635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
|
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
|
+
+
|
// This token will be skipped during macro expansion.
tokent=TF_MACRO+TF_ABNORMAL;
*tokenstr=0;
macros[glohash[name].id-0xC000]=add_macro();
}
}
#ifndef CONFIG_OMIT_INCLUDE
static void begin_include_file(const char*name) {
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(main_options['S']) fatal("Cannot use {include} with level hash calculation mode\n");
if(*name=='.' || *name=='_' || *name=='-' || !*name || name[strspn(name,"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-abcdefghijklmnopqrstuvwxyz.")])
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);
}
#endif
static void begin_macro(TokenList*mac) {
MacroStack*ms=malloc(sizeof(MacroStack));
TokenList**ap=0;
int a=0;
int b=0;
int c=0;
|
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
|
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
|
+
+
+
+
|
if(!macros) fatal("Allocation failed\n");
}
nxttok();
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
define_macro(look_hash_mac(),1);
goto again;
case MAC_INCLUDE:
#ifdef CONFIG_OMIT_INCLUDE
ParseError("The {include} macro has been omitted from this version\n");
#else
if(macstack) ParseError("Cannot use {include} inside of a macro\n");
nxttok1();
if(tokent==TF_MACRO && tokenv==1) ReturnToken(TF_EOF,0);
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
n=look_hash_mac();
nxttok1();
if(tokent!=TF_MACRO+TF_CLOSE) ParseError("Too many macro arguments\n");
begin_include_file(glohash[n].txt);
goto again;
#endif
case MAC_CALL:
nxttok();
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
tokenv=look_hash_mac();
goto call;
case MAC_APPEND:
if(!macros) {
|