コード例 #1
0
  @Override
  public InputStream getResourceAsStream(String resourceName) {
    final LispThread thread = LispThread.currentThread();

    Pathname name = new Pathname(resourceName.substring("org/armedbear/lisp/".length()));
    LispObject truenameFasl = Symbol.LOAD_TRUENAME_FASL.symbolValue(thread);
    LispObject truename = Symbol.LOAD_TRUENAME.symbolValue(thread);

    if (truenameFasl instanceof Pathname) {
      return Pathname.mergePathnames(name, (Pathname) truenameFasl, Keyword.NEWEST)
          .getInputStream();
    } else if (truename instanceof Pathname) {
      return Pathname.mergePathnames(name, (Pathname) truename, Keyword.NEWEST).getInputStream();
    } else if (!Pathname.truename(name).equals(NIL)) {
      return name.getInputStream();
    }

    return null;
  }
コード例 #2
0
 public LispObject loadFunction(int fnNumber) {
   // Function name is fnIndex + 1
   String name = baseName + "_" + (fnNumber + 1);
   try {
     Class clz = loadClass(name);
     Function f = (Function) clz.newInstance();
     if (clz.getClassLoader() instanceof JavaClassLoader) {
       // Don't do this for system classes (though probably dont need this for other classes)
       f.setClassBytes(getFunctionClassBytes(name));
     }
     return f;
   } catch (Throwable e) {
     if (e instanceof ControlTransfer) {
       throw (ControlTransfer) e;
     }
     Debug.trace(e);
     return error(
         new LispError(
             "Compiled function can't be loaded: "
                 + name
                 + " from "
                 + Symbol.LOAD_TRUENAME.symbolValue()));
   }
 }