]> Nishi Git Mirror - serenade.git/commitdiff
should be fixed
authornishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Sat, 27 Apr 2024 05:51:16 +0000 (05:51 +0000)
committernishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Sat, 27 Apr 2024 05:51:16 +0000 (05:51 +0000)
git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@76 0f02c867-ac3d-714e-8a88-971ba1f6efcf

Makefile
Serenade/interpreter.c
Serenade/interpreter.h
Serenade/run.c

index a676a01511d56962560d491b73189fd60f969c83..3eab909a95a6c331bbe1725f7a7c1de801fcec64 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,7 @@ all: ./Tool ./config.h ./Serenade
 
 clean:
        $(MAKE) -C ./Tool clean
-       $(MAKE) -C ./Serenade clean
+       $(MAKE) -C ./Serenade clean SUFFIX_SO="$(SUFFIX_SO)" PREFIX_SO="$(PREFIX_SO)"
        rm -f config.h
 
 FILES = `find . -name "*.c" -or -name "*.h"`
index 58eb16afcafb6163586d40bd14d5ddbaabf7370a..269208ecacce7a4673a919c0aeaedb661cc0bcdd 100644 (file)
@@ -170,8 +170,10 @@ struct sn_interpreter* sn_create_interpreter(void) {
        struct sn_interpreter* sn = malloc(sizeof(struct sn_interpreter));
        sn->variables = malloc(sizeof(struct sn_interpreter_kv*));
        sn->variables[0] = NULL;
+       sn->local_variables = NULL;
        sn->generics = malloc(sizeof(struct sn_generic**));
        sn->generics[0] = NULL;
+       sn->callstack = 0;
 
        return sn;
 }
index 8e4b552b9d0c85f203933d4a613a2f0b1bef7cb9..ebc3be032c40f370d3c25dc3215d2cafb07289c3 100644 (file)
@@ -37,6 +37,7 @@ struct sn_interpreter {
        struct sn_interpreter_kv** variables;
        struct sn_interpreter_kv** local_variables;
        struct sn_generic*** generics;
+       int callstack;
 };
 
 struct sn_interpreter_kv {
index 705c93fa695a0785a51f62ec5088e84d862cb9ba..fbc6612c123c672a55a55f45a4b24f48873e0359 100644 (file)
@@ -48,10 +48,12 @@ struct sn_generic* run_code(struct sn_interpreter* sn, int argc, struct sn_gener
        int i;
        struct sn_interpreter_kv** old_kv = sn->local_variables;
        sn->local_variables = malloc(sizeof(struct sn_interpreter_kv*));
-       sn->local_variables[i] = NULL;
+       sn->local_variables[0] = NULL;
+       sn->callstack++;
        for(i = 0; gens[i] != NULL; i++) {
                _sn_run(sn, gens[i]);
        }
+       sn->callstack--;
        free(sn->local_variables);
        sn->local_variables = old_kv;
        return r;