summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-12-03 10:13:02 +0100
committerTyge Løvset <[email protected]>2020-12-03 10:13:02 +0100
commit2afda956b19186c6f4306d43429948a6f7f40d07 (patch)
tree8ba57b84dfe6e480452698517d95c993991fe73c
parent6ed9779a437d4ba439b1e1301d2e5f1e0eaefb7c (diff)
downloadSTC-modified-2afda956b19186c6f4306d43429948a6f7f40d07.tar.gz
STC-modified-2afda956b19186c6f4306d43429948a6f7f40d07.zip
Simplified type sections.
-rw-r--r--docs/carray_api.md5
-rw-r--r--docs/cbitset_api.md8
-rw-r--r--docs/clist_api.md12
-rw-r--r--docs/cmap_api.md35
-rw-r--r--docs/cpqueue_api.md2
-rw-r--r--docs/cqueue_api.md2
-rw-r--r--docs/crandom_api.md18
-rw-r--r--docs/cset_api.md16
-rw-r--r--docs/cstack_api.md2
-rw-r--r--docs/cstr_api.md8
-rw-r--r--docs/cvec_api.md18
-rw-r--r--stc/cvec.h2
12 files changed, 48 insertions, 80 deletions
diff --git a/docs/carray_api.md b/docs/carray_api.md
index d2387f39..c8364b75 100644
--- a/docs/carray_api.md
+++ b/docs/carray_api.md
@@ -18,10 +18,7 @@ be replaced by `my` in all of the following documentation. The `#` character sho
| Type name | Type definition | Used to represent... |
|:---------------------|:------------------------------|:--------------------------|
-| `carray#X` | `struct {` | The carray type |
-| | ` carray#X_value_t* data;` | |
-| | ` ...;` | |
-| | `}` | |
+| `carray#X` | `struct { ... }` | The carray type |
| `carray#X_value_t` | `Value` | The value type |
| `carray#X_iter_t` | `struct { Value *val; }` | Iterator type |
diff --git a/docs/cbitset_api.md b/docs/cbitset_api.md
index a22d6f2f..74e72f14 100644
--- a/docs/cbitset_api.md
+++ b/docs/cbitset_api.md
@@ -4,10 +4,10 @@ This describes the API of string type **cbitset**.
## Types
-| cbitset | Type definition | Used to represent... |
-|:----------------------|:------------------------------------------|:-------------------------------------|
-| `cbitset_t` | `struct { uint64_t* _arr; size_t size; }` | The cbitset type |
-| `cbitset_iter_t` | `struct { cbitset_t *_bs; size_t val; }` | The cbitset iterator type |
+| cbitset | Type definition | Used to represent... |
+|:----------------------|:--------------------------|:-------------------------------------|
+| `cbitset_t` | `struct { ... }` | The cbitset type |
+| `cbitset_iter_t` | `struct { ... }` | The cbitset iterator type |
## Header file
diff --git a/docs/clist_api.md b/docs/clist_api.md
index a6b88626..64ee4c1f 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -27,17 +27,11 @@ using_clist(str, cstr_t, cstr_del, cstr_compare_raw, const char*, cstr_to_raw, c
| Type name | Type definition | Used to represent... |
|:----------------------|:---------------------------------------|:------------------------------------|
| `clist_X` | `struct { clist_X_node_t* last; }` | The clist type |
-| `clist_X_node_t` | `struct {` | clist node |
-| | ` struct clist_X_node* next;` | |
-| | ` clist_X_value_t value;` | |
-| | `}` | |
+| `clist_X_node_t` | `struct { ... }` | clist node |
| `clist_X_value_t` | `Value` | The clist element type |
| `clist_X_input_t` | `clist_X_value_t` | clist input type |
| `clist_X_rawvalue_t` | `RawValue` | clist raw value type |
-| `clist_X_iter_t` | `struct {` | clist iterator |
-| | ` clist_X_value_t* val;` | |
-| | ` ...;` | |
-| | `}` | |
+| `clist_X_iter_t` | `struct { ... }` | clist iterator |
## Constants and macros
@@ -96,8 +90,8 @@ size_t clist_X_remove(clist_X* self, RawValue val);
void clist_X_sort(clist_X* self);
clist_X_iter_t clist_X_before_begin(const clist_X* self);
-clist_X_iter_t clist_X_begin(const clist_X* self);
clist_X_iter_t clist_X_last(const clist_X* self);
+clist_X_iter_t clist_X_begin(const clist_X* self);
clist_X_iter_t clist_X_end(const clist_X* self);
void clist_X_next(clist_X_iter_t* it);
clist_X_value_t* clist_X_itval(clist_X_iter_t it);
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index 2fe5a830..b38eace2 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -42,38 +42,25 @@ using_cmap(str, cstr_t, cstr_t, cstr_del, cstr_equals_raw, cstr_hash_raw,
| Type name | Type definition | Used to represent... |
|:---------------------|:--------------------------------------|:-----------------------------------|
-| `cmap_X` | `struct {` | The cmap type |
-| | ` cmap_X_value_t* table;` | |
-| | ` uint8_t* _hashx;` | |
-| | ` ...;` | |
-| | `}` | |
+| `cmap_X` | `struct { ... }` | The cmap type |
| `cmap_X_rawkey_t` | `RawKey` | The raw key type |
| `cmap_X_rawval_t` | `RawMapped` | The raw mapped type |
| `cmap_X_key_t` | `Key` | The key type |
| `cmap_X_mapped_t` | `Mapped` | The mapped type |
-| `cmap_X_value_t` | `struct {` | The value type |
-| | ` cmap_X_key_t first;` | |
-| | ` cmap_X_mapped_t second;` | |
-| | `}` | |
+| `cmap_X_value_t` | `struct { ... }` | The value type |
| `cmap_X_input_t` | `struct { ... }` | RawKey + RawVal type |
-| `cmap_X_result_t` | `struct {` | Result of insert/put/emplace |
-| | ` cmap_X_value_t* first;` | |
-| | ` bool second; /* inserted */` | |
-| | `}` | |
-| `cmap_X_iter_t` | `struct {` | Iterator type |
-| | ` cmap_X_value_t* val;` | |
-| | ` ...;` | |
-| | `}` | |
+| `cmap_X_result_t` | `struct { ... }` | Result of insert/put/emplace |
+| `cmap_X_iter_t` | `struct { ... }` | Iterator type |
## Constants and macros
-| Name | Purpose |
-|:------------------------------------------------|:-----------------------|
-| `cmap_inits` | Initializer const |
-| `cmap_empty(map)` | Test for empty map |
-| `cmap_size(map)` | Get map size |
-| `cmap_capacity(map)` | Get map capacity |
-| `c_try_emplace(self, ctype, key, val)` | Emplace if key exist |
+| Name | Purpose |
+|:-----------------------------------------|:-----------------------|
+| `cmap_inits` | Initializer const |
+| `cmap_empty(map)` | Test for empty map |
+| `cmap_size(map)` | Get map size |
+| `cmap_capacity(map)` | Get map capacity |
+| `c_try_emplace(self, ctype, key, val)` | Emplace if key exist |
## Header file
diff --git a/docs/cpqueue_api.md b/docs/cpqueue_api.md
index 1b0ad6ca..90623de9 100644
--- a/docs/cpqueue_api.md
+++ b/docs/cpqueue_api.md
@@ -17,7 +17,7 @@ will affect the names of all cpqueue types and methods. E.g. declaring `using_cp
| Type name | Type definition | Used to represent... |
|:-----------------------|:---------------------------------------|:------------------------------------|
-| `cpqueue_X` | Depending on underlying container type | The cpqueue type |
+| `cpqueue_X` | Depends on underlying container type | The cpqueue type |
| `cpqueue_X_value_t` | | The cpqueue element type |
| `cpqueue_X_input_t` | | cpqueue input type |
| `cpqueue_X_rawvalue_t` | | cpqueue raw value type |
diff --git a/docs/cqueue_api.md b/docs/cqueue_api.md
index b54c0810..9b552653 100644
--- a/docs/cqueue_api.md
+++ b/docs/cqueue_api.md
@@ -17,7 +17,7 @@ will affect the names of all cqueue types and methods. E.g. declaring `using_cqu
| Type name | Type definition | Used to represent... |
|:----------------------|:---------------------------------------|:------------------------------------|
-| `cqueue_X` | Depending on underlying container type | The cqueue type |
+| `cqueue_X` | Depends on underlying container type | The cqueue type |
| `cqueue_X_value_t` | | The cqueue element type |
| `cqueue_X_input_t` | | cqueue input type |
| `cqueue_X_rawvalue_t` | | cqueue raw value type |
diff --git a/docs/crandom_api.md b/docs/crandom_api.md
index f066197e..87bddcef 100644
--- a/docs/crandom_api.md
+++ b/docs/crandom_api.md
@@ -5,15 +5,15 @@ The RNG's can generate uniform and normal distributions.
## Types
-| crandom | Type definition | Used to represent... |
-|:----------------------|:-----------------------------------------------------|:-------------------------------------|
-| `crand_rng32_t` | `struct {uint64_t state[2];}` | The crandom type |
-| `crand_uniform_i32_t` | `struct {int32_t offset; uint32_t range;}` | The crandom element type |
-| `crand_uniform_f32_t` | `struct {float offset, range;}` | crandom iterator |
-| `crand_rng64_t` | `struct {uint64_t state[4];}` | |
-| `crand_uniform_i64_t` | `struct {int64_t offset; uint64_t range;}` | |
-| `crand_uniform_f64_t` | `struct {double offset, range;}` | |
-| `crand_normal_f64_t` | `struct {double mean, stddev, next; bool has_next;}` | |
+| crandom | Type definition | Used to represent... |
+|:----------------------|:--------------------------------------------|:-------------------------------------|
+| `crand_rng32_t` | `struct {uint64_t state[2];}` | The crandom type |
+| `crand_uniform_i32_t` | `struct {int32_t offset; uint32_t range;}` | The crandom element type |
+| `crand_uniform_f32_t` | `struct {float offset, range;}` | crandom iterator |
+| `crand_rng64_t` | `struct {uint64_t state[4];}` | |
+| `crand_uniform_i64_t` | `struct {int64_t offset; uint64_t range;}` | |
+| `crand_uniform_f64_t` | `struct {double offset, range;}` | |
+| `crand_normal_f64_t` | `struct {double mean, stddev, ...;}` | |
## Header file
diff --git a/docs/cset_api.md b/docs/cset_api.md
index 970276e9..3a5d7fa7 100644
--- a/docs/cset_api.md
+++ b/docs/cset_api.md
@@ -26,23 +26,13 @@ be replaced by `my` in all of the following documentation.
| Type name | Type definition | Used to represent... |
|:---------------------|:--------------------------------------|:-----------------------------------|
-| `cset_X` | `struct {` | The cset type |
-| | ` cset_X_value_t* table;` | |
-| | ` uint8_t* _hashx;` | |
-| | ` ...;` | |
-| | `}` | |
+| `cset_X` | `struct { ... }` | The cset type |
| `cset_X_rawkey_t` | `RawKey` | The raw key type |
| `cset_X_key_t` | `Key` | The key type |
| `cset_X_value_t` | `Key` | The value type |
-| `cset_X_result_t` | `struct {` | Result of insert/emplace |
-| | ` cset_X_value_t* first;` | |
-| | ` bool second; /* inserted */` | |
-| | `}` | |
+| `cset_X_result_t` | `struct { ... }` | Result of insert/emplace |
| `cset_X_input_t` | `cset_X_rawkey_t` | The input type (rawkey) |
-| `cset_X_iter_t` | `struct {` | Iterator type |
-| | ` cset_X_value_t* val;` | |
-| | ` ...;` | |
-| | `}` | |
+| `cset_X_iter_t` | `struct { ... }` | Iterator type |
## Constants and macros
diff --git a/docs/cstack_api.md b/docs/cstack_api.md
index 783b1cf9..9cbd9d58 100644
--- a/docs/cstack_api.md
+++ b/docs/cstack_api.md
@@ -17,7 +17,7 @@ will affect the names of all cstack types and methods. E.g. declaring `using_cst
| Type name | Type definition | Used to represent... |
|:----------------------|:---------------------------------------|:------------------------------------|
-| `cstack_X` | Depending on underlying container type | The cstack type |
+| `cstack_X` | Depends on underlying container type | The cstack type |
| `cstack_X_value_t` | | The cstack element type |
| `cstack_X_input_t` | | cstack input type |
| `cstack_X_rawvalue_t` | | cstack raw value type |
diff --git a/docs/cstr_api.md b/docs/cstr_api.md
index aa7ec53d..93680c71 100644
--- a/docs/cstr_api.md
+++ b/docs/cstr_api.md
@@ -12,10 +12,10 @@ This describes the API of string type **cstr_t**.
## Constants and macros
-| Name | Value |
-|:---------------------------|:-----------------|
-| `cstr_inits` | `{...}` |
-| `cstr_npos` | `-1ull` |
+| Name | Value |
+|:---------------- -|:-----------------|
+| `cstr_inits` | `{...}` |
+| `cstr_npos` | `-1ull` |
## Header file
diff --git a/docs/cvec_api.md b/docs/cvec_api.md
index fe820526..9660f540 100644
--- a/docs/cvec_api.md
+++ b/docs/cvec_api.md
@@ -24,13 +24,13 @@ using_cvec(str, cstr_t, cstr_del, cstr_compare_raw, const char*, cstr_to_raw, cs
## Types
-| Type name | Type definition | Used to represent... |
-|:---------------------|:---------------------------------------|:------------------------------------|
-| `cvec_X` | `struct { cvec_X_value_t* data; }` | The cvec type |
-| `cvec_X_value_t` | `Value` | The cvec value type |
-| `cvec_X_input_t` | `cvec_X_value_t` | The input type |
-| `cvec_X_rawvalue_t` | `RawValue` | The raw value type |
-| `cvec_X_iter_t` | `struct { cvec_X_value_t* val; }` | The iterator |
+| Type name | Type definition | Used to represent... |
+|:---------------------|:------------------------------------|:-----------------------|
+| `cvec_X` | `struct { cvec_X_value_t* data; }` | The cvec type |
+| `cvec_X_value_t` | `Value` | The cvec value type |
+| `cvec_X_input_t` | `cvec_X_value_t` | The input type |
+| `cvec_X_rawvalue_t` | `RawValue` | The raw value type |
+| `cvec_X_iter_t` | `struct { cvec_X_value_t* val; }` | The iterator |
## Constants and macros
@@ -101,10 +101,10 @@ void cvec_X_sort_with(cvec_X* self, size_t ifirst, size_t ifinish
int(*cmp)(const cvec_X_value_t*, const cvec_X_value_t*));
cvec_X_iter_t cvec_X_begin(const cvec_X* self);
-cvec_X_iter_t cvec_X_last(const cvec_X* self);
cvec_X_iter_t cvec_X_end(const cvec_X* self);
void cvec_X_next(cvec_X_iter_t* it);
cvec_X_value_t* cvec_X_itval(cvec_X_iter_t it);
+size_t cvec_X_index(const cvec_X vec, cvec_X_iter_t it);
```
## Examples
@@ -159,7 +159,7 @@ int main() {
cstr_t tmp = cstr_from_fmt("%d elements so far", cvec_str_size(names));
- // Emplace_back() will not compile when adding a new cstr_t type. Use push_back():
+ // emplace_back() will not compile if adding a new cstr_t type. Use push_back():
cvec_str_push_back(&names, tmp); // tmp is moved to names, do not del() it.
printf("%s\n", names.data[1].str); // Access the second element
diff --git a/stc/cvec.h b/stc/cvec.h
index 00e4b6c9..d6c66751 100644
--- a/stc/cvec.h
+++ b/stc/cvec.h
@@ -184,7 +184,7 @@
STC_INLINE cvec_##X##_value_t* \
cvec_##X##_itval(cvec_##X##_iter_t it) {return it.val;} \
STC_INLINE size_t \
- cvec_##X##_idx(cvec_##X v, cvec_##X##_iter_t it) {return it.val - v.data;} \
+ cvec_##X##_index(cvec_##X v, cvec_##X##_iter_t it) {return it.val - v.data;} \
\
_c_implement_cvec_7(X, Value, valueDestroy, RawValue, valueCompareRaw, valueToRaw, valueFromRaw) \
typedef cvec_##X cvec_##X##_t