Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

A place to discuss general QL issues.
User avatar
ql_freak
Super Gold Card
Posts: 543
Joined: Sun Jan 18, 2015 1:29 am

Re: Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

Post by ql_freak »

Derek_Stewart wrote: Fri Jul 11, 2025 7:33 am Hi,

The source code to C68 is available, could that be enhanced to produce reentrant code?
Hi Derek,

look in the current C68 manual. C68 can produce reentrant code, with similar options as in Lattice C. (Code size with all static variables/data restricted to 32 or 64 KByten, not sure).

The question is: Has these (available) options from C68 been tested in the QDOS version of C68. They are not used in the libraries delivered with C68 (and so the code is not tested). Lattice was the most famous compiler at tits time, (Atari, Amiga, DOS, embedded, ...) and so it's reentrant options seem to work (Erling has even implemented a full K&R compatible library for the QL). But is this true for C68? Has anyone tried these options and has checked the produced code?


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
bwinkel67
QL Wafer Drive
Posts: 1552
Joined: Thu Oct 03, 2019 2:09 am

Re: Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

Post by bwinkel67 »

tofro wrote: Fri Jul 11, 2025 9:52 am ...

"Pure" programs are programs that can be started through the Hotkey System multiple times and can share the same instance of code, but have a private data space - They have basically the same restrictions as ROMable code.

...

"Impure" programs are in no way any "worse" than "Pure" ones. Just different. There is actually not much point to desire only "pure" programs on the QL - You have to invest a large amount of effort if you aim for them in anything but assembly. And, I'd rather have a working, "impure" one, than a non-finished "pure" one.....
That was a very informative rundown. One question, if you EXEC the same program twice, I'm assuming the code isn't shared and each process runs its own copy.


User avatar
tofro
Font of All Knowledge
Posts: 3148
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

Post by tofro »

ql_freak wrote: Tue Jul 15, 2025 1:32 am
The question is: Has these (available) options from C68 been tested in the QDOS version of C68. They are not used in the libraries delivered with C68 (and so the code is not tested). Lattice was the most famous compiler at tits time, (Atari, Amiga, DOS, embedded, ...) and so it's reentrant options seem to work (Erling has even implemented a full K&R compatible library for the QL). But is this true for C68? Has anyone tried these options and has checked the produced code?
I have and it works (with a few quirks). You need your own startup code and your own libraries (simply re-compiling is not enough, as some libs use static variables)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
tofro
Font of All Knowledge
Posts: 3148
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

Post by tofro »

bwinkel67 wrote: Tue Jul 15, 2025 4:48 am
tofro wrote: Fri Jul 11, 2025 9:52 am ...

"Pure" programs are programs that can be started through the Hotkey System multiple times and can share the same instance of code, but have a private data space - They have basically the same restrictions as ROMable code.

...

"Impure" programs are in no way any "worse" than "Pure" ones. Just different. There is actually not much point to desire only "pure" programs on the QL - You have to invest a large amount of effort if you aim for them in anything but assembly. And, I'd rather have a working, "impure" one, than a non-finished "pure" one.....
That was a very informative rundown. One question, if you EXEC the same program twice, I'm assuming the code isn't shared and each process runs its own copy.
The code sharing between multiple instances of "pure" programs works with the HOTKEY system only. Simply EXECing the program twice creates two instances (EXEC can't now what you're running now is the same that you started ten seconds ago and has no correlation between the two).


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
ql_freak
Super Gold Card
Posts: 543
Joined: Sun Jan 18, 2015 1:29 am

Re: Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

Post by ql_freak »

tofro wrote: Tue Jul 15, 2025 6:08 am
ql_freak wrote: Tue Jul 15, 2025 1:32 am
The question is: Has these (available) options from C68 been tested in the QDOS version of C68. They are not used in the libraries delivered with C68 (and so the code is not tested). Lattice was the most famous compiler at tits time, (Atari, Amiga, DOS, embedded, ...) and so it's reentrant options seem to work (Erling has even implemented a full K&R compatible library for the QL). But is this true for C68? Has anyone tried these options and has checked the produced code?
I have and it works (with a few quirks). You need your own startup code and your own libraries (simply re-compiling is not enough, as some libs use static variables)
This is very nice to hear :-D Static variables are possible. There is an option for it in C68 (as in Lattice C), but then the code size (or size of static data? Not sure) is restricted to 32 or 64 KBytes (this is also the case with EJC if you want to create reentrant [pure] code).

Not really a problem for programs which should be pure (can be HOT_CHPed without the Igitit option). My rn program (created with EJC) is about 12.5 KBytes - and it does some complicated stuff, a "hello world" (i.e. with included <stdio.h>) is less than 9 KBytes :-)


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
ql_freak
Super Gold Card
Posts: 543
Joined: Sun Jan 18, 2015 1:29 am

Re: Contact to Metacomco (and Lattice!) because of their C Development Kit? (The Lattice C compiler)

Post by ql_freak »

tofro wrote: Tue Jul 15, 2025 6:11 am The code sharing between multiple instances of "pure" programs works with the HOTKEY system only.
But you can make an executable Thing from any executable program (with e.g. HOT_CHP) and there is EXEP (which unfortunately doesn't support all the features of EX), but AFAIK at least command strings can be passed with EXEP. And EXEP can start executable Things(!). So it should be possible, to HOT_CHP a program, which must be started more than once and then call it with EXEP from your program.

IMPORTANT NOTE: With impure (Igitit option) programs you must use HOT_CHP1 or use the "I" option in HOT_CHP! All C programs (except those compiled with EJC in standard config) are impure programs. BTW: All PSION (office) programs are pure programs(!). I don't know if XCHANGE is also a pure program (but as it can load multiple documents, it doesn't need this feature IMHO).


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
Post Reply