void main(void) { general_setup(); adc_setup(); uart_setup(); __enable_interrupt(); //__bis_SR_register(CPUOFF+GIE); while(1) { } }
int main(int argc, char *argv[]) { int res; if (argc == 6) { nbTeams = (int) strtol(argv[1], &argv[1], 10); //TODO : mettre des #define pour equipe min et max if (nbTeams > 10 || nbTeams < 2) { printf("Please enter a number of teams between 2 and %d\n", 10); //TODO : wtf ? 50% string 50% %d ? exit(EXIT_SUCCESS); } nbPlayers = (int) strtol(argv[2], &argv[2], 10); if (nbPlayers > MAXPLAYERS || nbPlayers < 2) { printf("Please enter a number of players between 2 and %d\n", MAXPLAYERS); exit(EXIT_SUCCESS); } //tell photon server the ip adress NotifyPhotonServer(argv[5]); networkLoad = (int) strtol(argv[3], &argv[3], 10); networkLoadinterval = (int) strtol(argv[4], &argv[4], 10); printf("%d teams, %d players\n", nbTeams, nbPlayers); } else { printf("Airstrike nbOfTeams nbOfPlayers NetworkLoad(Bytes) networkLoadinterval(ms) IPadressOfPhoton\n"); exit(EXIT_SUCCESS); } res = general_setup() == 0; assert(res); engine_setup(); DEBUGPOINT(1); teams_setup(); DEBUGPOINT(42); players_setup(); objects_setup(); planeCollision=cfgnum("game.planeCollision",1); networkport = cfgnum("network.port",1234); network_init(); Mix_Music *play_sound = NULL; play_sound = Mix_LoadMUS("data/sound/Xcyril-La_decouverte_et_la_conquete.wav"); Mix_PlayMusic(play_sound, -1); //Mix_VolumeMusic(MIX_MAX_VOLUME/2); fprintf(stderr, "Entering main loop.\n"); while (process_events()) { if (!paused) { if(inGame){ game_frame(); }else{ connect_frame(); } } else { console_mode(); paused = 0; } } // We probably never get here right now, because of exit() calls. fprintf(stderr, "Left main loop.\n"); sprite_group_free(mech_group); sprite_group_free(bomb_group); sprite_group_free(bullet_group); sprite_group_free(effects_group); sprite_group_free(foreground_group); return EXIT_SUCCESS; }
void SSerialInterface::process_options(int margc, char ** margv) { print_args(margc,margv); printf("SSerialInterface::process_options()\n"); for (;;) { int option_index = 0; static const char *short_options = "hb:p:d:R:TsSy:z:certq:l:a:w:o:i:"; static const struct option long_options[] = { {"help", no_argument, 0, 0}, {"baud", required_argument, 0, 'b'}, {"port", required_argument, 0, 'p'}, {"divisor", required_argument, 0, 'd'}, {"rx_dump", required_argument, 0, 'R'}, {"detailed_tx", no_argument, 0, 'T'}, {"stats", no_argument, 0, 's'}, {"stop-on-err", no_argument, 0, 'S'}, {"single-byte", no_argument, 0, 'y'}, {"second-byte", no_argument, 0, 'z'}, {"rts-cts", no_argument, 0, 'c'}, {"dump-err", no_argument, 0, 'e'}, {"no-rx", no_argument, 0, 'r'}, {"no-tx", no_argument, 0, 't'}, {"rx-delay", required_argument, 0, 'l'}, {"tx-delay", required_argument, 0, 'a'}, {"tx-bytes", required_argument, 0, 'w'}, {"rs485", required_argument, 0, 'q'}, {"tx-time", required_argument, 0, 'o'}, {"rx-time", required_argument, 0, 'i'}, {0,0,0,0}, }; printf("SSerialInterface::calling getopt_long()\n"); printf("%d: \n", margc ); for (int i=0; i<margc; i++) printf("argv[%d]=%s\n", i, margv[i] ); int c = getopt_long(margc, margv, short_options, long_options, &option_index ); printf("c=(%c) : \n", c); if (c == EOF) { break; } printf("Serial Cmd Line Option: (%c) : \n", c); switch (c) { case 0: //display_help(); break; case 'h': //display_help(); break; case 'b': _cl_baud = atoi(optarg); break; case 'p': _cl_port = strdup(optarg); break; case 'd': _cl_divisor = atoi(optarg); break; case 'R': _cl_rx_dump = 1; //printf("Serial : (\"-r\") READ DUMP Requested\n"); _cl_rx_dump_ascii = !strcmp(optarg, "ascii"); break; case 'T': _cl_tx_detailed = 1; break; case 's': _cl_stats = 1; break; case 'S': _cl_stop_on_error = 1; break; case 'y': { char * endptr; _cl_single_byte = strtol(optarg, &endptr, 0); break; } case 'z': { char * endptr; _cl_another_byte = strtol(optarg, &endptr, 0); break; } case 'c': _cl_rts_cts = 1; break; case 'e': _cl_dump_err = 1; break; case 'r': _cl_no_rx = 1; break; case 't': _cl_no_tx = 1; break; case 'l': { char *endptr; _cl_rx_delay = strtol(optarg, &endptr, 0); break; } case 'a': { char *endptr; _cl_tx_delay = strtol(optarg, &endptr, 0); break; } case 'w': { char *endptr; _cl_tx_bytes = strtol(optarg, &endptr, 0); break; } case 'q': { char *endptr; _cl_rs485_delay = strtol(optarg, &endptr, 0); break; } case 'o': { char *endptr; _cl_tx_time = strtol(optarg, &endptr, 0); break; } case 'i': { char *endptr; _cl_rx_time = strtol(optarg, &endptr, 0); break; } } } printf("calling general_setup()\n"); general_setup(); printf("Exited process_options()\n"); }