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