ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
semtable.c File Reference

implementation of table for coordinating meaning across a vmhost More...

#include "semtable.h"
#include "def.h"
Include dependency graph for semtable.c:

Go to the source code of this file.

char G_ctx_buf [20]
 
SemTable_sem_new ()
 
int _sem_new_context (SemTable *sem, T *definitions)
 
void _sem_free (SemTable *sem)
 
ContextStore__sem_context (SemTable *sem, Context c)
 
void _sem_free_context (SemTable *sem, Context c)
 
char * _sem_ctx2s (SemTable *sem, Context c)
 
T__sem_get_defs (SemTable *sem, SemanticType semtype, Context c)
 
T__sem_get_def (SemTable *sem, SemanticType semtype, Context c, SemanticAddr i)
 
char * _sem_get_name (SemTable *sem, SemanticID s)
 
T_sem_get_label (SemTable *sem, SemanticID s, Symbol label_type)
 
void _sem_add_label (SemTable *sem, SemanticID s, Symbol label_type, char *label)
 
Structure _sem_get_symbol_structure (SemTable *sem, Symbol s)
 
bool __sem_get_by_label (SemTable *sem, char *label, SemanticID *sid, Context c)
 
bool _sem_get_by_label (SemTable *sem, char *label, SemanticID *sid)
 

Detailed Description

implementation of table for coordinating meaning across a vmhost

Definition in file semtable.c.

Function Documentation

void _sem_add_label ( SemTable sem,
SemanticID  s,
Symbol  label_type,
char *  label 
)

add a name to a definition

Parameters
[in]semis the semantic table where symbols and structures are defined
[in]sthe semantic id of the definition to add a label to
[in]label_typeis a symbol of the label type to add
[in]labeltext of the label

Examples (from test suite):

spec_is_true(__sem_get_by_label(G_sem,"DEFINITIONS",&s,SYS_CONTEXT));
spec_is_sem_equal(s,DEFINITIONS);
spec_is_false(__sem_get_by_label(G_sem,"DEFINITIONS",&s,INTERNET_CONTEXT));
spec_is_true(_sem_get_by_label(G_sem,"OCTET_STREAM",&s));
spec_is_sem_equal(s,OCTET_STREAM);
spec_is_true(semeq(s,OCTET_STREAM));
spec_is_false(_sem_get_by_label(G_sem,"non existent symbol",&s));

Definition at line 148 of file semtable.c.

T* _sem_get_label ( SemTable sem,
SemanticID  s,
Symbol  label_type 
)

get one of a symbol's labels

Parameters
[in]semis the semantic table where symbols and structures are define
[in]sthe Symbol to return the label of
[in]sthe Symbol to return the label of
Returns
label or NULL if the definition couldn't be found
Note
the label returned is a pointer to the actual label in the definition. it must not be changed or modified! Clone it if you need to.

Examples (from test suite):

spec_is_str_equal(t2s(_sem_get_label(G_sem,CONTENT_TYPE,HTTP_HEADER_LABEL)),"(HTTP_HEADER_LABEL:Content-Type)");
spec_is_str_equal(t2s(_sem_get_label(G_sem,CONTENT_TYPE,TEST_SYMBOL_SYMBOL)),"(ENGLISH_LABEL:CONTENT_TYPE)");

Definition at line 124 of file semtable.c.

char* _sem_get_name ( SemTable sem,
SemanticID  s 
)

get symbol's name

Parameters
[in]semis the semantic table where symbols and structures are define
[in]sthe Symbol to return the label of
Returns
cstring surface of the first label in the definition

Examples (from test suite):

spec_is_str_equal(_sem_get_name(G_sem,TEST_INT_SYMBOL),"TEST_INT_SYMBOL");
spec_is_str_equal(_sem_get_name(G_sem,NULL_SYMBOL),"NULL_SYMBOL");
spec_is_str_equal(_sem_get_name(G_sem,NULL_STRUCTURE),"NULL_STRUCTURE");
spec_is_str_equal(_sem_get_name(G_sem,NULL_PROCESS),"NULL_PROCESS");
spec_is_str_equal(_sem_get_name(G_sem,DEFINITIONS),"DEFINITIONS");
spec_is_str_equal(_sem_get_name(G_sem,INTEGER),"INTEGER");
spec_is_str_equal(_sem_get_name(G_sem,IF),"IF");

Definition at line 85 of file semtable.c.