void XMLInputStream::initialize() { char xmlComments[MAX_CONFIG_VALUE_LENGTH]; xmlCommentMode = COMMENTS_DEFAULT; if (getConfigurationValue("XML_COMMENTS", xmlComments)) { if (strcasecmp(xmlComments, "plaintext") == 0) xmlCommentMode = COMMENTS_PLAINTEXT; else if (strcasecmp(xmlComments, "ignore") == 0) xmlCommentMode = COMMENTS_IGNORE; } for (int i = 0; i <= 32; i++) isWhiteSpace[i] = true; for (int i = 33; i <= 255; i++) isWhiteSpace[i] = false; for (int i = 0; WHITESPACES[i] != 0; i++) isWhiteSpace[(byte)WHITESPACES[i]] = true; for (int i = 0; i <= 255; i++) isTerminator[i] = isInstigator[i] = false; isInstigator[(byte)'<'] = true; isInstigator[(byte)'>'] = isTerminator[(byte)'>'] = true; isTerminator[(byte)'@'] = true; isInstigator[(byte)'@'] = true; bufferSize = BUFFER_SIZE; bufferPos = BUFFER_SIZE; filePosition = 0; sequenceNumber = 0; termQueueLength = 0; currentTag[0] = 0; currentlyInComment = false; atQueryTime = false; } // end of initialize()
std::string AudioPluginInstance::getDistinctiveConfigurationText() const { std::string base = getConfigurationValue("load"); if (base == "") { for (ConfigMap::const_iterator i = m_config.begin(); i != m_config.end(); ++i) { if (!strncmp(i->first.c_str(), "__ROSEGARDEN__", strlen("__ROSEGARDEN__"))) continue; if (i->second != "" && i->second[0] == '/') { base = i->second; break; } else if (base != "") { base = i->second; } } } if (base == "") return ""; std::string::size_type s = base.rfind('/'); if (s < base.length() - 1) base = base.substr(s + 1); std::string::size_type d = base.rfind('.'); if (d < base.length() - 1 && d > 0) base = base.substr(0, d); return base; }
int main(int argc, char **argv) { initializeConfiguratorFromCommandLineParameters(argc, argv); log(LOG_DEBUG, "MasterIndex", "Starting application."); for (int i = 1; i < argc; i++) processParameter(argv[i]); char *workDir = "./"; char dummy[MAX_CONFIG_VALUE_LENGTH]; if (!getConfigurationValue("LOG_FILE", dummy)) { log(LOG_ERROR, "MasterIndex", "Configuration variable \"LOG_FILE\" not found. Make sure Wumpus finds your configuration file."); return 1; } MasterIndex *mi = new MasterIndex(workDir); if (!mi->startupOk) { log(LOG_ERROR, "MasterIndex", "Unable to start MasterIndex. Check whether all directory permissions and have been set correctly and whether an fschange-like notification service is running."); delete mi; return 1; } // set whole process group to low priority pid_t processGroup = getpgrp(); setpriority(PRIO_PGRP, processGroup, +3); char line[1024]; printf("Enter \"QUIT\" to stop the MasterIndex.\n"); while (fgets(line, 1023, stdin) != NULL) { bool emptyLine = true; for (int i = 0; line[i] != 0; i++) if ((line[i] < 0) || (line[i] > ' ')) emptyLine = false; if (emptyLine) continue; if (line[strlen(line) - 1] == '\n') line[strlen(line) - 1] = 0; if (strcasecmp(line, "QUIT") == 0) break; Query *q = new Query(mi, line, geteuid()); if (q->parse()) { char l2[65536]; while (q->getNextLine(l2)) printf("%s\n", l2); } int status; q->getStatus(&status, line); printf("@%d-%s\n", status, line); delete q; } delete mi; printAllocations(); return 0; } // end of main()
bool CDRQuery::parse() { // if no container is given, assume default container char defaultContainer[MAX_CONFIG_VALUE_LENGTH]; if (!getConfigurationValue("DEFAULT_RETRIEVAL_SET", defaultContainer)) strcpy(defaultContainer, DOC_QUERY); if (!parseQueryString(queryString, defaultContainer, NULL, memoryLimit)) { syntaxErrorDetected = finished = true; ok = false; } else if (((elementCount < 1) || (elementCount > CDR_MAX_SCORER_COUNT)) && (maxLevel > 1)) { // @cdr queries may not contain more than CDR_MAX_SCORER_COUNT query terms syntaxErrorDetected = finished = true; ok = false; } else { if (statisticsQuery == NULL) if (visibleExtents != NULL) statisticsQuery = new GCLQuery(index, visibleExtents->getExtentList()); processQuery(); ok = true; } return ok; } // end of parse()
bool CRecieveTask_zakazrf_ru::run() { qDebug(); // m_signaller->onRecieveFinished(this); // return true; connect(m_signaller, SIGNAL(dataParsed(QUrl)), this, SLOT(removeData(QUrl))); #ifndef RUN_ALL_TASKS QUrl testUrl("http://zakazrf.ru/ViewReduction.aspx?id=4781"); CDataStructure* tmpdata = new CDataStructure(testUrl); tmpdata->setType(getUrlDataType(testUrl)); tmpdata->setRoot(); m_dataStructures.insert(testUrl, tmpdata); m_activeDataStructures.push_back(tmpdata); QUrl testUrl2("http://zakazrf.ru/ViewReduction.aspx?id=2943"); CDataStructure* tmpdata2 = new CDataStructure(testUrl2); tmpdata2->setType(getUrlDataType(testUrl2)); tmpdata2->setRoot(); m_dataStructures.insert(testUrl2, tmpdata2); m_activeDataStructures.push_back(tmpdata2); QUrl testUrl3("http://zakazrf.ru/ViewReduction.aspx?id=5319"); CDataStructure* tmpdata3 = new CDataStructure(testUrl3); tmpdata3->setType(getUrlDataType(testUrl3)); tmpdata3->setRoot(); m_dataStructures.insert(testUrl3, tmpdata3); m_activeDataStructures.push_back(tmpdata3); #else CDownloadManager_zakazrf_ru downloadManager; downloadManager.init(); QUrlList urls=downloadManager.getUrls(); if(urls.isEmpty()) { int min = getConfigurationValue("zakazrf/min_id",1).toUInt(); int max = getConfigurationValue("zakazrf/max_id",10000).toUInt(); if (max < min) { int tmp = max; max = min; min = tmp; } for(int i = min; i < max; i++) { QUrl testUrl(QString("http://zakazrf.ru/ViewReduction.aspx?id=%1").arg(i)); CDataStructure* tmpdata = new CDataStructure(testUrl); tmpdata->setType(getUrlDataType(testUrl)); tmpdata->setRoot(); m_dataStructures.insert(testUrl, tmpdata); m_activeDataStructures.push_back(tmpdata); } } else { for(int i=0; i<urls.count();i++) { CDataStructure* tmpdata = new CDataStructure(urls.at(i)); tmpdata->setType(getUrlDataType(urls.at(i))); tmpdata->setRoot(); m_dataStructures.insert(urls.at(i), tmpdata); m_activeDataStructures.push_back(tmpdata); } } #endif CDataStructure* data=NULL; QList<CDataStructure*>::iterator activeDataStructuresIter; for(activeDataStructuresIter = m_activeDataStructures.begin(); activeDataStructuresIter != m_activeDataStructures.end();) { if(m_threads.count()<(m_maxThreads+1)) { data=(*activeDataStructuresIter); CReciveThread *thread=new CReciveThread(data->url(), m_threadCounter++); thread->setDataStructure(data); m_threads.push_back(thread); connect(thread, SIGNAL(dataReady(int/*,QByteArray*/)), this, SLOT(onDataReady(int/*,QByteArray*/))); connect(thread, SIGNAL(finished()), this, SLOT(onThreadFinished())); thread->start(); activeDataStructuresIter=m_activeDataStructures.erase(activeDataStructuresIter); break; } break; }