--- lempar.c.orig 2020-11-05 19:44:09.412097759 +0100 +++ lempar.c 2020-11-06 09:03:57.932738075 +0100 @@ -89,6 +89,11 @@ /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) +/* Default linkage for exposed parser routines is global */ +#ifndef YYFUNCAPI +# define YYFUNCAPI +#endif + /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. ** @@ -248,6 +253,7 @@ ** Outputs: ** None. */ +YYFUNCAPI void ParseTrace(FILE *TraceFILE, char *zTracePrompt){ yyTraceFILE = TraceFILE; yyTracePrompt = zTracePrompt; @@ -317,6 +323,7 @@ /* Initialize a new parser that has already been allocated. */ +YYFUNCAPI void ParseInit(void *yypRawParser ParseCTX_PDECL){ yyParser *yypParser = (yyParser*)yypRawParser; ParseCTX_STORE @@ -356,6 +363,7 @@ ** A pointer to a parser. This pointer is used in subsequent calls ** to Parse and ParseFree. */ +YYFUNCAPI void *ParseAlloc(void *(*mallocProc)(YYMALLOCARGTYPE) ParseCTX_PDECL){ yyParser *yypParser; yypParser = (yyParser*)(*mallocProc)( (YYMALLOCARGTYPE)sizeof(yyParser) ); @@ -424,6 +432,7 @@ /* ** Clear all secondary memory allocations from the parser */ +YYFUNCAPI void ParseFinalize(void *p){ yyParser *pParser = (yyParser*)p; while( pParser->yytos>pParser->yystack ) yy_pop_parser_stack(pParser); @@ -441,6 +450,7 @@ ** is defined in a %include section of the input grammar) then it is ** assumed that the input pointer is never NULL. */ +YYFUNCAPI void ParseFree( void *p, /* The parser to be deleted */ void (*freeProc)(void*) /* Function used to reclaim memory */ @@ -457,6 +467,7 @@ ** Return the peak depth of the stack for a parser. */ #ifdef YYTRACKMAXSTACKDEPTH +YYFUNCAPI int ParseStackPeak(void *p){ yyParser *pParser = (yyParser*)p; return pParser->yyhwm; @@ -481,6 +492,7 @@ ** Return the number of missed state/lookahead combinations. */ #if defined(YYCOVERAGE) +YYFUNCAPI int ParseCoverage(FILE *out){ int stateno, iLookAhead, i; int nMissed = 0; @@ -889,6 +901,7 @@ ** Outputs: ** None. */ +YYFUNCAPI void Parse( void *yyp, /* The parser */ int yymajor, /* The major token code number */ @@ -1063,6 +1076,7 @@ ** Return the fallback token corresponding to canonical token iToken, or ** 0 if iToken has no fallback. */ +YYFUNCAPI int ParseFallback(int iToken){ #ifdef YYFALLBACK assert( iToken<(int)(sizeof(yyFallback)/sizeof(yyFallback[0])) );