33 #include <avr/pgmspace.h>
36 #include "loader/sym.h"
40 static union sym_value
41 sym_lookup(const char *name,
const struct sym_bol *symbols,
int nelts)
44 int start, middle, end;
52 middle = (start + end) / 2;
54 PGM_P addr = (PGM_P)pgm_read_word(&symbols[middle].name);
55 r = strcmp_P(name, addr);
57 r = strcmp(name, symbols[middle].name);
65 ret.func = (sym_func_t)pgm_read_word(&symbols[middle].value);
68 return symbols[middle].value;
79 sym_object(
const char *name)
82 ret = sym_lookup(name, sym_obj, sym_obj_nelts);
90 ret = sym_lookup(name, sym_func, sym_func_nelts);
96 sym_function(
const char *name)
98 return sym_lookup(name, sym_func, sym_func_nelts).func;