A simple object-oriented database with a Tcl interface driven by a flex/bison parser.

The Object System

The objects are arrays of void *s, whose values are cast as necessary.

The first few slots are the same for all objects:

0
class The class of the object (object)
1
id The id of the object (int)
2
next The next object in the list, if any (object)
The remaining slots vary from class to class.

Objects in the Class class have following layout:

3
name Name of class (string)
4
numObject Number of objects built for this class (int)
5
numSlots Number of slots in this class (int)
6
slots Slots of this class (object)
Objects in the Slot class have the following layout:
3
name Name of the slot (string)
4
type Type of the slot (integer)
The following slot types are supported:
0
object CCE_OBJECT
1
string CCE_STRING
2
integer CCE_INTEGER

For more information, see the documentation for built-in objects

void 
CceRegisterObject(
  Cce_Object  object 
)
First, resize the array if necessary, then register the object.

Side Effects cce_numObjects, objectTableSize, and cce_objectPointers may be modified

Defined in cceObjects.c

 
Cce_AstObjectWriteFilename(
  Cce_Object o, 
  char * n 
)
Write the filename of an AST object

Defined in cce.h

 
Cce_AstObjectWriteLine(
  Cce_Object o, 
  int l 
)
Write the line number of an AST object

Defined in cce.h

int 
Cce_ClassAddSlot(
  Cce_Object  class, 
  char * name, 
  int  type 
)
Create a new object of class Slot and append it to the class's list of slots. This should not be called once objects of the class have been created. Return the slot number. The name is copied.

See Also Cce_ClassNew
Defined in cceObjects.c

int 
Cce_ClassFindNamedSlot(
  Cce_Object  class, 
  char * slotName, 
  int * type 
)
Return the index of a slot name in the given class, or -1 if no slot was found. Also fills in the slot type if the pointer is non-nil.

Defined in cceObjects.c

Cce_Object 
Cce_ClassNew(
  char * name 
)
Create a new object of class Class and fill in the first few slots

See Also Cce_ObjectNew
Defined in cceObjects.c

int 
Cce_ClassReadNumSlots(
  Cce_Object o 
)
Read the number of slots in a class

Defined in cce.h

Cce_Object 
Cce_ClassReadSlots(
  Cce_Object o 
)
Read the slots in a class

Defined in cce.h

int 
Cce_Init(
  Tcl_Interp * interp 
)
Initialize the cce package

Side Effects Adds command to the interpreter

Defined in cceCmd.c

void 
Cce_MemberListSetAccess(
  Cce_Object  list, 
  int  access 
)
Set the access on a list of members

Defined in cceGram.c

void 
Cce_MemberListSetClass(
  Cce_Object  list, 
  char * className 
)
Set the class name on a list of members

Defined in cceGram.c

Cce_Object 
Cce_ObjectAppendObject(
  Cce_Object  object, 
  Cce_Object  list 
)
Append an object to the list and return the list. If the list is NULL, return the object. If the object is NULL, return the list.

Defined in cceObjects.c

Cce_Object 
Cce_ObjectNew(
  Cce_Object  class 
)
Create a new object of a given class.

Side Effects Adds the new object's ID to the array of object identifier pointers.

Defined in cceObjects.c

 
Cce_ObjectOfId(
   id 
)
Returns NULL if the ID is invalid.

See Also CceRegisterObject
Defined in cce.h

 
Cce_ObjectReadClass(
  Cce_Object o 
)
Read the class of an object

Defined in cce.h

int 
Cce_ObjectReadId(
  Cce_Object o 
)
Read the id of an object

Defined in cce.h

Cce_Object 
Cce_ObjectReadNext(
  Cce_Object o 
)
Read the next object of an object

Defined in cce.h

int 
Cce_ObjectSlotReadInt(
  Cce_Object o, 
  int s 
)
Read an integer slot

Defined in cce.h

Cce_Object 
Cce_ObjectSlotReadObject(
  Cce_Object o, 
  int s 
)
Read an object slot

Defined in cce.h

char * 
Cce_ObjectSlotReadString(
  Cce_Object o, 
  int s 
)
Read a string slot

Defined in cce.h

 
Cce_ObjectSlotWrite(
  Cce_Object o, 
  int s, 
   v 
)
Write a slot

Defined in cce.h

 
Cce_ObjectWriteClass(
  Cce_Object o, 
  Cce_Object v 
)
Write the class of an object

Defined in cce.h

 
Cce_ObjectWriteId(
  Cce_Object o, 
  int v 
)
Write the id of an object

Defined in cce.h

 
Cce_ObjectWriteNext(
  Cce_Object o, 
  Cce_Object v 
)
Write the next object of an object

Defined in cce.h

void 
Cce_ObjectsInitialize(
    
)
Initialize the object system

Side Effects The object pointer table is initialized

Defined in cceObjects.c

int 
Cce_ParseFile(
  FILE * file, 
  char * filename, 
  Cce_Object * object, 
  Tcl_DString * parseErrors 
)
Parse a file and return the status (0 if no problem). If object is non-NIL, fill it in with the top level object from the parse tree. If parseErrors is non-NIL, append any parse errors to that dynamic string.

Defined in cceGram.c

char * 
Cce_SlotReadName(
  Cce_Object o 
)
Read the name of a slot

Defined in cce.h

int 
Cce_SlotReadType(
  Cce_Object o 
)
Read the type of a slot

Defined in cce.h

char * 
Cce_StringDup(
  char s 
)
Duplicate a string by malloc'ing

Defined in cceInt.h

static int 
ParseFileCmd(
  ClientData  dummy, 
  Tcl_Interp * interp, 
  int  argc, 
    
)
Open the file, parse it, and return the object it created

Defined in cceCmd.c

static int 
SlotCmd(
  ClientData  dummy, 
  Tcl_Interp * interp, 
  int  argc, 
    
)
Find the named slot, write the result

Defined in cceCmd.c

int 
main(
  int  argc, 
  char ** argv 
)
The main() routine

Defined in cceMain.c

Last updated on 970307 10h10