610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
|
InputStack*nxt=inpstack;
inpstack=malloc(sizeof(InputStack));
if(!inpstack) fatal("Allocation failed\n");
inpstack->classfp=classfp;
inpstack->linenum=linenum;
inpstack->next=nxt;
linenum=1;
//TODO: Use the correct directory to load the include file
classfp=fopen(name,"r");
if(!classfp) ParseError("Cannot open include file \"%s\": %m\n",name);
}
static void begin_macro(TokenList*mac) {
MacroStack*ms=malloc(sizeof(MacroStack));
TokenList**ap=0;
int a=0;
|
>
|
>
>
>
>
|
>
|
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
|
InputStack*nxt=inpstack;
inpstack=malloc(sizeof(InputStack));
if(!inpstack) fatal("Allocation failed\n");
inpstack->classfp=classfp;
inpstack->linenum=linenum;
inpstack->next=nxt;
linenum=1;
if(*name=='.' || *name=='_' || *name=='-' || !*name || name[strspn(name,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-")])
ParseError("Improper name of include file \"%s\"\n",name);
if(main_options['z']) {
if(strlen(name)<9 || memcmp(name-strlen(name),".include",8)) ParseError("Include file name doesn't end with .include\n");
classfp=composite_slice(name,0)?:fopen(name,"r");
} else {
classfp=fopen(name,"r");
}
if(!classfp) ParseError("Cannot open include file \"%s\": %m\n",name);
}
static void begin_macro(TokenList*mac) {
MacroStack*ms=malloc(sizeof(MacroStack));
TokenList**ap=0;
int a=0;
|