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

4290 commits

Author SHA1 Message Date
Marius Vollmer
b645ea8c7e (scm_lreadr): Signal an error for invalid escape sequences in strings.
Code cleanups too.
2003-11-30 00:57:03 +00:00
Dirk Herrmann
5c26400756 * Forgot to submit the Changelog last time. 2003-11-21 23:28:15 +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
28a6e1b0b6 (scm_drain_input): Bug fix: only access the port after checking that
it indeed is one.
2003-11-21 17:08:31 +00:00
Kevin Ryde
018d4730fe *** empty log message *** 2003-11-21 00:45:07 +00:00
Kevin Ryde
7f84824269 (scm_bit_extract): Use mpz functions, rearrange inum case
to share some shifting.
2003-11-21 00:33:44 +00:00
Kevin Ryde
ae38324d9c (scm_abs): Allocate a new real only for negatives, as done for bignums. 2003-11-21 00:07:13 +00:00
Kevin Ryde
753ac1e7e1 (scm_integer_expt): Don't mpz_init after scm_i_clonebig or
scm_i_mkbig, since they do so already.  Don't mpz_clear a bignum SCM,
since gc does this.
2003-11-21 00:03:54 +00:00
Rob Browning
c412e408c5 (scm_system_star): new prototype. 2003-11-19 21:40:42 +00:00
Rob Browning
0db17ef9ab (scm_system_star): new function. 2003-11-19 21:40:32 +00:00
Marius Vollmer
fb16d26e23 *** empty log message *** 2003-11-19 05:13:53 +00:00
Marius Vollmer
c60e130c97 * numbers.c (scm_make_ratio): Rewritten to have a simpler
structure.  Previously, not all cases with a negative denominator
were covered.
2003-11-19 05:12:08 +00:00
Marius Vollmer
0b0c8e3b4c * numbers.c (scm_make_ratio): Don't declare divisible_p after
statements.
2003-11-19 04:30:40 +00:00
Marius Vollmer
4bca30d83a *** empty log message *** 2003-11-19 03:51:21 +00:00
Marius Vollmer
02164269a7 * numbers.c (scm_i_fraction_equalp): Do not treat the return value
of scm_equal_p as a C boolean, use SCM_FALSEP.  Previously, all
fractions were equal to each other regardless of value.  Ooops.

* numbers.c (scm_rationalize): Return an inexact result when given
inexact arguments.
2003-11-19 03:50:26 +00:00
Marius Vollmer
eb927cb95c * numbers.c (scm_exact_p, scm_inexact_p): Throw error for non-numbers. 2003-11-19 02:38:37 +00:00
Marius Vollmer
d8592269ab (mem2decimal_from_point): use scm_divide instead of scm_divide2real
when forming the fractional part.  This allows "#e1.2" to yield 6/5.
2003-11-19 02:19:03 +00:00
Marius Vollmer
bdf26b606b *** empty log message *** 2003-11-18 20:01:57 +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
Rob Browning
28fda54472 *** empty log message *** 2003-11-18 06:14:29 +00:00
Rob Browning
9ca20a9c88 * gen-scmconfig.c (main): remove public definition of
SCM_SIZEOF___INT64 and SCM_SIZEOF_UNSIGNED___INT64 and add
direct typedef of long_long and ulong_long inside deprecated block
when appropriate.
2003-11-18 06:10:39 +00:00
Rob Browning
1fe5648d31 move long_long and ulong_long definitions to
gen-scmconfig.c so that we don't need to add SCM_SIZEOF___INT64
and SCM_SIZEOF_UNSIGNED___INT64 to the public namespace.
2003-11-18 06:10:11 +00:00
Marius Vollmer
9a1d7d7c8b *** empty log message *** 2003-11-17 16:57:27 +00:00
Marius Vollmer
b4d5926184 (scm_string_hash): New hashing algorithm that takes the complete
string into account.
2003-11-17 16:56:48 +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
b58e742039 *** empty log message *** 2003-11-17 00:26:14 +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
Marius Vollmer
8b31d75b34 (scm_compile_shell_switches): Use scm_c_read_string for the "-e"
option instead of scm_str2symbol.  This allows things like (@ ...) to
be specified for the entry point.
2003-11-17 00:22:18 +00:00
Marius Vollmer
c62a38765d (scm_lreadr): detect EOF after backslash, and interpret \xNN
hexadecimal sequences.  From Paul Jarc, thanks!
2003-11-16 21:01:57 +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
Marius Vollmer
5df36eac84 *** empty log message *** 2003-11-13 19:41:12 +00:00
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
3890131acd *** empty log message *** 2003-11-13 18:23:06 +00:00
Marius Vollmer
fbff94c9c3 (scm_get_stack_base): Provide a definition that return NULL when the
machine type is unknown.  Previously, gc_os_dep.c would refuse to
compile.
2003-11-13 18:19:02 +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
Kevin Ryde
c2337a6178 *** empty log message *** 2003-11-08 22:19:24 +00:00
Kevin Ryde
4d3526d096 Add a copyright year. 2003-11-08 22:18:33 +00:00
Kevin Ryde
9e37591017 (scm_dynamic_unlink): Need scm_list_1 on error message
argument.  Reported by Mike Gran.
2003-11-08 22:18:01 +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
Kevin Ryde
0ee39677b9 *** empty log message *** 2003-10-19 00:49:36 +00:00