<> <> <> <<002591: Change the banner line.>> @x @d banner=='This is TANGLE, Version 2.7' @y @d banner=='This is Tangle 2.7 for Cedar 6.0' @z <<003074: Define read_ln and write_ln as macros, expanding to themselves without the underscores, so that later hackery about leaving in underscores works.>> @x @d end_of_TANGLE = 9999 {go here to wrap it up} @y @d end_of_TANGLE = 9999 {go here to wrap it up} @d read_ln == readln @d write_ln == writeln @z <<003339: Allow for external procedure and function declarations for things implemented directly in Cedar, rather than in Pascal.>> @x var @@/ @@/ @y var @@/ @@/ @@/ @z <<007644: Up the buf_size to something reasonable.>> @x @!buf_size=100; {maximum length of input line} @y @!buf_size=5000; {maximum length of input line} @z <<008411: Reset max_id_length to a large value, to avoid truncation of identifiers. Also, up the unambig_length because leaving in the underscores makes things more ambiguous.>> @x @!max_id_length=12; {long identifiers are chopped to this length, which must not exceed |line_length|} @!unambig_length=7; {identifiers must be unique if chopped to this length} {note that 7 is more strict than \PASCAL's 8, but this can be varied} @y @!max_id_length=72; {long identifiers are chopped to this length, which must not exceed |line_length|} @!unambig_length=12; {identifiers must be unique if chopped to this length} {note that 7 is more strict than \PASCAL's 8, but this can be varied} @z <<013556: Allow for eight-bit characters in the input files.>> @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 <<019237: Assume that we have the MIT character set.>> @x for i:=1 to @'37 do xchr[i]:=' '; @y for i:=1 to @'37 do xchr[i]:=chr(i); @z <<020884: Change multi-arg call to rewrite into an appropriate Cedar procedure.>> @x rewrite(term_out,'TTY:'); {send |term_out| output to the terminal} @y tty_rewrite(term_out); {send |term_out| output to the terminal} @z <<021837: Hook up file open calls to Cedar.>> @x begin reset(web_file); reset(change_file); @y begin file_reset(web_file, 'web '); file_reset(change_file, 'changes '); @z <<022302: Hook up still more file open calls to Cedar.>> @x rewrite(Pascal_file); rewrite(pool); @y file_rewrite(Pascal_file, 'pas '); file_rewrite(pool, 'pool '); @z <<026004: Report Phase I error locations using character counts instead of line numbers.>> @x begin if changing then print('. (change file ')@+else print('. ('); print_ln('l.', line:1, ')'); if loc>=limit then l:=limit else l:=loc; @y begin if loc>=limit then l:=limit else l:=loc; if changing then print_ln('. (change file pos:', file_get_pos(change_file)-(limit-l)-2:1, ')') else print_ln('. (pos:', file_get_pos(web_file)-(limit-l)-2:1, ')'); @z <<026693: Report Phase II error locations using character counts as well.>> @x begin print_ln('. (l.',line:1,')'); @y begin print_ln('. (pos:',file_get_pos(Pascal_file)+out_ptr:1,')'); @z <<042434: Hackery! I would prefer that the "_" characters be left in the identifier names. Stripping them out just makes the Mesa source look ugly.>> @x while (i"_" then @y while (i> @x begin c:=byte_mem[w,k]; if c<>"_" then begin if c>="a" then c:=c-@'40; {convert to uppercase} @y begin c:=byte_mem[w,k]; begin if c>="a" then c:=c-@'40; {convert to uppercase} @z <<086335: Still more hackery! Once again, please just ignore "_" in identifier names.>> @x if out_contrib[k]>="a" then out_contrib[k]:=out_contrib[k]-@'40 else if out_contrib[k]="_" then decr(k); @y if out_contrib[k]>="a" then out_contrib[k]:=out_contrib[k]-@'40; @z <<126031: Close files.>> @x @t\4\4@>{here files should be closed if the operating system requires it} @y file_close(web_file); file_close(change_file); file_close(Pascal_file); file_close(pool); @z <<126105: Add a final carriage return after the job history>> @x @; @y @; new_line; @z <<127715: Add Cedar forward declarations.>> @x @* System-dependent changes. This module should be replaced, if necessary, by changes to the program that are necessary to make \.{TANGLE} work at a particular installation. It is usually best to design your change file so that all changes to previous modules preserve the module numbering; then everybody's version will be consistent with the printed program. More extensive changes, which introduce new modules, can be inserted here; then only the index itself will get a new module number. @^system dependencies@> @y @* System-dependent changes. Here at PARC, any Pascal output by Tangle must be transliterated into Cedar by McCreight's PasMesa compiler before it can be executed. Rather than incorporate the funny features of Pascal-H into PasMesa, we instead here declare some procedures |external| that we never intend to implement in Pascal at all. Instead, these procedures are written by hand in Cedar, and are linked in with the translated Pascal program by the Cedar binding process. @^changed modules@> @^system dependencies@> @= procedure tty_reset(var f: text_file); external; {set up for input from terminal} procedure tty_rewrite(var f: text_file); external; {set up for output to terminal} procedure file_reset(var f: text_file; ext: alfa); external; {set up for input from file} procedure file_rewrite(var f: text_file; ext: alfa); external; {set up for output to file} procedure file_close(var f: text_file); external; {close a file} function file_get_pos(var f: text_file):integer; external; {return character count} @z