1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00
Commit graph

116 commits

Author SHA1 Message Date
Andy Wingo
1234bb1850 Update license notices in all C files
Update to newest recommended license notices from the FSF.  Everything
stays LGPLv3+ except guile-readline which is GPLv3+.
2018-06-20 20:07:34 +02:00
Andy Wingo
791eb0c01a Remove (C) from copyright statements
As the FSF advises, 'There is no legal significance to using the
three-character sequence “(C)”, but it does no harm.'  It does take up
space though!  For that reason, we remove it here from our C files.
2018-06-20 19:17:06 +02:00
Andy Wingo
97cc65fee4 Rename __scm.h to scm.h
* libguile/scm.h: Rename.  Update all includers.
2018-06-20 16:33:33 +02:00
Andy Wingo
c495b44714 Remove Emacs local variables comments in Guile source
The .dir-locals.el file in the repository is sufficient for Emacs
users.

* libguile/__scm.h:
* libguile/alist.c:
* libguile/alist.h:
* libguile/array-handle.c:
* libguile/array-handle.h:
* libguile/array-map.c:
* libguile/array-map.h:
* libguile/arrays.c:
* libguile/arrays.h:
* libguile/async.c:
* libguile/async.h:
* libguile/backtrace.c:
* libguile/backtrace.h:
* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/boolean.c:
* libguile/boolean.h:
* libguile/chars.c:
* libguile/chars.h:
* libguile/chooks.c:
* libguile/chooks.h:
* libguile/continuations.c:
* libguile/continuations.h:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/debug-malloc.h:
* libguile/debug.c:
* libguile/debug.h:
* libguile/deprecation.c:
* libguile/deprecation.h:
* libguile/dynl.c:
* libguile/dynl.h:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/dynwind.c:
* libguile/dynwind.h:
* libguile/eq.c:
* libguile/eq.h:
* libguile/error.c:
* libguile/error.h:
* libguile/eval.c:
* libguile/eval.h:
* libguile/evalext.c:
* libguile/evalext.h:
* libguile/expand.c:
* libguile/expand.h:
* libguile/extensions.c:
* libguile/extensions.h:
* libguile/feature.c:
* libguile/feature.h:
* libguile/filesys.c:
* libguile/filesys.h:
* libguile/fluids.c:
* libguile/fluids.h:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/fports.h:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.c:
* libguile/gc.h:
* libguile/generalized-arrays.c:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.c:
* libguile/generalized-vectors.h:
* libguile/gettext.c:
* libguile/gettext.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/guardians.c:
* libguile/guardians.h:
* libguile/guile.c:
* libguile/hash.c:
* libguile/hash.h:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/hooks.h:
* libguile/i18n.c:
* libguile/i18n.h:
* libguile/init.c:
* libguile/init.h:
* libguile/instructions.c:
* libguile/instructions.h:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/ioext.c:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.c:
* libguile/keywords.h:
* libguile/list.c:
* libguile/list.h:
* libguile/load.c:
* libguile/load.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/macros.c:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memmove.c:
* libguile/memoize.c:
* libguile/memoize.h:
* libguile/modules.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/net_db.h:
* libguile/null-threads.c:
* libguile/null-threads.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/objprop.c:
* libguile/objprop.h:
* libguile/options.c:
* libguile/options.h:
* libguile/pairs.c:
* libguile/pairs.h:
* libguile/poll.c:
* libguile/poll.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/posix.h:
* libguile/print.c:
* libguile/print.h:
* libguile/procprop.c:
* libguile/procprop.h:
* libguile/procs.c:
* libguile/procs.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/promises.c:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.c:
* libguile/random.h:
* libguile/rdelim.c:
* libguile/rdelim.h:
* libguile/read.c:
* libguile/read.h:
* libguile/regex-posix.c:
* libguile/regex-posix.h:
* libguile/rw.c:
* libguile/rw.h:
* libguile/scmsigs.c:
* libguile/scmsigs.h:
* libguile/script.c:
* libguile/script.h:
* libguile/simpos.c:
* libguile/simpos.h:
* libguile/smob.c:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.c:
* libguile/socket.h:
* libguile/sort.c:
* libguile/sort.h:
* libguile/srcprop.c:
* libguile/srcprop.h:
* libguile/stackchk.c:
* libguile/stackchk.h:
* libguile/stacks.c:
* libguile/stacks.h:
* libguile/stime.c:
* libguile/stime.h:
* libguile/strerror.c:
* libguile/strings.c:
* libguile/strings.h:
* libguile/strorder.c:
* libguile/strorder.h:
* libguile/strports.c:
* libguile/strports.h:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/symbols.h:
* libguile/syntax.c:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.c:
* libguile/threads.h:
* libguile/throw.c:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.c:
* libguile/unicode.h:
* libguile/uniform.c:
* libguile/uniform.h:
* libguile/values.c:
* libguile/values.h:
* libguile/variable.c:
* libguile/variable.h:
* libguile/vectors.c:
* libguile/vectors.h:
* libguile/version.c:
* libguile/vm-engine.c:
* libguile/vm-expand.h:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.c:
* libguile/weak-set.h:
* libguile/weak-table.c:
* libguile/weak-table.h:
* libguile/weak-vector.c:
* libguile/weak-vector.h: Remove needless trailing comments.
2018-06-20 14:32:28 +02:00
Andy Wingo
5534c2817e Remove useless "classes: h_files" from Guile headers.
* libguile/__scm.h:
* libguile/alist.h:
* libguile/array-handle.h:
* libguile/array-map.h:
* libguile/arrays.h:
* libguile/async.h:
* libguile/backtrace.h:
* libguile/bitvectors.h:
* libguile/boolean.h:
* libguile/chars.h:
* libguile/chooks.h:
* libguile/continuations.h:
* libguile/debug-malloc.h:
* libguile/debug.h:
* libguile/deprecation.h:
* libguile/dynl.h:
* libguile/dynstack.h:
* libguile/dynwind.h:
* libguile/eq.h:
* libguile/error.h:
* libguile/eval.h:
* libguile/evalext.h:
* libguile/expand.h:
* libguile/extensions.h:
* libguile/feature.h:
* libguile/filesys.h:
* libguile/fluids.h:
* libguile/fports.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/generalized-arrays.h:
* libguile/generalized-vectors.h:
* libguile/gettext.h:
* libguile/goops.h:
* libguile/gsubr.h:
* libguile/guardians.h:
* libguile/hash.h:
* libguile/hashtab.h:
* libguile/hooks.h:
* libguile/i18n.h:
* libguile/init.h:
* libguile/inline.h:
* libguile/ioext.h:
* libguile/iselect.h:
* libguile/keywords.h:
* libguile/list.h:
* libguile/load.h:
* libguile/macros.h:
* libguile/mallocs.c:
* libguile/mallocs.h:
* libguile/memoize.h:
* libguile/modules.h:
* libguile/net_db.h:
* libguile/null-threads.h:
* libguile/numbers.h:
* libguile/objprop.h:
* libguile/options.h:
* libguile/pairs.h:
* libguile/poll.h:
* libguile/ports.h:
* libguile/posix-w32.h:
* libguile/posix.h:
* libguile/print.h:
* libguile/procprop.h:
* libguile/procs.h:
* libguile/promises.h:
* libguile/pthread-threads.h:
* libguile/random.h:
* libguile/rdelim.h:
* libguile/read.h:
* libguile/regex-posix.h:
* libguile/rw.h:
* libguile/scmsigs.h:
* libguile/script.h:
* libguile/simpos.h:
* libguile/smob.h:
* libguile/snarf.h:
* libguile/socket.h:
* libguile/sort.h:
* libguile/srcprop.h:
* libguile/stackchk.h:
* libguile/stacks.h:
* libguile/stime.h:
* libguile/strings.h:
* libguile/strorder.h:
* libguile/strports.h:
* libguile/struct.h:
* libguile/symbols.h:
* libguile/syscalls.h:
* libguile/tags.h:
* libguile/threads.h:
* libguile/throw.h:
* libguile/trees.h:
* libguile/unicode.h:
* libguile/uniform.h:
* libguile/values.h:
* libguile/variable.h:
* libguile/vectors.h:
* libguile/vports.h:
* libguile/weak-list.h:
* libguile/weak-set.h:
* libguile/weak-table.h:
* libguile/weak-vector.h: Remove "classes: h_files".  Reformat
  copyrights if needed.
2018-06-20 14:26:16 +02:00
Andy Wingo
e56d22153b Remove ports.h from inline.h
* libguile/inline.h: Remove ports.h.
* libguile/bitvectors.c:
* libguile/bytevectors.c:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/goops.h:
* libguile/programs.c:
* libguile/smob.c:
* libguile/srfi-14.c:
* libguile/vm.c: Add ports.h.
2018-06-19 12:01:38 +02:00
Andy Wingo
1a99bd10f8 Devolve boolean.h include.
* libguile/_scm.h: Remove boolean.h include.
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/backtrace.c:
* libguile/bitvectors.c:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/dynwind.c:
* libguile/eq.c:
* libguile/eval.c:
* libguile/expand.c:
* libguile/fdes-finalizers.c:
* libguile/filesys.c:
* libguile/foreign.c:
* libguile/fports.c:
* libguile/frames.c:
* libguile/generalized-arrays.h:
* libguile/goops.c:
* libguile/goops.h:
* libguile/guardians.c:
* libguile/hooks.c:
* libguile/i18n.c:
* libguile/intrinsics.c:
* libguile/list.c:
* libguile/load.c:
* libguile/loader.c:
* libguile/macros.c:
* libguile/memoize.c:
* libguile/modules.c:
* libguile/net_db.c:
* libguile/numbers.c:
* libguile/options.c:
* libguile/ports.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/procs.h:
* libguile/programs.c:
* libguile/r6rs-ports.c:
* libguile/read.c:
* libguile/scmsigs.c:
* libguile/sort.c:
* libguile/srcprop.h:
* libguile/srfi-1.c:
* libguile/srfi-13.c:
* libguile/srfi-14.c:
* libguile/srfi-14.h:
* libguile/srfi-4.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strorder.c:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/vports.c: Add boolean.h includes.
2018-06-18 21:38:44 +02:00
Andy Wingo
460552163e Remove list.h from _scm.h
* libguile/_scm.h: Remove list.h include.  Add appropriate includes to
  relevant callers.
2018-06-18 11:46:32 +02:00
Andy Wingo
5f50309448 Remove includes of validate.h.
* guile-readline/readline.c:
* libguile/alist.c:
* libguile/array-map.c:
* libguile/arrays.c:
* libguile/async.c:
* libguile/atomic.c:
* libguile/backtrace.c:
* libguile/boolean.c:
* libguile/bytevectors.c:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/debug.c:
* libguile/dynl.c:
* libguile/eq.c:
* libguile/error.c:
* libguile/eval.c:
* libguile/evalext.c:
* libguile/expand.c:
* libguile/feature.c:
* libguile/filesys.c:
* libguile/fluids.c:
* libguile/fports.c:
* libguile/gc-malloc.c:
* libguile/gc.c:
* libguile/goops.c:
* libguile/goops.h:
* libguile/guardians.c:
* libguile/hash.c:
* libguile/hashtab.c:
* libguile/hashtab.h:
* libguile/hooks.c:
* libguile/i18n.c:
* libguile/ioext.c:
* libguile/keywords.c:
* libguile/list.c:
* libguile/load.c:
* libguile/macros.c:
* libguile/memoize.c:
* libguile/modules.h:
* libguile/net_db.c:
* libguile/numbers.c:
* libguile/pairs.c:
* libguile/poll.c:
* libguile/ports.c:
* libguile/posix.c:
* libguile/print.c:
* libguile/procprop.c:
* libguile/procs.c:
* libguile/promises.c:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/rdelim.c:
* libguile/read.c:
* libguile/regex-posix.c:
* libguile/rw.c:
* libguile/scmsigs.c:
* libguile/script.c:
* libguile/simpos.c:
* libguile/socket.c:
* libguile/sort.c:
* libguile/srcprop.c:
* libguile/srfi-1.c:
* libguile/srfi-4.c:
* libguile/srfi-60.c:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/strorder.c:
* libguile/strports.c:
* libguile/struct.c:
* libguile/symbols.c:
* libguile/syntax.c:
* libguile/threads.c:
* libguile/throw.c:
* libguile/trees.c:
* libguile/unicode.c:
* libguile/values.c:
* libguile/variable.c:
* libguile/vectors.c:
* libguile/vports.c:
* libguile/weak-set.c:
* libguile/weak-table.c:
* libguile/weak-vector.c:
* libguile.h: Remove validate.h include.
2018-06-18 10:50:23 +02:00
Andy Wingo
ee5994a517 remove self field of vtables
* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT, scm_vtable_index_self):
  Remove "self" field.  Renumber the other fields.
* module/oop/goops.scm (<self-slot>): Remove.
  (fold-class-slots): Adapt for "self" slot removal.  Adapt all users.
  (class-redefinition): Now that there is no "self" slot to update, use
  %modify-instance instead of %modify-class.
* libguile/goops.c (class_self): Remove.
  (scm_sys_modify_class): Remove.
* libguile/goops.h (scm_sys_modify_class): Remove.
* module/rnrs/records/procedural.scm: Import vtable-offset-user.
  Renumber rtd indexes using vtable-offset-user.
* module/srfi/srfi-35.scm (%condition-type-vtable): Remove mention of
  vtable fields.
* module/system/base/types.scm (address->inferior-struct): Adapt for
  different vtable field layout.
2017-09-14 09:49:55 +02:00
Andy Wingo
4898959901 Implement class redefinition on top of fixed structs
* libguile/struct.h: Steal another flag for GOOPS.
* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_INDIRECT)
  (SCM_VTABLE_FLAG_GOOPS_NEEDS_MIGRATION): New flags.
  (SCM_CLASSF_GOOPS_VALID, SCM_CLASSF_GOOPS_OR_VALID): Remove obsolete
  definitions.
  (SCM_IS_A_P): Use the scm_class_of function.
* libguile/goops.c (var_class_of_obsolete_indirect_instance): Rename
  from var_migrate_instance.
  (scm_is_generic, scm_is_method, scm_sys_init_layout_x): Use
  scm_class_of instead of the SCM_CLASS_OF macro.
  (get_indirect_slots): New helper.
  (scm_class_of): This patch moves us in a direction where we won't be
  able to separately address a struct's data and its identity.
  Therefore to check whether a class needs migration, we check an
  embedded pointer from a slot instead of the vtable data.
  (scm_sys_struct_data): Remove this temporary function.
  (scm_sys_modify_instance): Update to swap slot values instead of the
  data pointers themselves.
  (scm_sys_modify_class): Use scm_sys_modify_instance.
  (scm_sys_goops_loaded): Capture class-of-obsolete-indirect-instance
  instead of migrate-instance.
  (scm_init_goops_builtins): Don't export the "valid" flag any more;
  export instead the "indirect" and "needs-migration" flags.
* libguile/foreign-object.c (scm_assert_foreign_object_type): Add a
  FIXME.
* libguile/vm-engine.c (class-of): Take away fast path for the time
  being.
* module/oop/goops.scm (class-has-indirect-instances?)
  (indirect-slots-need-migration?): New helpers.
  (<class>, <slot>, %class-slot-definition, initialize): Remove use of
  vtable-flag-goops-valid.
  (define-class): Always push redefined values through
  `class-redefinition'.
  (<redefinable-class>): New public definition.  Use it as a metaclass
  for redefinable classes.  Provide a compute-slots function that
  declares the indirect slots mechanism.  Add the "indirect" flag to
  instances of <redefinable-class>.  Create indirect-slots objects for
  instances of those classes as part of their allocate-instance.
  (change-object-class, class-of-obsolete-indirect-instance): Update for
  new representation change.
* test-suite/tests/goops.test ("object update"): Add #:metaclass
  <redefinable-class> to all redefinable classes.  For the "hell" test,
  make the new classes with class-direct-slots, not class-slots; this
  was an error in the test.
2017-09-14 09:44:30 +02:00
Andy Wingo
5c8bb13630 Change name of "static" flag indicating static slot allocation
* libguile/goops.h (SCM_VTABLE_FLAG_GOOPS_STATIC_SLOT_ALLOCATION):
  Rename from SCM_VTABLE_FLAG_GOOPS_STATIC.
* libguile/goops.c (scm_init_goops_builtins): Adapt.
* module/oop/goops.scm (class-has-statically-allocated-slots?):
  (initialize): Adapt.
2017-09-14 09:25:55 +02:00
Andy Wingo
95f66b197c GOOPS instance migration implemented in Scheme
* libguile/goops.c (scm_class_of): Call out directly to the GOOPS-local
  `migrate-instance' if an instance needs to migrate.
  (scm_sys_struct_data): New internal temporary function used by the
  Scheme `migrate-instance'.  Exorcise the evil one from the old C
  implementation.
* libguile/goops.h (scm_change_object_class): Remove function used only
  internally in GOOPS.
* module/oop/goops.scm (migrate-instance): Implement the
  hell/purgatory/etc logic in Scheme instead of C.
2017-09-14 09:24:50 +02:00
Andy Wingo
cd51ce81d0 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.
2016-05-13 18:31:29 +02:00
Andy Wingo
26350edcac 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.
2015-02-06 13:25:17 +01:00
Andy Wingo
e437c50b88 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.
2015-01-23 16:16:03 +01:00
Andy Wingo
2bcb278a30 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.
2015-01-23 16:16:03 +01:00
Andy Wingo
761338f60c 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.
2015-01-23 16:16:03 +01:00
Andy Wingo
60061fe0fe 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.
2015-01-23 16:16:02 +01:00
Andy Wingo
2025a02793 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.
2015-01-23 16:16:02 +01:00
Andy Wingo
07452c83ae 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.
2015-01-23 16:16:02 +01:00
Andy Wingo
92928b8619 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.
2015-01-23 16:16:02 +01:00
Andy Wingo
2b5812c64d Deprecate scm_get_keyword
* libguile/deprecated.c (scm_get_keyword): Deprecate.
* libguile/deprecated.h:
* libguile/goops.c:
* libguile/goops.h:
2015-01-23 16:16:01 +01:00
Andy Wingo
4a28ef1086 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.
2015-01-23 16:16:01 +01:00
Andy Wingo
5a6165db6e 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.
2015-01-23 16:16:01 +01:00
Andy Wingo
2b7692bcc4 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.
2015-01-23 16:16:01 +01:00
Andy Wingo
3292354a4d Remove pure-generic?
* libguile/goops.h:
* libguile/goops.c (scm_pure_generic_p): Remove function only compiled
  in debug mode.
2015-01-23 16:16:01 +01:00
Andy Wingo
e03e310126 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.
2015-01-23 16:16:00 +01:00
Andy Wingo
57898597ad 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.
2015-01-23 16:16:00 +01:00
Andy Wingo
6c7dd9ebd3 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>.
2015-01-23 16:16:00 +01:00
Andy Wingo
9e2cd55ec8 Remove unused CPP defines naming <method> slots
* libguile/goops.h (scm_si_generic_function, scm_si_specializers)
  (scm_si_procedure, scm_si_formals, scm_si_body)
  (scm_si_make_procedure): Remove unused CPP defines.
2015-01-23 16:16:00 +01:00
Andy Wingo
79f2aaab30 Remove unused `default-slot-definition-class' <class> slot
* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_slotdef_class)
* module/oop/goops.scm (build-<class>-slots): Remove unused
  `default-slot-definition-class' <class> slot.
2015-01-23 16:16:00 +01:00
Andy Wingo
005c078f27 Remove useless scm_s_slot_set_x export
* libguile/goops.c:
* libguile/goops.h (scm_s_slot_set_x): Remove unused and useless
  export.
2015-01-23 16:16:00 +01:00
Andy Wingo
623559f311 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.
2015-01-23 16:16:00 +01:00
Andy Wingo
07f6200116 Remove unused scm_t_method and SCM_METHOD
* libguile/goops.h (scm_t_method, SCM_METHOD): Remove unused struct
  type, typedef, and macro.
2015-01-23 16:16:00 +01:00
Andy Wingo
28b818d303 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.
2015-01-23 16:16:00 +01:00
Andy Wingo
51fd1cd650 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.
2015-01-23 16:16:00 +01:00
Andy Wingo
a91ea6a8a3 Remove declarations without definitions
* libguile/goops.h: Remove declarations for scm_oldfmt, scm_c_oldfmt0,
  and scm_c_oldfmt.  These symbols were not defined.
2015-01-23 16:16:00 +01:00
Andy Wingo
8906f23ded 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).
2015-01-23 16:16:00 +01:00
Andy Wingo
6ab1939653 %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.
2015-01-23 16:15:59 +01:00
Andy Wingo
3a0d141233 Rewrite %method-more-specific? to be in Scheme
* libguile/goops.h:
* libguile/goops.c (more_specificp, scm_sys_method_more_specific_p):
* module/oop/goops.scm (%method-more-specific?): Rewrite in Scheme.  We
  remove the scm_sys_method_more_specific_p interface as it is a private
  interface and it's not extensible.
2015-01-23 16:15:59 +01:00
Andy Wingo
e4aa440a2f Deprecate C interfaces scm_compute_applicable_methods, scm_find_method
* libguile/deprecated.h:
* libguile/deprecated.c (scm_compute_applicable_methods): Deprecate.
  This was the boot version of compute-applicable-methods, not the full
  version; the right thing to do is to call scheme.
  (scm_find_method): Deprecate.  Again, the right thing is to do this on
  the Scheme level.

* libguile/goops.c:
* libguile/goops.h: Deprecated code moved to deprecated.[ch].
2015-01-23 16:15:59 +01:00
Andy Wingo
c0a56ec78d %compute-applicable-methods in Scheme
* libguile/goops.c: Move %compute-applicable-methods to Scheme.
  (scm_sys_goops_loaded): No need to initialize
  var_compute_applicable_methods.
* libguile/goops.h (scm_sys_compute_applicable_methods): Remove.  This
  was internal so it shouldn't cause a problem.

* module/oop/goops.scm (%sort-applicable-methods):
  (%compute-applicable-methods): New definitions.
2015-01-23 16:15:59 +01:00
Andy Wingo
686022e84e remove scm_si_name_access
* libguile/goops.h (scm_si_name_access): Remove alias for
  scm_si_getters_n_setters.
2011-11-24 11:47:36 +01:00
Andy Wingo
2575157e54 remove unused <class> slot: keyword-access
* libguile/goops.h (SCM_CLASS_CLASS_LAYOUT, scm_si_keyword_access):
* libguile/goops.c (build_class_class_slots): Remove unused
  keyword-access slot from classes.
2011-11-24 11:47:36 +01:00
Andy Wingo
fa075d40dc scm_wta_* procedures replace SCM_WTA_* macros
* libguile/__scm.h: Move all the SCM_WTA and SCM_GASSERT macros out of
  here.  Also remove the scm_call_generic declarations.
* libguile/deprecated.h (SCM_WTA_DISPATCH_0, SCM_WTA_DISPATCH_1):
  (SCM_WTA_DISPATCH_2, SCM_WTA_DISPATCH_N): Deprecate.  See below for
  their replacements.
  (SCM_GASSERT0, SCM_GASSERT1, SCM_GASSERT2, SCM_GASSERTn): Deprecate
  these too.
  (SCM_WTA_DISPATCH_1_SUBR): Deprecate this strange thing.
  (scm_call_generic_0, scm_call_generic_1, scm_call_generic_2):
  (scm_call_generic_3, scm_apply_generic): Remove, indicating their
  replacements.

* libguile/print.c (iprin1):
* libguile/eq.c (scm_equal_p): Use scm_call_2 instead of
  scm_call_generic_2.

* libguile/goops.h:
* libguile/goops.c: Remove scm_{call,apply}_generic definitions.
  (scm_wta_dispatch_0, scm_wta_dispatch_1, scm_wta_dispatch_2):
  (scm_wta_dispatch_n): New procedures, replacing the SCM_WTA macros.

* libguile/numbers.c (scm_lcm):
* libguile/procs.c (scm_setter): Remove uses of SCM_GASSERT.

* libguile/numbers.c (scm_lcm):
* libguile/procs.c (scm_setter):
* libguile/vectors.c: Use the procedural scm_wta routines instead of the
  SCM_WTA macros.
2011-05-15 15:34:16 +02:00
Andy Wingo
f3c6a02c88 deprecate scm_struct_table
* libguile/goops.h:
* libguile/goops.c (scm_i_define_class_for_vtable): New internal helper,
  defines a class for a vtable, relying on the name slot being set
  correctly.
  (scm_class_of, create_struct_classes): Use the local vtable-to-class
  map instead of scm_struct_table.

* libguile/struct.h (SCM_STRUCT_TABLE_NAME, SCM_SET_STRUCT_TABLE_NAME)
  (SCM_STRUCT_TABLE_CLASS, SCM_SET_STRUCT_TABLE_CLASS, scm_struct_table)
  (scm_struct_create_handle): Deprecate these internals of the map
  between structs and classes.

* libguile/deprecated.h:
* libguile/deprecated.c (scm_struct_create_handle): Deprecated code over
  here now.
2011-05-01 23:01:14 +02:00
Andy Wingo
d5f9864ffc remove scm_add_method
* libguile/goops.h:
* libguile/goops.c (scm_add_method): Remove this function. It didn't
  work, and even if we fixed it to work it wouldn't be as good as using
  Scheme's `add-method!'.
2009-12-20 15:34:19 +01:00
Andy Wingo
ea68d342f1 procedures-with-setters implemented in terms of structs
* libguile/tags.h (scm_tc7_pws): No more.

* libguile/procs.c (scm_procedure_with_setter_p)
  (scm_make_procedure_with_setter, scm_procedure, scm_setter): Implement
  procedures-with-setters in terms of applicable structs with setters.

* libguile/procs.h: Remove a big, outdated comment, and the deprecated
  macros.

* libguile/deprecated.h (SCM_PROCEDURE_WITH_SETTER_P, SCM_PROCEDURE)
  (SCM_SETTER): Deprecate these. SCM_PROCEDURE and SCM_SETTER are bad
  names.

* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc.c (scm_i_tag_name):
* libguile/goops.c: (scm_class_of):
* libguile/print.c (iprin1):
* libguile/procprop.c (scm_i_procedure_arity):
* libguile/procs.c (scm_procedure_p):
* libguile/debug.c (scm_procedure_source): Remove a tc7_pws case.

* libguile/goops.h:
* libguile/goops.c (scm_class_procedure_with_setter): Remove this class;
  it is subsumed by applicable_struct_with_setter.

* libguile/struct.h: Update a comment.

* libguile/vm-i-system.c (call, goto/args, mv-call): Remove PWS cases.
2009-12-07 09:56:58 +01:00
Andy Wingo
9ea31741da fluids are tc7 objects
If you're wondering what I'm doing, I'm trying to eventually reimplement
smobs in terms of structs, so that applicable smobs can just follow the
applicable struct dispatch path. But to do that I have to get structs
initialized before things that use smobs, which means transforming a
bunch of smobby things to tc7 things. But this transformation is good
for performance anyway, and we currently have a glut of unused tc7s,
so here we go...

* libguile/tags.h (scm_tc7_fluid, scm_tc7_dynamic_state): Fluids (and
  dynamic states) now have tc7s.

* libguile/fluids.h: Remove scm_fluids_prehistory, and add internal
  scm_i_fluid_print. Update a comment.

* libguile/fluids.c: Update for tc7 representation. Also remove the next
  pointers while we're at it, as they aren't used in the new BDW GC.

* libguile/eq.c (scm_equal_p): Remove the hashtable case. Hashtables
  could never be equal? before, I don't see why to add stubs doing the
  same thing now.

* libguile/print.c (iprin1):
* libguile/gc.c (scm_i_tag_name):
* libguile/evalext.c (scm_self_evaluating_p): Add fluid and
  dynamic_state cases.

* libguile/goops.h: Remove scm_class_hashtable; it will be static.
* libguile/goops.c: Make <hashtable> static, and add <fluid> and
  <dynamic-state> classes.

* libguile/hashtab.h:
* libguile/hashtab.c: Remove scm_i_hashtable_equal_p.

* libguile/init.c (scm_i_init_guile): Remove call to fluids_prehistory.
2009-12-05 10:52:18 +01:00