Changeset 4348


Ignore:
Timestamp:
10/13/03 14:11:52 (19 years ago)
Author:
piso
Message:

STD-INSTANCE-CLASS, %SET-STD-INSTANCE-CLASS, %SET-STD-INSTANCE-SLOTS

File:
1 edited

Legend:

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

    r4326 r4348  
    33 *
    44 * Copyright (C) 2003 Peter Graves
    5  * $Id: StandardObject.java,v 1.8 2003-10-12 16:13:54 piso Exp $
     5 * $Id: StandardObject.java,v 1.9 2003-10-13 14:11:52 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    8484    }
    8585
     86    // ### std-instance-class
     87    private static final Primitive1 STD_INSTANCE_CLASS =
     88        new Primitive1("std-instance-class", PACKAGE_SYS, false)
     89    {
     90        public LispObject execute(LispObject arg) throws ConditionThrowable
     91        {
     92            if (arg instanceof StandardObject)
     93                return ((StandardObject)arg).cls;
     94            throw new ConditionThrowable(new TypeError(arg, "standard object"));
     95        }
     96    };
     97
     98    // ### %set-std-instance-class
     99    private static final Primitive2 _SET_STD_INSTANCE_CLASS =
     100        new Primitive2("%set-std-instance-class", PACKAGE_SYS, false)
     101    {
     102        public LispObject execute(LispObject first, LispObject second)
     103            throws ConditionThrowable
     104        {
     105            if (first instanceof StandardObject) {
     106                ((StandardObject)first).cls = (LispClass) second;
     107                return second;
     108            }
     109            throw new ConditionThrowable(new TypeError(first, "standard object"));
     110        }
     111    };
     112
     113    // ### std-instance-slots
    86114    private static final Primitive1 STD_INSTANCE_SLOTS =
    87115        new Primitive1("std-instance-slots", PACKAGE_SYS, false)
     
    92120                return ((StandardObject)arg).slots;
    93121            throw new ConditionThrowable(new TypeError(arg, "standard object"));
     122        }
     123    };
     124
     125    // ### %set-std-instance-slots
     126    private static final Primitive2 _SET_STD_INSTANCE_SLOTS =
     127        new Primitive2("%set-std-instance-slots", PACKAGE_SYS, false)
     128    {
     129        public LispObject execute(LispObject first, LispObject second)
     130            throws ConditionThrowable
     131        {
     132            if (first instanceof StandardObject) {
     133                ((StandardObject)first).slots = second;
     134                return second;
     135            }
     136            throw new ConditionThrowable(new TypeError(first, "standard object"));
    94137        }
    95138    };
Note: See TracChangeset for help on using the changeset viewer.