# Slotzugriffe
Class.methods
 	^methods
!
Class.super_class
 	^super_class
!
Class.name
	^name
!
Class.slots
 	^slots
!
####################################
Class.print()
	# Gibt aus: <Class KLASSENNAME>
	"<Class ".simple_print();
	name.print();
	">".simple_print()
!

Class.new_class_instance(class)
	|result|
    result = self.intern_new_object_of_class(self.class.number_all_slots,class);
	result.plain_init();
	^result
!
####################################
Class.new_sub_class(name,slots)
	|new_meta_class new_meta_class_instanz vector|
    new_meta_class = self.new_class_instance(self.class_with_name("MetaClass"));
	new_meta_class.init_with(self.class,name);
	new_meta_class_instanz = new_meta_class.new(name,self,slots);
	name.as_symbol().set_global_value(new_meta_class_instanz);
	^new_meta_class_instanz

!
Class.plain_init()
	# Initialisiert Slots: slots und methods, Registriert sich als Klasse.
	|vector|
	vector = self.sys_new_vector(100);
	vector.sys_set_slot_n(0,0);
	methods = vector;
	slots = self.sys_new_vector(0);
	self.sys_register_class();
	^self

!
Class.number_own_slots
	# Liefert Anzahl eigener Slots.
    ^self.slots.size
!
Class.number_all_slots
	# Liefert Anzahl aller Slots in Klassen-Hierarchie.
    if self.eq(self.class_with_name("Object"))
	then
    	^0
    else
      	^self.number_own_slots + self.super_class.number_all_slots
	endif
!

Class.new()
	|result|
    result = self.intern_new_object_of_class(self.number_all_slots,self);
	^result

!
Class.init_slots(a_super,a_slots,a_name)
	|vector|
	super_class = a_super;
	slots       = a_slots;
	name        = a_name;
	vector = self.sys_new_vector(100);
	vector.set_nth(0,0);
	methods     = vector;
	self.sys_register_class();
	^self

!
Class.intern_move(newsuper)
	|myclass|
    myclass = self.class;
	super_class = newsuper;
	myclass.intern_move(newsuper.class.super_class);
    ^self
!
Class.register_as_global()
	self.name.as_symbol().set_global_value(self)
!
Class.print_hierarchy()
	|class|
    "Hierarchy von ".simple_print();self.write();
    class = self;
	while (class.eq(nil).not)
		"  ".simple_print();
        class.name.write();
        class = class.super_class
    end
!
Object.print_hierarchy()
	|class|
    "Hierarchy von ".simple_print();self.write();
    class = self;
	while (class.eq(nil).not)
		"  ".simple_print();
        class.name.write();
        class = class.super_class
    end

#eof
