From 92b950333c6c7002bdbf1b60af44a249dc0cef9c Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sun, 19 Dec 2021 12:21:44 +0100 Subject: First commit for Version 3 of STC. Main changes are consistent rename of '_del' to '_drop' and '_compare' to '_cmp'. Also i_key_ref (earlier i_key_sptr) and i_val_ref replaced by more general i_key_bind/i_val_bind. --- examples/astar.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'examples/astar.c') diff --git a/examples/astar.c b/examples/astar.c index 88c602ef..ee002b79 100644 --- a/examples/astar.c +++ b/examples/astar.c @@ -24,9 +24,9 @@ point_init(int x, int y, int width) } int -point_compare_priority(const point* a, const point* b) +point_cmp_priority(const point* a, const point* b) { - return c_default_compare(&a->priorty, &b->priorty); + return c_default_cmp(&a->priorty, &b->priorty); } int @@ -49,7 +49,7 @@ point_index(const point* p) } int -point_key_compare(const point* a, const point* b) +point_key_cmp(const point* a, const point* b) { int i = point_index(a); int j = point_index(b); @@ -57,22 +57,22 @@ point_key_compare(const point* a, const point* b) } #define i_val point -#define i_cmp point_compare_priority +#define i_cmp point_cmp_priority #include #define i_val point -#define i_opt c_no_compare +#define i_opt c_no_cmp #include #define i_key point #define i_val int -#define i_cmp point_key_compare +#define i_cmp point_key_cmp #define i_tag pcost #include #define i_key point #define i_val point -#define i_cmp point_key_compare +#define i_cmp point_key_cmp #define i_tag pstep #include @@ -155,10 +155,10 @@ main(void) "# # # # # # # # # #\n" "# @ # ##### ##### ##### ######### ##### # ######### # #\n" "# # # # # # #\n" - "#########################################################################\n"), cstr_del(&maze)) + "#########################################################################\n"), cstr_drop(&maze)) { int width = cstr_find(maze, "\n") + 1; - c_autovar (cdeq_point path = astar(&maze, width), cdeq_point_del(&path)) + c_autovar (cdeq_point path = astar(&maze, width), cdeq_point_drop(&path)) { c_foreach (it, cdeq_point, path) maze.str[point_index(it.ref)] = 'x'; printf("%s", maze.str); -- cgit v1.2.3