diff options
Diffstat (limited to 'web/matlabweb/weave.c')
-rw-r--r-- | web/matlabweb/weave.c | 4959 |
1 files changed, 4959 insertions, 0 deletions
diff --git a/web/matlabweb/weave.c b/web/matlabweb/weave.c new file mode 100644 index 0000000000..0e6b28f57b --- /dev/null +++ b/web/matlabweb/weave.c @@ -0,0 +1,4959 @@ +/*1:*/ +#line 169 "weave.web" + +#line 21 "theweave.ch" +/*5:*/ +#line 32 "common.h" + +#include<stdio.h> + +/*:5*//*37:*/ +#line 652 "weave.web" + +#include"ctype.h" + +/*:37*/ +#line 21 "theweave.ch" + +#define WEAVE 1 +#line 171 "weave.web" +/*4:*/ +#line 26 "common.h" + +typedef short boolean; +typedef char unsigned eight_bits; +extern boolean program; +extern int phase; + +/*:4*//*6:*/ +#line 41 "common.h" + +typedef char ASCII; +typedef char outer_char; +extern ASCII xord[]; +extern outer_char xchr[]; +ASCII mod_text[400+1]; +ASCII *mod_text_end= mod_text+400; +ASCII *id_first; +ASCII *id_loc; + +/*:6*//*7:*/ +#line 54 "common.h" + +extern ASCII buffer[]; +extern ASCII *buffer_end; +extern ASCII *loc; +extern ASCII *limit; + +/*:7*//*8:*/ +#line 72 "common.h" + +typedef struct name_info{ +ASCII *byte_start; +struct name_info *link; +union{ +struct name_info *Rlink; + +eight_bits Ilk; + +}dummy; +ASCII *equiv_or_xref; +}name_info; + +typedef name_info *name_pointer; +typedef name_pointer *hash_pointer; + +extern ASCII byte_mem[]; +extern ASCII *byte_mem_end; +extern name_info name_dir[]; +extern name_pointer name_dir_end; +extern name_pointer name_ptr; +extern ASCII *byte_ptr; +extern name_pointer hash[]; +extern hash_pointer hash_end; +extern hash_pointer h; +extern name_pointer id_lookup(); +extern name_pointer mod_lookup(); +extern name_pointer prefix_lookup(); + +/*:8*//*9:*/ +#line 117 "common.h" + +extern history; + +/*:9*//*10:*/ +#line 129 "common.h" + +extern include_depth; +extern FILE *file[]; +extern FILE *change_file; +extern char C_file_name[]; +extern char tex_file_name[]; +extern char file_name[][60]; + +extern char change_file_name[]; +extern line[]; +extern change_line; +extern boolean input_has_ended; +extern boolean changing; + +/*:10*//*11:*/ +#line 144 "common.h" + +typedef unsigned short sixteen_bits; +extern sixteen_bits module_count; +extern boolean changed_module[]; +extern boolean print_where; + +/*:11*//*12:*/ +#line 151 "common.h" + +extern int argc; +extern char * *argv; +extern no_xref; + +/*:12*//*13:*/ +#line 164 "common.h" + +FILE *C_file; +FILE *tex_file; +#line 217 "weave.web" + +/*:13*/ +#line 171 "weave.web" + +/*18:*/ +#line 299 "weave.web" + +typedef struct xref_info{ +sixteen_bits num; +struct xref_info *xlink; +}xref_info; +typedef xref_info *xref_pointer; + +/*:18*//*24:*/ +#line 411 "weave.web" + +typedef sixteen_bits token; +typedef token *token_pointer; +typedef token_pointer *text_pointer; + +/*:24*//*116:*/ +#line 1581 "weave.web" + +typedef struct{ +eight_bits cat; +eight_bits mathness; +union{ +text_pointer Trans; + /*221:*/ +#line 3298 "weave.web" + +name_pointer Head; + +/*:221*/ +#line 1587 "weave.web" + +}trans_plus; +}scrap; +typedef scrap *scrap_pointer; + +/*:116*//*171:*/ +#line 2428 "weave.web" +typedef int mode; +typedef struct{ +token_pointer end_field; +token_pointer tok_field; +boolean mode_field; +}output_state; +typedef output_state *stack_pointer; + +/*:171*/ +#line 172 "weave.web" + +/*17:*/ +#line 274 "weave.web" + +boolean change_exists; + +/*:17*//*19:*/ +#line 306 "weave.web" + +xref_info xmem[20000]; +xref_pointer xmem_end= xmem+20000-1; +xref_pointer xref_ptr; +sixteen_bits xref_switch,mod_xref_switch; + +/*:19*//*25:*/ +#line 421 "weave.web" + +token tok_mem[20000]; +token_pointer tok_mem_end= tok_mem+20000-1; +token_pointer tok_start[4000]; +token_pointer tok_ptr; +text_pointer text_ptr; +text_pointer tok_start_end= tok_start+4000-1; +#ifdef STAT +token_pointer max_tok_ptr; +text_pointer max_text_ptr; +#endif STAT + +/*:25*//*31:*/ +#line 529 "weave.web" + +eight_bits ccode[128]; + +/*:31*//*36:*/ +#line 648 "weave.web" + +name_pointer cur_module; +int math_flag; + +/*:36*//*53:*/ +#line 853 "weave.web" +ASCII cur_module_char; + +/*:53*//*59:*/ +#line 937 "weave.web" + +eight_bits next_control; + +/*:59*//*65:*/ +#line 1050 "weave.web" + +name_pointer lhs,rhs; + +/*:65*//*69:*/ +#line 1099 "weave.web" + +xref_pointer cur_xref; + +/*:69*//*72:*/ +#line 1146 "weave.web" + +ASCII out_buf[80+1]; +ASCII *out_ptr; +ASCII *out_buf_end= out_buf+80; +int out_line; + +/*:72*//*83:*/ +#line 1338 "weave.web" +eight_bits next_control; + +/*:83*//*115:*/ +#line 1157 "grammar.web" +char the_at_sign= 64; + +#line 1548 "weave.web" + +/*:115*//*117:*/ +#line 1601 "weave.web" + +scrap scrap_info[2000]; +scrap_pointer scrap_info_end= scrap_info+2000-1; +scrap_pointer pp; +scrap_pointer scrap_base; +scrap_pointer scrap_ptr; +scrap_pointer lo_ptr; +scrap_pointer hi_ptr; +#ifdef STAT +scrap_pointer max_scr_ptr; +#endif STAT + +/*:117*//*121:*/ +#line 1742 "weave.web" + +int init_mathness,last_mathness; + +/*:121*//*134:*/ +#line 2018 "weave.web" + +#ifdef DEBUG +int tracing; +#endif DEBUG + +/*:134*//*165:*/ +#line 362 "scraps.web" +char C_file_extension[]= "m"; +/*:165*//*172:*/ +#line 2441 "weave.web" + +output_state cur_state; +output_state stack[400 +#line 215 "weave.web" + +#line 1 "common.h" +]; +stack_pointer stack_ptr; +stack_pointer stack_end= stack+400 +#line 215 "weave.web" + +#line 1 "common.h" +-1; +#ifdef STAT +stack_pointer max_stack_ptr; +#endif STAT + +/*:172*//*176:*/ +#line 2493 "weave.web" + +name_pointer cur_name; + +/*:176*//*192:*/ +#line 2823 "weave.web" + +int save_line; +ASCII *save_place; +boolean format_visible; +boolean doing_format= 0; + +/*:192*//*204:*/ +#line 3040 "weave.web" + +name_pointer this_module; + +/*:204*//*209:*/ +#line 3116 "weave.web" + +xref_pointer next_xref,this_xref,first_xref,mid_xref; + + +/*:209*//*214:*/ +#line 3207 "weave.web" + +extern int no_xref; + +/*:214*//*216:*/ +#line 3238 "weave.web" + +sixteen_bits k_module; + +/*:216*//*218:*/ +#line 3264 "weave.web" + +name_pointer bucket[128]; +name_pointer next_name; +hash_pointer h; +name_pointer blink[4000]; + +/*:218*//*222:*/ +#line 3308 "weave.web" + +eight_bits cur_depth; +ASCII *cur_byte; +sixteen_bits cur_val; +#ifdef STAT +scrap_pointer max_sort_ptr; +#endif STAT + +/*:222*//*224:*/ +#line 3325 "weave.web" + +ASCII collate[102]; + +/*:224*//*234:*/ +#line 3487 "weave.web" +boolean do_file; +/*:234*/ +#line 173 "weave.web" + + +main(ac,av) +char * *av; +{ +argc= ac;argv= av; +program= 1; +common_init(); +/*20:*/ +#line 316 "weave.web" + +name_dir->equiv_or_xref= (ASCII *)xmem; +xref_ptr= xmem; +xref_switch= 0; +mod_xref_switch= 0; +xmem->num= 0; + +/*:20*//*26:*/ +#line 433 "weave.web" + +tok_ptr= tok_mem+1;text_ptr= tok_start+1;tok_start[0]= tok_mem+1; +tok_start[1]= tok_mem+1; + +#ifdef STAT +max_tok_ptr= tok_mem+1;max_text_ptr= tok_start+1; +#endif STAT + +/*:26*//*32:*/ +#line 536 "weave.web" + +{int c;for(c= 0;c<=127;c++)ccode[c]= 0;} +ccode[' ']= ccode[011]= ccode['*']= 255; +ccode['-']= 244; +ccode['#']= 245; +ccode['=']= 2; +ccode['d']= ccode['D']= 252; +ccode['f']= ccode['F']= 251; +ccode['s']= ccode['S']= 251; +ccode['c']= ccode['C']= 253; +ccode['u']= ccode['U']= 253; +ccode['t']= ccode['T']= 238; +ccode['&']= 240; +ccode['<']= ccode['(']= 254; +ccode['!']= 126;ccode['^']= (200+1); +ccode['$']= 125; +ccode[':']= (200+2); +ccode['.']= (200+3); +ccode[',']= 241; +ccode['|']= 242; +ccode['/']= 243; +ccode['+']= 246; +ccode[';']= 247; +ccode['`']= 239; +#line 78 "theweave.ch" +ccode['\'']= 12; +ccode['"']= 13; +ccode['\%']= 9; +#line 562 "weave.web" +/*33:*/ +#line 574 "weave.web" + +#ifdef DEBUG +ccode['0']= ccode['1']= ccode['2']= 249; +#endif DEBUG + +/*:33*/ +#line 562 "weave.web" + + + + + +ccode['@']= ccode[64]; +ccode[64]= 64; + +/*:32*//*54:*/ +#line 861 "weave.web" +mod_text[0]= ' '; + +/*:54*//*75:*/ +#line 1205 "weave.web" + +out_ptr= out_buf+1;out_line= 1; +/*164:*/ +#line 360 "scraps.web" + + *out_ptr= 'x';fprintf(tex_file,"\\input mweb.te"); +/*:164*/ +#line 1207 "weave.web" + + +/*:75*//*77:*/ +#line 1237 "weave.web" + +out_buf[0]= '\\'; + +/*:77*//*118:*/ +#line 1613 "weave.web" + +scrap_base= scrap_info+1; +#ifdef STAT +max_scr_ptr= +#endif STAT +scrap_ptr= scrap_info; + +/*:118*//*173:*/ +#line 2450 "weave.web" + +#ifdef STAT +max_stack_ptr= stack; +#endif STAT + +/*:173*//*223:*/ +#line 3316 "weave.web" + +#ifdef STAT +max_sort_ptr= scrap_info; +#endif STAT + + +/*:223*//*225:*/ +#line 3331 "weave.web" + +collate[0]= 0;strcpy(collate+1," \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\ +\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\ +!\42#$%&'()*+,-./:;<=>?@[\\]^`{|}~_\ +abcdefghijklmnopqrstuvwxyz0123456789"); + +/*:225*/ +#line 181 "weave.web" +; +printf("This is Matlab WEAVE (generated at 12:51 PM on January 27, 2000)\n"); +/*16:*/ +#line 262 "weave.web" + + +id_lookup("TeX",NULL,4); + + + + +/*:16*//*163:*/ +#line 336 "scraps.web" + +id_lookup("function",NULL,65); +id_lookup("end",NULL,69); +id_lookup("switch",NULL,64); +id_lookup("global",NULL,75); +id_lookup("_fquotel",NULL,67); +id_lookup("else",NULL,73); +id_lookup("otherwise",NULL,73); +id_lookup("catch",NULL,73); +id_lookup("break",NULL,79); +id_lookup("for",NULL,68); +id_lookup("clear",NULL,77); +id_lookup("_fquoter",NULL,72); +id_lookup("elseif",NULL,76); +id_lookup("_transposed",NULL,66); +id_lookup("try",NULL,78); +id_lookup("case",NULL,76); +id_lookup("return",NULL,79); +id_lookup("pi",NULL,74); +id_lookup("inf",NULL,70); +id_lookup("while",NULL,71); +id_lookup("if",NULL,71); +/*:163*/ +#line 183 "weave.web" +; +phase_one(); +phase_two(); +phase_three(); +#ifdef STAT +/*236:*/ +#line 3496 "weave.web" + +printf( +"\nMemory usage statistics: %d of %d names, %d of %d cross-references,\n", +name_ptr-name_dir,name_dir_end-name_dir, +xref_ptr-xmem,xmem_end-xmem); +printf("\t %d of %d bytes;",byte_ptr-byte_mem,byte_mem_end-byte_mem); +printf("\nParsing required %d of %d(%d) scraps, %d of %d(%d) texts,\n", +max_scr_ptr-scrap_info,2000,2000-50, +max_text_ptr-tok_start,4000,4000-50 +); +printf("\t %d of %d(%d) tokens, %d of %d levels;\n", +max_tok_ptr-tok_mem,20000,20000-50, +max_stack_ptr-stack,stack_end-stack +); +printf("\nSorting required %d levels\n",max_sort_ptr-scrap_info); + +/*:236*/ +#line 188 "weave.web" +; +#endif STAT +wrap_up(); +} + +/*:1*//*21:*/ +#line 335 "weave.web" +new_xref(p) +name_pointer p; +{ +xref_pointer q; +sixteen_bits m,n; +if(no_xref)return; +if(((p->dummy.Ilk>3)||((p+1)->byte_start-(p)->byte_start)==1)&&xref_switch==0)return; +m= module_count+xref_switch;xref_switch= 0;q= (xref_pointer)p->equiv_or_xref; +if(q!=xmem){ +n= q->num; +if(n==m||n==m+10240)return; +else if(m==n+10240){ +q->num= m;return; +} +} +if(xref_ptr==xmem_end)stat_overflow("cross-reference");else(++xref_ptr)->num= m;;xref_ptr->xlink= q;p->equiv_or_xref= (ASCII *)xref_ptr; +} + +/*:21*//*22:*/ +#line 367 "weave.web" +new_mod_xref(p) +name_pointer p; +{ +xref_pointer q,r; +q= (xref_pointer)p->equiv_or_xref; +r= xmem; +if(q>xmem){ +if(mod_xref_switch==0)while(q->num>=10240){ +r= q; +q= q->xlink; +} +else if(q->num>=10240){ +/*23:*/ +#line 393 "weave.web" + +{ +if((mod_xref_switch==10240&&q->num>=2 *10240)|| +(mod_xref_switch==2 *10240&&q->num<2 *10240)){ +printf("\n! You can't use <");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start)); +printf("> both as a file and as a named module");{if(history==0)history= 1;}; + + +} +} + + +/*:23*/ +#line 379 "weave.web" + +r= q; +q= q->xlink; +} +} +if(q->num==(module_count+mod_xref_switch))return; + +if(xref_ptr==xmem_end)stat_overflow("cross-reference");else(++xref_ptr)->num= module_count+mod_xref_switch;; +xref_ptr->xlink= q;mod_xref_switch= 0; +if(r==xmem)p->equiv_or_xref= (ASCII *)xref_ptr; +else r->xlink= xref_ptr; +} + +/*:22*//*27:*/ +#line 441 "weave.web" + +names_match(p,first,l,t) +name_pointer p; +ASCII *first; +int l; +eight_bits t; +{ +if(((p+1)->byte_start-(p)->byte_start)!=l)return 0; +if(p->dummy.Ilk!=t&&!(t==0&&(p->dummy.Ilk>3)))return 0; +return!strncmp(first,p->byte_start,l); +} + +init_p(p,t) +name_pointer p; +eight_bits t; +{ +p->dummy.Ilk= t;p->equiv_or_xref= (ASCII *)xmem; +} + +init_node(p) +name_pointer p; +{ +p->equiv_or_xref= (ASCII *)xmem; +} + +/*:27*//*34:*/ +#line 584 "weave.web" +skip_limbo(){ +while(1){ +if(loc>limit&&get_line()==0)return; + *(limit+1)= 64; +while( *loc!=64)loc++; +if(loc++<=limit)if(ccode[ *loc++]==255)return; +} +} + +/*:34*//*35:*/ +#line 598 "weave.web" +unsigned skip_TeX() +{ +while(1){ +if(loc>limit&&get_line()==0)return(255); + *(limit+1)= 64; +while( *loc!=64&& *loc!=124)loc++; +if( *loc++==124)return(248); +if(loc<=limit)return(ccode[ *(loc++)]); +} +} + +/*:35*//*38:*/ +#line 125 "theweave.ch" + +eight_bits previous_token,do_get_next(); +name_pointer previous_scrap; + +eight_bits get_next(see_vertical) +char see_vertical; +{ +eight_bits c; +c= do_get_next(see_vertical); +if(!(c==' '||c=='\t'||c=='\n'||c=='\v'||c=='\r'||c=='\f'||c==193)){ +previous_token= c; +if(c==200){ +previous_scrap= id_lookup(id_first,id_loc,0); +} +} +return(c); +} + + + +int fquote_level; +eight_bits do_get_next(see_vertical) +char see_vertical; +{ +eight_bits c; +while(1){ +if(loc>limit){ +if(get_line()==0)return(255); +else return(10); +} +c= *(loc++); +/*168:*/ +#line 367 "scraps.web" + +{int len;len= strlen("%"); +if(loc+len-1<=limit&&!strncmp(loc-1,"%",len)){ +loc+= len-1; +return(8 +#line 498 "weave.web" +); +} +} +/*:168*/ +#line 156 "theweave.ch" + +if(see_vertical&&c==124){ +if( *loc==124&&loc<limit)loc++; +else return 248; +} +if(isdigit(c)||c=='.')/*42:*/ +#line 712 "weave.web" +{ +id_first= id_loc= mod_text+1; + +if( *(loc-1)=='.'&&!isdigit( *loc))goto mistake; + *id_loc++= *(loc-1); +while(isdigit( *loc)) *id_loc++= *loc++; +if( *loc=='.'){ + *id_loc++= *loc++; +while(isdigit( *loc)) *id_loc++= *loc++; +} +#if defined C_FLOATING_POINT||defined MATLAB_FLOATING_POINT +if( *loc=='e'|| *loc=='E'){ + *id_loc++= '_';loc++; +if( *loc=='+'|| *loc=='-') *id_loc++= *loc++; +while(isdigit( *loc)) *id_loc++= *loc++; +} +#endif +#if defined MATLAB_FLOATING_POINT +if( *loc=='i'|| *loc=='I'){ + *id_loc++= 'i'; +loc++; +} +#endif +return(199); +} + + + +/*:42*/ +#line 161 "theweave.ch" + +else if(isalpha(c)||c=='_') +/*41:*/ +#line 703 "weave.web" +{ +id_first= --loc; +while(isalpha( *++loc)||isdigit( *loc)|| *loc=='_'); +id_loc= loc;return(200); +} + +/*:41*/ +#line 163 "theweave.ch" + +else if(c=='`'){ +fquote_level++; +return(32); +}else if(c=='"'){ +/*45:*/ +#line 296 "theweave.ch" + +{ +if((previous_token==200&&!strncmp((previous_scrap)->byte_start,"case",strlen("case")))) +previous_token= '('; + +switch(previous_token){ +case'(': +case'[':case'{': +case'+':case'-': +case'*':case 197: +case'^':case'\\': +case'/':case 195: +case':':case',': +case'=':case 192: +case'<':case 191: +case'>':case 189: +case 190:case'|': +case';': +/*46:*/ +#line 335 "theweave.ch" +{ +ASCII delim= c; +id_first= mod_text+1; +id_loc= mod_text; +if(delim=='`'&& *(loc-2)==64){ + + *++id_loc= 64; + *++id_loc= 64; +} + + *++id_loc= '\''; +if(delim=='`')delim= '\''; +while(1){ +if(loc>=limit)/*48:*/ +#line 389 "theweave.ch" + +{ +if( *(limit-1)!='\\'){ +err_print("! String didn't end");loc= limit;break; + +} +if(get_line()==0){ +err_print("! Input ended in middle of string");loc= buffer;break; + +} +} + + +/*:48*/ +#line 348 "theweave.ch" + +if((c= *loc++)==delim)/*47:*/ +#line 373 "theweave.ch" + +{ +if(++id_loc<=mod_text_end){ + *id_loc= c; +if( *loc==delim){ +if(++id_loc<=mod_text_end) + *id_loc= *loc++; +continue; +}else{ + *id_loc= '\''; +break; +} +} +} + +/*:47*/ +#line 349 "theweave.ch" + +if(c=='\\')/*49:*/ +#line 403 "theweave.ch" + +{ +if(loc>=limit)continue; +#if 0 +else if(++id_loc<=mod_text_end){ + *id_loc= '\\'; +c= *loc++; +} +#endif +} + + +#line 816 "weave.web" +/*:49*/ +#line 350 "theweave.ch" + +if(++id_loc<=mod_text_end) *id_loc= c; +} +if(id_loc>=mod_text_end){ +printf("\n! String too long: "); + +fflush(stdout),write(1,mod_text+1,25); +printf("...");history= 2; +} +id_loc++; +return(198); +} + + +/*:46*/ +#line 314 "theweave.ch" + +case')':case']': +case 199:case'.': +case 198:case 200: +#ifdef WEAVE +case 8 +#line 498 "weave.web" +: +return(15); +#else +return'\"'; +#endif +default: +err_print("! Unknown left context for quote"); +printf("\n character: %d = \'%c\'\n\n",previous_token, +previous_token); +return('\''); +} +} + + + +/*:45*/ +#line 168 "theweave.ch" + +}else if(c=='\''){ +if(fquote_level>0){ +fquote_level--; +return(5); +}else +/*45:*/ +#line 296 "theweave.ch" + +{ +if((previous_token==200&&!strncmp((previous_scrap)->byte_start,"case",strlen("case")))) +previous_token= '('; + +switch(previous_token){ +case'(': +case'[':case'{': +case'+':case'-': +case'*':case 197: +case'^':case'\\': +case'/':case 195: +case':':case',': +case'=':case 192: +case'<':case 191: +case'>':case 189: +case 190:case'|': +case';': +/*46:*/ +#line 335 "theweave.ch" +{ +ASCII delim= c; +id_first= mod_text+1; +id_loc= mod_text; +if(delim=='`'&& *(loc-2)==64){ + + *++id_loc= 64; + *++id_loc= 64; +} + + *++id_loc= '\''; +if(delim=='`')delim= '\''; +while(1){ +if(loc>=limit)/*48:*/ +#line 389 "theweave.ch" + +{ +if( *(limit-1)!='\\'){ +err_print("! String didn't end");loc= limit;break; + +} +if(get_line()==0){ +err_print("! Input ended in middle of string");loc= buffer;break; + +} +} + + +/*:48*/ +#line 348 "theweave.ch" + +if((c= *loc++)==delim)/*47:*/ +#line 373 "theweave.ch" + +{ +if(++id_loc<=mod_text_end){ + *id_loc= c; +if( *loc==delim){ +if(++id_loc<=mod_text_end) + *id_loc= *loc++; +continue; +}else{ + *id_loc= '\''; +break; +} +} +} + +/*:47*/ +#line 349 "theweave.ch" + +if(c=='\\')/*49:*/ +#line 403 "theweave.ch" + +{ +if(loc>=limit)continue; +#if 0 +else if(++id_loc<=mod_text_end){ + *id_loc= '\\'; +c= *loc++; +} +#endif +} + + +#line 816 "weave.web" +/*:49*/ +#line 350 "theweave.ch" + +if(++id_loc<=mod_text_end) *id_loc= c; +} +if(id_loc>=mod_text_end){ +printf("\n! String too long: "); + +fflush(stdout),write(1,mod_text+1,25); +printf("...");history= 2; +} +id_loc++; +return(198); +} + + +/*:46*/ +#line 314 "theweave.ch" + +case')':case']': +case 199:case'.': +case 198:case 200: +#ifdef WEAVE +case 8 +#line 498 "weave.web" +: +return(15); +#else +return'\"'; +#endif +default: +err_print("! Unknown left context for quote"); +printf("\n character: %d = \'%c\'\n\n",previous_token, +previous_token); +return('\''); +} +} + + + +/*:45*/ +#line 174 "theweave.ch" + +}else if(c==64) +/*50:*/ +#line 819 "weave.web" +{ +c= *loc++; +switch(ccode[c]){ +case 126:xref_switch= 10240;continue; +case 125:math_flag= !math_flag;continue; +#ifdef DEBUG +case 249:tracing= c-'0';continue; +#endif DEBUG +case(200+1):case(200+2):case(200+3): +case 238: +/*57:*/ +#line 900 "weave.web" +{ +c= ccode[ *(loc-1)];id_first= loc; *(limit+1)= 64; +while( *loc!=64)loc++; +id_loc= loc; +if(loc++>limit){ +err_print("! Control text didn't end");loc= limit;return(c); + +} +if( *loc++!='>')err_print("! Control codes are forbidden in control text"); + +return(c); +} + +/*:57*/ +#line 829 "weave.web" + +case 254: +/*52:*/ +#line 844 "weave.web" +{ +ASCII *k; +cur_module_char= c; +/*55:*/ +#line 863 "weave.web" + +k= mod_text; +while(1){ +if(loc>limit&&get_line()==0){ +err_print("! Input ended in section name"); + +loc= buffer+1;break; +} +c= *loc; +/*56:*/ +#line 887 "weave.web" + +if(c==64){ +c= *(loc+1); +if(c=='>'){ +loc+= 2;break; +} +if(ccode[c]==255){ +err_print("! Section name didn't end");break; + +} + *(++k)= 64;loc++; +} + +/*:56*/ +#line 872 "weave.web" +; +loc++;if(k<mod_text_end)k++; +if(c==' '||c==011){ +c= ' ';if( *(k-1)==' ')k--; +} + *k= c; +} +if(k>=mod_text_end){ +printf("\n! Section name too long: "); + +fflush(stdout),write(1,mod_text+1,25); +printf("...");{if(history==0)history= 1;}; +} +if( *k==' '&&k>mod_text)k--; + +/*:55*/ +#line 847 "weave.web" +; +if(k-mod_text>3&&strncmp(k-2,"...",3)==0)cur_module= prefix_lookup(mod_text+1,k-3); +else cur_module= mod_lookup(mod_text+1,k); +xref_switch= 0;return(254); +} + +/*:52*/ +#line 831 "weave.web" + +case 2:/*58:*/ +#line 918 "weave.web" +{ +id_first= loc++; *(limit+1)= 64; *(limit+2)= '>'; +while( *loc!=64|| *(loc+1)!='>')loc++; +if(loc>=limit)err_print("! Verbatim string didn't end"); + +id_loc= loc;loc+= 2; +return(2); +} + +/*:58*/ +#line 832 "weave.web" + +case 239: +/*46:*/ +#line 335 "theweave.ch" +{ +ASCII delim= c; +id_first= mod_text+1; +id_loc= mod_text; +if(delim=='`'&& *(loc-2)==64){ + + *++id_loc= 64; + *++id_loc= 64; +} + + *++id_loc= '\''; +if(delim=='`')delim= '\''; +while(1){ +if(loc>=limit)/*48:*/ +#line 389 "theweave.ch" + +{ +if( *(limit-1)!='\\'){ +err_print("! String didn't end");loc= limit;break; + +} +if(get_line()==0){ +err_print("! Input ended in middle of string");loc= buffer;break; + +} +} + + +/*:48*/ +#line 348 "theweave.ch" + +if((c= *loc++)==delim)/*47:*/ +#line 373 "theweave.ch" + +{ +if(++id_loc<=mod_text_end){ + *id_loc= c; +if( *loc==delim){ +if(++id_loc<=mod_text_end) + *id_loc= *loc++; +continue; +}else{ + *id_loc= '\''; +break; +} +} +} + +/*:47*/ +#line 349 "theweave.ch" + +if(c=='\\')/*49:*/ +#line 403 "theweave.ch" + +{ +if(loc>=limit)continue; +#if 0 +else if(++id_loc<=mod_text_end){ + *id_loc= '\\'; +c= *loc++; +} +#endif +} + + +#line 816 "weave.web" +/*:49*/ +#line 350 "theweave.ch" + +if(++id_loc<=mod_text_end) *id_loc= c; +} +if(id_loc>=mod_text_end){ +printf("\n! String too long: "); + +fflush(stdout),write(1,mod_text+1,25); +printf("...");history= 2; +} +id_loc++; +return(198); +} + + +/*:46*/ +#line 834 "weave.web" +; +case 12:/*43:*/ +#line 741 "weave.web" +{ +id_first= id_loc= mod_text+1; + *id_loc++= '~'; +while('0'<= *loc&& *loc<'8') *id_loc++= *loc++; +return(199); +} +/*:43*/ +#line 835 "weave.web" +; +#line 422 "theweave.ch" +case 13:/*44:*/ +#line 748 "weave.web" +{ +id_first= id_loc= mod_text+1; + *id_loc++= '^'; +while(isxdigit( *loc)){ + *id_loc++= (islower( *loc)?toupper( *loc): *loc); +loc++; +} +return(199); +} + +/*:44*/ +#line 422 "theweave.ch" +; +case 9:/*51:*/ +#line 430 "theweave.ch" + +{ +id_first= mod_text+1; +id_loc= mod_text; + *++id_loc= '\%'; +while(loc<limit) *++id_loc= *loc++; +id_loc++; +return(9); +} +#line 840 "weave.web" + +/*:51*/ +#line 423 "theweave.ch" +; +default:return(ccode[c]); +} +} + +/*:50*/ +#line 176 "theweave.ch" + +else if(c==' '||c==011)continue; +mistake:/*154:*/ +#line 3 "scraps.web" + +if(loc+2<=limit){ +if(strncmp("...",loc-1,3)==0){ +loc+= 2; +return 193; +} +} +if(loc+1<=limit){ +if(strncmp("..",loc-1,2)==0){ +loc+= 1; +return 194; +} +else if(strncmp("./",loc-1,2)==0){ +loc+= 1; +return 195; +} +else if(strncmp("<=",loc-1,2)==0){ +loc+= 1; +return 190; +} +else if(strncmp("~=",loc-1,2)==0){ +loc+= 1; +return 191; +} +else if(strncmp("==",loc-1,2)==0){ +loc+= 1; +return 192; +} +else if(strncmp(">=",loc-1,2)==0){ +loc+= 1; +return 189; +} +else if(strncmp(".^",loc-1,2)==0){ +loc+= 1; +return 196; +} +else if(strncmp(".*",loc-1,2)==0){ +loc+= 1; +return 197; +} +} +/*:154*/ +#line 178 "theweave.ch" + +return(c); +} +} +/*:38*//*60:*/ +#line 943 "weave.web" +phase_one(){ +phase= 1;reset_input();module_count= 0; +skip_limbo();change_exists= 0; +while(!input_has_ended) +/*61:*/ +#line 954 "weave.web" + +{ +if(++module_count==2000)stat_overflow("section number"); +changed_module[module_count]= 0; +if( *(loc-1)=='*'){ +printf("*%d",module_count); +fflush(stdout); +} +/*64:*/ +#line 1017 "weave.web" + +while(1){ +switch(next_control= skip_TeX()){ +case 126:xref_switch= 10240;continue; +#ifdef DEBUG +case 249:tracing= next_control-'0';continue; +#endif DEBUG +case 248:C_xref(1);break; +case(200+1):case(200+2): +case(200+3):case 254: +loc-= 2;next_control= get_next(1); +if(next_control!=254){ + + + + +new_xref(id_lookup(id_first,id_loc,next_control-200)); +} +break; +} +if(next_control>=251)break; +} + +/*:64*/ +#line 962 "weave.web" +; +/*66:*/ +#line 1055 "weave.web" + +while(next_control<=252){ +xref_switch= 10240; +if(next_control==252)next_control= get_next(1); +else/*67:*/ +#line 1069 "weave.web" +{ +next_control= get_next(1); +if(next_control==200){ +lhs= id_lookup(id_first,id_loc,0);lhs->dummy.Ilk= 0;new_xref(lhs); +next_control= get_next(1); +if(next_control==200){ +rhs= id_lookup(id_first,id_loc,0); +lhs->dummy.Ilk= rhs->dummy.Ilk;rhs->dummy.Ilk= 0;new_xref(rhs); +rhs->dummy.Ilk= lhs->dummy.Ilk;next_control= get_next(1); +} +} +} + +/*:67*/ +#line 1059 "weave.web" +; +outer_xref(); +} + +/*:66*/ +#line 963 "weave.web" +; +/*68:*/ +#line 1085 "weave.web" + +if(next_control<=254){ +if(next_control==253)mod_xref_switch= 0; +else mod_xref_switch= (cur_module_char=='<'?10240:2 *10240); +do{ +if(next_control==254&&cur_module!=NULL)new_mod_xref(cur_module); +next_control= get_next(1);outer_xref(); +}while(next_control<=254); +} + +/*:68*/ +#line 964 "weave.web" +; +if(changed_module[module_count])change_exists= 1; +} + +/*:61*/ +#line 947 "weave.web" +; +changed_module[module_count]= change_exists; + +phase= 2; +/*71:*/ +#line 1138 "weave.web" +mod_check(name_dir->dummy.Rlink) + +/*:71*/ +#line 951 "weave.web" +; +} + +/*:60*//*62:*/ +#line 980 "weave.web" +C_xref(see_v) +char see_v; +{ +name_pointer p; +while(next_control<251){ +if(next_control>=200&&next_control<=(200+3)){ +p= id_lookup(id_first,id_loc,next_control-200);new_xref(p); +} +next_control= get_next(see_v); +if(next_control==248||next_control==8 +#line 498 "weave.web" +)return; +} +} + +/*:62*//*63:*/ +#line 997 "weave.web" +outer_xref() +{ +int bal; +while(next_control<251) +if(next_control!=8 +#line 498 "weave.web" +)C_xref(0); +else{ +bal= copy_comment(1);next_control= 248; +while(bal>0){ +C_xref(1); +if(next_control==248)bal= copy_comment(bal); +else bal= 0; +} +} +} + +/*:63*//*70:*/ +#line 1106 "weave.web" +mod_check(p)name_pointer p; +{ +int level; +if(p){ +mod_check(p->link); +cur_xref= (xref_pointer)p->equiv_or_xref; +level= (cur_xref->num)/10240; +if(level==0){ +printf("\n! Never defined: <");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start));putchar('>');{if(history==0)history= 1;}; + +} +while(cur_xref->num>=10240){ +if((cur_xref->num)/10240!=level){ +printf("\n! You can't use <");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start)); +printf("> both as a file and as a named module");{if(history==0)history= 1;}; + +} +cur_xref= cur_xref->xlink; +} +if(cur_xref==xmem&&level<2){ +printf("\n! Never used: <");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start));putchar('>');{if(history==0)history= 1;}; + +} +else if(cur_xref!=xmem&&level==2){ +printf("\n! You can't use file module (");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start)); +putchar(')');{if(history==0)history= 1;}; + +} +mod_check(p->dummy.Rlink); +} +} + +/*:70*//*73:*/ +#line 1167 "weave.web" +flush_buffer(b,per_cent) +ASCII *b; +boolean per_cent; +{ +ASCII *j;j= b; +if(!per_cent) +while(j>out_buf&& *j==' ')j--; +fflush(tex_file),write(fileno(tex_file),out_buf+1,j-out_buf); +if(per_cent)putc(xchr['%'],tex_file); +putc('\n',tex_file);out_line++; +if(b<out_ptr)strncpy(out_buf+1,b+1,out_ptr-b); +out_ptr-= b-out_buf; +} + +/*:73*//*74:*/ +#line 1189 "weave.web" +finish_line() +{ +ASCII *k; +if(out_ptr>out_buf)flush_buffer(out_ptr,0); +else{ +for(k= buffer;k<=limit;k++) +if( *k!=' '&& *k!=011)return; +flush_buffer(out_buf,0); +} +} + +/*:74*//*76:*/ +#line 1221 "weave.web" +out_str_del(s,t) +ASCII *s, *t; +{ +while(s<t){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *s++;}; +} + +out_str(s) +ASCII *s; +{ +while( *s){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *s++;}; +} + +/*:76*//*78:*/ +#line 1244 "weave.web" +break_out() +{ +ASCII *k= out_ptr; +while(1){ +if(k==out_buf)/*79:*/ +#line 1263 "weave.web" + +{ +printf("\n! Line had to be broken (output l. %d):\n",out_line); + +fflush(stdout),write(1,out_buf+1,out_ptr-out_buf-1); +putchar('\n');{if(history==0)history= 1;}; +flush_buffer(out_ptr-1,1);return; +} + +/*:79*/ +#line 1248 "weave.web" +; +if( *k==' '){ +flush_buffer(k,0);return; +} +if( *(k--)=='\\'&& *k!='\\'){ +flush_buffer(k,1);return; +} +} +} + +/*:78*//*80:*/ +#line 1277 "weave.web" +out_mod(n)sixteen_bits n; +{ +ASCII s[6]; +sprintf(s,"%d",n);out_str(s); +if(changed_module[n])out_str("\\*"); +} + +/*:80*//*81:*/ +#line 1287 "weave.web" +out_name(p)name_pointer p;{ +ASCII *k, *k_end= (p+1)->byte_start; +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '{';}; +for(k= p->byte_start;k<k_end;k++){ +if( *k=='$'){{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'D';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'O';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= ' ';};} +else if( *k=='&'){{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'a';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'm';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'p';};} +else{ +if( *k=='_'|| *k=='%'|| *k=='#'|| *k=='^'|| *k=='{'|| *k=='}') +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';}; +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *k;}; +} +} +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '}';}; +} + +/*:81*//*82:*/ +#line 1312 "weave.web" +copy_limbo() +{ +ASCII c; +while(1){ +if(loc>limit&&(finish_line(),get_line()==0))return; + *(limit+1)= 64; +while( *loc!=64){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *(loc++);}; +if(loc++<=limit){ +c= *loc++; +if(ccode[c]==255)break; +if(c!='z'&&c!='Z'){ +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 64;}; +if(c!=64)err_print("! Double @ required outside of sections"); + +} +} +} +} + + +/*:82*//*84:*/ +#line 1340 "weave.web" +eight_bits copy_TeX() +{ +ASCII c; +while(1){ +if(loc>limit&&(finish_line(),get_line()==0))return(255); + *(limit+1)= 64; +while((c= *(loc++))!=124&&c!=64){ +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= c;}; +if(out_ptr==out_buf+1&&(c==' '||c==011))out_ptr--; +} +if(c==124)return(248); +if(loc<=limit)return(ccode[ *(loc++)]); +} +} + +/*:84*//*85:*/ +#line 1368 "weave.web" + +copy_comment(bal) +int bal; +{ +ASCII c; +while(1){ +if(loc>limit) +if(1){ +loc++;if(bal==1){if(phase==2){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';};return(0);} +else{ +err_print("! Braces don't balance in comment"); + +/*87:*/ +#line 1415 "weave.web" + +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= ' ';}; +while(bal-->0){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';}; + +return(0); + +/*:87*/ +#line 1380 "weave.web" +; +} +}else{ +if(get_line()==0){ +err_print("! Input ended in mid-comment"); + +loc= buffer+1;/*87:*/ +#line 1415 "weave.web" + +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= ' ';}; +while(bal-->0){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';}; + +return(0); + +/*:87*/ +#line 1386 "weave.web" +; +} +} + +c= *(loc++); +if(c==124)return(bal); +/*169:*/ +#line 375 "scraps.web" + +{int len;len= strlen("\n"); +if(loc+len-1<=limit&&!strncmp(loc-1,"\n",len)){ +loc++;if(bal==1){if(phase==2){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';};return(0);} +else{ +err_print("! Braces don't balance in comment"); + +/*87:*/ +#line 1415 "weave.web" + +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= ' ';}; +while(bal-->0){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';}; + +return(0); + +/*:87*/ +#line 382 "scraps.web" +; +} +} +} +#line 2385 "weave.web" + +/*:169*/ +#line 1392 "weave.web" +; +if(phase==2){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= c;}; +/*86:*/ +#line 1400 "weave.web" + +if(c==64){ +if( *(loc++)!=64){ +err_print("! Illegal use of @ in comment"); + +loc-= 2;if(phase==2)tok_ptr--;/*87:*/ +#line 1415 "weave.web" + +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= ' ';}; +while(bal-->0){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';}; + +return(0); + +/*:87*/ +#line 1405 "weave.web" +; +} +} +else if(c=='\\'&& *loc!=64&&phase==2){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= *(loc++);} +else if(c=='{')bal++; +else if(c=='}')bal--; + +/*:86*/ +#line 1394 "weave.web" +; +} +} + + + +/*:85*//*92:*/ +#line 48 "grammar.web" + +#ifdef DEBUG +#define PRINT_CAT(A,B)case A:printf(B);break +print_cat(c) +eight_bits c; +{ +switch(c){ +PRINT_CAT(1,"end"); +PRINT_CAT(2,"fn_head"); +PRINT_CAT(3,"unorbinop"); +PRINT_CAT(4,"con_nl"); +PRINT_CAT(5,"fquoter"); +PRINT_CAT(6,"switch"); +PRINT_CAT(7,"con"); +PRINT_CAT(8,"stmt"); +PRINT_CAT(9,"qclose"); +PRINT_CAT(10,"dnl"); +PRINT_CAT(11,"else"); +PRINT_CAT(12,"forcon"); +PRINT_CAT(13,"forbrace"); +PRINT_CAT(14,"range"); +PRINT_CAT(15,"transp"); +PRINT_CAT(16,"ifcon"); +PRINT_CAT(17,"swcon"); +PRINT_CAT(18,"global_head"); +PRINT_CAT(19,"break"); +PRINT_CAT(20,"colon"); +PRINT_CAT(21,"newline"); +PRINT_CAT(22,"semi"); +PRINT_CAT(23,"global_list"); +PRINT_CAT(24,"for"); +PRINT_CAT(25,"decl_head"); +PRINT_CAT(26,"equals"); +PRINT_CAT(27,"open"); +PRINT_CAT(28,"simp"); +PRINT_CAT(29,"ifbrace"); +PRINT_CAT(30,"ifexpr"); +PRINT_CAT(31,"decl_list"); +PRINT_CAT(32,"fquotel"); +PRINT_CAT(33,"elseif"); +PRINT_CAT(34,"expr"); +PRINT_CAT(35,"try"); +PRINT_CAT(36,"comma"); +PRINT_CAT(37,"binop"); +PRINT_CAT(38,"close"); +PRINT_CAT(39,"fn_arglist"); +PRINT_CAT(40,"fn_decl"); +PRINT_CAT(41,"forexpr"); +PRINT_CAT(42,"qopen"); +PRINT_CAT(43,"if"); +PRINT_CAT(44,"unop"); +PRINT_CAT(45,"ignore_scrap"); +case 0:printf("zero");break; +default:printf("UNKNOWN");break; +} +} +#endif DEBUG + +/*:92*//*119:*/ +#line 1643 "weave.web" + +#ifdef DEBUG +print_text(p) +text_pointer p; +{ +token_pointer j; +sixteen_bits r; +if(p>=text_ptr)printf("BAD"); +else for(j= *p;j< *(p+1);j++){ +r= *j%10240; +switch( *j/10240){ +case 1:printf("\\{");fflush(stdout),write(1,((name_dir+r))->byte_start,((((name_dir+r))+1)->byte_start-(((name_dir+r)))->byte_start));printf("}");break; + +case 2:printf("\\&{");fflush(stdout),write(1,((name_dir+r))->byte_start,((((name_dir+r))+1)->byte_start-(((name_dir+r)))->byte_start));printf("}");break; + +case 3:printf("<");fflush(stdout),write(1,((name_dir+r))->byte_start,((((name_dir+r))+1)->byte_start-(((name_dir+r)))->byte_start));printf(">");break; + +case 4:printf("[[%d]]",r);break; +case 5:printf("|[[%d]]|",r);break; +default:/*120:*/ +#line 1668 "weave.web" + +switch(r){ +case 133:printf("\\mathbin{");break; +case 135:printf("\\mathop{");break; +case 134:printf("\\mathrel{");break; +case 136:printf("[ccancel]");break; +case 137:printf("[cancel]");break; +case 137+1:printf("[indent]");break; +case 137+2:printf("[outdent]");break; +case 137+4:printf("[backup]");break; +case 137+3:printf("[opt]");break; +case 137+5:printf("[break]");break; +case 137+6:printf("[force]");break; +case 137+7:printf("[fforce]");break; +case 137+7+1:printf("[quit]");break; +default:putchar(r); +} + +/*:120*/ +#line 1662 "weave.web" +; +} +} +} +#endif DEBUG + +/*:119*//*122:*/ +#line 1745 "weave.web" +app_str(s) +ASCII *s; +{ +while( *s) *(tok_ptr++)= *(s++); +} + +app(a) +token a; +{ +if(a==' '||a>=136&&a<=137+7){ +if(last_mathness==0)init_mathness= 2; +else if(last_mathness==1) *(tok_ptr++)= '$'; +last_mathness= 2; +} +else{ +if(last_mathness==0)init_mathness= 1; +else if(last_mathness==2) *(tok_ptr++)= '$'; +last_mathness= last_mathness= 1; +} + *(tok_ptr++)= a; +} +app1(a) +scrap_pointer a; +{ +switch(((a)->mathness%4)){ +case(2): +if(last_mathness==0)init_mathness= 2; +if(last_mathness==1) *(tok_ptr++)= '$'; +last_mathness= (((a)->mathness/4)%4); +break; +case(1): +if(last_mathness==0)init_mathness= 1; +else if(last_mathness==2) *(tok_ptr++)= '$'; +last_mathness= (((a)->mathness/4)%4); +break; +case(0): +break; +} + *(tok_ptr++)= 4 *10240+(a)->trans_plus.Trans-tok_start; +} + +/*:122*//*124:*/ +#line 1807 "weave.web" + +/*125:*/ +#line 1840 "weave.web" + + +sixteen_bits first_id(p) +text_pointer p; +{ +token_pointer tp; +sixteen_bits r; +sixteen_bits the_id; + +for(tp= *p;tp< *(p+1);tp++){ +r= *tp%10240; +switch( *tp/10240){ +case 1: +return *tp; +break; +case 2: +case 3: +goto next; +break; +case 4: +case 5: + +if((the_id= first_id(tok_start+r))!=0)return the_id; +goto next; +break; +default: +goto next; +break; +} +next:continue; +} +return 0; +} + +/*:125*/ +#line 1808 "weave.web" + +make_underlined(p) + +scrap_pointer p; +{ +sixteen_bits tok_value; + + + + +tok_value= first_id(p->trans_plus.Trans); +if(tok_value==0){ +#ifdef DEBUG +if(tracing>0){ +printf("\n! I couldn't find an identifier to underline."); +{if(history==0)history= 1;}; +} +#endif DEBUG +return; +} +if(tok_value<10240||tok_value>=2 *10240) +{printf("");err_print("! Internal error in first_id");history= 3;wrap_up();}; + + + +if(((tok_value-10240+name_dir+1)->byte_start-(tok_value-10240+name_dir)->byte_start)>1) +underline_xref(tok_value-10240+name_dir); +} + +/*:124*//*126:*/ +#line 1879 "weave.web" +underline_xref(p) +name_pointer p; +{ +xref_pointer q= (xref_pointer)p->equiv_or_xref; + +xref_pointer r; +sixteen_bits m; +sixteen_bits n; +if(no_xref)return; +xref_switch= 10240; +m= module_count+xref_switch; +while(q!=xmem){ +n= q->num; +if(n==m)return; +else if(m==n+10240){ +q->num= m;return; +} +else if(n>=10240&&n<m)break; +q= q->xlink; +} +/*127:*/ +#line 1909 "weave.web" + +if(xref_ptr==xmem_end)stat_overflow("cross-reference");else(++xref_ptr)->num= 0;; +xref_ptr->xlink= (xref_pointer)p->equiv_or_xref; +p->equiv_or_xref= (ASCII *)xref_ptr; +r= xref_ptr; +while(r->xlink!=q){r->num= r->xlink->num;r= r->xlink;} +r->num= m; + + + +/*:127*/ +#line 1899 "weave.web" +; +} + +/*:126*//*129:*/ +#line 1933 "weave.web" +reduce(j,k,c,d,n) +scrap_pointer j; +eight_bits c; +short k,d,n; +{ +scrap_pointer i,i1; +j->cat= c;j->trans_plus.Trans= text_ptr; +j->mathness= ((eight_bits)(init_mathness+4 *(last_mathness))); + *(++text_ptr)= tok_ptr; +if(k>1){ +for(i= j+k,i1= j+1;i<=lo_ptr;i++,i1++){ +i1->cat= i->cat;i1->trans_plus.Trans= i->trans_plus.Trans; +i1->mathness= i->mathness; +} +lo_ptr= lo_ptr-k+1; +} +/*130:*/ +#line 1956 "weave.web" + +if(pp+d>=scrap_base)pp= pp+d; +else pp= scrap_base; + +/*:130*/ +#line 1949 "weave.web" +; +#ifdef DEBUG +/*135:*/ +#line 2023 "weave.web" +{ +scrap_pointer k; +if(tracing==2){ +printf("\n%d:",n); +for(k= scrap_base;k<=lo_ptr;k++){ +if(k==pp)putchar('*');else putchar(' '); +if(((k)->mathness%4)==1)putchar('+'); +else if(((k)->mathness%4)==2)putchar('-'); +print_cat(k->cat); +if((((k)->mathness/4)%4)==1)putchar('+'); +else if((((k)->mathness/4)%4)==2)putchar('-'); +} +if(hi_ptr<=scrap_ptr)printf("..."); +} +} + +/*:135*/ +#line 1951 "weave.web" +; +#endif DEBUG +pp--; +} + +/*:129*//*131:*/ +#line 1963 "weave.web" +squash(j,k,c,d,n) +scrap_pointer j; +eight_bits c; +short k,d,n; +{ +scrap_pointer i; +if(k==1){ +j->cat= c;/*130:*/ +#line 1956 "weave.web" + +if(pp+d>=scrap_base)pp= pp+d; +else pp= scrap_base; + +/*:130*/ +#line 1970 "weave.web" +; +#ifdef DEBUG +/*135:*/ +#line 2023 "weave.web" +{ +scrap_pointer k; +if(tracing==2){ +printf("\n%d:",n); +for(k= scrap_base;k<=lo_ptr;k++){ +if(k==pp)putchar('*');else putchar(' '); +if(((k)->mathness%4)==1)putchar('+'); +else if(((k)->mathness%4)==2)putchar('-'); +print_cat(k->cat); +if((((k)->mathness/4)%4)==1)putchar('+'); +else if((((k)->mathness/4)%4)==2)putchar('-'); +} +if(hi_ptr<=scrap_ptr)printf("..."); +} +} + +/*:135*/ +#line 1972 "weave.web" +; +#endif DEBUG +pp--; +return; +} +for(i= j;i<j+k;i++)app1(i); +reduce(j,k,c,d,n); +} + +/*:131*//*136:*/ +#line 2052 "weave.web" +text_pointer translate() +{ +scrap_pointer i, +j; +pp= scrap_base;lo_ptr= pp-1;hi_ptr= pp; +/*139:*/ +#line 2094 "weave.web" + +#ifdef DEBUG +if(tracing==2){ +printf("\nTracing after l. %d:\n",line[include_depth]);{if(history==0)history= 1;}; +if(loc>buffer+50){ +printf("..."); +fflush(stdout),write(1,loc-51,51); +} +else fflush(stdout),write(1,buffer+1,loc-buffer); +} +#endif DEBUG + +/*:139*/ +#line 2057 "weave.web" +; +/*132:*/ +#line 1985 "weave.web" + +while(1){ +/*133:*/ +#line 2004 "weave.web" + +if(lo_ptr<pp+6-1){ +while(hi_ptr<=scrap_ptr&&lo_ptr!=pp+6-1){ +(++lo_ptr)->cat= hi_ptr->cat;lo_ptr->mathness= (hi_ptr)->mathness; +lo_ptr->trans_plus.Trans= (hi_ptr++)->trans_plus.Trans; +} +for(i= lo_ptr+1;i<=pp+6-1;i++)i->cat= 0; +} + +/*:133*/ +#line 1988 "weave.web" +; +if(tok_ptr+8>tok_mem_end||text_ptr+4>tok_start_end){ +#ifdef STAT +if(tok_ptr>max_tok_ptr)max_tok_ptr= tok_ptr; +if(text_ptr>max_text_ptr)max_text_ptr= text_ptr; +#endif STAT +stat_overflow("token/text"); +} +if(pp>lo_ptr)break; +init_mathness= last_mathness= 0; +/*123:*/ +#line 1791 "weave.web" +{ + +/*93:*/ +#line 109 "grammar.web" + +if((pp+0)->cat!=0&& +(pp+1)->cat==45){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,(pp+0)->cat,-5,1); +goto end_prods; +}if((pp+0)->cat==45&& +(pp+1)->cat!=0){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,(pp+1)->cat,-5,2); +goto end_prods; +}if((pp+0)->cat==15){ + +app1(pp+0); +app_str("^{\\prime}"); +reduce(pp+0,1,44,-2,3); +goto end_prods; +}if((pp+0)->cat==32){ + +app1(pp+0); +app_str("\\FQL"); +app(137+1); +reduce(pp+0,1,42,-2,4); +goto end_prods; +}/*:93*//*94:*/ +#line 137 "grammar.web" + +if((pp+0)->cat==5){ + +app1(pp+0); +app_str("\\FQR"); +app(137+2); +reduce(pp+0,1,9,-2,5); +goto end_prods; +}if((pp+0)->cat==42&& +(pp+1)->cat==8){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,42,-2,6); +goto end_prods; +}if((pp+0)->cat==42&& +(pp+1)->cat==21){ + +app1(pp+0); +app(137+6); +app1(pp+1); +reduce(pp+0,2,42,-2,7); +goto end_prods; +}if((pp+0)->cat==42&& +(pp+1)->cat==9){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,34,-5,8); +goto end_prods; +}if((pp+0)->cat==42&& +(pp+1)->cat==34&& +(pp+2)->cat==9){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,34,-5,9); +goto end_prods; +}/*:94*//*95:*/ +#line 176 "grammar.web" + +if((pp+0)->cat==21&& +((pp+1)->cat!=21&&(pp+1)->cat!=0)){ + +app1(pp+0); +app(137+6); +reduce(pp+0,1,22,-3,10); +goto end_prods; +}if((pp+0)->cat==21&& +(pp+1)->cat==21){ + +app1(pp+0); +app1(pp+1); +app(137+7); +reduce(pp+0,2,10,-2,11); +goto end_prods; +}if((pp+0)->cat==10&& +(pp+1)->cat==21){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,10,-2,12); +goto end_prods; +}if((pp+0)->cat==10){ + +app1(pp+0); +reduce(pp+0,1,22,-3,13); +goto end_prods; +}if((pp+0)->cat==10&& +((pp+1)->cat!=21&&(pp+1)->cat!=0)){ + +app1(pp+0); +reduce(pp+0,1,22,-3,14); +goto end_prods; +}/*:95*//*96:*/ +#line 210 "grammar.web" + +if(((pp+0)->cat==7|| +(pp+0)->cat==4)&& +(pp+1)->cat==21){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,4,-2,15); +goto end_prods; +}if((pp+0)->cat==4&& +((pp+1)->cat!=21&&(pp+1)->cat!=0)){ + +app1(pp+0); +app(137+6); +app1(pp+1); +reduce(pp+0,2,(pp+1)->cat,-5,16); +goto end_prods; +}if((pp+0)->cat==8&& +(pp+1)->cat==22){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,8,-4,17); +goto end_prods; +}if((pp+0)->cat==8&& +(pp+1)->cat==21&& +((pp+2)->cat!=21&&(pp+2)->cat!=0)){ + +app1(pp+0); +app1(pp+1); +app(137+6); +reduce(pp+0,2,8,-4,18); +goto end_prods; +}if((pp+0)->cat==8&& +(pp+1)->cat==21&& +(pp+2)->cat==21){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+7); +reduce(pp+0,3,8,-4,19); +goto end_prods; +}/*:96*//*97:*/ +#line 253 "grammar.web" + +if((pp+0)->cat==25&& +(pp+1)->cat==28){ + +app1(pp+0); +app(137+1); +app_str("\\"); +app_str(" "); +app1(pp+1); +reduce(pp+0,2,31,-2,20); +goto end_prods; +}if((pp+0)->cat==31&& +(pp+1)->cat==28){ + +app1(pp+0); +app_str("\\"); +app_str(" "); +app1(pp+1); +reduce(pp+0,2,31,-2,21); +goto end_prods; +}if((pp+0)->cat==31&& +(pp+1)->cat==36&& +(pp+2)->cat==28){ + +app1(pp+0); +app1(pp+1); +app_str("\\"); +app_str(" "); +app1(pp+2); +reduce(pp+0,3,31,-2,22); +goto end_prods; +}if((pp+0)->cat==18&& +(pp+1)->cat==28){ + + +app1(pp+0); +app(137+1); +app_str("\\"); +app_str(" "); +make_underlined(pp+1); +app1(pp+1); +reduce(pp+0,2,23,-2,23); +goto end_prods; +}if((pp+0)->cat==23&& +(pp+1)->cat==28){ + + +app1(pp+0); +app_str("\\"); +app_str(" "); +make_underlined(pp+1); +app1(pp+1); +reduce(pp+0,2,23,-2,24); +goto end_prods; +}/*:97*//*98:*/ +#line 307 "grammar.web" + +if((pp+0)->cat==23&& +(pp+1)->cat==36&& +(pp+2)->cat==28){ + + +app1(pp+0); +app1(pp+1); +app_str("\\"); +app_str(" "); +make_underlined(pp+2); +app1(pp+2); +reduce(pp+0,3,23,-2,25); +goto end_prods; +}if((pp+0)->cat==31&& +(pp+1)->cat==22){ + +app1(pp+0); +app(137+2); +app1(pp+1); +reduce(pp+0,2,8,-4,26); +goto end_prods; +}if((pp+0)->cat==23&& +(pp+1)->cat==22){ + +app1(pp+0); +app(137+2); +app1(pp+1); +reduce(pp+0,2,8,-4,27); +goto end_prods; +}if((pp+0)->cat==34&& +(pp+1)->cat==44){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,34,-5,28); +goto end_prods; +}if((pp+0)->cat==34&& +((pp+1)->cat==37|| +(pp+1)->cat==3)&& +(pp+2)->cat==34){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,34,-5,29); +goto end_prods; +}/*:98*//*99:*/ +#line 354 "grammar.web" + +if(!((pp+0)->cat==0||(pp+0)->cat==43|| +(pp+0)->cat==33|| +(pp+0)->cat==6)&& +(pp+1)->cat==34&& +(pp+2)->cat==36&& +(pp+3)->cat==34){ + + +app1(pp+1); +app1(pp+2); +app(137+3); +app_str("9"); +app1(pp+3); +reduce(pp+1,3,34,-5,30); +goto end_prods; +}if((pp+0)->cat==28&& +(pp+1)->cat==27){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,27,-2,31); +goto end_prods; +}if((pp+0)->cat==28){ + +app1(pp+0); +reduce(pp+0,1,34,-5,32); +goto end_prods; +}if(((pp+0)->cat==27)&& +(pp+1)->cat==34&& +(pp+2)->cat==38){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,34,-5,33); +goto end_prods; +}if(((pp+0)->cat==27)&& +(pp+1)->cat==38){ + +app1(pp+0); +app_str("\\thinspace"); +app1(pp+1); +reduce(pp+0,2,34,-5,34); +goto end_prods; +}/*:99*//*100:*/ +#line 399 "grammar.web" + +if((pp+0)->cat==27&& +(pp+1)->cat==8){ + +app1(pp+0); +app1(pp+1); +app_str("\\"); +app_str(" "); +reduce(pp+0,2,27,-2,35); +goto end_prods; +}if(((pp+0)->cat==44|| +(pp+0)->cat==3)&& +(pp+1)->cat==34){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,34,-5,36); +goto end_prods; +}if((pp+0)->cat==34&& +(pp+1)->cat==26&& +(pp+2)->cat==34&& +((pp+3)->cat==36|| +(pp+3)->cat==22|| +(pp+3)->cat==21)){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +reduce(pp+0,4,8,-4,37); +goto end_prods; +}if((pp+0)->cat==34&& +(pp+1)->cat==20){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,14,-2,38); +goto end_prods; +}if((pp+0)->cat==14&& +(pp+1)->cat==34){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,34,-5,39); +goto end_prods; +}/*:100*//*101:*/ +#line 445 "grammar.web" + +if((pp+0)->cat==20){ + + +app_str("\\mathord{\\kern.1em"); +app1(pp+0); +app_str("\\kern.1em}"); +reduce(pp+0,1,34,-5,40); +goto end_prods; +}if(!((pp+0)->cat==0||(pp+0)->cat==43|| +(pp+0)->cat==33|| +(pp+0)->cat==6)&& +(pp+1)->cat==34&& +(pp+2)->cat==34){ + + +app1(pp+1); +app_str("\\"); +app_str(" "); +app1(pp+2); +reduce(pp+1,2,34,-5,41); +goto end_prods; +}if((pp+0)->cat==2&& +(pp+1)->cat==34&& +(pp+2)->cat==26){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,2,-2,42); +goto end_prods; +}if((pp+0)->cat==2&& +(pp+1)->cat==28){ + +app1(pp+0); +app(137+1); +app1(pp+1); +reduce(pp+0,2,40,-2,43); +goto end_prods; +}if((pp+0)->cat==40&& +(pp+1)->cat==27){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,39,-2,44); +goto end_prods; +}/*:101*//*102:*/ +#line 491 "grammar.web" + +if((pp+0)->cat==40){ + +app1(pp+0); +app(137+1); +reduce(pp+0,1,8,-4,45); +goto end_prods; +}if((pp+0)->cat==39&& +((pp+1)->cat==28|| +(pp+1)->cat==36|| +(pp+1)->cat==34)){ + + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,39,-2,46); +goto end_prods; +}if((pp+0)->cat==39&& +(pp+1)->cat==38){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,8,-4,47); +goto end_prods; +}if((pp+0)->cat==43&& +(pp+1)->cat==34&& +!((pp+2)->cat==0||(pp+2)->cat==37|| +(pp+2)->cat==3)){ + + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,30,-2,48); +goto end_prods; +}if((pp+0)->cat==43&& +(pp+1)->cat==34&& +(pp+2)->cat==7&& +(pp+3)->cat==21){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+1); +app(137+1); +app(137+6); +app1(pp+3); +reduce(pp+0,4,16,-2,49); +goto end_prods; +}/*:102*//*103:*/ +#line 539 "grammar.web" + +if((pp+0)->cat==43&& +(pp+1)->cat==34&& +((pp+2)->cat==37|| +(pp+2)->cat==3)&& +(pp+3)->cat==7&& +(pp+4)->cat==21){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +app(137+1); +app(137+1); +app(137+6); +app1(pp+4); +reduce(pp+0,5,16,-2,50); +goto end_prods; +}if((pp+0)->cat==43&& +(pp+1)->cat==34&& +((pp+2)->cat==37|| +(pp+2)->cat==3)&& +(pp+3)->cat==34&& +(pp+4)->cat==7&& +(pp+5)->cat==21){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +app1(pp+4); +app(137+1); +app(137+1); +app(137+6); +app1(pp+5); +reduce(pp+0,6,16,-2,51); +goto end_prods; +}if((pp+0)->cat==16&& +(pp+1)->cat==7&& +(pp+2)->cat==21){ + +app1(pp+0); +app1(pp+1); +app(137+6); +app1(pp+2); +reduce(pp+0,3,16,-2,52); +goto end_prods; +}if((pp+0)->cat==16&& +((pp+1)->cat==37|| +(pp+1)->cat==3)&& +(pp+2)->cat==34){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,16,-2,53); +goto end_prods; +}if((pp+0)->cat==16&& +(pp+1)->cat==34){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,16,-2,54); +goto end_prods; +}/*:103*//*104:*/ +#line 605 "grammar.web" + +if((pp+0)->cat==30&& +(pp+1)->cat==8){ + + +app1(pp+0); +app(137+1); +app_str("\\thinspace\\"); +app_str(" "); +app1(pp+1); +reduce(pp+0,2,29,-2,55); +goto end_prods; +}if((pp+0)->cat==30&& +(pp+1)->cat==36&& +(pp+2)->cat==8){ + +app1(pp+0); +app1(pp+1); +app(137+1); +app1(pp+2); +reduce(pp+0,3,29,-2,56); +goto end_prods; +}if((pp+0)->cat==30&& +(pp+1)->cat==21){ + +app1(pp+0); +app1(pp+1); +app(137+1); +app(137+6); +reduce(pp+0,2,29,-2,57); +goto end_prods; +}if((pp+0)->cat==16&& +(pp+1)->cat==8){ + +app1(pp+0); +app(137+2); +app(137+6); +app1(pp+1); +reduce(pp+0,2,29,-2,58); +goto end_prods; +}if((pp+0)->cat==16&& +(pp+1)->cat==36&& +(pp+2)->cat==8){ + +app1(pp+0); +app1(pp+1); +app(137+2); +app(137+6); +app1(pp+2); +reduce(pp+0,3,29,-2,59); +goto end_prods; +}/*:104*//*105:*/ +#line 656 "grammar.web" + +if((pp+0)->cat==16&& +(pp+1)->cat==34&& +(pp+2)->cat==36&& +(pp+3)->cat!=0){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+2); +app(137+6); +reduce(pp+0,3,29,-2,60); +goto end_prods; +}if((pp+0)->cat==16&& +(pp+1)->cat==34&& +(pp+2)->cat==21&& +(pp+3)->cat!=0){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+2); +app(137+6); +reduce(pp+0,3,29,-2,61); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==11){ + +app1(pp+0); +app(137+2); +app1(pp+1); +app(137+1); +reduce(pp+0,2,13,-2,62); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==33&& +((pp+2)->cat==34|| +(pp+2)->cat==28)&& +(pp+3)->cat==21){ + + +app1(pp+0); +app(137+2); +app1(pp+1); +app(137+1); +app1(pp+2); +app(137+6); +app1(pp+3); +reduce(pp+0,4,29,-2,63); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==33&& +(pp+2)->cat==34&& +(pp+3)->cat==8){ + + +app1(pp+0); +app(137+2); +app1(pp+1); +app(137+1); +app1(pp+2); +app_str("\\thinspace\\"); +app_str(" "); +app1(pp+3); +reduce(pp+0,4,29,-2,64); +goto end_prods; +}/*:105*//*106:*/ +#line 722 "grammar.web" + +if((pp+0)->cat==29&& +(pp+1)->cat==33&& +(pp+2)->cat==34&& +(pp+3)->cat==36&& +(pp+4)->cat==8){ + + +app1(pp+0); +app(137+2); +app1(pp+1); +app(137+1); +app1(pp+2); +app1(pp+3); +app1(pp+4); +reduce(pp+0,5,29,-2,65); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==8){ + +app1(pp+0); +app(137+6); +app1(pp+1); +reduce(pp+0,2,29,-2,66); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==22){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,29,-2,67); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==21&& +(pp+2)->cat==1&& +((pp+3)->cat==36|| +(pp+3)->cat==22)){ + + +app1(pp+0); +app1(pp+1); +app(137+2); +app(137+6); +app1(pp+2); +app1(pp+3); +reduce(pp+0,4,8,-4,68); +goto end_prods; +}if((pp+0)->cat==29&& +(pp+1)->cat==1){ + +app1(pp+0); +app(137+2); +app_str(" "); +app1(pp+1); +reduce(pp+0,2,8,-4,69); +goto end_prods; +}/*:106*//*107:*/ +#line 778 "grammar.web" + +if((pp+0)->cat==29&& +(pp+1)->cat==1&& +((pp+2)->cat==36|| +(pp+2)->cat==22)){ + +app1(pp+0); +app(137+2); +app_str(" "); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,8,-4,70); +goto end_prods; +}if((pp+0)->cat==35){ + +app1(pp+0); +app(137+1); +reduce(pp+0,1,29,-2,71); +goto end_prods; +}if((pp+0)->cat==6&& +(pp+1)->cat==34&& +!((pp+2)->cat==0||(pp+2)->cat==37|| +(pp+2)->cat==3)){ + + +app1(pp+0); +app1(pp+1); +app(137+1); +app(137+6); +reduce(pp+0,2,29,-2,72); +goto end_prods; +}if((pp+0)->cat==6&& +(pp+1)->cat==34&& +(pp+2)->cat==7&& +(pp+3)->cat==21){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+1); +app(137+1); +app(137+6); +app1(pp+3); +reduce(pp+0,4,17,-2,73); +goto end_prods; +}if((pp+0)->cat==6&& +(pp+1)->cat==34&& +((pp+2)->cat==37|| +(pp+2)->cat==3)&& +(pp+3)->cat==7&& +(pp+4)->cat==21){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +app(137+1); +app(137+1); +app(137+6); +app1(pp+4); +reduce(pp+0,5,17,-2,74); +goto end_prods; +}/*:107*//*108:*/ +#line 841 "grammar.web" + +if((pp+0)->cat==6&& +(pp+1)->cat==34&& +((pp+2)->cat==37|| +(pp+2)->cat==3)&& +(pp+3)->cat==34&& +(pp+4)->cat==7&& +(pp+5)->cat==21){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +app1(pp+4); +app(137+1); +app(137+1); +app(137+6); +app1(pp+5); +reduce(pp+0,6,17,-2,75); +goto end_prods; +}if((pp+0)->cat==17&& +(pp+1)->cat==7&& +(pp+2)->cat==21){ + +app1(pp+0); +app1(pp+1); +app(137+6); +app1(pp+2); +reduce(pp+0,3,17,-2,76); +goto end_prods; +}if((pp+0)->cat==17&& +((pp+1)->cat==37|| +(pp+1)->cat==3)&& +(pp+2)->cat==34){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,17,-2,77); +goto end_prods; +}if((pp+0)->cat==17&& +(pp+1)->cat==34){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,17,-2,78); +goto end_prods; +}if((pp+0)->cat==17&& +(pp+1)->cat==8){ + +app1(pp+0); +app(137+2); +app(137+6); +app1(pp+1); +reduce(pp+0,2,29,-2,79); +goto end_prods; +}/*:108*//*109:*/ +#line 898 "grammar.web" + +if((pp+0)->cat==17&& +(pp+1)->cat==36&& +(pp+2)->cat==8){ + +app1(pp+0); +app1(pp+1); +app(137+2); +app(137+6); +app1(pp+2); +reduce(pp+0,3,29,-2,80); +goto end_prods; +}if((pp+0)->cat==17&& +(pp+1)->cat==34&& +(pp+2)->cat==36&& +(pp+3)->cat!=0){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+2); +app(137+6); +reduce(pp+0,3,29,-2,81); +goto end_prods; +}if((pp+0)->cat==17&& +(pp+1)->cat==34&& +(pp+2)->cat==21&& +(pp+3)->cat!=0){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+2); +app(137+6); +reduce(pp+0,3,29,-2,82); +goto end_prods; +}if((pp+0)->cat==24&& +(pp+1)->cat==34&& +(pp+2)->cat==26&& +(pp+3)->cat==34){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +reduce(pp+0,4,41,-2,83); +goto end_prods; +}if((pp+0)->cat==24&& +(pp+1)->cat==34&& +(pp+2)->cat==26&& +((pp+3)->cat==34|| +(pp+3)->cat==28)&& +((pp+4)->cat==20|| +(pp+4)->cat==37|| +(pp+4)->cat==3|| +(pp+4)->cat==36)&& +((pp+5)->cat==34|| +(pp+5)->cat==28)){ + + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app1(pp+3); +app1(pp+4); +app1(pp+5); +reduce(pp+0,6,41,-2,84); +goto end_prods; +}/*:109*//*110:*/ +#line 967 "grammar.web" + +if((pp+0)->cat==41&& +((pp+1)->cat==20|| +(pp+1)->cat==37|| +(pp+1)->cat==3|| +(pp+1)->cat==36)&& +((pp+2)->cat==34|| +(pp+2)->cat==28)){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,41,-2,85); +goto end_prods; +}if((pp+0)->cat==41&& +((pp+1)->cat==20|| +(pp+1)->cat==37|| +(pp+1)->cat==3|| +(pp+1)->cat==36)&& +(pp+2)->cat==7&& +(pp+3)->cat==21){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +app(137+1); +app(137+1); +app(137+6); +app1(pp+3); +reduce(pp+0,4,12,-2,86); +goto end_prods; +}if((pp+0)->cat==41&& +(pp+1)->cat==7&& +(pp+2)->cat==21){ + +app1(pp+0); +app1(pp+1); +app(137+1); +app(137+1); +app(137+6); +app1(pp+2); +reduce(pp+0,3,12,-2,87); +goto end_prods; +}if((pp+0)->cat==12&& +(pp+1)->cat==7&& +(pp+2)->cat==21){ + +app1(pp+0); +app1(pp+1); +app(137+6); +app1(pp+2); +reduce(pp+0,3,12,-2,88); +goto end_prods; +}if((pp+0)->cat==12&& +((pp+1)->cat==20|| +(pp+1)->cat==37|| +(pp+1)->cat==3|| +(pp+1)->cat==36)&& +((pp+2)->cat==34|| +(pp+2)->cat==28)){ + + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,12,-2,89); +goto end_prods; +}/*:110*//*111:*/ +#line 1036 "grammar.web" + +if((pp+0)->cat==12&& +((pp+1)->cat==34|| +(pp+1)->cat==28)){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,12,-2,90); +goto end_prods; +}if((pp+0)->cat==12&& +(pp+1)->cat==8){ + +app1(pp+0); +app(137+2); +app(137+6); +app1(pp+1); +reduce(pp+0,2,13,-2,91); +goto end_prods; +}if((pp+0)->cat==41&& +(pp+1)->cat==8){ + +app1(pp+0); +app(137+1); +app_str(" "); +app1(pp+1); +reduce(pp+0,2,13,-2,92); +goto end_prods; +}if((pp+0)->cat==41&& +(pp+1)->cat==21){ + +app1(pp+0); +app(137+1); +app(137+6); +app1(pp+1); +reduce(pp+0,2,13,-2,93); +goto end_prods; +}if((pp+0)->cat==13&& +(pp+1)->cat==36){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,13,-2,94); +goto end_prods; +}/*:111*//*112:*/ +#line 1079 "grammar.web" + +if((pp+0)->cat==13&& +(pp+1)->cat==8){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,13,-2,95); +goto end_prods; +}if((pp+0)->cat==13&& +(pp+1)->cat==21&& +(pp+2)->cat==1){ + +app1(pp+0); +app1(pp+1); +app(137+2); +app(137+6); +app1(pp+2); +reduce(pp+0,3,8,-4,96); +goto end_prods; +}if((pp+0)->cat==13&& +(pp+1)->cat==1){ + +app1(pp+0); +app(137+2); +app_str(" "); +app1(pp+1); +reduce(pp+0,2,8,-4,97); +goto end_prods; +}if((pp+0)->cat==13&& +(pp+1)->cat==1&& +((pp+2)->cat==36|| +(pp+2)->cat==22)){ + +app1(pp+0); +app(137+2); +app_str(" "); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,8,-4,98); +goto end_prods; +}if(((pp+0)->cat==19|| +(pp+0)->cat==34|| +(pp+0)->cat==8)&& +(pp+1)->cat==22){ + +app1(pp+0); +app1(pp+1); +reduce(pp+0,2,8,-4,99); +goto end_prods; +}/*:112*//*113:*/ +#line 1128 "grammar.web" + +if((pp+0)->cat==8&& +(pp+1)->cat==8){ + +app1(pp+0); +app(137+6); +app1(pp+1); +reduce(pp+0,2,8,-4,100); +goto end_prods; +}if((pp+0)->cat==22){ + +app1(pp+0); +reduce(pp+0,1,8,-4,101); +goto end_prods; +}if((pp+0)->cat==34&& +(pp+1)->cat==36&& +(pp+2)->cat==8){ + +app1(pp+0); +app1(pp+1); +app1(pp+2); +reduce(pp+0,3,8,-4,102); +goto end_prods; +} +end_prods: +/*:113*/ +#line 1793 "weave.web" + +pp++; +} + +/*:123*/ +#line 1998 "weave.web" +; +} + +/*:132*/ +#line 2058 "weave.web" +; +/*137:*/ +#line 2067 "weave.web" +{ +/*138:*/ +#line 2083 "weave.web" + +#ifdef DEBUG +if(lo_ptr>scrap_base&&tracing==1){ +printf("\nIrreducible scrap sequence in section %d:",module_count); +{if(history==0)history= 1;}; +for(j= scrap_base;j<=lo_ptr;j++){ +printf(" ");print_cat(j->cat); +} +} +#endif DEBUG + +/*:138*/ +#line 2068 "weave.web" +; +for(j= scrap_base;j<=lo_ptr;j++){ +if(j!=scrap_base) *(tok_ptr++)= ' '; +if((((j)->mathness%4)==1)&&math_flag==0) *(tok_ptr++)= '$'; +if((((j)->mathness%4)==2)&&math_flag==1){ + *(tok_ptr++)= ' '; *(tok_ptr++)= '$';} + *(tok_ptr++)= 4 *10240+(j)->trans_plus.Trans-tok_start; +if(((((j)->mathness/4)%4)==1)&&math_flag==0) *(tok_ptr++)= '$'; +if(((((j)->mathness/4)%4)==2)&&math_flag==1){ *(tok_ptr++)= '$'; + *(tok_ptr++)= ' ';} +if(tok_ptr+6>tok_mem_end)stat_overflow("token"); +} + *(++text_ptr)= tok_ptr;return(text_ptr-1); +} + +/*:137*/ +#line 2059 "weave.web" +; +} + +/*:136*//*140:*/ +#line 2151 "weave.web" +C_parse(see_v) +char see_v; +{ +name_pointer p; +while(next_control<251){ +/*142:*/ +#line 2169 "weave.web" + +/*144:*/ +#line 2230 "weave.web" + +if(scrap_ptr+50>scrap_info_end||tok_ptr+50>tok_mem_end|| +text_ptr+50>tok_start_end){ +#ifdef STAT +if(scrap_ptr>max_scr_ptr)max_scr_ptr= scrap_ptr; +if(tok_ptr>max_tok_ptr)max_tok_ptr= tok_ptr; +if(text_ptr>max_text_ptr)max_text_ptr= text_ptr; +#endif STAT +stat_overflow("scrap/token/text"); +} + +/*:144*/ +#line 2171 "weave.web" +; +#line 447 "theweave.ch" +switch(next_control){ +/*39:*/ +#line 183 "theweave.ch" + +case 32: +(++scrap_ptr)->cat= 32;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 5: +(++scrap_ptr)->cat= 5;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 15: +(++scrap_ptr)->cat= 15;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; + +#line 700 "weave.web" +/*:39*//*159:*/ +#line 69 "scraps.web" + +case'[': + *(tok_ptr++)= next_control; *(tok_ptr++)= 137+1; + +(++scrap_ptr)->cat= 27;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'(': + *(tok_ptr++)= next_control; *(tok_ptr++)= 137+1; + +(++scrap_ptr)->cat= 27;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 194: +app_str("{.\\thinspace.}"); + +(++scrap_ptr)->cat= 28;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case']': + *(tok_ptr++)= next_control; *(tok_ptr++)= 137+2; + +(++scrap_ptr)->cat= 38;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case')': + *(tok_ptr++)= next_control; *(tok_ptr++)= 137+2; + +(++scrap_ptr)->cat= 38;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 195: +app_str("\\mathbin{./}"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'\\': +app_str("\\backslash"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'^': +app_str("\\mathbin{\\hat{}}"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'*': +app_str("{*}"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 190: +app_str("\\L"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'+': + *(tok_ptr++)= next_control; +(++scrap_ptr)->cat= 3;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 191: +app_str("\\I"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 192: +app_str("\\S"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case',': +app_str(",\\;"); + +(++scrap_ptr)->cat= 36;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 189: +app_str("\\G"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'{': +app_str("\\{"); + *(tok_ptr++)= 137+1; + +(++scrap_ptr)->cat= 27;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case':': +app_str("\\mathbin:"); + +(++scrap_ptr)->cat= 20;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'-': + *(tok_ptr++)= next_control; +(++scrap_ptr)->cat= 3;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'|': +app_str("\\V"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case';': +app_str(";\\;"); + +(++scrap_ptr)->cat= 22;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'.': + *(tok_ptr++)= next_control; +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'<': + *(tok_ptr++)= next_control; +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'}': +app_str("\\}"); + *(tok_ptr++)= 137+2; + +(++scrap_ptr)->cat= 38;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'/': + *(tok_ptr++)= next_control; +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'~': +app_str("\\neg"); + +(++scrap_ptr)->cat= 44;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'=': +app_str("="); + +(++scrap_ptr)->cat= 26;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'>': + *(tok_ptr++)= next_control; +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 193: +app_str("\\ldots"); + +(++scrap_ptr)->cat= 7;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 196: +app_str("\\mathbin{.\\hat{}}"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 197: +app_str("\\mathbin{.*}"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case'&': +app_str("\\W"); + +(++scrap_ptr)->cat= 37;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +/*:159*/ +#line 448 "theweave.ch" + +case 198:case 199:case 2: +/*146:*/ +#line 2258 "weave.web" + +{ +int imag= 0; + +if(next_control==199)app_str("\\O{"); +else if(next_control==198)app_str("\\.{"); +else app_str("\\={"); +while(id_first<id_loc){ +if( *id_first==64){ +if( *(id_first+1)==64)id_first++; +else err_print("! Double at_sign should be used in strings"); +} +/*147:*/ +#line 2289 "weave.web" + +switch( *id_first){ +case' ':case'\\': +case'%':case'$':case'^':case'`': +case'#': +case'{':case'}':case'~':case'&':case'_': + *(tok_ptr++)= '\\';break; + +} + +/*:147*/ +#line 2270 "weave.web" + +#ifdef MATLAB_FLOATING_POINT +if((next_control==199)&&( *id_first=='i')){ +imag= 1;id_first++; +} +else{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= *id_first++;}; +#else +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= *id_first++;}; +#endif +} + *(tok_ptr++)= '}'; +#ifdef MATLAB_FLOATING_POINT +if(imag) *(tok_ptr++)= 'i'; +#endif +/*156:*/ +#line 60 "scraps.web" + +(++scrap_ptr)->cat= 28;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +/*:156*/ +#line 2284 "weave.web" + +} + + + +/*:146*/ +#line 450 "theweave.ch" +; +break; +case 9: +app_str("\\CCM{"); + +while(id_first<id_loc){ +if( *id_first==64){ +if( *(id_first+1)==64)id_first++; +else err_print("! Double at_sign should be used in controlled comments"); +} + +/*147:*/ +#line 2289 "weave.web" + +switch( *id_first){ +case' ':case'\\': +case'%':case'$':case'^':case'`': +case'#': +case'{':case'}':case'~':case'&':case'_': + *(tok_ptr++)= '\\';break; + +} + +/*:147*/ +#line 461 "theweave.ch" + +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= *id_first++;}; +} + *(tok_ptr++)= '}'; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; +#line 2177 "weave.web" +case 10:/*157:*/ +#line 62 "scraps.web" + + +(++scrap_ptr)->cat= 21;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(0+4 *(0))); *(++text_ptr)= tok_ptr;; +/*:157*/ +#line 2177 "weave.web" +;break; +case 200:/*155:*/ +#line 44 "scraps.web" + +p= id_lookup(id_first,id_loc,0); +if(p->dummy.Ilk==0||p->dummy.Ilk==4){ + *(tok_ptr++)= 10240+p-name_dir; +(++scrap_ptr)->cat= 28;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +} +else if(p->dummy.Ilk>3){ +/*162:*/ +#line 254 "scraps.web" + +switch(p->dummy.Ilk){ +case 64: + *(tok_ptr++)= 2 *10240+p-name_dir;app_str("\\"); +app_str(" "); + +(++scrap_ptr)->cat= 6;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 65: + *(tok_ptr++)= 2 *10240+p-name_dir;app_str("\\"); +app_str(" "); + +(++scrap_ptr)->cat= 2;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 66: +app_str(""); + +(++scrap_ptr)->cat= 15;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 67: +app_str(""); + +(++scrap_ptr)->cat= 32;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 68: + *(tok_ptr++)= 2 *10240+p-name_dir;app_str("\\"); +app_str(" "); + +(++scrap_ptr)->cat= 24;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 69: + *(tok_ptr++)= 2 *10240+p-name_dir; +(++scrap_ptr)->cat= 1;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 70: +app_str("\\infty"); + +(++scrap_ptr)->cat= 28;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 71: + *(tok_ptr++)= 2 *10240+p-name_dir;app_str("\\"); +app_str(" "); + +(++scrap_ptr)->cat= 43;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 72: +app_str(""); + +(++scrap_ptr)->cat= 5;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 73: + *(tok_ptr++)= 2 *10240+p-name_dir; +(++scrap_ptr)->cat= 11;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 74: +app_str("\\pi"); + +(++scrap_ptr)->cat= 28;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 75: + *(tok_ptr++)= 2 *10240+p-name_dir; +(++scrap_ptr)->cat= 18;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 76: + *(tok_ptr++)= 2 *10240+p-name_dir;app_str("\\"); +app_str(" "); + +(++scrap_ptr)->cat= 33;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 77: + *(tok_ptr++)= 2 *10240+p-name_dir; +(++scrap_ptr)->cat= 25;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 78: + *(tok_ptr++)= 2 *10240+p-name_dir; +(++scrap_ptr)->cat= 35;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +case 79: + *(tok_ptr++)= 2 *10240+p-name_dir; +(++scrap_ptr)->cat= 19;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +break; +} +/*:162*/ +#line 51 "scraps.web" +; +} +else{ +err_print("! Identifier with unmentioned ilk"); + + +} +/*:155*/ +#line 2178 "weave.web" +;break; +case 238:/*148:*/ +#line 2299 "weave.web" + +app_str("\\hbox{");while(id_first<id_loc){if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= *id_first++;}; + *(tok_ptr++)= '}'; +/*156:*/ +#line 60 "scraps.web" + +(++scrap_ptr)->cat= 28;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;; +/*:156*/ +#line 2302 "weave.web" + + + +/*:148*/ +#line 2179 "weave.web" +;break; +case 0:case 248: +break; +case(200+1):case(200+2):case(200+3): +break; +/*143:*/ +#line 2196 "weave.web" + + +case 241: +app_str("\\,"); +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;;break; +case 242: + *(tok_ptr++)= 137+3;app_str("0"); +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;;break; +case 244: +app_str("\\0"); +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(1+4 *(1))); *(++text_ptr)= tok_ptr;;break; +case 243: + *(tok_ptr++)= 137+6; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;;break; +case 245: + *(tok_ptr++)= 137+7; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;;break; +case 246: + *(tok_ptr++)= 136; +app_str("{}"); + *(tok_ptr++)= 137+5; +app_str("{}"); + *(tok_ptr++)= 136; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;;break; +case 247: +/*158:*/ +#line 65 "scraps.web" + +app_str("\\relax"); + +(++scrap_ptr)->cat= 22;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(0+4 *(0))); *(++text_ptr)= tok_ptr;; +/*:158*/ +#line 2221 "weave.web" + +break; + + +/*:143*/ +#line 2184 "weave.web" + +case 240:app_str("\\J");(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;;break; +default: *(tok_ptr++)= next_control;(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;;break; +} + + +/*:142*/ +#line 2156 "weave.web" +; +next_control= get_next(see_v); +if(next_control==248||next_control==8 +#line 498 "weave.web" +)return; +} +} + +/*:140*//*149:*/ +#line 2310 "weave.web" +text_pointer C_translate() +{ +text_pointer p; +scrap_pointer save_base; +save_base= scrap_base;scrap_base= scrap_ptr+1; +C_parse(1); +if(next_control!=248)err_print("! Missing vertical_bar after C text"); + +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= 137;};(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; + +p= translate(); +#ifdef STAT +if(scrap_ptr>max_scr_ptr)max_scr_ptr= scrap_ptr; +#endif STAT +scrap_ptr= scrap_base-1;scrap_base= save_base; +return(p); +} + +/*:149*//*150:*/ +#line 2334 "weave.web" +outer_parse() +{ +int bal; +text_pointer p,q; +while(next_control<251){ +if(next_control==8 +#line 498 "weave.web" +){ +/*152:*/ +#line 2373 "weave.web" + +if(tok_ptr+50>tok_mem_end||text_ptr+50>tok_start_end +||scrap_ptr+50>scrap_info_end){ +#ifdef STAT +if(scrap_ptr>max_scr_ptr)max_scr_ptr= scrap_ptr; +if(tok_ptr>max_tok_ptr)max_tok_ptr= tok_ptr; +if(text_ptr>max_text_ptr)max_text_ptr= text_ptr; +#endif STAT +stat_overflow("token/text/scrap"); +} + +#line 1 "scraps.web" +/*:152*/ +#line 2341 "weave.web" +; +/*151:*/ +#line 2351 "weave.web" + + *(tok_ptr++)= 137+5;app_str("\\C{"); + +bal= copy_comment(1);next_control= 248; +while(bal>0){ +p= text_ptr; + *(++text_ptr)= tok_ptr; +q= C_translate(); + + *(tok_ptr++)= 4 *10240+p-tok_start; +app_str("\\PB{"); + *(tok_ptr++)= 5 *10240+q-tok_start; +{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= '}';}; +if(next_control==248)bal= copy_comment(bal); +else bal= 0; +} + *(tok_ptr++)= 137+6; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; + + + + +/*:151*/ +#line 2342 "weave.web" +; +} +else{ +C_parse(0); +} +} +} + + +/*:150*//*174:*/ +#line 2459 "weave.web" +push_level(p) +text_pointer p; +{ +if(stack_ptr==stack_end)stat_overflow("stack"); +if(stack_ptr>stack){ +stack_ptr->end_field= cur_state.end_field; +stack_ptr->tok_field= cur_state.tok_field; +stack_ptr->mode_field= cur_state.mode_field; +} +stack_ptr++; +#ifdef STAT +if(stack_ptr>max_stack_ptr)max_stack_ptr= stack_ptr; +#endif STAT +cur_state.tok_field= *p;cur_state.end_field= *(p+1); +} + +/*:174*//*175:*/ +#line 2479 "weave.web" +pop_level() +{ +cur_state.end_field= (--stack_ptr)->end_field; +cur_state.tok_field= stack_ptr->tok_field;cur_state.mode_field= stack_ptr->mode_field; +} + +/*:175*//*177:*/ +#line 2499 "weave.web" +eight_bits get_output() +{ +sixteen_bits a; +restart:while(cur_state.tok_field==cur_state.end_field)pop_level(); +a= *(cur_state.tok_field++); +if(a>=0400){ +cur_name= a%10240+name_dir; +switch(a/10240){ +case 2:return(0201); +case 3:return(0200); +case 4:push_level(a%10240+tok_start);goto restart; + +case 5:push_level(a%10240+tok_start);cur_state.mode_field= 0;goto restart; + +default:return(200); +} +} +return(a); +} + +/*:177*//*178:*/ +#line 2535 "weave.web" + +output_C() +{ +token_pointer save_tok_ptr; +text_pointer save_text_ptr; +sixteen_bits save_next_control; +text_pointer p; +save_tok_ptr= tok_ptr; +save_text_ptr= text_ptr; +save_next_control= next_control; +next_control= 248; +p= C_translate(); + *(tok_ptr++)= 5 *10240+p-tok_start; +out_str("\\PB{"); +make_output(); +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '}';}; +#ifdef STAT +if(text_ptr>max_text_ptr)max_text_ptr= text_ptr; +if(tok_ptr>max_tok_ptr)max_tok_ptr= tok_ptr; +#endif STAT +text_ptr= save_text_ptr;tok_ptr= save_tok_ptr; +next_control= save_next_control; +} + + +/*:178*//*179:*/ +#line 2562 "weave.web" +make_output() +{ +eight_bits a, +b; +int c; +ASCII *k, *k_limit; +ASCII *j; +ASCII delim; +ASCII *save_loc, *save_limit; +name_pointer cur_mod_name; +boolean save_mode; + *(tok_ptr++)= 137+7+1; + *(++text_ptr)= tok_ptr;push_level(text_ptr-1); +while(1){ +a= get_output(); +reswitch:switch(a){ +case 137+7+1:return; +case 200:case 0201:/*180:*/ +#line 2610 "weave.web" + +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';}; +if(a==200){ +if(cur_name->dummy.Ilk==4&&!doing_format){ +/*181:*/ +#line 2633 "weave.web" + +{ +char *j; + +for(j= cur_name->byte_start;j<(cur_name+1)->byte_start;j++){ +switch( *j){ +case'_':case'^':case'$':case'#': +case'@':case'%':case'|':case'~': +case'&':{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'x';};break; +default:{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *j;}; +} +} +} + + + +/*:181*/ +#line 2614 "weave.web" + +break; +} +if(((cur_name+1)->byte_start-(cur_name)->byte_start)==1){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '|';} +else{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';} +}else{ +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '&';} +} +out_name(cur_name); + + + + + + +/*:180*/ +#line 2579 "weave.web" +;break; +case 0200:/*186:*/ +#line 2709 "weave.web" +{ +boolean is_file; +cur_xref= (xref_pointer)cur_name->equiv_or_xref; +is_file= cur_xref->num>=2 *10240; + +out_str((is_file?"\\XF":"\\X")); + +if(cur_xref->num>=10240){ +out_mod(cur_xref->num-(is_file?2 *10240:10240)); +if(phase==3){ +cur_xref= cur_xref->xlink; +while(cur_xref->num>=10240){ +out_str(", "); +out_mod(cur_xref->num-(is_file?2 *10240:10240)); +cur_xref= cur_xref->xlink; +} +} +} +else{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '0';}; +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= ':';};/*187:*/ +#line 2733 "weave.web" + +k= cur_name->byte_start;k_limit= (cur_name+1)->byte_start; +cur_mod_name= cur_name; +while(k<k_limit){ +b= *(k++); +if(b==64)/*188:*/ +#line 2755 "weave.web" + +if( *k++!=64){ +printf("\n! Illegal control code in section name: <"); + +fflush(stdout),write(1,(cur_mod_name)->byte_start,(((cur_mod_name)+1)->byte_start-((cur_mod_name))->byte_start));printf("> ");history= 2; +} + +/*:188*/ +#line 2738 "weave.web" + +if(is_file) +switch(b){ +case' ':case'\\':case'#':case'%':case'$':case'^': +case'{':case'}':case'~':case'&':case'_': +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';}; +default:{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= b;}; +} +else if(b!=124){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= b;} +else{ +/*189:*/ +#line 2768 "weave.web" + +j= limit+1; *j= 124;delim= 0; +while(1){ +if(k>=k_limit){ +printf("\n! C text in section name didn't end: <"); + +fflush(stdout),write(1,(cur_mod_name)->byte_start,(((cur_mod_name)+1)->byte_start-((cur_mod_name))->byte_start));printf("> ");history= 2;break; +} +b= *(k++); +if(b==64)/*190:*/ +#line 2790 "weave.web" +{ +if(j>buffer+500-4)stat_overflow("buffer"); + *(++j)= 64; *(++j)= *(k++); +} + +/*:190*/ +#line 2777 "weave.web" + +else{ +if(b=='\''||b=='"') +if(delim==0)delim= b; +else if(delim==b)delim= 0; +if(b!=124||delim!=0){ +if(j>buffer+500-3)stat_overflow("buffer"); + *(++j)= b; +} +else break; +} +} + +/*:189*/ +#line 2748 "weave.web" + +save_loc= loc;save_limit= limit;loc= limit+2;limit= j+1; + *limit= 124;output_C(); +loc= save_loc;limit= save_limit; +} +} + +/*:187*/ +#line 2728 "weave.web" +; +out_str((is_file?"\\XF":"\\X")); +} + +/*:186*/ +#line 2580 "weave.web" +;break; +case 133:case 134:case 135: +/*182:*/ +#line 2649 "weave.web" + +if(a==133)out_str("\\mathbin{"); +else if(a==134)out_str("\\mathrel{"); +else out_str("\\mathop{"); + +/*:182*/ +#line 2582 "weave.web" +;break; +case 137:c= 0;while((a= get_output())>=137+1&&a<=137+7){ +if(a==137+1)c++;if(a==137+2)c--; +} +/*185:*/ +#line 2698 "weave.web" + +for(;c>0;c--)out_str("\\1"); +for(;c<0;c++)out_str("\\2"); + +/*:185*/ +#line 2586 "weave.web" +; +goto reswitch; +case 136:c= 0; +while(((a= get_output())>=137+1||a==' ')&&a<=137+7){ +if(a==137+1)c++;if(a==137+2)c--; +} +/*185:*/ +#line 2698 "weave.web" + +for(;c>0;c--)out_str("\\1"); +for(;c<0;c++)out_str("\\2"); + +/*:185*/ +#line 2592 "weave.web" +; +goto reswitch; +case 137+1:case 137+2:case 137+3:case 137+4:case 137+5: +case 137+6:case 137+7:/*183:*/ +#line 2657 "weave.web" + +if(a<137+5){ +if(cur_state.mode_field==1){ +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= a-137+'0';}; +if(a==137+3){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= get_output();}; +} +else if(a==137+3)b= get_output(); +} +else/*184:*/ +#line 2673 "weave.web" +{ +b= a;save_mode= cur_state.mode_field;c= 0; +while(1){ +a= get_output(); +if(a==137||a==136){ +/*185:*/ +#line 2698 "weave.web" + +for(;c>0;c--)out_str("\\1"); +for(;c<0;c++)out_str("\\2"); + +/*:185*/ +#line 2678 "weave.web" +; +goto reswitch; +} +if((a!=' '&&a<137+1)||a==137+4||a>137+7){ +if(save_mode==1){ +if(out_ptr>out_buf+3&&strncmp(out_ptr-3,"\\Y\\P",4)==0) +goto reswitch; +/*185:*/ +#line 2698 "weave.web" + +for(;c>0;c--)out_str("\\1"); +for(;c<0;c++)out_str("\\2"); + +/*:185*/ +#line 2685 "weave.web" +; +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';};{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= b-137+'0';}; +if(a!=137+7+1)finish_line(); +} +else if(a!=137+7+1&&cur_state.mode_field==0){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= ' ';}; +goto reswitch; +} +if(a==137+1)c++; +else if(a==137+2)c--; +else if(a>b)b= a; +} +} + +/*:184*/ +#line 2665 "weave.web" + + +/*:183*/ +#line 2596 "weave.web" +;break; +default:{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= a;}; +} +} +} + +/*:179*//*191:*/ +#line 2802 "weave.web" +phase_two(){ +reset_input();printf("\nWriting the output file..."); +module_count= 0;copy_limbo(); +math_flag= 0; +finish_line();flush_buffer(out_buf,0); +while(!input_has_ended)/*193:*/ +#line 2829 "weave.web" +{ +module_count++; +/*194:*/ +#line 2846 "weave.web" + +if( *(loc-1)!='*')out_str("\\M"); + +else{ +out_str("\\N"); + +printf("*%d",module_count);fflush(stdout); +} +out_mod(module_count);out_str(". "); + +/*:194*/ +#line 2831 "weave.web" +; +save_line= out_line;save_place= out_ptr; +/*195:*/ +#line 2859 "weave.web" +do{ +next_control= copy_TeX(); +switch(next_control){ +case 248: +out_str("\\CD{}"); +stack_ptr= stack;cur_state.mode_field= 1;output_C(); +out_str("\\DC{}"); +break; +case 64:{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 64;};break; +case 12:/*196:*/ +#line 2882 "weave.web" +{ +out_str("\\O{\\~"); +while('0'<= *loc&& *loc<'8'){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *loc++;}; +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '}';}; +} + +/*:196*/ +#line 2868 "weave.web" +;break; +case 13:/*197:*/ +#line 2888 "weave.web" +{ +out_str("\\O{\\^"); +while(isxdigit( *loc)){ +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= islower( *loc)?toupper( *loc): *loc;}; +loc++; +} +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '}';}; +} + + + +/*:197*/ +#line 2869 "weave.web" +;break; +case 238:case(200+1):case(200+2):case(200+3): +case 254:loc-= 2;next_control= get_next(1); +if(next_control==238) +err_print("! TeX string should be in C text only");break; + +case 241:case 242: +case 244:case 245:case 246:case 240: +case 247:err_print("! You can't do that in TeX text");break; + +} +}while(next_control<251); + +/*:195*/ +#line 2833 "weave.web" +; +/*198:*/ +#line 2902 "weave.web" + +if(next_control<=252){ +if(save_line!=out_line||save_place!=out_ptr)out_str("\\Y");;save_line= out_line;save_place= out_ptr; +} +while(next_control<=252){ +stack_ptr= stack;cur_state.mode_field= 1; +if(next_control==252)/*200:*/ +#line 2949 "weave.web" +{ + *(tok_ptr++)= 137+4;app_str("\\D"); + +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 2952 "weave.web" + +if(next_control!=200) +err_print("! Improper macro definition"); + +else{ + *(tok_ptr++)= '$'; + *(tok_ptr++)= 10240+id_lookup(id_first,id_loc,0)-name_dir; +/*202:*/ +#line 2980 "weave.web" + +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 2981 "weave.web" + +if(next_control==40){ + *(tok_ptr++)= 40; +do{ +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 2985 "weave.web" + +if(next_control==200){ + *(tok_ptr++)= 10240+id_lookup(id_first,id_loc,0)-name_dir; +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 2988 "weave.web" + +}else{ +err_print("! Improper macro definition"); +/*201:*/ +#line 2976 "weave.web" +goto punt_the_definition; + +/*:201*/ +#line 2991 "weave.web" +; +} +if(next_control==44||next_control==41) + *(tok_ptr++)= next_control; +}while(next_control==44); +if(next_control!=41){ +err_print("! Macro parameter list must end with )"); +/*201:*/ +#line 2976 "weave.web" +goto punt_the_definition; + +/*:201*/ +#line 2998 "weave.web" +; +} +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 3000 "weave.web" + + +} + + + + +/*:202*/ +#line 2961 "weave.web" +; +if(next_control==61){ + *(tok_ptr++)= '\\'; *(tok_ptr++)= 'S'; +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 2964 "weave.web" + +}else{ +err_print("! Equals sign required in macro definition"); + +} +punt_the_definition: + *(tok_ptr++)= '$'; *(tok_ptr++)= 137+5; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; + +} +} + +/*:200*/ +#line 2908 "weave.web" + +else/*203:*/ +#line 3007 "weave.web" +{ +doing_format= 1; +app_str("\\F");(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; + + +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 3012 "weave.web" + + +if(scrap_ptr!=scrap_info+1){ +err_print("! This can't happen -- bad scrap_ptr in format definition"); +printf("\n\tscrap_ptr-scrap_info==%d\n",scrap_ptr-scrap_info); +} +if(next_control==200){ + *(tok_ptr++)= 10240+id_lookup(id_first,id_loc,0)-name_dir; +app_str(" "); +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; + +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 3023 "weave.web" + +if(next_control==200){ + *(tok_ptr++)= 10240+id_lookup(id_first,id_loc,0)-name_dir; + *(tok_ptr++)= 10; +(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; +/*40:*/ +#line 700 "weave.web" + +while((next_control= get_next(0))==10); + +/*:40*/ +#line 3028 "weave.web" + +} +} + +if(scrap_ptr!=scrap_info+3)err_print("! Improper format definition"); + +} + +/*:203*/ +#line 2909 "weave.web" +; +outer_parse();finish_C(); +doing_format= 0; +} + +/*:198*/ +#line 2834 "weave.web" +; +/*205:*/ +#line 3043 "weave.web" + +this_module= name_dir; +if(next_control<=254){ +if(save_line!=out_line||save_place!=out_ptr)out_str("\\Y");;stack_ptr= stack;cur_state.mode_field= 1; +if(next_control==253)next_control= get_next(0); +else{ +this_module= cur_module; +/*206:*/ +#line 3060 "weave.web" + +do next_control= get_next(0); +while(next_control=='+'); +if(next_control!='=') +err_print("! You need an = sign after the section name"); + +else next_control= get_next(0); +if(out_ptr>out_buf+1&& *out_ptr=='Y'&& *(out_ptr-1)=='\\') *(tok_ptr++)= 137+4; + + + *(tok_ptr++)= 3 *10240+this_module-name_dir; +cur_xref= (xref_pointer)this_module->equiv_or_xref; +app_str("${}"); +if(cur_xref->num%10240!=module_count){ +app_str("\\mathrel+"); +this_module= name_dir; +} +app_str("\\S"); + +app_str("{}$"); + *(tok_ptr++)= 137+6; +/*166:*/ +#line 363 "scraps.web" + +(++scrap_ptr)->cat= 8;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; +/*:166*/ +#line 3081 "weave.web" + + + +/*:206*/ +#line 3051 "weave.web" +; +} +while(next_control<=254){ +outer_parse(); +/*207:*/ +#line 3084 "weave.web" + +if(next_control<254){ +err_print("! You can't do that in C text"); + +next_control= get_next(1); +} +else if(next_control==254){ +if(cur_module_char!='<'){ +err_print("! You can't use a file like a module"); + +next_control= get_next(1); +}else{ + *(tok_ptr++)= 3 *10240+cur_module-name_dir; +/*167:*/ +#line 365 "scraps.web" + +(++scrap_ptr)->cat= 34;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(0+4 *(0))); *(++text_ptr)= tok_ptr;; +/*:167*/ +#line 3097 "weave.web" + +next_control= get_next(1); +} +} + +/*:207*/ +#line 3055 "weave.web" +; +} +finish_C(); +} + +/*:205*/ +#line 2835 "weave.web" +; +/*208:*/ +#line 3104 "weave.web" + +if(this_module>name_dir){ +/*210:*/ +#line 3125 "weave.web" + +first_xref= (xref_pointer)this_module->equiv_or_xref; +this_xref= first_xref->xlink; +if(this_xref->num>10240){ +mid_xref= this_xref;cur_xref= 0; +do{ +next_xref= this_xref->xlink;this_xref->xlink= cur_xref; +cur_xref= this_xref;this_xref= next_xref; +}while(this_xref->num>10240); +first_xref->xlink= cur_xref; +} +else mid_xref= xmem; +cur_xref= xmem; +while(this_xref!=xmem){ +next_xref= this_xref->xlink;this_xref->xlink= cur_xref; +cur_xref= this_xref;this_xref= next_xref; +} +if(mid_xref>xmem)mid_xref->xlink= cur_xref; +else first_xref->xlink= cur_xref; +cur_xref= first_xref->xlink; + +/*:210*/ +#line 3106 "weave.web" +; +footnote(((((xref_pointer)this_module->equiv_or_xref)->num>=2 *10240) +?2 *10240:10240)); +footnote(0); +} + +/*:208*/ +#line 2836 "weave.web" +; +/*213:*/ +#line 3194 "weave.web" + +out_str("\\fi");finish_line(); + +flush_buffer(out_buf,0); + +/*:213*/ +#line 2837 "weave.web" +; +} + +/*:193*/ +#line 2807 "weave.web" +; +} + +/*:191*//*199:*/ +#line 2924 "weave.web" +finish_C() +{ +text_pointer p; +out_str("\\P");{if(tok_ptr+2>tok_mem_end)stat_overflow("token"); *(tok_ptr++)= 137+6;};(++scrap_ptr)->cat= 45;scrap_ptr->trans_plus.Trans= text_ptr;scrap_ptr->mathness= ((eight_bits)(2+4 *(2))); *(++text_ptr)= tok_ptr;; +p= translate(); + + *(tok_ptr++)= p-tok_start+4 *10240;make_output(); +if(out_ptr>out_buf+1) +if( *(out_ptr-1)=='\\') + + + +if( *out_ptr=='6')out_ptr-= 2; +else if( *out_ptr=='7') *out_ptr= 'Y'; +out_str("\\par");finish_line(); +#ifdef STAT +if(text_ptr>max_text_ptr)max_text_ptr= text_ptr; +if(tok_ptr>max_tok_ptr)max_tok_ptr= tok_ptr; +if(scrap_ptr>max_scr_ptr)max_scr_ptr= scrap_ptr; +#endif STAT +tok_ptr= tok_mem+1;text_ptr= tok_start+1;scrap_ptr= scrap_info; + +} + +/*:199*//*211:*/ +#line 3156 "weave.web" +footnote(flag) +sixteen_bits flag; +{ +xref_pointer q; +if(cur_xref->num<=flag)return; +finish_line();{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '\\';}; + + + + +if(flag==0){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'U';} +else{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'A';}; +/*212:*/ +#line 3176 "weave.web" + +q= cur_xref; +if(q->xlink->num>flag){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 's';}; +while(1){ +out_mod(cur_xref->num-flag); +cur_xref= cur_xref->xlink; +if(cur_xref->num<=flag)break; +if(cur_xref->xlink->num>flag)out_str(", "); +else{ +out_str("\\ET"); +if(cur_xref!=q->xlink){if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 's';} +} +} + + + + + +/*:212*/ +#line 3168 "weave.web" +; +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '.';}; +} + +/*:211*//*215:*/ +#line 3210 "weave.web" +phase_three(){ +if(no_xref){ +finish_line(); +out_str("\\vfill\\end"); +finish_line(); +} +else{ +phase= 3;printf("\nWriting the index..."); +if(change_exists){ +finish_line();/*217:*/ +#line 3241 "weave.web" +{ + +k_module= 0; +while(!changed_module[++k_module]); +out_str("\\ch "); +out_mod(k_module); +while(1){ +while(!changed_module[++k_module]); +out_str(", ");out_mod(k_module); +if(k_module==module_count)break; +} +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '.';}; +} + +/*:217*/ +#line 3219 "weave.web" +; +} +finish_line();out_str("\\inx");finish_line(); + +/*219:*/ +#line 3273 "weave.web" +{ +int c; +for(c= 0;c<=127;c++)bucket[c]= NULL; +for(h= hash;h<=hash_end;h++){ +next_name= *h; +while(next_name){ +cur_name= next_name;next_name= cur_name->link; +if(((xref_pointer)cur_name->equiv_or_xref)!=xmem){ +c= (cur_name->byte_start)[0]; +if(c<='Z'&&c>='A')c= c+040; +blink[cur_name-name_dir]= bucket[c];bucket[c]= cur_name; +} +} +} +} + +/*:219*/ +#line 3223 "weave.web" +; +/*227:*/ +#line 3361 "weave.web" + +scrap_ptr= scrap_info;unbucket(1); +while(scrap_ptr>scrap_info){ +cur_depth= scrap_ptr->cat; +if(blink[scrap_ptr->trans_plus.Head-name_dir]==0||cur_depth==255) +/*229:*/ +#line 3391 "weave.web" + +{ +name_pointer tp; + +tp= id_lookup("TeX",NULL,4); +tp->dummy.Ilk= 0; + +cur_name= scrap_ptr->trans_plus.Head; +do{ +out_str("\\:"); + +/*230:*/ +#line 3411 "weave.web" + + +switch(cur_name->dummy.Ilk){ +case 0:if(((cur_name+1)->byte_start-(cur_name)->byte_start)==1)out_str("\\|"); +else out_str("\\\\");break; +case 1:break; +case 2:out_str("\\9");break; +case 3:out_str("\\.");break; +case 4: +out_str("$\\"); +/*181:*/ +#line 2633 "weave.web" + +{ +char *j; + +for(j= cur_name->byte_start;j<(cur_name+1)->byte_start;j++){ +switch( *j){ +case'_':case'^':case'$':case'#': +case'@':case'%':case'|':case'~': +case'&':{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= 'x';};break; +default:{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= *j;}; +} +} +} + + + +/*:181*/ +#line 3421 "weave.web" + +out_str("$"); +goto name_done; +default:out_str("\\&"); +} +out_name(cur_name); +name_done:; + + + + + + + + + +/*:230*/ +#line 3402 "weave.web" +; +/*231:*/ +#line 3440 "weave.web" + +/*232:*/ +#line 3455 "weave.web" + +this_xref= (xref_pointer)cur_name->equiv_or_xref;cur_xref= xmem; +do{ +next_xref= this_xref->xlink;this_xref->xlink= cur_xref; +cur_xref= this_xref;this_xref= next_xref; +}while(this_xref!=xmem); + +/*:232*/ +#line 3441 "weave.web" +; +do{ +out_str(", ");cur_val= cur_xref->num; +if(cur_val<10240)out_mod(cur_val); +else{out_str("\\[");out_mod(cur_val%10240);{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= ']';};} + +cur_xref= cur_xref->xlink; +}while(cur_xref!=xmem); +{if(out_ptr>=out_buf_end)break_out(); *(++out_ptr)= '.';};finish_line(); + +/*:231*/ +#line 3403 "weave.web" +; +cur_name= blink[cur_name-name_dir]; +}while(cur_name); +--scrap_ptr; +} + + + +/*:229*/ +#line 3366 "weave.web" + +else/*228:*/ +#line 3370 "weave.web" +{ +ASCII c; +next_name= scrap_ptr->trans_plus.Head; +do{ +cur_name= next_name;next_name= blink[cur_name-name_dir]; +cur_byte= cur_name->byte_start+cur_depth; +if(cur_byte==(cur_name+1)->byte_start)c= 0; +else{ +c= *cur_byte; +if(c<='Z'&&c>='A')c= c+040; +} +blink[cur_name-name_dir]= bucket[c];bucket[c]= cur_name; +}while(next_name); +--scrap_ptr;unbucket(cur_depth+1); +} + +/*:228*/ +#line 3367 "weave.web" +; +} + +/*:227*/ +#line 3224 "weave.web" +; +out_str("\\fin");finish_line(); + +/*235:*/ +#line 3488 "weave.web" + +do_file= (1==1); +mod_print(name_dir->dummy.Rlink); +do_file= (1==0); +mod_print(name_dir->dummy.Rlink); + + + +/*:235*/ +#line 3227 "weave.web" +; +out_str("\\con");finish_line(); + +} +printf("Done."); +check_complete(); +} + +/*:215*//*226:*/ +#line 3345 "weave.web" +unbucket(d) +eight_bits d; +{ +ASCII c; +for(c= 100;c>=0;c--)if(bucket[collate[c]]){ +if(scrap_ptr>=scrap_info_end)stat_overflow("sorting"); +scrap_ptr++; +#ifdef STAT +if(scrap_ptr>max_sort_ptr)max_sort_ptr= scrap_ptr; +#endif STAT +if(c==0)scrap_ptr->cat= 255; +else scrap_ptr->cat= d; +scrap_ptr->trans_plus.Head= bucket[collate[c]];bucket[collate[c]]= NULL; +} +} + +/*:226*//*233:*/ +#line 3466 "weave.web" +mod_print(p) +name_pointer p; +{ +boolean is_file; +if(p){ +mod_print(p->link); +cur_xref= (xref_pointer)p->equiv_or_xref; +is_file= ((cur_xref->num)>=2 *10240); +if((is_file&&do_file)||(!is_file&&!do_file)){ +out_str("\\:"); + +tok_ptr= tok_mem+1;text_ptr= tok_start+1;scrap_ptr= scrap_info;stack_ptr= stack;cur_state.mode_field= 1; + *(tok_ptr++)= p-name_dir+3 *10240;make_output(); +footnote(0); +finish_line(); +} +mod_print(p->dummy.Rlink); +} +} + +/*:233*//*237:*/ +#line 3512 "weave.web" + +stat_overflow(s) +char *s; +{ +printf("\n! Sorry, capacity exceeded: %s",s); +#ifdef STAT +/*236:*/ +#line 3496 "weave.web" + +printf( +"\nMemory usage statistics: %d of %d names, %d of %d cross-references,\n", +name_ptr-name_dir,name_dir_end-name_dir, +xref_ptr-xmem,xmem_end-xmem); +printf("\t %d of %d bytes;",byte_ptr-byte_mem,byte_mem_end-byte_mem); +printf("\nParsing required %d of %d(%d) scraps, %d of %d(%d) texts,\n", +max_scr_ptr-scrap_info,2000,2000-50, +max_text_ptr-tok_start,4000,4000-50 +); +printf("\t %d of %d(%d) tokens, %d of %d levels;\n", +max_tok_ptr-tok_mem,20000,20000-50, +max_stack_ptr-stack,stack_end-stack +); +printf("\nSorting required %d levels\n",max_sort_ptr-scrap_info); + +/*:236*/ +#line 3518 "weave.web" +; +#endif STAT +history= 3;wrap_up(); +} + +/*:237*/ |