History

CWEB — Release 3.3, 1994-12-06.

Andreas Scherer committed 15 years ago

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

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

Unified · Split

ctangle.c+100−95
@@ -7,7 +7,7 @@ · 6 unmodified lines
7#include <stdio.h>7#include <stdio.h>
8 8
9/*:6*//*62:*/9/*:6*//*62:*/
10#line 874 "ctangle.w"10#line 875 "ctangle.w"
11 11
12#include <ctype.h> 12#include <ctype.h>
13#include <stdlib.h> 13#include <stdlib.h>
@@ -15,7 +15,7 @@ · 1 unmodified line
15/*:62*/15/*:62*/
16#line 62 "ctangle.w"16#line 62 "ctangle.w"
17 17
18#define banner "This is CTANGLE (Version 3.2)\n" \18#define banner "This is CTANGLE (Version 3.3)\n" \
19 19
20#define max_bytes 90000 \20#define max_bytes 90000 \
21 21
@@ -47,15 +47,15 @@ · 25 unmodified lines
47#define period_ast 02647#define period_ast 026
48#define minus_gt_ast 027 \48#define minus_gt_ast 027 \
49 49
50#define xisalpha(c)(isalpha(c)&&((eight_bits)c<0200))50#define xisalpha(c) (isalpha(c) &&((eight_bits) c<0200) )
51#define xisdigit(c)(isdigit(c)&&((eight_bits)c<0200))51#define xisdigit(c) (isdigit(c) &&((eight_bits) c<0200) )
52#define xisspace(c)(isspace(c)&&((eight_bits)c<0200))52#define xisspace(c) (isspace(c) &&((eight_bits) c<0200) )
53#define xislower(c)(islower(c)&&((eight_bits)c<0200))53#define xislower(c) (islower(c) &&((eight_bits) c<0200) )
54#define xisupper(c)(isupper(c)&&((eight_bits)c<0200))54#define xisupper(c) (isupper(c) &&((eight_bits) c<0200) )
55#define xisxdigit(c)(isxdigit(c)&&((eight_bits)c<0200)) \55#define xisxdigit(c) (isxdigit(c) &&((eight_bits) c<0200) ) \
56 56
57#define length(c)(c+1)->byte_start-(c)->byte_start57#define length(c) (c+1) ->byte_start-(c) ->byte_start
58#define print_id(c)term_write((c)->byte_start,length((c)))58#define print_id(c) term_write((c) ->byte_start,length((c) ) )
59#define llink link59#define llink link
60#define rlink dummy.Rlink60#define rlink dummy.Rlink
61#define root name_dir->rlink \61#define root name_dir->rlink \
@@ -66,9 +66,9 @@ · 4 unmodified lines
66#define harmless_message 166#define harmless_message 1
67#define error_message 267#define error_message 2
68#define fatal_message 368#define fatal_message 3
69#define mark_harmless {if(history==spotless)history= harmless_message;}69#define mark_harmless {if(history==spotless) history= harmless_message;}
70#define mark_error history= error_message70#define mark_error history= error_message
71#define confusion(s)fatal("! This can't happen: ",s) \71#define confusion(s) fatal("! This can't happen: ",s) \
72 72
73#define max_file_name_length 6073#define max_file_name_length 60
74#define cur_file file[include_depth]74#define cur_file file[include_depth]
@@ -80,12 +80,12 @@ · 5 unmodified lines
80#define show_progress flags['p']80#define show_progress flags['p']
81#define show_happiness flags['h'] \81#define show_happiness flags['h'] \
82 82
83#define update_terminal fflush(stdout)83#define update_terminal fflush(stdout)
84#define new_line putchar('\n')84#define new_line putchar('\n')
85#define putxchar putchar85#define putxchar putchar
86#define term_write(a,b)fflush(stdout),fwrite(a,sizeof(char),b,stdout)86#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
87#define C_printf(c,a)fprintf(C_file,c,a)87#define C_printf(c,a) fprintf(C_file,c,a)
88#define C_putc(c)putc(c,C_file) \88#define C_putc(c) putc(c,C_file) \
89 89
90#define equiv equiv_or_xref \90#define equiv equiv_or_xref \
91 91
@@ -93,7 +93,7 @@ · 1 unmodified line
93 93
94#define string 0294#define string 02
95#define join 017795#define join 0177
96#define output_defs_flag (2*024000-1) \96#define output_defs_flag (2*024000-1) \
97 97
98#define cur_end cur_state.end_field98#define cur_end cur_state.end_field
99#define cur_byte cur_state.byte_field99#define cur_byte cur_state.byte_field
@@ -125,14 +125,14 @@ · 25 unmodified lines
125 125
126#define constant 03 \126#define constant 03 \
127 127
128#define isxalpha(c)((c)=='_')128#define isxalpha(c) ((c) =='_')
129#define ishigh(c)((unsigned char)(c)>0177) \129#define ishigh(c) ((unsigned char) (c) >0177) \
130 \130 \
131 131
132#define compress(c)if(loc++<=limit)return(c) \132#define compress(c) if(loc++<=limit) return(c) \
133 133
134#define macro 0134#define macro 0
135#define app_repl(c){if(tok_ptr==tok_mem_end)overflow("token");*tok_ptr++= c;} \135#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \
136 136
137 137
138#line 63 "ctangle.w"138#line 63 "ctangle.w"
@@ -345,15 +345,16 @@ boolean comment_continues= 0; · 206 unmodified lines
345#line 871 "ctangle.w"345#line 871 "ctangle.w"
346 346
347name_pointer cur_section_name;347name_pointer cur_section_name;
348int no_where;
348 349
349/*:61*//*75:*/350/*:61*//*75:*/
350#line 1181 "ctangle.w"351#line 1185 "ctangle.w"
351 352
352text_pointer cur_text;353text_pointer cur_text;
353eight_bits next_control;354eight_bits next_control;
354 355
355/*:75*//*82:*/356/*:75*//*82:*/
356#line 1328 "ctangle.w"357#line 1335 "ctangle.w"
357 358
358extern sixteen_bits section_count;359extern sixteen_bits section_count;
359 360
@@ -382,15 +383,15 @@ void output_defs(); · 22 unmodified lines
382/*:46*//*48:*/383/*:46*//*48:*/
383#line 642 "ctangle.w"384#line 642 "ctangle.w"
384 385
385void out_char();386static void out_char();
386 387
387/*:48*//*90:*/388/*:48*//*90:*/
388#line 1434 "ctangle.w"389#line 1442 "ctangle.w"
389 390
390void phase_one();391void phase_one();
391 392
392/*:90*//*92:*/393/*:90*//*92:*/
393#line 1452 "ctangle.w"394#line 1460 "ctangle.w"
394 395
395void skip_limbo();396void skip_limbo();
396 397
@@ -457,7 +458,7 @@ ccode['\'']= ord; · 60 unmodified lines
457}458}
458 459
459/*:57*//*71:*/460/*:57*//*71:*/
460#line 1105 "ctangle.w"461#line 1106 "ctangle.w"
461section_text[0]= ' ';462section_text[0]= ' ';
462 463
463/*:71*/464/*:71*/
@@ -717,7 +718,7 @@ pop_level(0); · 253 unmodified lines
717/*:47*//*49:*/718/*:47*//*49:*/
718#line 645 "ctangle.w"719#line 645 "ctangle.w"
719 720
720void721static void
721out_char(cur_char)722out_char(cur_char)
722eight_bits cur_char;723eight_bits cur_char;
723{724{
@@ -861,7 +862,7 @@ else loc++; · 137 unmodified lines
861}862}
862 863
863/*:60*//*63:*/864/*:60*//*63:*/
864#line 885 "ctangle.w"865#line 886 "ctangle.w"
865 866
866eight_bits867eight_bits
867get_next()868get_next()
@@ -872,10 +873,10 @@ while(1){ · 4 unmodified lines
872if(loc>limit){873if(loc>limit){
873if(preprocessing&&*(limit-1)!='\\')preprocessing= 0;874if(preprocessing&&*(limit-1)!='\\')preprocessing= 0;
874if(get_line()==0)return(new_section);875if(get_line()==0)return(new_section);
875else if(print_where){876else if(print_where&&!no_where){
876print_where= 0;877print_where= 0;
877/*77:*/878/*77:*/
878#line 1208 "ctangle.w"879#line 1215 "ctangle.w"
879 880
880store_two_bytes(0150000);881store_two_bytes(0150000);
881if(changing)id_first= change_file_name;882if(changing)id_first= change_file_name;
@@ -883,11 +884,11 @@ else id_first= cur_file_name; · 1 unmodified line
883id_loc= id_first+strlen(id_first);884id_loc= id_first+strlen(id_first);
884if(changing)store_two_bytes((sixteen_bits)change_line);885if(changing)store_two_bytes((sixteen_bits)change_line);
885else store_two_bytes((sixteen_bits)cur_line);886else store_two_bytes((sixteen_bits)cur_line);
886{int a= id_lookup(id_first,id_loc)-name_dir;app_repl((a/0400)+0200);887{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
887app_repl(a%0400);}888app_repl(a%0400);}
888 889
889/*:77*/890/*:77*/
890#line 897 "ctangle.w"891#line 898 "ctangle.w"
891;892;
892}893}
893else return('\n');894else return('\n');
@@ -901,7 +902,7 @@ else continue; · 7 unmodified lines
901}902}
902loc++;903loc++;
903if(xisdigit(c)||c=='\\'||c=='.')/*66:*/904if(xisdigit(c)||c=='\\'||c=='.')/*66:*/
904#line 963 "ctangle.w"905#line 964 "ctangle.w"
905{906{
906id_first= loc-1;907id_first= loc-1;
907if(*id_first=='.'&&!xisdigit(*loc))goto mistake;908if(*id_first=='.'&&!xisdigit(*loc))goto mistake;
@@ -929,11 +930,11 @@ return(constant); · 21 unmodified lines
929}930}
930 931
931/*:66*/932/*:66*/
932#line 909 "ctangle.w"933#line 910 "ctangle.w"
933 934
934else if(c=='\''||c=='"'||(c=='L'&&(*loc=='\''||*loc=='"')))935else if(c=='\''||c=='"'||(c=='L'&&(*loc=='\''||*loc=='"')))
935/*67:*/936/*67:*/
936#line 994 "ctangle.w"937#line 995 "ctangle.w"
937{938{
938char delim= c;939char delim= c;
939id_first= section_text+1;940id_first= section_text+1;
@@ -976,11 +977,11 @@ return(string); · 36 unmodified lines
976}977}
977 978
978/*:67*/979/*:67*/
979#line 911 "ctangle.w"980#line 912 "ctangle.w"
980 981
981else if(isalpha(c)||isxalpha(c)||ishigh(c))982else if(isalpha(c)||isxalpha(c)||ishigh(c))
982/*65:*/983/*65:*/
983#line 957 "ctangle.w"984#line 958 "ctangle.w"
984{985{
985id_first= --loc;986id_first= --loc;
986while(isalpha(*++loc)||isdigit(*loc)||isxalpha(*loc)||ishigh(*loc));987while(isalpha(*++loc)||isdigit(*loc)||isxalpha(*loc)||ishigh(*loc));
@@ -988,10 +989,10 @@ id_loc= loc;return(identifier); · 1 unmodified line
988}989}
989 990
990/*:65*/991/*:65*/
991#line 913 "ctangle.w"992#line 914 "ctangle.w"
992 993
993else if(c=='@')/*68:*/994else if(c=='@')/*68:*/
994#line 1038 "ctangle.w"995#line 1039 "ctangle.w"
995{996{
996c= ccode[(eight_bits)*loc++];997c= ccode[(eight_bits)*loc++];
997switch(c){998switch(c){
@@ -1008,11 +1009,11 @@ continue; · 10 unmodified lines
1008case section_name:1009case section_name:
1009cur_section_name_char= *(loc-1);1010cur_section_name_char= *(loc-1);
1010/*70:*/1011/*70:*/
1011#line 1087 "ctangle.w"1012#line 1088 "ctangle.w"
1012{1013{
1013char*k;1014char*k;
1014/*72:*/1015/*72:*/
1015#line 1107 "ctangle.w"1016#line 1108 "ctangle.w"
1016 1017
1017k= section_text;1018k= section_text;
1018while(1){1019while(1){
@@ -1023,7 +1024,7 @@ loc= buffer+1;break; · 4 unmodified lines
1023}1024}
1024c= *loc;1025c= *loc;
1025/*73:*/1026/*73:*/
1026#line 1131 "ctangle.w"1027#line 1132 "ctangle.w"
1027 1028
1028if(c=='@'){1029if(c=='@'){
1029c= *(loc+1);1030c= *(loc+1);
@@ -1042,7 +1043,7 @@ err_print("! Nesting of section names not allowed");break; · 12 unmodified lines
1042}1043}
1043 1044
1044/*:73*/1045/*:73*/
1045#line 1116 "ctangle.w"1046#line 1117 "ctangle.w"
1046;1047;
1047loc++;if(k<section_text_end)k++;1048loc++;if(k<section_text_end)k++;
1048if(xisspace(c)){1049if(xisspace(c)){
@@ -1059,7 +1060,7 @@ printf("...");mark_harmless; · 10 unmodified lines
1059if(*k==' '&&k>section_text)k--;1060if(*k==' '&&k>section_text)k--;
1060 1061
1061/*:72*/1062/*:72*/
1062#line 1089 "ctangle.w"1063#line 1090 "ctangle.w"
1063;1064;
1064if(k-section_text>3&&strncmp(k-2,"...",3)==0)1065if(k-section_text>3&&strncmp(k-2,"...",3)==0)
1065cur_section_name= section_lookup(section_text+1,k-3,1);1066cur_section_name= section_lookup(section_text+1,k-3,1);
@@ -1082,16 +1083,16 @@ overflow("output files"); · 16 unmodified lines
1082}1083}
1083 1084
1084/*:40*/1085/*:40*/
1085#line 1095 "ctangle.w"1086#line 1096 "ctangle.w"
1086;1087;
1087return(section_name);1088return(section_name);
1088}1089}
1089 1090
1090/*:70*/1091/*:70*/
1091#line 1053 "ctangle.w"1092#line 1054 "ctangle.w"
1092;1093;
1093case string:/*74:*/1094case string:/*74:*/
1094#line 1153 "ctangle.w"1095#line 1154 "ctangle.w"
1095{1096{
1096id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';1097id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
1097while(*loc!='@'||*(loc+1)!='>')loc++;1098while(*loc!='@'||*(loc+1)!='>')loc++;
@@ -1102,10 +1103,10 @@ return(string); · 4 unmodified lines
1102}1103}
1103 1104
1104/*:74*/1105/*:74*/
1105#line 1054 "ctangle.w"1106#line 1055 "ctangle.w"
1106;1107;
1107case ord:/*69:*/1108case ord:/*69:*/
1108#line 1066 "ctangle.w"1109#line 1067 "ctangle.w"
1109 1110
1110id_first= loc;1111id_first= loc;
1111if(*loc=='\\'){1112if(*loc=='\\'){
@@ -1128,14 +1129,14 @@ loc++; · 16 unmodified lines
1128return(ord);1129return(ord);
1129 1130
1130/*:69*/1131/*:69*/
1131#line 1055 "ctangle.w"1132#line 1056 "ctangle.w"
1132;1133;
1133default:return(c);1134default:return(c);
1134}1135}
1135}1136}
1136 1137
1137/*:68*/1138/*:68*/
1138#line 914 "ctangle.w"1139#line 915 "ctangle.w"
1139 1140
1140else if(xisspace(c)){1141else if(xisspace(c)){
1141if(!preprocessing||loc>limit)continue;1142if(!preprocessing||loc>limit)continue;
@@ -1144,7 +1145,7 @@ else return(' '); · 2 unmodified lines
1144}1145}
1145else if(c=='#'&&loc==buffer+1)preprocessing= 1;1146else if(c=='#'&&loc==buffer+1)preprocessing= 1;
1146mistake:/*64:*/1147mistake:/*64:*/
1147#line 935 "ctangle.w"1148#line 936 "ctangle.w"
1148 1149
1149switch(c){1150switch(c){
1150case'+':if(*loc=='+')compress(plus_plus);break;1151case'+':if(*loc=='+')compress(plus_plus);break;
@@ -1168,14 +1169,14 @@ case'!':if(*loc=='=')compress(not_eq);break; · 17 unmodified lines
1168}1169}
1169 1170
1170/*:64*/1171/*:64*/
1171#line 921 "ctangle.w"1172#line 922 "ctangle.w"
1172 1173
1173return(c);1174return(c);
1174}1175}
1175}1176}
1176 1177
1177/*:63*//*76:*/1178/*:63*//*76:*/
1178#line 1185 "ctangle.w"1179#line 1189 "ctangle.w"
1179 1180
1180void1181void
1181scan_repl(t)1182scan_repl(t)
@@ -1183,7 +1184,7 @@ eight_bits t; · 1 unmodified line
1183{1184{
1184sixteen_bits a;1185sixteen_bits a;
1185if(t==section_name){/*77:*/1186if(t==section_name){/*77:*/
1186#line 1208 "ctangle.w"1187#line 1215 "ctangle.w"
1187 1188
1188store_two_bytes(0150000);1189store_two_bytes(0150000);
1189if(changing)id_first= change_file_name;1190if(changing)id_first= change_file_name;
@@ -1191,23 +1192,23 @@ else id_first= cur_file_name; · 1 unmodified line
1191id_loc= id_first+strlen(id_first);1192id_loc= id_first+strlen(id_first);
1192if(changing)store_two_bytes((sixteen_bits)change_line);1193if(changing)store_two_bytes((sixteen_bits)change_line);
1193else store_two_bytes((sixteen_bits)cur_line);1194else store_two_bytes((sixteen_bits)cur_line);
1194{int a= id_lookup(id_first,id_loc)-name_dir;app_repl((a/0400)+0200);1195{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
1195app_repl(a%0400);}1196app_repl(a%0400);}
1196 1197
1197/*:77*/1198/*:77*/
1198#line 1191 "ctangle.w"1199#line 1195 "ctangle.w"
1199;}1200;}
1200while(1)switch(a= get_next()){1201while(1)switch(a= get_next()){
1201/*78:*/1202/*78:*/
1202#line 1218 "ctangle.w"1203#line 1225 "ctangle.w"
1203 1204
1204case identifier:a= id_lookup(id_first,id_loc)-name_dir;1205case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;
1205app_repl((a/0400)+0200);1206app_repl((a/0400)+0200);
1206app_repl(a%0400);break;1207app_repl(a%0400);break;
1207case section_name:if(t!=section_name)goto done;1208case section_name:if(t!=section_name)goto done;
1208else{1209else{
1209/*79:*/1210/*79:*/
1210#line 1246 "ctangle.w"1211#line 1253 "ctangle.w"
1211{1212{
1212char*try_loc= loc;1213char*try_loc= loc;
1213while(*try_loc==' '&&try_loc<limit)try_loc++;1214while(*try_loc==' '&&try_loc<limit)try_loc++;
@@ -1220,13 +1221,13 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section"); · 6 unmodified lines
1220}1221}
1221 1222
1222/*:79*/1223/*:79*/
1223#line 1224 "ctangle.w"1224#line 1231 "ctangle.w"
1224;1225;
1225a= cur_section_name-name_dir;1226a= cur_section_name-name_dir;
1226app_repl((a/0400)+0250);1227app_repl((a/0400)+0250);
1227app_repl(a%0400);1228app_repl(a%0400);
1228/*77:*/1229/*77:*/
1229#line 1208 "ctangle.w"1230#line 1215 "ctangle.w"
1230 1231
1231store_two_bytes(0150000);1232store_two_bytes(0150000);
1232if(changing)id_first= change_file_name;1233if(changing)id_first= change_file_name;
@@ -1234,11 +1235,11 @@ else id_first= cur_file_name; · 1 unmodified line
1234id_loc= id_first+strlen(id_first);1235id_loc= id_first+strlen(id_first);
1235if(changing)store_two_bytes((sixteen_bits)change_line);1236if(changing)store_two_bytes((sixteen_bits)change_line);
1236else store_two_bytes((sixteen_bits)cur_line);1237else store_two_bytes((sixteen_bits)cur_line);
1237{int a= id_lookup(id_first,id_loc)-name_dir;app_repl((a/0400)+0200);1238{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
1238app_repl(a%0400);}1239app_repl(a%0400);}
1239 1240
1240/*:77*/1241/*:77*/
1241#line 1228 "ctangle.w"1242#line 1235 "ctangle.w"
1242;break;1243;break;
1243}1244}
1244case output_defs_code:1245case output_defs_code:
@@ -1246,7 +1247,7 @@ a= output_defs_flag; · 1 unmodified line
1246app_repl((a/0400)+0200);1247app_repl((a/0400)+0200);
1247app_repl(a%0400);1248app_repl(a%0400);
1248/*77:*/1249/*77:*/
1249#line 1208 "ctangle.w"1250#line 1215 "ctangle.w"
1250 1251
1251store_two_bytes(0150000);1252store_two_bytes(0150000);
1252if(changing)id_first= change_file_name;1253if(changing)id_first= change_file_name;
@@ -1254,15 +1255,15 @@ else id_first= cur_file_name; · 1 unmodified line
1254id_loc= id_first+strlen(id_first);1255id_loc= id_first+strlen(id_first);
1255if(changing)store_two_bytes((sixteen_bits)change_line);1256if(changing)store_two_bytes((sixteen_bits)change_line);
1256else store_two_bytes((sixteen_bits)cur_line);1257else store_two_bytes((sixteen_bits)cur_line);
1257{int a= id_lookup(id_first,id_loc)-name_dir;app_repl((a/0400)+0200);1258{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
1258app_repl(a%0400);}1259app_repl(a%0400);}
1259 1260
1260/*:77*/1261/*:77*/
1261#line 1234 "ctangle.w"1262#line 1241 "ctangle.w"
1262;break;1263;break;
1263case constant:case string:1264case constant:case string:
1264/*80:*/1265/*80:*/
1265#line 1257 "ctangle.w"1266#line 1264 "ctangle.w"
1266 1267
1267app_repl(a);1268app_repl(a);
1268while(id_first<id_loc){1269while(id_first<id_loc){
@@ -1276,11 +1277,11 @@ app_repl(*id_first++); · 7 unmodified lines
1276app_repl(a);break;1277app_repl(a);break;
1277 1278
1278/*:80*/1279/*:80*/
1279#line 1236 "ctangle.w"1280#line 1243 "ctangle.w"
1280;1281;
1281case ord:1282case ord:
1282/*81:*/1283/*81:*/
1283#line 1273 "ctangle.w"1284#line 1280 "ctangle.w"
1284{1285{
1285int c= (eight_bits)*id_first;1286int c= (eight_bits)*id_first;
1286if(c=='\\'){1287if(c=='\\'){
@@ -1331,7 +1332,7 @@ app_repl(constant); · 44 unmodified lines
1331break;1332break;
1332 1333
1333/*:81*/1334/*:81*/
1334#line 1238 "ctangle.w"1335#line 1245 "ctangle.w"
1335;1336;
1336case definition:case format_code:case begin_C:if(t!=section_name)goto done;1337case definition:case format_code:case begin_C:if(t!=section_name)goto done;
1337else{1338else{
@@ -1341,8 +1342,11 @@ err_print("! @d, @f and @c are ignored in C text");continue; · 3 unmodified lines
1341case new_section:goto done;1342case new_section:goto done;
1342 1343
1343/*:78*/1344/*:78*/
1344#line 1196 "ctangle.w"1345#line 1200 "ctangle.w"
1345 1346
1347case')':app_repl(a);
1348if(t==macro)app_repl(' ');
1349break;
1346default:app_repl(a);1350default:app_repl(a);
1347}1351}
1348done:next_control= (eight_bits)a;1352done:next_control= (eight_bits)a;
@@ -1351,7 +1355,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr; · 2 unmodified lines
1351}1355}
1352 1356
1353/*:76*//*83:*/1357/*:76*//*83:*/
1354#line 1335 "ctangle.w"1358#line 1342 "ctangle.w"
1355 1359
1356void1360void
1357scan_section()1361scan_section()
@@ -1359,14 +1363,14 @@ scan_section() · 1 unmodified line
1359name_pointer p;1363name_pointer p;
1360text_pointer q;1364text_pointer q;
1361sixteen_bits a;1365sixteen_bits a;
1362section_count++;1366section_count++;no_where= 1;
1363if(*(loc-1)=='*'&&show_progress){1367if(*(loc-1)=='*'&&show_progress){
1364printf("*%d",section_count);update_terminal;1368printf("*%d",section_count);update_terminal;
1365}1369}
1366next_control= 0;1370next_control= 0;
1367while(1){1371while(1){
1368/*84:*/1372/*84:*/
1369#line 1373 "ctangle.w"1373#line 1381 "ctangle.w"
1370 1374
1371while(next_control<definition)1375while(next_control<definition)
1372 1376
@@ -1375,11 +1379,11 @@ loc-= 2;next_control= get_next(); · 2 unmodified lines
1375}1379}
1376 1380
1377/*:84*/1381/*:84*/
1378#line 1349 "ctangle.w"1382#line 1356 "ctangle.w"
1379;1383;
1380if(next_control==definition){1384if(next_control==definition){
1381/*85:*/1385/*85:*/
1382#line 1380 "ctangle.w"1386#line 1388 "ctangle.w"
1383{1387{
1384while((next_control= get_next())=='\n');1388while((next_control= get_next())=='\n');
1385if(next_control!=identifier){1389if(next_control!=identifier){
@@ -1387,18 +1391,18 @@ err_print("! Definition flushed, must start with identifier"); · 1 unmodified line
1387 1391
1388continue;1392continue;
1389}1393}
1390app_repl(((a= id_lookup(id_first,id_loc)-name_dir)/0400)+0200);1394app_repl(((a= id_lookup(id_first,id_loc,0)-name_dir)/0400)+0200);
1391 1395
1392app_repl(a%0400);1396app_repl(a%0400);
1393if(*loc!='('){1397if(*loc!='('){
1394app_repl(string);app_repl(' ');app_repl(string);1398app_repl(string);app_repl(' ');app_repl(string);
1395}1399}
1396print_where= 0;scan_repl(macro);1400scan_repl(macro);
1397cur_text->text_link= 0;1401cur_text->text_link= 0;
1398}1402}
1399 1403
1400/*:85*/1404/*:85*/
1401#line 1351 "ctangle.w"1405#line 1358 "ctangle.w"
1402 1406
1403continue;1407continue;
1404}1408}
@@ -1408,34 +1412,35 @@ p= name_dir;break; · 3 unmodified lines
1408if(next_control==section_name){1412if(next_control==section_name){
1409p= cur_section_name;1413p= cur_section_name;
1410/*86:*/1414/*86:*/
1411#line 1405 "ctangle.w"1415#line 1413 "ctangle.w"
1412 1416
1413while((next_control= get_next())=='+');1417while((next_control= get_next())=='+');
1414if(next_control!='='&&next_control!=eq_eq)1418if(next_control!='='&&next_control!=eq_eq)
1415continue;1419continue;
1416 1420
1417/*:86*/1421/*:86*/
1418#line 1359 "ctangle.w"1422#line 1366 "ctangle.w"
1419;1423;
1420break;1424break;
1421}1425}
1422return;1426return;
1423}1427}
1428no_where= print_where= 0;
1424/*87:*/1429/*87:*/
1425#line 1410 "ctangle.w"1430#line 1418 "ctangle.w"
1426 1431
1427/*88:*/1432/*88:*/
1428#line 1415 "ctangle.w"1433#line 1423 "ctangle.w"
1429 1434
1430store_two_bytes((sixteen_bits)(0150000+section_count));1435store_two_bytes((sixteen_bits)(0150000+section_count));
1431 1436
1432 1437
1433/*:88*/1438/*:88*/
1434#line 1411 "ctangle.w"1439#line 1419 "ctangle.w"
1435;1440;
1436scan_repl(section_name);1441scan_repl(section_name);
1437/*89:*/1442/*89:*/
1438#line 1419 "ctangle.w"1443#line 1427 "ctangle.w"
1439 1444
1440if(p==name_dir||p==0){1445if(p==name_dir||p==0){
1441(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;1446(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
@@ -1452,16 +1457,16 @@ cur_text->text_link= section_flag; · 10 unmodified lines
1452 1457
1453 1458
1454/*:89*/1459/*:89*/
1455#line 1413 "ctangle.w"1460#line 1421 "ctangle.w"
1456;1461;
1457 1462
1458/*:87*/1463/*:87*/
1459#line 1364 "ctangle.w"1464#line 1372 "ctangle.w"
1460;1465;
1461}1466}
1462 1467
1463/*:83*//*91:*/1468/*:83*//*91:*/
1464#line 1437 "ctangle.w"1469#line 1445 "ctangle.w"
1465 1470
1466void1471void
1467phase_one(){1472phase_one(){
@@ -1475,7 +1480,7 @@ phase= 2; · 7 unmodified lines
1475}1480}
1476 1481
1477/*:91*//*93:*/1482/*:91*//*93:*/
1478#line 1455 "ctangle.w"1483#line 1463 "ctangle.w"
1479 1484
1480void1485void
1481skip_limbo()1486skip_limbo()
@@ -1490,7 +1495,7 @@ c= *loc++; · 8 unmodified lines
1490if(ccode[(eight_bits)c]==new_section)break;1495if(ccode[(eight_bits)c]==new_section)break;
1491switch(ccode[(eight_bits)c]){1496switch(ccode[(eight_bits)c]){
1492case translit_code:/*94:*/1497case translit_code:/*94:*/
1493#line 1484 "ctangle.w"1498#line 1492 "ctangle.w"
1494 1499
1495while(xisspace(*loc)&&loc<limit)loc++;1500while(xisspace(*loc)&&loc<limit)loc++;
1496loc+= 3;1501loc+= 3;
@@ -1515,7 +1520,7 @@ translit[i-0200][loc-beg]= '\0'; · 18 unmodified lines
1515}1520}
1516 1521
1517/*:94*/1522/*:94*/
1518#line 1468 "ctangle.w"1523#line 1476 "ctangle.w"
1519;break;1524;break;
1520case format_code:case'@':break;1525case format_code:case'@':break;
1521case control_text:if(c=='q'||c=='Q'){1526case control_text:if(c=='q'||c=='Q'){
@@ -1533,7 +1538,7 @@ default:err_print("! Double @ should be used in limbo"); · 11 unmodified lines
1533}1538}
1534 1539
1535/*:93*//*95:*/1540/*:93*//*95:*/
1536#line 1510 "ctangle.w"1541#line 1518 "ctangle.w"
1537 1542
1538void1543void
1539print_stats(){1544print_stats(){

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