/*1:*/
#line 75 "mtangle.web"

/*6:*/
#line 32 "common.h"

#include<stdio.h>

/*:6*//*97:*/
#line 1118 "mtangle.web"

#include"ctype.h"

/*:97*/
#line 76 "mtangle.web"

/*5:*/
#line 26 "common.h"

typedef short boolean;
typedef char unsigned eight_bits;
extern boolean program;
extern int phase;

/*:5*//*7:*/
#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;

/*:7*//*8:*/
#line 54 "common.h"

extern ASCII buffer[];
extern ASCII *buffer_end;
extern ASCII *loc;
extern ASCII *limit;

/*:8*//*9:*/
#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();

/*:9*//*10:*/
#line 117 "common.h"

extern history;

/*:10*//*11:*/
#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;

/*:11*//*12:*/
#line 144 "common.h"

typedef unsigned short sixteen_bits;
extern sixteen_bits module_count;
extern boolean changed_module[];
extern boolean print_where;

/*:12*//*13:*/
#line 151 "common.h"

extern int argc;
extern char * *argv;
extern no_xref;

/*:13*//*14:*/
#line 164 "common.h"

FILE *C_file;
FILE *tex_file;
#line 124 "mtangle.web"

/*:14*/
#line 77 "mtangle.web"

/*16:*/
#line 151 "mtangle.web"

typedef struct{
eight_bits *tok_start;
sixteen_bits text_link;
}text;
typedef text *text_pointer;

/*:16*//*27:*/
#line 299 "mtangle.web"

typedef struct{
eight_bits *end_field;
eight_bits *byte_field;
name_pointer name_field;
text_pointer repl_field;
sixteen_bits mod_field;
}output_state;
typedef output_state *stack_pointer;

/*:27*/
#line 78 "mtangle.web"

/*17:*/
#line 158 "mtangle.web"

text text_info[2000];
text_pointer text_info_end= text_info+2000-1;
text_pointer text_ptr;
eight_bits tok_mem[150000];
eight_bits *tok_mem_end= tok_mem+150000-1;
eight_bits *tok_ptr;

/*:17*//*23:*/
#line 229 "mtangle.web"

text_pointer last_unnamed;

/*:23*//*28:*/
#line 315 "mtangle.web"

output_state cur_state;

output_state stack[50+1];
stack_pointer stack_ptr;
stack_pointer stack_end= stack+50;

/*:28*//*39:*/
#line 458 "mtangle.web"

int cur_val;


/*:39*//*49:*/
#line 590 "mtangle.web"

short balances[128];
/*:49*//*53:*/
#line 653 "mtangle.web"

name_pointer parm_ptr;

/*:53*//*65:*/
#line 776 "mtangle.web"

eight_bits out_state;
boolean protect;

/*:65*//*67:*/
#line 805 "mtangle.web"

name_pointer output_files[256];
name_pointer *cur_out_file, *end_output_files, *an_output_file;
char cur_module_char;
char output_file_name[400];

/*:67*//*81:*/
#line 122 "outtoks.web"
char C_file_extension[]= "m";
/*:81*//*83:*/
#line 127 "outtoks.web"
char the_at_sign= 64;

#line 262 "mtangle.ch"
/*:83*//*89:*/
#line 1013 "mtangle.web"

eight_bits ccode[128];

/*:89*//*91:*/
#line 1045 "mtangle.web"
short tracing;
/*:91*//*94:*/
#line 1079 "mtangle.web"

boolean comment_continues= 0;

/*:94*//*96:*/
#line 1115 "mtangle.web"

name_pointer cur_module;

/*:96*//*117:*/
#line 1387 "mtangle.web"

text_pointer cur_text;
eight_bits next_control;

/*:117*//*120:*/
#line 1455 "mtangle.web"

ASCII param_name_texts[256];
ASCII *param_name_texts_end= param_name_texts+256;
ASCII *param_names[32];
short next_param_name;
ASCII *next_param_name_text;

/*:120*//*141:*/
#line 1801 "mtangle.web"

extern sixteen_bits module_count;

/*:141*/
#line 79 "mtangle.web"


main(ac,av)
char * *av;
{
argc= ac;argv= av;
program= 0;
/*18:*/
#line 166 "mtangle.web"

text_info->tok_start= tok_ptr= tok_mem;
text_ptr= text_info+1;text_ptr->tok_start= tok_mem;


/*:18*//*20:*/
#line 176 "mtangle.web"

name_dir->equiv_or_xref= (ASCII *)text_info;

/*:20*//*24:*/
#line 232 "mtangle.web"
last_unnamed= text_info;text_info->text_link= 0;

/*:24*//*50:*/
#line 592 "mtangle.web"

{int i;
for(i= 0;i<128;i++)balances[i]= 0;
/*51:*/
#line 599 "mtangle.web"

balances[40]= 1;
balances[41]= -1;
balances[91]= 1;
balances[93]= -1;
balances[123]= 1;
balances[125]= -1;

#line 60 "mtangle.ch"
/*:51*/
#line 595 "mtangle.web"
;
}
/*:50*//*68:*/
#line 815 "mtangle.web"

cur_out_file= end_output_files= output_files+256;

/*:68*//*90:*/
#line 1016 "mtangle.web"
{
int c;
for(c= 0;c<=127;c++)ccode[c]= 0;
ccode[' ']= ccode[011]= ccode['*']= 255;
ccode['@']= '@';
ccode['=']= 2;
ccode['d']= ccode['D']= 252;
ccode['f']= ccode['F']= 251;
ccode['c']= ccode['C']= 253;
ccode['u']= ccode['U']= 253;
ccode['^']= ccode[':']= ccode['.']= ccode['t']= ccode['T']= 250;
ccode['&']= 127
#line 259 "mtangle.web"
;
ccode['<']= ccode['(']= 254;
ccode['`']= 249;
ccode['\'']= 5;
#line 286 "mtangle.ch"
ccode['"']= 6;
ccode['%']= 3;
#line 1032 "mtangle.web"



ccode['@']= ccode[64];
ccode[64]= 64;

#ifdef DEBUG
ccode['0']= ccode['1']= ccode['2']= ccode['3']= ccode['4']= 248;
#endif DEBUG

}

/*:90*//*92:*/
#line 1046 "mtangle.web"
tracing= 0;

/*:92*//*113:*/
#line 1316 "mtangle.web"
mod_text[0]= ' ';

/*:113*//*122:*/
#line 1467 "mtangle.web"
/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 1467 "mtangle.web"
;

/*:122*/
#line 86 "mtangle.web"
;
common_init();
printf("This is Matlab TANGLE (generated at 12:51 PM on January 27, 2000)\n");
phase_one();
phase_two();
wrap_up();
}

/*:1*//*21:*/
#line 182 "mtangle.web"

names_match(p,first,l)
name_pointer p;
ASCII *first;
int l;
{
if(((p+1)->byte_start-(p)->byte_start)!=l)return 0;
return!strncmp(first,p->byte_start,l);
}

/*:21*//*22:*/
#line 193 "mtangle.web"

init_node(node)
name_pointer node;
{
node->equiv_or_xref= (ASCII *)text_info;

}
init_p(p,t)
name_pointer p;
eight_bits t;
{
p->dummy.Ilk= t;
}



/*:22*//*26:*/
#line 264 "mtangle.web"
store_two_bytes(x)
sixteen_bits x;
{
if(tok_ptr+2>tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};};
 *tok_ptr++= x>>8;
 *tok_ptr++= x&255;
}


/*:26*//*30:*/
#line 339 "mtangle.web"
push_level(p)
name_pointer p;
{
/*31:*/
#line 351 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>0){
printf("\nPushing ");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start));
printf(" =nd[%d]",p-name_dir);
}
#endif TRACE_MACROS

/*:31*/
#line 342 "mtangle.web"
;
if(stack_ptr==stack_end){{printf("\n! Sorry, capacity exceeded: ");err_print("stack");history= 3;wrap_up();};};
 *stack_ptr= cur_state;
stack_ptr++;
cur_state.name_field= p;cur_state.repl_field= (text_pointer)p->equiv_or_xref;
cur_state.byte_field= cur_state.repl_field->tok_start;cur_state.end_field= (cur_state.repl_field+1)->tok_start;
cur_state.mod_field= 0;
}

/*:30*//*32:*/
#line 366 "mtangle.web"
pop_level()
{int number_of_parameters;
/*35:*/
#line 408 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>0){
printf("\nPopping ");fflush(stdout),write(1,(cur_state.name_field)->byte_start,(((cur_state.name_field)+1)->byte_start-((cur_state.name_field))->byte_start));
printf(" =nd[%d]",cur_state.name_field-name_dir);
}

#endif TRACE_MACROS



/*:35*/
#line 368 "mtangle.web"
;
if(cur_state.repl_field->text_link==0){
if(cur_state.name_field->dummy.Ilk==1){
/*33:*/
#line 383 "mtangle.web"

number_of_parameters=  *(cur_state.repl_field->tok_start);
/*34:*/
#line 402 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>1){
printf("\nUnstacking %d parameters",number_of_parameters);
}
#endif TRACE_MACROS
/*:34*/
#line 385 "mtangle.web"
;
while(number_of_parameters-->0){
name_ptr--;text_ptr--;
#ifdef TRACE_MACROS
byte_ptr-= 2;
#endif TRACE_MACROS
}
#ifdef STAT
#ifdef STAT_HAS_BEEN_FIXED
if(tok_ptr>max_tok_ptr)max_tok_ptr= tok_ptr;


#endif STAT_HAS_BEEN_FIXED
#endif STAT
tok_ptr= text_ptr->tok_start;


/*:33*/
#line 371 "mtangle.web"
;
}
}else if(cur_state.repl_field->text_link<2000){
cur_state.repl_field= cur_state.repl_field->text_link+text_info;
cur_state.byte_field= cur_state.repl_field->tok_start;cur_state.end_field= (cur_state.repl_field+1)->tok_start;
return;
}
stack_ptr--;
if(stack_ptr>stack)cur_state=  *stack_ptr;
}


/*:32*//*40:*/
#line 463 "mtangle.web"
sixteen_bits
get_output()
{
sixteen_bits a;
restart:if(stack_ptr==stack)return 0;
if(cur_state.byte_field==cur_state.end_field){
cur_val= -((int)cur_state.mod_field);
pop_level();
if(cur_val==0)goto restart;
out_char(129);return 0;
}
a=  *cur_state.byte_field++;
if(a<128)
if(a==7){
/*43:*/
#line 524 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf(" [#%d]", *cur_state.byte_field);
}
#endif TRACE_MACROS

/*:43*/
#line 477 "mtangle.web"
;
/*42:*/
#line 522 "mtangle.web"

push_level(name_ptr- *cur_state.byte_field++);goto restart;
/*:42*/
#line 479 "mtangle.web"
;
}else{
if((out_state==4)&&(a==9)){
/*41:*/
#line 505 "mtangle.web"

{
char *start, *end, *c;
int nr;
nr=  *cur_state.byte_field;
start= ((text_pointer)((name_ptr-nr)->equiv_or_xref))->tok_start;
end= ((text_pointer)((name_ptr-nr)->equiv_or_xref)+1)->tok_start;
if(( *(start+1))!='\''){
printf("\n! Parameter referred to with \"$%c\" "
"is not a string (line %d of %s)\n\n",
 *cur_state.byte_field,line[include_depth],output_file_name);
}else{
for(c= start+2;c<(end-2);c++)out_char( *c);
}
cur_state.byte_field++;
}

/*:41*/
#line 482 "mtangle.web"

}else out_char(a);
}
else{
a= (a-128) *256+ *cur_state.byte_field++;
switch(a/10240){
case 0:
/*44:*/
#line 531 "mtangle.web"

if(name_dir[a].dummy.Ilk==1){
/*45:*/
#line 545 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf("\nExpanding macro (");fflush(stdout),write(1,(name_dir+a)->byte_start,(((name_dir+a)+1)->byte_start-((name_dir+a))->byte_start));
printf("=nd[%d])",a);
}
#endif TRACE_MACROS

/*:45*/
#line 533 "mtangle.web"
;
/*47:*/
#line 31 "mtangle.ch"

{int number_of_parameters;
while(isspace( *cur_state.byte_field)&&stack_ptr!=stack)cur_state.byte_field++;
while(cur_state.byte_field==cur_state.end_field&&stack_ptr>stack)pop_level();
number_of_parameters=  *(((text_pointer)name_dir[a].equiv_or_xref)->tok_start);
if(number_of_parameters>0){
while(isspace( *cur_state.byte_field)&&stack_ptr!=stack)cur_state.byte_field++;
if(stack_ptr==stack|| *cur_state.byte_field!=40){
printf("\n! No parameters given for ");
fflush(stdout),write(1,(a+name_dir)->byte_start,(((a+name_dir)+1)->byte_start-((a+name_dir))->byte_start));
err_print("");
goto restart;
}
cur_state.byte_field++;
#line 574 "mtangle.web"
parm_ptr= name_ptr;
while(number_of_parameters-->0){
/*52:*/
#line 60 "mtangle.ch"

{int bal;
eight_bits b,oldb;
sixteen_bits c;
bal= 0;
/*62:*/
#line 717 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf("\nScanning #%d...",number_of_parameters+1);
}
#endif TRACE_MACROS
/*:62*/
#line 65 "mtangle.ch"
;
while(1){
b=  *cur_state.byte_field++;
if(isspace(b)&&b!=10)continue;
#line 615 "mtangle.web"
if(b==7){
b=  *cur_state.byte_field++;
/*59:*/
#line 683 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf(" <#%d=",b);fflush(stdout),write(1,(name_ptr-b)->byte_start,(((name_ptr-b)+1)->byte_start-((name_ptr-b))->byte_start));printf("=nd[%d]>",
name_ptr-b-name_dir);
}
#endif TRACE_MACROS

/*:59*/
#line 617 "mtangle.web"
;
c= name_ptr-name_dir-b;
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 128+(c/256);};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= c%256;};
}else{
if(b>=128){
/*60:*/
#line 691 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
int c;
printf(" <");
c= (b-128) *256+ *cur_state.byte_field;
switch(c/10240){
case 0:fflush(stdout),write(1,(name_dir+c)->byte_start,(((name_dir+c)+1)->byte_start-((name_dir+c))->byte_start));
printf(" =nd[%d]",c);
break;
case 1:printf("MODULE");break;
default:printf("CONTEXT");break;
}
printf(">");
}
#endif TRACE_MACROS

/*:60*/
#line 623 "mtangle.web"
;
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= b;};
b=  *cur_state.byte_field++;
}else if(bal==0&&((number_of_parameters==0&&b==41)
||(number_of_parameters>0&&b==44))){
goto done;
}else if(/*54:*/
#line 656 "mtangle.web"
(b==2||b==3)
/*:54*/
#line 629 "mtangle.web"
){
/*55:*/
#line 657 "mtangle.web"

{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= b;};
oldb= b;
/*56:*/
#line 671 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2)printf(" <");
#endif TRACE_MACROS
/*:56*/
#line 660 "mtangle.web"
;
while((b=  *cur_state.byte_field++)!=oldb){
/*57:*/
#line 675 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2)printf("%c",b);
#endif TRACE_MACROS
/*:57*/
#line 662 "mtangle.web"
;
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= b;};
if(cur_state.byte_field>=cur_state.end_field)
{printf("\n! This can't happen: ");err_print("string or constant didn't end in token list");history= 3;wrap_up();};
}
/*58:*/
#line 679 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2)printf(">");
#endif TRACE_MACROS
/*:58*/
#line 667 "mtangle.web"
;



/*:55*/
#line 630 "mtangle.web"
;
}else{
/*61:*/
#line 708 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf(" <");
if(31<b&&b<127)printf("%c",b);
printf(">");
}
#endif TRACE_MACROS

/*:61*/
#line 632 "mtangle.web"
;
bal+= balances[b];
}
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= b;};
}
}
done:
parm_ptr->equiv_or_xref= (ASCII *)text_ptr;
text_ptr->text_link= 0;
parm_ptr->dummy.Ilk= 2;
#ifdef TRACE_MACROS
if(byte_ptr+2>=byte_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("byte memory");history= 3;wrap_up();};};
 *byte_ptr++= 35; *byte_ptr++= number_of_parameters+1+48;
#endif TRACE_MACROS
if(parm_ptr>=name_dir_end){{printf("\n! Sorry, capacity exceeded: ");err_print("name");history= 3;wrap_up();};};
(++parm_ptr)->byte_start= byte_ptr;
if(text_ptr>=text_info_end){{printf("\n! Sorry, capacity exceeded: ");err_print("text");history= 3;wrap_up();};};
(++text_ptr)->tok_start= tok_ptr;
/*63:*/
#line 723 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>1){
printf("\nStacked ");fflush(stdout),write(1,(parm_ptr-1)->byte_start,(((parm_ptr-1)+1)->byte_start-((parm_ptr-1))->byte_start));
printf("=nd[%d]",parm_ptr-1-name_dir);
}
#endif TRACE_MACROS

/*:63*/
#line 650 "mtangle.web"
;
}

/*:52*/
#line 577 "mtangle.web"
;
}
name_ptr= parm_ptr;

}
}

/*:47*/
#line 535 "mtangle.web"
;
push_level(name_dir+a);
cur_state.byte_field++;
goto restart;
}else if(name_dir[a].dummy.Ilk==2){
/*46:*/
#line 553 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf("\nExpanding parameter (");fflush(stdout),write(1,(name_dir+a)->byte_start,(((name_dir+a)+1)->byte_start-((name_dir+a))->byte_start));
printf("=nd[%d])",a);
}
#endif TRACE_MACROS


#line 31 "mtangle.ch"
/*:46*/
#line 540 "mtangle.web"
;
push_level(name_dir+a);
goto restart;
}

/*:44*/
#line 489 "mtangle.web"
;
cur_val= a;out_char(130);break;
case 1:/*64:*/
#line 734 "mtangle.web"

a-= 10240;
if((a+name_dir)->equiv_or_xref!=(ASCII *)text_info)push_level(a+name_dir);
else if(a!=0){
printf("\n! Not present: <");fflush(stdout),write(1,(a+name_dir)->byte_start,(((a+name_dir)+1)->byte_start-((a+name_dir))->byte_start));err_print(">");

}
goto restart;

/*:64*/
#line 491 "mtangle.web"
;
default:cur_val= a-20480;if(cur_val>0)cur_state.mod_field= cur_val;
out_char(129);
}
}
return 1;
}

/*:40*//*66:*/
#line 89 "mtangle.ch"
flush_buffer()
#line 90 "mtangle.ch"
{
if(protect==0)putc('\n',C_file);
else fprintf(C_file,"%s","\',...\n\'");
if(line[include_depth]%100==0){
printf(".");
if(line[include_depth]%500==0)printf("%d",line[include_depth]);
fflush(stdout);
}
line[include_depth]++;
}

#line 795 "mtangle.web"
/*:66*//*70:*/
#line 834 "mtangle.web"

phase_two(){
line[include_depth]= 1;
if(text_info->text_link==0){
if(end_output_files==cur_out_file){
printf("\n! No program text was specified.");{if(history==0)history= 1;};

}
}else{
printf("\nWriting the output files: (%s)",C_file_name);fflush(stdout);
/*29:*/
#line 328 "mtangle.web"

stack_ptr= stack+1;cur_state.name_field= name_dir;cur_state.repl_field= text_info->text_link+text_info;
cur_state.byte_field= cur_state.repl_field->tok_start;cur_state.end_field= (cur_state.repl_field+1)->tok_start;cur_state.mod_field= 0;

/*:29*/
#line 844 "mtangle.web"
;
while(stack_ptr>stack)get_output();
flush_buffer();
}
if(end_output_files>cur_out_file){
if(text_info->text_link==0){
printf("\nWriting the output files: ");fflush(stdout);
}
/*71:*/
#line 860 "mtangle.web"

for(an_output_file= end_output_files;an_output_file>cur_out_file;){
an_output_file--;
strncpy(output_file_name,( *an_output_file)->byte_start,400);
output_file_name[(( *an_output_file+1)->byte_start-( *an_output_file)->byte_start)]= '\0';
fclose(C_file);
C_file= fopen(output_file_name,"w");
if(C_file==NULL){
{printf("! Cannot open output file:");err_print(output_file_name);history= 3;wrap_up();}
}else{
printf(" (%s)",output_file_name);fflush(stdout);
}
stack_ptr= stack+1;
cur_state.name_field= ( *an_output_file);
cur_state.repl_field= (text_pointer)cur_state.name_field->equiv_or_xref;
cur_state.byte_field= cur_state.repl_field->tok_start;
cur_state.end_field= (cur_state.repl_field+1)->tok_start;
cur_state.mod_field= 0;
while(stack_ptr>stack)get_output();
flush_buffer();
}



#line 134 "mtangle.ch"

/*:71*/
#line 852 "mtangle.web"

}
printf("\nDone.");
}

/*:70*//*72:*/
#line 137 "mtangle.ch"

eight_bits prev_char;
out_char(cur_char)
eight_bits cur_char;
{
ASCII *j;
int nq;
/*73:*/
#line 911 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
switch(cur_char){
case 10:printf(" [\\n]");break;
case 2:
printf("[STRING]");break;
case 127
#line 259 "mtangle.web"
:
printf("[JOIN]");break;
case 3:
printf("[CONSTANT]");break;
case 130:
printf(" [");fflush(stdout),write(1,(cur_val+name_dir)->byte_start,(((cur_val+name_dir)+1)->byte_start-((cur_val+name_dir))->byte_start));printf("]");
break;
case 129:
if(cur_val>0){
printf(" [%d:]",cur_val);
}else if(cur_val<0){
printf(" [:%d]",-cur_val);
}else{
printf("[LINE NUMBER]");
}
break;

default:
if(31<cur_char&&cur_char<127){
printf(" [%c]",cur_char);
}else{
printf(" [\\%3o]",cur_char);
}
}
}
#endif TRACE_MACROS




/*:73*/
#line 144 "mtangle.ch"
;
switch(cur_char){
case 10:

if(prev_char!=10&&
!(prev_char==129&&protect>0))
flush_buffer();
if(out_state!=4)out_state= 0;
break;
/*74:*/
#line 948 "mtangle.web"

case 130:
if(out_state==1)putc(' ',C_file);
for(j= (cur_val+name_dir)->byte_start;j<(name_dir+cur_val+1)->byte_start;
j++)putc( *j,C_file);
out_state= 1;break;

#line 214 "mtangle.ch"
/*:74*/
#line 153 "mtangle.ch"
;
/*75:*/
#line 215 "mtangle.ch"

case 129:
if(cur_val==0)cur_state.byte_field+= 4;
break;
#line 978 "mtangle.web"

#line 1 "outtoks.web"
/*:75*/
#line 154 "mtangle.ch"
;
/*78:*/
#line 44 "outtoks.web"

case 28:
fprintf(C_file,"%s","..");
if(out_state!=4)out_state= 0;
break;
case 29:
fprintf(C_file,"%s","./");
if(out_state!=4)out_state= 0;
break;
case 24:
fprintf(C_file,"%s","<=");
if(out_state!=4)out_state= 0;
break;
case 25:
fprintf(C_file,"%s","~=");
if(out_state!=4)out_state= 0;
break;
case 26:
fprintf(C_file,"%s","==");
if(out_state!=4)out_state= 0;
break;
case 23:
fprintf(C_file,"%s",">=");
if(out_state!=4)out_state= 0;
break;
#line 233 "mtangle.ch"
case 27:
if(tracing)printf("\noutput linecon: protect = %d on line %d",
protect,line[include_depth]);
if(protect){fprintf(C_file,"%s"," ");}
else{
if(out_state==4){
fprintf(C_file,"%s","...");
}else{
fprintf(C_file,"%s"," ...");
}
}
if(out_state!=4)out_state= 0;
break;
#line 77 "outtoks.web"
case 30:
fprintf(C_file,"%s",".^");
if(out_state!=4)out_state= 0;
break;
case 31:
fprintf(C_file,"%s",".*");
if(out_state!=4)out_state= 0;
break;
/*:78*//*79:*/
#line 85 "outtoks.web"

case'*':
if(out_state==4){
fprintf(C_file,"%s","*");
}else{
fprintf(C_file,"%s"," * ");
}
if(out_state!=4)out_state= 0;
break;
case'-':
if(out_state==4){
fprintf(C_file,"%s","-");
}else{
fprintf(C_file,"%s","-");
}
if(out_state!=4)out_state= 0;
break;
case'=':
if(out_state==4){
fprintf(C_file,"%s","=");
}else{
fprintf(C_file,"%s"," = ");
}
if(out_state!=4)out_state= 0;
break;
/*:79*/
#line 155 "mtangle.ch"

case 127
#line 259 "mtangle.web"
:out_state= 3;break;
case 3:if(out_state==4){
out_state= 1;break;
}
if(out_state==1)putc(' ',C_file);out_state= 4;break;
case'`':
if(protect==0)putc('[',C_file);
for(nq= 0;nq<1<<protect;nq++)putc('\'',C_file);
protect++;
break;
case'\'':
if(protect>0){
for(nq= 0;nq<1<<protect-1;nq++)putc('\'',C_file);
protect--;
if(protect==0)putc(']',C_file);
}else{
putc('\'',C_file);
}
break;
case'"':
for(nq= 0;nq<1<<protect;nq++)putc('\'',C_file);
break;
case 2:if(out_state==4)out_state= 0;
else out_state= 4;break;
default:putc(cur_char,C_file);if(out_state!=4)out_state= 0;
break;
}
prev_char= cur_char;
}

#line 910 "mtangle.web"

/*:72*//*93:*/
#line 1051 "mtangle.web"
eight_bits skip_ahead()
{
eight_bits c;
while(1){
if(loc>limit&&(get_line()==0))return(255);
 *(limit+1)= 64;
while( *loc!=64)loc++;
if(loc<=limit){
loc++;c= ccode[ *loc];
#ifdef DEBUG
if(c==248){
tracing=  *loc-48;c= 0;
}
#endif DEBUG
loc++;
if(c!=0|| *(loc-1)=='>')return(c);
}
}
}

/*:93*//*95:*/
#line 1082 "mtangle.web"

skip_comment()
{
ASCII c;
if(1){
get_line();
return(comment_continues= 0);
}else{
while(1){
if(loc>limit)
if(get_line())return(comment_continues= 1);
else{
err_print("! Input ended in mid-comment");

return(comment_continues= 0);
}
c=  *(loc++);
/*85:*/
#line 142 "outtoks.web"


/*:85*/
#line 1099 "mtangle.web"

if(c==64){
if(ccode[ *loc]==255){
err_print("! Section name ended in mid-comment");loc--;

return(comment_continues= 0);
}
else loc++;
}
}
}
}


/*:95*//*98:*/
#line 333 "mtangle.ch"

eight_bits do_get_next();
eight_bits previous_token;
name_pointer previous_scrap;

eight_bits get_next()
{
eight_bits c;
c= do_get_next();
if(!(c==' '||c=='\t'||c=='\n'||c=='\v'||c=='\r'||c=='\f'||c==27)){
previous_token= c;
if(c==130){
previous_scrap= id_lookup(id_first,id_loc,0);
}
}
return(c);
}


/*:98*//*99:*/
#line 353 "mtangle.ch"

int fquote_level= 0;
eight_bits do_get_next()
{
eight_bits c;
while(1){
if(loc>limit)/*100:*/
#line 401 "mtangle.ch"

{
if(get_line()==0)return(255);
else if(print_where){
print_where= 0;
/*134:*/
#line 1668 "mtangle.web"

store_two_bytes(53248);
if(changing)id_first= change_file_name;
else id_first= file_name[include_depth];
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)line[include_depth]);
{int a= id_lookup(id_first,id_loc,0)-name_dir;{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= (a/256)+128;};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a%256;};}

/*:134*/
#line 406 "mtangle.ch"
;
}
else{
return(10);
}
}

#line 1156 "mtangle.web"
/*:100*/
#line 359 "mtangle.ch"

c=  *loc;
if(comment_continues){
skip_comment();
if(comment_continues||1)return(10);
else continue;
}
/*84:*/
#line 263 "mtangle.ch"

{
int len;len= strlen("%");
if(loc+len<=limit&&!strncmp(loc,"%",len)){
loc+= len;
id_first= mod_text+1;
id_loc= mod_text;
 *++id_loc= '\%';
 *++id_loc=  *loc;
while( *loc++!='\n'&&loc<limit){
if(++id_loc<=mod_text_end) *id_loc=  *loc;
}
id_loc++;
return(2);
}
}
#line 140 "outtoks.web"
/*:84*/
#line 366 "mtangle.ch"

loc++;
if(isdigit(c)||c=='\\'||c=='.'){
/*102:*/
#line 1164 "mtangle.web"
{
id_first= loc-1;
if( *id_first=='.'&&!isdigit( *loc))goto mistake;
if( *id_first=='\\')while(isdigit( *loc))loc++;
else{
if( *id_first=='0'){
if( *loc=='x'|| *loc=='X'){
loc++;while(isxdigit( *loc))loc++;goto found;
}
}
while(isdigit( *loc))loc++;
if( *loc=='.'){
loc++;
while(isdigit( *loc))loc++;
}
#if defined C_FLOATING_POINT||defined MATLAB_FLOATING_POINT
if( *loc=='e'|| *loc=='E'){
if( *++loc=='+'|| *loc=='-')loc++;
while(isdigit( *loc))loc++;
}
#endif
}
#ifdef MATLAB_FLOATING_POINT
if( *loc=='i') *id_loc++=  *loc++;
#endif
found:
id_loc= loc;
return(3);
}

#line 470 "mtangle.ch"

/*:102*/
#line 369 "mtangle.ch"

}else if(isalpha(c)||c=='_'||c=='$'){
/*101:*/
#line 1156 "mtangle.web"
{
id_first= --loc;
while(isalpha( *++loc)||isdigit( *loc)|| *loc=='_');
if( *loc=='$')while(isdigit( *++loc)|| *loc=='$');

id_loc= loc;return(130);
}

/*:101*/
#line 371 "mtangle.ch"

}else if(c=='"'){
/*107:*/
#line 583 "mtangle.ch"

{
if((previous_token==130&&!strncmp((previous_scrap)->byte_start,"case",strlen("case"))))
previous_token= '(';

switch(previous_token){
case'(':
case'[':case'{':
case'+':case'-':
case'*':case 31:
case'^':case'\\':
case'/':case 29:
case':':case',':
case'=':case 26:
case'<':case 25:
case'>':case 23:
case 24:case'|':
case';':
/*103:*/
#line 478 "mtangle.ch"
{
ASCII delim= c;

id_first= mod_text+1;
id_loc= mod_text; *++id_loc= delim;
while(1){
if(loc>=limit)/*104:*/
#line 501 "mtangle.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;
}
else if(++id_loc<=mod_text_end) *id_loc= 10;

}



/*:104*/
#line 484 "mtangle.ch"

if((c=  *loc++)==delim)/*105:*/
#line 516 "mtangle.ch"

{
if(++id_loc<=mod_text_end) *id_loc= c;
if( *loc==delim){
if(++id_loc<=mod_text_end) *id_loc=  *loc++;
continue;
}
else break;
}

/*:105*/
#line 485 "mtangle.ch"

if(c=='\\')/*106:*/
#line 527 "mtangle.ch"

{
if(loc>=limit)continue;
#if 0
if(++id_loc<=mod_text_end) *id_loc= '\\';
c=  *loc++;
#endif
}

/*:106*/
#line 486 "mtangle.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(2);
}


/*:103*/
#line 601 "mtangle.ch"

case')':case']':
case 3:case'.':
case 2:case 130:
#ifdef WEAVE
case begin_comment:
return(SP_transp);
#else
return'\"';
#endif
default:
err_print("! Unknown left context for quote");
printf("\n character: %d = \'%c\'\n\n",previous_token,
previous_token);
return('\'');
}
}


#line 1245 "mtangle.web"
/*:107*/
#line 373 "mtangle.ch"


}else if(c=='\''){

if(fquote_level>0){
fquote_level--;
return('\'');
}else{
/*107:*/
#line 583 "mtangle.ch"

{
if((previous_token==130&&!strncmp((previous_scrap)->byte_start,"case",strlen("case"))))
previous_token= '(';

switch(previous_token){
case'(':
case'[':case'{':
case'+':case'-':
case'*':case 31:
case'^':case'\\':
case'/':case 29:
case':':case',':
case'=':case 26:
case'<':case 25:
case'>':case 23:
case 24:case'|':
case';':
/*103:*/
#line 478 "mtangle.ch"
{
ASCII delim= c;

id_first= mod_text+1;
id_loc= mod_text; *++id_loc= delim;
while(1){
if(loc>=limit)/*104:*/
#line 501 "mtangle.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;
}
else if(++id_loc<=mod_text_end) *id_loc= 10;

}



/*:104*/
#line 484 "mtangle.ch"

if((c=  *loc++)==delim)/*105:*/
#line 516 "mtangle.ch"

{
if(++id_loc<=mod_text_end) *id_loc= c;
if( *loc==delim){
if(++id_loc<=mod_text_end) *id_loc=  *loc++;
continue;
}
else break;
}

/*:105*/
#line 485 "mtangle.ch"

if(c=='\\')/*106:*/
#line 527 "mtangle.ch"

{
if(loc>=limit)continue;
#if 0
if(++id_loc<=mod_text_end) *id_loc= '\\';
c=  *loc++;
#endif
}

/*:106*/
#line 486 "mtangle.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(2);
}


/*:103*/
#line 601 "mtangle.ch"

case')':case']':
case 3:case'.':
case 2:case 130:
#ifdef WEAVE
case begin_comment:
return(SP_transp);
#else
return'\"';
#endif
default:
err_print("! Unknown left context for quote");
printf("\n character: %d = \'%c\'\n\n",previous_token,
previous_token);
return('\'');
}
}


#line 1245 "mtangle.web"
/*:107*/
#line 381 "mtangle.ch"

}
}else if(c=='`'){
fquote_level++;

return('`');
}else if(c=='\n'){
return(c);
}else if(c==64){
/*108:*/
#line 1248 "mtangle.web"
{
c= ccode[ *loc++];
switch(c){
case 0:continue;
case 250:while((c= skip_ahead())==64);

if( *(loc-1)!='>')err_print("! Improper @ within control text");

continue;
case 254:
cur_module_char=  *(loc-1);
/*112:*/
#line 1298 "mtangle.web"
{
ASCII *k;
/*114:*/
#line 1318 "mtangle.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;
/*115:*/
#line 1342 "mtangle.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++;
}

/*:115*/
#line 1327 "mtangle.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--;

/*:114*/
#line 1300 "mtangle.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);
if(cur_module_char=='('){
/*69:*/
#line 819 "mtangle.web"

{
if(cur_out_file>output_files){
for(an_output_file= cur_out_file;
an_output_file<end_output_files;an_output_file++)
if( *an_output_file==cur_module)break;
if(an_output_file==end_output_files)
 *--cur_out_file= cur_module;
}else{
{{printf("\n! Sorry, capacity exceeded: ");err_print("output files");history= 3;wrap_up();};};
}
}

/*:69*/
#line 1305 "mtangle.web"

}
return(254);
}

/*:112*/
#line 1259 "mtangle.web"
;
case 2:/*116:*/
#line 1360 "mtangle.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);
}

/*:116*/
#line 1260 "mtangle.web"
;
#ifdef DEBUG
case 248:tracing=  *(loc-1)-'0';continue;
#endif DEBUG
case 249:/*109:*/
#line 1271 "mtangle.web"

id_first= loc;
if( *loc=='\\')loc++;
while( *loc!='\''){
loc++;
if(loc>limit){
err_print("! String didn't end");loc= limit-1;break;
}
}
loc++;
return(249);

/*:109*/
#line 1264 "mtangle.web"
;
case 5:/*110:*/
#line 1283 "mtangle.web"
{
id_first= loc;
while('0'<= *loc&& *loc<'8')loc++;
id_loc= loc;
return(5);
}

/*:110*/
#line 1265 "mtangle.web"
;
#line 627 "mtangle.ch"
case 6:/*111:*/
#line 1290 "mtangle.web"
{
id_first= loc;
while(isxdigit( *loc))loc++;
id_loc= loc;
return(6);
}


/*:111*/
#line 627 "mtangle.ch"
;
case 3:loc--;
/*84:*/
#line 263 "mtangle.ch"

{
int len;len= strlen("%");
if(loc+len<=limit&&!strncmp(loc,"%",len)){
loc+= len;
id_first= mod_text+1;
id_loc= mod_text;
 *++id_loc= '\%';
 *++id_loc=  *loc;
while( *loc++!='\n'&&loc<limit){
if(++id_loc<=mod_text_end) *id_loc=  *loc;
}
id_loc++;
return(2);
}
}
#line 140 "outtoks.web"
/*:84*/
#line 629 "mtangle.ch"
;
default:return(c);
#line 1268 "mtangle.web"
}
}

/*:108*/
#line 390 "mtangle.ch"

}else if(c==' '||c==011){
if(c==011)printf("\n saw a tab mark!");
return(c);
}
mistake:/*77:*/
#line 3 "outtoks.web"

if(loc+2<=limit){
if(strncmp("...",loc-1,3)==0){
loc+= 2;
return 27;
}
}
if(loc+1<=limit){
if(strncmp("..",loc-1,2)==0){
loc+= 1;
return 28;
}
else if(strncmp("./",loc-1,2)==0){
loc+= 1;
return 29;
}
else if(strncmp("<=",loc-1,2)==0){
loc+= 1;
return 24;
}
else if(strncmp("~=",loc-1,2)==0){
loc+= 1;
return 25;
}
else if(strncmp("==",loc-1,2)==0){
loc+= 1;
return 26;
}
else if(strncmp(">=",loc-1,2)==0){
loc+= 1;
return 23;
}
else if(strncmp(".^",loc-1,2)==0){
loc+= 1;
return 30;
}
else if(strncmp(".*",loc-1,2)==0){
loc+= 1;
return 31;
}
}
/*:77*/
#line 395 "mtangle.ch"

return(c);
}
}

/*:99*//*118:*/
#line 1391 "mtangle.web"
scan_repl(t)
eight_bits t;
{
sixteen_bits a;
int set_print_where;
if(t==254){/*134:*/
#line 1668 "mtangle.web"

store_two_bytes(53248);
if(changing)id_first= change_file_name;
else id_first= file_name[include_depth];
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)line[include_depth]);
{int a= id_lookup(id_first,id_loc,0)-name_dir;{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= (a/256)+128;};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a%256;};}

/*:134*/
#line 1396 "mtangle.web"
;}


while(1){
if(t==1){
print_where= 0;
}
a= get_next();
if(tracing>2){
eight_bits cur_char;
cur_char= a;
/*73:*/
#line 911 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
switch(cur_char){
case 10:printf(" [\\n]");break;
case 2:
printf("[STRING]");break;
case 127
#line 259 "mtangle.web"
:
printf("[JOIN]");break;
case 3:
printf("[CONSTANT]");break;
case 130:
printf(" [");fflush(stdout),write(1,(cur_val+name_dir)->byte_start,(((cur_val+name_dir)+1)->byte_start-((cur_val+name_dir))->byte_start));printf("]");
break;
case 129:
if(cur_val>0){
printf(" [%d:]",cur_val);
}else if(cur_val<0){
printf(" [:%d]",-cur_val);
}else{
printf("[LINE NUMBER]");
}
break;

default:
if(31<cur_char&&cur_char<127){
printf(" [%c]",cur_char);
}else{
printf(" [\\%3o]",cur_char);
}
}
}
#endif TRACE_MACROS




/*:73*/
#line 1407 "mtangle.web"

}
if(t==1){
set_print_where= print_where;
}
switch(a){
/*133:*/
#line 1611 "mtangle.web"

case 130:
{short n;
if((n= parameter_number(id_first,id_loc))!=0){
#ifdef TRACE_MACROS
if(tracing>1){
printf("\nIdentified ");fflush(stdout),write(1,id_first,id_loc-id_first);
printf(" as parameter number %d (%d from back)",n,next_param_name-n+1);
}
#endif TRACE_MACROS
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 7;};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= next_param_name-n+1;};
}else{
a= id_lookup(id_first,id_loc,0)-name_dir;
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= (a/256)+128;};{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a%256;};
}
}
break;
case 254:if(t!=254)goto done;
else{
/*135:*/
#line 1678 "mtangle.web"
{
ASCII *try_loc= loc;
while( *try_loc==' '&&try_loc<limit)try_loc++;
if( *try_loc=='+'&&try_loc<limit)try_loc++;
while( *try_loc==' '&&try_loc<limit)try_loc++;
if( *try_loc=='=')err_print("! Nested named modules.  Missing @?");

}

/*:135*/
#line 1631 "mtangle.web"
;
a= cur_module-name_dir;
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= (a/256)+168;};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a%256;};
/*134:*/
#line 1668 "mtangle.web"

store_two_bytes(53248);
if(changing)id_first= change_file_name;
else id_first= file_name[include_depth];
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)line[include_depth]);
{int a= id_lookup(id_first,id_loc,0)-name_dir;{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= (a/256)+128;};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a%256;};}

/*:134*/
#line 1635 "mtangle.web"
;break;
}
case 3:case 2:
/*136:*/
#line 1693 "mtangle.web"

{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a;};
while(id_first<id_loc){
if( *id_first==64)id_first++;
if(( *id_first=='$')&&( *(id_first+1)=='{')&&(t==1)){
char *end, *c,pname[100],tmp[200];
int pnum;
id_first+= 2;
end= id_first;
while( *end++!='}');
end--;
strncpy(pname,id_first,end-id_first);
pname[end-id_first]= 0;
if((pnum= parameter_number(id_first,end))!=0){
printf("parameter %s is number %d\n",pname,pnum);
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 9;};
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= next_param_name-pnum+1;};
}else{
sprintf(tmp,"! Can't find string parameter %s\n\n",pname);
err_print(tmp);
}
id_first= end+1;
}else{
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++=  *id_first++;};
}
}
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a;};break;

/*:136*/
#line 1638 "mtangle.web"
;
case 249:
/*137:*/
#line 1721 "mtangle.web"
{
int c;
if( *id_first==64){
c= xchr[ *id_first++];
if( *id_first!=64)err_print("! Double @ within string");
}
else if( *id_first=='\\'){
id_first++;
switch( *id_first){
case't':c= 9;break;
case'n':c= 10;break;
case'b':c= 8;break;
case'0':c= 0;break;
case'\\':c= 92;break;
default:err_print("! Unrecognized escape sequence");
}
}
else c= xchr[ *id_first];
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 3;};


app_decimal((long)c);
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 3;};
}
break;

/*:137*/
#line 1640 "mtangle.web"
;
case 5:
/*138:*/
#line 1748 "mtangle.web"
{
long sum= 0;
while(id_first<id_loc){
sum= 8 *sum+ *id_first++-'0';
if(sum>67108864)err_print("! Octal constant exceeds @\"04000000");
}
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 3;};
app_decimal(sum);
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 3;};
}

/*:138*/
#line 1642 "mtangle.web"
;break;
case 6:
/*139:*/
#line 1759 "mtangle.web"
{
long sum= 0;
while(id_first<id_loc){
sum= 16 *sum+
(isdigit( *id_first)
? *id_first-'0'
:isupper( *id_first)
? *id_first-'A'+10
: *id_first-'a'+10
);
id_first++;
if(sum>67108864)err_print("! Hex constant exceeds @\"04000000");
}
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 3;};
app_decimal(sum);
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= 3;};
}

/*:139*/
#line 1644 "mtangle.web"
;break;
case 10:
#ifdef NEWLINES_IN_MACROS
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a;};
#else
if(t==1)continue;
else{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a;};
#endif NEWLINES_IN_MACROS
break;
case 252:case 251:case 253:
if(t!=254)goto done;
else{
err_print("! @d, @f and @u are ignored in C text");continue;

}
case 255:goto done;

/*:133*/
#line 1416 "mtangle.web"

default:{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= a;};
}
}
done:next_control= (eight_bits)a;
if(text_ptr>text_info_end){{printf("\n! Sorry, capacity exceeded: ");err_print("text");history= 3;wrap_up();};};
if(t==1){
/*119:*/
#line 642 "mtangle.ch"

#line 643 "mtangle.ch"
tok_ptr-= 2;
while( *tok_ptr<128&&isspace( *(tok_ptr+1)))tok_ptr--;
tok_ptr+= 2;
#line 1444 "mtangle.web"

/*:119*/
#line 1423 "mtangle.web"
;
}
cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr;
print_where= set_print_where;
}

/*:118*//*125:*/
#line 1490 "mtangle.web"

int parameter_number(first,loc)
ASCII *first, *loc;
{
ASCII *f, *p;
int n;
for(n= 0;n<next_param_name;n++){
if(loc-first==param_names[n+1]-param_names[n]){

for(f= first,p= param_names[n];f<loc;)
if( *f++!= *p++)goto nomatch;
return n+1;
}
nomatch:continue;
}
return 0;
}


/*:125*//*140:*/
#line 1778 "mtangle.web"

app_decimal(c)
long c;
{long power;
if(c==0){{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= '0';};return;}
if(c<0){{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= '-';};c= -c;}
for(power= 1;c>=power;power *= 10);

for(power/= 10;power>=1;power/= 10){
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= '0'+c/power;};
c%= power;

}
}



/*:140*//*142:*/
#line 1805 "mtangle.web"
scan_module()
{
name_pointer p;
text_pointer q;
sixteen_bits a;
module_count++;
if( *(loc-1)=='*')
printf("*%d",module_count);fflush(stdout);
/*143:*/
#line 1822 "mtangle.web"

next_control= 0;
while(1){
done_scanning:
while(next_control<=251)
if((next_control= skip_ahead())==254){

loc-= 2;next_control= get_next();
}
if(next_control!=252)break;
/*126:*/
#line 670 "mtangle.ch"

#line 671 "mtangle.ch"
while(isspace(next_control= get_next()));
/*130:*/
#line 1566 "mtangle.web"

if(next_control!=130){
err_print("! Macro name must be an dientifier");

/*144:*/
#line 1840 "mtangle.web"

/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 1841 "mtangle.web"
;
p->dummy.Ilk= 0;
goto done_scanning;


/*:144*/
#line 1570 "mtangle.web"
;
}else{
p= id_lookup(id_first,id_loc,1);
if(p->dummy.Ilk!=1){
#ifdef WARN_USE_BEFORE_DEF
printf("\n! Warning: macro name ");
fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start));
printf(" was used before it was defined");
{if(history==0)history= 1;};
#endif WARN_USE_BEFORE_DEF
p->dummy.Ilk= 1;
}else if(p+1!=name_ptr){
err_print("! Macro name is multiply defined: ");
}
}

#line 748 "mtangle.ch"
/*:130*/
#line 673 "mtangle.ch"
;
/*129:*/
#line 711 "mtangle.ch"

while(isspace(next_control= get_next()));
if(next_control==40){
do{
/*131:*/
#line 748 "mtangle.ch"

while(isspace(next_control= get_next()));
if(next_control!=130){
err_print("! Macro parameter name not an identifier");

/*144:*/
#line 1840 "mtangle.web"

/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 1841 "mtangle.web"
;
p->dummy.Ilk= 0;
goto done_scanning;


/*:144*/
#line 753 "mtangle.ch"
;
}else{
if(parameter_number(id_first,id_loc)!=0){
err_print("! Duplicate parameters in macro definition");

/*144:*/
#line 1840 "mtangle.web"

/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 1841 "mtangle.web"
;
p->dummy.Ilk= 0;
goto done_scanning;


/*:144*/
#line 758 "mtangle.ch"
;
}else{
/*123:*/
#line 1469 "mtangle.web"

/*124:*/
#line 1475 "mtangle.web"

if(next_param_name==32)
{{printf("\n! Sorry, capacity exceeded: ");err_print("parameter names");history= 3;wrap_up();};};
if(id_loc-id_first>
param_name_texts_end-next_param_name_text)
{{printf("\n! Sorry, capacity exceeded: ");err_print("parameter name texts");history= 3;wrap_up();};};


/*:124*/
#line 1470 "mtangle.web"
;
while(id_first<id_loc)
 *next_param_name_text++=  *id_first++;
param_names[++next_param_name]= next_param_name_text;

/*:123*/
#line 760 "mtangle.ch"
;
}
}
while(isspace(next_control))next_control= get_next();
#line 1601 "mtangle.web"


/*:131*/
#line 715 "mtangle.ch"
;
while(isspace(next_control= get_next()));
}while(next_control==44);
while(isspace(next_control))next_control= get_next();
if(next_control!=41){
err_print("! Macro parameter list must end with )");
/*144:*/
#line 1840 "mtangle.web"

/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 1841 "mtangle.web"
;
p->dummy.Ilk= 0;
goto done_scanning;


/*:144*/
#line 721 "mtangle.ch"
;
}
while(isspace(next_control= get_next()));

}
#line 1564 "mtangle.web"


/*:129*/
#line 676 "mtangle.ch"
;
if(next_control!=61){
printf("\nnext_control = <%c>",next_control);
err_print("! You must put an = sign before the macro replacement text");
/*144:*/
#line 1840 "mtangle.web"

/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 1841 "mtangle.web"
;
p->dummy.Ilk= 0;
goto done_scanning;


/*:144*/
#line 680 "mtangle.ch"
;
}
/*127:*/
#line 1533 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>1){
printf("\nScanning definition of macro ");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start));
}
#endif TRACE_MACROS

/*:127*/
#line 682 "mtangle.ch"
;
{if(tok_ptr==tok_mem_end){{printf("\n! Sorry, capacity exceeded: ");err_print("token");history= 3;wrap_up();};}; *tok_ptr++= next_param_name;};
scan_repl(1);
p->equiv_or_xref= (ASCII *)cur_text;
/*128:*/
#line 1540 "mtangle.web"

#ifdef TRACE_MACROS
if(tracing>2){
printf("\nMacro ");fflush(stdout),write(1,(p)->byte_start,(((p)+1)->byte_start-((p))->byte_start));
printf("'s replacement text is in text_info[%d]",cur_text-text_info);
}
#endif TRACE_MACROS


#line 711 "mtangle.ch"
/*:128*/
#line 686 "mtangle.ch"
;
/*121:*/
#line 1462 "mtangle.web"

next_param_name= 0;
next_param_name_text= param_name_texts;
param_names[next_param_name]= next_param_name_text;

/*:121*/
#line 687 "mtangle.ch"
;

#line 1532 "mtangle.web"

/*:126*/
#line 1832 "mtangle.web"
;
cur_text->text_link= 0;
}

/*:143*/
#line 1813 "mtangle.web"
;
/*145:*/
#line 1846 "mtangle.web"

switch(next_control){
case 253:p= name_dir;break;
case 254:p= cur_module;
/*146:*/
#line 1858 "mtangle.web"

while((next_control= get_next())=='+');
if(next_control!='='){
err_print("! C text flushed, = sign is missing");

while((next_control= skip_ahead())!=255);
return;
}

/*:146*/
#line 1850 "mtangle.web"
;
break;
default:return;
}
/*147:*/
#line 1867 "mtangle.web"

store_two_bytes((sixteen_bits)(53248+module_count));

/*:147*/
#line 1854 "mtangle.web"
;
scan_repl(254);
/*148:*/
#line 1870 "mtangle.web"

if(p==name_dir||p==0){
(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
}
else if(p->equiv_or_xref==(ASCII *)text_info)p->equiv_or_xref= (ASCII *)cur_text;

else{
q= (text_pointer)p->equiv_or_xref;
while(q->text_link<2000)q= q->text_link+text_info;
q->text_link= cur_text-text_info;
}
cur_text->text_link= 2000;

/*:148*/
#line 1856 "mtangle.web"
;

/*:145*/
#line 1814 "mtangle.web"
;
}

/*:142*//*149:*/
#line 1883 "mtangle.web"
phase_one(){
phase= 1;
module_count= 0;
reset_input();
while((next_control= skip_ahead())!=255);
while(!input_has_ended)scan_module();
check_complete();
phase= 2;
}

/*:149*//*150:*/
#line 1893 "mtangle.web"
print_stats(){
printf("\nMemory usage statistics:\n");
printf("%d names (out of %d)\n",name_ptr-name_dir,4000);
printf("%d replacement texts (out of %d)\n",text_ptr-text_info,2000);
printf("%d bytes (out of %d)\n",byte_ptr-byte_mem,90000);
printf("%d tokens (out of %d)\n",tok_ptr-tok_mem,150000);
}

/*:150*/