void Fidelity::Engine::SimulationXmlReader::readFSX() { while(!atEnd()) { readNext(); if(isEndElement()) { break; } // Evaluate child tags if(isStartElement()) { // We expect these children for the root tag if (name() == "description") { readDescription(); } else if (name() == "globals") { readGlobals(); } else if (name() == "engine") { readEngine(); } else if (name() == "plugins") { readPlugins(); } else if (name() == "setup") { readSetup(); } else { unknownElement(); } } } }
int main(int argc, char **argv) { GDISPLAY *video, *feedback; GPOINT *gPoints; XEvent event; WSETUP *wayv; WGESTURE *gaction; MATRIX *gesture; VECTOR *vector; int gPosition = 0; char *file; printf("wayV version %s\n", VERSION); /* Decide what configuration file to open */ if(argc != 2) file = strdup(SETUPFILE); else file = strdup(argv[1]); if((wayv = readSetup(file)) == NULL) exit(BAD); // writeSetup(wayv, SETUPOUT); /* Setup the display */ if(!(video = setupDrawable(wayv->pretty, wayv->pretty->window, argc, argv))) { printf("Cannot connected to X server\n"); return BAD; } /* Setup the mouse/pointer as an input device */ setupPointer(wayv, video); /* Allocate memory to store the gesture points */ gPoints = setupGPoints(wayv->universe->maxgpoints); if(wayv->pretty->display[0] == 'i') handleDrawableWindow(video, MAP); setupSignals(); /* Process the events */ while(1) { XNextEvent(video->display, &event); switch(event.type) { case MotionNotify: if(gPosition < wayv->universe->maxgpoints) { gPoints[gPosition].x = event.xmotion.x; gPoints[gPosition].y = event.xmotion.y; if(wayv->pretty->display[0] == 'y') writePixels(video, (int)gPoints[gPosition-1].x - GDEF_BORDER, (int)gPoints[gPosition-1].y - GDEF_BORDER, (int)gPoints[gPosition].x - GDEF_BORDER, (int)gPoints[gPosition].y - GDEF_BORDER); else if(wayv->pretty->display[0] == 'i') writePixels(video, (int)gPoints[gPosition-1].x, (int)gPoints[gPosition-1].y, (int)gPoints[gPosition].x, (int)gPoints[gPosition].y); gPosition++; } break; case ButtonPress: if(wayv->pretty->display[0] == 'y') handleDrawableWindow(video, MAP); gPosition = 0; gPoints[gPosition].x = event.xbutton.x; gPoints[gPosition].y = event.xbutton.y; gPosition++; break; case ButtonRelease: if(wayv->pretty->display[0] == 'y') handleDrawableWindow(video, UNMAP); gPoints[gPosition].x = GEND; gPoints[gPosition].y = GEND; gesture = gridGPoints(gPoints, wayv->universe->xgrid, wayv->universe->ygrid); vector = vectGPoints(gPoints, wayv->universe->xgrid, wayv->universe->ygrid, wayv->universe->maxvectors); printf("\n\n=======Gesture======="); printMat(gesture); printVec(vector); if(wayv->pretty->display[0] != 'n') handleDrawableWindow(video, CLEAR); if((gaction = findGesture(wayv, gesture, vector, wayv->think))) { printf("Is Action : %s\n", gaction->name); performAction(wayv, gaction, video, gPoints); /* Fork off program to handle feedback window */ if(wayv->pretty->feedback[0] == 'y' && fork() == 0) { feedback = writeText(gaction->action); waitMilli(wayv->pretty->wait); handleDrawableWindow(feedback, DESTROY); close(ConnectionNumber(video->display)); setsid(); exit(BAD); } } freeMat(gesture); free(vector); break; case ClientMessage: if(event.xclient.data.l[0] == video->wmdelete) { closeDisplay(video); exit(GOOD); } break; } } }
void gams::UGINIT(int argc, char * argv[]){ float zero=0; timest_(zero); cout.sync_with_stdio(); GINIT(); new AMSJob(); AMSJob::gethead()->data(); GCTLIT.ITCKOV=1; GCPHYS.IRAYL=1; integer mone=-1; GFFGO(); AMSJob::gethead()->udata(); #ifdef __CORBA__ AMSJob::gethead()->add( new AMSProducer(argc,argv,PRODFFKEY.Debug)); AMSProducer::gethead()->sendid(); AMSJob::gethead()->setjobtype(AMSJob::Production); #endif // Geant initialization GZINIT(); GPART(); GPIONS(4); int itrt=4; gstran_(itrt,CCFFKEY.StrCharge,CCFFKEY.StrMass); #ifdef __DB__ initDB(); lms = &dbout; readSetup(); if ((AMSFFKEY.Read%2) == 1) lms -> CheckConstants(); #else AMSgmat::amsmat(); AMSgtmed::amstmed(); AMSgvolume::amsgeom(); // GRFILE(1,"geomstr.dat","Q"); // GROUT("VOLU",1," "); // GREND(1); #endif //GRFILE(1,"geomstr.dat","N"); //GROUT("VOLU",1," "); //GREND(1); AMSJob::map(); AMSJob::gethead()->init(); #ifdef __CORBA__ AMSTimeID * phead=AMSJob::gethead()->gettimestructure(); AMSTimeID * down=(AMSTimeID *)phead->down(); int nb=down->GetNbytes(); AMSProducer::gethead()->getRunEventInfo(); #endif if(!AMSJob::gethead()->isProduction())AMSJob::gethead()->uhinit(); // AMSJob::gethead()->urinit(); #ifndef __BATCH__ #ifdef __G4AMS__ if(MISCFFKEY.G3On) #endif GDINIT(); #endif #ifdef __DB__ if ((AMSFFKEY.Read%2) == 1) dbout.CheckCommons(); writeSetup(); // int n = AMSJob::gethead()->FillTDVTable(); // ooStatus rstatus = dbout.FillTDV(n); // if (rstatus != oocSuccess) cerr<<"uginit_ -W- FillTDV"<<endl; AMSJob::gethead() -> seteventRtype(eventR); #endif #ifdef __G4AMS__ if(MISCFFKEY.G4On)g4ams::G4INIT(); #endif GPHYSI(); AMSJob::map(1); }