1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-03 13:20:26 +02:00
Commit graph

4233 commits

Author SHA1 Message Date
Dirk Herrmann
03a3e94134 * libguile/eval.c (s_bad_formals, s_bad_formal, s_duplicate_formal):
New static identifiers.

	(s_clauses, s_formals, s_duplicate_formals): Removed.

	(scm_m_lambda): Use ASSERT_SYNTAX to signal syntax errors.  Be more
	specific about the kind of error that was detected.  Prepare for
	easier integration of changes for separated memoization.

	* test-suite/tests/syntax.test (define exception:bad-formal, define
	exception:duplicate-formal): New.

	(exception:duplicate-formals): Removed.

	(exception:bad-formals): Adapted to the new way of error
	reporting.

	Adapted tests for 'lambda' to the new way of error reporting.
2003-10-12 20:47:32 +00:00
Dirk Herrmann
4610b011a7 * libguile/eval.c (s_duplicate_binding): New static identifier.
(scm_m_case): Call scm_c_memq instead of implementing it inline.

	(scm_m_define): Added comment about how we check for duplicate
	formals.

	(scm_m_do): Added check for duplicate bindings.

	(scm_m_if): Use ASSERT_SYNTAX to signal syntax errors.  Avoid
	unnecessary consing when creating the memoized code.

	(scm_c_improper_memq, c_improper_memq, scm_m_lambda): Renamed
	scm_c_improper_memq to c_improper_memq, since it is not exported.

	(transform_bindings): Call scm_c_memq rather than
	scm_c_improper_memq.

	(SCM_CEVAL): Simplified handling of SCM_IM_IF forms.

	* test-suite/tests/syntax.test (exception:missing/extra-expr-syntax):
        New, introduced temporarily until all memoizers use the new way of
	error reporting.

	Adapted tests for 'if' to the new way of error reporting.
2003-10-12 12:58:51 +00:00
Dirk Herrmann
a954ce1d25 * eval.c (s_bad_bindings, s_bad_binding, s_bad_exit_clause): New
static identifiers.

	(scm_m_do): Use ASSERT_SYNTAX to signal syntax errors.  Be more
	specific about the kind of error that was detected.  Avoid use of
	SCM_CDRLOC.  Avoid unnecessary consing when creating the memoized
	code, this way also making sure that file name, line number
	information etc. remain available.
2003-10-12 09:22:52 +00:00
Dirk Herrmann
8ae95199fd * eval.c (memoize_as_thunk_prototype): New static function.
(scm_m_delay, scm_m_future): Use memoize_as_thunk_prototype.
	Avoid unnecessary consing when creating the memoized code.
2003-10-12 07:13:46 +00:00
Kevin Ryde
9b9a35b601 *** empty log message *** 2003-10-11 22:25:28 +00:00
Kevin Ryde
4c13270f34 (scm_append): Track argument number and use in error. 2003-10-11 22:24:34 +00:00
Dirk Herrmann
cc56ba8062 * libguile/eval.c (s_missing_expression, s_bad_variable): New static
identifiers.

	(scm_m_define): Use ASSERT_SYNTAX to signal syntax errors.  Prefer
	R5RS terminology for the naming of variables.  Be more specific
	about the kind of error that was detected.  Make sure file name,
	line number etc. are added to all freshly created expressions.
	Avoid unnecessary consing when creating the memoized code.

	* test-suite/tests/syntax.test (exception:missing-expr,
	exception:extra-expr): New.

	Adapted tests for 'begin' to the new way of error
	reporting.
2003-10-11 16:03:29 +00:00
Dirk Herrmann
609a8b86ae * libguile/eval.c (s_extra_expression, s_misplaced_else_clause,
s_bad_cond_clause, s_missing_recipient): New static identifiers.

	(s_extra_case_clause): Removed.

	(scm_m_case, scm_m_cond): If a clause appears after an else
	clause, report a misplaced else clause.

	(scm_m_cond): Use ASSERT_SYNTAX to signal syntax errors.  Be more
	specific about the kind of error that was detected.  Handle bound
	'else and '=>.  Avoid unnecessary consing when creating the
	memoized code.

	(scm_m_cond, unmemocopy, SCM_CEVAL): Use SCM_IM_ELSE to memoize
	the syntactic keyword 'else and SCM_IM_ARROW to memoize the
	syntactic keyword '=>.

	* test-suite/tests/syntax.test (exception:misplaced-else-clause,
	exception:bad-cond-clause): New.

	(exception:bad/missing-clauses, exception:extra-case-clause):
	Removed.

	Adapted tests for 'case' and 'cond' to the new way of error
	reporting.

	The tests that check if cond is hygienic pass now.
2003-10-11 10:40:19 +00:00
Dirk Herrmann
58a2510b07 * libguile/eval.c (scm_m_case): Allow empty lists of case labels.
* test-suite/tests/syntax.test: Fixed and activated test of empty case
        label support.
2003-10-11 01:52:25 +00:00
Dirk Herrmann
2a6f7afe04 * libguile/tags.h (SCM_IM_ELSE, SCM_IM_ARROW): New memoizer codes.
* libguile/print.c (scm_isymnames): Add names for the new memoizer
        codes.

	* libguile/eval.c (s_missing_clauses, s_bad_case_clause,
	s_extra_case_clause, s_bad_case_labels, s_duplicate_case_label,
	literal_p): New static identifiers.

	(scm_m_case): Use ASSERT_SYNTAX to signal syntax errors.  Be more
	specific about the kind of error that was detected.  Check for
	duplicate case labels.  Handle bound 'else.  Avoid unnecessary
	consing when creating the memoized code.

	(scm_m_case, unmemocopy, SCM_CEVAL): Use SCM_IM_ELSE to memoize
	the syntactic keyword 'else.

	* test-suite/tests/syntax.test (exception:bad-expression,
	exception:missing-clauses, exception:bad-case-clause,
	exception:extra-case-clause, exception:bad-case-labels): New.

	Added some tests and adapted tests for 'case' to the new way of
	error reporting.
2003-10-11 00:57:25 +00:00
Dirk Herrmann
e6729603c0 * libguile/eval.c (s_bad_expression, syntax_error_key, syntax_error,
ASSERT_SYNTAX, ASSERT_SYNTAX_2): New static identifiers.

	(scm_m_and): Use ASSERT_SYNTAX to signal syntax errors.  Avoid
	unnecessary consing when creating the memoized code.

	* test-suite/lib.scm (run-test-exception): Handle syntax errors.
2003-10-10 21:49:27 +00:00
Kevin Ryde
9ddeb77696 *** empty log message *** 2003-10-09 00:41:46 +00:00
Kevin Ryde
2be24db4d7 (scm_inexact_to_exact): Don't depend on what double->long
cast gives for values bigger than a long, or for nan or inf.
2003-10-09 00:38:51 +00:00
Kevin Ryde
ff6ea7b951 *** empty log message *** 2003-10-08 23:00:37 +00:00
Dirk Herrmann
df5af69a91 * smob.h (scm_make_smob_type): Made the declaration match the
definition.
2003-10-07 22:03:26 +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
Kevin Ryde
591924eb4c *** empty log message *** 2003-10-02 00:11:12 +00:00
Kevin Ryde
184b85a394 (s_scm_call_with_output_string): scm_get_output_string
rather than scm_strport_to_string, so as to guard against the port
having been closed by the called procedure.  Reported by Nic Ferrier.
2003-10-02 00:04:26 +00:00
Dirk Herrmann
f03314f920 * numbers.h (SCM_INEXACTP): Removed uses of SCM_TYP16S.
* tags.h, deprecated.h (SCM_TYP16S): Deprecated and moved from
	tags.h to deprecated.h.
2003-09-21 07:54:23 +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
29c4382afd * numbers.c (scm_make_complex), gc-card.c (scm_i_sweep_card): Use
sizeof (scm_t_complex) to determine the memory size of the
	malloc'd area for complex numbers.
2003-09-18 20:18:17 +00:00
Dirk Herrmann
47ae1f0eca * libguile/numbers.c (scm_bigequal): Fixed.
* test-suite/tests/numbers.test (equal?): Added tests.

	* test-suite/tests/numbers.test (=): Fixed and added some bignum
        related tests.
2003-09-17 21:03:26 +00:00
Marius Vollmer
859b6b2fff *** empty log message *** 2003-09-16 21:21:28 +00:00
Marius Vollmer
2d99b584ac (scm_current_time): 'time' does not set errno so don't use
SCM_SYSERROR for reporting errors.
2003-09-16 21:18:26 +00:00
Dirk Herrmann
e17d318faa This set of patches eliminates the dependency between the
implementation of evaluator specific memoization codes and special
	constants like #f, '() etc. ('flags'), which are not evaluator
	specific.  The goal is to remove definitions of evaluator
	memoization codes completely from the public interface.  This will
	make it possible to experiment more freely with optimizations of
	guile's internal representation of memoized code.

	* objects.c (scm_class_of): Eliminate dependency on SCM_ISYMNUM.

	* print.c (iflagnames): New array, holding the printed names of
	guile's special constants ('flags').

	(scm_isymnames): Now holds only the printed names of the
	memoization codes.

	(scm_iprin1): Separate the handling of memoization codes and
	guile's special constants.

	* tags.h (scm_tc9_flag, SCM_ITAG9, SCM_MAKE_ITAG9, SCM_ITAG9_DATA,
	SCM_IFLAGNUM): new

	(scm_tc8_char, scm_tc8_iloc, SCM_BOOL_F, SCM_BOOL_T,
	SCM_UNDEFINED, SCM_EOF_VAL, SCM_EOL, SCM_UNSPECIFIED, SCM_UNBOUND,
	SCM_ELISP_NIL, SCM_IM_DISPATCH, SCM_IM_SLOT_REF,
	SCM_IM_SLOT_SET_X, SCM_IM_DELAY, SCM_IM_FUTURE,
	SCM_IM_CALL_WITH_VALUES, SCM_IM_NIL_COND, SCM_IM_BIND): Changed
	values.

	(SCM_IFLAGP): SCM_IFLAGP now only tests for flags.

	(SCM_IFLAGP, SCM_MAKIFLAG, SCM_IFLAGNUM): Generalized to use the
	tc9 macros and scm_tc9_flag.
2003-09-16 17:37:56 +00:00
Marius Vollmer
eecac80630 *** empty log message *** 2003-09-15 12:37:16 +00:00
Marius Vollmer
2eb78d0670 (scm_setgroups): Check that the gid list is not too long. Thanks to
Paul Jarc!
2003-09-15 12:36:57 +00:00
Dirk Herrmann
22f2cf2d9a * tags.h: Reduced the number of short instructions from 14 to 13.
The typecode of the former 14th short instruction is now used to
	represent long instructions.  Changed some comments to reflect
	this fact.

	(SCM_MAKISYM): ISYMs get a new tc7 code, namely the one that was
	previously used by SCM_IM_DEFINE.

	(SCM_IM_DEFINE): Turned into a long instruction.

	* eval.c (unmemocopy, SCM_CEVAL): Treat SCM_IM_DEFINE as a long
	instruction.

	* eval.c (SCM_CEVAL): Since characters and iflags have now a tc7
	code that is separate from all instructions, one level of dispatch
	for long instructions can be eliminated.

	* print.c (scm_isymnames): Removed some commented code.
2003-09-14 08:07:10 +00:00
Marius Vollmer
97a61c5f91 *** empty log message *** 2003-09-12 15:43:04 +00:00
Marius Vollmer
189b66ba87 (SCM_FENCE): Use __memory_barrier with the Intel compiler on IA64. 2003-09-12 15:42:29 +00:00
Marius Vollmer
50e0ba57da *** empty log message *** 2003-09-12 15:16:56 +00:00
Marius Vollmer
cdc5f67652 (scm_tc16_hashtable): Added "extern" declaration. 2003-09-12 15:11:59 +00:00
Marius Vollmer
6dc1cd1eec (scm_module_reverse_lookup): Check that the obarray really is a
hashtable and do nothing if not.
2003-09-12 15:11:09 +00:00
Marius Vollmer
62f548e16c *** empty log message *** 2003-09-12 14:14:05 +00:00
Marius Vollmer
2b2c6fca20 Use "extern inline" only with GCC. Use "static
inline" else.
2003-09-12 14:13:48 +00:00
Dirk Herrmann
0d5e348022 * numbers.h (SCM_INEXACTP, SCM_REALP, SCM_COMPLEXP): Removed uses
of SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP and SCM_SLOPPY_COMPLEXP.

	* numbers.h, deprecated.h (SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP,
	SCM_SLOPPY_COMPLEXP): Deprecated and moved from numbers.h to
	deprecated.h.
2003-09-06 09:17:29 +00:00
Dirk Herrmann
6b412e9171 * eq.c (scm_eqv_p, scm_equal_p): Removed uses of
SCM_SLOPPY_INEXACTP, SCM_SLOPPY_REALP and SCM_SLOPPY_COMPLEXP.

	* eq.c (scm_eqv_p, scm_equal_p): Reordered comparisons from
	0.0==some_expression to some_expression==0.0.  The latter is
	better readable.  The former is preferred by some people, since it
	leads to a compiler error when confusing == with =.  However, when
	using gcc, a warning will be issued if in an if-statement an
	assigment appears.  Since many Guile developers are using gcc,
	such errors will not remain unnoticed anyway.  We can therefore
	focus on better readability.
2003-09-06 08:50:26 +00:00
Dirk Herrmann
7e3b25bf51 * tags.h: Added description of Guile's type system. Removed some
old and misleading comments.
2003-09-04 20:47:41 +00:00
Dirk Herrmann
3ea39242b8 * unit.c (scm_cvref): Eliminate unnecessary uses of SCM_NIMP,
SCM_SLOPPY_REALP and SCM_SLOPPY_COMPLEXP.
2003-09-04 20:14:02 +00:00
Dirk Herrmann
5d7d39ff5d * numbers.h (SCM_MAKINUM): Define in terms of scm_tc2_int.
(SCM_INEXACTP, SCM_REALP, SCM_COMPLEXP): Define in terms of the
	respective SLOPPY macro.
2003-09-04 20:04:30 +00:00
Dirk Herrmann
baa84a205c * eq.c (scm_equal_p): Use SCM_TYP7 to check if an object is of
type string, not SCM_TYP7S.
2003-09-04 19:21:21 +00:00
Kevin Ryde
53bb87824d *** empty log message *** 2003-09-03 00:03:20 +00:00
Kevin Ryde
03b79aa32a (scm_strptime): Add comment about glibc strptime %s and
current timezone requiring SCM_DEFER_INTS.
2003-09-03 00:01:17 +00:00
Kevin Ryde
ba15f500e3 *** empty log message *** 2003-09-02 23:03:34 +00:00
Kevin Ryde
4d814788fc (scm_lognot): Correction to docstring, ones-complement not 2s-complement. 2003-09-02 23:00:28 +00:00
Neil Jerram
defdc4b4ee Make -s switch optional. 2003-08-30 21:22:45 +00:00
Kevin Ryde
0f008a157a *** empty log message *** 2003-08-30 00:07:49 +00:00
Kevin Ryde
f9811f9f2e (scm_lognot): Rewrite using ~ and mpz_com, for directness
and to have non-integer types rejected as per other logical funcs.
2003-08-30 00:04:42 +00:00
Kevin Ryde
438a3ba10d *** empty log message *** 2003-08-28 00:13:06 +00:00
Kevin Ryde
c1ffdc6a42 (scm_remember_upto_here_1): Revise comments on the asm form. 2003-08-27 23:34:53 +00:00