Changeset 3539


Ignore:
Timestamp:
08/28/03 00:00:15 (20 years ago)
Author:
piso
Message:

FUNCALL

File:
1 edited

Legend:

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

    r3538 r3539  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.358 2003-08-27 17:28:27 piso Exp $
     5 * $Id: Primitives.java,v 1.359 2003-08-28 00:00:15 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    23392339    // ### funcall
    23402340    private static final Primitive FUNCALL = new Primitive("funcall") {
    2341         public LispObject execute(LispObject first) throws Condition
     2341        public LispObject execute(LispObject arg) throws Condition
    23422342        {
    23432343            LispObject fun;
    2344             if (first instanceof Symbol) {
    2345                 fun = first.getSymbolFunction();
    2346                 if (fun instanceof SpecialOperator)
    2347                     throw new UndefinedFunctionError(first);
    2348             } else
    2349                 fun = first;
     2344            if (arg instanceof Symbol)
     2345                fun = arg.getSymbolFunction();
     2346            else
     2347                fun = arg;
    23502348            if (fun instanceof Function)
    23512349                return funcall0(fun, LispThread.currentThread());
    2352             throw new TypeError(fun, "function");
     2350            throw new UndefinedFunctionError(arg);
    23532351        }
    23542352        public LispObject execute(LispObject first, LispObject second)
     
    23562354        {
    23572355            LispObject fun;
    2358             if (first instanceof Symbol) {
     2356            if (first instanceof Symbol)
    23592357                fun = first.getSymbolFunction();
    2360                 if (fun instanceof SpecialOperator)
    2361                     throw new UndefinedFunctionError(first);
    2362             } else
     2358            else
    23632359                fun = first;
    23642360            if (fun instanceof Function)
    23652361                return funcall1(fun, second, LispThread.currentThread());
    2366             throw new TypeError(fun, "function");
     2362            throw new UndefinedFunctionError(first);
    23672363        }
    23682364        public LispObject execute(LispObject first, LispObject second,
    2369             LispObject third) throws Condition
     2365                                  LispObject third)
     2366            throws Condition
    23702367        {
    23712368            LispObject fun;
    2372             if (first instanceof Symbol) {
     2369            if (first instanceof Symbol)
    23732370                fun = first.getSymbolFunction();
    2374                 if (fun instanceof SpecialOperator)
    2375                     throw new UndefinedFunctionError(first);
    2376             } else
     2371            else
    23772372                fun = first;
    23782373            if (fun instanceof Function)
    23792374                return funcall2(fun, second, third, LispThread.currentThread());
    2380             throw new TypeError(fun, "function");
     2375            throw new UndefinedFunctionError(first);
    23812376        }
    23822377        public LispObject execute(LispObject[] args) throws Condition
     
    23842379            if (args.length < 1)
    23852380                throw new WrongNumberOfArgumentsException(this);
    2386             LispObject fun = args[0];
    2387             if (fun instanceof Symbol) {
    2388                 fun = fun.getSymbolFunction();
    2389                 if (fun instanceof SpecialOperator)
    2390                     throw new UndefinedFunctionError(args[0]);
    2391             }
     2381            LispObject fun;
     2382            if (args[0] instanceof Symbol)
     2383                fun = args[0].getSymbolFunction();
     2384            else
     2385                fun = args[0];
    23922386            if (fun instanceof Function) {
    23932387                final int length = args.length - 1; // Number of arguments.
     
    24012395                }
    24022396            }
    2403             throw new TypeError(fun, "function");
     2397            throw new UndefinedFunctionError(args[0]);
    24042398        }
    24052399    };
Note: See TracChangeset for help on using the changeset viewer.