From ff760a5ca59e6e6ba55bac170d688583ed96ff08 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Sep 2022 21:55:39 +0900 Subject: [PATCH 01/46] Cleanup include graph Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/character.hpp | 2 -- include/meevax/kernel/complex.hpp | 2 -- include/meevax/kernel/instruction.hpp | 1 - include/meevax/kernel/library.hpp | 2 -- include/meevax/kernel/syntax.hpp | 3 +-- src/kernel/complex.cpp | 2 ++ src/kernel/reader.cpp | 2 ++ src/main.cpp | 5 +---- 10 files changed, 10 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 72b3eb067..35b497cae 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.232.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.233.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.232_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.233_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.232 +Meevax Lisp System, version 0.4.233 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index 2a4561f41..f5ab0cc66 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.232 +0.4.233 diff --git a/include/meevax/kernel/character.hpp b/include/meevax/kernel/character.hpp index 3965a4511..6ea002f59 100644 --- a/include/meevax/kernel/character.hpp +++ b/include/meevax/kernel/character.hpp @@ -17,8 +17,6 @@ #ifndef INCLUDED_MEEVAX_KERNEL_CHARACTER_HPP #define INCLUDED_MEEVAX_KERNEL_CHARACTER_HPP -#include - #include namespace meevax diff --git a/include/meevax/kernel/complex.hpp b/include/meevax/kernel/complex.hpp index 6c6698342..5c5f4d322 100644 --- a/include/meevax/kernel/complex.hpp +++ b/include/meevax/kernel/complex.hpp @@ -18,9 +18,7 @@ #define INCLUDED_MEEVAX_KERNEL_COMPLEX_HPP #include -#include -#include #include namespace meevax diff --git a/include/meevax/kernel/instruction.hpp b/include/meevax/kernel/instruction.hpp index fb9055811..a45b47fa4 100644 --- a/include/meevax/kernel/instruction.hpp +++ b/include/meevax/kernel/instruction.hpp @@ -18,7 +18,6 @@ #define INCLUDED_MEEVAX_KERNEL_INSTRUCTION_HPP #include -#include namespace meevax { diff --git a/include/meevax/kernel/library.hpp b/include/meevax/kernel/library.hpp index 1f7127e64..d73c391ec 100644 --- a/include/meevax/kernel/library.hpp +++ b/include/meevax/kernel/library.hpp @@ -17,9 +17,7 @@ #ifndef INCLUDED_MEEVAX_KERNEL_LIBRARY_HPP #define INCLUDED_MEEVAX_KERNEL_LIBRARY_HPP -#include #include -#include namespace meevax { diff --git a/include/meevax/kernel/syntax.hpp b/include/meevax/kernel/syntax.hpp index fd17e3b84..48d4257f2 100644 --- a/include/meevax/kernel/syntax.hpp +++ b/include/meevax/kernel/syntax.hpp @@ -19,7 +19,6 @@ #include #include -#include #include #define SYNTAX(NAME) \ @@ -42,7 +41,7 @@ inline namespace kernel function_type compile; - explicit syntax(symbol::value_type const&, function_type const&); + explicit syntax(std::string const&, function_type const&); }; auto operator <<(std::ostream &, syntax const&) -> std::ostream &; diff --git a/src/kernel/complex.cpp b/src/kernel/complex.cpp index e571547c7..27bda1ace 100644 --- a/src/kernel/complex.cpp +++ b/src/kernel/complex.cpp @@ -14,6 +14,8 @@ limitations under the License. */ +#include + #include #include diff --git a/src/kernel/reader.cpp b/src/kernel/reader.cpp index 2ebeffbf9..454d1f6b1 100644 --- a/src/kernel/reader.cpp +++ b/src/kernel/reader.cpp @@ -14,6 +14,8 @@ limitations under the License. */ +#include + #include #include diff --git a/src/main.cpp b/src/main.cpp index 89f9d6682..389807261 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,9 +14,7 @@ limitations under the License. */ -#include #include -#include auto main(int const argc, char const* const* const argv) -> int { @@ -48,8 +46,7 @@ auto main(int const argc, char const* const* const argv) -> int while (main.interactive and main.char_ready()) { - print(u8"\u250c", repeat(u8"\u2500", 79)); - write(standard_output, u8"\u2502\u03bb> "); + write(standard_output, u8"\u03bb> "); print(main.evaluate(main.read())); } From 7947a016a53a2f9001e2365476ebd33ebd1bfcdf Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Sep 2022 22:07:28 +0900 Subject: [PATCH 02/46] Update `syntax` to not to depends `description` Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/syntax.hpp | 7 ++++--- src/kernel/syntax.cpp | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 35b497cae..16d3fbcef 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.233.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.234.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.233_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.234_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.233 +Meevax Lisp System, version 0.4.234 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index f5ab0cc66..aef71667e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.233 +0.4.234 diff --git a/include/meevax/kernel/syntax.hpp b/include/meevax/kernel/syntax.hpp index 48d4257f2..4a5ca9d9c 100644 --- a/include/meevax/kernel/syntax.hpp +++ b/include/meevax/kernel/syntax.hpp @@ -19,7 +19,6 @@ #include #include -#include #define SYNTAX(NAME) \ auto NAME( \ @@ -33,13 +32,15 @@ namespace meevax { inline namespace kernel { - struct syntax : public description + struct syntax { using function_pointer_type = SYNTAX((*)); using function_type = std::function; - function_type compile; + std::string const name; + + function_type const compile; explicit syntax(std::string const&, function_type const&); }; diff --git a/src/kernel/syntax.cpp b/src/kernel/syntax.cpp index 6b9f7a763..57c47dedc 100644 --- a/src/kernel/syntax.cpp +++ b/src/kernel/syntax.cpp @@ -21,13 +21,13 @@ namespace meevax inline namespace kernel { syntax::syntax(std::string const& name, function_type const& compile) - : description { name } + : name { name } , compile { compile } {} auto operator <<(std::ostream & os, syntax const& datum) -> std::ostream & { - return os << magenta("#,(") << green("syntax") << " " << datum.name << magenta(")"); + return os << magenta("#,(") << green("syntax ") << datum.name << magenta(")"); } } // namespace kernel } // namespace meevax From a523f8ed6ff0152614577a535ab0d864c154e612 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Sep 2022 22:21:10 +0900 Subject: [PATCH 03/46] Update `procedure` to not depend on `description` Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/intrinsic.hpp | 2 +- include/meevax/kernel/procedure.hpp | 16 ++++++++-------- src/kernel/procedure.cpp | 14 +++++++------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 16d3fbcef..be979be2f 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.234.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.235.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.234_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.235_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.234 +Meevax Lisp System, version 0.4.235 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index aef71667e..8d7c6911c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.234 +0.4.235 diff --git a/include/meevax/kernel/intrinsic.hpp b/include/meevax/kernel/intrinsic.hpp index 47393e254..20800553a 100644 --- a/include/meevax/kernel/intrinsic.hpp +++ b/include/meevax/kernel/intrinsic.hpp @@ -28,7 +28,7 @@ inline namespace kernel , public procedure { template - explicit intrinsic(symbol::value_type const& name, F&& f, G&& g) + explicit intrinsic(std::string const& name, F&& f, G&& g) : syntax { name, std::forward(f) } , procedure { name, std::forward(g) } {} diff --git a/include/meevax/kernel/procedure.hpp b/include/meevax/kernel/procedure.hpp index be855be57..56a9dac88 100644 --- a/include/meevax/kernel/procedure.hpp +++ b/include/meevax/kernel/procedure.hpp @@ -18,8 +18,6 @@ #define INCLUDED_MEEVAX_KERNEL_PROCEDURE_HPP #include -#include -#include namespace meevax { @@ -27,21 +25,23 @@ inline namespace kernel { #define PROCEDURE(...) meevax::value_type __VA_ARGS__(meevax::const_reference xs) - struct procedure : public description + struct procedure { using function_pointer_type = PROCEDURE((*)); using function_type = std::function; + std::string const name; + function_type call; - explicit procedure(symbol::value_type const&, function_type const&); + explicit procedure(std::string const&, function_type const&); - explicit procedure(symbol::value_type const&, symbol::value_type const&); + explicit procedure(std::string const&, std::string const&); - static auto dlopen(symbol::value_type const&) -> void *; + static auto dlopen(std::string const&) -> void *; - static auto dlsym(symbol::value_type const&, void * const) -> function_pointer_type; + static auto dlsym(std::string const&, void * const) -> function_pointer_type; }; auto operator <<(std::ostream &, procedure const&) -> std::ostream &; @@ -49,7 +49,7 @@ inline namespace kernel struct predicate : public procedure { template - explicit predicate(symbol::value_type const& name, Callable && call) + explicit predicate(std::string const& name, Callable && call) : procedure { name, [call](auto&&... xs) { return call(std::forward(xs)...) ? t : f; } } {} }; diff --git a/src/kernel/procedure.cpp b/src/kernel/procedure.cpp index 1ff099e2d..f81140506 100644 --- a/src/kernel/procedure.cpp +++ b/src/kernel/procedure.cpp @@ -27,17 +27,17 @@ namespace meevax { inline namespace kernel { - procedure::procedure(symbol::value_type const& name, function_type const& call) - : description { name } + procedure::procedure(std::string const& name, function_type const& call) + : name { name } , call { call } {} - procedure::procedure(symbol::value_type const& name, symbol::value_type const& libfoo_so) - : description { name } + procedure::procedure(std::string const& name, std::string const& libfoo_so) + : name { name } , call { dlsym(name, dlopen(libfoo_so)) } {} - auto procedure::dlopen(symbol::value_type const& libfoo_so) -> void * + auto procedure::dlopen(std::string const& libfoo_so) -> void * { auto dlclose = [](void * const handle) { @@ -48,7 +48,7 @@ inline namespace kernel }; static std::unordered_map< - symbol::value_type, std::unique_ptr + std::string, std::unique_ptr > dynamic_libraries {}; ::dlerror(); // clear @@ -75,7 +75,7 @@ inline namespace kernel } } - auto procedure::dlsym(symbol::value_type const& name, void * const handle) -> function_pointer_type + auto procedure::dlsym(std::string const& name, void * const handle) -> function_pointer_type { if (auto address = ::dlsym(handle, name.c_str()); address) { From f97e54f60b8f8d51ad7bb9f0a95361143002239c Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Sep 2022 22:36:28 +0900 Subject: [PATCH 04/46] Update file-ports to use `string` to store its pathname Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/port.hpp | 10 ++++++---- src/kernel/port.cpp | 13 +++++++++---- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index be979be2f..f5e137289 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.235.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.236.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.235_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.236_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.235 +Meevax Lisp System, version 0.4.236 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index 8d7c6911c..ecbacf056 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.235 +0.4.236 diff --git a/include/meevax/kernel/port.hpp b/include/meevax/kernel/port.hpp index f9b9a8b50..61dfe0927 100644 --- a/include/meevax/kernel/port.hpp +++ b/include/meevax/kernel/port.hpp @@ -19,8 +19,7 @@ #include -#include -#include +#include namespace meevax { @@ -43,9 +42,12 @@ inline namespace kernel #undef DEFINE #define DEFINE(TYPENAME, FILE_STREAM) \ - struct TYPENAME : public description \ - , public FILE_STREAM \ + struct TYPENAME : public FILE_STREAM \ { \ + string const pathname; \ + \ + explicit TYPENAME(string const&); \ + \ explicit TYPENAME(std::string const&); \ }; \ \ diff --git a/src/kernel/port.cpp b/src/kernel/port.cpp index 47abe9acc..24e0d0ac8 100644 --- a/src/kernel/port.cpp +++ b/src/kernel/port.cpp @@ -45,14 +45,19 @@ inline namespace kernel #undef DEFINE #define DEFINE(TYPENAME, FILE_STREAM, NAME) \ - TYPENAME::TYPENAME(std::string const& name) \ - : description { name } \ - , FILE_STREAM { name } \ + TYPENAME::TYPENAME(string const& pathname) \ + : FILE_STREAM { pathname } \ + , pathname { pathname } \ + {} \ + \ + TYPENAME::TYPENAME(std::string const& pathname) \ + : FILE_STREAM { pathname } \ + , pathname { pathname } \ {} \ \ auto operator <<(std::ostream & os, TYPENAME const& datum) -> std::ostream & \ { \ - return os << magenta("#,(") << green("open-" NAME) << " " << datum.name << magenta(")"); \ + return os << magenta("#,(") << green("open-" NAME " ") << datum.pathname << magenta(")"); \ } \ static_assert(true) From a1d67735698928629e475b86835dcfd443575003 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Sep 2022 22:51:17 +0900 Subject: [PATCH 05/46] Remove header `utility/description.hpp` Signed-off-by: yamacir-kit --- README.md | 6 ++--- VERSION | 2 +- include/meevax/kernel/list.hpp | 1 - include/meevax/kernel/number.hpp | 4 --- include/meevax/utility/description.hpp | 34 -------------------------- src/kernel/vector.cpp | 1 + 6 files changed, 5 insertions(+), 43 deletions(-) delete mode 100644 include/meevax/utility/description.hpp diff --git a/README.md b/README.md index f5e137289..fbcee3557 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.236.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.237.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.236_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.237_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.236 +Meevax Lisp System, version 0.4.237 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index ecbacf056..b0c04395c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.236 +0.4.237 diff --git a/include/meevax/kernel/list.hpp b/include/meevax/kernel/list.hpp index 57172c2e8..788172702 100644 --- a/include/meevax/kernel/list.hpp +++ b/include/meevax/kernel/list.hpp @@ -21,7 +21,6 @@ #include #include -#include #include namespace meevax diff --git a/include/meevax/kernel/number.hpp b/include/meevax/kernel/number.hpp index bac05f62b..3313b5b67 100644 --- a/include/meevax/kernel/number.hpp +++ b/include/meevax/kernel/number.hpp @@ -17,12 +17,8 @@ #ifndef INCLUDED_MEEVAX_KERNEL_NUMERICAL_HPP #define INCLUDED_MEEVAX_KERNEL_NUMERICAL_HPP -#include -#include #include -#include #include -#include #include #include #include diff --git a/include/meevax/utility/description.hpp b/include/meevax/utility/description.hpp deleted file mode 100644 index 205c848ee..000000000 --- a/include/meevax/utility/description.hpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright 2018-2022 Tatsuya Yamasaki. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -#ifndef INCLUDED_MEEVAX_UTILITY_DESCRIPTION_HPP -#define INCLUDED_MEEVAX_UTILITY_DESCRIPTION_HPP - -#include - -namespace meevax -{ -inline namespace kernel -{ - struct description - { - std::string const name; - }; -} // namespace kernel -} // namespace meevax - - -#endif // INCLUDED_MEEVAX_UTILITY_DESCRIPTION_HPP diff --git a/src/kernel/vector.cpp b/src/kernel/vector.cpp index 5e31ee107..89a9ab8db 100644 --- a/src/kernel/vector.cpp +++ b/src/kernel/vector.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include From 80dbc5c0de0b470ecf19cd5409b6ca2af5119aa0 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Thu, 15 Sep 2022 23:40:23 +0900 Subject: [PATCH 06/46] Rename header `equivalence.hpp` to `comparator.hpp` Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- basis/r4rs-essential.ss | 4 +++- basis/srfi-211.ss | 4 +++- .../kernel/{equivalence.hpp => comparator.hpp} | 8 ++++---- include/meevax/kernel/identity.hpp | 1 - include/meevax/kernel/list.hpp | 3 ++- src/kernel/boolean.cpp | 2 +- src/kernel/{equivalence.cpp => comparator.cpp} | 0 src/kernel/library.cpp | 17 ++++++++++++----- 10 files changed, 29 insertions(+), 18 deletions(-) rename include/meevax/kernel/{equivalence.hpp => comparator.hpp} (83%) rename src/kernel/{equivalence.cpp => comparator.cpp} (100%) diff --git a/README.md b/README.md index fbcee3557..15f4d5230 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.237.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.238.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.237_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.238_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.237 +Meevax Lisp System, version 0.4.238 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index b0c04395c..7c98dbcde 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.237 +0.4.238 diff --git a/basis/r4rs-essential.ss b/basis/r4rs-essential.ss index 815241138..35a6820ad 100644 --- a/basis/r4rs-essential.ss +++ b/basis/r4rs-essential.ss @@ -2,7 +2,9 @@ (import (meevax character) (meevax control) (meevax environment) - (meevax equivalence) + (rename (meevax comparator) + (identity=? eq?) + (normally=? eqv?)) (meevax foreign-function) (meevax list) (meevax number) diff --git a/basis/srfi-211.ss b/basis/srfi-211.ss index 0e00fe979..15e81708b 100644 --- a/basis/srfi-211.ss +++ b/basis/srfi-211.ss @@ -13,7 +13,9 @@ (export sc-macro-transformer rsc-macro-transformer make-syntactic-closure identifier?)) (define-library (srfi 211 explicit-renaming) - (import (meevax equivalence) + (import (rename (meevax comparator) + (identity=? eq?) + (normally=? eqv?)) (meevax list) (meevax macro) (meevax pair) diff --git a/include/meevax/kernel/equivalence.hpp b/include/meevax/kernel/comparator.hpp similarity index 83% rename from include/meevax/kernel/equivalence.hpp rename to include/meevax/kernel/comparator.hpp index 3af9ea328..00a38ce12 100644 --- a/include/meevax/kernel/equivalence.hpp +++ b/include/meevax/kernel/comparator.hpp @@ -14,10 +14,10 @@ limitations under the License. */ -#ifndef INCLUDED_MEEVAX_KERNEL_EQUIVALENCE_HPP -#define INCLUDED_MEEVAX_KERNEL_EQUIVALENCE_HPP +#ifndef INCLUDED_MEEVAX_KERNEL_COMPARATOR_HPP +#define INCLUDED_MEEVAX_KERNEL_COMPARATOR_HPP -#include +#include namespace meevax { @@ -37,4 +37,4 @@ inline namespace kernel } // namespace kernel } // namespace meevax -#endif // INCLUDED_MEEVAX_KERNEL_EQUIVALENCE_HPP +#endif // INCLUDED_MEEVAX_KERNEL_COMPARATOR_HPP diff --git a/include/meevax/kernel/identity.hpp b/include/meevax/kernel/identity.hpp index de71a0570..6e742214b 100644 --- a/include/meevax/kernel/identity.hpp +++ b/include/meevax/kernel/identity.hpp @@ -17,7 +17,6 @@ #ifndef INCLUDED_MEEVAX_KERNEL_IDENTITY_HPP #define INCLUDED_MEEVAX_KERNEL_IDENTITY_HPP -#include #include namespace meevax diff --git a/include/meevax/kernel/list.hpp b/include/meevax/kernel/list.hpp index 788172702..bb1b9299f 100644 --- a/include/meevax/kernel/list.hpp +++ b/include/meevax/kernel/list.hpp @@ -20,7 +20,8 @@ #include #include -#include +#include +#include #include namespace meevax diff --git a/src/kernel/boolean.cpp b/src/kernel/boolean.cpp index ca7a53f33..73f28c8ee 100644 --- a/src/kernel/boolean.cpp +++ b/src/kernel/boolean.cpp @@ -15,7 +15,7 @@ */ #include -#include +#include namespace meevax { diff --git a/src/kernel/equivalence.cpp b/src/kernel/comparator.cpp similarity index 100% rename from src/kernel/equivalence.cpp rename to src/kernel/comparator.cpp diff --git a/src/kernel/library.cpp b/src/kernel/library.cpp index f0c5f99b0..ac1963f81 100644 --- a/src/kernel/library.cpp +++ b/src/kernel/library.cpp @@ -148,13 +148,20 @@ inline namespace kernel library.export_("%load"); }); - define_library("(meevax equivalence)", [](library & library) + define_library("(meevax comparator)", [](library & library) { - library.define("eq?", [](let const& xs) { return eq (car(xs), cadr(xs)); }); - library.define("eqv?", [](let const& xs) { return eqv(car(xs), cadr(xs)); }); + library.define("identity=?", [](let const& xs) + { + return eq(car(xs), cadr(xs)); + }); + + library.define("normally=?", [](let const& xs) + { + return eqv(car(xs), cadr(xs)); + }); - library.export_("eq?"); - library.export_("eqv?"); + library.export_("identity=?"); + library.export_("normally=?"); }); define_library("(meevax evaluate)", [](library & library) From 06bbe46e510f0c7289c9eb0da6b11f8b573e3308 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 16 Sep 2022 00:17:49 +0900 Subject: [PATCH 07/46] Update `configurator` to not to use `procedure` internally Signed-off-by: yamacir-kit --- README.md | 6 +-- VERSION | 2 +- include/meevax/kernel/configurator.hpp | 54 +++++++++++++------------- include/meevax/kernel/environment.hpp | 1 - 4 files changed, 30 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 15f4d5230..c614cc537 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.238.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.239.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.238_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.239_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.238 +Meevax Lisp System, version 0.4.239 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index 7c98dbcde..4ec4b9a45 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.238 +0.4.239 diff --git a/include/meevax/kernel/configurator.hpp b/include/meevax/kernel/configurator.hpp index 55aa7120f..5b39082d0 100644 --- a/include/meevax/kernel/configurator.hpp +++ b/include/meevax/kernel/configurator.hpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include @@ -44,7 +43,7 @@ inline namespace kernel IMPORT(environment, read, NIL); template - using dispatcher = std::unordered_map; + using dispatcher = std::unordered_map>; public: static inline auto batch = false; @@ -80,15 +79,15 @@ inline namespace kernel { std::make_pair('b', [](auto&&...) { - return make(batch = true); + batch = true; }), std::make_pair('d', [](auto&&...) { - return make(debug = true); + debug = true; }), - std::make_pair('h', [](auto&&...) -> value_type + std::make_pair('h', [](auto&&...) { configurator::display_help(); throw exit_status::success; @@ -96,10 +95,15 @@ inline namespace kernel std::make_pair('i', [](auto&&...) { - return make(interactive = true); + interactive = true; }), - std::make_pair('v', [](auto&&...) -> value_type + std::make_pair('t', [](auto&&...) + { + trace = true; + }), + + std::make_pair('v', [](auto&&...) { configurator::display_version(); throw exit_status::success; @@ -108,21 +112,19 @@ inline namespace kernel static inline const dispatcher short_options_with_arguments { - std::make_pair('e', [](const_reference x, auto&&...) + std::make_pair('e', [](const_reference x) { print(interaction_environment().as().evaluate(x)); - return unspecified; }), - std::make_pair('l', [](const_reference x, auto&&...) + std::make_pair('l', [](const_reference x) { - return interaction_environment().as().load(x.as_const()); + interaction_environment().as().load(x.as_const()); }), - std::make_pair('w', [](const_reference x, auto&&...) + std::make_pair('w', [](const_reference x) { print(x); - return unspecified; }), }; @@ -130,15 +132,15 @@ inline namespace kernel { std::make_pair("batch", [](auto&&...) { - return make(batch = true); + batch = true; }), std::make_pair("debug", [](auto&&...) { - return make(debug = true); + debug = true; }), - std::make_pair("help", [](auto&&...) -> value_type + std::make_pair("help", [](auto&&...) { display_help(); throw exit_status::success; @@ -146,15 +148,15 @@ inline namespace kernel std::make_pair("interactive", [](auto&&...) { - return make(interactive = true); + interactive = true; }), std::make_pair("trace", [](auto&&...) { - return make(trace = true); + trace = true; }), - std::make_pair("version", [](auto&&...) -> value_type + std::make_pair("version", [](auto&&...) { display_version(); throw exit_status::success; @@ -163,21 +165,19 @@ inline namespace kernel static inline const dispatcher long_options_with_arguments { - std::make_pair("evaluate", [](const_reference x, auto&&...) + std::make_pair("evaluate", [](const_reference x) { print(interaction_environment().as().evaluate(x)); - return unspecified; }), - std::make_pair("load", [](const_reference x, auto&&...) + std::make_pair("load", [](const_reference x) { - return interaction_environment().as().load(x.as_const()); + interaction_environment().as().load(x.as_const()); }), - std::make_pair("write", [](const_reference x, auto&&...) + std::make_pair("write", [](const_reference x) { print(x); - return unspecified; }), }; @@ -263,10 +263,8 @@ inline namespace kernel else { interactive = false; - return load(*current_option); + load(*current_option); } - - return unspecified; }(); } }; diff --git a/include/meevax/kernel/environment.hpp b/include/meevax/kernel/environment.hpp index 3bd1e1c97..1ddab7f1a 100644 --- a/include/meevax/kernel/environment.hpp +++ b/include/meevax/kernel/environment.hpp @@ -21,7 +21,6 @@ #include #include #include -#include namespace meevax { From 634e7dabb62a4f2834f5b1715d2b671f14800365 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 16 Sep 2022 01:24:34 +0900 Subject: [PATCH 08/46] Rename template function `field` to `get` Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/configurator.hpp | 16 ++++++++-------- include/meevax/kernel/list.hpp | 6 +++--- src/kernel/library.cpp | 6 +++++- 5 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index c614cc537..299957006 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.239.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.240.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.239_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.240_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.239 +Meevax Lisp System, version 0.4.240 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index 4ec4b9a45..533bacc45 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.239 +0.4.240 diff --git a/include/meevax/kernel/configurator.hpp b/include/meevax/kernel/configurator.hpp index 5b39082d0..e45d20cfb 100644 --- a/include/meevax/kernel/configurator.hpp +++ b/include/meevax/kernel/configurator.hpp @@ -112,17 +112,17 @@ inline namespace kernel static inline const dispatcher short_options_with_arguments { - std::make_pair('e', [](const_reference x) + std::make_pair('e', [](auto&& x) { print(interaction_environment().as().evaluate(x)); }), - std::make_pair('l', [](const_reference x) + std::make_pair('l', [](auto&& x) { - interaction_environment().as().load(x.as_const()); + interaction_environment().as().load(x.template as_const()); }), - std::make_pair('w', [](const_reference x) + std::make_pair('w', [](auto&& x) { print(x); }), @@ -165,17 +165,17 @@ inline namespace kernel static inline const dispatcher long_options_with_arguments { - std::make_pair("evaluate", [](const_reference x) + std::make_pair("evaluate", [](auto&& x) { print(interaction_environment().as().evaluate(x)); }), - std::make_pair("load", [](const_reference x) + std::make_pair("load", [](auto&& x) { - interaction_environment().as().load(x.as_const()); + interaction_environment().as().load(x.template as_const()); }), - std::make_pair("write", [](const_reference x) + std::make_pair("write", [](auto&& x) { print(x); }), diff --git a/include/meevax/kernel/list.hpp b/include/meevax/kernel/list.hpp index bb1b9299f..62facee51 100644 --- a/include/meevax/kernel/list.hpp +++ b/include/meevax/kernel/list.hpp @@ -29,7 +29,7 @@ namespace meevax inline namespace kernel { template - auto field(T&& x) -> decltype(auto) + auto get(T&& x) -> decltype(auto) { if constexpr (std::is_same_v, iterator>) { @@ -47,12 +47,12 @@ inline namespace kernel inline auto car = [](auto&& x) -> decltype(auto) { - return field<0>(std::forward(x)); + return get<0>(std::forward(x)); }; inline auto cdr = [](auto&& x) -> decltype(auto) { - return field<1>(std::forward(x)); + return get<1>(std::forward(x)); }; template , diff --git a/src/kernel/library.cpp b/src/kernel/library.cpp index ac1963f81..6fbaa3b93 100644 --- a/src/kernel/library.cpp +++ b/src/kernel/library.cpp @@ -88,7 +88,11 @@ inline namespace kernel { library.define("emergency-exit", [](let const& xs) { - if (let const& status = car(xs); status.is()) + if (let const& status = car(xs); status.is()) + { + throw exit_status::success; + } + else if (status.is()) { throw select(status) ? exit_status::success : exit_status::failure; } From c2a0e55f3ef274b9cf55e8a28a8295b82f8a1ce9 Mon Sep 17 00:00:00 2001 From: yamacir-kit Date: Fri, 16 Sep 2022 19:27:20 +0900 Subject: [PATCH 09/46] Lipsticks Signed-off-by: yamacir-kit --- README.md | 6 +++--- VERSION | 2 +- include/meevax/kernel/configurator.hpp | 2 -- include/meevax/kernel/error.hpp | 3 --- include/meevax/kernel/heterogeneous.hpp | 5 ----- include/meevax/kernel/list.hpp | 1 - include/meevax/kernel/machine.hpp | 1 - include/meevax/kernel/number.hpp | 1 - include/meevax/kernel/overview.hpp | 17 ++++++++++------- include/meevax/kernel/reader.hpp | 1 - include/meevax/kernel/string.hpp | 2 +- include/meevax/kernel/syntax.hpp | 2 ++ include/meevax/memory/collector.hpp | 2 -- include/meevax/memory/nan_boxing_pointer.hpp | 1 - src/kernel/library.cpp | 2 +- src/kernel/string.cpp | 6 +++--- 16 files changed, 21 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 299957006..7fcbfb720 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,9 @@ sudo rm -rf /usr/local/share/meevax | Target Name | Description |:-------------------|:-- -| `all` (default) | Build shared-library `libmeevax.0.4.240.so` and executable `meevax`. +| `all` (default) | Build shared-library `libmeevax.0.4.241.so` and executable `meevax`. | `test` | Test executable `meevax`. -| `package` | Generate debian package `meevax_0.4.240_amd64.deb`. +| `package` | Generate debian package `meevax_0.4.241_amd64.deb`. | `install` | Copy files into `/usr/local` __(1)__. | `install.deb` | `all` + `package` + `sudo apt install .deb` | `safe-install.deb` | `all` + `test` + `package` + `sudo apt install .deb` @@ -122,7 +122,7 @@ __(1)__ Meevax installed by `make install` cannot be uninstalled by the system's ## Usage ``` -Meevax Lisp System, version 0.4.240 +Meevax Lisp System, version 0.4.241 Usage: meevax [OPTION...] [FILE...] diff --git a/VERSION b/VERSION index 533bacc45..2657f9836 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.240 +0.4.241 diff --git a/include/meevax/kernel/configurator.hpp b/include/meevax/kernel/configurator.hpp index e45d20cfb..7907ca5f1 100644 --- a/include/meevax/kernel/configurator.hpp +++ b/include/meevax/kernel/configurator.hpp @@ -19,9 +19,7 @@ #include -#include #include -#include #include #include #include diff --git a/include/meevax/kernel/error.hpp b/include/meevax/kernel/error.hpp index 7b5e35b4b..b5dbd80be 100644 --- a/include/meevax/kernel/error.hpp +++ b/include/meevax/kernel/error.hpp @@ -17,11 +17,8 @@ #ifndef INCLUDED_MEEVAX_KERNEL_ERROR_HPP #define INCLUDED_MEEVAX_KERNEL_ERROR_HPP -#include - #include #include -#include /* ---- Error ------------------------------------------------------------------ * diff --git a/include/meevax/kernel/heterogeneous.hpp b/include/meevax/kernel/heterogeneous.hpp index 8f297bb82..69e4f0d4c 100644 --- a/include/meevax/kernel/heterogeneous.hpp +++ b/include/meevax/kernel/heterogeneous.hpp @@ -17,13 +17,8 @@ #ifndef INCLUDED_MEEVAX_KERNEL_POINTER_HPP #define INCLUDED_MEEVAX_KERNEL_POINTER_HPP -#include -#include #include #include -#include -#include -#include namespace meevax { diff --git a/include/meevax/kernel/list.hpp b/include/meevax/kernel/list.hpp index 62facee51..d78301e8d 100644 --- a/include/meevax/kernel/list.hpp +++ b/include/meevax/kernel/list.hpp @@ -19,7 +19,6 @@ #include -#include #include #include #include diff --git a/include/meevax/kernel/machine.hpp b/include/meevax/kernel/machine.hpp index 4c11ebea8..c24e58bc6 100644 --- a/include/meevax/kernel/machine.hpp +++ b/include/meevax/kernel/machine.hpp @@ -17,7 +17,6 @@ #ifndef INCLUDED_MEEVAX_KERNEL_MACHINE_HPP #define INCLUDED_MEEVAX_KERNEL_MACHINE_HPP -#include #include #include #include diff --git a/include/meevax/kernel/number.hpp b/include/meevax/kernel/number.hpp index 3313b5b67..b218c3f38 100644 --- a/include/meevax/kernel/number.hpp +++ b/include/meevax/kernel/number.hpp @@ -21,7 +21,6 @@ #include #include #include -#include namespace meevax { diff --git a/include/meevax/kernel/overview.hpp b/include/meevax/kernel/overview.hpp index ea272d156..070abec71 100644 --- a/include/meevax/kernel/overview.hpp +++ b/include/meevax/kernel/overview.hpp @@ -17,10 +17,19 @@ #ifndef INCLUDED_MEEVAX_KERNEL_OVERVIEW_HPP #define INCLUDED_MEEVAX_KERNEL_OVERVIEW_HPP +#include +#include +#include +#include +#include #include +#include #include -#include +#include +#include +#include #include +#include #define NIL /* nothing */ @@ -28,13 +37,7 @@ namespace meevax { inline namespace kernel { - class environment; - - struct error; // error.hpp - struct exact_integer; // exact_integer.hpp struct pair; // pair.hpp - struct ratio; // ratio.hpp - struct vector; // vector.hpp template