int arbitraryMovie(char *command, int xspin[4]) { char *string; string = queryString("File to play: ", NULL, 0); return (string ? movie(command + 3, xspin, string) : TRUE); }
int oneParmMovie(char *command, int xspin[4]) { int failed = FALSE; int nc = -1, frames, j; double low, high, step; char *string; FILE *moviefile; string = queryString("Parameter to watch: ", NULL, 0); if (string) nc = parseva(caps(string)); if (nc < 0 || nc >= NA) { ERROR("/** Invalid fit parameter number: %s **/\n", string); failed = TRUE; return failed; } /* Valid parameter number */ moviefile = fopen(movfile, "w"); frames = frameRange(&low, &high, A[nc]); step = (frames == 1) ? 0 : (high - low) / (double) (frames - 1); genva(&nc, 1, fitlist); fprintf(moviefile, "#%s\n", fitlist); for (j = 0; j < frames; j++) { fprintf(moviefile, "%15.6G\n", low); low += step; } fclose(moviefile); return movie(command + 2, xspin, movfile); }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QString queryString(qgetenv("QUERY_STRING")); if (!queryString.isEmpty()) { // run as CGI script Report::handleCGIQuery(queryString); return 0; } if (a.arguments().contains(QLatin1String("-testmapping"))) { BaselineHandler h(QLS("SomeRunId")); h.testPathMapping(); return 0; } BaselineServer server; if (!server.listen(QHostAddress::Any, BaselineProtocol::ServerPort)) { qWarning("Failed to listen!"); return 1; } qDebug() << "\n*****" << argv[0] << "started, ready to serve on port" << BaselineProtocol::ServerPort << "with baseline protocol version" << BaselineProtocol::ProtocolVersion << "*****\n"; return a.exec(); }
// Extracts the query string from the given HTTP message std::string getQueryString(struct http_message *hm) { if (hm->query_string.len > 0) { std::string queryString (hm->query_string.p, hm->query_string.len); return queryString; }else{ return ""; } }
int bang(char *command) { int retValue = 0; static char execstring[1024]; if (command[1] == '!') retValue = system(getenv("SHELL")); else if (queryString("System: ", execstring, 1023) != NULL) retValue = system(execstring); return retValue; }
void RestServer::getUserRequest(mg_connection *connection){ std::string username = this->getValueFromHttpRequestHeader(connection, "user"); std::string token = this->getValueFromHttpRequestHeader(connection, "token"); std::string query("username="); std::string queryString(connection->query_string); std::string queryUsername = queryString.substr(queryString.find(query)+query.length()); std::string response = this->serviceManager->getUser(username, token, queryUsername); mg_printf_data(connection, response.c_str()); }
void preFitFrame(char *command, FILE *gnuPipe, int npnts, double chisq) { fprintf(gnuPipe, "set logscale y\n" "set bar small\n" "set xlabel \"%s\"\n" "set ylabel \"%s\"\n" "plot \"%s\" w errorbars, \"%s\" w line\n", qlabel, rlabel, infile, fitfile); fitFrame(gnuPipe, npnts, chisq); queryString("Wait for first frame, then press enter to commence fitting. ", NULL, 0); }
void preFitFrame(char *command, FILE *gnuPipe, int xspin[4], double chisq) { /* Determine reflectivities to print */ setPspin(pspin, xspin, command + 3); #if LINEAR_DATA fputs("set logscale y\n", gnuPipe); #endif fputs("set bar small\n", gnuPipe); fitFrame(gnuPipe, xspin, chisq); queryString("Wait for first frame, then press enter to commence fitting. ", NULL, 0); }
QList<Subject> LoginManager::getSubjects() { QList<Subject> list; if(db.open()) { QString queryString("SELECT * FROM depth_courses"); QSqlQuery query = db.exec(queryString); while(query.next()) { list.append(Subject(query.value(0).toString(), query.value(1).toString(), query.value(2).toInt(), query.value(4).toInt())); } db.close(); return list; } }
QList<Course> LoginManager::getCourses() { QList<Course> list; if(db.open()) { QString queryString("SELECT * FROM courses"); QSqlQuery query = db.exec(queryString); while(query.next()) { list.append(Course(query.value(0).toString(), query.value(1).toInt())); } db.close(); return list; } }
QList<Transaction> LoginManager::getTransactions() { if(db.open()) { QList<Transaction> list; QString queryString("SELECT * FROM accounts WHERE Type <> 2"); QSqlQuery query = db.exec(queryString); while(query.next()) { list.append(Transaction(query.value(0).toString(), query.value(1).toInt(), query.value(3).toString(), query.value(4).toString())); } db.close(); return list; } }
void MasterKeysTable::populateTable() { d->tableView->clear(); setTableHeader(); QLatin1String queryString("SELECT * from MasterKeys where userid=1"); QMap<QString, QVariant> bindMap; QVector<QVector<QVariant> > results; DatabaseAccess::instance()->executeDirectSql(queryString, bindMap, results); if(results.isEmpty()) { return; } d->tableView->setRowCount(results.size()); for(int i = 0 ; i < results.size(); i++) { QVector<QVariant> item = results.at(i); for(int j = 0; j < item.size(); j++) { QVariant cellData = item.at(j); QTableWidgetItem* tableItem = 0; if(cellData.type() == QVariant::Int) { tableItem = new QTableWidgetItem(QString::number(cellData.toInt())); } if(cellData.type() == QVariant::String) { tableItem = new QTableWidgetItem(cellData.toString()); } if(cellData.type() == QVariant::ByteArray) { tableItem = new QTableWidgetItem(QString(cellData.toByteArray().toBase64())); } if(tableItem == NULL) qDebug() << "Element is NULL" << cellData.type(); d->tableView->setItem(i,j,tableItem); } } }
QVector<ResearchPaper> LoginManager::findResearchPapers() { if(db.open()) { QVector<ResearchPaper> list; QString queryString("SELECT * FROM research_papers"); QSqlQuery query(queryString, db); query.exec(); while(query.next()) { list.append(ResearchPaper(query.value(0).toString(), query.value(1).toString(), query.value(2).toString(), query.value(3).toString(), query.value(4).toInt())); } db.close(); return list; } }
QList<ResearchProject> LoginManager::getProjects() { if(db.open()) { QList<ResearchProject> list; QString queryString("SELECT * FROM research_projects"); QSqlQuery query(queryString, db); query.exec(); while(query.next()) { list.append(ResearchProject(query.value(3).toString(), query.value(2).toString(), query.value(1).toString(), query.value(4).toInt(), query.value(0).toString())); } db.close(); return list; } }
int fitMovie(char *command, int xspin[4], double preFit[NA]) { char *string; int frames = 0, numFields = 0; register int j, nc; FILE *moviefile; moviefile = fopen(movfile, "w"); string = queryString("Number of frames: ", NULL, 0); if (string) sscanf(string, "%d", &frames); /* Find parameters which changed */ for (j = 0; j < NA; j++) { if (A[j] != preFit[j]) fields[numFields++] = j; } /* List parameters that changed in header */ fputc('#', moviefile); for (j = 0; j < numFields; j++) { nc = fields[j]; orig[nc] = preFit[nc]; genva(fields + j, 1, fitlist); fprintf(moviefile, " %s", fitlist); } fputc('\n', moviefile); /* Print parameters before fit */ for (j = 0; j < numFields; j++) fprintf(moviefile, "%15.6G", orig[fields[j]]); fputc('\n', moviefile); /* Print remaining frames */ while(frames > 0) { for (j = 0; j < numFields; j++) { nc = fields[j]; orig[nc] += (A[nc] - orig[nc]) / (double) frames; fprintf(moviefile, "%15.6G", orig[nc]); } fputc('\n', moviefile); frames--; } fclose(moviefile); return movie(command + 3, xspin, movfile); }
QStringList ScreenPhone::getContact(const QString& number) { QStringList activeCallContact; if(controller->db->mydb.open()) { QString queryString("SELECT name, surname, pic_path, number, description, number_id, contact_id FROM contact_number NATURAL JOIN contacts WHERE number LIKE '" + number + "' LIMIT 1"); //qDebug() << "getContact query: " << queryString; QSqlQuery query = controller->db->mydb.exec(queryString); if(controller->db->mydb.lastError().number()>0) { qDebug() << "getContact error: " << controller->db->mydb.lastError(); } else { while(query.next()) { activeCallContact.append(query.value(0).toString()); activeCallContact.append(query.value(1).toString()); activeCallContact.append(query.value(2).toString()); activeCallContact.append(query.value(3).toString()); activeCallContact.append(query.value(4).toString()); activeCallContact.append(query.value(5).toString()); activeCallContact.append(query.value(6).toString()); return activeCallContact; } } } activeCallContact.append(number); activeCallContact.append(""); activeCallContact.append(""); activeCallContact.append(number); activeCallContact.append("Unknown"); activeCallContact.append(0); activeCallContact.append(0); return activeCallContact; }
String Locale::weekFormatInLDML() { String templ = queryString(WebLocalizedString::WeekFormatTemplate); // Converts a string like "Week $2, $1" to an LDML date format pattern like // "'Week 'ww', 'yyyy". StringBuilder builder; unsigned literalStart = 0; unsigned length = templ.length(); for (unsigned i = 0; i + 1 < length; ++i) { if (templ[i] == '$' && (templ[i + 1] == '1' || templ[i + 1] == '2')) { if (literalStart < i) DateTimeFormat::quoteAndAppendLiteral(templ.substring(literalStart, i - literalStart), builder); builder.append(templ[++i] == '1' ? "yyyy" : "ww"); literalStart = i + 1; } } if (literalStart < length) DateTimeFormat::quoteAndAppendLiteral(templ.substring(literalStart, length - literalStart), builder); return builder.toString(); }
void MainServer::handle_receive_from_client(const boost::system::error_code& error,std::size_t insize/*bytes_transferred*/) { if (!error || error == boost::asio::error::message_size) { u_int32_t clientip=mRemoteClient.address().to_v4().to_ulong(); std::string queryname=queryString(insize); if (insize > 1) { mServerSocket.async_send_to(boost::asio::buffer(mResponseHelper.reply(mRecvBuffer,insize,true), insize+16), mRemoteClient, boost::bind(&MainServer::handle_send, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred ) ); } else { syslog(LOG_WARNING, "Tiny packet, unable to get uniqueu id, ignoring."); } } server_start_receive(); }
void MpcImportWindow::updateTexts() { QString linkText("<a href=\"http://www.minorplanetcenter.net/iau/MPEph/MPEph.html\">Minor Planet & Comet Ephemeris Service</a>"); // TRANSLATORS: A link showing the text "Minor Planet & Comet Ephemeris Service" is inserted. QString queryString(q_("Query the MPC's %1:")); ui->labelQueryLink->setText(QString(queryString).arg(linkText)); QString firstLine(q_("Only one result will be returned if the query is successful.")); QString secondLine(q_("Both comets and asteroids can be identified with their number, name (in English) or provisional designation.")); QString cPrefix("<b>C/</b>"); QString pPrefix("<b>P/</b>"); QString cometQuery("<tt>C/Halley</tt>"); QString cometName("1P/Halley"); QString asteroidQuery("<tt>Halley</tt>"); QString asteroidName("(2688) Halley"); QString nameWarning(q_("Comet <i>names</i> need to be prefixed with %1 or %2. If more than one comet matches a name, only the first result will be returned. For example, searching for \"%3\" will return %4, Halley's Comet, but a search for \"%5\" will return the asteroid %6.")); QString thirdLine = QString(nameWarning).arg(cPrefix, pPrefix, cometQuery, cometName, asteroidQuery, asteroidName); ui->labelQueryInstructions->setText(QString("%1<br/>%2<br/>%3").arg(firstLine, secondLine, thirdLine)); }
int cd (char *command) { int retValue = 0; #if 0 if ( queryString("New directory: ", currentDir, PATH_MAX) != NULL && #ifdef ALWAYSEXPAND /* Always expand (like the shell). */ chdir(tildeExpand(currentDir)) == -1 #else /* Expand only if it doesn't exist in current dir. */ chdir(currentDir) == -1 && (errno != ENOENT || chdir(tildeExpand(currentDir)) == -1) #endif ) { perror(currentDir); retValue = -1; } getwd(currentDir); #endif return retValue; }
InternetUsageStatistics::InternetUsageStatistics(std::string dbPath) { int retval = sqlite3_open(dbPath.c_str(), &_sqliteDB); // If connection failed, handle returns NULL if (retval != SQLITE_OK) { BOOST_LOG_TRIVIAL(error) << "Database connection failed in InternetUsageStatistics!"; } assert(retval == SQLITE_OK); BOOST_LOG_TRIVIAL(info) << "SQLite connection to " << dbPath << " successfully established in InternetUsageStatistics!"; std::string queryString( " SELECT value FROM unbroadbandstats as un," " rel_country_to_un as rel" " WHERE un.country_or_area = rel.country_or_area" " AND rel.country = ?" " GROUP BY un.country_or_area" " HAVING max(year)"); assert(sqlite3_prepare_v2(_sqliteDB, queryString.c_str(), queryString.size(), &_stmt, NULL) == SQLITE_OK); }
STATIC int frameRange(double *low, double *high, double orig) { int frames = 0; char *string; double dummyUnc; *low = orig; if (setLayerParam(low, &dummyUnc, "starting value")) /* Invalid response, use original value */ *low = orig; *high = orig; if (setLayerParam(high, &dummyUnc, "ending value")) /* Invalid response, use original value */ *high = orig; string = queryString("Number of frames: ", NULL, 0); if (string) sscanf(string, "%d", &frames); frames++; return frames; }
void mlayer(void) { static char command[COMMANDLEN+2]; static double undoFit[NA], undoFitUnc[NA]; /* Process command */ while (queryString("mlayer% ", command, COMMANDLEN + 2) == NULL); caps(command); /* Spawn a command */ if (strcmp(command, "!") == 0 || strcmp(command, "!!") == 0) { bang(command); /* Print current directory */ } else if (strcmp(command, "PWD") == 0) { puts(currentDir); /* Change current directory */ } else if (strcmp(command, "CD") == 0) { cd(command); /* Help */ } else if (strcmp(command, "?") == 0 || strcmp(command, "HE") == 0 || strcmp(command, "HELP") == 0) { help(command + (*command == '?' ? 1 : 2)); /* Value of vacuum QCSQ */ } else if (strcmp(command, "QCV") == 0 || strcmp(command, "VQC") == 0) { setVQCSQ(tqcsq); /* Value of vacuum linear absorption coefficient */ } else if (strcmp(command, "MUV") == 0 || strcmp(command, "VMU") == 0) { setVMU(tmu); /* Wavelength */ } else if (strcmp(command, "WL") == 0) { double v = lambda; if (setWavelength(&lambda)==0 && lambda != v) { /* May need to recalculate Q for the new wavelength */ if (theta_offset != 0. && loaded) loadData(infile); } /* Theta offset */ } else if (strcmp(command, "TO") == 0) { double v = theta_offset; if (setThetaoffset(&theta_offset)==0 && theta_offset != v) { /* May need to recalculate Q for the new theta offset */ if (loaded) loadData(infile); } /* Number of layers */ } else if ( strcmp(command, "NTL") == 0 || strcmp(command, "NML") == 0 || strcmp(command, "NBL") == 0 ) switch (command[1]) { case 'T': setNLayer(&ntlayer); break; case 'M': setNLayer(&nmlayer); break; case 'B': setNLayer(&nblayer); break; /* Add or remove layers */ } else if ( strcmp(command, "ATL") == 0 || strcmp(command, "AML") == 0 || strcmp(command, "ABL") == 0 || strcmp(command, "RTL") == 0 || strcmp(command, "RML") == 0 || strcmp(command, "RBL") == 0 ) { modifyLayers(command); /* Copy layer */ } else if (strcmp(command, "CL") == 0) { copyLayer(command); /* Maximum number of layers used to simulate rough interface */ } else if ( strcmp(command, "NR") == 0 && !setNRough(&nrough) ) { /* Generate interface profile */ if (nrough < 3) nrough = 11; if (*proftyp == 'H') gentanh(nrough, zint, rufint); else generf(nrough, zint, rufint); /* Specify error function or hyperbolic tangent profile */ } else if (strcmp(command, "PR") == 0) { setProfile(proftyp, PROFTYPLEN + 2); /* Number of layers in multilayer */ } else if (strcmp(command, "NMR") == 0) { setNrepeat(&nrepeat); /* Range of Q to be scanned */ } else if (strcmp(command, "QL") == 0) { setQrange(&qmin, &qmax); /* Number of points scanned */ } else if (strcmp(command, "NP") == 0) { setNpnts(); /* File for input data */ } else if (strcmp(command, "IF") == 0) { setFilename(infile, INFILELEN + 2); /* File for output data */ } else if (strcmp(command, "OF") == 0) { setFilename(outfile, OUTFILELEN + 2); /* File for parameters */ } else if (strcmp(command, "PF") == 0) { setFilename(parfile, PARFILELEN + 2); /* Delta lambda */ } else if (strcmp(command, "DL") == 0) { setLamdel(&lamdel); /* Delta theta */ } else if (strcmp(command, "DT") == 0) { setThedel(&thedel); /* Beam intensity */ } else if (strcmp(command, "BI") == 0) { setBeamIntens(&bmintns, &Dbmintns); /* Background intensity */ } else if (strcmp(command, "BK") == 0) { setBackground(&bki, &Dbki); /* Verify parameters by printing out */ } else if ( strncmp(command, "TVE", 3) == 0 || strncmp(command, "MVE", 3) == 0 || strncmp(command, "BVE", 3) == 0 || strncmp(command, "VE", 2) == 0 ) { printLayers(command); /* Get data from file */ } else if (strcmp(command, "GD") == 0) { loadData(infile); /* Edit constraints */ } else if (strcmp(command, "EC") == 0) { constrainFunc newmodule; newmodule = newConstraints(constrainScript, constrainModule); if (newmodule != NULL) Constrain = newmodule; /* Reload constrain module */ } else if (strcmp(command, "LC") == 0) { Constrain = loadConstrain(constrainModule); /* Unload constrain module */ } else if (strcmp(command, "ULC") == 0) { Constrain = loadConstrain(NULL); /* Load parameters from parameter file */ } else if (strncmp(command, "LP", 2) == 0) { loadParms(command, &npnts, parfile, constrainScript, constrainModule); /* Save parameters to parameter file */ } else if (strcmp(command, "SP") == 0) { parms(tqcsq, mqcsq, bqcsq, tqcmsq, mqcmsq, bqcmsq, td, md, bd, trough, mrough, brough, tmu, mmu, bmu, MAXLAY, &lambda, &lamdel, &thedel, &theta_offset, &ntlayer, &nmlayer, &nblayer, &nrepeat, &qmin, &qmax, &npnts, infile, outfile, &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp, DA, constrainScript, parfile, TRUE); /* List data and fit */ } else if (strcmp(command, "LID") == 0) { listData(); /* Generate logarithm of bare (unconvoluted) reflectivity */ } else if (strcmp(command, "GR") == 0 || strcmp(command, "SA") == 0) { genReflect(command); /* Generate and display layer profile used for roughness */ } else if (strcmp(command, "GLP") == 0) { genProfile(); /* Save layer profile to OUTFILE */ } else if ( strcmp(command, "SLP") == 0 || strcmp(command, "SSP") == 0 ) { saveProfile(command); /* Save values in XTEMP and YTEMP to OUTFILE */ } else if (strcmp(command, "SV") == 0) { saveTemps(outfile); /* Calculate derivative of reflectivity or spin asymmetry with respect to a fit parameter or save a fit to disk file */ } else if ( strcmp(command, "RD") == 0 || strcmp(command, "RSD") == 0 || strcmp(command, "SRF") == 0 || strcmp(command, "SRSF") == 0 ) { printDerivs(command); /* Turn off all varied parameters */ } else if (strcmp(command, "VANONE") == 0) { clearLista(listA); /* Specify which parameters are to be varied in the reflectivity fit */ } else if (strncmp(command, "VA", 2) == 0) { varyParm(command); /* Calculate chi-squared */ } else if (strcmp(command, "CSR") == 0 || strcmp(command, "CSRS") == 0) { printChiSq(command); /* Fit five-layer reflectivity */ } else if (strncmp(command, "FR", 2) == 0) { register int n; for (n = 0; n < NA; n++) { undoFit[n] = A[n]; undoFitUnc[n] = DA[n]; } fitReflec(command); /* Undo last fit */ } else if (strcmp(command, "UF") == 0) { register int n; for (n = 0; n < NA; n++) { A[n] = undoFit[n]; DA[n] = undoFitUnc[n]; } /* Exit */ } else if (strcmp(command, "EX") == 0) { parms(tqcsq, mqcsq, bqcsq, tqcmsq, mqcmsq, bqcmsq, td, md, bd, trough, mrough, brough, tmu, mmu, bmu, MAXLAY, &lambda, &lamdel, &thedel, &theta_offset, &ntlayer, &nmlayer, &nblayer, &nrepeat, &qmin, &qmax, &npnts, infile, outfile, &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp, DA, constrainScript, parfile, TRUE); exit(0); /* Exit without saving changes */ } else if (strcmp(command, "QU") == 0 || strcmp(command, "QUIT") == 0) { exit(0); /***** Start new ************** */ /* Plot reflectivity on screen */ } else if (strncmp(command, "PRF", 3) == 0) { plotfit(command); /* Plot profile on screen */ } else if (strcmp(command, "PLP") == 0) { /* Generate profile */ plotprofile(command); /* Send data to other processes. */ } else if (strcmp(command, "SEND") == 0) { ipc_send(command); /* Receive data to other processes. */ } else if (strcmp(command, "RECV") == 0) { ipc_recv(command); /* Plot movie of reflectivity change from fit */ } else if (strncmp(command, "MVF", 3) == 0) { fitMovie(command, undoFit); /* Plot general movie from data file on screen */ } else if (strncmp(command, "MVX", 3) == 0) { arbitraryMovie(command); /* Plot movie of parameter on screen */ } else if (strncmp(command, "MV", 2) == 0) { oneParmMovie(command); /* Update constraints */ } else if (strcmp(command, "UC") == 0) { genshift(a, TRUE); /* constrain(a); */ (*Constrain)(FALSE, a, ntlayer, nmlayer, nrepeat, nblayer); genshift(a, FALSE); /* Enter critical Q squared */ /* or */ /* Top length absorption coefficient */ /* or */ /* Thicknesses of top layers */ /* or */ /* Roughnesses of top layers */ } else { static char *paramcom[] = {"QC", "MU", "D", "RO"}; static double *top[] = { tqcsq, tmu, td, trough}; static double *mid[] = { mqcsq, mmu, md, mrough}; static double *bot[] = { bqcsq, bmu, bd, brough}; static double *Dtop[] = {Dtqcsq, Dtmu, Dtd, Dtrough}; static double *Dmid[] = {Dmqcsq, Dmmu, Dmd, Dmrough}; static double *Dbot[] = {Dbqcsq, Dbmu, Dbd, Dbrough}; static int (*store[])(int, double *, double *) = { setQCSQ, setMU, setD, setRO }; int param, code = -1; for (param = 0; param < sizeof(paramcom) / sizeof(paramcom[0]); param++) { code = fetchLayParam(command, paramcom[param], top[param], mid[param], bot[param], Dtop[param], Dmid[param], Dbot[param], store[param]); if (code > -1) break; } if (code == -1) ERROR("/** Unrecognized command: %s **/\n", command); } }
std::string MySQLPreparedStatement::getQueryString() const { std::string queryString(m_queryString); size_t pos = 0; for (uint32 i = 0; i < m_stmt->statement_data.size(); i++) { pos = queryString.find('?', pos); std::stringstream ss; switch (m_stmt->statement_data[i].type) { case TYPE_BOOL: ss << uint16(m_stmt->statement_data[i].data.boolean); break; case TYPE_UI8: ss << uint16(m_stmt->statement_data[i].data.ui8); // stringstream will append a character with that code instead of numeric representation break; case TYPE_UI16: ss << m_stmt->statement_data[i].data.ui16; break; case TYPE_UI32: ss << m_stmt->statement_data[i].data.ui32; break; case TYPE_I8: ss << int16(m_stmt->statement_data[i].data.i8); // stringstream will append a character with that code instead of numeric representation break; case TYPE_I16: ss << m_stmt->statement_data[i].data.i16; break; case TYPE_I32: ss << m_stmt->statement_data[i].data.i32; break; case TYPE_UI64: ss << m_stmt->statement_data[i].data.ui64; break; case TYPE_I64: ss << m_stmt->statement_data[i].data.i64; break; case TYPE_FLOAT: ss << m_stmt->statement_data[i].data.f; break; case TYPE_DOUBLE: ss << m_stmt->statement_data[i].data.d; break; case TYPE_STRING: ss << '\'' << (char const*)m_stmt->statement_data[i].binary.data() << '\''; break; case TYPE_BINARY: ss << "BINARY"; break; case TYPE_NULL: ss << "NULL"; break; } std::string replaceStr = ss.str(); queryString.replace(pos, 1, replaceStr); pos += replaceStr.length(); } return queryString; }
void MainServer::handle_receive_from_client(const boost::system::error_code& error,std::size_t insize/*bytes_transferred*/) { if (!error || error == boost::asio::error::message_size) { u_int32_t clientip=mRemoteClient.address().to_v4().to_ulong(); u_int32_t clientno = mRoutingCore.asNum(clientip); std::string queryname=queryString(insize); if (insize > 1) { //The dbus pbdns service will send us DNS queries with a magic domain, we need to handle these differently. if (boost::regex_match(queryname,mMagicDomainRegex)) { syslog(LOG_NOTICE, "command packet '%s' received.", queryname.c_str() ); bool ok=false; boost::smatch what; //Check if the query has one of two valid command syntaxes. if ((boost::regex_match(queryname,what,mCommandRegex,boost::match_extra))|| (boost::regex_match(queryname,what,mCommand2Regex,boost::match_extra))) { ok=true; size_t ws=0; size_t gw=0; try { ws=boost::lexical_cast<size_t>(what[1]); if (what.size() == 3) { gw=boost::lexical_cast<size_t>(what[2]); } } catch (std::exception& e) { syslog(LOG_ERR, "Error while parsing command packet '%s'. This must be a bug, please report to the author.", queryname.c_str() ); ok=false; } if (ok) { //Call the appropriate command on the routing core. if (what.size() == 3) { ok=mRoutingCore.updateRouting(ws,gw); } else { mRoutingCore.clear(ws); } if (ok) { syslog(LOG_NOTICE, "Command '%s' SUCCEEDED.", queryname.c_str() ); } else { syslog(LOG_ERR, "Command '%s' FAILED.", queryname.c_str() ); } } } else { syslog(LOG_ERR, "Command packet '%s' has an invalid format.", queryname.c_str() ); } //Sens out a direct true/false response to the dbus service. mServerSocket.async_send_to(boost::asio::buffer(mResponseHelper.reply(mRecvBuffer,insize,ok), insize+16), mRemoteClient, boost::bind(&MainServer::handle_send, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred ) ); } else { if (mRoutingCore.parked(clientno,queryname)) { //If the dns we would forward to is the park ip, than we asume whe have an A query and respond with a 'thats-me' response. mServerSocket.async_send_to(boost::asio::buffer(mResponseHelper.reply(mRecvBuffer,insize,true), insize+16), mRemoteClient, boost::bind(&MainServer::handle_send, this, boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred ) ); } else { //If its not the dbus service sending commands than we must forward it somewhere. //Ask the routing core what peer to use. dynr::Peer dns=mRoutingCore.lookup(clientno,queryname); std::string dnsip=dns; std::string bestip=dns.myBestIp(); //Check if we already have a forwarder for the network we need to forward on. if (mForwarders.find(bestip) == mForwarders.end()) { //If on, than create one and register it with the boost::asio io service. try { boost::shared_ptr<DnsForwarder> tmpforwarder(new DnsForwarder(mIoService,mServerSocket,bestip)); mForwarders[bestip]=tmpforwarder; } catch (std::exception& e) { syslog(LOG_ERR, "FATAL config error, %s is not an IP address we can bind on",bestip.c_str()); throw ; } } //Get the propper forwarder. boost::shared_ptr<DnsForwarder> forwarder=mForwarders[bestip]; //Ask the propper forwarder to forward the packet to the found dns IP. forwarder->forward(mRecvBuffer,insize,dnsip,mRemoteClient); } } } else { syslog(LOG_WARNING, "Tiny packet, unable to get uniqueu id, ignoring.", queryname.c_str() ); } } server_start_receive(); }
String Locale::validationMessageTooShortText(unsigned valueLength, int minLength) { return queryString(WebLocalizedString::ValidationTooShort, convertToLocalizedNumber(String::number(valueLength)), convertToLocalizedNumber(String::number(minLength))); }
STATIC int runMovie(int frames, int numFields, LINEBUF *frameData, FILE *gnuPipe, char *command) { #if 0 register int j; int replay = TRUE, failed = FALSE, frame, nc; const char *xlabel, *ylabel; char *string; void (*oldhandler)(int); void (*nextFrame)(FILE *, int [4], int [4]); FILE *oldConsole; /* Steal the complex data space for our own devices */ double *yinitx = (double *)(yfita); /* Save original values */ for (j = 0; j < NA; j++) orig[j] = A[j]; while (replay) { double *yvalues; frame = 0; rewindBuf(frameData); do { nc = loadFrame(frameData, numFields); frame++; } while (nc != -1 && nc != numFields); if (nc == -1) { /* No files matched field specification */ printf("/** No frames found with %d variables **/\n", numFields); failed = TRUE; break; } if (numFields == 1) fprintf(gnuPipe, title, fitlist, A[fields[0]]); else fprintf(gnuPipe, "set title \"Frame %d of %d\"\n", frame, frames); /* Calculate reflectivities and package for gnuplot */ (*Constrain)(FALSE, A, nlayer); switch (*command) { case 'P': xlabel = zlabel; ylabel = dlabel; firstProfileFrame(gnuPipe, xspin, pspin); nextFrame = profileFrame; break; case 'D': case 'I': case 'R': yvalues = y4x; xlabel = qlabel; ylabel = rlabel; firstReflecFrame(gnuPipe, xspin, pspin); nextFrame = reflecFrame; if (*command == 'D') memcpy(yinitx, y4x, sizeof(double) * n4x * ncross); if (*command == 'I') yvalues = yinitx; break; default: case 'S': xlabel = zlabel; ylabel = dlabel; firstSDensityFrame(gnuPipe, xspin, pspin); nextFrame = sDensityFrame; break; } string = queryString("Specify an optional y range in format ymin:ymax ", NULL, 0); if (string != NULL) fprintf(gnuPipe, "set yrange [%s]\n", string); if (nextFrame == profileFrame) { string = queryString("Specify an optional theta range in format ymin:ymax ", NULL, 0); if (string != NULL) fprintf(gnuPipe, "set y2range [%s]\n", string); } fprintf(gnuPipe, "set xlabel \"%s\"\n", xlabel); fprintf(gnuPipe, "set ylabel \"%s\"\n", ylabel); fputs("replot\n", gnuPipe); fflush(gnuPipe); #ifndef DEBUGMALLOC oldhandler = signal(SIGINT, stopMovie); #endif abortMovie = FALSE; queryString("Wait for first frame, then press enter to start movie. ", NULL, 0); while (!abortMovie) { struct timeval now; gettimeofday(&now, NULL); do { nc = loadFrame(frameData, numFields); frame++; } while (nc != -1 && nc != numFields); if (nc == -1) /* No more frames */ break; (*Constrain)(FALSE, A, nlayer); if (nextFrame == reflecFrame) { genderiv4(q4x, yvalues, n4x, 0); if (*command == 'D') { register int n; for (n = 0; n < n4x * ncross; n++) #ifdef LINEAR_DATA y4x[n] /= yinitx[n]; #else y4x[n] -= yinitx[n]; #endif } else if (*command == 'I') { register int n; for (n = 0; n < n4x * ncross; n++) #ifdef LINEAR_DATA y4x[n] = yinitx[n] / y4x[n]; #else y4x[n] = yinitx[n] - y4x[n]; #endif } } else { ngenlayers(qcsq, d, rough, mu, nlayer, zint, rufint, nrough, proftyp); mgenlayers(qcmsq, dm, mrough, the, nlayer, zint, rufint, nrough, proftyp); gmagpro4(); } framePause(0.125, &now); (*nextFrame)(gnuPipe, xspin, pspin); if (numFields == 1) fprintf(gnuPipe, title, fitlist, A[fields[0]]); else fprintf(gnuPipe, "set title \"Frame %d of %d\"\n", frame, frames); fputs("replot\n", gnuPipe); fflush(gnuPipe); if (*command == 'I') memcpy(y4x, yinitx, sizeof(double) * n4x * ncross); } if (abortMovie) puts("Stopping the movie."); #ifndef DEBUGMALLOC /* Restore signal handlers */ signal(SIGINT, oldhandler); #endif string = queryString("Input \"R\" to replay. ", NULL, 0); if (!string || (*string != 'r' && *string != 'R')) replay = FALSE; } fputs("quit\n", gnuPipe); /* Restore original values */ for (j = 0; j < NA; j++) A[j] = orig[j]; /* (*Constrain)(FALSE, A, nlayer); */ return failed; #else return 0; #endif }
bool SearchSet::writeSet(QString filename) { QFile file(filename); if(!file.open(QIODevice::WriteOnly)){ return(false); } QDomDocument doc("SearchSet"); QDomElement root = doc.createElement("SearchSet"); doc.appendChild(root); QDomElement queryTag = doc.createElement("Query"); root.appendChild(queryTag); QDomText queryText = doc.createTextNode(queryString()); queryTag.appendChild(queryText); QDomElement maxDepthTag = doc.createElement("MaxDepth"); root.appendChild(maxDepthTag); QDomText maxDepthText = doc.createTextNode(QString::number(maxDepth())); maxDepthTag.appendChild(maxDepthText); QDomElement addUSRefsTag = doc.createElement("AddUSRefs"); root.appendChild(addUSRefsTag); QDomText addUSRefsText = doc.createTextNode(addUSRefs()?"1":"0"); addUSRefsTag.appendChild(addUSRefsText); QDomElement addRefByTag = doc.createElement("AddReferencedBy"); root.appendChild(addRefByTag); QDomText addRefByText = doc.createTextNode(addReferencedBy()?"1":"0"); addRefByTag.appendChild(addRefByText); QDomElement outstandingTag = doc.createElement("Outstanding"); root.appendChild(outstandingTag); QMapIterator<QString, SearchItem*> outStandingIterator(m_outstandingItems); while(outStandingIterator.hasNext()){ outStandingIterator.next(); outstandingTag.appendChild(outStandingIterator.value()->getDomElement(doc)); } QDomElement needRefByTag = doc.createElement("NeedReferencedBy"); root.appendChild(needRefByTag); QMapIterator<QString, SearchItem*> referencedByIterator(m_needReferencedBy); while(referencedByIterator.hasNext()){ referencedByIterator.next(); needRefByTag.appendChild(referencedByIterator.value()->getDomElement(doc)); } QDomElement downloadedTag = doc.createElement("Downloaded"); root.appendChild(downloadedTag); QMapIterator<QString, SearchItem*> downloadedIterator(m_downloadedItems); while(downloadedIterator.hasNext()){ downloadedIterator.next(); downloadedTag.appendChild(downloadedIterator.value()->getDomElement(doc)); } QTextStream stream(&file); stream << doc.toString() << endl; file.close(); emit modified(false); return(true); }
egl::Error FunctionsEGL::initialize(EGLNativeDisplayType nativeDisplay) { #define ANGLE_GET_PROC_OR_ERROR(MEMBER, NAME) \ if (!SetPtr(MEMBER, getProcAddress(#NAME))) \ { \ return egl::EglNotInitialized() << "Could not load EGL entry point " #NAME; \ } ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->bindAPIPtr, eglBindAPI); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->chooseConfigPtr, eglChooseConfig); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createContextPtr, eglCreateContext); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createPbufferSurfacePtr, eglCreatePbufferSurface); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createWindowSurfacePtr, eglCreateWindowSurface); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroyContextPtr, eglDestroyContext); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroySurfacePtr, eglDestroySurface); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getConfigAttribPtr, eglGetConfigAttrib); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getDisplayPtr, eglGetDisplay); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getErrorPtr, eglGetError); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->initializePtr, eglInitialize); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->makeCurrentPtr, eglMakeCurrent); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->queryStringPtr, eglQueryString); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->querySurfacePtr, eglQuerySurface); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->swapBuffersPtr, eglSwapBuffers); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->terminatePtr, eglTerminate); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->bindTexImagePtr, eglBindTexImage); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->releaseTexImagePtr, eglReleaseTexImage); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->swapIntervalPtr, eglSwapInterval); mEGLDisplay = mFnPtrs->getDisplayPtr(nativeDisplay); if (mEGLDisplay == EGL_NO_DISPLAY) { return egl::EglNotInitialized() << "Failed to get system egl display"; } if (mFnPtrs->initializePtr(mEGLDisplay, &majorVersion, &minorVersion) != EGL_TRUE) { return egl::Error(mFnPtrs->getErrorPtr(), "Failed to initialize system egl"); } if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 4)) { return egl::EglNotInitialized() << "Unsupported EGL version (require at least 1.4)."; } if (mFnPtrs->bindAPIPtr(EGL_OPENGL_ES_API) != EGL_TRUE) { return egl::Error(mFnPtrs->getErrorPtr(), "Failed to bind API in system egl"); } const char *extensions = queryString(EGL_EXTENSIONS); if (!extensions) { return egl::Error(mFnPtrs->getErrorPtr(), "Faild to query extensions in system egl"); } angle::SplitStringAlongWhitespace(extensions, &mExtensions); if (hasExtension("EGL_KHR_image_base")) { ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createImageKHRPtr, eglCreateImageKHR); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroyImageKHRPtr, eglDestroyImageKHR); } if (hasExtension("EGL_KHR_fence_sync")) { ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->clientWaitSyncKHRPtr, eglClientWaitSyncKHR); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->createSyncKHRPtr, eglCreateSyncKHR); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->destroySyncKHRPtr, eglDestroySyncKHR); ANGLE_GET_PROC_OR_ERROR(&mFnPtrs->getSyncAttribKHRPtr, eglGetSyncAttribKHR); } #undef ANGLE_GET_PROC_OR_ERROR return egl::NoError(); }
void magblocks4(void) { static char command[COMMANDLEN + 2]; static double undoFit[NA], undoFitUnc[NA]; int npnts, j; double qmax, qmin; /* Process command */ while (queryString("magblocks4% ", command, COMMANDLEN + 2) == NULL); caps(command); /* Spawn a command */ if (strcmp(command, "!") == 0 || strcmp(command, "!!") == 0) { bang(command); /* Print current directory */ } else if (strcmp(command, "PWD") == 0) { puts(currentDir); /* Change current directory */ } else if (strcmp(command, "CD") == 0) { cd(command); /* Help */ } else if ( strcmp(command, "?") == 0 || strcmp(command, "HE") == 0 ) { help(command + (*command == '?' ? 1 : 2)); /* Value of vacuum QCSQ */ } else if ( strcmp(command, "QCV") == 0 || strcmp(command, "VQC") == 0 ) { setVQCSQ(qcsq); /* Vacuum QCMSQ */ } else if ( strcmp(command, "QMV") == 0 || strcmp(command, "VQM") == 0 ) { setVMQCSQ(qcmsq); /* Value of vacuum linear absorption coefficient */ } else if ( strcmp(command, "MUV") == 0 || strcmp(command, "VMU") == 0 ) { setVMU(mu); /* Enter critical Q squared */ } else if (strncmp(command, "QC", 2) == 0) { setQCSQ(command + 2, qcsq, Dqcsq); /* Top magnetic critical Q squared */ } else if (strncmp(command, "QM", 2) == 0) { setMQCSQ(command + 2, qcmsq, Dqcmsq); /* Top length absorption coefficient */ } else if (strncmp(command, "MU", 2) == 0) { setMU(command + 2, mu, Dmu); /* Thicknesses of magnetic layers */ } else if (strncmp(command, "DM", 2) == 0) { setDM(command + 2, dm, Ddm); /* Delta lambda */ } else if (strcmp(command, "DL") == 0) { setLamdel(&lamdel); /* Delta theta */ } else if (strcmp(command, "DT") == 0) { setThedel(&thedel); /* Enter chemical thickness */ } else if (command[0] == 'D') { setD(command + 1, d, Dd); /* Chemical roughnesses */ } else if (strncmp(command, "RO", 2) == 0) { setRO(command + 2, rough, Drough); /* Magnetic roughnesses of layers */ } else if (strncmp(command, "RM", 2) == 0) { setMRO(command + 2, mrough, Dmrough); /* Theta angle of average moment in layer */ } else if (strncmp(command, "TH", 2) == 0) { setTHE(command + 2, the, Dthe); /* Wavelength */ } else if (strcmp(command, "WL") == 0) { setWavelength(&lambda); /* Guide angle */ } else if (strcmp(command, "EPS") == 0) { setGuideangle(&aguide); /* Number of layers */ } else if (strcmp(command, "NL") == 0) { if (!setNlayer(&nlayer)) /* Bug found Wed Jun 7 10:38:45 EDT 2000 by KOD */ /* since it starts at 0, correction for vacuum forces zero */ for (j = 1; j <= nlayer; j++) /* Set all absorptions to non-zero values */ if (mu[j] < *mu) mu[j] = *mu + 1.e-20; /* Add or remove layers */ } else if (strcmp(command, "AL") == 0 || strcmp(command, "RL") == 0) { modifyLayers(command); /* Copy layer */ } else if (strcmp(command, "CL") == 0) { copyLayer(command); /* Make superlattice */ } else if (strcmp(command, "SL") == 0) { superLayer(command); /* Maximum number of layers used to simulate rough interface */ } else if (strcmp(command, "NR") == 0) { if (!setNrough(&nrough)) { /* Generate interface profile */ if (nrough < 3) nrough = 11; if (proftyp[0] == 'H') gentanh(nrough, zint, rufint); else generf(nrough, zint, rufint); } /* Specify error function or hyperbolic tangent profile */ } else if (strcmp(command, "PR") == 0) { setProfile(proftyp, PROFTYPLEN + 2); /* Range of Q to be scanned */ } else if (strcmp(command, "QL") == 0) { if (!setQrange(&qmin, &qmax)) { qmina = qmin; qmaxa = qmax; qminb = qmin; qmaxb = qmax; qminc = qmin; qmaxc = qmax; qmind = qmin; qmaxd = qmax; } /* Number of points scanned */ } else if (strcmp(command, "NP") == 0) { if (!setNpnts(&npnts)) { npntsa = npnts; npntsb = npnts; npntsc = npnts; npntsd = npnts; } /* File for input data */ } else if (strcmp(command, "IF") == 0) { setFilename(infile, INFILELEN + 2); /* File for output data */ } else if (strcmp(command, "OF") == 0) { setFilename(outfile, OUTFILELEN + 2); /* File for parameters */ } else if (strcmp(command, "PF") == 0) { setFilename(parfile, PARFILELEN + 2); /* Polarization state */ } else if (strcmp(command, "PS") == 0) { setPolstat(polstat, POLSTATLEN + 2); /* Beam intensity */ } else if (strcmp(command, "BI") == 0) { setBeamIntens(&bmintns, &Dbmintns); /* Background intensity */ } else if (strcmp(command, "BK") == 0) { setBackground(&bki, &Dbki); /* Verify parameters by printing out */ } else if (strncmp(command, "VE", 2) == 0) { printLayers(command); /* Get data from file */ } else if (strcmp(command, "GD") == 0) { loadData(infile, xspin); /* Edit constraints */ } else if (strcmp(command, "EC") == 0) { constrainFunc newmodule; newmodule = newConstraints(constrainScript, constrainModule); if (newmodule != NULL) Constrain = newmodule; /* Reload constrain module */ } else if (strcmp(command, "LC") == 0) { Constrain = loadConstrain(constrainModule); /* Unload constrain module */ } else if (strcmp(command, "ULC") == 0) { Constrain = loadConstrain(NULL); /* Load parameters from parameter file */ } else if (strncmp(command, "LP", 2) == 0) { loadParms(command, parfile, constrainScript, constrainModule); /* Save parameters to parameter file */ } else if (strcmp(command, "SP") == 0) { parms(qcsq, qcmsq, d, dm, rough, mrough, mu, the, MAXLAY, &lambda, &lamdel, &thedel, &aguide, &nlayer, &qmina, &qmaxa, &npntsa, &qminb, &qmaxb, &npntsb, &qminc, &qmaxc, &npntsc, &qmind, &qmaxd, &npntsd, infile, outfile, &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp, polstat, DA, constrainScript, parfile, TRUE); /* List data and fit */ } else if (strcmp(command, "LID") == 0) { listData(); /* Generate logarithm of bare (unconvoluted) reflectivity */ /* or generate reflected amplitude */ } else if (strcmp(command,"GR") == 0 || strcmp(command, "GA") == 0) { genReflect(command); /* Generate and display layer profile */ } else if ( strcmp(command, "GLP") == 0 || strncmp(command, "SLP", 3) == 0 ) { genProfile(command); /* Save values in Q4X and YFIT to OUTFILE */ } else if (strcmp(command, "SV") == 0) { saveTemps(outfile, xspin, y4x, n4x, FALSE); /* Save values in Q4X and YFITA to OUTFILE */ } else if (strcmp(command, "SVA") == 0) { saveTemps(outfile, xspin, yfita, n4x, TRUE); /* Calculate derivative of reflectivity or spin asymmetry with respect */ /* to a fit parameter or save a fit to disk file */ } else if ( strcmp(command, "RD") == 0 || strcmp(command, "SRF") == 0 ) { printDerivs(command, npnts); /* Turn off all varied parameters */ } else if (strcmp(command, "VANONE") == 0) { clearLista(listA); /* Specify which parameters are to be varied in the reflectivity fit */ } else if (strncmp(command, "VA", 2) == 0) { varyParm(command); /* Calculate chi-squared */ } else if ( strcmp(command, "CSR") == 0 || strcmp(command, "CS") == 0 ) { calcChiSq(command); /* Fit reflectivity */ } else if (strncmp(command, "FR", 2) == 0) { for (j = 0; j < NA; j++) { undoFit[j] = A[j]; undoFitUnc[j] = DA[j]; } fitReflec(command); /* Undo last fit */ } else if (strcmp(command, "UF") == 0) { for (j = 0; j < NA; j++) { A[j] = undoFit[j]; DA[j] = undoFitUnc[j]; } /* Exit */ } else if ( strcmp(command, "EX") == 0 || strcmp(command, "EXS") == 0 ) { parms(qcsq, qcmsq, d, dm, rough, mrough, mu, the, MAXLAY, &lambda, &lamdel, &thedel, &aguide, &nlayer, &qmina, &qmaxa, &npntsa, &qminb, &qmaxb, &npntsb, &qminc, &qmaxc, &npntsc, &qmind, &qmaxd, &npntsd, infile, outfile, &bmintns, &bki, listA, &mfit, NA, &nrough, proftyp, polstat, DA, constrainScript, parfile, TRUE); /* Print elapsed CPU time */ if (strcmp(command, "EXS") == 0) system("ps"); exit(0); /* Exit without saving changes */ } else if (strcmp(command, "QU") == 0 || strcmp(command, "QUIT") == 0) { exit(0); /* Plot reflectivity on screen */ } else if (strncmp(command, "PRF", 3) == 0) { plotfit(command, xspin); /* Plot profile on screen */ } else if (strncmp(command, "PLP", 3) == 0) { plotprofile(command, xspin); /* Plot movie of reflectivity change from fit */ } else if (strncmp(command, "MVF", 3) == 0) { fitMovie(command, xspin, undoFit); /* Plot general movie from data file on screen */ } else if (strncmp(command, "MVX", 3) == 0) { arbitraryMovie(command, xspin); /* Plot movie of parameter on screen */ } else if (strncmp(command, "MV", 2) == 0) { oneParmMovie(command, xspin); /* Update constraints */ } else if (strcmp(command, "UC") == 0) { genshift(a, TRUE); /* constrain(a); */ (*Constrain)(FALSE, a, nlayer); genshift(a, FALSE); /* Determine number of points required for resolution extension */ } else if (strcmp(command, "RE") == 0) { calcExtend(xspin); #if 0 /* Dead code --- shadowed by "CD" command earlier */ /* Convolute input raw data set with instrumental resolution */ } else if (strcmp(command, "CD") == 0) { calcConvolve(polstat); #endif /* Send data to other processes. */ } else if (strcmp(command, "SEND") == 0) { ipc_send(command); /* Receive data to other processes. */ } else if (strcmp(command, "RECV") == 0) { ipc_recv(command); /* Faulty input */ } else ERROR("/** Unrecognized command **/"); }