Changeset 5038


Ignore:
Timestamp:
12/09/03 20:38:53 (18 years ago)
Author:
asimon
Message:

Peter's new EXT:ARGLIST

File:
1 edited

Legend:

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

    r5000 r5038  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: arglist.java,v 1.1 2003-12-07 17:01:41 piso Exp $
     5 * $Id: arglist.java,v 1.2 2003-12-09 20:38:53 asimon Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    2424public final class arglist extends Lisp
    2525{
    26     // ### arglist
     26
    2727    private static final Primitive1 ARGLIST =
    2828        new Primitive1("arglist", PACKAGE_EXT, true)
     
    3030        public LispObject execute(LispObject arg) throws ConditionThrowable
    3131        {
     32            LispThread thread = LispThread.currentThread();
    3233            Function function = coerceToFunction(arg);
    3334            LispObject arglist = function.getArglist();
    3435            final LispObject value1, value2;
     36            if (arglist instanceof LispString) {
     37                String s = ((LispString)arglist).getValue();
     38                // Give the string list syntax.
     39                s = "(" + s + ")";
     40                // Bind *PACKAGE* so we use the EXT package if we need
     41                // to intern any symbols.
     42                Environment oldDynEnv = thread.getDynamicEnvironment();
     43                thread.bindSpecial(_PACKAGE_, PACKAGE_EXT);
     44                try {
     45                    arglist = readObjectFromString(s);
     46                }
     47                finally {
     48                    thread.setDynamicEnvironment(oldDynEnv);
     49                }
     50                function.setArglist(arglist);
     51            }
    3552            if (arglist != null) {
    3653                value1 = arglist;
     
    4057                value2 = NIL;
    4158            }
    42             return LispThread.currentThread().setValues(value1, value2);
     59            return thread.setValues(value1, value2);
    4360        }
    4461    };
Note: See TracChangeset for help on using the changeset viewer.