modernc.org/knuth@v0.0.4/mf/internal/trap/mf.ch (about)

     1  @x mf.web:160:
     2  @d banner=='This is METAFONT, Version 2.71828182' {printed when \MF\ starts}
     3  @y
     4  @d banner=='This is METAFONT, Version 2.71828182 (TRAP)' {printed when \MF\ starts}
     5  @z
     6  
     7  @x mf.web:250:
     8  start_of_MF@t\hskip-2pt@>, end_of_MF@t\hskip-2pt@>,@,final_end;
     9  @y
    10  start_of_MF;
    11  @z
    12  
    13  @x mf.web:272: TRAP
    14  @d stat==@{ {change this to `$\\{stat}\equiv\null$' when gathering
    15    usage statistics}
    16  @d tats==@t@>@} {change this to `$\\{tats}\equiv\null$' when gathering
    17    usage statistics}
    18  @y
    19  @d stat== {change this to `$\\{stat}\equiv\null$' when gathering
    20    usage statistics}
    21  @d tats== {change this to `$\\{tats}\equiv\null$' when gathering
    22    usage statistics}
    23  @z
    24  
    25  @x mf.web:337:
    26  @d othercases == others: {default for cases not listed explicitly}
    27  @y
    28  @d othercases == else {default for cases not listed explicitly}
    29  @z
    30  
    31  @x mf.web:349: TRAP
    32  @!mem_max=30000; {greatest index in \MF's internal |mem| array;
    33    must be strictly less than |max_halfword|;
    34    must be equal to |mem_top| in \.{INIMF}, otherwise |>=mem_top|}
    35  @!max_internal=100; {maximum number of internal quantities}
    36  @!buf_size=500; {maximum number of characters simultaneously present in
    37    current lines of open files; must not exceed |max_halfword|}
    38  @!error_line=72; {width of context lines on terminal error messages}
    39  @!half_error_line=42; {width of first lines of contexts in terminal
    40    error messages; should be between 30 and |error_line-15|}
    41  @!max_print_line=79; {width of longest text lines output; should be at least 60}
    42  @!screen_width=768; {number of pixels in each row of screen display}
    43  @!screen_depth=1024; {number of pixels in each column of screen display}
    44  @!stack_size=30; {maximum number of simultaneous input sources}
    45  @!max_strings=2000; {maximum number of strings; must not exceed |max_halfword|}
    46  @!string_vacancies=8000; {the minimum number of characters that should be
    47    available for the user's identifier names and strings,
    48    after \MF's own error messages are stored}
    49  @!pool_size=32000; {maximum number of characters in strings, including all
    50    error messages and help texts, and the names of all identifiers;
    51    must exceed |string_vacancies| by the total
    52    length of \MF's own strings, which is currently about 22000}
    53  @!move_size=5000; {space for storing moves in a single octant}
    54  @!max_wiggle=300; {number of autorounded points per cycle}
    55  @!gf_buf_size=800; {size of the output buffer, must be a multiple of 8}
    56  @y
    57  @!mem_max=3000; {greatest index in \MF's internal |mem| array;
    58    must be strictly less than |max_halfword|;
    59    must be equal to |mem_top| in \.{INIMF}, otherwise |>=mem_top|}
    60  @!max_internal=100; {maximum number of internal quantities}
    61  @!buf_size=500; {maximum number of characters simultaneously present in
    62    current lines of open files; must not exceed |max_halfword|}
    63  @!error_line=64; {width of context lines on terminal error messages}
    64  @!half_error_line=32; {width of first lines of contexts in terminal
    65    error messages; should be between 30 and |error_line-15|}
    66  @!max_print_line=72; {width of longest text lines output; should be at least 60}
    67  @!screen_width=100; {number of pixels in each row of screen display}
    68  @!screen_depth=200; {number of pixels in each column of screen display}
    69  @!stack_size=30; {maximum number of simultaneous input sources}
    70  @!max_strings=2000; {maximum number of strings; must not exceed |max_halfword|}
    71  @!string_vacancies=8000; {the minimum number of characters that should be
    72    available for the user's identifier names and strings,
    73    after \MF's own error messages are stored}
    74  @!pool_size=32000; {maximum number of characters in strings, including all
    75    error messages and help texts, and the names of all identifiers;
    76    must exceed |string_vacancies| by the total
    77    length of \MF's own strings, which is currently about 22000}
    78  @!move_size=5000; {space for storing moves in a single octant}
    79  @!max_wiggle=300; {number of autorounded points per cycle}
    80  @!gf_buf_size=8; {size of the output buffer, must be a multiple of 8}
    81  @z
    82  
    83  @x mf.web:399: TRAP
    84  @d mem_top==30000 {largest index in the |mem| array dumped by \.{INIMF};
    85    must be substantially larger than |mem_min|
    86    and not greater than |mem_max|}
    87  @y
    88  @d mem_top==3000 {largest index in the |mem| array dumped by \.{INIMF};
    89    must be substantially larger than |mem_min|
    90    and not greater than |mem_max|}
    91  @z
    92  
    93  @x mf.web:922:
    94  @d update_terminal == break(term_out) {empty the terminal output buffer}
    95  @d clear_terminal == break_in(term_in,true) {clear the terminal input buffer}
    96  @y
    97  @d update_terminal == {empty the terminal output buffer}
    98  @d clear_terminal == {clear the terminal input buffer}
    99  @z
   100  
   101  @x mf.web:955:
   102    begin write_ln(term_out,'Buffer size exceeded!'); goto final_end;
   103  @y
   104    begin write_ln(term_out,'Buffer size exceeded!'); panic(final_end);
   105  @z
   106  
   107  @x mf.web:997:
   108  @p function init_terminal:boolean; {gets the terminal input started}
   109  label exit;
   110  begin t_open_in;
   111  loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal;
   112  @.**@>
   113    if not input_ln(term_in,true) then {this shouldn't happen}
   114  @y
   115  @p function init_terminal:boolean; {gets the terminal input started}
   116  label exit;
   117  begin t_open_in;
   118  loop@+begin wake_up_terminal; write(term_out,'**'); update_terminal;
   119  @.**@>
   120    if not input_ln(term_in,false) then {this shouldn't happen}
   121  @z
   122  
   123  @x mf.web:1413:
   124  @d wterm_ln(#)==write_ln(term_out,#)
   125  @y
   126  @d wterm_ln(#)==write_ln(term_out,#)
   127  @d write_ln(#)==writeln(#)
   128  @d read_ln(#)==readln(#)
   129  @z
   130  
   131  @x mf.web:1738:
   132  procedure jump_out;
   133  begin goto end_of_MF;
   134  end;
   135  @y
   136  procedure jump_out;
   137  begin panic(end_of_MF);
   138  end;
   139  @z
   140  
   141  @x mf.web:12090 TRAP:
   142  begin init_screen:=false;
   143  @y
   144  begin init_screen:=true; {screen instructions will be logged}
   145  @z
   146  
   147  @x mf.web:12138:
   148  @p procedure blank_rectangle(@!left_col,@!right_col:screen_col;
   149    @!top_row,@!bot_row:screen_row);
   150  var @!r:screen_row;
   151  @!c:screen_col;
   152  @y
   153  @p procedure blank_rectangle(@!left_col,@!right_col:screen_col;
   154    @!top_row,@!bot_row:screen_row);
   155  @z
   156  
   157  @x mf.web:12165:
   158  @p procedure paint_row(@!r:screen_row;@!b:pixel_color;var @!a:trans_spec;
   159    @!n:screen_col);
   160  var @!k:screen_col; {an index into |a|}
   161  @!c:screen_col; {an index into |screen_pixel|}
   162  @y
   163  @p procedure paint_row(@!r:screen_row;@!b:pixel_color;var @!a:trans_spec;
   164    @!n:screen_col);
   165  var @!k:screen_col; {an index into |a|}
   166  @z
   167  
   168  @x mf.web:15878:
   169  @p procedure open_log_file;
   170  var @!old_setting:0..max_selector; {previous |selector| setting}
   171  @!k:0..buf_size; {index into |months| and |buffer|}
   172  @!l:0..buf_size; {end of first input line}
   173  @!m:integer; {the current month}
   174  @y
   175  @p procedure open_log_file;
   176  var @!old_setting:0..max_selector; {previous |selector| setting}
   177  @!k:0..buf_size; {index into |months| and |buffer|}
   178  @!l:0..buf_size; {end of first input line}
   179  @z
   180  
   181  @x mf.web:22883:
   182  main_control; {come to life}
   183  final_cleanup; {prepare for death}
   184  end_of_MF: close_files_and_terminate;
   185  final_end: ready_already:=0;
   186  end.
   187  @y
   188  main_control; {come to life}
   189  final_cleanup; {prepare for death}
   190  close_files_and_terminate;
   191  final_end: ready_already:=0;
   192  end.
   193  @z
   194  
   195  @x mf.web:22901:
   196  procedure close_files_and_terminate;
   197  var @!k:integer; {all-purpose index}
   198  @!lh:integer; {the length of the \.{TFM} header, in words}
   199  @!lk_offset:0..256; {extra words inserted at beginning of |lig_kern| array}
   200  @!p:pointer; {runs through a list of \.{TFM} dimensions}
   201  @!x:scaled; {a |tfm_width| value being output to the \.{GF} file}
   202  begin
   203  @!stat if internal[tracing_stats]>0 then
   204    @<Output statistics about this job@>;@;@+tats@/
   205  wake_up_terminal; @<Finish the \.{TFM} and \.{GF} files@>;
   206  if log_opened then
   207    begin wlog_cr;
   208    a_close(log_file); selector:=selector-2;
   209    if selector=term_only then
   210      begin print_nl("Transcript written on ");
   211  @.Transcript written...@>
   212      slow_print(log_name); print_char(".");
   213      end;
   214    end;
   215  end;
   216  @y
   217  procedure close_files_and_terminate;
   218  var @!k:integer; {all-purpose index}
   219  @!lh:integer; {the length of the \.{TFM} header, in words}
   220  @!lk_offset:0..256; {extra words inserted at beginning of |lig_kern| array}
   221  @!p:pointer; {runs through a list of \.{TFM} dimensions}
   222  @!x:scaled; {a |tfm_width| value being output to the \.{GF} file}
   223  begin
   224  @!stat if internal[tracing_stats]>0 then
   225    @<Output statistics about this job@>;@;@+tats@/
   226  wake_up_terminal; @<Finish the \.{TFM} and \.{GF} files@>;
   227  if log_opened then
   228    begin wlog_cr;
   229    a_close(log_file); selector:=selector-2;
   230    if selector=term_only then
   231      begin print_nl("Transcript written on ");
   232  @.Transcript written...@>
   233      slow_print(log_name); print_char(".");
   234      end;
   235    end;
   236    write_ln(term_out);
   237  end;
   238  @z