diff options
| author | Tyge Løvset <[email protected]> | 2022-04-27 19:46:01 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-04-27 19:46:01 +0200 |
| commit | 163831695b2ad211fc31ffb7410a82cd66a425e9 (patch) | |
| tree | 9b2fdeba17944eadf267d7a770124599674f43bd | |
| parent | edfcc712b48e2a582bcad1bc5a4102f18154e549 (diff) | |
| download | STC-modified-163831695b2ad211fc31ffb7410a82cd66a425e9.tar.gz STC-modified-163831695b2ad211fc31ffb7410a82cd66a425e9.zip | |
Docs only update for carc/cbox.
| -rw-r--r-- | docs/carc_api.md | 10 | ||||
| -rw-r--r-- | docs/cbox_api.md | 4 | ||||
| -rw-r--r-- | include/stc/carc.h | 3 | ||||
| -rw-r--r-- | include/stc/cbox.h | 2 |
4 files changed, 10 insertions, 9 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md index ea5dea1f..8eec043f 100644 --- a/docs/carc_api.md +++ b/docs/carc_api.md @@ -70,7 +70,7 @@ bool carc_X_value_eq(const i_val* x, const i_val* y); // cbox_X_value_c #define i_type Map #define i_key_str // strings #define i_val int -#define i_keydrop(p) (printf(" drop name: %s\n", (p)->str), cstr_drop(p)) +#define i_keydrop(p) (printf(" drop name: %s\n", cstr_str(p)), cstr_drop(p)) #include <stc/csmap.h> #define i_type Arc // (atomic) ref. counted type @@ -97,13 +97,13 @@ int main() { // POPULATE the stack with shared pointers to Map: Map *map; - map = Stack_push(&stack, Arc_from(Map_init()))->get; + map = Stack_push(&stack, Arc_make(Map_init()))->get; c_apply(v, Map_emplace(map, c_pair(v)), Map_raw, { {"Joey", 1990}, {"Mary", 1995}, {"Joanna", 1992} }); - map = Stack_push(&stack, Arc_from(Map_init()))->get; + map = Stack_push(&stack, Arc_make(Map_init()))->get; c_apply(v, Map_emplace(map, c_pair(v)), Map_raw, { {"Rosanna", 2001}, {"Brad", 1999}, @@ -111,7 +111,7 @@ int main() }); // POPULATE the list: - map = List_push_back(&list, Arc_from(Map_init()))->get; + map = List_push_back(&list, Arc_make(Map_init()))->get; c_apply(v, Map_emplace(map, c_pair(v)), Map_raw, { {"Steve", 1979}, {"Rick", 1974}, @@ -124,7 +124,7 @@ int main() // Deep-copy (not share) a Map from the stack to the list // List will contain two shared and two unshared maps. - map = List_push_back(&list, Arc_from(Map_clone(*stack.data[1].get)))->get; + map = List_push_back(&list, Arc_make(Map_clone(*stack.data[1].get)))->get; // Add one more element to the cloned map: Map_emplace_or_assign(map, "Cloned", 2022); diff --git a/docs/cbox_api.md b/docs/cbox_api.md index 266539c6..02b827a3 100644 --- a/docs/cbox_api.md +++ b/docs/cbox_api.md @@ -85,8 +85,8 @@ int main() c_auto (ISet, set) // similar { c_apply(v, IVec_push(&vec, v), IBox, { - IBox_from(2021), IBox_from(2012), - IBox_from(2022), IBox_from(2015), + IBox_make(2021), IBox_make(2012), + IBox_make(2022), IBox_make(2015), }); printf("vec:"); diff --git a/include/stc/carc.h b/include/stc/carc.h index c7c18f53..031c4f56 100644 --- a/include/stc/carc.h +++ b/include/stc/carc.h @@ -37,10 +37,11 @@ void Person_drop(Person* p) { #define i_tag person
#define i_key Person
#define i_keydrop Person_drop
+#define i_opt c_no_cmp
#include <stc/carc.h>
int main() {
- carc_person p = carc_person_from(Person_new("John", "Smiths"));
+ carc_person p = carc_person_make(Person_new("John", "Smiths"));
carc_person q = carc_person_clone(p); // share the pointer
printf("%s %s. uses: %" PRIuMAX "\n", cstr_str(&q.get->name), cstr_str(&q.get->last), *q.use_count);
diff --git a/include/stc/cbox.h b/include/stc/cbox.h index f34888e8..b4b583fa 100644 --- a/include/stc/cbox.h +++ b/include/stc/cbox.h @@ -48,7 +48,7 @@ void Person_drop(Person* p) { int main() {
c_auto (PBox, p, q)
{
- p = PBox_from(Person_from("John Smiths", "[email protected]"));
+ p = PBox_make(Person_from("John Smiths", "[email protected]"));
q = PBox_clone(p);
cstr_assign(&q.get->name, "Joe Smiths");
|
