diff options
| author | Tyge Løvset <[email protected]> | 2021-12-13 13:53:22 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-12-13 13:53:22 +0100 |
| commit | 17280f8177736c35b34e41556a307ca51e68d1e2 (patch) | |
| tree | 96b0b7dfeede1dc0a6c6f36ec60f18e2ff3bd68a /docs/csview_api.md | |
| parent | c7a26eb5b5fef1c2706d5875a0603d352926487e (diff) | |
| download | STC-modified-17280f8177736c35b34e41556a307ca51e68d1e2.tar.gz STC-modified-17280f8177736c35b34e41556a307ca51e68d1e2.zip | |
Renamed constructor *cstr_lit()* to `cstr_new(lit)`.
Renamed *cstr_assign_fmt()* to `cstr_printf()`.
Renamed cbits_from_str() to cbits_from().
Diffstat (limited to 'docs/csview_api.md')
| -rw-r--r-- | docs/csview_api.md | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/csview_api.md b/docs/csview_api.md index 1376b768..2653dafa 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -25,12 +25,11 @@ All csview definitions and prototypes are available by including a single header ## Methods ```c +csview csview_new(const char literal_only[]); // make csview from literal, no strlen() +csview csview_from_s(cstr s); // same as cstr_sv() csview csview_from(const char* str); // make csview from const char* csview csview_from_n(const char* str, size_t n); // construct -csview csview_from_s(cstr s); // same as cstr_sv() - -csview csview_lit(const char literal_only[]); // make csview from literal, no strlen() -csview c_sv(const char literal_only[]); // same as csview_lit() +csview c_sv(const char literal_only[]); // same as csview_new() size_t csview_size(csview sv); size_t csview_length(csview sv); @@ -104,7 +103,7 @@ uint64_t csview_hash(const csview* x, size_t dummy); int main () { - cstr str1 = cstr_lit("We think in generalities, but we live in details."); + cstr str1 = cstr_new("We think in generalities, but we live in details."); // (quoting Alfred N. Whitehead) csview sv1 = cstr_substr(str1, 3, 5); // "think" @@ -113,7 +112,7 @@ int main () csview sv3 = cstr_slice(str1, -8, -1); // get "details" printf("%.*s %.*s %.*s\n", csview_ARG(sv1), csview_ARG(sv2), csview_ARG(sv3)); - cstr s1 = cstr_lit("Apples are red"); + cstr s1 = cstr_new("Apples are red"); cstr s2 = cstr_from_v(cstr_substr(s1, -3, 3)); // "red" cstr s3 = cstr_from_v(cstr_substr(s1, 0, 6)); // "Apples" printf("%s %s\n", s2, s3.str); |
