void
SymbCache_add_trigger(
const SymbCache_ptr self,
SymbTableTriggerFun trigger,
SymbTableTriggerAction action,
void* arg
)
- Adds a trigger to the symbol cache.
"arg" is the argument that will be passed to
function "trigger" when invoked.
The "action" parameter determines when "trigger"
is triggered. The possibilities are:
ST_TRIGGER_SYMBOL_ADD: Triggered when a symbol
is added. When the trigger is called, all
informations about the symbol are already
available (e.g. SymbType).
ST_TRIGGER_SYMBOL_REMOVE: Triggered when a
symbol is removed. All informations about the
symbol are still available when the trigger is
invoked.
ST_TRIGGER_SYMBOL_REDECLARE: Triggered when a
symbol that had been removed and later
redeclared with the same name. All
informations about the new symbol are
available, while informations about the old
symbol are not
- See Also
SymbCache_remove_trigger
- Defined in
SymbCache.c
SymbCache_ptr
SymbCache_create(
SymbTable_ptr symb_table
)
- Callable only by the SymbTable instance that owns self.
The caller keeps the ownership of given SymbTable instance
- Defined in
SymbCache.c
void
SymbCache_destroy(
SymbCache_ptr self
)
- Callable only by the SymbTable instance that owns self.
- Defined in
SymbCache.c
void
SymbCache_gen_iter(
const SymbCache_ptr self,
SymbTableIter* iter,
const unsigned int mask
)
- Generates an interator over the Symbol Cache symbols.
The iterator will ignore all symbols that do not
satisfy the mask
- Defined in
SymbCache.c
node_ptr
SymbCache_get_actual_parameter_context(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the context of the actual parameter associated
with the given formal parameter
- Defined in
SymbCache.c
node_ptr
SymbCache_get_actual_parameter(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the actual param of the given formal parameter
- Defined in
SymbCache.c
node_ptr
SymbCache_get_array_define_body(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the body of the given define array name
- Defined in
SymbCache.c
node_ptr
SymbCache_get_array_define_context(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the context of the given define array name
- Defined in
SymbCache.c
int
SymbCache_get_array_defines_num(
const SymbCache_ptr self
)
- Returns the number of define arrays.
- Defined in
SymbCache.c
int
SymbCache_get_constants_num(
const SymbCache_ptr self
)
- Returns the number of declared contants
- Defined in
SymbCache.c
node_ptr
SymbCache_get_define_body(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the body of the given DEFINE name
- Defined in
SymbCache.c
node_ptr
SymbCache_get_define_context(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the context of the given DEFINE name
- Defined in
SymbCache.c
node_ptr
SymbCache_get_define_flatten_body(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the flattenized body of the given DEFINE name
- Defined in
SymbCache.c
int
SymbCache_get_defines_num(
const SymbCache_ptr self
)
- Returns the number of DEFINEs.
- Defined in
SymbCache.c
node_ptr
SymbCache_get_flatten_actual_parameter(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the flattenized actual parameter of the given
formal parameter
- Defined in
SymbCache.c
int
SymbCache_get_frozen_vars_num(
const SymbCache_ptr self
)
- Returns the number of declared frozen variables.
- Defined in
SymbCache.c
node_ptr
SymbCache_get_function_context(
SymbCache_ptr self,
node_ptr name
)
- Returns the context of the given NFunction
- Defined in
SymbCache.c
int
SymbCache_get_functions_num(
const SymbCache_ptr self
)
- Returns the number of NFunctions.
- Defined in
SymbCache.c
NFunction_ptr
SymbCache_get_function(
SymbCache_ptr self,
node_ptr name
)
- Returns the NFunction instance of the given
function name
- Defined in
SymbCache.c
int
SymbCache_get_input_vars_num(
const SymbCache_ptr self
)
- Returns the number of declared input variables
- Defined in
SymbCache.c
int
SymbCache_get_parameters_num(
const SymbCache_ptr self
)
- Returns the number of parameters.
- Defined in
SymbCache.c
int
SymbCache_get_state_vars_num(
const SymbCache_ptr self
)
- Returns the number of declared state variables.
- Defined in
SymbCache.c
SymbTableType
SymbCache_get_symbol_type(
const SymbCache_ptr self,
const node_ptr symbol
)
- Get the symbol type. The symbol must be declared
in the cache
- Defined in
SymbCache.c
SymbType_ptr
SymbCache_get_var_type(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the type of a given variable
- Defined in
SymbCache.c
SymbType_ptr
SymbCache_get_variable_array_type(
const SymbCache_ptr self,
const node_ptr name
)
- Returns the type of array variable, i.e. of variable_array
- Defined in
SymbCache.c
int
SymbCache_get_variable_arrays_num(
const SymbCache_ptr self
)
- Returns the number of Symbol Types.
- Defined in
SymbCache.c
boolean
SymbCache_is_iter_end(
const SymbCache_ptr self,
const SymbTableIter* iter
)
- Checks if the iterator is at it's end
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_array_define(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
define array
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_constant(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
constant
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_declared(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is declared
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_define(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
DEFINE
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_frozen_var(
const SymbCache_ptr self,
const node_ptr name
)
- A variable is frozen if it is known that the var cannot
change its value during transitions.
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_function(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
NFunction
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_input_var(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is an input
variable.
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_parameter(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared formal
parameter
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_state_frozen_var(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the variable is a frozen or a state
variable
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_state_var(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a state variable.
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_variable_array(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
array variable, i.e symbol type
- Defined in
SymbCache.c
boolean
SymbCache_is_symbol_var(
const SymbCache_ptr self,
const node_ptr name
)
- Returns true if the given symbol is either a state, a frozen or
an input variable.
- Defined in
SymbCache.c
node_ptr
SymbCache_iter_get_symbol(
const SymbCache_ptr self,
const SymbTableIter* iter
)
- Get the symbol pointed by the iterator
- Defined in
SymbCache.c
void
SymbCache_iter_set_filter(
const SymbCache_ptr self,
SymbTableIter* iter,
SymbTableIterFilterFun filter,
void* arg
)
- Sets the filter for an interator over the
Symbol Cache symbols. The iterator will be moved
in order to point to a symbol that satisfies
both the mask and the filter
- Defined in
SymbCache.c
boolean
SymbCache_list_contains_input_var(
const SymbCache_ptr self,
const NodeList_ptr var_list
)
- The given list of variables is traversed until an input
variable is found
- Defined in
SymbCache.c
boolean
SymbCache_list_contains_state_frozen_var(
const SymbCache_ptr self,
const NodeList_ptr var_list
)
- The given list of variables is traversed until
a state or frozen variable is found
- Defined in
SymbCache.c
boolean
SymbCache_list_contains_undef_var(
const SymbCache_ptr self,
const NodeList_ptr var_list
)
- Iterates through the elements in var_list
checking each one to see if it is one undeclared variable.
- Defined in
SymbCache.c
void
SymbCache_new_array_define(
SymbCache_ptr self,
node_ptr name,
node_ptr ctx,
node_ptr definition
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
Internally we use ARRAY_DEF node to recognize a define array.
- Defined in
SymbCache.c
void
SymbCache_new_constant(
SymbCache_ptr self,
node_ptr name
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted. Multiple-time
declared constant are accepted, and a reference count is kept to deal with
them
- Defined in
SymbCache.c
void
SymbCache_new_define(
SymbCache_ptr self,
node_ptr name,
node_ptr ctx,
node_ptr definition
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_new_frozen_var(
SymbCache_ptr self,
node_ptr var,
SymbType_ptr type
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- See Also
SymbCache_redeclare_state_as_frozen_var
- Defined in
SymbCache.c
void
SymbCache_new_function(
SymbCache_ptr self,
node_ptr name,
node_ptr ctx,
NFunction_ptr fun
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_new_input_var(
SymbCache_ptr self,
node_ptr var,
SymbType_ptr type
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_new_parameter(
SymbCache_ptr self,
node_ptr formal,
node_ptr ctx,
node_ptr actual
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_new_state_var(
SymbCache_ptr self,
node_ptr var,
SymbType_ptr type
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_new_variable_array(
SymbCache_ptr self,
node_ptr name,
SymbType_ptr type
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_next_iter(
const SymbCache_ptr self,
SymbTableIter* iter
)
- Moves the iterator over the next symbol,
regarding to the mask given when built using
SymbCache_gen_iter
- Defined in
SymbCache.c
void
SymbCache_redeclare_state_as_frozen_var(
SymbCache_ptr self,
node_ptr name
)
- A variable is frozen if it is known that its value cannot
be changed during transitions.
The given 'name' has to be already declared state variable and not yet
redeclared as frozen.
- See Also
SymbCache_new_frozen_var
- Defined in
SymbCache.c
void
SymbCache_remove_constant(
SymbCache_ptr self,
node_ptr constant
)
- Removal is performed taking into account of reference
counting, as constants can be shared among several layers. This
(private) method can be used only by SymbLayer, otherwise the
resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_remove_define(
SymbCache_ptr self,
node_ptr define
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_remove_function(
SymbCache_ptr self,
node_ptr fun
)
- This (private) method can be used only by
SymbLayer, otherwise the resulting status
will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_remove_parameter(
SymbCache_ptr self,
node_ptr formal
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
void
SymbCache_remove_symbols(
SymbCache_ptr self,
const node_ptr* symbols,
const unsigned int size
)
- Removes all the symbols in the array in
linear time
- Defined in
SymbCache.c
void
SymbCache_remove_trigger(
const SymbCache_ptr self,
SymbTableTriggerFun trigger,
SymbTableTriggerAction action
)
- Removes a trigger from the symbol cache
- See Also
SymbCache_add_trigger
- Defined in
SymbCache.c
void
SymbCache_remove_var(
SymbCache_ptr self,
node_ptr var
)
- This (private) method can be used only by SymbLayer,
otherwise the resulting status will be corrupted.
- Defined in
SymbCache.c
boolean
SymbLayer_can_declare_array_define(
const SymbLayer_ptr self,
const node_ptr name
)
- Returns true if the given symbol does not exist within
the symbol table which self belongs to. Returns false if the symbol
was already declared.
- Defined in
SymbLayer.c
boolean
SymbLayer_can_declare_constant(
const SymbLayer_ptr self,
const node_ptr name
)
- Since more than one layer can declare the same constants,
this method might return true even if another layer already contain the
given constant. If the constant had already been declared within self,
false is returned.
- Defined in
SymbLayer.c
boolean
SymbLayer_can_declare_define(
const SymbLayer_ptr self,
const node_ptr name
)
- Returns true if the given symbol does not exist within
the symbol table which self belongs to. Returns false if the symbol
was already declared.
- Defined in
SymbLayer.c
boolean
SymbLayer_can_declare_function(
const SymbLayer_ptr self,
const node_ptr name
)
- Returns true if the given symbol does not exist
within the symbol table which self belongs to. Returns
false if the symbol was already declared.
- Defined in
SymbLayer.c
boolean
SymbLayer_can_declare_parameter(
const SymbLayer_ptr self,
const node_ptr name
)
- Returns true if the given symbol does not exist within
the symbol table which self belongs to. Returns false if the symbol
was already declared.
- Defined in
SymbLayer.c
boolean
SymbLayer_can_declare_variable_array(
const SymbLayer_ptr self,
const node_ptr name
)
- Returns true if the given symbol does not exist within
the symbol table which self belongs to. Returns false if the symbol
was already declared.
- Defined in
SymbLayer.c
boolean
SymbLayer_can_declare_var(
const SymbLayer_ptr self,
const node_ptr name
)
- Returns true if the given symbol does not exist
within the symbol table which self belongs to. Returns
false if the symbol was already declared.
- Defined in
SymbLayer.c
void
SymbLayer_committed_to_enc(
SymbLayer_ptr self
)
- This method is part of a private registration protocol
between encodings and layers, and must be considered as a private
method. Every time a layer is registered (committed) within an
enconding, the layer is notified with a call to this method from the
encoding instance which the layer is committed to. This mechanism
helps to detect errors when a layer in use by an encoding is removed
and destroyed from within a symbol table. The destructor will always
check that self is not in use by any encoding when it is invoked.
- See Also
removed_from_enc
- Defined in
SymbLayer.c
SymbLayer_ptr
SymbLayer_create(
const char* name,
const LayerInsertPolicy policy,
SymbCache_ptr cache
)
- name is copied, the caller keeps ownership of cache.
- Defined in
SymbLayer.c
void
SymbLayer_declare_array_define(
SymbLayer_ptr self,
node_ptr name,
node_ptr context,
node_ptr definition
)
- A new define array of a given value is created. name must be
contestualized, context is provided as a separated information
- Defined in
SymbLayer.c
void
SymbLayer_declare_constant(
SymbLayer_ptr self,
node_ptr name
)
- A new constant is created
- See Also
SymbLayer_can_declare_constant
- Defined in
SymbLayer.c
void
SymbLayer_declare_define(
SymbLayer_ptr self,
node_ptr name,
node_ptr context,
node_ptr definition
)
- A new DEFINE of a given value is created. name must be
contestualized, context is provided as a separated information
- Defined in
SymbLayer.c
void
SymbLayer_declare_frozen_var(
SymbLayer_ptr self,
node_ptr var_name,
SymbType_ptr type
)
- A new frozen variable is created of a given type.
The variable type can be created with SymbType_create or returned by
funtions SymbTablePkg_..._type.
The layer is responsible for destroying the variable's type.
- Defined in
SymbLayer.c
void
SymbLayer_declare_function(
SymbLayer_ptr self,
node_ptr name,
node_ptr ctx,
NFunction_ptr fun
)
- A new NFunction is declared within the layer.
Name must be contestualized, context is provided
as a separated information
- See Also
SymbLayer_can_declare_function
- Defined in
SymbLayer.c
void
SymbLayer_declare_input_var(
SymbLayer_ptr self,
node_ptr var_name,
SymbType_ptr type
)
- A new input variable is created of a given type.
The variable type can be created with SymbType_create or returned by
funtions SymbTablePkg_..._type.
The layer is responsible for destroying the variable's type.
- Defined in
SymbLayer.c
void
SymbLayer_declare_parameter(
SymbLayer_ptr self,
node_ptr formal,
node_ptr context,
node_ptr actual
)
- A new parameter of a given value is created. name must be
contestualized, context is provided as a separated information
- Defined in
SymbLayer.c
void
SymbLayer_declare_state_var(
SymbLayer_ptr self,
node_ptr var_name,
SymbType_ptr type
)
- A new state variable is created of a given type.
The variable type can be created with SymbType_create or returned by
funtions SymbTablePkg_..._type.
The layer is responsible for destroying the variable's type.
- Defined in
SymbLayer.c
void
SymbLayer_declare_variable_array(
SymbLayer_ptr self,
node_ptr name,
SymbType_ptr type
)
- The specified name will be associated to the give array type
in the symbols collection
- Defined in
SymbLayer.c
void
SymbLayer_destroy_raw(
SymbLayer_ptr self
)
- Use this destructor if the SymbCache will be
destroyed after this call (ie. You are
destroying the Symbol Table)
- Defined in
SymbLayer.c
void
SymbLayer_destroy(
SymbLayer_ptr self
)
- Use this destructor if the SymbCache will not be
destroyed after this call (ie. You are removing
a layer from the Symbol Table)
- Defined in
SymbLayer.c
void
SymbLayer_gen_iter(
const SymbLayer_ptr self,
SymbLayerIter* iter,
const unsigned int mask
)
- Generates an interator over the Symbol Cache symbols.
The iterator will ignore all symbols that do not
satisfy the mask
- Defined in
SymbLayer.c
int
SymbLayer_get_array_defines_num(
const SymbLayer_ptr self
)
- Returns the number of define arrays.
- Defined in
SymbLayer.c
int
SymbLayer_get_bool_frozen_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared boolean frozen variables
- Defined in
SymbLayer.c
int
SymbLayer_get_bool_input_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared boolean input variables
- Defined in
SymbLayer.c
int
SymbLayer_get_bool_state_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared boolean state variables
- Defined in
SymbLayer.c
int
SymbLayer_get_constants_num(
const SymbLayer_ptr self
)
- Returns the number of declared contants
- Defined in
SymbLayer.c
int
SymbLayer_get_defines_num(
const SymbLayer_ptr self
)
- Returns the number of DEFINEs.
- Defined in
SymbLayer.c
int
SymbLayer_get_frozen_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared frozen variables.
- Defined in
SymbLayer.c
int
SymbLayer_get_functions_num(
const SymbLayer_ptr self
)
- Returns the number of NFunctions.
- Defined in
SymbLayer.c
int
SymbLayer_get_input_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared input variables
- Defined in
SymbLayer.c
LayerInsertPolicy
SymbLayer_get_insert_policy(
const SymbLayer_ptr self
)
- This method is thought to be used exclusively by class
SymbTable
- Defined in
SymbLayer.c
const char*
SymbLayer_get_name(
const SymbLayer_ptr self
)
- Returned string must not be freed, it belongs to self
- Defined in
SymbLayer.c
int
SymbLayer_get_parameters_num(
const SymbLayer_ptr self
)
- Returns the number of parameters.
- Defined in
SymbLayer.c
int
SymbLayer_get_state_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared state variables.
- Defined in
SymbLayer.c
int
SymbLayer_get_symbols_num(
const SymbLayer_ptr self
)
- Returns the number of declared symbols
- Defined in
SymbLayer.c
int
SymbLayer_get_variable_arrays_num(
const SymbLayer_ptr self
)
- Returns the number of Symbol Types.
- Defined in
SymbLayer.c
int
SymbLayer_get_vars_num(
const SymbLayer_ptr self
)
- Returns the number of declared variables
- Defined in
SymbLayer.c
boolean
SymbLayer_is_symbol_in_layer(
SymbLayer_ptr self,
node_ptr name
)
- Returns true if the symbol is defined in the layer.
- Defined in
SymbLayer.c
boolean
SymbLayer_is_variable_in_layer(
SymbLayer_ptr self,
node_ptr name
)
- Returns true if the variable is defined in the layer.
- Defined in
SymbLayer.c
unsigned int
SymbLayer_iter_count(
const SymbLayer_ptr self,
SymbLayerIter iter
)
- Counts the elements of the iterator.
The iter will not be consumed (since passed as
copy)
- Defined in
SymbLayer.c
boolean
SymbLayer_iter_filter_bool_vars(
const SymbLayer_ptr self,
const node_ptr sym,
void* arg
)
- SymbLayer built-in filter: Returns true iff the symbol
is a boolean variable
- Defined in
SymbLayer.c
node_ptr
SymbLayer_iter_get_symbol(
const SymbLayer_ptr self,
const SymbLayerIter* iter
)
- Get the symbol pointed by the iterator
- Defined in
SymbLayer.c
boolean
SymbLayer_iter_is_end(
const SymbLayer_ptr self,
const SymbLayerIter* iter
)
- Checks if the iterator is at it's end
- Defined in
SymbLayer.c
void
SymbLayer_iter_next(
const SymbLayer_ptr self,
SymbLayerIter* iter
)
- Moves the iterator over the next symbol,
regarding to the mask given when built using
SymbCache_gen_iter
- Defined in
SymbLayer.c
void
SymbLayer_iter_set_filter(
const SymbLayer_ptr self,
SymbLayerIter* iter,
SymbLayerIterFilterFun filter,
void* arg
)
- Sets the filter for an interator over the
Symbol Layer symbols. The iterator will be moved
in order to point to a symbol that satisfies
both the mask and the filter
- Defined in
SymbLayer.c
NodeList_ptr
SymbLayer_iter_to_list(
const SymbLayer_ptr self,
SymbLayerIter iter
)
- Generates a list starting from the given iterator.
The iter will not be consumed (since passed as
copy)
- Defined in
SymbLayer.c
Set_t
SymbLayer_iter_to_set(
const SymbLayer_ptr self,
SymbLayerIter iter
)
- Generates a set starting from the given iterator.
The iter will not be consumed (since passed as
copy)
- Defined in
SymbLayer.c
boolean
SymbLayer_must_insert_before(
const SymbLayer_ptr self,
const SymbLayer_ptr other
)
- Compares the insertion policies of self and other, and
returns true if self must be inserted *before* other.
- Defined in
SymbLayer.c
EXTERN void
SymbLayer_redeclare_state_as_frozen_var(
SymbLayer_ptr self,
node_ptr var
)
- A variable is frozen if it is known then the var's value
cannot change in transitions.
'var' must be a state variable already defined and not redeclared as frozen.
- Defined in
SymbLayer.c
void
SymbLayer_remove_define(
SymbLayer_ptr self,
node_ptr name
)
- This method can be called only if self is not
currently commited to any encoding. It is not allowed to remove
symbols from layers that are committed to any encoder. This is
required as caches and other mechanisms may fail to work
correctly otherwise.
- Defined in
SymbLayer.c
void
SymbLayer_remove_function(
SymbLayer_ptr self,
node_ptr name
)
- This method can be called only if self is not
currently commited to any encoding. It is not allowed to remove
symbols from layers that are committed to any encoder. This is
required as caches and other mechanisms may fail to work
correctly otherwise.
- Defined in
SymbLayer.c
void
SymbLayer_remove_var(
SymbLayer_ptr self,
node_ptr name
)
- This method can be called only if self is not
currently commited to any encoding. It is not allowed to remove
symbols from layers that are committed to any encoder. This is
required as caches and other mechanisms may fail to work
correctly otherwise.
- Defined in
SymbLayer.c
void
SymbLayer_removed_from_enc(
SymbLayer_ptr self
)
- This method is part of a private registration protocol
between encodings and layers, and must be considered as a private
method. Every time a layer is removed (uncommitted) from an
enconding, the layer is notified with a call to this method from the
encoding instance which the layer is being removed from. This mechanism
helps to detect errors when a layer in use by an encoding is removed
and destroyed from within a symbol table. The destructor will always
check that self is not in use by any encoding when it is invoked.
- See Also
commit_to_enc
- Defined in
SymbLayer.c
void
SymbLayer_set_name(
SymbLayer_ptr self,
const char* new_name
)
- This method is protected (not usable by users, only
used by the symbol table when renaming a layer
- Defined in
SymbLayer.c
SymbType_ptr
SymbTablePkg_array_type(
SymbType_ptr subtype,
int lower_bound,
int upper_bound
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
PRECONDITION: subtype has to be created with one of SymbTypePkg_.._type
function.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_boolean_set_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_boolean_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_error_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
void
SymbTablePkg_init(
)
- This initialisation can be performed only after
the Node package and the variable boolean_range have been initialised.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_int_symbolic_enum_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
Do not access the values contained in the type's body.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_integer_set_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_integer_symbolic_set_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_integer_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_no_type(
)
- This type is a type of correct expressions
which normally do not have any time.
The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_pure_int_enum_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
Do not access the values contained in the type's body.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_pure_symbolic_enum_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
Do not access the values contained in the type's body.
- Defined in
symb_table.c
void
SymbTablePkg_quit(
)
- WARNING: the package de-initialisation
destroys types created with the function SymbTablePkg_..._type.
NB: The reason behind this constrain is the following: these functions
exploit memory sharing, and this memory is freed during
de-initialisation.
In any case, the de-initialisation is performed by
system "reset" command, and this command also frees all node_ptr,
so in any case the symbolic types will be unusable, because they
use node_ptr inside.
SO, DESTROY ALL SYMBOLIC TYPES CREATED SO FAR BEFORE THE symb_table
PACKAGE DE-INITIALISATION!
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_real_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_signed_word_type(
int width
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_statement_type(
)
- This type is a type of correct expressions which are
statements, like assignments, or high-level nodes like TRANS, INIT,
etc. The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_string_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_symbolic_set_type(
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_unsigned_word_type(
int width
)
- The memory is shared, so you can compare pointers to
compare types. De-initialisation of the package destroys this type.
- Defined in
symb_table.c
SymbType_ptr
SymbTablePkg_wordarray_type(
int awidth,
int vwidth
)
- The memory is shared, so you can compare pointers to
compare types. The association is done based on the cons of awidth and vwidth.
De-initialisation of the package destroys this type.
- Defined in
symb_table.c
void
SymbTable_add_trigger(
const SymbTable_ptr self,
SymbTableTriggerFun trigger,
SymbTableTriggerAction action,
void* arg
)
- Adds a trigger to the symbol table.
"arg" is the argument that will be passed to
function "trigger" when invoked.
The "action" parameter determines when "trigger"
is triggered. The possibilities are:
ST_TRIGGER_SYMBOL_ADD: Triggered when a symbol
is added. When the trigger is called, all
informations about the symbol are already
available (e.g. SymbType).
ST_TRIGGER_SYMBOL_REMOVE: Triggered when a
symbol is removed. This may happen when
removing a layer from the symbol table, or
when removing a variable from a layer. All
informations about the symbol are still
available when the trigger is invoked
ST_TRIGGER_SYMBOL_REDECLARE: Triggered when a
symbol that had been removed from the symbol
table, or a from a layer, is redeclared with
the same name. All informations about the new
symbol are available, while informations about
the old symbol are not
- See Also
SymbTable_remove_trigger
- Defined in
SymbTable.c
boolean
SymbTable_contains_infinite_precision_variables(
const SymbTable_ptr self
)
- Checks whether the Symbol Table contains infinite
precision variables
- Defined in
SymbTable.c
SymbTable_ptr
SymbTable_copy(
const SymbTable_ptr self,
Set_t blacklist
)
- Returned ST is allocated and has to be released by caller.
The copy is performed iterating over each layer in the
Symbol Table. The new ST contains a copy of each layer of
the given Symbol Table
- See Also
SymbTable_create
SymbTable_destroy
- Defined in
SymbTable.c
void
SymbTable_create_layer_class(
SymbTable_ptr self,
const char* class_name
)
- This method creates a new class of layers. The
class must be not existing. The method can be used to create a
class of layers that might be empty. It is not required to
create a class before calling methods that use that class, like
e.g. SymbTable_layer_add_to_class that wll create the class
when not existing. class_name can be NULL to create the default
class (whose name must have been previously specified with
SymbTable_set_default_layers_class_name)
- See Also
SymbTable_layer_add_to_class
- Defined in
SymbTable.c
SymbLayer_ptr
SymbTable_create_layer(
SymbTable_ptr self,
const char* layer_name,
const LayerInsertPolicy ins_policy
)
- The created layer is returned. Do not destroy the
layer, since it belongs to self. if layer name is NULL, then a
temporary name will be searched and a new layer will be created. To
retrieve the layer name, query the returned SymbLayer instance.
- See Also
remove_layer
- Defined in
SymbTable.c
SymbTable_ptr
SymbTable_create(
)
- Class constructor
- Defined in
SymbTable.c
SymbLayer_ptr
SymbTable_define_get_layer(
SymbTable_ptr self,
node_ptr name
)
- Returns the layer a DEFINE is defined in, NULL
if there is no layer containing it.
- Defined in
SymbTable.c
void
SymbTable_destroy(
SymbTable_ptr self
)
- Class destructor
- Defined in
SymbTable.c
void
SymbTable_foreach(
const SymbTable_ptr self,
unsigned int mask,
SymbTableForeachFun fun,
void* arg
)
- Executes the given function over each symbol
that satisfies the given symbol mask
- Defined in
SymbTable.c
SymbLayer_ptr
SymbTable_function_get_layer(
SymbTable_ptr self,
node_ptr name
)
- Returns the layer a NFunction is defined in, NULL
if there is no layer containing it.
- Defined in
SymbTable.c
void
SymbTable_gen_iter(
const SymbTable_ptr self,
SymbTableIter* iter,
unsigned int mask
)
- Initializes the given iterator with the given mask.
It is fundamental to call this procedure before
using the iterator.
SYMB_TABLE_FOREACH and SYMB_TABLE_FOREACH_FILTER
automaticcaly call this function, so the caller
does not have to worry about that.
- Defined in
SymbTable.c
node_ptr
SymbTable_get_actual_parameter_context(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the context of the actual parameter associated
with the given formal one
- Defined in
SymbTable.c
node_ptr
SymbTable_get_actual_parameter(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the actual param of the given formal parameter
- Defined in
SymbTable.c
node_ptr
SymbTable_get_array_define_body(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the body of the given array define name
- Defined in
SymbTable.c
node_ptr
SymbTable_get_array_define_context(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the context of the given array define name
- Defined in
SymbTable.c
node_ptr
SymbTable_get_array_define_flatten_body(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the flattened body of the given array define name
- Defined in
SymbTable.c
int
SymbTable_get_array_defines_num(
const SymbTable_ptr self
)
- Returns the number of all declared array define
- Defined in
SymbTable.c
array_t*
SymbTable_get_class_layer_names(
SymbTable_ptr self,
const char* class_name
)
- Specified class must be existing, or if NULL is
specified a default class must have been defined. Returned
array belongs to self and has NOT to be destroyed or changed by
the caller.
- Defined in
SymbTable.c
const char*
SymbTable_get_class_of_layer(
const SymbTable_ptr self,
const char* layer_name
)
- Returns the name of the class in which the given layer is
declared or NULL if there is no such a class.
- Defined in
SymbTable.c
int
SymbTable_get_constants_num(
const SymbTable_ptr self
)
- Returns the number of all declared constants
- Defined in
SymbTable.c
const char*
SymbTable_get_default_layers_class_name(
const SymbTable_ptr self
)
- Returned string belongs to self, and must be NOT
destroyed or changed. Returned string is NULL if not previously set.
- See Also
SymbTable_set_default_layers_class_name
- Defined in
SymbTable.c
node_ptr
SymbTable_get_define_body(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the body of the given DEFINE
- Defined in
SymbTable.c
node_ptr
SymbTable_get_define_context(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the context of the given DEFINE name
- Defined in
SymbTable.c
node_ptr
SymbTable_get_define_flatten_body(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the flattenized body of the given
define
- Defined in
SymbTable.c
int
SymbTable_get_defines_num(
const SymbTable_ptr self
)
- Returns the number of all declared defines
- Defined in
SymbTable.c
node_ptr
SymbTable_get_determinization_var_name(
const SymbTable_ptr self
)
- Returns a valid name for a new determinization
variable. Searches in the symbol table for a
variable name which is not declared yet, and
returns it. Warning: This method does not
declare a new variable, it simply finds a
valid name for a new determinization
variable. If the returned variable name is
not used later to declare a new variable,
succeed calls to this method may not return a
valid name.
- See Also
symb_table_deinit
- Defined in
SymbTable.c
node_ptr
SymbTable_get_flatten_actual_parameter(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the flattenized actual parameter of the given
formal parameter
- Defined in
SymbTable.c
node_ptr
SymbTable_get_fresh_symbol_name(
SymbTable_ptr self,
const char* tplate
)
- If tplate is NULL then a valid fresh symbol is choosed.
NB: here tplate actually means prefix.
- Defined in
SymbTable.c
int
SymbTable_get_frozen_vars_num(
const SymbTable_ptr self
)
- Returns the number of all declared frozen variables
- Defined in
SymbTable.c
node_ptr
SymbTable_get_function_context(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the context of the NFunction with the given name
- Defined in
SymbTable.c
int
SymbTable_get_functions_num(
const SymbTable_ptr self
)
- Returns the number of all NFunctions
- Defined in
SymbTable.c
NFunction_ptr
SymbTable_get_function(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the NFunction with the given name
- Defined in
SymbTable.c
int
SymbTable_get_input_vars_num(
const SymbTable_ptr self
)
- Returns the number of all declared input variables
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers_i_symbols(
SymbTable_ptr self,
const array_t* layer_names
)
- Everytime this method is called, it will create and
calculate a new list. layers is an array of strings.
WARNING: The returned instance must be destroyed by the caller
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers_i_vars(
SymbTable_ptr self,
const array_t* layer_names
)
- Everytime this method is called, it will create and
calculate a new list. layers is an array of strings.
WARNING: The returned instance must be destroyed by the caller
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers_sf_i_symbols(
SymbTable_ptr self,
const array_t* layer_names
)
- Everytime this method is called, it will create and
calculate a new list. layers is an array of strings.
WARNING: The returned instance must be destroyed by the caller
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers_sf_i_vars(
SymbTable_ptr self,
const array_t* layer_names
)
- Everytime this method is called, it will create and
calculate a new list. layers is an array of strings.
WARNING: The returned instance must be destroyed by the caller
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers_sf_symbols(
SymbTable_ptr self,
const array_t* layer_names
)
- Everytime this method is called, it will create and
calculate a new list. layers is an array of strings.
WARNING: The returned instance must be destroyed by the caller.
Note: state symbols include frozen variables.
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers_sf_vars(
SymbTable_ptr self,
const array_t* layer_names
)
- Everytime this method is called, it will create and
calculate a new list. layers is an array of strings.
WARNING: The returned instance must be destroyed by the caller
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_get_layers(
const SymbTable_ptr self
)
- The returned list belongs to self. Do not free or
change it.
- Defined in
SymbTable.c
SymbLayer_ptr
SymbTable_get_layer(
const SymbTable_ptr self,
const char* layer_name
)
- NULL is returned when the layer does not exist within
self. Returned SymbLayer instance belongs to self.
- Defined in
SymbTable.c
int
SymbTable_get_parameters_num(
const SymbTable_ptr self
)
- Returns the number of all parameters
- Defined in
SymbTable.c
hash_ptr
SymbTable_get_simplification_hash(
SymbTable_ptr self
)
- See function Expr_simplify for more details.
- Defined in
SymbTable.c
int
SymbTable_get_state_vars_num(
const SymbTable_ptr self
)
- Returns the number of all declared state variables
- Defined in
SymbTable.c
SymbCategory
SymbTable_get_symbol_category(
const SymbTable_ptr self,
node_ptr symbol
)
- Possible categories are: state vars, input vars, state
only defines, input only defines, state-input defines,
state-input-next defines. If a symbol is not properly recognized as
one of the above, SYMBOL_INVALID is returned (for constants, for examples).
An identifier is var or define. It is also allowed to have arrays
with constant index, i.e. if V is identifier than V[5
- Side Effects None
- Defined in
SymbTable.c
TypeChecker_ptr
SymbTable_get_type_checker(
const SymbTable_ptr self
)
- Returned instance belongs to self
- Defined in
SymbTable.c
SymbType_ptr
SymbTable_get_var_type(
const SymbTable_ptr self,
const node_ptr name
)
- The type belongs to the layer, do not destroy it.
- Defined in
SymbTable.c
SymbType_ptr
SymbTable_get_variable_array_type(
const SymbTable_ptr self,
const node_ptr name
)
- Returns the body of the given array define name
- Defined in
SymbTable.c
int
SymbTable_get_vars_num(
const SymbTable_ptr self
)
- Returns the number of all declared variables
- Defined in
SymbTable.c
boolean
SymbTable_is_layer_in_class(
SymbTable_ptr self,
const char* layer_name,
const char* class_name
)
- If class_name is NULL, the default class will be checked
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_array_define(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
array define
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_bool_var(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a variable of enum type
with the values 0 and 1 (boolean)
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_constant(
const SymbTable_ptr self,
const node_ptr name
)
- Notice that this method will check only symbols defined
within self. For example if an integer constant was not declared
within self, this method will return false for it. For generic
expressions, consider using function node_is_leaf which performs a
purely-syntactly check.
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_declared(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is declared
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_define(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
DEFINE
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_frozen_var(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a frozen variable.
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_function(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
NFunction
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_input_var(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is an input variable.
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_parameter(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
parameter
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_state_frozen_var(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a frozen or a state variable.
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_state_var(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a state variable.
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_variable_array(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is a declared
variable array
- Defined in
SymbTable.c
boolean
SymbTable_is_symbol_var(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given symbol is either a state, frozen or
an input variable.
- Defined in
SymbTable.c
boolean
SymbTable_is_var_finite(
const SymbTable_ptr self,
const node_ptr name
)
- Returns true if the given variable has a finite domain
- Defined in
SymbTable.c
unsigned int
SymbTable_iter_count(
const SymbTable_ptr self,
SymbTableIter iter
)
- Counts the elements of the iterator. The iterator
is NOT changed (it is passed as value..)
- Defined in
SymbTable.c
boolean
SymbTable_iter_filter_i_symbols(
const SymbTable_ptr self,
const node_ptr sym,
void* arg
)
- Default iterator filter: Input symbols.
Only defines that predicate over input variables
or input variables themselfs satisfy this
filter.
- Defined in
SymbTable.c
boolean
SymbTable_iter_filter_sf_i_symbols(
const SymbTable_ptr self,
const node_ptr sym,
void* arg
)
- Default iterator filter: State, Frozen and Input symbols.
Only defines that predicate over state or frozen
AND input variables or variables themselfs
satisfy this filter.
- Defined in
SymbTable.c
boolean
SymbTable_iter_filter_sf_symbols(
const SymbTable_ptr self,
const node_ptr sym,
void* arg
)
- Default iterator filter: State, Frozen symbols.
Only defines that predicate over state or frozen
variables or state / frozen variables themselfs
satisfy this filter.
- Defined in
SymbTable.c
node_ptr
SymbTable_iter_get_symbol(
const SymbTable_ptr self,
const SymbTableIter* iter
)
- Gets the symbol pointed by the given iterator.
The given iterator must not be at it's end
- Defined in
SymbTable.c
boolean
SymbTable_iter_is_end(
const SymbTable_ptr self,
const SymbTableIter* iter
)
- Checks if the iterator is at it's end
- Defined in
SymbTable.c
void
SymbTable_iter_next(
const SymbTable_ptr self,
SymbTableIter* iter
)
- Moves the iterator to the next valid symbol
- Defined in
SymbTable.c
void
SymbTable_iter_set_filter(
const SymbTable_ptr self,
SymbTableIter* iter,
SymbTableIterFilterFun fun,
void* arg
)
- Sets the filter to be used by the iterator.
The iterator internally moves itself to the next
valid symbol that satisfies both the filter and
the mask
- Defined in
SymbTable.c
NodeList_ptr
SymbTable_iter_to_list(
const SymbTable_ptr self,
SymbTableIter iter
)
- Creates a list starting from the iterator. The list
must be freed. The iterator is NOT changed (it
is passed as value..)
- Defined in
SymbTable.c
Set_t
SymbTable_iter_to_set(
const SymbTable_ptr self,
SymbTableIter iter
)
- Creates a set starting from the iterator. The set
must be freed. The iterator is NOT changed (it
is passed as value..)
- Defined in
SymbTable.c
void
SymbTable_layer_add_to_class(
SymbTable_ptr self,
const char* layer_name,
const char* class_name
)
- A new class will be created if given class does not
exist yet. The given layer must be existing.
- See Also
SymbTable_layer_remove_from_class
- Defined in
SymbTable.c
boolean
SymbTable_layer_class_exists(
SymbTable_ptr self,
const char* class_name
)
- This method checks if class 'class_name' has been
previously created in the SymbTable.Returns true if the class exists,
false otherwise.
- Side Effects None
- Defined in
SymbTable.c
void
SymbTable_layer_remove_from_class(
SymbTable_ptr self,
const char* layer_name,
const char* class_name
)
- Given class must be existing, or if NULL default
class must be existing. If the layer is not found, nothing happens.
- See Also
SymbTable_layer_add_to_class
- Defined in
SymbTable.c
boolean
SymbTable_list_contains_input_var(
const SymbTable_ptr self,
const NodeList_ptr var_list
)
- The given list of variables is traversed until an input
variable is found
- Defined in
SymbTable.c
boolean
SymbTable_list_contains_state_frozen_var(
const SymbTable_ptr self,
const NodeList_ptr var_list
)
- The given list of variables is traversed until
a state or frozen variable is found
- Defined in
SymbTable.c
boolean
SymbTable_list_contains_undef_var(
const SymbTable_ptr self,
const NodeList_ptr var_list
)
- Iterates through the elements in var_list
checking each one to see if it is one undeclared variable.
- Defined in
SymbTable.c
void
SymbTable_remove_layer(
SymbTable_ptr self,
SymbLayer_ptr layer
)
- The layer must be not in use by any encoding, so remove
it from all encodings before calling this method. The removed layer
will be no longer available after the invocation of this method.
If given layer belongs to a set of layer classes, the layer will
be removed from the classes as well (meaning that there is no
need to remove the layer from the classes it belongs to)
- See Also
create_layer
- Defined in
SymbTable.c
void
SymbTable_remove_trigger(
const SymbTable_ptr self,
SymbTableTriggerFun trigger,
SymbTableTriggerAction action
)
- Removes a trigger from the Symbol Table
- See Also
SymbTable_add_trigger
- Defined in
SymbTable.c
void
SymbTable_rename_layer(
const SymbTable_ptr self,
const char* layer_name,
const char* new_name
)
- Use to rename an existing layer. Useful for example to
substitute an existing layer with another.
- Defined in
SymbTable.c
ResolveSymbol_ptr
SymbTable_resolve_symbol(
SymbTable_ptr self,
node_ptr expr,
node_ptr context
)
- Resolves the given symbol in the given context.
This function returns the internal instance of
ResolveSymbol, which must NOT be freed by the
caller. The ResolveSymbol internal instance is
re-populated everytime that this function is
called.
- Defined in
SymbTable.c
void
SymbTable_set_default_layers_class_name(
SymbTable_ptr self,
const char* class_name
)
- Given string is duplicated.
- See Also
SymbTable_get_default_layers_class_name
- Defined in
SymbTable.c
SymbLayer_ptr
SymbTable_symbol_get_layer(
SymbTable_ptr self,
node_ptr name
)
- Returns the layer a symbol is defined in, NULL
if there is no layer containing it.
- Defined in
SymbTable.c
SymbLayer_ptr
SymbTable_variable_get_layer(
SymbTable_ptr self,
node_ptr name
)
- Returns the layer a variable is defined in, NULL
if there is no layer containing it.
- Defined in
SymbTable.c
int
SymbType_calculate_type_size(
const SymbType_ptr self
)
- This function can be invoked only on finite-precision
valid type of variables. This means that such types as no-type or error-type
or real or any memory-shared ones should not be given to this function.
- See Also
SymbType_create
- Defined in
SymbType.c
SymbType_ptr
SymbType_convert_right_to_left(
SymbType_ptr leftType,
SymbType_ptr rightType
)
- The implicit conversion is performed
in accordance to the type order.
NOTE: only memory-shared types can be given to this function.
- Defined in
SymbType.c
SymbType_ptr
SymbType_copy(
const SymbType_ptr self
)
- This function takes one type and returns its copy.
Note: the body of the type is not copied, i.e. just pointer is remembered.
See SymbType_create for more info about body.
Note: the input type should not be a memory-shared type (since there is no
meaning in coping a memory sharing type).
- Side Effects allocate memory
- See Also
SymbType_destroy
- Defined in
SymbType.c
SymbType_ptr
SymbType_create_array(
SymbType_ptr subtype,
int lower_bound,
int upper_bound
)
- This is specialized version of SymbType_create
which is designed for array types only.
It is implemented as a special construtor because array types are quite
different from all the others.
Parameter subtype is the subtype of the array type. This type has
to be not-memory-shared and its ownership is passed to created
type. I.e. subtype will be destroyed when returned type is destroyed.
lower_bound, upper-bound are the lower and upper bounds,resp, of
the array.
All the constrains about memory, lifetype, etc are the same as for
SymbType_create.
- Side Effects allocate memory
- See Also
SymbType_destroy
- Defined in
SymbType.c
SymbType_ptr
SymbType_create_memory_sharing_array_type(
SymbType_ptr subtype,
int lower_bound,
int upper_bound
)
- The same as SymbType_create_memory_sharing_type
but can be used to create array types.
subtype has to be memory shared.
- Side Effects allocate memory
- See Also
SymbType_create
SymbType_destroy_memory_sharing_type
- Defined in
SymbType.c
SymbType_ptr
SymbType_create_memory_sharing_type(
SymbTypeTag tag,
node_ptr body
)
- The difference from the public constructor is that this
constructor marks the created type as a memory sharing type. As
result the public constructor will not be able to destroy memory
sharing instance of a type. Use the private constructor
SymbType_destroy_memory_sharing_type to destroy such instances.
- Side Effects allocate memory
- See Also
SymbType_create
SymbType_destroy_memory_sharing_type
- Defined in
SymbType.c
SymbType_ptr
SymbType_create(
SymbTypeTag tag,
node_ptr body
)
- The tag must be a correct tag. The 'body' is the
additional info corresponding to a particular kind of the type:
* for a enum type the body is the list of values;
* for "BOOL", "INT" or "REAL" the body is unused, and set to Nil;
* for signed and unsigned "WORD" it is the NUMBER node defining the
width of the type;
* for "WORDARRAY", the body is a pair of NUMBER nodes, defining
the width of the address, and the width of the value.
* for everything else body is Nil;
Note that array types have to be created with
SymbType_create_array, not with this constructor.
Set-types are used with expressions which represent a set values.
"NO-TYPE" is used with expressions which normally do not
have any type such as assignments.
"ERROR" type indicates an error (not an actual type).
No-type, error-type and all set-types (boolean-set, integer-set,
symbolic-set, symbolic-integer-set) should not be created with this
constructor, but only with memory-shared function
SymbTablePkg_..._type. The reason behind this constrain is that
only expressions (not variables) can have these types, therefore
only memory-shared versions of these types are required.
The constructor does not create a copy of the body, but just remember
the pointer.
NB: system "reset" command destroys all node_ptr objects, including those
used in SymbType_ptr. So destroy all symbolic types before the destruction
of node_ptr objects, i.e. before or during "reset"
- Side Effects allocate memory
- See Also
SymbType_create_array
SymbType_destroy
- Defined in
SymbType.c
void
SymbType_destroy_memory_sharing_type(
SymbType_ptr self
)
- The same as the public destructor SymbType_destroy
but 'self' has to be created by private constructor
SymbType_create_memory_sharing_type only.
- See Also
SymbType_create_memory_sharing_type
SymbType_create
- Defined in
SymbType.c
void
SymbType_destroy(
SymbType_ptr self
)
- Deallocate the memory. The destructor
does not deallocate memory from the type's body (since the
constructor did not created the body).
NOTE: If self is a memory sharing type instance, i.e. a type returned by
SymbTablePkg_..._type functions then the destructor will not delete
the type.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_equals(
SymbType_ptr self,
SymbType_ptr oth
)
- True if and only if the given types are equal, the given
types can be memory-sharing or not.
- Defined in
SymbType.c
node_ptr
SymbType_generate_all_word_values(
const SymbType_ptr self
)
- Generates and returns a list of all possible values
of a particular Unsigned Word type
- Defined in
SymbType.c
int
SymbType_get_array_lower_bound(
const SymbType_ptr self
)
- Get array lower bound
- Defined in
SymbType.c
SymbType_ptr
SymbType_get_array_subtype(
const SymbType_ptr self
)
- The returned pointer belongs to the ginven SymbType_ptr
and must not be freed
- Defined in
SymbType.c
int
SymbType_get_array_upper_bound(
const SymbType_ptr self
)
- Get array upper bound
- Defined in
SymbType.c
node_ptr
SymbType_get_enum_type_values(
const SymbType_ptr self
)
- The given type has to be a ENUM type.
The return list is a list of all possible values of a enum type. This list
was provided during construction.
NB: Memory sharing types do not have particular values, since they
are "simplified".
- Defined in
SymbType.c
SymbType_ptr
SymbType_get_greater(
const SymbType_ptr type1,
const SymbType_ptr type2
)
- The implicit conversion is performed
in accordance to the type order.
NOTE: only memory-shared types can be given to this function.
- Defined in
SymbType.c
SymbType_ptr
SymbType_get_minimal_common(
SymbType_ptr type1,
SymbType_ptr type2
)
- The implicit conversion is performed in accordance to
the type order. NOTE: only memory-shared types can be given to this
function except for SYMB_TYPE_ARRAY which can be non-memory shared
- Defined in
SymbType.c
SymbTypeTag
SymbType_get_tag(
const SymbType_ptr self
)
- Returns the tag (the kind) of the type
- Defined in
SymbType.c
int
SymbType_get_word_line_number(
const SymbType_ptr self
)
- The body of the type, provided during construction, is
a node NUMBER specifying the width of the Word or a node CONS
specifying the address-value widths or WordArray. This node was
create during parsing and contains the line number of the type
declaration.
NB: The type should not be memory-sharing.
NB: Virtually this function is used only in TypeChecker_is_type_wellformed
- See Also
SymbType_create
- Defined in
SymbType.c
int
SymbType_get_word_width(
const SymbType_ptr self
)
- The given type should be Word and the
body of the type (given to the constructor) should be NUMBER node.
- Defined in
SymbType.c
int
SymbType_get_wordarray_awidth(
const SymbType_ptr self
)
- .
- Defined in
SymbType.c
int
SymbType_get_wordarray_vwidth(
const SymbType_ptr self
)
- .
- Defined in
SymbType.c
boolean
SymbType_is_array(
const SymbType_ptr self
)
- Returns true if the type is an array-type, or else returns false
- Defined in
SymbType.c
boolean
SymbType_is_back_comp(
const SymbType_ptr type
)
- We distinguish "old" types because we may want to turn
off the type checking on these types for backward
compatibility. Integer is also considered as "old", because an enum
of integer values is always casted to Integer.
- Defined in
SymbType.c
boolean
SymbType_is_boolean(
const SymbType_ptr self
)
- The kind of enum-type is analysed in the constructor.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_enum(
const SymbType_ptr self
)
- Returns true if the type is a enum-type, or else returns false
- Defined in
SymbType.c
boolean
SymbType_is_error(
const SymbType_ptr self
)
- Error type is used to indicate an error
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_infinite_precision(
const SymbType_ptr self
)
- Inifinite-precision types are such as integer and real.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_int_symbolic_enum(
const SymbType_ptr self
)
- The kind of enum-type is analysed in the constructor.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_integer(
const SymbType_ptr self
)
- Returns true if the type is a integer-type, or else returns false
- Defined in
SymbType.c
boolean
SymbType_is_memory_shared(
SymbType_ptr self
)
- True if and only if the given type is memory shared
- Defined in
SymbType.c
boolean
SymbType_is_pure_int_enum(
const SymbType_ptr self
)
- The kind of enum-type is analysed in the constructor.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_pure_symbolic_enum(
const SymbType_ptr self
)
- The kind of enum-type is analysed in the constructor.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_real(
const SymbType_ptr self
)
- Returns true if the type is a real-type, or else returns false
- Defined in
SymbType.c
boolean
SymbType_is_set(
const SymbType_ptr self
)
- Returns true, if the type is one of the set-types, i.e.
boolean-set, integer-set, symbolic-set, integer-symbolic-set, and
false otherwise.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_signed_word(
const SymbType_ptr self
)
- Returns true, if the type is a signed Word type
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_statement(
const SymbType_ptr self
)
- Returns true, if the type is a statement-type,
and false otherwise.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_string(
const SymbType_ptr self
)
- Returns true, if the type is a String type
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_unsigned_word(
const SymbType_ptr self
)
- Returns true, if the type is an unsigned Word type
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_word_1(
const SymbType_ptr self
)
- Returns true, if the type is a Unsigned Word type and the width of
the word is 1. Otherwise - returns false.
- See Also
SymbType_create
- Defined in
SymbType.c
boolean
SymbType_is_wordarray(
const SymbType_ptr self
)
- .
- Defined in
SymbType.c
boolean
SymbType_is_word(
const SymbType_ptr self
)
- Returns true, if the type is a Word type (signed or unsigned)
- See Also
SymbType_create
- Defined in
SymbType.c
SymbType_ptr
SymbType_make_from_set_type(
const SymbType_ptr self
)
- More precisely the following conversion takes place:
boolean-set -> boolean
integer-set ->integer
symbolic-set -> symbolic-enum
integer-symbolic-set -> integer-symbolic-set
another type -> the same type
The implicit conversion is performed in accordance to the type order.
NOTE: only memory-shared types can be given to this function.
- See Also
SymbType_make_set_type
- Defined in
SymbType.c
SymbType_ptr
SymbType_make_memory_shared(
const SymbType_ptr self
)
- The input type should have
a corresponding memory shared type. For example, function type
and error type do not have memory shared instances.
- Defined in
SymbType.c
SymbType_ptr
SymbType_make_set_type(
const SymbType_ptr self
)
- The implicit conversion is performed in accordance to the type order.
NOTE: only memory-shared types can be given to this function.
- See Also
SymbType_make_type_from_set_type
- Defined in
SymbType.c
void
SymbType_print(
const SymbType_ptr self,
FILE* output_stream
)
- This function is made very similar to print_node.
If a Enum type was created with SymbType_create then all its values will be
printed, otherwise the type was created with SymbTablePkg_..._type
and simplified type name (instead of actual type values) is printed.
- See Also
SymbType_sprint
- Defined in
SymbType.c
char*
SymbType_sprint(
const SymbType_ptr self
)
- This function is made very similar to sprint_node.
If an Enum type was created with
SymbType_create then all its values will be
printed, otherwise the type was created with
SymbTablePkg_..._type and simplified type
name (instead of actual type values) is
printed.
The returned string must be released by the caller.
- Side Effects The returned string is allocated and has to be released
by the caller
- See Also
SymbType_print
- Defined in
SymbType.c
static assoc_retval
class_layers_hash_free(
char * key,
char * data,
char * arg
)
- Private destructor used by clas destroyer
- See Also
symb_table_deinit
- Defined in
SymbTable.c
static boolean
node_equal(
node_ptr n1,
node_ptr n2
)
- Equality function for node_ptr, used to compare bodies of
types in SymbType_equal.
- See Also
SymbType_equal
- Defined in
SymbType.c
static node_ptr
resolve_symbol_resolve_name_recur(
const SymbTable_ptr symb_table,
node_ptr n,
node_ptr context
)
- If name is complex and first ATOM is a parameter then the parameter is
substituted by its value (in order to pass modules in parameters and
access their members).
Returns TYPE_ERROR if not resolvable name is provided
- See Also
resolve_symbol_resolve_name
- Defined in
ResolveSymbol.c
static node_ptr
resolve_symbol_resolve_name(
const SymbTable_ptr symb_table,
node_ptr name,
node_ptr context
)
- The result of this function is a properly formed
identifier, find_atom-ed, and suitable to access hash tables such
as symbol table, etc.
An input expression may be a simple or complex (with DOT)
identifier, a bit or an array element.
Note: identifiers are not expanded, i.e. defines and formal parameters
are not substituted by the corresponding expressions.
Nil is returned if the given expression is not syntactically an
identifier.
Currently, arrays are additionally flattened to maintain old code.
See the description of compileFlattenSexpRecur for info about ARRAY.
- See Also
resolve_symbol_resolve_name_recur
- Defined in
ResolveSymbol.c
static void
str_print(
SymbTypePrinterInfo_ptr pinfo,
const char * fmt,
)
- This function prints the specified formatted string in
the pinfo
- See Also
SymbType_print
SymbType_sprint
- Defined in
SymbType.c
static assoc_retval
sym_hash_free_vars(
char * key,
char * data,
char * arg
)
- Private destructor used by class destroyer
- See Also
symb_table_deinit
- Defined in
SymbCache.c
static inline SymbolInfo*
symb_cache_alloc_symb_info(
const SymbCache_ptr self
)
- The instance is popped from the pool, if available.
Otherwise, a new chunk of memory is allocated
and the pool is repopulated with
SYMBOL_INFO_CHUNK_SIZE instances of SymbolInfo
- Defined in
SymbCache.c
static inline void
symb_cache_check_and_shrink_symbols(
SymbCache_ptr self
)
- Shrinks the symbols array if needed
- Defined in
SymbCache.c
static void
symb_cache_deinit(
SymbCache_ptr self
)
- Private deinitializer, called by the destructor
- See Also
symb_cache_init
- Defined in
SymbCache.c
static inline void
symb_cache_free_symb_info(
const SymbCache_ptr self,
SymbolInfo* si
)
- Pushes the given symbol info instance in the
SymbolInfo's instances pool, for future re-use
- Defined in
SymbCache.c
static void
symb_cache_free_triggers(
NodeList_ptr triggers
)
- Clears the given list of triggers
- See Also
symb_cache_init
- Defined in
SymbCache.c
static void
symb_cache_init(
SymbCache_ptr self,
SymbTable_ptr symb_table
)
- Private initializer, called by the constructor
- See Also
symb_cache_deinit
- Defined in
SymbCache.c
static inline void
symb_cache_new_symbol(
SymbCache_ptr self,
const node_ptr sym,
SymbolInfo* symbol_info
)
- The given symbol is added in the cache.
The given symbol is added in the symbol_hash
associated to the relative SymbolInfo, and in
the symbols array (which may need a resizing).
- Defined in
SymbCache.c
static inline void
symb_cache_remove_symbol(
SymbCache_ptr self,
const node_ptr sym,
const boolean shrink_if_needed
)
- Removes a symbol from the cache.
The given symbol is removed from the symbol_hash
and from the symbols array. The associated
SymbolInfo is freed (i.e. is pushed in the
pool). This operation costs O(1), but if
shrink_if_needed is true and the symbols array
has too many holes, it is shrinked (O(n + h)
with n = number of symbols and h = number of
holes)
- Defined in
SymbCache.c
static inline void
symb_layer_check_and_shrink_symbols(
SymbLayer_ptr self
)
- Shrinks the symbols array if needed
- Defined in
SymbLayer.c
static void
symb_layer_deinit(
SymbLayer_ptr self,
boolean clean_cache
)
- Called by the destructor
- Defined in
SymbLayer.c
static void
symb_layer_init(
SymbLayer_ptr self,
const char* name,
const LayerInsertPolicy policy,
SymbCache_ptr cache
)
- Called by the constructor
- Defined in
SymbLayer.c
static inline void
symb_layer_new_symbol(
SymbLayer_ptr self,
const node_ptr sym
)
- Adds the given symbol from the layer
- Defined in
SymbLayer.c
static inline void
symb_layer_remove_symbol(
SymbLayer_ptr self,
const node_ptr sym
)
- Removes the given symbol from the layer
- Defined in
SymbLayer.c
static array_t*
symb_table_create_layers_class(
const SymbTable_ptr self,
const char* class_name
)
- Returns the array of layer class, creating it when
needed
- Defined in
SymbTable.c
static void
symb_table_deinit(
SymbTable_ptr self
)
- Private deinitializer, called by the destructor only
- See Also
symb_table_init
- Defined in
SymbTable.c
static SymbCategory
symb_table_detect_expr_category(
const SymbTable_ptr st,
const Expr_ptr expr
)
- Returns the type of a define, for a discussion on
symbol categories look the SymbCategory enum
description in SymbTable.h
- Defined in
SymbTable.c
static NodeList_ptr
symb_table_filter_layers_symbols(
SymbTable_ptr self,
const array_t* layer_names,
SymbTableIter* iter
)
- The caller is responsible for destroying the
returned list
- Defined in
SymbTable.c
static node_ptr
symb_table_flatten_array_define(
const SymbTable_ptr self,
const node_ptr body,
const node_ptr context
)
- Returns the flattened body of an array define
- See Also
SymbTable_get_array_define_flatten_body
- Defined in
SymbTable.c
static array_t*
symb_table_get_layers_class(
const SymbTable_ptr self,
const char* class_name
)
- Returns the array of layer class, NULL if class does
not exist.
- Defined in
SymbTable.c
static array_t*
symb_table_get_layers_from_class(
const SymbTable_ptr self,
const char* class_name
)
- Returns the array of layer class, or NULL when not existing.
Resolves NULL class_name to the default class
- Defined in
SymbTable.c
static void
symb_table_init(
SymbTable_ptr self
)
- Private initializer, called by the constructor only
- See Also
symb_table_deinit
- Defined in
SymbTable.c
static boolean
symb_table_layer_exists(
const SymbTable_ptr self,
const char* layer_name
)
- Returns true if the given name corresponds to an already
registered layer.
- Defined in
SymbTable.c
static void
symb_table_layer_rename_in_class(
SymbTable_ptr self,
const char* class_name,
const char* old_layer_name,
const char* new_layer_name
)
- Used internally by remove_layer and rename_layer.
To remove, pass NULL as new_layer_name
- Defined in
SymbTable.c
static enum st_retval
symb_table_types_hash_cleaner(
char * c1,
char * c2,
char * c3
)
- The function is used to free the memory from
memory-sharing Word/WordArray/Array types stored in the hash table
symb_table_..._type_hash. Used in the SymbTablePkg_quit only
- Defined in
symb_table.c
static void
symb_type_sprint_aux(
const SymbType_ptr self,
SymbTypePrinterInfo_ptr pinfo
)
- This is the function that prints the SymbType using the
file stream or the string buffer provided by pinfo
- See Also
SymbType_print
SymbType_sprint
- Defined in
SymbType.c
(
)
- Clear the given SymbTypePrinterInfo
- See Also
SymbType_print
SymbType_sprint
- Defined in
SymbType.c
(
)
- Initialize the given SymbTypePrinterInfo to print on a
file
- See Also
SymbType_print
SymbType_sprint
- Defined in
SymbType.c
(
)
- The initial buffer size used when printing on a string
- See Also
SymbType_print
SymbType_sprint
- Defined in
SymbType.c