From e7748c3eb607ace655bc48d807cbbc116960a611 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 3 Nov 2021 23:38:02 +0100 Subject: accidentally deleted header files --- state.c | 5 ----- state.h | 23 +++++++++++++++++++++++ util.h | 7 +++++++ 3 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 state.h create mode 100644 util.h 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 + +#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 -- cgit 1.4.1-2-gfad0