Ejemplo n.º 1
0
void
kvst_sample_init(int rows, int cols)
{
    has_backup = 0;
    kvst_set_bktmgr(def_imgr);
    mgrs[imgr]->mbm_mbks_init(rows, cols);
    ncols = cols;
    nrows = rows;
    est_init();
    bsampling = 1;
}
Ejemplo n.º 2
0
int
main(int argc, char * const*argv)
{
  List *files = list_create(LIST_SINGLE);
  char *fn;
  unsigned char *key;
  FILE*keysf;
  const char *keysname, *fldsname;
  int i,top;

  f_log = stderr;

  options(argc,argv,"2c:p:s");

  if (!curr_project)
    usage();

  setlocale(LC_ALL,LOCALE);

  if (l2)
    vidp = vid_load_data(se_file(curr_project,"cat","vid.dat"));

  estp = est_init(curr_project, "cat");

  dp = dbi_create("cat",
		  se_dir(curr_project,"cat"),
		  500000,
		  sizeof(struct location8),DBI_ACCRETE);
  dbi_set_cache(dp,cache_size);
  dbi_set_user(dp,d_cat);

  progress("secatx: creating index %s\n",dp->dir);
  pqidsf = xfopen(se_file(curr_project,"cat","pqids.lst"),"w");
  fldsname = strdup(se_file(curr_project,"cat","fieldnames.tab"));
  fldsf = xfopen(fldsname,"w");
  
  for (i = 0,top=(sizeof(static_names)/sizeof(const char *))-3; 
       i < top; 
       ++i)
    {
      struct sn_tab *s = statnames(static_names[i],strlen(static_names[i]));
      fprintf(fldsf,"%s\t%d\n",static_names[i],s->uid);
    }

  if (one_big_stdin)
    {
      runexpat(i_stdin, NULL, startElement, endElement);
    }
  else
    {
      while (NULL != (fn = fgets(fnbuf,_MAX_PATH,stdin)))
	{
	  fn[strlen(fn)-1] = '\0';
	  list_add(files,strdup(fn));
	}
      fnlist = malloc(1+files->count * sizeof(const char *));
      findex = 0;
      list_exec(files,fn_expand);
      runexpat(i_list, fnlist, startElement, endElement);
    }

  dbi_flush(dp);
  dbi_free(dp);

  est_dump(estp);
  est_term(estp);

  if (l2)
    {
      vid_free(vidp);
      vidp = NULL;
    }

  progress("secatx: completed db creation\n");
  dp = dbi_open("cat",se_dir(curr_project,"cat"));
  if (dp && dp->h.entry_count > 0)
    {
      keysname = strdup(se_file(curr_project,"cat","key.lst"));
      keysf = xfopen(keysname,"w");
      while (NULL != (key = dbi_each (dp)))
#if 1
	fprintf(keysf,"%s\n",key);
#else
      fprintf(keysf,"%lu\t%s\n",(unsigned long)dp->nfound,key);
#endif
      xfclose(keysname,keysf);
    }
  else
    {
      fprintf(stderr,"secatx: no keys in input\n");
    }
  dbi_close(dp);
  xfclose(fldsname,fldsf);

  ce_cfg(curr_project, "cat", "catalog", "xmd", ce_xmd, NULL);

  return 0;
}
Ejemplo n.º 3
0
int
main(int argc, char * const*argv)
{
  unsigned char *key;
  FILE*keysf;
  const char *keysname, *fldsname, *vids;
  char *gdfpath = NULL;
  extern int vid_obey_dots;

  f_log = stderr;

  options(argc,argv,"p:");

  if (!curr_project)
    usage();

  setlocale(LC_ALL,LOCALE);

  vid_obey_dots = 0;
  vidp = vid_init();

  gdfpath = malloc(strlen(curr_project)+1);
  sprintf(gdfpath, "%s", curr_project);

  estp = est_init(gdfpath, "cat");

  dp = dbi_create("cat",
		  se_dir(gdfpath,"cat"),
		  500000,
		  sizeof(struct location8),DBI_ACCRETE);
  dbi_set_cache(dp,cache_size);
  dbi_set_user(dp,d_cat);

  progress("segdfx: creating index %s\n",dp->dir);
  pqidsf = xfopen(se_file(gdfpath,"cat","pqids.lst"),"w");
  fldsname = strdup(se_file(gdfpath,"cat","fieldnames.tab"));
  fldsf = xfopen(fldsname,"w");
  
  runexpat(i_stdin, NULL, startElement, endElement);

  dbi_flush(dp);
  dbi_free(dp);

  est_dump(estp);
  est_term(estp);

  vids = se_file (gdfpath, curr_index, "vid.dat");
  vid_dump_data(vidp,vids);
  vid_term(vidp);
  vidp = NULL;

  progress("segdfx: completed db creation\n");

  dp = dbi_open("cat",se_dir(gdfpath,"cat"));
  if (dp && dp->h.entry_count > 0)
    {
      keysname = strdup(se_file(gdfpath,"cat","key.lst"));
      keysf = xfopen(keysname,"w");
      while (NULL != (key = dbi_each (dp)))
	fprintf(keysf,"%s\n",key);
      xfclose(keysname,keysf);
    }
  else
    {
      fprintf(stderr,"segdfx: no keys in input\n");
    }
  dbi_close(dp);
  xfclose(fldsname,fldsf);

  ce_cfg(gdfpath, "cat", "catalog", "xmd", ce_xmd, NULL);

  return 0;
}