summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorRasmus Luha <rasmus.luha@gmail.com>2022-11-03 01:08:28 +0200
committerRasmus Luha <rasmus.luha@gmail.com>2022-11-03 01:08:28 +0200
commit4bdad2d5c7dec0eb19c418cadb47cc3124092310 (patch)
treec80d9cceb8e10e91daf38657cf64d8ce0bbf3104 /inc
parentfcb9ff2b96de6989e9a676e96753b1b1279acf67 (diff)
praks IV doneHEADmaster
Diffstat (limited to 'inc')
-rw-r--r--inc/mem.h9
-rw-r--r--inc/stack.h15
-rw-r--r--inc/translator.h18
3 files changed, 36 insertions, 6 deletions
diff --git a/inc/mem.h b/inc/mem.h
index 86bed3f..4ebdf61 100644
--- a/inc/mem.h
+++ b/inc/mem.h
@@ -9,12 +9,21 @@ struct mem_st {
};
int mem_pos();
+
int mem_inc();
int mem_dec();
+
int mem_left();
int mem_right();
+
int mem_get();
int mem_set(char v);
+
void mem_printDebug();
+
+//Added
+//int mem_add(int amout);
+//int mem_move(int amout);
+
#endif
diff --git a/inc/stack.h b/inc/stack.h
index fcc976a..45f8daa 100644
--- a/inc/stack.h
+++ b/inc/stack.h
@@ -5,13 +5,16 @@
struct stack_st {
int len;
- int arr[STACK_SIZE];
+ int size;
+ int* arr;
};
-void stackPush(int val);
-int stackPop(void);
-int stackIsEmpty(void);
-int stackPeek(void);
-void stackPrint(void);
+void stackPush(struct stack_st *s, int val);
+int stackPop(struct stack_st *s);
+int stackIsEmpty(struct stack_st *s);
+int stackPeek(struct stack_st *s);
+void stackPrint(struct stack_st *s);
+
+void stackFree(struct stack_st *s);
#endif
diff --git a/inc/translator.h b/inc/translator.h
new file mode 100644
index 0000000..0007526
--- /dev/null
+++ b/inc/translator.h
@@ -0,0 +1,18 @@
+#ifndef _TRANSLATOR_H__
+#define _TRANSLATOR_H__
+
+/* Selle struktuuriga esitame kõiki Brainfuck instruktsioone koos
+ lisainfoga, mis võimaldavad optimeeringuid.
+*/
+struct BF_instruction_st {
+
+ /* Instruktsiooni väljakutse funktsioon. Esimene parameeter on viit instruktsiooni
+ objektile teine on viit instruktsiooni indeksile, mida antud funktsioon
+ peab kas suurendama või muutma (näiteks tsüklites).
+ */
+
+ void (*run)(struct BF_instruction_st *instruction, int *index);
+};
+
+
+#endif