X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sam_header.h;h=e5c754f3649ce6a13e6f5cb3ca93275d13bb67fe;hb=6714aa07f8d3ec25225cc691066da89ca1bd0e9b;hp=4f633ed7625c9591cd664387a882e88b0622b490;hpb=d410ecbf60b5aed90ee20c6ba40637ca50241edd;p=samtools.git diff --git a/sam_header.h b/sam_header.h index 4f633ed..e5c754f 100644 --- a/sam_header.h +++ b/sam_header.h @@ -1,48 +1,24 @@ #ifndef __SAM_HEADER_H__ #define __SAM_HEADER_H__ -#include "khash.h" -KHASH_MAP_INIT_STR(str,const char *) - -// HeaderDict is a list_t of header lines. Each HeaderLine holds a list of tags. -struct _list_t -{ - struct _list_t *next; - void *data; -}; -typedef struct _list_t list_t; -typedef list_t HeaderDict; - -typedef struct -{ - char key[2]; - char *value; -} -HeaderTag; - -typedef struct -{ - char type[2]; - list_t *tags; -} -HeaderLine; - - -void debug(const char *format, ...); -void error(const char *format, ...); +#ifdef __cplusplus +extern "C" { +#endif -HeaderDict *sam_header_parse(const char *headerText); -void sam_header_free(HeaderDict *header); -char *sam_header_write(const HeaderDict *headerDict); // returns a newly allocated string + void *sam_header_parse2(const char *headerText); + void *sam_header_merge(int n, const void **dicts); + void sam_header_free(void *header); + char *sam_header_write(const void *headerDict); // returns a newly allocated string -khash_t(str) *sam_header_lookup_table(const HeaderDict *dict, char type[2], char key_tag[2], char value_tag[2]); + char **sam_header2list(const void *_dict, char type[2], char key_tag[2], int *_n); -list_t *list_append(list_t *root, void *data); -void list_free(list_t *root); + void *sam_header2tbl(const void *dict, char type[2], char key_tag[2], char value_tag[2]); + const char *sam_tbl_get(void *h, const char *key); + int sam_tbl_size(void *h); + void sam_tbl_destroy(void *h); -//HeaderDict *sam_header_merge(int n, const HeaderDict **dicts); // if n=1, the func clones the dictionary -//char *sam_header_get(const HeaderDict *d, char type[2], int i, char tag[2]); -//int sam_header_ins(HeaderDict *d, char tp[2], int i, char tg[2], const char *s); -//int sam_header_del(HeaderDict *d, char type[2], int i, char tag[2]); +#ifdef __cplusplus +} +#endif #endif