void gt_fa_xbzclose(BZFILE *stream) { if (!fa) fa_init(); gt_assert(fa); if (!stream) return; xfclose_generic(stream, GFM_BZIP2, fa); }
void gt_fa_xgzclose(gzFile stream) { if (!fa) fa_init(); gt_assert(fa); if (!stream) return; xfclose_generic(stream, GFM_GZIP, fa); }
void gt_fa_xfclose(FILE *stream) { if (!fa) fa_init(); gt_assert(fa); if (!stream) return; xfclose_generic(stream, GFM_UNCOMPRESSED, fa); }
gzFile gt_fa_xgzopen_func(const char *path, const char *mode, const char *filename, int line) { gt_assert(path && mode); if (!fa) fa_init(); gt_assert(fa); return fileopen_generic(fa, path, mode, GFM_GZIP, true, filename, line, NULL); }
gzFile gt_fa_gzopen_func(const char *path, const char *mode, const char *filename, int line, GtError *err) { gt_error_check(err); gt_assert(path && mode); if (!fa) fa_init(); gt_assert(fa); return fileopen_generic(fa, path, mode, GFM_GZIP, false, filename, line, err); }
FILE* gt_fa_xfopen_func(const char *path, const char *mode, const char *filename, int line) { gt_assert(path && mode); if (!fa) fa_init(); gt_assert(fa); return fileopen_generic(fa, path, mode, GFM_UNCOMPRESSED, true, filename, line, NULL); }
int mr_destroy(void) { if(pthread_barrier_destroy(&barrier)) { perror("bar init"); return -1; } if(fa_init(file_name, nb_thread, &file_size)) return -1; if(wcc_destroy(nb_thread)) return -1; return 0; }
/*********** Main thread functions **************/ int mr_init(void) { if(pthread_barrier_init( &barrier, NULL, nb_thread)) { perror("bar init"); return -1; } if(fa_init(file_name, nb_thread, &file_size)) return -1; /* TODO: better heuristique for nb_buckets */ if(wcc_init(nb_thread, file_size/AMAX_WORD_SIZE)) return -1; return 0; }
struct fa_t* fa_new(enum fa_mode mode, size_t type, struct state_t *states, size_t num_states) { struct fa_t *a = malloc(sizeof(struct fa_t)); assert(a != NULL); fa_init(a, mode, type, states, num_states); return a; }