summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-09-30 09:04:49 +0200
committerTyge Løvset <[email protected]>2021-09-30 09:04:49 +0200
commitcb6cc689516c1adf2b22860ca62e508a3618e3d8 (patch)
tree3455a36c4d7aa6a5cd633c80be8dbcb36915af21 /examples
parent3624d34fabaa388e018f907a42ecfd014d96b704 (diff)
downloadSTC-modified-cb6cc689516c1adf2b22860ca62e508a3618e3d8.tar.gz
STC-modified-cb6cc689516c1adf2b22860ca62e508a3618e3d8.zip
More cleanup. i_fwd is rarely needed, so removed F_tag. Use i_fwd define flag instead.
Diffstat (limited to 'examples')
-rw-r--r--examples/new_deq.c7
-rw-r--r--examples/new_list.c8
-rw-r--r--examples/new_map.c4
-rw-r--r--examples/new_pque.c4
-rw-r--r--examples/new_sptr.c9
-rw-r--r--examples/new_vec.c8
-rw-r--r--examples/sptr_ex.c3
7 files changed, 27 insertions, 16 deletions
diff --git a/examples/new_deq.c b/examples/new_deq.c
index 93853ce3..58ca7722 100644
--- a/examples/new_deq.c
+++ b/examples/new_deq.c
@@ -10,7 +10,8 @@ struct MyStruct {
} typedef MyStruct;
-#define F_tag i32
+#define i_fwd
+#define i_tag i32
#define i_val int
#include <stc/cdeq.h>
@@ -19,7 +20,9 @@ int point_compare(const Point* a, const Point* b) {
int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define F_tag pnt
+
+#define i_fwd
+#define i_tag pnt
#define i_val Point
#define i_cmp point_compare
#include <stc/cdeq.h>
diff --git a/examples/new_list.c b/examples/new_list.c
index 66c97c3b..a46e6350 100644
--- a/examples/new_list.c
+++ b/examples/new_list.c
@@ -9,8 +9,8 @@ struct MyStruct {
clist_pnt pntlst;
} typedef MyStruct;
-
-#define F_tag i32
+#define i_fwd
+#define i_tag i32
#define i_val int
#include <stc/clist.h>
@@ -19,7 +19,9 @@ int point_compare(const Point* a, const Point* b) {
int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define F_tag pnt
+
+#define i_fwd
+#define i_tag pnt
#define i_val Point
#define i_cmp point_compare
#include <stc/clist.h>
diff --git a/examples/new_map.c b/examples/new_map.c
index f09fe801..297e9be7 100644
--- a/examples/new_map.c
+++ b/examples/new_map.c
@@ -19,7 +19,9 @@ int point_compare(const Point* a, const Point* b) {
int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define F_tag pnt // F=forward declared
+
+#define i_fwd // forward declared
+#define i_tag pnt
#define i_key Point
#define i_val int
#define i_cmp point_compare
diff --git a/examples/new_pque.c b/examples/new_pque.c
index 7047a622..08962e1f 100644
--- a/examples/new_pque.c
+++ b/examples/new_pque.c
@@ -19,7 +19,9 @@ int Point_cmp(const Point* a, const Point* b) {
int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define F_tag pnt // F: was forward declared.
+
+#define i_fwd // forward declared.
+#define i_tag pnt
#define i_val Point
#define i_cmp Point_cmp
#include <stc/cpque.h>
diff --git a/examples/new_sptr.c b/examples/new_sptr.c
index 678ac85e..e4ed5e89 100644
--- a/examples/new_sptr.c
+++ b/examples/new_sptr.c
@@ -1,8 +1,5 @@
#include <stc/cstr.h>
-#include <stc/forward.h>
-forward_csptr(csptr_person, struct Person);
-
struct Person { cstr name, last; } typedef Person;
Person Person_init(const char* name, const char* last) {
@@ -13,12 +10,14 @@ void Person_del(Person* p) {
c_del(cstr, &p->name, &p->last);
}
-#define F_tag person
+#define i_tag person
#define i_val Person
-#define i_valdel Person_del
+#define i_del Person_del
#define i_cmp c_no_compare
#include <stc/csptr.h>
+// ...
+
#define i_val int
#include <stc/csptr.h>
diff --git a/examples/new_vec.c b/examples/new_vec.c
index fb4181bd..34029168 100644
--- a/examples/new_vec.c
+++ b/examples/new_vec.c
@@ -9,8 +9,8 @@ struct MyStruct {
cvec_pnt pntvec;
} typedef MyStruct;
-
-#define F_tag i32
+#define i_fwd pnt
+#define i_tag i32
#define i_val int
#include <stc/cvec.h>
@@ -19,7 +19,9 @@ int point_compare(const Point* a, const Point* b) {
int c = c_default_compare(&a->x, &b->x);
return c ? c : c_default_compare(&a->y, &b->y);
}
-#define F_tag pnt
+
+#define i_fwd pnt
+#define i_tag pnt
#define i_val Point
#define i_cmp point_compare
#include <stc/cvec.h>
diff --git a/examples/sptr_ex.c b/examples/sptr_ex.c
index cd84c668..d7b3999b 100644
--- a/examples/sptr_ex.c
+++ b/examples/sptr_ex.c
@@ -27,8 +27,9 @@ void Song_del(Song* s) {
c_del(cstr, &s->artist, &s->title);
}
+#define i_fwd
+#define i_tag song
#define i_val Song
-#define F_tag song
#define i_cmp c_no_compare
#define i_del Song_del
#include <stc/csptr.h>