diff options
author | Andy Wingo <wingo@pobox.com> | 2011-10-10 16:20:08 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-10-10 16:20:08 +0200 |
commit | a215c1591351b9c8099c833361520c174d490cd4 (patch) | |
tree | 7d672d4a510f46b21bee1a3c43ea7bbba41a5d5c /libguile | |
parent | 840cf0d1e2bb3b019210958056404f29347042fe (diff) | |
parent | 34c5fe83c021eb27c5bdff0f1328c733a7cb45b4 (diff) | |
download | guile-a215c1591351b9c8099c833361520c174d490cd4.tar.gz |
Merge remote-tracking branch 'origin/stable-2.0'
Does not include psyntax regeneration.
Conflicts:
module/ice-9/psyntax-pp.scm
module/language/tree-il/peval.scm
test-suite/tests/tree-il.test
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/numbers.c | 10 | ||||
-rw-r--r-- | libguile/numbers.h | 2 | ||||
-rw-r--r-- | libguile/read.c | 41 |
3 files changed, 32 insertions, 21 deletions
diff --git a/libguile/numbers.c b/libguile/numbers.c index a278ed5b9..19673b84a 100644 --- a/libguile/numbers.c +++ b/libguile/numbers.c @@ -536,6 +536,11 @@ SCM_PRIMITIVE_GENERIC (scm_exact_p, "exact?", 1, 0, 0, } #undef FUNC_NAME +int +scm_is_exact (SCM val) +{ + return scm_is_true (scm_exact_p (val)); +} SCM_PRIMITIVE_GENERIC (scm_inexact_p, "inexact?", 1, 0, 0, (SCM x), @@ -552,6 +557,11 @@ SCM_PRIMITIVE_GENERIC (scm_inexact_p, "inexact?", 1, 0, 0, } #undef FUNC_NAME +int +scm_is_inexact (SCM val) +{ + return scm_is_true (scm_inexact_p (val)); +} SCM_PRIMITIVE_GENERIC (scm_odd_p, "odd?", 1, 0, 0, (SCM n), diff --git a/libguile/numbers.h b/libguile/numbers.h index d98583039..d3a344443 100644 --- a/libguile/numbers.h +++ b/libguile/numbers.h @@ -165,6 +165,7 @@ typedef struct scm_t_complex SCM_API SCM scm_exact_p (SCM x); +SCM_API int scm_is_exact (SCM x); SCM_API SCM scm_odd_p (SCM n); SCM_API SCM scm_even_p (SCM n); SCM_API SCM scm_finite_p (SCM x); @@ -241,6 +242,7 @@ SCM_API SCM scm_real_p (SCM x); SCM_API SCM scm_rational_p (SCM z); SCM_API SCM scm_integer_p (SCM x); SCM_API SCM scm_inexact_p (SCM x); +SCM_API int scm_is_inexact (SCM x); SCM_API SCM scm_num_eq_p (SCM x, SCM y); SCM_API SCM scm_less_p (SCM x, SCM y); SCM_API SCM scm_gr_p (SCM x, SCM y); diff --git a/libguile/read.c b/libguile/read.c index 0b7144c58..4b9c24864 100644 --- a/libguile/read.c +++ b/libguile/read.c @@ -1133,34 +1133,33 @@ scm_read_r6rs_block_comment (scm_t_wchar chr, SCM port) /* Unlike SCSH-style block comments, SRFI-30/R6RS block comments may be nested. So care must be taken. */ int nesting_level = 1; - int opening_seen = 0, closing_seen = 0; + + int a = scm_getc (port); + + if (a == EOF) + scm_i_input_error ("scm_read_r6rs_block_comment", port, + "unterminated `#| ... |#' comment", SCM_EOL); while (nesting_level > 0) { - int c = scm_getc (port); + int b = scm_getc (port); - if (c == EOF) + if (b == EOF) scm_i_input_error ("scm_read_r6rs_block_comment", port, "unterminated `#| ... |#' comment", SCM_EOL); - if (opening_seen) - { - if (c == '|') - nesting_level++; - opening_seen = 0; - } - else if (closing_seen) - { - if (c == '#') - nesting_level--; - closing_seen = 0; - } - else if (c == '|') - closing_seen = 1; - else if (c == '#') - opening_seen = 1; - else - opening_seen = closing_seen = 0; + if (a == '|' && b == '#') + { + nesting_level--; + b = EOF; + } + else if (a == '#' && b == '|') + { + nesting_level++; + b = EOF; + } + + a = b; } return SCM_UNSPECIFIED; |