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

81 commits

Author SHA1 Message Date
Ludovic Courtès
8ac870dee4 Implement `hash' for structs.
* libguile/hash.c (scm_hasher): Call `scm_i_struct_hash' upon
  `scm_tcs_struct'.
* libguile/struct.c (scm_i_struct_hash): New function.
* libguile/struct.h (scm_i_struct_hash): New declaration.

* test-suite/tests/structs.test ("hash"): New test prefix.
2012-10-12 23:21:39 +02:00
Andy Wingo
6d46f1e48a deprecate make-vtable-vtable
* libguile/struct.h:
* libguile/struct.c (scm_make_vtable_vtable): Deprecate, as you can
  handle most of the use cases with make-vtable, and we don't want to
  promote the creation of new roots to the type hierarchy.
  (scm_i_make_vtable_vtable): The internal replacement.
2012-07-28 13:03:04 +02:00
Andy Wingo
d192791373 deprecate struct-vtable-tag
* libguile/deprecated.c:
* libguile/deprecated.h:
* libguile/struct.c:
* libguile/struct.h:
* doc/ref/api-compound.texi: Deprecate struct-vtable-tag.
2012-07-06 18:12:59 +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
a2220d7ea4 add flag to vtables to indicate that their layout is valid
* libguile/struct.h (SCM_VTABLE_FLAG_VALIDATED): New flag, indicates
  that the layout of a vtable has been validated. The other flags have
  been renumbered.

* libguile/struct.c (scm_i_struct_inherit_vtable_magic): Set the
  VALIDATED flag if everything goes through.
  (scm_struct_vtable_p): If the struct should be a vtable but isn't
  validated, throw an error.
  (scm_make_vtable_vtable): Validate the incoming user_fields layout
  bit. Set the VALIDATED flag.
  (scm_c_make_structv): Add a comment about the case in which we delay
  scm_i_struct_inherit_vtable_magic.
2010-08-29 11:41:42 -07:00
Ludovic Courtès
e03b7f73e2 Recognize structs with both "pr" and "pw" flags as simple.
* libguile/struct.c (set_vtable_layout_flags): Keep the
  `SCM_VTABLE_FLAG_SIMPLE' flag when VTABLE has a mixture of `r' and `w'
  fields.

* libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE): Adjust comment.
2010-01-26 00:00:58 +01:00
Ludovic Courtès
bb190ddbba Add ASCII art representing the basic struct layout.
* libguile/struct.h: Add ASCII art version of the basic struct layout as
  shown in Andy's diagrams.
2010-01-25 23:43:41 +01:00
Ludovic Courtès
aa42c03669 Optimize struct initialization and accessors for the common case.
* libguile/struct.c (set_vtable_layout_flags): New function.
  (scm_i_struct_inherit_vtable_magic): Use it.
  (scm_struct_init): Optimize the case where HANDLE's vtable has the
  `SCM_VTABLE_FLAG_SIMPLE' flag.
  (scm_struct_ref): Likewise.
  (scm_struct_ref): Likewise, when `SCM_VTABLE_FLAG_SIMPLE_RW' is also set.

* libguile/struct.h (SCM_VTABLE_BASE_LAYOUT): Update comment for the
  next-to-last hidden field.
  (scm_vtable_index_reserved_6): Rename to...
  (scm_vtable_index_size): ... this.
  (SCM_VTABLE_FLAG_RESERVED_0): Rename to...
  (SCM_VTABLE_FLAG_SIMPLE): ... this.
  (SCM_VTABLE_FLAG_RESERVED_1): Rename to...
  (SCM_VTABLE_FLAG_SIMPLE_RW): ... this.

* test-suite/tests/structs.test ("low-level struct
  procedures")["struct-ref", "struct-set!", "struct-ref out-of-range",
  "struct-set! out-of-range"]: New tests.
2010-01-23 16:21:13 +01:00
Andy Wingo
96a44c1cab scm_i_alloc_struct does not take a "what" arg
* libguile/struct.h:
* libguile/struct.c (scm_i_alloc_struct): Change to not take a "what"
  argument. Callers changed.
2009-12-08 23:13:20 +01:00
Andy Wingo
485d13670b reserve a vtable flag for smobs.
* libguile/struct.h (SCM_VTABLE_FLAG_SMOB_0): Reserve a vtable flag for
  smobs.
2009-12-08 23:13:20 +01:00
Andy Wingo
72ab4b2e2b add vtable finalizer and printer setter macros
* libguile/struct.h (SCM_VTABLE_INSTANCE_FINALIZER): Use DATA_REF, not
  SLOT_REF.
  (SCM_SET_VTABLE_INSTANCE_FINALIZER, SCM_SET_VTABLE_INSTANCE_PRINTER):
  New accessor macros.
2009-12-08 23:13:20 +01:00
Andy Wingo
db5ed68588 make some applicable struct vtable-vtable public to C
* libguile/struct.h (scm_standard_vtable_vtable)
  (scm_applicable_struct_vtable_vtable)
  (scm_applicable_struct_with_setter_vtable_vtable)
* libguile/struct.c: Make these stock meta-tables public to C.
2009-12-08 23:13:13 +01:00
Andy Wingo
66e78727d6 add scm_c_make_struct[v]
* libguile/struct.h (scm_c_make_struct, scm_c_make_structv): New
  functions with which you can make a struct without consing a rest
  list.

* libguile/struct.c (scm_struct_init): Refactor to take an array of init
  values, not a list.
  (scm_make_struct, scm_make_vtable_vtable): Pull the rest arg out into
  a list and pass it down to the new array-taking functions.

* libguile/memoize.c: Remove a neeless #include <alloca>.
2009-12-07 11:21:59 +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
1be8532fdb some scm_i_init_guile cleanups
* libguile/init.c (scm_i_init_guile): Since hash tables are tc7 objects,
  things that depend on hash tables no longer depend on smobs, so move
  smob_prehistory up a bit. No more struct_prehistory.

* libguile/struct.h:
* libguile/struct.c (scm_struct_prehistory): Remove empty function.
2009-12-05 11:16:54 +01:00
Andy Wingo
2858deaf47 header tidyings
* libguile/goops.h:
* libguile/struct.h: c-backslash-region some vars.
2009-11-26 00:25:07 +01:00
Andy Wingo
51f66c9120 limn goops flags, remove foreign objs, rename entity to applicable-struct
* libguile/goops.c (scm_class_applicable_struct)
  (scm_class_applicable_struct_with_setter)
  (scm_class_applicable_struct_class): Rename from
  scm_class_entity, scm_class_entity_with_setter, and
  scm_class_entity_class.
  (scm_class_simple_method): Removed; this abstraction is not used.
  (scm_class_foreign_class, scm_class_foreign_object): Remove these,
  they are undocumented and unused. They might come back later.
  (scm_sys_inherit_magic_x): Simply inherit the vtable flags from the
  class's class. Flags are about layout, and it is the class that
  determines the layout of the instance.
  (scm_basic_basic_make_class): Don't bother setting GOOPS_OR_VALID,
  inherit-magic will do that.
  (scm_basic_make_class): Inherit magic after setting the layout. Allows
  the struct magic checker to do its job.
  (scm_accessor_method_slot_definition): Move implementation to Scheme.
  Removes the need for the accessor flag.
  (scm_sys_allocate_instance): Adapt to scm_i_alloc_struct name change,
  and that alloc-struct will handle finalization.
  (scm_compute_applicable_methods): Remove accessor check, as it's
  unnecessary.
  (scm_make): Adapt to new generic slot order, and no more
  simple-method.
  (create_standard_classes): What was the GF slot "dispatch-procedure"
  is now the applicable-struct slot "procedure". No more foreign class,
  foreign object, or simple method. Rename <entity> and friends to
  <applicable-struct> and friends. No more entity-with-setter -- though
  perhaps it will come back too. Instead generic-with-setter is its own
  thing.

* libguile/goops.h (SCM_CLASSF_METACLASS): "A goops class that is a
  vtable" -- no need for a separate flag.
  (SCM_CLASSF_FOREIGN, SCM_CLASSF_SIMPLE_METHOD)
  (SCM_CLASSF_ACCESSOR_METHOD): Removed these unused flags.
  (SCM_ACCESSORP): Removed.
  Renumber generic slots, rename entity classes, and remove the foreign
  class, foreign object, and simple method classes.

* libguile/struct.c (scm_i_struct_inherit_vtable_magic): New function,
  called when making new vtables.applicable structs
  (scm_i_alloc_struct): Remove 8-bit alignment check, as libGC
  guarantees this for us. Handle finalizer registration here.
  (scm_make_struct): Factor some things to scm_i_alloc_struct and
  scm_i_struct_inherit_vtable_magic.
  (scm_make_vtable_vtable): Adapt to scm_i_alloc_struct name change.

* libguile/struct.h (scm_i_alloc_struct): Change name from
  scm_alloc_struct, and make internal.

* module/oop/goops.scm (oop): Don't declare #:replace <class> et al,
  because <class> isn't defined in the core any more.
  (accessor-method-slot-definition): Defined in Scheme now.
  Remove <foreign-object> methods.
  (initialize on <class>): Prep layout before inheriting magic, as in
  scm_basic_make_class.

* module/oop/goops/dispatch.scm (delayed-compile)
  (memoize-effective-method!): Adapt to 'procedure slot name change.
2009-11-26 00:25:07 +01:00
Andy Wingo
b6cf4d0265 a very big commit cleaning up structs & goops. also applicable structs.
I tried to split this one, and I know it's a bit disruptive, but this
stuff really is one big cobweb. So instead we'll pretend like these are
separate commits, by separating the changelog.

Applicable struct runtime support.

* libguile/debug.c (scm_procedure_source):
* libguile/eval.c (scm_trampoline_0, scm_trampoline_1)
  (scm_trampoline_2):
* libguile/eval.i.c (CEVAL):
* libguile/goops.c (scm_class_of):
* libguile/procprop.c (scm_i_procedure_arity):
* libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Allow
  for applicable structs. Whee!

* libguile/deprecated.h (scm_vtable_index_vtable): Define as a synonym
  for scm_vtable_index_self.
  (scm_vtable_index_printer): Alias scm_vtable_index_instance_printer.
  (scm_struct_i_free): Alias scm_vtable_index_instance_finalize.
  (scm_struct_i_flags): Alias scm_vtable_index_flags.
  (SCM_STRUCTF_FLAGS): Be a -1 mask, we have a whole word now.
  (SCM_SET_VTABLE_DESTRUCTOR): Implement by hand.

Hidden slots.

* libguile/struct.c (scm_make_struct_layout): Add support for "hidden"
  fields, writable fields that are not visible to make-struct. This
  allows us to add fields to vtables and not break existing make-struct
  invocations.
  (scm_struct_ref, scm_struct_set_x): Always get struct length from the
  vtable. Support hidden fields.

* libguile/goops.c (scm_class_hidden, scm_class_protected_hidden): New
  slot classes, to correspond to the new vtable slots.
  (scm_sys_prep_layout_x): Turn hidden slots into 'h'.
  (build_class_class_slots): Reorder the class slots to account for
  vtable fields coming out of negative-land, for name as a vtable slot,
  and for hidden fields.
  (create_standard_classes): Define <hidden-slot> and
  <protected-hidden-slot>.

Clean up struct.h.

* libguile/struct.h: Lay things out cleaner. There are no more hidden
  (negative) words. Names are nicer. The exposition is nicer. But the
  basics are the same. The incompatibilities are that <vtable> has more
  slots now, and that scm_alloc_struct's signature has changed. The
  former is ameliorated by the "hidden" slots mentioned before, and the
  latter, well, it was always a very internal thing...
  (scm_t_struct_finalize): New type, a finalizer function to be run when
  instances of a vtable are collected.
  (scm_t_struct_free): Removed, structs' data is managed by the GC now,
  and not freed by vtable functions.

* libguile/struct.c: (scm_vtable_p): Now we keep flags on
  vtable-vtables, so this check is cheaper.
  (scm_alloc_struct): No hidden words. Yippee.
  (struct_finalizer_trampoline): Entersify.
  (scm_make_struct): No need to babysit extra words, though now we have
  to babysit flags. Propagate the vtable, applicable, and setter flags
  appropriately.
  (scm_make_vtable_vtable): Update for new simplicity.
  (scm_print_struct): A better printer.
  (scm_init_struct): Define <applicable-struct-vtable>, a magical vtable
  like CL's funcallable-standard-class. Also define
  <applicable-struct-with-setter-vtable>.

Remove foreign object implementation.

* libguile/goops.h:
* libguile/goops.c (scm_make_foreign_object, scm_make_class)
  (scm_add_slot, scm_wrap_object, scm_wrap_component): Remove, these
  were undocumented and unworking.

Clean up goops.h, a little.

* libguile/goops.h:
* libguile/goops.c: Also clean up.
* module/oop/goops/dispatch.scm (hashset-index): Adapt for new hashset
  index.
2009-11-26 00:24:58 +01:00
Andy Wingo
26fe6af140 remove redundant, unnecessary instance size from struct vtables
* libguile/struct.h (scm_struct_i_size): Remove this shared field -- I
  mean, the slot is still there, but it's only used for flags.

* libguile/goops.h (SCM_SET_CLASS_INSTANCE_SIZE):
* libguile/goops.c (scm_sys_inherit_magic_x, scm_make_class): Remove
  uses and definition of SCM_SET_CLASS_INSTANCE_SIZE. Light structs used
  it, but you have that info in the layout; and foreign classes used it,
  but that is going away soon anyway :)
2009-11-15 20:28:12 +01:00
Andy Wingo
11561496ba remove support for "entities" -- a form of applicable struct
Entities were meant to be a form of applicable struct. Unfortunately,
the implementation is intertwingled with generics. Removing them, for
now, will make it possible to cleanly re-add applicable struct support.

* libguile/struct.h (SCM_STRUCTF_ENTITY): Remove.
  (SCM_STRUCTF_GOOPS_HACK): New flag; sigh.
* libguile/struct.c (scm_make_struct): We make "entity" structs if the
  GOOPS_HACK flag is set. This will be fixed when we rework flags and
  remove hidden words.

* libguile/goops.c (scm_class_of): Structs are not applicable, for now
  at least.
  (scm_sys_inherit_magic_x, scm_basic_basic_make_class)
  (scm_sys_allocate_instance, scm_sys_set_object_setter_x):
  (make_struct_class): Adapt for no more entities (and thus no entity
  flag).
  (create_standard_classes): For some reason, generic functions were
  getting the LIGHT flag set, after the ENTITY flag was removed; so for
  now explicitly clear that flag.
* libguile/goops.h (SCM_GENERIC_SETTER, SCM_SET_GENERIC_SETTER): New
  macros.

* libguile/objects.h:
* libguile/objects.c: Remove code for entities.

* libguile/debug.c: (scm_procedure_source): Only work with generics.

* libguile/eval.c (scm_trampoline_0, scm_trampoline_1)
  (scm_trampoline_2): Only handle generics.

* libguile/eval.i.c (CEVAL): #ifdef out the pieces about entities.

* libguile/procprop.c (scm_i_procedure_arity): Remove support for
  entities.

* libguile/procs.c (scm_procedure_p, scm_procedure, scm_setter): Remove
  entity support.
2009-11-15 20:28:11 +01:00
Andy Wingo
9e759da10b remove unused struct gc chain macros
* libguile/struct.h (SCM_STRUCT_GC_CHAIN, SCM_SET_STRUCT_GC_CHAIN):
  Remove, no longer necessary given topological finalization, provided
  by libGC.
2009-11-15 20:28:11 +01:00
Ludovic Courtès
d587c9e8b2 Use proper types for hash/assoc functions in `hashtab.h'.
Partly fixes bug #23681 ("Function declarators with empty parentheses
should not be used").

* libguile/goops.c (scm_wrap_component): Cast `scm_sloppy_assq'.

* libguile/hashtab.c (scm_hash_fn_get_handle): Update to take functions
  of type `scm_t_hash_fn' and `scm_t_assoc_fn'.  Update callers.
  (scm_ihashx): Change to match `scm_t_hash_fn'.
  (scm_sloppy_assx): Change to match `scm_t_assoc_fn'.

* libguile/hashtab.h (scm_t_hash_fn, scm_t_assoc_fn): New types.
  (scm_t_hashtable)[hash_fn]: Change to `scm_t_hash_fn'.
  (scm_i_rehash, scm_hash_fn_get_handle, scm_hash_fn_create_handle_x,
  scm_hash_fn_ref, scm_hash_fn_set_x, scm_hash_fn_remove_x): Change to
  take `scm_t_hash_fn' and `scm_t_assoc_fn' parameters.

* libguile/srcprop.h (scm_whash_get_handle, scm_whash_create_handle,
  scm_whash_lookup): Implement in terms of `scm_hashq_*' instead of
  `scm_hash_fn_*'.

* libguile/struct.c (scm_struct_ihashq): Change to match
  `scm_t_hash_fn'.
  (scm_struct_create_handle): Cast `scm_sloppy_assq'.

* libguile/struct.h (scm_struct_ihashq): Update, make internal.
2009-10-20 00:10:18 +02:00
Ludovic Courtès
fbb857a472 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/Makefile.am
	libguile/frames.c
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc_os_dep.c
	libguile/load.c
	libguile/macros.c
	libguile/objcodes.c
	libguile/programs.c
	libguile/strings.c
	libguile/vm.c
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
	m4/inline.m4
2009-08-18 00:06:45 +02:00
Neil Jerram
53befeb700 Change Guile license to LGPLv3+
(Not quite finished, the following will be done tomorrow.
   module/srfi/*.scm
   module/rnrs/*.scm
   module/scripts/*.scm
   testsuite/*.scm
   guile-readline/*
)
2009-06-17 00:22:09 +01:00
Ludovic Courtès
6f03035fe8 Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	libguile/Makefile.am
	libguile/coop-defs.h
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-malloc.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/gc.h
	libguile/gc_os_dep.c
	libguile/hashtab.c
	libguile/hashtab.h
	libguile/inline.h
	libguile/private-gc.h
	libguile/struct.c
	libguile/struct.h
	libguile/threads.c
	libguile/threads.h
	libguile/vectors.h
	libguile/weaks.h
	test-suite/tests/gc.test
2008-09-10 23:09:30 +02:00
Ludovic Courtès
e9b8556ec9 Merge commit '7337d56d57' into boehm-demers-weiser-gc
Conflicts:
	libguile/struct.c
2008-09-10 22:44:31 +02:00
Ludovic Courtes
6cc80cb6ab Removed the now-useless `scm_struct_free_*' functions.
* libguile/struct.c (scm_alloc_struct): Set the `scm_struct_i_free'
  element to 0 instead of `scm_struct_free_standard'.
  (scm_struct_free_0): Removed.
  (scm_struct_free_light): Removed.
  (scm_struct_free_standard): Removed.
  (scm_struct_free_entity): Removed.

* libguile/struct.h (scm_struct_free_0): Removed.
  (scm_struct_free_light): Removed.
  (scm_struct_free_standard): Removed.
  (scm_struct_free_entity): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-35
2008-09-10 20:26:47 +02:00
Ludovic Courtes
5e67dc27e3 Added support for the free function of structures.
* libguile/struct.c (struct_finalizer_trampoline): New.
  (scm_struct_gc_init): Removed.
  (scm_i_structs_to_free): Removed.
  (scm_free_structs): Removed.
  (scm_make_struct): Register a finalizer for the new struct if need be.
  (scm_struct_prehistory): Cleared.

* libguile/struct.h (scm_i_structs_to_free): Removed.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-33
2008-09-05 09:37:17 +02:00
Han-Wen Nienhuys
569aa529d5 Use word_2 to store mark bits for freeing structs and vtables in the
correct order.

This ensures that we only use GC Marks during the actual GC Mark.
2008-08-16 13:21:21 -03:00
Ludovic Courtès
102dbb6f6c Add `SCM_INTERNAL' macro, use it. 2008-05-31 23:21:02 +02:00
Kevin Ryde
651f2cd27d merge from 1.8 branch 2007-03-07 23:12:36 +00:00
Ludovic Courtès
d15ad007c9 Changes from arch/CVS synchronization 2006-06-13 07:48:42 +00:00
Kevin Ryde
2b829bbb3d merge from 1.8 branch 2006-04-17 00:05:42 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Han-Wen Nienhuys
ffd724008b * struct.h: change scm_structs_to_free to scm_i_structs_to_free
* gc-malloc.c (scm_gc_register_collectable_memory): use floats;
these won't ever wrap around with high memory usage.

* gc-malloc.c: add DEBUGINFO for mtrigger GCs.
2002-09-05 21:12:21 +00:00
Marius Vollmer
4c9419ac31 * gc.h, gc.c (scm_gc_sweep): Issue deprecation warning when
non-zero is returned from a port or smob free function.
(scm_malloc, scm_realloc, scm_strndup, scm_strdup,
scm_gc_register_collectable_memory,
scm_gc_unregister_collectable_memory, scm_gc_malloc,
scm_gc_realloc, scm_gc_free, scm_gc_strndup, scm_gc_strdup): New.

* backtrace.c, continuations.c, convert.i.c, coop-threads.c,
debug-malloc.c, dynl.c, environments.c, environments.h,
extensions.c, filesys.c, fports.c, gc.c, gc.h, gh_data.c, goops.c,
guardians.c, hooks.c, init.c, keywords.c, load.c, numbers.c,
ports.c, posix.c, procs.c, rdelim.c, regex-posix.c, root.c,
smob.c, stime.c, strings.c, struct.c, struct.h, symbols.c, unif.c,
vectors.c, weaks.c: Use scm_gc_malloc/scm_malloc and
scm_gc_free/free instead of scm_must_malloc and scm_must_free, as
appropriate.  Return zero from smob and port free functions.

* debug-malloc.c (scm_malloc_reregister): Handle "old == NULL".

* fports.c (scm_setvbuf): Reset read buffer to saved values when
it is pointing to the putback buffer.
2002-02-11 18:06:50 +00:00
Marius Vollmer
33b001fd89 Prefixed each each exported symbol with SCM_API. 2001-11-02 00:19:12 +00:00
Dirk Herrmann
b29058ffee * Remove deprecated macros and typenames.
* Rename header macros to SCM_<filename>_H.
* Prefer !SCM_<foo> over SCM_N<foo>.
2001-08-31 11:17:06 +00:00
Marius Vollmer
7866776ca0 (scm_vtable_index_vcell): Removed. Renumbered subsequent indices. 2001-07-29 20:39:38 +00:00
Marius Vollmer
904a077df1 * tags.h: Update tag system docs.
(scm_tc3_cons_gloc): Renamed to scm_tc3_struct.  Changed all uses.
(scm_tcs_cons_gloc): Renamed to scm_tcs_struct.  Changed all uses.
(SCM_ECONSP, SCM_NECONSP): Removed.  Changed all uses to SCM_CONSP
or SCM_NCONSP, respectively.

* struct.c, struct.h, srcprop.c, procs.c, procprop.c, print.c,
objects.c. modules.c, goops.c, eval.c, debug.c: Changed all uses
of scm_tc3_cond_gloc and scm_tcs_cons_gloc.  See above.

* print.c (scm_iprin1): Remove printing of glocs.  Do not try to
tell glocs from structs.

* gc.c (scm_gc_mark, scm_gc_sweep): Remove handling of glocs.

* eval.c (scm_m_atbind): Make a list of variables, not glocs.
(scm_ceval, scm_deval): For SCM_IM_BIND, fiddle with variables
instead of with glocs.
(EVALCAR): Do not test for glocs.
(scm_lookupcar, scm_lookupcar1): Do not handle glocs in race
condition.
(scm_unmemocar): Do not handle glocs.
(scm_m_atfop): Memoize as a variable, not as a gloc.
(scm_eval_args, scm_deval_args): Do not handle glocs.
(scm_ceval, scm_deval): Likewise.

* eval.h (SCM_XEVALCAR): Do not test for glocs.
(SCM_GLOC_VAR, SCM_GLOC_VAL, SCM_GLOC_SET_VAL, SCM_GLOC_VAL_LOC):
Removed.

* debug.h, debug.c (scm_make_gloc, scm_gloc_p): Removed.

* dynwind.c (scm_swap_bindings): Likewise.
(scm_dowinds): Updated to recognize lists of variables instead of
lists of glocs.

* __scm.h (SCM_CAUTIOS, SCM_RECKLESS): Update comments.
2001-07-26 21:40:18 +00:00
Thien-Thi Nguyen
a06e3a75b2 Remove "face-lift" comment. 2001-07-09 07:36:48 +00:00
Marius Vollmer
92c2555f69 replace "scm_*_t" with "scm_t_*". 2001-06-14 19:50:43 +00:00
Dirk Herrmann
00d8d838bb * Simplified the goops macro system a bit and fixed a bug. 2001-06-11 08:51:28 +00:00
Dirk Herrmann
729dbac32f * Changed the default definition of SCM.
* Fixed some typing problems detected by the above change.
* Fixed some problems that were detected by compiling guile with -W.
2001-05-27 22:00:03 +00:00
Michael Livshin
c014a02eec revert the ill-considered part of the 2001-05-24 changes 2001-05-26 20:51:22 +00:00
Michael Livshin
1be6b49ccb * validate.h
(SCM_NUM2{SIZE,PTRDIFF,SHORT,USHORT,BITS,UBITS,INT,UINT}[_DEF]):
new macros.

* unif.h: type renaming:
scm_array -> scm_array_t
scm_array_dim -> scm_array_dim_t
the old names are deprecated, all in-Guile uses changed.

* tags.h (scm_ubits_t): new typedef, representing unsigned
scm_bits_t.

* stacks.h: type renaming:
scm_info_frame -> scm_info_frame_t
scm_stack -> scm_stack_t
the old names are deprecated, all in-Guile uses changed.

* srcprop.h: type renaming:
scm_srcprops -> scm_srcprops_t
scm_srcprops_chunk -> scm_srcprops_chunk_t
the old names are deprecated, all in-Guile uses changed.

* gsubr.c, procs.c, print.c, ports.c, read.c, rdelim.c, ramap.c,
rw.c, smob.c, sort.c, srcprop.c, stacks.c, strings.c, strop.c,
strorder.c, strports.c, struct.c, symbols.c, unif.c, values.c,
vectors.c, vports.c, weaks.c:
various int/size_t -> size_t/scm_bits_t changes.

* random.h: type renaming:
scm_rstate -> scm_rstate_t
scm_rng -> scm_rng_t
scm_i_rstate -> scm_i_rstate_t
the old names are deprecated, all in-Guile uses changed.

* procs.h: type renaming:
scm_subr_entry -> scm_subr_entry_t
the old name is deprecated, all in-Guile uses changed.

* options.h (scm_option_t.val): unsigned long -> scm_bits_t.
type renaming:
scm_option -> scm_option_t
the old name is deprecated, all in-Guile uses changed.

* objects.c: various long -> scm_bits_t changes.
(scm_i_make_class_object): flags: unsigned long -> scm_ubits_t

* numbers.h (SCM_FIXNUM_BIT): deprecated, renamed to
SCM_I_FIXNUM_BIT.

* num2integral.i.c: new file, multiply included by numbers.c, used
to "templatize" the various integral <-> num conversion routines.

* numbers.c (scm_mkbig, scm_big2num, scm_adjbig, scm_normbig,
scm_copybig, scm_2ulong2big, scm_dbl2big, scm_big2dbl):
deprecated.
(scm_i_mkbig, scm_i_big2inum, scm_i_adjbig, scm_i_normbig,
scm_i_copybig, scm_i_short2big, scm_i_ushort2big, scm_i_int2big,
scm_i_uint2big, scm_i_long2big, scm_i_ulong2big, scm_i_bits2big,
scm_i_ubits2big, scm_i_size2big, scm_i_ptrdiff2big,
scm_i_long_long2big, scm_i_ulong_long2big, scm_i_dbl2big,
scm_i_big2dbl, scm_short2num, scm_ushort2num, scm_int2num,
scm_uint2num, scm_bits2num, scm_ubits2num, scm_size2num,
scm_ptrdiff2num, scm_num2short, scm_num2ushort, scm_num2int,
scm_num2uint, scm_num2bits, scm_num2ubits, scm_num2ptrdiff,
scm_num2size): new functions.

* modules.c (scm_module_reverse_lookup): i, n: int -> scm_bits_t.x

* load.c: change int -> size_t in various places (where the
variable is used to store a string length).
(search-path): call scm_done_free, not scm_done_malloc.

* list.c (scm_ilength): return a scm_bits_t, not long.
some other {int,long} -> scm_bits_t changes.

* hashtab.c: various [u]int -> scm_bits_t changes.
scm_ihashx_closure -> scm_ihashx_closure_t (and made a typedef).
(scm_ihashx): n: uint -> scm_bits_t
use scm_bits2num instead of scm_ulong2num.

* gsubr.c: various int -> scm_bits_t changes.

* gh_data.c (gh_scm2double): no loss of precision any more.

* gh.h (gh_str2scm): len: int -> size_t
(gh_{get,set}_substr): start: int -> scm_bits_t,
len: int -> size_t
(gh_<num>2scm): n: int -> scm_bits_t
(gh_*vector_length): return scm_[u]size_t, not unsigned long.
(gh_length): return scm_bits_t, not unsigned long.

* fports.h: type renaming:
scm_fport -> scm_fport_t
the old name is deprecated, all in-Guile uses changed.

* fports.c (fport_fill_input): count: int -> scm_bits_t
(fport_flush): init_size, remaining, count: int -> scm_bits_t

* debug.h (scm_lookup_cstr, scm_lookup_soft, scm_evstr): removed
those prototypes, as the functions they prototype don't exist.

* fports.c (default_buffer_size): int -> size_t
(scm_fport_buffer_add): read_size, write_size: int -> scm_bits_t
default_size: int -> size_t
(scm_setvbuf): csize: int -> scm_bits_t

* fluids.c (n_fluids): int -> scm_bits_t
(grow_fluids): old_length, i: int -> scm_bits_t
(next_fluid_num, scm_fluid_ref, scm_fluid_set_x): n: int ->
scm_bits_t
(scm_c_with_fluids): flen, vlen: int -> scm_bits_t

* filesys.c (s_scm_open_fdes): changed calls to SCM_NUM2LONG to
the new and shiny SCM_NUM2INT.

* extensions.c: extension -> extension_t (and made a typedef).

* eval.h (SCM_IFRAME): cast to scm_bits_t, not int.  just so
there are no nasty surprises if/when the various deeply magic tag
bits move somewhere else.

* eval.c: changed the locals used to store results of SCM_IFRAME,
scm_ilength and such to be of type scm_bits_t (and not int/long).
(iqq): depth, edepth: int -> scm_bits_t
(scm_eval_stack): int -> scm_bits_t
(SCM_CEVAL): various vars are not scm_bits_t instead of int.
(check_map_args, scm_map, scm_for_each): len: long -> scm_bits_t
i: int -> scm_bits_t

* environments.c: changed the many calls to scm_ulong2num to
scm_ubits2num.
(import_environment_fold): proc_as_ul: ulong -> scm_ubits_t

* dynwind.c (scm_dowinds): delta: long -> scm_bits_t

* debug.h: type renaming:
scm_debug_info -> scm_debug_info_t
scm_debug_frame -> scm_debug_frame_t
the old names are deprecated, all in-Guile uses changed.
(scm_debug_eframe_size): int -> scm_bits_t

* debug.c (scm_init_debug): use scm_c_define instead of the
deprecated scm_define.

* continuations.h: type renaming:
scm_contregs -> scm_contregs_t
the old name is deprecated, all in-Guile uses changed.
(scm_contregs_t.num_stack_items): size_t -> scm_bits_t
(scm_contregs_t.num_stack_items): ulong -> scm_ubits_t

* continuations.c (scm_make_continuation): change the type of
stack_size form long to scm_bits_t.

* ports.h: type renaming:
scm_port_rw_active -> scm_port_rw_active_t (and made a typedef)
scm_port -> scm_port_t
scm_ptob_descriptor -> scm_ptob_descriptor_t
the old names are deprecated, all in-Guile uses changed.
(scm_port_t.entry): int -> scm_bits_t.
(scm_port_t.line_number): int -> long.
(scm_port_t.putback_buf_size): int -> size_t.

* __scm.h (long_long, ulong_long): deprecated (they pollute the
global namespace and have little value besides that).
(SCM_BITS_LENGTH): new, is the bit size of scm_bits_t (i.e. of an
SCM handle).
(ifdef spaghetti): include sys/types.h and sys/stdtypes.h, if they
exist (for size_t & ptrdiff_t)
(scm_sizet): deprecated.

* Makefile.am (noinst_HEADERS): add num2integral.i.c
2001-05-24 00:50:51 +00:00
Gary Houston
ce21243418 * reimplementation of values, call-with-values as primitives:
* values.c, values.h: new files.  use a struct to contain multiple
	values, similar to the previous Scheme-level implementation.
	* Makefile.am: add values.c, values.h, values.x.
	* continuations.c (continuation_apply): support R5RS multiple value
	continuations.
	* init.c: call scm_init_values.
	* struct.h: define SCM_SET_STRUCT_PRINTER.
2000-11-26 18:27:49 +00:00
Mikael Djurfeldt
85c2133978 * struct.h (SCM_STRUCT_GC_CHAIN, SCM_SET_STRUCT_GC_CHAIN): New
macros.
(scm_structs_to_free, scm_struct_prehistory): Declare.
2000-08-09 18:29:39 +00:00
Dirk Herrmann
f762051048 * Fixed struct initialization. 2000-07-26 08:35:35 +00:00