aboutsummaryrefslogtreecommitdiff
path: root/vector.h
diff options
context:
space:
mode:
Diffstat (limited to 'vector.h')
-rw-r--r--vector.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/vector.h b/vector.h
new file mode 100644
index 00000000..f6acd66a
--- /dev/null
+++ b/vector.h
@@ -0,0 +1,27 @@
+#ifndef VECTOR_H
+#define VECTOR_H
+
+#include <stdlib.h>
+#include "macro.h"
+
+#define VECT(T) TEMPL(vect, T)
+
+#endif /* VECTOR_H */
+
+#ifdef TYPE
+
+typedef struct {
+ unsigned int length;
+ unsigned int alloc;
+ TYPE** items;
+} VECT(TYPE);
+
+INIT_F(VECT(TYPE));
+FREE_F(VECT(TYPE));
+
+int PUSH(VECT(TYPE))(VECT(TYPE)*, TYPE*);
+TYPE* GET(VECT(TYPE))(VECT(TYPE)*, unsigned int idx);
+int EMPTY(VECT(TYPE))(VECT(TYPE)*);
+unsigned int SIZE(VECT(TYPE))(VECT(TYPE)*);
+
+#endif /* TYPE */