|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T t
Length: 6860 (0x1acc) Types: TextFile Names: »tftopl.ch«
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦c319c2751⟧ »unix3.0/TeX3.0.tar.Z« └─⟦036c765ac⟧ └─⟦this⟧ »TeX3.0/texware/tftopl.ch«
% tftopl.ch for C compilation with web2c. % % The original version of this file was created by Pavel Curtis. % % History: % 04/04/83 (PC) Original version, made to work with version 1.0 of TFtoPL, % released with version 0.96 of TeX in February, 1983. % 04/16/83 (PC) Brought up to version 1.0 released with version 0.97 of TeX % in April, 1983. % 06/30/83 (HWT) Revised changefile format, for use with version 1.7 Tangle. % 07/28/83 (HWT) Brought up to version 2 % 11/21/83 (HWT) Brought up to version 2.1 % 03/24/84 (HWT) Brought up to version 2.2 % 07/12/84 (HWT) Brought up to version 2.3 % 07/05/87 (ETM) Brought up to version 2.5 % 03/22/88 (ETM) Converted for use with WEB to C. % 11/30/89 (KB) Version 3. % 01/16/90 (SR) Version 3.1. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [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 C} @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, C Version 3.1' {printed when the program starts} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [2] Fix files in program statement %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p program TFtoPL(@!tfm_file,@!pl_file,@!output); @y @p program TFtoPL; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [6] Declare tfm_name. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!tfm_file:packed file of 0..255; @y @!tfm_file:packed file of 0..255; @!tfm_name:packed array [1..FILENAMESIZE] of char; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [7] Open the 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. With C under Unix, we just open the file by name and read characters from it. @<Set init...@>= if argc < 3 then begin print_ln('Usage: tftopl <tfm file> <property list file>.'); uexit(1); end; argv(1, tfm_name); reset(tfm_file, tfm_name); @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [16] Declare pl_name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!pl_file:text; @y @!pl_file:text; @!pl_name: array[1..FILENAMESIZE] 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [27, 28] Change strings to C char pointers. The Pascal strings are % indexed starting at 1, so we pad with a blank. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!ASCII_04,@!ASCII_10,@!ASCII_14: packed array [1..32] of char; {strings for output in the user's external character set} @!MBL_string,@!RI_string,@!RCE_string:packed array [1..3] of char; {handy string constants for |face| codes} @y @!ASCII_04,@!ASCII_10,@!ASCII_14: ccharpointer; {strings for output in the user's external character set} @!MBL_string,@!RI_string,@!RCE_string: ccharpointer; {handy string constants for |face| codes} @z @x ASCII_04:=' !"#$%&''()*+,-./0123456789:;<=>?';@/ ASCII_10:='@@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_';@/ ASCII_14:='`abcdefghijklmnopqrstuvwxyz{|}~ ';@/ MBL_string:='MBL'; RI_string:='RI '; RCE_string:='RCE'; @y ASCII_04:=' !"#$%&''()*+,-./0123456789:;<=>?';@/ ASCII_10:=' @@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_';@/ ASCII_14:=' `abcdefghijklmnopqrstuvwxyz{|}~ ';@/ MBL_string:=' MBL'; RI_string:=' RI '; RCE_string:=' RCE'; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [39] Don't output the face code as an integer. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x out(MBL_string[1+(b mod 3)]); out(RI_string[1+s]); out(RCE_string[1+(b div 3)]); @y put_byte(MBL_string[1+(b mod 3)], pl_file); put_byte(RI_string[1+s], pl_file); put_byte(RCE_string[1+(b div 3)], pl_file); @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [40] Force 32-bit constant arithmetic for 16-bit machines %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x f:=((tfm[k+1] mod 16)*@'400+tfm[k+2])*@'400+tfm[k+3]; @y f:=((tfm[k+1] mod 16)*toint(@'400)+tfm[k+2])*@'400+tfm[k+3]; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [90] Change name of the function `f'. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x r:=f(r,(hash[r]-1)div 256,(hash[r]-1)mod 256); @y r:=f_fn(r,(hash[r]-1)div 256,(hash[r]-1)mod 256); @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [94] web2c can't handle these mutually recursive procedures. % But let's do a fake definition of f here, so that it gets into web2c's % symbol table. We also have to change the name, because there is also a % variable named `f', and some C compilers can't deal with that. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p function f(@!h,@!x,@!y:index):index; forward;@t\2@> {compute $f$ for arguments known to be in |hash[h]|} @y @p ifdef('notdef') function f_fn(@!h,@!x,@!y:index):index; begin end;@t\2@> {compute $f$ for arguments known to be in |hash[h]|} endif('notdef') @z @x else eval:=f(h,x,y); @y else eval:=f_fn(h,x,y); @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [95] The real definition of f. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p function f; @y @p function f_fn(@!h,@!x,@!y:index):index; @z @x f:=lig_z[h]; @y f_fn:=lig_z[h]; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [99] Add printing of newline at end of program %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x final_end:end. @y final_end:print_ln(' '); end. @z