Changeset 1334 for XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.yacc
- Timestamp:
- 11/20/17 09:49:26 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.yacc
r1328 r1334 15 15 } 16 16 17 IFilterExprNode* parsed; 18 std::string globalInputText; 19 size_t globalReadOffset = 0; 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) 20 22 21 23 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 22 24 { 25 if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 23 26 size_t numBytesToRead = maxBytesToRead; 24 size_t bytesRemaining = globalInputText.length()-globalReadOffset;27 size_t bytesRemaining = (*globalInputText_ptr).length()-globalReadOffset; 25 28 size_t i; 26 29 if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 27 for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i];30 for (i = 0; i < numBytesToRead; i++) buffer[i] = (*globalInputText_ptr).c_str()[globalReadOffset + i]; 28 31 *numBytesRead = numBytesToRead; 29 32 globalReadOffset += numBytesToRead; … … 145 148 IFilterExprNode* parseExpr(const string& strExpr) 146 149 { 147 globalInputText = strExpr; 148 globalReadOffset = 0; 149 yyparse(); 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 } 150 157 return parsed; 151 158 }
Note: See TracChangeset
for help on using the changeset viewer.