1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-01 20:30:28 +02:00

Merge branch 'master' into boehm-demers-weiser-gc

Conflicts:
	lib/Makefile.am
	libguile/Makefile.am
	libguile/frames.c
	libguile/gc-card.c
	libguile/gc-freelist.c
	libguile/gc-mark.c
	libguile/gc-segment.c
	libguile/gc_os_dep.c
	libguile/load.c
	libguile/macros.c
	libguile/objcodes.c
	libguile/programs.c
	libguile/strings.c
	libguile/vm.c
	m4/gnulib-cache.m4
	m4/gnulib-comp.m4
	m4/inline.m4
This commit is contained in:
Ludovic Courtès 2009-08-17 23:39:56 +02:00
commit fbb857a472
823 changed files with 61674 additions and 14111 deletions

43
.gitignore vendored
View file

@ -53,7 +53,6 @@ conftest.c
depcomp
elisp-comp
guile-*.tar.gz
guile-tools
install-sh
libtool
ltconfig
@ -70,10 +69,48 @@ guile-readline/guile-readline-config.h
guile-readline/guile-readline-config.h.in
*.go
TAGS
guile-1.8.pc
/meta/guile-2.0.pc
/meta/guile-2.0-uninstalled.pc
gdb-pre-inst-guile
libguile/stack-limit-calibration.scm
cscope.out
cscope.files
*.log
INSTALL
*.aux
*.cp
*.cps
*.dvi
*.fn
*.fns
*.ky
*.pg
*.toc
*.tp
*.vr
*.tps
*.vrs
*.pgs
*.rn
*.rns
/meta/gdb-uninstalled-guile
/meta/guile
/meta/uninstalled-env
/examples/box-module/box
/examples/box/box
/lib/alloca.h
/lib/charset.alias
/lib/configmake.h
/lib/ref-add.sed
/lib/ref-del.sed
/lib/stdlib.h
/lib/string.h
/lib/strings.h
/lib/sys/file.h
/lib/time.h
/lib/unistd.h
/lib/unistr/.dirstamp
/GPATH
/GRTAGS
/GSYMS
/GTAGS
/meta/guile-tools

View file

@ -30,7 +30,7 @@ The NEWS file is quite long. Here are the most interesting entries:
from threads that have not been created by Guile.
* Mutexes and condition variables are now always fair. A recursive
mutex must be requested explicitely.
mutex must be requested explicitly.
* The low-level thread API has been removed.

674
COPYING Normal file
View file

@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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
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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,504 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Version 3, 29 June 2007
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
0. Additional Definitions.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
1. Exception to Section 3 of the GNU GPL.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
2. Conveying Modified Versions.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3. Object Code Incorporating Material from Library Header Files.
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
b) Accompany the object code with a copy of the GNU GPL and this license
document.
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
4. Combined Works.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

19
FAQ
View file

@ -1,19 +0,0 @@
Guile FAQ -*- outline -*-
* Build problems
** readline.c: error: `rl_pending_input' undeclared
This occurs if the Readline library detected by Guile's configure
script is actually the BSD Editline project's supposedly
Readline-compatible library. The immediate fix is to uninstall
Editline and install the real GNU Readline instead. When you do this,
please note that it probably won't work to keep Editline in /usr and
install GNU Readline in /usr/local (or some similar arrangement),
because the Editline library will then still be picked up at link and
run time; it's best (subject to other constraints) to remove Editline
completely.
For the longer term, please also report this problem to the Editline
project, to encourage them to fix it in the next release of their
Readline compatibility library.

View file

@ -2,7 +2,7 @@
GUILE_MAJOR_VERSION=1
GUILE_MINOR_VERSION=9
GUILE_MICRO_VERSION=0
GUILE_MICRO_VERSION=2
GUILE_EFFECTIVE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}
GUILE_VERSION=${GUILE_EFFECTIVE_VERSION}.${GUILE_MICRO_VERSION}-bdwgc

View file

@ -59,8 +59,9 @@ Automake --- a system for automatically generating Makefiles that
libtool --- a system for managing the zillion hairy options needed
on various systems to produce shared libraries. Available in
"ftp://ftp.gnu.org/pub/gnu/libtool". Version 1.5.26 (or
later) is needed for correct AIX support.
"ftp://ftp.gnu.org/pub/gnu/libtool". Version 2.2 (or
later) is recommended (for correct AIX support, and correct
interaction with the Gnulib module for using libunistring).
gettext --- a system for rigging a program so that it can output its
messages in the local tongue. Guile presently only exports
@ -88,6 +89,10 @@ have been known to cause problems, and a short description of the problem.
- autoreconf from autoconf prior to 2.59 will run gettextize, which
will mess up the Guile tree.
- libtool 1.5.26 does not know that it should remove the -R options
that the Gnulib libunistring and havelib modules generate (because
gcc doesn't actually support -R).
- (add here.)

View file

@ -1,2 +1,2 @@
Guile is covered under the terms of the GNU Lesser General Public
License, version 2.1. See COPYING.LESSER.
License, version 3 or later. See COPYING.LESSER and COPYING.

View file

@ -1,39 +1,37 @@
## Process this file with automake to produce Makefile.in.
##
## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007, 2008 Free Software Foundation, Inc.
## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
# want automake 1.10 or higher so that AM_GNU_GETTEXT can tell automake that
# config.rpath is needed
#
AUTOMAKE_OPTIONS = 1.10
SUBDIRS = lib libguile guile-config guile-readline emacs \
scripts srfi doc examples test-suite benchmark-suite lang am \
SUBDIRS = lib meta libguile guile-readline emacs \
srfi doc examples test-suite benchmark-suite lang am \
module testsuite
bin_SCRIPTS = guile-tools
include_HEADERS = libguile.h
EXTRA_DIST = LICENSE HACKING GUILE-VERSION \
m4/ChangeLog-2008 FAQ guile-1.8.pc.in \
m4/ChangeLog-2008 \
m4/autobuild.m4 ChangeLog-2008
TESTS = check-guile
@ -42,7 +40,16 @@ ACLOCAL_AMFLAGS = -I m4
DISTCLEANFILES = check-guile.log
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = guile-1.8.pc
dist-hook: gen-ChangeLog
gen_start_rev = 61db429e251bfd2f75cb4632972e0238056eb24b
.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
$(gen_start_rev)..HEAD > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
# Makefile.am ends here

666
NEWS
View file

@ -5,29 +5,602 @@ See the end for copying conditions.
Please send Guile bug reports to bug-guile@gnu.org.
Changes in 1.9.0:
(During the 1.9 series, we will keep an incremental NEWS for the latest
prerelease, and a full NEWS corresponding to 1.8 -> 2.0.)
Changes in 1.9.2 (since the 1.9.1 prerelease):
** VM speed improvements
Closures now copy the free variables that they need into a flat vector
instead of capturing all heap-allocated variables. This speeds up access
to free variables, avoids unnecessary garbage retention, and allows all
variables to be allocated on the stack.
Variables which are `set!' are now allocated on the stack, but in
"boxes". This allows a more uniform local variable allocation
discipline, and allows faster access to these variables.
The VM has new special-case operations, `add1' and `sub1'.
** VM robustness improvements
The maximum number of live local variables has been increased from 256
to 65535.
The default VM stack size is 64 kilo-words, up from 16 kilo-words. This
allows more programs to execute in the default stack space. In the
future we will probably implement extensible stacks via overflow
handlers.
Some lingering cases in which the VM could perform unaligned accesses
have been fixed.
The address range for relative jumps has been expanded from 16-bit
addresses to 19-bit addresses via 8-byte alignment of jump targets. This
will probably change to a 24-bit byte-addressable strategy before Guile
2.0.
** Compiler optimizations
Procedures bound by `letrec' are no longer allocated on the heap,
subject to a few constraints. In many cases, procedures bound by
`letrec' and `let' can be rendered inline to their parent function, with
loop detection for mutually tail-recursive procedures.
Unreferenced variables are now optimized away.
** Compiler robustness
Guile may now warn about unused lexically-bound variables. Pass
`-Wunused-variable' to `guile-tools compile', or `#:warnings
(unused-variable)' within the #:opts argument to the `compile' procedure
from `(system base compile)'.
** Incomplete support for Unicode characters and strings
Preliminary support for Unicode has landed. Characters may be entered in
octal format via e.g. `#\454', or created via (integer->char 300). A hex
external representation will probably be introduced at some point.
Internally, strings are now represented either in the `latin-1'
encoding, one byte per character, or in UTF-32, with four bytes per
character. Strings manage their own allocation, switching if needed.
Currently no locale conversion is performed. Extended characters may be
written in a string using the hexadecimal escapes `\xXX', `\uXXXX', or
`\UXXXXXX', for 8-bit, 16-bit, or 24-bit codepoints, respectively.
This support is obviously incomplete. Many C functions have not yet been
updated to deal with the new representations. Users are advised to wait
for the next release for more serious use of Unicode strings.
** `defined?' may accept a module as its second argument
Previously it only accepted internal structures from the evaluator.
** `let-values' is now implemented with a hygienic macro
This could have implications discussed below in the NEWS entry titled,
"Lexical bindings introduced by hygienic macros may not be referenced by
nonhygienic macros".
** Global variables `scm_charnames' and `scm_charnums' are removed
These variables contained the names of control characters and were
used when writing characters. While these were global, they were
never intended to be public API. They have been replaced with private
functions.
** EBCDIC support is removed
There was an EBCDIC compile flag that altered some of the character
processing. It appeared that full EBCDIC support was never completed
and was unmaintained.
** Packaging changes
Guile now provides `guile-2.0.pc' (used by pkg-config) instead of
`guile-1.8.pc'.
** And of course, the usual collection of bugfixes
Interested users should see the ChangeLog for more information.
Changes in 1.9.x (since the 1.8.x series):
* New modules (see the manual for details)
** `(srfi srfi-18)', multithreading support
** The `(ice-9 i18n)' module provides internationalization support
* Changes to the distribution
** Guile now uses Gnulib as a portability aid
** `(srfi srfi-18)', more sophisticated multithreading support
** `(ice-9 i18n)', internationalization support
** `(rnrs bytevector)', the R6RS bytevector API
** `(rnrs io ports)', a subset of the R6RS I/O port API
** `(system xref)', a cross-referencing facility (FIXME undocumented)
* Changes to the stand-alone interpreter
** Guile now can compile Scheme to bytecode for a custom virtual machine.
Compiled code loads much faster than Scheme source code, and runs around
3 or 4 times as fast, generating much less garbage in the process.
** The stack limit is now initialized from the environment.
If getrlimit(2) is available and a stack limit is set, Guile will set
its stack limit to 80% of the rlimit. Otherwise the limit is 160000
words, a four-fold increase from the earlier default limit.
** New environment variables: GUILE_LOAD_COMPILED_PATH,
GUILE_SYSTEM_LOAD_COMPILED_PATH
GUILE_LOAD_COMPILED_PATH is for compiled files what GUILE_LOAD_PATH is
for source files. It is a different path, however, because compiled
files are architecture-specific. GUILE_SYSTEM_LOAD_COMPILED_PATH is like
GUILE_SYSTEM_PATH.
** New read-eval-print loop (REPL) implementation
Running Guile with no arguments drops the user into the new REPL. While
it is self-documenting to an extent, the new REPL has not yet been
documented in the manual. This will be fixed before 2.0.
** New `guile-tools' commands: `compile', `disassemble'
Pass the `--help' command-line option to these commands for more
information.
* Changes to Scheme functions and syntax
** A new 'memoize-symbol evaluator trap has been added. This trap can
be used for efficiently implementing a Scheme code coverage.
** Procedure removed: `the-environment'
This procedure was part of the interpreter's execution model, and does
not apply to the compiler.
** Files loaded with `primitive-load-path' will now be compiled
automatically.
If a compiled .go file corresponding to a .scm file is not found or is
not fresh, the .scm file will be compiled on the fly, and the resulting
.go file stored away. An advisory note will be printed on the console.
Note that this mechanism depends on preservation of the .scm and .go
modification times; if the .scm or .go files are moved after
installation, care should be taken to preserve their original
timestamps.
Autocompiled files will be stored in the $XDG_CACHE_HOME/guile/ccache
directory, where $XDG_CACHE_HOME defaults to ~/.cache. This directory
will be created if needed.
To inhibit autocompilation, set the GUILE_AUTO_COMPILE environment
variable to 0, or pass --no-autocompile on the Guile command line.
Note that there is currently a bug here: automatic compilation will
sometimes be attempted when it shouldn't.
For example, the old (lang elisp) modules are meant to be interpreted,
not compiled. This bug will be fixed before 2.0. FIXME 2.0: Should say
something here about module-transformer called for compile.
** New POSIX procedures: `getrlimit' and `setrlimit'
Note however that the interface of these functions is likely to change
in the next prerelease.
** New procedure in `(oops goops)': `method-formals'
** BUG: (procedure-property func 'arity) does not work on compiled
procedures
This will be fixed one way or another before 2.0.
** New procedures in (ice-9 session): `add-value-help-handler!',
`remove-value-help-handler!', `add-name-help-handler!'
`remove-name-help-handler!', `procedure-arguments',
The value and name help handlers provide some minimal extensibility to
the help interface. Guile-lib's `(texinfo reflection)' uses them, for
example, to make stexinfo help documentation available. See those
procedures' docstrings for more information.
`procedure-arguments' describes the arguments that a procedure can take,
combining arity and formals. For example:
(procedure-arguments resolve-interface)
=> ((required . (name)) (rest . args))
Additionally, `module-commentary' is now publically exported from
`(ice-9 session).
** Deprecated: `procedure->memoizing-macro', `procedure->syntax'
These procedures will not work with syncase expansion, and indeed are
not used in the normal course of Guile. They are still used by the old
Emacs Lisp support, however.
** New language: ECMAScript
Guile now ships with one other high-level language supported,
ECMAScript. The goal is to support all of version 3.1 of the standard,
but not all of the libraries are there yet. This support is not yet
documented; ask on the mailing list if you are interested.
** New language: Brainfuck
Brainfuck is a toy language that closely models Turing machines. Guile's
brainfuck compiler is meant to be an example of implementing other
languages. See the manual for details, or
http://en.wikipedia.org/wiki/Brainfuck for more information about the
Brainfuck language itself.
** Defmacros may now have docstrings.
Indeed, any macro may have a docstring. `object-documentation' from
`(ice-9 documentation)' may be used to retrieve the docstring, once you
have a macro value -- but see the above note about first-class macros.
Docstrings are associated with the syntax transformer procedures.
** The psyntax expander now knows how to interpret the @ and @@ special
forms.
** The psyntax expander is now hygienic with respect to modules.
Free variables in a macro are scoped in the module that the macro was
defined in, not in the module the macro is used in. For example, code
like this works now:
(define-module (foo) #:export (bar))
(define (helper x) ...)
(define-syntax bar
(syntax-rules () ((_ x) (helper x))))
(define-module (baz) #:use-module (foo))
(bar qux)
It used to be you had to export `helper' from `(foo)' as well.
Thankfully, this has been fixed.
** New function, `procedure-module'
While useful on its own, `procedure-module' is used by psyntax on syntax
transformers to determine the module in which to scope introduced
identifiers.
** `eval-case' has been deprecated, and replaced by `eval-when'.
The semantics of `eval-when' are easier to understand. It is still
missing documentation, however.
** Guile is now more strict about prohibiting definitions in expression
contexts.
Although previous versions of Guile accepted it, the following
expression is not valid, in R5RS or R6RS:
(if test (define foo 'bar) (define foo 'baz))
In this specific case, it would be better to do:
(define foo (if test 'bar 'baz))
It is certainly possible to circumvent this resriction with e.g.
`(module-define! (current-module) 'foo 'baz)'. We would appreciate
feedback about this change (a consequence of using psyntax as the
default expander), and may choose to revisit this situation before 2.0
in response to user feedback.
** Defmacros must now produce valid Scheme expressions.
It used to be that defmacros could unquote in Scheme values, as a way of
supporting partial evaluation, and avoiding some hygiene issues. For
example:
(define (helper x) ...)
(define-macro (foo bar)
`(,helper ,bar))
Assuming this macro is in the `(baz)' module, the direct translation of
this code would be:
(define (helper x) ...)
(define-macro (foo bar)
`((@@ (baz) helper) ,bar))
Of course, one could just use a hygienic macro instead:
(define-syntax foo
(syntax-rules ()
((_ bar) (helper bar))))
** Guile's psyntax now supports docstrings and internal definitions.
The following Scheme is not strictly legal:
(define (foo)
"bar"
(define (baz) ...)
(baz))
However its intent is fairly clear. Guile interprets "bar" to be the
docstring of `foo', and the definition of `baz' is still in definition
context.
** Macros need to be defined before their first use.
It used to be that with lazy memoization, this might work:
(define (foo x)
(ref x))
(define-macro (ref x) x)
(foo 1) => 1
But now, the body of `foo' is interpreted to mean a call to the toplevel
`ref' function, instead of a macro expansion. The solution is to define
macros before code that uses them.
** Functions needed by macros at expand-time need to be present at
expand-time.
For example, this code will work at the REPL:
(define (double-helper x) (* x x))
(define-macro (double-literal x) (double-helper x))
(double-literal 2) => 4
But it will not work when a file is compiled, because the definition of
`double-helper' is not present at expand-time. The solution is to wrap
the definition of `double-helper' in `eval-when':
(eval-when (load compile eval)
(define (double-helper x) (* x x)))
(define-macro (double-literal x) (double-helper x))
(double-literal 2) => 4
See the (currently missing) documentation for eval-when for more
information.
** New variable, %pre-modules-transformer
Need to document this one some more.
** Temporarily removed functions: `macroexpand', `macroexpand-1'
`macroexpand' will be added back before 2.0. It is unclear how to
implement `macroexpand-1' with syntax-case, though PLT Scheme does prove
that it is possible.
** New reader macros: #' #` #, #,@
These macros translate, respectively, to `syntax', `quasisyntax',
`unsyntax', and `unsyntax-splicing'. See the R6RS for more information.
These reader macros may be overridden by `read-hash-extend'.
** Incompatible change to #'
Guile did have a #' hash-extension, by default, which just returned the
subsequent datum: #'foo => foo. In the unlikely event that anyone
actually used this, this behavior may be reinstated via the
`read-hash-extend' mechanism.
** Scheme expresssions may be commented out with #;
#; comments out an entire expression. See SRFI-62 or the R6RS for more
information.
** `make-stack' with a tail-called procedural narrowing argument no longer
works (with compiled procedures)
It used to be the case that a captured stack could be narrowed to select
calls only up to or from a certain procedure, even if that procedure
already tail-called another procedure. This was because the debug
information from the original procedure was kept on the stack.
Now with the new compiler, the stack only contains active frames from
the current continuation. A narrow to a procedure that is not in the
stack will result in an empty stack. To fix this, narrow to a procedure
that is active in the current continuation, or narrow to a specific
number of stack frames.
** backtraces through compiled procedures only show procedures that are
active in the current continuation
Similarly to the previous issue, backtraces in compiled code may be
different from backtraces in interpreted code. There are no semantic
differences, however. Please mail bug-guile@gnu.org if you see any
deficiencies with Guile's backtraces.
** syntax-rules and syntax-case macros now propagate source information
through to the expanded code
This should result in better backtraces.
** The currying behavior of `define' has been removed.
Before, `(define ((f a) b) (* a b))' would translate to
(define f (lambda (a) (lambda (b) (* a b))))
Now a syntax error is signaled, as this syntax is not supported by
default. If there is sufficient demand, this syntax can be supported
again by default.
** All modules have names now
Before, you could have anonymous modules: modules without names. Now,
because of hygiene and macros, all modules have names. If a module was
created without a name, the first time `module-name' is called on it, a
fresh name will be lazily generated for it.
** Many syntax errors have different texts now
Syntax errors still throw to the `syntax-error' key, but the arguments
are often different now. Perhaps in the future, Guile will switch to
using standard SRFI-35 conditions.
** Returning multiple values to compiled code will silently truncate the
values to the expected number
For example, the interpreter would raise an error evaluating the form,
`(+ (values 1 2) (values 3 4))', because it would see the operands as
being two compound "values" objects, to which `+' does not apply.
The compiler, on the other hand, receives multiple values on the stack,
not as a compound object. Given that it must check the number of values
anyway, if too many values are provided for a continuation, it chooses
to truncate those values, effectively evaluating `(+ 1 3)' instead.
The idea is that the semantics that the compiler implements is more
intuitive, and the use of the interpreter will fade out with time.
This behavior is allowed both by the R5RS and the R6RS.
** Multiple values in compiled code are not represented by compound
objects
This change may manifest itself in the following situation:
(let ((val (foo))) (do-something) val)
In the interpreter, if `foo' returns multiple values, multiple values
are produced from the `let' expression. In the compiler, those values
are truncated to the first value, and that first value is returned. In
the compiler, if `foo' returns no values, an error will be raised, while
the interpreter would proceed.
Both of these behaviors are allowed by R5RS and R6RS. The compiler's
behavior is more correct, however. If you wish to preserve a potentially
multiply-valued return, you will need to set up a multiple-value
continuation, using `call-with-values'.
** Defmacros are now implemented in terms of syntax-case.
The practical ramification of this is that the `defmacro?' predicate has
been removed, along with `defmacro-transformer', `macro-table',
`xformer-table', `assert-defmacro?!', `set-defmacro-transformer!' and
`defmacro:transformer'. This is because defmacros are simply macros. If
any of these procedures provided useful facilities to you, we encourage
you to contact the Guile developers.
** psyntax is now the default expander
Scheme code is now expanded by default by the psyntax hygienic macro
expander. Expansion is performed completely before compilation or
interpretation.
Notably, syntax errors will be signalled before interpretation begins.
In the past, many syntax errors were only detected at runtime if the
code in question was memoized.
As part of its expansion, psyntax renames all lexically-bound
identifiers. Original identifier names are preserved and given to the
compiler, but the interpreter will see the renamed variables, e.g.,
`x432' instead of `x'.
Note that the psyntax that Guile uses is a fork, as Guile already had
modules before incompatible modules were added to psyntax -- about 10
years ago! Thus there are surely a number of bugs that have been fixed
in psyntax since then. If you find one, please notify bug-guile@gnu.org.
** syntax-rules and syntax-case are available by default.
There is no longer any need to import the `(ice-9 syncase)' module
(which is now deprecated). The expander may be invoked directly via
`sc-expand', though it is normally searched for via the current module
transformer.
Also, the helper routines for syntax-case are available in the default
environment as well: `syntax->datum', `datum->syntax',
`bound-identifier=?', `free-identifier=?', `generate-temporaries',
`identifier?', and `syntax-violation'. See the R6RS for documentation.
** Lexical bindings introduced by hygienic macros may not be referenced
by nonhygienic macros.
If a lexical binding is introduced by a hygienic macro, it may not be
referenced by a nonhygienic macro. For example, this works:
(let ()
(define-macro (bind-x val body)
`(let ((x ,val)) ,body))
(define-macro (ref x)
x)
(bind-x 10 (ref x)))
But this does not:
(let ()
(define-syntax bind-x
(syntax-rules ()
((_ val body) (let ((x val)) body))))
(define-macro (ref x)
x)
(bind-x 10 (ref x)))
It is not normal to run into this situation with existing code. However,
as code is ported over from defmacros to syntax-case, it is possible to
run into situations like this. In the future, Guile will probably port
its `while' macro to syntax-case, which makes this issue one to know
about.
** Macros may no longer be referenced as first-class values.
In the past, you could evaluate e.g. `if', and get its macro value. Now,
expanding this form raises a syntax error.
Macros still /exist/ as first-class values, but they must be
/referenced/ via the module system, e.g. `(module-ref (current-module)
'if)'.
This decision may be revisited before the 2.0 release. Feedback welcome
to guile-devel@gnu.org (subscription required) or bug-guile@gnu.org (no
subscription required).
** New macro type: syncase-macro
XXX Need to decide whether to document this for 2.0, probably should:
make-syncase-macro, make-extended-syncase-macro, macro-type,
syncase-macro-type, syncase-macro-binding
** A new `memoize-symbol' evaluator trap has been added.
This trap can be used for efficiently implementing a Scheme code
coverage.
** Duplicate bindings among used modules are resolved lazily.
This slightly improves program startup times.
** New thread cancellation and thread cleanup API
See `cancel-thread', `set-thread-cleanup!', and `thread-cleanup'.
** Fix bad interaction between `false-if-exception' and stack-call.
Exceptions thrown by `false-if-exception' were erronously causing the
stack to be saved, causing later errors to show the incorrectly-saved
backtrace. This has been fixed.
** New global variables: %load-compiled-path, %load-compiled-extensions
These are analogous to %load-path and %load-extensions.
** New procedure, `make-promise'
`(make-promise (lambda () foo))' is equivalent to `(delay foo)'.
** New entry into %guile-build-info: `ccachedir'
** Fix bug in `module-bound?'.
`module-bound?' was returning true if a module did have a local
variable, but one that was unbound, but another imported module bound
the variable. This was an error, and was fixed.
** `(ice-9 syncase)' has been deprecated.
As syntax-case is available by default, importing `(ice-9 syncase)' has
no effect, and will trigger a deprecation warning.
* Changes to the C interface
** The GH interface (deprecated in version 1.6, 2001) was removed.
@ -40,22 +613,80 @@ application code.
** Functions for handling `scm_option' now no longer require an argument
indicating length of the `scm_t_option' array.
** Primitive procedures (aka. "subrs") are now stored in double cells
This removes the subr table and simplifies the code.
** scm_primitive_load_path has additional argument, exception_on_error
** Primitive procedures with more than 3 arguments (aka. "gsubrs") are
no longer implemented using the "compiled closure" mechanism. This
simplifies code and reduces both the storage and run-time overhead.
** New C function: scm_module_public_interface
This procedure corresponds to Scheme's `module-public-interface'.
** `scm_stat' has an additional argument, `exception_on_error'
** `scm_primitive_load_path' has an additional argument `exception_on_not_found'
** `scm_set_port_seek' and `scm_set_port_truncate' use the `scm_t_off' type
Previously they would use the `off_t' type, which is fragile since its
definition depends on the application's value for `_FILE_OFFSET_BITS'.
** The `long_long' C type, deprecated in 1.8, has been removed
* Changes to the distribution
** Guile's license is now LGPLv3+
In other words the GNU Lesser General Public License, version 3 or
later (at the discretion of each person that chooses to redistribute
part of Guile).
** `guile-config' will be deprecated in favor of `pkg-config'
`guile-config' has been rewritten to get its information from
`pkg-config', so this should be a transparent change. Note however that
guile.m4 has yet to be modified to call pkg-config instead of
guile-config.
** Guile now provides `guile-2.0.pc' instead of `guile-1.8.pc'
Programs that use `pkg-config' to find Guile or one of its Autoconf
macros should now require `guile-2.0' instead of `guile-1.8'.
** New installation directory: $(pkglibdir)/1.9/ccache
If $(libdir) is /usr/lib, for example, Guile will install its .go files
to /usr/lib/guile/1.9/ccache. These files are architecture-specific.
** New dependency: GNU libunistring.
See http://www.gnu.org/software/libunistring/. We hope to merge in
Unicode support in the next prerelease.
Changes in 1.8.8 (since 1.8.7)
* Bugs fixed
** Fix possible buffer overruns when parsing numbers
Changes in 1.8.7 (since 1.8.6)
* New modules (see the manual for details)
** `(srfi srfi-98)', an interface to access environment variables
* Bugs fixed
** Fix compilation with `--disable-deprecated'
** Fix %fast-slot-ref/set!, to avoid possible segmentation fault
** Fix MinGW build problem caused by HAVE_STRUCT_TIMESPEC confusion
** Fix build problem when scm_t_timespec is different from struct timespec
** Fix build when compiled with -Wundef -Werror
** More build fixes for `alphaev56-dec-osf5.1b' (Tru64)
** Build fixes for `powerpc-ibm-aix5.3.0.0' (AIX 5.3)
** With GCC, always compile with `-mieee' on `alpha*' and `sh*'
** Better diagnose broken `(strftime "%z" ...)' in `time.test' (bug #24130)
** Fix parsing of SRFI-88/postfix keywords longer than 128 characters
** Fix reading of complex numbers where both parts are inexact decimals
** Allow @ macro to work with (ice-9 syncase)
@ -184,13 +815,6 @@ lead to a stack overflow.
** Fixed shadowing of libc's <random.h> on Tru64, which broke compilation
** Make sure all tests honor `$TMPDIR'
* Changes to the distribution
** New FAQ
We've started collecting Frequently Asked Questions (FAQ), and will
distribute these (with answers!) in future Guile releases.
Changes in 1.8.4 (since 1.8.3)

77
README
View file

@ -14,7 +14,7 @@ Guile versions with an odd middle number, i.e. 1.9.* are unstable
development versions. Even middle numbers indicate stable versions.
This has been the case since the 1.3.* series.
The next stable release will likely be version 1.10.0.
The next stable release will likely be version 2.0.0.
Please send bug reports to bug-guile@gnu.org.
@ -27,24 +27,38 @@ Generic instructions for configuring and compiling Guile can be found
in the INSTALL file. Guile specific information and configure options
can be found below, including instructions for installing SLIB.
Guile requires a few external packages and can optionally use a number
of external packages such as `readline' when they are available.
Guile expects to be able to find these packages in the default
compiler setup, it does not try to make any special arrangements
itself. For example, for the `readline' package, Guile expects to be
able to find the include file <readline/readline.h>, without passing
any special `-I' options to the compiler.
Guile depends on the following external libraries.
- libgmp
- libiconv
- libintl
- libltdl
- libunistring
It will also use the libreadline library if it is available. For each
of these there is a corresponding --with-XXX-prefix option that you
can use when invoking ./configure, if you have these libraries
installed in a location other than the standard places (/usr and
/usr/local).
If you installed an external package, and you used the --prefix
installation option to install it somewhere else than /usr/local, you
must arrange for your compiler to find it by default. If that
compiler is gcc, one convenient way of making such arrangements is to
use the --with-local-prefix option during installation, naming the
same directory as you used in the --prefix option of the package. In
particular, it is not good enough to use the same --prefix option when
you install gcc and the package; you need to use the
--with-local-prefix option as well. See the gcc documentation for
more details.
These options are provided by the Gnulib `havelib' module, and details
of how they work are documented in `Searching for Libraries' in the
Gnulib manual (http://www.gnu.org/software/gnulib/manual). The extent
to which they work on a given OS depends on whether that OS supports
encoding full library path names in executables (aka `rpath'). Also
note that using these options, and hence hardcoding full library path
names (where that is supported), makes it impossible to later move the
built executables and libraries to an installation location other than
the one that was specified at build time.
Another possible approach is to set CPPFLAGS and LDFLAGS before
running configure, so that they include -I options for all the
non-standard places where you have installed header files and -L
options for all the non-standard places where you have installed
libraries. This will allow configure and make to find those headers
and libraries during the build. The locations found will not be
hardcoded into the build executables and libraries, so with this
approach you will probably also need to set LD_LIBRARY_PATH
correspondingly, to allow Guile to find the necessary libraries again
at runtime.
Required External Packages ================================================
@ -61,6 +75,12 @@ Guile requires the following external packages:
libltdl is used for loading extensions at run-time. It is
available from http://www.gnu.org/software/libtool/
- GNU libunistring
libunistring is used for Unicode string operations, such as the
`utf*->string' procedures. It is available from
http://www.gnu.org/software/libunistring/ .
Special Instructions For Some Systems =====================================
@ -223,9 +243,23 @@ GUILE_FOR_BUILD variable, it defaults to just "guile".
Using Guile Without Installing It =========================================
The top directory of the Guile sources contains a script called
"pre-inst-guile" that can be used to run the Guile that has just been
built.
The "meta/" subdirectory of the Guile sources contains a script called
"guile" that can be used to run the Guile that has just been built. Note
that this is not the same "guile" as the one that is installed; this
"guile" is a wrapper script that sets up the environment appropriately,
then invokes the Guile binary.
You may also build external packages against an uninstalled Guile build
tree. The "uninstalled-env" script in the "meta/" subdirectory will set
up an environment with a path including "meta/", a modified dynamic
linker path, a modified PKG_CONFIG_PATH, etc.
For example, you can enter this environment via invoking
meta/uninstalled-env bash
Within that shell, other packages should be able to build against
uninstalled Guile.
Installing SLIB ===========================================================
@ -289,6 +323,7 @@ About This Distribution ==============================================
Interesting files include:
- LICENSE, which contains the exact terms of the Guile license.
- COPYING.LESSER, which contains the terms of the GNU Lesser General Public License.
- COPYING, which contains the terms of the GNU General Public License.
- INSTALL, which contains general instructions for building/installing Guile.
- NEWS, which describes user-visible changes since the last release of Guile.

9
THANKS
View file

@ -3,6 +3,7 @@ Contributors since the last release:
Rob Browning
Ludovic Courtès
Julian Graham
Mike Gran
Stefan Jahn
Neil Jerram
Gregory Marton
@ -13,6 +14,7 @@ Contributors since the last release:
Kevin Ryde
Bill Schottstaedt
Richard Todd
Andy Wingo
Sponsors since the last release:
@ -23,6 +25,7 @@ For fixes or providing information which led to a fix:
David Allouche
Martin Baulig
Fabrice Bauzac
Sylvain Beucler
Carlo Bramini
Rob Browning
Adrian Bunk
@ -37,6 +40,7 @@ For fixes or providing information which led to a fix:
John W Eaton
Clinton Ebadi
David Fang
Barry Fishman
Charles Gagnon
Peter Gavin
Eric Gillespie, Jr
@ -61,10 +65,12 @@ For fixes or providing information which led to a fix:
René Köcher
Matthias Köppe
Matt Kraai
Daniel Kraft
Miroslav Lichvar
Jeff Long
Marco Maggi
Gregory Marton
Kjetil S. Matheussen
Antoine Mathys
Dan McMahill
Roger Mc Murtrie
@ -82,6 +88,7 @@ For fixes or providing information which led to a fix:
David Pirotte
Carlos Pita
Ken Raeburn
Juhani Rantanen
Andreas Rottmann
Hugh Sasse
Werner Scheinast
@ -91,6 +98,7 @@ For fixes or providing information which led to a fix:
Scott Shedden
Alex Shinn
Daniel Skarda
Dale Smith
Cesar Strauss
Rainer Tammer
Richard Todd
@ -106,6 +114,7 @@ For fixes or providing information which led to a fix:
Andreas Vögele
Michael Talbot-Wilson
Michael Tuexen
Mark H. Weaver
Jon Wilson
Andy Wingo
Keith Wright

View file

@ -4,20 +4,20 @@
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu

View file

@ -2,12 +2,32 @@
GOBJECTS = $(SOURCES:%.scm=%.go)
moddir = $(pkgdatadir)/$(GUILE_EFFECTIVE_VERSION)/$(modpath)
nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES) $(GOBJECTS)
nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES)
ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/ccache/$(modpath)
nobase_ccache_DATA = $(GOBJECTS)
EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES)
CLEANFILES = $(GOBJECTS)
# Well, shit. We can't have install changing timestamps, can we? But
# install_sh doesn't know how to preserve timestamps. Soooo, fondle
# automake to make things happen.
install-data-hook:
@$(am__vpath_adj_setup) \
list='$(nobase_mod_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
$(am__vpath_adj) \
echo " touch -r '$$d$$p' '$(DESTDIR)$(moddir)/$$f'"; \
touch -r "$$d$$p" "$(DESTDIR)$(moddir)/$$f"; \
done
@$(am__vpath_adj_setup) \
list='$(nobase_ccache_DATA)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
$(am__vpath_adj) \
echo " touch -r '$$d$$p' '$(DESTDIR)$(ccachedir)/$$f'"; \
touch -r "$$d$$p" "$(DESTDIR)$(ccachedir)/$$f"; \
done
SUFFIXES = .scm .go
.scm.go:
$(MKDIR_P) `dirname $@`
$(top_builddir)/pre-inst-guile-env $(top_builddir)/guile-tools compile -o "$@" "$<"
GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guile-tools compile -o "$@" "$<"

View file

@ -5,17 +5,17 @@
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## it under the terms of the GNU Lesser General Public License as
## published by the Free Software Foundation; either version 3, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA

View file

@ -5,17 +5,17 @@
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## it under the terms of the GNU Lesser General Public License as
## published by the Free Software Foundation; either version 3, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
@ -28,7 +28,7 @@
## Code:
preinstguile = $(top_builddir_absolute)/pre-inst-guile
preinstguile = $(top_builddir_absolute)/meta/guile
preinstguiletool = GUILE="$(preinstguile)" $(top_srcdir)/scripts
## am/pre-inst-guile ends here

View file

@ -1,4 +1,5 @@
SCM_BENCHMARKS = benchmarks/0-reference.bm \
benchmarks/bytevectors.bm \
benchmarks/continuations.bm \
benchmarks/if.bm \
benchmarks/logand.bm \

View file

@ -0,0 +1,100 @@
;;; -*- mode: scheme; coding: latin-1; -*-
;;; R6RS Byte Vectors.
;;;
;;; Copyright 2009 Ludovic Courtès <ludo@gnu.org>
;;;
;;;
;;; 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, 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 software; see the file COPYING.LESSER. If
;;; not, write to the Free Software Foundation, Inc., 51 Franklin
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (benchmarks bytevector)
:use-module (rnrs bytevector)
:use-module (srfi srfi-4)
:use-module (benchmark-suite lib))
(define bv (make-bytevector 16384))
(define %native-endianness
(native-endianness))
(define %foreign-endianness
(if (eq? (native-endianness) (endianness little))
(endianness big)
(endianness little)))
(define u8v (make-u8vector 16384))
(define u16v (make-u16vector 8192))
(define u32v (make-u32vector 4196))
(define u64v (make-u64vector 2048))
(with-benchmark-prefix "ref/set!"
(benchmark "bytevector-u8-ref" 1000000
(bytevector-u8-ref bv 0))
(benchmark "bytevector-u16-ref (foreign)" 1000000
(bytevector-u16-ref bv 0 %foreign-endianness))
(benchmark "bytevector-u16-ref (native)" 1000000
(bytevector-u16-ref bv 0 %native-endianness))
(benchmark "bytevector-u16-native-ref" 1000000
(bytevector-u16-native-ref bv 0))
(benchmark "bytevector-u32-ref (foreign)" 1000000
(bytevector-u32-ref bv 0 %foreign-endianness))
(benchmark "bytevector-u32-ref (native)" 1000000
(bytevector-u32-ref bv 0 %native-endianness))
(benchmark "bytevector-u32-native-ref" 1000000
(bytevector-u32-native-ref bv 0))
(benchmark "bytevector-u64-ref (foreign)" 1000000
(bytevector-u64-ref bv 0 %foreign-endianness))
(benchmark "bytevector-u64-ref (native)" 1000000
(bytevector-u64-ref bv 0 %native-endianness))
(benchmark "bytevector-u64-native-ref" 1000000
(bytevector-u16-native-ref bv 0)))
(with-benchmark-prefix "lists"
(benchmark "bytevector->u8-list" 2000
(bytevector->u8-list bv))
(benchmark "bytevector->uint-list 16-bit" 2000
(bytevector->uint-list bv (native-endianness) 2))
(benchmark "bytevector->uint-list 64-bit" 2000
(bytevector->uint-list bv (native-endianness) 8)))
(with-benchmark-prefix "SRFI-4" ;; for comparison
(benchmark "u8vector-ref" 1000000
(u8vector-ref u8v 0))
(benchmark "u16vector-ref" 1000000
(u16vector-ref u16v 0))
(benchmark "u32vector-ref" 1000000
(u32vector-ref u32v 0))
(benchmark "u64vector-ref" 1000000
(u64vector-ref u64v 0)))

View file

@ -2,20 +2,20 @@
;;;
;;; Copyright (C) 2008 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
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; 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, 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 General Public License for more details.
;;; GNU Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this software; see the file COPYING. If not, write to
;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;; Boston, MA 02110-1301 USA
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this software; see the file COPYING.LESSER. If
;;; not, write to the Free Software Foundation, Inc., 51 Franklin
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (benchmarks read)
:use-module (benchmark-suite lib))

View file

@ -2,20 +2,20 @@
;;;
;;; Copyright (C) 2009 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
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; 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, 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 General Public License for more details.
;;; GNU Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this software; see the file COPYING. If not, write to
;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;; Boston, MA 02110-1301 USA
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this software; see the file COPYING.LESSER. If
;;; not, write to the Free Software Foundation, Inc., 51 Franklin
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (benchmarks subrs)
:use-module (benchmark-suite lib))

View file

@ -2,20 +2,20 @@
;;;
;;; Copyright (C) 2008 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
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; 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, 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 General Public License for more details.
;;; GNU Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this software; see the file COPYING. If not, write to
;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;; Boston, MA 02110-1301 USA
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this software; see the file COPYING.LESSER. If
;;; not, write to the Free Software Foundation, Inc., 51 Franklin
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (benchmarks uniform-vector-read)
:use-module (benchmark-suite lib)

View file

@ -7,20 +7,20 @@
;;;;
;;;; Copyright (C) 2002, 2006 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
;;;; the Free Software Foundation; either version 2, or (at your option)
;;;; any later version.
;;;; 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, 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 General Public License for more details.
;;;; GNU Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING. If not, write to
;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;;; Boston, MA 02110-1301 USA
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this software; see the file COPYING.LESSER.
;;;; If not, write to the Free Software Foundation, Inc., 51 Franklin
;;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
;;;; Usage: [guile -e main -s] guile-benchmark [OPTIONS] [BENCHMARK ...]

View file

@ -1,20 +1,20 @@
;;;; benchmark-suite/lib.scm --- generic support for benchmarking
;;;; Copyright (C) 2002, 2006 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
;;;; the Free Software Foundation; either version 2, or (at your option)
;;;; any later version.
;;;; 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, 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 General Public License for more details.
;;;; GNU Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this software; see the file COPYING. If not, write to
;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;;; Boston, MA 02110-1301 USA
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this software; see the file COPYING.LESSER.
;;;; If not, write to the Free Software Foundation, Inc., 51 Franklin
;;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (benchmark-suite lib)
:export (

View file

@ -47,7 +47,7 @@ for cc_temp in $CC""; do
done
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
# Code taken from libtool.m4's _LT_COMPILER_PIC.
wl=
if test "$GCC" = yes; then
@ -64,7 +64,7 @@ else
;;
esac
;;
mingw* | cygwin* | pw32* | os2*)
mingw* | cygwin* | pw32* | os2* | cegcc*)
;;
hpux9* | hpux10* | hpux11*)
wl='-Wl,'
@ -76,7 +76,13 @@ else
;;
linux* | k*bsd*-gnu)
case $cc_basename in
icc* | ecc*)
ecc*)
wl='-Wl,'
;;
icc* | ifort*)
wl='-Wl,'
;;
lf95*)
wl='-Wl,'
;;
pgcc | pgf77 | pgf90)
@ -124,7 +130,7 @@ else
esac
fi
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
hardcode_libdir_flag_spec=
hardcode_libdir_separator=
@ -132,7 +138,7 @@ hardcode_direct=no
hardcode_minus_L=no
case "$host_os" in
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
# FIXME: the MSVC++ port hasn't been tested in a loooong time
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
@ -182,7 +188,7 @@ if test "$with_gnu_ld" = yes; then
ld_shlibs=no
fi
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
# hardcode_libdir_flag_spec is actually meaningless, as there is
# no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
@ -326,7 +332,7 @@ else
;;
bsdi[45]*)
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@ -494,7 +500,7 @@ else
fi
# Check dynamic linker characteristics
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
# only about the one the linker finds when passed -lNAME. This is the last
# element of library_names_spec in libtool.m4, or possibly two of them if the
@ -517,7 +523,7 @@ case "$host_os" in
bsdi[45]*)
library_names_spec='$libname$shrext'
;;
cygwin* | mingw* | pw32*)
cygwin* | mingw* | pw32* | cegcc*)
shrext=.dll
library_names_spec='$libname.dll.a $libname.lib'
;;

183
build-aux/gitlog-to-changelog Executable file
View file

@ -0,0 +1,183 @@
#!/usr/bin/perl
# Convert git log output to ChangeLog format.
my $VERSION = '2009-06-04 08:53'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
# Copyright (C) 2008, 2009 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
# 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Written by Jim Meyering
use strict;
use warnings;
use Getopt::Long;
use POSIX qw(strftime);
(my $ME = $0) =~ s|.*/||;
# use File::Coda; # http://meyering.net/code/Coda/
END {
defined fileno STDOUT or return;
close STDOUT and return;
warn "$ME: failed to close standard output: $!\n";
$? ||= 1;
}
sub usage ($)
{
my ($exit_code) = @_;
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
if ($exit_code != 0)
{
print $STREAM "Try `$ME --help' for more information.\n";
}
else
{
print $STREAM <<EOF;
Usage: $ME [OPTIONS] [ARGS]
Convert git log output to ChangeLog format. If present, any ARGS
are passed to "git log". To avoid ARGS being parsed as options to
$ME, they may be preceded by '--'.
OPTIONS:
--since=DATE convert only the logs since DATE;
the default is to convert all log entries.
--help display this help and exit
--version output version information and exit
EXAMPLE:
$ME --since=2008-01-01 > ChangeLog
$ME -- -n 5 foo > last-5-commits-to-branch-foo
EOF
}
exit $exit_code;
}
# If the string $S is a well-behaved file name, simply return it.
# If it contains white space, quotes, etc., quote it, and return the new string.
sub shell_quote($)
{
my ($s) = @_;
if ($s =~ m![^\w+/.,-]!)
{
# Convert each single quote to '\''
$s =~ s/\'/\'\\\'\'/g;
# Then single quote the string.
$s = "'$s'";
}
return $s;
}
sub quoted_cmd(@)
{
return join (' ', map {shell_quote $_} @_);
}
{
my $since_date = '1970-01-01 UTC';
GetOptions
(
help => sub { usage 0 },
version => sub { print "$ME version $VERSION\n"; exit },
'since=s' => \$since_date,
) or usage 1;
my @cmd = (qw (git log --log-size), "--since=$since_date",
'--pretty=format:%ct %an <%ae>%n%n%s%n%b%n', @ARGV);
open PIPE, '-|', @cmd
or die ("$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n"
. "(Is your Git too old? Version 1.5.1 or later is required.)\n");
my $prev_date_line = '';
while (1)
{
defined (my $in = <PIPE>)
or last;
$in =~ /^log size (\d+)$/
or die "$ME:$.: Invalid line (expected log size):\n$in";
my $log_nbytes = $1;
my $log;
my $n_read = read PIPE, $log, $log_nbytes;
$n_read == $log_nbytes
or die "$ME:$.: unexpected EOF\n";
my @line = split "\n", $log;
my $author_line = shift @line;
defined $author_line
or die "$ME:$.: unexpected EOF\n";
$author_line =~ /^(\d+) (.*>)$/
or die "$ME:$.: Invalid line "
. "(expected date/author/email):\n$author_line\n";
my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1));
# If this line would be the same as the previous date/name/email
# line, then arrange not to print it.
if ($date_line ne $prev_date_line)
{
$prev_date_line eq ''
or print "\n";
print $date_line;
}
$prev_date_line = $date_line;
# Omit "Signed-off-by..." lines.
@line = grep !/^Signed-off-by: .*>$/, @line;
# If there were any lines
if (@line == 0)
{
warn "$ME: warning: empty commit message:\n $date_line\n";
}
else
{
# Remove leading and trailing blank lines.
while ($line[0] =~ /^\s*$/) { shift @line; }
while ($line[$#line] =~ /^\s*$/) { pop @line; }
# Prefix each non-empty line with a TAB.
@line = map { length $_ ? "\t$_" : '' } @line;
print "\n", join ("\n", @line), "\n";
}
defined ($in = <PIPE>)
or last;
$in ne "\n"
and die "$ME:$.: unexpected line:\n$in";
}
close PIPE
or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
# FIXME-someday: include $PROCESS_STATUS in the diagnostic
}
# Local Variables:
# indent-tabs-mode: nil
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "my $VERSION = '"
# time-stamp-format: "%:y-%02m-%02d %02H:%02M"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "'; # UTC"
# End:

View file

@ -1,6 +1,6 @@
#! /bin/sh
# Usage: check-guile [-i GUILE-INTERPRETER] [GUILE-TEST-ARGS]
# If `-i GUILE-INTERPRETER' is omitted, use ${top_builddir}/pre-inst-guile.
# If `-i GUILE-INTERPRETER' is omitted, use ${top_builddir}/meta/guile.
# See ${top_srcdir}/test-suite/guile-test for documentation on GUILE-TEST-ARGS.
#
# Example invocations:
@ -21,7 +21,7 @@ if [ x"$1" = x-i ] ; then
shift
shift
else
guile=${top_builddir}/pre-inst-guile
guile=${top_builddir}/meta/guile
fi
GUILE_LOAD_PATH=$TEST_SUITE_DIR
@ -41,7 +41,6 @@ if [ ! -f guile-procedures.txt ] ; then
fi
exec $guile \
-l ${top_builddir}/libguile/stack-limit-calibration.scm \
-e main -s "$TEST_SUITE_DIR/guile-test" \
--test-suite "$TEST_SUITE_DIR/tests" \
--log-file check-guile.log "$@"

View file

@ -8,20 +8,20 @@ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
This file is part of GUILE
GUILE is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your
option) any later version.
GUILE 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, or (at your option) any
later version.
GUILE 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
General Public License for more details.
GUILE 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 General Public License
along with GUILE; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
You should have received a copy of the GNU Lesser General Public
License along with GUILE; see the file COPYING.LESSER. If not, write
to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
Floor, Boston, MA 02110-1301, USA.
]])
@ -159,6 +159,7 @@ AC_ARG_ENABLE([deprecated],
if test "$enable_deprecated" = no; then
SCM_I_GSC_ENABLE_DEPRECATED=0
warn_default=no
else
if test "$enable_deprecated" = yes || test "$enable_deprecated" = ""; then
warn_default=summary
@ -168,9 +169,9 @@ else
warn_default=$enable_deprecated
fi
SCM_I_GSC_ENABLE_DEPRECATED=1
fi
AC_DEFINE_UNQUOTED(SCM_WARN_DEPRECATED_DEFAULT, "$warn_default",
[Define this to control the default warning level for deprecated features.])
fi
AC_ARG_ENABLE(elisp,
[ --disable-elisp omit Emacs Lisp support],,
@ -620,6 +621,8 @@ AC_SUBST([SCM_I_GSC_HAVE_STRUCT_DIRENT64])
# Reasons for testing:
# complex.h - new in C99
# fenv.h - available in C99, but not older systems
# machine/fpu.h - on Tru64 5.1b, the declaration of fesetround(3) is in
# this file instead of <fenv.h>
# process.h - mingw specific
# langinfo.h, nl_types.h - SuS v2
#
@ -627,7 +630,7 @@ AC_CHECK_HEADERS([complex.h fenv.h io.h libc.h limits.h malloc.h memory.h proces
regex.h rxposix.h rx/rxposix.h sys/dir.h sys/ioctl.h sys/select.h \
sys/time.h sys/timeb.h sys/times.h sys/stdtypes.h sys/types.h \
sys/utime.h time.h unistd.h utime.h pwd.h grp.h sys/utsname.h \
direct.h langinfo.h nl_types.h])
direct.h langinfo.h nl_types.h machine/fpu.h])
# "complex double" is new in C99, and "complex" is only a keyword if
# <complex.h> is included
@ -733,10 +736,14 @@ AC_CHECK_FUNCS([DINFINITY DQNAN cexp chsize clog clog10 ctermid fesetround ftime
# sethostname - the function itself check because it's not in mingw,
# the DECL is checked because Solaris 10 doens't have in any header
# xlocale.h - needed on Darwin for the `locale_t' API
# hstrerror - on Tru64 5.1b the symbol is available in libc but the
# declaration isn't anywhere.
# cuserid - on Tru64 5.1b the declaration is documented to be available
# only with `_XOPEN_SOURCE' or some such.
#
AC_CHECK_HEADERS(crypt.h netdb.h pthread.h sys/param.h sys/resource.h sys/file.h xlocale.h)
AC_CHECK_FUNCS(chroot flock getlogin cuserid getpriority setpriority getpass sethostname gethostname)
AC_CHECK_DECLS([sethostname])
AC_CHECK_DECLS([sethostname, hstrerror, cuserid])
# crypt() may or may not be available, for instance in some countries there
# are restrictions on cryptography.
@ -820,14 +827,13 @@ fi
dnl GMP tests
AC_CHECK_LIB([gmp], [__gmpz_init], ,
[AC_MSG_ERROR([GNU MP not found, see README])])
# mpz_import is a macro so we need to include <gmp.h>
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gmp.h>]],
[[mpz_import (0, 0, 0, 0, 0, 0, 0); ]])],
AC_LIB_HAVE_LINKFLAGS(gmp,
[],
[AC_MSG_ERROR([At least GNU MP 4.1 is required, see README])])
[#include <gmp.h>],
[mpz_import (0, 0, 0, 0, 0, 0, 0);],
AC_MSG_ERROR([GNU MP 4.1 or greater not found, see README]))
dnl GNU libunistring is checked for by Gnulib's `libunistring' module.
dnl i18n tests
#AC_CHECK_HEADERS([libintl.h])
@ -883,6 +889,8 @@ if test -n "$have_sys_un_h" ; then
[Define if the system supports Unix-domain (file-domain) sockets.])
fi
AC_CHECK_FUNCS(getrlimit setrlimit)
AC_CHECK_FUNCS(socketpair getgroups setgroups setpwent pause tzset)
AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
@ -1037,18 +1045,6 @@ if test $guile_cv_localtime_cache = yes; then
AC_DEFINE(LOCALTIME_CACHE, 1, [Define if localtime caches the TZ setting.])
fi
dnl Test whether system calls are restartable by default on the
dnl current system. If they are not, we put a loop around every system
dnl call to check for EINTR (see SCM_SYSCALL) and do not attempt to
dnl change from the default behaviour. On the other hand, if signals
dnl are restartable then the loop is not installed and when libguile
dnl initialises it also resets the behaviour of each signal to cause a
dnl restart (in case a different runtime had a different default
dnl behaviour for some reason: e.g., different versions of linux seem
dnl to behave differently.)
AC_SYS_RESTARTABLE_SYSCALLS
if test "$enable_regex" = yes; then
if test "$ac_cv_header_regex_h" = yes ||
test "$ac_cv_header_rxposix_h" = yes ||
@ -1260,11 +1256,12 @@ case "$with_threads" in
build_pthread_support="yes"
ACX_PTHREAD(CC="$PTHREAD_CC"
ACX_PTHREAD([CC="$PTHREAD_CC"
LIBS="$PTHREAD_LIBS $LIBS"
SCM_I_GSC_USE_PTHREAD_THREADS=1
with_threads="pthreads",
with_threads="null")
with_threads="pthreads"],
[with_threads="null"
build_pthread_support="no"])
old_CFLAGS="$CFLAGS"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
@ -1551,37 +1548,24 @@ AC_CONFIG_FILES([
doc/tutorial/Makefile
emacs/Makefile
examples/Makefile
examples/box-dynamic-module/Makefile
examples/box-dynamic/Makefile
examples/box-module/Makefile
examples/box/Makefile
examples/modules/Makefile
examples/safe/Makefile
examples/scripts/Makefile
guile-config/Makefile
lang/Makefile
libguile/Makefile
scripts/Makefile
srfi/Makefile
test-suite/Makefile
test-suite/standalone/Makefile
meta/Makefile
module/Makefile
module/ice-9/Makefile
module/ice-9/debugger/Makefile
module/ice-9/debugging/Makefile
module/srfi/Makefile
module/oop/Makefile
module/oop/goops/Makefile
testsuite/Makefile
])
AC_CONFIG_FILES([guile-1.8.pc])
AC_CONFIG_FILES([meta/guile-2.0.pc])
AC_CONFIG_FILES([meta/guile-2.0-uninstalled.pc])
AC_CONFIG_FILES([check-guile], [chmod +x check-guile])
AC_CONFIG_FILES([benchmark-guile], [chmod +x benchmark-guile])
AC_CONFIG_FILES([guile-tools], [chmod +x guile-tools])
AC_CONFIG_FILES([pre-inst-guile], [chmod +x pre-inst-guile])
AC_CONFIG_FILES([pre-inst-guile-env], [chmod +x pre-inst-guile-env])
AC_CONFIG_FILES([gdb-pre-inst-guile], [chmod +x gdb-pre-inst-guile])
AC_CONFIG_FILES([meta/guile], [chmod +x meta/guile])
AC_CONFIG_FILES([meta/uninstalled-env], [chmod +x meta/uninstalled-env])
AC_CONFIG_FILES([meta/gdb-uninstalled-guile], [chmod +x meta/gdb-uninstalled-guile])
AC_CONFIG_FILES([meta/guile-tools], [chmod +x meta/guile-tools])
AC_CONFIG_FILES([libguile/guile-snarf],
[chmod +x libguile/guile-snarf])
AC_CONFIG_FILES([libguile/guile-doc-snarf],

View file

@ -1,23 +1,23 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 1998, 2002, 2006, 2008 Free Software Foundation, Inc.
## Copyright (C) 1998, 2002, 2006, 2008, 2009 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu
@ -43,5 +43,3 @@ include $(top_srcdir)/am/maintainer-dirs
guile-api.alist: guile-api.alist-FORCE
( cd $(top_builddir) ; $(mscripts)/update-guile-api.alist )
guile-api.alist-FORCE:
info_TEXINFOS = guile-vm.texi

View file

@ -2,20 +2,20 @@
*
* Copyright (C) 1998, 2000, 2004, 2006 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* 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, 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 General Public License for more details.
* 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 General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdlib.h>

View file

@ -2,20 +2,20 @@
*
* Copyright (C) 1998, 2006 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* 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, 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 General Public License for more details.
* 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 General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <libguile.h>

View file

@ -4,20 +4,20 @@
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu

View file

@ -3,19 +3,19 @@
;; Copyright (C) 2002, 2006 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 the Free Software Foundation; either version 2, or
;; modify it under the terms of the GNU Lesser General Public License
;; as published by the Free Software Foundation; either version 3, 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
;; 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
;; General Public License for more details.
;; Lesser General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this software; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301 USA
;; You should have received a copy of the GNU Lesser General Public
;; License along with this software; see the file COPYING.LESSER. If
;; not, write to the Free Software Foundation, Inc., 51 Franklin
;; Street, Fifth Floor, Boston, MA 02110-1301 USA
;;; Commentary:

File diff suppressed because it is too large Load diff

View file

@ -2,22 +2,22 @@
;;;
;;; Copyright (C) 2001, 2004 Neil Jerram
;;;
;;; This file is not part of GNU Emacs, but the same permissions apply.
;;; This file is not part of GUILE, but the same permissions apply.
;;;
;;; GNU Emacs is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; GUILE 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, or
;;; (at your option) any later version.
;;;
;;; GNU Emacs 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 General Public License for more details.
;;; GUILE 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 General Public License
;;; along with GNU Emacs; see the file COPYING. If not, write to the
;;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;; Boston, MA 02110-1301, USA.
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with GUILE; see the file COPYING.LESSER. If not,
;;; write to the Free Software Foundation, Inc., 51 Franklin Street,
;;; Fifth Floor, Boston, MA 02110-1301, USA.
;;; Commentary:

View file

@ -204,7 +204,7 @@ Execute all thunks from the asyncs of the list @var{list_of_a}.
@deffn {Scheme Procedure} system-async thunk
@deffnx {C Function} scm_system_async (thunk)
This function is deprecated. You can use @var{thunk} directly
instead of explicitely creating an async object.
instead of explicitly creating an async object.
@end deffn

View file

@ -1,18 +1,19 @@
/* Copyright (C) 2000,2001, 2006, 2008 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
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* 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, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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 library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/

View file

@ -4,20 +4,20 @@
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu

View file

@ -4,20 +4,20 @@
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu
@ -89,8 +89,9 @@ include $(top_srcdir)/am/pre-inst-guile
# Automated snarfing
autoconf.texi: autoconf-macros.texi
autoconf-macros.texi: $(top_srcdir)/guile-config/guile.m4
$(preinstguiletool)/snarf-guile-m4-docs $(top_srcdir)/guile-config/guile.m4 \
autoconf-macros.texi: $(top_srcdir)/meta/guile.m4
GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guile-tools \
snarf-guile-m4-docs $(top_srcdir)/meta/guile.m4 \
> $(srcdir)/$@
lib-version.texi: $(top_srcdir)/GUILE-VERSION

View file

@ -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
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -271,10 +271,16 @@ with duplicate bindings.
Guile provides a procedure for checking whether a symbol is bound in the
top level environment.
@c NJFIXME explain [env]
@deffn {Scheme Procedure} defined? sym [env]
@deffnx {C Function} scm_defined_p (sym, env)
Return @code{#t} if @var{sym} is defined in the lexical environment @var{env}. When @var{env} is not specified, look in the top-level environment as defined by the current module.
@deffn {Scheme Procedure} defined? sym [module]
@deffnx {C Function} scm_defined_p (sym, module)
Return @code{#t} if @var{sym} is defined in the module @var{module} or
the current module when @var{module} is not specified; otherwise return
@code{#f}.
Up to Guile 1.8, the second optional argument had to be @dfn{lexical
environment} as returned by @code{the-environment}, for example. The
behavior of this function remains unchanged when the second argument is
omitted.
@end deffn

View file

@ -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, 2006, 2007
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -1405,6 +1405,12 @@ C}), but returns a pointer to the elements of a uniform numeric vector
of the indicated kind.
@end deftypefn
Uniform numeric vectors can be written to and read from input/output
ports using the procedures listed below. However, bytevectors may often
be more convenient for binary input/output since they provide more
flexibility in the interpretation of raw byte sequences
(@pxref{Bytevectors}).
@deffn {Scheme Procedure} uniform-vector-read! uvec [port_or_fd [start [end]]]
@deffnx {C Function} scm_uniform_vector_read_x (uvec, port_or_fd, start, end)
Fill the elements of @var{uvec} by reading
@ -1643,18 +1649,18 @@ and writing.
@subsection Generalized Vectors
Guile has a number of data types that are generally vector-like:
strings, uniform numeric vectors, bitvectors, and of course ordinary
vectors of arbitrary Scheme values. These types are disjoint: a
Scheme value belongs to at most one of the four types listed above.
strings, uniform numeric vectors, bytevectors, bitvectors, and of course
ordinary vectors of arbitrary Scheme values. These types are disjoint:
a Scheme value belongs to at most one of the five types listed above.
If you want to gloss over this distinction and want to treat all four
types with common code, you can use the procedures in this section.
They work with the @emph{generalized vector} type, which is the union
of the four vector-like types.
of the five vector-like types.
@deffn {Scheme Procedure} generalized-vector? obj
@deffnx {C Function} scm_generalized_vector_p (obj)
Return @code{#t} if @var{obj} is a vector, string,
Return @code{#t} if @var{obj} is a vector, bytevector, string,
bitvector, or uniform numeric vector.
@end deffn
@ -1743,9 +1749,9 @@ matrix with zero columns and 3 rows is different from a matrix with 3
columns and zero rows, which again is different from a vector of
length zero.
Generalized vectors, such as strings, uniform numeric vectors, bit
vectors and ordinary vectors, are the special case of one dimensional
arrays.
Generalized vectors, such as strings, uniform numeric vectors,
bytevectors, bit vectors and ordinary vectors, are the special case of
one dimensional arrays.
@menu
* Array Syntax::
@ -1828,6 +1834,16 @@ is a rank-zero array with contents 12.
@end table
In addition, bytevectors are also arrays, but use a different syntax
(@pxref{Bytevectors}):
@table @code
@item #vu8(1 2 3)
is a 3-byte long bytevector, with contents 1, 2, 3.
@end table
@node Array Procedures
@subsubsection Array Procedures
@ -2342,21 +2358,13 @@ the danger of a deadlock. In a multi-threaded program, you will need
additional synchronization to avoid modifying reserved arrays.)
You must take care to always unreserve an array after reserving it,
also in the presence of non-local exits. To simplify this, reserving
and unreserving work like a dynwind context (@pxref{Dynamic Wind}): a
call to @code{scm_array_get_handle} can be thought of as beginning a
dynwind context and @code{scm_array_handle_release} as ending it.
When a non-local exit happens between these two calls, the array is
implicitely unreserved.
even in the presence of non-local exits. If a non-local exit can
happen between these two calls, you should install a dynwind context
that releases the array when it is left (@pxref{Dynamic Wind}).
That is, you need to properly pair reserving and unreserving in your
code, but you don't need to worry about non-local exits.
These calls and other pairs of calls that establish dynwind contexts
need to be properly nested. If you begin a context prior to reserving
an array, you need to unreserve the array before ending the context.
Likewise, when reserving two or more arrays in a certain order, you
need to unreserve them in the opposite order.
In addition, array reserving and unreserving must be properly
paired. For instance, when reserving two or more arrays in a certain
order, you need to unreserve them in the opposite order.
Once you have reserved an array and have retrieved the pointer to its
elements, you must figure out the layout of the elements in memory.

View file

@ -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, 2007, 2008
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -45,6 +45,7 @@ For the documentation of such @dfn{compound} data types, see
* Characters:: Single characters.
* Character Sets:: Sets of characters.
* Strings:: Sequences of characters.
* Bytevectors:: Sequences of bytes.
* Regular Expressions:: Pattern matching and substitution.
* Symbols:: Symbols.
* Keywords:: Self-quoting, customizable display keywords.
@ -331,7 +332,7 @@ integers.
The motivation for this behavior is that the inexactness of a number
should not be lost silently. If you want to allow inexact integers,
you can explicitely insert a call to @code{inexact->exact} or to its C
you can explicitly insert a call to @code{inexact->exact} or to its C
equivalent @code{scm_inexact_to_exact}. (Only inexact integers will
be converted by this call into exact integers; inexact non-integers
will become exact fractions.)
@ -3746,6 +3747,445 @@ is larger than @var{max_len}, only @var{max_len} bytes have been
stored and you probably need to try again with a larger buffer.
@end deftypefn
@node Bytevectors
@subsection Bytevectors
@cindex bytevector
@cindex R6RS
A @dfn{bytevector} is a raw bit string. The @code{(rnrs bytevector)}
module provides the programming interface specified by the
@uref{http://www.r6rs.org/, Revised^6 Report on the Algorithmic Language
Scheme (R6RS)}. It contains procedures to manipulate bytevectors and
interpret their contents in a number of ways: bytevector contents can be
accessed as signed or unsigned integer of various sizes and endianness,
as IEEE-754 floating point numbers, or as strings. It is a useful tool
to encode and decode binary data.
The R6RS (Section 4.3.4) specifies an external representation for
bytevectors, whereby the octets (integers in the range 0--255) contained
in the bytevector are represented as a list prefixed by @code{#vu8}:
@lisp
#vu8(1 53 204)
@end lisp
denotes a 3-byte bytevector containing the octets 1, 53, and 204. Like
string literals, booleans, etc., bytevectors are ``self-quoting'', i.e.,
they do not need to be quoted:
@lisp
#vu8(1 53 204)
@result{} #vu8(1 53 204)
@end lisp
Bytevectors can be used with the binary input/output primitives of the
R6RS (@pxref{R6RS I/O Ports}).
@menu
* Bytevector Endianness:: Dealing with byte order.
* Bytevector Manipulation:: Creating, copying, manipulating bytevectors.
* Bytevectors as Integers:: Interpreting bytes as integers.
* Bytevectors and Integer Lists:: Converting to/from an integer list.
* Bytevectors as Floats:: Interpreting bytes as real numbers.
* Bytevectors as Strings:: Interpreting bytes as Unicode strings.
* Bytevectors as Generalized Vectors:: Guile extension to the bytevector API.
@end menu
@node Bytevector Endianness
@subsubsection Endianness
@cindex endianness
@cindex byte order
@cindex word order
Some of the following procedures take an @var{endianness} parameter.
The @dfn{endianness} is defined as the order of bytes in multi-byte
numbers: numbers encoded in @dfn{big endian} have their most
significant bytes written first, whereas numbers encoded in
@dfn{little endian} have their least significant bytes
first@footnote{Big-endian and little-endian are the most common
``endiannesses'', but others do exist. For instance, the GNU MP
library allows @dfn{word order} to be specified independently of
@dfn{byte order} (@pxref{Integer Import and Export,,, gmp, The GNU
Multiple Precision Arithmetic Library Manual}).}.
Little-endian is the native endianness of the IA32 architecture and
its derivatives, while big-endian is native to SPARC and PowerPC,
among others. The @code{native-endianness} procedure returns the
native endianness of the machine it runs on.
@deffn {Scheme Procedure} native-endianness
@deffnx {C Function} scm_native_endianness ()
Return a value denoting the native endianness of the host machine.
@end deffn
@deffn {Scheme Macro} endianness symbol
Return an object denoting the endianness specified by @var{symbol}. If
@var{symbol} is neither @code{big} nor @code{little} then an error is
raised at expand-time.
@end deffn
@defvr {C Variable} scm_endianness_big
@defvrx {C Variable} scm_endianness_little
The objects denoting big- and little-endianness, respectively.
@end defvr
@node Bytevector Manipulation
@subsubsection Manipulating Bytevectors
Bytevectors can be created, copied, and analyzed with the following
procedures and C functions.
@deffn {Scheme Procedure} make-bytevector len [fill]
@deffnx {C Function} scm_make_bytevector (len, fill)
@deffnx {C Function} scm_c_make_bytevector (size_t len)
Return a new bytevector of @var{len} bytes. Optionally, if @var{fill}
is given, fill it with @var{fill}; @var{fill} must be in the range
[-128,255].
@end deffn
@deffn {Scheme Procedure} bytevector? obj
@deffnx {C Function} scm_bytevector_p (obj)
Return true if @var{obj} is a bytevector.
@end deffn
@deftypefn {C Function} int scm_is_bytevector (SCM obj)
Equivalent to @code{scm_is_true (scm_bytevector_p (obj))}.
@end deftypefn
@deffn {Scheme Procedure} bytevector-length bv
@deffnx {C Function} scm_bytevector_length (bv)
Return the length in bytes of bytevector @var{bv}.
@end deffn
@deftypefn {C Function} size_t scm_c_bytevector_length (SCM bv)
Likewise, return the length in bytes of bytevector @var{bv}.
@end deftypefn
@deffn {Scheme Procedure} bytevector=? bv1 bv2
@deffnx {C Function} scm_bytevector_eq_p (bv1, bv2)
Return is @var{bv1} equals to @var{bv2}---i.e., if they have the same
length and contents.
@end deffn
@deffn {Scheme Procedure} bytevector-fill! bv fill
@deffnx {C Function} scm_bytevector_fill_x (bv, fill)
Fill bytevector @var{bv} with @var{fill}, a byte.
@end deffn
@deffn {Scheme Procedure} bytevector-copy! source source-start target target-start len
@deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, target_start, len)
Copy @var{len} bytes from @var{source} into @var{target}, starting
reading from @var{source-start} (a positive index within @var{source})
and start writing at @var{target-start}.
@end deffn
@deffn {Scheme Procedure} bytevector-copy bv
@deffnx {C Function} scm_bytevector_copy (bv)
Return a newly allocated copy of @var{bv}.
@end deffn
@deftypefn {C Function} scm_t_uint8 scm_c_bytevector_ref (SCM bv, size_t index)
Return the byte at @var{index} in bytevector @var{bv}.
@end deftypefn
@deftypefn {C Function} void scm_c_bytevector_set_x (SCM bv, size_t index, scm_t_uint8 value)
Set the byte at @var{index} in @var{bv} to @var{value}.
@end deftypefn
Low-level C macros are available. They do not perform any
type-checking; as such they should be used with care.
@deftypefn {C Macro} size_t SCM_BYTEVECTOR_LENGTH (bv)
Return the length in bytes of bytevector @var{bv}.
@end deftypefn
@deftypefn {C Macro} {signed char *} SCM_BYTEVECTOR_CONTENTS (bv)
Return a pointer to the contents of bytevector @var{bv}.
@end deftypefn
@node Bytevectors as Integers
@subsubsection Interpreting Bytevector Contents as Integers
The contents of a bytevector can be interpreted as a sequence of
integers of any given size, sign, and endianness.
@lisp
(let ((bv (make-bytevector 4)))
(bytevector-u8-set! bv 0 #x12)
(bytevector-u8-set! bv 1 #x34)
(bytevector-u8-set! bv 2 #x56)
(bytevector-u8-set! bv 3 #x78)
(map (lambda (number)
(number->string number 16))
(list (bytevector-u8-ref bv 0)
(bytevector-u16-ref bv 0 (endianness big))
(bytevector-u32-ref bv 0 (endianness little)))))
@result{} ("12" "1234" "78563412")
@end lisp
The most generic procedures to interpret bytevector contents as integers
are described below.
@deffn {Scheme Procedure} bytevector-uint-ref bv index endianness size
@deffnx {Scheme Procedure} bytevector-sint-ref bv index endianness size
@deffnx {C Function} scm_bytevector_uint_ref (bv, index, endianness, size)
@deffnx {C Function} scm_bytevector_sint_ref (bv, index, endianness, size)
Return the @var{size}-byte long unsigned (resp. signed) integer at
index @var{index} in @var{bv}, decoded according to @var{endianness}.
@end deffn
@deffn {Scheme Procedure} bytevector-uint-set! bv index value endianness size
@deffnx {Scheme Procedure} bytevector-sint-set! bv index value endianness size
@deffnx {C Function} scm_bytevector_uint_set_x (bv, index, value, endianness, size)
@deffnx {C Function} scm_bytevector_sint_set_x (bv, index, value, endianness, size)
Set the @var{size}-byte long unsigned (resp. signed) integer at
@var{index} to @var{value}, encoded according to @var{endianness}.
@end deffn
The following procedures are similar to the ones above, but specialized
to a given integer size:
@deffn {Scheme Procedure} bytevector-u8-ref bv index
@deffnx {Scheme Procedure} bytevector-s8-ref bv index
@deffnx {Scheme Procedure} bytevector-u16-ref bv index endianness
@deffnx {Scheme Procedure} bytevector-s16-ref bv index endianness
@deffnx {Scheme Procedure} bytevector-u32-ref bv index endianness
@deffnx {Scheme Procedure} bytevector-s32-ref bv index endianness
@deffnx {Scheme Procedure} bytevector-u64-ref bv index endianness
@deffnx {Scheme Procedure} bytevector-s64-ref bv index endianness
@deffnx {C Function} scm_bytevector_u8_ref (bv, index)
@deffnx {C Function} scm_bytevector_s8_ref (bv, index)
@deffnx {C Function} scm_bytevector_u16_ref (bv, index, endianness)
@deffnx {C Function} scm_bytevector_s16_ref (bv, index, endianness)
@deffnx {C Function} scm_bytevector_u32_ref (bv, index, endianness)
@deffnx {C Function} scm_bytevector_s32_ref (bv, index, endianness)
@deffnx {C Function} scm_bytevector_u64_ref (bv, index, endianness)
@deffnx {C Function} scm_bytevector_s64_ref (bv, index, endianness)
Return the unsigned @var{n}-bit (signed) integer (where @var{n} is 8,
16, 32 or 64) from @var{bv} at @var{index}, decoded according to
@var{endianness}.
@end deffn
@deffn {Scheme Procedure} bytevector-u8-set! bv index value
@deffnx {Scheme Procedure} bytevector-s8-set! bv index value
@deffnx {Scheme Procedure} bytevector-u16-set! bv index value endianness
@deffnx {Scheme Procedure} bytevector-s16-set! bv index value endianness
@deffnx {Scheme Procedure} bytevector-u32-set! bv index value endianness
@deffnx {Scheme Procedure} bytevector-s32-set! bv index value endianness
@deffnx {Scheme Procedure} bytevector-u64-set! bv index value endianness
@deffnx {Scheme Procedure} bytevector-s64-set! bv index value endianness
@deffnx {C Function} scm_bytevector_u8_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_s8_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_u16_set_x (bv, index, value, endianness)
@deffnx {C Function} scm_bytevector_s16_set_x (bv, index, value, endianness)
@deffnx {C Function} scm_bytevector_u32_set_x (bv, index, value, endianness)
@deffnx {C Function} scm_bytevector_s32_set_x (bv, index, value, endianness)
@deffnx {C Function} scm_bytevector_u64_set_x (bv, index, value, endianness)
@deffnx {C Function} scm_bytevector_s64_set_x (bv, index, value, endianness)
Store @var{value} as an @var{n}-bit (signed) integer (where @var{n} is
8, 16, 32 or 64) in @var{bv} at @var{index}, encoded according to
@var{endianness}.
@end deffn
Finally, a variant specialized for the host's endianness is available
for each of these functions (with the exception of the @code{u8}
accessors, for obvious reasons):
@deffn {Scheme Procedure} bytevector-u16-native-ref bv index
@deffnx {Scheme Procedure} bytevector-s16-native-ref bv index
@deffnx {Scheme Procedure} bytevector-u32-native-ref bv index
@deffnx {Scheme Procedure} bytevector-s32-native-ref bv index
@deffnx {Scheme Procedure} bytevector-u64-native-ref bv index
@deffnx {Scheme Procedure} bytevector-s64-native-ref bv index
@deffnx {C Function} scm_bytevector_u16_native_ref (bv, index)
@deffnx {C Function} scm_bytevector_s16_native_ref (bv, index)
@deffnx {C Function} scm_bytevector_u32_native_ref (bv, index)
@deffnx {C Function} scm_bytevector_s32_native_ref (bv, index)
@deffnx {C Function} scm_bytevector_u64_native_ref (bv, index)
@deffnx {C Function} scm_bytevector_s64_native_ref (bv, index)
Return the unsigned @var{n}-bit (signed) integer (where @var{n} is 8,
16, 32 or 64) from @var{bv} at @var{index}, decoded according to the
host's native endianness.
@end deffn
@deffn {Scheme Procedure} bytevector-u16-native-set! bv index value
@deffnx {Scheme Procedure} bytevector-s16-native-set! bv index value
@deffnx {Scheme Procedure} bytevector-u32-native-set! bv index value
@deffnx {Scheme Procedure} bytevector-s32-native-set! bv index value
@deffnx {Scheme Procedure} bytevector-u64-native-set! bv index value
@deffnx {Scheme Procedure} bytevector-s64-native-set! bv index value
@deffnx {C Function} scm_bytevector_u16_native_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_s16_native_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_u32_native_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_s32_native_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_u64_native_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_s64_native_set_x (bv, index, value)
Store @var{value} as an @var{n}-bit (signed) integer (where @var{n} is
8, 16, 32 or 64) in @var{bv} at @var{index}, encoded according to the
host's native endianness.
@end deffn
@node Bytevectors and Integer Lists
@subsubsection Converting Bytevectors to/from Integer Lists
Bytevector contents can readily be converted to/from lists of signed or
unsigned integers:
@lisp
(bytevector->sint-list (u8-list->bytevector (make-list 4 255))
(endianness little) 2)
@result{} (-1 -1)
@end lisp
@deffn {Scheme Procedure} bytevector->u8-list bv
@deffnx {C Function} scm_bytevector_to_u8_list (bv)
Return a newly allocated list of unsigned 8-bit integers from the
contents of @var{bv}.
@end deffn
@deffn {Scheme Procedure} u8-list->bytevector lst
@deffnx {C Function} scm_u8_list_to_bytevector (lst)
Return a newly allocated bytevector consisting of the unsigned 8-bit
integers listed in @var{lst}.
@end deffn
@deffn {Scheme Procedure} bytevector->uint-list bv endianness size
@deffnx {Scheme Procedure} bytevector->sint-list bv endianness size
@deffnx {C Function} scm_bytevector_to_uint_list (bv, endianness, size)
@deffnx {C Function} scm_bytevector_to_sint_list (bv, endianness, size)
Return a list of unsigned (resp. signed) integers of @var{size} bytes
representing the contents of @var{bv}, decoded according to
@var{endianness}.
@end deffn
@deffn {Scheme Procedure} uint-list->bytevector lst endianness size
@deffnx {Scheme Procedure} sint-list->bytevector lst endianness size
@deffnx {C Function} scm_uint_list_to_bytevector (lst, endianness, size)
@deffnx {C Function} scm_sint_list_to_bytevector (lst, endianness, size)
Return a new bytevector containing the unsigned (resp. signed) integers
listed in @var{lst} and encoded on @var{size} bytes according to
@var{endianness}.
@end deffn
@node Bytevectors as Floats
@subsubsection Interpreting Bytevector Contents as Floating Point Numbers
@cindex IEEE-754 floating point numbers
Bytevector contents can also be accessed as IEEE-754 single- or
double-precision floating point numbers (respectively 32 and 64-bit
long) using the procedures described here.
@deffn {Scheme Procedure} bytevector-ieee-single-ref bv index endianness
@deffnx {Scheme Procedure} bytevector-ieee-double-ref bv index endianness
@deffnx {C Function} scm_bytevector_ieee_single_ref (bv, index, endianness)
@deffnx {C Function} scm_bytevector_ieee_double_ref (bv, index, endianness)
Return the IEEE-754 single-precision floating point number from @var{bv}
at @var{index} according to @var{endianness}.
@end deffn
@deffn {Scheme Procedure} bytevector-ieee-single-set! bv index value endianness
@deffnx {Scheme Procedure} bytevector-ieee-double-set! bv index value endianness
@deffnx {C Function} scm_bytevector_ieee_single_set_x (bv, index, value, endianness)
@deffnx {C Function} scm_bytevector_ieee_double_set_x (bv, index, value, endianness)
Store real number @var{value} in @var{bv} at @var{index} according to
@var{endianness}.
@end deffn
Specialized procedures are also available:
@deffn {Scheme Procedure} bytevector-ieee-single-native-ref bv index
@deffnx {Scheme Procedure} bytevector-ieee-double-native-ref bv index
@deffnx {C Function} scm_bytevector_ieee_single_native_ref (bv, index)
@deffnx {C Function} scm_bytevector_ieee_double_native_ref (bv, index)
Return the IEEE-754 single-precision floating point number from @var{bv}
at @var{index} according to the host's native endianness.
@end deffn
@deffn {Scheme Procedure} bytevector-ieee-single-native-set! bv index value
@deffnx {Scheme Procedure} bytevector-ieee-double-native-set! bv index value
@deffnx {C Function} scm_bytevector_ieee_single_native_set_x (bv, index, value)
@deffnx {C Function} scm_bytevector_ieee_double_native_set_x (bv, index, value)
Store real number @var{value} in @var{bv} at @var{index} according to
the host's native endianness.
@end deffn
@node Bytevectors as Strings
@subsubsection Interpreting Bytevector Contents as Unicode Strings
@cindex Unicode string encoding
Bytevector contents can also be interpreted as Unicode strings encoded
in one of the most commonly available encoding formats@footnote{Guile
1.8 does @emph{not} support Unicode strings. Therefore, the procedures
described here assume that Guile strings are internally encoded
according to the current locale. For instance, if @code{$LC_CTYPE} is
@code{fr_FR.ISO-8859-1}, then @code{string->utf-8} @i{et al.} will
assume that Guile strings are Latin-1-encoded.}.
@lisp
(utf8->string (u8-list->bytevector '(99 97 102 101)))
@result{} "cafe"
(string->utf8 "caf@'e") ;; SMALL LATIN LETTER E WITH ACUTE ACCENT
@result{} #vu8(99 97 102 195 169)
@end lisp
@deffn {Scheme Procedure} string->utf8 str
@deffnx {Scheme Procedure} string->utf16 str
@deffnx {Scheme Procedure} string->utf32 str
@deffnx {C Function} scm_string_to_utf8 (str)
@deffnx {C Function} scm_string_to_utf16 (str)
@deffnx {C Function} scm_string_to_utf32 (str)
Return a newly allocated bytevector that contains the UTF-8, UTF-16, or
UTF-32 (aka. UCS-4) encoding of @var{str}.
@end deffn
@deffn {Scheme Procedure} utf8->string utf
@deffnx {Scheme Procedure} utf16->string utf
@deffnx {Scheme Procedure} utf32->string utf
@deffnx {C Function} scm_utf8_to_string (utf)
@deffnx {C Function} scm_utf16_to_string (utf)
@deffnx {C Function} scm_utf32_to_string (utf)
Return a newly allocated string that contains from the UTF-8-, UTF-16-,
or UTF-32-decoded contents of bytevector @var{utf}.
@end deffn
@node Bytevectors as Generalized Vectors
@subsubsection Accessing Bytevectors with the Generalized Vector API
As an extension to the R6RS, Guile allows bytevectors to be manipulated
with the @dfn{generalized vector} procedures (@pxref{Generalized
Vectors}). This also allows bytevectors to be accessed using the
generic @dfn{array} procedures (@pxref{Array Procedures}). When using
these APIs, bytes are accessed one at a time as 8-bit unsigned integers:
@example
(define bv #vu8(0 1 2 3))
(generalized-vector? bv)
@result{} #t
(generalized-vector-ref bv 2)
@result{} 2
(generalized-vector-set! bv 2 77)
(array-ref bv 2)
@result{} 77
(array-type bv)
@result{} vu8
@end example
@node Regular Expressions
@subsection Regular Expressions
@tpindex Regular expressions

View file

@ -61,7 +61,7 @@ Arrange things so that all of the code in the current thread executes as
if from within a call to @code{scm_with_guile}. That is, all functions
called by the current thread can assume that @code{SCM} values on their
stack frames are protected from the garbage collector (except when the
thread has explicitely left guile mode, of course).
thread has explicitly left guile mode, of course).
When @code{scm_init_guile} is called from a thread that already has been
in guile mode once, nothing happens. This behavior matters when you

View file

@ -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
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2007, 2009
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -18,6 +18,7 @@
* Block Reading and Writing:: Reading and writing blocks of text.
* Default Ports:: Defaults for input, output and errors.
* Port Types:: Types of port and how to make them.
* R6RS I/O Ports:: The R6RS port API.
* I/O Extensions:: Using and extending ports in C.
@end menu
@ -1023,6 +1024,269 @@ documentation for @code{open-file} in @ref{File Ports}.
@end deffn
@node R6RS I/O Ports
@subsection R6RS I/O Ports
@cindex R6RS
@cindex R6RS ports
The I/O port API of the @uref{http://www.r6rs.org/, Revised Report^6 on
the Algorithmic Language Scheme (R6RS)} is provided by the @code{(rnrs
io ports)} module. It provides features, such as binary I/O and Unicode
string I/O, that complement or refine Guile's historical port API
presented above (@pxref{Input and Output}).
@c FIXME: Update description when implemented.
@emph{Note}: The implementation of this R6RS API is currently far from
complete, notably due to the lack of support for Unicode I/O and strings.
@menu
* R6RS End-of-File:: The end-of-file object.
* R6RS Port Manipulation:: Manipulating R6RS ports.
* R6RS Binary Input:: Binary input.
* R6RS Binary Output:: Binary output.
@end menu
@node R6RS End-of-File
@subsubsection The End-of-File Object
@cindex EOF
@cindex end-of-file
R5RS' @code{eof-object?} procedure is provided by the @code{(rnrs io
ports)} module:
@deffn {Scheme Procedure} eof-object? obj
@deffnx {C Function} scm_eof_object_p (obj)
Return true if @var{obj} is the end-of-file (EOF) object.
@end deffn
In addition, the following procedure is provided:
@deffn {Scheme Procedure} eof-object
@deffnx {C Function} scm_eof_object ()
Return the end-of-file (EOF) object.
@lisp
(eof-object? (eof-object))
@result{} #t
@end lisp
@end deffn
@node R6RS Port Manipulation
@subsubsection Port Manipulation
The procedures listed below operate on any kind of R6RS I/O port.
@deffn {Scheme Procedure} port-position port
If @var{port} supports it (see below), return the offset (an integer)
indicating where the next octet will be read from/written to in
@var{port}. If @var{port} does not support this operation, an error
condition is raised.
This is similar to Guile's @code{seek} procedure with the
@code{SEEK_CUR} argument (@pxref{Random Access}).
@end deffn
@deffn {Scheme Procedure} port-has-port-position? port
Return @code{#t} is @var{port} supports @code{port-position}.
@end deffn
@deffn {Scheme Procedure} set-port-position! port offset
If @var{port} supports it (see below), set the position where the next
octet will be read from/written to @var{port} to @var{offset} (an
integer). If @var{port} does not support this operation, an error
condition is raised.
This is similar to Guile's @code{seek} procedure with the
@code{SEEK_SET} argument (@pxref{Random Access}).
@end deffn
@deffn {Scheme Procedure} port-has-set-port-position!? port
Return @code{#t} is @var{port} supports @code{set-port-position!}.
@end deffn
@deffn {Scheme Procedure} call-with-port port proc
Call @var{proc}, passing it @var{port} and closing @var{port} upon exit
of @var{proc}. Return the return values of @var{proc}.
@end deffn
@node R6RS Binary Input
@subsubsection Binary Input
@cindex binary input
R6RS binary input ports can be created with the procedures described
below.
@deffn {Scheme Procedure} open-bytevector-input-port bv [transcoder]
@deffnx {C Function} scm_open_bytevector_input_port (bv, transcoder)
Return an input port whose contents are drawn from bytevector @var{bv}
(@pxref{Bytevectors}).
@c FIXME: Update description when implemented.
The @var{transcoder} argument is currently not supported.
@end deffn
@cindex custom binary input ports
@deffn {Scheme Procedure} make-custom-binary-input-port id read! get-position set-position! close
@deffnx {C Function} scm_make_custom_binary_input_port (id, read!, get-position, set-position!, close)
Return a new custom binary input port@footnote{This is similar in spirit
to Guile's @dfn{soft ports} (@pxref{Soft Ports}).} named @var{id} (a
string) whose input is drained by invoking @var{read!} and passing it a
bytevector, an index where bytes should be written, and the number of
bytes to read. The @code{read!} procedure must return an integer
indicating the number of bytes read, or @code{0} to indicate the
end-of-file.
Optionally, if @var{get-position} is not @code{#f}, it must be a thunk
that will be called when @var{port-position} is invoked on the custom
binary port and should return an integer indicating the position within
the underlying data stream; if @var{get-position} was not supplied, the
returned port does not support @var{port-position}.
Likewise, if @var{set-position!} is not @code{#f}, it should be a
one-argument procedure. When @var{set-port-position!} is invoked on the
custom binary input port, @var{set-position!} is passed an integer
indicating the position of the next byte is to read.
Finally, if @var{close} is not @code{#f}, it must be a thunk. It is
invoked when the custom binary input port is closed.
Using a custom binary input port, the @code{open-bytevector-input-port}
procedure could be implemented as follows:
@lisp
(define (open-bytevector-input-port source)
(define position 0)
(define length (bytevector-length source))
(define (read! bv start count)
(let ((count (min count (- length position))))
(bytevector-copy! source position
bv start count)
(set! position (+ position count))
count))
(define (get-position) position)
(define (set-position! new-position)
(set! position new-position))
(make-custom-binary-input-port "the port" read!
get-position
set-position!))
(read (open-bytevector-input-port (string->utf8 "hello")))
@result{} hello
@end lisp
@end deffn
@cindex binary input
Binary input is achieved using the procedures below:
@deffn {Scheme Procedure} get-u8 port
@deffnx {C Function} scm_get_u8 (port)
Return an octet read from @var{port}, a binary input port, blocking as
necessary, or the end-of-file object.
@end deffn
@deffn {Scheme Procedure} lookahead-u8 port
@deffnx {C Function} scm_lookahead_u8 (port)
Like @code{get-u8} but does not update @var{port}'s position to point
past the octet.
@end deffn
@deffn {Scheme Procedure} get-bytevector-n port count
@deffnx {C Function} scm_get_bytevector_n (port, count)
Read @var{count} octets from @var{port}, blocking as necessary and
return a bytevector containing the octets read. If fewer bytes are
available, a bytevector smaller than @var{count} is returned.
@end deffn
@deffn {Scheme Procedure} get-bytevector-n! port bv start count
@deffnx {C Function} scm_get_bytevector_n_x (port, bv, start, count)
Read @var{count} bytes from @var{port} and store them in @var{bv}
starting at index @var{start}. Return either the number of bytes
actually read or the end-of-file object.
@end deffn
@deffn {Scheme Procedure} get-bytevector-some port
@deffnx {C Function} scm_get_bytevector_some (port)
Read from @var{port}, blocking as necessary, until data are available or
and end-of-file is reached. Return either a new bytevector containing
the data read or the end-of-file object.
@end deffn
@deffn {Scheme Procedure} get-bytevector-all port
@deffnx {C Function} scm_get_bytevector_all (port)
Read from @var{port}, blocking as necessary, until the end-of-file is
reached. Return either a new bytevector containing the data read or the
end-of-file object (if no data were available).
@end deffn
@node R6RS Binary Output
@subsubsection Binary Output
Binary output ports can be created with the procedures below.
@deffn {Scheme Procedure} open-bytevector-output-port [transcoder]
@deffnx {C Function} scm_open_bytevector_output_port (transcoder)
Return two values: a binary output port and a procedure. The latter
should be called with zero arguments to obtain a bytevector containing
the data accumulated by the port, as illustrated below.
@lisp
(call-with-values
(lambda ()
(open-bytevector-output-port))
(lambda (port get-bytevector)
(display "hello" port)
(get-bytevector)))
@result{} #vu8(104 101 108 108 111)
@end lisp
@c FIXME: Update description when implemented.
The @var{transcoder} argument is currently not supported.
@end deffn
@cindex custom binary output ports
@deffn {Scheme Procedure} make-custom-binary-output-port id write! get-position set-position! close
@deffnx {C Function} scm_make_custom_binary_output_port (id, write!, get-position, set-position!, close)
Return a new custom binary output port named @var{id} (a string) whose
output is sunk by invoking @var{write!} and passing it a bytevector, an
index where bytes should be read from this bytevector, and the number of
bytes to be ``written''. The @code{write!} procedure must return an
integer indicating the number of bytes actually written; when it is
passed @code{0} as the number of bytes to write, it should behave as
though an end-of-file was sent to the byte sink.
The other arguments are as for @code{make-custom-binary-input-port}
(@pxref{R6RS Binary Input, @code{make-custom-binary-input-port}}).
@end deffn
@cindex binary output
Writing to a binary output port can be done using the following
procedures:
@deffn {Scheme Procedure} put-u8 port octet
@deffnx {C Function} scm_put_u8 (port, octet)
Write @var{octet}, an integer in the 0--255 range, to @var{port}, a
binary output port.
@end deffn
@deffn {Scheme Procedure} put-bytevector port bv [start [count]]
@deffnx {C Function} scm_put_bytevector (port, bv, start, count)
Write the contents of @var{bv} to @var{port}, optionally starting at
index @var{start} and limiting to @var{count} octets.
@end deffn
@node I/O Extensions
@subsection Using and Extending Ports in C
@ -1267,7 +1531,7 @@ implementations take care to avoid this problem.
The procedure is set using
@deftypefun void scm_set_port_seek (scm_t_bits tc, off_t (*seek) (SCM port, off_t offset, int whence))
@deftypefun void scm_set_port_seek (scm_t_bits tc, scm_t_off (*seek) (SCM port, scm_t_off offset, int whence))
@end deftypefun
@item truncate
@ -1275,7 +1539,7 @@ Truncate the port data to be specified length. It can be assumed that the
current state of @code{rw_active} is @code{SCM_PORT_NEITHER}.
Set using
@deftypefun void scm_set_port_truncate (scm_t_bits tc, void (*truncate) (SCM port, off_t length))
@deftypefun void scm_set_port_truncate (scm_t_bits tc, void (*truncate) (SCM port, scm_t_off length))
@end deftypefun
@end table

View file

@ -10,7 +10,7 @@
Guile uses a @emph{garbage collector} to manage most of its objects.
While the garbage collector is designed to be mostly invisible, you
sometimes need to interact with it explicitely.
sometimes need to interact with it explicitly.
See @ref{Garbage Collection} for a general discussion of how garbage
collection relates to using Guile from C.
@ -201,7 +201,7 @@ below for a motivation.
@deftypefn {C Function} void scm_gc_free (void *@var{mem}, size_t @var{size}, const char *@var{what})
Like @code{free}, but also call @code{scm_gc_unregister_collectable_memory}.
Note that you need to explicitely pass the @var{size} parameter. This
Note that you need to explicitly pass the @var{size} parameter. This
is done since it should normally be easy to provide this parameter
(for memory that is associated with GC controlled objects) and this
frees us from tracking this value in the GC itself, which will keep

View file

@ -162,18 +162,10 @@ appropriate module first, though:
Returns @code{#t} iff @var{obj} is a compiled procedure.
@end deffn
@deffn {Scheme Procedure} program-bytecode program
@deffnx {C Function} scm_program_bytecode (program)
Returns the object code associated with this program, as a
@code{u8vector}.
@end deffn
@deffn {Scheme Procedure} program-base program
@deffnx {C Function} scm_program_base (program)
Returns the address in memory corresponding to the start of
@var{program}'s object code, as an integer. This is useful mostly when
you map the value of an instruction pointer from the VM to actual
instructions.
@deffn {Scheme Procedure} program-objcode program
@deffnx {C Function} scm_program_objcode (program)
Returns the object code associated with this program. @xref{Bytecode
and Objcode}, for more information.
@end deffn
@deffn {Scheme Procedure} program-objects program
@ -184,9 +176,9 @@ vector. @xref{VM Programs}, for more information.
@deffn {Scheme Procedure} program-module program
@deffnx {C Function} scm_program_module (program)
Returns the module that was current when this program was created.
Free variables in this program are looked up with respect to this
module.
Returns the module that was current when this program was created. Can
return @code{#f} if the compiler could determine that this information
was unnecessary.
@end deffn
@deffn {Scheme Procedure} program-external program
@ -250,9 +242,9 @@ REPL. The only tricky bit is that @var{extp} is a boolean, declaring
whether the binding is heap-allocated or not. @xref{VM Concepts}, for
more information.
Note that bindings information are stored in a program as part of its
metadata thunk, so including them in the generated object code does
not impose a runtime performance penalty.
Note that bindings information is stored in a program as part of its
metadata thunk, so including it in the generated object code does not
impose a runtime performance penalty.
@end deffn
@deffn {Scheme Procedure} program-sources program

View file

@ -257,7 +257,7 @@ otherwise return the first argument.
@deffn {Scheme Procedure} system-async thunk
@deffnx {C Function} scm_system_async (thunk)
This function is deprecated. You can use @var{thunk} directly
instead of explicitely creating an async object.
instead of explicitly creating an async object.
@end deffn

View file

@ -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
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2009
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -49,7 +49,7 @@ checks.
@cindex autoconf
GNU Guile provides a @dfn{pkg-config} description file, installed as
@file{@var{prefix}/lib/pkgconfig/guile-1.8.pc}, which contains all the
@file{@var{prefix}/lib/pkgconfig/guile-2.0.pc}, which contains all the
information necessary to compile and link C applications that use Guile.
The @code{pkg-config} program is able to read this file and provide this
information to application programmers; it can be obtained at
@ -59,8 +59,8 @@ The following command lines give respectively the C compilation and link
flags needed to build Guile-using programs:
@example
pkg-config guile-1.8 --cflags
pkg-config guile-1.8 --libs
pkg-config guile-2.0 --cflags
pkg-config guile-2.0 --libs
@end example
To ease use of pkg-config with Autoconf, pkg-config comes with a
@ -71,7 +71,7 @@ accordingly, or prints an error and exits if Guile was not found:
@findex PKG_CHECK_MODULES
@example
PKG_CHECK_MODULES([GUILE], [guile-1.8])
PKG_CHECK_MODULES([GUILE], [guile-2.0])
@end example
Guile comes with additional Autoconf macros providing more information,

View file

@ -1,6 +1,6 @@
@c -*-texinfo-*-
@c This is part of the GNU Guile Reference Manual.
@c Copyright (C) 2008
@c Copyright (C) 2008, 2009
@c Free Software Foundation, Inc.
@c See the file guile.texi for copying conditions.
@ -17,14 +17,16 @@ This section aims to pay attention to the small man behind the
curtain.
@xref{Read/Load/Eval/Compile}, if you're lost and you just wanted to
know how to compile your .scm file.
know how to compile your @code{.scm} file.
@menu
* Compiler Tower::
* The Scheme Compiler::
* GHIL::
* Tree-IL::
* GLIL::
* Object Code::
* Assembly::
* Bytecode and Objcode::
* Writing New High-Level Languages::
* Extending the Compiler::
@end menu
@ -52,7 +54,7 @@ They are registered with the @code{define-language} form.
@deffn {Scheme Syntax} define-language @
name title version reader printer @
[parser=#f] [read-file=#f] [compilers='()] [evaluator=#f]
[parser=#f] [compilers='()] [decompilers='()] [evaluator=#f]
Define a language.
This syntax defines a @code{#<language>} object, bound to @var{name}
@ -65,14 +67,11 @@ for Scheme:
#:title "Guile Scheme"
#:version "0.5"
#:reader read
#:read-file read-file
#:compilers `((,ghil . ,compile-ghil))
#:compilers `((tree-il . ,compile-tree-il))
#:decompilers `((tree-il . ,decompile-tree-il))
#:evaluator (lambda (x module) (primitive-eval x))
#:printer write)
@end example
In this example, from @code{(language scheme spec)}, @code{read-file}
reads expressions from a port and wraps them in a @code{begin} block.
@end deffn
The interesting thing about having languages defined this way is that
@ -85,12 +84,12 @@ Guile Scheme interpreter 0.5 on Guile 1.9.0
Copyright (C) 2001-2008 Free Software Foundation, Inc.
Enter `,help' for help.
scheme@@(guile-user)> ,language ghil
Guile High Intermediate Language (GHIL) interpreter 0.3 on Guile 1.9.0
scheme@@(guile-user)> ,language tree-il
Tree Intermediate Language interpreter 1.0 on Guile 1.9.0
Copyright (C) 2001-2008 Free Software Foundation, Inc.
Enter `,help' for help.
ghil@@(guile-user)>
tree-il@@(guile-user)>
@end example
Languages can be looked up by name, as they were above.
@ -128,17 +127,25 @@ The normal tower of languages when compiling Scheme goes like this:
@itemize
@item Scheme, which we know and love
@item Guile High Intermediate Language (GHIL)
@item Tree Intermediate Language (Tree-IL)
@item Guile Low Intermediate Language (GLIL)
@item Object code
@item Assembly
@item Bytecode
@item Objcode
@end itemize
Object code may be serialized to disk directly, though it has a cookie
and version prepended to the front. But when compiling Scheme at
run time, you want a Scheme value, e.g. a compiled procedure. For this
reason, so as not to break the abstraction, Guile defines a fake
language, @code{value}. Compiling to @code{value} loads the object
code into a procedure, and wakes the sleeping giant.
and version prepended to the front. But when compiling Scheme at run
time, you want a Scheme value: for example, a compiled procedure. For
this reason, so as not to break the abstraction, Guile defines a fake
language at the bottom of the tower:
@itemize
@item Value
@end itemize
Compiling to @code{value} loads the object code into a procedure, and
wakes the sleeping giant.
Perhaps this strangeness can be explained by example:
@code{compile-file} defaults to compiling to object code, because it
@ -156,350 +163,287 @@ different worlds indefinitely, as shown by the following quine:
@node The Scheme Compiler
@subsection The Scheme Compiler
The job of the Scheme compiler is to expand all macros and to resolve
all symbols to lexical variables. Its target language, GHIL, is fairly
close to Scheme itself, so this process is not very complicated.
The job of the Scheme compiler is to expand all macros and all of
Scheme to its most primitive expressions. The definition of
``primitive'' is given by the inventory of constructs provided by
Tree-IL, the target language of the Scheme compiler: procedure
applications, conditionals, lexical references, etc. This is described
more fully in the next section.
The Scheme compiler is driven by a table of @dfn{translators},
declared with the @code{define-scheme-translator} form, defined in the
module, @code{(language scheme compile-ghil)}.
The tricky and amusing thing about the Scheme-to-Tree-IL compiler is
that it is completely implemented by the macro expander. Since the
macro expander has to run over all of the source code already in order
to expand macros, it might as well do the analysis at the same time,
producing Tree-IL expressions directly.
@deffn {Scheme Syntax} define-scheme-translator head clause1 clause2...
The best documentation of this form is probably an example. Here is
the translator for @code{if}:
Because this compiler is actually the macro expander, it is
extensible. Any macro which the user writes becomes part of the
compiler.
@example
(define-scheme-translator if
;; (if TEST THEN [ELSE])
((,test ,then)
(make-ghil-if e l (retrans test) (retrans then) (retrans '(begin))))
((,test ,then ,else)
(make-ghil-if e l (retrans test) (retrans then) (retrans else))))
@end example
The Scheme-to-Tree-IL expander may be invoked using the generic
@code{compile} procedure:
The match syntax is from the @code{pmatch} macro, defined in
@code{(system base pmatch)}. The result of a clause should be a valid
GHIL value. If no clause matches, a syntax error is signalled.
@lisp
(compile '(+ 1 2) #:from 'scheme #:to 'tree-il)
@result{}
#<<application> src: #f
proc: #<<toplevel-ref> src: #f name: +>
args: (#<<const> src: #f exp: 1>
#<<const> src: #f exp: 2>)>
@end lisp
In the body of the clauses, the following bindings are introduced:
@itemize
@item @code{e}, the current environment
@item @code{l}, the current source location (or @code{#f})
@item @code{retrans}, a procedure that may be called to compile
subexpressions
@end itemize
Or, since Tree-IL is so close to Scheme, it is often useful to expand
Scheme to Tree-IL, then translate back to Scheme. For that reason the
expander provides two interfaces. The former is equivalent to calling
@code{(sc-expand '(+ 1 2) 'c)}, where the @code{'c} is for
``compile''. With @code{'e} (the default), the result is translated
back to Scheme:
Note that translators are looked up by @emph{value}, not by name. That
is to say, the translator is keyed under the @emph{value} of
@code{if}, which normally prints as @code{#<primitive-builtin-macro!
if>}.
@end deffn
@lisp
(sc-expand '(+ 1 2))
@result{} (+ 1 2)
(sc-expand '(let ((x 10)) (* x x)))
@result{} (let ((x84 10)) (* x84 x84))
@end lisp
Users can extend the compiler by defining new translators.
Additionally, some forms can be inlined directly to
instructions -- @xref{Inlined Scheme Instructions}, for a list. The
actual inliners are defined in @code{(language scheme inline)}:
The second example shows that as part of its job, the macro expander
renames lexically-bound variables. The original names are preserved
when compiling to Tree-IL, but can't be represented in Scheme: a
lexical binding only has one name. It is for this reason that the
@emph{native} output of the expander is @emph{not} Scheme. There's too
much information we would lose if we translated to Scheme directly:
lexical variable names, source locations, and module hygiene.
@deffn {Scheme Syntax} define-inline head arity1 result1 arity2 result2...
Defines an inliner for @code{head}. As in
@code{define-scheme-translator}, inliners are keyed by value and not
by name.
Note however that @code{sc-expand} does not have the same signature as
@code{compile-tree-il}. @code{compile-tree-il} is a small wrapper
around @code{sc-expand}, to make it conform to the general form of
compiler procedures in Guile's language tower.
Expressions are matched on their arities. For example:
Compiler procedures take three arguments: an expression, an
environment, and a keyword list of options. They return three values:
the compiled expression, the corresponding environment for the target
language, and a ``continuation environment''. The compiled expression
and environment will serve as input to the next language's compiler.
The ``continuation environment'' can be used to compile another
expression from the same source language within the same module.
@example
(define-inline eq?
(x y) (eq? x y))
@end example
For example, you might compile the expression, @code{(define-module
(foo))}. This will result in a Tree-IL expression and environment. But
if you compiled a second expression, you would want to take into
account the compile-time effect of compiling the previous expression,
which puts the user in the @code{(foo)} module. That is purpose of the
``continuation environment''; you would pass it as the environment
when compiling the subsequent expression.
This inlines calls to the Scheme procedure, @code{eq?}, to the
instruction @code{eq?}.
A more complicated example would be:
@example
(define-inline +
() 0
(x) x
(x y) (add x y)
(x y . rest) (add x (+ y . rest)))
@end example
@end deffn
Compilers take two arguments, an expression and an environment, and
return two values as well: an expression in the target language, and
an environment suitable for the target language. The format of the
environment is language-dependent.
For Scheme, an environment may be one of three things:
For Scheme, an environment may be one of two things:
@itemize
@item @code{#f}, in which case compilation is performed in the context
of the current module;
@item a module, which specifies the context of the compilation; or
@item a @dfn{compile environment}, which specifies lexical variables
as well.
of the current module; or
@item a module, which specifies the context of the compilation.
@end itemize
The format of a compile environment for scheme is @code{(@var{module}
@var{lexicals} . @var{externals})}, though users are strongly
discouraged from constructing these environments themselves. Instead,
if you need this functionality -- as in GOOPS' dynamic method compiler
-- capture an environment with @code{compile-time-environment}, then
pass that environment to @code{compile}.
@node Tree-IL
@subsection Tree-IL
@deffn {Scheme Procedure} compile-time-environment
A special function known to the compiler that, when compiled, will
return a representation of the lexical environment in place at compile
time. Useful for supporting some forms of dynamic compilation. Returns
@code{#f} if called from the interpreter.
@end deffn
@node GHIL
@subsection GHIL
Guile High Intermediate Language (GHIL) is a structured intermediate
Tree Intermediate Language (Tree-IL) is a structured intermediate
language that is close in expressive power to Scheme. It is an
expanded, pre-analyzed Scheme.
GHIL is ``structured'' in the sense that its representation is based
on records, not S-expressions. This gives a rigidity to the language
that ensures that compiling to a lower-level language only requires a
limited set of transformations. Practically speaking, consider the
GHIL type, @code{<ghil-quote>}, which has fields named @code{env},
@code{loc}, and @code{exp}. Instances of this type are records created
via @code{make-ghil-quote}, and whose fields are accessed as
@code{ghil-quote-env}, @code{ghil-quote-loc}, and
@code{ghil-quote-exp}. There is also a predicate, @code{ghil-quote?}.
@xref{Records}, for more information on records.
Tree-IL is ``structured'' in the sense that its representation is
based on records, not S-expressions. This gives a rigidity to the
language that ensures that compiling to a lower-level language only
requires a limited set of transformations. Practically speaking,
consider the Tree-IL type, @code{<const>}, which has two fields,
@code{src} and @code{exp}. Instances of this type are records created
via @code{make-const}, and whose fields are accessed as
@code{const-src}, and @code{const-exp}. There is also a predicate,
@code{const?}. @xref{Records}, for more information on records.
Expressions of GHIL name their environments explicitly, and all
variables are referenced by identity in addition to by name.
@code{(language ghil)} defines a number of routines to deal explicitly
with variables and environments:
@c alpha renaming
@deftp {Scheme Variable} <ghil-toplevel-env> [table='()]
A toplevel environment. The @var{table} holds all toplevel variables
that have been resolved in this environment.
@end deftp
@deftp {Scheme Variable} <ghil-env> parent [table='()] [variables='()]
A lexical environment. @var{parent} will be the enclosing lexical
environment, or a toplevel environment. @var{table} holds an alist
mapping symbols to variables bound in this environment, while
@var{variables} holds a cumulative list of all variables ever defined
in this environment.
All Tree-IL types have a @code{src} slot, which holds source location
information for the expression. This information, if present, will be
residualized into the compiled object code, allowing backtraces to
show source information. The format of @code{src} is the same as that
returned by Guile's @code{source-properties} function. @xref{Source
Properties}, for more information.
Lexical environments correspond to procedures. Bindings introduced
e.g. by Scheme's @code{let} add to the bindings in a lexical
environment. An example of a case in which a variable might be in
@var{variables} but not in @var{table} would be a variable that is in
the same procedure, but is out of scope.
@end deftp
@deftp {Scheme Variable} <ghil-var> env name kind [index=#f]
A variable. @var{kind} is one of @code{argument}, @code{local},
@code{external}, @code{toplevel}, @code{public}, or @code{private};
see the procedures below for more information. @var{index} is used in
compilation.
@end deftp
@deffn {Scheme Procedure} ghil-var-is-bound? env sym
Recursively look up a variable named @var{sym} in @var{env}, and
return it or @code{#f} if none is found.
@end deffn
@deffn {Scheme Procedure} ghil-var-for-ref! env sym
Recursively look up a variable named @var{sym} in @var{env}, and
return it. If the symbol was not bound, return a new toplevel
variable.
@end deffn
@deffn {Scheme Procedure} ghil-var-for-set! env sym
Like @code{ghil-var-for-ref!}, except that the returned variable will
be marked as @code{external}. @xref{Variables and the VM}.
@end deffn
@deffn {Scheme Procedure} ghil-var-define! toplevel-env sym
Return an existing or new toplevel variable named @var{sym}.
@var{toplevel-env} must be a toplevel environment.
@end deffn
@deffn {Scheme Procedure} ghil-var-at-module! env modname sym interface?
Return a variable that will be resolved at run-time with respect to a
specific module named @var{modname}. If @var{interface?} is true, the
variable will be of type @code{public}, otherwise @code{private}.
@end deffn
@deffn {Scheme Procedure} call-with-ghil-environment env syms func
Bind @var{syms} to fresh variables within a new lexical environment
whose parent is @var{env}, and call @var{func} as @code{(@var{func}
@var{new-env} @var{new-vars})}.
@end deffn
@deffn {Scheme Procedure} call-with-ghil-bindings env syms func
Like @code{call-with-ghil-environment}, except the existing
environment @var{env} is re-used. For that reason, @var{func} is
invoked as @code{(@var{func} @var{new-vars})}
@end deffn
In the aforementioned @code{<ghil-quote>} type, the @var{env} slot
holds a pointer to the environment in which the expression occurs. The
@var{loc} slot holds source location information, so that errors
corresponding to this expression can be mapped back to the initial
expression in the higher-level language, e.g. Scheme. @xref{Compiled
Procedures}, for more information on source location objects.
GHIL also has a declarative serialization format, which makes writing
and reading it a tractable problem for the human mind. Since all GHIL
language constructs contain @code{env} and @code{loc} pointers, they
are left out of the serialization. (Serializing @code{env} structures
would be difficult, as they are often circular.) What is left is the
type of expression, and the remaining slots defined in the expression
type.
For example, an S-expression representation of the @code{<ghil-quote>}
expression would be:
Although Tree-IL objects are represented internally using records,
there is also an equivalent S-expression external representation for
each kind of Tree-IL. For example, an the S-expression representation
of @code{#<const src: #f exp: 3>} expression would be:
@example
(quote 3)
(const 3)
@end example
It's deceptively like Scheme. The general rule is, for a type defined
as @code{<ghil-@var{foo}> env loc @var{slot1} @var{slot2}...}, the
S-expression representation will be @code{(@var{foo} @var{slot1}
@var{slot2}...)}. Users may program with this format directly at the
REPL:
Users may program with this format directly at the REPL:
@example
scheme@@(guile-user)> ,language ghil
Guile High Intermediate Language (GHIL) interpreter 0.3 on Guile 1.9.0
scheme@@(guile-user)> ,language tree-il
Tree Intermediate Language interpreter 1.0 on Guile 1.9.0
Copyright (C) 2001-2008 Free Software Foundation, Inc.
Enter `,help' for help.
ghil@@(guile-user)> (call (ref +) (quote 32) (quote 10))
tree-il@@(guile-user)> (apply (primitive +) (const 32) (const 10))
@result{} 42
@end example
For convenience, some slots are serialized as rest arguments; those
are noted below. The other caveat is that variables are serialized as
their names only, and not their identities.
The @code{src} fields are left out of the external representation.
@deftp {Scheme Variable} <ghil-void> env loc
The unspecified value.
@end deftp
@deftp {Scheme Variable} <ghil-quote> env loc exp
A quoted expression.
One may create Tree-IL objects from their external representations via
calling @code{parse-tree-il}, the reader for Tree-IL. If any source
information is attached to the input S-expression, it will be
propagated to the resulting Tree-IL expressions. This is probably the
easiest way to compile to Tree-IL: just make the appropriate external
representations in S-expression format, and let @code{parse-tree-il}
take care of the rest.
Note that unlike in Scheme, there are no self-quoting expressions; all
constants must come from @code{quote} expressions.
@deftp {Scheme Variable} <void> src
@deftpx {External Representation} (void)
An empty expression. In practice, equivalent to Scheme's @code{(if #f
#f)}.
@end deftp
@deftp {Scheme Variable} <ghil-quasiquote> env loc exp
A quasiquoted expression. The expression is treated as a constant,
except for embedded @code{unquote} and @code{unquote-splicing} forms.
@deftp {Scheme Variable} <const> src exp
@deftpx {External Representation} (const @var{exp})
A constant.
@end deftp
@deftp {Scheme Variable} <ghil-unquote> env loc exp
Like Scheme's @code{unquote}; only valid within a quasiquote.
@deftp {Scheme Variable} <primitive-ref> src name
@deftpx {External Representation} (primitive @var{name})
A reference to a ``primitive''. A primitive is a procedure that, when
compiled, may be open-coded. For example, @code{cons} is usually
recognized as a primitive, so that it compiles down to a single
instruction.
Compilation of Tree-IL usually begins with a pass that resolves some
@code{<module-ref>} and @code{<toplevel-ref>} expressions to
@code{<primitive-ref>} expressions. The actual compilation pass
has special cases for applications of certain primitives, like
@code{apply} or @code{cons}.
@end deftp
@deftp {Scheme Variable} <ghil-unquote-splicing> env loc exp
Like Scheme's @code{unquote-splicing}; only valid within a quasiquote.
@deftp {Scheme Variable} <lexical-ref> src name gensym
@deftpx {External Representation} (lexical @var{name} @var{gensym})
A reference to a lexically-bound variable. The @var{name} is the
original name of the variable in the source program. @var{gensym} is a
unique identifier for this variable.
@end deftp
@deftp {Scheme Variable} <ghil-ref> env loc var
A variable reference. Note that for purposes of serialization,
@var{var} is serialized as its name, as a symbol.
@deftp {Scheme Variable} <lexical-set> src name gensym exp
@deftpx {External Representation} (set! (lexical @var{name} @var{gensym}) @var{exp})
Sets a lexically-bound variable.
@end deftp
@deftp {Scheme Variable} <ghil-set> env loc var val
A variable mutation. @var{var} is serialized as a symbol.
@deftp {Scheme Variable} <module-ref> src mod name public?
@deftpx {External Representation} (@@ @var{mod} @var{name})
@deftpx {External Representation} (@@@@ @var{mod} @var{name})
A reference to a variable in a specific module. @var{mod} should be
the name of the module, e.g. @code{(guile-user)}.
If @var{public?} is true, the variable named @var{name} will be looked
up in @var{mod}'s public interface, and serialized with @code{@@};
otherwise it will be looked up among the module's private bindings,
and is serialized with @code{@@@@}.
@end deftp
@deftp {Scheme Variable} <ghil-define> env loc var val
A toplevel variable definition. See @code{ghil-var-define!}.
@deftp {Scheme Variable} <module-set> src mod name public? exp
@deftpx {External Representation} (set! (@@ @var{mod} @var{name}) @var{exp})
@deftpx {External Representation} (set! (@@@@ @var{mod} @var{name}) @var{exp})
Sets a variable in a specific module.
@end deftp
@deftp {Scheme Variable} <ghil-if> env loc test then else
@deftp {Scheme Variable} <toplevel-ref> src name
@deftpx {External Representation} (toplevel @var{name})
References a variable from the current procedure's module.
@end deftp
@deftp {Scheme Variable} <toplevel-set> src name exp
@deftpx {External Representation} (set! (toplevel @var{name}) @var{exp})
Sets a variable in the current procedure's module.
@end deftp
@deftp {Scheme Variable} <toplevel-define> src name exp
@deftpx {External Representation} (define (toplevel @var{name}) @var{exp})
Defines a new top-level variable in the current procedure's module.
@end deftp
@deftp {Scheme Variable} <conditional> src test then else
@deftpx {External Representation} (if @var{test} @var{then} @var{else})
A conditional. Note that @var{else} is not optional.
@end deftp
@deftp {Scheme Variable} <ghil-and> env loc . exps
Like Scheme's @code{and}.
@end deftp
@deftp {Scheme Variable} <ghil-or> env loc . exps
Like Scheme's @code{or}.
@end deftp
@deftp {Scheme Variable} <ghil-begin> env loc . body
Like Scheme's @code{begin}.
@end deftp
@deftp {Scheme Variable} <ghil-bind> env loc vars exprs . body
Like a deconstructed @code{let}: each element of @var{vars} will be
bound to the corresponding GHIL expression in @var{exprs}.
Note that for purposes of the serialization format, @var{exprs} are
evaluated before the new bindings are added to the environment. For
@code{letrec} semantics, there also exists a @code{bindrec} parse
flavor. This is useful for writing GHIL at the REPL, but the
serializer does not currently have the cleverness needed to determine
whether a @code{<ghil-bind>} has @code{let} or @code{letrec}
semantics, and thus only serializes @code{<ghil-bind>} as @code{bind}.
@end deftp
@deftp {Scheme Variable} <ghil-mv-bind> env loc vars rest producer . body
Like Scheme's @code{receive} -- binds the values returned by
applying @code{producer}, which should be a thunk, to the
@code{lambda}-like bindings described by @var{vars} and @var{rest}.
@end deftp
@deftp {Scheme Variable} <ghil-lambda> env loc vars rest meta . body
A closure. @var{vars} is the argument list, serialized as a list of
symbols. @var{rest} is a boolean, which is @code{#t} iff the last
argument is a rest argument. @var{meta} is an association list of
properties. The actual @var{body} should be a list of GHIL
expressions.
@end deftp
@deftp {Scheme Variable} <ghil-call> env loc proc . args
@deftp {Scheme Variable} <application> src proc args
@deftpx {External Representation} (apply @var{proc} . @var{args})
A procedure call.
@end deftp
@deftp {Scheme Variable} <ghil-mv-call> env loc producer consumer
Like Scheme's @code{call-with-values}.
@deftp {Scheme Variable} <sequence> src exps
@deftpx {External Representation} (begin . @var{exps})
Like Scheme's @code{begin}.
@end deftp
@deftp {Scheme Variable} <ghil-inline> env loc op . args
An inlined VM instruction. @var{op} should be the instruction name as
a symbol, and @var{args} should be its arguments, as GHIL expressions.
@deftp {Scheme Variable} <lambda> src names vars meta body
@deftpx {External Representation} (lambda @var{names} @var{vars} @var{meta} @var{body})
A closure. @var{names} is original binding form, as given in the
source code, which may be an improper list. @var{vars} are gensyms
corresponding to the @var{names}. @var{meta} is an association list of
properties. The actual @var{body} is a single Tree-IL expression.
@end deftp
@deftp {Scheme Variable} <ghil-values> env loc . values
Like Scheme's @code{values}.
@deftp {Scheme Variable} <let> src names vars vals exp
@deftpx {External Representation} (let @var{names} @var{vars} @var{vals} @var{exp})
Lexical binding, like Scheme's @code{let}. @var{names} are the
original binding names, @var{vars} are gensyms corresponding to the
@var{names}, and @var{vals} are Tree-IL expressions for the values.
@var{exp} is a single Tree-IL expression.
@end deftp
@deftp {Scheme Variable} <ghil-values*> env loc . values
@var{values} are as in the Scheme expression, @code{(apply values .
@var{vals})}.
@end deftp
@deftp {Scheme Variable} <ghil-reified-env> env loc
Produces, at run-time, a reification of the environment at compile
time. Used in the implementation of Scheme's
@code{compile-time-environment}.
@deftp {Scheme Variable} <letrec> src names vars vals exp
@deftpx {External Representation} (letrec @var{names} @var{vars} @var{vals} @var{exp})
A version of @code{<let>} that creates recursive bindings, like
Scheme's @code{letrec}.
@end deftp
GHIL implements a compiler to GLIL that recursively traverses GHIL
expressions, writing out GLIL expressions into a linear list. The
compiler also keeps some state as to whether the current expression is
in tail context, and whether its value will be used in future
computations. This state allows the compiler not to emit code for
constant expressions that will not be used (e.g. docstrings), and to
perform tail calls when in tail position.
There are two Tree-IL constructs that are not normally produced by
higher-level compilers, but instead are generated during the
source-to-source optimization and analysis passes that the Tree-IL
compiler does. Users should not generate these expressions directly,
unless they feel very clever, as the default analysis pass will
generate them as necessary.
Just as the Scheme to GHIL compiler introduced new hidden state---the
environment---the GHIL to GLIL compiler introduces more state, the
stack. While not represented explicitly, the stack is present in the
compilation of each GHIL expression: compiling a GHIL expression
should leave the run-time value stack in the same state. For example,
if the intermediate value stack has two elements before evaluating an
@code{if} expression, it should have two elements after that
expression.
@deftp {Scheme Variable} <let-values> src names vars exp body
@deftpx {External Representation} (let-values @var{names} @var{vars} @var{exp} @var{body})
Like Scheme's @code{receive} -- binds the values returned by
evaluating @code{exp} to the @code{lambda}-like bindings described by
@var{vars}. That is to say, @var{vars} may be an improper list.
@code{<let-values>} is an optimization of @code{<application>} of the
primitive, @code{call-with-values}.
@end deftp
@deftp {Scheme Variable} <fix> src names vars vals body
@deftpx {External Representation} (fix @var{names} @var{vars} @var{vals} @var{body})
Like @code{<letrec>}, but only for @var{vals} that are unset
@code{lambda} expressions.
@code{fix} is an optimization of @code{letrec} (and @code{let}).
@end deftp
Tree-IL implements a compiler to GLIL that recursively traverses
Tree-IL expressions, writing out GLIL expressions into a linear list.
The compiler also keeps some state as to whether the current
expression is in tail context, and whether its value will be used in
future computations. This state allows the compiler not to emit code
for constant expressions that will not be used (e.g. docstrings), and
to perform tail calls when in tail position.
Most optimization, such as it currently is, is performed on Tree-IL
expressions as source-to-source transformations. There will be more
optimizations added in the future.
Interested readers are encouraged to read the implementation in
@code{(language ghil compile-glil)} for more details.
@code{(language tree-il compile-glil)} for more details.
@node GLIL
@subsection GLIL
Guile Low Intermediate Language (GLIL) is a structured intermediate
language whose expressions closely mirror the functionality of Guile's
VM instruction set.
language whose expressions more closely approximate Guile's VM
instruction set. Its expression types are defined in @code{(language
glil)}.
Its expression types are defined in @code{(language glil)}, and as
with GHIL, some of its fields parse as rest arguments.
@deftp {Scheme Variable} <glil-program> nargs nrest nlocs nexts meta . body
@deftp {Scheme Variable} <glil-program> nargs nrest nlocs meta . body
A unit of code that at run-time will correspond to a compiled
procedure. @var{nargs} @var{nrest} @var{nlocs}, and @var{nexts}
collectively define the program's arity; see @ref{Compiled
Procedures}, for more information. @var{meta} should be an alist of
properties, as in @code{<ghil-lambda>}. @var{body} is a list of GLIL
procedure. @var{nargs} @var{nrest} and @var{nlocs} collectively define
the program's arity; see @ref{Compiled Procedures}, for more
information. @var{meta} should be an alist of properties, as in
Tree-IL's @code{<lambda>}. @var{body} is an ordered list of GLIL
expressions.
@end deftp
@deftp {Scheme Variable} <glil-bind> . vars
@ -534,37 +478,34 @@ offset within a VM program.
@end deftp
@deftp {Scheme Variable} <glil-source> loc
Records source information for the preceding expression. @var{loc}
should be a vector, @code{#(@var{line} @var{column} @var{filename})}.
should be an association list of containing @code{line} @code{column},
and @code{filename} keys, e.g. as returned by
@code{source-properties}.
@end deftp
@deftp {Scheme Variable} <glil-void>
Pushes the unspecified value on the stack.
Pushes ``the unspecified value'' on the stack.
@end deftp
@deftp {Scheme Variable} <glil-const> obj
Pushes a constant value onto the stack. @var{obj} must be a number,
string, symbol, keyword, boolean, character, or a pair or vector or
list thereof, or the empty list.
string, symbol, keyword, boolean, character, uniform array, the empty
list, or a pair or vector of constants.
@end deftp
@deftp {Scheme Variable} <glil-argument> op index
Accesses an argument on the stack. If @var{op} is @code{ref}, the
argument is pushed onto the stack; if it is @code{set}, the argument
is set from the top value on the stack, which is popped off.
@end deftp
@deftp {Scheme Variable} <glil-local> op index
Like @code{<glil-argument>}, but for local variables. @xref{Stack
Layout}, for more information.
@end deftp
@deftp {Scheme Variable} <glil-external> op depth index
Accesses a heap-allocated variable, addressed by @var{depth}, the nth
enclosing environment, and @var{index}, the variable's position within
the environment. @var{op} is @code{ref} or @code{set}.
@deftp {Scheme Variable} <glil-lexical> local? boxed? op index
Accesses a lexically bound variable. If the variable is not
@var{local?} it is free. All variables may have @code{ref} and
@code{set} as their @var{op}. Boxed variables may also have the
@var{op}s @code{box}, @code{empty-box}, and @code{fix}, which
correspond in semantics to the VM instructions @code{box},
@code{empty-box}, and @code{fix-closure}. @xref{Stack Layout}, for
more information.
@end deftp
@deftp {Scheme Variable} <glil-toplevel> op name
Accesses a toplevel variable. @var{op} may be @code{ref}, @code{set},
or @code{define}.
@end deftp
@deftp {Scheme Variable} <glil-module> op mod name public?
Accesses a variable within a specific module. See
@code{ghil-var-at-module!}, for more information.
Accesses a variable within a specific module. See Tree-IL's
@code{<module-ref>}, for more information.
@end deftp
@deftp {Scheme Variable} <glil-label> label
Creates a new label. @var{label} can be any Scheme value, and should
@ -599,7 +540,7 @@ Guile Lowlevel Intermediate Language (GLIL) interpreter 0.3 on Guile 1.9.0
Copyright (C) 2001-2008 Free Software Foundation, Inc.
Enter `,help' for help.
glil@@(guile-user)> (program 0 0 0 0 () (const 3) (call return 0))
glil@@(guile-user)> (program 0 0 0 () (const 3) (call return 1))
@result{} 3
@end example
@ -607,23 +548,146 @@ Just as in all of Guile's compilers, an environment is passed to the
GLIL-to-object code compiler, and one is returned as well, along with
the object code.
@node Object Code
@subsection Object Code
@node Assembly
@subsection Assembly
Object code is the serialization of the raw instruction stream of a
program, ready for interpretation by the VM. Procedures related to
object code are defined in the @code{(system vm objcode)} module.
Assembly is an S-expression-based, human-readable representation of
the actual bytecodes that will be emitted for the VM. As such, it is a
useful intermediate language both for compilation and for
decompilation.
Besides the fact that it is not a record-based language, assembly
differs from GLIL in four main ways:
@itemize
@item Labels have been resolved to byte offsets in the program.
@item Constants inside procedures have either been expressed as inline
instructions or cached in object arrays.
@item Procedures with metadata (source location information, liveness
extents, procedure names, generic properties, etc) have had their
metadata serialized out to thunks.
@item All expressions correspond directly to VM instructions -- i.e.,
there is no @code{<glil-lexical>} which can be a ref or a set.
@end itemize
Assembly is isomorphic to the bytecode that it compiles to. You can
compile to bytecode, then decompile back to assembly, and you have the
same assembly code.
The general form of assembly instructions is the following:
@lisp
(@var{inst} @var{arg} ...)
@end lisp
The @var{inst} names a VM instruction, and its @var{arg}s will be
embedded in the instruction stream. The easiest way to see assembly is
to play around with it at the REPL, as can be seen in this annotated
example:
@example
scheme@@(guile-user)> (compile '(lambda (x) (+ x x)) #:to 'assembly)
(load-program 0 0 0
() ; Labels
70 ; Length
#f ; Metadata
(make-false)
(make-false) ; object table for the returned lambda
(nop)
(nop) ; Alignment. Since assembly has already resolved its labels
(nop) ; to offsets, and programs must be 8-byte aligned since their
(nop) ; object code is mmap'd directly to structures, assembly
(nop) ; has to have the alignment embedded in it.
(nop)
(load-program
1
0
()
8
(load-program 0 0 0 () 21 #f
(load-symbol "x") ; Name and liveness extent for @code{x}.
(make-false)
(make-int8:0) ; Some instruction+arg combinations
(make-int8:0) ; have abbreviations.
(make-int8 6)
(list 0 5)
(list 0 1)
(make-eol)
(list 0 2)
(return))
; And here, the actual code.
(local-ref 0)
(local-ref 0)
(add)
(return)
(nop)
(nop))
; Return our new procedure.
(return))
@end example
Of course you can switch the REPL to assembly and enter in assembly
S-expressions directly, like with other languages, though it is more
difficult, given that the length fields have to be correct.
@node Bytecode and Objcode
@subsection Bytecode and Objcode
Finally, the raw bytes. There are actually two different ``languages''
here, corresponding to two different ways to represent the bytes.
``Bytecode'' represents code as uniform byte vectors, useful for
structuring and destructuring code on the Scheme level. Bytecode is
the next step down from assembly:
@example
scheme@@(guile-user)> (compile '(+ 32 10) #:to 'assembly)
@result{} (load-program 0 0 0 () 6 #f
(make-int8 32) (make-int8 10) (add) (return))
scheme@@(guile-user)> (compile '(+ 32 10) #:to 'bytecode)
@result{} #u8(0 0 0 0 6 0 0 0 0 0 0 0 0 0 0 0 10 32 10 10 120 52)
@end example
``Objcode'' is bytecode, but mapped directly to a C structure,
@code{struct scm_objcode}:
@example
struct scm_objcode @{
scm_t_uint8 nargs;
scm_t_uint8 nrest;
scm_t_uint16 nlocs;
scm_t_uint32 len;
scm_t_uint32 metalen;
scm_t_uint8 base[0];
@};
@end example
As one might imagine, objcode imposes a minimum length on the
bytecode. Also, the multibyte fields are in native endianness, which
makes objcode (and bytecode) system-dependent. Indeed, in the short
example above, all but the last 6 bytes were the program's header.
Objcode also has a couple of important efficiency hacks. First,
objcode may be mapped directly from disk, allowing compiled code to be
loaded quickly, often from the system's disk cache, and shared among
multiple processes. Secondly, objcode may be embedded in other
objcode, allowing procedures to have the text of other procedures
inlined into their bodies, without the need for separate allocation of
the code. Of course, the objcode object itself does need to be
allocated.
Procedures related to objcode are defined in the @code{(system vm
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.
@end deffn
@deffn {Scheme Procedure} bytecode->objcode bytecode nlocs nexts
@deffnx {C Function} scm_bytecode_to_objcode (bytecode, nlocs, nexts)
@deffn {Scheme Procedure} bytecode->objcode bytecode
@deffnx {C Function} scm_bytecode_to_objcode (bytecode,)
Makes a bytecode object from @var{bytecode}, which should be a
@code{u8vector}. @var{nlocs} and @var{nexts} denote the number of
stack and heap variables to reserve when this objcode is executed.
@code{u8vector}.
@end deffn
@deffn {Scheme Variable} load-objcode file
@ -631,21 +695,28 @@ stack and heap variables to reserve when this objcode is executed.
Load object code from a file named @var{file}. The file will be mapped
into memory via @code{mmap}, so this is a very fast operation.
On disk, object code has an eight-byte cookie prepended to it, so that
we will not execute arbitrary garbage. In addition, two more bytes are
reserved for @var{nlocs} and @var{nexts}.
On disk, object code has an sixteen-byte cookie prepended to it, to
prevent accidental loading of arbitrary garbage.
@end deffn
@deffn {Scheme Variable} write-objcode objcode file
@deffnx {C Function} scm_write_objcode (objcode)
Write object code out to a file, prepending the eight-byte cookie.
@end deffn
@deffn {Scheme Variable} objcode->u8vector objcode
@deffnx {C Function} scm_objcode_to_u8vector (objcode)
Copy object code out to a @code{u8vector} for analysis by Scheme. The
ten-byte header is included.
Copy object code out to a @code{u8vector} for analysis by Scheme.
@end deffn
@deffn {Scheme Variable} objcode->program objcode [external='()]
@deffnx {C Function} scm_objcode_to_program (objcode, external)
The following procedure is actually in @code{(system vm program)}, but
we'll mention it here:
@deffn {Scheme Variable} make-program objcode objtable [free-vars=#f]
@deffnx {C Function} scm_make_program (objcode, objtable, free_vars)
Load up object code into a Scheme program. The resulting program will
be a thunk that captures closure variables from @var{external}.
have @var{objtable} as its object table, which should be a vector or
@code{#f}, and will capture the free variables from @var{free-vars}.
@end deffn
Object code from a file may be disassembled at the REPL via the
@ -659,12 +730,25 @@ respect to the compilation environment. Normally the environment
propagates through the compiler transparently, but users may specify
the compilation environment manually as well:
@deffn {Scheme Procedure} make-objcode-env module externals
@deffn {Scheme Procedure} make-objcode-env module free-vars
Make an object code environment. @var{module} should be a Scheme
module, and @var{externals} should be a list of external variables.
module, and @var{free-vars} should be a vector of free variables.
@code{#f} is also a valid object code environment.
@end deffn
@node Writing New High-Level Languages
@subsection Writing New High-Level Languages
In order to integrate a new language @var{lang} into Guile's compiler
system, one has to create the module @code{(language @var{lang} spec)}
containing the language definition and referencing the parser,
compiler and other routines processing it. The module hierarchy in
@code{(language brainfuck)} defines a very basic Brainfuck
implementation meant to serve as easy-to-understand example on how to
do this. See for instance @url{http://en.wikipedia.org/wiki/Brainfuck}
for more information about the Brainfuck language itself.
@node Extending the Compiler
@subsection Extending the Compiler
@ -687,12 +771,14 @@ procedure is called a certain number of times.
The name of the game is a profiling-based harvest of the low-hanging
fruit, running programs of interest under a system-level profiler and
determining which improvements would give the most bang for the buck.
There are many well-known efficiency hacks in the literature: Dybvig's
letrec optimization, individual boxing of heap-allocated values (and
then store the boxes on the stack directory), optimized case-lambda
expressions, stack underflow and overflow handlers, etc. Highly
recommended papers: Dybvig's HOCS, Ghuloum's compiler paper.
It's really getting to the point though that native compilation is the
next step.
The compiler also needs help at the top end, enhancing the Scheme that
it knows to also understand R6RS, and adding new high-level compilers:
Emacs Lisp, Lua, JavaScript...
it knows to also understand R6RS, and adding new high-level compilers.
We have JavaScript and Emacs Lisp mostly complete, but they could use
some love; Lua would be nice as well, butq whatever language it is
that strikes your fancy would be welcome too.
Compilers are for hacking, not for admiring or for complaining about.
Get to it!

View file

@ -470,12 +470,12 @@ You can get the version number by invoking the command
@example
$ guile --version
Guile 1.4.1
Copyright (c) 1995, 1996, 1997, 2000, 2006 Free Software Foundation
Guile may be distributed under the terms of the GNU General Public License;
certain other uses are permitted as well. For details, see the file
`COPYING', which is included in the Guile distribution.
There is no warranty, to the extent permitted by law.
Guile 1.9.0
Copyright (c) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation
Guile may be distributed under the terms of the GNU Lesser General
Public Licence. For details, see the files `COPYING.LESSER' and
`COPYING', which are included in the Guile distribution. There is no
warranty, to the extent permitted by law.
@end example
@item

View file

@ -182,7 +182,7 @@ As explained above, the @code{SCM} type can represent all Scheme values.
Some values fit entirely into a @code{SCM} value (such as small
integers), but other values require additional storage in the heap (such
as strings and vectors). This additional storage is managed
automatically by Guile. You don't need to explicitely deallocate it
automatically by Guile. You don't need to explicitly deallocate it
when a @code{SCM} value is no longer used.
Two things must be guaranteed so that Guile is able to manage the

View file

@ -1909,10 +1909,6 @@ for termination, not stopping.
If a signal occurs while in a system call, deliver the signal then
restart the system call (as opposed to returning an @code{EINTR} error
from that call).
Guile always enables this flag where available, no matter what
@var{flags} are specified. This avoids spurious error returns in low
level operations.
@end defvar
The return value is a pair with information about the old handler as

View file

@ -159,12 +159,12 @@ person would want to do.
@itemize @bullet
@item
The Guile library (libguile) and supporting files are published under
the terms of the GNU Lesser General Public License version 2.1. See
the file @file{COPYING.LIB}.
the terms of the GNU Lesser General Public License version 3 or later.
See the files @file{COPYING.LESSER} and @file{COPYING}.
@item
The Guile readline module is published under the terms of the GNU
General Public License version 2. See the file @file{COPYING}.
General Public License version 3 or later. See the file @file{COPYING}.
@item
The manual you're now reading is published under the terms of the GNU

View file

@ -47,6 +47,7 @@ get the relevant SRFI documents from the SRFI home page
* SRFI-61:: A more general `cond' clause
* SRFI-69:: Basic hash tables.
* SRFI-88:: Keyword objects.
* SRFI-98:: Accessing environment variables.
@end menu
@ -3608,6 +3609,25 @@ Return the keyword object whose name is @var{str}.
@end example
@end deffn
@node SRFI-98
@subsection SRFI-98 Accessing environment variables.
@cindex SRFI-98
@cindex environment variables
This is a portable wrapper around Guile's built-in support for
interacting with the current environment, @xref{Runtime Environment}.
@deffn {Scheme Procedure} get-environment-variable name
Returns a string containing the value of the environment variable
given by the string @code{name}, or @code{#f} if the named
environment variable is not found. This is equivalent to
@code{(getenv name)}.
@end deffn
@deffn {Scheme Procedure} get-environment-variables
Returns the names and values of all the environment variables as an
association list in which both the keys and the values are strings.
@end deffn
@c srfi-modules.texi ends here

View file

@ -13,8 +13,8 @@ procedures can call each other as they please.
The difference is that the compiler creates and interprets bytecode
for a custom virtual machine, instead of interpreting the
S-expressions directly. Running compiled code is faster than running
interpreted code.
S-expressions directly. Loading and running compiled code is faster
than loading and running source code.
The virtual machine that does the bytecode interpretation is a part of
Guile itself. This section describes the nature of Guile's virtual
@ -111,7 +111,7 @@ The registers that a VM has are as follows:
In other architectures, the instruction pointer is sometimes called
the ``program counter'' (pc). This set of registers is pretty typical
for stack machines; their exact meanings in the context of Guile's VM
is described in the next section.
are described in the next section.
A virtual machine executes by loading a compiled procedure, and
executing the object code associated with that procedure. Of course,
@ -119,19 +119,22 @@ that procedure may call other procedures, tail-call others, ad
infinitum---indeed, within a guile whose modules have all been
compiled to object code, one might never leave the virtual machine.
@c wingo: I wish the following were true, but currently we just use
@c the one engine. This kind of thing is possible tho.
@c wingo: The following is true, but I don't know in what context to
@c describe it. A documentation FIXME.
@c A VM may have one of three engines: reckless, regular, or debugging.
@c Reckless engine is fastest but dangerous. Regular engine is normally
@c fail-safe and reasonably fast. Debugging engine is safest and
@c functional but very slow.
@c (Actually we have just a regular and a debugging engine; normally
@c we use the latter, it's almost as fast as the ``regular'' engine.)
@node Stack Layout
@subsection Stack Layout
While not strictly necessary to understand how to work with the VM, it
is instructive and sometimes entertaining to consider the struture of
is instructive and sometimes entertaining to consider the structure of
the VM stack.
Logically speaking, a VM stack is composed of ``frames''. Each frame
@ -156,12 +159,11 @@ The structure of the fixed part of an application frame is as follows:
@example
Stack
| | <- fp + bp->nargs + bp->nlocs + 4
| | <- fp + bp->nargs + bp->nlocs + 3
+------------------+ = SCM_FRAME_UPPER_ADDRESS (fp)
| Return address |
| MV return address|
| Dynamic link |
| External link | <- fp + bp->nargs + bp->nlocs
| Dynamic link | <- fp + bp->nargs + bp->nlocs
| Local variable 1 | = SCM_FRAME_DATA_ADDRESS (fp)
| Local variable 0 | <- fp + bp->nargs
| Argument 1 |
@ -174,7 +176,7 @@ The structure of the fixed part of an application frame is as follows:
In the above drawing, the stack grows upward. The intermediate values
stored in the application of this frame are stored above
@code{SCM_FRAME_UPPER_ADDRESS (fp)}. @code{bp} refers to the
@code{struct scm_program*} data associated with the program at
@code{struct scm_objcode} data associated with the program at
@code{fp - 1}. @code{nargs} and @code{nlocs} are properties of the
compiled procedure, which will be discussed later.
@ -198,25 +200,17 @@ values being returned.
@item Dynamic link
This is the @code{fp} in effect before this program was applied. In
effect, this and the return address are the registers that are always
``saved''.
@item External link
This field is a reference to the list of heap-allocated variables
associated with this frame. For a discussion of heap versus stack
allocation, @xref{Variables and the VM}.
``saved''. The dynamic link links the current frame to the previous
frame; computing a stack trace involves traversing these frames.
@item Local variable @var{n}
Lambda-local variables that are allocated on the stack are all
allocated as part of the frame. This makes access to non-captured,
non-mutated variables very cheap.
Lambda-local variables that are all allocated as part of the frame.
This makes access to variables very cheap.
@item Argument @var{n}
The calling convention of the VM requires arguments of a function
application to be pushed on the stack, and here they are. Normally
references to arguments dispatch to these locations on the stack.
However if an argument has to be stored on the heap, it will be copied
from its initial value here onto a location in the heap, and
thereafter only referenced on the heap.
application to be pushed on the stack, and here they are. References
to arguments dispatch to these locations on the stack.
@item Program
This is the program being applied. For more information on how
@ -226,40 +220,51 @@ programs are implemented, @xref{VM Programs}.
@node Variables and the VM
@subsection Variables and the VM
Let's think about the following Scheme code as an example:
Consider the following Scheme code as an example:
@example
(define (foo a)
(lambda (b) (list foo a b)))
@end example
Within the lambda expression, "foo" is a top-level variable, "a" is a
lexically captured variable, and "b" is a local variable.
Within the lambda expression, @code{foo} is a top-level variable, @code{a} is a
lexically captured variable, and @code{b} is a local variable.
That is to say: @code{b} may safely be allocated on the stack, as
there is no enclosed procedure that references it, nor is it ever
mutated.
Another way to refer to @code{a} and @code{b} is to say that @code{a}
is a ``free'' variable, since it is not defined within the lambda, and
@code{b} is a ``bound'' variable. These are the terms used in the
@dfn{lambda calculus}, a mathematical notation for describing
functions. The lambda calculus is useful because it allows one to
prove statements about functions. It is especially good at describing
scope relations, and it is for that reason that we mention it here.
@code{a}, on the other hand, is referenced by an enclosed procedure,
that of the lambda. Thus it must be allocated on the heap, as it may
(and will) outlive the dynamic extent of the invocation of @code{foo}.
Guile allocates all variables on the stack. When a lexically enclosed
procedure with free variables---a @dfn{closure}---is created, it
copies those variables its free variable vector. References to free
variables are then redirected through the free variable vector.
@code{foo} is a toplevel variable, as mandated by Scheme's semantics:
If a variable is ever @code{set!}, however, it will need to be
heap-allocated instead of stack-allocated, so that different closures
that capture the same variable can see the same value. Also, this
allows continuations to capture a reference to the variable, instead
of to its value at one point in time. For these reasons, @code{set!}
variables are allocated in ``boxes''---actually, in variable cells.
@xref{Variables}, for more information. References to @code{set!}
variables are indirected through the boxes.
@example
(define proc (foo 'bar)) ; assuming prev. definition of @code{foo}
(define foo 42) ; redefinition
(proc 'baz)
@result{} (42 bar baz)
@end example
Thus perhaps counterintuitively, what would seem ``closer to the
metal'', viz @code{set!}, actually forces an extra memory allocation
and indirection.
Note that variables that are mutated (via @code{set!}) must be
allocated on the heap, even if they are local variables. This is
because any called subprocedure might capture the continuation, which
would need to capture locations instead of values. Thus perhaps
counterintuitively, what would seem ``closer to the metal'', viz
@code{set!}, actually forces heap allocation instead of stack
allocation.
Going back to our example, @code{b} may be allocated on the stack, as
it is never mutated.
@code{a} may also be allocated on the stack, as it too is never
mutated. Within the enclosed lambda, its value will be copied into
(and referenced from) the free variables vector.
@code{foo} is a top-level variable, because @code{foo} is not
lexically bound in this example.
@node VM Programs
@subsection Compiled Procedures are VM Programs
@ -276,6 +281,7 @@ You can pick apart these pieces with the accessors in @code{(system vm
program)}. @xref{Compiled Procedures}, for a full API reference.
@cindex object table
@cindex object array
The object array of a compiled procedure, also known as the
@dfn{object table}, holds all Scheme objects whose values are known
not to change across invocations of the procedure: constant strings,
@ -293,38 +299,33 @@ instruction, which uses the object vector, and are almost as fast as
local variable references.
We can see how these concepts tie together by disassembling the
@code{foo} function to see what is going on:
@code{foo} function we defined earlier to see what is going on:
@smallexample
scheme@@(guile-user)> (define (foo a) (lambda (b) (list foo a b)))
scheme@@(guile-user)> ,x foo
Disassembly of #<program foo (a)>:
Bytecode:
0 (local-ref 0) ;; `a' (arg)
2 (external-set 0) ;; `a' (arg)
4 (object-ref 0) ;; #<program #(0 28 #f) (b)>
6 (make-closure) at (unknown file):0:16
7 (return)
0 (object-ref 1) ;; #<program b7e478b0 at <unknown port>:0:16 (b)>
2 (local-ref 0) ;; `a' (arg)
4 (vector 0 1) ;; 1 element
7 (make-closure)
8 (return)
----------------------------------------
Disassembly of #<program #(0 28 #f) (b)>:
Disassembly of #<program b7e478b0 at <unknown port>:0:16 (b)>:
Bytecode:
0 (toplevel-ref 0) ;; `list'
2 (toplevel-ref 1) ;; `foo'
4 (external-ref 0) ;; (closure variable)
6 (local-ref 0) ;; `b' (arg)
8 (goto/args 3) at (unknown file):0:28
0 (toplevel-ref 1) ;; `foo'
2 (free-ref 0) ;; (closure variable)
4 (local-ref 0) ;; `b' (arg)
6 (list 0 3) ;; 3 elements at (unknown file):0:28
9 (return)
@end smallexample
At @code{ip} 0 and 2, we do the copy from argument to heap for
@code{a}. @code{Ip} 4 loads up the compiled lambda, and then at
@code{ip} 6 we make a closure---binding code (from the compiled
lambda) with data (the heap-allocated variables). Finally we return
the closure.
At @code{ip} 0, we load up the compiled lambda. @code{Ip} 2 and 4
create the free variables vector, and @code{ip} 7 makes the
closure---binding code (from the compiled lambda) with data (the
free-variable vector). Finally we return the closure.
The second stanza disassembles the compiled lambda. Toplevel variables
are resolved relative to the module that was current when the
@ -336,13 +337,14 @@ Control Instructions}, for more details.
Then we see a reference to an external variable, corresponding to
@code{a}. The disassembler doesn't have enough information to give a
name to that variable, so it just marks it as being a ``closure
variable''. Finally we see the reference to @code{b}, then a tail call
(@code{goto/args}) with three arguments.
variable''. Finally we see the reference to @code{b}, then the
@code{list} opcode, an inline implementation of the @code{list} scheme
routine.
@node Instruction Set
@subsection Instruction Set
There are about 100 instructions in Guile's virtual machine. These
There are about 150 instructions in Guile's virtual machine. These
instructions represent atomic units of a program's execution. Ideally,
they perform one task without conditional branches, then dispatch to
the next instruction in the stream.
@ -365,7 +367,8 @@ their own test-and-branch instructions:
@end example
In addition, some Scheme primitives have their own inline
implementations, e.g. @code{cons}.
implementations, e.g. @code{cons}, and @code{list}, as we saw in the
previous section.
So Guile's instruction set is a @emph{complete} instruction set, in
that it provides the instructions that are suited to the problem, and
@ -381,16 +384,22 @@ instructions. More instructions may be added over time.
* Miscellaneous Instructions::
* Inlined Scheme Instructions::
* Inlined Mathematical Instructions::
* Inlined Bytevector Instructions::
@end menu
@node Environment Control Instructions
@subsubsection Environment Control Instructions
These instructions access and mutate the environment of a compiled
procedure---the local bindings, the ``external'' bindings, and the
procedure---the local bindings, the free (captured) bindings, and the
toplevel bindings.
Some of these instructions have @code{long-} variants, the difference
being that they take 16-bit arguments, encoded in big-endianness,
instead of the normal 8-bit range.
@deffn Instruction local-ref index
@deffnx Instruction long-local-ref index
Push onto the stack the value of the local variable located at
@var{index} within the current stack frame.
@ -400,34 +409,65 @@ arguments.
@end deffn
@deffn Instruction local-set index
@deffnx Instruction long-local-ref index
Pop the Scheme object located on top of the stack and make it the new
value of the local variable located at @var{index} within the current
stack frame.
@end deffn
@deffn Instruction external-ref index
Push the value of the closure variable located at position
@var{index} within the program's list of external variables.
@deffn Instruction free-ref index
Push the value of the captured variable located at position
@var{index} within the program's vector of captured variables.
@end deffn
@deffn Instruction external-set index
Pop the Scheme object located on top of the stack and make it the new
value of the closure variable located at @var{index} within the
program's list of external variables.
@deffn Instruction free-boxed-ref index
@deffnx Instruction free-boxed-set index
Get or set a boxed free variable. Note that there is no free-set
instruction, as variables that are @code{set!} must be boxed.
These instructions assume that the value at position @var{index} in
the free variables vector is a variable.
@end deffn
The external variable lookup algorithm should probably be made more
efficient in the future via addressing by frame and index. Currently,
external variables are all consed onto a list, which results in O(N)
lookup time.
@deffn Instruction make-closure
Pop a vector and a program object off the stack, in that order, and
push a new program object with the given free variables vector. The
new program object shares state with the original program.
@deffn Instruction externals
Pushes the current list of external variables onto the stack. This
instruction is used in the implementation of
@code{compile-time-environment}. @xref{The Scheme Compiler}.
At the time of this writing, the space overhead of closures is 4 words
per closure.
@end deffn
@deffn Instruction fix-closure index
Pop a vector off the stack, and set it as the @var{index}th local
variable's free variable vector. The @var{index}th local variable is
assumed to be a procedure.
This instruction is part of a hack for allocating mutually recursive
procedures. The hack is to first perform a @code{local-set} for all of
the recursive procedures, then fix up the procedures' free variable
bindings in place. This allows most @code{letrec}-bound procedures to
be allocated unboxed on the stack.
One could of course do a @code{local-ref}, then @code{make-closure},
then @code{local-set}, but this macroinstruction helps to speed up the
common case.
@end deffn
@deffn Instruction box index
Pop a value off the stack, and set the @var{index}nth local variable
to a box containing that value. A shortcut for @code{make-variable}
then @code{local-set}, used when binding boxed variables.
@end deffn
@deffn Instruction empty-box index
Set the @var{indext}h local variable to a box containing a variable
whose value is unbound. Used when compiling some @code{letrec}
expressions.
@end deffn
@deffn Instruction toplevel-ref index
@deffnx Instruction long-toplevel-ref index
Push the value of the toplevel binding whose location is stored in at
position @var{index} in the object table.
@ -440,11 +480,11 @@ created.
Alternately, the lookup may be performed relative to a particular
module, determined at compile-time (e.g. via @code{@@} or
@code{@@@@}). In that case, the cell in the object table holds a list:
@code{(@var{modname} @var{sym} @var{interface?})}. The symbol
@var{sym} will be looked up in the module named @var{modname} (a list
of symbols). The lookup will be performed against the module's public
interface, unless @var{interface?} is @code{#f}, which it is for
example when compiling @code{@@@@}.
@code{(@var{modname} @var{sym} @var{public?})}. The symbol @var{sym}
will be looked up in the module named @var{modname} (a list of
symbols). The lookup will be performed against the module's public
interface, unless @var{public?} is @code{#f}, which it is for example
when compiling @code{@@@@}.
In any case, if the symbol is unbound, an error is signalled.
Otherwise the initial form is replaced with the looked-up variable, an
@ -455,13 +495,20 @@ variable has been successfully resolved.
This instruction pushes the value of the variable onto the stack.
@end deffn
@deffn Instruction toplevel-ref index
@deffn Instruction toplevel-set index
@deffnx Instruction long-toplevel-set index
Pop a value off the stack, and set it as the value of the toplevel
variable stored at @var{index} in the object table. If the variable
has not yet been looked up, we do the lookup as in
@code{toplevel-ref}.
@end deffn
@deffn Instruction define
Pop a symbol and a value from the stack, in that order. Look up its
binding in the current toplevel environment, creating the binding if
necessary. Set the variable to the value.
@end deffn
@deffn Instruction link-now
Pop a value, @var{x}, from the stack. Look up the binding for @var{x},
according to the rules for @code{toplevel-ref}, and push that variable
@ -481,8 +528,15 @@ Pop off two objects from the stack, a variable and a value, and set
the variable to the value.
@end deffn
@deffn Instruction make-variable
Replace the top object on the stack with a variable containing it.
Used in some circumstances when compiling @code{letrec} expressions.
@end deffn
@deffn Instruction object-ref n
Push @var{n}th value from the current program's object vector.
@deffnx Instruction long-object-ref n
Push @var{n}th value from the current program's object vector. The
``long'' variant has a 16-bit index instead of an 8-bit index.
@end deffn
@node Branch Instructions
@ -502,7 +556,10 @@ the one to which the instruction pointer points).
@end itemize
Note that the offset passed to the instruction is encoded on two 8-bit
integers which are then combined by the VM as one 16-bit integer.
integers which are then combined by the VM as one 16-bit integer. Note
also that jump targets in Guile are aligned on 8-byte boundaries, and
that the offset refers to the @var{n}th 8-byte boundary, effectively
giving Guile a 19-bit relative address space.
@deffn Instruction br offset
Jump to @var{offset}.
@ -546,81 +603,47 @@ the instruction pointer to the next VM instruction.
All of these loading instructions have a @code{length} parameter,
indicating the size of the embedded data, in bytes. The length itself
may be encoded in 1, 2, or 4 bytes.
is encoded in 3 bytes.
@deffn Instruction load-integer length
@deffnx Instruction load-unsigned-integer length
Load a 32-bit integer (respectively unsigned integer) from the
instruction stream.
@end deffn
@deffn Instruction load-number length
Load an arbitrary number from the instruction stream. The number is
embedded in the stream as a string.
@end deffn
@deffn Instruction load-string length
Load a string from the instruction stream.
Load a string from the instruction stream. The string is assumed to be
encoded in the ``latin1'' locale.
@end deffn
@deffn Instruction load-wide-string length
Load a UTF-32 string from the instruction stream. @var{length} is the
length in bytes, not in codepoints
@end deffn
@deffn Instruction load-symbol length
Load a symbol from the instruction stream.
Load a symbol from the instruction stream. The symbol is assumed to be
encoded in the ``latin1'' locale. Symbols backed by wide strings may
be loaded via @code{load-wide-string} then @code{make-symbol}.
@end deffn
@deffn Instruction load-keyword length
Load a keyword from the instruction stream.
@deffn Instruction load-array length
Load a uniform array from the instruction stream. The shape and type
of the array are popped off the stack, in that order.
@end deffn
@deffn Instruction define length
Load a symbol from the instruction stream, and look up its binding in
the current toplevel environment, creating the binding if necessary.
Push the variable corresponding to the binding.
@end deffn
@deffn Instruction load-program length
@deffn Instruction load-program
Load bytecode from the instruction stream, and push a compiled
procedure. This instruction pops the following values from the stack:
procedure.
@itemize
@item Optionally, a thunk, which when called should return metadata
associated with this program---for example its name, the names of its
arguments, its documentation string, debugging information, etc.
This instruction pops one value from the stack: the program's object
table, as a vector, or @code{#f} in the case that the program has no
object table. A program that does not reference toplevel bindings and
does not use @code{object-ref} does not need an object table.
Normally, this thunk its itself a compiled procedure (with no
metadata). Metadata is represented this way so that the initial load
of a procedure is fast: the VM just mmap's the thunk and goes. The
symbols and pairs associated with the metadata are only created if the
user asks for them.
This instruction is unlike the rest of the loading instructions,
because instead of parsing its data, it directly maps the instruction
stream onto a C structure, @code{struct scm_objcode}. @xref{Bytecode
and Objcode}, for more information.
For information on the format of the thunk's return value,
@xref{Compiled Procedures}.
@item Optionally, the program's object table, as a vector.
A program that does not reference toplevel bindings and does not use
@code{object-ref} does not need an object table.
@item Finally, either one immediate integer or four immediate integers
representing the arity of the program.
In the four-fixnum case, the values are respectively the number of
arguments taken by the function (@var{nargs}), the number of @dfn{rest
arguments} (@var{nrest}, 0 or 1), the number of local variables
(@var{nlocs}) and the number of external variables (@var{nexts})
(@pxref{Environment Control Instructions}).
The common single-fixnum case represents all of these values within a
16-bit bitmask.
@end itemize
The resulting compiled procedure will not have any ``external''
variables captured, so it will be loaded only once but may be used
many times to create closures.
@end deffn
Finally, while this instruction is not strictly a ``loading''
instruction, it's useful to wind up the @code{load-program} discussion
here:
@deffn Instruction make-closure
Pop the program object from the stack, capture the current set of
``external'' variables, and assign those external variables to a copy
of the program. Push the new program object, which shares state with
the original program. Also captures the current module.
The resulting compiled procedure will not have any free variables
captured, so it may be loaded only once but used many times to create
closures.
@end deffn
@node Procedural Instructions
@ -640,22 +663,24 @@ set to the returned value.
@deffn Instruction call nargs
Call the procedure located at @code{sp[-nargs]} with the @var{nargs}
arguments located from @code{sp[0]} to @code{sp[-nargs + 1]}.
arguments located from @code{sp[-nargs + 1]} to @code{sp[0]}.
For compiled procedures, this instruction sets up a new stack frame,
as described in @ref{Stack Layout}, and then dispatches to the first
instruction in the called procedure, relying on the called procedure
to return one value to the newly-created continuation. Because the new
frame pointer will point to sp[-nargs + 1], the arguments don't have
to be shuffled around -- they are already in place.
For non-compiled procedures (continuations, primitives, and
interpreted procedures), @code{call} will pop the procedure and
arguments off the stack, and push the result of calling
@code{scm_apply}.
For compiled procedures, this instruction sets up a new stack frame,
as described in @ref{Stack Layout}, and then dispatches to the first
instruction in the called procedure, relying on the called procedure
to return one value to the newly-created continuation.
@end deffn
@deffn Instruction goto/args nargs
Like @code{call}, but reusing the current continuation. This
instruction implements tail calling as required by RnRS.
instruction implements tail calls as required by RnRS.
For compiled procedures, that means that @code{goto/args} reuses the
current frame instead of building a new one. The @code{goto/*}
@ -726,14 +751,14 @@ values. This is an optimization for the common @code{(apply values
@deffn Instruction truncate-values nbinds nrest
Used in multiple-value continuations, this instruction takes the
values that are on the stack (including the number-of-value marker)
values that are on the stack (including the number-of-values marker)
and truncates them for a binding construct.
For example, a call to @code{(receive (x y . z) (foo) ...)} would,
logically speaking, pop off the values returned from @code{(foo)} and
push them as three values, corresponding to @code{x}, @code{y}, and
@code{z}. In that case, @var{nbinds} would be 3, and @var{nrest} would
be 1 (to indicate that one of the bindings was a rest arguments).
be 1 (to indicate that one of the bindings was a rest argument).
Signals an error if there is an insufficient number of values.
@end deffn
@ -760,6 +785,17 @@ Push the immediate value @code{1} onto the stack.
Push @var{value}, a 16-bit integer, onto the stack.
@end deffn
@deffn Instruction make-uint64 value
Push @var{value}, an unsigned 64-bit integer, onto the stack. The
value is encoded in 8 bytes, most significant byte first (big-endian).
@end deffn
@deffn Instruction make-int64 value
Push @var{value}, a signed 64-bit integer, onto the stack. The value
is encoded in 8 bytes, most significant byte first (big-endian), in
twos-complement arithmetic.
@end deffn
@deffn Instruction make-false
Push @code{#f} onto the stack.
@end deffn
@ -776,15 +812,30 @@ Push @code{'()} onto the stack.
Push @var{value}, an 8-bit character, onto the stack.
@end deffn
@deffn Instruction make-char32 value
Push @var{value}, an 32-bit character, onto the stack. The value is
encoded in big-endian order.
@end deffn
@deffn Instruction make-symbol
Pops a string off the stack, and pushes a symbol.
@end deffn
@deffn Instruction make-keyword value
Pops a symbol off the stack, and pushes a keyword.
@end deffn
@deffn Instruction list n
Pops off the top @var{n} values off of the stack, consing them up into
a list, then pushes that list on the stack. What was the topmost value
will be the last element in the list.
will be the last element in the list. @var{n} is a two-byte value,
most significant byte first.
@end deffn
@deffn Instruction vector n
Create and fill a vector with the top @var{n} values from the stack,
popping off those values and pushing on the resulting vector.
popping off those values and pushing on the resulting vector. @var{n}
is a two-byte value, like in @code{vector}.
@end deffn
@deffn Instruction mark
@ -817,7 +868,8 @@ pushes its elements on the stack.
@subsubsection Miscellaneous Instructions
@deffn Instruction nop
Does nothing!
Does nothing! Used for padding other instructions to certain
alignments.
@end deffn
@deffn Instruction halt
@ -850,9 +902,8 @@ Pushes ``the unspecified value'' onto the stack.
@subsubsection Inlined Scheme Instructions
The Scheme compiler can recognize the application of standard Scheme
procedures, or unbound variables that look like they are bound to
standard Scheme procedures. It tries to inline these small operations
to avoid the overhead of creating new stack frames.
procedures. It tries to inline these small operations to avoid the
overhead of creating new stack frames.
Since most of these operations are historically implemented as C
primitives, not inlining them would entail constantly calling out from
@ -876,14 +927,16 @@ stream.
@deffnx Instruction eqv? x y
@deffnx Instruction equal? x y
@deffnx Instruction pair? x y
@deffnx Instruction list? x y
@deffnx Instruction list? x
@deffnx Instruction set-car! pair x
@deffnx Instruction set-cdr! pair x
@deffnx Instruction slot-ref struct n
@deffnx Instruction slot-set struct n x
@deffnx Instruction cons x
@deffnx Instruction cons x y
@deffnx Instruction car x
@deffnx Instruction cdr x
@deffnx Instruction vector-ref x y
@deffnx Instruction vector-set x n y
Inlined implementations of their Scheme equivalents.
@end deffn
@ -904,7 +957,9 @@ As in the previous section, the definitions below show stack
parameters instead of instruction stream parameters.
@deffn Instruction add x y
@deffnx Instruction add1 x
@deffnx Instruction sub x y
@deffnx Instruction sub1 x
@deffnx Instruction mul x y
@deffnx Instruction div x y
@deffnx Instruction quo x y
@ -917,3 +972,58 @@ parameters instead of instruction stream parameters.
@deffnx Instruction ge? x y
Inlined implementations of the corresponding mathematical operations.
@end deffn
@node Inlined Bytevector Instructions
@subsubsection Inlined Bytevector Instructions
Bytevector operations correspond closely to what the current hardware
can do, so it makes sense to inline them to VM instructions, providing
a clear path for eventual native compilation. Without this, Scheme
programs would need other primitives for accessing raw bytes -- but
these primitives are as good as any.
As in the previous section, the definitions below show stack
parameters instead of instruction stream parameters.
The multibyte formats (@code{u16}, @code{f64}, etc) take an extra
endianness argument. Only aligned native accesses are currently
fast-pathed in Guile's VM.
@deffn Instruction bv-u8-ref bv n
@deffnx Instruction bv-s8-ref bv n
@deffnx Instruction bv-u16-native-ref bv n
@deffnx Instruction bv-s16-native-ref bv n
@deffnx Instruction bv-u32-native-ref bv n
@deffnx Instruction bv-s32-native-ref bv n
@deffnx Instruction bv-u64-native-ref bv n
@deffnx Instruction bv-s64-native-ref bv n
@deffnx Instruction bv-f32-native-ref bv n
@deffnx Instruction bv-f64-native-ref bv n
@deffnx Instruction bv-u16-ref bv n endianness
@deffnx Instruction bv-s16-ref bv n endianness
@deffnx Instruction bv-u32-ref bv n endianness
@deffnx Instruction bv-s32-ref bv n endianness
@deffnx Instruction bv-u64-ref bv n endianness
@deffnx Instruction bv-s64-ref bv n endianness
@deffnx Instruction bv-f32-ref bv n endianness
@deffnx Instruction bv-f64-ref bv n endianness
@deffnx Instruction bv-u8-set bv n val
@deffnx Instruction bv-s8-set bv n val
@deffnx Instruction bv-u16-native-set bv n val
@deffnx Instruction bv-s16-native-set bv n val
@deffnx Instruction bv-u32-native-set bv n val
@deffnx Instruction bv-s32-native-set bv n val
@deffnx Instruction bv-u64-native-set bv n val
@deffnx Instruction bv-s64-native-set bv n val
@deffnx Instruction bv-f32-native-set bv n val
@deffnx Instruction bv-f64-native-set bv n val
@deffnx Instruction bv-u16-set bv n val endianness
@deffnx Instruction bv-s16-set bv n val endianness
@deffnx Instruction bv-u32-set bv n val endianness
@deffnx Instruction bv-s32-set bv n val endianness
@deffnx Instruction bv-u64-set bv n val endianness
@deffnx Instruction bv-s64-set bv n val endianness
@deffnx Instruction bv-f32-set bv n val endianness
@deffnx Instruction bv-f64-set bv n val endianness
Inlined implementations of the corresponding bytevector operations.
@end deffn

View file

@ -4,20 +4,20 @@
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu

View file

@ -4,20 +4,20 @@
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
AUTOMAKE_OPTIONS = gnu

View file

@ -5,8 +5,7 @@
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 2.1 of the License, or (at your option) any later
;;;; version.
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of

View file

@ -5,8 +5,7 @@
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 2.1 of the License, or (at your option) any later
;;;; version.
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of

View file

@ -5,8 +5,7 @@
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 2.1 of the License, or (at your option) any later
;;;; version.
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of

View file

@ -2,20 +2,20 @@
;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Author: Thien-Thi Nguyen <ttn@gnu.org>
;;; Version: 1

View file

@ -2,20 +2,20 @@
;; Copyright (C) 2001, 2006 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
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Commentary:

View file

@ -2,20 +2,20 @@
;; Copyright (C) 2001 Keisuke Nishida <kxn30@po.cwru.edu>
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Code:

View file

@ -2,20 +2,20 @@
;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Commentary:

View file

@ -2,20 +2,20 @@
;; Copyright (C) 2001 Keisuke Nishida <kxn30@po.cwru.edu>
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Code:

View file

@ -2,22 +2,20 @@
;; Copyright (C) 2000, 2006 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Author: Mikael Djurfeldt <djurfeldt@nada.kth.se>

View file

@ -2,20 +2,20 @@
;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Author: Thien-Thi Nguyen <ttn@gnu.org>
;;; Version: 1

View file

@ -2,22 +2,20 @@
;; Copyright (C) 2000, 2006 Free Software Foundation, Inc.
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs 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 General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Author: Mikael Djurfeldt <djurfeldt@nada.kth.se>

View file

@ -2,20 +2,20 @@
;;; Copyright (C) 2001, 2006 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
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free
;;;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
;;;; 02111-1307 USA
;;; Commentary:

View file

@ -1,25 +1,95 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006, 2008 Free Software Foundation, Inc.
## Copyright (C) 2001, 2006, 2008, 2009 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## GUILE 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, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## GNU Lesser General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
## You should have received a copy of the GNU Lesser General Public
## License along with GUILE; see the file COPYING.LESSER. If not,
## write to the Free Software Foundation, Inc., 51 Franklin Street,
## Fifth Floor, Boston, MA 02110-1301 USA
SUBDIRS = scripts box box-module box-dynamic box-dynamic-module\
modules safe
EXTRA_DIST = README ChangeLog-2008 check.test \
\
scripts/README scripts/simple-hello.scm scripts/hello \
scripts/fact \
\
box/README box/box.c \
\
box-module/README box-module/box.c \
\
box-dynamic/README box-dynamic/box.c \
\
box-dynamic-module/README box-dynamic-module/box.c \
box-dynamic-module/box-module.scm box-dynamic-module/box-mixed.scm \
\
modules/README modules/module-0.scm modules/module-1.scm \
modules/module-2.scm modules/main \
\
safe/README safe/safe safe/untrusted.scm safe/evil.scm
EXTRA_DIST = README ChangeLog-2008
AM_CFLAGS = `PATH=$(bindir):$$PATH PKG_CONFIG_PATH=$(libdir)/pkgconfig $(bindir)/guile-config compile`
AM_LIBS = `PATH=$(bindir):$$PATH PKG_CONFIG_PATH=$(libdir)/pkgconfig $(bindir)/guile-config link`
box/box: box/box.o
-$(MKDIR_P) box
$(CC) $< $(AM_LIBS) -o $@
box/box.o: box/box.c
-$(MKDIR_P) box
$(CC) $(AM_CFLAGS) -c $< -o $@
box-module/box: box-module/box.o
-$(MKDIR_P) box-module
$(CC) $< $(AM_LIBS) -o $@
box-module/box.o: box-module/box.c
-$(MKDIR_P) box-module
$(CC) $(AM_CFLAGS) -c $< -o $@
libbox.la: box-dynamic/box.lo
$(top_builddir)/libtool --mode=link $(CC) $< $(AM_LIBS) -rpath $(libdir) -o $@
box-dynamic/box.lo: box-dynamic/box.c
-$(MKDIR_P) box-dynamic
$(top_builddir)/libtool --mode=compile $(CC) $(AM_CFLAGS) -c $< -o $@
libbox-module.la: box-dynamic-module/box.lo
$(top_builddir)/libtool --mode=link $(CC) $< $(AM_LIBS) -rpath $(libdir) -o $@
box-dynamic-module/box.lo: box-dynamic-module/box.c
-$(MKDIR_P) box-dynamic-module
$(top_builddir)/libtool --mode=compile $(CC) $(AM_CFLAGS) -c $< -o $@
installcheck: box/box box-module/box libbox.la libbox-module.la
LD_LIBRARY_PATH="$(libdir):$$LD_LIBRARY_PATH" \
LTDL_LIBRARY_PATH="$(builddir):$$LTDL_LIBRARY_PATH" \
GUILE_LOAD_PATH="$(abs_top_srcdir):$$GUILE_LOAD_PATH" \
PATH="$(bindir):$$PATH" \
GUILE_AUTO_COMPILE=0 \
srcdir="$(srcdir)" \
$(srcdir)/check.test
CLEANFILES = \
box/box box/box.o \
box-module/box box-module/box.o
clean-local:
$(top_builddir)/libtool --mode=clean rm -f \
box-dynamic/box.lo libbox.la \
box-dynamic-module/box.lo libbox-module.la

View file

@ -1,36 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README box.c box-module.scm box-mixed.scm check.test
CFLAGS=`$(bindir)/guile-config compile`
LIBS=`$(bindir)/guile-config link`
libbox-module: box.lo
sh ../../libtool --mode=link $(CC) $< $(LIBS) -rpath $(libdir) -o libbox-module.la
box.lo: box.c
sh ../../libtool --mode=compile $(CC) $(CFLAGS) -c $<
installcheck: libbox-module
LTDL_LIBRARY_PATH=.libs GUILE_LOAD_PATH=$(top_srcdir):$(srcdir) $(srcdir)/check.test
CLEANFILES=libbox-module.la box.lo box.o

View file

@ -2,20 +2,20 @@
*
* Copyright (C) 1998,2001, 2006 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* 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, 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 General Public License for more details.
* 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 General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Include all needed declarations. */

View file

@ -1,48 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
set -e
#
# ./box test #1
#
$guile -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box test #2
#
$guile -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box test #3
#
$guile -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
#
# ./box test #4
#
$guile -c '(begin (use-modules (box-mixed)) (let ((b (make-box-list 1 2 3))) (display b) (newline) (display (box-map 1+ b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
(#<box 1> #<box 2> #<box 3>)
(#<box 2> #<box 3> #<box 4>)
EOF
rm -f TMP
# check.test ends here

View file

@ -1,36 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README box.c check.test
CFLAGS=`$(bindir)/guile-config compile`
LIBS=`$(bindir)/guile-config link`
libbox: box.lo
sh ../../libtool --mode=link $(CC) $< $(LIBS) -rpath $(libdir) -o libbox.la
box.lo: box.c
sh ../../libtool --mode=compile $(CC) $(CFLAGS) -c $<
installcheck: libbox
LTDL_LIBRARY_PATH=.libs GUILE_LOAD_PATH=$(top_srcdir):$(srcdir) $(srcdir)/check.test
CLEANFILES=libbox.la box.lo box.o

View file

@ -2,20 +2,20 @@
*
* Copyright (C) 1998,2001, 2006 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* 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, 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 General Public License for more details.
* 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 General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Include all needed declarations. */

View file

@ -1,38 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
set -e
#
# ./box test #1
#
$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box test #2
#
$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box test #3
#
$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
# check.test ends here

View file

@ -1,36 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README box.c check.test
CFLAGS=`$(bindir)/guile-config compile`
LIBS=`$(bindir)/guile-config link`
box: box.o
$(CC) $< $(LIBS) -o box
box.o: box.c
$(CC) $(CFLAGS) -c $<
installcheck: box
LD_LIBRARY_PATH=$(libdir) GUILE_LOAD_PATH=$(top_srcdir) $(srcdir)/check.test
CLEANFILES=box box.o

View file

@ -2,20 +2,20 @@
*
* Copyright (C) 1998,2001, 2006 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* 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, 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 General Public License for more details.
* 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 General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Include all needed declarations. */

View file

@ -1,38 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
set -e
#
# ./box test #1
#
./box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box test #2
#
./box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box test #3
#
./box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
# check.test ends here

View file

@ -1,36 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README box.c check.test
CFLAGS=`$(bindir)/guile-config compile`
LIBS=`$(bindir)/guile-config link`
box: box.o
$(CC) $< $(LIBS) -o box
box.o: box.c
$(CC) $(CFLAGS) -c $<
installcheck: box
LD_LIBRARY_PATH=$(libdir) GUILE_LOAD_PATH=$(top_srcdir) $(srcdir)/check.test
CLEANFILES=box box.o

View file

@ -2,20 +2,20 @@
*
* Copyright (C) 1998,2001, 2006 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
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
* 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, 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 General Public License for more details.
* 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 General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* You should have received a copy of the GNU Lesser General Public
* License along with this software; see the file COPYING.LESSER. If
* not, write to the Free Software Foundation, Inc., 51 Franklin
* Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* Include all needed declarations. */

View file

@ -1,38 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
set -e
#
# ./box test #1
#
./box -c '(let ((b (make-box))) (display b) (newline))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box test #2
#
./box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box test #3
#
./box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
# check.test ends here

238
examples/check.test Executable file
View file

@ -0,0 +1,238 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../libguile/guile}
if [ -x $guile ] ; then
:
else
echo could not find guile interpreter.
echo '(are you running this script from' `dirname $0` '?)'
echo GUILE env var: ${GUILE-not set}
exit 1
fi
if test "X$srcdir" = X; then
srcdir=.
fi
set -e
#
# simple-hello.scm
#
$guile -s $srcdir/scripts/simple-hello.scm > TMP
cat <<EOF | diff -u - TMP
Hello, World!
EOF
rm -f TMP
#
# hello
#
$guile -s $srcdir/scripts/hello > TMP
echo "Hello, World!" | diff -u - TMP
rm -f TMP
$guile -s $srcdir/scripts/hello --version > TMP
echo "hello 0.0.1" | diff -u - TMP
rm -f TMP
$guile -s $srcdir/scripts/hello --help > TMP
cat <<EOF | diff -u - TMP
Usage: hello [options...]
--help, -h Show this usage information
--version, -v Show version information
EOF
rm -f TMP
#
# fact
#
case `$guile -s $srcdir/scripts/fact 5` in 120) ;; *) echo $0: error: fact 5 ;; esac
#
# ./box/box test #1
#
./box/box -c '(let ((b (make-box))) (display b) (newline))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box/box test #2
#
./box/box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box/box test #3
#
./box/box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
#
# ./box-module/box test #1
#
./box-module/box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box-module/box test #2
#
./box-module/box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box-module/box test #3
#
./box-module/box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
#
# ./box-dynamic/box test #1
#
$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box-dynamic/box test #2
#
$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box-dynamic/box test #3
#
$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
#
# ./box-dynamic-module/box test #1
#
$guile -L $srcdir/box-dynamic-module \
-c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
EOF
rm -f TMP
#
# ./box-dynamic-module/box test #2
#
$guile -L $srcdir/box-dynamic-module \
-c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
EOF
rm -f TMP
#
# ./box-dynamic-module/box test #3
#
$guile -L $srcdir/box-dynamic-module \
-c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
#<box #f>
#<box 1>
1
EOF
rm -f TMP
#
# ./box-dynamic-module/box test #4
#
$guile -L $srcdir/box-dynamic-module \
-c '(begin (use-modules (box-mixed)) (let ((b (make-box-list 1 2 3))) (display b) (newline) (display (box-map 1+ b)) (newline)))' > TMP
cat <<EOF | diff -u - TMP
(#<box 1> #<box 2> #<box 3>)
(#<box 2> #<box 3> #<box 4>)
EOF
rm -f TMP
#
# ./main test
#
$guile -L $srcdir/modules -s $srcdir/modules/main > TMP
cat <<EOF | diff -u - TMP
module-0 foo
module-0 bar
module-1 foo
module-1 bar
module-2 braz
module-2 braz
module-2 foo
EOF
rm -f TMP
#
# ./safe untrusted.scm
#
$guile -s $srcdir/safe/safe $srcdir/safe/untrusted.scm > TMP
cat <<EOF | diff -u - TMP
1
1
2
6
24
120
720
5040
40320
362880
3628800
EOF
rm -f TMP
#
# ./safe evil.scm
#
$guile -s $srcdir/safe/safe $srcdir/safe/evil.scm > TMP
cat <<EOF | diff -u - TMP
** Exception: (unbound-variable #f "Unbound variable: ~S" (open-input-file) #f)
EOF
rm -f TMP
# check.test ends here

View file

@ -5,9 +5,9 @@
/* Copyright (C) 2001, 2002, 2006, 2008 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
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* 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 library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -16,7 +16,8 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/

View file

@ -1,25 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README module-0.scm module-1.scm module-2.scm main check.test
installcheck:
srcdir=$(srcdir) GUILE_LOAD_PATH=$(top_srcdir):$(srcdir) $(srcdir)/check.test

View file

@ -1,27 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
if test "X$srcdir" = X; then
srcdir=.
fi
set -e
#
# ./main test
#
$guile -s $srcdir/main > TMP
cat <<EOF | diff -u - TMP
module-0 foo
module-0 bar
module-1 foo
module-1 bar
module-2 braz
module-2 braz
module-2 foo
EOF
rm -f TMP
# check.test ends here

View file

@ -1,25 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README safe untrusted.scm evil.scm check.test
installcheck:
srcdir=$(srcdir) GUILE_LOAD_PATH=$(top_srcdir) $(srcdir)/check.test

View file

@ -1,40 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
if test "X$srcdir" = X; then
srcdir=.
fi
set -e
#
# ./safe untrusted.scm
#
$guile -s $srcdir/safe $srcdir/untrusted.scm > TMP
cat <<EOF | diff -u - TMP
1
1
2
6
24
120
720
5040
40320
362880
3628800
EOF
rm -f TMP
#
# ./safe evil.scm
#
$guile -s $srcdir/safe $srcdir/evil.scm > TMP
cat <<EOF | diff -u - TMP
** Exception: (unbound-variable #f "Unbound variable: ~S" (open-input-file) #f)
EOF
rm -f TMP
# check.test ends here

View file

@ -1,25 +0,0 @@
## Process this file with Automake to create Makefile.in
##
## Copyright (C) 2001, 2006 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
EXTRA_DIST = README simple-hello.scm hello fact check.test
installcheck:
srcdir=$(srcdir) GUILE_LOAD_PATH=$(top_srcdir) $(srcdir)/check.test

View file

@ -1,53 +0,0 @@
#!/bin/sh
# must be run from this directory
guile=${GUILE-../../libguile/guile}
if [ -x $guile ] ; then
:
else
echo could not find guile interpreter.
echo '(are you running this script from' `dirname $0` '?)'
echo GUILE env var: ${GUILE-not set}
exit 1
fi
if test "X$srcdir" = X; then
srcdir=.
fi
set -e
#
# simple-hello.scm
#
$guile -s $srcdir/simple-hello.scm > TMP
cat <<EOF | diff -u - TMP
Hello, World!
EOF
rm -f TMP
#
# hello
#
$guile -s $srcdir/hello > TMP
echo "Hello, World!" | diff -u - TMP
rm -f TMP
$guile -s $srcdir/hello --version > TMP
echo "hello 0.0.1" | diff -u - TMP
rm -f TMP
$guile -s $srcdir/hello --help > TMP
cat <<EOF | diff -u - TMP
Usage: hello [options...]
--help, -h Show this usage information
--version, -v Show version information
EOF
rm -f TMP
#
# fact
#
case `$guile -s $srcdir/fact 5` in 120) ;; *) echo $0: error: fact 5 ;; esac
# check.test ends here

View file

@ -5,20 +5,20 @@ exec ${GUILE-guile} --no-debug -q -l "$0" \
!#
;;; Copyright (C) 2008 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
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; 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, 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 General Public License for more details.
;;; GNU Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this software; see the file COPYING. If not, write to
;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;; Boston, MA 02110-1301 USA
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this software; see the file COPYING.LESSER. If
;;; not, write to the Free Software Foundation, Inc., 51 Franklin
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(use-modules (ice-9 format)
(ice-9 rdelim)

View file

@ -6,20 +6,20 @@ exec ${GUILE-guile} -q -l "$0" \
!#
;;; Copyright (C) 2008 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
;;; the Free Software Foundation; either version 2, or (at your option)
;;; any later version.
;;; 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, 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 General Public License for more details.
;;; GNU Lesser General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this software; see the file COPYING. If not, write to
;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;;; Boston, MA 02110-1301 USA
;;; You should have received a copy of the GNU Lesser General Public
;;; License along with this software; see the file COPYING.LESSER. If
;;; not, write to the Free Software Foundation, Inc., 51 Franklin
;;; Street, Fifth Floor, Boston, MA 02110-1301 USA
(use-modules (ice-9 rdelim)
(ice-9 popen)
@ -233,7 +233,7 @@ Report bugs to <bug-guile@gnu.org>.~%"))
(ref-env (assoc-ref args 'reference-environment))
(bdwgc-env (or (assoc-ref args 'bdwgc-environment)
(string-append "GUILE=" bench-dir
"/../pre-inst-guile")))
"/../meta/guile")))
(prof-opts (assoc-ref args 'profile-options)))
(for-each (lambda (benchmark)
(let ((ref (parse-result (run-reference-guile ref-env

View file

@ -1,38 +0,0 @@
#!/bin/sh
# Copyright (C) 2002, 2006, 2008 Free Software Foundation
#
# This file is part of GUILE.
#
# GUILE is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or
# (at your option) any later version.
#
# GUILE 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with GUILE; see the file COPYING. If not, write
# to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
# Floor, Boston, MA 02110-1301 USA
# Commentary:
# Usage: gdb-pre-inst-guile [ARGS]
#
# This script runs Guile from the build tree under GDB. See
# ./pre-inst-guile for more information.
#
# In addition to running ./gdb-pre-inst-guile, sometimes it's useful to
# run e.g. ./check-guile -i ./gdb-pre-inst-guile foo.test.
# Code:
set -e
# env (set by configure)
top_builddir="@top_builddir_absolute@"
exec ${top_builddir}/pre-inst-guile-env libtool --mode=execute \
gdb --args ${top_builddir}/libguile/guile "$@"

View file

@ -148,11 +148,6 @@ define nextframe
output $vmdl
newline
set $vmsp=$vmsp-1
sputs "el:\t"
output $vmsp
sputs "\t"
gwrite *$vmsp
set $vmsp=$vmsp-1
set $vmnlocs=(int)$vmbp->nlocs
while $vmnlocs > 0
sputs "loc #"

View file

@ -1,46 +0,0 @@
## Process this file with Automake to create Makefile.in
## Jim Blandy <jimb@red-bean.com> --- September 1997
##
## Copyright (C) 1998, 1999, 2001, 2006, 2007, 2008 Free Software Foundation, Inc.
##
## This file is part of GUILE.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA
bin_SCRIPTS=guile-config
CLEANFILES=guile-config
EXTRA_DIST=guile-config.in guile.m4 ChangeLog-2008
## FIXME: in the future there will be direct automake support for
## doing this. When that happens, switch over.
aclocaldir = $(datadir)/aclocal
aclocal_DATA = guile.m4
## We use @-...-@ as the substitution brackets here, instead of the
## usual @...@, so autoconf doesn't go and substitute the values
## directly into the left-hand sides of the sed substitutions. *sigh*
guile-config: guile-config.in ${top_builddir}/libguile/libpath.h
rm -f guile-config.tmp
sed < ${srcdir}/guile-config.in > guile-config.tmp \
-e 's|@-bindir-@|${bindir}|' \
-e s:@-GUILE_VERSION-@:${GUILE_VERSION}:
chmod +x guile-config.tmp
mv guile-config.tmp guile-config
## Get rid of any copies of the configuration script under the old
## name, so people don't end up running ancient copies of it.
install-exec-local:
rm -f ${bindir}/build-guile

View file

@ -2,20 +2,20 @@
##
## Copyright (C) 1998, 1999, 2000, 2001, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
##
## This file is part of GUILE.
## This file is part of guile-readline.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## guile-readline is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 3, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## guile-readline 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
## General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## You should have received a copy of the GNU General Public License
## along with guile-readline; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA

View file

@ -7,7 +7,7 @@ AC_INIT(guile-readline,
]),
[bug-guile@gnu.org])
AC_CONFIG_AUX_DIR([.])
AC_CONFIG_AUX_DIR([../build-aux])
AC_CONFIG_SRCDIR(readline.c)
AM_CONFIG_HEADER([guile-readline-config.h])
AM_INIT_AUTOMAKE([foreign no-define])
@ -38,6 +38,7 @@ for termlib in ncurses curses termcap terminfo termlib ; do
[LIBS="-l${termlib} $LIBS"; break])
done
AC_LIB_LINKFLAGS(readline)
AC_CHECK_LIB(readline, readline)
if test $ac_cv_lib_readline_readline = no; then
AC_MSG_WARN([libreadline was not found on your system.])
@ -53,77 +54,6 @@ dnl install paren matching on the Guile command line (when using
dnl readline for input), so it's completely optional.
AC_CHECK_FUNCS(rl_get_keymap)
dnl Check for rl_pre_input_hook. This is more complicated because on
dnl some systems (HP/UX), the linker wont let us treat
dnl rl_pre_input_hook as a function when it really is a function
dnl pointer.
AC_MSG_CHECKING([for rl_pre_input_hook])
AC_CACHE_VAL(ac_cv_var_rl_pre_input_hook,
[AC_TRY_LINK([
#include <stdio.h>
#include <readline/readline.h>
], [
rl_pre_input_hook = 0;
],
ac_cv_var_rl_pre_input_hook=yes,
ac_cv_var_rl_pre_input_hook=no)])
AC_MSG_RESULT($ac_cv_var_rl_pre_input_hook)
if test $ac_cv_var_rl_pre_input_hook = yes; then
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK,1,
[Define if rl_pre_input_hook is available.])
fi
AC_MSG_CHECKING(if readline clears SA_RESTART flag for SIGWINCH)
AC_CACHE_VAL(guile_cv_sigwinch_sa_restart_cleared,
AC_TRY_RUN([#include <signal.h>
#include <stdio.h>
#include <readline/readline.h>
int
hook ()
{
struct sigaction action;
sigaction (SIGWINCH, NULL, &action);
rl_cleanup_after_signal();
/* exit with 0 if readline disabled SA_RESTART */
exit (action.sa_flags & SA_RESTART);
}
int
main ()
{
struct sigaction action;
sigaction (SIGWINCH, NULL, &action);
action.sa_flags |= SA_RESTART;
sigaction (SIGWINCH, &action, NULL);
/* Give readline something to read. Otherwise, it might hang, for
example when run as a background process with job control.
*/
rl_instream = fopen ("/dev/null", "r");
if (rl_instream == NULL)
{
perror ("/dev/null");
exit (1);
}
rl_pre_input_hook = hook;
readline ("");
}],
guile_cv_sigwinch_sa_restart_cleared=yes,
guile_cv_sigwinch_sa_restart_cleared=no,
guile_cv_sigwinch_sa_restart_cleared=yes))
AC_MSG_RESULT($guile_cv_sigwinch_sa_restart_cleared)
if test $guile_cv_sigwinch_sa_restart_cleared = yes; then
AC_DEFINE(GUILE_SIGWINCH_SA_RESTART_CLEARED, 1,
[Define if readline disables SA_RESTART.])
fi
AC_CACHE_CHECK([for rl_getc_function pointer in readline],
ac_cv_var_rl_getc_function,
[AC_TRY_LINK([

View file

@ -2,20 +2,20 @@
##
## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
##
## This file is part of GUILE.
## This file is part of guile-readline.
##
## GUILE is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2, or
## guile-readline is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 3, or
## (at your option) any later version.
##
## GUILE 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 General Public License for more details.
## guile-readline 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
## General Public License for more details.
##
## You should have received a copy of the GNU General Public
## License along with GUILE; see the file COPYING. If not, write
## You should have received a copy of the GNU General Public License
## along with guile-readline; see the file COPYING. If not, write
## to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
## Floor, Boston, MA 02110-1301 USA

View file

@ -4,7 +4,7 @@
;;;;
;;;; 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
;;;; the Free Software Foundation; either version 2, or (at your option)
;;;; the Free Software Foundation; either version 3, or (at your option)
;;;; any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
@ -169,8 +169,6 @@
(define-public (set-readline-read-hook! h)
(set! read-hook h))
(if (provided? 'regex)
(begin
(define-public apropos-completion-function
(let ((completions '()))
(lambda (text cont?)
@ -185,8 +183,8 @@
(begin (set! completions (cdr completions))
retval))))))
(set! *readline-completion-function* apropos-completion-function)
))
(if (provided? 'regex)
(set! *readline-completion-function* apropos-completion-function))
(define-public (with-readline-completion-function completer thunk)
"With @var{completer} as readline completion function, call @var{thunk}."

View file

@ -4,7 +4,7 @@
*
* 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
* the Free Software Foundation; either version 2, or (at your option)
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
@ -530,26 +530,6 @@ match_paren (int x, int k)
}
#endif /* HAVE_RL_GET_KEYMAP */
#if defined (HAVE_RL_PRE_INPUT_HOOK) && defined (GUILE_SIGWINCH_SA_RESTART_CLEARED)
/* Readline disables SA_RESTART on SIGWINCH.
* This code turns it back on.
*/
static int
sigwinch_enable_restart (void)
{
#ifdef HAVE_SIGINTERRUPT
siginterrupt (SIGWINCH, 0);
#else
struct sigaction action;
sigaction (SIGWINCH, NULL, &action);
action.sa_flags |= SA_RESTART;
sigaction (SIGWINCH, &action, NULL);
#endif
return 0;
}
#endif
#endif /* HAVE_RL_GETC_FUNCTION */
void
@ -569,9 +549,6 @@ scm_init_readline ()
#endif
rl_basic_word_break_characters = "\t\n\"'`;()";
rl_readline_name = "Guile";
#if defined (HAVE_RL_PRE_INPUT_HOOK) && defined (GUILE_SIGWINCH_SA_RESTART_CLEARED)
rl_pre_input_hook = sigwinch_enable_restart;
#endif
reentry_barrier_mutex = scm_permanent_object (scm_make_mutex ());
scm_init_opts (scm_readline_options,

View file

@ -5,7 +5,7 @@
*
* 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
* the Free Software Foundation; either version 2, or (at your option)
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,

Some files were not shown because too many files have changed in this diff Show more