void Function::renderasm(ASMhandle& context){ if(debug) cerr<<"Function: renderasm start"<<endl; /* Function header assembly */ assembler.push_back(ss<<"\t.align 2"<<endl); assembler.push_back(ss<<"\t.globl "<<name<<endl); // This has to be ommitted for functions declared static assembler.push_back(ss<<"\t.ent "<<name<<endl); assembler.push_back(ss<<"\t.type "<<name<<", @function"<<endl); assembler.push_back(ss<<name<<":"<<endl); ASMhandle new_context(context); new_context.subroutine_enter(); init_args(new_context); if(debug) cerr<<"Function: renderasm of parameters successful"<<endl; if(fn_body!=NULL) fn_body->renderasm(new_context, true); else context.subroutine_exit(NULL); if(debug) cerr<<"Function: renderasm of body successful"<<endl; /* Function end assembly */ assembler.push_back(ss<<endl<<"\t.end "<<name<<endl<<endl); }
int main(int argc, char *argv[]) { struct arguments args; /* Process arguments */ init_args(&args); if (parse_args(argc, argv, &args) < 0) return -1; validate_args(&args); if (args.verbose) print_args(&args); switch (args.mode) { case CLI_MODE: tun_cli(&args); break; case SERV_MODE: tun_serv(&args); break; case FULLMESH_MODE: tun_peer(&args); break; default: break; } return 0; }
int main(int ac, char **av) { t_args option; if (ac < 5) return (usage(av[0])); signal(SIGINT, &signal_handler); signal(SIGPIPE, SIG_IGN); srand(time(NULL) + getpid()); init_args(&option); if (check_args(ac, av, &option) == false || check_all_args(&option) == false) return (usage(av[0])); display_init(&option); g_s.global_time = 0; g_s.id_egg = 1; g_s.other_size = 0; if ((g_s.sock = init_server(option.port)) == -1) return (display_error("Error : Could not init the server.\n")); printf("**** Initialization done\n"); init_map(&g_s, option.width, option.height); init_team(&g_s, option.nb_client, option.team_name); init_stone(&g_s, option.width * option.height); g_s.option = &option; server_loop(&g_s); xclose(g_s.sock); return (0); }
int op_add(t_action *action, char *str, t_pos *pos) { int i; char c; char type; char **tab; char **list_arg; if ((c = 0) || !(pos->prog_size += 2) || !(i = -1) || !(action->identifier = 0x04) || !(action->args = malloc(sizeof(t_arg *) * 4)) || !(tab = str_to_word_tab(str, ',')) || !(list_arg = str_to_word_tab("1 1 1", ' ')) || init_args(action, 3)) return (1); while (tab[++i]) { if (i > 2 || (type = check_type(tab[i], pos)) == -1 || check_args(type, list_arg[i], pos) || fill_arg(type, tab[i], action->args[i], action->pos - i - 1)) return (1); add_prog_size(type, pos); c += (type << (6 - (i * 2))); } action->coding_byte = c; return (free_tab(tab), free_tab(list_arg), (i < 3) ? 1 : 0); }
extern void _entry (void) { int argc=0; char **argv = NULL; init_args(argc, argv); int result=main(argc, argv); exit(result); }
void init (int argc,char *argv[]) { struct lac *lac; init_args (argc,argv); rand_source = 0; init_addr (); if (init_config ()) { log (LOG_CRIT, "%s: Unable to load config file\n", __FUNCTION__); exit (1); } if (uname (&uts)) { log (LOG_CRIT, "%s : Unable to determine host system\n", __FUNCTION__); exit (1); } init_tunnel_list (&tunnels); if (init_network ()) exit (1); if (gconfig.daemon) daemonize (); signal (SIGTERM, &death_handler); signal (SIGINT, &death_handler); signal (SIGCHLD, &child_handler); signal (SIGUSR1, &status_handler); signal (SIGHUP, &null_handler); init_scheduler (); mkfifo (CONTROL_PIPE, 0600); control_fd = open (CONTROL_PIPE, O_RDONLY | O_NONBLOCK, 0600); if (control_fd < 0) { log (LOG_CRIT, "%s: Unable to open " CONTROL_PIPE " for reading.", __FUNCTION__); exit (1); } log (LOG_LOG, "l2tpd version " SERVER_VERSION " started on %s PID:%d\n", hostname, getpid ()); log (LOG_LOG, "Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.\n"); log (LOG_LOG, "Forked by Scott Balmos and David Stipp, (C) 2001\n"); log (LOG_LOG, "Inhereted by Jeff McAdams, (C) 2002\n"); log (LOG_LOG, "%s version %s on a %s, port %d\n", uts.sysname, uts.release, uts.machine, gconfig.port); lac = laclist; while (lac) { if (lac->autodial) { #ifdef DEBUG_MAGIC log (LOG_DEBUG, "%s: Autodialing '%s'\n", __FUNCTION__, lac->entname[0] ? lac->entname : "(unnamed)"); #endif lac->active = -1; switch_io = 1; /* If we're a LAC, autodials will be ICRQ's */ magic_lac_dial (lac); } lac = lac->next; } }
/****************************************************************************** install_db() Install the a database. ******************************************************************************/ void install_db(char *datadir) { arg_list_t al; int err, i; char input[PATH_MAX]; char output[PATH_MAX]; char error[PATH_MAX]; // input file snprintf(input, PATH_MAX, "%s/bin/test_db.sql", base_dir); snprintf(output, PATH_MAX, "%s/install.out", datadir); snprintf(error, PATH_MAX, "%s/install.err", datadir); // args init_args(&al); add_arg(&al, mysqld_file); add_arg(&al, "--no-defaults"); add_arg(&al, "--bootstrap"); add_arg(&al, "--skip-grant-tables"); add_arg(&al, "--basedir=%s", base_dir); add_arg(&al, "--datadir=%s", datadir); add_arg(&al, "--skip-innodb"); add_arg(&al, "--skip-bdb"); // spawn if ((err = spawn(mysqld_file, &al, TRUE, input, output, error)) != 0) { die("Unable to create database."); } // free args free_args(&al); }
int main(int argc, char **argv) { /*const char *fake_argv[3] ; fake_argv[0] = "ac3dto3ds" ; fake_argv[1] = "converter" ; fake_argv[2] = NULL ; */ init_args(argc, argv); extern int loadACo( char * inputFilename, char * outputFilename, int saveIn); extern int loadAC( char * inputFilename, char * outputFilename, int saveIn); if (typeConvertion==_AC3DTO3DS) { loadAC( InputFileName, OutputFileName,0); } else if (typeConvertion==_AC3DTOAC3D) { loadACo( InputFileName, OutputFileName,0); } else if (typeConvertion==_AC3DTOOBJ) { loadAC( InputFileName, OutputFileName,1); } else if (typeConvertion==_AC3DTOAC3DM) { loadAC( InputFileName, OutputFileName,2); } else if (typeConvertion==_AC3DTOAC3DS) { loadAC( InputFileName, OutputFileName,3); } else if (typeConvertion==_AC3DTOAC3DGROUP) { loadAndGroup( OutputFileName); } return 0; }
/* * Function * main * * Description * LINUX entry point of TORCS * * Parameters * * * Return * * * Remarks * */ int main(int argc, char *argv[]) { init_args(argc, argv); /*** kswe ***/ signal(SIGTERM, signal_handler); signal(SIGINT, signal_handler); user_input = (float*)init_shared_mem(&shmid_input, SHMEM, sizeof(float), size_user_input, shared_memory_input); // shm start (input) torcs_output = (float*)init_shared_mem(&shmid_output, SHMEM2, sizeof(float), size_torcs_output, shared_memory_output); for(int i = 0; i < size_user_input; i++) user_input[i] = 0.0; for(int i = 0; i < size_torcs_output; i++) torcs_output[i] = 0.0; user_input[STEER_MODE] = 1.0; // steering mode: lane keeping /************/ LinuxSpecInit(); /* init specific linux functions */ GfScrInit(argc, argv); /* init screen */ TorcsEntry(); /* launch TORCS */ glutMainLoop(); /* event loop of glut */ return 0; /* just for the compiler, never reached */ }
/** * \brief Example 1: Implements an abstract surface code using an 8-step cycle. * * \param[in] argc The number of command line arguments * \param[in] argv An array of the command line arguments * * \return 0 */ int main(int argc, char **argv) { RECIPE *recipe; // Initialise, then load the args ARGS *args = init_args(); load_args(args, argc, argv); // Create the recipe for an infinite simulation recipe = qc_create_recipe(RECIPE_INFINITE, 1, 2*args->d-1, 2*args->d-1); // Generate the recipe generate_recipe(args, recipe); // Boot up process, calculate optimal t_check if (args->boot == 1) { calculate_t_check(args, recipe); } // Run the simulation simulate_recipe(args, recipe); // Free the recipe qc_free_recipe(recipe); // If we opened a file for the output, it needs to be closed if (args->out_raw != stdout) { fclose(args->out_raw); } free(args); return 0; }
void get_new_std_input_args(int *argcp, const char **argvp[]) { init_args(); char *n_args = std_input(); int argc = n_names(n_args); const char **argv = new_argv(argc, n_args); *argcp = argc, *argvp = argv; }
void get_new_recursive_args(int *argcp, const char **argvp[]) { init_args(); char *n_args = recursive_args(*argcp, *argvp); int argc = n_names(n_args); const char **argv = new_argv(argc, n_args); *argcp = argc, *argvp = argv; }
int main(int argc, char * argv[]) { long_index = 0; init_args(); parse_long(argc, argv); printf("Correlation method is %d\n",argum.correlation_method); print_args(); return 0; }
static int Init(int argc, const char **argv) { if ((App = AppAlloc(&AppInfo,argc,argv)) == NULL) return -1; if (init_args() != 0) return -1; if (ReadGenerators() != 0) return -1; if (ReadSeed() != 0) return -1; return 0; }
int main(int argc, char **argv) { init_args(argc, argv); load_params(); init_graphics(); /* not used */ load_database(); draw(); set_texture_coord(); save_database(); return 0; }
int main(int argc, char *argv[]) { int k=0, gg=0; Game *g; nGames = 0; init_args(argc, argv); srand(time(NULL)); readGameFile(_file); for (gg = 0; gg < 13; gg++) { printf("Entropy of Game %u Size %u : Entropy %u\n", gg+1, games[gg]->size, calcEntropy2(games[gg])); //printGame(games[gg]); g = games[gg]; g = initialize_search(g, &k); if (check(g)) { printf("%s0 (%u)\n", g->moves, k); } else { printf("%s", g->moves); } g->moves[0] = '\0'; if(g != games[gg]) { free(g->pancakes); free(g->moves); free(g); } k=0; } //Trivial Solution /*printf("Games : %u\n", nGames); for(i=0; i<nGames; i++) { printf("Game %u - Size %u\n", i+1, games[i]->size); g = games[i]; for(j=0; j<g->size; j++) { printf("%u ", g->pancakes[j]); } printf("\n"); pancakeFlipSort(g); printf("0 (%u)\n", g->flips); //for (j = 0; j < g->size; j++) { // printf("%u ", g->pancakes[j]); //} printf("\n"); }*/ return 0; }
int main(int argc, char **argv) { t_env e; if (argc == 1) exit(0); ((t_stat *)get_instance())->env = &e; if (init_args(argv, &e, argc) == -1) return (make_error(&e, "Error initializing arguments\n")); if (init_termios(&e) == -1) return (make_error(&e, "Error initializing terminal\n")); if (init_select(&e) == -1) return (make_error(&e, "Configuration error\n")); }
/****************************************************************************** mysql_install_db() Install the database. ******************************************************************************/ int mysql_install_db(int argc, char *argv[]) { arg_list_t al; int i, j, err; char skip; // private options static char *private_options[] = { "--autoclose", "--sql-file=", NULL }; // args init_args(&al); add_arg(&al, "%s", mysqld); // parent args for(i = 1; i < argc; i++) { skip = FALSE; // skip private arguments for (j=0; private_options[j]; j++) { if(!strnicmp(argv[i], private_options[j], strlen(private_options[j]))) { skip = TRUE; break; } } if (!skip) add_arg(&al, "%s", argv[i]); } add_arg(&al, "--bootstrap"); add_arg(&al, "--skip-grant-tables"); add_arg(&al, "--skip-innodb"); add_arg(&al, "--skip-bdb"); // spawn mysqld err = spawn(mysqld, &al, TRUE, sql_file, out_log, err_log); // free args free_args(&al); return err; }
int main(int argc, char **argv) { init_args(argc, argv); glutInit(&argc, argv); glutCreateWindow(argv[1]); ssgInit(); #ifndef WIN32 LinuxSpecInit(); #else WindowsSpecInit(); #endif Generate(); return 0; }
/****************************************************************************** read_defaults() Read the defaults. ******************************************************************************/ void read_defaults(arg_list_t *pal) { arg_list_t al; char defaults_file[PATH_MAX]; char mydefaults[PATH_MAX]; char line[PATH_MAX]; FILE *fp; // defaults output file snprintf(defaults_file, PATH_MAX, "%s/bin/defaults.out", basedir); remove(defaults_file); // mysqladmin file snprintf(mydefaults, PATH_MAX, "%s/bin/my_print_defaults", basedir); // args init_args(&al); add_arg(&al, mydefaults); if (default_option[0]) add_arg(&al, default_option); add_arg(&al, "mysqld"); add_arg(&al, "mysql_install_db"); spawn(mydefaults, &al, TRUE, NULL, defaults_file, NULL); free_args(&al); // gather defaults if((fp = fopen(defaults_file, "r")) != NULL) { while(fgets(line, PATH_MAX, fp)) { char *p; // remove end-of-line character if ((p = strrchr(line, '\n')) != NULL) *p = '\0'; // add the option as an argument add_arg(pal, line); } fclose(fp); } // remove file remove(defaults_file); }
/************ Main() ************************/ int main ( int argc, char **argv) { /* =================================================== */ logged = FALSE; atexit(check_log); logfp = stdout; /* provides a way to inform user that something */ /* was logged. can be changed by code (eg init file */ /* but must be set before init_args(). see generic.h */ init_args(argc, argv); SW_CTL_init_model(_firstfile); SW_CTL_main(); return 0; }
int send_seq(va_list *llist, char *seq, int bytes) { t_arg args; init_args(&args); while (*seq) { set_seq_flags(seq, &args); set_seq_mod(seq, &args); set_seq_wildcard(llist, seq, &args); set_seq_wildcard_precision(llist, &seq, &args); if (*seq != '0') set_seq_precision(&seq, &args); if (ft_strchr(FLAGS, *seq)) bytes = compute_seq(llist, seq, args); seq++; } return (bytes); }
/****************************************************************************** get_options() Get the options. ******************************************************************************/ void get_options(int argc, char *argv[]) { arg_list_t al; // start defaults start_defaults(argc, argv); // default file arguments init_args(&al); add_arg(&al, "ignore"); read_defaults(&al); parse_args(al.argc, al.argv); free_args(&al); // command-line arguments parse_args(argc, argv); // finish defaults finish_defaults(); }
void init(t_env *env, char **av, int ac) { env->color = NULL; env->pixel = NULL; env->coeff = NULL; env->t = NULL; env->fract = NULL; if ((init_args(env, av, ac))) ft_exit(env, "Wrong arg !"); if (!(img_init(env))) ft_exit(env, "Unable to init mlx."); if (!(env->color = rgbmap())) ft_exit(env, "Unable to creat rgbmap"); if (!(env->pixel = pixelmap())) ft_exit(env, "Unable to create pixelmap"); if (!(env->coeff = coeffmap())) ft_exit(env, "Unable to create coeffmap"); if (!(env->t = threadmap(env))) ft_exit(env, "Unable to create threadmap"); }
/* * Function * main * * Description * LINUX entry point of TORCS * * Parameters * * * Return * * * Remarks * */ int main(int argc, char *argv[]) { const char *raceconfig = ""; init_args(argc, argv, &raceconfig); LinuxSpecInit(); /* init specific linux functions */ if(strlen(raceconfig) == 0) { GfScrInit(argc, argv); /* init screen */ TorcsEntry(); /* launch TORCS */ glutMainLoop(); /* event loop of glut */ } else { // Run race from console, no Window, no OpenGL/OpenAL etc. // Thought for blind scripted AI training ReRunRaceOnConsole(raceconfig); } return 0; /* just for the compiler, never reached */ }
int ft_correct_flag(va_list *ap, char *flag, int so_far) { t_arg args; int value; init_args(&args); while (*flag != '\0') { ft_verif_flag_flags(&flag, &args); ft_verif_has_mod(&flag, &args); ft_verif_wildcard(ap, &flag, &args); ft_verif_wildprecision(ap, &flag, &args); if (*flag != '0') ft_verif_precision(&flag, &args); if (ft_strchr(KNOWN_FLAGS, *flag)) value = ft_compute_flag(ap, flag, args, so_far); flag++; } return (value); }
int main(int ac, char **av) { int fd; t_env env; f_action *fptr_action; if (init_args(ac, av, &env) == -1) { error_arg(); return (-1); } signal(SIGTERM, &set_flag); signal(SIGINT, &set_flag); if (verif_fd() == -1 || create_socket(&fd) == -1 || init_server_socket(fd, env.port) == -1 || init_env(&env, fd, &fptr_action) == -1 || server(&env, fptr_action) == -1) return (-1); printf("Bye Bye\n"); delete_env(&env, fptr_action); return (0); }
int main(int argc, char **argv) { int ret; init_vars(); init_args(argc, argv); ret = init_coroutine_env(); if (ret != 0) { fprintf(stderr, "init async_coro failed\n"); exit(-1); } if (accept_loop() != RET_SUCCESS) { fprintf(stderr, "accept_loop() failed\n"); exit(-1); } return 0; }
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; }
void init (int argc,char *argv[]) { struct lac *lac; struct in_addr listenaddr; int myRet=0; init_args (argc,argv); srand( time(NULL) ); rand_source = 0; init_addr (); if (init_config ()) { log (LOG_CRIT, "%s: Unable to load config file\n", __FUNCTION__); exit (1); } init_tunnel_list (&tunnels); if (init_network ()) exit (1); //if (gconfig.daemon) //daemonize (); signal (SIGTERM, &death_handler); signal (SIGINT, &death_handler); signal (SIGCHLD, &child_handler); signal (SIGUSR1, &status_handler); signal (SIGHUP, &null_handler); init_scheduler (); unlink (gconfig.controlfile); myRet=mkfifo (gconfig.controlfile, 0600); // log (LOG_LOG,"gconfig.controlfile=%s, myRet=%d,errno=%d",gconfig.controlfile,myRet,errno);//Added for test if(myRet<0) { log (LOG_CRIT, "%s: Unable to mkfifo %s.",__FUNCTION__, gconfig.controlfile); exit (1); } control_fd = open (gconfig.controlfile, O_RDONLY | O_NONBLOCK, 0600); if (control_fd < 0) { log (LOG_CRIT, "%s: Unable to open %s for reading.", __FUNCTION__, gconfig.controlfile); exit (1); } log (LOG_LOG, "l2tpd version " SERVER_VERSION " started on %s PID:%d\n", hostname, getpid ()); log (LOG_LOG, "Written by Mark Spencer, Copyright (C) 1998, Adtran, Inc.\n"); log (LOG_LOG, "Forked by Scott Balmos and David Stipp, (C) 2001\n"); log (LOG_LOG, "Inherited by Jeff McAdams, (C) 2002\n"); listenaddr.s_addr = gconfig.listenaddr; log (LOG_LOG, "Listening on IP address %s, port %d\n", inet_ntoa(listenaddr), gconfig.port); lac = laclist; while (lac) { if (lac->autodial) { #ifdef DEBUG_MAGIC log (LOG_DEBUG, "%s: Autodialing '%s'\n", __FUNCTION__, lac->entname[0] ? lac->entname : "(unnamed)"); #endif lac->active = -1; switch_io = 1; /* If we're a LAC, autodials will be ICRQ's */ magic_lac_dial (lac); } lac = lac->next; } }