int main(int argc, char **argv) { lx = 0; ly = 0; lz = 0; px = 0; py = 0; pz = 0; if (RS232_OpenComport(COMPORT, 9600) == 0){ cMode = rest; printf("connected\n"); printf("Hold your hand in a relaxed position and press enter\n"); waitForEnter(); acquireData(&grelax,true); printData(grelax); printf("Hold your hand in a fist (or as best you can) and press enter\n"); waitForEnter(); acquireData(>ense,true); printData(gtense); gdiff = gtense - grelax; printf("Difference is: \n"); printData(gdiff); printf("press enter to continue\n"); waitForEnter(); acquireData(&gd,true); setOtherLoop(&mainloop); glMain(argc, argv); } else{ printf("fail\n"); } return 0; }
int main(int argc, char** argv) { struct arg_int *numVerticesArg = arg_int0("v","vertices",NULL, "num vertices (default is 20)"); struct arg_int *numObjectsArg = arg_int0("o","objects",NULL, "num objects (default is 20)"); struct arg_lit *help = arg_lit0(NULL,"help", "print this help and exit"); struct arg_str *rendererArg = arg_str1(NULL,NULL,"RENDERER",NULL); struct arg_end *end = arg_end(20); void* argtable[] = {numVerticesArg, numObjectsArg, help, rendererArg, end}; const char* progname = "gl-instancing"; int exitcode=0; int nerrors; renderer *renderer; int numVertices = 20; int numObjects = 20; /* verify the argtable[] entries were allocated sucessfully */ if (arg_nullcheck(argtable) != 0) { /* NULL entries were detected, some allocations must have failed */ printf("%s: insufficient memory\n",progname); exitcode=1; goto exit; } /* Parse the command line as defined by argtable[] */ nerrors = arg_parse(argc,argv,argtable); /* special case: '--help' takes precedence over error reporting */ if (help->count > 0) { printUsage(stderr, progname, argtable); goto exit; } if (numVerticesArg->count > 0) { numVertices = numVerticesArg->ival[0]; } if (numObjectsArg->count > 0) { numObjects = numObjectsArg->ival[0]; } if (rendererArg->count == 0) { fprintf(stderr, "Provide a renderer!\n"); printUsage(stderr, progname, argtable); goto exit; } if (rendererArg->count > 0) { if (strcmp(rendererArg->sval[0], "standard") == 0) { renderer = getStandardRenderer(numVertices, numObjects); } else if (strcmp(rendererArg->sval[0], "instanced") == 0) { renderer = getInstancedRenderer(numVertices, numObjects); } else { fprintf(stderr, "Renderer %s is unknown. Supported renderers: instanced, standard\n", rendererArg->sval[0]); printUsage(stderr, progname, argtable); goto exit; } } exitcode = glMain(renderer); exit: /* deallocate each non-null entry in argtable[] */ arg_freetable(argtable,sizeof(argtable)/sizeof(argtable[0])); return exitcode; }