Changeset 4098


Ignore:
Timestamp:
09/28/03 14:58:43 (20 years ago)
Author:
piso
Message:

FIND-CLASS

File:
1 edited

Legend:

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

    r3993 r4098  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: LispClass.java,v 1.26 2003-09-22 12:24:08 piso Exp $
     5 * $Id: LispClass.java,v 1.27 2003-09-28 14:58:43 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    156156
    157157    // ### find-class
     158    // find-class symbol &optional errorp environment => class
    158159    private static final Primitive FIND_CLASS = new Primitive("find-class") {
    159         public LispObject execute(LispObject[] args) throws ConditionThrowable
    160         {
    161             if (args.length < 1)
    162                 throw new ConditionThrowable(new WrongNumberOfArgumentsException(this));
    163             LispObject obj = (LispObject) map.get(checkSymbol(args[0]));
    164             return obj != null ? obj : NIL;
     160        public LispObject execute(LispObject symbol) throws ConditionThrowable
     161        {
     162            LispObject c = findClass(checkSymbol(symbol));
     163            if (c == null) {
     164                StringBuffer sb = new StringBuffer("there is no class named ");
     165                sb.append(symbol);
     166                throw new ConditionThrowable(new LispError(sb.toString()));
     167            }
     168            return c;
     169        }
     170        public LispObject execute(LispObject symbol, LispObject errorp)
     171            throws ConditionThrowable
     172        {
     173            LispObject c = findClass(checkSymbol(symbol));
     174            if (c == null) {
     175                if (errorp != NIL) {
     176                    StringBuffer sb = new StringBuffer("there is no class named ");
     177                    sb.append(symbol);
     178                    throw new ConditionThrowable(new LispError(sb.toString()));
     179                }
     180                return NIL;
     181            }
     182            return c;
     183        }
     184        public LispObject execute(LispObject symbol, LispObject errorp,
     185                                  LispObject environment)
     186            throws ConditionThrowable
     187        {
     188            // FIXME Ignore environment.
     189            return execute(symbol, errorp);
    165190        }
    166191    };
Note: See TracChangeset for help on using the changeset viewer.