Compiler Universal Routines

Defines

#define UniversalTable   gl_list_t

Functions

struct UniversalTable * CreateUniversalTable (void)
void DestroyUniversalTable (struct UniversalTable *table)
struct UniversalTable * MergeTables (struct UniversalTable *table1, struct UniversalTable *table2)
void SetUniversalTable (struct UniversalTable *table)
struct UniversalTable * GetUniversalTable (void)
struct InstanceLookupInstance (struct UniversalTable *table, struct TypeDescription *desc)
void AddUniversalInstance (struct UniversalTable *table, struct TypeDescription *desc, struct Instance *inst)
unsigned long NumberTypes (struct UniversalTable *table)
void ChangeUniversalInstance (struct UniversalTable *table, struct Instance *oldinst, struct Instance *newinst)
void RemoveUniversalInstance (struct UniversalTable *table, struct Instance *inst)
struct TypeDescriptionGetTypeDescription (struct UniversalTable *table, unsigned long pos)
struct InstanceGetInstance (struct UniversalTable *table, unsigned long pos)

Define Documentation

#define UniversalTable   gl_list_t

Definition at line 50 of file universal.h.


Function Documentation

struct UniversalTable* CreateUniversalTable ( void   )  [read]

Create an empty table for holding the universal instances.

Definition at line 50 of file universal.c.

References gl_create(), and UNIVERSAL_TABLE_SIZE.

Referenced by Asc_CompilerInit().

void DestroyUniversalTable ( struct UniversalTable *  table  ) 

Destroy the list, but not the instances contained in the list.

struct UniversalTable* MergeTables ( struct UniversalTable *  table1,
struct UniversalTable *  table2 
) [read]

Merge the contents of two universal tables and make a joint table. The old tables are probably destroyed. NOT IMPLEMENTED.

Todo:
Implement compiler/universal.c MergeTables().
void SetUniversalTable ( struct UniversalTable *  table  ) 

Set the global universal table to "table". This replaces the previous universal table, if one existed. In general for instantiation to correctly handle universal instances, there must be an non-NULL universal table. The universal table is initially NULL.

struct UniversalTable* GetUniversalTable ( void   )  [read]
struct Instance* LookupInstance ( struct UniversalTable *  table,
struct TypeDescription desc 
) [read]

Return the pointer to the universal instance of type desc. This will return NULL if no such instance is in the table.

void AddUniversalInstance ( struct UniversalTable *  table,
struct TypeDescription desc,
struct Instance inst 
)

Add a type to the universal table. Add the type "desc" to the universal list. inst is the instance that all instances of type "desc" should be. This assumes that desc is not already in the list. This does no checking that the instance given is of the type given -- it is assumed the user knows what they are doing, particularly in handling universals around refinement and merging.

unsigned long NumberTypes ( struct UniversalTable *  table  ) 

Return the number of types found in the table.

void ChangeUniversalInstance ( struct UniversalTable *  table,
struct Instance oldinst,
struct Instance newinst 
)

Change any references of oldinst into newinst.

void RemoveUniversalInstance ( struct UniversalTable *  table,
struct Instance inst 
)

Remove any type entry that contains instance inst.

struct TypeDescription* GetTypeDescription ( struct UniversalTable *  table,
unsigned long  pos 
) [read]

Return the type description in position pos. Note that the instance may be more refined that the type.

struct Instance* GetInstance ( struct UniversalTable *  table,
unsigned long  pos 
) [read]

Return the instance in position pos.

Generated on Mon Mar 4 17:48:44 2013 for libascend by  doxygen 1.6.3