% Change file for the VFtoVP processor, for use with GNU Pascal % (by Don Knuth; see ../etc-sparc for its prehistory) % History: % 2000.04.30 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [0] WEAVE: print changes only %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x \pageno=\contentspagenumber \advance\pageno by 1 @y \pageno=\contentspagenumber \advance\pageno by 1 \let\maybe=\iffalse \def\title{VF\lowercase{to}VP changes for GNU Pascal} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [1] Change banner string %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @d banner=='This is VFtoVP, Version 1.2' {printed when the program starts} @y @d banner=='This is VFtoVP, Version 1.2 for Linux' {printed when the program starts} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [2] Fix files in program statement; add external access procedures %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @p program VFtoVP(@!vf_file,@!tfm_file,@!vpl_file,@!output); label @@/ const @@/ type @@/ var @@/ @y @p program VFtoVP(@!output); label @@/ const @@/ type UNIX_file_name=packed array[1..100] of char; byte_file=packed file of ByteCard; @@/ var @@/ @\ @=#include "dvityext.h"@> @\@/ @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [3] Add a label %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @=final_end; @y @=final_end-1, final_end; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [4] 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [7] Fix declaration of vf_file; declare extra VF-file variables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!vf_file:packed file of byte; @y @!vf_file:byte_file; {files that contain binary data} @!vf_name:UNIX_file_name; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [10] Fix declaration of tfm_file; declare extra TFM-file variables %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!tfm_file:packed file of byte; @y @!tfm_file:byte_file; {files that contain binary data} @!tfm_name:UNIX_file_name; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [11] Open binary files %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @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@> @= reset(tfm_file); reset(vf_file); @y @ On some systems you may have to do something special to read a packed file of bytes. @= if argc < 4 then begin print_ln('Usage: vftovp '); goto final_end-1; end; argv(1, vf_name); argv(2, tfm_name); if testreadaccess(vf_name) then reset(vf_file, vf_name) else begin print_ln('I can''t read the VF file!'); goto final_end-1; end; if testreadaccess(tfm_name) then reset(tfm_file, tfm_name) else begin print_ln('I can''t read the TFM file!'); goto final_end-1; end; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [20] Declare vpl_name %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!vpl_file:text; @y @!vpl_file:text; @!vpl_name: UNIX_file_name; @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [21] Open VPL file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @ @= rewrite(vpl_file); @y @ @= setpaths; {read environment, to find TEXFONTS, if there} argv(3, vpl_name); rewrite(vpl_file, vpl_name); @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [37] Declare real_name_of_file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @!cur_name:packed array[1..name_length] of char; {external name, with no lower case letters} @y @!cur_name,@!real_name_of_file:external UNIX_file_name; {external names} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [39] Open a local TFM file using the normal font paths %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x reset(tfm_file,cur_name); @^system dependencies@> if eof(tfm_file) then print_ln('---not loaded, TFM file can''t be opened!') @.TFM file can\'t be opened@> else begin font_bc:=0; font_ec:=256; {will cause error if not modified soon} @y if not testaccess(4,3) then print_ln('---not loaded, TFM file can''t be opened!') @.TFM file can\'t be opened@> else begin reset(tfm_file,real_name_of_file); font_bc:=0; font_ec:=256; {will cause error if not modified soon} @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [42] Remove initialization of now-defunct array %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x @ @= default_directory:=default_directory_name; @y @ (No initialization to be done. Keep this module to preserve numbering.) @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [43] 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 a=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 (vf[k]>="a")and(vf[k]<="z") then cur_name[r]:=xchr[vf[k]-@'40] else cur_name[r]:=xchr[vf[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[vf[k]]; end; cur_name[r+1]:='.'; cur_name[r+2]:='t'; cur_name[r+3]:='f'; cur_name[r+4]:='m'; cur_name[r+5]:=chr(0); @z %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % [133] Add printing of newlines at end of program %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @x final_end:end. @y final_end: out_ln; final_end-1: print_ln(' '); end. @z