Changeset 13103


Ignore:
Timestamp:
12/26/10 11:59:59 (11 years ago)
Author:
ehuelsmann
Message:

Add JNULL_REF to check for a JavaObject? containing a 'null' value.

File:
1 edited

Legend:

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

    r12849 r13103  
    10561056    };
    10571057
     1058    private static final Primitive JNULL_REF = new pf_jnull_ref();
     1059    @DocString(name="jnull-ref", args="object",
     1060    doc="Returns a non-NIL value when the JAVA-OBJECT `object` is `null`,\n"
     1061            + "or signals a TYPE-ERROR condition if the object isn't of\n"
     1062            + "the right type.")
     1063    private static final class pf_jnull_ref extends Primitive
     1064    {
     1065        pf_jnull_ref()
     1066        {
     1067            super("jnull-ref", PACKAGE_JAVA, true);
     1068        }
     1069
     1070        @Override
     1071        public LispObject execute(LispObject ref)
     1072        {
     1073            if (ref instanceof JavaObject)
     1074            {
     1075                JavaObject jref = (JavaObject)ref;
     1076                return (jref.javaInstance() == null) ? T : NIL;
     1077            } else
     1078                return Lisp.type_error(ref, Symbol.JAVA_OBJECT);
     1079        }
     1080    };
     1081
     1082
    10581083    private static final Primitive JAVA_OBJECT_P = new pf_java_object_p();
    10591084    @DocString(name="java-object-p", args="object",
Note: See TracChangeset for help on using the changeset viewer.