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

     1  @x mft.web:128:
     2  The ``banner line'' defined here should be changed whenever \.{MFT}
     3  is modified.
     4  
     5  @d banner=='This is MFT, Version 2.1'
     6  @y
     7  The ``banner line'' defined here should be changed whenever \.{MFT}
     8  is modified.
     9  
    10  @d banner=='This is MFT, Version 2.1 (gomft v0.0-prerelease)'
    11  @z
    12  
    13  @x mft.web:143:
    14  @p @t\4@>@<Compiler directives@>@/
    15  program MFT(@!mf_file,@!change_file,@!style_file,@!tex_file);
    16  label end_of_MFT; {go here to finish}
    17  @y
    18  @p @t\4@>@<Compiler directives@>@/
    19  program MFT(@!mf_file,@!change_file,@!style_file,@!tex_file,@!output);
    20  @z
    21  
    22  @x mft.web:211:
    23  @d othercases == others: {default for cases not listed explicitly}
    24  @y
    25  @d othercases == else {default for cases not listed explicitly}
    26  @z
    27  
    28  @x mft.web:224:
    29  @!line_length=80; {lines of \TeX\ output have at most this many characters,
    30    should be less than 256}
    31  @y TeX-live compatibility
    32  @!line_length=79; {lines of \TeX\ output have at most this many characters,
    33    should be less than 256}
    34  @z
    35  
    36  @x mft.web:458:
    37  @d print(#)==write(term_out,#) {`|print|' means write on the terminal}
    38  @d print_ln(#)==write_ln(term_out,#) {`|print|' and then start new line}
    39  @d new_line==write_ln(term_out) {start new line on the terminal}
    40  @y
    41  @d term_out==output
    42  @d print(#)==write(term_out,#) {`|print|' means write on the terminal}
    43  @d print_ln(#)==write_ln(term_out,#) {`|print|' and then start new line}
    44  @d new_line==write_ln(term_out) {start new line on the terminal}
    45  @d write_ln(#)==writeln(#)
    46  @d read_ln(#)==readln(#)
    47  @z
    48  
    49  @x mft.web:466:
    50  @!term_out:text_file; {the terminal as an output file}
    51  @y
    52  @z
    53  
    54  @x mft.web:474:
    55  rewrite(term_out,'TTY:'); {send |term_out| output to the terminal}
    56  @y
    57  @z
    58  
    59  @x mft.web:476:
    60  @ The |update_terminal| procedure is called when we want
    61  to make sure that everything we have output to the terminal so far has
    62  actually left the computer's internal buffers and been sent.
    63  @^system dependencies@>
    64  
    65  @d update_terminal == break(term_out) {empty the terminal output buffer}
    66  @y
    67  @ The |update_terminal| procedure is called when we want
    68  to make sure that everything we have output to the terminal so far has
    69  actually left the computer's internal buffers and been sent.
    70  @^system dependencies@>
    71  
    72  @d update_terminal == {empty the terminal output buffer}
    73  @z
    74  
    75  @x mft.web:605:
    76  procedure jump_out;
    77  begin goto end_of_MFT;
    78  end;
    79  @y
    80  procedure jump_out;
    81  begin
    82  	panic(end_of_MFT);
    83  end;
    84  @z
    85  
    86  @x mft.web:1942:
    87  @* The main program.
    88  Let's put it all together now: \.{MFT} starts and ends here.
    89  @^system dependencies@>
    90  
    91  @p begin initialize; {beginning of the main program}
    92  print_ln(banner); {print a ``banner line''}
    93  @<Store all the primitives@>;
    94  @<Store all the translations@>;
    95  @<Initialize the input...@>;
    96  do_the_translation;
    97  @<Check that all changes have been read@>;
    98  end_of_MFT:{here files should be closed if the operating system requires it}
    99  @<Print the job |history|@>;
   100  end.
   101  @y
   102  @* The main program.
   103  Let's put it all together now: \.{MFT} starts and ends here.
   104  @^system dependencies@>
   105  
   106  @p begin initialize; {beginning of the main program}
   107  print_ln(banner); {print a ``banner line''}
   108  @<Store all the primitives@>;
   109  @<Store all the translations@>;
   110  @<Initialize the input...@>;
   111  do_the_translation;
   112  @<Check that all changes have been read@>;
   113  @<Print the job |history|@>;
   114  end.
   115  @z
   116  
   117  
   118  @x mft.web:1942:
   119  @<Print the job |history|@>=
   120  case history of
   121  spotless: print_nl('(No errors were found.)');
   122  harmless_message: print_nl('(Did you see the warning message above?)');
   123  error_message: print_nl('(Pardon me, but I think I spotted something wrong.)');
   124  fatal_message: print_nl('(That was a fatal error, my friend.)');
   125  end {there are no other cases}
   126  @y
   127  @<Print the job |history|@>=
   128  case history of
   129  spotless: print_nl('(No errors were found.)');
   130  harmless_message: print_nl('(Did you see the warning message above?)');
   131  error_message: print_nl('(Pardon me, but I think I spotted something wrong.)');
   132  fatal_message: print_nl('(That was a fatal error, my friend.)');
   133  end; {there are no other cases}
   134  write_ln('');
   135  @z