From 71a4d8c4f44a85747e623d35409f3ba92dad0420 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 27 Apr 2024 02:36:58 +0000 Subject: [PATCH] add binmodule git-svn-id: file:///raid/svn-main/nishi-serenade/trunk@71 0f02c867-ac3d-714e-8a88-971ba1f6efcf --- Serenade/binmodule.c | 31 +++++++++++++++++++++++++++++++ Serenade/binmodule.h | 38 ++++++++++++++++++++++++++++++++++++++ Tool/configgen.c | 4 +--- cmdline | 5 +++++ 4 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 Serenade/binmodule.c create mode 100644 Serenade/binmodule.h diff --git a/Serenade/binmodule.c b/Serenade/binmodule.c new file mode 100644 index 0000000..bfdea90 --- /dev/null +++ b/Serenade/binmodule.c @@ -0,0 +1,31 @@ +/* $Id$ */ +/* --- START LICENSE --- */ +/* -------------------------------------------------------------------------- */ +/* Serenade is a Lisp Dialect */ +/* -------------------------------------------------------------------------- */ +/* Copyright (c) 2024 Nishi. */ +/* Redistribution and use in source and binary forms, with or without modific */ +/* ation, are permitted provided that the following conditions are met: */ +/* 1. Redistributions of source code must retain the above copyright noti */ +/* ce, this list of conditions and the following disclaimer. */ +/* 2. Redistributions in binary form must reproduce the above copyright n */ +/* otice, this list of conditions and the following disclaimer in the documen */ +/* tation and/or other materials provided with the distribution. */ +/* 3. Neither the name of the copyright holder nor the names of its contr */ +/* ibutors may be used to endorse or promote products derived from this softw */ +/* are without specific prior written permission. */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS */ +/* " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH */ +/* E IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO */ +/* SE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS */ +/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CON */ +/* SEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITU */ +/* TE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPT */ +/* ION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S */ +/* TRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN */ +/* Y WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY */ +/* OF SUCH DAMAGE. */ +/* -------------------------------------------------------------------------- */ +/* --- END LICENSE --- */ + +#include "binmodule.h" diff --git a/Serenade/binmodule.h b/Serenade/binmodule.h new file mode 100644 index 0000000..31bbdbf --- /dev/null +++ b/Serenade/binmodule.h @@ -0,0 +1,38 @@ +/* $Id$ */ +/* --- START LICENSE --- */ +/* -------------------------------------------------------------------------- */ +/* Serenade is a Lisp Dialect */ +/* -------------------------------------------------------------------------- */ +/* Copyright (c) 2024 Nishi. */ +/* Redistribution and use in source and binary forms, with or without modific */ +/* ation, are permitted provided that the following conditions are met: */ +/* 1. Redistributions of source code must retain the above copyright noti */ +/* ce, this list of conditions and the following disclaimer. */ +/* 2. Redistributions in binary form must reproduce the above copyright n */ +/* otice, this list of conditions and the following disclaimer in the documen */ +/* tation and/or other materials provided with the distribution. */ +/* 3. Neither the name of the copyright holder nor the names of its contr */ +/* ibutors may be used to endorse or promote products derived from this softw */ +/* are without specific prior written permission. */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS */ +/* " AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH */ +/* E IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPO */ +/* SE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS */ +/* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CON */ +/* SEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITU */ +/* TE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPT */ +/* ION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, S */ +/* TRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN */ +/* Y WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY */ +/* OF SUCH DAMAGE. */ +/* -------------------------------------------------------------------------- */ +/* --- END LICENSE --- */ + +#ifndef __SERENADE_BINMODULE_H__ +#define __SERENADE_BINMODULE_H__ + +#include "interpreter.h" + +void ffi_init(struct sn_interpreter* sn); + +#endif diff --git a/Tool/configgen.c b/Tool/configgen.c index 4b4f12c..b7971e2 100644 --- a/Tool/configgen.c +++ b/Tool/configgen.c @@ -35,9 +35,7 @@ char choice[256]; -char* asks[] = {"repl", "y", "HAS_REPL_SUPPORT", "Do you want the REPL support?", "ffi", "y", "HAS_FFI_SUPPORT", "Do you want the FFI support?", "readline", "n", "HAS_READLINE_SUPPORT", "Do you want the readline support for the REPL?", - - NULL}; +char* asks[] = {"repl", "y", "HAS_REPL_SUPPORT", "Do you want the REPL support?", "ffi", "y", "HAS_FFI_SUPPORT", "Do you want the FFI support?", "readline", "n", "HAS_READLINE_SUPPORT", "Do you want the readline support for the REPL?", "binmodule", "y", "HAS_BINMODULE_SUPPORT", "Do you want the binary module (e.g. so or dll) support?", NULL}; void show_dialog(int n) { fprintf(stderr, "[default is %c] %s ", asks[n * 4 + 1][0], asks[n * 4 + 3]); diff --git a/cmdline b/cmdline index 73b208d..246ef94 100644 --- a/cmdline +++ b/cmdline @@ -18,13 +18,18 @@ #ifdef HAS_READLINE_SUPPORT -lreadline #endif +#if defined(HAS_FFI_SUPPORT) || defined(HAS_BINMODULE_SUPPORT) #ifdef __linux__ -ldl #endif #endif +#endif #ifdef OBJS #ifdef HAS_FFI_SUPPORT ffi_binding.o #endif +#ifdef HAS_BINMODULE_SUPPORT +binmodule.o +#endif #endif -- 2.43.0