Skip to content

Commit

Permalink
Declare v1::pointer_set deprecated
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Feb 15, 2024
1 parent 9926a2b commit fa08602
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 22 deletions.
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ file(GLOB ${PROJECT_NAME}_TEST_CPP ${CMAKE_CURRENT_SOURCE_DIR}/test/*.cpp)

foreach(EACH IN LISTS ${PROJECT_NAME}_TEST_CPP)
get_filename_component(FILENAME ${EACH} NAME_WE)
add_executable(assert-${FILENAME} ${EACH})
target_link_libraries(assert-${FILENAME} PRIVATE basis kernel)
add_executable(test_${FILENAME} ${EACH})
target_link_libraries(test_${FILENAME} PRIVATE basis kernel)
target_compile_options(test_${FILENAME} PUBLIC -Wno-deprecated-declarations)
add_test(
NAME assert-${FILENAME}
NAME test/${FILENAME}
COMMAND ${${PROJECT_NAME}_MEMORY_CHECK_COMMAND}
${${PROJECT_NAME}_MEMORY_CHECK_OPTIONS}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assert-${FILENAME})
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_${FILENAME})
endforeach()

# ---- Additional Targets ------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Procedures for each standard are provided by the following R7RS-style libraries:
cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build
make package
sudo apt install build/meevax_0.5.115_amd64.deb
sudo apt install build/meevax_0.5.116_amd64.deb
```

or
Expand Down Expand Up @@ -123,9 +123,9 @@ sudo rm -rf /usr/local/share/meevax

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.115.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.116.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.115_amd64.deb`
| `package` | Generate debian package `meevax_0.5.116_amd64.deb`
| `install` | Copy files into `/usr/local` directly

## Usage
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.115
0.5.116
6 changes: 5 additions & 1 deletion include/meevax/kernel/pair.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ inline namespace kernel

using const_iterator = forward_iterator<true>;

explicit pair(object const& = unit, object const& = unit);
constexpr pair() = default;

explicit pair(object const&);

explicit pair(object const&, object const&);

template <typename... Ts, typename = std::enable_if_t<(1 < sizeof...(Ts))>>
explicit pair(object const& a, Ts&&... xs)
Expand Down
24 changes: 12 additions & 12 deletions include/meevax/memory/integer_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ inline namespace memory

using subset = integer_set<std::uintptr_t, Es...>; // Only the outermost implementation knows the original type name T.

using superset = std::array<subset *, N>;
using subsets = subset *[N];

superset data {};
subsets data = {};

struct const_iterator : public std::iterator<std::bidirectional_iterator_tag, T>
{
superset const* data = nullptr;
subset const* const* data = nullptr;

std::size_t i = std::numeric_limits<std::size_t>::max();

Expand All @@ -83,15 +83,15 @@ inline namespace memory
constexpr const_iterator() = default;

explicit const_iterator(integer_set const* container, std::size_t i, std::uintptr_t j = 0)
: data { std::addressof(container->data) }
: data { container->data }
, i { i }
{
assert(i <= N);
increment_unless_truthy(j);
}

explicit const_iterator(integer_set const* container)
: data { std::addressof(container->data) }
: data { container->data }
, i { N }
{
decrement_unless_truthy();
Expand All @@ -100,9 +100,11 @@ inline namespace memory

auto increment_unless_truthy(std::uintptr_t j = 0) -> void
{
for (assert(data); good(); ++i, j = 0)
assert(data);

for (; good(); ++i, j = 0)
{
if (auto datum = (*data)[i]; datum and (iter = datum->lower_bound(j)).good())
if (data[i] and (iter = data[i]->lower_bound(j)).good())
{
return;
}
Expand All @@ -113,13 +115,11 @@ inline namespace memory

auto decrement_unless_truthy() -> void
{
i = std::min(i, N - 1);

assert(good());
assert(data);

for (assert(data); good(); --i)
for (i = std::min(i, N - 1); good(); --i)
{
if (auto datum = (*data)[i]; datum and (iter = typename subset::const_iterator(datum)).good())
if (data[i] and (iter = typename subset::const_iterator(data[i])).good())
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/memory/pointer_set.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ inline namespace v1
template <typename...> typename OrderedMap = simple_flat_map,
template <std::size_t> typename Bitset = simple_bitset,
std::size_t N = 4096 * 8> // getconf PAGE_SIZE
class pointer_set
class [[deprecated]] pointer_set
{
static_assert(std::is_pointer_v<Pointer>);

Expand Down
4 changes: 4 additions & 0 deletions src/kernel/pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ inline namespace kernel
{
let unit { nullptr };

pair::pair(object const& a)
: std::pair<object, object> { a, unit }
{}

pair::pair(object const& a, object const& b)
: std::pair<object, object> { a, b }
{}
Expand Down

0 comments on commit fa08602

Please sign in to comment.