Editor::Editor() { // addContext(Constants::LangRuby); addContext(Constants::OCaml::EditorId); addContext(Constants::OCaml::LangOCaml); addContext(Constants::M_TOOLS_OCAML); }
/*! \brief Initializes the OpenCL environment. */ CLEnvGL () : CLEnv () { addContext (0, true); addQueueGL (0); addQueueGL (0); addProgram (0, kernel_files); }
GCF::Components::ClipboardComponent::ClipboardComponent() { d = new GCF::Components::ClipboardComponentData; d->clipboardModel = new GCF::Components::ClipboardModel(this); // add a default context addContext(defaultContextName); }
void GCF::Components::ClipboardComponent::creationAnnounced() { GCF::AbstractComponent* comp = 0; QString name; QObject* xmlUtilsObj = findObject("IXmlUtils", name, &comp); if(xmlUtilsObj) { d->xmlUtils = qobject_cast<IXmlUtils*>(xmlUtilsObj); GCF::AbstractComponent::addDependency(comp, this); } if(!d->xmlUtils) return; // Load the previously stored XML if possible QString clipboardFile = QString("%1/Clipboard.xml").arg( GCF::AbstractComponent::guiXmlFileDirectory() ); QFile file(clipboardFile); file.open(QFile::ReadOnly); QDomDocument doc("Clipboard"); bool success = doc.setContent(&file); file.close(); if(!success) return; // Root element QDomElement rootE = doc.documentElement(); // Now read contexts from the Clipboard XML document QList<QDomElement> contextEList = d->xmlUtils->findElements(rootE, "Context"); for(int i=0; i<contextEList.count(); i++) { QDomElement contextE = contextEList[i]; QString ctx = contextE.attribute("Name"); if(ctx == defaultContextName) activateDefaultContext(); else addContext(ctx); // Now add data elements into the context QList<QDomElement> dataEList = d->xmlUtils->findElements(contextE, "Data"); for(int j=0; j<dataEList.count(); j++) { QDomElement dataE = dataEList[j]; QByteArray ba; d->xmlUtils->loadData(dataE, ba); QDataStream ds(&ba, QIODevice::ReadOnly); QVariantList list; GCF::Message::extractVariantList(ds, list); ClipboardData data( QIcon(list[2].value<QPixmap>()), list[0], list[1].toString() ); addData(data); } } }
/** Writes a 'citation' node containing the metadata of one citation. @param sourceId: id of the article wich contains the citation @param referencedId: id of the referenced article/book @param context: context of the citation @param section: section where the citation is within the article */ void CitationsXMLGenerator::addCitation(int sourceId, int referencedId, const string &context, const CSection §ion) { addOpenningTag(aXMLFile, "citation"); addSourceArticleId(sourceId); addReferencedArticleId(referencedId); addContext(context); addSection(section); addClosingTag(aXMLFile, "citation"); }
SmokeGenerator::SmokeGenerator(PositionedElement* sourceElement, int smokeNumber) { _sourceElement = sourceElement; _smokeNumber = smokeNumber; addContext(new BlendingContext(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); for (int i = 0; i < smokeNumber; ++i) { Smoke* smoke = new Smoke(); smoke->setVisible(false); addChild(smoke); } }
/*! \param[in] width width (in pixels) of the associated point clouds. * \param[in] height height (in pixels) of the associated point clouds. * \param[in] numPC maximum number of point clouds that the OpenGL buffers will hold. */ CLEnvGL::CLEnvGL (int width, int height, int numPC) : CLEnv (), width (width), height (height), numPC (numPC) { addContext (0, true); addQueueGL (0); addQueueGL (0); addProgram (0, kernel_files_gf); addProgram (0, kernel_files_rbc); addProgram (0, kernel_files_icp); addProgram (0, kernel_files_slam); }
Task::ReportResult GTest_UHMM3Search::report() { if( stateInfo.hasError() ) { return ReportResult_Finished; } if(searchTaskToCtx != NULL && !searchTaskToCtx->hasError() && !searchTaskToCtx->isCanceled() ) { addContext( searchTaskCtxName, searchTaskToCtx ); ctxAdded = true; } return ReportResult_Finished; }
static void parseFunction (tokenInfo *const token) { tokenInfo *const name = newToken (); vString *const signature = vStringNew (); boolean is_class = FALSE; /* * This deals with these formats * function validFunctionTwo(a,b) {} */ readToken (name); if (!isType (name, TOKEN_IDENTIFIER)) goto cleanUp; /* Add scope in case this is an INNER function */ addToScope(name, token->scope); readToken (token); while (isType (token, TOKEN_PERIOD)) { readToken (token); if ( isKeyword(token, KEYWORD_NONE) ) { addContext (name, token); readToken (token); } } if ( isType (token, TOKEN_OPEN_PAREN) ) skipArgumentList(token, FALSE, signature); if ( isType (token, TOKEN_OPEN_CURLY) ) { is_class = parseBlock (token, name); if ( is_class ) makeClassTag (name, signature); else makeFunctionTag (name, signature); } findCmdTerm (token, FALSE, FALSE); cleanUp: vStringDelete (signature); deleteToken (name); }
Task::ReportResult GTest_CalculateTreeFromAligment::report() { if (task == NULL) { return ReportResult_Finished; } if (!task->hasError()) { PhyTree tree = task->getResult(); U2DbiRef dbiRef = AppContext::getDbiRegistry()->getSessionTmpDbiRef(stateInfo); CHECK_OP(stateInfo, ReportResult_Finished); PhyTreeObject *obj = PhyTreeObject::createInstance(tree, treeObjContextName, dbiRef, stateInfo); CHECK_OP(stateInfo, ReportResult_Finished); addContext(treeObjContextName,obj); } return ReportResult_Finished; }
void Mission::doBlock( missionNode *node, int mode ) { trace( node, mode ); if (mode == SCRIPT_PARSE) scope_stack.push_back( node ); if (mode == SCRIPT_RUN) addContext( node ); vector< easyDomNode* >::const_iterator siter; for (siter = node->subnodes.begin(); siter != node->subnodes.end() && !have_return( mode ); siter++) { missionNode *snode = (missionNode*) *siter; checkStatement( snode, mode ); } if (mode == SCRIPT_RUN) removeContext(); if (mode == SCRIPT_PARSE) scope_stack.pop_back(); }
Task::ReportResult GTest_SecStructPredictTask::report() { if (task!=NULL && task->hasError()) { stateInfo.setError(task->getError()); } else if (!resultsTableContextName.isEmpty()) { QList<SharedAnnotationData> results = task->getResults(); U2OpStatusImpl os; const U2DbiRef dbiRef = AppContext::getDbiRegistry()->getSessionTmpDbiRef(os); SAFE_POINT_OP(os, ReportResult_Finished); aObj = new AnnotationTableObject(resultsTableContextName, dbiRef); aObj->addAnnotations(results); addContext(resultsTableContextName, aObj); contextAdded = true; } return ReportResult_Finished; }
// ---------------------------------------------------------------------------- // TextLanguage::addFunction // // Adds a function arg set to the language. If the function [name] exists, // [args] will be added to it as a new arg set, otherwise a new function will // be added // ---------------------------------------------------------------------------- void TextLanguage::addFunction( string name, string args, string desc, string deprecated, bool replace, string return_type) { // Split out context from name string context; if (name.Contains(".")) { string fname; context = name.BeforeFirst('.', &fname); name = fname; } // Check if the function exists auto func = function(name); // If it doesn't, create it if (!func) { functions_.push_back(TLFunction(name)); func = &functions_.back(); } // Clear the function if we're replacing it else if (replace) { if (!context.empty()) { func->clear(); } else { func->clearContexts(); } } // Add the context func->addContext(context, args, return_type, desc, deprecated); }
Status RollbackImpl::_transitionToRollback(OperationContext* opCtx) { invariant(opCtx); if (_isInShutdown()) { return Status(ErrorCodes::ShutdownInProgress, "rollback shutting down"); } log() << "transition to ROLLBACK"; { Lock::GlobalWrite globalWrite(opCtx); auto status = _replicationCoordinator->setFollowerMode(MemberState::RS_ROLLBACK); if (!status.isOK()) { status.addContext(str::stream() << "Cannot transition from " << _replicationCoordinator->getMemberState().toString() << " to " << MemberState(MemberState::RS_ROLLBACK).toString()); log() << status; return status; } } return Status::OK(); }
// ----------------------------------------------------------------------------- // Adds a function arg set to the language. If the function [name] exists, // [args] will be added to it as a new arg set, otherwise a new function will // be added // ----------------------------------------------------------------------------- void TextLanguage::addFunction( string_view name, string_view args, string_view desc, string_view deprecated, bool replace, string_view return_type) { // Split out context from name string context; string func_name{ name }; if (StrUtil::contains(name, '.')) { context = StrUtil::beforeFirst(name, '.'); func_name = StrUtil::afterFirst(name, '.'); } // Check if the function exists auto func = function(func_name); // If it doesn't, create it if (!func) { functions_.emplace_back(func_name); func = &functions_.back(); } // Clear the function if we're replacing it else if (replace) { if (!context.empty()) func->clear(); else func->clearContexts(); } // Add the context func->addContext(context, args, return_type, desc, deprecated); }
/* * Class: com_ibm_opencard_terminal_pcsc10_OCFPCSC1 * Method: SCardEstablishContext * Signature: (I)I */ JNIEXPORT jint JNICALL Java_com_ibm_opencard_terminal_pcsc10_OCFPCSC1_SCardEstablishContext (JNIEnv *env, jobject obj, jint scope) { CONTEXT_INFO cInfo; long returnCode; // clear ContextInformation clearContextInfo(&cInfo); returnCode = SCardEstablishContext((DWORD)scope, NULL, NULL, &cInfo.context); if (returnCode != SCARD_S_SUCCESS) { throwPcscException(env, obj, "SCardEstablishContext", "PC/SC Error SCardEstablishContext", returnCode); return 0; } /* add this context to the internal table * it's useful in the case the layer above didn't release the context * the Dll_Main is able to release all established contexts */ addContext(cInfo); return (jint)cInfo.context; }
GLC_Context *GLC_ContextManager::createContext(QOpenGLContext *pFromContext, QSurface *pSurface) { GLC_Context* pContext= new GLC_Context(pFromContext, pSurface); addContext(pContext); QOpenGLContextGroup* pSharedGroup= pFromContext->shareGroup(); QList<QOpenGLContext*> sharedContextList= pSharedGroup->shares(); const int count= sharedContextList.count(); for (int i= 0; i < count; ++i) { QOpenGLContext* pOpenGLSharedContext= sharedContextList.at(i); if (pOpenGLSharedContext != pFromContext) { if (m_OpenGLContextToGLCContext.contains(pOpenGLSharedContext)) { GLC_Context* pSharedContext= m_OpenGLContextToGLCContext.value(pOpenGLSharedContext); pContext->shareWith(pSharedContext); break; } } } return pContext; }
// ---------------------------------------------------------------------------- // TextLanguage::loadZScript // // Loads types (classes) and functions from parsed ZScript definitions [defs] // ---------------------------------------------------------------------------- void TextLanguage::loadZScript(ZScript::Definitions& defs, bool custom) { // Classes for (auto& c : defs.classes()) { // Add class as type addWord(Type, c.name(), custom); // Add class functions for (auto& f : c.functions()) { // Ignore overriding functions if (f.isOverride()) continue; // Check if the function exists auto func = function(f.name()); // If it doesn't, create it if (!func) { functions_.push_back(TLFunction(f.name())); func = &functions_.back(); } // Add the context if (!func->hasContext(c.name())) func->addContext( c.name(), f, custom, zfuncs_ex_props_[func->name()].description, zfuncs_ex_props_[func->name()].deprecated_f); } } }
CppEditor::CppEditor() { addContext(ProjectExplorer::Constants::CXX_LANGUAGE_ID); }
/************************************************ Function: extractRequestResourceToAOS Parameters: const xacml_request_t request Description: This function extracts the Action information details from the request and puts that into the EEF AOS Return: 0 : good !0 : bad ************************************************/ int extractRequestResourceToAOS (const xacml_request_t request) { int rc; size_t i; size_t j; size_t count; const char * attribute_id; const char * data_type; const char * issuer; const char * value; xacml_resource_attribute_t resource_attribute = NULL; size_t resource_attr_count = 0; /*const char * logstr = "extractRequestResourceToAOS";*/ aos_context_t* aos_context = NULL; aos_attribute_t* aos_attribute = NULL; rc = xacml_request_get_resource_attribute_count(request, &resource_attr_count); for (i = 0 ; i < resource_attr_count; i++) { rc = xacml_request_get_resource_attribute( request, i, &resource_attribute); if (resource_attribute) { rc = xacml_resource_attribute_get_count( resource_attribute, &count); if((aos_context = createContext (RESOURCE)) == NULL){ return 1; } /* aos_context should be set now */ for (j = 0; j < count; j++) { attribute_id = NULL; data_type = NULL; issuer = NULL; value = NULL; rc = xacml_resource_attribute_get_attribute( resource_attribute, j, &attribute_id, &data_type, &issuer, &value); /* EEF AOS magic */ /*fprintf (stderr, "aos_set_string (\"%s\", \"%s\")\n", attribute_id, (char *) value);*/ /* aos_set_string (attribute_id, (char *) value); */ if (aos_context){ if((aos_attribute = createAttribute())){ setAttributeId (aos_attribute, attribute_id); setAttributeIssuer(aos_attribute, issuer); setAttributeType (aos_attribute, data_type); setAttributeValue (aos_attribute, value, strlen(value) + 1); addAttribute(aos_context, aos_attribute); aos_attribute = NULL; } } } if(aos_context){ addContext (aos_context); aos_context = NULL; } } } return 0; }
varInst* Mission::doScript( missionNode *node, int mode, varInstMap *varmap ) { trace( node, mode ); if (mode == SCRIPT_PARSE) { current_script = node; if (parsemode == PARSE_DECL) { node->script.name = node->attr_value( "name" ); if ( node->script.name.empty() ) fatalError( node, mode, "you have to give a script name" ); current_module->script.scripts[node->script.name] = node; debug( 5, node, mode, "added to module "+current_module->script.name+" : script ="+node->script.name ); node->script.nr_arguments = 0; string retvalue = node->attr_value( "type" ); if (retvalue.empty() || retvalue == "void") node->script.vartype = VAR_VOID; else node->script.vartype = vartypeFromString( retvalue ); } scope_stack.push_back( node ); } debug( 5, node, mode, "executing script name="+node->script.name ); if (mode == SCRIPT_RUN) { addContextStack( node ); addContext( node ); } vector< easyDomNode* >::const_iterator siter; if (mode == SCRIPT_PARSE && parsemode == PARSE_DECL) { node->script.nr_arguments = 0; node->script.argument_node = NULL; } for (siter = node->subnodes.begin(); siter != node->subnodes.end() && !have_return( mode ); siter++) { missionNode *snode = (missionNode*) *siter; if (snode->tag == DTAG_ARGUMENTS) { doArguments( snode, mode, varmap ); if (mode == SCRIPT_PARSE && parsemode == PARSE_DECL) node->script.argument_node = snode; char buffer[200]; sprintf( buffer, "nr of arguments=%d", node->script.nr_arguments ); debug( 3, node, mode, buffer ); } else { if (mode == SCRIPT_PARSE && parsemode == PARSE_DECL) { //do nothing, break here } else { checkStatement( snode, mode ); } } } if (mode == SCRIPT_RUN) { removeContext(); contextStack *cstack = runtime.cur_thread->exec_stack.back(); varInst *vi = cstack->return_value; if (vi != NULL) { if (node->script.vartype != vi->type) { fatalError( node, mode, "doScript: return type not set correctly" ); assert( 0 ); } } else if (node->script.vartype != VAR_VOID) { fatalError( node, mode, "no return set from doScript" ); assert( 0 ); } varInst *viret = NULL; if (vi) { viret = newVarInst( VI_TEMP ); viret->type = vi->type; assignVariable( viret, vi ); } removeContextStack(); return viret; } else { scope_stack.pop_back(); return NULL; } }
Task::ReportResult GTest_uHMMERSearch::report() { if (!resultDocContextName.isEmpty()) { addContext(resultDocContextName, aDoc); } return ReportResult_Finished; }
/************************************************ Function: extractRequestSubjectToAOS Parameters: const xacml_request_t request Description: This function extracts the Subject information details from the request and puts that into the EEF AOS. Return: 0 : good !0 : bad ************************************************/ int extractRequestSubjectToAOS (const xacml_request_t request) { /*char * logstr = "extractRequestSubjectToAOS()";*/ size_t count = 0; size_t i = 0; const char *category; const char *attribute_id; const char *data_type; const char *issuer; const char *value; aos_context_t* aos_context = NULL; aos_attribute_t* aos_attribute = NULL; xacml_request_get_subject_attribute_count(request, &count); if (count > 0) { rewindContexts(); if((aos_context = getNextContext(SUBJECT, NULL)) == NULL){ if((aos_context = createContext (SUBJECT)) == NULL){ return 1; } } /* aos_context should be set now */ } for (i = 0; i < count; i++) { category = NULL; attribute_id = NULL; data_type = NULL; issuer = NULL; value = NULL; xacml_request_get_subject_attribute( request, i, &category, &attribute_id, &data_type, &issuer, &value); /* EEF AOS magic */ /*fprintf (stderr, "aos_set_string (\"%s\", \"%s\")\n", attribute_id, (const char *) value);*/ /* if (strcmp ("http://authz-interop.org/xacml/subject/voms-fqan", attribute_id) == 0) */ /* { */ /* fprintf (stderr, "Skipping voms-fqan\n"); */ /* continue; */ /* } */ /* aos_set_string (attribute_id, (char *) value); */ if (aos_context){ if((aos_attribute = createAttribute())){ setAttributeId (aos_attribute, attribute_id); setAttributeIssuer(aos_attribute, issuer); setAttributeType (aos_attribute, data_type); setAttributeValue (aos_attribute, value, strlen(value) + 1); addAttribute(aos_context, aos_attribute); } } } if(aos_context){ addContext (aos_context); } return 0; }
/************************************************ Function: extractRequestActionToAOS Parameters: const xacml_request_t request Description: This function extracts the Action information details from the request and puts that into the EEF AOS. Return: 0 : good !0 : bad ************************************************/ int extractRequestActionToAOS (const xacml_request_t request) { int rc; size_t i; size_t count; const char * attribute_id; const char * data_type; const char * issuer; const char * value; /*char * logstr = "extractRequestActionToAOS";*/ aos_context_t* aos_context = NULL; aos_attribute_t* aos_attribute = NULL; rc = xacml_request_get_action_attribute_count(request, &count); if (count > 0) { rewindContexts(); if((aos_context = getNextContext(ACTION, NULL)) == NULL){ if((aos_context = createContext (ACTION)) == NULL){ return 1; } } /* aos_context should be set now */ } for (i = 0 ; i < count; i++) { attribute_id = NULL; data_type = NULL; issuer = NULL; value = NULL; rc = xacml_request_get_action_attribute( request, i, &attribute_id, &data_type, &issuer, &value); /* EEF AOS magic */ /*fprintf (stderr, "aos_set_string (\"%s\", \"%s\")\n", attribute_id, (char *) value);*/ /* aos_set_string (attribute_id, (char *) value); */ if (aos_context){ if((aos_attribute = createAttribute())){ setAttributeId (aos_attribute, attribute_id); setAttributeIssuer(aos_attribute, issuer); setAttributeType (aos_attribute, data_type); setAttributeValue (aos_attribute, value, strlen(value) + 1); addAttribute(aos_context, aos_attribute); } } } if(aos_context){ addContext (aos_context); } return 0; }