aboutsummaryrefslogtreecommitdiffstats
path: root/mtable.h
diff options
context:
space:
mode:
Diffstat (limited to 'mtable.h')
-rw-r--r--mtable.h36
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