History

CWEB — Release 3.64aa, 2005-12-06.

Andreas Scherer committed 15 years ago

Commit 52dad7e1 parent c5c26712 files · +135 −135Browse files

Unified · Split

2 files
  1. ctangle.c +134 −134
  2. ctangle.w +1 −1
ctangle.c+134−134
@@ -1,19 +1,19 @@
1/*1:*/1/*1:*/
2#line 64 "ctangle.w"2#line 64 "./ctangle.w"
3 3
4/*6:*/4/*6:*/
5#line 35 "common.h"5#line 35 "./common.h"
6 6
7#include <stdio.h> 7#include <stdio.h>
8 8
9/*:6*//*62:*/9/*:6*//*62:*/
10#line 888 "ctangle.w"10#line 888 "./ctangle.w"
11 11
12#include <ctype.h> 12#include <ctype.h>
13#include <stdlib.h> 13#include <stdlib.h>
14 14
15/*:62*/15/*:62*/
16#line 65 "ctangle.w"16#line 65 "./ctangle.w"
17 17
18#define banner "This is CTANGLE (Version 3.64)\n" \18#define banner "This is CTANGLE (Version 3.64)\n" \
19 19
@@ -137,10 +137,10 @@ · 117 unmodified lines
137#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \137#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \
138 138
139 139
140#line 66 "ctangle.w"140#line 66 "./ctangle.w"
141 141
142/*5:*/142/*5:*/
143#line 29 "common.h"143#line 29 "./common.h"
144 144
145typedef short boolean;145typedef short boolean;
146typedef char unsigned eight_bits;146typedef char unsigned eight_bits;
@@ -148,7 +148,7 @@ extern boolean program; · 1 unmodified line
148extern int phase;148extern int phase;
149 149
150/*:5*//*7:*/150/*:5*//*7:*/
151#line 57 "common.h"151#line 57 "./common.h"
152 152
153char section_text[longest_name+1];153char section_text[longest_name+1];
154char*section_text_end= section_text+longest_name;154char*section_text_end= section_text+longest_name;
@@ -156,7 +156,7 @@ char*id_first; · 1 unmodified line
156char*id_loc;156char*id_loc;
157 157
158/*:7*//*8:*/158/*:7*//*8:*/
159#line 72 "common.h"159#line 72 "./common.h"
160 160
161extern char buffer[];161extern char buffer[];
162extern char*buffer_end;162extern char*buffer_end;
@@ -164,7 +164,7 @@ extern char*loc; · 1 unmodified line
164extern char*limit;164extern char*limit;
165 165
166/*:8*//*9:*/166/*:8*//*9:*/
167#line 87 "common.h"167#line 87 "./common.h"
168 168
169typedef struct name_info{169typedef struct name_info{
170char*byte_start;170char*byte_start;
@@ -192,7 +192,7 @@ extern name_pointer section_lookup(); · 21 unmodified lines
192extern void print_section_name(),sprint_section_name();192extern void print_section_name(),sprint_section_name();
193 193
194/*:9*//*10:*/194/*:9*//*10:*/
195#line 122 "common.h"195#line 122 "./common.h"
196 196
197extern history;197extern history;
198extern err_print();198extern err_print();
@@ -201,7 +201,7 @@ extern void fatal(); · 2 unmodified lines
201extern void overflow();201extern void overflow();
202 202
203/*:10*//*11:*/203/*:10*//*11:*/
204#line 137 "common.h"204#line 137 "./common.h"
205 205
206extern include_depth;206extern include_depth;
207extern FILE*file[];207extern FILE*file[];
@@ -223,7 +223,7 @@ extern get_line(); · 15 unmodified lines
223extern check_complete();223extern check_complete();
224 224
225/*:11*//*12:*/225/*:11*//*12:*/
226#line 158 "common.h"226#line 158 "./common.h"
227 227
228typedef unsigned short sixteen_bits;228typedef unsigned short sixteen_bits;
229extern sixteen_bits section_count;229extern sixteen_bits section_count;
@@ -232,14 +232,14 @@ extern boolean change_pending; · 2 unmodified lines
232extern boolean print_where;232extern boolean print_where;
233 233
234/*:12*//*13:*/234/*:12*//*13:*/
235#line 170 "common.h"235#line 170 "./common.h"
236 236
237extern int argc;237extern int argc;
238extern char**argv;238extern char**argv;
239extern boolean flags[];239extern boolean flags[];
240 240
241/*:13*//*14:*/241/*:13*//*14:*/
242#line 182 "common.h"242#line 182 "./common.h"
243 243
244extern FILE*C_file;244extern FILE*C_file;
245extern FILE*tex_file;245extern FILE*tex_file;
@@ -248,16 +248,16 @@ extern FILE*scn_file; · 2 unmodified lines
248extern FILE*active_file;248extern FILE*active_file;
249 249
250/*:14*//*15:*/250/*:14*//*15:*/
251#line 191 "common.h"251#line 191 "./common.h"
252 252
253extern void common_init();253extern void common_init();
254#line 128 "ctangle.w"254#line 128 "./ctangle.w"
255 255
256/*:15*/256/*:15*/
257#line 67 "ctangle.w"257#line 67 "./ctangle.w"
258 258
259/*16:*/259/*16:*/
260#line 152 "ctangle.w"260#line 152 "./ctangle.w"
261 261
262typedef struct{262typedef struct{
263eight_bits*tok_start;263eight_bits*tok_start;
@@ -266,7 +266,7 @@ sixteen_bits text_link; · 2 unmodified lines
266typedef text*text_pointer;266typedef text*text_pointer;
267 267
268/*:16*//*27:*/268/*:16*//*27:*/
269#line 296 "ctangle.w"269#line 296 "./ctangle.w"
270 270
271typedef struct{271typedef struct{
272eight_bits*end_field;272eight_bits*end_field;
@@ -278,10 +278,10 @@ sixteen_bits section_field; · 5 unmodified lines
278typedef output_state*stack_pointer;278typedef output_state*stack_pointer;
279 279
280/*:27*/280/*:27*/
281#line 68 "ctangle.w"281#line 68 "./ctangle.w"
282 282
283/*17:*/283/*17:*/
284#line 159 "ctangle.w"284#line 159 "./ctangle.w"
285 285
286text text_info[max_texts];286text text_info[max_texts];
287text_pointer text_info_end= text_info+max_texts-1;287text_pointer text_info_end= text_info+max_texts-1;
@@ -291,12 +291,12 @@ eight_bits*tok_mem_end= tok_mem+max_toks-1; · 3 unmodified lines
291eight_bits*tok_ptr;291eight_bits*tok_ptr;
292 292
293/*:17*//*23:*/293/*:17*//*23:*/
294#line 227 "ctangle.w"294#line 227 "./ctangle.w"
295 295
296text_pointer last_unnamed;296text_pointer last_unnamed;
297 297
298/*:23*//*28:*/298/*:23*//*28:*/
299#line 312 "ctangle.w"299#line 312 "./ctangle.w"
300 300
301output_state cur_state;301output_state cur_state;
302 302
@@ -305,18 +305,18 @@ stack_pointer stack_ptr; · 2 unmodified lines
305stack_pointer stack_end= stack+stack_size;305stack_pointer stack_end= stack+stack_size;
306 306
307/*:28*//*32:*/307/*:28*//*32:*/
308#line 384 "ctangle.w"308#line 384 "./ctangle.w"
309 309
310int cur_val;310int cur_val;
311 311
312/*:32*//*36:*/312/*:32*//*36:*/
313#line 473 "ctangle.w"313#line 473 "./ctangle.w"
314 314
315eight_bits out_state;315eight_bits out_state;
316boolean protect;316boolean protect;
317 317
318/*:36*//*38:*/318/*:36*//*38:*/
319#line 502 "ctangle.w"319#line 502 "./ctangle.w"
320 320
321name_pointer output_files[max_files];321name_pointer output_files[max_files];
322name_pointer*cur_out_file,*end_output_files,*an_output_file;322name_pointer*cur_out_file,*end_output_files,*an_output_file;
@@ -324,47 +324,47 @@ char cur_section_name_char; · 1 unmodified line
324char output_file_name[longest_name];324char output_file_name[longest_name];
325 325
326/*:38*//*45:*/326/*:38*//*45:*/
327#line 599 "ctangle.w"327#line 599 "./ctangle.w"
328 328
329boolean output_defs_seen= 0;329boolean output_defs_seen= 0;
330 330
331/*:45*//*51:*/331/*:45*//*51:*/
332#line 710 "ctangle.w"332#line 710 "./ctangle.w"
333 333
334char translit[128][translit_length];334char translit[128][translit_length];
335 335
336/*:51*//*56:*/336/*:51*//*56:*/
337#line 789 "ctangle.w"337#line 789 "./ctangle.w"
338 338
339eight_bits ccode[256];339eight_bits ccode[256];
340 340
341/*:56*//*59:*/341/*:56*//*59:*/
342#line 845 "ctangle.w"342#line 845 "./ctangle.w"
343 343
344boolean comment_continues= 0;344boolean comment_continues= 0;
345 345
346/*:59*//*61:*/346/*:59*//*61:*/
347#line 884 "ctangle.w"347#line 884 "./ctangle.w"
348 348
349name_pointer cur_section_name;349name_pointer cur_section_name;
350int no_where;350int no_where;
351 351
352/*:61*//*75:*/352/*:61*//*75:*/
353#line 1195 "ctangle.w"353#line 1195 "./ctangle.w"
354 354
355text_pointer cur_text;355text_pointer cur_text;
356eight_bits next_control;356eight_bits next_control;
357 357
358/*:75*//*82:*/358/*:75*//*82:*/
359#line 1350 "ctangle.w"359#line 1350 "./ctangle.w"
360 360
361extern sixteen_bits section_count;361extern sixteen_bits section_count;
362 362
363/*:82*/363/*:82*/
364#line 69 "ctangle.w"364#line 69 "./ctangle.w"
365 365
366/*2:*/366/*2:*/
367#line 77 "ctangle.w"367#line 77 "./ctangle.w"
368 368
369extern int strlen();369extern int strlen();
370extern int strcmp();370extern int strcmp();
@@ -373,36 +373,36 @@ extern int strncmp(); · 2 unmodified lines
373extern char*strncpy();373extern char*strncpy();
374 374
375/*:2*//*41:*/375/*:2*//*41:*/
376#line 533 "ctangle.w"376#line 533 "./ctangle.w"
377 377
378void phase_two();378void phase_two();
379 379
380/*:41*//*46:*/380/*:41*//*46:*/
381#line 602 "ctangle.w"381#line 602 "./ctangle.w"
382 382
383void output_defs();383void output_defs();
384 384
385/*:46*//*48:*/385/*:46*//*48:*/
386#line 648 "ctangle.w"386#line 648 "./ctangle.w"
387 387
388static void out_char();388static void out_char();
389 389
390/*:48*//*90:*/390/*:48*//*90:*/
391#line 1457 "ctangle.w"391#line 1457 "./ctangle.w"
392 392
393void phase_one();393void phase_one();
394 394
395/*:90*//*92:*/395/*:90*//*92:*/
396#line 1475 "ctangle.w"396#line 1475 "./ctangle.w"
397 397
398void skip_limbo();398void skip_limbo();
399 399
400/*:92*/400/*:92*/
401#line 70 "ctangle.w"401#line 70 "./ctangle.w"
402 402
403 403
404/*:1*//*3:*/404/*:1*//*3:*/
405#line 91 "ctangle.w"405#line 91 "./ctangle.w"
406 406
407int main(ac,av)407int main(ac,av)
408int ac;408int ac;
@@ -411,28 +411,28 @@ char**av; · 2 unmodified lines
411argc= ac;argv= av;411argc= ac;argv= av;
412program= ctangle;412program= ctangle;
413/*18:*/413/*18:*/
414#line 167 "ctangle.w"414#line 167 "./ctangle.w"
415 415
416text_info->tok_start= tok_ptr= tok_mem;416text_info->tok_start= tok_ptr= tok_mem;
417text_ptr= text_info+1;text_ptr->tok_start= tok_mem;417text_ptr= text_info+1;text_ptr->tok_start= tok_mem;
418 418
419 419
420/*:18*//*20:*/420/*:18*//*20:*/
421#line 177 "ctangle.w"421#line 177 "./ctangle.w"
422 422
423name_dir->equiv= (char*)text_info;423name_dir->equiv= (char*)text_info;
424 424
425/*:20*//*24:*/425/*:20*//*24:*/
426#line 230 "ctangle.w"426#line 230 "./ctangle.w"
427last_unnamed= text_info;text_info->text_link= 0;427last_unnamed= text_info;text_info->text_link= 0;
428 428
429/*:24*//*39:*/429/*:24*//*39:*/
430#line 512 "ctangle.w"430#line 512 "./ctangle.w"
431 431
432cur_out_file= end_output_files= output_files+max_files;432cur_out_file= end_output_files= output_files+max_files;
433 433
434/*:39*//*52:*/434/*:39*//*52:*/
435#line 713 "ctangle.w"435#line 713 "./ctangle.w"
436 436
437{437{
438int i;438int i;
@@ -440,7 +440,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned)(128+i)); · 1 unmodified line
440}440}
441 441
442/*:52*//*57:*/442/*:52*//*57:*/
443#line 792 "ctangle.w"443#line 792 "./ctangle.w"
444{444{
445int c;445int c;
446for(c= 0;c<256;c++)ccode[c]= ignore;446for(c= 0;c<256;c++)ccode[c]= ignore;
@@ -460,11 +460,11 @@ ccode['\'']= ord; · 13 unmodified lines
460}460}
461 461
462/*:57*//*71:*/462/*:57*//*71:*/
463#line 1116 "ctangle.w"463#line 1116 "./ctangle.w"
464section_text[0]= ' ';464section_text[0]= ' ';
465 465
466/*:71*/466/*:71*/
467#line 98 "ctangle.w"467#line 98 "./ctangle.w"
468;468;
469common_init();469common_init();
470if(show_banner)printf(banner);470if(show_banner)printf(banner);
@@ -474,7 +474,7 @@ return wrap_up(); · 3 unmodified lines
474}474}
475 475
476/*:3*//*21:*/476/*:3*//*21:*/
477#line 183 "ctangle.w"477#line 183 "./ctangle.w"
478 478
479int names_match(p,first,l)479int names_match(p,first,l)
480name_pointer p;480name_pointer p;
@@ -486,7 +486,7 @@ return!strncmp(first,p->byte_start,l); · 5 unmodified lines
486}486}
487 487
488/*:21*//*22:*/488/*:21*//*22:*/
489#line 198 "ctangle.w"489#line 198 "./ctangle.w"
490 490
491void491void
492init_node(node)492init_node(node)
@@ -498,7 +498,7 @@ void · 5 unmodified lines
498init_p(){}498init_p(){}
499 499
500/*:22*//*26:*/500/*:22*//*26:*/
501#line 260 "ctangle.w"501#line 260 "./ctangle.w"
502 502
503void503void
504store_two_bytes(x)504store_two_bytes(x)
@@ -510,7 +510,7 @@ if(tok_ptr+2> tok_mem_end)overflow("token"); · 5 unmodified lines
510}510}
511 511
512/*:26*//*30:*/512/*:26*//*30:*/
513#line 336 "ctangle.w"513#line 336 "./ctangle.w"
514 514
515void515void
516push_level(p)516push_level(p)
@@ -527,7 +527,7 @@ cur_section= 0; · 10 unmodified lines
527}527}
528 528
529/*:30*//*31:*/529/*:30*//*31:*/
530#line 355 "ctangle.w"530#line 355 "./ctangle.w"
531 531
532void532void
533pop_level(flag)533pop_level(flag)
@@ -543,7 +543,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr; · 9 unmodified lines
543}543}
544 544
545/*:31*//*33:*/545/*:31*//*33:*/
546#line 391 "ctangle.w"546#line 391 "./ctangle.w"
547 547
548void548void
549get_output()549get_output()
@@ -566,7 +566,7 @@ switch(a/024000){ · 16 unmodified lines
566case 0:cur_val= a;out_char(identifier);break;566case 0:cur_val= a;out_char(identifier);break;
567case 1:if(a==output_defs_flag)output_defs();567case 1:if(a==output_defs_flag)output_defs();
568else/*34:*/568else/*34:*/
569#line 423 "ctangle.w"569#line 423 "./ctangle.w"
570 570
571{571{
572a-= 024000;572a-= 024000;
@@ -580,7 +580,7 @@ goto restart; · 7 unmodified lines
580}580}
581 581
582/*:34*/582/*:34*/
583#line 412 "ctangle.w"583#line 412 "./ctangle.w"
584;584;
585break;585break;
586default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val;586default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val;
@@ -590,7 +590,7 @@ out_char(section_number); · 3 unmodified lines
590}590}
591 591
592/*:33*//*37:*/592/*:33*//*37:*/
593#line 481 "ctangle.w"593#line 481 "./ctangle.w"
594 594
595void595void
596flush_buffer()596flush_buffer()
@@ -605,29 +605,29 @@ cur_line++; · 8 unmodified lines
605}605}
606 606
607/*:37*//*42:*/607/*:37*//*42:*/
608#line 536 "ctangle.w"608#line 536 "./ctangle.w"
609 609
610void610void
611phase_two(){611phase_two(){
612web_file_open= 0;612web_file_open= 0;
613cur_line= 1;613cur_line= 1;
614/*29:*/614/*29:*/
615#line 325 "ctangle.w"615#line 325 "./ctangle.w"
616 616
617stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info;617stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info;
618cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0;618cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0;
619 619
620/*:29*/620/*:29*/
621#line 541 "ctangle.w"621#line 541 "./ctangle.w"
622;622;
623/*44:*/623/*44:*/
624#line 595 "ctangle.w"624#line 595 "./ctangle.w"
625 625
626if(!output_defs_seen)626if(!output_defs_seen)
627output_defs();627output_defs();
628 628
629/*:44*/629/*:44*/
630#line 542 "ctangle.w"630#line 542 "./ctangle.w"
631;631;
632if(text_info->text_link==0&&cur_out_file==end_output_files){632if(text_info->text_link==0&&cur_out_file==end_output_files){
633printf("\n! No program text was specified.");mark_harmless;633printf("\n! No program text was specified.");mark_harmless;
@@ -650,7 +650,7 @@ if(text_info->text_link==0)goto writeloop; · 16 unmodified lines
650while(stack_ptr> stack)get_output();650while(stack_ptr> stack)get_output();
651flush_buffer();651flush_buffer();
652writeloop:/*43:*/652writeloop:/*43:*/
653#line 572 "ctangle.w"653#line 572 "./ctangle.w"
654 654
655for(an_output_file= end_output_files;an_output_file> cur_out_file;){655for(an_output_file= end_output_files;an_output_file> cur_out_file;){
656an_output_file--;656an_output_file--;
@@ -671,14 +671,14 @@ flush_buffer(); · 14 unmodified lines
671}671}
672 672
673/*:43*/673/*:43*/
674#line 563 "ctangle.w"674#line 563 "./ctangle.w"
675;675;
676if(show_happiness)printf("\nDone.");676if(show_happiness)printf("\nDone.");
677}677}
678}678}
679 679
680/*:42*//*47:*/680/*:42*//*47:*/
681#line 605 "ctangle.w"681#line 605 "./ctangle.w"
682 682
683void683void
684output_defs()684output_defs()
@@ -718,7 +718,7 @@ pop_level(0); · 33 unmodified lines
718}718}
719 719
720/*:47*//*49:*/720/*:47*//*49:*/
721#line 651 "ctangle.w"721#line 651 "./ctangle.w"
722 722
723static void723static void
724out_char(cur_char)724out_char(cur_char)
@@ -731,7 +731,7 @@ case'\n':if(protect&&out_state!=verbatim)C_putc(' '); · 6 unmodified lines
731if(protect||out_state==verbatim)C_putc('\\');731if(protect||out_state==verbatim)C_putc('\\');
732flush_buffer();if(out_state!=verbatim)out_state= normal;break;732flush_buffer();if(out_state!=verbatim)out_state= normal;break;
733/*53:*/733/*53:*/
734#line 719 "ctangle.w"734#line 719 "./ctangle.w"
735 735
736case identifier:736case identifier:
737if(out_state==num_or_id)C_putc(' ');737if(out_state==num_or_id)C_putc(' ');
@@ -746,10 +746,10 @@ j++; · 8 unmodified lines
746out_state= num_or_id;break;746out_state= num_or_id;break;
747 747
748/*:53*/748/*:53*/
749#line 662 "ctangle.w"749#line 662 "./ctangle.w"
750;750;
751/*54:*/751/*54:*/
752#line 732 "ctangle.w"752#line 732 "./ctangle.w"
753 753
754case section_number:754case section_number:
755if(cur_val> 0)C_printf("/*%d:*/",cur_val);755if(cur_val> 0)C_printf("/*%d:*/",cur_val);
@@ -776,10 +776,10 @@ C_printf("%s","\"\n"); · 20 unmodified lines
776break;776break;
777 777
778/*:54*/778/*:54*/
779#line 663 "ctangle.w"779#line 663 "./ctangle.w"
780;780;
781/*50:*/781/*50:*/
782#line 681 "ctangle.w"782#line 681 "./ctangle.w"
783 783
784case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;784case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;
785case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;785case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;
@@ -800,7 +800,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal; · 14 unmodified lines
800break;800break;
801 801
802/*:50*/802/*:50*/
803#line 664 "ctangle.w"803#line 664 "./ctangle.w"
804;804;
805case'=':case'>':C_putc(cur_char);C_putc(' ');805case'=':case'>':C_putc(cur_char);C_putc(' ');
806out_state= normal;break;806out_state= normal;break;
@@ -819,7 +819,7 @@ default:C_putc(cur_char);out_state= normal;break; · 12 unmodified lines
819}819}
820 820
821/*:49*//*58:*/821/*:49*//*58:*/
822#line 813 "ctangle.w"822#line 813 "./ctangle.w"
823 823
824eight_bits824eight_bits
825skip_ahead()825skip_ahead()
@@ -837,7 +837,7 @@ if(c!=ignore||*(loc-1)=='>')return(c); · 11 unmodified lines
837}837}
838 838
839/*:58*//*60:*/839/*:58*//*60:*/
840#line 848 "ctangle.w"840#line 848 "./ctangle.w"
841 841
842int skip_comment(is_long_comment)842int skip_comment(is_long_comment)
843boolean is_long_comment;843boolean is_long_comment;
@@ -871,7 +871,7 @@ else loc++; · 27 unmodified lines
871}871}
872 872
873/*:60*//*63:*/873/*:60*//*63:*/
874#line 900 "ctangle.w"874#line 900 "./ctangle.w"
875 875
876eight_bits876eight_bits
877get_next()877get_next()
@@ -885,7 +885,7 @@ if(get_line()==0)return(new_section); · 7 unmodified lines
885else if(print_where&&!no_where){885else if(print_where&&!no_where){
886print_where= 0;886print_where= 0;
887/*77:*/887/*77:*/
888#line 1225 "ctangle.w"888#line 1225 "./ctangle.w"
889 889
890store_two_bytes(0150000);890store_two_bytes(0150000);
891if(changing)id_first= change_file_name;891if(changing)id_first= change_file_name;
@@ -897,7 +897,7 @@ else store_two_bytes((sixteen_bits)cur_line); · 5 unmodified lines
897app_repl(a%0400);}897app_repl(a%0400);}
898 898
899/*:77*/899/*:77*/
900#line 912 "ctangle.w"900#line 912 "./ctangle.w"
901;901;
902}902}
903else return('\n');903else return('\n');
@@ -911,7 +911,7 @@ else continue; · 7 unmodified lines
911}911}
912loc++;912loc++;
913if(xisdigit(c)||c=='.')/*66:*/913if(xisdigit(c)||c=='.')/*66:*/
914#line 978 "ctangle.w"914#line 978 "./ctangle.w"
915{915{
916id_first= loc-1;916id_first= loc-1;
917if(*id_first=='.'&&!xisdigit(*loc))goto mistake;917if(*id_first=='.'&&!xisdigit(*loc))goto mistake;
@@ -936,11 +936,11 @@ return(constant); · 18 unmodified lines
936}936}
937 937
938/*:66*/938/*:66*/
939#line 924 "ctangle.w"939#line 924 "./ctangle.w"
940 940
941else if(c=='\''||c=='"'||(c=='L'&&(*loc=='\''||*loc=='"')))941else if(c=='\''||c=='"'||(c=='L'&&(*loc=='\''||*loc=='"')))
942/*67:*/942/*67:*/
943#line 1006 "ctangle.w"943#line 1006 "./ctangle.w"
944{944{
945char delim= c;945char delim= c;
946id_first= section_text+1;946id_first= section_text+1;
@@ -983,11 +983,11 @@ return(string); · 36 unmodified lines
983}983}
984 984
985/*:67*/985/*:67*/
986#line 926 "ctangle.w"986#line 926 "./ctangle.w"
987 987
988else if(isalpha(c)||isxalpha(c)||ishigh(c))988else if(isalpha(c)||isxalpha(c)||ishigh(c))
989/*65:*/989/*65:*/
990#line 972 "ctangle.w"990#line 972 "./ctangle.w"
991{991{
992id_first= --loc;992id_first= --loc;
993while(isalpha(*++loc)||isdigit(*loc)||isxalpha(*loc)||ishigh(*loc));993while(isalpha(*++loc)||isdigit(*loc)||isxalpha(*loc)||ishigh(*loc));
@@ -995,10 +995,10 @@ id_loc= loc;return(identifier); · 1 unmodified line
995}995}
996 996
997/*:65*/997/*:65*/
998#line 928 "ctangle.w"998#line 928 "./ctangle.w"
999 999
1000else if(c=='@')/*68:*/1000else if(c=='@')/*68:*/
1001#line 1050 "ctangle.w"1001#line 1050 "./ctangle.w"
1002{1002{
1003c= ccode[(eight_bits)*loc++];1003c= ccode[(eight_bits)*loc++];
1004switch(c){1004switch(c){
@@ -1014,11 +1014,11 @@ continue; · 9 unmodified lines
1014case section_name:1014case section_name:
1015cur_section_name_char= *(loc-1);1015cur_section_name_char= *(loc-1);
1016/*70:*/1016/*70:*/
1017#line 1098 "ctangle.w"1017#line 1098 "./ctangle.w"
1018{1018{
1019char*k;1019char*k;
1020/*72:*/1020/*72:*/
1021#line 1118 "ctangle.w"1021#line 1118 "./ctangle.w"
1022 1022
1023k= section_text;1023k= section_text;
1024while(1){1024while(1){
@@ -1029,7 +1029,7 @@ loc= buffer+1;break; · 4 unmodified lines
1029}1029}
1030c= *loc;1030c= *loc;
1031/*73:*/1031/*73:*/
1032#line 1142 "ctangle.w"1032#line 1142 "./ctangle.w"
1033 1033
1034if(c=='@'){1034if(c=='@'){
1035c= *(loc+1);1035c= *(loc+1);
@@ -1048,7 +1048,7 @@ err_print("! Nesting of section names not allowed");break; · 12 unmodified lines
1048}1048}
1049 1049
1050/*:73*/1050/*:73*/
1051#line 1127 "ctangle.w"1051#line 1127 "./ctangle.w"
1052;1052;
1053loc++;if(k<section_text_end)k++;1053loc++;if(k<section_text_end)k++;
1054if(xisspace(c)){1054if(xisspace(c)){
@@ -1065,14 +1065,14 @@ printf("...");mark_harmless; · 10 unmodified lines
1065if(*k==' '&&k> section_text)k--;1065if(*k==' '&&k> section_text)k--;
1066 1066
1067/*:72*/1067/*:72*/
1068#line 1100 "ctangle.w"1068#line 1100 "./ctangle.w"
1069;1069;
1070if(k-section_text> 3&&strncmp(k-2,"...",3)==0)1070if(k-section_text> 3&&strncmp(k-2,"...",3)==0)
1071cur_section_name= section_lookup(section_text+1,k-3,1);1071cur_section_name= section_lookup(section_text+1,k-3,1);
1072else cur_section_name= section_lookup(section_text+1,k,0);1072else cur_section_name= section_lookup(section_text+1,k,0);
1073if(cur_section_name_char=='(')1073if(cur_section_name_char=='(')
1074/*40:*/1074/*40:*/
1075#line 516 "ctangle.w"1075#line 516 "./ctangle.w"
1076 1076
1077{1077{
1078for(an_output_file= cur_out_file;1078for(an_output_file= cur_out_file;
@@ -1088,16 +1088,16 @@ overflow("output files"); · 9 unmodified lines
1088}1088}
1089 1089
1090/*:40*/1090/*:40*/
1091#line 1106 "ctangle.w"1091#line 1106 "./ctangle.w"
1092;1092;
1093return(section_name);1093return(section_name);
1094}1094}
1095 1095
1096/*:70*/1096/*:70*/
1097#line 1064 "ctangle.w"1097#line 1064 "./ctangle.w"
1098;1098;
1099case string:/*74:*/1099case string:/*74:*/
1100#line 1164 "ctangle.w"1100#line 1164 "./ctangle.w"
1101{1101{
1102id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';1102id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
1103while(*loc!='@'||*(loc+1)!='>')loc++;1103while(*loc!='@'||*(loc+1)!='>')loc++;
@@ -1108,10 +1108,10 @@ return(string); · 4 unmodified lines
1108}1108}
1109 1109
1110/*:74*/1110/*:74*/
1111#line 1065 "ctangle.w"1111#line 1065 "./ctangle.w"
1112;1112;
1113case ord:/*69:*/1113case ord:/*69:*/
1114#line 1077 "ctangle.w"1114#line 1077 "./ctangle.w"
1115 1115
1116id_first= loc;1116id_first= loc;
1117if(*loc=='\\'){1117if(*loc=='\\'){
@@ -1134,14 +1134,14 @@ loc++; · 16 unmodified lines
1134return(ord);1134return(ord);
1135 1135
1136/*:69*/1136/*:69*/
1137#line 1066 "ctangle.w"1137#line 1066 "./ctangle.w"
1138;1138;
1139default:return(c);1139default:return(c);
1140}1140}
1141}1141}
1142 1142
1143/*:68*/1143/*:68*/
1144#line 929 "ctangle.w"1144#line 929 "./ctangle.w"
1145 1145
1146else if(xisspace(c)){1146else if(xisspace(c)){
1147if(!preprocessing||loc> limit)continue;1147if(!preprocessing||loc> limit)continue;
@@ -1150,7 +1150,7 @@ else return(' '); · 2 unmodified lines
1150}1150}
1151else if(c=='#'&&loc==buffer+1)preprocessing= 1;1151else if(c=='#'&&loc==buffer+1)preprocessing= 1;
1152mistake:/*64:*/1152mistake:/*64:*/
1153#line 950 "ctangle.w"1153#line 950 "./ctangle.w"
1154 1154
1155switch(c){1155switch(c){
1156case'+':if(*loc=='+')compress(plus_plus);break;1156case'+':if(*loc=='+')compress(plus_plus);break;
@@ -1174,14 +1174,14 @@ case'!':if(*loc=='=')compress(not_eq);break; · 17 unmodified lines
1174}1174}
1175 1175
1176/*:64*/1176/*:64*/
1177#line 936 "ctangle.w"1177#line 936 "./ctangle.w"
1178 1178
1179return(c);1179return(c);
1180}1180}
1181}1181}
1182 1182
1183/*:63*//*76:*/1183/*:63*//*76:*/
1184#line 1199 "ctangle.w"1184#line 1199 "./ctangle.w"
1185 1185
1186void1186void
1187scan_repl(t)1187scan_repl(t)
@@ -1189,7 +1189,7 @@ eight_bits t; · 1 unmodified line
1189{1189{
1190sixteen_bits a;1190sixteen_bits a;
1191if(t==section_name){/*77:*/1191if(t==section_name){/*77:*/
1192#line 1225 "ctangle.w"1192#line 1225 "./ctangle.w"
1193 1193
1194store_two_bytes(0150000);1194store_two_bytes(0150000);
1195if(changing)id_first= change_file_name;1195if(changing)id_first= change_file_name;
@@ -1201,11 +1201,11 @@ else store_two_bytes((sixteen_bits)cur_line); · 5 unmodified lines
1201app_repl(a%0400);}1201app_repl(a%0400);}
1202 1202
1203/*:77*/1203/*:77*/
1204#line 1205 "ctangle.w"1204#line 1205 "./ctangle.w"
1205;}1205;}
1206while(1)switch(a= get_next()){1206while(1)switch(a= get_next()){
1207/*78:*/1207/*78:*/
1208#line 1235 "ctangle.w"1208#line 1235 "./ctangle.w"
1209 1209
1210case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;1210case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;
1211app_repl((a/0400)+0200);1211app_repl((a/0400)+0200);
@@ -1213,7 +1213,7 @@ app_repl(a%0400);break; · 1 unmodified line
1213case section_name:if(t!=section_name)goto done;1213case section_name:if(t!=section_name)goto done;
1214else{1214else{
1215/*79:*/1215/*79:*/
1216#line 1268 "ctangle.w"1216#line 1268 "./ctangle.w"
1217{1217{
1218char*try_loc= loc;1218char*try_loc= loc;
1219while(*try_loc==' '&&try_loc<limit)try_loc++;1219while(*try_loc==' '&&try_loc<limit)try_loc++;
@@ -1226,13 +1226,13 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); · 6 unmodified lines
1226}1226}
1227 1227
1228/*:79*/1228/*:79*/
1229#line 1241 "ctangle.w"1229#line 1241 "./ctangle.w"
1230;1230;
1231a= cur_section_name-name_dir;1231a= cur_section_name-name_dir;
1232app_repl((a/0400)+0250);1232app_repl((a/0400)+0250);
1233app_repl(a%0400);1233app_repl(a%0400);
1234/*77:*/1234/*77:*/
1235#line 1225 "ctangle.w"1235#line 1225 "./ctangle.w"
1236 1236
1237store_two_bytes(0150000);1237store_two_bytes(0150000);
1238if(changing)id_first= change_file_name;1238if(changing)id_first= change_file_name;
@@ -1244,7 +1244,7 @@ else store_two_bytes((sixteen_bits)cur_line); · 5 unmodified lines
1244app_repl(a%0400);}1244app_repl(a%0400);}
1245 1245
1246/*:77*/1246/*:77*/
1247#line 1245 "ctangle.w"1247#line 1245 "./ctangle.w"
1248;break;1248;break;
1249}1249}
1250case output_defs_code:if(t!=section_name)err_print("! Misplaced @h");1250case output_defs_code:if(t!=section_name)err_print("! Misplaced @h");
@@ -1255,7 +1255,7 @@ a= output_defs_flag; · 4 unmodified lines
1255app_repl((a/0400)+0200);1255app_repl((a/0400)+0200);
1256app_repl(a%0400);1256app_repl(a%0400);
1257/*77:*/1257/*77:*/
1258#line 1225 "ctangle.w"1258#line 1225 "./ctangle.w"
1259 1259
1260store_two_bytes(0150000);1260store_two_bytes(0150000);
1261if(changing)id_first= change_file_name;1261if(changing)id_first= change_file_name;
@@ -1267,13 +1267,13 @@ else store_two_bytes((sixteen_bits)cur_line); · 5 unmodified lines
1267app_repl(a%0400);}1267app_repl(a%0400);}
1268 1268
1269/*:77*/1269/*:77*/
1270#line 1254 "ctangle.w"1270#line 1254 "./ctangle.w"
1271;1271;
1272}1272}
1273break;1273break;
1274case constant:case string:1274case constant:case string:
1275/*80:*/1275/*80:*/
1276#line 1279 "ctangle.w"1276#line 1279 "./ctangle.w"
1277 1277
1278app_repl(a);1278app_repl(a);
1279while(id_first<id_loc){1279while(id_first<id_loc){
@@ -1287,11 +1287,11 @@ app_repl(*id_first++); · 7 unmodified lines
1287app_repl(a);break;1287app_repl(a);break;
1288 1288
1289/*:80*/1289/*:80*/
1290#line 1258 "ctangle.w"1290#line 1258 "./ctangle.w"
1291;1291;
1292case ord:1292case ord:
1293/*81:*/1293/*81:*/
1294#line 1295 "ctangle.w"1294#line 1295 "./ctangle.w"
1295{1295{
1296int c= (eight_bits)*id_first;1296int c= (eight_bits)*id_first;
1297if(c=='\\'){1297if(c=='\\'){
@@ -1342,7 +1342,7 @@ app_repl(constant); · 44 unmodified lines
1342break;1342break;
1343 1343
1344/*:81*/1344/*:81*/
1345#line 1260 "ctangle.w"1345#line 1260 "./ctangle.w"
1346;1346;
1347case definition:case format_code:case begin_C:if(t!=section_name)goto done;1347case definition:case format_code:case begin_C:if(t!=section_name)goto done;
1348else{1348else{
@@ -1352,7 +1352,7 @@ err_print("! @d, @f and @c are ignored in C text");continue; · 3 unmodified lines
1352case new_section:goto done;1352case new_section:goto done;
1353 1353
1354/*:78*/1354/*:78*/
1355#line 1210 "ctangle.w"1355#line 1210 "./ctangle.w"
1356 1356
1357case')':app_repl(a);1357case')':app_repl(a);
1358if(t==macro)app_repl(' ');1358if(t==macro)app_repl(' ');
@@ -1365,7 +1365,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; · 6 unmodified lines
1365}1365}
1366 1366
1367/*:76*//*83:*/1367/*:76*//*83:*/
1368#line 1357 "ctangle.w"1368#line 1357 "./ctangle.w"
1369 1369
1370void1370void
1371scan_section()1371scan_section()
@@ -1380,7 +1380,7 @@ printf("*%d",section_count);update_terminal; · 8 unmodified lines
1380next_control= 0;1380next_control= 0;
1381while(1){1381while(1){
1382/*84:*/1382/*84:*/
1383#line 1396 "ctangle.w"1383#line 1396 "./ctangle.w"
1384 1384
1385while(next_control<definition)1385while(next_control<definition)
1386 1386
@@ -1389,11 +1389,11 @@ loc-= 2;next_control= get_next(); · 2 unmodified lines
1389}1389}
1390 1390
1391/*:84*/1391/*:84*/
1392#line 1371 "ctangle.w"1392#line 1371 "./ctangle.w"
1393;1393;
1394if(next_control==definition){1394if(next_control==definition){
1395/*85:*/1395/*85:*/
1396#line 1403 "ctangle.w"1396#line 1403 "./ctangle.w"
1397{1397{
1398while((next_control= get_next())=='\n');1398while((next_control= get_next())=='\n');
1399if(next_control!=identifier){1399if(next_control!=identifier){
@@ -1412,7 +1412,7 @@ cur_text->text_link= 0; · 12 unmodified lines
1412}1412}
1413 1413
1414/*:85*/1414/*:85*/
1415#line 1373 "ctangle.w"1415#line 1373 "./ctangle.w"
1416 1416
1417continue;1417continue;
1418}1418}
@@ -1422,14 +1422,14 @@ p= name_dir;break; · 3 unmodified lines
1422if(next_control==section_name){1422if(next_control==section_name){
1423p= cur_section_name;1423p= cur_section_name;
1424/*86:*/1424/*86:*/
1425#line 1428 "ctangle.w"1425#line 1428 "./ctangle.w"
1426 1426
1427while((next_control= get_next())=='+');1427while((next_control= get_next())=='+');
1428if(next_control!='='&&next_control!=eq_eq)1428if(next_control!='='&&next_control!=eq_eq)
1429continue;1429continue;
1430 1430
1431/*:86*/1431/*:86*/
1432#line 1381 "ctangle.w"1432#line 1381 "./ctangle.w"
1433;1433;
1434break;1434break;
1435}1435}
@@ -1437,20 +1437,20 @@ return; · 1 unmodified line
1437}1437}
1438no_where= print_where= 0;1438no_where= print_where= 0;
1439/*87:*/1439/*87:*/
1440#line 1433 "ctangle.w"1440#line 1433 "./ctangle.w"
1441 1441
1442/*88:*/1442/*88:*/
1443#line 1438 "ctangle.w"1443#line 1438 "./ctangle.w"
1444 1444
1445store_two_bytes((sixteen_bits)(0150000+section_count));1445store_two_bytes((sixteen_bits)(0150000+section_count));
1446 1446
1447 1447
1448/*:88*/1448/*:88*/
1449#line 1434 "ctangle.w"1449#line 1434 "./ctangle.w"
1450;1450;
1451scan_repl(section_name);1451scan_repl(section_name);
1452/*89:*/1452/*89:*/
1453#line 1442 "ctangle.w"1453#line 1442 "./ctangle.w"
1454 1454
1455if(p==name_dir||p==0){1455if(p==name_dir||p==0){
1456(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;1456(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
@@ -1467,16 +1467,16 @@ cur_text->text_link= section_flag; · 10 unmodified lines
1467 1467
1468 1468
1469/*:89*/1469/*:89*/
1470#line 1436 "ctangle.w"1470#line 1436 "./ctangle.w"
1471;1471;
1472 1472
1473/*:87*/1473/*:87*/
1474#line 1387 "ctangle.w"1474#line 1387 "./ctangle.w"
1475;1475;
1476}1476}
1477 1477
1478/*:83*//*91:*/1478/*:83*//*91:*/
1479#line 1460 "ctangle.w"1479#line 1460 "./ctangle.w"
1480 1480
1481void1481void
1482phase_one(){1482phase_one(){
@@ -1490,7 +1490,7 @@ phase= 2; · 7 unmodified lines
1490}1490}
1491 1491
1492/*:91*//*93:*/1492/*:91*//*93:*/
1493#line 1478 "ctangle.w"1493#line 1478 "./ctangle.w"
1494 1494
1495void1495void
1496skip_limbo()1496skip_limbo()
@@ -1505,7 +1505,7 @@ c= *loc++; · 8 unmodified lines
1505if(ccode[(eight_bits)c]==new_section)break;1505if(ccode[(eight_bits)c]==new_section)break;
1506switch(ccode[(eight_bits)c]){1506switch(ccode[(eight_bits)c]){
1507case translit_code:/*94:*/1507case translit_code:/*94:*/
1508#line 1507 "ctangle.w"1508#line 1507 "./ctangle.w"
1509 1509
1510while(xisspace(*loc)&&loc<limit)loc++;1510while(xisspace(*loc)&&loc<limit)loc++;
1511loc+= 3;1511loc+= 3;
@@ -1530,7 +1530,7 @@ translit[i-0200][loc-beg]= '\0'; · 18 unmodified lines
1530}1530}
1531 1531
1532/*:94*/1532/*:94*/
1533#line 1491 "ctangle.w"1533#line 1491 "./ctangle.w"
1534;break;1534;break;
1535case format_code:case'@':break;1535case format_code:case'@':break;
1536case control_text:if(c=='q'||c=='Q'){1536case control_text:if(c=='q'||c=='Q'){
@@ -1548,7 +1548,7 @@ default:err_print("! Double @ should be used in limbo"); · 11 unmodified lines
1548}1548}
1549 1549
1550/*:93*//*95:*/1550/*:93*//*95:*/
1551#line 1533 "ctangle.w"1551#line 1533 "./ctangle.w"
1552 1552
1553void1553void
1554print_stats(){1554print_stats(){
ctangle.w+1−1
@@ -831,7 +831,7 @@ speed in order to pass over comments, which \.{CTANGLE} does not transmit · 830 unmodified lines
831to the output. If the comment is introduced by \.{/*}, |skip_comment|831to the output. If the comment is introduced by \.{/*}, |skip_comment|
832proceeds until finding the end-comment token \.{*/} or a newline; in the832proceeds until finding the end-comment token \.{*/} or a newline; in the
833latter case |skip_comment| will be called again by |get_next|, since the833latter case |skip_comment| will be called again by |get_next|, since the
834comment is not finished. This is done so that the each newline in the834comment is not finished. This is done so that each newline in the
835\CEE/ part of a section is copied to the output; otherwise the \&{\#line}835\CEE/ part of a section is copied to the output; otherwise the \&{\#line}
836commands inserted into the \CEE/ file by the output routines become useless.836commands inserted into the \CEE/ file by the output routines become useless.
837On the other hand, if the comment is introduced by \.{//} (i.e., if it837On the other hand, if the comment is introduced by \.{//} (i.e., if it

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t