[ont.micro.mac] porting unix programs to mac

info-mac@utcsrgv.UUCP (info-mac) (06/26/84)

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.

info-mac@utcsrgv.UUCP (info-mac) (06/27/84)

Date: Tue, 26 Jun 84 09:22:03 pdt
From: Bill Croft <uw-beaver!croft@safe>
To: info-mac@sumex, winkler@harvard
Subject: re: porting unix programs to mac
Cc: croft@SUMEX-AIM.ARPA


	"...and does not exceed sumacc's limit of
	one 32K segment..."

While it is true that SUMACC currently does not support overlays,
there is no limit on the size of the program (other than the amount
of physical memory).  Thus SUMACC programs on the current hardware
are limited to about 80K bytes.  

The 32K byte limit you mentioned DOES exist for Pascal (workshop)
segments, since these use PC-relative addressing, which is restricted
to +-32K offsets.

	--Bill