summaryrefslogtreecommitdiff
path: root/tern.h
diff options
context:
space:
mode:
authorMike Pavone <pavone@retrodev.com>2013-10-26 22:38:47 -0700
committerMike Pavone <pavone@retrodev.com>2013-10-26 22:38:47 -0700
commit7e61eaa7225bf025af42f88d0598aff8412f4144 (patch)
treebd19c2e555fc997065eba51715459185db566878 /tern.h
parent4788b58c7290ad4a4a161d6bc69bc184acc2ef66 (diff)
parentb8dc9d69563379341f127af571b4bec1312f4ca0 (diff)
Update opengl branch from default. Fix build breakage unrelated to merge
--HG-- branch : opengl
Diffstat (limited to 'tern.h')
-rw-r--r--tern.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/tern.h b/tern.h
new file mode 100644
index 0000000..e727599
--- /dev/null
+++ b/tern.h
@@ -0,0 +1,34 @@
+/*
+ Copyright 2013 Michael Pavone
+ This file is part of BlastEm.
+ BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
+*/
+#ifndef TERN_H_
+#define TERN_H_
+
+#include <stdint.h>
+
+typedef union {
+ void *ptrval;
+ intptr_t intval;
+} tern_val;
+
+typedef struct tern_node {
+ struct tern_node *left;
+ union {
+ struct tern_node *next;
+ tern_val value;
+ } straight;
+ struct tern_node *right;
+ char el;
+} tern_node;
+
+tern_node * tern_insert(tern_node * head, char * key, tern_val value);
+int tern_find(tern_node * head, char * key, tern_val *ret);
+tern_node * tern_find_prefix(tern_node * head, char * key);
+intptr_t tern_find_int(tern_node * head, char * key, intptr_t def);
+tern_node * tern_insert_int(tern_node * head, char * key, intptr_t value);
+void * tern_find_ptr(tern_node * head, char * key);
+tern_node * tern_insert_ptr(tern_node * head, char * key, void * value);
+
+#endif //TERN_H_