code cleanup: make function definition confirm to GNU coding style
[xboard.git] / parser.c
index a0a7ad1..c4330d1 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -51,7 +51,8 @@ static char fromString = 0, lastChar = '\n';
 #define ALPHABETIC 2
 #define BADNUMBER (-2000000000)
 
-int ReadLine()
+int
+ReadLine ()
 {   // Read one line from the input file, and append to the buffer
     char c, *start = inPtr;
     if(fromString) return 0; // parsing string, so the end is a hard end
@@ -66,7 +67,8 @@ int ReadLine()
     return 1;
 }
 
-int Scan(char c, char **p)
+int
+Scan (char c, char **p)
 {   // line-spanning skip to mentioned character or EOF
     do {
        while(**p) if(*(*p)++ == c) return 0;
@@ -75,7 +77,8 @@ int Scan(char c, char **p)
     return 1;
 }
 
-int SkipWhite(char **p)
+int
+SkipWhite (char **p)
 {   // skip spaces tabs and newlines; return 1 if anything was skipped
     char *start = *p;
     do{
@@ -84,7 +87,8 @@ int SkipWhite(char **p)
     return *p != start;
 }
 
-inline int Match(char *pattern, char **ptr)
+inline int
+Match (char *pattern, char **ptr)
 {
     char *p = pattern, *s = *ptr;
     while(*p && (*p == *s++ || s[-1] == '\r' && *p--)) p++;
@@ -95,7 +99,8 @@ inline int Match(char *pattern, char **ptr)
     return 0; // no match, no ptr update
 }
 
-inline int Word(char *pattern, char **p)
+inline int
+Word (char *pattern, char **p)
 {
     if(Match(pattern, p)) return 1;
     if(*pattern >= 'a' && *pattern <= 'z' && *pattern - **p == 'a' - 'A') { // capitalized
@@ -106,15 +111,16 @@ inline int Word(char *pattern, char **p)
     return 0;
 }
 
-int Verb(char *pattern, char **p)
+int
+Verb (char *pattern, char **p)
 {
     int res = Word(pattern, p);
     if(res && !Match("s", p)) Match("ed", p); // eat conjugation suffix, if any
     return res;
 }
 
-
-int Number(char **p)
+int
+Number (char **p)
 {
     int val = 0;
     if(**p < '0' || **p > '9') return BADNUMBER;
@@ -124,7 +130,8 @@ int Number(char **p)
     return val;
 }
 
-int RdTime(char c, char **p)
+int
+RdTime (char c, char **p)
 {
     char *start = ++(*p), *sec; // increment *p, as it was pointing to the opening ( or {
     if(Number(p) == BADNUMBER) return 0;
@@ -139,7 +146,8 @@ int RdTime(char c, char **p)
     return 0;
 }
 
-char PromoSuffix(char **p)
+char
+PromoSuffix (char **p)
 {
     char *start = *p;
     if(**p == 'e' && (Match("ep", p) || Match("e.p.", p))) { *p = start; return NULLCHAR; } // non-compliant e.p. suffix is no promoChar!
@@ -151,7 +159,8 @@ char PromoSuffix(char **p)
     return NULLCHAR; // no suffix detected
 }
 
-int NextUnit(char **p)
+int
+NextUnit (char **p)
 {      // Main parser routine
        int coord[4], n, result, piece, i;
        char type[4], promoted, separator, slash, *oldp, *commentEnd, c;
@@ -533,12 +542,14 @@ badMove:// we failed to find algebraic move
 /*
     Return offset of next pattern in the current file.
 */
-int yyoffset()
+int
+yyoffset ()
 {
     return ftell(inputFile) - (inPtr - parsePtr); // subtract what is read but not yet parsed
 }
 
-void yynewfile (FILE *f)
+void
+yynewfile (FILE *f)
 {   // prepare parse buffer for reading file
     inputFile = f;
     inPtr = parsePtr = inputBuf;
@@ -547,14 +558,16 @@ void yynewfile (FILE *f)
     *inPtr = NULLCHAR; // make sure we will start by reading a line
 }
 
-void yynewstr P((char *s))
+void
+yynewstr P((char *s))
 {
     parsePtr = s;
     inputFile = NULL;
     fromString = 1;
 }
 
-int yylex()
+int
+yylex ()
 {   // this replaces the flex-generated parser
     int result = NextUnit(&parsePtr);
     char *p = parseStart, *q = yytext;
@@ -564,7 +577,8 @@ int yylex()
     return result;
 }
 
-int Myylex()
+int
+Myylex ()
 {   // [HGM] wrapper for yylex, which treats nesting of parentheses
     int symbol, nestingLevel = 0, i=0;
     char *p;
@@ -584,7 +598,8 @@ int Myylex()
     return symbol;
 }
 
-ChessMove yylexstr(int boardIndex, char *s, char *buf, int buflen)
+ChessMove
+yylexstr (int boardIndex, char *s, char *buf, int buflen)
 {
     ChessMove ret;
     char *savPP = parsePtr;
@@ -598,4 +613,3 @@ ChessMove yylexstr(int boardIndex, char *s, char *buf, int buflen)
     fromString = 0;
     return ret;
 }
-