fix the crash bug for expression y^x when y is not defined

This commit is contained in:
paul-wu
2016-03-08 02:15:35 -10:00
parent 18c102c76d
commit 46db164377

View File

@ -516,6 +516,11 @@ void showcons(char * name)
printf("Type: constant\n"); printf("Type: constant\n");
printf("Value: %lld\n",global_p); printf("Value: %lld\n",global_p);
} }
if(strcamp(name, "global_curve")){
printf("Name: %s\n",name);
printf("Type: constant\n");
printcurve(global_curve);
}
} }
void statement(int header) void statement(int header)
@ -566,7 +571,7 @@ void statement(int header)
if(tokenlist[header]->type == 1 && strcamp(tokenlist[header]->vaule,"check")){ if(tokenlist[header]->type == 1 && strcamp(tokenlist[header]->vaule,"check")){
while(++header < tokenlen){ while(++header < tokenlen){
if(tokenlist[header]->type == 1){ if(tokenlist[header]->type == 1){
if(strcamp(tokenlist[header]->vaule,"global_p")){ if(strcamp(tokenlist[header]->vaule,"global_p") || strcamp(tokenlist[header]->vaule,"global_curve")){
showcons(tokenlist[header]->vaule); showcons(tokenlist[header]->vaule);
return; return;
} }
@ -914,6 +919,8 @@ VALU * term(int * start)
result = atom(start); result = atom(start);
if(result == NULL)return result;
if(*start < tokenlen && checkchar(tokenlist[*start],'^')){ if(*start < tokenlen && checkchar(tokenlist[*start],'^')){
*start += 1; *start += 1;
VALU * temp = atom(start); VALU * temp = atom(start);