mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Changes from arch/CVS synchronization
This commit is contained in:
parent
24d6fae831
commit
7337d56d57
8 changed files with 1065 additions and 693 deletions
|
@ -1,3 +1,7 @@
|
|||
2007-07-22 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* configure.in: Check for <strings.h> and `strncasecmp ()'.
|
||||
|
||||
2007-07-19 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* NEWS: Mention `(ice-9 i18n)' and lazy duplicate binding
|
||||
|
|
|
@ -546,7 +546,7 @@ AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h malloc.h memory.h proces
|
|||
regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
|
||||
sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
|
||||
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
|
||||
direct.h langinfo.h nl_types.h])
|
||||
strings.h direct.h langinfo.h nl_types.h])
|
||||
|
||||
# "complex double" is new in C99, and "complex" is only a keyword if
|
||||
# <complex.h> is included
|
||||
|
@ -638,7 +638,7 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
|
|||
# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
|
||||
# nl_langinfo - X/Open, not available on Windows.
|
||||
#
|
||||
AC_CHECK_FUNCS([DINFINITY DQNAN chsize clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strcoll strcoll_l newlocale nl_langinfo])
|
||||
AC_CHECK_FUNCS([DINFINITY DQNAN chsize clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe readdir_r readlink rename rmdir select setegid seteuid setlocale setpgid setsid sigaction siginterrupt stat64 strftime strptime symlink sync sysconf tcgetpgrp tcsetpgrp times uname waitpid strdup system usleep atexit on_exit chown link fcntl ttyname getpwent getgrent kill getppid getpgrp fork setitimer getitimer strchr strcmp index bcopy memcpy rindex truncate unsetenv isblank _NSGetEnviron strncasecmp strcoll strcoll_l newlocale nl_langinfo])
|
||||
|
||||
# Reasons for testing:
|
||||
# netdb.h - not in mingw
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
2007-07-22 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
Overhauled the reader, making it faster.
|
||||
|
||||
* gdbint.c (tok_buf, tok_buf_mark_p): Removed.
|
||||
(gdb_read): Don't use a token buffer. Use `scm_read ()' instead
|
||||
of `scm_lreadr ()'.
|
||||
|
||||
* read.c: Overhauled. No longer use a token buffer. Use a
|
||||
on-stack C buffer in the common case and use Scheme strings when
|
||||
larger buffers are needed.
|
||||
* read.h (scm_grow_tok_buf, scm_flush_ws, scm_casei_streq,
|
||||
scm_lreadr, scm_lreadrecparen): Removed.
|
||||
(scm_i_input_error): Marked as `SCM_NORETURN'.
|
||||
|
||||
2007-07-15 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* script.c (scm_compile_shell_switches): Updated copyright year.
|
||||
|
|
|
@ -103,9 +103,6 @@ int scm_print_carefully_p;
|
|||
static SCM gdb_input_port;
|
||||
static int port_mark_p, stream_mark_p, string_mark_p;
|
||||
|
||||
static SCM tok_buf;
|
||||
static int tok_buf_mark_p;
|
||||
|
||||
static SCM gdb_output_port;
|
||||
|
||||
|
||||
|
@ -184,10 +181,9 @@ gdb_read (char *str)
|
|||
scm_puts (str, gdb_input_port);
|
||||
scm_truncate_file (gdb_input_port, SCM_UNDEFINED);
|
||||
scm_seek (gdb_input_port, SCM_INUM0, scm_from_int (SEEK_SET));
|
||||
|
||||
/* Read one object */
|
||||
tok_buf_mark_p = SCM_GC_MARK_P (tok_buf);
|
||||
SCM_CLEAR_GC_MARK (tok_buf);
|
||||
ans = scm_lreadr (&tok_buf, gdb_input_port, &ans);
|
||||
ans = scm_read (gdb_input_port);
|
||||
if (SCM_GC_P)
|
||||
{
|
||||
if (SCM_NIMP (ans))
|
||||
|
@ -202,8 +198,6 @@ gdb_read (char *str)
|
|||
if (SCM_NIMP (ans))
|
||||
scm_permanent_object (ans);
|
||||
exit:
|
||||
if (tok_buf_mark_p)
|
||||
SCM_SET_GC_MARK (tok_buf);
|
||||
remark_port (gdb_input_port);
|
||||
SCM_END_FOREIGN_BLOCK;
|
||||
return status;
|
||||
|
@ -292,8 +286,6 @@ scm_init_gdbint ()
|
|||
SCM_OPN | SCM_RDNG | SCM_WRTNG,
|
||||
s);
|
||||
gdb_input_port = scm_permanent_object (port);
|
||||
|
||||
tok_buf = scm_permanent_object (scm_c_make_string (30, SCM_UNDEFINED));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
1459
libguile/read.c
1459
libguile/read.c
File diff suppressed because it is too large
Load diff
|
@ -53,16 +53,12 @@ SCM_API SCM scm_sym_dot;
|
|||
|
||||
SCM_API SCM scm_read_options (SCM setting);
|
||||
SCM_API SCM scm_read (SCM port);
|
||||
SCM_API char * scm_grow_tok_buf (SCM * tok_buf);
|
||||
SCM_API int scm_flush_ws (SCM port, const char *eoferr);
|
||||
SCM_API int scm_casei_streq (char * s1, char * s2);
|
||||
SCM_API SCM scm_lreadr (SCM * tok_buf, SCM port, SCM *copy);
|
||||
SCM_API size_t scm_read_token (int ic, SCM * tok_buf, SCM port, int weird);
|
||||
SCM_API SCM scm_lreadrecparen (SCM * tok_buf, SCM port, char *name, SCM *copy);
|
||||
SCM_API SCM scm_read_hash_extend (SCM chr, SCM proc);
|
||||
|
||||
SCM_API void scm_i_input_error (const char *func, SCM port,
|
||||
const char *message, SCM arg);
|
||||
const char *message, SCM arg)
|
||||
SCM_NORETURN;
|
||||
|
||||
SCM_API void scm_init_read (void);
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
2007-07-22 Ludovic Courtès <ludo@gnu.org>
|
||||
|
||||
* tests/reader.test: Added a proper header and `define-module'.
|
||||
(exception:unterminated-block-comment,
|
||||
exception:unknown-character-name,
|
||||
exception:unknown-sharp-object, exception:eof-in-string,
|
||||
exception:illegal-escape, with-read-options): New.
|
||||
(reading)[block comment, unprintable symbol]: New tests.
|
||||
(exceptions): New test prefix.
|
||||
(read-options): New test prefix.
|
||||
|
||||
2007-07-18 Stephen Compall <s11@member.fsf.org>
|
||||
|
||||
* tests/syntax.test: Add SRFI-61 `cond' tests.
|
||||
|
|
|
@ -1,15 +1,55 @@
|
|||
;;;; reader.test --- test the Guile parser -*- scheme -*-
|
||||
;;;; Jim Blandy <jimb@red-bean.com> --- September 1999
|
||||
;;;; reader.test --- Exercise the reader. -*- Scheme -*-
|
||||
;;;;
|
||||
;;;; Copyright (C) 1999, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
|
||||
;;;; Jim Blandy <jimb@red-bean.com>
|
||||
;;;;
|
||||
;;;; This library is free software; you can redistribute it and/or
|
||||
;;;; modify it under the terms of the GNU Lesser General Public
|
||||
;;;; License as published by the Free Software Foundation; either
|
||||
;;;; version 2.1 of the License, or (at your option) any later version.
|
||||
;;;;
|
||||
;;;; This library is distributed in the hope that it will be useful,
|
||||
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;;;; Lesser General Public License for more details.
|
||||
;;;;
|
||||
;;;; You should have received a copy of the GNU Lesser General Public
|
||||
;;;; License along with this library; if not, write to the Free Software
|
||||
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
(define-module (test-suite reader)
|
||||
:use-module (test-suite lib))
|
||||
|
||||
|
||||
(define exception:eof
|
||||
(cons 'read-error "end of file$"))
|
||||
|
||||
(define exception:unexpected-rparen
|
||||
(cons 'read-error "unexpected \")\"$"))
|
||||
(define exception:unterminated-block-comment
|
||||
(cons 'read-error "unterminated `#! ... !#' comment$"))
|
||||
(define exception:unknown-character-name
|
||||
(cons 'read-error "unknown character name .*$"))
|
||||
(define exception:unknown-sharp-object
|
||||
(cons 'read-error "Unknown # object: .*$"))
|
||||
(define exception:eof-in-string
|
||||
(cons 'read-error "end of file in string constant$"))
|
||||
(define exception:illegal-escape
|
||||
(cons 'read-error "illegal character in escape sequence: .*$"))
|
||||
|
||||
|
||||
(define (read-string s)
|
||||
(with-input-from-string s (lambda () (read))))
|
||||
|
||||
(define (with-read-options opts thunk)
|
||||
(let ((saved-options (read-options)))
|
||||
(dynamic-wind
|
||||
(lambda ()
|
||||
(read-options opts))
|
||||
thunk
|
||||
(lambda ()
|
||||
(read-options saved-options)))))
|
||||
|
||||
|
||||
(with-test-prefix "reading"
|
||||
(pass-if "0"
|
||||
(equal? (read-string "0") 0))
|
||||
|
@ -31,8 +71,18 @@
|
|||
(lambda (key subr message args rest)
|
||||
(apply format #f message args)
|
||||
;; message and args are ok
|
||||
#t))))
|
||||
#t)))
|
||||
|
||||
(pass-if "block comment"
|
||||
(equal? '(+ 1 2 3)
|
||||
(read-string "(+ 1 #! this is a\ncomment !# 2 3)")))
|
||||
|
||||
(pass-if "unprintable symbol"
|
||||
;; The reader tolerates unprintable characters for symbols.
|
||||
(equal? (string->symbol "\001\002\003")
|
||||
(read-string "\001\002\003"))))
|
||||
|
||||
|
||||
(pass-if-exception "radix passed to number->string can't be zero"
|
||||
exception:out-of-range
|
||||
(number->string 10 0))
|
||||
|
@ -40,6 +90,7 @@
|
|||
exception:out-of-range
|
||||
(number->string 10 1))
|
||||
|
||||
|
||||
(with-test-prefix "mismatching parentheses"
|
||||
(pass-if-exception "opening parenthesis"
|
||||
exception:eof
|
||||
|
@ -53,3 +104,53 @@
|
|||
(pass-if-exception "closing parenthesis following mismatched vector opening"
|
||||
exception:unexpected-rparen
|
||||
(read-string ")")))
|
||||
|
||||
|
||||
(with-test-prefix "exceptions"
|
||||
|
||||
;; Reader exceptions: although they are not documented, they may be relied
|
||||
;; on by some programs, hence these tests.
|
||||
|
||||
(pass-if-exception "unterminated block comment"
|
||||
exception:unterminated-block-comment
|
||||
(read-string "(+ 1 #! comment\n..."))
|
||||
(pass-if-exception "unknown character name"
|
||||
exception:unknown-character-name
|
||||
(read-string "#\\theunknowncharacter"))
|
||||
(pass-if-exception "unknown sharp object"
|
||||
exception:unknown-sharp-object
|
||||
(read-string "#?"))
|
||||
(pass-if-exception "eof in string"
|
||||
exception:eof-in-string
|
||||
(read-string "\"the string that never ends"))
|
||||
(pass-if-exception "illegal escape in string"
|
||||
exception:illegal-escape
|
||||
(read-string "\"some string \\???\"")))
|
||||
|
||||
|
||||
(with-test-prefix "read-options"
|
||||
(pass-if "case-sensitive"
|
||||
(not (eq? 'guile 'GuiLe)))
|
||||
(pass-if "case-insensitive"
|
||||
(eq? 'guile
|
||||
(with-read-options '(case-insensitive)
|
||||
(lambda ()
|
||||
(read-string "GuiLe")))))
|
||||
(pass-if "prefix keywords"
|
||||
(eq? #:keyword
|
||||
(with-read-options '(keywords prefix case-insensitive)
|
||||
(lambda ()
|
||||
(read-string ":KeyWord")))))
|
||||
(pass-if "no positions"
|
||||
(let ((sexp (with-read-options '()
|
||||
(lambda ()
|
||||
(read-string "(+ 1 2 3)")))))
|
||||
(and (not (source-property sexp 'line))
|
||||
(not (source-property sexp 'column)))))
|
||||
(pass-if "positions"
|
||||
(let ((sexp (with-read-options '(positions)
|
||||
(lambda ()
|
||||
(read-string "(+ 1 2 3)")))))
|
||||
(and (equal? (source-property sexp 'line) 0)
|
||||
(equal? (source-property sexp 'column) 0)))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue