summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-08-12 11:38:10 +0200
committerTyge Lovset <[email protected]>2022-08-12 11:38:10 +0200
commita417e5affc99233abb6dbb685154bfdea1b726e3 (patch)
tree211f1e1c000d57ea7e5ca318c625996ce094dc76
parentf534db7ac4a993a05074868b8840a3a674ac76b4 (diff)
downloadSTC-modified-a417e5affc99233abb6dbb685154bfdea1b726e3.tar.gz
STC-modified-a417e5affc99233abb6dbb685154bfdea1b726e3.zip
More misc changes carc/cbox, cdeq/cvec.
-rw-r--r--docs/carc_api.md10
-rw-r--r--docs/cbox_api.md6
-rw-r--r--docs/cdeq_api.md8
-rw-r--r--docs/cvec_api.md10
-rw-r--r--examples/city.c25
-rw-r--r--include/stc/carc.h22
-rw-r--r--include/stc/cbox.h16
-rw-r--r--include/stc/cdeq.h29
-rw-r--r--include/stc/cvec.h17
-rw-r--r--include/stc/forward.h2
-rw-r--r--include/stc/template.h8
11 files changed, 73 insertions, 80 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md
index 8061c642..d09b1839 100644
--- a/docs/carc_api.md
+++ b/docs/carc_api.md
@@ -32,17 +32,17 @@ See similar c++ class [std::shared_ptr](https://en.cppreference.com/w/cpp/memory
## Methods
```c
carc_X carc_X_init(); // empty shared pointer
-carc_X carc_X_new(i_valraw raw); // construct a new value in an carc from raw type.
-carc_X carc_X_from(i_val val); // create a carc from constructed val object. Faster than from_ptr().
-carc_X carc_X_from_ptr(i_val* p); // create a carc from raw pointer. Takes ownership of p.
+carc_X carc_X_new(i_valraw raw); // create an carc from raw type (available if i_valraw defined by user).
+carc_X carc_X_from(i_val val); // create an carc from constructed val object. Faster than from_ptr().
+carc_X carc_X_from_ptr(i_val* p); // create an carc from raw pointer. Takes ownership of p.
carc_X carc_X_clone(carc_X other); // return other with increased use count
carc_X carc_X_move(carc_X* self); // transfer ownership to another carc.
void carc_X_take(carc_X* self, carc_X other); // take ownership of other.
-void carc_X_assign(carc_X* self, carc_X other); // copy shared (increase use count)
+void carc_X_copy(carc_X* self, carc_X other); // shared assign (increase use count)
void carc_X_drop(carc_X* self); // destruct (decrease use count, free at 0)
-long carc_X_use_count(carc_X ptr);
+long carc_X_use_count(const carc_X* self);
void carc_X_reset(carc_X* self);
void carc_X_reset_to(carc_X* self, i_val* p); // assign new carc from ptr. Takes ownership of p.
diff --git a/docs/cbox_api.md b/docs/cbox_api.md
index 2587fdf8..dc90fa8e 100644
--- a/docs/cbox_api.md
+++ b/docs/cbox_api.md
@@ -31,14 +31,14 @@ compare the pointer addresses when used. Additionally, `c_no_clone` or `i_is_fwd
## Methods
```c
cbox_X cbox_X_init(); // return an empty cbox
-cbox_X cbox_X_from(i_valraw raw); // construct a new boxed object from raw type, if defined.
-cbox_X cbox_X_make(i_val val); // make a cbox from constructed val object.
+cbox_X cbox_X_new(i_valraw raw); // create a cbox from raw type. Avail if i_valraw user defined.
+cbox_X cbox_X_from(i_val val); // create a cbox from constructed val object.
cbox_X cbox_X_from_ptr(i_val* p); // create a cbox from a pointer. Takes ownership of p.
cbox_X cbox_X_clone(cbox_X other); // return deep copied clone
cbox_X cbox_X_move(cbox_X* self); // transfer ownership to another cbox.
void cbox_X_take(cbox_X* self, cbox_X other); // take ownership of other.
-void cbox_X_assign(cbox_X* self, cbox_X other); // deep copy to self
+void cbox_X_copy(cbox_X* self, cbox_X other); // deep copy to self
void cbox_X_drop(cbox_X* self); // destruct the contained object and free's it.
void cbox_X_reset(cbox_X* self);
diff --git a/docs/cdeq_api.md b/docs/cdeq_api.md
index e7336a26..a8d2baeb 100644
--- a/docs/cdeq_api.md
+++ b/docs/cdeq_api.md
@@ -29,6 +29,7 @@ cdeq_X cdeq_X_clone(cdeq_X deq);
void cdeq_X_clear(cdeq_X* self);
void cdeq_X_copy(cdeq_X* self, const cdeq_X* other);
+cdeq_X_iter cdeq_X_copy_range_p(cdeq_X* self, i_val* pos, const i_val* p1, const i_val* p2);
bool cdeq_X_reserve(cdeq_X* self, size_t cap);
void cdeq_X_shrink_to_fit(cdeq_X* self);
void cdeq_X_swap(cdeq_X* a, cdeq_X* b);
@@ -63,16 +64,15 @@ cdeq_X_iter cdeq_X_insert_at(cdeq_X* self, cdeq_X_iter it, i_val value);
cdeq_X_iter cdeq_X_insert_range_p(cdeq_X* self, i_val* pos,
const i_val* p1, const i_val* p2);
-cdeq_X_iter cdeq_X_emplace_n(cdeq_X* self, size_t idx, const i_valraw[] arr, size_t n);
+cdeq_X_iter cdeq_X_emplace_n(cdeq_X* self, size_t idx, const i_valraw[] arr, size_t n); // clone values
cdeq_X_iter cdeq_X_emplace_at(cdeq_X* self, cdeq_X_iter it, i_valraw raw);
-cdeq_X_iter cdeq_X_emplace_range(cdeq_X* self, cdeq_X_iter it, // will clone
- cdeq_X_iter it1, cdeq_X_iter it2);
cdeq_X_iter cdeq_X_emplace_range_p(cdeq_X* self, i_val* pos,
- const i_val* p1, const i_val* p2);
+ const i_valraw* p1, const i_valraw* p2);
cdeq_X_iter cdeq_X_erase_n(cdeq_X* self, size_t idx, size_t n);
cdeq_X_iter cdeq_X_erase_at(cdeq_X* self, cdeq_X_iter it);
cdeq_X_iter cdeq_X_erase_range(cdeq_X* self, cdeq_X_iter it1, cdeq_X_iter it2);
+cdeq_X_iter cdeq_X_erase_range_p(cdeq_X* self, i_val* p1, i_val* p2);
void cdeq_X_sort(cdeq_X* self);
void cdeq_X_sort_range(cdeq_X_iter i1, cdeq_X_iter i2,
diff --git a/docs/cvec_api.md b/docs/cvec_api.md
index b33cdc75..ea26c345 100644
--- a/docs/cvec_api.md
+++ b/docs/cvec_api.md
@@ -34,6 +34,7 @@ cvec_X cvec_X_clone(cvec_X vec);
void cvec_X_clear(cvec_X* self);
void cvec_X_copy(cvec_X* self, const cvec_X* other);
+cvec_X_iter cvec_X_copy_range_p(cvec_X* self, i_val* pos, const i_val* p1, const i_val* p2);
bool cvec_X_reserve(cvec_X* self, size_t cap);
bool cvec_X_resize(cvec_X* self, size_t size, i_val null);
cvec_X_iter cvec_X_insert_uninit_p(cvec_X* self, i_val* pos, size_t n); // return pos iter
@@ -74,16 +75,15 @@ cvec_X_iter cvec_X_insert_at(cvec_X* self, cvec_X_iter it, i_val value);
cvec_X_iter cvec_X_insert_range_p(cvec_X* self, i_val* pos,
const i_val* p1, const i_val* p2);
-cvec_X_iter cvec_X_emplace_n(cvec_X* self, size_t idx, const i_valraw[] arr, size_t n);
+cvec_X_iter cvec_X_emplace_n(cvec_X* self, size_t idx, const i_valraw[] arr, size_t n); // clone values
cvec_X_iter cvec_X_emplace_at(cvec_X* self, cvec_X_iter it, i_valraw raw);
-cvec_X_iter cvec_X_emplace_range(cvec_X* self, cvec_X_iter it, // will clone
- cvec_X_iter it1, cvec_X_iter it2);
-cvec_X_iter cvec_X_emplace_range_p(cvec_X* self, i_val* pos,
- const i_val* p1, const i_val* p2);
+cvec_X_iter cvec_X_emplace_range_p(cvec_X* self, i_val* pos,
+ const i_valraw* p1, const i_valraw* p2);
cvec_X_iter cvec_X_erase_n(cvec_X* self, size_t idx, size_t n);
cvec_X_iter cvec_X_erase_at(cvec_X* self, cvec_X_iter it);
cvec_X_iter cvec_X_erase_range(cvec_X* self, cvec_X_iter it1, cvec_X_iter it2);
+cvec_X_iter cvec_X_erase_range_p(cvec_X* self, i_val* p1, i_val* p2);
void cvec_X_sort(cvec_X* self);
void cvec_X_sort_range(cvec_X_iter i1, cvec_X_iter i2,
diff --git a/examples/city.c b/examples/city.c
index 0fcee341..c6a9417f 100644
--- a/examples/city.c
+++ b/examples/city.c
@@ -32,8 +32,9 @@ static inline void City_drop(City* c) {
#define i_type CityArc
#define i_key_bind City
-#include <stc/cbox.h>
-//#include <stc/carc.h> // try instead of cbox.h
+#define i_opt c_no_atomic
+//#include <stc/cbox.h>
+#include <stc/carc.h> // try instead of cbox.h
#define i_type Cities
#define i_key_arcbox CityArc
@@ -50,17 +51,13 @@ int main(void)
c_auto (Cities, cities, copy)
c_auto (CityMap, map)
{
- struct City_s { const char *name, *country; float lat, lon; int pop; };
-
- c_forarray (struct City_s, c, {
- {"New York", "US", 4.3, 23.2, 9000000},
- {"Paris", "France", 4.3, 23.2, 9000000},
- {"Berlin", "Germany", 4.3, 23.2, 9000000},
- {"London", "UK", 4.3, 23.2, 9000000},
+ c_forarray (City, c, {
+ {cstr_new("New York"), cstr_new("US"), 4.3, 23.2, 9000000},
+ {cstr_new("Paris"), cstr_new("France"), 4.3, 23.2, 9000000},
+ {cstr_new("Berlin"), cstr_new("Germany"), 4.3, 23.2, 9000000},
+ {cstr_new("London"), cstr_new("UK"), 4.3, 23.2, 9000000},
}) {
- Cities_emplace(&cities, (City){cstr_from(c->name),
- cstr_from(c->country),
- c->lat, c->lon, c->pop});
+ Cities_emplace(&cities, *c);
}
copy = Cities_clone(cities); // share each element!
@@ -76,12 +73,12 @@ int main(void)
c_foreach (c, Cities, cities)
printf("city:%s, %d, use:%ld\n", cstr_str(&c.ref->get->name),
c.ref->get->population,
- CityArc_use_count(*c.ref));
+ CityArc_use_count(c.ref));
printf("\nMap:\n");
c_forpair (id, city, CityMap, map)
printf("id:%d, city:%s, %d, use:%ld\n", *_.id, cstr_str(&_.city->get->name),
- _.city->get->population, CityArc_use_count(*_.city));
+ _.city->get->population, CityArc_use_count(_.city));
puts("");
}
}
diff --git a/include/stc/carc.h b/include/stc/carc.h
index 20ba26b0..6e8f7d38 100644
--- a/include/stc/carc.h
+++ b/include/stc/carc.h
@@ -56,14 +56,17 @@ int main() {
#include <stdlib.h>
#if defined(__GNUC__) || defined(__clang__)
+ typedef long catomic_long;
#define c_atomic_inc(v) (void)__atomic_add_fetch(v, 1, __ATOMIC_SEQ_CST)
#define c_atomic_dec_and_test(v) !__atomic_sub_fetch(v, 1, __ATOMIC_SEQ_CST)
#elif defined(_MSC_VER)
#include <intrin.h>
+ typedef long catomic_long;
#define c_atomic_inc(v) (void)_InterlockedIncrement(v)
#define c_atomic_dec_and_test(v) !_InterlockedDecrement(v)
#else
#include <stdatomic.h>
+ typedef _Atomic long catomic_long;
#define c_atomic_inc(v) (void)atomic_fetch_add(v, 1)
#define c_atomic_dec_and_test(v) (atomic_fetch_sub(v, 1) == 1)
#endif
@@ -88,18 +91,18 @@ typedef i_keyraw _cx_raw;
#if !c_option(c_is_fwd)
_cx_deftypes(_c_carc_types, _cx_self, i_key);
#endif
-_cx_carc_rep { long counter; i_key value; };
+_cx_carc_rep { catomic_long counter; i_key value; };
STC_INLINE _cx_self _cx_memb(_init)(void)
{ return c_make(_cx_self){NULL, NULL}; }
-STC_INLINE long _cx_memb(_use_count)(_cx_self ptr)
- { return ptr.use_count ? *ptr.use_count : 0; }
+STC_INLINE long _cx_memb(_use_count)(const _cx_self* self)
+ { return self->use_count ? *self->use_count : 0; }
STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p) {
_cx_self ptr = {p};
if (p)
- *(ptr.use_count = c_alloc(long)) = 1;
+ *(ptr.use_count = c_alloc(catomic_long)) = 1;
return ptr;
}
@@ -111,16 +114,13 @@ STC_INLINE _cx_self _cx_memb(_from)(_cx_value val) {
*(ptr.get = &rep->value) = val;
return ptr;
}
-// [deprecated]
-STC_INLINE _cx_self _cx_memb(_make)(_cx_value val)
+
+STC_INLINE _cx_self _cx_memb(_make)(_cx_value val) // [deprecated]
{ return _cx_memb(_from)(val); }
STC_INLINE _cx_raw _cx_memb(_toraw)(const _cx_self* self)
{ return i_keyto(self->get); }
-STC_INLINE _cx_value _cx_memb(_toval)(const _cx_self* self)
- { return *self->get; }
-
STC_INLINE _cx_self _cx_memb(_move)(_cx_self* self) {
_cx_self ptr = *self;
self->get = NULL, self->use_count = NULL;
@@ -132,7 +132,7 @@ STC_INLINE void _cx_memb(_drop)(_cx_self* self) {
i_keydrop(self->get);
if ((char *)self->get != (char *)self->use_count + offsetof(_cx_carc_rep, value))
c_free(self->get);
- c_free(self->use_count);
+ c_free((long*)self->use_count);
}
}
@@ -158,7 +158,7 @@ STC_INLINE _cx_self _cx_memb(_clone)(_cx_self ptr) {
return ptr;
}
-STC_INLINE void _cx_memb(_assign)(_cx_self* self, _cx_self ptr) {
+STC_INLINE void _cx_memb(_copy)(_cx_self* self, _cx_self ptr) {
if (ptr.use_count)
_i_atomic_inc(ptr.use_count);
_cx_memb(_drop)(self);
diff --git a/include/stc/cbox.h b/include/stc/cbox.h
index d26a63c8..02a73fdc 100644
--- a/include/stc/cbox.h
+++ b/include/stc/cbox.h
@@ -82,8 +82,8 @@ _cx_deftypes(_c_cbox_types, _cx_self, i_key);
STC_INLINE _cx_self _cx_memb(_init)(void)
{ return c_make(_cx_self){NULL}; }
-STC_INLINE long _cx_memb(_use_count)(_cx_self box)
- { return (long)(box.get != NULL); }
+STC_INLINE long _cx_memb(_use_count)(const _cx_self* self)
+ { return (long)(self->get != NULL); }
STC_INLINE _cx_self _cx_memb(_from_ptr)(_cx_value* p)
{ return c_make(_cx_self){p}; }
@@ -100,9 +100,6 @@ STC_INLINE _cx_self _cx_memb(_make)(_cx_value val)
STC_INLINE _cx_raw _cx_memb(_toraw)(const _cx_self* self)
{ return i_keyto(self->get); }
-STC_INLINE _cx_value _cx_memb(_toval)(const _cx_self* self)
- { return *self->get; }
-
// destructor
STC_INLINE void _cx_memb(_drop)(_cx_self* self) {
if (self->get) {
@@ -129,11 +126,11 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) {
self->get = p;
}
-#if !defined _i_no_clone
#if !defined _i_no_emplace
STC_INLINE _cx_self _cx_memb(_new)(_cx_raw raw)
{ return _cx_memb(_from)(i_keyfrom(raw)); }
#endif
+#if !defined _i_no_clone
STC_INLINE _cx_self _cx_memb(_clone)(_cx_self other) {
if (!other.get)
return other;
@@ -141,13 +138,6 @@ STC_INLINE void _cx_memb(_reset_to)(_cx_self* self, _cx_value* p) {
*out.get = i_keyclone(*other.get);
return out;
}
-
- STC_INLINE void _cx_memb(_assign)(_cx_self* self, const _cx_self ptr) {
- if (self->get == ptr.get)
- return;
- _cx_memb(_drop)(self);
- *self = _cx_memb(_clone)(ptr);
- }
#endif // !_i_no_clone
STC_INLINE void _cx_memb(_take)(_cx_self* self, _cx_self other) {
diff --git a/include/stc/cdeq.h b/include/stc/cdeq.h
index afe26f4b..ef6c9f26 100644
--- a/include/stc/cdeq.h
+++ b/include/stc/cdeq.h
@@ -48,15 +48,12 @@ STC_API void _cx_memb(_clear)(_cx_self* self);
STC_API void _cx_memb(_drop)(_cx_self* self);
STC_API _cx_value* _cx_memb(_push)(_cx_self* self, i_key value);
STC_API void _cx_memb(_shrink_to_fit)(_cx_self *self);
+
#if !defined _i_queue
#if !defined _i_no_emplace
STC_API _cx_iter _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
const _cx_raw* p1, const _cx_raw* p2);
#endif // _i_no_emplace
-#if !defined _i_no_clone
-STC_API _cx_iter _cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
-#endif // !_i_no_clone
#if !c_option(c_no_cmp)
STC_API _cx_iter _cx_memb(_find_in)(_cx_iter p1, _cx_iter p2, _cx_raw raw);
@@ -68,19 +65,26 @@ STC_API _cx_iter _cx_memb(_insert_range_p)(_cx_self* self, _cx_value* pos
const _cx_value* p1, const _cx_value* p2);
#endif // !_i_queue
-#if !defined _i_no_clone
-STC_API _cx_self _cx_memb(_clone)(_cx_self cx);
#if !defined _i_no_emplace
STC_INLINE _cx_value* _cx_memb(_emplace)(_cx_self* self, _cx_raw raw)
{ return _cx_memb(_push)(self, i_keyfrom(raw)); }
#endif
-STC_INLINE i_key _cx_memb(_value_clone)(i_key val)
- { return i_keyclone(val); }
+
+#if !defined _i_no_clone
+#if !defined _i_queue
+STC_API _cx_iter _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2);
+
STC_INLINE void _cx_memb(_copy)(_cx_self *self, const _cx_self* other) {
if (self->data == other->data) return;
- _cx_memb(_drop)(self);
- *self = _cx_memb(_clone)(*other);
+ _cx_memb(_clear)(self);
+ _cx_memb(_copy_range_p)(self, self->data, other->data,
+ other->data + cdeq_rep_(other)->size);
}
+#endif // !_i_queue
+STC_API _cx_self _cx_memb(_clone)(_cx_self cx);
+STC_INLINE i_key _cx_memb(_value_clone)(i_key val)
+ { return i_keyclone(val); }
#endif // !_i_no_clone
STC_INLINE size_t _cx_memb(_size)(const _cx_self* cx) { return cdeq_rep_(cx)->size; }
STC_INLINE size_t _cx_memb(_capacity)(const _cx_self* cx) { return cdeq_rep_(cx)->cap; }
@@ -222,6 +226,7 @@ _cx_memb(_clear)(_cx_self* self) {
--q; i_keydrop(q);
}
rep->size = 0;
+ self->data = self->_base;
}
}
@@ -409,8 +414,8 @@ _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos, const _cx_raw* p1, co
#if !defined _i_no_clone
STC_DEF _cx_iter
-_cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2) {
+_cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2) {
_cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
if (it.ref) for (_cx_iter j; p1 != p2; ++p1)
*j.ref++ = i_keyclone((*p1));
diff --git a/include/stc/cvec.h b/include/stc/cvec.h
index 371d6a29..a7828708 100644
--- a/include/stc/cvec.h
+++ b/include/stc/cvec.h
@@ -112,14 +112,15 @@ _cx_memb(_emplace_at)(_cx_self* self, _cx_iter it, _cx_raw raw) {
#if !defined _i_no_clone
STC_API _cx_self _cx_memb(_clone)(_cx_self cx);
-STC_API _cx_iter _cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2);
+STC_API _cx_iter _cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2);
STC_INLINE i_key _cx_memb(_value_clone)(_cx_value val)
{ return i_keyclone(val); }
STC_INLINE void _cx_memb(_copy)(_cx_self* self, const _cx_self* other) {
if (self->data == other->data) return;
- _cx_memb(_drop)(self);
- *self = _cx_memb(_clone)(*other);
+ _cx_memb(_clear)(self);
+ _cx_memb(_copy_range_p)(self, self->data, other->data,
+ other->data + cvec_rep_(other)->size);
}
#endif // !_i_no_clone
@@ -372,19 +373,20 @@ _cx_memb(_clone)(_cx_self cx) {
const size_t len = cvec_rep_(&cx)->size;
_cx_self out = _cx_memb(_with_capacity)(len);
if (cvec_rep_(&out)->cap)
- _cx_memb(_clone_range_p)(&out, out.data, cx.data, cx.data + len);
+ _cx_memb(_copy_range_p)(&out, out.data, cx.data, cx.data + len);
return out;
}
STC_DEF _cx_iter
-_cx_memb(_clone_range_p)(_cx_self* self, _cx_value* pos,
- const _cx_value* p1, const _cx_value* p2) {
+_cx_memb(_copy_range_p)(_cx_self* self, _cx_value* pos,
+ const _cx_value* p1, const _cx_value* p2) {
_cx_iter it = _cx_memb(_insert_uninit_p)(self, pos, p2 - p1);
if (it.ref)
for (_cx_iter j = it; p1 != p2; ++p1)
*j.ref++ = i_keyclone((*p1));
return it;
}
+#endif // !_i_no_clone
#if !defined _i_no_emplace
STC_DEF _cx_iter
@@ -397,7 +399,6 @@ _cx_memb(_emplace_range_p)(_cx_self* self, _cx_value* pos,
return it;
}
#endif // !_i_no_emplace
-#endif // !_i_no_clone
#if !c_option(c_no_cmp)
STC_DEF _cx_iter
diff --git a/include/stc/forward.h b/include/stc/forward.h
index 8a0278a5..264d6939 100644
--- a/include/stc/forward.h
+++ b/include/stc/forward.h
@@ -68,7 +68,7 @@ typedef union {
\
typedef struct { \
SELF##_value* get; \
- long* use_count; \
+ catomic_long* use_count; \
} SELF
#define _c_carr2_types(SELF, VAL) \
diff --git a/include/stc/template.h b/include/stc/template.h
index eeccc39e..4597e02c 100644
--- a/include/stc/template.h
+++ b/include/stc/template.h
@@ -109,9 +109,9 @@
#endif
#elif defined i_key_arcbox
#define i_key_bind i_key_arcbox
- #define i_keyfrom c_paste(i_key_arcbox, _from)
#define i_keyraw c_paste(i_key_arcbox, _value)
- #define i_keyto c_paste(i_key_arcbox, _toval)
+ #define i_keyfrom c_paste(i_key_arcbox, _from)
+ #define i_keyto(x) *(x)->get
#define i_eq c_paste(i_key_arcbox, _value_eq)
#endif
@@ -200,9 +200,9 @@
#define i_valto cstr_sv
#elif defined i_val_arcbox
#define i_val_bind i_val_arcbox
- #define i_valfrom c_paste(i_val_arcbox, _from)
#define i_valraw c_paste(i_val_arcbox, _value)
- #define i_valto c_paste(i_val_arcbox, _toval)
+ #define i_valfrom c_paste(i_val_arcbox, _from)
+ #define i_valto(x) *(x)->get
#endif
#ifdef i_val_bind