guido@boring.UUCP (04/21/85)
We have just unpacked our copy of SUMacC (sp?) and I have successfully compiled, downloaded and run several programs like the 'example' that was recently posted to net.sources.mac (which actually shared a lot of code with 'Skel', also posted both in C and Pascal, without mentioning it as a source -- so I suspect a common ancestor or brutal theft :-). However, it strikes me that none of the examples uses any part of the 'standard I/O library'. In other words, no "printf", no "fopen", no "getchar", no what-have-you. I tried what would happen to the standard "Hello, world" program. I got no "undefined externals" errors, but sure enough, it bombed with ID=11. I would believe that I am missing something, except that I ran "nm68" on libc, and it contains no references to anything in libmac, which leads me to believe that this library was set up for another operating system (the Sun or the Motorola Exormacs?). Also, "fopen" did not exist in the library. Other evidence is the lack of a file "stdio.h" in the include library. So I am left with accepting that the Mac does not support "stdio". I recognize that the standard I/O library doesn't fit too well in the philosophy of the Mac's user interface standards, yet I can see a "niche" for it: it would immensely ease the initial phase of porting existing applications. The Mac OS supports all necessary functions (open, close, read, write, seek) so it would be easy to implement it, except for the fact that the screen and keyboard can't be accessed as ordinary files -- this could be cured, however, by introducing a "stdio window". I would like to receive any answers you have to the following questions: - Have I missed something, and is there a simple way to make printf c.s. behave properly? - If not, has someone already implemented stdio for the Mac OS, and are they willing to share it? - If not, I am probably going to do it myself. I am willing to share the code. However, I am not terribly eager to re-invent the wheel. - What is your opinion on the usefulness of stdio in the Mac environment? - What do other compilers offer in this area? - A related question: is it possible to write routines that are compatible with C's malloc, realloc and free (I expect to find these in the ANSI standard library, so they're not bound to Unix)? How? Send mail or post to the net as you find appropriate. Thanks in advance. Guido van Rossum, "Stamp Out BASIC Committee", CWI, Amsterdam guido@mcvax.UUCP (Who said the Macintosh made programming unnecessary? :-)
dimitrov@csd2.UUCP (Isaac Dimitrovsky) (04/22/85)
[] The Megamax C compiler seems to have most of the standard i/o library, as well as some extras (malloc/free, setjmp/longjmp). Isaac Dimitrovsky
jimb@amdcad.UUCP (Jim Budler) (04/23/85)
Consulair Mac C has most of the standard i/o (if not all, I haven't yet gotten that far) as well as a seperate library. So stdio is not incompatible with the Mac OS. It also has mallo, calloc and free implemented. -- Jim Budler Advanced Micro Devices, Inc. (408) 749-5806 UUCPnet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb Compuserve: 72415,1200