From f6eea481cd378423968af5dfe4f57464eea90e1c Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 27 Apr 2024 02:40:38 +0000 Subject: [PATCH] rename git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@72 0f02c867-ac3d-714e-8a88-971ba1f6efcf --- Serenade/binmodule.c | 3 +++ Serenade/binmodule.h | 2 +- Serenade/interpreter.c | 6 +++++- Serenade/interpreter.h | 2 +- Serenade/main.c | 4 ++-- Tool/configgen.c | 3 +++ 6 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Serenade/binmodule.c b/Serenade/binmodule.c index bfdea90..49423d9 100644 --- a/Serenade/binmodule.c +++ b/Serenade/binmodule.c @@ -29,3 +29,6 @@ /* --- END LICENSE --- */ #include "binmodule.h" + +void binmodule_init(struct sn_interpreter* sn){ +} diff --git a/Serenade/binmodule.h b/Serenade/binmodule.h index 31bbdbf..41c0b4a 100644 --- a/Serenade/binmodule.h +++ b/Serenade/binmodule.h @@ -33,6 +33,6 @@ #include "interpreter.h" -void ffi_init(struct sn_interpreter* sn); +void binmodule_init(struct sn_interpreter* sn); #endif diff --git a/Serenade/interpreter.c b/Serenade/interpreter.c index 993d808..1b22c00 100644 --- a/Serenade/interpreter.c +++ b/Serenade/interpreter.c @@ -31,6 +31,7 @@ #include "interpreter.h" #include "../config.h" + #include "run.h" #include "util.h" @@ -156,10 +157,13 @@ void sn_stdlib_init(struct sn_interpreter* sn) { sn_set_handler(sn, "source", source_handler); } -void sn_ffi_init(struct sn_interpreter* sn) { +void sn_module_init(struct sn_interpreter* sn) { #ifdef HAS_FFI_SUPPORT ffi_init(sn); #endif +#ifdef HAS_BINMODULE_SUPPORT + binmodule_init(sn); +#endif } struct sn_interpreter* sn_create_interpreter(void) { diff --git a/Serenade/interpreter.h b/Serenade/interpreter.h index fc7c73c..8e4b552 100644 --- a/Serenade/interpreter.h +++ b/Serenade/interpreter.h @@ -52,6 +52,6 @@ struct sn_interpreter_kv* sn_set_variable(struct sn_interpreter* sn, const char* struct sn_interpreter_kv* sn_set_handler(struct sn_interpreter* sn, const char* name, struct sn_generic* (*handler)(struct sn_interpreter* sn, int, struct sn_generic**)); int sn_eval(struct sn_interpreter* sn, char* data, unsigned long long len); void sn_stdlib_init(struct sn_interpreter* sn); -void sn_ffi_init(struct sn_interpreter* sn); +void sn_module_init(struct sn_interpreter* sn); #endif diff --git a/Serenade/main.c b/Serenade/main.c index e6227af..657dcd1 100644 --- a/Serenade/main.c +++ b/Serenade/main.c @@ -86,7 +86,7 @@ int main(int argc, char** argv) { fread(str, 1, s.st_size, f); struct sn_interpreter* sn = sn_create_interpreter(); sn_stdlib_init(sn); - sn_ffi_init(sn); + sn_module_init(sn); int r = sn_eval(sn, str, s.st_size); sn_interpreter_free(sn); free(str); @@ -116,7 +116,7 @@ int main(int argc, char** argv) { printf("Parser stack size: %d\n", PARSER_STACK_SIZE); struct sn_interpreter* sn = sn_create_interpreter(); sn_stdlib_init(sn); - sn_ffi_init(sn); + sn_module_init(sn); char cbuf[2]; cbuf[0] = '\n'; cbuf[1] = 0; diff --git a/Tool/configgen.c b/Tool/configgen.c index b7971e2..e12ff97 100644 --- a/Tool/configgen.c +++ b/Tool/configgen.c @@ -47,6 +47,9 @@ void macro_print(FILE* out) { fprintf(out, "#ifdef HAS_FFI_SUPPORT\n"); fprintf(out, "#include \"Serenade/ffi_binding.h\"\n"); fprintf(out, "#endif\n"); + fprintf(out, "#ifdef HAS_BINMODULE_SUPPORT\n"); + fprintf(out, "#include \"Serenade/binmodule.h\"\n"); + fprintf(out, "#endif\n"); fprintf(out, "#endif\n"); } -- 2.43.0