本文整理汇总了C++中CTokenizer::SetErrorProc方法的典型用法代码示例。如果您正苦于以下问题:C++ CTokenizer::SetErrorProc方法的具体用法?C++ CTokenizer::SetErrorProc怎么用?C++ CTokenizer::SetErrorProc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTokenizer
的用法示例。
在下文中一共展示了CTokenizer::SetErrorProc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
#ifdef _WIN32
struct _finddata_t fileinfo;
bool error_pause = false;
#endif
char *filename, error_msg[MAX_STRING_LENGTH], newfilename[MAX_FILENAME_LENGTH];
int handle;
//Init the tokenizer and pass the symbols we require
Tokenizer.Create( 0 );
Tokenizer.SetSymbols( (keywordArray_t *) Interpreter.GetSymbols() );
Tokenizer.SetErrorProc( (void (__cdecl *)(const char *)) NULL_Error );
//Init the block streaming class
BlockStream.Init();
//No script arguments, print the banner
if (argc < 2)
{
printf("\n\nIBIze v%1.2f -- jweier\n", IBIZE_VERSION );
printf("ICARUS v%1.2f\n", ICARUS_VERSION );
printf("Copyright (c) 1999, Raven Software\n");
printf("------------------------------\n");
printf("\nIBIze [script1.txt] [script2.txt] [script3.txt] ...\n\n");
return 0;
}
int iErrorBlock = 0;
//Interpret all files passed on the command line
for (int i=1; i<argc; i++)
{
filename = (char *) argv[i];
//FIXME: There could be better ways to do this...
if ( filename[0] == '-' )
{
#ifdef _WIN32
if ( tolower(filename[1]) == 'e' )
error_pause = true;
//Can just use a wildcard in the commandline on non-windows
if ( tolower(filename[1]) == 'a' )
{
handle = _findfirst ( "*.txt", &fileinfo);
while ( handle != -1 )
{
if (Tokenizer.AddParseFile( (char*) &fileinfo.name ))
{
//Interpret the file
if ( (iErrorBlock=InterpretFile( (char *) &fileinfo.name )) !=0 )
{
// failed
//
BlockStream.Free();
if (error_pause)
getch();
}
}
if ( _findnext( handle, &fileinfo ) == -1 )
break;
}
_findclose (handle);
}
#endif
continue;
}
//Tokenize the file
if (Tokenizer.AddParseFile( filename ))
{
//Interpret the file
if ( (iErrorBlock=InterpretFile( filename )) !=0 )
{
// failed
//
BlockStream.Free();
#ifdef _WIN32
if (error_pause)
getch();
#endif
return iErrorBlock;
}
}
else
{
//Try adding on the SCR extension if it was left off
strcpy((char *) &newfilename, filename);
strcat((char *) &newfilename, SCRIPT_EXTENSION);
if (Tokenizer.AddParseFile( (char*) &newfilename ))
{
//.........这里部分代码省略.........