CATCH_NEXTROW() { ActivityTimer t(totalCycles, timeActivities, NULL); if(abortSoon || eof || eogNext) { eogNext = false; return NULL; } if (refill) { refill=false; index=0; try { group.reset(false); loop { OwnedConstThorRow row = input->nextRow(); if (!row) break; group.append(row.getClear()); if (group.isFull()) { StringBuffer errStr("GROUPSORT"); errStr.append("(").append(container.queryId()).append(") "); errStr.append("exceeded available memory. records=").append(group.ordinality()).append(", memory usage=").append((unsigned)(group.totalSize()/1024)).append('k'); IException *e = MakeActivityException(this, TE_TooMuchData, "%s", errStr.str()); EXCLOG(e, NULL); throw e; } } if (group.ordinality()==0) { eof = true; return NULL; } group.sort(*icompare,!unstable); } catch (IOutOfMemException *e) { StringBuffer errStr("GROUPSORT"); errStr.append("(").append(container.queryId()).append(") "); errStr.append("exceeded available memory. records=").append(group.ordinality()).append(", memory usage=").append((unsigned)(group.totalSize()/1024)).append('k'); errStr.append(": ").append(e->errorCode()).append(", "); e->errorMessage(errStr); e->Release(); IException *e2 = MakeActivityException(this, TE_TooMuchData, "%s", errStr.str()); EXCLOG(e2, NULL); throw e2; } } if(index >= group.ordinality()) { refill = true; return NULL; // eog } const void *row = group.itemClear(index++); assertex(row); dataLinkIncrement(); return row; }
jsval shareInfo_to_jsval(JSContext* cx, const sdkbox::PluginShare::ShareResponse& response) { JS::RootedObject proto(cx); JS::RootedObject parent(cx); #if defined(MOZJS_MAJOR_VERSION) and MOZJS_MAJOR_VERSION >= 26 JS::RootedObject jsRet(cx, JS_NewObject(cx, NULL, proto, parent)); #else JSObject *jsRet = JS_NewObject(cx, NULL, NULL, NULL); #endif #if defined(MOZJS_MAJOR_VERSION) and MOZJS_MAJOR_VERSION >= 26 JS::RootedValue state(cx); #else jsval state; #endif state = int32_to_jsval(cx, response.state); #if defined(MOZJS_MAJOR_VERSION) and MOZJS_MAJOR_VERSION >= 26 JS_SetProperty(cx, jsRet, "state", state); #else JS_SetProperty(cx, jsRet, "state", &state); #endif #if defined(MOZJS_MAJOR_VERSION) and MOZJS_MAJOR_VERSION >= 26 JS::RootedValue errStr(cx); #else jsval errStr; #endif errStr = std_string_to_jsval(cx, response.error); #if defined(MOZJS_MAJOR_VERSION) and MOZJS_MAJOR_VERSION >= 26 JS_SetProperty(cx, jsRet, "error", errStr); #else JS_SetProperty(cx, jsRet, "error", &errStr); #endif return OBJECT_TO_JSVAL(jsRet); }
/************************************************************************* Call operator *************************************************************************/ bool LuaFunctor::operator()(const EventArgs& args) const { // named error handler needs binding? if ((d_errFuncIndex == LUA_NOREF) && !d_errFuncName.empty()) { pushNamedFunction(L, d_errFuncName); d_errFuncIndex = luaL_ref(L, LUA_REGISTRYINDEX); d_ourErrFuncIndex = true; } // is this a late binding? if (needs_lookup) { pushNamedFunction(L, function_name); // reference function index = luaL_ref(L, LUA_REGISTRYINDEX); needs_lookup = false; CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed"); function_name.clear(); } // put error handler on stack if we're using such a thing int err_idx = 0; if (d_errFuncIndex != LUA_NOREF) { lua_rawgeti(L, LUA_REGISTRYINDEX, d_errFuncIndex); err_idx = lua_gettop(L); } // retrieve function lua_rawgeti(L, LUA_REGISTRYINDEX, index); // possibly self as well? int nargs = 1; if (self != LUA_NOREF) { lua_rawgeti(L, LUA_REGISTRYINDEX, self); ++nargs; } // push EventArgs parameter tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs"); // call it int error = lua_pcall(L, nargs, 1, err_idx); // handle errors if (error) { String errStr(lua_tostring(L, -1)); lua_pop(L, 1); CEGUI_THROW(ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n")); } // retrieve result bool ret = lua_isboolean(L, -1) ? lua_toboolean(L, -1 ) : true; lua_pop(L, 1); return ret; }
/** * Set property from python version */ int EDCALL GenIntProperty::pySet( PyObject * value, bool transient /* = false */ ) { uint32 ib; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = -1; if (pInt_->bits() < 0) { int32 i = 0; ret = Script::setData( value, i, errStr.c_str() ); ib = (uint32)i; } else { uint32 i = 0; ret = Script::setData( value, i, errStr.c_str() ); ib = i; } if (ret == 0) { pInt_->set( ib, transient ); } return ret; }
//----------------------------------------------------------------------------// bool LuaScriptModule::executeScriptedEventHandler_impl( const String& handler_name, const EventArgs& e, const int err_idx, const int top) { LuaFunctor::pushNamedFunction(d_state, handler_name); // push EventArgs as the first parameter tolua_pushusertype(d_state, (void*)&e, "const CEGUI::EventArgs"); // call it int error = lua_pcall(d_state, 1, 1, err_idx); // handle errors if (error) { String errStr(lua_tostring(d_state,-1)); lua_settop(d_state,top); CEGUI_THROW(ScriptException("Unable to evaluate the Lua event " "handler: '" + handler_name + "'\n\n" + errStr + "\n")); } // retrieve result bool ret = lua_isboolean(d_state, -1) ? lua_toboolean(d_state, -1 ) : true; lua_settop(d_state,top); return ret; }
std::string CXMLConfiguration::errorStr() { std::string errStr(mXMLDocument.ErrorDesc()); char errStr2[100]; sprintf(errStr2, " at row %d, col %d", mXMLDocument.ErrorRow(), mXMLDocument.ErrorCol()); return errStr + errStr2; }
//////////////////////////// // GET FIRMWARE HDR std::string CameraIo::GetFirmwareHdr() { if( CamModel::USB != m_type ) { std::string errStr("error GetFirmwareHdr not supported via ethernet"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidOperation ); } Eeprom::Header hdr; std::tr1::dynamic_pointer_cast<CamUsbIo>( m_Interface)->ReadHeader( hdr ); std::stringstream strm; strm << "BufCon Size = " << hdr.BufConSize << "\n"; strm << "CamCon Size = " << hdr.CamConSize << "\n"; strm << "CheckSum = " << static_cast<int32_t>(hdr.CheckSum) << "\n"; strm << "DeviceId = " << hdr.DeviceId << "\n"; strm << "Fields = " << hdr.Fields << "\n"; strm << "ProductId = " << hdr.ProductId << "\n"; strm << "Serial Number Index = " << static_cast<int32_t>(hdr.SerialNumIndex) << "\n"; strm << "Size =" << static_cast<int32_t>(hdr.Size) << "\n"; strm << "VendorId = " << hdr.VendorId << "\n"; strm << "Version = " << static_cast<int32_t>(hdr.Version) << std::endl; return strm.str(); }
void OutputParser::parseNvidiaLine(const std::string& output, OutputItem& item) { std::size_t pos; std::string detail; std::string wrnStr("warning"); std::string errStr("error"); if ((pos = output.find(':')) == std::string::npos) return; parseNvidiaLocation(output.substr(0, pos), item); detail = output.substr(pos + 2); if (detail.find(errStr) == 0) { detail = detail.substr(errStr.size() + 1); item.type = OutputItem::ErrorItem; item.isDeferencable = true; } else if (detail.find(wrnStr) == 0) { detail = detail.substr(wrnStr.size() + 1); item.type = OutputItem::WarningItem; item.isDeferencable = true; } if ((pos = detail.find(':')) != std::string::npos) { item.errNo = detail.substr(0, pos).c_str(); detail = detail.substr(pos + 2); } buildShortenedString(detail, item); }
void HttpRequest::onReplyFinished() { qDebug() << "HttpRequest::onReplyFinished()"; TwtImageScaler::removeTemporaryFile(); if(mRequestTimeoutTimer->isActive()) { mRequestTimeoutTimer->stop(); } mRequestTimeoutTimer->setInterval(KRequestTimeOut); disconnect(mReply, SIGNAL(finished()), this, SLOT(onReplyFinished())); QByteArray tempData = mReply->readAll(); QNetworkReply::NetworkError replyError = mReply->error(); if(QNetworkReply::NoError == replyError) { mReply->deleteLater(); mReply = NULL; emit loadingFinished(tempData); } else { qDebug() << "HttpRequest::err: " << mReply->errorString(); QString errStr("Twitter API returned "); errStr += QString::number(mReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt()); errStr += " "; errStr += mReply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toByteArray(); mReply->deleteLater(); mReply = NULL; emit loadingError(errStr); } }
/** * Set property from python version */ int EDCALL GenPositionProperty::pySet( PyObject * value, bool transient /* = false */ ) { Vector3 v; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, v, errStr.c_str() ); if (ret == 0) { pMatrix_->recordState(); Matrix invCtx; pMatrix_->getMatrixContextInverse( invCtx ); Matrix curPose; pMatrix_->getMatrix( curPose, transient ); curPose.translation( invCtx.applyPoint( v ) ); pMatrix_->setMatrix( curPose ); pMatrix_->commitState(); // could set python exception if op failed. either change // commitState to return a bool (easiest) or get matrix // again and compare to what we set. } return ret; }
//////////////////////////// // CTOR AltaIo::AltaIo( CamModel::InterfaceType type, const std::string & deviceAddr ) : CameraIo( type ), m_fileName( __FILE__ ) { //log that we are trying to connect std::string msg = "Try to connection to device " + deviceAddr; ApgLogger::Instance().Write(ApgLogger::LEVEL_RELEASE,"info", apgHelper::mkMsg ( m_fileName, msg, __LINE__) ); //create the camera interface switch( m_type ) { case CamModel::ETHERNET: m_Interface = std::tr1::shared_ptr<ICamIo>( new AltaEthernetIo( deviceAddr ) ); break; case CamModel::USB: m_Interface = std::tr1::shared_ptr<ICamIo>( new AltaUsbIo( deviceAddr ) ); break; default: { std::string errStr("Undefined camera interface type"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidUsage ); } break; } }
void QgsEditorWidgetWrapper::updateConstraint( const QgsFeature &ft ) { bool toEmit( false ); QString errStr( tr( "predicate is True" ) ); QString expression = layer()->editFormConfig().constraintExpression( mFieldIdx ); QString description; QVariant value = ft.attribute( mFieldIdx ); if ( ! expression.isEmpty() ) { description = layer()->editFormConfig().constraintDescription( mFieldIdx ); QgsExpressionContext context = layer()->createExpressionContext(); context.setFeature( ft ); QgsExpression expr( expression ); mValidConstraint = expr.evaluate( &context ).toBool(); if ( expr.hasParserError() ) errStr = expr.parserErrorString(); else if ( expr.hasEvalError() ) errStr = expr.evalErrorString(); else if ( ! mValidConstraint ) errStr = tr( "predicate is False" ); toEmit = true; } else mValidConstraint = true; if ( layer()->editFormConfig().notNull( mFieldIdx ) ) { if ( !expression.isEmpty() ) { QString fieldName = ft.fields().field( mFieldIdx ).name(); expression = "( " + expression + " ) AND ( " + fieldName + " IS NOT NULL)"; description = "( " + description + " ) AND NotNull"; } else { description = QStringLiteral( "NotNull" ); expression = QStringLiteral( "NotNull" ); } mValidConstraint = mValidConstraint && !value.isNull(); if ( value.isNull() ) errStr = tr( "predicate is False" ); toEmit = true; } if ( toEmit ) { updateConstraintWidgetStatus( mValidConstraint ); emit constraintStatusChanged( expression, description, errStr, mValidConstraint ); } }
void EiC_float_err(int i) { signal(SIGFPE, EiC_float_err); errStr("EiC maths exception"); if(jmpOn && jmpOn++ <= 1) longjmp(env,Err_); else eic_disaster(); }
void EiC_ill_oper(int i) { signal(SIGILL, EiC_ill_oper); errStr("EiC illegal operation attempted\n"); if(jmpOn && jmpOn++ <= 1) longjmp(env,Err_); else eic_disaster(); }
void EiC_term_int(int i) { signal(SIGINT, EiC_term_int); errStr("EiC interrupted"); if(jmpOn && jmpOn++ <= 1) longjmp(env,Err_); else eic_disaster(); }
void EiC_stor_access(int i) { signal(SIGSEGV, EiC_stor_access); errStr("EiC illegal storage access"); if(jmpOn && jmpOn++ <= 1) { longjmp(env,Err_); } else eic_disaster(); }
//-------------------------------------------------------------------------------------- // Create any D3D10 resources that aren't dependant on the back buffer //-------------------------------------------------------------------------------------- HRESULT CALLBACK OnD3D10CreateDevice(ID3D10Device* pd3dDevice, const DXGI_SURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext) { HRESULT hr; g_device = pd3dDevice; V_RETURN(g_DialogResourceManager.OnD3D10CreateDevice(pd3dDevice)); V_RETURN(g_D3DSettingsDlg.OnD3D10CreateDevice(pd3dDevice)); V_RETURN(D3DX10CreateFont(pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &g_pFont10)); V_RETURN(D3DX10CreateSprite(pd3dDevice, 512, &g_pSprite10)); g_pTxtHelper = new CDXUTTextHelper(NULL, NULL, g_pFont10, g_pSprite10, 15); V_RETURN(CDXUTDirectionWidget::StaticOnD3D10CreateDevice(pd3dDevice)); // Read the D3DX effect file WCHAR str[MAX_PATH]; ID3D10Blob* pErrBlob = NULL; V_RETURN(DXUTFindDXSDKMediaFileCch(str, MAX_PATH, L"Effect_Undistort.fx")); hr = D3DX10CreateEffectFromFile(str, NULL, NULL, "fx_4_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, pd3dDevice, NULL, NULL, &g_pEffect10, &pErrBlob, NULL); if (FAILED(hr)) { std::string errStr((LPCSTR)pErrBlob->GetBufferPointer(), pErrBlob->GetBufferSize()); WCHAR err[256]; MultiByteToWideChar(CP_ACP, 0, errStr.c_str(), (int)errStr.size(), err, errStr.size()); MessageBox(NULL, (LPCWSTR)err, L"Error", MB_OK); return hr; } // Setup the vector image and the display UINT width = (DXUTIsAppRenderingWithD3D9()) ? DXUTGetD3D9BackBufferSurfaceDesc()->Width : DXUTGetDXGIBackBufferSurfaceDesc()->Width; UINT height = (DXUTIsAppRenderingWithD3D9()) ? DXUTGetD3D9BackBufferSurfaceDesc()->Height : DXUTGetDXGIBackBufferSurfaceDesc()->Height; g_vsObj = new VSObject(pd3dDevice); D3D10_RASTERIZER_DESC rasterizerState; rasterizerState.FillMode = D3D10_FILL_SOLID; rasterizerState.CullMode = D3D10_CULL_NONE; rasterizerState.FrontCounterClockwise = true; rasterizerState.DepthBias = false; rasterizerState.DepthBiasClamp = 0; rasterizerState.SlopeScaledDepthBias = 0; rasterizerState.DepthClipEnable = true; rasterizerState.ScissorEnable = false; rasterizerState.MultisampleEnable = false; rasterizerState.AntialiasedLineEnable = false; pd3dDevice->CreateRasterizerState(&rasterizerState, &g_pRasterState); return S_OK; }
//////////////////////////// // WRITE FX2 REG void CameraIo::WriteFx2Reg( uint16_t reg, uint8_t val ) { if( CamModel::USB != m_type ) { std::string errStr("error WriteFx2Reg not supported via ethernet"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidOperation ); } std::tr1::dynamic_pointer_cast<CamUsbIo>(m_Interface)->WriteFx2Reg( reg, val ); }
/** * Set property from python version */ int EDCALL GenBoolProperty::pySet( PyObject * value, bool transient /* = false */ ) { bool b; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, b, errStr.c_str() ); if (ret == 0) { pBool_->set( b, transient ); } return ret; }
/** * Python set method */ int EDCALL ListTextProperty::pySet( PyObject * value, bool transient /* = false */ ) { std::string s; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, s, errStr.c_str() ); if (ret == 0) { text_->set( s, transient ); } return ret; }
/** * Set property from python version */ int EDCALL Vector2Property::pySet( PyObject * value, bool transient /* = false */ ) { Vector2 v; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, v, errStr.c_str() ); if (ret == 0) { pVector2_->set( v, transient ); } return ret; }
/** * Set property from python version */ int EDCALL GenMatrixProperty::pySet( PyObject * value, bool transient /* = false */ ) { Matrix m; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, m, errStr.c_str() ); if (ret == 0) { pMatrix_->setMatrix(m); } return ret; }
/** * Set property from python version */ int EDCALL GenFloatProperty::pySet( PyObject * value, bool transient /* = false */ ) { float f; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, f, errStr.c_str() ); if (ret == 0) { pFloat_->set( f, transient ); } return ret; }
//////////////////////////// // READ BUFCON REG uint8_t CameraIo::ReadBufConReg( uint16_t reg ) const { if( CamModel::USB != m_type ) { std::string errStr("error ReadBufConReg not supported via ethernet"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidOperation ); } return std::tr1::dynamic_pointer_cast<CamUsbIo>( m_Interface)->ReadBufConReg( reg ) ; }
//////////////////////////// // SET SERIAL NUMBER void CameraIo::SetSerialNumber( const std::string & num ) { if( CamModel::USB != m_type ) { std::string errStr("error SetSerialNumber not supported via ethernet"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidOperation ); } std::tr1::dynamic_pointer_cast<CamUsbIo>( m_Interface)->SetSerialNumber( num ); }
/** * Set property from python version */ int EDCALL GenScaleProperty::pySet( PyObject * value, bool transient /* = false */ ) { Vector3 v; std::string errStr( "GeneralEditor." ); errStr += name_; int ret = Script::setData( value, v, errStr.c_str() ); if (ret == 0) { if ( ::almostZero(v.x) || ::almostZero(v.y) || ::almostZero(v.z) ) { PyErr_SetString( PyExc_TypeError, "GenScaleProperty::pySet() " "one of the scale factors was zero." ); return 1; } Matrix curPose; pMatrix_->getMatrix( curPose, transient ); Vector3 currScale; currScale.x = curPose.applyToUnitAxisVector(0).length(); currScale.y = curPose.applyToUnitAxisVector(1).length(); currScale.z = curPose.applyToUnitAxisVector(2).length(); if ( ::almostZero(currScale.x) || ::almostZero(currScale.y) || ::almostZero(currScale.z) ) { PyErr_SetString( PyExc_TypeError, "GenScaleProperty::pySet() " "the scale factor of one axis of the existing pose was zero."); return 1; } pMatrix_->recordState(); Matrix mScale; mScale.setScale( v.x / currScale.x, v.y / currScale.y, v.z / currScale.z ); curPose.preMultiply( mScale ); pMatrix_->setMatrix( curPose ); pMatrix_->commitState(); // could set python exception if op failed. either change // commitState to return a bool (easiest) or get matrix // again and compare to what we set. } return ret; }
//////////////////////////// // GET USB FIRMWARE VERSION std::string CameraIo::GetUsbFirmwareVersion() { if( CamModel::USB != m_type ) { std::string errStr("error cannot get Usb firwmare version via ethernet"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidOperation ); } return std::tr1::dynamic_pointer_cast<CamUsbIo>( m_Interface)->GetUsbFirmwareVersion(); }
//////////////////////////// // GET USB VENDOR INFO void CameraIo::GetUsbVendorInfo( uint16_t & VendorId, uint16_t & ProductId, uint16_t & DeviceId) { if( CamModel::USB != m_type ) { std::string errStr("error cannot get Usb vendor info via ethernet"); apgHelper::throwRuntimeException( m_fileName, errStr, __LINE__, Apg::ErrorType_InvalidOperation ); } std::tr1::dynamic_pointer_cast<CamUsbIo>( m_Interface)->GetUsbVendorInfo( VendorId, ProductId, DeviceId ); }
void EiC_bus_err(int i) { #if defined(WIN32) || defined(_DJGPP) signal(SIGABRT,EiC_bus_err); #else signal(SIGBUS, EiC_bus_err); #endif errStr("EiC bus error trapped"); if(jmpOn && jmpOn++ <= 1) longjmp(env,Err_); else eic_disaster(); }
void EiC_term_int(int i) { #if !defined(__SYMBIAN32__) && !defined(_WIN32_WCE) //maks signal(SIGINT, EiC_term_int); #endif #ifndef STAND_ALONE_GAME errStr("EiC interrupted"); #endif if(jmpOn && jmpOn++ <= 1) longjmp(env,Err_); else eic_disaster(); }