1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
|
nxttok();
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
define_macro(look_hash_mac(),0);
goto again;
case MAC_EDIT:
if(!macros) ParseError("Cannot edit nonexistent macro\n");
nxttok();
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
n=glohash[look_hash_mac()].id;
if(n<0xC000 || n>MAX_MACRO+0xC000-1 || !macros[n-0xC000]) ParseError("Undefined macro: {%s}\n",tokenstr);
nxttok();
n-=0xC000;
if(macros[n]->t&(TF_MACRO|TF_EOF)) ParseError("Invalid edit token\n");
free(macros[n]->str);
macros[n]->t=tokent;
macros[n]->v=tokenv;
macros[n]->str=0;
if(*tokenstr) {
macros[n]->str=strdup(tokenstr);
if(!macros[n]->str) fatal("Allocation failed\n");
}
if(main_options['M']) {
int i;
printf("M= @%4d %04X %08X \"",linenum,tokent,tokenv);
for(i=0;tokenstr[i];i++) {
if(tokenstr[i]<32 || tokenstr[i]>126) printf("<%02X>",tokenstr[i]&255);
else putchar(tokenstr[i]);
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
|
nxttok();
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
define_macro(look_hash_mac(),0);
goto again;
case MAC_EDIT:
if(!macros) ParseError("Cannot edit nonexistent macro\n");
nxttok();
if(tokent==TF_INT) {
if(!macstack) ParseError("Empty macro stack\n");
n=tokenv-1;
nxttok();
if(n<0 || macstack->n<=n || !macstack->args[n]) ParseError("Cannot edit nonexistent argument %u\n",n+1);
macstack->args[n]->t=tokent;
macstack->args[n]->v=tokenv;
macstack->args[n]->str=0;
if(*tokenstr) {
macstack->args[n]->str=strdup(tokenstr);
if(!macstack->args[n]->str) fatal("Allocation failed\n");
}
} else {
if(!(tokent&TF_NAME) || tokenv!=OP_STRING) ParseError("String literal expected\n");
n=glohash[look_hash_mac()].id;
if(n<0xC000 || n>MAX_MACRO+0xC000-1 || !macros[n-0xC000]) ParseError("Undefined macro: {%s}\n",tokenstr);
nxttok();
n-=0xC000;
if(macros[n]->t&(TF_MACRO|TF_EOF)) ParseError("Invalid edit token\n");
free(macros[n]->str);
macros[n]->t=tokent;
macros[n]->v=tokenv;
macros[n]->str=0;
if(*tokenstr) {
macros[n]->str=strdup(tokenstr);
if(!macros[n]->str) fatal("Allocation failed\n");
}
}
if(main_options['M']) {
int i;
printf("M= @%4d %04X %08X \"",linenum,tokent,tokenv);
for(i=0;tokenstr[i];i++) {
if(tokenstr[i]<32 || tokenstr[i]>126) printf("<%02X>",tokenstr[i]&255);
else putchar(tokenstr[i]);
|