summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-05-18 10:04:53 +0200
committerTyge Løvset <[email protected]>2021-05-18 10:04:53 +0200
commit60a127bb9a7180d4d30c2b7186456cc1226e812a (patch)
tree615bc0f176dbd22af7d9a269c02793eeceab45cf /docs
parent915ccf1d811ae9a0469cddd8f2dc6370e835e24b (diff)
downloadSTC-modified-60a127bb9a7180d4d30c2b7186456cc1226e812a.tar.gz
STC-modified-60a127bb9a7180d4d30c2b7186456cc1226e812a.zip
Internal updates in cstr. Minor API change in carray carrayNX_with_value() => carrayNX_with_values(). Docs/examples improvements.
Diffstat (limited to 'docs')
-rw-r--r--docs/carray_api.md4
-rw-r--r--docs/cstr_api.md22
2 files changed, 13 insertions, 13 deletions
diff --git a/docs/carray_api.md b/docs/carray_api.md
index 51688fd3..3ae293c3 100644
--- a/docs/carray_api.md
+++ b/docs/carray_api.md
@@ -29,7 +29,7 @@ be replaced by `i` in all of the following documentation.
```c
carray2X carray2X_init(size_t xdim, size_t ydim);
-carray2X carray2X_with_value(size_t xdim, size_t ydim, Value val);
+carray2X carray2X_with_values(size_t xdim, size_t ydim, Value val);
carray2X carray2X_with_storage(size_t xdim, size_t ydim, Value* array);
carray2X carray2X_clone(carray2X arr);
Value* carray2X_release(carray2X* self); // release storage (not freed)
@@ -45,7 +45,7 @@ void carray2X_next(carray2X_iter_t* it);
```
```c
carray3X carray3X_init(size_t xdim, size_t ydim, size_t zdim);
-carray3X carray3X_with_value(size_t xdim, size_t ydim, size_t zdim, Value val);
+carray3X carray3X_with_values(size_t xdim, size_t ydim, size_t zdim, Value val);
carray3X carray3X_with_storage(size_t xdim, size_t ydim, size_t zdim, Value* array);
carray3X carray3X_clone(carray3X arr);
Value* carray3X_release(carray3X* self); // release storage (not freed)
diff --git a/docs/cstr_api.md b/docs/cstr_api.md
index 308c54ab..a2b23a70 100644
--- a/docs/cstr_api.md
+++ b/docs/cstr_api.md
@@ -15,12 +15,12 @@ All cstr definitions and prototypes are available by including a single header f
## Methods
```c
-cstr cstr_init(void); // constructor
-cstr cstr_new(const char literal_only[]); // constructor
+cstr cstr_init(void); // constructor; same as cstr_null.
+cstr cstr_new(const char literal_only[]); // cstr from literal; no strlen().
+cstr cstr_from(const char* str); // constructor using strlen()
+cstr cstr_from_n(const char* str, size_t n); // constructor with specified length
cstr cstr_with_capacity(size_t cap);
cstr cstr_with_size(size_t len, char fill); // repeat fill len times
-cstr cstr_from(const char* str);
-cstr cstr_from_n(const char* str, size_t n);
cstr cstr_from_fmt(const char* fmt, ...); // printf() formatting
cstr cstr_clone(cstr s);
@@ -62,14 +62,14 @@ int cstr_compare(const cstr *s1, const cstr *s2);
bool cstr_equals(cstr s, const char* str);
bool cstr_equals_s(cstr s, cstr s2);
size_t cstr_find(cstr s, const char* substr);
-size_t cstr_find_n(cstr s, const char* substr, size_t pos, size_t n);
-bool cstr_contains(cstr s, const char* substr);
+size_t cstr_find_n(cstr s, const char* needle, size_t pos, size_t nmax);
+bool cstr_contains(cstr s, const char* needle);
bool cstr_begins_with(cstr s, const char* substr);
bool cstr_ends_with(cstr s, const char* substr);
bool cstr_iequals(cstr s, const char* str); // prefix i = case-insensitive
-size_t cstr_ifind_n(cstr s, const char* substr, size_t pos, size_t n);
-bool cstr_icontains(cstr s, const char* substr);
+size_t cstr_ifind_n(cstr s, const char* needle, size_t pos, size_t nmax);
+bool cstr_icontains(cstr s, const char* needle);
bool cstr_ibegins_with(cstr s, const char* substr);
bool cstr_iends_with(cstr s, const char* substr);
@@ -96,8 +96,8 @@ int c_rawstr_compare(const char** x, const char** y);
bool c_rawstr_equals(const char** x, const char** y);
uint64_t c_rawstr_hash(const char* const* x, size_t ignored);
int c_strncasecmp(const char* str1, const char* str2, size_t n);
-char* c_strnstr(const char* str, const char* needle, size_t n);
-char* c_strncasestr(const char* str, const char* needle, size_t n);
+char* c_strnstrn(const char* str, const char* needle, size_t slen, size_t nmax);
+char* c_strncasestrn(const char* str, const char* needle, size_t slen, size_t nmax);
```
## Types
@@ -113,7 +113,7 @@ char* c_strncasestr(const char* str, const char* needle, size_t n);
| Name | Value |
|:------------------|:------------------|
| `cstr_npos` | `((size_t) -1)` |
-| `cstr_null | cstr null value |
+| `cstr_null` | cstr null value |
## Example
```c