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

51 commits

Author SHA1 Message Date
Andy Wingo
3d5f3091e1 first-class macro representation (no bits on variables)
* libguile/macros.c (scm_macro_p): Update docs.

* module/ice-9/boot-9.scm (module-define!, module-ref): Define pre-boot
  forms of these functions as well. I suspect module-add! can go soon.
  (module-lookup-keyword, module-define-keyword!)
  (module-undefine-keyword!) Remove these.

* module/ice-9/psyntax-pp.scm: Regenerate. Notice the difference?

* module/ice-9/psyntax.scm (put-global-definition-hook)
  (get-global-definition-hook): Rework to expect first-class macros. Heh
  heh.
  (remove-global-definition-hook): Pleasantly, this hook can go away.
  (chi-install-global): Terrorism to generate the right kind of output --
  will clean up.
  (chi-top): Unify definition handling for all kinds of values.
2009-04-29 21:20:28 +02:00
Andy Wingo
5a0132b337 a different tack for syncase macro representation
* libguile/macros.c (macro_print): Show syntax-case bindings, if present.
  (macro_mark): Mark the extra two words if they're there.
  (scm_make_syncase_macro, scm_make_extended_syncase_macro): OK! A new
  take at the "how do we represent syncase macros in Guile" problem.
  Whereas we need a disjoint type, but would like it to be compatible
  with old predicates (e.g. `macro?'), and need to be able to extend
  existing syntax definitions (e.g. `cond'), let's add a bit to macros to
  indicate whether they have syncase macro bindings or not, and a fourth
  macro type for native syncase macros.
  (scm_macro_type): Return 'syntax-case for native syntax-case macros.
  Note that other macro types may have syntax-case bindings.
  (scm_macro_name): Return #f if the transformer is not a procedure.
  (scm_syncase_macro_type, scm_syncase_macro_binding): New accessors for
  the syncase macro bindings.

* libguile/macros.h: Add API for syncase macros.

* module/ice-9/boot-9.scm (module-define-keyword!): Adapt to use syncase
  macros, though they are not yet used. Reorder other syncase API.

* module/ice-9/psyntax.scm (chi-expr): Fix syntax-violation invocation.
2009-04-29 00:38:12 +02:00
Andy Wingo
999f1b26e7 Merge commit 'origin/master' into vm
Conflicts:

	doc/Makefile.am
	ice-9/Makefile.am
	libguile/gc.c
2008-09-30 21:12:16 +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
Andy Wingo
6c289afe76 macro-transformer recognizes compiled macros
* libguile/macros.c (macro-transformer): Recognize compiled as well as
  interpreted transformer procedures.
2008-09-07 23:13:52 +02:00
Andy Wingo
3633ff4e95 print compiled macros correctly
* libguile/macros.c (macro_print): Print macros whose code is a program
  as non-primitive. (Already, primitive-macro? would return #f.)
2008-09-07 22:27:19 +02:00
Han-Wen Nienhuys
22fc179acd * backtrace.c, debug.c, debug.h, deprecation.c, eq.c, eval.c
eval.h, gsubr.c, init.c, macros.c, print.c, print.h, read.c,
read.h, stacks.c, symbols.c, throw.c: use private-options.h

* private-options.h: new file: contain hardcoded option
definitions.
2007-01-22 15:14:40 +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
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
9fcf3cbb81 * backtrace.c (display_expression, display_frame): Call
scm_i_unmemoize_expr for unmemoizing a memoized object holding a
	single memoized expression.

	* debug.c (memoized_print): Don't try to unmemoize the memoized
	object, since we can't know whether it holds a single expression
	or a body.

	(scm_mem_to_proc): Removed check for lambda expression, since it
	was moot anyway.  Whoever uses these functions for debugging
	purposes should know what they do: Creating invalid memoized code
	will cause crashes, independent of whether this check is present
	or not.

	(scm_proc_to_mem): Take the closure's code as it is and don't
	append a SCM_IM_LAMBDA isym.  To allow easier debugging, the
	memoized code should not be modified.

	* debug.[ch] (scm_unmemoize, scm_i_unmemoize_expr): Removed
	scm_unmemoize from public use, but made scm_i_unmemoize_expr
	available as a guile internal function instead.  However,
	scm_i_unmemoize_expr will only work on memoized objects that hold
	a single memoized expression.  It won't work with bodies.

	* debug.c (scm_procedure_source), macros.c (macro_print), print.c
	(scm_iprin1): Call scm_i_unmemocopy_body for unmemoizing a body,
	i. e. a list of expressions.

	* eval.c (unmemoize_exprs): Drop internal body markers from the
	output during unmemoization.

	* eval.[ch] (scm_unmemocopy, scm_i_unmemocopy_expr,
	scm_i_unmemocopy_body): Removed scm_unmemocopy from public use,
	but made scm_i_unmemocopy_expr and scm_i_unmemocopy_body available
	as guile internal functions instead.  scm_i_unmemoize_expr will
	only work on a single memoized expression, while
	scm_i_unmemocopy_body will only work on bodies.
2004-06-27 12:34:54 +00:00
Marius Vollmer
f5710d53b1 Use SCM_SMOB_* instead of SCM_CELL_* as appropriate. Use
SCM_SMOB_FLAGS and SCM_SET_SMOB_FLAGS instead of accessing the
zeroth word directly.  Use SCM_SMOB_PREDICATE as appropriate.
2004-05-06 16:43:14 +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
Marius Vollmer
73be1d9e8e Changed license terms to the plain LGPL thru-out. 2003-04-05 19:15:35 +00:00
Han-Wen Nienhuys
1d1559ce6d * macros.c: include deprecation.h
* vectors.c (s_scm_vector_move_right_x): remove side effect in
macro arg.
(s_scm_vector_move_left_x): idem.

* net_db.c, posix.c, socket.c: variable naming: change ans to
result.

* sort.c (scm_merge_vector_x): accept vector as argument
iso. SCM*. This is needed for full GC correctness.

* gc.h: undo previous undocumented changes related to #ifdef
GENGC.
2002-07-21 17:46:23 +00:00
Han-Wen Nienhuys
34d19ef643 2002-07-20 Han-Wen <hanwen@cs.uu.nl>
* *.c: add space after commas everywhere.

* *.c: use SCM_VECTOR_SET everywhere, where a vector is written.
Document cases where SCM_WRITABLE_VELTS() is used.

* vectors.h (SCM_VELTS): prepare for write barrier, and let
SCM_VELTS() return a const pointer
(SCM_VECTOR_SET): add macro.

* autogen.sh (mscripts): find and check version number of
autoconf. Complain if 2.53 is not found.
2002-07-20 14:08:34 +00:00
Dirk Herrmann
3063e30a6d * eval.c (SCM_CEVAL), macros.c (macro_print, scm_makmacro,
scm_sym_macro, scm_macro_type), macros.h (scm_makmacro):
Deprecated the special kind of built-in dynamic syntax transformer
that was inaccurately named "macro".  Note:  The built-in syntax
transformers that are named "mmacro" or "memoizing-macro" still
exist, and it is these which come much closer to what one would
call a macro.
2002-07-15 20:39:53 +00:00
Neil Jerram
bb2c02f237 Small docstring fixes. 2002-03-15 10:37:40 +00:00
Thien-Thi Nguyen
a6b844c224 Retire inclusion guard macro SCM_MAGIC_SNARFER. 2002-03-14 03:47:43 +00:00
Neil Jerram
8f85c0c6c3 * Adding C function declarations from the SCM interface to the
reference manual documentation.
2001-11-16 15:04:17 +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
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
Dirk Herrmann
726d810a75 * Fixed scm_thunk_p's results when applied to closures.
* Extracted macro printing code from print.c to macros.c.
* Minor cleanups.
2001-04-19 14:46:01 +00:00
Martin Grabmüller
1e6808ea20 Correct, update, improve and clean up a lot of docstrings in order to make
the documentation much more consistent.
2001-04-03 13:19:05 +00:00
Marius Vollmer
88c927e950 * macros.c (scm_macro_name, scm_macro_transformer): Use
SCM_SMOB_DATA instead of SCM_CDR.  Provided by Martin Grabmueller.
Thanks!
2001-02-09 14:37:30 +00:00
Keisuke Nishida
e841c3e0c0 Smob-related creanup. 2000-12-08 17:32:56 +00:00
Marius Vollmer
8dc9439fc6 * alist.c, arbiters.c, async.c, backtrace.c, boolean.c, chars.c,
continuations.c, debug-malloc.c, debug.c, dynl.c, dynwind.c,
environments.c, eq.c, error.c, eval.c, evalext.c, feature.c,
filesys.c, fluids.c, fports.c, gc.c, goops.c, guardians.c, hash.c,
hashtab.c, hooks.c, ioext.c, iselect.c, keywords.c, lang.c,
list.c, load.c, macros.c, modules.c, net_db.c, numbers.c,
objects.c, objprop.c, options.c, pairs.c, ports.c, posix.c,
print.c, procprop.c, procs.c, properties.c, ramap.c, random.c,
read.c, regex-posix.c, root.c, scmsigs.c, script.c, simpos.c,
socket.c, sort.c, srcprop.c, stackchk.c, stacks.c, stime.c,
strings.c, strop.c, strorder.c, strports.c, struct.c, symbols.c,
tag.c, threads.c, throw.c, unif.c, variable.c, vectors.c,
version.c, vports.c, weaks.c: Makes sure the snarfer output
inclusion is disabled when the snarfer is run on the file.  Thanks
to Lars J. Aas!

* Makefile.am: Install guile-procedures.txt in version-specific
directory to enable multiple installed guile versions.  Suggested
by Karl M. Hegbloom <karlheg@debian.org, patch by Matthias Koeppe.
2000-11-17 16:25:05 +00:00
Neil Jerram
872e0c7291 * macros.c: Remove surplus newlines from end of docstrings.
* list.c (scm_list_tail): Add @deffnx line to docstring for
	list-cdr-ref.

	* keywords.c: Docstring improvements in conjunction with new
	reference manual doc on keywords.

	* error.c (scm_error_scm): Fix texinfo syntax error in
	docstring.  (@code(~S) should be @code{~S}.)

	* dynl.c: Remove surplus newlines from end of docstrings.
2000-08-11 15:12:37 +00:00
Mikael Djurfeldt
f2c9fcb07e Updated copyrights 2000-06-12 12:28:24 +00:00
Dirk Herrmann
206d3de31e * Replace SCM_UNPACK_CAR appropriately. 2000-05-23 22:23:56 +00:00
Mikael Djurfeldt
a059974535 * Makefile.am (DEFS): Added. automake adds -I options to DEFS,
and we don't want that.
(INCLUDES): Removed all -I options except for the root source
directory and the root build directory.

* *.*: Change includes so that they always use the "prefixes"
libguile/, qt/, guile-readline/, or libltdl/.
(Thanks to Tim Mooney.)
2000-04-21 14:16:44 +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
Dirk Herrmann
ba11fd4cb6 Only include root.h where it is actually needed. 2000-03-18 08:44:04 +00:00
Mikael Djurfeldt
f12677062e *** empty log message *** 2000-03-12 18:30:33 +00:00
Mikael Djurfeldt
413cb56ff4 * async.c, boolean.h, debug.c, dynl.c, dynwind.c, eval.c, eval.h,
feature.h, filesys.h, fluids.h, fports.c, fports.h, gc.c, gc.h,
  hash.c, keywords.h, macros.c, numbers.c, numbers.h, objects.c,
  objects.h, options.c, pairs.h, ports.c, ports.h, print.c,
  procs.h, ramap.c, read.c, smob.c, smob.h, srcprop.h, stacks.c,
  stacks.h, strports.c, struct.c, struct.h, tag.c, tags.h,
  throw.c, unif.c, unif.h, variable.h, vectors.h, weaks.c,
  weaks.h (SCM_SCM, SCM_BITS, SCM_CARBITS): Renamed from
  SCM_ASSCM, SCM_ASWORD, SCM_CARW).
2000-03-12 17:00:58 +00:00
Greg J. Badros
c209c88e54 *.[ch]: make a distinction between SCM as a generic
name for a Scheme object (now a void*), and SCM as 32 bit word for
storing tags and immediates (now a long int).  Introduced
SCM_ASWORD and SCM_ASSCM for conversion. Fixed various dubious
code in the process: arbiter.c (use macros), unif.c (scm_array_p),
2000-03-09 18:58:58 +00:00
Greg J. Badros
b6791b2e94 * error.h, error.c: Added `scm_wrong_type_arg_msg' to support
displaying the expected type.  Use SCM_LISTn in a couple places
instead of scm_cons-ing by hand.

* __scm.h: Added SCM_ASSERT_TYPE macro.

* validate.h, scm_validate.h: Added the former, as a renamed
version of the latter with SCM_ASSERT_TYPE used in
SCM_MAKE_VALIDATE (instead of just SCM_ASSERT)

* Makefile.am: Rename scm_validate.h to validate.h.

* *.c, *.h: Include validate.h, not scm_validate.h (old name's
prefix was superfluous).
2000-03-03 00:09:54 +00:00
Greg J. Badros
07f7f249e5 * macros.c: Doc patches from Richard Kim. Pasted from scm.texi. 2000-02-07 17:08:07 +00:00
Mikael Djurfeldt
b380b88547 * alist.c, chars.c, debug.c, dynl.c, dynwind.c, error.c, eval.c,
evalext.c, filesys.c, gc.c, hash.c, hashtab.c, ioext.c,
   keywords.c, list.c, load.c, macros.c, net_db.c, numbers.c,
   objprop.c, ports.c, posix.c, print.c, procprop.c, procs.c,
   ramap.c, regex-posix.c, root.c, scmsigs.c, simpos.c, socket.c,
   stacks.c, stime.c, strings.c, strop.c, strports.c, struct.c,
   symbols.c, throw.c, unif.c, vectors.c, version.c, vports.c,
   weaks.c: Converted docstrings to ANSI C format.
2000-01-18 11:24:03 +00:00
Greg J. Badros
3b3b36ddb7 * *.[ch]: Whitespace changes -- added space after SCM_VALIDATE_*
macros and SCM_DEFINE macros to match GNU coding standards.
2000-01-05 19:25:37 +00:00
Greg J. Badros
a1ec69163d *.[ch]: Replace GUILE_PROC w/ SCM_DEFINE. 2000-01-05 19:05:23 +00:00
Mikael Djurfeldt
26cfa3befe * macros.c (scm_make_synt): Use scm_make_subr_opt to make the
transformer subr.  (Thanks to Bill Schottstaedt.)
1999-12-21 21:31:50 +00:00
Greg J. Badros
4079f87ed2 * Makefile.am: Fix ETAGS_ARGS to recognize GUILE_PROC,
GUILE_PROC1.  Build guile-procedures.txt, and add that file to
pkgdata_DATA.

* load.c: Added `pkgdata-dir', `site-dir', `library-dir'
primitives.

* guile-doc-snarf.awk: Drop trailing space when no arguments:
e.g., "(foo )" is now "(foo)".

* *.c: moved all the documentation for primitives from
guile-doc/ref/{appendices,posix,scheme}.texi into the source code.
This leaves about half of the primitives undocumented.  Also, all
the markup is currently still texinfo.  I don't have a problem
with texinfo per se, but the markup is not very descriptive or
accurate.
1999-12-13 03:40:23 +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
Mikael Djurfeldt
23a621512f Greg's smob patch 1999-07-07 09:44:01 +00:00
Jim Blandy
3eeba8d4f5 * chars.c (scm_lowers, scm_uppers, scm_charnames, scm_charnums),
eval.c (s_expression, s_test, s_body, s_bindings, s_variable,
s_clauses, s_formals): Variables now const.
* eval.c (promsmob): Now const.
* macros.c (macrosmob): Now const.
* smob.c (scm_newsmob): Smobfuns argument now points to const.
(freecell, flob, bigob): Now const.
* dynl.c (scm_make_argv_from_stringlist, scm_coerce_rostring),
error.c (scm_error, scm_syserror, scm_syserror_msg,
scm_num_overflow, scm_out_of_range, scm_wrong_type_arg,
scm_memory_error, scm_misc_error, scm_wta), macros.c
(scm_make_synt), feature.c (scm_add_feature), filesys.c
(scm_input_waiting_p), gc.c (scm_gc_start, scm_igc,
scm_must_malloc, scm_must_realloc), gsubr.c (scm_make_gsubr),
numbers.c (scm_num2dbl, scm_two_doubles, scm_num2long,
scm_num2long_long, scm_num2ulong),
options.c (scm_options), posix.c (scm_convert_exec_args,
environ_list_to_c), procs.c (scm_make_subr_opt, scm_make_subr),
ramap.c (scm_ramapc), read.c (scm_flush_ws), socket.c
(scm_sock_fd_to_port, scm_fill_sockaddr, scm_addr_vector), stime.c
(setzone, restorezone, bdtime2c), strop.c (scm_i_index),
strports.c (scm_mkstrport), symbols.c (scm_intern_obarray_soft,
scm_intern_obarray, scm_intern, scm_intern0,
scm_sysintern0_no_module_lookup, scm_sysintern, scm_sysintern0,
scm_symbol_value0), unif.c (scm_aind, scm_shap2ra): Argument
indicating calling subr, error message text, reason for error,
symbol name or feature name are now pointer to const.
* snarf.h (SCM_PROC, SCM_PROC1): String variables are now const.
* procs.c (scm_init_iprocs): iproc argument now points to const.
* pairs.c (cxrs): Now const.
* chars.h, error.h, feature.h, filesys.h, gc.h, gsubr.h, macros.h,
numbers.h, options.h, procs.h, ramap.h, read.h, smob.h,
strports.h, symbols.h, unif.h: Update variable declarations and
function prototypes for above changes.
* dynl.c, dynl-dld.c, dynl-dl.c, dynl-shl.c (sysdep_dynl_link,
sysdep_dynl_unlink, sysdep_dynl_func): Arguments FNAME, SUBR, and
SYMB now point to const.
1999-02-06 12:31:04 +00:00
Mikael Djurfeldt
8499074bcc * macros.c (scm_makacro, scm_makmacro, scm_makmmacro): Added
argument checking.
1998-12-19 03:35:51 +00:00