rick@pcrat.UUCP (Rick Richardson) (05/18/88)
In article <1467@uop.edu> exodus@uop.edu (G.Onufer) writes: > >The OTHER Tex in C is called CTeX (I guess) or more likely tex-to-c. It >is a machine translation from the tex.web file to one or ten c files + headers >and extra.c. I brought up MetaFont with the "web2c" stuff from <morgan@ics.uci.edu>, and not without a little amazement that it worked at all. I couldn't bring up TeX, because "web2c" couldn't handle variant records (C unions). Furthermore, none of the adjunct programs have been converted to be buildable with "web2c". At this point, I said to myself why don't I try using "ptoc" on the "tangle"ed pascal. (ptoc was posted to the net a while back, it was written by Per Bergsten, accept no substitutes!). This method should avoid having special change files and extra C files to support "web2c" for each program that needs to be converted. After all, "ptoc" plus a C compiler is in theory a Pascal compiler. BTW, "ptoc" is written in Pascal, and can convert itself. It is a very large program, and you bootstrap via a supplied C translation. The system I'm using is a 386 running Interactive's 386ix, your mileage may vary. With a very few changes to "ptoc" (others keyword versus otherwise, rewind() returns void on SVR3, etc.), the adjunct programs built in a very straightforward way, e.g.: make mflib.a #Need supporting C routines #Repeat below for each adjunct tangle gftopk gftopk #Used SYS_V .ch file, make PASCAL ptoc <gftopk.p >gftopk.c #Make C cc gftopk.c mflib.a -o gftopk #Viola' The only gotcha I noticed was that the change files for the adjunct programs universally called argv() with a number one larger than they should have, e.g. argv(2,...) was supposed to pick up the argument in argv[1]!!!!! I hedged and used a little "sed" to fix this anomoly. I haven't tackled TeX yet by this method, but I think this approach is by far less error prone than either a human translation of the Pascal, or the "web2c" psuedo-translation. Also, thanks to all the people who offered to ftp the U of Wash tape to UUNET. Rick Adams picked it up already, as you can see. -- Rick Richardson, President, PC Research, Inc. (201) 542-3734 (voice, nights) OR (201) 834-1378 (voice, days) uunet!pcrat!rick (UUCP) rick%pcrat.uucp@uunet.uu.net (INTERNET)