% This is GFTOPXL.CHGCMS in text format, as of jun 5, 1986 % (change file for IBM CMS PASCAL/VS, % created by B.SCHULZE and some other people) % % Important remark: in large parts of the TeX community, there is a % belief that a PXL file must always consist of exactly 128 characters. % There are even driver programs that try to find the pxl directory at % exactly 128*4+5 words from the end of the pxl file. This belief is % wrong. The last but one word of the pxl file is the pointer to the % beginning of the directory, so it is easy to calculate the number % of characters that are defined. This change file allows GFtoPXL to % convert up to 256 characters, and the resulting directory is as % small as possible. % B. Schulze, Univ. of Bonn % %line numbers correspond to version 2.1 (of may 5, 86) % %line 68 % %section x @x banner @d banner=='This is GFtoPXL, Version 2.1' {printed when the program starts} @y @d banner=='This is GFtoPXL, CMS Version 2.1 (SFB72)' {printed when the program starts} @z % %line 95 % %section x @x @d othercases == others: {default for cases not listed explicitly} @y @d othercases == otherwise {default for cases not listed explicitly} @z % %line 106 % %section x @x @d print(#)==write(#) @d print_ln(#)==write_ln(#) @y @d print(#)==write(output,#) @d print_ln(#)==write_ln(output,#) @z % %line 117 % %section x @x begin print_ln(banner);@/ @y begin @= TERMIN @>(output); @= TERMOUT @>(output); {prepare the terminal for output} print_ln(banner);@/ @z % %line 135 % %section x @x @!max_glyph_no=127; {maximum glyph number in font, later change to 255} @!top_pixel=700; {boundary of pixel image of glyph} @!bot_pixel=-350; @!left_pixel=-250; @!right_pixel=750; @y @!max_glyph_no=255; {maximum glyph number in font} @!top_pixel=700; {boundary of pixel image of glyph} @!bot_pixel=-250; @!left_pixel=-250; @!right_pixel=750; @!len_byte_block=1024; {blocksize of gf file} @!len_pxl_block=1024; {blocksize of pxl file} @z % %line 200 % %section x @x forget relicts from another program! @!term_in:text_file; {the terminal, considered as an input file} @!term_out:text_file; {the terminal, considered as an output file} @y @z % %line 245 % %section x @x @d last_text_char=127 {ordinal number of the largest element of |text_char|} @y @d last_text_char=255 {ordinal number of the largest element of |text_char|} @z % %line 248 % %section x @x @!text_file=packed file of text_char; @y @!text_file=text; @z % %line 695 % %section x @x @!eight_bits=0..255; {unsigned one-byte quantity} @!byte_file=packed file of eight_bits; {files that contain binary data} @y @!eight_bits= packed 0..255; {unsigned one-byte quantity} @!byte_block = packed array (.0..len_byte_block-1.) of eight_bits; @!byte_file = packed file of byte_block; @!pxl_block = packed array (.0..len_pxl_block-1.) of eight_bits; @!px_file = packed file of pxl_block; @z % %line % %section x @x @!pxl_file:byte_file; {the stuff we have \.{GFtoPXL}ed} @y @!eof_gf: boolean; @!lrec: integer; @!norec: integer; @!cur_block: integer; @!pxl_file:px_file; {the stuff we have \.{GFtoPXL}ed} @z % %line 709 % %section x @x begin reset(gf_file); @y begin reset(gf_file); cur_block := 1; eof_gf := eof(gf_file); @z % %line 735 % %section x @x @p function get_byte:integer; {returns the next byte, unsigned} var b:eight_bits; begin if eof(gf_file) then get_byte:=0 else begin read(gf_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(gf_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(gf_file,a); read(gf_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(gf_file,a); read(gf_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(gf_file,a); read(gf_file,b); read(gf_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(gf_file,a); read(gf_file,b); read(gf_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(gf_file,a); read(gf_file,b); read(gf_file,c); read(gf_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 @d get_gf(#)==begin if eof_gf then prem_end else # := gf_file@@(.cur_loc mod len_byte_block.); incr(cur_loc); if cur_loc mod len_byte_block = 0 then if cur_block < norec then begin get(gf_file); incr (cur_block); end else eof_gf := true end @p procedure prem_end; begin bad_gf ('didn''t we read past endfile just now?') end; @# function get_byte:integer; {returns the next byte, unsigned} var b:eight_bits; begin get_gf(b); get_byte:=b; end; @# function signed_byte:integer; {returns the next byte, signed} var b:eight_bits; begin get_gf(b); 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 get_gf(a); get_gf(b); get_two_bytes:=a*256+b; end; @# function signed_pair:integer; {returns the next two bytes, signed} var a,@!b:eight_bits; begin get_gf(a); get_gf(b); 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 get_gf(a); get_gf(b); get_gf(c); 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 get_gf(a); get_gf(b); get_gf(c); 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 get_gf(a); get_gf(b); get_gf(c); get_gf(d); 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; @z % %line 789 % %section x @x @d pxl_byte(#)==begin write(pxl_file,#); incr(pxl_byte_no); end @y @d pxl_byte(#)==begin pxl_file@@(.pxl_byte_no mod len_pxl_block.):=#; incr(pxl_byte_no); if pxl_byte_no mod len_pxl_block = 0 then put(pxl_file) end @z % %line 798 % %section x @x procedure pxl_word(@!w:integer); begin if w>0 then pxl_byte(w div @"1000000) else begin w:=w+@"40000000; w:=w+@"40000000; pxl_byte((w div @"1000000) + 128); end; pxl_byte((w div @"10000) mod @"100); pxl_byte((w div @"100) mod @"100); pxl_byte(w mod @"100); end; @y procedure pxl_word(@!w:integer); begin if w>=0 then pxl_byte(w div @"1000000) {how comes?} else begin w:=w+@"40000000; w:=w+@"40000000; pxl_byte((w div @"1000000) + 128); end; pxl_byte((w div @"10000) mod @"100); pxl_byte((w div @"100) mod @"100); pxl_byte(w mod @"100); end; @z % %line 827 % %section x @x @p function gf_length:integer; begin set_pos(gf_file,-1); gf_length:=cur_pos(gf_file); end; @# procedure move_to_byte(n:integer); begin set_pos(gf_file,n); cur_loc:=n; end; @y @p function gf_length:integer; begin readstr (parms, lrec, norec); gf_length := lrec*norec; end; @# procedure move_to_byte(n:integer); var block: integer; begin block:=n div lrec + 1; eof_gf := false; if block <> cur_block then begin cur_block:=block; seek(gf_file, block); get (gf_file); end; cur_loc := n; end; @z % %line 867 % %section x @x @d white=0 {could also be |false|} @d black=1 {could also be |true|} @y @d white==false @d black==true @z % %line 873 % %section x @x @!pixel=white..black; {could also be |boolean|} @y @!pixel=boolean; @z % %line 987 % %section x @x if eof(gf_file) then bad_gf('the file ended prematurely'); @y if eof_gf then bad_gf('the file ended prematurely'); @z % %line 1203 % %section @x while (m=223)and not eof(gf_file) do m:=get_byte; if not eof(gf_file) then bad_gf('signature in byte ',cur_loc-1:1, @y while (m=223)and not eof_gf do m:=get_byte; if not eof_gf then bad_gf('signature in byte ',cur_loc-1:1, @z % %line 1375 % %section @x why the rest? for char_code:=0 to max_glyph_no do begin @y for char_code:=0 to ec do begin @z % %line 1386 % %section @x (first line necessary for correct hit!) pxl_word(pxl_dir_ptr); pxl_word(pxl_id); @y pxl_word(pxl_dir_ptr); pxl_word(pxl_id); while pxl_byte_no mod len_pxl_block > 0 do pxl_byte(0); {We want to ship out the last |pxl_file| block} @z % %line 1417 % %section @x b:=image; incr(m); for i:=2 to 8 do begin b:=b*2+image; @y if image then b:=1 else b:=0; incr(m); for i:=2 to 8 do begin b:=b*2; if image then b:=b+1; @z % %line 1428 % %section @x b:=image; incr(m); i:=2; while m<=max_m do begin b:=b*2+image; @y if image then b:=1 else b:=0; incr(m); i:=2; while m<=max_m do begin b:=b*2; if image then b:=b+1; @z % %line 1506 % %section @x if eof(gf_file) then bad_gf('the file ended prematurely'); @y if eof_gf then bad_gf('the file ended prematurely'); @z