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

303 commits

Author SHA1 Message Date
Andy Wingo
21497600d2 add formals', body', and `compile-env' slots to <method>
* ice-9/boot-9.scm (compile-time-environment): Return #f instead of
  erroring under the interpreter, a bit more sane.

* libguile/goops.c (create_standard_classes):
* libguile/goops.h (scm_si_formals, scm_si_body, scm_si_compile_env):
* oop/goops.scm (method, initialize): Add `formals', `body', and
  `compile-env' slots to <method>.
2008-10-25 22:58:48 +02:00
Ludovic Courtès
44e268898b Merge branch 'master' into boehm-demers-weiser-gc
Conflicts:
	lib/Makefile.am
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc.c
	libguile/gc.h
	libguile/gc_os_dep.c
	libguile/private-gc.h
	m4/.cvsignore
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
2008-09-13 22:51:27 +02:00
Ludovic Courtès
dbb605f575 Include <config.h> in all C files; use #ifdef HAVE_CONFIG_H' rather than #if'. 2008-09-13 15:35:27 +02: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
077644c8a4 Removed unnecessary uses of class destructors.
* libguile/goops.c (scm_sys_inherit_magic_x): Don't invoke
  `SCM_SET_CLASS_DESTRUCTOR' for legacy destructors that are no longer
  needed (e.g., `scm_struct_free_entity ()', etc.).

* libguile/objects.c (scm_init_objects): Likewise.

git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-34
2008-09-10 20:26:35 +02:00
Ludovic Courtès
bb764c0e3c Complete fix of `hell' allocation in GOOPS. 2008-08-19 19:08:29 +02:00
Han-Wen Nienhuys
408bcd99d3 Fix sizeof() nitpick for goops corruption. 2008-08-18 11:19:59 -03:00
Han-Wen Nienhuys
51ef99f7fa Fix memory corruption issue with hell[] array: realloc/calloc need to
factor in sizeof(scm_t_bits)
2008-08-16 02:32:00 -03:00
Andy Wingo
4125c76761 initialize 'u' slots to 0, not SCM_UNPACK(SCM_GOOPS_UNBOUND)
* goops.c (wrap_init): Initialize 'u' slots to 0, not some random
SCM value.
2008-04-10 23:21:30 +02:00
Andy Wingo
54ee7cdfce respect slot allocation, e.g. for <read-only-slot>
* libguile/goops.c (get_slot_value, set_slot_value): In the struct
	allocation case, don't poke the slots array directly -- we should
	go through struct-ref/struct-set! code so that we get the
	permissions and allocation ('u' versus 'p') correct.
2008-04-10 23:21:30 +02:00
Ludovic Courtès
5305df84f8 Fix bug #22369: segfault in `scm_add_slot ()'. 2008-02-21 08:43:54 +00:00
Ludovic Courtès
b1f57ea4ce Changes from arch/CVS synchronization 2007-07-10 22:34:50 +00:00
Marius Vollmer
92205699d0 The FSF has a new address. 2005-05-23 19:57:22 +00:00
Neil Jerram
7346de618a Fix comment typos 2005-04-24 12:23:57 +00:00
Marius Vollmer
4e047c3e46 Include "libguile/async.h" for SCM_CRITICAL_SECTION_START/END. 2005-03-07 21:42:02 +00:00
Marius Vollmer
9de87eea47 See ChangeLog from 2005-03-02. 2005-03-02 20:42:01 +00:00
Marius Vollmer
539d541073 * objects.h, objects.c, goops.c, goops.h (scm_class_boolean,
scm_class_char, scm_class_pair, scm_class_procedure,
scm_class_string, scm_class_symbol,
scm_class_procedure_with_setter, 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_port_class, scm_smob_class,
scm_no_applicable_method, scm_class_of): Moved from objects to
goops since they are only useable once goops has been loaded.
(scm_classes_initialized): Removed.
(scm_class_of): Do not check it.
(create_standard_classes): Do not set it.
2005-01-18 14:58:39 +00:00
Marius Vollmer
526982f570 * objects.h, objects.c (scm_classes_initialized): New.
(scm_class_of): Signal error when scm_classes_initialized is zero.
* goops.c (create_standard_classes): Set scm_classes_initialized
to one.
2005-01-17 18:11:43 +00:00
Marius Vollmer
c8857a4db4 (scm_array_handle_release): New, changed all uses of
scm_t_array_handle to properly call it.
(scm_vector_get_handle, scm_generalized_vector_get_handle):
Renamed former to latter, changed all uses.
2005-01-06 18:56:34 +00:00
Marius Vollmer
4057a3e05a Use new vector elements API or simple vector API, as appropriate.
Removed SCM_HAVE_ARRAYS ifdefery.  Replaced all uses of
SCM_HASHTABLE_BUCKETS with SCM_HASHTABLE_BUCKET.
2005-01-02 20:49:04 +00:00
Marius Vollmer
c598539a67 Replaced SCM_KEYWORDP with scm_is_keyword. 2004-10-04 17:02:53 +00:00
Marius Vollmer
d2e53ed6f8 *** empty log message *** 2004-09-22 17:41:37 +00:00
Marius Vollmer
cc95e00ac6 * strings.h, strings.c: (scm_i_string_chars, scm_i_string_length,
scm_i_string_writable_chars, scm_i_string_stop_writing): New, to
replace SCM_I_STRING_CHARS and SCM_I_STRING_LENGTH.  Updated all
uses.
(scm_i_make_string, scm_c_make_string): New, to replace
scm_allocate_string.  Updated all uses.
(SCM_STRINGP, SCM_STRING_CHARS, SCM_STRING_UCHARS,
SCM_STRING_LENGTH): Deprecated.
(scm_allocate_string, scm_take_str, scm_take0str, scm_mem2string,
scm_str2string, scm_makfrom0str, scm_makfrom0str_opt):
Discouraged.  Replaced all uses with scm_from_locale_string or
similar, as appropriate.
(scm_c_string_length, scm_c_string_ref, scm_c_string_set_x,
scm_c_substring, scm_c_substring_shared, scm_c_substring_copy,
scm_substring_shared, scm_substring_copy): New.

* symbols.c, symbols.h (SCM_SYMBOLP, SCM_SYMBOL_FUNC,
SCM_SET_SYMBOL_FUNC, SCM_SYMBOL_PROPS, SCM_SET_SYMBOL_PROPS,
SCM_SYMBOL_HASH, SCM_SYMBOL_INTERNED_P, scm_mem2symbol,
scm_str2symbol, scm_mem2uninterned_symbol): Discouraged.
(SCM_SYMBOL_LENGTH, SCM_SYMBOL_CHARS, scm_c_symbol2str):
Deprecated.
(SCM_MAKE_SYMBOL_TAG, SCM_SET_SYMBOL_LENGTH, SCM_SET_SYMBOL_CHARS,
SCM_PROP_SLOTS, SCM_SET_PROP_SLOTS): Removed.
(scm_is_symbol, scm_from_locale_symbol, scm_from_locale_symboln):
New, to replace scm_str2symbol and scm_mem2symbol, respectively.
Updated all uses.
(scm_gensym): Generate only the number suffix in the buffer, just
string-append the prefix.
2004-08-19 17:19:44 +00:00
Marius Vollmer
bc36d0502b * tags.h, deprecated.h (SCM_EQ_P): Deprecated by moving it into
deprecated.h.  Replaced all uses with scm_is_eq.
2004-07-27 15:41:49 +00:00
Marius Vollmer
e11e83f3d9 * deprecated.h, deprecated.c, numbers.h (SCM_INUMP, SCM_NINUMP,
SCM_INUM): Deprecated by reenaming them to SCM_I_INUMP, SCM_I_NINUMP
and SCM_I_INUM, respectively and adding deprecated versions to
deprecated.h and deprecated.c.  Changed all uses to either use the
SCM_I_ variants or scm_is_*, scm_to_*, or scm_from_*, as appropriate.
2004-07-23 15:43:02 +00:00
Marius Vollmer
a55c2b6809 * validate.h, deprecated.h (SCM_VALIDATE_INUM, SCM_VALIDATE_INUM_COPY,
SCM_VALIDATE_BIGINT, SCM_VALIDATE_INUM_MIN,
SCM_VALIDATE_INUM_MIN_COPY,
SCM_VALIDATE_INUM_MIN_DEF_COPY,SCM_VALIDATE_INUM_DEF,
SCM_VALIDATE_INUM_DEF_COPY, SCM_VALIDATE_INUM_RANGE,
SCM_VALIDATE_INUM_RANGE_COPY): Deprecated because they make the
fixnum/bignum distinction visible.  Changed all uses to scm_to_size_t
or similar.
2004-07-10 14:35:36 +00:00
Marius Vollmer
93ccaef0c6 * numbers.h (SCM_MAKINUM, SCM_I_MAKINUM): Renamed SCM_MAKINUM to
SCM_I_MAKINUM and changed all uses.
2004-07-08 15:58:11 +00:00
Marius Vollmer
7888309be8 * deprecated.h, boolean.h (SCM_FALSEP, SCM_NFALSEP, SCM_BOOL,
SCM_NEGATE_BOOL, SCM_BOOLP): Deprecated by moving into "deprecated.h".
Replaced all uses with scm_is_false, scm_is_true, scm_from_bool, and
scm_is_bool, respectively.
2004-07-06 10:59:25 +00:00
Dirk Herrmann
366ecaec7a * goops.c (compute_getters_n_setters, create_standard_classes,
scm_add_slot): Compute closures by calling scm_i_eval_x on a
	lambda expression rather than creating them with scm_closure.
2004-05-24 04:15:49 +00:00
Marius Vollmer
f92e85f735 * print.c (scm_iprin1): Handle fractions.
* objects.h (scm_class_fraction): New.
* objects.c (scm_class_fraction): New.
(scm_class_of): Handle fractions.

* hash.c (scm_hasher): Handle fractions.

* numbers.c: New code for handling fraction all over the place.
(scm_odd_p, scm_even_p): Handle inexact integers.
(scm_rational_p): New function, same as scm_real_p.
(scm_round_number, scm_truncate_number, scm_ceiling, scm_floor):
New exact functions that replace the inexact 'dsubr'
implementations.
(scm_numerator, scm_denominator): New.

* numbers.h (SCM_NUMP): Recognize fractions.
(SCM_FRACTIONP, SCM_SLOPPY_FRACTIONP, SCM_FRACTION_NUMERATOR,
SCM_FRACTION_DENOMINATOR, SCM_FRACTION_SET_NUMERATOR,
SCM_FRACTION_SET_DENOMINATOR, SCM_FRACTION_REDUCED_BIT,
SCM_FRACTION_REDUCED_SET, SCM_FRACTION_REDUCED_CLEAR,
SCM_FRACTION_REDUCED): New.
(scm_floor, scm_ceiling, scm_truncate_number, scm_round_number):
New prototypes.
(scm_make_ratio, scm_rationalize, scm_numerator, scm_denominator,
scm_rational_p): New prototypes.
(scm_i_dbl2num, scm_i_fraction2double, scm_i_fraction_equalp,
scm_i_print_fraction): New prototypes.

* goops.c (create_standard_classes): Create "<fraction>" class.

* gc-mark.c (scm_gc_mark_dependencies): Handle fractions.

* gc-card.c (scm_i_sweep_card): Include scm_tc16_fraction as a
case in the switch, but do nothing for now.

* eval.c (SCM_CEVAL, SCM_APPLY, call_dsubr_1): Convert fractions
to doubles when calling 'dsubr' functions.

* eq.c (scm_eqv_p, scm_equal_p): Handle fractions.
2003-11-18 19:59:53 +00:00
Marius Vollmer
da0e6c2baf Make type names char const * instead of char *. Thanks to Paul Jarc! 2003-10-07 15:58:19 +00:00
Dirk Herrmann
534c55a97d This set of patches introduces a new tc7 code scm_tc7_number for
numbers.  Bignums, reals and complex numbers are turned from smobs
	into subtypes of scm_tc7_number.

	* tags.h (scm_tc7_number): New.

	* eq.c (scm_equal_p), eval.c (SCM_CEVAL), evalext.c
	(scm_self_evaluating_p), gc-card.c (scm_i_sweep_card), gc-mark.c
	(scm_gc_mark_dependencies), goops.c (create_smob_classes), hash.c
	(scm_hasher), numbers.c, numbers.h (SCM_NUMP), objects.c
	(scm_class_of), print.c (scm_iprin1), smob.c
	(scm_smob_prehistory): Don't handle bignums, reals and complex
	numbers as subtypes of scm_tc7_smob any more.

	* numbers.h, tags.h (scm_tc16_big, scm_tc16_real,
	scm_tc16_complex): Moved definitions from tags.h to numbers.h.
2003-09-18 20:55:40 +00:00
Dirk Herrmann
3b88ed2a4d The purpose of this patch is to make guile's internal memoizers
distinguishable from memoizing macros created on the scheme level
	or from user provided primitive memoizing macros.  The reason is,
	that the internal memoizers are the only ones that are allowed to
	transform their scheme input into memoizer byte code, while all
	other memoizing macros may only transform scheme code into new
	scheme code.

	To achieve this, a new macro type 'builtin-macro!' is introduced.
	Currently, 'builtin-macro!'s are handled as memoizing macros, but
	this will change when the memoizer and executor are separated.

	* macros.[ch] (scm_i_makbimacro): New.

	* macros.h (SCM_BUILTIN_MACRO_P): New.

	* macros.c (macro_print, scm_macro_type): Support builtin-macro!s.

	* eval.c, goops.c: All of guile's primitive memoizing macros are
	primitive builtin-macros now.

	* eval.c (scm_macroexp, SCM_CEVAL): Make sure the primitive
	builtin-macros are handled equally to memoizing macros.
2003-05-04 08:36:56 +00:00
Mikael Djurfeldt
c8e1d35451 * eval.c (scm_m_atdispatch): Removed until actually needed. (This
macro was introduced in anticipation of GOOPS method compilation
code.)

* goops.c: Removed binding of @dispatch.
2003-04-28 12:43:45 +00:00
Dirk Herrmann
a4aa213486 * eval.c, goops.c (@dispatch, @slot-ref, @slot-set!): Move the
instructions that bind the macros on the scheme level back to
	goops.c in order to make sure again that the bindings go into the
	(oop goops) module and are not visible from the outside.
2003-04-28 06:05:10 +00:00
Dirk Herrmann
b0c5d67b98 * eval.c, eval.h, goops.c, goops.h (scm_m_atslot_ref,
scm_m_atslot_set_x, scm_m_atdispatch): Move the declarations and
	definitions of the special goops memoizers from goops.[ch] to
	eval.[ch].  Hmm... it seems that scm_m_atdispatch is not used
	throughout guile.
2003-04-25 16:22:47 +00:00
Dirk Herrmann
0c88d7dfae * goops.c (TEST_CHANGE_CLASS, scm_sys_initialize_object): Don't
compare SCM values with !=.
2003-04-20 23:38:18 +00:00
Mikael Djurfeldt
0fd7dcd398 goops.c (TEST_CHANGE_CLASS): Update variable class after class change. 2003-04-18 08:19:03 +00:00
Mikael Djurfeldt
58241edc7d * tests/goops.test: Added tests for class redefinition, object
update and active slots.

* goops.scm (compute-getter-method): For custom getter: Check
boundness even if there is an init-thunk.  (The getter can return
#<unbound> even if the slot has been set before.)
(remove-class-accessors!): Also remove accessor-method from its
accessor.

* goops.c (scm_sys_fast_slot_ref): Use SCM_SLOT instead of
scm_at_assert_bound_ref.  (We don't want the unbound check.  See
oop/goops/active-slot.scm.)
2003-04-15 01:17:36 +00:00
Rob Browning
63c1872f88 * goops.c (prep_hashsets): make static to match prototype.
(scm_sym_args): SCM_SYMBOL -> SCM_GLOBAL_SYMBOL.  Thanks to Albert
Chin.
2003-04-13 17:46:54 +00:00
Mikael Djurfeldt
21ab2aeb77 * goops.scm (compute-getters-n-setters/verify-accessors): Better
check of format of value returned by compute-get-n-set.
(compute-getters-n-setters): Extended format of slot
getters-n-setters to indicate position and size of slot memory
allocated in instances.

* goops.c (scm_sys_prep_layout_x): Instance allocation is now
indicated through extra fields in getters-n-setters.
(scm_add_slot): Adapted to new format of getters_n_setters slot.
(Thanks to Andy Wingo.)
2003-04-13 14:48:35 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Mikael Djurfeldt
74b6d6e456 * goops.c (make_class_from_template): New fourth arg:
applicablep.
(scm_class_extended_generic_with_setter, scm_class_self): Fixed
cpls.

* smob.c (scm_set_smob_apply): Call scm_i_inherit_applicable.

* goops.c, objects.c, objects.h (scm_make_extended_class): New
second arg: applicablep.
(scm_i_inherit_applicable): New function.

* goops.c, goops.h (scm_class_applicable,
scm_class_extended_accessor): New classes.
2003-03-19 08:57:47 +00:00
Mikael Djurfeldt
f8af5c6d35 * goops.scm (define-extended-generics): New syntax.
(<class> <operator-class> <entity-class> <entity>): Marked as
replacements.
(upgrade-accessor): Renamed from upgrade-generic-with-setter.
(ensure-accessor, upgrade-accessor): Rewritten to accomodate the
new <accessor> class.
(merge-accessors): Provide for merging of accessors imported from
different modules under the same name.

* goops.c, goops.h (scm_class_accessor_method): Renamed from
scm_class_accessor.
(scm_class_accessor): New class.
2003-03-11 14:50:08 +00:00
Mikael Djurfeldt
a48d60b1c0 * srfi-1.c (scm_init_srfi_1): Extend root module map and for-each
with the versions in this module using
scm_c_extend_primitive_generic.

* goops.scm (equal?): Define default method.

* goops.c (scm_primitive_generic_generic): Enable primitive
generic if not enabled.
(scm_sys_goops_loaded): Setup unextended primitive generics.

* goops.c, goops.h (scm_c_extend_primitive_generic): New function.

* snarf.h (SCM_PRIMITIVE_GENERIC, SCM_PRIMITIVE_GENERIC_1): New
snarf macros.

* numbers.c (scm_abs): Use SCM_PRIMITIVE_GENERIC.  (This is only a
testing example.  All uses of SCM_GPROC should be converted.)

* procprop.c (scm_stand_in_scm_proc): Use scm_assq instead of
scm_assoc.

* eq.c (scm_equal_p): Turned into a primitive generic.
2003-03-06 12:51:57 +00:00
Mikael Djurfeldt
38d8927ca8 * goops.c (TEST_CHANGE_CLASS): Use scm_change_object_class instead
of calling the procedure change-object-class.
2003-01-10 12:58:40 +00:00
Mikael Djurfeldt
b46fae006d * goops.c (scm_sys_prep_layout_x): Bugfix: Only create layout for
slots with instance allocation.
2003-01-08 15:05:55 +00:00
Mikael Djurfeldt
bbf8d52350 * goops.scm (upgrade-generic-with-setter,
compute-new-list-of-methods): Use methods slot directly instead of
generic-function-methods.
(upgrade-generic-with-setter): Handle <extended-generic>:s.
(define-extended-generic): New syntax.
(make-extended-generic): New function.

* goops.c, goops.h (scm_class_extended_generic_with_setter): New
class.
(scm_compute_applicable_methods): Use scm_generic_function_methods.

* goops.c (scm_generic_function_methods): Support extended
generic functions.
2003-01-08 13:24:41 +00:00
Marius Vollmer
3d7f708f21 * __scm.h (USE_THREADS, GUILE_ISELECT): Define when
SCM_DEBUG_DEPRECATED.  Removed their use thru-out Guile.
2002-11-03 22:09:20 +00:00