Changeset 1328 for XIOS/dev/branch_openmp/src/parse_expr
- Timestamp:
- 11/15/17 12:14:34 (7 years ago)
- Location:
- XIOS/dev/branch_openmp/src/parse_expr
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/parse_expr/lex_parser.cpp
r1134 r1328 347 347 extern char *yytext; 348 348 #define yytext_ptr yytext 349 350 349 static yyconst flex_int16_t yy_nxt[][128] = 351 350 { -
XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.cpp
r1134 r1328 80 80 } 81 81 82 static IFilterExprNode* parsed; 83 static std::string globalInputText; 84 static std::string *globalInputText_ptr = 0; 85 static size_t globalReadOffset = 0; 86 #pragma omp threadprivate(parsed, globalInputText_ptr, globalReadOffset) 87 82 IFilterExprNode* parsed; 83 std::string globalInputText; 84 size_t globalReadOffset = 0; 85 88 86 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 89 87 { 90 if(globalInputText_ptr == 0) globalInputText_ptr = new std::string;91 88 size_t numBytesToRead = maxBytesToRead; 92 size_t bytesRemaining = (*globalInputText_ptr).length()-globalReadOffset;89 size_t bytesRemaining = globalInputText.length()-globalReadOffset; 93 90 size_t i; 94 91 if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 95 for (i = 0; i < numBytesToRead; i++) buffer[i] = (*globalInputText_ptr).c_str()[globalReadOffset + i];92 for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; 96 93 *numBytesRead = numBytesToRead; 97 94 globalReadOffset += numBytesToRead; … … 2005 2002 IFilterExprNode* parseExpr(const string& strExpr) 2006 2003 { 2007 #pragma omp critical (_parser) 2008 { 2009 if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 2010 (*globalInputText_ptr).assign (strExpr); 2011 globalReadOffset = 0; 2012 yyparse(); 2013 } 2004 globalInputText = strExpr; 2005 globalReadOffset = 0; 2006 yyparse(); 2014 2007 return parsed; 2015 2008 } … … 2017 2010 2018 2011 2019 -
XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.yacc
r1134 r1328 15 15 } 16 16 17 static IFilterExprNode* parsed; 18 static std::string globalInputText; 19 static std::string *globalInputText_ptr = 0; 20 static size_t globalReadOffset = 0; 21 #pragma omp threadprivate(parsed, globalInputText_ptr, globalReadOffset) 22 17 IFilterExprNode* parsed; 18 std::string globalInputText; 19 size_t globalReadOffset = 0; 20 23 21 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 24 22 { 25 if(globalInputText_ptr == 0) globalInputText_ptr = new std::string;26 23 size_t numBytesToRead = maxBytesToRead; 27 size_t bytesRemaining = (*globalInputText_ptr).length()-globalReadOffset;24 size_t bytesRemaining = globalInputText.length()-globalReadOffset; 28 25 size_t i; 29 26 if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 30 for (i = 0; i < numBytesToRead; i++) buffer[i] = (*globalInputText_ptr).c_str()[globalReadOffset + i];27 for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i]; 31 28 *numBytesRead = numBytesToRead; 32 29 globalReadOffset += numBytesToRead; … … 148 145 IFilterExprNode* parseExpr(const string& strExpr) 149 146 { 150 #pragma omp critical (_parser) 151 { 152 if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 153 (*globalInputText_ptr).assign (strExpr); 154 globalReadOffset = 0; 155 yyparse(); 156 } 147 globalInputText = strExpr; 148 globalReadOffset = 0; 149 yyparse(); 157 150 return parsed; 158 151 }
Note: See TracChangeset
for help on using the changeset viewer.