Skip to content

Commit

Permalink
Update procedure_pointer to allow foreign-functions to define mutab…
Browse files Browse the repository at this point in the history
…le procedures

Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Oct 7, 2023
1 parent 3b90940 commit e57ae75
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,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.30_amd64.deb
sudo apt install build/meevax_0.5.31_amd64.deb
```

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

| Target Name | Description
|-------------|-------------
| `all` | Build shared-library `libmeevax.0.5.30.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.31.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.30_amd64.deb`
| `package` | Generate debian package `meevax_0.5.31_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.30
0.5.31
10 changes: 5 additions & 5 deletions example/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ using namespace meevax; // NOTE: DIRTY HACK

extern "C"
{
auto arity(object const& xs)
auto arity(object & xs)
{
return make<exact_integer>(length(xs));
}

auto dummy_procedure(object const& xs)
auto dummy_procedure(object & xs)
{
std::cout << "\n; calling C++ function." << std::endl;

Expand Down Expand Up @@ -45,17 +45,17 @@ extern "C"
}
};

auto make_hoge(object const& xs)
auto make_hoge(object & xs)
{
return make<hoge>(xs[0].as<exact_integer>());
}

auto is_hoge(object const& xs)
auto is_hoge(object & xs)
{
return xs[0].is<hoge>() ? t : f;
}

auto hoge_value(object const& xs)
auto hoge_value(object & xs)
{
return make<exact_integer>(xs[0].as<hoge>().value);
}
Expand Down
2 changes: 1 addition & 1 deletion include/meevax/kernel/procedure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ inline namespace kernel
}
};

using procedure_pointer = auto (*)(object const&) -> object;
using procedure_pointer = auto (*)(object &) -> object;

auto dlopen(std::string const&) -> void *;

Expand Down

0 comments on commit e57ae75

Please sign in to comment.