Mercurial > repos > blastem
annotate tern.h @ 505:b7b7a1cab44a
The local clone on my laptop got messed up and some changes had not been pushed. This commit represents the status of the working copy from that clone. It unfortunately contains some changes that I did not intend to commit yet, but this seems like the best option at the moment.
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 06 Jan 2014 22:54:05 -0800 |
parents | 51bf87f76d15 |
children | de6f00204fa2 |
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 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 typedef union { |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 void *ptrval; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 intptr_t intval; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 } tern_val; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 typedef struct tern_node { |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 struct tern_node *left; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 union { |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 struct tern_node *next; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 tern_val value; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 } straight; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 struct tern_node *right; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 char el; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 } tern_node; |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 tern_node * tern_insert(tern_node * head, char * key, tern_val value); |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 int tern_find(tern_node * head, char * key, tern_val *ret); |
431
440efd7d27a9
Read key bindings from config file
Mike Pavone <pavone@retrodev.com>
parents:
429
diff
changeset
|
28 tern_node * tern_find_prefix(tern_node * head, char * key); |
429
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 intptr_t tern_find_int(tern_node * head, char * key, intptr_t def); |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 tern_node * tern_insert_int(tern_node * head, char * key, intptr_t value); |
498
51bf87f76d15
Pull shader file names from config file.
Mike Pavone <pavone@retrodev.com>
parents:
467
diff
changeset
|
31 void * tern_find_ptr_default(tern_node * head, char * key, void * def); |
429
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 void * tern_find_ptr(tern_node * head, char * key); |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 tern_node * tern_insert_ptr(tern_node * head, char * key, void * value); |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 |
f6fdde540791
Added ternary tree implementation and a simple test program for it
Mike Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 #endif //TERN_H_ |