Mercurial > repos > blastem
annotate tern.h @ 1315:810ae0287d66
Fix minor bug that displayed window plane as if it were plane A In plane debug view
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 05 Apr 2017 09:48:49 -0700 |
parents | 72ea3885e7b5 |
children | 071e761bcdcf |
rev | line source |
---|---|
467
140af5509ce7
Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents:
431
diff
changeset
|
1 /* |
140af5509ce7
Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents:
431
diff
changeset
|
2 Copyright 2013 Michael Pavone |
498
51bf87f76d15
Pull shader file names from config file.
Mike Pavone <pavone@retrodev.com>
parents:
467
diff
changeset
|
3 This file is part of BlastEm. |
467
140af5509ce7
Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents:
431
diff
changeset
|
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. |
140af5509ce7
Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents:
431
diff
changeset
|
5 */ |
429
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 #ifndef TERN_H_ |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 #define TERN_H_ |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 #include <stdint.h> |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 |
631
de6f00204fa2
Add support for disassembling VOS program modules
Michael Pavone <pavone@retrodev.com>
parents:
498
diff
changeset
|
11 #define MAX_INT_KEY_SIZE (sizeof(uint32_t) + 2) |
de6f00204fa2
Add support for disassembling VOS program modules
Michael Pavone <pavone@retrodev.com>
parents:
498
diff
changeset
|
12 |
429
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 typedef union { |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 void *ptrval; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 intptr_t intval; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 } tern_val; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 typedef struct tern_node { |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 struct tern_node *left; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 union { |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 struct tern_node *next; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 tern_val value; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 } straight; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 struct tern_node *right; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 char el; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 } tern_node; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
631
diff
changeset
|
28 typedef void (*iter_fun)(char *key, tern_val val, void *data); |
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
631
diff
changeset
|
29 |
1186
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
30 tern_node * tern_insert(tern_node * head, char const * key, tern_val value); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
31 int tern_find(tern_node * head, char const * key, tern_val *ret); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
32 tern_node * tern_find_prefix(tern_node * head, char const * key); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
33 intptr_t tern_find_int(tern_node * head, char const * key, intptr_t def); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
34 tern_node * tern_insert_int(tern_node * head, char const * key, intptr_t value); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
35 void * tern_find_ptr_default(tern_node * head, char const * key, void * def); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
36 void * tern_find_ptr(tern_node * head, char const * key); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
37 tern_val tern_find_path_default(tern_node *head, char const *key, tern_val def); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
38 tern_val tern_find_path(tern_node *head, char const *key); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
39 tern_node * tern_insert_ptr(tern_node * head, char const * key, void * value); |
110251ea369e
Consting up some parameters to ternary tree functions
Michael Pavone <pavone@retrodev.com>
parents:
768
diff
changeset
|
40 tern_node * tern_insert_node(tern_node *head, char const *key, tern_node *value); |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
631
diff
changeset
|
41 uint32_t tern_count(tern_node *head); |
768
2f48a3c187c6
Add support for reading cartridge memory map from ROM database, though without EEPROM support for now
Michael Pavone <pavone@retrodev.com>
parents:
766
diff
changeset
|
42 void tern_foreach(tern_node *head, iter_fun fun, void *data); |
631
de6f00204fa2
Add support for disassembling VOS program modules
Michael Pavone <pavone@retrodev.com>
parents:
498
diff
changeset
|
43 char * tern_int_key(uint32_t key, char * buf); |
766
1b2f8280ba81
WIP changes to support reading cart memory map from ROM DB
Michael Pavone <pavone@retrodev.com>
parents:
631
diff
changeset
|
44 tern_node * tern_get_node(tern_val value); |
1293
72ea3885e7b5
Don't leak a ternary tree when building the menu's initial path
Michael Pavone <pavone@retrodev.com>
parents:
1186
diff
changeset
|
45 void tern_free(tern_node *head); |
429
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 #endif //TERN_H_ |