This commit is contained in:
Paul 2001-01-05 19:25:07 +00:00
parent 85076e653d
commit e1411394cb
12 changed files with 154 additions and 48 deletions

View file

@ -61,10 +61,15 @@ struct FunctionDef
---- */
static FunctionDef s_functionNames[]=
{
{ "setCharacterAnimation", 2 }, // character,animation
{ "setText", 1 }, // textId
{ "drawSprite", 4 }, // frame,x,y,ot
{ "getFrameTime", 0 }, //
{ "setCharacterAnimation", 2 }, // characterId,animationId
{ "setText", 1 }, // textId
{ "giveItem", 1 }, // itemId
{ "gotItem", 1 }, // itemId
{ "setResponseOptions", 1 }, // optionsId
{ "getResponse", 0 }, //
{ "drawSprite", 4 }, // frame,x,y,ot
{ "getFrameTime", 0 }, //
};
static int s_functionCount=sizeof(s_functionNames)/sizeof(FunctionDef);

View file

@ -99,6 +99,7 @@ extern int main(int argc, char *argv[])
}
}
printf("\n");
return ret;
}

View file

@ -172,39 +172,64 @@ void mylexer::unexpectedChar()
{
int result;
char name[256]="\0";
char *endOfMacro=name;
char *replacement;
int nextChar;
char c[2]="*"; // Err...
int extraChars=0;
// Search for a macro
strcat(name,yytext);
do
yyunput(*(name+strlen(name)-1));
name[strlen(name)-1]='\0';
while(1)
{
replacement=lookupMacro(name,&result);
if(replacement)
do
{
break;
}
nextChar=yygetchar();
if(nextChar!=-1)
{
if(strlen(name)>=255)
nextChar=yyinput();
if(nextChar!=-1)
{
printf("OVERFLOW WHILE LOOKING UP MACRO\n");
if(strlen(name)>=255)
{
printf("OVERFLOW WHILE LOOKING UP MACRO\n");
error();
return;
}
c[0]=(char)nextChar;
strcat(name,c);
}
else
{
printf("END OF FILE WHILE LOOKING FOR MACRO\n");
error();
return;
}
c[0]=(char)nextChar;
strcat(name,c);
lookupMacro(name,&result);
}
while(result==POSSIBLE_KNOWN_MACRO);
if(result==UNKNOWN_MACRO)
{
if(endOfMacro!=name)
{
char *cp;
cp=name+strlen(name)-1;
while(cp!=endOfMacro-1)
{
yyunput(*cp--);
name[strlen(name)-1]='\0';
}
}
break;
}
else
{
printf("END OF FILE WHILE LOOKING FOR MACRO\n");
error();
return;
endOfMacro=name+strlen(name);
}
}
while(result==POSSIBLE_KNOWN_MACRO);
replacement=lookupMacro(name,&result);
if(result==KNOWN_MACRO)
{
// Err.. shove the string into the input buffer ( is this good? )
@ -214,11 +239,7 @@ void mylexer::unexpectedChar()
{
yyunput(*--ptr);
}
}
else
{
printf("UNEXPECTED STRING: '%s'\n",name);
error();
printf("found macro '%s'='%s'\n",name,replacement);
}
}