summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-13 13:53:22 +0100
committerTyge Løvset <[email protected]>2021-12-13 13:53:22 +0100
commit17280f8177736c35b34e41556a307ca51e68d1e2 (patch)
tree96b0b7dfeede1dc0a6c6f36ec60f18e2ff3bd68a /examples
parentc7a26eb5b5fef1c2706d5875a0603d352926487e (diff)
downloadSTC-modified-17280f8177736c35b34e41556a307ca51e68d1e2.tar.gz
STC-modified-17280f8177736c35b34e41556a307ca51e68d1e2.zip
Renamed constructor *cstr_lit()* to `cstr_new(lit)`.
Renamed *cstr_assign_fmt()* to `cstr_printf()`. Renamed cbits_from_str() to cbits_from().
Diffstat (limited to 'examples')
-rw-r--r--examples/astar.c2
-rw-r--r--examples/bits.c2
-rw-r--r--examples/csmap_erase.c10
-rw-r--r--examples/csmap_insert.c2
-rw-r--r--examples/cstr_match.c2
-rw-r--r--examples/demos.c2
-rw-r--r--examples/inits.c2
-rw-r--r--examples/ptr_elems.c4
-rw-r--r--examples/splitstr.c2
9 files changed, 14 insertions, 14 deletions
diff --git a/examples/astar.c b/examples/astar.c
index 2bf136e3..88c602ef 100644
--- a/examples/astar.c
+++ b/examples/astar.c
@@ -132,7 +132,7 @@ astar(cstr* maze, int width)
int
main(void)
{
- c_autovar (cstr maze = cstr_lit(
+ c_autovar (cstr maze = cstr_new(
"#########################################################################\n"
"# # # # # # #\n"
"# # ######### # ##### ######### ##### ##### ##### # ! #\n"
diff --git a/examples/bits.c b/examples/bits.c
index 9263f88c..fbdee3e8 100644
--- a/examples/bits.c
+++ b/examples/bits.c
@@ -5,7 +5,7 @@ int main()
{
c_autovar (cbits set = cbits_with_size(23, true), cbits_del(&set)) {
printf("count %zu, %zu\n", cbits_count(set), set.size);
- cbits s1 = cbits_from_str("1110100110111");
+ cbits s1 = cbits_new("1110100110111");
char buf[256];
cbits_to_str(s1, buf, 0, -1);
printf("buf: %s: %zu\n", buf, cbits_count(s1));
diff --git a/examples/csmap_erase.c b/examples/csmap_erase.c
index 627c11d4..9cf65389 100644
--- a/examples/csmap_erase.c
+++ b/examples/csmap_erase.c
@@ -20,11 +20,11 @@ int main()
c_auto (mymap, m1)
{
// Fill in some data to test with, one at a time
- mymap_insert(&m1, 1, cstr_lit("A"));
- mymap_insert(&m1, 2, cstr_lit("B"));
- mymap_insert(&m1, 3, cstr_lit("C"));
- mymap_insert(&m1, 4, cstr_lit("D"));
- mymap_insert(&m1, 5, cstr_lit("E"));
+ mymap_insert(&m1, 1, cstr_new("A"));
+ mymap_insert(&m1, 2, cstr_new("B"));
+ mymap_insert(&m1, 3, cstr_new("C"));
+ mymap_insert(&m1, 4, cstr_new("D"));
+ mymap_insert(&m1, 5, cstr_new("E"));
puts("Starting data of map m1 is:");
printmap(m1);
diff --git a/examples/csmap_insert.c b/examples/csmap_insert.c
index 32f53377..920cf02d 100644
--- a/examples/csmap_insert.c
+++ b/examples/csmap_insert.c
@@ -83,7 +83,7 @@ int main()
// The templatized versions move-constructing elements
c_auto (csmap_istr, m3) {
- csmap_istr_value ip1 = {475, cstr_lit("blue")}, ip2 = {510, cstr_lit("green")};
+ csmap_istr_value ip1 = {475, cstr_new("blue")}, ip2 = {510, cstr_new("green")};
// single element
csmap_istr_insert(&m3, ip1.first, cstr_move(&ip1.second));
diff --git a/examples/cstr_match.c b/examples/cstr_match.c
index 9e5cc11c..041a2d84 100644
--- a/examples/cstr_match.c
+++ b/examples/cstr_match.c
@@ -3,7 +3,7 @@
int main()
{
- c_autovar (cstr ss = cstr_lit("The quick brown fox jumps over the lazy dog.JPG"), cstr_del(&ss)) {
+ c_autovar (cstr ss = cstr_new("The quick brown fox jumps over the lazy dog.JPG"), cstr_del(&ss)) {
size_t pos = cstr_find_n(ss, "brown", 0, 5);
printf("%zu [%s]\n", pos, pos == cstr_npos ? "<NULL>" : &ss.str[pos]);
printf("equals: %d\n", cstr_equals(ss, "The quick brown fox jumps over the lazy dog.JPG"));
diff --git a/examples/demos.c b/examples/demos.c
index 30250c5f..70aa722d 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -3,7 +3,7 @@
void stringdemo1()
{
printf("\nSTRINGDEMO1\n");
- c_autovar (cstr cs = cstr_from("one-nine-three-seven-five"), cstr_del(&cs))
+ c_autovar (cstr cs = cstr_new("one-nine-three-seven-five"), cstr_del(&cs))
{
printf("%s.\n", cs.str);
diff --git a/examples/inits.c b/examples/inits.c
index a9751ba5..43613198 100644
--- a/examples/inits.c
+++ b/examples/inits.c
@@ -63,7 +63,7 @@ int main(void)
int year = 2020;
c_auto (cmap_id, idnames) {
cmap_id_emplace(&idnames, 100, "Hello");
- cmap_id_insert(&idnames, 110, cstr_from("World"));
+ cmap_id_insert(&idnames, 110, cstr_new("World"));
cmap_id_insert(&idnames, 120, cstr_from_fmt("Howdy, -%d-", year));
c_foreach (i, cmap_id, idnames)
diff --git a/examples/ptr_elems.c b/examples/ptr_elems.c
index 47cdc7d1..c5416822 100644
--- a/examples/ptr_elems.c
+++ b/examples/ptr_elems.c
@@ -49,8 +49,8 @@ int main()
c_auto (cmap_str, map)
{
printf("\nMap with pointer elements:\n");
- cmap_str_insert(&map, cstr_lit("testing"), c_new(inttype, 999));
- cmap_str_insert(&map, cstr_lit("done"), c_new(inttype, 111));
+ cmap_str_insert(&map, cstr_new("testing"), c_new(inttype, 999));
+ cmap_str_insert(&map, cstr_new("done"), c_new(inttype, 111));
// Emplace: implicit key, val construction using i_keyfrom/i_valfrom:
cmap_str_emplace(&map, "hello", 200);
diff --git a/examples/splitstr.c b/examples/splitstr.c
index baa48d21..8bea911a 100644
--- a/examples/splitstr.c
+++ b/examples/splitstr.c
@@ -33,7 +33,7 @@ int main()
print_split(c_sv("This has no matching separator"), c_sv("xx")); puts("");
puts("Output from string_split():");
- cstr string = cstr_lit("Split,this,,string,now,");
+ cstr string = cstr_new("Split,this,,string,now,");
cvec_str vec = string_split(cstr_sv(string), c_sv(","));
c_autodefer (cvec_str_del(&vec), cstr_del(&string))