DecimalInputSymbolRef::DecimalInputSymbolRef(InputSource& input, Array<Action*>& actions, ErrorHandler& errorHandler, OptionParameters& optionParameters, Symbols& symbols, unsigned long& timeOfOptionExecution, unsigned long& timeOfStateExecution) : symbol(0), parameters(0) { char buf[100]; input.readString(buf,99); XABSL_DEBUG_INIT(errorHandler.message("creating a reference to decimal input symbol \"%s\"",buf)); if (!symbols.decimalInputSymbols.exists(buf)) { errorHandler.error("XabslDecimalInputSymbolRef::DecimalInputSymbolRef(): decimal input symbol \"%s\" was not registered",buf); return; } symbol = symbols.decimalInputSymbols[buf]; parameters = new ParameterAssignment(&symbol->parameters, errorHandler); parameters->create(input, optionParameters, symbols, timeOfOptionExecution, timeOfStateExecution, actions); }
TestResult::List XSDTSTestCase::execute(const ExecutionStage, TestSuite*) { ErrorHandler errHandler; ErrorHandler::installQtMessageHandler(&errHandler); TestResult::List retval; TestResult::Status resultStatus = TestResult::Unknown; QString serialized; if (m_testType == SchemaTest) { executeSchemaTest(resultStatus, serialized, &errHandler); } else { executeInstanceTest(resultStatus, serialized, &errHandler); } resultStatus = TestBaseLine::scan(serialized, baseLines()); Q_ASSERT(resultStatus != TestResult::Unknown); m_result = new TestResult(name(), resultStatus, 0, errHandler.messages(), QPatternist::Item::List(), serialized); retval.append(m_result); ErrorHandler::installQtMessageHandler(0); changed(this); return retval; }
bool EnumeratedExpression::createOperand(const EnumeratedExpression*& operand, const Enumeration* enumeration, InputSource& input, ErrorHandler& errorHandler, Symbols& symbols, Option& option, State& state) { operand = EnumeratedExpression::create(enumeration, input, errorHandler, symbols, option, state); if(operand == 0) { errorHandler.error("XabslEnumeratedExpression::createOperand(): created operand is 0"); return false; } if(errorHandler.errorsOccurred) { errorHandler.error("XabslEnumeratedExpression::createOperand(): could not create operand"); if(operand != 0) delete operand; return false; } return true; }
EnumeratedInputSymbolRef::EnumeratedInputSymbolRef(const Enumeration* enumeration, InputSource& input, ErrorHandler& errorHandler, Symbols& symbols, Option& option, State& state) : symbol(0), parameters(0) { char buf[100]; input.readString(buf, 99); XABSL_DEBUG_INIT(errorHandler.message("creating reference to enumerated input symbol \"%s\"", buf)); if(!symbols.enumeratedInputSymbols.exists(buf)) { errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumerated input symbol \"%s\" was not registered at the engine", buf); return; } symbol = symbols.enumeratedInputSymbols[buf]; this->enumeration = symbol->enumeration; if(enumeration != NULL && enumeration != this->enumeration) { errorHandler.error("XabslEnumeratedInputSymbolRef::XabslEnumeratedInputSymbolRef(): enumeration input symbol \"%s\" does not match enumeration type \"%s\"", buf, enumeration->n); } parameters = new ParameterAssignment(&symbol->parameters, errorHandler); parameters->create(input, symbols, option, state); }
/** This is the entry point for parsing when you have source stream and the textual name of that stream, and is also called */ bool ZASParser::sParse(const ZFileSpec& iFileSpec, const ZStreamR& iStream, ParseHandler& iParseHandler, const StreamProvider& iStreamProvider, const ErrorHandler& iErrorHandler, IncludeHandler* iIncludeHandler) { try { Parser theParser(iParseHandler, iStreamProvider, iErrorHandler, iIncludeHandler); iParseHandler.StartParse(); theParser.Parse(iFileSpec, iStream); iParseHandler.EndParse(); return true; } catch (NestedParse& ex) { printf("EX4\n"); iErrorHandler.ReportError(ex.GetSources(), ex.GetMessage()); } catch (exception& ex) { printf("EX5\n"); iErrorHandler.ReportError(ex.what()); } catch (...) { iErrorHandler.ReportError("Unknown exception"); } return false; }
inline Iterator parseObject(Iterator begin, Iterator end, ObjectBodyParser objectBodyParser, ErrorHandler &errorHandler) { Iterator i = skipLeadingSpaces<spacePolicy>(begin, end); if (unlikely(i == end)) { goto prematureEnd; } if (unlikely(*i != u8"{"[0])) { goto malformedJson; } i = objectBodyParser(++i, end, errorHandler); if (unlikely(!errorHandler.valid())) { return end; } if (unlikely(i == end)) { goto prematureEnd; } if (unlikely(*i != u8"}"[0])) { goto malformedJson; } return skipTrailingSpaces<spacePolicy>(++i, end); prematureEnd: errorHandler.prematureEnd(); return end; malformedJson: errorHandler.malformedJson(i); return end; }
bool DocumentImporter::import() { ErrorHandler errorHandler; COLLADASaxFWL::Loader loader(&errorHandler); COLLADAFW::Root root(&loader, this); ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer)); loader.registerExtraDataCallbackHandler(ehandler); if (!root.loadDocument(mFilename)) return false; if(errorHandler.hasError()) return false; /** TODO set up scene graph and such here */ mImportStage = Controller; COLLADASaxFWL::Loader loader2; COLLADAFW::Root root2(&loader2, this); if (!root2.loadDocument(mFilename)) return false; delete ehandler; return true; }
IfElseBlock::IfElseBlock(InputSource& input, ErrorHandler& errorHandler, Symbols& symbols, Option& option, State& state) : ifCondition(0), ifStatement(0), elseStatement(0) { // if case XABSL_DEBUG_INIT(errorHandler.message("creating if statement")); ifCondition = BooleanExpression::create(input, errorHandler, symbols, option, state); if(errorHandler.errorsOccurred) { errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if condition"); return; } ifStatement = Statement::createStatement(input, errorHandler, symbols, option, state); if(errorHandler.errorsOccurred) { errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create if statement"); return; } // else case XABSL_DEBUG_INIT(errorHandler.message("creating else statement")); elseStatement = Statement::createStatement(input, errorHandler, symbols, option, state); if(errorHandler.errorsOccurred) errorHandler.error("XabslIfElseBlock::IfElseBlock(): could not create else statement"); }
bool DecimalExpression::createOperand(DecimalExpression*& operand, InputSource& input, Array<Action*>& actions, ErrorHandler& errorHandler, OptionParameters& parameters, Symbols& symbols, unsigned long& timeOfOptionExecution, unsigned long& timeOfStateExecution) { operand = DecimalExpression::create(input,actions,errorHandler,parameters, symbols, timeOfOptionExecution,timeOfStateExecution); if (operand == 0) { errorHandler.error("XabslDecimalExpression::createOperand(): created operand is 0"); return false; } if (errorHandler.errorsOccurred) { errorHandler.error("XabslDecimalExpression::createOperand(): could not create operand"); if (operand != 0) delete operand; return false; } return true; }
static void GEOS_DLL notice_trampoline(const char* message, void* userdata) { ErrorHandler* debug = static_cast<ErrorHandler*>(userdata); if (!debug) return; debug->m_geos_callback(message); if (!debug->m_log->get()) return; }
Penjin::ERRORS Text::load(CRstring name,CRuint fontSize) { ErrorHandler* eMan = ErrorMan::getInstance(); // check if fontSize is not the same as loaded font if(this->fontSize != fontSize || name != getFileName()) { clear(); #if PLATFORM_WII font = TTF_OpenFont((Penjin::getWorkingDirectory() + name).c_str(), fontSize); #else font = TTF_OpenFont(name.c_str(), fontSize); #endif } if(font) { setFileName(name); // check if we already have Glyphs for this fontSize if(glyphs.size() >= fontSize) { if(glyphs.at(fontSize-1).size()) { // if the fontSize checks out... if(glyphs.at(fontSize-1)[0]->getFontSize() == fontSize) { this->fontSize = fontSize; #ifdef _DEBUG eMan->print(PENJIN_OK,"Text: font loaded, Size: " + StringUtility::intToString(fontSize) + "Font: " + name); #endif return PENJIN_OK; } } } else { //Setup enough glyphs for fontSize glyphs.resize(fontSize); } // create Dummy Char for spacing calcs glyphs[fontSize-1].push_back(NULL); glyphs[fontSize-1][0] = new Glyph(); glyphs[fontSize-1][0]->setFontSize(fontSize); glyphs[fontSize-1][0]->setFont(font); glyphs[fontSize-1][0]->setCharacter('-'); // picked because a nice square char to give us a "standard surface width" glyphs[fontSize-1][0]->setPosition(cursorPos.getPosition()); glyphs[fontSize-1][0]->refresh(); setFileName(name); this->fontSize = fontSize; #ifdef _DEBUG eMan->print(PENJIN_OK,"Text: font loaded, Size: " + StringUtility::intToString(fontSize) + "Font: " + name); #endif return PENJIN_OK; } eMan->print(PENJIN_TTF_UNABLE_TO_OPEN,"Text: Size: " + StringUtility::intToString(fontSize) + "Font: " + name); return PENJIN_TTF_UNABLE_TO_OPEN; }
Error CodeGen::setErrorHandler(ErrorHandler* handler) { ErrorHandler* oldHandler = _errorHandler; if (oldHandler != NULL) oldHandler->release(); if (handler != NULL) handler = handler->addRef(); _errorHandler = handler; return kErrorOk; }
inline Iterator parseComma(Iterator begin, Iterator end, ErrorHandler &errorHandler) { Iterator i = skipLeadingSpaces<spacePolicy>(begin, end); if (unlikely(i == end)) { errorHandler.prematureEnd(); return end; } if (unlikely(*i != u8","[0])) { errorHandler.malformedJson(i); return i; } return skipTrailingSpaces<spacePolicy>(++i, end); }
DecimalValue::DecimalValue(InputSource& input, ErrorHandler& errorHandler) { value = input.readValue(); XABSL_DEBUG_INIT(errorHandler.message("created decimal value: \"%.2f\"",value)); }
inline void put ( Reader reader, ErrorHandler handler ) { const com::Result result = reader->putErrorHandler(handler.value()); if ( result.bad() ) { UNCHECKED_COM_ERROR(ISAXXMLReader, putErrorHandler, result); } }
ConflictCondition::ConflictCondition( ErrorHandler& errorHandler, State& state) : state(state) { XABSL_DEBUG_INIT(errorHandler.message("creating a \"conflict\" element")); }
SubsequentOptionReachedTargetStateCondition::SubsequentOptionReachedTargetStateCondition( ErrorHandler& errorHandler, State& state) : state(state) { XABSL_DEBUG_INIT(errorHandler.message("creating a \"subsequent-option-reached-target-state\" element")); }
static void getargs (int argc, const char *argv[]) { static bool help = false; OIIO::ArgParse ap; ap.options ("Usage: testshade [options] shader...", "%*", add_shader, "", "--help", &help, "Print help message", "-v", &verbose, "Verbose messages", "--debug", &debug, "Lots of debugging info", "--debug2", &debug2, "Even more debugging info", "--stats", &stats, "Print run statistics", "-g %d %d", &xres, &yres, "Make an X x Y grid of shading points", "-o %L %L", &outputvars, &outputfiles, "Output (variable, filename)", "-od %s", &dataformatname, "Set the output data format to one of: " "uint8, half, float", "--layer %s", &layername, "Set next layer name", "--fparam %L %L", &fparams, &fparams, "Add a float param (args: name value)", "--iparam %L %L", &iparams, &iparams, "Add an integer param (args: name value)", "--vparam %L %L %L %L", &vparams, &vparams, &vparams, &vparams, "Add a vector or color param (args: name x y z)", "--sparam %L %L", &sparams, &sparams, "Add a string param (args: name value)", "--connect %L %L %L %L", &connections, &connections, &connections, &connections, "Connect fromlayer fromoutput tolayer toinput", "--raytype %s", &raytype, "Set the raytype", "--iters %d", &iters, "Number of iterations", "-O0", &O0, "Do no runtime shader optimization", "-O1", &O1, "Do a little runtime shader optimization", "-O2", &O2, "Do lots of runtime shader optimization", "--center", &pixelcenters, "Shade at output pixel 'centers' rather than corners", "--debugnan", &debugnan, "Turn on 'debugnan' mode", "--options %s", &extraoptions, "Set extra OSL options", // "-v", &verbose, "Verbose output", NULL); if (ap.parse(argc, argv) < 0 || shadernames.empty()) { std::cerr << ap.geterror() << std::endl; ap.usage (); exit (EXIT_FAILURE); } if (help) { std::cout << "testshade -- Test Open Shading Language\n" "(c) Copyright 2009-2010 Sony Pictures Imageworks Inc. All Rights Reserved.\n"; ap.usage (); exit (EXIT_SUCCESS); } if (debug || verbose) errhandler.verbosity (ErrorHandler::VERBOSE); }
BooleanOutputSymbolRef::BooleanOutputSymbolRef(InputSource& input, ErrorHandler& errorHandler, Symbols& symbols) { char buf[100]; input.readString(buf,99); XABSL_DEBUG_INIT(errorHandler.message("creating a reference to a boolean output symbol \"%s\"",buf)); if (!symbols.booleanOutputSymbols.exists(buf)) { errorHandler.error("XabslBooleanOutputSymbolRef::BooleanOutputSymbolRef(): boolean output symbol \"%s\" was not registered",buf); return; } symbol = symbols.booleanOutputSymbols[buf]; }
BooleanOptionParameterRef::BooleanOptionParameterRef(InputSource& input, ErrorHandler& errorHandler, Option& option) { char buf[100]; input.readString(buf,99); XABSL_DEBUG_INIT(errorHandler.message("creating a reference to boolean option parameter \"%s\"",buf)); if (!option.parameters->boolean.exists(buf)) { errorHandler.error("XabslBooleanOptionParameterRef::BooleanOptionParameterRef(): boolean option parameter \"%s\" does not exist",buf); return; } parameter = option.parameters->boolean.getPElement(buf)->e; }
DecimalOptionParameterRef::DecimalOptionParameterRef(InputSource& input, ErrorHandler& errorHandler, OptionParameters& parameters) { char buf[100]; input.readString(buf,99); XABSL_DEBUG_INIT(errorHandler.message("creating a reference to decimal option parameter \"%s\"",buf)); if (!parameters.decimal.exists(buf)) { errorHandler.error("XabslDecimalOptionParameterRef::DecimalOptionParameterRef(): decimal option parameter \"%s\" does not exist",buf); return; } parameter = parameters.decimal.getPElement(buf)->e; }
template <class T> Array<T>::Array(size_t Size) { Buffer=(T *)malloc(sizeof(T)*Size); if (Buffer==NULL && Size!=0) ErrHandler.MemoryError(); AllocSize=BufSize=Size; }
EnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(InputSource& input, ErrorHandler& errorHandler, Symbols& symbols, Option& option, State& state) { if (!EnumeratedExpression::createOperand(operand1,NULL,input,errorHandler,symbols,option,state)) { errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression"); operand1 = operand2 = 0; return; } if (!EnumeratedExpression::createOperand(operand2,operand1->enumeration,input,errorHandler,symbols,option,state)) { errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression"); operand2 = 0; return; } }
BooleanValue::BooleanValue(InputSource& input, ErrorHandler& errorHandler) { char buf[6]; input.readString(buf, 5); value = (strcmp("true", buf) == 0); XABSL_DEBUG_INIT(errorHandler.message("created boolean value: \"%s\"", value ? "true" : "false")); }
inline Iterator parsePropertyValue(Iterator begin, Iterator end, const char * const propName, const std::size_t propNameSize, ValueParser valueParser, ErrorHandler &errorHandler) { Iterator i = skipLeadingSpaces<spacePolicy>(begin, end); // TODO optimise property name matching const char *realPropNameBegin; std::size_t realPropNameSize; auto propNameParser = [&](const char * const begin, const char * const end, ErrorHandler &errorHandler) -> const char * { // TODO support quotation marks in property name (make it optional for better performance. realPropNameBegin = begin; const char * const propNameEnd = std::find(begin, end, u8"\""[0]); realPropNameSize = propNameEnd - realPropNameBegin; return propNameEnd; }; // TODO support forward iterators; combine scanning and comparing into a single loop. i = afc::json::parseString<const char *, decltype(propNameParser) &, ErrorHandler, afc::json::noSpaces> (i, end, propNameParser, errorHandler); if (unlikely(!errorHandler.valid())) { return end; } if (unlikely(!afc::equal(propName, propNameSize, realPropNameBegin, realPropNameSize))) { errorHandler.malformedJson(i); return end; } i = afc::json::parseColon<const char *, ErrorHandler, spacePolicy>(i, end, errorHandler); if (unlikely(!errorHandler.valid())) { return end; } i = valueParser(i, end, errorHandler); if (unlikely(!errorHandler.valid())) { return end; } return skipTrailingSpaces<spacePolicy>(i, end); }
bool DocumentImporter::import() { ErrorHandler errorHandler; COLLADASaxFWL::Loader loader(&errorHandler); COLLADAFW::Root root(&loader, this); ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer)); loader.registerExtraDataCallbackHandler(ehandler); // deselect all to select new objects BKE_scene_base_deselect_all(CTX_data_scene(mContext)); std::string mFilename = std::string(this->import_settings->filepath); const std::string encodedFilename = bc_url_encode(mFilename); if (!root.loadDocument(encodedFilename)) { fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n"); delete ehandler; return false; } if (errorHandler.hasError()) { delete ehandler; return false; } /** TODO set up scene graph and such here */ mImportStage = Controller; COLLADASaxFWL::Loader loader2; COLLADAFW::Root root2(&loader2, this); if (!root2.loadDocument(encodedFilename)) { fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n"); delete ehandler; return false; } delete ehandler; return true; }
inline typename std::enable_if<!_impl::isRandomAccessIterator<Iterator>(), Iterator>::type parseBoolean(Iterator begin, Iterator end, bool &dest, ErrorHandler &errorHandler) { Iterator i = skipLeadingSpaces<spacePolicy>(begin, end); char c; if (unlikely(i == end)) { goto prematureEnd; } c = *i; if (c == u8"t"[0]) { if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"r"[0])) goto malformedJson; if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"u"[0])) goto malformedJson; if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"e"[0])) goto malformedJson; dest = true; } else if (c == u8"f"[0]) { if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"a"[0])) goto malformedJson; if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"l"[0])) goto malformedJson; if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"s"[0])) goto malformedJson; if (unlikely(++i == end)) goto prematureEnd; if (unlikely(*i != u8"e"[0])) goto malformedJson; dest = false; } else { goto malformedJson; } return skipTrailingSpaces<spacePolicy>(++i, end); prematureEnd: errorHandler.prematureEnd(); return end; malformedJson: errorHandler.malformedJson(i); return end; }
inline Iterator parseArray(Iterator begin, Iterator end, ArrayElementParser arrayElementParser, ErrorHandler &errorHandler) { Iterator i = skipLeadingSpaces<spacePolicy>(begin, end); if (unlikely(i == end)) { goto prematureEnd; } if (unlikely(*i != u8"["[0])) { goto malformedJson; } if (unlikely(++i == end)) { goto prematureEnd; } if (*i == u8"]"[0]) { return skipTrailingSpaces<spacePolicy>(++i, end); } for (;;) { i = arrayElementParser(i, end, errorHandler); if (unlikely(!errorHandler.valid())) { return end; } if (unlikely(i == end)) { goto prematureEnd; } const char c = *i; if (c == u8"]"[0]) { return skipTrailingSpaces<spacePolicy>(++i, end); } if (likely(c == u8","[0])) { ++i; } else { goto malformedJson; } } prematureEnd: errorHandler.prematureEnd(); return end; malformedJson: errorHandler.malformedJson(i); return end; }
TransitionToState::TransitionToState(InputSource& input, ErrorHandler& errorHandler, Array<State*>& states) { char buf[100]; input.readString(buf,99); nextState = states[buf]; XABSL_DEBUG_INIT(errorHandler.message("creating a transition to state \"%s\"",nextState->n)); }
EnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(InputSource& input, Array<Action*>& actions, ErrorHandler& errorHandler, OptionParameters& parameters, Symbols& symbols, unsigned long& timeOfOptionExecution, unsigned long& timeOfStateExecution) { if (!EnumeratedExpression::createOperand(operand1,NULL,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution)) { errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression"); operand1 = operand2 = 0; return; } if (!EnumeratedExpression::createOperand(operand2,operand1->enumeration,input,actions,errorHandler,parameters,symbols,timeOfOptionExecution,timeOfStateExecution)) { errorHandler.error("XabslEnumeratedInputSymbolComparison::EnumeratedInputSymbolComparison(): could not create enumerated expression"); operand2 = 0; return; } }