示例#1
0
void hexdig_init_D2A (void)
{
#define USC (unsigned char *)
	htinit(hexdig, USC "0123456789", 0x10);
	htinit(hexdig, USC "abcdef", 0x10 + 10);
	htinit(hexdig, USC "ABCDEF", 0x10 + 10);
}
示例#2
0
 void
hexdig_init_D2A(Void)	/* Use of hexdig_init omitted 20121220 to avoid a */
			/* race condition when multiple threads are used. */
{
#define USC (unsigned char *)
	htinit(hexdig, USC "0123456789", 0x10);
	htinit(hexdig, USC "abcdef", 0x10 + 10);
	htinit(hexdig, USC "ABCDEF", 0x10 + 10);
	}
示例#3
0
文件: kn.c 项目: rflynn/shootout
/* count all the 1-nucleotide and 2-nucleotide sequences, and write the
 * code and percentage frequency, sorted */
static void do_freq(const struct buf *seq, unsigned len, char *dst)
{
  struct ht t;
  htinit(&t, HT_BINS, MIN(dna_combo(len), MAX_ENTRIES));
  unsigned long total = freq_build(&t, seq, len);
  {
    struct htentry *e = ht2vec(&t);
    qsort(e, htsize(&t), sizeof *e, freq_cmp);
    freq_print(e, htsize(&t), total, dst);
    free(e);
  }
  htfree(&t);
}
示例#4
0
文件: kn.c 项目: rflynn/shootout
/* count all 'buf' substrings of length 'len', return count for buf[0..len-1] */
static void do_cnt(const struct buf *seq, unsigned len, char *buf)
{
  const char *Match = "GGTATTTTAATTTATAGT";
  unsigned long cnt = 0;
  struct ht t;
  htinit(&t, HT_BINS, MIN(dna_combo(len), MAX_ENTRIES));
  freq_build(&t, seq, len);
  struct htentry *e = htfind(&t, Match, len, index(Match, len));
  if (e)
    cnt = e->val.cnt;
  htfree(&t);
  sprintf(buf, "%lu\t%.*s\n", cnt, len, Match);
}
示例#5
0
DR_EXPORT void
dr_init(client_id_t id)
{

printf("Started dr_init\n");

    dr_register_exit_event(exit_event);
    dr_register_bb_event(bb_event);
    dr_register_thread_init_event(writeLog); 
    count_mutex = dr_mutex_create();
    client_id = id;
#ifdef SHOW_SYMBOLS
    if (drsym_init(0) != DRSYM_SUCCESS) {
        dr_log(NULL, LOG_ALL, 1, "WARNING: unable to initialize symbol translation\n");
    }
#endif

htinit();

}
示例#6
0
main(void)
{
    ht.arr = 0;
    puts("Hash tabulka");
    puts("----------");
    puts("");
menu:
    puts("1 - HashTable_Init()");
    puts("2 - HashTable_Destruct()");
    puts("3 - HashTable_Insert()");
    puts("4 - HashTable_Delete()");
    puts("5 - HashTable_Find()");
    puts("6 - HashTable_Get_Count()");
    puts("7 - HashTable_Clear()");
    puts("8 - HashTable_Process()");
    puts("M - zobraz toto menu");
    puts("K - konec");
    puts("Pro ukonceni stiskni CTRL+D (Linux) nebo CTRL+Z (Windows).");
in:
    if(!gets(t))
        goto out;
    switch(t[0]) {
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
        if(ht.arr)
            break;
        puts("Tabulka neni inicializovana.");
        goto in;
    }
    switch(t[0]) {
    case '1':
        puts("Zadejte velikost tabulky (napr. 1000):");
        htfree(ht);
        ht = htinit(readint());
        goto in;
    case '3':
        if(!readperson())
            break;
        printf("hash: Key: %s\n", k);
        printf("-> Hash index: %d\n", htset(&ht, k, p));
        goto in;
    case '6':
        puts("Velikost tabulky:");
        printf("%d\n", ht.len);
        goto in;
    case '8':
        htwalk(ht, printperson);
        goto in;
    case 'M':
    case 'm':
        goto menu;
    }
out:
    htfree(ht);
    return 0;
}