1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

*** empty log message ***

This commit is contained in:
Mikael Djurfeldt 1999-03-14 16:55:01 +00:00
parent f7da61905e
commit 6ee350ad3f
3 changed files with 89 additions and 5 deletions

View file

@ -1,3 +1,9 @@
1999-03-14 Mikael Djurfeldt <mdj@barbara.nada.kth.se>
* boot-9.scm (make-record-type): Use `set-struct-vtable-name!' to
associate a name to the record type descriptor so that the object
system can create a wrapper class for it.
1999-03-12 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
Improvement of backtraces: Introduces a new stack narrowing

View file

@ -1,3 +1,72 @@
1999-03-14 Mikael Djurfeldt <mdj@barbara.nada.kth.se>
Most of this batch of changes is about how to deal with extended
types when an object system is loaded into Guile. A nice object
system is capable of representing Guile's types as class objects.
For example, we want a regular expression to be of class <regex>.
But regular expressions are smobs which aren't under direct
control of the object system, so there has to be some mechanism
which informs the object system that a new class should be created
which can represent the smob type. I call this a "wrapper class".
* objects.c: #include "smob.h";
(scm_class_keyword): Removed. (Class is automatically created by
make_smob_classes.)
(scm_smob_class): Array of smob classes indexed by smobnum.
(scm_make_extended_class): "Plugin" function pointer for creation
of wrapper classes for smob and struct types.
(scm_class_of): Handle compiled closures. (Currently regarded as
<procedure>.);
Use scm_smob_class to handle smob types;
Handle scm_tc16_bigpos, scm_tc16_bigneg, and, scm_tc16_keyword
through scm_smob_class;
Handle structs.
* smob.c (scm_newsmob): Also create a wrapper class if
scm_smob_class has been initialized.
* smob.h (SCM_TC2SMOBNUM): New macro for conversion between tc16
type code and smobnum.
* struct.c: #include "alist.h", "weaks.h", "hashtab.h";
(scm_struct_table): Weak key table with auxilliary information for
struct types. Currently used for names and wrapper classes.
(scm_struct_ihashq): Hash function for structs.
(scm_struct_create_handle): Get/create entry in scm_struct_table.
(scm_struct_vtable_name, scm_set_struct_vtable_name_x): Procedures
for accessing names of vtables. The record implementation in
boot-9.scm currently uses the setter to record the name of record
types. When the object system is initialized, it can use this
information to create wrapper classes with suitable names.
(scm_init_struct): Allocate scm_struct_table.
(scm_alloc_struct): Don't initialize scm_struct_i_tag here.
(struct tags are a finite resource and we might want to restrict
the use of tags to vtables only. E.g., Goops only uses tags for
classes.)
(scm_make_struct): Use scm_struct_entity_n_extra_words instead of
magic number 5.
(scm_struct_vtable_tag): Use scm_struct_i_tag instead of magic
number -1.
* struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME,
SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS): New macros.
Used for access of struct table entries.
* hashtab.c, hashtab.h (scm_internal_hash_fold): New function.
(scm_hash_fold): New procedure. Used to process all entries in a
hash table (in no particular order).
Argh! For the umpteenth time I got compilation errors because of
the "intuitive" name `kw'. This has to have an end:
* Makefile.am, init.c, libguile.h, objects.c, root.h: Replaced
"kw" --> "keywords" everywhere.
(I doubt that this will cause big compatibility problems since the
application interface is unaffected.)
* keywords.c, keywords.h: Files renamed from kw.c, kw.h.
1999-03-12 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* srcprop.c (scm_set_source_property_x): Bugfix: Convert line and

View file

@ -72,7 +72,7 @@
(SCM_STRUCT_VTABLE_DATA (obj)[scm_struct_i_flags])
#define SCM_SET_CLASS_FLAGS(c, f) (SCM_CLASS_FLAGS (c) |= (f))
#define SCM_CLEAR_CLASS_FLAGS(c, f) (SCM_CLASS_FLAGS (c) &= ~(f))
#define SCM_CLASSF_MASK (0xFF << 24)
#define SCM_CLASSF_MASK SCM_STRUCTF_MASK
#define SCM_CLASSF_ENTITY SCM_STRUCTF_ENTITY
/* Operator classes need to be identified in the evaluator.
@ -162,15 +162,21 @@ struct scm_metaclass_operator {
*/
#define SCM_ENTITY_LAYOUT ""
/* The following three definitions are Goops dependencies needed by
scm_class_of. */
/* {Interface to Goops}
*
* The evaluator contains a multi-method dispatch mechanism.
* This interface is used by that mechanism and during creation of
* smob and struct classes.
*/
/* Internal representation of Goops objects. */
#define SCM_CLASSF_GOOPS (0x10 << 24)
#define scm_si_redefined 18
#define scm_si_hashsets 20
#define SCM_CLASS_OF(x) SCM_STRUCT_VTABLE (x)
#define SCM_OBJ_CLASS_REDEF(x) (SCM_STRUCT_VTABLE_DATA(x)[scm_si_redefined])
/* Plugin proxy classes for basic types. */
extern SCM scm_metaclass_standard;
extern SCM scm_metaclass_operator;
extern SCM scm_class_boolean, scm_class_char, scm_class_pair;
@ -178,8 +184,11 @@ extern SCM scm_class_procedure, scm_class_string, scm_class_symbol;
extern SCM scm_class_procedure_with_setter;
extern SCM scm_class_vector, scm_class_null;
extern SCM scm_class_real, scm_class_complex, scm_class_integer;
extern SCM scm_class_keyword, scm_class_unknown;
extern SCM scm_class_unknown;
extern SCM *scm_smob_class;
/* Plugin Goops functions. */
extern SCM (*scm_make_extended_class) (char *type_name);
extern void (*scm_change_object_class) (SCM, SCM, SCM);
extern void (*scm_memoize_method) (SCM x, SCM args);