Changeset 4941


Ignore:
Timestamp:
12/02/03 19:43:13 (18 years ago)
Author:
piso
Message:

FSET

File:
1 edited

Legend:

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

    r4914 r4941  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.508 2003-11-29 19:23:36 piso Exp $
     5 * $Id: Primitives.java,v 1.509 2003-12-02 19:43:13 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    28342834
    28352835    // ### fset
    2836     private static final Primitive2 FSET =
    2837         new Primitive2("fset", PACKAGE_SYS, false) {
    2838         public LispObject execute(LispObject first, LispObject second)
    2839             throws ConditionThrowable
    2840         {
    2841             Symbol symbol = checkSymbol(first);
    2842             if (second instanceof LispString) {
    2843                 String className = ((LispString)second).getValue();
    2844                 if (className.endsWith(".class")) {
    2845                     try {
    2846                         JavaClassLoader loader = new JavaClassLoader();
    2847                         Class c = loader.loadClassFromFile(className);
    2848                         if (c != null) {
    2849                             Class[] parameterTypes = new Class[0];
    2850                             java.lang.reflect.Constructor constructor =
    2851                                 c.getConstructor(parameterTypes);
    2852                             Object[] initargs = new Object[0];
    2853                             LispObject obj =
    2854                                 (LispObject) constructor.newInstance(initargs);
    2855                             symbol.setSymbolFunction(obj);
    2856                             return obj;
    2857                         }
    2858                     }
    2859                     catch (Throwable t) {
    2860                         Debug.trace(t);
    2861                     }
    2862                 }
    2863                 throw new ConditionThrowable(new LispError("unable to load ".concat(className)));
    2864             }
    2865             symbol.setSymbolFunction(second);
     2836    private static final Primitive2 FSET = new Primitive2("fset", PACKAGE_SYS, false)
     2837    {
     2838        public LispObject execute(LispObject first, LispObject second)
     2839            throws ConditionThrowable
     2840        {
     2841            checkSymbol(first).setSymbolFunction(second);
    28662842            return second;
    28672843        }
Note: See TracChangeset for help on using the changeset viewer.