openfoam/wmake/etc/lempar.c.patch
Mark Olesen 6365bab800 ENH: update lemon version and linkage directive (#1768)
- replace `%namespace` directive with simpler `%static` directive.

  We always encapsulate Lemon parser routines in an anonymous
  namespace, so a simpler static linkage directive suffices.

  This reduces the size of the Lemon patch (program and template).
2020-07-10 12:01:58 +02:00

88 lines
2.5 KiB
Diff

--- lempar.c.orig 2020-07-09 14:55:42.000000000 +0200
+++ lempar.c 2020-07-10 11:04:51.991472607 +0200
@@ -93,6 +93,12 @@
/************* 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.
**
@@ -251,6 +257,7 @@
** Outputs:
** None.
*/
+YYFUNCAPI
void ParseTrace(FILE *TraceFILE, char *zTracePrompt){
yyTraceFILE = TraceFILE;
yyTracePrompt = zTracePrompt;
@@ -320,6 +327,7 @@
/* Initialize a new parser that has already been allocated.
*/
+YYFUNCAPI
void ParseInit(void *yypRawParser ParseCTX_PDECL){
yyParser *yypParser = (yyParser*)yypRawParser;
ParseCTX_STORE
@@ -359,6 +367,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) );
@@ -427,6 +436,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);
@@ -444,6 +454,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 */
@@ -460,6 +471,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;
@@ -484,6 +496,7 @@
** Return the number of missed state/lookahead combinations.
*/
#if defined(YYCOVERAGE)
+YYFUNCAPI
int ParseCoverage(FILE *out){
int stateno, iLookAhead, i;
int nMissed = 0;
@@ -891,6 +904,7 @@
** Outputs:
** None.
*/
+YYFUNCAPI
void Parse(
void *yyp, /* The parser */
int yymajor, /* The major token code number */
@@ -1065,6 +1079,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])) );