added a char stack implementation for later use
[smdp.git] / include / cstack.h
diff --git a/include/cstack.h b/include/cstack.h
new file mode 100644 (file)
index 0000000..edb9847
--- /dev/null
@@ -0,0 +1,22 @@
+#if !defined( CSTACK_H )
+#define CSTACK_H
+
+typedef struct _cstack_t {
+    char *content;
+    size_t alloc;
+    size_t size;
+    int head;
+    void (*push)(struct _cstack_t *self, char c);
+    char (*pop)(struct _cstack_t *self);
+    char (*top)(struct _cstack_t *self);
+    int (*empty)(struct _cstack_t *self);
+    void (*delete)(struct _cstack_t *self);
+} cstack_t;
+
+void cstack_push(cstack_t *self, char c);
+char cstack_pop(cstack_t *self);
+char cstack_top(cstack_t *self);
+int cstack_empty(cstack_t *self);
+void cstack_delete(cstack_t *self);
+
+#endif // !defined( CSTACK_H )
\ No newline at end of file