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

header file for table for coordinating meaning across a vmhost More...

#include "ceptr_types.h"
#include "ceptr_error.h"
Include dependency graph for semtable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _sem_context(sem, s)   __sem_context(sem,(s).context)
 
#define _sem_get_defs(sem, s)   __sem_get_defs(sem,(s).semtype,(s).context)
 
#define _sem_get_def(sem, s)   __sem_get_def(sem,(s).semtype,(s).context,(s).id)
 

Functions

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)
 
T__sem_get_defs (SemTable *st, 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 *s, Context ctx)
 
bool _sem_get_by_label (SemTable *sem, char *label, SemanticID *s)
 

Detailed Description

header file for table for coordinating meaning across a vmhost

Definition in file semtable.h.

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.