Changeset 5205


Ignore:
Timestamp:
12/19/03 19:20:12 (17 years ago)
Author:
piso
Message:

INSTANCE-REF, %SET-INSTANCE-REF

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

Legend:

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

    r5199 r5205  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: Autoload.java,v 1.112 2003-12-19 18:29:29 piso Exp $
     5 * $Id: Autoload.java,v 1.113 2003-12-19 19:20:12 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    303303        autoload(PACKAGE_SYS, "%set-class-slots", "SlotClass");
    304304        autoload(PACKAGE_SYS, "%set-generic-function-discriminating-function", "GenericFunction");
     305        autoload(PACKAGE_SYS, "%set-instance-ref", "StandardObject");
    305306        autoload(PACKAGE_SYS, "%string-capitalize", "StringFunctions");
    306307        autoload(PACKAGE_SYS, "%string-downcase", "StringFunctions");
     
    336337        autoload(PACKAGE_SYS, "generic-function-discriminating-function", "GenericFunction");
    337338        autoload(PACKAGE_SYS, "hash-table-entries", "HashTable");
     339        autoload(PACKAGE_SYS, "instance-ref", "StandardObject");
    338340        autoload(PACKAGE_SYS, "layout-class", "Layout");
    339341        autoload(PACKAGE_SYS, "layout-length", "Layout");
  • trunk/j/src/org/armedbear/lisp/StandardObject.java

    r5202 r5205  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StandardObject.java,v 1.14 2003-12-19 18:43:01 piso Exp $
     5 * $Id: StandardObject.java,v 1.15 2003-12-19 19:19:52 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    170170            }
    171171            return signal(new TypeError(first, Symbol.STANDARD_OBJECT));
     172        }
     173    };
     174
     175    // ### instance-ref
     176    // instance-ref object index => value
     177    private static final Primitive2 INSTANCE_REF =
     178        new Primitive2("instance-ref", PACKAGE_SYS, false)
     179    {
     180        public LispObject execute(LispObject first, LispObject second)
     181            throws ConditionThrowable
     182        {
     183            try {
     184                return ((StandardObject)first).slots.AREF(second);
     185            }
     186            catch (ClassCastException e) {
     187                return signal(new TypeError(first, Symbol.STANDARD_OBJECT));
     188            }
     189        }
     190    };
     191
     192    // ### %set-instance-ref
     193    // %set-instance-ref object index new-value => new-value
     194    private static final Primitive3 _SET_INSTANCE_REF =
     195        new Primitive3("%set-instance-ref", PACKAGE_SYS, false)
     196    {
     197        public LispObject execute(LispObject first, LispObject second,
     198                                  LispObject third)
     199            throws ConditionThrowable
     200        {
     201            try {
     202                ((StandardObject)first).slots.set(Fixnum.getValue(second),
     203                                                  third);
     204                return third;
     205            }
     206            catch (ClassCastException e) {
     207                return signal(new TypeError(first, Symbol.STANDARD_OBJECT));
     208            }
    172209        }
    173210    };
Note: See TracChangeset for help on using the changeset viewer.