Changeset 11370


Ignore:
Timestamp:
10/30/08 22:11:11 (13 years ago)
Author:
astalla
Message:

Fixed: proxy handling of no-args methods; problems caused by closing the input stream in AbclScriptEngine?.eval.
Minor cleanups.

Location:
branches/scripting/j/src/org/armedbear/lisp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/scripting/j/src/org/armedbear/lisp/JProxy.java

    r11369 r11370  
    158158        }
    159159       
     160        if(args == null) {
     161          args = new Object[0];
     162        }
    160163      LispObject[] lispArgs = new LispObject[args.length + 2];
    161164      lispArgs[0] = toLispObject(proxy);
  • branches/scripting/j/src/org/armedbear/lisp/scripting/AbclScriptEngine.java

    r11369 r11370  
    286286      outStream._finishOutput();
    287287      out.flush();
    288       in.close();
     288      //in.close();
    289289      out.close();
    290290      return toJava(retVal);
     
    321321  }
    322322
    323   private static Object toJava(LispObject lispObject) {
     323  private static Object toJava(LispObject lispObject) throws ConditionThrowable {
     324    return lispObject.javaInstance();
     325    /*
    324326    if(lispObject instanceof JavaObject) {
    325327      return ((JavaObject) lispObject).getObject();
     
    338340    } else {
    339341      return lispObject;
    340     }
     342    }*/
    341343  }
    342344 
     
    380382          return new JavaObject(javaObject);
    381383        }
    382     /*if(javaObject instanceof LispObject) {
    383       return (LispObject) javaObject;
    384     } else if(javaObject instanceof Float) {
    385       return new SingleFloat((Float) javaObject);
    386     } else if(javaObject instanceof Double) {
    387       return new DoubleFloat((Double) javaObject);
    388     } else if(javaObject instanceof Character) {
    389       return LispCharacter.getInstance((Character) javaObject);
    390     } else if(javaObject instanceof Long) {
    391       return new Bignum((Long) javaObject);
    392     } else if(javaObject instanceof BigInteger) {
    393       return new Bignum((BigInteger) javaObject);
    394     } else if(javaObject instanceof Integer) {
    395       return new Fixnum((Integer) javaObject);
    396     } else if(javaObject instanceof String) {
    397       return new SimpleString((String) javaObject);
    398     } else {
    399       return new JavaObject(javaObject);
    400     }*/
    401384  }
    402385 
    403   @SuppressWarnings("unchecked")
    404386  @Override
    405387  public <T> T getInterface(Class<T> clasz) {
    406     return getInterface(Lisp.NIL, clasz);
     388    //return getInterface(Lisp.NIL, clasz);
     389    throw new UnsupportedOperationException("Not implemented");
    407390  }
    408391
     
    411394  public <T> T getInterface(Object thiz, Class<T> clasz) {
    412395    try {
    413       Symbol s = findSymbol("find-java-interface-implementation", "abcl-script");
    414       Object obj = s.getSymbolFunction().execute(new JavaObject(clasz));
    415       if(obj instanceof Function) {
    416         return (T) ((JavaObject) ((Function) obj).execute((LispObject) thiz)).getObject();
    417       } else {
    418         return null;
    419       }
     396      Symbol s = findSymbol("jmake-proxy", "JAVA");
     397      LispObject f = s.getSymbolFunction();
     398      JavaObject iface = new JavaObject(clasz);
     399      return (T) ((JavaObject) f.execute(iface, (LispObject) thiz)).javaInstance();
    420400    } catch (ConditionThrowable e) {
    421401      throw new Error(e);
Note: See TracChangeset for help on using the changeset viewer.