Changeset 5007


Ignore:
Timestamp:
12/07/03 18:31:07 (18 years ago)
Author:
piso
Message:

STRINGP, SIMPLE-STRING-P => LispString?.java

Location:
trunk/j/src/org/armedbear/lisp
Files:
2 edited

Legend:

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

    r4998 r5007  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: LispString.java,v 1.68 2003-12-07 16:44:06 piso Exp $
     5 * $Id: LispString.java,v 1.69 2003-12-07 18:31:07 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    345345    }
    346346
     347    public static final Primitive1 STRINGP = new Primitive1("stringp")
     348    {
     349        public LispObject execute(LispObject arg) throws ConditionThrowable
     350        {
     351            // Displaced arrays might be strings.
     352            return arg.STRINGP();
     353        }
     354    };
     355
     356    public static final Primitive1 SIMPLE_STRING_P = new Primitive1("simple-string-p")
     357    {
     358        public LispObject execute(LispObject arg) throws ConditionThrowable
     359        {
     360            // Displaced arrays are not simple.
     361            if (arg instanceof LispString)
     362                return ((LispString)arg).fillPointer < 0 ? T : NIL;
     363            else
     364                return NIL;
     365        }
     366    };
     367
    347368    // ### %make-string
    348369    // %make-string size initial-element element-type => string
    349370    // Returns a simple string.
    350371    private static final Primitive3 _MAKE_STRING =
    351         new Primitive3("%make-string", PACKAGE_SYS, false) {
     372        new Primitive3("%make-string", PACKAGE_SYS, false)
     373    {
    352374        public LispObject execute(LispObject size, LispObject initialElement,
    353375                                  LispObject elementType) throws ConditionThrowable
     
    380402    };
    381403
    382     private static final Primitive2 CHAR = new Primitive2("char") {
     404    private static final Primitive2 CHAR = new Primitive2("char")
     405    {
    383406        public LispObject execute(LispObject first, LispObject second)
    384407            throws ConditionThrowable
  • trunk/j/src/org/armedbear/lisp/Primitives.java

    r5006 r5007  
    33 *
    44 * Copyright (C) 2002-2003 Peter Graves
    5  * $Id: Primitives.java,v 1.513 2003-12-07 18:10:41 piso Exp $
     5 * $Id: Primitives.java,v 1.514 2003-12-07 18:31:00 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    5858    private static final int MAKUNBOUND                 = 24;
    5959    private static final int SIMPLE_BIT_VECTOR_P        = 25;
    60     private static final int SIMPLE_STRING_P            = 26;
    61     private static final int SIMPLE_VECTOR_P            = 27;
    62     private static final int STRINGP                    = 28;
    63     private static final int UPPER_CASE_P               = 29;
    64     private static final int VECTORP                    = 30;
     60    private static final int SIMPLE_VECTOR_P            = 26;
     61    private static final int UPPER_CASE_P               = 27;
     62    private static final int VECTORP                    = 28;
    6563
    6664    private Primitives()
     
    9290        definePrimitive1("makunbound", MAKUNBOUND);
    9391        definePrimitive1("simple-bit-vector-p", SIMPLE_BIT_VECTOR_P);
    94         definePrimitive1("simple-string-p", SIMPLE_STRING_P);
    9592        definePrimitive1("simple-vector-p", SIMPLE_VECTOR_P);
    96         definePrimitive1("stringp", STRINGP);
    9793        definePrimitive1("upper-case-p", UPPER_CASE_P);
    9894        definePrimitive1("vectorp", VECTORP);
     
    218214            case CHAR_UPCASE:                   // ### char-upcase
    219215                return LispCharacter.getInstance(Utilities.toUpperCase(LispCharacter.getValue(arg)));
    220             case STRINGP:                       // ### stringp
    221                 return arg.STRINGP();
    222             case SIMPLE_STRING_P:               // ### simple-string-p
    223                 return arg.SIMPLE_STRING_P();
    224216            case EVAL:                          // ### eval
    225217                return eval(arg, new Environment(), LispThread.currentThread());
Note: See TracChangeset for help on using the changeset viewer.