[armedbear-cvs] r13714 - trunk/abcl/src/org/armedbear/lisp

mevenson at common-lisp.net mevenson at common-lisp.net
Wed Jan 4 13:44:29 UTC 2012


Author: mevenson
Date: Wed Jan  4 05:44:29 2012
New Revision: 13714

Log:
[PATCH 2/2] add class SPECIALIZER, splice it into mop class

>From 3d54c11cd984ce6df5a563c57dce85765c1ab602 Mon Sep 17 00:00:00 2001
 hierarchy.
---
 src/org/armedbear/lisp/Specializer.java   |   52 +++++++++++++++++++++++++++++
 src/org/armedbear/lisp/StandardClass.java |   18 ++++++----
 src/org/armedbear/lisp/Symbol.java        |    2 +
 3 files changed, 65 insertions(+), 7 deletions(-)
 create mode 100644 src/org/armedbear/lisp/Specializer.java

Added:
   trunk/abcl/src/org/armedbear/lisp/Specializer.java
Modified:
   trunk/abcl/src/org/armedbear/lisp/StandardClass.java
   trunk/abcl/src/org/armedbear/lisp/Symbol.java

Added: trunk/abcl/src/org/armedbear/lisp/Specializer.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/abcl/src/org/armedbear/lisp/Specializer.java	Wed Jan  4 05:44:29 2012	(r13714)
@@ -0,0 +1,52 @@
+/*
+ * Specializer.java
+ *
+ * Copyright (C) 2003-2005 Peter Graves, 2012 Rudolf Schlatte
+ * $Id$
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * As a special exception, the copyright holders of this library give you
+ * permission to link this library with independent modules to produce an
+ * executable, regardless of the license terms of these independent
+ * modules, and to copy and distribute the resulting executable under
+ * terms of your choice, provided that you also meet, for each linked
+ * independent module, the terms and conditions of the license of that
+ * module.  An independent module is a module which is not derived from
+ * or based on this library.  If you modify this library, you may extend
+ * this exception to your version of the library, but you are not
+ * obligated to do so.  If you do not wish to do so, delete this
+ * exception statement from your version.
+ */
+
+package org.armedbear.lisp;
+
+import static org.armedbear.lisp.Lisp.*;
+
+public abstract class Specializer extends Metaobject
+{
+  protected Specializer(LispClass cls, int length)
+  {
+    super(cls, length);
+  }
+
+  @Override
+  public LispObject typep(LispObject type)
+  {
+    if (type == Symbol.SPECIALIZER)
+      return T;
+    return super.typep(type);
+  }
+}

Modified: trunk/abcl/src/org/armedbear/lisp/StandardClass.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/StandardClass.java	Wed Jan  4 05:44:27 2012	(r13713)
+++ trunk/abcl/src/org/armedbear/lisp/StandardClass.java	Wed Jan  4 05:44:29 2012	(r13714)
@@ -387,6 +387,8 @@
     addStandardClass(Symbol.STANDARD_OBJECT, list(BuiltInClass.CLASS_T));
   public static final StandardClass METAOBJECT =
     addStandardClass(Symbol.METAOBJECT, list(STANDARD_OBJECT));
+  public static final StandardClass SPECIALIZER =
+    addStandardClass(Symbol.SPECIALIZER, list(METAOBJECT));
 
     public static final StandardClass SLOT_DEFINITION =
         addStandardClass(Symbol.SLOT_DEFINITION, list(METAOBJECT));
@@ -422,7 +424,7 @@
                                                    BuiltInClass.FUNCTION));
 
   public static final StandardClass CLASS =
-    addStandardClass(Symbol.CLASS, list(STANDARD_OBJECT));
+    addStandardClass(Symbol.CLASS, list(SPECIALIZER));
 
   public static final StandardClass BUILT_IN_CLASS =
     addStandardClass(Symbol.BUILT_IN_CLASS, list(CLASS));
@@ -578,14 +580,14 @@
                                list(PACKAGE_CL.intern("ARITHMETIC-ERROR-OPERATION"))),
             new SlotDefinition(Symbol.OPERANDS,
                                list(PACKAGE_CL.intern("ARITHMETIC-ERROR-OPERANDS")))));
-    BUILT_IN_CLASS.setCPL(BUILT_IN_CLASS, CLASS, STANDARD_OBJECT,
+    BUILT_IN_CLASS.setCPL(BUILT_IN_CLASS, CLASS, SPECIALIZER, METAOBJECT, STANDARD_OBJECT,
                           BuiltInClass.CLASS_T);
     CELL_ERROR.setCPL(CELL_ERROR, ERROR, SERIOUS_CONDITION, CONDITION,
                       STANDARD_OBJECT, BuiltInClass.CLASS_T);
     CELL_ERROR.setDirectSlotDefinitions(
       list(new SlotDefinition(Symbol.NAME,
                                list(Symbol.CELL_ERROR_NAME))));
-    CLASS.setCPL(CLASS, STANDARD_OBJECT, BuiltInClass.CLASS_T);
+    CLASS.setCPL(CLASS, SPECIALIZER, METAOBJECT, STANDARD_OBJECT, BuiltInClass.CLASS_T);
     COMPILER_ERROR.setCPL(COMPILER_ERROR, CONDITION, STANDARD_OBJECT,
                           BuiltInClass.CLASS_T);
     INTERNAL_COMPILER_ERROR.setCPL(INTERNAL_COMPILER_ERROR, CONDITION, STANDARD_OBJECT,
@@ -632,7 +634,7 @@
                                     ERROR, SERIOUS_CONDITION, CONDITION,
                                     STANDARD_OBJECT, BuiltInClass.CLASS_T);
     FORWARD_REFERENCED_CLASS.setCPL(FORWARD_REFERENCED_CLASS, CLASS,
-                                    BuiltInClass.CLASS_T);
+                                    SPECIALIZER, METAOBJECT, STANDARD_OBJECT, BuiltInClass.CLASS_T);
     GENERIC_FUNCTION.setCPL(GENERIC_FUNCTION, METAOBJECT, STANDARD_OBJECT,
                             BuiltInClass.FUNCTION,
                             BuiltInClass.CLASS_T);
@@ -641,6 +643,7 @@
     JAVA_EXCEPTION.setDirectSlotDefinitions(
       list(new SlotDefinition(Symbol.CAUSE, list(Symbol.JAVA_EXCEPTION_CAUSE))));
     METAOBJECT.setCPL(METAOBJECT, STANDARD_OBJECT, BuiltInClass.CLASS_T);
+    SPECIALIZER.setCPL(SPECIALIZER, METAOBJECT, STANDARD_OBJECT, BuiltInClass.CLASS_T);
     METHOD.setCPL(METHOD, METAOBJECT, STANDARD_OBJECT, BuiltInClass.CLASS_T);
     PACKAGE_ERROR.setCPL(PACKAGE_ERROR, ERROR, SERIOUS_CONDITION, CONDITION,
                          STANDARD_OBJECT, BuiltInClass.CLASS_T);
@@ -674,7 +677,7 @@
     SIMPLE_WARNING.setDirectSuperclasses(list(SIMPLE_CONDITION, WARNING));
     SIMPLE_WARNING.setCPL(SIMPLE_WARNING, SIMPLE_CONDITION, WARNING,
                           CONDITION, STANDARD_OBJECT, BuiltInClass.CLASS_T);
-    STANDARD_CLASS.setCPL(STANDARD_CLASS, CLASS,
+    STANDARD_CLASS.setCPL(STANDARD_CLASS, CLASS, SPECIALIZER, METAOBJECT,
                           STANDARD_OBJECT, BuiltInClass.CLASS_T);
     STANDARD_OBJECT.setCPL(STANDARD_OBJECT, BuiltInClass.CLASS_T);
     STORAGE_CONDITION.setCPL(STORAGE_CONDITION, SERIOUS_CONDITION, CONDITION,
@@ -684,8 +687,8 @@
     STREAM_ERROR.setDirectSlotDefinitions(
       list(new SlotDefinition(Symbol.STREAM,
                                list(PACKAGE_CL.intern("STREAM-ERROR-STREAM")))));
-    STRUCTURE_CLASS.setCPL(STRUCTURE_CLASS, CLASS, STANDARD_OBJECT,
-                           BuiltInClass.CLASS_T);
+    STRUCTURE_CLASS.setCPL(STRUCTURE_CLASS, CLASS, SPECIALIZER, METAOBJECT,
+                           STANDARD_OBJECT, BuiltInClass.CLASS_T);
     STYLE_WARNING.setCPL(STYLE_WARNING, WARNING, CONDITION, STANDARD_OBJECT,
                          BuiltInClass.CLASS_T);
     TYPE_ERROR.setCPL(TYPE_ERROR, ERROR, SERIOUS_CONDITION, CONDITION,
@@ -729,6 +732,7 @@
     FLOATING_POINT_UNDERFLOW.finalizeClass();
     JAVA_EXCEPTION.finalizeClass();
     METAOBJECT.finalizeClass();
+    SPECIALIZER.finalizeClass();
     PACKAGE_ERROR.finalizeClass();
     PARSE_ERROR.finalizeClass();
     PRINT_NOT_READABLE.finalizeClass();

Modified: trunk/abcl/src/org/armedbear/lisp/Symbol.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Symbol.java	Wed Jan  4 05:44:27 2012	(r13713)
+++ trunk/abcl/src/org/armedbear/lisp/Symbol.java	Wed Jan  4 05:44:29 2012	(r13714)
@@ -2969,6 +2969,8 @@
     PACKAGE_MOP.addInternalSymbol("CLASS-PRECEDENCE-LIST");
   public static final Symbol METAOBJECT =
     PACKAGE_MOP.addExternalSymbol("METAOBJECT");
+  public static final Symbol SPECIALIZER =
+    PACKAGE_MOP.addExternalSymbol("SPECIALIZER");
   public static final Symbol STANDARD_READER_METHOD =
     PACKAGE_MOP.addExternalSymbol("STANDARD-READER-METHOD");
   public static final Symbol DIRECT_SLOT_DEFINITION =




More information about the armedbear-cvs mailing list