diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/carc_api.md | 2 | ||||
| -rw-r--r-- | docs/cbox_api.md | 2 | ||||
| -rw-r--r-- | docs/ccommon_api.md | 14 | ||||
| -rw-r--r-- | docs/cmap_api.md | 2 | ||||
| -rw-r--r-- | docs/cspan_api.md | 2 | ||||
| -rw-r--r-- | docs/cstr_api.md | 4 | ||||
| -rw-r--r-- | docs/csview_api.md | 2 |
7 files changed, 14 insertions, 14 deletions
diff --git a/docs/carc_api.md b/docs/carc_api.md index 9f3d8cb9..22e6bac2 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` | `{0}` | 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 5914a5ad..9151f56d 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` | `{0}` | 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 cd9be505..1f0847da 100644 --- a/docs/ccommon_api.md +++ b/docs/ccommon_api.md @@ -82,17 +82,16 @@ c_forrange (i, 30, 0, -5) printf(" %lld", i); ### crange A number sequence generator type, similar to [boost::irange](https://www.boost.org/doc/libs/release/libs/range/doc/html/range/reference/ranges/irange.html). The **crange_value** type is `long long`. Below *start*, *stop*, and *step* are of type *crange_value*: ```c -crange& crange_obj(...) // create a compound literal crange object -crange crange_make(stop); // will generate 0, 1, ..., stop-1 -crange crange_make(start, stop); // will generate start, start+1, ... stop-1 -crange crange_make(start, stop, step); // will generate start, start+step, ... upto-not-including stop +crange crange_init(stop); // will generate 0, 1, ..., stop-1 +crange crange_init(start, stop); // will generate start, start+1, ... stop-1 +crange crange_init(start, stop, step); // will generate start, start+step, ... upto-not-including stop // note that step may be negative. crange_iter crange_begin(crange* self); crange_iter crange_end(crange* self); void crange_next(crange_iter* it); // 1. All primes less than 32: -crange r1 = crange_make(3, 32, 2); +crange r1 = crange_init(3, 32, 2); printf("2"); // first prime c_forfilter (i, crange, r1, isPrime(*i.ref)) printf(" %lld", *i.ref); @@ -100,7 +99,8 @@ c_forfilter (i, crange, r1, isPrime(*i.ref)) // 2. The first 11 primes: printf("2"); -c_forfilter (i, crange, crange_obj(3, INT64_MAX, 2), +crange range = crange_init(3, INT64_MAX, 2); +c_forfilter (i, crange, range, isPrime(*i.ref) && c_flt_take(10) ){ @@ -140,7 +140,7 @@ bool isPrime(long long i) { int main() { // Get 10 prime numbers starting from 1000. Skip the first 15 primes, // then select every 25th prime (including the initial). - crange R = crange_make(1001, INT64_MAX, 2); // 1001, 1003, ... + crange R = crange_init(1001, INT64_MAX, 2); // 1001, 1003, ... c_forfilter (i, crange, R, isPrime(*i.ref) && diff --git a/docs/cmap_api.md b/docs/cmap_api.md index 69e547a0..8ef322e6 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/cspan_api.md b/docs/cspan_api.md index 3a811ebf..c78bb8a0 100644 --- a/docs/cspan_api.md +++ b/docs/cspan_api.md @@ -26,7 +26,7 @@ i.e., it may be expanded multiple times. However, all integer arguments are safe `cspan_at(&ms3, i++, j++, k++)` is allowed. If the number of arguments does not match the span rank, a compile error is issued. Runtime bounds checks are enabled by default (define `STC_NDEBUG` or `NDEBUG` to disable). ```c -SpanType cspan_make(T SpanType, {v1, v2, ...}); // make a 1-d cspan from values +SpanType cspan_init(T SpanType, {v1, v2, ...}); // make a 1-d cspan from values SpanType cspan_from(STCContainer* cnt); // make a 1-d cspan from compatible STC container SpanType cspan_from_array(ValueType array[]); // make a 1-d cspan from C array SpanTypeN cspan_md(ValueType* data, intptr_t xdim, ...); // make a multi-dimensional cspan diff --git a/docs/cstr_api.md b/docs/cstr_api.md index 438dbf27..c7d19e0c 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_lit(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, intptr_t n); // constructor with n first bytes of str @@ -153,7 +153,7 @@ char* cstrnstrn(const char* str, const char* search, intptr_t slen, intpt | Name | Value | |:------------------|:------------------| | `c_NPOS` | `INTPTR_MAX` | -| `cstr_NULL` | cstr null value | +| `cstr_null` | empty cstr value | ## Example ```c diff --git a/docs/csview_api.md b/docs/csview_api.md index 879822d3..a02b007a 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -112,7 +112,7 @@ uint64_t csview_hash(const csview* x); | Name | Value | Usage | |:---------------|:---------------------|:---------------------------------------------| -| `csview_NULL` | same as `c_sv("")` | `sview = csview_NULL;` | +| `csview_null` | same as `c_sv("")` | `sview = csview_null;` | | `c_SV(sv)` | printf argument | `printf("sv: %.*s\n", c_SV(sv));` | ## Example |
