diff options
author | dan <[email protected]> | 2023-06-03 14:41:14 -0400 |
---|---|---|
committer | dan <[email protected]> | 2023-06-03 14:41:14 -0400 |
commit | 48c02f4fccd13cf329594988a19a4edd1fce4774 (patch) | |
tree | a92d6af027aa5b9d3368801b770179cc83a928f3 /forthmachine.c | |
parent | f130b76fabb440b02c418a537074ec80489a9480 (diff) | |
download | forth-48c02f4fccd13cf329594988a19a4edd1fce4774.tar.gz forth-48c02f4fccd13cf329594988a19a4edd1fce4774.tar.bz2 forth-48c02f4fccd13cf329594988a19a4edd1fce4774.zip |
feat: forthmachine and stack errors handled with error handlers, not just by printing
Diffstat (limited to 'forthmachine.c')
-rw-r--r-- | forthmachine.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/forthmachine.c b/forthmachine.c index ba67013..a421630 100644 --- a/forthmachine.c +++ b/forthmachine.c @@ -2,14 +2,16 @@ #include <stdio.h> #include <string.h> #include "drhstrings.h" +#include "errorhandler.h" #include "stack.h" /****/ -forthmachine* forthmachine_new() { +forthmachine* forthmachine_new(errorhandler errorhandler) { forthmachine* fm = (forthmachine*)malloc(sizeof(forthmachine)); fm->ot = optable_new(); - fm->s = stack_new(); + fm->s = stack_new(errorhandler); fm->outputbuffer = (char*)malloc(sizeof(char) * MAX_OUTPUT_BUFFER_SIZE); + fm->errorhandler = errorhandler; strcpy(fm->outputbuffer, ""); return fm; } |