LispBM
|
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <inttypes.h>
#include <lbm_memory.h>
#include <heap.h>
#include "symrepr.h"
#include "extensions.h"
#include "lbm_utils.h"
#include "lbm_image.h"
Data Structures | |
struct | special_sym |
Macros | |
#define | NUM_SPECIAL_SYMBOLS (sizeof(special_symbols) / sizeof(special_sym)) |
#define | NAME 0 |
#define | ID 1 |
#define | NEXT 2 |
Variables | |
special_sym const | special_symbols [] |
static lbm_uint * | symlist = NULL |
static lbm_uint | next_symbol_id = RUNTIME_SYMBOLS_START |
static lbm_uint | symbol_table_size_list = 0 |
static lbm_uint | symbol_table_size_list_flash = 0 |
static lbm_uint | symbol_table_size_strings = 0 |
static lbm_uint | symbol_table_size_strings_flash = 0 |
#define ID 1 |
#define NAME 0 |
#define NEXT 2 |
#define NUM_SPECIAL_SYMBOLS (sizeof(special_symbols) / sizeof(special_sym)) |
int lbm_add_symbol | ( | char * | name, |
lbm_uint * | id | ||
) |
Add a symbol to the symbol table. The symbol name string is copied to arrays and symbols memory.
name | String representation of the symbol. |
id | Resulting id is returned through this argument. |
int lbm_add_symbol_base | ( | char * | name, |
lbm_uint * | id | ||
) |
int lbm_add_symbol_const | ( | char * | name, |
lbm_uint * | id | ||
) |
Add a symbol to the symbol table. The name is assumed to be a statically allocated string.
name | Statically allocated name string. |
id | Resulting id is returned through this argument. |
int lbm_add_symbol_const_base | ( | char * | name, |
lbm_uint * | id, | ||
bool | link | ||
) |
Add a symbol to the symbol table. The name is assumed to be a statically allocated string.
name | Statically allocated name string. |
id | Resulting id is returned through this argument. |
link | If The variable assigned the ID is restored upon an image-boot. |
const char * lbm_get_name_by_symbol | ( | lbm_uint | id | ) |
Look up a symbol name from the symbol table given an id.
id | The id to look up in the symbol table. |
int lbm_get_symbol_by_name | ( | char * | name, |
lbm_uint * | id | ||
) |
Look up an id from the symbol table given a name.
name | Name string to look up. |
id | Resulting id is returned through this argument. |
lbm_uint * lbm_get_symbol_list_entry_by_name | ( | char * | name | ) |
Get a pointer to the list entry holding a symbol name, id mapping.
name | Name string to look up. |
lbm_uint lbm_get_symbol_table_size | ( | void | ) |
lbm_uint lbm_get_symbol_table_size_flash | ( | void | ) |
lbm_uint lbm_get_symbol_table_size_names | ( | void | ) |
lbm_uint lbm_get_symbol_table_size_names_flash | ( | void | ) |
int lbm_str_to_symbol | ( | char * | name, |
lbm_uint * | sym_id | ||
) |
Name of symbol to symbol. If the symbol exists the ID of the symbol is returned. If the name does not match any existing symbol, one is created and that ID is returned.
name | String name of symbol. |
id | Resulting ID is returned through this argument. |
bool lbm_symbol_in_flash | ( | char * | str | ) |
Check if a symbol name is stored in flash.
str | Symbol name string. |
bool lbm_symbol_list_entry_in_flash | ( | char * | str | ) |
Check if a symbol name id mapping list entry is stored in flash.
str | Symbol name string. |
int lbm_symrepr_init | ( | void | ) |
Initialize the symbol table.
void lbm_symrepr_name_iterator | ( | symrepr_name_iterator_fun | f | ) |
Iterate over all symbol names as strings
symrepr_name_iterator_fun | function taking a string |
void lbm_symrepr_set_symlist | ( | lbm_uint * | ls | ) |
Sets the symlist root element.
ls | Root element to set as the symlist. |
|
extern |
const char * lookup_symrepr_name_memory | ( | lbm_uint | id | ) |
bool store_symbol_name_flash | ( | char * | name, |
lbm_uint * | res | ||
) |
Store a symbol name on the constant heap (flash).
name | Symbol name. |
res | Pointer where result address in flash is returned. |
|
static |
special_sym const special_symbols[] |
|
static |
|
static |
|
static |
|
static |
|
static |