Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utcsrgv.UUCP Path: utzoo!utcsrgv!info-mac From: info-mac@utcsrgv.UUCP (info-mac) Newsgroups: ont.micro.mac Subject: porting unix programs to mac Message-ID: <4638@utcsrgv.UUCP> Date: Tue, 26-Jun-84 01:44:36 EDT Article-I.D.: utcsrgv.4638 Posted: Tue Jun 26 01:44:36 1984 Date-Received: Tue, 26-Jun-84 07:26:26 EDT Sender: peterr@utcsrgv.UUCP Organization: CSRI, University of Toronto Lines: 35 Date: Mon, 25 Jun 84 10:37:54 edt From: uw-beaver!winkler@harvard (Dan Winkler) To: info-mac@sumex Subject: porting unix programs to mac I've ported the Unix hangman game (and its entire 15,000 word dictionary) to the Mac using sumacc. Only minor changes were necessary. I had to remove the signal handling and replace the calls to the curses package by QuickDraw commands. The file i/o calls had direct analogs in the Mac file system and were easily adapted. Hangman doesn't use malloc, but if it had I could have replaced calls to malloc and free by the Mac's NewPtr and DisposePtr. Calls to realloc would be harder to fix since the Mac memory manager does not have the ability to extend a block without destroying its contents. I think the prospects are good for porting any Unix C program that runs in a single process and does not exceed sumacc's limit of one 32k segment, assuming it is clearly written. (Hangman is very well written, but I had previously started to port dc and gave up because the style was so convoluted.) In fact, I think it would be possible to develop a library of Unix system calls written for the Mac that would allow many Unix programs to run essentially unmodified on the Mac. Porting hangman's dictionary required some extra work because the form of the dictionary under Unix is a 15,000 line (140k byte) file with one word per line. MacTerminal will only save 2,000 lines off top. But after setting the MacTerminal linelength to 132 and reformatting the dictionary so that it put several words per line, this limit was not a problem. The largest file you can transfer this way is 2,000 X 132 = 264,000 bytes.