@x @d banner=='This is TANGLE, Version 2.7' @y @d banner=='This is Tangle 2.7 for Cedar 6.0' @z @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 @x var @@/ @@/ @y var @@/ @@/ @@/ @z @x @!buf_size=100; {maximum length of input line} @y @!buf_size=5000; {maximum length of input line} @z @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 @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 @x for i:=1 to @'37 do xchr[i]:=' '; @y for i:=1 to @'37 do xchr[i]:=chr(i); @z @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 @x begin reset(web_file); reset(change_file); @y begin file_reset(web_file, 'web '); file_reset(change_file, 'changes '); @z @x rewrite(Pascal_file); rewrite(pool); @y file_rewrite(Pascal_file, 'pas '); file_rewrite(pool, 'pool '); @z @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 @x begin print_ln('. (l.',line:1,')'); @y begin print_ln('. (pos:',file_get_pos(Pascal_file)+out_ptr:1,')'); @z @x while (i"_" then @y while (i"_" 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 @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 @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 @x @; @y @; new_line; @z @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 ๚file: Tangle.changes Modified by Lyle Ramshaw, October 27, 1983 9:23 pm Pavel, September 14, 1985 3:56:50 pm PDT 002591: Change the banner line. 003074: Define read_ln and write_ln as macros, expanding to themselves without the underscores, so that later hackery about leaving in underscores works. 003339: Allow for external procedure and function declarations for things implemented directly in Cedar, rather than in Pascal. 007644: Up the buf_size to something reasonable. 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. 013556: Allow for eight-bit characters in the input files. 019237: Assume that we have the MIT character set. 020884: Change multi-arg call to rewrite into an appropriate Cedar procedure. 021837: Hook up file open calls to Cedar. 022302: Hook up still more file open calls to Cedar. 026004: Report Phase I error locations using character counts instead of line numbers. 026693: Report Phase II error locations using character counts as well. 042434: Hackery! I would prefer that the "_" characters be left in the identifier names. Stripping them out just makes the Mesa source look ugly. 044962: More hackery! Once again, please just ignore "_" in identifier names. 086335: Still more hackery! Once again, please just ignore "_" in identifier names. 126031: Close files. 126105: Add a final carriage return after the job history 127715: Add Cedar forward declarations. สr˜J™™2Icode™(—J˜unit™˜J˜(—˜J˜-—J˜—™™˜J˜/—˜J˜/J˜J˜—J˜—™˜J˜$J˜—˜J˜$J˜NJ˜—J˜—šœ0™0šœ˜Jšœ.˜.—šœ˜Jšœ/˜/—Jšœ˜—™ฎ˜J˜hJ˜’—˜J˜hJ˜“—J˜—™:˜J˜L—˜J˜L—J˜—šœ2™2šœ˜Jšœ!˜!—šœ˜Jšœ$˜$—Jšœ˜—™M˜J˜B—˜J˜?—J˜—™)˜J˜*—˜J˜P—J˜—™4˜J˜$—˜J˜J—J˜—šœV™Všœ˜JšœC˜CJšœ˜Jšœ(˜(—šœ˜Jšœ.˜.˜J˜M—J˜D—Jšœ˜—šœG™Gšœ˜Jšœ#˜#—šœ˜JšœB˜B—Jšœ˜—™“˜J˜(J˜—˜J˜(J˜—J˜—™N˜J˜J˜J˜:—˜J˜J˜:—J˜—™T˜J˜CJ˜,—˜J˜D—J˜—™˜J˜I—˜J˜.J˜*—J˜—šœ9™9šœ˜Jšœ˜—šœ˜Jšœ˜J˜ —Jšœ˜—šœ'™'˜J˜…—˜J˜ส—J˜——…—๐\