Changeset 12462


Ignore:
Timestamp:
02/13/10 22:16:55 (11 years ago)
Author:
ehuelsmann
Message:

In order to make StandardClass? use its NAME slot
instead of LispClass?'s 'symbol' field:

  • Rename 'symbol' to 'name', making it private
  • Rename the 'symbol' java property accessors everywhere
  • Add getName() / setName() overrides in StandardClass?

which write to the slot instead of the field

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

Legend:

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

    r12431 r12462  
    7575  {
    7676    StringBuilder sb = new StringBuilder("#<BUILT-IN-CLASS ");
    77     sb.append(symbol.writeToString());
     77    sb.append(getName().writeToString());
    7878    sb.append('>');
    7979    return sb.toString();
  • branches/metaclass/abcl/src/org/armedbear/lisp/Condition.java

    r12298 r12462  
    140140    LispClass c = getLispClass();
    141141    if (c != null)
    142       return c.getSymbol();
     142      return c.getName();
    143143    return Symbol.CONDITION;
    144144  }
  • branches/metaclass/abcl/src/org/armedbear/lisp/ForwardReferencedClass.java

    r12288 r12462  
    7070        StringBuffer sb =
    7171            new StringBuffer(Symbol.FORWARD_REFERENCED_CLASS.writeToString());
    72         if (symbol != null) {
     72        if (getName() != null) {
    7373            sb.append(' ');
    74             sb.append(symbol.writeToString());
     74            sb.append(getName().writeToString());
    7575        }
    7676        return unreadableString(sb.toString());
  • branches/metaclass/abcl/src/org/armedbear/lisp/LispClass.java

    r12455 r12462  
    8989  private final int sxhash;
    9090
    91   protected Symbol symbol;
     91  private LispObject name;
    9292  private LispObject propertyList;
    9393  private Layout classLayout;
     
    105105  }
    106106
     107  protected LispClass(Symbol symbol)
     108  {
     109    this(null, symbol);
     110  }
     111
    107112  protected LispClass(Layout layout, Symbol symbol)
     113  {
     114    super(layout, layout == null ? 0 : layout.getLength());
     115    setName(symbol);
     116    sxhash = hashCode() & 0x7fffffff;
     117  }
     118
     119  protected LispClass(Layout layout,
     120                      Symbol symbol, LispObject directSuperclasses)
    108121  {
    109122    super(layout, layout == null ? 0 : layout.getLength());
    110123    sxhash = hashCode() & 0x7fffffff;
    111     this.symbol = symbol;
    112     this.directSuperclasses = NIL;
    113   }
    114 
    115   protected LispClass(Layout layout,
    116                       Symbol symbol, LispObject directSuperclasses)
    117   {
    118     super(layout, layout == null ? 0 : layout.getLength());
    119     sxhash = hashCode() & 0x7fffffff;
    120     this.symbol = symbol;
     124    setName(symbol);
    121125    this.directSuperclasses = directSuperclasses;
    122126  }
     
    126130  {
    127131    LispObject result = NIL;
    128     result = result.push(new Cons("NAME", symbol != null ? symbol : NIL));
     132    result = result.push(new Cons("NAME", name != null ? name : NIL));
    129133    result = result.push(new Cons("LAYOUT", classLayout != null ? classLayout : NIL));
    130134    result = result.push(new Cons("DIRECT-SUPERCLASSES", directSuperclasses));
     
    142146  }
    143147
    144   public final Symbol getSymbol()
    145   {
    146     return symbol;
     148  public LispObject getName()
     149  {
     150    return name;
     151  }
     152
     153  public void setName(LispObject name)
     154  {
     155    this.name = name;
    147156  }
    148157
     
    289298    classPrecedenceList =
    290299      list(obj1, obj2, obj3, obj4, obj5, obj6, obj7, obj8, obj9);
    291   }
    292 
    293   public String getName()
    294   {
    295     return symbol.getName();
    296300  }
    297301
  • branches/metaclass/abcl/src/org/armedbear/lisp/Primitives.java

    r12431 r12462  
    51335133      public LispObject execute(LispObject arg)
    51345134      {
    5135           return checkClass(arg).symbol;
     5135          return checkClass(arg).getName();
    51365136      }
    51375137    };
     
    51455145
    51465146      {
    5147           checkClass(first).symbol = checkSymbol(second);
     5147          checkClass(first).setName(checkSymbol(second));
    51485148          return second;
    51495149      }
  • branches/metaclass/abcl/src/org/armedbear/lisp/SlotClass.java

    r12455 r12462  
    4646    {
    4747      super(layout);
     48    }
     49
     50    public SlotClass(Symbol symbol, LispObject directSuperclasses)
     51
     52
     53    {
     54        this(null, symbol, directSuperclasses);
    4855    }
    4956
  • branches/metaclass/abcl/src/org/armedbear/lisp/StandardClass.java

    r12455 r12462  
    3939{
    4040
     41  private static Symbol name = PACKAGE_MOP.intern("NAME");
     42
    4143  static Layout layoutStandardClass =
    4244      new Layout(null,
    43                  list(PACKAGE_MOP.intern("NAME"),
     45                 list(name,
    4446                      PACKAGE_MOP.intern("LAYOUT"),
    4547                      PACKAGE_MOP.intern("DIRECT-SUPERCLASSES"),
     
    6971  {
    7072      super(layoutStandardClass,
    71           symbol, directSuperclasses);
     73            symbol, directSuperclasses);
     74  }
     75
     76  @Override
     77  public LispObject getName()
     78  {
     79    return getInstanceSlotValue(name);
     80  }
     81
     82  @Override
     83  public void setName(LispObject newName)
     84  {
     85    setInstanceSlotValue(name, newName);
    7286  }
    7387
     
    107121    StringBuilder sb =
    108122      new StringBuilder(Symbol.STANDARD_CLASS.writeToString());
    109     if (symbol != null)
     123    if (getName() != null)
    110124      {
    111125        sb.append(' ');
    112         sb.append(symbol.writeToString());
     126        sb.append(getName().writeToString());
    113127      }
    114128    return unreadableString(sb.toString());
     
    296310    GENERIC_FUNCTION.setDirectSuperclasses(list(BuiltInClass.FUNCTION,
    297311                                                 STANDARD_OBJECT));
     312    //    GENERIC_FUNCTION.setSlots();
    298313
    299314    ARITHMETIC_ERROR.setCPL(ARITHMETIC_ERROR, ERROR, SERIOUS_CONDITION,
     
    306321    BUILT_IN_CLASS.setCPL(BUILT_IN_CLASS, CLASS, STANDARD_OBJECT,
    307322                          BuiltInClass.CLASS_T);
     323    //    BUILT_IN_CLASS.setSlots();
    308324    JAVA_CLASS.setCPL(JAVA_CLASS, CLASS, STANDARD_OBJECT,
    309325            BuiltInClass.CLASS_T);
     326    //    JAVA_CLASS.setSlots();
    310327    CELL_ERROR.setCPL(CELL_ERROR, ERROR, SERIOUS_CONDITION, CONDITION,
    311328                      STANDARD_OBJECT, BuiltInClass.CLASS_T);
     
    316333    COMPILER_ERROR.setCPL(COMPILER_ERROR, CONDITION, STANDARD_OBJECT,
    317334                          BuiltInClass.CLASS_T);
     335//    COMPILER_ERROR.setSlots();
    318336    COMPILER_UNSUPPORTED_FEATURE_ERROR.setCPL(COMPILER_UNSUPPORTED_FEATURE_ERROR,
    319337                                              CONDITION, STANDARD_OBJECT,
    320338                                              BuiltInClass.CLASS_T);
     339//    COMPILER_UNSUPPORTED_FEATURE_ERROR.setSlots();
    321340    CONDITION.setCPL(CONDITION, STANDARD_OBJECT, BuiltInClass.CLASS_T);
    322341    CONDITION.setDirectSlotDefinitions(
     
    332351    CONTROL_ERROR.setCPL(CONTROL_ERROR, ERROR, SERIOUS_CONDITION, CONDITION,
    333352                         STANDARD_OBJECT, BuiltInClass.CLASS_T);
     353//    CONTROL_ERROR.setSlots();
    334354    DIVISION_BY_ZERO.setCPL(DIVISION_BY_ZERO, ARITHMETIC_ERROR, ERROR,
    335355                            SERIOUS_CONDITION, CONDITION, STANDARD_OBJECT,
    336356                            BuiltInClass.CLASS_T);
     357//    DIVISION_BY_ZERO.setSlots();
    337358    END_OF_FILE.setCPL(END_OF_FILE, STREAM_ERROR, ERROR, SERIOUS_CONDITION,
    338359                       CONDITION, STANDARD_OBJECT, BuiltInClass.CLASS_T);
  • branches/metaclass/abcl/src/org/armedbear/lisp/StandardGenericFunction.java

    r12431 r12462  
    210210      {
    211211        StringBuilder sb = new StringBuilder();
    212         sb.append(getLispClass().getSymbol().writeToString());
     212        sb.append(getLispClass().getName().writeToString());
    213213        sb.append(' ');
    214214        sb.append(name.writeToString());
  • branches/metaclass/abcl/src/org/armedbear/lisp/StandardMethod.java

    r12431 r12462  
    157157          {
    158158            StringBuilder sb = new StringBuilder();
    159             sb.append(getLispClass().getSymbol().writeToString());
     159            sb.append(getLispClass().getName().writeToString());
    160160            sb.append(' ');
    161161            sb.append(name.writeToString());
     
    170170                    LispObject spec = specs.car();
    171171                    if (spec instanceof LispClass)
    172                       names = names.push(((LispClass)spec).getSymbol());
     172                      names = names.push(((LispClass)spec).getName());
    173173                    else
    174174                      names = names.push(spec);
  • branches/metaclass/abcl/src/org/armedbear/lisp/StandardObject.java

    r12444 r12462  
    114114    // The proper name of a class is "a symbol that names the class whose
    115115    // name is that symbol".
    116     final Symbol symbol = c1.getSymbol();
    117     if (symbol != NIL)
     116    final LispObject name = c1.getName();
     117    if (name != NIL && name != UNBOUND_VALUE)
    118118      {
    119119        // TYPE-OF.9
    120         final LispObject c2 = LispClass.findClass(symbol);
     120        final LispObject c2 = LispClass.findClass(checkSymbol(name));
    121121        if (c2 == c1)
    122           return symbol;
     122          return name;
    123123      }
    124124    return c1;
     
    143143        if (type == cls)
    144144          return T;
    145         if (type == cls.getSymbol())
     145        if (type == cls.getName())
    146146          return T;
    147147        LispObject cpl = cls.getCPL();
     
    150150            if (type == cpl.car())
    151151              return T;
    152             if (type == ((LispClass)cpl.car()).getSymbol())
     152            if (type == ((LispClass)cpl.car()).getName())
    153153              return T;
    154154            cpl = cpl.cdr();
  • branches/metaclass/abcl/src/org/armedbear/lisp/StructureClass.java

    r12288 r12462  
    8080    {
    8181        StringBuffer sb = new StringBuffer("#<STRUCTURE-CLASS ");
    82         sb.append(symbol.writeToString());
     82        sb.append(getName().writeToString());
    8383        sb.append('>');
    8484        return sb.toString();
  • branches/metaclass/abcl/src/org/armedbear/lisp/StructureObject.java

    r12431 r12462  
    145145  public LispObject typeOf()
    146146  {
    147     return structureClass.getSymbol();
     147    return structureClass.getName();
    148148  }
    149149
     
    176176    if (type instanceof StructureClass)
    177177      return memq(type, structureClass.getCPL()) ? T : NIL;
    178     if (type == structureClass.getSymbol())
     178    if (type == structureClass.getName())
    179179      return T;
    180180    if (type == Symbol.STRUCTURE_OBJECT)
     
    422422          }
    423423        if (_PRINT_STRUCTURE_.symbolValue(thread) == NIL)
    424           return unreadableString(structureClass.getSymbol().writeToString());
     424          return unreadableString(structureClass.getName().writeToString());
    425425        int maxLevel = Integer.MAX_VALUE;
    426426        LispObject printLevel = Symbol.PRINT_LEVEL.symbolValue(thread);
     
    433433          return "#";
    434434        StringBuilder sb = new StringBuilder("#S(");
    435         sb.append(structureClass.getSymbol().writeToString());
     435        sb.append(structureClass.getName().writeToString());
    436436        if (currentLevel < maxLevel)
    437437          {
  • branches/metaclass/abcl/src/org/armedbear/lisp/make_condition.java

    r12288 r12462  
    5353            symbol = (Symbol) type;
    5454        else if (type instanceof LispClass)
    55             symbol = ((LispClass)type).getSymbol();
     55            symbol = checkSymbol(((LispClass)type).getName());
    5656        else {
    5757            // This function only works on symbols and classes.
Note: See TracChangeset for help on using the changeset viewer.