scc.cpp
来自「C人工智能游戏开发的一些实例源代码 C Game development in 」· C++ 代码 · 共 34 行
CPP
34 行
#include <stdio.h>
#include "SCC.H"
// Flex reads the 'yyin' file handle for input. 'yyin' will be defined in
// the generated scc-lexer.cpp file, so we'll need to extern the variable.
extern FILE *yyin;
int main( int argc, char **argv )
{
// The usage for this program is pretty simple. If no arguments are given
// to the program, then it will expect input on stdin (this is the default
// value of 'yyin'). If there was an argument specified, then this will
// specify the source file name to read from.
if ( argc == 2 ) {
// Open the given file name for reading.
yyin = fopen( argv[1], "r" );
// If the file could not be opened, then inform the user and terminate the
// program.
if ( yyin == NULL ) {
perror( argv[1] );
return 1;
}
}
// Call into Bison to tell it to parse the input file.
yyparse();
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?