diff options
author | FreeArtMan <=> | 2015-12-17 20:59:18 +0000 |
---|---|---|
committer | FreeArtMan <=> | 2015-12-17 20:59:18 +0000 |
commit | a61ad1cef9ef77f9afd67230df5470b6b55525be (patch) | |
tree | d8bae5fc932865e769e4965ce0817b6d107badf2 /mtable.h | |
download | dm-a61ad1cef9ef77f9afd67230df5470b6b55525be.tar.gz dm-a61ad1cef9ef77f9afd67230df5470b6b55525be.zip |
Initial commit
Diffstat (limited to 'mtable.h')
-rw-r--r-- | mtable.h | 36 |
1 files changed, 36 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> +#include <stdint.h> + +#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 |