about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDaniel <steew0x8@protonmail.com>2021-11-03 23:38:02 +0100
committerDaniel <steew0x8@protonmail.com>2021-11-03 23:38:02 +0100
commite7748c3eb607ace655bc48d807cbbc116960a611 (patch)
treed2009a40f204993c13372a26e5b69c9839e02d52
parentd465d6e672eba42da6e2dd729e02e6b78b0bf22a (diff)
downloadrpncalc-e7748c3eb607ace655bc48d807cbbc116960a611.tar.gz
accidentally deleted header files
-rw-r--r--state.c5
-rw-r--r--state.h23
-rw-r--r--util.h7
3 files changed, 30 insertions, 5 deletions
diff --git a/state.c b/state.c
index 2c504e8..8b13789 100644
--- a/state.c
+++ b/state.c
@@ -1,6 +1 @@
-#include "state.h"
 
-void push(state *s, double d) {
-  s->stack.val[s->stack.count+1] = d;
-  s->stack.count += 1;
-}
diff --git a/state.h b/state.h
new file mode 100644
index 0000000..8a9b2d5
--- /dev/null
+++ b/state.h
@@ -0,0 +1,23 @@
+#ifndef STATE_H
+#define STATE_H
+
+#include <stdio.h>
+
+#define STACK_SIZE 100
+
+typedef struct {
+  double val[STACK_SIZE];
+  int count;
+} stack;
+
+typedef struct {
+  int command_count;
+  FILE *defbuf;
+  FILE *defout;
+  char last_op;
+  char *prompt;
+  stack stack;
+  
+} state;
+
+#endif
diff --git a/util.h b/util.h
new file mode 100644
index 0000000..18fb507
--- /dev/null
+++ b/util.h
@@ -0,0 +1,7 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+typedef enum {OPERATOR, DOUBLE, FUNCTION} TYPE;
+int discriminate(char *s);
+
+#endif