Changeset 8775


Ignore:
Timestamp:
03/15/05 03:58:06 (16 years ago)
Author:
piso
Message:

MAKE-ENVIRONMENT
ENVIRONMENT-ADD-MACRO-DEFINITION

File:
1 edited

Legend:

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

    r8667 r8775  
    33 *
    44 * Copyright (C) 2002-2005 Peter Graves
    5  * $Id: Environment.java,v 1.22 2005-02-28 19:05:00 piso Exp $
     5 * $Id: Environment.java,v 1.23 2005-03-15 03:58:06 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    224224    }
    225225
     226    public static final Primitive MAKE_ENVIRONMENT =
     227        new Primitive("make-environment", PACKAGE_SYS, true,
     228                      "&optional parent-environment")
     229    {
     230        public LispObject execute()
     231        {
     232            return new Environment();
     233        }
     234        public LispObject execute(LispObject arg) throws ConditionThrowable
     235        {
     236            if (arg == NIL)
     237                return new Environment();
     238            return new Environment(checkEnvironment(arg));
     239        }
     240    };
     241
     242    public static final Primitive ENVIRONMENT_ADD_MACRO_DEFINITION =
     243        new Primitive("environment-add-macro-definition", PACKAGE_SYS, true,
     244                      "environment name expander")
     245    {
     246        public LispObject execute(LispObject first, LispObject second,
     247                                  LispObject third)
     248            throws ConditionThrowable
     249        {
     250            Environment env = checkEnvironment(first);
     251            LispObject name = second;
     252            LispObject expander = third;
     253            env.addFunctionBinding(name, expander);
     254            return env;
     255        }
     256    };
     257
    226258    // ### empty-environment-p
    227259    private static final Primitive EMPTY_ENVIRONMENT_P =
Note: See TracChangeset for help on using the changeset viewer.