/*1:*/
#line 75 "/home/mark/litprog/spider/src/master/common.web"

#include<stdio.h>
#ifdef MSDOS
#define index strchr
#endif

/*3:*/
#line 97 "/home/mark/litprog/spider/src/master/common.web"

extern char the_at_sign;


/*:3*//*65:*/
#line 1089 "/home/mark/litprog/spider/src/master/common.web"
extern char C_file_extension[];
#line 1090 "/home/mark/litprog/spider/src/master/common.web"

/*:65*/
#line 81 "/home/mark/litprog/spider/src/master/common.web"

/*9:*/
#line 229 "/home/mark/litprog/spider/src/master/common.web"
char setting_up;
#line 230 "/home/mark/litprog/spider/src/master/common.web"

/*:9*/
#line 82 "/home/mark/litprog/spider/src/master/common.web"

/*4:*/
#line 104 "/home/mark/litprog/spider/src/master/common.web"

#line 105 "/home/mark/litprog/spider/src/master/common.web"
typedef short boolean;
typedef char unsigned eight_bits;
boolean program;

/*:4*//*6:*/
#line 191 "/home/mark/litprog/spider/src/master/common.web"

typedef char ASCII;
typedef char outer_char;

/*:6*//*7:*/
#line 199 "/home/mark/litprog/spider/src/master/common.web"

#line 200 "/home/mark/litprog/spider/src/master/common.web"
ASCII xord[127+1];
outer_char xchr[128];

/*:7*//*12:*/
#line 291 "/home/mark/litprog/spider/src/master/common.web"

ASCII buffer[500];
ASCII *buffer_end= buffer+200-2;
ASCII *limit;
ASCII *loc;

/*:12*//*14:*/
#line 344 "/home/mark/litprog/spider/src/master/common.web"

int include_depth;
FILE *file[10];
FILE *change_file;
char file_name[10][60];

char change_file_name[60];
int line[10];
int change_line;
boolean input_has_ended;
boolean changing;

/*:14*//*26:*/
#line 534 "/home/mark/litprog/spider/src/master/common.web"

typedef unsigned short sixteen_bits;
sixteen_bits module_count;
boolean changed_module[2000];
boolean print_where= 0;

/*:26*//*37:*/
#line 672 "/home/mark/litprog/spider/src/master/common.web"

typedef struct name_info{
ASCII *byte_start;
 /*41:*/
#line 711 "/home/mark/litprog/spider/src/master/common.web"

#line 712 "/home/mark/litprog/spider/src/master/common.web"
struct name_info *link;

/*:41*//*48:*/
#line 804 "/home/mark/litprog/spider/src/master/common.web"

union{
struct name_info *Rlink;

eight_bits Ilk;
}dummy;

/*:48*//*55:*/
#line 943 "/home/mark/litprog/spider/src/master/common.web"

ASCII *equiv_or_xref;

/*:55*/
#line 675 "/home/mark/litprog/spider/src/master/common.web"

}name_info;
typedef name_info *name_pointer;
ASCII byte_mem[90000];
ASCII *byte_mem_end= byte_mem+90000-1;
name_info name_dir[4000];
name_pointer name_dir_end= name_dir+4000-1;

/*:37*//*39:*/
#line 697 "/home/mark/litprog/spider/src/master/common.web"

name_pointer name_ptr;
ASCII *byte_ptr;

/*:39*//*42:*/
#line 727 "/home/mark/litprog/spider/src/master/common.web"

typedef name_pointer *hash_pointer;
name_pointer hash[353];
hash_pointer hash_end= hash+353-1;
hash_pointer h;

/*:42*//*56:*/
#line 963 "/home/mark/litprog/spider/src/master/common.web"

int history= 0;

/*:56*//*64:*/
#line 1076 "/home/mark/litprog/spider/src/master/common.web"

#line 1077 "/home/mark/litprog/spider/src/master/common.web"
int argc;
char * *argv;
char C_file_name[60];
char tex_file_name[60];
int no_xref;

/*:64*//*75:*/
#line 1202 "/home/mark/litprog/spider/src/master/common.web"

#line 1203 "/home/mark/litprog/spider/src/master/common.web"
FILE *C_file;
FILE *tex_file;

/*:75*/
#line 83 "/home/mark/litprog/spider/src/master/common.web"

/*5:*/
#line 115 "/home/mark/litprog/spider/src/master/common.web"
int phase;
#line 116 "/home/mark/litprog/spider/src/master/common.web"

/*:5*//*15:*/
#line 366 "/home/mark/litprog/spider/src/master/common.web"

ASCII change_buffer[200];
ASCII *change_limit;

/*:15*//*30:*/
#line 569 "/home/mark/litprog/spider/src/master/common.web"

#line 1 "pathopen.h"

#line 187"/u/norman/pu/web/dist/src/master/pathopen.web"

#line 188"/u/norman/pu/web/dist/src/master/pathopen.web"
void pathaddname();
void pathaddpath();
void pathreset();
FILE *pathopen();

#line 571 "/home/mark/litprog/spider/src/master/common.web"
/*:30*//*50:*/
#line 829 "/home/mark/litprog/spider/src/master/common.web"

name_pointer install_node();

/*:50*/
#line 84 "/home/mark/litprog/spider/src/master/common.web"

/*8:*/
#line 215 "/home/mark/litprog/spider/src/master/common.web"

#line 216 "/home/mark/litprog/spider/src/master/common.web"
common_init()
{
strncpy(xchr,"                                 !\"#$%&'()*+,-./0123456789\
:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ ",128);
/*11:*/
#line 270 "/home/mark/litprog/spider/src/master/common.web"


/*:11*/
#line 220 "/home/mark/litprog/spider/src/master/common.web"
;
/*10:*/
#line 234 "/home/mark/litprog/spider/src/master/common.web"
{
#line 235 "/home/mark/litprog/spider/src/master/common.web"
int i;
for(i= 0;i<=127;i++)
xord[i]= 32;
for(i= 1;i<127;i++)xord[xchr[i]]= i;
}

/*:10*/
#line 221 "/home/mark/litprog/spider/src/master/common.web"
;
/*40:*/
#line 701 "/home/mark/litprog/spider/src/master/common.web"

#line 702 "/home/mark/litprog/spider/src/master/common.web"
name_dir->byte_start= byte_ptr= byte_mem;
name_ptr= name_dir+1;
name_ptr->byte_start= byte_mem;

/*:40*//*43:*/
#line 735 "/home/mark/litprog/spider/src/master/common.web"

#line 736 "/home/mark/litprog/spider/src/master/common.web"
for(h= hash;h<=hash_end; *h++= NULL);

/*:43*//*49:*/
#line 811 "/home/mark/litprog/spider/src/master/common.web"

#line 812 "/home/mark/litprog/spider/src/master/common.web"
name_dir->dummy.Rlink= NULL;

/*:49*/
#line 222 "/home/mark/litprog/spider/src/master/common.web"
;
setting_up= 1;
/*76:*/
#line 1206 "/home/mark/litprog/spider/src/master/common.web"

#line 1207 "/home/mark/litprog/spider/src/master/common.web"
scan_args();
/*28:*/
#line 565 "/home/mark/litprog/spider/src/master/common.web"

#line 566 "/home/mark/litprog/spider/src/master/common.web"
pathaddpath(getenv("WEBPATH"),':');
/*:28*/
#line 1208 "/home/mark/litprog/spider/src/master/common.web"

if(program==0){
if((C_file= fopen(C_file_name,"w"))==NULL)
{printf("! Cannot open output file ");err_print(C_file_name);history= 3;wrap_up();};
}
else{
if((tex_file= fopen(tex_file_name,"w"))==NULL)
{printf("! Cannot open output file ");err_print(tex_file_name);history= 3;wrap_up();};
}

/*:76*/
#line 224 "/home/mark/litprog/spider/src/master/common.web"
;
setting_up= 0;
}

/*:8*//*13:*/
#line 301 "/home/mark/litprog/spider/src/master/common.web"

#line 302 "/home/mark/litprog/spider/src/master/common.web"
#include<stdio.h>
input_ln(fp)
FILE *fp;
{
register int c;
register ASCII *k;
if(feof(fp))return(0);
limit= k= buffer;
while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n')
if(( *(k++)= xord[c])!=32)limit= k;
if(k>buffer_end)
if((c= getc(fp))!=EOF&&c!='\n'){
ungetc(c,fp);loc= buffer;err_print("\n! Input line too long");

}
if(c==EOF&&limit==buffer)return(0);

return(1);
}

/*:13*//*16:*/
#line 376 "/home/mark/litprog/spider/src/master/common.web"

#line 377 "/home/mark/litprog/spider/src/master/common.web"
prime_the_change_buffer()
{
change_limit= 0;
/*17:*/
#line 390 "/home/mark/litprog/spider/src/master/common.web"

#line 391 "/home/mark/litprog/spider/src/master/common.web"
while(1){
change_line++;
if(!input_ln(change_file))return;
if(limit<buffer+2)continue;
if(buffer[0]!=the_at_sign)continue;
/*18:*/
#line 408 "/home/mark/litprog/spider/src/master/common.web"

#line 409 "/home/mark/litprog/spider/src/master/common.web"
if(buffer[1]>=88&&buffer[1]<=90||buffer[1]==73)buffer[1]+= 122-90;

/*:18*/
#line 396 "/home/mark/litprog/spider/src/master/common.web"
;
/*19:*/
#line 413 "/home/mark/litprog/spider/src/master/common.web"
{
#line 414 "/home/mark/litprog/spider/src/master/common.web"
if(buffer[1]==105){
loc= buffer+2;
err_print("! No includes allowed in change file");

}
}

/*:19*/
#line 397 "/home/mark/litprog/spider/src/master/common.web"
;
if(buffer[1]==120)break;
if(buffer[1]==121||buffer[1]==122){
loc= buffer+2;
err_print("! Where is the matching @x?");

}
}

/*:17*/
#line 380 "/home/mark/litprog/spider/src/master/common.web"
;
/*20:*/
#line 423 "/home/mark/litprog/spider/src/master/common.web"

#line 424 "/home/mark/litprog/spider/src/master/common.web"
do{
change_line++;
if(!input_ln(change_file)){
err_print("! Change file ended after @x");

return;
}
}while(limit==buffer);

/*:20*/
#line 381 "/home/mark/litprog/spider/src/master/common.web"
;
/*21:*/
#line 433 "/home/mark/litprog/spider/src/master/common.web"

#line 434 "/home/mark/litprog/spider/src/master/common.web"
{
change_limit= change_buffer-buffer+limit;
strncpy(change_buffer,buffer,limit-buffer+1);
}

/*:21*/
#line 382 "/home/mark/litprog/spider/src/master/common.web"
;
}

/*:16*//*22:*/
#line 448 "/home/mark/litprog/spider/src/master/common.web"

#line 449 "/home/mark/litprog/spider/src/master/common.web"
check_change()
{
int n= 0;
if((change_limit-change_buffer!=limit-buffer||strncmp(buffer,change_buffer,limit-buffer)))return;
while(1){
changing= 1;print_where= 1;change_line++;
if(!input_ln(change_file)){
err_print("! Change file ended before @y");

change_limit= 0;changing= 0;print_where= 1;
return;
}
if(limit>buffer+1&&buffer[0]==the_at_sign)
/*19:*/
#line 413 "/home/mark/litprog/spider/src/master/common.web"
{
#line 414 "/home/mark/litprog/spider/src/master/common.web"
if(buffer[1]==105){
loc= buffer+2;
err_print("! No includes allowed in change file");

}
}

/*:19*/
#line 462 "/home/mark/litprog/spider/src/master/common.web"
;
/*23:*/
#line 479 "/home/mark/litprog/spider/src/master/common.web"

#line 480 "/home/mark/litprog/spider/src/master/common.web"
if(limit>buffer+1&&buffer[0]==the_at_sign){
/*18:*/
#line 408 "/home/mark/litprog/spider/src/master/common.web"

#line 409 "/home/mark/litprog/spider/src/master/common.web"
if(buffer[1]>=88&&buffer[1]<=90||buffer[1]==73)buffer[1]+= 122-90;

/*:18*/
#line 481 "/home/mark/litprog/spider/src/master/common.web"
;
if(buffer[1]==120||buffer[1]==122){
loc= buffer+2;err_print("! Where is the matching @y?");

}
else if(buffer[1]==121){
if(n>0){
loc= buffer+2;
err_print("! Hmm... some of the preceding lines failed to match");

}
return;
}
}

/*:23*/
#line 464 "/home/mark/litprog/spider/src/master/common.web"
;
/*21:*/
#line 433 "/home/mark/litprog/spider/src/master/common.web"

#line 434 "/home/mark/litprog/spider/src/master/common.web"
{
change_limit= change_buffer-buffer+limit;
strncpy(change_buffer,buffer,limit-buffer+1);
}

/*:21*/
#line 465 "/home/mark/litprog/spider/src/master/common.web"
;
changing= 0;print_where= 1;line[include_depth]++;
while(!input_ln(file[include_depth])){
if(include_depth==0){
err_print("! WEB file ended during a change");

input_has_ended= 1;return;
}
include_depth--;print_where= 1;line[include_depth]++;
}
if((change_limit-change_buffer!=limit-buffer||strncmp(buffer,change_buffer,limit-buffer)))n++;
}
}

/*:22*//*24:*/
#line 499 "/home/mark/litprog/spider/src/master/common.web"

#line 500 "/home/mark/litprog/spider/src/master/common.web"
reset_input()
{
limit= buffer;loc= buffer+1;buffer[0]= 32;
/*25:*/
#line 512 "/home/mark/litprog/spider/src/master/common.web"

#line 513 "/home/mark/litprog/spider/src/master/common.web"
if((file[0]= fopen(file_name[0],"r"))==NULL)
{printf("! Cannot open input file ");err_print(file_name[0]);history= 3;wrap_up();};
if((change_file= fopen(change_file_name,"r"))==NULL)
{printf("! Cannot open change file ");err_print(change_file_name);history= 3;wrap_up();};

/*:25*/
#line 503 "/home/mark/litprog/spider/src/master/common.web"
;
line[include_depth]= 0;change_line= 0;include_depth= 0;
changing= 1;prime_the_change_buffer();changing= !changing;
limit= buffer;loc= buffer+1;buffer[0]= 32;input_has_ended= 0;
}

/*:24*//*27:*/
#line 540 "/home/mark/litprog/spider/src/master/common.web"

#line 541 "/home/mark/litprog/spider/src/master/common.web"
get_line()
{
restart:
if(changing)changed_module[module_count]= 1;
else/*34:*/
#line 607 "/home/mark/litprog/spider/src/master/common.web"
{
#line 608 "/home/mark/litprog/spider/src/master/common.web"
line[include_depth]++;
while(!input_ln(file[include_depth])){
print_where= 1;
if(include_depth==0){input_has_ended= 1;break;}
else{fclose(file[include_depth]);include_depth--;line[include_depth]++;}
}
if(!input_has_ended)
if(limit==change_limit-change_buffer+buffer)
if(buffer[0]==change_buffer[0])
if(change_limit>change_buffer)check_change();
}

/*:34*/
#line 545 "/home/mark/litprog/spider/src/master/common.web"
;
if(changing){
/*35:*/
#line 620 "/home/mark/litprog/spider/src/master/common.web"
{
#line 621 "/home/mark/litprog/spider/src/master/common.web"
change_line++;
if(!input_ln(change_file)){
err_print("! Change file ended without @z");

buffer[0]= the_at_sign;buffer[1]= 122;limit= buffer+2;
}
if(limit>buffer+1)
if(buffer[0]==the_at_sign){
/*18:*/
#line 408 "/home/mark/litprog/spider/src/master/common.web"

#line 409 "/home/mark/litprog/spider/src/master/common.web"
if(buffer[1]>=88&&buffer[1]<=90||buffer[1]==73)buffer[1]+= 122-90;

/*:18*/
#line 629 "/home/mark/litprog/spider/src/master/common.web"
;
/*19:*/
#line 413 "/home/mark/litprog/spider/src/master/common.web"
{
#line 414 "/home/mark/litprog/spider/src/master/common.web"
if(buffer[1]==105){
loc= buffer+2;
err_print("! No includes allowed in change file");

}
}

/*:19*/
#line 630 "/home/mark/litprog/spider/src/master/common.web"
;
if(buffer[1]==120||buffer[1]==121){
loc= buffer+2;err_print("! Where is the matching @z?");

}
else if(buffer[1]==122){
prime_the_change_buffer();changing= !changing;print_where= 1;
}
}
}

/*:35*/
#line 547 "/home/mark/litprog/spider/src/master/common.web"
;
if(!changing){
changed_module[module_count]= 1;goto restart;
}
}
loc= buffer; *limit= 32;
if( *buffer==the_at_sign&&( *(buffer+1)==105|| *(buffer+1)==73))
/*33:*/
#line 579 "/home/mark/litprog/spider/src/master/common.web"
{
#line 580 "/home/mark/litprog/spider/src/master/common.web"
ASCII *k, *j;
loc= buffer+2;
while(loc<=limit&&( *loc==32|| *loc==9|| *loc==34))loc++;
if(loc>=limit)err_print("! Include file name not given");

else{
if(++include_depth<10){
k= file_name[include_depth];j= loc;
while( *loc!=32&& *loc!=9&& *loc!=34) *k++= xchr[ *loc++];
 *k= '\0';
if((file[include_depth]= pathopen(file_name[include_depth],"r"))==NULL){
loc= j;
include_depth--;
err_print("! Cannot find include file on path");

}
else{line[include_depth]= 0;print_where= 1;}
}
else{
include_depth--;
err_print("! Too many nested includes");

}
}
goto restart;
}

/*:33*/
#line 554 "/home/mark/litprog/spider/src/master/common.web"
;
return(!input_has_ended);
}

/*:27*//*32:*/
#line 572 "/home/mark/litprog/spider/src/master/common.web"

#line 573 "/home/mark/litprog/spider/src/master/common.web"
void overflow (s)
char *s;
{{{printf("\n! Sorry, capacity exceeded: ");err_print(s);history= 3;wrap_up();};};}
/*:32*//*36:*/
#line 644 "/home/mark/litprog/spider/src/master/common.web"

#line 645 "/home/mark/litprog/spider/src/master/common.web"
check_complete(){
if(change_limit!=0){
strncpy(buffer,change_buffer,change_limit-change_buffer+1);
limit= change_limit-change_buffer+buffer;
changing= 1;loc= change_limit;
err_print("! Change file entry did not match");

}
}

/*:36*//*57:*/
#line 977 "/home/mark/litprog/spider/src/master/common.web"

#line 978 "/home/mark/litprog/spider/src/master/common.web"
err_print(s)
char *s;
{
ASCII *k, *l;
printf("\n%s",(s==(char *)0)?"Bad error message!!!":s);
if(setting_up){
printf("\nError occurred while scanning arguments or opening output files. ");
}else{
/*58:*/
#line 1000 "/home/mark/litprog/spider/src/master/common.web"

#line 1001 "/home/mark/litprog/spider/src/master/common.web"
if(changing)printf(". (l. %d of change file)\n",change_line);
else if(include_depth==0)printf(". (l. %d)\n",line[include_depth]);
else printf(". (l. %d of include file %s)\n",line[include_depth],file_name[include_depth]);
l= (loc>=limit?limit:loc);
if(l>buffer){
for(k= buffer;k<l;k++)
if( *k=='\t')putchar(' ');
else putchar(xchr[ *k]);
putchar('\n');
for(k= buffer;k<l;k++)putchar(' ');
}
for(k= l;k<limit;k++)putchar(xchr[ *k]);
if( *limit==124)putchar('|');
putchar(' ');

/*:58*/
#line 986 "/home/mark/litprog/spider/src/master/common.web"
;
}
fflush(stdout);history= 2;
}

/*:57*//*62:*/
#line 1046 "/home/mark/litprog/spider/src/master/common.web"

wrap_up(){
putchar('\n');
/*63:*/
#line 1054 "/home/mark/litprog/spider/src/master/common.web"

#line 1055 "/home/mark/litprog/spider/src/master/common.web"
switch(history){
case 0:printf("(No errors were found.)\n");break;
case 1:
printf("(Did you see the warning message above?)\n");break;
case 2:
printf("(Pardon me, but I think I spotted something wrong.)\n");break;
case 3:printf("(That was a fatal error, my friend.)\n");
}

/*:63*/
#line 1049 "/home/mark/litprog/spider/src/master/common.web"
;
if(history>1)exit(1);
else exit(0);
}

/*:62*//*66:*/
#line 1097 "/home/mark/litprog/spider/src/master/common.web"

#line 1098 "/home/mark/litprog/spider/src/master/common.web"
scan_args()
{
char *dot_pos, *index();
boolean found_web= 0,found_change= 0;
no_xref= 0;
while(--argc>0){
if( * *(++argv)!='-'){
if(!found_web)/*67:*/
#line 1121 "/home/mark/litprog/spider/src/master/common.web"

#line 1122 "/home/mark/litprog/spider/src/master/common.web"
{
if(strlen( *argv)>60-5)
/*73:*/
#line 1193 "/home/mark/litprog/spider/src/master/common.web"
{printf("! Filename %s too long\n");err_print( *argv);history= 3;wrap_up();};
#line 1194 "/home/mark/litprog/spider/src/master/common.web"

/*:73*/
#line 1124 "/home/mark/litprog/spider/src/master/common.web"
;
if((dot_pos= index( *argv,'.'))==NULL)
sprintf(file_name[0],"%s.web", *argv);
else{
sprintf(file_name[0],"%s", *argv);
/*68:*/
#line 1137 "/home/mark/litprog/spider/src/master/common.web"

#line 1138 "/home/mark/litprog/spider/src/master/common.web"
{char *p;
p= dot_pos;
while( *++p!='\0')
if( *p=='.')dot_pos= p;
}

/*:68*/
#line 1129 "/home/mark/litprog/spider/src/master/common.web"

 *dot_pos= 0;
}
sprintf(tex_file_name,"%s.tex", *argv);
sprintf(C_file_name,"%s.%s", *argv,C_file_extension);
found_web= 1;
}

/*:67*/
#line 1106 "/home/mark/litprog/spider/src/master/common.web"

else if(!found_change)/*69:*/
#line 1144 "/home/mark/litprog/spider/src/master/common.web"

#line 1145 "/home/mark/litprog/spider/src/master/common.web"
{
if(strlen( *argv)>60-5)
/*73:*/
#line 1193 "/home/mark/litprog/spider/src/master/common.web"
{printf("! Filename %s too long\n");err_print( *argv);history= 3;wrap_up();};
#line 1194 "/home/mark/litprog/spider/src/master/common.web"

/*:73*/
#line 1147 "/home/mark/litprog/spider/src/master/common.web"
;
if((dot_pos= index( *argv,'.'))==NULL)
sprintf(change_file_name,"%s.ch", *argv);
else sprintf(change_file_name,"%s", *argv);
found_change= 1;
}

/*:69*/
#line 1107 "/home/mark/litprog/spider/src/master/common.web"

else/*72:*/
#line 1184 "/home/mark/litprog/spider/src/master/common.web"

#line 1185 "/home/mark/litprog/spider/src/master/common.web"
{
if(program==0)
{printf("! Usage: tangle webfile[.web] [changefile[.ch]] [-Ipathname ...]\n");err_print(0);history= 3;wrap_up();}
else
{printf("! Usage: weave webfile[.web] [changefile[.ch]] [-x] [-Ipathname ...]\n");err_print(
0);history= 3;wrap_up();};
}

/*:72*/
#line 1108 "/home/mark/litprog/spider/src/master/common.web"
;
}
else/*71:*/
#line 1169 "/home/mark/litprog/spider/src/master/common.web"

#line 1170 "/home/mark/litprog/spider/src/master/common.web"
{
switch(( *argv)[1]){
case'x':
no_xref= 1;
break;
case'I':
/*29:*/
#line 567 "/home/mark/litprog/spider/src/master/common.web"

#line 568 "/home/mark/litprog/spider/src/master/common.web"
pathaddname( *argv+2);
/*:29*/
#line 1176 "/home/mark/litprog/spider/src/master/common.web"

break;
default:
/*74:*/
#line 1195 "/home/mark/litprog/spider/src/master/common.web"
{
#line 1196 "/home/mark/litprog/spider/src/master/common.web"
printf("! Unknown option in argument %s\n", *argv);{if(history==0)history= 1;};
}

/*:74*/
#line 1179 "/home/mark/litprog/spider/src/master/common.web"
;
break;
}
}

/*:71*/
#line 1110 "/home/mark/litprog/spider/src/master/common.web"
;
}
if(!found_web)/*72:*/
#line 1184 "/home/mark/litprog/spider/src/master/common.web"

#line 1185 "/home/mark/litprog/spider/src/master/common.web"
{
if(program==0)
{printf("! Usage: tangle webfile[.web] [changefile[.ch]] [-Ipathname ...]\n");err_print(0);history= 3;wrap_up();}
else
{printf("! Usage: weave webfile[.web] [changefile[.ch]] [-x] [-Ipathname ...]\n");err_print(
0);history= 3;wrap_up();};
}

/*:72*/
#line 1112 "/home/mark/litprog/spider/src/master/common.web"
;
if(!found_change)/*70:*/
#line 1154 "/home/mark/litprog/spider/src/master/common.web"

#line 1155 "/home/mark/litprog/spider/src/master/common.web"
#ifdef MSDOS
strcpy(change_file_name,"NUL");
#else
strcpy(change_file_name,"/dev/null");
#endif
/*:70*/
#line 1113 "/home/mark/litprog/spider/src/master/common.web"
;
}

/*:66*/
#line 85 "/home/mark/litprog/spider/src/master/common.web"
;

/*:1*//*44:*/
#line 740 "/home/mark/litprog/spider/src/master/common.web"
name_pointer
#line 741 "/home/mark/litprog/spider/src/master/common.web"
 id_lookup(first,last,t)
ASCII *first;
ASCII *last;
eight_bits t;
{
ASCII *i= first;
int h;
int l;
name_pointer p;
if(last==NULL)for(last= first; *last!='\0';last++);
l= last-first;
/*45:*/
#line 762 "/home/mark/litprog/spider/src/master/common.web"

h=  *i;while(++i<last)h= (h+h+ *i)%353;

/*:45*/
#line 752 "/home/mark/litprog/spider/src/master/common.web"
;
/*46:*/
#line 768 "/home/mark/litprog/spider/src/master/common.web"

#line 769 "/home/mark/litprog/spider/src/master/common.web"
p= hash[h];
while(p&&!names_match(p,first,l,t))p= p->link;
if(p==NULL){
p= name_ptr;
p->link= hash[h];hash[h]= p;
}

/*:46*/
#line 753 "/home/mark/litprog/spider/src/master/common.web"
;
if(p==name_ptr)/*47:*/
#line 780 "/home/mark/litprog/spider/src/master/common.web"
{
#line 781 "/home/mark/litprog/spider/src/master/common.web"
if(byte_ptr+l>byte_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("byte memory");history= 3;wrap_up();};};
if(name_ptr>=name_dir_end){{printf("\n! Sorry, capacity exceeded: ");err_print("name");history= 3;wrap_up();};};
strncpy(byte_ptr,first,l);
(++name_ptr)->byte_start= byte_ptr+= l;
init_p(p,t);
}

/*:47*/
#line 754 "/home/mark/litprog/spider/src/master/common.web"
;
return(p);
}

/*:44*//*51:*/
#line 832 "/home/mark/litprog/spider/src/master/common.web"
name_pointer
#line 833 "/home/mark/litprog/spider/src/master/common.web"
 mod_lookup(k,l)
ASCII *k;
ASCII *l;
{
short c= 2;
name_pointer p= name_dir->dummy.Rlink;
name_pointer q= name_dir;
while(p){
c= web_strcmp(k,l+1,p->byte_start,(p+1)->byte_start);
q= p;
switch(c){
case 0:p= p->link;continue;
case 2:p= p->dummy.Rlink;continue;
case 1:return p;
default:err_print("! Incompatible section names");return NULL;

}
}
return(install_node(q,c,k,l-k+1));
}

/*:51*//*52:*/
#line 857 "/home/mark/litprog/spider/src/master/common.web"

web_strcmp(j,j1,k,k1)
ASCII *j;
ASCII *j1;
ASCII *k;
ASCII *k1;
{
while(k<k1&&j<j1&& *j== *k)k++,j++;
if(k==k1)if(j==j1)return 1;
else return 4;
else if(j==j1)return 3;
else if( *j< *k)return 0;
else return 2;
}

/*:52*//*53:*/
#line 880 "/home/mark/litprog/spider/src/master/common.web"
name_pointer
install_node(parent,c,j,name_len)
name_pointer parent;
int c;
ASCII *j;
int name_len;
{
name_pointer node= name_ptr;
if(byte_ptr+name_len>byte_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("byte memory");history= 3;wrap_up();};};
if(name_ptr==name_dir_end){{printf("\n! Sorry, capacity exceeded: ");err_print("name");history= 3;wrap_up();};};
if(c==0)parent->link= node;else parent->dummy.Rlink= node;
node->link= NULL;node->dummy.Rlink= NULL;
init_node(node);
strncpy(byte_ptr,j,name_len);
(++name_ptr)->byte_start= byte_ptr+= name_len;
return(node);
}

/*:53*//*54:*/
#line 904 "/home/mark/litprog/spider/src/master/common.web"
name_pointer
prefix_lookup(k,l)
ASCII *k;
ASCII *l;
{
short c= 2;
short count= 0;
name_pointer p= name_dir->dummy.Rlink;
name_pointer q= NULL;

name_pointer r= NULL;
while(p){
c= web_strcmp(k,l+1,p->byte_start,(p+1)->byte_start);
switch(c){
case 0:p= p->link;break;
case 2:p= p->dummy.Rlink;break;
default:r= p;count++;q= p->dummy.Rlink;p= p->link;
}
if(p==NULL){
p= q;q= NULL;
}
}
if(count==0)err_print("! Name does not match");

if(count>1)err_print("! Ambiguous prefix");

return(r);
}

/*:54*/