summaryrefslogtreecommitdiffhomepage
path: root/misc/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-13 18:03:22 +0100
committerTyge Løvset <[email protected]>2023-02-13 18:03:22 +0100
commita3645620cf4b8855801d9ca0cf7385de5a70c5d9 (patch)
tree4ef27f9dc36d03507d86a4e6fee66494152c76dd /misc/examples
parent3421d7b745310da05117fa97348a99a4a6ef8b5b (diff)
downloadSTC-modified-a3645620cf4b8855801d9ca0cf7385de5a70c5d9.tar.gz
STC-modified-a3645620cf4b8855801d9ca0cf7385de5a70c5d9.zip
Removed support for uppercase version of c_sv() (i.e c_SV => c_sv).
Renamed c_ARGSV => c_SV. Old name is still working.
Diffstat (limited to 'misc/examples')
-rw-r--r--misc/examples/cstr_match.c4
-rw-r--r--misc/examples/forfilter.c4
-rw-r--r--misc/examples/regex2.c2
-rw-r--r--misc/examples/replace.c4
-rw-r--r--misc/examples/splitstr.c4
-rw-r--r--misc/examples/sso_substr.c2
-rw-r--r--misc/examples/sview_split.c4
-rw-r--r--misc/examples/utf8replace_c.c4
8 files changed, 14 insertions, 14 deletions
diff --git a/misc/examples/cstr_match.c b/misc/examples/cstr_match.c
index 4d11edbb..6682c4ba 100644
--- a/misc/examples/cstr_match.c
+++ b/misc/examples/cstr_match.c
@@ -17,7 +17,7 @@ int main()
csview ch1 = cstr_u8_chr(&s1, 7);
csview ch2 = cstr_u8_chr(&s1, 10);
printf("%s\nsize: %" c_ZI ", %" c_ZI "\n", cstr_str(&s1), cstr_u8_size(&s1), cstr_size(&s1));
- printf("ch1: %.*s\n", c_SVARG(ch1));
- printf("ch2: %.*s\n", c_SVARG(ch2));
+ printf("ch1: %.*s\n", c_SV(ch1));
+ printf("ch2: %.*s\n", c_SV(ch2));
}
}
diff --git a/misc/examples/forfilter.c b/misc/examples/forfilter.c
index b0be4e69..5e1cf15e 100644
--- a/misc/examples/forfilter.c
+++ b/misc/examples/forfilter.c
@@ -102,14 +102,14 @@ void demo3(void)
puts("demo3:");
c_foreach (w, SVec, words_containing_i)
- printf(" %.*s", c_SVARG(*w.ref));
+ printf(" %.*s", c_SV(*w.ref));
puts("");
}
}
void demo4(void)
{
- csview s = c_SV("ab123cReAghNGnΩoEp"); // Ω = multi-byte
+ csview s = c_sv("ab123cReAghNGnΩoEp"); // Ω = multi-byte
c_auto (cstr, out) {
c_forfilter (i, csview, s, utf8_isupper(utf8_peek(i.ref))) {
char chr[4];
diff --git a/misc/examples/regex2.c b/misc/examples/regex2.c
index 4c58f3ba..20bd323c 100644
--- a/misc/examples/regex2.c
+++ b/misc/examples/regex2.c
@@ -27,7 +27,7 @@ int main()
c_formatch (j, &re, s[i].input) {
c_forrange (k, cregex_captures(&re))
- printf(" submatch %lld: %.*s\n", k, c_SVARG(j.match[k]));
+ printf(" submatch %lld: %.*s\n", k, c_SV(j.match[k]));
}
}
}
diff --git a/misc/examples/replace.c b/misc/examples/replace.c
index 15cf3bae..c22c71ff 100644
--- a/misc/examples/replace.c
+++ b/misc/examples/replace.c
@@ -19,13 +19,13 @@ int main ()
cstr_replace_at(&s, 9, 5, s2); // "this is an example string." (1)
printf("(1) %s\n", cstr_str(&s));
- cstr_replace_at_sv(&s, 19, 6, c_SV(s3+7, 6)); // "this is an example phrase." (2)
+ cstr_replace_at_sv(&s, 19, 6, c_sv(s3+7, 6)); // "this is an example phrase." (2)
printf("(2) %s\n", cstr_str(&s));
cstr_replace_at(&s, 8, 10, "just a"); // "this is just a phrase." (3)
printf("(3) %s\n", cstr_str(&s));
- cstr_replace_at_sv(&s, 8, 6, c_SV("a shorty", 7)); // "this is a short phrase." (4)
+ cstr_replace_at_sv(&s, 8, 6, c_sv("a shorty", 7)); // "this is a short phrase." (4)
printf("(4) %s\n", cstr_str(&s));
cstr_replace_at(&s, 22, 1, "!!!"); // "this is a short phrase!!!" (5)
diff --git a/misc/examples/splitstr.c b/misc/examples/splitstr.c
index 4705696c..5bf02d42 100644
--- a/misc/examples/splitstr.c
+++ b/misc/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_SVARG(i.token));
+ printf("'%.*s'\n", c_SV(i.token));
puts("\nSplit with c_formatch (regex):");
c_with (cregex re = cregex_from("[^ ]+"), cregex_drop(&re))
c_formatch (i, &re, " Hello World C99! ")
- printf("'%.*s'\n", c_SVARG(i.match[0]));
+ printf("'%.*s'\n", c_SV(i.match[0]));
}
diff --git a/misc/examples/sso_substr.c b/misc/examples/sso_substr.c
index d17dc89c..4b2dbcc8 100644
--- a/misc/examples/sso_substr.c
+++ b/misc/examples/sso_substr.c
@@ -8,7 +8,7 @@ int main ()
intptr_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_SVARG(sv1), c_SVARG(sv2), c_SVARG(sv3));
+ printf("%.*s, %.*s, %.*s\n", c_SV(sv1), c_SV(sv2), c_SV(sv3));
cstr_assign(&str, "apples are green or red");
cstr s2 = cstr_from_sv(cstr_substr_ex(&str, -3, 3)); // "red"
diff --git a/misc/examples/sview_split.c b/misc/examples/sview_split.c
index 2bb7aaee..18d547f8 100644
--- a/misc/examples/sview_split.c
+++ b/misc/examples/sview_split.c
@@ -4,13 +4,13 @@
int main()
{
// No memory allocations or string length calculations!
- const csview date = c_SV("2021/03/12");
+ const csview date = c_sv("2021/03/12");
intptr_t pos = 0;
const csview year = csview_token(date, "/", &pos);
const csview month = csview_token(date, "/", &pos);
const csview day = csview_token(date, "/", &pos);
- printf("%.*s, %.*s, %.*s\n", c_SVARG(year), c_SVARG(month), c_SVARG(day));
+ printf("%.*s, %.*s, %.*s\n", c_SV(year), c_SV(month), c_SV(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/misc/examples/utf8replace_c.c b/misc/examples/utf8replace_c.c
index adb8c042..b697efd8 100644
--- a/misc/examples/utf8replace_c.c
+++ b/misc/examples/utf8replace_c.c
@@ -11,12 +11,12 @@ int main()
cstr_u8_replace_at(&hello,
cstr_u8_to_pos(&hello, 7),
1,
- c_SV("🐨")
+ c_sv("🐨")
);
printf("%s\n", cstr_str(&hello));
c_foreach (c, cstr, hello)
- printf("%.*s,", c_SVARG(c.u8.chr));
+ printf("%.*s,", c_SV(c.u8.chr));
str = cstr_lit("scooby, dooby doo");
cstr_replace(&str, "oo", "00");