Changeset 4346


Ignore:
Timestamp:
10/13/03 13:10:37 (19 years ago)
Author:
piso
Message:

ADD-CLASS => %SET-FIND-CLASS

File:
1 edited

Legend:

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

    r4311 r4346  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispClass.java,v 1.32 2003-10-11 18:48:09 piso Exp $
     5 * $Id: LispClass.java,v 1.33 2003-10-13 13:10:37 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    171171    }
    172172
    173     // ### add-class
    174     private static final Primitive1 ADD_CLASS =
    175         new Primitive1("add-class", PACKAGE_SYS, false)
    176     {
    177         public LispObject execute(LispObject obj) throws ConditionThrowable
    178         {
    179             if (obj instanceof LispClass) {
    180                 LispClass c = (LispClass) obj;
    181                 addClass(c.getSymbol(), c);
    182                 return c;
    183             }
    184             throw new ConditionThrowable(new TypeError(this, "class"));
    185         }
    186     };
    187 
    188173    // ### find-class
    189174    // find-class symbol &optional errorp environment => class
     
    222207    };
    223208
     209    // ### %set-find-class
     210    private static final Primitive2 _SET_FIND_CLASS =
     211        new Primitive2("%set-find-class", PACKAGE_SYS, false)
     212    {
     213        public LispObject execute(LispObject first, LispObject second)
     214            throws ConditionThrowable
     215        {
     216            Symbol symbol = checkSymbol(first);
     217            if (second instanceof LispClass) {
     218                addClass(symbol, (LispClass) second);
     219                return second;
     220            }
     221            if (second == NIL) {
     222                map.remove(symbol);
     223                return second;
     224            }
     225            throw new ConditionThrowable(new TypeError(second, "class"));
     226        }
     227    };
     228
    224229    // ### class-name
    225230    private static final Primitive1 CLASS_NAME = new Primitive1("class-name")
Note: See TracChangeset for help on using the changeset viewer.