summaryrefslogtreecommitdiffhomepage
path: root/examples
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 /examples
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 'examples')
-rw-r--r--examples/cstr_match.c6
-rw-r--r--examples/forfilter.c2
-rw-r--r--examples/new_arr.c2
-rw-r--r--examples/read.c2
-rw-r--r--examples/regex2.c2
-rw-r--r--examples/splitstr.c4
-rw-r--r--examples/sso_substr.c2
-rw-r--r--examples/sview_split.c2
-rw-r--r--examples/utf8replace_c.c2
-rw-r--r--examples/vikings.c4
10 files changed, 14 insertions, 14 deletions
diff --git a/examples/cstr_match.c b/examples/cstr_match.c
index 9324ce41..5ba09ed9 100644
--- a/examples/cstr_match.c
+++ b/examples/cstr_match.c
@@ -6,7 +6,7 @@ int main()
{
c_with (cstr ss = cstr_new("The quick brown fox jumps over the lazy dog.JPG"), cstr_drop(&ss)) {
size_t pos = cstr_find_at(&ss, 0, "brown");
- printf("%" c_ZU " [%s]\n", pos, pos == cstr_npos ? "<NULL>" : cstr_str(&ss) + pos);
+ printf("%" c_ZU " [%s]\n", pos, pos == c_NPOS ? "<NULL>" : cstr_str(&ss) + pos);
printf("equals: %d\n", cstr_equals(&ss, "The quick brown fox jumps over the lazy dog.JPG"));
printf("contains: %d\n", cstr_contains(&ss, "umps ove"));
printf("starts_with: %d\n", cstr_starts_with(&ss, "The quick brown"));
@@ -17,7 +17,7 @@ int main()
csview ch1 = cstr_u8_chr(&s1, 7);
csview ch2 = cstr_u8_chr(&s1, 10);
printf("%s\nsize: %" c_ZU ", %" c_ZU "\n", cstr_str(&s1), cstr_u8_size(&s1), cstr_size(&s1));
- printf("ch1: %.*s\n", c_ARGsv(ch1));
- printf("ch2: %.*s\n", c_ARGsv(ch2));
+ printf("ch1: %.*s\n", c_ARGSV(ch1));
+ printf("ch2: %.*s\n", c_ARGSV(ch2));
}
}
diff --git a/examples/forfilter.c b/examples/forfilter.c
index bf486ea4..9eb1536e 100644
--- a/examples/forfilter.c
+++ b/examples/forfilter.c
@@ -99,7 +99,7 @@ void demo3(void)
puts("demo3:");
c_foreach (w, SVec, words_containing_i)
- printf(" %.*s", c_ARGsv(*w.ref));
+ printf(" %.*s", c_ARGSV(*w.ref));
puts("");
}
}
diff --git a/examples/new_arr.c b/examples/new_arr.c
index 79e7c7a6..871cfae0 100644
--- a/examples/new_arr.c
+++ b/examples/new_arr.c
@@ -46,7 +46,7 @@ int main()
puts("");
}
- c_with (carr2_str text2d = carr2_str_with_size(h, d, cstr_null), carr2_str_drop(&text2d))
+ c_with (carr2_str text2d = carr2_str_with_size(h, d, cstr_NULL), carr2_str_drop(&text2d))
{
cstr_assign(&text2d.data[2][1], "hello");
cstr_assign(&text2d.data[4][0], "world");
diff --git a/examples/read.c b/examples/read.c
index 5a9a30d5..4efdcfeb 100644
--- a/examples/read.c
+++ b/examples/read.c
@@ -7,7 +7,7 @@ cvec_str read_file(const char* name)
{
cvec_str vec = cvec_str_init();
c_with (FILE* f = fopen(name, "r"), fclose(f))
- c_with (cstr line = cstr_null, cstr_drop(&line))
+ c_with (cstr line = cstr_NULL, cstr_drop(&line))
while (cstr_getline(&line, f))
cvec_str_push(&vec, cstr_clone(line));
return vec;
diff --git a/examples/regex2.c b/examples/regex2.c
index 4f60cfc4..dbf6aae4 100644
--- a/examples/regex2.c
+++ b/examples/regex2.c
@@ -25,7 +25,7 @@ int main()
c_formatch (j, &re, s[i].input) {
c_forrange (k, cregex_captures(&re))
- printf(" submatch %lld: %.*s\n", k, c_ARGsv(j.match[k]));
+ printf(" submatch %lld: %.*s\n", k, c_ARGSV(j.match[k]));
puts("");
}
}
diff --git a/examples/splitstr.c b/examples/splitstr.c
index 39db1a54..a3c12a3a 100644
--- a/examples/splitstr.c
+++ b/examples/splitstr.c
@@ -8,12 +8,12 @@ int main()
puts("Split with c_fortoken (csview):");
c_fortoken (i, "Hello World C99!", " ")
- printf("'%.*s'\n", c_ARGsv(i.token));
+ printf("'%.*s'\n", c_ARGSV(i.token));
puts("\nSplit with c_formatch (regex):");
c_with (cregex re = cregex_from("[^ ]+", CREG_DEFAULT), cregex_drop(&re))
c_formatch (i, &re, " Hello World C99! ")
- printf("'%.*s'\n", c_ARGsv(i.match[0]));
+ printf("'%.*s'\n", c_ARGSV(i.match[0]));
}
diff --git a/examples/sso_substr.c b/examples/sso_substr.c
index 0c8e9b22..ea10c411 100644
--- a/examples/sso_substr.c
+++ b/examples/sso_substr.c
@@ -9,7 +9,7 @@ int main ()
size_t pos = cstr_find(&str, "live"); // position of "live"
csview sv2 = cstr_substr_ex(&str, pos, 4); // "live"
csview sv3 = cstr_slice_ex(&str, -8, -1); // "details"
- printf("%.*s, %.*s, %.*s\n", c_ARGsv(sv1), c_ARGsv(sv2), c_ARGsv(sv3));
+ printf("%.*s, %.*s, %.*s\n", c_ARGSV(sv1), c_ARGSV(sv2), c_ARGSV(sv3));
cstr_assign(&str, "apples are green or red");
cstr s2 = cstr_from_sv(cstr_substr_ex(&str, -3, 3)); // "red"
diff --git a/examples/sview_split.c b/examples/sview_split.c
index 634fdc38..81d93276 100644
--- a/examples/sview_split.c
+++ b/examples/sview_split.c
@@ -11,7 +11,7 @@ int main()
const csview month = csview_token(date, "/", &pos);
const csview day = csview_token(date, "/", &pos);
- printf("%.*s, %.*s, %.*s\n", c_ARGsv(year), c_ARGsv(month), c_ARGsv(day));
+ printf("%.*s, %.*s, %.*s\n", c_ARGSV(year), c_ARGSV(month), c_ARGSV(day));
c_auto (cstr, y, m, d) {
y = cstr_from_sv(year), m = cstr_from_sv(month), d = cstr_from_sv(day);
diff --git a/examples/utf8replace_c.c b/examples/utf8replace_c.c
index be77d615..c2b3c0cf 100644
--- a/examples/utf8replace_c.c
+++ b/examples/utf8replace_c.c
@@ -17,7 +17,7 @@ int main() {
upper = cstr_toupper_sv(cstr_sv(&hello));
c_foreach (c, cstr, hello)
- printf("%.*s,", c_ARGsv(c.u8.chr));
+ printf("%.*s,", c_ARGSV(c.u8.chr));
puts("");
}
}
diff --git a/examples/vikings.c b/examples/vikings.c
index a1099d28..26a74757 100644
--- a/examples/vikings.c
+++ b/examples/vikings.c
@@ -23,11 +23,11 @@ static inline int RViking_cmp(const RViking* rx, const RViking* ry) {
}
static inline Viking Viking_from(RViking raw) { // note: parameter is by value
- return c_init(Viking){cstr_from(raw.name), cstr_from(raw.country)};
+ return c_INIT(Viking){cstr_from(raw.name), cstr_from(raw.country)};
}
static inline RViking Viking_toraw(const Viking* vp) {
- return c_init(RViking){cstr_str(&vp->name), cstr_str(&vp->country)};
+ return c_INIT(RViking){cstr_str(&vp->name), cstr_str(&vp->country)};
}
// With this in place, we define the Viking => int hash map type: