]> Nishi Git Mirror - serenade.git/commitdiff
fix
authornishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Fri, 26 Apr 2024 03:24:57 +0000 (03:24 +0000)
committernishi <nishi@0f02c867-ac3d-714e-8a88-971ba1f6efcf>
Fri, 26 Apr 2024 03:24:57 +0000 (03:24 +0000)
git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@40 0f02c867-ac3d-714e-8a88-971ba1f6efcf

Makefile
Serenade/interpreter.c
Serenade/interpreter.h
cmdline
platforms/win32.mk
platforms/win64.mk

index a41d0f8734e97386a6e179c1a88e74f0329e51b5..8a6d0a113b34c96a45020b2cdafac85c6f336b6e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
 
 CPP = cpp
 CC = cc
+CPP = cpp
 CFLAGS = -std=c99 -g
 LDFLAGS =
 LIBS = `$(CPP) -DLIBS cmdline | grep -vE "^\#" | tr '\\n' ' '`
index 3f0892739bed1033f4fe54be16e0407976ac2af1..29a8a72e9960ed4539febacc788312c5158f2830 100644 (file)
@@ -125,6 +125,8 @@ 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->generics = malloc(sizeof(struct sn_generic**));
+       sn->generics[0] = NULL;
 
        sn_set_handler(sn, "+", math_handler);
        sn_set_handler(sn, "-", math_handler);
@@ -148,6 +150,12 @@ void sn_interpreter_free(struct sn_interpreter* sn) {
                free(sn->variables[i]);
        }
        free(sn->variables);
+       for(i = 0; sn->generics[i] != NULL; i++){
+               int j;
+               for(j = 0; sn->generics[i][j] != NULL; j++) sn_generic_free(sn->generics[i][j]); 
+               free(sn->generics[i]);
+       }
+       free(sn->generics);
        free(sn);
 }
 
@@ -216,8 +224,16 @@ int sn_eval(struct sn_interpreter* sn, char* data, unsigned long long len) {
                                }
                        }
                }
-               for(i = 0; gens[i] != NULL; i++) sn_generic_free(gens[i]);
-               free(gens);
+               int j;
+               struct sn_generic*** oldgens = sn->generics;
+               for(j = 0; oldgens[j] != NULL; j++);
+               sn->generics = malloc(sizeof(struct sn_generic**) * (j + 2));
+               for(j = 0; oldgens[j] != NULL; j++){
+                       sn->generics[j] = oldgens[j];
+               }
+               sn->generics[j] = gens;
+               sn->generics[j + 1] = NULL;
+               free(oldgens);
        }
        return r;
 }
index fb3dbcfbf3f9559dcf19f23a8f4e3ecefdf05818..686be99d76e6b5b1816fa4a90cdef9f6d75dc69e 100644 (file)
@@ -35,6 +35,7 @@
 
 struct sn_interpreter {
        struct sn_interpreter_kv** variables;
+       struct sn_generic*** generics;
 };
 
 struct sn_interpreter_kv {
diff --git a/cmdline b/cmdline
index 860c096b5c66f9ab5ec08670ee07455a1de5b160..b219df6c5b5a134e3c8229371eb74dba4ec0c862 100644 (file)
--- a/cmdline
+++ b/cmdline
@@ -6,9 +6,11 @@
 -lffi
 #endif
 #ifdef __linux__
+#ifndef __MINGW32__
 -ldl
 #endif
 #endif
+#endif
 
 #ifdef OBJS
 #ifdef HAS_FFI_SUPPORT
index 40135dec401b5ee544301832939c7a7161538ad4..5007c303b93861c94da17df67069d488addd1545 100644 (file)
@@ -3,4 +3,5 @@
 
 CPP = i686-w64-mingw32-cpp
 CC = i686-w64-mingw32-gcc
+CPP = i686-w64-mingw32-cpp
 SUFFIX = .exe
index 30fea524decd3e30d92ed92eba2d2229c5cdf987..5a788eeb6c392843cee060073180e677bc3adb62 100644 (file)
@@ -3,4 +3,5 @@
 
 CPP = x86_64-w64-mingw32-cpp
 CC = x86_64-w64-mingw32-gcc
+CPP = x86_64-w64-mingw32-cpp
 SUFFIX = .exe