From a61ad1cef9ef77f9afd67230df5470b6b55525be Mon Sep 17 00:00:00 2001 From: FreeArtMan <=> Date: Thu, 17 Dec 2015 20:59:18 +0000 Subject: Initial commit --- mtable.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 mtable.h (limited to 'mtable.h') diff --git a/mtable.h b/mtable.h new file mode 100644 index 0000000..573f3e2 --- /dev/null +++ b/mtable.h @@ -0,0 +1,36 @@ +#ifndef __MTABLE_H +#define __MTABLE_H + +#include +#include +#include + +#include "darray.h" +#include "debug.h" + +typedef struct mt_range { + //range postiont start end + unsigned long start; + unsigned long end; + //cmp array start end + void *cmp; + int cmp_sz; + //note string + void *val; + int val_sz; +} mt_range; + +typedef struct mt_table { + darray *table; +} mt_table; + +mt_table* mt_create(); +int mt_add( mt_table *mt, mt_range *rng ); +mt_range* mt_search( mt_table *mt, int pos ); +int mt_print( mt_table *mt ); +void mt_destroy( mt_table *mt ); + +#define mt_size(MT_TABLE) (darr_end((MT_TABLE)->table)) +#define mt_get(MT_TABLE,X) (darr_get((MT_TABLE)->table,X)) + +#endif \ No newline at end of file -- cgit v1.2.3