Skip to content

Commit 5e27098

Browse files
authored
Merge pull request #473 from yamacir-kit/release-candidate
Release candidate
2 parents 1748222 + e6dbc64 commit 5e27098

24 files changed

+523
-118
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1+
basis/src
12
build
2-
include/meevax/basis
33
include/meevax/unicode
44
src/kernel/version.cpp

CMakeLists.txt

+38-18
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,33 @@ string(TOLOWER ${CMAKE_SYSTEM_NAME} ${PROJECT_NAME}_SYSTEM_NAME)
6464
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/README.md ${CMAKE_CURRENT_SOURCE_DIR}/README.md)
6565
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/configure/version.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/kernel/version.cpp)
6666

67+
# ---- Target basis ------------------------------------------------------------
68+
69+
file(GLOB ${PROJECT_NAME}_BASIS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/basis/*.ss)
70+
71+
foreach(EACH IN LISTS ${PROJECT_NAME}_BASIS_SOURCES)
72+
get_filename_component(FILENAME ${EACH} NAME)
73+
file(READ ${EACH} ${FILENAME})
74+
endforeach()
75+
76+
configure_file(
77+
${CMAKE_CURRENT_SOURCE_DIR}/configure/basis.cpp
78+
${CMAKE_CURRENT_SOURCE_DIR}/basis/src/basis.cpp)
79+
80+
add_library(basis SHARED)
81+
82+
target_sources(basis PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/basis/src/basis.cpp)
83+
84+
target_include_directories(basis
85+
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/basis/include>
86+
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
87+
88+
set_target_properties(basis PROPERTIES
89+
OUTPUT_NAME ${PROJECT_NAME}-basis # Rename libbasis => libmeevax-basis
90+
VERSION ${PROJECT_VERSION}
91+
SOVERSION ${PROJECT_VERSION_MAJOR}
92+
LINK_FLAGS_RELEASE -s)
93+
6794
# ---- Target kernel -----------------------------------------------------------
6895

6996
add_library(kernel SHARED)
@@ -81,25 +108,18 @@ target_link_libraries(kernel
81108
PUBLIC gmp)
82109

83110
set_target_properties(kernel PROPERTIES
84-
OUTPUT_NAME ${PROJECT_NAME} # Rename libkernel => libmeevax
111+
OUTPUT_NAME ${PROJECT_NAME}-kernel # Rename libkernel => libmeevax-kernel
85112
VERSION ${PROJECT_VERSION}
86113
SOVERSION ${PROJECT_VERSION_MAJOR}
87114
LINK_FLAGS_RELEASE -s)
88115

89-
# ---- Target basis ------------------------------------------------------------
90-
91-
add_custom_target(basis
92-
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/configure/basis.cmake)
93-
94116
# ---- Target shell ------------------------------------------------------------
95117

96118
add_executable(shell)
97119

98-
add_dependencies(shell basis)
99-
100120
target_sources(shell PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
101121

102-
target_link_libraries(shell PRIVATE kernel)
122+
target_link_libraries(shell PRIVATE basis kernel)
103123

104124
set_target_properties(shell PROPERTIES
105125
OUTPUT_NAME ${PROJECT_NAME} # Rename shell => meevax
@@ -116,7 +136,7 @@ write_basic_package_version_file(
116136
# ---- Target install ----------------------------------------------------------
117137

118138
install( # /usr/lib/libmeevax
119-
TARGETS kernel
139+
TARGETS basis kernel
120140
EXPORT ${PROJECT_NAME}-config
121141
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
122142
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
@@ -126,7 +146,8 @@ install( # /usr/bin/meevax
126146
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
127147

128148
install( # /usr/include/meevax
129-
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
149+
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
150+
${CMAKE_CURRENT_SOURCE_DIR}/basis/include/
130151
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
131152

132153
install( # /usr/share/meevax/meevax-config.cmake
@@ -135,8 +156,7 @@ install( # /usr/share/meevax/meevax-config.cmake
135156
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}
136157
NAMESPACE Meevax::)
137158

138-
# /usr/share/meevax/meevax-config-version.cmake
139-
install(
159+
install( # /usr/share/meevax/meevax-config-version.cmake
140160
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
141161
DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
142162

@@ -180,14 +200,14 @@ file(GLOB ${PROJECT_NAME}_TEST_CPP ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)
180200

181201
foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_CPP)
182202
get_filename_component(FILENAME ${EACH} NAME_WE)
183-
add_executable(assert-${FILENAME} ${EACH})
184-
add_dependencies(assert-${FILENAME} basis)
185-
target_link_libraries(assert-${FILENAME} PRIVATE kernel)
203+
add_executable(test_${FILENAME} ${EACH})
204+
target_link_libraries(test_${FILENAME} PRIVATE basis kernel)
205+
target_compile_options(test_${FILENAME} PUBLIC -Wno-deprecated-declarations)
186206
add_test(
187-
NAME assert-${FILENAME}
207+
NAME test/${FILENAME}
188208
COMMAND ${${PROJECT_NAME}_MEMORY_CHECK_COMMAND}
189209
${${PROJECT_NAME}_MEMORY_CHECK_OPTIONS}
190-
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assert-${FILENAME})
210+
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${FILENAME})
191211
endforeach()
192212

193213
# ---- Additional Targets ------------------------------------------------------

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Latest release is [here](https://github.com/yamacir-kit/meevax/releases).
2525
- Low-level hygienic macro system, known as *syntactic closures* [[Bawden and
2626
Rees 1988](#Bawden-and-Rees-1988); [Hanson 1991](#Hanson-1991)] and *explicit
2727
renaming* [[Clinger 1991](#Clinger-1991)]. For these, the well-known macro
28-
transformers `sc-macro-transformer`, `rsc-macro-transformer`, and
28+
transformers `sc-macro-transformer`, `rsc-macro-transformer` and
2929
`er-macro-transformer` from the library [`(meevax
3030
macro-transformer)`](./basis/meevax.ss) are provided. Note that these are
3131
non-Scheme standards.
@@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
9191
cmake -B build -DCMAKE_BUILD_TYPE=Release
9292
cd build
9393
make package
94-
sudo apt install build/meevax_0.5.107_amd64.deb
94+
sudo apt install build/meevax_0.5.119_amd64.deb
9595
```
9696

9797
or
@@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax
123123

124124
| Target Name | Description
125125
|-------------|-------------
126-
| `all` | Build shared-library `libmeevax.0.5.107.so` and executable `meevax`
126+
| `all` | Build shared-library `libmeevax.0.5.119.so` and executable `meevax`
127127
| `test` | Test executable `meevax`
128-
| `package` | Generate debian package `meevax_0.5.107_amd64.deb`
128+
| `package` | Generate debian package `meevax_0.5.119_amd64.deb`
129129
| `install` | Copy files into `/usr/local` directly
130130

131131
## Usage

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.107
1+
0.5.119

basis/include/meevax/basis.hpp

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
Copyright 2018-2023 Tatsuya Yamasaki.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
#ifndef INCLUDED_MEEVAX_KERNEL_BASIS_HPP
18+
#define INCLUDED_MEEVAX_KERNEL_BASIS_HPP
19+
20+
#include <vector>
21+
22+
namespace meevax
23+
{
24+
auto basis() -> std::vector<char const*>;
25+
} // namespace meevax
26+
27+
#endif // INCLUDED_MEEVAX_KERNEL_BASIS_HPP

configure/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Latest release is [here](https://github.com/yamacir-kit/meevax/releases).
2525
- Low-level hygienic macro system, known as *syntactic closures* [[Bawden and
2626
Rees 1988](#Bawden-and-Rees-1988); [Hanson 1991](#Hanson-1991)] and *explicit
2727
renaming* [[Clinger 1991](#Clinger-1991)]. For these, the well-known macro
28-
transformers `sc-macro-transformer`, `rsc-macro-transformer`, and
28+
transformers `sc-macro-transformer`, `rsc-macro-transformer` and
2929
`er-macro-transformer` from the library [`(meevax
3030
macro-transformer)`](./basis/meevax.ss) are provided. Note that these are
3131
non-Scheme standards.

configure/basis.cmake

-15
This file was deleted.

configure/basis.hpp configure/basis.cpp

+5-18
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,13 @@
1414
limitations under the License.
1515
*/
1616

17-
#ifndef INCLUDED_MEEVAX_KERNEL_BASIS_HPP
18-
#define INCLUDED_MEEVAX_KERNEL_BASIS_HPP
19-
20-
#include <array>
17+
#include <meevax/basis.hpp>
2118

2219
namespace meevax
2320
{
24-
inline namespace kernel
25-
{
26-
template <typename... Ts>
27-
constexpr auto make_array(Ts&&... xs) -> std::array<std::decay_t<std::common_type_t<Ts...>>, sizeof...(Ts)>
28-
{
29-
return { std::forward<decltype(xs)>(xs)... };
30-
}
31-
32-
constexpr auto basis()
21+
auto basis() -> std::vector<char const*>
3322
{
34-
return make_array(
23+
return {
3524
R"##(${meevax.ss})##",
3625
R"##(${r4rs.ss})##",
3726
R"##(${r5rs.ss})##",
@@ -53,9 +42,7 @@ inline namespace kernel
5342
R"##(${srfi-78.ss})##",
5443
R"##(${srfi-98.ss})##",
5544
R"##(${srfi-111.ss})##",
56-
R"##(${srfi-149.ss})##");
45+
R"##(${srfi-149.ss})##",
46+
};
5747
}
58-
} // namespace kernel
5948
} // namespace meevax
60-
61-
#endif // INCLUDED_MEEVAX_KERNEL_BASIS_HPP

example/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ add_library(${PROJECT_NAME} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.c
1010

1111
target_compile_options(${PROJECT_NAME} PUBLIC "-Wno-return-type-c-linkage")
1212

13-
target_link_libraries(${PROJECT_NAME} PRIVATE Meevax::kernel)
13+
target_link_libraries(${PROJECT_NAME} PRIVATE Meevax::kernel Meevax::basis)
1414

1515
enable_testing()
1616

example/example.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <meevax/basis.hpp>
12
#include <meevax/kernel/environment.hpp>
23

34
using namespace meevax; // NOTE: DIRTY HACK

include/meevax/kernel/pair.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,11 @@ inline namespace kernel
136136

137137
using const_iterator = forward_iterator<true>;
138138

139-
explicit pair(object const& = unit, object const& = unit);
139+
constexpr pair() = default;
140+
141+
explicit pair(object const&);
142+
143+
explicit pair(object const&, object const&);
140144

141145
template <typename... Ts, typename = std::enable_if_t<(1 < sizeof...(Ts))>>
142146
explicit pair(object const& a, Ts&&... xs)

include/meevax/kernel/procedure.hpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ inline namespace kernel
4545
{
4646
std::enable_if_t<std::is_invocable_v<F> or std::is_invocable_v<F, object &>, F> invocable;
4747

48-
explicit generic_procedure(std::string const& name, F f)
49-
: primitive_procedure { name }
50-
, invocable { f }
48+
template <typename T, typename U>
49+
explicit generic_procedure(T && x, U && y)
50+
: primitive_procedure { std::forward<decltype(x)>(x) }
51+
, invocable { std::forward<decltype(y)>(y) }
5152
{}
5253

5354
auto operator ()(object & xs) const -> object override

include/meevax/memory/collector.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -121,30 +121,30 @@ inline namespace memory
121121
friend class collector;
122122

123123
protected:
124-
tag * location = nullptr;
124+
tag * object = nullptr;
125125

126126
explicit constexpr mutator() = default;
127127

128-
explicit mutator(tag * location) noexcept
129-
: location { location }
128+
explicit mutator(tag * object) noexcept
129+
: object { object }
130130
{
131-
if (location)
131+
if (object)
132132
{
133133
mutators.insert(this);
134134
}
135135
}
136136

137137
~mutator() noexcept
138138
{
139-
if (location)
139+
if (object)
140140
{
141141
mutators.erase(this);
142142
}
143143
}
144144

145145
auto reset(tag * after = nullptr) noexcept -> void
146146
{
147-
if (auto before = std::exchange(location, after); not before and after)
147+
if (auto before = std::exchange(object, after); not before and after)
148148
{
149149
mutators.insert(this);
150150
}
@@ -181,9 +181,9 @@ inline namespace memory
181181
protected:
182182
static inline tag * cache = nullptr;
183183

184-
static inline pointer_set<tag *> tags {};
184+
static inline v2::pointer_set<tag *> tags {};
185185

186-
static inline pointer_set<mutator *> mutators {};
186+
static inline v2::pointer_set<mutator *> mutators {};
187187

188188
static inline std::size_t allocation = 0;
189189

include/meevax/memory/gc_pointer.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ inline namespace memory
3333

3434
gc_pointer(gc_pointer const& gcp)
3535
: pointer { gcp }
36-
, collector::mutator { gcp.location }
36+
, collector::mutator { gcp.object }
3737
{}
3838

3939
gc_pointer(pointer const& p)
@@ -72,7 +72,7 @@ inline namespace memory
7272
auto reset(gc_pointer const& gcp) -> void
7373
{
7474
pointer::reset(gcp);
75-
collector::mutator::reset(gcp.location);
75+
collector::mutator::reset(gcp.object);
7676
}
7777

7878
auto reset(pointer const& p) -> void

include/meevax/memory/heterogeneous_pointer.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ inline namespace memory
4343
{
4444
template <typename... Us>
4545
explicit constexpr binder(Us&&... xs)
46-
: std::conditional_t<std::is_base_of_v<Top, Bound>, Top, Bound> { std::forward<decltype(xs)>(xs)... }
46+
: std::conditional_t<std::is_base_of_v<Top, Bound> and std::is_constructible_v<Top, Us...>, Top, Bound> {
47+
std::forward<decltype(xs)>(xs)...
48+
}
4749
{}
4850

4951
~binder() override = default;

0 commit comments

Comments
 (0)