Beispiel #1
0
 context::context()
 {
   initialize_dictionary(m_dictionary, api::utils);
   initialize_dictionary(m_dictionary, api::boolean);
   initialize_dictionary(m_dictionary, api::date);
   initialize_dictionary(m_dictionary, api::month);
   initialize_dictionary(m_dictionary, api::number);
   initialize_dictionary(m_dictionary, api::quote);
   initialize_dictionary(m_dictionary, api::string);
   initialize_dictionary(m_dictionary, api::time_api);
   initialize_dictionary(m_dictionary, api::vector);
   initialize_dictionary(m_dictionary, api::weekday);
 }
Beispiel #2
0
int main(int argc, char *argv[]){
  // Initialize an empty argument list                                                  
  struct fuse_args mountpt = FUSE_ARGS_INIT(0, NULL);
  // add program and mountpoint                                   
  fuse_opt_add_arg(&mountpt, argv[0]);
  fuse_opt_add_arg(&mountpt, argv[1]);
  //fuse_opt_add_arg(&mountpt, argv[2]);// for debug                            
  //fuse_opt_add_arg(&mountpt, argv[3]);// for debug                   

  log_file_path= argv[2];
  fs_size=atoi(argv[3])*1000000;
  num_blocks=fs_size/block_size;
  if(num_blocks < 1000){
    free_space =block_size;
  }else
  free_space=block_size*4;

  dictionary= malloc(num_blocks*sizeof(int));
  log_fp = fopen (log_file_path,"a+");
  if (log_fp == NULL) {
    printf ("Data file could not be opened\n");
    return 1;
  }
  initialize_dictionary();
  mount=time(NULL);

  struct fuse_args args = FUSE_ARGS_INIT(mountpt.argc, mountpt.argv);
  struct fuse_chan *ch;
  char *mountpoint;
  int err = -1;
  if (fuse_parse_cmdline(&args, &mountpoint, NULL, NULL) != -1 &&
      (ch = fuse_mount(mountpoint, &args)) != NULL) {
    struct fuse_session *se;
    se = fuse_lowlevel_new(&args, &lfs_ll_oper,
			   sizeof(lfs_ll_oper), NULL);
    if (se != NULL) {
      if (fuse_set_signal_handlers(se) != -1) {
	fuse_session_add_chan(se, ch);
	/* Block until ctrl+c or fusermount -u */
	err = fuse_session_loop(se);
	fuse_remove_signal_handlers(se);
	fuse_session_remove_chan(ch);
      }
      fuse_session_destroy(se);
      unmount=time(NULL);
      write_stats();
    }
    fuse_unmount(mountpoint, ch);
  }
  fuse_opt_free_args(&args);
  free(dictionary);
  fclose(log_fp);
  return err ? 1 : 0;

}
Beispiel #3
0
int main(int argc, char **argv) {


	if(argc >= 1){//Mudar dps para 3<<<<<<<<<<<<<<<<<<<<<<<<<

		initialize_dictionary(argv[1]);

		initialize_text(argv[2]);


//TODO
		//1 - ver o lance do malloc do append(segmentation fault




		exist_word(gno_root_dictionary,NULL);//Mostra a saída
		show_list(gno_sugestion);

	}else{
		printf("Bad arguments");
	}
	return 0;
}