This second service release wraps up the major code overhaul after CWEB 4.0.
Unified · Split
| @@ -1,6 +1,6 @@ | |||
| 1 | # This file is part of CWEB. | 1 | # This file is part of CWEB. |
| 2 | # It is distributed WITHOUT ANY WARRANTY, express or implied. | 2 | # It is distributed WITHOUT ANY WARRANTY, express or implied. |
| 3 | # Version 4.1 --- February 2021 | 3 | # Version 4.2 --- February 2021 |
| 4 | 4 | ||
| 5 | # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth | 5 | # Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth |
| 6 | 6 | ||
| @@ -63,8 +63,10 @@ RM= /bin/rm · 56 unmodified lines | |||
| 63 | CP= /bin/cp | 63 | CP= /bin/cp |
| 64 | 64 | ||
| 65 | # uncomment the second line if you use pdftex to bypass .dvi files | 65 | # uncomment the second line if you use pdftex to bypass .dvi files |
| 66 | # uncomment the third line if you use xetex to bypass .dvi files | ||
| 66 | PDFTEX = dvipdfm | 67 | PDFTEX = dvipdfm |
| 67 | #PDFTEX = pdftex | 68 | #PDFTEX = pdftex |
| 69 | #PDFTEX = xetex | ||
| 68 | 70 | ||
| 69 | ########## You shouldn't have to change anything after this point ####### | 71 | ########## You shouldn't have to change anything after this point ####### |
| 70 | 72 | ||
| @@ -105,6 +107,7 @@ ALL = common.w ctangle.w cweave.w prod.w \ · 34 unmodified lines | |||
| 105 | case "$(PDFTEX)" in \ | 107 | case "$(PDFTEX)" in \ |
| 106 | dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \ | 108 | dvipdfm ) tex "\let\pdf+ \input $*"; dvipdfm $* ;; \ |
| 107 | pdftex ) pdftex $* ;; \ | 109 | pdftex ) pdftex $* ;; \ |
| 110 | xetex ) xetex $* ;; \ | ||
| 108 | esac | 111 | esac |
| 109 | 112 | ||
| 110 | all: ctangle cweave | 113 | all: ctangle cweave |
| @@ -1,4 +1,4 @@ | |||
| 1 | # cweb 4.1 | 1 | # cweb 4.2 |
| 2 | 2 | ||
| 3 | people have been accumulating several decades of experience with | 3 | people have been accumulating several decades of experience with |
| 4 | [cweb](http://www-cs-faculty.stanford.edu/~uno/cweb.html), and we know that | 4 | [cweb](http://www-cs-faculty.stanford.edu/~uno/cweb.html), and we know that |
| @@ -16,7 +16,7 @@ in fact, now to be found in this cweb development project. · 11 unmodified lines | |||
| 16 | besides for further development, this ‘project’ is used as an – obviously | 16 | besides for further development, this ‘project’ is used as an – obviously |
| 17 | incomplete – repository of original release versions of levy/knuth | 17 | incomplete – repository of original release versions of levy/knuth |
| 18 | [cweb](http://www-cs-faculty.stanford.edu/~uno/cweb.html). you can either | 18 | [cweb](http://www-cs-faculty.stanford.edu/~uno/cweb.html). you can either |
| 19 | compile these sources directly or stick the recent version “cweb-4.1” into my | 19 | compile these sources directly or stick the recent version “cweb-4.2” into my |
| 20 | [cwebbin](https://github.com/ascherer/cwebbin), which introduces convenient | 20 | [cwebbin](https://github.com/ascherer/cwebbin), which introduces convenient |
| 21 | extensions and prepares cweb for inclusion in the “tex live” distribution. | 21 | extensions and prepares cweb for inclusion in the “tex live” distribution. |
| 22 | 22 | ||
| @@ -4,9 +4,9 @@ No changes to CTANGLE or CWEAVE are needed. · 3 unmodified lines | |||
| 4 | (Contributed 13 Oct 2000 by AndPio@aol.com; slightly edited by Don Knuth) | 4 | (Contributed 13 Oct 2000 by AndPio@aol.com; slightly edited by Don Knuth) |
| 5 | 5 | ||
| 6 | @x in limbo, change the title page document to specify Mac version | 6 | @x in limbo, change the title page document to specify Mac version |
| 7 | \centerline{(Version 4.1)} | 7 | \centerline{(Version 4.2)} |
| 8 | @y | 8 | @y |
| 9 | \centerline{(Version 4.1 for MacOS)} | 9 | \centerline{(Version 4.2 for MacOS)} |
| 10 | @z | 10 | @z |
| 11 | 11 | ||
| 12 | @x sections 23/24: Make input_ln accept \n, \r, \n\r, or \r\n as line endings | 12 | @x sections 23/24: Make input_ln accept \n, \r, \n\r, or \r\n as line endings |
| @@ -10,24 +10,24 @@ ex <dev_>cc;'-v -h -c -=500000 -DCWEBINPUTS=flp2_ common_c' · 9 unmodified lines | |||
| 10 | @x | 10 | @x |
| 11 | \def\v{\char'174} % vertical (|) in typewriter font | 11 | \def\v{\char'174} % vertical (|) in typewriter font |
| 12 | 12 | ||
| 13 | \def\title{Common code for CTANGLE and CWEAVE (Version 4.1)} | 13 | \def\title{Common code for CTANGLE and CWEAVE (Version 4.2)} |
| 14 | \def\topofcontents{\null\vfill | 14 | \def\topofcontents{\null\vfill |
| 15 | \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and | 15 | \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and |
| 16 | {\ttitlefont CWEAVE}} | 16 | {\ttitlefont CWEAVE}} |
| 17 | \vskip 15pt | 17 | \vskip 15pt |
| 18 | \centerline{(Version 4.1)} | 18 | \centerline{(Version 4.2)} |
| 19 | \vfill} | 19 | \vfill} |
| 20 | \def\botofcontents{\vfill | 20 | \def\botofcontents{\vfill |
| 21 | \noindent | 21 | \noindent |
| 22 | @y | 22 | @y |
| 23 | \def\v{\char'174} % vertical (|) in typewriter font | 23 | \def\v{\char'174} % vertical (|) in typewriter font |
| 24 | 24 | ||
| 25 | \def\title{Common code for CTANGLE and CWEAVE (QL Version 4.1)} | 25 | \def\title{Common code for CTANGLE and CWEAVE (QL Version 4.2)} |
| 26 | \def\topofcontents{\null\vfill | 26 | \def\topofcontents{\null\vfill |
| 27 | \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and | 27 | \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and |
| 28 | {\ttitlefont CWEAVE}} | 28 | {\ttitlefont CWEAVE}} |
| 29 | \vskip 15pt | 29 | \vskip 15pt |
| 30 | \centerline{(Version 4.1)} | 30 | \centerline{(Version 4.2)} |
| 31 | \vfill} | 31 | \vfill} |
| 32 | \def\botofcontents{\vfill | 32 | \def\botofcontents{\vfill |
| 33 | \noindent | 33 | \noindent |
| @@ -41,6 +41,15 @@ · 40 unmodified lines | |||
| 41 | #define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) | 41 | #define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) |
| 42 | #define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ | 42 | #define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ |
| 43 | 43 | ||
| 44 | #define max_include_depth 10 \ | ||
| 45 | |||
| 46 | #define max_file_name_length 1024 | ||
| 47 | #define cur_file file[include_depth] | ||
| 48 | #define cur_file_name file_name[include_depth] | ||
| 49 | #define cur_line line[include_depth] | ||
| 50 | #define web_file file[0] | ||
| 51 | #define web_file_name file_name[0] \ | ||
| 52 | |||
| 44 | #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) | 53 | #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) |
| 45 | #define print_id(c) term_write((c) ->byte_start,length((c) ) ) | 54 | #define print_id(c) term_write((c) ->byte_start,length((c) ) ) |
| 46 | #define llink link | 55 | #define llink link |
| @@ -57,15 +66,6 @@ · 10 unmodified lines | |||
| 57 | #define confusion(s) fatal("! This can't happen: ",s) \ | 66 | #define confusion(s) fatal("! This can't happen: ",s) \ |
| 58 | \ | 67 | \ |
| 59 | 68 | ||
| 60 | #define max_include_depth 10 \ | ||
| 61 | |||
| 62 | #define max_file_name_length 1024 | ||
| 63 | #define cur_file file[include_depth] | ||
| 64 | #define cur_file_name file_name[include_depth] | ||
| 65 | #define cur_line line[include_depth] | ||
| 66 | #define web_file file[0] | ||
| 67 | #define web_file_name file_name[0] \ | ||
| 68 | |||
| 69 | #define show_banner flags['b'] | 69 | #define show_banner flags['b'] |
| 70 | #define show_progress flags['p'] | 70 | #define show_progress flags['p'] |
| 71 | #define show_stats flags['s'] | 71 | #define show_stats flags['s'] |
| @@ -149,7 +149,31 @@ extern char*loc; · 77 unmodified lines | |||
| 149 | extern char*limit; | 149 | extern char*limit; |
| 150 | 150 | ||
| 151 | /*:5*//*6:*/ | 151 | /*:5*//*6:*/ |
| 152 | #line 102 "common.h" | 152 | #line 105 "common.h" |
| 153 | |||
| 154 | extern int include_depth; | ||
| 155 | extern FILE*file[]; | ||
| 156 | extern FILE*change_file; | ||
| 157 | extern char file_name[][max_file_name_length]; | ||
| 158 | |||
| 159 | extern char change_file_name[]; | ||
| 160 | extern int line[]; | ||
| 161 | extern int change_line; | ||
| 162 | extern int change_depth; | ||
| 163 | extern boolean input_has_ended; | ||
| 164 | extern boolean changing; | ||
| 165 | extern boolean web_file_open; | ||
| 166 | |||
| 167 | /*:6*//*8:*/ | ||
| 168 | #line 125 "common.h" | ||
| 169 | |||
| 170 | extern sixteen_bits section_count; | ||
| 171 | extern boolean changed_section[]; | ||
| 172 | extern boolean change_pending; | ||
| 173 | extern boolean print_where; | ||
| 174 | |||
| 175 | /*:8*//*9:*/ | ||
| 176 | #line 139 "common.h" | ||
| 153 | 177 | ||
| 154 | typedef struct name_info{ | 178 | typedef struct name_info{ |
| 155 | char*byte_start; | 179 | char*byte_start; |
| @@ -173,44 +197,20 @@ extern name_pointer hash[]; · 17 unmodified lines | |||
| 173 | extern hash_pointer hash_end; | 197 | extern hash_pointer hash_end; |
| 174 | extern hash_pointer h; | 198 | extern hash_pointer h; |
| 175 | 199 | ||
| 176 | /*:6*//*8:*/ | 200 | /*:9*//*11:*/ |
| 177 | #line 146 "common.h" | 201 | #line 183 "common.h" |
| 178 | 202 | ||
| 179 | extern int history; | 203 | extern int history; |
| 180 | 204 | ||
| 181 | /*:8*//*10:*/ | 205 | /*:11*//*13:*/ |
| 182 | #line 166 "common.h" | 206 | #line 199 "common.h" |
| 183 | 207 | ||
| 184 | extern int include_depth; | 208 | extern int argc; |
| 185 | extern FILE*file[]; | 209 | extern char**argv; |
| 186 | extern FILE*change_file; | ||
| 187 | extern char C_file_name[]; | 210 | extern char C_file_name[]; |
| 188 | extern char tex_file_name[]; | 211 | extern char tex_file_name[]; |
| 189 | extern char idx_file_name[]; | 212 | extern char idx_file_name[]; |
| 190 | extern char scn_file_name[]; | 213 | extern char scn_file_name[]; |
| 191 | extern char file_name[][max_file_name_length]; | ||
| 192 | |||
| 193 | extern char change_file_name[]; | ||
| 194 | extern int line[]; | ||
| 195 | extern int change_line; | ||
| 196 | extern int change_depth; | ||
| 197 | extern boolean input_has_ended; | ||
| 198 | extern boolean changing; | ||
| 199 | extern boolean web_file_open; | ||
| 200 | |||
| 201 | /*:10*//*12:*/ | ||
| 202 | #line 190 "common.h" | ||
| 203 | |||
| 204 | extern sixteen_bits section_count; | ||
| 205 | extern boolean changed_section[]; | ||
| 206 | extern boolean change_pending; | ||
| 207 | extern boolean print_where; | ||
| 208 | |||
| 209 | /*:12*//*13:*/ | ||
| 210 | #line 203 "common.h" | ||
| 211 | |||
| 212 | extern int argc; | ||
| 213 | extern char**argv; | ||
| 214 | extern boolean flags[]; | 214 | extern boolean flags[]; |
| 215 | 215 | ||
| 216 | /*:13*//*14:*/ | 216 | /*:13*//*14:*/ |
| @@ -232,10 +232,11 @@ boolean program; · 15 unmodified lines | |||
| 232 | 232 | ||
| 233 | /*:18*//*19:*/ | 233 | /*:18*//*19:*/ |
| 234 | #line 92 "common.w" | 234 | #line 92 "common.w" |
| 235 | |||
| 235 | int phase; | 236 | int phase; |
| 236 | 237 | ||
| 237 | /*:19*//*21:*/ | 238 | /*:19*//*21:*/ |
| 238 | #line 129 "common.w" | 239 | #line 130 "common.w" |
| 239 | 240 | ||
| 240 | char section_text[longest_name+1]; | 241 | char section_text[longest_name+1]; |
| 241 | char*section_text_end= section_text+longest_name; | 242 | char*section_text_end= section_text+longest_name; |
| @@ -243,12 +244,12 @@ char*id_first; · 1 unmodified line | |||
| 243 | char*id_loc; | 244 | char*id_loc; |
| 244 | 245 | ||
| 245 | /*:21*//*22:*/ | 246 | /*:21*//*22:*/ |
| 246 | #line 149 "common.w" | 247 | #line 150 "common.w" |
| 247 | 248 | ||
| 248 | char buffer[long_buf_size]; | 249 | char buffer[long_buf_size]; |
| 249 | char*buffer_end= buffer+buf_size-2; | 250 | char*buffer_end= buffer+buf_size-2; |
| 250 | char*limit= buffer; | ||
| 251 | char*loc= buffer; | 251 | char*loc= buffer; |
| 252 | char*limit= buffer; | ||
| 252 | 253 | ||
| 253 | /*:22*//*25:*/ | 254 | /*:22*//*25:*/ |
| 254 | #line 194 "common.w" | 255 | #line 194 "common.w" |
| @@ -259,7 +260,7 @@ FILE*change_file; · 4 unmodified lines | |||
| 259 | char file_name[max_include_depth][max_file_name_length]; | 260 | char file_name[max_include_depth][max_file_name_length]; |
| 260 | 261 | ||
| 261 | char change_file_name[max_file_name_length]; | 262 | char change_file_name[max_file_name_length]; |
| 262 | char alt_web_file_name[max_file_name_length]; | 263 | static char alt_web_file_name[max_file_name_length]; |
| 263 | int line[max_include_depth]; | 264 | int line[max_include_depth]; |
| 264 | int change_line; | 265 | int change_line; |
| 265 | int change_depth; | 266 | int change_depth; |
| @@ -270,11 +271,11 @@ boolean web_file_open= false; · 4 unmodified lines | |||
| 270 | /*:25*//*26:*/ | 271 | /*:25*//*26:*/ |
| 271 | #line 220 "common.w" | 272 | #line 220 "common.w" |
| 272 | 273 | ||
| 273 | char change_buffer[buf_size]; | 274 | static char change_buffer[buf_size]; |
| 274 | char*change_limit; | 275 | static char*change_limit; |
| 275 | 276 | ||
| 276 | /*:26*//*37:*/ | 277 | /*:26*//*37:*/ |
| 277 | #line 401 "common.w" | 278 | #line 399 "common.w" |
| 278 | 279 | ||
| 279 | sixteen_bits section_count; | 280 | sixteen_bits section_count; |
| 280 | boolean changed_section[max_sections]; | 281 | boolean changed_section[max_sections]; |
| @@ -283,7 +284,7 @@ boolean change_pending; · 2 unmodified lines | |||
| 283 | boolean print_where= false; | 284 | boolean print_where= false; |
| 284 | 285 | ||
| 285 | /*:37*//*43:*/ | 286 | /*:37*//*43:*/ |
| 286 | #line 598 "common.w" | 287 | #line 596 "common.w" |
| 287 | 288 | ||
| 288 | char byte_mem[max_bytes]; | 289 | char byte_mem[max_bytes]; |
| 289 | char*byte_mem_end= byte_mem+max_bytes-1; | 290 | char*byte_mem_end= byte_mem+max_bytes-1; |
| @@ -291,25 +292,25 @@ name_info name_dir[max_names]; · 1 unmodified line | |||
| 291 | name_pointer name_dir_end= name_dir+max_names-1; | 292 | name_pointer name_dir_end= name_dir+max_names-1; |
| 292 | 293 | ||
| 293 | /*:43*//*44:*/ | 294 | /*:43*//*44:*/ |
| 294 | #line 609 "common.w" | 295 | #line 607 "common.w" |
| 295 | 296 | ||
| 296 | name_pointer name_ptr; | ||
| 297 | char*byte_ptr; | 297 | char*byte_ptr; |
| 298 | name_pointer name_ptr; | ||
| 298 | 299 | ||
| 299 | /*:44*//*46:*/ | 300 | /*:44*//*46:*/ |
| 300 | #line 629 "common.w" | 301 | #line 627 "common.w" |
| 301 | 302 | ||
| 302 | name_pointer hash[hash_size]; | 303 | name_pointer hash[hash_size]; |
| 303 | hash_pointer hash_end= hash+hash_size-1; | 304 | hash_pointer hash_end= hash+hash_size-1; |
| 304 | hash_pointer h; | 305 | hash_pointer h; |
| 305 | 306 | ||
| 306 | /*:46*//*65:*/ | 307 | /*:46*//*65:*/ |
| 307 | #line 1017 "common.w" | 308 | #line 1014 "common.w" |
| 308 | 309 | ||
| 309 | int history= spotless; | 310 | int history= spotless; |
| 310 | 311 | ||
| 311 | /*:65*//*73:*/ | 312 | /*:65*//*73:*/ |
| 312 | #line 1138 "common.w" | 313 | #line 1135 "common.w" |
| 313 | 314 | ||
| 314 | int argc; | 315 | int argc; |
| 315 | char**argv; | 316 | char**argv; |
| @@ -320,7 +321,7 @@ char scn_file_name[max_file_name_length]; · 4 unmodified lines | |||
| 320 | boolean flags[128]; | 321 | boolean flags[128]; |
| 321 | 322 | ||
| 322 | /*:73*//*83:*/ | 323 | /*:73*//*83:*/ |
| 323 | #line 1286 "common.w" | 324 | #line 1282 "common.w" |
| 324 | 325 | ||
| 325 | FILE*C_file; | 326 | FILE*C_file; |
| 326 | FILE*tex_file; | 327 | FILE*tex_file; |
| @@ -332,7 +333,14 @@ FILE*active_file; · 5 unmodified lines | |||
| 332 | #line 70 "common.w" | 333 | #line 70 "common.w" |
| 333 | 334 | ||
| 334 | /*7:*/ | 335 | /*7:*/ |
| 335 | #line 125 "common.h" | 336 | #line 119 "common.h" |
| 337 | |||
| 338 | extern boolean get_line(void); | ||
| 339 | extern void check_complete(void); | ||
| 340 | extern void reset_input(void); | ||
| 341 | |||
| 342 | /*:7*//*10:*/ | ||
| 343 | #line 162 "common.h" | ||
| 336 | 344 | ||
| 337 | extern boolean names_match(name_pointer,const char*,size_t,eight_bits); | 345 | extern boolean names_match(name_pointer,const char*,size_t,eight_bits); |
| 338 | extern name_pointer id_lookup(const char*,const char*,char); | 346 | extern name_pointer id_lookup(const char*,const char*,char); |
| @@ -344,71 +352,59 @@ extern void print_prefix_name(name_pointer); · 5 unmodified lines | |||
| 344 | extern void print_section_name(name_pointer); | 352 | extern void print_section_name(name_pointer); |
| 345 | extern void sprint_section_name(char*,name_pointer); | 353 | extern void sprint_section_name(char*,name_pointer); |
| 346 | 354 | ||
| 347 | /*:7*//*9:*/ | 355 | /*:10*//*12:*/ |
| 348 | #line 149 "common.h" | 356 | #line 186 "common.h" |
| 349 | 357 | ||
| 350 | extern int wrap_up(void); | 358 | extern int wrap_up(void); |
| 351 | extern void err_print(const char*); | 359 | extern void err_print(const char*); |
| 352 | extern void fatal(const char*,const char*); | 360 | extern void fatal(const char*,const char*); |
| 353 | extern void overflow(const char*); | 361 | extern void overflow(const char*); |
| 354 | 362 | ||
| 355 | /*:9*//*11:*/ | 363 | /*:12*//*15:*/ |
| 356 | #line 184 "common.h" | ||
| 357 | |||
| 358 | extern boolean get_line(void); | ||
| 359 | extern void check_complete(void); | ||
| 360 | extern void reset_input(void); | ||
| 361 | |||
| 362 | /*:11*//*15:*/ | ||
| 363 | #line 223 "common.h" | 364 | #line 223 "common.h" |
| 364 | 365 | ||
| 365 | extern void common_init(void); | 366 | extern void common_init(void); |
| 366 | extern void print_stats(void); | 367 | extern void print_stats(void); |
| 367 | 368 | ||
| 368 | /*:15*//*23:*/ | 369 | /*:15*//*24:*/ |
| 369 | #line 159 "common.w" | 370 | #line 180 "common.w" |
| 370 | |||
| 371 | static boolean input_ln(FILE*); | 371 | static boolean input_ln(FILE*); |
| 372 | 372 | ||
| 373 | /*:23*//*27:*/ | 373 | /*:24*//*28:*/ |
| 374 | #line 231 "common.w" | 374 | #line 241 "common.w" |
| 375 | |||
| 376 | static void prime_the_change_buffer(void); | 375 | static void prime_the_change_buffer(void); |
| 377 | 376 | ||
| 378 | /*:27*//*32:*/ | 377 | /*:28*//*33:*/ |
| 379 | #line 303 "common.w" | 378 | #line 340 "common.w" |
| 380 | |||
| 381 | static void check_change(void); | 379 | static void check_change(void); |
| 382 | 380 | ||
| 383 | /*:32*//*55:*/ | 381 | /*:33*//*55:*/ |
| 384 | #line 776 "common.w" | 382 | #line 774 "common.w" |
| 385 | 383 | ||
| 386 | static int web_strcmp(char*,int,char*,int); | 384 | static int web_strcmp(char*,int,char*,int); |
| 387 | static name_pointer add_section_name(name_pointer,int,char*,char*,int); | 385 | static name_pointer add_section_name(name_pointer,int,char*,char*,int); |
| 388 | static void extend_section_name(name_pointer,char*,char*,int); | 386 | static void extend_section_name(name_pointer,char*,char*,int); |
| 389 | 387 | ||
| 390 | /*:55*//*63:*/ | 388 | /*:55*//*64:*/ |
| 391 | #line 972 "common.w" | 389 | #line 1002 "common.w" |
| 392 | |||
| 393 | static int section_name_cmp(char**,int,name_pointer); | 390 | static int section_name_cmp(char**,int,name_pointer); |
| 394 | 391 | ||
| 395 | /*:63*//*75:*/ | 392 | /*:64*//*76:*/ |
| 396 | #line 1170 "common.w" | 393 | #line 1197 "common.w" |
| 397 | |||
| 398 | static void scan_args(void); | 394 | static void scan_args(void); |
| 399 | 395 | ||
| 400 | /*:75*/ | 396 | /*:76*/ |
| 401 | #line 71 "common.w" | 397 | #line 71 "common.w" |
| 402 | 398 | ||
| 403 | 399 | ||
| 404 | /*:1*//*20:*/ | 400 | /*:1*//*20:*/ |
| 405 | #line 98 "common.w" | 401 | #line 99 "common.w" |
| 406 | 402 | ||
| 407 | void | 403 | void |
| 408 | common_init(void) | 404 | common_init(void) |
| 409 | { | 405 | { |
| 410 | /*45:*/ | 406 | /*45:*/ |
| 411 | #line 613 "common.w" | 407 | #line 611 "common.w" |
| 412 | 408 | ||
| 413 | name_dir->byte_start= byte_ptr= byte_mem; | 409 | name_dir->byte_start= byte_ptr= byte_mem; |
| 414 | name_ptr= name_dir+1; | 410 | name_ptr= name_dir+1; |
| @@ -416,24 +412,24 @@ name_ptr->byte_start= byte_mem; · 1 unmodified line | |||
| 416 | root= NULL; | 412 | root= NULL; |
| 417 | 413 | ||
| 418 | /*:45*//*47:*/ | 414 | /*:45*//*47:*/ |
| 419 | #line 636 "common.w" | 415 | #line 634 "common.w" |
| 420 | 416 | ||
| 421 | for(h= hash;h<=hash_end;*h++= NULL); | 417 | for(h= hash;h<=hash_end;*h++= NULL); |
| 422 | 418 | ||
| 423 | /*:47*/ | 419 | /*:47*/ |
| 424 | #line 102 "common.w" | 420 | #line 103 "common.w" |
| 425 | 421 | ||
| 426 | /*74:*/ | 422 | /*74:*/ |
| 427 | #line 1151 "common.w" | 423 | #line 1148 "common.w" |
| 428 | 424 | ||
| 429 | show_banner= show_happiness= show_progress= make_xrefs= true; | 425 | show_banner= show_happiness= show_progress= make_xrefs= true; |
| 430 | show_stats= false; | 426 | show_stats= false; |
| 431 | 427 | ||
| 432 | /*:74*/ | 428 | /*:74*/ |
| 433 | #line 103 "common.w" | 429 | #line 104 "common.w" |
| 434 | 430 | ||
| 435 | /*84:*/ | 431 | /*84:*/ |
| 436 | #line 1293 "common.w" | 432 | #line 1289 "common.w" |
| 437 | 433 | ||
| 438 | scan_args(); | 434 | scan_args(); |
| 439 | if(program==ctangle){ | 435 | if(program==ctangle){ |
| @@ -447,12 +443,12 @@ fatal("! Cannot open output file ",tex_file_name); · 7 unmodified lines | |||
| 447 | } | 443 | } |
| 448 | 444 | ||
| 449 | /*:84*/ | 445 | /*:84*/ |
| 450 | #line 104 "common.w" | 446 | #line 105 "common.w" |
| 451 | 447 | ||
| 452 | } | 448 | } |
| 453 | 449 | ||
| 454 | /*:20*//*24:*/ | 450 | /*:20*//*23:*/ |
| 455 | #line 162 "common.w" | 451 | #line 160 "common.w" |
| 456 | 452 | ||
| 457 | static boolean input_ln( | 453 | static boolean input_ln( |
| 458 | FILE*fp) | 454 | FILE*fp) |
| @@ -473,15 +469,15 @@ if(c==EOF&&limit==buffer)return false; · 14 unmodified lines | |||
| 473 | return true; | 469 | return true; |
| 474 | } | 470 | } |
| 475 | 471 | ||
| 476 | /*:24*//*28:*/ | 472 | /*:23*//*27:*/ |
| 477 | #line 234 "common.w" | 473 | #line 231 "common.w" |
| 478 | 474 | ||
| 479 | static void | 475 | static void |
| 480 | prime_the_change_buffer(void) | 476 | prime_the_change_buffer(void) |
| 481 | { | 477 | { |
| 482 | change_limit= change_buffer; | 478 | change_limit= change_buffer; |
| 483 | /*29:*/ | 479 | /*29:*/ |
| 484 | #line 248 "common.w" | 480 | #line 247 "common.w" |
| 485 | 481 | ||
| 486 | while(true){ | 482 | while(true){ |
| 487 | change_line++; | 483 | change_line++; |
| @@ -498,10 +494,10 @@ err_print("! Missing @x in change file"); · 10 unmodified lines | |||
| 498 | } | 494 | } |
| 499 | 495 | ||
| 500 | /*:29*/ | 496 | /*:29*/ |
| 501 | #line 239 "common.w" | 497 | #line 236 "common.w" |
| 502 | 498 | ||
| 503 | /*30:*/ | 499 | /*30:*/ |
| 504 | #line 265 "common.w" | 500 | #line 264 "common.w" |
| 505 | 501 | ||
| 506 | do{ | 502 | do{ |
| 507 | change_line++; | 503 | change_line++; |
| @@ -513,10 +509,10 @@ return; · 5 unmodified lines | |||
| 513 | }while(limit==buffer); | 509 | }while(limit==buffer); |
| 514 | 510 | ||
| 515 | /*:30*/ | 511 | /*:30*/ |
| 516 | #line 240 "common.w" | 512 | #line 237 "common.w" |
| 517 | 513 | ||
| 518 | /*31:*/ | 514 | /*31:*/ |
| 519 | #line 275 "common.w" | 515 | #line 274 "common.w" |
| 520 | 516 | ||
| 521 | { | 517 | { |
| 522 | change_limit= change_buffer+(ptrdiff_t)(limit-buffer); | 518 | change_limit= change_buffer+(ptrdiff_t)(limit-buffer); |
| @@ -524,12 +520,12 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); · 1 unmodified line | |||
| 524 | } | 520 | } |
| 525 | 521 | ||
| 526 | /*:31*/ | 522 | /*:31*/ |
| 527 | #line 241 "common.w" | 523 | #line 238 "common.w" |
| 528 | 524 | ||
| 529 | } | 525 | } |
| 530 | 526 | ||
| 531 | /*:28*//*33:*/ | 527 | /*:27*//*32:*/ |
| 532 | #line 306 "common.w" | 528 | #line 302 "common.w" |
| 533 | 529 | ||
| 534 | static void | 530 | static void |
| 535 | check_change(void) | 531 | check_change(void) |
| @@ -552,7 +548,7 @@ return; · 16 unmodified lines | |||
| 552 | if(limit> buffer+1&&buffer[0]=='@'){ | 548 | if(limit> buffer+1&&buffer[0]=='@'){ |
| 553 | char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; | 549 | char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; |
| 554 | /*34:*/ | 550 | /*34:*/ |
| 555 | #line 344 "common.w" | 551 | #line 342 "common.w" |
| 556 | 552 | ||
| 557 | if(xyz_code=='x'||xyz_code=='z'){ | 553 | if(xyz_code=='x'||xyz_code=='z'){ |
| 558 | loc= buffer+2;err_print("! Where is the matching @y?"); | 554 | loc= buffer+2;err_print("! Where is the matching @y?"); |
| @@ -570,11 +566,11 @@ return; · 11 unmodified lines | |||
| 570 | } | 566 | } |
| 571 | 567 | ||
| 572 | /*:34*/ | 568 | /*:34*/ |
| 573 | #line 328 "common.w" | 569 | #line 324 "common.w" |
| 574 | 570 | ||
| 575 | } | 571 | } |
| 576 | /*31:*/ | 572 | /*31:*/ |
| 577 | #line 275 "common.w" | 573 | #line 274 "common.w" |
| 578 | 574 | ||
| 579 | { | 575 | { |
| 580 | change_limit= change_buffer+(ptrdiff_t)(limit-buffer); | 576 | change_limit= change_buffer+(ptrdiff_t)(limit-buffer); |
| @@ -582,7 +578,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); · 1 unmodified line | |||
| 582 | } | 578 | } |
| 583 | 579 | ||
| 584 | /*:31*/ | 580 | /*:31*/ |
| 585 | #line 330 "common.w" | 581 | #line 326 "common.w" |
| 586 | 582 | ||
| 587 | changing= false;cur_line++; | 583 | changing= false;cur_line++; |
| 588 | while(!input_ln(cur_file)){ | 584 | while(!input_ln(cur_file)){ |
| @@ -597,15 +593,15 @@ if(lines_dont_match)n++; · 8 unmodified lines | |||
| 597 | } | 593 | } |
| 598 | } | 594 | } |
| 599 | 595 | ||
| 600 | /*:33*//*35:*/ | 596 | /*:32*//*35:*/ |
| 601 | #line 364 "common.w" | 597 | #line 362 "common.w" |
| 602 | 598 | ||
| 603 | void | 599 | void |
| 604 | reset_input(void) | 600 | reset_input(void) |
| 605 | { | 601 | { |
| 606 | limit= buffer;loc= buffer+1;buffer[0]= ' '; | 602 | limit= buffer;loc= buffer+1;buffer[0]= ' '; |
| 607 | /*36:*/ | 603 | /*36:*/ |
| 608 | #line 379 "common.w" | 604 | #line 377 "common.w" |
| 609 | 605 | ||
| 610 | if((web_file= fopen(web_file_name,"r"))==NULL){ | 606 | if((web_file= fopen(web_file_name,"r"))==NULL){ |
| 611 | strcpy(web_file_name,alt_web_file_name); | 607 | strcpy(web_file_name,alt_web_file_name); |
| @@ -619,7 +615,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) · 7 unmodified lines | |||
| 619 | fatal("! Cannot open change file ",change_file_name); | 615 | fatal("! Cannot open change file ",change_file_name); |
| 620 | 616 | ||
| 621 | /*:36*/ | 617 | /*:36*/ |
| 622 | #line 369 "common.w" | 618 | #line 367 "common.w" |
| 623 | 619 | ||
| 624 | include_depth= 0;cur_line= 0;change_line= 0; | 620 | include_depth= 0;cur_line= 0;change_line= 0; |
| 625 | change_depth= include_depth; | 621 | change_depth= include_depth; |
| @@ -628,14 +624,14 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= false; · 2 unmodified lines | |||
| 628 | } | 624 | } |
| 629 | 625 | ||
| 630 | /*:35*//*38:*/ | 626 | /*:35*//*38:*/ |
| 631 | #line 408 "common.w" | 627 | #line 406 "common.w" |
| 632 | 628 | ||
| 633 | boolean get_line(void) | 629 | boolean get_line(void) |
| 634 | { | 630 | { |
| 635 | restart: | 631 | restart: |
| 636 | if(changing&&include_depth==change_depth) | 632 | if(changing&&include_depth==change_depth) |
| 637 | /*41:*/ | 633 | /*41:*/ |
| 638 | #line 516 "common.w" | 634 | #line 514 "common.w" |
| 639 | { | 635 | { |
| 640 | change_line++; | 636 | change_line++; |
| 641 | if(!input_ln(change_file)){ | 637 | if(!input_ln(change_file)){ |
| @@ -666,11 +662,11 @@ prime_the_change_buffer();changing= !changing;print_where= true; · 24 unmodified lines | |||
| 666 | } | 662 | } |
| 667 | 663 | ||
| 668 | /*:41*/ | 664 | /*:41*/ |
| 669 | #line 413 "common.w" | 665 | #line 411 "common.w" |
| 670 | 666 | ||
| 671 | if(!changing||include_depth> change_depth){ | 667 | if(!changing||include_depth> change_depth){ |
| 672 | /*40:*/ | 668 | /*40:*/ |
| 673 | #line 499 "common.w" | 669 | #line 497 "common.w" |
| 674 | { | 670 | { |
| 675 | cur_line++; | 671 | cur_line++; |
| 676 | while(!input_ln(cur_file)){ | 672 | while(!input_ln(cur_file)){ |
| @@ -689,7 +685,7 @@ if(change_limit> change_buffer)check_change(); · 12 unmodified lines | |||
| 689 | } | 685 | } |
| 690 | 686 | ||
| 691 | /*:40*/ | 687 | /*:40*/ |
| 692 | #line 415 "common.w" | 688 | #line 413 "common.w" |
| 693 | 689 | ||
| 694 | if(changing&&include_depth==change_depth)goto restart; | 690 | if(changing&&include_depth==change_depth)goto restart; |
| 695 | } | 691 | } |
| @@ -710,7 +706,7 @@ goto restart; · 14 unmodified lines | |||
| 710 | } | 706 | } |
| 711 | include_depth++; | 707 | include_depth++; |
| 712 | /*39:*/ | 708 | /*39:*/ |
| 713 | #line 453 "common.w" | 709 | #line 451 "common.w" |
| 714 | { | 710 | { |
| 715 | char temp_file_name[max_file_name_length]; | 711 | char temp_file_name[max_file_name_length]; |
| 716 | char*cur_file_name_end= cur_file_name+max_file_name_length-1; | 712 | char*cur_file_name_end= cur_file_name+max_file_name_length-1; |
| @@ -758,14 +754,14 @@ include_depth--;err_print("! Cannot open include file");goto restart; · 41 unmodified lines | |||
| 758 | } | 754 | } |
| 759 | 755 | ||
| 760 | /*:39*/ | 756 | /*:39*/ |
| 761 | #line 434 "common.w" | 757 | #line 432 "common.w" |
| 762 | 758 | ||
| 763 | } | 759 | } |
| 764 | return true; | 760 | return true; |
| 765 | } | 761 | } |
| 766 | 762 | ||
| 767 | /*:38*//*42:*/ | 763 | /*:38*//*42:*/ |
| 768 | #line 548 "common.w" | 764 | #line 546 "common.w" |
| 769 | 765 | ||
| 770 | void | 766 | void |
| 771 | check_complete(void){ | 767 | check_complete(void){ |
| @@ -779,7 +775,7 @@ err_print("! Change file entry did not match"); · 7 unmodified lines | |||
| 779 | } | 775 | } |
| 780 | 776 | ||
| 781 | /*:42*//*48:*/ | 777 | /*:42*//*48:*/ |
| 782 | #line 641 "common.w" | 778 | #line 639 "common.w" |
| 783 | 779 | ||
| 784 | name_pointer | 780 | name_pointer |
| 785 | id_lookup( | 781 | id_lookup( |
| @@ -794,17 +790,17 @@ name_pointer p; · 8 unmodified lines | |||
| 794 | if(last==NULL)for(last= first;*last!='\0';last++); | 790 | if(last==NULL)for(last= first;*last!='\0';last++); |
| 795 | l= (int)(last-first); | 791 | l= (int)(last-first); |
| 796 | /*49:*/ | 792 | /*49:*/ |
| 797 | #line 664 "common.w" | 793 | #line 662 "common.w" |
| 798 | 794 | ||
| 799 | h= (eight_bits)*i; | 795 | h= (eight_bits)*i; |
| 800 | while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size; | 796 | while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size; |
| 801 | 797 | ||
| 802 | 798 | ||
| 803 | /*:49*/ | 799 | /*:49*/ |
| 804 | #line 654 "common.w" | 800 | #line 652 "common.w" |
| 805 | 801 | ||
| 806 | /*50:*/ | 802 | /*50:*/ |
| 807 | #line 672 "common.w" | 803 | #line 670 "common.w" |
| 808 | 804 | ||
| 809 | p= hash[h]; | 805 | p= hash[h]; |
| 810 | while(p&&!names_match(p,first,l,t))p= p->link; | 806 | while(p&&!names_match(p,first,l,t))p= p->link; |
| @@ -814,10 +810,10 @@ p->link= hash[h];hash[h]= p; · 3 unmodified lines | |||
| 814 | } | 810 | } |
| 815 | 811 | ||
| 816 | /*:50*/ | 812 | /*:50*/ |
| 817 | #line 655 "common.w" | 813 | #line 653 "common.w" |
| 818 | 814 | ||
| 819 | if(p==name_ptr)/*51:*/ | 815 | if(p==name_ptr)/*51:*/ |
| 820 | #line 683 "common.w" | 816 | #line 681 "common.w" |
| 821 | { | 817 | { |
| 822 | if(byte_ptr+l> byte_mem_end)overflow("byte memory"); | 818 | if(byte_ptr+l> byte_mem_end)overflow("byte memory"); |
| 823 | if(name_ptr>=name_dir_end)overflow("name"); | 819 | if(name_ptr>=name_dir_end)overflow("name"); |
| @@ -827,13 +823,13 @@ init_p(p,t); · 3 unmodified lines | |||
| 827 | } | 823 | } |
| 828 | 824 | ||
| 829 | /*:51*/ | 825 | /*:51*/ |
| 830 | #line 656 "common.w" | 826 | #line 654 "common.w" |
| 831 | 827 | ||
| 832 | return p; | 828 | return p; |
| 833 | } | 829 | } |
| 834 | 830 | ||
| 835 | /*:48*//*52:*/ | 831 | /*:48*//*52:*/ |
| 836 | #line 715 "common.w" | 832 | #line 713 "common.w" |
| 837 | 833 | ||
| 838 | void | 834 | void |
| 839 | print_section_name( | 835 | print_section_name( |
| @@ -854,7 +850,7 @@ if(q)term_write("...",3); · 14 unmodified lines | |||
| 854 | } | 850 | } |
| 855 | 851 | ||
| 856 | /*:52*//*53:*/ | 852 | /*:52*//*53:*/ |
| 857 | #line 734 "common.w" | 853 | #line 732 "common.w" |
| 858 | 854 | ||
| 859 | void | 855 | void |
| 860 | sprint_section_name( | 856 | sprint_section_name( |
| @@ -877,7 +873,7 @@ s= p->byte_start; · 16 unmodified lines | |||
| 877 | } | 873 | } |
| 878 | 874 | ||
| 879 | /*:53*//*54:*/ | 875 | /*:53*//*54:*/ |
| 880 | #line 755 "common.w" | 876 | #line 753 "common.w" |
| 881 | 877 | ||
| 882 | void | 878 | void |
| 883 | print_prefix_name( | 879 | print_prefix_name( |
| @@ -890,7 +886,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); · 6 unmodified lines | |||
| 890 | } | 886 | } |
| 891 | 887 | ||
| 892 | /*:54*//*56:*/ | 888 | /*:54*//*56:*/ |
| 893 | #line 781 "common.w" | 889 | #line 779 "common.w" |
| 894 | 890 | ||
| 895 | static int web_strcmp( | 891 | static int web_strcmp( |
| 896 | char*j, | 892 | char*j, |
| @@ -908,7 +904,7 @@ else return greater; · 11 unmodified lines | |||
| 908 | } | 904 | } |
| 909 | 905 | ||
| 910 | /*:56*//*57:*/ | 906 | /*:56*//*57:*/ |
| 911 | #line 810 "common.w" | 907 | #line 808 "common.w" |
| 912 | 908 | ||
| 913 | static name_pointer | 909 | static name_pointer |
| 914 | add_section_name( | 910 | add_section_name( |
| @@ -939,7 +935,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); · 24 unmodified lines | |||
| 939 | } | 935 | } |
| 940 | 936 | ||
| 941 | /*:57*//*58:*/ | 937 | /*:57*//*58:*/ |
| 942 | #line 839 "common.w" | 938 | #line 837 "common.w" |
| 943 | 939 | ||
| 944 | static void | 940 | static void |
| 945 | extend_section_name( | 941 | extend_section_name( |
| @@ -963,7 +959,7 @@ if(ispref)*(byte_ptr-1)= ' '; · 17 unmodified lines | |||
| 963 | } | 959 | } |
| 964 | 960 | ||
| 965 | /*:58*//*59:*/ | 961 | /*:58*//*59:*/ |
| 966 | #line 867 "common.w" | 962 | #line 865 "common.w" |
| 967 | 963 | ||
| 968 | name_pointer | 964 | name_pointer |
| 969 | section_lookup( | 965 | section_lookup( |
| @@ -978,7 +974,7 @@ name_pointer par= NULL; · 8 unmodified lines | |||
| 978 | 974 | ||
| 979 | int name_len= (int)(last-first)+1; | 975 | int name_len= (int)(last-first)+1; |
| 980 | /*60:*/ | 976 | /*60:*/ |
| 981 | #line 891 "common.w" | 977 | #line 889 "common.w" |
| 982 | 978 | ||
| 983 | while(p){ | 979 | while(p){ |
| 984 | c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); | 980 | c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); |
| @@ -1005,19 +1001,19 @@ p= q,q= NULL; · 20 unmodified lines | |||
| 1005 | } | 1001 | } |
| 1006 | 1002 | ||
| 1007 | /*:60*/ | 1003 | /*:60*/ |
| 1008 | #line 881 "common.w" | 1004 | #line 879 "common.w" |
| 1009 | 1005 | ||
| 1010 | /*61:*/ | 1006 | /*61:*/ |
| 1011 | #line 916 "common.w" | 1007 | #line 914 "common.w" |
| 1012 | 1008 | ||
| 1013 | if(r==NULL) | 1009 | if(r==NULL) |
| 1014 | return add_section_name(par,c,first,last+1,ispref); | 1010 | return add_section_name(par,c,first,last+1,ispref); |
| 1015 | 1011 | ||
| 1016 | /*:61*/ | 1012 | /*:61*/ |
| 1017 | #line 882 "common.w" | 1013 | #line 880 "common.w" |
| 1018 | 1014 | ||
| 1019 | /*62:*/ | 1015 | /*62:*/ |
| 1020 | #line 924 "common.w" | 1016 | #line 922 "common.w" |
| 1021 | 1017 | ||
| 1022 | switch(section_name_cmp(&first,name_len,r)){ | 1018 | switch(section_name_cmp(&first,name_len,r)){ |
| 1023 | 1019 | ||
| @@ -1051,12 +1047,12 @@ return r; · 27 unmodified lines | |||
| 1051 | } | 1047 | } |
| 1052 | 1048 | ||
| 1053 | /*:62*/ | 1049 | /*:62*/ |
| 1054 | #line 883 "common.w" | 1050 | #line 881 "common.w" |
| 1055 | 1051 | ||
| 1056 | } | 1052 | } |
| 1057 | 1053 | ||
| 1058 | /*:59*//*64:*/ | 1054 | /*:59*//*63:*/ |
| 1059 | #line 975 "common.w" | 1055 | #line 970 "common.w" |
| 1060 | 1056 | ||
| 1061 | static int section_name_cmp( | 1057 | static int section_name_cmp( |
| 1062 | char**pfirst, | 1058 | char**pfirst, |
| @@ -1089,8 +1085,8 @@ default:return c; · 26 unmodified lines | |||
| 1089 | } | 1085 | } |
| 1090 | } | 1086 | } |
| 1091 | 1087 | ||
| 1092 | /*:64*//*66:*/ | 1088 | /*:63*//*66:*/ |
| 1093 | #line 1027 "common.w" | 1089 | #line 1024 "common.w" |
| 1094 | 1090 | ||
| 1095 | void | 1091 | void |
| 1096 | err_print( | 1092 | err_print( |
| @@ -1099,7 +1095,7 @@ const char*s) · 2 unmodified lines | |||
| 1099 | char*k,*l; | 1095 | char*k,*l; |
| 1100 | printf(*s=='!'?"\n%s":"%s",s); | 1096 | printf(*s=='!'?"\n%s":"%s",s); |
| 1101 | if(web_file_open)/*67:*/ | 1097 | if(web_file_open)/*67:*/ |
| 1102 | #line 1047 "common.w" | 1098 | #line 1044 "common.w" |
| 1103 | 1099 | ||
| 1104 | {if(changing&&include_depth==change_depth) | 1100 | {if(changing&&include_depth==change_depth) |
| 1105 | printf(". (l. %d of change file)\n",change_line); | 1101 | printf(". (l. %d of change file)\n",change_line); |
| @@ -1119,20 +1115,20 @@ putchar(' '); · 13 unmodified lines | |||
| 1119 | } | 1115 | } |
| 1120 | 1116 | ||
| 1121 | /*:67*/ | 1117 | /*:67*/ |
| 1122 | #line 1034 "common.w" | 1118 | #line 1031 "common.w" |
| 1123 | 1119 | ||
| 1124 | update_terminal;mark_error; | 1120 | update_terminal;mark_error; |
| 1125 | } | 1121 | } |
| 1126 | 1122 | ||
| 1127 | /*:66*//*68:*/ | 1123 | /*:66*//*68:*/ |
| 1128 | #line 1079 "common.w" | 1124 | #line 1076 "common.w" |
| 1129 | 1125 | ||
| 1130 | int wrap_up(void){ | 1126 | int wrap_up(void){ |
| 1131 | if(show_progress)new_line; | 1127 | if(show_progress)new_line; |
| 1132 | if(show_stats) | 1128 | if(show_stats) |
| 1133 | print_stats(); | 1129 | print_stats(); |
| 1134 | /*69:*/ | 1130 | /*69:*/ |
| 1135 | #line 1089 "common.w" | 1131 | #line 1086 "common.w" |
| 1136 | 1132 | ||
| 1137 | switch(history){ | 1133 | switch(history){ |
| 1138 | case spotless:if(show_happiness)puts("(No errors were found.)");break; | 1134 | case spotless:if(show_happiness)puts("(No errors were found.)");break; |
| @@ -1144,14 +1140,14 @@ case fatal_message:puts("(That was a fatal error, my friend.)"); · 5 unmodified lines | |||
| 1144 | } | 1140 | } |
| 1145 | 1141 | ||
| 1146 | /*:69*/ | 1142 | /*:69*/ |
| 1147 | #line 1084 "common.w" | 1143 | #line 1081 "common.w" |
| 1148 | 1144 | ||
| 1149 | if(history> harmless_message)return EXIT_FAILURE; | 1145 | if(history> harmless_message)return EXIT_FAILURE; |
| 1150 | else return EXIT_SUCCESS; | 1146 | else return EXIT_SUCCESS; |
| 1151 | } | 1147 | } |
| 1152 | 1148 | ||
| 1153 | /*:68*//*70:*/ | 1149 | /*:68*//*70:*/ |
| 1154 | #line 1105 "common.w" | 1150 | #line 1102 "common.w" |
| 1155 | void | 1151 | void |
| 1156 | fatal( | 1152 | fatal( |
| 1157 | const char*s,const char*t) | 1153 | const char*s,const char*t) |
| @@ -1162,7 +1158,7 @@ history= fatal_message;exit(wrap_up()); · 4 unmodified lines | |||
| 1162 | } | 1158 | } |
| 1163 | 1159 | ||
| 1164 | /*:70*//*71:*/ | 1160 | /*:70*//*71:*/ |
| 1165 | #line 1116 "common.w" | 1161 | #line 1113 "common.w" |
| 1166 | void | 1162 | void |
| 1167 | overflow( | 1163 | overflow( |
| 1168 | const char*t) | 1164 | const char*t) |
| @@ -1171,8 +1167,8 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); · 2 unmodified lines | |||
| 1171 | } | 1167 | } |
| 1172 | 1168 | ||
| 1173 | 1169 | ||
| 1174 | /*:71*//*76:*/ | 1170 | /*:71*//*75:*/ |
| 1175 | #line 1173 "common.w" | 1171 | #line 1167 "common.w" |
| 1176 | 1172 | ||
| 1177 | static void | 1173 | static void |
| 1178 | scan_args(void) | 1174 | scan_args(void) |
| @@ -1186,7 +1182,7 @@ boolean found_web= false,found_change= false,found_out= false; · 7 unmodified lines | |||
| 1186 | strcpy(change_file_name,"/dev/null"); | 1182 | strcpy(change_file_name,"/dev/null"); |
| 1187 | while(--argc> 0){ | 1183 | while(--argc> 0){ |
| 1188 | if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ | 1184 | if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/ |
| 1189 | #line 1262 "common.w" | 1185 | #line 1258 "common.w" |
| 1190 | 1186 | ||
| 1191 | { | 1187 | { |
| 1192 | for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) | 1188 | for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) |
| @@ -1194,7 +1190,7 @@ flags[(eight_bits)*dot_pos]= flag_change; · 1 unmodified line | |||
| 1194 | } | 1190 | } |
| 1195 | 1191 | ||
| 1196 | /*:80*/ | 1192 | /*:80*/ |
| 1197 | #line 1185 "common.w" | 1193 | #line 1179 "common.w" |
| 1198 | 1194 | ||
| 1199 | else{ | 1195 | else{ |
| 1200 | s= name_pos= *argv;dot_pos= NULL; | 1196 | s= name_pos= *argv;dot_pos= NULL; |
| @@ -1204,17 +1200,17 @@ else if(*s=='/')dot_pos= NULL,name_pos= ++s; · 3 unmodified lines | |||
| 1204 | else s++; | 1200 | else s++; |
| 1205 | } | 1201 | } |
| 1206 | if(!found_web)/*77:*/ | 1202 | if(!found_web)/*77:*/ |
| 1207 | #line 1210 "common.w" | 1203 | #line 1206 "common.w" |
| 1208 | 1204 | ||
| 1209 | { | 1205 | { |
| 1210 | if(s-*argv> max_file_name_length-5) | 1206 | if(s-*argv> max_file_name_length-5) |
| 1211 | /*82:*/ | 1207 | /*82:*/ |
| 1212 | #line 1280 "common.w" | 1208 | #line 1276 "common.w" |
| 1213 | fatal("! Filename too long\n",*argv); | 1209 | fatal("! Filename too long\n",*argv); |
| 1214 | 1210 | ||
| 1215 | 1211 | ||
| 1216 | /*:82*/ | 1212 | /*:82*/ |
| 1217 | #line 1213 "common.w" | 1213 | #line 1209 "common.w" |
| 1218 | 1214 | ||
| 1219 | if(dot_pos==NULL) | 1215 | if(dot_pos==NULL) |
| 1220 | sprintf(web_file_name,"%s.w",*argv); | 1216 | sprintf(web_file_name,"%s.w",*argv); |
| @@ -1231,21 +1227,21 @@ found_web= true; · 10 unmodified lines | |||
| 1231 | } | 1227 | } |
| 1232 | 1228 | ||
| 1233 | /*:77*/ | 1229 | /*:77*/ |
| 1234 | #line 1194 "common.w" | 1230 | #line 1188 "common.w" |
| 1235 | 1231 | ||
| 1236 | else if(!found_change)/*78:*/ | 1232 | else if(!found_change)/*78:*/ |
| 1237 | #line 1228 "common.w" | 1233 | #line 1224 "common.w" |
| 1238 | 1234 | ||
| 1239 | { | 1235 | { |
| 1240 | if(strcmp(*argv,"-")!=0){ | 1236 | if(strcmp(*argv,"-")!=0){ |
| 1241 | if(s-*argv> max_file_name_length-4) | 1237 | if(s-*argv> max_file_name_length-4) |
| 1242 | /*82:*/ | 1238 | /*82:*/ |
| 1243 | #line 1280 "common.w" | 1239 | #line 1276 "common.w" |
| 1244 | fatal("! Filename too long\n",*argv); | 1240 | fatal("! Filename too long\n",*argv); |
| 1245 | 1241 | ||
| 1246 | 1242 | ||
| 1247 | /*:82*/ | 1243 | /*:82*/ |
| 1248 | #line 1232 "common.w" | 1244 | #line 1228 "common.w" |
| 1249 | 1245 | ||
| 1250 | if(dot_pos==NULL) | 1246 | if(dot_pos==NULL) |
| 1251 | sprintf(change_file_name,"%s.ch",*argv); | 1247 | sprintf(change_file_name,"%s.ch",*argv); |
| @@ -1255,20 +1251,20 @@ found_change= true; · 3 unmodified lines | |||
| 1255 | } | 1251 | } |
| 1256 | 1252 | ||
| 1257 | /*:78*/ | 1253 | /*:78*/ |
| 1258 | #line 1195 "common.w" | 1254 | #line 1189 "common.w" |
| 1259 | 1255 | ||
| 1260 | else if(!found_out)/*79:*/ | 1256 | else if(!found_out)/*79:*/ |
| 1261 | #line 1240 "common.w" | 1257 | #line 1236 "common.w" |
| 1262 | 1258 | ||
| 1263 | { | 1259 | { |
| 1264 | if(s-*argv> max_file_name_length-5) | 1260 | if(s-*argv> max_file_name_length-5) |
| 1265 | /*82:*/ | 1261 | /*82:*/ |
| 1266 | #line 1280 "common.w" | 1262 | #line 1276 "common.w" |
| 1267 | fatal("! Filename too long\n",*argv); | 1263 | fatal("! Filename too long\n",*argv); |
| 1268 | 1264 | ||
| 1269 | 1265 | ||
| 1270 | /*:82*/ | 1266 | /*:82*/ |
| 1271 | #line 1243 "common.w" | 1267 | #line 1239 "common.w" |
| 1272 | 1268 | ||
| 1273 | if(dot_pos==NULL){ | 1269 | if(dot_pos==NULL){ |
| 1274 | sprintf(tex_file_name,"%s.tex",*argv); | 1270 | sprintf(tex_file_name,"%s.tex",*argv); |
| @@ -1288,10 +1284,10 @@ found_out= true; · 13 unmodified lines | |||
| 1288 | } | 1284 | } |
| 1289 | 1285 | ||
| 1290 | /*:79*/ | 1286 | /*:79*/ |
| 1291 | #line 1196 "common.w" | 1287 | #line 1190 "common.w" |
| 1292 | 1288 | ||
| 1293 | else/*81:*/ | 1289 | else/*81:*/ |
| 1294 | #line 1268 "common.w" | 1290 | #line 1264 "common.w" |
| 1295 | 1291 | ||
| 1296 | { | 1292 | { |
| 1297 | if(program==ctangle) | 1293 | if(program==ctangle) |
| @@ -1305,12 +1301,12 @@ else fatal( · 7 unmodified lines | |||
| 1305 | } | 1301 | } |
| 1306 | 1302 | ||
| 1307 | /*:81*/ | 1303 | /*:81*/ |
| 1308 | #line 1197 "common.w" | 1304 | #line 1191 "common.w" |
| 1309 | 1305 | ||
| 1310 | } | 1306 | } |
| 1311 | } | 1307 | } |
| 1312 | if(!found_web)/*81:*/ | 1308 | if(!found_web)/*81:*/ |
| 1313 | #line 1268 "common.w" | 1309 | #line 1264 "common.w" |
| 1314 | 1310 | ||
| 1315 | { | 1311 | { |
| 1316 | if(program==ctangle) | 1312 | if(program==ctangle) |
| @@ -1324,8 +1320,8 @@ else fatal( · 7 unmodified lines | |||
| 1324 | } | 1320 | } |
| 1325 | 1321 | ||
| 1326 | /*:81*/ | 1322 | /*:81*/ |
| 1327 | #line 1200 "common.w" | 1323 | #line 1194 "common.w" |
| 1328 | 1324 | ||
| 1329 | } | 1325 | } |
| 1330 | 1326 | ||
| 1331 | /*:76*/ | 1327 | /*:75*/ |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | % This program by Silvio Levy and Donald E. Knuth | 2 | % This program by Silvio Levy and Donald E. Knuth |
| 3 | % is based on a program by Knuth. | 3 | % is based on a program by Knuth. |
| 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. | 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. |
| 5 | % Version 4.1 --- February 2021 (works also with later versions) | 5 | % Version 4.2 --- February 2021 (works also with later versions) |
| 6 | 6 | ||
| 7 | % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth | 7 | % Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth |
| 8 | 8 | ||
| @@ -91,6 +91,43 @@ extern char *buffer_end; /* end of |buffer| */ · 82 unmodified lines | |||
| 91 | extern char *loc; /* points to the next character to be read from the buffer */ | 91 | extern char *loc; /* points to the next character to be read from the buffer */ |
| 92 | extern char *limit; /* points to the last character in the buffer */ | 92 | extern char *limit; /* points to the last character in the buffer */ |
| 93 | 93 | ||
| 94 | @ Code related to file handling: | ||
| 95 | @f line x /* make |line| an unreserved word */ | ||
| 96 | @d max_include_depth 10 /* maximum number of source files open | ||
| 97 | simultaneously, not counting the change file */ | ||
| 98 | @d max_file_name_length 1024 | ||
| 99 | @d cur_file file[include_depth] /* current file */ | ||
| 100 | @d cur_file_name file_name[include_depth] /* current file name */ | ||
| 101 | @d cur_line line[include_depth] /* number of current line in current file */ | ||
| 102 | @d web_file file[0] /* main source file */ | ||
| 103 | @d web_file_name file_name[0] /* main source file name */ | ||
| 104 | |||
| 105 | @<Common code...@>= | ||
| 106 | extern int include_depth; /* current level of nesting */ | ||
| 107 | extern FILE *file[]; /* stack of non-change files */ | ||
| 108 | extern FILE *change_file; /* change file */ | ||
| 109 | extern char file_name[][max_file_name_length]; | ||
| 110 | /* stack of non-change file names */ | ||
| 111 | extern char change_file_name[]; /* name of change file */ | ||
| 112 | extern int line[]; /* number of current line in the stacked files */ | ||
| 113 | extern int change_line; /* number of current line in change file */ | ||
| 114 | extern int change_depth; /* where \.{@@y} originated during a change */ | ||
| 115 | extern boolean input_has_ended; /* if there is no more input */ | ||
| 116 | extern boolean changing; /* if the current line is from |change_file| */ | ||
| 117 | extern boolean web_file_open; /* if the web file is being read */ | ||
| 118 | |||
| 119 | @ @<Predecl...@>= | ||
| 120 | extern boolean get_line(void); /* inputs the next line */ | ||
| 121 | extern void check_complete(void); /* checks that all changes were picked up */ | ||
| 122 | extern void reset_input(void); /* initialize to read the web file and change file */ | ||
| 123 | |||
| 124 | @ Code related to section numbers: | ||
| 125 | @<Common code...@>= | ||
| 126 | extern sixteen_bits section_count; /* the current section number */ | ||
| 127 | extern boolean changed_section[]; /* is the section changed? */ | ||
| 128 | extern boolean change_pending; /* is a decision about change still unclear? */ | ||
| 129 | extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */ | ||
| 130 | |||
| 94 | @ Code related to identifier and section name storage: | 131 | @ Code related to identifier and section name storage: |
| 95 | @d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */ | 132 | @d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */ |
| 96 | @d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */ | 133 | @d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */ |
| @@ -131,7 +168,7 @@ extern void init_node(name_pointer);@/ · 34 unmodified lines | |||
| 131 | extern void init_p(name_pointer,eight_bits);@/ | 168 | extern void init_p(name_pointer,eight_bits);@/ |
| 132 | extern void print_prefix_name(name_pointer);@/ | 169 | extern void print_prefix_name(name_pointer);@/ |
| 133 | extern void print_section_name(name_pointer);@/ | 170 | extern void print_section_name(name_pointer);@/ |
| 134 | extern void sprint_section_name(char *,name_pointer);@/ | 171 | extern void sprint_section_name(char *,name_pointer); |
| 135 | 172 | ||
| 136 | @ Code related to error handling: | 173 | @ Code related to error handling: |
| 137 | @d spotless 0 /* |history| value for normal jobs */ | 174 | @d spotless 0 /* |history| value for normal jobs */ |
| @@ -152,47 +189,6 @@ extern void err_print(const char *); /* print error message and context */ · 14 unmodified lines | |||
| 152 | extern void fatal(const char *,const char *); /* issue error message and die */ | 189 | extern void fatal(const char *,const char *); /* issue error message and die */ |
| 153 | extern void overflow(const char *); /* succumb because a table has overflowed */ | 190 | extern void overflow(const char *); /* succumb because a table has overflowed */ |
| 154 | 191 | ||
| 155 | @ Code related to file handling: | ||
| 156 | @f line x /* make |line| an unreserved word */ | ||
| 157 | @d max_include_depth 10 /* maximum number of source files open | ||
| 158 | simultaneously, not counting the change file */ | ||
| 159 | @d max_file_name_length 1024 | ||
| 160 | @d cur_file file[include_depth] /* current file */ | ||
| 161 | @d cur_file_name file_name[include_depth] /* current file name */ | ||
| 162 | @d cur_line line[include_depth] /* number of current line in current file */ | ||
| 163 | @d web_file file[0] /* main source file */ | ||
| 164 | @d web_file_name file_name[0] /* main source file name */ | ||
| 165 | |||
| 166 | @<Common code...@>= | ||
| 167 | extern int include_depth; /* current level of nesting */ | ||
| 168 | extern FILE *file[]; /* stack of non-change files */ | ||
| 169 | extern FILE *change_file; /* change file */ | ||
| 170 | extern char C_file_name[]; /* name of |C_file| */ | ||
| 171 | extern char tex_file_name[]; /* name of |tex_file| */ | ||
| 172 | extern char idx_file_name[]; /* name of |idx_file| */ | ||
| 173 | extern char scn_file_name[]; /* name of |scn_file| */ | ||
| 174 | extern char file_name[][max_file_name_length]; | ||
| 175 | /* stack of non-change file names */ | ||
| 176 | extern char change_file_name[]; /* name of change file */ | ||
| 177 | extern int line[]; /* number of current line in the stacked files */ | ||
| 178 | extern int change_line; /* number of current line in change file */ | ||
| 179 | extern int change_depth; /* where \.{@@y} originated during a change */ | ||
| 180 | extern boolean input_has_ended; /* if there is no more input */ | ||
| 181 | extern boolean changing; /* if the current line is from |change_file| */ | ||
| 182 | extern boolean web_file_open; /* if the web file is being read */ | ||
| 183 | |||
| 184 | @ @<Predecl...@>= | ||
| 185 | extern boolean get_line(void); /* inputs the next line */ | ||
| 186 | extern void check_complete(void); /* checks that all changes were picked up */ | ||
| 187 | extern void reset_input(void); /* initialize to read the web file and change file */ | ||
| 188 | |||
| 189 | @ Code related to section numbers: | ||
| 190 | @<Common code...@>= | ||
| 191 | extern sixteen_bits section_count; /* the current section number */ | ||
| 192 | extern boolean changed_section[]; /* is the section changed? */ | ||
| 193 | extern boolean change_pending; /* is a decision about change still unclear? */ | ||
| 194 | extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */ | ||
| 195 | |||
| 196 | @ Code related to command line arguments: | 192 | @ Code related to command line arguments: |
| 197 | @d show_banner flags['b'] /* should the banner line be printed? */ | 193 | @d show_banner flags['b'] /* should the banner line be printed? */ |
| 198 | @d show_progress flags['p'] /* should progress reports be printed? */ | 194 | @d show_progress flags['p'] /* should progress reports be printed? */ |
| @@ -203,9 +199,13 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */ · 4 unmodified lines | |||
| 203 | @<Common code...@>= | 199 | @<Common code...@>= |
| 204 | extern int argc; /* copy of |ac| parameter to |main| */ | 200 | extern int argc; /* copy of |ac| parameter to |main| */ |
| 205 | extern char **argv; /* copy of |av| parameter to |main| */ | 201 | extern char **argv; /* copy of |av| parameter to |main| */ |
| 202 | extern char C_file_name[]; /* name of |C_file| */ | ||
| 203 | extern char tex_file_name[]; /* name of |tex_file| */ | ||
| 204 | extern char idx_file_name[]; /* name of |idx_file| */ | ||
| 205 | extern char scn_file_name[]; /* name of |scn_file| */ | ||
| 206 | extern boolean flags[]; /* an option for each 7-bit code */ | 206 | extern boolean flags[]; /* an option for each 7-bit code */ |
| 207 | 207 | ||
| 208 | @ Code relating to output: | 208 | @ Code related to output: |
| 209 | @d update_terminal fflush(stdout) /* empty the terminal output buffer */ | 209 | @d update_terminal fflush(stdout) /* empty the terminal output buffer */ |
| 210 | @d new_line putchar('\n') @d putxchar putchar | 210 | @d new_line putchar('\n') @d putxchar putchar |
| 211 | @d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout) | 211 | @d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout) |
| @@ -222,7 +222,7 @@ extern FILE *active_file; /* currently active file for \.{CWEAVE} output */ · 10 unmodified lines | |||
| 222 | @ The procedure that gets everything rolling: | 222 | @ The procedure that gets everything rolling: |
| 223 | @<Predecl...@>= | 223 | @<Predecl...@>= |
| 224 | extern void common_init(void);@/ | 224 | extern void common_init(void);@/ |
| 225 | extern void print_stats(void);@/ | 225 | extern void print_stats(void); |
| 226 | 226 | ||
| 227 | @ The following parameters were sufficient in the original \.{WEB} to | 227 | @ The following parameters were sufficient in the original \.{WEB} to |
| 228 | handle \TEX/, so they should be sufficient for most applications of | 228 | handle \TEX/, so they should be sufficient for most applications of |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | % This program by Silvio Levy and Donald E. Knuth | 2 | % This program by Silvio Levy and Donald E. Knuth |
| 3 | % is based on a program by Knuth. | 3 | % is based on a program by Knuth. |
| 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. | 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. |
| 5 | % Version 4.1 --- February 2021 | 5 | % Version 4.2 --- February 2021 |
| 6 | 6 | ||
| 7 | % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth | 7 | % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth |
| 8 | 8 | ||
| @@ -22,12 +22,12 @@ · 13 unmodified lines | |||
| 22 | 22 | ||
| 23 | \def\v{\char'174} % vertical (|) in typewriter font | 23 | \def\v{\char'174} % vertical (|) in typewriter font |
| 24 | 24 | ||
| 25 | \def\title{Common code for CTANGLE and CWEAVE (Version 4.1)} | 25 | \def\title{Common code for CTANGLE and CWEAVE (Version 4.2)} |
| 26 | \def\topofcontents{\null\vfill | 26 | \def\topofcontents{\null\vfill |
| 27 | \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and | 27 | \centerline{\titlefont Common code for {\ttitlefont CTANGLE} and |
| 28 | {\ttitlefont CWEAVE}} | 28 | {\ttitlefont CWEAVE}} |
| 29 | \vskip 15pt | 29 | \vskip 15pt |
| 30 | \centerline{(Version 4.1)} | 30 | \centerline{(Version 4.2)} |
| 31 | \vfill} | 31 | \vfill} |
| 32 | \def\botofcontents{\vfill | 32 | \def\botofcontents{\vfill |
| 33 | \noindent | 33 | \noindent |
| @@ -68,7 +68,7 @@ The file begins with a few basic definitions. · 34 unmodified lines | |||
| 68 | @h | 68 | @h |
| 69 | @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ | 69 | @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ |
| 70 | @<Global variables@>@/ | 70 | @<Global variables@>@/ |
| 71 | @<Predeclaration of procedures@>@/ | 71 | @<Predeclaration of procedures@> |
| 72 | 72 | ||
| 73 | @ The details will be filled in due course. The interface of this module | 73 | @ The details will be filled in due course. The interface of this module |
| 74 | is included first. It is also used by the main programs. | 74 | is included first. It is also used by the main programs. |
| @@ -89,7 +89,8 @@ produces the \TEX/ output file, and finally it sorts and outputs the index. · 14 unmodified lines | |||
| 89 | Similarly, \.{CTANGLE} operates in two phases. | 89 | Similarly, \.{CTANGLE} operates in two phases. |
| 90 | The global variable |phase| tells which phase we are in. | 90 | The global variable |phase| tells which phase we are in. |
| 91 | 91 | ||
| 92 | @<Global var...@>= int phase; /* which phase are we in? */ | 92 | @<Global var...@>= |
| 93 | int phase; /* which phase are we in? */ | ||
| 93 | 94 | ||
| 94 | @ There's an initialization procedure that gets both \.{CTANGLE} and | 95 | @ There's an initialization procedure that gets both \.{CTANGLE} and |
| 95 | \.{CWEAVE} off to a good start. We will fill in the details of this | 96 | \.{CWEAVE} off to a good start. We will fill in the details of this |
| @@ -149,17 +150,14 @@ some of \.{CWEB}'s routines use the fact that it is safe to refer to · 53 unmodified lines | |||
| 149 | @<Global var...@>= | 150 | @<Global var...@>= |
| 150 | char buffer[long_buf_size]; /* where each line of input goes */ | 151 | char buffer[long_buf_size]; /* where each line of input goes */ |
| 151 | char *buffer_end=buffer+buf_size-2; /* end of |buffer| */ | 152 | char *buffer_end=buffer+buf_size-2; /* end of |buffer| */ |
| 152 | char *limit=buffer; /* points to the last character in the buffer */ | ||
| 153 | char *loc=buffer; /* points to the next character to be read from the buffer */ | 153 | char *loc=buffer; /* points to the next character to be read from the buffer */ |
| 154 | char *limit=buffer; /* points to the last character in the buffer */ | ||
| 154 | 155 | ||
| 155 | @ In the unlikely event that your standard I/O library does not | 156 | @ In the unlikely event that your standard I/O library does not |
| 156 | support |feof|, |getc|, and |ungetc| you may have to change things here. | 157 | support |feof|, |getc|, and |ungetc| you may have to change things here. |
| 157 | @^system dependencies@> | 158 | @^system dependencies@> |
| 158 | 159 | ||
| 159 | @<Predecl...@>= | 160 | @c |
| 160 | static boolean input_ln(FILE *);@/ | ||
| 161 | |||
| 162 | @ @c | ||
| 163 | static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */ | 161 | static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns |false| */ |
| 164 | FILE *fp@t\2\2@>) /* what file to read from */ | 162 | FILE *fp@t\2\2@>) /* what file to read from */ |
| 165 | { | 163 | { |
| @@ -179,6 +177,8 @@ FILE *fp@t\2\2@>) /* what file to read from */ · 13 unmodified lines | |||
| 179 | return true; | 177 | return true; |
| 180 | } | 178 | } |
| 181 | 179 | ||
| 180 | @ @<Predecl...@>=@+static boolean input_ln(FILE *); | ||
| 181 | |||
| 182 | @ Now comes the problem of deciding which file to read from next. | 182 | @ Now comes the problem of deciding which file to read from next. |
| 183 | Recall that the actual text that \.{CWEB} should process comes from two | 183 | Recall that the actual text that \.{CWEB} should process comes from two |
| 184 | streams: a |web_file|, which can contain possibly nested include | 184 | streams: a |web_file|, which can contain possibly nested include |
| @@ -198,7 +198,7 @@ FILE *change_file; /* change file */ · 13 unmodified lines | |||
| 198 | char file_name[max_include_depth][max_file_name_length]; | 198 | char file_name[max_include_depth][max_file_name_length]; |
| 199 | /* stack of non-change file names */ | 199 | /* stack of non-change file names */ |
| 200 | char change_file_name[max_file_name_length]; /* name of change file */ | 200 | char change_file_name[max_file_name_length]; /* name of change file */ |
| 201 | char alt_web_file_name[max_file_name_length]; /* alternate name to try */ | 201 | static char alt_web_file_name[max_file_name_length]; /* alternate name to try */ |
| 202 | int line[max_include_depth]; /* number of current line in the stacked files */ | 202 | int line[max_include_depth]; /* number of current line in the stacked files */ |
| 203 | int change_line; /* number of current line in change file */ | 203 | int change_line; /* number of current line in change file */ |
| 204 | int change_depth; /* where \.{@@y} originated during a change */ | 204 | int change_depth; /* where \.{@@y} originated during a change */ |
| @@ -218,8 +218,8 @@ Here's a shorthand expression for inequality between the two lines: · 13 unmodified lines | |||
| 218 | strncmp(buffer, change_buffer, (size_t)(limit-buffer))) | 218 | strncmp(buffer, change_buffer, (size_t)(limit-buffer))) |
| 219 | 219 | ||
| 220 | @<Global var...@>= | 220 | @<Global var...@>= |
| 221 | char change_buffer[buf_size]; /* next line of |change_file| */ | 221 | static char change_buffer[buf_size]; /* next line of |change_file| */ |
| 222 | char *change_limit; /* points to the last character in |change_buffer| */ | 222 | static char *change_limit; /* points to the last character in |change_buffer| */ |
| 223 | 223 | ||
| 224 | @ Procedure |prime_the_change_buffer| | 224 | @ Procedure |prime_the_change_buffer| |
| 225 | sets |change_buffer| in preparation for the next matching operation. | 225 | sets |change_buffer| in preparation for the next matching operation. |
| @@ -228,10 +228,7 @@ Since blank lines in the change file are not used for matching, we have · 2 unmodified lines | |||
| 228 | the change file is exhausted. This procedure is called only when | 228 | the change file is exhausted. This procedure is called only when |
| 229 | |changing| is |true|; hence error messages will be reported correctly. | 229 | |changing| is |true|; hence error messages will be reported correctly. |
| 230 | 230 | ||
| 231 | @<Predecl...@>= | 231 | @c |
| 232 | static void prime_the_change_buffer(void);@/ | ||
| 233 | |||
| 234 | @ @c | ||
| 235 | static void | 232 | static void |
| 236 | prime_the_change_buffer(void) | 233 | prime_the_change_buffer(void) |
| 237 | { | 234 | { |
| @@ -241,6 +238,8 @@ prime_the_change_buffer(void) · 3 unmodified lines | |||
| 241 | @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>@; | 238 | @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>@; |
| 242 | } | 239 | } |
| 243 | 240 | ||
| 241 | @ @<Predecl...@>=@+static void prime_the_change_buffer(void); | ||
| 242 | |||
| 244 | @ While looking for a line that begins with \.{@@x} in the change file, we | 243 | @ While looking for a line that begins with \.{@@x} in the change file, we |
| 245 | allow lines that begin with \.{@@}, as long as they don't begin with \.{@@y}, | 244 | allow lines that begin with \.{@@}, as long as they don't begin with \.{@@y}, |
| 246 | \.{@@z}, or \.{@@i} (which would probably mean that the change file is fouled up). | 245 | \.{@@z}, or \.{@@i} (which would probably mean that the change file is fouled up). |
| @@ -289,7 +288,7 @@ prepares to read the next line from |change_file|. · 42 unmodified lines | |||
| 289 | 288 | ||
| 290 | When a match is found, the current section is marked as changed unless | 289 | When a match is found, the current section is marked as changed unless |
| 291 | the first line after the \.{@@x} and after the \.{@@y} both start with | 290 | the first line after the \.{@@x} and after the \.{@@y} both start with |
| 292 | either |'@@*'| or |'@@ '| (possibly preceded by whitespace). | 291 | either `\.{@@*}' or `\.{@@\ }' (possibly preceded by whitespace). |
| 293 | 292 | ||
| 294 | This procedure is called only when |buffer<limit|, i.e., when the | 293 | This procedure is called only when |buffer<limit|, i.e., when the |
| 295 | current line is nonempty. | 294 | current line is nonempty. |
| @@ -300,10 +299,7 @@ current line is nonempty. · 4 unmodified lines | |||
| 300 | if (*loc=='@@' && (xisspace(*(loc+1)) || *(loc+1)=='*')) change_pending=b; | 299 | if (*loc=='@@' && (xisspace(*(loc+1)) || *(loc+1)=='*')) change_pending=b; |
| 301 | } | 300 | } |
| 302 | 301 | ||
| 303 | @<Predecl...@>= | 302 | @c |
| 304 | static void check_change(void);@/ | ||
| 305 | |||
| 306 | @ @c | ||
| 307 | static void | 303 | static void |
| 308 | check_change(void) /* switches to |change_file| if the buffers match */ | 304 | check_change(void) /* switches to |change_file| if the buffers match */ |
| 309 | { | 305 | { |
| @@ -341,6 +337,8 @@ check_change(void) /* switches to |change_file| if the buffers match */ · 31 unmodified lines | |||
| 341 | } | 337 | } |
| 342 | } | 338 | } |
| 343 | 339 | ||
| 340 | @ @<Predecl...@>=@+static void check_change(void); | ||
| 341 | |||
| 344 | @ @<If the current line starts with \.{@@y}...@>= | 342 | @ @<If the current line starts with \.{@@y}...@>= |
| 345 | if (xyz_code=='x' || xyz_code=='z') { | 343 | if (xyz_code=='x' || xyz_code=='z') { |
| 346 | loc=buffer+2; err_print("! Where is the matching @@y?"); | 344 | loc=buffer+2; err_print("! Where is the matching @@y?"); |
| @@ -607,8 +605,8 @@ usually have |name_ptr->byte_start==byte_ptr|, and certainly · 260 unmodified lines | |||
| 607 | we want to keep |name_ptr<=name_dir_end| and |byte_ptr<=byte_mem_end|. | 605 | we want to keep |name_ptr<=name_dir_end| and |byte_ptr<=byte_mem_end|. |
| 608 | 606 | ||
| 609 | @<Global var...@>= | 607 | @<Global var...@>= |
| 610 | name_pointer name_ptr; /* first unused position in |name_dir| */ | ||
| 611 | char *byte_ptr; /* first unused position in |byte_mem| */ | 608 | char *byte_ptr; /* first unused position in |byte_mem| */ |
| 609 | name_pointer name_ptr; /* first unused position in |name_dir| */ | ||
| 612 | 610 | ||
| 613 | @ @<Init...@>= | 611 | @ @<Init...@>= |
| 614 | name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */ | 612 | name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */ |
| @@ -776,7 +774,7 @@ are null-terminated, and we keep an eye open for prefixes and extensions. · 161 unmodified lines | |||
| 776 | @<Predecl...@>= | 774 | @<Predecl...@>= |
| 777 | static int web_strcmp(char *,int,char *,int);@/ | 775 | static int web_strcmp(char *,int,char *,int);@/ |
| 778 | static name_pointer add_section_name(name_pointer,int,char *,char *,int);@/ | 776 | static name_pointer add_section_name(name_pointer,int,char *,char *,int);@/ |
| 779 | static void extend_section_name(name_pointer,char *,char *,int);@/ | 777 | static void extend_section_name(name_pointer,char *,char *,int); |
| 780 | 778 | ||
| 781 | @ @c | 779 | @ @c |
| 782 | static int web_strcmp(@t\1\1@> /* fuller comparison than |strcmp| */ | 780 | static int web_strcmp(@t\1\1@> /* fuller comparison than |strcmp| */ |
| @@ -969,10 +967,7 @@ us to regard \.{@@<foo...@@>} as an ``extension'' of itself. · 186 unmodified lines | |||
| 969 | 967 | ||
| 970 | @d bad_extension 5 | 968 | @d bad_extension 5 |
| 971 | 969 | ||
| 972 | @<Predec...@>= | 970 | @c |
| 973 | static int section_name_cmp(char **,int,name_pointer);@/ | ||
| 974 | |||
| 975 | @ @c | ||
| 976 | static int section_name_cmp(@t\1\1@> | 971 | static int section_name_cmp(@t\1\1@> |
| 977 | char **pfirst, /* pointer to beginning of comparison string */ | 972 | char **pfirst, /* pointer to beginning of comparison string */ |
| 978 | int len, /* length of string */ | 973 | int len, /* length of string */ |
| @@ -1004,6 +999,8 @@ name_pointer r@t\2\2@>) /* section name being compared */ · 25 unmodified lines | |||
| 1004 | } | 999 | } |
| 1005 | } | 1000 | } |
| 1006 | 1001 | ||
| 1002 | @ @<Predec...@>=@+static int section_name_cmp(char **,int,name_pointer); | ||
| 1003 | |||
| 1007 | @** Reporting errors to the user. | 1004 | @** Reporting errors to the user. |
| 1008 | A global variable called |history| will contain one of four values | 1005 | A global variable called |history| will contain one of four values |
| 1009 | at the end of every run: |spotless| means that no unusual messages were | 1006 | at the end of every run: |spotless| means that no unusual messages were |
| @@ -1150,7 +1147,7 @@ should be set before calling |common_init|. · 140 unmodified lines | |||
| 1150 | 1147 | ||
| 1151 | @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>= | 1148 | @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>= |
| 1152 | show_banner=show_happiness=show_progress=make_xrefs=true;@/ | 1149 | show_banner=show_happiness=show_progress=make_xrefs=true;@/ |
| 1153 | show_stats=false;@/ | 1150 | show_stats=false; |
| 1154 | 1151 | ||
| 1155 | @ We now must look at the command line arguments and set the file names | 1152 | @ We now must look at the command line arguments and set the file names |
| 1156 | accordingly. At least one file name must be present: the \.{CWEB} | 1153 | accordingly. At least one file name must be present: the \.{CWEB} |
| @@ -1167,10 +1164,7 @@ when no changes are desired. · 10 unmodified lines | |||
| 1167 | 1164 | ||
| 1168 | If there's a third file name, it will be the output file. | 1165 | If there's a third file name, it will be the output file. |
| 1169 | 1166 | ||
| 1170 | @<Pred...@>= | 1167 | @c |
| 1171 | static void scan_args(void);@/ | ||
| 1172 | |||
| 1173 | @ @c | ||
| 1174 | static void | 1168 | static void |
| 1175 | scan_args(void) | 1169 | scan_args(void) |
| 1176 | { | 1170 | { |
| @@ -1200,6 +1194,8 @@ scan_args(void) · 23 unmodified lines | |||
| 1200 | if (!found_web) @<Print usage error message and quit@>@; | 1194 | if (!found_web) @<Print usage error message and quit@>@; |
| 1201 | } | 1195 | } |
| 1202 | 1196 | ||
| 1197 | @ @<Pred...@>=@+static void scan_args(void); | ||
| 1198 | |||
| 1203 | @ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it, | 1199 | @ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it, |
| 1204 | otherwise we add |".w"|. If this file can't be opened, we prepare an | 1200 | otherwise we add |".w"|. If this file can't be opened, we prepare an |
| 1205 | |alt_web_file_name| by adding |"web"| after the dot. | 1201 | |alt_web_file_name| by adding |"web"| after the dot. |
| @@ -17,12 +17,12 @@ by using "huge" pointers. · 16 unmodified lines | |||
| 17 | The ``banner line'' defined here should be changed whenever \.{CTANGLE} | 17 | The ``banner line'' defined here should be changed whenever \.{CTANGLE} |
| 18 | is modified. | 18 | is modified. |
| 19 | 19 | ||
| 20 | @d banner "This is CTANGLE (Version 4.1)" | 20 | @d banner "This is CTANGLE (Version 4.2)" |
| 21 | @y | 21 | @y |
| 22 | The ``banner line'' defined here should be changed whenever \.{CTANGLE} | 22 | The ``banner line'' defined here should be changed whenever \.{CTANGLE} |
| 23 | is modified. | 23 | is modified. |
| 24 | 24 | ||
| 25 | @d banner "This is CTANGLE (Version 4.1pc/big)" | 25 | @d banner "This is CTANGLE (Version 4.2pc/big)" |
| 26 | @z | 26 | @z |
| 27 | 27 | ||
| 28 | 28 | ||
| @@ -141,13 +141,13 @@ typedef text *text_pointer; · 112 unmodified lines | |||
| 141 | 141 | ||
| 142 | 142 | ||
| 143 | @x Section 17. | 143 | @x Section 17. |
| 144 | eight_bits tok_mem[max_toks]; | 144 | static eight_bits tok_mem[max_toks]; |
| 145 | eight_bits *tok_mem_end=tok_mem+max_toks-1; | 145 | static eight_bits *tok_mem_end=tok_mem+max_toks-1; |
| 146 | eight_bits *tok_ptr; /* first unused position in |tok_mem| */ | 146 | static eight_bits *tok_ptr; /* first unused position in |tok_mem| */ |
| 147 | @y | 147 | @y |
| 148 | eight_bits huge tok_mem[max_toks]; | 148 | static eight_bits huge tok_mem[max_toks]; |
| 149 | eight_bits huge* tok_mem_end; | 149 | static eight_bits huge* tok_mem_end; |
| 150 | eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */ | 150 | static eight_bits huge* tok_ptr; /* first unused position in |tok_mem| */ |
| 151 | @z | 151 | @z |
| 152 | 152 | ||
| 153 | 153 | ||
| @@ -9,9 +9,9 @@ that allows >64K arrays. If you need lots of bytes and toks, try the · 8 unmodified lines | |||
| 9 | alternate change files with -bs suffix instead of -pc. | 9 | alternate change files with -bs suffix instead of -pc. |
| 10 | 10 | ||
| 11 | @x section 1 | 11 | @x section 1 |
| 12 | @d banner "This is CTANGLE (Version 4.1)" | 12 | @d banner "This is CTANGLE (Version 4.2)" |
| 13 | @y | 13 | @y |
| 14 | @d banner "This is CTANGLE (Version 4.1pc)" | 14 | @d banner "This is CTANGLE (Version 4.2pc)" |
| 15 | @z | 15 | @z |
| 16 | @x section 4 | 16 | @x section 4 |
| 17 | @d max_bytes 1000000 /* the number of bytes in identifiers, | 17 | @d max_bytes 1000000 /* the number of bytes in identifiers, |
| @@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c -=500000 ctangle_c" · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | @x | 9 | @x |
| 10 | \def\title{CTANGLE (Version 4.1)} | 10 | \def\title{CTANGLE (Version 4.2)} |
| 11 | @y | 11 | @y |
| 12 | \def\title{CTANGLE (QL Version 4.1)} | 12 | \def\title{CTANGLE (QL Version 4.2)} |
| 13 | @z | 13 | @z |
| 14 | 14 | ||
| 15 | @x section 1 | 15 | @x section 1 |
| 16 | @d banner "This is CTANGLE (Version 4.1)" | 16 | @d banner "This is CTANGLE (Version 4.2)" |
| 17 | @y | 17 | @y |
| 18 | @d banner "This is CTANGLE (QL Version 4.1)" | 18 | @d banner "This is CTANGLE (QL Version 4.2)" |
| 19 | @z | 19 | @z |
| 20 | 20 | ||
| 21 | @x | 21 | @x |
| @@ -10,9 +10,9 @@ created: · 9 unmodified lines | |||
| 10 | (these changes not necessary for initial bootstrapping) | 10 | (these changes not necessary for initial bootstrapping) |
| 11 | 11 | ||
| 12 | @x section 1 (01-FEB-1992 ST) | 12 | @x section 1 (01-FEB-1992 ST) |
| 13 | @d banner "This is CTANGLE (Version 4.1)" | 13 | @d banner "This is CTANGLE (Version 4.2)" |
| 14 | @y | 14 | @y |
| 15 | @d banner "This is CTANGLE (VAX/VMS Version 4.1)" | 15 | @d banner "This is CTANGLE (VAX/VMS Version 4.2)" |
| 16 | @z | 16 | @z |
| 17 | 17 | ||
| 18 | @x section 3 (01-FEB-1992 ST) | 18 | @x section 3 (01-FEB-1992 ST) |
| @@ -4,9 +4,9 @@ This is the change file for CWEB's CTANGLE under Win32 · 3 unmodified lines | |||
| 4 | Changes necessary for compiling with Borland C/C++ | 4 | Changes necessary for compiling with Borland C/C++ |
| 5 | 5 | ||
| 6 | @x section 1 | 6 | @x section 1 |
| 7 | @d banner "This is CTANGLE (Version 4.1)" | 7 | @d banner "This is CTANGLE (Version 4.2)" |
| 8 | @y | 8 | @y |
| 9 | @d banner "This is CTANGLE (Version 4.1win32)" | 9 | @d banner "This is CTANGLE (Version 4.2win32)" |
| 10 | @z | 10 | @z |
| 11 | 11 | ||
| 12 | @x | 12 | @x |
| @@ -15,7 +15,7 @@ · 14 unmodified lines | |||
| 15 | /*:4*/ | 15 | /*:4*/ |
| 16 | #line 67 "ctangle.w" | 16 | #line 67 "ctangle.w" |
| 17 | 17 | ||
| 18 | #define banner "This is CTANGLE (Version 4.1)" \ | 18 | #define banner "This is CTANGLE (Version 4.2)" \ |
| 19 | 19 | ||
| 20 | #define ctangle false | 20 | #define ctangle false |
| 21 | #define cweave true \ | 21 | #define cweave true \ |
| @@ -43,6 +43,15 @@ · 21 unmodified lines | |||
| 43 | #define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) | 43 | #define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) |
| 44 | #define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ | 44 | #define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \ |
| 45 | 45 | ||
| 46 | #define max_include_depth 10 \ | ||
| 47 | |||
| 48 | #define max_file_name_length 1024 | ||
| 49 | #define cur_file file[include_depth] | ||
| 50 | #define cur_file_name file_name[include_depth] | ||
| 51 | #define cur_line line[include_depth] | ||
| 52 | #define web_file file[0] | ||
| 53 | #define web_file_name file_name[0] \ | ||
| 54 | |||
| 46 | #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) | 55 | #define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start) |
| 47 | #define print_id(c) term_write((c) ->byte_start,length((c) ) ) | 56 | #define print_id(c) term_write((c) ->byte_start,length((c) ) ) |
| 48 | #define llink link | 57 | #define llink link |
| @@ -59,15 +68,6 @@ · 10 unmodified lines | |||
| 59 | #define confusion(s) fatal("! This can't happen: ",s) \ | 68 | #define confusion(s) fatal("! This can't happen: ",s) \ |
| 60 | \ | 69 | \ |
| 61 | 70 | ||
| 62 | #define max_include_depth 10 \ | ||
| 63 | |||
| 64 | #define max_file_name_length 1024 | ||
| 65 | #define cur_file file[include_depth] | ||
| 66 | #define cur_file_name file_name[include_depth] | ||
| 67 | #define cur_line line[include_depth] | ||
| 68 | #define web_file file[0] | ||
| 69 | #define web_file_name file_name[0] \ | ||
| 70 | |||
| 71 | #define show_banner flags['b'] | 71 | #define show_banner flags['b'] |
| 72 | #define show_progress flags['p'] | 72 | #define show_progress flags['p'] |
| 73 | #define show_stats flags['s'] | 73 | #define show_stats flags['s'] |
| @@ -171,7 +171,31 @@ extern char*loc; · 97 unmodified lines | |||
| 171 | extern char*limit; | 171 | extern char*limit; |
| 172 | 172 | ||
| 173 | /*:6*//*7:*/ | 173 | /*:6*//*7:*/ |
| 174 | #line 102 "common.h" | 174 | #line 105 "common.h" |
| 175 | |||
| 176 | extern int include_depth; | ||
| 177 | extern FILE*file[]; | ||
| 178 | extern FILE*change_file; | ||
| 179 | extern char file_name[][max_file_name_length]; | ||
| 180 | |||
| 181 | extern char change_file_name[]; | ||
| 182 | extern int line[]; | ||
| 183 | extern int change_line; | ||
| 184 | extern int change_depth; | ||
| 185 | extern boolean input_has_ended; | ||
| 186 | extern boolean changing; | ||
| 187 | extern boolean web_file_open; | ||
| 188 | |||
| 189 | /*:7*//*9:*/ | ||
| 190 | #line 125 "common.h" | ||
| 191 | |||
| 192 | extern sixteen_bits section_count; | ||
| 193 | extern boolean changed_section[]; | ||
| 194 | extern boolean change_pending; | ||
| 195 | extern boolean print_where; | ||
| 196 | |||
| 197 | /*:9*//*10:*/ | ||
| 198 | #line 139 "common.h" | ||
| 175 | 199 | ||
| 176 | typedef struct name_info{ | 200 | typedef struct name_info{ |
| 177 | char*byte_start; | 201 | char*byte_start; |
| @@ -195,44 +219,20 @@ extern name_pointer hash[]; · 17 unmodified lines | |||
| 195 | extern hash_pointer hash_end; | 219 | extern hash_pointer hash_end; |
| 196 | extern hash_pointer h; | 220 | extern hash_pointer h; |
| 197 | 221 | ||
| 198 | /*:7*//*9:*/ | 222 | /*:10*//*12:*/ |
| 199 | #line 146 "common.h" | 223 | #line 183 "common.h" |
| 200 | 224 | ||
| 201 | extern int history; | 225 | extern int history; |
| 202 | 226 | ||
| 203 | /*:9*//*11:*/ | 227 | /*:12*//*14:*/ |
| 204 | #line 166 "common.h" | 228 | #line 199 "common.h" |
| 205 | 229 | ||
| 206 | extern int include_depth; | 230 | extern int argc; |
| 207 | extern FILE*file[]; | 231 | extern char**argv; |
| 208 | extern FILE*change_file; | ||
| 209 | extern char C_file_name[]; | 232 | extern char C_file_name[]; |
| 210 | extern char tex_file_name[]; | 233 | extern char tex_file_name[]; |
| 211 | extern char idx_file_name[]; | 234 | extern char idx_file_name[]; |
| 212 | extern char scn_file_name[]; | 235 | extern char scn_file_name[]; |
| 213 | extern char file_name[][max_file_name_length]; | ||
| 214 | |||
| 215 | extern char change_file_name[]; | ||
| 216 | extern int line[]; | ||
| 217 | extern int change_line; | ||
| 218 | extern int change_depth; | ||
| 219 | extern boolean input_has_ended; | ||
| 220 | extern boolean changing; | ||
| 221 | extern boolean web_file_open; | ||
| 222 | |||
| 223 | /*:11*//*13:*/ | ||
| 224 | #line 190 "common.h" | ||
| 225 | |||
| 226 | extern sixteen_bits section_count; | ||
| 227 | extern boolean changed_section[]; | ||
| 228 | extern boolean change_pending; | ||
| 229 | extern boolean print_where; | ||
| 230 | |||
| 231 | /*:13*//*14:*/ | ||
| 232 | #line 203 "common.h" | ||
| 233 | |||
| 234 | extern int argc; | ||
| 235 | extern char**argv; | ||
| 236 | extern boolean flags[]; | 236 | extern boolean flags[]; |
| 237 | 237 | ||
| 238 | /*:14*//*15:*/ | 238 | /*:14*//*15:*/ |
| @@ -257,7 +257,7 @@ sixteen_bits text_link; · 18 unmodified lines | |||
| 257 | typedef text*text_pointer; | 257 | typedef text*text_pointer; |
| 258 | 258 | ||
| 259 | /*:19*//*31:*/ | 259 | /*:19*//*31:*/ |
| 260 | #line 270 "ctangle.w" | 260 | #line 269 "ctangle.w" |
| 261 | 261 | ||
| 262 | typedef struct{ | 262 | typedef struct{ |
| 263 | eight_bits*end_field; | 263 | eight_bits*end_field; |
| @@ -274,83 +274,90 @@ typedef output_state*stack_pointer; · 10 unmodified lines | |||
| 274 | /*20:*/ | 274 | /*20:*/ |
| 275 | #line 129 "ctangle.w" | 275 | #line 129 "ctangle.w" |
| 276 | 276 | ||
| 277 | text text_info[max_texts]; | 277 | static text text_info[max_texts]; |
| 278 | text_pointer text_info_end= text_info+max_texts-1; | 278 | static text_pointer text_info_end= text_info+max_texts-1; |
| 279 | text_pointer text_ptr; | 279 | static text_pointer text_ptr; |
| 280 | eight_bits tok_mem[max_toks]; | 280 | static eight_bits tok_mem[max_toks]; |
| 281 | eight_bits*tok_mem_end= tok_mem+max_toks-1; | 281 | static eight_bits*tok_mem_end= tok_mem+max_toks-1; |
| 282 | eight_bits*tok_ptr; | 282 | static eight_bits*tok_ptr; |
| 283 | 283 | ||
| 284 | /*:20*//*26:*/ | 284 | /*:20*//*26:*/ |
| 285 | #line 198 "ctangle.w" | 285 | #line 198 "ctangle.w" |
| 286 | 286 | ||
| 287 | text_pointer last_unnamed; | 287 | static text_pointer last_unnamed; |
| 288 | 288 | ||
| 289 | /*:26*//*32:*/ | 289 | /*:26*//*32:*/ |
| 290 | #line 286 "ctangle.w" | 290 | #line 285 "ctangle.w" |
| 291 | 291 | ||
| 292 | output_state cur_state; | 292 | static output_state cur_state; |
| 293 | 293 | ||
| 294 | output_state stack[stack_size+1]; | 294 | static output_state stack[stack_size+1]; |
| 295 | stack_pointer stack_end= stack+stack_size; | 295 | static stack_pointer stack_end= stack+stack_size; |
| 296 | stack_pointer stack_ptr; | 296 | static stack_pointer stack_ptr; |
| 297 | 297 | ||
| 298 | /*:32*//*37:*/ | 298 | /*:32*//*37:*/ |
| 299 | #line 362 "ctangle.w" | 299 | #line 361 "ctangle.w" |
| 300 | 300 | ||
| 301 | int cur_val; | 301 | static int cur_val; |
| 302 | 302 | ||
| 303 | /*:37*//*42:*/ | 303 | /*:37*//*42:*/ |
| 304 | #line 454 "ctangle.w" | 304 | #line 452 "ctangle.w" |
| 305 | 305 | ||
| 306 | eight_bits out_state; | 306 | static eight_bits out_state; |
| 307 | boolean protect; | 307 | static boolean protect; |
| 308 | 308 | ||
| 309 | /*:42*//*45:*/ | 309 | /*:42*//*45:*/ |
| 310 | #line 486 "ctangle.w" | 310 | #line 483 "ctangle.w" |
| 311 | 311 | ||
| 312 | name_pointer output_files[max_files]; | 312 | static name_pointer output_files[max_files]; |
| 313 | name_pointer*cur_out_file,*end_output_files,*an_output_file; | 313 | static name_pointer*cur_out_file,*end_output_files,*an_output_file; |
| 314 | char cur_section_name_char; | 314 | static char cur_section_name_char; |
| 315 | char output_file_name[longest_name+1]; | 315 | static char output_file_name[longest_name+1]; |
| 316 | 316 | ||
| 317 | /*:45*//*52:*/ | 317 | /*:45*//*52:*/ |
| 318 | #line 586 "ctangle.w" | 318 | #line 582 "ctangle.w" |
| 319 | 319 | ||
| 320 | boolean output_defs_seen= false; | 320 | static boolean output_defs_seen= false; |
| 321 | 321 | ||
| 322 | /*:52*//*57:*/ | 322 | /*:52*//*57:*/ |
| 323 | #line 695 "ctangle.w" | 323 | #line 691 "ctangle.w" |
| 324 | 324 | ||
| 325 | char translit[128][translit_length]; | 325 | static char translit[128][translit_length]; |
| 326 | 326 | ||
| 327 | /*:57*//*62:*/ | 327 | /*:57*//*62:*/ |
| 328 | #line 774 "ctangle.w" | 328 | #line 770 "ctangle.w" |
| 329 | 329 | ||
| 330 | eight_bits ccode[256]; | 330 | static eight_bits ccode[256]; |
| 331 | 331 | ||
| 332 | /*:62*//*66:*/ | 332 | /*:62*//*66:*/ |
| 333 | #line 834 "ctangle.w" | 333 | #line 830 "ctangle.w" |
| 334 | 334 | ||
| 335 | boolean comment_continues= false; | 335 | static boolean comment_continues= false; |
| 336 | 336 | ||
| 337 | /*:66*//*68:*/ | 337 | /*:66*//*68:*/ |
| 338 | #line 873 "ctangle.w" | 338 | #line 869 "ctangle.w" |
| 339 | 339 | ||
| 340 | name_pointer cur_section_name; | 340 | static name_pointer cur_section_name; |
| 341 | boolean no_where; | 341 | static boolean no_where; |
| 342 | 342 | ||
| 343 | /*:68*//*82:*/ | 343 | /*:68*//*82:*/ |
| 344 | #line 1187 "ctangle.w" | 344 | #line 1182 "ctangle.w" |
| 345 | 345 | ||
| 346 | text_pointer cur_text; | 346 | static text_pointer cur_text; |
| 347 | eight_bits next_control; | 347 | static eight_bits next_control; |
| 348 | 348 | ||
| 349 | /*:82*/ | 349 | /*:82*/ |
| 350 | #line 71 "ctangle.w" | 350 | #line 71 "ctangle.w" |
| 351 | 351 | ||
| 352 | /*8:*/ | 352 | /*8:*/ |
| 353 | #line 125 "common.h" | 353 | #line 119 "common.h" |
| 354 | |||
| 355 | extern boolean get_line(void); | ||
| 356 | extern void check_complete(void); | ||
| 357 | extern void reset_input(void); | ||
| 358 | |||
| 359 | /*:8*//*11:*/ | ||
| 360 | #line 162 "common.h" | ||
| 354 | 361 | ||
| 355 | extern boolean names_match(name_pointer,const char*,size_t,eight_bits); | 362 | extern boolean names_match(name_pointer,const char*,size_t,eight_bits); |
| 356 | extern name_pointer id_lookup(const char*,const char*,char); | 363 | extern name_pointer id_lookup(const char*,const char*,char); |
| @@ -362,91 +369,75 @@ extern void print_prefix_name(name_pointer); · 5 unmodified lines | |||
| 362 | extern void print_section_name(name_pointer); | 369 | extern void print_section_name(name_pointer); |
| 363 | extern void sprint_section_name(char*,name_pointer); | 370 | extern void sprint_section_name(char*,name_pointer); |
| 364 | 371 | ||
| 365 | /*:8*//*10:*/ | 372 | /*:11*//*13:*/ |
| 366 | #line 149 "common.h" | 373 | #line 186 "common.h" |
| 367 | 374 | ||
| 368 | extern int wrap_up(void); | 375 | extern int wrap_up(void); |
| 369 | extern void err_print(const char*); | 376 | extern void err_print(const char*); |
| 370 | extern void fatal(const char*,const char*); | 377 | extern void fatal(const char*,const char*); |
| 371 | extern void overflow(const char*); | 378 | extern void overflow(const char*); |
| 372 | 379 | ||
| 373 | /*:10*//*12:*/ | 380 | /*:13*//*16:*/ |
| 374 | #line 184 "common.h" | ||
| 375 | |||
| 376 | extern boolean get_line(void); | ||
| 377 | extern void check_complete(void); | ||
| 378 | extern void reset_input(void); | ||
| 379 | |||
| 380 | /*:12*//*16:*/ | ||
| 381 | #line 223 "common.h" | 381 | #line 223 "common.h" |
| 382 | 382 | ||
| 383 | extern void common_init(void); | 383 | extern void common_init(void); |
| 384 | extern void print_stats(void); | 384 | extern void print_stats(void); |
| 385 | 385 | ||
| 386 | /*:16*//*29:*/ | 386 | /*:16*//*30:*/ |
| 387 | #line 231 "ctangle.w" | 387 | #line 241 "ctangle.w" |
| 388 | |||
| 389 | static void store_two_bytes(sixteen_bits); | 388 | static void store_two_bytes(sixteen_bits); |
| 390 | 389 | ||
| 391 | /*:29*//*34:*/ | 390 | /*:30*//*35:*/ |
| 392 | #line 310 "ctangle.w" | 391 | #line 324 "ctangle.w" |
| 393 | 392 | ||
| 394 | static void push_level(name_pointer); | 393 | static void push_level(name_pointer); |
| 395 | static void pop_level(boolean); | 394 | static void pop_level(boolean); |
| 396 | 395 | ||
| 397 | /*:34*//*38:*/ | 396 | /*:35*//*39:*/ |
| 398 | #line 369 "ctangle.w" | 397 | #line 397 "ctangle.w" |
| 399 | |||
| 400 | static void get_output(void); | 398 | static void get_output(void); |
| 401 | 399 | ||
| 402 | /*:38*//*43:*/ | 400 | /*:39*//*44:*/ |
| 403 | #line 462 "ctangle.w" | 401 | #line 473 "ctangle.w" |
| 404 | |||
| 405 | static void flush_buffer(void); | 402 | static void flush_buffer(void); |
| 406 | 403 | ||
| 407 | /*:43*//*48:*/ | 404 | /*:44*//*49:*/ |
| 408 | #line 517 "ctangle.w" | 405 | #line 549 "ctangle.w" |
| 409 | |||
| 410 | static void phase_two(void); | 406 | static void phase_two(void); |
| 411 | 407 | ||
| 412 | /*:48*//*53:*/ | 408 | /*:49*//*53:*/ |
| 413 | #line 589 "ctangle.w" | 409 | #line 585 "ctangle.w" |
| 414 | 410 | ||
| 415 | static void output_defs(void); | 411 | static void output_defs(void); |
| 416 | static void out_char(eight_bits); | 412 | static void out_char(eight_bits); |
| 417 | 413 | ||
| 418 | /*:53*//*64:*/ | 414 | /*:53*//*65:*/ |
| 419 | #line 798 "ctangle.w" | 415 | #line 810 "ctangle.w" |
| 420 | 416 | ||
| 421 | static eight_bits skip_ahead(void); | 417 | static eight_bits skip_ahead(void); |
| 422 | static boolean skip_comment(boolean); | 418 | static boolean skip_comment(boolean); |
| 423 | 419 | ||
| 424 | /*:64*//*69:*/ | 420 | /*:65*//*70:*/ |
| 425 | #line 885 "ctangle.w" | 421 | #line 924 "ctangle.w" |
| 426 | |||
| 427 | static eight_bits get_next(void); | 422 | static eight_bits get_next(void); |
| 428 | 423 | ||
| 429 | /*:69*//*83:*/ | 424 | /*:70*//*84:*/ |
| 430 | #line 1191 "ctangle.w" | 425 | #line 1208 "ctangle.w" |
| 431 | |||
| 432 | static void scan_repl(eight_bits); | 426 | static void scan_repl(eight_bits); |
| 433 | 427 | ||
| 434 | /*:83*//*90:*/ | 428 | /*:84*//*91:*/ |
| 435 | #line 1348 "ctangle.w" | 429 | #line 1379 "ctangle.w" |
| 436 | |||
| 437 | static void scan_section(void); | 430 | static void scan_section(void); |
| 438 | 431 | ||
| 439 | /*:90*//*98:*/ | 432 | /*:91*//*99:*/ |
| 440 | #line 1455 "ctangle.w" | 433 | #line 1460 "ctangle.w" |
| 441 | |||
| 442 | static void phase_one(void); | 434 | static void phase_one(void); |
| 443 | 435 | ||
| 444 | /*:98*//*100:*/ | 436 | /*:99*//*101:*/ |
| 445 | #line 1473 "ctangle.w" | 437 | #line 1494 "ctangle.w" |
| 446 | |||
| 447 | static void skip_limbo(void); | 438 | static void skip_limbo(void); |
| 448 | 439 | ||
| 449 | /*:100*/ | 440 | /*:101*/ |
| 450 | #line 72 "ctangle.w" | 441 | #line 72 "ctangle.w" |
| 451 | 442 | ||
| 452 | 443 | ||
| @@ -476,12 +467,12 @@ init_node(name_dir); · 23 unmodified lines | |||
| 476 | last_unnamed= text_info;text_info->text_link= 0; | 467 | last_unnamed= text_info;text_info->text_link= 0; |
| 477 | 468 | ||
| 478 | /*:27*//*46:*/ | 469 | /*:27*//*46:*/ |
| 479 | #line 496 "ctangle.w" | 470 | #line 493 "ctangle.w" |
| 480 | 471 | ||
| 481 | cur_out_file= end_output_files= output_files+max_files; | 472 | cur_out_file= end_output_files= output_files+max_files; |
| 482 | 473 | ||
| 483 | /*:46*//*58:*/ | 474 | /*:46*//*58:*/ |
| 484 | #line 698 "ctangle.w" | 475 | #line 694 "ctangle.w" |
| 485 | 476 | ||
| 486 | { | 477 | { |
| 487 | int i; | 478 | int i; |
| @@ -489,7 +480,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i)); · 1 unmodified line | |||
| 489 | } | 480 | } |
| 490 | 481 | ||
| 491 | /*:58*//*63:*/ | 482 | /*:58*//*63:*/ |
| 492 | #line 777 "ctangle.w" | 483 | #line 773 "ctangle.w" |
| 493 | { | 484 | { |
| 494 | int c; | 485 | int c; |
| 495 | for(c= 0;c<256;c++)ccode[c]= ignore; | 486 | for(c= 0;c<256;c++)ccode[c]= ignore; |
| @@ -509,7 +500,7 @@ ccode['\'']= ord; · 13 unmodified lines | |||
| 509 | } | 500 | } |
| 510 | 501 | ||
| 511 | /*:63*//*78:*/ | 502 | /*:63*//*78:*/ |
| 512 | #line 1108 "ctangle.w" | 503 | #line 1103 "ctangle.w" |
| 513 | section_text[0]= ' '; | 504 | section_text[0]= ' '; |
| 514 | 505 | ||
| 515 | /*:78*/ | 506 | /*:78*/ |
| @@ -547,10 +538,10 @@ node->equiv= (void*)text_info; · 31 unmodified lines | |||
| 547 | void | 538 | void |
| 548 | init_p(name_pointer p,eight_bits t){(void)p;(void)t;} | 539 | init_p(name_pointer p,eight_bits t){(void)p;(void)t;} |
| 549 | 540 | ||
| 550 | /*:25*//*30:*/ | 541 | /*:25*//*29:*/ |
| 551 | #line 234 "ctangle.w" | 542 | #line 231 "ctangle.w" |
| 552 | 543 | ||
| 553 | void | 544 | static void |
| 554 | store_two_bytes( | 545 | store_two_bytes( |
| 555 | sixteen_bits x) | 546 | sixteen_bits x) |
| 556 | { | 547 | { |
| @@ -559,8 +550,8 @@ if(tok_ptr+2> tok_mem_end)overflow("token"); · 2 unmodified lines | |||
| 559 | *tok_ptr++= x&0377; | 550 | *tok_ptr++= x&0377; |
| 560 | } | 551 | } |
| 561 | 552 | ||
| 562 | /*:30*//*35:*/ | 553 | /*:29*//*34:*/ |
| 563 | #line 314 "ctangle.w" | 554 | #line 309 "ctangle.w" |
| 564 | 555 | ||
| 565 | static void | 556 | static void |
| 566 | push_level( | 557 | push_level( |
| @@ -576,8 +567,8 @@ cur_section= 0; · 9 unmodified lines | |||
| 576 | } | 567 | } |
| 577 | } | 568 | } |
| 578 | 569 | ||
| 579 | /*:35*//*36:*/ | 570 | /*:34*//*36:*/ |
| 580 | #line 333 "ctangle.w" | 571 | #line 332 "ctangle.w" |
| 581 | 572 | ||
| 582 | static void | 573 | static void |
| 583 | pop_level( | 574 | pop_level( |
| @@ -592,8 +583,8 @@ stack_ptr--; · 8 unmodified lines | |||
| 592 | if(stack_ptr> stack)cur_state= *stack_ptr; | 583 | if(stack_ptr> stack)cur_state= *stack_ptr; |
| 593 | } | 584 | } |
| 594 | 585 | ||
| 595 | /*:36*//*39:*/ | 586 | /*:36*//*38:*/ |
| 596 | #line 372 "ctangle.w" | 587 | #line 368 "ctangle.w" |
| 597 | 588 | ||
| 598 | static void | 589 | static void |
| 599 | get_output(void) | 590 | get_output(void) |
| @@ -616,7 +607,7 @@ switch(a/024000){ · 16 unmodified lines | |||
| 616 | case 0:cur_val= a;out_char(identifier);break; | 607 | case 0:cur_val= a;out_char(identifier);break; |
| 617 | case 1:if(a==output_defs_flag)output_defs(); | 608 | case 1:if(a==output_defs_flag)output_defs(); |
| 618 | else/*40:*/ | 609 | else/*40:*/ |
| 619 | #line 404 "ctangle.w" | 610 | #line 402 "ctangle.w" |
| 620 | 611 | ||
| 621 | { | 612 | { |
| 622 | a-= 024000; | 613 | a-= 024000; |
| @@ -630,7 +621,7 @@ goto restart; · 7 unmodified lines | |||
| 630 | } | 621 | } |
| 631 | 622 | ||
| 632 | /*:40*/ | 623 | /*:40*/ |
| 633 | #line 393 "ctangle.w" | 624 | #line 389 "ctangle.w" |
| 634 | 625 | ||
| 635 | break; | 626 | break; |
| 636 | default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; | 627 | default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val; |
| @@ -639,8 +630,8 @@ out_char(section_number); · 2 unmodified lines | |||
| 639 | } | 630 | } |
| 640 | } | 631 | } |
| 641 | 632 | ||
| 642 | /*:39*//*44:*/ | 633 | /*:38*//*43:*/ |
| 643 | #line 465 "ctangle.w" | 634 | #line 460 "ctangle.w" |
| 644 | 635 | ||
| 645 | static void | 636 | static void |
| 646 | flush_buffer(void) | 637 | flush_buffer(void) |
| @@ -654,30 +645,30 @@ update_terminal; · 7 unmodified lines | |||
| 654 | cur_line++; | 645 | cur_line++; |
| 655 | } | 646 | } |
| 656 | 647 | ||
| 657 | /*:44*//*49:*/ | 648 | /*:43*//*48:*/ |
| 658 | #line 520 "ctangle.w" | 649 | #line 514 "ctangle.w" |
| 659 | 650 | ||
| 660 | static void | 651 | static void |
| 661 | phase_two(void){ | 652 | phase_two(void){ |
| 662 | web_file_open= false; | 653 | web_file_open= false; |
| 663 | cur_line= 1; | 654 | cur_line= 1; |
| 664 | /*33:*/ | 655 | /*33:*/ |
| 665 | #line 299 "ctangle.w" | 656 | #line 298 "ctangle.w" |
| 666 | 657 | ||
| 667 | stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info; | 658 | stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info; |
| 668 | cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0; | 659 | cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0; |
| 669 | 660 | ||
| 670 | /*:33*/ | 661 | /*:33*/ |
| 671 | #line 525 "ctangle.w" | 662 | #line 519 "ctangle.w" |
| 672 | 663 | ||
| 673 | /*51:*/ | 664 | /*51:*/ |
| 674 | #line 582 "ctangle.w" | 665 | #line 578 "ctangle.w" |
| 675 | 666 | ||
| 676 | if(!output_defs_seen) | 667 | if(!output_defs_seen) |
| 677 | output_defs(); | 668 | output_defs(); |
| 678 | 669 | ||
| 679 | /*:51*/ | 670 | /*:51*/ |
| 680 | #line 526 "ctangle.w" | 671 | #line 520 "ctangle.w" |
| 681 | 672 | ||
| 682 | if(text_info->text_link==0&&cur_out_file==end_output_files){ | 673 | if(text_info->text_link==0&&cur_out_file==end_output_files){ |
| 683 | fputs("\n! No program text was specified.",stdout);mark_harmless; | 674 | fputs("\n! No program text was specified.",stdout);mark_harmless; |
| @@ -700,7 +691,7 @@ if(text_info->text_link==0)goto writeloop; · 16 unmodified lines | |||
| 700 | while(stack_ptr> stack)get_output(); | 691 | while(stack_ptr> stack)get_output(); |
| 701 | flush_buffer(); | 692 | flush_buffer(); |
| 702 | writeloop:/*50:*/ | 693 | writeloop:/*50:*/ |
| 703 | #line 559 "ctangle.w" | 694 | #line 555 "ctangle.w" |
| 704 | 695 | ||
| 705 | for(an_output_file= end_output_files;an_output_file> cur_out_file;){ | 696 | for(an_output_file= end_output_files;an_output_file> cur_out_file;){ |
| 706 | an_output_file--; | 697 | an_output_file--; |
| @@ -721,7 +712,7 @@ flush_buffer(); · 14 unmodified lines | |||
| 721 | } | 712 | } |
| 722 | 713 | ||
| 723 | /*:50*/ | 714 | /*:50*/ |
| 724 | #line 547 "ctangle.w" | 715 | #line 541 "ctangle.w" |
| 725 | 716 | ||
| 726 | if(show_happiness){ | 717 | if(show_happiness){ |
| 727 | if(show_progress)new_line; | 718 | if(show_progress)new_line; |
| @@ -730,8 +721,8 @@ fputs("Done.",stdout); · 2 unmodified lines | |||
| 730 | } | 721 | } |
| 731 | } | 722 | } |
| 732 | 723 | ||
| 733 | /*:49*//*54:*/ | 724 | /*:48*//*54:*/ |
| 734 | #line 593 "ctangle.w" | 725 | #line 589 "ctangle.w" |
| 735 | 726 | ||
| 736 | static void | 727 | static void |
| 737 | output_defs(void) | 728 | output_defs(void) |
| @@ -771,7 +762,7 @@ pop_level(false); · 33 unmodified lines | |||
| 771 | } | 762 | } |
| 772 | 763 | ||
| 773 | /*:54*//*55:*/ | 764 | /*:54*//*55:*/ |
| 774 | #line 636 "ctangle.w" | 765 | #line 632 "ctangle.w" |
| 775 | 766 | ||
| 776 | static void | 767 | static void |
| 777 | out_char( | 768 | out_char( |
| @@ -784,7 +775,7 @@ case'\n':if(protect&&out_state!=verbatim)C_putc(' '); · 6 unmodified lines | |||
| 784 | if(protect||out_state==verbatim)C_putc('\\'); | 775 | if(protect||out_state==verbatim)C_putc('\\'); |
| 785 | flush_buffer();if(out_state!=verbatim)out_state= normal;break; | 776 | flush_buffer();if(out_state!=verbatim)out_state= normal;break; |
| 786 | /*59:*/ | 777 | /*59:*/ |
| 787 | #line 704 "ctangle.w" | 778 | #line 700 "ctangle.w" |
| 788 | 779 | ||
| 789 | case identifier: | 780 | case identifier: |
| 790 | if(out_state==num_or_id)C_putc(' '); | 781 | if(out_state==num_or_id)C_putc(' '); |
| @@ -799,10 +790,10 @@ j++; · 8 unmodified lines | |||
| 799 | out_state= num_or_id;break; | 790 | out_state= num_or_id;break; |
| 800 | 791 | ||
| 801 | /*:59*/ | 792 | /*:59*/ |
| 802 | #line 647 "ctangle.w" | 793 | #line 643 "ctangle.w" |
| 803 | 794 | ||
| 804 | /*60:*/ | 795 | /*60:*/ |
| 805 | #line 717 "ctangle.w" | 796 | #line 713 "ctangle.w" |
| 806 | 797 | ||
| 807 | case section_number: | 798 | case section_number: |
| 808 | if(cur_val> 0)C_printf("/*%d:*/",cur_val); | 799 | if(cur_val> 0)C_printf("/*%d:*/",cur_val); |
| @@ -829,10 +820,10 @@ C_printf("%s","\"\n"); · 20 unmodified lines | |||
| 829 | break; | 820 | break; |
| 830 | 821 | ||
| 831 | /*:60*/ | 822 | /*:60*/ |
| 832 | #line 648 "ctangle.w" | 823 | #line 644 "ctangle.w" |
| 833 | 824 | ||
| 834 | /*56:*/ | 825 | /*56:*/ |
| 835 | #line 666 "ctangle.w" | 826 | #line 662 "ctangle.w" |
| 836 | 827 | ||
| 837 | case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; | 828 | case plus_plus:C_putc('+');C_putc('+');out_state= normal;break; |
| 838 | case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; | 829 | case minus_minus:C_putc('-');C_putc('-');out_state= normal;break; |
| @@ -853,7 +844,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; · 14 unmodified lines | |||
| 853 | break; | 844 | break; |
| 854 | 845 | ||
| 855 | /*:56*/ | 846 | /*:56*/ |
| 856 | #line 649 "ctangle.w" | 847 | #line 645 "ctangle.w" |
| 857 | 848 | ||
| 858 | case'=':case'>':C_putc(cur_char);C_putc(' '); | 849 | case'=':case'>':C_putc(cur_char);C_putc(' '); |
| 859 | out_state= normal;break; | 850 | out_state= normal;break; |
| @@ -871,8 +862,8 @@ default:C_putc(cur_char);out_state= normal;break; · 11 unmodified lines | |||
| 871 | } | 862 | } |
| 872 | } | 863 | } |
| 873 | 864 | ||
| 874 | /*:55*//*65:*/ | 865 | /*:55*//*64:*/ |
| 875 | #line 802 "ctangle.w" | 866 | #line 794 "ctangle.w" |
| 876 | 867 | ||
| 877 | static eight_bits | 868 | static eight_bits |
| 878 | skip_ahead(void) | 869 | skip_ahead(void) |
| @@ -889,8 +880,8 @@ if(c!=ignore||*(loc-1)=='>')return c; · 10 unmodified lines | |||
| 889 | } | 880 | } |
| 890 | } | 881 | } |
| 891 | 882 | ||
| 892 | /*:65*//*67:*/ | 883 | /*:64*//*67:*/ |
| 893 | #line 837 "ctangle.w" | 884 | #line 833 "ctangle.w" |
| 894 | 885 | ||
| 895 | static boolean skip_comment( | 886 | static boolean skip_comment( |
| 896 | boolean is_long_comment) | 887 | boolean is_long_comment) |
| @@ -923,8 +914,8 @@ else loc++; · 26 unmodified lines | |||
| 923 | } | 914 | } |
| 924 | } | 915 | } |
| 925 | 916 | ||
| 926 | /*:67*//*70:*/ | 917 | /*:67*//*69:*/ |
| 927 | #line 888 "ctangle.w" | 918 | #line 881 "ctangle.w" |
| 928 | 919 | ||
| 929 | static eight_bits | 920 | static eight_bits |
| 930 | get_next(void) | 921 | get_next(void) |
| @@ -938,7 +929,7 @@ if(get_line()==false)return new_section; · 7 unmodified lines | |||
| 938 | else if(print_where&&!no_where){ | 929 | else if(print_where&&!no_where){ |
| 939 | print_where= false; | 930 | print_where= false; |
| 940 | /*85:*/ | 931 | /*85:*/ |
| 941 | #line 1220 "ctangle.w" | 932 | #line 1214 "ctangle.w" |
| 942 | 933 | ||
| 943 | store_two_bytes(0150000); | 934 | store_two_bytes(0150000); |
| 944 | if(changing&&include_depth==change_depth){ | 935 | if(changing&&include_depth==change_depth){ |
| @@ -953,7 +944,7 @@ id_loc= id_first+strlen(id_first); · 8 unmodified lines | |||
| 953 | app_repl(a_l%0400);} | 944 | app_repl(a_l%0400);} |
| 954 | 945 | ||
| 955 | /*:85*/ | 946 | /*:85*/ |
| 956 | #line 900 "ctangle.w" | 947 | #line 893 "ctangle.w" |
| 957 | 948 | ||
| 958 | } | 949 | } |
| 959 | else return'\n'; | 950 | else return'\n'; |
| @@ -967,7 +958,7 @@ else continue; · 7 unmodified lines | |||
| 967 | } | 958 | } |
| 968 | loc++; | 959 | loc++; |
| 969 | if(xisdigit(c)||c=='.')/*73:*/ | 960 | if(xisdigit(c)||c=='.')/*73:*/ |
| 970 | #line 969 "ctangle.w" | 961 | #line 964 "ctangle.w" |
| 971 | { | 962 | { |
| 972 | id_first= loc-1; | 963 | id_first= loc-1; |
| 973 | if(*id_first=='.'&&!xisdigit(*loc))goto mistake; | 964 | if(*id_first=='.'&&!xisdigit(*loc))goto mistake; |
| @@ -992,13 +983,13 @@ return constant; · 18 unmodified lines | |||
| 992 | } | 983 | } |
| 993 | 984 | ||
| 994 | /*:73*/ | 985 | /*:73*/ |
| 995 | #line 912 "ctangle.w" | 986 | #line 905 "ctangle.w" |
| 996 | 987 | ||
| 997 | else if(c=='\''||c=='"' | 988 | else if(c=='\''||c=='"' |
| 998 | ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) | 989 | ||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"')) |
| 999 | ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) | 990 | ||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"'))) |
| 1000 | /*74:*/ | 991 | /*74:*/ |
| 1001 | #line 997 "ctangle.w" | 992 | #line 992 "ctangle.w" |
| 1002 | { | 993 | { |
| 1003 | char delim= c; | 994 | char delim= c; |
| 1004 | id_first= section_text+1; | 995 | id_first= section_text+1; |
| @@ -1042,11 +1033,11 @@ return string; · 37 unmodified lines | |||
| 1042 | } | 1033 | } |
| 1043 | 1034 | ||
| 1044 | /*:74*/ | 1035 | /*:74*/ |
| 1045 | #line 916 "ctangle.w" | 1036 | #line 909 "ctangle.w" |
| 1046 | 1037 | ||
| 1047 | else if(isalpha(c)||isxalpha(c)||ishigh(c)) | 1038 | else if(isalpha(c)||isxalpha(c)||ishigh(c)) |
| 1048 | /*72:*/ | 1039 | /*72:*/ |
| 1049 | #line 962 "ctangle.w" | 1040 | #line 957 "ctangle.w" |
| 1050 | { | 1041 | { |
| 1051 | id_first= --loc; | 1042 | id_first= --loc; |
| 1052 | while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc) | 1043 | while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc) |
| @@ -1055,10 +1046,10 @@ id_loc= loc;return identifier; · 2 unmodified lines | |||
| 1055 | } | 1046 | } |
| 1056 | 1047 | ||
| 1057 | /*:72*/ | 1048 | /*:72*/ |
| 1058 | #line 918 "ctangle.w" | 1049 | #line 911 "ctangle.w" |
| 1059 | 1050 | ||
| 1060 | else if(c=='@')/*75:*/ | 1051 | else if(c=='@')/*75:*/ |
| 1061 | #line 1042 "ctangle.w" | 1052 | #line 1037 "ctangle.w" |
| 1062 | { | 1053 | { |
| 1063 | c= ccode[(eight_bits)*loc++]; | 1054 | c= ccode[(eight_bits)*loc++]; |
| 1064 | switch(c){ | 1055 | switch(c){ |
| @@ -1074,11 +1065,11 @@ continue; · 9 unmodified lines | |||
| 1074 | case section_name: | 1065 | case section_name: |
| 1075 | cur_section_name_char= *(loc-1); | 1066 | cur_section_name_char= *(loc-1); |
| 1076 | /*77:*/ | 1067 | /*77:*/ |
| 1077 | #line 1090 "ctangle.w" | 1068 | #line 1085 "ctangle.w" |
| 1078 | { | 1069 | { |
| 1079 | char*k; | 1070 | char*k; |
| 1080 | /*79:*/ | 1071 | /*79:*/ |
| 1081 | #line 1110 "ctangle.w" | 1072 | #line 1105 "ctangle.w" |
| 1082 | 1073 | ||
| 1083 | k= section_text; | 1074 | k= section_text; |
| 1084 | while(true){ | 1075 | while(true){ |
| @@ -1089,7 +1080,7 @@ loc= buffer+1;break; · 4 unmodified lines | |||
| 1089 | } | 1080 | } |
| 1090 | c= *loc; | 1081 | c= *loc; |
| 1091 | /*80:*/ | 1082 | /*80:*/ |
| 1092 | #line 1134 "ctangle.w" | 1083 | #line 1129 "ctangle.w" |
| 1093 | 1084 | ||
| 1094 | if(c=='@'){ | 1085 | if(c=='@'){ |
| 1095 | c= *(loc+1); | 1086 | c= *(loc+1); |
| @@ -1108,7 +1099,7 @@ err_print("! Nesting of section names not allowed");break; · 12 unmodified lines | |||
| 1108 | } | 1099 | } |
| 1109 | 1100 | ||
| 1110 | /*:80*/ | 1101 | /*:80*/ |
| 1111 | #line 1119 "ctangle.w" | 1102 | #line 1114 "ctangle.w" |
| 1112 | 1103 | ||
| 1113 | loc++;if(k<section_text_end)k++; | 1104 | loc++;if(k<section_text_end)k++; |
| 1114 | if(xisspace(c)){ | 1105 | if(xisspace(c)){ |
| @@ -1125,14 +1116,14 @@ printf("...");mark_harmless; · 10 unmodified lines | |||
| 1125 | if(*k==' '&&k> section_text)k--; | 1116 | if(*k==' '&&k> section_text)k--; |
| 1126 | 1117 | ||
| 1127 | /*:79*/ | 1118 | /*:79*/ |
| 1128 | #line 1092 "ctangle.w" | 1119 | #line 1087 "ctangle.w" |
| 1129 | 1120 | ||
| 1130 | if(k-section_text> 3&&strncmp(k-2,"...",3)==0) | 1121 | if(k-section_text> 3&&strncmp(k-2,"...",3)==0) |
| 1131 | cur_section_name= section_lookup(section_text+1,k-3,1); | 1122 | cur_section_name= section_lookup(section_text+1,k-3,1); |
| 1132 | else cur_section_name= section_lookup(section_text+1,k,0); | 1123 | else cur_section_name= section_lookup(section_text+1,k,0); |
| 1133 | if(cur_section_name_char=='(') | 1124 | if(cur_section_name_char=='(') |
| 1134 | /*47:*/ | 1125 | /*47:*/ |
| 1135 | #line 500 "ctangle.w" | 1126 | #line 497 "ctangle.w" |
| 1136 | 1127 | ||
| 1137 | { | 1128 | { |
| 1138 | for(an_output_file= cur_out_file; | 1129 | for(an_output_file= cur_out_file; |
| @@ -1148,16 +1139,16 @@ overflow("output files"); · 9 unmodified lines | |||
| 1148 | } | 1139 | } |
| 1149 | 1140 | ||
| 1150 | /*:47*/ | 1141 | /*:47*/ |
| 1151 | #line 1098 "ctangle.w" | 1142 | #line 1093 "ctangle.w" |
| 1152 | 1143 | ||
| 1153 | return section_name; | 1144 | return section_name; |
| 1154 | } | 1145 | } |
| 1155 | 1146 | ||
| 1156 | /*:77*/ | 1147 | /*:77*/ |
| 1157 | #line 1056 "ctangle.w" | 1148 | #line 1051 "ctangle.w" |
| 1158 | 1149 | ||
| 1159 | case string:/*81:*/ | 1150 | case string:/*81:*/ |
| 1160 | #line 1156 "ctangle.w" | 1151 | #line 1151 "ctangle.w" |
| 1161 | { | 1152 | { |
| 1162 | id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; | 1153 | id_first= loc++;*(limit+1)= '@';*(limit+2)= '>'; |
| 1163 | while(*loc!='@'||*(loc+1)!='>')loc++; | 1154 | while(*loc!='@'||*(loc+1)!='>')loc++; |
| @@ -1168,10 +1159,10 @@ return string; · 4 unmodified lines | |||
| 1168 | } | 1159 | } |
| 1169 | 1160 | ||
| 1170 | /*:81*/ | 1161 | /*:81*/ |
| 1171 | #line 1057 "ctangle.w" | 1162 | #line 1052 "ctangle.w" |
| 1172 | 1163 | ||
| 1173 | case ord:/*76:*/ | 1164 | case ord:/*76:*/ |
| 1174 | #line 1069 "ctangle.w" | 1165 | #line 1064 "ctangle.w" |
| 1175 | 1166 | ||
| 1176 | id_first= loc; | 1167 | id_first= loc; |
| 1177 | if(*loc=='\\'){ | 1168 | if(*loc=='\\'){ |
| @@ -1194,14 +1185,14 @@ loc++; · 16 unmodified lines | |||
| 1194 | return ord; | 1185 | return ord; |
| 1195 | 1186 | ||
| 1196 | /*:76*/ | 1187 | /*:76*/ |
| 1197 | #line 1058 "ctangle.w" | 1188 | #line 1053 "ctangle.w" |
| 1198 | 1189 | ||
| 1199 | default:return c; | 1190 | default:return c; |
| 1200 | } | 1191 | } |
| 1201 | } | 1192 | } |
| 1202 | 1193 | ||
| 1203 | /*:75*/ | 1194 | /*:75*/ |
| 1204 | #line 919 "ctangle.w" | 1195 | #line 912 "ctangle.w" |
| 1205 | 1196 | ||
| 1206 | else if(xisspace(c)){ | 1197 | else if(xisspace(c)){ |
| 1207 | if(!preprocessing||loc> limit)continue; | 1198 | if(!preprocessing||loc> limit)continue; |
| @@ -1210,7 +1201,7 @@ else return' '; · 2 unmodified lines | |||
| 1210 | } | 1201 | } |
| 1211 | else if(c=='#'&&loc==buffer+1)preprocessing= 1; | 1202 | else if(c=='#'&&loc==buffer+1)preprocessing= 1; |
| 1212 | mistake:/*71:*/ | 1203 | mistake:/*71:*/ |
| 1213 | #line 940 "ctangle.w" | 1204 | #line 935 "ctangle.w" |
| 1214 | 1205 | ||
| 1215 | switch(c){ | 1206 | switch(c){ |
| 1216 | case'+':if(*loc=='+')compress(plus_plus);break; | 1207 | case'+':if(*loc=='+')compress(plus_plus);break; |
| @@ -1234,14 +1225,14 @@ case'!':if(*loc=='=')compress(non_eq);break; · 17 unmodified lines | |||
| 1234 | } | 1225 | } |
| 1235 | 1226 | ||
| 1236 | /*:71*/ | 1227 | /*:71*/ |
| 1237 | #line 926 "ctangle.w" | 1228 | #line 919 "ctangle.w" |
| 1238 | 1229 | ||
| 1239 | return c; | 1230 | return c; |
| 1240 | } | 1231 | } |
| 1241 | } | 1232 | } |
| 1242 | 1233 | ||
| 1243 | /*:70*//*84:*/ | 1234 | /*:69*//*83:*/ |
| 1244 | #line 1194 "ctangle.w" | 1235 | #line 1186 "ctangle.w" |
| 1245 | 1236 | ||
| 1246 | static void | 1237 | static void |
| 1247 | scan_repl( | 1238 | scan_repl( |
| @@ -1249,7 +1240,7 @@ eight_bits t) · 1 unmodified line | |||
| 1249 | { | 1240 | { |
| 1250 | sixteen_bits a; | 1241 | sixteen_bits a; |
| 1251 | if(t==section_name){/*85:*/ | 1242 | if(t==section_name){/*85:*/ |
| 1252 | #line 1220 "ctangle.w" | 1243 | #line 1214 "ctangle.w" |
| 1253 | 1244 | ||
| 1254 | store_two_bytes(0150000); | 1245 | store_two_bytes(0150000); |
| 1255 | if(changing&&include_depth==change_depth){ | 1246 | if(changing&&include_depth==change_depth){ |
| @@ -1264,11 +1255,11 @@ id_loc= id_first+strlen(id_first); · 8 unmodified lines | |||
| 1264 | app_repl(a_l%0400);} | 1255 | app_repl(a_l%0400);} |
| 1265 | 1256 | ||
| 1266 | /*:85*/ | 1257 | /*:85*/ |
| 1267 | #line 1200 "ctangle.w" | 1258 | #line 1192 "ctangle.w" |
| 1268 | } | 1259 | } |
| 1269 | while(true)switch(a= get_next()){ | 1260 | while(true)switch(a= get_next()){ |
| 1270 | /*86:*/ | 1261 | /*86:*/ |
| 1271 | #line 1233 "ctangle.w" | 1262 | #line 1227 "ctangle.w" |
| 1272 | 1263 | ||
| 1273 | case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; | 1264 | case identifier:a= id_lookup(id_first,id_loc,0)-name_dir; |
| 1274 | app_repl((a/0400)+0200); | 1265 | app_repl((a/0400)+0200); |
| @@ -1276,7 +1267,7 @@ app_repl(a%0400);break; · 1 unmodified line | |||
| 1276 | case section_name:if(t!=section_name)goto done; | 1267 | case section_name:if(t!=section_name)goto done; |
| 1277 | else{ | 1268 | else{ |
| 1278 | /*87:*/ | 1269 | /*87:*/ |
| 1279 | #line 1266 "ctangle.w" | 1270 | #line 1260 "ctangle.w" |
| 1280 | { | 1271 | { |
| 1281 | char*try_loc= loc; | 1272 | char*try_loc= loc; |
| 1282 | while(*try_loc==' '&&try_loc<limit)try_loc++; | 1273 | while(*try_loc==' '&&try_loc<limit)try_loc++; |
| @@ -1289,13 +1280,13 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); · 6 unmodified lines | |||
| 1289 | } | 1280 | } |
| 1290 | 1281 | ||
| 1291 | /*:87*/ | 1282 | /*:87*/ |
| 1292 | #line 1239 "ctangle.w" | 1283 | #line 1233 "ctangle.w" |
| 1293 | 1284 | ||
| 1294 | a= cur_section_name-name_dir; | 1285 | a= cur_section_name-name_dir; |
| 1295 | app_repl((a/0400)+0250); | 1286 | app_repl((a/0400)+0250); |
| 1296 | app_repl(a%0400); | 1287 | app_repl(a%0400); |
| 1297 | /*85:*/ | 1288 | /*85:*/ |
| 1298 | #line 1220 "ctangle.w" | 1289 | #line 1214 "ctangle.w" |
| 1299 | 1290 | ||
| 1300 | store_two_bytes(0150000); | 1291 | store_two_bytes(0150000); |
| 1301 | if(changing&&include_depth==change_depth){ | 1292 | if(changing&&include_depth==change_depth){ |
| @@ -1310,7 +1301,7 @@ id_loc= id_first+strlen(id_first); · 8 unmodified lines | |||
| 1310 | app_repl(a_l%0400);} | 1301 | app_repl(a_l%0400);} |
| 1311 | 1302 | ||
| 1312 | /*:85*/ | 1303 | /*:85*/ |
| 1313 | #line 1243 "ctangle.w" | 1304 | #line 1237 "ctangle.w" |
| 1314 | break; | 1305 | break; |
| 1315 | } | 1306 | } |
| 1316 | case output_defs_code:if(t!=section_name)err_print("! Misplaced @h"); | 1307 | case output_defs_code:if(t!=section_name)err_print("! Misplaced @h"); |
| @@ -1321,7 +1312,7 @@ a= output_defs_flag; · 4 unmodified lines | |||
| 1321 | app_repl((a/0400)+0200); | 1312 | app_repl((a/0400)+0200); |
| 1322 | app_repl(a%0400); | 1313 | app_repl(a%0400); |
| 1323 | /*85:*/ | 1314 | /*85:*/ |
| 1324 | #line 1220 "ctangle.w" | 1315 | #line 1214 "ctangle.w" |
| 1325 | 1316 | ||
| 1326 | store_two_bytes(0150000); | 1317 | store_two_bytes(0150000); |
| 1327 | if(changing&&include_depth==change_depth){ | 1318 | if(changing&&include_depth==change_depth){ |
| @@ -1336,13 +1327,13 @@ id_loc= id_first+strlen(id_first); · 8 unmodified lines | |||
| 1336 | app_repl(a_l%0400);} | 1327 | app_repl(a_l%0400);} |
| 1337 | 1328 | ||
| 1338 | /*:85*/ | 1329 | /*:85*/ |
| 1339 | #line 1252 "ctangle.w" | 1330 | #line 1246 "ctangle.w" |
| 1340 | 1331 | ||
| 1341 | } | 1332 | } |
| 1342 | break; | 1333 | break; |
| 1343 | case constant:case string: | 1334 | case constant:case string: |
| 1344 | /*88:*/ | 1335 | /*88:*/ |
| 1345 | #line 1277 "ctangle.w" | 1336 | #line 1271 "ctangle.w" |
| 1346 | 1337 | ||
| 1347 | app_repl(a); | 1338 | app_repl(a); |
| 1348 | while(id_first<id_loc){ | 1339 | while(id_first<id_loc){ |
| @@ -1356,11 +1347,11 @@ app_repl(*id_first++); · 7 unmodified lines | |||
| 1356 | app_repl(a);break; | 1347 | app_repl(a);break; |
| 1357 | 1348 | ||
| 1358 | /*:88*/ | 1349 | /*:88*/ |
| 1359 | #line 1256 "ctangle.w" | 1350 | #line 1250 "ctangle.w" |
| 1360 | 1351 | ||
| 1361 | case ord: | 1352 | case ord: |
| 1362 | /*89:*/ | 1353 | /*89:*/ |
| 1363 | #line 1293 "ctangle.w" | 1354 | #line 1287 "ctangle.w" |
| 1364 | { | 1355 | { |
| 1365 | int c= (eight_bits)*id_first; | 1356 | int c= (eight_bits)*id_first; |
| 1366 | if(c=='\\'){ | 1357 | if(c=='\\'){ |
| @@ -1411,7 +1402,7 @@ app_repl(constant); · 44 unmodified lines | |||
| 1411 | break; | 1402 | break; |
| 1412 | 1403 | ||
| 1413 | /*:89*/ | 1404 | /*:89*/ |
| 1414 | #line 1258 "ctangle.w" | 1405 | #line 1252 "ctangle.w" |
| 1415 | 1406 | ||
| 1416 | case definition:case format_code:case begin_C:if(t!=section_name)goto done; | 1407 | case definition:case format_code:case begin_C:if(t!=section_name)goto done; |
| 1417 | else{ | 1408 | else{ |
| @@ -1421,7 +1412,7 @@ err_print("! @d, @f and @c are ignored in C text");continue; · 3 unmodified lines | |||
| 1421 | case new_section:goto done; | 1412 | case new_section:goto done; |
| 1422 | 1413 | ||
| 1423 | /*:86*/ | 1414 | /*:86*/ |
| 1424 | #line 1205 "ctangle.w" | 1415 | #line 1197 "ctangle.w" |
| 1425 | 1416 | ||
| 1426 | case')':app_repl(a); | 1417 | case')':app_repl(a); |
| 1427 | if(t==macro)app_repl(' '); | 1418 | if(t==macro)app_repl(' '); |
| @@ -1433,8 +1424,8 @@ if(text_ptr> text_info_end)overflow("text"); · 5 unmodified lines | |||
| 1433 | cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; | 1424 | cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; |
| 1434 | } | 1425 | } |
| 1435 | 1426 | ||
| 1436 | /*:84*//*91:*/ | 1427 | /*:83*//*90:*/ |
| 1437 | #line 1355 "ctangle.w" | 1428 | #line 1346 "ctangle.w" |
| 1438 | 1429 | ||
| 1439 | static void | 1430 | static void |
| 1440 | scan_section(void) | 1431 | scan_section(void) |
| @@ -1449,7 +1440,7 @@ printf("*%d",section_count);update_terminal; · 8 unmodified lines | |||
| 1449 | next_control= 0; | 1440 | next_control= 0; |
| 1450 | while(true){ | 1441 | while(true){ |
| 1451 | /*92:*/ | 1442 | /*92:*/ |
| 1452 | #line 1394 "ctangle.w" | 1443 | #line 1387 "ctangle.w" |
| 1453 | 1444 | ||
| 1454 | while(next_control<definition) | 1445 | while(next_control<definition) |
| 1455 | 1446 | ||
| @@ -1458,11 +1449,11 @@ loc-= 2;next_control= get_next(); · 2 unmodified lines | |||
| 1458 | } | 1449 | } |
| 1459 | 1450 | ||
| 1460 | /*:92*/ | 1451 | /*:92*/ |
| 1461 | #line 1369 "ctangle.w" | 1452 | #line 1360 "ctangle.w" |
| 1462 | 1453 | ||
| 1463 | if(next_control==definition){ | 1454 | if(next_control==definition){ |
| 1464 | /*93:*/ | 1455 | /*93:*/ |
| 1465 | #line 1401 "ctangle.w" | 1456 | #line 1394 "ctangle.w" |
| 1466 | { | 1457 | { |
| 1467 | while((next_control= get_next())=='\n'); | 1458 | while((next_control= get_next())=='\n'); |
| 1468 | if(next_control!=identifier){ | 1459 | if(next_control!=identifier){ |
| @@ -1481,7 +1472,7 @@ cur_text->text_link= macro; · 12 unmodified lines | |||
| 1481 | } | 1472 | } |
| 1482 | 1473 | ||
| 1483 | /*:93*/ | 1474 | /*:93*/ |
| 1484 | #line 1371 "ctangle.w" | 1475 | #line 1362 "ctangle.w" |
| 1485 | 1476 | ||
| 1486 | continue; | 1477 | continue; |
| 1487 | } | 1478 | } |
| @@ -1491,14 +1482,14 @@ p= name_dir;break; · 3 unmodified lines | |||
| 1491 | if(next_control==section_name){ | 1482 | if(next_control==section_name){ |
| 1492 | p= cur_section_name; | 1483 | p= cur_section_name; |
| 1493 | /*94:*/ | 1484 | /*94:*/ |
| 1494 | #line 1426 "ctangle.w" | 1485 | #line 1419 "ctangle.w" |
| 1495 | 1486 | ||
| 1496 | while((next_control= get_next())=='+'); | 1487 | while((next_control= get_next())=='+'); |
| 1497 | if(next_control!='='&&next_control!=eq_eq) | 1488 | if(next_control!='='&&next_control!=eq_eq) |
| 1498 | continue; | 1489 | continue; |
| 1499 | 1490 | ||
| 1500 | /*:94*/ | 1491 | /*:94*/ |
| 1501 | #line 1379 "ctangle.w" | 1492 | #line 1370 "ctangle.w" |
| 1502 | 1493 | ||
| 1503 | break; | 1494 | break; |
| 1504 | } | 1495 | } |
| @@ -1506,20 +1497,20 @@ return; · 1 unmodified line | |||
| 1506 | } | 1497 | } |
| 1507 | no_where= print_where= false; | 1498 | no_where= print_where= false; |
| 1508 | /*95:*/ | 1499 | /*95:*/ |
| 1509 | #line 1431 "ctangle.w" | 1500 | #line 1424 "ctangle.w" |
| 1510 | 1501 | ||
| 1511 | /*96:*/ | 1502 | /*96:*/ |
| 1512 | #line 1436 "ctangle.w" | 1503 | #line 1429 "ctangle.w" |
| 1513 | 1504 | ||
| 1514 | store_two_bytes((sixteen_bits)(0150000+section_count)); | 1505 | store_two_bytes((sixteen_bits)(0150000+section_count)); |
| 1515 | 1506 | ||
| 1516 | 1507 | ||
| 1517 | /*:96*/ | 1508 | /*:96*/ |
| 1518 | #line 1432 "ctangle.w" | 1509 | #line 1425 "ctangle.w" |
| 1519 | 1510 | ||
| 1520 | scan_repl(section_name); | 1511 | scan_repl(section_name); |
| 1521 | /*97:*/ | 1512 | /*97:*/ |
| 1522 | #line 1440 "ctangle.w" | 1513 | #line 1433 "ctangle.w" |
| 1523 | 1514 | ||
| 1524 | if(p==name_dir||p==0){ | 1515 | if(p==name_dir||p==0){ |
| 1525 | (last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; | 1516 | (last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text; |
| @@ -1536,16 +1527,16 @@ cur_text->text_link= section_flag; · 10 unmodified lines | |||
| 1536 | 1527 | ||
| 1537 | 1528 | ||
| 1538 | /*:97*/ | 1529 | /*:97*/ |
| 1539 | #line 1434 "ctangle.w" | 1530 | #line 1427 "ctangle.w" |
| 1540 | 1531 | ||
| 1541 | 1532 | ||
| 1542 | /*:95*/ | 1533 | /*:95*/ |
| 1543 | #line 1385 "ctangle.w" | 1534 | #line 1376 "ctangle.w" |
| 1544 | 1535 | ||
| 1545 | } | 1536 | } |
| 1546 | 1537 | ||
| 1547 | /*:91*//*99:*/ | 1538 | /*:90*//*98:*/ |
| 1548 | #line 1458 "ctangle.w" | 1539 | #line 1448 "ctangle.w" |
| 1549 | 1540 | ||
| 1550 | static void | 1541 | static void |
| 1551 | phase_one(void){ | 1542 | phase_one(void){ |
| @@ -1558,8 +1549,8 @@ check_complete(); · 6 unmodified lines | |||
| 1558 | phase= 2; | 1549 | phase= 2; |
| 1559 | } | 1550 | } |
| 1560 | 1551 | ||
| 1561 | /*:99*//*101:*/ | 1552 | /*:98*//*100:*/ |
| 1562 | #line 1476 "ctangle.w" | 1553 | #line 1465 "ctangle.w" |
| 1563 | 1554 | ||
| 1564 | static void | 1555 | static void |
| 1565 | skip_limbo(void) | 1556 | skip_limbo(void) |
| @@ -1574,7 +1565,7 @@ c= *loc++; · 8 unmodified lines | |||
| 1574 | if(ccode[(eight_bits)c]==new_section)break; | 1565 | if(ccode[(eight_bits)c]==new_section)break; |
| 1575 | switch(ccode[(eight_bits)c]){ | 1566 | switch(ccode[(eight_bits)c]){ |
| 1576 | case translit_code:/*102:*/ | 1567 | case translit_code:/*102:*/ |
| 1577 | #line 1505 "ctangle.w" | 1568 | #line 1496 "ctangle.w" |
| 1578 | 1569 | ||
| 1579 | while(xisspace(*loc)&&loc<limit)loc++; | 1570 | while(xisspace(*loc)&&loc<limit)loc++; |
| 1580 | loc+= 3; | 1571 | loc+= 3; |
| @@ -1599,7 +1590,7 @@ translit[i-0200][loc-beg]= '\0'; · 18 unmodified lines | |||
| 1599 | } | 1590 | } |
| 1600 | 1591 | ||
| 1601 | /*:102*/ | 1592 | /*:102*/ |
| 1602 | #line 1489 "ctangle.w" | 1593 | #line 1478 "ctangle.w" |
| 1603 | break; | 1594 | break; |
| 1604 | case format_code:case'@':break; | 1595 | case format_code:case'@':break; |
| 1605 | case control_text:if(c=='q'||c=='Q'){ | 1596 | case control_text:if(c=='q'||c=='Q'){ |
| @@ -1616,8 +1607,8 @@ default:err_print("! Double @ should be used in limbo"); · 10 unmodified lines | |||
| 1616 | } | 1607 | } |
| 1617 | } | 1608 | } |
| 1618 | 1609 | ||
| 1619 | /*:101*//*103:*/ | 1610 | /*:100*//*103:*/ |
| 1620 | #line 1531 "ctangle.w" | 1611 | #line 1522 "ctangle.w" |
| 1621 | 1612 | ||
| 1622 | void | 1613 | void |
| 1623 | print_stats(void){ | 1614 | print_stats(void){ |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | % This program by Silvio Levy and Donald E. Knuth | 2 | % This program by Silvio Levy and Donald E. Knuth |
| 3 | % is based on a program by Knuth. | 3 | % is based on a program by Knuth. |
| 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. | 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. |
| 5 | % Version 4.1 --- February 2021 | 5 | % Version 4.2 --- February 2021 |
| 6 | 6 | ||
| 7 | % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth | 7 | % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth |
| 8 | 8 | ||
| @@ -27,11 +27,11 @@ · 18 unmodified lines | |||
| 27 | \mathchardef\RA="3221 % right arrow | 27 | \mathchardef\RA="3221 % right arrow |
| 28 | \mathchardef\BA="3224 % double arrow | 28 | \mathchardef\BA="3224 % double arrow |
| 29 | 29 | ||
| 30 | \def\title{CTANGLE (Version 4.1)} | 30 | \def\title{CTANGLE (Version 4.2)} |
| 31 | \def\topofcontents{\null\vfill | 31 | \def\topofcontents{\null\vfill |
| 32 | \centerline{\titlefont The {\ttitlefont CTANGLE} processor} | 32 | \centerline{\titlefont The {\ttitlefont CTANGLE} processor} |
| 33 | \vskip 15pt | 33 | \vskip 15pt |
| 34 | \centerline{(Version 4.1)} | 34 | \centerline{(Version 4.2)} |
| 35 | \vfill} | 35 | \vfill} |
| 36 | \def\botofcontents{\vfill | 36 | \def\botofcontents{\vfill |
| 37 | \noindent | 37 | \noindent |
| @@ -61,15 +61,15 @@ Joachim Schrod, Lee Wittenberg, and others who have contributed improvements. · 23 unmodified lines | |||
| 61 | The ``banner line'' defined here should be changed whenever \.{CTANGLE} | 61 | The ``banner line'' defined here should be changed whenever \.{CTANGLE} |
| 62 | is modified. | 62 | is modified. |
| 63 | 63 | ||
| 64 | @d banner "This is CTANGLE (Version 4.1)" | 64 | @d banner "This is CTANGLE (Version 4.2)" |
| 65 | 65 | ||
| 66 | @c | 66 | @c |
| 67 | @<Include files@>@/ | 67 | @<Include files@>@/ |
| 68 | @h | 68 | @h |
| 69 | @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ | 69 | @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ |
| 70 | @<Typedef declarations@>@/ | 70 | @<Typedef declarations@>@/ |
| 71 | @<Global variables@>@/ | 71 | @<Private variables@>@/ |
| 72 | @<Predeclaration of procedures@>@/ | 72 | @<Predeclaration of procedures@> |
| 73 | 73 | ||
| 74 | @ \.{CTANGLE} has a fairly straightforward outline. It operates in | 74 | @ \.{CTANGLE} has a fairly straightforward outline. It operates in |
| 75 | two phases: First it reads the source file, saving the \CEE/ code in | 75 | two phases: First it reads the source file, saving the \CEE/ code in |
| @@ -126,13 +126,13 @@ typedef struct { · 50 unmodified lines | |||
| 126 | } text; | 126 | } text; |
| 127 | typedef text *text_pointer; | 127 | typedef text *text_pointer; |
| 128 | 128 | ||
| 129 | @ @<Glob...@>= | 129 | @ @<Private...@>= |
| 130 | text text_info[max_texts]; | 130 | static text text_info[max_texts]; |
| 131 | text_pointer text_info_end=text_info+max_texts-1; | 131 | static text_pointer text_info_end=text_info+max_texts-1; |
| 132 | text_pointer text_ptr; /* first unused position in |text_info| */ | 132 | static text_pointer text_ptr; /* first unused position in |text_info| */ |
| 133 | eight_bits tok_mem[max_toks]; | 133 | static eight_bits tok_mem[max_toks]; |
| 134 | eight_bits *tok_mem_end=tok_mem+max_toks-1; | 134 | static eight_bits *tok_mem_end=tok_mem+max_toks-1; |
| 135 | eight_bits *tok_ptr; /* first unused position in |tok_mem| */ | 135 | static eight_bits *tok_ptr; /* first unused position in |tok_mem| */ |
| 136 | 136 | ||
| 137 | @ @<Set init...@>= | 137 | @ @<Set init...@>= |
| 138 | text_info->tok_start=tok_ptr=tok_mem; | 138 | text_info->tok_start=tok_ptr=tok_mem; |
| @@ -195,8 +195,8 @@ The replacement text pointer for the first unnamed section appears in · 56 unmodified lines | |||
| 195 | 195 | ||
| 196 | @d section_flag max_texts /* final |text_link| in section replacement texts */ | 196 | @d section_flag max_texts /* final |text_link| in section replacement texts */ |
| 197 | 197 | ||
| 198 | @<Glob...@>= | 198 | @<Private...@>= |
| 199 | text_pointer last_unnamed; /* most recent replacement text of unnamed section */ | 199 | static text_pointer last_unnamed; /* most recent replacement text of unnamed section */ |
| 200 | 200 | ||
| 201 | @ @<Set init...@>= last_unnamed=text_info; text_info->text_link=0; | 201 | @ @<Set init...@>= last_unnamed=text_info; text_info->text_link=0; |
| 202 | 202 | ||
| @@ -228,11 +228,8 @@ construction or numerical constant. · 25 unmodified lines | |||
| 228 | @ The following procedure is used to enter a two-byte value into | 228 | @ The following procedure is used to enter a two-byte value into |
| 229 | |tok_mem| when a replacement text is being generated. | 229 | |tok_mem| when a replacement text is being generated. |
| 230 | 230 | ||
| 231 | @<Predecl...@>= | 231 | @c |
| 232 | static void store_two_bytes(sixteen_bits);@/ | 232 | static void |
| 233 | |||
| 234 | @ @c | ||
| 235 | void | ||
| 236 | store_two_bytes( | 233 | store_two_bytes( |
| 237 | sixteen_bits x) | 234 | sixteen_bits x) |
| 238 | { | 235 | { |
| @@ -241,6 +238,8 @@ sixteen_bits x) · 2 unmodified lines | |||
| 241 | *tok_ptr++=x&0377; /* store low byte */ | 238 | *tok_ptr++=x&0377; /* store low byte */ |
| 242 | } | 239 | } |
| 243 | 240 | ||
| 241 | @ @<Predecl...@>=@+static void store_two_bytes(sixteen_bits); | ||
| 242 | |||
| 244 | @** Stacks for output. The output process uses a stack to keep track | 243 | @** Stacks for output. The output process uses a stack to keep track |
| 245 | of what is going on at different ``levels'' as the sections are being | 244 | of what is going on at different ``levels'' as the sections are being |
| 246 | written out. Entries on this stack have five parts: | 245 | written out. Entries on this stack have five parts: |
| @@ -283,12 +282,12 @@ typedef output_state *stack_pointer; · 36 unmodified lines | |||
| 283 | @d cur_repl cur_state.repl_field /* pointer to current replacement text */ | 282 | @d cur_repl cur_state.repl_field /* pointer to current replacement text */ |
| 284 | @d cur_section cur_state.section_field /* current section number being expanded */ | 283 | @d cur_section cur_state.section_field /* current section number being expanded */ |
| 285 | 284 | ||
| 286 | @<Global...@>= | 285 | @<Private...@>= |
| 287 | output_state cur_state; /* |cur_end|, |cur_byte|, |cur_name|, |cur_repl|, | 286 | static output_state cur_state; /* |cur_end|, |cur_byte|, |cur_name|, |cur_repl|, |
| 288 | and |cur_section| */ | 287 | and |cur_section| */ |
| 289 | output_state stack[stack_size+1]; /* info for non-current levels */ | 288 | static output_state stack[stack_size+1]; /* info for non-current levels */ |
| 290 | stack_pointer stack_end=stack+stack_size; /* end of |stack| */ | 289 | static stack_pointer stack_end=stack+stack_size; /* end of |stack| */ |
| 291 | stack_pointer stack_ptr; /* first unused location in the output state stack */ | 290 | static stack_pointer stack_ptr; /* first unused location in the output state stack */ |
| 292 | 291 | ||
| 293 | @ To get the output process started, we will perform the following | 292 | @ To get the output process started, we will perform the following |
| 294 | initialization steps. We may assume that |text_info->text_link| is nonzero, | 293 | initialization steps. We may assume that |text_info->text_link| is nonzero, |
| @@ -307,11 +306,7 @@ the new one going. · 12 unmodified lines | |||
| 307 | We assume that the \CEE/ compiler can copy structures. | 306 | We assume that the \CEE/ compiler can copy structures. |
| 308 | @^system dependencies@> | 307 | @^system dependencies@> |
| 309 | 308 | ||
| 310 | @<Predecl...@>= | 309 | @c |
| 311 | static void push_level(name_pointer);@/ | ||
| 312 | static void pop_level(boolean);@/ | ||
| 313 | |||
| 314 | @ @c | ||
| 315 | static void | 310 | static void |
| 316 | push_level(@t\1\1@> /* suspends the current level */ | 311 | push_level(@t\1\1@> /* suspends the current level */ |
| 317 | name_pointer p@t\2\2@>) | 312 | name_pointer p@t\2\2@>) |
| @@ -326,6 +321,10 @@ name_pointer p@t\2\2@>) · 8 unmodified lines | |||
| 326 | } | 321 | } |
| 327 | } | 322 | } |
| 328 | 323 | ||
| 324 | @ @<Predecl...@>= | ||
| 325 | static void push_level(name_pointer);@/ | ||
| 326 | static void pop_level(boolean); | ||
| 327 | |||
| 329 | @ When we come to the end of a replacement text, the |pop_level| subroutine | 328 | @ When we come to the end of a replacement text, the |pop_level| subroutine |
| 330 | does the right thing: It either moves to the continuation of this replacement | 329 | does the right thing: It either moves to the continuation of this replacement |
| 331 | text or returns the state to the most recently stacked level. | 330 | text or returns the state to the most recently stacked level. |
| @@ -359,17 +358,14 @@ if the next output is an identifier, in which case · 27 unmodified lines | |||
| 359 | @d section_number 0201 /* code returned by |get_output| for section numbers */ | 358 | @d section_number 0201 /* code returned by |get_output| for section numbers */ |
| 360 | @d identifier 0202 /* code returned by |get_output| for identifiers */ | 359 | @d identifier 0202 /* code returned by |get_output| for identifiers */ |
| 361 | 360 | ||
| 362 | @<Global...@>= | 361 | @<Private...@>= |
| 363 | int cur_val; /* additional information corresponding to output token */ | 362 | static int cur_val; /* additional information corresponding to output token */ |
| 364 | 363 | ||
| 365 | @ If |get_output| finds that no more output remains, it returns with | 364 | @ If |get_output| finds that no more output remains, it returns with |
| 366 | |stack_ptr==stack|. | 365 | |stack_ptr==stack|. |
| 367 | @^high-bit character handling@> | 366 | @^high-bit character handling@> |
| 368 | 367 | ||
| 369 | @<Predecl...@>= | 368 | @c |
| 370 | static void get_output(void);@/ | ||
| 371 | |||
| 372 | @ @c | ||
| 373 | static void | 369 | static void |
| 374 | get_output(void) /* sends next token to |out_char| */ | 370 | get_output(void) /* sends next token to |out_char| */ |
| 375 | { | 371 | { |
| @@ -398,6 +394,8 @@ get_output(void) /* sends next token to |out_char| */ · 22 unmodified lines | |||
| 398 | } | 394 | } |
| 399 | } | 395 | } |
| 400 | 396 | ||
| 397 | @ @<Predecl...@>=@+static void get_output(void); | ||
| 398 | |||
| 401 | @ The user may have forgotten to give any \CEE/ text for a section name, | 399 | @ The user may have forgotten to give any \CEE/ text for a section name, |
| 402 | or the \CEE/ text may have been associated with a different name by mistake. | 400 | or the \CEE/ text may have been associated with a different name by mistake. |
| 403 | 401 | ||
| @@ -451,18 +449,15 @@ are preceded by a `\.\\'. · 47 unmodified lines | |||
| 451 | @d unbreakable 3 /* state associated with \.{@@\&} */ | 449 | @d unbreakable 3 /* state associated with \.{@@\&} */ |
| 452 | @d verbatim 4 /* state in the middle of a string */ | 450 | @d verbatim 4 /* state in the middle of a string */ |
| 453 | 451 | ||
| 454 | @<Global...@>= | 452 | @<Private...@>= |
| 455 | eight_bits out_state; /* current status of partial output */ | 453 | static eight_bits out_state; /* current status of partial output */ |
| 456 | boolean protect; /* should newline characters be quoted? */ | 454 | static boolean protect; /* should newline characters be quoted? */ |
| 457 | 455 | ||
| 458 | @ Here is a routine that is invoked when we want to output the current line. | 456 | @ Here is a routine that is invoked when we want to output the current line. |
| 459 | During the output process, |cur_line| equals the number of the next line | 457 | During the output process, |cur_line| equals the number of the next line |
| 460 | to be output. | 458 | to be output. |
| 461 | 459 | ||
| 462 | @<Predecl...@>= | 460 | @c |
| 463 | static void flush_buffer(void);@/ | ||
| 464 | |||
| 465 | @ @c | ||
| 466 | static void | 461 | static void |
| 467 | flush_buffer(void) /* writes one line to output file */ | 462 | flush_buffer(void) /* writes one line to output file */ |
| 468 | { | 463 | { |
| @@ -475,6 +470,8 @@ flush_buffer(void) /* writes one line to output file */ · 6 unmodified lines | |||
| 475 | cur_line++; | 470 | cur_line++; |
| 476 | } | 471 | } |
| 477 | 472 | ||
| 473 | @ @<Predecl...@>=@+static void flush_buffer(void); | ||
| 474 | |||
| 478 | @ Second, we have modified the original \.{TANGLE} so that it will write output | 475 | @ Second, we have modified the original \.{TANGLE} so that it will write output |
| 479 | on multiple files. | 476 | on multiple files. |
| 480 | If a section name is introduced in at least one place by \.{@@(} | 477 | If a section name is introduced in at least one place by \.{@@(} |
| @@ -483,11 +480,11 @@ All these special sections are saved on a stack, |output_files|. · 2 unmodified lines | |||
| 483 | We write them out after we've done the unnamed section. | 480 | We write them out after we've done the unnamed section. |
| 484 | 481 | ||
| 485 | @d max_files 256 | 482 | @d max_files 256 |
| 486 | @<Glob...@>= | 483 | @<Private...@>= |
| 487 | name_pointer output_files[max_files]; | 484 | static name_pointer output_files[max_files]; |
| 488 | name_pointer *cur_out_file, *end_output_files, *an_output_file; | 485 | static name_pointer *cur_out_file, *end_output_files, *an_output_file; |
| 489 | char cur_section_name_char; /* is it |'<'| or |'('| */ | 486 | static char cur_section_name_char; /* is it |'<'| or |'('| */ |
| 490 | char output_file_name[longest_name+1]; /* name of the file */ | 487 | static char output_file_name[longest_name+1]; /* name of the file */ |
| 491 | 488 | ||
| 492 | @ We make |end_output_files| point just beyond the end of | 489 | @ We make |end_output_files| point just beyond the end of |
| 493 | |output_files|. The stack pointer | 490 | |output_files|. The stack pointer |
| @@ -514,10 +511,7 @@ complain we're out of room@>= · 20 unmodified lines | |||
| 514 | @* The big output switch. Here then is the routine that does the | 511 | @* The big output switch. Here then is the routine that does the |
| 515 | output. | 512 | output. |
| 516 | 513 | ||
| 517 | @<Predecl...@>= | 514 | @c |
| 518 | static void phase_two(void);@/ | ||
| 519 | |||
| 520 | @ @c | ||
| 521 | static void | 515 | static void |
| 522 | phase_two (void) { | 516 | phase_two (void) { |
| 523 | web_file_open=false; | 517 | web_file_open=false; |
| @@ -552,6 +546,8 @@ writeloop: @<Write all the named output files@>@; · 28 unmodified lines | |||
| 552 | } | 546 | } |
| 553 | } | 547 | } |
| 554 | 548 | ||
| 549 | @ @<Predecl...@>=@+static void phase_two(void); | ||
| 550 | |||
| 555 | @ To write the named output files, we proceed as for the unnamed | 551 | @ To write the named output files, we proceed as for the unnamed |
| 556 | section. | 552 | section. |
| 557 | The only subtlety is that we have to open each one. | 553 | The only subtlety is that we have to open each one. |
| @@ -583,12 +579,12 @@ that refer to macros, preceded by the \.{\#define} preprocessor command. · 25 unmodified lines | |||
| 583 | if (!output_defs_seen) | 579 | if (!output_defs_seen) |
| 584 | output_defs(); | 580 | output_defs(); |
| 585 | 581 | ||
| 586 | @ @<Glob...@>= | 582 | @ @<Private...@>= |
| 587 | boolean output_defs_seen=false; | 583 | static boolean output_defs_seen=false; |
| 588 | 584 | ||
| 589 | @ @<Predecl...@>= | 585 | @ @<Predecl...@>= |
| 590 | static void output_defs(void);@/ | 586 | static void output_defs(void);@/ |
| 591 | static void out_char(eight_bits);@/ | 587 | static void out_char(eight_bits); |
| 592 | 588 | ||
| 593 | @ @c | 589 | @ @c |
| 594 | static void | 590 | static void |
| @@ -692,8 +688,8 @@ This makes debugging a lot less confusing. · 97 unmodified lines | |||
| 692 | 688 | ||
| 693 | @d translit_length 10 | 689 | @d translit_length 10 |
| 694 | 690 | ||
| 695 | @<Glo...@>= | 691 | @<Private...@>= |
| 696 | char translit[128][translit_length]; | 692 | static char translit[128][translit_length]; |
| 697 | 693 | ||
| 698 | @ @<Set init...@>= | 694 | @ @<Set init...@>= |
| 699 | { | 695 | { |
| @@ -771,8 +767,8 @@ milestones. · 71 unmodified lines | |||
| 771 | @d section_name 0311 /* control code for `\.{@@<}' */ | 767 | @d section_name 0311 /* control code for `\.{@@<}' */ |
| 772 | @d new_section 0312 /* control code for `\.{@@\ }' and `\.{@@*}' */ | 768 | @d new_section 0312 /* control code for `\.{@@\ }' and `\.{@@*}' */ |
| 773 | 769 | ||
| 774 | @<Global...@>= | 770 | @<Private...@>= |
| 775 | eight_bits ccode[256]; /* meaning of a char following \.{@@} */ | 771 | static eight_bits ccode[256]; /* meaning of a char following \.{@@} */ |
| 776 | 772 | ||
| 777 | @ @<Set ini...@>= { | 773 | @ @<Set ini...@>= { |
| 778 | int c; /* must be |int| so the |for| loop will end */ | 774 | int c; /* must be |int| so the |for| loop will end */ |
| @@ -795,11 +791,7 @@ eight_bits ccode[256]; /* meaning of a char following \.{@@} */ · 16 unmodified lines | |||
| 795 | @ The |skip_ahead| procedure reads through the input at fairly high speed | 791 | @ The |skip_ahead| procedure reads through the input at fairly high speed |
| 796 | until finding the next non-ignorable control code, which it returns. | 792 | until finding the next non-ignorable control code, which it returns. |
| 797 | 793 | ||
| 798 | @<Predecl...@>= | 794 | @c |
| 799 | static eight_bits skip_ahead(void);@/ | ||
| 800 | static boolean skip_comment(boolean);@/ | ||
| 801 | |||
| 802 | @ @c | ||
| 803 | static eight_bits | 795 | static eight_bits |
| 804 | skip_ahead(void) /* skip to next control code */ | 796 | skip_ahead(void) /* skip to next control code */ |
| 805 | { | 797 | { |
| @@ -815,6 +807,10 @@ skip_ahead(void) /* skip to next control code */ · 9 unmodified lines | |||
| 815 | } | 807 | } |
| 816 | } | 808 | } |
| 817 | 809 | ||
| 810 | @ @<Predecl...@>= | ||
| 811 | static eight_bits skip_ahead(void);@/ | ||
| 812 | static boolean skip_comment(boolean); | ||
| 813 | |||
| 818 | @ The |skip_comment| procedure reads through the input at somewhat high | 814 | @ The |skip_comment| procedure reads through the input at somewhat high |
| 819 | speed in order to pass over comments, which \.{CTANGLE} does not transmit | 815 | speed in order to pass over comments, which \.{CTANGLE} does not transmit |
| 820 | to the output. If the comment is introduced by \.{/*}, |skip_comment| | 816 | to the output. If the comment is introduced by \.{/*}, |skip_comment| |
| @@ -831,8 +827,8 @@ the two types of comments. · 10 unmodified lines | |||
| 831 | If |skip_comment| comes to the end of the section, it prints an error message. | 827 | If |skip_comment| comes to the end of the section, it prints an error message. |
| 832 | No comment, long or short, is allowed to contain `\.{@@\ }' or `\.{@@*}'. | 828 | No comment, long or short, is allowed to contain `\.{@@\ }' or `\.{@@*}'. |
| 833 | 829 | ||
| 834 | @<Global...@>= | 830 | @<Private...@>= |
| 835 | boolean comment_continues=false; /* are we scanning a comment? */ | 831 | static boolean comment_continues=false; /* are we scanning a comment? */ |
| 836 | 832 | ||
| 837 | @ @c | 833 | @ @c |
| 838 | static boolean skip_comment(@t\1\1@> /* skips over comments */ | 834 | static boolean skip_comment(@t\1\1@> /* skips over comments */ |
| @@ -870,9 +866,9 @@ boolean is_long_comment@t\2\2@>) · 31 unmodified lines | |||
| 870 | 866 | ||
| 871 | @d constant 03 | 867 | @d constant 03 |
| 872 | 868 | ||
| 873 | @<Global...@>= | 869 | @<Private...@>= |
| 874 | name_pointer cur_section_name; /* name of section just scanned */ | 870 | static name_pointer cur_section_name; /* name of section just scanned */ |
| 875 | boolean no_where; /* suppress |print_where|? */ | 871 | static boolean no_where; /* suppress |print_where|? */ |
| 876 | 872 | ||
| 877 | @ As one might expect, |get_next| consists mostly of a big switch | 873 | @ As one might expect, |get_next| consists mostly of a big switch |
| 878 | that branches to the various special cases that can arise. | 874 | that branches to the various special cases that can arise. |
| @@ -882,10 +878,7 @@ that branches to the various special cases that can arise. · 3 unmodified lines | |||
| 882 | @d ishigh(c) ((eight_bits)(c)>0177) | 878 | @d ishigh(c) ((eight_bits)(c)>0177) |
| 883 | @^high-bit character handling@> | 879 | @^high-bit character handling@> |
| 884 | 880 | ||
| 885 | @<Predecl...@>= | 881 | @c |
| 886 | static eight_bits get_next(void);@/ | ||
| 887 | |||
| 888 | @ @c | ||
| 889 | static eight_bits | 882 | static eight_bits |
| 890 | get_next(void) /* produces the next input token */ | 883 | get_next(void) /* produces the next input token */ |
| 891 | { | 884 | { |
| @@ -928,6 +921,8 @@ get_next(void) /* produces the next input token */ · 36 unmodified lines | |||
| 928 | } | 921 | } |
| 929 | } | 922 | } |
| 930 | 923 | ||
| 924 | @ @<Predecl...@>=@+static eight_bits get_next(void); | ||
| 925 | |||
| 931 | @ The following code assigns values to the combinations \.{++}, | 926 | @ The following code assigns values to the combinations \.{++}, |
| 932 | \.{--}, \.{->}, \.{>=}, \.{<=}, \.{==}, \.{<<}, \.{>>}, \.{!=}, \.{||} and | 927 | \.{--}, \.{->}, \.{>=}, \.{<=}, \.{==}, \.{<<}, \.{>>}, \.{!=}, \.{||} and |
| 933 | \.{\&\&}, and to the \CPLUSPLUS/ | 928 | \.{\&\&}, and to the \CPLUSPLUS/ |
| @@ -1184,12 +1179,9 @@ acted, |cur_text| will point to the replacement text just generated, and · 250 unmodified lines | |||
| 1184 | @d macro 0 | 1179 | @d macro 0 |
| 1185 | @d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *tok_ptr++=c;} | 1180 | @d app_repl(c) {if (tok_ptr==tok_mem_end) overflow("token"); *tok_ptr++=c;} |
| 1186 | 1181 | ||
| 1187 | @<Global...@>= | 1182 | @<Private...@>= |
| 1188 | text_pointer cur_text; /* replacement text formed by |scan_repl| */ | 1183 | static text_pointer cur_text; /* replacement text formed by |scan_repl| */ |
| 1189 | eight_bits next_control; | 1184 | static eight_bits next_control; |
| 1190 | |||
| 1191 | @ @<Predecl...@>= | ||
| 1192 | static void scan_repl(eight_bits);@/ | ||
| 1193 | 1185 | ||
| 1194 | @ @c | 1186 | @ @c |
| 1195 | static void | 1187 | static void |
| @@ -1213,6 +1205,8 @@ eight_bits t@t\2\2@>) · 17 unmodified lines | |||
| 1213 | cur_text=text_ptr; (++text_ptr)->tok_start=tok_ptr; | 1205 | cur_text=text_ptr; (++text_ptr)->tok_start=tok_ptr; |
| 1214 | } | 1206 | } |
| 1215 | 1207 | ||
| 1208 | @ @<Predecl...@>=@+static void scan_repl(eight_bits); | ||
| 1209 | |||
| 1216 | @ Here is the code for the line number: first a |sixteen_bits| equal | 1210 | @ Here is the code for the line number: first a |sixteen_bits| equal |
| 1217 | to |0150000|; then the numeric line number; then a pointer to the | 1211 | to |0150000|; then the numeric line number; then a pointer to the |
| 1218 | file name. | 1212 | file name. |
| @@ -1236,7 +1230,7 @@ case identifier: a=id_lookup(id_first,id_loc,0)-name_dir; · 17 unmodified lines | |||
| 1236 | app_repl(a % 0400); break; | 1230 | app_repl(a % 0400); break; |
| 1237 | case section_name: if (t!=section_name) goto done; | 1231 | case section_name: if (t!=section_name) goto done; |
| 1238 | else { | 1232 | else { |
| 1239 | @<Was an `@@' missed here?@>@; | 1233 | @<Was an `\.{@@}' missed here?@>@; |
| 1240 | a=cur_section_name-name_dir; | 1234 | a=cur_section_name-name_dir; |
| 1241 | app_repl((a / 0400)+0250); | 1235 | app_repl((a / 0400)+0250); |
| 1242 | app_repl(a % 0400); | 1236 | app_repl(a % 0400); |
| @@ -1263,7 +1257,7 @@ case definition: case format_code: case begin_C: if (t!=section_name) goto done; · 20 unmodified lines | |||
| 1263 | } | 1257 | } |
| 1264 | case new_section: goto done; | 1258 | case new_section: goto done; |
| 1265 | 1259 | ||
| 1266 | @ @<Was an `@@'...@>= { | 1260 | @ @<Was an `\.{@@}'...@>= { |
| 1267 | char *try_loc=loc; | 1261 | char *try_loc=loc; |
| 1268 | while (*try_loc==' ' && try_loc<limit) try_loc++; | 1262 | while (*try_loc==' ' && try_loc<limit) try_loc++; |
| 1269 | if (*try_loc=='+' && try_loc<limit) try_loc++; | 1263 | if (*try_loc=='+' && try_loc<limit) try_loc++; |
| @@ -1345,10 +1339,7 @@ sensed in the input, and it proceeds until the end of that section. It · 75 unmodified lines | |||
| 1345 | uses |section_count| to keep track of the current section number; with luck, | 1339 | uses |section_count| to keep track of the current section number; with luck, |
| 1346 | \.{CWEAVE} and \.{CTANGLE} will both assign the same numbers to sections. | 1340 | \.{CWEAVE} and \.{CTANGLE} will both assign the same numbers to sections. |
| 1347 | 1341 | ||
| 1348 | @<Predecl...@>= | 1342 | The body of |scan_section| is a loop where we look for control codes |
| 1349 | static void scan_section(void);@/ | ||
| 1350 | |||
| 1351 | @ The body of |scan_section| is a loop where we look for control codes | ||
| 1352 | that are significant to \.{CTANGLE}: those | 1343 | that are significant to \.{CTANGLE}: those |
| 1353 | that delimit a definition, the \CEE/ part of a module, or a new module. | 1344 | that delimit a definition, the \CEE/ part of a module, or a new module. |
| 1354 | 1345 | ||
| @@ -1385,6 +1376,8 @@ scan_section(void) · 30 unmodified lines | |||
| 1385 | @<Scan the \CEE/ part of the current section@>@; | 1376 | @<Scan the \CEE/ part of the current section@>@; |
| 1386 | } | 1377 | } |
| 1387 | 1378 | ||
| 1379 | @ @<Predecl...@>=@+static void scan_section(void); | ||
| 1380 | |||
| 1388 | @ At the top of this loop, if |next_control==section_name|, the | 1381 | @ At the top of this loop, if |next_control==section_name|, the |
| 1389 | section name has already been scanned (see |@<Get control code | 1382 | section name has already been scanned (see |@<Get control code |
| 1390 | and...@>|). Thus, if we encounter |next_control==section_name| in the | 1383 | and...@>|). Thus, if we encounter |next_control==section_name| in the |
| @@ -1452,9 +1445,6 @@ else { · 61 unmodified lines | |||
| 1452 | cur_text->text_link=section_flag; | 1445 | cur_text->text_link=section_flag; |
| 1453 | /* mark this replacement text as a nonmacro */ | 1446 | /* mark this replacement text as a nonmacro */ |
| 1454 | 1447 | ||
| 1455 | @ @<Predec...@>= | ||
| 1456 | static void phase_one(void);@/ | ||
| 1457 | |||
| 1458 | @ @c | 1448 | @ @c |
| 1459 | static void | 1449 | static void |
| 1460 | phase_one(void) { | 1450 | phase_one(void) { |
| @@ -1467,13 +1457,12 @@ phase_one(void) { · 6 unmodified lines | |||
| 1467 | phase=2; | 1457 | phase=2; |
| 1468 | } | 1458 | } |
| 1469 | 1459 | ||
| 1460 | @ @<Predec...@>=@+static void phase_one(void); | ||
| 1461 | |||
| 1470 | @ Only a small subset of the control codes is legal in limbo, so limbo | 1462 | @ Only a small subset of the control codes is legal in limbo, so limbo |
| 1471 | processing is straightforward. | 1463 | processing is straightforward. |
| 1472 | 1464 | ||
| 1473 | @<Predecl...@>= | 1465 | @c |
| 1474 | static void skip_limbo(void);@/ | ||
| 1475 | |||
| 1476 | @ @c | ||
| 1477 | static void | 1466 | static void |
| 1478 | skip_limbo(void) | 1467 | skip_limbo(void) |
| 1479 | { | 1468 | { |
| @@ -1502,6 +1491,8 @@ skip_limbo(void) · 22 unmodified lines | |||
| 1502 | } | 1491 | } |
| 1503 | } | 1492 | } |
| 1504 | 1493 | ||
| 1494 | @ @<Predecl...@>=@+static void skip_limbo(void); | ||
| 1495 | |||
| 1505 | @ @<Read in transliteration of a character@>= | 1496 | @ @<Read in transliteration of a character@>= |
| 1506 | while(xisspace(*loc)&&loc<limit) loc++; | 1497 | while(xisspace(*loc)&&loc<limit) loc++; |
| 1507 | loc+=3; | 1498 | loc+=3; |
| @@ -20,12 +20,12 @@ This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94. · 19 unmodified lines | |||
| 20 | The ``banner line'' defined here should be changed whenever \.{CWEAVE} | 20 | The ``banner line'' defined here should be changed whenever \.{CWEAVE} |
| 21 | is modified. | 21 | is modified. |
| 22 | 22 | ||
| 23 | @d banner "This is CWEAVE (Version 4.1)" | 23 | @d banner "This is CWEAVE (Version 4.2)" |
| 24 | @y | 24 | @y |
| 25 | The ``banner line'' defined here should be changed whenever \.{CWEAVE} | 25 | The ``banner line'' defined here should be changed whenever \.{CWEAVE} |
| 26 | is modified. | 26 | is modified. |
| 27 | 27 | ||
| 28 | @d banner "This is CWEAVE (Version 4.1pc/big)" | 28 | @d banner "This is CWEAVE (Version 4.2pc/big)" |
| 29 | @z | 29 | @z |
| 30 | 30 | ||
| 31 | 31 | ||
| @@ -103,11 +103,11 @@ typedef xref_info huge* xref_pointer; · 71 unmodified lines | |||
| 103 | 103 | ||
| 104 | 104 | ||
| 105 | @x Section 23. | 105 | @x Section 23. |
| 106 | xref_info xmem[max_refs]; /* contains cross-reference information */ | 106 | static xref_info xmem[max_refs]; /* contains cross-reference information */ |
| 107 | xref_pointer xmem_end = xmem+max_refs-1; | 107 | static xref_pointer xmem_end = xmem+max_refs-1; |
| 108 | @y | 108 | @y |
| 109 | xref_info huge xmem[max_refs]; /* contains cross-reference information */ | 109 | static xref_info huge xmem[max_refs]; /* contains cross-reference information */ |
| 110 | xref_pointer xmem_end; | 110 | static xref_pointer xmem_end; |
| 111 | @z | 111 | @z |
| 112 | 112 | ||
| 113 | 113 | ||
| @@ -129,21 +129,21 @@ xmem->num=0; /* sentinel value */ · 15 unmodified lines | |||
| 129 | 129 | ||
| 130 | 130 | ||
| 131 | @x Section 30. (to please Borland's C++, version 4.02) | 131 | @x Section 30. (to please Borland's C++, version 4.02) |
| 132 | token tok_mem[max_toks]; /* tokens */ | 132 | static token tok_mem[max_toks]; /* tokens */ |
| 133 | token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */ | 133 | static token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */ |
| 134 | token_pointer tok_ptr; /* first unused position in |tok_mem| */ | 134 | static token_pointer tok_ptr; /* first unused position in |tok_mem| */ |
| 135 | token_pointer max_tok_ptr; /* largest value of |tok_ptr| */ | 135 | static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */ |
| 136 | token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ | 136 | static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ |
| 137 | text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */ | 137 | static text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */ |
| 138 | text_pointer text_ptr; /* first unused position in |tok_start| */ | 138 | static text_pointer text_ptr; /* first unused position in |tok_start| */ |
| 139 | @y | 139 | @y |
| 140 | token tok_mem[max_toks]; /* tokens */ | 140 | static token tok_mem[max_toks]; /* tokens */ |
| 141 | token_pointer tok_mem_end; /* end of |tok_mem| */ | 141 | static token_pointer tok_mem_end; /* end of |tok_mem| */ |
| 142 | token_pointer tok_ptr; /* first unused position in |tok_mem| */ | 142 | static token_pointer tok_ptr; /* first unused position in |tok_mem| */ |
| 143 | token_pointer max_tok_ptr; /* largest value of |tok_ptr| */ | 143 | static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */ |
| 144 | token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ | 144 | static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ |
| 145 | text_pointer tok_start_end; /* end of |tok_start| */ | 145 | static text_pointer tok_start_end; /* end of |tok_start| */ |
| 146 | text_pointer text_ptr; /* first unused position in |tok_start| */ | 146 | static text_pointer text_ptr; /* first unused position in |tok_start| */ |
| 147 | @z | 147 | @z |
| 148 | 148 | ||
| 149 | @x Section 31. (goes with the previous change) | 149 | @x Section 31. (goes with the previous change) |
| @@ -212,9 +212,9 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1; · 62 unmodified lines | |||
| 212 | 212 | ||
| 213 | 213 | ||
| 214 | @x Section 246. | 214 | @x Section 246. |
| 215 | char *cur_byte; /* index into |byte_mem| */ | 215 | static char *cur_byte; /* index into |byte_mem| */ |
| 216 | @y | 216 | @y |
| 217 | char huge* cur_byte; /* index into |byte_mem| */ | 217 | static char huge* cur_byte; /* index into |byte_mem| */ |
| 218 | @z | 218 | @z |
| 219 | 219 | ||
| 220 | 220 | ||
| @@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one. · 15 unmodified lines | |||
| 16 | } | 16 | } |
| 17 | @y | 17 | @y |
| 18 | \def\botofcontents{\vfill\titlefalse} | 18 | \def\botofcontents{\vfill\titlefalse} |
| 19 | \def\contentspagenumber{110} | 19 | \def\contentspagenumber{111} |
| 20 | \def\title{APPENDIX F: CWEAVE} | 20 | \def\title{APPENDIX F: CWEAVE} |
| 21 | \let\K=\leftarrow | 21 | \let\K=\leftarrow |
| 22 | @z | 22 | @z |
| @@ -11,9 +11,9 @@ that allows >64K arrays. (If you need lots more bytes, try the alternate · 10 unmodified lines | |||
| 11 | change files that have -bs in their name instead of -pc.) | 11 | change files that have -bs in their name instead of -pc.) |
| 12 | 12 | ||
| 13 | @x section 1 | 13 | @x section 1 |
| 14 | @d banner "This is CWEAVE (Version 4.1)" | 14 | @d banner "This is CWEAVE (Version 4.2)" |
| 15 | @y | 15 | @y |
| 16 | @d banner "This is CWEAVE (Version 4.1pc)" | 16 | @d banner "This is CWEAVE (Version 4.2pc)" |
| 17 | @z | 17 | @z |
| 18 | 18 | ||
| 19 | @x section 4 | 19 | @x section 4 |
| @@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c =500000 cweave_c" · 6 unmodified lines | |||
| 7 | 7 | ||
| 8 | 8 | ||
| 9 | @x | 9 | @x |
| 10 | \def\title{CWEAVE (Version 4.1)} | 10 | \def\title{CWEAVE (Version 4.2)} |
| 11 | @y | 11 | @y |
| 12 | \def\title{CWEAVE (QL Version 4.1)} | 12 | \def\title{CWEAVE (QL Version 4.2)} |
| 13 | @z | 13 | @z |
| 14 | 14 | ||
| 15 | @x section 1 | 15 | @x section 1 |
| 16 | @d banner "This is CWEAVE (Version 4.1)" | 16 | @d banner "This is CWEAVE (Version 4.2)" |
| 17 | @y | 17 | @y |
| 18 | @d banner "This is CWEAVE (QL Version 4.1)" | 18 | @d banner "This is CWEAVE (QL Version 4.2)" |
| 19 | @z | 19 | @z |
| 20 | 20 | ||
| 21 | @x | 21 | @x |
| @@ -13,9 +13,9 @@ modified: · 12 unmodified lines | |||
| 13 | (also modified by Don Knuth to keep version numbers uptodate) | 13 | (also modified by Don Knuth to keep version numbers uptodate) |
| 14 | 14 | ||
| 15 | @x section 1 (01-FEB-1992 ST) | 15 | @x section 1 (01-FEB-1992 ST) |
| 16 | @d banner "This is CWEAVE (Version 4.1)" | 16 | @d banner "This is CWEAVE (Version 4.2)" |
| 17 | @y | 17 | @y |
| 18 | @d banner "This is CWEAVE (VAX/VMS Version 4.1)" | 18 | @d banner "This is CWEAVE (VAX/VMS Version 4.2)" |
| 19 | @z | 19 | @z |
| 20 | 20 | ||
| 21 | @x section 3 (01-FEB-1992 ST) | 21 | @x section 3 (01-FEB-1992 ST) |
| @@ -2,9 +2,9 @@ This is the change file for CWEB's CWEAVE under Win32 · 1 unmodified line | |||
| 2 | (Contributed by Fabrice Popineau, February 2002) | 2 | (Contributed by Fabrice Popineau, February 2002) |
| 3 | 3 | ||
| 4 | @x section 1 | 4 | @x section 1 |
| 5 | @d banner "This is CWEAVE (Version 4.1)" | 5 | @d banner "This is CWEAVE (Version 4.2)" |
| 6 | @y | 6 | @y |
| 7 | @d banner "This is CWEAVE (Version 4.1win32)" | 7 | @d banner "This is CWEAVE (Version 4.2win32)" |
| 8 | @z | 8 | @z |
| 9 | 9 | ||
| 10 | @x | 10 | @x |
| @@ -2,7 +2,7 @@ · 1 unmodified line | |||
| 2 | % This program by Silvio Levy and Donald E. Knuth | 2 | % This program by Silvio Levy and Donald E. Knuth |
| 3 | % is based on a program by Knuth. | 3 | % is based on a program by Knuth. |
| 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. | 4 | % It is distributed WITHOUT ANY WARRANTY, express or implied. |
| 5 | % Version 4.1 --- February 2021 | 5 | % Version 4.2 --- February 2021 |
| 6 | 6 | ||
| 7 | % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth | 7 | % Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth |
| 8 | 8 | ||
| @@ -32,11 +32,11 @@ · 23 unmodified lines | |||
| 32 | \def\skipxTeX{\\{skip\_\TEX/}} | 32 | \def\skipxTeX{\\{skip\_\TEX/}} |
| 33 | \def\copyxTeX{\\{copy\_\TEX/}} | 33 | \def\copyxTeX{\\{copy\_\TEX/}} |
| 34 | 34 | ||
| 35 | \def\title{CWEAVE (Version 4.1)} | 35 | \def\title{CWEAVE (Version 4.2)} |
| 36 | \def\topofcontents{\null\vfill | 36 | \def\topofcontents{\null\vfill |
| 37 | \centerline{\titlefont The {\ttitlefont CWEAVE} processor} | 37 | \centerline{\titlefont The {\ttitlefont CWEAVE} processor} |
| 38 | \vskip 15pt | 38 | \vskip 15pt |
| 39 | \centerline{(Version 4.1)} | 39 | \centerline{(Version 4.2)} |
| 40 | \vfill} | 40 | \vfill} |
| 41 | \def\botofcontents{\vfill | 41 | \def\botofcontents{\vfill |
| 42 | \noindent | 42 | \noindent |
| @@ -67,13 +67,13 @@ Crusius, and others who have contributed improvements. · 24 unmodified lines | |||
| 67 | The ``banner line'' defined here should be changed whenever \.{CWEAVE} | 67 | The ``banner line'' defined here should be changed whenever \.{CWEAVE} |
| 68 | is modified. | 68 | is modified. |
| 69 | 69 | ||
| 70 | @d banner "This is CWEAVE (Version 4.1)" | 70 | @d banner "This is CWEAVE (Version 4.2)" |
| 71 | 71 | ||
| 72 | @c @<Include files@>@/ | 72 | @c @<Include files@>@/ |
| 73 | @h | 73 | @h |
| 74 | @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ | 74 | @<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/ |
| 75 | @<Typedef declarations@>@/ | 75 | @<Typedef declarations@>@/ |
| 76 | @<Global variables@>@/ | 76 | @<Private variables@>@/ |
| 77 | @<Predeclaration of procedures@> | 77 | @<Predeclaration of procedures@> |
| 78 | 78 | ||
| 79 | @ \.{CWEAVE} has a fairly straightforward outline. It operates in | 79 | @ \.{CWEAVE} has a fairly straightforward outline. It operates in |
| @@ -99,6 +99,7 @@ char **av@t\2\2@>) /* argument values */ · 19 unmodified lines | |||
| 99 | phase_one(); /* read all the user's text and store the cross-references */ | 99 | phase_one(); /* read all the user's text and store the cross-references */ |
| 100 | phase_two(); /* read all the text again and translate it to \TEX/ form */ | 100 | phase_two(); /* read all the text again and translate it to \TEX/ form */ |
| 101 | phase_three(); /* output the cross-reference index */ | 101 | phase_three(); /* output the cross-reference index */ |
| 102 | if (tracing==2 && !show_progress) new_line; | ||
| 102 | return wrap_up(); /* and exit gracefully */ | 103 | return wrap_up(); /* and exit gracefully */ |
| 103 | } | 104 | } |
| 104 | 105 | ||
| @@ -181,8 +182,8 @@ is the total number of sections that have started. Sections which have · 76 unmodified lines | |||
| 181 | been altered by a change file entry have their |changed_section| flag | 182 | been altered by a change file entry have their |changed_section| flag |
| 182 | turned on during the first phase. | 183 | turned on during the first phase. |
| 183 | 184 | ||
| 184 | @<Global...@>= | 185 | @<Private...@>= |
| 185 | boolean change_exists; /* has any section changed? */ | 186 | static boolean change_exists; /* has any section changed? */ |
| 186 | 187 | ||
| 187 | @ The other large memory area in \.{CWEAVE} keeps the cross-reference data. | 188 | @ The other large memory area in \.{CWEAVE} keeps the cross-reference data. |
| 188 | All uses of the name |p| are recorded in a linked list beginning at | 189 | All uses of the name |p| are recorded in a linked list beginning at |
| @@ -213,11 +214,11 @@ typedef struct xref_info { · 24 unmodified lines | |||
| 213 | } xref_info; | 214 | } xref_info; |
| 214 | typedef xref_info *xref_pointer; | 215 | typedef xref_info *xref_pointer; |
| 215 | 216 | ||
| 216 | @ @<Global...@>= | 217 | @ @<Private...@>= |
| 217 | xref_info xmem[max_refs]; /* contains cross-reference information */ | 218 | static xref_info xmem[max_refs]; /* contains cross-reference information */ |
| 218 | xref_pointer xmem_end = xmem+max_refs-1; | 219 | static xref_pointer xmem_end = xmem+max_refs-1; |
| 219 | xref_pointer xref_ptr; /* the largest occupied position in |xmem| */ | 220 | static xref_pointer xref_ptr; /* the largest occupied position in |xmem| */ |
| 220 | sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */ | 221 | static sixteen_bits xref_switch,section_xref_switch; /* either zero or |def_flag| */ |
| 221 | 222 | ||
| 222 | @ A section that is used for multi-file output (with the \.{@@(} feature) | 223 | @ A section that is used for multi-file output (with the \.{@@(} feature) |
| 223 | has a special first cross-reference whose |num| field is |file_flag|. | 224 | has a special first cross-reference whose |num| field is |file_flag|. |
| @@ -250,7 +251,7 @@ If one were careful, one could probably make more changes around section · 26 unmodified lines | |||
| 250 | @<Predecl...@>= | 251 | @<Predecl...@>= |
| 251 | static void new_xref(name_pointer);@/ | 252 | static void new_xref(name_pointer);@/ |
| 252 | static void new_section_xref(name_pointer);@/ | 253 | static void new_section_xref(name_pointer);@/ |
| 253 | static void set_file_flag(name_pointer);@/ | 254 | static void set_file_flag(name_pointer); |
| 254 | 255 | ||
| 255 | @ @c | 256 | @ @c |
| 256 | static void | 257 | static void |
| @@ -332,15 +333,15 @@ that is unoccupied by replacement text is called |tok_ptr|, and the first · 75 unmodified lines | |||
| 332 | unused location of |tok_start| is called |text_ptr|. | 333 | unused location of |tok_start| is called |text_ptr|. |
| 333 | Thus, we usually have |*text_ptr==tok_ptr|. | 334 | Thus, we usually have |*text_ptr==tok_ptr|. |
| 334 | 335 | ||
| 335 | @<Global...@>= | 336 | @<Private...@>= |
| 336 | token tok_mem[max_toks]; /* tokens */ | 337 | static token tok_mem[max_toks]; /* tokens */ |
| 337 | token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */ | 338 | static token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */ |
| 338 | token_pointer tok_ptr; /* first unused position in |tok_mem| */ | 339 | static token_pointer tok_ptr; /* first unused position in |tok_mem| */ |
| 339 | token_pointer max_tok_ptr; /* largest value of |tok_ptr| */ | 340 | static token_pointer max_tok_ptr; /* largest value of |tok_ptr| */ |
| 340 | token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ | 341 | static token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ |
| 341 | text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */ | 342 | static text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */ |
| 342 | text_pointer text_ptr; /* first unused position in |tok_start| */ | 343 | static text_pointer text_ptr; /* first unused position in |tok_start| */ |
| 343 | text_pointer max_text_ptr; /* largest value of |text_ptr| */ | 344 | static text_pointer max_text_ptr; /* largest value of |text_ptr| */ |
| 344 | 345 | ||
| 345 | @ @<Set init...@>= | 346 | @ @<Set init...@>= |
| 346 | tok_ptr=max_tok_ptr=tok_mem+1;@/ | 347 | tok_ptr=max_tok_ptr=tok_mem+1;@/ |
| @@ -382,8 +383,7 @@ name_pointer p) · 35 unmodified lines | |||
| 382 | p->xref=(void *)xref_ptr; | 383 | p->xref=(void *)xref_ptr; |
| 383 | } | 384 | } |
| 384 | 385 | ||
| 385 | @ @<Predecl...@>= | 386 | @ @<Predecl...@>=@+static void update_node(name_pointer p); |
| 386 | static void update_node(name_pointer p);@/ | ||
| 387 | 387 | ||
| 388 | @ We have to get \CEE/'s | 388 | @ We have to get \CEE/'s |
| 389 | reserved words into the hash table, and the simplest way to do this is | 389 | reserved words into the hash table, and the simplest way to do this is |
| @@ -489,8 +489,7 @@ id_lookup("volatile",NULL,const_like); · 99 unmodified lines | |||
| 489 | id_lookup("wchar_t",NULL,raw_int); | 489 | id_lookup("wchar_t",NULL,raw_int); |
| 490 | id_lookup("while",NULL,for_like); | 490 | id_lookup("while",NULL,for_like); |
| 491 | id_lookup("xor",NULL,alfop); | 491 | id_lookup("xor",NULL,alfop); |
| 492 | id_lookup("xor_eq",NULL,alfop); | 492 | id_lookup("xor_eq",NULL,alfop);@+ res_wd_end=name_ptr; |
| 493 | res_wd_end=name_ptr; | ||
| 494 | id_lookup("TeX",NULL,custom); | 493 | id_lookup("TeX",NULL,custom); |
| 495 | id_lookup("make_pair",NULL,func_template); | 494 | id_lookup("make_pair",NULL,func_template); |
| 496 | 495 | ||
| @@ -546,8 +545,8 @@ scanning routines. · 49 unmodified lines | |||
| 546 | @ Control codes are converted to \.{CWEAVE}'s internal | 545 | @ Control codes are converted to \.{CWEAVE}'s internal |
| 547 | representation by means of the table |ccode|. | 546 | representation by means of the table |ccode|. |
| 548 | 547 | ||
| 549 | @<Global...@>= | 548 | @<Private...@>= |
| 550 | eight_bits ccode[256]; /* meaning of a char following \.{@@} */ | 549 | static eight_bits ccode[256]; /* meaning of a char following \.{@@} */ |
| 551 | 550 | ||
| 552 | @ @<Set ini...@>= | 551 | @ @<Set ini...@>= |
| 553 | {int c; for (c=0; c<256; c++) ccode[c]=0;} | 552 | {int c; for (c=0; c<256; c++) ccode[c]=0;} |
| @@ -589,7 +588,7 @@ interpretation of identifiers. · 35 unmodified lines | |||
| 589 | 588 | ||
| 590 | @<Predec...@>= | 589 | @<Predec...@>= |
| 591 | static void skip_limbo(void);@/ | 590 | static void skip_limbo(void);@/ |
| 592 | static eight_bits skip_TeX(void);@/ | 591 | static eight_bits skip_TeX(void); |
| 593 | 592 | ||
| 594 | @ @c | 593 | @ @c |
| 595 | static void | 594 | static void |
| @@ -597,7 +596,7 @@ skip_limbo(void) { · 1 unmodified line | |||
| 597 | while(true) { | 596 | while(true) { |
| 598 | if (loc>limit && get_line()==false) return; | 597 | if (loc>limit && get_line()==false) return; |
| 599 | *(limit+1)='@@'; | 598 | *(limit+1)='@@'; |
| 600 | while (*loc!='@@') loc++; /* look for '@@', then skip two chars */ | 599 | while (*loc!='@@') loc++; /* look for `\.{@@}', then skip two chars */ |
| 601 | if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; | 600 | if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++]; |
| 602 | if (c==new_section) return; | 601 | if (c==new_section) return; |
| 603 | if (c==noop) skip_restricted(); | 602 | if (c==noop) skip_restricted(); |
| @@ -666,9 +665,9 @@ it sets |xref_switch| to |def_flag| and goes on to the next token. · 62 unmodified lines | |||
| 666 | @d string 0201 /* \CEE/ string */ | 665 | @d string 0201 /* \CEE/ string */ |
| 667 | @d identifier 0202 /* \CEE/ identifier or reserved word */ | 666 | @d identifier 0202 /* \CEE/ identifier or reserved word */ |
| 668 | 667 | ||
| 669 | @<Global...@>= | 668 | @<Private...@>= |
| 670 | name_pointer cur_section; /* name of section just scanned */ | 669 | static name_pointer cur_section; /* name of section just scanned */ |
| 671 | char cur_section_char; /* the character just before that name */ | 670 | static char cur_section_char; /* the character just before that name */ |
| 672 | 671 | ||
| 673 | @ As one might expect, |get_next| consists mostly of a big switch | 672 | @ As one might expect, |get_next| consists mostly of a big switch |
| 674 | that branches to the various special cases that can arise. | 673 | that branches to the various special cases that can arise. |
| @@ -680,10 +679,7 @@ compilers even allow the dollar sign. · 5 unmodified lines | |||
| 680 | @d ishigh(c) ((eight_bits)(c)>0177) | 679 | @d ishigh(c) ((eight_bits)(c)>0177) |
| 681 | @^high-bit character handling@> | 680 | @^high-bit character handling@> |
| 682 | 681 | ||
| 683 | @<Predecl...@>= | 682 | @c |
| 684 | static eight_bits get_next(void);@/ | ||
| 685 | |||
| 686 | @ @c | ||
| 687 | static eight_bits | 683 | static eight_bits |
| 688 | get_next(void) /* produces the next input token */ | 684 | get_next(void) /* produces the next input token */ |
| 689 | { | 685 | { |
| @@ -708,6 +704,8 @@ get_next(void) /* produces the next input token */ · 18 unmodified lines | |||
| 708 | } | 704 | } |
| 709 | } | 705 | } |
| 710 | 706 | ||
| 707 | @ @<Predecl...@>=@+static eight_bits get_next(void); | ||
| 708 | |||
| 711 | @ Because preprocessor commands do not fit in with the rest of the syntax | 709 | @ Because preprocessor commands do not fit in with the rest of the syntax |
| 712 | of \CEE/, | 710 | of \CEE/, |
| 713 | we have to deal with them separately. One solution is to enclose such | 711 | we have to deal with them separately. One solution is to enclose such |
| @@ -721,8 +719,8 @@ for |ord|, since |get_next| changes |ord| into a string. · 7 unmodified lines | |||
| 721 | @d left_preproc ord /* begins a preprocessor command */ | 719 | @d left_preproc ord /* begins a preprocessor command */ |
| 722 | @d right_preproc 0217 /* ends a preprocessor command */ | 720 | @d right_preproc 0217 /* ends a preprocessor command */ |
| 723 | 721 | ||
| 724 | @<Glob...@>= | 722 | @<Private...@>= |
| 725 | boolean preprocessing=false; /* are we scanning a preprocessor command? */ | 723 | static boolean preprocessing=false; /* are we scanning a preprocessor command? */ |
| 726 | 724 | ||
| 727 | @ @<Raise prep...@>= { | 725 | @ @<Raise prep...@>= { |
| 728 | preprocessing=true; | 726 | preprocessing=true; |
| @@ -734,8 +732,8 @@ boolean preprocessing=false; /* are we scanning a preprocessor command? */ · 5 unmodified lines | |||
| 734 | a file name in lines that start with \.{\#include}. We must treat this file | 732 | a file name in lines that start with \.{\#include}. We must treat this file |
| 735 | name as a string. | 733 | name as a string. |
| 736 | 734 | ||
| 737 | @<Glob...@>= | 735 | @<Private...@>= |
| 738 | boolean sharp_include_line=false; /* are we scanning a |#include| line? */ | 736 | static boolean sharp_include_line=false; /* are we scanning a \&{\#include} line? */ |
| 739 | 737 | ||
| 740 | @ @<Check if next token is |include|@>= | 738 | @ @<Check if next token is |include|@>= |
| 741 | while (loc<=buffer_end-7 && xisspace(*loc)) loc++; | 739 | while (loc<=buffer_end-7 && xisspace(*loc)) loc++; |
| @@ -844,7 +842,7 @@ convention, but do not allow the string to be longer than |longest_name|. · 102 unmodified lines | |||
| 844 | if (delim=='u' && *loc=='8') { *++id_loc=*loc++; } | 842 | if (delim=='u' && *loc=='8') { *++id_loc=*loc++; } |
| 845 | delim=*loc++; *++id_loc=delim; | 843 | delim=*loc++; *++id_loc=delim; |
| 846 | } | 844 | } |
| 847 | if (delim=='<') delim='>'; /* for file names in |#include| lines */ | 845 | if (delim=='<') delim='>'; /* for file names in \&{\#include} lines */ |
| 848 | while (true) { | 846 | while (true) { |
| 849 | if (loc>=limit) { | 847 | if (loc>=limit) { |
| 850 | if(*(limit-1)!='\\') { | 848 | if(*(limit-1)!='\\') { |
| @@ -960,10 +958,7 @@ if (c=='@@') { · 109 unmodified lines | |||
| 960 | 958 | ||
| 961 | @ This function skips over a restricted context at relatively high speed. | 959 | @ This function skips over a restricted context at relatively high speed. |
| 962 | 960 | ||
| 963 | @<Predecl...@>= | 961 | @c |
| 964 | static void skip_restricted(void);@/ | ||
| 965 | |||
| 966 | @ @c | ||
| 967 | static void | 962 | static void |
| 968 | skip_restricted(void) | 963 | skip_restricted(void) |
| 969 | { | 964 | { |
| @@ -983,6 +978,8 @@ false_alarm: · 13 unmodified lines | |||
| 983 | } | 978 | } |
| 984 | } | 979 | } |
| 985 | 980 | ||
| 981 | @ @<Predecl...@>=@+static void skip_restricted(void); | ||
| 982 | |||
| 986 | @ At the present point in the program we | 983 | @ At the present point in the program we |
| 987 | have |*(loc-1)==verbatim|; we set |id_first| to the beginning | 984 | have |*(loc-1)==verbatim|; we set |id_first| to the beginning |
| 988 | of the string itself, and |id_loc| to its ending-plus-one location in the | 985 | of the string itself, and |id_loc| to its ending-plus-one location in the |
| @@ -1007,16 +1004,13 @@ The global variable |next_control| often contains the most recent output of · 18 unmodified lines | |||
| 1007 | |get_next|; in interesting cases, this will be the control code that | 1004 | |get_next|; in interesting cases, this will be the control code that |
| 1008 | ended a section or part of a section. | 1005 | ended a section or part of a section. |
| 1009 | 1006 | ||
| 1010 | @<Global...@>= | 1007 | @<Private...@>= |
| 1011 | eight_bits next_control; /* control code waiting to be acting upon */ | 1008 | static eight_bits next_control; /* control code waiting to be acting upon */ |
| 1012 | 1009 | ||
| 1013 | @ The overall processing strategy in phase one has the following | 1010 | @ The overall processing strategy in phase one has the following |
| 1014 | straightforward outline. | 1011 | straightforward outline. |
| 1015 | 1012 | ||
| 1016 | @<Predecl...@>= | 1013 | @c |
| 1017 | static void phase_one(void);@/ | ||
| 1018 | |||
| 1019 | @ @c | ||
| 1020 | static void | 1014 | static void |
| 1021 | phase_one(void) { | 1015 | phase_one(void) { |
| 1022 | phase=1; reset_input(); section_count=0; | 1016 | phase=1; reset_input(); section_count=0; |
| @@ -1029,6 +1023,8 @@ phase_one(void) { · 6 unmodified lines | |||
| 1029 | @<Print error messages about unused or undefined section names@>@; | 1023 | @<Print error messages about unused or undefined section names@>@; |
| 1030 | } | 1024 | } |
| 1031 | 1025 | ||
| 1026 | @ @<Predecl...@>=@+static void phase_one(void); | ||
| 1027 | |||
| 1032 | @ @<Store cross-reference data...@>= | 1028 | @ @<Store cross-reference data...@>= |
| 1033 | { | 1029 | { |
| 1034 | if (++section_count==max_sections) overflow("section number"); | 1030 | if (++section_count==max_sections) overflow("section number"); |
| @@ -1067,7 +1063,7 @@ as well as |normal==0|. · 32 unmodified lines | |||
| 1067 | 1063 | ||
| 1068 | @<Predecl...@>= | 1064 | @<Predecl...@>= |
| 1069 | static void C_xref(eight_bits);@/ | 1065 | static void C_xref(eight_bits);@/ |
| 1070 | static void outer_xref(void);@/ | 1066 | static void outer_xref(void); |
| 1071 | 1067 | ||
| 1072 | @ @c | 1068 | @ @c |
| 1073 | static void | 1069 | static void |
| @@ -1161,9 +1157,9 @@ entirely, even if it contains \pb\ constructions. · 87 unmodified lines | |||
| 1161 | The variables |lhs| and |rhs| point to the respective identifiers involved | 1157 | The variables |lhs| and |rhs| point to the respective identifiers involved |
| 1162 | in a format definition. | 1158 | in a format definition. |
| 1163 | 1159 | ||
| 1164 | @<Global...@>= | 1160 | @<Private...@>= |
| 1165 | name_pointer lhs, rhs; /* pointers to |byte_start| for format identifiers */ | 1161 | static name_pointer lhs, rhs; /* pointers to |byte_start| for format identifiers */ |
| 1166 | name_pointer res_wd_end; /* pointer to the first nonreserved identifier */ | 1162 | static name_pointer res_wd_end; /* pointer to the first nonreserved identifier */ |
| 1167 | 1163 | ||
| 1168 | @ When we get to the following code we have |next_control>=format_code|. | 1164 | @ When we get to the following code we have |next_control>=format_code|. |
| 1169 | 1165 | ||
| @@ -1245,18 +1241,15 @@ if (next_control<=section_name) { /* |begin_C| or |section_name| */ · 75 unmodified lines | |||
| 1245 | section name was both defined and used. The variable |cur_xref| will point | 1241 | section name was both defined and used. The variable |cur_xref| will point |
| 1246 | to cross-references for the current section name of interest. | 1242 | to cross-references for the current section name of interest. |
| 1247 | 1243 | ||
| 1248 | @<Global...@>= | 1244 | @<Private...@>= |
| 1249 | xref_pointer cur_xref; /* temporary cross-reference pointer */ | 1245 | static xref_pointer cur_xref; /* temporary cross-reference pointer */ |
| 1250 | boolean an_output; /* did |file_flag| precede |cur_xref|? */ | 1246 | static boolean an_output; /* did |file_flag| precede |cur_xref|? */ |
| 1251 | 1247 | ||
| 1252 | @ The following recursive procedure | 1248 | @ The following recursive procedure |
| 1253 | walks through the tree of section names and prints out anomalies. | 1249 | walks through the tree of section names and prints out anomalies. |
| 1254 | @^recursion@> | 1250 | @^recursion@> |
| 1255 | 1251 | ||
| 1256 | @<Predecl...@>= | 1252 | @c |
| 1257 | static void section_check(name_pointer);@/ | ||
| 1258 | |||
| 1259 | @ @c | ||
| 1260 | static void | 1253 | static void |
| 1261 | section_check( | 1254 | section_check( |
| 1262 | name_pointer p) /* print anomalies in subtree |p| */ | 1255 | name_pointer p) /* print anomalies in subtree |p| */ |
| @@ -1281,6 +1274,8 @@ name_pointer p) /* print anomalies in subtree |p| */ · 18 unmodified lines | |||
| 1281 | } | 1274 | } |
| 1282 | } | 1275 | } |
| 1283 | 1276 | ||
| 1277 | @ @<Predecl...@>=@+static void section_check(name_pointer); | ||
| 1278 | |||
| 1284 | @ @<Print error messages about un...@>=section_check(root); | 1279 | @ @<Print error messages about un...@>=section_check(root); |
| 1285 | 1280 | ||
| 1286 | @* Low-level output routines. | 1281 | @* Low-level output routines. |
| @@ -1289,11 +1284,11 @@ characters long, so we place it into an output buffer. During the output · 2 unmodified lines | |||
| 1289 | process, |out_line| will hold the current line number of the line about to | 1284 | process, |out_line| will hold the current line number of the line about to |
| 1290 | be output. | 1285 | be output. |
| 1291 | 1286 | ||
| 1292 | @<Global...@>= | 1287 | @<Private...@>= |
| 1293 | char out_buf[line_length+1]; /* assembled characters */ | 1288 | static char out_buf[line_length+1]; /* assembled characters */ |
| 1294 | char *out_buf_end = out_buf+line_length; /* end of |out_buf| */ | 1289 | static char *out_buf_end = out_buf+line_length; /* end of |out_buf| */ |
| 1295 | char *out_ptr; /* last character in |out_buf| */ | 1290 | static char *out_ptr; /* last character in |out_buf| */ |
| 1296 | int out_line; /* number of next line to be output */ | 1291 | static int out_line; /* number of next line to be output */ |
| 1297 | 1292 | ||
| 1298 | @ The |flush_buffer| routine empties the buffer up to a given breakpoint, | 1293 | @ The |flush_buffer| routine empties the buffer up to a given breakpoint, |
| 1299 | and moves any remaining characters to the beginning of the next line. | 1294 | and moves any remaining characters to the beginning of the next line. |
| @@ -1314,7 +1309,7 @@ of commented-out text). · 14 unmodified lines | |||
| 1314 | 1309 | ||
| 1315 | @<Predecl...@>= | 1310 | @<Predecl...@>= |
| 1316 | static void flush_buffer(char *,boolean,boolean);@/ | 1311 | static void flush_buffer(char *,boolean,boolean);@/ |
| 1317 | static void finish_line(void);@/ | 1312 | static void finish_line(void); |
| 1318 | 1313 | ||
| 1319 | @ @c | 1314 | @ @c |
| 1320 | static void | 1315 | static void |
| @@ -1379,7 +1374,7 @@ A line break will occur at a space or after a single-nonletter · 58 unmodified lines | |||
| 1379 | 1374 | ||
| 1380 | @<Predecl...@>= | 1375 | @<Predecl...@>= |
| 1381 | static void out_str(const char *);@/ | 1376 | static void out_str(const char *);@/ |
| 1382 | static void break_out(void);@/ | 1377 | static void break_out(void); |
| 1383 | 1378 | ||
| 1384 | @ @c | 1379 | @ @c |
| 1385 | static void | 1380 | static void |
| @@ -1437,7 +1432,7 @@ the section is changed, we output `\.{\\*}' just after the number. · 51 unmodified lines | |||
| 1437 | 1432 | ||
| 1438 | @<Predecl...@>= | 1433 | @<Predecl...@>= |
| 1439 | static void out_section(sixteen_bits);@/ | 1434 | static void out_section(sixteen_bits);@/ |
| 1440 | static void out_name(name_pointer,boolean);@/ | 1435 | static void out_name(name_pointer,boolean); |
| 1441 | 1436 | ||
| 1442 | @ @c | 1437 | @ @c |
| 1443 | static void | 1438 | static void |
| @@ -1484,7 +1479,7 @@ The use of `\.{@@}' signs is severely restricted in such material: · 40 unmodified lines | |||
| 1484 | @<Predecl...@>= | 1479 | @<Predecl...@>= |
| 1485 | static void copy_limbo(void);@/ | 1480 | static void copy_limbo(void);@/ |
| 1486 | static eight_bits copy_TeX(void);@/ | 1481 | static eight_bits copy_TeX(void);@/ |
| 1487 | static int copy_comment(boolean,int);@/ | 1482 | static int copy_comment(boolean,int); |
| 1488 | 1483 | ||
| 1489 | @ @c | 1484 | @ @c |
| 1490 | static void | 1485 | static void |
| @@ -1716,8 +1711,8 @@ same initial letter; these subscripts are assigned from left to right. · 225 unmodified lines | |||
| 1716 | @d begin_arg 61 /* \.{@@[} */ | 1711 | @d begin_arg 61 /* \.{@@[} */ |
| 1717 | @d end_arg 62 /* \.{@@]} */ | 1712 | @d end_arg 62 /* \.{@@]} */ |
| 1718 | 1713 | ||
| 1719 | @<Glo...@>= | 1714 | @<Private...@>= |
| 1720 | char cat_name[256][12]; | 1715 | static char cat_name[256][12]; |
| 1721 | 1716 | ||
| 1722 | @ @<Set in...@>= | 1717 | @ @<Set in...@>= |
| 1723 | {int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");} | 1718 | {int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");} |
| @@ -1783,10 +1778,7 @@ char cat_name[256][12]; · 59 unmodified lines | |||
| 1783 | 1778 | ||
| 1784 | @ This code allows \.{CWEAVE} to display its parsing steps. | 1779 | @ This code allows \.{CWEAVE} to display its parsing steps. |
| 1785 | 1780 | ||
| 1786 | @<Predecl...@>= | 1781 | @c |
| 1787 | static void print_cat(eight_bits);@/ | ||
| 1788 | |||
| 1789 | @ @c | ||
| 1790 | static void | 1782 | static void |
| 1791 | print_cat(@t\1\1@> /* symbolic printout of a category */ | 1783 | print_cat(@t\1\1@> /* symbolic printout of a category */ |
| 1792 | eight_bits c@t\2\2@>) | 1784 | eight_bits c@t\2\2@>) |
| @@ -1794,6 +1786,8 @@ eight_bits c@t\2\2@>) · 1 unmodified line | |||
| 1794 | fputs(cat_name[c],stdout); | 1786 | fputs(cat_name[c],stdout); |
| 1795 | } | 1787 | } |
| 1796 | 1788 | ||
| 1789 | @ @<Predecl...@>=@+static void print_cat(eight_bits); | ||
| 1790 | |||
| 1797 | @ The token lists for translated \TEX/ output contain some special control | 1791 | @ The token lists for translated \TEX/ output contain some special control |
| 1798 | symbols as well as ordinary characters. These control symbols are | 1792 | symbols as well as ordinary characters. These control symbols are |
| 1799 | interpreted by \.{CWEAVE} before they are written to the output file. | 1793 | interpreted by \.{CWEAVE} before they are written to the output file. |
| @@ -2104,15 +2098,15 @@ typedef scrap *scrap_pointer; · 304 unmodified lines | |||
| 2104 | 2098 | ||
| 2105 | @ @d trans trans_plus.Trans /* translation texts of scraps */ | 2099 | @ @d trans trans_plus.Trans /* translation texts of scraps */ |
| 2106 | 2100 | ||
| 2107 | @<Global...@>= | 2101 | @<Private...@>= |
| 2108 | scrap scrap_info[max_scraps]; /* memory array for scraps */ | 2102 | static scrap scrap_info[max_scraps]; /* memory array for scraps */ |
| 2109 | scrap_pointer scrap_info_end=scrap_info+max_scraps-1; /* end of |scrap_info| */ | 2103 | static scrap_pointer scrap_info_end=scrap_info+max_scraps-1; /* end of |scrap_info| */ |
| 2110 | scrap_pointer scrap_base; /* beginning of the current scrap sequence */ | 2104 | static scrap_pointer scrap_base; /* beginning of the current scrap sequence */ |
| 2111 | scrap_pointer scrap_ptr; /* ending of the current scrap sequence */ | 2105 | static scrap_pointer scrap_ptr; /* ending of the current scrap sequence */ |
| 2112 | scrap_pointer max_scr_ptr; /* largest value assumed by |scrap_ptr| */ | 2106 | static scrap_pointer max_scr_ptr; /* largest value assumed by |scrap_ptr| */ |
| 2113 | scrap_pointer pp; /* current position for reducing productions */ | 2107 | static scrap_pointer pp; /* current position for reducing productions */ |
| 2114 | scrap_pointer lo_ptr; /* last scrap that has been examined */ | 2108 | static scrap_pointer lo_ptr; /* last scrap that has been examined */ |
| 2115 | scrap_pointer hi_ptr; /* first scrap that has not been examined */ | 2109 | static scrap_pointer hi_ptr; /* first scrap that has not been examined */ |
| 2116 | 2110 | ||
| 2117 | @ @<Set init...@>= | 2111 | @ @<Set init...@>= |
| 2118 | scrap_base=scrap_info+1; | 2112 | scrap_base=scrap_info+1; |
| @@ -2141,10 +2135,7 @@ translated without line-break controls. · 22 unmodified lines | |||
| 2141 | @d tok_flag 4*id_flag /* signifies a token list */ | 2135 | @d tok_flag 4*id_flag /* signifies a token list */ |
| 2142 | @d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ | 2136 | @d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */ |
| 2143 | 2137 | ||
| 2144 | @<Predecl...@>= | 2138 | @c |
| 2145 | static void print_text(text_pointer p);@/ | ||
| 2146 | |||
| 2147 | @ @c | ||
| 2148 | static void | 2139 | static void |
| 2149 | print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ | 2140 | print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */ |
| 2150 | text_pointer p@t\2\2@>) | 2141 | text_pointer p@t\2\2@>) |
| @@ -2169,6 +2160,8 @@ text_pointer p@t\2\2@>) · 18 unmodified lines | |||
| 2169 | update_terminal; | 2160 | update_terminal; |
| 2170 | } | 2161 | } |
| 2171 | 2162 | ||
| 2163 | @ @<Predecl...@>=@+static void print_text(text_pointer p); | ||
| 2164 | |||
| 2172 | @ @<Print token |r|...@>= | 2165 | @ @<Print token |r|...@>= |
| 2173 | switch (r) { | 2166 | switch (r) { |
| 2174 | case math_rel: printf("\\mathrel{"@q}@>); break; | 2167 | case math_rel: printf("\\mathrel{"@q}@>); break; |
| @@ -2265,13 +2258,13 @@ productions as they were listed earlier. · 90 unmodified lines | |||
| 2265 | @d app(a) *(tok_ptr++)=(token)(a) | 2258 | @d app(a) *(tok_ptr++)=(token)(a) |
| 2266 | @d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start)) | 2259 | @d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start)) |
| 2267 | 2260 | ||
| 2268 | @<Global...@>= | 2261 | @<Private...@>= |
| 2269 | int cur_mathness, init_mathness; | 2262 | static int cur_mathness, init_mathness; |
| 2270 | 2263 | ||
| 2271 | @ @<Predecl...@>= | 2264 | @ @<Predecl...@>= |
| 2272 | static void app_str(const char *);@/ | 2265 | static void app_str(const char *);@/ |
| 2273 | static void big_app(token);@/ | 2266 | static void big_app(token);@/ |
| 2274 | static void big_app1(scrap_pointer);@/ | 2267 | static void big_app1(scrap_pointer); |
| 2275 | 2268 | ||
| 2276 | @ @c | 2269 | @ @c |
| 2277 | static void | 2270 | static void |
| @@ -2428,7 +2421,7 @@ more properly alpha\-betized, · 150 unmodified lines | |||
| 2428 | static token_pointer find_first_ident(text_pointer);@/ | 2421 | static token_pointer find_first_ident(text_pointer);@/ |
| 2429 | static void make_reserved(scrap_pointer);@/ | 2422 | static void make_reserved(scrap_pointer);@/ |
| 2430 | static void make_underlined(scrap_pointer);@/ | 2423 | static void make_underlined(scrap_pointer);@/ |
| 2431 | static void underline_xref(name_pointer);@/ | 2424 | static void underline_xref(name_pointer); |
| 2432 | 2425 | ||
| 2433 | @ @c | 2426 | @ @c |
| 2434 | static token_pointer | 2427 | static token_pointer |
| @@ -3022,7 +3015,7 @@ too large, since it is assumed that this test was done beforehand. · 587 unmodified lines | |||
| 3022 | 3015 | ||
| 3023 | @<Predecl...@>= | 3016 | @<Predecl...@>= |
| 3024 | static void reduce(scrap_pointer,short,eight_bits,short,short);@/ | 3017 | static void reduce(scrap_pointer,short,eight_bits,short,short);@/ |
| 3025 | static void squash(scrap_pointer,short,eight_bits,short,short);@/ | 3018 | static void squash(scrap_pointer,short,eight_bits,short,short); |
| 3026 | 3019 | ||
| 3027 | @ @c | 3020 | @ @c |
| 3028 | static void | 3021 | static void |
| @@ -3114,8 +3107,8 @@ current stack categories will be printed out when |tracing| is set to 2; · 85 unmodified lines | |||
| 3114 | a sequence of two or more irreducible scraps will be printed out when | 3107 | a sequence of two or more irreducible scraps will be printed out when |
| 3115 | |tracing| is set to 1. | 3108 | |tracing| is set to 1. |
| 3116 | 3109 | ||
| 3117 | @<Global...@>= | 3110 | @<Private...@>= |
| 3118 | int tracing; /* can be used to show parsing details */ | 3111 | static int tracing; /* can be used to show parsing details */ |
| 3119 | 3112 | ||
| 3120 | @ @<Print a snapsh...@>= | 3113 | @ @<Print a snapsh...@>= |
| 3121 | { scrap_pointer k_l; /* pointer into |scrap_info| */ | 3114 | { scrap_pointer k_l; /* pointer into |scrap_info| */ |
| @@ -3146,10 +3139,7 @@ lists with up to six tokens without checking for overflow. Before calling · 24 unmodified lines | |||
| 3146 | since |translate| might add a new text and a new scrap before it checks | 3139 | since |translate| might add a new text and a new scrap before it checks |
| 3147 | for overflow. | 3140 | for overflow. |
| 3148 | 3141 | ||
| 3149 | @<Predecl...@>= | 3142 | @c |
| 3150 | static text_pointer translate(void);@/ | ||
| 3151 | |||
| 3152 | @ @c | ||
| 3153 | static text_pointer | 3143 | static text_pointer |
| 3154 | translate(void) /* converts a sequence of scraps */ | 3144 | translate(void) /* converts a sequence of scraps */ |
| 3155 | { | 3145 | { |
| @@ -3161,6 +3151,8 @@ translate(void) /* converts a sequence of scraps */ · 5 unmodified lines | |||
| 3161 | @<Combine the irreducible scraps that remain@>@; | 3151 | @<Combine the irreducible scraps that remain@>@; |
| 3162 | } | 3152 | } |
| 3163 | 3153 | ||
| 3154 | @ @<Predecl...@>=@+static text_pointer translate(void); | ||
| 3155 | |||
| 3164 | @ If the initial sequence of scraps does not reduce to a single scrap, | 3156 | @ If the initial sequence of scraps does not reduce to a single scrap, |
| 3165 | we concatenate the translations of all remaining scraps, separated by | 3157 | we concatenate the translations of all remaining scraps, separated by |
| 3166 | blank spaces, with dollar signs surrounding the translations of scraps | 3158 | blank spaces, with dollar signs surrounding the translations of scraps |
| @@ -3214,10 +3206,7 @@ repeatedly to read \CEE/ text until encountering the next `\.{\v}' or · 47 unmodified lines | |||
| 3214 | what it reads are appended into the |cat| and |trans| arrays, and |scrap_ptr| | 3206 | what it reads are appended into the |cat| and |trans| arrays, and |scrap_ptr| |
| 3215 | is advanced. | 3207 | is advanced. |
| 3216 | 3208 | ||
| 3217 | @<Predecl...@>= | 3209 | @c |
| 3218 | static void C_parse(eight_bits);@/ | ||
| 3219 | |||
| 3220 | @ @c | ||
| 3221 | static void | 3210 | static void |
| 3222 | C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */ | 3211 | C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */ |
| 3223 | eight_bits spec_ctrl@t\2\2@>) | 3212 | eight_bits spec_ctrl@t\2\2@>) |
| @@ -3231,6 +3220,8 @@ C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */ · 7 unmodified lines | |||
| 3231 | } | 3220 | } |
| 3232 | } | 3221 | } |
| 3233 | 3222 | ||
| 3223 | @ @<Predecl...@>=@+static void C_parse(eight_bits); | ||
| 3224 | |||
| 3234 | @ The following macro is used to append a scrap whose tokens have just | 3225 | @ The following macro is used to append a scrap whose tokens have just |
| 3235 | been appended: | 3226 | been appended: |
| 3236 | 3227 | ||
| @@ -3452,7 +3443,7 @@ token list; it also builds a new scrap if |scrapping==true|. · 215 unmodified lines | |||
| 3452 | @<Predec...@>= | 3443 | @<Predec...@>= |
| 3453 | static void app_cur_id(boolean);@/ | 3444 | static void app_cur_id(boolean);@/ |
| 3454 | static text_pointer C_translate(void);@/ | 3445 | static text_pointer C_translate(void);@/ |
| 3455 | static void outer_parse(void);@/ | 3446 | static void outer_parse(void); |
| 3456 | 3447 | ||
| 3457 | @ @c | 3448 | @ @c |
| 3458 | static void | 3449 | static void |
| @@ -3604,12 +3595,12 @@ typedef output_state *stack_pointer; · 145 unmodified lines | |||
| 3604 | @d cur_mode cur_state.mode_field /* current mode of interpretation */ | 3595 | @d cur_mode cur_state.mode_field /* current mode of interpretation */ |
| 3605 | @d init_stack stack_ptr=stack;cur_mode=outer /* initialize the stack */ | 3596 | @d init_stack stack_ptr=stack;cur_mode=outer /* initialize the stack */ |
| 3606 | 3597 | ||
| 3607 | @<Global...@>= | 3598 | @<Private...@>= |
| 3608 | output_state cur_state; /* |cur_end|, |cur_tok|, |cur_mode| */ | 3599 | static output_state cur_state; /* |cur_end|, |cur_tok|, |cur_mode| */ |
| 3609 | output_state stack[stack_size]; /* info for non-current levels */ | 3600 | static output_state stack[stack_size]; /* info for non-current levels */ |
| 3610 | stack_pointer stack_end=stack+stack_size-1; /* end of |stack| */ | 3601 | static stack_pointer stack_end=stack+stack_size-1; /* end of |stack| */ |
| 3611 | stack_pointer stack_ptr; /* first unused location in the output state stack */ | 3602 | static stack_pointer stack_ptr; /* first unused location in the output state stack */ |
| 3612 | stack_pointer max_stack_ptr; /* largest value assumed by |stack_ptr| */ | 3603 | static stack_pointer max_stack_ptr; /* largest value assumed by |stack_ptr| */ |
| 3613 | 3604 | ||
| 3614 | @ @<Set init...@>= | 3605 | @ @<Set init...@>= |
| 3615 | max_stack_ptr=stack; | 3606 | max_stack_ptr=stack; |
| @@ -3620,7 +3611,7 @@ The value of |cur_mode| is not changed. · 4 unmodified lines | |||
| 3620 | 3611 | ||
| 3621 | @<Predecl...@>= | 3612 | @<Predecl...@>= |
| 3622 | static void push_level(text_pointer);@/ | 3613 | static void push_level(text_pointer);@/ |
| 3623 | static void pop_level(void);@/ | 3614 | static void pop_level(void); |
| 3624 | 3615 | ||
| 3625 | @ @c | 3616 | @ @c |
| 3626 | static void | 3617 | static void |
| @@ -3658,8 +3649,8 @@ by a complex routine that might generate additional levels of output). · 31 unmodified lines | |||
| 3658 | In these cases |cur_name| points to the identifier or section name in | 3649 | In these cases |cur_name| points to the identifier or section name in |
| 3659 | question. | 3650 | question. |
| 3660 | 3651 | ||
| 3661 | @<Global...@>= | 3652 | @<Private...@>= |
| 3662 | name_pointer cur_name; | 3653 | static name_pointer cur_name; |
| 3663 | 3654 | ||
| 3664 | @ @d res_word 0201 /* returned by |get_output| for reserved words */ | 3655 | @ @d res_word 0201 /* returned by |get_output| for reserved words */ |
| 3665 | @d section_code 0200 /* returned by |get_output| for section names */ | 3656 | @d section_code 0200 /* returned by |get_output| for section names */ |
| @@ -3667,7 +3658,7 @@ name_pointer cur_name; · 1 unmodified line | |||
| 3667 | @<Predecl...@>= | 3658 | @<Predecl...@>= |
| 3668 | static eight_bits get_output(void);@/ | 3659 | static eight_bits get_output(void);@/ |
| 3669 | static void output_C(void);@/ | 3660 | static void output_C(void);@/ |
| 3670 | static void make_output(void);@/ | 3661 | static void make_output(void); |
| 3671 | 3662 | ||
| 3672 | @ @c | 3663 | @ @c |
| 3673 | static eight_bits | 3664 | static eight_bits |
| @@ -3990,10 +3981,7 @@ is analogous to phase one, except that more work is involved because we must · 316 unmodified lines | |||
| 3990 | actually output the \TEX/ material instead of merely looking at the | 3981 | actually output the \TEX/ material instead of merely looking at the |
| 3991 | \.{CWEB} specifications. | 3982 | \.{CWEB} specifications. |
| 3992 | 3983 | ||
| 3993 | @<Predecl...@>= | 3984 | @c |
| 3994 | static void phase_two(void);@/ | ||
| 3995 | |||
| 3996 | @ @c | ||
| 3997 | static void | 3985 | static void |
| 3998 | phase_two(void) { | 3986 | phase_two(void) { |
| 3999 | reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout); | 3987 | reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout); |
| @@ -4003,6 +3991,8 @@ finish_line(); flush_buffer(out_buf,false,false); /* insert a blank line, it loo · 3 unmodified lines | |||
| 4003 | while (!input_has_ended) @<Translate the current section@>@; | 3991 | while (!input_has_ended) @<Translate the current section@>@; |
| 4004 | } | 3992 | } |
| 4005 | 3993 | ||
| 3994 | @ @<Predecl...@>=@+static void phase_two(void); | ||
| 3995 | |||
| 4006 | @ The output file will contain the control sequence \.{\\Y} between non-null | 3996 | @ The output file will contain the control sequence \.{\\Y} between non-null |
| 4007 | sections of a section, e.g., between the \TEX/ and definition parts if both | 3997 | sections of a section, e.g., between the \TEX/ and definition parts if both |
| 4008 | are nonempty. This puts a little white space between the parts when they are | 3998 | are nonempty. This puts a little white space between the parts when they are |
| @@ -4017,14 +4007,14 @@ and `|emit_space_if_needed|' are able to handle the situation: · 8 unmodified lines | |||
| 4017 | space_checked=true; | 4007 | space_checked=true; |
| 4018 | @.\\Y@> | 4008 | @.\\Y@> |
| 4019 | 4009 | ||
| 4020 | @<Global...@>= | 4010 | @<Private...@>= |
| 4021 | int save_line; /* former value of |out_line| */ | 4011 | static int save_line; /* former value of |out_line| */ |
| 4022 | char *save_place; /* former value of |out_ptr| */ | 4012 | static char *save_place; /* former value of |out_ptr| */ |
| 4023 | int sec_depth; /* the integer, if any, following \.{@@*} */ | 4013 | static int sec_depth; /* the integer, if any, following \.{@@*} */ |
| 4024 | boolean space_checked; /* have we done |emit_space_if_needed|? */ | 4014 | static boolean space_checked; /* have we done |emit_space_if_needed|? */ |
| 4025 | boolean format_visible; /* should the next format declaration be output? */ | 4015 | static boolean format_visible; /* should the next format declaration be output? */ |
| 4026 | boolean doing_format=false; /* are we outputting a format declaration? */ | 4016 | static boolean doing_format=false; /* are we outputting a format declaration? */ |
| 4027 | boolean group_found=false; /* has a starred section occurred? */ | 4017 | static boolean group_found=false; /* has a starred section occurred? */ |
| 4028 | 4018 | ||
| 4029 | @ @<Translate the current section@>= { | 4019 | @ @<Translate the current section@>= { |
| 4030 | section_count++; | 4020 | section_count++; |
| @@ -4113,10 +4103,7 @@ takes place, so that the translation will normally end with \.{\\6} or · 82 unmodified lines | |||
| 4113 | \.{\\7} (the \TEX/ macros for |force| and |big_force|). This \.{\\6} or | 4103 | \.{\\7} (the \TEX/ macros for |force| and |big_force|). This \.{\\6} or |
| 4114 | \.{\\7} is replaced by the concluding \.{\\par} or by \.{\\Y\\par}. | 4104 | \.{\\7} is replaced by the concluding \.{\\par} or by \.{\\Y\\par}. |
| 4115 | 4105 | ||
| 4116 | @<Predecl...@>= | 4106 | @c |
| 4117 | static void finish_C(boolean);@/ | ||
| 4118 | |||
| 4119 | @ @c | ||
| 4120 | static void | 4107 | static void |
| 4121 | finish_C(@t\1\1@> /* finishes a definition or a \CEE/ part */ | 4108 | finish_C(@t\1\1@> /* finishes a definition or a \CEE/ part */ |
| 4122 | boolean visible@t\2\2@>) /* nonzero if we should produce \TeX\ output */ | 4109 | boolean visible@t\2\2@>) /* nonzero if we should produce \TeX\ output */ |
| @@ -4145,6 +4132,8 @@ finish_C(@t\1\1@> /* finishes a definition or a \CEE/ part */ · 22 unmodified lines | |||
| 4145 | /* forget the tokens and the scraps */ | 4132 | /* forget the tokens and the scraps */ |
| 4146 | } | 4133 | } |
| 4147 | 4134 | ||
| 4135 | @ @<Predecl...@>=@+static void finish_C(boolean); | ||
| 4136 | |||
| 4148 | @ Keeping in line with the conventions of the \CEE/ preprocessor (and | 4137 | @ Keeping in line with the conventions of the \CEE/ preprocessor (and |
| 4149 | otherwise contrary to the rules of \.{CWEB}) we distinguish here | 4138 | otherwise contrary to the rules of \.{CWEB}) we distinguish here |
| 4150 | between the case that `\.(' immediately follows an identifier and the | 4139 | between the case that `\.(' immediately follows an identifier and the |
| @@ -4202,8 +4191,8 @@ it starts after we scan the matching `\.)'. · 51 unmodified lines | |||
| 4202 | |next_control>=begin_C|. We will make the global variable |this_section| | 4191 | |next_control>=begin_C|. We will make the global variable |this_section| |
| 4203 | point to the current section name, if it has a name. | 4192 | point to the current section name, if it has a name. |
| 4204 | 4193 | ||
| 4205 | @<Global...@>= | 4194 | @<Private...@>= |
| 4206 | name_pointer this_section; /* the current section name, or zero */ | 4195 | static name_pointer this_section; /* the current section name, or zero */ |
| 4207 | 4196 | ||
| 4208 | @ @<Translate the \CEE/...@>= | 4197 | @ @<Translate the \CEE/...@>= |
| 4209 | this_section=name_dir; | 4198 | this_section=name_dir; |
| @@ -4286,10 +4275,7 @@ leaves |cur_xref| pointing to the first element not printed. Typical outputs: · 76 unmodified lines | |||
| 4286 | Note that the output of \.{CWEAVE} is not English-specific; users may | 4275 | Note that the output of \.{CWEAVE} is not English-specific; users may |
| 4287 | supply new definitions for the macros \.{\\A}, \.{\\As}, etc. | 4276 | supply new definitions for the macros \.{\\A}, \.{\\As}, etc. |
| 4288 | 4277 | ||
| 4289 | @<Predecl...@>= | 4278 | @c |
| 4290 | static void footnote(sixteen_bits);@/ | ||
| 4291 | |||
| 4292 | @ @c | ||
| 4293 | static void | 4279 | static void |
| 4294 | footnote(@t\1\1@> /* outputs section cross-references */ | 4280 | footnote(@t\1\1@> /* outputs section cross-references */ |
| 4295 | sixteen_bits flag@t\2\2@>) | 4281 | sixteen_bits flag@t\2\2@>) |
| @@ -4305,6 +4291,8 @@ sixteen_bits flag@t\2\2@>) · 9 unmodified lines | |||
| 4305 | out('.'); | 4291 | out('.'); |
| 4306 | } | 4292 | } |
| 4307 | 4293 | ||
| 4294 | @ @<Predecl...@>=@+static void footnote(sixteen_bits); | ||
| 4295 | |||
| 4308 | @ The following code distinguishes three cases, according as the number | 4296 | @ The following code distinguishes three cases, according as the number |
| 4309 | of cross-references is one, two, or more than two. Variable |q| points | 4297 | of cross-references is one, two, or more than two. Variable |q| points |
| 4310 | to the first cross-reference, and the last link is a zero. | 4298 | to the first cross-reference, and the last link is a zero. |
| @@ -4335,10 +4323,7 @@ If the user has set the |no_xref| flag (the \.{-x} option on the command line), · 24 unmodified lines | |||
| 4335 | just finish off the page, omitting the index, section name list, and table of | 4323 | just finish off the page, omitting the index, section name list, and table of |
| 4336 | contents. | 4324 | contents. |
| 4337 | 4325 | ||
| 4338 | @<Predecl...@>= | 4326 | @c |
| 4339 | static void phase_three(void);@/ | ||
| 4340 | |||
| 4341 | @ @c | ||
| 4342 | static void | 4327 | static void |
| 4343 | phase_three(void) { | 4328 | phase_three(void) { |
| 4344 | if (no_xref) { | 4329 | if (no_xref) { |
| @@ -4386,11 +4371,13 @@ if (show_happiness) { · 41 unmodified lines | |||
| 4386 | check_complete(); /* was all of the change file used? */ | 4371 | check_complete(); /* was all of the change file used? */ |
| 4387 | } | 4372 | } |
| 4388 | 4373 | ||
| 4374 | @ @<Predecl...@>=@+static void phase_three(void); | ||
| 4375 | |||
| 4389 | @ Just before the index comes a list of all the changed sections, including | 4376 | @ Just before the index comes a list of all the changed sections, including |
| 4390 | the index section itself. | 4377 | the index section itself. |
| 4391 | 4378 | ||
| 4392 | @<Global...@>= | 4379 | @<Private...@>= |
| 4393 | sixteen_bits k_section; /* runs through the sections */ | 4380 | static sixteen_bits k_section; /* runs through the sections */ |
| 4394 | 4381 | ||
| 4395 | @ @<Tell about changed sections@>= { | 4382 | @ @<Tell about changed sections@>= { |
| 4396 | /* remember that the index is already marked as changed */ | 4383 | /* remember that the index is already marked as changed */ |
| @@ -4415,10 +4402,10 @@ letters, since we want to have `$t<\\{TeX}<\&{to}$'.) The · 18 unmodified lines | |||
| 4415 | list for character |c| begins at location |bucket[c]| and continues through | 4402 | list for character |c| begins at location |bucket[c]| and continues through |
| 4416 | the |blink| array. | 4403 | the |blink| array. |
| 4417 | 4404 | ||
| 4418 | @<Global...@>= | 4405 | @<Private...@>= |
| 4419 | name_pointer bucket[256]; | 4406 | static name_pointer bucket[256]; |
| 4420 | name_pointer next_name; /* successor of |cur_name| when sorting */ | 4407 | static name_pointer next_name; /* successor of |cur_name| when sorting */ |
| 4421 | name_pointer blink[max_names]; /* links in the buckets */ | 4408 | static name_pointer blink[max_names]; /* links in the buckets */ |
| 4422 | 4409 | ||
| 4423 | @ To begin the sorting, we go through all the hash lists and put each entry | 4410 | @ To begin the sorting, we go through all the hash lists and put each entry |
| 4424 | having a nonempty cross-reference list into the proper bucket. | 4411 | having a nonempty cross-reference list into the proper bucket. |
| @@ -4458,11 +4445,11 @@ name_pointer Head; · 33 unmodified lines | |||
| 4458 | @d sort_ptr scrap_ptr /* ditto */ | 4445 | @d sort_ptr scrap_ptr /* ditto */ |
| 4459 | @d max_sorts max_scraps /* ditto */ | 4446 | @d max_sorts max_scraps /* ditto */ |
| 4460 | 4447 | ||
| 4461 | @<Global...@>= | 4448 | @<Private...@>= |
| 4462 | eight_bits cur_depth; /* depth of current buckets */ | 4449 | static eight_bits cur_depth; /* depth of current buckets */ |
| 4463 | char *cur_byte; /* index into |byte_mem| */ | 4450 | static char *cur_byte; /* index into |byte_mem| */ |
| 4464 | sixteen_bits cur_val; /* current cross-reference number */ | 4451 | static sixteen_bits cur_val; /* current cross-reference number */ |
| 4465 | sort_pointer max_sort_ptr; /* largest value of |sort_ptr| */ | 4452 | static sort_pointer max_sort_ptr; /* largest value of |sort_ptr| */ |
| 4466 | 4453 | ||
| 4467 | @ @<Set init...@>= | 4454 | @ @<Set init...@>= |
| 4468 | max_sort_ptr=scrap_info; | 4455 | max_sort_ptr=scrap_info; |
| @@ -4470,8 +4457,8 @@ max_sort_ptr=scrap_info; · 1 unmodified line | |||
| 4470 | @ The desired alphabetic order is specified by the |collate| array; namely, | 4457 | @ The desired alphabetic order is specified by the |collate| array; namely, |
| 4471 | $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. | 4458 | $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$. |
| 4472 | 4459 | ||
| 4473 | @<Global...@>= | 4460 | @<Private...@>= |
| 4474 | eight_bits collate[101+128]; /* collation order */ | 4461 | static eight_bits collate[101+128]; /* collation order */ |
| 4475 | @^high-bit character handling@> | 4462 | @^high-bit character handling@> |
| 4476 | 4463 | ||
| 4477 | @ We use the order $\hbox{null}<\.\ <\hbox{other characters}<{}$\.\_${}< | 4464 | @ We use the order $\hbox{null}<\.\ <\hbox{other characters}<{}$\.\_${}< |
| @@ -4530,10 +4517,7 @@ regarded as identical. · 52 unmodified lines | |||
| 4530 | 4517 | ||
| 4531 | @d infinity 255 /* $\infty$ (approximately) */ | 4518 | @d infinity 255 /* $\infty$ (approximately) */ |
| 4532 | 4519 | ||
| 4533 | @<Predecl...@>= | 4520 | @c |
| 4534 | static void unbucket(eight_bits);@/ | ||
| 4535 | |||
| 4536 | @ @c | ||
| 4537 | static void | 4521 | static void |
| 4538 | unbucket(@t\1\1@> /* empties buckets having depth |d| */ | 4522 | unbucket(@t\1\1@> /* empties buckets having depth |d| */ |
| 4539 | eight_bits d@t\2\2@>) | 4523 | eight_bits d@t\2\2@>) |
| @@ -4551,6 +4535,8 @@ eight_bits d@t\2\2@>) · 11 unmodified lines | |||
| 4551 | } | 4535 | } |
| 4552 | } | 4536 | } |
| 4553 | 4537 | ||
| 4538 | @ @<Predecl...@>=@+static void unbucket(eight_bits); | ||
| 4539 | |||
| 4554 | @ @<Sort and output...@>= | 4540 | @ @<Sort and output...@>= |
| 4555 | sort_ptr=scrap_info; unbucket(1); | 4541 | sort_ptr=scrap_info; unbucket(1); |
| 4556 | while (sort_ptr>scrap_info) { | 4542 | while (sort_ptr>scrap_info) { |
| @@ -4635,8 +4621,8 @@ out('.'); finish_line(); · 78 unmodified lines | |||
| 4635 | @ List inversion is best thought of as popping elements off one stack and | 4621 | @ List inversion is best thought of as popping elements off one stack and |
| 4636 | pushing them onto another. In this case |cur_xref| will be the head of | 4622 | pushing them onto another. In this case |cur_xref| will be the head of |
| 4637 | the stack that we push things onto. | 4623 | the stack that we push things onto. |
| 4638 | @<Global...@>= | 4624 | @<Private...@>= |
| 4639 | xref_pointer next_xref, this_xref; | 4625 | static xref_pointer next_xref, this_xref; |
| 4640 | /* pointer variables for rearranging a list */ | 4626 | /* pointer variables for rearranging a list */ |
| 4641 | 4627 | ||
| 4642 | @ @<Invert the cross-reference list at |cur_name|, making |cur_xref| the head@>= | 4628 | @ @<Invert the cross-reference list at |cur_name|, making |cur_xref| the head@>= |
| @@ -4650,10 +4636,7 @@ do { · 7 unmodified lines | |||
| 4650 | prints them. | 4636 | prints them. |
| 4651 | @^recursion@> | 4637 | @^recursion@> |
| 4652 | 4638 | ||
| 4653 | @<Predecl...@>= | 4639 | @c |
| 4654 | static void section_print(name_pointer);@/ | ||
| 4655 | |||
| 4656 | @ @c | ||
| 4657 | static void | 4640 | static void |
| 4658 | section_print(@t\1\1@> /* print all section names in subtree |p| */ | 4641 | section_print(@t\1\1@> /* print all section names in subtree |p| */ |
| 4659 | name_pointer p@t\2\2@>) | 4642 | name_pointer p@t\2\2@>) |
| @@ -4670,6 +4653,8 @@ name_pointer p@t\2\2@>) · 10 unmodified lines | |||
| 4670 | } | 4653 | } |
| 4671 | } | 4654 | } |
| 4672 | 4655 | ||
| 4656 | @ @<Predecl...@>=@+static void section_print(name_pointer); | ||
| 4657 | |||
| 4673 | @ @<Output all the section names@>=section_print(root); | 4658 | @ @<Output all the section names@>=section_print(root); |
| 4674 | 4659 | ||
| 4675 | @ Because on some systems the difference between two pointers is a |ptrdiff_t| | 4660 | @ Because on some systems the difference between two pointers is a |ptrdiff_t| |
| @@ -1,7 +1,7 @@ | |||
| 1 | % standard macros for CWEB listings (in addition to plain.tex) | 1 | % standard macros for CWEB listings (in addition to plain.tex) |
| 2 | % Version 4.1 --- February 2021 | 2 | % Version 4.2 --- February 2021 |
| 3 | \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros | 3 | \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros |
| 4 | \xdef\fmtversion{\fmtversion+CWEB4.1} | 4 | \xdef\fmtversion{\fmtversion+CWEB4.2} |
| 5 | \chardef\cwebversion=4 \chardef\cwebrevision=1 | 5 | \chardef\cwebversion=4 \chardef\cwebrevision=1 |
| 6 | \newif\ifpdf | 6 | \newif\ifpdf |
| 7 | \ifx\pdf+\pdftrue\fi | 7 | \ifx\pdf+\pdftrue\fi |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | \def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill} | 37 | \def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill} |
| 38 | \def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno} | 38 | \def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno} |
| 39 | \def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.1)} | 39 | \def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.2)} |
| 40 | 40 | ||
| 41 | % This verbatim mode assumes that ! marks are !! in the text being copied. | 41 | % This verbatim mode assumes that ! marks are !! in the text being copied. |
| 42 | \def\verbatim{\begingroup | 42 | \def\verbatim{\begingroup |
| @@ -50,7 +50,7 @@ · 7 unmodified lines | |||
| 50 | \null\vfill | 50 | \null\vfill |
| 51 | \centerline{\titlefont The {\ttitlefont CWEB} System of | 51 | \centerline{\titlefont The {\ttitlefont CWEB} System of |
| 52 | Structured Documentation} | 52 | Structured Documentation} |
| 53 | \vskip 18pt\centerline{(Version 4.1 --- February 2021)} | 53 | \vskip 18pt\centerline{(Version 4.2 --- February 2021)} |
| 54 | \vskip 24pt | 54 | \vskip 24pt |
| 55 | \centerline{\authorfont Donald E. Knuth and Silvio Levy} | 55 | \centerline{\authorfont Donald E. Knuth and Silvio Levy} |
| 56 | \vfill | 56 | \vfill |
| @@ -398,15 +398,15 @@ $$\hbox{ If \\{pa} is declared as `\&{int} ${}{*}\\{pa}$', · 341 unmodified lines | |||
| 398 | the assignment $\\{pa}\K{\AND}\|a[\T{0}]$ makes \\{pa} | 398 | the assignment $\\{pa}\K{\AND}\|a[\T{0}]$ makes \\{pa} |
| 399 | point to the zeroth element of \|a.}$$ | 399 | point to the zeroth element of \|a.}$$ |
| 400 | The \TEX/ text would look like this in your \.{CWEB} file: | 400 | The \TEX/ text would look like this in your \.{CWEB} file: |
| 401 | $$\lpile{\.{If |pa| is declared as `|int *pa|', the}\cr | 401 | $$\lpile{\.{If |pa| is declared as `|int *pa|', the assignment}\cr |
| 402 | \.{assignment |pa=\&a[0]| makes |pa| point | 402 | \.{|pa=\&a[0]| makes |pa| point to the zeroth element of |a|.}\cr}$$ |
| 403 | to the zeroth element of |a|.}\cr}$$ | 403 | And \.{CWEAVE} translates this into something |
| 404 | And \.{CWEAVE} translates this into something you are glad you didn't have | 404 | you are glad you didn't have to type: |
| 405 | to type: | 405 | $$\lpile{\.{If \\PB\{\\\\\{pa\}\} is declared as `\\PB\{\\\&\{int\} |
| 406 | $$\lpile{\.{If \\\\\{pa\} is declared as | 406 | \$\{\}\{*\}\\\\\{pa\}\$\}', the}\cr |
| 407 | `\\\&\{int\} \$\{\}\{*\}\\\\\{pa\}\$',}\cr | 407 | \.{assignment \\PB\{\$\\\\\{pa\}\\K\{\\AND\}\\|a[\\T\{0\}]\$\} |
| 408 | \.{the assignment \$\\\\\{pa\}\\K\{\\AND\}\\|a[\\T\{0\}]\$}\cr | 408 | makes \\PB\{\\\\\{pa\}\} point}\cr |
| 409 | \.{makes \\\\\{pa\} point to the zeroth element of \\|a.}\cr}$$ | 409 | \.{to the zeroth element of \\PB\{\\|a\}.}\cr}$$ |
| 410 | Incidentally, the cross-reference index that \.{CWEAVE} would make, in | 410 | Incidentally, the cross-reference index that \.{CWEAVE} would make, in |
| 411 | the presence of a comment like this, would include | 411 | the presence of a comment like this, would include |
| 412 | the current section number as one of the index entries for \\{pa}, | 412 | the current section number as one of the index entries for \\{pa}, |
| @@ -1011,7 +1011,7 @@ part of a \.{struct}, even though \CEE/ does allow this. · 598 unmodified lines | |||
| 1011 | 1011 | ||
| 1012 | \section Running the programs. | 1012 | \section Running the programs. |
| 1013 | The \UNIX/ command line for \.{CTANGLE} is | 1013 | The \UNIX/ command line for \.{CTANGLE} is |
| 1014 | $$\.{ctangle [options] web\_file[.w] [\{change\_file[.ch]|-\} [out\_file]]}$$ | 1014 | $$\.{ctangle [options] webfile[.w] [\{changefile[.ch]|-\} [outfile[.c]]]}$$ |
| 1015 | and the same conventions apply to \.{CWEAVE}. If `\.-' or no change file is | 1015 | and the same conventions apply to \.{CWEAVE}. If `\.-' or no change file is |
| 1016 | specified, the change file is null. The extensions \.{.w} and \.{.ch} | 1016 | specified, the change file is null. The extensions \.{.w} and \.{.ch} |
| 1017 | are appended only if the given file names contain no dot. If the | 1017 | are appended only if the given file names contain no dot. If the |
| @@ -1042,7 +1042,7 @@ by default.) · 24 unmodified lines | |||
| 1042 | 1042 | ||
| 1043 | \option e Enclose \CEE/ material formatted by \.{CWEAVE} in | 1043 | \option e Enclose \CEE/ material formatted by \.{CWEAVE} in |
| 1044 | brackets \.{\\PB\{...\}}, so that special hooks can be used. | 1044 | brackets \.{\\PB\{...\}}, so that special hooks can be used. |
| 1045 | (Off by default; has no effect on \.{CTANGLE}.) | 1045 | (On by default; has no effect on \.{CTANGLE}.) |
| 1046 | 1046 | ||
| 1047 | \option f Force line breaks after each \CEE/ statement formatted | 1047 | \option f Force line breaks after each \CEE/ statement formatted |
| 1048 | by \.{CWEAVE}. (On by default; \.{-f} saves paper but looks less \CEE/-like | 1048 | by \.{CWEAVE}. (On by default; \.{-f} saves paper but looks less \CEE/-like |
| @@ -1336,7 +1336,7 @@ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); · 287 unmodified lines | |||
| 1336 | \def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}} | 1336 | \def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CWEAVE}} |
| 1337 | 1337 | ||
| 1338 | Here is the corresponding excerpt from \.{common.tex}. | 1338 | Here is the corresponding excerpt from \.{common.tex}. |
| 1339 | (Code for section 31 omitted for space reasons.) | 1339 | (Code for section 31 is omitted for space reasons.) |
| 1340 | 1340 | ||
| 1341 | \vskip6pt | 1341 | \vskip6pt |
| 1342 | \begingroup \def\tt{\eighttt} \baselineskip9pt | 1342 | \begingroup \def\tt{\eighttt} \baselineskip9pt |
| @@ -1591,7 +1591,7 @@ $$\lpile{\.{\\def\\topofcontents\{\\null\\vfill}\cr · 248 unmodified lines | |||
| 1591 | \.{ { }\\titlefalse \% include headline on the contents page}\cr | 1591 | \.{ { }\\titlefalse \% include headline on the contents page}\cr |
| 1592 | \.{ { }\\def\\rheader\{\\mainfont The \{\\tt CWEAVE\}{ }processor\\hfil\}}\cr | 1592 | \.{ { }\\def\\rheader\{\\mainfont The \{\\tt CWEAVE\}{ }processor\\hfil\}}\cr |
| 1593 | \.{ { }\\centerline\{\\titlefont The \{\\ttitlefont CWEAVE\}{ }processor\}}\cr | 1593 | \.{ { }\\centerline\{\\titlefont The \{\\ttitlefont CWEAVE\}{ }processor\}}\cr |
| 1594 | \.{ { }\\vskip 15pt \\centerline\{(Version 4.1)\}{ }\\vfill\}}\cr}$$ | 1594 | \.{ { }\\vskip 15pt \\centerline\{(Version 4.2)\}{ }\\vfill\}}\cr}$$ |
| 1595 | Redefining \.{\\rheader}, which is the headline for right-hand pages, | 1595 | Redefining \.{\\rheader}, which is the headline for right-hand pages, |
| 1596 | suffices in this case to put the desired information at the top of the | 1596 | suffices in this case to put the desired information at the top of the |
| 1597 | contents page. | 1597 | contents page. |