{ // Read one line from the input file, and append to the buffer\r
char c, *start = inPtr;\r
if(fromString) return 0; // parsing string, so the end is a hard end\r
+ if(!inputFile) return 0;\r
while((c = fgetc(inputFile)) != EOF) {\r
*inPtr++ = c;\r
if(c == '\n') { *inPtr = NULLCHAR; return 1; }\r
return ImpossibleMove; // for now treat as invalid\r
}\r
// fxg stuff, but also things like 0-0, 0-1 and 1-0\r
- if(!piece && type[1] == NOTHING && type[0] == ALPHABETIC && type[2] == ALPHABETIC) {\r
+ if(!piece && type[1] == NOTHING && type[0] == ALPHABETIC && type[2] == ALPHABETIC
+ && (coord[0] != 14 || coord[2] != 14) /* reserve oo for castling! */ ) {
piece = 'P'; n = 4; // kludge alert: fake full to-square\r
}\r
}\r
{ // prepare parse buffer for reading file\r
inputFile = f;\r
inPtr = parsePtr = inputBuf;\r
+ fromString = 0;\r
lastChar = '\n';\r
*inPtr = NULLCHAR; // make sure we will start by reading a line\r
}\r
\r
void yynewstr P((char *s))\r
{\r
+ parsePtr = s;\r
+ inputFile = NULL;\r
+ fromString = 1;\r
}\r
\r
int yylex()\r