kb_symbol.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  kb_symbol_s
struct  kb_table_s

Defines

#define KB_SYMBOL_TYPE_NONE   -1
#define KB_SYMBOL_TYPE_SECTION   0
#define KB_SYMBOL_TYPE_ALIAS   1
#define KB_SYMBOL_TYPE_DEVICE   2
#define KB_SYMBOL_TYPE_REGISTER   3
#define KB_SYMBOL_NAME_SIZE   128
#define KB_SYMBOL_TABLE_SIZE   141

Typedefs

typedef struct kb_symbol_s kb_symbol_t
typedef struct kb_table_s kb_symbol_table_t

Functions

kb_symbol_table_tkb_create_symbol_table (kb_symbol_table_t *table)
void kb_destroy_symbol_table (kb_symbol_table_t *table)
unsigned long kb_hash (const char *name)
int kb_add_symbol (kb_symbol_table_t *table, kb_symbol_t *knew)
kb_symbol_tkb_lookup_symbol (kb_symbol_table_t *table, const char *name)
void kb_dump_symbol_table (kb_symbol_table_t *table)

Variables

const char * kb_symbol_type_names []


Define Documentation

#define KB_SYMBOL_NAME_SIZE   128

Definition at line 22 of file kb_symbol.h.

Referenced by kb_build_scoped_name(), kb_parse_alias(), and kb_parse_device().

#define KB_SYMBOL_TABLE_SIZE   141

#define KB_SYMBOL_TYPE_ALIAS   1

Definition at line 19 of file kb_symbol.h.

Referenced by kb_lookup_device(), kb_lookup_register(), and kb_parse_alias().

#define KB_SYMBOL_TYPE_DEVICE   2

Definition at line 20 of file kb_symbol.h.

Referenced by kb_lookup_device(), and kb_parse_device().

#define KB_SYMBOL_TYPE_NONE   -1

Definition at line 17 of file kb_symbol.h.

#define KB_SYMBOL_TYPE_REGISTER   3

Definition at line 21 of file kb_symbol.h.

Referenced by kb_lookup_register(), and kb_parse_register().

#define KB_SYMBOL_TYPE_SECTION   0

Definition at line 18 of file kb_symbol.h.

Referenced by kb_enum_alias(), kb_enum_device(), kb_enum_register(), and kb_parse_section().


Typedef Documentation

typedef struct kb_symbol_s kb_symbol_t

typedef struct kb_table_s kb_symbol_table_t


Function Documentation

int kb_add_symbol ( kb_symbol_table_t table,
kb_symbol_t knew 
)

This function adds a given symbol into a given table.

Parameters:
table A symbol table
new A new symbol
Returns:
A value:
  • 0 symbol already defined
  • 1 new symbol added

Definition at line 128 of file kb_symbol.c.

References kb_table_s::count, kb_hash(), KB_SYMBOL_TABLE_SIZE, kb_table_s::lock, kb_symbol_s::name, kb_symbol_s::next, and kb_table_s::symbols.

Referenced by kb_parse_alias(), kb_parse_device(), kb_parse_register(), and kb_parse_section().

Here is the call graph for this function:

kb_symbol_table_t* kb_create_symbol_table ( kb_symbol_table_t table  ) 

This function initializes a given table of symbol.

Parameters:
table A pointer to a symbol table or NULL.
Returns:
A pointer to the initialized symbol table

Definition at line 42 of file kb_symbol.c.

References kb_table_s::count, KB_ALLOC, KB_SYMBOL_TABLE_SIZE, kb_table_s::lock, and kb_table_s::symbols.

Referenced by kb_config_init().

void kb_destroy_symbol_table ( kb_symbol_table_t table  ) 

This function destroys all elements in a given symbol table.

Parameters:
table A pointer to the given symbol table
Remarks:
table is never freed.

Definition at line 67 of file kb_symbol.c.

References kb_symbol_s::alloc, kb_table_s::count, kb_free, KB_SYMBOL_TABLE_SIZE, kb_table_s::lock, kb_symbol_s::next, kb_table_s::symbols, and kb_symbol_s::value.

Referenced by kb_config_exit().

void kb_dump_symbol_table ( kb_symbol_table_t table  ) 

This function dumps the symbol table

Parameters:
table A symbol table

Definition at line 192 of file kb_symbol.c.

References kb_msg(), KB_SYMBOL_TABLE_SIZE, kb_symbol_type_names, kb_symbol_s::name, kb_symbol_s::next, kb_table_s::symbols, and kb_symbol_s::type.

Here is the call graph for this function:

unsigned long kb_hash ( const char *  name  ) 

This function calculates the hash value of a key.

Parameters:
name A string containing the key to hash
Returns:
a hash value
Remarks:
The hash function is case insensitive.

Definition at line 107 of file kb_symbol.c.

Referenced by kb_add_symbol(), and kb_lookup_symbol().

kb_symbol_t* kb_lookup_symbol ( kb_symbol_table_t table,
const char *  name 
)

This function find a symbol into a given table.

Parameters:
table A symbol table
name A string containing the name of the symbol to find.
Returns:
A Pointer to the symbol found or NULL if the symbol is not defined.

Definition at line 165 of file kb_symbol.c.

References kb_hash(), KB_SYMBOL_TABLE_SIZE, kb_symbol_s::name, kb_symbol_s::next, and kb_table_s::symbols.

Referenced by kb_enum_alias(), kb_enum_device(), kb_enum_register(), kb_lookup_device(), kb_lookup_register(), kb_parse_alias(), kb_parse_device(), kb_parse_register(), and kb_parse_section().

Here is the call graph for this function:


Variable Documentation

const char* kb_symbol_type_names[]

Symbol Type Names

Definition at line 31 of file kb_symbol.c.

Referenced by kb_dump_symbol_table().


Generated on Wed Dec 15 11:49:28 2010 for KoreBot Library by  doxygen 1.5.5