modernc.org/knuth@v0.0.4/web/testdata/ctan.org/tex-archive/systems/knuth/dist/mfware/gftodvi.ch (about)

     1  @x gftodvi.web:88:
     2  @d othercases == others: {default for cases not listed explicitly}
     3  @y
     4  @d othercases == else {default for cases not listed explicitly}
     5  @z
     6  
     7  @x
     8  @d print_nl(#)==@+begin write_ln; write(#);@+end
     9  @y
    10  @d print_nl(#)==@+begin write_ln(); write(#);@+end
    11  @d write_ln(#)==writeln(#)
    12  @d read_ln(#)==readln(#)
    13  @z
    14  
    15  @x gftodvi.web:108:
    16  @p program GF_to_DVI(@!output);
    17  label @<Labels in the outer block@>@/
    18  const @<Constants in the outer block@>@/
    19  type @<Types in the outer block@>@/
    20  var @<Globals in the outer block@>@/
    21  procedure initialize; {this procedure gets things started properly}
    22    var @!i,@!j,@!m,@!n:integer; {loop indices for initializations}
    23    begin print_ln(banner);@/
    24    @<Set initial values@>@/
    25    end;
    26  
    27  @ If the program has to stop prematurely, it goes to the
    28  `|final_end|'.
    29  
    30  @d final_end=9999 {label for the end of it all}
    31  
    32  @<Labels...@>=final_end;
    33  @y
    34  @p program GF_to_DVI(@!output);
    35  @<Labels in the outer block@>@/
    36  const @<Constants in the outer block@>@/
    37  type @<Types in the outer block@>@/
    38  var @<Globals in the outer block@>@/
    39  procedure initialize; {this procedure gets things started properly}
    40    var @!i,@!j,@!m,@!n:integer; {loop indices for initializations}
    41    begin print_ln(banner);@/
    42    @<Set initial values@>@/
    43    end;
    44  
    45  @ If the program has to stop prematurely, it goes to the
    46  `|final_end|'.
    47  
    48  @d final_end=9999 {label for the end of it all}
    49  
    50  @<Labels...@>=
    51  @z
    52  
    53  @x gftodvi.web:184:
    54  @d abort(#)==@+begin print(' ',#); jump_out;@+end
    55  @d bad_gf(#)==abort('Bad GF file: ',#,'! (at byte ',cur_loc-1:1,')')
    56  @.Bad GF file@>
    57  
    58  @p procedure jump_out;
    59  begin goto final_end;
    60  end;
    61  @y
    62  @d abort(#)==@+begin write_ln(stderr, ' ',#); jump_out;@+end
    63  @d bad_gf(#)==abort('Bad GF file: ',#,'! (at byte ',cur_loc-1:1,')')
    64  @.Bad GF file@>
    65  
    66  @p procedure jump_out;
    67  begin panic(final_end);
    68  end;
    69  @z
    70  
    71  @x gftodvi.web:383:
    72  @d update_terminal == break(output) {empty the terminal output buffer}
    73  @y
    74  @d update_terminal == {empty the terminal output buffer}
    75  @z
    76  
    77  @x gftodvi.web:2802:
    78  @<Finish the \.{DVI} file and |goto final_end|@>=
    79  begin dvi_out(post); {beginning of the postamble}
    80  dvi_four(last_bop); last_bop:=dvi_offset+dvi_ptr-5; {|post| location}
    81  dvi_four(25400000); dvi_four(473628672); {conversion ratio for sp}
    82  dvi_four(1000); {magnification factor}
    83  dvi_four(max_v); dvi_four(max_h);@/
    84  dvi_out(0); dvi_out(3); {`\\{max\_push}' is said to be 3}@/
    85  dvi_out(total_pages div 256); dvi_out(total_pages mod 256);@/
    86  if not fonts_not_loaded then
    87    for k:=title_font to logo_font do
    88      if length(font_name[k])>0 then dvi_font_def(k);
    89  dvi_out(post_post); dvi_four(last_bop); dvi_out(dvi_id_byte);@/
    90  k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's}
    91  while k>0 do
    92    begin dvi_out(223); decr(k);
    93    end;
    94  @<Empty the last bytes out of |dvi_buf|@>;
    95  goto final_end;
    96  end
    97  @y
    98  @<Finish the \.{DVI} file and |goto final_end|@>=
    99  begin dvi_out(post); {beginning of the postamble}
   100  dvi_four(last_bop); last_bop:=dvi_offset+dvi_ptr-5; {|post| location}
   101  dvi_four(25400000); dvi_four(473628672); {conversion ratio for sp}
   102  dvi_four(1000); {magnification factor}
   103  dvi_four(max_v); dvi_four(max_h);@/
   104  dvi_out(0); dvi_out(3); {`\\{max\_push}' is said to be 3}@/
   105  dvi_out(total_pages div 256); dvi_out(total_pages mod 256);@/
   106  if not fonts_not_loaded then
   107    for k:=title_font to logo_font do
   108      if length(font_name[k])>0 then dvi_font_def(k);
   109  dvi_out(post_post); dvi_four(last_bop); dvi_out(dvi_id_byte);@/
   110  k:=4+((dvi_buf_size-dvi_ptr) mod 4); {the number of 223's}
   111  while k>0 do
   112    begin dvi_out(223); decr(k);
   113    end;
   114  @<Empty the last bytes out of |dvi_buf|@>;
   115  end
   116  @z
   117  
   118  @x gftodvi.web:4328:
   119  @p begin initialize; {get all variables initialized}
   120  @<Initialize the strings@>;
   121  start_gf; {open the input and output files}
   122  @<Process the preamble@>;
   123  cur_gf:=get_byte; init_str_ptr:=str_ptr;
   124  loop@+  begin @<Initialize variables for the next character@>;
   125    while (cur_gf>=xxx1)and(cur_gf<=no_op) do @<Process a no-op command@>;
   126    if cur_gf=post then @<Finish the \.{DVI} file and |goto final_end|@>;
   127    if cur_gf<>boc then if cur_gf<>boc1 then abort('Missing boc!');
   128  @.Missing boc@>
   129    @<Process a character@>;
   130    cur_gf:=get_byte; str_ptr:=init_str_ptr; pool_ptr:=str_start[str_ptr];
   131    end;
   132  final_end:end.
   133  @y
   134  @p begin initialize; {get all variables initialized}
   135  @<Initialize the strings@>;
   136  start_gf; {open the input and output files}
   137  @<Process the preamble@>;
   138  cur_gf:=get_byte; init_str_ptr:=str_ptr;
   139  loop@+  begin @<Initialize variables for the next character@>;
   140    while (cur_gf>=xxx1)and(cur_gf<=no_op) do @<Process a no-op command@>;
   141    if cur_gf=post then @<Finish the \.{DVI} file and |goto final_end|@>;
   142    if cur_gf<>boc then if cur_gf<>boc1 then abort('Missing boc!');
   143  @.Missing boc@>
   144    @<Process a character@>;
   145    cur_gf:=get_byte; str_ptr:=init_str_ptr; pool_ptr:=str_start[str_ptr];
   146    end;
   147  end.
   148  @z