Changeset 5859


Ignore:
Timestamp:
02/17/04 01:38:32 (17 years ago)
Author:
piso
Message:

ENVIRONMENT-VARS

File:
1 edited

Legend:

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

    r5858 r5859  
    33 *
    44 * Copyright (C) 2002-2004 Peter Graves
    5  * $Id: Environment.java,v 1.11 2004-02-16 19:59:52 piso Exp $
     5 * $Id: Environment.java,v 1.12 2004-02-17 01:38:32 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    198198        }
    199199    };
     200
     201    // ### environment-vars
     202    private static final Primitive1 ENVIRONMENT_VARS =
     203        new Primitive1("environment-vars", PACKAGE_SYS, false, "environment")
     204    {
     205        public LispObject execute(LispObject arg) throws ConditionThrowable
     206        {
     207            try {
     208                Environment env = (Environment) arg;
     209                LispObject result = NIL;
     210                for (Binding binding = env.vars; binding != null; binding = binding.next)
     211                    if (!binding.specialp)
     212                        result = new Cons(binding.symbol, result);
     213                return result;
     214            }
     215            catch (ClassCastException e) {
     216                return signal(new TypeError(String.valueOf(arg) + " is not an environment."));
     217            }
     218        }
     219    };
    200220}
Note: See TracChangeset for help on using the changeset viewer.