"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "scm.info" between
scm-5f2.zip and scm-5f3.zip

About: SCM is a Scheme Language Interpreter.

scm.info  (scm-5f2):scm.info  (scm-5f3)
This is scm-5f2.info, produced by makeinfo version 4.13 from scm.texi. | This is scm-5f3.info, produced by makeinfo version 6.5 from scm.texi. |
This manual is for SCM (version 5f1, May 2013), an implementation of | This manual is for SCM (version 5f2, January 2015), an implementation of |
the algorithmic language Scheme. the algorithmic language Scheme.
Copyright (C) 1990-2007 Free Software Foundation, Inc. Copyright (C) 1990-2007 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and Foundation; with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license is included in the no Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License." section entitled "GNU Free Documentation License."
INFO-DIR-SECTION The Algorithmic Language Scheme INFO-DIR-SECTION The Algorithmic Language Scheme
START-INFO-DIR-ENTRY START-INFO-DIR-ENTRY
* SCM: (scm). A Scheme interpreter. * SCM: (scm). A Scheme interpreter.
END-INFO-DIR-ENTRY END-INFO-DIR-ENTRY
 
File: scm-5f2.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) File: scm-5f3.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir)
| |
SCM SCM
*** ***
This manual is for SCM (version 5f1, May 2013), an implementation of | This manual is for SCM (version 5f2, January 2015), an implementation of |
the algorithmic language Scheme. the algorithmic language Scheme.
Copyright (C) 1990-2007 Free Software Foundation, Inc. Copyright (C) 1990-2007 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and Foundation; with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license is included in the no Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License." section entitled "GNU Free Documentation License."
skipping to change at line 49 skipping to change at line 48
* Overview:: * Overview::
* Installing SCM:: How to * Installing SCM:: How to
* Operational Features:: * Operational Features::
* The Language:: Reference. * The Language:: Reference.
* Packages:: Optional Capabilities. * Packages:: Optional Capabilities.
* The Implementation:: How it works. * The Implementation:: How it works.
* Index:: * Index::
 
File: scm-5f2.info, Node: Overview, Next: Installing SCM, Prev: Top, Up: Top File: scm-5f3.info, Node: Overview, Next: Installing SCM, Prev: Top, Up: Top
| |
1 Overview 1 Overview
********** **********
SCM is a portable Scheme implementation written in C. SCM provides a SCM is a portable Scheme implementation written in C. SCM provides a
machine independent platform for [JACAL], a symbolic algebra system. machine independent platform for [JACAL], a symbolic algebra system.
SCM supports and requires the SLIB Scheme library. SCM, SLIB, and SCM supports and requires the SLIB Scheme library. SCM, SLIB, and JACAL |
JACAL are GNU projects. are GNU projects. |
* Menu: * Menu:
* SCM Features:: * SCM Features::
* SCM Authors:: * SCM Authors::
* Copying:: * Copying::
* Bibliography:: * Bibliography::
 
File: scm-5f2.info, Node: SCM Features, Next: SCM Authors, Prev: Overview, U p: Overview File: scm-5f3.info, Node: SCM Features, Next: SCM Authors, Prev: Overview, U p: Overview
| |
1.1 Features 1.1 Features
============ ============
* Conforms to Revised^5 Report on the Algorithmic Language Scheme * Conforms to Revised^5 Report on the Algorithmic Language Scheme
[R5RS] and the [IEEE] P1178 specification. [R5RS] and the [IEEE] P1178 specification.
* Support for [SICP], [R2RS], [R3RS], and [R5RS] scheme code. * Support for [SICP], [R2RS], [R3RS], and [R5RS] scheme code.
* Runs under Amiga, Atari-ST, MacOS, MS-DOS, OS/2, NOS/VE, Unicos, * Runs under Amiga, Atari-ST, MacOS, MS-DOS, OS/2, NOS/VE, Unicos,
VMS, Unix and similar systems. Supports ASCII and EBCDIC VMS, Unix and similar systems. Supports ASCII and EBCDIC character |
character sets. sets. |
* Is fully documented in TeXinfo form, allowing documentation to be * Is fully documented in TeXinfo form, allowing documentation to be
generated in info, TeX, html, nroff, and troff formats. generated in info, TeX, html, nroff, and troff formats.
* Supports inexact real and complex numbers, 30 bit immediate * Supports inexact real and complex numbers, 30 bit immediate
integers and large precision integers. integers and large precision integers.
* Many Common Lisp functions: 'logand', 'logor', 'logxor', 'lognot', |
* Many Common Lisp functions: `logand', `logor', `logxor', `lognot', 'ash', 'logcount', 'integer-length', 'bit-extract', 'defmacro', |
`ash', `logcount', `integer-length', `bit-extract', `defmacro', 'macroexpand', 'macroexpand1', 'gentemp', 'defvar', 'force-output', |
`macroexpand', `macroexpand1', `gentemp', `defvar', `force-output', 'software-type', 'get-decoded-time', 'get-internal-run-time', |
`software-type', `get-decoded-time', `get-internal-run-time', 'get-internal-real-time', 'delete-file', 'rename-file', |
`get-internal-real-time', `delete-file', `rename-file', 'copy-tree', 'acons', and 'eval'. |
`copy-tree', `acons', and `eval'. * 'Char-code-limit', 'most-positive-fixnum', 'most-negative-fixnum', |
'and internal-time-units-per-second' constants. 'slib:features' |
* `Char-code-limit', `most-positive-fixnum', `most-negative-fixnum', and '*load-pathname*' variables. |
`and internal-time-units-per-second' constants. `slib:features'
and `*load-pathname*' variables.
* Arrays and bit-vectors. String ports and software emulation ports. * Arrays and bit-vectors. String ports and software emulation ports.
I/O extensions providing ANSI C and POSIX.1 facilities. I/O extensions providing ANSI C and POSIX.1 facilities.
* Interfaces to standard libraries including REGEX string regular * Interfaces to standard libraries including REGEX string regular
expression matching and the CURSES screen management package. expression matching and the CURSES screen management package.
* Available add-on packages including an interactive debugger, * Available add-on packages including an interactive debugger,
database, X-window graphics, BGI graphics, Motif, and Open-Windows database, X-window graphics, BGI graphics, Motif, and Open-Windows
packages. packages.
* The Hobbit compiler and dynamic linking of compiled modules. * The Hobbit compiler and dynamic linking of compiled modules.
* User definable responses to interrupts and errors, * User definable responses to interrupts and errors,
Process-syncronization primitives. Setable levels of monitoring Process-syncronization primitives. Setable levels of monitoring
and timing information printed interactively (the `verbose' and timing information printed interactively (the 'verbose' |
function). `Restart', `quit', and `exec'. function). 'Restart', 'quit', and 'exec'. |
 
File: scm-5f2.info, Node: SCM Authors, Next: Copying, Prev: SCM Features, Up : Overview File: scm-5f3.info, Node: SCM Authors, Next: Copying, Prev: SCM Features, Up : Overview
| |
1.2 Authors 1.2 Authors
=========== ===========
Aubrey Jaffer (agj@alum.mit.edu) Aubrey Jaffer (agj@alum.mit.edu)
Most of SCM. Most of SCM.
Radey Shouman Radey Shouman
Arrays, `gsubr's, compiled closures, records, Ecache, syntax-rules Arrays, 'gsubr's, compiled closures, records, Ecache, syntax-rules |
macros, and "safeport"s. macros, and "safeport"s.
Jerry D. Hedden Jerry D. Hedden
Real and Complex functions. Fast mixed type arithmetics. Real and Complex functions. Fast mixed type arithmetics.
Hugh Secker-Walker Hugh Secker-Walker
Syntax checking and memoization of special forms by evaluator. Syntax checking and memoization of special forms by evaluator.
Storage allocation strategy and parameters. Storage allocation strategy and parameters.
George Carrette George Carrette
"Siod", written by George Carrette, was the starting point for SCM. "Siod", written by George Carrette, was the starting point for SCM.
The major innovations taken from Siod are the evaluator's use of The major innovations taken from Siod are the evaluator's use of
the C-stack and being able to garbage collect off the C-stack the C-stack and being able to garbage collect off the C-stack
(*note Garbage Collection::). (*note Garbage Collection::).
There are many other contributors to SCM. They are acknowledged in the There are many other contributors to SCM. They are acknowledged in the
file `ChangeLog', a log of changes that have been made to scm. file 'ChangeLog', a log of changes that have been made to scm. |
 
File: scm-5f2.info, Node: Copying, Next: Bibliography, Prev: SCM Authors, Up : Overview File: scm-5f3.info, Node: Copying, Next: Bibliography, Prev: SCM Authors, Up : Overview
| |
1.3 Copyright 1.3 Copyright
============= =============
Authors have assigned their SCM copyrights to: Authors have assigned their SCM copyrights to:
Free Software Foundation, Inc. Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111, USA 59 Temple Place, Suite 330, Boston, MA 02111, USA
* Menu: * Menu:
* The SCM License:: * The SCM License::
* SIOD copyright:: * SIOD copyright::
* GNU Free Documentation License:: Copying this Manual * GNU Free Documentation License:: Copying this Manual
 
File: scm-5f2.info, Node: The SCM License, Next: SIOD copyright, Prev: Copyin g, Up: Copying File: scm-5f3.info, Node: The SCM License, Next: SIOD copyright, Prev: Copyin g, Up: Copying
| |
1.3.1 The SCM License 1.3.1 The SCM License
--------------------- ---------------------
This program is free software: you can redistribute it and/or modify it 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 under the terms of the GNU Lesser General Public License as published by |
by the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or (at |
(at your option) any later version. your option) any later version. |
This program is distributed in the hope that it will be useful, but This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser |
Lesser General Public License for more details. General Public License for more details. |
You should have received a copy of the GNU Lesser General Public You should have received a copy of the GNU Lesser General Public License |
License along with this program. If not, see along with this program. If not, see <http://www.gnu.org/licenses/>. |
`http://www.gnu.org/licenses/'.
 
File: scm-5f2.info, Node: SIOD copyright, Next: GNU Free Documentation License , Prev: The SCM License, Up: Copying File: scm-5f3.info, Node: SIOD copyright, Next: GNU Free Documentation License , Prev: The SCM License, Up: Copying
| |
1.3.2 SIOD copyright 1.3.2 SIOD copyright
-------------------- --------------------
COPYRIGHT (C) 1989 BY COPYRIGHT (C) 1989 BY
PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS.
ALL RIGHTS RESERVED ALL RIGHTS RESERVED
Permission to use, copy, modify, distribute and sell this software and Permission to use, copy, modify, distribute and sell this software and
its documentation for any purpose and without fee is hereby granted, its documentation for any purpose and without fee is hereby granted,
skipping to change at line 209 skipping to change at line 192
PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR EVENT SHALL PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
gjc@paradigm.com gjc@paradigm.com
Phone: 617-492-6079 Phone: 617-492-6079
Paradigm Associates Inc Paradigm Associates Inc
29 Putnam Ave, Suite 6 29 Putnam Ave, Suite 6
Cambridge, MA 02138 Cambridge, MA 02138
 
File: scm-5f2.info, Node: GNU Free Documentation License, Prev: SIOD copyright , Up: Copying File: scm-5f3.info, Node: GNU Free Documentation License, Prev: SIOD copyright , Up: Copying
| |
1.3.3 GNU Free Documentation License 1.3.3 GNU Free Documentation License
------------------------------------ ------------------------------------
Version 1.3, 3 November 2008 Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
`http://fsf.org/' <http://fsf.org/> |
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
0. PREAMBLE 0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it, assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or with or without modifying it, either commercially or
skipping to change at line 248 skipping to change at line 230
This License is a kind of "copyleft", which means that derivative This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. works of the document must themselves be free in the same sense.
It complements the GNU General Public License, which is a copyleft It complements the GNU General Public License, which is a copyleft
license designed for free software. license designed for free software.
We have designed this License in order to use it for manuals for We have designed this License in order to use it for manuals for
free software, because free software needs free documentation: a free software, because free software needs free documentation: a
free program should come with manuals providing the same freedoms free program should come with manuals providing the same freedoms
that the software does. But this License is not limited to that the software does. But this License is not limited to
software manuals; it can be used for any textual work, regardless software manuals; it can be used for any textual work, regardless
of subject matter or whether it is published as a printed book. of subject matter or whether it is published as a printed book. We |
We recommend this License principally for works whose purpose is recommend this License principally for works whose purpose is |
instruction or reference. instruction or reference.
1. APPLICABILITY AND DEFINITIONS 1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, This License applies to any manual or other work, in any medium,
that contains a notice placed by the copyright holder saying it that contains a notice placed by the copyright holder saying it can |
can be distributed under the terms of this License. Such a notice be distributed under the terms of this License. Such a notice |
grants a world-wide, royalty-free license, unlimited in duration, grants a world-wide, royalty-free license, unlimited in duration,
to use that work under the conditions stated herein. The to use that work under the conditions stated herein. The
"Document", below, refers to any such manual or work. Any member "Document", below, refers to any such manual or work. Any member
of the public is a licensee, and is addressed as "you". You of the public is a licensee, and is addressed as "you". You accept |
accept the license if you copy, modify or distribute the work in a the license if you copy, modify or distribute the work in a way |
way requiring permission under copyright law. requiring permission under copyright law. |
A "Modified Version" of the Document means any work containing the A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language. modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section A "Secondary Section" is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could subject (or to related matters) and contains nothing that could
fall directly within that overall subject. (Thus, if the Document fall directly within that overall subject. (Thus, if the Document
is in part a textbook of mathematics, a Secondary Section may not is in part a textbook of mathematics, a Secondary Section may not
explain any mathematics.) The relationship could be a matter of explain any mathematics.) The relationship could be a matter of
historical connection with the subject or with related matters, or historical connection with the subject or with related matters, or
of legal, commercial, philosophical, ethical or political position of legal, commercial, philosophical, ethical or political position
regarding them. regarding them.
The "Invariant Sections" are certain Secondary Sections whose The "Invariant Sections" are certain Secondary Sections whose
titles are designated, as being those of Invariant Sections, in titles are designated, as being those of Invariant Sections, in the |
the notice that says that the Document is released under this notice that says that the Document is released under this License. |
License. If a section does not fit the above definition of If a section does not fit the above definition of Secondary then it |
Secondary then it is not allowed to be designated as Invariant. is not allowed to be designated as Invariant. The Document may |
The Document may contain zero Invariant Sections. If the Document contain zero Invariant Sections. If the Document does not identify |
does not identify any Invariant Sections then there are none. any Invariant Sections then there are none. |
The "Cover Texts" are certain short passages of text that are The "Cover Texts" are certain short passages of text that are
listed, as Front-Cover Texts or Back-Cover Texts, in the notice listed, as Front-Cover Texts or Back-Cover Texts, in the notice
that says that the Document is released under this License. A that says that the Document is released under this License. A
Front-Cover Text may be at most 5 words, and a Back-Cover Text may Front-Cover Text may be at most 5 words, and a Back-Cover Text may
be at most 25 words. be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy, A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the represented in a format whose specification is available to the
general public, that is suitable for revising the document general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images straightforwardly with generic text editors or (for images composed |
composed of pixels) generic paint programs or (for drawings) some of pixels) generic paint programs or (for drawings) some widely |
widely available drawing editor, and that is suitable for input to available drawing editor, and that is suitable for input to text |
text formatters or for automatic translation to a variety of formatters or for automatic translation to a variety of formats |
formats suitable for input to text formatters. A copy made in an suitable for input to text formatters. A copy made in an otherwise |
otherwise Transparent file format whose markup, or absence of Transparent file format whose markup, or absence of markup, has |
markup, has been arranged to thwart or discourage subsequent been arranged to thwart or discourage subsequent modification by |
modification by readers is not Transparent. An image format is readers is not Transparent. An image format is not Transparent if |
not Transparent if used for any substantial amount of text. A used for any substantial amount of text. A copy that is not |
copy that is not "Transparent" is called "Opaque". "Transparent" is called "Opaque". |
Examples of suitable formats for Transparent copies include plain Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, ASCII without markup, Texinfo input format, LaTeX input format,
SGML or XML using a publicly available DTD, and SGML or XML using a publicly available DTD, and standard-conforming |
standard-conforming simple HTML, PostScript or PDF designed for simple HTML, PostScript or PDF designed for human modification. |
human modification. Examples of transparent image formats include Examples of transparent image formats include PNG, XCF and JPG. |
PNG, XCF and JPG. Opaque formats include proprietary formats that Opaque formats include proprietary formats that can be read and |
can be read and edited only by proprietary word processors, SGML or edited only by proprietary word processors, SGML or XML for which |
XML for which the DTD and/or processing tools are not generally the DTD and/or processing tools are not generally available, and |
available, and the machine-generated HTML, PostScript or PDF the machine-generated HTML, PostScript or PDF produced by some word |
produced by some word processors for output purposes only. processors for output purposes only. |
The "Title Page" means, for a printed book, the title page itself, The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the plus such following pages as are needed to hold, legibly, the
material this License requires to appear in the title page. For material this License requires to appear in the title page. For
works in formats which do not have any title page as such, "Title works in formats which do not have any title page as such, "Title
Page" means the text near the most prominent appearance of the Page" means the text near the most prominent appearance of the
work's title, preceding the beginning of the body of the text. work's title, preceding the beginning of the body of the text.
The "publisher" means any person or entity that distributes copies The "publisher" means any person or entity that distributes copies
of the Document to the public. of the Document to the public.
skipping to change at line 354 skipping to change at line 336
2. VERBATIM COPYING 2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License copyright notices, and the license notice saying this License
applies to the Document are reproduced in all copies, and that you applies to the Document are reproduced in all copies, and that you
add no other conditions whatsoever to those of this License. You add no other conditions whatsoever to those of this License. You
may not use technical measures to obstruct or control the reading may not use technical measures to obstruct or control the reading
or further copying of the copies you make or distribute. However, or further copying of the copies you make or distribute. However,
you may accept compensation in exchange for copies. If you you may accept compensation in exchange for copies. If you
distribute a large enough number of copies you must also follow distribute a large enough number of copies you must also follow the |
the conditions in section 3. conditions in section 3. |
You may also lend copies, under the same conditions stated above, You may also lend copies, under the same conditions stated above,
and you may publicly display copies. and you may publicly display copies.
3. COPYING IN QUANTITY 3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly If you publish printed copies (or copies in media that commonly
have printed covers) of the Document, numbering more than 100, and have printed covers) of the Document, numbering more than 100, and
the Document's license notice requires Cover Texts, you must the Document's license notice requires Cover Texts, you must
enclose the copies in covers that carry, clearly and legibly, all enclose the copies in covers that carry, clearly and legibly, all
these Cover Texts: Front-Cover Texts on the front cover, and these Cover Texts: Front-Cover Texts on the front cover, and
Back-Cover Texts on the back cover. Both covers must also clearly Back-Cover Texts on the back cover. Both covers must also clearly
and legibly identify you as the publisher of these copies. The and legibly identify you as the publisher of these copies. The
front cover must present the full title with all words of the front cover must present the full title with all words of the title |
title equally prominent and visible. You may add other material equally prominent and visible. You may add other material on the |
on the covers in addition. Copying with changes limited to the covers in addition. Copying with changes limited to the covers, as |
covers, as long as they preserve the title of the Document and long as they preserve the title of the Document and satisfy these |
satisfy these conditions, can be treated as verbatim copying in conditions, can be treated as verbatim copying in other respects. |
other respects.
If the required texts for either cover are too voluminous to fit If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto reasonably) on the actual cover, and continue the rest onto
adjacent pages. adjacent pages.
If you publish or distribute Opaque copies of the Document If you publish or distribute Opaque copies of the Document
numbering more than 100, you must either include a numbering more than 100, you must either include a machine-readable |
machine-readable Transparent copy along with each Opaque copy, or Transparent copy along with each Opaque copy, or state in or with |
state in or with each Opaque copy a computer-network location from each Opaque copy a computer-network location from which the general |
which the general network-using public has access to download network-using public has access to download using public-standard |
using public-standard network protocols a complete Transparent network protocols a complete Transparent copy of the Document, free |
copy of the Document, free of added material. If you use the of added material. If you use the latter option, you must take |
latter option, you must take reasonably prudent steps, when you reasonably prudent steps, when you begin distribution of Opaque |
begin distribution of Opaque copies in quantity, to ensure that copies in quantity, to ensure that this Transparent copy will |
this Transparent copy will remain thus accessible at the stated remain thus accessible at the stated location until at least one |
location until at least one year after the last time you year after the last time you distribute an Opaque copy (directly or |
distribute an Opaque copy (directly or through your agents or through your agents or retailers) of that edition to the public. |
retailers) of that edition to the public.
It is requested, but not required, that you contact the authors of It is requested, but not required, that you contact the authors of
the Document well before redistributing any large number of the Document well before redistributing any large number of copies, |
copies, to give them a chance to provide you with an updated to give them a chance to provide you with an updated version of the |
version of the Document. Document. |
4. MODIFICATIONS 4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document You may copy and distribute a Modified Version of the Document
under the conditions of sections 2 and 3 above, provided that you under the conditions of sections 2 and 3 above, provided that you
release the Modified Version under precisely this License, with release the Modified Version under precisely this License, with the |
the Modified Version filling the role of the Document, thus Modified Version filling the role of the Document, thus licensing |
licensing distribution and modification of the Modified Version to distribution and modification of the Modified Version to whoever |
whoever possesses a copy of it. In addition, you must do these possesses a copy of it. In addition, you must do these things in |
things in the Modified Version: the Modified Version: |
A. Use in the Title Page (and on the covers, if any) a title A. Use in the Title Page (and on the covers, if any) a title
distinct from that of the Document, and from those of distinct from that of the Document, and from those of previous |
previous versions (which should, if there were any, be listed versions (which should, if there were any, be listed in the |
in the History section of the Document). You may use the History section of the Document). You may use the same title |
same title as a previous version if the original publisher of as a previous version if the original publisher of that |
that version gives permission. version gives permission. |
B. List on the Title Page, as authors, one or more persons or B. List on the Title Page, as authors, one or more persons or
entities responsible for authorship of the modifications in entities responsible for authorship of the modifications in
the Modified Version, together with at least five of the the Modified Version, together with at least five of the
principal authors of the Document (all of its principal principal authors of the Document (all of its principal
authors, if it has fewer than five), unless they release you authors, if it has fewer than five), unless they release you
from this requirement. from this requirement.
C. State on the Title page the name of the publisher of the C. State on the Title page the name of the publisher of the
Modified Version, as the publisher. Modified Version, as the publisher.
skipping to change at line 445 skipping to change at line 425
the Addendum below. the Addendum below.
G. Preserve in that license notice the full lists of Invariant G. Preserve in that license notice the full lists of Invariant
Sections and required Cover Texts given in the Document's Sections and required Cover Texts given in the Document's
license notice. license notice.
H. Include an unaltered copy of this License. H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, I. Preserve the section Entitled "History", Preserve its Title,
and add to it an item stating at least the title, year, new and add to it an item stating at least the title, year, new
authors, and publisher of the Modified Version as given on authors, and publisher of the Modified Version as given on the |
the Title Page. If there is no section Entitled "History" in Title Page. If there is no section Entitled "History" in the |
the Document, create one stating the title, year, authors, Document, create one stating the title, year, authors, and |
and publisher of the Document as given on its Title Page, publisher of the Document as given on its Title Page, then add |
then add an item describing the Modified Version as stated in an item describing the Modified Version as stated in the |
the previous sentence. previous sentence. |
J. Preserve the network location, if any, given in the Document J. Preserve the network location, if any, given in the Document
for public access to a Transparent copy of the Document, and for public access to a Transparent copy of the Document, and
likewise the network locations given in the Document for likewise the network locations given in the Document for
previous versions it was based on. These may be placed in previous versions it was based on. These may be placed in the |
the "History" section. You may omit a network location for a "History" section. You may omit a network location for a work |
work that was published at least four years before the that was published at least four years before the Document |
Document itself, or if the original publisher of the version itself, or if the original publisher of the version it refers |
it refers to gives permission. to gives permission. |
K. For any section Entitled "Acknowledgements" or "Dedications", K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the Preserve the Title of the section, and preserve in the section |
section all the substance and tone of each of the contributor all the substance and tone of each of the contributor |
acknowledgements and/or dedications given therein. acknowledgements and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document, L. Preserve all the Invariant Sections of the Document, unaltered |
unaltered in their text and in their titles. Section numbers in their text and in their titles. Section numbers or the |
or the equivalent are not considered part of the section equivalent are not considered part of the section titles. |
titles.
M. Delete any section Entitled "Endorsements". Such a section M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version. may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled N. Do not retitle any existing section to be Entitled
"Endorsements" or to conflict in title with any Invariant "Endorsements" or to conflict in title with any Invariant
Section. Section.
O. Preserve any Warranty Disclaimers. O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no appendices that qualify as Secondary Sections and contain no
material copied from the Document, you may at your option material copied from the Document, you may at your option designate |
designate some or all of these sections as invariant. To do this, some or all of these sections as invariant. To do this, add their |
add their titles to the list of Invariant Sections in the Modified titles to the list of Invariant Sections in the Modified Version's |
Version's license notice. These titles must be distinct from any license notice. These titles must be distinct from any other |
other section titles. section titles. |
You may add a section Entitled "Endorsements", provided it contains You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text parties--for example, statements of peer review or that the text
has been approved by an organization as the authoritative has been approved by an organization as the authoritative
definition of a standard. definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, You may add a passage of up to five words as a Front-Cover Text,
and a passage of up to 25 words as a Back-Cover Text, to the end and a passage of up to 25 words as a Back-Cover Text, to the end of |
of the list of Cover Texts in the Modified Version. Only one the list of Cover Texts in the Modified Version. Only one passage |
passage of Front-Cover Text and one of Back-Cover Text may be of Front-Cover Text and one of Back-Cover Text may be added by (or |
added by (or through arrangements made by) any one entity. If the through arrangements made by) any one entity. If the Document |
Document already includes a cover text for the same cover, already includes a cover text for the same cover, previously added |
previously added by you or by arrangement made by the same entity by you or by arrangement made by the same entity you are acting on |
you are acting on behalf of, you may not add another; but you may behalf of, you may not add another; but you may replace the old |
replace the old one, on explicit permission from the previous one, on explicit permission from the previous publisher that added |
publisher that added the old one. the old one. |
The author(s) and publisher(s) of the Document do not by this The author(s) and publisher(s) of the Document do not by this
License give permission to use their names for publicity for or to License give permission to use their names for publicity for or to
assert or imply endorsement of any Modified Version. assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS 5. COMBINING DOCUMENTS
You may combine the Document with other documents released under You may combine the Document with other documents released under
this License, under the terms defined in section 4 above for this License, under the terms defined in section 4 above for
modified versions, provided that you include in the combination modified versions, provided that you include in the combination all |
all of the Invariant Sections of all of the original documents, of the Invariant Sections of all of the original documents, |
unmodified, and list them all as Invariant Sections of your unmodified, and list them all as Invariant Sections of your
combined work in its license notice, and that you preserve all combined work in its license notice, and that you preserve all
their Warranty Disclaimers. their Warranty Disclaimers.
The combined work need only contain one copy of this License, and The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name copy. If there are multiple Invariant Sections with the same name
but different contents, make the title of each such section unique but different contents, make the title of each such section unique
by adding at the end of it, in parentheses, the name of the by adding at the end of it, in parentheses, the name of the
original author or publisher of that section if known, or else a original author or publisher of that section if known, or else a
skipping to change at line 541 skipping to change at line 520
Entitled "History"; likewise combine any sections Entitled Entitled "History"; likewise combine any sections Entitled
"Acknowledgements", and any sections Entitled "Dedications". You "Acknowledgements", and any sections Entitled "Dedications". You
must delete all sections Entitled "Endorsements." must delete all sections Entitled "Endorsements."
6. COLLECTIONS OF DOCUMENTS 6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other You may make a collection consisting of the Document and other
documents released under this License, and replace the individual documents released under this License, and replace the individual
copies of this License in the various documents with a single copy copies of this License in the various documents with a single copy
that is included in the collection, provided that you follow the that is included in the collection, provided that you follow the
rules of this License for verbatim copying of each of the rules of this License for verbatim copying of each of the documents |
documents in all other respects. in all other respects. |
You may extract a single document from such a collection, and You may extract a single document from such a collection, and
distribute it individually under this License, provided you insert distribute it individually under this License, provided you insert
a copy of this License into the extracted document, and follow a copy of this License into the extracted document, and follow this |
this License in all other respects regarding verbatim copying of License in all other respects regarding verbatim copying of that |
that document. document. |
7. AGGREGATION WITH INDEPENDENT WORKS 7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other A compilation of the Document or its derivatives with other
separate and independent documents or works, in or on a volume of separate and independent documents or works, in or on a volume of a |
a storage or distribution medium, is called an "aggregate" if the storage or distribution medium, is called an "aggregate" if the |
copyright resulting from the compilation is not used to limit the copyright resulting from the compilation is not used to limit the
legal rights of the compilation's users beyond what the individual legal rights of the compilation's users beyond what the individual
works permit. When the Document is included in an aggregate, this works permit. When the Document is included in an aggregate, this
License does not apply to the other works in the aggregate which License does not apply to the other works in the aggregate which
are not themselves derivative works of the Document. are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half copies of the Document, then if the Document is less than one half
of the entire aggregate, the Document's Cover Texts may be placed of the entire aggregate, the Document's Cover Texts may be placed
on covers that bracket the Document within the aggregate, or the on covers that bracket the Document within the aggregate, or the
skipping to change at line 599 skipping to change at line 578
9. TERMINATION 9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, otherwise to copy, modify, sublicense, or distribute it is void,
and will automatically terminate your rights under this License. and will automatically terminate your rights under this License.
However, if you cease all violation of this License, then your However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a) license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly provisionally, unless and until the copyright holder explicitly and |
and finally terminates your license, and (b) permanently, if the finally terminates your license, and (b) permanently, if the |
copyright holder fails to notify you of the violation by some copyright holder fails to notify you of the violation by some
reasonable means prior to 60 days after the cessation. reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from received notice of violation of this License (for any work) from
that copyright holder, and you cure the violation prior to 30 days that copyright holder, and you cure the violation prior to 30 days
after your receipt of the notice. after your receipt of the notice.
Termination of your rights under this section does not terminate Termination of your rights under this section does not terminate
the licenses of parties who have received copies or rights from the licenses of parties who have received copies or rights from you |
you under this License. If your rights have been terminated and under this License. If your rights have been terminated and not |
not permanently reinstated, receipt of a copy of some or all of permanently reinstated, receipt of a copy of some or all of the |
the same material does not give you any rights to use it. same material does not give you any rights to use it. |
10. FUTURE REVISIONS OF THIS LICENSE 10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions of The Free Software Foundation may publish new, revised versions of
the GNU Free Documentation License from time to time. Such new the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See differ in detail to address new problems or concerns. See
`http://www.gnu.org/copyleft/'. <http://www.gnu.org/copyleft/>. |
Each version of the License is given a distinguishing version Each version of the License is given a distinguishing version
number. If the Document specifies that a particular numbered number. If the Document specifies that a particular numbered
version of this License "or any later version" applies to it, you version of this License "or any later version" applies to it, you
have the option of following the terms and conditions either of have the option of following the terms and conditions either of
that specified version or of any later version that has been that specified version or of any later version that has been
published (not as a draft) by the Free Software Foundation. If published (not as a draft) by the Free Software Foundation. If the |
the Document does not specify a version number of this License, Document does not specify a version number of this License, you may |
you may choose any version ever published (not as a draft) by the choose any version ever published (not as a draft) by the Free |
Free Software Foundation. If the Document specifies that a proxy Software Foundation. If the Document specifies that a proxy can |
can decide which future versions of this License can be used, that decide which future versions of this License can be used, that |
proxy's public statement of acceptance of a version permanently proxy's public statement of acceptance of a version permanently
authorizes you to choose that version for the Document. authorizes you to choose that version for the Document.
11. RELICENSING 11. RELICENSING
"Massive Multiauthor Collaboration Site" (or "MMC Site") means any "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
World Wide Web server that publishes copyrightable works and also World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. public wiki that anybody can edit is an example of such a server.
A "Massive Multiauthor Collaboration" (or "MMC") contained in the A "Massive Multiauthor Collaboration" (or "MMC") contained in the
site means any set of copyrightable works thus published on the MMC site means any set of copyrightable works thus published on the MMC
site. site.
"CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
skipping to change at line 684 skipping to change at line 663
Copyright (C) YEAR YOUR NAME. Copyright (C) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation; or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''. Free Documentation License''.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this: replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with with the Invariant Sections being LIST THEIR TITLES, with
the Front-Cover Texts being LIST, and with the Back-Cover Texts the Front-Cover Texts being LIST, and with the Back-Cover Texts
being LIST. being LIST.
If you have Invariant Sections without Cover Texts, or some other If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the combination of the three, merge those two alternatives to suit the
situation. situation.
If your document contains nontrivial examples of program code, we If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of recommend releasing these examples in parallel under your choice of free |
free software license, such as the GNU General Public License, to software license, such as the GNU General Public License, to permit |
permit their use in free software. their use in free software. |
 
File: scm-5f2.info, Node: Bibliography, Prev: Copying, Up: Overview File: scm-5f3.info, Node: Bibliography, Prev: Copying, Up: Overview
| |
1.4 Bibliography 1.4 Bibliography
================ ================
[IEEE] [IEEE]
`IEEE Standard 1178-1990. IEEE Standard for the Scheme 'IEEE Standard 1178-1990. IEEE Standard for the Scheme Programming |
Programming Language.' IEEE, New York, 1991. Language.' IEEE, New York, 1991. |
[R4RS] [R4RS]
William Clinger and Jonathan Rees, Editors. Revised(4) Report on William Clinger and Jonathan Rees, Editors. Revised(4) Report on
the Algorithmic Language Scheme. `ACM Lisp Pointers' Volume IV, the Algorithmic Language Scheme. 'ACM Lisp Pointers' Volume IV, |
Number 3 (July-September 1991), pp. 1-55. Number 3 (July-September 1991), pp. 1-55.
*note Top: (r4rs)Top. *note (r4rs)Top::. |
[R5RS] [R5RS]
Richard Kelsey and William Clinger and Jonathan (Rees, editors) Richard Kelsey and William Clinger and Jonathan (Rees, editors)
Revised(5) Report on the Algorithmic Language Scheme. Revised(5) Report on the Algorithmic Language Scheme.
`Higher-Order and Symbolic Computation' Volume 11, Number 1 (1998), 'Higher-Order and Symbolic Computation' Volume 11, Number 1 (1998), |
pp. 7-105, and `ACM SIGPLAN Notices' 33(9), September 1998. pp. 7-105, and 'ACM SIGPLAN Notices' 33(9), September 1998. |
*note Top: (r5rs)Top. *note (r5rs)Top::. |
[Exrename] [Exrename]
William Clinger Hygienic Macros Through Explicit Renaming `Lisp William Clinger Hygienic Macros Through Explicit Renaming 'Lisp |
Pointers' Volume IV, Number 4 (December 1991), pp 17-23. Pointers' Volume IV, Number 4 (December 1991), pp 17-23.
[SICP] [SICP]
Harold Abelson and Gerald Jay Sussman with Julie Sussman. Harold Abelson and Gerald Jay Sussman with Julie Sussman.
`Structure and Interpretation of Computer Programs.' MIT Press, 'Structure and Interpretation of Computer Programs.' MIT Press, |
Cambridge, 1985. Cambridge, 1985.
[Simply] [Simply]
Brian Harvey and Matthew Wright. `Simply Scheme: Introducing Brian Harvey and Matthew Wright. 'Simply Scheme: Introducing |
Computer Science' MIT Press, 1994 ISBN 0-262-08226-8 Computer Science' MIT Press, 1994 ISBN 0-262-08226-8
[SchemePrimer] [SchemePrimer]
犬飼大(Dai Inukai) `入門Scheme' 犬飼大(Dai Inukai) '入門Scheme' 1999年12月初版 |
1999年12月初版 ISBN4-87966-954-7 ISBN4-87966-954-7 |
[SLIB] [SLIB]
Todd R. Eigenschink, Dave Love, and Aubrey Jaffer. SLIB, The Todd R. Eigenschink, Dave Love, and Aubrey Jaffer. SLIB, The
Portable Scheme Library. Version 2c8, June 2000. Portable Scheme Library. Version 2c8, June 2000.
*note Top: (slib)Top. *note (slib)Top::. |
[JACAL] [JACAL]
Aubrey Jaffer. JACAL Symbolic Mathematics System. Version 1b0, Aubrey Jaffer. JACAL Symbolic Mathematics System. Version 1b0,
Sep 1999. Sep 1999.
*note Top: (jacal)Top. *note (jacal)Top::. |
`scm.texi' 'scm.texi' |
`scm.info' 'scm.info' |
Documentation of `scm' extensions (beyond Scheme standards). Documentation of 'scm' extensions (beyond Scheme standards). |
Documentation on the internal representation and how to extend or Documentation on the internal representation and how to extend or
include `scm' in other programs. include 'scm' in other programs. |
'Xlibscm.texi' |
`Xlibscm.texi' 'Xlibscm.info' |
`Xlibscm.info'
Documentation of the Xlib - SCM Language X Interface. Documentation of the Xlib - SCM Language X Interface.
 
File: scm-5f2.info, Node: Installing SCM, Next: Operational Features, Prev: O verview, Up: Top File: scm-5f3.info, Node: Installing SCM, Next: Operational Features, Prev: O verview, Up: Top
| |
2 Installing SCM 2 Installing SCM
**************** ****************
SCM runs on a wide variety of platforms. "Distributions" is the | SCM runs on a wide variety of platforms. "Distributions" is the |
starting point for all platforms. The process described in "GNU | starting point for all platforms. The process described in "GNU |
configure and make" will work on most Unix and GNU/Linux platforms. If | configure and make" will work on most Unix and GNU/Linux platforms. If |
it works for you, then you may skip the later sections of "Installing | it works for you, then you may skip the later sections of "Installing |
SCM". | SCM". |
| |
* Menu: * Menu:
* Distributions:: Source and Binaries * Distributions:: Source and Binaries
* GNU configure and make:: For Unix and GNU/Linux * GNU configure and make:: For Unix and GNU/Linux
* Building SCM:: * Building SCM::
* Saving Executable Images:: For Faster Startup * Saving Executable Images:: For Faster Startup
* Installation:: * Installation::
* Troubleshooting and Testing:: * Troubleshooting and Testing::
 
File: scm-5f2.info, Node: Distributions, Next: GNU configure and make, Prev: Installing SCM, Up: Installing SCM File: scm-5f3.info, Node: Distributions, Next: GNU configure and make, Prev: Installing SCM, Up: Installing SCM
| |
2.1 Distributions | 2.1 Distributions |
================= | ================= |
The SCM homepage contains links to precompiled binaries and source | The SCM homepage contains links to precompiled binaries and source |
distributions. | distributions. |
Downloads and instructions for installing the precompiled binaries are | Downloads and instructions for installing the precompiled binaries are |
at `http://people.csail.mit.edu/jaffer/SCM#QuickStart'. | at <http://people.csail.mit.edu/jaffer/SCM#QuickStart>. |
| |
If there is no precompiled binary for your platform, you may be able to | If there is no precompiled binary for your platform, you may be able to |
build from the source distribution. The rest of these instructions | build from the source distribution. The rest of these instructions deal |
deal with building and installing SCM and SLIB from sources. | with building and installing SCM and SLIB from sources. |
| |
Download (both SCM and SLIB of) either the last release or current | Download (both SCM and SLIB of) either the last release or current |
development snapshot from | development snapshot from |
`http://people.csail.mit.edu/jaffer/SCM#BuildFromSource'. | <http://people.csail.mit.edu/jaffer/SCM#BuildFromSource>. |
| |
Unzip both the SCM and SLIB zips. For example, if you are working in | Unzip both the SCM and SLIB zips. For example, if you are working in |
`/usr/local/src/', this will create directories `/usr/local/src/scm/' | '/usr/local/src/', this will create directories '/usr/local/src/scm/' |
and `/usr/local/src/slib/'. | and '/usr/local/src/slib/'. |
| |
 
File: scm-5f2.info, Node: GNU configure and make, Next: Building SCM, Prev: D istributions, Up: Installing SCM File: scm-5f3.info, Node: GNU configure and make, Next: Building SCM, Prev: D istributions, Up: Installing SCM
| |
2.2 GNU configure and make | 2.2 GNU configure and make |
========================== | ========================== |
| |
`scm/configure' and `slib/configure' are Shell scripts which create the | 'scm/configure' and 'slib/configure' are Shell scripts which create the |
files `scm/config.status' and `slib/config.status' on Unix and MinGW | files 'scm/config.status' and 'slib/config.status' on Unix and MinGW |
systems. | systems. |
| |
The `config.status' files are used (included) by the Makefile to | The 'config.status' files are used (included) by the Makefile to control |
control where the packages will be installed by `make install'. With | where the packages will be installed by 'make install'. With GNU shell |
GNU shell (bash) and utilities, the following commands should build and | (bash) and utilities, the following commands should build and install |
install SCM and SLIB: | SCM and SLIB: |
| |
bash$ (cd slib; ./configure --prefix=/usr/local/) | bash$ (cd slib; ./configure --prefix=/usr/local/) |
bash$ (cd scm | bash$ (cd scm |
> ./configure --prefix=/usr/local/ | > ./configure --prefix=/usr/local/ |
> make scmlit | > make scmlit |
> sudo make all | > sudo make all |
> sudo make install) | > sudo make install) |
bash$ (cd slib; sudo make install) | bash$ (cd slib; sudo make install) |
| |
If the install commands worked, skip to *note Testing::. | If the install commands worked, skip to *note Testing::. |
| |
If `configure' doesn't work on your system, make `scm/config.status' | If 'configure' doesn't work on your system, make 'scm/config.status' and |
and `slib/config.status' be empty files. | 'slib/config.status' be empty files. |
| |
For additional help on using the `configure' script, run | For additional help on using the 'configure' script, run |
`./configure --help'. | './configure --help'. |
| |
`make all' will attempt to create a dumped executable (*note Saving | 'make all' will attempt to create a dumped executable (*note Saving |
Executable Images::), which has very small startup latency. If that | Executable Images::), which has very small startup latency. If that |
fails, it will try to compile an ordinary `scm' executable. | fails, it will try to compile an ordinary 'scm' executable. |
| |
Note that the compilation output may contain error messages; be | Note that the compilation output may contain error messages; be |
concerned only if the `make install' transcripts contain errors. | concerned only if the 'make install' transcripts contain errors. |
| |
`sudo' runs the command after it as user "root". On recent GNU/Linux | 'sudo' runs the command after it as user "root". On recent GNU/Linux |
systems, dumping requires that `make all' be run as user root; hence | systems, dumping requires that 'make all' be run as user root; hence the |
the use of `sudo'. | use of 'sudo'. |
| |
`make install' requires root privileges if you are installing to | 'make install' requires root privileges if you are installing to |
standard Unix locations as specified to (or defaulted by) | standard Unix locations as specified to (or defaulted by) './configure'. |
`./configure'. Note that this is independent of whether you did | Note that this is independent of whether you did 'sudo make all' or |
`sudo make all' or `make all'. | 'make all'. |
| |
* Menu: * Menu:
| |
* Making scmlit:: * Making scmlit::
* Makefile targets:: * Makefile targets::
| |
 
File: scm-5f2.info, Node: Making scmlit, Next: Makefile targets, Prev: GNU co nfigure and make, Up: GNU configure and make File: scm-5f3.info, Node: Making scmlit, Next: Makefile targets, Prev: GNU co nfigure and make, Up: GNU configure and make
| |
2.2.1 Making scmlit | 2.2.1 Making scmlit |
------------------- | ------------------- |
| |
The SCM distribution `Makefile' contains rules for making "scmlit", a | The SCM distribution 'Makefile' contains rules for making "scmlit", a |
"bare-bones" version of SCM sufficient for running `build'. `build' is | "bare-bones" version of SCM sufficient for running 'build'. 'build' is |
a Scheme program used to compile (or create scripts to compile) full | a Scheme program used to compile (or create scripts to compile) full |
featured versions of SCM (*note Building SCM::). To create scmlit, run | featured versions of SCM (*note Building SCM::). To create scmlit, run |
`make scmlit' in the `scm/' directory. | 'make scmlit' in the 'scm/' directory. |
| |
Makefiles are not portable to the majority of platforms. If you need | Makefiles are not portable to the majority of platforms. If you need to |
to compile SCM without `scmlit', there are several ways to proceed: | compile SCM without 'scmlit', there are several ways to proceed: |
* Use the build (http://people.csail.mit.edu/jaffer/buildscm.html) * Use the build (http://people.csail.mit.edu/jaffer/buildscm.html)
web page to create custom batch scripts for compiling SCM. web page to create custom batch scripts for compiling SCM.
* Use SCM on a different platform to run `build' to create a script * Use SCM on a different platform to run 'build' to create a script |
to build SCM; to build SCM;
* Use another implementation of Scheme to run `build' to create a * Use another implementation of Scheme to run 'build' to create a |
script to build SCM; script to build SCM;
* Create your own script or `Makefile'. * Create your own script or 'Makefile'. |
Finding SLIB | Finding SLIB |
------------ | ------------ |
If you didn't create scmlit using `make scmlit', then you must create a | If you didn't create scmlit using 'make scmlit', then you must create a |
file named `scm/require.scm'. For most installations, | file named 'scm/require.scm'. For most installations, 'scm/require.scm' |
`scm/require.scm' can just be copied from `scm/requires.scm', which is | can just be copied from 'scm/requires.scm', which is part of the SCM |
part of the SCM distribution. | distribution. |
If, when executing `scmlit' or `scm', you get a message like: | If, when executing 'scmlit' or 'scm', you get a message like: |
ERROR: "LOAD couldn't find file " "/usr/local/src/scm/require" | ERROR: "LOAD couldn't find file " "/usr/local/src/scm/require" |
then create a file `require.scm' in the SCM "implementation-vicinity" | then create a file 'require.scm' in the SCM "implementation-vicinity" |
(this is the same directory as where the file `Init5f1.scm' is). | (this is the same directory as where the file 'Init5f2.scm' is). |
`require.scm' should have the contents: | 'require.scm' should have the contents: |
(define (library-vicinity) "/usr/local/lib/slib/") (define (library-vicinity) "/usr/local/lib/slib/")
where the pathname string `/usr/local/lib/slib/' is to be replaced by where the pathname string '/usr/local/lib/slib/' is to be replaced by |
the pathname into which you unzipped (or installed) SLIB. | the pathname into which you unzipped (or installed) SLIB. |
| |
Alternatively, you can set the (shell) environment variable | Alternatively, you can set the (shell) environment variable |
`SCHEME_LIBRARY_PATH' to the pathname of the SLIB directory (*note | 'SCHEME_LIBRARY_PATH' to the pathname of the SLIB directory (*note |
SCHEME_LIBRARY_PATH: SCM Variables.). If set, this environment | SCHEME_LIBRARY_PATH: SCM Variables.). If set, this environment variable |
variable overrides `scm/require.scm'. | overrides 'scm/require.scm'. |
| |
Absolute pathnames are recommended here; if you use a relative | Absolute pathnames are recommended here; if you use a relative pathname, |
pathname, SLIB can get confused when the working directory is changed | SLIB can get confused when the working directory is changed (*note |
(*note chmod: I/O-Extensions.). The way to specify a relative pathname | chmod: I/O-Extensions.). The way to specify a relative pathname is to |
is to append it to the implementation-vicinity, which is absolute: | append it to the implementation-vicinity, which is absolute: |
(define library-vicinity (define library-vicinity
(let ((lv (string-append (implementation-vicinity) "../slib/"))) (let ((lv (string-append (implementation-vicinity) "../slib/")))
(lambda () lv))) (lambda () lv)))
 
File: scm-5f2.info, Node: Makefile targets, Prev: Making scmlit, Up: GNU conf igure and make File: scm-5f3.info, Node: Makefile targets, Prev: Making scmlit, Up: GNU conf igure and make
| |
2.2.2 Makefile targets | 2.2.2 Makefile targets |
---------------------- | ---------------------- |
| |
Each of the following four `make' targets creates an executable named | Each of the following four 'make' targets creates an executable named |
`scm'. Each target takes its build options from a file with an `.opt' | 'scm'. Each target takes its build options from a file with an '.opt' |
suffix. If that options file doesn't exist, making that target will | suffix. If that options file doesn't exist, making that target will |
create the file with the `-F' features: cautious, bignums, arrays, | create the file with the '-F' features: cautious, bignums, arrays, |
inexact, engineering-notation, and dynamic-linking. Once that `.opt' | inexact, engineering-notation, and dynamic-linking. Once that '.opt' |
file exists, you can edit it to your taste and it will be preserved. | file exists, you can edit it to your taste and it will be preserved. |
| |
`make scm4' | 'make scm4' |
Produces a R4RS executable named `scm' lacking hygienic macros | Produces a R4RS executable named 'scm' lacking hygienic macros (but |
(but with defmacro). The build options are taken from `scm4.opt'. | with defmacro). The build options are taken from 'scm4.opt'. If |
If build or the executable fails, try removing `dynamic-linking' | build or the executable fails, try removing 'dynamic-linking' from |
from `scm4.opt'. | 'scm4.opt'. |
| |
`make scm5' | 'make scm5' |
R5RS; like `make scm4' but with `-F macro'. The build options are | R5RS; like 'make scm4' but with '-F macro'. The build options are |
taken from `scm5.opt'. If build or the executable fails, try | taken from 'scm5.opt'. If build or the executable fails, try |
removing `dynamic-linking' from `scm5.opt'. | removing 'dynamic-linking' from 'scm5.opt'. |
| |
`make dscm4' | 'make dscm4' |
Produces a R4RS executable named `udscm4', which it starts and | Produces a R4RS executable named 'udscm4', which it starts and |
dumps to a low startup latency executable named `scm'. The build | dumps to a low startup latency executable named 'scm'. The build |
options are taken from `udscm4.opt'. | options are taken from 'udscm4.opt'. |
| |
If the build fails, then `build scm4' instead. If the dumped | If the build fails, then 'build scm4' instead. If the dumped |
executable fails to run, then send me a bug report (and use | executable fails to run, then send me a bug report (and use |
`build scm4' until the problem with dump is corrected). | 'build scm4' until the problem with dump is corrected). |
| |
`make dscm5' | 'make dscm5' |
Like `make dscm4' but with `-F macro'. The build options are | Like 'make dscm4' but with '-F macro'. The build options are taken |
taken from `udscm5.opt'. | from 'udscm5.opt'. |
| |
If the build fails, then `build scm5' instead. If the dumped | If the build fails, then 'build scm5' instead. If the dumped |
executable fails to run, then send me a bug report (and use | executable fails to run, then send me a bug report (and use |
`build scm5' until the problem with dump is corrected). | 'build scm5' until the problem with dump is corrected). |
|
| |
If the above builds fail because of `-F dynamic-linking', then (because | If the above builds fail because of '-F dynamic-linking', then (because |
they can't be dynamically linked) you will likely want to add some | they can't be dynamically linked) you will likely want to add some other |
other features to the build's `.opt' file. See the `-F' build option | features to the build's '.opt' file. See the '-F' build option in *note |
in *note Build Options::. | Build Options::. |
| |
If dynamic-linking is working, then you will likely want to compile | If dynamic-linking is working, then you will likely want to compile most |
most of the modules as "DLL"s. The build options for compiling DLLs | of the modules as "DLL"s. The build options for compiling DLLs are in |
are in `dlls.opt'. | 'dlls.opt'. |
| |
`make x.so' | 'make x.so' |
The `Xlib' module; *note SCM Language X Interface: (Xlibscm)Top. | The 'Xlib' module; *note SCM Language X Interface: (Xlibscm)Top. |
| |
`make myturtle' | 'make myturtle' |
Creates a DLL named `turtlegr.so' which is a simple graphics API. | Creates a DLL named 'turtlegr.so' which is a simple graphics API. |
| |
`make wbscm.so' | 'make wbscm.so' |
The `wb' module; *note B-tree database implementation: (wb)Top. | The 'wb' module; *note B-tree database implementation: (wb)Top. |
Compiling this requires that wb source be in a peer directory to | Compiling this requires that wb source be in a peer directory to |
scm. | scm. |
| |
`make dlls' | 'make dlls' |
Compiles all the distributed library modules, but not `wbscm.so'. | Compiles all the distributed library modules, but not 'wbscm.so'. |
Many of the module compiles are recursively invoked in such a way | Many of the module compiles are recursively invoked in such a way |
that failure of one (which could be due to a system library not | that failure of one (which could be due to a system library not |
being installed) doesn't cause the top-level `make dlls' to fail. | being installed) doesn't cause the top-level 'make dlls' to fail. |
If `make dlls' fails as a whole, it is time to submit a bug report | If 'make dlls' fails as a whole, it is time to submit a bug report |
(*note Reporting Problems::). | (*note Reporting Problems::). |
|
 
File: scm-5f2.info, Node: Building SCM, Next: Saving Executable Images, Prev: GNU configure and make, Up: Installing SCM File: scm-5f3.info, Node: Building SCM, Next: Saving Executable Images, Prev: GNU configure and make, Up: Installing SCM
| |
2.3 Building SCM 2.3 Building SCM
================ ================
The file "build" loads the file "build.scm", which constructs a The file "build" loads the file "build.scm", which constructs a
relational database of how to compile and link SCM executables. relational database of how to compile and link SCM executables.
`build.scm' has information for the platforms which SCM has been ported 'build.scm' has information for the platforms which SCM has been ported |
to (of which I have been notified). Some of this information is old, to (of which I have been notified). Some of this information is old,
incorrect, or incomplete. Send corrections and additions to | incorrect, or incomplete. Send corrections and additions to |
agj@alum.mit.edu. | agj@alum.mit.edu. |
* Menu: * Menu:
* Invoking Build:: * Invoking Build::
* Build Options:: build --help * Build Options:: build -help
* Compiling and Linking Custom Files:: * Compiling and Linking Custom Files::
 
File: scm-5f2.info, Node: Invoking Build, Next: Build Options, Prev: Building SCM, Up: Building SCM File: scm-5f3.info, Node: Invoking Build, Next: Build Options, Prev: Building SCM, Up: Building SCM
| |
2.3.1 Invoking Build 2.3.1 Invoking Build
-------------------- --------------------
This section teaches how to use `build', a Scheme program for creating | This section teaches how to use 'build', a Scheme program for creating |
compilation scripts to produce SCM executables and library modules. | compilation scripts to produce SCM executables and library modules. The |
The options accepted by `build' are documented in *note Build Options::. | options accepted by 'build' are documented in *note Build Options::. |
| |
Use the _any_ method if you encounter problems with the other two | Use the _any_ method if you encounter problems with the other two |
methods (MS-DOS, Unix). | methods (MS-DOS, Unix). |
MS-DOS MS-DOS
From the SCM source directory, type `build' followed by up to 9 From the SCM source directory, type 'build' followed by up to 9 |
command line arguments. command line arguments.
Unix | Unix |
From the SCM source directory, type `./build' followed by command From the SCM source directory, type './build' followed by command |
line arguments. line arguments.
_any_ | _any_ |
From the SCM source directory, start `scm' or `scmlit' and type From the SCM source directory, start 'scm' or 'scmlit' and type |
`(load "build")'. Alternatively, start `scm' or `scmlit' with the '(load "build")'. Alternatively, start 'scm' or 'scmlit' with the |
command line argument `-ilbuild'. This method will also work for | command line argument '-ilbuild'. This method will also work for |
MS-DOS and Unix. | MS-DOS and Unix. |
| |
After loading various SLIB modules, the program will print: | After loading various SLIB modules, the program will print: |
|
type (b "build <command-line>") to build | type (b "build <command-line>") to build |
type (b*) to enter build command loop | type (b*) to enter build command loop |
|
The `b*' procedure enters into a "build shell" where you can enter | The 'b*' procedure enters into a "build shell" where you can enter |
commands (with or without the `build'). Blank lines are ignored. | commands (with or without the 'build'). Blank lines are ignored. |
To create a build script with all defaults type `build'. | To create a build script with all defaults type 'build'. |
| |
If the build-shell encouters an error, you can reenter the | If the build-shell encouters an error, you can reenter the |
build-shell by typing `(b*)'. To exit scm type `(quit)'. | build-shell by typing '(b*)'. To exit scm type '(quit)'. |
|
| |
Here is a transcript of an interactive (b*) build-shell. | Here is a transcript of an interactive (b*) build-shell. |
| |
bash$ scmlit | bash$ scmlit |
SCM version 5e7, Copyright (C) 1990-2006 Free Software Foundation. | SCM version 5e7, Copyright (C) 1990-2006 Free Software Foundation. |
SCM comes with ABSOLUTELY NO WARRANTY; for details type `(terms)'. | SCM comes with ABSOLUTELY NO WARRANTY; for details type `(terms)'. |
This is free software, and you are welcome to redistribute it | This is free software, and you are welcome to redistribute it |
under certain conditions; type `(terms)' for details. | under certain conditions; type `(terms)' for details. |
> (load "build") | > (load "build") |
;loading build | ;loading build |
skipping to change at line 1089 skipping to change at line 1064
echo '#define FLOATS'>>scmflags.h | echo '#define FLOATS'>>scmflags.h |
echo '#define ARRAYS'>>scmflags.h | echo '#define ARRAYS'>>scmflags.h |
# ================ Compile C source files | # ================ Compile C source files |
gcc -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c e val.c sys.c subr.c debug.c unif.c rope.c gcc -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c e val.c sys.c subr.c debug.c unif.c rope.c
# ================ Link C object files | # ================ Link C object files |
gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc
"scm" | "scm" |
build> -t exe -w myscript.sh | build> -t exe -w myscript.sh |
"scm" | "scm" |
build> (quit) | build> (quit) |
|
No compilation was done. The `-t exe' command shows the compile | No compilation was done. The '-t exe' command shows the compile script. |
script. The `-t exe -w myscript.sh' line creates a file `myscript.sh' | The '-t exe -w myscript.sh' line creates a file 'myscript.sh' containing |
containing the compile script. To actually compile and link it, type | the compile script. To actually compile and link it, type |
`./myscript.sh'. | './myscript.sh'. |
|
Invoking build without the `-F' option will build or create a shell Invoking build without the '-F' option will build or create a shell |
script with the `arrays', `inexact', and `bignums' options as defaults. script with the 'arrays', 'inexact', and 'bignums' options as defaults. |
Invoking `build' with `-F lit -o scmlit' will make a script for | Invoking 'build' with '-F lit -o scmlit' will make a script for |
compiling `scmlit'. | compiling 'scmlit'. |
bash$ ./build bash$ ./build
-| -|
#! /bin/sh #! /bin/sh
# unix (linux) script created by SLIB/batch # unix (linux) script created by SLIB/batch
# ================ Write file with C defines # ================ Write file with C defines
rm -f scmflags.h rm -f scmflags.h
echo '#define IMPLINIT "Init5f1.scm"'>>scmflags.h | echo '#define IMPLINIT "Init5f2.scm"'>>scmflags.h |
echo '#define BIGNUMS'>>scmflags.h echo '#define BIGNUMS'>>scmflags.h
echo '#define FLOATS'>>scmflags.h echo '#define FLOATS'>>scmflags.h
echo '#define ARRAYS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h
# ================ Compile C source files # ================ Compile C source files
gcc -O2 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl .c eval.c sys.c subr.c debug.c unif.c rope.c gcc -O2 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl .c eval.c sys.c subr.c debug.c unif.c rope.c
# ================ Link C object files # ================ Link C object files
gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc
To cross compile for another platform, invoke build with the `-p' or To cross compile for another platform, invoke build with the '-p' or |
`--platform=' option. This will create a script for the platform named '--platform=' option. This will create a script for the platform named |
in the `-p' or `--platform=' option. in the '-p' or '--platform=' option. |
bash$ ./build -o scmlit -p darwin -F lit bash$ ./build -o scmlit -p darwin -F lit
-| -|
#! /bin/sh #! /bin/sh
# unix (darwin) script created by SLIB/batch # unix (darwin) script created by SLIB/batch
# ================ Write file with C defines # ================ Write file with C defines
rm -f scmflags.h rm -f scmflags.h
echo '#define IMPLINIT "Init5f1.scm"'>>scmflags.h | echo '#define IMPLINIT "Init5f2.scm"'>>scmflags.h |
# ================ Compile C source files # ================ Compile C source files
cc -O3 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl. c eval.c sys.c subr.c debug.c unif.c rope.c cc -O3 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl. c eval.c sys.c subr.c debug.c unif.c rope.c
# ================ Link C object files # ================ Link C object files
mv -f scmlit scmlit~ mv -f scmlit scmlit~
cc -o scmlit continue.o scm.o scmmain.o findexec.o script.o time.o repl.o s cl.o eval.o sys.o subr.o debug.o unif.o rope.o cc -o scmlit continue.o scm.o scmmain.o findexec.o script.o time.o repl.o s cl.o eval.o sys.o subr.o debug.o unif.o rope.o
 
File: scm-5f2.info, Node: Build Options, Next: Compiling and Linking Custom Fi les, Prev: Invoking Build, Up: Building SCM File: scm-5f3.info, Node: Build Options, Next: Compiling and Linking Custom Fi les, Prev: Invoking Build, Up: Building SCM
| |
2.3.2 Build Options 2.3.2 Build Options
------------------- -------------------
The options to "build" specify what, where, and how to build a SCM The options to "build" specify what, where, and how to build a SCM
program or dynamically linked module. These options are unrelated to program or dynamically linked module. These options are unrelated to
the SCM command line options. the SCM command line options.
-- Build Option: -p PLATFORM-NAME -- Build Option: -p PLATFORM-NAME
-- Build Option: --platform=PLATFORM-NAME -- Build Option: ---platform=PLATFORM-NAME |
specifies that the compilation should be for a specifies that the compilation should be for a
computer/operating-system combination called PLATFORM-NAME. computer/operating-system combination called PLATFORM-NAME. _Note_ |
_Note_ The case of PLATFORM-NAME is distinguised. The current The case of PLATFORM-NAME is distinguised. The current |
PLATFORM-NAMEs are all lower-case. PLATFORM-NAMEs are all lower-case.
The platforms defined by table "platform" in `build.scm' are: The platforms defined by table "platform" in 'build.scm' are: |
Table: platform Table: platform
name processor operating-system compiler name processor operating-system compiler
#f processor-family operating-system #f #f processor-family operating-system #f
symbol processor-family operating-system symbol symbol processor-family operating-system symbol
symbol symbol symbol symbol symbol symbol symbol symbol
================= ================= ================= ================= ================= ================= ================= =================
*unknown* *unknown* unix cc *unknown* *unknown* unix cc
acorn-unixlib acorn *unknown* cc acorn-unixlib acorn *unknown* cc
aix powerpc aix cc aix powerpc aix cc
alpha-elf alpha unix cc alpha-elf alpha unix cc
skipping to change at line 1205 skipping to change at line 1179
unix *unknown* unix cc unix *unknown* unix cc
vms vax vms cc vms vax vms cc
vms-gcc vax vms gcc vms-gcc vax vms gcc
watcom-9.0 i386 ms-dos wcc386p watcom-9.0 i386 ms-dos wcc386p
-- Build Option: -f PATHNAME -- Build Option: -f PATHNAME
specifies that the build options contained in PATHNAME be spliced specifies that the build options contained in PATHNAME be spliced
into the argument list at this point. The use of option files can into the argument list at this point. The use of option files can
separate functional features from platform-specific ones. separate functional features from platform-specific ones.
The `Makefile' calls out builds with the options in `.opt' files: The 'Makefile' calls out builds with the options in '.opt' files: |
`dlls.opt' 'dlls.opt' |
Options for Makefile targets dlls, myturtle, and x.so. | Options for Makefile targets dlls, myturtle, and x.so. |
'gdb.opt' |
`gdb.opt'
Options for udgdbscm and gdbscm. Options for udgdbscm and gdbscm.
'libscm.opt' |
`libscm.opt'
Options for libscm.a. Options for libscm.a.
'pg.opt' |
`pg.opt'
Options for pgscm, which instruments C functions. Options for pgscm, which instruments C functions.
'udscm4.opt' |
`udscm4.opt'
Options for targets udscm4 and dscm4 (scm). Options for targets udscm4 and dscm4 (scm).
'udscm5.opt' |
`udscm5.opt'
Options for targets udscm5 and dscm5 (scm). Options for targets udscm5 and dscm5 (scm).
The Makefile creates options files it depends on only if they do The Makefile creates options files it depends on only if they do
not already exist. not already exist.
-- Build Option: -o FILENAME -- Build Option: -o FILENAME
-- Build Option: --outname=FILENAME -- Build Option: ---outname=FILENAME |
specifies that the compilation should produce an executable or specifies that the compilation should produce an executable or
object name of FILENAME. The default is `scm'. Executable object name of FILENAME. The default is 'scm'. Executable |
suffixes will be added if neccessary, e.g. `scm' => `scm.exe'. suffixes will be added if neccessary, e.g. 'scm' => 'scm.exe'. |
-- Build Option: -l LIBNAME ... -- Build Option: -l LIBNAME ...
-- Build Option: --libraries=LIBNAME -- Build Option: ---libraries=LIBNAME |
specifies that the LIBNAME should be linked with the executable specifies that the LIBNAME should be linked with the executable
produced. If compile flags or include directories (`-I') are produced. If compile flags or include directories ('-I') are |
needed, they are automatically supplied for compilations. The `c' needed, they are automatically supplied for compilations. The 'c' |
library is always included. SCM "features" specify any libraries library is always included. SCM "features" specify any libraries
they need; so you shouldn't need this option often. they need; so you shouldn't need this option often.
-- Build Option: -D DEFINITION ... -- Build Option: -D DEFINITION ...
-- Build Option: --defines=DEFINITION -- Build Option: ---defines=DEFINITION |
specifies that the DEFINITION should be made in any C source specifies that the DEFINITION should be made in any C source
compilations. If compile flags or include directories (`-I') are compilations. If compile flags or include directories ('-I') are |
needed, they are automatically supplied for compilations. SCM needed, they are automatically supplied for compilations. SCM
"features" specify any flags they need; so you shouldn't need this "features" specify any flags they need; so you shouldn't need this
option often. option often.
-- Build Option: --compiler-options=FLAG -- Build Option: ---compiler-options=FLAG |
specifies that that FLAG will be put on compiler command-lines. specifies that that FLAG will be put on compiler command-lines.
-- Build Option: --linker-options=FLAG -- Build Option: ---linker-options=FLAG |
specifies that that FLAG will be put on linker command-lines. specifies that that FLAG will be put on linker command-lines.
-- Build Option: -s PATHNAME -- Build Option: -s PATHNAME
-- Build Option: --scheme-initial=PATHNAME -- Build Option: ---scheme-initial=PATHNAME |
specifies that PATHNAME should be the default location of the SCM specifies that PATHNAME should be the default location of the SCM
initialization file `Init5f1.scm'. SCM tries several likely | initialization file 'Init5f2.scm'. SCM tries several likely |
locations before resorting to PATHNAME (*note File-System locations before resorting to PATHNAME (*note File-System
Habitat::). If not specified, the current directory (where build Habitat::). If not specified, the current directory (where build
is building) is used. is building) is used.
-- Build Option: -c PATHNAME ... -- Build Option: -c PATHNAME ...
-- Build Option: --c-source-files=PATHNAME -- Build Option: ---c-source-files=PATHNAME |
specifies that the C source files PATHNAME ... are to be compiled. specifies that the C source files PATHNAME ... are to be compiled.
-- Build Option: -j PATHNAME ... -- Build Option: -j PATHNAME ...
-- Build Option: --object-files=PATHNAME -- Build Option: ---object-files=PATHNAME |
specifies that the object files PATHNAME ... are to be linked. specifies that the object files PATHNAME ... are to be linked.
-- Build Option: -i CALL ... -- Build Option: -i CALL ...
-- Build Option: --initialization=CALL -- Build Option: ---initialization=CALL |
specifies that the C functions CALL ... are to be invoked during specifies that the C functions CALL ... are to be invoked during
initialization. initialization.
-- Build Option: -t BUILD-WHAT -- Build Option: -t BUILD-WHAT
-- Build Option: --type=BUILD-WHAT -- Build Option: ---type=BUILD-WHAT |
specifies in general terms what sort of thing to build. The specifies in general terms what sort of thing to build. The
choices are: choices are:
`exe' 'exe' |
executable program. executable program.
'lib' |
`lib'
library module. library module.
'dlls' |
`dlls'
archived dynamically linked library object files. archived dynamically linked library object files.
'dll' |
`dll'
dynamically linked library object file. dynamically linked library object file.
The default is to build an executable. The default is to build an executable.
-- Build Option: -h BATCH-SYNTAX -- Build Option: -h BATCH-SYNTAX
-- Build Option: -batch-dialect=BATCH-SYNTAX -- Build Option: --batch-dialect=BATCH-SYNTAX |
specifies how to build. The default is to create a batch file for specifies how to build. The default is to create a batch file for
the host system. The SLIB file `batch.scm' knows how to create the host system. The SLIB file 'batch.scm' knows how to create |
batch files for: batch files for:
* unix * unix
* dos * dos
* vms * vms
* amigaos (was amigados) * amigaos (was amigados)
* system * system
This option executes the compilation and linking commands This option executes the compilation and linking commands
through the use of the `system' procedure. through the use of the 'system' procedure. |
* *unknown* * *unknown*
This option outputs Scheme code. This option outputs Scheme code.
-- Build Option: -w BATCH-FILENAME -- Build Option: -w BATCH-FILENAME
-- Build Option: -script-name=BATCH-FILENAME -- Build Option: --script-name=BATCH-FILENAME |
specifies where to write the build script. The default is to specifies where to write the build script. The default is to
display it on `(current-output-port)'. display it on '(current-output-port)'. |
-- Build Option: -F FEATURE ... -- Build Option: -F FEATURE ...
-- Build Option: --features=FEATURE -- Build Option: ---features=FEATURE |
specifies to build the given features into the executable. The specifies to build the given features into the executable. The
defined features are: defined features are:
"array" "array"
Alias for ARRAYS Alias for ARRAYS
"array-for-each" "array-for-each"
array-map! and array-for-each (arrays must also be featured). array-map! and array-for-each (arrays must also be featured).
"arrays" "arrays"
Use if you want arrays, uniform-arrays and uniform-vectors. Use if you want arrays, uniform-arrays and uniform-vectors.
"bignums" "bignums"
Large precision integers. Large precision integers.
"byte" "byte"
Treating strings as byte-vectors. Treating strings as byte-vectors.
"byte-number" "byte-number"
Byte/number conversions Byte/number conversions
"careful-interrupt-masking" "careful-interrupt-masking"
Define this for extra checking of interrupt masking and some Define this for extra checking of interrupt masking and some
simple checks for proper use of malloc and free. This is for simple checks for proper use of malloc and free. This is for
debugging C code in `sys.c', `eval.c', `repl.c' and makes the debugging C code in 'sys.c', 'eval.c', 'repl.c' and makes the |
interpreter several times slower than usual. interpreter several times slower than usual.
"cautious" "cautious"
Normally, the number of arguments arguments to interpreted Normally, the number of arguments arguments to interpreted
closures (from LAMBDA) are checked if the function part of a closures (from LAMBDA) are checked if the function part of a
form is not a symbol or only the first time the form is form is not a symbol or only the first time the form is
executed if the function part is a symbol. defining executed if the function part is a symbol. defining
`reckless' disables any checking. If you want to have SCM 'reckless' disables any checking. If you want to have SCM |
always check the number of arguments to interpreted closures always check the number of arguments to interpreted closures
define feature `cautious'. define feature 'cautious'. |
"cheap-continuations" "cheap-continuations"
If you only need straight stack continuations, executables If you only need straight stack continuations, executables
compile with this feature will run faster and use less compile with this feature will run faster and use less storage |
storage than not having it. Machines with unusual stacks than not having it. Machines with unusual stacks _need_ this. |
_need_ this. Also, if you incorporate new C code into scm Also, if you incorporate new C code into scm which uses VMS |
which uses VMS system services or library routines (which system services or library routines (which need to unwind the |
need to unwind the stack in an ordrly manner) you may need to stack in an ordrly manner) you may need to use this feature. |
use this feature.
"compiled-closure" "compiled-closure"
Use if you want to use compiled closures. Use if you want to use compiled closures.
"curses" "curses"
For the "curses" screen management package. For the "curses" screen management package.
"debug" "debug"
Turns on the features `cautious' and Turns on the features 'cautious' and |
`careful-interrupt-masking'; uses `-g' flags for debugging 'careful-interrupt-masking'; uses '-g' flags for debugging SCM |
SCM source code. source code. |
"differ" "differ"
Sequence comparison Sequence comparison
"dont-memoize-locals" "dont-memoize-locals"
SCM normally converts references to local variables to ILOCs, SCM normally converts references to local variables to ILOCs,
which make programs run faster. If SCM is badly broken, try which make programs run faster. If SCM is badly broken, try
using this option to disable the MEMOIZE_LOCALS feature. using this option to disable the MEMOIZE_LOCALS feature.
"dump" "dump"
Convert a running scheme program into an executable file. Convert a running scheme program into an executable file.
"dynamic-linking" "dynamic-linking"
Be able to load compiled files while running. Be able to load compiled files while running.
"edit-line" "edit-line"
interface to the editline or GNU readline library. interface to the editline or GNU readline library.
"engineering-notation" "engineering-notation"
Use if you want floats to display in engineering notation Use if you want floats to display in engineering notation
(exponents always multiples of 3) instead of scientific (exponents always multiples of 3) instead of scientific
notation. notation.
"generalized-c-arguments" "generalized-c-arguments"
`make_gsubr' for arbitrary (< 11) arguments to C functions. 'make_gsubr' for arbitrary (< 11) arguments to C functions. |
"i/o-extensions" "i/o-extensions"
Commonly available I/O extensions: "exec", line I/O, file Commonly available I/O extensions: "exec", line I/O, file
positioning, file delete and rename, and directory functions. positioning, file delete and rename, and directory functions.
"inexact" "inexact"
Use if you want floating point numbers. Use if you want floating point numbers.
"lit" "lit"
Lightweight - no features Lightweight - no features
"macro" "macro"
C level support for hygienic and referentially transparent C level support for hygienic and referentially transparent
macros (syntax-rules macros). macros (syntax-rules macros).
"mysql" "mysql"
Client connections to the mysql databases. Client connections to the mysql databases.
"no-heap-shrink" "no-heap-shrink"
Use if you want segments of unused heap to not be freed up Use if you want segments of unused heap to not be freed up
after garbage collection. This may increase time in GC for after garbage collection. This may increase time in GC for
*very* large working sets. *very* large working sets.
"none" "none"
No features No features
"posix" "posix"
Posix functions available on all "Unix-like" systems. fork Posix functions available on all "Unix-like" systems. fork
and process functions, user and group IDs, file permissions, and process functions, user and group IDs, file permissions,
and "link". and "link".
"reckless" "reckless"
If your scheme code runs without any errors you can disable If your scheme code runs without any errors you can disable
almost all error checking by compiling all files with almost all error checking by compiling all files with
`reckless'. 'reckless'. |
"record" "record"
The Record package provides a facility for user to define The Record package provides a facility for user to define
their own record data types. See SLIB for documentation. their own record data types. See SLIB for documentation.
"regex" "regex"
String regular expression matching. String regular expression matching.
"rev2-procedures" "rev2-procedures"
These procedures were specified in the `Revised^2 Report on These procedures were specified in the 'Revised^2 Report on |
Scheme' but not in `R4RS'. Scheme' but not in 'R4RS'. |
"sicp" "sicp"
Use if you want to run code from: Use if you want to run code from:
Harold Abelson and Gerald Jay Sussman with Julie Sussman. Harold Abelson and Gerald Jay Sussman with Julie Sussman.
`Structure and Interpretation of Computer Programs.' The MIT 'Structure and Interpretation of Computer Programs.' The MIT |
Press, Cambridge, Massachusetts, USA, 1985. Press, Cambridge, Massachusetts, USA, 1985.
Differences from R5RS are: Differences from R5RS are:
* (eq? '() '#f) * (eq? '() '#f)
* (define a 25) returns the symbol a. * (define a 25) returns the symbol a.
* (set! a 36) returns 36.
* (set! a 36) returns 36. "single-precision-only"
"single-precision-only"
Use if you want all inexact real numbers to be single Use if you want all inexact real numbers to be single
precision. This only has an effect if SINGLES is also precision. This only has an effect if SINGLES is also defined |
defined (which is the default). This does not affect complex (which is the default). This does not affect complex numbers. |
numbers.
"socket" "socket"
BSD "socket" interface. Socket addr functions require BSD "socket" interface. Socket addr functions require
inexacts or bignums for 32-bit precision. inexacts or bignums for 32-bit precision.
"tick-interrupts" "tick-interrupts"
Use if you want the ticks and ticks-interrupt functions. Use if you want the ticks and ticks-interrupt functions.
"turtlegr" "turtlegr"
"Turtle" graphics calls for both Borland-C and X11 from "Turtle" graphics calls for both Borland-C and X11 from
sjm@ee.tut.fi. sjm@ee.tut.fi.
"unix" "unix"
Those unix features which have not made it into the Posix Those unix features which have not made it into the Posix
specs: nice, acct, lstat, readlink, symlink, mknod and sync. specs: nice, acct, lstat, readlink, symlink, mknod and sync.
"wb" "wb"
WB database with relational wrapper. WB database with relational wrapper.
"wb-no-threads" | "wb-no-threads" |
no-comment | no-comment |
| |
"windows" "windows"
Microsoft Windows executable. Microsoft Windows executable.
"x" "x"
Alias for Xlib feature. Alias for Xlib feature.
"xlib" "xlib"
Interface to Xlib graphics routines. Interface to Xlib graphics routines.
 
File: scm-5f2.info, Node: Compiling and Linking Custom Files, Prev: Build Opti ons, Up: Building SCM File: scm-5f3.info, Node: Compiling and Linking Custom Files, Prev: Build Opti ons, Up: Building SCM
| |
2.3.3 Compiling and Linking Custom Files 2.3.3 Compiling and Linking Custom Files
---------------------------------------- ----------------------------------------
A correspondent asks: A correspondent asks:
How can we link in our own c files to the SCM interpreter so that How can we link in our own c files to the SCM interpreter so that
we can add our own functionality? (e.g. we have a bunch of tcp we can add our own functionality? (e.g. we have a bunch of tcp
functions we want access to). Would this involve changing functions we want access to). Would this involve changing
build.scm or the Makefile or both? build.scm or the Makefile or both?
(*note Changing Scm:: has instructions describing the C code format). Suppose (*note Changing Scm:: has instructions describing the C code format). |
a C file "foo.c" has functions you wish to add to SCM. To compile and Suppose a C file "foo.c" has functions you wish to add to SCM. To |
link your file at compile time, use the `-c' and `-i' options to build: compile and link your file at compile time, use the '-c' and '-i' |
options to build: |
bash$ ./build -c foo.c -i init_foo bash$ ./build -c foo.c -i init_foo
-| -|
#! /bin/sh #! /bin/sh
rm -f scmflags.h rm -f scmflags.h
echo '#define IMPLINIT "/home/jaffer/scm/Init5f1.scm"'>>scmflags.h | echo '#define IMPLINIT "/home/jaffer/scm/Init5f2.scm"'>>scmflags.h |
echo '#define COMPILED_INITS init_foo();'>>scmflags.h echo '#define COMPILED_INITS init_foo();'>>scmflags.h
echo '#define BIGNUMS'>>scmflags.h echo '#define BIGNUMS'>>scmflags.h
echo '#define FLOATS'>>scmflags.h echo '#define FLOATS'>>scmflags.h
echo '#define ARRAYS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h
gcc -O2 -c continue.c scm.c findexec.c script.c time.c repl.c scl.c \ gcc -O2 -c continue.c scm.c findexec.c script.c time.c repl.c scl.c \
eval.c sys.c subr.c unif.c rope.c foo.c eval.c sys.c subr.c unif.c rope.c foo.c
gcc -rdynamic -o scm continue.o scm.o findexec.o script.o time.o \ gcc -rdynamic -o scm continue.o scm.o findexec.o script.o time.o \
repl.o scl.o eval.o sys.o subr.o unif.o rope.o foo.o -lm -lc repl.o scl.o eval.o sys.o subr.o unif.o rope.o foo.o -lm -lc
To make a dynamically loadable object file use the `-t dll' option: To make a dynamically loadable object file use the '-t dll' option: |
bash$ ./build -t dll -c foo.c bash$ ./build -t dll -c foo.c
-| -|
#! /bin/sh #! /bin/sh
rm -f scmflags.h rm -f scmflags.h
echo '#define IMPLINIT "/home/jaffer/scm/Init5f1.scm"'>>scmflags.h | echo '#define IMPLINIT "/home/jaffer/scm/Init5f2.scm"'>>scmflags.h |
echo '#define BIGNUMS'>>scmflags.h echo '#define BIGNUMS'>>scmflags.h
echo '#define FLOATS'>>scmflags.h echo '#define FLOATS'>>scmflags.h
echo '#define ARRAYS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h
echo '#define DLL'>>scmflags.h echo '#define DLL'>>scmflags.h
gcc -O2 -fpic -c foo.c gcc -O2 -fpic -c foo.c
gcc -shared -o foo.so foo.o -lm -lc gcc -shared -o foo.so foo.o -lm -lc
Once `foo.c' compiles correctly (and your SCM build supports Once 'foo.c' compiles correctly (and your SCM build supports |
dynamic-loading), you can load the compiled file with the Scheme command dynamic-loading), you can load the compiled file with the Scheme command
`(load "./foo.so")'. See *note Configure Module Catalog:: for how to '(load "./foo.so")'. See *note Configure Module Catalog:: for how to |
add a compiled dll file to SLIB's catalog. add a compiled dll file to SLIB's catalog.
 
File: scm-5f2.info, Node: Saving Executable Images, Next: Installation, Prev: Building SCM, Up: Installing SCM File: scm-5f3.info, Node: Saving Executable Images, Next: Installation, Prev: Building SCM, Up: Installing SCM
| |
2.4 Saving Executable Images | 2.4 Saving Executable Images |
============================ ============================
|
In SCM, the ability to save running program images is called "dump"
(*note Dump::). In order to make `dump' available to SCM, build with
feature `dump'. `dump'ed executables are compatible with dynamic
linking.
Most of the code for "dump" is taken from `emacs-19.34/src/unex*.c'.
No modifications to the emacs source code were required to use
`unexelf.c'. Dump has not been ported to all platforms. If `unexec.c'
or `unexelf.c' don't work for you, try using the appropriate `unex*.c'
file from emacs.
The `dscm4' and `dscm5' targets in the SCM `Makefile' save images from In SCM, the ability to save running program images is called "dump" |
`udscm4' and `udscm5' executables respectively. (*note Dump::). In order to make 'dump' available to SCM, build with |
feature 'dump'. 'dump'ed executables are compatible with dynamic |
linking. |
Most of the code for "dump" is taken from 'emacs-19.34/src/unex*.c'. No |
modifications to the emacs source code were required to use 'unexelf.c'. |
Dump has not been ported to all platforms. If 'unexec.c' or 'unexelf.c' |
don't work for you, try using the appropriate 'unex*.c' file from emacs. |
The 'dscm4' and 'dscm5' targets in the SCM 'Makefile' save images from |
'udscm4' and 'udscm5' executables respectively. |
"Address space layout randomization" interferes with `dump'. Here are | "Address space layout randomization" interferes with 'dump'. Here are |
the fixes for various operating-systems: | the fixes for various operating-systems: |
Fedora-Core-1 Fedora-Core-1 |
Remove the `#' from the line `#SETARCH = setarch i386' in the Remove the '#' from the line '#SETARCH = setarch i386' in the |
`Makefile'. 'Makefile'. |
Fedora-Core-3 Fedora-Core-3 |
`http://jamesthornton.com/writing/emacs-compile.html' [For FC3] | <http://jamesthornton.com/writing/emacs-compile.html> [For FC3] |
combreloc has become the default for recent GNU ld, which breaks | combreloc has become the default for recent GNU ld, which breaks |
the unexec/undump on all versions of both Emacs and XEmacs... | the unexec/undump on all versions of both Emacs and XEmacs... |
Override by adding the following to `udscm5.opt': Override by adding the following to 'udscm5.opt': |
`--linker-options="-z nocombreloc"' '--linker-options="-z nocombreloc"' |
Linux Kernels later than 2.6.11 | Linux Kernels later than 2.6.11 |
`http://www.opensubscriber.com/message/emacs-devel@gnu.org/1007118.html' <http://www.opensubscriber.com/message/emacs-devel@gnu.org/1007118.html> |
mentions the "exec-shield" feature. Kernels later than 2.6.11 mentions the "exec-shield" feature. Kernels later than 2.6.11 must |
must do (as root): do (as root): |
echo 0 > /proc/sys/kernel/randomize_va_space echo 0 > /proc/sys/kernel/randomize_va_space |
before dumping. `Makefile' has this `randomize_va_space' stuffing before dumping. 'Makefile' has this 'randomize_va_space' stuffing |
scripted for targets `dscm4' and `dscm5'. You must either set scripted for targets 'dscm4' and 'dscm5'. You must either set |
`randomize_va_space' to 0 or run as root to dump. 'randomize_va_space' to 0 or run as root to dump. |
OS-X 10.6 | OS-X 10.6 |
`http://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages
/man1/dyld.1.html' <http://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages
/man1/dyld.1.html>
The dynamic linker uses the following environment variables. They | The dynamic linker uses the following environment variables. They |
affect any program that uses the dynamic linker. | affect any program that uses the dynamic linker. |
|
DYLD_NO_PIE | DYLD_NO_PIE |
|
Causes dyld to not randomize the load addresses of images in a | Causes dyld to not randomize the load addresses of images in a |
process where the main executable was built position independent. | process where the main executable was built position independent. |
This can be helpful when trying to reproduce and debug a problem | This can be helpful when trying to reproduce and debug a problem in |
in a PIE. | a PIE. |
|
 
File: scm-5f2.info, Node: Installation, Next: Troubleshooting and Testing, Pr ev: Saving Executable Images, Up: Installing SCM File: scm-5f3.info, Node: Installation, Next: Troubleshooting and Testing, Pr ev: Saving Executable Images, Up: Installing SCM
| |
2.5 Installation | 2.5 Installation |
================ | ================ |
Once `scmlit', `scm', and `dlls' have been built, these commands will | Once 'scmlit', 'scm', and 'dlls' have been built, these commands will |
install them to the locations specified when you ran `./configure': | install them to the locations specified when you ran './configure': |
bash$ (cd scm; make install) | bash$ (cd scm; make install) |
bash$ (cd slib; make install) | bash$ (cd slib; make install) |
Note that installation to system directories (like `/usr/bin/') will | Note that installation to system directories (like '/usr/bin/') will |
require that those commands be run as root: | require that those commands be run as root: |
bash$ (cd scm; sudo make install) | bash$ (cd scm; sudo make install) |
bash$ (cd slib; sudo make install) | bash$ (cd slib; sudo make install) |
 
File: scm-5f2.info, Node: Troubleshooting and Testing, Prev: Installation, Up : Installing SCM File: scm-5f3.info, Node: Troubleshooting and Testing, Prev: Installation, Up : Installing SCM
| |
2.6 Troubleshooting and Testing | 2.6 Troubleshooting and Testing |
=============================== | =============================== |
|
* Menu: * Menu:
|
* Problems Compiling:: * Problems Compiling::
* Problems Linking:: * Problems Linking::
* Testing:: * Testing::
* Problems Starting:: * Problems Starting::
* Problems Running:: * Problems Running::
* Reporting Problems:: * Reporting Problems::
|
 
File: scm-5f2.info, Node: Problems Compiling, Next: Problems Linking, Prev: T roubleshooting and Testing, Up: Troubleshooting and Testing File: scm-5f3.info, Node: Problems Compiling, Next: Problems Linking, Prev: T roubleshooting and Testing, Up: Troubleshooting and Testing
| |
2.6.1 Problems Compiling | 2.6.1 Problems Compiling |
------------------------ | ------------------------ |
FILE PROBLEM / MESSAGE HOW TO FIX FILE PROBLEM / MESSAGE HOW TO FIX
*.c include file not found. Correct the status of *.c include file not found. Correct the status of
STDC_HEADERS in scmfig.h. STDC_HEADERS in scmfig.h.
fix #include statement or add fix #include statement or add
#define for system type to #define for system type to
scmfig.h. scmfig.h.
*.c Function should return a value. Ignore. *.c Function should return a Ignore.
value. |
Parameter is never used. Parameter is never used.
Condition is always false. Condition is always false.
Unreachable code in function. Unreachable code in function.
scm.c assignment between incompatible Change SIGRETTYPE in scm.c. scm.c assignment between Change SIGRETTYPE in scm.c. |
types. incompatible types. |
time.c CLK_TCK redefined. incompatablility between time.c CLK_TCK redefined. incompatablility between
<stdlib.h> and <sys/types.h>. <stdlib.h> and <sys/types.h>.
Remove STDC_HEADERS in scmfig.h. Remove STDC_HEADERS in |
scmfig.h. |
Edit <sys/types.h> to remove Edit <sys/types.h> to remove
incompatability. incompatability.
subr.c Possibly incorrect assignment Ignore. subr.c Possibly incorrect assignment Ignore.
in function lgcd. in function lgcd.
sys.c statement not reached. Ignore. sys.c statement not reached. Ignore.
constant in conditional constant in conditional
expression. expression.
sys.c undeclared, outside of #undef STDC_HEADERS in scmfig.h. sys.c undeclared, outside of #undef STDC_HEADERS in |
functions. functions. scmfig.h. |
scl.c syntax error. #define SYSTNAME to your system scl.c syntax error. #define SYSTNAME to your |
type in scl.c (softtype). system type in scl.c |
(softtype). |
 
File: scm-5f2.info, Node: Problems Linking, Next: Testing, Prev: Problems Com piling, Up: Troubleshooting and Testing File: scm-5f3.info, Node: Problems Linking, Next: Testing, Prev: Problems Com piling, Up: Troubleshooting and Testing
| |
2.6.2 Problems Linking | 2.6.2 Problems Linking |
---------------------- | ---------------------- |
PROBLEM HOW TO FIX PROBLEM HOW TO FIX
_sin etc. missing. Uncomment LIBS in makefile. _sin etc. missing. Uncomment LIBS in makefile.
 
File: scm-5f2.info, Node: Testing, Next: Problems Starting, Prev: Problems Li nking, Up: Troubleshooting and Testing File: scm-5f3.info, Node: Testing, Next: Problems Starting, Prev: Problems Li nking, Up: Troubleshooting and Testing
| |
2.6.3 Testing | 2.6.3 Testing |
------------- | ------------- |
| |
Loading `r4rstest.scm' in the distribution will run an [R4RS] | Loading 'r4rstest.scm' in the distribution will run an [R4RS] |
conformance test on `scm'. | conformance test on 'scm'. |
| |
> (load "r4rstest.scm") | > (load "r4rstest.scm") |
-| | -| |
;loading r4rstest.scm | ;loading r4rstest.scm |
SECTION(2 1) | SECTION(2 1) |
SECTION(3 4) | SECTION(3 4) |
#<primitive-procedure boolean?> | #<primitive-procedure boolean?> |
#<primitive-procedure char?> | #<primitive-procedure char?> |
#<primitive-procedure null?> | #<primitive-procedure null?> |
#<primitive-procedure number?> | #<primitive-procedure number?> |
... | ... |
| |
Loading `pi.scm' in the distribution will enable you to compute digits | Loading 'pi.scm' in the distribution will enable you to compute digits |
of pi. | of pi. |
| |
> (load "pi.scm") | > (load "pi.scm") |
;loading pi.scm | ;loading pi.scm |
;done loading pi.scm | ;done loading pi.scm |
#<unspecified> | #<unspecified> |
> (pi 100 5) | > (pi 100 5) |
00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 | 00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 |
37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 | 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 |
70679 | 70679 |
;Evaluation took 550 ms (60 in gc) 36976 cells work, 1548.B other | ;Evaluation took 550 ms (60 in gc) 36976 cells work, 1548.B other |
#<unspecified> | #<unspecified> |
| |
Performance | Performance |
----------- | ----------- |
| |
Loading `bench.scm' will compute and display performance statistics of | Loading 'bench.scm' will compute and display performance statistics of |
SCM running `pi.scm'. `make bench' or `make benchlit' appends the | SCM running 'pi.scm'. 'make bench' or 'make benchlit' appends the |
performance report to the file `BenchLog', facilitating tracking | performance report to the file 'BenchLog', facilitating tracking effects |
effects of changes to SCM on performance. | of changes to SCM on performance. |
| |
 
File: scm-5f2.info, Node: Problems Starting, Next: Problems Running, Prev: Te sting, Up: Troubleshooting and Testing File: scm-5f3.info, Node: Problems Starting, Next: Problems Running, Prev: Te sting, Up: Troubleshooting and Testing
| |
2.6.4 Problems Starting | 2.6.4 Problems Starting |
----------------------- | ----------------------- |
PROBLEM HOW TO FIX PROBLEM HOW TO FIX
/bin/bash: scm: program not found Is `scm' in a `$PATH' directory? | /bin/bash: scm: program not found Is 'scm' in a '$PATH' directory? |
/bin/bash: /usr/local/bin/scm: `chmod +x /usr/local/bin/scm' | /bin/bash: /usr/local/bin/scm: 'chmod +x /usr/local/bin/scm' |
Permission denied | Permission denied |
Opening message and then machine Change memory model option to C Opening message and then machine Change memory model option to C
crashes. compiler (or makefile). crashes. compiler (or makefile).
Make sure sizet definition is Make sure sizet definition is
correct in scmfig.h. correct in scmfig.h.
Reduce the size of HEAP_SEG_SIZE in Reduce the size of HEAP_SEG_SIZE |
setjump.h. in setjump.h. |
Input hangs. #define NOSETBUF Input hangs. #define NOSETBUF
ERROR: heap: need larger initial. Increase initial heap allocation ERROR: heap: need larger initial. Increase initial heap allocation
using -a<kb> or INIT_HEAP_SIZE. using -a<kb> or INIT_HEAP_SIZE.
ERROR: Could not allocate. Check sizet definition. ERROR: Could not allocate. Check sizet definition.
Use 32 bit compiler mode. Use 32 bit compiler mode.
Don't try to run as subproccess. Don't try to run as subproccess.
remove <FLAG> in scmfig.h and Do so and recompile files. remove <FLAG> in scmfig.h and Do so and recompile files.
recompile scm. recompile scm.
add <FLAG> in scmfig.h and add <FLAG> in scmfig.h and
recompile scm. recompile scm.
ERROR: Init5f1.scm not found. Assign correct IMPLINIT in makefile | ERROR: Init5f2.scm not found. Assign correct IMPLINIT in |
or scmfig.h. makefile or scmfig.h. |
Define environment variable Define environment variable
SCM_INIT_PATH to be the full SCM_INIT_PATH to be the full
pathname of Init5f1.scm. | pathname of Init5f2.scm. |
WARNING: require.scm not found. Define environment variable WARNING: require.scm not found. Define environment variable
SCHEME_LIBRARY_PATH to be the full SCHEME_LIBRARY_PATH to be the full
pathname of the scheme library pathname of the scheme library
[SLIB]. [SLIB].
Change library-vicinity in Change library-vicinity in
Init5f1.scm to point to library or | Init5f2.scm to point to library or |
remove. remove.
Make sure the value of Make sure the value of
(library-vicinity) has a trailing (library-vicinity) has a trailing
file separator (like / or \). file separator (like / or \).
 
File: scm-5f2.info, Node: Problems Running, Next: Reporting Problems, Prev: P roblems Starting, Up: Troubleshooting and Testing File: scm-5f3.info, Node: Problems Running, Next: Reporting Problems, Prev: P roblems Starting, Up: Troubleshooting and Testing
| |
2.6.5 Problems Running | 2.6.5 Problems Running |
---------------------- | ---------------------- |
PROBLEM HOW TO FIX PROBLEM HOW TO FIX
Runs some and then machine crashes. See above under machine crashes. Runs some and then machine See above under machine crashes. |
crashes. |
Runs some and then ERROR: ... Remove optimization option to C Runs some and then ERROR: ... Remove optimization option to C
(after a GC has happened). compiler and recompile. (after a GC has happened). compiler and recompile.
#define SHORT_ALIGN in `scmfig.h'. #define SHORT_ALIGN in 'scmfig.h'. |
Some symbol names print incorrectly. Change memory model option to C Some symbol names print Change memory model option to C |
compiler (or makefile). incorrectly. compiler (or makefile). |
Check that HEAP_SEG_SIZE fits Check that HEAP_SEG_SIZE fits
within sizet. within sizet.
Increase size of HEAP_SEG_SIZE (or Increase size of HEAP_SEG_SIZE (or
INIT_HEAP_SIZE if it is smaller INIT_HEAP_SIZE if it is smaller
than HEAP_SEG_SIZE). than HEAP_SEG_SIZE).
ERROR: Rogue pointer in Heap. See above under machine crashes. ERROR: Rogue pointer in Heap. See above under machine crashes.
Newlines don't appear correctly in Check file mode (define OPEN_... in Newlines don't appear correctly in Check file mode (define OPEN_... |
output files. `Init5f1.scm'). | output files. in 'Init5f2.scm'). |
Spaces or control characters appear Check character defines in Spaces or control characters Check character defines in |
in symbol names. `scmfig.h'. appear in symbol names. 'scmfig.h'. |
Negative numbers turn positive. Check SRS in `scmfig.h'. Negative numbers turn positive. Check SRS in 'scmfig.h'. |
;ERROR: bignum: numerical overflow Increase NUMDIGS_MAX in `scmfig.h' ;ERROR: bignum: numerical overflow Increase NUMDIGS_MAX in 'scmfig.h' |
and recompile. and recompile.
VMS: Couldn't unwind stack. #define CHEAP_CONTINUATIONS in VMS: Couldn't unwind stack. #define CHEAP_CONTINUATIONS in
`scmfig.h'. 'scmfig.h'. |
VAX: botched longjmp. VAX: botched longjmp.
| |
 
File: scm-5f2.info, Node: Reporting Problems, Prev: Problems Running, Up: Tro ubleshooting and Testing File: scm-5f3.info, Node: Reporting Problems, Prev: Problems Running, Up: Tro ubleshooting and Testing
| |
2.6.6 Reporting Problems | 2.6.6 Reporting Problems |
------------------------ | ------------------------ |
Reported problems and solutions are grouped under Compiling, Linking, Reported problems and solutions are grouped under Compiling, Linking,
Running, and Testing. If you don't find your problem listed there, you Running, and Testing. If you don't find your problem listed there, you
can send a bug report to `agj@alum.mit.edu' or `scm-discuss@gnu.org'. | can send a bug report to 'agj@alum.mit.edu' or 'scm-discuss@gnu.org'. |
The bug report should include: | The bug report should include: |
1. The version of SCM (printed when SCM is invoked with no arguments). 1. The version of SCM (printed when SCM is invoked with no arguments).
2. The type of computer you are using. 2. The type of computer you are using.
3. The name and version of your computer's operating system. 3. The name and version of your computer's operating system.
4. The values of the environment variables 'SCM_INIT_PATH' and |
4. The values of the environment variables `SCM_INIT_PATH' and 'SCHEME_LIBRARY_PATH'. |
`SCHEME_LIBRARY_PATH'.
5. The name and version of your C compiler. 5. The name and version of your C compiler.
6. If you are using an executable from a distribution, the name, 6. If you are using an executable from a distribution, the name,
vendor, and date of that distribution. In this case, vendor, and date of that distribution. In this case, corresponding |
corresponding with the vendor is recommended. with the vendor is recommended. |
 
File: scm-5f2.info, Node: Operational Features, Next: The Language, Prev: Ins talling SCM, Up: Top File: scm-5f3.info, Node: Operational Features, Next: The Language, Prev: Ins talling SCM, Up: Top
| |
3 Operational Features 3 Operational Features
********************** **********************
* Menu: * Menu:
* Invoking SCM:: * Invoking SCM::
* SCM Options:: * SCM Options::
* Invocation Examples:: * Invocation Examples::
* SCM Variables:: * SCM Variables::
* SCM Session:: * SCM Session::
* Editing Scheme Code:: * Editing Scheme Code::
* Debugging Scheme Code:: * Debugging Scheme Code::
* Debugging Continuations:: * Debugging Continuations::
* Errors:: * Errors::
* Memoized Expressions:: * Memoized Expressions::
* Internal State:: * Internal State::
* Scripting:: * Scripting::
 
File: scm-5f2.info, Node: Invoking SCM, Next: SCM Options, Prev: Operational Features, Up: Operational Features File: scm-5f3.info, Node: Invoking SCM, Next: SCM Options, Prev: Operational Features, Up: Operational Features
| |
3.1 Invoking SCM 3.1 Invoking SCM
================ ================
scm [-a kbytes] [-muvbiq] [-version] [-help] scm [-a kbytes] [-muvbiq] [--version] [--help] |
[[-]-no-init-file] [--no-symbol-case-fold] [[-]-no-init-file] [--no-symbol-case-fold]
[-p int] [-r feature] [-h feature] [-p int] [-r feature] [-h feature]
[-d filename] [-f filename] [-l filename] [-d filename] [-f filename] [-l filename]
[-c expression] [-e expression] [-o dumpname] [-c expression] [-e expression] [-o dumpname]
[-- | - | -s] [filename] [arguments ...] [-- | - | -s] [filename] [arguments ...]
Upon startup `scm' loads the file specified by by the environment Upon startup 'scm' loads the file specified by by the environment |
variable SCM_INIT_PATH. variable SCM_INIT_PATH.
If SCM_INIT_PATH is not defined or if the file it names is not present, If SCM_INIT_PATH is not defined or if the file it names is not present,
`scm' tries to find the directory containing the executable file. If 'scm' tries to find the directory containing the executable file. If it |
it is able to locate the executable, `scm' looks for the initialization is able to locate the executable, 'scm' looks for the initialization |
file (usually `Init5f1.scm') in platform-dependent directories relative | file (usually 'Init5f2.scm') in platform-dependent directories relative |
to this directory. See *note File-System Habitat:: for a blow-by-blow to this directory. See *note File-System Habitat:: for a blow-by-blow
description. description.
As a last resort (if initialization file cannot be located), the C As a last resort (if initialization file cannot be located), the C
compile parameter IMPLINIT (defined in the makefile or `scmfig.h') is compile parameter IMPLINIT (defined in the makefile or 'scmfig.h') is |
tried. tried.
Unless the option `-no-init-file' or `--no-init-file' occurs in the Unless the option '-no-init-file' or '--no-init-file' occurs in the |
command line, or if `scm' is being invoked as a script, `Init5f1.scm' | command line, or if 'scm' is being invoked as a script, 'Init5f2.scm' |
checks to see if there is file `ScmInit.scm' in the path specified by checks to see if there is file 'ScmInit.scm' in the path specified by |
the environment variable HOME (or in the current directory if HOME is the environment variable HOME (or in the current directory if HOME is
undefined). If it finds such a file, then it is loaded. undefined). If it finds such a file, then it is loaded.
`Init5f1.scm' then looks for command input from one of three sources: | 'Init5f2.scm' then looks for command input from one of three sources: |
From an option on the command line, from a file named on the command From an option on the command line, from a file named on the command
line, or from standard input. line, or from standard input.
This explanation applies to SCMLIT or other builds of SCM. This explanation applies to SCMLIT or other builds of SCM.
Scheme-code files can also invoke SCM and its variants. *Note #!: Scheme-code files can also invoke SCM and its variants. *Note #!:
Lexical Conventions. Lexical Conventions.
 
File: scm-5f2.info, Node: SCM Options, Next: Invocation Examples, Prev: Invok ing SCM, Up: Operational Features File: scm-5f3.info, Node: SCM Options, Next: Invocation Examples, Prev: Invok ing SCM, Up: Operational Features
| |
3.2 Options 3.2 Options
=========== ===========
The options are processed in the order specified on the command line. The options are processed in the order specified on the command line.
-- Command Option: -a k -- Command Option: -a k
specifies that `scm' should allocate an initial heapsize of K specifies that 'scm' should allocate an initial heapsize of K |
kilobytes. This option, if present, must be the first on the kilobytes. This option, if present, must be the first on the
command line. If not specified, the default is `INIT_HEAP_SIZE' command line. If not specified, the default is 'INIT_HEAP_SIZE' in |
in source file `setjump.h' which the distribution sets at source file 'setjump.h' which the distribution sets at |
`25000*sizeof(cell)'. '25000*sizeof(cell)'. |
-- Command Option: -no-init-file -- Command Option: -no-init-file
-- Command Option: --no-init-file -- Command Option: ---no-init-file |
Inhibits the loading of `ScmInit.scm' as described above. Inhibits the loading of 'ScmInit.scm' as described above. |
-- Command Option: -no-symbol-case-fold -- Command Option: --no-symbol-case-fold |
Symbol (and identifier) names will be case sensitive. Symbol (and identifier) names will be case sensitive.
-- Command Option: --help -- Command Option: ---help |
prints usage information and URI; then exit. prints usage information and URI; then exit.
-- Command Option: --version -- Command Option: ---version |
prints version information and exit. prints version information and exit.
-- Command Option: -r feature -- Command Option: -r feature
requires FEATURE. This will load a file from [SLIB] if that requires FEATURE. This will load a file from [SLIB] if that
FEATURE is not already provided. If FEATURE is 2, 2rs, or r2rs; FEATURE is not already provided. If FEATURE is 2, 2rs, or r2rs; 3, |
3, 3rs, or r3rs; 4, 4rs, or r4rs; 5, 5rs, or r5rs; `scm' will 3rs, or r3rs; 4, 4rs, or r4rs; 5, 5rs, or r5rs; 'scm' will require |
require the features neccessary to support [R2RS]; [R3RS]; [R4RS]; the features neccessary to support [R2RS]; [R3RS]; [R4RS]; or |
or [R5RS], respectively. [R5RS], respectively. |
-- Command Option: -h feature -- Command Option: -h feature
provides FEATURE. provides FEATURE.
-- Command Option: -l filename -- Command Option: -l filename
-- Command Option: -f filename -- Command Option: -f filename
loads FILENAME. `Scm' will load the first (unoptioned) file named loads FILENAME. 'Scm' will load the first (unoptioned) file named |
on the command line if no `-c', `-e', `-f', `-l', or `-s' option on the command line if no '-c', '-e', '-f', '-l', or '-s' option |
preceeds it. preceeds it.
-- Command Option: -d filename -- Command Option: -d filename
Loads SLIB `databases' feature and opens FILENAME as a database. Loads SLIB 'databases' feature and opens FILENAME as a database. |
-- Command Option: -e expression -- Command Option: -e expression
-- Command Option: -c expression -- Command Option: -c expression
specifies that the scheme expression EXPRESSION is to be specifies that the scheme expression EXPRESSION is to be evaluated. |
evaluated. These options are inspired by `perl' and `sh' These options are inspired by 'perl' and 'sh' respectively. On |
respectively. On Amiga systems the entire option and argument Amiga systems the entire option and argument need to be enclosed in |
need to be enclosed in quotes. For instance `"-e(newline)"'. quotes. For instance '"-e(newline)"'. |
-- Command Option: -o dumpname -- Command Option: -o dumpname
saves the current SCM session as the executable program `dumpname'. saves the current SCM session as the executable program 'dumpname'. |
This option works only in SCM builds supporting `dump' (*note This option works only in SCM builds supporting 'dump' (*note |
Dump::). Dump::).
If options appear on the command line after `-o DUMPNAME', then If options appear on the command line after '-o DUMPNAME', then the |
the saved session will continue with processing those options when saved session will continue with processing those options when it |
it is invoked. Otherwise the (new) command line is processed as is invoked. Otherwise the (new) command line is processed as usual |
usual when the saved image is invoked. when the saved image is invoked. |
-- Command Option: -p level -- Command Option: -p level
sets the prolixity (verboseness) to LEVEL. This is the same as sets the prolixity (verboseness) to LEVEL. This is the same as the |
the `scm' command (verobse LEVEL). 'scm' command (verobse LEVEL). |
-- Command Option: -v -- Command Option: -v
(verbose mode) specifies that `scm' will print prompts, evaluation (verbose mode) specifies that 'scm' will print prompts, evaluation |
times, notice of loading files, and garbage collection statistics. times, notice of loading files, and garbage collection statistics.
This is the same as `-p3'. This is the same as '-p3'. |
-- Command Option: -q -- Command Option: -q
(quiet mode) specifies that `scm' will print no extra information. (quiet mode) specifies that 'scm' will print no extra information. |
This is the same as `-p0'. This is the same as '-p0'. |
-- Command Option: -m -- Command Option: -m
specifies that subsequent loads, evaluations, and user specifies that subsequent loads, evaluations, and user interactions |
interactions will be with syntax-rules macro capability. To use a will be with syntax-rules macro capability. To use a specific |
specific syntax-rules macro implementation from [SLIB] (instead of syntax-rules macro implementation from [SLIB] (instead of [SLIB]'s |
[SLIB]'s default) put `-r' MACROPACKAGE before `-m' on the command default) put '-r' MACROPACKAGE before '-m' on the command line. |
line.
-- Command Option: -u -- Command Option: -u
specifies that subsequent loads, evaluations, and user specifies that subsequent loads, evaluations, and user interactions |
interactions will be without syntax-rules macro capability. will be without syntax-rules macro capability. Syntax-rules macro |
Syntax-rules macro capability can be restored by a subsequent `-m' capability can be restored by a subsequent '-m' on the command line |
on the command line or from Scheme code. or from Scheme code. |
-- Command Option: -i -- Command Option: -i
specifies that `scm' should run interactively. That means that specifies that 'scm' should run interactively. That means that |
`scm' will not terminate until the `(quit)' or `(exit)' command is 'scm' will not terminate until the '(quit)' or '(exit)' command is |
given, even if there are errors. It also sets the prolixity level given, even if there are errors. It also sets the prolixity level
to 2 if it is less than 2. This will print prompts, evaluation to 2 if it is less than 2. This will print prompts, evaluation
times, and notice of loading files. The prolixity level can be times, and notice of loading files. The prolixity level can be set |
set by subsequent options. If `scm' is started from a tty, it by subsequent options. If 'scm' is started from a tty, it will |
will assume that it should be interactive unless given a assume that it should be interactive unless given a subsequent '-b' |
subsequent `-b' option. option. |
-- Command Option: -b -- Command Option: -b
specifies that `scm' should run non-interactively. That means that specifies that 'scm' should run non-interactively. That means that |
`scm' will terminate after processing the command line or if there 'scm' will terminate after processing the command line or if there |
are errors. are errors.
-- Command Option: -s -- Command Option: -s
specifies, by analogy with `sh', that `scm' should run specifies, by analogy with 'sh', that 'scm' should run |
interactively and that further options are to be treated as program interactively and that further options are to be treated as program
aguments. aguments.
-- Command Option: - -- Command Option: -
-- Command Option: -- -- Command Option: --- |
specifies that further options are to be treated as program specifies that further options are to be treated as program
aguments. aguments.
 
File: scm-5f2.info, Node: Invocation Examples, Next: SCM Variables, Prev: SCM Options, Up: Operational Features File: scm-5f3.info, Node: Invocation Examples, Next: SCM Variables, Prev: SCM Options, Up: Operational Features
| |
3.3 Invocation Examples 3.3 Invocation Examples
======================= =======================
`% scm foo.scm' '% scm foo.scm' |
Loads and executes the contents of `foo.scm' and then enters Loads and executes the contents of 'foo.scm' and then enters |
interactive session. interactive session.
`% scm -f foo.scm arg1 arg2 arg3' '% scm -f foo.scm arg1 arg2 arg3' |
Parameters `arg1', `arg2', and `arg3' are stored in the global Parameters 'arg1', 'arg2', and 'arg3' are stored in the global list |
list `*argv*'; Loads and executes the contents of `foo.scm' and '*argv*'; Loads and executes the contents of 'foo.scm' and exits. |
exits.
`% scm -s foo.scm arg1 arg2' '% scm -s foo.scm arg1 arg2' |
Sets *argv* to `("foo.scm" "arg1" "arg2")' and enters interactive Sets *argv* to '("foo.scm" "arg1" "arg2")' and enters interactive |
session. session.
`% scm -e `(write (list-ref *argv* *optind*))' bar' '% scm -e `(write (list-ref *argv* *optind*))' bar' |
Prints `"bar"'. Prints '"bar"'. |
`% scm -rpretty-print -r format -i' '% scm -rpretty-print -r format -i' |
Loads `pretty-print' and `format' and enters interactive session. Loads 'pretty-print' and 'format' and enters interactive session. |
`% scm -r5' '% scm -r5' |
Loads `dynamic-wind', `values', and syntax-rules macros and enters Loads 'dynamic-wind', 'values', and syntax-rules macros and enters |
interactive (with macros) session. interactive (with macros) session.
`% scm -r5 -r4' '% scm -r5 -r4' |
Like above but `rev4-optional-procedures' are also loaded. Like above but 'rev4-optional-procedures' are also loaded. |
 
File: scm-5f2.info, Node: SCM Variables, Next: SCM Session, Prev: Invocation Examples, Up: Operational Features File: scm-5f3.info, Node: SCM Variables, Next: SCM Session, Prev: Invocation Examples, Up: Operational Features
| |
3.4 Environment Variables 3.4 Environment Variables
========================= =========================
-- Environment Variable: SCM_INIT_PATH -- Environment Variable: SCM_INIT_PATH
is the pathname where `scm' will look for its initialization code. is the pathname where 'scm' will look for its initialization code. |
The default is the file `Init5f1.scm' in the source directory. | The default is the file 'Init5f2.scm' in the source directory. |
-- Environment Variable: SCHEME_LIBRARY_PATH -- Environment Variable: SCHEME_LIBRARY_PATH
is the [SLIB] Scheme library directory. is the [SLIB] Scheme library directory.
-- Environment Variable: HOME -- Environment Variable: HOME
is the directory where `Init5f1.scm' will look for the user | is the directory where 'Init5f2.scm' will look for the user |
initialization file `ScmInit.scm'. initialization file 'ScmInit.scm'. |
-- Environment Variable: EDITOR -- Environment Variable: EDITOR
is the name of the program which `ed' will call. If EDITOR is not is the name of the program which 'ed' will call. If EDITOR is not |
defined, the default is `ed'. defined, the default is 'ed'. |
3.5 Scheme Variables 3.5 Scheme Variables
==================== ====================
-- Variable: *argv* -- Variable: *argv*
contains the list of arguments to the program. `*argv*' can change contains the list of arguments to the program. '*argv*' can change |
during argument processing. This list is suitable for use as an during argument processing. This list is suitable for use as an
argument to [SLIB] `getopt'. argument to [SLIB] 'getopt'. |
-- Variable: *syntax-rules* -- Variable: *syntax-rules*
controls whether loading and interaction support syntax-rules controls whether loading and interaction support syntax-rules
macros. Define this in `ScmInit.scm' or files specified on the macros. Define this in 'ScmInit.scm' or files specified on the |
command line. This can be overridden by subsequent `-m' and `-u' command line. This can be overridden by subsequent '-m' and '-u' |
options. options.
-- Variable: *interactive* -- Variable: *interactive*
controls interactivity as explained for the `-i' and `-b' options. controls interactivity as explained for the '-i' and '-b' options. |
Define this in `ScmInit.scm' or files specified on the command Define this in 'ScmInit.scm' or files specified on the command |
line. This can be overridden by subsequent `-i' and `-b' options. line. This can be overridden by subsequent '-i' and '-b' options. |
 
File: scm-5f2.info, Node: SCM Session, Next: Editing Scheme Code, Prev: SCM V ariables, Up: Operational Features File: scm-5f3.info, Node: SCM Session, Next: Editing Scheme Code, Prev: SCM V ariables, Up: Operational Features
| |
3.6 SCM Session 3.6 SCM Session
=============== ===============
* Options, file loading and features can be specified from the * Options, file loading and features can be specified from the
command line. *Note System interface: (scm)System interface. command line. *Note (scm)System interface::. *Note |
*Note Require: (slib)Require. (slib)Require::. |
* Typing the end-of-file character at the top level session (while * Typing the end-of-file character at the top level session (while
SCM is not waiting for parenthesis closure) causes SCM to exit. SCM is not waiting for parenthesis closure) causes SCM to exit.
* Typing the interrupt character aborts evaluation of the current * Typing the interrupt character aborts evaluation of the current
form and resumes the top level read-eval-print loop. form and resumes the top level read-eval-print loop.
-- Function: quit -- Function: quit
-- Function: quit n -- Function: quit n
-- Function: exit -- Function: exit
-- Function: exit n -- Function: exit n
Aliases for `exit' (*note exit: (slib)System.). On many systems, Aliases for 'exit' (*note exit: (slib)System.). On many systems, |
SCM can also tail-call another program. *Note execp: SCM can also tail-call another program. *Note execp:
I/O-Extensions. I/O-Extensions.
-- Callback procedure: boot-tail dumped? -- Callback procedure: boot-tail dumped?
`boot-tail' is called by `scm_top_level' just before entering 'boot-tail' is called by 'scm_top_level' just before entering |
interactive top-level. If `boot-tail' calls `quit', then interactive top-level. If 'boot-tail' calls 'quit', then |
interactive top-level is not entered. interactive top-level is not entered.
-- Function: program-arguments -- Function: program-arguments
Returns a list of strings of the arguments scm was called with. Returns a list of strings of the arguments scm was called with.
-- Function: getlogin -- Function: getlogin
Returns the (login) name of the user logged in on the controlling Returns the (login) name of the user logged in on the controlling
terminal of the process, or #f if this information cannot be terminal of the process, or #f if this information cannot be
determined. determined.
For documentation of the procedures `getenv' and `system' *Note System For documentation of the procedures 'getenv' and 'system' *Note |
Interface: (slib)System Interface. (slib)System Interface::. |
SCM extends `getenv' as suggested by draft SRFI-98: SCM extends 'getenv' as suggested by draft SRFI-98: |
-- Function: getenv name -- Function: getenv name
Looks up NAME, a string, in the program environment. If NAME is Looks up NAME, a string, in the program environment. If NAME is
found a string of its value is returned. Otherwise, `#f' is found a string of its value is returned. Otherwise, '#f' is |
returned. returned.
-- Function: getenv -- Function: getenv
Returns names and values of all the environment variables as an Returns names and values of all the environment variables as an
association-list. association-list.
(getenv) => (getenv) =>
(("PATH" . "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin") (("PATH" . "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin")
("USERNAME" . "taro")) ("USERNAME" . "taro"))
-- Function: vms-debug -- Function: vms-debug
If SCM is compiled under VMS this `vms-debug' will invoke the VMS If SCM is compiled under VMS this 'vms-debug' will invoke the VMS |
debugger. debugger.
 
File: scm-5f2.info, Node: Editing Scheme Code, Next: Debugging Scheme Code, P rev: SCM Session, Up: Operational Features File: scm-5f3.info, Node: Editing Scheme Code, Next: Debugging Scheme Code, P rev: SCM Session, Up: Operational Features
| |
3.7 Editing Scheme Code 3.7 Editing Scheme Code
======================= =======================
-- Function: ed arg1 ... -- Function: ed arg1 ...
The value of the environment variable `EDITOR' (or just `ed' if it The value of the environment variable 'EDITOR' (or just 'ed' if it |
isn't defined) is invoked as a command with arguments ARG1 .... isn't defined) is invoked as a command with arguments ARG1 ....
-- Function: ed filename -- Function: ed filename
If SCM is compiled under VMS `ed' will invoke the editor with a If SCM is compiled under VMS 'ed' will invoke the editor with a |
single the single argument FILENAME. single the single argument FILENAME.
Gnu Emacs: Gnu Emacs:
Editing of Scheme code is supported by emacs. Buffers holding Editing of Scheme code is supported by emacs. Buffers holding
files ending in .scm are automatically put into scheme-mode. files ending in .scm are automatically put into scheme-mode.
If your Emacs can run a process in a buffer you can use the Emacs If your Emacs can run a process in a buffer you can use the Emacs
command `M-x run-scheme' with SCM. Otherwise, use the emacs command 'M-x run-scheme' with SCM. Otherwise, use the emacs command |
command `M-x suspend-emacs'; or see "other systems" below. 'M-x suspend-emacs'; or see "other systems" below. |
Epsilon (MS-DOS): Epsilon (MS-DOS):
There is lisp (and scheme) mode available by use of the package There is lisp (and scheme) mode available by use of the package
`LISP.E'. It offers several different indentation formats. With 'LISP.E'. It offers several different indentation formats. With |
this package, buffers holding files ending in `.L', `.LSP', `.S', this package, buffers holding files ending in '.L', '.LSP', '.S', |
and `.SCM' (my modification) are automatically put into lisp-mode. and '.SCM' (my modification) are automatically put into lisp-mode. |
It is possible to run a process in a buffer under Epsilon. With It is possible to run a process in a buffer under Epsilon. With
Epsilon 5.0 the command line options `-e512 -m0' are neccessary to Epsilon 5.0 the command line options '-e512 -m0' are neccessary to |
manage RAM properly. It has been reported that when compiling SCM manage RAM properly. It has been reported that when compiling SCM
with Turbo C, you need to `#define NOSETBUF' for proper operation with Turbo C, you need to '#define NOSETBUF' for proper operation |
in a process buffer with Epsilon 5.0. in a process buffer with Epsilon 5.0.
One can also call out to an editor from SCM if RAM is at a One can also call out to an editor from SCM if RAM is at a premium; |
premium; See "under other systems" below. See "under other systems" below. |
other systems: other systems:
Define the environment variable `EDITOR' to be the name of the Define the environment variable 'EDITOR' to be the name of the |
editing program you use. The SCM procedure `(ed arg1 ...)' will editing program you use. The SCM procedure '(ed arg1 ...)' will |
invoke your editor and return to SCM when you exit the editor. The invoke your editor and return to SCM when you exit the editor. The
following definition is convenient: following definition is convenient:
(define (e) (ed "work.scm") (load "work.scm")) (define (e) (ed "work.scm") (load "work.scm"))
Typing `(e)' will invoke the editor with the file of interest. Typing '(e)' will invoke the editor with the file of interest. |
After editing, the modified file will be loaded. After editing, the modified file will be loaded.
 
File: scm-5f2.info, Node: Debugging Scheme Code, Next: Debugging Continuations , Prev: Editing Scheme Code, Up: Operational Features File: scm-5f3.info, Node: Debugging Scheme Code, Next: Debugging Continuations , Prev: Editing Scheme Code, Up: Operational Features
| |
3.8 Debugging Scheme Code 3.8 Debugging Scheme Code
========================= =========================
The `cautious' option of `build' (*note Build Options::) supports The 'cautious' option of 'build' (*note Build Options::) supports |
debugging in Scheme. debugging in Scheme.
"CAUTIOUS" "CAUTIOUS"
If SCM is built with the `CAUTIOUS' flag, then when an error If SCM is built with the 'CAUTIOUS' flag, then when an error |
occurs, a "stack trace" of certain pending calls are printed as occurs, a "stack trace" of certain pending calls are printed as
part of the default error response. A (memoized) expression and part of the default error response. A (memoized) expression and
newline are printed for each partially evaluated combination whose newline are printed for each partially evaluated combination whose
procedure is not builtin. See *note Memoized Expressions:: for procedure is not builtin. See *note Memoized Expressions:: for how |
how to read memoized expressions. to read memoized expressions. |
Also as the result of the `CAUTIOUS' flag, both `error' and Also as the result of the 'CAUTIOUS' flag, both 'error' and |
`user-interrupt' (invoked by <C-c>) to print stack traces and 'user-interrupt' (invoked by <C-c>) to print stack traces and |
conclude by calling `breakpoint' (*note Breakpoints: conclude by calling 'breakpoint' (*note (slib)Breakpoints::) |
(slib)Breakpoints.) instead of aborting to top level. Under instead of aborting to top level. Under either condition, program |
either condition, program execution can be resumed by `(continue)'. execution can be resumed by '(continue)'. |
In this configuration one can interrupt a running Scheme program In this configuration one can interrupt a running Scheme program
with <C-c>, inspect or modify top-level values, trace or untrace with <C-c>, inspect or modify top-level values, trace or untrace
procedures, and continue execution with `(continue)'. procedures, and continue execution with '(continue)'. |
If `verbose' (*note verbose: Internal State.) is called with an If 'verbose' (*note verbose: Internal State.) is called with an argument |
argument greater than 2, then the interpreter will check stack size greater than 2, then the interpreter will check stack size periodically. |
periodically. If the size of stack in use exceeds the C #define If the size of stack in use exceeds the C #define 'STACK_LIMIT' (default |
`STACK_LIMIT' (default is `HEAP_SEG_SIZE'), SCM generates a `stack' is 'HEAP_SEG_SIZE'), SCM generates a 'stack' 'segment violation'. |
`segment violation'.
There are several SLIB macros which so useful that SCM automatically There are several SLIB macros which so useful that SCM automatically
loads the appropriate module from SLIB if they are invoked. loads the appropriate module from SLIB if they are invoked.
-- Macro: trace proc1 ... -- Macro: trace proc1 ...
Traces the top-level named procedures given as arguments. Traces the top-level named procedures given as arguments.
-- Macro: trace -- Macro: trace
With no arguments, makes sure that all the currently traced With no arguments, makes sure that all the currently traced
identifiers are traced (even if those identifiers have been identifiers are traced (even if those identifiers have been
redefined) and returns a list of the traced identifiers. redefined) and returns a list of the traced identifiers.
-- Macro: untrace proc1 ... -- Macro: untrace proc1 ...
Turns tracing off for its arguments. Turns tracing off for its arguments.
-- Macro: untrace -- Macro: untrace
With no arguments, untraces all currently traced identifiers and With no arguments, untraces all currently traced identifiers and
returns a list of these formerly traced identifiers. returns a list of these formerly traced identifiers.
The routines I use most frequently for debugging are: The routines I use most frequently for debugging are:
-- Function: print arg1 ... -- Function: print arg1 ...
`Print' writes all its arguments, separated by spaces. `Print' 'Print' writes all its arguments, separated by spaces. 'Print' |
outputs a `newline' at the end and returns the value of the last outputs a 'newline' at the end and returns the value of the last |
argument. argument.
One can just insert `(print '<label>' and `)' around an expression One can just insert '(print '<label>' and ')' around an expression |
in order to see its values as a program operates. in order to see its values as a program operates.
-- Function: pprint arg1 ... -- Function: pprint arg1 ...
`Pprint' pretty-prints (*note Pretty-Print: (slib)Pretty-Print.) 'Pprint' pretty-prints (*note (slib)Pretty-Print::) all its |
all its arguments, separated by newlines. `Pprint' returns the arguments, separated by newlines. 'Pprint' returns the value of |
value of the last argument. the last argument. |
One can just insert `(pprint '<label>' and `)' around an One can just insert '(pprint '<label>' and ')' around an expression |
expression in order to see its values as a program operates. in order to see its values as a program operates. _Note_ |
_Note_ `pretty-print' does _not_ format procedures. 'pretty-print' does _not_ format procedures. |
When typing at top level, `pprint' is not a good way to see nested When typing at top level, 'pprint' is not a good way to see nested |
structure because it will return the last object pretty-printed, which structure because it will return the last object pretty-printed, which
could be large. `pp' is a better choice. could be large. 'pp' is a better choice. |
-- Procedure: pp arg1 ... -- Procedure: pp arg1 ...
`Pprint' pretty-prints (*note Pretty-Print: (slib)Pretty-Print.) 'Pprint' pretty-prints (*note (slib)Pretty-Print::) all its |
all its arguments, separated by newlines. `pp' returns arguments, separated by newlines. 'pp' returns '#<unspecified>'. |
`#<unspecified>'.
-- Syntax: print-args name -- Syntax: print-args name
-- Syntax: print-args -- Syntax: print-args
Writes NAME if supplied; then writes the names and values of the Writes NAME if supplied; then writes the names and values of the
closest lexical bindings enclosing the call to `Print-args'. closest lexical bindings enclosing the call to 'Print-args'. |
(define (foo a b) (print-args foo) (+ a b)) (define (foo a b) (print-args foo) (+ a b))
(foo 3 6) (foo 3 6)
-| In foo: a = 3; b = 6; -| In foo: a = 3; b = 6;
=> 9 => 9
Sometimes more elaborate measures are needed to print values in a useful Sometimes more elaborate measures are needed to print values in a useful
manner. When the values to be printed may have very large (or infinite) manner. When the values to be printed may have very large (or infinite)
external representations, *note Quick Print: (slib)Quick Print, can be external representations, *note (slib)Quick Print::, can be used. |
used.
When `trace' is not sufficient to find program flow problems, SLIB-PSD, When 'trace' is not sufficient to find program flow problems, SLIB-PSD, |
the Portable Scheme Debugger offers source code debugging from GNU the Portable Scheme Debugger offers source code debugging from GNU
Emacs. PSD runs slowly, so start by instrumenting only a few functions Emacs. PSD runs slowly, so start by instrumenting only a few functions
at a time. at a time.
http://groups.csail.mit.edu/mac/ftpdir/scm/slib-psd1-3.tar.gz http://groups.csail.mit.edu/mac/ftpdir/scm/slib-psd1-3.tar.gz
ftp.maths.tcd.ie:pub/bosullvn/jacal/slib-psd1-3.tar.gz ftp.maths.tcd.ie:pub/bosullvn/jacal/slib-psd1-3.tar.gz
ftp.cs.indiana.edu:/pub/scheme-repository/utl/slib-psd1-3.tar.gz ftp.cs.indiana.edu:/pub/scheme-repository/utl/slib-psd1-3.tar.gz
 
File: scm-5f2.info, Node: Debugging Continuations, Next: Errors, Prev: Debugg ing Scheme Code, Up: Operational Features File: scm-5f3.info, Node: Debugging Continuations, Next: Errors, Prev: Debugg ing Scheme Code, Up: Operational Features
| |
3.9 Debugging Continuations 3.9 Debugging Continuations
=========================== ===========================
These functions are defined in `debug.c', all operate on captured These functions are defined in 'debug.c', all operate on captured |
continuations: continuations:
-- Procedure: frame-trace cont n -- Procedure: frame-trace cont n
Prints information about the code being executed and the Prints information about the code being executed and the
environment scopes active for continuation frame N of continuation environment scopes active for continuation frame N of continuation
CONT. A "continuation frame" is an entry in the environment CONT. A "continuation frame" is an entry in the environment stack; |
stack; a new frame is pushed when the environment is replaced or a new frame is pushed when the environment is replaced or extended |
extended in a non-tail call context. Frame 0 is the top of the in a non-tail call context. Frame 0 is the top of the stack. |
stack.
-- Procedure: frame->environment cont n -- Procedure: frame->environment cont n
Prints the environment for continuation frame N of continuation Prints the environment for continuation frame N of continuation
CONT. This contains just the names, not the values, of the CONT. This contains just the names, not the values, of the
environment. environment.
-- Procedure: scope-trace env -- Procedure: scope-trace env
will print information about active lexical scopes for environment will print information about active lexical scopes for environment
ENV. ENV.
-- Procedure: frame-eval cont n expr -- Procedure: frame-eval cont n expr
Evaluates EXPR in the environment defined by continuation frame N Evaluates EXPR in the environment defined by continuation frame N
of continuation CONT and returns the result. Values in the of continuation CONT and returns the result. Values in the
environment may be returned or SET!. environment may be returned or SET!.
*note stack-trace: Errors. also now accepts an optional continuation *note stack-trace: Errors. also now accepts an optional continuation
argument. `stack-trace' differs from `frame-trace' in that it argument. 'stack-trace' differs from 'frame-trace' in that it truncates |
truncates long output using safeports and prints code from all long output using safeports and prints code from all available frames. |
available frames.
(define k #f) (define k #f)
(define (foo x y) (define (foo x y)
(set! k (call-with-current-continuation identity)) (set! k (call-with-current-continuation identity))
#f) #f)
(let ((a 3) (b 4)) (let ((a 3) (b 4))
(foo a b) (foo a b)
#f) #f)
(stack-trace k) (stack-trace k)
-| -|
;STACK TRACE ;STACK TRACE
1; ((#@set! #@k (#@call-with-current-continuation #@identity)) #f ... 1; ((#@set! #@k (#@call-with-current-continuation #@identity)) #f ...
2; (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f) 2; (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f)
... ...
#t #t
(frame-trace k 0) (frame-trace k 0)
-| -|
(#@call-with-current-continuation #@identity) (#@call-with-current-continuation #@identity)
; in scope: ; in scope:
; (x y) procedure foo#<unspecified> ; (x y) procedure foo#<unspecified>
(frame-trace k 1) (frame-trace k 1)
-| -|
((#@set! #@k (#@call-with-current-continuation #@identity)) #f) ((#@set! #@k (#@call-with-current-continuation #@identity)) #f)
; in scope: ; in scope:
; (x y) procedure foo#<unspecified> ; (x y) procedure foo#<unspecified>
(frame-trace k 2) (frame-trace k 2)
-| -|
(#@let ((a 3) (b 4)) (#@foo #@a #@b) #f) (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f)
; in scope: ; in scope:
; (a b . #@let)#<unspecified> ; (a b . #@let)#<unspecified>
(frame-trace k 3) (frame-trace k 3)
-| -|
(#@let ((a 3) (b 4)) (#@foo #@a #@b) #f) (#@let ((a 3) (b 4)) (#@foo #@a #@b) #f)
; in top level environment. ; in top level environment.
(frame->environment k 0) (frame->environment k 0)
-| -|
((x y) 2 foo) ((x y) 2 foo)
(scope-trace (frame->environment k 0)) (scope-trace (frame->environment k 0))
-| -|
; in scope: ; in scope:
; (x y) procedure foo#<unspecified> ; (x y) procedure foo#<unspecified>
(frame-eval k 0 'x) => 3 (frame-eval k 0 'x) => 3
(frame-eval k 0 '(set! x 8)) (frame-eval k 0 '(set! x 8))
(frame-eval k 0 'x) => 8 (frame-eval k 0 'x) => 8
 
File: scm-5f2.info, Node: Errors, Next: Memoized Expressions, Prev: Debugging Continuations, Up: Operational Features File: scm-5f3.info, Node: Errors, Next: Memoized Expressions, Prev: Debugging Continuations, Up: Operational Features
| |
3.10 Errors 3.10 Errors
=========== ===========
A computer-language implementation designer faces choices of how A computer-language implementation designer faces choices of how
reflexive to make the implementation in handling exceptions and errors; reflexive to make the implementation in handling exceptions and errors;
that is, how much of the error and exception routines should be written that is, how much of the error and exception routines should be written
in the language itself. The design of a portable implementation is in the language itself. The design of a portable implementation is
further constrained by the need to have (almost) all errors print further constrained by the need to have (almost) all errors print
meaningful messages, even when the implementation itself is not meaningful messages, even when the implementation itself is not
functioning correctly. Therefore, SCM implements much of its error functioning correctly. Therefore, SCM implements much of its error
response code in C. response code in C.
The following common error and conditions are handled by C code. Those The following common error and conditions are handled by C code. Those
with callback names after them can also be handled by Scheme code with callback names after them can also be handled by Scheme code (*note |
(*note Interrupts::). If the callback identifier is not defined at top Interrupts::). If the callback identifier is not defined at top level, |
level, the default error handler (C code) is invoked. There are many the default error handler (C code) is invoked. There are many other |
other error messages which are not treated specially. error messages which are not treated specially. |
"ARGn" "ARGn"
Wrong type in argument Wrong type in argument
"ARG1" "ARG1"
Wrong type in argument 1 Wrong type in argument 1
"ARG2" "ARG2"
Wrong type in argument 2 Wrong type in argument 2
"ARG3" "ARG3"
Wrong type in argument 3 Wrong type in argument 3
"ARG4" "ARG4"
Wrong type in argument 4 Wrong type in argument 4
"ARG5" "ARG5"
Wrong type in argument 5 Wrong type in argument 5
"WNA" "WNA"
Wrong number of args Wrong number of args
"OVFLOW" "OVFLOW"
numerical overflow numerical overflow
"OUTOFRANGE" "OUTOFRANGE"
Argument out of range Argument out of range
"NALLOC" "NALLOC"
`(out-of-storage)' '(out-of-storage)' |
"THRASH" "THRASH"
GC is `(thrashing)' GC is '(thrashing)' |
"EXIT" "EXIT"
`(end-of-program)' '(end-of-program)' |
"HUP_SIGNAL" "HUP_SIGNAL"
`(hang-up)' '(hang-up)' |
"INT_SIGNAL" "INT_SIGNAL"
`(user-interrupt)' '(user-interrupt)' |
"FPE_SIGNAL" "FPE_SIGNAL"
`(arithmetic-error)' '(arithmetic-error)' |
"BUS_SIGNAL" "BUS_SIGNAL"
bus error bus error
"SEGV_SIGNAL" "SEGV_SIGNAL"
segment violation segment violation
"ALRM_SIGNAL" "ALRM_SIGNAL"
`(alarm-interrupt)' '(alarm-interrupt)' |
"VTALRM_SIGNAL" "VTALRM_SIGNAL"
`(virtual-alarm-interrupt)' '(virtual-alarm-interrupt)' |
"PROF_SIGNAL" "PROF_SIGNAL"
`(profile-alarm-interrupt)' '(profile-alarm-interrupt)' |
-- Variable: errobj -- Variable: errobj
When SCM encounters a non-fatal error, it aborts evaluation of the When SCM encounters a non-fatal error, it aborts evaluation of the
current form, prints a message explaining the error, and resumes current form, prints a message explaining the error, and resumes
the top level read-eval-print loop. The value of ERROBJ is the the top level read-eval-print loop. The value of ERROBJ is the
offending object if appropriate. The builtin procedure `error' offending object if appropriate. The builtin procedure 'error' |
does _not_ set ERROBJ. does _not_ set ERROBJ.
`errno' and `perror' report ANSI C errors encountered during a call to 'errno' and 'perror' report ANSI C errors encountered during a call to a |
a system or library function. system or library function. |
-- Function: errno -- Function: errno
-- Function: errno n -- Function: errno n
With no argument returns the current value of the system variable With no argument returns the current value of the system variable
`errno'. When given an argument, `errno' sets the system variable 'errno'. When given an argument, 'errno' sets the system variable |
`errno' to N and returns the previous value of `errno'. `(errno 'errno' to N and returns the previous value of 'errno'. '(errno |
0)' will clear outstanding errors. This is recommended after 0)' will clear outstanding errors. This is recommended after
`try-load' returns `#f' since this occurs when the file could not 'try-load' returns '#f' since this occurs when the file could not |
be opened. be opened.
-- Function: perror string -- Function: perror string
Prints on standard error output the argument STRING, a colon, Prints on standard error output the argument STRING, a colon,
followed by a space, the error message corresponding to the current followed by a space, the error message corresponding to the current
value of `errno' and a newline. The value returned is unspecified. value of 'errno' and a newline. The value returned is unspecified. |
`warn' and `error' provide a uniform way for Scheme code to signal 'warn' and 'error' provide a uniform way for Scheme code to signal |
warnings and errors. warnings and errors.
-- Function: warn arg1 arg2 arg3 ... -- Function: warn arg1 arg2 arg3 ...
Alias for *note slib:warn: (slib)System. Outputs an error message Alias for *note slib:warn: (slib)System. Outputs an error message
containing the arguments. `warn' is defined in `Init5f1.scm'. | containing the arguments. 'warn' is defined in 'Init5f2.scm'. |
-- Function: error arg1 arg2 arg3 ... -- Function: error arg1 arg2 arg3 ...
Alias for *note slib:error: (slib)System. Outputs an error Alias for *note slib:error: (slib)System. Outputs an error message |
message containing the arguments, aborts evaluation of the current containing the arguments, aborts evaluation of the current form and |
form and resumes the top level read-eval-print loop. `Error' is resumes the top level read-eval-print loop. 'Error' is defined in |
defined in `Init5f1.scm'. | 'Init5f2.scm'. |
If SCM is built with the `CAUTIOUS' flag, then when an error occurs, a If SCM is built with the 'CAUTIOUS' flag, then when an error occurs, a |
"stack trace" of certain pending calls are printed as part of the "stack trace" of certain pending calls are printed as part of the
default error response. A (memoized) expression and newline are default error response. A (memoized) expression and newline are printed |
printed for each partially evaluated combination whose procedure is not for each partially evaluated combination whose procedure is not builtin. |
builtin. See *note Memoized Expressions:: for how to read memoized See *note Memoized Expressions:: for how to read memoized expressions. |
expressions.
Also as the result of the 'CAUTIOUS' flag, both 'error' and |
Also as the result of the `CAUTIOUS' flag, both `error' and 'user-interrupt' (invoked by <C-c>) are defined to print stack traces |
`user-interrupt' (invoked by <C-c>) are defined to print stack traces and conclude by calling 'breakpoint' (*note (slib)Breakpoints::). This |
and conclude by calling `breakpoint' (*note Breakpoints: allows the user to interract with SCM as with Lisp systems. |
(slib)Breakpoints.). This allows the user to interract with SCM as
with Lisp systems.
-- Function: stack-trace -- Function: stack-trace
Prints information describing the stack of partially evaluated Prints information describing the stack of partially evaluated
expressions. `stack-trace' returns `#t' if any lines were printed expressions. 'stack-trace' returns '#t' if any lines were printed |
and `#f' otherwise. See `Init5f1.scm' for an example of the use | and '#f' otherwise. See 'Init5f2.scm' for an example of the use of |
of `stack-trace'. 'stack-trace'. |
 
File: scm-5f2.info, Node: Memoized Expressions, Next: Internal State, Prev: E rrors, Up: Operational Features File: scm-5f3.info, Node: Memoized Expressions, Next: Internal State, Prev: E rrors, Up: Operational Features
| |
3.11 Memoized Expressions 3.11 Memoized Expressions
========================= =========================
SCM memoizes the address of each occurence of an identifier's value when SCM memoizes the address of each occurence of an identifier's value when
first encountering it in a source expression. Subsequent executions of first encountering it in a source expression. Subsequent executions of
that memoized expression is faster because the memoized reference that memoized expression is faster because the memoized reference
encodes where in the top-level or local environment its value is. encodes where in the top-level or local environment its value is.
When procedures are displayed, the memoized locations appear in a format When procedures are displayed, the memoized locations appear in a format
different from references which have not yet been executed. I find this different from references which have not yet been executed. I find this
a convenient aid to locating bugs and untested expressions. a convenient aid to locating bugs and untested expressions.
* The names of memoized lexically bound identifiers are replaced with * The names of memoized lexically bound identifiers are replaced with
#@<m>-<n>, where <m> is the number of binding contours back and #@<m>-<n>, where <m> is the number of binding contours back and <n> |
<n> is the index of the value in that binding countour. is the index of the value in that binding countour. |
* The names of identifiers which are not lexiallly bound but defined * The names of identifiers which are not lexiallly bound but defined
at top-level have #@ prepended. at top-level have #@ prepended.
For instance, `open-input-file' is defined as follows in `Init5f1.scm': | For instance, 'open-input-file' is defined as follows in 'Init5f2.scm': |
(define (open-input-file str) (define (open-input-file str)
(or (open-file str open_read) (or (open-file str open_read)
(and (procedure? could-not-open) (could-not-open) #f) (and (procedure? could-not-open) (could-not-open) #f)
(error "OPEN-INPUT-FILE couldn't open file " str))) (error "OPEN-INPUT-FILE couldn't open file " str)))
If `open-input-file' has not yet been used, the displayed procedure is If 'open-input-file' has not yet been used, the displayed procedure is |
similar to the original definition (lines wrapped for readability): similar to the original definition (lines wrapped for readability):
open-input-file => open-input-file =>
#<CLOSURE (str) (or (open-file str open_read) #<CLOSURE (str) (or (open-file str open_read)
(and (procedure? could-not-open) (could-not-open) #f) (and (procedure? could-not-open) (could-not-open) #f)
(error "OPEN-INPUT-FILE couldn't open file " str))> (error "OPEN-INPUT-FILE couldn't open file " str))>
If we open a file using `open-input-file', the sections of code used If we open a file using 'open-input-file', the sections of code used |
become memoized: become memoized:
(open-input-file "r4rstest.scm") => #<input-port 3> (open-input-file "r4rstest.scm") => #<input-port 3>
open-input-file => open-input-file =>
#<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read)
(and (procedure? could-not-open) (could-not-open) #f) (and (procedure? could-not-open) (could-not-open) #f)
(error "OPEN-INPUT-FILE couldn't open file " str))> (error "OPEN-INPUT-FILE couldn't open file " str))>
If we cause `open-input-file' to execute other sections of code, they If we cause 'open-input-file' to execute other sections of code, they |
too become memoized: too become memoized:
(open-input-file "foo.scm") => (open-input-file "foo.scm") =>
ERROR: No such file or directory ERROR: No such file or directory
ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm" ERROR: OPEN-INPUT-FILE couldn't open file "foo.scm"
open-input-file => open-input-file =>
#<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read) #<CLOSURE (str) (#@or (#@open-file #@0+0 #@open_read)
(#@and (#@procedure? #@could-not-open) (could-not-open) #f) (#@and (#@procedure? #@could-not-open) (could-not-open) #f)
(#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))> (#@error "OPEN-INPUT-FILE couldn't open file " #@0+0))>
 
File: scm-5f2.info, Node: Internal State, Next: Scripting, Prev: Memoized Exp ressions, Up: Operational Features File: scm-5f3.info, Node: Internal State, Next: Scripting, Prev: Memoized Exp ressions, Up: Operational Features
| |
3.12 Internal State 3.12 Internal State
=================== ===================
-- Variable: *interactive* -- Variable: *interactive*
The variable *INTERACTIVE* determines whether the SCM session is The variable *INTERACTIVE* determines whether the SCM session is
interactive, or should quit after the command line is processed. interactive, or should quit after the command line is processed.
*INTERACTIVE* is controlled directly by the command-line options *INTERACTIVE* is controlled directly by the command-line options
`-b', `-i', and `-s' (*note Invoking SCM::). If none of these '-b', '-i', and '-s' (*note Invoking SCM::). If none of these |
options are specified, the rules to determine interactivity are options are specified, the rules to determine interactivity are
more complicated; see `Init5f1.scm' for details. | more complicated; see 'Init5f2.scm' for details. |
-- Function: abort -- Function: abort
Resumes the top level Read-Eval-Print loop. Resumes the top level Read-Eval-Print loop.
-- Function: restart -- Function: restart
Restarts the SCM program with the same arguments as it was Restarts the SCM program with the same arguments as it was
originally invoked. All `-l' loaded files are loaded again; If originally invoked. All '-l' loaded files are loaded again; If |
those files have changed, those changes will be reflected in the those files have changed, those changes will be reflected in the
new session. new session.
_Note_ When running a saved executable (*note Dump::), `restart' _Note_ When running a saved executable (*note Dump::), 'restart' is |
is redefined to be `exec-self'. redefined to be 'exec-self'. |
-- Function: exec-self -- Function: exec-self
Exits and immediately re-invokes the same executable with the same Exits and immediately re-invokes the same executable with the same
arguments. If the executable file has been changed or replaced arguments. If the executable file has been changed or replaced
since the beginning of the current session, the _new_ executable since the beginning of the current session, the _new_ executable
will be invoked. This differentiates `exec-self' from `restart'. will be invoked. This differentiates 'exec-self' from 'restart'. |
-- Function: verbose n -- Function: verbose n
Controls how much monitoring information is printed. If N is: Controls how much monitoring information is printed. If N is:
0 0
no prompt or information is printed. no prompt or information is printed.
>= 1
>= 1
a prompt is printed. a prompt is printed.
>= 2
>= 2
messages bracketing file loading are printed. messages bracketing file loading are printed.
>= 3
>= 3
the CPU time is printed after each top level form evaluated; the CPU time is printed after each top level form evaluated;
notifications of heap growth printed; the interpreter checks notifications of heap growth printed; the interpreter checks
stack depth periodically. stack depth periodically.
>= 4
>= 4
a garbage collection summary is printed after each top level a garbage collection summary is printed after each top level
form evaluated; form evaluated;
>= 5
>= 5
a message for each GC (*note Garbage Collection::) is printed; a message for each GC (*note Garbage Collection::) is printed;
warnings issued for top-level symbols redefined. warnings issued for top-level symbols redefined.
-- Function: gc -- Function: gc
Scans all of SCM objects and reclaims for further use those that Scans all of SCM objects and reclaims for further use those that
are no longer accessible. are no longer accessible.
-- Function: gc #t | -- Function: gc #t |
Garbage-collects only the ecache. | Garbage-collects only the ecache. |
| |
-- Function: room -- Function: room
-- Function: room #t -- Function: room #t
Prints out statistics about SCM's current use of storage. `(room Prints out statistics about SCM's current use of storage. '(room |
#t)' also gives the hexadecimal heap segment and stack bounds. #t)' also gives the hexadecimal heap segment and stack bounds.
-- Constant: *scm-version* -- Constant: *scm-version*
Contains the version string (e.g. `5f1') of SCM. | Contains the version string (e.g. '5f2') of SCM. |
3.12.1 Executable path 3.12.1 Executable path
---------------------- ----------------------
In order to dump a saved executable or to dynamically-link using DLD, In order to dump a saved executable or to dynamically-link using DLD,
SCM must know where its executable file is. Sometimes SCM (*note SCM must know where its executable file is. Sometimes SCM (*note
Executable Pathname::) guesses incorrectly the location of the Executable Pathname::) guesses incorrectly the location of the currently |
currently running executable. In that case, the correct path can be set running executable. In that case, the correct path can be set by |
by calling `execpath' with the pathname. calling 'execpath' with the pathname. |
-- Function: execpath -- Function: execpath
Returns the path (string) which SCM uses to find the executable Returns the path (string) which SCM uses to find the executable
file whose invocation the currently running session is, or #f if file whose invocation the currently running session is, or #f if
the path is not set. the path is not set.
-- Function: execpath #f -- Function: execpath #f
-- Function: execpath newpath -- Function: execpath newpath
Sets the path to `#f' or NEWPATH, respectively. The old path is Sets the path to '#f' or NEWPATH, respectively. The old path is |
returned. returned.
For other configuration constants and procedures *Note Configuration: For other configuration constants and procedures *Note |
(slib)Configuration. (slib)Configuration::. |
 
File: scm-5f2.info, Node: Scripting, Prev: Internal State, Up: Operational Fe atures File: scm-5f3.info, Node: Scripting, Prev: Internal State, Up: Operational Fe atures
| |
3.13 Scripting 3.13 Scripting
============== ==============
* Menu: * Menu:
* Unix Scheme Scripts:: From Olin Shivers' Scheme Shell * Unix Scheme Scripts:: From Olin Shivers' Scheme Shell
* MS-DOS Compatible Scripts:: Run in MS-DOS and Unix * MS-DOS Compatible Scripts:: Run in MS-DOS and Unix
* Unix Shell Scripts:: Use /bin/sh to run Scheme * Unix Shell Scripts:: Use /bin/sh to run Scheme
 
File: scm-5f2.info, Node: Unix Scheme Scripts, Next: MS-DOS Compatible Scripts , Prev: Scripting, Up: Scripting File: scm-5f3.info, Node: Unix Scheme Scripts, Next: MS-DOS Compatible Scripts , Prev: Scripting, Up: Scripting
| |
3.13.1 Unix Scheme Scripts 3.13.1 Unix Scheme Scripts
-------------------------- --------------------------
In reading this section, keep in mind that the first line of a script In reading this section, keep in mind that the first line of a script
file has (different) meanings to SCM and the operating system file has (different) meanings to SCM and the operating system
(`execve'). ('execve'). |
-- file: #! interpreter \ ... -- file: #! interpreter \ ...
On unix systems, a "Shell-Script" is a file (with execute On unix systems, a "Shell-Script" is a file (with execute
permissions) whose first two characters are `#!'. The INTERPRETER permissions) whose first two characters are '#!'. The INTERPRETER |
argument must be the pathname of the program to process the rest argument must be the pathname of the program to process the rest of |
of the file. The directories named by environment variable `PATH' the file. The directories named by environment variable 'PATH' are |
are _not_ searched to find INTERPRETER. _not_ searched to find INTERPRETER. |
When executing a shell-script, the operating system invokes When executing a shell-script, the operating system invokes
INTERPRETER with a single argument encapsulating the rest of the INTERPRETER with a single argument encapsulating the rest of the
first line's contents (if not just whitespace), the pathname of the first line's contents (if not just whitespace), the pathname of the
Scheme Script file, and then any arguments which the shell-script Scheme Script file, and then any arguments which the shell-script
was invoked with. was invoked with.
Put one space character between `#!' and the first character of Put one space character between '#!' and the first character of |
INTERPRETER (`/'). The INTERPRETER name is followed by ` \'; SCM INTERPRETER ('/'). The INTERPRETER name is followed by ' \'; SCM |
substitutes the second line of FILE for `\' (and the rest of the substitutes the second line of FILE for '\' (and the rest of the |
line), then appends any arguments given on the command line line), then appends any arguments given on the command line
invoking this Scheme-Script. invoking this Scheme-Script.
When SCM executes the script, the Scheme variable *SCRIPT* will be When SCM executes the script, the Scheme variable *SCRIPT* will be
set to the script pathname. The last argument before `!#' on the set to the script pathname. The last argument before '!#' on the |
second line should be `-'; SCM will load the script file, preserve second line should be '-'; SCM will load the script file, preserve |
the unprocessed arguments, and set *ARGV* to a list of the script the unprocessed arguments, and set *ARGV* to a list of the script
pathname and the unprocessed arguments. pathname and the unprocessed arguments.
Note that the interpreter, not the operating system, provides the Note that the interpreter, not the operating system, provides the
`\' substitution; this will only take place if INTERPRETER is a '\' substitution; this will only take place if INTERPRETER is a SCM |
SCM or SCSH interpreter. or SCSH interpreter. |
-- Read syntax: #! ignored !# -- Read syntax: #! ignored !#
When the first two characters of the file being loaded are `#!' and When the first two characters of the file being loaded are '#!' and |
a `\' is present before a newline in the file, all characters up a '\' is present before a newline in the file, all characters up to |
to `!#' will be ignored by SCM `read'. '!#' will be ignored by SCM 'read'. |
This combination of interpretatons allows SCM source files to be used as This combination of interpretatons allows SCM source files to be used as
POSIX shell-scripts if the first line is: POSIX shell-scripts if the first line is:
#! /usr/local/bin/scm \ #! /usr/local/bin/scm \
The following Scheme-Script prints factorial of its argument: The following Scheme-Script prints factorial of its argument:
#! /usr/local/bin/scm \ %0 %* #! /usr/local/bin/scm \ %0 %*
- !# - !#
skipping to change at line 2751 skipping to change at line 2660
#f) #f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n))))) (define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*)))) (if *script* (exit (fact.script (list-tail *argv* *optind*))))
./fact 32 ./fact 32
=> =>
263130836933693530167218012160000000 263130836933693530167218012160000000
If the wrong number of arguments is given, `fact' prints its ARGV with If the wrong number of arguments is given, 'fact' prints its ARGV with |
usage information. usage information.
./fact 3 2 ./fact 3 2
-| -|
("./fact" "3" "2") ("./fact" "3" "2")
Usage: fact N Usage: fact N
Returns the factorial of N. Returns the factorial of N.
 
File: scm-5f2.info, Node: MS-DOS Compatible Scripts, Next: Unix Shell Scripts, Prev: Unix Scheme Scripts, Up: Scripting File: scm-5f3.info, Node: MS-DOS Compatible Scripts, Next: Unix Shell Scripts, Prev: Unix Scheme Scripts, Up: Scripting
| |
3.13.2 MS-DOS Compatible Scripts 3.13.2 MS-DOS Compatible Scripts
-------------------------------- --------------------------------
It turns out that we can create scheme-scripts which run both under unix It turns out that we can create scheme-scripts which run both under unix
and MS-DOS. To implement this, I have written the MS-DOS programs: and MS-DOS. To implement this, I have written the MS-DOS programs:
`#!.bat' and `!#.exe', which are available from: '#!.bat' and '!#.exe', which are available from: |
`http://groups.csail.mit.edu/mac/ftpdir/scm/sharpbang.zip' <http://groups.csail.mit.edu/mac/ftpdir/scm/sharpbang.zip> |
With these two programs installed in a `PATH' directory, we have the With these two programs installed in a 'PATH' directory, we have the |
following syntax for <PROGRAM>.BAT files. following syntax for <PROGRAM>.BAT files.
-- file: #! interpreter \ %0 %* -- file: #! interpreter \ %0 %*
The first two characters of the Scheme-Script are `#!'. The |
INTERPRETER can be either a unix style program path (using `/' The first two characters of the Scheme-Script are '#!'. The |
INTERPRETER can be either a unix style program path (using '/' |
between filename components) or a DOS program name or path. The between filename components) or a DOS program name or path. The
rest of the first line of the Scheme-Script should be literally rest of the first line of the Scheme-Script should be literally
`\ %0 %*', as shown. '\ %0 %*', as shown. |
If INTERPRETER has `/' in it, INTERPRETER is converted to a DOS If INTERPRETER has '/' in it, INTERPRETER is converted to a DOS |
style filename (`/' => `\'). style filename ('/' => '\'). |
In looking for an executable named INTERPRETER, `#!' first checks In looking for an executable named INTERPRETER, '#!' first checks |
this (converted) filename; if INTERPRETER doesn't exist, it then this (converted) filename; if INTERPRETER doesn't exist, it then
tries to find a program named like the string starting after the tries to find a program named like the string starting after the
last `\' (or `/') in INTERPRETER. When searching for executables, last '\' (or '/') in INTERPRETER. When searching for executables, |
`#!' tries all directories named by environment variable `PATH'. '#!' tries all directories named by environment variable 'PATH'. |
Once the INTERPRETER executable path is found, arguments are Once the INTERPRETER executable path is found, arguments are
processed in the manner of scheme-shell, with all the text after processed in the manner of scheme-shell, with all the text after
the `\' taken as part of the meta-argument. More precisely, `#!' the '\' taken as part of the meta-argument. More precisely, '#!' |
calls INTERPRETER with any options on the second line of the calls INTERPRETER with any options on the second line of the
Scheme-Script up to `!#', the name of the Scheme-Script file, and Scheme-Script up to '!#', the name of the Scheme-Script file, and |
then any of at most 8 arguments given on the command line invoking then any of at most 8 arguments given on the command line invoking
this Scheme-Script. this Scheme-Script.
The previous example Scheme-Script works in both MS-DOS and unix The previous example Scheme-Script works in both MS-DOS and unix
systems. systems.
 
File: scm-5f2.info, Node: Unix Shell Scripts, Prev: MS-DOS Compatible Scripts, Up: Scripting File: scm-5f3.info, Node: Unix Shell Scripts, Prev: MS-DOS Compatible Scripts, Up: Scripting
| |
3.13.3 Unix Shell Scripts 3.13.3 Unix Shell Scripts
------------------------- -------------------------
Scheme-scripts suffer from two drawbacks: Scheme-scripts suffer from two drawbacks:
* Some Unixes limit the length of the `#!' interpreter line to the * Some Unixes limit the length of the '#!' interpreter line to the |
size of an object file header, which can be as small as 32 bytes. size of an object file header, which can be as small as 32 bytes.
* A full, explicit pathname must be specified, perhaps requiring more |
* A full, explicit pathname must be specified, perhaps requiring than 32 bytes and making scripts vulnerable to breakage when |
more than 32 bytes and making scripts vulnerable to breakage when
programs are moved. programs are moved.
The following approach solves these problems at the expense of slower The following approach solves these problems at the expense of slower
startup. Make `#! /bin/sh' the first line and prepend every subsequent startup. Make '#! /bin/sh' the first line and prepend every subsequent |
line to be executed by the shell with `:;'. The last line to be line to be executed by the shell with ':;'. The last line to be |
executed by the shell should contain an "exec" command; `exec' executed by the shell should contain an "exec" command; 'exec' |
tail-calls its argument. tail-calls its argument.
`/bin/sh' is thus invoked with the name of the script file, which it '/bin/sh' is thus invoked with the name of the script file, which it |
executes as a *sh script. Usually the second line starts `:;exec scm executes as a *sh script. Usually the second line starts ':;exec scm |
-f$0', which executes scm, which in turn loads the script file. When -f$0', which executes scm, which in turn loads the script file. When
SCM loads the script file, it ignores the first and second lines, and SCM loads the script file, it ignores the first and second lines, and
evaluates the rest of the file as Scheme source code. evaluates the rest of the file as Scheme source code.
The second line of the script file does not have the length restriction The second line of the script file does not have the length restriction
mentioned above. Also, `/bin/sh' searches the directories listed in mentioned above. Also, '/bin/sh' searches the directories listed in the |
the `PATH' environment variable for `scm', eliminating the need to use 'PATH' environment variable for 'scm', eliminating the need to use |
absolute locations in order to invoke a program. absolute locations in order to invoke a program.
The following example additionally sets *SCRIPT* to the script The following example additionally sets *SCRIPT* to the script argument, |
argument, making it compatible with the scheme code of the previous making it compatible with the scheme code of the previous example. |
example.
#! /bin/sh #! /bin/sh
:;exec scm -e"(set! *script* \"$0\")" -l$0 "$@" :;exec scm -e"(set! *script* \"$0\")" -l$0 "$@"
(define (fact.script args) (define (fact.script args)
(cond ((and (= 1 (length args)) (cond ((and (= 1 (length args))
(string->number (car args))) (string->number (car args)))
=> (lambda (n) (print (fact n)) #t)) => (lambda (n) (print (fact n)) #t))
(else (fact.usage)))) (else (fact.usage))))
skipping to change at line 2862 skipping to change at line 2770
#f) #f)
(define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n))))) (define (fact n) (if (< n 2) 1 (* n (fact (+ -1 n)))))
(if *script* (exit (fact.script (list-tail *argv* *optind*)))) (if *script* (exit (fact.script (list-tail *argv* *optind*))))
./fact 6 ./fact 6
=> 720 => 720
 
File: scm-5f2.info, Node: The Language, Next: Packages, Prev: Operational Fea tures, Up: Top File: scm-5f3.info, Node: The Language, Next: Packages, Prev: Operational Fea tures, Up: Top
| |
4 The Language 4 The Language
************** **************
* Menu: * Menu:
* Standards Compliance:: Links to sections in [R5RS] and [SLIB] * Standards Compliance:: Links to sections in [R5RS] and [SLIB]
* Storage:: Finalizers, GC-hook, vector-set-length! * Storage:: Finalizers, GC-hook, vector-set-length!
* Time:: Both real time and processor time * Time:: Both real time and processor time
* Interrupts:: and exceptions * Interrupts:: and exceptions
* Process Synchronization:: Because interrupts are preemptive * Process Synchronization:: Because interrupts are preemptive
* Files and Ports:: * Files and Ports::
* Eval and Load:: and line-numbers * Eval and Load:: and line-numbers
* Lexical Conventions:: Also called read-syntax * Lexical Conventions:: Also called read-syntax
* Syntax:: Macros * Syntax:: Macros
 
File: scm-5f2.info, Node: Standards Compliance, Next: Storage, Prev: The Lang uage, Up: The Language File: scm-5f3.info, Node: Standards Compliance, Next: Storage, Prev: The Lang uage, Up: The Language
| |
4.1 Standards Compliance 4.1 Standards Compliance
======================== ========================
Scm conforms to the `IEEE Standard 1178-1990. IEEE Standard for the Scm conforms to the 'IEEE Standard 1178-1990. IEEE Standard for the |
Scheme Programming Language.' (*note Bibliography::), and `Revised(5) Scheme Programming Language.' (*note Bibliography::), and 'Revised(5) |
Report on the Algorithmic Language Scheme'. *note Top: (r5rs)Top. All Report on the Algorithmic Language Scheme'. *note (r5rs)Top::. All the |
the required features of these specifications are supported. Many of required features of these specifications are supported. Many of the |
the optional features are supported as well. optional features are supported as well. |
Optionals of [R5RS] Supported by SCM Optionals of [R5RS] Supported by SCM
------------------------------------ ------------------------------------
`-' and `/' of more than 2 arguments '-' and '/' of more than 2 arguments |
`exp' 'exp' |
`log' 'log' |
`sin' 'sin' |
`cos' 'cos' |
`tan' 'tan' |
`asin' 'asin' |
`acos' 'acos' |
`atan' 'atan' |
`sqrt' 'sqrt' |
`expt' 'expt' |
`make-rectangular' 'make-rectangular' |
`make-polar' 'make-polar' |
`real-part' 'real-part' |
`imag-part' 'imag-part' |
`magnitude' 'magnitude' |
`angle' 'angle' |
`exact->inexact' 'exact->inexact' |
`inexact->exact' 'inexact->exact' |
*Note Numerical operations: (r5rs)Numerical operations. *Note (r5rs)Numerical operations::. |
'with-input-from-file' |
`with-input-from-file' 'with-output-to-file' |
`with-output-to-file' *Note (r5rs)Ports::. |
*Note Ports: (r5rs)Ports. 'load' |
'transcript-on' |
`load' 'transcript-off' |
`transcript-on' *Note (r5rs)System interface::. |
`transcript-off'
*Note System interface: (r5rs)System interface.
Optionals of [R5RS] not Supported by SCM Optionals of [R5RS] not Supported by SCM
---------------------------------------- ----------------------------------------
`numerator' 'numerator' |
`denominator' 'denominator' |
`rationalize' 'rationalize' |
*Note Numerical operations: (r5rs)Numerical operations. *Note (r5rs)Numerical operations::. |
[SLIB] Features of SCM and SCMLIT [SLIB] Features of SCM and SCMLIT
--------------------------------- ---------------------------------
`delay' 'delay' |
`full-continuation' 'full-continuation' |
`ieee-p1178' 'ieee-p1178' |
`object-hash' 'object-hash' |
`rev4-report' 'rev4-report' |
`source' 'source' |
See SLIB file `Template.scm'. See SLIB file 'Template.scm'. |
'current-time' |
`current-time' *Note (slib)Time and Date::. |
*Note Time and Date: (slib)Time and Date. 'defmacro' |
*Note (slib)Defmacro::. |
`defmacro' 'getenv' |
*Note Defmacro: (slib)Defmacro. 'system' |
*Note (slib)System Interface::. |
`getenv' 'hash' |
`system' *Note (slib)Hashing::. |
*Note System Interface: (slib)System Interface. 'logical' |
*Note (slib)Bit-Twiddling::. |
`hash' 'multiarg-apply' |
*Note Hashing: (slib)Hashing. *Note (slib)Multi-argument Apply::. |
'multiarg/and-' |
`logical' *Note (slib)Multi-argument / and -::. |
*Note Bit-Twiddling: (slib)Bit-Twiddling. 'rev4-optional-procedures' |
*Note (slib)Rev4 Optional Procedures::. |
`multiarg-apply' 'string-port' |
*Note Multi-argument Apply: (slib)Multi-argument Apply. *Note (slib)String Ports::. |
'tmpnam' |
`multiarg/and-' *Note (slib)Input/Output::. |
*Note Multi-argument / and -: (slib)Multi-argument / and -. 'transcript' |
*Note (slib)Transcripts::. |
`rev4-optional-procedures' 'vicinity' |
*Note Rev4 Optional Procedures: (slib)Rev4 Optional Procedures. *Note (slib)Vicinity::. |
'with-file' |
`string-port' *Note (slib)With-File::. |
*Note String Ports: (slib)String Ports.
`tmpnam'
*Note Input/Output: (slib)Input/Output.
`transcript'
*Note Transcripts: (slib)Transcripts.
`vicinity'
*Note Vicinity: (slib)Vicinity.
`with-file'
*Note With-File: (slib)With-File.
[SLIB] Features of SCM [SLIB] Features of SCM
---------------------- ----------------------
`array' 'array' |
*Note Arrays: (slib)Arrays. *Note (slib)Arrays::. |
'array-for-each' |
`array-for-each' *Note (slib)Array Mapping::. |
*Note Array Mapping: (slib)Array Mapping. 'bignum' |
'complex' |
`bignum' 'inexact' |
`complex' 'rational' |
`inexact' 'real' |
`rational' *Note (slib)Require::. |
`real'
*Note Require: (slib)Require.
 
File: scm-5f2.info, Node: Storage, Next: Time, Prev: Standards Compliance, U p: The Language File: scm-5f3.info, Node: Storage, Next: Time, Prev: Standards Compliance, U p: The Language
| |
4.2 Storage 4.2 Storage
=========== ===========
-- Function: vector-set-length! object length -- Function: vector-set-length! object length
Change the length of string, vector, bit-vector, or uniform-array Change the length of string, vector, bit-vector, or uniform-array
OBJECT to LENGTH. If this shortens OBJECT then the remaining OBJECT to LENGTH. If this shortens OBJECT then the remaining
contents are lost. If it enlarges OBJECT then the contents of the contents are lost. If it enlarges OBJECT then the contents of the
extended part are undefined but the original part is unchanged. extended part are undefined but the original part is unchanged. It |
It is an error to change the length of literal datums. The new is an error to change the length of literal datums. The new object |
object is returned. is returned. |
-- Function: copy-tree obj -- Function: copy-tree obj
-- Function: @copy-tree obj -- Function: @copy-tree obj
*Note copy-tree: (slib)Tree Operations. This extends the SLIB *Note copy-tree: (slib)Tree Operations. This extends the SLIB
version by also copying vectors. Use `@copy-tree' if you depend version by also copying vectors. Use '@copy-tree' if you depend on |
on this feature; `copy-tree' could get redefined. this feature; 'copy-tree' could get redefined. |
-- Function: acons obj1 obj2 obj3 -- Function: acons obj1 obj2 obj3
Returns (cons (cons obj1 obj2) obj3). Returns (cons (cons obj1 obj2) obj3).
(set! a-list (acons key datum a-list)) (set! a-list (acons key datum a-list))
Adds a new association to a-list. Adds a new association to a-list.
-- Callback procedure: gc-hook ... -- Callback procedure: gc-hook ...
Allows a Scheme procedure to be run shortly after each garbage Allows a Scheme procedure to be run shortly after each garbage
collection. This procedure will not be run recursively. If it collection. This procedure will not be run recursively. If it
runs long enough to cause a garbage collection before returning a runs long enough to cause a garbage collection before returning a
warning will be printed. warning will be printed.
To remove the gc-hook, `(set! gc-hook #f)'. To remove the gc-hook, '(set! gc-hook #f)'. |
-- Function: add-finalizer object finalizer -- Function: add-finalizer object finalizer
OBJECT may be any garbage collected object, that is, any object OBJECT may be any garbage collected object, that is, any object
other than an immediate integer, character, or special token such other than an immediate integer, character, or special token such
as `#f' or `#t', *Note Immediates::. FINALIZER is a thunk, or as '#f' or '#t', *Note Immediates::. FINALIZER is a thunk, or |
procedure taking no arguments. procedure taking no arguments.
FINALIZER will be invoked asynchronously exactly once some time FINALIZER will be invoked asynchronously exactly once some time
after OBJECT becomes eligible for garbage collection. A reference after OBJECT becomes eligible for garbage collection. A reference
to OBJECT in the environment of FINALIZER will not prevent to OBJECT in the environment of FINALIZER will not prevent
finalization, but will delay the reclamation of OBJECT at least finalization, but will delay the reclamation of OBJECT at least
until the next garbage collection. A reference to OBJECT in some until the next garbage collection. A reference to OBJECT in some
other object's finalizer will necessarily prevent finalization other object's finalizer will necessarily prevent finalization
until both objects are eligible for garbage collection. until both objects are eligible for garbage collection.
Finalizers are not run in any predictable order. All finalizers Finalizers are not run in any predictable order. All finalizers
will be run by the time the program ends. will be run by the time the program ends.
This facility was based on the paper by Simon Peyton Jones, et al, This facility was based on the paper by Simon Peyton Jones, et al,
"Stretching the storage manager: weak pointers and stable names in "Stretching the storage manager: weak pointers and stable names in
Haskell", Proc. 11th International Workshop on the Implementation Haskell", Proc. 11th International Workshop on the Implementation
of Functional Languages, The Netherlands, September 7-10 1999, of Functional Languages, The Netherlands, September 7-10 1999,
Springer-Verlag LNCS. Springer-Verlag LNCS.
 
File: scm-5f2.info, Node: Time, Next: Interrupts, Prev: Storage, Up: The Lan guage File: scm-5f3.info, Node: Time, Next: Interrupts, Prev: Storage, Up: The Lan guage
| |
4.3 Time 4.3 Time
======== ========
-- Constant: internal-time-units-per-second -- Constant: internal-time-units-per-second
Is the integer number of internal time units in a second. Is the integer number of internal time units in a second.
-- Function: get-internal-run-time -- Function: get-internal-run-time
Returns the integer run time in internal time units from an Returns the integer run time in internal time units from an
unspecified starting time. The difference of two calls to unspecified starting time. The difference of two calls to
`get-internal-run-time' divided by 'get-internal-run-time' divided by 'internal-time-units-per-second' |
`internal-time-units-per-second' will give elapsed run time in will give elapsed run time in seconds. |
seconds.
-- Function: get-internal-real-time -- Function: get-internal-real-time
Returns the integer time in internal time units from an unspecified Returns the integer time in internal time units from an unspecified
starting time. The difference of two calls to starting time. The difference of two calls to
`get-internal-real-time' divided by 'get-internal-real-time' divided by |
`internal-time-units-per-second' will give elapsed real time in | 'internal-time-units-per-second' will give elapsed real time in |
seconds. seconds.
-- Function: current-time -- Function: current-time
Returns the time since 00:00:00 GMT, January 1, 1970, measured in Returns the time since 00:00:00 GMT, January 1, 1970, measured in
seconds. *Note current-time: (slib)Time and Date. `current-time' seconds. *Note current-time: (slib)Time and Date. 'current-time' |
is used in *note Time and Date: (slib)Time and Date. is used in *note (slib)Time and Date::. |
 
File: scm-5f2.info, Node: Interrupts, Next: Process Synchronization, Prev: Ti me, Up: The Language File: scm-5f3.info, Node: Interrupts, Next: Process Synchronization, Prev: Ti me, Up: The Language
| |
4.4 Interrupts 4.4 Interrupts
============== ==============
-- Function: ticks n -- Function: ticks n
Returns the number of ticks remaining till the next tick interrupt. Returns the number of ticks remaining till the next tick interrupt.
Ticks are an arbitrary unit of evaluation. Ticks can vary greatly Ticks are an arbitrary unit of evaluation. Ticks can vary greatly
in the amount of time they represent. in the amount of time they represent.
If N is 0, any ticks request is canceled. Otherwise a If N is 0, any ticks request is canceled. Otherwise a
`ticks-interrupt' will be signaled N from the current time. 'ticks-interrupt' will be signaled N from the current time. |
`ticks' is supported if SCM is compiled with the `ticks' flag 'ticks' is supported if SCM is compiled with the 'ticks' flag |
defined. defined.
-- Callback procedure: ticks-interrupt ... -- Callback procedure: ticks-interrupt ...
Establishes a response for tick interrupts. Another tick Establishes a response for tick interrupts. Another tick interrupt |
interrupt will not occur unless `ticks' is called again. Program will not occur unless 'ticks' is called again. Program execution |
execution will resume if the handler returns. This procedure will resume if the handler returns. This procedure should (abort) |
should (abort) or some other action which does not return if it or some other action which does not return if it does not want |
does not want processing to continue. processing to continue. |
-- Function: alarm secs -- Function: alarm secs
Returns the number of seconds remaining till the next alarm Returns the number of seconds remaining till the next alarm
interrupt. If SECS is 0, any alarm request is canceled. interrupt. If SECS is 0, any alarm request is canceled. Otherwise |
Otherwise an `alarm-interrupt' will be signaled SECS from the an 'alarm-interrupt' will be signaled SECS from the current time. |
current time. ALARM is not supported on all systems. ALARM is not supported on all systems. |
-- Function: milli-alarm millisecs interval -- Function: milli-alarm millisecs interval
-- Function: virtual-alarm millisecs interval -- Function: virtual-alarm millisecs interval
-- Function: profile-alarm millisecs interval -- Function: profile-alarm millisecs interval
`milli-alarm' is similar to `alarm', except that the first 'milli-alarm' is similar to 'alarm', except that the first argument |
argument MILLISECS, and the return value are measured in MILLISECS, and the return value are measured in milliseconds rather |
milliseconds rather than seconds. If the optional argument than seconds. If the optional argument INTERVAL is supplied then |
INTERVAL is supplied then alarm interrupts will be scheduled every alarm interrupts will be scheduled every INTERVAL milliseconds |
INTERVAL milliseconds until turned off by a call to `milli-alarm' until turned off by a call to 'milli-alarm' or 'alarm'. |
or `alarm'.
'virtual-alarm' and 'profile-alarm' are similar. 'virtual-alarm' |
`virtual-alarm' and `profile-alarm' are similar. `virtual-alarm' decrements process execution time rather than real time, and causes |
decrements process execution time rather than real time, and 'SIGVTALRM' to be signaled. 'profile-alarm' decrements both |
causes `SIGVTALRM' to be signaled. `profile-alarm' decrements process execution time and system execution time on behalf of the |
both process execution time and system execution time on behalf process, and causes 'SIGPROF' to be signaled. |
of the process, and causes `SIGPROF' to be signaled.
`milli-alarm', `virtual-alarm', and `profile-alarm' are supported 'milli-alarm', 'virtual-alarm', and 'profile-alarm' are supported |
only on systems providing the `setitimer' system call. only on systems providing the 'setitimer' system call. |
-- Callback procedure: user-interrupt ... -- Callback procedure: user-interrupt ...
-- Callback procedure: alarm-interrupt ... -- Callback procedure: alarm-interrupt ...
-- Callback procedure: virtual-alarm-interrupt ... -- Callback procedure: virtual-alarm-interrupt ...
-- Callback procedure: profile-alarm-interrupt ... -- Callback procedure: profile-alarm-interrupt ...
Establishes a response for `SIGINT' (control-C interrupt) and Establishes a response for 'SIGINT' (control-C interrupt) and |
`SIGALRM', `SIGVTALRM', and `SIGPROF' interrupts. Program 'SIGALRM', 'SIGVTALRM', and 'SIGPROF' interrupts. Program |
execution will resume if the handler returns. This procedure execution will resume if the handler returns. This procedure
should `(abort)' or some other action which does not return if it should '(abort)' or some other action which does not return if it |
does not want processing to continue after it returns. does not want processing to continue after it returns.
Interrupt handlers are disabled during execution `system' and `ed' Interrupt handlers are disabled during execution 'system' and 'ed' |
procedures. procedures.
To unestablish a response for an interrupt set the handler symbol To unestablish a response for an interrupt set the handler symbol
to `#f'. For instance, `(set! user-interrupt #f)'. to '#f'. For instance, '(set! user-interrupt #f)'. |
-- Callback procedure: out-of-storage ... -- Callback procedure: out-of-storage ...
-- Callback procedure: could-not-open ... -- Callback procedure: could-not-open ...
-- Callback procedure: end-of-program ... -- Callback procedure: end-of-program ...
-- Callback procedure: hang-up ... -- Callback procedure: hang-up ...
-- Callback procedure: arithmetic-error ... -- Callback procedure: arithmetic-error ...
Establishes a response for storage allocation error, file opening Establishes a response for storage allocation error, file opening
error, end of program, SIGHUP (hang up interrupt) and arithmetic error, end of program, SIGHUP (hang up interrupt) and arithmetic
errors respectively. This procedure should (abort) or some other errors respectively. This procedure should (abort) or some other
action which does not return if it does not want the default error action which does not return if it does not want the default error
message to also be displayed. If no procedure is defined for message to also be displayed. If no procedure is defined for
HANG-UP then END-OF-PROGRAM (if defined) will be called. HANG-UP then END-OF-PROGRAM (if defined) will be called.
To unestablish a response for an error set the handler symbol to To unestablish a response for an error set the handler symbol to
`#f'. For instance, `(set! could-not-open #f)'. '#f'. For instance, '(set! could-not-open #f)'. |
 
File: scm-5f2.info, Node: Process Synchronization, Next: Files and Ports, Pre v: Interrupts, Up: The Language File: scm-5f3.info, Node: Process Synchronization, Next: Files and Ports, Pre v: Interrupts, Up: The Language
| |
4.5 Process Synchronization 4.5 Process Synchronization
=========================== ===========================
An "exchanger" is a procedure of one argument regulating mutually exclusive An "exchanger" is a procedure of one argument regulating mutually |
access to a resource. When a exchanger is called, its current content exclusive access to a resource. When a exchanger is called, its current |
is returned, while being replaced by its argument in an atomic content is returned, while being replaced by its argument in an atomic |
operation. operation.
-- Function: make-exchanger obj -- Function: make-exchanger obj
Returns a new exchanger with the argument OBJ as its initial Returns a new exchanger with the argument OBJ as its initial
content. content.
(define queue (make-exchanger (list a))) (define queue (make-exchanger (list a)))
A queue implemented as an exchanger holding a list can be A queue implemented as an exchanger holding a list can be protected |
protected from reentrant execution thus: from reentrant execution thus: |
(define (pop queue) (define (pop queue)
(let ((lst #f)) (let ((lst #f))
(dynamic-wind (dynamic-wind
(lambda () (set! lst (queue #f))) (lambda () (set! lst (queue #f)))
(lambda () (and lst (not (null? lst)) (lambda () (and lst (not (null? lst))
(let ((ret (car lst))) (let ((ret (car lst)))
(set! lst (cdr lst)) (set! lst (cdr lst))
ret))) ret)))
(lambda () (and lst (queue lst)))))) (lambda () (and lst (queue lst))))))
(pop queue) => a (pop queue) => a
(pop queue) => #f (pop queue) => #f
-- Function: make-arbiter name -- Function: make-arbiter name
Returns an object of type arbiter and name NAME. Its state is Returns an object of type arbiter and name NAME. Its state is
initially unlocked. initially unlocked.
-- Function: try-arbiter arbiter -- Function: try-arbiter arbiter
Returns `#t' and locks ARBITER if ARBITER was unlocked. |
Otherwise, returns `#f'. Returns '#t' and locks ARBITER if ARBITER was unlocked. Otherwise, |
returns '#f'. |
-- Function: release-arbiter arbiter -- Function: release-arbiter arbiter
Returns `#t' and unlocks ARBITER if ARBITER was locked. |
Otherwise, returns `#f'. Returns '#t' and unlocks ARBITER if ARBITER was locked. Otherwise, |
returns '#f'. |
 
File: scm-5f2.info, Node: Files and Ports, Next: Eval and Load, Prev: Process Synchronization, Up: The Language File: scm-5f3.info, Node: Files and Ports, Next: Eval and Load, Prev: Process Synchronization, Up: The Language
| |
4.6 Files and Ports 4.6 Files and Ports
=================== ===================
These procedures generalize and extend the standard capabilities in These procedures generalize and extend the standard capabilities in
*note Ports: (r5rs)Ports. *note (r5rs)Ports::.
* Menu: * Menu:
* Opening and Closing:: * Opening and Closing::
* Port Properties:: * Port Properties::
* Port Redirection:: * Port Redirection::
* Soft Ports:: * Soft Ports::
 
File: scm-5f2.info, Node: Opening and Closing, Next: Port Properties, Prev: F iles and Ports, Up: Files and Ports File: scm-5f3.info, Node: Opening and Closing, Next: Port Properties, Prev: F iles and Ports, Up: Files and Ports
| |
4.6.1 Opening and Closing 4.6.1 Opening and Closing
------------------------- -------------------------
-- Function: open-file string modes -- Function: open-file string modes
-- Function: try-open-file string modes -- Function: try-open-file string modes
Returns a port capable of receiving or delivering characters as Returns a port capable of receiving or delivering characters as
specified by the MODES string. If a file cannot be opened `#f' is specified by the MODES string. If a file cannot be opened '#f' is |
returned. returned.
Internal functions opening files "callback" to the SCM function Internal functions opening files "callback" to the SCM function
`open-file'. You can extend `open-file' by redefining it. 'open-file'. You can extend 'open-file' by redefining it. |
`try-open-file' is the primitive procedure; Do not redefine 'try-open-file' is the primitive procedure; Do not redefine |
`try-open-file'! 'try-open-file'! |
-- Constant: open_read -- Constant: open_read
-- Constant: open_write -- Constant: open_write
-- Constant: open_both -- Constant: open_both
Contain modes strings specifying that a file is to be opened for Contain modes strings specifying that a file is to be opened for
reading, writing, and both reading and writing respectively. reading, writing, and both reading and writing respectively.
Both input and output functions can be used with io-ports. An end Both input and output functions can be used with io-ports. An end
of file must be read or a two-argument file-position done on the of file must be read or a two-argument file-position done on the
port between a read operation and a write operation or vice-versa. port between a read operation and a write operation or vice-versa.
-- Function: _ionbf modestr -- Function: _ionbf modestr
Returns a version of MODESTR which when `open-file' is called with Returns a version of MODESTR which when 'open-file' is called with |
it as the second argument will return an unbuffered port. An it as the second argument will return an unbuffered port. An
input-port must be unbuffered in order for `char-ready?' and input-port must be unbuffered in order for 'char-ready?' and |
`wait-for-input' to work correctly on it. The initial value of 'wait-for-input' to work correctly on it. The initial value of |
`(current-input-port)' is unbuffered if the platform supports it. '(current-input-port)' is unbuffered if the platform supports it. |
-- Function: _tracked modestr -- Function: _tracked modestr
Returns a version of MODESTR which when `open-file' is called with Returns a version of MODESTR which when 'open-file' is called with |
it as the second argument will return a tracked port. A tracked it as the second argument will return a tracked port. A tracked
port maintains current line and column numbers, which may be port maintains current line and column numbers, which may be
queried with `port-line' and `port-column'. queried with 'port-line' and 'port-column'. |
-- Function: _exclusive modestr -- Function: _exclusive modestr
Returns a version of MODESTR which when `open-file' is called with Returns a version of MODESTR which when 'open-file' is called with |
it as the second argument will return a port only if the named file it as the second argument will return a port only if the named file
does not already exist. This functionality is provided by calling does not already exist. This functionality is provided by calling
`try-create-file' *Note I/O-Extensions::, which is not available 'try-create-file' *Note I/O-Extensions::, which is not available |
for all platforms. for all platforms.
-- Function: open-ports -- Function: open-ports
Returns a list of all currently open ports, excluding string ports, Returns a list of all currently open ports, excluding string ports,
see *Note String Ports: (slib)String Ports. This may be useful see *Note (slib)String Ports::. This may be useful after a fork |
after a fork *Note Posix Extensions::, or for debugging. Bear in *Note Posix Extensions::, or for debugging. Bear in mind that |
mind that ports that would be closed by gc will be kept open by a ports that would be closed by gc will be kept open by a reference |
reference to this list. to this list. |
-- Function: close-port port -- Function: close-port port
Closes PORT. The same as close-input-port and close-output-port. Closes PORT. The same as close-input-port and close-output-port.
 
File: scm-5f2.info, Node: Port Properties, Next: Port Redirection, Prev: Open ing and Closing, Up: Files and Ports File: scm-5f3.info, Node: Port Properties, Next: Port Redirection, Prev: Open ing and Closing, Up: Files and Ports
| |
4.6.2 Port Properties 4.6.2 Port Properties
--------------------- ---------------------
-- Function: port-closed? port -- Function: port-closed? port
Returns #t if PORT is closed. Returns #t if PORT is closed.
-- Function: port-type obj -- Function: port-type obj
If OBJ is not a port returns false, otherwise returns a symbol If OBJ is not a port returns false, otherwise returns a symbol
describing the port type, for example string or pipe. describing the port type, for example string or pipe.
-- Function: port-filename port -- Function: port-filename port
Returns the filename PORT was opened with. If PORT is not open to Returns the filename PORT was opened with. If PORT is not open to
a file the result is unspecified. a file the result is unspecified.
-- Function: file-position port -- Function: file-position port
-- Function: file-position port #f -- Function: file-position port #f
Returns the current position of the character in PORT which will Returns the current position of the character in PORT which will
next be read or written. If PORT is open to a non-file then `#f' next be read or written. If PORT is open to a non-file then '#f' |
is returned. is returned.
-- Function: file-position port k -- Function: file-position port k
Sets the current position in PORT which will next be read or Sets the current position in PORT which will next be read or
written. If successful, `#f' is returned. If PORT is open to a written. If successful, '#f' is returned. If PORT is open to a |
non-file, then `file-position' returns `#f'. non-file, then 'file-position' returns '#f'. |
-- Function: port-line port -- Function: port-line port
-- Function: port-column port -- Function: port-column port
If PORT is a tracked port, return the current line (column) number, If PORT is a tracked port, return the current line (column) number,
otherwise return `#f'. Line and column numbers begin with 1. The otherwise return '#f'. Line and column numbers begin with 1. The |
column number applies to the next character to be read; if that column number applies to the next character to be read; if that
character is a newline, then the column number will be one more character is a newline, then the column number will be one more
than the length of the line. than the length of the line.
-- Function: freshline port -- Function: freshline port
Outputs a newline to optional argument PORT unless the current Outputs a newline to optional argument PORT unless the current
output column number of PORT is known to be zero, ie output will output column number of PORT is known to be zero, ie output will
start at the beginning of a new line. PORT defaults to start at the beginning of a new line. PORT defaults to
`current-output-port'. If PORT is not a tracked port `freshline' 'current-output-port'. If PORT is not a tracked port 'freshline' |
is equivalent to `newline'. is equivalent to 'newline'. |
-- Function: isatty? port -- Function: isatty? port
Returns `#t' if PORT is input or output to a serial non-file Returns '#t' if PORT is input or output to a serial non-file |
device. device.
-- procedure: char-ready? -- procedure: char-ready?
-- procedure: char-ready? port -- procedure: char-ready? port |
Returns `#t' if a character is ready on the input PORT and returns
`#f' otherwise. If `char-ready?' returns `#t' then the next
`read-char' operation on the given PORT is guaranteed not to hang.
If the PORT is at end of file then `char-ready?' returns `#t'. PORT
may be omitted, in which case it defaults to the value returned by
`current-input-port'.
_Rationale_ `Char-ready?' exists to make it possible for a program Returns '#t' if a character is ready on the input PORT and returns |
'#f' otherwise. If 'char-ready?' returns '#t' then the next |
'read-char' operation on the given PORT is guaranteed not to hang. |
If the PORT is at end of file then 'char-ready?' returns '#t'. |
PORT may be omitted, in which case it defaults to the value |
returned by 'current-input-port'. |
|
_Rationale_ 'Char-ready?' exists to make it possible for a program |
to accept characters from interactive ports without getting stuck to accept characters from interactive ports without getting stuck
waiting for input. Any input editors associated with such ports waiting for input. Any input editors associated with such ports
must ensure that characters whose existence has been asserted by must ensure that characters whose existence has been asserted by
`char-ready?' cannot be rubbed out. If `char-ready?' were to 'char-ready?' cannot be rubbed out. If 'char-ready?' were to |
return `#f' at end of file, a port at end of file would be return '#f' at end of file, a port at end of file would be |
indistinguishable from an interactive port that has no ready indistinguishable from an interactive port that has no ready
characters. characters.
-- procedure: wait-for-input x -- procedure: wait-for-input x
-- procedure: wait-for-input x port1 ... -- procedure: wait-for-input x port1 ...
Returns a list those ports PORT1 ... which are `char-ready?'. If Returns a list those ports PORT1 ... which are 'char-ready?'. If |
none of PORT1 ... become `char-ready?' within the time interval of none of PORT1 ... become 'char-ready?' within the time interval of |
X seconds, then #f is returned. The PORT1 ... arguments may be X seconds, then #f is returned. The PORT1 ... arguments may be
omitted, in which case they default to the list of the value omitted, in which case they default to the list of the value
returned by `current-input-port'. returned by 'current-input-port'. |
 
File: scm-5f2.info, Node: Port Redirection, Next: Soft Ports, Prev: Port Prop erties, Up: Files and Ports File: scm-5f3.info, Node: Port Redirection, Next: Soft Ports, Prev: Port Prop erties, Up: Files and Ports
| |
4.6.3 Port Redirection 4.6.3 Port Redirection
---------------------- ----------------------
-- Function: current-error-port -- Function: current-error-port
Returns the current port to which diagnostic output is directed. Returns the current port to which diagnostic output is directed.
-- Function: with-error-to-file string thunk -- Function: with-error-to-file string thunk
THUNK must be a procedure of no arguments, and string must be a THUNK must be a procedure of no arguments, and string must be a
string naming a file. The file is opened for output, an output string naming a file. The file is opened for output, an output
port connected to it is made the default value returned by port connected to it is made the default value returned by
current-error-port, and the THUNK is called with no arguments. current-error-port, and the THUNK is called with no arguments.
When the thunk returns, the port is closed and the previous When the thunk returns, the port is closed and the previous default |
default is restored. With-error-to-file returns the value yielded is restored. With-error-to-file returns the value yielded by |
by THUNK. THUNK. |
-- Function: with-input-from-port port thunk -- Function: with-input-from-port port thunk
-- Function: with-output-to-port port thunk -- Function: with-output-to-port port thunk
-- Function: with-error-to-port port thunk -- Function: with-error-to-port port thunk
These routines differ from with-input-from-file, These routines differ from with-input-from-file,
with-output-to-file, and with-error-to-file in that the first with-output-to-file, and with-error-to-file in that the first
argument is a port, rather than a string naming a file. argument is a port, rather than a string naming a file.
-- Function: call-with-outputs thunk proc -- Function: call-with-outputs thunk proc
Calls the THUNK procedure while the current-output-port and Calls the THUNK procedure while the current-output-port and
current-error-port are directed to string-ports. If THUNK current-error-port are directed to string-ports. If THUNK returns, |
returns, the PROC procedure is called with the output-string, the the PROC procedure is called with the output-string, the |
error-string, and the value returned by THUNK. If THUNK does not error-string, and the value returned by THUNK. If THUNK does not
return a value (perhaps because of error), PROC is called with return a value (perhaps because of error), PROC is called with just |
just the output-string and the error-string as arguments. the output-string and the error-string as arguments. |
 
File: scm-5f2.info, Node: Soft Ports, Prev: Port Redirection, Up: Files and P orts File: scm-5f3.info, Node: Soft Ports, Prev: Port Redirection, Up: Files and P orts
| |
4.6.4 Soft Ports 4.6.4 Soft Ports
---------------- ----------------
A "soft-port" is a port based on a vector of procedures capable of A "soft-port" is a port based on a vector of procedures capable of
accepting or delivering characters. It allows emulation of I/O ports. accepting or delivering characters. It allows emulation of I/O ports.
-- Function: make-soft-port vector modes -- Function: make-soft-port vector modes
Returns a port capable of receiving or delivering characters as Returns a port capable of receiving or delivering characters as
specified by the MODES string (*note open-file: Files and Ports.). specified by the MODES string (*note open-file: Files and Ports.).
VECTOR must be a vector of length 5. Its components are as VECTOR must be a vector of length 5. Its components are as
follows: follows:
0. procedure accepting one character for output 0. procedure accepting one character for output
1. procedure accepting a string for output 1. procedure accepting a string for output
2. thunk for flushing output 2. thunk for flushing output
3. thunk for getting one character 3. thunk for getting one character
4. thunk for closing port (not by garbage collection) 4. thunk for closing port (not by garbage collection)
For an output-only port only elements 0, 1, 2, and 4 need be For an output-only port only elements 0, 1, 2, and 4 need be
procedures. For an input-only port only elements 3 and 4 need be procedures. For an input-only port only elements 3 and 4 need be
procedures. Thunks 2 and 4 can instead be `#f' if there is no procedures. Thunks 2 and 4 can instead be '#f' if there is no |
useful operation for them to perform. useful operation for them to perform.
If thunk 3 returns `#f' or an `eof-object' (*note eof-object?: If thunk 3 returns '#f' or an 'eof-object' (*note eof-object?: |
(r5rs)Input.) it indicates that the port has reached end-of-file. (r5rs)Input.) it indicates that the port has reached end-of-file.
For example: For example:
If it is necessary to explicitly close the port when it is garbage If it is necessary to explicitly close the port when it is garbage
collected, (*note add-finalizer: Interrupts.). collected, (*note add-finalizer: Interrupts.).
(define stdout (current-output-port)) (define stdout (current-output-port))
(define p (make-soft-port (define p (make-soft-port
(vector (vector
(lambda (c) (write c stdout)) (lambda (c) (write c stdout))
(lambda (s) (display s stdout)) (lambda (s) (display s stdout))
(lambda () (display "." stdout)) (lambda () (display "." stdout))
(lambda () (char-upcase (read-char))) (lambda () (char-upcase (read-char)))
(lambda () (display "@" stdout))) (lambda () (display "@" stdout)))
"rw")) "rw"))
(write p p) => #<input-output-soft#\space45d10#\> (write p p) => #<input-output-soft#\space45d10#\>
 
File: scm-5f2.info, Node: Eval and Load, Next: Lexical Conventions, Prev: Fil es and Ports, Up: The Language File: scm-5f3.info, Node: Eval and Load, Next: Lexical Conventions, Prev: Fil es and Ports, Up: The Language
| |
4.7 Eval and Load 4.7 Eval and Load
================= =================
-- Function: try-load filename -- Function: try-load filename
If the string FILENAME names an existing file, the try-load If the string FILENAME names an existing file, the try-load
procedure reads Scheme source code expressions and definitions procedure reads Scheme source code expressions and definitions from |
from the file and evaluates them sequentially and returns `#t'. the file and evaluates them sequentially and returns '#t'. If not, |
If not, try-load returns `#f'. The try-load procedure does not try-load returns '#f'. The try-load procedure does not affect the |
affect the values returned by `current-input-port' and values returned by 'current-input-port' and 'current-output-port'. |
`current-output-port'.
-- Variable: *load-pathname* -- Variable: *load-pathname*
Is set to the pathname given as argument to `load', `try-load', Is set to the pathname given as argument to 'load', 'try-load', and |
and `dyn:link' (*note Compiling And Linking: (hobbit)Compiling And 'dyn:link' (*note (hobbit)Compiling And Linking::). |
Linking.). `*load-pathname*' is used to compute the value of '*load-pathname*' is used to compute the value of *note |
*note program-vicinity: (slib)Vicinity. program-vicinity: (slib)Vicinity. |
-- Function: eval obj -- Function: eval obj
Alias for *note eval: (slib)System. Alias for *note eval: (slib)System.
-- Function: eval-string str -- Function: eval-string str
Returns the result of reading an expression from STR and Returns the result of reading an expression from STR and evaluating |
evaluating it. `eval-string' does not change `*load-pathname*' or it. 'eval-string' does not change '*load-pathname*' or |
`line-number'. 'line-number'. |
-- Function: load-string str -- Function: load-string str
Reads and evaluates all the expressions from STR. As with `load', Reads and evaluates all the expressions from STR. As with 'load', |
the value returned is unspecified. `load-string' does not change the value returned is unspecified. 'load-string' does not change |
`*load-pathname*' or `line-number'. '*load-pathname*' or 'line-number'. |
-- Function: line-number -- Function: line-number
Returns the current line number of the file currently being loaded. Returns the current line number of the file currently being loaded.
* Menu: * Menu:
* Line Numbers:: * Line Numbers::
 
File: scm-5f2.info, Node: Line Numbers, Prev: Eval and Load, Up: Eval and Loa d File: scm-5f3.info, Node: Line Numbers, Prev: Eval and Load, Up: Eval and Loa d
| |
4.7.1 Line Numbers 4.7.1 Line Numbers
------------------ ------------------
Scheme code defined by load may optionally contain line number Scheme code defined by load may optionally contain line number
information. Currently this information is used only for reporting information. Currently this information is used only for reporting
expansion time errors, but in the future run-time error messages may expansion time errors, but in the future run-time error messages may
also include line number information. also include line number information.
-- Function: try-load pathname reader -- Function: try-load pathname reader
This is the primitive for loading, PATHNAME is the name of a file This is the primitive for loading, PATHNAME is the name of a file
containing Scheme code, and optional argument READER is a function containing Scheme code, and optional argument READER is a function
of one argument, a port. READER should read and return Scheme of one argument, a port. READER should read and return Scheme code |
code as list structure. The default value is `read', which is as list structure. The default value is 'read', which is used if |
used if READER is not supplied or is false. READER is not supplied or is false. |
Line number objects are disjoint from integers or other Scheme types. Line number objects are disjoint from integers or other Scheme types.
When evaluated or loaded as Scheme code, an s-expression containing a When evaluated or loaded as Scheme code, an s-expression containing a
line-number in the car is equivalent to the cdr of the s-expression. A line-number in the car is equivalent to the cdr of the s-expression. A
pair consisting of a line-number in the car and a vector in the cdr is pair consisting of a line-number in the car and a vector in the cdr is
equivalent to the vector. The meaning of s-expressions with equivalent to the vector. The meaning of s-expressions with
line-numbers in other positions is undefined. line-numbers in other positions is undefined.
-- Function: read-numbered port -- Function: read-numbered port
Behaves like `read', except that Behaves like 'read', except that |
bullet Load (read) sytnaxes are enabled. bullet Load (read) sytnaxes are enabled.
bullet every s-expression read will be replaced with a cons of a |
bullet every s-expression read will be replaced with a cons of line-number object and the sexp actually read. This |
a line-number object and the sexp actually read. This
replacement is done only if PORT is a tracked port See *Note replacement is done only if PORT is a tracked port See *Note
Files and Ports::. Files and Ports::.
-- Function: integer->line-number int -- Function: integer->line-number int
Returns a line-number object with value INT. INT should be an Returns a line-number object with value INT. INT should be an
exact non-negative integer. exact non-negative integer.
-- Function: line-number->integer linum -- Function: line-number->integer linum
Returns the value of line-number object LINUM as an integer. Returns the value of line-number object LINUM as an integer.
-- Function: line-number? obj -- Function: line-number? obj
Returns true if and only if OBJ is a line-number object. Returns true if and only if OBJ is a line-number object.
-- Function: read-for-load port -- Function: read-for-load port
Behaves like `read', except that load syntaxes are enabled. Behaves like 'read', except that load syntaxes are enabled. |
-- Variable: *load-reader* -- Variable: *load-reader*
-- Variable: *slib-load-reader* -- Variable: *slib-load-reader*
The value of `*load-reader*' should be a value acceptable as the The value of '*load-reader*' should be a value acceptable as the |
second argument to `try-load' (note that #f is acceptable). This second argument to 'try-load' (note that #f is acceptable). This |
value will be used to read code during calls to `scm:load'. The value will be used to read code during calls to 'scm:load'. The |
value of `*slib-load-reader*' will similarly be used during calls value of '*slib-load-reader*' will similarly be used during calls |
to `slib:load' and `require'. to 'slib:load' and 'require'. |
In order to disable all line-numbering, it is sufficient to set! In order to disable all line-numbering, it is sufficient to set!
`*load-reader*' and `*slib-load-reader*' to #f. '*load-reader*' and '*slib-load-reader*' to #f. |
 
File: scm-5f2.info, Node: Lexical Conventions, Next: Syntax, Prev: Eval and L oad, Up: The Language File: scm-5f3.info, Node: Lexical Conventions, Next: Syntax, Prev: Eval and L oad, Up: The Language
| |
4.8 Lexical Conventions 4.8 Lexical Conventions
======================= =======================
* Menu: * Menu:
* Common-Lisp Read Syntax:: * Common-Lisp Read Syntax::
* Load Syntax:: * Load Syntax::
* Documentation and Comments:: * Documentation and Comments::
* Modifying Read Syntax:: * Modifying Read Syntax::
 
File: scm-5f2.info, Node: Common-Lisp Read Syntax, Next: Load Syntax, Prev: L exical Conventions, Up: Lexical Conventions File: scm-5f3.info, Node: Common-Lisp Read Syntax, Next: Load Syntax, Prev: L exical Conventions, Up: Lexical Conventions
| |
4.8.1 Common-Lisp Read Syntax 4.8.1 Common-Lisp Read Syntax
----------------------------- -----------------------------
-- Read syntax: #\token -- Read syntax: #\token
If TOKEN is a sequence of two or more digits, then this syntax is If TOKEN is a sequence of two or more digits, then this syntax is
equivalent to `#.(integer->char (string->number token 8))'. equivalent to '#.(integer->char (string->number token 8))'. |
If TOKEN is `C-', `c-', or `^' followed by a character, then this If TOKEN is 'C-', 'c-', or '^' followed by a character, then this |
syntax is read as a control character. If TOKEN is `M-' or `m-' syntax is read as a control character. If TOKEN is 'M-' or 'm-' |
followed by a character, then a meta character is read. `c-' and followed by a character, then a meta character is read. 'c-' and |
`m-' prefixes may be combined. 'm-' prefixes may be combined. |
-- Read syntax: #+ feature form -- Read syntax: #+ feature form
If feature is `provided?' then FORM is read as a scheme If feature is 'provided?' then FORM is read as a scheme expression. |
expression. If not, then FORM is treated as whitespace. If not, then FORM is treated as whitespace. |
Feature is a boolean expression composed of symbols and `and', Feature is a boolean expression composed of symbols and 'and', |
`or', and `not' of boolean expressions. 'or', and 'not' of boolean expressions. |
For more information on `provided?', *Note Require: (slib)Require. For more information on 'provided?', *Note (slib)Require::. |
-- Read syntax: #- feature form -- Read syntax: #- feature form
is equivalent to `#+(not feature) expression'. is equivalent to '#+(not feature) expression'. |
-- Read syntax: #| any thing |# -- Read syntax: #| any thing |#
Is a balanced comment. Everything up to the matching `|#' is Is a balanced comment. Everything up to the matching '|#' is |
ignored by the `read'. Nested `#|...|#' can occur inside ANY ignored by the 'read'. Nested '#|...|#' can occur inside ANY |
THING. THING.
"Load sytax" is Read syntax enabled for `read' only when that `read' is "Load sytax" is Read syntax enabled for 'read' only when that 'read' is |
part of loading a file or string. This distinction was made so that part of loading a file or string. This distinction was made so that
reading from a datafile would not be able to corrupt a scheme program reading from a datafile would not be able to corrupt a scheme program
using `#.'. using '#.'. |
-- Load syntax: #. expression -- Load syntax: #. expression
Is read as the object resulting from the evaluation of EXPRESSION. Is read as the object resulting from the evaluation of EXPRESSION.
This substitution occurs even inside quoted structure. This substitution occurs even inside quoted structure.
In order to allow compiled code to work with `#.' it is good In order to allow compiled code to work with '#.' it is good |
practice to define those symbols used inside of EXPRESSION with practice to define those symbols used inside of EXPRESSION with
`#.(define ...)'. For example: '#.(define ...)'. For example: |
#.(define foo 9) => #<unspecified> #.(define foo 9) => #<unspecified>
'(#.foo #.(+ foo foo)) => (9 18) '(#.foo #.(+ foo foo)) => (9 18)
-- Load syntax: #' form -- Load syntax: #' form
is equivalent to FORM (for compatibility with common-lisp). is equivalent to FORM (for compatibility with common-lisp).
 
File: scm-5f2.info, Node: Load Syntax, Next: Documentation and Comments, Prev : Common-Lisp Read Syntax, Up: Lexical Conventions File: scm-5f3.info, Node: Load Syntax, Next: Documentation and Comments, Prev : Common-Lisp Read Syntax, Up: Lexical Conventions
| |
4.8.2 Load Syntax 4.8.2 Load Syntax
----------------- -----------------
"#!" is the unix mechanism for executing scripts. See *note Unix "#!" is the unix mechanism for executing scripts. See *note Unix
Scheme Scripts:: for the full description of how this comment supports Scheme Scripts:: for the full description of how this comment supports
scripting. scripting.
-- Load syntax: #?line -- Load syntax: #?line
-- Load syntax: #?column -- Load syntax: #?column
Return integers for the current line and column being read during a Return integers for the current line and column being read during a
load. load.
-- Load syntax: #?file -- Load syntax: #?file
Returns the string naming the file currently being loaded. This Returns the string naming the file currently being loaded. This
path is the string passed to `load', possibly with `.scm' appended. path is the string passed to 'load', possibly with '.scm' appended. |
 
File: scm-5f2.info, Node: Documentation and Comments, Next: Modifying Read Syn tax, Prev: Load Syntax, Up: Lexical Conventions File: scm-5f3.info, Node: Documentation and Comments, Next: Modifying Read Syn tax, Prev: Load Syntax, Up: Lexical Conventions
| |
4.8.3 Documentation and Comments 4.8.3 Documentation and Comments
-------------------------------- --------------------------------
-- procedure: procedure-documentation proc -- procedure: procedure-documentation proc
Returns the documentation string of PROC if it exists, or `#f' if Returns the documentation string of PROC if it exists, or '#f' if |
not. not.
If the body of a `lambda' (or the definition of a procedure) has If the body of a 'lambda' (or the definition of a procedure) has |
more than one expression, and the first expression (preceeding any more than one expression, and the first expression (preceeding any
internal definitions) is a string, then that string is the internal definitions) is a string, then that string is the
"documentation string" of that procedure. "documentation string" of that procedure.
(procedure-documentation (lambda (x) "Identity" x)) => "Identity" (procedure-documentation (lambda (x) "Identity" x)) => "Identity"
(define (square x) (define (square x)
"Return the square of X." "Return the square of X."
(* x x)) (* x x))
=> #<unspecified> => #<unspecified>
(procedure-documentation square) => "Return the square of X." (procedure-documentation square) => "Return the square of X."
-- Function: comment string1 ... -- Function: comment string1 ...
Appends STRING1 ... to the strings given as arguments to previous Appends STRING1 ... to the strings given as arguments to previous
calls `comment'. calls 'comment'. |
-- Function: comment -- Function: comment
Returns the (appended) strings given as arguments to previous calls Returns the (appended) strings given as arguments to previous calls
`comment' and empties the current string collection. 'comment' and empties the current string collection. |
-- Load syntax: #;text-till-end-of-line -- Load syntax: #;text-till-end-of-line
Behaves as `(comment "TEXT-TILL-END-OF-LINE")'. Behaves as '(comment "TEXT-TILL-END-OF-LINE")'. |
 
File: scm-5f2.info, Node: Modifying Read Syntax, Prev: Documentation and Comme nts, Up: Lexical Conventions File: scm-5f3.info, Node: Modifying Read Syntax, Prev: Documentation and Comme nts, Up: Lexical Conventions
| |
4.8.4 Modifying Read Syntax 4.8.4 Modifying Read Syntax
--------------------------- ---------------------------
-- Callback procedure: read:sharp c port -- Callback procedure: read:sharp c port
If a <#> followed by a character (for a non-standard syntax) is If a <#> followed by a character (for a non-standard syntax) is
encountered by `read', `read' will call the value of the symbol encountered by 'read', 'read' will call the value of the symbol |
`read:sharp' with arguments the character and the port being read 'read:sharp' with arguments the character and the port being read |
from. The value returned by this function will be the value of from. The value returned by this function will be the value of
`read' for this expression unless the function returns 'read' for this expression unless the function returns |
`#<unspecified>' in which case the expression will be treated as '#<unspecified>' in which case the expression will be treated as |
whitespace. `#<unspecified>' is the value returned by the whitespace. '#<unspecified>' is the value returned by the |
expression `(if #f #f)'. expression '(if #f #f)'. |
-- Callback procedure: load:sharp c port -- Callback procedure: load:sharp c port
Dispatches like `read:sharp', but only during `load's. The Dispatches like 'read:sharp', but only during 'load's. The |
read-syntaxes handled by `load:sharp' are a superset of those read-syntaxes handled by 'load:sharp' are a superset of those |
handled by `read:sharp'. `load:sharp' calls `read:sharp' if none handled by 'read:sharp'. 'load:sharp' calls 'read:sharp' if none |
of its syntaxes match C. of its syntaxes match C.
-- Callback procedure: char:sharp token -- Callback procedure: char:sharp token
If the sequence <#\> followed by a non-standard character name is If the sequence <#\> followed by a non-standard character name is
encountered by `read', `read' will call the value of the symbol encountered by 'read', 'read' will call the value of the symbol |
`char:sharp' with the token (a string of length at least two) as 'char:sharp' with the token (a string of length at least two) as |
argument. If the value returned is a character, then that will be argument. If the value returned is a character, then that will be
the value of `read' for this expression, otherwise an error will the value of 'read' for this expression, otherwise an error will be |
be signaled. signaled. |
_Note_ When adding new <#> syntaxes, have your code save the previous _Note_ When adding new <#> syntaxes, have your code save the previous
value of `load:sharp', `read:sharp', or `char:sharp' when defining it. value of 'load:sharp', 'read:sharp', or 'char:sharp' when defining it. |
Call this saved value if an invocation's syntax is not recognized. Call this saved value if an invocation's syntax is not recognized. This |
This will allow `#+', `#-', and *note Uniform Array::s to still be will allow '#+', '#-', and *note Uniform Array::s to still be supported |
supported (as they dispatch from `read:sharp'). (as they dispatch from 'read:sharp'). |
 
File: scm-5f2.info, Node: Syntax, Prev: Lexical Conventions, Up: The Language File: scm-5f3.info, Node: Syntax, Prev: Lexical Conventions, Up: The Language
| |
4.9 Syntax 4.9 Syntax
========== ==========
SCM provides a native implementation of "defmacro". *Note Defmacro: SCM provides a native implementation of "defmacro". *Note |
(slib)Defmacro. (slib)Defmacro::. |
When built with `-F macro' build option (*note Build Options::) and When built with '-F macro' build option (*note Build Options::) and |
`*syntax-rules*' is non-false, SCM also supports [R5RS] `syntax-rules' '*syntax-rules*' is non-false, SCM also supports [R5RS] 'syntax-rules' |
macros. *Note Macros: (r5rs)Macros. macros. *Note (r5rs)Macros::. |
Other Scheme Syntax Extension Packages from SLIB can be employed through Other Scheme Syntax Extension Packages from SLIB can be employed through
the use of `macro:eval' and `macro:load'; Or by using the SLIB the use of 'macro:eval' and 'macro:load'; Or by using the SLIB |
read-eval-print-loop: read-eval-print-loop:
(require 'repl) (require 'repl)
(repl:top-level macro:eval) (repl:top-level macro:eval)
With the appropriate catalog entries (*note Library Catalogs: With the appropriate catalog entries (*note (slib)Library Catalogs::), |
(slib)Library Catalogs.), files using macro packages will automatically files using macro packages will automatically use the correct macro |
use the correct macro loader when `require'd. loader when 'require'd. |
* Menu: * Menu:
* Define and Set:: * Define and Set::
* Defmacro:: * Defmacro::
* Syntax-Rules:: * Syntax-Rules::
* Macro Primitives:: * Macro Primitives::
* Environment Frames:: * Environment Frames::
* Syntactic Hooks for Hygienic Macros:: * Syntactic Hooks for Hygienic Macros::
 
File: scm-5f2.info, Node: Define and Set, Next: Defmacro, Prev: Syntax, Up: Syntax File: scm-5f3.info, Node: Define and Set, Next: Defmacro, Prev: Syntax, Up: Syntax
| |
4.9.1 Define and Set 4.9.1 Define and Set
-------------------- --------------------
-- Special Form: defined? symbol -- Special Form: defined? symbol
Equivalent to `#t' if SYMBOL is a syntactic keyword (such as `if') Equivalent to '#t' if SYMBOL is a syntactic keyword (such as 'if') |
or a symbol with a value in the top level environment (*note or a symbol with a value in the top level environment (*note
Variables and regions: (r5rs)Variables and regions.). Otherwise (r5rs)Variables and regions::). Otherwise equivalent to '#f'. |
equivalent to `#f'.
-- Special Form: defvar identifier initial-value -- Special Form: defvar identifier initial-value
If IDENTIFIER is unbound in the top level environment, then If IDENTIFIER is unbound in the top level environment, then
IDENTIFIER is `define'd to the result of evaluating the form IDENTIFIER is 'define'd to the result of evaluating the form |
INITIAL-VALUE as if the `defvar' form were instead the form INITIAL-VALUE as if the 'defvar' form were instead the form |
`(define identifier initial-value)' . If IDENTIFIER already has a '(define identifier initial-value)' . If IDENTIFIER already has a |
value, then INITIAL-VALUE is _not_ evaluated and IDENTIFIER's value, then INITIAL-VALUE is _not_ evaluated and IDENTIFIER's value |
value is not changed. `defvar' is valid only when used at is not changed. 'defvar' is valid only when used at top-level. |
top-level.
-- Special Form: defconst identifier value -- Special Form: defconst identifier value
If IDENTIFIER is unbound in the top level environment, then If IDENTIFIER is unbound in the top level environment, then
IDENTIFIER is `define'd to the result of evaluating the form VALUE IDENTIFIER is 'define'd to the result of evaluating the form VALUE |
as if the `defconst' form were instead the form `(define as if the 'defconst' form were instead the form '(define identifier |
identifier value)' . If IDENTIFIER already has a value, then value)' . If IDENTIFIER already has a value, then VALUE is _not_ |
VALUE is _not_ evaluated, IDENTIFIER's value is not changed, and evaluated, IDENTIFIER's value is not changed, and an error is |
an error is signaled. `defconst' is valid only when used at signaled. 'defconst' is valid only when used at top-level. |
top-level.
-- Special Form: set! (variable1 variable2 ...) <expression> -- Special Form: set! (variable1 variable2 ...) <expression>
The identifiers VARIABLE1, VARIABLE2, ... must be bound either in The identifiers VARIABLE1, VARIABLE2, ... must be bound either in
some region enclosing the `set!' expression or at top level. some region enclosing the 'set!' expression or at top level. |
<Expression> is evaluated, and the elements of the resulting list <Expression> is evaluated, and the elements of the resulting list
are stored in the locations to which each corresponding VARIABLE are stored in the locations to which each corresponding VARIABLE is |
is bound. The result of the `set!' expression is unspecified. bound. The result of the 'set!' expression is unspecified. |
(define x 2) (define x 2)
(define y 3) (define y 3)
(+ x y) => 5 (+ x y) => 5
(set! (x y) (list 4 5)) => _unspecified_ (set! (x y) (list 4 5)) => _unspecified_
(+ x y) => 9 (+ x y) => 9
-- Special Form: qase key clause1 clause2 ... -- Special Form: qase key clause1 clause2 ...
`qase' is an extension of standard Scheme `case': Each CLAUSE of a 'qase' is an extension of standard Scheme 'case': Each CLAUSE of a |
`qase' statement must have as first element a list containing 'qase' statement must have as first element a list containing |
elements which are: elements which are:
* literal datums, or * literal datums, or
* a comma followed by the name of a symbolic constant, or * a comma followed by the name of a symbolic constant, or
* a comma followed by an at-sign (@) followed by the name of a * a comma followed by an at-sign (@) followed by the name of a
symbolic constant whose value is a list. symbolic constant whose value is a list.
A `qase' statement is equivalent to a `case' statement in which A 'qase' statement is equivalent to a 'case' statement in which |
these symbolic constants preceded by commas have been replaced by these symbolic constants preceded by commas have been replaced by
the values of the constants, and all symbolic constants preceded by the values of the constants, and all symbolic constants preceded by
comma-at-signs have been replaced by the elements of the list comma-at-signs have been replaced by the elements of the list
values of the constants. This use of comma, (or, equivalently, values of the constants. This use of comma, (or, equivalently,
`unquote') is similar to that of `quasiquote' except that the 'unquote') is similar to that of 'quasiquote' except that the |
unquoted expressions must be "symbolic constants". unquoted expressions must be "symbolic constants".
Symbolic constants are defined using `defconst', their values are Symbolic constants are defined using 'defconst', their values are |
substituted in the head of each `qase' clause during macro substituted in the head of each 'qase' clause during macro |
expansion. `defconst' constants should be defined before use. expansion. 'defconst' constants should be defined before use. |
`qase' can be substituted for any correct use of `case'. 'qase' can be substituted for any correct use of 'case'. |
(defconst unit '1) (defconst unit '1)
(defconst semivowels '(w y)) (defconst semivowels '(w y))
(qase (* 2 3) (qase (* 2 3)
((2 3 5 7) 'prime) ((2 3 5 7) 'prime)
((,unit 4 6 8 9) 'composite)) ==> composite ((,unit 4 6 8 9) 'composite)) ==> composite
(qase (car '(c d)) (qase (car '(c d))
((a) 'a) ((a) 'a)
((b) 'b)) ==> _unspecified_ ((b) 'b)) ==> _unspecified_
(qase (car '(c d)) (qase (car '(c d))
((a e i o u) 'vowel) ((a e i o u) 'vowel)
((,@semivowels) 'semivowel) ((,@semivowels) 'semivowel)
(else 'consonant)) ==> consonant (else 'consonant)) ==> consonant
 
File: scm-5f2.info, Node: Defmacro, Next: Syntax-Rules, Prev: Define and Set, Up: Syntax File: scm-5f3.info, Node: Defmacro, Next: Syntax-Rules, Prev: Define and Set, Up: Syntax
| |
4.9.2 Defmacro 4.9.2 Defmacro
-------------- --------------
SCM supports the following constructs from Common Lisp: `defmacro', SCM supports the following constructs from Common Lisp: 'defmacro', |
`macroexpand', `macroexpand-1', and `gentemp'. *Note Defmacro: 'macroexpand', 'macroexpand-1', and 'gentemp'. *Note (slib)Defmacro::. |
(slib)Defmacro.
SCM `defmacro' is extended over that described for SLIB: SCM 'defmacro' is extended over that described for SLIB: |
(defmacro (macro-name . arguments) body) (defmacro (macro-name . arguments) body)
is equivalent to is equivalent to
(defmacro macro-name arguments body) (defmacro macro-name arguments body)
As in Common Lisp, an element of the formal argument list for As in Common Lisp, an element of the formal argument list for 'defmacro' |
`defmacro' may be a possibly nested list, in which case the may be a possibly nested list, in which case the corresponding actual |
corresponding actual argument must be a list with as many members as the argument must be a list with as many members as the formal argument. |
formal argument. Rest arguments are indicated by improper lists, as in Rest arguments are indicated by improper lists, as in Scheme. It is an |
Scheme. It is an error if the actual argument list does not have the error if the actual argument list does not have the tree structure |
tree structure required by the formal argument list. required by the formal argument list. |
For example: For example:
(defmacro (let1 ((name value)) . body) (defmacro (let1 ((name value)) . body)
`((lambda (,name) ,@body) ,value)) `((lambda (,name) ,@body) ,value))
(let1 ((x (foo))) (print x) x) == ((lambda (x) (print x) x) (foo)) (let1 ((x (foo))) (print x) x) == ((lambda (x) (print x) x) (foo))
(let1 not legal syntax) error--> not "does not match" ((name value)) (let1 not legal syntax) error-> not "does not match" ((name value)) |
 
File: scm-5f2.info, Node: Syntax-Rules, Next: Macro Primitives, Prev: Defmacr o, Up: Syntax File: scm-5f3.info, Node: Syntax-Rules, Next: Macro Primitives, Prev: Defmacr o, Up: Syntax
| |
4.9.3 Syntax-Rules 4.9.3 Syntax-Rules
------------------ ------------------
SCM supports [R5RS] `syntax-rules' macros *Note Macros: (r5rs)Macros. SCM supports [R5RS] 'syntax-rules' macros *Note (r5rs)Macros::. |
The pattern language is extended by the syntax `(... <obj>)', which is The pattern language is extended by the syntax '(... <obj>)', which is |
identical to `<obj>' except that ellipses in `<obj>' are treated as identical to '<obj>' except that ellipses in '<obj>' are treated as |
ordinary identifiers in a template, or as literals in a pattern. In ordinary identifiers in a template, or as literals in a pattern. In
particular, `(... ...)' quotes the ellipsis token `...' in a pattern or particular, '(... ...)' quotes the ellipsis token '...' in a pattern or |
template. template.
For example: For example:
(define-syntax check-tree (define-syntax check-tree
(syntax-rules () (syntax-rules ()
((_ (?pattern (... ...)) ?obj) ((_ (?pattern (... ...)) ?obj)
(let loop ((obj ?obj)) (let loop ((obj ?obj))
(or (null? obj) (or (null? obj)
(and (pair? obj) (and (pair? obj)
(check-tree ?pattern (car obj)) (check-tree ?pattern (car obj))
skipping to change at line 3874 skipping to change at line 3755
(check-tree ?first (car obj)) (check-tree ?first (car obj))
(check-tree ?rest (cdr obj))))) (check-tree ?rest (cdr obj)))))
((_ ?atom ?obj) #t))) ((_ ?atom ?obj) #t)))
(check-tree ((a b) ...) '((1 2) (3 4) (5 6))) => #t (check-tree ((a b) ...) '((1 2) (3 4) (5 6))) => #t
(check-tree ((a b) ...) '((1 2) (3 4) not-a-2list) => #f (check-tree ((a b) ...) '((1 2) (3 4) not-a-2list) => #f
Note that although the ellipsis is matched as a literal token in the Note that although the ellipsis is matched as a literal token in the
defined macro it is not included in the literals list for defined macro it is not included in the literals list for
`syntax-rules'. 'syntax-rules'. |
The pattern language is also extended to support identifier macros. A The pattern language is also extended to support identifier macros. A
reference to an identifier macro keyword that is not the first reference to an identifier macro keyword that is not the first
identifier in a form may expand into Scheme code, rather than raising a identifier in a form may expand into Scheme code, rather than raising a
"keyword as variable" error. The pattern for expansion of such a bare "keyword as variable" error. The pattern for expansion of such a bare
macro keyword is a single identifier, as in other syntax rules the macro keyword is a single identifier, as in other syntax rules the
identifier is ignored. identifier is ignored.
For example: For example:
(define-syntax eight (define-syntax eight
(syntax-rules () (syntax-rules ()
(_ 8))) (_ 8)))
(+ 3 eight) => 11 (+ 3 eight) => 11
(eight) => ERROR (eight) => ERROR
(set! eight 9) => ERROR (set! eight 9) => ERROR
 
File: scm-5f2.info, Node: Macro Primitives, Next: Environment Frames, Prev: S yntax-Rules, Up: Syntax File: scm-5f3.info, Node: Macro Primitives, Next: Environment Frames, Prev: S yntax-Rules, Up: Syntax
| |
4.9.4 Macro Primitives 4.9.4 Macro Primitives
---------------------- ----------------------
-- Function: procedure->syntax proc -- Function: procedure->syntax proc
Returns a "macro" which, when a symbol defined to this value Returns a "macro" which, when a symbol defined to this value
appears as the first symbol in an expression, returns the result appears as the first symbol in an expression, returns the result of |
of applying PROC to the expression and the environment. applying PROC to the expression and the environment. |
-- Function: procedure->macro proc -- Function: procedure->macro proc
-- Function: procedure->memoizing-macro proc -- Function: procedure->memoizing-macro proc
-- Function: procedure->identifier-macro -- Function: procedure->identifier-macro
Returns a "macro" which, when a symbol defined to this value Returns a "macro" which, when a symbol defined to this value
appears as the first symbol in an expression, evaluates the result appears as the first symbol in an expression, evaluates the result
of applying PROC to the expression and the environment. The value of applying PROC to the expression and the environment. The value
returned from PROC which has been passed to returned from PROC which has been passed to
`PROCEDURE->MEMOIZING-MACRO' replaces the form passed to PROC. 'PROCEDURE->MEMOIZING-MACRO' replaces the form passed to PROC. For |
For example: example: |
(defsyntax trace (defsyntax trace
(procedure->macro (procedure->macro
(lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x)))))) (lambda (x env) `(set! ,(cadr x) (tracef ,(cadr x) ',(cadr x))))))
(trace foo) == (set! foo (tracef foo 'foo)). (trace foo) == (set! foo (tracef foo 'foo)).
`PROCEDURE->IDENTIFIER-MACRO' is similar to 'PROCEDURE->IDENTIFIER-MACRO' is similar to |
`PROCEDURE->MEMOIZING-MACRO' except that PROC is also called in 'PROCEDURE->MEMOIZING-MACRO' except that PROC is also called in |
case the symbol bound to the macro appears in an expression but case the symbol bound to the macro appears in an expression but
_not_ as the first symbol, that is, when it looks like a variable _not_ as the first symbol, that is, when it looks like a variable
reference. In that case, the form passed to PROC is a single reference. In that case, the form passed to PROC is a single
identifier. identifier.
-- Special Form: defsyntax name expr -- Special Form: defsyntax name expr
Defines NAME as a macro keyword bound to the result of evaluating Defines NAME as a macro keyword bound to the result of evaluating
EXPR, which should be a macro. Using `define' for this purpose EXPR, which should be a macro. Using 'define' for this purpose may |
may not result in NAME being interpreted as a macro keyword. not result in NAME being interpreted as a macro keyword. |
 
File: scm-5f2.info, Node: Environment Frames, Next: Syntactic Hooks for Hygien ic Macros, Prev: Macro Primitives, Up: Syntax File: scm-5f3.info, Node: Environment Frames, Next: Syntactic Hooks for Hygien ic Macros, Prev: Macro Primitives, Up: Syntax
| |
4.9.5 Environment Frames 4.9.5 Environment Frames
------------------------ ------------------------
An "environment" is a list of frames representing lexical bindings. An "environment" is a list of frames representing lexical bindings.
Only the names and scope of the bindings are included in environments Only the names and scope of the bindings are included in environments
passed to macro expanders - run-time values are not included. passed to macro expanders - run-time values are not included.
There are several types of environment frames: There are several types of environment frames:
`((lambda (variable1 ...) ...) value1 ...)' '((lambda (variable1 ...) ...) value1 ...)' |
`(let ((variable1 value1) (variable2 value2) ...) ...)' '(let ((variable1 value1) (variable2 value2) ...) ...)' |
`(letrec ((variable1 value1) ...) ...)' '(letrec ((variable1 value1) ...) ...)' |
result in a single enviroment frame: result in a single enviroment frame:
(variable1 variable2 ...) (variable1 variable2 ...)
`(let ((variable1 value1)) ...)' |
`(let* ((variable1 value1) ...) ...)' '(let ((variable1 value1)) ...)' |
'(let* ((variable1 value1) ...) ...)' |
result in an environment frame for each variable: result in an environment frame for each variable:
variable1 variable2 ... variable1 variable2 ...
`(let-syntax ((key1 macro1) (key2 macro2)) ...)' |
`(letrec-syntax ((key1 value1) (key2 value2)) ...)' '(let-syntax ((key1 macro1) (key2 macro2)) ...)' |
Lexically bound macros result in environment frames consisting of '(letrec-syntax ((key1 value1) (key2 value2)) ...)' |
a marker and an alist of keywords and macro objects: Lexically bound macros result in environment frames consisting of a |
marker and an alist of keywords and macro objects: |
(<env-syntax-marker> (key1 . value1) (key2 . value2)) (<env-syntax-marker> (key1 . value1) (key2 . value2))
Currently <env-syntax-marker> is the integer 6. Currently <env-syntax-marker> is the integer 6.
`line numbers' 'line numbers' |
Line numbers (*note Line Numbers::) may be included in the Line numbers (*note Line Numbers::) may be included in the
environment as frame entries to indicate the line number on which environment as frame entries to indicate the line number on which a |
a function is defined. They are ignored for variable lookup. function is defined. They are ignored for variable lookup. |
#<line 8> #<line 8>
`miscellaneous' |
'miscellaneous' |
Debugging information is stored in environments in a plist format: Debugging information is stored in environments in a plist format:
Any exact integer stored as an environment frame may be followed Any exact integer stored as an environment frame may be followed by |
by any value. The two frame entries are ignored when doing any value. The two frame entries are ignored when doing variable |
variable lookup. Load file names, procedure names, and closure lookup. Load file names, procedure names, and closure |
documentation strings are stored in this format. documentation strings are stored in this format.
<env-filename-marker> "foo.scm" <env-procedure-name-marker> foo ... <env-filename-marker> "foo.scm" <env-procedure-name-marker> foo ...
Currently <env-filename-marker> is the integer 1 and Currently <env-filename-marker> is the integer 1 and
<env-procedure-name-marker> the integer 2. <env-procedure-name-marker> the integer 2.
-- Special Form: @apply procedure argument-list -- Special Form: @apply procedure argument-list
Returns the result of applying PROCEDURE to ARGUMENT-LIST. Returns the result of applying PROCEDURE to ARGUMENT-LIST.
`@apply' differs from `apply' when the identifiers bound by the '@apply' differs from 'apply' when the identifiers bound by the |
closure being applied are `set!'; setting affects ARGUMENT-LIST. closure being applied are 'set!'; setting affects ARGUMENT-LIST. |
(define lst (list 'a 'b 'c)) (define lst (list 'a 'b 'c))
(@apply (lambda (v1 v2 v3) (set! v1 (cons v2 v3))) lst) (@apply (lambda (v1 v2 v3) (set! v1 (cons v2 v3))) lst)
lst => ((b . c) b c) lst => ((b . c) b c)
Thus a mutable environment can be treated as both a list and local Thus a mutable environment can be treated as both a list and local
bindings. bindings.
 
File: scm-5f2.info, Node: Syntactic Hooks for Hygienic Macros, Prev: Environme nt Frames, Up: Syntax File: scm-5f3.info, Node: Syntactic Hooks for Hygienic Macros, Prev: Environme nt Frames, Up: Syntax
| |
4.9.6 Syntactic Hooks for Hygienic Macros 4.9.6 Syntactic Hooks for Hygienic Macros
----------------------------------------- -----------------------------------------
SCM provides a synthetic identifier type for efficient implementation of SCM provides a synthetic identifier type for efficient implementation of
hygienic macros (for example, `syntax-rules' *note Macros: hygienic macros (for example, 'syntax-rules' *note (r5rs)Macros::) A |
(r5rs)Macros.) A synthetic identifier may be inserted in Scheme code by synthetic identifier may be inserted in Scheme code by a macro expander |
a macro expander in any context where a symbol would normally be used. in any context where a symbol would normally be used. Collectively, |
Collectively, symbols and synthetic identifiers are _identifiers_. symbols and synthetic identifiers are _identifiers_. |
-- Function: identifier? obj -- Function: identifier? obj
Returns `#t' if OBJ is a symbol or a synthetic identifier, and Returns '#t' if OBJ is a symbol or a synthetic identifier, and '#f' |
`#f' otherwise. otherwise. |
If it is necessary to distinguish between symbols and synthetic If it is necessary to distinguish between symbols and synthetic
identifiers, use the predicate `symbol?'. identifiers, use the predicate 'symbol?'. |
A synthetic identifier includes two data: a parent, which is an A synthetic identifier includes two data: a parent, which is an
identifier, and an environment, which is either `#f' or a lexical identifier, and an environment, which is either '#f' or a lexical |
environment which has been passed to a "macro expander" (a procedure environment which has been passed to a "macro expander" (a procedure
passed as an argument to `procedure->macro', passed as an argument to 'procedure->macro', |
`procedure->memoizing-macro', or `procedure->syntax'). 'procedure->memoizing-macro', or 'procedure->syntax'). |
-- Function: renamed-identifier parent env -- Function: renamed-identifier parent env
Returns a synthetic identifier. PARENT must be an identifier, and Returns a synthetic identifier. PARENT must be an identifier, and
ENV must either be `#f' or a lexical environment passed to a macro ENV must either be '#f' or a lexical environment passed to a macro |
expander. `renamed-identifier' returns a distinct object for each expander. 'renamed-identifier' returns a distinct object for each |
call, even if passed identical arguments. call, even if passed identical arguments.
There is no direct way to access all of the data internal to a synthetic There is no direct way to access all of the data internal to a synthetic
identifier, those data are used during variable lookup. If a synthetic identifier, those data are used during variable lookup. If a synthetic
identifier is inserted as quoted data then during macro expansion it identifier is inserted as quoted data then during macro expansion it
will be repeatedly replaced by its parent, until a symbol is obtained. will be repeatedly replaced by its parent, until a symbol is obtained.
-- Function: identifier->symbol id -- Function: identifier->symbol id
Returns the symbol obtained by recursively extracting the parent of Returns the symbol obtained by recursively extracting the parent of
ID, which must be an identifier. ID, which must be an identifier.
4.9.7 Use of Synthetic Identifiers 4.9.7 Use of Synthetic Identifiers
---------------------------------- ----------------------------------
`renamed-identifier' may be used as a replacement for `gentemp': 'renamed-identifier' may be used as a replacement for 'gentemp': |
(define gentemp (define gentemp
(let ((name (string->symbol "An unlikely variable"))) (let ((name (string->symbol "An unlikely variable")))
(lambda () (lambda ()
(renamed-identifier name #f)))) (renamed-identifier name #f))))
If an identifier returned by this version of `gentemp' is inserted in a If an identifier returned by this version of 'gentemp' is inserted in a |
binding position as the name of a variable then it is guaranteed that binding position as the name of a variable then it is guaranteed that no |
no other identifier (except one produced by passing the first to other identifier (except one produced by passing the first to |
`renamed-identifier') may denote that variable. If an identifier 'renamed-identifier') may denote that variable. If an identifier |
returned by `gentemp' is inserted free, then it will denote the returned by 'gentemp' is inserted free, then it will denote the |
top-level value bound to its parent, the symbol named "An unlikely top-level value bound to its parent, the symbol named "An unlikely
variable". This behavior, of course, is meant to be put to good use: variable". This behavior, of course, is meant to be put to good use:
(define top-level-foo (define top-level-foo
(procedure->memoizing-macro (procedure->memoizing-macro
(lambda (exp env) (lambda (exp env)
(renamed-identifier 'foo #f)))) (renamed-identifier 'foo #f))))
Defines a macro which may always be used to refer to the top-level Defines a macro which may always be used to refer to the top-level
binding of `foo'. binding of 'foo'. |
(define foo 'top-level) (define foo 'top-level)
(let ((foo 'local)) (let ((foo 'local))
(top-level-foo)) => top-level (top-level-foo)) => top-level
In other words, we can avoid capturing `foo'. In other words, we can avoid capturing 'foo'. |
If a lexical environment is passed as the second argument to If a lexical environment is passed as the second argument to
`renamed-identifier' then if the identifier is inserted free its parent 'renamed-identifier' then if the identifier is inserted free its parent |
will be looked up in that environment, rather than in the top-level will be looked up in that environment, rather than in the top-level
environment. The use of such an identifier _must_ be restricted to the environment. The use of such an identifier _must_ be restricted to the
lexical scope of its environment. lexical scope of its environment.
There is another restriction imposed for implementation convenience: There is another restriction imposed for implementation convenience:
Macros passing their lexical environments to `renamed-identifier' may Macros passing their lexical environments to 'renamed-identifier' may be |
be lexically bound only by the special forms `let-syntax' or lexically bound only by the special forms 'let-syntax' or |
`letrec-syntax'. No error is signaled if this restriction is not met, 'letrec-syntax'. No error is signaled if this restriction is not met, |
but synthetic identifier lookup will not work properly. but synthetic identifier lookup will not work properly.
In order to maintain referential transparency it is necessary to In order to maintain referential transparency it is necessary to
determine whether two identifiers have the same denotation. With determine whether two identifiers have the same denotation. With
synthetic identifiers it is not necessary that two identifiers be `eq?' synthetic identifiers it is not necessary that two identifiers be 'eq?' |
in order to denote the same binding. in order to denote the same binding.
-- Function: identifier-equal? id1 id2 env -- Function: identifier-equal? id1 id2 env
Returns `#t' if identifiers ID1 and ID2 denote the same binding in Returns '#t' if identifiers ID1 and ID2 denote the same binding in |
lexical environment ENV, and `#f' otherwise. ENV must either be a lexical environment ENV, and '#f' otherwise. ENV must either be a |
lexical environment passed to a macro transformer during macro lexical environment passed to a macro transformer during macro
expansion or the empty list. expansion or the empty list.
For example, For example,
(define top-level-foo? (define top-level-foo?
(procedure->memoizing-macro (procedure->memoizing-macro
(let ((foo-name (renamed-identifier 'foo #f))) (let ((foo-name (renamed-identifier 'foo #f)))
(lambda (exp env) (lambda (exp env)
(identifier-equal? (cadr exp) foo-name env))))) (identifier-equal? (cadr exp) foo-name env)))))
(top-level-foo? foo) => #t (top-level-foo? foo) => #t
(let ((foo 'local)) (let ((foo 'local))
(top-level-foo? foo)) => #f (top-level-foo? foo)) => #f
-- Function: @macroexpand1 expr env -- Function: @macroexpand1 expr env
If the `car' of EXPR denotes a macro in ENV, then if that macro is If the 'car' of EXPR denotes a macro in ENV, then if that macro is |
a primitive, EXPR will be returned, if the macro was defined in a primitive, EXPR will be returned, if the macro was defined in
Scheme, then a macro expansion will be returned. If the `car' of Scheme, then a macro expansion will be returned. If the 'car' of |
EXPR does not denote a macro, the `#f' is returned. EXPR does not denote a macro, the '#f' is returned. |
-- Function: extended-environment names values env -- Function: extended-environment names values env
Returns a new environment object, equivalent to ENV, which must Returns a new environment object, equivalent to ENV, which must
either be an environment object or null, extended by one frame. either be an environment object or null, extended by one frame.
NAMES must be an identifier, or an improper list of identifiers, NAMES must be an identifier, or an improper list of identifiers,
usable as a formals list in a `lambda' expression. VALUES must be usable as a formals list in a 'lambda' expression. VALUES must be |
a list of objects long enough to provide a binding for each of the a list of objects long enough to provide a binding for each of the
identifiers in NAMES. If NAMES is an identifier or an improper identifiers in NAMES. If NAMES is an identifier or an improper
list then VALS may be, respectively, any object or an improper list then VALS may be, respectively, any object or an improper list |
list of objects. of objects. |
-- Special Form: syntax-quote obj -- Special Form: syntax-quote obj
Synthetic identifiers are converted to their parent symbols by Synthetic identifiers are converted to their parent symbols by
`quote' and `quasiquote' so that literal data in macro definitions 'quote' and 'quasiquote' so that literal data in macro definitions |
will be properly transcribed. `syntax-quote' behaves like will be properly transcribed. 'syntax-quote' behaves like 'quote', |
`quote', but preserves synthetic identifier intact. but preserves synthetic identifier intact. |
-- Special Form: the-macro mac -- Special Form: the-macro mac
`the-macro' is the simplest of all possible macro transformers: 'the-macro' is the simplest of all possible macro transformers: MAC |
MAC may be a syntactic keyword (macro name) or an expression may be a syntactic keyword (macro name) or an expression evaluating |
evaluating to a macro, otherwise an error is signaled. MAC is to a macro, otherwise an error is signaled. MAC is evaluated and |
evaluated and returned once only, after which the same memoizied returned once only, after which the same memoizied value is |
value is returned. returned. |
`the-macro' may be used to protect local copies of macros against 'the-macro' may be used to protect local copies of macros against |
redefinition, for example: redefinition, for example:
(@let-syntax ((let (the-macro let))) (@let-syntax ((let (the-macro let)))
;; code that will continue to work even if LET is redefined. ;; code that will continue to work even if LET is redefined.
...) ...)
-- Special Form: renaming-transformer proc -- Special Form: renaming-transformer proc
A low-level "explicit renaming" macro facility very similar to that A low-level "explicit renaming" macro facility very similar to that
proposed by W. Clinger [Exrename] is supported. Syntax may be proposed by W. Clinger [Exrename] is supported. Syntax may be
defined in `define-syntax', `let-syntax', and `letrec-syntax' defined in 'define-syntax', 'let-syntax', and 'letrec-syntax' using |
using `renaming-transformer' instead of `syntax-rules'. PROC 'renaming-transformer' instead of 'syntax-rules'. PROC should |
should evaluate to a procedure accepting three arguments: EXPR, evaluate to a procedure accepting three arguments: EXPR, RENAME, |
RENAME, and COMPARE. EXPR is a representation of Scheme code to and COMPARE. EXPR is a representation of Scheme code to be |
be expanded, as list structure. RENAME is a procedure accepting expanded, as list structure. RENAME is a procedure accepting an |
an identifier and returning an identifier renamed in the identifier and returning an identifier renamed in the definition |
definition environment of the new syntax. COMPARE accepts two environment of the new syntax. COMPARE accepts two identifiers and |
identifiers and returns true if and only if both denote the same returns true if and only if both denote the same binding in the |
binding in the usage environment of the new syntax. usage environment of the new syntax. |
 
File: scm-5f2.info, Node: Packages, Next: The Implementation, Prev: The Langu age, Up: Top File: scm-5f3.info, Node: Packages, Next: The Implementation, Prev: The Langu age, Up: Top
| |
5 Packages 5 Packages
********** **********
* Menu: * Menu:
* Dynamic Linking:: * Dynamic Linking::
* Dump:: Create Fast-Booting Executables * Dump:: Create Fast-Booting Executables
* Numeric:: Numeric Language Extensions * Numeric:: Numeric Language Extensions
* Arrays:: As in APL * Arrays:: As in APL
skipping to change at line 4178 skipping to change at line 4063
* Curses:: Screen Control * Curses:: Screen Control
* Sockets:: Cruise the Net * Sockets:: Cruise the Net
* SCMDB:: interface to MySQL * SCMDB:: interface to MySQL
* Menu: * Menu:
* Xlib: (Xlibscm). X Window Graphics. * Xlib: (Xlibscm). X Window Graphics.
* Hobbit: (hobbit). Scheme-to-C Compiler * Hobbit: (hobbit). Scheme-to-C Compiler
 
File: scm-5f2.info, Node: Dynamic Linking, Next: Dump, Prev: Packages, Up: P ackages File: scm-5f3.info, Node: Dynamic Linking, Next: Dump, Prev: Packages, Up: P ackages
| |
5.1 Dynamic Linking 5.1 Dynamic Linking
=================== ===================
If SCM has been compiled with `dynl.c' then the additional properties If SCM has been compiled with 'dynl.c' then the additional properties of |
of load and ([SLIB]) require specified here are supported. The load and ([SLIB]) require specified here are supported. The 'require' |
`require' form is preferred. form is preferred. |
-- Function: require feature -- Function: require feature
If the symbol FEATURE has not already been given as an argument to If the symbol FEATURE has not already been given as an argument to
`require', then the object and library files associated with 'require', then the object and library files associated with |
FEATURE will be dynamically-linked, and an unspecified value FEATURE will be dynamically-linked, and an unspecified value
returned. If FEATURE is not found in `*catalog*', then an error returned. If FEATURE is not found in '*catalog*', then an error is |
is signaled. signaled. |
-- Function: usr:lib lib -- Function: usr:lib lib
Returns the pathname of the C library named LIB. For example: Returns the pathname of the C library named LIB. For example:
`(usr:lib "m")' returns `"/usr/lib/libm.a"', the path of the C '(usr:lib "m")' returns '"/usr/lib/libm.a"', the path of the C math |
math library. library. |
-- Function: x:lib lib -- Function: x:lib lib
Returns the pathname of the X library named LIB. For example: Returns the pathname of the X library named LIB. For example:
`(x:lib "X11")' returns `"/usr/X11/lib/libX11.sa"', the path of '(x:lib "X11")' returns '"/usr/X11/lib/libX11.sa"', the path of the |
the X11 library. X11 library. |
-- Function: load filename lib1 ... -- Function: load filename lib1 ...
In addition to the [R5RS] requirement of loading Scheme In addition to the [R5RS] requirement of loading Scheme expressions |
expressions if FILENAME is a Scheme source file, `load' will also if FILENAME is a Scheme source file, 'load' will also dynamically |
dynamically load/link object files (produced by `compile-file', for load/link object files (produced by 'compile-file', for instance). |
instance). The object-suffix need not be given to load. For The object-suffix need not be given to load. For example, |
example,
(load (in-vicinity (implementation-vicinity) "sc2")) (load (in-vicinity (implementation-vicinity) "sc2"))
or (load (in-vicinity (implementation-vicinity) "sc2.o")) or (load (in-vicinity (implementation-vicinity) "sc2.o"))
or (require 'rev2-procedures) or (require 'rev2-procedures)
or (require 'rev3-procedures) or (require 'rev3-procedures)
will load/link `sc2.o' if it exists. will load/link 'sc2.o' if it exists. |
The LIB1 ... pathnames specify additional libraries which may be The LIB1 ... pathnames specify additional libraries which may be
needed for object files not produced by the Hobbit compiler. For needed for object files not produced by the Hobbit compiler. For
instance, crs is linked on GNU/Linux by instance, crs is linked on GNU/Linux by
(load (in-vicinity (implementation-vicinity) "crs.o") (load (in-vicinity (implementation-vicinity) "crs.o")
(usr:lib "ncurses") (usr:lib "c")) (usr:lib "ncurses") (usr:lib "c"))
or (require 'curses) or (require 'curses)
Turtlegr graphics library is linked by: Turtlegr graphics library is linked by:
(load (in-vicinity (implementation-vicinity) "turtlegr") (load (in-vicinity (implementation-vicinity) "turtlegr")
(usr:lib "X11") (usr:lib "c") (usr:lib "m")) (usr:lib "X11") (usr:lib "c") (usr:lib "m"))
or (require 'turtle-graphics) or (require 'turtle-graphics)
And the string regular expression (*note Regular Expression And the string regular expression (*note Regular Expression Pattern |
Pattern Matching::) package is linked by: Matching::) package is linked by: |
(load (in-vicinity (implementation-vicinity) "rgx") (usr:lib "c")) (load (in-vicinity (implementation-vicinity) "rgx") (usr:lib "c"))
or or
(require 'regex) (require 'regex)
The following functions comprise the low-level Scheme interface to The following functions comprise the low-level Scheme interface to
dynamic linking. See the file `Link.scm' in the SCM distribution for dynamic linking. See the file 'Link.scm' in the SCM distribution for an |
an example of their use. example of their use. |
-- Function: dyn:link filename -- Function: dyn:link filename
FILENAME should be a string naming an "object" or "archive" file, FILENAME should be a string naming an "object" or "archive" file,
the result of C-compiling. The `dyn:link' procedure links and the result of C-compiling. The 'dyn:link' procedure links and |
loads FILENAME into the current SCM session. If successfull, loads FILENAME into the current SCM session. If successfull,
`dyn:link' returns a "link-token" suitable for passing as the 'dyn:link' returns a "link-token" suitable for passing as the |
second argument to `dyn:call'. If not successful, `#f' is second argument to 'dyn:call'. If not successful, '#f' is |
returned. returned.
-- Function: dyn:call name link-token -- Function: dyn:call name link-token
LINK-TOKEN should be the value returned by a call to `dyn:link'. LINK-TOKEN should be the value returned by a call to 'dyn:link'. |
NAME should be the name of C function of no arguments defined in NAME should be the name of C function of no arguments defined in
the file named FILENAME which was succesfully `dyn:link'ed in the the file named FILENAME which was succesfully 'dyn:link'ed in the |
current SCM session. The `dyn:call' procedure calls the C current SCM session. The 'dyn:call' procedure calls the C function |
function corresponding to NAME. If successful, `dyn:call' returns corresponding to NAME. If successful, 'dyn:call' returns '#t'; If |
`#t'; If not successful, `#f' is returned. not successful, '#f' is returned. |
`dyn:call' is used to call the "init_..." function after loading 'dyn:call' is used to call the "init_..." function after loading |
SCM object files. The init_... function then makes the SCM object files. The init_... function then makes the identifiers |
identifiers defined in the file accessible as Scheme procedures. defined in the file accessible as Scheme procedures. |
-- Function: dyn:main-call name link-token arg1 ... -- Function: dyn:main-call name link-token arg1 ...
LINK-TOKEN should be the value returned by a call to `dyn:link'. LINK-TOKEN should be the value returned by a call to 'dyn:link'. |
NAME should be the name of C function of 2 arguments, `(int argc, NAME should be the name of C function of 2 arguments, '(int argc, |
const char **argv)', defined in the file named FILENAME which was const char **argv)', defined in the file named FILENAME which was
succesfully `dyn:link'ed in the current SCM session. The succesfully 'dyn:link'ed in the current SCM session. The |
`dyn:main-call' procedure calls the C function corresponding to 'dyn:main-call' procedure calls the C function corresponding to |
NAME with `argv' style arguments, such as are given to C `main' NAME with 'argv' style arguments, such as are given to C 'main' |
functions. If successful, `dyn:main-call' returns the integer functions. If successful, 'dyn:main-call' returns the integer |
returned from the call to NAME. returned from the call to NAME.
`dyn:main-call' can be used to call a `main' procedure from SCM. 'dyn:main-call' can be used to call a 'main' procedure from SCM. |
For example, I link in and `dyn:main-call' a large C program, the For example, I link in and 'dyn:main-call' a large C program, the |
low level routines of which callback (*note Callbacks::) into SCM low level routines of which callback (*note Callbacks::) into SCM
(which emulates PCI hardware). (which emulates PCI hardware).
-- Function: dyn:unlink link-token -- Function: dyn:unlink link-token
LINK-TOKEN should be the value returned by a call to `dyn:link'. LINK-TOKEN should be the value returned by a call to 'dyn:link'. |
The `dyn:unlink' procedure removes the previously loaded file from The 'dyn:unlink' procedure removes the previously loaded file from |
the current SCM session. If successful, `dyn:unlink' returns the current SCM session. If successful, 'dyn:unlink' returns '#t'; |
`#t'; If not successful, `#f' is returned. If not successful, '#f' is returned. |
 
File: scm-5f2.info, Node: Dump, Next: Numeric, Prev: Dynamic Linking, Up: Pa ckages File: scm-5f3.info, Node: Dump, Next: Numeric, Prev: Dynamic Linking, Up: Pa ckages
| |
5.2 Dump 5.2 Dump
======== ========
"Dump", (also known as "unexec"), saves the continuation of an entire "Dump", (also known as "unexec"), saves the continuation of an entire
SCM session to an executable file, which can then be invoked as a SCM session to an executable file, which can then be invoked as a
program. Dumped executables start very quickly, since no Scheme code program. Dumped executables start very quickly, since no Scheme code
has to be loaded. has to be loaded.
There are constraints on which sessions are savable using `dump' There are constraints on which sessions are savable using 'dump' |
* Saved continuations are invalid in subsequent invocations; they * Saved continuations are invalid in subsequent invocations; they
cause segmentation faults and other unpleasant side effects. cause segmentation faults and other unpleasant side effects.
* Although DLD (*note Dynamic Linking::) can be used to load compiled * Although DLD (*note Dynamic Linking::) can be used to load compiled
modules both before and after dumping, `SUN_DL' ELF systems can modules both before and after dumping, 'SUN_DL' ELF systems can |
load compiled modules only after dumping. This can be worked load compiled modules only after dumping. This can be worked
around by compiling in those features you wish to `dump'. around by compiling in those features you wish to 'dump'. |
* Ports (other than 'current-input-port', 'current-output-port', |
* Ports (other than `current-input-port', `current-output-port', 'current-error-port'), X windows, etc. are invalid in subsequent |
`current-error-port'), X windows, etc. are invalid in subsequent
invocations. invocations.
This restriction could be removed; *Note Improvements To Make::. This restriction could be removed; *Note Improvements To Make::.
* 'Dump' should only be called from a loading file when the call to |
* `Dump' should only be called from a loading file when the call to
dump is the last expression in that file. dump is the last expression in that file.
* 'Dump' can be called from the command line. |
* `Dump' can be called from the command line.
-- Function: dump newpath -- Function: dump newpath
-- Function: dump newpath #f -- Function: dump newpath #f
-- Function: dump newpath #t -- Function: dump newpath #t
-- Function: dump newpath thunk -- Function: dump newpath thunk
* Calls `gc'. * Calls 'gc'. |
* Creates an executable program named NEWPATH which continues * Creates an executable program named NEWPATH which continues
the state of the current SCM session when invoked. The the state of the current SCM session when invoked. The
optional argument THUNK, if provided, should be a procedure optional argument THUNK, if provided, should be a procedure of |
of no arguments; BOOT-TAIL will be set to this procedure, no arguments; BOOT-TAIL will be set to this procedure, causing |
causing it to be called in the restored executable. it to be called in the restored executable. |
If the optional argument is missing or a boolean, SCM's If the optional argument is missing or a boolean, SCM's
standard command line processing will be called in the standard command line processing will be called in the
restored executable. restored executable.
If the second argument to `dump' is `#t', argument processing If the second argument to 'dump' is '#t', argument processing |
will continue from the command line passed to the dumping will continue from the command line passed to the dumping
session. If the second argument is missing or `#f' then the session. If the second argument is missing or '#f' then the |
command line arguments of the restoring invocation will be command line arguments of the restoring invocation will be
processed. processed.
* Resumes the top level Read-Eval-Print loop. This is done * Resumes the top level Read-Eval-Print loop. This is done
instead of continuing normally to avoid creating a saved instead of continuing normally to avoid creating a saved
continuation in the dumped executable. continuation in the dumped executable.
`dump' may set the values of `boot-tail', `*argv*', `restart', and 'dump' may set the values of 'boot-tail', '*argv*', 'restart', and |
*INTERACTIVE*. `dump' returns an unspecified value. *INTERACTIVE*. 'dump' returns an unspecified value. |
When a dumped executable is invoked, the variable *INTERACTIVE* (*note When a dumped executable is invoked, the variable *INTERACTIVE* (*note
Internal State::) has the value it possessed when `dump' created it. Internal State::) has the value it possessed when 'dump' created it. |
Calling `dump' with a single argument sets *INTERACTIVE* to `#f', which Calling 'dump' with a single argument sets *INTERACTIVE* to '#f', which |
is the state it has at the beginning of command line processing. is the state it has at the beginning of command line processing.
The procedure `program-arguments' returns the command line arguments The procedure 'program-arguments' returns the command line arguments for |
for the curent invocation. More specifically, `program-arguments' for the curent invocation. More specifically, 'program-arguments' for the |
the restored session are _not_ saved from the dumping session. Command restored session are _not_ saved from the dumping session. Command line |
line processing is done on the value of the identifier `*argv*'. processing is done on the value of the identifier '*argv*'. |
The following example shows how to create `rscm', which is like regular The following example shows how to create 'rscm', which is like regular |
scm, but which loads faster and has the `random' package alreadly scm, but which loads faster and has the 'random' package alreadly |
provided. provided.
bash$ scm -rrandom bash$ scm -rrandom
> (dump "rscm") > (dump "rscm")
#<unspecified> #<unspecified>
> (quit) > (quit)
bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)" bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)"
00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 00003 14159 26535 89793 23846 26433 83279 50288 41971 69399
37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211
70679 82148 08651 32823 06647 09384 46095 50582 23172 53594 70679 82148 08651 32823 06647 09384 46095 50582 23172 53594
08128 48111 74502 84102 70193 85211 05559 64462 29489 08128 48111 74502 84102 70193 85211 05559 64462 29489
bash$ bash$
This task can also be accomplished using the `-o' command line option This task can also be accomplished using the '-o' command line option |
(*note SCM Options::). (*note SCM Options::).
bash$ scm -rrandom -o rscm bash$ scm -rrandom -o rscm
> (quit) > (quit)
bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)" bash$ ./rscm -lpi.scm -e"(pi (random 200) 5)"
00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 00003 14159 26535 89793 23846 26433 83279 50288 41971 69399
37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211
70679 82148 08651 32823 06647 09384 46095 50582 23172 53594 70679 82148 08651 32823 06647 09384 46095 50582 23172 53594
08128 48111 74502 84102 70193 85211 05559 64462 29489 08128 48111 74502 84102 70193 85211 05559 64462 29489
bash$ bash$
 
File: scm-5f2.info, Node: Numeric, Next: Arrays, Prev: Dump, Up: Packages File: scm-5f3.info, Node: Numeric, Next: Arrays, Prev: Dump, Up: Packages
| |
5.3 Numeric 5.3 Numeric
=========== ===========
-- Constant: most-positive-fixnum -- Constant: most-positive-fixnum
The immediate integer closest to positive infinity. *Note The immediate integer closest to positive infinity. *Note
Configuration: (slib)Configuration. (slib)Configuration::. |
-- Constant: most-negative-fixnum -- Constant: most-negative-fixnum
The immediate integer closest to negative infinity. The immediate integer closest to negative infinity.
-- Constant: $pi -- Constant: $pi
-- Constant: pi -- Constant: pi
The ratio of the circumference to the diameter of a circle. The ratio of the circumference to the diameter of a circle.
These procedures are in addition to those in *Note Irrational Integer These procedures are in addition to those in *Note (slib)Irrational
Functions: (slib)Irrational Integer Functions. | Integer Functions::. |
| |
-- Function: exact-round x | -- Function: exact-round x |
-- Function: exact-floor x | -- Function: exact-floor x |
-- Function: exact-ceiling x | -- Function: exact-ceiling x |
-- Function: exact-truncate x | -- Function: exact-truncate x |
Return exact integers. | Return exact integers. |
| |
These procedures augment the standard capabilities in *note Numerical These procedures augment the standard capabilities in *note |
operations: (r5rs)Numerical operations. Many are from *Note Irrational (r5rs)Numerical operations::. Many are from *Note (slib)Irrational Real
Real Functions: (slib)Irrational Real Functions. | Functions::. |
-- Function: pi* z -- Function: pi* z
`(* pi Z)' '(* pi Z)' |
-- Function: pi/ z -- Function: pi/ z
`(/ pi Z)' '(/ pi Z)' |
-- Function: sinh z -- Function: sinh z
-- Function: cosh z -- Function: cosh z
-- Function: tanh z -- Function: tanh z
Return the hyperbolic sine, cosine, and tangent of Z Return the hyperbolic sine, cosine, and tangent of Z
-- Function: asinh z -- Function: asinh z
-- Function: acosh z -- Function: acosh z
-- Function: atanh z -- Function: atanh z
Return the inverse hyperbolic sine, cosine, and tangent of Z Return the inverse hyperbolic sine, cosine, and tangent of Z
skipping to change at line 4438 skipping to change at line 4316
-- Function: real-sqrt x -- Function: real-sqrt x
-- Function: real-exp x -- Function: real-exp x
-- Function: real-ln x -- Function: real-ln x
-- Function: real-sin x -- Function: real-sin x
-- Function: real-cos x -- Function: real-cos x
-- Function: real-tan x -- Function: real-tan x
-- Function: real-asin x -- Function: real-asin x
-- Function: real-acos x -- Function: real-acos x
-- Function: real-atan x -- Function: real-atan x
-- Function: atan y x | -- Function: atan y x |
|
-- Function: real-sinh x -- Function: real-sinh x
-- Function: real-cosh x -- Function: real-cosh x
-- Function: real-tanh x -- Function: real-tanh x
-- Function: real-asinh x -- Function: real-asinh x
-- Function: real-acosh x -- Function: real-acosh x
-- Function: real-atanh x -- Function: real-atanh x
Real-only versions of these popular functions. The argument X Real-only versions of these popular functions. The argument X must |
must be a real number. It is an error if the value which should be be a real number. It is an error if the value which should be |
returned by a call to these procedures is _not_ real. returned by a call to these procedures is _not_ real.
-- Function: real-log10 x -- Function: real-log10 x
Real-only base 10 logarithm. Real-only base 10 logarithm.
-- Function: $atan2 y x -- Function: $atan2 y x
Computes `(angle (make-rectangular x y))' for real numbers Y and X. Computes '(angle (make-rectangular x y))' for real numbers Y and X. |
-- Function: real-expt x1 x2 -- Function: real-expt x1 x2
Returns real number X1 raised to the real power X2. It is an Returns real number X1 raised to the real power X2. It is an error |
error if the value which should be returned by a call to if the value which should be returned by a call to 'real-expt' is |
`real-expt' is not real. not real. |
|
-- Function: infinite? z | -- Function: infinite? z |
-- Function: finite? z | -- Function: finite? z |
All IEEE-754 numbers except positive and negative infinity and NaN | All IEEE-754 numbers except positive and negative infinity and NaN |
(non-a-number) are finite. | (non-a-number) are finite. |
|
 
File: scm-5f2.info, Node: Arrays, Next: Records, Prev: Numeric, Up: Packages File: scm-5f3.info, Node: Arrays, Next: Records, Prev: Numeric, Up: Packages
| |
5.4 Arrays 5.4 Arrays
========== ==========
* Menu: * Menu:
* Conventional Arrays:: * Conventional Arrays::
* Uniform Array:: * Uniform Array::
* Bit Vectors:: * Bit Vectors::
* Array Mapping:: array-for-each * Array Mapping:: array-for-each
 
File: scm-5f2.info, Node: Conventional Arrays, Next: Uniform Array, Prev: Arr ays, Up: Arrays File: scm-5f3.info, Node: Conventional Arrays, Next: Uniform Array, Prev: Arr ays, Up: Arrays
| |
5.4.1 Conventional Arrays 5.4.1 Conventional Arrays
------------------------- -------------------------
The following syntax and procedures are SCM extensions to feature The following syntax and procedures are SCM extensions to feature
`array' in *note Arrays: (slib)Arrays. 'array' in *note (slib)Arrays::. |
"Arrays" read and write as a `#' followed by the "rank" (number of "Arrays" read and write as a '#' followed by the "rank" (number of |
dimensions) followed by the character #\a or #\A and what appear as dimensions) followed by the character #\a or #\A and what appear as
lists (of lists) of elements. The lists must be nested to the depth of lists (of lists) of elements. The lists must be nested to the depth of
the rank. For each depth, all lists must be the same length. the rank. For each depth, all lists must be the same length.
(make-array '#(ho) 4 3) => (make-array '#(ho) 4 3) =>
#2A((ho ho ho) (ho ho ho) (ho ho ho) (ho ho ho)) #2A((ho ho ho) (ho ho ho) (ho ho ho) (ho ho ho))
Unshared, conventional (not uniform) 0-based arrays of rank 1 are Unshared, conventional (not uniform) 0-based arrays of rank 1 are
equivalent to (and can't be distinguished from) scheme vectors. equivalent to (and can't be distinguished from) scheme vectors.
(make-array '#(ho) 3) => #(ho ho ho) (make-array '#(ho) 3) => #(ho ho ho)
-- Function: transpose-array array dim0 dim1 ... -- Function: transpose-array array dim0 dim1 ...
Returns an array sharing contents with ARRAY, but with dimensions Returns an array sharing contents with ARRAY, but with dimensions
arranged in a different order. There must be one DIM argument for arranged in a different order. There must be one DIM argument for
each dimension of ARRAY. DIM0, DIM1, ... should be integers each dimension of ARRAY. DIM0, DIM1, ... should be integers
between 0 and the rank of the array to be returned. Each integer between 0 and the rank of the array to be returned. Each integer
in that range must appear at least once in the argument list. in that range must appear at least once in the argument list.
The values of DIM0, DIM1, ... correspond to dimensions in the The values of DIM0, DIM1, ... correspond to dimensions in the array |
array to be returned, their positions in the argument list to to be returned, their positions in the argument list to dimensions |
dimensions of ARRAY. Several DIMs may have the same value, in of ARRAY. Several DIMs may have the same value, in which case the |
which case the returned array will have smaller rank than ARRAY. returned array will have smaller rank than ARRAY. |
examples: examples:
(transpose-array '#2A((a b) (c d)) 1 0) => #2A((a c) (b d)) (transpose-array '#2A((a b) (c d)) 1 0) => #2A((a c) (b d))
(transpose-array '#2A((a b) (c d)) 0 0) => #1A(a d) (transpose-array '#2A((a b) (c d)) 0 0) => #1A(a d)
(transpose-array '#3A(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) => (transpose-array '#3A(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 1 0) =>
#2A((a 4) (b 5) (c 6)) #2A((a 4) (b 5) (c 6))
-- Function: enclose-array array dim0 dim1 ... -- Function: enclose-array array dim0 dim1 ...
DIM0, DIM1 ... should be nonnegative integers less than the rank DIM0, DIM1 ... should be nonnegative integers less than the rank of |
of ARRAY. ENCLOSE-ARRAY returns an array resembling an array of ARRAY. ENCLOSE-ARRAY returns an array resembling an array of |
shared arrays. The dimensions of each shared array are the same shared arrays. The dimensions of each shared array are the same as |
as the DIMth dimensions of the original array, the dimensions of the DIMth dimensions of the original array, the dimensions of the |
the outer array are the same as those of the original array that outer array are the same as those of the original array that did |
did not match a DIM. not match a DIM. |
An enclosed array is not a general Scheme array. Its elements may An enclosed array is not a general Scheme array. Its elements may
not be set using `array-set!'. Two references to the same element not be set using 'array-set!'. Two references to the same element |
of an enclosed array will be `equal?' but will not in general be of an enclosed array will be 'equal?' but will not in general be |
`eq?'. The value returned by ARRAY-PROTOTYPE when given an 'eq?'. The value returned by ARRAY-PROTOTYPE when given an |
enclosed array is unspecified. enclosed array is unspecified.
examples: examples:
(enclose-array '#3A(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1) => (enclose-array '#3A(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1) =>
#<enclosed-array (#1A(a d) #1A(b e) #1A(c f)) (#1A(1 4) #1A(2 5) #1A(3 6))> #<enclosed-array (#1A(a d) #1A(b e) #1A(c f)) (#1A(1 4) #1A(2 5) #1A(3 6))>
(enclose-array '#3A(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 0) => (enclose-array '#3A(((a b c) (d e f)) ((1 2 3) (4 5 6))) 1 0) =>
#<enclosed-array #2A((a 1) (d 4)) #2A((b 2) (e 5)) #2A((c 3) (f 6))> #<enclosed-array #2A((a 1) (d 4)) #2A((b 2) (e 5)) #2A((c 3) (f 6))>
-- Function: array->list array -- Function: array->list array
Returns a list consisting of all the elements, in order, of ARRAY. Returns a list consisting of all the elements, in order, of ARRAY.
In the case of a rank-0 array, returns the single element. In the case of a rank-0 array, returns the single element.
-- Function: array-contents array -- Function: array-contents array
-- Function: array-contents array strict -- Function: array-contents array strict
If ARRAY may be "unrolled" into a one dimensional shared array If ARRAY may be "unrolled" into a one dimensional shared array
without changing their order (last subscript changing fastest), without changing their order (last subscript changing fastest),
then `array-contents' returns that shared array, otherwise it then 'array-contents' returns that shared array, otherwise it |
returns `#f'. All arrays made by MAKE-ARRAY may be unrolled, some returns '#f'. All arrays made by MAKE-ARRAY may be unrolled, some |
arrays made by MAKE-SHARED-ARRAY may not be. arrays made by MAKE-SHARED-ARRAY may not be.
If the optional argument STRICT is provided, a shared array will If the optional argument STRICT is provided, a shared array will be |
be returned only if its elements are stored internally contiguous returned only if its elements are stored internally contiguous in |
in memory. memory. |
 
File: scm-5f2.info, Node: Uniform Array, Next: Bit Vectors, Prev: Conventiona l Arrays, Up: Arrays File: scm-5f3.info, Node: Uniform Array, Next: Bit Vectors, Prev: Conventiona l Arrays, Up: Arrays
| |
5.4.2 Uniform Array 5.4.2 Uniform Array
------------------- -------------------
"Uniform Arrays" and vectors are arrays whose elements are all of the "Uniform Arrays" and vectors are arrays whose elements are all of the
same type. Uniform vectors occupy less storage than conventional same type. Uniform vectors occupy less storage than conventional
vectors. Uniform Array procedures also work on vectors, vectors. Uniform Array procedures also work on vectors,
uniform-vectors, bit-vectors, and strings. uniform-vectors, bit-vectors, and strings.
SLIB now supports uniform arrys. The primary array creation procedure SLIB now supports uniform arrys. The primary array creation procedure
is `make-array', detailed in *Note Arrays: (slib)Arrays. is 'make-array', detailed in *Note (slib)Arrays::. |
Unshared uniform character 0-based arrays of rank 1 (dimension) are Unshared uniform character 0-based arrays of rank 1 (dimension) are
equivalent to (and can't be distinguished from) strings. equivalent to (and can't be distinguished from) strings.
(make-array "" 3) => "$q2" (make-array "" 3) => "$q2"
Unshared uniform boolean 0-based arrays of rank 1 (dimension) are Unshared uniform boolean 0-based arrays of rank 1 (dimension) are
equivalent to (and can't be distinguished from) *note bit-vectors: Bit equivalent to (and can't be distinguished from) *note bit-vectors: Bit
Vectors. Vectors.
(make-array '#1at() 3) => #*000 (make-array '#1at() 3) => #*000
== ==
skipping to change at line 4595 skipping to change at line 4474
64.0 double (double precision) #A:floR64b 64.0 double (double precision) #A:floR64b
32.0 float (single precision) #A:floR32b 32.0 float (single precision) #A:floR32b
32 unsigned integer (32-bit) #A:fixN32b 32 unsigned integer (32-bit) #A:fixN32b
-32 signed integer (32-bit) #A:fixZ32b -32 signed integer (32-bit) #A:fixZ32b
-16 signed integer (16-bit) #A:fixZ16b -16 signed integer (16-bit) #A:fixZ16b
#\a char (string) #A:char #\a char (string) #A:char
#t boolean (bit-vector) #A:bool #t boolean (bit-vector) #A:bool
Other uniform vectors are written in a form similar to that of general Other uniform vectors are written in a form similar to that of general
arrays, except that one or more modifying characters are put between the arrays, except that one or more modifying characters are put between the
#\A character and the contents list. For example, `'#1A:fixZ32b(3 5 9)' #\A character and the contents list. For example, ''#1A:fixZ32b(3 5 9)' |
returns a uniform vector of signed integers. returns a uniform vector of signed integers.
-- Function: array? obj prototype -- Function: array? obj prototype
Returns `#t' if the OBJ is an array of type corresponding to Returns '#t' if the OBJ is an array of type corresponding to |
PROTOTYPE, and `#f' if not. PROTOTYPE, and '#f' if not. |
-- Function: array-prototype array -- Function: array-prototype array
Returns an object that would produce an array of the same type as Returns an object that would produce an array of the same type as
ARRAY, if used as the PROTOTYPE for `list->uniform-array'. ARRAY, if used as the PROTOTYPE for 'list->uniform-array'. |
-- Function: list->uniform-array rank prot lst -- Function: list->uniform-array rank prot lst
Returns a uniform array of the type indicated by prototype PROT Returns a uniform array of the type indicated by prototype PROT
with elements the same as those of LST. Elements must be of the with elements the same as those of LST. Elements must be of the
appropriate type, no coercions are done. appropriate type, no coercions are done.
In, for example, the case of a rank-2 array, LST must be a list of In, for example, the case of a rank-2 array, LST must be a list of
lists, all of the same length. The length of LST will be the lists, all of the same length. The length of LST will be the first |
first dimension of the result array, and the length of each dimension of the result array, and the length of each element the |
element the second dimension. second dimension. |
If RANK is zero, LST, which need not be a list, is the single If RANK is zero, LST, which need not be a list, is the single
element of the returned array. element of the returned array.
-- Function: uniform-array-read! ura -- Function: uniform-array-read! ura
-- Function: uniform-array-read! ura port -- Function: uniform-array-read! ura port
Attempts to read all elements of URA, in lexicographic order, as Attempts to read all elements of URA, in lexicographic order, as
binary objects from PORT. If an end of file is encountered during binary objects from PORT. If an end of file is encountered during
uniform-array-read! the objects up to that point only are put into uniform-array-read! the objects up to that point only are put into
URA (starting at the beginning) and the remainder of the array is URA (starting at the beginning) and the remainder of the array is
unchanged. unchanged.
`uniform-array-read!' returns the number of objects read. PORT 'uniform-array-read!' returns the number of objects read. PORT may |
may be omitted, in which case it defaults to the value returned by be omitted, in which case it defaults to the value returned by |
`(current-input-port)'. '(current-input-port)'. |
-- Function: uniform-array-write ura -- Function: uniform-array-write ura
-- Function: uniform-array-write ura port -- Function: uniform-array-write ura port
Writes all elements of URA as binary objects to PORT. The number Writes all elements of URA as binary objects to PORT. The number
of of objects actually written is returned. PORT may be omitted, of of objects actually written is returned. PORT may be omitted,
in which case it defaults to the value returned by in which case it defaults to the value returned by
`(current-output-port)'. '(current-output-port)'. |
-- Function: logaref array index1 index2 ... -- Function: logaref array index1 index2 ...
If an INDEX is provided for each dimension of ARRAY returns the If an INDEX is provided for each dimension of ARRAY returns the
INDEX1, INDEX2, ...'th element of ARRAY. If one more INDEX is INDEX1, INDEX2, ...'th element of ARRAY. If one more INDEX is
provided, then the last index specifies bit position of the provided, then the last index specifies bit position of the
twos-complement representation of the array element indexed by the twos-complement representation of the array element indexed by the
other INDEXs returning `#t' if the bit is 1, and `#f' if 0. It is other INDEXs returning '#t' if the bit is 1, and '#f' if 0. It is |
an error if this element is not an exact integer. an error if this element is not an exact integer.
(logaref '#(#b1101 #b0010) 0) => #b1101 (logaref '#(#b1101 #b0010) 0) => #b1101
(logaref '#(#b1101 #b0010) 0 1) => #f (logaref '#(#b1101 #b0010) 0 1) => #f
(logaref '#2((#b1101 #b0010)) 0 0) => #b1101 (logaref '#2((#b1101 #b0010)) 0 0) => #b1101
-- Function: logaset! array val index1 index2 ... -- Function: logaset! array val index1 index2 ...
If an INDEX is provided for each dimension of ARRAY sets the If an INDEX is provided for each dimension of ARRAY sets the
INDEX1, INDEX2, ...'th element of ARRAY to VAL. If one more INDEX INDEX1, INDEX2, ...'th element of ARRAY to VAL. If one more INDEX
is provided, then the last index specifies bit position of the is provided, then the last index specifies bit position of the
twos-complement representation of an exact integer array element, twos-complement representation of an exact integer array element,
setting the bit to 1 if VAL is `#t' and to 0 if VAL is `#f'. In setting the bit to 1 if VAL is '#t' and to 0 if VAL is '#f'. In |
this case it is an error if the array element is not an exact this case it is an error if the array element is not an exact
integer or if VAL is not boolean. integer or if VAL is not boolean.
 
File: scm-5f2.info, Node: Bit Vectors, Next: Array Mapping, Prev: Uniform Arr ay, Up: Arrays File: scm-5f3.info, Node: Bit Vectors, Next: Array Mapping, Prev: Uniform Arr ay, Up: Arrays
| |
5.4.3 Bit Vectors 5.4.3 Bit Vectors
----------------- -----------------
Bit vectors can be written and read as a sequence of `0's and `1's Bit vectors can be written and read as a sequence of '0's and '1's |
prefixed by `#*'. prefixed by '#*'. |
#1At(#f #f #f #t #f #t #f) => #*0001010 #1At(#f #f #f #t #f #t #f) => #*0001010
Some of these operations will eventually be generalized to other Some of these operations will eventually be generalized to other
uniform-arrays. uniform-arrays.
-- Function: bit-count bool bv -- Function: bit-count bool bv
Returns the number of occurrences of BOOL in BV. Returns the number of occurrences of BOOL in BV.
-- Function: bit-position bool bv k -- Function: bit-position bool bv k
Returns the minimum index of an occurrence of BOOL in BV which is Returns the minimum index of an occurrence of BOOL in BV which is
at least K. If no BOOL occurs within the specified range `#f' is at least K. If no BOOL occurs within the specified range '#f' is |
returned. returned.
-- Function: bit-invert! bv -- Function: bit-invert! bv
Modifies BV by replacing each element with its negation. Modifies BV by replacing each element with its negation.
-- Function: bit-set*! bv uve bool -- Function: bit-set*! bv uve bool
If UVE is a bit-vector, then BV and UVE must be of the same | If UVE is a bit-vector, then BV and UVE must be of the same length. |
length. If BOOL is `#t', then UVE is OR'ed into BV; If BOOL is | If BOOL is '#t', then UVE is OR'ed into BV; If BOOL is '#f', the |
`#f', the inversion of UVE is AND'ed into BV. | inversion of UVE is AND'ed into BV. |
If UVE is a unsigned integer vector, then all the elements of UVE | If UVE is a unsigned integer vector, then all the elements of UVE |
must be between 0 and the `LENGTH' of BV. The bits of BV | must be between 0 and the 'LENGTH' of BV. The bits of BV |
corresponding to the indexes in UVE are set to BOOL. | corresponding to the indexes in UVE are set to BOOL. |
The return value is unspecified. The return value is unspecified.
-- Function: bit-count* bv uve bool -- Function: bit-count* bv uve bool
Returns Returns
(bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t). (bit-count (bit-set*! (if bool bv (bit-invert! bv)) uve #t) #t).
BV is not modified. BV is not modified.
 
File: scm-5f2.info, Node: Array Mapping, Prev: Bit Vectors, Up: Arrays File: scm-5f3.info, Node: Array Mapping, Prev: Bit Vectors, Up: Arrays
| |
5.4.4 Array Mapping 5.4.4 Array Mapping
------------------- -------------------
`(require 'array-for-each)' '(require 'array-for-each)' |
SCM has some extra functions in feature `array-for-each': SCM has some extra functions in feature 'array-for-each': |
-- Function: array-fill! array fill -- Function: array-fill! array fill
Stores FILL in every element of ARRAY. The value returned is Stores FILL in every element of ARRAY. The value returned is
unspecified. unspecified.
-- Function: serial-array:copy! destination source -- Function: serial-array:copy! destination source
Same as `array:copy!' but guaranteed to copy in row-major order. Same as 'array:copy!' but guaranteed to copy in row-major order. |
-- Function: array-equal? array0 array1 ... -- Function: array-equal? array0 array1 ...
Returns `#t' iff all arguments are arrays with the same shape, the Returns '#t' iff all arguments are arrays with the same shape, the |
same type, and have corresponding elements which are either same type, and have corresponding elements which are either
`equal?' or `array-equal?'. This function differs from `equal?' 'equal?' or 'array-equal?'. This function differs from 'equal?' in |
in that a one dimensional shared array may be ARRAY-EQUAL? but not that a one dimensional shared array may be ARRAY-EQUAL? but not |
EQUAL? to a vector or uniform vector. EQUAL? to a vector or uniform vector.
-- Function: array-map! array0 proc array1 ... -- Function: array-map! array0 proc array1 ...
If ARRAY1, ... are arrays, they must have the same number of If ARRAY1, ... are arrays, they must have the same number of
dimensions as ARRAY0 and have a range for each index which dimensions as ARRAY0 and have a range for each index which includes |
includes the range for the corresponding index in ARRAY0. If they the range for the corresponding index in ARRAY0. If they are |
are scalars, that is, not arrays, vectors, or strings, then they scalars, that is, not arrays, vectors, or strings, then they will |
will be converted internally to arrays of the appropriate shape. be converted internally to arrays of the appropriate shape. PROC |
PROC is applied to each tuple of elements of ARRAY1 ... and the is applied to each tuple of elements of ARRAY1 ... and the result |
result is stored as the corresponding element in ARRAY0. The is stored as the corresponding element in ARRAY0. The value |
value returned is unspecified. The order of application is returned is unspecified. The order of application is unspecified. |
unspecified.
Handling non-array arguments is a SCM extension of *note Handling non-array arguments is a SCM extension of *note
array-map!: (slib)Array Mapping. array-map!: (slib)Array Mapping.
-- Function: serial-array-map! array0 proc array1 ... -- Function: serial-array-map! array0 proc array1 ...
Same as ARRAY-MAP!, but guaranteed to apply PROC in row-major Same as ARRAY-MAP!, but guaranteed to apply PROC in row-major
order. order.
-- Function: array-map prototype proc array1 array2 ... -- Function: array-map prototype proc array1 array2 ...
ARRAY2, ... must have the same number of dimensions as ARRAY1 and ARRAY2, ... must have the same number of dimensions as ARRAY1 and
have a range for each index which includes the range for the have a range for each index which includes the range for the
corresponding index in ARRAY1. PROC is applied to each tuple of corresponding index in ARRAY1. PROC is applied to each tuple of
elements of ARRAY1, ARRAY2, ... and the result is stored as the elements of ARRAY1, ARRAY2, ... and the result is stored as the
corresponding element in a new array of type PROTOTYPE. The new corresponding element in a new array of type PROTOTYPE. The new
array is returned. The order of application is unspecified. array is returned. The order of application is unspecified.
-- Function: scalar->array scalar array prototype -- Function: scalar->array scalar array prototype
-- Function: scalar->array scalar array -- Function: scalar->array scalar array
Returns a uniform array of the same shape as ARRAY, having only Returns a uniform array of the same shape as ARRAY, having only one |
one shared element, which is `eqv?' to SCALAR. If the optional shared element, which is 'eqv?' to SCALAR. If the optional |
argument PROTOTYPE is supplied it will be used as the prototype argument PROTOTYPE is supplied it will be used as the prototype for |
for the returned array. Otherwise the returned array will be of the returned array. Otherwise the returned array will be of the |
the same type as `array' if that is possible, and a conventional same type as 'array' if that is possible, and a conventional array |
array if it is not. This function is used internally by if it is not. This function is used internally by 'array-map!' and |
`array-map!' and friends to handle scalar arguments. friends to handle scalar arguments. |
 
File: scm-5f2.info, Node: Records, Next: I/O-Extensions, Prev: Arrays, Up: P ackages File: scm-5f3.info, Node: Records, Next: I/O-Extensions, Prev: Arrays, Up: P ackages
| |
5.5 Records 5.5 Records
=========== ===========
SCM provides user-definable datatypes with the same interface as SLIB, SCM provides user-definable datatypes with the same interface as SLIB,
see *Note Records: (slib)Records, with the following extension. see *Note (slib)Records::, with the following extension. |
-- Function: record-printer-set! rtd printer -- Function: record-printer-set! rtd printer
Causes records of type RTD to be printed in a user-specified Causes records of type RTD to be printed in a user-specified
format. RTD must be a record type descriptor returned by format. RTD must be a record type descriptor returned by
`make-record-type', PRINTER a procedure accepting three arguments: 'make-record-type', PRINTER a procedure accepting three arguments: |
the record to be printed, the port to print to, and a boolean the record to be printed, the port to print to, and a boolean which |
which is true if the record is being written on behalf of `write' is true if the record is being written on behalf of 'write' and |
and false if for `display'. If PRINTER returns #f, the default false if for 'display'. If PRINTER returns #f, the default record |
record printer will be called. printer will be called. |
A PRINTER value of #f means use the default printer. A PRINTER value of #f means use the default printer.
Only the default printer will be used when printing error messages. Only the default printer will be used when printing error messages.
 
File: scm-5f2.info, Node: I/O-Extensions, Next: Posix Extensions, Prev: Recor ds, Up: Packages File: scm-5f3.info, Node: I/O-Extensions, Next: Posix Extensions, Prev: Recor ds, Up: Packages
| |
5.6 I/O-Extensions 5.6 I/O-Extensions
================== ==================
If `'i/o-extensions' is provided (by linking in `ioext.o'), *note Line If ''i/o-extensions' is provided (by linking in 'ioext.o'), *note |
I/O: (slib)Line I/O, and the following functions are defined: (slib)Line I/O::, and the following functions are defined: |
-- Function: stat <port-or-string> -- Function: stat <port-or-string>
Returns a vector of integers describing the argument. The argument Returns a vector of integers describing the argument. The argument
can be either a string or an open input port. If the argument is can be either a string or an open input port. If the argument is
an open port then the returned vector describes the file to which an open port then the returned vector describes the file to which
the port is opened; If the argument is a string then the returned the port is opened; If the argument is a string then the returned
vector describes the file named by that string. If there exists vector describes the file named by that string. If there exists no |
no file with the name string, or if the file cannot be accessed file with the name string, or if the file cannot be accessed '#f' |
`#f' is returned. The elements of the returned vector are as is returned. The elements of the returned vector are as follows: |
follows:
0 st_dev 0 st_dev
ID of device containing a directory entry for this file ID of device containing a directory entry for this file
1 st_ino
1 st_ino
Inode number Inode number
2 st_mode
2 st_mode
File type, attributes, and access control summary File type, attributes, and access control summary
3 st_nlink
3 st_nlink
Number of links Number of links
4 st_uid
4 st_uid
User ID of file owner User ID of file owner
5 st_gid
5 st_gid
Group ID of file group Group ID of file group
6 st_rdev
6 st_rdev
Device ID; this entry defined only for char or blk spec files Device ID; this entry defined only for char or blk spec files
7 st_size
7 st_size
File size (bytes) File size (bytes)
8 st_atime
8 st_atime
Time of last access Time of last access
9 st_mtime
9 st_mtime
Last modification time Last modification time
10 st_ctime
10 st_ctime
Last file status change time Last file status change time
-- Function: getpid -- Function: getpid
Returns the process ID of the current process. Returns the process ID of the current process.
-- Function: try-create-file name modes perms -- Function: try-create-file name modes perms
If the file with name NAME already exists, return `#f', otherwise If the file with name NAME already exists, return '#f', otherwise |
try to create and open the file like `try-open-file', *Note Files try to create and open the file like 'try-open-file', *Note Files
and Ports::. If the optional integer argument PERMS is provided, and Ports::. If the optional integer argument PERMS is provided,
it is used as the permissions of the new file (modified by the it is used as the permissions of the new file (modified by the
current umask). current umask).
-- Function: reopen-file filename modes port -- Function: reopen-file filename modes port
Closes port PORT and reopens it with FILENAME and MODES. Closes port PORT and reopens it with FILENAME and MODES.
`reopen-file' returns `#t' if successful, `#f' if not. 'reopen-file' returns '#t' if successful, '#f' if not. |
-- Function: duplicate-port port modes -- Function: duplicate-port port modes
Creates and returns a "duplicate" port from PORT. Duplicate Creates and returns a "duplicate" port from PORT. Duplicate
_unbuffered_ ports share one file position. MODES are as for _unbuffered_ ports share one file position. MODES are as for *note |
*note open-file: Files and Ports. open-file: Files and Ports. |
-- Function: redirect-port! from-port to-port -- Function: redirect-port! from-port to-port
Closes TO-PORT and makes TO-PORT be a duplicate of FROM-PORT. Closes TO-PORT and makes TO-PORT be a duplicate of FROM-PORT.
`redirect-port!' returns TO-PORT if successful, `#f' if not. If 'redirect-port!' returns TO-PORT if successful, '#f' if not. If |
unsuccessful, TO-PORT is not closed. unsuccessful, TO-PORT is not closed.
-- Function: opendir dirname -- Function: opendir dirname
Returns a "directory" object corresponding to the file system Returns a "directory" object corresponding to the file system
directory named DIRNAME. If unsuccessful, returns `#f'. directory named DIRNAME. If unsuccessful, returns '#f'. |
-- Function: readdir dir -- Function: readdir dir
Returns the string name of the next entry from the directory DIR. Returns the string name of the next entry from the directory DIR.
If there are no more entries in the directory, `readdir' returns a If there are no more entries in the directory, 'readdir' returns a |
`#f'. '#f'. |
-- Function: rewinddir dir -- Function: rewinddir dir
Reinitializes DIR so that the next call to `readdir' with DIR will Reinitializes DIR so that the next call to 'readdir' with DIR will |
return the first entry in the directory again. return the first entry in the directory again.
-- Function: closedir dir -- Function: closedir dir
Closes DIR and returns `#t'. If DIR is already closed,, Closes DIR and returns '#t'. If DIR is already closed,, 'closedir' |
`closedir' returns a `#f'. returns a '#f'. |
-- Function: directory-for-each proc directory -- Function: directory-for-each proc directory
PROC must be a procedure taking one argument. PROC must be a procedure taking one argument. 'Directory-For-Each' |
`Directory-For-Each' applies PROC to the (string) name of each applies PROC to the (string) name of each file in DIRECTORY. The |
file in DIRECTORY. The dynamic order in which PROC is applied to dynamic order in which PROC is applied to the filenames is |
the filenames is unspecified. The value returned by unspecified. The value returned by 'directory-for-each' is |
`directory-for-each' is unspecified. unspecified. |
-- Function: directory-for-each proc directory pred -- Function: directory-for-each proc directory pred
Applies PROC only to those filenames for which the procedure PRED Applies PROC only to those filenames for which the procedure PRED
returns a non-false value. returns a non-false value.
-- Function: directory-for-each proc directory match -- Function: directory-for-each proc directory match
Applies PROC only to those filenames for which `(filename:match?? Applies PROC only to those filenames for which '(filename:match?? |
MATCH)' would return a non-false value (*note Filenames: MATCH)' would return a non-false value (*note (slib)Filenames::). |
(slib)Filenames.).
(require 'directory) (require 'directory)
(directory-for-each print "." "[A-Z]*.scm") (directory-for-each print "." "[A-Z]*.scm")
-| -|
"Init.scm" "Init.scm"
"Iedline.scm" "Iedline.scm"
"Link.scm" "Link.scm"
"Macro.scm" "Macro.scm"
"Transcen.scm" "Transcen.scm"
"Init5f1.scm" | "Init5f2.scm" |
| |
-- Function: directory*-for-each proc path-glob | -- Function: directory*-for-each proc path-glob |
PATH-GLOB is a pathname whose last component is a (wildcard) | PATH-GLOB is a pathname whose last component is a (wildcard) |
pattern (*note Filenames: (slib)Filenames.). PROC must be a | pattern (*note (slib)Filenames::). PROC must be a procedure taking |
procedure taking one argument. `directory*-for-each' applies PROC | one argument. 'directory*-for-each' applies PROC to the (string) |
to the (string) name of each file in the current directory. The | name of each file in the current directory. The dynamic order in |
dynamic order in which PROC is applied to the filenames is | which PROC is applied to the filenames is unspecified. The value |
unspecified. The value returned by `directory*-for-each' is | returned by 'directory*-for-each' is unspecified. |
unspecified. |
-- Function: mkdir path mode -- Function: mkdir path mode
The `mkdir' function creates a new, empty directory whose name is The 'mkdir' function creates a new, empty directory whose name is |
PATH. The integer argument MODE specifies the file permissions PATH. The integer argument MODE specifies the file permissions for |
for the new directory. *Note The Mode Bits for Access Permission: the new directory. *Note (libc)The Mode Bits for Access
(libc)The Mode Bits for Access Permission, for more information Permission::, for more information about this. |
about this.
`mkdir' returns if successful, `#f' if not. 'mkdir' returns if successful, '#f' if not. |
-- Function: rmdir path -- Function: rmdir path
The `rmdir' function deletes the directory PATH. The directory The 'rmdir' function deletes the directory PATH. The directory |
must be empty before it can be removed. `rmdir' returns if must be empty before it can be removed. 'rmdir' returns if |
successful, `#f' if not. successful, '#f' if not. |
-- Function: chdir filename -- Function: chdir filename
Changes the current directory to FILENAME. If FILENAME does not Changes the current directory to FILENAME. If FILENAME does not
exist or is not a directory, `#f' is returned. Otherwise, `#t' is exist or is not a directory, '#f' is returned. Otherwise, '#t' is |
returned. returned.
-- Function: getcwd -- Function: getcwd
The function `getcwd' returns a string containing the absolute file The function 'getcwd' returns a string containing the absolute file |
name representing the current working directory. If this string name representing the current working directory. If this string
cannot be obtained, `#f' is returned. cannot be obtained, '#f' is returned. |
-- Function: rename-file oldfilename newfilename -- Function: rename-file oldfilename newfilename
Renames the file specified by OLDFILENAME to NEWFILENAME. If the Renames the file specified by OLDFILENAME to NEWFILENAME. If the
renaming is successful, `#t' is returned. Otherwise, `#f' is renaming is successful, '#t' is returned. Otherwise, '#f' is |
returned.
-- Function: copy-file oldfilename newfilename |
Copies the file specified by OLDFILENAME to NEWFILENAME. If the |
copying is successful, `#t' is returned. Otherwise, `#f' is |
returned. | returned. |
| |
-- Function: copy-file oldfilename newfilename |
Copies the file specified by OLDFILENAME to NEWFILENAME. If the |
copying is successful, '#t' is returned. Otherwise, '#f' is |
returned.
-- Function: chmod file mode -- Function: chmod file mode
The function `chmod' sets the access permission bits for the file The function 'chmod' sets the access permission bits for the file |
named by FILE to MODE. The FILE argument may be a string named by FILE to MODE. The FILE argument may be a string
containing the filename or a port open to the file. containing the filename or a port open to the file.
`chmod' returns if successful, `#f' if not. 'chmod' returns if successful, '#f' if not. |
-- Function: utime pathname acctime modtime -- Function: utime pathname acctime modtime
Sets the file times associated with the file named PATHNAME to Sets the file times associated with the file named PATHNAME to have |
have access time ACCTIME and modification time MODTIME. `utime' access time ACCTIME and modification time MODTIME. 'utime' returns |
returns if successful, `#f' if not. if successful, '#f' if not. |
-- Function: umask mode -- Function: umask mode
The function `umask' sets the file creation mask of the current The function 'umask' sets the file creation mask of the current |
process to MASK, and returns the previous value of the file process to MASK, and returns the previous value of the file
creation mask. creation mask.
-- Function: fileno port -- Function: fileno port
Returns the integer file descriptor associated with the port PORT. Returns the integer file descriptor associated with the port PORT.
If an error is detected, `#f' is returned. If an error is detected, '#f' is returned. |
-- Function: access pathname how -- Function: access pathname how
Returns `#t' if the file named by PATHNAME can be accessed in the Returns '#t' if the file named by PATHNAME can be accessed in the |
way specified by the HOW argument. The HOW argument can be the way specified by the HOW argument. The HOW argument can be the
`logior' of the flags: 'logior' of the flags: |
0. File-exists? 0. File-exists?
1. File-is-executable? 1. File-is-executable?
2. File-is-writable? 2. File-is-writable?
4. File-is-readable? 4. File-is-readable?
Or the HOW argument can be a string of 0 to 3 of the following Or the HOW argument can be a string of 0 to 3 of the following
characters in any order. The test performed is the `and' of the characters in any order. The test performed is the 'and' of the |
associated tests and `file-exists?'. associated tests and 'file-exists?'. |
<x> <x>
File-is-executable? File-is-executable?
<w>
<w>
File-is-writable? File-is-writable?
<r>
<r>
File-is-readable? File-is-readable?
-- Function: execl command arg0 ... -- Function: execl command arg0 ...
-- Function: execlp command arg0 ... -- Function: execlp command arg0 ...
Transfers control to program COMMAND called with arguments ARG0 Transfers control to program COMMAND called with arguments ARG0
.... For `execl', COMMAND must be an exact pathname of an .... For 'execl', COMMAND must be an exact pathname of an |
executable file. `execlp' searches for COMMAND in the list of executable file. 'execlp' searches for COMMAND in the list of |
directories specified by the environment variable PATH. The directories specified by the environment variable PATH. The
convention is that ARG0 is the same name as COMMAND. convention is that ARG0 is the same name as COMMAND.
If successful, this procedure does not return. Otherwise an error If successful, this procedure does not return. Otherwise an error
message is printed and the integer `errno' is returned. message is printed and the integer 'errno' is returned. |
-- Function: execv command arglist -- Function: execv command arglist
-- Function: execvp command arglist -- Function: execvp command arglist
Like `execl' and `execlp' except that the set of arguments to Like 'execl' and 'execlp' except that the set of arguments to |
COMMAND is ARGLIST. COMMAND is ARGLIST.
-- Function: putenv string -- Function: putenv string
adds or removes definitions from the "environment". If the STRING adds or removes definitions from the "environment". If the STRING
is of the form `NAME=VALUE', the definition is added to the is of the form 'NAME=VALUE', the definition is added to the |
environment. Otherwise, the STRING is interpreted as the name of environment. Otherwise, the STRING is interpreted as the name of
an environment variable, and any definition for this variable in an environment variable, and any definition for this variable in
the environment is removed. the environment is removed.
Names of environment variables are case-sensitive and must not Names of environment variables are case-sensitive and must not
contain the character `='. System-defined environment variables contain the character '='. System-defined environment variables |
are invariably uppercase. are invariably uppercase.
`Putenv' is used to set up the environment before calls to 'Putenv' is used to set up the environment before calls to 'execl', |
`execl', `execlp', `execv', `execvp', `system', or `open-pipe' 'execlp', 'execv', 'execvp', 'system', or 'open-pipe' (*note |
(*note open-pipe: Posix Extensions.). open-pipe: Posix Extensions.). |
To access environment variables, use `getenv' (*note getenv: To access environment variables, use 'getenv' (*note getenv: |
(slib)System Interface.). (slib)System Interface.).
 
File: scm-5f2.info, Node: Posix Extensions, Next: Unix Extensions, Prev: I/O- Extensions, Up: Packages File: scm-5f3.info, Node: Posix Extensions, Next: Unix Extensions, Prev: I/O- Extensions, Up: Packages
| |
5.7 Posix Extensions 5.7 Posix Extensions
==================== ====================
If `'posix' is provided (by linking in `posix.o'), the following If ''posix' is provided (by linking in 'posix.o'), the following |
functions are defined: functions are defined:
-- Function: open-pipe string modes -- Function: open-pipe string modes
If the string MODES contains an <r>, returns an input port capable If the string MODES contains an <r>, returns an input port capable
of delivering characters from the standard output of the system of delivering characters from the standard output of the system
command STRING. Otherwise, returns an output port capable of command STRING. Otherwise, returns an output port capable of
receiving characters which become the standard input of the system receiving characters which become the standard input of the system
command STRING. If a pipe cannot be created `#f' is returned. command STRING. If a pipe cannot be created '#f' is returned. |
-- Function: open-input-pipe string -- Function: open-input-pipe string
Returns an input port capable of delivering characters from the Returns an input port capable of delivering characters from the
standard output of the system command STRING. If a pipe cannot be standard output of the system command STRING. If a pipe cannot be
created `#f' is returned. created '#f' is returned. |
-- Function: open-output-pipe string -- Function: open-output-pipe string
Returns an output port capable of receiving characters which become Returns an output port capable of receiving characters which become
the standard input of the system command STRING. If a pipe cannot the standard input of the system command STRING. If a pipe cannot
be created `#f' is returned. be created '#f' is returned. |
-- Function: broken-pipe port -- Function: broken-pipe port
If this function is defined at top level, it will be called when an If this function is defined at top level, it will be called when an
output pipe is closed from the other side (this is the condition output pipe is closed from the other side (this is the condition
under which a SIGPIPE is sent). The already closed PORT will be under which a SIGPIPE is sent). The already closed PORT will be
passed so that any necessary cleanup may be done. An error is not passed so that any necessary cleanup may be done. An error is not
signaled when output to a pipe fails in this way, but any further signaled when output to a pipe fails in this way, but any further
output to the closed pipe will cause an error to be signaled. output to the closed pipe will cause an error to be signaled.
-- Function: close-port pipe -- Function: close-port pipe
Closes the PIPE, rendering it incapable of delivering or accepting Closes the PIPE, rendering it incapable of delivering or accepting
characters. This routine has no effect if the pipe has already characters. This routine has no effect if the pipe has already
been closed. The value returned is unspecified. been closed. The value returned is unspecified.
-- Function: pipe -- Function: pipe
Returns `(cons RD WD)' where RD and WD are the read and write Returns '(cons RD WD)' where RD and WD are the read and write |
(port) ends of a "pipe" respectively. (port) ends of a "pipe" respectively.
-- Function: fork -- Function: fork
Creates a copy of the process calling `fork'. Both processes Creates a copy of the process calling 'fork'. Both processes |
return from `fork', but the calling ("parent") process's `fork' return from 'fork', but the calling ("parent") process's 'fork' |
returns the "child" process's ID whereas the child process's returns the "child" process's ID whereas the child process's 'fork' |
`fork' returns 0. returns 0. |
For a discussion of "ID"s *Note Process Persona: (GNU C Library)Process For a discussion of "ID"s *Note (GNU C Library)Process Persona::. |
Persona.
-- Function: getppid -- Function: getppid
Returns the process ID of the parent of the current process. For Returns the process ID of the parent of the current process. For a |
a process's own ID *Note getpid: I/O-Extensions. process's own ID *Note getpid: I/O-Extensions. |
-- Function: getuid -- Function: getuid
Returns the real user ID of this process. Returns the real user ID of this process.
-- Function: getgid -- Function: getgid
Returns the real group ID of this process. Returns the real group ID of this process.
-- Function: getegid -- Function: getegid
Returns the effective group ID of this process. Returns the effective group ID of this process.
-- Function: geteuid -- Function: geteuid
Returns the effective user ID of this process. Returns the effective user ID of this process.
-- Function: setuid id -- Function: setuid id
Sets the real user ID of this process to ID. Returns `#t' if Sets the real user ID of this process to ID. Returns '#t' if |
successful, `#f' if not. successful, '#f' if not. |
-- Function: setgid id -- Function: setgid id
Sets the real group ID of this process to ID. Returns `#t' if Sets the real group ID of this process to ID. Returns '#t' if |
successful, `#f' if not. successful, '#f' if not. |
-- Function: setegid id -- Function: setegid id
Sets the effective group ID of this process to ID. Returns `#t' Sets the effective group ID of this process to ID. Returns '#t' if |
if successful, `#f' if not. successful, '#f' if not. |
-- Function: seteuid id -- Function: seteuid id
Sets the effective user ID of this process to ID. Returns `#t' if Sets the effective user ID of this process to ID. Returns '#t' if |
successful, `#f' if not. successful, '#f' if not. |
-- Function: kill pid sig -- Function: kill pid sig
The `kill' function sends the signal SIGNUM to the process or The 'kill' function sends the signal SIGNUM to the process or |
process group specified by PID. Besides the signals listed in process group specified by PID. Besides the signals listed in
*note Standard Signals: (libc)Standard Signals, SIGNUM can also *note (libc)Standard Signals::, SIGNUM can also have a value of |
have a value of zero to check the validity of the PID. zero to check the validity of the PID. |
The PID specifies the process or process group to receive the The PID specifies the process or process group to receive the
signal: signal:
> 0 > 0
The process whose identifier is PID. The process whose identifier is PID.
0 0
All processes in the same process group as the sender. The All processes in the same process group as the sender. The
sender itself does not receive the signal. sender itself does not receive the signal.
-1 -1
If the process is privileged, send the signal to all If the process is privileged, send the signal to all processes |
processes except for some special system processes. except for some special system processes. Otherwise, send the |
Otherwise, send the signal to all processes with the same signal to all processes with the same effective user ID. |
effective user ID.
< -1
< -1 The process group whose identifier is '(abs PID)'. |
The process group whose identifier is `(abs PID)'.
A process can send a signal to itself with '(kill (getpid) |
A process can send a signal to itself with `(kill (getpid) SIGNUM)'. If 'kill' is used by a process to send a signal to |
SIGNUM)'. If `kill' is used by a process to send a signal to itself, and the signal is not blocked, then 'kill' delivers at |
itself, and the signal is not blocked, then `kill' delivers at
least one signal (which might be some other pending unblocked least one signal (which might be some other pending unblocked
signal instead of the signal SIGNUM) to that process before it signal instead of the signal SIGNUM) to that process before it
returns. returns.
The return value from `kill' is zero if the signal can be sent The return value from 'kill' is zero if the signal can be sent |
successfully. Otherwise, no signal is sent, and a value of `-1' is successfully. Otherwise, no signal is sent, and a value of '-1' is |
returned. If PID specifies sending a signal to several processes, returned. If PID specifies sending a signal to several processes,
`kill' succeeds if it can send the signal to at least one of them. 'kill' succeeds if it can send the signal to at least one of them. |
There's no way you can tell which of the processes got the signal There's no way you can tell which of the processes got the signal
or whether all of them did. or whether all of them did.
-- Function: waitpid pid options -- Function: waitpid pid options
The `waitpid' function suspends execution of the current process |
until a child as specified by the PID argument has exited, or The 'waitpid' function suspends execution of the current process |
until a signal is delivered whose action is to terminate the until a child as specified by the PID argument has exited, or until |
current process or to call a signal handling function. If a child a signal is delivered whose action is to terminate the current |
as requested by PID has already exited by the time of the call (a process or to call a signal handling function. If a child as |
so-called "zombie" process), the function returns immediately. requested by PID has already exited by the time of the call (a |
Any system resources used by the child are freed. so-called "zombie" process), the function returns immediately. Any |
system resources used by the child are freed. |
The value of PID can be: The value of PID can be:
< -1 < -1
which means to wait for any child process whose process group which means to wait for any child process whose process group
ID is equal to the absolute value of PID. ID is equal to the absolute value of PID.
-1 -1
which means to wait for any child process; this is the same which means to wait for any child process; this is the same
behaviour which wait exhibits. behaviour which wait exhibits.
0 0
which means to wait for any child process whose process group which means to wait for any child process whose process group
ID is equal to that of the calling process. ID is equal to that of the calling process.
> 0 > 0
which means to wait for the child whose process ID is equal which means to wait for the child whose process ID is equal to |
to the value of PID. the value of PID. |
The value of OPTIONS is one of the following: The value of OPTIONS is one of the following:
0. Nothing special. 0. Nothing special.
1. (`WNOHANG') which means to return immediately if no child is 1. ('WNOHANG') which means to return immediately if no child is |
there to be waited for. there to be waited for.
2. (`WUNTRACED') which means to also return for children which 2. ('WUNTRACED') which means to also return for children which |
are stopped, and whose status has not been reported. are stopped, and whose status has not been reported.
3. Which means both of the above. 3. Which means both of the above.
The return value normally is the exit status of the child process, The return value normally is the exit status of the child process,
including the exit value along with flags indicating whether a including the exit value along with flags indicating whether a
coredump was generated or the child terminated as a result of a coredump was generated or the child terminated as a result of a
signal. If the `WNOHANG' option was specified and no child signal. If the 'WNOHANG' option was specified and no child process |
process is waiting to be noticed, the value is zero. A value of is waiting to be noticed, the value is zero. A value of '#f' is |
`#f' is returned in case of error and `errno' is set. For returned in case of error and 'errno' is set. For information |
information about the `errno' codes *Note Process Completion: (GNU about the 'errno' codes *Note (GNU C Library)Process Completion::. |
C Library)Process Completion.
-- Function: uname -- Function: uname
You can use the `uname' procedure to find out some information You can use the 'uname' procedure to find out some information |
about the type of computer your program is running on. about the type of computer your program is running on.
Returns a vector of strings. These strings are: Returns a vector of strings. These strings are:
0. The name of the operating system in use. 0. The name of the operating system in use.
1. The network name of this particular computer. 1. The network name of this particular computer.
2. The current release level of the operating system 2. The current release level of the operating system
implementation. implementation.
3. The current version level within the release of the operating 3. The current version level within the release of the operating
system. system.
4. Description of the type of hardware that is in use. 4. Description of the type of hardware that is in use.
Some examples are `"i386-ANYTHING"', `"m68k-hp"', Some examples are '"i386-ANYTHING"', '"m68k-hp"', |
`"sparc-sun"', `"m68k-sun"', `"m68k-sony"' and `"mips-dec"'. '"sparc-sun"', '"m68k-sun"', '"m68k-sony"' and '"mips-dec"'. |
-- Function: getpw name -- Function: getpw name
-- Function: getpw uid -- Function: getpw uid
-- Function: getpw -- Function: getpw
Returns a vector of information for the entry for `NAME', `UID', Returns a vector of information for the entry for 'NAME', 'UID', or |
or the next entry if no argument is given. The information is: the next entry if no argument is given. The information is: |
0. The user's login name. 0. The user's login name.
1. The encrypted password string. 1. The encrypted password string.
2. The user ID number. 2. The user ID number.
3. The user's default group ID number. 3. The user's default group ID number.
4. A string typically containing the user's real name, and 4. A string typically containing the user's real name, and
possibly other information such as a phone number. possibly other information such as a phone number.
5. The user's home directory, initial working directory, or '#f', |
5. The user's home directory, initial working directory, or in which case the interpretation is system-dependent. |
`#f', in which case the interpretation is system-dependent.
6. The user's default shell, the initial program run when the 6. The user's default shell, the initial program run when the
user logs in, or `#f', indicating that the system default user logs in, or '#f', indicating that the system default |
should be used. should be used.
-- Function: setpwent #t -- Function: setpwent #t
Rewinds the pw entry table back to the begining. Rewinds the pw entry table back to the begining.
-- Function: setpwent #f -- Function: setpwent #f
-- Function: setpwent -- Function: setpwent
Closes the pw table. Closes the pw table.
-- Function: getgr name -- Function: getgr name
-- Function: getgr uid -- Function: getgr uid
-- Function: getgr -- Function: getgr
Returns a vector of information for the entry for `NAME', `UID', Returns a vector of information for the entry for 'NAME', 'UID', or |
or the next entry if no argument is given. The information is: the next entry if no argument is given. The information is: |
0. The name of the group. 0. The name of the group.
1. The encrypted password string. 1. The encrypted password string.
2. The group ID number. 2. The group ID number.
3. A list of (string) names of users in the group. 3. A list of (string) names of users in the group.
-- Function: setgrent #t -- Function: setgrent #t
Rewinds the group entry table back to the begining. Rewinds the group entry table back to the begining.
-- Function: setgrent #f -- Function: setgrent #f
-- Function: setgrent -- Function: setgrent
Closes the group table. Closes the group table.
-- Function: getgroups -- Function: getgroups
Returns a vector of all the supplementary group IDs of the process. Returns a vector of all the supplementary group IDs of the process.
-- Function: link oldname newname -- Function: link oldname newname
The `link' function makes a new link to the existing file named by The 'link' function makes a new link to the existing file named by |
OLDNAME, under the new name NEWNAME. OLDNAME, under the new name NEWNAME.
`link' returns a value of `#t' if it is successful and `#f' on 'link' returns a value of '#t' if it is successful and '#f' on |
failure. failure.
-- Function: chown filename owner group -- Function: chown filename owner group
The `chown' function changes the owner of the file FILENAME to The 'chown' function changes the owner of the file FILENAME to |
OWNER, and its group owner to GROUP. OWNER, and its group owner to GROUP.
`chown' returns a value of `#t' if it is successful and `#f' on 'chown' returns a value of '#t' if it is successful and '#f' on |
failure. failure.
-- Function: ttyname port -- Function: ttyname port
If port PORT is associated with a terminal device, returns a If port PORT is associated with a terminal device, returns a string |
string containing the file name of termainal device; otherwise containing the file name of termainal device; otherwise '#f'. |
`#f'.
 
File: scm-5f2.info, Node: Unix Extensions, Next: Sequence Comparison, Prev: P osix Extensions, Up: Packages File: scm-5f3.info, Node: Unix Extensions, Next: Sequence Comparison, Prev: P osix Extensions, Up: Packages
| |
5.8 Unix Extensions 5.8 Unix Extensions
=================== ===================
If `'unix' is provided (by linking in `unix.o'), the following If ''unix' is provided (by linking in 'unix.o'), the following functions |
functions are defined: are defined: |
These "privileged" and symbolic link functions are not in Posix: These "privileged" and symbolic link functions are not in Posix:
-- Function: symlink oldname newname -- Function: symlink oldname newname
The `symlink' function makes a symbolic link to OLDNAME named The 'symlink' function makes a symbolic link to OLDNAME named |
NEWNAME. NEWNAME.
`symlink' returns a value of `#t' if it is successful and `#f' on 'symlink' returns a value of '#t' if it is successful and '#f' on |
failure. failure.
-- Function: readlink filename -- Function: readlink filename
Returns the value of the symbolic link FILENAME or `#f' for Returns the value of the symbolic link FILENAME or '#f' for |
failure. failure.
-- Function: lstat filename -- Function: lstat filename
The `lstat' function is like `stat', except that it does not The 'lstat' function is like 'stat', except that it does not follow |
follow symbolic links. If FILENAME is the name of a symbolic symbolic links. If FILENAME is the name of a symbolic link, |
link, `lstat' returns information about the link itself; otherwise, 'lstat' returns information about the link itself; otherwise, |
`lstat' works like `stat'. *Note I/O-Extensions::. 'lstat' works like 'stat'. *Note I/O-Extensions::. |
-- Function: nice increment -- Function: nice increment
Increment the priority of the current process by INCREMENT. Increment the priority of the current process by INCREMENT.
`chown' returns a value of `#t' if it is successful and `#f' on 'chown' returns a value of '#t' if it is successful and '#f' on |
failure. failure.
-- Function: acct filename -- Function: acct filename
When called with the name of an exisitng file as argument, When called with the name of an exisitng file as argument,
accounting is turned on, records for each terminating process are accounting is turned on, records for each terminating process are
appended to FILENAME as it terminates. An argument of `#f' causes appended to FILENAME as it terminates. An argument of '#f' causes |
accounting to be turned off. accounting to be turned off.
`acct' returns a value of `#t' if it is successful and `#f' on 'acct' returns a value of '#t' if it is successful and '#f' on |
failure. failure.
-- Function: mknod filename mode dev -- Function: mknod filename mode dev
The `mknod' function makes a special file with name FILENAME and The 'mknod' function makes a special file with name FILENAME and |
modes MODE for device number DEV. modes MODE for device number DEV.
`mknod' returns a value of `#t' if it is successful and `#f' on 'mknod' returns a value of '#t' if it is successful and '#f' on |
failure. failure.
-- Function: sync -- Function: sync
`sync' first commits inodes to buffers, and then buffers to disk. 'sync' first commits inodes to buffers, and then buffers to disk. |
sync() only schedules the writes, so it may return before the sync() only schedules the writes, so it may return before the
actual writing is done. The value returned is unspecified. actual writing is done. The value returned is unspecified.
 
File: scm-5f2.info, Node: Sequence Comparison, Next: Regular Expression Patter n Matching, Prev: Unix Extensions, Up: Packages File: scm-5f3.info, Node: Sequence Comparison, Next: Regular Expression Patter n Matching, Prev: Unix Extensions, Up: Packages
| |
5.9 Sequence Comparison 5.9 Sequence Comparison
======================= =======================
`(require 'diff)' '(require 'diff)' |
A blazing fast implementation of the sequence-comparison module in A blazing fast implementation of the sequence-comparison module in SLIB, |
SLIB, see *Note Sequence Comparison: (slib)Sequence Comparison. see *Note (slib)Sequence Comparison::. |
 
File: scm-5f2.info, Node: Regular Expression Pattern Matching, Next: Line Edit ing, Prev: Sequence Comparison, Up: Packages File: scm-5f3.info, Node: Regular Expression Pattern Matching, Next: Line Edit ing, Prev: Sequence Comparison, Up: Packages
| |
5.10 Regular Expression Pattern Matching 5.10 Regular Expression Pattern Matching
======================================== ========================================
These functions are defined in `rgx.c' using a POSIX or GNU "regex" These functions are defined in 'rgx.c' using a POSIX or GNU "regex" |
library. If your computer does not support regex, a package is library. If your computer does not support regex, a package is
available via ftp from `ftp.gnu.org:/pub/gnu/regex-0.12.tar.gz'. For a available via ftp from 'ftp.gnu.org:/pub/gnu/regex-0.12.tar.gz'. For a |
description of regular expressions, *Note syntax: (regex)syntax. description of regular expressions, *Note (regex)syntax::. |
-- Function: regcomp PATTERN [FLAGS] -- Function: regcomp PATTERN [FLAGS]
Compile a "regular expression". Return a compiled regular Compile a "regular expression". Return a compiled regular
expression, or an integer error code suitable as an argument to expression, or an integer error code suitable as an argument to
`regerror'. 'regerror'. |
FLAGS in `regcomp' is a string of option letters used to control
the compilation of the regular expression. The letters may
consist of:
`n'
newlines won't be matched by `.' or hat lists; ( `[^...]' )
`i' FLAGS in 'regcomp' is a string of option letters used to control |
ignore case.only when compiled with _GNU_SOURCE: the compilation of the regular expression. The letters may consist |
of: |
`0'
'n' |
newlines won't be matched by '.' or hat lists; ( '[^...]' ) |
'i' |
ignore case. |
only when compiled with _GNU_SOURCE: |
'0' |
allows dot to match a null character. allows dot to match a null character.
'f' |
`f'
enable GNU fastmaps. enable GNU fastmaps.
-- Function: regerror ERRNO -- Function: regerror ERRNO
Returns a string describing the integer ERRNO returned when Returns a string describing the integer ERRNO returned when
`regcomp' fails. 'regcomp' fails. |
-- Function: regexec RE STRING -- Function: regexec RE STRING
Returns `#f' or a vector of integers. These integers are in Returns '#f' or a vector of integers. These integers are in |
doublets. The first of each doublet is the index of STRING of the doublets. The first of each doublet is the index of STRING of the
start of the matching expression or sub-expression (delimited by start of the matching expression or sub-expression (delimited by
parentheses in the pattern). The last of each doublet is index of parentheses in the pattern). The last of each doublet is index of
STRING of the end of that expression. `#f' is returned if the STRING of the end of that expression. '#f' is returned if the |
string does not match. string does not match.
-- Function: regmatch? RE STRING -- Function: regmatch? RE STRING
Returns `#t' if the PATTERN such that REGEXP = (regcomp PATTERN) Returns '#t' if the PATTERN such that REGEXP = (regcomp PATTERN) |
matches STRING as a POSIX extended regular expressions. Returns matches STRING as a POSIX extended regular expressions. Returns
`#f' otherwise. '#f' otherwise. |
-- Function: regsearch RE STRING [START [LEN]] -- Function: regsearch RE STRING [START [LEN]]
-- Function: regsearchv RE STRING [START [LEN]] -- Function: regsearchv RE STRING [START [LEN]]
-- Function: regmatch RE STRING [START [LEN]] -- Function: regmatch RE STRING [START [LEN]]
-- Function: regmatchv RE STRING [START [LEN]] -- Function: regmatchv RE STRING [START [LEN]]
`Regsearch' searches for the pattern within the string. 'Regsearch' searches for the pattern within the string. |
`Regmatch' anchors the pattern and begins matching it against 'Regmatch' anchors the pattern and begins matching it against |
string. string.
`Regsearch' returns the character position where RE starts, or 'Regsearch' returns the character position where RE starts, or '#f' |
`#f' if not found. if not found. |
`Regmatch' returns the number of characters matched, `#f' if not 'Regmatch' returns the number of characters matched, '#f' if not |
matched. matched.
`Regsearchv' and `regmatchv' return the match vector is returned 'Regsearchv' and 'regmatchv' return the match vector is returned if |
if RE is found, `#f' otherwise. RE is found, '#f' otherwise. |
RE RE
may be either: may be either:
1. a compiled regular expression returned by `regcomp'; 1. a compiled regular expression returned by 'regcomp'; |
2. a string representing a regular expression; 2. a string representing a regular expression;
3. a list of a string and a set of option letters. 3. a list of a string and a set of option letters.
STRING
STRING
The string to be operated upon. The string to be operated upon.
START
START
The character position at which to begin the search or match. The character position at which to begin the search or match.
If absent, the default is zero. If absent, the default is zero.
_Compiled _GNU_SOURCE and using GNU libregex only_ _Compiled _GNU_SOURCE and using GNU libregex only_
When searching, if START is negative, the absolute value of When searching, if START is negative, the absolute value of
START will be used as the start location and reverse searching START will be used as the start location and reverse searching
will be performed. will be performed.
LEN LEN
The search is allowed to examine only the first LEN The search is allowed to examine only the first LEN characters |
characters of STRING. If absent, the entire string may be of STRING. If absent, the entire string may be examined. |
examined.
-- Function: string-split RE STRING -- Function: string-split RE STRING
-- Function: string-splitv RE STRING -- Function: string-splitv RE STRING
`String-split' splits a string into substrings that are separated 'String-split' splits a string into substrings that are separated |
by RE, returning a vector of substrings. by RE, returning a vector of substrings.
`String-splitv' returns a vector of string positions that indicate 'String-splitv' returns a vector of string positions that indicate |
where the substrings are located. where the substrings are located.
-- Function: string-edit RE EDIT-SPEC STRING [COUNT] -- Function: string-edit RE EDIT-SPEC STRING [COUNT]
Returns the edited string. Returns the edited string.
EDIT-SPEC EDIT-SPEC
Is a string used to replace occurances of RE. Backquoted Is a string used to replace occurances of RE. Backquoted
integers in the range of 1-9 may be used to insert integers in the range of 1-9 may be used to insert
subexpressions in RE, as in `sed'. subexpressions in RE, as in 'sed'. |
COUNT
COUNT The number of substitutions for 'string-edit' to perform. If |
The number of substitutions for `string-edit' to perform. If '#t', all occurances of RE will be replaced. The default is |
`#t', all occurances of RE will be replaced. The default is
to perform one substitution. to perform one substitution.
 
File: scm-5f2.info, Node: Line Editing, Next: Curses, Prev: Regular Expressio n Pattern Matching, Up: Packages File: scm-5f3.info, Node: Line Editing, Next: Curses, Prev: Regular Expressio n Pattern Matching, Up: Packages
| |
5.11 Line Editing 5.11 Line Editing
================= =================
`(require 'edit-line)' '(require 'edit-line)' |
These procedures provide input line editing and recall. These procedures provide input line editing and recall.
These functions are defined in `edline.c' and `Iedline.scm' using the These functions are defined in 'edline.c' and 'Iedline.scm' using the |
"editline" or GNU "readline" (*note Overview: (readline)Top.) libraries "editline" or GNU "readline" (*note Overview: (readline)Top.) libraries
available from: available from:
* `ftp.sys.toronto.edu:/pub/rc/editline.shar' * 'ftp.sys.toronto.edu:/pub/rc/editline.shar' |
* 'ftp.gnu.org:/pub/gnu/readline-2.0.tar.gz' |
* `ftp.gnu.org:/pub/gnu/readline-2.0.tar.gz'
When `edit-line' package is initialized, if the current input port is When 'edit-line' package is initialized, if the current input port is |
the default input port and the environment variable EMACS is not the default input port and the environment variable EMACS is not
defined, line-editing mode will be entered. defined, line-editing mode will be entered.
-- Function: default-input-port -- Function: default-input-port
Returns the initial `current-input-port' SCM was invoked with Returns the initial 'current-input-port' SCM was invoked with |
(stdin). (stdin).
-- Function: default-output-port -- Function: default-output-port
Returns the initial `current-output-port' SCM was invoked with Returns the initial 'current-output-port' SCM was invoked with |
(stdout). (stdout).
-- Function: make-edited-line-port -- Function: make-edited-line-port
Returns an input/output port that allows command line editing and Returns an input/output port that allows command line editing and
retrieval of history. retrieval of history.
-- Function: line-editing -- Function: line-editing
Returns the current edited line port or `#f'. Returns the current edited line port or '#f'. |
-- Function: line-editing bool -- Function: line-editing bool
If BOOL is false, exits line-editing mode and returns the previous If BOOL is false, exits line-editing mode and returns the previous
value of `(line-editing)'. If BOOL is true, sets the current value of '(line-editing)'. If BOOL is true, sets the current input |
input and output ports to an edited line port and returns the and output ports to an edited line port and returns the previous |
previous value of `(line-editing)'. value of '(line-editing)'. |
 
File: scm-5f2.info, Node: Curses, Next: Sockets, Prev: Line Editing, Up: Pac kages File: scm-5f3.info, Node: Curses, Next: Sockets, Prev: Line Editing, Up: Pac kages
| |
5.12 Curses 5.12 Curses
=========== ===========
These functions are defined in `crs.c' using the "curses" library. These functions are defined in 'crs.c' using the "curses" library. |
Unless otherwise noted these routines return `#t' for successful Unless otherwise noted these routines return '#t' for successful |
completion and `#f' for failure. completion and '#f' for failure. |
-- Function: initscr -- Function: initscr
Returns a port for a full screen window. This routine must be Returns a port for a full screen window. This routine must be
called to initialize curses. called to initialize curses.
-- Function: endwin -- Function: endwin
A program should call `endwin' before exiting or escaping from A program should call 'endwin' before exiting or escaping from |
curses mode temporarily, to do a system call, for example. This curses mode temporarily, to do a system call, for example. This
routine will restore termio modes, move the cursor to the lower routine will restore termio modes, move the cursor to the lower
left corner of the screen and reset the terminal into the proper left corner of the screen and reset the terminal into the proper
non-visual mode. To resume after a temporary escape, call *note non-visual mode. To resume after a temporary escape, call *note
refresh: Window Manipulation. refresh: Window Manipulation.
* Menu: * Menu:
* Output Options Setting:: * Output Options Setting::
* Terminal Mode Setting:: * Terminal Mode Setting::
* Window Manipulation:: * Window Manipulation::
* Output:: * Output::
* Input:: * Input::
* Curses Miscellany:: * Curses Miscellany::
 
File: scm-5f2.info, Node: Output Options Setting, Next: Terminal Mode Setting, Prev: Curses, Up: Curses File: scm-5f3.info, Node: Output Options Setting, Next: Terminal Mode Setting, Prev: Curses, Up: Curses
| |
5.12.1 Output Options Setting 5.12.1 Output Options Setting
----------------------------- -----------------------------
These routines set options within curses that deal with output. All These routines set options within curses that deal with output. All
options are initially `#f', unless otherwise stated. It is not options are initially '#f', unless otherwise stated. It is not |
necessary to turn these options off before calling `endwin'. necessary to turn these options off before calling 'endwin'. |
-- Function: clearok win bf -- Function: clearok win bf
If enabled (BF is `#t'), the next call to `force-output' or If enabled (BF is '#t'), the next call to 'force-output' or |
`refresh' with WIN will clear the screen completely and redraw the 'refresh' with WIN will clear the screen completely and redraw the |
entire screen from scratch. This is useful when the contents of entire screen from scratch. This is useful when the contents of
the screen are uncertain, or in some cases for a more pleasing the screen are uncertain, or in some cases for a more pleasing
visual effect. visual effect.
-- Function: idlok win bf -- Function: idlok win bf
If enabled (BF is `#t'), curses will consider using the hardware If enabled (BF is '#t'), curses will consider using the hardware |
"insert/delete-line" feature of terminals so equipped. If "insert/delete-line" feature of terminals so equipped. If disabled |
disabled (BF is `#f'), curses will very seldom use this feature. (BF is '#f'), curses will very seldom use this feature. The |
The "insert/delete-character" feature is always considered. This "insert/delete-character" feature is always considered. This |
option should be enabled only if your application needs option should be enabled only if your application needs
"insert/delete-line", for example, for a screen editor. It is "insert/delete-line", for example, for a screen editor. It is
disabled by default because disabled by default because
"insert/delete-line" tends to be visually annoying when used in "insert/delete-line" tends to be visually annoying when used in
applications where it is not really needed. If applications where it is not really needed. If
"insert/delete-line" cannot be used, curses will redraw the "insert/delete-line" cannot be used, curses will redraw the changed |
changed portions of all lines. portions of all lines. |
-- Function: leaveok win bf -- Function: leaveok win bf
Normally, the hardware cursor is left at the location of the window Normally, the hardware cursor is left at the location of the window
cursor being refreshed. This option allows the cursor to be left cursor being refreshed. This option allows the cursor to be left
wherever the update happens to leave it. It is useful for wherever the update happens to leave it. It is useful for
applications where the cursor is not used, since it reduces the applications where the cursor is not used, since it reduces the
need for cursor motions. If possible, the cursor is made need for cursor motions. If possible, the cursor is made invisible |
invisible when this option is enabled. when this option is enabled. |
-- Function: scrollok win bf -- Function: scrollok win bf
This option controls what happens when the cursor of window WIN is This option controls what happens when the cursor of window WIN is
moved off the edge of the window or scrolling region, either from a moved off the edge of the window or scrolling region, either from a
newline on the bottom line, or typing the last character of the newline on the bottom line, or typing the last character of the
last line. If disabled (BF is `#f'), the cursor is left on the last line. If disabled (BF is '#f'), the cursor is left on the |
bottom line at the location where the offending character was bottom line at the location where the offending character was
entered. If enabled (BF is `#t'), `force-output' is called on the entered. If enabled (BF is '#t'), 'force-output' is called on the |
window WIN, and then the physical terminal and window WIN are window WIN, and then the physical terminal and window WIN are
scrolled up one line. scrolled up one line.
_Note_ in order to get the physical scrolling effect on the _Note_ in order to get the physical scrolling effect on the
terminal, it is also necessary to call `idlok'. terminal, it is also necessary to call 'idlok'. |
-- Function: nodelay win bf -- Function: nodelay win bf
This option causes wgetch to be a non-blocking call. If no input This option causes wgetch to be a non-blocking call. If no input
is ready, wgetch will return an eof-object. If disabled, wgetch is ready, wgetch will return an eof-object. If disabled, wgetch
will hang until a key is pressed. will hang until a key is pressed.
 
File: scm-5f2.info, Node: Terminal Mode Setting, Next: Window Manipulation, P rev: Output Options Setting, Up: Curses File: scm-5f3.info, Node: Terminal Mode Setting, Next: Window Manipulation, P rev: Output Options Setting, Up: Curses
| |
5.12.2 Terminal Mode Setting 5.12.2 Terminal Mode Setting
---------------------------- ----------------------------
These routines set options within curses that deal with input. The These routines set options within curses that deal with input. The
options involve using ioctl(2) and therefore interact with curses options involve using ioctl(2) and therefore interact with curses
routines. It is not necessary to turn these options off before calling routines. It is not necessary to turn these options off before calling
`endwin'. The routines in this section all return an unspecified value. 'endwin'. The routines in this section all return an unspecified value. |
-- Function: cbreak -- Function: cbreak
-- Function: nocbreak -- Function: nocbreak
These two routines put the terminal into and out of `CBREAK' mode, These two routines put the terminal into and out of 'CBREAK' mode, |
respectively. In `CBREAK' mode, characters typed by the user are respectively. In 'CBREAK' mode, characters typed by the user are |
immediately available to the program and erase/kill character immediately available to the program and erase/kill character
processing is not performed. When in `NOCBREAK' mode, the tty processing is not performed. When in 'NOCBREAK' mode, the tty |
driver will buffer characters typed until a <LFD> or <RET> is driver will buffer characters typed until a <LFD> or <RET> is
typed. Interrupt and flowcontrol characters are unaffected by typed. Interrupt and flowcontrol characters are unaffected by this |
this mode. Initially the terminal may or may not be in `CBREAK' mode. Initially the terminal may or may not be in 'CBREAK' mode, |
mode, as it is inherited, therefore, a program should call as it is inherited, therefore, a program should call 'cbreak' or |
`cbreak' or `nocbreak' explicitly. Most interactive programs 'nocbreak' explicitly. Most interactive programs using curses will |
using curses will set `CBREAK' mode. set 'CBREAK' mode. |
_Note_ `cbreak' overrides `raw'. For a discussion of how these _Note_ 'cbreak' overrides 'raw'. For a discussion of how these |
routines interact with `echo' and `noecho' *Note read-char: Input. routines interact with 'echo' and 'noecho' *Note read-char: Input. |
-- Function: raw -- Function: raw
-- Function: noraw -- Function: noraw
The terminal is placed into or out of `RAW' mode. `RAW' mode is The terminal is placed into or out of 'RAW' mode. 'RAW' mode is |
similar to `CBREAK' mode, in that characters typed are immediately similar to 'CBREAK' mode, in that characters typed are immediately |
passed through to the user program. The differences are that in passed through to the user program. The differences are that in
`RAW' mode, the interrupt, quit, suspend, and flow control 'RAW' mode, the interrupt, quit, suspend, and flow control |
characters are passed through uninterpreted, instead of generating characters are passed through uninterpreted, instead of generating
a signal. `RAW' mode also causes 8-bit input and output. The a signal. 'RAW' mode also causes 8-bit input and output. The |
behavior of the `BREAK' key depends on other bits in the terminal behavior of the 'BREAK' key depends on other bits in the terminal |
driver that are not set by curses. driver that are not set by curses.
-- Function: echo -- Function: echo
-- Function: noecho -- Function: noecho
These routines control whether characters typed by the user are These routines control whether characters typed by the user are
echoed by `read-char' as they are typed. Echoing by the tty echoed by 'read-char' as they are typed. Echoing by the tty driver |
driver is always disabled, but initially `read-char' is in `ECHO' is always disabled, but initially 'read-char' is in 'ECHO' mode, so |
mode, so characters typed are echoed. Authors of most interactive characters typed are echoed. Authors of most interactive programs |
programs prefer to do their own echoing in a controlled area of prefer to do their own echoing in a controlled area of the screen, |
the screen, or not to echo at all, so they disable echoing by or not to echo at all, so they disable echoing by calling 'noecho'. |
calling `noecho'. For a discussion of how these routines interact For a discussion of how these routines interact with 'echo' and |
with `echo' and `noecho' *Note read-char: Input. 'noecho' *Note read-char: Input. |
-- Function: nl -- Function: nl
-- Function: nonl -- Function: nonl
These routines control whether <LFD> is translated into <RET> and These routines control whether <LFD> is translated into <RET> and
`LFD' on output, and whether <RET> is translated into <LFD> on 'LFD' on output, and whether <RET> is translated into <LFD> on |
input. Initially, the translations do occur. By disabling these input. Initially, the translations do occur. By disabling these
translations using `nonl', curses is able to make better use of translations using 'nonl', curses is able to make better use of the |
the linefeed capability, resulting in faster cursor motion. linefeed capability, resulting in faster cursor motion. |
-- Function: resetty -- Function: resetty
-- Function: savetty -- Function: savetty
These routines save and restore the state of the terminal modes. These routines save and restore the state of the terminal modes.
`savetty' saves the current state of the terminal in a buffer and 'savetty' saves the current state of the terminal in a buffer and |
`resetty' restores the state to what it was at the last call to 'resetty' restores the state to what it was at the last call to |
`savetty'. 'savetty'. |
 
File: scm-5f2.info, Node: Window Manipulation, Next: Output, Prev: Terminal M ode Setting, Up: Curses File: scm-5f3.info, Node: Window Manipulation, Next: Output, Prev: Terminal M ode Setting, Up: Curses
| |
5.12.3 Window Manipulation 5.12.3 Window Manipulation
-------------------------- --------------------------
-- Function: newwin nlines ncols begy begx -- Function: newwin nlines ncols begy begx
Create and return a new window with the given number of lines (or Create and return a new window with the given number of lines (or
rows), NLINES, and columns, NCOLS. The upper left corner of the rows), NLINES, and columns, NCOLS. The upper left corner of the
window is at line BEGY, column BEGX. If either NLINES or NCOLS is window is at line BEGY, column BEGX. If either NLINES or NCOLS is
0, they will be set to the value of `LINES'-BEGY and `COLS'-BEGX. 0, they will be set to the value of 'LINES'-BEGY and 'COLS'-BEGX. |
A new full-screen window is created by calling `newwin(0,0,0,0)'. A new full-screen window is created by calling 'newwin(0,0,0,0)'. |
-- Function: subwin orig nlines ncols begy begx -- Function: subwin orig nlines ncols begy begx
Create and return a pointer to a new window with the given number Create and return a pointer to a new window with the given number
of lines (or rows), NLINES, and columns, NCOLS. The window is at of lines (or rows), NLINES, and columns, NCOLS. The window is at
position (BEGY, BEGX) on the screen. This position is relative to position (BEGY, BEGX) on the screen. This position is relative to
the screen, and not to the window ORIG. The window is made in the the screen, and not to the window ORIG. The window is made in the
middle of the window ORIG, so that changes made to one window will middle of the window ORIG, so that changes made to one window will
affect both windows. When using this routine, often it will be affect both windows. When using this routine, often it will be
necessary to call `touchwin' or `touchline' on ORIG before calling necessary to call 'touchwin' or 'touchline' on ORIG before calling |
`force-output'. 'force-output'. |
-- Function: close-port win -- Function: close-port win
Deletes the window WIN, freeing up all memory associated with it. Deletes the window WIN, freeing up all memory associated with it.
In the case of sub-windows, they should be deleted before the main In the case of sub-windows, they should be deleted before the main
window WIN. window WIN.
-- Function: refresh -- Function: refresh
-- Function: force-output win -- Function: force-output win
These routines are called to write output to the terminal, as most These routines are called to write output to the terminal, as most
other routines merely manipulate data structures. `force-output' other routines merely manipulate data structures. 'force-output' |
copies the window WIN to the physical terminal screen, taking into copies the window WIN to the physical terminal screen, taking into
account what is already there in order to minimize the amount of account what is already there in order to minimize the amount of
information that's sent to the terminal (called optimization). information that's sent to the terminal (called optimization).