int cgiMain() { #ifdef DEBUG LoadEnvironment(); #endif /* DEBUG */ /* Load a previously saved CGI scenario if that button has been pressed. */ if (cgiFormSubmitClicked("loadenvironment") == cgiFormSuccess) { LoadEnvironment(); } /* Set any new cookie requested. Must be done *before* outputting the content type. */ CookieSet(); /* Send the content type, letting the browser know this is HTML */ cgiHeaderContentType("text/html"); /* Top of the page */ fprintf(cgiOut, "<HTML><HEAD>\n"); fprintf(cgiOut, "<TITLE>cgic test</TITLE></HEAD>\n"); fprintf(cgiOut, "<BODY><H1>cgic test</H1>\n"); /* If a submit button has already been clicked, act on the submission of the form. */ if ((cgiFormSubmitClicked("testcgic") == cgiFormSuccess) || cgiFormSubmitClicked("saveenvironment") == cgiFormSuccess) { HandleSubmit(); fprintf(cgiOut, "<hr>\n"); } /* Now show the form */ ShowForm(); /* Finish up the page */ fprintf(cgiOut, "</BODY></HTML>\n"); return 0; }
int MakeMain::Run(int argc, char **argv, char **env) { char *p = getenv("MAKEFLAGS"); if (p) { Variable *v = new Variable("MAKEFLAGS", p, Variable::f_recursive, Variable::o_environ); *VariableContainer::Instance() += v; p = getenv("MAKEOVERRIDES"); if (p) { Variable *v = new Variable("MAKEOVERRIDES", p, Variable::f_recursive, Variable::o_environ); *VariableContainer::Instance() += v; } Eval r(v->GetValue(), false); std::string cmdLine = r.Evaluate(); Dispatch(cmdLine.c_str()); } if (!switchParser.Parse(&argc, argv) || help.GetValue() || help2.GetValue()) { Utils::banner(argv[0]); Utils::usage(argv[0], usageText); } if (dir.GetValue().size()) { cwd = OS::GetWorkingDir(); if (!OS::SetWorkingDir(dir.GetValue())) { std::cout << "Cannot set working dir to: " << dir.GetValue() << std::endl; return 2; } } if (printDir.GetValue()) { std::cout << OS::GetWorkingDir() << std::endl; } if (cancelKeep.GetValue()) { cancelKeep.SetValue(false); keepGoing.SetValue(false); } bool done = false; Eval::Init(); Eval::SetWarnings(warnUndef.GetValue()); while (!done && !Eval::GetErrCount()) { VariableContainer::Instance()->Clear(); RuleContainer::Instance()->Clear(); Include::Instance()->Clear(); Maker::ClearFirstGoal(); LoadEnvironment(env); LoadCmdDefines(); SetVariable("MAKE", argv[0], Variable::o_environ, false); Variable *v = VariableContainer::Instance()->Lookup("SHELL"); if (!v) { v = VariableContainer::Instance()->Lookup("COMSPEC"); if (!v) v = VariableContainer::Instance()->Lookup("ComSpec"); if (v) { std::string val = v->GetValue(); SetVariable("SHELL", val, Variable::o_environ, true); } } std::string goals; for (int i=1; i < argc; i++) { if (goals.size()) goals += " "; goals += argv[i]; } SetVariable("MAKECMDGOALS", goals, Variable::o_command_line, false); SetMakeFlags(); if (restarts) { std::strstream str; std::string temp; str << restarts; str >> temp; SetVariable("MAKE_RESTARTS", temp, Variable::o_command_line, false); } v = VariableContainer::Instance()->Lookup("MAKE_LEVEL"); if (!v) { SetVariable("MAKE_LEVEL", "0", Variable::o_environ, true); } else { std::strstream str; std::string temp; str << v->GetValue(); int n; str >> n; n++; str << n; str >> temp; v->SetValue(temp); } SetVariable(".FEATURES","second-expansion order-only target-specific", Variable::o_environ, false); SetVariable(".DEFAULT_GOAL","", Variable::o_environ, false); SetVariable(".INCLUDE_DIRS",includes.GetValue(), Variable::o_command_line, false); SetVariable("VPATH",includes.GetValue(), Variable::o_environ, false); SetInternalVars(); v = VariableContainer::Instance()->Lookup("MAKEFILES"); if (v) { v->SetExport(true); Include::Instance()->AddFileList(v->GetValue(), true, true); } Rule *rule = new Rule(".SUFFIXES", ".c .o .cpp .nas .asm", "", new Command("", 0), "", 0, false); RuleList *ruleList = new RuleList(".SUFFIXES"); ruleList->Add(rule, false); *RuleContainer::Instance() += ruleList; std::string files = specifiedFiles.GetValue(); if (!files.size()) files = "makefile"; Include::Instance()->AddFileList(files, false, false); SetupImplicit(); RuleContainer::Instance()->SecondaryEval(); done = !Include::Instance()->MakeMakefiles(silent.GetValue()); if (!done) restarts++; } if (showDatabase.GetValue()) ShowDatabase(); int rv = 0; if (Eval::GetErrCount()) { rv = 2; } else { bool xsilent = silent.GetValue(); bool xignore = ignoreErrors.GetValue(); bool xdontrun = displayOnly.GetValue(); bool xtouch = touch.GetValue(); xdontrun |= xtouch || query.GetValue(); xsilent |= xtouch || query.GetValue(); Maker maker(xsilent, xdontrun, xignore, xtouch, rebuild.GetValue(), newFiles.GetValue(), oldFiles.GetValue()); for (int i = 1; i < argc; i++) { maker.AddGoal(argv[i]); } if (maker.CreateDependencyTree()) { rv = maker.RunCommands(keepGoing.GetValue()); if (query.GetValue() && rv == 0) rv = maker.HasCommands() ? 1 : 0; } else { rv = 2; } } if (dir.GetValue().size()) { OS::SetWorkingDir(cwd); } if (printDir.GetValue()) { std::cout << OS::GetWorkingDir() << std::endl; } return rv; }
void QtOSGViewer::_CreateActions() { exitAct = new QAction(tr("E&xit"), this); exitAct->setShortcut(tr("Ctrl+Q")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); loadAct = new QAction(QIcon(":/images/open.png"),tr("L&oad..."), this); loadAct->setShortcut(tr("Ctrl+L")); connect(loadAct, SIGNAL(triggered()), this, SLOT(LoadEnvironment())); importAct = new QAction(QIcon(":/images/Import.png"),tr("I&mport..."), this); importAct->setShortcut(tr("Ctrl+I")); connect(importAct, SIGNAL(triggered()), this, SLOT(ImportEnvironment())); saveAct = new QAction(QIcon(":/images/save.png"),tr("S&ave..."), this); saveAct->setShortcut(tr("Ctrl+S")); connect(saveAct, SIGNAL(triggered()), this, SLOT(SaveEnvironment())); viewCamAct = new QAction(tr("View Camera Params"), this); viewColAct = new QAction(tr("View Collision Word"), this); pubilshAct = new QAction(tr("Pubilsh Bodies Anytimes"), this); printAct = new QAction(tr("Print Debug Output"), this); showAct = new QAction(tr("Show Framerate"), this); playAct = new QAction(QIcon(":/images/play.png"),tr("Play"), this); stopAct = new QAction(QIcon(":/images/stop.png"),tr("Stop"), this); recordAct = new QAction(tr("Record V&ideo"), this); odeAct = new QAction(tr("ODE Dynamic Simulation"), this); odeAct->setCheckable(true); selfAct = new QAction(tr("Self Collision"), this); selfAct->setCheckable(true); applyAct = new QAction(tr("Apply Gravity"), this); applyAct->setCheckable(true); applyAct->setChecked(true); aboutAct = new QAction(tr("About"), this); pauseAct = new QAction(QIcon(":/images/pause.png"),tr("Pause"), this); puntAct = new QAction(QIcon(":/images/no_edit.png"),tr("Pointer"), this); AxesAct = new QAction(QIcon(":/images/axes.png"),tr("Axes"), this); AxesAct->setCheckable(true); connect(AxesAct, SIGNAL(triggered()), this, SLOT(axes())); houseAct = new QAction(QIcon(":/images/house.png"),tr("Home"), this); connect(houseAct, SIGNAL(triggered()),this,SLOT(ResetViewToHome())); smoothAct = new QAction(QIcon(":/images/smooth.png"),tr("Smooth"), this); connect(smoothAct, SIGNAL(triggered()), this, SLOT(polygonMode())); flatAct = new QAction(QIcon(":/images/flat.png"),tr("Flat"), this); connect(flatAct, SIGNAL(triggered()), this, SLOT(polygonMode())); lightAct = new QAction(QIcon(":/images/lighton.png"),tr("Light"), this); lightAct->setCheckable(true); connect(lightAct, SIGNAL(triggered()), this, SLOT(_ProcessLightChange())); wireAct = new QAction(QIcon(":/images/wire.png"),tr("Wire"), this); connect(wireAct, SIGNAL(triggered()), this, SLOT(polygonMode())); facesAct = new QAction(QIcon(":/images/faces.png"),tr("Cull face"), this); facesAct->setCheckable(true); connect(facesAct, SIGNAL(triggered()), this, SLOT(_ProcessFacesModeChange())); bboxAct = new QAction(QIcon(":/images/bbox.png"),tr("Poligon"), this); bboxAct->setCheckable(true); connect(bboxAct, SIGNAL(triggered()), this, SLOT(_ProcessBoundingBox())); connect(&_timer, SIGNAL(timeout()), this, SLOT(_Refresh())); _timer.start(1000/60); // ms }