PY_RES_TYPE PY_NGS_StatisticsGetAsI64 ( void* pRef, char const* path, int64_t* pRet, void** ppNGSStrError ) { PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes try { int64_t res = CheckedCast< ngs::StatisticsItf* >(pRef) -> getAsI64 ( path ); assert (pRet != NULL); *pRet = (int64_t) res; ret = PY_RES_OK; } catch ( ngs::ErrorMsg & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( std::exception & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( ... ) { ret = ExceptionHandler ( ppNGSStrError ); } return ret; }
PY_RES_TYPE PY_NGS_GetValueByParams5(void* pRef, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, TVal_c* pRet, void** ppNGSStrError, TVal_cpp (TRef::*pfn)(T1, T2, T3, T4, T5) const) { PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes try { TVal_cpp res = (CheckedCast< TRef* >(pRef) ->* pfn)( p1, p2, p3, p4, p5 ); assert(pRet != NULL); *pRet = (TVal_c)res; ret = PY_RES_OK; } catch ( ngs::ErrorMsg & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( std::exception & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( ... ) { ret = ExceptionHandler ( ppNGSStrError ); } return ret; }
PY_RES_TYPE PY_NGS_ReferenceSequenceGetLength ( void* pRef, uint64_t* pRet, void** ppNGSStrError ) { PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes try { uint64_t res = CheckedCast< ngs::ReferenceSequenceItf* >(pRef) -> getLength (); assert (pRet != NULL); *pRet = (uint64_t) res; ret = PY_RES_OK; } catch ( ngs::ErrorMsg & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( std::exception & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( ... ) { ret = ExceptionHandler ( ppNGSStrError ); } return ret; }
PY_RES_TYPE PY_NGS_ReadGroupGetStatistics ( void* pRef, void** pRet, void** ppNGSStrError ) { PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes try { ngs::StatisticsItf* res = CheckedCast< ngs::ReadGroupItf* >(pRef) -> getStatistics (); assert (pRet != NULL); *pRet = (void*) res; ret = PY_RES_OK; } catch ( ngs::ErrorMsg & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( std::exception & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( ... ) { ret = ExceptionHandler ( ppNGSStrError ); } return ret; }
PY_RES_TYPE PY_NGS_PileupGetReferenceBase ( void* pRef, char* pRet, void** ppNGSStrError ) { PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes try { char res = CheckedCast< ngs::PileupItf* >(pRef) -> getReferenceBase (); assert (pRet != NULL); *pRet = (char) res; ret = PY_RES_OK; } catch ( ngs::ErrorMsg & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( std::exception & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( ... ) { ret = ExceptionHandler ( ppNGSStrError ); } return ret; }
int test(struct IridiumContext * context) { setup(context); // x is a flag to indicate whether a jump occurred int x = 0; struct list * exceptions = list_new(EXCEPTION(MyException, 1)); // With no exception raised // Create the exception frame with no ensure exception_frame e = ExceptionHandler(context, exceptions, 0, 0, 0); switch (setjmp(e -> env)) { case 0: // begin // ... x = 1; END_BEGIN(context, e); case 1: // rescue MyException // ... assertNotReaches(); END_RESCUE(context, e); } assert(stack_empty(context->_exception_frames)); assertEqual(x, 1); return 0; }
void RlParser::Parse(ReplacementList& rl) { //resetting the categories //rl_ccat = RlCCat::open; rl_ccat = RlCCat::closed; rl_dcat = RlDCat::independent; rl_idlist.clear(); funArgId.clear(); rl_str_formatted.clear(); rl_ttype.Reset(); auto replacement_list_temp = rl.rl_tokens; //bool rl_modified = false; //auto rl_term_tok_id = boost::wave::token_id(replacement_list_temp.back()); //auto rl_term_tok_val = replacement_list_temp.back().get_value(); //std::vector<token_type>::iterator beg = rl.rl_tokens.begin(); //std::vector<token_type>::iterator if(replacement_list_temp.back() == boost::wave::T_CPPCOMMENT){ //std::cout<<"Last token is a cpp comment"; replacement_list_temp.back().set_token_id(boost::wave::T_NEWLINE); replacement_list_temp.back().set_value("\n"); //rl_modified = true; //replacement_list_temp.push_back(token_type(boost::wave::T_NEWLINE)); } //end = rl.rl_tokens.end(); std::vector<token_type>::iterator beg = replacement_list_temp.begin(); end = replacement_list_temp.end(); try { funArgId = rl.funArgId; switch(rl.rl_tokens.size()) { case 0://some problem while parsing the replacement_list throw ExceptionHandler(" -note: error while parsing the replacement list"); case 1://only one token means that is newline rl.rl_ccat = RlCCat::closed; rl.rl_dcat = RlDCat::independent; break; default://more than one token required for parsing the replacement list Parser(beg,end); //need to set these values by the parser //change these rvalues to pointers to save space and time rl.rl_ccat = rl_ccat; rl.rl_dcat = rl_dcat; rl.rl_ttype = rl_ttype; rl.rl_idlist = rl_idlist; rl.rl_str_formatted = rl_str_formatted; break; } } catch(ExceptionHandler& e) { //set the reject type and the demacrofier will take care of it rl_ccat = RlCCat::open; rl_ttype.reject_type = true; logFile<<e.GetMessage()<<"\n"; } /*if the replacement text was modified? if(rl_modified){ replacement_list_temp.back().set_token_id(rl_term_tok_id); replacement_list_temp.back().set_value(rl_term_tok_val); }*/ }
void __fastcall SampleRunViewController::update() { try { for ( TFmxObject* o : m_runContainerAdditions ) { m_view->runContainer->RemoveObject(o); } m_runContainerAdditions.clear(); WorklistEntrySet pending; m_selectedWorklistEntry.reset( NULL ); valc::SnapshotPtr snapshot = m_model->getSnapshot(); do { const int worklistID = m_model->getSelectedWorklistEntry(); if ( ! worklistID ) { break; } const valc::WorklistEntry* worklistEntry = findWorklistEntry( worklistID, snapshot ); if ( ! worklistEntry ) { break; } m_selectedWorklistEntry.reset( new WorklistEntryContext(worklistEntry, snapshot) ); m_view->barcode ->Text = m_selectedWorklistEntry->getBarcode().c_str(); m_view->sampleID->Text = m_selectedWorklistEntry->getSampleID(); for ( LocalRunIterator localRun( snapshot->localBegin(), snapshot->localEnd() ), eof; localRun != eof; ++localRun ) { if ( localRun->getSampleDescriptor() == m_selectedWorklistEntry->getSampleDescriptor() ) { describeLocalRun( *localRun, snapshot, pending ); } } m_selectedWorklistEntry->setNumPendingForSample( pending.size() ); if ( pending.size() ) { describePending(pending, snapshot ); } } while(false); } catch( const Exception& e ) { ExceptionHandler()(e); } }
BOOL CVirtualHelper::do_call(PyObject *args) { USES_CONVERSION; XDODECREF(retVal); // our old one. retVal = NULL; ASSERT(handler); // caller must trap this. ASSERT(args); PyObject *result = gui_call_object(handler,args); DODECREF(args); if (result==NULL) { if (vehErrorHandling==VEH_PRINT_ERROR) { char msg[256]; TRACE("CallVirtual : callback failed with exception\n"); gui_print_error(); // this will probably fail if we are already inside the exception handler PyObject *obRepr = PyObject_Repr(handler); char *szRepr = "<no representation (PyObject_Repr failed)>"; if (obRepr){ if (PyString_Check(obRepr)) szRepr = PyString_AS_STRING(obRepr); else if (PyUnicode_Check(obRepr)) szRepr=W2A(PyUnicode_AS_UNICODE(obRepr)); } else PyErr_Clear(); LPTSTR HandlerName=csHandlerName.GetBuffer(csHandlerName.GetLength()); snprintf(msg, sizeof(msg)/sizeof(msg[0]), "%s() virtual handler (%s) raised an exception", T2A(HandlerName), szRepr); csHandlerName.ReleaseBuffer(); Py_XDECREF(obRepr); PyErr_SetString(ui_module_error, msg); // send to the debugger TRACE(msg); TRACE("\n"); // send to the app. gui_print_error(); } else { // Error dialog. CString csAddnMsg = " when executing "; csAddnMsg += csHandlerName; csAddnMsg += " handler"; ExceptionHandler(EHA_DISPLAY_DIALOG, NULL, csAddnMsg); } return FALSE; } retVal = result; return TRUE; }
PY_RES_TYPE PY_NGS_PileupIteratorNext ( void* pRef, int* pRet, void** ppNGSStrError ) { PY_RES_TYPE ret = PY_RES_ERROR; try { bool res = CheckedCast< ngs::PileupItf* >(pRef) -> nextPileup(); assert(pRet != NULL); *pRet = (int)res; ret = PY_RES_OK; } catch ( ngs::ErrorMsg & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( std::exception & x ) { ret = ExceptionHandler ( x, ppNGSStrError ); } catch ( ... ) { ret = ExceptionHandler ( ppNGSStrError ); } return ret; }
unsigned int ThreadWorkerEntryPoint( LPVOID lpvoid ) { CPythonWinThread *pThis = (CPythonWinThread *)lpvoid; CEnterLeavePython _celp; PyObject *result = PyEval_CallObject( pThis->obFunc, pThis->obArgs ); if (result == NULL) { if (PyErr_Occurred() == PyExc_SystemExit) PyErr_Clear(); else { ExceptionHandler(EHA_PRINT_ERROR, _T("Unhandled exception in thread")); } } else Py_DECREF(result); // Cleanup thread state? return 0; }
Controler::Controler(){ in = Input(); com = Computer(); out = Output(); eh = ExceptionHandler(); }
void ModelUnknownManager::SetupUnknowns() { //md MUST me defined using SetData int i, j; Use *use; md->max_unknowns = 0; use = &md->use; // Count mass balance in solution md->max_unknowns += use->sol_p->totals->Count(); // Add 5 for ionic strength, activity of water, charge balance, total H, total O md->max_unknowns += 5; // Count pure phases if (use->ppa_p != NULL) md->max_unknowns += use->ppa_p->pure_phases->Count(); // Count exchange if (md->use.exc_p != NULL) { ExchComp *excc_p; ElementOfSpecies *eos_p; for (i = 0; i < use->exc_p->comps->Count(); i++) { excc_p = (*use->exc_p->comps)[i]; for (j = 0; j < excc_p->totals->Count(); j++) { eos_p = (*excc_p->totals)[j]; if (eos_p->e->master == NULL) //<= maybe this verification isn't necessary { sprintf(message, "Master species missing for element %s", eos_p->e->name.CharPtr()); throw ExceptionHandler(message); } if (eos_p->e->master->type == EX) md->max_unknowns++; } } } // Count surfaces if (use->sur_p != NULL) { if (use->sur_p->type != CD_MUSIC) md->max_unknowns += use->sur_p->comps->Count() + use->sur_p->charge->Count(); else md->max_unknowns += use->sur_p->comps->Count() + (4 * use->sur_p->charge->Count()); } // Count gas components if (use->gas_p != NULL) md->max_unknowns++; // Count solid solutions if (use->ssa_p != NULL) { SS *ss_p; for (i = 0; i < use->ssa_p->ss_list->Count(); i++) { ss_p = (*use->ssa_p->ss_list)[i]; md->max_unknowns += ss_p->comps_list->Count(); } } //One for luck md->max_unknowns++; // "Allocate" space for pointer array and structures unknown_list->Clear(); unknown_list->SetNewCapacity(md->max_unknowns); Unknown *u; for (i = 0; i < md->max_unknowns; i++) { u = unknown_list->AddNew(); //ToDo: Check Unknown Constructor with "unknown_alloc" original function to see if it's all ok u->number = i; } //unknown_list_ptr = unknown_list->Pointer(); }