mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Merge remote-tracking branch 'origin/stable-2.0'
Conflicts: configure.ac libguile/deprecated.c libguile/deprecated.h libguile/filesys.h libguile/fluids.c libguile/fports.c libguile/gc.c libguile/guile.c libguile/numbers.c libguile/objcodes.c libguile/r6rs-ports.c libguile/smob.c libguile/socket.c libguile/threads.h module/language/scheme/decompile-tree-il.scm module/language/tree-il/peval.scm test-suite/tests/syncase.test
This commit is contained in:
commit
26d148066f
523 changed files with 10485 additions and 3954 deletions
|
@ -5,7 +5,7 @@
|
|||
# It is necessary if you want to build targets usually of interest
|
||||
# only to the maintainer.
|
||||
|
||||
# Copyright (C) 2001, 2003, 2006-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001, 2003, 2006-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
19
Makefile.am
19
Makefile.am
|
@ -1,7 +1,7 @@
|
|||
## Process this file with automake to produce Makefile.in.
|
||||
##
|
||||
## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007,
|
||||
## 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
|
||||
## 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||
##
|
||||
## This file is part of GUILE.
|
||||
##
|
||||
|
@ -42,6 +42,19 @@ SUBDIRS = \
|
|||
libguileincludedir = $(pkgincludedir)/$(GUILE_EFFECTIVE_VERSION)
|
||||
libguileinclude_HEADERS = libguile.h
|
||||
|
||||
schemelibdir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)
|
||||
schemelib_DATA = libguile/guile-procedures.txt
|
||||
|
||||
# Build it from here so that all the modules are compiled by the time we
|
||||
# build it.
|
||||
libguile/guile-procedures.txt: libguile/guile-procedures.texi
|
||||
$(AM_V_GEN) \
|
||||
$(top_builddir)/meta/guile --no-auto-compile \
|
||||
"$(srcdir)/libguile/texi-fragments-to-docstrings" \
|
||||
"$(builddir)/libguile/guile-procedures.texi" \
|
||||
> $@.tmp
|
||||
@mv $@.tmp $@
|
||||
|
||||
EXTRA_DIST = LICENSE HACKING GUILE-VERSION \
|
||||
m4/ChangeLog-2008 \
|
||||
m4/gnulib-cache.m4 \
|
||||
|
@ -50,13 +63,15 @@ EXTRA_DIST = LICENSE HACKING GUILE-VERSION \
|
|||
gnulib-local/lib/localcharset.h.diff \
|
||||
gnulib-local/lib/localcharset.c.diff \
|
||||
gnulib-local/m4/clock_time.m4.diff \
|
||||
gnulib-local/build-aux/git-version-gen.diff
|
||||
gnulib-local/build-aux/git-version-gen.diff \
|
||||
libguile/texi-fragments-to-docstrings
|
||||
|
||||
TESTS = check-guile
|
||||
TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
CLEANFILES = libguile/guile-procedures.txt
|
||||
DISTCLEANFILES = check-guile.log
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-error-on-warning
|
||||
|
|
317
NEWS
317
NEWS
|
@ -1,10 +1,325 @@
|
|||
Guile NEWS --- history of user-visible changes.
|
||||
Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2013 Free Software Foundation, Inc.
|
||||
See the end for copying conditions.
|
||||
|
||||
Please send Guile bug reports to bug-guile@gnu.org.
|
||||
|
||||
|
||||
Changes in 2.0.8 (since 2.0.7):
|
||||
|
||||
* TODO
|
||||
|
||||
Reorder points in order of importance and make comprehensible
|
||||
|
||||
Assemble thanks
|
||||
|
||||
file name docs
|
||||
|
||||
gnulib version
|
||||
|
||||
--language docs
|
||||
|
||||
* Notable changes
|
||||
|
||||
** New guile.m4.
|
||||
|
||||
The `guile.m4' autoconf macros have been rewritten to use `guild' and
|
||||
`pkg-config' instead of the deprecated `guile-config' (which itself
|
||||
calls pkg-config).
|
||||
|
||||
There is also a new macro, `GUILE_PKG', which allows packages to select
|
||||
the version of Guile that they want to compile against. See "Autoconf
|
||||
Macros" in the manual, for more information.
|
||||
|
||||
** Better Windows support.
|
||||
|
||||
Guile now correctly identifies absolute paths on Windows (MinGW), and
|
||||
creates files on that platform according to its path conventions. See
|
||||
XXX in the manual, for all details.
|
||||
|
||||
In addition, the new Gnulib imports provide `select' and `poll' on
|
||||
Windows builds.
|
||||
|
||||
As an incompatible change, systems that are missing <sys/select.h> were
|
||||
previously provided a public `scm_std_select' C function that defined a
|
||||
version of `select', but unhappily it also provided its own incompatible
|
||||
definitions for FD_SET, FD_ZERO, and other system interface. Guile
|
||||
should not be setting these macros in public API, so this interface was
|
||||
removed on those plaforms (basically only MinGW).
|
||||
|
||||
** Gnulib update.
|
||||
|
||||
Guile's copy of Gnulib was updated to XXX. The following modules were
|
||||
imported from Gnulib: select, times, pipe-posix, fstat, getlogin, and
|
||||
poll.
|
||||
|
||||
** New optimizations.
|
||||
|
||||
There were a number of improvements to the partial evaluator, allowing
|
||||
complete reduction of forms such as:
|
||||
|
||||
((let ((_ 10)) (lambda () _)))
|
||||
|
||||
((lambda _ _))
|
||||
|
||||
(apply (lambda _) 1 2 3 4)
|
||||
|
||||
(call-with-values (lambda () (values 1 2)) (lambda _ _))
|
||||
|
||||
A number (ahem) of numeric operations on have been made faster, among
|
||||
them GCD and logarithms.
|
||||
|
||||
Finally, `array-ref' and `array-set!' on arrays of rank 1 or 2 is now
|
||||
faster, because it avoids building a rest list.
|
||||
|
||||
** `include' resolves relative file names relative to including file.
|
||||
|
||||
Given a relative file name, `include' will look for it relative to the
|
||||
directory of the including file. This harmonizes the behavior of
|
||||
`include' with that of `load'.
|
||||
|
||||
** SLIB compatibility restored.
|
||||
|
||||
Guile 2.0.8 is now compatible with SLIB. You will have to use a
|
||||
development version of SLIB, however, until a new version of SLIB is
|
||||
released.
|
||||
|
||||
** Better ,trace REPL command.
|
||||
|
||||
Sometimes the ,trace output for nested function calls could overflow the
|
||||
terminal width, which wasn't useful. Now there is a limit to the amount
|
||||
of space the prefix will take. See the documentation for ",trace" for
|
||||
more information.
|
||||
|
||||
** Update predefined character sets to Unicode 6.2.
|
||||
|
||||
* Manual updates
|
||||
|
||||
** Better SXML documentation.
|
||||
|
||||
The documentation for SXML modules was much improved, though there is
|
||||
still far to go. See "SXML" in manual.
|
||||
|
||||
** Style updates.
|
||||
|
||||
Use of "iff" was replaced with standard English. Keyword arguments are
|
||||
now documented consistently, along with their default values.
|
||||
|
||||
** An end to the generated-documentation experiment.
|
||||
|
||||
When Guile 2.0 imported some modules from Guile-Lib, they came with a
|
||||
system that generated documentation from docstrings and module
|
||||
commentaries. This produced terrible documentation. We finally bit the
|
||||
bullet and incorporated these modules into the main text, and will be
|
||||
improving them manually over time, as is the case with SXML. Help is
|
||||
appreciated.
|
||||
|
||||
** New documentation.
|
||||
|
||||
There is now documentation for `scm_array_type', and `scm_array_ref', as
|
||||
well as for the new `array-length' / 'scm_c_array_length' /
|
||||
`scm_array_length' functions. `array-in-bounds?' has better
|
||||
documentation as well. The `program-arguments-alist' and
|
||||
`program-lambda-list' functions are now documented. Finally, the GOOPS
|
||||
class hierarchy diagram has been regenerated for the web and print
|
||||
output formats.
|
||||
|
||||
* New deprecations
|
||||
|
||||
** Deprecate generalized vector interface.
|
||||
|
||||
The generalized vector interface, introduced in 1.8.0, is simply a
|
||||
redundant, verbose interface to arrays of rank 1. `array-ref' and
|
||||
similar functions are entirely sufficient. Thus,
|
||||
`scm_generalized_vector_p', `scm_generalized_vector_length',
|
||||
`scm_generalized_vector_ref', `scm_generalized_vector_set_x', and
|
||||
`scm_generalized_vector_to_list' are now deprecated.
|
||||
|
||||
** Deprecate SCM_CHAR_CODE_LIMIT and char-code-limit.
|
||||
|
||||
These constants were defined to 256, which is not the highest codepoint
|
||||
supported by Guile. Given that they were useless and incorrect, they
|
||||
have been deprecated.
|
||||
|
||||
** Deprecate `http-get*'.
|
||||
|
||||
The new `#:streaming?' argument to `http-get' subsumes the functionality
|
||||
of `http-get*' (introduced in 2.0.7). Also, the `#:extra-headers'
|
||||
argument is deprecated in favor of `#:headers'.
|
||||
|
||||
** Deprecate (ice-9 mapping).
|
||||
|
||||
This module, present in Guile since 1996 but never used or documented,
|
||||
has never worked in Guile 2.0. It has now been deprecated and will be
|
||||
removed in Guile 2.2.
|
||||
|
||||
* New interfaces
|
||||
|
||||
** `round-ash', a bit-shifting operator that rounds on right-shift.
|
||||
|
||||
See "Bitwise Operations".
|
||||
|
||||
** New environment variables: `GUILE_STACK_SIZE', `GUILE_INSTALL_LOCALE'.
|
||||
|
||||
See "Environment Variables".
|
||||
|
||||
** New procedure `sendfile'.
|
||||
|
||||
See "File System".
|
||||
|
||||
** New procedures for dealing with file names.
|
||||
|
||||
See XXX for documentation on `system-file-name-convention',
|
||||
`file-name-separator?', `absolute-file-name?', and
|
||||
`file-name-separator-string'.
|
||||
|
||||
** `array-length', an array's first dimension.
|
||||
|
||||
See "Array Procedures".
|
||||
|
||||
** `hash-count', for hash tables.
|
||||
|
||||
See "Hash Tables".
|
||||
|
||||
** New foreign types: `ssize_t', `ptrdiff_t'.
|
||||
|
||||
See "Foreign Types".
|
||||
|
||||
** New C helpers: `scm_from_ptrdiff_t', `scm_to_ptrdiff_t'.
|
||||
|
||||
See "Integers".
|
||||
|
||||
** Much more capable `xml->sxml'
|
||||
|
||||
See "Reading and Writing XML" for information on how the `xml->sxml'
|
||||
parser deals with namespaces, processed entities, doctypes, and literal
|
||||
strings. Incidentally, `current-ssax-error-port' is now a parameter
|
||||
object.
|
||||
|
||||
** New command-line argument: `--language'
|
||||
|
||||
See XXX in the manual.
|
||||
|
||||
** `current-language' in default environment.
|
||||
|
||||
Previously defined only in `(system base language)', `current-language'
|
||||
is now defined in the default environment, and is used to determine the
|
||||
language for the REPL, and for `compile-and-load'.
|
||||
|
||||
** New procedure: `fluid->parameter'
|
||||
|
||||
See "Parameters", for information on how to convert a fluid to a
|
||||
parameter.
|
||||
|
||||
** New procedures to read all characters from a port
|
||||
|
||||
See "Line/Delimited" in the manual for documentation on `read-string'
|
||||
and `read-string!'.
|
||||
|
||||
** New HTTP client procedures.
|
||||
|
||||
See "Web Client" for documentation on the new `http-head', `http-post',
|
||||
`http-put', `http-delete', `http-trace', and `http-options' procedures,
|
||||
and also for more options to `http-get'.
|
||||
|
||||
** New procedures for converting strings to and from bytevectors.
|
||||
|
||||
See "Representing Strings as Bytes" for documention on the new `(ice-9
|
||||
iconv)' module and its `bytevector->string' and `string->bytevector'
|
||||
procedures.
|
||||
|
||||
** New `print' REPL option.
|
||||
|
||||
See "REPL Commands" in the manual for information on the new
|
||||
user-customizable REPL printer.
|
||||
|
||||
** New variable: %site-ccache-dir.
|
||||
|
||||
The "Installing Site Packages" and "Build Config" manual sections now
|
||||
refer to this variable to describe where users should install their
|
||||
`.go' files.
|
||||
|
||||
* Build fixes
|
||||
|
||||
** Fix compilation against libgc 7.3.
|
||||
** Fix cross-compilation of `c-tokenize.o'.
|
||||
** Fix warning when compiling against glibc 2.17.
|
||||
** Fix documentation build against Texinfo 5.0.
|
||||
** Fix building Guile from a directory with non-ASCII characters.
|
||||
** Fix native MinGW build.
|
||||
** Fix --disable-posix build.
|
||||
** Fix MinGW builds with networking, POSIX, and thread support.
|
||||
|
||||
* Bug fixes
|
||||
|
||||
** SRFI-37: Fix infinite loop when parsing optional-argument short options
|
||||
(http://bugs.gnu.org/13176)
|
||||
** web: Support non-GMT date headers in the HTTP client
|
||||
(http://bugs.gnu.org/13544)
|
||||
** Avoid stack overflows with `par-map' and nested futures in general
|
||||
(http://bugs.gnu.org/13188)
|
||||
** A fork when multiple threads are running will now print a warning.
|
||||
** Allow for spurious wakeups from pthread_cond_wait.
|
||||
(http://bugs.gnu.org/10641)
|
||||
** Warn and ignore module autoload failures.
|
||||
(http://bugs.gnu.org/12202)
|
||||
** Use chmod portably in (system base compile).
|
||||
(http://bugs.gnu.org/10474)
|
||||
** Fix response-body-port for responses without content-length.
|
||||
(http://bugs.gnu.org/13857)
|
||||
** Allow case-lambda expressions with no clauses.
|
||||
(http://bugs.gnu.org/9776)
|
||||
** Improve standards conformance of string->number.
|
||||
(http://bugs.gnu.org/11887)
|
||||
** Support calls and tail-calls with more than 255 formals.
|
||||
** ,option evaluates its right-hand-side.
|
||||
(http://bugs.gnu.org/13076)
|
||||
** Structs with tail arrays are not simple.
|
||||
(http://bugs.gnu.org/12808)
|
||||
** Make `SCM_LONG_BIT' usable in preprocessor conditionals.
|
||||
(http://bugs.gnu.org/13848)
|
||||
** Fix thread-unsafe lazy initializations.
|
||||
** Allow SMOB mark procedures to be called from parallel markers.
|
||||
(http://bugs.gnu.org/13611)
|
||||
** Fix later-bindings-win logic in with-fluids.
|
||||
(http://bugs.gnu.org/13843)
|
||||
** Fix duplicate removal of with-fluids.
|
||||
(http://bugs.gnu.org/13838)
|
||||
** Support calling foreign functions of 10 arguments or more.
|
||||
(http://bugs.gnu.org/13809)
|
||||
** Let reverse! accept arbitrary types as second argument.
|
||||
(http://bugs.gnu.org/13835)
|
||||
** Recognize the `x86_64.*-gnux32' triplet.
|
||||
** Check whether a triplet's OS part specifies an ABI.
|
||||
** Recognize mips64* as having 32-bit pointers by default.
|
||||
** Remove language/glil/decompile-assembly.scm.
|
||||
(http://bugs.gnu.org/10622)
|
||||
** Use O_BINARY in `copy-file', `load-objcode', `mkstemp'.
|
||||
** Fix compilation of functions with more than 255 local variables.
|
||||
** Fix `getgroups' for when zero supplementary group IDs exist.
|
||||
** Allow (define-macro name (lambda ...)).
|
||||
** Various fixes to the (texinfo) modules.
|
||||
** guild: Gracefully handle failures to install the locale.
|
||||
** Fix format string warnings for ~!, ~|, ~/, ~q, ~Q, and ~^.
|
||||
(http://bugs.gnu.org/13485)
|
||||
** Fix source annotation bug in psyntax 'expand-body'.
|
||||
** Ecmascript: Fix conversion to boolean for non-numbers.
|
||||
** A failure to find a module's file does not prevent future loading.
|
||||
** Many (oop goops save) fixes.
|
||||
** `http-get': don't shutdown write end of socket.
|
||||
(http://bugs.gnu.org/13095)
|
||||
** Avoid signed integer overflow in scm_product.
|
||||
** http: read-response-body always returns bytevector or #f (not EOF in one case).
|
||||
** web: Correctly detect "No route to host" conditions.
|
||||
** `system*': failure to execvp no longer leaks dangling processes
|
||||
(http://bugs.gnu.org/13166)
|
||||
** More sensible case-lambda* dispatch
|
||||
(http://bugs.gnu.org/12929)
|
||||
** Do not defer expansion of internal define-syntax forms.
|
||||
(http://bugs.gnu.org/13509)
|
||||
|
||||
|
||||
|
||||
Changes in 2.0.7 (since 2.0.6):
|
||||
|
||||
* Notable changes
|
||||
|
|
4
THANKS
4
THANKS
|
@ -9,6 +9,7 @@ Contributors since the last release:
|
|||
Daniel Hartwig
|
||||
No Itisnt
|
||||
Neil Jerram
|
||||
Chris K Jester-Young
|
||||
Daniel Kraft
|
||||
Noah Lavine
|
||||
Gregory Marton
|
||||
|
@ -21,7 +22,7 @@ Contributors since the last release:
|
|||
Ken Raeburn
|
||||
Andreas Rottmann
|
||||
Kevin Ryde
|
||||
Brian Templeton
|
||||
BT Templeton
|
||||
Mark H Weaver
|
||||
Göran Weinholt
|
||||
Ralf Wildenhues
|
||||
|
@ -94,6 +95,7 @@ For fixes or providing information which led to a fix:
|
|||
David Jaquay
|
||||
Paul Jarc
|
||||
Steve Juranich
|
||||
David Kastrup
|
||||
Richard Kim
|
||||
Bruce Korb
|
||||
René Köcher
|
||||
|
|
|
@ -9,7 +9,7 @@ my $VERSION = '2012-06-08 06:53'; # UTC
|
|||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2012 Free Software Foundation, Inc.
|
||||
# Copyright 1996-2013 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
|
|
160
build-aux/gendocs.sh
Executable file → Normal file
160
build-aux/gendocs.sh
Executable file → Normal file
|
@ -2,9 +2,9 @@
|
|||
# gendocs.sh -- generate a GNU manual in many formats. This script is
|
||||
# mentioned in maintain.texi. See the help message below for usage details.
|
||||
|
||||
scriptversion=2012-10-27.11
|
||||
scriptversion=2013-02-03.15
|
||||
|
||||
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
# Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
@ -56,7 +56,7 @@ unset use_texi2html
|
|||
|
||||
version="gendocs.sh $scriptversion
|
||||
|
||||
Copyright 2012 Free Software Foundation, Inc.
|
||||
Copyright 2013 Free Software Foundation, Inc.
|
||||
There is NO warranty. You may redistribute this software
|
||||
under the terms of the GNU General Public License.
|
||||
For more information about these matters, see the files named COPYING."
|
||||
|
@ -69,16 +69,23 @@ discussion:
|
|||
http://www.gnu.org/prep/maintain_toc.html
|
||||
|
||||
Options:
|
||||
-s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
|
||||
-o OUTDIR write files into OUTDIR, instead of manual/.
|
||||
-I DIR append DIR to the Texinfo search path.
|
||||
--email ADR use ADR as contact in generated web pages.
|
||||
--docbook convert through DocBook too (xml, txt, html, pdf).
|
||||
--html ARG pass indicated ARG to makeinfo or texi2html for HTML targets.
|
||||
--info ARG pass indicated ARG to makeinfo for Info, instead of --no-split.
|
||||
--texi2html use texi2html to generate HTML targets.
|
||||
--help display this help and exit successfully.
|
||||
--version display version information and exit successfully.
|
||||
--email ADR use ADR as contact in generated web pages; always give this.
|
||||
|
||||
-s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
|
||||
-o OUTDIR write files into OUTDIR, instead of manual/.
|
||||
-I DIR append DIR to the Texinfo search path.
|
||||
--common ARG pass ARG in all invocations.
|
||||
--html ARG pass ARG to makeinfo or texi2html for HTML targets.
|
||||
--info ARG pass ARG to makeinfo for Info, instead of --no-split.
|
||||
--no-ascii skip generating the plain text output.
|
||||
--source ARG include ARG in tar archive of sources.
|
||||
--split HOW make split HTML by node, section, chapter; default node.
|
||||
|
||||
--texi2html use texi2html to make HTML target, with all split versions.
|
||||
--docbook convert through DocBook too (xml, txt, html, pdf).
|
||||
|
||||
--help display this help and exit successfully.
|
||||
--version display version information and exit successfully.
|
||||
|
||||
Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
|
||||
|
||||
|
@ -92,8 +99,8 @@ Output will be in a new subdirectory \"manual\" (by default;
|
|||
use -o OUTDIR to override). Move all the new files into your web CVS
|
||||
tree, as explained in the Web Pages node of maintain.texi.
|
||||
|
||||
Please do use the --email ADDRESS option to specify your bug-reporting
|
||||
address in the generated HTML pages.
|
||||
Please use the --email ADDRESS option so your own bug-reporting
|
||||
address will be used in the generated HTML pages.
|
||||
|
||||
MANUAL-TITLE is included as part of the HTML <title> of the overall
|
||||
manual/index.html file. It should include the name of the package being
|
||||
|
@ -117,7 +124,7 @@ You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
|
|||
and PERL to control the programs that get executed, and
|
||||
GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
|
||||
looked for. With --docbook, the environment variables DOCBOOK2HTML,
|
||||
DOCBOOK2PDF, and DOCBOOK2TXT are also respected.
|
||||
DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
|
||||
|
||||
By default, makeinfo and texi2dvi are run in the default (English)
|
||||
locale, since that's the language of most Texinfo manuals. If you
|
||||
|
@ -130,25 +137,34 @@ Email bug reports or enhancement requests to bug-texinfo@gnu.org.
|
|||
MANUAL_TITLE=
|
||||
PACKAGE=
|
||||
EMAIL=webmasters@gnu.org # please override with --email
|
||||
commonarg= # Options passed to all the tools (-I dir).
|
||||
commonarg= # passed to all makeinfo/texi2html invcations.
|
||||
dirargs= # passed to all tools (-I dir).
|
||||
dirs= # -I's directories.
|
||||
htmlarg=
|
||||
infoarg=--no-split
|
||||
generate_ascii=true
|
||||
outdir=manual
|
||||
source_extra=
|
||||
split=node
|
||||
srcfile=
|
||||
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--email) shift; EMAIL=$1;;
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
-s) shift; srcfile=$1;;
|
||||
-o) shift; outdir=$1;;
|
||||
-I) shift; commonarg="$commonarg -I '$1'"; dirs="$dirs $1";;
|
||||
--docbook) docbook=yes;;
|
||||
--html) shift; htmlarg=$1;;
|
||||
--info) shift; infoarg=$1;;
|
||||
-s) shift; srcfile=$1;;
|
||||
-o) shift; outdir=$1;;
|
||||
-I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
|
||||
--common) shift; commonarg=$1;;
|
||||
--docbook) docbook=yes;;
|
||||
--email) shift; EMAIL=$1;;
|
||||
--html) shift; htmlarg=$1;;
|
||||
--info) shift; infoarg=$1;;
|
||||
--no-ascii) generate_ascii=false;;
|
||||
--source) shift; source_extra=$1;;
|
||||
--split) shift; split=$1;;
|
||||
--texi2html) use_texi2html=1;;
|
||||
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
-*)
|
||||
echo "$0: Unknown option \`$1'." >&2
|
||||
echo "$0: Try \`--help' for more information." >&2
|
||||
|
@ -166,6 +182,9 @@ while test $# -gt 0; do
|
|||
shift
|
||||
done
|
||||
|
||||
# makeinfo uses the dirargs, but texi2dvi doesn't.
|
||||
commonarg=" $dirargs $commonarg"
|
||||
|
||||
# For most of the following, the base name is just $PACKAGE
|
||||
base=$PACKAGE
|
||||
|
||||
|
@ -247,46 +266,52 @@ case $outdir in
|
|||
*) abs_outdir=$srcdir/$outdir;;
|
||||
esac
|
||||
|
||||
echo "Generating output formats for $srcfile"
|
||||
echo "Making output for $srcfile"
|
||||
echo " in `pwd`"
|
||||
mkdir -p "$outdir/"
|
||||
|
||||
cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
|
||||
echo "Generating info file(s)... ($cmd)"
|
||||
echo "Generating info... ($cmd)"
|
||||
eval "$cmd"
|
||||
mkdir -p "$outdir/"
|
||||
tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
|
||||
ls -l "$outdir/$PACKAGE.info.tar.gz"
|
||||
info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
|
||||
# do not mv the info files, there's no point in having them available
|
||||
# separately on the web.
|
||||
|
||||
cmd="$SETLANG $TEXI2DVI $commonarg \"$srcfile\""
|
||||
echo "Generating dvi ... ($cmd)"
|
||||
cmd="$SETLANG $TEXI2DVI $dirargs \"$srcfile\""
|
||||
printf "\nGenerating dvi... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
|
||||
# compress/finish dvi:
|
||||
gzip -f -9 $PACKAGE.dvi
|
||||
dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
|
||||
mv $PACKAGE.dvi.gz "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.dvi.gz"
|
||||
|
||||
cmd="$SETLANG $TEXI2DVI --pdf $commonarg \"$srcfile\""
|
||||
echo "Generating pdf ... ($cmd)"
|
||||
cmd="$SETLANG $TEXI2DVI --pdf $dirargs \"$srcfile\""
|
||||
printf "\nGenerating pdf... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
pdf_size=`calcsize $PACKAGE.pdf`
|
||||
mv $PACKAGE.pdf "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.pdf"
|
||||
|
||||
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
echo "Generating ASCII... ($cmd)"
|
||||
eval "$cmd"
|
||||
ascii_size=`calcsize $PACKAGE.txt`
|
||||
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
|
||||
ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
|
||||
mv $PACKAGE.txt "$outdir/"
|
||||
if $generate_ascii; then
|
||||
opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
printf "\nGenerating ascii... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
ascii_size=`calcsize $PACKAGE.txt`
|
||||
gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
|
||||
ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
|
||||
mv $PACKAGE.txt "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
|
||||
fi
|
||||
|
||||
html_split()
|
||||
{
|
||||
opt="--split=$1 $commonarg $htmlarg --node-files"
|
||||
opt="--split=$1 --node-files $commonarg $htmlarg"
|
||||
cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
|
||||
echo "Generating html by $1... ($cmd)"
|
||||
printf "\nGenerating html by $1... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
split_html_dir=$PACKAGE.html
|
||||
(
|
||||
|
@ -304,7 +329,7 @@ html_split()
|
|||
if test -z "$use_texi2html"; then
|
||||
opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
echo "Generating monolithic html... ($cmd)"
|
||||
printf "\nGenerating monolithic html... ($cmd)\n"
|
||||
rm -rf $PACKAGE.html # in case a directory is left over
|
||||
eval "$cmd"
|
||||
html_mono_size=`calcsize $PACKAGE.html`
|
||||
|
@ -312,24 +337,29 @@ if test -z "$use_texi2html"; then
|
|||
html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
|
||||
copy_images "$outdir/" $PACKAGE.html
|
||||
mv $PACKAGE.html "$outdir/"
|
||||
ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
|
||||
|
||||
opt="--html -o $PACKAGE.html $commonarg $htmlarg"
|
||||
opt="--html -o $PACKAGE.html --split=$split $commonarg $htmlarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
|
||||
echo "Generating html by node... ($cmd)"
|
||||
printf "\nGenerating html by $split... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
split_html_dir=$PACKAGE.html
|
||||
copy_images $split_html_dir/ $split_html_dir/*.html
|
||||
(
|
||||
cd $split_html_dir || exit 1
|
||||
tar -czf "$abs_outdir/$PACKAGE.html_node.tar.gz" -- *
|
||||
tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
|
||||
)
|
||||
html_node_tgz_size=`calcsize "$outdir/$PACKAGE.html_node.tar.gz"`
|
||||
rm -rf "$outdir/html_node/"
|
||||
mv $split_html_dir "$outdir/html_node/"
|
||||
else
|
||||
eval \
|
||||
html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
|
||||
rm -rf "$outdir/html_$split/"
|
||||
mv $split_html_dir "$outdir/html_$split/"
|
||||
du -s "$outdir/html_$split/"
|
||||
ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
|
||||
|
||||
else # use texi2html:
|
||||
opt="--output $PACKAGE.html $commonarg $htmlarg"
|
||||
cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
|
||||
echo "Generating monolithic html... ($cmd)"
|
||||
printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
|
||||
rm -rf $PACKAGE.html # in case a directory is left over
|
||||
eval "$cmd"
|
||||
html_mono_size=`calcsize $PACKAGE.html`
|
||||
|
@ -342,19 +372,20 @@ else
|
|||
html_split section
|
||||
fi
|
||||
|
||||
echo Making .tar.gz for sources...
|
||||
printf "\nMaking .tar.gz for sources...\n"
|
||||
d=`dirname $srcfile`
|
||||
(
|
||||
cd "$d"
|
||||
srcfiles=`ls *.texinfo *.texi *.txi *.eps 2>/dev/null` || true
|
||||
tar cvzfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
|
||||
srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
|
||||
tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
|
||||
ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
|
||||
)
|
||||
texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
|
||||
|
||||
if test -n "$docbook"; then
|
||||
opt="-o - --docbook $commonarg"
|
||||
cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
|
||||
echo "Generating docbook XML... ($cmd)"
|
||||
printf "\nGenerating docbook XML... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_xml_size=`calcsize $PACKAGE-db.xml`
|
||||
gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
|
||||
|
@ -364,7 +395,7 @@ if test -n "$docbook"; then
|
|||
split_html_db_dir=html_node_db
|
||||
opt="$commonarg -o $split_html_db_dir"
|
||||
cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
|
||||
echo "Generating docbook HTML... ($cmd)"
|
||||
printf "\nGenerating docbook HTML... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
(
|
||||
cd ${split_html_db_dir} || exit 1
|
||||
|
@ -377,24 +408,25 @@ if test -n "$docbook"; then
|
|||
rmdir ${split_html_db_dir}
|
||||
|
||||
cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
|
||||
echo "Generating docbook ASCII... ($cmd)"
|
||||
printf "\nGenerating docbook ASCII... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_ascii_size=`calcsize $PACKAGE-db.txt`
|
||||
mv $PACKAGE-db.txt "$outdir/"
|
||||
|
||||
cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
|
||||
echo "Generating docbook PDF... ($cmd)"
|
||||
printf "\nGenerating docbook PDF... ($cmd)\n"
|
||||
eval "$cmd"
|
||||
docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
|
||||
mv $PACKAGE-db.pdf "$outdir/"
|
||||
fi
|
||||
|
||||
echo "Writing index file..."
|
||||
printf "\nMaking index file...\n"
|
||||
if test -z "$use_texi2html"; then
|
||||
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
|
||||
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
|
||||
CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
|
||||
/%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
|
||||
else
|
||||
CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
|
||||
# should take account of --split here.
|
||||
CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
|
||||
fi
|
||||
|
||||
curdate=`$SETLANG date '+%B %d, %Y'`
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
# Print a version string.
|
||||
scriptversion=2012-07-06.14; # UTC
|
||||
scriptversion=2012-12-31.23; # UTC
|
||||
|
||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2007-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -85,16 +85,18 @@ Print a version string.
|
|||
|
||||
Options:
|
||||
|
||||
--prefix prefix of git tags to strip from version (default 'v')
|
||||
--match pattern for git tags to match (default: '\$prefix*')
|
||||
--prefix prefix of git tags (default 'v')
|
||||
--match pattern for git tags to match (default: '\$prefix*')
|
||||
--fallback fallback version to use if \"git --version\" fails
|
||||
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
--help display this help and exit
|
||||
--version output version information and exit
|
||||
|
||||
Running without arguments will suffice in most cases. If no --match
|
||||
argument is given, only match tags that begin with the --prefix."
|
||||
Running without arguments will suffice in most cases."
|
||||
|
||||
prefix=v
|
||||
fallback=
|
||||
|
||||
unset match
|
||||
unset tag_sed_script
|
||||
|
||||
|
@ -104,14 +106,15 @@ while test $# -gt 0; do
|
|||
--version) echo "$version"; exit 0;;
|
||||
--prefix) shift; prefix="$1";;
|
||||
--match) shift; match="$1";;
|
||||
--fallback) shift; fallback="$1";;
|
||||
-*)
|
||||
echo "$0: Unknown option '$1'." >&2
|
||||
echo "$0: Try '--help' for more information." >&2
|
||||
exit 1;;
|
||||
*)
|
||||
if test -z "$tarball_version_file"; then
|
||||
if test "x$tarball_version_file" = x; then
|
||||
tarball_version_file="$1"
|
||||
elif test -z "$tag_sed_script"; then
|
||||
elif test "x$tag_sed_script" = x; then
|
||||
tag_sed_script="$1"
|
||||
else
|
||||
echo "$0: extra non-option argument '$1'." >&2
|
||||
|
@ -121,7 +124,7 @@ while test $# -gt 0; do
|
|||
shift
|
||||
done
|
||||
|
||||
if test -z "$tarball_version_file"; then
|
||||
if test "x$tarball_version_file" = x; then
|
||||
echo "$usage"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -146,18 +149,19 @@ then
|
|||
[0-9]*) ;;
|
||||
*) v= ;;
|
||||
esac
|
||||
test -z "$v" \
|
||||
test "x$v" = x \
|
||||
&& echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2
|
||||
fi
|
||||
|
||||
if test -n "$v"
|
||||
if test "x$v" != x
|
||||
then
|
||||
: # use $v
|
||||
# Otherwise, if there is at least one git commit involving the working
|
||||
# directory, and "git describe" output looks sensible, use that to
|
||||
# derive a version string.
|
||||
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
|
||||
&& v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null` \
|
||||
&& v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null \
|
||||
|| git describe --abbrev=4 HEAD 2>/dev/null` \
|
||||
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
|
||||
&& case $v in
|
||||
$prefix[0-9]*) ;;
|
||||
|
@ -189,8 +193,10 @@ then
|
|||
# Remove the "g" in git describe's output string, to save a byte.
|
||||
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
|
||||
v_from_git=1
|
||||
else
|
||||
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
|
||||
v=UNKNOWN
|
||||
else
|
||||
v=$fallback
|
||||
fi
|
||||
|
||||
v=`echo "$v" |sed "s/^$prefix//"`
|
||||
|
@ -198,7 +204,7 @@ v=`echo "$v" |sed "s/^$prefix//"`
|
|||
# Test whether to append the "-dirty" suffix only if the version
|
||||
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
|
||||
# or if it came from .tarball-version.
|
||||
if test -n "$v_from_git"; then
|
||||
if test "x$v_from_git" != x; then
|
||||
# Don't declare a version "dirty" merely because a time stamp has changed.
|
||||
git update-index --refresh > /dev/null 2>&1
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ my $VERSION = '2012-07-29 06:11'; # UTC
|
|||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
#!/bin/sh
|
||||
# Run this after each non-alpha release, to update the web documentation at
|
||||
# http://www.gnu.org/software/$pkg/manual/
|
||||
# This script must be run from the top-level directory,
|
||||
# assumes you're using git for revision control,
|
||||
# and requires a .prev-version file as well as a Makefile,
|
||||
# from which it extracts the version number and package name, respectively.
|
||||
# Also, it assumes all documentation is in the doc/ sub-directory.
|
||||
|
||||
VERSION=2009-07-21.16; # UTC
|
||||
VERSION=2012-12-16.14; # UTC
|
||||
|
||||
# Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -37,8 +32,14 @@ Run this script from top_srcdir (no arguments) after each non-alpha
|
|||
release, to update the web documentation at
|
||||
http://www.gnu.org/software/\$pkg/manual/
|
||||
|
||||
This script assumes you're using git for revision control, and
|
||||
requires a .prev-version file as well as a Makefile, from which it
|
||||
extracts the version number and package name, respectively. Also, it
|
||||
assumes all documentation is in the doc/ sub-directory.
|
||||
|
||||
Options:
|
||||
-C, --builddir=DIR location of (configured) Makefile (default: .)
|
||||
-n, --dry-run don't actually commit anything
|
||||
--help print this help, then exit
|
||||
--version print version number, then exit
|
||||
|
||||
|
@ -100,12 +101,12 @@ find_tool ()
|
|||
# Requirements: everything required to bootstrap your package, plus
|
||||
# these.
|
||||
find_tool CVS cvs
|
||||
find_tool CVSU cvsu
|
||||
find_tool GIT git
|
||||
find_tool RSYNC rsync
|
||||
find_tool XARGS gxargs xargs
|
||||
|
||||
builddir=.
|
||||
dryrun=
|
||||
while test $# != 0
|
||||
do
|
||||
# Handle --option=value by splitting apart and putting back on argv.
|
||||
|
@ -121,6 +122,7 @@ do
|
|||
case $1 in
|
||||
--help|--version) ${1#--};;
|
||||
-C|--builddir) shift; builddir=$1; shift ;;
|
||||
-n|--dry-run) dryrun=echo; shift;;
|
||||
--*) die "unrecognized option: $1";;
|
||||
*) break;;
|
||||
esac
|
||||
|
@ -139,7 +141,7 @@ current_branch=$($GIT branch | sed -ne '/^\* /{s///;p;q;}')
|
|||
cleanup()
|
||||
{
|
||||
__st=$?
|
||||
rm -rf "$tmp"
|
||||
$dryrun rm -rf "$tmp"
|
||||
$GIT checkout "$current_branch"
|
||||
$GIT submodule update --recursive
|
||||
$GIT branch -d $tmp_branch
|
||||
|
@ -172,12 +174,15 @@ $RSYNC -avP "$builddir"/doc/manual/ $tmp/$pkg/manual
|
|||
(
|
||||
cd $tmp/$pkg/manual
|
||||
|
||||
# Add any new files:
|
||||
$CVSU --types='?' \
|
||||
| sed s/..// \
|
||||
| $XARGS --no-run-if-empty -- $CVS add -ko
|
||||
# Add all the files. This is simpler than trying to add only the
|
||||
# new ones because of new directories: it would require iterating on
|
||||
# adding the outer directories, and then their contents.
|
||||
#
|
||||
# find guarantees that we add outer directories first.
|
||||
find . -name CVS -prune -o -print \
|
||||
| $XARGS --no-run-if-empty -- $dryrun $CVS add -ko
|
||||
|
||||
$CVS ci -m $version
|
||||
$dryrun $CVS ci -m $version
|
||||
)
|
||||
|
||||
# Local variables:
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
# Sign files and upload them.
|
||||
|
||||
scriptversion=2012-06-11.00; # UTC
|
||||
scriptversion=2012-12-11.16; # UTC
|
||||
|
||||
# Copyright (C) 2004-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -242,6 +242,8 @@ fi
|
|||
|
||||
# Make sure passphrase is not exported in the environment.
|
||||
unset passphrase
|
||||
unset passphrase_fd_0
|
||||
GNUPGHOME=${GNUPGHOME:-$HOME/.gnupg}
|
||||
|
||||
# Reset PATH to be sure that echo is a built-in. We will later use
|
||||
# 'echo $passphrase' to output the passphrase, so it is important that
|
||||
|
@ -249,12 +251,13 @@ unset passphrase
|
|||
# listings with their arguments...).
|
||||
# Remember this script runs with 'set -e', so if echo is not built-in
|
||||
# it will exit now.
|
||||
if $dry_run; then :; else
|
||||
if $dry_run || grep -q "^use-agent" $GNUPGHOME/gpg.conf; then :; else
|
||||
PATH=/empty echo -n "Enter GPG passphrase: "
|
||||
stty -echo
|
||||
read -r passphrase
|
||||
stty echo
|
||||
echo
|
||||
passphrase_fd_0="--passphrase-fd 0"
|
||||
fi
|
||||
|
||||
if test $# -ne 0; then
|
||||
|
@ -262,7 +265,7 @@ if test $# -ne 0; then
|
|||
do
|
||||
echo "Signing $file ..."
|
||||
rm -f $file.sig
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 -ba -o $file.sig $file
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 -ba -o $file.sig $file
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -320,12 +323,12 @@ upload ()
|
|||
case $dest in
|
||||
alpha.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/alpha $files $base.directive.asc
|
||||
;;
|
||||
ftp.gnu.org:*)
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg ncftpput ftp-upload.gnu.org /incoming/ftp $files $base.directive.asc
|
||||
;;
|
||||
savannah.gnu.org:*)
|
||||
|
@ -344,7 +347,7 @@ upload ()
|
|||
destdir_p1=`echo "$destdir" | sed 's,^[^/]*/,,'`
|
||||
destdir_topdir=`echo "$destdir" | sed 's,/.*,,'`
|
||||
mkdirective "$destdir_p1" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
for f in $files $base.directive.asc
|
||||
do
|
||||
echo put $f
|
||||
|
@ -353,7 +356,7 @@ upload ()
|
|||
/*)
|
||||
dest_host=`echo "$dest" | sed 's,:.*,,'`
|
||||
mkdirective "$destdir" "$base" "$file" "$stmt"
|
||||
echo "$passphrase" | $dbg $GPG --passphrase-fd 0 --clearsign $base.directive
|
||||
echo "$passphrase" | $dbg $GPG $passphrase_fd_0 --clearsign $base.directive
|
||||
$dbg cp $files $base.directive.asc $dest_host
|
||||
;;
|
||||
*)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* A C macro for declaring that specific arguments must not be NULL.
|
||||
Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* C++ compatible function declaration macros.
|
||||
Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* A C macro for declaring that specific function parameters are not used.
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* A C macro for emitting warnings if a function is used.
|
||||
Copyright (C) 2010-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2010-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published
|
||||
|
@ -55,7 +55,7 @@
|
|||
rather than issue the nice warning, but the end result of informing
|
||||
the developer about their portability problem is still achieved):
|
||||
#if HAVE_RAW_DECL_ENVIRON
|
||||
static inline char ***rpl_environ (void) { return &environ; }
|
||||
static char ***rpl_environ (void) { return &environ; }
|
||||
_GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
|
||||
# undef environ
|
||||
# define environ (*rpl_environ ())
|
||||
|
|
|
@ -10,7 +10,7 @@ my $VERSION = '2012-01-06 07:23'; # UTC
|
|||
# If you change this file with Emacs, please let the write hook
|
||||
# do its job. Otherwise, update this string manually.
|
||||
|
||||
# Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Print a version string.
|
||||
scriptversion=2011-05-16.22; # UTC
|
||||
|
||||
# Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2013 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
35
configure.ac
35
configure.ac
|
@ -647,12 +647,13 @@ AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64])
|
|||
# this file instead of <fenv.h>
|
||||
# process.h - mingw specific
|
||||
# sched.h - missing on MinGW
|
||||
# sys/sendfile.h - non-POSIX, found in glibc
|
||||
#
|
||||
AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h memory.h process.h string.h \
|
||||
sys/dir.h sys/ioctl.h sys/select.h \
|
||||
sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
|
||||
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
|
||||
direct.h machine/fpu.h poll.h sched.h])
|
||||
direct.h machine/fpu.h sched.h sys/sendfile.h])
|
||||
|
||||
# "complex double" is new in C99, and "complex" is only a keyword if
|
||||
# <complex.h> is included
|
||||
|
@ -705,9 +706,6 @@ case $host in
|
|||
[Define if you have the <winsock2.h> header file.])])
|
||||
AC_CHECK_LIB(ws2_32, main)
|
||||
AC_LIBOBJ([win32-uname])
|
||||
if test "$enable_networking" = yes ; then
|
||||
AC_LIBOBJ([win32-socket])
|
||||
fi
|
||||
if test "$enable_shared" = yes ; then
|
||||
EXTRA_DEFS="-DSCM_IMPORT"
|
||||
AC_DEFINE([USE_DLL_IMPORT], 1,
|
||||
|
@ -738,7 +736,6 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
|
|||
# gmtime_r - recent posix, not on old systems
|
||||
# pipe - not in mingw
|
||||
# _pipe - specific to mingw, taking 3 args
|
||||
# poll - since posix 2001
|
||||
# readdir_r - recent posix, not on old systems
|
||||
# readdir64_r - not available on HP-UX 11.11
|
||||
# stat64 - SuS largefile stuff, not on old systems
|
||||
|
@ -748,10 +745,21 @@ AC_CHECK_HEADERS([assert.h crt_externs.h])
|
|||
# _NSGetEnviron - Darwin specific
|
||||
# strcoll_l, newlocale - GNU extensions (glibc), also available on Darwin
|
||||
# fork - unavailable on Windows
|
||||
# utimensat: posix.1-2008
|
||||
# sched_getaffinity, sched_setaffinity: GNU extensions (glibc)
|
||||
# utimensat - posix.1-2008
|
||||
# sched_getaffinity, sched_setaffinity - GNU extensions (glibc)
|
||||
# sendfile - non-POSIX, found in glibc
|
||||
#
|
||||
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime ftruncate fchown fchmod 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])
|
||||
AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid \
|
||||
fesetround ftime ftruncate fchown fchmod getcwd geteuid getsid \
|
||||
gettimeofday gmtime_r ioctl lstat mkdir mknod nice pipe _pipe \
|
||||
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 sendfile])
|
||||
|
||||
AM_CONDITIONAL([HAVE_FORK], [test "x$ac_cv_func_fork" = "xyes"])
|
||||
|
||||
|
@ -920,6 +928,8 @@ AC_DEFUN([GUILE_FUNC_DECLARED], [
|
|||
GUILE_FUNC_DECLARED(sleep, unistd.h)
|
||||
GUILE_FUNC_DECLARED(usleep, unistd.h)
|
||||
|
||||
AC_CHECK_DECLS([getlogin, alarm])
|
||||
|
||||
AC_CHECK_DECLS([strptime],,,
|
||||
[#define _GNU_SOURCE /* ask glibc to give strptime prototype */
|
||||
#include <time.h>])
|
||||
|
@ -1229,7 +1239,13 @@ save_LIBS="$LIBS"
|
|||
LIBS="$BDW_GC_LIBS $LIBS"
|
||||
CFLAGS="$BDW_GC_CFLAGS $CFLAGS"
|
||||
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask GC_set_start_callback GC_get_suspend_signal GC_move_disappearing_link GC_get_heap_usage_safe GC_get_free_space_divisor GC_gcollect_and_unmap GC_get_unmapped_bytes GC_set_finalizer_notifier GC_set_finalize_on_demand])
|
||||
AC_CHECK_FUNCS([GC_do_blocking GC_call_with_gc_active GC_pthread_exit \
|
||||
GC_pthread_cancel GC_allow_register_threads GC_pthread_sigmask \
|
||||
GC_set_start_callback GC_get_suspend_signal GC_move_disappearing_link \
|
||||
GC_get_heap_usage_safe GC_get_free_space_divisor \
|
||||
GC_gcollect_and_unmap GC_get_unmapped_bytes GC_set_finalizer_notifier \
|
||||
GC_set_finalize_on_demand GC_set_all_interior_pointers GC_get_gc_no \
|
||||
GC_set_java_finalization])
|
||||
|
||||
# Though the `GC_do_blocking ()' symbol is present in GC 7.1, it is not
|
||||
# declared, and has a different type (returning void instead of
|
||||
|
@ -1632,7 +1648,6 @@ AC_CONFIG_FILES([
|
|||
|
||||
AC_CONFIG_FILES([meta/guile-2.2.pc])
|
||||
AC_CONFIG_FILES([meta/guile-2.2-uninstalled.pc])
|
||||
AC_CONFIG_FILES([doc/ref/effective-version.texi])
|
||||
|
||||
GUILE_CONFIG_SCRIPT([check-guile])
|
||||
GUILE_CONFIG_SCRIPT([benchmark-guile])
|
||||
|
|
|
@ -75,7 +75,7 @@ the FSF.<br />
|
|||
Please send broken links and other corrections or suggestions to
|
||||
<a href="mailto:%%EMAIL%%"><%%EMAIL%%></a>.</p>
|
||||
|
||||
<p>Copyright © 2012 Free Software Foundation, Inc.</p>
|
||||
<p>Copyright © 2013 Free Software Foundation, Inc.</p>
|
||||
|
||||
<p>Verbatim copying and distribution of this entire article are
|
||||
permitted worldwide, without royalty, in any medium, provided this
|
||||
|
|
|
@ -106,7 +106,6 @@
|
|||
@author C. H@sc{ANSON}
|
||||
@author K. M. P@sc{ITMAN}
|
||||
@author M. W@sc{AND}
|
||||
@author
|
||||
|
||||
|
||||
@c {\it Dedicated to the Memory of ALGOL 60}
|
||||
|
@ -116,7 +115,7 @@
|
|||
|
||||
|
||||
|
||||
@unnumbered Summary
|
||||
@majorheading Summary
|
||||
|
||||
|
||||
The report gives a defining description of the programming language
|
||||
|
|
|
@ -123,6 +123,13 @@ autoconf-macros.texi: $(top_srcdir)/meta/guile.m4
|
|||
snarf-guile-m4-docs $(top_srcdir)/meta/guile.m4 \
|
||||
> $(srcdir)/$@
|
||||
|
||||
# Build that file from here rather than at the user's site to avoid
|
||||
# triggering a rebuild of `guile.info'. Note that `GUILE-VERSION' is
|
||||
# among $(CONFIG_STATUS_DEPENDENCIES); thus, when it's updated, this
|
||||
# Makefile is rebuilt, and $(GUILE_EFFECTIVE_VERSION) is up-to-date.
|
||||
$(srcdir)/effective-version.texi: $(top_srcdir)/GUILE-VERSION
|
||||
echo "@set EFFECTIVE-VERSION $(GUILE_EFFECTIVE_VERSION)" > $@
|
||||
|
||||
MAINTAINERCLEANFILES = autoconf-macros.texi
|
||||
|
||||
www-commit: html
|
||||
|
|
|
@ -300,7 +300,7 @@ depending on the datatype of their arguments.
|
|||
@rnindex list?
|
||||
@deffn {Scheme Procedure} list? x
|
||||
@deffnx {C Function} scm_list_p (x)
|
||||
Return @code{#t} iff @var{x} is a proper list, else @code{#f}.
|
||||
Return @code{#t} if @var{x} is a proper list, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
The predicate @code{null?} is often used in list-processing code to
|
||||
|
@ -311,7 +311,7 @@ somehow deals with the elements of a list until the list satisfies
|
|||
@rnindex null?
|
||||
@deffn {Scheme Procedure} null? x
|
||||
@deffnx {C Function} scm_null_p (x)
|
||||
Return @code{#t} iff @var{x} is the empty list, else @code{#f}.
|
||||
Return @code{#t} if @var{x} is the empty list, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@deftypefn {C Function} int scm_is_null (SCM x)
|
||||
|
@ -2248,7 +2248,7 @@ Overview}). It can be used with:
|
|||
(use-modules (srfi srfi-9))
|
||||
@end example
|
||||
|
||||
@deffn {library syntax} define-record-type type @* (constructor fieldname @dots{}) @* predicate @* (fieldname accessor [modifier]) @dots{}
|
||||
@deffn {Scheme Syntax} define-record-type type @* (constructor fieldname @dots{}) @* predicate @* (fieldname accessor [modifier]) @dots{}
|
||||
@sp 1
|
||||
Create a new record type, and make various @code{define}s for using
|
||||
it. This syntax can only occur at the top-level, not nested within
|
||||
|
@ -2283,12 +2283,12 @@ field in a @var{record}.
|
|||
An example will illustrate typical usage,
|
||||
|
||||
@example
|
||||
(define-record-type employee-type
|
||||
(define-record-type <employee>
|
||||
(make-employee name age salary)
|
||||
employee?
|
||||
(name get-employee-name)
|
||||
(age get-employee-age set-employee-age)
|
||||
(salary get-employee-salary set-employee-salary))
|
||||
(name employee-name)
|
||||
(age employee-age set-employee-age!)
|
||||
(salary employee-salary set-employee-salary!))
|
||||
@end example
|
||||
|
||||
This creates a new employee data type, with name, age and salary
|
||||
|
@ -2298,13 +2298,13 @@ that it's established only when an employee object is created). These
|
|||
can all then be used as for example,
|
||||
|
||||
@example
|
||||
employee-type @result{} #<record-type employee-type>
|
||||
<employee> @result{} #<record-type <employee>>
|
||||
|
||||
(define fred (make-employee "Fred" 45 20000.00))
|
||||
|
||||
(employee? fred) @result{} #t
|
||||
(get-employee-age fred) @result{} 45
|
||||
(set-employee-salary fred 25000.00) ;; pay rise
|
||||
(employee-age fred) @result{} 45
|
||||
(set-employee-salary! fred 25000.00) ;; pay rise
|
||||
@end example
|
||||
|
||||
The functions created by @code{define-record-type} are ordinary
|
||||
|
@ -2334,10 +2334,10 @@ an output port.
|
|||
This example prints the employee's name in brackets, for instance @code{[Fred]}.
|
||||
|
||||
@example
|
||||
(set-record-type-printer! employee-type
|
||||
(set-record-type-printer! <employee>
|
||||
(lambda (record port)
|
||||
(write-char #\[ port)
|
||||
(display (get-employee-name record) port)
|
||||
(display (employee-name record) port)
|
||||
(write-char #\] port)))
|
||||
@end example
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010, 2011, 2012
|
||||
@c Free Software Foundation, Inc.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009, 2010,
|
||||
@c 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
@node Control Mechanisms
|
||||
|
@ -200,7 +200,7 @@ For this clause type, @var{test} may return multiple values, and
|
|||
@code{cond} ignores its boolean state; instead, @code{cond} evaluates
|
||||
@var{guard} and applies the resulting procedure to the value(s) of
|
||||
@var{test}, as if @var{guard} were the @var{consumer} argument of
|
||||
@code{call-with-values}. Iff the result of that procedure call is a
|
||||
@code{call-with-values}. If the result of that procedure call is a
|
||||
true value, it evaluates @var{expression} and applies the resulting
|
||||
procedure to the value(s) of @var{test}, in the same manner as the
|
||||
@var{guard} was called.
|
||||
|
@ -1735,8 +1735,8 @@ and the call to these routines doesn't change @code{errno}.
|
|||
@deftypefnx {C Function} void scm_wrong_type_arg (char *@var{subr}, int @var{argnum}, SCM @var{bad_value})
|
||||
@deftypefnx {C Function} void scm_wrong_type_arg_msg (char *@var{subr}, int @var{argnum}, SCM @var{bad_value}, const char *@var{expected})
|
||||
@deftypefnx {C Function} void scm_memory_error (char *@var{subr})
|
||||
Throw an error with the various keys described above.
|
||||
@deftypefnx {C Function} void scm_misc_error (const char *@var{subr}, const char *@var{message}, SCM @var{args})
|
||||
Throw an error with the various keys described above.
|
||||
|
||||
In @code{scm_wrong_num_args}, @var{proc} should be a Scheme symbol
|
||||
which is the name of the procedure incorrectly invoked. The other
|
||||
|
|
|
@ -1686,19 +1686,15 @@ starts from 0 for the least significant bit.
|
|||
@end lisp
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} ash n cnt
|
||||
@deffnx {C Function} scm_ash (n, cnt)
|
||||
Return @var{n} shifted left by @var{cnt} bits, or shifted right if
|
||||
@var{cnt} is negative. This is an ``arithmetic'' shift.
|
||||
@deffn {Scheme Procedure} ash n count
|
||||
@deffnx {C Function} scm_ash (n, count)
|
||||
Return @math{floor(n * 2^count)}.
|
||||
@var{n} and @var{count} must be exact integers.
|
||||
|
||||
This is effectively a multiplication by @m{2^{cnt}, 2^@var{cnt}}, and
|
||||
when @var{cnt} is negative it's a division, rounded towards negative
|
||||
infinity. (Note that this is not the same rounding as @code{quotient}
|
||||
does.)
|
||||
|
||||
With @var{n} viewed as an infinite precision twos complement,
|
||||
@code{ash} means a left shift introducing zero bits, or a right shift
|
||||
dropping bits.
|
||||
With @var{n} viewed as an infinite-precision twos-complement
|
||||
integer, @code{ash} means a left shift introducing zero bits
|
||||
when @var{count} is positive, or a right shift dropping bits
|
||||
when @var{count} is negative. This is an ``arithmetic'' shift.
|
||||
|
||||
@lisp
|
||||
(number->string (ash #b1 3) 2) @result{} "1000"
|
||||
|
@ -1709,6 +1705,28 @@ dropping bits.
|
|||
@end lisp
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} round-ash n count
|
||||
@deffnx {C Function} scm_round_ash (n, count)
|
||||
Return @math{round(n * 2^count)}.
|
||||
@var{n} and @var{count} must be exact integers.
|
||||
|
||||
With @var{n} viewed as an infinite-precision twos-complement
|
||||
integer, @code{round-ash} means a left shift introducing zero
|
||||
bits when @var{count} is positive, or a right shift rounding
|
||||
to the nearest integer (with ties going to the nearest even
|
||||
integer) when @var{count} is negative. This is a rounded
|
||||
``arithmetic'' shift.
|
||||
|
||||
@lisp
|
||||
(number->string (round-ash #b1 3) 2) @result{} \"1000\"
|
||||
(number->string (round-ash #b1010 -1) 2) @result{} \"101\"
|
||||
(number->string (round-ash #b1010 -2) 2) @result{} \"10\"
|
||||
(number->string (round-ash #b1011 -2) 2) @result{} \"11\"
|
||||
(number->string (round-ash #b1101 -2) 2) @result{} \"11\"
|
||||
(number->string (round-ash #b1110 -2) 2) @result{} \"100\"
|
||||
@end lisp
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} logcount n
|
||||
@deffnx {C Function} scm_logcount (n)
|
||||
Return the number of bits in integer @var{n}. If @var{n} is
|
||||
|
@ -2049,7 +2067,7 @@ number of one to eight digits.
|
|||
@rnindex char?
|
||||
@deffn {Scheme Procedure} char? x
|
||||
@deffnx {C Function} scm_char_p (x)
|
||||
Return @code{#t} iff @var{x} is a character, else @code{#f}.
|
||||
Return @code{#t} if @var{x} is a character, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
Fundamentally, the character comparison operations below are
|
||||
|
@ -2057,31 +2075,31 @@ numeric comparisons of the character's code points.
|
|||
|
||||
@rnindex char=?
|
||||
@deffn {Scheme Procedure} char=? x y
|
||||
Return @code{#t} iff code point of @var{x} is equal to the code point
|
||||
Return @code{#t} if code point of @var{x} is equal to the code point
|
||||
of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char<?
|
||||
@deffn {Scheme Procedure} char<? x y
|
||||
Return @code{#t} iff the code point of @var{x} is less than the code
|
||||
Return @code{#t} if the code point of @var{x} is less than the code
|
||||
point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char<=?
|
||||
@deffn {Scheme Procedure} char<=? x y
|
||||
Return @code{#t} iff the code point of @var{x} is less than or equal
|
||||
Return @code{#t} if the code point of @var{x} is less than or equal
|
||||
to the code point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char>?
|
||||
@deffn {Scheme Procedure} char>? x y
|
||||
Return @code{#t} iff the code point of @var{x} is greater than the
|
||||
Return @code{#t} if the code point of @var{x} is greater than the
|
||||
code point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char>=?
|
||||
@deffn {Scheme Procedure} char>=? x y
|
||||
Return @code{#t} iff the code point of @var{x} is greater than or
|
||||
Return @code{#t} if the code point of @var{x} is greater than or
|
||||
equal to the code point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -2099,32 +2117,32 @@ it cannot cover all cases for all languages.
|
|||
|
||||
@rnindex char-ci=?
|
||||
@deffn {Scheme Procedure} char-ci=? x y
|
||||
Return @code{#t} iff the case-folded code point of @var{x} is the same
|
||||
Return @code{#t} if the case-folded code point of @var{x} is the same
|
||||
as the case-folded code point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-ci<?
|
||||
@deffn {Scheme Procedure} char-ci<? x y
|
||||
Return @code{#t} iff the case-folded code point of @var{x} is less
|
||||
Return @code{#t} if the case-folded code point of @var{x} is less
|
||||
than the case-folded code point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-ci<=?
|
||||
@deffn {Scheme Procedure} char-ci<=? x y
|
||||
Return @code{#t} iff the case-folded code point of @var{x} is less
|
||||
Return @code{#t} if the case-folded code point of @var{x} is less
|
||||
than or equal to the case-folded code point of @var{y}, else
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-ci>?
|
||||
@deffn {Scheme Procedure} char-ci>? x y
|
||||
Return @code{#t} iff the case-folded code point of @var{x} is greater
|
||||
Return @code{#t} if the case-folded code point of @var{x} is greater
|
||||
than the case-folded code point of @var{y}, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-ci>=?
|
||||
@deffn {Scheme Procedure} char-ci>=? x y
|
||||
Return @code{#t} iff the case-folded code point of @var{x} is greater
|
||||
Return @code{#t} if the case-folded code point of @var{x} is greater
|
||||
than or equal to the case-folded code point of @var{y}, else
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
@ -2132,36 +2150,36 @@ than or equal to the case-folded code point of @var{y}, else
|
|||
@rnindex char-alphabetic?
|
||||
@deffn {Scheme Procedure} char-alphabetic? chr
|
||||
@deffnx {C Function} scm_char_alphabetic_p (chr)
|
||||
Return @code{#t} iff @var{chr} is alphabetic, else @code{#f}.
|
||||
Return @code{#t} if @var{chr} is alphabetic, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-numeric?
|
||||
@deffn {Scheme Procedure} char-numeric? chr
|
||||
@deffnx {C Function} scm_char_numeric_p (chr)
|
||||
Return @code{#t} iff @var{chr} is numeric, else @code{#f}.
|
||||
Return @code{#t} if @var{chr} is numeric, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-whitespace?
|
||||
@deffn {Scheme Procedure} char-whitespace? chr
|
||||
@deffnx {C Function} scm_char_whitespace_p (chr)
|
||||
Return @code{#t} iff @var{chr} is whitespace, else @code{#f}.
|
||||
Return @code{#t} if @var{chr} is whitespace, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-upper-case?
|
||||
@deffn {Scheme Procedure} char-upper-case? chr
|
||||
@deffnx {C Function} scm_char_upper_case_p (chr)
|
||||
Return @code{#t} iff @var{chr} is uppercase, else @code{#f}.
|
||||
Return @code{#t} if @var{chr} is uppercase, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@rnindex char-lower-case?
|
||||
@deffn {Scheme Procedure} char-lower-case? chr
|
||||
@deffnx {C Function} scm_char_lower_case_p (chr)
|
||||
Return @code{#t} iff @var{chr} is lowercase, else @code{#f}.
|
||||
Return @code{#t} if @var{chr} is lowercase, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} char-is-both? chr
|
||||
@deffnx {C Function} scm_char_is_both_p (chr)
|
||||
Return @code{#t} iff @var{chr} is either uppercase or lowercase, else
|
||||
Return @code{#t} if @var{chr} is either uppercase or lowercase, else
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -2583,8 +2601,8 @@ string is not defined.
|
|||
|
||||
@deffn {Scheme Procedure} char-set-contains? cs ch
|
||||
@deffnx {C Function} scm_char_set_contains_p (cs, ch)
|
||||
Return @code{#t} iff the character @var{ch} is contained in the
|
||||
character set @var{cs}.
|
||||
Return @code{#t} if the character @var{ch} is contained in the
|
||||
character set @var{cs}, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} char-set-every pred cs
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2010, 2011, 2012
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2010, 2011, 2012, 2013
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -1175,7 +1175,9 @@ calls to @var{proc}.
|
|||
In addition, Guile defines a procedure to call a thunk, tracing all
|
||||
procedure calls and returns within the thunk.
|
||||
|
||||
@deffn {Scheme Procedure} call-with-trace thunk #:key (calls? #t) (instructions? #f) (width 80) (vm (the-vm))
|
||||
@deffn {Scheme Procedure} call-with-trace thunk [#:calls?=#t] @
|
||||
[#:instructions?=#f] @
|
||||
[#:width=80] [#:vm=(the-vm)]
|
||||
Call @var{thunk}, tracing all execution within its dynamic extent.
|
||||
|
||||
If @var{calls?} is true, Guile will print a brief report at each
|
||||
|
|
|
@ -488,7 +488,10 @@ procedure in the default environment, but you really want the one from
|
|||
(use-modules (ice-9 eval-string))
|
||||
@end example
|
||||
|
||||
@deffn {Scheme Procedure} eval-string string [module=#f] [file=#f] [line=#f] [column=#f] [lang=(current-language)] [compile?=#f]
|
||||
@deffn {Scheme Procedure} eval-string string [#:module=#f] [#:file=#f] @
|
||||
[#:line=#f] [#:column=#f] @
|
||||
[#:lang=(current-language)] @
|
||||
[#:compile?=#f]
|
||||
Parse @var{string} according to the current language, normally Scheme.
|
||||
Evaluate or compile the expressions it contains, in order, returning the
|
||||
last expression.
|
||||
|
@ -691,7 +694,9 @@ coding declaration as recognized by @code{file-encoding}
|
|||
The compiler can also be invoked directly by Scheme code using the procedures
|
||||
below:
|
||||
|
||||
@deffn {Scheme Procedure} compile exp [env=#f] [from=(current-language)] [to=value] [opts=()]
|
||||
@deffn {Scheme Procedure} compile exp [#:env=#f] @
|
||||
[#:from=(current-language)] @
|
||||
[#:to=value] [#:opts=()]
|
||||
Compile the expression @var{exp} in the environment @var{env}. If
|
||||
@var{exp} is a procedure, the result will be a compiled procedure;
|
||||
otherwise @code{compile} is mostly equivalent to @code{eval}.
|
||||
|
@ -700,10 +705,11 @@ For a discussion of languages and compiler options, @xref{Compiling to
|
|||
the Virtual Machine}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} compile-file file [output-file=#f] @
|
||||
[from=(current-language)] [to='objcode] @
|
||||
[env=(default-environment from)] [opts='()] @
|
||||
[canonicalization 'relative]
|
||||
@deffn {Scheme Procedure} compile-file file [#:output-file=#f] @
|
||||
[#:from=(current-language)] [#:to='objcode] @
|
||||
[#:env=(default-environment from)] @
|
||||
[#:opts='()] @
|
||||
[#:canonicalization='relative]
|
||||
Compile the file named @var{file}.
|
||||
|
||||
Output will be written to a @var{output-file}. If you do not supply an
|
||||
|
@ -1061,7 +1067,8 @@ was found, or @code{#f} otherwise. The port is rewound.
|
|||
@cindex promises
|
||||
|
||||
Promises are a convenient way to defer a calculation until its result
|
||||
is actually needed, and to run such a calculation only once.
|
||||
is actually needed, and to run such a calculation only once. Also
|
||||
@pxref{SRFI-45}.
|
||||
|
||||
@deffn syntax delay expr
|
||||
@rnindex delay
|
||||
|
|
|
@ -215,7 +215,7 @@ including ellipsizing and tail patterns.
|
|||
((_ #((var val) ...) exp exp* ...)
|
||||
(let ((var val) ...) exp exp* ...))))
|
||||
(letv #((foo 'bar)) foo)
|
||||
@result{} foo
|
||||
@result{} bar
|
||||
@end example
|
||||
|
||||
Literals are used to match specific datums in an expression, like the use of
|
||||
|
@ -520,7 +520,8 @@ is impossible with @code{syntax-rules}, given the datum matching forms. But with
|
|||
@code{syntax-case} it is easy:
|
||||
|
||||
@deffn {Scheme Procedure} identifier? syntax-object
|
||||
Returns @code{#t} iff @var{syntax-object} is an identifier.
|
||||
Returns @code{#t} if @var{syntax-object} is an identifier, or @code{#f}
|
||||
otherwise.
|
||||
@end deffn
|
||||
|
||||
@example
|
||||
|
@ -690,13 +691,13 @@ macros can use to compare, generate, and query objects of this data
|
|||
type.
|
||||
|
||||
@deffn {Scheme Procedure} bound-identifier=? a b
|
||||
Return @code{#t} iff the syntax objects @var{a} and @var{b} refer to the
|
||||
same lexically-bound identifier.
|
||||
Return @code{#t} if the syntax objects @var{a} and @var{b} refer to the
|
||||
same lexically-bound identifier, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} free-identifier=? a b
|
||||
Return @code{#t} iff the syntax objects @var{a} and @var{b} refer to the
|
||||
same free identifier.
|
||||
Return @code{#t} if the syntax objects @var{a} and @var{b} refer to the
|
||||
same free identifier, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} generate-temporaries ls
|
||||
|
@ -941,7 +942,7 @@ left-hand side of a @code{set!} expression, as in the following:
|
|||
(set! foo @var{val})
|
||||
;; expands via
|
||||
(foo-transformer #'(set! foo @var{val}))
|
||||
;; iff foo-transformer is a "variable transformer"
|
||||
;; if foo-transformer is a "variable transformer"
|
||||
@end example
|
||||
|
||||
As the example notes, the transformer procedure must be explicitly
|
||||
|
@ -1131,7 +1132,8 @@ for syntax-case.
|
|||
|
||||
@deffn {Scheme Procedure} macro? obj
|
||||
@deffnx {C Function} scm_macro_p (obj)
|
||||
Return @code{#t} iff @var{obj} is a syntax transformer.
|
||||
Return @code{#t} if @var{obj} is a syntax transformer, or @code{#f}
|
||||
otherwise.
|
||||
|
||||
Note that it's a bit difficult to actually get a macro as a first-class object;
|
||||
simply naming it (like @code{case}) will produce a syntax error. But it is
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011, 2012
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -759,8 +759,8 @@ Return a variable initialized to value @var{init}.
|
|||
|
||||
@deffn {Scheme Procedure} variable-bound? var
|
||||
@deffnx {C Function} scm_variable_bound_p (var)
|
||||
Return @code{#t} iff @var{var} is bound to a value.
|
||||
Throws an error if @var{var} is not a variable object.
|
||||
Return @code{#t} if @var{var} is bound to a value, or @code{#f}
|
||||
otherwise. Throws an error if @var{var} is not a variable object.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} variable-ref var
|
||||
|
@ -784,8 +784,8 @@ Unset the value of the variable @var{var}, leaving @var{var} unbound.
|
|||
|
||||
@deffn {Scheme Procedure} variable? obj
|
||||
@deffnx {C Function} scm_variable_p (obj)
|
||||
Return @code{#t} iff @var{obj} is a variable object, else
|
||||
return @code{#f}.
|
||||
Return @code{#t} if @var{obj} is a variable object, else return
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
||||
|
@ -827,7 +827,8 @@ the time @var{thunk}'s dynamic extent was last entered) is restored. If
|
|||
saved, and the previously saved inner module is set current again.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} resolve-module name [autoload=#t] [version=#f] [#:ensure=#t]
|
||||
@deffn {Scheme Procedure} resolve-module name [autoload=#t] [version=#f] @
|
||||
[#:ensure=#t]
|
||||
@deffnx {C Function} scm_resolve_module (name)
|
||||
Find the module named @var{name} and return it. When it has not already
|
||||
been defined and @var{autoload} is true, try to auto-load it. When it
|
||||
|
@ -837,7 +838,9 @@ that the resulting module is compatible with the given version reference
|
|||
(@pxref{R6RS Version References}). The name is a list of symbols.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} resolve-interface name [#:select=#f] [#:hide='()] [#:select=()] [#:prefix=#f] [#:renamer] [#:version=#f]
|
||||
@deffn {Scheme Procedure} resolve-interface name [#:select=#f] @
|
||||
[#:hide='()] [#:prefix=#f] @
|
||||
[#:renamer=#f] [#:version=#f]
|
||||
Find the module named @var{name} as with @code{resolve-module} and
|
||||
return its interface. The interface of a module is also a module
|
||||
object, but it contains only the exported bindings.
|
||||
|
@ -942,14 +945,18 @@ the @var{name} is not bound in the module, signals an error. Returns a
|
|||
variable, always.
|
||||
|
||||
@example
|
||||
static SCM eval_string_var;
|
||||
|
||||
/* NOTE: It is important that the call to 'my_init'
|
||||
happens-before all calls to 'my_eval_string'. */
|
||||
void my_init (void)
|
||||
@{
|
||||
eval_string_var = scm_c_public_lookup ("ice-9 eval-string",
|
||||
"eval-string");
|
||||
@}
|
||||
|
||||
SCM my_eval_string (SCM str)
|
||||
@{
|
||||
static SCM eval_string_var = SCM_BOOL_F;
|
||||
|
||||
if (scm_is_false (eval_string_var))
|
||||
eval_string_var =
|
||||
scm_c_public_lookup ("ice-9 eval-string", "eval-string");
|
||||
|
||||
return scm_call_1 (scm_variable_ref (eval_string_var), str);
|
||||
@}
|
||||
@end example
|
||||
|
|
|
@ -96,6 +96,13 @@ your site should be installed. On Unix-like systems, this is usually
|
|||
@file{/usr/local/share/guile/site} or @file{/usr/share/guile/site}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} %site-ccache-dir
|
||||
@deffnx {C Function} scm_sys_site_ccache_dir ()
|
||||
Return the directory where users should install compiled @code{.go}
|
||||
files for use with this version of Guile. Might look something like
|
||||
@file{/usr/lib/guile/@value{EFFECTIVE-VERSION}/site-ccache}.
|
||||
@end deffn
|
||||
|
||||
@defvar %guile-build-info
|
||||
Alist of information collected during the building of a particular
|
||||
Guile. Entries can be grouped into one of several categories:
|
||||
|
|
|
@ -157,7 +157,8 @@ appropriate module first, though:
|
|||
|
||||
@deffn {Scheme Procedure} program? obj
|
||||
@deffnx {C Function} scm_program_p (obj)
|
||||
Returns @code{#t} iff @var{obj} is a compiled procedure.
|
||||
Returns @code{#t} if @var{obj} is a compiled procedure, or @code{#f}
|
||||
otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} program-objcode program
|
||||
|
@ -333,7 +334,11 @@ cheaply, without allocating a rest list.
|
|||
@code{lambda*} is like @code{lambda}, except with some extensions to
|
||||
allow optional and keyword arguments.
|
||||
|
||||
@deffn {library syntax} lambda* ([var@dots{}] @* [#:optional vardef@dots{}] @* [#:key vardef@dots{} [#:allow-other-keys]] @* [#:rest var | . var]) @* body
|
||||
@deffn {library syntax} lambda* ([var@dots{}] @* @
|
||||
[#:optional vardef@dots{}] @* @
|
||||
[#:key vardef@dots{} [#:allow-other-keys]] @* @
|
||||
[#:rest var | . var]) @* @
|
||||
body1 body2 @dots{}
|
||||
@sp 1
|
||||
Create a procedure which takes optional and/or keyword arguments
|
||||
specified with @code{#:optional} and @code{#:key}. For example,
|
||||
|
@ -712,6 +717,11 @@ compatible arity.
|
|||
Return X.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} and=> value proc
|
||||
When @var{value} is @code{#f}, return @code{#f}. Otherwise, return
|
||||
@code{(@var{proc} @var{value})}.
|
||||
@end deffn
|
||||
|
||||
@node Procedure Properties
|
||||
@subsection Procedure Properties and Meta-information
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ Once @var{body} or @var{handler} returns, the return value is made the
|
|||
|
||||
@deffn {Scheme Procedure} thread? obj
|
||||
@deffnx {C Function} scm_thread_p (obj)
|
||||
Return @code{#t} iff @var{obj} is a thread; otherwise, return
|
||||
Return @code{#t} ff @var{obj} is a thread; otherwise, return
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -267,7 +267,7 @@ specified; @code{#f} is returned otherwise).
|
|||
|
||||
@deffn {Scheme Procedure} thread-exited? thread
|
||||
@deffnx {C Function} scm_thread_exited_p (thread)
|
||||
Return @code{#t} iff @var{thread} has exited.
|
||||
Return @code{#t} if @var{thread} has exited, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@c begin (texi-doc-string "guile" "yield")
|
||||
|
@ -376,7 +376,7 @@ The returned mutex will be recursive.
|
|||
|
||||
@deffn {Scheme Procedure} mutex? obj
|
||||
@deffnx {C Function} scm_mutex_p (obj)
|
||||
Return @code{#t} iff @var{obj} is a mutex; otherwise, return
|
||||
Return @code{#t} if @var{obj} is a mutex; otherwise, return
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -481,7 +481,7 @@ Return a new condition variable.
|
|||
|
||||
@deffn {Scheme Procedure} condition-variable? obj
|
||||
@deffnx {C Function} scm_condition_variable_p (obj)
|
||||
Return @code{#t} iff @var{obj} is a condition variable; otherwise,
|
||||
Return @code{#t} if @var{obj} is a condition variable; otherwise,
|
||||
return @code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -702,7 +702,7 @@ implicitly bound to some definite value).
|
|||
|
||||
@deffn {Scheme Procedure} fluid? obj
|
||||
@deffnx {C Function} scm_fluid_p (obj)
|
||||
Return @code{#t} iff @var{obj} is a fluid; otherwise, return
|
||||
Return @code{#t} if @var{obj} is a fluid; otherwise, return
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -726,7 +726,7 @@ Disassociate the given fluid from any value, making it unbound.
|
|||
|
||||
@deffn {Scheme Procedure} fluid-bound? fluid
|
||||
@deffnx {C Function} scm_fluid_bound_p (fluid)
|
||||
Returns @code{#t} iff the given fluid is bound to a value, otherwise
|
||||
Returns @code{#t} if the given fluid is bound to a value, otherwise
|
||||
@code{#f}.
|
||||
@end deffn
|
||||
|
||||
|
@ -1037,6 +1037,13 @@ future has completed. This suspend/resume is achieved by capturing the
|
|||
calling future's continuation, and later reinstating it (@pxref{Prompts,
|
||||
delimited continuations}).
|
||||
|
||||
Note that @code{par-map} above is not tail-recursive. This could lead
|
||||
to stack overflows when @var{lst} is large compared to
|
||||
@code{(current-processor-count)}. To address that, @code{touch} uses
|
||||
the suspend mechanism described above to limit the number of nested
|
||||
futures executing on the same stack. Thus, the above code should never
|
||||
run into stack overflows.
|
||||
|
||||
@deffn {Scheme Syntax} future exp
|
||||
Return a future for expression @var{exp}. This is equivalent to:
|
||||
|
||||
|
|
|
@ -124,9 +124,9 @@ Else, signal an error.
|
|||
@end deftypefn
|
||||
|
||||
@deftypefn {C Macro} int SCM_SMOB_PREDICATE (scm_t_bits tag, SCM exp)
|
||||
Return true iff @var{exp} is a smob instance of the type indicated by
|
||||
@var{tag}. The expression @var{exp} can be evaluated more than once,
|
||||
so it shouldn't contain any side effects.
|
||||
Return true if @var{exp} is a smob instance of the type indicated by
|
||||
@var{tag}, or false otherwise. The expression @var{exp} can be
|
||||
evaluated more than once, so it shouldn't contain any side effects.
|
||||
@end deftypefn
|
||||
|
||||
@deftypefn {C Function} SCM scm_new_smob (scm_t_bits tag, void *data)
|
||||
|
|
|
@ -188,8 +188,8 @@ would modify regular hash tables. (@pxref{Hash Tables})
|
|||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} include-deprecated-features
|
||||
Return @code{#t} iff deprecated features should be included
|
||||
in public interfaces.
|
||||
Return @code{#t} if deprecated features should be included in public
|
||||
interfaces, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} issue-deprecation-warning . msgs
|
||||
|
@ -202,7 +202,7 @@ they are printed in turn, each one followed by a newline.
|
|||
|
||||
@deffn {Scheme Procedure} valid-object-procedure? proc
|
||||
@deffnx {C Function} scm_valid_object_procedure_p (proc)
|
||||
Return @code{#t} iff @var{proc} is a procedure that can be used with @code{set-object-procedure}. It is always valid to use a closure constructed by @code{lambda}.
|
||||
Return @code{#t} ff @var{proc} is a procedure that can be used with @code{set-object-procedure}. It is always valid to use a closure constructed by @code{lambda}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} %get-pre-modules-obarray
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2011, 2012
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2011, 2012, 2013
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -308,10 +308,10 @@ input.
|
|||
|
||||
@deffn {Scheme Procedure} sorted? items less
|
||||
@deffnx {C Function} scm_sorted_p (items, less)
|
||||
Return @code{#t} iff @var{items} is a list or vector such that,
|
||||
Return @code{#t} if @var{items} is a list or vector such that,
|
||||
for each element @var{x} and the next element @var{y} of
|
||||
@var{items}, @code{(@var{less} @var{y} @var{x})} returns
|
||||
@code{#f}.
|
||||
@code{#f}. Otherwise return @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} sort items less
|
||||
|
|
|
@ -53,10 +53,11 @@ Languages are registered in the module, @code{(system base language)}:
|
|||
They are registered with the @code{define-language} form.
|
||||
|
||||
@deffn {Scheme Syntax} define-language @
|
||||
name title reader printer @
|
||||
[parser=#f] [compilers='()] [decompilers='()] [evaluator=#f] @
|
||||
[joiner=#f] [for-humans?=#t] @
|
||||
[make-default-environment=make-fresh-user-module]
|
||||
[#:name] [#:title] [#:reader] [#:printer] @
|
||||
[#:parser=#f] [#:compilers='()] @
|
||||
[#:decompilers='()] [#:evaluator=#f] @
|
||||
[#:joiner=#f] [#:for-humans?=#t] @
|
||||
[#:make-default-environment=make-fresh-user-module]
|
||||
Define a language.
|
||||
|
||||
This syntax defines a @code{#<language>} object, bound to @var{name}
|
||||
|
@ -590,9 +591,9 @@ variables. @var{vars} is a list of @code{(@var{name} @var{type}
|
|||
program's metadata and do not form part of a program's code path.
|
||||
@end deftp
|
||||
@deftp {Scheme Variable} <glil-mv-bind> vars rest
|
||||
A multiple-value binding of the values on the stack to @var{vars}. Iff
|
||||
@var{rest} is true, the last element of @var{vars} will be treated as
|
||||
a rest argument.
|
||||
A multiple-value binding of the values on the stack to @var{vars}. If
|
||||
@var{rest} is true, the last element of @var{vars} will be treated as a
|
||||
rest argument.
|
||||
|
||||
In addition to pushing a binding annotation on the stack, like
|
||||
@code{<glil-bind>}, an expression is emitted at compilation time to
|
||||
|
@ -799,7 +800,7 @@ objcode)} module.
|
|||
|
||||
@deffn {Scheme Procedure} objcode? obj
|
||||
@deffnx {C Function} scm_objcode_p (obj)
|
||||
Returns @code{#f} iff @var{obj} is object code, @code{#f} otherwise.
|
||||
Returns @code{#f} if @var{obj} is object code, @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} bytecode->objcode bytecode [endianness]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2010, 2011
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2010, 2011, 2013
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -291,6 +291,32 @@ This variable names the file that holds the Guile REPL command history.
|
|||
You can specify a different history file by setting this environment
|
||||
variable. By default, the history file is @file{$HOME/.guile_history}.
|
||||
|
||||
@item GUILE_INSTALL_LOCALE
|
||||
@vindex GUILE_INSTALL_LOCALE
|
||||
This is a flag that can be used to tell Guile whether or not to install
|
||||
the current locale at startup, via a call to @code{(setlocale LC_ALL
|
||||
"")}. @xref{Locales}, for more information on locales.
|
||||
|
||||
You may explicitly indicate that you do not want to install
|
||||
the locale by setting @env{GUILE_INSTALL_LOCALE} to @code{0}, or
|
||||
explicitly enable it by setting the variable to @code{1}.
|
||||
|
||||
Usually, installing the current locale is the right thing to do. It
|
||||
allows Guile to correctly parse and print strings with non-ASCII
|
||||
characters. Therefore, this option is on by default.
|
||||
|
||||
@item GUILE_STACK_SIZE
|
||||
@vindex GUILE_STACK_SIZE
|
||||
Guile currently has a limited stack size for Scheme computations.
|
||||
Attempting to call too many nested functions will signal an error. This
|
||||
is good to detect infinite recursion, but sometimes the limit is reached
|
||||
for normal computations. This environment variable, if set to a
|
||||
positive integer, specifies the number of Scheme value slots to allocate
|
||||
for the stack.
|
||||
|
||||
In the future we will implement stacks that can grow and shrink, but for
|
||||
now this hack will have to do.
|
||||
|
||||
@item GUILE_LOAD_COMPILED_PATH
|
||||
@vindex GUILE_LOAD_COMPILED_PATH
|
||||
This variable may be used to augment the path that is searched for
|
||||
|
|
|
@ -374,7 +374,7 @@ available through both Scheme and C interfaces.
|
|||
* Curried Definitions:: Extended @code{define} syntax.
|
||||
* Statprof:: An easy-to-use statistical profiler.
|
||||
* SXML:: Parsing, transforming, and serializing XML.
|
||||
* Texinfo:: Munging documents written in Texinfo.
|
||||
* Texinfo Processing:: Munging documents written in Texinfo.
|
||||
@end menu
|
||||
|
||||
@include slib.texi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2010, 2011
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2010, 2011, 2013
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -288,21 +288,6 @@ classes, multiple inheritance and generic functions.
|
|||
@node Typographical Conventions
|
||||
@section Typographical Conventions
|
||||
|
||||
We use some conventions in this manual.
|
||||
|
||||
@itemize @bullet
|
||||
|
||||
@item
|
||||
For some procedures, notably type predicates, we use ``iff'' to mean
|
||||
``if and only if''. The construct is usually something like: `Return
|
||||
@var{val} iff @var{condition}', where @var{val} is usually
|
||||
``@nicode{#t}'' or ``non-@nicode{#f}''. This typically means that
|
||||
@var{val} is returned if @var{condition} holds, and that @samp{#f} is
|
||||
returned otherwise. To clarify: @var{val} will @strong{only} be
|
||||
returned when @var{condition} is true.
|
||||
@cindex iff
|
||||
|
||||
@item
|
||||
In examples and procedure descriptions and all other places where the
|
||||
evaluation of Scheme expression is shown, we use some notation for
|
||||
denoting the output and evaluation results of expressions.
|
||||
|
@ -328,10 +313,6 @@ As you can see, this code prints @samp{1} (denoted by
|
|||
@samp{@print{}}), and returns @code{hooray} (denoted by
|
||||
@samp{@result{}}).
|
||||
|
||||
@c Add other conventions here.
|
||||
|
||||
@end itemize
|
||||
|
||||
|
||||
@c Local Variables:
|
||||
@c TeX-master: "guile.texi"
|
||||
|
|
|
@ -1573,6 +1573,9 @@ modifies the queue @var{list} then it must either maintain
|
|||
@section Streams
|
||||
@cindex streams
|
||||
|
||||
This section documents Guile's legacy stream module. For a more
|
||||
complete and portable stream library, @pxref{SRFI-41}.
|
||||
|
||||
A stream represents a sequence of values, each of which is calculated
|
||||
only when required. This allows large or even infinite sequences to
|
||||
be represented and manipulated with familiar operations like ``car'',
|
||||
|
|
|
@ -803,6 +803,29 @@ Copy the file specified by @var{oldfile} to @var{newfile}.
|
|||
The return value is unspecified.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} sendfile out in count [offset]
|
||||
@deffnx {C Function} scm_sendfile (out, in, count, offset)
|
||||
Send @var{count} bytes from @var{in} to @var{out}, both of which
|
||||
are either open file ports or file descriptors. When
|
||||
@var{offset} is omitted, start reading from @var{in}'s current
|
||||
position; otherwise, start reading at @var{offset}.
|
||||
|
||||
When @var{in} is a port, it is often preferable to specify @var{offset},
|
||||
because @var{in}'s offset as a port may be different from the offset of
|
||||
its underlying file descriptor.
|
||||
|
||||
On systems that support it, such as GNU/Linux, this procedure uses the
|
||||
@code{sendfile} libc function, which usually corresponds to a system
|
||||
call. This is faster than doing a series of @code{read} and
|
||||
@code{write} system calls. A typical application is to send a file over
|
||||
a socket.
|
||||
|
||||
In some cases, the @code{sendfile} libc function may return
|
||||
@code{EINVAL} or @code{ENOSYS}. In that case, Guile's @code{sendfile}
|
||||
procedure automatically falls back to doing a series of @code{read} and
|
||||
@code{write} calls.
|
||||
@end deffn
|
||||
|
||||
@findex rename
|
||||
@deffn {Scheme Procedure} rename-file oldname newname
|
||||
@deffnx {C Function} scm_rename (oldname, newname)
|
||||
|
@ -1718,6 +1741,18 @@ interpretation is not required.
|
|||
Example: (system* "echo" "foo" "bar")
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} quit [status]
|
||||
@deffnx {Scheme Procedure} exit [status]
|
||||
Terminate the current process with proper unwinding of the Scheme stack.
|
||||
The exit status zero if @var{status} is not supplied. If @var{status}
|
||||
is supplied, and it is an integer, that integer is used as the exit
|
||||
status. If @var{status} is @code{#t} or @code{#f}, the exit status is 0
|
||||
or 1, respectively.
|
||||
|
||||
The procedure @code{exit} is an alias of @code{quit}. They have the
|
||||
same functionality.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} primitive-exit [status]
|
||||
@deffnx {Scheme Procedure} primitive-_exit [status]
|
||||
@deffnx {C Function} scm_primitive_exit (status)
|
||||
|
@ -2528,8 +2563,11 @@ code should be prepared to handle it when it is defined.
|
|||
@var{hint_socktype} was not recognized.
|
||||
|
||||
@item EAI_SYSTEM
|
||||
A system error occurred; the error code can be found in
|
||||
@code{errno}.
|
||||
A system error occurred. In C, the error code can be found in
|
||||
@code{errno}; this value is not accessible from Scheme, but in
|
||||
practice it provides little information about the actual error
|
||||
cause.
|
||||
@c See <http://bugs.gnu.org/13958>.
|
||||
@end table
|
||||
|
||||
Users are encouraged to read the
|
||||
|
@ -3052,6 +3090,7 @@ Manual}, or @command{man 7 socket}.
|
|||
@defvarx SO_OOBINLINE
|
||||
@defvarx SO_NO_CHECK
|
||||
@defvarx SO_PRIORITY
|
||||
@defvarx SO_REUSEPORT
|
||||
The @var{value} taken or returned is an integer.
|
||||
@end defvar
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 2010, 2011, 2012
|
||||
@c Copyright (C) 2010, 2011, 2012, 2013
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -273,10 +273,8 @@ grouped below by the existing manual sections to which they correspond.
|
|||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} define-syntax keyword expression
|
||||
@deffnx {Scheme Syntax} let-syntax ((keyword transformer) @dots{})
|
||||
exp1 exp2 @dots{}
|
||||
@deffnx {Scheme Syntax} letrec-syntax ((keyword transformer) @dots{})
|
||||
exp1 exp2 @dots{}
|
||||
@deffnx {Scheme Syntax} let-syntax ((keyword transformer) @dots{}) exp1 exp2 @dots{}
|
||||
@deffnx {Scheme Syntax} letrec-syntax ((keyword transformer) @dots{}) exp1 exp2 @dots{}
|
||||
@xref{Defining Macros}, for documentation.
|
||||
@end deffn
|
||||
|
||||
|
@ -1523,9 +1521,9 @@ This procedure is identical to the one provided by Guile's core library.
|
|||
@xref{Runtime Environment}, for documentation.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} exit
|
||||
@deffnx {Scheme Procedure} exit obj
|
||||
This procedure is identical to the one provided by Guile's core library.
|
||||
@deffn {Scheme Procedure} exit [status]
|
||||
This procedure is identical to the one provided by Guile's core
|
||||
library. @xref{Processes}, for documentation.
|
||||
@end deffn
|
||||
|
||||
@node rnrs arithmetic fixnums
|
||||
|
|
|
@ -125,7 +125,7 @@ The programmatic interface to value history is in a module:
|
|||
@end lisp
|
||||
|
||||
@deffn {Scheme Procedure} value-history-enabled?
|
||||
Return true iff value history is enabled.
|
||||
Return true if value history is enabled, or false otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} enable-value-history!
|
||||
|
@ -430,8 +430,11 @@ Garbage collection.
|
|||
Display statistics.
|
||||
@end deffn
|
||||
|
||||
@deffn {REPL Command} option [key value]
|
||||
List/show/set options.
|
||||
@deffn {REPL Command} option [name] [exp]
|
||||
With no arguments, lists all options. With one argument, shows the
|
||||
current value of the @var{name} option. With two arguments, sets the
|
||||
@var{name} option to the result of evaluating the Scheme expression
|
||||
@var{exp}.
|
||||
@end deffn
|
||||
|
||||
@deffn {REPL Command} quit
|
||||
|
@ -749,6 +752,7 @@ list}, or simply @code{guild}.
|
|||
@cindex site path
|
||||
@cindex load path
|
||||
@findex %site-dir
|
||||
@findex %site-ccache-dir
|
||||
|
||||
At some point, you will probably want to share your code with other
|
||||
people. To do so effectively, it is important to follow a set of common
|
||||
|
@ -780,11 +784,11 @@ find them.
|
|||
As with Scheme files, Guile searches a path to find compiled @code{.go}
|
||||
files, the @code{%load-compiled-path}. By default, this path has two
|
||||
entries: a path for Guile's files, and a path for site packages. You
|
||||
should install your @code{.go} files into the latter. Currently there
|
||||
is no procedure to get at this path, which is probably a bug. As in the
|
||||
previous example, if Guile @value{EFFECTIVE-VERSION} is installed on
|
||||
your system in @code{/usr/}, then the place to put compiled files for
|
||||
site packages will be
|
||||
should install your @code{.go} files into the latter directory, whose
|
||||
value is returned by invoking the @code{%site-ccache-dir} procedure. As
|
||||
in the previous example, if Guile @value{EFFECTIVE-VERSION} is installed
|
||||
on your system in @code{/usr/}, then @code{(%site-ccache-dir)} site
|
||||
packages will be
|
||||
@code{/usr/lib/guile/@value{EFFECTIVE-VERSION}/site-ccache}.
|
||||
|
||||
Note that a @code{.go} file will only be loaded in preference to a
|
||||
|
|
|
@ -45,6 +45,7 @@ get the relevant SRFI documents from the SRFI home page
|
|||
* SRFI-37:: args-fold program argument processor
|
||||
* SRFI-38:: External Representation for Data With Shared Structure
|
||||
* SRFI-39:: Parameter objects
|
||||
* SRFI-41:: Streams.
|
||||
* SRFI-42:: Eager comprehensions
|
||||
* SRFI-45:: Primitives for expressing iterative lazy algorithms
|
||||
* SRFI-55:: Requiring Features.
|
||||
|
@ -76,13 +77,13 @@ check for the Scheme implementation, that is, before she can know that
|
|||
it is safe to use @code{use-modules} to load SRFI support modules. The
|
||||
second reason is that some features defined in SRFIs had been
|
||||
implemented in Guile before the developers started to add SRFI
|
||||
implementations as modules (for example SRFI-6 (@pxref{SRFI-6})). In
|
||||
implementations as modules (for example SRFI-13 (@pxref{SRFI-13})). In
|
||||
the future, it is possible that SRFIs in the core library might be
|
||||
factored out into separate modules, requiring explicit module loading
|
||||
when they are needed. So you should be prepared to have to use
|
||||
@code{use-modules} someday in the future to access SRFI-6 bindings. If
|
||||
@code{use-modules} someday in the future to access SRFI-13 bindings. If
|
||||
you want, you can do that already. We have included the module
|
||||
@code{(srfi srfi-6)} in the distribution, which currently does nothing,
|
||||
@code{(srfi srfi-13)} in the distribution, which currently does nothing,
|
||||
but ensures that you can write future-safe code.
|
||||
|
||||
Generally, support for a specific SRFI is made available by using
|
||||
|
@ -145,9 +146,13 @@ guile-2 ;; starting from Guile 2.x
|
|||
r5rs
|
||||
srfi-0
|
||||
srfi-4
|
||||
srfi-6
|
||||
srfi-13
|
||||
srfi-14
|
||||
srfi-23
|
||||
srfi-39
|
||||
srfi-55
|
||||
srfi-61
|
||||
srfi-105
|
||||
@end example
|
||||
|
||||
Other SRFI feature symbols are defined once their code has been loaded
|
||||
|
@ -1846,11 +1851,19 @@ uniform numeric vector, it is returned unchanged.
|
|||
@cindex SRFI-6
|
||||
|
||||
SRFI-6 defines the procedures @code{open-input-string},
|
||||
@code{open-output-string} and @code{get-output-string}. These
|
||||
procedures are included in the Guile core, so using this module does not
|
||||
make any difference at the moment. But it is possible that support for
|
||||
SRFI-6 will be factored out of the core library in the future, so using
|
||||
this module does not hurt, after all.
|
||||
@code{open-output-string} and @code{get-output-string}.
|
||||
|
||||
Note that although versions of these procedures are included in the
|
||||
Guile core, the core versions are not fully conformant with SRFI-6:
|
||||
attempts to read or write characters that are not supported by the
|
||||
current @code{%default-port-encoding} will fail.
|
||||
|
||||
We therefore recommend that you import this module, which supports all
|
||||
characters:
|
||||
|
||||
@example
|
||||
(use-modules (srfi srfi-6))
|
||||
@end example
|
||||
|
||||
@node SRFI-8
|
||||
@subsection SRFI-8 - receive
|
||||
|
@ -3429,9 +3442,10 @@ Note that all fields of @var{type} and its supertypes must be specified.
|
|||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} make-compound-condition condition1 condition2 @dots{}
|
||||
Return a new compound condition composed of @var{conditions}. The
|
||||
returned condition has the type of each condition of @var{conditions}
|
||||
(per @code{condition-has-type?}).
|
||||
Return a new compound condition composed of @var{condition1}
|
||||
@var{condition2} @enddots{}. The returned condition has the type of
|
||||
each condition of condition1 condition2 @dots{} (per
|
||||
@code{condition-has-type?}).
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} condition-has-type? c type
|
||||
|
@ -3775,6 +3789,712 @@ scope and the result from that @var{thunk} is the return from
|
|||
@code{with-parameters*}.
|
||||
@end defun
|
||||
|
||||
@node SRFI-41
|
||||
@subsection SRFI-41 - Streams
|
||||
@cindex SRFI-41
|
||||
|
||||
This subsection is based on the
|
||||
@uref{http://srfi.schemers.org/srfi-41/srfi-41.html, specification of
|
||||
SRFI-41} by Philip L.@: Bewig.
|
||||
|
||||
@c The copyright notice and license text of the SRFI-41 specification is
|
||||
@c reproduced below:
|
||||
|
||||
@c Copyright (C) Philip L. Bewig (2007). All Rights Reserved.
|
||||
|
||||
@c Permission is hereby granted, free of charge, to any person obtaining a
|
||||
@c copy of this software and associated documentation files (the
|
||||
@c "Software"), to deal in the Software without restriction, including
|
||||
@c without limitation the rights to use, copy, modify, merge, publish,
|
||||
@c distribute, sublicense, and/or sell copies of the Software, and to
|
||||
@c permit persons to whom the Software is furnished to do so, subject to
|
||||
@c the following conditions:
|
||||
|
||||
@c The above copyright notice and this permission notice shall be included
|
||||
@c in all copies or substantial portions of the Software.
|
||||
|
||||
@c THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
@c OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
@c MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
@c NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
@c LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
@c OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
@c WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
@noindent
|
||||
This SRFI implements streams, sometimes called lazy lists, a sequential
|
||||
data structure containing elements computed only on demand. A stream is
|
||||
either null or is a pair with a stream in its cdr. Since elements of a
|
||||
stream are computed only when accessed, streams can be infinite. Once
|
||||
computed, the value of a stream element is cached in case it is needed
|
||||
again. SRFI-41 can be made available with:
|
||||
|
||||
@example
|
||||
(use-modules (srfi srfi-41))
|
||||
@end example
|
||||
|
||||
@menu
|
||||
* SRFI-41 Stream Fundamentals::
|
||||
* SRFI-41 Stream Primitives::
|
||||
* SRFI-41 Stream Library::
|
||||
@end menu
|
||||
|
||||
@node SRFI-41 Stream Fundamentals
|
||||
@subsubsection SRFI-41 Stream Fundamentals
|
||||
|
||||
SRFI-41 Streams are based on two mutually-recursive abstract data types:
|
||||
An object of the @code{stream} abstract data type is a promise that,
|
||||
when forced, is either @code{stream-null} or is an object of type
|
||||
@code{stream-pair}. An object of the @code{stream-pair} abstract data
|
||||
type contains a @code{stream-car} and a @code{stream-cdr}, which must be
|
||||
a @code{stream}. The essential feature of streams is the systematic
|
||||
suspensions of the recursive promises between the two data types.
|
||||
|
||||
The object stored in the @code{stream-car} of a @code{stream-pair} is a
|
||||
promise that is forced the first time the @code{stream-car} is accessed;
|
||||
its value is cached in case it is needed again. The object may have any
|
||||
type, and different stream elements may have different types. If the
|
||||
@code{stream-car} is never accessed, the object stored there is never
|
||||
evaluated. Likewise, the @code{stream-cdr} is a promise to return a
|
||||
stream, and is only forced on demand.
|
||||
|
||||
@node SRFI-41 Stream Primitives
|
||||
@subsubsection SRFI-41 Stream Primitives
|
||||
|
||||
This library provides eight operators: constructors for
|
||||
@code{stream-null} and @code{stream-pair}s, type predicates for streams
|
||||
and the two kinds of streams, accessors for both fields of a
|
||||
@code{stream-pair}, and a lambda that creates procedures that return
|
||||
streams.
|
||||
|
||||
@deffn {Scheme Variable} stream-null
|
||||
A promise that, when forced, is a single object, distinguishable from
|
||||
all other objects, that represents the null stream. @code{stream-null}
|
||||
is immutable and unique.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} stream-cons object-expr stream-expr
|
||||
Creates a newly-allocated stream containing a promise that, when forced,
|
||||
is a @code{stream-pair} with @var{object-expr} in its @code{stream-car}
|
||||
and @var{stream-expr} in its @code{stream-cdr}. Neither
|
||||
@var{object-expr} nor @var{stream-expr} is evaluated when
|
||||
@code{stream-cons} is called.
|
||||
|
||||
Once created, a @code{stream-pair} is immutable; there is no
|
||||
@code{stream-set-car!} or @code{stream-set-cdr!} that modifies an
|
||||
existing stream-pair. There is no dotted-pair or improper stream as
|
||||
with lists.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream? object
|
||||
Returns true if @var{object} is a stream, otherwise returns false. If
|
||||
@var{object} is a stream, its promise will not be forced. If
|
||||
@code{(stream? obj)} returns true, then one of @code{(stream-null? obj)}
|
||||
or @code{(stream-pair? obj)} will return true and the other will return
|
||||
false.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-null? object
|
||||
Returns true if @var{object} is the distinguished null stream, otherwise
|
||||
returns false. If @var{object} is a stream, its promise will be forced.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-pair? object
|
||||
Returns true if @var{object} is a @code{stream-pair} constructed by
|
||||
@code{stream-cons}, otherwise returns false. If @var{object} is a
|
||||
stream, its promise will be forced.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-car stream
|
||||
Returns the object stored in the @code{stream-car} of @var{stream}. An
|
||||
error is signalled if the argument is not a @code{stream-pair}. This
|
||||
causes the @var{object-expr} passed to @code{stream-cons} to be
|
||||
evaluated if it had not yet been; the value is cached in case it is
|
||||
needed again.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-cdr stream
|
||||
Returns the stream stored in the @code{stream-cdr} of @var{stream}. An
|
||||
error is signalled if the argument is not a @code{stream-pair}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} stream-lambda formals body @dots{}
|
||||
Creates a procedure that returns a promise to evaluate the @var{body} of
|
||||
the procedure. The last @var{body} expression to be evaluated must
|
||||
yield a stream. As with normal @code{lambda}, @var{formals} may be a
|
||||
single variable name, in which case all the formal arguments are
|
||||
collected into a single list, or a list of variable names, which may be
|
||||
null if there are no arguments, proper if there are an exact number of
|
||||
arguments, or dotted if a fixed number of arguments is to be followed by
|
||||
zero or more arguments collected into a list. @var{Body} must contain
|
||||
at least one expression, and may contain internal definitions preceding
|
||||
any expressions to be evaluated.
|
||||
@end deffn
|
||||
|
||||
@example
|
||||
(define strm123
|
||||
(stream-cons 1
|
||||
(stream-cons 2
|
||||
(stream-cons 3
|
||||
stream-null))))
|
||||
|
||||
(stream-car strm123) @result{} 1
|
||||
(stream-car (stream-cdr strm123) @result{} 2
|
||||
|
||||
(stream-pair?
|
||||
(stream-cdr
|
||||
(stream-cons (/ 1 0) stream-null))) @result{} #f
|
||||
|
||||
(stream? (list 1 2 3)) @result{} #f
|
||||
|
||||
(define iter
|
||||
(stream-lambda (f x)
|
||||
(stream-cons x (iter f (f x)))))
|
||||
|
||||
(define nats (iter (lambda (x) (+ x 1)) 0))
|
||||
|
||||
(stream-car (stream-cdr nats)) @result{} 1
|
||||
|
||||
(define stream-add
|
||||
(stream-lambda (s1 s2)
|
||||
(stream-cons
|
||||
(+ (stream-car s1) (stream-car s2))
|
||||
(stream-add (stream-cdr s1)
|
||||
(stream-cdr s2)))))
|
||||
|
||||
(define evens (stream-add nats nats))
|
||||
|
||||
(stream-car evens) @result{} 0
|
||||
(stream-car (stream-cdr evens)) @result{} 2
|
||||
(stream-car (stream-cdr (stream-cdr evens))) @result{} 4
|
||||
@end example
|
||||
|
||||
@node SRFI-41 Stream Library
|
||||
@subsubsection SRFI-41 Stream Library
|
||||
|
||||
@deffn {Scheme Syntax} define-stream (name args @dots{}) body @dots{}
|
||||
Creates a procedure that returns a stream, and may appear anywhere a
|
||||
normal @code{define} may appear, including as an internal definition.
|
||||
It may contain internal definitions of its own. The defined procedure
|
||||
takes arguments in the same way as @code{stream-lambda}.
|
||||
@code{define-stream} is syntactic sugar on @code{stream-lambda}; see
|
||||
also @code{stream-let}, which is also a sugaring of
|
||||
@code{stream-lambda}.
|
||||
|
||||
A simple version of @code{stream-map} that takes only a single input
|
||||
stream calls itself recursively:
|
||||
|
||||
@example
|
||||
(define-stream (stream-map proc strm)
|
||||
(if (stream-null? strm)
|
||||
stream-null
|
||||
(stream-cons
|
||||
(proc (stream-car strm))
|
||||
(stream-map proc (stream-cdr strm))))))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} list->stream list
|
||||
Returns a newly-allocated stream containing the elements from
|
||||
@var{list}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} port->stream [port]
|
||||
Returns a newly-allocated stream containing in its elements the
|
||||
characters on the port. If @var{port} is not given it defaults to the
|
||||
current input port. The returned stream has finite length and is
|
||||
terminated by @code{stream-null}.
|
||||
|
||||
It looks like one use of @code{port->stream} would be this:
|
||||
|
||||
@example
|
||||
(define s ;wrong!
|
||||
(with-input-from-file filename
|
||||
(lambda () (port->stream))))
|
||||
@end example
|
||||
|
||||
But that fails, because @code{with-input-from-file} is eager, and closes
|
||||
the input port prematurely, before the first character is read. To read
|
||||
a file into a stream, say:
|
||||
|
||||
@example
|
||||
(define-stream (file->stream filename)
|
||||
(let ((p (open-input-file filename)))
|
||||
(stream-let loop ((c (read-char p)))
|
||||
(if (eof-object? c)
|
||||
(begin (close-input-port p)
|
||||
stream-null)
|
||||
(stream-cons c
|
||||
(loop (read-char p)))))))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} stream object-expr @dots{}
|
||||
Creates a newly-allocated stream containing in its elements the objects,
|
||||
in order. The @var{object-expr}s are evaluated when they are accessed,
|
||||
not when the stream is created. If no objects are given, as in
|
||||
(stream), the null stream is returned. See also @code{list->stream}.
|
||||
|
||||
@example
|
||||
(define strm123 (stream 1 2 3))
|
||||
|
||||
; (/ 1 0) not evaluated when stream is created
|
||||
(define s (stream 1 (/ 1 0) -1))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream->list [n] stream
|
||||
Returns a newly-allocated list containing in its elements the first
|
||||
@var{n} items in @var{stream}. If @var{stream} has less than @var{n}
|
||||
items, all the items in the stream will be included in the returned
|
||||
list. If @var{n} is not given it defaults to infinity, which means that
|
||||
unless @var{stream} is finite @code{stream->list} will never return.
|
||||
|
||||
@example
|
||||
(stream->list 10
|
||||
(stream-map (lambda (x) (* x x))
|
||||
(stream-from 0)))
|
||||
@result{} (0 1 4 9 16 25 36 49 64 81)
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-append stream @dots{}
|
||||
Returns a newly-allocated stream containing in its elements those
|
||||
elements contained in its input @var{stream}s, in order of input. If
|
||||
any of the input streams is infinite, no elements of any of the
|
||||
succeeding input streams will appear in the output stream. See also
|
||||
@code{stream-concat}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-concat stream
|
||||
Takes a @var{stream} consisting of one or more streams and returns a
|
||||
newly-allocated stream containing all the elements of the input streams.
|
||||
If any of the streams in the input @var{stream} is infinite, any
|
||||
remaining streams in the input stream will never appear in the output
|
||||
stream. See also @code{stream-append}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-constant object @dots{}
|
||||
Returns a newly-allocated stream containing in its elements the
|
||||
@var{object}s, repeating in succession forever.
|
||||
|
||||
@example
|
||||
(stream-constant 1) @result{} 1 1 1 @dots{}
|
||||
(stream-constant #t #f) @result{} #t #f #t #f #t #f @dots{}
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-drop n stream
|
||||
Returns the suffix of the input @var{stream} that starts at the next
|
||||
element after the first @var{n} elements. The output stream shares
|
||||
structure with the input @var{stream}; thus, promises forced in one
|
||||
instance of the stream are also forced in the other instance of the
|
||||
stream. If the input @var{stream} has less than @var{n} elements,
|
||||
@code{stream-drop} returns the null stream. See also
|
||||
@code{stream-take}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-drop-while pred stream
|
||||
Returns the suffix of the input @var{stream} that starts at the first
|
||||
element @var{x} for which @code{(pred x)} returns false. The output
|
||||
stream shares structure with the input @var{stream}. See also
|
||||
@code{stream-take-while}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-filter pred stream
|
||||
Returns a newly-allocated stream that contains only those elements
|
||||
@var{x} of the input @var{stream} which satisfy the predicate
|
||||
@code{pred}.
|
||||
|
||||
@example
|
||||
(stream-filter odd? (stream-from 0))
|
||||
@result{} 1 3 5 7 9 @dots{}
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-fold proc base stream
|
||||
Applies a binary procedure @var{proc} to @var{base} and the first
|
||||
element of @var{stream} to compute a new @var{base}, then applies the
|
||||
procedure to the new @var{base} and the next element of @var{stream} to
|
||||
compute a succeeding @var{base}, and so on, accumulating a value that is
|
||||
finally returned as the value of @code{stream-fold} when the end of the
|
||||
stream is reached. @var{stream} must be finite, or @code{stream-fold}
|
||||
will enter an infinite loop. See also @code{stream-scan}, which is
|
||||
similar to @code{stream-fold}, but useful for infinite streams. For
|
||||
readers familiar with other functional languages, this is a left-fold;
|
||||
there is no corresponding right-fold, since right-fold relies on finite
|
||||
streams that are fully-evaluated, in which case they may as well be
|
||||
converted to a list.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-for-each proc stream @dots{}
|
||||
Applies @var{proc} element-wise to corresponding elements of the input
|
||||
@var{stream}s for side-effects; it returns nothing.
|
||||
@code{stream-for-each} stops as soon as any of its input streams is
|
||||
exhausted.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-from first [step]
|
||||
Creates a newly-allocated stream that contains @var{first} as its first
|
||||
element and increments each succeeding element by @var{step}. If
|
||||
@var{step} is not given it defaults to 1. @var{first} and @var{step}
|
||||
may be of any numeric type. @code{stream-from} is frequently useful as
|
||||
a generator in @code{stream-of} expressions. See also
|
||||
@code{stream-range} for a similar procedure that creates finite streams.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-iterate proc base
|
||||
Creates a newly-allocated stream containing @var{base} in its first
|
||||
element and applies @var{proc} to each element in turn to determine the
|
||||
succeeding element. See also @code{stream-unfold} and
|
||||
@code{stream-unfolds}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-length stream
|
||||
Returns the number of elements in the @var{stream}; it does not evaluate
|
||||
its elements. @code{stream-length} may only be used on finite streams;
|
||||
it enters an infinite loop with infinite streams.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} stream-let tag ((var expr) @dots{}) body @dots{}
|
||||
Creates a local scope that binds each variable to the value of its
|
||||
corresponding expression. It additionally binds @var{tag} to a
|
||||
procedure which takes the bound variables as arguments and @var{body} as
|
||||
its defining expressions, binding the @var{tag} with
|
||||
@code{stream-lambda}. @var{tag} is in scope within body, and may be
|
||||
called recursively. When the expanded expression defined by the
|
||||
@code{stream-let} is evaluated, @code{stream-let} evaluates the
|
||||
expressions in its @var{body} in an environment containing the
|
||||
newly-bound variables, returning the value of the last expression
|
||||
evaluated, which must yield a stream.
|
||||
|
||||
@code{stream-let} provides syntactic sugar on @code{stream-lambda}, in
|
||||
the same manner as normal @code{let} provides syntactic sugar on normal
|
||||
@code{lambda}. However, unlike normal @code{let}, the @var{tag} is
|
||||
required, not optional, because unnamed @code{stream-let} is
|
||||
meaningless.
|
||||
|
||||
For example, @code{stream-member} returns the first @code{stream-pair}
|
||||
of the input @var{strm} with a @code{stream-car} @var{x} that satisfies
|
||||
@code{(eql? obj x)}, or the null stream if @var{x} is not present in
|
||||
@var{strm}.
|
||||
|
||||
@example
|
||||
(define-stream (stream-member eql? obj strm)
|
||||
(stream-let loop ((strm strm))
|
||||
(cond ((stream-null? strm) strm)
|
||||
((eql? obj (stream-car strm)) strm)
|
||||
(else (loop (stream-cdr strm))))))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-map proc stream @dots{}
|
||||
Applies @var{proc} element-wise to corresponding elements of the input
|
||||
@var{stream}s, returning a newly-allocated stream containing elements
|
||||
that are the results of those procedure applications. The output stream
|
||||
has as many elements as the minimum-length input stream, and may be
|
||||
infinite.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} stream-match stream clause @dots{}
|
||||
Provides pattern-matching for streams. The input @var{stream} is an
|
||||
expression that evaluates to a stream. Clauses are of the form
|
||||
@code{(pattern [fender] expression)}, consisting of a @var{pattern} that
|
||||
matches a stream of a particular shape, an optional @var{fender} that
|
||||
must succeed if the pattern is to match, and an @var{expression} that is
|
||||
evaluated if the pattern matches. There are four types of patterns:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
() matches the null stream.
|
||||
|
||||
@item
|
||||
(@var{pat0} @var{pat1} @dots{}) matches a finite stream with length
|
||||
exactly equal to the number of pattern elements.
|
||||
|
||||
@item
|
||||
(@var{pat0} @var{pat1} @dots{} @code{.} @var{pat-rest}) matches an
|
||||
infinite stream, or a finite stream with length at least as great as the
|
||||
number of pattern elements before the literal dot.
|
||||
|
||||
@item
|
||||
@var{pat} matches an entire stream. Should always appear last in the
|
||||
list of clauses; it's not an error to appear elsewhere, but subsequent
|
||||
clauses could never match.
|
||||
@end itemize
|
||||
|
||||
Each pattern element may be either:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
An identifier, which matches any stream element. Additionally, the
|
||||
value of the stream element is bound to the variable named by the
|
||||
identifier, which is in scope in the @var{fender} and @var{expression}
|
||||
of the corresponding @var{clause}. Each identifier in a single pattern
|
||||
must be unique.
|
||||
|
||||
@item
|
||||
A literal underscore (@code{_}), which matches any stream element but
|
||||
creates no bindings.
|
||||
@end itemize
|
||||
|
||||
The @var{pattern}s are tested in order, left-to-right, until a matching
|
||||
pattern is found; if @var{fender} is present, it must evaluate to a true
|
||||
value for the match to be successful. Pattern variables are bound in
|
||||
the corresponding @var{fender} and @var{expression}. Once the matching
|
||||
@var{pattern} is found, the corresponding @var{expression} is evaluated
|
||||
and returned as the result of the match. An error is signaled if no
|
||||
pattern matches the input @var{stream}.
|
||||
|
||||
@code{stream-match} is often used to distinguish null streams from
|
||||
non-null streams, binding @var{head} and @var{tail}:
|
||||
|
||||
@example
|
||||
(define (len strm)
|
||||
(stream-match strm
|
||||
(() 0)
|
||||
((head . tail) (+ 1 (len tail)))))
|
||||
@end example
|
||||
|
||||
Fenders can test the common case where two stream elements must be
|
||||
identical; the @code{else} pattern is an identifier bound to the entire
|
||||
stream, not a keyword as in @code{cond}.
|
||||
|
||||
@example
|
||||
(stream-match strm
|
||||
((x y . _) (equal? x y) 'ok)
|
||||
(else 'error))
|
||||
@end example
|
||||
|
||||
A more complex example uses two nested matchers to match two different
|
||||
stream arguments; @code{(stream-merge lt? . strms)} stably merges two or
|
||||
more streams ordered by the @code{lt?} predicate:
|
||||
|
||||
@example
|
||||
(define-stream (stream-merge lt? . strms)
|
||||
(define-stream (merge xx yy)
|
||||
(stream-match xx (() yy) ((x . xs)
|
||||
(stream-match yy (() xx) ((y . ys)
|
||||
(if (lt? y x)
|
||||
(stream-cons y (merge xx ys))
|
||||
(stream-cons x (merge xs yy))))))))
|
||||
(stream-let loop ((strms strms))
|
||||
(cond ((null? strms) stream-null)
|
||||
((null? (cdr strms)) (car strms))
|
||||
(else (merge (car strms)
|
||||
(apply stream-merge lt?
|
||||
(cdr strms)))))))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} stream-of expr clause @dots{}
|
||||
Provides the syntax of stream comprehensions, which generate streams by
|
||||
means of looping expressions. The result is a stream of objects of the
|
||||
type returned by @var{expr}. There are four types of clauses:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
(@var{var} @code{in} @var{stream-expr}) loops over the elements of
|
||||
@var{stream-expr}, in order from the start of the stream, binding each
|
||||
element of the stream in turn to @var{var}. @code{stream-from} and
|
||||
@code{stream-range} are frequently useful as generators for
|
||||
@var{stream-expr}.
|
||||
|
||||
@item
|
||||
(@var{var} @code{is} @var{expr}) binds @var{var} to the value obtained
|
||||
by evaluating @var{expr}.
|
||||
|
||||
@item
|
||||
(@var{pred} @var{expr}) includes in the output stream only those
|
||||
elements @var{x} which satisfy the predicate @var{pred}.
|
||||
@end itemize
|
||||
|
||||
The scope of variables bound in the stream comprehension is the clauses
|
||||
to the right of the binding clause (but not the binding clause itself)
|
||||
plus the result expression.
|
||||
|
||||
When two or more generators are present, the loops are processed as if
|
||||
they are nested from left to right; that is, the rightmost generator
|
||||
varies fastest. A consequence of this is that only the first generator
|
||||
may be infinite and all subsequent generators must be finite. If no
|
||||
generators are present, the result of a stream comprehension is a stream
|
||||
containing the result expression; thus, @samp{(stream-of 1)} produces a
|
||||
finite stream containing only the element 1.
|
||||
|
||||
@example
|
||||
(stream-of (* x x)
|
||||
(x in (stream-range 0 10))
|
||||
(even? x))
|
||||
@result{} 0 4 16 36 64
|
||||
|
||||
(stream-of (list a b)
|
||||
(a in (stream-range 1 4))
|
||||
(b in (stream-range 1 3)))
|
||||
@result{} (1 1) (1 2) (2 1) (2 2) (3 1) (3 2)
|
||||
|
||||
(stream-of (list i j)
|
||||
(i in (stream-range 1 5))
|
||||
(j in (stream-range (+ i 1) 5)))
|
||||
@result{} (1 2) (1 3) (1 4) (2 3) (2 4) (3 4)
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-range first past [step]
|
||||
Creates a newly-allocated stream that contains @var{first} as its first
|
||||
element and increments each succeeding element by @var{step}. The
|
||||
stream is finite and ends before @var{past}, which is not an element of
|
||||
the stream. If @var{step} is not given it defaults to 1 if @var{first}
|
||||
is less than past and -1 otherwise. @var{first}, @var{past} and
|
||||
@var{step} may be of any real numeric type. @code{stream-range} is
|
||||
frequently useful as a generator in @code{stream-of} expressions. See
|
||||
also @code{stream-from} for a similar procedure that creates infinite
|
||||
streams.
|
||||
|
||||
@example
|
||||
(stream-range 0 10) @result{} 0 1 2 3 4 5 6 7 8 9
|
||||
(stream-range 0 10 2) @result{} 0 2 4 6 8
|
||||
@end example
|
||||
|
||||
Successive elements of the stream are calculated by adding @var{step} to
|
||||
@var{first}, so if any of @var{first}, @var{past} or @var{step} are
|
||||
inexact, the length of the output stream may differ from
|
||||
@code{(ceiling (- (/ (- past first) step) 1)}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-ref stream n
|
||||
Returns the @var{n}th element of stream, counting from zero. An error
|
||||
is signaled if @var{n} is greater than or equal to the length of stream.
|
||||
|
||||
@example
|
||||
(define (fact n)
|
||||
(stream-ref
|
||||
(stream-scan * 1 (stream-from 1))
|
||||
n))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-reverse stream
|
||||
Returns a newly-allocated stream containing the elements of the input
|
||||
@var{stream} but in reverse order. @code{stream-reverse} may only be
|
||||
used with finite streams; it enters an infinite loop with infinite
|
||||
streams. @code{stream-reverse} does not force evaluation of the
|
||||
elements of the stream.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-scan proc base stream
|
||||
Accumulates the partial folds of an input @var{stream} into a
|
||||
newly-allocated output stream. The output stream is the @var{base}
|
||||
followed by @code{(stream-fold proc base (stream-take i stream))} for
|
||||
each of the first @var{i} elements of @var{stream}.
|
||||
|
||||
@example
|
||||
(stream-scan + 0 (stream-from 1))
|
||||
@result{} (stream 0 1 3 6 10 15 @dots{})
|
||||
|
||||
(stream-scan * 1 (stream-from 1))
|
||||
@result{} (stream 1 1 2 6 24 120 @dots{})
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-take n stream
|
||||
Returns a newly-allocated stream containing the first @var{n} elements
|
||||
of the input @var{stream}. If the input @var{stream} has less than
|
||||
@var{n} elements, so does the output stream. See also
|
||||
@code{stream-drop}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-take-while pred stream
|
||||
Takes a predicate and a @code{stream} and returns a newly-allocated
|
||||
stream containing those elements @code{x} that form the maximal prefix
|
||||
of the input stream which satisfy @var{pred}. See also
|
||||
@code{stream-drop-while}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-unfold map pred gen base
|
||||
The fundamental recursive stream constructor. It constructs a stream by
|
||||
repeatedly applying @var{gen} to successive values of @var{base}, in the
|
||||
manner of @code{stream-iterate}, then applying @var{map} to each of the
|
||||
values so generated, appending each of the mapped values to the output
|
||||
stream as long as @code{(pred? base)} returns a true value. See also
|
||||
@code{stream-iterate} and @code{stream-unfolds}.
|
||||
|
||||
The expression below creates the finite stream @samp{0 1 4 9 16 25 36 49
|
||||
64 81}. Initially the @var{base} is 0, which is less than 10, so
|
||||
@var{map} squares the @var{base} and the mapped value becomes the first
|
||||
element of the output stream. Then @var{gen} increments the @var{base}
|
||||
by 1, so it becomes 1; this is less than 10, so @var{map} squares the
|
||||
new @var{base} and 1 becomes the second element of the output stream.
|
||||
And so on, until the base becomes 10, when @var{pred} stops the
|
||||
recursion and stream-null ends the output stream.
|
||||
|
||||
@example
|
||||
(stream-unfold
|
||||
(lambda (x) (expt x 2)) ; map
|
||||
(lambda (x) (< x 10)) ; pred?
|
||||
(lambda (x) (+ x 1)) ; gen
|
||||
0) ; base
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-unfolds proc seed
|
||||
Returns @var{n} newly-allocated streams containing those elements
|
||||
produced by successive calls to the generator @var{proc}, which takes
|
||||
the current @var{seed} as its argument and returns @var{n}+1 values
|
||||
|
||||
(@var{proc} @var{seed}) @result{} @var{seed} @var{result_0} @dots{} @var{result_n-1}
|
||||
|
||||
where the returned @var{seed} is the input @var{seed} to the next call
|
||||
to the generator and @var{result_i} indicates how to produce the next
|
||||
element of the @var{i}th result stream:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
(@var{value}): @var{value} is the next car of the result stream.
|
||||
|
||||
@item
|
||||
@code{#f}: no value produced by this iteration of the generator
|
||||
@var{proc} for the result stream.
|
||||
|
||||
@item
|
||||
(): the end of the result stream.
|
||||
@end itemize
|
||||
|
||||
It may require multiple calls of @var{proc} to produce the next element
|
||||
of any particular result stream. See also @code{stream-iterate} and
|
||||
@code{stream-unfold}.
|
||||
|
||||
@example
|
||||
(define (stream-partition pred? strm)
|
||||
(stream-unfolds
|
||||
(lambda (s)
|
||||
(if (stream-null? s)
|
||||
(values s '() '())
|
||||
(let ((a (stream-car s))
|
||||
(d (stream-cdr s)))
|
||||
(if (pred? a)
|
||||
(values d (list a) #f)
|
||||
(values d #f (list a))))))
|
||||
strm))
|
||||
|
||||
(call-with-values
|
||||
(lambda ()
|
||||
(stream-partition odd?
|
||||
(stream-range 1 6)))
|
||||
(lambda (odds evens)
|
||||
(list (stream->list odds)
|
||||
(stream->list evens))))
|
||||
@result{} ((1 3 5) (2 4))
|
||||
@end example
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} stream-zip stream @dots{}
|
||||
Returns a newly-allocated stream in which each element is a list (not a
|
||||
stream) of the corresponding elements of the input @var{stream}s. The
|
||||
output stream is as long as the shortest input @var{stream}, if any of
|
||||
the input @var{stream}s is finite, or is infinite if all the input
|
||||
@var{stream}s are infinite.
|
||||
@end deffn
|
||||
|
||||
@node SRFI-42
|
||||
@subsection SRFI-42 - Eager Comprehensions
|
||||
@cindex SRFI-42
|
||||
|
@ -3832,6 +4552,13 @@ words, no program that uses the R5RS definitions of delay and force will
|
|||
break if those definition are replaced by the SRFI-45 definitions of
|
||||
delay and force.
|
||||
|
||||
Guile also adds @code{promise?} to the list of exports, which is not
|
||||
part of the official SRFI-45.
|
||||
|
||||
@deffn {Scheme Procedure} promise? obj
|
||||
Return true if @var{obj} is an SRFI-45 promise, otherwise return false.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Syntax} delay expression
|
||||
Takes an expression of arbitrary type @var{a} and returns a promise of
|
||||
type @code{(Promise @var{a})} which at some point in the future may be
|
||||
|
|
|
@ -381,13 +381,8 @@ Pearl. Proc ICFP'00, pp. 186-197.
|
|||
@deffn {Scheme Procedure} attlist-add attlist name-value
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} attlist-null? _
|
||||
@verbatim
|
||||
-- Scheme Procedure: null? x
|
||||
Return `#t' iff X is the empty list, else `#f'.
|
||||
|
||||
|
||||
@end verbatim
|
||||
@deffn {Scheme Procedure} attlist-null? x
|
||||
Return @code{#t} if @var{x} is the empty list, else @code{#f}.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} attlist-remove-top attlist
|
||||
|
|
|
@ -3,8 +3,12 @@
|
|||
@c Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
@node Texinfo
|
||||
@section Texinfo
|
||||
@c Note: Don't use "Texinfo" as the node name here because this leads to
|
||||
@c a clash in the HTML output between texinfo.html (from the "texinfo"
|
||||
@c node) and Texinfo.html on case-insensitive file systems such as
|
||||
@c HFS+ (MacOS X).
|
||||
@node Texinfo Processing
|
||||
@section Texinfo Processing
|
||||
|
||||
@menu
|
||||
* texinfo:: Parse texinfo files or fragments into @code{stexi}, a scheme representation
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
@cindex HTTP
|
||||
|
||||
It has always been possible to connect computers together and share
|
||||
information between them, but the rise of the World-Wide Web over the
|
||||
information between them, but the rise of the World Wide Web over the
|
||||
last couple of decades has made it much easier to do so. The result is
|
||||
a richly connected network of computation, in which Guile forms a part.
|
||||
|
||||
|
@ -206,9 +206,10 @@ The following procedures can be found in the @code{(web uri)}
|
|||
module. Load it into your Guile, using a form like the above, to have
|
||||
access to them.
|
||||
|
||||
@deffn {Scheme Procedure} build-uri scheme [#:userinfo=@code{#f}] [#:host=@code{#f}] @
|
||||
[#:port=@code{#f}] [#:path=@code{""}] [#:query=@code{#f}] @
|
||||
[#:fragment=@code{#f}] [#:validate?=@code{#t}]
|
||||
@deffn {Scheme Procedure} build-uri scheme @
|
||||
[#:userinfo=@code{#f}] [#:host=@code{#f}] [#:port=@code{#f}] @
|
||||
[#:path=@code{""}] [#:query=@code{#f}] [#:fragment=@code{#f}] @
|
||||
[#:validate?=@code{#t}]
|
||||
Construct a URI object. @var{scheme} should be a symbol, @var{port}
|
||||
either a positive, exact integer or @code{#f}, and the rest of the
|
||||
fields are either strings or @code{#f}. If @var{validate?} is true,
|
||||
|
@ -216,7 +217,7 @@ also run some consistency checks to make sure that the constructed URI
|
|||
is valid.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} uri? x
|
||||
@deffn {Scheme Procedure} uri? obj
|
||||
@deffnx {Scheme Procedure} uri-scheme uri
|
||||
@deffnx {Scheme Procedure} uri-userinfo uri
|
||||
@deffnx {Scheme Procedure} uri-host uri
|
||||
|
@ -249,9 +250,9 @@ Percent-decode the given @var{str}, according to @var{encoding}, which
|
|||
should be the name of a character encoding.
|
||||
|
||||
Note that this function should not generally be applied to a full URI
|
||||
string. For paths, use split-and-decode-uri-path instead. For query
|
||||
strings, split the query on @code{&} and @code{=} boundaries, and decode
|
||||
the components separately.
|
||||
string. For paths, use @code{split-and-decode-uri-path} instead. For
|
||||
query strings, split the query on @code{&} and @code{=} boundaries, and
|
||||
decode the components separately.
|
||||
|
||||
Note also that percent-encoded strings encode @emph{bytes}, not
|
||||
characters. There is no guarantee that a given byte sequence is a valid
|
||||
|
@ -351,8 +352,8 @@ parsing and serialization procedures. If a header is unknown, its
|
|||
string name is simply its symbol name in title-case.
|
||||
|
||||
@deffn {Scheme Procedure} known-header? sym
|
||||
Return @code{#t} iff @var{sym} is a known header, with associated
|
||||
parsers and serialization procedures.
|
||||
Return @code{#t} if @var{sym} is a known header, with associated
|
||||
parsers and serialization procedures, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} header-parser sym
|
||||
|
@ -378,7 +379,8 @@ For more on the set of headers that Guile knows about out of the box,
|
|||
@pxref{HTTP Headers}. To add your own, use the @code{declare-header!}
|
||||
procedure:
|
||||
|
||||
@deffn {Scheme Procedure} declare-header! name parser validator writer [#:multiple?=@code{#f}]
|
||||
@deffn {Scheme Procedure} declare-header! name parser validator writer @
|
||||
[#:multiple?=@code{#f}]
|
||||
Declare a parser, validator, and writer for a given header.
|
||||
@end deffn
|
||||
|
||||
|
@ -405,8 +407,8 @@ you want a header's value to be returned/written ``as-is''.
|
|||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} valid-header? sym val
|
||||
Return a true value iff @var{val} is a valid Scheme value for the header
|
||||
with name @var{sym}.
|
||||
Return a true value if @var{val} is a valid Scheme value for the header
|
||||
with name @var{sym}, or @code{#f} otherwise.
|
||||
@end deffn
|
||||
|
||||
Now that we have a generic interface for reading and writing headers, we
|
||||
|
@ -450,7 +452,7 @@ like @code{GET}.
|
|||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} parse-http-version str [start] [end]
|
||||
Parse an HTTP version from @var{str}, returning it as a major-minor
|
||||
Parse an HTTP version from @var{str}, returning it as a major--minor
|
||||
pair. For example, @code{HTTP/1.1} parses as the pair of integers,
|
||||
@code{(1 . 1)}.
|
||||
@end deffn
|
||||
|
@ -471,7 +473,7 @@ Write the first line of an HTTP request to @var{port}.
|
|||
|
||||
@deffn {Scheme Procedure} read-response-line port
|
||||
Read the first line of an HTTP response from @var{port}, returning three
|
||||
values: the HTTP version, the response code, and the "reason phrase".
|
||||
values: the HTTP version, the response code, and the ``reason phrase''.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} write-response-line version code reason-phrase port
|
||||
|
@ -1130,13 +1132,13 @@ any loss of generality.
|
|||
|
||||
@subsubsection Request API
|
||||
|
||||
@deffn {Scheme Procedure} request?
|
||||
@deffnx {Scheme Procedure} request-method
|
||||
@deffnx {Scheme Procedure} request-uri
|
||||
@deffnx {Scheme Procedure} request-version
|
||||
@deffnx {Scheme Procedure} request-headers
|
||||
@deffnx {Scheme Procedure} request-meta
|
||||
@deffnx {Scheme Procedure} request-port
|
||||
@deffn {Scheme Procedure} request? obj
|
||||
@deffnx {Scheme Procedure} request-method request
|
||||
@deffnx {Scheme Procedure} request-uri request
|
||||
@deffnx {Scheme Procedure} request-version request
|
||||
@deffnx {Scheme Procedure} request-headers request
|
||||
@deffnx {Scheme Procedure} request-meta request
|
||||
@deffnx {Scheme Procedure} request-port request
|
||||
A predicate and field accessors for the request type. The fields are as
|
||||
follows:
|
||||
@table @code
|
||||
|
@ -1170,7 +1172,9 @@ request, you may read the body separately, and likewise for writing
|
|||
requests.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} build-request uri [#:method='GET] [#:version='(1 . 1)] [#:headers='()] [#:port=#f] [#:meta='()] [#:validate-headers?=#t]
|
||||
@deffn {Scheme Procedure} build-request uri [#:method='GET] @
|
||||
[#:version='(1 . 1)] [#:headers='()] [#:port=#f] [#:meta='()] @
|
||||
[#:validate-headers?=#t]
|
||||
Construct an HTTP request object. If @var{validate-headers?} is true,
|
||||
the headers are each run through their respective validators.
|
||||
@end deffn
|
||||
|
@ -1253,12 +1257,12 @@ A helper routine to determine the absolute URI of a request, using the
|
|||
As with requests (@pxref{Requests}), Guile offers a data type for HTTP
|
||||
responses. Again, the body is represented separately from the request.
|
||||
|
||||
@deffn {Scheme Procedure} response?
|
||||
@deffnx {Scheme Procedure} response-version
|
||||
@deffnx {Scheme Procedure} response-code
|
||||
@deffn {Scheme Procedure} response? obj
|
||||
@deffnx {Scheme Procedure} response-version response
|
||||
@deffnx {Scheme Procedure} response-code response
|
||||
@deffnx {Scheme Procedure} response-reason-phrase response
|
||||
@deffnx {Scheme Procedure} response-headers
|
||||
@deffnx {Scheme Procedure} response-port
|
||||
@deffnx {Scheme Procedure} response-headers response
|
||||
@deffnx {Scheme Procedure} response-port response
|
||||
A predicate and field accessors for the response type. The fields are as
|
||||
follows:
|
||||
@table @code
|
||||
|
@ -1384,6 +1388,10 @@ Return @code{#t} if @var{type}, a symbol as returned by
|
|||
@code{(web client)} provides a simple, synchronous HTTP client, built on
|
||||
the lower-level HTTP, request, and response modules.
|
||||
|
||||
@example
|
||||
(use-modules (web client))
|
||||
@end example
|
||||
|
||||
@deffn {Scheme Procedure} open-socket-for-uri uri
|
||||
Return an open input/output port for a connection to URI.
|
||||
@end deffn
|
||||
|
@ -1419,9 +1427,9 @@ If you already have a port open, pass it as @var{port}. Otherwise, a
|
|||
connection will be opened to the server corresponding to @var{uri}. Any
|
||||
extra headers in the alist @var{headers} will be added to the request.
|
||||
|
||||
If @var{body} is not #f, a message body will also be sent with the HTTP
|
||||
request. If @var{body} is a string, it is encoded according to the
|
||||
content-type in @var{headers}, defaulting to UTF-8. Otherwise
|
||||
If @var{body} is not @code{#f}, a message body will also be sent with
|
||||
the HTTP request. If @var{body} is a string, it is encoded according to
|
||||
the content-type in @var{headers}, defaulting to UTF-8. Otherwise
|
||||
@var{body} should be a bytevector, or @code{#f} for no body. Although a
|
||||
message body may be sent with any request, usually only @code{POST} and
|
||||
@code{PUT} requests have bodies.
|
||||
|
@ -1480,8 +1488,8 @@ The life cycle of a server goes as follows:
|
|||
|
||||
@enumerate
|
||||
@item
|
||||
The @code{open} hook is called, to open the server. @code{open} takes 0 or
|
||||
more arguments, depending on the backend, and returns an opaque
|
||||
The @code{open} hook is called, to open the server. @code{open} takes
|
||||
zero or more arguments, depending on the backend, and returns an opaque
|
||||
server socket object, or signals an error.
|
||||
|
||||
@item
|
||||
|
@ -1578,8 +1586,8 @@ in, allowing the user's handler to explicitly manage its state.
|
|||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} sanitize-response request response body
|
||||
"Sanitize" the given response and body, making them appropriate for the
|
||||
given request.
|
||||
``Sanitize'' the given response and body, making them appropriate for
|
||||
the given request.
|
||||
|
||||
As a convenience to web handler authors, @var{response} may be given as
|
||||
an alist of headers, in which case it is used to construct a default
|
||||
|
@ -1615,7 +1623,9 @@ and body, and write the response to the client. Return the new state
|
|||
produced by the handler procedure.
|
||||
@end deffn
|
||||
|
||||
@deffn {Scheme Procedure} run-server handler [impl='http] [open-params='()] . state
|
||||
@deffn {Scheme Procedure} run-server handler @
|
||||
[impl='http] [open-params='()] @
|
||||
arg @dots{}
|
||||
Run Guile's built-in web server.
|
||||
|
||||
@var{handler} should be a procedure that takes two or more arguments,
|
||||
|
@ -1627,16 +1637,20 @@ For examples, skip ahead to the next section, @ref{Web Examples}.
|
|||
The response and body will be run through @code{sanitize-response}
|
||||
before sending back to the client.
|
||||
|
||||
Additional arguments to @var{handler} are taken from @var{state}.
|
||||
Additional return values are accumulated into a new @var{state}, which
|
||||
will be used for subsequent requests. In this way a handler can
|
||||
explicitly manage its state.
|
||||
Additional arguments to @var{handler} are taken from @var{arg}
|
||||
@enddots{}. These arguments comprise a @dfn{state}. Additional return
|
||||
values are accumulated into a new state, which will be used for
|
||||
subsequent requests. In this way a handler can explicitly manage its
|
||||
state.
|
||||
@end deffn
|
||||
|
||||
The default web server implementation is @code{http}, which binds to a
|
||||
socket, listening for request on that port.
|
||||
|
||||
@deffn {HTTP Implementation} http [#:host=#f] [#:family=AF_INET] [#:addr=INADDR_LOOPBACK] [#:port 8080] [#:socket]
|
||||
@deffn {HTTP Implementation} http [#:host=#f] @
|
||||
[#:family=AF_INET] @
|
||||
[#:addr=INADDR_LOOPBACK] @
|
||||
[#:port 8080] [#:socket]
|
||||
The default HTTP implementation. We document it as a function with
|
||||
keyword arguments, because that is precisely the way that it is -- all
|
||||
of the @var{open-params} to @code{run-server} get passed to the
|
||||
|
|
|
@ -2,47 +2,33 @@ This patch is being discussed
|
|||
at <http://lists.gnu.org/archive/html/bug-gnulib/2012-07/msg00079.html>.
|
||||
Remove when integrated in Gnulib.
|
||||
|
||||
--- a/build-aux/git-version-gen 2012-06-12 21:25:48.000000000 +0200
|
||||
+++ b/build-aux/git-version-gen 2012-07-07 01:52:08.000000000 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Print a version string.
|
||||
-scriptversion=2012-03-18.17; # UTC
|
||||
+scriptversion=2012-07-06.14; # UTC
|
||||
|
||||
# Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
||||
#
|
||||
@@ -85,20 +85,25 @@
|
||||
|
||||
--- a/build-aux/git-version-gen
|
||||
+++ b/build-aux/git-version-gen
|
||||
@@ -86,6 +86,7 @@ Print a version string.
|
||||
Options:
|
||||
|
||||
- --prefix prefix of git tags (default 'v')
|
||||
+ --prefix prefix of git tags to strip from version (default 'v')
|
||||
+ --match pattern for git tags to match (default: '\$prefix*')
|
||||
|
||||
- --help display this help and exit
|
||||
- --version output version information and exit
|
||||
+ --help display this help and exit
|
||||
+ --version output version information and exit
|
||||
|
||||
-Running without arguments will suffice in most cases."
|
||||
+Running without arguments will suffice in most cases. If no --match
|
||||
+argument is given, only match tags that begin with the --prefix."
|
||||
--prefix prefix of git tags (default 'v')
|
||||
+ --match pattern for git tags to match (default: '\$prefix*')
|
||||
--fallback fallback version to use if \"git --version\" fails
|
||||
|
||||
--help display this help and exit
|
||||
@@ -96,11 +97,15 @@ Running without arguments will suffice in most cases."
|
||||
prefix=v
|
||||
fallback=
|
||||
|
||||
+unset match
|
||||
+unset tag_sed_script
|
||||
|
||||
+
|
||||
while test $# -gt 0; do
|
||||
case $1 in
|
||||
--help) echo "$usage"; exit 0;;
|
||||
--version) echo "$version"; exit 0;;
|
||||
--prefix) shift; prefix="$1";;
|
||||
+ --match) shift; match="$1";;
|
||||
--fallback) shift; fallback="$1";;
|
||||
-*)
|
||||
echo "$0: Unknown option '$1'." >&2
|
||||
echo "$0: Try '--help' for more information." >&2
|
||||
@@ -121,6 +126,7 @@
|
||||
@@ -124,6 +129,7 @@ if test "x$tarball_version_file" = x; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -50,13 +36,12 @@ Remove when integrated in Gnulib.
|
|||
tag_sed_script="${tag_sed_script:-s/x/x/}"
|
||||
|
||||
nl='
|
||||
@@ -151,8 +157,7 @@
|
||||
@@ -154,7 +160,7 @@ then
|
||||
# directory, and "git describe" output looks sensible, use that to
|
||||
# derive a version string.
|
||||
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
|
||||
- && v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|
||||
- || git describe --abbrev=4 HEAD 2>/dev/null` \
|
||||
+ && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null` \
|
||||
+ && v=`git describe --abbrev=4 --match="$match" HEAD 2>/dev/null \
|
||||
|| git describe --abbrev=4 HEAD 2>/dev/null` \
|
||||
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
|
||||
&& case $v in
|
||||
$prefix[0-9]*) ;;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* readline.c --- line editing support for Guile */
|
||||
|
||||
/* Copyright (C) 1997,1999,2000,2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010, 2013 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1997,1999,2000,2001, 2002, 2003, 2006, 2007, 2008,
|
||||
* 2009, 2010, 2013 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -27,19 +28,13 @@
|
|||
|
||||
#ifdef HAVE_RL_GETC_FUNCTION
|
||||
#include "libguile.h"
|
||||
#include "libguile/iselect.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#ifndef __MINGW32__
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <sys/select.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "libguile/validate.h"
|
||||
|
@ -207,10 +202,8 @@ SCM_DEFINE (scm_readline, "%readline", 0, 4, 0,
|
|||
|
||||
scm_dynwind_end ();
|
||||
|
||||
#ifndef __MINGW32__
|
||||
fclose (rl_instream);
|
||||
fclose (rl_outstream);
|
||||
#endif
|
||||
|
||||
--in_readline;
|
||||
return ans;
|
||||
|
@ -240,10 +233,8 @@ unwind_readline (void *unused)
|
|||
rl_free_line_state ();
|
||||
rl_cleanup_after_signal ();
|
||||
fputc ('\n', rl_outstream); /* We don't want next output on this line */
|
||||
#ifndef __MINGW32__
|
||||
fclose (rl_instream);
|
||||
fclose (rl_outstream);
|
||||
#endif
|
||||
--in_readline;
|
||||
}
|
||||
|
||||
|
@ -314,10 +305,8 @@ scm_readline_init_ports (SCM inp, SCM outp)
|
|||
|
||||
input_port = inp;
|
||||
output_port = outp;
|
||||
#ifndef __MINGW32__
|
||||
rl_instream = stream_from_fport (inp, "r", s_scm_readline);
|
||||
rl_outstream = stream_from_fport (outp, "w", s_scm_readline);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -489,11 +478,9 @@ static int
|
|||
match_paren (int x, int k)
|
||||
{
|
||||
int tmp;
|
||||
#ifndef __MINGW32__
|
||||
int fno;
|
||||
SELECT_TYPE readset;
|
||||
fd_set readset;
|
||||
struct timeval timeout;
|
||||
#endif
|
||||
|
||||
rl_insert (x, k);
|
||||
if (!SCM_READLINE_BOUNCE_PARENS)
|
||||
|
@ -504,14 +491,12 @@ match_paren (int x, int k)
|
|||
&& rl_line_buffer[rl_point - 2] == '\\')
|
||||
return 0;
|
||||
|
||||
#ifndef __MINGW32__
|
||||
tmp = 1000 * SCM_READLINE_BOUNCE_PARENS;
|
||||
timeout.tv_sec = tmp / 1000000;
|
||||
timeout.tv_usec = tmp % 1000000;
|
||||
FD_ZERO (&readset);
|
||||
fno = fileno (rl_instream);
|
||||
FD_SET (fno, &readset);
|
||||
#endif
|
||||
|
||||
if (rl_point > 1)
|
||||
{
|
||||
|
@ -520,12 +505,7 @@ match_paren (int x, int k)
|
|||
if (rl_point > -1)
|
||||
{
|
||||
rl_redisplay ();
|
||||
#ifndef __MINGW32__
|
||||
scm_std_select (fno + 1, &readset, NULL, NULL, &timeout);
|
||||
#else
|
||||
WaitForSingleObject (GetStdHandle(STD_INPUT_HANDLE),
|
||||
SCM_READLINE_BOUNCE_PARENS);
|
||||
#endif
|
||||
select (fno + 1, &readset, NULL, NULL, &timeout);
|
||||
}
|
||||
rl_point = tmp;
|
||||
}
|
||||
|
@ -542,9 +522,7 @@ scm_init_readline ()
|
|||
#include "guile-readline/readline.x"
|
||||
scm_readline_completion_function_var
|
||||
= scm_c_define ("*readline-completion-function*", SCM_BOOL_F);
|
||||
#ifndef __MINGW32__
|
||||
rl_getc_function = current_input_getc;
|
||||
#endif
|
||||
#if defined (_RL_FUNCTION_TYPEDEF)
|
||||
rl_completion_entry_function = (rl_compentry_func_t*) completion_function;
|
||||
#else
|
||||
|
|
171
lib/Makefile.am
171
lib/Makefile.am
|
@ -1,6 +1,6 @@
|
|||
## DO NOT EDIT! GENERATED AUTOMATICALLY!
|
||||
## Process this file with automake to produce Makefile.in.
|
||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -21,7 +21,7 @@
|
|||
# the same distribution terms as the rest of that program.
|
||||
#
|
||||
# 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 clock-time 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
|
||||
# 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 clock-time close connect dirfd duplocale environ extensions flock floor fpieee frexp fstat full-read full-write func gendocs getaddrinfo getlogin 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 pipe-posix pipe2 poll putenv recv recvfrom regex rename select send sendto setenv setsockopt shutdown socket stat-time stdlib strftime striconveh string sys_stat times trunc verify vsnprintf warnings wchar
|
||||
|
||||
AUTOMAKE_OPTIONS = 1.5 gnits subdir-objects
|
||||
|
||||
|
@ -62,6 +62,8 @@ libgnu_la_LDFLAGS += $(ISNANL_LIBM)
|
|||
libgnu_la_LDFLAGS += $(LDEXP_LIBM)
|
||||
libgnu_la_LDFLAGS += $(LIBSOCKET)
|
||||
libgnu_la_LDFLAGS += $(LIB_CLOCK_GETTIME)
|
||||
libgnu_la_LDFLAGS += $(LIB_POLL)
|
||||
libgnu_la_LDFLAGS += $(LIB_SELECT)
|
||||
libgnu_la_LDFLAGS += $(LOG1P_LIBM)
|
||||
libgnu_la_LDFLAGS += $(LOG_LIBM)
|
||||
libgnu_la_LDFLAGS += $(LTLIBICONV)
|
||||
|
@ -87,6 +89,17 @@ EXTRA_DIST += alignof.h
|
|||
|
||||
## end gnulib module alignof
|
||||
|
||||
## begin gnulib module alloca
|
||||
|
||||
|
||||
libgnu_la_LIBADD += @LTALLOCA@
|
||||
libgnu_la_DEPENDENCIES += @LTALLOCA@
|
||||
EXTRA_DIST += alloca.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += alloca.c
|
||||
|
||||
## end gnulib module alloca
|
||||
|
||||
## begin gnulib module alloca-opt
|
||||
|
||||
BUILT_SOURCES += $(ALLOCA_H)
|
||||
|
@ -371,6 +384,15 @@ EXTRA_DIST += dosname.h
|
|||
|
||||
## end gnulib module dosname
|
||||
|
||||
## begin gnulib module dup2
|
||||
|
||||
|
||||
EXTRA_DIST += dup2.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += dup2.c
|
||||
|
||||
## end gnulib module dup2
|
||||
|
||||
## begin gnulib module duplocale
|
||||
|
||||
|
||||
|
@ -556,6 +578,15 @@ EXTRA_libgnu_la_SOURCES += gai_strerror.c getaddrinfo.c
|
|||
|
||||
## end gnulib module getaddrinfo
|
||||
|
||||
## begin gnulib module getlogin
|
||||
|
||||
|
||||
EXTRA_DIST += getlogin.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += getlogin.c
|
||||
|
||||
## end gnulib module getlogin
|
||||
|
||||
## begin gnulib module getpeername
|
||||
|
||||
|
||||
|
@ -1006,6 +1037,7 @@ EXTRA_DIST += malloca.h malloca.valgrind
|
|||
## begin gnulib module math
|
||||
|
||||
BUILT_SOURCES += math.h
|
||||
libgnu_la_SOURCES += math.c
|
||||
|
||||
# We need the following in order to create <math.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
|
@ -1438,12 +1470,59 @@ EXTRA_DIST += pathmax.h
|
|||
|
||||
## end gnulib module pathmax
|
||||
|
||||
## begin gnulib module pipe-posix
|
||||
|
||||
|
||||
EXTRA_DIST += pipe.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += pipe.c
|
||||
|
||||
## end gnulib module pipe-posix
|
||||
|
||||
## begin gnulib module pipe2
|
||||
|
||||
libgnu_la_SOURCES += pipe2.c
|
||||
|
||||
## end gnulib module pipe2
|
||||
|
||||
## begin gnulib module poll
|
||||
|
||||
|
||||
EXTRA_DIST += poll.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += poll.c
|
||||
|
||||
## end gnulib module poll
|
||||
|
||||
## begin gnulib module poll-h
|
||||
|
||||
BUILT_SOURCES += poll.h
|
||||
|
||||
# We need the following in order to create <poll.h> when the system
|
||||
# doesn't have one.
|
||||
poll.h: poll.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_POLL_H''@|$(HAVE_POLL_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_POLL_H''@|$(NEXT_POLL_H)|g' \
|
||||
-e 's/@''GNULIB_POLL''@/$(GNULIB_POLL)/g' \
|
||||
-e 's|@''HAVE_POLL''@|$(HAVE_POLL)|g' \
|
||||
-e 's|@''REPLACE_POLL''@|$(REPLACE_POLL)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/poll.in.h; \
|
||||
} > $@-t && \
|
||||
mv -f $@-t $@
|
||||
MOSTLYCLEANFILES += poll.h poll.h-t
|
||||
|
||||
EXTRA_DIST += poll.in.h
|
||||
|
||||
## end gnulib module poll-h
|
||||
|
||||
## begin gnulib module putenv
|
||||
|
||||
|
||||
|
@ -1559,6 +1638,15 @@ EXTRA_DIST += same-inode.h
|
|||
|
||||
## end gnulib module same-inode
|
||||
|
||||
## begin gnulib module select
|
||||
|
||||
|
||||
EXTRA_DIST += select.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += select.c
|
||||
|
||||
## end gnulib module select
|
||||
|
||||
## begin gnulib module send
|
||||
|
||||
|
||||
|
@ -2093,6 +2181,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
|||
-e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
|
||||
-e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
|
||||
-e 's/@''GNULIB_RPMATCH''@/$(GNULIB_RPMATCH)/g' \
|
||||
-e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
|
||||
-e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
|
||||
-e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
|
||||
-e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
|
||||
|
@ -2121,6 +2210,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
|
|||
-e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
|
||||
-e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
|
||||
-e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
|
||||
-e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
|
||||
-e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
|
||||
-e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
|
||||
-e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
|
||||
|
@ -2311,9 +2401,44 @@ EXTRA_DIST += sys_file.in.h
|
|||
|
||||
## end gnulib module sys_file
|
||||
|
||||
## begin gnulib module sys_select
|
||||
|
||||
BUILT_SOURCES += sys/select.h
|
||||
|
||||
# We need the following in order to create <sys/select.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
|
||||
$(AM_V_at)$(MKDIR_P) sys
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|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_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
|
||||
-e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
|
||||
-e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \
|
||||
-e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \
|
||||
-e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
|
||||
-e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \
|
||||
-e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \
|
||||
-e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
|
||||
-e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/sys_select.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += sys/select.h sys/select.h-t
|
||||
MOSTLYCLEANDIRS += sys
|
||||
|
||||
EXTRA_DIST += sys_select.in.h
|
||||
|
||||
## end gnulib module sys_select
|
||||
|
||||
## begin gnulib module sys_socket
|
||||
|
||||
BUILT_SOURCES += sys/socket.h
|
||||
libgnu_la_SOURCES += sys_socket.c
|
||||
|
||||
# We need the following in order to create <sys/socket.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
|
@ -2458,6 +2583,37 @@ EXTRA_DIST += sys_time.in.h
|
|||
|
||||
## end gnulib module sys_time
|
||||
|
||||
## begin gnulib module sys_times
|
||||
|
||||
BUILT_SOURCES += sys/times.h
|
||||
|
||||
# We need the following in order to create <sys/times.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
sys/times.h: sys_times.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
|
||||
$(AM_V_at)$(MKDIR_P) sys
|
||||
$(AM_V_GEN)rm -f $@-t $@ && \
|
||||
{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
|
||||
sed -e 's|@''GUARD_PREFIX''@|GL|g' \
|
||||
-e 's/@''HAVE_SYS_TIMES_H''@/$(HAVE_SYS_TIMES_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_SYS_TIMES_H''@|$(NEXT_SYS_TIMES_H)|g' \
|
||||
-e 's/@''GNULIB_TIMES''@/$(GNULIB_TIMES)/g' \
|
||||
-e 's|@''HAVE_STRUCT_TMS''@|$(HAVE_STRUCT_TMS)|g' \
|
||||
-e 's|@''HAVE_TIMES''@|$(HAVE_TIMES)|g' \
|
||||
-e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
|
||||
-e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
|
||||
< $(srcdir)/sys_times.in.h; \
|
||||
} > $@-t && \
|
||||
mv $@-t $@
|
||||
MOSTLYCLEANFILES += sys/times.h sys/times.h-t
|
||||
MOSTLYCLEANDIRS += sys
|
||||
|
||||
EXTRA_DIST += sys_times.in.h
|
||||
|
||||
## end gnulib module sys_times
|
||||
|
||||
## begin gnulib module sys_types
|
||||
|
||||
BUILT_SOURCES += sys/types.h
|
||||
|
@ -2560,6 +2716,15 @@ EXTRA_libgnu_la_SOURCES += time_r.c
|
|||
|
||||
## end gnulib module time_r
|
||||
|
||||
## begin gnulib module times
|
||||
|
||||
|
||||
EXTRA_DIST += times.c
|
||||
|
||||
EXTRA_libgnu_la_SOURCES += times.c
|
||||
|
||||
## end gnulib module times
|
||||
|
||||
## begin gnulib module trunc
|
||||
|
||||
|
||||
|
@ -2572,6 +2737,7 @@ EXTRA_libgnu_la_SOURCES += trunc.c
|
|||
## begin gnulib module unistd
|
||||
|
||||
BUILT_SOURCES += unistd.h
|
||||
libgnu_la_SOURCES += unistd.c
|
||||
|
||||
# We need the following in order to create an empty placeholder for
|
||||
# <unistd.h> when the system doesn't have one.
|
||||
|
@ -2963,6 +3129,7 @@ EXTRA_libgnu_la_SOURCES += wcrtomb.c
|
|||
## begin gnulib module wctype-h
|
||||
|
||||
BUILT_SOURCES += wctype.h
|
||||
libgnu_la_SOURCES += wctype-h.c
|
||||
|
||||
# We need the following in order to create <wctype.h> when the system
|
||||
# doesn't have one that works with the given compiler.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* accept.c --- wrappers for Windows accept function
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Determine alignment of types.
|
||||
Copyright (C) 2003-2004, 2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2003-2004, 2006, 2009-2013 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
|
||||
|
|
478
lib/alloca.c
Normal file
478
lib/alloca.c
Normal file
|
@ -0,0 +1,478 @@
|
|||
/* alloca.c -- allocate automatically reclaimed memory
|
||||
(Mostly) portable public-domain implementation -- D A Gwyn
|
||||
|
||||
This implementation of the PWB library alloca function,
|
||||
which is used to allocate space off the run-time stack so
|
||||
that it is automatically reclaimed upon procedure exit,
|
||||
was inspired by discussions with J. Q. Johnson of Cornell.
|
||||
J.Otto Tennant <jot@cray.com> contributed the Cray support.
|
||||
|
||||
There are some preprocessor constants that can
|
||||
be defined when compiling for your specific system, for
|
||||
improved efficiency; however, the defaults should be okay.
|
||||
|
||||
The general concept of this implementation is to keep
|
||||
track of all alloca-allocated blocks, and reclaim any
|
||||
that are found to be deeper in the stack than the current
|
||||
invocation. This heuristic does not reclaim storage as
|
||||
soon as it becomes invalid, but it will do so eventually.
|
||||
|
||||
As a special case, alloca(0) reclaims storage without
|
||||
allocating any. It is a good idea to use alloca(0) in
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <alloca.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef emacs
|
||||
# include "lisp.h"
|
||||
# include "blockinput.h"
|
||||
# ifdef EMACS_FREE
|
||||
# undef free
|
||||
# define free EMACS_FREE
|
||||
# endif
|
||||
#else
|
||||
# define memory_full() abort ()
|
||||
#endif
|
||||
|
||||
/* If compiling with GCC 2, this file's not needed. */
|
||||
#if !defined (__GNUC__) || __GNUC__ < 2
|
||||
|
||||
/* If someone has defined alloca as a macro,
|
||||
there must be some other way alloca is supposed to work. */
|
||||
# ifndef alloca
|
||||
|
||||
# ifdef emacs
|
||||
# ifdef static
|
||||
/* actually, only want this if static is defined as ""
|
||||
-- this is for usg, in which emacs must undefine static
|
||||
in order to make unexec workable
|
||||
*/
|
||||
# ifndef STACK_DIRECTION
|
||||
you
|
||||
lose
|
||||
-- must know STACK_DIRECTION at compile-time
|
||||
/* Using #error here is not wise since this file should work for
|
||||
old and obscure compilers. */
|
||||
# endif /* STACK_DIRECTION undefined */
|
||||
# endif /* static */
|
||||
# endif /* emacs */
|
||||
|
||||
/* If your stack is a linked list of frames, you have to
|
||||
provide an "address metric" ADDRESS_FUNCTION macro. */
|
||||
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
long i00afunc ();
|
||||
# define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
|
||||
# else
|
||||
# define ADDRESS_FUNCTION(arg) &(arg)
|
||||
# endif
|
||||
|
||||
/* Define STACK_DIRECTION if you know the direction of stack
|
||||
growth for your system; otherwise it will be automatically
|
||||
deduced at run-time.
|
||||
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown */
|
||||
|
||||
# ifndef STACK_DIRECTION
|
||||
# define STACK_DIRECTION 0 /* Direction unknown. */
|
||||
# endif
|
||||
|
||||
# if STACK_DIRECTION != 0
|
||||
|
||||
# define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
|
||||
|
||||
# else /* STACK_DIRECTION == 0; need run-time code. */
|
||||
|
||||
static int stack_dir; /* 1 or -1 once known. */
|
||||
# define STACK_DIR stack_dir
|
||||
|
||||
static int
|
||||
find_stack_direction (int *addr, int depth)
|
||||
{
|
||||
int dir, dummy = 0;
|
||||
if (! addr)
|
||||
addr = &dummy;
|
||||
*addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
|
||||
dir = depth ? find_stack_direction (addr, depth - 1) : 0;
|
||||
return dir + dummy;
|
||||
}
|
||||
|
||||
# endif /* STACK_DIRECTION == 0 */
|
||||
|
||||
/* An "alloca header" is used to:
|
||||
(a) chain together all alloca'ed blocks;
|
||||
(b) keep track of stack depth.
|
||||
|
||||
It is very important that sizeof(header) agree with malloc
|
||||
alignment chunk size. The following default should work okay. */
|
||||
|
||||
# ifndef ALIGN_SIZE
|
||||
# define ALIGN_SIZE sizeof(double)
|
||||
# endif
|
||||
|
||||
typedef union hdr
|
||||
{
|
||||
char align[ALIGN_SIZE]; /* To force sizeof(header). */
|
||||
struct
|
||||
{
|
||||
union hdr *next; /* For chaining headers. */
|
||||
char *deep; /* For stack depth measure. */
|
||||
} h;
|
||||
} header;
|
||||
|
||||
static header *last_alloca_header = NULL; /* -> last alloca header. */
|
||||
|
||||
/* Return a pointer to at least SIZE bytes of storage,
|
||||
which will be automatically reclaimed upon exit from
|
||||
the procedure that called alloca. Originally, this space
|
||||
was supposed to be taken from the current stack frame of the
|
||||
caller, but that method cannot be made to work for some
|
||||
implementations of C, for example under Gould's UTX/32. */
|
||||
|
||||
void *
|
||||
alloca (size_t size)
|
||||
{
|
||||
auto char probe; /* Probes stack depth: */
|
||||
register char *depth = ADDRESS_FUNCTION (probe);
|
||||
|
||||
# if STACK_DIRECTION == 0
|
||||
if (STACK_DIR == 0) /* Unknown growth direction. */
|
||||
STACK_DIR = find_stack_direction (NULL, (size & 1) + 20);
|
||||
# endif
|
||||
|
||||
/* Reclaim garbage, defined as all alloca'd storage that
|
||||
was allocated from deeper in the stack than currently. */
|
||||
|
||||
{
|
||||
register header *hp; /* Traverses linked list. */
|
||||
|
||||
# ifdef emacs
|
||||
BLOCK_INPUT;
|
||||
# endif
|
||||
|
||||
for (hp = last_alloca_header; hp != NULL;)
|
||||
if ((STACK_DIR > 0 && hp->h.deep > depth)
|
||||
|| (STACK_DIR < 0 && hp->h.deep < depth))
|
||||
{
|
||||
register header *np = hp->h.next;
|
||||
|
||||
free (hp); /* Collect garbage. */
|
||||
|
||||
hp = np; /* -> next header. */
|
||||
}
|
||||
else
|
||||
break; /* Rest are not deeper. */
|
||||
|
||||
last_alloca_header = hp; /* -> last valid storage. */
|
||||
|
||||
# ifdef emacs
|
||||
UNBLOCK_INPUT;
|
||||
# endif
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
return NULL; /* No allocation required. */
|
||||
|
||||
/* Allocate combined header + user data storage. */
|
||||
|
||||
{
|
||||
/* Address of header. */
|
||||
register header *new;
|
||||
|
||||
size_t combined_size = sizeof (header) + size;
|
||||
if (combined_size < sizeof (header))
|
||||
memory_full ();
|
||||
|
||||
new = malloc (combined_size);
|
||||
|
||||
if (! new)
|
||||
memory_full ();
|
||||
|
||||
new->h.next = last_alloca_header;
|
||||
new->h.deep = depth;
|
||||
|
||||
last_alloca_header = new;
|
||||
|
||||
/* User storage begins just after header. */
|
||||
|
||||
return (void *) (new + 1);
|
||||
}
|
||||
}
|
||||
|
||||
# if defined (CRAY) && defined (CRAY_STACKSEG_END)
|
||||
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
# ifndef CRAY_STACK
|
||||
# define CRAY_STACK
|
||||
# ifndef CRAY2
|
||||
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
|
||||
struct stack_control_header
|
||||
{
|
||||
long shgrow:32; /* Number of times stack has grown. */
|
||||
long shaseg:32; /* Size of increments to stack. */
|
||||
long shhwm:32; /* High water mark of stack. */
|
||||
long shsize:32; /* Current size of stack (all segments). */
|
||||
};
|
||||
|
||||
/* The stack segment linkage control information occurs at
|
||||
the high-address end of a stack segment. (The stack
|
||||
grows from low addresses to high addresses.) The initial
|
||||
part of the stack segment linkage control information is
|
||||
0200 (octal) words. This provides for register storage
|
||||
for the routine which overflows the stack. */
|
||||
|
||||
struct stack_segment_linkage
|
||||
{
|
||||
long ss[0200]; /* 0200 overflow words. */
|
||||
long sssize:32; /* Number of words in this segment. */
|
||||
long ssbase:32; /* Offset to stack base. */
|
||||
long:32;
|
||||
long sspseg:32; /* Offset to linkage control of previous
|
||||
segment of stack. */
|
||||
long:32;
|
||||
long sstcpt:32; /* Pointer to task common address block. */
|
||||
long sscsnm; /* Private control structure number for
|
||||
microtasking. */
|
||||
long ssusr1; /* Reserved for user. */
|
||||
long ssusr2; /* Reserved for user. */
|
||||
long sstpid; /* Process ID for pid based multi-tasking. */
|
||||
long ssgvup; /* Pointer to multitasking thread giveup. */
|
||||
long sscray[7]; /* Reserved for Cray Research. */
|
||||
long ssa0;
|
||||
long ssa1;
|
||||
long ssa2;
|
||||
long ssa3;
|
||||
long ssa4;
|
||||
long ssa5;
|
||||
long ssa6;
|
||||
long ssa7;
|
||||
long sss0;
|
||||
long sss1;
|
||||
long sss2;
|
||||
long sss3;
|
||||
long sss4;
|
||||
long sss5;
|
||||
long sss6;
|
||||
long sss7;
|
||||
};
|
||||
|
||||
# else /* CRAY2 */
|
||||
/* The following structure defines the vector of words
|
||||
returned by the STKSTAT library routine. */
|
||||
struct stk_stat
|
||||
{
|
||||
long now; /* Current total stack size. */
|
||||
long maxc; /* Amount of contiguous space which would
|
||||
be required to satisfy the maximum
|
||||
stack demand to date. */
|
||||
long high_water; /* Stack high-water mark. */
|
||||
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
|
||||
long hits; /* Number of internal buffer hits. */
|
||||
long extends; /* Number of block extensions. */
|
||||
long stko_mallocs; /* Block allocations by $STKOFEN. */
|
||||
long underflows; /* Number of stack underflow calls ($STKRETN). */
|
||||
long stko_free; /* Number of deallocations by $STKRETN. */
|
||||
long stkm_free; /* Number of deallocations by $STKMRET. */
|
||||
long segments; /* Current number of stack segments. */
|
||||
long maxs; /* Maximum number of stack segments so far. */
|
||||
long pad_size; /* Stack pad size. */
|
||||
long current_address; /* Current stack segment address. */
|
||||
long current_size; /* Current stack segment size. This
|
||||
number is actually corrupted by STKSTAT to
|
||||
include the fifteen word trailer area. */
|
||||
long initial_address; /* Address of initial segment. */
|
||||
long initial_size; /* Size of initial segment. */
|
||||
};
|
||||
|
||||
/* The following structure describes the data structure which trails
|
||||
any stack segment. I think that the description in 'asdef' is
|
||||
out of date. I only describe the parts that I am sure about. */
|
||||
|
||||
struct stk_trailer
|
||||
{
|
||||
long this_address; /* Address of this block. */
|
||||
long this_size; /* Size of this block (does not include
|
||||
this trailer). */
|
||||
long unknown2;
|
||||
long unknown3;
|
||||
long link; /* Address of trailer block of previous
|
||||
segment. */
|
||||
long unknown5;
|
||||
long unknown6;
|
||||
long unknown7;
|
||||
long unknown8;
|
||||
long unknown9;
|
||||
long unknown10;
|
||||
long unknown11;
|
||||
long unknown12;
|
||||
long unknown13;
|
||||
long unknown14;
|
||||
};
|
||||
|
||||
# endif /* CRAY2 */
|
||||
# endif /* not CRAY_STACK */
|
||||
|
||||
# ifdef CRAY2
|
||||
/* Determine a "stack measure" for an arbitrary ADDRESS.
|
||||
I doubt that "lint" will like this much. */
|
||||
|
||||
static long
|
||||
i00afunc (long *address)
|
||||
{
|
||||
struct stk_stat status;
|
||||
struct stk_trailer *trailer;
|
||||
long *block, size;
|
||||
long result = 0;
|
||||
|
||||
/* We want to iterate through all of the segments. The first
|
||||
step is to get the stack status structure. We could do this
|
||||
more quickly and more directly, perhaps, by referencing the
|
||||
$LM00 common block, but I know that this works. */
|
||||
|
||||
STKSTAT (&status);
|
||||
|
||||
/* Set up the iteration. */
|
||||
|
||||
trailer = (struct stk_trailer *) (status.current_address
|
||||
+ status.current_size
|
||||
- 15);
|
||||
|
||||
/* There must be at least one stack segment. Therefore it is
|
||||
a fatal error if "trailer" is null. */
|
||||
|
||||
if (trailer == 0)
|
||||
abort ();
|
||||
|
||||
/* Discard segments that do not contain our argument address. */
|
||||
|
||||
while (trailer != 0)
|
||||
{
|
||||
block = (long *) trailer->this_address;
|
||||
size = trailer->this_size;
|
||||
if (block == 0 || size == 0)
|
||||
abort ();
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
if ((block <= address) && (address < (block + size)))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Set the result to the offset in this segment and add the sizes
|
||||
of all predecessor segments. */
|
||||
|
||||
result = address - block;
|
||||
|
||||
if (trailer == 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if (trailer->this_size <= 0)
|
||||
abort ();
|
||||
result += trailer->this_size;
|
||||
trailer = (struct stk_trailer *) trailer->link;
|
||||
}
|
||||
while (trailer != 0);
|
||||
|
||||
/* We are done. Note that if you present a bogus address (one
|
||||
not in any segment), you will get a different number back, formed
|
||||
from subtracting the address of the first block. This is probably
|
||||
not what you want. */
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
# else /* not CRAY2 */
|
||||
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
|
||||
Determine the number of the cell within the stack,
|
||||
given the address of the cell. The purpose of this
|
||||
routine is to linearize, in some sense, stack addresses
|
||||
for alloca. */
|
||||
|
||||
static long
|
||||
i00afunc (long address)
|
||||
{
|
||||
long stkl = 0;
|
||||
|
||||
long size, pseg, this_segment, stack;
|
||||
long result = 0;
|
||||
|
||||
struct stack_segment_linkage *ssptr;
|
||||
|
||||
/* Register B67 contains the address of the end of the
|
||||
current stack segment. If you (as a subprogram) store
|
||||
your registers on the stack and find that you are past
|
||||
the contents of B67, you have overflowed the segment.
|
||||
|
||||
B67 also points to the stack segment linkage control
|
||||
area, which is what we are really interested in. */
|
||||
|
||||
stkl = CRAY_STACKSEG_END ();
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
|
||||
/* If one subtracts 'size' from the end of the segment,
|
||||
one has the address of the first word of the segment.
|
||||
|
||||
If this is not the first segment, 'pseg' will be
|
||||
nonzero. */
|
||||
|
||||
pseg = ssptr->sspseg;
|
||||
size = ssptr->sssize;
|
||||
|
||||
this_segment = stkl - size;
|
||||
|
||||
/* It is possible that calling this routine itself caused
|
||||
a stack overflow. Discard stack segments which do not
|
||||
contain the target address. */
|
||||
|
||||
while (!(this_segment <= address && address <= stkl))
|
||||
{
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
|
||||
# endif
|
||||
if (pseg == 0)
|
||||
break;
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
this_segment = stkl - size;
|
||||
}
|
||||
|
||||
result = address - this_segment;
|
||||
|
||||
/* If you subtract pseg from the current end of the stack,
|
||||
you get the address of the previous stack segment's end.
|
||||
This seems a little convoluted to me, but I'll bet you save
|
||||
a cycle somewhere. */
|
||||
|
||||
while (pseg != 0)
|
||||
{
|
||||
# ifdef DEBUG_I00AFUNC
|
||||
fprintf (stderr, "%011o %011o\n", pseg, size);
|
||||
# endif
|
||||
stkl = stkl - pseg;
|
||||
ssptr = (struct stack_segment_linkage *) stkl;
|
||||
size = ssptr->sssize;
|
||||
pseg = ssptr->sspseg;
|
||||
result += size;
|
||||
}
|
||||
return (result);
|
||||
}
|
||||
|
||||
# endif /* not CRAY2 */
|
||||
# endif /* CRAY */
|
||||
|
||||
# endif /* no alloca */
|
||||
#endif /* not GCC 2 */
|
|
@ -1,6 +1,6 @@
|
|||
/* Memory allocation on the stack.
|
||||
|
||||
Copyright (C) 1995, 1999, 2001-2004, 2006-2012 Free Software Foundation,
|
||||
Copyright (C) 1995, 1999, 2001-2004, 2006-2013 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* A GNU-like <arpa/inet.h>.
|
||||
|
||||
Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005-2006, 2008-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Formatted output to strings.
|
||||
Copyright (C) 1999, 2002, 2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2002, 2006, 2009-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* basename.c -- return the last element in a file name
|
||||
|
||||
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2012 Free Software
|
||||
Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Binary mode I/O.
|
||||
Copyright (C) 2001, 2003, 2005, 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2003, 2005, 2008-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* bind.c --- wrappers for Windows bind function
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Convert unibyte character to wide character.
|
||||
Copyright (C) 2008, 2010-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008, 2010-2013 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2008.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* byteswap.h - Byte swapping
|
||||
Copyright (C) 2005, 2007, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2007, 2009-2013 Free Software Foundation, Inc.
|
||||
Written by Oskar Liljeblad <oskar@osk.mine.nu>, 2005.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Character handling in C locale.
|
||||
|
||||
Copyright 2000-2003, 2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright 2000-2003, 2006, 2009-2013 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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<ctype.h> functions' behaviour depends on the current locale set via
|
||||
setlocale.
|
||||
|
||||
Copyright (C) 2000-2003, 2006, 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2003, 2006, 2008-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Case-insensitive string comparison functions in C locale.
|
||||
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2012 Free Software
|
||||
Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* c-strcasecmp.c -- case insensitive string comparator in C locale
|
||||
Copyright (C) 1998-1999, 2005-2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-1999, 2005-2006, 2009-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Optimized case-insensitive string comparison in C locale.
|
||||
Copyright (C) 2001-2002, 2007, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001-2002, 2007, 2009-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* c-strncasecmp.c -- case insensitive string comparator in C locale
|
||||
Copyright (C) 1998-1999, 2005-2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998-1999, 2005-2006, 2009-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Return the canonical absolute name of a given file.
|
||||
Copyright (C) 1996-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996-2013 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
|
||||
|
@ -16,16 +16,16 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef _LIBC
|
||||
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||
optimizes away the name == NULL test below. */
|
||||
# define _GL_ARG_NONNULL(params)
|
||||
|
||||
# define _GL_USE_STDLIB_ALLOC 1
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if !HAVE_CANONICALIZE_FILE_NAME || !FUNC_REALPATH_WORKS || defined _LIBC
|
||||
|
||||
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||
optimizes away the name == NULL test below. */
|
||||
#define _GL_ARG_NONNULL(params)
|
||||
|
||||
/* Specification. */
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
|||
# define __realpath realpath
|
||||
# include "pathmax.h"
|
||||
# include "malloca.h"
|
||||
# include "dosname.h"
|
||||
# if HAVE_GETCWD
|
||||
# if IN_RELOCWRAPPER
|
||||
/* When building the relocatable program wrapper, use the system's getcwd
|
||||
|
@ -101,6 +102,7 @@ __realpath (const char *name, char *resolved)
|
|||
const char *start, *end, *rpath_limit;
|
||||
long int path_max;
|
||||
int num_links = 0;
|
||||
size_t prefix_len;
|
||||
|
||||
if (name == NULL)
|
||||
{
|
||||
|
@ -143,7 +145,11 @@ __realpath (const char *name, char *resolved)
|
|||
rpath = resolved;
|
||||
rpath_limit = rpath + path_max;
|
||||
|
||||
if (name[0] != '/')
|
||||
/* This is always zero for Posix hosts, but can be 2 for MS-Windows
|
||||
and MS-DOS X:/foo/bar file names. */
|
||||
prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
|
||||
|
||||
if (!IS_ABSOLUTE_FILE_NAME (name))
|
||||
{
|
||||
if (!__getcwd (rpath, path_max))
|
||||
{
|
||||
|
@ -151,20 +157,28 @@ __realpath (const char *name, char *resolved)
|
|||
goto error;
|
||||
}
|
||||
dest = strchr (rpath, '\0');
|
||||
start = name;
|
||||
prefix_len = FILE_SYSTEM_PREFIX_LEN (rpath);
|
||||
}
|
||||
else
|
||||
{
|
||||
rpath[0] = '/';
|
||||
dest = rpath + 1;
|
||||
dest = rpath;
|
||||
if (prefix_len)
|
||||
{
|
||||
memcpy (rpath, name, prefix_len);
|
||||
dest += prefix_len;
|
||||
}
|
||||
*dest++ = '/';
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
|
||||
{
|
||||
if (name[1] == '/' && name[2] != '/')
|
||||
if (ISSLASH (name[1]) && !ISSLASH (name[2]) && !prefix_len)
|
||||
*dest++ = '/';
|
||||
*dest = '\0';
|
||||
}
|
||||
start = name + prefix_len;
|
||||
}
|
||||
|
||||
for (start = end = name; *start; start = end)
|
||||
for (end = start; *start; start = end)
|
||||
{
|
||||
#ifdef _LIBC
|
||||
struct stat64 st;
|
||||
|
@ -174,11 +188,11 @@ __realpath (const char *name, char *resolved)
|
|||
int n;
|
||||
|
||||
/* Skip sequence of multiple path-separators. */
|
||||
while (*start == '/')
|
||||
while (ISSLASH (*start))
|
||||
++start;
|
||||
|
||||
/* Find end of path component. */
|
||||
for (end = start; *end && *end != '/'; ++end)
|
||||
for (end = start; *end && !ISSLASH (*end); ++end)
|
||||
/* Nothing. */;
|
||||
|
||||
if (end - start == 0)
|
||||
|
@ -188,17 +202,19 @@ __realpath (const char *name, char *resolved)
|
|||
else if (end - start == 2 && start[0] == '.' && start[1] == '.')
|
||||
{
|
||||
/* Back up to previous component, ignore if at root already. */
|
||||
if (dest > rpath + 1)
|
||||
while ((--dest)[-1] != '/');
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
|
||||
&& *dest == '/' && dest[1] != '/')
|
||||
if (dest > rpath + prefix_len + 1)
|
||||
for (--dest; dest > rpath && !ISSLASH (dest[-1]); --dest)
|
||||
continue;
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT
|
||||
&& dest == rpath + 1 && !prefix_len
|
||||
&& ISSLASH (*dest) && !ISSLASH (dest[1]))
|
||||
dest++;
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t new_size;
|
||||
|
||||
if (dest[-1] != '/')
|
||||
if (!ISSLASH (dest[-1]))
|
||||
*dest++ = '/';
|
||||
|
||||
if (dest + (end - start) >= rpath_limit)
|
||||
|
@ -209,7 +225,7 @@ __realpath (const char *name, char *resolved)
|
|||
if (resolved)
|
||||
{
|
||||
__set_errno (ENAMETOOLONG);
|
||||
if (dest > rpath + 1)
|
||||
if (dest > rpath + prefix_len + 1)
|
||||
dest--;
|
||||
*dest = '\0';
|
||||
goto error;
|
||||
|
@ -299,24 +315,32 @@ __realpath (const char *name, char *resolved)
|
|||
memmove (&extra_buf[n], end, len + 1);
|
||||
name = end = memcpy (extra_buf, buf, n);
|
||||
|
||||
if (buf[0] == '/')
|
||||
if (IS_ABSOLUTE_FILE_NAME (buf))
|
||||
{
|
||||
dest = rpath + 1; /* It's an absolute symlink */
|
||||
size_t pfxlen = FILE_SYSTEM_PREFIX_LEN (buf);
|
||||
|
||||
if (pfxlen)
|
||||
memcpy (rpath, buf, pfxlen);
|
||||
dest = rpath + pfxlen;
|
||||
*dest++ = '/'; /* It's an absolute symlink */
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT)
|
||||
{
|
||||
if (buf[1] == '/' && buf[2] != '/')
|
||||
if (ISSLASH (buf[1]) && !ISSLASH (buf[2]) && !pfxlen)
|
||||
*dest++ = '/';
|
||||
*dest = '\0';
|
||||
}
|
||||
/* Install the new prefix to be in effect hereafter. */
|
||||
prefix_len = pfxlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Back up to previous component, ignore if at root
|
||||
already: */
|
||||
if (dest > rpath + 1)
|
||||
while ((--dest)[-1] != '/');
|
||||
if (dest > rpath + prefix_len + 1)
|
||||
for (--dest; dest > rpath && !ISSLASH (dest[-1]); --dest)
|
||||
continue;
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
|
||||
&& *dest == '/' && dest[1] != '/')
|
||||
&& ISSLASH (*dest) && !ISSLASH (dest[1]) && !prefix_len)
|
||||
dest++;
|
||||
}
|
||||
}
|
||||
|
@ -327,10 +351,10 @@ __realpath (const char *name, char *resolved)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (dest > rpath + 1 && dest[-1] == '/')
|
||||
if (dest > rpath + prefix_len + 1 && ISSLASH (dest[-1]))
|
||||
--dest;
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1
|
||||
&& *dest == '/' && dest[1] != '/')
|
||||
if (DOUBLE_SLASH_IS_DISTINCT_ROOT && dest == rpath + 1 && !prefix_len
|
||||
&& ISSLASH (*dest) && !ISSLASH (dest[1]))
|
||||
dest++;
|
||||
*dest = '\0';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Round towards positive infinity.
|
||||
Copyright (C) 2007, 2010-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007, 2010-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* close replacement.
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#! /bin/sh
|
||||
# Output a system dependent table of character encoding aliases.
|
||||
#
|
||||
# Copyright (C) 2000-2004, 2006-2012 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2000-2004, 2006-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* connect.c --- wrappers for Windows connect function
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* A GNU-like <dirent.h>.
|
||||
Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* dirfd.c -- return the file descriptor associated with an open DIR*
|
||||
|
||||
Copyright (C) 2001, 2006, 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2001, 2006, 2008-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* dirname.c -- return all but the last element in a file name
|
||||
|
||||
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2012 Free Software
|
||||
Copyright (C) 1990, 1998, 2000-2001, 2003-2006, 2009-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Take file names apart into directory and base names.
|
||||
|
||||
Copyright (C) 1998, 2001, 2003-2006, 2009-2012 Free Software Foundation,
|
||||
Copyright (C) 1998, 2001, 2003-2006, 2009-2013 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* File names on MS-DOS/Windows systems.
|
||||
|
||||
Copyright (C) 2000-2001, 2004-2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2000-2001, 2004-2006, 2009-2013 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
|
||||
|
|
160
lib/dup2.c
Normal file
160
lib/dup2.c
Normal file
|
@ -0,0 +1,160 @@
|
|||
/* Duplicate an open file descriptor to a specified file descriptor.
|
||||
|
||||
Copyright (C) 1999, 2004-2007, 2009-2013 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 Paul Eggert */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#if HAVE_DUP2
|
||||
|
||||
# undef dup2
|
||||
|
||||
# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
|
||||
/* Get declarations of the native Windows API functions. */
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
|
||||
# include "msvc-inval.h"
|
||||
|
||||
/* Get _get_osfhandle. */
|
||||
# include "msvc-nothrow.h"
|
||||
|
||||
static int
|
||||
ms_windows_dup2 (int fd, int desired_fd)
|
||||
{
|
||||
int result;
|
||||
|
||||
/* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open,
|
||||
dup2 (fd, fd) returns 0, but all further attempts to use fd in
|
||||
future dup2 calls will hang. */
|
||||
if (fd == desired_fd)
|
||||
{
|
||||
if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
/* Wine 1.0.1 return 0 when desired_fd is negative but not -1:
|
||||
http://bugs.winehq.org/show_bug.cgi?id=21289 */
|
||||
if (desired_fd < 0)
|
||||
{
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
TRY_MSVC_INVAL
|
||||
{
|
||||
result = dup2 (fd, desired_fd);
|
||||
}
|
||||
CATCH_MSVC_INVAL
|
||||
{
|
||||
errno = EBADF;
|
||||
result = -1;
|
||||
}
|
||||
DONE_MSVC_INVAL;
|
||||
|
||||
if (result == 0)
|
||||
result = desired_fd;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
# define dup2 ms_windows_dup2
|
||||
|
||||
# endif
|
||||
|
||||
int
|
||||
rpl_dup2 (int fd, int desired_fd)
|
||||
{
|
||||
int result;
|
||||
|
||||
# ifdef F_GETFL
|
||||
/* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF.
|
||||
On Cygwin 1.5.x, dup2 (1, 1) returns 0.
|
||||
On Cygwin 1.7.17, dup2 (1, -1) dumps core.
|
||||
On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */
|
||||
if (desired_fd < 0)
|
||||
fd = desired_fd;
|
||||
if (fd == desired_fd)
|
||||
return fcntl (fd, F_GETFL) == -1 ? -1 : fd;
|
||||
# endif
|
||||
|
||||
result = dup2 (fd, desired_fd);
|
||||
|
||||
/* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */
|
||||
if (result == -1 && errno == EMFILE)
|
||||
errno = EBADF;
|
||||
# if REPLACE_FCHDIR
|
||||
if (fd != desired_fd && result != -1)
|
||||
result = _gl_register_dup (fd, result);
|
||||
# endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#else /* !HAVE_DUP2 */
|
||||
|
||||
/* On older platforms, dup2 did not exist. */
|
||||
|
||||
# ifndef F_DUPFD
|
||||
static int
|
||||
dupfd (int fd, int desired_fd)
|
||||
{
|
||||
int duplicated_fd = dup (fd);
|
||||
if (duplicated_fd < 0 || duplicated_fd == desired_fd)
|
||||
return duplicated_fd;
|
||||
else
|
||||
{
|
||||
int r = dupfd (fd, desired_fd);
|
||||
int e = errno;
|
||||
close (duplicated_fd);
|
||||
errno = e;
|
||||
return r;
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
int
|
||||
dup2 (int fd, int desired_fd)
|
||||
{
|
||||
int result = fcntl (fd, F_GETFL) < 0 ? -1 : fd;
|
||||
if (result == -1 || fd == desired_fd)
|
||||
return result;
|
||||
close (desired_fd);
|
||||
# ifdef F_DUPFD
|
||||
result = fcntl (fd, F_DUPFD, desired_fd);
|
||||
# if REPLACE_FCHDIR
|
||||
if (0 <= result)
|
||||
result = _gl_register_dup (fd, result);
|
||||
# endif
|
||||
# else
|
||||
result = dupfd (fd, desired_fd);
|
||||
# endif
|
||||
if (result == -1 && (errno == EMFILE || errno == EINVAL))
|
||||
errno = EBADF;
|
||||
return result;
|
||||
}
|
||||
#endif /* !HAVE_DUP2 */
|
|
@ -1,5 +1,5 @@
|
|||
/* Duplicate a locale object.
|
||||
Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* A POSIX-like <errno.h>.
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* Like <fcntl.h>, but with non-working flags defined to 0.
|
||||
|
||||
Copyright (C) 2006-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Hook for making making file descriptor functions close(), ioctl() extensible.
|
||||
Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2013 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2009.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Hook for making making file descriptor functions close(), ioctl() extensible.
|
||||
Copyright (C) 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2009-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Supplemental information about the floating-point formats.
|
||||
Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007, 2009-2013 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2007.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Auxiliary definitions for <float.h>.
|
||||
Copyright (C) 2011-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2011.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* A correct <float.h>.
|
||||
|
||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2013 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
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Written by Richard W.M. Jones <rjones.at.redhat.com>
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 Free Software Foundation, Inc.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Round towards negative infinity.
|
||||
Copyright (C) 2007, 2010-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007, 2010-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Split a double into fraction and mantissa.
|
||||
Copyright (C) 2007-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2007-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* fstat() replacement.
|
||||
Copyright (C) 2011-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2011-2013 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
|
||||
|
@ -31,7 +31,7 @@
|
|||
#endif
|
||||
#undef __need_system_sys_stat_h
|
||||
|
||||
static inline int
|
||||
static int
|
||||
orig_fstat (int fd, struct stat *buf)
|
||||
{
|
||||
return fstat (fd, buf);
|
||||
|
@ -51,7 +51,7 @@ orig_fstat (int fd, struct stat *buf)
|
|||
#endif
|
||||
|
||||
#if HAVE_MSVC_INVALID_PARAMETER_HANDLER
|
||||
static inline int
|
||||
static int
|
||||
fstat_nothrow (int fd, struct stat *buf)
|
||||
{
|
||||
int result;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* An interface to read that retries after partial reads and interrupts.
|
||||
Copyright (C) 2002-2003, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2009-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* An interface to read() that reads all it is asked to read.
|
||||
|
||||
Copyright (C) 2002, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002, 2009-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* An interface to read and write that retries (if necessary) until complete.
|
||||
|
||||
Copyright (C) 1993-1994, 1997-2006, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993-1994, 1997-2006, 2009-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* An interface to write() that writes all it is asked to write.
|
||||
|
||||
Copyright (C) 2002-2003, 2009-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2002-2003, 2009-2013 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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2012 Free Software
|
||||
/* Copyright (C) 1997, 2001-2002, 2004-2006, 2008-2013 Free Software
|
||||
Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Philip Blundell <pjb27@cam.ac.uk>, 1997.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Get address information (partial implementation).
|
||||
Copyright (C) 1997, 2001-2002, 2004-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2001-2002, 2004-2013 Free Software Foundation, Inc.
|
||||
Contributed by Simon Josefsson <simon@josefsson.org>.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
@ -15,12 +15,12 @@
|
|||
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>
|
||||
|
||||
/* Don't use __attribute__ __nonnull__ in this compilation unit. Otherwise gcc
|
||||
optimizes away the sa == NULL test below. */
|
||||
#define _GL_ARG_NONNULL(params)
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <netdb.h>
|
||||
|
||||
#if HAVE_NETINET_IN_H
|
||||
|
@ -109,7 +109,7 @@ use_win32_p (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline bool
|
||||
static bool
|
||||
validate_family (int family)
|
||||
{
|
||||
/* FIXME: Support more families. */
|
||||
|
|
41
lib/getlogin.c
Normal file
41
lib/getlogin.c
Normal file
|
@ -0,0 +1,41 @@
|
|||
/* Provide a working getlogin for systems which lack it.
|
||||
|
||||
Copyright (C) 2010-2013 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, 2010. */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* Specification. */
|
||||
#include <unistd.h>
|
||||
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
char *
|
||||
getlogin (void)
|
||||
{
|
||||
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
|
||||
static char login_name[1024];
|
||||
DWORD sz = sizeof (login_name);
|
||||
|
||||
if (GetUserName (login_name, &sz))
|
||||
return login_name;
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/* getpeername.c --- wrappers for Windows getpeername function
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* getsockname.c --- wrappers for Windows getsockname function
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* getsockopt.c --- wrappers for Windows getsockopt function
|
||||
|
||||
Copyright (C) 2008-2012 Free Software Foundation, Inc.
|
||||
Copyright (C) 2008-2013 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
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* Convenience header for conditional use of GNU <libintl.h>.
|
||||
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2012 Free Software
|
||||
Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2013 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
|
|
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