mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts: GUILE-VERSION libguile/gc-malloc.c libguile/ports.c
This commit is contained in:
commit
0858753e82
147 changed files with 19590 additions and 6327 deletions
19
NEWS
19
NEWS
|
@ -5,6 +5,13 @@ See the end for copying conditions.
|
||||||
Please send Guile bug reports to bug-guile@gnu.org.
|
Please send Guile bug reports to bug-guile@gnu.org.
|
||||||
|
|
||||||
|
|
||||||
|
Changes in 2.0.5 (since 2.0.4):
|
||||||
|
|
||||||
|
This release fixes the binary interface information (SONAME) of
|
||||||
|
libguile, which was incorrect in 2.0.4. It does not contain other
|
||||||
|
changes.
|
||||||
|
|
||||||
|
|
||||||
Changes in 2.0.4 (since 2.0.3):
|
Changes in 2.0.4 (since 2.0.3):
|
||||||
|
|
||||||
* Notable changes
|
* Notable changes
|
||||||
|
@ -124,6 +131,11 @@ This procedure initializes a random seed using good random sources
|
||||||
available on your platform, such as /dev/urandom. See "Random Number
|
available on your platform, such as /dev/urandom. See "Random Number
|
||||||
Generation" in the manual, for more.
|
Generation" in the manual, for more.
|
||||||
|
|
||||||
|
** Warn about unsupported `simple-format' options.
|
||||||
|
|
||||||
|
The `-Wformat' compilation option now reports unsupported format options
|
||||||
|
passed to `simple-format'.
|
||||||
|
|
||||||
** Manual updates
|
** Manual updates
|
||||||
|
|
||||||
Besides the sections already mentioned, the following manual sections
|
Besides the sections already mentioned, the following manual sections
|
||||||
|
@ -158,7 +170,6 @@ Search the manual for these identifiers and modules, for more.
|
||||||
** Add deprecated shim for `scm_display_error' with stack as first argument.
|
** Add deprecated shim for `scm_display_error' with stack as first argument.
|
||||||
** Add warnings for unsupported `simple-format' options.
|
** Add warnings for unsupported `simple-format' options.
|
||||||
** Allow overlapping regions to be passed to `bytevector-copy!'.
|
** Allow overlapping regions to be passed to `bytevector-copy!'.
|
||||||
** Avoid calling `u32_conv_from_encoding' on the null string.
|
|
||||||
** Better function prologue disassembly
|
** Better function prologue disassembly
|
||||||
** Compiler: fix miscompilation of (values foo ...) in some contexts.
|
** Compiler: fix miscompilation of (values foo ...) in some contexts.
|
||||||
** Compiler: fix serialization of #nil-terminated lists.
|
** Compiler: fix serialization of #nil-terminated lists.
|
||||||
|
@ -168,12 +179,10 @@ Search the manual for these identifiers and modules, for more.
|
||||||
** Don't leak file descriptors when mmaping objcode.
|
** Don't leak file descriptors when mmaping objcode.
|
||||||
** Empty substrings no longer reference the original stringbuf.
|
** Empty substrings no longer reference the original stringbuf.
|
||||||
** FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged.
|
** FFI: Fix `set-pointer-finalizer!' to leave the type cell unchanged.
|
||||||
** FFI: Fix signed/unsigned pointer mismatches in implementation.
|
|
||||||
** FFI: Hold a weak reference to the CIF made by `procedure->pointer'.
|
** FFI: Hold a weak reference to the CIF made by `procedure->pointer'.
|
||||||
** FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
|
** FFI: Hold a weak reference to the procedure passed to `procedure->pointer'.
|
||||||
** FFI: Properly unpack small integer return values in closure call.
|
** FFI: Properly unpack small integer return values in closure call.
|
||||||
** Fix R6RS `fold-left' so the accumulator is the first argument.
|
** Fix R6RS `fold-left' so the accumulator is the first argument.
|
||||||
** Fix `validate-target' in (system base target).
|
|
||||||
** Fix bit-set*! bug from 2005.
|
** Fix bit-set*! bug from 2005.
|
||||||
** Fix bug in `make-repl' when `lang' is actually a <language>.
|
** Fix bug in `make-repl' when `lang' is actually a <language>.
|
||||||
** Fix bugs related to mutation, the null string, and shared substrings.
|
** Fix bugs related to mutation, the null string, and shared substrings.
|
||||||
|
@ -188,19 +197,17 @@ Search the manual for these identifiers and modules, for more.
|
||||||
** HTTP: Permit non-date values for Expires header.
|
** HTTP: Permit non-date values for Expires header.
|
||||||
** HTTP: `write-request-line' writes absolute paths, not absolute URIs.
|
** HTTP: `write-request-line' writes absolute paths, not absolute URIs.
|
||||||
** Hack the port-column of current-output-port after printing a prompt.
|
** Hack the port-column of current-output-port after printing a prompt.
|
||||||
** Have `cpu-word-size' error out on unknown CPUs; add support for MIPSEL.
|
|
||||||
** Make sure `regexp-quote' tests use Unicode-capable string ports.
|
** Make sure `regexp-quote' tests use Unicode-capable string ports.
|
||||||
** Peval: Fix bugs in the new optimizer.
|
** Peval: Fix bugs in the new optimizer.
|
||||||
** Peval: fold (values FOO) to FOO in more cases
|
|
||||||
** Statistically unique marks and labels, for robust hygiene across sessions.
|
** Statistically unique marks and labels, for robust hygiene across sessions.
|
||||||
** Web: Allow URIs with empty authorities, like "file:///etc/hosts".
|
** Web: Allow URIs with empty authorities, like "file:///etc/hosts".
|
||||||
** `,language' at REPL sets the current-language fluid.
|
** `,language' at REPL sets the current-language fluid.
|
||||||
** `primitive-load' returns the value(s) of the last expression.
|
** `primitive-load' returns the value(s) of the last expression.
|
||||||
** `scm_from_stringn' always returns unique strings.
|
** `scm_from_stringn' always returns unique strings.
|
||||||
** `scm_i_substring_copy' tries to narrow the substring.
|
** `scm_i_substring_copy' tries to narrow the substring.
|
||||||
** guile-readline: Clean `.go' files.
|
|
||||||
** i18n: Fix gc_malloc/free mismatch on non-GNU systems.
|
** i18n: Fix gc_malloc/free mismatch on non-GNU systems.
|
||||||
|
|
||||||
|
|
||||||
Changes in 2.0.3 (since 2.0.2):
|
Changes in 2.0.3 (since 2.0.2):
|
||||||
|
|
||||||
* Speed improvements
|
* Speed improvements
|
||||||
|
|
|
@ -614,7 +614,8 @@ AC_DEFUN([gl_CLOCK_TIME],
|
||||||
AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
|
AC_SEARCH_LIBS([clock_getcpuclockid], [rt posix4],
|
||||||
[test "$ac_cv_search_clock_getcpuclockid" = "none required" \
|
[test "$ac_cv_search_clock_getcpuclockid" = "none required" \
|
||||||
|| LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
|
|| LIB_CLOCK_GETTIME=$ac_cv_search_clock_getcpuclockid],
|
||||||
[LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
|
[test "$ac_cv_search_clock_gettime" = "none required" \
|
||||||
|
|| LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
|
||||||
else
|
else
|
||||||
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
|
LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
|
||||||
fi])
|
fi])
|
||||||
|
|
40
configure.ac
40
configure.ac
|
@ -5,7 +5,7 @@ dnl
|
||||||
define(GUILE_CONFIGURE_COPYRIGHT,[[
|
define(GUILE_CONFIGURE_COPYRIGHT,[[
|
||||||
|
|
||||||
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
|
||||||
2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GUILE
|
This file is part of GUILE
|
||||||
|
|
||||||
|
@ -652,24 +652,13 @@ AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64])
|
||||||
# machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in
|
# machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in
|
||||||
# this file instead of <fenv.h>
|
# this file instead of <fenv.h>
|
||||||
# process.h - mingw specific
|
# process.h - mingw specific
|
||||||
# langinfo.h, nl_types.h - SuS v2
|
|
||||||
# sched.h - missing on MinGW
|
# sched.h - missing on MinGW
|
||||||
#
|
#
|
||||||
AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h memory.h process.h string.h \
|
AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h memory.h process.h string.h \
|
||||||
regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.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/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 \
|
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
|
||||||
direct.h langinfo.h nl_types.h machine/fpu.h poll.h sched.h])
|
direct.h machine/fpu.h poll.h sched.h])
|
||||||
|
|
||||||
# Reasons for testing:
|
|
||||||
# nl_item - lacking on Cygwin
|
|
||||||
AC_CHECK_TYPES([nl_item], [], [],
|
|
||||||
[[#ifdef HAVE_LANGINFO_H
|
|
||||||
# include <langinfo.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NL_TYPES_H
|
|
||||||
# include <nl_types.h>
|
|
||||||
#endif]])
|
|
||||||
|
|
||||||
# "complex double" is new in C99, and "complex" is only a keyword if
|
# "complex double" is new in C99, and "complex" is only a keyword if
|
||||||
# <complex.h> is included
|
# <complex.h> is included
|
||||||
|
@ -764,11 +753,10 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
|
||||||
# isblank - available as a GNU extension or in C99
|
# isblank - available as a GNU extension or in C99
|
||||||
# _NSGetEnviron - Darwin specific
|
# _NSGetEnviron - Darwin specific
|
||||||
# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
|
# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
|
||||||
# nl_langinfo - X/Open, not available on Windows.
|
|
||||||
# utimensat: posix.1-2008
|
# utimensat: posix.1-2008
|
||||||
# sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
|
# sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
|
||||||
#
|
#
|
||||||
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_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 utimensat sched_getaffinity sched_setaffinity])
|
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown getcwd geteuid getsid gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe poll readdir_r readdir64_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 utimensat sched_getaffinity sched_setaffinity])
|
||||||
|
|
||||||
# Reasons for testing:
|
# Reasons for testing:
|
||||||
# netdb.h - not in mingw
|
# netdb.h - not in mingw
|
||||||
|
@ -1112,24 +1100,8 @@ if test $guile_cv_localtime_cache = yes; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$enable_regex" = yes; then
|
if test "$enable_regex" = yes; then
|
||||||
if test "$ac_cv_header_regex_h" = yes ||
|
AC_LIBOBJ([regex-posix])
|
||||||
test "$ac_cv_header_rxposix_h" = yes ||
|
AC_DEFINE([ENABLE_REGEX], 1, [Define when regex support is enabled.])
|
||||||
test "$ac_cv_header_rx_rxposix_h" = yes; then
|
|
||||||
GUILE_NAMED_CHECK_FUNC(regcomp, norx, [AC_LIBOBJ([regex-posix])],
|
|
||||||
[AC_CHECK_LIB(rx, main)
|
|
||||||
GUILE_NAMED_CHECK_FUNC(regcomp, rx, [AC_LIBOBJ([regex-posix])],
|
|
||||||
[AC_CHECK_LIB(regex, main)
|
|
||||||
GUILE_NAMED_CHECK_FUNC(regcomp, regex, [AC_LIBOBJ([regex-posix])])])]
|
|
||||||
)
|
|
||||||
dnl The following should not be necessary, but for some reason
|
|
||||||
dnl autoheader misses it if we don't include it!
|
|
||||||
if test "$ac_cv_func_regcomp_norx" = yes ||
|
|
||||||
test "$ac_cv_func_regcomp_regex" = yes ||
|
|
||||||
test "$ac_cv_func_regcomp_rx" = yes; then
|
|
||||||
AC_DEFINE([HAVE_REGCOMP], 1,
|
|
||||||
[This is included as part of a workaround for a autoheader bug.])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_REPLACE_FUNCS([strerror memmove mkstemp])
|
AC_REPLACE_FUNCS([strerror memmove mkstemp])
|
||||||
|
|
|
@ -326,7 +326,7 @@ the last pair of the list.
|
||||||
@c no-op since it does nothing but return the list the caller must
|
@c no-op since it does nothing but return the list the caller must
|
||||||
@c have already created.
|
@c have already created.
|
||||||
@c
|
@c
|
||||||
@deffn {Scheme Procedure} list elem1 @dots{} elemN
|
@deffn {Scheme Procedure} list elem @dots{}
|
||||||
@deffnx {C Function} scm_list_1 (elem1)
|
@deffnx {C Function} scm_list_1 (elem1)
|
||||||
@deffnx {C Function} scm_list_2 (elem1, elem2)
|
@deffnx {C Function} scm_list_2 (elem1, elem2)
|
||||||
@deffnx {C Function} scm_list_3 (elem1, elem2, elem3)
|
@deffnx {C Function} scm_list_3 (elem1, elem2, elem3)
|
||||||
|
@ -334,11 +334,11 @@ the last pair of the list.
|
||||||
@deffnx {C Function} scm_list_5 (elem1, elem2, elem3, elem4, elem5)
|
@deffnx {C Function} scm_list_5 (elem1, elem2, elem3, elem4, elem5)
|
||||||
@deffnx {C Function} scm_list_n (elem1, @dots{}, elemN, @nicode{SCM_UNDEFINED})
|
@deffnx {C Function} scm_list_n (elem1, @dots{}, elemN, @nicode{SCM_UNDEFINED})
|
||||||
@rnindex list
|
@rnindex list
|
||||||
Return a new list containing elements @var{elem1} to @var{elemN}.
|
Return a new list containing elements @var{elem} @enddots{}.
|
||||||
|
|
||||||
@code{scm_list_n} takes a variable number of arguments, terminated by
|
@code{scm_list_n} takes a variable number of arguments, terminated by
|
||||||
the special @code{SCM_UNDEFINED}. That final @code{SCM_UNDEFINED} is
|
the special @code{SCM_UNDEFINED}. That final @code{SCM_UNDEFINED} is
|
||||||
not included in the list. None of @var{elem1} to @var{elemN} can
|
not included in the list. None of @var{elem} @dots{} can
|
||||||
themselves be @code{SCM_UNDEFINED}, or @code{scm_list_n} will
|
themselves be @code{SCM_UNDEFINED}, or @code{scm_list_n} will
|
||||||
terminate at that point.
|
terminate at that point.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -430,12 +430,14 @@ pairs. This is why you should be careful when using the side-effecting
|
||||||
variants.
|
variants.
|
||||||
|
|
||||||
@rnindex append
|
@rnindex append
|
||||||
@deffn {Scheme Procedure} append lst1 @dots{} lstN
|
@deffn {Scheme Procedure} append lst @dots{} obj
|
||||||
@deffnx {Scheme Procedure} append! lst1 @dots{} lstN
|
@deffnx {Scheme Procedure} append
|
||||||
|
@deffnx {Scheme Procedure} append! lst @dots{} obj
|
||||||
|
@deffnx {Scheme Procedure} append!
|
||||||
@deffnx {C Function} scm_append (lstlst)
|
@deffnx {C Function} scm_append (lstlst)
|
||||||
@deffnx {C Function} scm_append_x (lstlst)
|
@deffnx {C Function} scm_append_x (lstlst)
|
||||||
Return a list comprising all the elements of lists @var{lst1} to
|
Return a list comprising all the elements of lists @var{lst} @dots{}
|
||||||
@var{lstN}.
|
@var{obj}. If called with no arguments, return the empty list.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(append '(x) '(y)) @result{} (x y)
|
(append '(x) '(y)) @result{} (x y)
|
||||||
|
@ -443,7 +445,7 @@ Return a list comprising all the elements of lists @var{lst1} to
|
||||||
(append '(a (b)) '((c))) @result{} (a (b) (c))
|
(append '(a (b)) '((c))) @result{} (a (b) (c))
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
The last argument @var{lstN} may actually be any object; an improper
|
The last argument @var{obj} may actually be any object; an improper
|
||||||
list results if the last argument is not a proper list.
|
list results if the last argument is not a proper list.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
|
@ -452,11 +454,11 @@ list results if the last argument is not a proper list.
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
@code{append} doesn't modify the given lists, but the return may share
|
@code{append} doesn't modify the given lists, but the return may share
|
||||||
structure with the final @var{lstN}. @code{append!} modifies the
|
structure with the final @var{obj}. @code{append!} modifies the
|
||||||
given lists to form its return.
|
given lists to form its return.
|
||||||
|
|
||||||
For @code{scm_append} and @code{scm_append_x}, @var{lstlst} is a list
|
For @code{scm_append} and @code{scm_append_x}, @var{lstlst} is a list
|
||||||
of the list operands @var{lst1} @dots{} @var{lstN}. That @var{lstlst}
|
of the list operands @var{lst} @dots{} @var{obj}. That @var{lstlst}
|
||||||
itself is not modified or used in the return.
|
itself is not modified or used in the return.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -709,7 +711,7 @@ thus created is determined implicitly by the number of arguments given.
|
||||||
|
|
||||||
@rnindex vector
|
@rnindex vector
|
||||||
@rnindex list->vector
|
@rnindex list->vector
|
||||||
@deffn {Scheme Procedure} vector . l
|
@deffn {Scheme Procedure} vector arg @dots{}
|
||||||
@deffnx {Scheme Procedure} list->vector l
|
@deffnx {Scheme Procedure} list->vector l
|
||||||
@deffnx {C Function} scm_vector (l)
|
@deffnx {C Function} scm_vector (l)
|
||||||
Return a newly allocated vector composed of the
|
Return a newly allocated vector composed of the
|
||||||
|
@ -775,19 +777,19 @@ in the vector.
|
||||||
|
|
||||||
@rnindex vector-length
|
@rnindex vector-length
|
||||||
@deffn {Scheme Procedure} vector-length vector
|
@deffn {Scheme Procedure} vector-length vector
|
||||||
@deffnx {C Function} scm_vector_length vector
|
@deffnx {C Function} scm_vector_length (vector)
|
||||||
Return the number of elements in @var{vector} as an exact integer.
|
Return the number of elements in @var{vector} as an exact integer.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} size_t scm_c_vector_length (SCM v)
|
@deftypefn {C Function} size_t scm_c_vector_length (SCM vec)
|
||||||
Return the number of elements in @var{vector} as a @code{size_t}.
|
Return the number of elements in @var{vec} as a @code{size_t}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@rnindex vector-ref
|
@rnindex vector-ref
|
||||||
@deffn {Scheme Procedure} vector-ref vector k
|
@deffn {Scheme Procedure} vector-ref vec k
|
||||||
@deffnx {C Function} scm_vector_ref vector k
|
@deffnx {C Function} scm_vector_ref (vec, k)
|
||||||
Return the contents of position @var{k} of @var{vector}.
|
Return the contents of position @var{k} of @var{vec}.
|
||||||
@var{k} must be a valid index of @var{vector}.
|
@var{k} must be a valid index of @var{vec}.
|
||||||
@lisp
|
@lisp
|
||||||
(vector-ref '#(1 1 2 3 5 8 13 21) 5) @result{} 8
|
(vector-ref '#(1 1 2 3 5 8 13 21) 5) @result{} 8
|
||||||
(vector-ref '#(1 1 2 3 5 8 13 21)
|
(vector-ref '#(1 1 2 3 5 8 13 21)
|
||||||
|
@ -798,9 +800,9 @@ Return the contents of position @var{k} of @var{vector}.
|
||||||
@end lisp
|
@end lisp
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_c_vector_ref (SCM v, size_t k)
|
@deftypefn {C Function} SCM scm_c_vector_ref (SCM vec, size_t k)
|
||||||
Return the contents of position @var{k} (a @code{size_t}) of
|
Return the contents of position @var{k} (a @code{size_t}) of
|
||||||
@var{vector}.
|
@var{vec}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
A vector created by one of the dynamic vector constructor procedures
|
A vector created by one of the dynamic vector constructor procedures
|
||||||
|
@ -813,10 +815,10 @@ considered as constants. Currently, however, Guile does not detect this
|
||||||
error.
|
error.
|
||||||
|
|
||||||
@rnindex vector-set!
|
@rnindex vector-set!
|
||||||
@deffn {Scheme Procedure} vector-set! vector k obj
|
@deffn {Scheme Procedure} vector-set! vec k obj
|
||||||
@deffnx {C Function} scm_vector_set_x vector k obj
|
@deffnx {C Function} scm_vector_set_x (vec, k, obj)
|
||||||
Store @var{obj} in position @var{k} of @var{vector}.
|
Store @var{obj} in position @var{k} of @var{vec}.
|
||||||
@var{k} must be a valid index of @var{vector}.
|
@var{k} must be a valid index of @var{vec}.
|
||||||
The value returned by @samp{vector-set!} is unspecified.
|
The value returned by @samp{vector-set!} is unspecified.
|
||||||
@lisp
|
@lisp
|
||||||
(let ((vec (vector 0 '(2 2 2 2) "Anna")))
|
(let ((vec (vector 0 '(2 2 2 2) "Anna")))
|
||||||
|
@ -825,14 +827,14 @@ The value returned by @samp{vector-set!} is unspecified.
|
||||||
@end lisp
|
@end lisp
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} void scm_c_vector_set_x (SCM v, size_t k, SCM obj)
|
@deftypefn {C Function} void scm_c_vector_set_x (SCM vec, size_t k, SCM obj)
|
||||||
Store @var{obj} in position @var{k} (a @code{size_t}) of @var{v}.
|
Store @var{obj} in position @var{k} (a @code{size_t}) of @var{vec}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@rnindex vector-fill!
|
@rnindex vector-fill!
|
||||||
@deffn {Scheme Procedure} vector-fill! v fill
|
@deffn {Scheme Procedure} vector-fill! vec fill
|
||||||
@deffnx {C Function} scm_vector_fill_x (v, fill)
|
@deffnx {C Function} scm_vector_fill_x (vec, fill)
|
||||||
Store @var{fill} in every position of @var{vector}. The value
|
Store @var{fill} in every position of @var{vec}. The value
|
||||||
returned by @code{vector-fill!} is unspecified.
|
returned by @code{vector-fill!} is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -1010,7 +1012,7 @@ Like @code{scm_make_bitvector}, but the length is given as a
|
||||||
@code{size_t}.
|
@code{size_t}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} bitvector . bits
|
@deffn {Scheme Procedure} bitvector bit @dots{}
|
||||||
@deffnx {C Function} scm_bitvector (bits)
|
@deffnx {C Function} scm_bitvector (bits)
|
||||||
Create a new bitvector with the arguments as elements.
|
Create a new bitvector with the arguments as elements.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1031,7 +1033,7 @@ Return the element at index @var{idx} of the bitvector
|
||||||
@var{vec}.
|
@var{vec}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_c_bitvector_ref (SCM obj, size_t idx)
|
@deftypefn {C Function} SCM scm_c_bitvector_ref (SCM vec, size_t idx)
|
||||||
Return the element at index @var{idx} of the bitvector
|
Return the element at index @var{idx} of the bitvector
|
||||||
@var{vec}.
|
@var{vec}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
@ -1042,7 +1044,7 @@ Set the element at index @var{idx} of the bitvector
|
||||||
@var{vec} when @var{val} is true, else clear it.
|
@var{vec} when @var{val} is true, else clear it.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_c_bitvector_set_x (SCM obj, size_t idx, SCM val)
|
@deftypefn {C Function} SCM scm_c_bitvector_set_x (SCM vec, size_t idx, SCM val)
|
||||||
Set the element at index @var{idx} of the bitvector
|
Set the element at index @var{idx} of the bitvector
|
||||||
@var{vec} when @var{val} is true, else clear it.
|
@var{vec} when @var{val} is true, else clear it.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
@ -1427,8 +1429,8 @@ stored in the variable @code{*unspecified*} so that for example
|
||||||
@code{(make-typed-array 'u32 *unspecified* 4)} creates a uninitialized
|
@code{(make-typed-array 'u32 *unspecified* 4)} creates a uninitialized
|
||||||
@code{u32} vector of length 4.
|
@code{u32} vector of length 4.
|
||||||
|
|
||||||
Each @var{bound} may be a positive non-zero integer @var{N}, in which
|
Each @var{bound} may be a positive non-zero integer @var{n}, in which
|
||||||
case the index for that dimension can range from 0 through @var{N-1}; or
|
case the index for that dimension can range from 0 through @var{n}-1; or
|
||||||
an explicit index range specifier in the form @code{(LOWER UPPER)},
|
an explicit index range specifier in the form @code{(LOWER UPPER)},
|
||||||
where both @var{lower} and @var{upper} are integers, possibly less than
|
where both @var{lower} and @var{upper} are integers, possibly less than
|
||||||
zero, and possibly the same number (however, @var{lower} cannot be
|
zero, and possibly the same number (however, @var{lower} cannot be
|
||||||
|
@ -1512,8 +1514,8 @@ For example,
|
||||||
@end example
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} array-rank obj
|
@deffn {Scheme Procedure} array-rank array
|
||||||
@deffnx {C Function} scm_array_rank (obj)
|
@deffnx {C Function} scm_array_rank (array)
|
||||||
Return the rank of @var{array}.
|
Return the rank of @var{array}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -1546,7 +1548,7 @@ is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@c begin (texi-doc-string "guile" "array-equal?")
|
@c begin (texi-doc-string "guile" "array-equal?")
|
||||||
@deffn {Scheme Procedure} array-equal? array1 array2 @dots{}
|
@deffn {Scheme Procedure} array-equal? array @dots{}
|
||||||
Return @code{#t} if all arguments are arrays with the same shape, the
|
Return @code{#t} if all arguments are arrays with the same shape, the
|
||||||
same type, and have corresponding elements which are either
|
same type, and have corresponding elements which are either
|
||||||
@code{equal?} or @code{array-equal?}. This function differs from
|
@code{equal?} or @code{array-equal?}. This function differs from
|
||||||
|
@ -1563,7 +1565,7 @@ same type, and have corresponding elements which are either
|
||||||
@c at least vaguely matches array-map!, but is it meant to be a
|
@c at least vaguely matches array-map!, but is it meant to be a
|
||||||
@c documented feature?
|
@c documented feature?
|
||||||
|
|
||||||
@deffn {Scheme Procedure} array-map! dst proc src1 @dots{} srcN
|
@deffn {Scheme Procedure} array-map! dst proc src @dots{}
|
||||||
@deffnx {Scheme Procedure} array-map-in-order! dst proc src1 @dots{} srcN
|
@deffnx {Scheme Procedure} array-map-in-order! dst proc src1 @dots{} srcN
|
||||||
@deffnx {C Function} scm_array_map_x (dst, proc, srclist)
|
@deffnx {C Function} scm_array_map_x (dst, proc, srclist)
|
||||||
Set each element of the @var{dst} array to values obtained from calls
|
Set each element of the @var{dst} array to values obtained from calls
|
||||||
|
@ -1580,10 +1582,10 @@ range in @var{dst}. This ensures all @var{dst} indices are valid in
|
||||||
each @var{src}.
|
each @var{src}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} array-for-each proc src1 @dots{} srcN
|
@deffn {Scheme Procedure} array-for-each proc src1 src2 @dots{}
|
||||||
@deffnx {C Function} scm_array_for_each (proc, src1, srclist)
|
@deffnx {C Function} scm_array_for_each (proc, src1, srclist)
|
||||||
Apply @var{proc} to each tuple of elements of @var{src1} @dots{}
|
Apply @var{proc} to each tuple of elements of @var{src1} @var{src2}
|
||||||
@var{srcN}, in row-major order. The value returned is unspecified.
|
@dots{}, in row-major order. The value returned is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} array-index-map! dst proc
|
@deffn {Scheme Procedure} array-index-map! dst proc
|
||||||
|
@ -1625,10 +1627,10 @@ $\left(\matrix{%
|
||||||
|
|
||||||
@deffn {Scheme Procedure} uniform-array-read! ra [port_or_fd [start [end]]]
|
@deffn {Scheme Procedure} uniform-array-read! ra [port_or_fd [start [end]]]
|
||||||
@deffnx {C Function} scm_uniform_array_read_x (ra, port_or_fd, start, end)
|
@deffnx {C Function} scm_uniform_array_read_x (ra, port_or_fd, start, end)
|
||||||
Attempt to read all elements of @var{ura}, in lexicographic order, as
|
Attempt to read all elements of array @var{ra}, in lexicographic order, as
|
||||||
binary objects from @var{port-or-fdes}.
|
binary objects from @var{port_or_fd}.
|
||||||
If an end of file is encountered,
|
If an end of file is encountered,
|
||||||
the objects up to that point are put into @var{ura}
|
the objects up to that point are put into @var{ra}
|
||||||
(starting at the beginning) and the remainder of the array is
|
(starting at the beginning) and the remainder of the array is
|
||||||
unchanged.
|
unchanged.
|
||||||
|
|
||||||
|
@ -1637,21 +1639,21 @@ a specified region of a vector (or linearized array) to be read,
|
||||||
leaving the remainder of the vector unchanged.
|
leaving the remainder of the vector unchanged.
|
||||||
|
|
||||||
@code{uniform-array-read!} returns the number of objects read.
|
@code{uniform-array-read!} returns the number of objects read.
|
||||||
@var{port-or-fdes} may be omitted, in which case it defaults to the value
|
@var{port_or_fd} may be omitted, in which case it defaults to the value
|
||||||
returned by @code{(current-input-port)}.
|
returned by @code{(current-input-port)}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} uniform-array-write v [port_or_fd [start [end]]]
|
@deffn {Scheme Procedure} uniform-array-write ra [port_or_fd [start [end]]]
|
||||||
@deffnx {C Function} scm_uniform_array_write (v, port_or_fd, start, end)
|
@deffnx {C Function} scm_uniform_array_write (ra, port_or_fd, start, end)
|
||||||
Writes all elements of @var{ura} as binary objects to
|
Writes all elements of @var{ra} as binary objects to
|
||||||
@var{port-or-fdes}.
|
@var{port_or_fd}.
|
||||||
|
|
||||||
The optional arguments @var{start}
|
The optional arguments @var{start}
|
||||||
and @var{end} allow
|
and @var{end} allow
|
||||||
a specified region of a vector (or linearized array) to be written.
|
a specified region of a vector (or linearized array) to be written.
|
||||||
|
|
||||||
The number of objects actually written is returned.
|
The number of objects actually written is returned.
|
||||||
@var{port-or-fdes} may be
|
@var{port_or_fd} may be
|
||||||
omitted, in which case it defaults to the value returned by
|
omitted, in which case it defaults to the value returned by
|
||||||
@code{(current-output-port)}.
|
@code{(current-output-port)}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1663,7 +1665,7 @@ omitted, in which case it defaults to the value returned by
|
||||||
@deffnx {C Function} scm_make_shared_array (oldarray, mapfunc, boundlist)
|
@deffnx {C Function} scm_make_shared_array (oldarray, mapfunc, boundlist)
|
||||||
Return a new array which shares the storage of @var{oldarray}.
|
Return a new array which shares the storage of @var{oldarray}.
|
||||||
Changes made through either affect the same underlying storage. The
|
Changes made through either affect the same underlying storage. The
|
||||||
@var{bound@dots{}} arguments are the shape of the new array, the same
|
@var{bound} @dots{} arguments are the shape of the new array, the same
|
||||||
as @code{make-array} (@pxref{Array Procedures}).
|
as @code{make-array} (@pxref{Array Procedures}).
|
||||||
|
|
||||||
@var{mapfunc} translates coordinates from the new array to the
|
@var{mapfunc} translates coordinates from the new array to the
|
||||||
|
@ -1793,7 +1795,7 @@ be returned only if its elements are stored internally contiguous in
|
||||||
memory.
|
memory.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} transpose-array array dim1 @dots{}
|
@deffn {Scheme Procedure} transpose-array array dim1 dim2 @dots{}
|
||||||
@deffnx {C Function} scm_transpose_array (array, dimlist)
|
@deffnx {C Function} scm_transpose_array (array, dimlist)
|
||||||
Return an array sharing contents with @var{array}, but with
|
Return an array sharing contents with @var{array}, but with
|
||||||
dimensions arranged in a different order. There must be one
|
dimensions arranged in a different order. There must be one
|
||||||
|
@ -2235,7 +2237,7 @@ Return a new vlist, as for SRFI-1 @code{unfold} and @code{unfold-right}
|
||||||
(@pxref{SRFI-1, @code{unfold}}).
|
(@pxref{SRFI-1, @code{unfold}}).
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} vlist-append vlists ...
|
@deffn {Scheme Procedure} vlist-append vlist @dots{}
|
||||||
Append the given vlists and return the resulting vlist.
|
Append the given vlists and return the resulting vlist.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -2465,7 +2467,7 @@ This section describes the basic procedures for working with
|
||||||
structures. @code{make-struct} creates a structure, and
|
structures. @code{make-struct} creates a structure, and
|
||||||
@code{struct-ref} and @code{struct-set!} access write fields.
|
@code{struct-ref} and @code{struct-set!} access write fields.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} make-struct vtable tail-size [init...]
|
@deffn {Scheme Procedure} make-struct vtable tail-size init @dots{}
|
||||||
@deffnx {C Function} scm_make_struct (vtable, tail_size, init_list)
|
@deffnx {C Function} scm_make_struct (vtable, tail_size, init_list)
|
||||||
Create a new structure, with layout per the given @var{vtable}
|
Create a new structure, with layout per the given @var{vtable}
|
||||||
(@pxref{Vtables}).
|
(@pxref{Vtables}).
|
||||||
|
|
|
@ -44,7 +44,7 @@ If the test is true, we want to display ``greater'' to the current
|
||||||
output port, then display a newline. We use @code{begin} to form a
|
output port, then display a newline. We use @code{begin} to form a
|
||||||
compound expression out of this sequence of sub-expressions.
|
compound expression out of this sequence of sub-expressions.
|
||||||
|
|
||||||
@deffn syntax begin expr1 expr2 @dots{}
|
@deffn syntax begin expr @dots{}
|
||||||
The expression(s) are evaluated in left-to-right order and the value of
|
The expression(s) are evaluated in left-to-right order and the value of
|
||||||
the last expression is returned as the value of the
|
the last expression is returned as the value of the
|
||||||
@code{begin}-expression. This expression type is used when the
|
@code{begin}-expression. This expression type is used when the
|
||||||
|
@ -277,7 +277,7 @@ Scheme programs is normally expressed using recursion. Nevertheless,
|
||||||
R5RS defines a construct for programming loops, calling @code{do}. In
|
R5RS defines a construct for programming loops, calling @code{do}. In
|
||||||
addition, Guile has an explicit looping syntax called @code{while}.
|
addition, Guile has an explicit looping syntax called @code{while}.
|
||||||
|
|
||||||
@deffn syntax do ((variable init [step]) @dots{}) (test [expr @dots{}]) body @dots{}
|
@deffn syntax do ((variable init [step]) @dots{}) (test expr @dots{}) body @dots{}
|
||||||
Bind @var{variable}s and evaluate @var{body} until @var{test} is true.
|
Bind @var{variable}s and evaluate @var{body} until @var{test} is true.
|
||||||
The return value is the last @var{expr} after @var{test}, if given. A
|
The return value is the last @var{expr} after @var{test}, if given. A
|
||||||
simple example will illustrate the basic form,
|
simple example will illustrate the basic form,
|
||||||
|
@ -348,7 +348,7 @@ Run a loop executing the @var{body} forms while @var{cond} is true.
|
||||||
Within @code{while}, two extra bindings are provided, they can be used
|
Within @code{while}, two extra bindings are provided, they can be used
|
||||||
from both @var{cond} and @var{body}.
|
from both @var{cond} and @var{body}.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} break break-arg...
|
@deffn {Scheme Procedure} break break-arg @dots{}
|
||||||
Break out of the @code{while} form.
|
Break out of the @code{while} form.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -487,7 +487,7 @@ tag allows some useful prompt and abort idioms, discussed in the next
|
||||||
section.
|
section.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} abort-to-prompt tag val ...
|
@deffn {Scheme Procedure} abort-to-prompt tag val1 val2 @dots{}
|
||||||
Unwind the dynamic and control context to the nearest prompt named @var{tag},
|
Unwind the dynamic and control context to the nearest prompt named @var{tag},
|
||||||
also passing the given values.
|
also passing the given values.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -599,8 +599,9 @@ The @code{%} symbol is chosen because it looks like a prompt.
|
||||||
Likewise there is an abbreviation for @code{abort-to-prompt}, which
|
Likewise there is an abbreviation for @code{abort-to-prompt}, which
|
||||||
assumes the default prompt tag:
|
assumes the default prompt tag:
|
||||||
|
|
||||||
@deffn {Scheme Procedure} abort val...
|
@deffn {Scheme Procedure} abort val1 val2 @dots{}
|
||||||
Abort to the default prompt tag, passing @var{val...} to the handler.
|
Abort to the default prompt tag, passing @var{val1} @var{val2} @dots{}
|
||||||
|
to the handler.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
As mentioned before, @code{(ice-9 control)} also provides other
|
As mentioned before, @code{(ice-9 control)} also provides other
|
||||||
|
@ -627,19 +628,22 @@ If both continuation and handler implicitly add prompts, then the
|
||||||
operator is @dfn{+F+}. @code{shift} and @code{reset} are such
|
operator is @dfn{+F+}. @code{shift} and @code{reset} are such
|
||||||
operators.
|
operators.
|
||||||
|
|
||||||
@deffn {Scheme Syntax} reset body...
|
@deffn {Scheme Syntax} reset body1 body2 @dots{}
|
||||||
Establish a prompt, and evaluate @var{body...} within that prompt.
|
Establish a prompt, and evaluate @var{body1} @var{body2} @dots{} within
|
||||||
|
that prompt.
|
||||||
|
|
||||||
The prompt handler is designed to work with @code{shift}, described
|
The prompt handler is designed to work with @code{shift}, described
|
||||||
below.
|
below.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Syntax} shift cont body...
|
@deffn {Scheme Syntax} shift cont body1 body2 @dots{}
|
||||||
Abort to the nearest @code{reset}, and evaluate @var{body...} in a
|
Abort to the nearest @code{reset}, and evaluate @var{body1} @var{body2}
|
||||||
context in which the captured continuation is bound to @var{cont}.
|
@dots{} in a context in which the captured continuation is bound to
|
||||||
|
@var{cont}.
|
||||||
|
|
||||||
As mentioned above, both the @var{body...} expression and invocations of
|
As mentioned above, taken together, the @var{body1} @var{body2} @dots{}
|
||||||
@var{cont} implicitly establish a prompt.
|
expressions and the invocations of @var{cont} implicitly establish a
|
||||||
|
prompt.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
Interested readers are invited to explore Oleg Kiselyov's wonderful web
|
Interested readers are invited to explore Oleg Kiselyov's wonderful web
|
||||||
|
@ -803,7 +807,7 @@ multiple values with a procedure which accepts these values as
|
||||||
parameters.
|
parameters.
|
||||||
|
|
||||||
@rnindex values
|
@rnindex values
|
||||||
@deffn {Scheme Procedure} values arg1 @dots{} argN
|
@deffn {Scheme Procedure} values arg @dots{}
|
||||||
@deffnx {C Function} scm_values (args)
|
@deffnx {C Function} scm_values (args)
|
||||||
Delivers all of its arguments to its continuation. Except for
|
Delivers all of its arguments to its continuation. Except for
|
||||||
continuations created by the @code{call-with-values} procedure,
|
continuations created by the @code{call-with-values} procedure,
|
||||||
|
@ -1220,10 +1224,10 @@ depends on the exception type. The documentation for each possible type
|
||||||
of exception should specify the additional arguments that are expected
|
of exception should specify the additional arguments that are expected
|
||||||
for that kind of exception.
|
for that kind of exception.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} throw key . args
|
@deffn {Scheme Procedure} throw key arg @dots{}
|
||||||
@deffnx {C Function} scm_throw (key, args)
|
@deffnx {C Function} scm_throw (key, args)
|
||||||
Invoke the catch form matching @var{key}, passing @var{args} to the
|
Invoke the catch form matching @var{key}, passing @var{arg} @dots{} to
|
||||||
@var{handler}.
|
the @var{handler}.
|
||||||
|
|
||||||
@var{key} is a symbol. It will match catches of the same symbol or of
|
@var{key} is a symbol. It will match catches of the same symbol or of
|
||||||
@code{#t}.
|
@code{#t}.
|
||||||
|
@ -1312,9 +1316,9 @@ Guile provides a set of convenience procedures for signaling error
|
||||||
conditions that are implemented on top of the exception primitives just
|
conditions that are implemented on top of the exception primitives just
|
||||||
described.
|
described.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} error msg args @dots{}
|
@deffn {Scheme Procedure} error msg arg @dots{}
|
||||||
Raise an error with key @code{misc-error} and a message constructed by
|
Raise an error with key @code{misc-error} and a message constructed by
|
||||||
displaying @var{msg} and writing @var{args}.
|
displaying @var{msg} and writing @var{arg} @enddots{}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} scm-error key subr message args data
|
@deffn {Scheme Procedure} scm-error key subr message args data
|
||||||
|
|
|
@ -695,10 +695,10 @@ value, including the special values @samp{+nan.0}, @samp{+inf.0} and
|
||||||
|
|
||||||
@deffn {Scheme Procedure} complex? z
|
@deffn {Scheme Procedure} complex? z
|
||||||
@deffnx {C Function} scm_complex_p (z)
|
@deffnx {C Function} scm_complex_p (z)
|
||||||
Return @code{#t} if @var{x} is a complex number, @code{#f}
|
Return @code{#t} if @var{z} is a complex number, @code{#f}
|
||||||
otherwise. Note that the sets of real, rational and integer
|
otherwise. Note that the sets of real, rational and integer
|
||||||
values form subsets of the set of complex numbers, i.e.@: the
|
values form subsets of the set of complex numbers, i.e.@: the
|
||||||
predicate will also be fulfilled if @var{x} is a real,
|
predicate will also be fulfilled if @var{z} is a real,
|
||||||
rational or integer number.
|
rational or integer number.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -2324,22 +2324,22 @@ Return @code{#t} if @var{obj} is a character set, @code{#f}
|
||||||
otherwise.
|
otherwise.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set= . char_sets
|
@deffn {Scheme Procedure} char-set= char_set @dots{}
|
||||||
@deffnx {C Function} scm_char_set_eq (char_sets)
|
@deffnx {C Function} scm_char_set_eq (char_sets)
|
||||||
Return @code{#t} if all given character sets are equal.
|
Return @code{#t} if all given character sets are equal.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set<= . char_sets
|
@deffn {Scheme Procedure} char-set<= char_set @dots{}
|
||||||
@deffnx {C Function} scm_char_set_leq (char_sets)
|
@deffnx {C Function} scm_char_set_leq (char_sets)
|
||||||
Return @code{#t} if every character set @var{cs}i is a subset
|
Return @code{#t} if every character set @var{char_set}i is a subset
|
||||||
of character set @var{cs}i+1.
|
of character set @var{char_set}i+1.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-hash cs [bound]
|
@deffn {Scheme Procedure} char-set-hash cs [bound]
|
||||||
@deffnx {C Function} scm_char_set_hash (cs, bound)
|
@deffnx {C Function} scm_char_set_hash (cs, bound)
|
||||||
Compute a hash value for the character set @var{cs}. If
|
Compute a hash value for the character set @var{cs}. If
|
||||||
@var{bound} is given and non-zero, it restricts the
|
@var{bound} is given and non-zero, it restricts the
|
||||||
returned value to the range 0 @dots{} @var{bound - 1}.
|
returned value to the range 0 @dots{} @var{bound} - 1.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@c ===================================================================
|
@c ===================================================================
|
||||||
|
@ -2443,8 +2443,8 @@ Return a newly allocated character set containing all
|
||||||
characters in @var{cs}.
|
characters in @var{cs}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set . rest
|
@deffn {Scheme Procedure} char-set chr @dots{}
|
||||||
@deffnx {C Function} scm_char_set (rest)
|
@deffnx {C Function} scm_char_set (chrs)
|
||||||
Return a character set containing all given characters.
|
Return a character set containing all given characters.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -2607,26 +2607,26 @@ such as union, complement, intersection etc. All of these procedures
|
||||||
provide side-effecting variants, which modify their character set
|
provide side-effecting variants, which modify their character set
|
||||||
argument(s).
|
argument(s).
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-adjoin cs . rest
|
@deffn {Scheme Procedure} char-set-adjoin cs chr @dots{}
|
||||||
@deffnx {C Function} scm_char_set_adjoin (cs, rest)
|
@deffnx {C Function} scm_char_set_adjoin (cs, chrs)
|
||||||
Add all character arguments to the first argument, which must
|
Add all character arguments to the first argument, which must
|
||||||
be a character set.
|
be a character set.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-delete cs . rest
|
@deffn {Scheme Procedure} char-set-delete cs chr @dots{}
|
||||||
@deffnx {C Function} scm_char_set_delete (cs, rest)
|
@deffnx {C Function} scm_char_set_delete (cs, chrs)
|
||||||
Delete all character arguments from the first argument, which
|
Delete all character arguments from the first argument, which
|
||||||
must be a character set.
|
must be a character set.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-adjoin! cs . rest
|
@deffn {Scheme Procedure} char-set-adjoin! cs chr @dots{}
|
||||||
@deffnx {C Function} scm_char_set_adjoin_x (cs, rest)
|
@deffnx {C Function} scm_char_set_adjoin_x (cs, chrs)
|
||||||
Add all character arguments to the first argument, which must
|
Add all character arguments to the first argument, which must
|
||||||
be a character set.
|
be a character set.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-delete! cs . rest
|
@deffn {Scheme Procedure} char-set-delete! cs chr @dots{}
|
||||||
@deffnx {C Function} scm_char_set_delete_x (cs, rest)
|
@deffnx {C Function} scm_char_set_delete_x (cs, chrs)
|
||||||
Delete all character arguments from the first argument, which
|
Delete all character arguments from the first argument, which
|
||||||
must be a character set.
|
must be a character set.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -2642,28 +2642,28 @@ characters). It may be helpful to modify the output of
|
||||||
@code{char-set-complement} by computing its intersection with the set
|
@code{char-set-complement} by computing its intersection with the set
|
||||||
of designated code points, @code{char-set:designated}.
|
of designated code points, @code{char-set:designated}.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-union . rest
|
@deffn {Scheme Procedure} char-set-union cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_union (rest)
|
@deffnx {C Function} scm_char_set_union (char_sets)
|
||||||
Return the union of all argument character sets.
|
Return the union of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-intersection . rest
|
@deffn {Scheme Procedure} char-set-intersection cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_intersection (rest)
|
@deffnx {C Function} scm_char_set_intersection (char_sets)
|
||||||
Return the intersection of all argument character sets.
|
Return the intersection of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-difference cs1 . rest
|
@deffn {Scheme Procedure} char-set-difference cs1 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_difference (cs1, rest)
|
@deffnx {C Function} scm_char_set_difference (cs1, char_sets)
|
||||||
Return the difference of all argument character sets.
|
Return the difference of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-xor . rest
|
@deffn {Scheme Procedure} char-set-xor cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_xor (rest)
|
@deffnx {C Function} scm_char_set_xor (char_sets)
|
||||||
Return the exclusive-or of all argument character sets.
|
Return the exclusive-or of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-diff+intersection cs1 . rest
|
@deffn {Scheme Procedure} char-set-diff+intersection cs1 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_diff_plus_intersection (cs1, rest)
|
@deffnx {C Function} scm_char_set_diff_plus_intersection (cs1, char_sets)
|
||||||
Return the difference and the intersection of all argument
|
Return the difference and the intersection of all argument
|
||||||
character sets.
|
character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -2673,28 +2673,28 @@ character sets.
|
||||||
Return the complement of the character set @var{cs}.
|
Return the complement of the character set @var{cs}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-union! cs1 . rest
|
@deffn {Scheme Procedure} char-set-union! cs1 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_union_x (cs1, rest)
|
@deffnx {C Function} scm_char_set_union_x (cs1, char_sets)
|
||||||
Return the union of all argument character sets.
|
Return the union of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-intersection! cs1 . rest
|
@deffn {Scheme Procedure} char-set-intersection! cs1 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_intersection_x (cs1, rest)
|
@deffnx {C Function} scm_char_set_intersection_x (cs1, char_sets)
|
||||||
Return the intersection of all argument character sets.
|
Return the intersection of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-difference! cs1 . rest
|
@deffn {Scheme Procedure} char-set-difference! cs1 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_difference_x (cs1, rest)
|
@deffnx {C Function} scm_char_set_difference_x (cs1, char_sets)
|
||||||
Return the difference of all argument character sets.
|
Return the difference of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-xor! cs1 . rest
|
@deffn {Scheme Procedure} char-set-xor! cs1 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_xor_x (cs1, rest)
|
@deffnx {C Function} scm_char_set_xor_x (cs1, char_sets)
|
||||||
Return the exclusive-or of all argument character sets.
|
Return the exclusive-or of all argument character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} char-set-diff+intersection! cs1 cs2 . rest
|
@deffn {Scheme Procedure} char-set-diff+intersection! cs1 cs2 cs @dots{}
|
||||||
@deffnx {C Function} scm_char_set_diff_plus_intersection_x (cs1, cs2, rest)
|
@deffnx {C Function} scm_char_set_diff_plus_intersection_x (cs1, cs2, char_sets)
|
||||||
Return the difference and the intersection of all argument
|
Return the difference and the intersection of all argument
|
||||||
character sets.
|
character sets.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -2714,7 +2714,7 @@ useful, several predefined character set variables exist.
|
||||||
These character sets are locale independent and are not recomputed
|
These character sets are locale independent and are not recomputed
|
||||||
upon a @code{setlocale} call. They contain characters from the whole
|
upon a @code{setlocale} call. They contain characters from the whole
|
||||||
range of Unicode code points. For instance, @code{char-set:letter}
|
range of Unicode code points. For instance, @code{char-set:letter}
|
||||||
contains about 94,000 characters.
|
contains about 100,000 characters.
|
||||||
|
|
||||||
@defvr {Scheme Variable} char-set:lower-case
|
@defvr {Scheme Variable} char-set:lower-case
|
||||||
@defvrx {C Variable} scm_char_set_lower_case
|
@defvrx {C Variable} scm_char_set_lower_case
|
||||||
|
@ -3099,7 +3099,7 @@ reverse order.
|
||||||
Return a newly allocated string of
|
Return a newly allocated string of
|
||||||
length @var{k}. If @var{chr} is given, then all elements of
|
length @var{k}. If @var{chr} is given, then all elements of
|
||||||
the string are initialized to @var{chr}, otherwise the contents
|
the string are initialized to @var{chr}, otherwise the contents
|
||||||
of the @var{string} are unspecified.
|
of the string are unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_c_make_string (size_t len, SCM chr)
|
@deftypefn {C Function} SCM scm_c_make_string (size_t len, SCM chr)
|
||||||
|
@ -3118,7 +3118,7 @@ produce the corresponding string element. The order in which
|
||||||
@deffn {Scheme Procedure} string-join ls [delimiter [grammar]]
|
@deffn {Scheme Procedure} string-join ls [delimiter [grammar]]
|
||||||
@deffnx {C Function} scm_string_join (ls, delimiter, grammar)
|
@deffnx {C Function} scm_string_join (ls, delimiter, grammar)
|
||||||
Append the string in the string list @var{ls}, using the string
|
Append the string in the string list @var{ls}, using the string
|
||||||
@var{delim} as a delimiter between the elements of @var{ls}.
|
@var{delimiter} as a delimiter between the elements of @var{ls}.
|
||||||
@var{grammar} is a symbol which specifies how the delimiter is
|
@var{grammar} is a symbol which specifies how the delimiter is
|
||||||
placed between the strings, and defaults to the symbol
|
placed between the strings, and defaults to the symbol
|
||||||
@code{infix}.
|
@code{infix}.
|
||||||
|
@ -3279,7 +3279,7 @@ Return all but the last @var{n} characters of @var{s}.
|
||||||
@deffnx {C Function} scm_string_pad (s, len, chr, start, end)
|
@deffnx {C Function} scm_string_pad (s, len, chr, start, end)
|
||||||
@deffnx {C Function} scm_string_pad_right (s, len, chr, start, end)
|
@deffnx {C Function} scm_string_pad_right (s, len, chr, start, end)
|
||||||
Take characters @var{start} to @var{end} from the string @var{s} and
|
Take characters @var{start} to @var{end} from the string @var{s} and
|
||||||
either pad with @var{char} or truncate them to give @var{len}
|
either pad with @var{chr} or truncate them to give @var{len}
|
||||||
characters.
|
characters.
|
||||||
|
|
||||||
@code{string-pad} pads or truncates on the left, so for example
|
@code{string-pad} pads or truncates on the left, so for example
|
||||||
|
@ -3404,11 +3404,11 @@ comparison. See @xref{Text Collation, the @code{(ice-9
|
||||||
i18n)} module}, for locale-dependent string comparison.
|
i18n)} module}, for locale-dependent string comparison.
|
||||||
|
|
||||||
@rnindex string=?
|
@rnindex string=?
|
||||||
@deffn {Scheme Procedure} string=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string=? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_equal_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_equal_p (s1, s2, rest)
|
||||||
Lexicographic equality predicate; return @code{#t} if the two
|
Lexicographic equality predicate; return @code{#t} if all strings are
|
||||||
strings are the same length and contain the same characters in
|
the same length and contain the same characters in the same positions,
|
||||||
the same positions, otherwise return @code{#f}.
|
otherwise return @code{#f}.
|
||||||
|
|
||||||
The procedure @code{string-ci=?} treats upper and lower case
|
The procedure @code{string-ci=?} treats upper and lower case
|
||||||
letters as though they were the same character, but
|
letters as though they were the same character, but
|
||||||
|
@ -3417,72 +3417,80 @@ characters.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string<?
|
@rnindex string<?
|
||||||
@deffn {Scheme Procedure} string<? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string<? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_less_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_less_p (s1, s2, rest)
|
||||||
Lexicographic ordering predicate; return @code{#t} if @var{s1}
|
Lexicographic ordering predicate; return @code{#t} if, for every pair of
|
||||||
is lexicographically less than @var{s2}.
|
consecutive string arguments @var{str_i} and @var{str_i+1}, @var{str_i} is
|
||||||
|
lexicographically less than @var{str_i+1}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string<=?
|
@rnindex string<=?
|
||||||
@deffn {Scheme Procedure} string<=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string<=? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_leq_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_leq_p (s1, s2, rest)
|
||||||
Lexicographic ordering predicate; return @code{#t} if @var{s1}
|
Lexicographic ordering predicate; return @code{#t} if, for every pair of
|
||||||
is lexicographically less than or equal to @var{s2}.
|
consecutive string arguments @var{str_i} and @var{str_i+1}, @var{str_i} is
|
||||||
|
lexicographically less than or equal to @var{str_i+1}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string>?
|
@rnindex string>?
|
||||||
@deffn {Scheme Procedure} string>? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string>? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_gr_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_gr_p (s1, s2, rest)
|
||||||
Lexicographic ordering predicate; return @code{#t} if @var{s1}
|
Lexicographic ordering predicate; return @code{#t} if, for every pair of
|
||||||
is lexicographically greater than @var{s2}.
|
consecutive string arguments @var{str_i} and @var{str_i+1}, @var{str_i} is
|
||||||
|
lexicographically greater than @var{str_i+1}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string>=?
|
@rnindex string>=?
|
||||||
@deffn {Scheme Procedure} string>=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string>=? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_geq_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_geq_p (s1, s2, rest)
|
||||||
Lexicographic ordering predicate; return @code{#t} if @var{s1}
|
Lexicographic ordering predicate; return @code{#t} if, for every pair of
|
||||||
is lexicographically greater than or equal to @var{s2}.
|
consecutive string arguments @var{str_i} and @var{str_i+1}, @var{str_i} is
|
||||||
|
lexicographically greater than or equal to @var{str_i+1}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string-ci=?
|
@rnindex string-ci=?
|
||||||
@deffn {Scheme Procedure} string-ci=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string-ci=? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_ci_equal_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_ci_equal_p (s1, s2, rest)
|
||||||
Case-insensitive string equality predicate; return @code{#t} if
|
Case-insensitive string equality predicate; return @code{#t} if
|
||||||
the two strings are the same length and their component
|
all strings are the same length and their component
|
||||||
characters match (ignoring case) at each position; otherwise
|
characters match (ignoring case) at each position; otherwise
|
||||||
return @code{#f}.
|
return @code{#f}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string-ci<?
|
@rnindex string-ci<?
|
||||||
@deffn {Scheme Procedure} string-ci<? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string-ci<? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_ci_less_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_ci_less_p (s1, s2, rest)
|
||||||
Case insensitive lexicographic ordering predicate; return
|
Case insensitive lexicographic ordering predicate; return @code{#t} if,
|
||||||
@code{#t} if @var{s1} is lexicographically less than @var{s2}
|
for every pair of consecutive string arguments @var{str_i} and
|
||||||
|
@var{str_i+1}, @var{str_i} is lexicographically less than @var{str_i+1}
|
||||||
regardless of case.
|
regardless of case.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string<=?
|
@rnindex string<=?
|
||||||
@deffn {Scheme Procedure} string-ci<=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string-ci<=? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_ci_leq_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_ci_leq_p (s1, s2, rest)
|
||||||
Case insensitive lexicographic ordering predicate; return
|
Case insensitive lexicographic ordering predicate; return @code{#t} if,
|
||||||
@code{#t} if @var{s1} is lexicographically less than or equal
|
for every pair of consecutive string arguments @var{str_i} and
|
||||||
to @var{s2} regardless of case.
|
@var{str_i+1}, @var{str_i} is lexicographically less than or equal to
|
||||||
|
@var{str_i+1} regardless of case.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string-ci>?
|
@rnindex string-ci>?
|
||||||
@deffn {Scheme Procedure} string-ci>? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string-ci>? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_ci_gr_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_ci_gr_p (s1, s2, rest)
|
||||||
Case insensitive lexicographic ordering predicate; return
|
Case insensitive lexicographic ordering predicate; return @code{#t} if,
|
||||||
@code{#t} if @var{s1} is lexicographically greater than
|
for every pair of consecutive string arguments @var{str_i} and
|
||||||
@var{s2} regardless of case.
|
@var{str_i+1}, @var{str_i} is lexicographically greater than
|
||||||
|
@var{str_i+1} regardless of case.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string-ci>=?
|
@rnindex string-ci>=?
|
||||||
@deffn {Scheme Procedure} string-ci>=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string-ci>=? s1 s2 s3 @dots{}
|
||||||
@deffnx {C Function} scm_i_string_ci_geq_p (s1, s2, rest)
|
@deffnx {C Function} scm_i_string_ci_geq_p (s1, s2, rest)
|
||||||
Case insensitive lexicographic ordering predicate; return
|
Case insensitive lexicographic ordering predicate; return @code{#t} if,
|
||||||
@code{#t} if @var{s1} is lexicographically greater than or
|
for every pair of consecutive string arguments @var{str_i} and
|
||||||
equal to @var{s2} regardless of case.
|
@var{str_i+1}, @var{str_i} is lexicographically greater than or equal to
|
||||||
|
@var{str_i+1} regardless of case.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-compare s1 s2 proc_lt proc_eq proc_gt [start1 [end1 [start2 [end2]]]]
|
@deffn {Scheme Procedure} string-compare s1 s2 proc_lt proc_eq proc_gt [start1 [end1 [start2 [end2]]]]
|
||||||
|
@ -3587,12 +3595,12 @@ case-insensitively.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-hash s [bound [start [end]]]
|
@deffn {Scheme Procedure} string-hash s [bound [start [end]]]
|
||||||
@deffnx {C Function} scm_substring_hash (s, bound, start, end)
|
@deffnx {C Function} scm_substring_hash (s, bound, start, end)
|
||||||
Compute a hash value for @var{S}. The optional argument @var{bound} is a non-negative exact integer specifying the range of the hash function. A positive value restricts the return value to the range [0,bound).
|
Compute a hash value for @var{s}. The optional argument @var{bound} is a non-negative exact integer specifying the range of the hash function. A positive value restricts the return value to the range [0,bound).
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-hash-ci s [bound [start [end]]]
|
@deffn {Scheme Procedure} string-hash-ci s [bound [start [end]]]
|
||||||
@deffnx {C Function} scm_substring_hash_ci (s, bound, start, end)
|
@deffnx {C Function} scm_substring_hash_ci (s, bound, start, end)
|
||||||
Compute a hash value for @var{S}. The optional argument @var{bound} is a non-negative exact integer specifying the range of the hash function. A positive value restricts the return value to the range [0,bound).
|
Compute a hash value for @var{s}. The optional argument @var{bound} is a non-negative exact integer specifying the range of the hash function. A positive value restricts the return value to the range [0,bound).
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
Because the same visual appearance of an abstract Unicode character can
|
Because the same visual appearance of an abstract Unicode character can
|
||||||
|
@ -3934,10 +3942,10 @@ operate on. The return value is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex string-append
|
@rnindex string-append
|
||||||
@deffn {Scheme Procedure} string-append . args
|
@deffn {Scheme Procedure} string-append arg @dots{}
|
||||||
@deffnx {C Function} scm_string_append (args)
|
@deffnx {C Function} scm_string_append (args)
|
||||||
Return a newly allocated string whose characters form the
|
Return a newly allocated string whose characters form the
|
||||||
concatenation of the given strings, @var{args}.
|
concatenation of the given strings, @var{arg} @enddots{}.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(let ((h "hello "))
|
(let ((h "hello "))
|
||||||
|
@ -3946,17 +3954,16 @@ concatenation of the given strings, @var{args}.
|
||||||
@end example
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-append/shared . rest
|
@deffn {Scheme Procedure} string-append/shared arg @dots{}
|
||||||
@deffnx {C Function} scm_string_append_shared (rest)
|
@deffnx {C Function} scm_string_append_shared (args)
|
||||||
Like @code{string-append}, but the result may share memory
|
Like @code{string-append}, but the result may share memory
|
||||||
with the argument strings.
|
with the argument strings.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-concatenate ls
|
@deffn {Scheme Procedure} string-concatenate ls
|
||||||
@deffnx {C Function} scm_string_concatenate (ls)
|
@deffnx {C Function} scm_string_concatenate (ls)
|
||||||
Append the elements of @var{ls} (which must be strings)
|
Append the elements (which must be strings) of @var{ls} together into a
|
||||||
together into a single string. Guaranteed to return a freshly
|
single string. Guaranteed to return a freshly allocated string.
|
||||||
allocated string.
|
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-concatenate-reverse ls [final_string [end]]
|
@deffn {Scheme Procedure} string-concatenate-reverse ls [final_string [end]]
|
||||||
|
@ -5181,9 +5188,9 @@ Return a newly allocated symbol made from a list of characters.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@rnindex symbol-append
|
@rnindex symbol-append
|
||||||
@deffn {Scheme Procedure} symbol-append . args
|
@deffn {Scheme Procedure} symbol-append arg @dots{}
|
||||||
Return a newly allocated symbol whose characters form the
|
Return a newly allocated symbol whose characters form the
|
||||||
concatenation of the given symbols, @var{args}.
|
concatenation of the given symbols, @var{arg} @enddots{}.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(let ((h 'hello))
|
(let ((h 'hello))
|
||||||
|
@ -5253,15 +5260,15 @@ When you want to do more from C, you should convert between symbols
|
||||||
and strings using @code{scm_symbol_to_string} and
|
and strings using @code{scm_symbol_to_string} and
|
||||||
@code{scm_string_to_symbol} and work with the strings.
|
@code{scm_string_to_symbol} and work with the strings.
|
||||||
|
|
||||||
@deffn {C Function} scm_from_latin1_symbol (const char *name)
|
@deftypefn {C Function} scm_from_latin1_symbol (const char *name)
|
||||||
@deffnx {C Function} scm_from_utf8_symbol (const char *name)
|
@deftypefnx {C Function} scm_from_utf8_symbol (const char *name)
|
||||||
Construct and return a Scheme symbol whose name is specified by the
|
Construct and return a Scheme symbol whose name is specified by the
|
||||||
null-terminated C string @var{name}. These are appropriate when
|
null-terminated C string @var{name}. These are appropriate when
|
||||||
the C string is hard-coded in the source code.
|
the C string is hard-coded in the source code.
|
||||||
@end deffn
|
@end deftypefn
|
||||||
|
|
||||||
@deffn {C Function} scm_from_locale_symbol (const char *name)
|
@deftypefn {C Function} scm_from_locale_symbol (const char *name)
|
||||||
@deffnx {C Function} scm_from_locale_symboln (const char *name, size_t len)
|
@deftypefnx {C Function} scm_from_locale_symboln (const char *name, size_t len)
|
||||||
Construct and return a Scheme symbol whose name is specified by
|
Construct and return a Scheme symbol whose name is specified by
|
||||||
@var{name}. For @code{scm_from_locale_symbol}, @var{name} must be null
|
@var{name}. For @code{scm_from_locale_symbol}, @var{name} must be null
|
||||||
terminated; for @code{scm_from_locale_symboln} the length of @var{name} is
|
terminated; for @code{scm_from_locale_symboln} the length of @var{name} is
|
||||||
|
@ -5271,7 +5278,7 @@ Note that these functions should @emph{not} be used when @var{name} is a
|
||||||
C string constant, because there is no guarantee that the current locale
|
C string constant, because there is no guarantee that the current locale
|
||||||
will match that of the source code. In such cases, use
|
will match that of the source code. In such cases, use
|
||||||
@code{scm_from_latin1_symbol} or @code{scm_from_utf8_symbol}.
|
@code{scm_from_latin1_symbol} or @code{scm_from_utf8_symbol}.
|
||||||
@end deffn
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_take_locale_symbol (char *str)
|
@deftypefn {C Function} SCM scm_take_locale_symbol (char *str)
|
||||||
@deftypefnx {C Function} SCM scm_take_locale_symboln (char *str, size_t len)
|
@deftypefnx {C Function} SCM scm_take_locale_symboln (char *str, size_t len)
|
||||||
|
|
|
@ -80,15 +80,15 @@ describes the Scheme stack at that point.
|
||||||
Use @code{start-stack} to limit the stack extent captured by future
|
Use @code{start-stack} to limit the stack extent captured by future
|
||||||
@code{make-stack} calls.
|
@code{make-stack} calls.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} make-stack obj . args
|
@deffn {Scheme Procedure} make-stack obj arg @dots{}
|
||||||
@deffnx {C Function} scm_make_stack (obj, args)
|
@deffnx {C Function} scm_make_stack (obj, args)
|
||||||
Create a new stack. If @var{obj} is @code{#t}, the current
|
Create a new stack. If @var{obj} is @code{#t}, the current
|
||||||
evaluation stack is used for creating the stack frames,
|
evaluation stack is used for creating the stack frames,
|
||||||
otherwise the frames are taken from @var{obj} (which must be
|
otherwise the frames are taken from @var{obj} (which must be
|
||||||
a continuation or a frame object).
|
a continuation or a frame object).
|
||||||
|
|
||||||
@var{args} should be a list containing any combination of
|
@var{arg} @dots{} can be any combination of integer, procedure, prompt
|
||||||
integer, procedure, prompt tag and @code{#t} values.
|
tag and @code{#t} values.
|
||||||
|
|
||||||
These values specify various ways of cutting away uninteresting
|
These values specify various ways of cutting away uninteresting
|
||||||
stack frames from the top and bottom of the stack that
|
stack frames from the top and bottom of the stack that
|
||||||
|
@ -96,7 +96,7 @@ stack frames from the top and bottom of the stack that
|
||||||
@code{(@var{inner_cut_1} @var{outer_cut_1} @var{inner_cut_2}
|
@code{(@var{inner_cut_1} @var{outer_cut_1} @var{inner_cut_2}
|
||||||
@var{outer_cut_2} @dots{})}.
|
@var{outer_cut_2} @dots{})}.
|
||||||
|
|
||||||
Each @var{inner_cut_N} can be @code{#t}, an integer, a prompt
|
Each @var{inner_cut_i} can be @code{#t}, an integer, a prompt
|
||||||
tag, or a procedure. @code{#t} means to cut away all frames up
|
tag, or a procedure. @code{#t} means to cut away all frames up
|
||||||
to but excluding the first user module frame. An integer means
|
to but excluding the first user module frame. An integer means
|
||||||
to cut away exactly that number of frames. A prompt tag means
|
to cut away exactly that number of frames. A prompt tag means
|
||||||
|
@ -105,14 +105,14 @@ tag. A procedure means to cut away all frames up to but
|
||||||
excluding the application frame whose procedure matches the
|
excluding the application frame whose procedure matches the
|
||||||
specified one.
|
specified one.
|
||||||
|
|
||||||
Each @var{outer_cut_N} can be an integer, a prompt tag, or a
|
Each @var{outer_cut_i} can be an integer, a prompt tag, or a
|
||||||
procedure. An integer means to cut away that number of frames.
|
procedure. An integer means to cut away that number of frames.
|
||||||
A prompt tag means to cut away all frames that are outside a
|
A prompt tag means to cut away all frames that are outside a
|
||||||
prompt with the given tag. A procedure means to cut away
|
prompt with the given tag. A procedure means to cut away
|
||||||
frames down to but excluding the application frame whose
|
frames down to but excluding the application frame whose
|
||||||
procedure matches the specified one.
|
procedure matches the specified one.
|
||||||
|
|
||||||
If the @var{outer_cut_N} of the last pair is missing, it is
|
If the @var{outer_cut_i} of the last pair is missing, it is
|
||||||
taken as 0.
|
taken as 0.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
|
@ -444,10 +444,10 @@ it as code.
|
||||||
@deffn {Scheme Procedure} eval exp module_or_state
|
@deffn {Scheme Procedure} eval exp module_or_state
|
||||||
@deffnx {C Function} scm_eval (exp, module_or_state)
|
@deffnx {C Function} scm_eval (exp, module_or_state)
|
||||||
Evaluate @var{exp}, a list representing a Scheme expression,
|
Evaluate @var{exp}, a list representing a Scheme expression,
|
||||||
in the top-level environment specified by @var{module}.
|
in the top-level environment specified by @var{module_or_state}.
|
||||||
While @var{exp} is evaluated (using @code{primitive-eval}),
|
While @var{exp} is evaluated (using @code{primitive-eval}),
|
||||||
@var{module} is made the current module. The current module
|
@var{module_or_state} is made the current module. The current module
|
||||||
is reset to its previous value when @var{eval} returns.
|
is reset to its previous value when @code{eval} returns.
|
||||||
XXX - dynamic states.
|
XXX - dynamic states.
|
||||||
Example: (eval '(+ 1 2) (interaction-environment))
|
Example: (eval '(+ 1 2) (interaction-environment))
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -504,23 +504,22 @@ eval-string)}, evaluating within @var{module} or the current module.
|
||||||
of an @code{SCM}.
|
of an @code{SCM}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} apply proc arg1 @dots{} argN arglst
|
@deffn {Scheme Procedure} apply proc arg @dots{} arglst
|
||||||
@deffnx {C Function} scm_apply_0 (proc, arglst)
|
@deffnx {C Function} scm_apply_0 (proc, arglst)
|
||||||
@deffnx {C Function} scm_apply_1 (proc, arg1, arglst)
|
@deffnx {C Function} scm_apply_1 (proc, arg1, arglst)
|
||||||
@deffnx {C Function} scm_apply_2 (proc, arg1, arg2, arglst)
|
@deffnx {C Function} scm_apply_2 (proc, arg1, arg2, arglst)
|
||||||
@deffnx {C Function} scm_apply_3 (proc, arg1, arg2, arg3, arglst)
|
@deffnx {C Function} scm_apply_3 (proc, arg1, arg2, arg3, arglst)
|
||||||
@deffnx {C Function} scm_apply (proc, arg, rest)
|
@deffnx {C Function} scm_apply (proc, arg, rest)
|
||||||
@rnindex apply
|
@rnindex apply
|
||||||
Call @var{proc} with arguments @var{arg1} @dots{} @var{argN} plus the
|
Call @var{proc} with arguments @var{arg} @dots{} and the
|
||||||
elements of the @var{arglst} list.
|
elements of the @var{arglst} list.
|
||||||
|
|
||||||
@code{scm_apply} takes parameters corresponding to a Scheme level
|
@code{scm_apply} takes parameters corresponding to a Scheme level
|
||||||
@code{(lambda (proc arg . rest) ...)}. So @var{arg} and all but the
|
@code{(lambda (proc arg1 . rest) ...)}. So @var{arg1} and all but the
|
||||||
last element of the @var{rest} list make up
|
last element of the @var{rest} list make up @var{arg} @dots{}, and the
|
||||||
@var{arg1}@dots{}@var{argN} and the last element of @var{rest} is the
|
last element of @var{rest} is the @var{arglst} list. Or if @var{rest}
|
||||||
@var{arglst} list. Or if @var{rest} is the empty list @code{SCM_EOL}
|
is the empty list @code{SCM_EOL} then there's no @var{arg} @dots{}, and
|
||||||
then there's no @var{arg1}@dots{}@var{argN} and @var{arg} is the
|
(@var{arg1}) is the @var{arglst}.
|
||||||
@var{arglst}.
|
|
||||||
|
|
||||||
@var{arglst} is not modified, but the @var{rest} list passed to
|
@var{arglst} is not modified, but the @var{rest} list passed to
|
||||||
@code{scm_apply} is modified.
|
@code{scm_apply} is modified.
|
||||||
|
@ -645,6 +644,7 @@ name is as for @code{compile-file} (see below).
|
||||||
|
|
||||||
@item -W @var{warning}
|
@item -W @var{warning}
|
||||||
@itemx --warn=@var{warning}
|
@itemx --warn=@var{warning}
|
||||||
|
@cindex warnings, compiler
|
||||||
Emit warnings of type @var{warning}; use @code{--warn=help} for a list
|
Emit warnings of type @var{warning}; use @code{--warn=help} for a list
|
||||||
of available warnings and their description. Currently recognized
|
of available warnings and their description. Currently recognized
|
||||||
warnings include @code{unused-variable}, @code{unused-toplevel},
|
warnings include @code{unused-variable}, @code{unused-toplevel},
|
||||||
|
@ -1012,7 +1012,7 @@ by @code{file-encoding}, if any, again by using
|
||||||
@code{set-port-encoding!}. Then the code can be read as normal.
|
@code{set-port-encoding!}. Then the code can be read as normal.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} file-encoding port
|
@deffn {Scheme Procedure} file-encoding port
|
||||||
@deffnx {C Function} scm_file_encoding port
|
@deffnx {C Function} scm_file_encoding (port)
|
||||||
Scan the port for an Emacs-like character coding declaration near the
|
Scan the port for an Emacs-like character coding declaration near the
|
||||||
top of the contents of a port with random-accessible contents
|
top of the contents of a port with random-accessible contents
|
||||||
(@pxref{Recognize Coding, how Emacs recognizes file encoding,, emacs,
|
(@pxref{Recognize Coding, how Emacs recognizes file encoding,, emacs,
|
||||||
|
|
|
@ -540,7 +540,7 @@ A value returned by @code{dynamic-pointer} is a Scheme wrapper for a C
|
||||||
pointer.
|
pointer.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} pointer-address pointer
|
@deffn {Scheme Procedure} pointer-address pointer
|
||||||
@deffnx {C Function} scm_pointer_address pointer
|
@deffnx {C Function} scm_pointer_address (pointer)
|
||||||
Return the numerical value of @var{pointer}.
|
Return the numerical value of @var{pointer}.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
@ -594,7 +594,7 @@ module contains procedures that can be used to convert byte sequences to
|
||||||
Scheme objects such as strings, floating point numbers, or integers.
|
Scheme objects such as strings, floating point numbers, or integers.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} pointer->bytevector pointer len [offset [uvec_type]]
|
@deffn {Scheme Procedure} pointer->bytevector pointer len [offset [uvec_type]]
|
||||||
@deffnx {C Function} scm_foreign_to_bytevector pointer len offset uvec_type
|
@deffnx {C Function} scm_foreign_to_bytevector (pointer, len, offset, uvec_type)
|
||||||
Return a bytevector aliasing the @var{len} bytes pointed to by
|
Return a bytevector aliasing the @var{len} bytes pointed to by
|
||||||
@var{pointer}.
|
@var{pointer}.
|
||||||
|
|
||||||
|
@ -614,7 +614,7 @@ Mutating the returned bytevector mutates the memory pointed to by
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} bytevector->pointer bv [offset]
|
@deffn {Scheme Procedure} bytevector->pointer bv [offset]
|
||||||
@deffnx {C Function} scm_bytevector_to_pointer bv offset
|
@deffnx {C Function} scm_bytevector_to_pointer (bv, offset)
|
||||||
Return a pointer pointer aliasing the memory pointed to by @var{bv} or
|
Return a pointer pointer aliasing the memory pointed to by @var{bv} or
|
||||||
@var{offset} bytes after @var{bv} when @var{offset} is passed.
|
@var{offset} bytes after @var{bv} when @var{offset} is passed.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -740,7 +740,7 @@ its type, offset, and alignment. Guile has some primitives to support
|
||||||
this.
|
this.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} sizeof type
|
@deffn {Scheme Procedure} sizeof type
|
||||||
@deffnx {C Function} scm_sizeof type
|
@deffnx {C Function} scm_sizeof (type)
|
||||||
Return the size of @var{type}, in bytes.
|
Return the size of @var{type}, in bytes.
|
||||||
|
|
||||||
@var{type} should be a valid C type, like @code{int}.
|
@var{type} should be a valid C type, like @code{int}.
|
||||||
|
@ -751,7 +751,7 @@ also be a list of types, in which case the size of a
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} alignof type
|
@deffn {Scheme Procedure} alignof type
|
||||||
@deffnx {C Function} scm_alignof type
|
@deffnx {C Function} scm_alignof (type)
|
||||||
Return the alignment of @var{type}, in bytes.
|
Return the alignment of @var{type}, in bytes.
|
||||||
|
|
||||||
@var{type} should be a valid C type, like @code{int}.
|
@var{type} should be a valid C type, like @code{int}.
|
||||||
|
@ -801,7 +801,7 @@ Of course, the land of C is not all nouns and no verbs: there are
|
||||||
functions too, and Guile allows you to call them.
|
functions too, and Guile allows you to call them.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} pointer->procedure return_type func_ptr arg_types
|
@deffn {Scheme Procedure} pointer->procedure return_type func_ptr arg_types
|
||||||
@deffnx {C Procedure} scm_pointer_to_procedure return_type func_ptr arg_types
|
@deffnx {C Procedure} scm_pointer_to_procedure (return_type, func_ptr, arg_types)
|
||||||
Make a foreign function.
|
Make a foreign function.
|
||||||
|
|
||||||
Given the foreign void pointer @var{func_ptr}, its argument and
|
Given the foreign void pointer @var{func_ptr}, its argument and
|
||||||
|
|
|
@ -129,7 +129,7 @@ this fluid otherwise.
|
||||||
@end defvr
|
@end defvr
|
||||||
|
|
||||||
@deffn {Scheme Procedure} port-encoding port
|
@deffn {Scheme Procedure} port-encoding port
|
||||||
@deffnx {C Function} scm_port_encoding
|
@deffnx {C Function} scm_port_encoding (port)
|
||||||
Returns, as a string, the character encoding that @var{port} uses to interpret
|
Returns, as a string, the character encoding that @var{port} uses to interpret
|
||||||
its input and output. The value @code{#f} is equivalent to @code{"ISO-8859-1"}.
|
its input and output. The value @code{#f} is equivalent to @code{"ISO-8859-1"}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -251,7 +251,7 @@ sequence when the error is raised.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} unread-char cobj [port]
|
@deffn {Scheme Procedure} unread-char cobj [port]
|
||||||
@deffnx {C Function} scm_unread_char (cobj, port)
|
@deffnx {C Function} scm_unread_char (cobj, port)
|
||||||
Place @var{char} in @var{port} so that it will be read by the
|
Place character @var{cobj} in @var{port} so that it will be read by the
|
||||||
next read operation. If called multiple times, the unread characters
|
next read operation. If called multiple times, the unread characters
|
||||||
will be read again in last-in first-out order. If @var{port} is
|
will be read again in last-in first-out order. If @var{port} is
|
||||||
not supplied, the current input port is used.
|
not supplied, the current input port is used.
|
||||||
|
@ -343,7 +343,7 @@ the current output port.
|
||||||
@var{message} can contain @code{~A} (was @code{%s}) and
|
@var{message} can contain @code{~A} (was @code{%s}) and
|
||||||
@code{~S} (was @code{%S}) escapes. When printed,
|
@code{~S} (was @code{%S}) escapes. When printed,
|
||||||
the escapes are replaced with corresponding members of
|
the escapes are replaced with corresponding members of
|
||||||
@var{ARGS}:
|
@var{args}:
|
||||||
@code{~A} formats using @code{display} and @code{~S} formats
|
@code{~A} formats using @code{display} and @code{~S} formats
|
||||||
using @code{write}.
|
using @code{write}.
|
||||||
If @var{destination} is @code{#t}, then use the current output
|
If @var{destination} is @code{#t}, then use the current output
|
||||||
|
@ -426,7 +426,7 @@ open.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} seek fd_port offset whence
|
@deffn {Scheme Procedure} seek fd_port offset whence
|
||||||
@deffnx {C Function} scm_seek (fd_port, offset, whence)
|
@deffnx {C Function} scm_seek (fd_port, offset, whence)
|
||||||
Sets the current position of @var{fd/port} to the integer
|
Sets the current position of @var{fd_port} to the integer
|
||||||
@var{offset}, which is interpreted according to the value of
|
@var{offset}, which is interpreted according to the value of
|
||||||
@var{whence}.
|
@var{whence}.
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ Seek from the current position.
|
||||||
@defvar SEEK_END
|
@defvar SEEK_END
|
||||||
Seek from the end of the file.
|
Seek from the end of the file.
|
||||||
@end defvar
|
@end defvar
|
||||||
If @var{fd/port} is a file descriptor, the underlying system
|
If @var{fd_port} is a file descriptor, the underlying system
|
||||||
call is @code{lseek}. @var{port} may be a string port.
|
call is @code{lseek}. @var{port} may be a string port.
|
||||||
|
|
||||||
The value returned is the new position in the file. This means
|
The value returned is the new position in the file. This means
|
||||||
|
@ -454,7 +454,7 @@ that the current position of a port can be obtained using:
|
||||||
@deffn {Scheme Procedure} ftell fd_port
|
@deffn {Scheme Procedure} ftell fd_port
|
||||||
@deffnx {C Function} scm_ftell (fd_port)
|
@deffnx {C Function} scm_ftell (fd_port)
|
||||||
Return an integer representing the current position of
|
Return an integer representing the current position of
|
||||||
@var{fd/port}, measured from the beginning. Equivalent to:
|
@var{fd_port}, measured from the beginning. Equivalent to:
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(seek port 0 SEEK_CUR)
|
(seek port 0 SEEK_CUR)
|
||||||
|
@ -922,7 +922,7 @@ of the respective current port is restored.
|
||||||
The current port setting is managed with @code{dynamic-wind}, so the
|
The current port setting is managed with @code{dynamic-wind}, so the
|
||||||
previous value is restored no matter how @var{thunk} exits (eg.@: an
|
previous value is restored no matter how @var{thunk} exits (eg.@: an
|
||||||
exception), and if @var{thunk} is re-entered (via a captured
|
exception), and if @var{thunk} is re-entered (via a captured
|
||||||
continuation) then it's set again to the @var{FILENAME} port.
|
continuation) then it's set again to the @var{filename} port.
|
||||||
|
|
||||||
The port is closed when @var{thunk} returns normally, but not when
|
The port is closed when @var{thunk} returns normally, but not when
|
||||||
exited via an exception or new continuation. This ensures it's still
|
exited via an exception or new continuation. This ensures it's still
|
||||||
|
@ -1414,7 +1414,7 @@ This condition type could be defined by
|
||||||
An exception with this type is raised when one of the operations for
|
An exception with this type is raised when one of the operations for
|
||||||
textual output to a port encounters a character that cannot be
|
textual output to a port encounters a character that cannot be
|
||||||
translated into bytes by the output direction of the port's transcoder.
|
translated into bytes by the output direction of the port's transcoder.
|
||||||
@var{Char} is the character that could not be encoded.
|
@var{char} is the character that could not be encoded.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Syntax} error-handling-mode @var{error-handling-mode-symbol}
|
@deffn {Scheme Syntax} error-handling-mode @var{error-handling-mode-symbol}
|
||||||
|
@ -1430,7 +1430,7 @@ symbol acceptable as a @var{handling-mode} argument to
|
||||||
raised.
|
raised.
|
||||||
|
|
||||||
@quotation Note
|
@quotation Note
|
||||||
Only the name of @var{error-handling-style-symbol} is significant.
|
Only the name of @var{error-handling-mode-symbol} is significant.
|
||||||
@end quotation
|
@end quotation
|
||||||
|
|
||||||
The error-handling mode of a transcoder specifies the behavior
|
The error-handling mode of a transcoder specifies the behavior
|
||||||
|
@ -1470,7 +1470,7 @@ symbol; and @var{handling-mode}, if present, an error-handling-mode
|
||||||
symbol.
|
symbol.
|
||||||
|
|
||||||
@var{eol-style} may be omitted, in which case it defaults to the native
|
@var{eol-style} may be omitted, in which case it defaults to the native
|
||||||
end-of-line style of the underlying platform. @var{Handling-mode} may
|
end-of-line style of the underlying platform. @var{handling-mode} may
|
||||||
be omitted, in which case it defaults to @code{replace}. The result is
|
be omitted, in which case it defaults to @code{replace}. The result is
|
||||||
a transcoder with the behavior specified by its arguments.
|
a transcoder with the behavior specified by its arguments.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1566,11 +1566,11 @@ encoding. Likewise, Guile does not prevent use of
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} textual-port? port
|
@deffn {Scheme Procedure} textual-port? port
|
||||||
Always return @var{#t}, as all ports can be used for textual I/O in
|
Always return @code{#t}, as all ports can be used for textual I/O in
|
||||||
Guile.
|
Guile.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} transcoded-port obj
|
@deffn {Scheme Procedure} transcoded-port binary-port transcoder
|
||||||
The @code{transcoded-port} procedure
|
The @code{transcoded-port} procedure
|
||||||
returns a new textual port with the specified @var{transcoder}.
|
returns a new textual port with the specified @var{transcoder}.
|
||||||
Otherwise the new textual port's state is largely the same as
|
Otherwise the new textual port's state is largely the same as
|
||||||
|
@ -1629,12 +1629,12 @@ of @var{proc}. Return the return values of @var{proc}.
|
||||||
@node R6RS Input Ports
|
@node R6RS Input Ports
|
||||||
@subsubsection Input Ports
|
@subsubsection Input Ports
|
||||||
|
|
||||||
@deffn {Scheme Procedure} input-port? obj@
|
@deffn {Scheme Procedure} input-port? obj
|
||||||
Returns @code{#t} if the argument is an input port (or a combined input
|
Returns @code{#t} if the argument is an input port (or a combined input
|
||||||
and output port), and returns @code{#f} otherwise.
|
and output port), and returns @code{#f} otherwise.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} port-eof? port
|
@deffn {Scheme Procedure} port-eof? input-port
|
||||||
Returns @code{#t}
|
Returns @code{#t}
|
||||||
if the @code{lookahead-u8} procedure (if @var{input-port} is a binary port)
|
if the @code{lookahead-u8} procedure (if @var{input-port} is a binary port)
|
||||||
or the @code{lookahead-char} procedure (if @var{input-port} is a textual port)
|
or the @code{lookahead-char} procedure (if @var{input-port} is a textual port)
|
||||||
|
@ -1648,7 +1648,7 @@ but the port cannot be determined to be at end of file.
|
||||||
@deffnx {Scheme Procedure} open-file-input-port filename file-options
|
@deffnx {Scheme Procedure} open-file-input-port filename file-options
|
||||||
@deffnx {Scheme Procedure} open-file-input-port filename file-options buffer-mode
|
@deffnx {Scheme Procedure} open-file-input-port filename file-options buffer-mode
|
||||||
@deffnx {Scheme Procedure} open-file-input-port filename file-options buffer-mode maybe-transcoder
|
@deffnx {Scheme Procedure} open-file-input-port filename file-options buffer-mode maybe-transcoder
|
||||||
@var{Maybe-transcoder} must be either a transcoder or @code{#f}.
|
@var{maybe-transcoder} must be either a transcoder or @code{#f}.
|
||||||
|
|
||||||
The @code{open-file-input-port} procedure returns an
|
The @code{open-file-input-port} procedure returns an
|
||||||
input port for the named file. The @var{file-options} and
|
input port for the named file. The @var{file-options} and
|
||||||
|
@ -1718,13 +1718,13 @@ indicating the number of bytes read, or @code{0} to indicate the
|
||||||
end-of-file.
|
end-of-file.
|
||||||
|
|
||||||
Optionally, if @var{get-position} is not @code{#f}, it must be a thunk
|
Optionally, if @var{get-position} is not @code{#f}, it must be a thunk
|
||||||
that will be called when @var{port-position} is invoked on the custom
|
that will be called when @code{port-position} is invoked on the custom
|
||||||
binary port and should return an integer indicating the position within
|
binary port and should return an integer indicating the position within
|
||||||
the underlying data stream; if @var{get-position} was not supplied, the
|
the underlying data stream; if @var{get-position} was not supplied, the
|
||||||
returned port does not support @var{port-position}.
|
returned port does not support @code{port-position}.
|
||||||
|
|
||||||
Likewise, if @var{set-position!} is not @code{#f}, it should be a
|
Likewise, if @var{set-position!} is not @code{#f}, it should be a
|
||||||
one-argument procedure. When @var{set-port-position!} is invoked on the
|
one-argument procedure. When @code{set-port-position!} is invoked on the
|
||||||
custom binary input port, @var{set-position!} is passed an integer
|
custom binary input port, @var{set-position!} is passed an integer
|
||||||
indicating the position of the next byte is to read.
|
indicating the position of the next byte is to read.
|
||||||
|
|
||||||
|
@ -1806,7 +1806,7 @@ end-of-file object (if no data were available).
|
||||||
@node R6RS Textual Input
|
@node R6RS Textual Input
|
||||||
@subsubsection Textual Input
|
@subsubsection Textual Input
|
||||||
|
|
||||||
@deffn {Scheme Procedure} get-char port
|
@deffn {Scheme Procedure} get-char textual-input-port
|
||||||
Reads from @var{textual-input-port}, blocking as necessary, until a
|
Reads from @var{textual-input-port}, blocking as necessary, until a
|
||||||
complete character is available from @var{textual-input-port},
|
complete character is available from @var{textual-input-port},
|
||||||
or until an end of file is reached.
|
or until an end of file is reached.
|
||||||
|
@ -1817,14 +1817,14 @@ point past the character. If an end of file is reached before any
|
||||||
character is read, @code{get-char} returns the end-of-file object.
|
character is read, @code{get-char} returns the end-of-file object.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lookahead-char port
|
@deffn {Scheme Procedure} lookahead-char textual-input-port
|
||||||
The @code{lookahead-char} procedure is like @code{get-char}, but it does
|
The @code{lookahead-char} procedure is like @code{get-char}, but it does
|
||||||
not update @var{textual-input-port} to point past the character.
|
not update @var{textual-input-port} to point past the character.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} get-string-n port count
|
@deffn {Scheme Procedure} get-string-n textual-input-port count
|
||||||
|
|
||||||
@var{Count} must be an exact, non-negative integer object, representing
|
@var{count} must be an exact, non-negative integer object, representing
|
||||||
the number of characters to be read.
|
the number of characters to be read.
|
||||||
|
|
||||||
The @code{get-string-n} procedure reads from @var{textual-input-port},
|
The @code{get-string-n} procedure reads from @var{textual-input-port},
|
||||||
|
@ -1840,11 +1840,11 @@ to point just past the characters read. If no characters can be read
|
||||||
before an end of file, the end-of-file object is returned.
|
before an end of file, the end-of-file object is returned.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} get-string-n! port string start count
|
@deffn {Scheme Procedure} get-string-n! textual-input-port string start count
|
||||||
|
|
||||||
@var{Start} and @var{count} must be exact, non-negative integer objects,
|
@var{start} and @var{count} must be exact, non-negative integer objects,
|
||||||
with @var{count} representing the number of characters to be read.
|
with @var{count} representing the number of characters to be read.
|
||||||
@var{String} must be a string with at least $@var{start} + @var{count}$
|
@var{string} must be a string with at least $@var{start} + @var{count}$
|
||||||
characters.
|
characters.
|
||||||
|
|
||||||
The @code{get-string-n!} procedure reads from @var{textual-input-port}
|
The @code{get-string-n!} procedure reads from @var{textual-input-port}
|
||||||
|
@ -1858,7 +1858,7 @@ exact integer object. If no characters can be read before an end of
|
||||||
file, the end-of-file object is returned.
|
file, the end-of-file object is returned.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} get-string-all port count
|
@deffn {Scheme Procedure} get-string-all textual-input-port count
|
||||||
Reads from @var{textual-input-port} until an end of file, decoding
|
Reads from @var{textual-input-port} until an end of file, decoding
|
||||||
characters in the same manner as @code{get-string-n} and
|
characters in the same manner as @code{get-string-n} and
|
||||||
@code{get-string-n!}.
|
@code{get-string-n!}.
|
||||||
|
@ -1868,7 +1868,7 @@ all the characters decoded from that data are returned. If no character
|
||||||
precedes the end of file, the end-of-file object is returned.
|
precedes the end of file, the end-of-file object is returned.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} get-line port
|
@deffn {Scheme Procedure} get-line textual-input-port
|
||||||
Reads from @var{textual-input-port} up to and including the linefeed
|
Reads from @var{textual-input-port} up to and including the linefeed
|
||||||
character or end of file, decoding characters in the same manner as
|
character or end of file, decoding characters in the same manner as
|
||||||
@code{get-string-n} and @code{get-string-n!}.
|
@code{get-string-n} and @code{get-string-n!}.
|
||||||
|
@ -1887,7 +1887,7 @@ any characters are read, the end-of-file object is returned.
|
||||||
@end quotation
|
@end quotation
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} get-datum port count
|
@deffn {Scheme Procedure} get-datum textual-input-port count
|
||||||
Reads an external representation from @var{textual-input-port} and returns the
|
Reads an external representation from @var{textual-input-port} and returns the
|
||||||
datum it represents. The @code{get-datum} procedure returns the next
|
datum it represents. The @code{get-datum} procedure returns the next
|
||||||
datum that can be parsed from the given @var{textual-input-port}, updating
|
datum that can be parsed from the given @var{textual-input-port}, updating
|
||||||
|
@ -2048,7 +2048,7 @@ Writes @var{char} to the port. The @code{put-char} procedure returns
|
||||||
@code{put-string} procedure returns an unspecified value.
|
@code{put-string} procedure returns an unspecified value.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} put-datum port datum
|
@deffn {Scheme Procedure} put-datum textual-output-port datum
|
||||||
@var{datum} should be a datum value. The @code{put-datum} procedure
|
@var{datum} should be a datum value. The @code{put-datum} procedure
|
||||||
writes an external representation of @var{datum} to
|
writes an external representation of @var{datum} to
|
||||||
@var{textual-output-port}. The specific external representation is
|
@var{textual-output-port}. The specific external representation is
|
||||||
|
|
|
@ -81,8 +81,9 @@ source code will invoke the syntax transformer defined by @var{transformer}.
|
||||||
|
|
||||||
One can also establish local syntactic bindings with @code{let-syntax}.
|
One can also establish local syntactic bindings with @code{let-syntax}.
|
||||||
|
|
||||||
@deffn {Syntax} let-syntax ((keyword transformer) ...) exp...
|
@deffn {Syntax} let-syntax ((keyword transformer) @dots{}) exp1 exp2 @dots{}
|
||||||
Bind @var{keyword...} to @var{transformer...} while expanding @var{exp...}.
|
Bind each @var{keyword} to its corresponding @var{transformer} while
|
||||||
|
expanding @var{exp1} @var{exp2} @enddots{}.
|
||||||
|
|
||||||
A @code{let-syntax} binding only exists at expansion-time.
|
A @code{let-syntax} binding only exists at expansion-time.
|
||||||
|
|
||||||
|
@ -104,8 +105,9 @@ top-level, or locally. Just as a local @code{define} expands out to an instance
|
||||||
of @code{letrec}, a local @code{define-syntax} expands out to
|
of @code{letrec}, a local @code{define-syntax} expands out to
|
||||||
@code{letrec-syntax}.
|
@code{letrec-syntax}.
|
||||||
|
|
||||||
@deffn {Syntax} letrec-syntax ((keyword transformer) ...) exp...
|
@deffn {Syntax} letrec-syntax ((keyword transformer) @dots{}) exp1 exp2 @dots{}
|
||||||
Bind @var{keyword...} to @var{transformer...} while expanding @var{exp...}.
|
Bind each @var{keyword} to its corresponding @var{transformer} while
|
||||||
|
expanding @var{exp1} @var{exp2} @enddots{}.
|
||||||
|
|
||||||
In the spirit of @code{letrec} versus @code{let}, an expansion produced by
|
In the spirit of @code{letrec} versus @code{let}, an expansion produced by
|
||||||
@var{transformer} may reference a @var{keyword} bound by the
|
@var{transformer} may reference a @var{keyword} bound by the
|
||||||
|
|
|
@ -398,7 +398,7 @@ set to @var{fill}. The default value for @var{fill} is the
|
||||||
empty list.
|
empty list.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} weak-vector . l
|
@deffn {Scheme Procedure} weak-vector elem @dots{}
|
||||||
@deffnx {Scheme Procedure} list->weak-vector l
|
@deffnx {Scheme Procedure} list->weak-vector l
|
||||||
@deffnx {C Function} scm_weak_vector (l)
|
@deffnx {C Function} scm_weak_vector (l)
|
||||||
Construct a weak vector from a list: @code{weak-vector} uses
|
Construct a weak vector from a list: @code{weak-vector} uses
|
||||||
|
|
|
@ -250,7 +250,7 @@ Export all bindings which should be in the public interface, either
|
||||||
by using @code{define-public} or @code{export} (both documented below).
|
by using @code{define-public} or @code{export} (both documented below).
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@deffn syntax define-module module-name [options @dots{}]
|
@deffn syntax define-module module-name option @dots{}
|
||||||
@var{module-name} is a list of one or more symbols.
|
@var{module-name} is a list of one or more symbols.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
|
@ -260,8 +260,8 @@ by using @code{define-public} or @code{export} (both documented below).
|
||||||
@code{define-module} makes this module available to Guile programs under
|
@code{define-module} makes this module available to Guile programs under
|
||||||
the given @var{module-name}.
|
the given @var{module-name}.
|
||||||
|
|
||||||
The @var{options} are keyword/value pairs which specify more about the
|
@var{option} @dots{} are keyword/value pairs which specify more about the
|
||||||
defined module. The recognized options and their meaning is shown in
|
defined module. The recognized options and their meaning are shown in
|
||||||
the following table.
|
the following table.
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
|
@ -962,7 +962,7 @@ SCM my_eval_string (SCM str)
|
||||||
Like @code{scm_public_lookup} or @code{scm_private_lookup}, but
|
Like @code{scm_public_lookup} or @code{scm_private_lookup}, but
|
||||||
additionally dereferences the variable. If the variable object is
|
additionally dereferences the variable. If the variable object is
|
||||||
unbound, signals an error. Returns the value bound to @var{name} in
|
unbound, signals an error. Returns the value bound to @var{name} in
|
||||||
@var{module}.
|
@var{module_name}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
In addition, there are a number of other lookup-related procedures. We
|
In addition, there are a number of other lookup-related procedures. We
|
||||||
|
@ -1009,7 +1009,7 @@ module is used instead of the current one.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_module_reverse_lookup (SCM @var{module}, SCM @var{variable})
|
@deftypefn {C Function} SCM scm_module_reverse_lookup (SCM @var{module}, SCM @var{variable})
|
||||||
Find the symbol that is bound to @var{variable} in @var{module}. When no such binding is found, return @var{#f}.
|
Find the symbol that is bound to @var{variable} in @var{module}. When no such binding is found, return @code{#f}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_c_define_module ({const char *}@var{name}, void (*@var{init})(void *), void *@var{data})
|
@deftypefn {C Function} SCM scm_c_define_module ({const char *}@var{name}, void (*@var{init})(void *), void *@var{data})
|
||||||
|
|
|
@ -103,7 +103,7 @@ useful mechanism, combining the process of registration
|
||||||
(@code{scm_c_make_gsubr}) and definition (@code{scm_define}).
|
(@code{scm_c_make_gsubr}) and definition (@code{scm_define}).
|
||||||
|
|
||||||
@deftypefun SCM scm_c_make_gsubr (const char *name, int req, int opt, int rst, fcn)
|
@deftypefun SCM scm_c_make_gsubr (const char *name, int req, int opt, int rst, fcn)
|
||||||
Register a C procedure @var{FCN} as a ``subr'' --- a primitive
|
Register a C procedure @var{fcn} as a ``subr'' --- a primitive
|
||||||
subroutine that can be called from Scheme. It will be associated with
|
subroutine that can be called from Scheme. It will be associated with
|
||||||
the given @var{name} but no environment binding will be created. The
|
the given @var{name} but no environment binding will be created. The
|
||||||
arguments @var{req}, @var{opt} and @var{rst} specify the number of
|
arguments @var{req}, @var{opt} and @var{rst} specify the number of
|
||||||
|
@ -115,7 +115,7 @@ to @var{fcn}, but may not exceed 10. The number of rest arguments should be 0 o
|
||||||
@end deftypefun
|
@end deftypefun
|
||||||
|
|
||||||
@deftypefun SCM scm_c_define_gsubr (const char *name, int req, int opt, int rst, fcn)
|
@deftypefun SCM scm_c_define_gsubr (const char *name, int req, int opt, int rst, fcn)
|
||||||
Register a C procedure @var{FCN}, as for @code{scm_c_make_gsubr}
|
Register a C procedure @var{fcn}, as for @code{scm_c_make_gsubr}
|
||||||
above, and additionally create a top-level Scheme binding for the
|
above, and additionally create a top-level Scheme binding for the
|
||||||
procedure in the ``current environment'' using @code{scm_define}.
|
procedure in the ``current environment'' using @code{scm_define}.
|
||||||
@code{scm_c_define_gsubr} returns a handle for the procedure in the
|
@code{scm_c_define_gsubr} returns a handle for the procedure in the
|
||||||
|
@ -418,8 +418,8 @@ elements. @code{let-optional} binds all variables simultaneously, while
|
||||||
@code{let-optional*} binds them sequentially, consistent with @code{let}
|
@code{let-optional*} binds them sequentially, consistent with @code{let}
|
||||||
and @code{let*} (@pxref{Local Bindings}).
|
and @code{let*} (@pxref{Local Bindings}).
|
||||||
|
|
||||||
@deffn {library syntax} let-optional rest-arg (binding @dots{}) expr @dots{}
|
@deffn {library syntax} let-optional rest-arg (binding @dots{}) body1 body2 @dots{}
|
||||||
@deffnx {library syntax} let-optional* rest-arg (binding @dots{}) expr @dots{}
|
@deffnx {library syntax} let-optional* rest-arg (binding @dots{}) body1 body2 @dots{}
|
||||||
These two macros give you an optional argument interface that is very
|
These two macros give you an optional argument interface that is very
|
||||||
@dfn{Schemey} and introduces no fancy syntax. They are compatible with
|
@dfn{Schemey} and introduces no fancy syntax. They are compatible with
|
||||||
the scsh macros of the same name, but are slightly extended. Each of
|
the scsh macros of the same name, but are slightly extended. Each of
|
||||||
|
@ -431,22 +431,22 @@ runs out, the remaining vars are bound either to the default values or
|
||||||
@code{#f} if no default value was specified. @var{rest-arg} remains
|
@code{#f} if no default value was specified. @var{rest-arg} remains
|
||||||
bound to whatever may have been left of @var{rest-arg}.
|
bound to whatever may have been left of @var{rest-arg}.
|
||||||
|
|
||||||
After binding the variables, the expressions @var{expr} @dots{} are
|
After binding the variables, the expressions @var{body1} @var{body2} @dots{}
|
||||||
evaluated in order.
|
are evaluated in order.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
Similarly, @code{let-keywords} and @code{let-keywords*} extract values
|
Similarly, @code{let-keywords} and @code{let-keywords*} extract values
|
||||||
from keyword style argument lists, binding local variables to those
|
from keyword style argument lists, binding local variables to those
|
||||||
values or to defaults.
|
values or to defaults.
|
||||||
|
|
||||||
@deffn {library syntax} let-keywords args allow-other-keys? (binding @dots{}) body @dots{}
|
@deffn {library syntax} let-keywords args allow-other-keys? (binding @dots{}) body1 body2 @dots{}
|
||||||
@deffnx {library syntax} let-keywords* args allow-other-keys? (binding @dots{}) body @dots{}
|
@deffnx {library syntax} let-keywords* args allow-other-keys? (binding @dots{}) body1 body2 @dots{}
|
||||||
@var{args} is evaluated and should give a list of the form
|
@var{args} is evaluated and should give a list of the form
|
||||||
@code{(#:keyword1 value1 #:keyword2 value2 @dots{})}. The
|
@code{(#:keyword1 value1 #:keyword2 value2 @dots{})}. The
|
||||||
@var{binding}s are variables and default expressions, with the
|
@var{binding}s are variables and default expressions, with the variables
|
||||||
variables to be set (by name) from the keyword values. The @var{body}
|
to be set (by name) from the keyword values. The @var{body1}
|
||||||
forms are then evaluated and the last is the result. An example will
|
@var{body2} @dots{} forms are then evaluated and the last is the
|
||||||
make the syntax clearest,
|
result. An example will make the syntax clearest,
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(define args '(#:xyzzy "hello" #:foo "world"))
|
(define args '(#:xyzzy "hello" #:foo "world"))
|
||||||
|
@ -478,12 +478,12 @@ exist for defining macros with the improved argument list handling
|
||||||
possibilities. The @code{-public} versions not only define the
|
possibilities. The @code{-public} versions not only define the
|
||||||
procedures/macros, but also export them from the current module.
|
procedures/macros, but also export them from the current module.
|
||||||
|
|
||||||
@deffn {library syntax} define*-public formals body
|
@deffn {library syntax} define*-public formals body1 body2 @dots{}
|
||||||
Like a mix of @code{define*} and @code{define-public}.
|
Like a mix of @code{define*} and @code{define-public}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {library syntax} defmacro* name formals body
|
@deffn {library syntax} defmacro* name formals body1 body2 @dots{}
|
||||||
@deffnx {library syntax} defmacro*-public name formals body
|
@deffnx {library syntax} defmacro*-public name formals body1 body2 @dots{}
|
||||||
These are just like @code{defmacro} and @code{defmacro-public} except that they
|
These are just like @code{defmacro} and @code{defmacro-public} except that they
|
||||||
take @code{lambda*}-style extended parameter lists, where @code{#:optional},
|
take @code{lambda*}-style extended parameter lists, where @code{#:optional},
|
||||||
@code{#:key}, @code{#:allow-other-keys} and @code{#:rest} are allowed with the usual
|
@code{#:key}, @code{#:allow-other-keys} and @code{#:rest} are allowed with the usual
|
||||||
|
@ -611,10 +611,11 @@ Return a procedure with the same arity as @var{proc} that returns the
|
||||||
@end lisp
|
@end lisp
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} compose proc rest ...
|
@deffn {Scheme Procedure} compose proc1 proc2 @dots{}
|
||||||
Compose @var{proc} with the procedures in @var{rest}, such that the last
|
Compose @var{proc1} with the procedures @var{proc2} @dots{} such that
|
||||||
one in @var{rest} is applied first and @var{proc} last, and return the
|
the last @var{proc} argument is applied first and @var{proc1} last, and
|
||||||
resulting procedure. The given procedures must have compatible arity.
|
return the resulting procedure. The given procedures must have
|
||||||
|
compatible arity.
|
||||||
|
|
||||||
@lisp
|
@lisp
|
||||||
(procedure? (compose 1+ 1-)) @result{} #t
|
(procedure? (compose 1+ 1-)) @result{} #t
|
||||||
|
@ -835,9 +836,9 @@ making large procedures inlinable will probably result in an increase in
|
||||||
code size. Additionally, the elimination of the call overhead rarely
|
code size. Additionally, the elimination of the call overhead rarely
|
||||||
matters for large procedures.
|
matters for large procedures.
|
||||||
|
|
||||||
@deffn {Scheme Syntax} define-inlinable (name parameter ...) body ...
|
@deffn {Scheme Syntax} define-inlinable (name parameter @dots{}) body1 body2 @dots{}
|
||||||
Define @var{name} as a procedure with parameters @var{parameter}s and
|
Define @var{name} as a procedure with parameters @var{parameter}s and
|
||||||
body @var{body}.
|
bodies @var{body1}, @var{body2}, @enddots{}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@c Local Variables:
|
@c Local Variables:
|
||||||
|
|
|
@ -228,7 +228,7 @@ and replace them with the contents of another string. The following
|
||||||
functions are convenient ways to do this.
|
functions are convenient ways to do this.
|
||||||
|
|
||||||
@c begin (scm-doc-string "regex.scm" "regexp-substitute")
|
@c begin (scm-doc-string "regex.scm" "regexp-substitute")
|
||||||
@deffn {Scheme Procedure} regexp-substitute port match [item@dots{}]
|
@deffn {Scheme Procedure} regexp-substitute port match item @dots{}
|
||||||
Write to @var{port} selected parts of the match structure @var{match}.
|
Write to @var{port} selected parts of the match structure @var{match}.
|
||||||
Or if @var{port} is @code{#f} then form a string from those parts and
|
Or if @var{port} is @code{#f} then form a string from those parts and
|
||||||
return that.
|
return that.
|
||||||
|
@ -276,7 +276,7 @@ re-ordering and hyphenating the fields.
|
||||||
|
|
||||||
|
|
||||||
@c begin (scm-doc-string "regex.scm" "regexp-substitute")
|
@c begin (scm-doc-string "regex.scm" "regexp-substitute")
|
||||||
@deffn {Scheme Procedure} regexp-substitute/global port regexp target [item@dots{}]
|
@deffn {Scheme Procedure} regexp-substitute/global port regexp target item@dots{}
|
||||||
@cindex search and replace
|
@cindex search and replace
|
||||||
Write to @var{port} selected parts of matches of @var{regexp} in
|
Write to @var{port} selected parts of matches of @var{regexp} in
|
||||||
@var{target}. If @var{port} is @code{#f} then form a string from
|
@var{target}. If @var{port} is @code{#f} then form a string from
|
||||||
|
|
|
@ -316,15 +316,15 @@ Higher level thread procedures are available by loading the
|
||||||
@code{(ice-9 threads)} module. These provide standardized
|
@code{(ice-9 threads)} module. These provide standardized
|
||||||
thread creation.
|
thread creation.
|
||||||
|
|
||||||
@deffn macro make-thread proc [args@dots{}]
|
@deffn macro make-thread proc arg @dots{}
|
||||||
Apply @var{proc} to @var{args} in a new thread formed by
|
Apply @var{proc} to @var{arg} @dots{} in a new thread formed by
|
||||||
@code{call-with-new-thread} using a default error handler that display
|
@code{call-with-new-thread} using a default error handler that display
|
||||||
the error to the current error port. The @var{args@dots{}}
|
the error to the current error port. The @var{arg} @dots{}
|
||||||
expressions are evaluated in the new thread.
|
expressions are evaluated in the new thread.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn macro begin-thread first [rest@dots{}]
|
@deffn macro begin-thread expr1 expr2 @dots{}
|
||||||
Evaluate forms @var{first} and @var{rest} in a new thread formed by
|
Evaluate forms @var{expr1} @var{expr2} @dots{} in a new thread formed by
|
||||||
@code{call-with-new-thread} using a default error handler that display
|
@code{call-with-new-thread} using a default error handler that display
|
||||||
the error to the current error port.
|
the error to the current error port.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -353,10 +353,10 @@ Acquiring requisite mutexes in a fixed order (like always A before B)
|
||||||
in all threads is one way to avoid such problems.
|
in all threads is one way to avoid such problems.
|
||||||
|
|
||||||
@sp 1
|
@sp 1
|
||||||
@deffn {Scheme Procedure} make-mutex . flags
|
@deffn {Scheme Procedure} make-mutex flag @dots{}
|
||||||
@deffnx {C Function} scm_make_mutex ()
|
@deffnx {C Function} scm_make_mutex ()
|
||||||
@deffnx {C Function} scm_make_mutex_with_flags (SCM flags)
|
@deffnx {C Function} scm_make_mutex_with_flags (SCM flags)
|
||||||
Return a new mutex. It is initially unlocked. If @var{flags} is
|
Return a new mutex. It is initially unlocked. If @var{flag} @dots{} is
|
||||||
specified, it must be a list of symbols specifying configuration flags
|
specified, it must be a list of symbols specifying configuration flags
|
||||||
for the newly-created mutex. The supported flags are:
|
for the newly-created mutex. The supported flags are:
|
||||||
@table @code
|
@table @code
|
||||||
|
@ -523,25 +523,25 @@ available from
|
||||||
(use-modules (ice-9 threads))
|
(use-modules (ice-9 threads))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@deffn macro with-mutex mutex [body@dots{}]
|
@deffn macro with-mutex mutex body1 body2 @dots{}
|
||||||
Lock @var{mutex}, evaluate the @var{body} forms, then unlock
|
Lock @var{mutex}, evaluate the body @var{body1} @var{body2} @dots{},
|
||||||
@var{mutex}. The return value is the return from the last @var{body}
|
then unlock @var{mutex}. The return value is that returned by the last
|
||||||
form.
|
body form.
|
||||||
|
|
||||||
The lock, body and unlock form the branches of a @code{dynamic-wind}
|
The lock, body and unlock form the branches of a @code{dynamic-wind}
|
||||||
(@pxref{Dynamic Wind}), so @var{mutex} is automatically unlocked if an
|
(@pxref{Dynamic Wind}), so @var{mutex} is automatically unlocked if an
|
||||||
error or new continuation exits @var{body}, and is re-locked if
|
error or new continuation exits the body, and is re-locked if
|
||||||
@var{body} is re-entered by a captured continuation.
|
the body is re-entered by a captured continuation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn macro monitor body@dots{}
|
@deffn macro monitor body1 body2 @dots{}
|
||||||
Evaluate the @var{body} forms, with a mutex locked so only one thread
|
Evaluate the body form @var{body1} @var{body2} @dots{} with a mutex
|
||||||
can execute that code at any one time. The return value is the return
|
locked so only one thread can execute that code at any one time. The
|
||||||
from the last @var{body} form.
|
return value is the return from the last body form.
|
||||||
|
|
||||||
Each @code{monitor} form has its own private mutex and the locking and
|
Each @code{monitor} form has its own private mutex and the locking and
|
||||||
evaluation is as per @code{with-mutex} above. A standard mutex
|
evaluation is as per @code{with-mutex} above. A standard mutex
|
||||||
(@code{make-mutex}) is used, which means @var{body} must not
|
(@code{make-mutex}) is used, which means the body must not
|
||||||
recursively re-enter the @code{monitor} form.
|
recursively re-enter the @code{monitor} form.
|
||||||
|
|
||||||
The term ``monitor'' comes from operating system theory, where it
|
The term ``monitor'' comes from operating system theory, where it
|
||||||
|
@ -751,12 +751,12 @@ set/restored when control enter or leaves the established dynamic
|
||||||
extent.
|
extent.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Macro} with-fluids ((fluid value) ...) body...
|
@deffn {Scheme Macro} with-fluids ((fluid value) @dots{}) body1 body2 @dots{}
|
||||||
Execute @var{body...} while each @var{fluid} is set to the
|
Execute body @var{body1} @var{body2} @dots{} while each @var{fluid} is
|
||||||
corresponding @var{value}. Both @var{fluid} and @var{value} are
|
set to the corresponding @var{value}. Both @var{fluid} and @var{value}
|
||||||
evaluated and @var{fluid} must yield a fluid. @var{body...} is
|
are evaluated and @var{fluid} must yield a fluid. The body is executed
|
||||||
executed inside a @code{dynamic-wind} and the fluids are set/restored
|
inside a @code{dynamic-wind} and the fluids are set/restored when
|
||||||
when control enter or leaves the established dynamic extent.
|
control enter or leaves the established dynamic extent.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deftypefn {C Function} SCM scm_c_with_fluids (SCM fluids, SCM vals, SCM (*cproc)(void *), void *data)
|
@deftypefn {C Function} SCM scm_c_with_fluids (SCM fluids, SCM vals, SCM (*cproc)(void *), void *data)
|
||||||
|
@ -890,11 +890,11 @@ canonical form. For example,
|
||||||
@end example
|
@end example
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@deffn {Scheme Syntax} parameterize ((param value) @dots{}) body @dots{}
|
@deffn {library syntax} parameterize ((param value) @dots{}) body1 body2 @dots{}
|
||||||
Establish a new dynamic scope with the given @var{param}s bound to new
|
Establish a new dynamic scope with the given @var{param}s bound to new
|
||||||
locations and set to the given @var{value}s. @var{body} is evaluated
|
locations and set to the given @var{value}s. @var{body1} @var{body2}
|
||||||
in that environment, the result is the return from the last form in
|
@dots{} is evaluated in that environment. The value returned is that of
|
||||||
@var{body}.
|
last body form.
|
||||||
|
|
||||||
Each @var{param} is an expression which is evaluated to get the
|
Each @var{param} is an expression which is evaluated to get the
|
||||||
parameter object. Often this will just be the name of a variable
|
parameter object. Often this will just be the name of a variable
|
||||||
|
@ -1043,33 +1043,32 @@ are implemented in terms of futures (@pxref{Futures}). Thus they are
|
||||||
relatively cheap as they re-use existing threads, and portable, since
|
relatively cheap as they re-use existing threads, and portable, since
|
||||||
they automatically use one thread per available CPU core.
|
they automatically use one thread per available CPU core.
|
||||||
|
|
||||||
@deffn syntax parallel expr1 @dots{} exprN
|
@deffn syntax parallel expr @dots{}
|
||||||
Evaluate each @var{expr} expression in parallel, each in its own thread.
|
Evaluate each @var{expr} expression in parallel, each in its own thread.
|
||||||
Return the results as a set of @var{N} multiple values
|
Return the results of @var{n} expressions as a set of @var{n} multiple
|
||||||
(@pxref{Multiple Values}).
|
values (@pxref{Multiple Values}).
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn syntax letpar ((var1 expr1) @dots{} (varN exprN)) body@dots{}
|
@deffn syntax letpar ((var expr) @dots{}) body1 body2 @dots{}
|
||||||
Evaluate each @var{expr} in parallel, each in its own thread, then bind
|
Evaluate each @var{expr} in parallel, each in its own thread, then bind
|
||||||
the results to the corresponding @var{var} variables and evaluate
|
the results to the corresponding @var{var} variables, and then evaluate
|
||||||
@var{body}.
|
@var{body1} @var{body2} @enddots{}
|
||||||
|
|
||||||
@code{letpar} is like @code{let} (@pxref{Local Bindings}), but all the
|
@code{letpar} is like @code{let} (@pxref{Local Bindings}), but all the
|
||||||
expressions for the bindings are evaluated in parallel.
|
expressions for the bindings are evaluated in parallel.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} par-map proc lst1 @dots{} lstN
|
@deffn {Scheme Procedure} par-map proc lst1 lst2 @dots{}
|
||||||
@deffnx {Scheme Procedure} par-for-each proc lst1 @dots{} lstN
|
@deffnx {Scheme Procedure} par-for-each proc lst1 lst2 @dots{}
|
||||||
Call @var{proc} on the elements of the given lists. @code{par-map}
|
Call @var{proc} on the elements of the given lists. @code{par-map}
|
||||||
returns a list comprising the return values from @var{proc}.
|
returns a list comprising the return values from @var{proc}.
|
||||||
@code{par-for-each} returns an unspecified value, but waits for all
|
@code{par-for-each} returns an unspecified value, but waits for all
|
||||||
calls to complete.
|
calls to complete.
|
||||||
|
|
||||||
The @var{proc} calls are @code{(@var{proc} @var{elem1} @dots{}
|
The @var{proc} calls are @code{(@var{proc} @var{elem1} @var{elem2}
|
||||||
@var{elemN})}, where each @var{elem} is from the corresponding
|
@dots{})}, where each @var{elem} is from the corresponding @var{lst} .
|
||||||
@var{lst}. Each @var{lst} must be the same length. The calls are
|
Each @var{lst} must be the same length. The calls are potentially made
|
||||||
potentially made in parallel, depending on the number of CPU cores
|
in parallel, depending on the number of CPU cores available.
|
||||||
available.
|
|
||||||
|
|
||||||
These functions are like @code{map} and @code{for-each} (@pxref{List
|
These functions are like @code{map} and @code{for-each} (@pxref{List
|
||||||
Mapping}), but make their @var{proc} calls in parallel.
|
Mapping}), but make their @var{proc} calls in parallel.
|
||||||
|
@ -1085,8 +1084,8 @@ completion, which makes them quite expensive.
|
||||||
|
|
||||||
Therefore, they should be avoided.
|
Therefore, they should be avoided.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} n-par-map n proc lst1 @dots{} lstN
|
@deffn {Scheme Procedure} n-par-map n proc lst1 lst2 @dots{}
|
||||||
@deffnx {Scheme Procedure} n-par-for-each n proc lst1 @dots{} lstN
|
@deffnx {Scheme Procedure} n-par-for-each n proc lst1 lst2 @dots{}
|
||||||
Call @var{proc} on the elements of the given lists, in the same way as
|
Call @var{proc} on the elements of the given lists, in the same way as
|
||||||
@code{par-map} and @code{par-for-each} above, but use no more than
|
@code{par-map} and @code{par-for-each} above, but use no more than
|
||||||
@var{n} threads at any one time. The order in which calls are
|
@var{n} threads at any one time. The order in which calls are
|
||||||
|
@ -1098,7 +1097,7 @@ a dual-CPU system for instance @math{@var{n}=4} might be enough to
|
||||||
keep the CPUs utilized, and not consume too much memory.
|
keep the CPUs utilized, and not consume too much memory.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} n-for-each-par-map n sproc pproc lst1 @dots{} lstN
|
@deffn {Scheme Procedure} n-for-each-par-map n sproc pproc lst1 lst2 @dots{}
|
||||||
Apply @var{pproc} to the elements of the given lists, and apply
|
Apply @var{pproc} to the elements of the given lists, and apply
|
||||||
@var{sproc} to each result returned by @var{pproc}. The final return
|
@var{sproc} to each result returned by @var{pproc}. The final return
|
||||||
value is unspecified, but all calls will have been completed before
|
value is unspecified, but all calls will have been completed before
|
||||||
|
|
|
@ -22,8 +22,8 @@ If @var{size} is 0, the default @emph{free} function will do nothing.
|
||||||
|
|
||||||
If @var{size} is not 0, the default @emph{free} function will
|
If @var{size} is not 0, the default @emph{free} function will
|
||||||
deallocate the memory block pointed to by @code{SCM_SMOB_DATA} with
|
deallocate the memory block pointed to by @code{SCM_SMOB_DATA} with
|
||||||
@code{scm_gc_free}. The @var{WHAT} parameter in the call to
|
@code{scm_gc_free}. The @var{what} parameter in the call to
|
||||||
@code{scm_gc_free} will be @var{NAME}.
|
@code{scm_gc_free} will be @var{name}.
|
||||||
|
|
||||||
Default values are provided for the @emph{mark}, @emph{free},
|
Default values are provided for the @emph{mark}, @emph{free},
|
||||||
@emph{print}, and @emph{equalp} functions, as described in
|
@emph{print}, and @emph{equalp} functions, as described in
|
||||||
|
@ -43,7 +43,7 @@ a @dfn{finalizer}) for the smob type specified by the tag
|
||||||
@var{tc}. @var{tc} is the tag returned by @code{scm_make_smob_type}.
|
@var{tc}. @var{tc} is the tag returned by @code{scm_make_smob_type}.
|
||||||
|
|
||||||
The @var{free} procedure must deallocate all resources that are
|
The @var{free} procedure must deallocate all resources that are
|
||||||
directly associated with the smob instance @var{OBJ}. It must assume
|
directly associated with the smob instance @var{obj}. It must assume
|
||||||
that all @code{SCM} values that it references have already been freed
|
that all @code{SCM} values that it references have already been freed
|
||||||
and are thus invalid.
|
and are thus invalid.
|
||||||
|
|
||||||
|
@ -107,14 +107,14 @@ with @code{scm_display}, @code{scm_write}, @code{scm_simple_format},
|
||||||
and @code{scm_puts}.
|
and @code{scm_puts}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deftypefn {C Function} void scm_set_smob_equalp (scm_t_bits tc, SCM (*equalp) (SCM obj1, SCM obj1))
|
@deftypefn {C Function} void scm_set_smob_equalp (scm_t_bits tc, SCM (*equalp) (SCM obj1, SCM obj2))
|
||||||
This function sets the smob equality-testing predicate for the smob
|
This function sets the smob equality-testing predicate for the smob
|
||||||
type specified by the tag @var{tc}. @var{tc} is the tag returned by
|
type specified by the tag @var{tc}. @var{tc} is the tag returned by
|
||||||
@code{scm_make_smob_type}.
|
@code{scm_make_smob_type}.
|
||||||
|
|
||||||
The @var{equalp} procedure should return @code{SCM_BOOL_T} when
|
The @var{equalp} procedure should return @code{SCM_BOOL_T} when
|
||||||
@var{obj1} is @code{equal?} to @var{obj2}. Else it should return
|
@var{obj1} is @code{equal?} to @var{obj2}. Else it should return
|
||||||
@var{SCM_BOOL_F}. Both @var{obj1} and @var{obj2} are instances of the
|
@code{SCM_BOOL_F}. Both @var{obj1} and @var{obj2} are instances of the
|
||||||
smob type @var{tc}.
|
smob type @var{tc}.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
|
|
|
@ -583,11 +583,11 @@ value of this procedure is not specified.
|
||||||
Convert the procedure list of @var{hook} to a list.
|
Convert the procedure list of @var{hook} to a list.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} run-hook hook . args
|
@deffn {Scheme Procedure} run-hook hook arg @dots{}
|
||||||
@deffnx {C Function} scm_run_hook (hook, args)
|
@deffnx {C Function} scm_run_hook (hook, args)
|
||||||
Apply all procedures from the hook @var{hook} to the arguments
|
Apply all procedures from the hook @var{hook} to the arguments @var{arg}
|
||||||
@var{args}. The order of the procedure application is first to
|
@enddots{}. The order of the procedure application is first to last.
|
||||||
last. The return value of this procedure is not specified.
|
The return value of this procedure is not specified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
If, in C code, you are certain that you have a hook object and well
|
If, in C code, you are certain that you have a hook object and well
|
||||||
|
|
|
@ -437,9 +437,9 @@ any, then the rest argument if any, then all of the keyword arguments.
|
||||||
|
|
||||||
@var{body} is the body of the clause. If the procedure is called with
|
@var{body} is the body of the clause. If the procedure is called with
|
||||||
an appropriate number of arguments, @var{body} is evaluated in tail
|
an appropriate number of arguments, @var{body} is evaluated in tail
|
||||||
position. Otherwise, if there is a @var{consequent}, it should be a
|
position. Otherwise, if there is an @var{alternate}, it should be a
|
||||||
@code{<lambda-case>} expression, representing the next clause to try.
|
@code{<lambda-case>} expression, representing the next clause to try.
|
||||||
If there is no @var{consequent}, a wrong-number-of-arguments error is
|
If there is no @var{alternate}, a wrong-number-of-arguments error is
|
||||||
signaled.
|
signaled.
|
||||||
@end deftp
|
@end deftp
|
||||||
@deftp {Scheme Variable} <let> src names gensyms vals exp
|
@deftp {Scheme Variable} <let> src names gensyms vals exp
|
||||||
|
|
|
@ -97,11 +97,12 @@ Class options, slot descriptions and inheritance are discussed more
|
||||||
below.
|
below.
|
||||||
@cindex slot
|
@cindex slot
|
||||||
|
|
||||||
@deffn syntax define-class name (super @dots{}) slot-definition @dots{} . options
|
@deffn syntax define-class name (super @dots{}) @
|
||||||
|
slot-definition @dots{} class-option @dots{}
|
||||||
Define a class called @var{name} that inherits from @var{super}s, with
|
Define a class called @var{name} that inherits from @var{super}s, with
|
||||||
direct slots defined by @var{slot-definition}s and class options
|
direct slots defined by @var{slot-definition}s and @var{class-option}s.
|
||||||
@var{options}. The newly created class is bound to the variable name
|
The newly created class is bound to the variable name @var{name} in the
|
||||||
@var{name} in the current environment.
|
current environment.
|
||||||
|
|
||||||
Each @var{slot-definition} is either a symbol that names the slot or a
|
Each @var{slot-definition} is either a symbol that names the slot or a
|
||||||
list,
|
list,
|
||||||
|
@ -115,8 +116,7 @@ list with an even number of elements. The even-numbered elements of
|
||||||
@var{slot-options} (counting from zero) are slot option keywords; the
|
@var{slot-options} (counting from zero) are slot option keywords; the
|
||||||
odd-numbered elements are the corresponding values for those keywords.
|
odd-numbered elements are the corresponding values for those keywords.
|
||||||
|
|
||||||
@var{options} is a similarly structured list containing class option
|
Each @var{class-option} is an option keyword and corresponding value.
|
||||||
keywords and corresponding values.
|
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
As an example, let us define a type for representing a complex number
|
As an example, let us define a type for representing a complex number
|
||||||
|
@ -183,13 +183,13 @@ creates a new @code{<my-complex>} object and binds it to the Scheme
|
||||||
variable @code{c}.
|
variable @code{c}.
|
||||||
|
|
||||||
@deffn generic make
|
@deffn generic make
|
||||||
@deffnx method make (class <class>) . initargs
|
@deffnx method make (class <class>) initarg @dots{}
|
||||||
Create and return a new instance of class @var{class}, initialized using
|
Create and return a new instance of class @var{class}, initialized using
|
||||||
@var{initargs}.
|
@var{initarg} @enddots{}.
|
||||||
|
|
||||||
In theory, @var{initargs} can have any structure that is understood by
|
In theory, @var{initarg} @dots{} can have any structure that is
|
||||||
whatever methods get applied when the @code{initialize} generic function
|
understood by whatever methods get applied when the @code{initialize}
|
||||||
is applied to the newly allocated instance.
|
generic function is applied to the newly allocated instance.
|
||||||
|
|
||||||
In practice, specialized @code{initialize} methods would normally call
|
In practice, specialized @code{initialize} methods would normally call
|
||||||
@code{(next-method)}, and so eventually the standard GOOPS
|
@code{(next-method)}, and so eventually the standard GOOPS
|
||||||
|
@ -206,7 +206,7 @@ instance's class. Any unprocessed keyword value pairs are ignored.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn generic make-instance
|
@deffn generic make-instance
|
||||||
@deffnx method make-instance (class <class>) . initargs
|
@deffnx method make-instance (class <class>) initarg @dots{}
|
||||||
@code{make-instance} is an alias for @code{make}.
|
@code{make-instance} is an alias for @code{make}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -674,9 +674,9 @@ setter). Any other previous value, including an existing generic
|
||||||
function, is discarded and replaced by a new, empty generic function.
|
function, is discarded and replaced by a new, empty generic function.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn syntax define-method (generic parameter @dots{}) . body
|
@deffn syntax define-method (generic parameter @dots{}) body @dots{}
|
||||||
Define a method for the generic function or accessor @var{generic} with
|
Define a method for the generic function or accessor @var{generic} with
|
||||||
parameters @var{parameter}s and body @var{body}.
|
parameters @var{parameter}s and body @var{body} @enddots{}.
|
||||||
|
|
||||||
@var{generic} is a generic function. If @var{generic} is a variable
|
@var{generic} is a generic function. If @var{generic} is a variable
|
||||||
which is not yet bound to a generic function object, the expansion of
|
which is not yet bound to a generic function object, the expansion of
|
||||||
|
@ -688,12 +688,12 @@ generic-with-setter object, the expansion will include a call to
|
||||||
|
|
||||||
Each @var{parameter} must be either a symbol or a two-element list
|
Each @var{parameter} must be either a symbol or a two-element list
|
||||||
@code{(@var{symbol} @var{class})}. The symbols refer to variables in
|
@code{(@var{symbol} @var{class})}. The symbols refer to variables in
|
||||||
the @var{body} that will be bound to the parameters supplied by the
|
the body forms that will be bound to the parameters supplied by the
|
||||||
caller when calling this method. The @var{class}es, if present,
|
caller when calling this method. The @var{class}es, if present,
|
||||||
specify the possible combinations of parameters to which this method
|
specify the possible combinations of parameters to which this method
|
||||||
can be applied.
|
can be applied.
|
||||||
|
|
||||||
@var{body} is the body of the method definition.
|
@var{body} @dots{} are the bodies of the method definition.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@code{define-method} expressions look a little like Scheme procedure
|
@code{define-method} expressions look a little like Scheme procedure
|
||||||
|
@ -1698,10 +1698,10 @@ If you customize these functions for particular classes or metaclasses,
|
||||||
you may still want to use @code{goops-error} to signal any error
|
you may still want to use @code{goops-error} to signal any error
|
||||||
conditions that you detect.
|
conditions that you detect.
|
||||||
|
|
||||||
@deffn procedure goops-error format-string . args
|
@deffn procedure goops-error format-string arg @dots{}
|
||||||
Raise an error with key @code{goops-error} and error message constructed
|
Raise an error with key @code{goops-error} and error message constructed
|
||||||
from @var{format-string} and @var{args}. Error message formatting is
|
from @var{format-string} and @var{arg} @enddots{}. Error message
|
||||||
as done by @code{scm-error}.
|
formatting is as done by @code{scm-error}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
||||||
|
@ -2228,11 +2228,12 @@ handles the redefinition by invoking @code{class-redefinition}
|
||||||
(@pxref{Redefining a Class}).
|
(@pxref{Redefining a Class}).
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@deffn syntax class name (super @dots{}) slot-definition @dots{} . options
|
@deffn syntax class name (super @dots{}) @
|
||||||
|
slot-definition @dots{} class-option @dots{}
|
||||||
Return a newly created class that inherits from @var{super}s, with
|
Return a newly created class that inherits from @var{super}s, with
|
||||||
direct slots defined by @var{slot-definition}s and class options
|
direct slots defined by @var{slot-definition}s and @var{class-option}s.
|
||||||
@var{options}. For the format of @var{slot-definition}s and
|
For the format of @var{slot-definition}s and @var{class-option}s, see
|
||||||
@var{options}, see @ref{Class Definition,, define-class}.
|
@ref{Class Definition,, define-class}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@noindent @code{class} expands to an expression which
|
@noindent @code{class} expands to an expression which
|
||||||
|
@ -2250,13 +2251,12 @@ calls @code{make-class} to create the class with the processed and
|
||||||
evaluated parameters.
|
evaluated parameters.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@deffn procedure make-class supers slots . options
|
@deffn procedure make-class supers slots class-option @dots{}
|
||||||
Return a newly created class that inherits from @var{supers}, with
|
Return a newly created class that inherits from @var{supers}, with
|
||||||
direct slots defined by @var{slots} and class options @var{options}.
|
direct slots defined by @var{slots} and @var{class-option}s. For the
|
||||||
For the format of @var{slots} and @var{options}, see @ref{Class
|
format of @var{slots} and @var{class-option}s, see @ref{Class
|
||||||
Definition,, define-class}, except note that for @code{make-class},
|
Definition,, define-class}, except note that for @code{make-class},
|
||||||
@var{slots} and @var{options} are separate list parameters: @var{slots}
|
@var{slots} is a separate list of slot definitions.
|
||||||
here is a list of slot definitions.
|
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@noindent @code{make-class}
|
@noindent @code{make-class}
|
||||||
|
@ -2307,18 +2307,19 @@ has to be created once.
|
||||||
The @code{env} parameter is ignored.
|
The @code{env} parameter is ignored.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn generic make metaclass @dots{}
|
@deffn generic make metaclass initarg @dots{}
|
||||||
@var{metaclass} is the metaclass of the class being defined, either
|
@var{metaclass} is the metaclass of the class being defined, either
|
||||||
taken from the @code{#:metaclass} class option or computed by
|
taken from the @code{#:metaclass} class option or computed by
|
||||||
@code{ensure-metaclass}. The applied method must create and return the
|
@code{ensure-metaclass}. The applied method must create and return the
|
||||||
fully initialized class metaobject for the new class definition.
|
fully initialized class metaobject for the new class definition.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
The @code{(make @var{metaclass} @dots{})} invocation is a particular
|
The @code{(make @var{metaclass} @var{initarg} @dots{})} invocation is a
|
||||||
case of the instance creation protocol covered in the previous section.
|
particular case of the instance creation protocol covered in the
|
||||||
It will create an class metaobject with metaclass @var{metaclass}. By
|
previous section. It will create an class metaobject with metaclass
|
||||||
default, this metaobject will be initialized by the @code{initialize}
|
@var{metaclass}. By default, this metaobject will be initialized by the
|
||||||
method that is specialized for instances of type @code{<class>}.
|
@code{initialize} method that is specialized for instances of type
|
||||||
|
@code{<class>}.
|
||||||
|
|
||||||
The @code{initialize} method for classes (signature @code{(initialize
|
The @code{initialize} method for classes (signature @code{(initialize
|
||||||
<class> initargs)}) calls the following generic functions.
|
<class> initargs)}) calls the following generic functions.
|
||||||
|
@ -2565,7 +2566,7 @@ calls @code{add-method!} to add this method to the relevant generic
|
||||||
function.
|
function.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
@deffn syntax method (parameter @dots{}) . body
|
@deffn syntax method (parameter @dots{}) body @dots{}
|
||||||
Make a method whose specializers are defined by the classes in
|
Make a method whose specializers are defined by the classes in
|
||||||
@var{parameter}s and whose procedure definition is constructed from the
|
@var{parameter}s and whose procedure definition is constructed from the
|
||||||
@var{parameter} symbols and @var{body} forms.
|
@var{parameter} symbols and @var{body} forms.
|
||||||
|
|
|
@ -64,16 +64,16 @@ bound to, respectively, the first and second element of @var{l}.
|
||||||
|
|
||||||
The pattern matcher is defined as follows:
|
The pattern matcher is defined as follows:
|
||||||
|
|
||||||
@deffn {Scheme Syntax} match exp clause ...
|
@deffn {Scheme Syntax} match exp clause1 clause2 @dots{}
|
||||||
Match object @var{exp} against the patterns in the given @var{clause}s,
|
Match object @var{exp} against the patterns in @var{clause1}
|
||||||
in the order in which they appear. Return the value produced by the
|
@var{clause2} @dots{} in the order in which they appear. Return the
|
||||||
first matching clause. If no @var{clause} matches, throw an exception
|
value produced by the first matching clause. If no clause matches,
|
||||||
with key @code{match-error}.
|
throw an exception with key @code{match-error}.
|
||||||
|
|
||||||
Each @var{clause} has the form @code{(pattern body)}. Each
|
Each clause has the form @code{(pattern body1 body2 @dots{})}. Each
|
||||||
@var{pattern} must follow the syntax described below. Each @var{body}
|
@var{pattern} must follow the syntax described below. Each body is an
|
||||||
is an arbitrary Scheme expression, possibly referring to pattern
|
arbitrary Scheme expression, possibly referring to pattern variables of
|
||||||
variables of @var{pattern}.
|
@var{pattern}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@c FIXME: Document other forms:
|
@c FIXME: Document other forms:
|
||||||
|
|
|
@ -90,13 +90,13 @@ dots.}, or in the worst case, displayed as @nicode{#}.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} truncated-print obj [port] [keyword-options]
|
@deffn {Scheme Procedure} truncated-print obj [port] [keyword-options]
|
||||||
Print @var{obj}, truncating the output, if necessary, to make it fit
|
Print @var{obj}, truncating the output, if necessary, to make it fit
|
||||||
into @var{width} characters. By default, @var{x} will be printed using
|
into @var{width} characters. By default, @var{obj} will be printed using
|
||||||
@code{write}, though that behavior can be overridden via the
|
@code{write}, though that behavior can be overridden via the
|
||||||
@var{display?} keyword argument.
|
@var{display?} keyword argument.
|
||||||
|
|
||||||
The default behaviour is to print depth-first, meaning that the entire
|
The default behaviour is to print depth-first, meaning that the entire
|
||||||
remaining width will be available to each sub-expression of @var{x} --
|
remaining width will be available to each sub-expression of @var{obj} --
|
||||||
e.g., if @var{x} is a vector, each member of @var{x}. One can attempt to
|
e.g., if @var{obj} is a vector, each member of @var{obj}. One can attempt to
|
||||||
``ration'' the available width, trying to allocate it equally to each
|
``ration'' the available width, trying to allocate it equally to each
|
||||||
sub-expression, via the @var{breadth-first?} keyword argument.
|
sub-expression, via the @var{breadth-first?} keyword argument.
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ C programmers will note the similarity between @code{format} and
|
||||||
instead of @nicode{%}, and are more powerful.
|
instead of @nicode{%}, and are more powerful.
|
||||||
|
|
||||||
@sp 1
|
@sp 1
|
||||||
@deffn {Scheme Procedure} format dest fmt [args@dots{}]
|
@deffn {Scheme Procedure} format dest fmt arg @dots{}
|
||||||
Write output specified by the @var{fmt} string to @var{dest}.
|
Write output specified by the @var{fmt} string to @var{dest}.
|
||||||
@var{dest} can be an output port, @code{#t} for
|
@var{dest} can be an output port, @code{#t} for
|
||||||
@code{current-output-port} (@pxref{Default Ports}), or @code{#f} to
|
@code{current-output-port} (@pxref{Default Ports}), or @code{#f} to
|
||||||
|
@ -269,7 +269,7 @@ Integer. Parameters: @var{minwidth}, @var{padchar}, @var{commachar},
|
||||||
@var{commawidth}.
|
@var{commawidth}.
|
||||||
|
|
||||||
Output an integer argument as a decimal, hexadecimal, octal or binary
|
Output an integer argument as a decimal, hexadecimal, octal or binary
|
||||||
integer (respectively).
|
integer (respectively), in a locale-independent way.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(format #t "~d" 123) @print{} 123
|
(format #t "~d" 123) @print{} 123
|
||||||
|
@ -297,7 +297,9 @@ minimum), it's padded on the left with the @var{padchar} parameter
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@nicode{~:d} adds commas (or the @var{commachar} parameter) every
|
@nicode{~:d} adds commas (or the @var{commachar} parameter) every
|
||||||
three digits (or the @var{commawidth} parameter many).
|
three digits (or the @var{commawidth} parameter many). However, when
|
||||||
|
your intent is to write numbers in a way that follows typographical
|
||||||
|
conventions, using @nicode{~h} is recommended.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(format #t "~:d" 1234567) @print{} 1,234,567
|
(format #t "~:d" 1234567) @print{} 1,234,567
|
||||||
|
@ -404,6 +406,29 @@ printed instead of the value.
|
||||||
(format #t "~5,,,'xf" 12345) @print{} xxxxx
|
(format #t "~5,,,'xf" 12345) @print{} xxxxx
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@item @nicode{~h}
|
||||||
|
Localized number@footnote{The @nicode{~h} format specifier first
|
||||||
|
appeared in Guile version 2.0.6.}. Parameters: @var{width},
|
||||||
|
@var{decimals}, @var{padchar}.
|
||||||
|
|
||||||
|
Like @nicode{~f}, output an exact or floating point number, but do so
|
||||||
|
according to the current locale, or according to the given locale object
|
||||||
|
when the @code{:} modifier is used (@pxref{Number Input and Output,
|
||||||
|
@code{number->locale-string}}).
|
||||||
|
|
||||||
|
@example
|
||||||
|
(format #t "~h" 12345.5678) ; with "C" as the current locale
|
||||||
|
@print{} 12345.5678
|
||||||
|
|
||||||
|
(format #t "~14,,'*:h" 12345.5678
|
||||||
|
(make-locale LC_ALL "en_US"))
|
||||||
|
@print{} ***12,345.5678
|
||||||
|
|
||||||
|
(format #t "~,2:h" 12345.5678
|
||||||
|
(make-locale LC_NUMERIC "fr_FR"))
|
||||||
|
@print{} 12 345,56
|
||||||
|
@end example
|
||||||
|
|
||||||
@item @nicode{~e}
|
@item @nicode{~e}
|
||||||
Exponential float. Parameters: @var{width}, @var{mantdigits},
|
Exponential float. Parameters: @var{width}, @var{mantdigits},
|
||||||
@var{expdigits}, @var{intdigits}, @var{overflowchar}, @var{padchar},
|
@var{expdigits}, @var{intdigits}, @var{overflowchar}, @var{padchar},
|
||||||
|
@ -1670,35 +1695,35 @@ secondly the number of elements in that list.
|
||||||
Return a vector which is the entire contents of @var{stream}.
|
Return a vector which is the entire contents of @var{stream}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} stream-fold proc init stream0 @dots{} streamN
|
@defun stream-fold proc init stream1 stream2 @dots{}
|
||||||
Apply @var{proc} successively over the elements of the given streams,
|
Apply @var{proc} successively over the elements of the given streams,
|
||||||
from first to last until the end of the shortest stream is reached.
|
from first to last until the end of the shortest stream is reached.
|
||||||
Return the result from the last @var{proc} call.
|
Return the result from the last @var{proc} call.
|
||||||
|
|
||||||
Each call is @code{(@var{proc} elem0 @dots{} elemN prev)}, where each
|
Each call is @code{(@var{proc} elem1 elem2 @dots{} prev)}, where each
|
||||||
@var{elem} is from the corresponding @var{stream}. @var{prev} is the
|
@var{elem} is from the corresponding @var{stream}. @var{prev} is the
|
||||||
return from the previous @var{proc} call, or the given @var{init} for
|
return from the previous @var{proc} call, or the given @var{init} for
|
||||||
the first call.
|
the first call.
|
||||||
@end deffn
|
@end defun
|
||||||
|
|
||||||
@deffn {Scheme Procedure} stream-for-each proc stream0 @dots{} streamN
|
@defun stream-for-each proc stream1 stream2 @dots{}
|
||||||
Call @var{proc} on the elements from the given @var{stream}s. The
|
Call @var{proc} on the elements from the given @var{stream}s. The
|
||||||
return value is unspecified.
|
return value is unspecified.
|
||||||
|
|
||||||
Each call is @code{(@var{proc} elem0 @dots{} elemN)}, where each
|
Each call is @code{(@var{proc} elem1 elem2 @dots{})}, where each
|
||||||
@var{elem} is from the corresponding @var{stream}.
|
@var{elem} is from the corresponding @var{stream}.
|
||||||
@code{stream-for-each} stops when it reaches the end of the shortest
|
@code{stream-for-each} stops when it reaches the end of the shortest
|
||||||
@var{stream}.
|
@var{stream}.
|
||||||
@end deffn
|
@end defun
|
||||||
|
|
||||||
@deffn {Scheme Procedure} stream-map proc stream0 @dots{} streamN
|
@defun stream-map proc stream1 stream2 @dots{}
|
||||||
Return a new stream which is the results of applying @var{proc} to the
|
Return a new stream which is the results of applying @var{proc} to the
|
||||||
elements of the given @var{stream}s.
|
elements of the given @var{stream}s.
|
||||||
|
|
||||||
Each call is @code{(@var{proc} elem0 @dots{} elemN)}, where each
|
Each call is @code{(@var{proc} elem1 elem2 @dots{})}, where each
|
||||||
@var{elem} is from the corresponding @var{stream}. The new stream
|
@var{elem} is from the corresponding @var{stream}. The new stream
|
||||||
ends when the end of the shortest given @var{stream} is reached.
|
ends when the end of the shortest given @var{stream} is reached.
|
||||||
@end deffn
|
@end defun
|
||||||
|
|
||||||
|
|
||||||
@node Buffered Input
|
@node Buffered Input
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
@c -*-texinfo-*-
|
@c -*-texinfo-*-
|
||||||
@c This is part of the GNU Guile Reference Manual.
|
@c This is part of the GNU Guile Reference Manual.
|
||||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011
|
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007,
|
||||||
@c Free Software Foundation, Inc.
|
@c 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
@c See the file guile.texi for copying conditions.
|
@c See the file guile.texi for copying conditions.
|
||||||
|
|
||||||
@node POSIX
|
@node POSIX
|
||||||
|
@ -211,8 +211,8 @@ initialized to zero. The @var{modes} string is the same as that
|
||||||
accepted by @code{open-file} (@pxref{File Ports, open-file}).
|
accepted by @code{open-file} (@pxref{File Ports, open-file}).
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} fdes->ports fd
|
@deffn {Scheme Procedure} fdes->ports fdes
|
||||||
@deffnx {C Function} scm_fdes_to_ports (fd)
|
@deffnx {C Function} scm_fdes_to_ports (fdes)
|
||||||
Return a list of existing ports which have @var{fdes} as an
|
Return a list of existing ports which have @var{fdes} as an
|
||||||
underlying file descriptor, without changing their revealed
|
underlying file descriptor, without changing their revealed
|
||||||
counts.
|
counts.
|
||||||
|
@ -230,8 +230,8 @@ descriptor, if one exists, and increments its revealed count.
|
||||||
Otherwise, returns a new output port with a revealed count of 1.
|
Otherwise, returns a new output port with a revealed count of 1.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} primitive-move->fdes port fd
|
@deffn {Scheme Procedure} primitive-move->fdes port fdes
|
||||||
@deffnx {C Function} scm_primitive_move_to_fdes (port, fd)
|
@deffnx {C Function} scm_primitive_move_to_fdes (port, fdes)
|
||||||
Moves the underlying file descriptor for @var{port} to the integer
|
Moves the underlying file descriptor for @var{port} to the integer
|
||||||
value @var{fdes} without changing the revealed count of @var{port}.
|
value @var{fdes} without changing the revealed count of @var{port}.
|
||||||
Any other ports already using this descriptor will be automatically
|
Any other ports already using this descriptor will be automatically
|
||||||
|
@ -252,10 +252,10 @@ The return value is unspecified.
|
||||||
Decrements the revealed count for a port.
|
Decrements the revealed count for a port.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} fsync object
|
@deffn {Scheme Procedure} fsync port_or_fd
|
||||||
@deffnx {C Function} scm_fsync (object)
|
@deffnx {C Function} scm_fsync (port_or_fd)
|
||||||
Copies any unwritten data for the specified output file descriptor to disk.
|
Copies any unwritten data for the specified output file descriptor to disk.
|
||||||
If @var{port/fd} is a port, its buffer is flushed before the underlying
|
If @var{port_or_fd} is a port, its buffer is flushed before the underlying
|
||||||
file descriptor is fsync'd.
|
file descriptor is fsync'd.
|
||||||
The return value is unspecified.
|
The return value is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -402,11 +402,11 @@ port.
|
||||||
This procedure is equivalent to @code{(dup->port @var{port} @var{modes})}.
|
This procedure is equivalent to @code{(dup->port @var{port} @var{modes})}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} redirect-port old new
|
@deffn {Scheme Procedure} redirect-port old_port new_port
|
||||||
@deffnx {C Function} scm_redirect_port (old, new)
|
@deffnx {C Function} scm_redirect_port (old_port, new_port)
|
||||||
This procedure takes two ports and duplicates the underlying file
|
This procedure takes two ports and duplicates the underlying file
|
||||||
descriptor from @var{old-port} into @var{new-port}. The
|
descriptor from @var{old_port} into @var{new_port}. The
|
||||||
current file descriptor in @var{new-port} will be closed.
|
current file descriptor in @var{new_port} will be closed.
|
||||||
After the redirection the two ports will share a file position
|
After the redirection the two ports will share a file position
|
||||||
and file status flags.
|
and file status flags.
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ The GNU C Library Reference Manual}.
|
||||||
@deffn {Scheme Procedure} stat object
|
@deffn {Scheme Procedure} stat object
|
||||||
@deffnx {C Function} scm_stat (object)
|
@deffnx {C Function} scm_stat (object)
|
||||||
Return an object containing various information about the file
|
Return an object containing various information about the file
|
||||||
determined by @var{obj}. @var{obj} can be a string containing
|
determined by @var{object}. @var{object} can be a string containing
|
||||||
a file name or a port or integer file descriptor which is open
|
a file name or a port or integer file descriptor which is open
|
||||||
on a file (in which case @code{fstat} is used as the underlying
|
on a file (in which case @code{fstat} is used as the underlying
|
||||||
system call).
|
system call).
|
||||||
|
@ -728,8 +728,8 @@ An integer representing the access permission bits.
|
||||||
@end deffn
|
@end deffn
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lstat str
|
@deffn {Scheme Procedure} lstat path
|
||||||
@deffnx {C Function} scm_lstat (str)
|
@deffnx {C Function} scm_lstat (path)
|
||||||
Similar to @code{stat}, but does not follow symbolic links, i.e.,
|
Similar to @code{stat}, but does not follow symbolic links, i.e.,
|
||||||
it will return information about a symbolic link itself, not the
|
it will return information about a symbolic link itself, not the
|
||||||
file it points to. @var{path} must be a string.
|
file it points to. @var{path} must be a string.
|
||||||
|
@ -762,8 +762,8 @@ as @code{-1}, then that ID is not changed.
|
||||||
@findex fchmod
|
@findex fchmod
|
||||||
@deffn {Scheme Procedure} chmod object mode
|
@deffn {Scheme Procedure} chmod object mode
|
||||||
@deffnx {C Function} scm_chmod (object, mode)
|
@deffnx {C Function} scm_chmod (object, mode)
|
||||||
Changes the permissions of the file referred to by @var{obj}.
|
Changes the permissions of the file referred to by @var{object}.
|
||||||
@var{obj} can be a string containing a file name or a port or integer file
|
@var{object} can be a string containing a file name or a port or integer file
|
||||||
descriptor which is open on a file (in which case @code{fchmod} is used
|
descriptor which is open on a file (in which case @code{fchmod} is used
|
||||||
as the underlying system call).
|
as the underlying system call).
|
||||||
@var{mode} specifies
|
@var{mode} specifies
|
||||||
|
@ -774,7 +774,7 @@ The return value is unspecified.
|
||||||
@deffn {Scheme Procedure} utime pathname [actime [modtime [actimens [modtimens [flags]]]]]
|
@deffn {Scheme Procedure} utime pathname [actime [modtime [actimens [modtimens [flags]]]]]
|
||||||
@deffnx {C Function} scm_utime (pathname, actime, modtime, actimens, modtimens, flags)
|
@deffnx {C Function} scm_utime (pathname, actime, modtime, actimens, modtimens, flags)
|
||||||
@code{utime} sets the access and modification times for the
|
@code{utime} sets the access and modification times for the
|
||||||
file named by @var{path}. If @var{actime} or @var{modtime} is
|
file named by @var{pathname}. If @var{actime} or @var{modtime} is
|
||||||
not supplied, then the current time is used. @var{actime} and
|
not supplied, then the current time is used. @var{actime} and
|
||||||
@var{modtime} must be integer time values as returned by the
|
@var{modtime} must be integer time values as returned by the
|
||||||
@code{current-time} procedure.
|
@code{current-time} procedure.
|
||||||
|
@ -953,7 +953,7 @@ which is usual for ordinary file creation,
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} tmpfile
|
@deffn {Scheme Procedure} tmpfile
|
||||||
@deffnx {C Function} scm_tmpfile
|
@deffnx {C Function} scm_tmpfile ()
|
||||||
Return an input/output port to a unique temporary file
|
Return an input/output port to a unique temporary file
|
||||||
named using the path prefix @code{P_tmpdir} defined in
|
named using the path prefix @code{P_tmpdir} defined in
|
||||||
@file{stdio.h}.
|
@file{stdio.h}.
|
||||||
|
@ -1055,7 +1055,7 @@ stream. Otherwise, close the stream. The @code{setpwent} and
|
||||||
|
|
||||||
@deffn {Scheme Procedure} getpw [user]
|
@deffn {Scheme Procedure} getpw [user]
|
||||||
@deffnx {C Function} scm_getpwuid (user)
|
@deffnx {C Function} scm_getpwuid (user)
|
||||||
Look up an entry in the user database. @var{obj} can be an integer,
|
Look up an entry in the user database. @var{user} can be an integer,
|
||||||
a string, or omitted, giving the behaviour of getpwuid, getpwnam
|
a string, or omitted, giving the behaviour of getpwuid, getpwnam
|
||||||
or getpwent respectively.
|
or getpwent respectively.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1108,9 +1108,9 @@ stream. Otherwise, close the stream. The @code{setgrent} and
|
||||||
@code{endgrent} procedures are implemented on top of this.
|
@code{endgrent} procedures are implemented on top of this.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} getgr [name]
|
@deffn {Scheme Procedure} getgr [group]
|
||||||
@deffnx {C Function} scm_getgrgid (name)
|
@deffnx {C Function} scm_getgrgid (group)
|
||||||
Look up an entry in the group database. @var{obj} can be an integer,
|
Look up an entry in the group database. @var{group} can be an integer,
|
||||||
a string, or omitted, giving the behaviour of getgrgid, getgrnam
|
a string, or omitted, giving the behaviour of getgrgid, getgrnam
|
||||||
or getgrent respectively.
|
or getgrent respectively.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1284,7 +1284,7 @@ names are from the current locale and in the locale character set.
|
||||||
@cindex time parsing
|
@cindex time parsing
|
||||||
Performs the reverse action to @code{strftime}, parsing
|
Performs the reverse action to @code{strftime}, parsing
|
||||||
@var{string} according to the specification supplied in
|
@var{string} according to the specification supplied in
|
||||||
@var{template}. The interpretation of month and day names is
|
@var{format}. The interpretation of month and day names is
|
||||||
dependent on the current locale. The value returned is a pair.
|
dependent on the current locale. The value returned is a pair.
|
||||||
The @acronym{CAR} has an object with time components
|
The @acronym{CAR} has an object with time components
|
||||||
in the form returned by @code{localtime} or @code{gmtime},
|
in the form returned by @code{localtime} or @code{gmtime},
|
||||||
|
@ -1411,8 +1411,8 @@ The given strings are all copied, so the C data is not accessed again
|
||||||
once @code{scm_set_program_arguments} returns.
|
once @code{scm_set_program_arguments} returns.
|
||||||
@end deftypefn
|
@end deftypefn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} getenv nam
|
@deffn {Scheme Procedure} getenv name
|
||||||
@deffnx {C Function} scm_getenv (nam)
|
@deffnx {C Function} scm_getenv (name)
|
||||||
@cindex environment
|
@cindex environment
|
||||||
Looks up the string @var{name} in the current environment. The return
|
Looks up the string @var{name} in the current environment. The return
|
||||||
value is @code{#f} unless a string of the form @code{NAME=VALUE} is
|
value is @code{#f} unless a string of the form @code{NAME=VALUE} is
|
||||||
|
@ -1442,8 +1442,8 @@ If @var{env} is omitted, return the current environment (in the
|
||||||
Unix sense) as a list of strings. Otherwise set the current
|
Unix sense) as a list of strings. Otherwise set the current
|
||||||
environment, which is also the default environment for child
|
environment, which is also the default environment for child
|
||||||
processes, to the supplied list of strings. Each member of
|
processes, to the supplied list of strings. Each member of
|
||||||
@var{env} should be of the form @var{NAME}=@var{VALUE} and values of
|
@var{env} should be of the form @var{name}=@var{value} and values of
|
||||||
@var{NAME} should not be duplicated. If @var{env} is supplied
|
@var{name} should not be duplicated. If @var{env} is supplied
|
||||||
then the return value is unspecified.
|
then the return value is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -1452,11 +1452,11 @@ then the return value is unspecified.
|
||||||
Modifies the environment of the current process, which is
|
Modifies the environment of the current process, which is
|
||||||
also the default environment inherited by child processes.
|
also the default environment inherited by child processes.
|
||||||
|
|
||||||
If @var{string} is of the form @code{NAME=VALUE} then it will be written
|
If @var{str} is of the form @code{NAME=VALUE} then it will be written
|
||||||
directly into the environment, replacing any existing environment string
|
directly into the environment, replacing any existing environment string
|
||||||
with
|
with
|
||||||
name matching @code{NAME}. If @var{string} does not contain an equal
|
name matching @code{NAME}. If @var{str} does not contain an equal
|
||||||
sign, then any existing string with name matching @var{string} will
|
sign, then any existing string with name matching @var{str} will
|
||||||
be removed.
|
be removed.
|
||||||
|
|
||||||
The return value is unspecified.
|
The return value is unspecified.
|
||||||
|
@ -1472,7 +1472,7 @@ The return value is unspecified.
|
||||||
@deffn {Scheme Procedure} chdir str
|
@deffn {Scheme Procedure} chdir str
|
||||||
@deffnx {C Function} scm_chdir (str)
|
@deffnx {C Function} scm_chdir (str)
|
||||||
@cindex current directory
|
@cindex current directory
|
||||||
Change the current working directory to @var{path}.
|
Change the current working directory to @var{str}.
|
||||||
The return value is unspecified.
|
The return value is unspecified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -1698,12 +1698,12 @@ If @code{system} is called without arguments, return a boolean
|
||||||
indicating whether the command processor is available.
|
indicating whether the command processor is available.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} system* . args
|
@deffn {Scheme Procedure} system* arg1 arg2 @dots{}
|
||||||
@deffnx {C Function} scm_system_star (args)
|
@deffnx {C Function} scm_system_star (args)
|
||||||
Execute the command indicated by @var{args}. The first element must
|
Execute the command indicated by @var{arg1} @var{arg2} @enddots{}. The
|
||||||
be a string indicating the command to be executed, and the remaining
|
first element must be a string indicating the command to be executed,
|
||||||
items must be strings representing each of the arguments to that
|
and the remaining items must be strings representing each of the
|
||||||
command.
|
arguments to that command.
|
||||||
|
|
||||||
This function returns the exit status of the command as provided by
|
This function returns the exit status of the command as provided by
|
||||||
@code{waitpid}. This value can be handled with @code{status:exit-val}
|
@code{waitpid}. This value can be handled with @code{status:exit-val}
|
||||||
|
@ -1743,22 +1743,22 @@ in the child would upset the protocol in the parent, so
|
||||||
@code{primitive-_exit} should be used to exit without that.
|
@code{primitive-_exit} should be used to exit without that.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} execl filename . args
|
@deffn {Scheme Procedure} execl filename arg @dots{}
|
||||||
@deffnx {C Function} scm_execl (filename, args)
|
@deffnx {C Function} scm_execl (filename, args)
|
||||||
Executes the file named by @var{path} as a new process image.
|
Executes the file named by @var{filename} as a new process image.
|
||||||
The remaining arguments are supplied to the process; from a C program
|
The remaining arguments are supplied to the process; from a C program
|
||||||
they are accessible as the @code{argv} argument to @code{main}.
|
they are accessible as the @code{argv} argument to @code{main}.
|
||||||
Conventionally the first @var{arg} is the same as @var{path}.
|
Conventionally the first @var{arg} is the same as @var{filename}.
|
||||||
All arguments must be strings.
|
All arguments must be strings.
|
||||||
|
|
||||||
If @var{arg} is missing, @var{path} is executed with a null
|
If @var{arg} is missing, @var{filename} is executed with a null
|
||||||
argument list, which may have system-dependent side-effects.
|
argument list, which may have system-dependent side-effects.
|
||||||
|
|
||||||
This procedure is currently implemented using the @code{execv} system
|
This procedure is currently implemented using the @code{execv} system
|
||||||
call, but we call it @code{execl} because of its Scheme calling interface.
|
call, but we call it @code{execl} because of its Scheme calling interface.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} execlp filename . args
|
@deffn {Scheme Procedure} execlp filename arg @dots{}
|
||||||
@deffnx {C Function} scm_execlp (filename, args)
|
@deffnx {C Function} scm_execlp (filename, args)
|
||||||
Similar to @code{execl}, however if
|
Similar to @code{execl}, however if
|
||||||
@var{filename} does not contain a slash
|
@var{filename} does not contain a slash
|
||||||
|
@ -1769,7 +1769,7 @@ This procedure is currently implemented using the @code{execvp} system
|
||||||
call, but we call it @code{execlp} because of its Scheme calling interface.
|
call, but we call it @code{execlp} because of its Scheme calling interface.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} execle filename env . args
|
@deffn {Scheme Procedure} execle filename env arg @dots{}
|
||||||
@deffnx {C Function} scm_execle (filename, env, args)
|
@deffnx {C Function} scm_execle (filename, env, args)
|
||||||
Similar to @code{execl}, but the environment of the new process is
|
Similar to @code{execl}, but the environment of the new process is
|
||||||
specified by @var{env}, which must be a list of strings as returned by the
|
specified by @var{env}, which must be a list of strings as returned by the
|
||||||
|
@ -2502,9 +2502,9 @@ Either @var{name} does not resolve for the supplied parameters,
|
||||||
or neither @var{name} nor @var{service} were supplied.
|
or neither @var{name} nor @var{service} were supplied.
|
||||||
|
|
||||||
@item EAI_NODATA
|
@item EAI_NODATA
|
||||||
This non-POSIX error code can be returned on GNU systems when a
|
This non-POSIX error code can be returned on some systems (GNU
|
||||||
request was actually made but returned no data, meaning
|
and Darwin, at least), for example when @var{name} is known
|
||||||
that no address is associated with @var{name}. Error handling
|
but requests that were made turned out no data. Error handling
|
||||||
code should be prepared to handle it when it is defined.
|
code should be prepared to handle it when it is defined.
|
||||||
|
|
||||||
@item EAI_SERVICE
|
@item EAI_SERVICE
|
||||||
|
@ -2841,7 +2841,7 @@ created with,
|
||||||
@deffn {Scheme Procedure} make-socket-address AF_INET ipv4addr port
|
@deffn {Scheme Procedure} make-socket-address AF_INET ipv4addr port
|
||||||
@deffnx {Scheme Procedure} make-socket-address AF_INET6 ipv6addr port [flowinfo [scopeid]]
|
@deffnx {Scheme Procedure} make-socket-address AF_INET6 ipv6addr port [flowinfo [scopeid]]
|
||||||
@deffnx {Scheme Procedure} make-socket-address AF_UNIX path
|
@deffnx {Scheme Procedure} make-socket-address AF_UNIX path
|
||||||
@deffnx {C Function} scm_make_socket_address family address arglist
|
@deffnx {C Function} scm_make_socket_address (family, address, arglist)
|
||||||
Return a new socket address object. The first argument is the address
|
Return a new socket address object. The first argument is the address
|
||||||
family, one of the @code{AF} constants, then the arguments vary
|
family, one of the @code{AF} constants, then the arguments vary
|
||||||
according to the family.
|
according to the family.
|
||||||
|
|
|
@ -273,8 +273,10 @@ grouped below by the existing manual sections to which they correspond.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Syntax} define-syntax keyword expression
|
@deffn {Scheme Syntax} define-syntax keyword expression
|
||||||
@deffnx {Scheme Syntax} let-syntax ((keyword transformer) ...) exp ...
|
@deffnx {Scheme Syntax} let-syntax ((keyword transformer) @dots{})
|
||||||
@deffnx {Scheme Syntax} letrec-syntax ((keyword transformer) ...) exp ...
|
exp1 exp2 @dots{}
|
||||||
|
@deffnx {Scheme Syntax} letrec-syntax ((keyword transformer) @dots{})
|
||||||
|
exp1 exp2 @dots{}
|
||||||
@xref{Defining Macros}, for documentation.
|
@xref{Defining Macros}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -403,7 +405,7 @@ grouped below by the existing manual sections to which they correspond.
|
||||||
@xref{SRFI-1 Fold and Map}, for documentation.
|
@xref{SRFI-1 Fold and Map}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} list elem1 ... elemN
|
@deffn {Scheme Procedure} list elem @dots{}
|
||||||
@xref{List Constructors}, for documentation.
|
@xref{List Constructors}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -413,7 +415,8 @@ grouped below by the existing manual sections to which they correspond.
|
||||||
@xref{List Selection}, for documentation.
|
@xref{List Selection}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} append lst1 ... lstN
|
@deffn {Scheme Procedure} append lst @dots{} obj
|
||||||
|
@deffnx {Scheme Procedure} append
|
||||||
@deffnx {Scheme Procedure} reverse lst
|
@deffnx {Scheme Procedure} reverse lst
|
||||||
@xref{Append/Reverse}, for documentation.
|
@xref{Append/Reverse}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -440,15 +443,15 @@ grouped below by the existing manual sections to which they correspond.
|
||||||
@xref{String Selection}, for documentation.
|
@xref{String Selection}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string=? [s1 [s2 . rest]]
|
@deffn {Scheme Procedure} string=? s1 s2 s3 @dots{}
|
||||||
@deffnx {Scheme Procedure} string<? [s1 [s2 . rest]]
|
@deffnx {Scheme Procedure} string<? s1 s2 s3 @dots{}
|
||||||
@deffnx {Scheme Procedure} string>? [s1 [s2 . rest]]
|
@deffnx {Scheme Procedure} string>? s1 s2 s3 @dots{}
|
||||||
@deffnx {Scheme Procedure} string<=? [s1 [s2 . rest]]
|
@deffnx {Scheme Procedure} string<=? s1 s2 s3 @dots{}
|
||||||
@deffnx {Scheme Procedure} string>=? [s1 [s2 . rest]]
|
@deffnx {Scheme Procedure} string>=? s1 s2 s3 @dots{}
|
||||||
@xref{String Comparison}, for documentation.
|
@xref{String Comparison}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} string-append . args
|
@deffn {Scheme Procedure} string-append arg @dots{}
|
||||||
@xref{Reversing and Appending Strings}, for documentation.
|
@xref{Reversing and Appending Strings}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -579,7 +582,7 @@ These procedures implement the @code{map} and @code{for-each} contracts
|
||||||
over vectors.
|
over vectors.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} vector . l
|
@deffn {Scheme Procedure} vector arg @dots{}
|
||||||
@deffnx {Scheme Procedure} vector? obj
|
@deffnx {Scheme Procedure} vector? obj
|
||||||
@deffnx {Scheme Procedure} make-vector len
|
@deffnx {Scheme Procedure} make-vector len
|
||||||
@deffnx {Scheme Procedure} make-vector len fill
|
@deffnx {Scheme Procedure} make-vector len fill
|
||||||
|
@ -600,7 +603,7 @@ over vectors.
|
||||||
@xref{Continuations}, for documentation.
|
@xref{Continuations}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} values arg1 ... argN
|
@deffn {Scheme Procedure} values arg @dots{}
|
||||||
@deffnx {Scheme Procedure} call-with-values producer consumer
|
@deffnx {Scheme Procedure} call-with-values producer consumer
|
||||||
@xref{Multiple Values}, for documentation.
|
@xref{Multiple Values}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -609,7 +612,7 @@ over vectors.
|
||||||
@xref{Dynamic Wind}, for documentation.
|
@xref{Dynamic Wind}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} apply proc arg1 ... argN arglst
|
@deffn {Scheme Procedure} apply proc arg @dots{} arglst
|
||||||
@xref{Fly Evaluation}, for documentation.
|
@xref{Fly Evaluation}, for documentation.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -717,8 +720,8 @@ These procedures are identical to the ones provided by SRFI-1.
|
||||||
@xref{SRFI-1 Filtering and Partitioning}, for @code{partition}.
|
@xref{SRFI-1 Filtering and Partitioning}, for @code{partition}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} fold-left combine nil list1 list2 ... listn
|
@deffn {Scheme Procedure} fold-left combine nil list1 list2 @dots{}
|
||||||
@deffnx {Scheme Procedure} fold-right combine nil list1 list2 ... listn
|
@deffnx {Scheme Procedure} fold-right combine nil list1 list2 @dots{}
|
||||||
These procedures are identical to the @code{fold} and @code{fold-right}
|
These procedures are identical to the @code{fold} and @code{fold-right}
|
||||||
procedures provided by SRFI-1. @xref{SRFI-1 Fold and Map}, for
|
procedures provided by SRFI-1. @xref{SRFI-1 Fold and Map}, for
|
||||||
documentation.
|
documentation.
|
||||||
|
@ -903,7 +906,7 @@ compatible with either.
|
||||||
The @code{(rnrs records syntactic (6))} library exports the syntactic
|
The @code{(rnrs records syntactic (6))} library exports the syntactic
|
||||||
API for working with R6RS records.
|
API for working with R6RS records.
|
||||||
|
|
||||||
@deffn {Scheme Syntax} define-record-type name-spec record-clause*
|
@deffn {Scheme Syntax} define-record-type name-spec record-clause @dots{}
|
||||||
Defines a new record type, introducing bindings for a record-type
|
Defines a new record type, introducing bindings for a record-type
|
||||||
descriptor, a record constructor descriptor, a constructor procedure,
|
descriptor, a record constructor descriptor, a constructor procedure,
|
||||||
a record predicate, and accessor and mutator procedures for the new
|
a record predicate, and accessor and mutator procedures for the new
|
||||||
|
|
|
@ -230,7 +230,7 @@ Show description/documentation.
|
||||||
Change modules / Show current module.
|
Change modules / Show current module.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {REPL Command} import [module ...]
|
@deffn {REPL Command} import module @dots{}
|
||||||
Import modules / List those imported.
|
Import modules / List those imported.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ List current bindings.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {REPL Command} in module expression
|
@deffn {REPL Command} in module expression
|
||||||
@deffnx {REPL Command} in module command [args ...]
|
@deffnx {REPL Command} in module command arg @dots{}
|
||||||
Evaluate an expression, or alternatively, execute another meta-command
|
Evaluate an expression, or alternatively, execute another meta-command
|
||||||
in the context of a module. For example, @samp{,in (foo bar) ,binding}
|
in the context of a module. For example, @samp{,in (foo bar) ,binding}
|
||||||
will show the bindings in the module @code{(foo bar)}.
|
will show the bindings in the module @code{(foo bar)}.
|
||||||
|
@ -311,7 +311,7 @@ they do not work at the top level.
|
||||||
@deffn {REPL Command} backtrace [count] [#:width w] [#:full? f]
|
@deffn {REPL Command} backtrace [count] [#:width w] [#:full? f]
|
||||||
Print a backtrace.
|
Print a backtrace.
|
||||||
|
|
||||||
Print a backtrace of all stack frames, or innermost @var{COUNT} frames.
|
Print a backtrace of all stack frames, or innermost @var{count} frames.
|
||||||
If @var{count} is negative, the last @var{count} frames will be shown.
|
If @var{count} is negative, the last @var{count} frames will be shown.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -406,11 +406,11 @@ reenter the REPL.
|
||||||
@node Inspect Commands
|
@node Inspect Commands
|
||||||
@subsubsection Inspect Commands
|
@subsubsection Inspect Commands
|
||||||
|
|
||||||
@deffn {REPL Command} inspect EXP
|
@deffn {REPL Command} inspect exp
|
||||||
Inspect the result(s) of evaluating @var{exp}.
|
Inspect the result(s) of evaluating @var{exp}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {REPL Command} pretty-print EXP
|
@deffn {REPL Command} pretty-print exp
|
||||||
Pretty-print the result(s) of evaluating @var{exp}.
|
Pretty-print the result(s) of evaluating @var{exp}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
|
|
@ -475,15 +475,14 @@ first containing the first elements of each lists and the second
|
||||||
containing the second elements of each lists, and so on.
|
containing the second elements of each lists, and so on.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} count pred lst1 @dots{} lstN
|
@deffn {Scheme Procedure} count pred lst1 lst2 @dots{}
|
||||||
Return a count of the number of times @var{pred} returns true when
|
Return a count of the number of times @var{pred} returns true when
|
||||||
called on elements from the given lists.
|
called on elements from the given lists.
|
||||||
|
|
||||||
@var{pred} is called with @var{N} parameters @code{(@var{pred}
|
@var{pred} is called with @var{N} parameters @code{(@var{pred}
|
||||||
@var{elem1} @dots{} @var{elemN})}, each element being from the
|
@var{elem1} @dots{} @var{elemN} )}, each element being from the
|
||||||
corresponding @var{lst1} @dots{} @var{lstN}. The first call is with
|
corresponding list. The first call is with the first element of each
|
||||||
the first element of each list, the second with the second element
|
list, the second with the second element from each, and so on.
|
||||||
from each, and so on.
|
|
||||||
|
|
||||||
Counting stops when the end of the shortest list is reached. At least
|
Counting stops when the end of the shortest list is reached. At least
|
||||||
one list must be non-circular.
|
one list must be non-circular.
|
||||||
|
@ -497,14 +496,14 @@ one list must be non-circular.
|
||||||
|
|
||||||
@c FIXME::martin: Review me!
|
@c FIXME::martin: Review me!
|
||||||
|
|
||||||
@deffn {Scheme Procedure} fold proc init lst1 @dots{} lstN
|
@deffn {Scheme Procedure} fold proc init lst1 lst2 @dots{}
|
||||||
@deffnx {Scheme Procedure} fold-right proc init lst1 @dots{} lstN
|
@deffnx {Scheme Procedure} fold-right proc init lst1 lst2 @dots{}
|
||||||
Apply @var{proc} to the elements of @var{lst1} @dots{} @var{lstN} to
|
Apply @var{proc} to the elements of @var{lst1} @var{lst2} @dots{} to
|
||||||
build a result, and return that result.
|
build a result, and return that result.
|
||||||
|
|
||||||
Each @var{proc} call is @code{(@var{proc} @var{elem1} @dots{}
|
Each @var{proc} call is @code{(@var{proc} @var{elem1} @var{elem2}
|
||||||
@var{elemN} @var{previous})}, where @var{elem1} is from @var{lst1},
|
@dots{} @var{previous})}, where @var{elem1} is from @var{lst1},
|
||||||
through @var{elemN} from @var{lstN}. @var{previous} is the return
|
@var{elem2} is from @var{lst2}, and so on. @var{previous} is the return
|
||||||
from the previous call to @var{proc}, or the given @var{init} for the
|
from the previous call to @var{proc}, or the given @var{init} for the
|
||||||
first call. If any list is empty, just @var{init} is returned.
|
first call. If any list is empty, just @var{init} is returned.
|
||||||
|
|
||||||
|
@ -534,11 +533,11 @@ string, and the last among equal longest,
|
||||||
@result{} "xyz"
|
@result{} "xyz"
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
If @var{lst1} through @var{lstN} have different lengths, @code{fold}
|
If @var{lst1} @var{lst2} @dots{} have different lengths, @code{fold}
|
||||||
stops when the end of the shortest is reached; @code{fold-right}
|
stops when the end of the shortest is reached; @code{fold-right}
|
||||||
commences at the last element of the shortest. Ie.@: elements past
|
commences at the last element of the shortest. Ie.@: elements past the
|
||||||
the length of the shortest are ignored in the other @var{lst}s. At
|
length of the shortest are ignored in the other @var{lst}s. At least
|
||||||
least one @var{lst} must be non-circular.
|
one @var{lst} must be non-circular.
|
||||||
|
|
||||||
@code{fold} should be preferred over @code{fold-right} if the order of
|
@code{fold} should be preferred over @code{fold-right} if the order of
|
||||||
processing doesn't matter, or can be arranged either way, since
|
processing doesn't matter, or can be arranged either way, since
|
||||||
|
@ -567,8 +566,8 @@ a variable in which to build the result, but a self-contained
|
||||||
@code{for-each} would have to be written out each time.
|
@code{for-each} would have to be written out each time.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} pair-fold proc init lst1 @dots{} lstN
|
@deffn {Scheme Procedure} pair-fold proc init lst1 lst2 @dots{}
|
||||||
@deffnx {Scheme Procedure} pair-fold-right proc init lst1 @dots{} lstN
|
@deffnx {Scheme Procedure} pair-fold-right proc init lst1 lst2 @dots{}
|
||||||
The same as @code{fold} and @code{fold-right}, but apply @var{proc} to
|
The same as @code{fold} and @code{fold-right}, but apply @var{proc} to
|
||||||
the pairs of the lists instead of the list elements.
|
the pairs of the lists instead of the list elements.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -839,48 +838,51 @@ wanting to use @code{break} from within a @code{while} loop will need
|
||||||
to make a new define under a different name.
|
to make a new define under a different name.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} any pred lst1 lst2 @dots{} lstN
|
@deffn {Scheme Procedure} any pred lst1 lst2 @dots{}
|
||||||
Test whether any set of elements from @var{lst1} @dots{} lstN
|
Test whether any set of elements from @var{lst1} @var{lst2} @dots{}
|
||||||
satisfies @var{pred}. If so the return value is the return from the
|
satisfies @var{pred}. If so, the return value is the return value from
|
||||||
successful @var{pred} call, or if not the return is @code{#f}.
|
the successful @var{pred} call, or if not, the return value is
|
||||||
|
@code{#f}.
|
||||||
|
|
||||||
Each @var{pred} call is @code{(@var{pred} @var{elem1} @dots{}
|
If there are n list arguments, then @var{pred} must be a predicate
|
||||||
@var{elemN})} taking an element from each @var{lst}. The calls are
|
taking n arguments. Each @var{pred} call is @code{(@var{pred}
|
||||||
made successively for the first, second, etc elements of the lists,
|
@var{elem1} @var{elem2} @dots{} )} taking an element from each
|
||||||
stopping when @var{pred} returns non-@code{#f}, or when the end of the
|
@var{lst}. The calls are made successively for the first, second, etc.
|
||||||
shortest list is reached.
|
elements of the lists, stopping when @var{pred} returns non-@code{#f},
|
||||||
|
or when the end of the shortest list is reached.
|
||||||
|
|
||||||
The @var{pred} call on the last set of elements (ie.@: when the end of
|
The @var{pred} call on the last set of elements (i.e., when the end of
|
||||||
the shortest list has been reached), if that point is reached, is a
|
the shortest list has been reached), if that point is reached, is a
|
||||||
tail call.
|
tail call.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} every pred lst1 lst2 @dots{} lstN
|
@deffn {Scheme Procedure} every pred lst1 lst2 @dots{}
|
||||||
Test whether every set of elements from @var{lst1} @dots{} lstN
|
Test whether every set of elements from @var{lst1} @var{lst2} @dots{}
|
||||||
satisfies @var{pred}. If so the return value is the return from the
|
satisfies @var{pred}. If so, the return value is the return from the
|
||||||
final @var{pred} call, or if not the return is @code{#f}.
|
final @var{pred} call, or if not, the return value is @code{#f}.
|
||||||
|
|
||||||
Each @var{pred} call is @code{(@var{pred} @var{elem1} @dots{}
|
If there are n list arguments, then @var{pred} must be a predicate
|
||||||
@var{elemN})} taking an element from each @var{lst}. The calls are
|
taking n arguments. Each @var{pred} call is @code{(@var{pred}
|
||||||
made successively for the first, second, etc elements of the lists,
|
@var{elem1} @var{elem2 @dots{}})} taking an element from each
|
||||||
stopping if @var{pred} returns @code{#f}, or when the end of any of
|
@var{lst}. The calls are made successively for the first, second, etc.
|
||||||
the lists is reached.
|
elements of the lists, stopping if @var{pred} returns @code{#f}, or when
|
||||||
|
the end of any of the lists is reached.
|
||||||
|
|
||||||
The @var{pred} call on the last set of elements (ie.@: when the end of
|
The @var{pred} call on the last set of elements (i.e., when the end of
|
||||||
the shortest list has been reached) is a tail call.
|
the shortest list has been reached) is a tail call.
|
||||||
|
|
||||||
If one of @var{lst1} @dots{} @var{lstN} is empty then no calls to
|
If one of @var{lst1} @var{lst2} @dots{}is empty then no calls to
|
||||||
@var{pred} are made, and the return is @code{#t}.
|
@var{pred} are made, and the return value is @code{#t}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} list-index pred lst1 @dots{} lstN
|
@deffn {Scheme Procedure} list-index pred lst1 lst2 @dots{}
|
||||||
Return the index of the first set of elements, one from each of
|
Return the index of the first set of elements, one from each of
|
||||||
@var{lst1}@dots{}@var{lstN}, which satisfies @var{pred}.
|
@var{lst1} @var{lst2} @dots{}, which satisfies @var{pred}.
|
||||||
|
|
||||||
@var{pred} is called as @code{(@var{pred} elem1 @dots{} elemN)}.
|
@var{pred} is called as @code{(@var{elem1} @var{elem2 @dots{}})}.
|
||||||
Searching stops when the end of the shortest @var{lst} is reached.
|
Searching stops when the end of the shortest @var{lst} is reached.
|
||||||
The return index starts from 0 for the first set of elements. If no
|
The return index starts from 0 for the first set of elements. If no
|
||||||
set of elements pass then the return is @code{#f}.
|
set of elements pass, then the return value is @code{#f}.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(list-index odd? '(2 4 6 9)) @result{} 3
|
(list-index odd? '(2 4 6 9)) @result{} 3
|
||||||
|
@ -1045,11 +1047,11 @@ sameness. This predicate must be consistent with @code{eq?}
|
||||||
@code{eq?} then they must also be equal under the predicate. This
|
@code{eq?} then they must also be equal under the predicate. This
|
||||||
simply means a given object must be equal to itself.
|
simply means a given object must be equal to itself.
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lset<= = list1 list2 @dots{}
|
@deffn {Scheme Procedure} lset<= = list @dots{}
|
||||||
Return @code{#t} if each list is a subset of the one following it.
|
Return @code{#t} if each list is a subset of the one following it.
|
||||||
Ie.@: @var{list1} a subset of @var{list2}, @var{list2} a subset of
|
I.e., @var{list1} is a subset of @var{list2}, @var{list2} is a subset of
|
||||||
@var{list3}, etc, for as many lists as given. If only one list or no
|
@var{list3}, etc., for as many lists as given. If only one list or no
|
||||||
lists are given then the return is @code{#t}.
|
lists are given, the return value is @code{#t}.
|
||||||
|
|
||||||
A list @var{x} is a subset of @var{y} if each element of @var{x} is
|
A list @var{x} is a subset of @var{y} if each element of @var{x} is
|
||||||
equal to some element in @var{y}. Elements are compared using the
|
equal to some element in @var{y}. Elements are compared using the
|
||||||
|
@ -1062,11 +1064,11 @@ given @var{=} procedure, called as @code{(@var{=} xelem yelem)}.
|
||||||
@end example
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lset= = list1 list2 @dots{}
|
@deffn {Scheme Procedure} lset= = list @dots{}
|
||||||
Return @code{#t} if all argument lists are set-equal. @var{list1} is
|
Return @code{#t} if all argument lists are set-equal. @var{list1} is
|
||||||
compared to @var{list2}, @var{list2} to @var{list3}, etc, for as many
|
compared to @var{list2}, @var{list2} to @var{list3}, etc., for as many
|
||||||
lists as given. If only one list or no lists are given then the
|
lists as given. If only one list or no lists are given, the return
|
||||||
return is @code{#t}.
|
value is @code{#t}.
|
||||||
|
|
||||||
Two lists @var{x} and @var{y} are set-equal if each element of @var{x}
|
Two lists @var{x} and @var{y} are set-equal if each element of @var{x}
|
||||||
is equal to some element of @var{y} and conversely each element of
|
is equal to some element of @var{y} and conversely each element of
|
||||||
|
@ -1082,14 +1084,14 @@ yelem)}, but exactly which calls are made is unspecified.
|
||||||
@end example
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lset-adjoin = list elem1 @dots{}
|
@deffn {Scheme Procedure} lset-adjoin = list elem @dots{}
|
||||||
Add to @var{list} any of the given @var{elem}s not already in the
|
Add to @var{list} any of the given @var{elem}s not already in the list.
|
||||||
list. @var{elem}s are @code{cons}ed onto the start of @var{list} (so
|
@var{elem}s are @code{cons}ed onto the start of @var{list} (so the
|
||||||
the return shares a common tail with @var{list}), but the order
|
return value shares a common tail with @var{list}), but the order that
|
||||||
they're added is unspecified.
|
the @var{elem}s are added is unspecified.
|
||||||
|
|
||||||
The given @var{=} procedure is used for comparing elements, called as
|
The given @var{=} procedure is used for comparing elements, called as
|
||||||
@code{(@var{=} listelem elem)}, ie.@: the second argument is one of
|
@code{(@var{=} listelem elem)}, i.e., the second argument is one of
|
||||||
the given @var{elem} parameters.
|
the given @var{elem} parameters.
|
||||||
|
|
||||||
@example
|
@example
|
||||||
|
@ -1097,11 +1099,11 @@ the given @var{elem} parameters.
|
||||||
@end example
|
@end example
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lset-union = list1 list2 @dots{}
|
@deffn {Scheme Procedure} lset-union = list @dots{}
|
||||||
@deffnx {Scheme Procedure} lset-union! = list1 list2 @dots{}
|
@deffnx {Scheme Procedure} lset-union! = list @dots{}
|
||||||
Return the union of the argument list sets. The result is built by
|
Return the union of the argument list sets. The result is built by
|
||||||
taking the union of @var{list1} and @var{list2}, then the union of
|
taking the union of @var{list1} and @var{list2}, then the union of
|
||||||
that with @var{list3}, etc, for as many lists as given. For one list
|
that with @var{list3}, etc., for as many lists as given. For one list
|
||||||
argument that list itself is the result, for no list arguments the
|
argument that list itself is the result, for no list arguments the
|
||||||
result is the empty list.
|
result is the empty list.
|
||||||
|
|
||||||
|
@ -1197,8 +1199,8 @@ a tail with @var{list1}. @code{lset-diff+intersection!} may modify
|
||||||
@var{list1} to form its results.
|
@var{list1} to form its results.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} lset-xor = list1 list2 @dots{}
|
@deffn {Scheme Procedure} lset-xor = list @dots{}
|
||||||
@deffnx {Scheme Procedure} lset-xor! = list1 list2 @dots{}
|
@deffnx {Scheme Procedure} lset-xor! = list @dots{}
|
||||||
Return an XOR of the argument lists. For two lists this means those
|
Return an XOR of the argument lists. For two lists this means those
|
||||||
elements which are in exactly one of the lists. For more than two
|
elements which are in exactly one of the lists. For more than two
|
||||||
lists it means those elements which appear in an odd number of the
|
lists it means those elements which appear in an odd number of the
|
||||||
|
@ -1461,18 +1463,18 @@ indicated type.
|
||||||
@deffnx {Scheme Procedure} make-f64vector n [value]
|
@deffnx {Scheme Procedure} make-f64vector n [value]
|
||||||
@deffnx {Scheme Procedure} make-c32vector n [value]
|
@deffnx {Scheme Procedure} make-c32vector n [value]
|
||||||
@deffnx {Scheme Procedure} make-c64vector n [value]
|
@deffnx {Scheme Procedure} make-c64vector n [value]
|
||||||
@deffnx {C Function} scm_make_u8vector n [value]
|
@deffnx {C Function} scm_make_u8vector (n, value)
|
||||||
@deffnx {C Function} scm_make_s8vector n [value]
|
@deffnx {C Function} scm_make_s8vector (n, value)
|
||||||
@deffnx {C Function} scm_make_u16vector n [value]
|
@deffnx {C Function} scm_make_u16vector (n, value)
|
||||||
@deffnx {C Function} scm_make_s16vector n [value]
|
@deffnx {C Function} scm_make_s16vector (n, value)
|
||||||
@deffnx {C Function} scm_make_u32vector n [value]
|
@deffnx {C Function} scm_make_u32vector (n, value)
|
||||||
@deffnx {C Function} scm_make_s32vector n [value]
|
@deffnx {C Function} scm_make_s32vector (n, value)
|
||||||
@deffnx {C Function} scm_make_u64vector n [value]
|
@deffnx {C Function} scm_make_u64vector (n, value)
|
||||||
@deffnx {C Function} scm_make_s64vector n [value]
|
@deffnx {C Function} scm_make_s64vector (n, value)
|
||||||
@deffnx {C Function} scm_make_f32vector n [value]
|
@deffnx {C Function} scm_make_f32vector (n, value)
|
||||||
@deffnx {C Function} scm_make_f64vector n [value]
|
@deffnx {C Function} scm_make_f64vector (n, value)
|
||||||
@deffnx {C Function} scm_make_c32vector n [value]
|
@deffnx {C Function} scm_make_c32vector (n, value)
|
||||||
@deffnx {C Function} scm_make_c64vector n [value]
|
@deffnx {C Function} scm_make_c64vector (n, value)
|
||||||
Return a newly allocated homogeneous numeric vector holding @var{n}
|
Return a newly allocated homogeneous numeric vector holding @var{n}
|
||||||
elements of the indicated type. If @var{value} is given, the vector
|
elements of the indicated type. If @var{value} is given, the vector
|
||||||
is initialized with that value, otherwise the contents are
|
is initialized with that value, otherwise the contents are
|
||||||
|
@ -1547,18 +1549,18 @@ Return the number of elements in @var{vec}.
|
||||||
@deffnx {Scheme Procedure} f64vector-ref vec i
|
@deffnx {Scheme Procedure} f64vector-ref vec i
|
||||||
@deffnx {Scheme Procedure} c32vector-ref vec i
|
@deffnx {Scheme Procedure} c32vector-ref vec i
|
||||||
@deffnx {Scheme Procedure} c64vector-ref vec i
|
@deffnx {Scheme Procedure} c64vector-ref vec i
|
||||||
@deffnx {C Function} scm_u8vector_ref (vec i)
|
@deffnx {C Function} scm_u8vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_s8vector_ref (vec i)
|
@deffnx {C Function} scm_s8vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_u16vector_ref (vec i)
|
@deffnx {C Function} scm_u16vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_s16vector_ref (vec i)
|
@deffnx {C Function} scm_s16vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_u32vector_ref (vec i)
|
@deffnx {C Function} scm_u32vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_s32vector_ref (vec i)
|
@deffnx {C Function} scm_s32vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_u64vector_ref (vec i)
|
@deffnx {C Function} scm_u64vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_s64vector_ref (vec i)
|
@deffnx {C Function} scm_s64vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_f32vector_ref (vec i)
|
@deffnx {C Function} scm_f32vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_f64vector_ref (vec i)
|
@deffnx {C Function} scm_f64vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_c32vector_ref (vec i)
|
@deffnx {C Function} scm_c32vector_ref (vec, i)
|
||||||
@deffnx {C Function} scm_c64vector_ref (vec i)
|
@deffnx {C Function} scm_c64vector_ref (vec, i)
|
||||||
Return the element at index @var{i} in @var{vec}. The first element
|
Return the element at index @var{i} in @var{vec}. The first element
|
||||||
in @var{vec} is index 0.
|
in @var{vec} is index 0.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1575,18 +1577,18 @@ in @var{vec} is index 0.
|
||||||
@deffnx {Scheme Procedure} f64vector-set! vec i value
|
@deffnx {Scheme Procedure} f64vector-set! vec i value
|
||||||
@deffnx {Scheme Procedure} c32vector-set! vec i value
|
@deffnx {Scheme Procedure} c32vector-set! vec i value
|
||||||
@deffnx {Scheme Procedure} c64vector-set! vec i value
|
@deffnx {Scheme Procedure} c64vector-set! vec i value
|
||||||
@deffnx {C Function} scm_u8vector_set_x (vec i value)
|
@deffnx {C Function} scm_u8vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_s8vector_set_x (vec i value)
|
@deffnx {C Function} scm_s8vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_u16vector_set_x (vec i value)
|
@deffnx {C Function} scm_u16vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_s16vector_set_x (vec i value)
|
@deffnx {C Function} scm_s16vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_u32vector_set_x (vec i value)
|
@deffnx {C Function} scm_u32vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_s32vector_set_x (vec i value)
|
@deffnx {C Function} scm_s32vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_u64vector_set_x (vec i value)
|
@deffnx {C Function} scm_u64vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_s64vector_set_x (vec i value)
|
@deffnx {C Function} scm_s64vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_f32vector_set_x (vec i value)
|
@deffnx {C Function} scm_f32vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_f64vector_set_x (vec i value)
|
@deffnx {C Function} scm_f64vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_c32vector_set_x (vec i value)
|
@deffnx {C Function} scm_c32vector_set_x (vec, i, value)
|
||||||
@deffnx {C Function} scm_c64vector_set_x (vec i value)
|
@deffnx {C Function} scm_c64vector_set_x (vec, i, value)
|
||||||
Set the element at index @var{i} in @var{vec} to @var{value}. The
|
Set the element at index @var{i} in @var{vec} to @var{value}. The
|
||||||
first element in @var{vec} is index 0. The return value is
|
first element in @var{vec} is index 0. The return value is
|
||||||
unspecified.
|
unspecified.
|
||||||
|
@ -1734,13 +1736,13 @@ Return the number of elements in @var{vec}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} uniform-vector-ref vec i
|
@deffn {Scheme Procedure} uniform-vector-ref vec i
|
||||||
@deffnx {C Function} scm_uniform_vector_ref (vec i)
|
@deffnx {C Function} scm_uniform_vector_ref (vec, i)
|
||||||
Return the element at index @var{i} in @var{vec}. The first element
|
Return the element at index @var{i} in @var{vec}. The first element
|
||||||
in @var{vec} is index 0.
|
in @var{vec} is index 0.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} uniform-vector-set! vec i value
|
@deffn {Scheme Procedure} uniform-vector-set! vec i value
|
||||||
@deffnx {C Function} scm_uniform_vector_set_x (vec i value)
|
@deffnx {C Function} scm_uniform_vector_set_x (vec, i, value)
|
||||||
Set the element at index @var{i} in @var{vec} to @var{value}. The
|
Set the element at index @var{i} in @var{vec} to @var{value}. The
|
||||||
first element in @var{vec} is index 0. The return value is
|
first element in @var{vec} is index 0. The return value is
|
||||||
unspecified.
|
unspecified.
|
||||||
|
@ -2322,7 +2324,7 @@ any) will be stored for later retrieval via a call to
|
||||||
Wait for @var{thread} to terminate and return its exit value. When a
|
Wait for @var{thread} to terminate and return its exit value. When a
|
||||||
time value @var{timeout} is given, it specifies a point in time where
|
time value @var{timeout} is given, it specifies a point in time where
|
||||||
the waiting should be aborted. When the waiting is aborted,
|
the waiting should be aborted. When the waiting is aborted,
|
||||||
@var{timeoutval} is returned if it is specified; otherwise, a
|
@var{timeout-val} is returned if it is specified; otherwise, a
|
||||||
@code{join-timeout-exception} exception is raised
|
@code{join-timeout-exception} exception is raised
|
||||||
(@pxref{SRFI-18 Exceptions}). Exceptions may also be raised if the
|
(@pxref{SRFI-18 Exceptions}). Exceptions may also be raised if the
|
||||||
thread was terminated by a call to @code{thread-terminate!}
|
thread was terminated by a call to @code{thread-terminate!}
|
||||||
|
@ -2430,8 +2432,8 @@ replaces a procedure of the same name in the core library.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@defun condition-variable-name condition-variable
|
@defun condition-variable-name condition-variable
|
||||||
Returns the name assigned to @var{thread} at the time of its creation,
|
Returns the name assigned to @var{condition-variable} at the time of its
|
||||||
or @code{#f} if it was not given a name.
|
creation, or @code{#f} if it was not given a name.
|
||||||
@end defun
|
@end defun
|
||||||
|
|
||||||
@defun condition-variable-specific condition-variable
|
@defun condition-variable-specific condition-variable
|
||||||
|
@ -3156,10 +3158,10 @@ parameters of a function. It can be used with,
|
||||||
(use-modules (srfi srfi-26))
|
(use-modules (srfi srfi-26))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@deffn {library syntax} cut slot @dots{}
|
@deffn {library syntax} cut slot1 slot2 @dots{}
|
||||||
@deffnx {library syntax} cute slot @dots{}
|
@deffnx {library syntax} cute slot1 slot2 @dots{}
|
||||||
Return a new procedure which will make a call (@var{slot} @dots{}) but
|
Return a new procedure which will make a call (@var{slot1} @var{slot2}
|
||||||
with selected parameters specialized to given expressions.
|
@dots{}) but with selected parameters specialized to given expressions.
|
||||||
|
|
||||||
An example will illustrate the idea. The following is a
|
An example will illustrate the idea. The following is a
|
||||||
specialization of @code{write}, sending output to
|
specialization of @code{write}, sending output to
|
||||||
|
@ -3517,7 +3519,7 @@ values as in the following example:
|
||||||
Note that all fields of @var{type} and its supertypes must be specified.
|
Note that all fields of @var{type} and its supertypes must be specified.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} make-compound-condition . conditions
|
@deffn {Scheme Procedure} make-compound-condition condition1 condition2 @dots{}
|
||||||
Return a new compound condition composed of @var{conditions}. The
|
Return a new compound condition composed of @var{conditions}. The
|
||||||
returned condition has the type of each condition of @var{conditions}
|
returned condition has the type of each condition of @var{conditions}
|
||||||
(per @code{condition-has-type?}).
|
(per @code{condition-has-type?}).
|
||||||
|
@ -3533,7 +3535,7 @@ Return the value of the field named @var{field-name} from condition @var{c}.
|
||||||
If @var{c} is a compound condition and several underlying condition
|
If @var{c} is a compound condition and several underlying condition
|
||||||
types contain a field named @var{field-name}, then the value of the
|
types contain a field named @var{field-name}, then the value of the
|
||||||
first such field is returned, using the order in which conditions were
|
first such field is returned, using the order in which conditions were
|
||||||
passed to @var{make-compound-condition}.
|
passed to @code{make-compound-condition}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} extract-condition c type
|
@deffn {Scheme Procedure} extract-condition c type
|
||||||
|
@ -3569,13 +3571,14 @@ The example below defines condition type @code{&foo}, inheriting from
|
||||||
@end lisp
|
@end lisp
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {library syntax} condition type-field-bindings...
|
@deffn {library syntax} condition type-field-binding1 type-field-binding2 @dots{}
|
||||||
Return a new condition, or compound condition, initialized according to
|
Return a new condition or compound condition, initialized according to
|
||||||
@var{type-field-bindings}. Each @var{type-field-binding} must have the
|
@var{type-field-binding1} @var{type-field-binding2} @enddots{}. Each
|
||||||
form @code{(type field-specs...)}, where @var{type} is the name of a
|
@var{type-field-binding} must have the form @code{(type
|
||||||
variable bound to condition type; each @var{field-spec} must have the
|
field-specs...)}, where @var{type} is the name of a variable bound to a
|
||||||
form @code{(field-name value)} where @var{field-name} is a symbol
|
condition type; each @var{field-spec} must have the form
|
||||||
denoting the field being initialized to @var{value}. As for
|
@code{(field-name value)} where @var{field-name} is a symbol denoting
|
||||||
|
the field being initialized to @var{value}. As for
|
||||||
@code{make-condition}, all fields must be specified.
|
@code{make-condition}, all fields must be specified.
|
||||||
|
|
||||||
The following example returns a simple condition:
|
The following example returns a simple condition:
|
||||||
|
@ -3703,12 +3706,12 @@ Return the specified field of @var{opt}, an option object, as
|
||||||
described above for @code{option}.
|
described above for @code{option}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} args-fold args options unrecognized-option-proc operand-proc seeds @dots{}
|
@deffn {Scheme Procedure} args-fold args options unrecognized-option-proc operand-proc seed @dots{}
|
||||||
Process @var{args}, a list of program arguments such as that returned
|
Process @var{args}, a list of program arguments such as that returned by
|
||||||
by @code{(cdr (program-arguments))}, in order against @var{options}, a
|
@code{(cdr (program-arguments))}, in order against @var{options}, a list
|
||||||
list of option objects as described above. All functions called take
|
of option objects as described above. All functions called take the
|
||||||
the ``seeds'', or the last multiple-values as multiple arguments,
|
``seeds'', or the last multiple-values as multiple arguments, starting
|
||||||
starting with @var{seeds}, and must return the new seeds. Return the
|
with @var{seed} @dots{}, and must return the new seeds. Return the
|
||||||
final seeds.
|
final seeds.
|
||||||
|
|
||||||
Call @code{unrecognized-option-proc}, which is like an option object's
|
Call @code{unrecognized-option-proc}, which is like an option object's
|
||||||
|
@ -3858,7 +3861,7 @@ This is a Guile-specific addition to the SRFI, similar to the core
|
||||||
@defun with-parameters* param-list value-list thunk
|
@defun with-parameters* param-list value-list thunk
|
||||||
Establish a new dynamic scope, as per @code{parameterize} above,
|
Establish a new dynamic scope, as per @code{parameterize} above,
|
||||||
taking parameters from @var{param-list} and corresponding values from
|
taking parameters from @var{param-list} and corresponding values from
|
||||||
@var{values-list}. A call @code{(@var{thunk})} is made in the new
|
@var{value-list}. A call @code{(@var{thunk})} is made in the new
|
||||||
scope and the result from that @var{thunk} is the return from
|
scope and the result from that @var{thunk} is the return from
|
||||||
@code{with-parameters*}.
|
@code{with-parameters*}.
|
||||||
@end defun
|
@end defun
|
||||||
|
@ -4021,9 +4024,9 @@ SRFI-55 provides @code{require-extension} which is a portable
|
||||||
mechanism to load selected SRFI modules. This is implemented in the
|
mechanism to load selected SRFI modules. This is implemented in the
|
||||||
Guile core, there's no module needed to get SRFI-55 itself.
|
Guile core, there's no module needed to get SRFI-55 itself.
|
||||||
|
|
||||||
@deffn {library syntax} require-extension clause@dots{}
|
@deffn {library syntax} require-extension clause1 clause2 @dots{}
|
||||||
Require each of the given @var{clause} features, throwing an error if
|
Require the features of @var{clause1} @var{clause2} @dots{} , throwing
|
||||||
any are unavailable.
|
an error if any are unavailable.
|
||||||
|
|
||||||
A @var{clause} is of the form @code{(@var{identifier} arg...)}. The
|
A @var{clause} is of the form @code{(@var{identifier} arg...)}. The
|
||||||
only @var{identifier} currently supported is @code{srfi} and the
|
only @var{identifier} currently supported is @code{srfi} and the
|
||||||
|
|
|
@ -64,7 +64,7 @@ Dybvig at Indiana University.
|
||||||
@code{sxml-match} provides @code{case}-like form for pattern matching of XML
|
@code{sxml-match} provides @code{case}-like form for pattern matching of XML
|
||||||
nodes.
|
nodes.
|
||||||
|
|
||||||
@deffn {Scheme Syntax} sxml-match input-expression clause ...
|
@deffn {Scheme Syntax} sxml-match input-expression clause1 clause2 @dots{}
|
||||||
Match @var{input-expression}, an SXML tree, according to the given @var{clause}s
|
Match @var{input-expression}, an SXML tree, according to the given @var{clause}s
|
||||||
(one or more), each consisting of a pattern and one or more expressions to be
|
(one or more), each consisting of a pattern and one or more expressions to be
|
||||||
evaluated if the pattern match succeeds. Optionally, each @var{clause} within
|
evaluated if the pattern match succeeds. Optionally, each @var{clause} within
|
||||||
|
@ -356,8 +356,8 @@ transformation that formats a ``TV Guide'' into HTML.
|
||||||
|
|
||||||
@unnumberedsubsec @code{sxml-match-let} and @code{sxml-match-let*}
|
@unnumberedsubsec @code{sxml-match-let} and @code{sxml-match-let*}
|
||||||
|
|
||||||
@deffn {Scheme Syntax} sxml-match-let ((pat expr) ...) expression0 expression ...)
|
@deffn {Scheme Syntax} sxml-match-let ((pat expr) ...) expression0 expression ...
|
||||||
@deffnx {Scheme Syntax} sxml-match-let* ((pat expr) ...) expression0 expression ...)
|
@deffnx {Scheme Syntax} sxml-match-let* ((pat expr) ...) expression0 expression ...
|
||||||
These forms generalize the @code{let} and @code{let*} forms of Scheme to allow
|
These forms generalize the @code{let} and @code{let*} forms of Scheme to allow
|
||||||
an XML pattern in the binding position, rather than a simple variable.
|
an XML pattern in the binding position, rather than a simple variable.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
|
@ -432,7 +432,7 @@ then @code{local-set}, used when binding boxed variables.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Instruction empty-box index
|
@deffn Instruction empty-box index
|
||||||
Set the @var{indext}h local variable to a box containing a variable
|
Set the @var{index}th local variable to a box containing a variable
|
||||||
whose value is unbound. Used when compiling some @code{letrec}
|
whose value is unbound. Used when compiling some @code{letrec}
|
||||||
expressions.
|
expressions.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -918,13 +918,13 @@ Jump to @var{offset} if the object on the stack is false.
|
||||||
|
|
||||||
@deffn Instruction br-if-eq offset
|
@deffn Instruction br-if-eq offset
|
||||||
Jump to @var{offset} if the two objects located on the stack are
|
Jump to @var{offset} if the two objects located on the stack are
|
||||||
equal in the sense of @var{eq?}. Note that, for this instruction, the
|
equal in the sense of @code{eq?}. Note that, for this instruction, the
|
||||||
stack pointer is decremented by two Scheme objects instead of only
|
stack pointer is decremented by two Scheme objects instead of only
|
||||||
one.
|
one.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Instruction br-if-not-eq offset
|
@deffn Instruction br-if-not-eq offset
|
||||||
Same as @var{br-if-eq} for non-@code{eq?} objects.
|
Same as @code{br-if-eq} for non-@code{eq?} objects.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn Instruction br-if-null offset
|
@deffn Instruction br-if-null offset
|
||||||
|
|
|
@ -1116,7 +1116,7 @@ if there was no request body.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} write-request-body r bv
|
@deffn {Scheme Procedure} write-request-body r bv
|
||||||
Write @var{body}, a bytevector, to the port corresponding to the HTTP
|
Write @var{bv}, a bytevector, to the port corresponding to the HTTP
|
||||||
request @var{r}.
|
request @var{r}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -1212,7 +1212,7 @@ As a side effect, sets the encoding on @var{port} to ISO-8859-1
|
||||||
discussion of character sets in @ref{Responses}, for more information.
|
discussion of character sets in @ref{Responses}, for more information.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} build-response [#:version='(1 . 1)] [#:code=200] [#:reason-phrase=#f] [#:headers='()] [#:port=#f] [#:validate-headers=#t]
|
@deffn {Scheme Procedure} build-response [#:version='(1 . 1)] [#:code=200] [#:reason-phrase=#f] [#:headers='()] [#:port=#f] [#:validate-headers?=#t]
|
||||||
Construct an HTTP response object. If @var{validate-headers?} is true,
|
Construct an HTTP response object. If @var{validate-headers?} is true,
|
||||||
the headers are each run through their respective validators.
|
the headers are each run through their respective validators.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
@ -1241,7 +1241,7 @@ if there was no response body.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} write-response-body r bv
|
@deffn {Scheme Procedure} write-response-body r bv
|
||||||
Write @var{body}, a bytevector, to the port corresponding to the HTTP
|
Write @var{bv}, a bytevector, to the port corresponding to the HTTP
|
||||||
response @var{r}.
|
response @var{r}.
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
|
@ -1291,7 +1291,7 @@ the lower-level HTTP, request, and response modules.
|
||||||
@deffn {Scheme Procedure} open-socket-for-uri uri
|
@deffn {Scheme Procedure} open-socket-for-uri uri
|
||||||
@end deffn
|
@end deffn
|
||||||
|
|
||||||
@deffn {Scheme Procedure} http-get uri [#:port=(open-socket-for-uri uri)] [#:version='(1 . 1)] [#:keep-alive?=#f] [#:extra-headers='()] [#:decode-body=#t]
|
@deffn {Scheme Procedure} http-get uri [#:port=(open-socket-for-uri uri)] [#:version='(1 . 1)] [#:keep-alive?=#f] [#:extra-headers='()] [#:decode-body?=#t]
|
||||||
Connect to the server corresponding to @var{uri} and ask for the
|
Connect to the server corresponding to @var{uri} and ask for the
|
||||||
resource, using the @code{GET} method. If you already have a port open,
|
resource, using the @code{GET} method. If you already have a port open,
|
||||||
pass it as @var{port}. The port will be closed at the end of the
|
pass it as @var{port}. The port will be closed at the end of the
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
2001-08-27 Neil Jerram <neil@ossau.uklinux.net>
|
|
||||||
|
|
||||||
The change log for files in this directory continues backwards
|
|
||||||
from 2001-08-27 in ../ChangeLog, as all the Guile documentation
|
|
||||||
prior to this date was contained in a single directory.
|
|
|
@ -1,7 +0,0 @@
|
||||||
# -*- Makefile -*-
|
|
||||||
|
|
||||||
EXTRA_DIST = libguile-overview.texi snarf.texi contributors.texi \
|
|
||||||
libguile-tools.texi strings.texi data-rep.texi new-types.texi tk.texi \
|
|
||||||
debug-c.texi old-intro.texi unix-other.texi debug-scheme.texi \
|
|
||||||
sample-APIs.texi unix.texi guile-slib.texi scheme-concepts.texi \
|
|
||||||
jimb-org.texi scm-ref.texi ChangeLog-2008
|
|
|
@ -1,80 +0,0 @@
|
||||||
@node Contributors to Guile
|
|
||||||
@appendix Contributors to Guile
|
|
||||||
|
|
||||||
This Guile Manual was written by Mark Galassi, Jim Blandy and Gary
|
|
||||||
Houston.
|
|
||||||
|
|
||||||
Guile was developed over many years by the following people:
|
|
||||||
|
|
||||||
@table @strong
|
|
||||||
@item George Carrette
|
|
||||||
Wrote files present in Siod version 2.3, released in December of 1989.
|
|
||||||
|
|
||||||
@item Aubrey Jaffer
|
|
||||||
Wrote substantial portions of guile.texi, and surely others.
|
|
||||||
Changes to: eval.c, ioext.c, posix.c, gscm.c, scm.h, socket.c,
|
|
||||||
gsubr.c, sys.c, test.scm, stime.c, and unif.c.
|
|
||||||
|
|
||||||
@item Gary Houston
|
|
||||||
changes to many files in libguile.
|
|
||||||
|
|
||||||
wrote: libguile/socket.c, ice-9/expect.scm
|
|
||||||
|
|
||||||
@item Tom Lord
|
|
||||||
Many changes throughout.
|
|
||||||
In the subdirectory ctax, wrote:
|
|
||||||
Makefile.in configure.in hashtabs.scm macros.scm scm-ops.scm
|
|
||||||
c-ops.scm grammar.scm lexer.scm reader.scm
|
|
||||||
In the subdirectory gtcltk-lib, wrote:
|
|
||||||
Makefile.in guile-tcl.c guile-tk.c
|
|
||||||
configure.in guile-tcl.h guile-tk.h
|
|
||||||
In the subdirectory guile, wrote:
|
|
||||||
Makefile.in getopt.c getopt1.c
|
|
||||||
configure.in getopt.h guile.c
|
|
||||||
In the subdirectory ice-9, wrote:
|
|
||||||
Makefile.in configure.in lineio.scm poe.scm
|
|
||||||
boot-9.scm hcons.scm mapping.scm
|
|
||||||
In the subdirectory lang, wrote:
|
|
||||||
Makefile.in grammar.scm lr0.scm pp.scm
|
|
||||||
configure.in lex.scm lr1.scm
|
|
||||||
In the subdirectory rx, wrote:
|
|
||||||
Makefile.in runtests.c rxbitset.h rxnfa.c rxspencer.c
|
|
||||||
TESTS rx.c rxcontext.h rxnfa.h rxspencer.h
|
|
||||||
TESTS2C.sed rx.h rxcset.c rxnode.c rxstr.c
|
|
||||||
_rx.h rxall.h rxcset.h rxnode.h rxstr.h
|
|
||||||
configure.in rxanal.c rxdbug.c rxposix.c rxsuper.c
|
|
||||||
hashrexp.c rxanal.h rxgnucomp.c rxposix.h rxsuper.h
|
|
||||||
inst-rxposix.h rxbasic.c rxgnucomp.h rxproto.h rxunfa.c
|
|
||||||
rgx.c rxbasic.h rxhash.c rxsimp.c rxunfa.h
|
|
||||||
rgx.h rxbitset.c rxhash.h rxsimp.h testcases.h
|
|
||||||
In the subdirectory doc, wrote:
|
|
||||||
ctax.texi gtcltk.texi in.texi lang.texi
|
|
||||||
and portions of guile.texi.
|
|
||||||
|
|
||||||
@item Anthony Green
|
|
||||||
wrote the original code in the 'threads' directory, and
|
|
||||||
ice-9/threads.scm.
|
|
||||||
|
|
||||||
@item Mikael Djurfeldt
|
|
||||||
@example
|
|
||||||
In the subdirectory libguile, wrote:
|
|
||||||
backtrace.c debug.c options.c root.c srcprop.c stacks.c
|
|
||||||
backtrace.h debug.h options.h root.h srcprop.h stacks.h
|
|
||||||
In the subdirectory threads, rewrote:
|
|
||||||
coop-threads.c coop.c mit-pthreads.c threads.c
|
|
||||||
coop-threads.h fsu-pthreads.h mit-pthreads.h threads.h
|
|
||||||
Many other changes throughout.
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@item Mark Galassi
|
|
||||||
@example
|
|
||||||
Designed and implemented the high-level libguile API (the @code{gh_}
|
|
||||||
interface), based largely on the defunct @code{gscm_} interface. In the
|
|
||||||
subdirectory gh, wrote:
|
|
||||||
gh.c gh_eval.c gh_io.c gh_test_c.c
|
|
||||||
gh.h gh_funcs.c gh_list.c gh_test_repl.c
|
|
||||||
gh_data.c gh_init.c gh_predicates.c
|
|
||||||
@end example
|
|
||||||
|
|
||||||
|
|
||||||
@end table
|
|
|
@ -1,2 +0,0 @@
|
||||||
@node Debugging libguile
|
|
||||||
@chapter Debugging libguile
|
|
|
@ -1,2 +0,0 @@
|
||||||
@node Debugging Scheme programs
|
|
||||||
@chapter Debugging Scheme programs
|
|
1165
doc/sources/env.texi
1165
doc/sources/env.texi
File diff suppressed because it is too large
Load diff
|
@ -1,434 +0,0 @@
|
||||||
|
|
||||||
@menu
|
|
||||||
* Format Interface::
|
|
||||||
* Format Specification::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Format Interface, Format Specification, Format, Format
|
|
||||||
@subsection Format Interface
|
|
||||||
|
|
||||||
@defun format destination format-string . arguments
|
|
||||||
An almost complete implementation of Common LISP format description
|
|
||||||
according to the CL reference book @cite{Common LISP} from Guy L.
|
|
||||||
Steele, Digital Press. Backward compatible to most of the available
|
|
||||||
Scheme format implementations.
|
|
||||||
|
|
||||||
Returns @code{#t}, @code{#f} or a string; has side effect of printing
|
|
||||||
according to @var{format-string}. If @var{destination} is @code{#t},
|
|
||||||
the output is to the current output port and @code{#t} is returned. If
|
|
||||||
@var{destination} is @code{#f}, a formatted string is returned as the
|
|
||||||
result of the call. NEW: If @var{destination} is a string,
|
|
||||||
@var{destination} is regarded as the format string; @var{format-string} is
|
|
||||||
then the first argument and the output is returned as a string. If
|
|
||||||
@var{destination} is a number, the output is to the current error port
|
|
||||||
if available by the implementation. Otherwise @var{destination} must be
|
|
||||||
an output port and @code{#t} is returned.@refill
|
|
||||||
|
|
||||||
@var{format-string} must be a string. In case of a formatting error
|
|
||||||
format returns @code{#f} and prints a message on the current output or
|
|
||||||
error port. Characters are output as if the string were output by the
|
|
||||||
@code{display} function with the exception of those prefixed by a tilde
|
|
||||||
(~). For a detailed description of the @var{format-string} syntax
|
|
||||||
please consult a Common LISP format reference manual. For a test suite
|
|
||||||
to verify this format implementation load @file{formatst.scm}. Please
|
|
||||||
send bug reports to @code{lutzeb@@cs.tu-berlin.de}.
|
|
||||||
|
|
||||||
Note: @code{format} is not reentrant, i.e. only one @code{format}-call
|
|
||||||
may be executed at a time.
|
|
||||||
|
|
||||||
@end defun
|
|
||||||
|
|
||||||
@node Format Specification, , Format Interface, Format
|
|
||||||
@subsection Format Specification (Format version 3.0)
|
|
||||||
|
|
||||||
Please consult a Common LISP format reference manual for a detailed
|
|
||||||
description of the format string syntax. For a demonstration of the
|
|
||||||
implemented directives see @file{formatst.scm}.@refill
|
|
||||||
|
|
||||||
This implementation supports directive parameters and modifiers
|
|
||||||
(@code{:} and @code{@@} characters). Multiple parameters must be
|
|
||||||
separated by a comma (@code{,}). Parameters can be numerical parameters
|
|
||||||
(positive or negative), character parameters (prefixed by a quote
|
|
||||||
character (@code{'}), variable parameters (@code{v}), number of rest
|
|
||||||
arguments parameter (@code{#}), empty and default parameters. Directive
|
|
||||||
characters are case independent. The general form of a directive
|
|
||||||
is:@refill
|
|
||||||
|
|
||||||
@noindent
|
|
||||||
@var{directive} ::= ~@{@var{directive-parameter},@}[:][@@]@var{directive-character}
|
|
||||||
|
|
||||||
@noindent
|
|
||||||
@var{directive-parameter} ::= [ [-|+]@{0-9@}+ | '@var{character} | v | # ]
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection Implemented CL Format Control Directives
|
|
||||||
|
|
||||||
Documentation syntax: Uppercase characters represent the corresponding
|
|
||||||
control directive characters. Lowercase characters represent control
|
|
||||||
directive parameter descriptions.
|
|
||||||
|
|
||||||
@table @asis
|
|
||||||
@item @code{~A}
|
|
||||||
Any (print as @code{display} does).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@A}
|
|
||||||
left pad.
|
|
||||||
@item @code{~@var{mincol},@var{colinc},@var{minpad},@var{padchar}A}
|
|
||||||
full padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~S}
|
|
||||||
S-expression (print as @code{write} does).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@S}
|
|
||||||
left pad.
|
|
||||||
@item @code{~@var{mincol},@var{colinc},@var{minpad},@var{padchar}S}
|
|
||||||
full padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~D}
|
|
||||||
Decimal.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@D}
|
|
||||||
print number sign always.
|
|
||||||
@item @code{~:D}
|
|
||||||
print comma separated.
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}D}
|
|
||||||
padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~X}
|
|
||||||
Hexadecimal.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@X}
|
|
||||||
print number sign always.
|
|
||||||
@item @code{~:X}
|
|
||||||
print comma separated.
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}X}
|
|
||||||
padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~O}
|
|
||||||
Octal.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@O}
|
|
||||||
print number sign always.
|
|
||||||
@item @code{~:O}
|
|
||||||
print comma separated.
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}O}
|
|
||||||
padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~B}
|
|
||||||
Binary.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@B}
|
|
||||||
print number sign always.
|
|
||||||
@item @code{~:B}
|
|
||||||
print comma separated.
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar}B}
|
|
||||||
padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~@var{n}R}
|
|
||||||
Radix @var{n}.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n},@var{mincol},@var{padchar},@var{commachar}R}
|
|
||||||
padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~@@R}
|
|
||||||
print a number as a Roman numeral.
|
|
||||||
@item @code{~:@@R}
|
|
||||||
print a number as an ``old fashioned'' Roman numeral.
|
|
||||||
@item @code{~:R}
|
|
||||||
print a number as an ordinal English number.
|
|
||||||
@item @code{~:@@R}
|
|
||||||
print a number as a cardinal English number.
|
|
||||||
@item @code{~P}
|
|
||||||
Plural.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@P}
|
|
||||||
prints @code{y} and @code{ies}.
|
|
||||||
@item @code{~:P}
|
|
||||||
as @code{~P but jumps 1 argument backward.}
|
|
||||||
@item @code{~:@@P}
|
|
||||||
as @code{~@@P but jumps 1 argument backward.}
|
|
||||||
@end table
|
|
||||||
@item @code{~C}
|
|
||||||
Character.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@C}
|
|
||||||
prints a character as the reader can understand it (i.e. @code{#\} prefixing).
|
|
||||||
@item @code{~:C}
|
|
||||||
prints a character as emacs does (eg. @code{^C} for ASCII 03).
|
|
||||||
@end table
|
|
||||||
@item @code{~F}
|
|
||||||
Fixed-format floating-point (prints a flonum like @var{mmm.nnn}).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{width},@var{digits},@var{scale},@var{overflowchar},@var{padchar}F}
|
|
||||||
@item @code{~@@F}
|
|
||||||
If the number is positive a plus sign is printed.
|
|
||||||
@end table
|
|
||||||
@item @code{~E}
|
|
||||||
Exponential floating-point (prints a flonum like @var{mmm.nnn}@code{E}@var{ee}).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{width},@var{digits},@var{exponentdigits},@var{scale},@var{overflowchar},@var{padchar},@var{exponentchar}E}
|
|
||||||
@item @code{~@@E}
|
|
||||||
If the number is positive a plus sign is printed.
|
|
||||||
@end table
|
|
||||||
@item @code{~G}
|
|
||||||
General floating-point (prints a flonum either fixed or exponential).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{width},@var{digits},@var{exponentdigits},@var{scale},@var{overflowchar},@var{padchar},@var{exponentchar}G}
|
|
||||||
@item @code{~@@G}
|
|
||||||
If the number is positive a plus sign is printed.
|
|
||||||
@end table
|
|
||||||
@item @code{~$}
|
|
||||||
Dollars floating-point (prints a flonum in fixed with signs separated).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{digits},@var{scale},@var{width},@var{padchar}$}
|
|
||||||
@item @code{~@@$}
|
|
||||||
If the number is positive a plus sign is printed.
|
|
||||||
@item @code{~:@@$}
|
|
||||||
A sign is always printed and appears before the padding.
|
|
||||||
@item @code{~:$}
|
|
||||||
The sign appears before the padding.
|
|
||||||
@end table
|
|
||||||
@item @code{~%}
|
|
||||||
Newline.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}%}
|
|
||||||
print @var{n} newlines.
|
|
||||||
@end table
|
|
||||||
@item @code{~&}
|
|
||||||
print newline if not at the beginning of the output line.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}&}
|
|
||||||
prints @code{~&} and then @var{n-1} newlines.
|
|
||||||
@end table
|
|
||||||
@item @code{~|}
|
|
||||||
Page Separator.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}|}
|
|
||||||
print @var{n} page separators.
|
|
||||||
@end table
|
|
||||||
@item @code{~~}
|
|
||||||
Tilde.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}~}
|
|
||||||
print @var{n} tildes.
|
|
||||||
@end table
|
|
||||||
@item @code{~}<newline>
|
|
||||||
Continuation Line.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~:}<newline>
|
|
||||||
newline is ignored, white space left.
|
|
||||||
@item @code{~@@}<newline>
|
|
||||||
newline is left, white space ignored.
|
|
||||||
@end table
|
|
||||||
@item @code{~T}
|
|
||||||
Tabulation.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@T}
|
|
||||||
relative tabulation.
|
|
||||||
@item @code{~@var{colnum,colinc}T}
|
|
||||||
full tabulation.
|
|
||||||
@end table
|
|
||||||
@item @code{~?}
|
|
||||||
Indirection (expects indirect arguments as a list).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@@?}
|
|
||||||
extracts indirect arguments from format arguments.
|
|
||||||
@end table
|
|
||||||
@item @code{~(@var{str}~)}
|
|
||||||
Case conversion (converts by @code{string-downcase}).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~:(@var{str}~)}
|
|
||||||
converts by @code{string-capitalize}.
|
|
||||||
@item @code{~@@(@var{str}~)}
|
|
||||||
converts by @code{string-capitalize-first}.
|
|
||||||
@item @code{~:@@(@var{str}~)}
|
|
||||||
converts by @code{string-upcase}.
|
|
||||||
@end table
|
|
||||||
@item @code{~*}
|
|
||||||
Argument Jumping (jumps 1 argument forward).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}*}
|
|
||||||
jumps @var{n} arguments forward.
|
|
||||||
@item @code{~:*}
|
|
||||||
jumps 1 argument backward.
|
|
||||||
@item @code{~@var{n}:*}
|
|
||||||
jumps @var{n} arguments backward.
|
|
||||||
@item @code{~@@*}
|
|
||||||
jumps to the 0th argument.
|
|
||||||
@item @code{~@var{n}@@*}
|
|
||||||
jumps to the @var{n}th argument (beginning from 0)
|
|
||||||
@end table
|
|
||||||
@item @code{~[@var{str0}~;@var{str1}~;...~;@var{strn}~]}
|
|
||||||
Conditional Expression (numerical clause conditional).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}[}
|
|
||||||
take argument from @var{n}.
|
|
||||||
@item @code{~@@[}
|
|
||||||
true test conditional.
|
|
||||||
@item @code{~:[}
|
|
||||||
if-else-then conditional.
|
|
||||||
@item @code{~;}
|
|
||||||
clause separator.
|
|
||||||
@item @code{~:;}
|
|
||||||
default clause follows.
|
|
||||||
@end table
|
|
||||||
@item @code{~@{@var{str}~@}}
|
|
||||||
Iteration (args come from the next argument (a list)).
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}@{}
|
|
||||||
at most @var{n} iterations.
|
|
||||||
@item @code{~:@{}
|
|
||||||
args from next arg (a list of lists).
|
|
||||||
@item @code{~@@@{}
|
|
||||||
args from the rest of arguments.
|
|
||||||
@item @code{~:@@@{}
|
|
||||||
args from the rest args (lists).
|
|
||||||
@end table
|
|
||||||
@item @code{~^}
|
|
||||||
Up and out.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}^}
|
|
||||||
aborts if @var{n} = 0
|
|
||||||
@item @code{~@var{n},@var{m}^}
|
|
||||||
aborts if @var{n} = @var{m}
|
|
||||||
@item @code{~@var{n},@var{m},@var{k}^}
|
|
||||||
aborts if @var{n} <= @var{m} <= @var{k}
|
|
||||||
@end table
|
|
||||||
@end table
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection Not Implemented CL Format Control Directives
|
|
||||||
|
|
||||||
@table @asis
|
|
||||||
@item @code{~:A}
|
|
||||||
print @code{#f} as an empty list (see below).
|
|
||||||
@item @code{~:S}
|
|
||||||
print @code{#f} as an empty list (see below).
|
|
||||||
@item @code{~<~>}
|
|
||||||
Justification.
|
|
||||||
@item @code{~:^}
|
|
||||||
(sorry I don't understand its semantics completely)
|
|
||||||
@end table
|
|
||||||
|
|
||||||
|
|
||||||
@subsubsection Extended, Replaced and Additional Control Directives
|
|
||||||
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}D}
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}X}
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}O}
|
|
||||||
@item @code{~@var{mincol},@var{padchar},@var{commachar},@var{commawidth}B}
|
|
||||||
@item @code{~@var{n},@var{mincol},@var{padchar},@var{commachar},@var{commawidth}R}
|
|
||||||
@var{commawidth} is the number of characters between two comma characters.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@table @asis
|
|
||||||
@item @code{~I}
|
|
||||||
print an R5RS complex number as @code{~F~@@Fi} with passed parameters for
|
|
||||||
@code{~F}.
|
|
||||||
@item @code{~Y}
|
|
||||||
Pretty print formatting of an argument for scheme code lists.
|
|
||||||
@item @code{~K}
|
|
||||||
Same as @code{~?.}
|
|
||||||
@item @code{~!}
|
|
||||||
Flushes the output if format @var{destination} is a port.
|
|
||||||
@item @code{~_}
|
|
||||||
Print a @code{#\space} character
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}_}
|
|
||||||
print @var{n} @code{#\space} characters.
|
|
||||||
@end table
|
|
||||||
@item @code{~/}
|
|
||||||
Print a @code{#\tab} character
|
|
||||||
@table @asis
|
|
||||||
@item @code{~@var{n}/}
|
|
||||||
print @var{n} @code{#\tab} characters.
|
|
||||||
@end table
|
|
||||||
@item @code{~@var{n}C}
|
|
||||||
Takes @var{n} as an integer representation for a character. No arguments
|
|
||||||
are consumed. @var{n} is converted to a character by
|
|
||||||
@code{integer->char}. @var{n} must be a positive decimal number.@refill
|
|
||||||
@item @code{~:S}
|
|
||||||
Print out readproof. Prints out internal objects represented as
|
|
||||||
@code{#<...>} as strings @code{"#<...>"} so that the format output can always
|
|
||||||
be processed by @code{read}.
|
|
||||||
@refill
|
|
||||||
@item @code{~:A}
|
|
||||||
Print out readproof. Prints out internal objects represented as
|
|
||||||
@code{#<...>} as strings @code{"#<...>"} so that the format output can always
|
|
||||||
be processed by @code{read}.
|
|
||||||
@item @code{~Q}
|
|
||||||
Prints information and a copyright notice on the format implementation.
|
|
||||||
@table @asis
|
|
||||||
@item @code{~:Q}
|
|
||||||
prints format version.
|
|
||||||
@end table
|
|
||||||
@refill
|
|
||||||
@item @code{~F, ~E, ~G, ~$}
|
|
||||||
may also print number strings, i.e. passing a number as a string and
|
|
||||||
format it accordingly.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@subsubsection Configuration Variables
|
|
||||||
|
|
||||||
Format has some configuration variables at the beginning of
|
|
||||||
@file{format.scm} to suit the systems and users needs. There should be
|
|
||||||
no modification necessary for the configuration that comes with SLIB.
|
|
||||||
If modification is desired the variable should be set after the format
|
|
||||||
code is loaded. Format detects automatically if the running scheme
|
|
||||||
system implements floating point numbers and complex numbers.
|
|
||||||
|
|
||||||
@table @asis
|
|
||||||
|
|
||||||
@item @var{format:symbol-case-conv}
|
|
||||||
Symbols are converted by @code{symbol->string} so the case type of the
|
|
||||||
printed symbols is implementation dependent.
|
|
||||||
@code{format:symbol-case-conv} is a one arg closure which is either
|
|
||||||
@code{#f} (no conversion), @code{string-upcase}, @code{string-downcase}
|
|
||||||
or @code{string-capitalize}. (default @code{#f})
|
|
||||||
|
|
||||||
@item @var{format:iobj-case-conv}
|
|
||||||
As @var{format:symbol-case-conv} but applies for the representation of
|
|
||||||
implementation internal objects. (default @code{#f})
|
|
||||||
|
|
||||||
@item @var{format:expch}
|
|
||||||
The character prefixing the exponent value in @code{~E} printing. (default
|
|
||||||
@code{#\E})
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@subsubsection Compatibility With Other Format Implementations
|
|
||||||
|
|
||||||
@table @asis
|
|
||||||
@item SLIB format 2.x:
|
|
||||||
See @file{format.doc}.
|
|
||||||
|
|
||||||
@item SLIB format 1.4:
|
|
||||||
Downward compatible except for padding support and @code{~A}, @code{~S},
|
|
||||||
@code{~P}, @code{~X} uppercase printing. SLIB format 1.4 uses C-style
|
|
||||||
@code{printf} padding support which is completely replaced by the CL
|
|
||||||
@code{format} padding style.
|
|
||||||
|
|
||||||
@item MIT C-Scheme 7.1:
|
|
||||||
Downward compatible except for @code{~}, which is not documented
|
|
||||||
(ignores all characters inside the format string up to a newline
|
|
||||||
character). (7.1 implements @code{~a}, @code{~s},
|
|
||||||
~@var{newline}, @code{~~}, @code{~%}, numerical and variable
|
|
||||||
parameters and @code{:/@@} modifiers in the CL sense).@refill
|
|
||||||
|
|
||||||
@item Elk 1.5/2.0:
|
|
||||||
Downward compatible except for @code{~A} and @code{~S} which print in
|
|
||||||
uppercase. (Elk implements @code{~a}, @code{~s}, @code{~~}, and
|
|
||||||
@code{~%} (no directive parameters or modifiers)).@refill
|
|
||||||
|
|
||||||
@item Scheme->C 01nov91:
|
|
||||||
Downward compatible except for an optional destination parameter: S2C
|
|
||||||
accepts a format call without a destination which returns a formatted
|
|
||||||
string. This is equivalent to a #f destination in S2C. (S2C implements
|
|
||||||
@code{~a}, @code{~s}, @code{~c}, @code{~%}, and @code{~~} (no directive
|
|
||||||
parameters or modifiers)).@refill
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
This implementation of format is solely useful in the SLIB context
|
|
||||||
because it requires other components provided by SLIB.@refill
|
|
|
@ -1,2 +0,0 @@
|
||||||
@node Guile and SLIB
|
|
||||||
@chapter Guile and SLIB
|
|
|
@ -1,131 +0,0 @@
|
||||||
@menu
|
|
||||||
Preliminary
|
|
||||||
|
|
||||||
* Introduction::
|
|
||||||
* Using Guile::
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@bye
|
|
||||||
|
|
||||||
>You can actually put any English text to break up the menu, so you
|
|
||||||
>could put the "Part n" headings in it.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
|
||||||
--- Explains Guile's goals, and gives brief examples of how to use
|
|
||||||
Guile interactively (show off repl), as a script interpreter,
|
|
||||||
and as an embedded interpreter.
|
|
||||||
|
|
||||||
Part I: Guile Scheme
|
|
||||||
R4RS Scheme as a Starting Point
|
|
||||||
--- Here we refer to R4RS, and explain that we're only
|
|
||||||
describing differences.
|
|
||||||
Block comments and interpreter triggers
|
|
||||||
Symbol case
|
|
||||||
Keywords
|
|
||||||
Exceptions
|
|
||||||
Modules
|
|
||||||
--- the preceding three come first, because we need them
|
|
||||||
in order to explain the behavior of some things later
|
|
||||||
Exception Handling
|
|
||||||
--- mention that repls usually establish default exception handlers
|
|
||||||
Dynamic Wind
|
|
||||||
Records
|
|
||||||
Structures
|
|
||||||
Arrays
|
|
||||||
Binary Numeric Operations
|
|
||||||
Shared and Read-Only Strings
|
|
||||||
Object Properties
|
|
||||||
Association Lists and Hash Tables
|
|
||||||
(Dictionaries In General)
|
|
||||||
association lists
|
|
||||||
hash tables (Hash Values)
|
|
||||||
Input/Output ports
|
|
||||||
file ports
|
|
||||||
soft ports
|
|
||||||
string ports
|
|
||||||
extended I/O (fseek; line read/write)
|
|
||||||
Garbage Collection
|
|
||||||
Threads and Dynamic Roots
|
|
||||||
Reflection
|
|
||||||
eval
|
|
||||||
Tag Values
|
|
||||||
Weak references
|
|
||||||
Regular Expressions
|
|
||||||
SLIB
|
|
||||||
POSIX system calls and networking
|
|
||||||
--- I think people will generally know whether they're looking
|
|
||||||
for a system call or not, so this should be an okay category.
|
|
||||||
conventions (includes error handling)
|
|
||||||
ports vs. file descriptors
|
|
||||||
file system (mknod goes here, no?)
|
|
||||||
user database
|
|
||||||
time (includes gettimeofday or whatever, strftime, strptime)
|
|
||||||
processes
|
|
||||||
terminals and pseudo-terminals
|
|
||||||
pipes
|
|
||||||
networking (includes databases, address conversion, and sockets)
|
|
||||||
system identification (uname)
|
|
||||||
locales (setlocale)
|
|
||||||
--- Note that there is no more 'misc'. It's better to have
|
|
||||||
small sections than unhelpful names.
|
|
||||||
SCSH
|
|
||||||
--- includes info on how to get SCSH features (open this
|
|
||||||
module), but mostly just a pointer to the SCSH manual.
|
|
||||||
This should not be under POSIX. SCSH includes plenty of
|
|
||||||
high-level stuff for starting processes and string
|
|
||||||
processing. SCSH is not a subset of POSIX, nor the
|
|
||||||
reverse.
|
|
||||||
Tcl/Tk interface
|
|
||||||
Module internals
|
|
||||||
first-class variables
|
|
||||||
first-class modules
|
|
||||||
internal debugging interface
|
|
||||||
--- The name of this chapter needs to clearly distinguish it
|
|
||||||
from the appendix describing the debugger UI. The intro
|
|
||||||
should have a pointer to the UI appendix.
|
|
||||||
|
|
||||||
Part II: Using Scheme with C --- a Portable Interface
|
|
||||||
--- We cover gh in a completely separate section. Why? I admit
|
|
||||||
I'm on shaky ground, but here's my reasoning: People who want
|
|
||||||
to write portable C code need to restrict themselves to only
|
|
||||||
using GH, and GH's semantics are (necessarily) well-defined
|
|
||||||
without reference to Guile's particulars. This makes life
|
|
||||||
more difficult for folks who just prefer to use the GH
|
|
||||||
interface when they can, but I really think the SCM interface
|
|
||||||
is not so bad, once you're used to it. A *lot* of GH
|
|
||||||
functions are just wrappers for SCM functions.
|
|
||||||
--- We cover repls here too, since GH has repl functions.
|
|
||||||
|
|
||||||
Part III: Using Scheme with C --- Guile's Interface
|
|
||||||
Scheme data representation
|
|
||||||
Relationship between Scheme and C functions
|
|
||||||
--- this is where we explain that all the functions marked as
|
|
||||||
"Primitive Functions" are also accessible from C, and how
|
|
||||||
to derive the C interface given the Scheme interface, when
|
|
||||||
we don't spell it out.
|
|
||||||
... I think there's other stuff needed here ...
|
|
||||||
I/O internals
|
|
||||||
linking Guile with your code
|
|
||||||
--- Mark's "Tools to automate adding libraries" is not a
|
|
||||||
well-defined concept. I think this is closer to what we
|
|
||||||
want to cover for now.
|
|
||||||
snarfing
|
|
||||||
|
|
||||||
Appendices:
|
|
||||||
Obtaining and Installing Guile
|
|
||||||
Invoking Guile
|
|
||||||
--- mentions read-eval-print loops
|
|
||||||
--- both the SCSH and GAWK manuals relegate invocation details
|
|
||||||
to an appendix. We can give examples in the introduction.
|
|
||||||
debugger user interface
|
|
||||||
--- The title and introduction of this appendix need to
|
|
||||||
distinguish this clearly from the chapter on the internal
|
|
||||||
debugging interface.
|
|
||||||
|
|
||||||
Indices:
|
|
||||||
--- At the top of the function/variable index, remind people
|
|
||||||
to look for functions under their Scheme names as well as
|
|
||||||
their C names.
|
|
|
@ -1,30 +0,0 @@
|
||||||
@node Libguile overview
|
|
||||||
@chapter Libguile overview
|
|
||||||
@cindex libguile - overview
|
|
||||||
|
|
||||||
Extension languages, like Guile, Python and Tcl, can be embedded into a
|
|
||||||
C program, @footnote{Or a C++ or Fortran or Pascal program if you want.}
|
|
||||||
and thus allow the user to @emph{extend} the C program.
|
|
||||||
|
|
||||||
The way this is done is by providing a C language library with a well
|
|
||||||
defined interface. The interface consists of a set of public and
|
|
||||||
documented C-callable routines that offer the full interpreter
|
|
||||||
functionality, and allow the conversion of data between C and the
|
|
||||||
extension language.
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* An example of libguile functionality::
|
|
||||||
* What can be done with libguile::
|
|
||||||
* Schizofrenia -- two APIs::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node An example of libguile functionality
|
|
||||||
@section An example of libguile functionality
|
|
||||||
|
|
||||||
[Two examples: using strings and using data conversion.]
|
|
||||||
|
|
||||||
@node What can be done with libguile
|
|
||||||
@section What can be done with libguile
|
|
||||||
|
|
||||||
@node Schizofrenia -- two APIs
|
|
||||||
@section Schizofrenia -- two APIs
|
|
|
@ -1,191 +0,0 @@
|
||||||
@node Tools to automate adding libraries
|
|
||||||
@chapter Tools to automate adding libraries
|
|
||||||
|
|
||||||
You want to ...
|
|
||||||
|
|
||||||
The chapters @ref{Libguile -- high level interface} and @ref{Libguile --
|
|
||||||
SCM interface} showed how to make C libraries available from Scheme.
|
|
||||||
Here I will describe some automated tools that the Guile team has made
|
|
||||||
available. Some have been written especially for Guile (the Guile Magic
|
|
||||||
Snarfer), and some are also in use with other languages (Python, Perl,
|
|
||||||
...)
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* By hand with gh_::
|
|
||||||
* By hand with Guile Magic Snarfer::
|
|
||||||
* Automatically using libtool::
|
|
||||||
* Automatically using SWIG::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node By hand with gh_
|
|
||||||
@section By hand with gh_
|
|
||||||
|
|
||||||
@node By hand with Guile Magic Snarfer
|
|
||||||
@section By hand with Guile Magic Snarfer
|
|
||||||
|
|
||||||
When writing C code for use with Guile, you typically define a set of C
|
|
||||||
functions, and then make some of them visible to the Scheme world by
|
|
||||||
calling the @code{scm_make_gsubr} function; a C functions published in
|
|
||||||
this way is called a @dfn{subr}. If you have many subrs to publish, it
|
|
||||||
can sometimes be annoying to keep the list of calls to
|
|
||||||
@code{scm_make_gsubr} in sync with the list of function definitions.
|
|
||||||
Frequently, a programmer will define a new subr in C, recompile his
|
|
||||||
application, and then discover that the Scheme interpreter cannot see
|
|
||||||
the subr, because he forgot to call @code{scm_make_gsubr}.
|
|
||||||
|
|
||||||
Guile provides the @code{guile-snarf} command to manage this problem.
|
|
||||||
Using this tool, you can keep all the information needed to define the
|
|
||||||
subr alongside the function definition itself; @code{guile-snarf} will
|
|
||||||
extract this information from your source code, and automatically
|
|
||||||
generate a file of calls to @code{scm_make_gsubr} which you can
|
|
||||||
@code{#include} into an initialization function. (The command name
|
|
||||||
comes from the verb ``to snarf'', here meaning ``to unceremoniously
|
|
||||||
extract information from a somewhat unwilling source.'')
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* How guile-snarf works:: Using the @code{guile-snarf} command.
|
|
||||||
* Macros guile-snarf recognizes:: How to mark up code for @code{guile-snarf}.
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node How guile-snarf works
|
|
||||||
@subsection How @code{guile-snarf} works
|
|
||||||
|
|
||||||
For example, here is how you might define a new subr called
|
|
||||||
@code{clear-image}, implemented by the C function @code{clear_image}:
|
|
||||||
|
|
||||||
@example
|
|
||||||
@group
|
|
||||||
#include <libguile.h>
|
|
||||||
|
|
||||||
@dots{}
|
|
||||||
|
|
||||||
SCM_PROC (s_clear_image, "clear-image", 1, 0, 0, clear_image);
|
|
||||||
|
|
||||||
SCM
|
|
||||||
clear_image (SCM image_smob)
|
|
||||||
@{
|
|
||||||
@dots{}
|
|
||||||
@}
|
|
||||||
|
|
||||||
@dots{}
|
|
||||||
|
|
||||||
void
|
|
||||||
init_image_type ()
|
|
||||||
@{
|
|
||||||
#include "image-type.x"
|
|
||||||
@}
|
|
||||||
@end group
|
|
||||||
@end example
|
|
||||||
|
|
||||||
The @code{SCM_PROC} declaration says that the C function
|
|
||||||
@code{clear_image} implements a Scheme subr called @code{clear-image},
|
|
||||||
which takes one required argument, no optional arguments, and no tail
|
|
||||||
argument. @code{SCM_PROC} also declares a static array of characters
|
|
||||||
named @code{s_clear_image}, initialized to the string
|
|
||||||
@code{"clear-image"}. The body of @code{clear_image} may use the array
|
|
||||||
in error messages, instead of writing out the literal string; this may
|
|
||||||
save string space on some systems.
|
|
||||||
|
|
||||||
Assuming the text above lives in a file named @file{image-type.c}, you will
|
|
||||||
need to execute the following command to compile this file:
|
|
||||||
@example
|
|
||||||
guile-snarf image-type.c > image-type.x
|
|
||||||
@end example
|
|
||||||
@noindent This scans @file{image-type.c} for @code{SCM_PROC}
|
|
||||||
declarations, and sends the following output to the file
|
|
||||||
@file{image-type.x}:
|
|
||||||
@example
|
|
||||||
scm_make_gsubr (s_clear_image, 1, 0, 0, clear_image);
|
|
||||||
@end example
|
|
||||||
When compiled normally, @code{SCM_PROC} is a macro which expands to a
|
|
||||||
declaration of the @code{s_clear_image} string.
|
|
||||||
|
|
||||||
In other words, @code{guile-snarf} scans source code looking for uses of
|
|
||||||
the @code{SCM_PROC} macro, and generates C code to define the
|
|
||||||
appropriate subrs. You need to provide all the same information you
|
|
||||||
would if you were using @code{scm_make_gsubr} yourself, but you can
|
|
||||||
place the information near the function definition itself, so it is less
|
|
||||||
likely to become incorrect or out-of-date.
|
|
||||||
|
|
||||||
If you have many files that @code{guile-snarf} must process, you should
|
|
||||||
consider using a rule like the following in your Makefile:
|
|
||||||
@example
|
|
||||||
.SUFFIXES: .x
|
|
||||||
.c.x:
|
|
||||||
./guile-snarf $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $< > $@
|
|
||||||
@end example
|
|
||||||
This tells make to run @code{guile-snarf} to produce each needed
|
|
||||||
@file{.x} file from the corresponding @file{.c} file.
|
|
||||||
|
|
||||||
@code{guile-snarf} passes all its command-line arguments directly to the
|
|
||||||
C preprocessor, which it uses to extract the information it needs from
|
|
||||||
the source code. this means you can pass normal compilation flags to
|
|
||||||
@code{guile-snarf} to define preprocessor symbols, add header file
|
|
||||||
directories, and so on.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@node Macros guile-snarf recognizes
|
|
||||||
@subsection Macros @code{guile-snarf} recognizes
|
|
||||||
|
|
||||||
Here are the macros you can use in your source code from which
|
|
||||||
@code{guile-snarf} can construct initialization code:
|
|
||||||
|
|
||||||
|
|
||||||
@defmac SCM_PROC (@var{namestr}, @var{name}, @var{req}, @var{opt}, @var{tail}, @var{c_func})
|
|
||||||
Declare a new Scheme primitive function, or @dfn{subr}. The new subr
|
|
||||||
will be named @var{name} in Scheme code, and be implemented by the C
|
|
||||||
function @var{c_func}. The subr will take @var{req} required arguments
|
|
||||||
and @var{opt} optional arguments. If @var{tail} is non-zero, the
|
|
||||||
function will accept any remaining arguments as a list.
|
|
||||||
|
|
||||||
Use this macro outside all function bodies, preferably above the
|
|
||||||
definition of @var{c_func} itself. When compiled, the @code{SCM_PROC}
|
|
||||||
declaration will expand to a definition for the @var{namestr} array,
|
|
||||||
initialized to @var{name}. The @code{guile-snarf} command uses this
|
|
||||||
declaration to automatically generate initialization code to create the
|
|
||||||
subr and bind it in the top-level environment. @xref{How guile-snarf
|
|
||||||
works}, for more info.
|
|
||||||
|
|
||||||
@xref{Subrs}, for details on argument passing and how to write
|
|
||||||
@var{c_func}.
|
|
||||||
@end defmac
|
|
||||||
|
|
||||||
|
|
||||||
@defmac SCM_GLOBAL (@var{var}, @var{scheme_name})
|
|
||||||
Declare a global Scheme variable named @var{scheme_name}, and a static C
|
|
||||||
variable named @var{var} to point to it. The value of the Scheme
|
|
||||||
variable lives in the @sc{cdr} of the cell @var{var} points to.
|
|
||||||
Initialize the variable to @code{#f}.
|
|
||||||
|
|
||||||
Use this macro outside all function bodies. When compiled, the
|
|
||||||
@code{SCM_GLOBAL} macro will expand to a definition for the variable
|
|
||||||
@var{var}, initialized to an innocuous value. The @code{guile-snarf}
|
|
||||||
command will use this declaration to automatically generate code to
|
|
||||||
create a global variable named @var{scheme_name}, and store a pointer to
|
|
||||||
its cell in @var{var}.
|
|
||||||
@end defmac
|
|
||||||
|
|
||||||
|
|
||||||
@defmac SCM_CONST_LONG (@var{var}, @var{scheme_name}, @var{value})
|
|
||||||
Like @code{SCM_GLOBAL}, but initialize the variable to @var{value},
|
|
||||||
which must be an integer.
|
|
||||||
@end defmac
|
|
||||||
|
|
||||||
|
|
||||||
@defmac SCM_SYMBOL (@var{var}, @var{name})
|
|
||||||
Declare a C variable of type @code{SCM} named @var{var}, and initialize
|
|
||||||
it to the Scheme symbol object whose name is @var{name}.
|
|
||||||
|
|
||||||
Use this macro outside all function bodies. When compiled, the
|
|
||||||
@code{SCM_SYMBOL} macro will expand to a definition for the variable
|
|
||||||
@var{var}, initialized to an innocuous value. The @code{guile-snarf}
|
|
||||||
command will use this declaration to automatically generate code to
|
|
||||||
create a symbol named @var{name}, and store it in @var{var}.
|
|
||||||
@end defmac
|
|
||||||
|
|
||||||
@node Automatically using libtool
|
|
||||||
@section Automatically using libtool
|
|
||||||
|
|
||||||
@node Automatically using SWIG
|
|
||||||
@section Automatically using SWIG
|
|
|
@ -1,2 +0,0 @@
|
||||||
@node Adding types to Guile
|
|
||||||
@chapter Adding types to Guile
|
|
|
@ -1,290 +0,0 @@
|
||||||
@node Introduction
|
|
||||||
@chapter Introduction
|
|
||||||
|
|
||||||
Guile is an interpreter for Scheme, a clean, economical programming
|
|
||||||
language in the Lisp family. You can invoke Guile from the shell to
|
|
||||||
evaluate Scheme expressions interactively, or use it as an interpreter
|
|
||||||
for script files. However, Guile is also packaged as a library, to be
|
|
||||||
embedded as an extension language into other applications. The
|
|
||||||
application can supplement the base language with special-purpose
|
|
||||||
functions and datatypes, allowing the user to customize and extend it by
|
|
||||||
writing Scheme code.
|
|
||||||
|
|
||||||
In its simplest form, Guile is an ordinary interpreter. The
|
|
||||||
@code{guile} program can read and evaluate Scheme expressions entered
|
|
||||||
from the terminal. Here is a sample interaction between Guile and a
|
|
||||||
user; the user's input appears after the @code{$} and @code{guile>}
|
|
||||||
prompts:
|
|
||||||
|
|
||||||
@example
|
|
||||||
$ guile
|
|
||||||
guile> (+ 1 2 3) ; add some numbers
|
|
||||||
6
|
|
||||||
guile> (define (factorial n) ; define a function
|
|
||||||
(if (zero? n) 1 (* n (factorial (- n 1)))))
|
|
||||||
guile> (factorial 20)
|
|
||||||
2432902008176640000
|
|
||||||
guile> (getpwnam "jimb") ; find my entry in /etc/passwd
|
|
||||||
#("jimb" ".0krIpK2VqNbU" 4008 10 "Jim Blandy" "/u/jimb"
|
|
||||||
"/usr/local/bin/bash")
|
|
||||||
guile> @kbd{C-d}
|
|
||||||
$
|
|
||||||
@end example
|
|
||||||
|
|
||||||
Guile can also interpret script files. For example, here is a Guile script
|
|
||||||
containing a script which displays the
|
|
||||||
|
|
||||||
|
|
||||||
application can
|
|
||||||
supplement the base language with its own functions, datatypes and
|
|
||||||
syntax, allowing the user to extend and
|
|
||||||
|
|
||||||
|
|
||||||
Guile interpret
|
|
||||||
|
|
||||||
. An
|
|
||||||
application the Guile interpreter to allow
|
|
||||||
|
|
||||||
|
|
||||||
, allowing
|
|
||||||
applications to incorporate the Scheme interpreter for customization
|
|
||||||
|
|
||||||
[[interactive]]
|
|
||||||
[[script interpreter]]
|
|
||||||
[[embedded]]
|
|
||||||
|
|
||||||
[[other languages]]
|
|
||||||
The concept of an extension language library does not originate with
|
|
||||||
Guile. However, Guile is the first to offer users a choice of languages
|
|
||||||
to program in.
|
|
||||||
|
|
||||||
|
|
||||||
Guile currently supports Scheme and Ctax , and we expect to support Emacs Lisp in the near future.
|
|
||||||
|
|
||||||
|
|
||||||
Scheme is powerful enough that other languages can be
|
|
||||||
conveniently translated into it,
|
|
||||||
|
|
||||||
However, unlike other extension packages, Guile gives users a choice of
|
|
||||||
languages to program in. Guile can
|
|
||||||
|
|
||||||
|
|
||||||
In this sense, Guile resembles the Tcl and Python packages, providing
|
|
||||||
both an ordinary interpreter and an extension language library.
|
|
||||||
However, unlike those packages, Guile supports more than one programming
|
|
||||||
language.
|
|
||||||
|
|
||||||
; users can
|
|
||||||
write Scheme code to control and customize applications which
|
|
||||||
incorporate Guile
|
|
||||||
|
|
||||||
, adding their own functions,
|
|
||||||
datatypes, and syntax, to allow the user to programm
|
|
||||||
|
|
||||||
|
|
||||||
link it into your own programs to make them
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Guile is a library containing an interpreter for Scheme, a complete but
|
|
||||||
economical programming language, which the developer can customize to
|
|
||||||
suit the application at hand by adding new functions, data types, and
|
|
||||||
control structures. These may be implemented in C, and then
|
|
||||||
``exported'' for use by the interpreted code. Because Guile already
|
|
||||||
provides a full-featured interpreter, the developer need not neglect the
|
|
||||||
language's design in order to concentrate on code relevant to the task.
|
|
||||||
In this way, Guile provides a framework for the construction of
|
|
||||||
domain-specific languages.
|
|
||||||
|
|
||||||
Guile provides first-class functions, a rich set of data types,
|
|
||||||
exception handling, a module system, and a powerful macro facility.
|
|
||||||
Guile also supports dynamic linking and direct access to Unix system
|
|
||||||
calls. Releases in the near future will support a source-level
|
|
||||||
debugger and bindings for the Tk user interface toolkit.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Guile is a framework for writing applications controlled by specialized
|
|
||||||
languages. In its simplest form, Guile is an interpreter for Scheme, a
|
|
||||||
clean, economical programming language in the Lisp family. However,
|
|
||||||
Guile is packaged as a library, allowing applications to link against it
|
|
||||||
and use Scheme as their extension language. The application can add
|
|
||||||
primitive functions to the language, implement new data types, and even
|
|
||||||
adjust the language's syntax.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[the introduction is probably not what Jim has in mind; I just took the
|
|
||||||
one I had in earlier, since the file had the same name intro.texi]
|
|
||||||
|
|
||||||
Guile is an implementation of the Scheme programming language, but, like
|
|
||||||
other modern implementations of Scheme, it adds many features that the
|
|
||||||
community of Scheme programmers considers necessary for an ``industrial
|
|
||||||
strength'' language.
|
|
||||||
|
|
||||||
Examples of extensions to Scheme are the module system
|
|
||||||
(@pxref{Modules}), the Unix system programming tools (@pxref{POSIX
|
|
||||||
system calls and networking} and @pxref{The Scheme shell (scsh)}), an
|
|
||||||
interface to @emph{libtool} to make it easier to add C libraries as
|
|
||||||
primitives (@pxref{Linking Guile with your code}), and (FIXME add more).
|
|
||||||
|
|
||||||
On top of these extensions, which many other Scheme implementations
|
|
||||||
provide, Guile also offers the possibility of writing routines in other
|
|
||||||
languages and running them simultaneously with Scheme. The desire to
|
|
||||||
implement other languages (in particular Emacs Lisp) on top of Scheme is
|
|
||||||
responsible for Guile's only deviation from the R4RS @footnote{R4RS is
|
|
||||||
the Revised^4 Report on the Algorithmic Language Scheme, the closest
|
|
||||||
thing to a standard Scheme specification today} Scheme standard
|
|
||||||
(@cite{r4rs}): Guile is case sensitive, whereas ``standard'' Scheme is
|
|
||||||
not.
|
|
||||||
|
|
||||||
But even more fundamentally, Guile is meant to be an @emph{embeddable}
|
|
||||||
Scheme interpreter. This means that a lot of work has gone into
|
|
||||||
packaging the interpreter as a C library (@pxref{A Portable C to Scheme Interface} and @pxref{Scheme data representation}).
|
|
||||||
|
|
||||||
This reference manual is mainly driven by the need to document all the
|
|
||||||
features that go beyond standard Scheme.
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* Getting started::
|
|
||||||
* Guile feature list::
|
|
||||||
* What you need to use Guile::
|
|
||||||
* Roadmap to the Manual::
|
|
||||||
* Motivation for Guile::
|
|
||||||
* History of Guile::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Getting started
|
|
||||||
@section Getting started
|
|
||||||
|
|
||||||
We assume that you know how to program in Scheme, although we do not
|
|
||||||
assume advanced knowledge. If you don't know Scheme, there are many
|
|
||||||
good books on Scheme at all levels, and the Guile Tutorial might give
|
|
||||||
you a good enough feel for the language. We also assume that you know
|
|
||||||
how to program in C, since there will be many examples of how to program
|
|
||||||
in C using Guile as a library.
|
|
||||||
|
|
||||||
Many diverse topics from the world of Unix hacking will be covered here,
|
|
||||||
such as shared libraries, socket programming, garbage collection, and so
|
|
||||||
forth. If at any time you feel you don't have enough background on a
|
|
||||||
given topic, just go up a level or two in the manual, and you will find
|
|
||||||
that the chapter begins with a few paragraphs that introduce the topic.
|
|
||||||
If you are still lost, read through the Guile tutorial and then come
|
|
||||||
back to this reference manual.
|
|
||||||
|
|
||||||
To run the core Guile interpreter and extension library you need no more
|
|
||||||
than a basically configured GNU/Unix system and the Guile sources. You
|
|
||||||
should download and install the Guile sources (@pxref{Obtaining and
|
|
||||||
Installing Guile}).
|
|
||||||
|
|
||||||
|
|
||||||
@node Guile feature list
|
|
||||||
@section Guile feature list
|
|
||||||
|
|
||||||
In a reductionist view, Guile could be regarded as:
|
|
||||||
@itemize @bullet
|
|
||||||
@item
|
|
||||||
An R4RS-compliant Scheme interpreter.
|
|
||||||
|
|
||||||
@item
|
|
||||||
Some Scheme features that go beyond the R4RS standard, notably a module
|
|
||||||
system, exception handling primitives and an interface to Aubrey
|
|
||||||
Jaffer's SLIB.
|
|
||||||
|
|
||||||
@item
|
|
||||||
A symbolic debugger for Scheme, and gdb extensions to facilitate
|
|
||||||
debugging libguile programs.
|
|
||||||
|
|
||||||
@item
|
|
||||||
An embeddable version of the same interpreter, called @emph{libguile}.
|
|
||||||
|
|
||||||
@item
|
|
||||||
A portable high level API on top of libguile (the @code{gh_} interface).
|
|
||||||
|
|
||||||
@item
|
|
||||||
A collection of bundled C libraries with a Guile API. As we write, this
|
|
||||||
list includes:
|
|
||||||
|
|
||||||
@table @strong
|
|
||||||
@item Rx
|
|
||||||
a regular expression library.
|
|
||||||
|
|
||||||
@item Unix
|
|
||||||
a low-level interface to the POSIX system calls, socket library
|
|
||||||
and other Unix system services.
|
|
||||||
|
|
||||||
@item Tk
|
|
||||||
an interface to John Ousterhout's Tk toolkit.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
@item
|
|
||||||
A set of tools for implementing other languages @emph{on top of Scheme},
|
|
||||||
and an example implementation of a language called @emph{Ctax}.
|
|
||||||
|
|
||||||
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
|
|
||||||
@node What you need to use Guile
|
|
||||||
@section What you need to use Guile
|
|
||||||
|
|
||||||
|
|
||||||
@node Roadmap to the Manual
|
|
||||||
@section Roadmap to the Manual
|
|
||||||
|
|
||||||
@node Motivation for Guile
|
|
||||||
@section Motivation for Guile
|
|
||||||
|
|
||||||
@node History of Guile
|
|
||||||
@section History of Guile
|
|
||||||
|
|
||||||
@page
|
|
||||||
@node Using Guile
|
|
||||||
@chapter Using Guile
|
|
||||||
|
|
||||||
[I think that this might go in the appendix in Jim's view of the manual]
|
|
||||||
|
|
||||||
@page
|
|
||||||
@node Invoking Guile
|
|
||||||
@appendix Invoking Guile
|
|
||||||
--- mentions read-eval-print loops
|
|
||||||
--- both the SCSH and GAWK manuals relegate invocation details
|
|
||||||
to an appendix. We can give examples in the introduction.
|
|
||||||
|
|
||||||
@table @samp
|
|
||||||
@item -h
|
|
||||||
@itemx --help
|
|
||||||
Display a helpful message.
|
|
||||||
@item -v
|
|
||||||
@item --version
|
|
||||||
Display the current version.
|
|
||||||
@item --emacs
|
|
||||||
To be used for emacs editing support.
|
|
||||||
@item -s @var{file}
|
|
||||||
Process @var{file} as a script then quit. This is a terminating option:
|
|
||||||
any further command line arguments can be accessed by the script using
|
|
||||||
the @code{(program-arguments)} procedure.
|
|
||||||
|
|
||||||
An executable script can start with the following:
|
|
||||||
|
|
||||||
@smallexample
|
|
||||||
#!/usr/bin/guile -s
|
|
||||||
!#
|
|
||||||
@end smallexample
|
|
||||||
|
|
||||||
Note the @code{!#} token on the second line. It is very important
|
|
||||||
to include this token when writing Guile scripts. Guile and SCSH,
|
|
||||||
the Scheme shell, share the convention that @code{#!} and
|
|
||||||
@code{!#} may be used to mark block comments (@pxref{Block
|
|
||||||
comments and interpreter triggers}). If the closing @code{!#}
|
|
||||||
token is not included, then Guile will consider the block comment
|
|
||||||
to be unclosed, and the script will probably not compile
|
|
||||||
correctly.
|
|
||||||
|
|
||||||
It is also important to include the @samp{-s} option at the
|
|
||||||
beginning of the Guile script, so that Guile knows not to behave
|
|
||||||
in an interactive fashion.
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
@node Examples of adding libraries
|
|
||||||
@chapter Examples of adding libraries
|
|
||||||
|
|
||||||
Should contain examples of brute-force gh_, Guile magic snarfer,
|
|
||||||
libtool, SWIG on a dummy API, followed by some real examples of how
|
|
||||||
libraries are added.
|
|
|
@ -1,249 +0,0 @@
|
||||||
@node Guile Scheme concepts
|
|
||||||
@chapter Guile Scheme concepts
|
|
||||||
|
|
||||||
Most Scheme implementations go beyond what is specified in the R4RS
|
|
||||||
document @footnote{Remember? R4RS is the Revised^4 report on the
|
|
||||||
Algorithmic Language Scheme}, mostly because R4RS does not give
|
|
||||||
specifications (or even recommendations) regarding some issues that are
|
|
||||||
quite important in practical programming.
|
|
||||||
|
|
||||||
Here is a list of how Guile implements some of these much-needed Scheme
|
|
||||||
extensions; other Scheme implementations do so quite similarly.
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* Scheme slang::
|
|
||||||
* Read-eval-print loops::
|
|
||||||
* Extra data types::
|
|
||||||
* Miscellaneous features::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Scheme slang
|
|
||||||
@section Scheme slang
|
|
||||||
@cindex slang
|
|
||||||
|
|
||||||
Even if you read some of the nice books on Scheme, or the R4RS report,
|
|
||||||
you might not find some of the terms frequently used by Scheme hackers,
|
|
||||||
both in the manual and in the @url{news:comp.lang.scheme} newsgroup.
|
|
||||||
|
|
||||||
Here is a glossary of some of the terms that make Scheme beginners and
|
|
||||||
intermediate users say ``huh?''
|
|
||||||
|
|
||||||
@table @strong
|
|
||||||
@item thunk
|
|
||||||
@cindex thunk
|
|
||||||
A Scheme procedure that takes no arguments. In this example,
|
|
||||||
@code{thunk} and @code{another-thunk} are both thunks:
|
|
||||||
@lisp
|
|
||||||
(define (thunk)
|
|
||||||
(display "Dude, I'm a thunk!")
|
|
||||||
(newline))
|
|
||||||
(define another-thunk
|
|
||||||
(lambda ()
|
|
||||||
(display "Me too!\n")
|
|
||||||
(newline)))
|
|
||||||
@end lisp
|
|
||||||
|
|
||||||
@item closure
|
|
||||||
@cindex closure
|
|
||||||
A closure is a procedure. However, the term emphasizes the fact that a
|
|
||||||
Scheme procedure remembers (or @dfn{closes over}) the variables that
|
|
||||||
were visible when the @code{lambda} expression was
|
|
||||||
evaluated.
|
|
||||||
|
|
||||||
In the example below, we might refer to @code{q} as a closure, because
|
|
||||||
it has closed over the value of @code{x}:
|
|
||||||
@lisp
|
|
||||||
(define p
|
|
||||||
(lambda (x)
|
|
||||||
(lambda (y)
|
|
||||||
(+ x y))))
|
|
||||||
(define q (p 5.7))
|
|
||||||
|
|
||||||
(q 10)
|
|
||||||
@result{} 15.7
|
|
||||||
@end lisp
|
|
||||||
|
|
||||||
However, strictly speaking, every Scheme procedure is really a closure,
|
|
||||||
since it closes over the top-level environment.
|
|
||||||
|
|
||||||
@item alist
|
|
||||||
@itemx association list
|
|
||||||
|
|
||||||
@item plist
|
|
||||||
@itemx property list
|
|
||||||
|
|
||||||
@end table
|
|
||||||
|
|
||||||
|
|
||||||
@node Read-eval-print loops
|
|
||||||
@section Read-eval-print loops
|
|
||||||
@cindex Read-eval-print loop
|
|
||||||
@cindex REPL
|
|
||||||
|
|
||||||
To explicitly mention the Scheme read-eval-print loop (REPL) seems weird
|
|
||||||
because we are all accustomed to firing up an interpreter and having it
|
|
||||||
read and execute commands.
|
|
||||||
|
|
||||||
But the REPL is not specified in R4RS; rather, it is proposed by the
|
|
||||||
Scheme Bible @cite{Structure and Interpretation of Computer Programs}
|
|
||||||
(also known as @emph{SICP}), and implemented in some form in all Scheme
|
|
||||||
interpreters.
|
|
||||||
@cindex Structure and Interpretation of Computer Programs
|
|
||||||
@cindex SICP
|
|
||||||
|
|
||||||
[FIXME: Someone needs to tell me what needs to be said about Guile's
|
|
||||||
REPL.]
|
|
||||||
|
|
||||||
@node Extra data types
|
|
||||||
@section Extra data types
|
|
||||||
|
|
||||||
The fundamental Scheme data types specified in R4RS are @emph{numbers}
|
|
||||||
(both exact and inexact), @emph{characters}, @emph{strings},
|
|
||||||
@emph{symbols}, @emph{vectors}, @emph{pairs} and @emph{lists} [FIXME: is
|
|
||||||
this complete?].
|
|
||||||
|
|
||||||
Many Scheme interpreters offer more types, and Guile is no exception.
|
|
||||||
Guile is based on Aubrey Jaffer's SCM interpreter, and thus inherits
|
|
||||||
@emph{uniform arrays}, [FIXME: any others? How about records?].
|
|
||||||
|
|
||||||
On top of that, Guile allows you to add extra types, but that is covered
|
|
||||||
in @ref{Adding types to Guile}. Here I will simply document all the
|
|
||||||
extra Scheme types shipped with Guile.
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* Conventional arrays::
|
|
||||||
* Uniform arrays::
|
|
||||||
* Bit vectors::
|
|
||||||
* Complex numbers::
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Conventional arrays
|
|
||||||
@subsection Conventional arrays
|
|
||||||
|
|
||||||
@node Uniform arrays
|
|
||||||
@subsection Uniform arrays
|
|
||||||
@cindex arrays - uniform
|
|
||||||
|
|
||||||
The motivation for uniform arrays in Scheme is performance. A vector
|
|
||||||
provides a performance increase over lists when you want a fixed-size
|
|
||||||
indexable list. But the elements in a vector can be of different types,
|
|
||||||
and this makes for larger storage requirements and slightly lower
|
|
||||||
performance.
|
|
||||||
|
|
||||||
A uniform array is similar to a vector, but all elements have to be of
|
|
||||||
the same type.
|
|
||||||
|
|
||||||
arrays, uniform arrays, bit vectors:
|
|
||||||
|
|
||||||
@deffn procedure array-fill ra fill
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure serial-array-copy! src dst
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure serial-array-map ra0 proc [lra]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-map ra0 proc [lra]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-for-each proc ra0 [lra]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-index-map! ra proc
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-copy! src dst
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-copy! src dst
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-copy! src dst
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-copy! src dst
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-copy! src dst
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array? ra [prot]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-rank ra
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-dimensions ra
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure dimensions->uniform-array dims prot fill ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure make-shared-array ra mapfunc dims ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure transpose-array arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure enclose-array axes ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-in-bounds? arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-ref ra arg ..
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure uniform-vector-ref vec pos
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-set! ra obj arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure uniform-array-set1! ua obj arg
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-contents ra [strict]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure uniform-array-read! ra [port-or-fd] [start] [end]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure uniform-array-write! ra [port-or-fd] [start] [end]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure bit-count item seq
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure bit-position item v k
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure bit-set! v kv obj
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure bit-count* v kv obj
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure bit-invert v
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array->list ra
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure list->uniform-array ndim prot list
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure array-prototype ra
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
Uniform arrays can be written and read, but @code{read} won't recognize
|
|
||||||
them unless the optional @code{read-sharp} parameter is supplied,
|
|
||||||
e.g,
|
|
||||||
@smalllisp
|
|
||||||
(read port #t read-sharp)
|
|
||||||
@end smalllisp
|
|
||||||
|
|
||||||
where @code{read-sharp} is the default procedure for parsing extended
|
|
||||||
sharp notations.
|
|
||||||
|
|
||||||
Reading an array is not very efficient at present, since it's implemented
|
|
||||||
by reading a list and converting the list to an array.
|
|
||||||
|
|
||||||
@c FIXME: must use @deftp, but its generation of TeX code is buggy.
|
|
||||||
@c Must fix it when TeXinfo gets fixed.
|
|
||||||
@deftp {Scheme type} {uniform array}
|
|
||||||
|
|
||||||
@end deftp
|
|
||||||
|
|
||||||
@node Bit vectors
|
|
||||||
@subsection Bit vectors
|
|
||||||
|
|
||||||
@node Complex numbers
|
|
||||||
@subsection Complex numbers
|
|
||||||
|
|
||||||
@c FIXME: must use @deftp, but its generation of TeX code is buggy.
|
|
||||||
@c Must fix it when TeXinfo gets fixed.
|
|
||||||
@deftp {Scheme type} complex
|
|
||||||
Standard complex numbers.
|
|
||||||
@end deftp
|
|
||||||
|
|
||||||
@node Miscellaneous features
|
|
||||||
@section Miscellaneous features
|
|
||||||
|
|
||||||
@defun defined? symbol
|
|
||||||
Returns @code{#t} if a symbol is bound to a value, @code{#f} otherwise.
|
|
||||||
This kind of procedure is not specified in R4RS because @c FIXME: finish
|
|
||||||
this thought
|
|
||||||
@end defun
|
|
||||||
|
|
||||||
@defun object-properties OBJ
|
|
||||||
and so forth
|
|
||||||
@end defun
|
|
|
@ -1,4 +0,0 @@
|
||||||
@node Libguile -- SCM interface
|
|
||||||
@chapter Libguile -- SCM interface
|
|
||||||
|
|
||||||
|
|
|
@ -1,45 +0,0 @@
|
||||||
@node Strings
|
|
||||||
@chapter Facilities for string manipulation
|
|
||||||
|
|
||||||
@deffn procedure string? string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure read-only-string? string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure list->string list
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure make-string length [char]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-length string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-ref string [index]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-set! string index char
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure substring string start [end]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-append arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure make-shared-substring string [from] [to]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-set! string index char
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-index string char [from] [to]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-rindex string char [from] [to]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure substring-move-left! string1 start1 [end1] [string2] [start2]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure substring-move-right! string1 start1 [end1] [string2] [start2]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure substring-fill! string start [end] [fill]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-null? string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string->list string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-copy string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-upcase! string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure string-downcase! string
|
|
||||||
@end deffn
|
|
|
@ -1,5 +0,0 @@
|
||||||
@node Tk interface
|
|
||||||
@chapter Tk interface
|
|
||||||
|
|
||||||
For now Guile has no well-specified Tk interface. It is an important part
|
|
||||||
of Guile, though, and will be documented here when it is written.
|
|
|
@ -1,132 +0,0 @@
|
||||||
@node Other Unix
|
|
||||||
@chapter Other Unix-specific facilities
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* Expect:: Expect, for pattern matching from a port.
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Expect
|
|
||||||
@section Expect: Pattern Matching from a Port
|
|
||||||
|
|
||||||
@code{expect} is a macro for selecting actions based on the output from
|
|
||||||
a port. The name comes from a tool of similar functionality by Don Libes.
|
|
||||||
Actions can be taken when a particular string is matched, when a timeout
|
|
||||||
occurs, or when end-of-file is seen on the port. The @code{expect} macro
|
|
||||||
is described below; @code{expect-strings} is a front-end to @code{expect}
|
|
||||||
based on regexec @xref{Regular expressions}.
|
|
||||||
|
|
||||||
Using these macros requires for now:
|
|
||||||
@smalllisp
|
|
||||||
(load-from-path "ice-9/expect")
|
|
||||||
@end smalllisp
|
|
||||||
|
|
||||||
@defun expect-strings clause @dots{}
|
|
||||||
By default, @code{expect-strings} will read from the current input port.
|
|
||||||
The first term in each clause consists of an expression evaluating to
|
|
||||||
a string pattern (regular expression). As characters
|
|
||||||
are read one-by-one from the port, they are accumulated in a buffer string
|
|
||||||
which is matched against each of the patterns. When a
|
|
||||||
pattern matches, the remaining expression(s) in
|
|
||||||
the clause are evaluated and the value of the last is returned. For example:
|
|
||||||
|
|
||||||
@smalllisp
|
|
||||||
(with-input-from-file "/etc/passwd"
|
|
||||||
(lambda ()
|
|
||||||
(expect-strings
|
|
||||||
("^nobody" (display "Got a nobody user.\n")
|
|
||||||
(display "That's no problem.\n"))
|
|
||||||
("^daemon" (display "Got a daemon user.\n")))))
|
|
||||||
@end smalllisp
|
|
||||||
|
|
||||||
The regular expression is compiled with the @code{REG_NEWLINE} flag, so
|
|
||||||
that the @code{^} and @code{$} anchors will match at any newline, not
|
|
||||||
just at the start
|
|
||||||
and end of the string.
|
|
||||||
|
|
||||||
There are two other ways to write a clause:
|
|
||||||
|
|
||||||
The expression(s) to evaluate on a match
|
|
||||||
can be omitted, in which case the result of the match
|
|
||||||
(converted to strings, as obtained from regexec with @var{match-pick}
|
|
||||||
set to @code{""}) will be returned if the pattern matches.
|
|
||||||
|
|
||||||
The symbol @code{=>} can be used to indicate that there is a single
|
|
||||||
expression to evaluate on a match, which must be a
|
|
||||||
procedure which will accept the result of a successful match (converted
|
|
||||||
to strings, as obtained from regexec with @var{match-pick} set to
|
|
||||||
@code{""}). E.g.,
|
|
||||||
|
|
||||||
@smalllisp
|
|
||||||
("^daemon" => write)
|
|
||||||
("^d\\(aemon\\)" => (lambda args (map write args)))
|
|
||||||
("^da\\(em\\)on" => (lambda (all sub)
|
|
||||||
(write all)
|
|
||||||
(write sub)))
|
|
||||||
@end smalllisp
|
|
||||||
|
|
||||||
The order of the substrings corresponds to the order in which the
|
|
||||||
opening brackets occur in the regular expression.
|
|
||||||
|
|
||||||
A number of variables can be used to control the behaviour
|
|
||||||
of @code{expect} (and @code{expect-strings}).
|
|
||||||
By default they are all bound at the top level to
|
|
||||||
the value @code{#f}, which produces the default behaviour.
|
|
||||||
They can be redefined at the
|
|
||||||
top level or locally bound in a form enclosing the @code{expect} expression.
|
|
||||||
|
|
||||||
@table @code
|
|
||||||
@item expect-port
|
|
||||||
A port to read characters from, instead of the current input port.
|
|
||||||
@item expect-timeout
|
|
||||||
@code{expect} will terminate after this number of
|
|
||||||
seconds, returning @code{#f} or the value returned by
|
|
||||||
@code{expect-timeout-proc}.
|
|
||||||
@item expect-timeout-proc
|
|
||||||
A procedure called if timeout occurs. The procedure takes a single argument:
|
|
||||||
the accumulated string.
|
|
||||||
@item expect-eof-proc
|
|
||||||
A procedure called if end-of-file is detected on the input port. The
|
|
||||||
procedure takes a single argument: the accumulated string.
|
|
||||||
@item expect-char-proc
|
|
||||||
A procedure to be called every time a character is read from the
|
|
||||||
port. The procedure takes a single argument: the character which was read.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
Here's an example using all of the variables:
|
|
||||||
|
|
||||||
@smalllisp
|
|
||||||
(let ((expect-port (open-input-file "/etc/passwd"))
|
|
||||||
(expect-timeout 1)
|
|
||||||
(expect-timeout-proc
|
|
||||||
(lambda (s) (display "Times up!\n")))
|
|
||||||
(expect-eof-proc
|
|
||||||
(lambda (s) (display "Reached the end of the file!\n")))
|
|
||||||
(expect-char-proc display))
|
|
||||||
(expect-strings
|
|
||||||
("^nobody" (display "Got a nobody user\n"))))
|
|
||||||
@end smalllisp
|
|
||||||
@end defun
|
|
||||||
|
|
||||||
@defun expect clause @dots{}
|
|
||||||
@code{expect} is used in the same way as @code{expect-strings},
|
|
||||||
but tests are specified not as patterns, but as procedures. The
|
|
||||||
procedures are called in turn after each character is read from the
|
|
||||||
port, with the value of the accumulated string as the argument. The
|
|
||||||
test is successful if the procedure returns a non-false value.
|
|
||||||
|
|
||||||
If the @code{=>} syntax is used, then if the test succeeds it must return
|
|
||||||
a list containing the arguments to be provided to the corresponding
|
|
||||||
expression.
|
|
||||||
|
|
||||||
In the following example, a string will only be matched at the beginning
|
|
||||||
of the file:
|
|
||||||
@smalllisp
|
|
||||||
(let ((expect-port (open-input-file "/etc/passwd")))
|
|
||||||
(expect
|
|
||||||
((lambda (s) (string=? s "fnord!"))
|
|
||||||
(display "Got a nobody user!\n"))))
|
|
||||||
@end smalllisp
|
|
||||||
|
|
||||||
The control variables described for @code{expect-strings} can also
|
|
||||||
be used with @code{expect}.
|
|
||||||
@end defun
|
|
|
@ -1,622 +0,0 @@
|
||||||
@node Low level Unix
|
|
||||||
@chapter Low level Unix interfaces
|
|
||||||
|
|
||||||
The low level Unix interfaces are currently available by
|
|
||||||
default in the Guile top level. However in the future they will probably
|
|
||||||
be placed in a module and @code{use-modules} or something similar will
|
|
||||||
be required to make them available.
|
|
||||||
|
|
||||||
@menu
|
|
||||||
* Unix conventions:: Conventions followed by the low level Unix
|
|
||||||
interfaces.
|
|
||||||
* Ports and descriptors:: Ports, file descriptors and how they
|
|
||||||
interact.
|
|
||||||
* Extended I/O:: Reading and writing to ports.
|
|
||||||
* File system:: Working in a hierarchical file system.
|
|
||||||
* User database:: Information about users from system databases.
|
|
||||||
* Processes:: Information and control of Unix processes.
|
|
||||||
* Terminals:: Terminals and pseudo-terminals.
|
|
||||||
* Network databases:: Network address conversion and information
|
|
||||||
from system databases.
|
|
||||||
* Network sockets:: An interface to the BSD socket library.
|
|
||||||
* Miscellaneous Unix:: Miscellaneous Unix interfaces.
|
|
||||||
@end menu
|
|
||||||
|
|
||||||
@node Unix conventions
|
|
||||||
@section Low level Unix conventions
|
|
||||||
|
|
||||||
The low-level interfaces are designed to give Scheme programs
|
|
||||||
access to as much functionality as possible from the underlying
|
|
||||||
Unix system. They can be used to implement higher level
|
|
||||||
interfaces such as the Scheme shell @ref{scsh}.
|
|
||||||
|
|
||||||
Generally there is a single procedure for each corresponding Unix
|
|
||||||
facility. However some of the procedures are implemented for
|
|
||||||
speed and convenience in Scheme and have no Unix equivalent
|
|
||||||
(e.g., @code{read-delimited}, @code{copy-file}.)
|
|
||||||
|
|
||||||
This interface is intended as far as possible to be portable across
|
|
||||||
different versions of Unix, so that Scheme programmers don't need to be
|
|
||||||
concerned with implementation differences. In some cases procedures
|
|
||||||
which can't be implemented (or reimplemented) on particular systems may
|
|
||||||
become no-ops, or perform limited actions. In other cases they may
|
|
||||||
throw errors. It should be possible to use the feature system to
|
|
||||||
determine what functionality is available.
|
|
||||||
|
|
||||||
General naming conventions are as follows:
|
|
||||||
|
|
||||||
@itemize @bullet
|
|
||||||
@item
|
|
||||||
The Scheme name is often identical to the name of the underlying Unix
|
|
||||||
facility.
|
|
||||||
@item
|
|
||||||
Underscores in Unix names are converted to hyphens.
|
|
||||||
@item
|
|
||||||
Procedures which destructively modify Scheme data gain appended
|
|
||||||
exclamation marks, e.g., @code{recv!}.
|
|
||||||
@item
|
|
||||||
Predicates have question marks appended, e.g., @code{access?}.
|
|
||||||
@item
|
|
||||||
Some names are changed to avoid conflict with dissimilar interfaces
|
|
||||||
defined by scsh.
|
|
||||||
@item
|
|
||||||
Unix preprocessor names such as @code{EPERM} or @code{R_OK} are converted
|
|
||||||
to Scheme variables of the same name (underscores are not replaced
|
|
||||||
with hyphens)
|
|
||||||
@end itemize
|
|
||||||
|
|
||||||
Most of the Unix interface procedures can be relied on to return a
|
|
||||||
well-specified value. Unexpected conditions are handled by raising
|
|
||||||
exceptions.
|
|
||||||
|
|
||||||
There are a few procedures which return a special
|
|
||||||
value if they don't succeed, e.g., @code{getenv} returns @code{#f}
|
|
||||||
if it the requested string is not found in the environment. These
|
|
||||||
cases will be noted in the documentation.
|
|
||||||
|
|
||||||
For ways to deal with exceptions, @ref{Exceptions}.
|
|
||||||
|
|
||||||
Errors which the C-library would report by returning a NULL
|
|
||||||
pointer or through some other means cause a @code{system-error} exception
|
|
||||||
to be raised. The value of the Unix @code{errno} variable is available
|
|
||||||
in the data passed by the exception, so there is no need to access the
|
|
||||||
global errno value (doing so would be unreliable in the presence of
|
|
||||||
continuations or multiple threads).
|
|
||||||
|
|
||||||
@deffn procedure errno [n]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure perror string
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Ports and descriptors
|
|
||||||
@section Ports and file descriptors
|
|
||||||
|
|
||||||
@deffn procedure move->fdes port fd
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure release-port-handle port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure set-port-revealed! @var{port} count
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure fdes->ports fdes
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure fileno port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure fdopen fdes modes
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure duplicate-port port modes
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure redirect-port into-port from-port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure freopen filename modes port
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Extended I/O
|
|
||||||
@section Extended I/O
|
|
||||||
|
|
||||||
Extended I/O procedures are available which read or write lines of text,
|
|
||||||
read text delimited by a specified set of characters, or report or
|
|
||||||
set the current position of a port.
|
|
||||||
|
|
||||||
@findex fwrite
|
|
||||||
@findex fread
|
|
||||||
Interfaces to @code{read}/@code{fread} and @code{write}/@code{fwrite} are
|
|
||||||
also available, as @code{uniform-array-read!} and @code{uniform-array-write!},
|
|
||||||
@ref{Uniform arrays}.
|
|
||||||
|
|
||||||
@deffn procedure read-line [port] [handle-delim]
|
|
||||||
Return a line of text from @var{port} if specified, otherwise from the
|
|
||||||
value returned by @code{(current-input-port)}. Under Unix, a line of text
|
|
||||||
is terminated by the first end-of-line character or by end-of-file.
|
|
||||||
|
|
||||||
If @var{handle-delim} is specified, it should be one of the following
|
|
||||||
symbols:
|
|
||||||
@table @code
|
|
||||||
@item trim
|
|
||||||
Discard the terminating delimiter. This is the default, but it will
|
|
||||||
be impossible to tell whether the read terminated with a delimiter or
|
|
||||||
end-of-file.
|
|
||||||
@item concat
|
|
||||||
Append the terminating delimiter (if any) to the returned string.
|
|
||||||
@item peek
|
|
||||||
Push the terminating delimiter (if any) back on to the port.
|
|
||||||
@item split
|
|
||||||
Return a pair containing the string read from the port and the
|
|
||||||
terminating delimiter or end-of-file object.
|
|
||||||
|
|
||||||
NOTE: if the scsh module is loaded then
|
|
||||||
multiple values are returned instead of a pair.
|
|
||||||
@end table
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure read-line! buf [port]
|
|
||||||
Read a line of text into the supplied string @var{buf} and return the
|
|
||||||
number of characters added to @var{buf}. If @var{buf} is filled, then
|
|
||||||
@code{#f} is returned.
|
|
||||||
Read from @var{port} if
|
|
||||||
specified, otherwise from the value returned by @code{(current-input-port)}.
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure read-delimited delims [port] [handle-delim]
|
|
||||||
Read text until one of the characters in the string @var{delims} is found
|
|
||||||
or end-of-file is reached. Read from @var{port} if supplied, otherwise
|
|
||||||
from the value returned by @code{(current-input-port)}.
|
|
||||||
@var{handle-delim} takes the same values as described for @code{read-line}.
|
|
||||||
|
|
||||||
NOTE: if the scsh module is loaded then @var{delims} must be an scsh
|
|
||||||
char-set, not a string.
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure read-delimited! delims buf [port] [handle-delim] [start] [end]
|
|
||||||
Read text into the supplied string @var{buf} and return the number of
|
|
||||||
characters added to @var{buf} (subject to @var{handle-delim}, which takes
|
|
||||||
the same values specified for @code{read-line}. If @var{buf} is filled,
|
|
||||||
@code{#f} is returned for both the number of characters read and the
|
|
||||||
delimiter. Also terminates if one of the characters in the string
|
|
||||||
@var{delims} is found
|
|
||||||
or end-of-file is reached. Read from @var{port} if supplied, otherwise
|
|
||||||
from the value returned by @code{(current-input-port)}.
|
|
||||||
|
|
||||||
NOTE: if the scsh module is loaded then @var{delims} must be an scsh
|
|
||||||
char-set, not a string.
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure write-line obj [port]
|
|
||||||
Display @var{obj} and a new-line character to @var{port} if specified,
|
|
||||||
otherwise to the
|
|
||||||
value returned by @code{(current-output-port)}; equivalent to:
|
|
||||||
|
|
||||||
@smalllisp
|
|
||||||
(display obj [port])
|
|
||||||
(newline [port])
|
|
||||||
@end smalllisp
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure ftell port
|
|
||||||
Returns an integer representing the current position of @var{port},
|
|
||||||
measured from the beginning.
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure fseek port offset whence
|
|
||||||
Sets the current position of @var{port} to the integer @var{offset},
|
|
||||||
which is interpreted according to the value of @var{whence}.
|
|
||||||
|
|
||||||
One of the following variables should be supplied
|
|
||||||
for @var{whence}:
|
|
||||||
@defvar SEEK_SET
|
|
||||||
Seek from the beginning of the file.
|
|
||||||
@end defvar
|
|
||||||
@defvar SEEK_CUR
|
|
||||||
Seek from the current position.
|
|
||||||
@end defvar
|
|
||||||
@defvar SEEK_END
|
|
||||||
Seek from the end of the file.
|
|
||||||
@end defvar
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node File system
|
|
||||||
@section File system
|
|
||||||
|
|
||||||
These procedures query and set file system attributes (such as owner,
|
|
||||||
permissions, sizes and types of files); deleting, copying, renaming and
|
|
||||||
linking files; creating and removing directories and querying their
|
|
||||||
contents; and the @code{sync} interface.
|
|
||||||
|
|
||||||
@deffn procedure access? path how
|
|
||||||
Evaluates to @code{#t} if @var{path} corresponds to an existing
|
|
||||||
file and the current process
|
|
||||||
has the type of access specified by @var{how}, otherwise
|
|
||||||
@code{#f}.
|
|
||||||
@var{how} should be specified
|
|
||||||
using the values of the variables listed below. Multiple values can
|
|
||||||
be combined using a bitwise or, in which case @code{#t} will only
|
|
||||||
be returned if all accesses are granted.
|
|
||||||
|
|
||||||
Permissions are checked using the real id of the current process,
|
|
||||||
not the effective id, although it's the effective id which determines
|
|
||||||
whether the access would actually be granted.
|
|
||||||
|
|
||||||
@defvar R_OK
|
|
||||||
test for read permission.
|
|
||||||
@end defvar
|
|
||||||
@defvar W_OK
|
|
||||||
test for write permission.
|
|
||||||
@end defvar
|
|
||||||
@defvar X_OK
|
|
||||||
test for execute permission.
|
|
||||||
@end defvar
|
|
||||||
@defvar F_OK
|
|
||||||
test for existence of the file.
|
|
||||||
@end defvar
|
|
||||||
@end deffn
|
|
||||||
@findex fstat
|
|
||||||
@deffn procedure stat obj
|
|
||||||
Evaluates to an object containing various information
|
|
||||||
about the file determined by @var{obj}.
|
|
||||||
@var{obj} can be a string containing a file name or a port or file
|
|
||||||
descriptor which is open on a file (in which case @code{fstat} is used
|
|
||||||
as the underlying system call).
|
|
||||||
|
|
||||||
The object returned by @code{stat} can be passed as a single parameter
|
|
||||||
to the following procedures, all of which return integers:
|
|
||||||
|
|
||||||
@table @r
|
|
||||||
@item stat:dev
|
|
||||||
The device containing the file.
|
|
||||||
@item stat:ino
|
|
||||||
The file serial number, which distinguishes this file from all other
|
|
||||||
files on the same device.
|
|
||||||
@item stat:mode
|
|
||||||
The mode of the file. This includes file type information
|
|
||||||
and the file permission bits. See @code{stat:type} and @code{stat:perms}
|
|
||||||
below.
|
|
||||||
@item stat:nlink
|
|
||||||
The number of hard links to the file.
|
|
||||||
@item stat:uid
|
|
||||||
The user ID of the file's owner.
|
|
||||||
@item stat:gid
|
|
||||||
The group ID of the file.
|
|
||||||
@item stat:rdev
|
|
||||||
Device ID; this entry is defined only for character or block
|
|
||||||
special files.
|
|
||||||
@item stat:size
|
|
||||||
The size of a regular file in bytes.
|
|
||||||
@item stat:atime
|
|
||||||
The last access time for the file.
|
|
||||||
@item stat:mtime
|
|
||||||
The last modification time for the file.
|
|
||||||
@item stat:ctime
|
|
||||||
The last modification time for the attributes of the file.
|
|
||||||
@item stat:blksize
|
|
||||||
The optimal block size for reading or writing the file, in bytes.
|
|
||||||
@item stat:blocks
|
|
||||||
The amount of disk space that the file occupies measured in units of
|
|
||||||
512 byte blocks.
|
|
||||||
@end table
|
|
||||||
|
|
||||||
In addition, the following procedures return the information
|
|
||||||
from stat:mode in a more convenient form:
|
|
||||||
|
|
||||||
@table @r
|
|
||||||
@item stat:type
|
|
||||||
A symbol representing the type of file. Possible values are
|
|
||||||
currently: regular, directory, symlink, block-special, char-special,
|
|
||||||
fifo, socket, unknown
|
|
||||||
@item stat:perms
|
|
||||||
An integer representing the access permission bits.
|
|
||||||
@end table
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure lstat path
|
|
||||||
Similar to @code{stat}, but does not follow symbolic links, i.e.,
|
|
||||||
it will return information about a symbolic link itself, not the
|
|
||||||
file it points to. @var{path} must be a string.
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure readlink path
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure chown path owner group
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure chmod port-or-path mode
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure utime path [actime] [modtime]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure delete-file path
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure copy-file path-from path-to
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure rename-file path-from path-to
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure link path-from path-to
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure symlink path-from path-to
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure mkdir path [mode]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure rmdir path
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure opendir path
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure readdir port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure rewinddir port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure closedir port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure sync
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node User database
|
|
||||||
@section User database
|
|
||||||
|
|
||||||
@deffn procedure getpwuid uid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getpwnam name
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getpwent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setpwent port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure endpwent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getgrgid uid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getgrnam name
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getgrent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setgrent port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure endgrent
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Processes
|
|
||||||
@section Processes
|
|
||||||
|
|
||||||
@deffn procedure chdir path
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getcwd
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure umask [mode]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getpid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getgroups
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure kill pid sig
|
|
||||||
|
|
||||||
@var{sig} should be specified using a variable corresponding to
|
|
||||||
the Unix symbolic name, e.g,
|
|
||||||
@defvar SIGHUP
|
|
||||||
Hang-up signal.
|
|
||||||
@end defvar
|
|
||||||
@defvar SIGINT
|
|
||||||
Interrupt signal.
|
|
||||||
@end defvar
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure waitpid pid options
|
|
||||||
@defvar WAIT_ANY
|
|
||||||
@end defvar
|
|
||||||
@defvar WAIT_MYPGRP
|
|
||||||
@end defvar
|
|
||||||
@defvar WNOHANG
|
|
||||||
@end defvar
|
|
||||||
@defvar WUNTRACED
|
|
||||||
@end defvar
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getppid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getuid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getgid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure geteuid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getegid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setuid id
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setgid id
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure seteuid id
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setegid id
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getpgrp
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setpgid pid pgid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setsid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure execl arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure execlp arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure primitive-fork
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure environ [env]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure putenv string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure nice incr
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Terminals
|
|
||||||
@section Terminals and pseudo-terminals
|
|
||||||
|
|
||||||
@deffn procedure isatty? port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure ttyname port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure ctermid
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure tcgetpgrp port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure tcsetpgrp port pgid
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Network databases
|
|
||||||
@section Network address conversion and system databases
|
|
||||||
|
|
||||||
@deffn procedure inet-aton address
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure inet-ntoa number
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure inet-netof address
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure inet-lnaof address
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure inet-makeaddr net lna
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure gethostbyname name
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure gethostbyaddr address
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure gethostent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure sethostent port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure endhostent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getnetbyname name
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getnetbyaddr address
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getnetent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setnetent port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure endnetent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getprotobyname name
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getprotobynumber number
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getprotoent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setprotoent port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure endprotoent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getservbyname name protocol
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getservbyport port protocol
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getservent
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setservent port
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure endservent
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Network sockets
|
|
||||||
@section BSD socket library interface
|
|
||||||
|
|
||||||
@deffn procedure socket family style protocol
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure socketpair family style protocol
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getsockopt socket level optname
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setsockopt socket level optname value
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure shutdown socket how
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure connect socket family address arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure bind socket family address arg ...
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure listen socket backlog
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure accept socket
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getsockname socket
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure getpeername socket
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure recv! socket buf [flags]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure send socket message [flags]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure recvfrom! socket buf [flags] [start] [end]
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure sendto socket message family address args ... [flags]
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node Miscellaneous Unix
|
|
||||||
@section Miscellaneous Unix interfaces
|
|
||||||
|
|
||||||
Things which haven't been classified elsewhere (yet?).
|
|
||||||
|
|
||||||
@deffn procedure open path flags [mode]
|
|
||||||
@defvar O_RDONLY
|
|
||||||
@end defvar
|
|
||||||
@defvar O_WRONLY
|
|
||||||
@end defvar
|
|
||||||
@defvar O_RDWR
|
|
||||||
@end defvar
|
|
||||||
@defvar O_CREAT
|
|
||||||
@end defvar
|
|
||||||
@defvar O_EXCL
|
|
||||||
@end defvar
|
|
||||||
@defvar O_NOCTTY
|
|
||||||
@end defvar
|
|
||||||
@defvar O_TRUNC
|
|
||||||
@end defvar
|
|
||||||
@defvar O_APPEND
|
|
||||||
@end defvar
|
|
||||||
@defvar O_NONBLOCK
|
|
||||||
@end defvar
|
|
||||||
@defvar O_NDELAY
|
|
||||||
@end defvar
|
|
||||||
@defvar O_SYNC
|
|
||||||
@end defvar
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure select reads writes excepts secs msecs
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure uname
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure pipe
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure open-pipe command modes
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure open-input-pipe command
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure open-output-pipe command
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure setlocale category [locale]
|
|
||||||
@defvar LC_COLLATE
|
|
||||||
@end defvar
|
|
||||||
@defvar LC_CTYPE
|
|
||||||
@end defvar
|
|
||||||
@defvar LC_MONETARY
|
|
||||||
@end defvar
|
|
||||||
@defvar LC_NUMERIC
|
|
||||||
@end defvar
|
|
||||||
@defvar LC_TIME
|
|
||||||
@end defvar
|
|
||||||
@defvar LC_MESSAGES
|
|
||||||
@end defvar
|
|
||||||
@defvar LC_ALL
|
|
||||||
@end defvar
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure strftime format stime
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure strptime format string
|
|
||||||
@end deffn
|
|
||||||
@deffn procedure mknod
|
|
||||||
@end deffn
|
|
||||||
|
|
||||||
@node scsh
|
|
||||||
@chapter The Scheme shell (scsh)
|
|
||||||
|
|
||||||
Guile includes an incomplete port of the Scheme shell (scsh) 0.4.4.
|
|
||||||
|
|
||||||
For information about scsh on the Web see
|
|
||||||
@url{http://www-swiss.ai.mit.edu/scsh/scsh.html}.
|
|
||||||
The original scsh is available by ftp from
|
|
||||||
@url{ftp://swiss-ftp.ai.mit.edu:/pub/su}.
|
|
||||||
|
|
||||||
This port of scsh does not currently use the Guile module system, but
|
|
||||||
can be initialized using:
|
|
||||||
@smalllisp
|
|
||||||
(load-from-path "scsh/init")
|
|
||||||
@end smalllisp
|
|
||||||
|
|
||||||
Note that SLIB must be installed before scsh can be initialized, see
|
|
||||||
@ref{SLIB} for details.
|
|
||||||
|
|
||||||
@node Threads
|
|
||||||
@chapter Programming Threads.
|
|
||||||
|
|
184
lib/Makefile.am
184
lib/Makefile.am
|
@ -21,7 +21,7 @@
|
||||||
# the same distribution terms as the rest of that program.
|
# the same distribution terms as the rest of that program.
|
||||||
#
|
#
|
||||||
# Generated by gnulib-tool.
|
# Generated by gnulib-tool.
|
||||||
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nproc open pipe2 putenv recv recvfrom rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
# Reproduce by: gnulib-tool --import --dir=. --local-dir=gnulib-local --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --lgpl=3 --no-conditional-dependencies --libtool --macro-prefix=gl --no-vc-files accept alignof alloca-opt announce-gen autobuild bind byteswap canonicalize-lgpl ceil close connect dirfd duplocale environ extensions flock floor fpieee frexp full-read full-write func gendocs getaddrinfo getpeername getsockname getsockopt git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload havelib iconv_open-utf inet_ntop inet_pton isinf isnan ldexp lib-symbol-versions lib-symbol-visibility libunistring listen localcharset locale log1p maintainer-makefile malloc-gnu malloca nl_langinfo nproc open pipe2 putenv recv recvfrom regex rename send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat trunc verify vsnprintf warnings wchar
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
|
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
|
||||||
|
|
||||||
|
@ -165,6 +165,15 @@ EXTRA_libgnu_la_SOURCES += bind.c
|
||||||
|
|
||||||
## end gnulib module bind
|
## end gnulib module bind
|
||||||
|
|
||||||
|
## begin gnulib module btowc
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += btowc.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += btowc.c
|
||||||
|
|
||||||
|
## end gnulib module btowc
|
||||||
|
|
||||||
## begin gnulib module byteswap
|
## begin gnulib module byteswap
|
||||||
|
|
||||||
BUILT_SOURCES += $(BYTESWAP_H)
|
BUILT_SOURCES += $(BYTESWAP_H)
|
||||||
|
@ -755,6 +764,39 @@ EXTRA_libgnu_la_SOURCES += isnan.c isnanl.c
|
||||||
|
|
||||||
## end gnulib module isnanl
|
## end gnulib module isnanl
|
||||||
|
|
||||||
|
## begin gnulib module langinfo
|
||||||
|
|
||||||
|
BUILT_SOURCES += langinfo.h
|
||||||
|
|
||||||
|
# We need the following in order to create an empty placeholder for
|
||||||
|
# <langinfo.h> when the system doesn't have one.
|
||||||
|
langinfo.h: langinfo.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
|
||||||
|
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||||
|
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||||
|
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||||
|
-e 's|@''HAVE_LANGINFO_H''@|$(HAVE_LANGINFO_H)|g' \
|
||||||
|
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||||
|
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||||
|
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||||
|
-e 's|@''NEXT_LANGINFO_H''@|$(NEXT_LANGINFO_H)|g' \
|
||||||
|
-e 's/@''GNULIB_NL_LANGINFO''@/$(GNULIB_NL_LANGINFO)/g' \
|
||||||
|
-e 's|@''HAVE_LANGINFO_CODESET''@|$(HAVE_LANGINFO_CODESET)|g' \
|
||||||
|
-e 's|@''HAVE_LANGINFO_T_FMT_AMPM''@|$(HAVE_LANGINFO_T_FMT_AMPM)|g' \
|
||||||
|
-e 's|@''HAVE_LANGINFO_ERA''@|$(HAVE_LANGINFO_ERA)|g' \
|
||||||
|
-e 's|@''HAVE_LANGINFO_YESEXPR''@|$(HAVE_LANGINFO_YESEXPR)|g' \
|
||||||
|
-e 's|@''HAVE_NL_LANGINFO''@|$(HAVE_NL_LANGINFO)|g' \
|
||||||
|
-e 's|@''REPLACE_NL_LANGINFO''@|$(REPLACE_NL_LANGINFO)|g' \
|
||||||
|
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||||
|
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||||
|
< $(srcdir)/langinfo.in.h; \
|
||||||
|
} > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
MOSTLYCLEANFILES += langinfo.h langinfo.h-t
|
||||||
|
|
||||||
|
EXTRA_DIST += langinfo.in.h
|
||||||
|
|
||||||
|
## end gnulib module langinfo
|
||||||
|
|
||||||
## begin gnulib module lib-symbol-visibility
|
## begin gnulib module lib-symbol-visibility
|
||||||
|
|
||||||
# The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
|
# The value of $(CFLAG_VISIBILITY) needs to be added to the CFLAGS for the
|
||||||
|
@ -1106,6 +1148,33 @@ EXTRA_DIST += math.in.h
|
||||||
|
|
||||||
## end gnulib module math
|
## end gnulib module math
|
||||||
|
|
||||||
|
## begin gnulib module mbrtowc
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += mbrtowc.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += mbrtowc.c
|
||||||
|
|
||||||
|
## end gnulib module mbrtowc
|
||||||
|
|
||||||
|
## begin gnulib module mbsinit
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += mbsinit.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += mbsinit.c
|
||||||
|
|
||||||
|
## end gnulib module mbsinit
|
||||||
|
|
||||||
|
## begin gnulib module mbtowc
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += mbtowc-impl.h mbtowc.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += mbtowc.c
|
||||||
|
|
||||||
|
## end gnulib module mbtowc
|
||||||
|
|
||||||
## begin gnulib module memchr
|
## begin gnulib module memchr
|
||||||
|
|
||||||
|
|
||||||
|
@ -1198,6 +1267,15 @@ EXTRA_DIST += netinet_in.in.h
|
||||||
|
|
||||||
## end gnulib module netinet_in
|
## end gnulib module netinet_in
|
||||||
|
|
||||||
|
## begin gnulib module nl_langinfo
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += nl_langinfo.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += nl_langinfo.c
|
||||||
|
|
||||||
|
## end gnulib module nl_langinfo
|
||||||
|
|
||||||
## begin gnulib module nproc
|
## begin gnulib module nproc
|
||||||
|
|
||||||
libgnu_la_SOURCES += nproc.c
|
libgnu_la_SOURCES += nproc.c
|
||||||
|
@ -1282,6 +1360,15 @@ EXTRA_libgnu_la_SOURCES += recvfrom.c
|
||||||
|
|
||||||
## end gnulib module recvfrom
|
## end gnulib module recvfrom
|
||||||
|
|
||||||
|
## begin gnulib module regex
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += regcomp.c regex.c regex.h regex_internal.c regex_internal.h regexec.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += regcomp.c regex.c regex_internal.c regexec.c
|
||||||
|
|
||||||
|
## end gnulib module regex
|
||||||
|
|
||||||
## begin gnulib module rename
|
## begin gnulib module rename
|
||||||
|
|
||||||
|
|
||||||
|
@ -1921,6 +2008,22 @@ EXTRA_DIST += stdlib.in.h
|
||||||
|
|
||||||
## end gnulib module stdlib
|
## end gnulib module stdlib
|
||||||
|
|
||||||
|
## begin gnulib module strcase
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += strcasecmp.c strncasecmp.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += strcasecmp.c strncasecmp.c
|
||||||
|
|
||||||
|
## end gnulib module strcase
|
||||||
|
|
||||||
|
## begin gnulib module streq
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += streq.h
|
||||||
|
|
||||||
|
## end gnulib module streq
|
||||||
|
|
||||||
## begin gnulib module strftime
|
## begin gnulib module strftime
|
||||||
|
|
||||||
libgnu_la_SOURCES += strftime.c
|
libgnu_la_SOURCES += strftime.c
|
||||||
|
@ -2040,6 +2143,37 @@ EXTRA_DIST += string.in.h
|
||||||
|
|
||||||
## end gnulib module string
|
## end gnulib module string
|
||||||
|
|
||||||
|
## begin gnulib module strings
|
||||||
|
|
||||||
|
BUILT_SOURCES += strings.h
|
||||||
|
|
||||||
|
# We need the following in order to create <strings.h> when the system
|
||||||
|
# doesn't have one that works with the given compiler.
|
||||||
|
strings.h: strings.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
|
||||||
|
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||||
|
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
|
||||||
|
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||||
|
-e 's|@''HAVE_STRINGS_H''@|$(HAVE_STRINGS_H)|g' \
|
||||||
|
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||||
|
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||||
|
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||||
|
-e 's|@''NEXT_STRINGS_H''@|$(NEXT_STRINGS_H)|g' \
|
||||||
|
-e 's|@''GNULIB_FFS''@|$(GNULIB_FFS)|g' \
|
||||||
|
-e 's|@''HAVE_FFS''@|$(HAVE_FFS)|g' \
|
||||||
|
-e 's|@''HAVE_STRCASECMP''@|$(HAVE_STRCASECMP)|g' \
|
||||||
|
-e 's|@''HAVE_DECL_STRNCASECMP''@|$(HAVE_DECL_STRNCASECMP)|g' \
|
||||||
|
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||||
|
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||||
|
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||||
|
< $(srcdir)/strings.in.h; \
|
||||||
|
} > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
MOSTLYCLEANFILES += strings.h strings.h-t
|
||||||
|
|
||||||
|
EXTRA_DIST += strings.in.h
|
||||||
|
|
||||||
|
## end gnulib module strings
|
||||||
|
|
||||||
## begin gnulib module sys_file
|
## begin gnulib module sys_file
|
||||||
|
|
||||||
BUILT_SOURCES += sys/file.h
|
BUILT_SOURCES += sys/file.h
|
||||||
|
@ -2704,6 +2838,54 @@ EXTRA_DIST += wchar.in.h
|
||||||
|
|
||||||
## end gnulib module wchar
|
## end gnulib module wchar
|
||||||
|
|
||||||
|
## begin gnulib module wcrtomb
|
||||||
|
|
||||||
|
|
||||||
|
EXTRA_DIST += wcrtomb.c
|
||||||
|
|
||||||
|
EXTRA_libgnu_la_SOURCES += wcrtomb.c
|
||||||
|
|
||||||
|
## end gnulib module wcrtomb
|
||||||
|
|
||||||
|
## begin gnulib module wctype-h
|
||||||
|
|
||||||
|
BUILT_SOURCES += wctype.h
|
||||||
|
|
||||||
|
# We need the following in order to create <wctype.h> when the system
|
||||||
|
# doesn't have one that works with the given compiler.
|
||||||
|
wctype.h: wctype.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
|
||||||
|
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||||
|
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||||
|
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||||
|
-e 's/@''HAVE_WCTYPE_H''@/$(HAVE_WCTYPE_H)/g' \
|
||||||
|
-e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
|
||||||
|
-e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
|
||||||
|
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
|
||||||
|
-e 's|@''NEXT_WCTYPE_H''@|$(NEXT_WCTYPE_H)|g' \
|
||||||
|
-e 's/@''GNULIB_ISWBLANK''@/$(GNULIB_ISWBLANK)/g' \
|
||||||
|
-e 's/@''GNULIB_WCTYPE''@/$(GNULIB_WCTYPE)/g' \
|
||||||
|
-e 's/@''GNULIB_ISWCTYPE''@/$(GNULIB_ISWCTYPE)/g' \
|
||||||
|
-e 's/@''GNULIB_WCTRANS''@/$(GNULIB_WCTRANS)/g' \
|
||||||
|
-e 's/@''GNULIB_TOWCTRANS''@/$(GNULIB_TOWCTRANS)/g' \
|
||||||
|
-e 's/@''HAVE_ISWBLANK''@/$(HAVE_ISWBLANK)/g' \
|
||||||
|
-e 's/@''HAVE_ISWCNTRL''@/$(HAVE_ISWCNTRL)/g' \
|
||||||
|
-e 's/@''HAVE_WCTYPE_T''@/$(HAVE_WCTYPE_T)/g' \
|
||||||
|
-e 's/@''HAVE_WCTRANS_T''@/$(HAVE_WCTRANS_T)/g' \
|
||||||
|
-e 's/@''HAVE_WINT_T''@/$(HAVE_WINT_T)/g' \
|
||||||
|
-e 's/@''REPLACE_ISWBLANK''@/$(REPLACE_ISWBLANK)/g' \
|
||||||
|
-e 's/@''REPLACE_ISWCNTRL''@/$(REPLACE_ISWCNTRL)/g' \
|
||||||
|
-e 's/@''REPLACE_TOWLOWER''@/$(REPLACE_TOWLOWER)/g' \
|
||||||
|
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||||
|
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||||
|
< $(srcdir)/wctype.in.h; \
|
||||||
|
} > $@-t && \
|
||||||
|
mv $@-t $@
|
||||||
|
MOSTLYCLEANFILES += wctype.h wctype.h-t
|
||||||
|
|
||||||
|
EXTRA_DIST += wctype.in.h
|
||||||
|
|
||||||
|
## end gnulib module wctype-h
|
||||||
|
|
||||||
## begin gnulib module write
|
## begin gnulib module write
|
||||||
|
|
||||||
|
|
||||||
|
|
39
lib/btowc.c
Normal file
39
lib/btowc.c
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
/* Convert unibyte character to wide character.
|
||||||
|
Copyright (C) 2008, 2010-2012 Free Software Foundation, Inc.
|
||||||
|
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
wint_t
|
||||||
|
btowc (int c)
|
||||||
|
{
|
||||||
|
if (c != EOF)
|
||||||
|
{
|
||||||
|
char buf[1];
|
||||||
|
wchar_t wc;
|
||||||
|
|
||||||
|
buf[0] = c;
|
||||||
|
if (mbtowc (&wc, buf, 1) >= 0)
|
||||||
|
return wc;
|
||||||
|
}
|
||||||
|
return WEOF;
|
||||||
|
}
|
177
lib/langinfo.in.h
Normal file
177
lib/langinfo.in.h
Normal file
|
@ -0,0 +1,177 @@
|
||||||
|
/* Substitute for and wrapper around <langinfo.h>.
|
||||||
|
Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* POSIX <langinfo.h> for platforms that lack it or have an incomplete one.
|
||||||
|
* <http://www.opengroup.org/onlinepubs/9699919799/basedefs/langinfo.h.html>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _@GUARD_PREFIX@_LANGINFO_H
|
||||||
|
|
||||||
|
#if __GNUC__ >= 3
|
||||||
|
@PRAGMA_SYSTEM_HEADER@
|
||||||
|
#endif
|
||||||
|
@PRAGMA_COLUMNS@
|
||||||
|
|
||||||
|
/* The include_next requires a split double-inclusion guard. */
|
||||||
|
#if @HAVE_LANGINFO_H@
|
||||||
|
# @INCLUDE_NEXT@ @NEXT_LANGINFO_H@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _@GUARD_PREFIX@_LANGINFO_H
|
||||||
|
#define _@GUARD_PREFIX@_LANGINFO_H
|
||||||
|
|
||||||
|
|
||||||
|
#if !@HAVE_LANGINFO_H@
|
||||||
|
|
||||||
|
/* A platform that lacks <langinfo.h>. */
|
||||||
|
|
||||||
|
/* Assume that it also lacks <nl_types.h> and the nl_item type. */
|
||||||
|
# if !GNULIB_defined_nl_item
|
||||||
|
typedef int nl_item;
|
||||||
|
# define GNULIB_defined_nl_item 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* nl_langinfo items of the LC_CTYPE category */
|
||||||
|
# define CODESET 10000
|
||||||
|
/* nl_langinfo items of the LC_NUMERIC category */
|
||||||
|
# define RADIXCHAR 10001
|
||||||
|
# define THOUSEP 10002
|
||||||
|
/* nl_langinfo items of the LC_TIME category */
|
||||||
|
# define D_T_FMT 10003
|
||||||
|
# define D_FMT 10004
|
||||||
|
# define T_FMT 10005
|
||||||
|
# define T_FMT_AMPM 10006
|
||||||
|
# define AM_STR 10007
|
||||||
|
# define PM_STR 10008
|
||||||
|
# define DAY_1 10009
|
||||||
|
# define DAY_2 (DAY_1 + 1)
|
||||||
|
# define DAY_3 (DAY_1 + 2)
|
||||||
|
# define DAY_4 (DAY_1 + 3)
|
||||||
|
# define DAY_5 (DAY_1 + 4)
|
||||||
|
# define DAY_6 (DAY_1 + 5)
|
||||||
|
# define DAY_7 (DAY_1 + 6)
|
||||||
|
# define ABDAY_1 10016
|
||||||
|
# define ABDAY_2 (ABDAY_1 + 1)
|
||||||
|
# define ABDAY_3 (ABDAY_1 + 2)
|
||||||
|
# define ABDAY_4 (ABDAY_1 + 3)
|
||||||
|
# define ABDAY_5 (ABDAY_1 + 4)
|
||||||
|
# define ABDAY_6 (ABDAY_1 + 5)
|
||||||
|
# define ABDAY_7 (ABDAY_1 + 6)
|
||||||
|
# define MON_1 10023
|
||||||
|
# define MON_2 (MON_1 + 1)
|
||||||
|
# define MON_3 (MON_1 + 2)
|
||||||
|
# define MON_4 (MON_1 + 3)
|
||||||
|
# define MON_5 (MON_1 + 4)
|
||||||
|
# define MON_6 (MON_1 + 5)
|
||||||
|
# define MON_7 (MON_1 + 6)
|
||||||
|
# define MON_8 (MON_1 + 7)
|
||||||
|
# define MON_9 (MON_1 + 8)
|
||||||
|
# define MON_10 (MON_1 + 9)
|
||||||
|
# define MON_11 (MON_1 + 10)
|
||||||
|
# define MON_12 (MON_1 + 11)
|
||||||
|
# define ABMON_1 10035
|
||||||
|
# define ABMON_2 (ABMON_1 + 1)
|
||||||
|
# define ABMON_3 (ABMON_1 + 2)
|
||||||
|
# define ABMON_4 (ABMON_1 + 3)
|
||||||
|
# define ABMON_5 (ABMON_1 + 4)
|
||||||
|
# define ABMON_6 (ABMON_1 + 5)
|
||||||
|
# define ABMON_7 (ABMON_1 + 6)
|
||||||
|
# define ABMON_8 (ABMON_1 + 7)
|
||||||
|
# define ABMON_9 (ABMON_1 + 8)
|
||||||
|
# define ABMON_10 (ABMON_1 + 9)
|
||||||
|
# define ABMON_11 (ABMON_1 + 10)
|
||||||
|
# define ABMON_12 (ABMON_1 + 11)
|
||||||
|
# define ERA 10047
|
||||||
|
# define ERA_D_FMT 10048
|
||||||
|
# define ERA_D_T_FMT 10049
|
||||||
|
# define ERA_T_FMT 10050
|
||||||
|
# define ALT_DIGITS 10051
|
||||||
|
/* nl_langinfo items of the LC_MONETARY category */
|
||||||
|
# define CRNCYSTR 10052
|
||||||
|
/* nl_langinfo items of the LC_MESSAGES category */
|
||||||
|
# define YESEXPR 10053
|
||||||
|
# define NOEXPR 10054
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* A platform that has <langinfo.h>. */
|
||||||
|
|
||||||
|
# if !@HAVE_LANGINFO_CODESET@
|
||||||
|
# define CODESET 10000
|
||||||
|
# define GNULIB_defined_CODESET 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if !@HAVE_LANGINFO_T_FMT_AMPM@
|
||||||
|
# define T_FMT_AMPM 10006
|
||||||
|
# define GNULIB_defined_T_FMT_AMPM 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if !@HAVE_LANGINFO_ERA@
|
||||||
|
# define ERA 10047
|
||||||
|
# define ERA_D_FMT 10048
|
||||||
|
# define ERA_D_T_FMT 10049
|
||||||
|
# define ERA_T_FMT 10050
|
||||||
|
# define ALT_DIGITS 10051
|
||||||
|
# define GNULIB_defined_ERA 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if !@HAVE_LANGINFO_YESEXPR@
|
||||||
|
# define YESEXPR 10053
|
||||||
|
# define NOEXPR 10054
|
||||||
|
# define GNULIB_defined_YESEXPR 1
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||||
|
|
||||||
|
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||||
|
|
||||||
|
/* Declare overridden functions. */
|
||||||
|
|
||||||
|
|
||||||
|
/* Return a piece of locale dependent information.
|
||||||
|
Note: The difference between nl_langinfo (CODESET) and locale_charset ()
|
||||||
|
is that the latter normalizes the encoding names to GNU conventions. */
|
||||||
|
|
||||||
|
#if @GNULIB_NL_LANGINFO@
|
||||||
|
# if @REPLACE_NL_LANGINFO@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# undef nl_langinfo
|
||||||
|
# define nl_langinfo rpl_nl_langinfo
|
||||||
|
# endif
|
||||||
|
_GL_FUNCDECL_RPL (nl_langinfo, char *, (nl_item item));
|
||||||
|
_GL_CXXALIAS_RPL (nl_langinfo, char *, (nl_item item));
|
||||||
|
# else
|
||||||
|
# if !@HAVE_NL_LANGINFO@
|
||||||
|
_GL_FUNCDECL_SYS (nl_langinfo, char *, (nl_item item));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (nl_langinfo, char *, (nl_item item));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIASWARN (nl_langinfo);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef nl_langinfo
|
||||||
|
# if HAVE_RAW_DECL_NL_LANGINFO
|
||||||
|
_GL_WARN_ON_USE (nl_langinfo, "nl_langinfo is not portable - "
|
||||||
|
"use gnulib module nl_langinfo for portability");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _@GUARD_PREFIX@_LANGINFO_H */
|
||||||
|
#endif /* _@GUARD_PREFIX@_LANGINFO_H */
|
396
lib/mbrtowc.c
Normal file
396
lib/mbrtowc.c
Normal file
|
@ -0,0 +1,396 @@
|
||||||
|
/* Convert multibyte character to wide character.
|
||||||
|
Copyright (C) 1999-2002, 2005-2012 Free Software Foundation, Inc.
|
||||||
|
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#if GNULIB_defined_mbstate_t
|
||||||
|
/* Implement mbrtowc() on top of mbtowc(). */
|
||||||
|
|
||||||
|
# include <errno.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
|
||||||
|
# include "localcharset.h"
|
||||||
|
# include "streq.h"
|
||||||
|
# include "verify.h"
|
||||||
|
|
||||||
|
|
||||||
|
verify (sizeof (mbstate_t) >= 4);
|
||||||
|
|
||||||
|
static char internal_state[4];
|
||||||
|
|
||||||
|
size_t
|
||||||
|
mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||||
|
{
|
||||||
|
char *pstate = (char *)ps;
|
||||||
|
|
||||||
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
pwc = NULL;
|
||||||
|
s = "";
|
||||||
|
n = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
return (size_t)(-2);
|
||||||
|
|
||||||
|
/* Here n > 0. */
|
||||||
|
|
||||||
|
if (pstate == NULL)
|
||||||
|
pstate = internal_state;
|
||||||
|
|
||||||
|
{
|
||||||
|
size_t nstate = pstate[0];
|
||||||
|
char buf[4];
|
||||||
|
const char *p;
|
||||||
|
size_t m;
|
||||||
|
|
||||||
|
switch (nstate)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
p = s;
|
||||||
|
m = n;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
buf[2] = pstate[3];
|
||||||
|
/*FALLTHROUGH*/
|
||||||
|
case 2:
|
||||||
|
buf[1] = pstate[2];
|
||||||
|
/*FALLTHROUGH*/
|
||||||
|
case 1:
|
||||||
|
buf[0] = pstate[1];
|
||||||
|
p = buf;
|
||||||
|
m = nstate;
|
||||||
|
buf[m++] = s[0];
|
||||||
|
if (n >= 2 && m < 4)
|
||||||
|
{
|
||||||
|
buf[m++] = s[1];
|
||||||
|
if (n >= 3 && m < 4)
|
||||||
|
buf[m++] = s[2];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EINVAL;
|
||||||
|
return (size_t)(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Here m > 0. */
|
||||||
|
|
||||||
|
# if __GLIBC__ || defined __UCLIBC__
|
||||||
|
/* Work around bug <http://sourceware.org/bugzilla/show_bug.cgi?id=9674> */
|
||||||
|
mbtowc (NULL, NULL, 0);
|
||||||
|
# endif
|
||||||
|
{
|
||||||
|
int res = mbtowc (pwc, p, m);
|
||||||
|
|
||||||
|
if (res >= 0)
|
||||||
|
{
|
||||||
|
if (pwc != NULL && ((*pwc == 0) != (res == 0)))
|
||||||
|
abort ();
|
||||||
|
if (nstate >= (res > 0 ? res : 1))
|
||||||
|
abort ();
|
||||||
|
res -= nstate;
|
||||||
|
pstate[0] = 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mbtowc does not distinguish between invalid and incomplete multibyte
|
||||||
|
sequences. But mbrtowc needs to make this distinction.
|
||||||
|
There are two possible approaches:
|
||||||
|
- Use iconv() and its return value.
|
||||||
|
- Use built-in knowledge about the possible encodings.
|
||||||
|
Given the low quality of implementation of iconv() on the systems that
|
||||||
|
lack mbrtowc(), we use the second approach.
|
||||||
|
The possible encodings are:
|
||||||
|
- 8-bit encodings,
|
||||||
|
- EUC-JP, EUC-KR, GB2312, EUC-TW, BIG5, GB18030, SJIS,
|
||||||
|
- UTF-8.
|
||||||
|
Use specialized code for each. */
|
||||||
|
if (m >= 4 || m >= MB_CUR_MAX)
|
||||||
|
goto invalid;
|
||||||
|
/* Here MB_CUR_MAX > 1 and 0 < m < 4. */
|
||||||
|
{
|
||||||
|
const char *encoding = locale_charset ();
|
||||||
|
|
||||||
|
if (STREQ (encoding, "UTF-8", 'U', 'T', 'F', '-', '8', 0, 0, 0, 0))
|
||||||
|
{
|
||||||
|
/* Cf. unistr/u8-mblen.c. */
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if (c >= 0xc2)
|
||||||
|
{
|
||||||
|
if (c < 0xe0)
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
else if (c < 0xf0)
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
goto incomplete;
|
||||||
|
if (m == 2)
|
||||||
|
{
|
||||||
|
unsigned char c2 = (unsigned char) p[1];
|
||||||
|
|
||||||
|
if ((c2 ^ 0x80) < 0x40
|
||||||
|
&& (c >= 0xe1 || c2 >= 0xa0)
|
||||||
|
&& (c != 0xed || c2 < 0xa0))
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (c <= 0xf4)
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
goto incomplete;
|
||||||
|
else /* m == 2 || m == 3 */
|
||||||
|
{
|
||||||
|
unsigned char c2 = (unsigned char) p[1];
|
||||||
|
|
||||||
|
if ((c2 ^ 0x80) < 0x40
|
||||||
|
&& (c >= 0xf1 || c2 >= 0x90)
|
||||||
|
&& (c < 0xf4 || (c == 0xf4 && c2 < 0x90)))
|
||||||
|
{
|
||||||
|
if (m == 2)
|
||||||
|
goto incomplete;
|
||||||
|
else /* m == 3 */
|
||||||
|
{
|
||||||
|
unsigned char c3 = (unsigned char) p[2];
|
||||||
|
|
||||||
|
if ((c3 ^ 0x80) < 0x40)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* As a reference for this code, you can use the GNU libiconv
|
||||||
|
implementation. Look for uses of the RET_TOOFEW macro. */
|
||||||
|
|
||||||
|
if (STREQ (encoding, "EUC-JP", 'E', 'U', 'C', '-', 'J', 'P', 0, 0, 0))
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if ((c >= 0xa1 && c < 0xff) || c == 0x8e || c == 0x8f)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
if (m == 2)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if (c == 0x8f)
|
||||||
|
{
|
||||||
|
unsigned char c2 = (unsigned char) p[1];
|
||||||
|
|
||||||
|
if (c2 >= 0xa1 && c2 < 0xff)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
if (STREQ (encoding, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
|
||||||
|
|| STREQ (encoding, "GB2312", 'G', 'B', '2', '3', '1', '2', 0, 0, 0)
|
||||||
|
|| STREQ (encoding, "BIG5", 'B', 'I', 'G', '5', 0, 0, 0, 0, 0))
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if (c >= 0xa1 && c < 0xff)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
if (STREQ (encoding, "EUC-TW", 'E', 'U', 'C', '-', 'T', 'W', 0, 0, 0))
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if ((c >= 0xa1 && c < 0xff) || c == 0x8e)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
else /* m == 2 || m == 3 */
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if (c == 0x8e)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
if (STREQ (encoding, "GB18030", 'G', 'B', '1', '8', '0', '3', '0', 0, 0))
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if ((c >= 0x90 && c <= 0xe3) || (c >= 0xf8 && c <= 0xfe))
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
else /* m == 2 || m == 3 */
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if (c >= 0x90 && c <= 0xe3)
|
||||||
|
{
|
||||||
|
unsigned char c2 = (unsigned char) p[1];
|
||||||
|
|
||||||
|
if (c2 >= 0x30 && c2 <= 0x39)
|
||||||
|
{
|
||||||
|
if (m == 2)
|
||||||
|
goto incomplete;
|
||||||
|
else /* m == 3 */
|
||||||
|
{
|
||||||
|
unsigned char c3 = (unsigned char) p[2];
|
||||||
|
|
||||||
|
if (c3 >= 0x81 && c3 <= 0xfe)
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
if (STREQ (encoding, "SJIS", 'S', 'J', 'I', 'S', 0, 0, 0, 0, 0))
|
||||||
|
{
|
||||||
|
if (m == 1)
|
||||||
|
{
|
||||||
|
unsigned char c = (unsigned char) p[0];
|
||||||
|
|
||||||
|
if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)
|
||||||
|
|| (c >= 0xf0 && c <= 0xf9))
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
goto invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* An unknown multibyte encoding. */
|
||||||
|
goto incomplete;
|
||||||
|
}
|
||||||
|
|
||||||
|
incomplete:
|
||||||
|
{
|
||||||
|
size_t k = nstate;
|
||||||
|
/* Here 0 <= k < m < 4. */
|
||||||
|
pstate[++k] = s[0];
|
||||||
|
if (k < m)
|
||||||
|
{
|
||||||
|
pstate[++k] = s[1];
|
||||||
|
if (k < m)
|
||||||
|
pstate[++k] = s[2];
|
||||||
|
}
|
||||||
|
if (k != m)
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
pstate[0] = m;
|
||||||
|
return (size_t)(-2);
|
||||||
|
|
||||||
|
invalid:
|
||||||
|
errno = EILSEQ;
|
||||||
|
/* The conversion state is undefined, says POSIX. */
|
||||||
|
return (size_t)(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* Override the system's mbrtowc() function. */
|
||||||
|
|
||||||
|
# undef mbrtowc
|
||||||
|
|
||||||
|
size_t
|
||||||
|
rpl_mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps)
|
||||||
|
{
|
||||||
|
# if MBRTOWC_NULL_ARG2_BUG || MBRTOWC_RETVAL_BUG
|
||||||
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
pwc = NULL;
|
||||||
|
s = "";
|
||||||
|
n = 1;
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if MBRTOWC_RETVAL_BUG
|
||||||
|
{
|
||||||
|
static mbstate_t internal_state;
|
||||||
|
|
||||||
|
/* Override mbrtowc's internal state. We cannot call mbsinit() on the
|
||||||
|
hidden internal state, but we can call it on our variable. */
|
||||||
|
if (ps == NULL)
|
||||||
|
ps = &internal_state;
|
||||||
|
|
||||||
|
if (!mbsinit (ps))
|
||||||
|
{
|
||||||
|
/* Parse the rest of the multibyte character byte for byte. */
|
||||||
|
size_t count = 0;
|
||||||
|
for (; n > 0; s++, n--)
|
||||||
|
{
|
||||||
|
wchar_t wc;
|
||||||
|
size_t ret = mbrtowc (&wc, s, 1, ps);
|
||||||
|
|
||||||
|
if (ret == (size_t)(-1))
|
||||||
|
return (size_t)(-1);
|
||||||
|
count++;
|
||||||
|
if (ret != (size_t)(-2))
|
||||||
|
{
|
||||||
|
/* The multibyte character has been completed. */
|
||||||
|
if (pwc != NULL)
|
||||||
|
*pwc = wc;
|
||||||
|
return (wc == 0 ? 0 : count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (size_t)(-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if MBRTOWC_NUL_RETVAL_BUG
|
||||||
|
{
|
||||||
|
wchar_t wc;
|
||||||
|
size_t ret = mbrtowc (&wc, s, n, ps);
|
||||||
|
|
||||||
|
if (ret != (size_t)(-1) && ret != (size_t)(-2))
|
||||||
|
{
|
||||||
|
if (pwc != NULL)
|
||||||
|
*pwc = wc;
|
||||||
|
if (wc == 0)
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
{
|
||||||
|
# if MBRTOWC_NULL_ARG1_BUG
|
||||||
|
wchar_t dummy;
|
||||||
|
|
||||||
|
if (pwc == NULL)
|
||||||
|
pwc = &dummy;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
return mbrtowc (pwc, s, n, ps);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
61
lib/mbsinit.c
Normal file
61
lib/mbsinit.c
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/* Test for initial conversion state.
|
||||||
|
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||||
|
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include "verify.h"
|
||||||
|
|
||||||
|
#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
|
||||||
|
|
||||||
|
/* On native Windows, 'mbstate_t' is defined as 'int'. */
|
||||||
|
|
||||||
|
int
|
||||||
|
mbsinit (const mbstate_t *ps)
|
||||||
|
{
|
||||||
|
return ps == NULL || *ps == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Platforms that lack mbsinit() also lack mbrlen(), mbrtowc(), mbsrtowcs()
|
||||||
|
and wcrtomb(), wcsrtombs().
|
||||||
|
We assume that
|
||||||
|
- sizeof (mbstate_t) >= 4,
|
||||||
|
- only stateless encodings are supported (such as UTF-8 and EUC-JP, but
|
||||||
|
not ISO-2022 variants),
|
||||||
|
- for each encoding, the number of bytes for a wide character is <= 4.
|
||||||
|
(This maximum is attained for UTF-8, GB18030, EUC-TW.)
|
||||||
|
We define the meaning of mbstate_t as follows:
|
||||||
|
- In mb -> wc direction, mbstate_t's first byte contains the number of
|
||||||
|
buffered bytes (in the range 0..3), followed by up to 3 buffered bytes.
|
||||||
|
- In wc -> mb direction, mbstate_t contains no information. In other
|
||||||
|
words, it is always in the initial state. */
|
||||||
|
|
||||||
|
verify (sizeof (mbstate_t) >= 4);
|
||||||
|
|
||||||
|
int
|
||||||
|
mbsinit (const mbstate_t *ps)
|
||||||
|
{
|
||||||
|
const char *pstate = (const char *)ps;
|
||||||
|
|
||||||
|
return pstate == NULL || pstate[0] == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
44
lib/mbtowc-impl.h
Normal file
44
lib/mbtowc-impl.h
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/* Convert multibyte character to wide character.
|
||||||
|
Copyright (C) 2011-2012 Free Software Foundation, Inc.
|
||||||
|
Written by Bruno Haible <bruno@clisp.org>, 2011.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* We don't need a static internal state, because the encoding is not state
|
||||||
|
dependent, and when mbrtowc returns (size_t)(-2). we throw the result
|
||||||
|
away. */
|
||||||
|
|
||||||
|
int
|
||||||
|
mbtowc (wchar_t *pwc, const char *s, size_t n)
|
||||||
|
{
|
||||||
|
if (s == NULL)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mbstate_t state;
|
||||||
|
wchar_t wc;
|
||||||
|
size_t result;
|
||||||
|
|
||||||
|
memset (&state, 0, sizeof (mbstate_t));
|
||||||
|
result = mbrtowc (&wc, s, n, &state);
|
||||||
|
if (result == (size_t)-1 || result == (size_t)-2)
|
||||||
|
{
|
||||||
|
errno = EILSEQ;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (pwc != NULL)
|
||||||
|
*pwc = wc;
|
||||||
|
return (wc == 0 ? 0 : result);
|
||||||
|
}
|
||||||
|
}
|
26
lib/mbtowc.c
Normal file
26
lib/mbtowc.c
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* Convert multibyte character to wide character.
|
||||||
|
Copyright (C) 2011-2012 Free Software Foundation, Inc.
|
||||||
|
Written by Bruno Haible <bruno@clisp.org>, 2011.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include "mbtowc-impl.h"
|
271
lib/nl_langinfo.c
Normal file
271
lib/nl_langinfo.c
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
/* nl_langinfo() replacement: query locale dependent information.
|
||||||
|
|
||||||
|
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <langinfo.h>
|
||||||
|
|
||||||
|
#if REPLACE_NL_LANGINFO
|
||||||
|
|
||||||
|
/* Override nl_langinfo with support for added nl_item values. */
|
||||||
|
|
||||||
|
# include <locale.h>
|
||||||
|
# include <string.h>
|
||||||
|
|
||||||
|
# undef nl_langinfo
|
||||||
|
|
||||||
|
char *
|
||||||
|
rpl_nl_langinfo (nl_item item)
|
||||||
|
{
|
||||||
|
switch (item)
|
||||||
|
{
|
||||||
|
# if GNULIB_defined_CODESET
|
||||||
|
case CODESET:
|
||||||
|
{
|
||||||
|
const char *locale;
|
||||||
|
static char buf[2 + 10 + 1];
|
||||||
|
|
||||||
|
locale = setlocale (LC_CTYPE, NULL);
|
||||||
|
if (locale != NULL && locale[0] != '\0')
|
||||||
|
{
|
||||||
|
/* If the locale name contains an encoding after the dot, return
|
||||||
|
it. */
|
||||||
|
const char *dot = strchr (locale, '.');
|
||||||
|
|
||||||
|
if (dot != NULL)
|
||||||
|
{
|
||||||
|
const char *modifier;
|
||||||
|
|
||||||
|
dot++;
|
||||||
|
/* Look for the possible @... trailer and remove it, if any. */
|
||||||
|
modifier = strchr (dot, '@');
|
||||||
|
if (modifier == NULL)
|
||||||
|
return dot;
|
||||||
|
if (modifier - dot < sizeof (buf))
|
||||||
|
{
|
||||||
|
memcpy (buf, dot, modifier - dot);
|
||||||
|
buf [modifier - dot] = '\0';
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
# if GNULIB_defined_T_FMT_AMPM
|
||||||
|
case T_FMT_AMPM:
|
||||||
|
return "%I:%M:%S %p";
|
||||||
|
# endif
|
||||||
|
# if GNULIB_defined_ERA
|
||||||
|
case ERA:
|
||||||
|
/* The format is not standardized. In glibc it is a sequence of strings
|
||||||
|
of the form "direction:offset:start_date:end_date:era_name:era_format"
|
||||||
|
with an empty string at the end. */
|
||||||
|
return "";
|
||||||
|
case ERA_D_FMT:
|
||||||
|
/* The %Ex conversion in strftime behaves like %x if the locale does not
|
||||||
|
have an alternative time format. */
|
||||||
|
item = D_FMT;
|
||||||
|
break;
|
||||||
|
case ERA_D_T_FMT:
|
||||||
|
/* The %Ec conversion in strftime behaves like %c if the locale does not
|
||||||
|
have an alternative time format. */
|
||||||
|
item = D_T_FMT;
|
||||||
|
break;
|
||||||
|
case ERA_T_FMT:
|
||||||
|
/* The %EX conversion in strftime behaves like %X if the locale does not
|
||||||
|
have an alternative time format. */
|
||||||
|
item = T_FMT;
|
||||||
|
break;
|
||||||
|
case ALT_DIGITS:
|
||||||
|
/* The format is not standardized. In glibc it is a sequence of 10
|
||||||
|
strings, appended in memory. */
|
||||||
|
return "\0\0\0\0\0\0\0\0\0\0";
|
||||||
|
# endif
|
||||||
|
# if GNULIB_defined_YESEXPR || !FUNC_NL_LANGINFO_YESEXPR_WORKS
|
||||||
|
case YESEXPR:
|
||||||
|
return "^[yY]";
|
||||||
|
case NOEXPR:
|
||||||
|
return "^[nN]";
|
||||||
|
# endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return nl_langinfo (item);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Provide nl_langinfo from scratch. */
|
||||||
|
|
||||||
|
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||||
|
|
||||||
|
/* Native Windows platforms. */
|
||||||
|
|
||||||
|
# define WIN32_LEAN_AND_MEAN /* avoid including junk */
|
||||||
|
# include <windows.h>
|
||||||
|
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
/* An old Unix platform without locales, such as Linux libc5 or BeOS. */
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <locale.h>
|
||||||
|
|
||||||
|
char *
|
||||||
|
nl_langinfo (nl_item item)
|
||||||
|
{
|
||||||
|
switch (item)
|
||||||
|
{
|
||||||
|
/* nl_langinfo items of the LC_CTYPE category */
|
||||||
|
case CODESET:
|
||||||
|
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||||
|
{
|
||||||
|
static char buf[2 + 10 + 1];
|
||||||
|
|
||||||
|
/* The Windows API has a function returning the locale's codepage as
|
||||||
|
a number. */
|
||||||
|
sprintf (buf, "CP%u", GetACP ());
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
# elif defined __BEOS__
|
||||||
|
return "UTF-8";
|
||||||
|
# else
|
||||||
|
return "ISO-8859-1";
|
||||||
|
# endif
|
||||||
|
/* nl_langinfo items of the LC_NUMERIC category */
|
||||||
|
case RADIXCHAR:
|
||||||
|
return localeconv () ->decimal_point;
|
||||||
|
case THOUSEP:
|
||||||
|
return localeconv () ->thousands_sep;
|
||||||
|
/* nl_langinfo items of the LC_TIME category.
|
||||||
|
TODO: Really use the locale. */
|
||||||
|
case D_T_FMT:
|
||||||
|
case ERA_D_T_FMT:
|
||||||
|
return "%a %b %e %H:%M:%S %Y";
|
||||||
|
case D_FMT:
|
||||||
|
case ERA_D_FMT:
|
||||||
|
return "%m/%d/%y";
|
||||||
|
case T_FMT:
|
||||||
|
case ERA_T_FMT:
|
||||||
|
return "%H:%M:%S";
|
||||||
|
case T_FMT_AMPM:
|
||||||
|
return "%I:%M:%S %p";
|
||||||
|
case AM_STR:
|
||||||
|
return "AM";
|
||||||
|
case PM_STR:
|
||||||
|
return "PM";
|
||||||
|
case DAY_1:
|
||||||
|
return "Sunday";
|
||||||
|
case DAY_2:
|
||||||
|
return "Monday";
|
||||||
|
case DAY_3:
|
||||||
|
return "Tuesday";
|
||||||
|
case DAY_4:
|
||||||
|
return "Wednesday";
|
||||||
|
case DAY_5:
|
||||||
|
return "Thursday";
|
||||||
|
case DAY_6:
|
||||||
|
return "Friday";
|
||||||
|
case DAY_7:
|
||||||
|
return "Saturday";
|
||||||
|
case ABDAY_1:
|
||||||
|
return "Sun";
|
||||||
|
case ABDAY_2:
|
||||||
|
return "Mon";
|
||||||
|
case ABDAY_3:
|
||||||
|
return "Tue";
|
||||||
|
case ABDAY_4:
|
||||||
|
return "Wed";
|
||||||
|
case ABDAY_5:
|
||||||
|
return "Thu";
|
||||||
|
case ABDAY_6:
|
||||||
|
return "Fri";
|
||||||
|
case ABDAY_7:
|
||||||
|
return "Sat";
|
||||||
|
case MON_1:
|
||||||
|
return "January";
|
||||||
|
case MON_2:
|
||||||
|
return "February";
|
||||||
|
case MON_3:
|
||||||
|
return "March";
|
||||||
|
case MON_4:
|
||||||
|
return "April";
|
||||||
|
case MON_5:
|
||||||
|
return "May";
|
||||||
|
case MON_6:
|
||||||
|
return "June";
|
||||||
|
case MON_7:
|
||||||
|
return "July";
|
||||||
|
case MON_8:
|
||||||
|
return "August";
|
||||||
|
case MON_9:
|
||||||
|
return "September";
|
||||||
|
case MON_10:
|
||||||
|
return "October";
|
||||||
|
case MON_11:
|
||||||
|
return "November";
|
||||||
|
case MON_12:
|
||||||
|
return "December";
|
||||||
|
case ABMON_1:
|
||||||
|
return "Jan";
|
||||||
|
case ABMON_2:
|
||||||
|
return "Feb";
|
||||||
|
case ABMON_3:
|
||||||
|
return "Mar";
|
||||||
|
case ABMON_4:
|
||||||
|
return "Apr";
|
||||||
|
case ABMON_5:
|
||||||
|
return "May";
|
||||||
|
case ABMON_6:
|
||||||
|
return "Jun";
|
||||||
|
case ABMON_7:
|
||||||
|
return "Jul";
|
||||||
|
case ABMON_8:
|
||||||
|
return "Aug";
|
||||||
|
case ABMON_9:
|
||||||
|
return "Sep";
|
||||||
|
case ABMON_10:
|
||||||
|
return "Oct";
|
||||||
|
case ABMON_11:
|
||||||
|
return "Nov";
|
||||||
|
case ABMON_12:
|
||||||
|
return "Dec";
|
||||||
|
case ERA:
|
||||||
|
return "";
|
||||||
|
case ALT_DIGITS:
|
||||||
|
return "\0\0\0\0\0\0\0\0\0\0";
|
||||||
|
/* nl_langinfo items of the LC_MONETARY category
|
||||||
|
TODO: Really use the locale. */
|
||||||
|
case CRNCYSTR:
|
||||||
|
return "-";
|
||||||
|
/* nl_langinfo items of the LC_MESSAGES category
|
||||||
|
TODO: Really use the locale. */
|
||||||
|
case YESEXPR:
|
||||||
|
return "^[yY]";
|
||||||
|
case NOEXPR:
|
||||||
|
return "^[nN]";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
3876
lib/regcomp.c
Normal file
3876
lib/regcomp.c
Normal file
File diff suppressed because it is too large
Load diff
72
lib/regex.c
Normal file
72
lib/regex.c
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
/* Extended regular expression matching and search library.
|
||||||
|
Copyright (C) 2002-2003, 2005-2006, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Make sure noone compiles this code with a C++ compiler. */
|
||||||
|
#if defined __cplusplus && defined _LIBC
|
||||||
|
# error "This is C code, use a C compiler"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
/* We have to keep the namespace clean. */
|
||||||
|
# define regfree(preg) __regfree (preg)
|
||||||
|
# define regexec(pr, st, nm, pm, ef) __regexec (pr, st, nm, pm, ef)
|
||||||
|
# define regcomp(preg, pattern, cflags) __regcomp (preg, pattern, cflags)
|
||||||
|
# define regerror(errcode, preg, errbuf, errbuf_size) \
|
||||||
|
__regerror(errcode, preg, errbuf, errbuf_size)
|
||||||
|
# define re_set_registers(bu, re, nu, st, en) \
|
||||||
|
__re_set_registers (bu, re, nu, st, en)
|
||||||
|
# define re_match_2(bufp, string1, size1, string2, size2, pos, regs, stop) \
|
||||||
|
__re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
|
||||||
|
# define re_match(bufp, string, size, pos, regs) \
|
||||||
|
__re_match (bufp, string, size, pos, regs)
|
||||||
|
# define re_search(bufp, string, size, startpos, range, regs) \
|
||||||
|
__re_search (bufp, string, size, startpos, range, regs)
|
||||||
|
# define re_compile_pattern(pattern, length, bufp) \
|
||||||
|
__re_compile_pattern (pattern, length, bufp)
|
||||||
|
# define re_set_syntax(syntax) __re_set_syntax (syntax)
|
||||||
|
# define re_search_2(bufp, st1, s1, st2, s2, startpos, range, regs, stop) \
|
||||||
|
__re_search_2 (bufp, st1, s1, st2, s2, startpos, range, regs, stop)
|
||||||
|
# define re_compile_fastmap(bufp) __re_compile_fastmap (bufp)
|
||||||
|
|
||||||
|
# include "../locale/localeinfo.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* On some systems, limits.h sets RE_DUP_MAX to a lower value than
|
||||||
|
GNU regex allows. Include it before <regex.h>, which correctly
|
||||||
|
#undefs RE_DUP_MAX and sets it to the right value. */
|
||||||
|
#include <limits.h>
|
||||||
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include <regex.h>
|
||||||
|
#include "regex_internal.h"
|
||||||
|
|
||||||
|
#include "regex_internal.c"
|
||||||
|
#include "regcomp.c"
|
||||||
|
#include "regexec.c"
|
||||||
|
|
||||||
|
/* Binary backward compatibility. */
|
||||||
|
#if _LIBC
|
||||||
|
# include <shlib-compat.h>
|
||||||
|
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
|
||||||
|
link_warning (re_max_failures, "the 're_max_failures' variable is obsolete and will go away.")
|
||||||
|
int re_max_failures = 2000;
|
||||||
|
# endif
|
||||||
|
#endif
|
675
lib/regex.h
Normal file
675
lib/regex.h
Normal file
|
@ -0,0 +1,675 @@
|
||||||
|
/* Definitions for data structures and routines for the regular
|
||||||
|
expression library.
|
||||||
|
Copyright (C) 1985, 1989-1993, 1995-1998, 2000-2003, 2005-2006, 2009-2012
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#ifndef _REGEX_H
|
||||||
|
#define _REGEX_H 1
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
/* Allow the use in C++ code. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define __USE_GNU_REGEX to declare GNU extensions that violate the
|
||||||
|
POSIX name space rules. */
|
||||||
|
#undef __USE_GNU_REGEX
|
||||||
|
#if (defined _GNU_SOURCE \
|
||||||
|
|| (!defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE \
|
||||||
|
&& !defined _XOPEN_SOURCE))
|
||||||
|
# define __USE_GNU_REGEX 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _REGEX_LARGE_OFFSETS
|
||||||
|
|
||||||
|
/* Use types and values that are wide enough to represent signed and
|
||||||
|
unsigned byte offsets in memory. This currently works only when
|
||||||
|
the regex code is used outside of the GNU C library; it is not yet
|
||||||
|
supported within glibc itself, and glibc users should not define
|
||||||
|
_REGEX_LARGE_OFFSETS. */
|
||||||
|
|
||||||
|
/* The type of the offset of a byte within a string.
|
||||||
|
For historical reasons POSIX 1003.1-2004 requires that regoff_t be
|
||||||
|
at least as wide as off_t. However, many common POSIX platforms set
|
||||||
|
regoff_t to the more-sensible ssize_t and the Open Group has
|
||||||
|
signalled its intention to change the requirement to be that
|
||||||
|
regoff_t be at least as wide as ptrdiff_t and ssize_t; see XBD ERN
|
||||||
|
60 (2005-08-25). We don't know of any hosts where ssize_t or
|
||||||
|
ptrdiff_t is wider than ssize_t, so ssize_t is safe. */
|
||||||
|
typedef ssize_t regoff_t;
|
||||||
|
|
||||||
|
/* The type of nonnegative object indexes. Traditionally, GNU regex
|
||||||
|
uses 'int' for these. Code that uses __re_idx_t should work
|
||||||
|
regardless of whether the type is signed. */
|
||||||
|
typedef size_t __re_idx_t;
|
||||||
|
|
||||||
|
/* The type of object sizes. */
|
||||||
|
typedef size_t __re_size_t;
|
||||||
|
|
||||||
|
/* The type of object sizes, in places where the traditional code
|
||||||
|
uses unsigned long int. */
|
||||||
|
typedef size_t __re_long_size_t;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
/* Use types that are binary-compatible with the traditional GNU regex
|
||||||
|
implementation, which mishandles strings longer than INT_MAX. */
|
||||||
|
|
||||||
|
typedef int regoff_t;
|
||||||
|
typedef int __re_idx_t;
|
||||||
|
typedef unsigned int __re_size_t;
|
||||||
|
typedef unsigned long int __re_long_size_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The following two types have to be signed and unsigned integer type
|
||||||
|
wide enough to hold a value of a pointer. For most ANSI compilers
|
||||||
|
ptrdiff_t and size_t should be likely OK. Still size of these two
|
||||||
|
types is 2 for Microsoft C. Ugh... */
|
||||||
|
typedef long int s_reg_t;
|
||||||
|
typedef unsigned long int active_reg_t;
|
||||||
|
|
||||||
|
/* The following bits are used to determine the regexp syntax we
|
||||||
|
recognize. The set/not-set meanings are chosen so that Emacs syntax
|
||||||
|
remains the value 0. The bits are given in alphabetical order, and
|
||||||
|
the definitions shifted by one from the previous bit; thus, when we
|
||||||
|
add or remove a bit, only one other definition need change. */
|
||||||
|
typedef unsigned long int reg_syntax_t;
|
||||||
|
|
||||||
|
#ifdef __USE_GNU_REGEX
|
||||||
|
|
||||||
|
/* If this bit is not set, then \ inside a bracket expression is literal.
|
||||||
|
If set, then such a \ quotes the following character. */
|
||||||
|
# define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
|
||||||
|
|
||||||
|
/* If this bit is not set, then + and ? are operators, and \+ and \? are
|
||||||
|
literals.
|
||||||
|
If set, then \+ and \? are operators and + and ? are literals. */
|
||||||
|
# define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then character classes are supported. They are:
|
||||||
|
[:alpha:], [:upper:], [:lower:], [:digit:], [:alnum:], [:xdigit:],
|
||||||
|
[:space:], [:print:], [:punct:], [:graph:], and [:cntrl:].
|
||||||
|
If not set, then character classes are not supported. */
|
||||||
|
# define RE_CHAR_CLASSES (RE_BK_PLUS_QM << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then ^ and $ are always anchors (outside bracket
|
||||||
|
expressions, of course).
|
||||||
|
If this bit is not set, then it depends:
|
||||||
|
^ is an anchor if it is at the beginning of a regular
|
||||||
|
expression or after an open-group or an alternation operator;
|
||||||
|
$ is an anchor if it is at the end of a regular expression, or
|
||||||
|
before a close-group or an alternation operator.
|
||||||
|
|
||||||
|
This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
|
||||||
|
POSIX draft 11.2 says that * etc. in leading positions is undefined.
|
||||||
|
We already implemented a previous draft which made those constructs
|
||||||
|
invalid, though, so we haven't changed the code back. */
|
||||||
|
# define RE_CONTEXT_INDEP_ANCHORS (RE_CHAR_CLASSES << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then special characters are always special
|
||||||
|
regardless of where they are in the pattern.
|
||||||
|
If this bit is not set, then special characters are special only in
|
||||||
|
some contexts; otherwise they are ordinary. Specifically,
|
||||||
|
* + ? and intervals are only special when not after the beginning,
|
||||||
|
open-group, or alternation operator. */
|
||||||
|
# define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then *, +, ?, and { cannot be first in an re or
|
||||||
|
immediately after an alternation or begin-group operator. */
|
||||||
|
# define RE_CONTEXT_INVALID_OPS (RE_CONTEXT_INDEP_OPS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then . matches newline.
|
||||||
|
If not set, then it doesn't. */
|
||||||
|
# define RE_DOT_NEWLINE (RE_CONTEXT_INVALID_OPS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then . doesn't match NUL.
|
||||||
|
If not set, then it does. */
|
||||||
|
# define RE_DOT_NOT_NULL (RE_DOT_NEWLINE << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, nonmatching lists [^...] do not match newline.
|
||||||
|
If not set, they do. */
|
||||||
|
# define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, either \{...\} or {...} defines an
|
||||||
|
interval, depending on RE_NO_BK_BRACES.
|
||||||
|
If not set, \{, \}, {, and } are literals. */
|
||||||
|
# define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, +, ? and | aren't recognized as operators.
|
||||||
|
If not set, they are. */
|
||||||
|
# define RE_LIMITED_OPS (RE_INTERVALS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, newline is an alternation operator.
|
||||||
|
If not set, newline is literal. */
|
||||||
|
# define RE_NEWLINE_ALT (RE_LIMITED_OPS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then '{...}' defines an interval, and \{ and \}
|
||||||
|
are literals.
|
||||||
|
If not set, then '\{...\}' defines an interval. */
|
||||||
|
# define RE_NO_BK_BRACES (RE_NEWLINE_ALT << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, (...) defines a group, and \( and \) are literals.
|
||||||
|
If not set, \(...\) defines a group, and ( and ) are literals. */
|
||||||
|
# define RE_NO_BK_PARENS (RE_NO_BK_BRACES << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then \<digit> matches <digit>.
|
||||||
|
If not set, then \<digit> is a back-reference. */
|
||||||
|
# define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then | is an alternation operator, and \| is literal.
|
||||||
|
If not set, then \| is an alternation operator, and | is literal. */
|
||||||
|
# define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then an ending range point collating higher
|
||||||
|
than the starting range point, as in [z-a], is invalid.
|
||||||
|
If not set, then when ending range point collates higher than the
|
||||||
|
starting range point, the range is ignored. */
|
||||||
|
# define RE_NO_EMPTY_RANGES (RE_NO_BK_VBAR << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then an unmatched ) is ordinary.
|
||||||
|
If not set, then an unmatched ) is invalid. */
|
||||||
|
# define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, succeed as soon as we match the whole pattern,
|
||||||
|
without further backtracking. */
|
||||||
|
# define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, do not process the GNU regex operators.
|
||||||
|
If not set, then the GNU regex operators are recognized. */
|
||||||
|
# define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, turn on internal regex debugging.
|
||||||
|
If not set, and debugging was on, turn it off.
|
||||||
|
This only works if regex.c is compiled -DDEBUG.
|
||||||
|
We define this bit always, so that all that's needed to turn on
|
||||||
|
debugging is to recompile regex.c; the calling code can always have
|
||||||
|
this bit set, and it won't affect anything in the normal case. */
|
||||||
|
# define RE_DEBUG (RE_NO_GNU_OPS << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, a syntactically invalid interval is treated as
|
||||||
|
a string of ordinary characters. For example, the ERE 'a{1' is
|
||||||
|
treated as 'a\{1'. */
|
||||||
|
# define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then ignore case when matching.
|
||||||
|
If not set, then case is significant. */
|
||||||
|
# define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
|
||||||
|
|
||||||
|
/* This bit is used internally like RE_CONTEXT_INDEP_ANCHORS but only
|
||||||
|
for ^, because it is difficult to scan the regex backwards to find
|
||||||
|
whether ^ should be special. */
|
||||||
|
# define RE_CARET_ANCHORS_HERE (RE_ICASE << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then \{ cannot be first in a regex or
|
||||||
|
immediately after an alternation, open-group or \} operator. */
|
||||||
|
# define RE_CONTEXT_INVALID_DUP (RE_CARET_ANCHORS_HERE << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then no_sub will be set to 1 during
|
||||||
|
re_compile_pattern. */
|
||||||
|
# define RE_NO_SUB (RE_CONTEXT_INVALID_DUP << 1)
|
||||||
|
|
||||||
|
#endif /* defined __USE_GNU_REGEX */
|
||||||
|
|
||||||
|
/* This global variable defines the particular regexp syntax to use (for
|
||||||
|
some interfaces). When a regexp is compiled, the syntax used is
|
||||||
|
stored in the pattern buffer, so changing this does not affect
|
||||||
|
already-compiled regexps. */
|
||||||
|
extern reg_syntax_t re_syntax_options;
|
||||||
|
|
||||||
|
#ifdef __USE_GNU_REGEX
|
||||||
|
/* Define combinations of the above bits for the standard possibilities.
|
||||||
|
(The [[[ comments delimit what gets put into the Texinfo file, so
|
||||||
|
don't delete them!) */
|
||||||
|
/* [[[begin syntaxes]]] */
|
||||||
|
# define RE_SYNTAX_EMACS 0
|
||||||
|
|
||||||
|
# define RE_SYNTAX_AWK \
|
||||||
|
(RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL \
|
||||||
|
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||||
|
| RE_NO_BK_VBAR | RE_NO_EMPTY_RANGES \
|
||||||
|
| RE_DOT_NEWLINE | RE_CONTEXT_INDEP_ANCHORS \
|
||||||
|
| RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
|
||||||
|
|
||||||
|
# define RE_SYNTAX_GNU_AWK \
|
||||||
|
((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
|
||||||
|
& ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS \
|
||||||
|
| RE_CONTEXT_INVALID_OPS ))
|
||||||
|
|
||||||
|
# define RE_SYNTAX_POSIX_AWK \
|
||||||
|
(RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS \
|
||||||
|
| RE_INTERVALS | RE_NO_GNU_OPS)
|
||||||
|
|
||||||
|
# define RE_SYNTAX_GREP \
|
||||||
|
(RE_BK_PLUS_QM | RE_CHAR_CLASSES \
|
||||||
|
| RE_HAT_LISTS_NOT_NEWLINE | RE_INTERVALS \
|
||||||
|
| RE_NEWLINE_ALT)
|
||||||
|
|
||||||
|
# define RE_SYNTAX_EGREP \
|
||||||
|
(RE_CHAR_CLASSES | RE_CONTEXT_INDEP_ANCHORS \
|
||||||
|
| RE_CONTEXT_INDEP_OPS | RE_HAT_LISTS_NOT_NEWLINE \
|
||||||
|
| RE_NEWLINE_ALT | RE_NO_BK_PARENS \
|
||||||
|
| RE_NO_BK_VBAR)
|
||||||
|
|
||||||
|
# define RE_SYNTAX_POSIX_EGREP \
|
||||||
|
(RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES \
|
||||||
|
| RE_INVALID_INTERVAL_ORD)
|
||||||
|
|
||||||
|
/* P1003.2/D11.2, section 4.20.7.1, lines 5078ff. */
|
||||||
|
# define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
|
||||||
|
|
||||||
|
# define RE_SYNTAX_SED RE_SYNTAX_POSIX_BASIC
|
||||||
|
|
||||||
|
/* Syntax bits common to both basic and extended POSIX regex syntax. */
|
||||||
|
# define _RE_SYNTAX_POSIX_COMMON \
|
||||||
|
(RE_CHAR_CLASSES | RE_DOT_NEWLINE | RE_DOT_NOT_NULL \
|
||||||
|
| RE_INTERVALS | RE_NO_EMPTY_RANGES)
|
||||||
|
|
||||||
|
# define RE_SYNTAX_POSIX_BASIC \
|
||||||
|
(_RE_SYNTAX_POSIX_COMMON | RE_BK_PLUS_QM | RE_CONTEXT_INVALID_DUP)
|
||||||
|
|
||||||
|
/* Differs from ..._POSIX_BASIC only in that RE_BK_PLUS_QM becomes
|
||||||
|
RE_LIMITED_OPS, i.e., \? \+ \| are not recognized. Actually, this
|
||||||
|
isn't minimal, since other operators, such as \`, aren't disabled. */
|
||||||
|
# define RE_SYNTAX_POSIX_MINIMAL_BASIC \
|
||||||
|
(_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
|
||||||
|
|
||||||
|
# define RE_SYNTAX_POSIX_EXTENDED \
|
||||||
|
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||||
|
| RE_CONTEXT_INDEP_OPS | RE_NO_BK_BRACES \
|
||||||
|
| RE_NO_BK_PARENS | RE_NO_BK_VBAR \
|
||||||
|
| RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||||
|
|
||||||
|
/* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
|
||||||
|
removed and RE_NO_BK_REFS is added. */
|
||||||
|
# define RE_SYNTAX_POSIX_MINIMAL_EXTENDED \
|
||||||
|
(_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS \
|
||||||
|
| RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES \
|
||||||
|
| RE_NO_BK_PARENS | RE_NO_BK_REFS \
|
||||||
|
| RE_NO_BK_VBAR | RE_UNMATCHED_RIGHT_PAREN_ORD)
|
||||||
|
/* [[[end syntaxes]]] */
|
||||||
|
|
||||||
|
#endif /* defined __USE_GNU_REGEX */
|
||||||
|
|
||||||
|
#ifdef __USE_GNU_REGEX
|
||||||
|
|
||||||
|
/* Maximum number of duplicates an interval can allow. POSIX-conforming
|
||||||
|
systems might define this in <limits.h>, but we want our
|
||||||
|
value, so remove any previous define. */
|
||||||
|
# ifdef RE_DUP_MAX
|
||||||
|
# undef RE_DUP_MAX
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* RE_DUP_MAX is 2**15 - 1 because an earlier implementation stored
|
||||||
|
the counter as a 2-byte signed integer. This is no longer true, so
|
||||||
|
RE_DUP_MAX could be increased to (INT_MAX / 10 - 1), or to
|
||||||
|
((SIZE_MAX - 2) / 10 - 1) if _REGEX_LARGE_OFFSETS is defined.
|
||||||
|
However, there would be a huge performance problem if someone
|
||||||
|
actually used a pattern like a\{214748363\}, so RE_DUP_MAX retains
|
||||||
|
its historical value. */
|
||||||
|
# define RE_DUP_MAX (0x7fff)
|
||||||
|
|
||||||
|
#endif /* defined __USE_GNU_REGEX */
|
||||||
|
|
||||||
|
|
||||||
|
/* POSIX 'cflags' bits (i.e., information for 'regcomp'). */
|
||||||
|
|
||||||
|
/* If this bit is set, then use extended regular expression syntax.
|
||||||
|
If not set, then use basic regular expression syntax. */
|
||||||
|
#define REG_EXTENDED 1
|
||||||
|
|
||||||
|
/* If this bit is set, then ignore case when matching.
|
||||||
|
If not set, then case is significant. */
|
||||||
|
#define REG_ICASE (1 << 1)
|
||||||
|
|
||||||
|
/* If this bit is set, then anchors do not match at newline
|
||||||
|
characters in the string.
|
||||||
|
If not set, then anchors do match at newlines. */
|
||||||
|
#define REG_NEWLINE (1 << 2)
|
||||||
|
|
||||||
|
/* If this bit is set, then report only success or fail in regexec.
|
||||||
|
If not set, then returns differ between not matching and errors. */
|
||||||
|
#define REG_NOSUB (1 << 3)
|
||||||
|
|
||||||
|
|
||||||
|
/* POSIX 'eflags' bits (i.e., information for regexec). */
|
||||||
|
|
||||||
|
/* If this bit is set, then the beginning-of-line operator doesn't match
|
||||||
|
the beginning of the string (presumably because it's not the
|
||||||
|
beginning of a line).
|
||||||
|
If not set, then the beginning-of-line operator does match the
|
||||||
|
beginning of the string. */
|
||||||
|
#define REG_NOTBOL 1
|
||||||
|
|
||||||
|
/* Like REG_NOTBOL, except for the end-of-line. */
|
||||||
|
#define REG_NOTEOL (1 << 1)
|
||||||
|
|
||||||
|
/* Use PMATCH[0] to delimit the start and end of the search in the
|
||||||
|
buffer. */
|
||||||
|
#define REG_STARTEND (1 << 2)
|
||||||
|
|
||||||
|
|
||||||
|
/* If any error codes are removed, changed, or added, update the
|
||||||
|
'__re_error_msgid' table in regcomp.c. */
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
_REG_ENOSYS = -1, /* This will never happen for this implementation. */
|
||||||
|
_REG_NOERROR = 0, /* Success. */
|
||||||
|
_REG_NOMATCH, /* Didn't find a match (for regexec). */
|
||||||
|
|
||||||
|
/* POSIX regcomp return error codes. (In the order listed in the
|
||||||
|
standard.) */
|
||||||
|
_REG_BADPAT, /* Invalid pattern. */
|
||||||
|
_REG_ECOLLATE, /* Invalid collating element. */
|
||||||
|
_REG_ECTYPE, /* Invalid character class name. */
|
||||||
|
_REG_EESCAPE, /* Trailing backslash. */
|
||||||
|
_REG_ESUBREG, /* Invalid back reference. */
|
||||||
|
_REG_EBRACK, /* Unmatched left bracket. */
|
||||||
|
_REG_EPAREN, /* Parenthesis imbalance. */
|
||||||
|
_REG_EBRACE, /* Unmatched \{. */
|
||||||
|
_REG_BADBR, /* Invalid contents of \{\}. */
|
||||||
|
_REG_ERANGE, /* Invalid range end. */
|
||||||
|
_REG_ESPACE, /* Ran out of memory. */
|
||||||
|
_REG_BADRPT, /* No preceding re for repetition op. */
|
||||||
|
|
||||||
|
/* Error codes we've added. */
|
||||||
|
_REG_EEND, /* Premature end. */
|
||||||
|
_REG_ESIZE, /* Compiled pattern bigger than 2^16 bytes. */
|
||||||
|
_REG_ERPAREN /* Unmatched ) or \); not returned from regcomp. */
|
||||||
|
} reg_errcode_t;
|
||||||
|
|
||||||
|
#ifdef _XOPEN_SOURCE
|
||||||
|
# define REG_ENOSYS _REG_ENOSYS
|
||||||
|
#endif
|
||||||
|
#define REG_NOERROR _REG_NOERROR
|
||||||
|
#define REG_NOMATCH _REG_NOMATCH
|
||||||
|
#define REG_BADPAT _REG_BADPAT
|
||||||
|
#define REG_ECOLLATE _REG_ECOLLATE
|
||||||
|
#define REG_ECTYPE _REG_ECTYPE
|
||||||
|
#define REG_EESCAPE _REG_EESCAPE
|
||||||
|
#define REG_ESUBREG _REG_ESUBREG
|
||||||
|
#define REG_EBRACK _REG_EBRACK
|
||||||
|
#define REG_EPAREN _REG_EPAREN
|
||||||
|
#define REG_EBRACE _REG_EBRACE
|
||||||
|
#define REG_BADBR _REG_BADBR
|
||||||
|
#define REG_ERANGE _REG_ERANGE
|
||||||
|
#define REG_ESPACE _REG_ESPACE
|
||||||
|
#define REG_BADRPT _REG_BADRPT
|
||||||
|
#define REG_EEND _REG_EEND
|
||||||
|
#define REG_ESIZE _REG_ESIZE
|
||||||
|
#define REG_ERPAREN _REG_ERPAREN
|
||||||
|
|
||||||
|
/* struct re_pattern_buffer normally uses member names like 'buffer'
|
||||||
|
that POSIX does not allow. In POSIX mode these members have names
|
||||||
|
with leading 're_' (e.g., 're_buffer'). */
|
||||||
|
#ifdef __USE_GNU_REGEX
|
||||||
|
# define _REG_RE_NAME(id) id
|
||||||
|
# define _REG_RM_NAME(id) id
|
||||||
|
#else
|
||||||
|
# define _REG_RE_NAME(id) re_##id
|
||||||
|
# define _REG_RM_NAME(id) rm_##id
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The user can specify the type of the re_translate member by
|
||||||
|
defining the macro RE_TRANSLATE_TYPE, which defaults to unsigned
|
||||||
|
char *. This pollutes the POSIX name space, so in POSIX mode just
|
||||||
|
use unsigned char *. */
|
||||||
|
#ifdef __USE_GNU_REGEX
|
||||||
|
# ifndef RE_TRANSLATE_TYPE
|
||||||
|
# define RE_TRANSLATE_TYPE unsigned char *
|
||||||
|
# endif
|
||||||
|
# define REG_TRANSLATE_TYPE RE_TRANSLATE_TYPE
|
||||||
|
#else
|
||||||
|
# define REG_TRANSLATE_TYPE unsigned char *
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This data structure represents a compiled pattern. Before calling
|
||||||
|
the pattern compiler, the fields 'buffer', 'allocated', 'fastmap',
|
||||||
|
'translate', and 'no_sub' can be set. After the pattern has been
|
||||||
|
compiled, the 're_nsub' field is available. All other fields are
|
||||||
|
private to the regex routines. */
|
||||||
|
|
||||||
|
struct re_pattern_buffer
|
||||||
|
{
|
||||||
|
/* Space that holds the compiled pattern. It is declared as
|
||||||
|
'unsigned char *' because its elements are sometimes used as
|
||||||
|
array indexes. */
|
||||||
|
unsigned char *_REG_RE_NAME (buffer);
|
||||||
|
|
||||||
|
/* Number of bytes to which 'buffer' points. */
|
||||||
|
__re_long_size_t _REG_RE_NAME (allocated);
|
||||||
|
|
||||||
|
/* Number of bytes actually used in 'buffer'. */
|
||||||
|
__re_long_size_t _REG_RE_NAME (used);
|
||||||
|
|
||||||
|
/* Syntax setting with which the pattern was compiled. */
|
||||||
|
reg_syntax_t _REG_RE_NAME (syntax);
|
||||||
|
|
||||||
|
/* Pointer to a fastmap, if any, otherwise zero. re_search uses the
|
||||||
|
fastmap, if there is one, to skip over impossible starting points
|
||||||
|
for matches. */
|
||||||
|
char *_REG_RE_NAME (fastmap);
|
||||||
|
|
||||||
|
/* Either a translate table to apply to all characters before
|
||||||
|
comparing them, or zero for no translation. The translation is
|
||||||
|
applied to a pattern when it is compiled and to a string when it
|
||||||
|
is matched. */
|
||||||
|
REG_TRANSLATE_TYPE _REG_RE_NAME (translate);
|
||||||
|
|
||||||
|
/* Number of subexpressions found by the compiler. */
|
||||||
|
size_t re_nsub;
|
||||||
|
|
||||||
|
/* Zero if this pattern cannot match the empty string, one else.
|
||||||
|
Well, in truth it's used only in 're_search_2', to see whether or
|
||||||
|
not we should use the fastmap, so we don't set this absolutely
|
||||||
|
perfectly; see 're_compile_fastmap' (the "duplicate" case). */
|
||||||
|
unsigned int _REG_RE_NAME (can_be_null) : 1;
|
||||||
|
|
||||||
|
/* If REGS_UNALLOCATED, allocate space in the 'regs' structure
|
||||||
|
for 'max (RE_NREGS, re_nsub + 1)' groups.
|
||||||
|
If REGS_REALLOCATE, reallocate space if necessary.
|
||||||
|
If REGS_FIXED, use what's there. */
|
||||||
|
#ifdef __USE_GNU_REGEX
|
||||||
|
# define REGS_UNALLOCATED 0
|
||||||
|
# define REGS_REALLOCATE 1
|
||||||
|
# define REGS_FIXED 2
|
||||||
|
#endif
|
||||||
|
unsigned int _REG_RE_NAME (regs_allocated) : 2;
|
||||||
|
|
||||||
|
/* Set to zero when 're_compile_pattern' compiles a pattern; set to
|
||||||
|
one by 're_compile_fastmap' if it updates the fastmap. */
|
||||||
|
unsigned int _REG_RE_NAME (fastmap_accurate) : 1;
|
||||||
|
|
||||||
|
/* If set, 're_match_2' does not return information about
|
||||||
|
subexpressions. */
|
||||||
|
unsigned int _REG_RE_NAME (no_sub) : 1;
|
||||||
|
|
||||||
|
/* If set, a beginning-of-line anchor doesn't match at the beginning
|
||||||
|
of the string. */
|
||||||
|
unsigned int _REG_RE_NAME (not_bol) : 1;
|
||||||
|
|
||||||
|
/* Similarly for an end-of-line anchor. */
|
||||||
|
unsigned int _REG_RE_NAME (not_eol) : 1;
|
||||||
|
|
||||||
|
/* If true, an anchor at a newline matches. */
|
||||||
|
unsigned int _REG_RE_NAME (newline_anchor) : 1;
|
||||||
|
|
||||||
|
/* [[[end pattern_buffer]]] */
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct re_pattern_buffer regex_t;
|
||||||
|
|
||||||
|
/* This is the structure we store register match data in. See
|
||||||
|
regex.texinfo for a full description of what registers match. */
|
||||||
|
struct re_registers
|
||||||
|
{
|
||||||
|
__re_size_t _REG_RM_NAME (num_regs);
|
||||||
|
regoff_t *_REG_RM_NAME (start);
|
||||||
|
regoff_t *_REG_RM_NAME (end);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* If 'regs_allocated' is REGS_UNALLOCATED in the pattern buffer,
|
||||||
|
're_match_2' returns information about at least this many registers
|
||||||
|
the first time a 'regs' structure is passed. */
|
||||||
|
#if !defined RE_NREGS && defined __USE_GNU_REGEX
|
||||||
|
# define RE_NREGS 30
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* POSIX specification for registers. Aside from the different names than
|
||||||
|
're_registers', POSIX uses an array of structures, instead of a
|
||||||
|
structure of arrays. */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
regoff_t rm_so; /* Byte offset from string's start to substring's start. */
|
||||||
|
regoff_t rm_eo; /* Byte offset from string's start to substring's end. */
|
||||||
|
} regmatch_t;
|
||||||
|
|
||||||
|
/* Declarations for routines. */
|
||||||
|
|
||||||
|
/* Sets the current default syntax to SYNTAX, and return the old syntax.
|
||||||
|
You can also simply assign to the 're_syntax_options' variable. */
|
||||||
|
extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
|
||||||
|
|
||||||
|
/* Compile the regular expression PATTERN, with length LENGTH
|
||||||
|
and syntax given by the global 're_syntax_options', into the buffer
|
||||||
|
BUFFER. Return NULL if successful, and an error string if not. */
|
||||||
|
extern const char *re_compile_pattern (const char *__pattern, size_t __length,
|
||||||
|
struct re_pattern_buffer *__buffer);
|
||||||
|
|
||||||
|
|
||||||
|
/* Compile a fastmap for the compiled pattern in BUFFER; used to
|
||||||
|
accelerate searches. Return 0 if successful and -2 if was an
|
||||||
|
internal error. */
|
||||||
|
extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
|
||||||
|
|
||||||
|
|
||||||
|
/* Search in the string STRING (with length LENGTH) for the pattern
|
||||||
|
compiled into BUFFER. Start searching at position START, for RANGE
|
||||||
|
characters. Return the starting position of the match, -1 for no
|
||||||
|
match, or -2 for an internal error. Also return register
|
||||||
|
information in REGS (if REGS and BUFFER->no_sub are nonzero). */
|
||||||
|
extern regoff_t re_search (struct re_pattern_buffer *__buffer,
|
||||||
|
const char *__string, __re_idx_t __length,
|
||||||
|
__re_idx_t __start, regoff_t __range,
|
||||||
|
struct re_registers *__regs);
|
||||||
|
|
||||||
|
|
||||||
|
/* Like 're_search', but search in the concatenation of STRING1 and
|
||||||
|
STRING2. Also, stop searching at index START + STOP. */
|
||||||
|
extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
|
||||||
|
const char *__string1, __re_idx_t __length1,
|
||||||
|
const char *__string2, __re_idx_t __length2,
|
||||||
|
__re_idx_t __start, regoff_t __range,
|
||||||
|
struct re_registers *__regs,
|
||||||
|
__re_idx_t __stop);
|
||||||
|
|
||||||
|
|
||||||
|
/* Like 're_search', but return how many characters in STRING the regexp
|
||||||
|
in BUFFER matched, starting at position START. */
|
||||||
|
extern regoff_t re_match (struct re_pattern_buffer *__buffer,
|
||||||
|
const char *__string, __re_idx_t __length,
|
||||||
|
__re_idx_t __start, struct re_registers *__regs);
|
||||||
|
|
||||||
|
|
||||||
|
/* Relates to 're_match' as 're_search_2' relates to 're_search'. */
|
||||||
|
extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
|
||||||
|
const char *__string1, __re_idx_t __length1,
|
||||||
|
const char *__string2, __re_idx_t __length2,
|
||||||
|
__re_idx_t __start, struct re_registers *__regs,
|
||||||
|
__re_idx_t __stop);
|
||||||
|
|
||||||
|
|
||||||
|
/* Set REGS to hold NUM_REGS registers, storing them in STARTS and
|
||||||
|
ENDS. Subsequent matches using BUFFER and REGS will use this memory
|
||||||
|
for recording register information. STARTS and ENDS must be
|
||||||
|
allocated with malloc, and must each be at least 'NUM_REGS * sizeof
|
||||||
|
(regoff_t)' bytes long.
|
||||||
|
|
||||||
|
If NUM_REGS == 0, then subsequent matches should allocate their own
|
||||||
|
register data.
|
||||||
|
|
||||||
|
Unless this function is called, the first search or match using
|
||||||
|
BUFFER will allocate its own register data, without freeing the old
|
||||||
|
data. */
|
||||||
|
extern void re_set_registers (struct re_pattern_buffer *__buffer,
|
||||||
|
struct re_registers *__regs,
|
||||||
|
__re_size_t __num_regs,
|
||||||
|
regoff_t *__starts, regoff_t *__ends);
|
||||||
|
|
||||||
|
#if defined _REGEX_RE_COMP || defined _LIBC
|
||||||
|
# ifndef _CRAY
|
||||||
|
/* 4.2 bsd compatibility. */
|
||||||
|
extern char *re_comp (const char *);
|
||||||
|
extern int re_exec (const char *);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* GCC 2.95 and later have "__restrict"; C99 compilers have
|
||||||
|
"restrict", and "configure" may have defined "restrict".
|
||||||
|
Other compilers use __restrict, __restrict__, and _Restrict, and
|
||||||
|
'configure' might #define 'restrict' to those words, so pick a
|
||||||
|
different name. */
|
||||||
|
#ifndef _Restrict_
|
||||||
|
# if 199901L <= __STDC_VERSION__
|
||||||
|
# define _Restrict_ restrict
|
||||||
|
# elif 2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__)
|
||||||
|
# define _Restrict_ __restrict
|
||||||
|
# else
|
||||||
|
# define _Restrict_
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
/* gcc 3.1 and up support the [restrict] syntax. Don't trust
|
||||||
|
sys/cdefs.h's definition of __restrict_arr, though, as it
|
||||||
|
mishandles gcc -ansi -pedantic. */
|
||||||
|
#ifndef _Restrict_arr_
|
||||||
|
# if ((199901L <= __STDC_VERSION__ \
|
||||||
|
|| ((3 < __GNUC__ || (3 == __GNUC__ && 1 <= __GNUC_MINOR__)) \
|
||||||
|
&& !defined __STRICT_ANSI__)) \
|
||||||
|
&& !defined __GNUG__)
|
||||||
|
# define _Restrict_arr_ _Restrict_
|
||||||
|
# else
|
||||||
|
# define _Restrict_arr_
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* POSIX compatibility. */
|
||||||
|
extern int regcomp (regex_t *_Restrict_ __preg,
|
||||||
|
const char *_Restrict_ __pattern,
|
||||||
|
int __cflags);
|
||||||
|
|
||||||
|
extern int regexec (const regex_t *_Restrict_ __preg,
|
||||||
|
const char *_Restrict_ __string, size_t __nmatch,
|
||||||
|
regmatch_t __pmatch[_Restrict_arr_],
|
||||||
|
int __eflags);
|
||||||
|
|
||||||
|
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
|
||||||
|
char *_Restrict_ __errbuf, size_t __errbuf_size);
|
||||||
|
|
||||||
|
extern void regfree (regex_t *__preg);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* C++ */
|
||||||
|
|
||||||
|
#endif /* regex.h */
|
1741
lib/regex_internal.c
Normal file
1741
lib/regex_internal.c
Normal file
File diff suppressed because it is too large
Load diff
866
lib/regex_internal.h
Normal file
866
lib/regex_internal.h
Normal file
|
@ -0,0 +1,866 @@
|
||||||
|
/* Extended regular expression matching and search library.
|
||||||
|
Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
||||||
|
This file is part of the GNU C Library.
|
||||||
|
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#ifndef _REGEX_INTERNAL_H
|
||||||
|
#define _REGEX_INTERNAL_H 1
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <langinfo.h>
|
||||||
|
#ifndef _LIBC
|
||||||
|
# include "localcharset.h"
|
||||||
|
#endif
|
||||||
|
#include <locale.h>
|
||||||
|
|
||||||
|
#include <wchar.h>
|
||||||
|
#include <wctype.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#if defined _LIBC
|
||||||
|
# include <bits/libc-lock.h>
|
||||||
|
#else
|
||||||
|
# define __libc_lock_init(NAME) do { } while (0)
|
||||||
|
# define __libc_lock_lock(NAME) do { } while (0)
|
||||||
|
# define __libc_lock_unlock(NAME) do { } while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* In case that the system doesn't have isblank(). */
|
||||||
|
#if !defined _LIBC && ! (defined isblank || (HAVE_ISBLANK && HAVE_DECL_ISBLANK))
|
||||||
|
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _LIBC
|
||||||
|
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
|
||||||
|
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
|
||||||
|
# include <locale/localeinfo.h>
|
||||||
|
# include <locale/elem-hash.h>
|
||||||
|
# include <locale/coll-lookup.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is for other GNU distributions with internationalized messages. */
|
||||||
|
#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
|
||||||
|
# include <libintl.h>
|
||||||
|
# ifdef _LIBC
|
||||||
|
# undef gettext
|
||||||
|
# define gettext(msgid) \
|
||||||
|
INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES)
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define gettext(msgid) (msgid)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef gettext_noop
|
||||||
|
/* This define is so xgettext can find the internationalizable
|
||||||
|
strings. */
|
||||||
|
# define gettext_noop(String) String
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* For loser systems without the definition. */
|
||||||
|
#ifndef SIZE_MAX
|
||||||
|
# define SIZE_MAX ((size_t) -1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE && HAVE_WCSCOLL) || _LIBC
|
||||||
|
# define RE_ENABLE_I18N
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC__ >= 3
|
||||||
|
# define BE(expr, val) __builtin_expect (expr, val)
|
||||||
|
#else
|
||||||
|
# define BE(expr, val) (expr)
|
||||||
|
# ifdef _LIBC
|
||||||
|
# define inline
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Number of ASCII characters. */
|
||||||
|
#define ASCII_CHARS 0x80
|
||||||
|
|
||||||
|
/* Number of single byte characters. */
|
||||||
|
#define SBC_MAX (UCHAR_MAX + 1)
|
||||||
|
|
||||||
|
#define COLL_ELEM_LEN_MAX 8
|
||||||
|
|
||||||
|
/* The character which represents newline. */
|
||||||
|
#define NEWLINE_CHAR '\n'
|
||||||
|
#define WIDE_NEWLINE_CHAR L'\n'
|
||||||
|
|
||||||
|
/* Rename to standard API for using out of glibc. */
|
||||||
|
#ifndef _LIBC
|
||||||
|
# define __wctype wctype
|
||||||
|
# define __iswctype iswctype
|
||||||
|
# define __btowc btowc
|
||||||
|
# define __wcrtomb wcrtomb
|
||||||
|
# define __mbrtowc mbrtowc
|
||||||
|
# define __regfree regfree
|
||||||
|
# define attribute_hidden
|
||||||
|
#endif /* not _LIBC */
|
||||||
|
|
||||||
|
#if __GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
|
||||||
|
# define __attribute(arg) __attribute__ (arg)
|
||||||
|
#else
|
||||||
|
# define __attribute(arg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef __re_idx_t Idx;
|
||||||
|
|
||||||
|
/* Special return value for failure to match. */
|
||||||
|
#define REG_MISSING ((Idx) -1)
|
||||||
|
|
||||||
|
/* Special return value for internal error. */
|
||||||
|
#define REG_ERROR ((Idx) -2)
|
||||||
|
|
||||||
|
/* Test whether N is a valid index, and is not one of the above. */
|
||||||
|
#ifdef _REGEX_LARGE_OFFSETS
|
||||||
|
# define REG_VALID_INDEX(n) ((Idx) (n) < REG_ERROR)
|
||||||
|
#else
|
||||||
|
# define REG_VALID_INDEX(n) (0 <= (n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Test whether N is a valid nonzero index. */
|
||||||
|
#ifdef _REGEX_LARGE_OFFSETS
|
||||||
|
# define REG_VALID_NONZERO_INDEX(n) ((Idx) ((n) - 1) < (Idx) (REG_ERROR - 1))
|
||||||
|
#else
|
||||||
|
# define REG_VALID_NONZERO_INDEX(n) (0 < (n))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* A hash value, suitable for computing hash tables. */
|
||||||
|
typedef __re_size_t re_hashval_t;
|
||||||
|
|
||||||
|
/* An integer used to represent a set of bits. It must be unsigned,
|
||||||
|
and must be at least as wide as unsigned int. */
|
||||||
|
typedef unsigned long int bitset_word_t;
|
||||||
|
/* All bits set in a bitset_word_t. */
|
||||||
|
#define BITSET_WORD_MAX ULONG_MAX
|
||||||
|
|
||||||
|
/* Number of bits in a bitset_word_t. For portability to hosts with
|
||||||
|
padding bits, do not use '(sizeof (bitset_word_t) * CHAR_BIT)';
|
||||||
|
instead, deduce it directly from BITSET_WORD_MAX. Avoid
|
||||||
|
greater-than-32-bit integers and unconditional shifts by more than
|
||||||
|
31 bits, as they're not portable. */
|
||||||
|
#if BITSET_WORD_MAX == 0xffffffffUL
|
||||||
|
# define BITSET_WORD_BITS 32
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 4 == 1
|
||||||
|
# define BITSET_WORD_BITS 36
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 16 == 1
|
||||||
|
# define BITSET_WORD_BITS 48
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 28 == 1
|
||||||
|
# define BITSET_WORD_BITS 60
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 31 >> 1 == 1
|
||||||
|
# define BITSET_WORD_BITS 64
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 31 >> 9 == 1
|
||||||
|
# define BITSET_WORD_BITS 72
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 3 == 1
|
||||||
|
# define BITSET_WORD_BITS 128
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 == 1
|
||||||
|
# define BITSET_WORD_BITS 256
|
||||||
|
#elif BITSET_WORD_MAX >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 31 >> 7 > 1
|
||||||
|
# define BITSET_WORD_BITS 257 /* any value > SBC_MAX will do here */
|
||||||
|
# if BITSET_WORD_BITS <= SBC_MAX
|
||||||
|
# error "Invalid SBC_MAX"
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# error "Add case for new bitset_word_t size"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Number of bitset_word_t values in a bitset_t. */
|
||||||
|
#define BITSET_WORDS ((SBC_MAX + BITSET_WORD_BITS - 1) / BITSET_WORD_BITS)
|
||||||
|
|
||||||
|
typedef bitset_word_t bitset_t[BITSET_WORDS];
|
||||||
|
typedef bitset_word_t *re_bitset_ptr_t;
|
||||||
|
typedef const bitset_word_t *re_const_bitset_ptr_t;
|
||||||
|
|
||||||
|
#define PREV_WORD_CONSTRAINT 0x0001
|
||||||
|
#define PREV_NOTWORD_CONSTRAINT 0x0002
|
||||||
|
#define NEXT_WORD_CONSTRAINT 0x0004
|
||||||
|
#define NEXT_NOTWORD_CONSTRAINT 0x0008
|
||||||
|
#define PREV_NEWLINE_CONSTRAINT 0x0010
|
||||||
|
#define NEXT_NEWLINE_CONSTRAINT 0x0020
|
||||||
|
#define PREV_BEGBUF_CONSTRAINT 0x0040
|
||||||
|
#define NEXT_ENDBUF_CONSTRAINT 0x0080
|
||||||
|
#define WORD_DELIM_CONSTRAINT 0x0100
|
||||||
|
#define NOT_WORD_DELIM_CONSTRAINT 0x0200
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
|
||||||
|
WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
|
||||||
|
WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
|
||||||
|
INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
|
||||||
|
LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
|
||||||
|
LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
|
||||||
|
BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
|
||||||
|
BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
|
||||||
|
WORD_DELIM = WORD_DELIM_CONSTRAINT,
|
||||||
|
NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT
|
||||||
|
} re_context_type;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Idx alloc;
|
||||||
|
Idx nelem;
|
||||||
|
Idx *elems;
|
||||||
|
} re_node_set;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
NON_TYPE = 0,
|
||||||
|
|
||||||
|
/* Node type, These are used by token, node, tree. */
|
||||||
|
CHARACTER = 1,
|
||||||
|
END_OF_RE = 2,
|
||||||
|
SIMPLE_BRACKET = 3,
|
||||||
|
OP_BACK_REF = 4,
|
||||||
|
OP_PERIOD = 5,
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
COMPLEX_BRACKET = 6,
|
||||||
|
OP_UTF8_PERIOD = 7,
|
||||||
|
#endif /* RE_ENABLE_I18N */
|
||||||
|
|
||||||
|
/* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
|
||||||
|
when the debugger shows values of this enum type. */
|
||||||
|
#define EPSILON_BIT 8
|
||||||
|
OP_OPEN_SUBEXP = EPSILON_BIT | 0,
|
||||||
|
OP_CLOSE_SUBEXP = EPSILON_BIT | 1,
|
||||||
|
OP_ALT = EPSILON_BIT | 2,
|
||||||
|
OP_DUP_ASTERISK = EPSILON_BIT | 3,
|
||||||
|
ANCHOR = EPSILON_BIT | 4,
|
||||||
|
|
||||||
|
/* Tree type, these are used only by tree. */
|
||||||
|
CONCAT = 16,
|
||||||
|
SUBEXP = 17,
|
||||||
|
|
||||||
|
/* Token type, these are used only by token. */
|
||||||
|
OP_DUP_PLUS = 18,
|
||||||
|
OP_DUP_QUESTION,
|
||||||
|
OP_OPEN_BRACKET,
|
||||||
|
OP_CLOSE_BRACKET,
|
||||||
|
OP_CHARSET_RANGE,
|
||||||
|
OP_OPEN_DUP_NUM,
|
||||||
|
OP_CLOSE_DUP_NUM,
|
||||||
|
OP_NON_MATCH_LIST,
|
||||||
|
OP_OPEN_COLL_ELEM,
|
||||||
|
OP_CLOSE_COLL_ELEM,
|
||||||
|
OP_OPEN_EQUIV_CLASS,
|
||||||
|
OP_CLOSE_EQUIV_CLASS,
|
||||||
|
OP_OPEN_CHAR_CLASS,
|
||||||
|
OP_CLOSE_CHAR_CLASS,
|
||||||
|
OP_WORD,
|
||||||
|
OP_NOTWORD,
|
||||||
|
OP_SPACE,
|
||||||
|
OP_NOTSPACE,
|
||||||
|
BACK_SLASH
|
||||||
|
|
||||||
|
} re_token_type_t;
|
||||||
|
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/* Multibyte characters. */
|
||||||
|
wchar_t *mbchars;
|
||||||
|
|
||||||
|
/* Collating symbols. */
|
||||||
|
# ifdef _LIBC
|
||||||
|
int32_t *coll_syms;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Equivalence classes. */
|
||||||
|
# ifdef _LIBC
|
||||||
|
int32_t *equiv_classes;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* Range expressions. */
|
||||||
|
# ifdef _LIBC
|
||||||
|
uint32_t *range_starts;
|
||||||
|
uint32_t *range_ends;
|
||||||
|
# else /* not _LIBC */
|
||||||
|
wchar_t *range_starts;
|
||||||
|
wchar_t *range_ends;
|
||||||
|
# endif /* not _LIBC */
|
||||||
|
|
||||||
|
/* Character classes. */
|
||||||
|
wctype_t *char_classes;
|
||||||
|
|
||||||
|
/* If this character set is the non-matching list. */
|
||||||
|
unsigned int non_match : 1;
|
||||||
|
|
||||||
|
/* # of multibyte characters. */
|
||||||
|
Idx nmbchars;
|
||||||
|
|
||||||
|
/* # of collating symbols. */
|
||||||
|
Idx ncoll_syms;
|
||||||
|
|
||||||
|
/* # of equivalence classes. */
|
||||||
|
Idx nequiv_classes;
|
||||||
|
|
||||||
|
/* # of range expressions. */
|
||||||
|
Idx nranges;
|
||||||
|
|
||||||
|
/* # of character classes. */
|
||||||
|
Idx nchar_classes;
|
||||||
|
} re_charset_t;
|
||||||
|
#endif /* RE_ENABLE_I18N */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
unsigned char c; /* for CHARACTER */
|
||||||
|
re_bitset_ptr_t sbcset; /* for SIMPLE_BRACKET */
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
re_charset_t *mbcset; /* for COMPLEX_BRACKET */
|
||||||
|
#endif /* RE_ENABLE_I18N */
|
||||||
|
Idx idx; /* for BACK_REF */
|
||||||
|
re_context_type ctx_type; /* for ANCHOR */
|
||||||
|
} opr;
|
||||||
|
#if __GNUC__ >= 2 && !defined __STRICT_ANSI__
|
||||||
|
re_token_type_t type : 8;
|
||||||
|
#else
|
||||||
|
re_token_type_t type;
|
||||||
|
#endif
|
||||||
|
unsigned int constraint : 10; /* context constraint */
|
||||||
|
unsigned int duplicated : 1;
|
||||||
|
unsigned int opt_subexp : 1;
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
unsigned int accept_mb : 1;
|
||||||
|
/* These 2 bits can be moved into the union if needed (e.g. if running out
|
||||||
|
of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */
|
||||||
|
unsigned int mb_partial : 1;
|
||||||
|
#endif
|
||||||
|
unsigned int word_char : 1;
|
||||||
|
} re_token_t;
|
||||||
|
|
||||||
|
#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT)
|
||||||
|
|
||||||
|
struct re_string_t
|
||||||
|
{
|
||||||
|
/* Indicate the raw buffer which is the original string passed as an
|
||||||
|
argument of regexec(), re_search(), etc.. */
|
||||||
|
const unsigned char *raw_mbs;
|
||||||
|
/* Store the multibyte string. In case of "case insensitive mode" like
|
||||||
|
REG_ICASE, upper cases of the string are stored, otherwise MBS points
|
||||||
|
the same address that RAW_MBS points. */
|
||||||
|
unsigned char *mbs;
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
/* Store the wide character string which is corresponding to MBS. */
|
||||||
|
wint_t *wcs;
|
||||||
|
Idx *offsets;
|
||||||
|
mbstate_t cur_state;
|
||||||
|
#endif
|
||||||
|
/* Index in RAW_MBS. Each character mbs[i] corresponds to
|
||||||
|
raw_mbs[raw_mbs_idx + i]. */
|
||||||
|
Idx raw_mbs_idx;
|
||||||
|
/* The length of the valid characters in the buffers. */
|
||||||
|
Idx valid_len;
|
||||||
|
/* The corresponding number of bytes in raw_mbs array. */
|
||||||
|
Idx valid_raw_len;
|
||||||
|
/* The length of the buffers MBS and WCS. */
|
||||||
|
Idx bufs_len;
|
||||||
|
/* The index in MBS, which is updated by re_string_fetch_byte. */
|
||||||
|
Idx cur_idx;
|
||||||
|
/* length of RAW_MBS array. */
|
||||||
|
Idx raw_len;
|
||||||
|
/* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */
|
||||||
|
Idx len;
|
||||||
|
/* End of the buffer may be shorter than its length in the cases such
|
||||||
|
as re_match_2, re_search_2. Then, we use STOP for end of the buffer
|
||||||
|
instead of LEN. */
|
||||||
|
Idx raw_stop;
|
||||||
|
/* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */
|
||||||
|
Idx stop;
|
||||||
|
|
||||||
|
/* The context of mbs[0]. We store the context independently, since
|
||||||
|
the context of mbs[0] may be different from raw_mbs[0], which is
|
||||||
|
the beginning of the input string. */
|
||||||
|
unsigned int tip_context;
|
||||||
|
/* The translation passed as a part of an argument of re_compile_pattern. */
|
||||||
|
RE_TRANSLATE_TYPE trans;
|
||||||
|
/* Copy of re_dfa_t's word_char. */
|
||||||
|
re_const_bitset_ptr_t word_char;
|
||||||
|
/* true if REG_ICASE. */
|
||||||
|
unsigned char icase;
|
||||||
|
unsigned char is_utf8;
|
||||||
|
unsigned char map_notascii;
|
||||||
|
unsigned char mbs_allocated;
|
||||||
|
unsigned char offsets_needed;
|
||||||
|
unsigned char newline_anchor;
|
||||||
|
unsigned char word_ops_used;
|
||||||
|
int mb_cur_max;
|
||||||
|
};
|
||||||
|
typedef struct re_string_t re_string_t;
|
||||||
|
|
||||||
|
|
||||||
|
struct re_dfa_t;
|
||||||
|
typedef struct re_dfa_t re_dfa_t;
|
||||||
|
|
||||||
|
#ifndef _LIBC
|
||||||
|
# define internal_function
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
|
||||||
|
Idx new_buf_len)
|
||||||
|
internal_function;
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
static void build_wcs_buffer (re_string_t *pstr) internal_function;
|
||||||
|
static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
|
||||||
|
internal_function;
|
||||||
|
#endif /* RE_ENABLE_I18N */
|
||||||
|
static void build_upper_buffer (re_string_t *pstr) internal_function;
|
||||||
|
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
|
||||||
|
static unsigned int re_string_context_at (const re_string_t *input, Idx idx,
|
||||||
|
int eflags)
|
||||||
|
internal_function __attribute ((pure));
|
||||||
|
#define re_string_peek_byte(pstr, offset) \
|
||||||
|
((pstr)->mbs[(pstr)->cur_idx + offset])
|
||||||
|
#define re_string_fetch_byte(pstr) \
|
||||||
|
((pstr)->mbs[(pstr)->cur_idx++])
|
||||||
|
#define re_string_first_byte(pstr, idx) \
|
||||||
|
((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF)
|
||||||
|
#define re_string_is_single_byte_char(pstr, idx) \
|
||||||
|
((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \
|
||||||
|
|| (pstr)->wcs[(idx) + 1] != WEOF))
|
||||||
|
#define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx)
|
||||||
|
#define re_string_cur_idx(pstr) ((pstr)->cur_idx)
|
||||||
|
#define re_string_get_buffer(pstr) ((pstr)->mbs)
|
||||||
|
#define re_string_length(pstr) ((pstr)->len)
|
||||||
|
#define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx])
|
||||||
|
#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
|
||||||
|
#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
|
||||||
|
|
||||||
|
#include <alloca.h>
|
||||||
|
|
||||||
|
#ifndef _LIBC
|
||||||
|
# if HAVE_ALLOCA
|
||||||
|
/* The OS usually guarantees only one guard page at the bottom of the stack,
|
||||||
|
and a page size can be as small as 4096 bytes. So we cannot safely
|
||||||
|
allocate anything larger than 4096 bytes. Also care for the possibility
|
||||||
|
of a few compiler-allocated temporary stack slots. */
|
||||||
|
# define __libc_use_alloca(n) ((n) < 4032)
|
||||||
|
# else
|
||||||
|
/* alloca is implemented with malloc, so just use malloc. */
|
||||||
|
# define __libc_use_alloca(n) 0
|
||||||
|
# undef alloca
|
||||||
|
# define alloca(n) malloc (n)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX
|
||||||
|
# define MAX(a,b) ((a) < (b) ? (b) : (a))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
|
||||||
|
#define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t)))
|
||||||
|
#define re_free(p) free (p)
|
||||||
|
|
||||||
|
struct bin_tree_t
|
||||||
|
{
|
||||||
|
struct bin_tree_t *parent;
|
||||||
|
struct bin_tree_t *left;
|
||||||
|
struct bin_tree_t *right;
|
||||||
|
struct bin_tree_t *first;
|
||||||
|
struct bin_tree_t *next;
|
||||||
|
|
||||||
|
re_token_t token;
|
||||||
|
|
||||||
|
/* 'node_idx' is the index in dfa->nodes, if 'type' == 0.
|
||||||
|
Otherwise 'type' indicate the type of this node. */
|
||||||
|
Idx node_idx;
|
||||||
|
};
|
||||||
|
typedef struct bin_tree_t bin_tree_t;
|
||||||
|
|
||||||
|
#define BIN_TREE_STORAGE_SIZE \
|
||||||
|
((1024 - sizeof (void *)) / sizeof (bin_tree_t))
|
||||||
|
|
||||||
|
struct bin_tree_storage_t
|
||||||
|
{
|
||||||
|
struct bin_tree_storage_t *next;
|
||||||
|
bin_tree_t data[BIN_TREE_STORAGE_SIZE];
|
||||||
|
};
|
||||||
|
typedef struct bin_tree_storage_t bin_tree_storage_t;
|
||||||
|
|
||||||
|
#define CONTEXT_WORD 1
|
||||||
|
#define CONTEXT_NEWLINE (CONTEXT_WORD << 1)
|
||||||
|
#define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1)
|
||||||
|
#define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1)
|
||||||
|
|
||||||
|
#define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD)
|
||||||
|
#define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE)
|
||||||
|
#define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF)
|
||||||
|
#define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF)
|
||||||
|
#define IS_ORDINARY_CONTEXT(c) ((c) == 0)
|
||||||
|
|
||||||
|
#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
|
||||||
|
#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
|
||||||
|
#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
|
||||||
|
#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
|
||||||
|
|
||||||
|
#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
|
||||||
|
((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|
||||||
|
|| ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|
||||||
|
|| ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\
|
||||||
|
|| ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context)))
|
||||||
|
|
||||||
|
#define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \
|
||||||
|
((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|
||||||
|
|| (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|
||||||
|
|| (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \
|
||||||
|
|| (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context)))
|
||||||
|
|
||||||
|
struct re_dfastate_t
|
||||||
|
{
|
||||||
|
re_hashval_t hash;
|
||||||
|
re_node_set nodes;
|
||||||
|
re_node_set non_eps_nodes;
|
||||||
|
re_node_set inveclosure;
|
||||||
|
re_node_set *entrance_nodes;
|
||||||
|
struct re_dfastate_t **trtable, **word_trtable;
|
||||||
|
unsigned int context : 4;
|
||||||
|
unsigned int halt : 1;
|
||||||
|
/* If this state can accept "multi byte".
|
||||||
|
Note that we refer to multibyte characters, and multi character
|
||||||
|
collating elements as "multi byte". */
|
||||||
|
unsigned int accept_mb : 1;
|
||||||
|
/* If this state has backreference node(s). */
|
||||||
|
unsigned int has_backref : 1;
|
||||||
|
unsigned int has_constraint : 1;
|
||||||
|
};
|
||||||
|
typedef struct re_dfastate_t re_dfastate_t;
|
||||||
|
|
||||||
|
struct re_state_table_entry
|
||||||
|
{
|
||||||
|
Idx num;
|
||||||
|
Idx alloc;
|
||||||
|
re_dfastate_t **array;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Array type used in re_sub_match_last_t and re_sub_match_top_t. */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Idx next_idx;
|
||||||
|
Idx alloc;
|
||||||
|
re_dfastate_t **array;
|
||||||
|
} state_array_t;
|
||||||
|
|
||||||
|
/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP. */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Idx node;
|
||||||
|
Idx str_idx; /* The position NODE match at. */
|
||||||
|
state_array_t path;
|
||||||
|
} re_sub_match_last_t;
|
||||||
|
|
||||||
|
/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
|
||||||
|
And information about the node, whose type is OP_CLOSE_SUBEXP,
|
||||||
|
corresponding to NODE is stored in LASTS. */
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
Idx str_idx;
|
||||||
|
Idx node;
|
||||||
|
state_array_t *path;
|
||||||
|
Idx alasts; /* Allocation size of LASTS. */
|
||||||
|
Idx nlasts; /* The number of LASTS. */
|
||||||
|
re_sub_match_last_t **lasts;
|
||||||
|
} re_sub_match_top_t;
|
||||||
|
|
||||||
|
struct re_backref_cache_entry
|
||||||
|
{
|
||||||
|
Idx node;
|
||||||
|
Idx str_idx;
|
||||||
|
Idx subexp_from;
|
||||||
|
Idx subexp_to;
|
||||||
|
char more;
|
||||||
|
char unused;
|
||||||
|
unsigned short int eps_reachable_subexps_map;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
/* The string object corresponding to the input string. */
|
||||||
|
re_string_t input;
|
||||||
|
#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
||||||
|
const re_dfa_t *const dfa;
|
||||||
|
#else
|
||||||
|
const re_dfa_t *dfa;
|
||||||
|
#endif
|
||||||
|
/* EFLAGS of the argument of regexec. */
|
||||||
|
int eflags;
|
||||||
|
/* Where the matching ends. */
|
||||||
|
Idx match_last;
|
||||||
|
Idx last_node;
|
||||||
|
/* The state log used by the matcher. */
|
||||||
|
re_dfastate_t **state_log;
|
||||||
|
Idx state_log_top;
|
||||||
|
/* Back reference cache. */
|
||||||
|
Idx nbkref_ents;
|
||||||
|
Idx abkref_ents;
|
||||||
|
struct re_backref_cache_entry *bkref_ents;
|
||||||
|
int max_mb_elem_len;
|
||||||
|
Idx nsub_tops;
|
||||||
|
Idx asub_tops;
|
||||||
|
re_sub_match_top_t **sub_tops;
|
||||||
|
} re_match_context_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
re_dfastate_t **sifted_states;
|
||||||
|
re_dfastate_t **limited_states;
|
||||||
|
Idx last_node;
|
||||||
|
Idx last_str_idx;
|
||||||
|
re_node_set limits;
|
||||||
|
} re_sift_context_t;
|
||||||
|
|
||||||
|
struct re_fail_stack_ent_t
|
||||||
|
{
|
||||||
|
Idx idx;
|
||||||
|
Idx node;
|
||||||
|
regmatch_t *regs;
|
||||||
|
re_node_set eps_via_nodes;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct re_fail_stack_t
|
||||||
|
{
|
||||||
|
Idx num;
|
||||||
|
Idx alloc;
|
||||||
|
struct re_fail_stack_ent_t *stack;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct re_dfa_t
|
||||||
|
{
|
||||||
|
re_token_t *nodes;
|
||||||
|
size_t nodes_alloc;
|
||||||
|
size_t nodes_len;
|
||||||
|
Idx *nexts;
|
||||||
|
Idx *org_indices;
|
||||||
|
re_node_set *edests;
|
||||||
|
re_node_set *eclosures;
|
||||||
|
re_node_set *inveclosures;
|
||||||
|
struct re_state_table_entry *state_table;
|
||||||
|
re_dfastate_t *init_state;
|
||||||
|
re_dfastate_t *init_state_word;
|
||||||
|
re_dfastate_t *init_state_nl;
|
||||||
|
re_dfastate_t *init_state_begbuf;
|
||||||
|
bin_tree_t *str_tree;
|
||||||
|
bin_tree_storage_t *str_tree_storage;
|
||||||
|
re_bitset_ptr_t sb_char;
|
||||||
|
int str_tree_storage_idx;
|
||||||
|
|
||||||
|
/* number of subexpressions 're_nsub' is in regex_t. */
|
||||||
|
re_hashval_t state_hash_mask;
|
||||||
|
Idx init_node;
|
||||||
|
Idx nbackref; /* The number of backreference in this dfa. */
|
||||||
|
|
||||||
|
/* Bitmap expressing which backreference is used. */
|
||||||
|
bitset_word_t used_bkref_map;
|
||||||
|
bitset_word_t completed_bkref_map;
|
||||||
|
|
||||||
|
unsigned int has_plural_match : 1;
|
||||||
|
/* If this dfa has "multibyte node", which is a backreference or
|
||||||
|
a node which can accept multibyte character or multi character
|
||||||
|
collating element. */
|
||||||
|
unsigned int has_mb_node : 1;
|
||||||
|
unsigned int is_utf8 : 1;
|
||||||
|
unsigned int map_notascii : 1;
|
||||||
|
unsigned int word_ops_used : 1;
|
||||||
|
int mb_cur_max;
|
||||||
|
bitset_t word_char;
|
||||||
|
reg_syntax_t syntax;
|
||||||
|
Idx *subexp_map;
|
||||||
|
#ifdef DEBUG
|
||||||
|
char* re_str;
|
||||||
|
#endif
|
||||||
|
#ifdef _LIBC
|
||||||
|
__libc_lock_define (, lock)
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
|
||||||
|
#define re_node_set_remove(set,id) \
|
||||||
|
(re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
|
||||||
|
#define re_node_set_empty(p) ((p)->nelem = 0)
|
||||||
|
#define re_node_set_free(set) re_free ((set)->elems)
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
SB_CHAR,
|
||||||
|
MB_CHAR,
|
||||||
|
EQUIV_CLASS,
|
||||||
|
COLL_SYM,
|
||||||
|
CHAR_CLASS
|
||||||
|
} bracket_elem_type;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
bracket_elem_type type;
|
||||||
|
union
|
||||||
|
{
|
||||||
|
unsigned char ch;
|
||||||
|
unsigned char *name;
|
||||||
|
wchar_t wch;
|
||||||
|
} opr;
|
||||||
|
} bracket_elem_t;
|
||||||
|
|
||||||
|
|
||||||
|
/* Inline functions for bitset_t operation. */
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_set (bitset_t set, Idx i)
|
||||||
|
{
|
||||||
|
set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_clear (bitset_t set, Idx i)
|
||||||
|
{
|
||||||
|
set[i / BITSET_WORD_BITS] &= ~ ((bitset_word_t) 1 << i % BITSET_WORD_BITS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool
|
||||||
|
bitset_contain (const bitset_t set, Idx i)
|
||||||
|
{
|
||||||
|
return (set[i / BITSET_WORD_BITS] >> i % BITSET_WORD_BITS) & 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_empty (bitset_t set)
|
||||||
|
{
|
||||||
|
memset (set, '\0', sizeof (bitset_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_set_all (bitset_t set)
|
||||||
|
{
|
||||||
|
memset (set, -1, sizeof (bitset_word_t) * (SBC_MAX / BITSET_WORD_BITS));
|
||||||
|
if (SBC_MAX % BITSET_WORD_BITS != 0)
|
||||||
|
set[BITSET_WORDS - 1] =
|
||||||
|
((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_copy (bitset_t dest, const bitset_t src)
|
||||||
|
{
|
||||||
|
memcpy (dest, src, sizeof (bitset_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_not (bitset_t set)
|
||||||
|
{
|
||||||
|
int bitset_i;
|
||||||
|
for (bitset_i = 0; bitset_i < SBC_MAX / BITSET_WORD_BITS; ++bitset_i)
|
||||||
|
set[bitset_i] = ~set[bitset_i];
|
||||||
|
if (SBC_MAX % BITSET_WORD_BITS != 0)
|
||||||
|
set[BITSET_WORDS - 1] =
|
||||||
|
((((bitset_word_t) 1 << SBC_MAX % BITSET_WORD_BITS) - 1)
|
||||||
|
& ~set[BITSET_WORDS - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_merge (bitset_t dest, const bitset_t src)
|
||||||
|
{
|
||||||
|
int bitset_i;
|
||||||
|
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
||||||
|
dest[bitset_i] |= src[bitset_i];
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
bitset_mask (bitset_t dest, const bitset_t src)
|
||||||
|
{
|
||||||
|
int bitset_i;
|
||||||
|
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
||||||
|
dest[bitset_i] &= src[bitset_i];
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef RE_ENABLE_I18N
|
||||||
|
/* Inline functions for re_string. */
|
||||||
|
static inline int
|
||||||
|
internal_function __attribute ((pure))
|
||||||
|
re_string_char_size_at (const re_string_t *pstr, Idx idx)
|
||||||
|
{
|
||||||
|
int byte_idx;
|
||||||
|
if (pstr->mb_cur_max == 1)
|
||||||
|
return 1;
|
||||||
|
for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
|
||||||
|
if (pstr->wcs[idx + byte_idx] != WEOF)
|
||||||
|
break;
|
||||||
|
return byte_idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline wint_t
|
||||||
|
internal_function __attribute ((pure))
|
||||||
|
re_string_wchar_at (const re_string_t *pstr, Idx idx)
|
||||||
|
{
|
||||||
|
if (pstr->mb_cur_max == 1)
|
||||||
|
return (wint_t) pstr->mbs[idx];
|
||||||
|
return (wint_t) pstr->wcs[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
internal_function __attribute ((pure))
|
||||||
|
re_string_elem_size_at (const re_string_t *pstr, Idx idx)
|
||||||
|
{
|
||||||
|
# ifdef _LIBC
|
||||||
|
const unsigned char *p, *extra;
|
||||||
|
const int32_t *table, *indirect;
|
||||||
|
int32_t tmp;
|
||||||
|
# include <locale/weight.h>
|
||||||
|
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
|
||||||
|
|
||||||
|
if (nrules != 0)
|
||||||
|
{
|
||||||
|
table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
|
||||||
|
extra = (const unsigned char *)
|
||||||
|
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
|
||||||
|
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
|
||||||
|
_NL_COLLATE_INDIRECTMB);
|
||||||
|
p = pstr->mbs + idx;
|
||||||
|
tmp = findidx (&p);
|
||||||
|
return p - pstr->mbs - idx;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
# endif /* _LIBC */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif /* RE_ENABLE_I18N */
|
||||||
|
|
||||||
|
#ifndef __GNUC_PREREQ
|
||||||
|
# if defined __GNUC__ && defined __GNUC_MINOR__
|
||||||
|
# define __GNUC_PREREQ(maj, min) \
|
||||||
|
((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
||||||
|
# else
|
||||||
|
# define __GNUC_PREREQ(maj, min) 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if __GNUC_PREREQ (3,4)
|
||||||
|
# undef __attribute_warn_unused_result__
|
||||||
|
# define __attribute_warn_unused_result__ \
|
||||||
|
__attribute__ ((__warn_unused_result__))
|
||||||
|
#else
|
||||||
|
# define __attribute_warn_unused_result__ /* empty */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _REGEX_INTERNAL_H */
|
4417
lib/regexec.c
Normal file
4417
lib/regexec.c
Normal file
File diff suppressed because it is too large
Load diff
63
lib/strcasecmp.c
Normal file
63
lib/strcasecmp.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/* Case-insensitive string comparison function.
|
||||||
|
Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||||
|
|
||||||
|
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||||
|
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||||
|
than S2.
|
||||||
|
Note: This function does not work with multibyte strings! */
|
||||||
|
|
||||||
|
int
|
||||||
|
strcasecmp (const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
const unsigned char *p1 = (const unsigned char *) s1;
|
||||||
|
const unsigned char *p2 = (const unsigned char *) s2;
|
||||||
|
unsigned char c1, c2;
|
||||||
|
|
||||||
|
if (p1 == p2)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
c1 = TOLOWER (*p1);
|
||||||
|
c2 = TOLOWER (*p2);
|
||||||
|
|
||||||
|
if (c1 == '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
|
++p1;
|
||||||
|
++p2;
|
||||||
|
}
|
||||||
|
while (c1 == c2);
|
||||||
|
|
||||||
|
if (UCHAR_MAX <= INT_MAX)
|
||||||
|
return c1 - c2;
|
||||||
|
else
|
||||||
|
/* On machines where 'char' and 'int' are types of the same size, the
|
||||||
|
difference of two 'unsigned char' values - including the sign bit -
|
||||||
|
doesn't fit in an 'int'. */
|
||||||
|
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||||
|
}
|
176
lib/streq.h
Normal file
176
lib/streq.h
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
/* Optimized string comparison.
|
||||||
|
Copyright (C) 2001-2002, 2007, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* Written by Bruno Haible <bruno@clisp.org>. */
|
||||||
|
|
||||||
|
#ifndef _GL_STREQ_H
|
||||||
|
#define _GL_STREQ_H
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
/* STREQ allows to optimize string comparison with a small literal string.
|
||||||
|
STREQ (s, "EUC-KR", 'E', 'U', 'C', '-', 'K', 'R', 0, 0, 0)
|
||||||
|
is semantically equivalent to
|
||||||
|
strcmp (s, "EUC-KR") == 0
|
||||||
|
just faster. */
|
||||||
|
|
||||||
|
/* Help GCC to generate good code for string comparisons with
|
||||||
|
immediate strings. */
|
||||||
|
#if defined (__GNUC__) && defined (__OPTIMIZE__)
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq9 (const char *s1, const char *s2)
|
||||||
|
{
|
||||||
|
return strcmp (s1 + 9, s2 + 9) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq8 (const char *s1, const char *s2, char s28)
|
||||||
|
{
|
||||||
|
if (s1[8] == s28)
|
||||||
|
{
|
||||||
|
if (s28 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq9 (s1, s2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq7 (const char *s1, const char *s2, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[7] == s27)
|
||||||
|
{
|
||||||
|
if (s27 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq8 (s1, s2, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq6 (const char *s1, const char *s2, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[6] == s26)
|
||||||
|
{
|
||||||
|
if (s26 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq7 (s1, s2, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq5 (const char *s1, const char *s2, char s25, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[5] == s25)
|
||||||
|
{
|
||||||
|
if (s25 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq6 (s1, s2, s26, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq4 (const char *s1, const char *s2, char s24, char s25, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[4] == s24)
|
||||||
|
{
|
||||||
|
if (s24 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq5 (s1, s2, s25, s26, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq3 (const char *s1, const char *s2, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[3] == s23)
|
||||||
|
{
|
||||||
|
if (s23 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq4 (s1, s2, s24, s25, s26, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq2 (const char *s1, const char *s2, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[2] == s22)
|
||||||
|
{
|
||||||
|
if (s22 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq3 (s1, s2, s23, s24, s25, s26, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq1 (const char *s1, const char *s2, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[1] == s21)
|
||||||
|
{
|
||||||
|
if (s21 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq2 (s1, s2, s22, s23, s24, s25, s26, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
streq0 (const char *s1, const char *s2, char s20, char s21, char s22, char s23, char s24, char s25, char s26, char s27, char s28)
|
||||||
|
{
|
||||||
|
if (s1[0] == s20)
|
||||||
|
{
|
||||||
|
if (s20 == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return streq1 (s1, s2, s21, s22, s23, s24, s25, s26, s27, s28);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
|
||||||
|
streq0 (s1, s2, s20, s21, s22, s23, s24, s25, s26, s27, s28)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define STREQ(s1,s2,s20,s21,s22,s23,s24,s25,s26,s27,s28) \
|
||||||
|
(strcmp (s1, s2) == 0)
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _GL_STREQ_H */
|
123
lib/strings.in.h
Normal file
123
lib/strings.in.h
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
/* A substitute <strings.h>.
|
||||||
|
|
||||||
|
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#ifndef _@GUARD_PREFIX@_STRINGS_H
|
||||||
|
|
||||||
|
#if __GNUC__ >= 3
|
||||||
|
@PRAGMA_SYSTEM_HEADER@
|
||||||
|
#endif
|
||||||
|
@PRAGMA_COLUMNS@
|
||||||
|
|
||||||
|
/* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
|
||||||
|
But avoid namespace pollution on glibc systems. */
|
||||||
|
#if defined __minix && !defined __GLIBC__
|
||||||
|
# include <sys/types.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The include_next requires a split double-inclusion guard. */
|
||||||
|
#if @HAVE_STRINGS_H@
|
||||||
|
# @INCLUDE_NEXT@ @NEXT_STRINGS_H@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _@GUARD_PREFIX@_STRINGS_H
|
||||||
|
#define _@GUARD_PREFIX@_STRINGS_H
|
||||||
|
|
||||||
|
#if ! @HAVE_DECL_STRNCASECMP@
|
||||||
|
/* Get size_t. */
|
||||||
|
# include <stddef.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||||
|
|
||||||
|
/* The definition of _GL_ARG_NONNULL is copied here. */
|
||||||
|
|
||||||
|
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* Find the index of the least-significant set bit. */
|
||||||
|
#if @GNULIB_FFS@
|
||||||
|
# if !@HAVE_FFS@
|
||||||
|
_GL_FUNCDECL_SYS (ffs, int, (int i));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (ffs, int, (int i));
|
||||||
|
_GL_CXXALIASWARN (ffs);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef ffs
|
||||||
|
# if HAVE_RAW_DECL_FFS
|
||||||
|
_GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
|
||||||
|
greater than zero if S1 is lexicographically less than, equal to or greater
|
||||||
|
than S2.
|
||||||
|
Note: This function does not work in multibyte locales. */
|
||||||
|
#if ! @HAVE_STRCASECMP@
|
||||||
|
extern int strcasecmp (char const *s1, char const *s2)
|
||||||
|
_GL_ARG_NONNULL ((1, 2));
|
||||||
|
#endif
|
||||||
|
#if defined GNULIB_POSIXCHECK
|
||||||
|
/* strcasecmp() does not work with multibyte strings:
|
||||||
|
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||||
|
as a sequence of bytes, not of characters. */
|
||||||
|
# undef strcasecmp
|
||||||
|
# if HAVE_RAW_DECL_STRCASECMP
|
||||||
|
_GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
|
||||||
|
"strings in multibyte locales - "
|
||||||
|
"use mbscasecmp if you care about "
|
||||||
|
"internationalization, or use c_strcasecmp , "
|
||||||
|
"gnulib module c-strcase) if you want a locale "
|
||||||
|
"independent function");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
|
||||||
|
returning less than, equal to or greater than zero if S1 is
|
||||||
|
lexicographically less than, equal to or greater than S2.
|
||||||
|
Note: This function cannot work correctly in multibyte locales. */
|
||||||
|
#if ! @HAVE_DECL_STRNCASECMP@
|
||||||
|
extern int strncasecmp (char const *s1, char const *s2, size_t n)
|
||||||
|
_GL_ARG_NONNULL ((1, 2));
|
||||||
|
#endif
|
||||||
|
#if defined GNULIB_POSIXCHECK
|
||||||
|
/* strncasecmp() does not work with multibyte strings:
|
||||||
|
POSIX says that it operates on "strings", and "string" in POSIX is defined
|
||||||
|
as a sequence of bytes, not of characters. */
|
||||||
|
# undef strncasecmp
|
||||||
|
# if HAVE_RAW_DECL_STRNCASECMP
|
||||||
|
_GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
|
||||||
|
"strings in multibyte locales - "
|
||||||
|
"use mbsncasecmp or mbspcasecmp if you care about "
|
||||||
|
"internationalization, or use c_strncasecmp , "
|
||||||
|
"gnulib module c-strcase) if you want a locale "
|
||||||
|
"independent function");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _@GUARD_PREFIX@_STRING_H */
|
||||||
|
#endif /* _@GUARD_PREFIX@_STRING_H */
|
63
lib/strncasecmp.c
Normal file
63
lib/strncasecmp.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/* strncasecmp.c -- case insensitive string comparator
|
||||||
|
Copyright (C) 1998-1999, 2005-2007, 2009-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
#define TOLOWER(Ch) (isupper (Ch) ? tolower (Ch) : (Ch))
|
||||||
|
|
||||||
|
/* Compare no more than N bytes of strings S1 and S2, ignoring case,
|
||||||
|
returning less than, equal to or greater than zero if S1 is
|
||||||
|
lexicographically less than, equal to or greater than S2.
|
||||||
|
Note: This function cannot work correctly in multibyte locales. */
|
||||||
|
|
||||||
|
int
|
||||||
|
strncasecmp (const char *s1, const char *s2, size_t n)
|
||||||
|
{
|
||||||
|
register const unsigned char *p1 = (const unsigned char *) s1;
|
||||||
|
register const unsigned char *p2 = (const unsigned char *) s2;
|
||||||
|
unsigned char c1, c2;
|
||||||
|
|
||||||
|
if (p1 == p2 || n == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
c1 = TOLOWER (*p1);
|
||||||
|
c2 = TOLOWER (*p2);
|
||||||
|
|
||||||
|
if (--n == 0 || c1 == '\0')
|
||||||
|
break;
|
||||||
|
|
||||||
|
++p1;
|
||||||
|
++p2;
|
||||||
|
}
|
||||||
|
while (c1 == c2);
|
||||||
|
|
||||||
|
if (UCHAR_MAX <= INT_MAX)
|
||||||
|
return c1 - c2;
|
||||||
|
else
|
||||||
|
/* On machines where 'char' and 'int' are types of the same size, the
|
||||||
|
difference of two 'unsigned char' values - including the sign bit -
|
||||||
|
doesn't fit in an 'int'. */
|
||||||
|
return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
|
||||||
|
}
|
53
lib/wcrtomb.c
Normal file
53
lib/wcrtomb.c
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
/* Convert wide character to multibyte character.
|
||||||
|
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||||
|
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||||
|
|
||||||
|
This program 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 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program 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 program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
/* Specification. */
|
||||||
|
#include <wchar.h>
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
size_t
|
||||||
|
wcrtomb (char *s, wchar_t wc, mbstate_t *ps)
|
||||||
|
{
|
||||||
|
/* This implementation of wcrtomb on top of wctomb() supports only
|
||||||
|
stateless encodings. ps must be in the initial state. */
|
||||||
|
if (ps != NULL && !mbsinit (ps))
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return (size_t)(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s == NULL)
|
||||||
|
/* We know the NUL wide character corresponds to the NUL character. */
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int ret = wctomb (s, wc);
|
||||||
|
|
||||||
|
if (ret >= 0)
|
||||||
|
return ret;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errno = EILSEQ;
|
||||||
|
return (size_t)(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
499
lib/wctype.in.h
Normal file
499
lib/wctype.in.h
Normal file
|
@ -0,0 +1,499 @@
|
||||||
|
/* A substitute for ISO C99 <wctype.h>, for platforms that lack it.
|
||||||
|
|
||||||
|
Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program 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 program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
|
/* Written by Bruno Haible and Paul Eggert. */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ISO C 99 <wctype.h> for platforms that lack it.
|
||||||
|
* <http://www.opengroup.org/susv3xbd/wctype.h.html>
|
||||||
|
*
|
||||||
|
* iswctype, towctrans, towlower, towupper, wctrans, wctype,
|
||||||
|
* wctrans_t, and wctype_t are not yet implemented.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _@GUARD_PREFIX@_WCTYPE_H
|
||||||
|
|
||||||
|
#if __GNUC__ >= 3
|
||||||
|
@PRAGMA_SYSTEM_HEADER@
|
||||||
|
#endif
|
||||||
|
@PRAGMA_COLUMNS@
|
||||||
|
|
||||||
|
#if @HAVE_WINT_T@
|
||||||
|
/* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.
|
||||||
|
Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before
|
||||||
|
<wchar.h>.
|
||||||
|
BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
|
||||||
|
included before <wchar.h>. */
|
||||||
|
# include <stddef.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <time.h>
|
||||||
|
# include <wchar.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Include the original <wctype.h> if it exists.
|
||||||
|
BeOS 5 has the functions but no <wctype.h>. */
|
||||||
|
/* The include_next requires a split double-inclusion guard. */
|
||||||
|
#if @HAVE_WCTYPE_H@
|
||||||
|
# @INCLUDE_NEXT@ @NEXT_WCTYPE_H@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _@GUARD_PREFIX@_WCTYPE_H
|
||||||
|
#define _@GUARD_PREFIX@_WCTYPE_H
|
||||||
|
|
||||||
|
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
|
||||||
|
|
||||||
|
/* The definition of _GL_WARN_ON_USE is copied here. */
|
||||||
|
|
||||||
|
/* Solaris 2.6 <wctype.h> includes <widec.h> which includes <euc.h> which
|
||||||
|
#defines a number of identifiers in the application namespace. Revert
|
||||||
|
these #defines. */
|
||||||
|
#ifdef __sun
|
||||||
|
# undef multibyte
|
||||||
|
# undef eucw1
|
||||||
|
# undef eucw2
|
||||||
|
# undef eucw3
|
||||||
|
# undef scrw1
|
||||||
|
# undef scrw2
|
||||||
|
# undef scrw3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Define wint_t and WEOF. (Also done in wchar.in.h.) */
|
||||||
|
#if !@HAVE_WINT_T@ && !defined wint_t
|
||||||
|
# define wint_t int
|
||||||
|
# ifndef WEOF
|
||||||
|
# define WEOF -1
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
/* MSVC defines wint_t as 'unsigned short' in <crtdefs.h>.
|
||||||
|
This is too small: ISO C 99 section 7.24.1.(2) says that wint_t must be
|
||||||
|
"unchanged by default argument promotions". Override it. */
|
||||||
|
# if defined _MSC_VER
|
||||||
|
# if !GNULIB_defined_wint_t
|
||||||
|
# include <crtdefs.h>
|
||||||
|
typedef unsigned int rpl_wint_t;
|
||||||
|
# undef wint_t
|
||||||
|
# define wint_t rpl_wint_t
|
||||||
|
# define GNULIB_defined_wint_t 1
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifndef WEOF
|
||||||
|
# define WEOF ((wint_t) -1)
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if !GNULIB_defined_wctype_functions
|
||||||
|
|
||||||
|
/* FreeBSD 4.4 to 4.11 has <wctype.h> but lacks the functions.
|
||||||
|
Linux libc5 has <wctype.h> and the functions but they are broken.
|
||||||
|
Assume all 11 functions (all isw* except iswblank) are implemented the
|
||||||
|
same way, or not at all. */
|
||||||
|
# if ! @HAVE_ISWCNTRL@ || @REPLACE_ISWCNTRL@
|
||||||
|
|
||||||
|
/* IRIX 5.3 has macros but no functions, its isw* macros refer to an
|
||||||
|
undefined variable _ctmp_ and to <ctype.h> macros like _P, and they
|
||||||
|
refer to system functions like _iswctype that are not in the
|
||||||
|
standard C library. Rather than try to get ancient buggy
|
||||||
|
implementations like this to work, just disable them. */
|
||||||
|
# undef iswalnum
|
||||||
|
# undef iswalpha
|
||||||
|
# undef iswblank
|
||||||
|
# undef iswcntrl
|
||||||
|
# undef iswdigit
|
||||||
|
# undef iswgraph
|
||||||
|
# undef iswlower
|
||||||
|
# undef iswprint
|
||||||
|
# undef iswpunct
|
||||||
|
# undef iswspace
|
||||||
|
# undef iswupper
|
||||||
|
# undef iswxdigit
|
||||||
|
# undef towlower
|
||||||
|
# undef towupper
|
||||||
|
|
||||||
|
/* Linux libc5 has <wctype.h> and the functions but they are broken. */
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# define iswalnum rpl_iswalnum
|
||||||
|
# define iswalpha rpl_iswalpha
|
||||||
|
# define iswblank rpl_iswblank
|
||||||
|
# define iswcntrl rpl_iswcntrl
|
||||||
|
# define iswdigit rpl_iswdigit
|
||||||
|
# define iswgraph rpl_iswgraph
|
||||||
|
# define iswlower rpl_iswlower
|
||||||
|
# define iswprint rpl_iswprint
|
||||||
|
# define iswpunct rpl_iswpunct
|
||||||
|
# define iswspace rpl_iswspace
|
||||||
|
# define iswupper rpl_iswupper
|
||||||
|
# define iswxdigit rpl_iswxdigit
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# if @REPLACE_TOWLOWER@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# define towlower rpl_towlower
|
||||||
|
# define towupper rpl_towupper
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswalnum
|
||||||
|
# else
|
||||||
|
iswalnum
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return ((wc >= '0' && wc <= '9')
|
||||||
|
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z'));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswalpha
|
||||||
|
# else
|
||||||
|
iswalpha
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return (wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswblank
|
||||||
|
# else
|
||||||
|
iswblank
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc == ' ' || wc == '\t';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswcntrl
|
||||||
|
# else
|
||||||
|
iswcntrl
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return (wc & ~0x1f) == 0 || wc == 0x7f;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswdigit
|
||||||
|
# else
|
||||||
|
iswdigit
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc >= '0' && wc <= '9';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswgraph
|
||||||
|
# else
|
||||||
|
iswgraph
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc >= '!' && wc <= '~';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswlower
|
||||||
|
# else
|
||||||
|
iswlower
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc >= 'a' && wc <= 'z';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswprint
|
||||||
|
# else
|
||||||
|
iswprint
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc >= ' ' && wc <= '~';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswpunct
|
||||||
|
# else
|
||||||
|
iswpunct
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return (wc >= '!' && wc <= '~'
|
||||||
|
&& !((wc >= '0' && wc <= '9')
|
||||||
|
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'Z')));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswspace
|
||||||
|
# else
|
||||||
|
iswspace
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return (wc == ' ' || wc == '\t'
|
||||||
|
|| wc == '\n' || wc == '\v' || wc == '\f' || wc == '\r');
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswupper
|
||||||
|
# else
|
||||||
|
iswupper
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return wc >= 'A' && wc <= 'Z';
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
# if @REPLACE_ISWCNTRL@
|
||||||
|
rpl_iswxdigit
|
||||||
|
# else
|
||||||
|
iswxdigit
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return ((wc >= '0' && wc <= '9')
|
||||||
|
|| ((wc & ~0x20) >= 'A' && (wc & ~0x20) <= 'F'));
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline wint_t
|
||||||
|
# if @REPLACE_TOWLOWER@
|
||||||
|
rpl_towlower
|
||||||
|
# else
|
||||||
|
towlower
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return (wc >= 'A' && wc <= 'Z' ? wc - 'A' + 'a' : wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline wint_t
|
||||||
|
# if @REPLACE_TOWLOWER@
|
||||||
|
rpl_towupper
|
||||||
|
# else
|
||||||
|
towupper
|
||||||
|
# endif
|
||||||
|
(wint_t wc)
|
||||||
|
{
|
||||||
|
return (wc >= 'a' && wc <= 'z' ? wc - 'a' + 'A' : wc);
|
||||||
|
}
|
||||||
|
|
||||||
|
# elif @GNULIB_ISWBLANK@ && (! @HAVE_ISWBLANK@ || @REPLACE_ISWBLANK@)
|
||||||
|
/* Only the iswblank function is missing. */
|
||||||
|
|
||||||
|
# if @REPLACE_ISWBLANK@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# define iswblank rpl_iswblank
|
||||||
|
# endif
|
||||||
|
_GL_FUNCDECL_RPL (iswblank, int, (wint_t wc));
|
||||||
|
# else
|
||||||
|
_GL_FUNCDECL_SYS (iswblank, int, (wint_t wc));
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined __MINGW32__
|
||||||
|
|
||||||
|
/* On native Windows, wchar_t is uint16_t, and wint_t is uint32_t.
|
||||||
|
The functions towlower and towupper are implemented in the MSVCRT library
|
||||||
|
to take a wchar_t argument and return a wchar_t result. mingw declares
|
||||||
|
these functions to take a wint_t argument and return a wint_t result.
|
||||||
|
This means that:
|
||||||
|
1. When the user passes an argument outside the range 0x0000..0xFFFF, the
|
||||||
|
function will look only at the lower 16 bits. This is allowed according
|
||||||
|
to POSIX.
|
||||||
|
2. The return value is returned in the lower 16 bits of the result register.
|
||||||
|
The upper 16 bits are random: whatever happened to be in that part of the
|
||||||
|
result register. We need to fix this by adding a zero-extend from
|
||||||
|
wchar_t to wint_t after the call. */
|
||||||
|
|
||||||
|
static inline wint_t
|
||||||
|
rpl_towlower (wint_t wc)
|
||||||
|
{
|
||||||
|
return (wint_t) (wchar_t) towlower (wc);
|
||||||
|
}
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# define towlower rpl_towlower
|
||||||
|
# endif
|
||||||
|
|
||||||
|
static inline wint_t
|
||||||
|
rpl_towupper (wint_t wc)
|
||||||
|
{
|
||||||
|
return (wint_t) (wchar_t) towupper (wc);
|
||||||
|
}
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# define towupper rpl_towupper
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# endif /* __MINGW32__ */
|
||||||
|
|
||||||
|
# define GNULIB_defined_wctype_functions 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if @REPLACE_ISWCNTRL@
|
||||||
|
_GL_CXXALIAS_RPL (iswalnum, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswalpha, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswcntrl, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswdigit, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswgraph, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswlower, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswprint, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswpunct, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswspace, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswupper, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (iswxdigit, int, (wint_t wc));
|
||||||
|
#else
|
||||||
|
_GL_CXXALIAS_SYS (iswalnum, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswalpha, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswcntrl, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswdigit, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswgraph, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswlower, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswprint, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswpunct, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswspace, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswupper, int, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (iswxdigit, int, (wint_t wc));
|
||||||
|
#endif
|
||||||
|
_GL_CXXALIASWARN (iswalnum);
|
||||||
|
_GL_CXXALIASWARN (iswalpha);
|
||||||
|
_GL_CXXALIASWARN (iswcntrl);
|
||||||
|
_GL_CXXALIASWARN (iswdigit);
|
||||||
|
_GL_CXXALIASWARN (iswgraph);
|
||||||
|
_GL_CXXALIASWARN (iswlower);
|
||||||
|
_GL_CXXALIASWARN (iswprint);
|
||||||
|
_GL_CXXALIASWARN (iswpunct);
|
||||||
|
_GL_CXXALIASWARN (iswspace);
|
||||||
|
_GL_CXXALIASWARN (iswupper);
|
||||||
|
_GL_CXXALIASWARN (iswxdigit);
|
||||||
|
|
||||||
|
#if @GNULIB_ISWBLANK@
|
||||||
|
# if @REPLACE_ISWCNTRL@ || @REPLACE_ISWBLANK@
|
||||||
|
_GL_CXXALIAS_RPL (iswblank, int, (wint_t wc));
|
||||||
|
# else
|
||||||
|
_GL_CXXALIAS_SYS (iswblank, int, (wint_t wc));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIASWARN (iswblank);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !@HAVE_WCTYPE_T@
|
||||||
|
# if !GNULIB_defined_wctype_t
|
||||||
|
typedef void * wctype_t;
|
||||||
|
# define GNULIB_defined_wctype_t 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Get a descriptor for a wide character property. */
|
||||||
|
#if @GNULIB_WCTYPE@
|
||||||
|
# if !@HAVE_WCTYPE_T@
|
||||||
|
_GL_FUNCDECL_SYS (wctype, wctype_t, (const char *name));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (wctype, wctype_t, (const char *name));
|
||||||
|
_GL_CXXALIASWARN (wctype);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef wctype
|
||||||
|
# if HAVE_RAW_DECL_WCTYPE
|
||||||
|
_GL_WARN_ON_USE (wctype, "wctype is unportable - "
|
||||||
|
"use gnulib module wctype for portability");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Test whether a wide character has a given property.
|
||||||
|
The argument WC must be either a wchar_t value or WEOF.
|
||||||
|
The argument DESC must have been returned by the wctype() function. */
|
||||||
|
#if @GNULIB_ISWCTYPE@
|
||||||
|
# if !@HAVE_WCTYPE_T@
|
||||||
|
_GL_FUNCDECL_SYS (iswctype, int, (wint_t wc, wctype_t desc));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (iswctype, int, (wint_t wc, wctype_t desc));
|
||||||
|
_GL_CXXALIASWARN (iswctype);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef iswctype
|
||||||
|
# if HAVE_RAW_DECL_ISWCTYPE
|
||||||
|
_GL_WARN_ON_USE (iswctype, "iswctype is unportable - "
|
||||||
|
"use gnulib module iswctype for portability");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if @REPLACE_TOWLOWER@ || defined __MINGW32__
|
||||||
|
_GL_CXXALIAS_RPL (towlower, wint_t, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_RPL (towupper, wint_t, (wint_t wc));
|
||||||
|
#else
|
||||||
|
_GL_CXXALIAS_SYS (towlower, wint_t, (wint_t wc));
|
||||||
|
_GL_CXXALIAS_SYS (towupper, wint_t, (wint_t wc));
|
||||||
|
#endif
|
||||||
|
_GL_CXXALIASWARN (towlower);
|
||||||
|
_GL_CXXALIASWARN (towupper);
|
||||||
|
|
||||||
|
#if !@HAVE_WCTRANS_T@
|
||||||
|
# if !GNULIB_defined_wctrans_t
|
||||||
|
typedef void * wctrans_t;
|
||||||
|
# define GNULIB_defined_wctrans_t 1
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Get a descriptor for a wide character case conversion. */
|
||||||
|
#if @GNULIB_WCTRANS@
|
||||||
|
# if !@HAVE_WCTRANS_T@
|
||||||
|
_GL_FUNCDECL_SYS (wctrans, wctrans_t, (const char *name));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (wctrans, wctrans_t, (const char *name));
|
||||||
|
_GL_CXXALIASWARN (wctrans);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef wctrans
|
||||||
|
# if HAVE_RAW_DECL_WCTRANS
|
||||||
|
_GL_WARN_ON_USE (wctrans, "wctrans is unportable - "
|
||||||
|
"use gnulib module wctrans for portability");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Perform a given case conversion on a wide character.
|
||||||
|
The argument WC must be either a wchar_t value or WEOF.
|
||||||
|
The argument DESC must have been returned by the wctrans() function. */
|
||||||
|
#if @GNULIB_TOWCTRANS@
|
||||||
|
# if !@HAVE_WCTRANS_T@
|
||||||
|
_GL_FUNCDECL_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (towctrans, wint_t, (wint_t wc, wctrans_t desc));
|
||||||
|
_GL_CXXALIASWARN (towctrans);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
# undef towctrans
|
||||||
|
# if HAVE_RAW_DECL_TOWCTRANS
|
||||||
|
_GL_WARN_ON_USE (towctrans, "towctrans is unportable - "
|
||||||
|
"use gnulib module towctrans for portability");
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _@GUARD_PREFIX@_WCTYPE_H */
|
||||||
|
#endif /* _@GUARD_PREFIX@_WCTYPE_H */
|
|
@ -255,9 +255,9 @@ SCM_DEFINE (scm_assq_set_x, "assq-set!", 3, 0, 0,
|
||||||
(SCM alist, SCM key, SCM val),
|
(SCM alist, SCM key, SCM val),
|
||||||
"@deffnx {Scheme Procedure} assv-set! alist key value\n"
|
"@deffnx {Scheme Procedure} assv-set! alist key value\n"
|
||||||
"@deffnx {Scheme Procedure} assoc-set! alist key value\n"
|
"@deffnx {Scheme Procedure} assoc-set! alist key value\n"
|
||||||
"Reassociate @var{key} in @var{alist} with @var{value}: find any existing\n"
|
"Reassociate @var{key} in @var{alist} with @var{val}: find any existing\n"
|
||||||
"@var{alist} entry for @var{key} and associate it with the new\n"
|
"@var{alist} entry for @var{key} and associate it with the new\n"
|
||||||
"@var{value}. If @var{alist} does not contain an entry for @var{key},\n"
|
"@var{val}. If @var{alist} does not contain an entry for @var{key},\n"
|
||||||
"add a new one. Return the (possibly new) alist.\n\n"
|
"add a new one. Return the (possibly new) alist.\n\n"
|
||||||
"These functions do not attempt to verify the structure of @var{alist},\n"
|
"These functions do not attempt to verify the structure of @var{alist},\n"
|
||||||
"and so may cause unusual results if passed an object that is not an\n"
|
"and so may cause unusual results if passed an object that is not an\n"
|
||||||
|
|
|
@ -320,8 +320,8 @@ scm_ramapc (void *cproc_ptr, SCM data, SCM ra0, SCM lra, const char *what)
|
||||||
|
|
||||||
SCM_DEFINE (scm_array_fill_x, "array-fill!", 2, 0, 0,
|
SCM_DEFINE (scm_array_fill_x, "array-fill!", 2, 0, 0,
|
||||||
(SCM ra, SCM fill),
|
(SCM ra, SCM fill),
|
||||||
"Store @var{fill} in every element of @var{array}. The value returned\n"
|
"Store @var{fill} in every element of array @var{ra}. The value\n"
|
||||||
"is unspecified.")
|
"returned is unspecified.")
|
||||||
#define FUNC_NAME s_scm_array_fill_x
|
#define FUNC_NAME s_scm_array_fill_x
|
||||||
{
|
{
|
||||||
scm_ramapc (scm_array_fill_int, fill, ra, SCM_EOL, FUNC_NAME);
|
scm_ramapc (scm_array_fill_int, fill, ra, SCM_EOL, FUNC_NAME);
|
||||||
|
@ -374,9 +374,9 @@ SCM_REGISTER_PROC(s_array_copy_in_order_x, "array-copy-in-order!", 2, 0, 0, scm_
|
||||||
SCM_DEFINE (scm_array_copy_x, "array-copy!", 2, 0, 0,
|
SCM_DEFINE (scm_array_copy_x, "array-copy!", 2, 0, 0,
|
||||||
(SCM src, SCM dst),
|
(SCM src, SCM dst),
|
||||||
"@deffnx {Scheme Procedure} array-copy-in-order! src dst\n"
|
"@deffnx {Scheme Procedure} array-copy-in-order! src dst\n"
|
||||||
"Copy every element from vector or array @var{source} to the\n"
|
"Copy every element from vector or array @var{src} to the\n"
|
||||||
"corresponding element of @var{destination}. @var{destination} must have\n"
|
"corresponding element of @var{dst}. @var{dst} must have the\n"
|
||||||
"the same rank as @var{source}, and be at least as large in each\n"
|
"same rank as @var{src}, and be at least as large in each\n"
|
||||||
"dimension. The order is unspecified.")
|
"dimension. The order is unspecified.")
|
||||||
#define FUNC_NAME s_scm_array_copy_x
|
#define FUNC_NAME s_scm_array_copy_x
|
||||||
{
|
{
|
||||||
|
@ -670,12 +670,13 @@ SCM_SYMBOL (sym_b, "b");
|
||||||
SCM_DEFINE (scm_array_map_x, "array-map!", 2, 0, 1,
|
SCM_DEFINE (scm_array_map_x, "array-map!", 2, 0, 1,
|
||||||
(SCM ra0, SCM proc, SCM lra),
|
(SCM ra0, SCM proc, SCM lra),
|
||||||
"@deffnx {Scheme Procedure} array-map-in-order! ra0 proc . lra\n"
|
"@deffnx {Scheme Procedure} array-map-in-order! ra0 proc . lra\n"
|
||||||
"@var{array1}, @dots{} must have the same number of dimensions as\n"
|
"@var{array1}, @dots{} must have the same number of dimensions\n"
|
||||||
"@var{array0} and have a range for each index which includes the range\n"
|
"as @var{ra0} and have a range for each index which includes the\n"
|
||||||
"for the corresponding index in @var{array0}. @var{proc} is applied to\n"
|
"range for the corresponding index in @var{ra0}. @var{proc} is\n"
|
||||||
"each tuple of elements of @var{array1} @dots{} and the result is stored\n"
|
"applied to each tuple of elements of @var{array1}, @dots{} and\n"
|
||||||
"as the corresponding element in @var{array0}. The value returned is\n"
|
"the result is stored as the corresponding element in @var{ra0}.\n"
|
||||||
"unspecified. The order of application is unspecified.")
|
"The value returned is unspecified. The order of application is\n"
|
||||||
|
"unspecified.")
|
||||||
#define FUNC_NAME s_scm_array_map_x
|
#define FUNC_NAME s_scm_array_map_x
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_PROC (2, proc);
|
SCM_VALIDATE_PROC (2, proc);
|
||||||
|
@ -722,7 +723,7 @@ rafe (SCM ra0, SCM proc, SCM ras)
|
||||||
|
|
||||||
SCM_DEFINE (scm_array_for_each, "array-for-each", 2, 0, 1,
|
SCM_DEFINE (scm_array_for_each, "array-for-each", 2, 0, 1,
|
||||||
(SCM proc, SCM ra0, SCM lra),
|
(SCM proc, SCM ra0, SCM lra),
|
||||||
"Apply @var{proc} to each tuple of elements of @var{array0} @dots{}\n"
|
"Apply @var{proc} to each tuple of elements of @var{ra0} @dots{}\n"
|
||||||
"in row-major order. The value returned is unspecified.")
|
"in row-major order. The value returned is unspecified.")
|
||||||
#define FUNC_NAME s_scm_array_for_each
|
#define FUNC_NAME s_scm_array_for_each
|
||||||
{
|
{
|
||||||
|
@ -735,7 +736,7 @@ SCM_DEFINE (scm_array_for_each, "array-for-each", 2, 0, 1,
|
||||||
|
|
||||||
SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
(SCM ra, SCM proc),
|
(SCM ra, SCM proc),
|
||||||
"Apply @var{proc} to the indices of each element of @var{array} in\n"
|
"Apply @var{proc} to the indices of each element of @var{ra} in\n"
|
||||||
"turn, storing the result in the corresponding element. The value\n"
|
"turn, storing the result in the corresponding element. The value\n"
|
||||||
"returned and the order of application are unspecified.\n\n"
|
"returned and the order of application are unspecified.\n\n"
|
||||||
"One can implement @var{array-indexes} as\n"
|
"One can implement @var{array-indexes} as\n"
|
||||||
|
|
|
@ -326,11 +326,12 @@ scm_i_ra_set_contp (SCM ra)
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
|
SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
|
||||||
(SCM oldra, SCM mapfunc, SCM dims),
|
(SCM oldra, SCM mapfunc, SCM dims),
|
||||||
"@code{make-shared-array} can be used to create shared subarrays of other\n"
|
"@code{make-shared-array} can be used to create shared subarrays\n"
|
||||||
"arrays. The @var{mapper} is a function that translates coordinates in\n"
|
"of other arrays. The @var{mapfunc} is a function that\n"
|
||||||
"the new array into coordinates in the old array. A @var{mapper} must be\n"
|
"translates coordinates in the new array into coordinates in the\n"
|
||||||
"linear, and its range must stay within the bounds of the old array, but\n"
|
"old array. A @var{mapfunc} must be linear, and its range must\n"
|
||||||
"it can be otherwise arbitrary. A simple example:\n"
|
"stay within the bounds of the old array, but it can be\n"
|
||||||
|
"otherwise arbitrary. A simple example:\n"
|
||||||
"@lisp\n"
|
"@lisp\n"
|
||||||
"(define fred (make-array #f 8 8))\n"
|
"(define fred (make-array #f 8 8))\n"
|
||||||
"(define freds-diagonal\n"
|
"(define freds-diagonal\n"
|
||||||
|
@ -444,18 +445,18 @@ SCM_DEFINE (scm_make_shared_array, "make-shared-array", 2, 0, 1,
|
||||||
/* args are RA . DIMS */
|
/* args are RA . DIMS */
|
||||||
SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
||||||
(SCM ra, SCM args),
|
(SCM ra, SCM args),
|
||||||
"Return an array sharing contents with @var{array}, but with\n"
|
"Return an array sharing contents with @var{ra}, but with\n"
|
||||||
"dimensions arranged in a different order. There must be one\n"
|
"dimensions arranged in a different order. There must be one\n"
|
||||||
"@var{dim} argument for each dimension of @var{array}.\n"
|
"@var{dim} argument for each dimension of @var{ra}.\n"
|
||||||
"@var{dim0}, @var{dim1}, @dots{} should be integers between 0\n"
|
"@var{dim0}, @var{dim1}, @dots{} should be integers between 0\n"
|
||||||
"and the rank of the array to be returned. Each integer in that\n"
|
"and the rank of the array to be returned. Each integer in that\n"
|
||||||
"range must appear at least once in the argument list.\n"
|
"range must appear at least once in the argument list.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The values of @var{dim0}, @var{dim1}, @dots{} correspond to\n"
|
"The values of @var{dim0}, @var{dim1}, @dots{} correspond to\n"
|
||||||
"dimensions in the array to be returned, their positions in the\n"
|
"dimensions in the array to be returned, their positions in the\n"
|
||||||
"argument list to dimensions of @var{array}. Several @var{dim}s\n"
|
"argument list to dimensions of @var{ra}. Several @var{dim}s\n"
|
||||||
"may have the same value, in which case the returned array will\n"
|
"may have the same value, in which case the returned array will\n"
|
||||||
"have smaller rank than @var{array}.\n"
|
"have smaller rank than @var{ra}.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"@lisp\n"
|
"@lisp\n"
|
||||||
"(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))\n"
|
"(transpose-array '#2((a b) (c d)) 1 0) @result{} #2((a c) (b d))\n"
|
||||||
|
@ -546,15 +547,15 @@ SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
|
||||||
wouldn't have contiguous elements. */
|
wouldn't have contiguous elements. */
|
||||||
SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
|
SCM_DEFINE (scm_array_contents, "array-contents", 1, 1, 0,
|
||||||
(SCM ra, SCM strict),
|
(SCM ra, SCM strict),
|
||||||
"If @var{array} may be @dfn{unrolled} into a one dimensional shared array\n"
|
"If @var{ra} may be @dfn{unrolled} into a one dimensional shared\n"
|
||||||
"without changing their order (last subscript changing fastest), then\n"
|
"array without changing their order (last subscript changing\n"
|
||||||
"@code{array-contents} returns that shared array, otherwise it returns\n"
|
"fastest), then @code{array-contents} returns that shared array,\n"
|
||||||
"@code{#f}. All arrays made by @var{make-array} and\n"
|
"otherwise it returns @code{#f}. All arrays made by\n"
|
||||||
"@var{make-uniform-array} may be unrolled, some arrays made by\n"
|
"@code{make-array} and @code{make-uniform-array} may be unrolled,\n"
|
||||||
"@var{make-shared-array} may not be.\n\n"
|
"some arrays made by @code{make-shared-array} may not be. If\n"
|
||||||
"If the optional argument @var{strict} is provided, a shared array will\n"
|
"the optional argument @var{strict} is provided, a shared array\n"
|
||||||
"be returned only if its elements are stored internally contiguous in\n"
|
"will be returned only if its elements are stored internally\n"
|
||||||
"memory.")
|
"contiguous in memory.")
|
||||||
#define FUNC_NAME s_scm_array_contents
|
#define FUNC_NAME s_scm_array_contents
|
||||||
{
|
{
|
||||||
SCM sra;
|
SCM sra;
|
||||||
|
|
|
@ -497,7 +497,7 @@ SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0,
|
||||||
"Return the index of the first occurrence of @var{item} in bit\n"
|
"Return the index of the first occurrence of @var{item} in bit\n"
|
||||||
"vector @var{v}, starting from @var{k}. If there is no\n"
|
"vector @var{v}, starting from @var{k}. If there is no\n"
|
||||||
"@var{item} entry between @var{k} and the end of\n"
|
"@var{item} entry between @var{k} and the end of\n"
|
||||||
"@var{bitvector}, then return @code{#f}. For example,\n"
|
"@var{v}, then return @code{#f}. For example,\n"
|
||||||
"\n"
|
"\n"
|
||||||
"@example\n"
|
"@example\n"
|
||||||
"(bit-position #t #*000101 0) @result{} 3\n"
|
"(bit-position #t #*000101 0) @result{} 3\n"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1995,1996,1998,2000,2001,2004, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -71,34 +71,33 @@ static scm_t_bits tc16_continuation;
|
||||||
#define META_HEADER(meta) meta, 0, 0, 0, 0, 0, 0, 0
|
#define META_HEADER(meta) meta, 0, 0, 0, 0, 0, 0, 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ALIGN_PTR(type,p,align) (type*)(ROUND_UP (((scm_t_bits)p), align))
|
#define OBJCODE_TAG SCM_MAKE_OBJCODE_TAG (SCM_OBJCODE_TYPE_STATIC, 0)
|
||||||
|
|
||||||
#ifdef SCM_ALIGNED
|
#if defined (SCM_ALIGNED) && 0
|
||||||
#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
|
#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
|
||||||
static const type sym[]
|
static const type sym[]
|
||||||
#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
|
#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
|
||||||
static SCM_ALIGNED (alignment) const type sym[]
|
static SCM_ALIGNED (alignment) const type sym[]
|
||||||
#else
|
|
||||||
#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
|
|
||||||
static type *sym
|
|
||||||
#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
|
|
||||||
SCM_SNARF_INIT(sym = scm_malloc_pointerless (sizeof(sym##__unaligned)); \
|
|
||||||
memcpy (sym, sym##__unaligned, sizeof(sym##__unaligned));) \
|
|
||||||
static type *sym = NULL; \
|
|
||||||
static const type sym##__unaligned[]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STATIC_OBJCODE_TAG \
|
|
||||||
SCM_PACK (SCM_MAKE_OBJCODE_TAG (SCM_OBJCODE_TYPE_STATIC, 0))
|
|
||||||
|
|
||||||
#define SCM_STATIC_OBJCODE(sym) \
|
#define SCM_STATIC_OBJCODE(sym) \
|
||||||
SCM_DECLARE_STATIC_ALIGNED_ARRAY (scm_t_uint8, sym##__bytecode); \
|
SCM_DECLARE_STATIC_ALIGNED_ARRAY (scm_t_uint8, sym##__bytecode); \
|
||||||
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_cell, sym##__cells) = { \
|
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_cell, sym##__cells) = { \
|
||||||
{ STATIC_OBJCODE_TAG, SCM_PACK (sym##__bytecode) }, \
|
{ SCM_PACK (OBJCODE_TAG), SCM_PACK (sym##__bytecode) }, \
|
||||||
{ SCM_BOOL_F, SCM_PACK (0) } \
|
{ SCM_BOOL_F, SCM_PACK (0) } \
|
||||||
}; \
|
}; \
|
||||||
static const SCM sym = SCM_PACK (sym##__cells); \
|
static const SCM sym = SCM_PACK (sym##__cells); \
|
||||||
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_uint8, sym##__bytecode)
|
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_uint8, sym##__bytecode)
|
||||||
|
#else
|
||||||
|
#define SCM_STATIC_OBJCODE(sym) \
|
||||||
|
static SCM sym; \
|
||||||
|
static scm_t_uint8 *sym##_bytecode; \
|
||||||
|
SCM_SNARF_INIT(sym##_bytecode = scm_gc_malloc_pointerless (sizeof(sym##_bytecode__unaligned), "partial continuation stub"); \
|
||||||
|
memcpy (sym##_bytecode, sym##_bytecode__unaligned, sizeof(sym##_bytecode__unaligned));) \
|
||||||
|
SCM_SNARF_INIT(sym = scm_double_cell (OBJCODE_TAG, \
|
||||||
|
(scm_t_bits)sym##_bytecode, \
|
||||||
|
SCM_UNPACK (SCM_BOOL_F), \
|
||||||
|
0);) \
|
||||||
|
static const scm_t_uint8 sym##_bytecode__unaligned[]
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SCM_STATIC_OBJCODE (cont_objcode) = {
|
SCM_STATIC_OBJCODE (cont_objcode) = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -81,34 +81,33 @@ scm_i_prompt_pop_abort_args_x (SCM vm)
|
||||||
#define META_HEADER(meta) meta, 0, 0, 0, 0, 0, 0, 0
|
#define META_HEADER(meta) meta, 0, 0, 0, 0, 0, 0, 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define ALIGN_PTR(type,p,align) (type*)(ROUND_UP (((scm_t_bits)p), align))
|
#define OBJCODE_TAG SCM_MAKE_OBJCODE_TAG (SCM_OBJCODE_TYPE_STATIC, 0)
|
||||||
|
|
||||||
#ifdef SCM_ALIGNED
|
#if defined (SCM_ALIGNED)
|
||||||
#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
|
#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
|
||||||
static const type sym[]
|
static const type sym[]
|
||||||
#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
|
#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
|
||||||
static SCM_ALIGNED (alignment) const type sym[]
|
static SCM_ALIGNED (alignment) const type sym[]
|
||||||
#else
|
|
||||||
#define SCM_DECLARE_STATIC_ALIGNED_ARRAY(type, sym) \
|
|
||||||
static type *sym
|
|
||||||
#define SCM_STATIC_ALIGNED_ARRAY(alignment, type, sym) \
|
|
||||||
SCM_SNARF_INIT(sym = scm_malloc_pointerless (sizeof(sym##__unaligned); \
|
|
||||||
memcpy (sym, sym##__unaligned, sizeof(sym##__unaligned));) \
|
|
||||||
static type *sym = NULL; \
|
|
||||||
static const type sym##__unaligned[]
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define STATIC_OBJCODE_TAG \
|
|
||||||
SCM_PACK (SCM_MAKE_OBJCODE_TAG (SCM_OBJCODE_TYPE_STATIC, 0))
|
|
||||||
|
|
||||||
#define SCM_STATIC_OBJCODE(sym) \
|
#define SCM_STATIC_OBJCODE(sym) \
|
||||||
SCM_DECLARE_STATIC_ALIGNED_ARRAY (scm_t_uint8, sym##__bytecode); \
|
SCM_DECLARE_STATIC_ALIGNED_ARRAY (scm_t_uint8, sym##__bytecode); \
|
||||||
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_cell, sym##__cells) = { \
|
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_cell, sym##__cells) = { \
|
||||||
{ STATIC_OBJCODE_TAG, SCM_PACK (sym##__bytecode) }, \
|
{ SCM_PACK (OBJCODE_TAG), SCM_PACK (sym##__bytecode) }, \
|
||||||
{ SCM_BOOL_F, SCM_PACK (0) } \
|
{ SCM_BOOL_F, SCM_PACK (0) } \
|
||||||
}; \
|
}; \
|
||||||
static const SCM sym = SCM_PACK (sym##__cells); \
|
static const SCM sym = SCM_PACK (sym##__cells); \
|
||||||
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_uint8, sym##__bytecode)
|
SCM_STATIC_ALIGNED_ARRAY (8, scm_t_uint8, sym##__bytecode)
|
||||||
|
#else
|
||||||
|
#define SCM_STATIC_OBJCODE(sym) \
|
||||||
|
static SCM sym; \
|
||||||
|
static scm_t_uint8 *sym##_bytecode; \
|
||||||
|
SCM_SNARF_INIT(sym##_bytecode = scm_gc_malloc_pointerless (sizeof(sym##_bytecode__unaligned), "partial continuation stub"); \
|
||||||
|
memcpy (sym##_bytecode, sym##_bytecode__unaligned, sizeof(sym##_bytecode__unaligned));) \
|
||||||
|
SCM_SNARF_INIT(sym = scm_double_cell (OBJCODE_TAG, \
|
||||||
|
(scm_t_bits)sym##_bytecode, \
|
||||||
|
SCM_UNPACK (SCM_BOOL_F), \
|
||||||
|
0);) \
|
||||||
|
static const scm_t_uint8 sym##_bytecode__unaligned[]
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SCM_STATIC_OBJCODE (cont_objcode) = {
|
SCM_STATIC_OBJCODE (cont_objcode) = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004, 2006, 2010 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2004, 2006, 2010,
|
||||||
|
* 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -99,7 +100,7 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#if defined __MINGW32__ && defined HAVE_NETWORKING
|
||||||
# include "win32-socket.h"
|
# include "win32-socket.h"
|
||||||
# define SCM_I_STRERROR(err) \
|
# define SCM_I_STRERROR(err) \
|
||||||
((err >= WSABASEERR) ? scm_i_socket_strerror (err) : strerror (err))
|
((err >= WSABASEERR) ? scm_i_socket_strerror (err) : strerror (err))
|
||||||
|
|
|
@ -465,7 +465,7 @@ static int fstat_Win32 (int fdes, struct stat *buf)
|
||||||
SCM_DEFINE (scm_stat, "stat", 1, 1, 0,
|
SCM_DEFINE (scm_stat, "stat", 1, 1, 0,
|
||||||
(SCM object, SCM exception_on_error),
|
(SCM object, SCM exception_on_error),
|
||||||
"Return an object containing various information about the file\n"
|
"Return an object containing various information about the file\n"
|
||||||
"determined by @var{obj}. @var{obj} can be a string containing\n"
|
"determined by @var{object}. @var{object} can be a string containing\n"
|
||||||
"a file name or a port or integer file descriptor which is open\n"
|
"a file name or a port or integer file descriptor which is open\n"
|
||||||
"on a file (in which case @code{fstat} is used as the underlying\n"
|
"on a file (in which case @code{fstat} is used as the underlying\n"
|
||||||
"system call).\n"
|
"system call).\n"
|
||||||
|
@ -586,7 +586,7 @@ SCM_DEFINE (scm_lstat, "lstat", 1, 0, 0,
|
||||||
(SCM str),
|
(SCM str),
|
||||||
"Similar to @code{stat}, but does not follow symbolic links, i.e.,\n"
|
"Similar to @code{stat}, but does not follow symbolic links, i.e.,\n"
|
||||||
"it will return information about a symbolic link itself, not the\n"
|
"it will return information about a symbolic link itself, not the\n"
|
||||||
"file it points to. @var{path} must be a string.")
|
"file it points to. @var{str} must be a string.")
|
||||||
#define FUNC_NAME s_scm_lstat
|
#define FUNC_NAME s_scm_lstat
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -640,7 +640,7 @@ SCM_DEFINE (scm_link, "link", 2, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_chdir, "chdir", 1, 0, 0,
|
SCM_DEFINE (scm_chdir, "chdir", 1, 0, 0,
|
||||||
(SCM str),
|
(SCM str),
|
||||||
"Change the current working directory to @var{path}.\n"
|
"Change the current working directory to @var{str}.\n"
|
||||||
"The return value is unspecified.")
|
"The return value is unspecified.")
|
||||||
#define FUNC_NAME s_scm_chdir
|
#define FUNC_NAME s_scm_chdir
|
||||||
{
|
{
|
||||||
|
@ -942,10 +942,10 @@ SCM_DEFINE (scm_select, "select", 3, 2, 0,
|
||||||
#ifdef HAVE_FCNTL
|
#ifdef HAVE_FCNTL
|
||||||
SCM_DEFINE (scm_fcntl, "fcntl", 2, 1, 0,
|
SCM_DEFINE (scm_fcntl, "fcntl", 2, 1, 0,
|
||||||
(SCM object, SCM cmd, SCM value),
|
(SCM object, SCM cmd, SCM value),
|
||||||
"Apply @var{command} to the specified file descriptor or the underlying\n"
|
"Apply @var{cmd} to the specified file descriptor or the underlying\n"
|
||||||
"file descriptor of the specified port. @var{value} is an optional\n"
|
"file descriptor of the specified port. @var{value} is an optional\n"
|
||||||
"integer argument.\n\n"
|
"integer argument.\n\n"
|
||||||
"Values for @var{command} are:\n\n"
|
"Values for @var{cmd} are:\n\n"
|
||||||
"@table @code\n"
|
"@table @code\n"
|
||||||
"@item F_DUPFD\n"
|
"@item F_DUPFD\n"
|
||||||
"Duplicate a file descriptor\n"
|
"Duplicate a file descriptor\n"
|
||||||
|
@ -993,9 +993,9 @@ SCM_DEFINE (scm_fcntl, "fcntl", 2, 1, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_fsync, "fsync", 1, 0, 0,
|
SCM_DEFINE (scm_fsync, "fsync", 1, 0, 0,
|
||||||
(SCM object),
|
(SCM object),
|
||||||
"Copies any unwritten data for the specified output file descriptor to disk.\n"
|
"Copies any unwritten data for the specified output file\n"
|
||||||
"If @var{port/fd} is a port, its buffer is flushed before the underlying\n"
|
"descriptor to disk. If @var{object} is a port, its buffer is\n"
|
||||||
"file descriptor is fsync'd.\n"
|
"flushed before the underlying file descriptor is fsync'd.\n"
|
||||||
"The return value is unspecified.")
|
"The return value is unspecified.")
|
||||||
#define FUNC_NAME s_scm_fsync
|
#define FUNC_NAME s_scm_fsync
|
||||||
{
|
{
|
||||||
|
@ -1020,8 +1020,9 @@ SCM_DEFINE (scm_fsync, "fsync", 1, 0, 0,
|
||||||
#ifdef HAVE_SYMLINK
|
#ifdef HAVE_SYMLINK
|
||||||
SCM_DEFINE (scm_symlink, "symlink", 2, 0, 0,
|
SCM_DEFINE (scm_symlink, "symlink", 2, 0, 0,
|
||||||
(SCM oldpath, SCM newpath),
|
(SCM oldpath, SCM newpath),
|
||||||
"Create a symbolic link named @var{path-to} with the value (i.e., pointing to)\n"
|
"Create a symbolic link named @var{oldpath} with the value\n"
|
||||||
"@var{path-from}. The return value is unspecified.")
|
"(i.e., pointing to) @var{newpath}. The return value is\n"
|
||||||
|
"unspecified.")
|
||||||
#define FUNC_NAME s_scm_symlink
|
#define FUNC_NAME s_scm_symlink
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
@ -1079,7 +1080,7 @@ SCM_DEFINE (scm_readlink, "readlink", 1, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_copy_file, "copy-file", 2, 0, 0,
|
SCM_DEFINE (scm_copy_file, "copy-file", 2, 0, 0,
|
||||||
(SCM oldfile, SCM newfile),
|
(SCM oldfile, SCM newfile),
|
||||||
"Copy the file specified by @var{path-from} to @var{path-to}.\n"
|
"Copy the file specified by @var{oldfile} to @var{newfile}.\n"
|
||||||
"The return value is unspecified.")
|
"The return value is unspecified.")
|
||||||
#define FUNC_NAME s_scm_copy_file
|
#define FUNC_NAME s_scm_copy_file
|
||||||
{
|
{
|
||||||
|
@ -1257,7 +1258,7 @@ SCM_DEFINE (scm_rename, "rename-file", 2, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_delete_file, "delete-file", 1, 0, 0,
|
SCM_DEFINE (scm_delete_file, "delete-file", 1, 0, 0,
|
||||||
(SCM str),
|
(SCM str),
|
||||||
"Deletes (or \"unlinks\") the file specified by @var{path}.")
|
"Deletes (or \"unlinks\") the file specified by @var{str}.")
|
||||||
#define FUNC_NAME s_scm_delete_file
|
#define FUNC_NAME s_scm_delete_file
|
||||||
{
|
{
|
||||||
int ans;
|
int ans;
|
||||||
|
@ -1325,12 +1326,12 @@ SCM_DEFINE (scm_access, "access?", 2, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_chmod, "chmod", 2, 0, 0,
|
SCM_DEFINE (scm_chmod, "chmod", 2, 0, 0,
|
||||||
(SCM object, SCM mode),
|
(SCM object, SCM mode),
|
||||||
"Changes the permissions of the file referred to by @var{obj}.\n"
|
"Changes the permissions of the file referred to by\n"
|
||||||
"@var{obj} can be a string containing a file name or a port or integer file\n"
|
"@var{object}. @var{object} can be a string containing a file\n"
|
||||||
"descriptor which is open on a file (in which case @code{fchmod} is used\n"
|
"name or a port or integer file descriptor which is open on a\n"
|
||||||
"as the underlying system call).\n"
|
"file (in which case @code{fchmod} is used as the underlying\n"
|
||||||
"@var{mode} specifies\n"
|
"system call). @var{mode} specifies the new permissions as a\n"
|
||||||
"the new permissions as a decimal number, e.g., @code{(chmod \"foo\" #o755)}.\n"
|
"decimal number, e.g., @code{(chmod \"foo\" #o755)}.\n"
|
||||||
"The return value is unspecified.")
|
"The return value is unspecified.")
|
||||||
#define FUNC_NAME s_scm_chmod
|
#define FUNC_NAME s_scm_chmod
|
||||||
{
|
{
|
||||||
|
@ -1488,7 +1489,7 @@ SCM_DEFINE (scm_basename, "basename", 1, 1, 0,
|
||||||
"Return the base name of the file name @var{filename}. The\n"
|
"Return the base name of the file name @var{filename}. The\n"
|
||||||
"base name is the file name without any directory components.\n"
|
"base name is the file name without any directory components.\n"
|
||||||
"If @var{suffix} is provided, and is equal to the end of\n"
|
"If @var{suffix} is provided, and is equal to the end of\n"
|
||||||
"@var{basename}, it is removed also.")
|
"@var{filename}, it is removed also.")
|
||||||
#define FUNC_NAME s_scm_basename
|
#define FUNC_NAME s_scm_basename
|
||||||
{
|
{
|
||||||
int i, j, len, end;
|
int i, j, len, end;
|
||||||
|
@ -1625,7 +1626,7 @@ scm_t_bits scm_tc16_dir;
|
||||||
|
|
||||||
SCM_DEFINE (scm_directory_stream_p, "directory-stream?", 1, 0, 0,
|
SCM_DEFINE (scm_directory_stream_p, "directory-stream?", 1, 0, 0,
|
||||||
(SCM obj),
|
(SCM obj),
|
||||||
"Return a boolean indicating whether @var{object} is a directory\n"
|
"Return a boolean indicating whether @var{obj} is a directory\n"
|
||||||
"stream as returned by @code{opendir}.")
|
"stream as returned by @code{opendir}.")
|
||||||
#define FUNC_NAME s_scm_directory_stream_p
|
#define FUNC_NAME s_scm_directory_stream_p
|
||||||
{
|
{
|
||||||
|
@ -1636,7 +1637,7 @@ SCM_DEFINE (scm_directory_stream_p, "directory-stream?", 1, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_opendir, "opendir", 1, 0, 0,
|
SCM_DEFINE (scm_opendir, "opendir", 1, 0, 0,
|
||||||
(SCM dirname),
|
(SCM dirname),
|
||||||
"Open the directory specified by @var{path} and return a directory\n"
|
"Open the directory specified by @var{dirname} and return a directory\n"
|
||||||
"stream.")
|
"stream.")
|
||||||
#define FUNC_NAME s_scm_opendir
|
#define FUNC_NAME s_scm_opendir
|
||||||
{
|
{
|
||||||
|
@ -1658,7 +1659,7 @@ SCM_DEFINE (scm_opendir, "opendir", 1, 0, 0,
|
||||||
SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0,
|
SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0,
|
||||||
(SCM port),
|
(SCM port),
|
||||||
"Return (as a string) the next directory entry from the directory stream\n"
|
"Return (as a string) the next directory entry from the directory stream\n"
|
||||||
"@var{stream}. If there is no remaining entry to be read then the\n"
|
"@var{port}. If there is no remaining entry to be read then the\n"
|
||||||
"end of file object is returned.")
|
"end of file object is returned.")
|
||||||
#define FUNC_NAME s_scm_readdir
|
#define FUNC_NAME s_scm_readdir
|
||||||
{
|
{
|
||||||
|
@ -1732,7 +1733,7 @@ SCM_DEFINE (scm_readdir, "readdir", 1, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_rewinddir, "rewinddir", 1, 0, 0,
|
SCM_DEFINE (scm_rewinddir, "rewinddir", 1, 0, 0,
|
||||||
(SCM port),
|
(SCM port),
|
||||||
"Reset the directory port @var{stream} so that the next call to\n"
|
"Reset the directory port @var{port} so that the next call to\n"
|
||||||
"@code{readdir} will return the first directory entry.")
|
"@code{readdir} will return the first directory entry.")
|
||||||
#define FUNC_NAME s_scm_rewinddir
|
#define FUNC_NAME s_scm_rewinddir
|
||||||
{
|
{
|
||||||
|
@ -1749,7 +1750,7 @@ SCM_DEFINE (scm_rewinddir, "rewinddir", 1, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_closedir, "closedir", 1, 0, 0,
|
SCM_DEFINE (scm_closedir, "closedir", 1, 0, 0,
|
||||||
(SCM port),
|
(SCM port),
|
||||||
"Close the directory stream @var{stream}.\n"
|
"Close the directory stream @var{port}.\n"
|
||||||
"The return value is unspecified.")
|
"The return value is unspecified.")
|
||||||
#define FUNC_NAME s_scm_closedir
|
#define FUNC_NAME s_scm_closedir
|
||||||
{
|
{
|
||||||
|
|
|
@ -136,6 +136,15 @@ SCM_DEFINE (scm_make_pointer, "make-pointer", 1, 1, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
void *
|
||||||
|
scm_to_pointer (SCM pointer)
|
||||||
|
#define FUNC_NAME "scm_to_pointer"
|
||||||
|
{
|
||||||
|
SCM_VALIDATE_POINTER (1, pointer);
|
||||||
|
return SCM_POINTER_VALUE (pointer);
|
||||||
|
}
|
||||||
|
#undef FUNC_NAME
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_from_pointer (void *ptr, scm_t_pointer_finalizer finalizer)
|
scm_from_pointer (void *ptr, scm_t_pointer_finalizer finalizer)
|
||||||
{
|
{
|
||||||
|
@ -1138,11 +1147,11 @@ invoke_closure (ffi_cif *cif, void *ret, void **args, void *data)
|
||||||
|
|
||||||
SCM_DEFINE (scm_procedure_to_pointer, "procedure->pointer", 3, 0, 0,
|
SCM_DEFINE (scm_procedure_to_pointer, "procedure->pointer", 3, 0, 0,
|
||||||
(SCM return_type, SCM proc, SCM arg_types),
|
(SCM return_type, SCM proc, SCM arg_types),
|
||||||
"Return a pointer to a C function of type @var{return-type}\n"
|
"Return a pointer to a C function of type @var{return_type}\n"
|
||||||
"taking arguments of types @var{arg-types} (a list) and\n"
|
"taking arguments of types @var{arg_types} (a list) and\n"
|
||||||
"behaving as a proxy to procedure @var{proc}. Thus\n"
|
"behaving as a proxy to procedure @var{proc}. Thus\n"
|
||||||
"@var{proc}'s arity, supported argument types, and return\n"
|
"@var{proc}'s arity, supported argument types, and return\n"
|
||||||
"type should match @var{return-type} and @var{arg-types}.\n")
|
"type should match @var{return_type} and @var{arg_types}.\n")
|
||||||
#define FUNC_NAME s_scm_procedure_to_pointer
|
#define FUNC_NAME s_scm_procedure_to_pointer
|
||||||
{
|
{
|
||||||
SCM cif_pointer, pointer;
|
SCM cif_pointer, pointer;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef SCM_FOREIGN_H
|
#ifndef SCM_FOREIGN_H
|
||||||
#define SCM_FOREIGN_H
|
#define SCM_FOREIGN_H
|
||||||
|
|
||||||
/* Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -23,8 +23,7 @@
|
||||||
|
|
||||||
/* A "foreign pointer" is a wrapped C pointer. It is represented by a
|
/* A "foreign pointer" is a wrapped C pointer. It is represented by a
|
||||||
cell whose second word is a pointer. The first word has the
|
cell whose second word is a pointer. The first word has the
|
||||||
`scm_tc7_pointer' type code and a bit saying whether it has an
|
`scm_tc7_pointer' type code.
|
||||||
associated finalizer or not.
|
|
||||||
|
|
||||||
The basic idea is that we can help the programmer to avoid cutting herself,
|
The basic idea is that we can help the programmer to avoid cutting herself,
|
||||||
but we won't take away her knives. */
|
but we won't take away her knives. */
|
||||||
|
@ -55,6 +54,7 @@ typedef void (*scm_t_pointer_finalizer) (void *);
|
||||||
#define SCM_POINTER_VALUE(x) \
|
#define SCM_POINTER_VALUE(x) \
|
||||||
((void *) SCM_CELL_WORD_1 (x))
|
((void *) SCM_CELL_WORD_1 (x))
|
||||||
|
|
||||||
|
SCM_API void *scm_to_pointer (SCM pointer);
|
||||||
SCM_API SCM scm_from_pointer (void *, scm_t_pointer_finalizer);
|
SCM_API SCM scm_from_pointer (void *, scm_t_pointer_finalizer);
|
||||||
|
|
||||||
SCM_API SCM scm_alignof (SCM type);
|
SCM_API SCM scm_alignof (SCM type);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
* 2004, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
* 2004, 2006, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -76,6 +76,49 @@ extern unsigned long * __libc_ia64_register_backing_store_base;
|
||||||
/* #define DEBUGINFO */
|
/* #define DEBUGINFO */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void*
|
||||||
|
do_realloc (void *from, size_t new_size)
|
||||||
|
{
|
||||||
|
scm_gc_register_allocation (new_size);
|
||||||
|
return realloc (from, new_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void*
|
||||||
|
do_calloc (size_t n, size_t size)
|
||||||
|
{
|
||||||
|
scm_gc_register_allocation (size);
|
||||||
|
return calloc (n, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void*
|
||||||
|
do_gc_malloc (size_t size, const char *what)
|
||||||
|
{
|
||||||
|
/* Ensure nonzero size to be compatible with always-nonzero return of
|
||||||
|
glibc malloc. */
|
||||||
|
return GC_MALLOC (size ? size : sizeof (void *));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void*
|
||||||
|
do_gc_malloc_atomic (size_t size, const char *what)
|
||||||
|
{
|
||||||
|
return GC_MALLOC_ATOMIC (size ? size : sizeof (void *));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void*
|
||||||
|
do_gc_realloc (void *from, size_t size, const char *what)
|
||||||
|
{
|
||||||
|
return GC_REALLOC (from, size ? size : sizeof (void *));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_gc_free (void *ptr)
|
||||||
|
{
|
||||||
|
GC_FREE (ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Function for non-cell memory management.
|
/* Function for non-cell memory management.
|
||||||
*/
|
*/
|
||||||
|
@ -85,10 +128,9 @@ scm_realloc (void *mem, size_t size)
|
||||||
{
|
{
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
||||||
scm_gc_register_allocation (size);
|
ptr = do_realloc (mem, size);
|
||||||
|
|
||||||
SCM_SYSCALL (ptr = realloc (mem, size));
|
if (ptr || size == 0)
|
||||||
if (ptr)
|
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
/* Time is hard: trigger a full, ``stop-the-world'' GC, and try again. */
|
/* Time is hard: trigger a full, ``stop-the-world'' GC, and try again. */
|
||||||
|
@ -98,7 +140,7 @@ scm_realloc (void *mem, size_t size)
|
||||||
GC_gcollect ();
|
GC_gcollect ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SCM_SYSCALL (ptr = realloc (mem, size));
|
ptr = do_realloc (mem, size);
|
||||||
if (ptr)
|
if (ptr)
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
|
@ -124,8 +166,8 @@ scm_calloc (size_t sz)
|
||||||
By default, try to use calloc, as it is likely more efficient than
|
By default, try to use calloc, as it is likely more efficient than
|
||||||
calling memset by hand.
|
calling memset by hand.
|
||||||
*/
|
*/
|
||||||
SCM_SYSCALL (ptr = calloc (sz, 1));
|
ptr = do_calloc (sz, 1);
|
||||||
if (ptr)
|
if (ptr || sz == 0)
|
||||||
return ptr;
|
return ptr;
|
||||||
|
|
||||||
ptr = scm_realloc (NULL, sz);
|
ptr = scm_realloc (NULL, sz);
|
||||||
|
@ -180,57 +222,38 @@ scm_gc_unregister_collectable_memory (void *mem, size_t size, const char *what)
|
||||||
void *
|
void *
|
||||||
scm_gc_malloc_pointerless (size_t size, const char *what)
|
scm_gc_malloc_pointerless (size_t size, const char *what)
|
||||||
{
|
{
|
||||||
return GC_MALLOC_ATOMIC (size);
|
return do_gc_malloc_atomic (size, what);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
scm_gc_malloc (size_t size, const char *what)
|
scm_gc_malloc (size_t size, const char *what)
|
||||||
{
|
{
|
||||||
void *ptr;
|
return do_gc_malloc (size, what);
|
||||||
|
|
||||||
if (size == 0)
|
|
||||||
/* `GC_MALLOC ()' doesn't handle zero. */
|
|
||||||
size = sizeof (void *);
|
|
||||||
|
|
||||||
ptr = GC_MALLOC (size);
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
scm_gc_calloc (size_t size, const char *what)
|
scm_gc_calloc (size_t size, const char *what)
|
||||||
{
|
{
|
||||||
/* `GC_MALLOC ()' always returns a zeroed buffer. */
|
/* `GC_MALLOC ()' always returns a zeroed buffer. */
|
||||||
return scm_gc_malloc (size, what);
|
return do_gc_malloc (size, what);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
scm_gc_realloc (void *mem, size_t old_size, size_t new_size, const char *what)
|
scm_gc_realloc (void *mem, size_t old_size, size_t new_size, const char *what)
|
||||||
{
|
{
|
||||||
void *ptr;
|
return do_gc_realloc (mem, new_size, what);
|
||||||
|
|
||||||
ptr = GC_REALLOC (mem, new_size);
|
|
||||||
|
|
||||||
#ifdef GUILE_DEBUG_MALLOC
|
|
||||||
if (mem)
|
|
||||||
scm_malloc_reregister (mem, ptr, what);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return ptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_gc_free (void *mem, size_t size, const char *what)
|
scm_gc_free (void *mem, size_t size, const char *what)
|
||||||
{
|
{
|
||||||
scm_gc_unregister_collectable_memory (mem, size, what);
|
do_gc_free (mem);
|
||||||
GC_FREE (mem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
scm_gc_strndup (const char *str, size_t n, const char *what)
|
scm_gc_strndup (const char *str, size_t n, const char *what)
|
||||||
{
|
{
|
||||||
char *dst = GC_MALLOC_ATOMIC (n + 1);
|
char *dst = do_gc_malloc_atomic (n + 1, what);
|
||||||
memcpy (dst, str, n);
|
memcpy (dst, str, n);
|
||||||
dst[n] = 0;
|
dst[n] = 0;
|
||||||
return dst;
|
return dst;
|
||||||
|
|
|
@ -198,7 +198,7 @@ SCM_DEFINE (scm_array_in_bounds_p, "array-in-bounds?", 1, 0, 1,
|
||||||
SCM_DEFINE (scm_array_ref, "array-ref", 1, 0, 1,
|
SCM_DEFINE (scm_array_ref, "array-ref", 1, 0, 1,
|
||||||
(SCM v, SCM args),
|
(SCM v, SCM args),
|
||||||
"Return the element at the @code{(index1, index2)} element in\n"
|
"Return the element at the @code{(index1, index2)} element in\n"
|
||||||
"@var{array}.")
|
"array @var{v}.")
|
||||||
#define FUNC_NAME s_scm_array_ref
|
#define FUNC_NAME s_scm_array_ref
|
||||||
{
|
{
|
||||||
scm_t_array_handle handle;
|
scm_t_array_handle handle;
|
||||||
|
@ -214,8 +214,9 @@ SCM_DEFINE (scm_array_ref, "array-ref", 1, 0, 1,
|
||||||
|
|
||||||
SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1,
|
SCM_DEFINE (scm_array_set_x, "array-set!", 2, 0, 1,
|
||||||
(SCM v, SCM obj, SCM args),
|
(SCM v, SCM obj, SCM args),
|
||||||
"Set the element at the @code{(index1, index2)} element in @var{array} to\n"
|
"Set the element at the @code{(index1, index2)} element in array\n"
|
||||||
"@var{new-value}. The value returned by array-set! is unspecified.")
|
"@var{v} to @var{obj}. The value returned by @code{array-set!}\n"
|
||||||
|
"is unspecified.")
|
||||||
#define FUNC_NAME s_scm_array_set_x
|
#define FUNC_NAME s_scm_array_set_x
|
||||||
{
|
{
|
||||||
scm_t_array_handle handle;
|
scm_t_array_handle handle;
|
||||||
|
|
|
@ -404,7 +404,7 @@ SCM_DEFINE (scm_hashq_ref, "hashq-ref", 2, 1, 0,
|
||||||
(SCM table, SCM key, SCM dflt),
|
(SCM table, SCM key, SCM dflt),
|
||||||
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
||||||
"value (if any) associated with it. If @var{key} is not found,\n"
|
"value (if any) associated with it. If @var{key} is not found,\n"
|
||||||
"return @var{default} (or @code{#f} if no @var{default} argument\n"
|
"return @var{dflt} (or @code{#f} if no @var{dflt} argument\n"
|
||||||
"is supplied). Uses @code{eq?} for equality testing.")
|
"is supplied). Uses @code{eq?} for equality testing.")
|
||||||
#define FUNC_NAME s_scm_hashq_ref
|
#define FUNC_NAME s_scm_hashq_ref
|
||||||
{
|
{
|
||||||
|
@ -426,7 +426,7 @@ SCM_DEFINE (scm_hashq_ref, "hashq-ref", 2, 1, 0,
|
||||||
SCM_DEFINE (scm_hashq_set_x, "hashq-set!", 3, 0, 0,
|
SCM_DEFINE (scm_hashq_set_x, "hashq-set!", 3, 0, 0,
|
||||||
(SCM table, SCM key, SCM val),
|
(SCM table, SCM key, SCM val),
|
||||||
"Find the entry in @var{table} associated with @var{key}, and\n"
|
"Find the entry in @var{table} associated with @var{key}, and\n"
|
||||||
"store @var{value} there. Uses @code{eq?} for equality testing.")
|
"store @var{val} there. Uses @code{eq?} for equality testing.")
|
||||||
#define FUNC_NAME s_scm_hashq_set_x
|
#define FUNC_NAME s_scm_hashq_set_x
|
||||||
{
|
{
|
||||||
if (SCM_WEAK_TABLE_P (table))
|
if (SCM_WEAK_TABLE_P (table))
|
||||||
|
@ -501,7 +501,7 @@ SCM_DEFINE (scm_hashv_ref, "hashv-ref", 2, 1, 0,
|
||||||
(SCM table, SCM key, SCM dflt),
|
(SCM table, SCM key, SCM dflt),
|
||||||
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
||||||
"value (if any) associated with it. If @var{key} is not found,\n"
|
"value (if any) associated with it. If @var{key} is not found,\n"
|
||||||
"return @var{default} (or @code{#f} if no @var{default} argument\n"
|
"return @var{dflt} (or @code{#f} if no @var{dflt} argument\n"
|
||||||
"is supplied). Uses @code{eqv?} for equality testing.")
|
"is supplied). Uses @code{eqv?} for equality testing.")
|
||||||
#define FUNC_NAME s_scm_hashv_ref
|
#define FUNC_NAME s_scm_hashv_ref
|
||||||
{
|
{
|
||||||
|
@ -606,7 +606,7 @@ SCM_DEFINE (scm_hash_ref, "hash-ref", 2, 1, 0,
|
||||||
(SCM table, SCM key, SCM dflt),
|
(SCM table, SCM key, SCM dflt),
|
||||||
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
"Look up @var{key} in the hash table @var{table}, and return the\n"
|
||||||
"value (if any) associated with it. If @var{key} is not found,\n"
|
"value (if any) associated with it. If @var{key} is not found,\n"
|
||||||
"return @var{default} (or @code{#f} if no @var{default} argument\n"
|
"return @var{dflt} (or @code{#f} if no @var{dflt} argument\n"
|
||||||
"is supplied). Uses @code{equal?} for equality testing.")
|
"is supplied). Uses @code{equal?} for equality testing.")
|
||||||
#define FUNC_NAME s_scm_hash_ref
|
#define FUNC_NAME s_scm_hash_ref
|
||||||
{
|
{
|
||||||
|
@ -629,7 +629,7 @@ SCM_DEFINE (scm_hash_ref, "hash-ref", 2, 1, 0,
|
||||||
SCM_DEFINE (scm_hash_set_x, "hash-set!", 3, 0, 0,
|
SCM_DEFINE (scm_hash_set_x, "hash-set!", 3, 0, 0,
|
||||||
(SCM table, SCM key, SCM val),
|
(SCM table, SCM key, SCM val),
|
||||||
"Find the entry in @var{table} associated with @var{key}, and\n"
|
"Find the entry in @var{table} associated with @var{key}, and\n"
|
||||||
"store @var{value} there. Uses @code{equal?} for equality\n"
|
"store @var{val} there. Uses @code{equal?} for equality\n"
|
||||||
"testing.")
|
"testing.")
|
||||||
#define FUNC_NAME s_scm_hash_set_x
|
#define FUNC_NAME s_scm_hash_set_x
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,16 +59,8 @@
|
||||||
|
|
||||||
#include "libguile/posix.h" /* for `scm_i_locale_mutex' */
|
#include "libguile/posix.h" /* for `scm_i_locale_mutex' */
|
||||||
|
|
||||||
#ifdef HAVE_LANGINFO_H
|
/* Use Gnulib's header, which also provides `nl_item' & co. */
|
||||||
# include <langinfo.h>
|
#include <langinfo.h>
|
||||||
#endif
|
|
||||||
#ifdef HAVE_NL_TYPES_H
|
|
||||||
# include <nl_types.h>
|
|
||||||
#endif
|
|
||||||
#ifndef HAVE_NL_ITEM
|
|
||||||
/* Cygwin has <langinfo.h> but lacks <nl_types.h> and `nl_item'. */
|
|
||||||
typedef int nl_item;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_SETLOCALE
|
#ifndef HAVE_SETLOCALE
|
||||||
static inline char *
|
static inline char *
|
||||||
|
@ -223,7 +215,7 @@ SCM_GLOBAL_VARIABLE (scm_global_locale, "%global-locale");
|
||||||
#define SCM_VALIDATE_OPTIONAL_LOCALE_COPY(_pos, _arg, _c_locale) \
|
#define SCM_VALIDATE_OPTIONAL_LOCALE_COPY(_pos, _arg, _c_locale) \
|
||||||
do \
|
do \
|
||||||
{ \
|
{ \
|
||||||
if (!scm_is_eq ((_arg), SCM_UNDEFINED)) \
|
if (!SCM_UNBNDP (_arg)) \
|
||||||
SCM_VALIDATE_LOCALE_COPY (_pos, _arg, _c_locale); \
|
SCM_VALIDATE_LOCALE_COPY (_pos, _arg, _c_locale); \
|
||||||
else \
|
else \
|
||||||
(_c_locale) = NULL; \
|
(_c_locale) = NULL; \
|
||||||
|
@ -1481,14 +1473,11 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
"Reference Manual}).")
|
"Reference Manual}).")
|
||||||
#define FUNC_NAME s_scm_nl_langinfo
|
#define FUNC_NAME s_scm_nl_langinfo
|
||||||
{
|
{
|
||||||
#ifdef HAVE_NL_LANGINFO
|
|
||||||
SCM result;
|
SCM result;
|
||||||
nl_item c_item;
|
nl_item c_item;
|
||||||
char *c_result;
|
char *c_result;
|
||||||
scm_t_locale c_locale;
|
scm_t_locale c_locale;
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
char *codeset;
|
char *codeset;
|
||||||
#endif
|
|
||||||
|
|
||||||
SCM_VALIDATE_INT_COPY (2, item, c_item);
|
SCM_VALIDATE_INT_COPY (2, item, c_item);
|
||||||
SCM_VALIDATE_OPTIONAL_LOCALE_COPY (2, locale, c_locale);
|
SCM_VALIDATE_OPTIONAL_LOCALE_COPY (2, locale, c_locale);
|
||||||
|
@ -1505,9 +1494,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
{
|
{
|
||||||
#ifdef USE_GNU_LOCALE_API
|
#ifdef USE_GNU_LOCALE_API
|
||||||
c_result = nl_langinfo_l (c_item, c_locale);
|
c_result = nl_langinfo_l (c_item, c_locale);
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
codeset = nl_langinfo_l (CODESET, c_locale);
|
codeset = nl_langinfo_l (CODESET, c_locale);
|
||||||
#endif /* HAVE_LANGINFO_CODESET */
|
|
||||||
#else /* !USE_GNU_LOCALE_API */
|
#else /* !USE_GNU_LOCALE_API */
|
||||||
/* We can't use `RUN_IN_LOCALE_SECTION ()' here because the locale
|
/* We can't use `RUN_IN_LOCALE_SECTION ()' here because the locale
|
||||||
mutex is already taken. */
|
mutex is already taken. */
|
||||||
|
@ -1532,9 +1519,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c_result = nl_langinfo (c_item);
|
c_result = nl_langinfo (c_item);
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
codeset = nl_langinfo (CODESET);
|
codeset = nl_langinfo (CODESET);
|
||||||
#endif /* HAVE_LANGINFO_CODESET */
|
|
||||||
|
|
||||||
restore_locale_settings (&lsec_prev_locale);
|
restore_locale_settings (&lsec_prev_locale);
|
||||||
free_locale_settings (&lsec_prev_locale);
|
free_locale_settings (&lsec_prev_locale);
|
||||||
|
@ -1544,9 +1529,7 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
c_result = nl_langinfo (c_item);
|
c_result = nl_langinfo (c_item);
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
codeset = nl_langinfo (CODESET);
|
codeset = nl_langinfo (CODESET);
|
||||||
#endif /* HAVE_LANGINFO_CODESET */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c_result = strdup (c_result);
|
c_result = strdup (c_result);
|
||||||
|
@ -1659,26 +1642,14 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
#ifdef HAVE_LANGINFO_CODESET
|
|
||||||
result = scm_from_stringn (c_result, strlen (c_result),
|
result = scm_from_stringn (c_result, strlen (c_result),
|
||||||
codeset,
|
codeset,
|
||||||
SCM_FAILED_CONVERSION_QUESTION_MARK);
|
SCM_FAILED_CONVERSION_QUESTION_MARK);
|
||||||
#else /* !HAVE_LANGINFO_CODESET */
|
|
||||||
/* This may be incorrectly encoded if the locale differs
|
|
||||||
from the c_locale. */
|
|
||||||
result = scm_from_locale_string (c_result);
|
|
||||||
#endif /* !HAVE_LANGINFO_CODESET */
|
|
||||||
free (c_result);
|
free (c_result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#else
|
|
||||||
scm_syserror_msg (FUNC_NAME, "`nl-langinfo' not supported on your system",
|
|
||||||
SCM_EOL, ENOSYS);
|
|
||||||
|
|
||||||
return SCM_BOOL_F;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
@ -1686,8 +1657,6 @@ SCM_DEFINE (scm_nl_langinfo, "nl-langinfo", 1, 1, 0,
|
||||||
static inline void
|
static inline void
|
||||||
define_langinfo_items (void)
|
define_langinfo_items (void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_LANGINFO_H
|
|
||||||
|
|
||||||
#define DEFINE_NLITEM_CONSTANT(_item) \
|
#define DEFINE_NLITEM_CONSTANT(_item) \
|
||||||
scm_c_define (# _item, scm_from_int (_item))
|
scm_c_define (# _item, scm_from_int (_item))
|
||||||
|
|
||||||
|
@ -1852,8 +1821,6 @@ define_langinfo_items (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef DEFINE_NLITEM_CONSTANT
|
#undef DEFINE_NLITEM_CONSTANT
|
||||||
|
|
||||||
#endif /* HAVE_NL_TYPES_H */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1862,10 +1829,8 @@ scm_init_i18n ()
|
||||||
{
|
{
|
||||||
SCM global_locale_smob;
|
SCM global_locale_smob;
|
||||||
|
|
||||||
#ifdef HAVE_NL_LANGINFO
|
|
||||||
scm_add_feature ("nl-langinfo");
|
scm_add_feature ("nl-langinfo");
|
||||||
define_langinfo_items ();
|
define_langinfo_items ();
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "libguile/i18n.x"
|
#include "libguile/i18n.x"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
|
||||||
|
* 2004, 2006, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -91,7 +92,7 @@
|
||||||
#include "libguile/poll.h"
|
#include "libguile/poll.h"
|
||||||
#include "libguile/ports.h"
|
#include "libguile/ports.h"
|
||||||
#include "libguile/posix.h"
|
#include "libguile/posix.h"
|
||||||
#ifdef HAVE_REGCOMP
|
#ifdef ENABLE_REGEX
|
||||||
#include "libguile/regex-posix.h"
|
#include "libguile/regex-posix.h"
|
||||||
#endif
|
#endif
|
||||||
#include "libguile/print.h"
|
#include "libguile/print.h"
|
||||||
|
@ -452,7 +453,7 @@ scm_i_init_guile (void *base)
|
||||||
#ifdef HAVE_POSIX
|
#ifdef HAVE_POSIX
|
||||||
scm_init_posix ();
|
scm_init_posix ();
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGCOMP
|
#ifdef ENABLE_REGEX
|
||||||
scm_init_regex_posix (); /* Requires smob_prehistory */
|
scm_init_regex_posix (); /* Requires smob_prehistory */
|
||||||
#endif
|
#endif
|
||||||
scm_init_procs ();
|
scm_init_procs ();
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
SCM_DEFINE (scm_ftell, "ftell", 1, 0, 0,
|
SCM_DEFINE (scm_ftell, "ftell", 1, 0, 0,
|
||||||
(SCM fd_port),
|
(SCM fd_port),
|
||||||
"Return an integer representing the current position of\n"
|
"Return an integer representing the current position of\n"
|
||||||
"@var{fd/port}, measured from the beginning. Equivalent to:\n"
|
"@var{fd_port}, measured from the beginning. Equivalent to:\n"
|
||||||
"\n"
|
"\n"
|
||||||
"@lisp\n"
|
"@lisp\n"
|
||||||
"(seek port 0 SEEK_CUR)\n"
|
"(seek port 0 SEEK_CUR)\n"
|
||||||
|
@ -63,8 +63,8 @@ SCM_DEFINE (scm_ftell, "ftell", 1, 0, 0,
|
||||||
SCM_DEFINE (scm_redirect_port, "redirect-port", 2, 0, 0,
|
SCM_DEFINE (scm_redirect_port, "redirect-port", 2, 0, 0,
|
||||||
(SCM old, SCM new),
|
(SCM old, SCM new),
|
||||||
"This procedure takes two ports and duplicates the underlying file\n"
|
"This procedure takes two ports and duplicates the underlying file\n"
|
||||||
"descriptor from @var{old-port} into @var{new-port}. The\n"
|
"descriptor from @var{old} into @var{new}. The\n"
|
||||||
"current file descriptor in @var{new-port} will be closed.\n"
|
"current file descriptor in @var{new} will be closed.\n"
|
||||||
"After the redirection the two ports will share a file position\n"
|
"After the redirection the two ports will share a file position\n"
|
||||||
"and file status flags.\n\n"
|
"and file status flags.\n\n"
|
||||||
"The return value is unspecified.\n\n"
|
"The return value is unspecified.\n\n"
|
||||||
|
@ -236,7 +236,7 @@ SCM_DEFINE (scm_fdopen, "fdopen", 2, 0, 0,
|
||||||
SCM_DEFINE (scm_primitive_move_to_fdes, "primitive-move->fdes", 2, 0, 0,
|
SCM_DEFINE (scm_primitive_move_to_fdes, "primitive-move->fdes", 2, 0, 0,
|
||||||
(SCM port, SCM fd),
|
(SCM port, SCM fd),
|
||||||
"Moves the underlying file descriptor for @var{port} to the integer\n"
|
"Moves the underlying file descriptor for @var{port} to the integer\n"
|
||||||
"value @var{fdes} without changing the revealed count of @var{port}.\n"
|
"value @var{fd} without changing the revealed count of @var{port}.\n"
|
||||||
"Any other ports already using this descriptor will be automatically\n"
|
"Any other ports already using this descriptor will be automatically\n"
|
||||||
"shifted to new descriptors and their revealed counts reset to zero.\n"
|
"shifted to new descriptors and their revealed counts reset to zero.\n"
|
||||||
"The return value is @code{#f} if the file descriptor already had the\n"
|
"The return value is @code{#f} if the file descriptor already had the\n"
|
||||||
|
@ -284,7 +284,7 @@ get_matching_port (void *closure, SCM port, SCM result)
|
||||||
/* Return a list of ports using a given file descriptor. */
|
/* Return a list of ports using a given file descriptor. */
|
||||||
SCM_DEFINE (scm_fdes_to_ports, "fdes->ports", 1, 0, 0,
|
SCM_DEFINE (scm_fdes_to_ports, "fdes->ports", 1, 0, 0,
|
||||||
(SCM fd),
|
(SCM fd),
|
||||||
"Return a list of existing ports which have @var{fdes} as an\n"
|
"Return a list of existing ports which have @var{fd} as an\n"
|
||||||
"underlying file descriptor, without changing their revealed\n"
|
"underlying file descriptor, without changing their revealed\n"
|
||||||
"counts.")
|
"counts.")
|
||||||
#define FUNC_NAME s_scm_fdes_to_ports
|
#define FUNC_NAME s_scm_fdes_to_ports
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2004, 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2004, 2006, 2008,
|
||||||
|
* 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -419,8 +420,9 @@ scm_c_string_has_an_ext (char *str, size_t len, SCM extensions)
|
||||||
|
|
||||||
/* Search PATH for a directory containing a file named FILENAME.
|
/* Search PATH for a directory containing a file named FILENAME.
|
||||||
The file must be readable, and not a directory.
|
The file must be readable, and not a directory.
|
||||||
If we find one, return its full filename; otherwise, return #f.
|
If we find one, return its full pathname; otherwise, return #f.
|
||||||
If FILENAME is absolute, return it unchanged.
|
If FILENAME is absolute, return it unchanged.
|
||||||
|
We also fill *stat_buf corresponding to the returned pathname.
|
||||||
If given, EXTENSIONS is a list of strings; for each directory
|
If given, EXTENSIONS is a list of strings; for each directory
|
||||||
in PATH, we search for FILENAME concatenated with each EXTENSION. */
|
in PATH, we search for FILENAME concatenated with each EXTENSION. */
|
||||||
static SCM
|
static SCM
|
||||||
|
@ -445,7 +447,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts,
|
||||||
filename_len = strlen (filename_chars);
|
filename_len = strlen (filename_chars);
|
||||||
scm_dynwind_free (filename_chars);
|
scm_dynwind_free (filename_chars);
|
||||||
|
|
||||||
/* If FILENAME is absolute, return it unchanged. */
|
/* If FILENAME is absolute and is still valid, return it unchanged. */
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
if (((filename_len >= 1) &&
|
if (((filename_len >= 1) &&
|
||||||
(filename_chars[0] == '/' || filename_chars[0] == '\\')) ||
|
(filename_chars[0] == '/' || filename_chars[0] == '\\')) ||
|
||||||
|
@ -457,14 +459,13 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts,
|
||||||
if (filename_len >= 1 && filename_chars[0] == '/')
|
if (filename_len >= 1 && filename_chars[0] == '/')
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
SCM res = filename;
|
if ((scm_is_false (require_exts) ||
|
||||||
if (scm_is_true (require_exts) &&
|
scm_c_string_has_an_ext (filename_chars, filename_len,
|
||||||
!scm_c_string_has_an_ext (filename_chars, filename_len,
|
|
||||||
extensions))
|
extensions))
|
||||||
res = SCM_BOOL_F;
|
&& stat (filename_chars, stat_buf) == 0
|
||||||
|
&& !(stat_buf->st_mode & S_IFDIR))
|
||||||
scm_dynwind_end ();
|
result = filename;
|
||||||
return res;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If FILENAME has an extension, don't try to add EXTENSIONS to it. */
|
/* If FILENAME has an extension, don't try to add EXTENSIONS to it. */
|
||||||
|
@ -483,8 +484,7 @@ search_path (SCM path, SCM filename, SCM extensions, SCM require_exts,
|
||||||
{
|
{
|
||||||
/* This filename has an extension, but not one of the right
|
/* This filename has an extension, but not one of the right
|
||||||
ones... */
|
ones... */
|
||||||
scm_dynwind_end ();
|
goto end;
|
||||||
return SCM_BOOL_F;
|
|
||||||
}
|
}
|
||||||
/* This filename already has an extension, so cancel the
|
/* This filename already has an extension, so cancel the
|
||||||
list of extensions. */
|
list of extensions. */
|
||||||
|
@ -571,9 +571,9 @@ SCM_DEFINE (scm_search_path, "search-path", 2, 0, 1,
|
||||||
"@var{filename}. The file must be readable, and not a directory.\n"
|
"@var{filename}. The file must be readable, and not a directory.\n"
|
||||||
"If we find one, return its full filename; otherwise, return\n"
|
"If we find one, return its full filename; otherwise, return\n"
|
||||||
"@code{#f}. If @var{filename} is absolute, return it unchanged.\n"
|
"@code{#f}. If @var{filename} is absolute, return it unchanged.\n"
|
||||||
"If given, @var{extensions} is a list of strings; for each\n"
|
"If given, @var{rest} is a list of extension strings; for each\n"
|
||||||
"directory in @var{path}, we search for @var{filename}\n"
|
"directory in @var{path}, we search for @var{filename}\n"
|
||||||
"concatenated with each @var{extension}.")
|
"concatenated with each extension.")
|
||||||
#define FUNC_NAME s_scm_search_path
|
#define FUNC_NAME s_scm_search_path
|
||||||
{
|
{
|
||||||
SCM extensions, require_exts;
|
SCM extensions, require_exts;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* "net_db.c" network database support
|
/* "net_db.c" network database support
|
||||||
* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2006, 2009, 2010, 2011 Free Software Foundation, Inc.
|
* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2006, 2009,
|
||||||
|
* 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -590,10 +591,14 @@ SCM_DEFINE (scm_getaddrinfo, "getaddrinfo", 1, 5, 0,
|
||||||
"@item EAI_NONAME\n"
|
"@item EAI_NONAME\n"
|
||||||
"Either @var{name} does not resolve for the supplied parameters, "
|
"Either @var{name} does not resolve for the supplied parameters, "
|
||||||
"or neither @var{name} nor @var{service} were supplied.\n\n"
|
"or neither @var{name} nor @var{service} were supplied.\n\n"
|
||||||
|
|
||||||
|
/* See `sysdeps/posix/getaddrinfo.c' in the GNU libc, and
|
||||||
|
<http://www.opensource.apple.com/source/Libinfo/Libinfo-324.1/lookup.subproj/netdb.h>,
|
||||||
|
for details on EAI_NODATA. */
|
||||||
"@item EAI_NODATA\n"
|
"@item EAI_NODATA\n"
|
||||||
"This non-POSIX error code can be returned on GNU systems when a\n"
|
"This non-POSIX error code can be returned on some systems (GNU "
|
||||||
"request was actually made but returned no data, meaning\n"
|
"and Darwin, at least), for example when @var{name} is known "
|
||||||
"that no address is associated with @var{name}. Error handling\n"
|
"but requests that were made turned out no data. Error handling\n"
|
||||||
"code should be prepared to handle it when it is defined.\n\n"
|
"code should be prepared to handle it when it is defined.\n\n"
|
||||||
"@item EAI_SERVICE\n"
|
"@item EAI_SERVICE\n"
|
||||||
"@var{service} was not recognized for the specified socket type.\n\n"
|
"@var{service} was not recognized for the specified socket type.\n\n"
|
||||||
|
|
|
@ -8704,8 +8704,8 @@ scm_c_make_rectangular (double re, double im)
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_rectangular, "make-rectangular", 2, 0, 0,
|
SCM_DEFINE (scm_make_rectangular, "make-rectangular", 2, 0, 0,
|
||||||
(SCM real_part, SCM imaginary_part),
|
(SCM real_part, SCM imaginary_part),
|
||||||
"Return a complex number constructed of the given @var{real-part} "
|
"Return a complex number constructed of the given @var{real_part} "
|
||||||
"and @var{imaginary-part} parts.")
|
"and @var{imaginary_part} parts.")
|
||||||
#define FUNC_NAME s_scm_make_rectangular
|
#define FUNC_NAME s_scm_make_rectangular
|
||||||
{
|
{
|
||||||
SCM_ASSERT_TYPE (scm_is_real (real_part), real_part,
|
SCM_ASSERT_TYPE (scm_is_real (real_part), real_part,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
|
/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004,
|
||||||
* 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
* 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -1991,10 +1991,11 @@ SCM_DEFINE (scm_peek_char, "peek-char", 0, 1, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_unread_char, "unread-char", 1, 1, 0,
|
SCM_DEFINE (scm_unread_char, "unread-char", 1, 1, 0,
|
||||||
(SCM cobj, SCM port),
|
(SCM cobj, SCM port),
|
||||||
"Place @var{char} in @var{port} so that it will be read by the\n"
|
"Place character @var{cobj} in @var{port} so that it will be\n"
|
||||||
"next read operation. If called multiple times, the unread characters\n"
|
"read by the next read operation. If called multiple times, the\n"
|
||||||
"will be read again in last-in first-out order. If @var{port} is\n"
|
"unread characters will be read again in last-in first-out\n"
|
||||||
"not supplied, the current input port is used.")
|
"order. If @var{port} is not supplied, the current input port\n"
|
||||||
|
"is used.")
|
||||||
#define FUNC_NAME s_scm_unread_char
|
#define FUNC_NAME s_scm_unread_char
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
|
@ -2406,7 +2407,7 @@ SCM_DEFINE (scm_char_ready_p, "char-ready?", 0, 1, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_seek, "seek", 3, 0, 0,
|
SCM_DEFINE (scm_seek, "seek", 3, 0, 0,
|
||||||
(SCM fd_port, SCM offset, SCM whence),
|
(SCM fd_port, SCM offset, SCM whence),
|
||||||
"Sets the current position of @var{fd/port} to the integer\n"
|
"Sets the current position of @var{fd_port} to the integer\n"
|
||||||
"@var{offset}, which is interpreted according to the value of\n"
|
"@var{offset}, which is interpreted according to the value of\n"
|
||||||
"@var{whence}.\n"
|
"@var{whence}.\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -2421,7 +2422,7 @@ SCM_DEFINE (scm_seek, "seek", 3, 0, 0,
|
||||||
"@defvar SEEK_END\n"
|
"@defvar SEEK_END\n"
|
||||||
"Seek from the end of the file.\n"
|
"Seek from the end of the file.\n"
|
||||||
"@end defvar\n"
|
"@end defvar\n"
|
||||||
"If @var{fd/port} is a file descriptor, the underlying system\n"
|
"If @var{fd_port} is a file descriptor, the underlying system\n"
|
||||||
"call is @code{lseek}. @var{port} may be a string port.\n"
|
"call is @code{lseek}. @var{port} may be a string port.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"The value returned is the new position in the file. This means\n"
|
"The value returned is the new position in the file. This means\n"
|
||||||
|
@ -2495,8 +2496,9 @@ truncate (const char *file, off_t length)
|
||||||
|
|
||||||
SCM_DEFINE (scm_truncate_file, "truncate-file", 1, 1, 0,
|
SCM_DEFINE (scm_truncate_file, "truncate-file", 1, 1, 0,
|
||||||
(SCM object, SCM length),
|
(SCM object, SCM length),
|
||||||
"Truncate @var{file} to @var{length} bytes. @var{file} can be a\n"
|
"Truncate file @var{object} to @var{length} bytes. @var{object}\n"
|
||||||
"filename string, a port object, or an integer file descriptor.\n"
|
"can be a filename string, a port object, or an integer file\n"
|
||||||
|
"descriptor.\n"
|
||||||
"The return value is unspecified.\n"
|
"The return value is unspecified.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"For a port or file descriptor @var{length} can be omitted, in\n"
|
"For a port or file descriptor @var{length} can be omitted, in\n"
|
||||||
|
@ -2731,9 +2733,9 @@ SCM_DEFINE (scm_port_for_each, "port-for-each", 1, 0, 0,
|
||||||
"Apply @var{proc} to each port in the Guile port table\n"
|
"Apply @var{proc} to each port in the Guile port table\n"
|
||||||
"in turn. The return value is unspecified. More specifically,\n"
|
"in turn. The return value is unspecified. More specifically,\n"
|
||||||
"@var{proc} is applied exactly once to every port that exists\n"
|
"@var{proc} is applied exactly once to every port that exists\n"
|
||||||
"in the system at the time @var{port-for-each} is invoked.\n"
|
"in the system at the time @code{port-for-each} is invoked.\n"
|
||||||
"Changes to the port table while @var{port-for-each} is running\n"
|
"Changes to the port table while @code{port-for-each} is running\n"
|
||||||
"have no effect as far as @var{port-for-each} is concerned.")
|
"have no effect as far as @code{port-for-each} is concerned.")
|
||||||
#define FUNC_NAME s_scm_port_for_each
|
#define FUNC_NAME s_scm_port_for_each
|
||||||
{
|
{
|
||||||
SCM_VALIDATE_PROC (1, proc);
|
SCM_VALIDATE_PROC (1, proc);
|
||||||
|
|
|
@ -285,7 +285,7 @@ SCM_DEFINE (scm_getgroups, "getgroups", 0, 0, 0,
|
||||||
SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
|
SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
|
||||||
(SCM group_vec),
|
(SCM group_vec),
|
||||||
"Set the current set of supplementary group IDs to the integers\n"
|
"Set the current set of supplementary group IDs to the integers\n"
|
||||||
"in the given vector @var{vec}. The return value is\n"
|
"in the given vector @var{group_vec}. The return value is\n"
|
||||||
"unspecified.\n"
|
"unspecified.\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Generally only the superuser can set the process group IDs.")
|
"Generally only the superuser can set the process group IDs.")
|
||||||
|
@ -335,9 +335,10 @@ SCM_DEFINE (scm_setgroups, "setgroups", 1, 0, 0,
|
||||||
#ifdef HAVE_GETPWENT
|
#ifdef HAVE_GETPWENT
|
||||||
SCM_DEFINE (scm_getpwuid, "getpw", 0, 1, 0,
|
SCM_DEFINE (scm_getpwuid, "getpw", 0, 1, 0,
|
||||||
(SCM user),
|
(SCM user),
|
||||||
"Look up an entry in the user database. @var{obj} can be an integer,\n"
|
"Look up an entry in the user database. @var{user} can be an\n"
|
||||||
"a string, or omitted, giving the behaviour of getpwuid, getpwnam\n"
|
"integer, a string, or omitted, giving the behaviour of\n"
|
||||||
"or getpwent respectively.")
|
"@code{getpwuid}, @code{getpwnam} or @code{getpwent}\n"
|
||||||
|
"respectively.")
|
||||||
#define FUNC_NAME s_scm_getpwuid
|
#define FUNC_NAME s_scm_getpwuid
|
||||||
{
|
{
|
||||||
struct passwd *entry;
|
struct passwd *entry;
|
||||||
|
@ -404,9 +405,10 @@ SCM_DEFINE (scm_setpwent, "setpw", 0, 1, 0,
|
||||||
/* Combines getgrgid and getgrnam. */
|
/* Combines getgrgid and getgrnam. */
|
||||||
SCM_DEFINE (scm_getgrgid, "getgr", 0, 1, 0,
|
SCM_DEFINE (scm_getgrgid, "getgr", 0, 1, 0,
|
||||||
(SCM name),
|
(SCM name),
|
||||||
"Look up an entry in the group database. @var{obj} can be an integer,\n"
|
"Look up an entry in the group database. @var{name} can be an\n"
|
||||||
"a string, or omitted, giving the behaviour of getgrgid, getgrnam\n"
|
"integer, a string, or omitted, giving the behaviour of\n"
|
||||||
"or getgrent respectively.")
|
"@code{getgrgid}, @code{getgrnam} or @code{getgrent}\n"
|
||||||
|
"respectively.")
|
||||||
#define FUNC_NAME s_scm_getgrgid
|
#define FUNC_NAME s_scm_getgrgid
|
||||||
{
|
{
|
||||||
struct group *entry;
|
struct group *entry;
|
||||||
|
@ -698,7 +700,7 @@ SCM_DEFINE (scm_waitpid, "waitpid", 1, 1, 0,
|
||||||
"group.\n"
|
"group.\n"
|
||||||
"@item @var{pid} less than -1\n"
|
"@item @var{pid} less than -1\n"
|
||||||
"Request status information for any child process whose process group ID\n"
|
"Request status information for any child process whose process group ID\n"
|
||||||
"is -@var{PID}.\n"
|
"is -@var{pid}.\n"
|
||||||
"@end table\n\n"
|
"@end table\n\n"
|
||||||
"The @var{options} argument, if supplied, should be the bitwise OR of the\n"
|
"The @var{options} argument, if supplied, should be the bitwise OR of the\n"
|
||||||
"values of zero or more of the following variables:\n\n"
|
"values of zero or more of the following variables:\n\n"
|
||||||
|
@ -1122,10 +1124,10 @@ SCM_DEFINE (scm_tcsetpgrp, "tcsetpgrp", 2, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_execl, "execl", 1, 0, 1,
|
SCM_DEFINE (scm_execl, "execl", 1, 0, 1,
|
||||||
(SCM filename, SCM args),
|
(SCM filename, SCM args),
|
||||||
"Executes the file named by @var{path} as a new process image.\n"
|
"Executes the file named by @var{filename} as a new process image.\n"
|
||||||
"The remaining arguments are supplied to the process; from a C program\n"
|
"The remaining arguments are supplied to the process; from a C program\n"
|
||||||
"they are accessible as the @code{argv} argument to @code{main}.\n"
|
"they are accessible as the @code{argv} argument to @code{main}.\n"
|
||||||
"Conventionally the first @var{arg} is the same as @var{path}.\n"
|
"Conventionally the first @var{arg} is the same as @var{filename}.\n"
|
||||||
"All arguments must be strings.\n\n"
|
"All arguments must be strings.\n\n"
|
||||||
"If @var{arg} is missing, @var{path} is executed with a null\n"
|
"If @var{arg} is missing, @var{path} is executed with a null\n"
|
||||||
"argument list, which may have system-dependent side-effects.\n\n"
|
"argument list, which may have system-dependent side-effects.\n\n"
|
||||||
|
@ -1359,7 +1361,7 @@ SCM_DEFINE (scm_utime, "utime", 1, 5, 0,
|
||||||
(SCM pathname, SCM actime, SCM modtime, SCM actimens, SCM modtimens,
|
(SCM pathname, SCM actime, SCM modtime, SCM actimens, SCM modtimens,
|
||||||
SCM flags),
|
SCM flags),
|
||||||
"@code{utime} sets the access and modification times for the\n"
|
"@code{utime} sets the access and modification times for the\n"
|
||||||
"file named by @var{path}. If @var{actime} or @var{modtime} is\n"
|
"file named by @var{pathname}. If @var{actime} or @var{modtime} is\n"
|
||||||
"not supplied, then the current time is used. @var{actime} and\n"
|
"not supplied, then the current time is used. @var{actime} and\n"
|
||||||
"@var{modtime} must be integer time values as returned by the\n"
|
"@var{modtime} must be integer time values as returned by the\n"
|
||||||
"@code{current-time} procedure.\n\n"
|
"@code{current-time} procedure.\n\n"
|
||||||
|
@ -1461,14 +1463,14 @@ SCM_DEFINE (scm_getpid, "getpid", 0, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
|
SCM_DEFINE (scm_putenv, "putenv", 1, 0, 0,
|
||||||
(SCM str),
|
(SCM str),
|
||||||
"Modifies the environment of the current process, which is\n"
|
"Modifies the environment of the current process, which is also\n"
|
||||||
"also the default environment inherited by child processes.\n\n"
|
"the default environment inherited by child processes. If\n"
|
||||||
"If @var{string} is of the form @code{NAME=VALUE} then it will be written\n"
|
"@var{str} is of the form @code{NAME=VALUE} then it will be\n"
|
||||||
"directly into the environment, replacing any existing environment string\n"
|
"written directly into the environment, replacing any existing\n"
|
||||||
"with\n"
|
"environment string with name matching @code{NAME}. If\n"
|
||||||
"name matching @code{NAME}. If @var{string} does not contain an equal\n"
|
"@var{str} does not contain an equal sign, then any existing\n"
|
||||||
"sign, then any existing string with name matching @var{string} will\n"
|
"string with name matching @var{str} will be removed.\n"
|
||||||
"be removed.\n\n"
|
"\n"
|
||||||
"The return value is unspecified.")
|
"The return value is unspecified.")
|
||||||
#define FUNC_NAME s_scm_putenv
|
#define FUNC_NAME s_scm_putenv
|
||||||
{
|
{
|
||||||
|
|
|
@ -1343,7 +1343,7 @@ SCM_DEFINE (scm_simple_format, "simple-format", 2, 0, 1,
|
||||||
"@var{message} can contain @code{~A} (was @code{%s}) and\n"
|
"@var{message} can contain @code{~A} (was @code{%s}) and\n"
|
||||||
"@code{~S} (was @code{%S}) escapes. When printed,\n"
|
"@code{~S} (was @code{%S}) escapes. When printed,\n"
|
||||||
"the escapes are replaced with corresponding members of\n"
|
"the escapes are replaced with corresponding members of\n"
|
||||||
"@var{ARGS}:\n"
|
"@var{args}:\n"
|
||||||
"@code{~A} formats using @code{display} and @code{~S} formats\n"
|
"@code{~A} formats using @code{display} and @code{~S} formats\n"
|
||||||
"using @code{write}.\n"
|
"using @code{write}.\n"
|
||||||
"If @var{destination} is @code{#t}, then use the current output\n"
|
"If @var{destination} is @code{#t}, then use the current output\n"
|
||||||
|
|
|
@ -125,7 +125,7 @@ SCM_DEFINE (scm_procedure_minimum_arity, "procedure-minimum-arity", 1, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_procedure_properties, "procedure-properties", 1, 0, 0,
|
SCM_DEFINE (scm_procedure_properties, "procedure-properties", 1, 0, 0,
|
||||||
(SCM proc),
|
(SCM proc),
|
||||||
"Return @var{obj}'s property list.")
|
"Return @var{proc}'s property list.")
|
||||||
#define FUNC_NAME s_scm_procedure_properties
|
#define FUNC_NAME s_scm_procedure_properties
|
||||||
{
|
{
|
||||||
SCM ret;
|
SCM ret;
|
||||||
|
|
|
@ -98,8 +98,8 @@ promise_print (SCM exp, SCM port, scm_print_state *pstate)
|
||||||
|
|
||||||
SCM_DEFINE (scm_force, "force", 1, 0, 0,
|
SCM_DEFINE (scm_force, "force", 1, 0, 0,
|
||||||
(SCM promise),
|
(SCM promise),
|
||||||
"If the promise @var{x} has not been computed yet, compute and\n"
|
"If @var{promise} has not been computed yet, compute and\n"
|
||||||
"return @var{x}, otherwise just return the previously computed\n"
|
"return @var{promise}, otherwise just return the previously computed\n"
|
||||||
"value.")
|
"value.")
|
||||||
#define FUNC_NAME s_scm_force
|
#define FUNC_NAME s_scm_force
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2006, 2007, 2010, 2011 Free Software Foundation, Inc.
|
/* Copyright (C) 1997, 1998, 1999, 2000, 2001, 2004, 2006, 2007, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -35,23 +35,7 @@
|
||||||
|
|
||||||
#include "libguile/_scm.h"
|
#include "libguile/_scm.h"
|
||||||
|
|
||||||
/* Supposedly, this file is never compiled unless we know we have
|
|
||||||
POSIX regular expressions. But we still put this in an #ifdef so
|
|
||||||
the file is CPP'able (for dependency scanning) even on systems that
|
|
||||||
don't have a <regex.h> header. */
|
|
||||||
#ifdef HAVE_REGCOMP
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
#include <regex.h>
|
#include <regex.h>
|
||||||
#else
|
|
||||||
#ifdef HAVE_RXPOSIX_H
|
|
||||||
#include <rxposix.h> /* GNU Rx library */
|
|
||||||
#else
|
|
||||||
#ifdef HAVE_RX_RXPOSIX_H
|
|
||||||
#include <rx/rxposix.h> /* GNU Rx library on Linux */
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_WCHAR_H
|
#ifdef HAVE_WCHAR_H
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
|
@ -169,7 +169,7 @@ SCM_DEFINE (scm_system_star, "system*", 0, 0, 1,
|
||||||
|
|
||||||
SCM_DEFINE (scm_getenv, "getenv", 1, 0, 0,
|
SCM_DEFINE (scm_getenv, "getenv", 1, 0, 0,
|
||||||
(SCM nam),
|
(SCM nam),
|
||||||
"Looks up the string @var{name} in the current environment. The return\n"
|
"Looks up the string @var{nam} in the current environment. The return\n"
|
||||||
"value is @code{#f} unless a string of the form @code{NAME=VALUE} is\n"
|
"value is @code{#f} unless a string of the form @code{NAME=VALUE} is\n"
|
||||||
"found, in which case the string @code{VALUE} is returned.")
|
"found, in which case the string @code{VALUE} is returned.")
|
||||||
#define FUNC_NAME s_scm_getenv
|
#define FUNC_NAME s_scm_getenv
|
||||||
|
|
|
@ -515,10 +515,10 @@ SCM_DEFINE (scm_getsockopt, "getsockopt", 3, 0, 0,
|
||||||
"@end defvar\n"
|
"@end defvar\n"
|
||||||
"\n"
|
"\n"
|
||||||
"@defvar SO_LINGER\n"
|
"@defvar SO_LINGER\n"
|
||||||
"The @var{value} returned is a pair of integers\n"
|
"The value returned is a pair of integers\n"
|
||||||
"@code{(@var{ENABLE} . @var{TIMEOUT})}. On old systems without\n"
|
"@code{(@var{enable} . @var{timeout})}. On old systems without\n"
|
||||||
"timeout support (ie.@: without @code{struct linger}), only\n"
|
"timeout support (ie.@: without @code{struct linger}), only\n"
|
||||||
"@var{ENABLE} has an effect but the value in Guile is always a\n"
|
"@var{enable} has an effect but the value in Guile is always a\n"
|
||||||
"pair.\n"
|
"pair.\n"
|
||||||
"@end defvar")
|
"@end defvar")
|
||||||
#define FUNC_NAME s_scm_getsockopt
|
#define FUNC_NAME s_scm_getsockopt
|
||||||
|
@ -1560,7 +1560,7 @@ SCM_DEFINE (scm_sendto, "sendto", 3, 1, 1,
|
||||||
(SCM sock, SCM message, SCM fam_or_sockaddr, SCM address, SCM args_and_flags),
|
(SCM sock, SCM message, SCM fam_or_sockaddr, SCM address, SCM args_and_flags),
|
||||||
"Transmit bytevector @var{message} on socket port\n"
|
"Transmit bytevector @var{message} on socket port\n"
|
||||||
"@var{sock}. The\n"
|
"@var{sock}. The\n"
|
||||||
"destination address is specified using the @var{fam},\n"
|
"destination address is specified using the @var{fam_or_sockaddr},\n"
|
||||||
"@var{address} and\n"
|
"@var{address} and\n"
|
||||||
"@var{args_and_flags} arguments, or just a socket address object "
|
"@var{args_and_flags} arguments, or just a socket address object "
|
||||||
"returned by @code{make-socket-address}, in a similar way to the\n"
|
"returned by @code{make-socket-address}, in a similar way to the\n"
|
||||||
|
|
|
@ -714,8 +714,8 @@ SCM_DEFINE (scm_srfi1_lset_difference_x, "lset-difference!", 2, 0, 1,
|
||||||
|
|
||||||
SCM_DEFINE (scm_srfi1_assoc, "assoc", 2, 1, 0,
|
SCM_DEFINE (scm_srfi1_assoc, "assoc", 2, 1, 0,
|
||||||
(SCM key, SCM alist, SCM pred),
|
(SCM key, SCM alist, SCM pred),
|
||||||
"Behaves like @code{assq} but uses third argument @var{pred?}\n"
|
"Behaves like @code{assq} but uses third argument @var{pred}\n"
|
||||||
"for key comparison. If @var{pred?} is not supplied,\n"
|
"for key comparison. If @var{pred} is not supplied,\n"
|
||||||
"@code{equal?} is used. (Extended from R5RS.)\n")
|
"@code{equal?} is used. (Extended from R5RS.)\n")
|
||||||
#define FUNC_NAME s_scm_srfi1_assoc
|
#define FUNC_NAME s_scm_srfi1_assoc
|
||||||
{
|
{
|
||||||
|
@ -844,9 +844,9 @@ SCM_DEFINE (scm_srfi1_partition_x, "partition!", 2, 0, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_srfi1_remove, "remove", 2, 0, 0,
|
SCM_DEFINE (scm_srfi1_remove, "remove", 2, 0, 0,
|
||||||
(SCM pred, SCM list),
|
(SCM pred, SCM list),
|
||||||
"Return a list containing all elements from @var{lst} which do\n"
|
"Return a list containing all elements from @var{list} which do\n"
|
||||||
"not satisfy the predicate @var{pred}. The elements in the\n"
|
"not satisfy the predicate @var{pred}. The elements in the\n"
|
||||||
"result list have the same order as in @var{lst}. The order in\n"
|
"result list have the same order as in @var{list}. The order in\n"
|
||||||
"which @var{pred} is applied to the list elements is not\n"
|
"which @var{pred} is applied to the list elements is not\n"
|
||||||
"specified.")
|
"specified.")
|
||||||
#define FUNC_NAME s_scm_srfi1_remove
|
#define FUNC_NAME s_scm_srfi1_remove
|
||||||
|
|
|
@ -375,7 +375,7 @@ SCM_SYMBOL (scm_sym_prefix, "prefix");
|
||||||
SCM_DEFINE (scm_string_join, "string-join", 1, 2, 0,
|
SCM_DEFINE (scm_string_join, "string-join", 1, 2, 0,
|
||||||
(SCM ls, SCM delimiter, SCM grammar),
|
(SCM ls, SCM delimiter, SCM grammar),
|
||||||
"Append the string in the string list @var{ls}, using the string\n"
|
"Append the string in the string list @var{ls}, using the string\n"
|
||||||
"@var{delim} as a delimiter between the elements of @var{ls}.\n"
|
"@var{delimiter} as a delimiter between the elements of @var{ls}.\n"
|
||||||
"@var{grammar} is a symbol which specifies how the delimiter is\n"
|
"@var{grammar} is a symbol which specifies how the delimiter is\n"
|
||||||
"placed between the strings, and defaults to the symbol\n"
|
"placed between the strings, and defaults to the symbol\n"
|
||||||
"@code{infix}.\n"
|
"@code{infix}.\n"
|
||||||
|
@ -1356,7 +1356,7 @@ SCM_DEFINE (scm_string_ci_ge, "string-ci>=", 2, 4, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_substring_hash, "string-hash", 1, 3, 0,
|
SCM_DEFINE (scm_substring_hash, "string-hash", 1, 3, 0,
|
||||||
(SCM s, SCM bound, SCM start, SCM end),
|
(SCM s, SCM bound, SCM start, SCM end),
|
||||||
"Compute a hash value for @var{S}. the optional argument "
|
"Compute a hash value for @var{s}. the optional argument "
|
||||||
"@var{bound} is a non-negative exact "
|
"@var{bound} is a non-negative exact "
|
||||||
"integer specifying the range of the hash function. "
|
"integer specifying the range of the hash function. "
|
||||||
"A positive value restricts the return value to the "
|
"A positive value restricts the return value to the "
|
||||||
|
@ -1373,7 +1373,7 @@ SCM_DEFINE (scm_substring_hash, "string-hash", 1, 3, 0,
|
||||||
|
|
||||||
SCM_DEFINE (scm_substring_hash_ci, "string-hash-ci", 1, 3, 0,
|
SCM_DEFINE (scm_substring_hash_ci, "string-hash-ci", 1, 3, 0,
|
||||||
(SCM s, SCM bound, SCM start, SCM end),
|
(SCM s, SCM bound, SCM start, SCM end),
|
||||||
"Compute a hash value for @var{S}. the optional argument "
|
"Compute a hash value for @var{s}. the optional argument "
|
||||||
"@var{bound} is a non-negative exact "
|
"@var{bound} is a non-negative exact "
|
||||||
"integer specifying the range of the hash function. "
|
"integer specifying the range of the hash function. "
|
||||||
"A positive value restricts the return value to the "
|
"A positive value restricts the return value to the "
|
||||||
|
|
|
@ -698,8 +698,8 @@ SCM_DEFINE (scm_char_set_eq, "char-set=", 0, 0, 1,
|
||||||
|
|
||||||
SCM_DEFINE (scm_char_set_leq, "char-set<=", 0, 0, 1,
|
SCM_DEFINE (scm_char_set_leq, "char-set<=", 0, 0, 1,
|
||||||
(SCM char_sets),
|
(SCM char_sets),
|
||||||
"Return @code{#t} if every character set @var{cs}i is a subset\n"
|
"Return @code{#t} if every character set @var{char_set}i is a subset\n"
|
||||||
"of character set @var{cs}i+1.")
|
"of character set @var{char_set}i+1.")
|
||||||
#define FUNC_NAME s_scm_char_set_leq
|
#define FUNC_NAME s_scm_char_set_leq
|
||||||
{
|
{
|
||||||
int argnum = 1;
|
int argnum = 1;
|
||||||
|
@ -732,7 +732,7 @@ SCM_DEFINE (scm_char_set_hash, "char-set-hash", 1, 1, 0,
|
||||||
(SCM cs, SCM bound),
|
(SCM cs, SCM bound),
|
||||||
"Compute a hash value for the character set @var{cs}. If\n"
|
"Compute a hash value for the character set @var{cs}. If\n"
|
||||||
"@var{bound} is given and non-zero, it restricts the\n"
|
"@var{bound} is given and non-zero, it restricts the\n"
|
||||||
"returned value to the range 0 @dots{} @var{bound - 1}.")
|
"returned value to the range 0 @dots{} @var{bound} - 1.")
|
||||||
#define FUNC_NAME s_scm_char_set_hash
|
#define FUNC_NAME s_scm_char_set_hash
|
||||||
{
|
{
|
||||||
const unsigned long default_bnd = 871;
|
const unsigned long default_bnd = 871;
|
||||||
|
|
4262
libguile/srfi-14.i.c
4262
libguile/srfi-14.i.c
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue