History

CWEB — Release 3.3, 1994-12-06.

Andreas Scherer committed 15 years ago

Commit 22cd55e1 parent 6f710fc16 files · +379 −303Browse files

Showing the changes to ctangle.w (1 of 16 files). Show all

Unified · Split

ctangle.w+21−13
@@ -2,7 +2,7 @@ · 1 unmodified line
22 % This program by Silvio Levy and Donald E. Knuth
33 % is based on a program by Knuth.
44 % It is distributed WITHOUT ANY WARRANTY, express or implied.
5−% Version 3.2 --- July 1994
5+% Version 3.3 --- December 1994
66
77 % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth
88
@@ -22,11 +22,11 @@ · 13 unmodified lines
2222 \mathchardef\RA="3221 % right arrow
2323 \mathchardef\BA="3224 % double arrow
2424
25−\def\title{CTANGLE (Version 3.2)}
25+\def\title{CTANGLE (Version 3.3)}
2626 \def\topofcontents{\null\vfill
2727 \centerline{\titlefont The {\ttitlefont CTANGLE} processor}
2828 \vskip 15pt
29− \centerline{(Version 3.2)}
29+ \centerline{(Version 3.3)}
3030 \vfill}
3131 \def\botofcontents{\vfill
3232 \noindent
@@ -56,7 +56,7 @@ Joachim Schrod, Lee Wittenberg, and others who have contributed improvements. · 23 unmodified lines
5656 The ``banner line'' defined here should be changed whenever \.{CTANGLE}
5757 is modified.
5858
59−@d banner "This is CTANGLE (Version 3.2)\n"
59+@d banner "This is CTANGLE (Version 3.3)\n"
6060
6161 @c
6262 @<Include files@>@/
@@ -640,10 +640,10 @@ is not called if |out_state==verbatim|, except perhaps with arguments · 577 unmodified lines
640640 (end the constant).
641641
642642 @<Predecl...@>=
643−void out_char();
643+static void out_char();
644644
645645 @ @c
646−void
646+static void
647647 out_char(cur_char)
648648 eight_bits cur_char;
649649 {
@@ -827,7 +827,7 @@ newline. The boolean argument |is_long_comment| distinguishes between · 177 unmodified lines
827827 the two types of comments.
828828
829829 If |skip_comment| comes to the end of the section, it prints an error message.
830−No comment, long or short, is allowed to contain `\.{@@ }' or `\.{@@*}'.
830+No comment, long or short, is allowed to contain `\.{@@\ }' or `\.{@@*}'.
831831
832832 @<Global...@>=
833833 boolean comment_continues=0; /* are we scanning a comment? */
@@ -870,6 +870,7 @@ boolean is_long_comment; · 36 unmodified lines
870870
871871 @<Global...@>=
872872 name_pointer cur_section_name; /* name of section just scanned */
873+int no_where; /* suppress |print_where|? */
873874
874875 @ @<Include...@>=
875876 #include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
@@ -892,7 +893,7 @@ get_next() /* produces the next input token */ · 16 unmodified lines
892893 if (loc>limit) {
893894 if (preprocessing && *(limit-1)!='\\') preprocessing=0;
894895 if (get_line()==0) return(new_section);
895− else if (print_where) {
896+ else if (print_where && !no_where) {
896897 print_where=0;
897898 @<Insert the line number into |tok_mem|@>;
898899 }
@@ -1170,6 +1171,9 @@ the name of the current section. · 271 unmodified lines
11701171 \item{b)}The symbols \.{@@d} and \.{@@f} and \.{@@c} are not allowed after
11711172 section names, while they terminate macro definitions.
11721173
1174+\item{c)}Spaces are inserted after right parentheses in macros, because the
1175+ANSI \CEE/ preprocessor sometimes requires it.
1176+
11731177 \yskip Therefore there is a single procedure |scan_repl| whose parameter
11741178 |t| specifies either |macro| or |section_name|. After |scan_repl| has
11751179 acted, |cur_text| will point to the replacement text just generated, and
@@ -1194,6 +1198,9 @@ eight_bits t; · 18 unmodified lines
11941198 |section_name|, etc.), either process it and change |a| to a byte
11951199 that should be stored, or |continue| if |a| should be ignored,
11961200 or |goto done| if |a| signals the end of this replacement text@>@;
1201+ case ')': app_repl(a);
1202+ if (t==macro) app_repl(' ');
1203+ break;
11971204 default: app_repl(a); /* store |a| in |tok_mem| */
11981205 }
11991206 done: next_control=(eight_bits) a;
@@ -1212,11 +1219,11 @@ else id_first=cur_file_name; · 12 unmodified lines
12121219 id_loc=id_first+strlen(id_first);
12131220 if (changing) store_two_bytes((sixteen_bits)change_line);
12141221 else store_two_bytes((sixteen_bits)cur_line);
1215−{int a=id_lookup(id_first,id_loc)-name_dir; app_repl((a / 0400)+0200);
1222+{int a=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a / 0400)+0200);
12161223 app_repl(a % 0400);}
12171224
12181225 @ @<In cases that |a| is...@>=
1219−case identifier: a=id_lookup(id_first,id_loc)-name_dir;
1226+case identifier: a=id_lookup(id_first,id_loc,0)-name_dir;
12201227 app_repl((a / 0400)+0200);
12211228 app_repl(a % 0400); break;
12221229 case section_name: if (t!=section_name) goto done;
@@ -1339,7 +1346,7 @@ scan_section() · 116 unmodified lines
13391346 name_pointer p; /* section name for the current section */
13401347 text_pointer q; /* text for the current section */
13411348 sixteen_bits a; /* token for left-hand side of definition */
1342− section_count++;
1349+ section_count++; @+ no_where=1;
13431350 if (*(loc-1)=='*' && show_progress) { /* starred section */
13441351 printf("*%d",section_count); update_terminal;
13451352 }
@@ -1361,6 +1368,7 @@ scan_section() · 15 unmodified lines
13611368 }
13621369 return; /* \.{@@\ } or \.{@@*} */
13631370 }
1371+ no_where=print_where=0;
13641372 @<Scan the \CEE/ part of the current section@>;
13651373 }
13661374
@@ -1384,13 +1392,13 @@ while (next_control<definition) · 17 unmodified lines
13841392 @.Definition flushed...@>
13851393 continue;
13861394 }
1387− app_repl(((a=id_lookup(id_first,id_loc)-name_dir) / 0400)+0200);
1395+ app_repl(((a=id_lookup(id_first,id_loc,0)-name_dir) / 0400)+0200);
13881396 /* append the lhs */
13891397 app_repl(a % 0400);
13901398 if (*loc!='(') { /* identifier must be separated from replacement text */
13911399 app_repl(string); app_repl(' '); app_repl(string);
13921400 }
1393− print_where=0; scan_repl(macro);
1401+ scan_repl(macro);
13941402 cur_text->text_link=0; /* |text_link==0| characterizes a macro */
13951403 }
13961404

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t