Changeset 4514


Ignore:
Timestamp:
10/23/03 15:01:41 (18 years ago)
Author:
piso
Message:

JNEW, makeLispObject(): added float support (Doug McNaught?).

File:
1 edited

Legend:

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

    r3999 r4514  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Java.java,v 1.11 2003-09-22 17:17:53 piso Exp $
     5 * $Id: Java.java,v 1.12 2003-10-23 15:01:41 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    190190    // ### jnew
    191191    // jnew constructor &rest args
    192     private static final Primitive JNEW = new Primitive("jnew", PACKAGE_JAVA) {
     192    private static final Primitive JNEW = new Primitive("jnew", PACKAGE_JAVA)
     193    {
    193194        public LispObject execute(LispObject[] args) throws ConditionThrowable
    194195        {
     
    205206                    else if (arg instanceof Fixnum)
    206207                        initargs[i-1] = new Integer(((Fixnum)arg).getValue());
     208                    else if (arg instanceof LispFloat)
     209                        initargs[i-1] = new Double(((LispFloat)arg).getValue());
    207210                }
    208211                return new JavaObject(constructor.newInstance(initargs));
     
    216219    // ### jcall
    217220    // jcall method instance &rest args
    218     private static final Primitive JCALL = new Primitive("jcall", PACKAGE_JAVA) {
     221    private static final Primitive JCALL = new Primitive("jcall", PACKAGE_JAVA)
     222    {
    219223        public LispObject execute(LispObject[] args) throws ConditionThrowable
    220224        {
     
    276280        if (obj instanceof Boolean)
    277281            return ((Boolean)obj).booleanValue() ? T : NIL;
     282        if (obj instanceof Integer)
     283            return new Fixnum(((Integer)obj).intValue());
    278284        if (obj instanceof Long)
    279285            return new Bignum(((Long)obj).longValue());
    280         if (obj instanceof Integer)
    281             return new Fixnum(((Integer)obj).intValue());
     286        if (obj instanceof Double || obj instanceof Float)
     287            return new LispFloat(((Number)obj).doubleValue());
    282288        if (obj instanceof String)
    283289            return new LispString((String)obj);
Note: See TracChangeset for help on using the changeset viewer.