Exemple #1
0
//--------------------------------------------------
ofLogLevel ofGetLogLevel(string module){
	if (getModules().find(module) == getModules().end()) {
		return currentLogLevel;
	} else {
		return getModules()[module];
	}
}
Exemple #2
0
bool ofLog::checkLog(ofLogLevel level, const string & module){
	if(getModules().find(module)==getModules().end()){
		if(level >= currentLogLevel) return true;
	}else{
		if(level >= getModules()[module]) return true;
	}
	return false;
}
std::shared_ptr<ModulePackage> ExpressionParser::load(const QString &filePath)
{
    auto tmp_module(std::make_shared<ModulePackage>(std::unique_ptr<QFile>(new QFile(filePath))));
    modulePkgs.append(tmp_module);
    modules += tmp_module->getModules();
    return tmp_module;
}
Exemple #4
0
/*
 * BPatch_image::findType
 *
 * Returns a BPatch_type* representing the named type.  If no such type
 * exists, returns NULL.
 *
 * name		The name of type to look up.
 */
BPatch_type *BPatch_image::findTypeInt(const char *name)
{
    BPatch_type *type;

    assert(BPatch::bpatch != NULL);

    // XXX - should this stuff really be by image ??? jkh 3/19/99
    BPatch_Vector<BPatch_module *> *mods = getModules();
    for (int m = mods->size() -1; m >= 0; m--) {
        BPatch_module *module = (*mods)[m];
        type = module->getModuleTypes()->findType(name);
        if (type) {
            return type;
        }
    }

    // check the default base types
    type = BPatch::bpatch->stdTypes->findType(name);
    if (type)  {
        return type;
    }

    // check the API types of last resort
    type = BPatch::bpatch->APITypes->findType(name);
    return type;

}
void Interface::setup()
{
	QString name;
	QStringList l = getModules();
	switch (l.size()) {
	case 0:
		break;
	case 1:
		name = l[0];
		break;
	default:
		name = Config::getValue("/Interface/Type", l[0]);
		name = l.contains(name) ? name : l[0];
		break;
	}
#ifdef INTERFACE_WIDGET
	if (name == "Widget") {
		d_ptr = new WidgetInterfacePrivate();
		return;
	}
#endif
#ifdef INTERFACE_QUICK2
	if (name == "Quick2") {
		d_ptr = new Quick2InterfacePrivate();
		return;
	}
#endif
}
Exemple #6
0
/*
 * BPatch_image::getProcedures
 *
 * Returns a list of all procedures in the image upon success, and NULL
 * upon failure.
 */
BPatch_Vector<BPatch_variableExpr *> *BPatch_image::getGlobalVariablesInt()
{
    BPatch_variableExpr *var;
    BPatch_Vector<BPatch_variableExpr *> *varlist =
        new BPatch_Vector<BPatch_variableExpr *>;

    if (varlist == NULL) return NULL;

    // XXX - should this stuff really be by image ??? jkh 3/19/99
    BPatch_Vector<BPatch_module *> *mods = getModules();
    //BPatch_type *type;
    for (unsigned int m = 0; m < mods->size(); m++) {
        BPatch_module *module = (*mods)[m];
        char name[255];
        module->getName(name, sizeof(name));
        pdvector<pdstring> keys = module->getModuleTypes()->globalVarsByName.keys();
        int limit = keys.size();
        for (int j = 0; j < limit; j++) {
            pdstring name = keys[j];
            var = createVarExprByName(module, name.c_str());
            if (var != NULL)
                varlist->push_back(var);
        }
    }


    return varlist;
}
Exemple #7
0
std::string gdbmiModules(CIDebugSymbols *syms, bool humanReadable, std::string *errorMessage)
{
    const Modules modules = getModules(syms, errorMessage);
    if (modules.empty())
        return std::string();

    std::ostringstream str;
    str << '[' << std::hex << std::showbase;
    const Modules::size_type size = modules.size();
    for (Modules::size_type m = 0; m < size; ++m) {
        const Module &module = modules.at(m);
        if (m)
            str << ',';
        str << "{name=\"" << module.name
            << "\",image=\"" << gdbmiStringFormat(module.image)
            << "\",start=\"" << module.base << "\",end=\""
            << (module.base + module.size - 1) << '"';
        if (module.deferred)
            str << "{deferred=\"true\"";
        str << '}';
        if (humanReadable)
            str << '\n';
    }
    str << ']';
    return str.str();
}
void RemoteXmlEclRepository::checkCacheValid()
{
    ConcreteEclRepository::checkCacheValid();

    DBGLOG("check cache");
    Owned<IPropertyTree> repository = getModules(cachestamp);
    if(!repository)
    {
        DBGLOG("getModules returned null");
        //process error
        return;
    }

    Owned<IPropertyTreeIterator> it = repository->getElements("./Module");
    bool somethingChanged = false;
    for (it->first(); it->isValid(); it->next())
    {
        IPropertyTree & cur = it->query();
        Owned<IHqlRemoteScope> rScope = createModule(&cur);
        timestamp_t timestamp = (timestamp_t)cur.getPropInt64("@timestamp"); 
        if (timestamp > cachestamp)
            cachestamp = timestamp;
        somethingChanged = true;
    }

    if(somethingChanged)
        rootScope->invalidateParsed();
}
Exemple #9
0
void m_dccchat::dccListen(std::string id, Socket* listenSocket) {
	std::tr1::unordered_map<std::string, std::vector<std::string> >::iterator ourReportingModules = reportingModules.find(id);
	while (true) {
		if (!listenSocket->isConnected())
			break;
		std::string receivedMsg = listenSocket->receive();
		std::cout << "DCC " << id << ":" << receivedMsg << std::endl;
		std::tr1::unordered_map<std::string, Module*> modules = getModules(); // get a new one each time in case it is updated
		for (std::tr1::unordered_map<std::string, std::string>::iterator hookIter = moduleTriggers.begin(); hookIter != moduleTriggers.end(); ++hookIter) {
			if (hookIter->first == receivedMsg.substr(0, receivedMsg.find_first_of(' '))) {
				bool alreadyReporting = false;
				for (unsigned int i = 0; i < ourReportingModules->second.size(); i++) {
					if (ourReportingModules->second[i] == hookIter->second) {
						alreadyReporting = true;
						break;
					}
				}
				if (!alreadyReporting)
					ourReportingModules->second.push_back(hookIter->second);
			}
		}
		for (unsigned int i = 0; i < ourReportingModules->second.size(); i++) {
			std::tr1::unordered_map<std::string, Module*>::iterator modIter = modules.find(ourReportingModules->second[i]);
			if (modIter == modules.end())
				ourReportingModules->second.erase(ourReportingModules->second.begin()+i);
			else {
				std::vector<std::string> modSupports = modIter->second->supports();
				for (unsigned int i = 0; i < modSupports.size(); i++) {
					if (modSupports[i] == "DCC_CHAT") {
						dccChat* dccMod = (dccChat*)modIter->second;
						dccMod->onDCCReceive(id, receivedMsg);
						break;
					}
				}
			}
		}
	}
	std::tr1::unordered_map<std::string, Module*> modules = getModules();
	for (unsigned int i = 0; i < reportingModules.size(); i++) {
		std::tr1::unordered_map<std::string, Module*>::iterator modIter = modules.find(ourReportingModules->second[i]);
		dccChat* dccMod = (dccChat*) modIter->second;
		dccMod->onDCCEnd(id); // call the DCC end hook for each watching module as the DCC session ends
	}
	delete listenSocket;
	activeConnections.erase(id);
}
Exemple #10
0
/*
 * getSourceObj - Return the children (modules)
 *
 */
bool BPatch_image::getSourceObjInt(BPatch_Vector<BPatch_sourceObj *> &vect)
{
    BPatch_Vector<BPatch_module *> *temp = getModules();
    if (temp) {
        vect = * (BPatch_Vector<BPatch_sourceObj *> *) temp;
        return (true);
    } else {
        return (false);
    }
}
Exemple #11
0
bool BPatch_image::getSourceLinesInt( unsigned long addr, std::vector< std::pair< const char *, unsigned int > > & lines ) {
    unsigned int originalSize = lines.size();

    /* Iteratate over the modules, looking for addr in each. */
    BPatch_Vector< BPatch_module * > * modules = getModules();
    for( unsigned int i = 0; i < modules->size(); i++ ) {
        LineInformation & lineInformation = (* modules)[i]->getLineInformation();
        lineInformation.getSourceLines( addr, lines );
    } /* end iteration over modules */
    if( lines.size() != originalSize ) {
        return true;
    }

    return false;
} /* eng getSourceLines() */
Exemple #12
0
bool BPatch_image::getAddressRangesInt( const char * lineSource, unsigned int lineNo, std::vector< LineInformation::AddressRange > & ranges ) {
    unsigned int originalSize = ranges.size();

    /* Iteratate over the modules, looking for ranges in each. */
    BPatch_Vector< BPatch_module * > * modules = getModules();
    for( unsigned int i = 0; i < modules->size(); i++ ) {
        LineInformation & lineInformation = (* modules)[i]->getLineInformation();
        lineInformation.getAddressRanges( lineSource, lineNo, ranges );
    } /* end iteration over modules */
    if( ranges.size() != originalSize ) {
        return true;
    }

    return false;
} /* end getAddressRanges() */
PropertyWidget* VoreenApplication::createPropertyWidget(Property* property) const {
    tgtAssert(property, "null pointer passed");
    if ((appFeatures_ & APP_PROPERTY_WIDGETS) == 0)
        return 0;

    const std::vector<VoreenModule*>& modules = getModules();
    for (size_t m=0; m<modules.size(); m++) {
        const std::vector<PropertyWidgetFactory*>& factories = modules_.at(m)->getPropertyWidgetFactories();
        for (size_t f=0; f<factories.size(); f++) {
            PropertyWidget* propertyWidget = factories.at(f)->createWidget(property);
            if (propertyWidget) 
                return propertyWidget;
        }
    }
    return 0;
}
Exemple #14
0
/*
 * BPatch_image::getProcedures
 *
 * Returns a list of all procedures in the image upon success, and NULL
 * upon failure.
 */
BPatch_Vector<BPatch_function *> *BPatch_image::getProceduresInt(bool incUninstrumentable)
{
    BPatch_Vector<BPatch_function *> *proclist =
        new BPatch_Vector<BPatch_function *>;

    if (proclist == NULL) return NULL;

    // XXX Also, what should we do about getting rid of this?  Should
    //     the BPatch_functions already be made and kept around as long
    //     as the process is, so the user doesn't have to delete them?
    BPatch_Vector<BPatch_module *> *mods = getModules();

    for (unsigned int i = 0; i < (unsigned) mods->size(); i++) {
        BPatch_Vector<BPatch_function *> *funcs = (*mods)[i]->getProcedures(incUninstrumentable);
        for (unsigned int j=0; j < (unsigned) funcs->size(); j++) {
            proclist->push_back((*funcs)[j]);
        }
    }

    return proclist;
}
void Project::setMissingDefaultValues()
{
    if (! projectRoot.hasProperty (Ids::ID))
        projectRoot.setProperty (Ids::ID, createAlphaNumericUID(), nullptr);

    // Create main file group if missing
    if (! projectRoot.getChildWithName (Ids::MAINGROUP).isValid())
    {
        Item mainGroup (*this, ValueTree (Ids::MAINGROUP), false);
        projectRoot.addChild (mainGroup.state, 0, 0);
    }

    getMainGroup().initialiseMissingProperties();

    if (getDocumentTitle().isEmpty())
        setTitle ("JUCE Project");

    if (! projectRoot.hasProperty (Ids::projectType))
        getProjectTypeValue() = ProjectType_GUIApp::getTypeName();

    if (! projectRoot.hasProperty (Ids::version))
        getVersionValue() = "1.0.0";

    updateOldStyleConfigList();
    moveOldPropertyFromProjectToAllExporters (Ids::bigIcon);
    moveOldPropertyFromProjectToAllExporters (Ids::smallIcon);

    if (getProjectType().isAudioPlugin())
        setMissingAudioPluginDefaultValues();

    getModules().sortAlphabetically();

    if (getBundleIdentifier().toString().isEmpty())
        getBundleIdentifier() = getDefaultBundleIdentifier();

    if (shouldIncludeBinaryInAppConfig() == var::null)
        shouldIncludeBinaryInAppConfig() = true;

    ProjucerApplication::getApp().updateNewlyOpenedProject (*this);
}
bool Project::isVST3PluginHost()
{
    return getModules().isModuleEnabled ("juce_audio_processors") && isConfigFlagEnabled ("JUCE_PLUGINHOST_VST3");
}
Exemple #17
0
/*
 * BPatch_image::findVariable
 *
 * Returns a BPatch_variableExpr* representing the given variable in the
 * application image.  If no such variable exists, returns NULL.
 *
 * name		The name of the variable to look up.
 *
 * First look for the name with an `_' prepended to it, and if that is not
 *   found try the original name.
 */
BPatch_variableExpr *BPatch_image::findVariableInt(const char *name, bool showError)
{
    pdvector<int_variable *> vars;
    process *llproc = proc->llproc;

    if (!llproc->findVarsByAll(name, vars)) {
        // _name?
        pdstring under_name = pdstring("_") + pdstring(name);
        if (!llproc->findVarsByAll(under_name, vars)) {
            // "default Namespace prefix?
            if (defaultNamespacePrefix) {
                pdstring prefix_name = pdstring(defaultNamespacePrefix) + pdstring(".") + pdstring(name);
                if (!llproc->findVarsByAll(prefix_name, vars)) {
                    if (showError) {
                        pdstring msg = pdstring("Unable to find variable: ") + pdstring(prefix_name);
                        showErrorCallback(100, msg);
                    }
                    return NULL;
                }
            } else {
                if (showError) {
                    pdstring msg = pdstring("Unable to find variable: ") + pdstring(name);
                    showErrorCallback(100, msg);
                }
                return NULL;
            }
        }
    }
    assert(vars.size());

    if (vars.size() > 1) {
        cerr << "Warning: found multiple matches for var " << name << endl;
    }

    int_variable *var = vars[0];

    BPatch_variableExpr *bpvar = AddrToVarExpr->hash[var->getAddress()];
    if (bpvar) {
        return bpvar;
    }
    // XXX - should this stuff really be by image ??? jkh 3/19/99
    BPatch_Vector<BPatch_module *> *mods = getModules();
    BPatch_type *type = NULL;

    // XXX look up the type off of the int_variable's module
    BPatch_module *module = NULL;
    for (unsigned int m = 0; m < mods->size(); m++) {
        if( (*mods)[m]->lowlevel_mod() == var->mod() ) {
            module = (*mods)[m];
            break;
        }
    }
    if(module) {
        type = module->getModuleTypes()->findVariableType(name);
    }
    else {
        bperr("findVariable: failed look up module %s\n",
              var->mod()->fileName().c_str());
    }
    if(!type) {
        //  if we can't find the type in the module, check the other modules
        //  (fixes prob on alpha) --  actually seems like most missing types
        //  end up in DEFAULT_MODULE
        for (unsigned int m = 0; m < mods->size(); m++) {
            BPatch_module *tm = (*mods)[m];
            type = tm->getModuleTypes()->findVariableType(name);
            if (type) {
#if 0
                char buf1[1024], buf2[1024];
                tm->getName(buf1, 1024);
                module->getName(buf2, 1024);
                fprintf(stderr, "%s[%d]:  found type for %s in module %s, not %s\n", FILE__, __LINE__, name, buf2, buf1);
#endif
                break;
            }

        }

        if (!type) {
            char buf[128];
            sprintf(buf, "%s[%d]:  cannot find type for var %s\n", FILE__, __LINE__, name);
            BPatch_reportError(BPatchWarning, 0, buf);
            type = BPatch::bpatch->type_Untyped;
        }
    }

    char *nameCopy = strdup(name);
    assert(nameCopy);
    BPatch_variableExpr *ret = new BPatch_variableExpr((char *) nameCopy,
            proc, (void *)var->getAddress(),
            type);
    AddrToVarExpr->hash[var->getAddress()] = ret;
    return ret;
}
Exemple #18
0
//--------------------------------------------------
void ofSetLogLevel(string module, ofLogLevel level){
	getModules()[module] = level;
}
Exemple #19
0
int CScatteredManage::processJobs()
{
	SCNode nd;
	SCJob sj;
	tcps_Array<PCC_ModuleFile> moudleFiles;
	PCC_ModuleIndex index;
	//bool b_rest = true,b_r2 = false;
	int pre_node_num =-1;
	while (1)
	{
		if(pre_node_num != getNodeCounts())
		{
			printf("##当前可调度节点数:%d,待处理作业数:%d\n",pre_node_num = getNodeCounts(),getJobsCounts());
			
		}
		
		//检测job队列
		if(popJob(sj))
		{
			
			printf("当前可调度节点数:%d,待处理作业数:%d\n",getNodeCounts(),getJobsCounts()+1);

			//先判断jobkey对应的会话是否有效 //这一步看需求,是否支持不要回调通知的作业提交,这里标志以回调有效的方式处理
            if(!isValidJobRequest(sj.jobKey))
				continue;//忽略

			while(1)//轮询等待有空余节点可做scattered计算
			{
				
				if(popNode(nd))// 注意节点要在作业处理完后收回
				{
				    
					//nd.ps->m_ss = sj.ss;//回调senssion句柄 要是m_ss的servece_s的客户端断开了连接,这个指针会失效//jobkey
					
                    
					nd.ps->m_jobkey = sj.jobKey;
					printf("节点%p处理作业:%lld\n",nd.ps,sj.jobKey);
					index.moduleKey = sj.moduleKey;
					//确保节点端存在 moduleKey指定的模块
					moudleFiles.Release();
				    BOOL isFound = false;
					if(TCPS_OK ==nd.ps->FindModule(sj.moduleKey,isFound) )// 节点端没有,同步此模块
					{
						if(!isFound)
						{
							//读取模块 填充 index,moudleFiles
							if(getModules(index,moudleFiles))
							{
								//再次调用接口
								if(nd.ps->AddModule(sj.moduleKey,moudleFiles) != TCPS_OK)
								{
									nd.ps->m_ss = NULL;//for mark
									pushNode(nd.key,nd.ps);
									NPLogError(("模块更新失败,作业无法调度\n"));
									break;
								}
							}
							else
							{
								nd.ps->m_ss = NULL;//for mark
								pushNode(nd.key,nd.ps);
								NPLogError(("模块读取失败,作业无法调度\n"));
								break;
							}
						}
					}
					else
					{
						pushNode(nd.key,nd.ps);
						NPLogError(("无法获取模块状态!\n"));
						break;
					}
					//节点暂时分离出去了
					//这里应当添加节点处理超时
					nd.ps->Compute(sj.moduleKey,
					sj.jobKey,
					sj.info.dataInputUrl,
					sj.info.dataOutputUrl,
					sj.info.programParam);
					//nd.ps->AddMoudle(index,moudleFiles);
					//nd.ps->RemoveModule(0);
				
					break;
				}
				Sleep(1);
			}
		}
		
		Sleep(1);
	}
	return 0;
}