7
* Object is the base object for many of the objects that are used in the game.
8
* It has some primitives that make it easy to use with the EcmaScript
11
* It is also the base for the GameObject class.
13
* @warning Note that there is no type-checking. So be careful when using this.
14
* You will have to keep track of what objects inherent from which
15
* object. Also note that there is no consent of interfaces.
21
* Is the primitive for the the <tt> to_string </tt> method in the
22
* <tt>ObjectClass</tt>.
24
typedef char * (* ToStringFunc)(Object * object);
27
* This is the primitive for the <tt> new_func </tt> method.
29
typedef char * (* NewFunc)(Object * object);
32
* The class for the Object, it is what holds the methods for the object.
34
typedef struct ObjectClass {
37
ToStringFunc to_string;
40
typedef struct Object {
44
/* Some reserved space in the Object instance, for good measure. These should
55
* Initialises the object to a sane values.
57
* @warning This does NOT allocate any memory for the instance.
59
* @param object The object to initialise.
61
* @param name The name of the object instance, this should be the same as the
62
* "class" name. IE: If the instance is of the type "Foo", then the
63
* name should be the same.
65
* @param klass The class instance to be added to the object instance.
67
void object_initialize (Object * object,
72
void object_class_initialize (ObjectClass * klass, )
76
* Create a new object of the same type as the one that this is executed on.
78
* This is does not copy the data in the object, it only crates a new instance
79
* of the object. This is generally not helpful.
81
Object * object_new_from_object (object * self);
84
* Creates a null-terminated string that can be used with in different ways, be
85
* it for debugging or other purposes.
87
char * object_to_string (Object * object);
92
* This will call an objects free method.
94
* @warning This will only work on objects that inherent from the Object. It
95
* may or will cause undefined behaviour when used with object that do
96
* not inherent from Object.
98
void object_free (Object * object);
102
#endif /* __H_OBJECT__ */