Changeset 3933


Ignore:
Timestamp:
09/20/03 18:20:47 (19 years ago)
Author:
piso
Message:

Work in progress.

Location:
trunk/j/src/org/armedbear/lisp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/LispClass.java

    r3927 r3933  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispClass.java,v 1.19 2003-09-20 17:00:09 piso Exp $
     5 * $Id: LispClass.java,v 1.20 2003-09-20 18:20:47 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424import java.util.HashMap;
    2525
    26 public class LispClass extends LispObject
     26public class LispClass extends StandardObject
    2727{
    2828    protected static final HashMap map = new HashMap();
    2929
    30     private final Symbol symbol;
     30    protected final Symbol symbol;
    3131
    3232    protected LispClass(Symbol symbol)
     
    4747    public LispObject typeOf()
    4848    {
    49         return Symbol.BUILT_IN_CLASS;
     49        return Symbol.CLASS;
    5050    }
    5151
    52     public String toString()
     52    public LispClass classOf()
    5353    {
    54         StringBuffer sb = new StringBuffer("#<BUILT-IN-CLASS ");
    55         sb.append(symbol.getName());
    56         sb.append('>');
    57         return sb.toString();
     54        return BuiltInClass.CLASS;
     55    }
     56
     57    public LispObject typep(LispObject type) throws ConditionThrowable
     58    {
     59        if (type == Symbol.CLASS)
     60            return T;
     61        if (type == BuiltInClass.CLASS)
     62            return T;
     63        return super.typep(type);
    5864    }
    5965
  • trunk/j/src/org/armedbear/lisp/StandardClass.java

    r3926 r3933  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StandardClass.java,v 1.1 2003-09-20 16:54:23 piso Exp $
     5 * $Id: StandardClass.java,v 1.2 2003-09-20 18:16:55 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2222package org.armedbear.lisp;
    2323
    24 public class StandardClass extends LispObject
     24public class StandardClass extends LispClass
    2525{
    2626    protected LispObject directSuperclasses; // A list.
     27
     28    public StandardClass(Symbol symbol)
     29    {
     30        super(symbol);
     31    }
    2732}
  • trunk/j/src/org/armedbear/lisp/StructureObject.java

    r3929 r3933  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StructureObject.java,v 1.13 2003-09-20 17:02:05 piso Exp $
     5 * $Id: StructureObject.java,v 1.14 2003-09-20 18:18:28 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public final class StructureObject extends LispObject
    2525{
    26     private final Symbol name;
     26    private final Symbol symbol;
    2727    private final LispObject[] slots;
    2828
    29     public StructureObject(Symbol name, LispObject list) throws ConditionThrowable
    30     {
    31         this.name = name;
     29    public StructureObject(Symbol symbol, LispObject list) throws ConditionThrowable
     30    {
     31        this.symbol = symbol;
    3232        slots = list.copyToArray();
    3333    }
     
    3535    public StructureObject(StructureObject obj)
    3636    {
    37         this.name = obj.name;
     37        this.symbol = obj.symbol;
    3838        slots = new LispObject[obj.slots.length];
    3939        for (int i = slots.length; i-- > 0;)
     
    4343    public LispObject typeOf()
    4444    {
    45         return name;
     45        return symbol;
     46    }
     47
     48    public LispClass classOf()
     49    {
     50        return LispClass.findClass(symbol);
    4651    }
    4752
    4853    public LispObject typep(LispObject type) throws ConditionThrowable
    4954    {
    50         if (type == name)
     55        if (type == symbol)
    5156            return T;
     57        if (type instanceof StructureClass)
     58            return type == LispClass.findClass(symbol) ? T : NIL;
    5259        if (type == Symbol.STRUCTURE_OBJECT)
    5360            return T;
     
    6067    {
    6168        StringBuffer sb = new StringBuffer("#S(");
    62         sb.append(name);
     69        sb.append(symbol);
    6370        // FIXME Use *PRINT-LENGTH*.
    6471        final int limit = Math.min(slots.length, 10);
     
    8794            }
    8895            catch (ArrayIndexOutOfBoundsException e) {
    89                 getStandardOutput().printStackTrace(e);
     96                // Shouldn't happen.
    9097                throw new ConditionThrowable(new LispError("internal error"));
    9198            }
     
    104111            }
    105112            catch (ArrayIndexOutOfBoundsException e) {
    106                 getStandardOutput().printStackTrace(e);
     113                // Shouldn't happen.
    107114                throw new ConditionThrowable(new LispError("internal error"));
    108115            }
     
    121128            }
    122129            catch (ArrayIndexOutOfBoundsException e) {
    123                 getStandardOutput().printStackTrace(e);
     130                // Shouldn't happen.
    124131                throw new ConditionThrowable(new LispError("internal error"));
    125132            }
     
    138145            }
    139146            catch (ArrayIndexOutOfBoundsException e) {
    140                 getStandardOutput().printStackTrace(e);
     147                // Shouldn't happen.
    141148                throw new ConditionThrowable(new LispError("internal error"));
    142149            }
     
    160167            }
    161168            catch (ArrayIndexOutOfBoundsException e) {
    162                 getStandardOutput().printStackTrace(e);
     169                // Shouldn't happen.
    163170                throw new ConditionThrowable(new LispError("internal error"));
    164171            }
     
    179186            }
    180187            catch (ArrayIndexOutOfBoundsException e) {
    181                 getStandardOutput().printStackTrace(e);
     188                // Shouldn't happen.
    182189                throw new ConditionThrowable(new LispError("internal error"));
    183190            }
     
    198205            }
    199206            catch (ArrayIndexOutOfBoundsException e) {
    200                 getStandardOutput().printStackTrace(e);
     207                // Shouldn't happen.
    201208                throw new ConditionThrowable(new LispError("internal error"));
    202209            }
     
    217224            }
    218225            catch (ArrayIndexOutOfBoundsException e) {
    219                 getStandardOutput().printStackTrace(e);
     226                // Shouldn't happen.
    220227                throw new ConditionThrowable(new LispError("internal error"));
    221228            }
Note: See TracChangeset for help on using the changeset viewer.