- Timestamp:
- 05/16/17 17:54:30 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/branch_yushan_merged/src/parse_expr/yacc_parser.cpp
r1038 r1134 80 80 } 81 81 82 IFilterExprNode* parsed; 83 std::string globalInputText; 84 size_t globalReadOffset = 0; 85 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 86 88 int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead) 87 89 { 90 if(globalInputText_ptr == 0) globalInputText_ptr = new std::string; 88 91 size_t numBytesToRead = maxBytesToRead; 89 size_t bytesRemaining = globalInputText.length()-globalReadOffset;92 size_t bytesRemaining = (*globalInputText_ptr).length()-globalReadOffset; 90 93 size_t i; 91 94 if (numBytesToRead > bytesRemaining) numBytesToRead = bytesRemaining; 92 for (i = 0; i < numBytesToRead; i++) buffer[i] = globalInputText.c_str()[globalReadOffset + i];95 for (i = 0; i < numBytesToRead; i++) buffer[i] = (*globalInputText_ptr).c_str()[globalReadOffset + i]; 93 96 *numBytesRead = numBytesToRead; 94 97 globalReadOffset += numBytesToRead; … … 2002 2005 IFilterExprNode* parseExpr(const string& strExpr) 2003 2006 { 2004 globalInputText = strExpr; 2005 globalReadOffset = 0; 2006 yyparse(); 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 } 2007 2014 return parsed; 2008 2015 } … … 2010 2017 2011 2018 2019
Note: See TracChangeset
for help on using the changeset viewer.