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

563 commits

Author SHA1 Message Date
Dirk Herrmann
36245b66c2 * libguile/eval.c (s_macro_keyword): New static identifier.
(scm_m_define): Change order to first create binding and
	evaluating the expression afterwards.

	(scm_m_set_x): Memoize complete set! expression.  Only leave
	symbols if no binding exists at memoization time.  Throw error if
	assigning to a syntactic keyword.

	(lazy_memoize_variable): New function.

	(CEVAL): When execution set!, perform lazy memoization if
	unmemoized symbol is detected.

	* libguile/modules.c (module_variable): Return variables with
	unbound value.

	* libguile/tags.h: Fix comment.

	* test-suite/tests/syntax.test: Add test case to check the correct
	handling of define expressions.
2004-04-26 19:59:03 +00:00
Dirk Herrmann
7e6e6b37ba Hide the implementation of ilocs and isyms in eval.c.
* deprecated.h (SCM_IFRINC, SCM_ICDR, SCM_IFRAME, SCM_IDIST,
	SCM_ICDRP), eval.c (SCM_IFRINC, SCM_ICDR, SCM_IFRAME, SCM_IDIST,
	SCM_ICDRP), eval.h (SCM_ICDR, SCM_IFRINC, SCM_IFRAME, SCM_IDIST,
	SCM_ICDRP): Deprecated and added to deprecated.h.  Moved from
	eval.h to eval.c.

	* deprecated.c (scm_isymnames), deprecated.h (scm_isymnames,
	SCM_ISYMNUM, SCM_ISYMCHARS), eval.c (SCM_ISYMNUM, isymnames,
	scm_unmemocopy, CEVAL), print.c (scm_isymnames), tags.h
	(SCM_ISYMNUM, scm_isymnames, SCM_ISYMCHARS): Deprecated
	scm_isymnames, SCM_ISYMNUM and SCM_ISYMCHARS and added to
	deprecated.[hc].  Moved scm_isymnames from print.c to eval.c and
	renamed to isymnames.  Moved SCM_ISYMNUM from tags.h to eval.c and
	renamed to ISYMNUM.

	* eval.c (scm_i_print_iloc, scm_i_print_isym), eval.h
	(scm_i_print_iloc, scm_i_print_isym), print.c (scm_iprin1):
	Extracted printing of ilocs and isyms to guile internal functions
	scm_i_print_iloc, scm_i_print_isym of eval.c.
2004-04-22 19:19:17 +00:00
Dirk Herrmann
b1cb24ff0a * eval.c (scm_unmemocopy): Fixed unmemoization of let*.
(deval_args, CEVAL): Minor improvements: Reduced variable scopes,
	added const qualifiers, cast intentionally unused expressions to
	void for emphasis, improved comment.
2004-04-19 16:49:56 +00:00
Dirk Herrmann
dec40cd262 * eval.c (CEVAL): Don't distinguish between short and long
instructions when dispatching - just always dispatch on the
	instruction code, which is common for short and long instructions.
	Further, removed unnecessary goto statements and added comment.
2004-04-03 16:38:56 +00:00
Dirk Herrmann
0e7bb79594 * eval.c (scm_unmemocopy): Don't distinguish between short and
long instructions when dispatching - just always dispatch on the
	instruction code, which is common for short and long instructions.
	Further, removed unnecessary goto statements, fixed indentation
	and replaced SCM_IMP predicates by SCM_NULLP.
2004-04-03 15:45:36 +00:00
Dirk Herrmann
f998676709 * eval.c (scm_lookupcar1, CEVAL): Use SCM_ILOCP instead of
comparison with SCM_ILOC00.  In CEVAL, eliminate goto-label
	'checkmacro'.
2004-04-03 14:24:17 +00:00
Dirk Herrmann
434f2f7a91 Introduce scm_debug_mode_p as a replacement for scm_debug_mode and
SCM_DEBUGGINGP:

	* debug.h (scm_debug_mode_p, scm_debug_mode, SCM_DEBUGGINGP),
	eval.c (scm_debug_mode_p): Deprecated scm_debug_mode and
	SCM_DEBUGGINGP.  Provided scm_debug_mode_p instead, to have one
	single interface that also matches the naming conventions.
	Probably scm_debug_mode_p should be part of the private interface
	anyway.

	* debug.h (scm_debug_mode_p), backtrace.c (display_error_body),
	eval.c (SCM_APPLY, scm_trampoline_0, scm_trampoline_1,
	scm_trampoline_2): Change uses of scm_debug_mode or SCM_DEBUGGINGP
	to scm_debug_mode_p.


	Deprecate direct access to scm_ceval, scm_deval and scm_ceval_ptr:

	* eval.h (scm_ceval, scm_deval, scm_ceval_ptr), debug.h
	(scm_ceval_ptr): Deprecated.  Moved declaration of scm_ceval_ptr
	from debug.h to eval.h.

	* debug.h (SCM_RESET_DEBUG_MODE): Don't access scm_ceval_ptr any
	more, just leave it with setting scm_debug_mode_p, which is
	equivalent for practical purposes.

	* deprecated.h (SCM_XEVAL, SCM_XEVALCAR): Call scm_i_eval_x
	instead of *scm_ceval_ptr.  Leave all evaluating to scm_i_eval_x.

	* gdbint.c (gdb_eval): Call scm_i_eval_x instead of scm_ceval.

	* eval.c (ceval, deval, scm_ceval, scm_deval): Made scm_ceval
	static and renamed it to ceval throughout.  Provide a new exported
	but deprecated function scm_ceval as a wrapper for backwards
	compatibility.  The same is done for the deval/scm_deval pair of
	functions.

	* eval.c (CEVAL, SCM_CEVAL): Renamed SCM_CEVAL to CEVAL
	throughout.  Defined CEVAL to ceval or deval, based on compilation
	phase.

	* eval.c (SCM_XEVAL, SCM_XEVALCAR): Dispatch on scm_debug_mode_p
	to ceval and deval instead of calling *scm_ceval_ptr.

	* eval.c (dispatching_eval): New deprecated static function.

	* eval.c (scm_ceval_ptr): Initialized to dispatching_eval in order
	to emulate its old behaviour as closely as possible.


	Change the evaluator such that only expressions for which pair? is
	true are passed to CEVAL, and such that all other expressions are
	evaluated outside of CEVAL:

	* eval.c (EVAL): New, provided in analogy to EVALCAR.  Evaluate an
	expression that is assumed to be memoized already.  All but
	expressions of the form '(<form> <form> ...)' are evaluated inline
	without calling an evaluator.

	* eval.c (SCM_XEVAL, SCM_XEVALCAR, EVALCAR): Evaluate all but
	expressions of the form '(<form> <form> ...)' inline without
	calling an evaluator.

	* eval.c (scm_i_eval_x, scm_i_eval, scm_ceval, scm_deval): Handle
	the special case of unmemoized symbols passed on the top level.

	* eval.c (CEVAL): Change calls to CEVAL to EVAL, except where it
	is known that the expression passed to CEVAL is of the form
	'(<form> <form> ...)'.  Remove handling of the tc7-objects, since
	now it is known that the input expression of CEVAL is a pair.
2004-03-29 19:59:43 +00:00
Dirk Herrmann
5fb6438380 * eval.c (is_self_quoting_p): New static function.
(scm_m_quote): Use is_self_quoting_p.

	(copy_tree): Corrected typo in comment.
2004-03-29 08:24:57 +00:00
Han-Wen Nienhuys
bfefbf18db * eval.c (s_scm_copy_tree): idem.
* list.c (s_scm_filter): remove "pointer" from doc string.
2004-03-28 13:57:19 +00:00
Dirk Herrmann
62360b8975 * libguile/eval.c: Separated some definitions relevant for execution
from the memoization part of the file.

	(copy_tree): New static function

	(scm_copy_tree): Rewritten to fix two kinds or bugs: First, cyclic
	structures are detected now and will lead to an exception instead
	of forcing guile to run in an endless loop, using up all the
	system's memory.  Second, arrays in the cdr of an improper list
	are now copied.  See the new test cases in eval.test.

	* test-suite/tests/eval.test: Added tests which reflect the recent
	fixes to copy-tree.
2004-03-24 01:21:50 +00:00
Marius Vollmer
fc22b297fc (scm_ceval, scm_deval): Explicitely evaluate ports to themselves.
Thanks to Han-Wen Nienhuys!
2004-03-21 00:30:12 +00:00
Han-Wen Nienhuys
f62b9dff21 (m_expand_body): remove stray variable new_body. 2004-01-22 23:14:09 +00:00
Marius Vollmer
9d4bf6d39a (m_expand_body): Rewrite the expression in place (by overwriting
FORMS) also when a letrec is constructed, not only when no definitions
are found.  Do not return rewritten expression to emphasize the
in-place rewriting.  Changed all users.
2004-01-22 22:42:29 +00:00
Dirk Herrmann
6bff13687c * eval.c (s_bad_define): New static identifier.
(m_body): Fixed comment.

	(scm_m_define): Don't generate memoized code for definitions that
	are not on the top level.  As a consequence, no memoized code at
	all is generated for definitions any more: Top level definitions
	are executed immediately during memoization and internal
	definitions are handled separately in m_expand_body.

	(scm_unmemocopy, unmemocopy): Removed code for unmemoizing
	definitions.  Consequently, there is no unmemoizing code any more
	that might modify the environment.  Thus, the old scm_unmemocopy
	is removed and the old unmemocopy is renamed to scm_unmemocopy.

	(SCM_CEVAL): The SCM_IM_DEFINE keyword can no longer occur in
	memoized code.  Call EVALCAR for continuations.  Prefer !SCM_NULLP
	over SCM_NIMP in places, where the argument is known to be part of
	a proper list.
2003-11-21 23:21:34 +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
6d1a2e9f4b (scm_m_generalized_set_x): Macroexpand the target when it
is a list.  This allows (@ ...) to work with set!.
(scm_m_generalized_set_x): Use ASSERT_SYNTAX_2 instead of
SCM_ASSYNT.
2003-11-17 16:52:05 +00:00
Marius Vollmer
7893dbbf45 (scm_m_generalized_set_x): Macroexpand the target when it is a list.
This allows (@ ...) to work with set!.
2003-11-17 00:24:48 +00:00
Dirk Herrmann
461bffb131 * eval.c (scm_m_letstar): Create memoized code in place to
minimize consing.
2003-11-16 13:32:02 +00:00
Dirk Herrmann
6f81708ae0 * eval.c (s_splicing): Commented and reformulated.
(lookup_global_symbol, lookup_symbol): New static functions.

	(s_test, s_bindings, s_duplicate_bindings, s_variable): Removed.

	(try_macro_lookup, literal_p): Use lookup_symbol instead of
	creating a temporary pair for scm_lookupcar.

	(scm_unmemocar, unmemocar): Renamed scm_unmemocar to unmemocar,
	created deprecated wrapper function scm_unmemocar.

	(SCM_VALIDATE_NON_EMPTY_COMBINATION, scm_sym_else,
	scm_sym_unquote, scm_sym_uq_splicing, scm_sym_enter_frame,
	scm_sym_apply_frame, scm_sym_exit_frame, scm_sym_trace, f_apply,
	undefineds, sym_three_question_marks): Moved around without
	modifications.

	* eval.c, eval.h (scm_macroexp, scm_unmemocar): Deprecated.
2003-11-16 10:47:45 +00:00
Dirk Herrmann
910b512506 * eval.c (try_macro_lookup, expand_user_macros, is_system_macro_p,
m_expand_body, scm_m_expand_body): Grouped together with m_body.
	No further modifications.
2003-11-15 12:43:00 +00:00
Dirk Herrmann
c86c440b17 * libguile/eval.c (s_mixed_body_forms): New static identifier.
(canonicalize_define, scm_m_define): The check for a bad
	expression is performed in canonicalize_define now.

	(try_macro_lookup, expand_user_macros, is_system_macro_p): New
	static helper functions for m_expand_body.

	(m_expand_body): Use ASSERT_SYNTAX to signal syntax errors.  Only
	expand user defined macros.  Fixed handling of the definition/
	expression boundary.  Fixed handling of definitions grouped with
	'begin.  Use canonicalize_define to expand definitions.

	* test-suite/tests/syntax.test: Tests that check for the correct
	handling of internal defines with begin work now.
2003-11-15 12:27:54 +00:00
Dirk Herrmann
430b840193 * eval.c (scm_m_body, m_body, scm_m_lambda, memoize_named_let,
scm_m_let, scm_m_letrec, m_expand_body): Renamed static function
	scm_m_body to m_body.
2003-11-09 08:47:19 +00:00
Dirk Herrmann
328dc9a3ef * eval.c, eval.h (scm_m_expand_body, m_expand_body): Deprecated
public use of scm_m_expand_body in eval.h.  In eval.c, renamed
	scm_m_expand_body to m_expand_body and made it static.  Added
	deprecated wrapper scm_m_expand_body.

	(scm_eval_body, SCM_CEVAL, SCM_APPLY): Use m_expand_body instead
	of scm_m_expand_body.
2003-11-09 08:10:58 +00:00
Dirk Herrmann
ced8edb0f9 * libguile/eval.c (s_missing_body_expression): New static identifier.
(s_body): Removed.

	(scm_m_expand_body): Fixed core dump when passing a body with
	defines, but without expressions (see additions to syntax.test).
	Use ASSERT_SYNTAX to signal syntax errors.

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

	Renamed section 'define' to 'top-level define' and added a new
	section 'internal define' with some tests.
2003-11-08 08:11:14 +00:00
Dirk Herrmann
0f572ba764 * eval.c (canonicalize_define): New static helper function.
(memoize_define, canonicalize_define): Extract handling of
	function currying to canonicalize_define.
2003-11-02 11:39:35 +00:00
Dirk Herrmann
2510c81061 * eval.c (scm_trampoline_0, scm_trampoline_1, scm_trampoline_2):
Make sure that error checking in debug mode is not worse than in
	standard mode.
2003-11-02 10:48:10 +00:00
Dirk Herrmann
34adf7eaf2 * eval.c (scm_m_body, scm_m_lambda): Documentation strings are not
handled in scm_m_body any more, but rather in scm_m_lambda.

	(scm_m_body, memoize_named_let, scm_m_let, scm_m_letstar,
	scm_m_letrec, scm_m_expand_body): Check for validity is done by
	calling functions of scm_m_body.

	(scm_m_lambda): Avoid unnecessary consing when creating the
	memoized code.
2003-11-01 10:21:15 +00:00
Dirk Herrmann
89bff2fc10 * libguile/eval.c (s_expression): Added comment.
(s_empty_combination, error_unbound_variable): New static
	identifiers.

	(SCM_VALIDATE_NON_EMPTY_COMBINATION, SCM_EVALIM2, scm_lookupcar1):
	Use ASSERT_SYNTAX, syntax_error or error_unbound_variable to
	signal syntax errors.

	(SCM_CEVAL): Separated handling of evaluator bytecodes and other
	scheme objects.

	* test-suite/tests/syntax.test (exception:missing/extra-expr-misc):
	Removed.

	(exception:illegal-empty-combination): New.

	(exception:missing/extra-expr): Unified capitalization.

	Adapted test for '()' to the new way of error reporting.
2003-11-01 07:26:44 +00:00
Dirk Herrmann
60a4984209 * eval.c (unmemocar, sym_three_question_marks, scm_unmemocar):
Grouped together with unmemocopy, without modifications.

	(build_binding_list, unmemocopy): Renamed names of list arguments
	and variables to reflect the actual order of the list elements.
2003-10-25 07:00:50 +00:00
Dirk Herrmann
70c1c10864 * eval.c (s_defun): New static identifier.
(scm_m_nil_cond, scm_m_atfop, scm_m_undefine): Add comments.  Use
	ASSERT_SYNTAX to signal syntax errors.  Avoid unnecessary consing
	when creating the memoized code.
2003-10-22 20:16:41 +00:00
Dirk Herrmann
9a848baf55 * eval.c (s_bad_slot_number): New static identifier.
(scm_m_atslot_ref, scm_m_atslot_set_x): Use ASSERT_SYNTAX to
	signal syntax errors.  Avoid unnecessary consing when creating the
	memoized code.
2003-10-18 19:03:24 +00:00
Dirk Herrmann
da48db629c * libguile/eval.c (scm_m_cont, scm_m_at_call_with_values,
scm_m_generalized_set_x): Use ASSERT_SYNTAX to signal syntax
	errors.  Avoid unnecessary consing when creating the memoized
	code.

	(scm_m_generalized_set_x): Let scm_m_set_x handle the R5RS
	standard case.  Make sure line and file information are copied to
	every created expression.

	* test-suite/tests/syntax.test (exception:bad-var): Removed.

	Adapted tests for 'set!' to the new way of error reporting.
2003-10-18 18:26:43 +00:00
Dirk Herrmann
82b3e2c612 * libguile/eval.c (scm_m_set_x, scm_m_apply, scm_m_atbind): Use
ASSERT_SYNTAX to signal syntax errors.  Avoid unnecessary consing
	when creating the memoized code.

	(scm_m_atbind): Reversed the order, in which the init expressions
	are stored and executed.  The order of execution is now equal to
	the order in which the initializers of the let-forms are executed.
	Use check_bindings and transform_bindings.

	(SCM_CEVAL): Eliminated SCM_NIMP in favor of more appropriate
	!SCM_NULLP.  Added some comments.

	* test-suite/tests/dynamic-scope.test (exception:missing-expr):
	Introduced temporarily until all memoizers use the new way of error
	reporting.
2003-10-18 17:24:09 +00:00
Dirk Herrmann
216286857b * libguile/eval.c: Sorted include files alphabetically.
(scm_m_begin): Added comment.

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

	(iqq, scm_m_quasiquote, scm_m_quote): Use ASSERT_SYNTAX to signal
	syntax errors.  Be more specific about the kind of error that was
	detected.

	(scm_m_quote, unmemocopy): As an optimization, vector constants
	are now inserted unquoted into the memoized code.  During
	unmemoization the quotes are added again to provide syntactically
	correct code.

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

	(exception:missing/extra-expr-syntax,
	exception:missing/extra-expr): Renamed
	exception:missing/extra-expr-syntax to
	exception:missing/extra-expr.
2003-10-18 14:49:55 +00:00
Dirk Herrmann
d6754c2398 * libguile/eval.c (scm_m_let, scm_m_letstar, scm_m_letrec,
scm_m_expand_body, check_bindings): Extracted syntax checking of
	bindings to new static function check_bindings.

	(scm_m_let, memoize_named_let): Extracted handling of named let to
	new static function memoize_named_let.

	(transform_bindings, scm_m_let, scm_m_letstar, scm_m_letrec): 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.

	* test-suite/lib.scm (exception:bad-variable): New.

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

	(exception:duplicate-bindings): Removed.

	Adapted tests for 'let', 'let*' and 'letrec' to the new way of
	error reporting.
2003-10-18 12:07:39 +00:00
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
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
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
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
Dirk Herrmann
f5c6ec2fb0 * test-suite/tests/chars.test: Fixed test comment. The bug that
this test detects was actually introduced by my patch from
	2003-05-31.

	* libguile/eval.c: Partially undid my patch from 2003-05-31.  This
	patch caused the segfault referenced in the previous changelog
	entry.
2003-06-04 23:50:13 +00:00
Dirk Herrmann
47dbd81e77 * test-suite/tests/chars.test: Added test, attempting to apply a
character.  This test will only pass if the other changes that are
	submitted together with this patch are also applied.

	* libguile/tags.h: Fixed comment about the immediate type code
	layout.

	* libguile/eval.c: Fixed handling of non-special instructions.
	Without this patch, guile will segfault on (#\0) and similar
	instructions.
2003-06-04 23:22:54 +00:00
Dirk Herrmann
d0624e391b * __scm.h, gc-card.c (SCM_DEBUG_DEBUGGER_SUPPORT,
SCM_DEBUG_DEBUGGING_SUPPORT): Renamed macro
	SCM_DEBUG_DEBUGGER_SUPPORT to SCM_DEBUG_DEBUGGING_SUPPORT and
	generalized it to apply not only to C level functions but also to
	scheme level functions.

	* debug.c, debug.h, eval.c (make-iloc, scm_make_iloc, iloc?,
	scm_iloc_p, dbg-make-iloc, scm_dbg_make_iloc, dbg-iloc?,
	scm_dbg_iloc_p): Moved functions scm_make_iloc, scm_iloc_p to
	eval.c, made them available under SCM_DEBUG_DEBUGGING_SUPPORT == 1
	only and renamed them to scm_dbg_make_iloc, scm_dbg_iloc_p,
	respectively.

	* deprecated.h, eval.c, eval.h (SCM_ILOC00, SCM_IDINC,
	SCM_IDSTMSK): Deprecated.  The macro definitions are moved from
	eval.h into eval.c and a copy is placed into deprecated.h.

	* eval.c, eval.h (SCM_MAKE_ILOC): Removed from eval.h and placed
	into eval.c. This definition was not part of the API in any
	officially released version of guile and thus does not need to go
	through a phase of deprecation.
2003-06-04 05:28:34 +00:00
Dirk Herrmann
e90c3a895d * deprecated.c, deprecated.h, eval.c, eval.h: Deprecated
scm_s_expression, scm_s_test, scm_s_body, scm_s_bindings,
	scm_s_variable, scm_s_clauses, scm_s_formals.  In eval.c the
	definitions are make static and renamed from scm_s_xxx to s_xxx.
	In deprecated.c the original definitions are copied.

	* deprecated.h, eval.c, eval: Deprecated SCM_EVALIM2, SCM_EVALIM,
	SCM_XEVAL and SCM_XEVALCAR.  The macro definitions are moved from
	eval.h into eval.c and a copy (slightly modified to work in user
	code) is placed into deprecated.h.

	* eval.c: Use the local static s_xxx definitions instead of the
	scm_s_xxx definitions throughout.
2003-06-02 20:54:21 +00:00