Skip to content

Commit

Permalink
Lipsticks
Browse files Browse the repository at this point in the history
Signed-off-by: yamacir-kit <[email protected]>
  • Loading branch information
yamacir-kit committed Nov 3, 2023
1 parent 23daa39 commit 898df17
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
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.67_amd64.deb
sudo apt install build/meevax_0.5.68_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.67.so` and executable `meevax`
| `all` | Build shared-library `libmeevax.0.5.68.so` and executable `meevax`
| `test` | Test executable `meevax`
| `package` | Generate debian package `meevax_0.5.67_amd64.deb`
| `package` | Generate debian package `meevax_0.5.68_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.67
0.5.68
3 changes: 1 addition & 2 deletions basis/srfi-4.ss
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
(define-library (srfi 4)
(import (meevax vector homogeneous))
(export
f32vector? make-f32vector f32vector f32vector-length f32vector-ref
(export f32vector? make-f32vector f32vector f32vector-length f32vector-ref
f32vector-set! f32vector->list list->f32vector

f64vector? make-f64vector f64vector f64vector-length f64vector-ref
Expand Down
19 changes: 13 additions & 6 deletions include/meevax/kernel/homogeneous_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ inline namespace kernel

homogeneous_vector() = default;

// list->@vector
explicit homogeneous_vector(object xs)
: valarray(length(xs))
{
Expand All @@ -45,29 +46,35 @@ inline namespace kernel
});
}

// make-@vector
explicit homogeneous_vector(std::size_t size, object const& x)
: valarray(input_cast(x), size)
{}

// @vector-copy
explicit homogeneous_vector(homogeneous_vector const& v, std::size_t begin, std::size_t end)
: valarray(v.valarray[std::slice(begin, begin < end ? end - begin : 0, 1)])
{}

// @vector-copy
explicit homogeneous_vector(homogeneous_vector const& v, std::size_t begin = 0)
: homogeneous_vector { v, begin, v.valarray.size() }
{}

// @vector-append
explicit homogeneous_vector(homogeneous_vector const& a, homogeneous_vector const& b)
: valarray(a.valarray.size() + b.valarray.size())
{
valarray[std::slice(0, a.valarray.size(), 1)] = a.valarray;
valarray[std::slice(a.valarray.size(), b.valarray.size(), 1)] = b.valarray;
slice(0, a.valarray.size()) = a.valarray;
slice(b.valarray.size(), valarray.size()) = b.valarray;
}

// string->u8vector
explicit homogeneous_vector(T const* data, std::size_t size)
: valarray(data, size)
{}

// get-output-u8vector
explicit homogeneous_vector(std::vector<T> const& v)
: valarray(v.data(), v.size())
{}
Expand Down Expand Up @@ -145,10 +152,6 @@ inline namespace kernel
return check(a.valarray == b.valarray);
}

using f32vector = homogeneous_vector<float>;

using f64vector = homogeneous_vector<double>;

using s8vector = homogeneous_vector<std::int8_t>;

using s16vector = homogeneous_vector<std::int16_t>;
Expand All @@ -164,6 +167,10 @@ inline namespace kernel
using u32vector = homogeneous_vector<std::uint32_t>;

using u64vector = homogeneous_vector<std::uint64_t>;

using f32vector = homogeneous_vector<float>;

using f64vector = homogeneous_vector<double>;
} // namespace kernel
} // namespace meevax

Expand Down
17 changes: 6 additions & 11 deletions src/kernel/boot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2038,7 +2038,7 @@ inline namespace kernel

define<library>("(meevax vector homogeneous)", [](library & library)
{
#define DEFINE_HOMOGENEOUS_VECTOR(TAG) \
#define DEFINE_VECTOR(TAG) \
library.define<procedure>(#TAG "vector?", [](let const& xs) \
{ \
return xs[0].is<TAG##vector>(); \
Expand Down Expand Up @@ -2170,16 +2170,11 @@ inline namespace kernel
return make<TAG##vector>(xs[0]); \
})

DEFINE_HOMOGENEOUS_VECTOR(f32);
DEFINE_HOMOGENEOUS_VECTOR(f64);
DEFINE_HOMOGENEOUS_VECTOR(s8);
DEFINE_HOMOGENEOUS_VECTOR(s16);
DEFINE_HOMOGENEOUS_VECTOR(s32);
DEFINE_HOMOGENEOUS_VECTOR(s64);
DEFINE_HOMOGENEOUS_VECTOR(u8);
DEFINE_HOMOGENEOUS_VECTOR(u16);
DEFINE_HOMOGENEOUS_VECTOR(u32);
DEFINE_HOMOGENEOUS_VECTOR(u64);
DEFINE_VECTOR(s8); DEFINE_VECTOR(s16); DEFINE_VECTOR(s32); DEFINE_VECTOR(s64);
DEFINE_VECTOR(u8); DEFINE_VECTOR(u16); DEFINE_VECTOR(u32); DEFINE_VECTOR(u64);
DEFINE_VECTOR(f32); DEFINE_VECTOR(f64);

#undef DEFINE_VECTOR

library.define<procedure>("u8vector->string", [](let const& xs)
{
Expand Down

0 comments on commit 898df17

Please sign in to comment.