Ejemplo n.º 1
0
void *tobject_alloc () {
	printf("Allocating object class\n");
	Object  *obj = calloc(sizeof(TObject), 1);

	obj->initializer = (void (*)(void*))tobject_initialize;
	obj->finalizer   = (void (*)(void*))tobject_finalize;

	object_set_name(obj, "object");
	object_set_parent(obj, NULL);

	object_initialize(obj);

	TObjectClass = obj;

	return obj;
}
Ejemplo n.º 2
0
/**	endDocument() is called when the end of the file is reached.  Any post-processing within the parser should occur here.
*/
void gld_loadHndl::endDocument(){
	OBJECT *tempobj = object_get_first();

	/* resolve_list(); */
	if(load_resolve_all() == FAILED){
		output_error("XML_Load: unable to resolve object linkings!");
		load_state = false;
	}
	/* "establish ranks" */

	for (; obj!=NULL; obj=obj->next)
		object_set_parent(obj,obj->parent);
	output_verbose("XML_Load: %d object%s loaded.", object_get_count(), object_get_count() > 0 ? "s" : "");
	if(object_count > 0)
		if(object_get_count() != this->object_count)
			output_warning("XML_Load: we expected %i objects instead!", this->object_count);
	output_verbose("XML_Load: %d class%s loaded.", class_get_count(), class_get_count() > 0 ? "es" : "");
	if(class_count > 0)
		if(class_get_count() != this->class_count)
			output_warning("XML_Load: we expected %i classes instead!", this->class_count);
}
Ejemplo n.º 3
0
object_t *object_create_from_class( class_type_t *class_type, object_t *parent )
{
	const class_info_t *class_info = class_type->info;
	object_t *obj = NULL;
	
	obj = (object_t *)smalloc( class_info->object_size );
	
	memset( obj, 0, class_info->object_size );
	
	obj->class_type = class_type;
	obj->realized = 0;
	
	//strcpy( obj->type, class_info->name );
    obj->type = class_info->name;	
    obj->destroy_pending = 0;
	
	/* run create functions */
	object_run_class_create( obj, obj->class_type->info );
	
	/* set our parent */
	object_set_parent( obj, parent );
	
	return obj;
}