diff options
| author | Tyge Løvset <[email protected]> | 2022-09-23 13:17:22 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-09-23 13:17:22 +0200 |
| commit | 2c83996f1ad7ac7176833d1ecb76f59120bf52cd (patch) | |
| tree | 495527c129d630b67aed0d8528c70ef5aa418106 /docs | |
| parent | 0ec40a5819a619b6b2777f24c555a8953e99ea9b (diff) | |
| download | STC-modified-2c83996f1ad7ac7176833d1ecb76f59120bf52cd.tar.gz STC-modified-2c83996f1ad7ac7176833d1ecb76f59120bf52cd.zip | |
Reverted c_forrange() macro with 3 or more args: swapped 1st and 2nd arg again.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ccommon_api.md | 10 | ||||
| -rw-r--r-- | docs/clist_api.md | 2 | ||||
| -rw-r--r-- | docs/cregex_api.md | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/docs/ccommon_api.md b/docs/ccommon_api.md index 403d8ef9..c45dadc1 100644 --- a/docs/ccommon_api.md +++ b/docs/ccommon_api.md @@ -192,18 +192,18 @@ Declare an iterator and specify a range to iterate with a for loop. Like python' |:----------------------------------------------|:-------------------------------------| | `c_forrange (stop)` | `for _ in range(stop):` | | `c_forrange (i, stop) // IntType = size_t` | `for i in range(stop):` | -| `c_forrange (IntType, i, stop)` | `for i in range(stop):` | -| `c_forrange (IntType, i, start, stop)` | `for i in range(start, stop):` | -| `c_forrange (IntType, i, start, stop, step)` | `for i in range(start, stop, step):` | +| `c_forrange (i, IntType, stop)` | `for i in range(stop):` | +| `c_forrange (i, IntType, start, stop)` | `for i in range(start, stop):` | +| `c_forrange (i, IntType, start, stop, step)` | `for i in range(start, stop, step):` | ```c c_forrange (5) printf("x"); // xxxxx c_forrange (i, 5) printf(" %" PRIuMAX "", i); // 0 1 2 3 4 -c_forrange (int, i, -3, 3) printf(" %d", i); +c_forrange (i, int, -3, 3) printf(" %d", i); // -3 -2 -1 0 1 2 -c_forrange (int, i, 30, 0, -5) printf(" %d", i); +c_forrange (i, int, 30, 0, -5) printf(" %d", i); // 30 25 20 15 10 5 ``` diff --git a/docs/clist_api.md b/docs/clist_api.md index 1b3c5b0b..9927087d 100644 --- a/docs/clist_api.md +++ b/docs/clist_api.md @@ -114,7 +114,7 @@ int main() { c_forlist (i, double, {10., 20., 30., 40., 50., 60., 70., 80., 90.}) DList_push_back(&list, *i.ref); - c_forrange (int, i, 1, 10) { + c_forrange (i, int, 1, 10) { if (i & 1) DList_push_front(&list, (double) i); else DList_push_back(&list, (double) i); } diff --git a/docs/cregex_api.md b/docs/cregex_api.md index 5f7e9136..2a0b22a8 100644 --- a/docs/cregex_api.md +++ b/docs/cregex_api.md @@ -128,13 +128,13 @@ To iterate multiple matches in an input string, you may use ```c csview match[5] = {0}; while (cregex_find(&re, input, match, cre_m_next) == cre_success) - c_forrange (int, k, cregex_captures(&re)) + c_forrange (k, int, cregex_captures(&re)) printf("submatch %d: %.*s\n", k, c_ARGsv(match[k])); ``` There is also a safe macro which simplifies this: ```c c_formatch (it, &re, input) - c_forrange (int, k, cregex_captures(&re)) + c_forrange (k, int, cregex_captures(&re)) printf("submatch %d: %.*s\n", k, c_ARGsv(it.match[k])); ``` |
