Changeset 1642 for XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.cpp
- Timestamp:
- 01/23/19 10:31:44 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_openmp/src/parse_expr/yacc_parser.cpp
r1334 r1642 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 }
Note: See TracChangeset
for help on using the changeset viewer.