void ZoneServerImplementation::shutdown() { //datagramService->setHandler(NULL); stopManagers(); info("shutting down zones", true); for (int i = 0; i < zones->size(); ++i) { ManagedReference<Zone*> zone = zones->get(i); if (zone != NULL) { zone->stopManagers(); //info("zone references " + String::valueOf(zone->getReferenceCount()), true); } } zones->removeAll(); info("zones shut down", true); printInfo(); datagramService = NULL; info("shut down complete", true); }
/** * Laedt, falls moeglich, ein Spiel. Das Spiel wird im GameState gespeichert, dieser muss also ein Pointer sein. */ void loadGame(struct GameState *gs, char *filename) { char fullFilename[255]; FILE *file; sprintf(fullFilename, "savegames/%s.sav", filename); // kompletten Dateinamen erzeugen file = fopen(fullFilename, "r"); // Datei oeffnen. r = read if (file == NULL) { printError("Oeffnen der Savegame-Datei fehlgeschlagen.\n"); return; } char ai0 = (*gs).ai0; char ai1 = (*gs).ai1; size_t size1 = fread(gs, sizeof(*gs), 1, file); (*gs).ai0 = ai0; (*gs).ai1 = ai1; size_t size2 = fread(history, sizeof(history) * sizeof(char), 1, file); fclose(file); // Datei schliessen. if (size1 == 0 || size2 == 0) { printError("Laden fehlgeschlagen: Der Inhalt des Savegames ist inkompatibel.\n"); } else { printInfo("Spiel geladen.\n"); } }
int main(int argc, char **argv) { device = &freenect.createDevice<MyFreenectDevice>(0); device->startVideo(); device->startDepth(); glutInit(&argc, argv); glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); glutInitWindowSize(640, 480); glutInitWindowPosition(0, 0); window = glutCreateWindow("LibFreenect"); glClearColor(0.45f, 0.45f, 0.45f, 0.0f); glEnable(GL_DEPTH_TEST); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0.0f); glMatrixMode(GL_PROJECTION); gluPerspective(50.0, 1.0, 900.0, 11000.0); glutDisplayFunc(&DrawGLScene); glutIdleFunc(&idleGLScene); glutReshapeFunc(&resizeGLScene); glutKeyboardFunc(&keyPressed); glutMotionFunc(&mouseMoved); glutMouseFunc(&mouseButtonPressed); printInfo(); glutMainLoop(); return 0; }
void VoxelGridGPU::setUniformCellSizeFromResolutionAndMapping(float width, float height, int resX, int resY, int resZ) { if ( ( width / resX ) != ( height / resY) ) { DEBUGLOG->log( "Resolution and dimensions are in an unequal ratio. Cannot compute uniform cell size"); return; } this->width = width; this->height = height; this->resX = resX; this->resY = resY; this->resZ = resZ; this->cellSize = ( width / resX ); this->depth = this->cellSize * resZ; computeProjectionMatrix(); computeWorldToVoxel(); printInfo(); }
int main(int argc, char *argv[]) { char *path = "."; if (argc >= 2) { path = argv[1]; } DIR *dp = opendir(path); if (dp == NULL) { perror("Open file"); exit(1); } chdir(argv[1]); struct dirent *dirbuf; struct stat statbuf; char *filename[N]; int index = 0; while ((dirbuf = readdir(dp)) != NULL) { if ((strcmp(dirbuf->d_name, ".") == 0) || (strcmp(dirbuf->d_name, "..") == 0)) { continue; } filename[index] = (char *)calloc(strlen(dirbuf->d_name), sizeof(char)); strcpy(filename[index], dirbuf->d_name); index++; } qsort(filename, index - 1, sizeof(filename[0]), cmp); for (int i = 0; i < index; i++) { printInfo(filename[i]); } closedir(dp); return 0; }
void literalTypes() { std::cout << "##############################################################\n"; std::cout << " Literal Types:\n"; std::cout << "##############################################################\n"; printInfo("1", 1); printInfo("1U", 1U); printInfo("1L", 1L); printInfo("0xFF", 0xFF); printInfo("0xFFFF", 0xFFFFF); printInfo("0xFFFFFFFF", 0xFFFFFFFF); printInfo("0xFFFFFFFFFFFFFFFF", 0xFFFFFFFFFFFFFFFF); printInfo("1LLU", 1LLU); printInfo("1.2L", 1.2L); printInfo("1.2", 1.2); }
Renderer::Renderer(const RenderContext &context) : m_currentFBOIndex(false), m_gBuffer(NULL), m_shaderGBuffer(NULL), m_ping(NULL), m_pong(NULL), m_firstRender(true), m_shaderSFQ(NULL), m_useDeferredShading(false), m_shaderDSLighting(NULL), m_shaderDSCompositing(NULL), m_dsLightRootNode(NULL), m_dsLightColor(NULL), m_useReflections(false), m_shaderRLR(NULL), m_useAntiAliasing(false), m_shaderFXAA(NULL), m_useBloom(false), m_shaderBloom(NULL), m_useBlur(false), m_shaderBlur(NULL), m_useRadialBlur(false), m_shaderRadialBlur(NULL), m_useDoF(false), m_shaderDoF(NULL), m_shaderDepth(NULL), m_useSSAO(false), m_shaderSSAOcalc(NULL), m_shaderSSAOblur(NULL), m_shaderSSAOfinal(NULL), m_useShadowMapping(false), m_shaderShadowMapping(NULL), m_smCam(NULL), m_currentViewMatrix(glm::mat4()), m_currentProjectionMatrix(glm::mat4()), m_windowWidth(0), m_windowHeight(0) { m_sfq.loadBufferData(); context.bindContext(); printInfo(); }
int _tmain(int argc, _TCHAR* argv[]) { int iNum = 0; if(argc != 2 && argc !=3) { printInfo(argc, argv); return -1; } ListInterfaceInfomation(); //请用户选择一个网卡 printf("Enter the interface number (1-%d):",gDevIndex); scanf("%d", &iNum); if(iNum <= 0) { printf("input error\n"); return -1; } ListInterfaceInfomation(GetDev, &iNum); ArpSpoof( szInterfaceName, argv[1], argv[2], 1000 /*ms*/ ); return 0; }
void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize) { printInfo(activity); LOGI(2, "-----ANativeActivity_onCreate"); //the callbacks the Android framework will call into a native application //all these callbacks happen on the main thread of the app, so we'll //need to make sure the function doesn't block activity->callbacks->onStart = onStart; activity->callbacks->onResume = onResume; activity->callbacks->onSaveInstanceState = onSaveInstanceState; activity->callbacks->onPause = onPause; activity->callbacks->onStop = onStop; activity->callbacks->onDestroy = onDestroy; activity->callbacks->onWindowFocusChanged = onWindowFocusChanged; activity->callbacks->onNativeWindowCreated = onNativeWindowCreated; activity->callbacks->onNativeWindowResized = onNativeWindowResized; activity->callbacks->onNativeWindowRedrawNeeded = onNativeWindowRedrawNeeded; activity->callbacks->onNativeWindowDestroyed = onNativeWindowDestroyed; activity->callbacks->onInputQueueCreated = onInputQueueCreated; activity->callbacks->onInputQueueDestroyed = onInputQueueDestroyed; activity->callbacks->onContentRectChanged = onContentRectChanged; activity->callbacks->onConfigurationChanged = onConfigurationChanged; activity->callbacks->onLowMemory = onLowMemory; activity->instance = NULL; }
/** * Gibt 1 zurueck, wenn ein Zug ausgefuehrt wurde, sonst 0. */ char aiDeepMove(struct GameState *gameState) { char from = 0; char to = 0; char coordFrom[] = "??"; char coordTo[] = "??"; int eval = 0; int bestEvalAdding = 0; if (loadOpeningBookMove(gameState, coordFrom, coordTo)) { from = convertCoordToIndex(coordFrom); to = convertCoordToIndex(coordTo); printf("Eroeffnungsbuch: "); } else { timeStamp = time(NULL); aiDeepSearch(gameState, &from, &to, &eval, &bestEvalAdding, 0); if (debugMode) printDev("Calculation time: %i\n", (int) time(NULL) - timeStamp); } if (from != 0) { convertIndexToCoord(from, coordFrom); convertIndexToCoord(to, coordTo); if ((*gameState).board[to] == 0) { printInfo("KI zieht mit %c von %s nach %s.\n", getPieceSymbolAsChar((*gameState).board[from]), coordFrom, coordTo); } else { printInfo("KI zieht mit %c von %s nach %s und schlaegt %c.\n", getPieceSymbolAsChar((*gameState).board[from]), coordFrom, coordTo, getPieceSymbolAsChar((*gameState).board[to])); } doMovePartial(gameState, from, to); doMoveFinal(gameState, from, to); return 1; } else { printf("Blah 3!\n"); exit(1); if (eval <= -valueCheckMate) { if (isCheck(gameState)) { printInfo("KI ist Schachmatt!\n"); } else { printInfo("KI gibt auf: Schachmatt in wenigen Zuegen!\n"); } } else { printError("Fehler: Keine Zuege gefunden, aber nicht Schachmatt!"); // DEBUG } return 0; } }
// Called every time there is a window event void AppWindow::glutKeyboard ( unsigned char key, int x, int y ) { float inc=0.025f; switch ( key ) { case 27 : exit(1); // Esc was pressed case 'i' : printInfo(); return; case ' ': _viewaxis = !_viewaxis; break; //case 'z' : _normals=!_normals; break; case 'n' : _flatn=!_flatn; std::cout<<(_flatn?"Flat...\n":"Smooth...\n"); _texturedCylinder.flat(_flatn); break; case 'p' : _phong=!_phong; std::cout<<"Switching to "<<(_phong?"Phong shader...\n":"Gouraud shader...\n"); _texturedCylinder.phong(_phong); break; case 'q' : numfaces++; _texturedCylinder.build(rt, rb, 1.0f, numfaces); break; case 'a': numfaces = (numfaces > 3) ? numfaces - 1 : numfaces; _texturedCylinder.build(rt, rb, 1.0f, numfaces); break; case 'w': rt += inc; _texturedCylinder.build(rt, rb, 1.0f, numfaces); break; case 's': rt = (rt - inc > 0.05f) ? rt - inc : rt; _texturedCylinder.build(rt, rb, 1.0f, numfaces); break; case 'e': rb += inc; _texturedCylinder.build(rt, rb, 1.0f, numfaces); break; case 'd': rb = (rb - inc > 0.05f) ? rb - inc : rb; _texturedCylinder.build(rt, rb, 1.0f, numfaces); break; case 'z': textureChoice = !textureChoice; break; case 'x': blendFactor = (blendFactor + inc > 1.0f) ? 1.0f : blendFactor + inc; break; case 'c': blendFactor = (blendFactor - inc < 0.0f) ? 0.0f : blendFactor - inc; break; default : return; } if ( _normals ) _lines.build ( _texturedCylinder.NL, GsColor::blue ); redraw(); }
void sprite::loadJson(Json::Value json) { qw = json.get("qw", 32).asInt(); qh = json.get("qh", 32).asInt(); for (int i = 0 ; !json["box"][i].isNull() ;i++ ) { struct box boxv; Json::Value box = json["box"][i]; boxv.x = box.get("x", 0).asInt(); boxv.y = box.get("y", 0).asInt(); boxv.w = box.get("w", 0).asInt(); boxv.h = box.get("h", 0).asInt(); boxv.bits = box.get("bits", 0).asInt(); boxes.push_back(boxv); } for (int i = 0 ; !json["frames"][i].isNull() ; i++) { struct frame framev; Json::Value frame = json["frames"][i]; framev.x = frame.get("x", 0.0).asFloat(); framev.y = frame.get("y", 0.0).asFloat(); framev.w = frame.get("w", 0.0).asFloat(); framev.h = frame.get("h", 0.0).asFloat(); framev.ox = frame.get("ox", 0.0).asFloat(); framev.oy = frame.get("oy", 0.0).asFloat(); for (int y = 0 ; frame["box"][y].isInt() ;y++ ) { framev.boxes.push_back(frame["box"][y].asInt()); } frames.push_back(framev); } for (int i = 0 ; !json["animations"][i].isNull() ; i++) { struct animation aniv; Json::Value animation = json["animations"][i]; aniv.loop = animation.get("loop", 1).asInt(); aniv.interval = animation.get("interval", 10).asInt(); aniv.next = animation.get("next", 0).asInt(); for (int y = 0 ; animation["frames"][y].isInt() ;y++ ) { aniv.frames.push_back(animation["frames"][y].asInt()); } animations.push_back(aniv); } printInfo(); }
void KoilItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event){ if(isSelected()) brushColor = selectedColor; else brushColor = normalColor; update(); emit printInfo(QString("")); QGraphicsItem::hoverLeaveEvent(event); }
void smokeScenario(int paper, int tobacco, int matches) { initializeSuplies(paper, tobacco, matches); printInfo(); forkSmokers(); wait(); printf("AGENT IS DONE!\n-----\n"); }
int main_t4(int argc, char *argv[]){ pthread_t tid; sun_pthread_create(&tid, NULL, thread_func, NULL); printInfo("main thread"); sleep(1); exit(0); }
void TicTacToe::on_gameField_buttonClicked(QAbstractButton *button) { switch(_currPlayer) { case 1: button->setIcon(QPixmap::fromImage(*_player1)); button->setWhatsThis("1"); break; case 2: button->setIcon(QPixmap::fromImage(*_player2)); button->setWhatsThis("2"); break; } button->setEnabled(false); bool won = checkWin(); if(won || full()) { if(won) { QListIterator<QAbstractButton *> i(gameField->buttons()); while (i.hasNext()) { QAbstractButton *qab = i.next(); qab->setEnabled(false); } switch(_currPlayer) { case 1: scorePlayer1->setText(QString::number(++_score1)); printInfo("Player 1 wins!"); break; case 2: scorePlayer2->setText(QString::number(++_score2)); printInfo("Player 2 wins!"); break; } } turnPlayer1->setText(""); turnPlayer2->setText(""); buttonNewGame->setEnabled(true); } else { switchPlayer(); } }
void KoilItem::hoverEnterEvent(QGraphicsSceneHoverEvent *event){ if(isSelected()) brushColor = selectedColor; else brushColor = hoverColor; update(); emit printInfo(info); QGraphicsItem::hoverEnterEvent(event); }
void Squad::printFullInfo() { printInfo(); for (int i = 0; i < (int)setup.size(); i++) { Broodwar->printf("%s, %d/%d", setup.at(i).type.getName().c_str(), setup.at(i).current, setup.at(i).no); } }
void futureAdagrad::updateParams (float *params, float *grad, int rank) { for (int i=0; i<m_nParamSize; i++) { m_histSquareGrad[i] += grad[i] * grad[i]; m_mapHistSquareGrad[rank][i] = m_histSquareGrad[i] - m_mapHistSquareGrad[rank][i]; params[i] -= m_learningRate * grad[i] / sqrt(m_mapHistSquareGrad[rank][i] + 0.1f); } printInfo(m_mapHistSquareGrad[rank]); memcpy(m_mapHistSquareGrad[rank], m_histSquareGrad, sizeof(float) * m_nParamSize); }
int LoadAsn (AsnInfo *asn) { /* Arguments: ** input i: Name of input file or image ** asn io: Association info structure */ extern int status; void printInfo (AsnInfo *); int SetInput (AsnInfo *); int SetAsnSingle (AsnInfo *); int GetAsnTable (AsnInfo *); int GetGlobalInfo (AsnInfo *); /* Determine whether input is a single file, an association table, ** or an entry from an association table. */ if (SetInput (asn)) return (status); if (asn->process == FULL) { sprintf (MsgText,"LoadAsn: Processing FULL Association"); } else if (asn->process == PARTIAL) { sprintf (MsgText,"LoadAsn: Processing PART of Association"); } else { sprintf (MsgText,"LoadAsn: Processing SINGLE exposure"); } trlmessage (MsgText); /* Read in global info from ASN table's primary header */ if (GetGlobalInfo (asn)) { trlerror (" Problem getting primary header information."); return (status); } /* Read in ASN table, and load appropriate members info into memory */ if (asn->process == SINGLE) { /* Set ASN structure values to process a single exposure */ if (SetAsnSingle (asn)) return (status); } else { if (GetAsnTable (asn)) return (status); } if (asn->debug) { sprintf (MsgText,"LoadAsn: Read in ASN table %s ", asn->asn_table); trlmessage (MsgText); } /* Print a summary of information about the association */ if (asn->verbose) printInfo (asn); return (status); }
void TicTacToe::switchPlayer() { switch(_currPlayer) { case 1: turnPlayer1->setText(""); turnPlayer2->setText(_turnIndicator); printInfo("Player 2s turn..."); _currPlayer = 2; break; case 2: turnPlayer1->setText(_turnIndicator); turnPlayer2->setText(""); printInfo("Player 1s turn..."); _currPlayer = 1; break; } }
void AttractorFractal::saveToFile(string name) { string fn = name + ".info"; std::ofstream out(fn); std::streambuf *coutbuf = cout.rdbuf(); cout.rdbuf(out.rdbuf()); printInfo(); cout.rdbuf(coutbuf); }
void RpcServer::listen(int seconds) { if (destroyed) { throw InvalidState("Invalid state: server has been shutdown and cannot be restarted."); } printInfo(); run(seconds); destroyed = true; }
void AppWindow::loadModel ( int model ) { float f; GsString file; switch ( model ) { case 1: f=0.1f; _gsm.load("../models/757body.obj"); _gsm2.load("../models/757rightwing.obj"); _gsm3.load("../models/757leftwing.obj"); _gsm4.load("../models/757toptail.obj"); _gsm5.load("../models/757leftback.obj"); _gsm6.load("../models/757rightback.obj"); std::cout << "Loading 757...\n"; /*if (!_gsm.load("../models/757body.obj") || !_gsm2.load("../models/757rightwing.obj") || !_gsm3.load("../models/757leftwing.obj") || !_gsm4.load("../models/757toptail.obj") || !_gsm5.load("../models/757leftback.obj") || !_gsm6.load("../models/757rightback.obj")) { std::cout << "Error!\n"; }*/ printInfo(_gsm); printInfo(_gsm2); printInfo(_gsm3); printInfo(_gsm4); printInfo(_gsm5); printInfo(_gsm6); _gsm.scale(f); _gsm2.scale(f); _gsm3.scale(f); _gsm4.scale(f); _gsm5.scale(f); _gsm6.scale(f); _model.build(_gsm); _model2.build(_gsm2); _model3.build(_gsm3); _model4.build(_gsm4); _model5.build(_gsm5); _model6.build(_gsm6); break; case 2: f=0.20f; file = "../models/al.obj"; _gsm.load( file ); _gsm2.load("../models/blank.obj"); _gsm3.load("../models/blank.obj"); _gsm4.load("../models/blank.obj"); _gsm5.load("../models/blank.obj"); _gsm6.load("../models/blank.obj"); _model.build(_gsm); _model2.build(_gsm2); _model3.build(_gsm3); _model4.build(_gsm4); _model5.build(_gsm5); _model6.build(_gsm6); std::cout << "Loading " << file << "...\n"; printInfo(_gsm); _gsm.scale(f); _model.build(_gsm); break; case 3: f=0.10f; file = "../models/f-16.obj"; _gsm.load( file ); _gsm2.load("../models/blank.obj"); _gsm3.load("../models/blank.obj"); _gsm4.load("../models/blank.obj"); _gsm5.load("../models/blank.obj"); _gsm6.load("../models/blank.obj"); _model.build(_gsm); _model2.build(_gsm2); _model3.build(_gsm3); _model4.build(_gsm4); _model5.build(_gsm5); _model6.build(_gsm6); std::cout << "Loading " << file << "...\n"; printInfo(_gsm); _gsm.scale(f); _model.build(_gsm); break; case 4: f = .01f; file = "../models/porsche.obj"; _gsm.load( file ); _gsm2.load("../models/blank.obj"); _gsm3.load("../models/blank.obj"); _gsm4.load("../models/blank.obj"); _gsm5.load("../models/blank.obj"); _gsm6.load("../models/blank.obj"); _model.build(_gsm); _model2.build(_gsm2); _model3.build(_gsm3); _model4.build(_gsm4); _model5.build(_gsm5); _model6.build(_gsm6); std::cout<<"Loading "<<file<<"...\n"; printInfo(_gsm); _gsm.scale(f); _model.build(_gsm); break; default: return; } redraw(); }
int main(int argc, char *argv[]) { struct busTicket myTicket; pname = argc > 0 ? argv[1] : "CUSTOMER"; pid = getpid(); printInfo("Initializing Customer"); /* initialize shared resource variables */ locateResources(&semid, &shmid, &shm); /* get in line */ semWait(semid, SEM_LINE); printInfo("My turn in line"); /* wait for mutex */ semWait(semid, SEM_MUTEX); /* tell agent my name */ snprintf(shm->name, sizeof(shm->name), "%s", pname); semSignal(semid, SEM_AGENT); /* wait for my ticket to be assigned */ semWait(semid, SEM_TICKET); /* get the ticket */ myTicket = shm->ticket; sprintf(buf, "My Ticket: [Name:%s Seat:%d Depart:%ld]", myTicket.name, myTicket.seat, myTicket.depart); printInfo(buf); /* release mutex */ if(myTicket.depart == shm->nbDepart) { printInfo("Waiting for next bus"); shm->nbWait++; semSignal(semid, SEM_MUTEX); /* wait for next bus */ semWait(semid, SEM_NBUS); } else { semSignal(semid, SEM_MUTEX); } /* board the bus */ printInfo("Boarding the bus"); return EXIT_SUCCESS; }
/* * Executes Commands in Background or Foregrounde depending on @param background * * @param commToExecute[] The command and its arguments to run. * @param background Run process in background or not. */ void run_command(char* commToExecute[], int background){ int child_pid; // Process ID // Fork a new process for the command if ((child_pid = fork()) < 0){ fprintf(stderr, "ERROR WHILE FORKING PROCESS \n"); exit(1); } //Child Process else if (child_pid == 0){ // Execute the command if (execvp(commToExecute[0], commToExecute) < 0){ fprintf(stderr, "ERROR DURING EXEC \n"); exit(1); } } // Parent process else{ struct timeval start; gettimeofday(&start, NULL); long start_time = ((start.tv_sec * 1000) + (start.tv_usec/1000)); // Foreground process if (background == 0){ int exitStat; waitpid(child_pid, &exitStat, 0); printInfo(start_time, child_pid, exitStat); } // Background process else{ bgProcNum++; bgProc* new_process = malloc(sizeof(bgProc)); new_process->pid = child_pid; new_process->job = getNewJobNum(); new_process->start = start_time; strcpy(new_process->command, commToExecute[0]); // No list exists if (bgProcTail == NULL){ new_process->prev = NULL; new_process->next = NULL; bgProcTail = new_process; bgProcHead = new_process; } // Add to end of list else{ new_process->prev = bgProcTail; new_process->next = NULL; bgProcTail->next = new_process; bgProcTail = new_process; } sleep(1); printf("Job : %d, PID : %d\n", new_process->job, new_process->pid); } } }
int logReader(int choice,char* diruser){ //diruser chi khi nao in userlog thi moi xai int num; FILE *fp; char dir[30]; khachHang temp; Nhap: system("cls"); if (choice == 1){ printf("\n================Xem Lich Su Giao Dich================\n"); strcpy(dir,diruser); dir[strlen(dir) - 4] = NULL; strcat(dir,"_log_user.dat"); } else if (choice == 0){ printf("\n====================Xem File Log=====================\n"); printf("\n #Nhap Ma So The : "); scanf("%d",&num); makeDir(dir,num); dir[strlen(dir) - 4] = NULL; strcat(dir,"_log.dat"); } if((fp=fopen(dir,"rb")) == NULL){ fclose(fp); int choice; do{ printf("\n Account Nay Chua Co File Log. Ban Muon\n"); printf("\n ---1.Nhap Ma So The Khac\n"); printf("\n ---2.Tro Ve Menu\n"); printf("\n #Chon : "); fflush(stdin); scanf("%d",&choice); switch (choice){ case 1 : system("cls"); goto Nhap; break; case 2 : return 0; default : system("cls"); printf("\n====================Xem File Log=====================\n"); printf("\n #Nhap Ma So The : %d\n",num); break; } }while(choice > 2 || choice < 1 ); } else{ printf("\n\n\n\n"); while(fread(&temp,sizeof(temp),1,fp) == 1){ printInfo(temp,2,temp.trangThai); printf("\n\n"); } printf("\n Nhan Phim Bat Ky De Quay Ve Menu\n"); getch(); return 1; } }
int main(int argc, char **argv) { int add = 1; char *result = malloc(100); int c; int index; // Parse flags while ((c = getopt(argc, argv, "s:")) != -1) { switch (c) { case 's': add = 0; break; default: printInfo(); return 0; } } // Insure that we have the correct u if (argc < 2) { printInfo(); return 0; } index = optind; if (add) { for (index = optind; index < argc; index++) { strcpy(result, add_roman(result, argv[index])); } } else { // We're doing subtraction so grab the 3rd arg as minuend and subtract the rest. strcpy(result, argv[2]); for (; index < argc; index++) { strcpy(result, subtract_roman(result, argv[index])); } } printf(" SVMMA: %s\n", result); free(result); return 0; }
void Exporter::validateData() { info += "\r\n"; removeRedundantMaterials(); buildBoneHierarchy(); // Calculate bone id (prevents mixing wrong types) boneId = 0; for(unsigned int i = 0; i < bones.size(); ++i) { // Sum of child index * parent index for(unsigned int j = 0; j < i; ++j) if(bones[i].getParentName() == bones[j].getName()) boneId += i*j; } if(model.getObjects().size() > 1) { model.buildObjectHierarchy(); printInfo("Resorted object hierarchy"); } if(model.getHelpers().size() > 1) { model.buildHelperHierarchy(); printInfo("Resorted helper hierarchy"); } if(boneId >= 0) { char number[20] = { 0 }; _itoa(boneId, number, 10); info += "\r\n"; printInfo("Calculated bone id: " + std::string(number)); } model.setCollisionFlags(); // !!!!!!!!!!!!!!!!!! //if(boneId <= 0) // model.chopObjects(); }
static void checkSimulationTerminated(DATA* data, SOLVER_INFO* solverInfo) { if(terminationTerminate) { printInfo(stdout, TermInfo); fputc('\n', stdout); infoStreamPrint(LOG_STDOUT, 0, "Simulation call terminate() at time %f\nMessage : %s", data->localData[0]->timeValue, TermMsg); data->simulationInfo.stopTime = solverInfo->currentTime; } }