summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/tree234.h
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2024-07-22 21:43:25 -0400
committerFranklin Wei <franklin@rockbox.org>2024-07-22 21:44:08 -0400
commit09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c (patch)
tree182bd4efb2dc8ca4fcb369d8cccab0c0f290d054 /apps/plugins/puzzles/src/tree234.h
parentc72030f98c953a82ed6f5c7132ad000c3d5f4a16 (diff)
downloadrockbox-09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c.tar.gz
rockbox-09aa8de52cb962f1ceebfb1fd44f2c54a924fc5c.zip
puzzles: resync with upstream
This brings the puzzles source in sync with Simon's branch, commit fd304c5 (from March 2024), with some added Rockbox-specific compatibility changes: https://www.franklinwei.com/git/puzzles/commit/?h=rockbox-devel&id=516830d9d76bdfe64fe5ccf2a9b59c33f5c7c078 There are quite a lot of backend changes, including a new "Mosaic" puzzle. In addition, some new frontend changes were necessary: - New "Preferences" menu to access the user preferences system. - Enabled spacebar input for several games. Change-Id: I94c7df674089c92f32d5f07025f6a1059068af1e
Diffstat (limited to 'apps/plugins/puzzles/src/tree234.h')
-rw-r--r--apps/plugins/puzzles/src/tree234.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/apps/plugins/puzzles/src/tree234.h b/apps/plugins/puzzles/src/tree234.h
index ccd943d69d..b58f939a0a 100644
--- a/apps/plugins/puzzles/src/tree234.h
+++ b/apps/plugins/puzzles/src/tree234.h
@@ -31,7 +31,11 @@
31#include <stdbool.h> 31#include <stdbool.h>
32 32
33/* 33/*
34 * This typedef is opaque outside tree234.c itself. 34 * This typedef is typically opaque outside tree234.c itself. But you
35 * can define TREE234_INTERNALS to get a definition of it and its
36 * subsidiary node structure, as long as you're prepared to commit to
37 * responding to changes in the internals (which probably means you're
38 * tree234.c itself or tree234-test.c).
35 */ 39 */
36typedef struct tree234_Tag tree234; 40typedef struct tree234_Tag tree234;
37 41
@@ -39,6 +43,24 @@ typedef int (*cmpfn234)(void *, void *);
39 43
40typedef void *(*copyfn234)(void *state, void *element); 44typedef void *(*copyfn234)(void *state, void *element);
41 45
46#ifdef TREE234_INTERNALS
47typedef struct node234_Tag node234;
48
49struct tree234_Tag {
50 node234 *root;
51 cmpfn234 cmp;
52};
53
54struct node234_Tag {
55 node234 *parent;
56 node234 *kids[4];
57 int counts[4];
58 void *elems[3];
59};
60
61int height234(tree234 *t);
62#endif
63
42/* 64/*
43 * Create a 2-3-4 tree. If `cmp' is NULL, the tree is unsorted, and 65 * Create a 2-3-4 tree. If `cmp' is NULL, the tree is unsorted, and
44 * lookups by key will fail: you can only look things up by numeric 66 * lookups by key will fail: you can only look things up by numeric