Пример #1
0
manager::manager(const config &gamecfg, CVideo &video, gui::scrollpane *pane, const config &values)
	: options_info_()
	, values_(values)
	, video_(video)
	, pane_(pane)
	, era_()
	, scenario_()
	, is_campaign_()
	, modifications_()
	, widgets_()
	, widgets_ordered_()
{
	DBG_MP << "Initializing the options manager" << std::endl;
	init_info(gamecfg, "modification");
	init_info(gamecfg, "era");
	init_info(gamecfg, "multiplayer");
	init_info(gamecfg, "campaign");

	BOOST_FOREACH (const config::any_child& i,
				   options_info_.all_children_range())
	{
		BOOST_FOREACH (const config::any_child& j, i.cfg.all_children_range())
		{
			if (is_valid_option(j.key, j.cfg)) {
				config& value = get_value_cfg(j.cfg["id"]);
				value["value"] = get_stored_value(j.cfg["id"]);
			}
		}
	}

	init_widgets();
}
Пример #2
0
FXbool VorbisDecoder::init_decoder() {
  const FXuchar * data_ptr = get_packet_offset();

  // Initialize Info
  init_info();

  while(get_next_packet()) {
    if (is_vorbis_header()) {
      if (vorbis_synthesis_headerin(&info,&comment,&op)<0) {
        GM_DEBUG_PRINT("[vorbis] vorbis_synthesis_headerin failed\n");
        return false;
        }
      }
    else { // First non header

      if (vorbis_synthesis_init(&dsp,&info)<0)
        return false;

      if (vorbis_block_init(&dsp,&block)<0) {
        vorbis_dsp_clear(&dsp);
        return false;
        }

      has_dsp=true;
      push_back_packet();
      return true;
      }
    }

  vorbis_info_clear(&info);

  set_packet_offset(data_ptr);
  return true;
  }
Пример #3
0
/*
 * Initialize the "r_info" array
 */
static errr init_r_info(void)
{
	int i;
	errr err;

	/* Init the header */
	init_header(&r_head, z_info->r_max, sizeof(monster_race));

	/* Save a pointer to the parsing function */
	r_head.parse_info_txt = parse_r_info;

	/* Save a pointer to the evaluate power function*/
	r_head.eval_info_post = eval_r_power;

	/* Save a pointer to the text file output function*/
	if (arg_rebalance) r_head.emit_info_txt_index = emit_r_info_index;

	err = init_info("monster", &r_head);

	/* Set the global variables */
	r_info = r_head.info_ptr;
	r_name = r_head.name_ptr;
	r_text = r_head.text_ptr;
	tot_mon_power = 0;
	for (i = 0; i < z_info->r_max; i++) 
	{
		tot_mon_power += r_info[i].power;
	} 

	return (err);
}
Пример #4
0
/* ------------------------------------------------------------- **
**  Sets up the control connection to the server and initialises
**  session info.
** ------------------------------------------------------------- */
void init_session(int fd, struct sockaddr_in source)
{
	info = init_info(fd, source);

	write_log(INFO, "Connect from %s",
		  sstr_buf(addr2name(info->client_control.address.sin_addr)));

	/*FIXME have a login function which deals with ntp and cache */
	ccp_changedest();
	ntp_changedest();
	info->final_server_address = info->server_control.address;

	write_log(INFO, "... to %s(%s)",
		  inet_ntoa(info->final_server_address.sin_addr),
		  sstr_buf(info->server_name));

#ifdef ENABLE_CHANGEPROC
	set_proc_title("frox: %s <-> %s",
		       inet_ntoa(info->client_control.address.sin_addr),
		       inet_ntoa(info->final_server_address.sin_addr));
#endif
	connect_to_server();

	ntp_senduser();

	run_proxy();
}
Пример #5
0
int main(int argc, char **argv) {

    int n, k;
    double pas;
    double *x, *y, *x0, *x1, *tmp;
    struct info_t info;

    const char *donnees = argv[1]; /* le fichier des donnees bruitees */
    n = atoi(argv[2]); /* nombre de donnees bruitees */

    pas = 1./n;

    init_info(n, &info);

    x = (double*)malloc((n+2)*sizeof(double));
    y = (double*)malloc((n+2)*sizeof(double));

    lire_fichier(donnees, x, &info);

    x0 = x;
    x1 = y;
    for( k = 1 ; k <= KMAX ; k++ ) {
	lissage(x0, &info, x1);
	tmp = x0;
	x0 = x1;
	x1 = tmp;
    }

    ecrire_fichier("lissage.txt", x0, &info);

    free(x);
    free(y);

    return 0;
}
Пример #6
0
int main(int argc, char **argv)
{
    int ins_pid;

    init_arguments (&argc, &argv);

    //打开锁文件
    lockfile = open (LOCKFILE, O_RDWR | O_CREAT , LOCKMODE);
    if (lockfile < 0){
        perror ("Lockfile");
        exit(EXIT_FAILURE);
    }

    if ( (ins_pid = program_running_check ()) ) {
        fprintf(stderr,"@@ERROR: zRuijie Already "
                            "Running with PID %d\n", ins_pid);
        exit(EXIT_SUCCESS);
    }
    init_info();
    init_device();
    init_frames ();

    signal (SIGINT, signal_interrupted);
    signal (SIGTERM, signal_interrupted);
    signal (SIGALRM, signal_alarm);

    show_local_info();

    send_eap_packet (EAPOL_START);
    alarm(5);

	pcap_loop (handle, -1, get_packet, NULL);   /* main loop */
    pcap_close (handle);
    return 0;
}
Пример #7
0
t_info		*init()
{
  t_info	*info;

  init_random();
  info = init_info();
  init_signal(info);
  return (info);
}
Пример #8
0
static void init(void) {
	load_data();

	init_menu();
	init_main();
	init_info();

	window_stack_push(window_menu, true);
}
Пример #9
0
/*
 * Initialize the "z_info" array
 */
static errr init_z_info(void)
{
	errr err;

	/* Init the header */
	init_header(&z_head, 1, sizeof(maxima));

	/* Save a pointer to the parsing function */
	z_head.parse_info_txt = parse_z_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("limits", &z_head);
	else err = init_info("m_limits", &z_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	z_info = z_head.info_ptr;

	return (err);
}
Пример #10
0
void init_cli(void)
{
	//initialize the hardware
	init_leds();
	init_uart();
	init_info();
	init_keyboard();

	cli_set_prompt(CLI_PROMPT);
}
Пример #11
0
/*
 * Initialize the "h_info" array
 */
static errr init_h_info(void)
{
	errr err;

	/* Init the header */
	init_header(&h_head, z_info->h_max, sizeof(hist_type));

	/* Save a pointer to the parsing function */
	h_head.parse_info_txt = parse_h_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("p_hist", &h_head);
	else err = init_info("m_p_hist", &h_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	h_info = h_head.info_ptr;
	h_text = h_head.text_ptr;

	return (err);
}
Пример #12
0
/*
 * Initialize the "r_info" array
 */
static errr init_r_info(void)
{
	errr err;

	/* Init the header */
	init_header(&r_head, z_info->r_max, sizeof(monster_race));

	/* Save a pointer to the parsing function */
	r_head.parse_info_txt = parse_r_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("monster", &r_head);
	else err = init_info("m_monster", &r_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	r_info = r_head.info_ptr;
	r_text = r_head.text_ptr;

	return (err);
}
Пример #13
0
/*
 * Initialize the "e_info" array
 */
static errr init_e_info(void)
{
	errr err;

	/* Init the header */
	init_header(&e_head, z_info->e_max, sizeof(ego_item_type));

	/* Save a pointer to the parsing function */
	e_head.parse_info_txt = parse_e_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("ego_item", &e_head);
	else err = init_info("m_ego_item", &e_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	e_info = e_head.info_ptr;
	e_name = e_head.name_ptr;
	e_text = e_head.text_ptr;
	return (err);
}
Пример #14
0
/*
 * Initialize the "q_info" array
 */
static errr init_q_info(void)
{
	errr err;

	/* Init the header */
	init_header(&q_head, z_info->q_max, sizeof(quest_type));

	/* Save a pointer to the parsing function */
	q_head.parse_info_txt = parse_q_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("quest", &q_head);
	else err = init_info("m_quest", &q_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	q_info = q_head.info_ptr;
	q_name = q_head.name_ptr;

	return (err);
}
Пример #15
0
int main(int argc, char **argv) {
    struct pollfd fds[POLL_MAX];
    int sockfd, clifd, polled=0, i;
    struct serv_conf conf;
    struct mime * mime_tbl;
    struct cgi * cgi_tbl;
    struct addrinfo *info;
    struct sockaddr_storage cli_addr;
    socklen_t addr_size;

    init_conf(&conf);
    init_info(conf.port, &info);
    mime_tbl = init_mime_table();
    cgi_tbl = init_cgi_table();

    sockfd = init_sock(info);
    if(sockfd==-1) return -1;

    memset(fds, 0, sizeof(struct pollfd)*POLL_MAX);
    for(i=0;i<POLL_MAX;i++) fds[i].fd = -1;
    fds[0].fd = sockfd;
    fds[0].events = POLLRDNORM;


    while(1) {
        polled = poll(fds, POLL_MAX, -1);
        if(polled==-1) {
            fprintf(stderr, "poll() error\n");
            continue;
        }

        if(fds[0].revents & POLLRDNORM) {
            /* Handle new connection */
            clifd = accept(sockfd, (struct sockaddr *) &cli_addr, &addr_size);
            for(i=1;i<POLL_MAX;i++) {
                if(fds[i].fd==-1) {
                    fds[i].fd = clifd;
                    fds[i].events = POLLRDNORM;
                    break;
                }
            }
        }

        for(i=1;i<POLL_MAX;i++) {
            if(fds[i].fd!=-1&&(fds[i].revents & POLLRDNORM)) {
                handle_request(mime_tbl, cgi_tbl, conf.pub_dir, fds[i].fd);
                close(fds[i].fd);
                fds[i].fd = -1;
                --polled;
            }
            if(polled==0) break;
        }
    }
    return 0;
}
Пример #16
0
/*
 * Initialize the "c_info" array
 */
static errr init_c_info(void)
{
	errr err;

	/* Init the header */
	init_header(&c_head, z_info->c_max, sizeof(player_class));

	/* Save a pointer to the parsing function */
	c_head.parse_info_txt = parse_c_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("p_class", &c_head);
	else err = init_info("m_p_class", &c_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	c_info = c_head.info_ptr;
	c_name = c_head.name_ptr;
	c_text = c_head.text_ptr;

	return (err);
}
Пример #17
0
/*
 * Initialize the "a_info" array
 */
static errr init_a_info(void)
{
	errr err;

	/* Init the header */
	init_header(&a_head, z_info->art_max, sizeof(artifact_type));

	/* Save a pointer to the parsing function */
	a_head.parse_info_txt = parse_a_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("artifact", &a_head);
	else err = init_info("m_artifact", &a_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	a_info = a_head.info_ptr;

	a_text = a_head.text_ptr;

	return (err);
}
Пример #18
0
/*
 * Initialize the "k_info" array
 */
static errr init_k_info(void)
{
	errr err;

	/* Init the header */
	init_header(&k_head, z_info->k_max, sizeof(object_kind));

	/* Save a pointer to the parsing function */
	k_head.parse_info_txt = parse_k_info;

	if (game_mode == GAME_NPPANGBAND) err = init_info("object", &k_head);
	else err = init_info("m_object", &k_head);  /* game_mode == NPPMORIA */

	/* Set the global variables */
	k_info = k_head.info_ptr;
	k_name = k_head.name_ptr;
	k_text = k_head.text_ptr;

	return (err);
}
Пример #19
0
void init_cli(void)
{
	//initialize the hardware
	init_leds();
	init_uart();
	init_info();
	init_24lc16b();
	init_25lc040a();

	cli_set_prompt(CLI_PROMPT);
}
Пример #20
0
int				main(void)
{
	t_info		info;
	extern char	**environ;

	init_info(&info);
	info.env = ft_envcpy(environ);
	sh_sig_init(&info);
	sh_loop(&info);
	ft_putendl("EXIT SUCCESS");
	return (EXIT_SUCCESS);
}
Пример #21
0
/*
 * Initialize the "b_info" array
 */
static errr init_b_info(void)
{
	errr err;

	/* Init the header */
	init_header(&b_head, (u16b)(MAX_STORES * z_info->b_max), sizeof(owner_type));

	/* Save a pointer to the parsing function */
	b_head.parse_info_txt = parse_b_info;


	if (game_mode == GAME_NPPANGBAND) err = init_info("shop_own", &b_head);
	else err = init_info("m_shop_own", &b_head);

	/* Set the global variables */
	b_info = b_head.info_ptr;
	b_name = b_head.name_ptr;
	b_text = b_head.text_ptr;

	return (err);
}
Пример #22
0
/* parse commandLine for spaces */
struct cmdInfo *parse(char *commandLine)
{
		 int i=0;
		 int numSpc=0;
		 struct cmdInfo *info = malloc(sizeof(struct cmdInfo));

		 // Count the tokens we will need
		 for (i=0; commandLine[i] != '\0'; i++) {
					if (commandLine[i] == ' ')
							 numSpc++;
		 }

		 // We have the number of tokens, initialize the space for them.
		 info->numArgs = numSpc;	
		 init_info(info);

		 // Tokenize the string through spaces.
		 i=0;
		 char commandDup[(int)strlen(commandLine)];
		 strcpy(commandDup, commandLine); // Needed because string constancy with strtok
		 char *token = strtok(commandDup, " "); // The strtok buffer
		 while (token) {
					//info->commandTokens[i] = (char*)malloc(50*sizeof(char)); //initialize this token's array
					info->commandTokens[i] = malloc (strlen(token)*sizeof(char));
					strcpy (info->commandTokens[i++], token);
					if (strcmp(token, "<")==0) {
							 //info->inpipe = malloc(50*sizeof(char));
							 token = strtok( NULL, " ");
							 info->inpipe = malloc(strlen(token)*sizeof(char));
							 info->commandTokens[i] = malloc (strlen(token)*sizeof(char));
							 strcpy (info->commandTokens[i++], token);
							 strcpy (info->inpipe, token);
					}
					if (strcmp(token, ">")==0) {
							 //info->output = malloc(50*sizeof(char));
							 token = strtok( NULL, " ");
							 info->output = malloc(strlen(token)*sizeof(char));
							 info->commandTokens[i] = malloc (strlen(token)*sizeof(char));
							 strcpy (info->commandTokens[i++], token);
							 strcpy (info->output, token);
					}
					token = strtok( NULL, " ");
		 }

		 // "Is this a backgrounded program?" check
		 if (strcmp(info->commandTokens[numSpc], "&")==0)
					info->background = TRUE;
	
		 return info;
}
Пример #23
0
/*   parse commandline for space separated commands */
parseInfo *parse (char *cmdline) {
  parseInfo *Result;
  char command[MAXLINE];
  int com_pos = -1;
  
  if (cmdline[-1] == '\n' && cmdline[-1] == '\0')
    return NULL;
  
  Result = (parseInfo *)malloc(sizeof(parseInfo));
  init_info(Result);
  parse_command(cmdline, &Result->CommArray[Result->pipeNum]);
  
  return Result;
}
Пример #24
0
//init memory with a uniq global reference
//size correspond to the total number of ref
void init_memory(int size, struct info *inf){
    if(inf->rank==CENTRAL_NODE){
        inf->cpt_end_simu = 0;//compting msg until next scheduling
        for(int i=0; i<size; i++){
            Data dat = Data(i+1, i+1, 0);//corresponding with ref and add 
                                         //of node's mem_local
            std::pair<int, Data> p = std::make_pair(dat.ref, dat); 
            inf->cn.mem_global.insert(p);
        }
    }
    else{
        init_info(size, inf); 
    }
}
Пример #25
0
int		ft_action_b(char *f, int lenud, va_list ap)
{
	t_printf		info;
	int				len;
	unsigned int	nbr;
	char			*tmp;

	info.type = 'b';
	init_info(&info, f, lenud, ap);
	if ((nbr = ft_get_value_ou(ap, &info)) == 2)
	{
		nbr = va_arg(ap, unsigned int);
		info.value = ft_zutoa((size_t)nbr);
	}
Пример #26
0
lp_ac_instance CALL_CONVT ac_init(void) { 
  ac_init_ffmpeg();
  
  //Allocate a new instance of the videoplayer data and return it
  lp_ac_data ptmp;  
  ptmp = (lp_ac_data)av_malloc(sizeof(ac_data));
  
  //Initialize the created structure
  memset(ptmp, 0, sizeof(ac_data));
  
  ptmp->instance.opened = 0;
  ptmp->instance.stream_count = 0;
  ptmp->instance.output_format = AC_OUTPUT_RGBA32;
  init_info(&(ptmp->instance.info));
  return (lp_ac_instance)ptmp;  
}
Пример #27
0
/*
 * Initialize the "n_info" structure
 */
static errr init_n_info(void)
{
  errr err;

  /* Init the header */
  init_header(&n_head, 1, sizeof(names_type));

  /* Save a pointer to the parsing function */
  n_head.parse_info_txt = parse_n_info;

  err = init_info("names", &n_head);

  n_info = n_head.info_ptr;

  return (err);
}
Пример #28
0
int		main(int argc, char **argv)
{
	t_info	info;
	int		n;

	init_info(&info);
	n = check_args(argc, argv);
	if (n)
		info.elem_a = store_stack(&info.a, n, ft_strsplit(argv[1], ' '), !(n));
	else
		info.elem_a = store_stack(&info.a, argc, argv, !(n));
	info.max = info.elem_a;
	check_dup(info.a);
	info.median = median(&info);
	run_sort_algorithms(&info);
	return (0);
}
Пример #29
0
/*
 * Initialize the "z_info" array
 */
static errr init_z_info(void)
{
	errr err;

	/* Init the header */
	init_header(&z_head, 1, sizeof(maxima));

	/* Save a pointer to the parsing function */
	z_head.parse_info_txt = parse_z_info;

	err = init_info("limits", &z_head);

	/* Set the global variables */
	z_info = z_head.info_ptr;

	return (err);
}
Пример #30
0
void EXTIx::begin()
{
	init_info(exti_pin);
	
	exti_pin->mode(INPUT);
	
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);
	
	EXTI_InitTypeDef EXTI_InitStructure;
	/* EXTI line(PB0) mode config */
	GPIO_EXTILineConfig(port_source, pin_source); 
  EXTI_InitStructure.EXTI_Line = exti_line;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = trigger; //下降沿中断
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure); 

}