int main(int argc, char *argv[]) { startCatchingSignals(); { astlocMarker markAstLoc(0, "<internal>"); initFlags(); initChplProgram(); initPrimitive(); initPrimitiveTypes(); initTheProgram(); setupOrderedGlobals(argv[0]); compute_program_name_loc(argv[0], &(arg_state.program_name), &(arg_state.program_loc)); process_args(&arg_state, argc, argv); initCompilerGlobals(); // must follow argument parsing setupDependentVars(); setupModulePaths(); recordCodeGenStrings(argc, argv); } // astlocMarker scope printStuff(argv[0]); if (rungdb) runCompilerInGDB(argc, argv); if (fdump_html || strcmp(log_flags, "")) init_logs(); compile_all(); if (fEnableTimers) { printf("timer 1: %8.3lf\n", timer1.elapsed()); printf("timer 2: %8.3lf\n", timer2.elapsed()); printf("timer 3: %8.3lf\n", timer3.elapsed()); printf("timer 4: %8.3lf\n", timer4.elapsed()); printf("timer 5: %8.3lf\n", timer5.elapsed()); } free_args(&arg_state); clean_exit(0); return 0; }
void printCon(struct node* arg_head) { struct node* n = arg_head; // -0x10(ebp) uint32_t i = 0; // -0x0c(ebp) if(con_cnt == 0) { puts("Add contacts first"); return; } puts("Contacts:"); for(i=0; i<9; i++, n += sizeof(struct node)) { if(n->in_use) { printStuff(n->name, n->desc_len, n->phone, n->desc); } } }
int main(int argc, char* argv[]) { PhaseTracker tracker; startCatchingSignals(); { astlocMarker markAstLoc(0, "<internal>"); tracker.StartPhase("init"); init_args(&sArgState, argv[0]); fDocs = (strcmp(sArgState.program_name, "chpldoc") == 0) ? true : false; fUseIPE = (strcmp(sArgState.program_name, "chpl-ipe") == 0) ? true : false; // Initialize the arguments for argument state. If chpldoc, use the docs // specific arguments. Otherwise, use the regular arguments. if (fDocs) { init_arg_desc(&sArgState, docs_arg_desc); } else { init_arg_desc(&sArgState, arg_desc); } initFlags(); initRootModule(); initPrimitive(); initPrimitiveTypes(); DefExpr* objectClass = defineObjectClass(); initChplProgram(objectClass); initStringLiteralModule(); process_args(&sArgState, argc, argv); setupChplGlobals(argv[0]); postprocess_args(); initCompilerGlobals(); // must follow argument parsing setupModulePaths(); recordCodeGenStrings(argc, argv); } // astlocMarker scope if (fUseIPE == false) printStuff(argv[0]); if (fRungdb) runCompilerInGDB(argc, argv); if (fRunlldb) runCompilerInLLDB(argc, argv); addSourceFiles(sArgState.nfile_arguments, sArgState.file_argument); if (fUseIPE == false) { runPasses(tracker, fDocs); } else { ipeRun(); } tracker.StartPhase("driverCleanup"); free_args(&sArgState); tracker.Stop(); if (printPasses == true || printPassesFile != NULL) { tracker.ReportPass(); tracker.ReportTotal(); tracker.ReportRollup(); } if (printPassesFile != NULL) { fclose(printPassesFile); } clean_exit(0); return 0; }
CoMD_return CoMD_lib(CoMD_input *inputStruct) { // Prolog //profileStart(totalTimer); //initSubsystems(); //Command cmd = parseCommandLine(argc, argv); Command cmd = parseInputStruct(inputStruct); //Ignore stressSuffix for now SimFlat* sim = initSimulation(cmd); Validate* validate = initValidate(sim); // atom counts, energy // This is the CoMD main loop const int nSteps = sim->nSteps; const int printRate = sim->printRate; double avgStress[9]; int stressi; int iStep; for(stressi=0;stressi<9;stressi++) avgStress[stressi]=0; for (iStep=0; iStep<nSteps;iStep++) { sumAtoms(sim); //Find and intercept these to write to the struct //printThings(sim, iStep, getElapsedTime(timestepTimer)); printTensor(iStep, sim->defInfo->stress); timestep(sim, 1, sim->dt); if(iStep>500){ for(stressi=0;stressi<9;stressi++) avgStress[stressi]+=sim->defInfo->stress[stressi]/(nSteps-500); } } sumAtoms(sim); //Find and intercept //printThings(sim, iStep, getElapsedTime(timestepTimer)); CoMD_return retVal = printStuff(iStep, sim, avgStress); // Epilog //validateResult(validate, sim); //profileStop(totalTimer); /* if (sim->pot->dfEmbed!=NULL) { free(sim->pot->dfEmbed); sim->pot->dfEmbed=NULL; } if (sim->pot->rhobar!=NULL) { free(sim->pot->rhobar); sim->pot->rhobar=NULL; } if (sim->pot->forceExchangeData!=NULL) { free(sim->pot->forceExchangeData); sim->pot->forceExchangeData=NULL; }*/ destroySimulation(&sim); comdFree(validate); //finalizeSubsystems();//??? //destroyParallel(); //??? return retVal; }
int main(int argc, char* argv[]) { PhaseTracker tracker; startCatchingSignals(); { astlocMarker markAstLoc(0, "<internal>"); tracker.StartPhase("init"); initFlags(); initChplProgram(); initPrimitive(); initPrimitiveTypes(); initTheProgram(); setupOrderedGlobals(argv[0]); compute_program_name_loc(argv[0], &(arg_state.program_name), &(arg_state.program_loc)); process_args(&arg_state, argc, argv); initCompilerGlobals(); // must follow argument parsing setupDependentVars(); setupModulePaths(); recordCodeGenStrings(argc, argv); } // astlocMarker scope printStuff(argv[0]); if (rungdb) runCompilerInGDB(argc, argv); if (runlldb) runCompilerInLLDB(argc, argv); testInputFiles(arg_state.nfile_arguments, arg_state.file_argument); if (strcmp(chplBinaryName, "chpldoc") == 0) fDocs = true; runPasses(tracker); tracker.StartPhase("driverCleanup"); if (fEnableTimers) { printf("timer 1: %8.3lf\n", timer1.elapsedSecs()); printf("timer 2: %8.3lf\n", timer2.elapsedSecs()); printf("timer 3: %8.3lf\n", timer3.elapsedSecs()); printf("timer 4: %8.3lf\n", timer4.elapsedSecs()); printf("timer 5: %8.3lf\n", timer5.elapsedSecs()); } free_args(&arg_state); tracker.Stop(); if (printPasses == true || printPassesFile != NULL) { tracker.ReportPass(); tracker.ReportTotal(); tracker.ReportRollup(); } if (printPassesFile != NULL) { fclose(printPassesFile); } clean_exit(0); return 0; }
int main() { printStuff(); return 0; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), sentBytes(NULL) { ui->setupUi(this); //---- Menu Configuration ---- machineGroup = new QActionGroup(this); machineGroup->addAction(ui->actionScorpio); machineGroup->addAction(ui->actionQuadcopter); ui->actionScorpio->setChecked(true); viewGroup = new QActionGroup(this); viewGroup->addAction(ui->actionTracking); viewGroup->addAction(ui->actionTracking); viewGroup->addAction(ui->actionManual_Control); viewGroup->addAction(ui->actionCommand_Center); ui->actionCommand_Center->setChecked(true); //---- ---- //---- Statusbar ---- serialConnected=false; gpsFix=false; joystickConnected=false; gpsFooterStat = new QLabel(this); connectedFooterStat = new QLabel(this); joystickFooterStat = new QLabel(this); aliveFooterState = new QLabel(this); connectedGPSFooterStat = new QLabel(this); ui->statusBar->addPermanentWidget(gpsFooterStat); ui->statusBar->addPermanentWidget(connectedFooterStat); ui->statusBar->addPermanentWidget(aliveFooterState); ui->statusBar->addPermanentWidget(joystickFooterStat); ui->statusBar->addPermanentWidget(connectedGPSFooterStat); //---- ---- //---- Compass Graphics View ---- compassPixmap = new QPixmap(":/img/CompassSquare150.png"); ui->compassViewLabel->setPixmap(rotatePixmap(compassPixmap,0)); //---- ---- //---- Speedometer Graphics View ---- ui->speedometerViewLabel->setPixmap(updateSpeedIndicator(0)); //---- ---- //---- Steer Graphics View ---- ui->steerGraphicsView->setStyleSheet("background: transparent"); steerGraphicsScene = new QGraphicsScene(this); QBrush brush(QColor::fromRgb(59,174,227)); steerRailIndicator = steerGraphicsScene->addRect(0,22.5,148,15,Qt::NoPen,brush); brush.setColor(Qt::red); QPen pen(Qt::black); pen.setWidth(2); steerIndicator = steerGraphicsScene->addRect(67.5,5,15,50,Qt::NoPen,brush); updateSteerIndicator(-100); ui->steerGraphicsView->setScene(steerGraphicsScene); //---- ---- //---- Tracker View ---- ui->trackerGraphicsView-> setBackgroundBrush(QBrush(QColor::fromRgb(237,200,90),Qt::Dense4Pattern)); trackerScene = new QGraphicsScene(this); ui->trackerGraphicsView->setScene(trackerScene); QPolygonF NorthArrow; NorthArrow.append(QPointF(-5.,0)); NorthArrow.append(QPointF(0.,-20)); NorthArrow.append(QPointF(5.,0)); NorthArrow.append(QPointF(0.,-5.)); NorthArrow.append(QPointF(-5.,0)); brush.setColor(Qt::black); northArrowGraphicsItem = trackerScene->addPolygon(NorthArrow,Qt::NoPen,brush); northArrowGraphicsItem->setPos(800,10); northArrowGraphicsItem->setFlag(QGraphicsItem::ItemIgnoresTransformations); //Scorpio Graphics Item scorpio2DGraphicsItem = new GraphicsItemScorpio; trackerScene->addItem(scorpio2DGraphicsItem); scorpio2DGraphicsItem->setPos(500,150); wgs2utm(BASE_LATITUDE, BASE_LONGITUDE,&baseEasting,&baseNorthing, &baseUTMZone); lastPoKnown=false; //---- ---- brush.setColor(QColor(255, 0, 0, 180)); targetMarker = trackerScene->addEllipse(400,100,10,10,pen,brush); brush.setColor(QColor(255, 255, 0, 180)); baseMarker = trackerScene->addRect(0,0,10,10,pen,brush); //---- ---- connect(&timerTracker,SIGNAL(timeout()),this,SLOT(updateTrackerGraphics())); //TODO: another sig-slot for updating scene to zoom to fit timerTracker.start(100); //---- ---- ---- ---- //---- Joystick Initialization ---- myJoystick = new RR_SDLJoystick; myJoystickData = new RR_SDLJoystickData_t; QString *joystickInitError; if(!myJoystick->initJoystick(myJoystickData, joystickInitError)){ ui->plainTextEdit->insertPlainText("Error Connecting Joystick"); //TODO: Fix so that the insertPlainText takes the error code from Joystick Object. } else{ ui->plainTextEdit->insertPlainText("Joystick Connected!"); joystickConnected=true; connect(&timerJoystick,SIGNAL(timeout()),myJoystick ,SLOT(pollJoystick())); timerJoystick.start(150); } connect(myJoystick,SIGNAL(gotJoystick()),this,SLOT(updateGaugeIndicators())); connect(myJoystick,SIGNAL(gotJoystick()),this,SLOT(updateJoystickTelemetry())); //---- ---- //---- Serial ---- serialPort = new RR_QtSerial(57600,"COM26"); connect(&timerSerial,SIGNAL(timeout()), serialPort,SLOT(receiveBytes())); connect(ui->actionConnect,SIGNAL(triggered(bool)),serialPort,SLOT(switchSerial(bool))); connect(serialPort,SIGNAL(gotConnected(bool)),this,SLOT(updateSerialStatusBar(bool))); connect(serialPort,SIGNAL(gotConnected(bool)),ui->actionConnect,SLOT(setChecked(bool))); timerSerial.start(150); //----- GPS ------ serialGPSPort = new RR_QtSerial(57600,"COM19"); connect(&timerGPSSerial, SIGNAL(timeout()),serialGPSPort, SLOT(receiveBytes())); connect(ui->actionConnect_GPS, SIGNAL(triggered(bool)), serialGPSPort, SLOT(switchSerial(bool))); connect(serialGPSPort,SIGNAL(gotConnected(bool)),this,SLOT(updateGPSSerialStatusBar(bool))); connect(serialGPSPort,SIGNAL(gotConnected(bool)),ui->actionConnect_GPS,SLOT(setChecked(bool))); timerGPSSerial.start(150); //------- //---- GPS Data Serialization ---- receivedGPSData = new RR_QtTelemetryReceivedData_t; sentGPSData = new RR_QtTelemetrySentData_t; gps = new RR_QtTelemetry(receivedGPSData,sentGPSData); receivedGPSData->fix=false; connect(serialGPSPort,SIGNAL(gotBytes(QByteArray*)),gps,SLOT(decodeBytes(QByteArray*))); connect(gps,SIGNAL(gotDecodedMessage()),this,SLOT(updateGPSData())); //---- ---- //---- Telemetry ---- receivedTelemetryData = new RR_QtTelemetryReceivedData_t; sentTelemetryData = new RR_QtTelemetrySentData_t; telemetry = new RR_QtTelemetry(receivedTelemetryData,sentTelemetryData); receivedTelemetryData->fix=false; connect(this,SIGNAL(gotJoystickMessage()),telemetry,SLOT(sendMessage())); connect(telemetry,SIGNAL(gotEncodedBytes(QByteArray*)),serialPort,SLOT(sendBytes(QByteArray*))); connect(serialPort,SIGNAL(gotBytes(QByteArray*)),telemetry,SLOT(decodeBytes(QByteArray*))); connect(telemetry,SIGNAL(gotDecodedMessage()),this,SLOT(updateTelemetryGraphics())); //---- ---- //---- Text Display ---- connect(&timerSerialPrint,SIGNAL(timeout()),this, SLOT(printStuff())); timerSerialPrint.start(ui->printfreSlider->value()); connect(ui->printfreSlider, SIGNAL(sliderMoved(int)),&timerSerialPrint,SLOT(start(int))); connect(ui->clearPushButton,SIGNAL(clicked()),ui->plainTextEdit,SLOT(clear())); connect(ui->printfreSlider,SIGNAL(sliderMoved(int)),this,SLOT(setPrintFrequencyText())); setPrintFrequencyText(); //---- ---- //---- Test and Debug ---- connect(&timerTestDebug,SIGNAL(timeout()),this,SLOT(testdebug())); timerTestDebug.start(1000); //---- ---- connect(&timerStatusBarUpdate, SIGNAL(timeout()), this, SLOT(updateGPSStatbar())); timerStatusBarUpdate.start(500); //Pulse Check connect(&timerPulseCheck,SIGNAL(timeout()), this, SLOT(checkPulse())); pulseSamplingTime = 5000; timerPulseCheck.start(pulseSamplingTime); }