summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonsykkel <jonrevold@gmail.com>2021-09-27 07:09:22 +0200
committerjonsykkel <jonrevold@gmail.com>2021-09-27 07:14:18 +0200
commit2dbf74c2032353e6e9603a28fc509d973c98ae5c (patch)
tree48bacc7124626defb664a14df9f207b2838de2ea
parentc295e58a90828b45bfc0bae3e26c8026400b91c6 (diff)
downloadokeffa-2dbf74c2032353e6e9603a28fc509d973c98ae5c.tar.gz
no limit stak sizeHEADmaster
-rw-r--r--calc/main.c11
-rw-r--r--makefile2
2 files changed, 5 insertions, 8 deletions
diff --git a/calc/main.c b/calc/main.c
index 07c9b88..aaf57d6 100644
--- a/calc/main.c
+++ b/calc/main.c
@@ -17,14 +17,13 @@
#define STACK(I) (stack+fl*(I))
#define STACK_INIT ((size_t)-1)
-#define STACK_SIZE 65536
//calc configuration
static size_t fl; //wordness, fz len
static size_t sh; //stack height
//calc state
-static word_t stack[STACK_SIZE];
+static word_t *stack;
static size_t sp; //stack ptr
static wbool_t flag; //carry/borrow
static size_t pos;
@@ -380,11 +379,9 @@ int main(int argc,char **argv){
eggog("invalid bitness: "FZ_VALIDITY_RULE_DOC);
}
- if(bitness/IRON_BYTEBITS*sh > STACK_SIZE){
- eggog("max stack size: %zu",STACK_SIZE);
- }
-
- fl = bitness/WORD_BITNESS;
+ fl = bitness/WORD_BITNESS;
+ word_t _stack[fl*sh];
+ stack = _stack;
init();
for(char c;c = read_char();){
diff --git a/makefile b/makefile
index 0e187f5..477b617 100644
--- a/makefile
+++ b/makefile
@@ -67,7 +67,7 @@ ifneq ($(run),)
run_cmd := @echo "run $(out)" 1>&2
#run_cmd += && ./$(out) 256 16
#run_cmd += && time $(out) 2048 16 < prog/ch7
- run_cmd += && ./$(out) 256 16 < prog/ch8 | python
+ run_cmd += && ./$(out) 1048576 32 < prog/ch8 | python
endif
ifneq ($(debug),)