Main Page | Class List | Directories | File List | Class Members | File Members

cc_symtab.c File Reference

CKPM C compiler symbol table implementation. More...

#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "cpp_io.h"
#include "cpp_conv.h"
#include "cc_symtab.h"

Functions

void Indend (int fd, int lev)
 write a string of blanks according to the indentation level
_objectObject_Create (char *name, class_t cls, int lev, struct _type *type, int val, struct _object *next, struct _object *dsc)
 create an Object description
void Object_Destroy (struct _object *o)
 destroy an Object description
void Object_Dump (struct _object *o, int lev, int fd, struct _object *en)
 dump an Object description
void Type_Destroy (struct _type *t)
 destroy a Type description
void Type_Dump (struct _type *t, int lev, int fd, struct _object *en)
 dump a Type description
_itemItem_Create ()
 create an Item description
void Item_Destroy (struct _item *i)
 destroy an Item description
void Item_Copy (struct _item *d, struct _item *s)
 copy an Item description
void Item_Dump (struct _item *i, int fd)
 dump an Item description
void SymTab_Enter (struct _symtab *st, class_t cls, int n, char *name, struct _type *type, struct _object *dsc)
 enter an entry to the symbol table
_symtabSymTab_Create ()
 create a symbol table
void SymTab_Destroy (struct _symtab *st)
 destroy a symbol table
void OpenScope (struct _symtab *st)
 open a new scope
void CloseScope (struct _symtab *st)
 close a the topmost scope
void SymTab_Dump (struct _symtab *st, int lev, int fd)
 dump the content of a symbol table
char * ClassToString (class_t cls)
 convert class numbers to strings
char * FormToString (form_t f)
 convert form numbers to strings
char * TypeToString (type_t t)
 convert type numbers to strings


Detailed Description

CKPM C compiler symbol table implementation.


Function Documentation

char* ClassToString class_t  cls  ) 
 

convert class numbers to strings

Parameters:
cls the class number
Returns:
the class name as a string

void CloseScope struct _symtab st  ) 
 

close a the topmost scope

Parameters:
st pointer to a symbol table

char* FormToString form_t  f  ) 
 

convert form numbers to strings

Parameters:
f the form number
Returns:
the form name as a string

void Indend int  fd,
int  lev
 

write a string of blanks according to the indentation level

Parameters:
fd the filedesciptor index of the output file
lev level of indentation

void Item_Copy struct _item d,
struct _item s
 

copy an Item description

Parameters:
d a pointer to the destination Item
s a pointer to the source Item

struct _item* Item_Create  ) 
 

create an Item description

Returns:
a pointer to a newly created and initialized Item description

void Item_Destroy struct _item i  ) 
 

destroy an Item description

Parameters:
i a pointer to a Item desription

void Item_Dump struct _item i,
int  fd
 

dump an Item description

Parameters:
i a pointer to an Item description
fd the filedesciptor index of the output file

struct _object* Object_Create char *  name,
class_t  cls,
int  lev,
struct _type type,
int  val,
struct _object next,
struct _object dsc
 

create an Object description

Parameters:
name the name of the object
cls the object type class
lev declaration level
type the object's type
val constants: value
next the next object entry
dsc 
Returns:
a pointer to a newly created and initialized Object description

void Object_Destroy struct _object o  ) 
 

destroy an Object description

Parameters:
o a ointer to an Object description

void Object_Dump struct _object o,
int  lev,
int  fd,
struct _object en
 

dump an Object description

Parameters:
o a pointer to an Object description
lev level of indentation
fd the filedesciptor index of the output file
en the pointer to the end of the list, i.e. guard object

void OpenScope struct _symtab st  ) 
 

open a new scope

Parameters:
st pointer to a symbol table

struct _symtab* SymTab_Create  ) 
 

create a symbol table

Returns:
a pointer to a newly created and initialized symbol table

void SymTab_Destroy struct _symtab st  ) 
 

destroy a symbol table

Parameters:
st pointer to a symbol table

void SymTab_Dump struct _symtab st,
int  lev,
int  fd
 

dump the content of a symbol table

Parameters:
st pointer to a symbol table
lev level of indentation
fd the filedesciptor index of the output file

void SymTab_Enter struct _symtab st,
class_t  cls,
int  n,
char *  name,
struct _type type,
struct _object dsc
 

enter an entry to the symbol table

Parameters:
st the pointer to the symbol table
cls the object type class
n the value of the object
name the name of the object
type the object's basic type
dsc a pointer to a detailed desctiption
Returns:
a pointer to a newly created and initialized Object description

void Type_Destroy struct _type t  ) 
 

destroy a Type description

Parameters:
t a pointer to a Type desription

void Type_Dump struct _type t,
int  lev,
int  fd,
struct _object en
 

dump a Type description

Parameters:
t a pointer to an Type description
lev level of indentation
fd the filedesciptor index of the output file
en the pointer to the end of the list, i.e. guard object

char* TypeToString type_t  t  ) 
 

convert type numbers to strings

Parameters:
t the type number
Returns:
the type name as a string


Generated on Thu Jul 13 03:56:36 2006 for CKPMcc by  doxygen 1.4.4