Reframe the preprocessor as a C++ class, with instances, removing all C code, removing all global variables. Upgrade bison version to pass a parse context on through to the preprocessor. All the basic things to make something thread safe.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@22291 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
parent
5f1a0b7998
commit
7213324259
59 changed files with 18949 additions and 4503 deletions
|
|
@ -59,20 +59,6 @@ Jutta Degener, 1995
|
|||
#include "ParseHelper.h"
|
||||
#include "../Public/ShaderLang.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define YYPARSE_PARAM parseContext
|
||||
#define YYPARSE_PARAM_DECL TParseContext&
|
||||
#define YY_DECL int yylex(YYSTYPE* pyylval, TParseContext& parseContext)
|
||||
#define YYLEX_PARAM parseContext
|
||||
#else
|
||||
#define YYPARSE_PARAM parseContextLocal
|
||||
#define parseContext (*((TParseContext*)(parseContextLocal)))
|
||||
#define YY_DECL int yylex(YYSTYPE* pyylval, void* parseContextLocal)
|
||||
#define YYLEX_PARAM (void*)(parseContextLocal)
|
||||
#endif
|
||||
|
||||
extern void yyerror(const char*);
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
|
|
@ -109,13 +95,18 @@ extern void yyerror(const char*);
|
|||
}
|
||||
|
||||
%{
|
||||
#ifndef _WIN32
|
||||
extern int yylex(YYSTYPE*, void*);
|
||||
#endif
|
||||
|
||||
#define YYPARSE_PARAM voidParseContext
|
||||
#define parseContext (*(TParseContext*)voidParseContext)
|
||||
#define YYLEX_PARAM parseContext
|
||||
#define yyerror(msg) parseContext.parserError(msg)
|
||||
|
||||
extern int yylex(YYSTYPE*, TParseContext&);
|
||||
|
||||
%}
|
||||
|
||||
%pure_parser /* Just in case is called from multiple threads */
|
||||
%expect 1 /* One shift reduce conflict because of if | else */
|
||||
%pure_parser // enable thread safety
|
||||
%expect 1 // One shift reduce conflict because of if | else
|
||||
|
||||
%token <lex> ATTRIBUTE VARYING
|
||||
%token <lex> CONST BOOL FLOAT DOUBLE INT UINT
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue