#include "gb-include.h" #include "Unicode.h" #include "Words.h" //#include "Tokens.h" #include int32_t elapsed_usec(const timeval* tv1, const timeval *tv2) { int32_t sec_elapsed = (tv2->tv_sec - tv1->tv_sec); int32_t usec_elapsed = tv2->tv_usec - tv1->tv_usec; if (usec_elapsed<0){ usec_elapsed += 1000000; sec_elapsed -=1; } usec_elapsed += sec_elapsed*1000000; return usec_elapsed; } // Read unicode from a file and parse into words int main(int argc, char**argv) { if (argc < 2){ fprintf(stderr, "Usage: %s filename ...\n", argv[0]); exit(1); } init_unicode(); if ( ! hashinit() ) { log("db: Failed to init hashtable." ); return 1; } // . hashinit() calls srand() w/ a fixed number // . let's mix it up again srand ( time(NULL) ); int i; for (i=1;i max_words) max_words = tokens.getNumTokens(); // // Print tokenization side by side for (foo=0;foo=0x20) && ((unsigned)c<=0x7f)){ //putchar(c); printf("%4c", (unsigned char)c); } else{ printf("<%02lX>", (u_int32_t)c); } } for(n=words.getWordLen(foo);n<15;n++) printf(" "); } else{ printf("%60s", ""); } printf(" | "); if (foo