Adding STklos primitive classes
Below is a patch to allow STk extension writers to add new
primitive STklos types. The only limitation is that only
1024 types can be created, but the idea is the important
thing. This code brings up a question for me: What does
it mean to use a primitive instance as a super class?
How do you set the object's value? E.g.
(define-class <my-real> (<real>)
((slot1) (slot2)))
Does this mean anything? How do you initialize it? With an
initialize method? What do you do in that method?
-david
P.S. I guess class_of_table should be static. I made Top, Object
and class global so you can use them as super classes when calling
STk_make_prim_type.
*** stklos.c.orig Sun Feb 26 17:08:31 1995
--- stklos.c Tue Apr 4 09:56:50 1995
***************
*** 33,35 ****
! static SCM Top, Object, Class;
static SCM Boolean, Char, Pair, Procedure, String, Symbol, Vector, Number,
--- 33,35 ----
! SCM Top, Object, Class;
static SCM Boolean, Char, Pair, Procedure, String, Symbol, Vector, Number,
***************
*** 352,353 ****
--- 352,361 ----
+ SCM class_of_table[1024] = {0,};
+
+ void STk_make_prim_type(int type, SCM *var, char *name, SCM meta, SCM super)
+ {
+ make_prim_type(var, name, meta, super);
+ class_of_table[type] = *var;
+ }
+
static void make_primitive_classes(void)
***************
*** 398,400 ****
case tc_tkcommand: return Widget;
! default: return (STk_procedurep(obj) == Truth)? Procedure: Unknown;
}
--- 406,410 ----
case tc_tkcommand: return Widget;
! default:
! if (STk_procedurep(obj) == Truth) return Procedure;
! else return class_of_table[TYPE(obj)] ? : Unknown;
}
Received on Tue Apr 04 1995 - 17:10:28 CEST
This archive was generated by hypermail 2.3.0
: Mon Jul 21 2014 - 19:38:59 CEST