[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-135-g793e8
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-135-g793e8a9 |
Date: |
Thu, 09 Jan 2014 03:10:04 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=793e8a9317d24298c82389bdf86b8ca17b4ee2f0
The branch, stable-2.0 has been updated
via 793e8a9317d24298c82389bdf86b8ca17b4ee2f0 (commit)
via 900a897cd31df98df06b84a478b77a7438739b54 (commit)
via f659df44954a7f182361395396c5e0340b08c7dd (commit)
via 4101d14f2e8857cb50489a1027d853a1aa565239 (commit)
via 6146984cc5f5788836eca55c52bac66cb96ddc73 (commit)
via a662686a25df19970e15f3b642ab08db5128489b (commit)
via b6203a189ba9e3bc8d72529528ab75b62a2c46e1 (commit)
from 265e7bd92a3d8720ca94d64443878d309250ecba (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 793e8a9317d24298c82389bdf86b8ca17b4ee2f0
Author: Mark H Weaver <address@hidden>
Date: Wed Dec 25 05:10:19 2013 -0500
Fix 'string-copy!' to work properly with overlapping src/dest.
* libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with
overlapping src/dest.
* test-suite/tests/srfi-13.test ("string-copy!"): Add tests.
commit 900a897cd31df98df06b84a478b77a7438739b54
Author: Mark H Weaver <address@hidden>
Date: Fri Dec 20 18:12:37 2013 -0500
Implement 'exact-integer?' and 'scm_is_exact_integer'.
* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer):
New procedures.
(scm_integer_p): Improve docstring.
* libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer):
New prototypes.
* doc/ref/api-data.texi (Integers): Add docs.
* test-suite/tests/numbers.test ("exact-integer?"): Add tests.
commit f659df44954a7f182361395396c5e0340b08c7dd
Author: Mark H Weaver <address@hidden>
Date: Wed Jan 8 21:39:55 2014 -0500
Fix doc that incorrectly claimed (integer? +inf.0) => #t.
Fixes <http://bugs.gnu.org/16356>.
Reported by Zefram <address@hidden>.
* doc/ref/api-data.texi (Integers): Add docs. Fix outdated example
that incorrectly showed (integer? +inf.0) => #t.
commit 4101d14f2e8857cb50489a1027d853a1aa565239
Author: Mark H Weaver <address@hidden>
Date: Tue Dec 24 06:48:44 2013 -0500
scm_primitive_load: Simplify code using 'scm_open_file_with_encoding'.
* libguile/load.c (scm_primitive_load): Use
'scm_open_file_with_encoding'.
commit 6146984cc5f5788836eca55c52bac66cb96ddc73
Author: Mark H Weaver <address@hidden>
Date: Tue Dec 24 07:40:40 2013 -0500
boot-9: add comment about autoload thread-unsafety.
* module/ice-9/boot-9.scm: Add comment about lack of thread-safety in
handling of autoloads.
commit a662686a25df19970e15f3b642ab08db5128489b
Author: Mark H Weaver <address@hidden>
Date: Tue Dec 24 08:00:51 2013 -0500
read: Avoid signed integer overflow in 'read_decimal_integer'.
* libguile/read.c (read_decimal_integer): Avoid overflow.
commit b6203a189ba9e3bc8d72529528ab75b62a2c46e1
Author: Mark H Weaver <address@hidden>
Date: Tue Dec 24 14:39:44 2013 -0500
Increment SCM_N_READ_OPTIONS for 'curly-infix' option.
* libguile/private-options.h (SCM_N_READ_OPTIONS): Increment to 8.
This should have been done when the 'curly-infix' was added.
-----------------------------------------------------------------------
Summary of changes:
doc/ref/api-data.texi | 27 +++++++++++++++++++++++----
libguile/load.c | 15 +++++----------
libguile/numbers.c | 23 +++++++++++++++++++++--
libguile/numbers.h | 2 ++
libguile/private-options.h | 2 +-
libguile/read.c | 3 +++
libguile/srfi-13.c | 13 ++++++++++---
module/ice-9/boot-9.scm | 3 +++
test-suite/tests/numbers.test | 28 ++++++++++++++++++++++++++++
test-suite/tests/srfi-13.test | 15 ++++++++++++---
10 files changed, 108 insertions(+), 23 deletions(-)
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 096970c..fda76f1 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -1,7 +1,7 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007,
address@hidden 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation,
Inc.
address@hidden 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software
Foundation, Inc.
@c See the file guile.texi for copying conditions.
@node Simple Data Types
@@ -318,7 +318,8 @@ Scheme integers can be exact and inexact. For example, a
number
written as @code{3.0} with an explicit decimal-point is inexact, but
it is also an integer. The functions @code{integer?} and
@code{scm_is_integer} report true for such a number, but the functions
address@hidden and @code{scm_is_unsigned_integer} only
address@hidden, @code{scm_is_exact_integer},
address@hidden, and @code{scm_is_unsigned_integer} only
allow exact integers and thus report false. Likewise, the conversion
functions like @code{scm_to_signed_integer} only accept exact
integers.
@@ -333,7 +334,7 @@ will become exact fractions.)
@deffn {Scheme Procedure} integer? x
@deffnx {C Function} scm_integer_p (x)
Return @code{#t} if @var{x} is an exact or inexact integer number, else
address@hidden
+return @code{#f}.
@lisp
(integer? 487)
@@ -346,7 +347,7 @@ Return @code{#t} if @var{x} is an exact or inexact integer
number, else
@result{} #f
(integer? +inf.0)
address@hidden #t
address@hidden #f
@end lisp
@end deffn
@@ -354,6 +355,24 @@ Return @code{#t} if @var{x} is an exact or inexact integer
number, else
This is equivalent to @code{scm_is_true (scm_integer_p (x))}.
@end deftypefn
address@hidden {Scheme Procedure} exact-integer? x
address@hidden {C Function} scm_exact_integer_p (x)
+Return @code{#t} if @var{x} is an exact integer number, else
+return @code{#f}.
+
address@hidden
+(exact-integer? 37)
address@hidden #t
+
+(exact-integer? 3.0)
address@hidden #f
address@hidden lisp
address@hidden deffn
+
address@hidden {C Function} int scm_is_exact_integer (SCM x)
+This is equivalent to @code{scm_is_true (scm_exact_integer_p (x))}.
address@hidden deftypefn
+
@defvr {C Type} scm_t_int8
@defvrx {C Type} scm_t_uint8
@defvrx {C Type} scm_t_int16
diff --git a/libguile/load.c b/libguile/load.c
index c460725..fbbbae4 100644
--- a/libguile/load.c
+++ b/libguile/load.c
@@ -89,7 +89,6 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0,
{
SCM hook = *scm_loc_load_hook;
SCM ret = SCM_UNSPECIFIED;
- char *encoding;
SCM_VALIDATE_STRING (1, filename);
if (scm_is_true (hook) && scm_is_false (scm_procedure_p (hook)))
@@ -102,18 +101,14 @@ SCM_DEFINE (scm_primitive_load, "primitive-load", 1, 0, 0,
{
SCM port;
- port = scm_open_file (filename, scm_from_locale_string ("r"));
+ port = scm_open_file_with_encoding (filename,
+ scm_from_latin1_string ("r"),
+ SCM_BOOL_T, /* guess_encoding */
+ scm_from_latin1_string ("UTF-8"));
+
scm_dynwind_begin (SCM_F_DYNWIND_REWINDABLE);
scm_i_dynwind_current_load_port (port);
- encoding = scm_i_scan_for_encoding (port);
- if (encoding)
- scm_i_set_port_encoding_x (port, encoding);
- else
- /* The file has no encoding declared. We'll presume UTF-8, like
- compile-file does. */
- scm_i_set_port_encoding_x (port, "UTF-8");
-
while (1)
{
SCM reader, form;
diff --git a/libguile/numbers.c b/libguile/numbers.c
index 22b53a5..51e813a 100644
--- a/libguile/numbers.c
+++ b/libguile/numbers.c
@@ -6515,8 +6515,8 @@ SCM_DEFINE (scm_rational_p, "rational?", 1, 0, 0,
SCM_DEFINE (scm_integer_p, "integer?", 1, 0, 0,
(SCM x),
- "Return @code{#t} if @var{x} is an integer number, @code{#f}\n"
- "else.")
+ "Return @code{#t} if @var{x} is an integer number,\n"
+ "else return @code{#f}.")
#define FUNC_NAME s_scm_integer_p
{
if (SCM_I_INUMP (x) || SCM_BIGP (x))
@@ -6531,6 +6531,19 @@ SCM_DEFINE (scm_integer_p, "integer?", 1, 0, 0,
}
#undef FUNC_NAME
+SCM_DEFINE (scm_exact_integer_p, "exact-integer?", 1, 0, 0,
+ (SCM x),
+ "Return @code{#t} if @var{x} is an exact integer number,\n"
+ "else return @code{#f}.")
+#define FUNC_NAME s_scm_exact_integer_p
+{
+ if (SCM_I_INUMP (x) || SCM_BIGP (x))
+ return SCM_BOOL_T;
+ else
+ return SCM_BOOL_F;
+}
+#undef FUNC_NAME
+
SCM scm_i_num_eq_p (SCM, SCM, SCM);
SCM_PRIMITIVE_GENERIC (scm_i_num_eq_p, "=", 0, 2, 1,
@@ -9604,6 +9617,12 @@ scm_is_integer (SCM val)
}
int
+scm_is_exact_integer (SCM val)
+{
+ return scm_is_true (scm_exact_integer_p (val));
+}
+
+int
scm_is_signed_integer (SCM val, scm_t_intmax min, scm_t_intmax max)
{
if (SCM_I_INUMP (val))
diff --git a/libguile/numbers.h b/libguile/numbers.h
index 912f287..4d977dc 100644
--- a/libguile/numbers.h
+++ b/libguile/numbers.h
@@ -243,6 +243,7 @@ SCM_API SCM scm_complex_p (SCM x);
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_exact_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);
@@ -331,6 +332,7 @@ SCM_INTERNAL void scm_i_print_complex (double real, double
imag, SCM port);
/* conversion functions for integers */
SCM_API int scm_is_integer (SCM val);
+SCM_API int scm_is_exact_integer (SCM val);
SCM_API int scm_is_signed_integer (SCM val,
scm_t_intmax min, scm_t_intmax max);
SCM_API int scm_is_unsigned_integer (SCM val,
diff --git a/libguile/private-options.h b/libguile/private-options.h
index ed0f314..4f580a6 100644
--- a/libguile/private-options.h
+++ b/libguile/private-options.h
@@ -69,6 +69,6 @@ SCM_INTERNAL scm_t_option scm_read_opts[];
#define SCM_HUNGRY_EOL_ESCAPES_P scm_read_opts[6].val
#define SCM_CURLY_INFIX_P scm_read_opts[7].val
-#define SCM_N_READ_OPTIONS 7
+#define SCM_N_READ_OPTIONS 8
#endif /* PRIVATE_OPTIONS */
diff --git a/libguile/read.c b/libguile/read.c
index 299ab70..b36ecd4 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -1121,6 +1121,9 @@ read_decimal_integer (SCM port, int c, ssize_t *resp)
while ('0' <= c && c <= '9')
{
+ if (((SSIZE_MAX - (c-'0')) / 10) <= res)
+ scm_i_input_error ("read_decimal_integer", port,
+ "number too large", SCM_EOL);
res = 10*res + c-'0';
got_it = 1;
c = scm_getc (port);
diff --git a/libguile/srfi-13.c b/libguile/srfi-13.c
index 4e5d572..5c30dfe 100644
--- a/libguile/srfi-13.c
+++ b/libguile/srfi-13.c
@@ -546,10 +546,17 @@ SCM_DEFINE (scm_string_copy_x, "string-copy!", 3, 2, 0,
SCM_ASSERT_RANGE (3, s, len <= scm_i_string_length (target) - ctstart);
target = scm_i_string_start_writing (target);
- for (i = 0; i < cend - cstart; i++)
+ if (ctstart < cstart)
{
- scm_i_string_set_x (target, ctstart + i,
- scm_i_string_ref (s, cstart + i));
+ for (i = 0; i < len; i++)
+ scm_i_string_set_x (target, ctstart + i,
+ scm_i_string_ref (s, cstart + i));
+ }
+ else
+ {
+ for (i = len; i--;)
+ scm_i_string_set_x (target, ctstart + i,
+ scm_i_string_ref (s, cstart + i));
}
scm_i_string_stop_writing ();
scm_remember_upto_here_1 (target);
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 19c22ea..dbef75f 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -2961,6 +2961,9 @@ module '(ice-9 q) '(make-q q-length))}."
;;; {Autoloading modules}
;;;
+;;; XXX FIXME autoloads-in-progress and autoloads-done
+;;; are not handled in a thread-safe way.
+
(define autoloads-in-progress '())
;; This function is called from scm_load_scheme_module in
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index 16f06bf..e91bc52 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -1808,6 +1808,34 @@
(pass-if (not (integer? (current-input-port)))))
;;;
+;;; integer?
+;;;
+
+(with-test-prefix "exact-integer?"
+ (pass-if (documented? exact-integer?))
+ (pass-if (exact-integer? 0))
+ (pass-if (exact-integer? 7))
+ (pass-if (exact-integer? -7))
+ (pass-if (exact-integer? (+ 1 fixnum-max)))
+ (pass-if (exact-integer? (- 1 fixnum-min)))
+ (pass-if (and (= 1.0 (round 1.0))
+ (not (exact-integer? 1.0))))
+ (pass-if (not (exact-integer? 1.3)))
+ (pass-if (not (exact-integer? +inf.0)))
+ (pass-if (not (exact-integer? -inf.0)))
+ (pass-if (not (exact-integer? +nan.0)))
+ (pass-if (not (exact-integer? +inf.0-inf.0i)))
+ (pass-if (not (exact-integer? +nan.0+nan.0i)))
+ (pass-if (not (exact-integer? 3+4i)))
+ (pass-if (not (exact-integer? #\a)))
+ (pass-if (not (exact-integer? "a")))
+ (pass-if (not (exact-integer? (make-vector 0))))
+ (pass-if (not (exact-integer? (cons 1 2))))
+ (pass-if (not (exact-integer? #t)))
+ (pass-if (not (exact-integer? (lambda () #t))))
+ (pass-if (not (exact-integer? (current-input-port)))))
+
+;;;
;;; inexact?
;;;
diff --git a/test-suite/tests/srfi-13.test b/test-suite/tests/srfi-13.test
index de6df8e..a1bae7b 100644
--- a/test-suite/tests/srfi-13.test
+++ b/test-suite/tests/srfi-13.test
@@ -555,8 +555,7 @@
(string=? "o-bar" (string-copy "\u0100\u0101o-bar" 2)))
(pass-if "start and end index"
- (string=? "o-ba" (string-copy "foo-bar" 2 6)))
-)
+ (string=? "o-ba" (string-copy "foo-bar" 2 6))))
(with-test-prefix "substring/shared"
@@ -578,7 +577,17 @@
(let* ((s "hello")
(t (string-copy "world, oh yeah!")))
(string-copy! t 1 s 1 3)
- t))))
+ t)))
+
+ (pass-if-equal "overlapping src and dest, moving right"
+ "aabce"
+ (let ((str (string-copy "abcde")))
+ (string-copy! str 1 str 0 3) str))
+
+ (pass-if-equal "overlapping src and dest, moving left"
+ "bcdde"
+ (let ((str (string-copy "abcde")))
+ (string-copy! str 0 str 1 4) str)))
(with-test-prefix "string-take"
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-135-g793e8a9,
Mark H Weaver <=