diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /systems/knuth/local/texware-sparc |
Initial commit
Diffstat (limited to 'systems/knuth/local/texware-sparc')
-rw-r--r-- | systems/knuth/local/texware-sparc/Makefile | 39 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/access.c | 19 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/dvityext.c | 150 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/dvityext.h | 11 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/dvitype.ch | 497 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/pltotf.ch | 135 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/pooltype.ch | 70 | ||||
-rw-r--r-- | systems/knuth/local/texware-sparc/tftopl.ch | 206 |
8 files changed, 1127 insertions, 0 deletions
diff --git a/systems/knuth/local/texware-sparc/Makefile b/systems/knuth/local/texware-sparc/Makefile new file mode 100644 index 0000000000..3478169052 --- /dev/null +++ b/systems/knuth/local/texware-sparc/Makefile @@ -0,0 +1,39 @@ +# Make executable files for this workstation, using the master TeX sources + +PFLAGS= -O -I.. -temp=. +CFLAGS= -O -I.. +PC= time pc + +all: pooltype tftopl pltotf dvitype + +%.p: %.ch + tangle ../../dist/texware/$*.web $*.ch + mv ../../dist/texware/$*.p . + +%.ch: ../../dist/texware/%.web + touch $*.ch + +%.o: %.p + ${PC} ${PFLAGS} -c $*.p + +pooltype: pooltype.o + ${PC} ${PFLAGS} -o pooltype pooltype.o + +tftopl: tftopl.o access.o + ${PC} ${PFLAGS} -o tftopl tftopl.o access.o + +pltotf: pltotf.o access.o + ${PC} ${PFLAGS} -o pltotf pltotf.o access.o + +dvitype: dvitype.o dvityext.o dvityext.h + ${PC} ${PFLAGS} -o dvitype dvitype.o dvityext.o + +dvityext.o: dvityext.c ../h00vars.h ../texpaths.h + +access.o: access.c + +install: # doit make install "PROG=dvitype" + mv $(PROG) /usr/local/bin/$(PROG) + +clean: + rm -f *.p *.o *~ ../../dist/texware/*.pool diff --git a/systems/knuth/local/texware-sparc/access.c b/systems/knuth/local/texware-sparc/access.c new file mode 100644 index 0000000000..af3e5de5e2 --- /dev/null +++ b/systems/knuth/local/texware-sparc/access.c @@ -0,0 +1,19 @@ +#include "h00vars.h" /* defines Pascal I/O structure */ + +#define namelength 100 /* must agree with tftopl.ch and pltotf.ch */ + +bool testreadaccess(fn) + char *fn; +{ + register char *p; + + fn[namelength-1] = ' '; + p = fn; + while (*p++ != ' '); + p--; + *p = '\0'; + if (access(fn,4)==0) { + *p = ' '; return(TRUE);} + else {*p = ' '; return(FALSE);} +} + diff --git a/systems/knuth/local/texware-sparc/dvityext.c b/systems/knuth/local/texware-sparc/dvityext.c new file mode 100644 index 0000000000..38c1d45159 --- /dev/null +++ b/systems/knuth/local/texware-sparc/dvityext.c @@ -0,0 +1,150 @@ +/* External procedures for dvitype */ +/* Written by: H. Trickey, 2/19/83 (adapted from TeX's ext.c) */ + +#include "texpaths.h" /* defines default TEXFONTS path */ +#include "h00vars.h" /* defines Pascal I/O structure */ + +char *fontpath; + +char *getenv(); + +/* + * setpaths is called to set up the pointer fontpath + * as follows: if the user's environment has a value for TEXFONTS + * then use it; otherwise, use defaultfontpath. + */ +setpaths() +{ + register char *envpath; + + if ((envpath = getenv("TEXFONTS")) != NULL) + fontpath = envpath; + else + fontpath = defaultfontpath; +} + +#define namelength 100 /* should agree with dvitype.ch */ +extern char curname[],realnameoffile[]; /* these have size namelength */ + +/* + * testaccess(amode,filepath) + * + * Test whether or not the file whose name is in the global curname + * can be opened for reading (if mode=READACCESS) + * or writing (if mode=WRITEACCESS). + * + * The filepath argument is one of the ...FILEPATH constants defined below. + * If the filename given in curname does not begin with '/', we try + * prepending all the ':'-separated areanames in the appropriate path to the + * filename until access can be made, if it ever can. + * + * The realnameoffile global array will contain the name that yielded an + * access success. + */ + +#define READACCESS 4 +#define WRITEACCESS 2 + +#define NOFILEPATH 0 +#define FONTFILEPATH 3 + +bool +testaccess(amode,filepath) + int amode,filepath; +{ + register bool ok; + register char *p; + char *curpathplace; + int f; + + switch(filepath) { + case NOFILEPATH: curpathplace = NULL; break; + case FONTFILEPATH: curpathplace = fontpath; break; + } + if (curname[0]=='/') /* file name has absolute path */ + curpathplace = NULL; + do { + packrealnameoffile(&curpathplace); + if (amode==READACCESS) + /* use system call "access" to see if we could read it */ + if (access(realnameoffile,READACCESS)==0) ok = TRUE; + else ok = FALSE; + else { + /* WRITEACCESS: use creat to see if we could create it, but close + the file again if we're OK, to let pc open it for real */ + f = creat(realnameoffile,0666); + if (f>=0) ok = TRUE; + else ok = FALSE; + if (ok) + close(f); + } + } while (!ok && curpathplace != NULL); + if (ok) { /* pad realnameoffile with blanks, as Pascal wants */ + for (p = realnameoffile; *p != '\0'; p++) + /* nothing: find end of string */ ; + while (p < &(realnameoffile[namelength])) + *p++ = ' '; + } + return (ok); +} + +/* + * packrealnameoffile(cpp) makes realnameoffile contain the directory at *cpp, + * followed by '/', followed by the characters in curname up until the + * first blank there, and finally a '\0'. The cpp pointer is left pointing + * at the next directory in the path. + * But: if *cpp == NULL, then we are supposed to use curname as is. + */ +packrealnameoffile(cpp) + char **cpp; +{ + register char *p,*realname; + + realname = realnameoffile; + if ((p = *cpp)!=NULL) { + while ((*p != ':') && (*p != '\0')) { + *realname++ = *p++; + if (realname == &(realnameoffile[namelength-1])) + break; + } + if (*p == '\0') *cpp = NULL; /* at end of path now */ + else *cpp = p+1; /* else get past ':' */ + *realname++ = '/'; /* separate the area from the name to follow */ + } + /* now append curname to realname... */ + p = curname; + while (*p != ' ') { + if (realname >= &(realnameoffile[namelength-1])) { + fprintf(stderr,"! Full file name is too long\n"); + break; + } + *realname++ = *p++; + } + *realname = '\0'; +} + +int flength(filep) + register struct iorec *filep; +{ + register FILE *iop; /* stdio-style FILE pointer */ + register long pos; /* current file position */ + register int len; /* the file length */ + + iop = filep->fbuf; + pos = ftell(iop); + fseek(iop,0L,2); + len = ftell(iop); + fseek(iop,pos,0); + return(len); +} + +bseek(filep,cnt) + register struct iorec *filep; + int cnt; +{ + register FILE *iop; /* stdio-style FILE pointer */ + + iop = filep->fbuf; + fseek(iop,(long)cnt,0); +} + diff --git a/systems/knuth/local/texware-sparc/dvityext.h b/systems/knuth/local/texware-sparc/dvityext.h new file mode 100644 index 0000000000..d177f6fe7e --- /dev/null +++ b/systems/knuth/local/texware-sparc/dvityext.h @@ -0,0 +1,11 @@ +procedure setpaths; + external; + +function testaccess(accessmode:integer; filepath:integer): boolean; + external; + +function flength(var f: bytefile):integer; + external; + +procedure bseek(var f: bytefile; loc: integer); + external; diff --git a/systems/knuth/local/texware-sparc/dvitype.ch b/systems/knuth/local/texware-sparc/dvitype.ch new file mode 100644 index 0000000000..a2ce230dd7 --- /dev/null +++ b/systems/knuth/local/texware-sparc/dvitype.ch @@ -0,0 +1,497 @@ +% Change file for the DVItype processor, for use on Berkeley UNIX systems. +% This file was created by Howard Trickey, CSD.Trickey@SCORE, and modified +% by Pavel Curtis, Pavel@Cornell. + +% History: +% ?? (HT) Original version. +% 4/4/83 (PC) Merged with Pavel's change file and made to work with the +% version 1.0 of DVItype released with version 0.95 of TeX in +% February, 1983. +% 4/18 (PC) Added changes to module 47 so that it would work the same +% when input was a file (or pipe) as with a terminal. +% 6/29 (HWT) Brought up to version 1.1 as released with version 0.99 of +% TeX, with new change file format +% 7/28 (HWT) Brought up to version 2 as released with version 0.999. +% Only the banner changes. +% 11/21 (HWT) Brought up to version 2.2 as released with version 1.0. +% 2/19/84 (HWT) Made it use TEXFONTS environment. +% 3/23/84 (HWT) Brought up to version 2.3. +% 7/11/84 (HWT) Brought up to version 2.6 as released with version 1.1. +% 8/4/84 (RKF) To version 2.7 +% 9/3/85 (RKF) To version 2.8 +% 12/5/87 (PAM) To version 2.9 +% 8/10/89 (don) Cosmetic change for SunOS; moved usage test +% 10/15/89 (don) Fixed input_ln so that initial newline isn't lost +% 10/18/89 (don) Enabled random reading +% 10/30/89 (don) To version 3 +% 11/18/89 (don) To version 3.1 +% 1/2/90 (don) To version 3.2 +% 5/17/90 (don) To version 3.3 +% 9/6/90 (don) To version 3.4 +% 3/7/95 (don) To version 3.5 +% 12/28/95 (don) To version 3.6 +% 12/23/96 (don) Identified the TFM file that was missing + +% The section numbers used in this file refer to those in the standard +% TeXware report (CS1097). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [0] WEAVE: print changes only +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +\pageno=\contentspagenumber \advance\pageno by 1 +@y +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iffalse +\def\title{DVI$\,$\lowercase{type} changes for SunOS} +@z +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [1] Change banner string +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d banner=='This is DVItype, Version 3.6' {printed when the program starts} +@y +@d banner=='This is DVItype, Version 3.6 for SunOS' + {printed when the program starts} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [2] Use default case statement feature of SunOS Pascal +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d othercases == others: {default for cases not listed explicitly} +@y +@d othercases == otherwise {default for cases not listed explicitly} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [3] Change filenames in program statement; add #include statement +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d print(#)==write(#) +@d print_ln(#)==write_ln(#) + +@p program DVI_type(@!dvi_file,@!output); +@y +For Berkeley {\mc UNIX}, we need the name |output| for the dialog, so make +the output come out on a file called |'dvitype.out'|. + +@d print(#)==write(dvityout,#) +@d print_ln(#)==write_ln(dvityout,#) + +@p program DVI_type(@!input,@!output); +@z + +@x +var @<Globals in the outer block@>@/ +@y +var @<Globals in the outer block@>@/ +@\@=#include "dvityext.h"@>@\ {declarations for external C procedures} +@z + +@x + begin print_ln(banner);@/ +@y + begin + setpaths; {read environment, to find TEXFONTS, if there} + rewrite(dvityout,'dvitype.out'); {prepare typescript for output} + print_ln(banner);@/ +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [5] Increase name_length +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@!name_length=50; {a file name shouldn't be longer than this} +@y +@!name_length=100; {a file name shouldn't be longer than this} +@z + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [21] Change definition of 'byte_file' to correct subrange +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +We shall stick to simple \PASCAL\ in this program, for reasons of clarity, +even if such simplicity is sometimes unrealistic. + +@<Types...@>= +@!eight_bits=0..255; {unsigned one-byte quantity} +@!byte_file=packed file of eight_bits; {files that contain binary data} +@y +On Berkeley {\mc UNIX}, we have to use |-128..127| for byte files, as +explained in the \TeX\ changes. + +@<Types...@>= +@!eight_bits=0..255; {unsigned one-byte quantity} +@!byte_file=packed file of -128..127; {files that contain binary data} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [23] Fix up opening the binary files +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|} +begin reset(dvi_file); +cur_loc:=0; +end; +@# +procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|} +begin reset(tfm_file,cur_name); +end; +@y +On Berkeley {\mc UNIX}, the |eof| testing won't work. +We use the external |test_access| procedure, which also does path searching +based on the user's environment or the default path. + +@d read_access_mode=4 {``read'' mode for |test_access|} +@d write_access_mode=2 {``write'' mode for |test_access|} + +@d no_file_path=0 {no path searching should be done} +@d font_file_path=3 {path specifier for \.{TFM} files} + +@p procedure open_dvi_file; {prepares to read packed bytes in |dvi_file|} +begin argv(1, cur_name); + if test_access(read_access_mode,no_file_path) then + begin dvi_name:=real_name_of_file; reset(dvi_file,dvi_name) + end + else begin + write_ln('DVI file not found'); + jump_out; + end; + cur_loc:=0; +end; +@# +procedure open_tfm_file; {prepares to read packed bytes in |tfm_file|} +begin +if test_access(read_access_mode,font_file_path) then + reset(tfm_file,real_name_of_file) +else begin + write_ln('TFM file not found: ',cur_name); + jump_out +end; +end; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [24] Declare real_name_of_file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +|dvi_file|, and |cur_name| is a string variable that will be set to the +current font metric file name before |open_tfm_file| is called. + +@<Glob...@>= +@!cur_loc:integer; {where we are about to look, in |dvi_file|} +@!cur_name:packed array[1..name_length] of char; {external name, + with no lower case letters} +@y +|dvi_file|, and |cur_name| is a string variable that will be set to the +current font metric file name before |open_tfm_file| is called. +Under UNIX, we also have a |real_name_of_file| string, that gets +set by the external |test_access| procedure after path searching. + +@<Glob...@>= +@!cur_loc:integer; {where we are about to look, in |dvi_file|} +@!cur_name,@!real_name_of_file,@!dvi_name:packed array[1..name_length] of char; + {external name} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [26] Fix read_tfm_word to read bytes properly +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@p procedure read_tfm_word; +begin read(tfm_file,b0); read(tfm_file,b1); +read(tfm_file,b2); read(tfm_file,b3); +end; +@y +@d get_tfm_byte(#) == + read(tfm_file,byte); if byte < 0 then # := byte + 256 else # := byte; + +@p procedure read_tfm_word; +var byte : -128..127; +begin +get_tfm_byte(b0); +get_tfm_byte(b1); +get_tfm_byte(b2); +get_tfm_byte(b3); +end; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [27] Fix up functions to read DVI bytes +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@p function get_byte:integer; {returns the next byte, unsigned} +var b:eight_bits; +begin if eof(dvi_file) then get_byte:=0 +else begin read(dvi_file,b); incr(cur_loc); get_byte:=b; + end; +end; +@# +function signed_byte:integer; {returns the next byte, signed} +var b:eight_bits; +begin read(dvi_file,b); incr(cur_loc); +if b<128 then signed_byte:=b @+ else signed_byte:=b-256; +end; +@# +function get_two_bytes:integer; {returns the next two bytes, unsigned} +var a,@!b:eight_bits; +begin read(dvi_file,a); read(dvi_file,b); +cur_loc:=cur_loc+2; +get_two_bytes:=a*256+b; +end; +@# +function signed_pair:integer; {returns the next two bytes, signed} +var a,@!b:eight_bits; +begin read(dvi_file,a); read(dvi_file,b); +cur_loc:=cur_loc+2; +if a<128 then signed_pair:=a*256+b +else signed_pair:=(a-256)*256+b; +end; +@# +function get_three_bytes:integer; {returns the next three bytes, unsigned} +var a,@!b,@!c:eight_bits; +begin read(dvi_file,a); read(dvi_file,b); read(dvi_file,c); +cur_loc:=cur_loc+3; +get_three_bytes:=(a*256+b)*256+c; +end; +@# +function signed_trio:integer; {returns the next three bytes, signed} +var a,@!b,@!c:eight_bits; +begin read(dvi_file,a); read(dvi_file,b); read(dvi_file,c); +cur_loc:=cur_loc+3; +if a<128 then signed_trio:=(a*256+b)*256+c +else signed_trio:=((a-256)*256+b)*256+c; +end; +@# +function signed_quad:integer; {returns the next four bytes, signed} +var a,@!b,@!c,@!d:eight_bits; +begin read(dvi_file,a); read(dvi_file,b); read(dvi_file,c); read(dvi_file,d); +cur_loc:=cur_loc+4; +if a<128 then signed_quad:=((a*256+b)*256+c)*256+d +else signed_quad:=(((a-256)*256+b)*256+c)*256+d; +end; +@y +@p function get_byte:integer; {returns the next byte, unsigned} +var b:-128..127; +begin if eof(dvi_file) then get_byte:=0 +else begin read(dvi_file,b); incr(cur_loc); + if b < 0 then get_byte := b + 256 else get_byte:=b; + end; +end; +@# +function signed_byte:integer; {returns the next byte, signed} +var b:-128..127; +begin read(dvi_file,b); incr(cur_loc); +signed_byte:=b; +end; +@# +function get_two_bytes:integer; {returns the next two bytes, unsigned} +var a,b:integer; +begin a := get_byte; b := get_byte; +get_two_bytes:=a*256+b; +end; +@# +function signed_pair:integer; {returns the next two bytes, signed} +var a,@!b:integer; +begin a := signed_byte; b := get_byte; +signed_pair:=a*256+b +end; +@# +function get_three_bytes:integer; {returns the next three bytes, unsigned} +var a,@!b,@!c:integer; +begin a := get_byte; b := get_byte; c := get_byte; +get_three_bytes:=(a*256+b)*256+c; +end; +@# +function signed_trio:integer; {returns the next three bytes, signed} +var a,@!b,@!c:integer; +begin a := signed_byte; b := get_byte; c := get_byte; +signed_trio:=(a*256+b)*256+c +end; +@# +function signed_quad:integer; {returns the next four bytes, signed} +var a,@!b,@!c,@!d:integer; +begin a := signed_byte; b := get_byte; c := get_byte; d := get_byte; +signed_quad:=((a*256+b)*256+c)*256+d +end; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [28] Redefine dvi_length() and move_to_byte(). +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@p function dvi_length:integer; +begin set_pos(dvi_file,-1); dvi_length:=cur_pos(dvi_file); +end; +@# +procedure move_to_byte(n:integer); +begin set_pos(dvi_file,n); cur_loc:=n; +end; +@y +@p function dvi_length:integer; +begin dvi_length:=flength(dvi_file); +end; +@# +procedure move_to_byte(n:integer); +begin bseek(dvi_file,n); cur_loc:=n; +end; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [45] Define term_in and term_out and declare dvityout, first_input +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +and |term_out| for terminal output. +@^system dependencies@> + +@<Glob...@>= +@!buffer:array[0..terminal_line_length] of ASCII_code; +@!term_in:text_file; {the terminal, considered as an input file} +@!term_out:text_file; {the terminal, considered as an output file} +@y +and |term_out| for terminal output. +@^system dependencies@> + +@d term_in==input +@d term_out==output + +@<Glob...@>= +@!buffer:array[0..terminal_line_length] of ASCII_code; +@!dvityout:text; +@!first_input:boolean; {true until |input_ln| has been invoked} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [46] Define update_terminal +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d update_terminal == break(term_out) {empty the terminal output buffer} +@y +@d update_terminal == flush(term_out) {empty the terminal output buffer} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [47] Remove call to reset(term_in) and initial eoln test +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +begin update_terminal; reset(term_in); +if eoln(term_in) then read_ln(term_in); +@y +begin update_terminal; +if first_input then first_input:=false +else if eoln(term_in) then read_ln(term_in); +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [50] Remove call to rewrite(term_out) +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +begin rewrite(term_out); {prepare the terminal for output} +@y +begin +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [64] Set default_directory_name +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d default_directory_name=='TeXfonts:' {change this to the correct name} +@d default_directory_name_length=9 {change this to the correct length} + +@<Glob...@>= +@!default_directory:packed array[1..default_directory_name_length] of char; +@y +Actually, under UNIX the standard area is defined in an external +``texpaths.h'' file. And the users have a path searched for fonts, +by setting the TEXFONTS environment variable. +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [65] Remove initialization of now-defunct array +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@ @<Set init...@>= +default_directory:=default_directory_name; +@y +@ (No initialization to be done. Keep this module to preserve numbering.) +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [66] Fix addition of ".tfm" suffix for portability and keep lowercase +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@ The string |cur_name| is supposed to be set to the external name of the +\.{TFM} file for the current font. This usually means that we need to +prepend the name of the default directory, and +to append the suffix `\.{.TFM}'. Furthermore, we change lower case letters +to upper case, since |cur_name| is a \PASCAL\ string. +@y +@ The string |cur_name| is supposed to be set to the external name of the +\.{TFM} file for the current font. This usually means that we need to, +at most sites, append the +suffix ``.tfm''. +@z + +@x +if p=0 then + begin for k:=1 to default_directory_name_length do + cur_name[k]:=default_directory[k]; + r:=default_directory_name_length; + end +else r:=0; +@y +r:=0; +@z + +@x + if (names[k]>="a")and(names[k]<="z") then + cur_name[r]:=xchr[names[k]-@'40] + else cur_name[r]:=xchr[names[k]]; + end; +cur_name[r+1]:='.'; cur_name[r+2]:='T'; cur_name[r+3]:='F'; cur_name[r+4]:='M' +@y + cur_name[r]:=xchr[names[k]]; + end; +cur_name[r+1]:='.'; cur_name[r+2]:='t'; cur_name[r+3]:='f'; cur_name[r+4]:='m' +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [105] Reopen DVI file after postamble has been checked +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +if not eof(dvi_file) then bad_dvi('signature in byte ',cur_loc-1:1, +@.signature...should be...@> + ' should be 223') +else if cur_loc<k+4 then + print_ln('not enough signature bytes at end of file (', +@.not enough signature bytes...@> + cur_loc-k:1,')'); +@y +if not eof(dvi_file) then bad_dvi('signature in byte ',cur_loc-1:1, +@.signature...should be...@> + ' should be 223'); +if cur_loc<k+4 then + print_ln('not enough signature bytes at end of file (', +@.not enough signature bytes...@> + cur_loc-k:1,')'); +reset(dvi_file,dvi_name) {the Berkeley UNIX routines have closed the file} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [107] Check usage; also print newline at end of program +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +dialog; {set up all the options} +@y +if argc <> 2 then + begin write_ln('Usage: dvitype <dvi-file>'); goto final_end; + end; +first_input:=true; dialog; {set up all the options} +@z +@x +final_end:end. +@y +final_end: print_ln(' '); end. +@z diff --git a/systems/knuth/local/texware-sparc/pltotf.ch b/systems/knuth/local/texware-sparc/pltotf.ch new file mode 100644 index 0000000000..8134f8dc46 --- /dev/null +++ b/systems/knuth/local/texware-sparc/pltotf.ch @@ -0,0 +1,135 @@ +% Change file for the PLtoTF processor, for use on Berkeley UNIX systems. +% This file was created by Pavel Curtis, Pavel@Cornell. + +% History: +% 4/4/83 (PC) Original version, made to work with version 1.2 of PLtoTF. +% 4/16 (PC) Brought up to version 1.3 of PLtoTF. +% 6/30 (HWT) Revised changefile format for version 1.7 Tangle +% 7/28 (HWT) Brought up to version 2 +% 11/21 (HWT) Brought up to version 2.1 +% 9/3/85 (RKF) Brought up to version 2.3 +% 8/7/89 (don) Cosmetic change for SunOS +% 9/16/89 (don) Cosmetic change for version 3 +% 10/16/89 (don) Avoided core dump when PL file can't be opened +% 11/18/89 (don) Brought up to version 3.1 +% 9/6/90 (don) Version 3.3 +% 3/25/91 (don) Version 3.4 +% 3/6/95 (don) Version 3.5 + +% The section numbers used in this file refer to the current nunmbers, +% and, where different, also to those in the standard TeXware report (CS1097). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [0] WEAVE: print changes only +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +\pageno=\contentspagenumber \advance\pageno by 1 +@y +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iffalse +\def\title{PL\lowercase{to}TF changes for SunOS} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [1] Change banner string +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d banner=='This is PLtoTF, Version 3.5' {printed when the program starts} +@y +@d banner=='This is PLtoTF, Version 3.5 for SunOS' + {printed when the program starts} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [2] Fix filenames in program statement; add `final_end' label; add access +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@p program PLtoTF(@!pl_file,@!tfm_file,@!output); +const @<Constants in the outer block@>@/ +type @<Types in the outer block@>@/ +var @<Globals in the outer block@>@/ +@y +@d final_end==9999 + +@p program PLtoTF(@!output); +label final_end; +const @<Constants in the outer block@>@/ +type UNIX_file_name=packed array[1..100] of char; + @<Types in the outer block@>@/ +var @<Globals in the outer block@>@/ +function testreadaccess(var fn:UNIX_file_name):boolean; external; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [6] Open PL file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +reset(pl_file); +@y +if argc < 3 then begin + print_ln('Usage: pltotf <pl-file> <tfm-file>'); + goto final_end; +end; +argv(1, pl_name); +if testreadaccess(pl_name) then reset(pl_file, pl_name) +else begin print_ln('I can''t read the PL file!'); goto final_end; + end; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [15] Change type of tfm_file and declare extra TFM-file variables +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@!tfm_file:packed file of 0..255; +@y +@!tfm_file : packed file of -128..127; +@!tmp : 0..255; +@!tfm_name, +@!pl_name : UNIX_file_name; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [16] Open TFM file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@ On some systems you may have to do something special to write a +packed file of bytes. For example, the following code didn't work +when it was first tried at Stanford, because packed files have to be +opened with a special switch setting on the \PASCAL\ that was used. +@^system dependencies@> + +@<Set init...@>= +rewrite(tfm_file); +@y +@ On some systems you may have to do something special to write a +packed file of bytes. +@^system dependencies@> + +@<Set init...@>= +argv(2, tfm_name); +rewrite(tfm_file, tfm_name); +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [127, was 119] Change TFM-byte output to fix ranges +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d out(#)==write(tfm_file,#) +@y +@d out(#)==begin + tmp := #; + if tmp > 127 then + write(tfm_file, tmp - 256) + else + write(tfm_file, tmp) + end +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [147, was 135] Define label `final_end'; print newline at end of program +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +end. +@y +final_end: print_ln(' '); end. +@z diff --git a/systems/knuth/local/texware-sparc/pooltype.ch b/systems/knuth/local/texware-sparc/pooltype.ch new file mode 100644 index 0000000000..94241bd9c6 --- /dev/null +++ b/systems/knuth/local/texware-sparc/pooltype.ch @@ -0,0 +1,70 @@ +% Change file for the Pooltype processor +% Hacked together by don on 8/7/89 since the old pooltype.ch seems lost +% 8-bit modifications made 9/11/89 + +% Module numbers are from the standard TeXware report (CS1097) + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [0] WEAVE: print changes only +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +\pageno=\contentspagenumber \advance\pageno by 1 +@y +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iffalse +\def\title{POOLTYPE changes for SunOS} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [2] Program header +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +@x +@p program POOLtype(@!pool_file,@!output); +@y +@p program POOLtype(@!output); +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [12] Permissiveness +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +for i:=0 to @'37 do xchr[i]:=' '; +for i:=@'177 to @'377 do xchr[i]:=' '; +@y +for i:=0 to @'37 do xchr[i]:=chr(i); +for i:=@'177 to @'377 do xchr[i]:=chr(i); +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [15] Beginning of main program +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +@x +@p begin initialize;@/ +@y +@p begin if argc < 2 then + abort('Usage: pooltype <pool-file>'); +initialize;@/ +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [18] Input file declaration needs also a string +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +@x +@!pool_file:packed file of text_char; +@y +@!pool_file:packed file of text_char; +@!pool_name: array[1..100] of char; {not 100 percent robust} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [19] Opening the input file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +@x +reset(pool_file); xsum:=false; +@y +argv(1,pool_name); reset(pool_file,pool_name); xsum:=false; +@z diff --git a/systems/knuth/local/texware-sparc/tftopl.ch b/systems/knuth/local/texware-sparc/tftopl.ch new file mode 100644 index 0000000000..cb18739546 --- /dev/null +++ b/systems/knuth/local/texware-sparc/tftopl.ch @@ -0,0 +1,206 @@ +% Change file for the TFtoPL processor, for use on Berkeley UNIX systems. +% This file was created by Pavel Curtis, Pavel@Cornell. + +% History: +% 4/4/83 (PC) Original version, made to work with version 1.0 of TFtoPL, +% released with version 0.96 of TeX in February, 1983. +% 4/16 (PC) Brought up to version 1.0 released with version 0.97 of TeX +% in April, 1983. +% 6/30 (HWT) Revised changefile format, for use with version 1.7 Tangle. +% 7/28 (HWT) Brought up to version 2 +% 11/21 (HWT) Brought up to version 2.1 +% 3/24/84 (HWT) Brought up to version 2.2 +% 7/12/84 (HWT) Brought up to version 2.3 +% 9/3/85 (RKF) Brought up to version 2.4 +% 3/1/86 (PAM) Cosmetic upgrade to Version 2.5 +% 8/7/89 (don) Cosmetic change for SunOS +% 9/15/89 (don) Cosmetic upgrade to Version 3 +% 10/18/89 (don) Avoid core dump when the file isn't present +% 11/18/89 (don) Brought up to version 3.1 + +% The section numbers used in this file refer to the current numbers, +% and, where different, also to those in the standard TeXware report (CS1097). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [0] WEAVE: print changes only +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +\pageno=\contentspagenumber \advance\pageno by 1 +@y +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iffalse +\def\title{TF\lowercase{to}PL changes for SunOS} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [1] Change banner string +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@d banner=='This is TFtoPL, Version 3.1' {printed when the program starts} +@y +@d banner=='This is TFtoPL, Version 3.1 for SunOS' + {printed when the program starts} +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [2] Fix files in program statement; add external access procedure +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@p program TFtoPL(@!tfm_file,@!pl_file,@!output); +label @<Labels in the outer block@>@/ +const @<Constants in the outer block@>@/ +type @<Types in the outer block@>@/ +var @<Globals in the outer block@>@/ +@y +@p program TFtoPL(@!output); +label @<Labels in the outer block@>@/ +const @<Constants in the outer block@>@/ +type UNIX_file_name=packed array[1..100] of char; + @<Types in the outer block@>@/ +var @<Globals in the outer block@>@/ +function testreadaccess(var fn:UNIX_file_name):boolean; external; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [6] Fix declaration of tfm_file; declare extra TFM-file variables +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@!tfm_file:packed file of 0..255; +@y +@!tfm_file:packed file of -128..127; {files that contain binary data} +@!tfm_name:UNIX_file_name; +@!tfm_byte:integer; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [7] Open TFM file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@ On some systems you may have to do something special to read a +packed file of bytes. For example, the following code didn't work +when it was first tried at Stanford, because packed files have to be +opened with a special switch setting on the \PASCAL\ that was used. +@^system dependencies@> + +@<Set init...@>= +reset(tfm_file); +@y +@ On some systems you may have to do something special to read a +packed file of bytes. + +@<Set init...@>= +if argc < 3 then begin + print_ln('Usage: tftopl <tfm-file> <pl-file>'); + goto final_end; +end; +argv(1, tfm_name); +if testreadaccess(tfm_name) then reset(tfm_file, tfm_name) +else begin print_ln('I can''t read the TFM file!'); goto final_end; + end; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [16] Declare pl_name +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@!pl_file:text; +@y +@!pl_file:text; +@!pl_name: array[1..100] of char; +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [17] Open PL file +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@ @<Set init...@>= +rewrite(pl_file); +@y +@ @<Set init...@>= +argv(2, pl_name); +rewrite(pl_file, pl_name); +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [20] Fix reading of TFM bytes. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +@<Read the whole input file@>= +read(tfm_file,tfm[0]); +if tfm[0]>127 then abort('The first byte of the input file exceeds 127!'); +@.The first byte...@> +if eof(tfm_file) then abort('The input file is only one byte long!'); +@.The input...one byte long@> +read(tfm_file,tfm[1]); lf:=tfm[0]*@'400+tfm[1]; +if lf=0 then + abort('The file claims to have length zero, but that''s impossible!'); +@.The file claims...@> +if 4*lf-1>tfm_size then abort('The file is bigger than I can handle!'); +@.The file is bigger...@> +for tfm_ptr:=2 to 4*lf-1 do + begin if eof(tfm_file) then + abort('The file has fewer bytes than it claims!'); +@.The file has fewer bytes...@> + read(tfm_file,tfm[tfm_ptr]); + end; +if not eof(tfm_file) then + begin print_ln('There''s some extra junk at the end of the TFM file,'); +@.There's some extra junk...@> + print_ln('but I''ll proceed as if it weren''t there.'); + end +@y +@d fget==begin get(tfm_file); + tfm_byte:=tfm_file^; + if tfm_byte<0 then tfm_byte:=tfm_byte+256; + end +@d fbyte==tfm_byte +@d read_sixteen(#)==begin #:=fbyte; + if #>127 then abort; + fget; #:=#*@'400+fbyte; + end +@d store_four_quarters(#)==begin fget; a:=fbyte; qw.b0:=qi(a); + fget; b:=fbyte; qw.b1:=qi(b); + fget; c:=fbyte; qw.b2:=qi(c); + fget; d:=fbyte; qw.b3:=qi(d); + #:=qw; + end + +@<Read the whole input file@>= + {Prime the pump} +tfm_byte:=tfm_file^; +if tfm_byte<0 then tfm_byte:=tfm_byte+256; + +tfm[0]:=fbyte; fget; +if tfm[0]>127 then abort('The first byte of the input file exceeds 127!'); +@.The first byte...@> +if eof(tfm_file) then abort('The input file is only one byte long!'); +@.The input...one byte long@> +tfm[1]:=fbyte; fget; lf:=tfm[0]*@'400+tfm[1]; +if lf=0 then + abort('The file claims to have length zero, but that''s impossible!'); +@.The file claims...@> +if 4*lf-1>tfm_size then abort('The file is bigger than I can handle!'); +@.The file is bigger...@> +for tfm_ptr:=2 to 4*lf-1 do + begin if eof(tfm_file) then + abort('The file has fewer bytes than it claims!'); +@.The file has fewer bytes...@> + tfm[tfm_ptr]:=fbyte; fget; + end; +if not eof(tfm_file) then + begin print_ln('There''s some extra junk at the end of the TFM file,'); +@.There's some extra junk...@> + print_ln('but I''ll proceed as if it weren''t there.'); + end + +@^system dependencies@>@^Changes for Berkeley {\mc UNIX}@> +@z + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% [99, was 88] Add printing of newline at end of program +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +@x +final_end:end. +@y +final_end: print_ln(' '); end. +@z |