[comp.lang.c] "C" on Atari looks pretty wierd

gnu@hoptoad.uucp (John Gilmore) (12/23/86)

I have been saving most of the sources that float through the Atari and
Amiga newsgroups on the off chance that some of them might be portable
to other environments (e.g. GNU or Unix).  Things seem to be getting
worse rather than better as time goes on though.  I am now seeing things
that don't even look like C, e.g. this fragment from the recently posted
"Backup" program:

dirlen = strlen(dir) + 1;       /* Save length of pathname to this point */
strcat(dir, "\\*.*");   /* Start with 1st file          */
//cpynchar(alert6 + 4L, dir, 20);
//form_alert(1,alert6);

What are these job control cards doing in the middle of a C program?
Do Atari C compilers really accept these?  What do they do?

Also, the library routines used are almost totally bonkers.  E.g.
to open a file they use Fopen rather than fopen.  To read it's Fread.
To scan a directory it's Fsfirst and Fsnext rather than opendir and
readdir.  For malloc/free they even use Malloc/Mfree!  What was wrong
with the old names, did they make software too easy to port?

While I have my disagreements with the draft ANSI standard for C,
it would sure be better than this kind of wild change-for-change's-sake.
-- 
John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   jgilmore@lll-crg.arpa
Call +1 800 854 7179 or +1 714 540 9870 and order X3.159-198x (ANSI C) for $65.
Then spend two weeks reading it and weeping.  THEN send in formal comments! 

minow@decvax.UUCP (Martin Minow) (12/24/86)

In article <1587@hoptoad.uucp> gnu@hoptoad.uucp (John Gilmore) saw
some wierd C in Atari C postings:
>strcat(dir, "\\*.*");   /* Start with 1st file          */
>//cpynchar(alert6 + 4L, dir, 20);
>//form_alert(1,alert6);

Not on my C compiler (Mark Williams).  form_alert puts a dialog box
on the screen with a simple message with a few (1-3) alternatives, such
as "[icon][Really Delete File][No|Yes]"  ([icon] is 0 for none, 1 for
a "note" icon, 2 for "wait", and 3 for "stop").  form_alert saves
a piece of the screen, displays the message, waits for a button press,
and returns the choice.

>Also, the library routines used are almost totally bonkers.  E.g.
>to open a file they use Fopen rather than fopen.  To read it's Fread.
>To scan a directory it's Fsfirst and Fsnext rather than opendir and
>readdir.  For malloc/free they even use Malloc/Mfree!  What was wrong
>with the old names, did they make software too easy to port?

the Fxxx routines are direct calls to the operating system -- equivalent
to Unix section II routines (open, close, sbrk, etc.)  The file routines
return small integers (channel numbers) The language support libraries
also support <stdio> routines.  The low-level routines are useful if you
want to save space.

I've had little trouble porting programs from VMS/Unix/DecusC to the Atari.
Given the price (monochrome 1040's are under $800 now, Mark Williams C
is a bit over $100), the Atari developers did a very good job.

Martin Minow
decvax!minow

stephan@kontron.UUCP (Stephan W. Wendl) (12/24/86)

> Xref: kontron comp.sys.atari.st:478 comp.lang.c:489
> 
> Do Atari C compilers really accept these?  What do they do?
> 
> Also, the library routines used are almost totally bonkers.  E.g.
> to open a file they use Fopen rather than fopen.  To read it's Fread.
> To scan a directory it's Fsfirst and Fsnext rather than opendir and
> readdir.  For malloc/free they even use Malloc/Mfree!  What was wrong
> with the old names, did they make software too easy to port?
> 
> -- 
> John Gilmore  {sun,ptsfa,lll-crg,ihnp4}!hoptoad!gnu   jgilmore@lll-crg.arpa


I don't know about the '//' but the line behind references gem calls.

About the library routines: apearently there quite some bugs in the lib functions
and one way to get arround is to use macros which just convert into trap calls. 
That effectivly makes the program work and quite shorter in codesize.