summaryrefslogtreecommitdiff
path: root/libguile/goops.c
Commit message (Expand)AuthorAgeFilesLines
* Add disjoint syntax object type...* libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, noinst_HEADERS): Add syntax.c and syntax.h. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (class_syntax, scm_class_of, scm_goops_early_init): * libguile/init.c (scm_init_guile): * libguile/print.c (iprin1): * libguile/tags.h (scm_tc7_syntax): * module/oop/goops.scm (<syntax>): * module/system/base/types.scm (%tc7-syntax, cell->object): * module/system/vm/disassembler.scm (code-annotation): Wire up the new data type. * libguile/syntax.c: * libguile/syntax.h: New files. * module/ice-9/boot-9.scm: Move new definitions to (system syntax internal). * module/system/syntax.scm (print-syntax): New helper. * module/system/vm/assembler.scm (statically-allocatable?) (intern-constant, link-data): Arrange to be able to write syntax objects into images. * module/language/cps/types.scm (&syntax): New type. Remove &hash-table; it was never detected, an internal binding, and we need the bit to avoid going into bignum territory. Andy Wingo2017-03-281-0/+4
* Mutex instead of critical section in GOOPS...* libguile/goops.c (scm_sys_modify_instance) (scm_sys_modify_class): Use a mutex instead of a critical section. Andy Wingo2016-11-011-4/+6
* Add atomic boxes...* doc/ref/api-scheduling.texi (Atomics): New manual section. * libguile.h: Include atomic.h. * libguile/Makefile.am (libguile_@GUILE_EFFECTIVE_VERSION@_la_SOURCES): (DOT_X_FILES, DOT_DOC_FILES, modinclude_HEADERS): Add atomic. * libguile/atomic.c: * libguile/atomic.h: New files. * libguile/atomics-internal.h (scm_atomic_set_scm, scm_atomic_ref_scm) (scm_atomic_swap_scm, scm_atomic_compare_and_swap_scm): New facilities. * libguile/goops.c (class_atomic_box, scm_sys_goops_early_init): Add support for <atomic-box>. Remove duplicate <keyword> fetch. * libguile/init.c (scm_i_init_guile): Call scm_register_atomic_box. * libguile/print.c (iprin1): Add atomic box case. * libguile/tags.h (scm_tc7_atomic_box): New tag. * libguile/validate.h (SCM_VALIDATE_ATOMIC_BOX): New macro. * module/Makefile.am (SOURCES): Add ice-9/atomic.scm. * module/ice-9/atomic.scm: New file. * module/oop/goops.scm (<atomic-box>): New var. Andy Wingo2016-09-061-2/+4
* GOOPS caches created vtables...* libguile/goops.c (scm_i_define_class_for_vtable): Cache created vtables. Fixes #24286. * test-suite/tests/goops.test ("classes for built-in types"): Add tests. Andy Wingo2016-09-021-1/+1
* Use heap-allocated port types instead of ptobnums...This removes a limitation on the number of port types, simplifies the API, and removes a central point of coordination. * libguile/ports-internal.h (struct scm_t_port_type): Rename from scm_t_ptob_descriptor, now that it's private. Add GOOPS class fields. (struct scm_t_port): Rename from struct scm_port, especially considering that deprecated.h redefines scm_port using the preprocessor :(. * libguile/ports.h: Add definitions of SCM_PORT and SCM_PORT_TYPE, though the scm_t_port and scm_t_port_type types are incomplete. (SCM_TC2PTOBNUM, SCM_PTOBNUM, SCM_PTOBNAME): Remove, as there are no more typecodes for port types. (scm_c_num_port_types, scm_c_port_type_ref, scm_c_port_type_add_x): Remove. (scm_make_port_type): Return a scm_t_port_type*. All methods adapted to take a scm_t_port_type* instead of a ptobnum. (scm_c_make_port_with_encoding, scm_c_make_port): Take a port type pointer instead of a tag. (scm_new_port_table_entry): Remove; not useful. * libguile/ports.c: Remove things related to the port kind table. Adapt uses of SCM_PORT_DESCRIPTOR / scm_t_ptob_descriptor to use SCM_PORT_TYPE and scm_t_port_type. * libguile/deprecated.c: * libguile/deprecated.h: * libguile/filesys.c: * libguile/fports.c: * libguile/fports.h: * libguile/print.c: * libguile/r6rs-ports.c: * libguile/strports.c: * libguile/strports.h: * libguile/tags.h: * libguile/vports.c: * test-suite/standalone/test-scm-c-read.c: Adapt to change. * libguile/goops.c (scm_class_of, make_port_classes) (scm_make_port_classes, create_port_classes): Adapt to store the classes in the ptob. Andy Wingo2016-05-131-31/+53
* Make scm_t_ptob_descriptor private....* libguile/goops.c: Use port internals header. * libguile/ports-internal.h (scm_t_port_type_flags) (struct scm_t_ptob_descriptor): Make private. * libguile/ports.h: Adapt. Andy Wingo2016-05-131-0/+1
* Add #:static-slot-allocation?...* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_STATIC): Reserve the fourth GOOPS flag to indicate that a class has static slot allocation. * libguile/goops.c (scm_init_goops_builtins): Define vtable-flag-goops-static for goops.scm. * module/oop/goops.scm (class-has-statically-allocated-slots?): New helper. (build-slots-list): Instead of the ad-hoc checks for <class> or <slot>, use the new helper. (initialize): Accept #:static-slot-allocation? keyword. * module/system/foreign-object.scm (make-foreign-object-type): Declare foreign object classes as having static slot allocation. * test-suite/tests/goops.test ("static slot allocation"): Add tests. Andy Wingo2015-02-061-0/+2
* Use a vtable bit to mark <slot> instances...* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_SLOT): Allocate another vtable flag to indicate that instances of this vtable are slots. * libguile/goops.c (scm_init_goops_builtins): Export vtable-flag-goops-slot to Scheme. * module/oop/goops.scm (<slot>, slot?, make-standard-class, initialize): Arrange for <slot> classes to have the vtable-flag-goops.slot. (build-slots-list): Ensure that <slot> slots are statically laid out. Andy Wingo2015-01-231-0/+2
* Introduce <slot> objects in GOOPS...* module/oop/goops.scm (fold-class-slots): Change format to use proper slot specifications. (fold-slot-slots): Flesh out with all needed slots. (<class>): Update cons-layout to deal with new fold-class-slots form. Don't create slots; we do that later. (is-a?, get-keyword, *unbound, unbound?, %allocate-instance): Move definitions up. (<slot>, slot?): New definitions. (slot-definition-name, slot-definition-allocation) (slot-definition-init-keyword, slot-definition-init-form) (slot-definition-init-value, slot-definition-init-thunk) (slot-definition-options, slot-definition-getter) (slot-definition-setter, slot-definition-accessor) (slot-definition-slot-ref, slot-definition-slot-set!) (slot-definition-index, slot-definition-size): New definitions as accessors on <slot> objects. (class-slot-definition): Adapt to class-slots change. (direct-slot-definition-class, make-slot): New definitions. (make): Define a boot version that can allocate <slot> instances. (compute-direct-slot-definition) (compute-direct-slot-definition-initargs) (effective-slot-definition-class, compute-effective-slot-definition): New definitions. (build-slots-list): Adapt to slots being <slot> objects. (compute-get-n-set): New boot definition. (allocate-slots): New definition. Replaces compute-getters-n-setters. (%compute-layout, %prep-layout): Adapt to changes. (make-standard-class): Make <slot> objects for direct-slots, and handle the allocate-slots protocol. (<foreign-slot>): Inherit from <slot>. (get-slot-value-using-name, set-slot-value-using-name!) (test-slot-existence): Adapt to using slot definition objects. (make-class): Allow slot specs or <slot> objects as the `slots' argument. (write): New method on <slot>. (class-slot-ref, class-slot-set!): Reimplement. (compute-slot-accessors, compute-getter-method) (compute-setter-method): Adapt to changes. (compute-getters-n-setters): Remove. Yay! (compute-get-n-set): Adapt to use effective slot definitions instead of the getters-n-setters for #:class / #:each-subclass allocation. (%initialize-object): Adapt. (initialize): New method for <slot>. Adapt method for <class>. * module/oop/goops/active-slot.scm (compute-get-n-set): * module/oop/goops/composite-slot.scm (compute-propagated-get-n-set): Use slot-definition-options to access options of slot. * test-suite/tests/goops.test ("bad init-thunk"): Fix to be a "pass-if" instead of an "expect-fail". Andy Wingo2015-01-231-0/+2
* The GOOPS "unbound" value is a unique pair...* libguile/goops.c (SCM_GOOPS_UNBOUND, SCM_GOOPS_UNBOUNDP): Remove internal macros. (scm_make_unbound, scm_unbound_p): Remove internal functions. (scm_sys_clear_fields_x): Add "unbound" parameter, for the init value. * module/oop/goops.scm (*unbound*): Define in Scheme as a simple heap-allocated value. (unbound?): New definition. (%allocate-instance): Pass *unbound* to %clear-fields!. (make-class, slot-definition-init-value) (slot-definition-init-form, make-closure-variable): Use *unbound* instead of (make-unbound), which is now gone. * module/oop/goops/active-slot.scm (compute-get-n-set): Use *unbound* instead of make-unbound. This module uses the GOOPS internals module; perhaps we should export make-unbound or something... * module/oop/goops/save.scm (make-unbound): Export our own make-unbound definition, for use by residualized save code. * module/language/ecmascript/base.scm (<undefined>, *undefined*): Use a unique object kind and instance for the undefined value. * libguile/vm.c (scm_i_vm_mark_stack): Fill the stack with SCM_UNSPECIFIED instead of SCM_UNBOUND. Andy Wingo2015-01-231-30/+4
* GOOPS: Deprecate "using-class" procs like slot-ref-using-class...* libguile/deprecated.h: * libguile/goops.c: * libguile/goops.h: * libguile/deprecated.c (scm_slot_ref_using_class): (scm_slot_set_using_class_x): (scm_slot_bound_using_class_p): (scm_slot_exists_using_class_p): Deprecate. * module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!) (slot-bound-using-class?, slot-exists-using-class?): Deprecate. Change to check that `class' is indeed the class of `obj', as required, and then dispatch to slot-ref et al. Andy Wingo2015-01-231-38/+0
* Manipulate GOOPS vtable flags from Scheme, for speed...* libguile/goops.h: Remove unimplemented declarations of scm_make_next_method, scm_sys_invalidate_method_cache_x, and stklos_version. (scm_sys_invalidate_class_x): Remove helper definition. This was exported in the past but shouldn't have been. * libguile/goops.c (scm_sys_make_vtable_vtable): Rename from scm_sys_make_root_class, and don't do anything about flags. (scm_sys_bless_applicable_struct_vtables_x, scm_class_p) (scm_sys_invalidate_class_x): Remove; we do these in Scheme now. (scm_init_goops_builtins): Define Scheme values for vtable flags. * module/oop/goops.scm (vtable-flag-goops-metaclass) (class-add-flags!, class-clear-flags!, class-has-flags?) (class?, instance?): New definitions. (<class>): Add GOOPS metaclass flags from Scheme. (<applicable-struct-class>, <applicable-struct-with-setter-class>): Add flags from Scheme. (make, initialize): Add class flags as appropriate. (class-redefinition): Clear the "valid" flag on the old class. (check-slot-args): Use instance? instead of a CPL check. Andy Wingo2015-01-231-45/+17
* scm_make cleanup...* libguile/goops.c (scm_make): Remove SCM_DEFINE around scm_make; the real definition is in Scheme. Andy Wingo2015-01-231-6/+2
* Cosmetic goops refactors....* module/oop/goops.scm: Update comments. * libguile/goops.c: Cosmetic reorderings, re-commentings, and de-commentings. Andy Wingo2015-01-231-97/+56
* Incorporate %inherit-magic! into %init-layout!...* libguile/goops.c (scm_make_standard_class, scm_sys_init_layout_x): Move definitions up. Incorporate scm_sys_inherit_magic_x into scm_sys_init_layout_x. * libguile/goops.h: Remove scm_sys_init_layout_x declaration. Andy Wingo2015-01-231-34/+29
* goops.c no longer knows about <class> slot allocation...* libguile/goops.c (scm_class_of): Access "redefined" slot by name in the case where we need to change the class of an instance. (scm_sys_goops_early_init): Move up capture of class-precedence-list so SCM_SUBCLASSP can use it. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_redefined) (scm_si_direct_supers, scm_si_direct_slots, scm_si_direct_subclasses) (scm_si_direct_methods, scm_si_cpl scm_si_slots) (scm_si_getters_n_setters, SCM_N_CLASS_SLOTS, SCM_OBJ_CLASS_REDEF): Remove. Now C code has no special knowledge about the layout of GOOPS classes. (SCM_SUBCLASSP): Use scm_class_precedence_list to get CPL. (SCM_INST, SCM_ACCESSORS_OF): Remove unused macros that were undocumented and nonsensical. Andy Wingo2015-01-231-6/+11
* Reimplement inherit-applicable! in Scheme...* libguile/goops.c: Move captured keywords and symbols up to the top. (scm_i_inherit_applicable): Dispatch to Scheme. (scm_sys_goops_early_init): Capture inherit-applicable!. * module/oop/goops.scm (inherit-applicable!): Scheme implementation. Andy Wingo2015-01-231-36/+7
* Reimplement %allocate-instance in Scheme...* libguile/goops.c (scm_sys_clear_fields_x): New function. (scm_sys_allocate_instance): Remove. It was available to C but not to Scheme and it's really internal. * libguile/goops.h: Remove scm_sys_allocate_instance. * module/oop/goops.scm (%allocate-instance): Implement in Scheme, using allocate-struct and %clear-fields!. (make, shallow-clone, deep-clone, allocate-instance): Adapt to %allocate-instance not taking an initargs argument. Andy Wingo2015-01-231-32/+14
* Re-use the vtable "size" field for GOOPS nfields...* module/oop/goops.scm (fold-<class>-slots): The first "reserved" slot is actually for instance sizes, used by the "simple struct" mechanism. Reuse this field for GOOPS's "nfields". (make-standard-class, <class>, initialize): Adapt order of field initializations. * libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, SCM_N_CLASS_SLOTS) * libguile/goops.c (scm_sys_allocate_instance): Adapt. Andy Wingo2015-01-231-1/+1
* Move <class> initialization to Scheme...* libguile/goops.c (scm_sys_make_root_class): Just make the vtable-vtable, and leave initialization to Scheme. * libguile/struct.c (scm_i_make_vtable_vtable): Change to take a full list of fields, not just the extra fields. (scm_init_struct): Adapt to scm_i_make_vtable_vtable change. * module/oop/goops.scm (<class>): Compute layout for <class>, and initialize <class> from here. Andy Wingo2015-01-231-21/+7
* Deprecate scm_get_keyword...* libguile/deprecated.c (scm_get_keyword): Deprecate. * libguile/deprecated.h: * libguile/goops.c: * libguile/goops.h: Andy Wingo2015-01-231-53/+0
* Rewrite %initialize-object in Scheme...* libguile/goops.h: * libguile/goops.c (scm_sys_initialize_object): Remove C interface. This function was only really useful as part of a GOOPS initialize method but was not exported from the goops module. * module/oop/goops.scm (get-keyword, %initialize-object): Implement in Scheme. Andy Wingo2015-01-231-68/+0
* Minor goops.c tidying...* libguile/goops.c: Reorder static variables. Remove unused sym_procedure. Andy Wingo2015-01-231-7/+5
* Remove scm_c_extend_primitive_generic...* libguile/goops.h (scm_c_extend_primitive_generic): Remove public interface. This was introduced in 2003 with the "extended" generics but never documented, unused as far as I can tell, and is better accessed from Scheme. * libguile/goops.c: Remove support for scm_c_extend_primitive_generic. Simplify capture of change-class. Andy Wingo2015-01-231-67/+1
* No more concept of "pure generics"...* libguile/goops.h (SCM_PUREGENERICP, SCM_VALIDATE_PUREGENERIC) (SCM_VTABLE_FLAG_GOOPS_PURE_GENERIC, SCM_CLASSF_PURE_GENERIC): Remove. * libguile/goops.c (scm_set_primitive_generic_x): Use SCM_GENERICP, not SCM_PUREGENERICP. (scm_sys_bless_pure_generic_vtable_x): Remove; this flag isn't checked. * module/oop/goops.scm: Don't call %bless-pure-generic-vtable!; there's no need. Andy Wingo2015-01-231-13/+1
* Remove TEST_CHANGE_CLASS...* libguile/goops.c (TEST_CHANGE_CLASS): Remove unused macro and comment. Andy Wingo2015-01-231-30/+0
* Remove pure-generic?...* libguile/goops.h: * libguile/goops.c (scm_pure_generic_p): Remove function only compiled in debug mode. Andy Wingo2015-01-231-16/+0
* Goops slot-unbound / slot-missing cleanups...* libguile/goops.c: Remove useless slot-unbound / slot-missing captures. Andy Wingo2015-01-231-6/+0
* Move slot-ref et al to Scheme...* libguile/goops.c: * module/oop/goops.scm (slot-ref-using-class, slot-set-using-class!): (slot-bound-using-class?, slot-exists-using-class?, slot-set!): (slot-bound?, slot-exists?): Move implementation to Scheme. Andy Wingo2015-01-231-206/+50
* Port method and generic accessors to Scheme...* libguile/goops.c: * module/oop/goops.scm (generic-function-methods) (method-generic-function, method-specializers, method-procedure): Port to Scheme. Andy Wingo2015-01-231-73/+31
* <class> accessors implemented in Scheme...* libguile/goops.c (scm_class_p): New internal helper, exported to goops.scm. (scm_class_name, scm_class_direct_supers, scm_class_direct_slots): (scm_class_direct_subclasses, scm_class_direct_methods): (scm_class_precedence_list, scm_class_slots): Dispatch to Scheme. (scm_sys_goops_early_init): Capture <class> accessors. * module/oop/goops.scm (define-class-accessor): New helper. (class-name, class-direct-supers, class-direct-slots): (class-direct-subclasses, class-direct-methods) (class-precedence-list, class-slots): Define in Scheme. (compute-std-cpl, compute-cpl): Move lower. Andy Wingo2015-01-231-57/+47
* Remove GOOPS random state...* libguile/goops.c: Remove GOOPS random state, now that there are no more hashsets. Andy Wingo2015-01-231-3/+0
* More goops.c cleanups, and fix a security issue...* libguile/goops.c: Remove unused #includes. (make_class_name): New helper, replaces unsafe use of sprintf. (scm_make_extended_class): Rewrite to call scm_make_standard_class directly. (scm_make_port_classes): Rewrite to use scm_make_standard_class, and no need to patch the CPL any more. Andy Wingo2015-01-231-49/+37
* More unused code removal in GOOPS...* libguile/goops.c: Remove unused sym_memoize_method_x. Andy Wingo2015-01-231-1/+0
* Remove private var_no_applicable_method capture...* libguile/goops.c (var_no_applicable_method): Remove unused capture. (sym_no_applicable_method): Remove unused symbol. Andy Wingo2015-01-231-4/+0
* Remove scm_assert_bound...* libguile/goops.c (scm_assert_bound): Remove unexported unused helper. * module/oop/goops.scm (make-generic-bound-check-getter): Change assert-bound use to use `unbound?'. Andy Wingo2015-01-231-13/+0
* Remove scm_at_assert_bound_ref...* libguile/goops.c (scm_at_assert_bound_ref): Remove unused, unexported function. Andy Wingo2015-01-231-14/+0
* Remove hashset slots from GOOPS classes...* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, SCM_INSTANCE_HASH) (SCM_SET_HASHSET): * libguile/goops.c (prep_hashsets, scm_sys_make_root_class, scm_sys_init_layout_x): * module/oop/goops.scm (build-<class>-slots): Remove hashsets from classes. We haven't implemented hashed dispatch since Guile 1.8, and it's not clear that the particular formulation of dispatch is a good idea. Andy Wingo2015-01-231-15/+0
* Deprecate C exports of GOOPS classes....* libguile/deprecated.h: (scm_class_boolean, scm_class_char, scm_class_pair) (scm_class_procedure, scm_class_string, scm_class_symbol) (scm_class_primitive_generic, scm_class_vector, scm_class_null) (scm_class_real, scm_class_complex, scm_class_integer) (scm_class_fraction, scm_class_unknown, scm_class_top) (scm_class_object, scm_class_class, scm_class_applicable) (scm_class_applicable_struct, scm_class_applicable_struct_with_setter) (scm_class_generic, scm_class_generic_with_setter, scm_class_accessor) (scm_class_extended_generic, scm_class_extended_generic_with_setter) (scm_class_extended_accessor, scm_class_method) (scm_class_accessor_method, scm_class_procedure_class) (scm_class_applicable_struct_class, scm_class_number, scm_class_list) (scm_class_keyword, scm_class_port, scm_class_input_output_port) (scm_class_input_port, scm_class_output_port, scm_class_foreign_slot) (scm_class_self, scm_class_protected, scm_class_hidden) (scm_class_opaque, scm_class_read_only, scm_class_protected_hidden) (scm_class_protected_opaque, scm_class_protected_read_only) (scm_class_scm, scm_class_int, scm_class_float) (scm_class_double, scm_port_class, scm_smob_class): Deprecate. * libguile/deprecated.c: * libguile/goops.c: * libguile/goops.h: Adapt to deprecation. * libguile/goops.h * libguile/goops.c (scm_is_generic, scm_is_method): New interfaces. (SCM_GENERICP, SCM_METHODP): Change to use new interfaces. * libguile/ports.c (scm_make_port_type): * libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): Use internal names for the port and smob class arrays. Andy Wingo2015-01-231-149/+160
* Generics with setters have <applicable-struct-with-setter> layout...* libguile/goops.c (scm_sys_set_object_setter_x): Remove. Instead, we use slot-set! of 'setter. (scm_i_define_class_for_vtable): Move lower in the file, and fold in scm_make_extended_class_from_symbol and make_class_from_symbol. Properly handle applicable structs with setters. (scm_class_applicable_struct_with_setter_class): New private capture. (scm_sys_bless_applicable_struct_vtables_x): Rename to take two arguments, and bless the second argument as an applicable struct with setter vtable. (scm_sys_goops_early_init): Capture setter classes. * libguile/deprecated.c (SPEC_OF, CPL_OF): Access slots by name, not by index. (applicablep, more_specificp): Adapt to use CPL_OF. (scm_find_method): Access "methods" slot by name. * libguile/procs.c (scm_setter): Remove special case for generics; if it's a setter, it will be a normal applicable struct. * module/oop/goops.scm (<applicable-struct-with-setter-class>) (<applicable-struct-with-setter>): New classes. (<generic-with-setter>): Now an instance of the setter metaclass and a child of the setter class, so that the "setter" slot ends up in the right place. (<accessor>, <extended-generic-with-setter>, <extended-accessor>): Be instances of the setter metaclass. (<method>, <accessor-method>): Move definitions farther down. (make): Use slot-set! when initializing setters here. (initialize): Likewise for <applicable-struct-with-setter>. Remove specialization for <generic-with-setter>. Andy Wingo2015-01-231-91/+75
* Remove useless scm_s_slot_set_x export...* libguile/goops.c: * libguile/goops.h (scm_s_slot_set_x): Remove unused and useless export. Andy Wingo2015-01-231-2/+0
* Deprecate scm_no_applicable_method C export...* libguile/deprecated.c (scm_init_deprecated_goops) (scm_no_applicable_method): * libguile/goops.h: * libguile/goops.c (scm_no_applicable_method) (scm_sys_goops_early_init): Deprecate scm_no_applicable_method C export. Andy Wingo2015-01-231-4/+5
* Fold GOOPS compile and dispatch modules into main GOOPS module...* libguile/goops.c (scm_sys_invalidate_method_cache_x): Remove C interface to this internal method. Instead, internal callers are all from Scheme, so we move the implementation to Scheme. (scm_make): Dispatch to `make' in Scheme. This is an incompatible but great change, as it fulfills the common user perception that scm_make is the same as GOOPS's `make'. (scm_sys_goops_early_init): Capture `make'. (scm_no_applicable_method): Define in Scheme and capture in C. * module/Makefile.am: Remove oop/goops/compile.scm and oop/goops/dispatch.scm. * module/oop/goops/compile.scm: * module/oop/goops/dispatch.scm: Fold into goops.scm. * module/oop/goops.scm: Fold in the generic compile and dispatch modules. This eliminates a circularity that caused some eval-when shenanigans, so remove the eval-whens as well. Reimplement the boot version of `make' in Scheme, and make the <generic> `initialize' method handle invalidation instead of the generic %allocate-instance. (no-applicable-method): Define here. Import the utils module in the normal define-module block. Andy Wingo2015-01-231-167/+6
* Deprecate scm_basic_make_class...* libguile/deprecated.h: * libguile/deprecated.c (scm_basic_make_class): Deprecate. * libguile/goops.c: * libguile/goops.h (scm_make_standard_class): New internal helper. It's a better spelling, as it matches make-standard-class, and is internal so as not to cause confusion between boot GOOPS helpers and "real" GOOPS interfaces. Andy Wingo2015-01-231-4/+4
* Move GOOPS boot to Scheme...* module/oop/goops.scm (build-<class>-slots): New helper, replacing build_class_class_slots. (build-slots-list, %compute-getters-n-setters, %compute-layout): New private helpers, moved here from C. (%prep-layout!): Reimplement in Scheme. (make-standard-class): New private helper, replacing scm_basic_make_class. (<class>, <top>, <object>): Define in Scheme. (<foreign-slot>, <protected-slot>, <hidden-slot>, <opaque-slot>, <read-only-slot>, <self-slot>, <protected-opaque-slot>, <protected-hidden-slot>, <protected-read-only-slot>, <scm-slot>, <int-slot>, <float-slot>, <double-slot>, <procedure-class>, <applicable-struct-class>, <method>, <accessor-method>, <applicable>, <applicable-struct>, <generic>, <extended-generic>, <generic-with-setter>, <accessor>, <extended-generic-with-setter>, <extended-accessor>): Define in Scheme. (<boolean>, <char>, <list>, <pair>, <null>, <string>, <symbol>, <vector>, <foreign>, <hashtable>, <fluid>, <dynamic-state>, <frame>, <vm-continuation>, <bytevector>, <uvec>, <array>, <bitvector>, <number>, <complex>, <real>, <integer>, <fraction>, <keyword>, <unknown>, <procedure>, <primitive-generic>, <port>, <input-port>, <output-port>, <input-output-port>): Define in Scheme. (compute-slots): Use build-slots-list helper. * libguile/goops.h: * libguile/goops.c (scm_basic_basic_make_class, scm_sys_compute_slots) (scm_sys_prep_layout_x): Remove. These were available to C, but were undocumented internals that were dangerous, confusing, and unnecessary. * libguile/goops.c: Add note about variable versus value references. Remove internal C routines that were just used during boot, as they have been moved to Scheme. (scm_basic_make_class): Change to call out to make-standard-class in Scheme. (scm_sys_make_root_class, scm_sys_bless_applicable_struct_vtable_x) (scm_sys_bless_pure_generic_vtable_x, scm_sys_init_layout_x): New private helpers. (scm_sys_goops_early_init): Change to capture values defined in Scheme. Andy Wingo2015-01-231-655/+154
* Remove unused %fast-slot-ref / %fast-slot-set! from GOOPS...* libguile/goops.h: * libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x): Remove these unused, unsafe functions. They were publically available only to C. * module/oop/goops/active-slot.scm (compute-get-n-set): Update to use struct-ref / struct-set! instead of %fast-slot-ref / %fast-slot-set! from (oop goops internal). Andy Wingo2015-01-231-36/+0
* Preparation for more GOOPS refactorings...* libguile/goops.c (scm_sys_goops_early_init) (scm_init_goops_builtins): Factor out some initialization to a separate helper. This will be the base for moving more things from C to Scheme in the future. * module/oop/goops.scm: Call %goops-early-init. Andy Wingo2015-01-231-16/+26
* %init-goops-builtins is an extension, not a global...* libguile/goops.h: * libguile/goops.c (scm_init_goops, scm_init_goops_builtins): Move %init-goops-builtins to be an extension instead of a globally accessible function. * module/oop/goops.scm: Adapt. Andy Wingo2015-01-231-6/+5
* compute-cpl implementation only in Scheme...* libguile/goops.c (build_class_class_slots, create_basic_classes): Instead of creating <class> with uninitialized `direct-slots', `slots', and `getters-n-setters' fields and initializing them later, create <class> with a "boot" version of unspecialized slots and later replace the fields with specialized slot classes. This allows slot-ref to work during early boot, which is necessary to move compute-cpl to Scheme. (create_standard_classes): Finish initializing <class> here. (map, filter_cpl, compute_cpl): Remove the boot-time compute-cpl in C and its helpers. (scm_basic_basic_make_class): Call compute-cpl in Scheme. (fix_cpl): Remove; since we use the correct compute-cpl from the beginning, there's no need to correct for the deficiencies of the C implementation any more. (build_slots_list): Adapt to build_class_class_slots change. * module/oop/goops.scm (compute-std-cpl, compute-cpl): Move these up to the top, so they can be called by the boot process. (compute-clos-cpl, top-sort, std-tie-breaker, build-transitive-closure) (build-constraints): Remove unused private code. Andy Wingo2015-01-231-116/+40
* More useless goops.c code removal...* libguile/goops.c: Remove needless scm_sym_define_public definition. Andy Wingo2015-01-231-2/+0