public Object eval()

in src/main/java/org/apache/bsf/engines/jacl/JaclEngine.java [75:103]


  public Object eval (final String source, final int lineNo, final int columnNo,
              final Object oscript) throws BSFException {
    final String script = oscript.toString ();
    try {
      interp.eval (script);
      final TclObject result = interp.getResult();
      final Object internalRep = result.getInternalRep();

      // if the object has a corresponding Java type, unwrap it
      if (internalRep instanceof ReflectObject) {
        return ReflectObject.get(interp,result);
    }
      if (internalRep instanceof TclString) {
        return result.toString();
    }
      if (internalRep instanceof TclDouble) {
        return new Double(TclDouble.get(interp,result));
    }
      if (internalRep instanceof TclInteger) {
        return new Integer(TclInteger.get(interp,result));
    }

      return result;
    } catch (final TclException e) {
      throw new BSFException (BSFException.REASON_EXECUTION_ERROR,
                  "error while eval'ing Jacl expression: " +
                  interp.getResult (), e);
    }
  }