This is scm.info, produced by makeinfo version 4.8 from scm.texi. This manual is for SCM (version 5e5, February 2008), and algorithmic | language Scheme implementation. Copyright (C) 1990-2007 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this | document under the terms of the GNU Free Documentation License, | Version 1.2 or any later version published by the Free Software | Foundation; 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 Free Documentation License." | INFO-DIR-SECTION The Algorithmic Language Scheme START-INFO-DIR-ENTRY * SCM: (scm). A Scheme interpreter. END-INFO-DIR-ENTRY  File: scm.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) SCM *** This manual is for SCM (version 5e5, February 2008), and algorithmic | language Scheme implementation. Copyright (C) 1990-2007 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this | document under the terms of the GNU Free Documentation License, | Version 1.2 or any later version published by the Free Software | Foundation; 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 Free Documentation License." | * Menu: * Overview:: * Installing SCM:: How to * Operational Features:: * The Language:: Reference. * Packages:: Optional Capabilities. * The Implementation:: How it works. * Index::  File: scm.info, Node: Overview, Next: Installing SCM, Prev: Top, Up: Top 1 Overview ********** SCM is a portable Scheme implementation written in C. SCM provides a | machine independent platform for [JACAL], a symbolic algebra system. SCM supports and requires the SLIB Scheme library. SCM, SLIB, and | JACAL are GNU projects. | * Menu: * SCM Features:: * SCM Authors:: * Copying:: * Bibliography::  File: scm.info, Node: SCM Features, Next: SCM Authors, Prev: Overview, Up: Overview 1.1 Features ============ * Conforms to Revised^5 Report on the Algorithmic Language Scheme [R5RS] and the [IEEE] P1178 specification. * Support for [SICP], [R2RS], [R3RS], and [R5RS] scheme code. * Runs under Amiga, Atari-ST, MacOS, MS-DOS, OS/2, NOS/VE, Unicos, VMS, Unix and similar systems. Supports ASCII and EBCDIC character sets. * Is fully documented in TeXinfo form, allowing documentation to be generated in info, TeX, html, nroff, and troff formats. * Supports inexact real and complex numbers, 30 bit immediate integers and large precision integers. * Many Common Lisp functions: `logand', `logor', `logxor', `lognot', `ash', `logcount', `integer-length', `bit-extract', `defmacro', `macroexpand', `macroexpand1', `gentemp', `defvar', `force-output', `software-type', `get-decoded-time', `get-internal-run-time', `get-internal-real-time', `delete-file', `rename-file', `copy-tree', `acons', and `eval'. * `Char-code-limit', `most-positive-fixnum', `most-negative-fixnum', `and internal-time-units-per-second' constants. `slib:features' and `*load-pathname*' variables. * Arrays and bit-vectors. String ports and software emulation ports. I/O extensions providing ANSI C and POSIX.1 facilities. * Interfaces to standard libraries including REGEX string regular expression matching and the CURSES screen management package. * Available add-on packages including an interactive debugger, database, X-window graphics, BGI graphics, Motif, and Open-Windows packages. * The Hobbit compiler and dynamic linking of compiled modules. | * User definable responses to interrupts and errors, Process-syncronization primitives. Setable levels of monitoring and timing information printed interactively (the `verbose' function). `Restart', `quit', and `exec'.  File: scm.info, Node: SCM Authors, Next: Copying, Prev: SCM Features, Up: Overview 1.2 Authors =========== Aubrey Jaffer (agj @ alum.mit.edu) Most of SCM. Radey Shouman Arrays, `gsubr's, compiled closures, records, Ecache, syntax-rules macros, and "safeport"s. Jerry D. Hedden Real and Complex functions. Fast mixed type arithmetics. Hugh Secker-Walker Syntax checking and memoization of special forms by evaluator. Storage allocation strategy and parameters. George Carrette "Siod", written by George Carrette, was the starting point for SCM. 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 (*note Garbage Collection::). 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: scm.info, Node: Copying, Next: Bibliography, Prev: SCM Authors, Up: Overview 1.3 Copyright ============= Authors have assigned their SCM copyrights to: Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111, USA * Menu: * The SCM License:: * SIOD copyright:: * GNU Free Documentation License:: Copying this Manual  File: scm.info, Node: The SCM License, Next: SIOD copyright, Prev: Copying, Up: Copying 1.3.1 The SCM License --------------------- This program is free software: you can redistribute it and/or modify it | under the terms of the GNU Lesser General Public License as published | by the Free Software Foundation, either version 3 of the License, or | (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | You should have received a copy of the GNU Lesser General Public | License along with this program. If not, see | `http://www.gnu.org/licenses/'. |  File: scm.info, Node: SIOD copyright, Next: GNU Free Documentation License, Prev: The SCM License, Up: Copying | 1.3.2 SIOD copyright -------------------- COPYRIGHT (C) 1989 BY PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS. ALL RIGHTS RESERVED Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Paradigm Associates Inc not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. PARADIGM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL PARADIGM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF 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 PERFORMANCE OF THIS SOFTWARE. gjc@paradigm.com Phone: 617-492-6079 Paradigm Associates Inc 29 Putnam Ave, Suite 6 Cambridge, MA 02138  File: scm.info, Node: GNU Free Documentation License, Prev: SIOD copyright, Up: Copying | 1.3.3 GNU Free Documentation License | ------------------------------------ | | Version 1.2, November 2002 | | Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. | 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | | Everyone is permitted to copy and distribute verbatim copies | of this license document, but changing it is not allowed. | | 0. PREAMBLE | | The purpose of this License is to make a manual, textbook, or other | functional and useful document "free" in the sense of freedom: to | assure everyone the effective freedom to copy and redistribute it, | with or without modifying it, either commercially or | noncommercially. Secondarily, this License preserves for the | author and publisher a way to get credit for their work, while not | being considered responsible for modifications made by others. | | This License is a kind of "copyleft", which means that derivative | works of the document must themselves be free in the same sense. | It complements the GNU General Public License, which is a copyleft | license designed for free software. | | We have designed this License in order to use it for manuals for | free software, because free software needs free documentation: a | free program should come with manuals providing the same freedoms | that the software does. But this License is not limited to | software manuals; it can be used for any textual work, regardless | of subject matter or whether it is published as a printed book. | We recommend this License principally for works whose purpose is | instruction or reference. | | 1. APPLICABILITY AND DEFINITIONS | | This License applies to any manual or other work, in any medium, | that contains a notice placed by the copyright holder saying it | can be distributed under the terms of this License. Such a notice | grants a world-wide, royalty-free license, unlimited in duration, | to use that work under the conditions stated herein. The | "Document", below, refers to any such manual or work. Any member | of the public is a licensee, and is addressed as "you". You | accept the license if you copy, modify or distribute the work in a | way requiring permission under copyright law. | | A "Modified Version" of the Document means any work containing the | Document or a portion of it, either copied verbatim, or with | modifications and/or translated into another language. | | A "Secondary Section" is a named appendix or a front-matter section | of the Document that deals exclusively with the relationship of the | publishers or authors of the Document to the Document's overall | subject (or to related matters) and contains nothing that could | fall directly within that overall subject. (Thus, if the Document | is in part a textbook of mathematics, a Secondary Section may not | explain any mathematics.) The relationship could be a matter of | historical connection with the subject or with related matters, or | of legal, commercial, philosophical, ethical or political position | regarding them. | | The "Invariant Sections" are certain Secondary Sections whose | titles are designated, as being those of Invariant Sections, in | the notice that says that the Document is released under this | License. If a section does not fit the above definition of | Secondary then it is not allowed to be designated as Invariant. | The Document may contain zero Invariant Sections. If the Document | does not identify any Invariant Sections then there are none. | | The "Cover Texts" are certain short passages of text that are | listed, as Front-Cover Texts or Back-Cover Texts, in the notice | 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 | be at most 25 words. | | A "Transparent" copy of the Document means a machine-readable copy, | represented in a format whose specification is available to the | general public, that is suitable for revising the document | straightforwardly with generic text editors or (for images | composed of pixels) generic paint programs or (for drawings) some | widely available drawing editor, and that is suitable for input to | text formatters or for automatic translation to a variety of | formats suitable for input to text formatters. A copy made in an | otherwise Transparent file format whose markup, or absence of | markup, has been arranged to thwart or discourage subsequent | modification by readers is not Transparent. An image format is | not Transparent if used for any substantial amount of text. A | copy that is not "Transparent" is called "Opaque". | | Examples of suitable formats for Transparent copies include plain | ASCII without markup, Texinfo input format, LaTeX input format, | SGML or XML using a publicly available DTD, and | standard-conforming simple HTML, PostScript or PDF designed for | human modification. Examples of transparent image formats include | PNG, XCF and JPG. Opaque formats include proprietary formats that | can be read and edited only by proprietary word processors, SGML or | XML for which the DTD and/or processing tools are not generally | available, and the machine-generated HTML, PostScript or PDF | produced by some word processors for output purposes only. | | The "Title Page" means, for a printed book, the title page itself, | plus such following pages as are needed to hold, legibly, the | material this License requires to appear in the title page. For | works in formats which do not have any title page as such, "Title | Page" means the text near the most prominent appearance of the | work's title, preceding the beginning of the body of the text. | | A section "Entitled XYZ" means a named subunit of the Document | whose title either is precisely XYZ or contains XYZ in parentheses | following text that translates XYZ in another language. (Here XYZ | stands for a specific section name mentioned below, such as | "Acknowledgements", "Dedications", "Endorsements", or "History".) | To "Preserve the Title" of such a section when you modify the | Document means that it remains a section "Entitled XYZ" according | to this definition. | | The Document may include Warranty Disclaimers next to the notice | which states that this License applies to the Document. These | Warranty Disclaimers are considered to be included by reference in | this License, but only as regards disclaiming warranties: any other | implication that these Warranty Disclaimers may have is void and | has no effect on the meaning of this License. | | 2. VERBATIM COPYING | | You may copy and distribute the Document in any medium, either | commercially or noncommercially, provided that this License, the | copyright notices, and the license notice saying this License | applies to the Document are reproduced in all copies, and that you | add no other conditions whatsoever to those of this License. You | may not use technical measures to obstruct or control the reading | or further copying of the copies you make or distribute. However, | you may accept compensation in exchange for copies. If you | distribute a large enough number of copies you must also follow | the conditions in section 3. | | You may also lend copies, under the same conditions stated above, | and you may publicly display copies. | | 3. COPYING IN QUANTITY | | If you publish printed copies (or copies in media that commonly | have printed covers) of the Document, numbering more than 100, and | the Document's license notice requires Cover Texts, you must | enclose the copies in covers that carry, clearly and legibly, all | these Cover Texts: Front-Cover Texts on the front cover, and | Back-Cover Texts on the back cover. Both covers must also clearly | and legibly identify you as the publisher of these copies. The | front cover must present the full title with all words of the | title equally prominent and visible. You may add other material | on the covers in addition. Copying with changes limited to the | covers, as long as they preserve the title of the Document and | satisfy these conditions, can be treated as verbatim copying in | other respects. | | If the required texts for either cover are too voluminous to fit | legibly, you should put the first ones listed (as many as fit | reasonably) on the actual cover, and continue the rest onto | adjacent pages. | | If you publish or distribute Opaque copies of the Document | numbering more than 100, you must either include a | machine-readable Transparent copy along with each Opaque copy, or | state in or with each Opaque copy a computer-network location from | which the general network-using public has access to download | using public-standard network protocols a complete Transparent | copy of the Document, free of added material. If you use the | latter option, you must take reasonably prudent steps, when you | begin distribution of Opaque copies in quantity, to ensure that | this Transparent copy will remain thus accessible at the stated | location until at least one year after the last time you | distribute an Opaque copy (directly or through your agents or | retailers) of that edition to the public. | | It is requested, but not required, that you contact the authors of | the Document well before redistributing any large number of | copies, to give them a chance to provide you with an updated | version of the Document. | | 4. MODIFICATIONS | | You may copy and distribute a Modified Version of the Document | under the conditions of sections 2 and 3 above, provided that you | release the Modified Version under precisely this License, with | the Modified Version filling the role of the Document, thus | licensing distribution and modification of the Modified Version to | whoever possesses a copy of it. In addition, you must do these | things in the Modified Version: | | A. Use in the Title Page (and on the covers, if any) a title | distinct from that of the Document, and from those of | previous versions (which should, if there were any, be listed | in the History section of the Document). You may use the | same title as a previous version if the original publisher of | that version gives permission. | | B. List on the Title Page, as authors, one or more persons or | entities responsible for authorship of the modifications in | the Modified Version, together with at least five of the | principal authors of the Document (all of its principal | authors, if it has fewer than five), unless they release you | from this requirement. | | C. State on the Title page the name of the publisher of the | Modified Version, as the publisher. | | D. Preserve all the copyright notices of the Document. | | E. Add an appropriate copyright notice for your modifications | adjacent to the other copyright notices. | | F. Include, immediately after the copyright notices, a license | notice giving the public permission to use the Modified | Version under the terms of this License, in the form shown in | the Addendum below. | | G. Preserve in that license notice the full lists of Invariant | Sections and required Cover Texts given in the Document's | license notice. | | H. Include an unaltered copy of this License. | | I. Preserve the section Entitled "History", Preserve its Title, | and add to it an item stating at least the title, year, new | authors, and publisher of the Modified Version as given on | the Title Page. If there is no section Entitled "History" in | the Document, create one stating the title, year, authors, | and publisher of the Document as given on its Title Page, | then add an item describing the Modified Version as stated in | the previous sentence. | | J. Preserve the network location, if any, given in the Document | for public access to a Transparent copy of the Document, and | likewise the network locations given in the Document for | previous versions it was based on. These may be placed in | the "History" section. You may omit a network location for a | work that was published at least four years before the | Document itself, or if the original publisher of the version | it refers to gives permission. | | K. For any section Entitled "Acknowledgements" or "Dedications", | Preserve the Title of the section, and preserve in the | section all the substance and tone of each of the contributor | acknowledgements and/or dedications given therein. | | L. Preserve all the Invariant Sections of the Document, | unaltered in their text and in their titles. Section numbers | or the equivalent are not considered part of the section | titles. | | M. Delete any section Entitled "Endorsements". Such a section | may not be included in the Modified Version. | | N. Do not retitle any existing section to be Entitled | "Endorsements" or to conflict in title with any Invariant | Section. | | O. Preserve any Warranty Disclaimers. | | If the Modified Version includes new front-matter sections or | appendices that qualify as Secondary Sections and contain no | material copied from the Document, you may at your option | designate some or all of these sections as invariant. To do this, | add their titles to the list of Invariant Sections in the Modified | Version's license notice. These titles must be distinct from any | other section titles. | | You may add a section Entitled "Endorsements", provided it contains | nothing but endorsements of your Modified Version by various | parties--for example, statements of peer review or that the text | has been approved by an organization as the authoritative | definition of a standard. | | 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 | of the list of Cover Texts in the Modified Version. Only one | passage of Front-Cover Text and one of Back-Cover Text may be | added by (or through arrangements made by) any one entity. If the | Document already includes a cover text for the same cover, | previously added by you or by arrangement made by the same entity | you are acting on behalf of, you may not add another; but you may | replace the old one, on explicit permission from the previous | publisher that added the old one. | | 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 | assert or imply endorsement of any Modified Version. | | 5. COMBINING DOCUMENTS | | You may combine the Document with other documents released under | this License, under the terms defined in section 4 above for | modified versions, provided that you include in the combination | all of the Invariant Sections of all of the original documents, | unmodified, and list them all as Invariant Sections of your | combined work in its license notice, and that you preserve all | their Warranty Disclaimers. | | The combined work need only contain one copy of this License, and | multiple identical Invariant Sections may be replaced with a single | copy. If there are multiple Invariant Sections with the same name | but different contents, make the title of each such section unique | 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 | unique number. Make the same adjustment to the section titles in | the list of Invariant Sections in the license notice of the | combined work. | | In the combination, you must combine any sections Entitled | "History" in the various original documents, forming one section | Entitled "History"; likewise combine any sections Entitled | "Acknowledgements", and any sections Entitled "Dedications". You | must delete all sections Entitled "Endorsements." | | 6. COLLECTIONS OF DOCUMENTS | | You may make a collection consisting of the Document and other | documents released under this License, and replace the individual | copies of this License in the various documents with a single copy | that is included in the collection, provided that you follow the | rules of this License for verbatim copying of each of the | documents in all other respects. | | You may extract a single document from such a collection, and | distribute it individually under this License, provided you insert | a copy of this License into the extracted document, and follow | this License in all other respects regarding verbatim copying of | that document. | | 7. AGGREGATION WITH INDEPENDENT WORKS | | A compilation of the Document or its derivatives with other | separate and independent documents or works, in or on a volume of | a storage or distribution medium, is called an "aggregate" if the | copyright resulting from the compilation is not used to limit the | legal rights of the compilation's users beyond what the individual | works permit. When the Document is included in an aggregate, this | License does not apply to the other works in the aggregate which | are not themselves derivative works of the Document. | | 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 | of the entire aggregate, the Document's Cover Texts may be placed | on covers that bracket the Document within the aggregate, or the | electronic equivalent of covers if the Document is in electronic | form. Otherwise they must appear on printed covers that bracket | the whole aggregate. | | 8. TRANSLATION | | Translation is considered a kind of modification, so you may | distribute translations of the Document under the terms of section | 4. Replacing Invariant Sections with translations requires special | permission from their copyright holders, but you may include | translations of some or all Invariant Sections in addition to the | original versions of these Invariant Sections. You may include a | translation of this License, and all the license notices in the | Document, and any Warranty Disclaimers, provided that you also | include the original English version of this License and the | original versions of those notices and disclaimers. In case of a | disagreement between the translation and the original version of | this License or a notice or disclaimer, the original version will | prevail. | | If a section in the Document is Entitled "Acknowledgements", | "Dedications", or "History", the requirement (section 4) to | Preserve its Title (section 1) will typically require changing the | actual title. | | 9. TERMINATION | | You may not copy, modify, sublicense, or distribute the Document | except as expressly provided for under this License. Any other | attempt to copy, modify, sublicense or distribute the Document is | void, and will automatically terminate your rights under this | License. However, parties who have received copies, or rights, | from you under this License will not have their licenses | terminated so long as such parties remain in full compliance. | | 10. FUTURE REVISIONS OF THIS LICENSE | | The Free Software Foundation may publish new, revised versions of | the GNU Free Documentation License from time to time. Such new | versions will be similar in spirit to the present version, but may | differ in detail to address new problems or concerns. See | `http://www.gnu.org/copyleft/'. | | Each version of the License is given a distinguishing version | number. If the Document specifies that a particular numbered | version of this License "or any later version" applies to it, you | have the option of following the terms and conditions either of | that specified version or of any later version that has been | published (not as a draft) by the Free Software Foundation. If | the Document does not specify a version number of this License, | you may choose any version ever published (not as a draft) by the | Free Software Foundation. | | ADDENDUM: How to use this License for your documents | ==================================================== | | To use this License in a document you have written, include a copy of | the License in the document and put the following copyright and license | notices just after the title page: | | Copyright (C) YEAR YOUR NAME. | Permission is granted to copy, distribute and/or modify this document | under the terms of the GNU Free Documentation License, Version 1.2 | or any later version published by the Free Software Foundation; | 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 Free Documentation License''. | | If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, | replace the "with...Texts." line with this: | | with the Invariant Sections being LIST THEIR TITLES, with | the Front-Cover Texts being LIST, and with the Back-Cover Texts | being LIST. | | If you have Invariant Sections without Cover Texts, or some other | combination of the three, merge those two alternatives to suit the | situation. | | If your document contains nontrivial examples of program code, we | recommend releasing these examples in parallel under your choice of | free software license, such as the GNU General Public License, to | permit their use in free software. | |  File: scm.info, Node: Bibliography, Prev: Copying, Up: Overview | 1.4 Bibliography ================ [IEEE] `IEEE Standard 1178-1990. IEEE Standard for the Scheme Programming Language.' IEEE, New York, 1991. [R4RS] William Clinger and Jonathan Rees, Editors. Revised(4) Report on the Algorithmic Language Scheme. `ACM Lisp Pointers' Volume IV, Number 3 (July-September 1991), pp. 1-55. *Note Top: (r4rs)Top. [R5RS] Richard Kelsey and William Clinger and Jonathan (Rees, editors) Revised(5) Report on the Algorithmic Language Scheme. `Higher-Order and Symbolic Computation' Volume 11, Number 1 (1998), pp. 7-105, and `ACM SIGPLAN Notices' 33(9), September 1998. *Note Top: (r5rs)Top. [Exrename] William Clinger Hygienic Macros Through Explicit Renaming `Lisp Pointers' Volume IV, Number 4 (December 1991), pp 17-23. [SICP] Harold Abelson and Gerald Jay Sussman with Julie Sussman. `Structure and Interpretation of Computer Programs.' MIT Press, Cambridge, 1985. [Simply] Brian Harvey and Matthew Wright. `Simply Scheme: Introducing Computer Science' MIT Press, 1994 ISBN 0-262-08226-8 [SchemePrimer] 犬飼大(Dai Inukai) `入門Scheme' 1999年12月初版 ISBN4-87966-954-7 [SLIB] Todd R. Eigenschink, Dave Love, and Aubrey Jaffer. SLIB, The Portable Scheme Library. Version 2c8, June 2000. *Note Top: (slib)Top. [JACAL] Aubrey Jaffer. JACAL Symbolic Mathematics System. Version 1b0, Sep 1999. *Note Top: (jacal)Top. `scm.texi' `scm.info' Documentation of `scm' extensions (beyond Scheme standards). Documentation on the internal representation and how to extend or include `scm' in other programs. `Xlibscm.texi' `Xlibscm.info' Documentation of the Xlib - SCM Language X Interface.  File: scm.info, Node: Installing SCM, Next: Operational Features, Prev: Overview, Up: Top 2 Installing SCM **************** * Menu: * Making SCM:: Bootstrapping. * SLIB:: REQUIREd reading. * Building SCM:: * Installing Dynamic Linking:: * Configure Module Catalog:: * Saving Images:: Make Fast-Booting Executables * Automatic C Preprocessor Definitions:: * Problems Compiling:: * Problems Linking:: * Problems Running:: * Testing:: * Reporting Problems::  File: scm.info, Node: Making SCM, Next: SLIB, Prev: Installing SCM, Up: Installing SCM 2.1 Making SCM ============== The SCM distribution has "Makefile" which contains rules for making "scmlit", a "bare-bones" version of SCM sufficient for running `build'. `build' is used to compile (or create scripts to compile) full featured versions (*note Building SCM::). Makefiles are not portable to the majority of platforms. If `Makefile' works for you, good; If not, I don't want to hear about it. If you need to compile SCM without build, there are several ways to proceed: * Use the build (http://swiss.csail.mit.edu/~jaffer/buildscm.html) web page to create custom batch scripts for compiling SCM. * Use SCM on a different platform to run `build' to create a script to build SCM; * Use another implementation of Scheme to run `build' to create a script to build SCM; * Create your own script or `Makefile'.  File: scm.info, Node: SLIB, Next: Building SCM, Prev: Making SCM, Up: Installing SCM 2.2 SLIB ======== [SLIB] is a portable Scheme library meant to provide compatibility and utility functions for all standard Scheme implementations. Although SLIB is not _neccessary_ to run SCM, I strongly suggest you obtain and install it. Bug reports about running SCM without SLIB have very low priority. SLIB is available from the same sites as SCM: * swiss.csail.mit.edu:/pub/scm/slib-3b1.tar.gz | * ftp.gnu.org:/pub/gnu/jacal/slib-3b1.tar.gz | Unpack SLIB (`tar xzf slib-3b1.tar.gz' or `unzip -ao slib-3b1.zip') in | an appropriate directory for your system; both `tar' and `unzip' will | create the directory `slib'. Then create a file `require.scm' in the SCM "implementation-vicinity" (this is the same directory as where the file `Init5e5.scm' is | installed). `require.scm' should have the contents: (define (library-vicinity) "/usr/local/lib/slib/") where the pathname string `/usr/local/lib/slib/' is to be replaced by the pathname into which you installed SLIB. Absolute pathnames are recommended here; if you use a relative pathname, SLIB can get confused when the working directory is changed (*note chmod: I/O-Extensions.). The way to specify a relative pathname is to append it to the implementation-vicinity, which is absolute: (define library-vicinity (let ((lv (string-append (implementation-vicinity) "../slib/"))) (lambda () lv))) Alternatively, you can set the (shell) environment variable `SCHEME_LIBRARY_PATH' to the pathname of the SLIB directory (*note SCHEME_LIBRARY_PATH: SCM Variables.). If set, the environment variable overrides `require.scm'. Again, absolute pathnames are recommended.  File: scm.info, Node: Building SCM, Next: Installing Dynamic Linking, Prev: SLIB, Up: Installing SCM 2.3 Building SCM ================ The file "build" loads the file "build.scm", which constructs a relational database of how to compile and link SCM executables. `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, incorrect, or incomplete. Send corrections and additions to jaffer @ ai.mit.edu. * Menu: * Invoking Build:: * Build Options:: * Compiling and Linking Custom Files::  File: scm.info, Node: Invoking Build, Next: Build Options, Prev: Building SCM, Up: Building SCM 2.3.1 Invoking Build -------------------- The _all_ method will also work for MS-DOS and unix. Use the _all_ method if you encounter problems with `build'. MS-DOS From the SCM source directory, type `build' followed by up to 9 command line arguments. unix From the SCM source directory, type `./build' followed by command line arguments. _all_ From the SCM source directory, start `scm' or `scmlit' and type `(load "build")'. Alternatively, start `scm' or `scmlit' with the command line argument `-ilbuild'. Invoking build without the `-F' option will build or create a shell script with the `arrays', `inexact', and `bignums' options as defaults. bash$ ./build -| #! /bin/sh # unix (linux) script created by SLIB/batch # ================ Write file with C defines rm -f scmflags.h echo '#define IMPLINIT "Init5e5.scm"'>>scmflags.h | echo '#define BIGNUMS'>>scmflags.h echo '#define FLOATS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h # ================ 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 # ================ 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 To cross compile for another platform, invoke build with the `-p' or `--platform=' option. This will create a script for the platform named in the `-p' or `--platform=' option. bash$ ./build -o scmlit -p darwin -F lit -| #! /bin/sh # unix (darwin) script created by SLIB/batch # ================ Write file with C defines rm -f scmflags.h echo '#define IMPLINIT "Init5e5.scm"'>>scmflags.h | # ================ 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 # ================ Link C object files mv -f scmlit scmlit~ cc -o scmlit 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  File: scm.info, Node: Build Options, Next: Compiling and Linking Custom Files, Prev: Invoking Build, Up: Building SCM 2.3.2 Build Options ------------------- The options to "build" specify what, where, and how to build a SCM program or dynamically linked module. These options are unrelated to the SCM command line options. -- Build Option: -p PLATFORM-NAME -- Build Option: --platform=PLATFORM-NAME specifies that the compilation should be for a computer/operating-system combination called PLATFORM-NAME. _Note_ The case of PLATFORM-NAME is distinguised. The current PLATFORM-NAMEs are all lower-case. The platforms defined by table "platform" in `build.scm' are: Table: platform name processor operating-system compiler #f processor-family operating-system #f symbol processor-family operating-system symbol symbol symbol symbol symbol ================= ================= ================= ================= *unknown* *unknown* unix cc acorn-unixlib acorn *unknown* cc aix powerpc aix cc alpha-elf alpha unix cc alpha-linux alpha linux gcc amiga-aztec m68000 amiga cc amiga-dice-c m68000 amiga dcc amiga-gcc m68000 amiga gcc amiga-sas m68000 amiga lc atari-st-gcc m68000 atari-st gcc atari-st-turbo-c m68000 atari-st tcc borland-c i8086 ms-dos bcc darwin powerpc unix cc djgpp i386 ms-dos gcc freebsd *unknown* unix cc gcc *unknown* unix gcc gnu-win32 i386 unix gcc highc i386 ms-dos hc386 hp-ux hp-risc hp-ux cc irix mips irix gcc linux *unknown* linux gcc linux-aout i386 linux gcc linux-ia64 ia64 linux gcc microsoft-c i8086 ms-dos cl microsoft-c-nt i386 ms-dos cl microsoft-quick-c i8086 ms-dos qcl ms-dos i8086 ms-dos cc netbsd *unknown* unix gcc openbsd *unknown* unix gcc os/2-cset i386 os/2 icc os/2-emx i386 os/2 gcc osf1 alpha unix cc plan9-8 i386 plan9 8c sunos sparc sunos cc svr4 *unknown* unix cc svr4-gcc-sun-ld sparc sunos gcc turbo-c i8086 ms-dos tcc unicos cray unicos cc unix *unknown* unix cc vms vax vms cc vms-gcc vax vms gcc watcom-9.0 i386 ms-dos wcc386p -- Build Option: -f PATHNAME specifies that the build options contained in PATHNAME be spliced into the argument list at this point. The use of option files can separate functional features from platform-specific ones. The `Makefile' calls out builds with the options in `.opt' files: `dlls.opt' Options for Makefile targets mydlls, myturtle, and x.so. `gdb.opt' Options for udgdbscm and gdbscm. `libscm.opt' Options for libscm.a. `pg.opt' Options for pgscm, which instruments C functions. `udscm4.opt' Options for targets udscm4 and dscm4 (scm). `udscm5.opt' Options for targets udscm5 and dscm5 (scm). The Makefile creates options files it depends on only if they do not already exist. -- Build Option: -o FILENAME -- Build Option: --outname=FILENAME specifies that the compilation should produce an executable or object name of FILENAME. The default is `scm'. Executable suffixes will be added if neccessary, e.g. `scm' => `scm.exe'. -- Build Option: -l LIBNAME ... -- Build Option: --libraries=LIBNAME specifies that the LIBNAME should be linked with the executable produced. If compile flags or include directories (`-I') are needed, they are automatically supplied for compilations. The `c' library is always included. SCM "features" specify any libraries they need; so you shouldn't need this option often. -- Build Option: -D DEFINITION ... -- Build Option: --defines=DEFINITION specifies that the DEFINITION should be made in any C source compilations. If compile flags or include directories (`-I') are needed, they are automatically supplied for compilations. SCM "features" specify any flags they need; so you shouldn't need this option often. -- Build Option: --compiler-options=FLAG specifies that that FLAG will be put on compiler command-lines. -- Build Option: --linker-options=FLAG specifies that that FLAG will be put on linker command-lines. -- Build Option: -s PATHNAME -- Build Option: --scheme-initial=PATHNAME specifies that PATHNAME should be the default location of the SCM initialization file `Init5e5.scm'. SCM tries several likely | locations before resorting to PATHNAME (*note File-System Habitat::). If not specified, the current directory (where build is building) is used. -- Build Option: -c PATHNAME ... -- Build Option: --c-source-files=PATHNAME specifies that the C source files PATHNAME ... are to be compiled. -- Build Option: -j PATHNAME ... -- Build Option: --object-files=PATHNAME specifies that the object files PATHNAME ... are to be linked. -- Build Option: -i CALL ... -- Build Option: --initialization=CALL specifies that the C functions CALL ... are to be invoked during initialization. -- Build Option: -t BUILD-WHAT -- Build Option: --type=BUILD-WHAT specifies in general terms what sort of thing to build. The choices are: `exe' executable program. `lib' library module. `dlls' archived dynamically linked library object files. `dll' dynamically linked library object file. The default is to build an executable. -- Build Option: -h BATCH-SYNTAX -- Build Option: -batch-dialect=BATCH-SYNTAX 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 batch files for: * unix * dos * vms * amigaos (was amigados) * system This option executes the compilation and linking commands through the use of the `system' procedure. * *unknown* This option outputs Scheme code. -- Build Option: -w BATCH-FILENAME -- Build Option: -script-name=BATCH-FILENAME specifies where to write the build script. The default is to display it on `(current-output-port)'. -- Build Option: -F FEATURE ... -- Build Option: --features=FEATURE specifies to build the given features into the executable. The defined features are: "array" Alias for ARRAYS "array-for-each" array-map! and array-for-each (arrays must also be featured). "arrays" Use if you want arrays, uniform-arrays and uniform-vectors. "bignums" Large precision integers. "byte" Treating strings as byte-vectors. "byte-number" Byte/number conversions "careful-interrupt-masking" Define this for extra checking of interrupt masking and some 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 interpreter several times slower than usual. "cautious" Normally, the number of arguments arguments to interpreted closures (from LAMBDA) are checked if the function part of a form is not a symbol or only the first time the form is executed if the function part is a symbol. defining `reckless' disables any checking. If you want to have SCM always check the number of arguments to interpreted closures define feature `cautious'. "cheap-continuations" If you only need straight stack continuations, executables compile with this feature will run faster and use less storage than not having it. Machines with unusual stacks _need_ this. Also, if you incorporate new C code into scm which uses VMS system services or library routines (which need to unwind the stack in an ordrly manner) you may need to use this feature. "compiled-closure" Use if you want to use compiled closures. "curses" For the "curses" screen management package. "debug" Turns on the features `cautious' and `careful-interrupt-masking'; uses `-g' flags for debugging SCM source code. "differ" Sequence comparison "dont-memoize-locals" SCM normally converts references to local variables to ILOCs, which make programs run faster. If SCM is badly broken, try using this option to disable the MEMOIZE_LOCALS feature. "dump" Convert a running scheme program into an executable file. "dynamic-linking" Be able to load compiled files while running. "edit-line" interface to the editline or GNU readline library. "engineering-notation" Use if you want floats to display in engineering notation (exponents always multiples of 3) instead of scientific notation. "generalized-c-arguments" `make_gsubr' for arbitrary (< 11) arguments to C functions. "i/o-extensions" Commonly available I/O extensions: "exec", line I/O, file positioning, file delete and rename, and directory functions. "inexact" Use if you want floating point numbers. "lit" Lightweight - no features "macro" C level support for hygienic and referentially transparent macros (syntax-rules macros). "mysql" Client connections to the mysql databases. "no-heap-shrink" Use if you want segments of unused heap to not be freed up after garbage collection. This may increase time in GC for *very* large working sets. "none" No features "posix" Posix functions available on all "Unix-like" systems. fork and process functions, user and group IDs, file permissions, and "link". "reckless" If your scheme code runs without any errors you can disable almost all error checking by compiling all files with `reckless'. "record" The Record package provides a facility for user to define their own record data types. See SLIB for documentation. "regex" String regular expression matching. "rev2-procedures" These procedures were specified in the `Revised^2 Report on Scheme' but not in `R4RS'. "sicp" Use if you want to run code from: Harold Abelson and Gerald Jay Sussman with Julie Sussman. `Structure and Interpretation of Computer Programs.' The MIT Press, Cambridge, Massachusetts, USA, 1985. Differences from R5RS are: * (eq? '() '#f) * (define a 25) returns the symbol a. * (set! a 36) returns 36. "single-precision-only" Use if you want all inexact real numbers to be single precision. This only has an effect if SINGLES is also defined (which is the default). This does not affect complex numbers. "socket" BSD "socket" interface. Socket addr functions require inexacts or bignums for 32-bit precision. "tick-interrupts" Use if you want the ticks and ticks-interrupt functions. "turtlegr" "Turtle" graphics calls for both Borland-C and X11 from sjm@ee.tut.fi. "unix" Those unix features which have not made it into the Posix specs: nice, acct, lstat, readlink, symlink, mknod and sync. "wb" WB database with relational wrapper. "windows" Microsoft Windows executable. "x" Alias for Xlib feature. "xlib" Interface to Xlib graphics routines.  File: scm.info, Node: Compiling and Linking Custom Files, Prev: Build Options, Up: Building SCM 2.3.3 Compiling and Linking Custom Files ---------------------------------------- A correspondent asks: 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 functions we want access to). Would this involve changing build.scm or the Makefile or both? (*note Changing Scm:: has instructions describing the C code format). Suppose a C file "foo.c" has functions you wish to add to SCM. To compile and link your file at compile time, use the `-c' and `-i' options to build: bash$ ./build -c foo.c -i init_foo -| #! /bin/sh rm -f scmflags.h echo '#define IMPLINIT "/home/jaffer/scm/Init5e5.scm"'>>scmflags.h | echo '#define COMPILED_INITS init_foo();'>>scmflags.h echo '#define BIGNUMS'>>scmflags.h echo '#define FLOATS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h 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 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 To make a dynamically loadable object file use the `-t dll' option: bash$ ./build -t dll -c foo.c -| #! /bin/sh rm -f scmflags.h echo '#define IMPLINIT "/home/jaffer/scm/Init5e5.scm"'>>scmflags.h | echo '#define BIGNUMS'>>scmflags.h echo '#define FLOATS'>>scmflags.h echo '#define ARRAYS'>>scmflags.h echo '#define DLL'>>scmflags.h gcc -O2 -fpic -c foo.c gcc -shared -o foo.so foo.o -lm -lc Once `foo.c' compiles correctly (and your SCM build supports dynamic-loading), you can load the compiled file with the Scheme command `(load "./foo.so")'. See *Note Configure Module Catalog:: for how to add a compiled dll file to SLIB's catalog.  File: scm.info, Node: Installing Dynamic Linking, Next: Configure Module Catalog, Prev: Building SCM, Up: Installing SCM 2.4 Installing Dynamic Linking ============================== Dynamic linking has not been ported to all platforms. Operating systems in the BSD family (a.out binary format) can usually be ported to "DLD". The "dl" library (`#define SUN_DL' for SCM) was a proposed POSIX standard and may be available on other machines with "COFF" binary format. For notes about porting to MS-Windows and finishing the port to VMS *Note VMS Dynamic Linking::. "DLD" is a library package of C functions that performs "dynamic link editing" on GNU/Linux, VAX (Ultrix), Sun 3 (SunOS 3.4 and 4.0), SPARCstation (SunOS 4.0), Sequent Symmetry (Dynix), and Atari ST. It is available from: * ftp.gnu.org:pub/gnu/dld-3.3.tar.gz These notes about using libdl on SunOS are from `gcc.info': On a Sun, linking using GNU CC fails to find a shared library and reports that the library doesn't exist at all. This happens if you are using the GNU linker, because it does only static linking and looks only for unshared libraries. If you have a shared library with no unshared counterpart, the GNU linker won't find anything. We hope to make a linker which supports Sun shared libraries, but please don't ask when it will be finished-we don't know. Sun forgot to include a static version of `libdl.a' with some versions of SunOS (mainly 4.1). This results in undefined symbols when linking static binaries (that is, if you use `-static'). If you see undefined symbols `_dlclose', `_dlsym' or `_dlopen' when linking, compile and link against the file `mit/util/misc/dlsym.c' from the MIT version of X windows.  File: scm.info, Node: Configure Module Catalog, Next: Saving Images, Prev: Installing Dynamic Linking, Up: Installing SCM 2.5 Configure Module Catalog ============================ The SLIB module "catalog" can be extended to define other `require'-able packages by adding calls to the Scheme source file `mkimpcat.scm'. Within `mkimpcat.scm', the following procedures are defined. -- Function: add-link feature object-file lib1 ... FEATURE should be a symbol. OBJECT-FILE should be a string naming a file containing compiled "object-code". Each LIBn argument should be either a string naming a library file or `#f'. If OBJECT-FILE exists, the `add-link' procedure registers symbol FEATURE so that the first time `require' is called with the symbol FEATURE as its argument, OBJECT-FILE and the LIB1 ... are dynamically linked into the executing SCM session. If OBJECT-FILE exists, `add-link' returns `#t', otherwise it returns `#f'. For example, to install a compiled dll `foo', add these lines to `mkimpcat.scm': (add-link 'foo (in-vicinity (implementation-vicinity) "foo" link:able-suffix)) -- Function: add-alias alias feature ALIAS and FEATURE are symbols. The procedure `add-alias' registers ALIAS as an alias for FEATURE. An unspecified value is returned. `add-alias' causes `(require 'ALIAS)' to behave like `(require 'FEATURE)'. -- Function: add-source feature filename FEATURE is a symbol. FILENAME is a string naming a file containing Scheme source code. The procedure `add-source' registers FEATURE so that the first time `require' is called with the symbol FEATURE as its argument, the file FILENAME will be `load'ed. An unspecified value is returned. Remember to delete the file `slibcat' after modifying the file `mkimpcat.scm' in order to force SLIB to rebuild its cache.  File: scm.info, Node: Saving Images, Next: Automatic C Preprocessor Definitions, Prev: Configure Module Catalog, Up: Installing SCM 2.6 Saving 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 `udscm4' and `udscm5' executables respectively. Recent GNU/Linux innovations interfere with `dump'. For: Fedora-Core-1 Remove the `#' from the line `#SETARCH = setarch i386' in the `Makefile'. Fedora-Core-3 `http://jamesthornton.com/writing/emacs-compile.html' writes: [For FC3] combreloc has become the default for recent GNU ld, which breaks the unexec/undump on all versions of both Emacs and XEmacs... Override by adding the following to `udscm5.opt': `--linker-options="-z nocombreloc"' Kernels later than 2.6.11 `http://www.opensubscriber.com/message/emacs-devel@gnu.org/1007118.html' mentions the "exec-shield" feature. Kernels later than 2.6.11 must do (as root): echo 0 > /proc/sys/kernel/randomize_va_space before dumping. `Makefile' has this `randomize_va_space' stuffing scripted for targets `dscm4' and `dscm5'. You must either set `randomize_va_space' to 0 or run as root to dump.  File: scm.info, Node: Automatic C Preprocessor Definitions, Next: Problems Compiling, Prev: Saving Images, Up: Installing SCM 2.7 Automatic C Preprocessor Definitions ======================================== These `#defines' are automatically provided by preprocessors of various C compilers. SCM uses the presence or absence of these definitions to configure "include file" locations and aliases for library functions. If the definition(s) corresponding to your system type is missing as your system is configured, add `-DFLAG' to the compilation command lines or add a `#define FLAG' line to `scmfig.h' or the beginning of `scmfig.h'. #define Platforms: ------- ---------- ARM_ULIB Huw Rogers free unix library for acorn archimedes AZTEC_C Aztec_C 5.2a __CYGWIN__ Cygwin __CYGWIN32__ Cygwin _DCC Dice C on AMIGA __GNUC__ Gnu CC (and DJGPP) __EMX__ Gnu C port (gcc/emx 0.8e) to OS/2 2.0 __HIGHC__ MetaWare High C __IBMC__ C-Set++ on OS/2 2.1 _MSC_VER MS VisualC++ 4.2 MWC Mark Williams C on COHERENT __MWERKS__ Metrowerks Compiler; Macintosh and WIN32 (?) _POSIX_SOURCE ?? _QC Microsoft QuickC __STDC__ ANSI C compliant __TURBOC__ Turbo C and Borland C __USE_POSIX ?? __WATCOMC__ Watcom C on MS-DOS __ZTC__ Zortech C _AIX AIX operating system __APPLE__ Apple Darwin AMIGA SAS/C 5.10 or Dice C on AMIGA __amigaos__ Gnu CC on AMIGA atarist ATARI-ST under Gnu CC __DragonflyBSD__ DragonflyBSD __FreeBSD__ FreeBSD GNUDOS DJGPP (obsolete in version 1.08) __GO32__ DJGPP (future?) hpux HP-UX linux GNU/Linux macintosh Macintosh (THINK_C and __MWERKS__ define) MCH_AMIGA Aztec_c 5.2a on AMIGA __MACH__ Apple Darwin __MINGW32__ MinGW - Minimalist GNU for Windows MSDOS Microsoft C 5.10 and 6.00A _MSDOS Microsoft CLARM and CLTHUMB compilers. __MSDOS__ Turbo C, Borland C, and DJGPP __NetBSD__ NetBSD nosve Control Data NOS/VE __OpenBSD__ OpenBSD SVR2 System V Revision 2. sun SunOS __SVR4 SunOS THINK_C developement environment for the Macintosh ultrix VAX with ULTRIX operating system. unix most Unix and similar systems and DJGPP (!?) __unix__ Gnu CC and DJGPP _UNICOS Cray operating system vaxc VAX C compiler VAXC VAX C compiler vax11c VAX C compiler VAX11 VAX C compiler _Windows Borland C 3.1 compiling for Windows _WIN32 MS VisualC++ 4.2 and Cygwin (Win32 API) _WIN32_WCE MS Windows CE vms (and VMS) VAX-11 C under VMS. __alpha DEC Alpha processor __alpha__ DEC Alpha processor hp9000s800 HP RISC processor __ia64 GCC on IA64 __ia64__ GCC on IA64 _LONGLONG GCC on IA64 __i386__ DJGPP i386 DJGPP _M_ARM Microsoft CLARM compiler defines as 4 for ARM. _M_ARMT Microsoft CLTHUMB compiler defines as 4 for Thumb. MULTIMAX Encore computer ppc PowerPC __ppc__ PowerPC pyr Pyramid 9810 processor __sgi__ Silicon Graphics Inc. sparc SPARC processor sequent Sequent computer tahoe CCI Tahoe processor vax VAX processor __x86_64 AMD Opteron  File: scm.info, Node: Problems Compiling, Next: Problems Linking, Prev: Automatic C Preprocessor Definitions, Up: Installing SCM 2.8 Problems Compiling ====================== FILE PROBLEM / MESSAGE HOW TO FIX *.c include file not found. Correct the status of STDC_HEADERS in scmfig.h. fix #include statement or add #define for system type to scmfig.h. *.c Function should return a value. Ignore. Parameter is never used. Condition is always false. Unreachable code in function. scm.c assignment between incompatible Change SIGRETTYPE in scm.c. types. time.c CLK_TCK redefined. incompatablility between and . Remove STDC_HEADERS in scmfig.h. Edit to remove incompatability. subr.c Possibly incorrect assignment Ignore. in function lgcd. sys.c statement not reached. Ignore. constant in conditional expression. sys.c undeclared, outside of #undef STDC_HEADERS in scmfig.h. functions. scl.c syntax error. #define SYSTNAME to your system type in scl.c (softtype).  File: scm.info, Node: Problems Linking, Next: Problems Running, Prev: Problems Compiling, Up: Installing SCM 2.9 Problems Linking ==================== PROBLEM HOW TO FIX _sin etc. missing. Uncomment LIBS in makefile.  File: scm.info, Node: Problems Running, Next: Testing, Prev: Problems Linking, Up: Installing SCM 2.10 Problems Running ===================== PROBLEM HOW TO FIX Opening message and then machine Change memory model option to C crashes. compiler (or makefile). Make sure sizet definition is correct in scmfig.h. Reduce the size of HEAP_SEG_SIZE in setjump.h. Input hangs. #define NOSETBUF ERROR: heap: need larger initial. Increase initial heap allocation using -a or INIT_HEAP_SIZE. ERROR: Could not allocate. Check sizet definition. Use 32 bit compiler mode. Don't try to run as subproccess. remove in scmfig.h and Do so and recompile files. recompile scm. add in scmfig.h and recompile scm. ERROR: Init5e5.scm not found. Assign correct IMPLINIT in makefile | or scmfig.h. Define environment variable SCM_INIT_PATH to be the full pathname of Init5e5.scm. | WARNING: require.scm not found. Define environment variable SCHEME_LIBRARY_PATH to be the full pathname of the scheme library [SLIB]. Change library-vicinity in Init5e5.scm to point to library or | remove. Make sure the value of (library-vicinity) has a trailing file separator (like / or \).  File: scm.info, Node: Testing, Next: Reporting Problems, Prev: Problems Running, Up: Installing SCM 2.11 Testing ============ Loading `r4rstest.scm' in the distribution will run an [R4RS] conformance test on `scm'. > (load "r4rstest.scm") -| ;loading "r4rstest.scm" SECTION(2 1) SECTION(3 4) # # # # ... Loading `pi.scm' in the distribution will enable you to compute digits of pi. > (load "pi") ;loading "pi" ;done loading "pi.scm" ;Evaluation took 20 ms (0 in gc) 767 cells work, 233.B other # > (pi 100 5) 00003 14159 26535 89793 23846 26433 83279 50288 41971 69399 37510 58209 74944 59230 78164 06286 20899 86280 34825 34211 70679 ;Evaluation took 550 ms (60 in gc) 36976 cells work, 1548.B other # Loading `bench.scm' will compute and display performance statistics of SCM running `pi.scm'. `make bench' or `make benchlit' appends the performance report to the file `BenchLog', facilitating tracking effects of changes to SCM on performance. PROBLEM HOW TO FIX Runs some and then machine crashes. See above under machine crashes. Runs some and then ERROR: ... Remove optimization option to C (after a GC has happened). compiler and recompile. #define SHORT_ALIGN in `scmfig.h'. Some symbol names print incorrectly. Change memory model option to C compiler (or makefile). Check that HEAP_SEG_SIZE fits within sizet. Increase size of HEAP_SEG_SIZE (or INIT_HEAP_SIZE if it is smaller than HEAP_SEG_SIZE). ERROR: Rogue pointer in Heap. See above under machine crashes. Newlines don't appear correctly in Check file mode (define OPEN_... in output files. `Init5e5.scm'). | Spaces or control characters appear Check character defines in in symbol names. `scmfig.h'. Negative numbers turn positive. Check SRS in `scmfig.h'. ;ERROR: bignum: numerical overflow Increase NUMDIGS_MAX in `scmfig.h' and recompile. VMS: Couldn't unwind stack. #define CHEAP_CONTINUATIONS in `scmfig.h'. VAX: botched longjmp. Sparc(SUN-4) heap is growing out of control You are experiencing a GC problem peculiar to the Sparc. The problem is that SCM doesn't know how to clear register windows. Every location which is not reused still gets marked at GC time. This causes lots of stuff which should be collected to not be. This will be a problem with any _conservative_ GC until we find what instruction will clear the register windows. This problem is exacerbated by using lots of call-with-current-continuations. A possible fix for dynthrow() is commented out in `continue.c'.  File: scm.info, Node: Reporting Problems, Prev: Testing, Up: Installing SCM 2.12 Reporting Problems ======================= Reported problems and solutions are grouped under Compiling, Linking, Running, and Testing. If you don't find your problem listed there, you can send a bug report to `agj @ alum.mit.edu'. The bug report should include: 1. The version of SCM (printed when SCM is invoked with no arguments). 2. The type of computer you are using. 3. The name and version of your computer's operating system. 4. The values of the environment variables `SCM_INIT_PATH' and `SCHEME_LIBRARY_PATH'. 5. The name and version of your C compiler. 6. If you are using an executable from a distribution, the name, vendor, and date of that distribution. In this case, corresponding with the vendor is recommended.  File: scm.info, Node: Operational Features, Next: The Language, Prev: Installing SCM, Up: Top 3 Operational Features ********************** * Menu: * Invoking SCM:: * SCM Options:: * Invocation Examples:: * SCM Variables:: * SCM Session:: * Editing Scheme Code:: * Debugging Scheme Code:: * Debugging Continuations:: * Errors:: * Memoized Expressions:: * Internal State:: * Scripting::  File: scm.info, Node: Invoking SCM, Next: SCM Options, Prev: Operational Features, Up: Operational Features 3.1 Invoking SCM ================ scm [-a kbytes] [-muvbiq] [-version] [-help] [[-]-no-init-file] [--no-symbol-case-fold] [-p int] [-r feature] [-h feature] [-d filename] [-f filename] [-l filename] [-c expression] [-e expression] [-o dumpname] [-- | - | -s] [filename] [arguments ...] Upon startup `scm' loads the file specified by by the environment variable SCM_INIT_PATH. 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 it is able to locate the executable, `scm' looks for the initialization file (usually `Init5e5.scm') in platform-dependent directories relative | to this directory. See *Note File-System Habitat:: for a blow-by-blow description. As a last resort (if initialization file cannot be located), the C compile parameter IMPLINIT (defined in the makefile or `scmfig.h') is tried. Unless the option `-no-init-file' or `--no-init-file' occurs in the command line, or if `scm' is being invoked as a script, `Init5e5.scm' | 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 undefined). If it finds such a file, then it is loaded. `Init5e5.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 line, or from standard input. This explanation applies to SCMLIT or other builds of SCM. Scheme-code files can also invoke SCM and its variants. *Note #!: Lexical Conventions.  File: scm.info, Node: SCM Options, Next: Invocation Examples, Prev: Invoking SCM, Up: Operational Features 3.2 Options =========== The options are processed in the order specified on the command line. -- Command Option: -a k specifies that `scm' should allocate an initial heapsize of K kilobytes. This option, if present, must be the first on the command line. If not specified, the default is `INIT_HEAP_SIZE' in source file `setjump.h' which the distribution sets at `25000*sizeof(cell)'. -- Command Option: -no-init-file -- Command Option: --no-init-file Inhibits the loading of `ScmInit.scm' as described above. -- Command Option: -no-symbol-case-fold Symbol (and identifier) names will be case sensitive. -- Command Option: --help prints usage information and URI; then exit. -- Command Option: --version prints version information and exit. -- Command Option: -r feature requires FEATURE. This will load a file from [SLIB] if that FEATURE is not already provided. If FEATURE is 2, 2rs, or r2rs; 3, 3rs, or r3rs; 4, 4rs, or r4rs; 5, 5rs, or r5rs; `scm' will require the features neccessary to support [R2RS]; [R3RS]; [R4RS]; or [R5RS], respectively. -- Command Option: -h feature provides FEATURE. -- Command Option: -l filename -- Command Option: -f filename loads FILENAME. `Scm' will load the first (unoptioned) file named on the command line if no `-c', `-e', `-f', `-l', or `-s' option preceeds it. -- Command Option: -d filename Loads SLIB `databases' feature and opens FILENAME as a database. -- Command Option: -e expression -- Command Option: -c expression specifies that the scheme expression EXPRESSION is to be evaluated. These options are inspired by `perl' and `sh' respectively. On Amiga systems the entire option and argument need to be enclosed in quotes. For instance `"-e(newline)"'. -- Command Option: -o dumpname saves the current SCM session as the executable program `dumpname'. This option works only in SCM builds supporting `dump' (*note Dump::). If options appear on the command line after `-o DUMPNAME', then the saved session will continue with processing those options when it is invoked. Otherwise the (new) command line is processed as usual when the saved image is invoked. -- Command Option: -p level sets the prolixity (verboseness) to LEVEL. This is the same as the `scm' command (verobse LEVEL). -- Command Option: -v (verbose mode) specifies that `scm' will print prompts, evaluation times, notice of loading files, and garbage collection statistics. This is the same as `-p3'. -- Command Option: -q (quiet mode) specifies that `scm' will print no extra information. This is the same as `-p0'. -- Command Option: -m specifies that subsequent loads, evaluations, and user interactions will be with syntax-rules macro capability. To use a specific syntax-rules macro implementation from [SLIB] (instead of [SLIB]'s default) put `-r' MACROPACKAGE before `-m' on the command line. -- Command Option: -u specifies that subsequent loads, evaluations, and user interactions will be without syntax-rules macro capability. Syntax-rules macro capability can be restored by a subsequent `-m' on the command line or from Scheme code. -- Command Option: -i specifies that `scm' should run interactively. That means that `scm' will not terminate until the `(quit)' or `(exit)' command is 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 times, and notice of loading files. The prolixity level can be set by subsequent options. If `scm' is started from a tty, it will assume that it should be interactive unless given a subsequent `-b' option. -- Command Option: -b specifies that `scm' should run non-interactively. That means that `scm' will terminate after processing the command line or if there are errors. -- Command Option: -s specifies, by analogy with `sh', that `scm' should run interactively and that further options are to be treated as program aguments. -- Command Option: - -- Command Option: -- specifies that further options are to be treated as program aguments.  File: scm.info, Node: Invocation Examples, Next: SCM Variables, Prev: SCM Options, Up: Operational Features 3.3 Invocation Examples ======================= `% scm foo.scm' Loads and executes the contents of `foo.scm' and then enters interactive session. `% scm -f foo.scm arg1 arg2 arg3' Parameters `arg1', `arg2', and `arg3' are stored in the global list `*argv*'; Loads and executes the contents of `foo.scm' and exits. `% scm -s foo.scm arg1 arg2' Sets *argv* to `("foo.scm" "arg1" "arg2")' and enters interactive session. `% scm -e `(write (list-ref *argv* *optind*))' bar' Prints `"bar"'. `% scm -rpretty-print -r format -i' Loads `pretty-print' and `format' and enters interactive session. `% scm -r5' Loads `dynamic-wind', `values', and syntax-rules macros and enters interactive (with macros) session. `% scm -r5 -r4' Like above but `rev4-optional-procedures' are also loaded.  File: scm.info, Node: SCM Variables, Next: SCM Session, Prev: Invocation Examples, Up: Operational Features 3.4 Environment Variables ========================= -- Environment Variable: SCM_INIT_PATH is the pathname where `scm' will look for its initialization code. The default is the file `Init5e5.scm' in the source directory. | -- Environment Variable: SCHEME_LIBRARY_PATH is the [SLIB] Scheme library directory. -- Environment Variable: HOME is the directory where `Init5e5.scm' will look for the user | initialization file `ScmInit.scm'. -- Environment Variable: EDITOR is the name of the program which `ed' will call. If EDITOR is not defined, the default is `ed'. 3.5 Scheme Variables ==================== -- Variable: *argv* contains the list of arguments to the program. `*argv*' can change during argument processing. This list is suitable for use as an argument to [SLIB] `getopt'. -- Variable: *syntax-rules* controls whether loading and interaction support syntax-rules macros. Define this in `ScmInit.scm' or files specified on the command line. This can be overridden by subsequent `-m' and `-u' options. -- Variable: *interactive* controls interactivity as explained for the `-i' and `-b' options. Define this in `ScmInit.scm' or files specified on the command line. This can be overridden by subsequent `-i' and `-b' options.  File: scm.info, Node: SCM Session, Next: Editing Scheme Code, Prev: SCM Variables, Up: Operational Features 3.6 SCM Session =============== * Options, file loading and features can be specified from the command line. *Note System interface: (scm)System interface. *Note Require: (slib)Require. * Typing the end-of-file character at the top level session (while SCM is not waiting for parenthesis closure) causes SCM to exit. * Typing the interrupt character aborts evaluation of the current form and resumes the top level read-eval-print loop. -- Function: quit -- Function: quit n -- Function: exit -- Function: exit n Aliases for `exit' (*note exit: (slib)System.). On many systems, SCM can also tail-call another program. *Note execp: I/O-Extensions. -- Callback procedure: boot-tail dumped? `boot-tail' is called by `scm_top_level' just before entering interactive top-level. If `boot-tail' calls `quit', then interactive top-level is not entered. -- Function: program-arguments Returns a list of strings of the arguments scm was called with. -- Function: getlogin Returns the (login) name of the user logged in on the controlling terminal of the process, or #f if this information cannot be determined. For documentation of the procedures `getenv' and `system' *Note System Interface: (slib)System Interface. -- Function: vms-debug If SCM is compiled under VMS this `vms-debug' will invoke the VMS debugger.  File: scm.info, Node: Editing Scheme Code, Next: Debugging Scheme Code, Prev: SCM Session, Up: Operational Features 3.7 Editing Scheme Code ======================= -- Function: ed arg1 ... The value of the environment variable `EDITOR' (or just `ed' if it isn't defined) is invoked as a command with arguments ARG1 .... -- Function: ed filename If SCM is compiled under VMS `ed' will invoke the editor with a single the single argument FILENAME. Gnu Emacs: Editing of Scheme code is supported by emacs. Buffers holding 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 command `M-x run-scheme' with SCM. Otherwise, use the emacs command `M-x suspend-emacs'; or see "other systems" below. Epsilon (MS-DOS): There is lisp (and scheme) mode available by use of the package `LISP.E'. It offers several different indentation formats. With this package, buffers holding files ending in `.L', `.LSP', `.S', and `.SCM' (my modification) are automatically put into lisp-mode. 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 manage RAM properly. It has been reported that when compiling SCM with Turbo C, you need to `#define NOSETBUF' for proper operation in a process buffer with Epsilon 5.0. One can also call out to an editor from SCM if RAM is at a premium; See "under other systems" below. other systems: Define the environment variable `EDITOR' to be the name of the editing program you use. The SCM procedure `(ed arg1 ...)' will invoke your editor and return to SCM when you exit the editor. The following definition is convenient: (define (e) (ed "work.scm") (load "work.scm")) Typing `(e)' will invoke the editor with the file of interest. After editing, the modified file will be loaded.  File: scm.info, Node: Debugging Scheme Code, Next: Debugging Continuations, Prev: Editing Scheme Code, Up: Operational Features 3.8 Debugging Scheme Code ========================= The `cautious' option of `build' (*note Build Options::) supports debugging in Scheme. "CAUTIOUS" 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 default error response. A (memoized) expression and newline are printed for each partially evaluated combination whose procedure is not builtin. See *Note Memoized Expressions:: for how to read memoized expressions. Also as the result of the `CAUTIOUS' flag, both `error' and `user-interrupt' (invoked by ) to print stack traces and conclude by calling `breakpoint' (*note Breakpoints: (slib)Breakpoints.) instead of aborting to top level. Under either condition, program execution can be resumed by `(continue)'. In this configuration one can interrupt a running Scheme program with , inspect or modify top-level values, trace or untrace procedures, and continue execution with `(continue)'. If `verbose' (*note verbose: Internal State.) is called with an argument greater than 2, then the interpreter will check stack size periodically. If the size of stack in use exceeds the C #define `STACK_LIMIT' (default is `HEAP_SEG_SIZE'), SCM generates a `stack' `segment violation'. There are several SLIB macros which so useful that SCM automatically loads the appropriate module from SLIB if they are invoked. -- Macro: trace proc1 ... Traces the top-level named procedures given as arguments. -- Macro: trace With no arguments, makes sure that all the currently traced identifiers are traced (even if those identifiers have been redefined) and returns a list of the traced identifiers. -- Macro: untrace proc1 ... Turns tracing off for its arguments. -- Macro: untrace With no arguments, untraces all currently traced identifiers and returns a list of these formerly traced identifiers. The routines I use most frequently for debugging are: -- Function: print arg1 ... `Print' writes all its arguments, separated by spaces. `Print' outputs a `newline' at the end and returns the value of the last argument. One can just insert `(print '