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

112 commits

Author SHA1 Message Date
Marius Vollmer
94e38a653a (SCM_SMOB, SCM_GLOBAL_SMOB, SCM_SMOB_MARK, SCM_GLOBAL_SMOB_MARK,
SCM_SMOB_FREE, SCM_GLOBAL_SMOB_FREE, SCM_SMOB_PRINT,
SCM_GLOBAL_SMOB_PRINT, SCM_SMOB_EQUALP, SCM_GLOBAL_SMOB_EQUALP,
SCM_SMOB_APPLY, SCM_GLOBAL_SMOB_APPLY): New macros from Paul Jarc.
Thanks!
2003-11-13 19:40:29 +00:00
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +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
0b6843b1eb * threads.c (scm_thread): Removed filed joining_threads.
(thread_print): Print thread number as well as address of thread
structure.
(scm_join_thread): Bugfix.
(scm_lock_mutex, scm_try_mutex, scm_unlock_mutex,
scm_timed_wait_condition_variable, scm_signal_condition_variable,
scm_broadcast_condition_variable): Use the low-level API.
(scm_all_threads): Return copy of thread list (to prevent
unintended destruction).
(scm_threads_prehistory): Initialize heap_mutex of fake thread.
2002-12-16 15:24:13 +00:00
Mikael Djurfeldt
28d52ebb19 * __scm.h (SCM_DEFER_INTS, SCM_ALLOW_INTS): New definitions.
Simply lock a thread C API recursive mutex.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): Removed.

* eval.c: Replaced SOURCE_SECTION_START / SOURCE_SECTION_END with
direct calls to scm_rec_mutex_lock / unlock around the three calls
to scm_m_expand_body.

* eval.c, eval.h (promise_free): New function.
(scm_force): Rewritten;  Now thread-safe; Removed
SCM_DEFER/ALLOW_INTS.

* pthread-threads.h: Added partially implemented plugin interface
for recursive mutexes.  These are, for now, only intended to be
used internally within the Guile implementation.

* pthread-threads.c: New file.

* threads.c: Conditionally #include "pthread-threads.c".

* eval.c, eval.h (scm_makprom, scm_force): Rewritten to be
thread-safe;

* snarf.h (SCM_MUTEX, SCM_GLOBAL_MUTEX, SCM_REC_MUTEX,
SCM_GLOBAL_REC_MUTEX): New macros.

* eval.c, threads.c, threads.h, snarf.h: Rewrote critical section
macros---use mutexes instead.

* tags.h (SCM_IM_FUTURE): New tag.

* eval.c (scm_m_future): New primitive macro.
(SCM_CEVAL): Support futures.
(unmemocopy): Support unmemoization of futures.

* print.c (scm_isymnames): Name of future isym.
2002-12-15 14:24:34 +00:00
Mikael Djurfeldt
9bc4701cd3 * __scm.h (SCM_ALLOW_INTS_ONLY): Removed.
(SCM_NONREC_CRITICAL_SECTION_START,
SCM_NONREC_CRITICAL_SECTION_END, SCM_REC_CRITICAL_SECTION_START,
SCM_REC_CRITICAL_SECTION_END): New macros.
(SCM_CRITICAL_SECTION_START/END): Defined here.

* eval.c: Insert SOURCE_SECTION_START / SOURCE_SECTION_END around
the three calls to scm_m_expand_body.

* gc.h: #include "libguile/pthread-threads.h";
(SCM_FREELIST_CREATE, SCM_FREELIST_LOC): New macros.

* gc.c (scm_i_freelist, scm_i_freelist2): Defined to be of type
scm_t_key;

* gc.c, gc-freelist.c, inline.h: Use SCM_FREELIST_LOC for freelist
access.

* gc-freelist.c (scm_gc_init_freelist): Create freelist keys.

* gc-freelist.c, threads.c (really_launch): Use
SCM_FREELIST_CREATE.

* gc-malloc.c (scm_realloc, scm_gc_register_collectable_memory):

* gc.c (scm_i_expensive_validation_check, scm_gc,
scm_gc_for_newcell): Put threads to sleep before doing GC-related
heap administration so that those pieces of code are executed
single-threaded.  We might consider rewriting these code sections
in terms of a "call_gc_code_singly_threaded" construct instead of
calling the pair of scm_i_thread_put_to_sleep () and
scm_i_thread_wake_up ().  Also, we would want to have as many of
these sections eleminated.

* init.c (scm_init_guile_1): Call scm_threads_prehistory.

* inline.h: #include "libguile/threads.h"

* pthread-threads.h: Macros now conform more closely to the
pthreads interface.  Some of them now take a second argument.

* threads.c, threads.h: Many changes.

* configure.in: Temporarily replaced "copt" threads option with new
option "pthreads".
(USE_PTHREAD_THREADS): Define if pthreads configured.
2002-12-09 13:42:58 +00:00
Marius Vollmer
5527702a65 (SCM_DEFINE_PUBLIC): New. 2002-09-01 16:19:18 +00:00
Marius Vollmer
09e804ff6f (SCM_SNARF_INIT): Add "^:^" after code so that guile-snarf can remove
trailing non-init code.
2002-03-14 22:23:43 +00:00
Neil Jerram
cecb4a5e9d * These changes add a @deffnx C function declaration and function
index entries for each Guile primitive to the copy of the doc
  snarf output that is used for reference manual synchronization.
  Online help is unchanged.
2001-11-16 09:55:54 +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
Martin Grabmüller
58ade1022c * alist.c, arbiters.c, async.h, backtrace.h, boolean.c, chars.c,
chars.h, continuations.h, debug-malloc.h, dynl.c, feature.c,
	feature.h, filesys.h, fluids.h, fports.h, gc_os_dep.c,
	gdb_interface.h, gh_eval.c, gh_funcs.c, gh_io.c, gh_list.c,
	gh_predicates.c, gsubr.c, gsubr.h, guardians.h,
	guile-func-name-check.in, guile-snarf-docs-texi.in,
	guile-snarf-docs.in, guile-snarf.awk.in, guile-snarf.in,
	hashtab.h, iselect.h, keywords.h, lang.c, list.h, load.h,
	objprop.c, objprop.h, options.c, options.h, random.h,
	regex-posix.h, root.c, root.h, script.c, snarf.h, stackchk.c,
	strerror.c, strop.h, strports.h, threads.h, values.c, values.h,
	version.c, version.h: Updated copyright notice.
2001-07-19 21:08:49 +00:00
Thien-Thi Nguyen
a06e3a75b2 Remove "face-lift" comment. 2001-07-09 07:36:48 +00:00
Michael Livshin
ac13d9d210 * snarf.h (SCM_SNARF_DOCS): change the "grammar" slightly.
* guile-snarf-docs.in, guile-snarf-docs-texi.in: rewrite &
simplify.

* eval.c: all hash signs are in column 0.

* Makefile.am (guile_filter_doc_snarfage): build using
c-tokenize.c, not filter-doc-snarfage.c.
rearrange snarfing dependencies a bit.

* c-tokenize.lex: new file.
2001-06-25 03:30:02 +00:00
Michael Livshin
a88ff5b650 * snarf.h, filter-doc-snarfage.c: more changes to cope with
space-happy C preprocessors.
2001-06-08 14:49:05 +00:00
Michael Livshin
c99f960518 * guile-snarf-docs.in, guile-snarf-docs-texi.in,
filter-doc-snarfage.c: new files.

* Makefile.am: add stuff to [build,] use and distribute
guile-snarf-docs, guile-snarf-docs-texi, guile_filter_doc_snarfage.

* guile-snarf.in: grok the new snarf output.

* snarf.h: make the output both texttools- and `read'-friendly.

* guile-doc-snarf.in (bindir): reimplement in terms of guile-snarf
and guile-snarf-docs.  (should also deprecate, I guess.  maybe
not).
2001-05-31 13:15:54 +00:00
Marius Vollmer
a0f3e74752 (SCM_CONST_LONG): Use SCM_VCELL_INIT instead of
SCM_VARIABLE_INIT since that it what it used to be.
2001-05-22 22:46:14 +00:00
Marius Vollmer
9a441ddb34 (scm_c_make_gsubr, scm_c_define_gsubr, scm_c_make_gsubr_with_generic,
scm_c_define_gsubr_with_generic): New functions.  They replace
scm_make_gsubr and scm_make_gsubr_with_generic.  The `make' variants
only create the gsubr object, while the `define' variants also put it
into the current module.  Changed all callers.  (scm_make_gsubr,
scm_make_gsubr_with_generic): Deprecated.

(scm_c_make_subr, scm_c_define_subr, scm_c_make_subr_with_generic,
scm_c_define_subr_with_generic): New functions.  They replace
scm_make_subr, scm_make_subr_opt and scm_make_subr_with_generic.  The
`make' variants only create the subr object, while the `define'
variants also put it into the current module.  Changed all callers.
(scm_make_subr, scm_make_subr_opt, scm_make_subr_with_generic):
Deprecated.
2001-05-20 00:35:43 +00:00
Marius Vollmer
86d31dfe7d Merge from mvo-vcell-cleanup-1-branch. 2001-05-15 14:57:22 +00:00
Marius Vollmer
e1fbffa9f4 (SCM_FUNC_CAST_ARBITRARY_ARGS): Use "SCM (*)()" for C++
as well.  "SCM (*)(...)" does not work on RedHat 7.1.
2001-05-06 21:19:53 +00:00
Keisuke Nishida
a9205f0774 * snarf.h (SCM_CONST_LONG): Deprecated.
* tag.c (CONST_INUM): New macro.  Use it to define scm_utag_*.
2001-03-16 05:11:34 +00:00
Dirk Herrmann
a3fc3be99d * Make the creation of bindings more straightforward. 2000-12-12 14:07:06 +00:00
Dirk Herrmann
38ae064c6e * Use scm_mem2symbol or scm_str2symbol to create symbol objects. 2000-12-08 17:08:34 +00:00
Dirk Herrmann
3c6d9d717f * Renamed SCM__X tokens to better readable ones that also follow the
SCM_SNARF_ prefix convention.
2000-06-21 08:43:12 +00:00
Mikael Djurfeldt
94a708591f * snarf.h (SCM_SNARF_HERE, SCM_SNARF_INIT, SCM_SNARF_DOCS):
Renamed from SCM_HERE, SCM_INIT, SCM_DOCS.
2000-06-12 11:59:57 +00:00
Mikael Djurfeldt
d80f396e99 * snarf.h, guile-snarf.awk.in, guile-snarf.in: Replaced snarf
markers with identifiers (SCM__I, SCM__D, SCM__S, SCM__E).
(Thanks to Bernard Urban.)
2000-06-08 18:48:24 +00:00
Dirk Herrmann
54778cd312 Lots of fixes to make guile (at some time) compile with strict typing. 2000-04-03 08:47:51 +00:00
Michael Livshin
89e00824a0 * *.[hc]: add Emacs magic at the end of file, to ensure GNU
indentation style.
2000-03-19 19:01:16 +00:00
Mikael Djurfeldt
e282f286eb * alist.c, eval.c, net_db.c, posix.c, print.c, snarf.h, struct.c,
tags.h: Fixed copyright notices.
2000-03-12 16:08:24 +00:00
Mikael Djurfeldt
fd61ba9ee2 * snarf.h (SCM_PROC1): Replaced SCM (*) (...) with
SCM_FUNC_CAST_ARBITRARY_ARGS.
2000-01-12 01:29:42 +00:00
Greg J. Badros
2fdcf8bdf0 * backtrace.c: Fix spelling typo in a comment.
* snarf.h: Use new SCM_DOCS macro to encapsulate the non SCM_INIT
text.  Reformatted some of the expansions.
2000-01-09 01:07:17 +00:00
Greg J. Badros
1e76143f0f * scm_validate.h (SCM_OUT_OF_RANGE): Use scm_out_of_range_pos to
report the position of the argument.

* error.h, error.c (scm_out_of_range_pos):  Added this function to
take extra "pos" argument, the position number of the errant
argument.

* debug.c: Use SCM_OUT_OF_RANGE instead of scm_out_of_range.

* snarf.h: Use SCM_HERE and SCM_INIT as names, not SCM_NOTSNARF
and SCM_SNARFING.  Also put the %%% in the SCM_INIT since Mikael
prefers that and I'm reasonably indifferent.
2000-01-07 23:53:20 +00:00
Mikael Djurfeldt
73d8385e9f * snarf.h (SCM_INSITU, SCM_INIT): Resurrected. 2000-01-07 23:33:29 +00:00
Greg J. Badros
4b4d0898a6 * snarf.h: Factor out differences between C++ and non-C++ into
SCM_FUNC_CAST_ARBITRARY_ARGS macro.  Modify all the snarf macro
definitions to use SCM_NOTSNARF and SCM_SNARFING macros (like
Mikael's macros, below, but changed names and SCM_SNARFING no
longer expands to include %%% -- that must appear in the argument
so that the token appears at the call-site as a reminder).
2000-01-07 23:05:04 +00:00
Mikael Djurfeldt
03ec84b88b Added extra newline in SCM_INIT macro. 2000-01-07 00:51:16 +00:00
Mikael Djurfeldt
bfe19b466f * snarf.h (SCM_INSITU, SCM_INIT): New snarf macros for use in user
snarf macro definitions.
2000-01-07 00:29:28 +00:00
Greg J. Badros
c3ee75204c * *.c, snarf.h: Replace GUILE_PROC1 with SCM_DEFINE1 throughout. 2000-01-06 19:51:45 +00:00
Greg J. Badros
a1ec69163d *.[ch]: Replace GUILE_PROC w/ SCM_DEFINE. 2000-01-05 19:05:23 +00:00
Greg J. Badros
5a237c9d5d * snarf.h (SCM_ASSERT): Give new definition of SCM_ASSERT when in
snarfing mode to output a lexically-identifiable sequence that the
guile-snarf.awk script uses to verify argument/position matching.
2000-01-05 18:19:54 +00:00
Mikael Djurfeldt
8f151b4264 Completed last change 1999-12-14 21:47:03 +00:00
Greg J. Badros
9b1594fd19 * snarf.h: Put SCM_PROC and SCM_PROC1 back in for
backward-compatibility of packages that use Guile.  Internally
Guile should not use them, though.  (Maybe enforce this with a new
-DBUILDING_GUILE compile-time flag?).
1999-12-14 18:54:31 +00:00
Greg J. Badros
eff08ab65d * scm_validate.h: Drop the SCM_DOCSTRING_SNARF for turning off
SCM_VALIDATE macros;  the SCM_VALIDATE macros should be checked
for argument mismatches (along with the FUNC_NAME macro checking)
by a static tool that runs directly over the .c files.

* snarf.h: Handle SCM_REGISTER_PROC better when snarfing.  The
docstring is still missing from the .doc file;  it just gives the
name of the C function that gets called instead.

* guile-doc-snarf.awk: Be sure to touch the output files to help
make out.  Also handle SCM_REGISTER_PROC better, and change the
output format slightly.
1999-12-13 00:52:43 +00:00
Greg J. Badros
3dc81fbace * snarf.h: Drop SCM_PROC, SCM_PROC1. Added extra output for
guile-doc-snarf script.

* guile-doc-snarf.in, guile-doc-snarf.awk: New, simple doc
extraction system.  Builds foo.x, foo.doc from foo.{c,cc}.
There are dependencies between these files and snarf.h.  This
replaces guile-snarf.

* guile-snarf.in: Drop everything after $$$ for the new snarf.h
macros.  This is obsoleted by guile-doc-snarf, but kept here for
now for good measure.

* Makefile.am: Added guile-doc-snarf, guile-doc-snarf.awk to
bin_SCRIPTS.  Added .doc to SUFFIXES, and give rule for creating
.doc files to use guile-doc-snarf.  Update the rule for creating
.x files to use guile-doc-snarf.
1999-12-12 23:37:40 +00:00
Greg J. Badros
6e8d25a695 * *.c: Finish replacing K&R style prototypes with ANSI C
prototypes.

* eval.c: Make scm_m_mody's 3rd argument be a const char *, not a
char *.  ANSI prototypes caught this.

* strorder.c: Use GUILE_PROC1 for the couple SCM_PROC1 expansions
that I missed.

* scm_validate.h: Use SCM_BOOLP for validating bools.  Do not
expand macros if SCM_DOCSTRING_SNARF.
1999-12-12 20:35:02 +00:00
Greg J. Badros
1bbd0b849f * *.c: Pervasive software-engineering-motivated rewrite of
function headers and argument checking.  Switched SCM_PROC,
SCM_PROC1 macros to be GUILE_PROC, GUILE_PROC1 (may change names
later, but was useful to keep old versions around while migrate)
that has docstrings and argument lists embedded in the GUILE_PROC
macro invocations that expand into a function header.  Use lots of
new SCM_VALIDATE_* macros to simplify error checking and reduce
tons of redundancy.  This is very similar to what I did for Scwm.

Note that none of the extraction of the docstrings, nor software
engineering checks of Scwm is yet added to Guile.  I'll work on
that tomorrow, I expect.

* Makefile.am: Added scm_validate.h to modinclude_HEADERS.

* chars.c: Added docstrings for the primitives defined in here.

* snarf.h:  Added GUILE_PROC, GUILE_PROC1.  Added
SCM_REGISTER_PROC to be like old SCM_PROC, though old SCM_PROC
still remains for now.  Changed naming convention for the s_foo
string name of the primitive to be s_scm_foo for ease of use with
the macro.

* scm_validate.h: Lots of new SCM_VALIDATE macros to simplify
argument checking through guile.  Maybe some of these should be
folded into the header file for the types they check, but for now
it was easiest to just stick them all in one place.
1999-12-12 02:36:16 +00:00
Jim Blandy
1bf17bb472 * snarf.h (SCM_GLOBAL_KEYWORD): Call scm_c_make_keyword, not
scm_makekey, which doesn't exist any more.  Guess nobody's using
this.
1999-09-05 12:41:52 +00:00
Mikael Djurfeldt
9de33deb2e * procs.c, procs.h (scm_subr_entry): New type: Stores data
associated with subrs.
(SCM_SUBRNUM, SCM_SUBR_ENTRY, SCM_SUBR_GENERIC, SCM_SUBR_PROPS,
SCM_SUBR_DOC): New macros.
(scm_subr_table): New variable.
(scm_mark_subr_table): New function.

* init.c (scm_boot_guile_1): Call scm_init_subr_table.

* gc.c (scm_gc_mark): Don't mark subr names here.
(scm_igc): Call scm_mark_subr_table.

* snarf.h (SCM_GPROC, SCM_GPROC1): New macros.

* procs.c, procs.h (scm_subr_p): New function (used internally).

* gsubr.c, gsubr.h (scm_make_gsubr_with_generic): New function.

* objects.c, objects.h (scm_primitive_generic): New class.

* objects.h (SCM_CMETHOD_CODE, SCM_CMETHOD_ENV): New macros.

* print.c (scm_iprin1): Print primitive-generics.

* __scm.h (SCM_WTA_DISPATCH_1, SCM_GASSERT1,
SCM_WTA_DISPATCH_2, SCM_GASSERT2): New macros.

* eval.c (SCM_CEVAL, SCM_APPLY): Replace scm_wta -->
SCM_WTA_DISPATCH_1 for scm_cxr's (unary floating point
primitives).  NOTE: This means that it is now *required* to use
SCM_GPROC1 when creating float scm_cxr's (float scm_cxr's is an
obscured representation that will be removed in the future anyway,
so backward compatibility is no problem here).

* numbers.c: Converted most numeric primitives (all but bit
comparison operations and bit operations) to dispatch on generic
if args don't match.

* eval.c, eval.h (scm_eval_body): New function.

* objects.c (scm_call_generic_0, scm_call_generic_1,
scm_call_generic_2, scm_call_generic_3, scm_apply_generic): New
functions.

* eval.c (SCM_CEVAL): Apply the cmethod directly after having
called scm_memoize_method instead of doing a second lookup.

* objects.h (scm_memoize_method): Now returns the memoized cmethod.

* procs.c (scm_make_subr_opt): Use scm_sysintern0 instead of
scm_sysintern so that the binding connected with the subr name
isn't cleared when we give set = 0.
1999-08-26 04:24:42 +00:00
Jim Blandy
af68fb843b * snarf.h (SCM_CONST_LONG): Remove trailing semicolon from
definition.
1999-07-19 07:53:51 +00:00
Jim Blandy
37a33fed28 Patch from Greg Badros:
* snarf.h (SCM_PROC, SCM_PROC1): Use __cplusplus or
GUILE_CPLUSPLUS_SNARF macros to force adding a cast to the last
(function pointer) argument to scm_make_gsubr and scm_make_subr
calls.  This avoids warnings in C++ programs using guile-snarf.
1999-07-17 05:49:20 +00:00
Mikael Djurfeldt
37b83f68b0 * snarf.h (SCM_KEYWORD, SCM_GLOBAL_KEYWORD): New macros. 1999-06-23 11:16:52 +00:00
Jim Blandy
e4755e5c7b * numbers.c (s_bignum): Renamed to s_bignum, and made static.
Libguile should not be exporting random little strings.
* numbers.h (s_bignum): Extern declaration removed.
More const changes from Ken Raeburn.
* numbers.c (scm_s_bignum, fx): Now const.
(scm_logtab, scm_ilentab, s_adjbig): Now static and const.
* numbers.h (scm_s_bignum): Update declaration.
* eval.c (bodycheck): Argument WHAT now points to const.
* snarf.h (SCM_SYNTAX): Name is const.
* eval.c (scm_i_let): Make this globally visible, to avoid dynamic
linking crashes on NetBSD.  (Thanks to Ken Raeburn.)
1999-04-17 16:03:32 +00:00