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

46 commits

Author SHA1 Message Date
Andy Wingo
c872cc2f37 Merge commit '6290d3f109' into vm-check 2009-03-17 16:05:41 +01:00
Andy Wingo
798e66ab10 Merge commit '04795a1cb2' into vm-check 2009-03-17 16:04:04 +01:00
Andy Wingo
e177058bc4 don't re-enter the compiler during method dispatch
* libguile/goops.c (scm_make): In the pre-inst `make', default
  `procedure' to #f, and read a `make-procedure' instead of
  `compile-env'.

* libguile/goops.h (scm_si_make_procedure): This instead of
  scm_si_compile_env.

* module/oop/goops.scm (make-method): Remove this unused function. Users
  should use (make <method> ...) directly.
  (method): Capture `make-procedure' instead of `procedure' in the case
  that the body calls a next-method. Allows for the kind of
  "recompilation" that we were using before, but with closures instead of
  re-entering the compiler. Type-specific compilation is still
  interesting, but probably should be implemented in another way.
  (initialize): Default #:procedure to #f, and
  s/compile-env/make-procedure/.

* module/oop/goops/compile.scm (code-table-lookup): Just return the
  cmethod, not the entry -- since the entry is now just (append types
  cmethod).
  (compile-make-procedure): New procedure, returns a form that, when
  evaluated/compiled, will yield a procedure of one argument, the
  next-method. When called with a next-method, the procedure returns an
  actual method implementation. compile-make-procedure returns #f if the
  body doesn't call next-method.
  (compile-method): Unify to always return procedures. Much cleaner and
  *much* faster in the compiled case. In the interpreted case, there
  might be a slight slowdown, but if there is one it should be slight.

* module/oop/goops/dispatch.scm (method-cache-install!): Adapt to removal
  of compute-entry-with-cmethod.
2009-02-13 23:30:20 +01:00
Ludovic Courtès
6290d3f109 GOOPS: Statically allocate the PORT class array.
* libguile/goops.c (scm_port_class): Statically allocate it.
  (create_port_classes): Don't use `scm_calloc ()'.

* libguile/goops.h (scm_port_class): Update declaration.

* libguile/ports.c (scm_make_port_type): When checking whether
  GOOPS is initialized, check whether the first element of
  SCM_PORT_CLASS is non-zero.
2009-02-03 00:03:09 +01:00
Ludovic Courtès
04795a1cb2 GOOPS: Statically allocate the SMOB class array.
* libguile/goops.c (scm_smob_class): Statically allocate it.
  (create_smob_classes): Don't malloc(3) `scm_smob_class'.

* libguile/goops.h (scm_smob_class): Update declaration.

* libguile/smob.c (scm_make_smob_type, scm_set_smob_apply): When
  checking whether GOOPS is initialized, check whether the first element
  of SCM_SMOB_CLASS is non-zero.
2009-02-03 00:02:50 +01:00
Andy Wingo
c32929d14d Merge commit 'origin/master' into vm
Conflicts:

	.gitignore
	guile-tools.in
	srfi/srfi-19.scm
2009-01-12 21:36:39 +01:00
Neil Jerram
a9931e4e1a Fix implementation of %fast-slot-ref and %fast-slot-set!
* libguile/goops.c (scm_sys_fast_slot_ref, scm_sys_fast_slot_set_x):
  Correct incantation for getting the number of slots of the specified
  instance.

* libguile/goops.h (SCM_NUMBER_OF_SLOTS): Removed (because wrong).

* test-suite/standalone/test-fast-slot-ref.in: New standalone test.

* configure.in: Generate test-suite/standalone/test-fast-slot-ref.

* test-suite/standalone/Makefile.am (check_SCRIPTS): Add
  test-fast-slot-ref.
2009-01-04 22:46:47 +00:00
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
102dbb6f6c Add `SCM_INTERNAL' macro, use it. 2008-05-31 23:21:02 +02: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
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
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
Han-Wen Nienhuys
702551e6cc * gc.h (SCM_GC_CELL_TYPE): SCM_GC_CELL_TYPE uses SCM_GC_CELL_OBJECT.
* goops.h (SCM_NUMBER_OF_SLOTS): don't SCM_UNPACK the result.

* backtrace.c ("display_backtrace_body"): SCM_PACK before SCM_EQ_P
(display_frame): idem.
(display_backtrace_file_and_line): idem.

* tags.h (SCM_UNPACK): stricter typechecking on SCM_UNPACK
arguments.
2004-03-28 13:55:03 +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
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
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
6182ceacb4 (SCM_MAKE_VALIDATE_MSG): New. Use it instead of SCM_MAKE_VALIDATE in
lots of places to gove better error messages.  Thanks to Bill
Schottstaedt!
2002-10-20 22:59:01 +00:00
Thien-Thi Nguyen
0b607675c2 (scm_slot_exists_p): Rename from scm_slots_exists_p. 2002-04-22 18:00:24 +00:00
Dirk Herrmann
f12745b633 * eval.c (SCM_CEVAL): Cleaned up the handling of #@dispatch.
Added lots of comments regarding the implementation of #@dispatch.
Changed intra-procedure communication to use t.arg1 instead of
arg2.  Removed some uses of t.arg1, t.lloc and proc as temporary
variables.  Introduced temporary variables with hopefully
descriptive names for clarification.  Replaced SCM_N?IMP by a more
explicit predicate in some places.  Use SCM_INSTANCE_HASH instead
of computing the expression explicitly.  Eliminate now unused
label nontoplevel_cdrxbegin.

* goops.h (SCM_INSTANCE_HASH): New macro.

* objects.h (SCM_CMETHOD_FORMALS, SCM_CMETHOD_BODY): New macros.
2002-03-09 20:15:16 +00:00
Dirk Herrmann
a392ee1556 * eval.c: Removed outdated references to "everr". Improved some
comments.

(scm_deval_args, deval_args):  Renamed scm_deval_args to
deval_args, since it is not part of the interface.

(SCM_CEVAL):  Added (maybe somewhat verbose) comment.  Avoid to
use references to debug.vect[0] before it exists.  Add parentheses
to switch statement.

* goops.h:  Added local emacs variables.
2002-01-10 21:57:03 +00:00
Marius Vollmer
6c4493a045 Replaced SCM_DEBUG_DEPRECATED with !SCM_ENABLE_DEPRECATED. 2001-11-25 15:11:20 +00:00
Marius Vollmer
33b001fd89 Prefixed each each exported symbol with SCM_API. 2001-11-02 00:19:12 +00:00
Marius Vollmer
7895b092c4 Renumbered slot indices. (SCM_CLASS_CLASS_LAYOUT):
Removed vcell slot layout code.
(scm_si_vcell): Removed.
2001-07-29 20:46:23 +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
dcb410ec07 * Fix SCM <--> scm_t_bits related typing problems.
Thanks to Matthias Koeppe for the bug report.
2001-06-07 23:10:33 +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
Marius Vollmer
abd28220e7 (scm_init_goops_builtins): Renamed from
`scm_init_goops'.  Do not explicitly create/switch modules.
Return SCM_UNSPECIFIED.
(scm_init_goops): Only register `%init-goops-builtins' procedure.
(scm_load_goops): Use scm_c_resolve_module instead of
scm_resolve_module.
2001-05-19 00:33:25 +00:00
Mikael Djurfeldt
a087ba812e * init.c, goops.c, goops.h: Reverted change of 2001-03-29. (The
goops module should be registered in order to work for an
application which uses libguile statically linked.)
2001-04-11 02:12:35 +00:00
Keisuke Nishida
1b27e91a9b * goops.c, goops.h (scm_init_oop_goops_goopscore_module): Deprecated.
* init.c (scm_init_guile_1): Don't init goopscore module.
2001-03-30 02:50:38 +00:00
Dirk Herrmann
e11208ca72 * Cleaned up uses and definition of SCM_ASSYNT. 2001-03-12 14:34:44 +00:00
Mikael Djurfeldt
5e03762c12 * goops.c, goops.h (scm_sys_pre_expand_closure_x): Removed.
(scm_sys_tag_body): Added.
2001-03-04 20:46:04 +00:00
Mikael Djurfeldt
87e7741df7 * goops.c (scm_sys_pre_expand_closure_x): New procedure. 2001-03-04 05:27:41 +00:00
Dirk Herrmann
25ba37dffa * Simplify the use of SCM_PUREGENERICP. 2000-12-21 17:07:38 +00:00
Keisuke Nishida
398d8ee17e Some GOOPS cleanup. 2000-12-16 20:25:08 +00:00
Dirk Herrmann
79a3dafe67 * Added scm_c_memq as a fast C level alternative for scm_memq. 2000-12-01 17:57:42 +00:00
Dirk Herrmann
7f555fb4ed * Fix previous change (thanks to Matthias Koeppe). 2000-11-24 14:43:41 +00:00
Dirk Herrmann
ca83b028dc * Goops does not provide its own version of logand any more.
* Removed use of deprecated stuff from goops.
2000-11-24 10:55:23 +00:00
Mikael Djurfeldt
42b586db77 * goops.h: Renamed class --> cls, new --> newinst in order to accomodate
C++.
2000-10-25 15:51:06 +00:00
Mikael Djurfeldt
0518d3e277 * goops.h: Removed various superfluous conditions. 2000-10-25 14:49:47 +00:00