summaryrefslogtreecommitdiffhomepage
path: root/docs/clist_api.md
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-11-30 15:18:26 +0100
committerTyge Løvset <[email protected]>2020-11-30 15:18:26 +0100
commit479c68a7946e5a07648ff2d716f4f61837f595d1 (patch)
treeda57a51af7983e4e9702b28802ea92485833989c /docs/clist_api.md
parentc7253fa4c12adf0639c1ed3a0cd2b2ea28ee194f (diff)
downloadSTC-modified-479c68a7946e5a07648ff2d716f4f61837f595d1.tar.gz
STC-modified-479c68a7946e5a07648ff2d716f4f61837f595d1.zip
Added cvec api docs.
Diffstat (limited to 'docs/clist_api.md')
-rw-r--r--docs/clist_api.md113
1 files changed, 57 insertions, 56 deletions
diff --git a/docs/clist_api.md b/docs/clist_api.md
index d30c5338..5d6f789d 100644
--- a/docs/clist_api.md
+++ b/docs/clist_api.md
@@ -2,47 +2,49 @@
UNDER CONSTRUCTION!
-This describes the API of string type **clist_xx**.
+This describes the API of circular singly linked list type **clist**.
## Instantiation
```c
-#define using_clist(xx, Value, ...)
-
#define using_clist_str()
-#define using_clist(xx, Value, valueDestroy=c_default_del,
+#define using_clist(z, Value, valueDestroy=c_default_del,
valueCompareRaw=c_default_compare,
RawValue=Value,
valueToRaw=c_default_to_raw,
valueFromRaw=c_default_from_raw)
```
The macro `using_clist()` can be instantiated with 2, 3, 4, or 7 arguments. Defaults are given above for args not specified.
-Note that xx can be any name, it's a tag and will affect the names of all clist types and methods,
-e.g. for `using_clist(my, int);` 'xx' should be replaced by 'my' in all the following.
-`using_clist_str()` is a predefined definition of clist_using(str, cstr_t, ...).
+Note that `z` can be any name, it's a tag and will affect the names of all clist types and methods,
+e.g. for `using_clist(my, int);` `_z` should be replaced by `_my` in all the following documentation.
+`using_clist_str()` is a predefined macro for `clist_using(str, cstr_t, ...)`.
## Types
-| cstr | Type definition | Used to represent... |
+| Type name | Type definition | Used to represent... |
|:----------------------|:---------------------------------------|:------------------------------------|
-| `clist_xx` | `struct { clist_xx_node_t* last; }` | The clist type |
-| `clist_xx_node_t` | `struct {` | |
-| | ` struct clist_xx_node* next;` | |
-| | ` clist_xx_value_t value;` | |
-| | `}` | clist node |
-| `clist_xx_value_t` | `Value` | The clist element type |
-| `clist_xx_iter_t` | `struct {` | |
-| | ` clist_xx_node_t* const* _last;` | |
-| | ` clist_xx_value_t* val;` | |
-| | ` int _state;` | |
-| | `}` | clist iterator |
-
-## Constants
-
-| cstr constant name | Numerical values |
+| `clist_z` | `struct { clist_z_node_t* last; }` | The clist type |
+| `clist_z_node_t` | `struct {` | clist node |
+| | ` struct clist_z_node* next;` | |
+| | ` clist_z_value_t value;` | |
+| | `}` | |
+| `clist_z_value_t` | `Value` | The clist element type |
+| `clist_z_input_t` | `clist_z_value_t` | clist input type |
+| `clist_z_rawvalue_t` | `RawValue` | clist raw value type |
+| `clist_z_iter_t` | `struct {` | clist iterator |
+| | ` clist_z_node_t* const* _...;` | |
+| | ` clist_z_value_t* val;` | |
+| | ` int _...;` | |
+| | `}` | |
+
+
+## Constants and macros
+
+| Name | Value |
|:---------------------------|:-----------------|
| `clist_inits` | `{NULL}` |
+| `clist_empty(list)` | `true` if empty |
## Header file
@@ -55,50 +57,49 @@ All clist definitions and prototypes may be included in your C source file by in
### Construction
-The interfaces to create a clist_xx object:
+The interfaces to create a clist_z object:
```c
-clist_xx clist_xx_init(void);
-bool clist_xx_empty(clist_xx ls);
-size_t clist_xx_size(clist_xx ls);
-
-void clist_xx_clear(clist_xx* self);
-void clist_xx_del(clist_xx* self);
+clist_z clist_z_init(void);
-Value clist_xx_value_from_raw(RawValue rawValue);
+void clist_z_clear(clist_z* self);
+void clist_z_del(clist_z* self);
-void clist_xx_push_n(clist_xx *self, const clist_xx_input_t in[], size_t size);
-void clist_xx_push_back(clist_xx* self, Value value);
-void clist_xx_emplace_back(clist_xx* self, RawValue rawValue);
+bool clist_z_empty(clist_z list);
+size_t clist_z_size(clist_z list);
+Value clist_z_value_from_raw(RawValue val);
-void clist_xx_push_front(clist_xx* self, Value value);
-void clist_xx_emplace_front(clist_xx* self, RawValue rawValue);
+void clist_z_push_n(clist_z *self, const clist_z_input_t in[], size_t size);
+void clist_z_push_back(clist_z* self, Value value);
+void clist_z_emplace_back(clist_z* self, RawValue val);
-void clist_xx_pop_front(clist_xx* self);
+void clist_z_push_front(clist_z* self, Value value);
+void clist_z_emplace_front(clist_z* self, RawValue val);
+void clist_z_pop_front(clist_z* self);
-clist_xx_iter_t clist_xx_insert_after(clist_xx* self, clist_xx_iter_t pos, Value value);
-clist_xx_iter_t clist_xx_emplace_after(clist_xx* self, clist_xx_iter_t pos, RawValue rawValue);
+clist_z_iter_t clist_z_insert_after(clist_z* self, clist_z_iter_t pos, Value val);
+clist_z_iter_t clist_z_emplace_after(clist_z* self, clist_z_iter_t pos, RawValue val);
-clist_xx_iter_t clist_xx_erase_after(clist_xx* self, clist_xx_iter_t pos);
-clist_xx_iter_t clist_xx_erase_range_after(clist_xx* self, clist_xx_iter_t pos, clist_xx_iter_t finish);
+clist_z_iter_t clist_z_erase_after(clist_z* self, clist_z_iter_t pos);
+clist_z_iter_t clist_z_erase_range_after(clist_z* self, clist_z_iter_t pos, clist_z_iter_t finish);
-void clist_xx_splice_front(clist_xx* self, clist_xx* other);
-void clist_xx_splice_back(clist_xx* self, clist_xx* other);
-void clist_xx_splice_after(clist_xx* self, clist_xx_iter_t pos, clist_xx* other);
+void clist_z_splice_front(clist_z* self, clist_z* other);
+void clist_z_splice_back(clist_z* self, clist_z* other);
+void clist_z_splice_after(clist_z* self, clist_z_iter_t pos, clist_z* other);
-clist_xx_iter_t clist_xx_find(const clist_xx* self, RawValue val);
-clist_xx_iter_t clist_xx_find_before(const clist_xx* self, clist_xx_iter_t first, clist_xx_iter_t finish, RawValue val);
+clist_z_iter_t clist_z_find(const clist_z* self, RawValue val);
+clist_z_iter_t clist_z_find_before(const clist_z* self, clist_z_iter_t first, clist_z_iter_t finish, RawValue val);
-size_t clist_xx_remove(clist_xx* self, RawValue val);
+size_t clist_z_remove(clist_z* self, RawValue val);
-void clist_xx_sort(clist_xx* self);
+void clist_z_sort(clist_z* self);
-Value* clist_xx_front(clist_xx* self);
-Value* clist_xx_back(clist_xx* self);
+Value* clist_z_front(clist_z* self);
+Value* clist_z_back(clist_z* self);
-clist_xx_iter_t clist_xx_before_begin(const clist_xx* self);
-clist_xx_iter_t clist_xx_begin(const clist_xx* self);
-clist_xx_iter_t clist_xx_last(const clist_xx* self);
-clist_xx_iter_t clist_xx_end(const clist_xx* self);
-void clist_xx_next(clist_xx_iter_t* it);
-clist_xx_value_t* clist_xx_itval(clist_xx_iter_t it);
+clist_z_iter_t clist_z_before_begin(const clist_z* self);
+clist_z_iter_t clist_z_begin(const clist_z* self);
+clist_z_iter_t clist_z_last(const clist_z* self);
+clist_z_iter_t clist_z_end(const clist_z* self);
+void clist_z_next(clist_z_iter_t* it);
+clist_z_value_t* clist_z_itval(clist_z_iter_t it);
```