1 | /* |
---|
2 | * File: symbols.h |
---|
3 | * |
---|
4 | * Description: |
---|
5 | * Entry points for symbol table routines. |
---|
6 | * |
---|
7 | * |
---|
8 | * |
---|
9 | * TODO: |
---|
10 | * |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef _INCLUDE_SYMBOLS_H |
---|
14 | #define _INCLUDE_SYMBOLS_H |
---|
15 | |
---|
16 | #ifdef __cplusplus |
---|
17 | extern "C" { |
---|
18 | #endif |
---|
19 | |
---|
20 | typedef struct { |
---|
21 | rtems_unsigned32 value; |
---|
22 | char *name; |
---|
23 | } rtems_symbol_t; |
---|
24 | |
---|
25 | #define SYMBOL_STRING_BLOCK_SIZE 4080 |
---|
26 | typedef struct rtems_symbol_string_block_s { |
---|
27 | struct rtems_symbol_string_block_s *next; |
---|
28 | char buffer[SYMBOL_STRING_BLOCK_SIZE]; |
---|
29 | } rtems_symbol_string_block_t; |
---|
30 | |
---|
31 | typedef struct { |
---|
32 | |
---|
33 | rtems_unsigned32 sorted; /* are symbols sorted right now? */ |
---|
34 | |
---|
35 | rtems_unsigned32 growth_factor; /* % to grow by when needed */ |
---|
36 | |
---|
37 | rtems_unsigned32 next; /* next symbol slot to use when adding */ |
---|
38 | rtems_unsigned32 size; /* max # of symbols */ |
---|
39 | |
---|
40 | /* |
---|
41 | * Symbol list -- sorted by address (when we do a lookup) |
---|
42 | */ |
---|
43 | |
---|
44 | rtems_symbol_t *addresses; /* symbol array by address */ |
---|
45 | |
---|
46 | /* |
---|
47 | * String list -- sorted by name (when we do a lookup) |
---|
48 | * This is a duplicate of the info in table->addresses, but it's |
---|
49 | * pretty small, so I don't worry about it. |
---|
50 | */ |
---|
51 | |
---|
52 | rtems_symbol_t *symbols; /* symbol array */ |
---|
53 | |
---|
54 | /* |
---|
55 | * String pool, unsorted, a list of blocks of string data |
---|
56 | */ |
---|
57 | |
---|
58 | rtems_symbol_string_block_t *string_buffer_head; |
---|
59 | rtems_symbol_string_block_t *string_buffer_current; |
---|
60 | rtems_unsigned32 strings_next; /* next byte to use in this block */ |
---|
61 | |
---|
62 | } rtems_symbol_table_t; |
---|
63 | |
---|
64 | void rtems_symbol_table_destroy(rtems_symbol_table_t *table); |
---|
65 | rtems_symbol_table_t *rtems_symbol_table_create(); |
---|
66 | rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, |
---|
67 | char *, rtems_unsigned32); |
---|
68 | rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, |
---|
69 | rtems_unsigned32); |
---|
70 | rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, |
---|
71 | char *); |
---|
72 | |
---|
73 | #define rtems_symbol_name(sp) ((sp)->name) |
---|
74 | #define rtems_symbol_value(sp) ((sp)->value) |
---|
75 | |
---|
76 | #ifdef __cplusplus |
---|
77 | } |
---|
78 | #endif |
---|
79 | |
---|
80 | #endif /* ! _INCLUDE_SYMBOLS_H */ |
---|