summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-19 09:04:23 +0100
committerTyge Løvset <[email protected]>2022-12-19 09:04:23 +0100
commit1d4ad83d6f3388982cb0aeadbc9815b4776df504 (patch)
tree6d0d389219644b127eaa83c8a54ccd93deef96b7 /docs
parent26a75a218a115a10cee82534be568a606c83dbb2 (diff)
downloadSTC-modified-1d4ad83d6f3388982cb0aeadbc9815b4776df504.tar.gz
STC-modified-1d4ad83d6f3388982cb0aeadbc9815b4776df504.zip
Renames:
cstr_null => cstr_NULL csview_null => csview_NULL cstr_npos => c_NPOS csview_npos => c_NPOS c_ARGsv(sv) => c_ARGSV(sv) c_init(x) => c_INIT(x)
Diffstat (limited to 'docs')
-rw-r--r--docs/carc_api.md2
-rw-r--r--docs/cbox_api.md2
-rw-r--r--docs/ccommon_api.md5
-rw-r--r--docs/cmap_api.md2
-rw-r--r--docs/cregex_api.md8
-rw-r--r--docs/cstr_api.md6
-rw-r--r--docs/csview_api.md14
7 files changed, 18 insertions, 21 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md
index 18bf52c7..15e2c452 100644
--- a/docs/carc_api.md
+++ b/docs/carc_api.md
@@ -67,7 +67,7 @@ bool carc_X_value_eq(const i_val* x, const i_val* y);
| Type name | Type definition | Used to represent... |
|:------------------|:--------------------------------------------------|:-----------------------|
-| `carc_null` | `{NULL, NULL}` | Init nullptr const |
+| `carc_NULL` | `{NULL, NULL}` | Init nullptr const |
| `carc_X` | `struct { carc_X_value* get; long* use_count; }` | The carc type |
| `carc_X_value` | `i_val` | The carc element type |
| `carc_X_raw` | `i_valraw` | Convertion type |
diff --git a/docs/cbox_api.md b/docs/cbox_api.md
index 710c82f7..b3314433 100644
--- a/docs/cbox_api.md
+++ b/docs/cbox_api.md
@@ -64,7 +64,7 @@ bool cbox_X_value_eq(const i_val* x, const i_val* y);
| Type name | Type definition | Used to represent... |
|:-------------------|:--------------------------------|:------------------------|
-| `cbox_null` | `{NULL}` | Init nullptr const |
+| `cbox_NULL` | `{NULL}` | Init nullptr const |
| `cbox_X` | `struct { cbox_X_value* get; }` | The cbox type |
| `cbox_X_value` | `i_val` | The cbox element type |
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md
index 8a11042b..8f887626 100644
--- a/docs/ccommon_api.md
+++ b/docs/ccommon_api.md
@@ -84,7 +84,7 @@ cvec_str readFile(const char* name)
cvec_str vec = cvec_str_init(); // returned
c_with (FILE* fp = fopen(name, "r"), fclose(fp))
- c_with (cstr line = cstr_null, cstr_drop(&line))
+ c_with (cstr line = cstr_NULL, cstr_drop(&line))
while (cstr_getline(&line, fp))
cvec_str_emplace_back(&vec, cstr_str(&line));
return vec;
@@ -313,7 +313,7 @@ if (it.ref) cmap_str_erase_at(&map, it);
c_erase_if(i, csmap_str, map, cstr_contains(i.ref, "hello"));
```
-### c_new, c_alloc, c_alloc_n, c_drop, c_init
+### c_new, c_alloc, c_alloc_n, c_drop
| Usage | Meaning |
|:-------------------------------|:----------------------------------------|
@@ -321,7 +321,6 @@ c_erase_if(i, csmap_str, map, cstr_contains(i.ref, "hello"));
| `c_alloc (type)` | `(type *) c_malloc(sizeof(type))` |
| `c_alloc_n (type, N)` | `(type *) c_malloc((N)*sizeof(type))` |
| `c_drop (ctype, &c1, ..., &cN)` | `ctype_drop(&c1); ... ctype_drop(&cN)` |
-| `c_init(type){value...}` | `(type){value...}` // c++ compatability |
```c
struct Pnt { double x, y, z; };
diff --git a/docs/cmap_api.md b/docs/cmap_api.md
index 48aa7e0d..315d2062 100644
--- a/docs/cmap_api.md
+++ b/docs/cmap_api.md
@@ -277,7 +277,7 @@ typedef struct {
cstr country;
} Viking;
-#define Viking_init() ((Viking){cstr_null, cstr_null})
+#define Viking_init() ((Viking){cstr_NULL, cstr_NULL})
static inline int Viking_cmp(const Viking* a, const Viking* b) {
int c = cstr_cmp(&a->name, &b->name);
diff --git a/docs/cregex_api.md b/docs/cregex_api.md
index 9bed66fa..ce218721 100644
--- a/docs/cregex_api.md
+++ b/docs/cregex_api.md
@@ -107,7 +107,7 @@ int main() {
// Lets find the first date in the string:
csview match[4]; // full-match, year, month, date.
if (cregex_find(&re, input, match, CREG_DEFAULT) == CREG_OK)
- printf("Found date: %.*s\n", c_ARGsv(match[0]));
+ printf("Found date: %.*s\n", c_ARGSV(match[0]));
else
printf("Could not find any date\n");
@@ -123,7 +123,7 @@ int main() {
For a single match you may use the all-in-one function:
```c
if (cregex_find_pattern(pattern, input, match, CREG_DEFAULT))
- printf("Found date: %.*s\n", c_ARGsv(match[0]));
+ printf("Found date: %.*s\n", c_ARGSV(match[0]));
```
To compile, use: `gcc first_match.c src/cregex.c src/utf8code.c`.
@@ -136,13 +136,13 @@ To iterate multiple matches in an input string, you may use
csview match[5] = {0};
while (cregex_find(&re, input, match, CREG_M_NEXT) == CREG_OK)
c_forrange (k, cregex_captures(&re))
- printf("submatch %lld: %.*s\n", k, c_ARGsv(match[k]));
+ printf("submatch %lld: %.*s\n", k, c_ARGSV(match[k]));
```
There is also a safe macro which simplifies this:
```c
c_formatch (it, &re, input)
c_forrange (k, cregex_captures(&re))
- printf("submatch %lld: %.*s\n", k, c_ARGsv(it.match[k]));
+ printf("submatch %lld: %.*s\n", k, c_ARGSV(it.match[k]));
```
## Using cregex in a project
diff --git a/docs/cstr_api.md b/docs/cstr_api.md
index 5c7ba41c..1f80e8e4 100644
--- a/docs/cstr_api.md
+++ b/docs/cstr_api.md
@@ -18,7 +18,7 @@ All cstr definitions and prototypes are available by including a single header f
## Methods
```c
-cstr cstr_init(void); // constructor; same as cstr_null.
+cstr cstr_init(void); // constructor; same as cstr_NULL.
cstr cstr_new(const char literal_only[]); // cstr from literal; no strlen() call.
cstr cstr_from(const char* str); // constructor using strlen()
cstr cstr_from_n(const char* str, size_t n); // constructor with n first bytes of str
@@ -152,8 +152,8 @@ char* cstrnstrn(const char* str, const char* search, size_t slen, size_t
| Name | Value |
|:------------------|:------------------|
-| `cstr_npos` | `INTPTR_MAX` |
-| `cstr_null` | cstr null value |
+| `c_NPOS` | `INTPTR_MAX` |
+| `cstr_NULL` | cstr null value |
## Example
```c
diff --git a/docs/csview_api.md b/docs/csview_api.md
index 10325ceb..59ebf58d 100644
--- a/docs/csview_api.md
+++ b/docs/csview_api.md
@@ -86,7 +86,7 @@ csview cstr_slice_ex(const cstr* s, intptr_t p, intptr_t q); // nega
To iterate tokens in an input string separated by a string:
```c
c_fortoken (i, "hello, one, two, three", ", ")
- printf("token: %.*s\n", c_ARGsv(i.token));
+ printf("token: %.*s\n", c_ARGSV(i.token));
```
#### Helper methods
@@ -109,10 +109,8 @@ uint64_t csview_hash(const csview* x);
| Name | Value | Usage |
|:---------------|:---------------------|:---------------------------------------------|
-| `csview_null` | same as `c_sv("")` | `sview = csview_null;` |
-| `csview_npos` | same as `cstr_npos` | |
-| `c_PRIsv` | `".*s"` | `printf("sv: %" c_PRIsv "\n", c_ARGsv(sv));` |
-| `c_ARGsv(sv)` | printf argument | `printf("sv: %.*s\n", c_ARGsv(sv));` |
+| `csview_NULL` | same as `c_sv("")` | `sview = csview_NULL;` |
+| `c_ARGSV(sv)` | printf argument | `printf("sv: %.*s\n", c_ARGSV(sv));` |
## Example
```c
@@ -129,7 +127,7 @@ int main ()
csview sv2 = cstr_substr(&str1, pos, 4); // get "live"
csview sv3 = cstr_slice(&str1, -8, -1); // get "details"
printf("%.*s %.*s %.*s\n",
- c_ARGsv(sv1), c_ARGsv(sv2), c_ARGsv(sv3));
+ c_ARGSV(sv1), c_ARGSV(sv2), c_ARGSV(sv3));
cstr s1 = cstr_new("Apples are red");
cstr s2 = cstr_from_sv(cstr_substr(&s1, -3, 3)); // "red"
cstr s3 = cstr_from_sv(cstr_substr(&s1, 0, 6)); // "Apples"
@@ -157,7 +155,7 @@ int main()
printf("%s\n", cstr_str(&s1));
c_foreach (i, cstr, s1)
- printf("%.*s,", c_ARGsv(i.u8.chr));
+ printf("%.*s,", c_ARGSV(i.u8.chr));
}
}
```
@@ -177,7 +175,7 @@ and does not depend on null-terminated strings. *string_split()* function return
void print_split(csview input, const char* sep)
{
c_fortoken_sv (i, input, sep)
- printf("[%.*s]\n", c_ARGsv(i.token));
+ printf("[%.*s]\n", c_ARGSV(i.token));
}
#include <stc/cstr.h>