From cf2ff10878153588b69e7e34523773e2bc42d79e Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 24 Oct 2022 12:23:30 +0200 Subject: API CHANGE: Renamed input params for naming consisteny and usage: i_key_class TYPE => i_keyclass TYPE i_val_class TYPE => i_valclass TYPE i_key_arcbox TYPE => i_keyboxed TYPE i_val_arcbox TYPE => i_valboxed TYPE i_key_bind, i_val_bind are removed. --- examples/arc_containers.c | 4 ++-- examples/arc_demo.c | 4 ++-- examples/arcvec_erase.c | 2 +- examples/box.c | 4 ++-- examples/box2.c | 2 +- examples/city.c | 6 +++--- examples/complex.c | 6 +++--- examples/forfilter.c | 2 +- examples/mapmap.c | 2 +- examples/mmap.c | 2 +- examples/multimap.c | 4 ++-- examples/music_arc.c | 4 ++-- examples/new_sptr.c | 6 +++--- examples/person_arc.c | 4 ++-- examples/rawptr_elements.c | 2 +- examples/vikings.c | 4 ++-- 16 files changed, 29 insertions(+), 29 deletions(-) (limited to 'examples') diff --git a/examples/arc_containers.c b/examples/arc_containers.c index 6e6f748f..5a8b3653 100644 --- a/examples/arc_containers.c +++ b/examples/arc_containers.c @@ -16,11 +16,11 @@ #include #define i_type Stack -#define i_val_arcbox Arc // define i_val_arcbox for carc/cbox value (not i_val) +#define i_valboxed Arc // define i_valboxed for carc/cbox value (not i_val) #include #define i_type List -#define i_val_arcbox Arc // as above +#define i_valboxed Arc // as above #include int main() diff --git a/examples/arc_demo.c b/examples/arc_demo.c index c282bdbd..087f90ac 100644 --- a/examples/arc_demo.c +++ b/examples/arc_demo.c @@ -13,10 +13,10 @@ void int_drop(int* x) { #define i_valdrop int_drop // optional, just to display the elements destroyed #include // Arc -#define i_key_arcbox Arc // note: use i_key_arcbox instead of i_key for carc/cbox elements +#define i_keyboxed Arc // note: use i_keyboxed instead of i_key for carc/cbox elements #include // csset_Arc (like: std::set>) -#define i_val_arcbox Arc // note: as above. +#define i_valboxed Arc // note: as above. #include // cvec_Arc (like: std::vector>) int main() diff --git a/examples/arcvec_erase.c b/examples/arcvec_erase.c index 6990c94a..c70d59d9 100644 --- a/examples/arcvec_erase.c +++ b/examples/arcvec_erase.c @@ -9,7 +9,7 @@ void show_drop(int* x) { printf("drop: %d\n", *x); } #include // Shared pointer to int #define i_type Vec -#define i_val_arcbox Arc +#define i_valboxed Arc #include // Vec: cvec diff --git a/examples/box.c b/examples/box.c index c95b2cb7..da13501f 100644 --- a/examples/box.c +++ b/examples/box.c @@ -28,11 +28,11 @@ void Person_drop(Person* p) { } #define i_type PBox -#define i_val_class Person // "class" binds _cmp, _clone, _drop functions. +#define i_valclass Person // "class" binds _cmp, _clone, _drop functions. #include #define i_type Persons -#define i_val_arcbox PBox // "arcbox" informs that PBox is a smart pointer. +#define i_valboxed PBox // "arcbox" informs that PBox is a smart pointer. #include int main() diff --git a/examples/box2.c b/examples/box2.c index 2413e3fe..f64eb239 100644 --- a/examples/box2.c +++ b/examples/box2.c @@ -24,7 +24,7 @@ struct { #include // cbox_Rectangle // Box in box: -#define i_val_arcbox cbox_Point // NB: use i_val_arcbox when value is a cbox or carc! +#define i_valboxed cbox_Point // NB: use i_valboxed when value is a cbox or carc! // it will auto define i_valdrop, i_valfrom, and i_cmp. #define i_tag BoxPoint #include // cbox_BoxPoint diff --git a/examples/city.c b/examples/city.c index 891e08f8..0996fe9b 100644 --- a/examples/city.c +++ b/examples/city.c @@ -13,17 +13,17 @@ City City_clone(City c); void City_drop(City* c); #define i_type CityArc -#define i_val_class City +#define i_valclass City #include //#include // try instead of cbox.h #define i_type Cities -#define i_key_arcbox CityArc +#define i_keyboxed CityArc #include #define i_type CityMap #define i_key int -#define i_val_arcbox CityArc +#define i_valboxed CityArc #include diff --git a/examples/complex.c b/examples/complex.c index c91f95d5..dd2f951a 100644 --- a/examples/complex.c +++ b/examples/complex.c @@ -14,18 +14,18 @@ #include #define i_type StackList -#define i_val_class FloatStack // "class" picks up _clone, _drop +#define i_valclass FloatStack // "class" picks up _clone, _drop #define i_opt c_no_cmp // no FloatStack_cmp() #include #define i_type ListMap #define i_key int -#define i_val_class StackList // "class" picks up _clone, _drop +#define i_valclass StackList // "class" picks up _clone, _drop #include #define i_type MapMap #define i_key_str -#define i_val_class ListMap +#define i_valclass ListMap #include diff --git a/examples/forfilter.c b/examples/forfilter.c index e1a3f1e5..cc7c3478 100644 --- a/examples/forfilter.c +++ b/examples/forfilter.c @@ -9,7 +9,7 @@ #include #define i_type SVec -#define i_val_class csview +#define i_valclass csview #include // filters and transforms: diff --git a/examples/mapmap.c b/examples/mapmap.c index 99f5e58d..488cc539 100644 --- a/examples/mapmap.c +++ b/examples/mapmap.c @@ -12,7 +12,7 @@ // Departments: std::map #define i_type Departments #define i_key_str -#define i_val_class People +#define i_valclass People // Shorthand for: // #define i_val People // #define i_cmp People_cmp diff --git a/examples/mmap.c b/examples/mmap.c index 6fe041e4..3934cf26 100644 --- a/examples/mmap.c +++ b/examples/mmap.c @@ -11,7 +11,7 @@ // Map of int => clist_str. #define i_type Multimap #define i_key int -#define i_val_class clist_str // uses clist_str as i_val and binds clist_str_clone, clist_str_drop +#define i_valclass clist_str // uses clist_str as i_val and binds clist_str_clone, clist_str_drop #define i_cmp -c_default_cmp // like std::greater #include diff --git a/examples/multimap.c b/examples/multimap.c index f8c5b6c2..e72bdce3 100644 --- a/examples/multimap.c +++ b/examples/multimap.c @@ -39,14 +39,14 @@ OlympicLocation OlympicLocation_clone(OlympicLocation loc); void OlympicLocation_drop(OlympicLocation* self); // Create a clist, can be sorted by year. -#define i_val_class OlympicLocation // binds _cmp, _clone and _drop. +#define i_valclass OlympicLocation // binds _cmp, _clone and _drop. #define i_tag OL #define i_extern // define _clist_mergesort() #include // Create a csmap where key is country name #define i_key_str // binds cstr_equ, cstr_hash, cstr_clone, ++ -#define i_val_class clist_OL // binds clist_OL_clone, clist_OL_drop +#define i_valclass clist_OL // binds clist_OL_clone, clist_OL_drop #define i_tag OL #include diff --git a/examples/music_arc.c b/examples/music_arc.c index 0fb0dd70..162c4c2f 100644 --- a/examples/music_arc.c +++ b/examples/music_arc.c @@ -21,13 +21,13 @@ void Song_drop(Song* s) { // Define the reference counted type #define i_type SongArc -#define i_val_class Song +#define i_valclass Song #define i_opt c_no_hash #include // ... and a vector of it #define i_type SongVec -#define i_val_arcbox SongArc +#define i_valboxed SongArc #include void example3() diff --git a/examples/new_sptr.c b/examples/new_sptr.c index c4c9f7f5..2c6b28d6 100644 --- a/examples/new_sptr.c +++ b/examples/new_sptr.c @@ -8,7 +8,7 @@ int Person_cmp(const Person* a, const Person* b); uint64_t Person_hash(const Person* p); #define i_type PersonArc -#define i_val_class Person // "class" ensure Person_drop will be called +#define i_valclass Person // "class" ensure Person_drop will be called #define i_cmp Person_cmp // enable carc object comparisons (not ptr to obj) #define i_hash Person_hash // enable carc object hash (not ptr to obj) #include @@ -19,11 +19,11 @@ uint64_t Person_hash(const Person* p); #include #define i_type IPStack -#define i_val_arcbox IPtr +#define i_valboxed IPtr #include #define i_type PASet -#define i_val_arcbox PersonArc +#define i_valboxed PersonArc #include diff --git a/examples/person_arc.c b/examples/person_arc.c index 26bdd44d..a7bf2a6f 100644 --- a/examples/person_arc.c +++ b/examples/person_arc.c @@ -28,12 +28,12 @@ void Person_drop(Person* p) { } #define i_type PSPtr -#define i_val_class Person // ensure Person_drop +#define i_valclass Person // ensure Person_drop #define i_cmp Person_cmp // specify object cmp, instead of ptr cmp for arc. #include #define i_type Persons -#define i_val_arcbox PSPtr // binds PSPtr_cmp, PSPtr_drop... +#define i_valboxed PSPtr // binds PSPtr_cmp, PSPtr_drop... #include diff --git a/examples/rawptr_elements.c b/examples/rawptr_elements.c index bae314fd..095357ca 100644 --- a/examples/rawptr_elements.c +++ b/examples/rawptr_elements.c @@ -23,7 +23,7 @@ typedef int64_t inttype; #define i_type SIBoxMap #define i_key_str -#define i_val_arcbox IBox +#define i_valboxed IBox #include int main() diff --git a/examples/vikings.c b/examples/vikings.c index 1cfcf72e..fc73f438 100644 --- a/examples/vikings.c +++ b/examples/vikings.c @@ -32,7 +32,7 @@ static inline RViking Viking_toraw(const Viking* vp) { // With this in place, we define the Viking => int hash map type: #define i_type Vikings -#define i_key_class Viking // key type +#define i_keyclass Viking // key type #define i_keyraw RViking // lookup type #define i_keyfrom Viking_from #define i_opt c_no_clone @@ -40,7 +40,7 @@ static inline RViking Viking_toraw(const Viking* vp) { #define i_val int // mapped type #include /* - i_key_class implies these defines, unless they are already defined: + i_keyclass implies these defines, unless they are already defined: i_cmp => RViking_cmp //i_hash => RViking_hash // already defined. //i_keyclone => Viking_clone // not used, because of c_no_clone -- cgit v1.2.3