32 #include <avr/pgmspace.h>
35 #include "loader/sym.h"
39 static union sym_value
40 sym_lookup(const char *name,
const struct sym_bol *symbols,
int nelts)
43 int start, middle, end;
51 middle = (start + end) / 2;
53 PGM_P addr = (PGM_P)pgm_read_word(&symbols[middle].name);
54 r = strcmp_P(name, addr);
56 r = strcmp(name, symbols[middle].name);
64 ret.func = (sym_func_t)pgm_read_word(&symbols[middle].value);
67 return symbols[middle].value;
78 sym_object(
const char *name)
81 ret = sym_lookup(name, sym_obj, sym_obj_nelts);
89 ret = sym_lookup(name, sym_func, sym_func_nelts);
95 sym_function(
const char *name)
97 return sym_lookup(name, sym_func, sym_func_nelts).func;
#define NULL
The null pointer.