Showing the changes to common.c (1 of 16 files). Show all
Unified · Split
| @@ -7,12 +7,12 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <ctype.h> |
| 8 | 8 | |
| 9 | 9 | /*:5*//*8:*/ |
| 10 | −#line 163 "common.w" | |
| 10 | +#line 164 "common.w" | |
| 11 | 11 | |
| 12 | 12 | #include <stdio.h> |
| 13 | 13 | |
| 14 | 14 | /*:8*//*22:*/ |
| 15 | −#line 468 "common.w" | |
| 15 | +#line 469 "common.w" | |
| 16 | 16 | |
| 17 | 17 | #include <stdlib.h> |
| 18 | 18 | |
| @@ -39,9 +39,10 @@ · 20 unmodified lines | ||
| 39 | 39 | #define minus_gt_ast 027 \ |
| 40 | 40 | |
| 41 | 41 | #define buf_size 100 |
| 42 | −#define long_buf_size 500 | |
| 43 | −#define xisspace(c)(isspace(c)&&((unsigned char)c<0200)) | |
| 44 | −#define xisupper(c)(isupper(c)&&((unsigned char)c<0200)) \ | |
| 42 | +#define longest_name 1000 | |
| 43 | +#define long_buf_size (buf_size+longest_name) | |
| 44 | +#define xisspace(c) (isspace(c) &&((unsigned char) c<0200) ) | |
| 45 | +#define xisupper(c) (isupper(c) &&((unsigned char) c<0200) ) \ | |
| 45 | 46 | |
| 46 | 47 | #define max_include_depth 10 \ |
| 47 | 48 | |
| @@ -53,27 +54,27 @@ · 5 unmodified lines | ||
| 53 | 54 | #define web_file_name file_name[0] \ |
| 54 | 55 | |
| 55 | 56 | #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \ |
| 56 | −strncmp(buffer,change_buffer,limit-buffer)) \ | |
| 57 | +strncmp(buffer,change_buffer,limit-buffer) ) \ | |
| 57 | 58 | |
| 58 | −#define if_section_start_make_pending(b){*limit= '!'; \ | |
| 59 | −for(loc= buffer;xisspace(*loc);loc++); \ | |
| 59 | +#define if_section_start_make_pending(b) {*limit= '!'; \ | |
| 60 | +for(loc= buffer;xisspace(*loc) ;loc++) ; \ | |
| 60 | 61 | *limit= ' '; \ |
| 61 | −if(*loc=='@'&&(xisspace(*(loc+1))||*(loc+1)=='*'))change_pending= b; \ | |
| 62 | +if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \ | |
| 62 | 63 | } \ |
| 63 | 64 | |
| 64 | 65 | #define max_sections 2000 \ |
| 65 | 66 | \ |
| 66 | 67 | |
| 67 | −#define too_long(){include_depth--; \ | |
| 68 | −err_print("! Include file name too long");goto restart;} \ | |
| 68 | +#define too_long() {include_depth--; \ | |
| 69 | +err_print("! Include file name too long") ;goto restart;} \ | |
| 69 | 70 | |
| 70 | 71 | #define max_bytes 90000 \ |
| 71 | 72 | |
| 72 | 73 | #define max_names 4000 \ |
| 73 | 74 | \ |
| 74 | 75 | |
| 75 | −#define length(c)(c+1)->byte_start-(c)->byte_start | |
| 76 | −#define print_id(c)term_write((c)->byte_start,length((c))) \ | |
| 76 | +#define length(c) (c+1) ->byte_start-(c) ->byte_start | |
| 77 | +#define print_id(c) term_write((c) ->byte_start,length((c) ) ) \ | |
| 77 | 78 | |
| 78 | 79 | #define hash_size 353 \ |
| 79 | 80 | |
| @@ -82,11 +83,11 @@ err_print("! Include file name too long");goto restart;} \ · 2 unmodified lines | ||
| 82 | 83 | #define root name_dir->rlink \ |
| 83 | 84 | \ |
| 84 | 85 | |
| 85 | −#define first_chunk(p)((p)->byte_start+2) | |
| 86 | −#define prefix_length(p)(int)((unsigned char)*((p)->byte_start)*256+ \ | |
| 87 | −(unsigned char)*((p)->byte_start+1)) | |
| 88 | −#define set_prefix_length(p,m)(*((p)->byte_start)= (m)/256, \ | |
| 89 | −*((p)->byte_start+1)= (m)%256) \ | |
| 86 | +#define first_chunk(p) ((p) ->byte_start+2) | |
| 87 | +#define prefix_length(p) (int) ((unsigned char) *((p) ->byte_start) *256+ \ | |
| 88 | +(unsigned char) *((p) ->byte_start+1) ) | |
| 89 | +#define set_prefix_length(p,m) (*((p) ->byte_start) = (m) /256, \ | |
| 90 | +*((p) ->byte_start+1) = (m) %256) \ | |
| 90 | 91 | |
| 91 | 92 | #define less 0 |
| 92 | 93 | #define equal 1 |
| @@ -100,10 +101,10 @@ err_print("! Include file name too long");goto restart;} \ · 7 unmodified lines | ||
| 100 | 101 | #define harmless_message 1 |
| 101 | 102 | #define error_message 2 |
| 102 | 103 | #define fatal_message 3 |
| 103 | −#define mark_harmless {if(history==spotless)history= harmless_message;} | |
| 104 | +#define mark_harmless {if(history==spotless) history= harmless_message;} | |
| 104 | 105 | #define mark_error history= error_message \ |
| 105 | 106 | |
| 106 | −#define confusion(s)fatal("! This can't happen: ",s) \ | |
| 107 | +#define confusion(s) fatal("! This can't happen: ",s) \ | |
| 107 | 108 | \ |
| 108 | 109 | |
| 109 | 110 | #define show_banner flags['b'] |
| @@ -111,13 +112,13 @@ err_print("! Include file name too long");goto restart;} \ · 1 unmodified line | ||
| 111 | 112 | #define show_stats flags['s'] |
| 112 | 113 | #define show_happiness flags['h'] \ |
| 113 | 114 | |
| 114 | −#define update_terminal fflush(stdout) \ | |
| 115 | +#define update_terminal fflush(stdout) \ | |
| 115 | 116 | |
| 116 | −#define new_line putchar('\n') | |
| 117 | +#define new_line putchar('\n') | |
| 117 | 118 | #define putxchar putchar |
| 118 | −#define term_write(a,b)fflush(stdout),fwrite(a,sizeof(char),b,stdout) | |
| 119 | −#define C_printf(c,a)fprintf(C_file,c,a) | |
| 120 | −#define C_putc(c)putc(c,C_file) \ | |
| 119 | +#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) | |
| 120 | +#define C_printf(c,a) fprintf(C_file,c,a) | |
| 121 | +#define C_putc(c) putc(c,C_file) \ | |
| 121 | 122 | |
| 122 | 123 | |
| 123 | 124 | #line 59 "common.w" |
| @@ -129,7 +130,7 @@ typedef short boolean; · 5 unmodified lines | ||
| 129 | 130 | boolean program; |
| 130 | 131 | |
| 131 | 132 | /*:2*//*7:*/ |
| 132 | −#line 157 "common.w" | |
| 133 | +#line 158 "common.w" | |
| 133 | 134 | |
| 134 | 135 | char buffer[long_buf_size]; |
| 135 | 136 | char*buffer_end= buffer+buf_size-2; |
| @@ -137,7 +138,7 @@ char*limit= buffer; · 1 unmodified line | ||
| 137 | 138 | char*loc= buffer; |
| 138 | 139 | |
| 139 | 140 | /*:7*//*10:*/ |
| 140 | −#line 212 "common.w" | |
| 141 | +#line 213 "common.w" | |
| 141 | 142 | |
| 142 | 143 | int include_depth; |
| 143 | 144 | FILE*file[max_include_depth]; |
| @@ -154,7 +155,7 @@ boolean changing; · 10 unmodified lines | ||
| 154 | 155 | boolean web_file_open= 0; |
| 155 | 156 | |
| 156 | 157 | /*:10*//*20:*/ |
| 157 | −#line 416 "common.w" | |
| 158 | +#line 417 "common.w" | |
| 158 | 159 | |
| 159 | 160 | typedef unsigned short sixteen_bits; |
| 160 | 161 | sixteen_bits section_count; |
| @@ -164,17 +165,17 @@ boolean change_pending; · 3 unmodified lines | ||
| 164 | 165 | boolean print_where= 0; |
| 165 | 166 | |
| 166 | 167 | /*:20*//*27:*/ |
| 167 | −#line 586 "common.w" | |
| 168 | +#line 587 "common.w" | |
| 168 | 169 | |
| 169 | 170 | typedef struct name_info{ |
| 170 | 171 | char*byte_start; |
| 171 | 172 | /*31:*/ |
| 172 | −#line 623 "common.w" | |
| 173 | +#line 624 "common.w" | |
| 173 | 174 | |
| 174 | 175 | struct name_info*link; |
| 175 | 176 | |
| 176 | 177 | /*:31*//*40:*/ |
| 177 | −#line 722 "common.w" | |
| 178 | +#line 723 "common.w" | |
| 178 | 179 | |
| 179 | 180 | union{ |
| 180 | 181 | struct name_info*Rlink; |
| @@ -183,12 +184,12 @@ char Ilk; · 2 unmodified lines | ||
| 183 | 184 | }dummy; |
| 184 | 185 | |
| 185 | 186 | /*:40*//*55:*/ |
| 186 | −#line 1054 "common.w" | |
| 187 | +#line 1055 "common.w" | |
| 187 | 188 | |
| 188 | 189 | char*equiv_or_xref; |
| 189 | 190 | |
| 190 | 191 | /*:55*/ |
| 191 | −#line 589 "common.w" | |
| 192 | +#line 590 "common.w" | |
| 192 | 193 | |
| 193 | 194 | }name_info; |
| 194 | 195 | typedef name_info*name_pointer; |
| @@ -198,13 +199,13 @@ name_info name_dir[max_names]; · 3 unmodified lines | ||
| 198 | 199 | name_pointer name_dir_end= name_dir+max_names-1; |
| 199 | 200 | |
| 200 | 201 | /*:27*//*29:*/ |
| 201 | −#line 609 "common.w" | |
| 202 | +#line 610 "common.w" | |
| 202 | 203 | |
| 203 | 204 | name_pointer name_ptr; |
| 204 | 205 | char*byte_ptr; |
| 205 | 206 | |
| 206 | 207 | /*:29*//*32:*/ |
| 207 | −#line 636 "common.w" | |
| 208 | +#line 637 "common.w" | |
| 208 | 209 | |
| 209 | 210 | typedef name_pointer*hash_pointer; |
| 210 | 211 | name_pointer hash[hash_size]; |
| @@ -212,12 +213,12 @@ hash_pointer hash_end= hash+hash_size-1; · 1 unmodified line | ||
| 212 | 213 | hash_pointer h; |
| 213 | 214 | |
| 214 | 215 | /*:32*//*56:*/ |
| 215 | −#line 1074 "common.w" | |
| 216 | +#line 1075 "common.w" | |
| 216 | 217 | |
| 217 | 218 | int history= spotless; |
| 218 | 219 | |
| 219 | 220 | /*:56*//*67:*/ |
| 220 | −#line 1212 "common.w" | |
| 221 | +#line 1213 "common.w" | |
| 221 | 222 | |
| 222 | 223 | int argc; |
| 223 | 224 | char**argv; |
| @@ -228,7 +229,7 @@ char scn_file_name[max_file_name_length]; · 4 unmodified lines | ||
| 228 | 229 | boolean flags[128]; |
| 229 | 230 | |
| 230 | 231 | /*:67*//*77:*/ |
| 231 | −#line 1366 "common.w" | |
| 232 | +#line 1367 "common.w" | |
| 232 | 233 | |
| 233 | 234 | FILE*C_file; |
| 234 | 235 | FILE*tex_file; |
| @@ -244,7 +245,7 @@ FILE*active_file; · 9 unmodified lines | ||
| 244 | 245 | int phase; |
| 245 | 246 | |
| 246 | 247 | /*:3*//*11:*/ |
| 247 | −#line 238 "common.w" | |
| 248 | +#line 239 "common.w" | |
| 248 | 249 | |
| 249 | 250 | char change_buffer[buf_size]; |
| 250 | 251 | char*change_limit; |
| @@ -253,48 +254,48 @@ char*change_limit; · 2 unmodified lines | ||
| 253 | 254 | #line 61 "common.w" |
| 254 | 255 | |
| 255 | 256 | /*33:*/ |
| 256 | −#line 642 "common.w" | |
| 257 | +#line 643 "common.w" | |
| 257 | 258 | |
| 258 | 259 | extern int names_match(); |
| 259 | 260 | |
| 260 | 261 | /*:33*//*38:*/ |
| 261 | −#line 695 "common.w" | |
| 262 | +#line 696 "common.w" | |
| 262 | 263 | |
| 263 | 264 | void init_p(); |
| 264 | 265 | |
| 265 | 266 | /*:38*//*46:*/ |
| 266 | −#line 844 "common.w" | |
| 267 | +#line 845 "common.w" | |
| 267 | 268 | |
| 268 | 269 | extern void init_node(); |
| 269 | 270 | |
| 270 | 271 | /*:46*//*53:*/ |
| 271 | −#line 1009 "common.w" | |
| 272 | +#line 1010 "common.w" | |
| 272 | 273 | |
| 273 | 274 | int section_name_cmp(); |
| 274 | 275 | |
| 275 | 276 | /*:53*//*57:*/ |
| 276 | −#line 1084 "common.w" | |
| 277 | +#line 1085 "common.w" | |
| 277 | 278 | |
| 278 | 279 | void err_print(); |
| 279 | 280 | |
| 280 | 281 | /*:57*//*60:*/ |
| 281 | −#line 1132 "common.w" | |
| 282 | +#line 1133 "common.w" | |
| 282 | 283 | |
| 283 | 284 | int wrap_up(); |
| 284 | 285 | extern void print_stats(); |
| 285 | 286 | |
| 286 | 287 | /*:60*//*63:*/ |
| 287 | −#line 1165 "common.w" | |
| 288 | +#line 1166 "common.w" | |
| 288 | 289 | |
| 289 | 290 | void fatal(),overflow(); |
| 290 | 291 | |
| 291 | 292 | /*:63*//*69:*/ |
| 292 | −#line 1243 "common.w" | |
| 293 | +#line 1244 "common.w" | |
| 293 | 294 | |
| 294 | 295 | void scan_args(); |
| 295 | 296 | |
| 296 | 297 | /*:69*//*81:*/ |
| 297 | −#line 1407 "common.w" | |
| 298 | +#line 1408 "common.w" | |
| 298 | 299 | |
| 299 | 300 | extern int strlen(); |
| 300 | 301 | extern int strcmp(); |
| @@ -313,19 +314,19 @@ void · 12 unmodified lines | ||
| 313 | 314 | common_init() |
| 314 | 315 | { |
| 315 | 316 | /*30:*/ |
| 316 | −#line 613 "common.w" | |
| 317 | +#line 614 "common.w" | |
| 317 | 318 | |
| 318 | 319 | name_dir->byte_start= byte_ptr= byte_mem; |
| 319 | 320 | name_ptr= name_dir+1; |
| 320 | 321 | name_ptr->byte_start= byte_mem; |
| 321 | 322 | |
| 322 | 323 | /*:30*//*34:*/ |
| 323 | −#line 647 "common.w" | |
| 324 | +#line 648 "common.w" | |
| 324 | 325 | |
| 325 | 326 | for(h= hash;h<=hash_end;*h++= NULL); |
| 326 | 327 | |
| 327 | 328 | /*:34*//*41:*/ |
| 328 | −#line 729 "common.w" | |
| 329 | +#line 730 "common.w" | |
| 329 | 330 | |
| 330 | 331 | root= NULL; |
| 331 | 332 | |
| @@ -333,7 +334,7 @@ root= NULL; · 1 unmodified line | ||
| 333 | 334 | #line 92 "common.w" |
| 334 | 335 | ; |
| 335 | 336 | /*68:*/ |
| 336 | −#line 1225 "common.w" | |
| 337 | +#line 1226 "common.w" | |
| 337 | 338 | |
| 338 | 339 | show_banner= show_happiness= show_progress= 1; |
| 339 | 340 | |
| @@ -341,7 +342,7 @@ show_banner= show_happiness= show_progress= 1; · 1 unmodified line | ||
| 341 | 342 | #line 93 "common.w" |
| 342 | 343 | ; |
| 343 | 344 | /*78:*/ |
| 344 | −#line 1373 "common.w" | |
| 345 | +#line 1374 "common.w" | |
| 345 | 346 | |
| 346 | 347 | scan_args(); |
| 347 | 348 | if(program==ctangle){ |
| @@ -360,7 +361,7 @@ fatal("! Cannot open output file ",tex_file_name); · 12 unmodified lines | ||
| 360 | 361 | } |
| 361 | 362 | |
| 362 | 363 | /*:4*//*9:*/ |
| 363 | −#line 170 "common.w" | |
| 364 | +#line 171 "common.w" | |
| 364 | 365 | |
| 365 | 366 | int input_ln(fp) |
| 366 | 367 | FILE*fp; |
| @@ -382,14 +383,14 @@ return(1); · 15 unmodified lines | ||
| 382 | 383 | } |
| 383 | 384 | |
| 384 | 385 | /*:9*//*12:*/ |
| 385 | −#line 249 "common.w" | |
| 386 | +#line 250 "common.w" | |
| 386 | 387 | |
| 387 | 388 | void |
| 388 | 389 | prime_the_change_buffer() |
| 389 | 390 | { |
| 390 | 391 | change_limit= change_buffer; |
| 391 | 392 | /*13:*/ |
| 392 | −#line 263 "common.w" | |
| 393 | +#line 264 "common.w" | |
| 393 | 394 | |
| 394 | 395 | while(1){ |
| 395 | 396 | change_line++; |
| @@ -406,10 +407,10 @@ err_print("! Missing @x in change file"); · 10 unmodified lines | ||
| 406 | 407 | } |
| 407 | 408 | |
| 408 | 409 | /*:13*/ |
| 409 | −#line 254 "common.w" | |
| 410 | +#line 255 "common.w" | |
| 410 | 411 | ; |
| 411 | 412 | /*14:*/ |
| 412 | −#line 280 "common.w" | |
| 413 | +#line 281 "common.w" | |
| 413 | 414 | |
| 414 | 415 | do{ |
| 415 | 416 | change_line++; |
| @@ -421,10 +422,10 @@ return; · 5 unmodified lines | ||
| 421 | 422 | }while(limit==buffer); |
| 422 | 423 | |
| 423 | 424 | /*:14*/ |
| 424 | −#line 255 "common.w" | |
| 425 | +#line 256 "common.w" | |
| 425 | 426 | ; |
| 426 | 427 | /*15:*/ |
| 427 | −#line 290 "common.w" | |
| 428 | +#line 291 "common.w" | |
| 428 | 429 | |
| 429 | 430 | { |
| 430 | 431 | change_limit= change_buffer-buffer+limit; |
| @@ -432,12 +433,12 @@ strncpy(change_buffer,buffer,limit-buffer+1); · 1 unmodified line | ||
| 432 | 433 | } |
| 433 | 434 | |
| 434 | 435 | /*:15*/ |
| 435 | −#line 256 "common.w" | |
| 436 | +#line 257 "common.w" | |
| 436 | 437 | ; |
| 437 | 438 | } |
| 438 | 439 | |
| 439 | 440 | /*:12*//*16:*/ |
| 440 | −#line 318 "common.w" | |
| 441 | +#line 319 "common.w" | |
| 441 | 442 | |
| 442 | 443 | void |
| 443 | 444 | check_change() |
| @@ -460,7 +461,7 @@ return; · 16 unmodified lines | ||
| 460 | 461 | if(limit>buffer+1&&buffer[0]=='@'){ |
| 461 | 462 | if(xisupper(buffer[1]))buffer[1]= tolower(buffer[1]); |
| 462 | 463 | /*17:*/ |
| 463 | −#line 356 "common.w" | |
| 464 | +#line 357 "common.w" | |
| 464 | 465 | |
| 465 | 466 | if(buffer[1]=='x'||buffer[1]=='z'){ |
| 466 | 467 | loc= buffer+2;err_print("! Where is the matching @y?"); |
| @@ -478,11 +479,11 @@ return; · 11 unmodified lines | ||
| 478 | 479 | } |
| 479 | 480 | |
| 480 | 481 | /*:17*/ |
| 481 | −#line 340 "common.w" | |
| 482 | +#line 341 "common.w" | |
| 482 | 483 | ; |
| 483 | 484 | } |
| 484 | 485 | /*15:*/ |
| 485 | −#line 290 "common.w" | |
| 486 | +#line 291 "common.w" | |
| 486 | 487 | |
| 487 | 488 | { |
| 488 | 489 | change_limit= change_buffer-buffer+limit; |
| @@ -490,7 +491,7 @@ strncpy(change_buffer,buffer,limit-buffer+1); · 1 unmodified line | ||
| 490 | 491 | } |
| 491 | 492 | |
| 492 | 493 | /*:15*/ |
| 493 | −#line 342 "common.w" | |
| 494 | +#line 343 "common.w" | |
| 494 | 495 | ; |
| 495 | 496 | changing= 0;cur_line++; |
| 496 | 497 | while(!input_ln(cur_file)){ |
| @@ -506,14 +507,14 @@ if(lines_dont_match)n++; · 9 unmodified lines | ||
| 506 | 507 | } |
| 507 | 508 | |
| 508 | 509 | /*:16*//*18:*/ |
| 509 | −#line 376 "common.w" | |
| 510 | +#line 377 "common.w" | |
| 510 | 511 | |
| 511 | 512 | void |
| 512 | 513 | reset_input() |
| 513 | 514 | { |
| 514 | 515 | limit= buffer;loc= buffer+1;buffer[0]= ' '; |
| 515 | 516 | /*19:*/ |
| 516 | −#line 391 "common.w" | |
| 517 | +#line 392 "common.w" | |
| 517 | 518 | |
| 518 | 519 | if((web_file= fopen(web_file_name,"r"))==NULL){ |
| 519 | 520 | strcpy(web_file_name,alt_web_file_name); |
| @@ -527,7 +528,7 @@ if((change_file= fopen(change_file_name,"r"))==NULL) · 7 unmodified lines | ||
| 527 | 528 | fatal("! Cannot open change file ",change_file_name); |
| 528 | 529 | |
| 529 | 530 | /*:19*/ |
| 530 | −#line 381 "common.w" | |
| 531 | +#line 382 "common.w" | |
| 531 | 532 | ; |
| 532 | 533 | include_depth= 0;cur_line= 0;change_line= 0; |
| 533 | 534 | change_depth= include_depth; |
| @@ -536,14 +537,14 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0; · 2 unmodified lines | ||
| 536 | 537 | } |
| 537 | 538 | |
| 538 | 539 | /*:18*//*21:*/ |
| 539 | −#line 424 "common.w" | |
| 540 | +#line 425 "common.w" | |
| 540 | 541 | |
| 541 | 542 | int get_line() |
| 542 | 543 | { |
| 543 | 544 | restart: |
| 544 | 545 | if(changing&&include_depth==change_depth) |
| 545 | 546 | /*25:*/ |
| 546 | −#line 529 "common.w" | |
| 547 | +#line 530 "common.w" | |
| 547 | 548 | { |
| 548 | 549 | change_line++; |
| 549 | 550 | if(!input_ln(change_file)){ |
| @@ -574,11 +575,11 @@ prime_the_change_buffer();changing= !changing;print_where= 1; · 24 unmodified lines | ||
| 574 | 575 | } |
| 575 | 576 | |
| 576 | 577 | /*:25*/ |
| 577 | −#line 429 "common.w" | |
| 578 | +#line 430 "common.w" | |
| 578 | 579 | ; |
| 579 | 580 | if(!changing||include_depth>change_depth){ |
| 580 | 581 | /*24:*/ |
| 581 | −#line 512 "common.w" | |
| 582 | +#line 513 "common.w" | |
| 582 | 583 | { |
| 583 | 584 | cur_line++; |
| 584 | 585 | while(!input_ln(cur_file)){ |
| @@ -597,7 +598,7 @@ if(change_limit>change_buffer)check_change(); · 12 unmodified lines | ||
| 597 | 598 | } |
| 598 | 599 | |
| 599 | 600 | /*:24*/ |
| 600 | −#line 431 "common.w" | |
| 601 | +#line 432 "common.w" | |
| 601 | 602 | ; |
| 602 | 603 | if(changing&&include_depth==change_depth)goto restart; |
| 603 | 604 | } |
| @@ -617,7 +618,7 @@ goto restart; · 13 unmodified lines | ||
| 617 | 618 | } |
| 618 | 619 | include_depth++; |
| 619 | 620 | /*23:*/ |
| 620 | −#line 471 "common.w" | |
| 621 | +#line 472 "common.w" | |
| 621 | 622 | { |
| 622 | 623 | char temp_file_name[max_file_name_length]; |
| 623 | 624 | char*cur_file_name_end= cur_file_name+max_file_name_length-1; |
| @@ -660,14 +661,14 @@ include_depth--;err_print("! Cannot open include file");goto restart; · 36 unmodified lines | ||
| 660 | 661 | } |
| 661 | 662 | |
| 662 | 663 | /*:23*/ |
| 663 | −#line 449 "common.w" | |
| 664 | +#line 450 "common.w" | |
| 664 | 665 | ; |
| 665 | 666 | } |
| 666 | 667 | return(!input_has_ended); |
| 667 | 668 | } |
| 668 | 669 | |
| 669 | 670 | /*:21*//*26:*/ |
| 670 | −#line 561 "common.w" | |
| 671 | +#line 562 "common.w" | |
| 671 | 672 | |
| 672 | 673 | void |
| 673 | 674 | check_complete(){ |
| @@ -681,7 +682,7 @@ err_print("! Change file entry did not match"); · 7 unmodified lines | ||
| 681 | 682 | } |
| 682 | 683 | |
| 683 | 684 | /*:26*//*35:*/ |
| 684 | −#line 652 "common.w" | |
| 685 | +#line 653 "common.w" | |
| 685 | 686 | |
| 686 | 687 | name_pointer |
| 687 | 688 | id_lookup(first,last,t) |
| @@ -696,17 +697,17 @@ name_pointer p; · 8 unmodified lines | ||
| 696 | 697 | if(last==NULL)for(last= first;*last!='\0';last++); |
| 697 | 698 | l= last-first; |
| 698 | 699 | /*36:*/ |
| 699 | −#line 675 "common.w" | |
| 700 | +#line 676 "common.w" | |
| 700 | 701 | |
| 701 | 702 | h= (unsigned char)*i; |
| 702 | 703 | while(++i<last)h= (h+h+(int)((unsigned char)*i))%hash_size; |
| 703 | 704 | |
| 704 | 705 | |
| 705 | 706 | /*:36*/ |
| 706 | −#line 665 "common.w" | |
| 707 | +#line 666 "common.w" | |
| 707 | 708 | ; |
| 708 | 709 | /*37:*/ |
| 709 | −#line 683 "common.w" | |
| 710 | +#line 684 "common.w" | |
| 710 | 711 | |
| 711 | 712 | p= hash[h]; |
| 712 | 713 | while(p&&!names_match(p,first,l,t))p= p->link; |
| @@ -716,10 +717,10 @@ p->link= hash[h];hash[h]= p; · 3 unmodified lines | ||
| 716 | 717 | } |
| 717 | 718 | |
| 718 | 719 | /*:37*/ |
| 719 | −#line 666 "common.w" | |
| 720 | +#line 667 "common.w" | |
| 720 | 721 | ; |
| 721 | 722 | if(p==name_ptr)/*39:*/ |
| 722 | −#line 698 "common.w" | |
| 723 | +#line 699 "common.w" | |
| 723 | 724 | { |
| 724 | 725 | if(byte_ptr+l>byte_mem_end)overflow("byte memory"); |
| 725 | 726 | if(name_ptr>=name_dir_end)overflow("name"); |
| @@ -729,13 +730,13 @@ if(program==cweave)init_p(p,t); · 3 unmodified lines | ||
| 729 | 730 | } |
| 730 | 731 | |
| 731 | 732 | /*:39*/ |
| 732 | −#line 667 "common.w" | |
| 733 | +#line 668 "common.w" | |
| 733 | 734 | ; |
| 734 | 735 | return(p); |
| 735 | 736 | } |
| 736 | 737 | |
| 737 | 738 | /*:35*//*42:*/ |
| 738 | −#line 756 "common.w" | |
| 739 | +#line 757 "common.w" | |
| 739 | 740 | |
| 740 | 741 | void |
| 741 | 742 | print_section_name(p) |
| @@ -756,7 +757,7 @@ if(q)term_write("...",3); · 14 unmodified lines | ||
| 756 | 757 | } |
| 757 | 758 | |
| 758 | 759 | /*:42*//*43:*/ |
| 759 | −#line 775 "common.w" | |
| 760 | +#line 776 "common.w" | |
| 760 | 761 | |
| 761 | 762 | void |
| 762 | 763 | sprint_section_name(dest,p) |
| @@ -779,7 +780,7 @@ s= p->byte_start; · 16 unmodified lines | ||
| 779 | 780 | } |
| 780 | 781 | |
| 781 | 782 | /*:43*//*44:*/ |
| 782 | −#line 796 "common.w" | |
| 783 | +#line 797 "common.w" | |
| 783 | 784 | |
| 784 | 785 | void |
| 785 | 786 | print_prefix_name(p) |
| @@ -792,7 +793,7 @@ if(s+l<(p+1)->byte_start)term_write("...",3); · 6 unmodified lines | ||
| 792 | 793 | } |
| 793 | 794 | |
| 794 | 795 | /*:44*//*45:*/ |
| 795 | −#line 817 "common.w" | |
| 796 | +#line 818 "common.w" | |
| 796 | 797 | |
| 797 | 798 | int web_strcmp(j,j_len,k,k_len) |
| 798 | 799 | char*j,*k; |
| @@ -808,7 +809,7 @@ else return greater; · 9 unmodified lines | ||
| 808 | 809 | } |
| 809 | 810 | |
| 810 | 811 | /*:45*//*47:*/ |
| 811 | −#line 847 "common.w" | |
| 812 | +#line 848 "common.w" | |
| 812 | 813 | |
| 813 | 814 | name_pointer |
| 814 | 815 | add_section_name(par,c,first,last,ispref) |
| @@ -839,7 +840,7 @@ return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); · 24 unmodified lines | ||
| 839 | 840 | } |
| 840 | 841 | |
| 841 | 842 | /*:47*//*48:*/ |
| 842 | −#line 876 "common.w" | |
| 843 | +#line 877 "common.w" | |
| 843 | 844 | |
| 844 | 845 | void |
| 845 | 846 | extend_section_name(p,first,last,ispref) |
| @@ -863,7 +864,7 @@ if(ispref)*(byte_ptr-1)= ' '; · 17 unmodified lines | ||
| 863 | 864 | } |
| 864 | 865 | |
| 865 | 866 | /*:48*//*49:*/ |
| 866 | −#line 904 "common.w" | |
| 867 | +#line 905 "common.w" | |
| 867 | 868 | |
| 868 | 869 | name_pointer |
| 869 | 870 | section_lookup(first,last,ispref) |
| @@ -878,7 +879,7 @@ name_pointer par= NULL; · 8 unmodified lines | ||
| 878 | 879 | |
| 879 | 880 | int name_len= last-first+1; |
| 880 | 881 | /*50:*/ |
| 881 | −#line 928 "common.w" | |
| 882 | +#line 929 "common.w" | |
| 882 | 883 | |
| 883 | 884 | while(p){ |
| 884 | 885 | c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p)); |
| @@ -905,19 +906,19 @@ p= q,q= NULL; · 20 unmodified lines | ||
| 905 | 906 | } |
| 906 | 907 | |
| 907 | 908 | /*:50*/ |
| 908 | −#line 918 "common.w" | |
| 909 | +#line 919 "common.w" | |
| 909 | 910 | ; |
| 910 | 911 | /*51:*/ |
| 911 | −#line 953 "common.w" | |
| 912 | +#line 954 "common.w" | |
| 912 | 913 | |
| 913 | 914 | if(r==NULL) |
| 914 | 915 | return add_section_name(par,c,first,last+1,ispref); |
| 915 | 916 | |
| 916 | 917 | /*:51*/ |
| 917 | −#line 919 "common.w" | |
| 918 | +#line 920 "common.w" | |
| 918 | 919 | ; |
| 919 | 920 | /*52:*/ |
| 920 | −#line 961 "common.w" | |
| 921 | +#line 962 "common.w" | |
| 921 | 922 | |
| 922 | 923 | switch(section_name_cmp(&first,name_len,r)){ |
| 923 | 924 | |
| @@ -951,12 +952,12 @@ return r; · 27 unmodified lines | ||
| 951 | 952 | } |
| 952 | 953 | |
| 953 | 954 | /*:52*/ |
| 954 | −#line 920 "common.w" | |
| 955 | +#line 921 "common.w" | |
| 955 | 956 | ; |
| 956 | 957 | } |
| 957 | 958 | |
| 958 | 959 | /*:49*//*54:*/ |
| 959 | −#line 1012 "common.w" | |
| 960 | +#line 1013 "common.w" | |
| 960 | 961 | |
| 961 | 962 | int section_name_cmp(pfirst,len,r) |
| 962 | 963 | char**pfirst; |
| @@ -990,7 +991,7 @@ default:return c; · 27 unmodified lines | ||
| 990 | 991 | } |
| 991 | 992 | |
| 992 | 993 | /*:54*//*58:*/ |
| 993 | −#line 1087 "common.w" | |
| 994 | +#line 1088 "common.w" | |
| 994 | 995 | |
| 995 | 996 | void |
| 996 | 997 | err_print(s) |
| @@ -999,7 +1000,7 @@ char*s; · 2 unmodified lines | ||
| 999 | 1000 | char*k,*l; |
| 1000 | 1001 | printf(*s=='!'?"\n%s":"%s",s); |
| 1001 | 1002 | if(web_file_open)/*59:*/ |
| 1002 | −#line 1107 "common.w" | |
| 1003 | +#line 1108 "common.w" | |
| 1003 | 1004 | |
| 1004 | 1005 | {if(changing&&include_depth==change_depth) |
| 1005 | 1006 | printf(". (l. %d of change file)\n",change_line); |
| @@ -1019,20 +1020,20 @@ putchar(' '); · 13 unmodified lines | ||
| 1019 | 1020 | } |
| 1020 | 1021 | |
| 1021 | 1022 | /*:59*/ |
| 1022 | −#line 1094 "common.w" | |
| 1023 | +#line 1095 "common.w" | |
| 1023 | 1024 | ; |
| 1024 | 1025 | update_terminal;mark_error; |
| 1025 | 1026 | } |
| 1026 | 1027 | |
| 1027 | 1028 | /*:58*//*61:*/ |
| 1028 | −#line 1142 "common.w" | |
| 1029 | +#line 1143 "common.w" | |
| 1029 | 1030 | |
| 1030 | 1031 | int wrap_up(){ |
| 1031 | 1032 | putchar('\n'); |
| 1032 | 1033 | if(show_stats) |
| 1033 | 1034 | print_stats(); |
| 1034 | 1035 | /*62:*/ |
| 1035 | −#line 1152 "common.w" | |
| 1036 | +#line 1153 "common.w" | |
| 1036 | 1037 | |
| 1037 | 1038 | switch(history){ |
| 1038 | 1039 | case spotless:if(show_happiness)printf("(No errors were found.)\n");break; |
| @@ -1044,14 +1045,14 @@ case fatal_message:printf("(That was a fatal error, my friend.)\n"); · 5 unmodified lines | ||
| 1044 | 1045 | } |
| 1045 | 1046 | |
| 1046 | 1047 | /*:62*/ |
| 1047 | −#line 1147 "common.w" | |
| 1048 | +#line 1148 "common.w" | |
| 1048 | 1049 | ; |
| 1049 | 1050 | if(history>harmless_message)return(1); |
| 1050 | 1051 | else return(0); |
| 1051 | 1052 | } |
| 1052 | 1053 | |
| 1053 | 1054 | /*:61*//*64:*/ |
| 1054 | −#line 1171 "common.w" | |
| 1055 | +#line 1172 "common.w" | |
| 1055 | 1056 | void |
| 1056 | 1057 | fatal(s,t) |
| 1057 | 1058 | char*s,*t; |
| @@ -1062,7 +1063,7 @@ history= fatal_message;exit(wrap_up()); · 4 unmodified lines | ||
| 1062 | 1063 | } |
| 1063 | 1064 | |
| 1064 | 1065 | /*:64*//*65:*/ |
| 1065 | −#line 1182 "common.w" | |
| 1066 | +#line 1183 "common.w" | |
| 1066 | 1067 | void |
| 1067 | 1068 | overflow(t) |
| 1068 | 1069 | char*t; |
| @@ -1072,7 +1073,7 @@ printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); · 3 unmodified lines | ||
| 1072 | 1073 | |
| 1073 | 1074 | |
| 1074 | 1075 | /*:65*//*70:*/ |
| 1075 | −#line 1246 "common.w" | |
| 1076 | +#line 1247 "common.w" | |
| 1076 | 1077 | |
| 1077 | 1078 | void |
| 1078 | 1079 | scan_args() |
| @@ -1086,7 +1087,7 @@ boolean flag_change; · 7 unmodified lines | ||
| 1086 | 1087 | |
| 1087 | 1088 | while(--argc>0){ |
| 1088 | 1089 | if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/ |
| 1089 | −#line 1340 "common.w" | |
| 1090 | +#line 1341 "common.w" | |
| 1090 | 1091 | |
| 1091 | 1092 | { |
| 1092 | 1093 | if(**argv=='-')flag_change= 0; |
| @@ -1096,7 +1097,7 @@ flags[*dot_pos]= flag_change; · 3 unmodified lines | ||
| 1096 | 1097 | } |
| 1097 | 1098 | |
| 1098 | 1099 | /*:74*/ |
| 1099 | −#line 1258 "common.w" | |
| 1100 | +#line 1259 "common.w" | |
| 1100 | 1101 | |
| 1101 | 1102 | else{ |
| 1102 | 1103 | s= name_pos= *argv;dot_pos= NULL; |
| @@ -1106,17 +1107,17 @@ else if(*s=='/')dot_pos= NULL,name_pos= ++s; · 3 unmodified lines | ||
| 1106 | 1107 | else s++; |
| 1107 | 1108 | } |
| 1108 | 1109 | if(!found_web)/*71:*/ |
| 1109 | −#line 1284 "common.w" | |
| 1110 | +#line 1285 "common.w" | |
| 1110 | 1111 | |
| 1111 | 1112 | { |
| 1112 | 1113 | if(s-*argv>max_file_name_length-5) |
| 1113 | 1114 | /*76:*/ |
| 1114 | −#line 1360 "common.w" | |
| 1115 | +#line 1361 "common.w" | |
| 1115 | 1116 | fatal("! Filename too long\n",*argv); |
| 1116 | 1117 | |
| 1117 | 1118 | |
| 1118 | 1119 | /*:76*/ |
| 1119 | −#line 1287 "common.w" | |
| 1120 | +#line 1288 "common.w" | |
| 1120 | 1121 | ; |
| 1121 | 1122 | if(dot_pos==NULL) |
| 1122 | 1123 | sprintf(web_file_name,"%s.w",*argv); |
| @@ -1133,22 +1134,22 @@ found_web= 1; · 10 unmodified lines | ||
| 1133 | 1134 | } |
| 1134 | 1135 | |
| 1135 | 1136 | /*:71*/ |
| 1136 | −#line 1267 "common.w" | |
| 1137 | +#line 1268 "common.w" | |
| 1137 | 1138 | |
| 1138 | 1139 | else if(!found_change)/*72:*/ |
| 1139 | −#line 1302 "common.w" | |
| 1140 | +#line 1303 "common.w" | |
| 1140 | 1141 | |
| 1141 | 1142 | { |
| 1142 | 1143 | if(strcmp(*argv,"-")==0)found_change= -1; |
| 1143 | 1144 | else{ |
| 1144 | 1145 | if(s-*argv>max_file_name_length-4) |
| 1145 | 1146 | /*76:*/ |
| 1146 | −#line 1360 "common.w" | |
| 1147 | +#line 1361 "common.w" | |
| 1147 | 1148 | fatal("! Filename too long\n",*argv); |
| 1148 | 1149 | |
| 1149 | 1150 | |
| 1150 | 1151 | /*:76*/ |
| 1151 | −#line 1307 "common.w" | |
| 1152 | +#line 1308 "common.w" | |
| 1152 | 1153 | ; |
| 1153 | 1154 | if(dot_pos==NULL) |
| 1154 | 1155 | sprintf(change_file_name,"%s.ch",*argv); |
| @@ -1158,20 +1159,20 @@ found_change= 1; · 3 unmodified lines | ||
| 1158 | 1159 | } |
| 1159 | 1160 | |
| 1160 | 1161 | /*:72*/ |
| 1161 | −#line 1268 "common.w" | |
| 1162 | +#line 1269 "common.w" | |
| 1162 | 1163 | |
| 1163 | 1164 | else if(!found_out)/*73:*/ |
| 1164 | −#line 1315 "common.w" | |
| 1165 | +#line 1316 "common.w" | |
| 1165 | 1166 | |
| 1166 | 1167 | { |
| 1167 | 1168 | if(s-*argv>max_file_name_length-5) |
| 1168 | 1169 | /*76:*/ |
| 1169 | −#line 1360 "common.w" | |
| 1170 | +#line 1361 "common.w" | |
| 1170 | 1171 | fatal("! Filename too long\n",*argv); |
| 1171 | 1172 | |
| 1172 | 1173 | |
| 1173 | 1174 | /*:76*/ |
| 1174 | −#line 1318 "common.w" | |
| 1175 | +#line 1319 "common.w" | |
| 1175 | 1176 | ; |
| 1176 | 1177 | if(dot_pos==NULL){ |
| 1177 | 1178 | sprintf(tex_file_name,"%s.tex",*argv); |
| @@ -1195,10 +1196,10 @@ found_out= 1; · 17 unmodified lines | ||
| 1195 | 1196 | } |
| 1196 | 1197 | |
| 1197 | 1198 | /*:73*/ |
| 1198 | −#line 1269 "common.w" | |
| 1199 | +#line 1270 "common.w" | |
| 1199 | 1200 | |
| 1200 | 1201 | else/*75:*/ |
| 1201 | −#line 1348 "common.w" | |
| 1202 | +#line 1349 "common.w" | |
| 1202 | 1203 | |
| 1203 | 1204 | { |
| 1204 | 1205 | if(program==ctangle) |
| @@ -1212,12 +1213,12 @@ else fatal( · 7 unmodified lines | ||
| 1212 | 1213 | } |
| 1213 | 1214 | |
| 1214 | 1215 | /*:75*/ |
| 1215 | −#line 1270 "common.w" | |
| 1216 | +#line 1271 "common.w" | |
| 1216 | 1217 | ; |
| 1217 | 1218 | } |
| 1218 | 1219 | } |
| 1219 | 1220 | if(!found_web)/*75:*/ |
| 1220 | −#line 1348 "common.w" | |
| 1221 | +#line 1349 "common.w" | |
| 1221 | 1222 | |
| 1222 | 1223 | { |
| 1223 | 1224 | if(program==ctangle) |
| @@ -1231,7 +1232,7 @@ else fatal( · 7 unmodified lines | ||
| 1231 | 1232 | } |
| 1232 | 1233 | |
| 1233 | 1234 | /*:75*/ |
| 1234 | −#line 1273 "common.w" | |
| 1235 | +#line 1274 "common.w" | |
| 1235 | 1236 | ; |
| 1236 | 1237 | if(found_change<=0)strcpy(change_file_name,"/dev/null"); |
| 1237 | 1238 | } |