home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / unixtex-6.1b-src.tgz / tar.out / contrib / unixtex / web2c / README < prev   
Text File  |  1996-09-28  |  18KB  |  473 lines

  1. This directory contains web2c, a system which converts TeX, Metafont,
  2. and other related WEB programs to C.  It is not a complete TeX
  3. distribution. Nor is it a general-purpose Pascal-to-C translator.
  4.  
  5. web2c is electronically distributed in two files: the web files, in
  6. web.tar.gz, and the web2c-specific files, in web2c.tar.gz. If you
  7. already have the web files for a particular Knuthian version, you need
  8. not re-retrieve them. web2c changes irregularly wrt Knuth's updates.
  9.  
  10. The file INSTALL contains installation instructions.
  11.  
  12. The file MACHINES contains a list of configurations that have passed the
  13. trip and trap test.  If your configuration is not on this list, you
  14. should build triptex and trapmf (instructions in INSTALL), and then send
  15. mail to tex-k@cs.umb.edu with the vital statistics, and, of course, any
  16. necessary changes, preferably in the form of context diffs, with
  17. ChangeLog entries.
  18.  
  19. The file PROBLEMS describes various difficulties people have
  20. encountered.  If you have trouble getting the distribution up, look here
  21. first.  Also look in ./MACHINES.
  22.  
  23. The files COPYING* describe copying conditions for some parts of
  24. this distribution.
  25.  
  26. If you know enough about TeX to be reading this, then you (or perhaps
  27. your institution) should consider joining the TeX Users Group.  TUG
  28. produces a periodical (TUGboat), sponsors an annual meeting (the
  29. proceedings of which are published as an issue of TUGboat), and arranges
  30. courses on TeX for all levels of users.  Given sufficient funding (which
  31. your joining will help), TUG could sponsor more projects that will
  32. benefit the TeX community (such as a successor to TeX $\pi$).  Here is
  33. the address:
  34.  
  35. TeX Users Group
  36. P.O. Box 869
  37. Santa Barbara, CA 93102
  38. USA
  39. phone: (805) 899-4673
  40. email: tug@tug.org
  41.  
  42.  
  43. Here is a table of contents for the rest of this file:
  44.    Changing constants
  45.    Format files and preloading
  46.    Directory hierarchies
  47.    Online output from Metafont
  48.    Porting and portability
  49.  
  50.  
  51.  
  52. Changing constants
  53. %%%%%%%%%%%%%%%%%%
  54.  
  55. The files tex/small.sed and mf/small.sed contain changes to the TeX and
  56. Metafont change files to produce programs using less memory, pool space,
  57. etc. than the defaults.  These patches are applied automatically by
  58. `configure' when you define `SMALLTeX' resp. `SMALLMF' in c-auto.h.in.
  59. The TeX/MF that results will have a larger text segment and run slower,
  60. because it has to convert frequently between 16-bit and 32-bit integers.
  61. On the other hand, the binary will need less swap space.
  62.  
  63. Similarly, the file bibtex/small.sed changes some of the constants in
  64. the default BibTeX to smaller values.  The default values are necessary
  65. for some databases (see math.utah.edu:pub/tex/bib), but are rather large.
  66.  
  67. If configure fails to apply the patches, you can do so yourself with, e.g.:
  68. % cd tex; sed -f small.sed < tex.ch > ctex.ch
  69.  
  70. I recommend the GNU version of patch, available from
  71. prep.ai.mit.edu:pub/gnu and many other archives.
  72.  
  73. If you want to have more than 256 fonts, you might try this patch.  I
  74. haven't installed it in the main change file because it requires
  75. changing max_quarterword. (This patch will not apply cleanly to the
  76. current sources, but it should be easy enough to fix up. If you do so,
  77. please send me the corrected version.)
  78.  
  79.  
  80. From: Bernd Raichle <raichle@azu.informatik.uni-stuttgart.de>
  81. Date: Mon, 18 May 92 13:27:13 +0200
  82.  
  83. I have applied these diffs to web2c 5.851b with a corrected
  84. WORDS_BIGENDIAN configuration file and *no* changes to `texmfmem.h'.
  85. (Changes are only needed for little-endian machines.)
  86.  
  87. The changed bigTeX is able to load more than 284 fonts before the
  88. font_mem of 100.000 words overflows (it's a good idea to increment
  89. `font_mem_size' when using more than 256 fonts).  `xdvi' and `dvips'
  90. can print the resulted dvi file without problem.
  91.  
  92. The new constant `max_font_max' is necessary, if you want different
  93. values of `font_max' in initex and virtex. (`max_font_max' is the
  94. space reserved in eqtb[] for the font identifiers; in the original
  95. source there is space for 256 font identifier.)
  96.  
  97. *** ctex.ch.ORIG    Fri May 15 12:50:08 1992
  98. --- ctex.ch-32fonts    Fri May 15 15:20:28 1992
  99. ***************
  100. *** 192,195 ****
  101.     can be going on simultaneously}
  102. ! @!font_max=255; {maximum internal font number; must not exceed |max_quarterword|
  103. !   and must be at most |font_base+256|}
  104.   @!font_mem_size=100000; {number of words of |font_info| for all fonts}
  105. --- 192,195 ----
  106.     can be going on simultaneously}
  107. ! @!font_max=450; {maximum internal font number; must not exceed |max_quarterword|
  108. !   and must be at most |font_base+max_font_max|}
  109.   @!font_mem_size=100000; {number of words of |font_info| for all fonts}
  110. ***************
  111. *** 250,251 ****
  112. --- 250,252 ----
  113.   @d hyph_size=607 {another prime; the number of \.{\\hyphenation} exceptions}
  114. + @d max_font_max=512 {maximum number of internal fonts}
  115.   @z
  116. ***************
  117. *** 721,723 ****
  118.   @d min_quarterword=0 {smallest allowable value in a |quarterword|}
  119. ! @d max_quarterword=255 {largest allowable value in a |quarterword|}
  120.   @d min_halfword==0 {smallest allowable value in a |halfword|}
  121. --- 722,724 ----
  122.   @d min_quarterword=0 {smallest allowable value in a |quarterword|}
  123. ! @d max_quarterword==65535 {largest allowable value in a |quarterword|}
  124.   @d min_halfword==0 {smallest allowable value in a |halfword|}
  125. ***************
  126. *** 726,727 ****
  127. --- 727,737 ----
  128.   
  129. + % [8.111]
  130. + @x
  131. + if font_max>font_base+256 then bad:=16;
  132. + @y
  133. + if (max_font_max<min_quarterword)or(max_font_max>max_quarterword) then bad:=15;
  134. + if font_max>font_base+max_font_max then bad:=16;
  135. + @z
  136.   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  137. ***************
  138. *** 870,871 ****
  139. --- 880,888 ----
  140.   
  141. + % [x.222]
  142. + @x
  143. + @d undefined_control_sequence=frozen_null_font+257 {dummy location}
  144. + @y
  145. + @d undefined_control_sequence=frozen_null_font+max_font_max+1 {dummy location}
  146. + @z
  147.   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  148. ***************
  149. *** 1203,1204 ****
  150. --- 1220,1256 ----
  151.   bytes at a time.
  152. + @z
  153. + % [x.602]
  154. + @x
  155. + @p procedure dvi_font_def(@!f:internal_font_number);
  156. + var k:pool_pointer; {index into |str_pool|}
  157. + begin dvi_out(fnt_def1);
  158. + dvi_out(f-font_base-1);@/
  159. + @y
  160. + @p procedure dvi_font_def(@!f:internal_font_number);
  161. + var k:pool_pointer; {index into |str_pool|}
  162. + begin if f<=256+font_base then
  163. +   begin dvi_out(fnt_def1);
  164. +   dvi_out(f-font_base-1);
  165. +   end
  166. + else begin dvi_out(fnt_def1+1);
  167. +   dvi_out((f-font_base-1) div @'400);
  168. +   dvi_out((f-font_base-1) mod @'400);
  169. +   end;
  170. + @z
  171. + % [x.622]
  172. + @x
  173. + if f<=64+font_base then dvi_out(f-font_base-1+fnt_num_0)
  174. + else  begin dvi_out(fnt1); dvi_out(f-font_base-1);
  175. +   end;
  176. + @y
  177. + if f<=64+font_base then dvi_out(f-font_base-1+fnt_num_0)
  178. + else if f<=256+font_base then
  179. +   begin dvi_out(fnt1); dvi_out(f-font_base-1);
  180. +   end
  181. + else begin dvi_out(fnt1+1);
  182. +   dvi_out((f-font_base-1) div @'400);
  183. +   dvi_out((f-font_base-1) mod @'400);
  184. +   end;
  185.   @z
  186.  
  187.  
  188. Here is another patch you might like to apply, this one to make the
  189. font_info structure take less space.
  190.  
  191. Date: Tue, 7 Sep 93 10:30:50 BST
  192. From: wgs@maths.ucd.ie (Wayne G. Sullivan)
  193.  
  194. In moving from 5.851c to 5.851d I decided to try an idea which has been
  195. lurking in the subconcious for some time. Four byte words suffice for
  196. the font_info array, so I defined a union fmemory_word scaled/qqqq. It
  197. took a bit of fiddling and I had to use a hack: I defined fmemory_word
  198. in the pascal file as a struct which was included in ifdef/endif so as
  199. not to be seen by c, and gave the union def in texmfmem.h. Anyway it
  200. seems to work and does not involve much effort. The only other changes
  201. needed are in the declaration of font_info and in the debug procedure
  202. which prints out all forms of a memory word -- actually, one should
  203. not call this procedure for entries in font_info. The point in making
  204. this change is that the tex program uses less memory and formats files
  205. are about 15% smaller, depending on the font data stored. Though I have
  206. done no timing tests, there should be no speed difference.
  207.  
  208.  
  209. diff texmfmem.h texmfmem.h.wgs ==>
  210. 113a114,120
  211. > typedef union {
  212. >     integer cint ;
  213. >   fourquarters qqqq ;
  214. > } fmemoryword  ;
  215. >
  216. >
  217. >
  218.  
  219.  
  220. diff tex.ch tex.ch.wgs ==>
  221. 798a799,802
  222. > ifdef('STUFFTOOMIT')
  223. > @!fmemory_word=record cint:integer; qqqq: four_quarters; end;
  224. > endif('STUFFTOOMIT')
  225. >
  226. 1177a1182,1190
  227. > @x 10682 m.549
  228. > @!font_info:array[font_index] of memory_word;
  229. >   {the big collection of font data}
  230. > @y  10683
  231. > @!font_info:array[font_index] of fmemory_word;
  232. >   {the big collection of font data}
  233. > @z
  234. >
  235. >
  236. 1963a1977,1993
  237. >
  238. >
  239. > @x 24397 m.1339
  240. > 5: print_word(font_info[n]);
  241. > @y  24397
  242. > 5:
  243. > begin
  244. > print_scaled(font_info[n].sc); print_char(" ");@/
  245. > print_int(font_info[n].qqqq.b0); print_char(":");@/
  246. > print_int(font_info[n].qqqq.b1); print_char(":");@/
  247. > print_int(font_info[n].qqqq.b2); print_char(":");@/
  248. > print_int(font_info[n].qqqq.b3);
  249. > end;
  250. > @z
  251.  
  252.  
  253.  
  254. Format files and preloading
  255. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  256.  
  257. TeX (and Metafont; I'll talk about TeX, but MF is completely analogous)
  258. can write its memory to a file; such a file is called a ``format file''.
  259. Why is this interesting?  Because TeX can read a format file much faster
  260. than the source file that gave rise to it.
  261.  
  262. To create a format file, you give the command `\dump' to initex after
  263. reading the source file.  (This is more or less the raison d'etre for
  264. initex.)  For example:
  265. prompt$ initex
  266. This is TeX, C Version 3.0
  267. **plain \dump
  268. <blurbs>
  269. Starting to dump on file plain.fmt
  270. <more blurbs>
  271.  
  272. Voila, you have a plain.fmt you can install somewhere with `make
  273. install-formats' (or cp, or whatever).
  274.  
  275. The `formats' target in ./Makefile and tex/Makefile does the above for the
  276. formats defined by the make variable $(formats).
  277.  
  278. Unlike all the other files in the TeX world, format files are not
  279. perfectly portable.  web2c itself writes the format files in BigEndian
  280. order (if NO_FMTBASE_SWAP is left undefined); for formats which do not
  281. dump any floating-point (e.g., |glue_ratio|) information, this suffices
  282. to make them portable across architectures.  Most formats (including
  283. plain) do not do this.  But you should always check.  (If you do compare
  284. format files dumped on different architectures, don't be alarmed by a
  285. few bytes' difference -- the date is also in the .fmt file.)
  286.  
  287. Well, I said Metafont is completely analogous, but you actually need to
  288. do a little more: create a file that defines your local output devices
  289. (i.e., ``mode_defs'').  A collection of most existing Metafont modes is
  290. available by ftp from ftp.cs.umb.edu:pub/tex/modes.mf, or by email from
  291. me, karl@cs.umb.edu.  Using modes.mf for your local modes wastes a
  292. little bit of Metafont's memory (because it defines modes which you will
  293. almost certainly never use), but it has several advantages: you can be
  294. sure that your fonts will be identical to others'; you get extra
  295. information added to your fonts; you don't have to experiment to find
  296. your own settings.  modes.mf also explains what goes into a mode_def,
  297. and how to use Metafont with different devices.
  298.  
  299. Once you have such a file, you say something like the following:
  300. prompt$ inimf
  301. This is METAFONT, C Version 2.0
  302. **plain
  303. <blurbs>
  304. *input modes
  305. <blurbs>
  306. *dump
  307. <final blurbs>
  308.  
  309. and you should have a file `plain.base', analogous to TeX's `plain.fmt'.
  310.  
  311. The target `bases' in ./Makefile and mf/Makefile does the above for the
  312. bases defined by the make variable $(bases).
  313.  
  314. TeX uses the name it was invoked with to figure out what format file to
  315. read.  Therefore, for each format file, you should create a link to the
  316. virtex executable named the name of the format file.  For example:
  317.     cd $(bindir)
  318.     ln virtex tex
  319.     ln virtex latex
  320.     ln virtex texinfo
  321.  
  322. Then, when you run, say,
  323. texinfo
  324. TeX looks for a format file named `texinfo.fmt'.
  325. All of this goes for Metafont, too.
  326. The Makefile tries to install these links automatically.
  327.  
  328. One more thing about format (and base) files: It is possible to
  329. ``preload'' TeX, i.e., avoid reading the .fmt file at runtime.  However,
  330. on most modern machines, you don't gain a lot of startup time, and you
  331. lose a lot of disk space.  Furthermore, different flavors of TeX will
  332. not have their code segments shared.  Therefore, it is probably best not
  333. to preload unless, of course, it takes your machine eons to load a
  334. format file.
  335.  
  336. You may be wondering what the formats listed in ./Makefile are.  Here is
  337. a brief description:
  338.  
  339. tex:
  340.         from plain.tex; described in the TeXbook.  The Makefile also
  341.         installs tex.fmt as plain.fmt, so that the constructions
  342.         described in the TeXbook will work.  Canonical source is
  343.         labrea.stanford.edu.
  344. latex:
  345.     from lplain.tex and latex.tex; described in the LaTeX manual,
  346.         by Leslie Lamport, published by Addison-Wesley.  Best
  347.         source is rusmv1.rus.uni-stuttgart.de.
  348. slitex:
  349.     LaTeX for making slides; also described in the LaTeX manual.
  350. texinfo:
  351.     from texinfo.tex; almost-completely logical markup (much more so
  352.         than LaTeX); can be translated into an Info document, which is
  353.         readable online.  Described in documentation that comes with the
  354.         macros.  Canonical source is prep.ai.mit.edu.
  355. amstex:
  356.         from amstex.tex; especially for mathematical papers; described
  357.         in the Joy of TeX, by Michael Spivak, published by the American
  358.         Mathematical Society.  Canonical source is e-math.ams.com.
  359. amslatex:
  360.     a combination of AMSTeX and LaTeX; incompatible with the
  361.         original LaTeX, because it uses Mittelbach and Schoepf's ``new
  362.         font selection scheme''.  Described in documentation that comes
  363.         with the macros.  Canonical source is e-math.ams.com.
  364. etex:
  365.         from eplain.tex; macros for common facilities that plain does
  366.         not have, e.g., symbolic cross-referencing.  Described in
  367.         documentation that comes with the macros.  Canonical source is
  368.         ftp.cs.umb.edu.
  369. inrstex:
  370.     from inrstex.tex; an alternative to LaTeX, with excellent
  371.         support for non-English supports.  Described in documentation
  372.         that comes with the macros.  Canonical source is
  373.         aldebaran.ee.mcgill.ca.
  374. picplus:
  375.         from picplus.tex; helps to make pictures; described in the
  376.         PiCTeX manual, by Michael Wichura, published by the TeX Users
  377.         Group.
  378.  
  379. You can get more information about these packages and order the manuals
  380. from tug@math.ams.org.
  381.  
  382.  
  383.  
  384. Directory hierarchies
  385. %%%%%%%%%%%%%%%%%%%%%
  386.  
  387. TeX and its friends use many different sorts of files: fonts, macros,
  388. format dumps, pool files, etc.  When you install TeX, you have to decide
  389. how everything should be organized.
  390.  
  391. The most painful thing to organize is the fonts.  There are both the
  392. .tfm files, which TeX and some DVI-readers need, and the PXL/GF/PK
  393. files, one for each point size and resolution, which only the
  394. DVI-readers look at.  Here are some of the common approaches:
  395.  
  396. 1) Put everything in one directory, say /usr/local/lib/tex/fonts. 
  397. Advantages: it's simple; everything is together; it's easy to tell if a
  398. particular file exists.  Disadvantage: the directory is huge.
  399.  
  400. 2) Put each set of pixel files at a given resolution (i.e.,
  401. magnification) in a different directory, and put the TFM files in
  402. another directory.  Advantage: the directories are smaller. 
  403. Disadvantage: the files for any given typeface are not together.
  404.  
  405. 3) Put each typeface family in a different subdirectory; e.g., have
  406. subdirectories `cm' (Computer Modern), `pandora', `euler', etc.
  407. Advantage: the files for a given typeface are together.  Disadvantage:
  408. many DVI-readers will not automatically look in subdirectories of
  409. TEXFONTS.  However, dvips (perhaps the most widely used
  410. dvi-to-PostScript translator), and xdvi (a previewer running under X11)
  411. both know how to search subdirectories, and I've modified them to use
  412. the same algorithm as TeX and friends; my modified versions are on
  413. ftp.cs.umb.edu:pub/tex.
  414.  
  415. See tex.man for more details on path searching.
  416.  
  417. #3 is the default organization in the Makefiles as distributed.
  418. See the file kpathsea/HIER for additional information.
  419.  
  420.  
  421.  
  422. Online output from Metafont
  423. %%%%%%%%%%%%%%%%%%%%%%%%%%%
  424.  
  425. Metafont in C can be compiled to support multiple window systems.  You
  426. say which you want via definitions in `c-auto.h.in'.
  427.  
  428. There are two versions of the X11 support in mf/MFwindow.  One is based
  429. on Xt, one on Xlib.  The Xt version is faster and has more
  430. functionality, so if it works on your system, you should use it.  It is
  431. the default.  But if it fails, you can try the Xlib version.
  432.  
  433. There are also two versions of the Sun support in mf/MFwindow.  One is
  434. based on Sunview, the other on Suntools (i.e., the gfx_hs structure).
  435. The former has more functionality, and it works on recent versions of
  436. SunOS, so it is the default.
  437.  
  438. Defining more devices is fairly straightforward.  Put the new file with
  439. the actual device support in mf/MFwindow.  Then add another entry to the
  440. tables at the end of `lib/texmf.c'; that should be it.
  441.  
  442.  
  443.  
  444. Porting and portability
  445. %%%%%%%%%%%
  446.  
  447. The C code generated by the web2c translator is intended to be as
  448. portable as possible.  If you find bugs or portability problems with the
  449. generated code, report them to karl@cs.umb.edu.
  450.  
  451. The generated code assumes that the type `short' has at least the range
  452. -32768..32767, and that `unsigned short' has at least the range
  453. 0..65535.  If this isn't the case, the translator will have to be modified.
  454.  
  455. Since the code is generated automatically, it is foolish to edit it by
  456. hand.  Instead, you should fix the `web2c' program, or perhaps add
  457. commands to the `convert' scripts.  (And you should also report your
  458. changes to the bug address in ../README.)
  459.  
  460. On another front, the `convert' scripts assume some basic Unix
  461. utilities: basename, cat, cp, diff, ln, make, mv, rm, sed, and touch.
  462. The Bourne shell is also assumed.  If your system versions are broken,
  463. you can try the GNU versions, available by anonymous ftp from
  464. prep.ai.mit.edu in pub/gnu, among many other places.  The GNU C compiler
  465. is also better (more reliable, faster, and produces better code) than
  466. many other C compilers, so you might want to get that.  For more
  467. information about the GNU project, write to gnu@prep.ai.mit.edu.
  468.