comparison tern.c @ 768:2f48a3c187c6

Add support for reading cartridge memory map from ROM database, though without EEPROM support for now
author Michael Pavone <pavone@retrodev.com>
date Tue, 07 Jul 2015 19:33:33 -0700
parents 1b2f8280ba81
children 724bbec47f86
comparison
equal deleted inserted replaced
767:ea525f600b1d 768:2f48a3c187c6
105 105
106 void * tern_find_ptr_default(tern_node * head, char * key, void * def) 106 void * tern_find_ptr_default(tern_node * head, char * key, void * def)
107 { 107 {
108 tern_val ret; 108 tern_val ret;
109 if (tern_find(head, key, &ret)) { 109 if (tern_find(head, key, &ret)) {
110 return ret.ptrval; 110 if (ret.intval & 1) {
111 return (void *)(ret.intval & ~1);
112 } else {
113 return ret.ptrval;
114 }
111 } 115 }
112 return def; 116 return def;
113 } 117 }
114 118
115 void * tern_find_ptr(tern_node * head, char * key) 119 void * tern_find_ptr(tern_node * head, char * key)
191 } 195 }
192 keybuf[pos] = head->el; 196 keybuf[pos] = head->el;
193 tern_foreach_int(head->straight.next, fun, data, keybuf, pos+1); 197 tern_foreach_int(head->straight.next, fun, data, keybuf, pos+1);
194 } 198 }
195 if (head->right) { 199 if (head->right) {
196 tern_foreach_int(head->left, fun, data, keybuf, pos); 200 tern_foreach_int(head->right, fun, data, keybuf, pos);
197 } 201 }
198 } 202 }
199 203
200 void tern_foreach(tern_node *head, iter_fun fun, void *data) 204 void tern_foreach(tern_node *head, iter_fun fun, void *data)
201 { 205 {