void pvm_internal_init_class(struct pvm_object_storage * os) { struct data_area_4_class * da = (struct data_area_4_class *)os->da; da->object_data_area_size = 0; da->object_flags = 0; da->object_default_interface = pvm_get_null_class(); da->sys_table_id = -1; da->class_name = pvm_get_null_object(); da->class_parent = pvm_get_null_class(); }
struct pvm_object pvm_create_class_object(struct pvm_object name, struct pvm_object iface, int da_size) { struct pvm_object _data = pvm_object_create_fixed( pvm_get_class_class() ); struct data_area_4_class * da = (struct data_area_4_class *)_data.data->da; da->object_data_area_size = da_size; da->object_flags = 0; da->object_default_interface = iface; da->sys_table_id = -1; da->class_name = name; da->class_parent = pvm_get_null_class(); return _data; }
// Really need this? int pvm_object_class_is_or_parent( struct pvm_object object, struct pvm_object tclass ) { struct pvm_object_storage *tested = object.data->_class.data; struct pvm_object_storage *nullc = pvm_get_null_class().data; while( !pvm_is_null( tclass ) ) { if( tested == tclass.data ) return 1; if( tclass.data == nullc ) break; tclass = pvm_object_da( tclass, class )->class_parent; } return 0; }
int pvm_object_class_is_or_child( struct pvm_object object, struct pvm_object tclass ) { struct pvm_object oclass = object.data->_class; //struct pvm_object_storage *tested = object.data->_class.data; struct pvm_object_storage *nullc = pvm_get_null_class().data; if( pvm_is_null( tclass ) ) return 0; while(1) { if( oclass.data == tclass.data ) return 1; if( oclass.data == nullc ) break; oclass = pvm_object_da( oclass, class )->class_parent; } return 0; }