Changeset 14570


Ignore:
Timestamp:
07/22/13 13:21:06 (4 years ago)
Author:
mevenson
Message:

Restore Packages.findPackage() API for obtaining the current package in Java.

Restore examples/java-to-lisp-1/MainAlternative.java to this use of
the API.

Fixes #324.

Location:
trunk/abcl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/examples/java-to-lisp-1/MainAlternative.java

    r14569 r14570  
    2020 */
    2121
    22 import org.armedbear.lisp.*;
     22import org.armedbear.lisp.Function;
     23import org.armedbear.lisp.Interpreter;
     24import org.armedbear.lisp.Package;
     25import org.armedbear.lisp.Packages;
     26import org.armedbear.lisp.Symbol;
    2327
    2428public class MainAlternative
     
    3741    // the function is not in a separate package, thus the
    3842    // correct package is CL-USER. Symbol names are
    39     // upper case. Package needs the prefix, because java
    40     // also has a class named Package.
    41     org.armedbear.lisp.Package defaultPackage =
    42         org.armedbear.lisp.Package.findPackage("CL-USER");
    43     Symbol sym =
    44         defaultPackage.findAccessibleSymbol("LISPFUNCTION");
     43    // (usually) upper case.
     44    Package defaultPackage
     45                  = Packages.findPackage("CL-USER");
     46    Symbol sym
     47                  = defaultPackage.findAccessibleSymbol("LISPFUNCTION");
    4548    Function function = (Function) sym.getSymbolFunction();
    4649    function.execute();
  • trunk/abcl/src/org/armedbear/lisp/Package.java

    r14557 r14570  
    6565    private transient LispObject useList = null;
    6666    private transient ArrayList<Package> usedByList = null;
    67   private transient ConcurrentHashMap<String, Package> localNicknames;
     67    private transient ConcurrentHashMap<String, Package> localNicknames;
    6868
    6969    // Anonymous package.
  • trunk/abcl/src/org/armedbear/lisp/Packages.java

    r14405 r14570  
    8787  }
    8888
     89  /**
     90      Returns the current package of the current LispThread.
     91     
     92      Intended to be used from Java code manipulating an Interpreter
     93      instance.
     94  */
     95  public static final synchronized Package findPackage(String name) {
     96    return getCurrentPackage().findPackage(name);
     97  }
     98   
    8999  // Finds package named `name'.  Returns null if package doesn't exist.
    90100  // Called by Package.findPackage after checking package-local package
Note: See TracChangeset for help on using the changeset viewer.