int CALLBACK WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR cmdLine, int cmdShow) { // Save all parameters hInstance = hInst; hPrevInstance = hPrevInst; nCmdShow = cmdShow; return my_main(__argc, __argv); }
int loop_main(t_sh *sh, pid_t pid) { if (sh == NULL) return (EXIT_FAILURE); while (is_open(NULL)) { my_printf("%s", sh->rdl.prompt); if ((get_readline(sh)) == false) return (unload_sh(sh)); sh->tok_list = tokenizer((char*)sh->line, sh->env); sh->line = gbgc_free(NULL, sh->line); parser(sh); my_main(sh, sh->env); if (!is_open(NULL)) { if (pid == getpid()) { dezombificator2(0); unload_sh(sh); } return (get_exitstate(NULL)); } sh->prs_list = destroy_dlist(sh->prs_list, free_t_prs); } if ((unload_sh(sh)) == FALSE) return (EXIT_FAILURE); return (get_exitstate(NULL)); }
/** * @brief ... * @param opt */ void init_jspell(char *opt) { int i, argc; static char aux[1]; char options[255]; static char *argv[MAX_SOL]; strcpy(options, opt); argc = 1; aux[0] = '\0'; argv[0] = aux; i = 0; while (options[i] != '\0') { argv[argc] = options+i; argc++; /* advance letters */ while (options[i] != ' ' && options[i] != '\0') i++; /* advance spaces */ while (options[i] == ' ') { options[i] = '\0'; i++; } } /* for (i = 0; i < argc; i++) printf("%d %s\n", i, argv[i]); */ my_main(argc, argv, 1); }
int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { MyMain my_main (argc, argv); my_main.run (); return 0; }
int main(int argc, char *argv[]) { gfx_width=640; gfx_height=480; gfx_fullscreen=0; c_minx=0; c_miny=0; c_maxx=gfx_width; c_maxy=gfx_height; fprintf(stderr, "Strange Adventures in Infinite Space - v" SAIS_VERSION_STRING "\n"); fprintf(stderr, "Unofficial fork by Philip Boulain et. al. (see README.md)\n"); if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_AUDIO) < 0) { fprintf(stderr, "Problem initialising SDL: %s\n", SDL_GetError()); return 1; } SDL_WM_SetCaption("Strange Adventures In Infinite Space", "Strange Adventures In Infinite Space"); // Enable UNICODE so we can emulate getch() in text input SDL_EnableUNICODE(1); // init SDL mixer if (Mix_OpenAudio(22050, AUDIO_S16, 2, 1024) < 0) { fprintf(stderr, "Problem initialising Audio: %s\n", SDL_GetError()); return 1; } Mix_AllocateChannels(16); sound_init(); // Must find the native resolution *before* setting the video mode const SDL_VideoInfo* video_info = SDL_GetVideoInfo(); g_native_resolution.w = video_info->current_w; g_native_resolution.h = video_info->current_h; g_virtual_resolution.x = 0; g_virtual_resolution.y = 0; g_virtual_resolution.w = gfx_width; g_virtual_resolution.h = gfx_height; sdlsurf = SDL_CreateRGBSurface(SDL_SWSURFACE, gfx_width, gfx_height, 8, 0xff000000, 0x00ff0000, 0x0000ff00, 0x000000ff); g_scaled_video = NULL; gfx_window_width = gfx_width; // Start at 1:1 size gfx_window_height = gfx_height; gfx_resize(); my_main(); return 0; }
//***************************************************************************** // //! \addtogroup example_list //! <h1>Ethernet with lwIP (enet_lwip)</h1> //! //! This example application demonstrates the operation of the Stellaris //! Ethernet controller using the lwIP TCP/IP Stack. DHCP is used to obtain //! an Ethernet address. If DHCP times out without obtaining an address, //! AutoIP will be used to obtain a link-local address. The address that is //! selected will be shown on the UART. //! //! UART0, connected to the FTDI virtual COM port and running at 115,200, //! 8-N-1, is used to display messages from this application. //! //! For additional details on lwIP, refer to the lwIP web page at: //! http://savannah.nongnu.org/projects/lwip/ // //***************************************************************************** //***************************************************************************** // // This example demonstrates the use of the Ethernet Controller. // //***************************************************************************** int main(void) { Init_All(); // // Loop forever. All the work is done in interrupt handlers. // while(1) { my_main(); } }
int main(int argc, char *argv[]) { int ret=my_main(argc,argv); return ret; }
int main(int argc, char **argv) { int exitcode = 0; int nerrors = 0; /* Prepare command line arguments */ struct arg_str *latero_ip = arg_str1(NULL,"latero_ip","IP", "Latero server IP address"); struct arg_lit *print_resp= arg_lit0("p", "print", "print response packet"); struct arg_int *numpkt = arg_int0("n", "numpkt","<n>", "How many packets (default is 1)"); struct arg_int *dacval = arg_intn(NULL,"dac","<int>",0,4,"dac values (up to 4 values)"); struct arg_lit *rd = arg_lit0("r", "read", "read"); struct arg_lit *wr = arg_lit0("w", "write", "write"); struct arg_int *addr = arg_int0("a", "addr",NULL, "address"); struct arg_int *value = arg_int0("v", "value",NULL, "value"); struct arg_lit *mainctrl = arg_lit0(NULL,"mainctrl", "Raw commands are for the main controller"); struct arg_int *tpat = arg_int0("t","testpat","<n>", "Run Test Pattern:1=Split, 2=AllPin, 3=RowCol"); struct arg_lit *latio = arg_lit0(NULL,"lateroio", "Raw commands are for the Latero IO card"); struct arg_lit *help = arg_lit0(NULL,"help", "print this help and exit"); struct arg_end *end = arg_end(10); void* argtable[] = {latero_ip,print_resp,numpkt,dacval, rd, wr, addr, value, mainctrl, tpat, latio, help,end}; //latero_ip->sval[0] = "192.168.1.108"; /* verify the argtable[] entries were allocated sucessfully */ if (arg_nullcheck(argtable) != 0) { /* NULL entries were detected, some allocations must have failed */ printf("Insufficient memory (argtable)\n"); exitcode = 1; goto exit; } numpkt->ival[0] = 1; tpat->ival[0] = 0; nerrors = arg_parse(argc,argv,argtable); /* special case: '--help' takes precedence over error reporting */ if (help->count > 0) { printf("Usage: %s", argv[0]); arg_print_syntax(stdout,argtable,"\n"); printf("Latero client demonstration program version 1, revision 1\n"); arg_print_glossary(stdout,argtable," %-25s %s\n"); exitcode=0; goto exit; } if (nerrors > 0) { /* Display the error details contained in the arg_end struct.*/ arg_print_errors(stdout,end,argv[0]); printf("Try '%s --help' for more information.\n",argv[0]); exitcode = 0; goto exit; } if( wr->count > 0 ) { if( addr->count != 1 || value->count != 1 ) { printf("Write requires an address and a value\n"); exitcode = 1; goto exit; } if( mainctrl->count + latio->count == 0 ) { printf("Write requires a destination (--mainctrl or --lateroio)\n"); exitcode = 1; goto exit; } } if( rd->count > 0 ) { if( addr->count != 1 ) { printf("Read requires an address\n"); exitcode = 1; goto exit; } if( mainctrl->count + latio->count == 0 ) { printf("Read requires a destination (--mainctrl or --lateroio)\n"); exitcode = 1; goto exit; } } return( my_main( latero_ip->sval[0], print_resp->count, numpkt->ival[0], dacval->ival, dacval->count, rd->count, wr->count, addr->ival[0], value->ival[0], mainctrl->count, latio->count, tpat->ival[0]) ); exit: printf("Program Ended\n"); arg_freetable(argtable,sizeof(argtable)/sizeof(argtable[0])); return(exitcode); }
_start() { int num = my_main(); _exit(num); }
static int do_profile( caddr_t start, unsigned long plength, unsigned scale, int thresh, int bucket, unsigned int mask ) { int i, retval; unsigned long blength; int num_buckets,j=0; int num_bufs = num_events; int event = num_events; int events[MAX_TEST_EVENTS]; char header[BUFSIZ]; strncpy(header,"address\t\t",BUFSIZ); //= "address\t\t\tcyc\tins\tfp_ins\n"; for(i=0;i<MAX_TEST_EVENTS;i++) { if (mask & test_events[i].mask) { events[j]=test_events[i].event; if (events[j]==PAPI_TOT_CYC) { strncat(header,"\tcyc",BUFSIZ-1); } if (events[j]==PAPI_TOT_INS) { strncat(header,"\tins",BUFSIZ-1); } if (events[j]==PAPI_FP_INS) { strncat(header,"\tfp_ins",BUFSIZ-1); } if (events[j]==PAPI_FP_OPS) { strncat(header,"\tfp_ops",BUFSIZ-1); } if (events[j]==PAPI_L2_TCM) { strncat(header,"\tl2_tcm",BUFSIZ-1); } j++; } } strncat(header,"\n",BUFSIZ-1); blength = prof_size( plength, scale, bucket, &num_buckets ); prof_alloc( num_bufs, blength ); if ( !TESTS_QUIET ) printf( "Overall event counts:\n" ); for ( i = 0; i < num_events; i++ ) { if ( ( retval = PAPI_profil( profbuf[i], ( unsigned int ) blength, start, scale, EventSet, events[i], thresh, PAPI_PROFIL_POSIX | bucket ) ) != PAPI_OK ) { if (retval == PAPI_EINVAL) { test_warn( __FILE__, __LINE__, "Trying to profile with derived event", 1); num_events=i; break; } else { printf("Failed with event %d 0x%x\n",i,events[i]); test_fail( __FILE__, __LINE__, "PAPI_profil", retval ); } } } if ( ( retval = PAPI_start( EventSet ) ) != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_start", retval ); my_main( ); if ( ( retval = PAPI_stop( EventSet, values[0] ) ) != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_stop", retval ); if ( !TESTS_QUIET ) { printf( TAB1, "PAPI_TOT_CYC:", ( values[0] )[--event] ); if ( strcmp( hw_info->model_string, "POWER6" ) != 0 ) { printf( TAB1, "PAPI_TOT_INS:", ( values[0] )[--event] ); } #if defined(__powerpc__) printf( TAB1, "PAPI_FP_INS", ( values[0] )[--event] ); #else if ( strcmp( hw_info->model_string, "Intel Pentium III" ) != 0 ) { printf( TAB1, "PAPI_FP_OPS:", ( values[0] )[--event] ); printf( TAB1, "PAPI_L2_TCM:", ( values[0] )[--event] ); } #endif } for ( i = 0; i < num_events; i++ ) { if ( ( retval = PAPI_profil( profbuf[i], ( unsigned int ) blength, start, scale, EventSet, events[i], 0, PAPI_PROFIL_POSIX ) ) != PAPI_OK ) test_fail( __FILE__, __LINE__, "PAPI_profil", retval ); } prof_head( blength, bucket, num_buckets, header ); prof_out( start, num_events, bucket, num_buckets, scale ); retval = prof_check( num_bufs, bucket, num_buckets ); for ( i = 0; i < num_bufs; i++ ) { free( profbuf[i] ); } return retval; }
int main() { long bos; pbos = &bos; my_main(); }