summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/shape.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
committerTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
commitd623c6c85071b9af5d607bb5d9aceceaea05220a (patch)
treef20fc3714f86e1553d1103bed6dc8efefcbd9d6b /misc/examples/shape.c
parent5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff)
downloadSTC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz
STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip
Experimental uppercase macros.
Diffstat (limited to 'misc/examples/shape.c')
-rw-r--r--misc/examples/shape.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/misc/examples/shape.c b/misc/examples/shape.c
index a17208ef..4f7903da 100644
--- a/misc/examples/shape.c
+++ b/misc/examples/shape.c
@@ -38,7 +38,7 @@ void Shape_delete(Shape* shape)
{
if (shape) {
shape->api->drop(shape);
- c_free(shape);
+ c_FREE(shape);
}
}
@@ -111,7 +111,7 @@ static void Polygon_draw(const Shape* shape)
{
const Polygon* self = c_dyn_cast(Polygon, shape);
printf("Polygon :");
- c_foreach (i, PointVec, self->points)
+ c_FOREACH (i, PointVec, self->points)
printf(" (%g,%g)", i.ref->x, i.ref->y);
puts("");
}
@@ -137,23 +137,23 @@ void testShape(const Shape* shape)
int main(void)
{
- c_auto (Shapes, shapes)
+ c_AUTO (Shapes, shapes)
{
- Triangle* tri1 = c_new(Triangle, Triangle_from((Point){5, 7}, (Point){12, 7}, (Point){12, 20}));
- Polygon* pol1 = c_new(Polygon, Polygon_init());
- Polygon* pol2 = c_new(Polygon, Polygon_init());
+ Triangle* tri1 = c_NEW(Triangle, Triangle_from((Point){5, 7}, (Point){12, 7}, (Point){12, 20}));
+ Polygon* pol1 = c_NEW(Polygon, Polygon_init());
+ Polygon* pol2 = c_NEW(Polygon, Polygon_init());
- c_forlist (i, Point, {{50, 72}, {123, 73}, {127, 201}, {828, 333}})
+ c_FORLIST (i, Point, {{50, 72}, {123, 73}, {127, 201}, {828, 333}})
Polygon_addPoint(pol1, *i.ref);
- c_forlist (i, Point, {{5, 7}, {12, 7}, {12, 20}, {82, 33}, {17, 56}})
+ c_FORLIST (i, Point, {{5, 7}, {12, 7}, {12, 20}, {82, 33}, {17, 56}})
Polygon_addPoint(pol2, *i.ref);
Shapes_push(&shapes, &tri1->shape);
Shapes_push(&shapes, &pol1->shape);
Shapes_push(&shapes, &pol2->shape);
- c_foreach (i, Shapes, shapes)
+ c_FOREACH (i, Shapes, shapes)
testShape(*i.ref);
}
}