Changeset 12455


Ignore:
Timestamp:
02/12/10 23:54:42 (11 years ago)
Author:
ehuelsmann
Message:

Make STANDARD-CLASS a normal STANDARD-OBJECT with

a normal Layout and normal slots. Of course, that
requires some support from its superclasses (SlotClass?
and LispClass?).

Location:
branches/metaclass/abcl/src/org/armedbear/lisp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/metaclass/abcl/src/org/armedbear/lisp/LispClass.java

    r12431 r12455  
    9999  private boolean finalized;
    100100
    101   protected LispClass()
    102   {
     101  protected LispClass(Layout layout)
     102  {
     103    super(layout, layout == null ? 0 : layout.getLength());
    103104    sxhash = hashCode() & 0x7fffffff;
    104105  }
    105106
    106   protected LispClass(Symbol symbol)
    107   {
     107  protected LispClass(Layout layout, Symbol symbol)
     108  {
     109    super(layout, layout == null ? 0 : layout.getLength());
    108110    sxhash = hashCode() & 0x7fffffff;
    109111    this.symbol = symbol;
     
    111113  }
    112114
    113   protected LispClass(Symbol symbol, LispObject directSuperclasses)
    114   {
     115  protected LispClass(Layout layout,
     116                      Symbol symbol, LispObject directSuperclasses)
     117  {
     118    super(layout, layout == null ? 0 : layout.getLength());
    115119    sxhash = hashCode() & 0x7fffffff;
    116120    this.symbol = symbol;
  • branches/metaclass/abcl/src/org/armedbear/lisp/SlotClass.java

    r12298 r12455  
    4343    private LispObject defaultInitargs = NIL;
    4444
    45     public SlotClass()
    46     {
    47     }
    48 
    49     public SlotClass(Symbol symbol, LispObject directSuperclasses)
    50     {
    51         super(symbol, directSuperclasses);
     45    public SlotClass(Layout layout)
     46    {
     47      super(layout);
     48    }
     49
     50    public SlotClass(Layout layout,
     51                     Symbol symbol, LispObject directSuperclasses)
     52    {
     53        super(layout, symbol, directSuperclasses);
    5254    }
    5355
  • branches/metaclass/abcl/src/org/armedbear/lisp/StandardClass.java

    r12431 r12455  
    3838public class StandardClass extends SlotClass
    3939{
     40
     41  static Layout layoutStandardClass =
     42      new Layout(null,
     43                 list(PACKAGE_MOP.intern("NAME"),
     44                      PACKAGE_MOP.intern("LAYOUT"),
     45                      PACKAGE_MOP.intern("DIRECT-SUPERCLASSES"),
     46                      PACKAGE_MOP.intern("DIRECT-SUBCLASSES"),
     47                      PACKAGE_MOP.intern("CLASS-PRECEDENCE-LIST"),
     48                      PACKAGE_MOP.intern("DIRECT-METHODS"),
     49                      PACKAGE_MOP.intern("DOCUMENTATION"),
     50                      PACKAGE_MOP.intern("DIRECT-SLOTS"),
     51                      PACKAGE_MOP.intern("SLOTS"),
     52                      PACKAGE_MOP.intern("DIRECT-DEFAULT-INITARGS"),
     53                      PACKAGE_MOP.intern("DEFAULT-INITARGS")),
     54                 NIL)
     55      {
     56        @Override
     57        public LispClass getLispClass()
     58        {
     59          return STANDARD_CLASS;
     60        }
     61      };
     62
    4063  public StandardClass()
    4164  {
    42     setClassLayout(new Layout(this, NIL, NIL));
     65      super(layoutStandardClass);
    4366  }
    4467
    4568  public StandardClass(Symbol symbol, LispObject directSuperclasses)
    4669  {
    47     super(symbol, directSuperclasses);
    48     setClassLayout(new Layout(this, NIL, NIL));
    49   }
    50 
    51   @Override
    52   public LispObject typeOf()
    53   {
    54     return Symbol.STANDARD_CLASS;
     70      super(layoutStandardClass,
     71          symbol, directSuperclasses);
    5572  }
    5673
     
    115132    addStandardClass(Symbol.STANDARD_OBJECT, list(BuiltInClass.CLASS_T));
    116133
     134  public static final StandardClass SLOT_DEFINITION =
     135    new SlotDefinitionClass();
     136  static
     137  {
     138    addClass(Symbol.SLOT_DEFINITION, SLOT_DEFINITION);
     139
     140    STANDARD_CLASS.setClassLayout(layoutStandardClass);
     141    STANDARD_CLASS.setDirectSlotDefinitions(STANDARD_CLASS.getClassLayout().generateSlotDefinitions());
     142  }
     143
    117144  // BuiltInClass.FUNCTION is also null here (see previous comment).
    118145  public static final StandardClass GENERIC_FUNCTION =
     
    258285  {
    259286    addClass(Symbol.STANDARD_GENERIC_FUNCTION, STANDARD_GENERIC_FUNCTION);
    260   }
    261 
    262   public static final StandardClass SLOT_DEFINITION =
    263     new SlotDefinitionClass();
    264   static
    265   {
    266     addClass(Symbol.SLOT_DEFINITION, SLOT_DEFINITION);
    267287  }
    268288
Note: See TracChangeset for help on using the changeset viewer.