From: Nick Bowler Date: Tue, 19 Jul 2011 23:13:23 +0000 (-0400) Subject: Add cdecl__ prefix to flex/bison functions. X-Git-Tag: v1~126 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/f64af1a757804cd18bd1731b4634e5752b9ca0ed Add cdecl__ prefix to flex/bison functions. Now all global symbols are prefixed. --- diff --git a/src/parse-decl.c b/src/parse-decl.c index 5002f59..3ffb102 100644 --- a/src/parse-decl.c +++ b/src/parse-decl.c @@ -391,14 +391,14 @@ struct cdecl *cdecl_parse_decl(const char *declstr) struct cdecl *decl; int rc; - rc = yylex_init(&scanner); + rc = cdecl__yylex_init(&scanner); if (rc != 0) return NULL; - state = yy_scan_string(declstr, scanner); - rc = yyparse(scanner, &decl); - yy_delete_buffer(state, scanner); - yylex_destroy(scanner); + state = cdecl__yy_scan_string(declstr, scanner); + rc = cdecl__yyparse(scanner, &decl); + cdecl__yy_delete_buffer(state, scanner); + cdecl__yylex_destroy(scanner); if (rc != 0) return NULL; @@ -437,14 +437,14 @@ struct cdecl *cdecl_parse_english(const char *english) struct cdecl *decl; int rc; - rc = yylex_init_extra(true, &scanner); + rc = cdecl__yylex_init_extra(true, &scanner); if (rc != 0) return NULL; - state = yy_scan_string(english, scanner); - rc = yyparse(scanner, &decl); - yy_delete_buffer(state, scanner); - yylex_destroy(scanner); + state = cdecl__yy_scan_string(english, scanner); + rc = cdecl__yyparse(scanner, &decl); + cdecl__yy_delete_buffer(state, scanner); + cdecl__yylex_destroy(scanner); if (rc != 0) return NULL; diff --git a/src/parse.y b/src/parse.y index 32ee5a7..1cda21f 100644 --- a/src/parse.y +++ b/src/parse.y @@ -18,6 +18,7 @@ */ } +%name-prefix "cdecl__yy" %parse-param {yyscan_t scanner} %parse-param {struct cdecl **out} %lex-param {yyscan_t scanner} @@ -54,8 +55,8 @@ } %code provides { -void yyerror(YYLTYPE *, void *, struct cdecl **, const char *); -int yyparse(void *scanner, struct cdecl **out); +void cdecl__yyerror(YYLTYPE *, void *, struct cdecl **, const char *); +int cdecl__yyparse(void *scanner, struct cdecl **out); } %union { diff --git a/src/scan.l b/src/scan.l index bb6564b..e59b0aa 100644 --- a/src/scan.l +++ b/src/scan.l @@ -22,10 +22,11 @@ %option noyywrap bison-locations reentrant %option extra-type="_Bool" +%option prefix="cdecl__yy" %{ #define lex_error(msg) do { \ - yyerror(yylloc, NULL, NULL, (msg)); \ + cdecl__yyerror(yylloc, NULL, NULL, (msg)); \ return T_LEX_ERROR; \ } while(0)