[comp.laser-printers] Porting METAFONT to the Pyramid

simpson@trwrb.UUCP (Scott Simpson) (07/24/87)

Has anyone out there ported METAFONT to a Pyramid under version 4.0
OSx?  METAFONT used to compile fine under OSx 3.1 but it seems that the
new Pyramid Pascal compiler will not allow you to pass an element of a
packed array by reference to a procedure (I reported it to Pyramid).
This causes a compilation error when the calledit() routine is called
with an element from str_pool.  I commented the call to this out and
compiled inimf but it goes in an infinite loop when it trys to read the
plain.mf file in.  You can't even interrupt inimf with ^C at this
point!  I am guessing that something in the parameter passing
convention has changed and some of the C files linked in need to be
changed.  If anyone has already solved this problem, I would appreciate
the change file and any other appropriate files needed.  Oh, our
version of /usr/lib/pcomp is 4.1.0 and our distribution tape contains
version 2.0 of TeX, 2.09 of LaTeX and 1.0 of METAFONT so it is
relatively current.
		Scott Simpson
		TRW Electronics and Defense Sector
		...{decvax,ihnp4,ucbvax}!trwrb!simpson

hedrick@TOPAZ.RUTGERS.EDU (Charles Hedrick) (08/06/87)

> new Pyramid Pascal compiler will not allow you to pass an element of a
> packed array by reference to a procedure (I reported it to Pyramid).

The Pascal standards do not allow an element of a packed array to be
passed by reference.  That it worked before might be called an
extension, but these sorts of minor extensions are generally regarded
as a bad idea.

simpson@trwrb.UUCP (Scott Simpson) (08/06/87)

A couple of weeks ago I requested a change file for METAFONT that would compile
under the OSx 4.0 Pascal compiler. (The old OSx 3.5 change file did not work).
I expect that many of you Pyramid sites have not upgraded to 4.0 OSx since I
did not receive any offers of a change file.  Consequently, I decided to get my
fingers dirty and fix the METAFONT change file myself.
	It seems that with this new release of the operating system, Pyramid
has made their compiler compatible with the ISO standard and packed array
elements can no longer be passed by reference.  This causes a compilation error
when str_pool is passed to the C calledit routine in TeX and METAFONT.  Since
the Pyramid pascal compiler packs character arrays anyway, you can simply
remove the packed keyword from the str_pool declaration in TeX and METAFONT.
This will enable both to compile and TeX will work fine but inimf will go
into an infinite loop when it tries to read in the plain.mf file.
	METAFONT needs a couple of more changes.  With the new pascal compiler,
you must declare eight bit bytes as 0..255 instead of -128..127 and you must
declare 16 bit half words as 0..65536 instead of -32768..32767.  Consequently,
you will need to set the following constants appropriately in the inimf change
file:
	mem_max=30000
	mem_min=0
	mem_top=30000
	min_quarterword=0
	max_quarterword=255
	min_halfword=0
	max_halfword=65536
Just change the values that are already there.  Inimf will now compile
correctly.  For virmf, I changed the value mem_max to 60000 in the ini_to_vir
script.
	Dvitype breaks too.  There is a bug in the pascal compiler that causes
expressions to sometimes be evaluated incorrectly.  (I reported it to Pyramid.)
In the routine signed_quad, the expression

	signed_quad := (((ord(a) - 256) * 256 + ord(b)) * 256 + ord(c)) * 256 
	+ ord(d);

does not evaluate correctly.  If you declare "i" and change this to

	begin
	    i := ((ord(a) - 256) * 256 + ord(b)) * 256 + ord(c);
	    signed_quad := i * 256 + ord(d);
	end;

dvitype works correctly.  Good luck!
		Scott Simpson
		TRW Space and Defense Sector
		...{decvax,ihnp4,ucbvax}!trwrb!simpson