modernc.org/knuth@v0.0.4/dvitype/dvitype.ch (about)

     1  @x dvitype.web:90:
     2  @d banner=='This is DVItype, Version 3.6' {printed when the program starts}
     3  @y
     4  @d banner=='This is DVItype, Version 3.6 (godvitype v0.0-prerelease)' {printed when the program starts}
     5  @z
     6  
     7  @x dvitype.web:116:
     8  @d othercases == others: {default for cases not listed explicitly}
     9  @y
    10  @d othercases == else {default for cases not listed explicitly}
    11  @z
    12  
    13  @x dvitype.web:127:
    14  @d print_ln(#)==write_ln(#)
    15  @y
    16  @d print_ln(#)==write_ln(#)
    17  @d write_ln(#)==writeln(#)
    18  @d read_ln(#)==readln(#)
    19  @z
    20  
    21  @x dvitype.web:129:
    22  @p program DVI_type(@!dvi_file,@!output);
    23  label @<Labels in the outer block@>@/
    24  const @<Constants in the outer block@>@/
    25  type @<Types in the outer block@>@/
    26  var @<Globals in the outer block@>@/
    27  procedure initialize; {this procedure gets things started properly}
    28    var i:integer; {loop index for initializations}
    29    begin print_ln(banner);@/
    30    @<Set initial values@>@/
    31    end;
    32  
    33  @ If the program has to stop prematurely, it goes to the
    34  `|final_end|'. Another label, |done|, is used when stopping normally.
    35  
    36  @d final_end=9999 {label for the end of it all}
    37  @d done=30 {go here when finished with a subtask}
    38  
    39  @<Labels...@>=final_end,done;
    40  @y
    41  @p program DVI_type(@!dvi_file,@!output);
    42  label @<Labels in the outer block@>@/
    43  const @<Constants in the outer block@>@/
    44  type @<Types in the outer block@>@/
    45  var @<Globals in the outer block@>@/
    46  procedure initialize; {this procedure gets things started properly}
    47    var i:integer; {loop index for initializations}
    48    begin print_ln(banner);@/
    49    @<Set initial values@>@/
    50    end;
    51  
    52  @ If the program has to stop prematurely, it goes to the
    53  `|final_end|'. Another label, |done|, is used when stopping normally.
    54  
    55  @d final_end=9999 {label for the end of it all}
    56  @d done=30 {go here when finished with a subtask}
    57  
    58  @<Labels...@>=done;
    59  @z
    60  
    61  @x dvitype.web:177:
    62  @d abort(#)==begin print(' ',#); jump_out;
    63      end
    64  @d bad_dvi(#)==abort('Bad DVI file: ',#,'!')
    65  @.Bad DVI file@>
    66  
    67  @p procedure jump_out;
    68  begin goto final_end;
    69  end;
    70  @y
    71  @d abort(#)==begin print(stderr,' ',#); jump_out;
    72      end
    73  @d bad_dvi(#)==abort('Bad DVI file: ',#,'!')
    74  @.Bad DVI file@>
    75  
    76  @p procedure jump_out;
    77  begin
    78  	panic(final_end);
    79  end;
    80  @z
    81  
    82  @x dvitype.web:1303:
    83  out_mode:=the_works; max_pages:=1000000; start_vals:=0; start_there[0]:=false;
    84  @y
    85  @z
    86  
    87  @x dvitype.web:1336:
    88  @d update_terminal == break(term_out) {empty the terminal output buffer}
    89  @y
    90  @d update_terminal == {empty the terminal output buffer}
    91  @z
    92  
    93  @x dvitype.web:2166:
    94  @p @t\4@>@<Declare the procedure called |scan_bop|@>@;
    95  procedure skip_pages(@!bop_seen:boolean);
    96  label 9999; {end of this subroutine}
    97  var p:integer; {a parameter}
    98  @!k:0..255; {command code}
    99  @!down_the_drain:integer; {garbage}
   100  begin showing:=false;
   101  while true do
   102  @y
   103  @p @t\4@>@<Declare the procedure called |scan_bop|@>@;
   104  procedure skip_pages(@!bop_seen:boolean);
   105  label 9999; {end of this subroutine}
   106  var p:integer; {a parameter}
   107  @!k:0..255; {command code}
   108  @!down_the_drain:integer; {garbage}
   109  begin showing:=false;
   110  p:=down_the_drain; { Go: use the var }
   111  while true do
   112  @z
   113  
   114  @x dvitype.web:2404:
   115  @* The main program.
   116  Now we are ready to put it all together. This is where \.{DVItype} starts,
   117  and where it ends.
   118  
   119  @p begin initialize; {get all variables initialized}
   120  dialog; {set up all the options}
   121  @y
   122  @* The main program.
   123  Now we are ready to put it all together. This is where \.{DVItype} starts,
   124  and where it ends.
   125  
   126  @p begin initialize; {get all variables initialized}
   127  @<Print all the selected options@>;
   128  @z
   129  
   130  @x dvitype.web:2421:
   131  final_end:end.
   132  @y
   133  end.
   134  @z