diff options
Diffstat (limited to 'SCM')
-rw-r--r-- | SCM/ANNOUNCE | 194 | ||||
-rw-r--r-- | SCM/COPYING | 674 | ||||
-rw-r--r-- | SCM/COPYING.LESSER | 165 | ||||
-rw-r--r-- | SCM/Makefile.orig | 736 | ||||
-rw-r--r-- | SCM/README | 381 | ||||
-rw-r--r-- | SCM/continue-ia64.S | 339 | ||||
-rw-r--r-- | SCM/continue.c | 242 | ||||
-rw-r--r-- | SCM/continue.h | 185 | ||||
-rw-r--r-- | SCM/scm.h | 1145 | ||||
-rw-r--r-- | SCM/scmfig.h | 870 | ||||
-rw-r--r-- | SCM/scmflags.h | 4 | ||||
-rw-r--r-- | SCM/setjump.h | 125 | ||||
-rw-r--r-- | SCM/setjump.mar | 39 | ||||
-rw-r--r-- | SCM/setjump.s | 40 | ||||
-rw-r--r-- | SCM/toilet-scm.c | 33 | ||||
-rw-r--r-- | SCM/ugsetjump.s | 35 |
16 files changed, 5207 insertions, 0 deletions
diff --git a/SCM/ANNOUNCE b/SCM/ANNOUNCE new file mode 100644 index 0000000..422222e --- /dev/null +++ b/SCM/ANNOUNCE @@ -0,0 +1,194 @@ +This message announces the availability of Scheme release scm-5e5. + +SCM conforms to Revised^5 Report on the Algorithmic Language Scheme +and the IEEE P1178 specification. SCM is written in C and runs under +Amiga, Atari-ST, MacOS, MS-DOS, OS/2, NOS/VE, Unicos, VMS, Windows, +Unix, and similar systems. + +SCM is free software and part of the GNU project. It is released +under the GNU Lesser General Public License (LGPL). + +Documentation and distributions in several formats are linked from +SCM's home page: + + http://swiss.csail.mit.edu/~jaffer/SCM + +Links to distributions of SCM and related softwares are at the end of +this message. + + -=-=- +scm-5e5 news: + +* SCM is now a GNU package. +* SCM license is now LGPLv3. +* Documentation changed to GNU Free Documentation License. +* scm-discuss email group + http://lists.gnu.org/mailman/listinfo/scm-discuss + + From Radey Shouman + + * repl.c (isymnames): Add name for IM_EVAL_VALUES. + Fix igc prototype, avert warning. + + * eval.c (scm_eval_values, ceval_1): Catch VALUES arity errors + in top-level repl evaluations. Eg (list (values 1 2)) now + throws an error even when typed to repl. + + * scm.h (IM_EVAL_VALUES): Add isym for use by scm_eval_values. + + From Bob Schumaker + + * macos-config.h, unexmacosx.c, lastfile.c: + Added from Emacs for MacOS (darwin). + + * build.scm (C-libraries): Added dump and dlll darwin entries. + (make-dll-archive, compile-dll-c-files): Added Darwin tagets. + (manifest): Added entries for "macos-config.h" and "lastfile.c". + + * Makefile (all): Make x.so only if /usr/X11R6/lib exists. + (install, installlib): test -d is not needed with mkdir -p. + + From Aubrey Jaffer + + * build, Makefile, scm.spec: Put "-" between "scm" and version. + + * unexelf.c, unexmacosx.c, unexsgi.c, unexsunos4.c, gmalloc.c, + lastfile.c, macos-config.h, r4rstest.scm, syntest2.scm, + unexalpha.c, unexec.c, !#.c, build, build.scm, ecrt0.c, + findexec.c, bench.scm: + Changed license to GPL version 3. + + * Transcen.scm, Tscript.scm, unif.c, unix.c, x.c, xgen.scm, + subr.c, sys.c, time.c, scm.texi, script.c, setjump.h, socket.c, + split.scm, scm.c, scm.h, scmfig.h, scmhob.h, scmhob.scm, + scmmain.c, repl.c, rgx.c, rope.c, sc2.c, scl.c, Macro.scm, + Makefile, mkimpcat.scm, pi.c, pi.scm, posix.c, ramap.c, + record.c, Iedline.scm, Init5e4.scm, Link.scm, Macexp.scm, + inc2scm, ioext.c, Idiffer.scm, gsubr.c, hobbit.scm, .gdbinit, + differ.c, disarm.scm, dynl.c, edline.c, eval.c, + get-contoffset-ia64.c, byte.c, bytenumb.c, compile.scm, + continue-ia64.S, continue.c, continue.h, crs.c, debug.c: + Changed license to LGPL version 3. + + * Tscript.scm: Handle EOF. + + * byte.c (bytes-append, bytes->string, string->bytes): Added. + + * scm.nsi: Create shortcuts at installation; removed SCM.lnk. + (MUI_ICON): Set to "SCM.ico". + + * scm.nsi (Uninstall): Delete tmp1, tmp2, and tmp3, + scmlit.exe, implcat, and slibcat when uninstalling. + + * Makefile ($(htmldir)Xlibscm_toc.html) + ($(htmldir)hobbit_toc.html): Add SCM.ico. + (all): Make differ.so. + (libscm.a, db.so, bytenumb.so, differ.so, myturtle, x.so): Depend + on scm.h and scmfig.h. + + * scm.h, repl.c: Made ints_disabled VOLATILE. + + * ANNOUNCE: Culled and reorganized URLs. + + * ioext.c (directory-for-each): Require 'filename, not 'glob. + + * Init5e4.scm (slib:features): Added srfi-96. + + * scm.c (init_scm): The streams when the program was dumped need + to be reset at initialization. + + * Makefile (Checklit, Check): Added case-sensitive checks. + + * repl.c (scm_lreadr): Made case-insensitive for character names. + + * keysymdef.scm, x11.scm: X Window System Version 7.1.1 + Release Date: 12 May 2006 + X Protocol Version 11, Revision 0, Release 7.1.1 + + -=-=- + +SCM source is available from: + http://swiss.csail.mit.edu/ftpdir/scm/scm-5e5.zip + swiss.csail.mit.edu:/pub/scm/scm-5e5.zip + http://swiss.csail.mit.edu/ftpdir/scm/scm-5e5-1.src.rpm + swiss.csail.mit.edu:/pub/scm/scm-5e5-1.src.rpm +Also available as i386 binary RPM: + http://swiss.csail.mit.edu/ftpdir/scm/scm-5e5-1.i386.rpm + swiss.csail.mit.edu:/pub/scm/scm-5e5-1.i386.rpm +Also available as i386 MS-Windows installer: + http://swiss.csail.mit.edu/ftpdir/scm/slib-3b1-1.exe + swiss.csail.mit.edu:/pub/scm/slib-3b1-1.exe + +SLIB is a portable Scheme library which SCM uses: + http://swiss.csail.mit.edu/ftpdir/scm/slib-3b1.zip + swiss.csail.mit.edu:/pub/scm/slib-3b1.zip +Also available as RPM: + http://swiss.csail.mit.edu/ftpdir/scm/slib-3b1-1.noarch.rpm + swiss.csail.mit.edu:/pub/scm/slib-3b1-1.noarch.rpm +Also available as MS-Windows installer: + http://swiss.csail.mit.edu/ftpdir/scm/slib-3b1-1.exe + swiss.csail.mit.edu:/pub/scm/slib-3b1-1.exe + +JACAL is a symbolic math system written in Scheme: + http://swiss.csail.mit.edu/ftpdir/scm/jacal-1b9.zip + swiss.csail.mit.edu:/pub/scm/jacal-1b9.zip +Also available as RPM: + http://swiss.csail.mit.edu/ftpdir/scm/jacal-1b9-1.noarch.rpm + swiss.csail.mit.edu:/pub/scm/jacal-1b9-1.noarch.rpm +Also available as MS-Windows installer: + http://swiss.csail.mit.edu/ftpdir/scm/jacal-1b9-1.exe + swiss.csail.mit.edu:/pub/scm/jacal-1b9-1.exe + +WB is a disk based, sorted associative array (B-tree) library for SCM. +Using WB, large databases can be created and managed from SCM. + http://swiss.csail.mit.edu/ftpdir/scm/wb-2a2.zip + swiss.csail.mit.edu:/pub/scm/wb-2a2.zip + http://swiss.csail.mit.edu/ftpdir/scm/wb-2a2-1.src.rpm + swiss.csail.mit.edu:/pub/scm/wb-2a2-1.src.rpm +Also available as i386 binary RPM: + http://swiss.csail.mit.edu/ftpdir/scm/wb-2a2-1.i386.rpm + swiss.csail.mit.edu:/pub/scm/wb-2a2-1.i386.rpm + +FreeSnell is a program to compute optical properties of multilayer +thin-film coatings: + http://swiss.csail.mit.edu/ftpdir/scm/FreeSnell-1b7.zip + swiss.csail.mit.edu:/pub/scm/FreeSnell-1b7.zip +Also available as MS-Windows installer: + http://swiss.csail.mit.edu/ftpdir/scm/FreeSnell-1b7-1.exe + swiss.csail.mit.edu:/pub/scm/FreeSnell-1b7-1.exe + +SIMSYNCH is a digital logic simulation system written in SCM. + http://swiss.csail.mit.edu/ftpdir/scm/synch-1c3.zip + swiss.csail.mit.edu:/pub/scm/synch-1c3.zip + +XSCM is a X windows interface package which works with SCM: + http://swiss.csail.mit.edu/ftpdir/scm/xscm-2.01.tar.gz + swiss.csail.mit.edu:/pub/scm/xscm-2.01.tar.gz + +TURTLSCM is a turtle graphics package which works with SCM on MS-DOS +or X11 machines: + http://swiss.csail.mit.edu/ftpdir/scm/turtlegr.tar.gz + swiss.csail.mit.edu:/pub/scm/turtlegr.tar.gz + +#! implements "#!" (POSIX) shell-scripts for MS-DOS batch files. + http://swiss.csail.mit.edu/ftpdir/scm/sharpbang.zip + swiss.csail.mit.edu:/pub/scm/sharpbang.zip + http://swiss.csail.mit.edu/ftpdir/scm/#!.zip + swiss.csail.mit.edu:/pub/scm/#!.zip + +SLIB-PSD is a portable debugger for Scheme (requires emacs editor): + http://swiss.csail.mit.edu/ftpdir/scm/slib-psd1-3.tar.gz + swiss.csail.mit.edu:/pub/scm/slib-psd1-3.tar.gz + +SMG-SCM is an SMG interface package which works with SCM on VMS. + http://swiss.csail.mit.edu/ftpdir/scm/smg-scm2a1.zip + swiss.csail.mit.edu:/pub/scm/smg-scm2a1.zip + +MacSCM is a Macintosh applications building package which works with +SCM (similar to XSCM). + http://swiss.csail.mit.edu/ftpdir/scm/macscm.tar.Z + swiss.csail.mit.edu:/pub/scm/macscm.tar.Z + +Programs for printing and viewing TexInfo documentation (which SCM +has) come with GNU Emacs or can be obtained via ftp from: + ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.8.tar.gz diff --git a/SCM/COPYING b/SCM/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/SCM/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/SCM/COPYING.LESSER b/SCM/COPYING.LESSER new file mode 100644 index 0000000..cd4ce53 --- /dev/null +++ b/SCM/COPYING.LESSER @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/SCM/Makefile.orig b/SCM/Makefile.orig new file mode 100644 index 0000000..1477c86 --- /dev/null +++ b/SCM/Makefile.orig @@ -0,0 +1,736 @@ +# "Makefile" for scm Scheme Interpreter +# Copyright (C) 1990-2008 Free Software Foundation, Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/>. + +# Author: Aubrey Jaffer + +SHELL = /bin/sh +#CC = gcc +#CFLAGS = -g +#LIBS = +#LD = $(CC) -g +LD = $(CC) +SCMLIT = ./scmlit +SCMEXE = ./scm +#SHOBJS = *.sl +SHOBJS = *.so + +#BUILD = ./build -hsystem -p svr4-gcc-sun-ld +BUILD = ./build -hsystem + +# Workaround for unexec on Fedora Core 1 GNU/Linux i386 +#SETARCH = setarch i386 + +# http://jamesthornton.com/writing/emacs-compile.html +# [For FC3] combreloc has become the default for recent GNU ld, which +# breaks the unexec/undump on all versions of both Emacs and +# XEmacs... +# +# Add the following to udscm5.opt: +#--linker-options="-z nocombreloc" + +# http://www.opensubscriber.com/message/emacs-devel@gnu.org/1007118.html +# Kernels later than 2.6.11 must do (as root) before dumping: +#echo 0 > /proc/sys/kernel/randomize_va_space + +#for RPMs +RELEASE = 1 + +intro: + @echo + @echo "This is the scm-$(VERSION) distribution. Read \"scm.info\"" + @echo "to learn how to build and install SCM. Or browse" + @echo " http://swiss.csail.mit.edu/~jaffer/SCM" + @echo + $(MAKE) scm + +srcdir.mk: Makefile + echo "CPROTO=`type cproto | sed 's%.* %%'`" > srcdir.mk + echo "srcdir=`pwd`/" >> srcdir.mk +#srcdir=$(HOME)/scm/ +#srcdir=/usr/local/src/scm/ +include srcdir.mk + +# directory where COPYING and InitXXX.scm reside. +#IMPLPATH = /usr/local/src/scm/ +#this one is good for bootstrapping +#IMPLPATH = `pwd`/ +IMPLPATH=$(srcdir) +include patchlvl.h +IMPLINIT = $(IMPLPATH)Init$(VERSION).scm + +# If pathname where InitXXX.scm resides is not known in advance then +# SCM_INIT_PATH is the environment variable whose value is the +# pathname where InitXXX.scm resides. + +hfiles = scm.h scmfig.h setjump.h patchlvl.h continue.h +cfiles = scmmain.c scm.c time.c repl.c ioext.c scl.c sys.c eval.c \ + subr.c sc2.c unif.c rgx.c crs.c dynl.c record.c posix.c socket.c\ + unix.c rope.c ramap.c gsubr.c edline.c continue.c \ + findexec.c script.c debug.c byte.c bytenumb.c differ.c +ufiles = pre-crt0.c ecrt0.c gmalloc.c unexec.c unexelf.c unexhp9k800.c \ + unexsunos4.c unexalpha.c unexsgi.c +# cxux-crt0.s ecrt0.c gmalloc.c pre-crt0.c unexaix.c unexalpha.c \ +# unexapollo.c unexconvex.c unexec.c unexelf.c unexelf1.c \ +# unexencap.c unexenix.c unexfx2800.c unexhp9k800.c unexmips.c \ +# unexnext.c unexnt.c unexsgi.c unexsni.c unexsunos4.c +ofiles = scm.o time.o repl.o scl.o sys.o eval.o subr.o unif.o rope.o \ + continue.o findexec.o script.o debug.o +# continue-ia64.o +ifiles = Init$(VERSION).scm Transcen.scm Link.scm Macro.scm Macexp.scm \ + Tscript.scm compile.scm Iedline.scm Idiffer.scm +hobfiles = hobbit.scm scmhob.scm scmhob.h +turfiles = turtlegr.c turtle grtest.scm +xafiles = xatoms.scm x11.scm xevent.scm keysymdef.scm +xfiles = x.c x.h xgen.scm xevent.h inc2scm $(xafiles) + +all: require.scm + $(MAKE) mydlls + $(MAKE) dscm5 + $(MAKE) differ.so + $(MAKE) db.so + if [ -d /usr/X11R6/lib ]; then $(MAKE) x.so; fi +require.scm: + cp -p requires.scm require.scm + +# SCMLIT -- try making this first! +scmlit: $(ofiles) scmmain.o require.scm Makefile + $(LD) -o scmlit $(ofiles) scmmain.o $(LIBS) + $(MAKE) checklit +scmflags.h: scmflags +scmflags: + echo "#ifndef IMPLINIT" > newflags.h + echo "#define IMPLINIT \"$(IMPLINIT)\"" >> newflags.h + echo "#endif" >> newflags.h + echo "#define CHEAP_CONTINUATIONS" >> newflags.h + echo "#define CAUTIOUS" >> newflags.h + -if (cmp -s newflags.h scmflags.h) then rm newflags.h; \ + else mv newflags.h scmflags.h; fi +.c.o: + $(CC) -c $(CFLAGS) $< -o $@ +scm.o: scm.c scm.h scmfig.h scmflags.h patchlvl.h +scmmain.o: scmmain.c scm.h scmfig.h scmflags.h patchlvl.h +scl.o: scl.c scm.h scmfig.h scmflags.h +eval.o: eval.c scm.h scmfig.h scmflags.h setjump.h +debug.o: debug.c scm.h scmfig.h scmflags.h setjump.h +unif.o: unif.c scm.h scmfig.h scmflags.h +#ramap.o: ramap.c scm.h scmfig.h scmflags.h +repl.o: repl.c scm.h scmfig.h scmflags.h setjump.h +sys.o: sys.c scm.h scmfig.h scmflags.h setjump.h +time.o: time.c scm.h scmfig.h scmflags.h +subr.o: subr.c scm.h scmfig.h scmflags.h +rope.o: rope.c scm.h scmfig.h scmflags.h +continue.o: continue.c continue.h setjump.h scm.h scmfig.h scmflags.h +continue-ia64.o: continue-ia64.S get-contoffset-ia64.c + gcc -o get-contoffset-ia64 get-contoffset-ia64.c + ./get-contoffset-ia64 contoffset-ia64.S + gcc -c -o continue-ia64.o continue-ia64.S + +# Simple build with bignums for running JACAL +scm: scmlit + $(BUILD) -s $(IMPLPATH) -F cautious bignums arrays # i/o-extensions + $(MAKE) check + +# R4RS interpreter (not dumpable) +scm4.opt: + echo "-F cautious bignums arrays inexact" >> scm4.opt + echo "-F engineering-notation dynamic-linking" >> scm4.opt +# if type gcc; then echo "--compiler-options=\"-fno-guess-branch-probability\"" >> scm4.opt; fi +scm4: $(cfiles) $(hfiles) build.scm build scm4.opt + $(BUILD) -f scm4.opt -o scm -s $(IMPLPATH) + -rm $(ofiles) scmmain.o + -$(MAKE) check + +# R5RS interpreter (not dumpable) +scm5.opt: + echo "-F cautious bignums arrays inexact" >> scm5.opt + echo "-F engineering-notation dynamic-linking" >> scm5.opt + echo "-F macro" >> scm5.opt +# if type gcc; then echo "--compiler-options=\"-fno-guess-branch-probability\"" >> scm5.opt; fi +scm5: $(cfiles) $(hfiles) build.scm build scm5.opt + $(BUILD) -f scm5.opt -o scm -s $(IMPLPATH) + -rm $(ofiles) scmmain.o + -$(MAKE) check + -$(MAKE) checkmacro + +# dumpable R4RS interpreter +udscm4.opt: + echo "-F cautious bignums arrays inexact" >> udscm4.opt + echo "-F engineering-notation dump dynamic-linking" >> udscm4.opt +# if type gcc; then echo "--compiler-options=\"-fno-guess-branch-probability\"" >> udscm4.opt; fi +udscm4: $(cfiles) $(hfiles) build.scm build udscm4.opt + $(BUILD) -f udscm4.opt -o udscm4 -s $(IMPLPATH) + -rm $(ofiles) scmmain.o +dscm4: udscm4 $(ifiles) require.scm + if [ -f /proc/sys/kernel/randomize_va_space -a\ + "`cat /proc/sys/kernel/randomize_va_space`" != "0" ]; then {\ + cat /proc/sys/kernel/randomize_va_space > randomize_va_space.tmp;\ + echo 0 > /proc/sys/kernel/randomize_va_space;\ + } fi + -rm -f slibcat implcat scm~ + -mv scm scm~ + echo "(quit)" | $(SETARCH) ./udscm4 -no-init-file -o scm + if [ -f randomize_va_space.tmp ]; then {\ + cat randomize_va_space.tmp > /proc/sys/kernel/randomize_va_space;\ + rm randomize_va_space.tmp;\ + } fi + +# dumpable R5RS interpreter +udscm5.opt: + $(MAKE) udscm4.opt + cat udscm4.opt >> udscm5.opt + echo "-F macro" >> udscm5.opt +udscm5: $(cfiles) $(ufiles) $(hfiles) build.scm build udscm5.opt + $(BUILD) -f udscm5.opt -o udscm5 -s $(IMPLPATH) + -rm $(ofiles) scmmain.o + strip udscm5 +dscm5: udscm5 $(ifiles) require.scm + if [ -f /proc/sys/kernel/randomize_va_space -a\ + "`cat /proc/sys/kernel/randomize_va_space`" != "0" ]; then {\ + cat /proc/sys/kernel/randomize_va_space > randomize_va_space.tmp;\ + echo 0 > /proc/sys/kernel/randomize_va_space;\ + } fi + -rm -f slibcat implcat scm~ + -mv scm scm~ + echo "(quit)" | $(SETARCH) ./udscm5 -no-init-file -r5 -o scm + if [ -f randomize_va_space.tmp ]; then {\ + cat randomize_va_space.tmp > /proc/sys/kernel/randomize_va_space;\ + rm randomize_va_space.tmp;\ + } fi + $(MAKE) check + $(MAKE) checkmacro + +# R5RS interpreter for debugging with GDB. +gdb.opt: udscm5.opt + cat udscm5.opt > gdb.opt + echo "-F debug" >> gdb.opt + echo "--compiler-options=-Wall" >> gdb.opt + echo "--linker-options=-Wall" >> gdb.opt + echo "-D NO_ENV_CACHE" >> gdb.opt +# echo "-DTEST_FARLOC -DTEST_SCM2PTR" >> gdb.opt +udgdbscm: gdb.opt $(cfiles) $(ufiles) $(hfiles) build.scm build + $(BUILD) -f gdb.opt -o udgdbscm -s $(IMPLPATH) +gdbscm: udgdbscm $(ifiles) require.scm + echo "(quit)" | $(SETARCH) ./udgdbscm -no-init-file -r5 -o gdbscm + +# R4RS interpreter for profiling +pg.opt: udscm4.opt + cat udscm4.opt >> pg.opt + echo "--compiler-options=-pg" >> pg.opt + echo "--linker-options=-pg" >> pg.opt + echo "-DLACK_SETITIMER" >> pg.opt +udpgscm: pg.opt + $(BUILD) -f pg.opt -o udpgscm -s $(IMPLPATH) +pgscm: udpgscm + echo "(quit)" | $(SETARCH) ./udpgscm -no-init-file -o pgscm + +# R4RS SCM library +libscm.opt: + echo "-F cautious bignums arrays inexact" >> libscm.opt + echo "-F engineering-notation" >> libscm.opt + echo "-F dynamic-linking" >> libscm.opt +mylib: libscm.a +libscm.a: libscm.opt scm.h scmfig.h + $(BUILD) -t lib -f libscm.opt +libtest: libscm.a libtest.c + $(LD) -o libtest libtest.c libscm.a -ldl -lm -lc + ./libtest + +# DLLs for dynamic linking +dlls.opt: + echo "--compiler-options=-Wall" >> dlls.opt + echo "--linker-options=-Wall" >> dlls.opt +mydlls: dlls.opt bytenumb.so + $(BUILD) -t dll -f dlls.opt -c ramap.c + $(BUILD) -t dll -f dlls.opt -c record.c + $(BUILD) -t dll -f dlls.opt -c gsubr.c + $(BUILD) -t dll -f dlls.opt -c byte.c + $(BUILD) -t dll -f dlls.opt -c sc2.c + $(BUILD) -t dll -f dlls.opt -c ioext.c + $(BUILD) -t dll -f dlls.opt -c posix.c + $(BUILD) -t dll -f dlls.opt -c socket.c + $(BUILD) -t dll -f dlls.opt -c unix.c + $(BUILD) -t dll -f dlls.opt -F curses + $(BUILD) -t dll -f dlls.opt -c rgx.c + if [ -f /usr/lib/libreadline.so ]; \ + then $(BUILD) -t dll -f dlls.opt -F edit-line; fi + +rwb-isam.scm wbtab.scm: ../wb/rwb-isam.scm ../wb/wbtab.scm + cp ../wb/rwb-isam.scm ../wb/wbtab.scm ./ +db.so: dlls.opt rwb-isam.scm wbtab.scm scm.h scmfig.h + if [ -f ../wb/blink.c ]; then \ + $(BUILD) -t dll -f dlls.opt -F wb; fi + +bytenumb.so: bytenumb.c scm.h scmfig.h + $(BUILD) -t dll -f dlls.opt -F byte-number inexact bignums +differ.so: differ.c scm.h scmfig.h + $(BUILD) -t dll -f dlls.opt -F differ +myturtle: dlls.opt scm.h scmfig.h + $(BUILD) -t dll -f dlls.opt -F turtlegr + +x.so: x.c x.h xevent.h dlls.opt scm.h scmfig.h + $(BUILD) -t dll -f dlls.opt -F x + +# Generate x11 include and Scheme files +incdir=/usr/include/ +x11.scm: inc2scm + rm -f x11.scm + $(SCMLIT) -l inc2scm x11.scm x: $(DESTDIR)$(incdir) X11/X.h X11/cursorfont.h X11/Xlib.h \ + X11/Xutil.h +keysymdef.scm: inc2scm + rm -f keysymdef.scm + $(SCMLIT) -l inc2scm keysymdef.scm x: $(DESTDIR)$(incdir) X11/keysym.h X11/keysymdef.h +xevent.h xevent.scm xatoms.scm: xgen.scm Makefile + $(SCMLIT) -l xgen.scm $(DESTDIR)$(incdir)X11/Xlib.h +x.h: x.c xevent.h + if [ -x "$(CPROTO)" ]; then $(CPROTO) x.c > x.h; fi + +# Check SCM; SCMLIT function. +checklit: + $(SCMLIT) -fr4rstest.scm -e'(test-sc4)(test-delay)(gc)' \ + -e '(or (null? errs) (quit 1))' +Checklit: + $(SCMLIT) --no-symbol-case-fold -fr4rstest.scm -e'(test-sc4)(test-delay)(gc)' \ + -e '(or (null? errs) (quit 1))' +check: r4rstest.scm + $(SCMEXE) -fr4rstest.scm -e'(test-sc4)(test-cont)(test-delay)(gc)' \ + -e '(or (null? errs) (quit 1))' +Check: r4rstest.scm + $(SCMEXE) --no-symbol-case-fold -fr4rstest.scm -e'(test-sc4)(test-cont)(test-delay)(gc)' \ + -e '(or (null? errs) (quit 1))' +checkmacro: syntest1.scm syntest2.scm r4rstest.scm + $(SCMEXE) -rmacro -fsyntest1.scm -fsyntest2.scm \ + -fr4rstest.scm -e'(test-sc4)(test-cont)(test-delay)' -fsyntest1 \ + -e '(or (null? errs) (quit 1))' + +# Measuare running speed of SCM; SCMLIT. Results are appended to file +# "BenchLog" +bench: + echo `whoami`@`hostname` testing scm \ + `$(SCMEXE) -e'(display *scm-version*)'` >> BenchLog + echo on `date` >> BenchLog + ls -l scm >> BenchLog + size scm >> BenchLog + uname -a >> BenchLog + $(SCMEXE) -lbench.scm + -cat prng.log >> BenchLog + echo >> BenchLog + -cat pi.log >> BenchLog + echo >> BenchLog + echo + tail -20 BenchLog + -rm -f pi.log prng.log +benchlit: + echo `whoami`@`hostname` testing scmlit \ + `$(SCMLIT) -e'(display *scm-version*)'` >> BenchLog + echo on `date` >> BenchLog + ls -l scmlit >> BenchLog + size scmlit >> BenchLog + uname -a >> BenchLog + $(SCMLIT) -lbench.scm + -cat prng.log >> BenchLog + echo >> BenchLog + -cat pi.log >> BenchLog + echo >> BenchLog + echo + tail -20 BenchLog + -rm -f pi.log prng.log +report: + $(SCMLIT) -e"(slib:report #t)" + $(SCMEXE) -e"(slib:report #t)" + +implcat: $(SHOBJS) mkimpcat.scm + $(SCMLIT) -lmkimpcat.scm + +htmldir=../public_html/ +dvi: scm.dvi Xlibscm.dvi hobbit.dvi +scm.dvi: $(texifiles) Makefile + texi2dvi -b -c scm.texi +Xlibscm.dvi: version.txi Xlibscm.texi Makefile + texi2dvi -b -c Xlibscm.texi +hobbit.dvi: version.txi hobbit.texi Makefile + texi2dvi -b -c hobbit.texi +xdvi: scm.dvi + xdvi scm.dvi +Xdvi: Xlibscm.dvi + xdvi Xlibscm.dvi +hobdvi: hobbit.dvi + xdvi hobbit.dvi + +pdf: $(htmldir)scm.pdf $(htmldir)Xlibscm.pdf $(htmldir)hobbit.pdf +$(htmldir)scm.pdf: $(texifiles) Makefile + texi2pdf -b -c scm.texi + mv scm.pdf $(htmldir) +$(htmldir)Xlibscm.pdf: version.txi Xlibscm.texi Makefile + texi2pdf -b -c Xlibscm.texi + mv Xlibscm.pdf $(htmldir) +$(htmldir)hobbit.pdf: version.txi hobbit.texi Makefile + texi2pdf -b -c hobbit.texi + mv hobbit.pdf $(htmldir) +xpdf: $(htmldir)scm.pdf + xpdf $(htmldir)scm.pdf +Xpdf: $(htmldir)Xlibscm.pdf + xpdf $(htmldir)Xlibscm.pdf +hobpdf: $(htmldir)hobbit.pdf + xpdf $(htmldir)hobbit.pdf + +PREVDOCS = prevdocs/ +html: $(htmldir)scm_toc.html $(htmldir)Xlibscm_toc.html $(htmldir)hobbit_toc.html + +TEXI2HTML = /usr/local/bin/texi2html -split -verbose + +$(htmldir)scm_toc.html: Makefile $(texifiles) + ${TEXI2HTML} scm.texi + -rm -f scm_stoc.html + if [ -f $(PREVDOCS)scm_toc.html ]; \ + then hitch $(PREVDOCS)scm_\*.html scm_\*.html $(htmldir); \ + else cp scm_*.html $(htmldir); fi +$(htmldir)Xlibscm_toc.html: Makefile version.txi Xlibscm.texi + ${TEXI2HTML} Xlibscm.texi + -rm -f Xlibscm_stoc.html + chpat '</HEAD>' '<LINK REL="icon" HREF="Logo/SCM.ico">\ +<LINK REL="shortcut icon" HREF="Logo/SCM.ico">\ +</HEAD>' Xlibscm_*.html + cp Xlibscm_*.html $(htmldir) +$(htmldir)hobbit_toc.html: Makefile version.txi hobbit.texi + ${TEXI2HTML} hobbit.texi + -rm -f hobbit_stoc.html + chpat '</HEAD>' '<LINK REL="icon" HREF="Logo/SCM.ico">\ +<LINK REL="shortcut icon" HREF="Logo/SCM.ico">\ +</HEAD>' hobbit_*.html + cp hobbit_*.html $(htmldir) + +prevdocs: $(PREVDOCS)scm_toc.html $(PREVDOCS)scm.info +$(PREVDOCS)scm_toc.html: +$(PREVDOCS)scm.info: Makefile + cd $(PREVDOCS); unzip -a $(dest)scm*.zip + rm $(PREVDOCS)scm/scm.info + cd $(PREVDOCS)scm; make scm.info; make scm_toc.html + cd $(PREVDOCS); mv -f scm/scm.info scm/*.html ./ + rm -rf $(PREVDOCS)scm + -rm -f scm-$(VERSION).info + +################ INSTALL DEFINITIONS ################ + +rpm_prefix=$(HOME)/rpmbuild/ + +prefix = /usr/local/ +exec_prefix = $(prefix) +# directory where `make install' will put executable. +bindir = $(exec_prefix)bin/ +libdir = $(exec_prefix)lib/ +libscmdir = $(libdir)scm/ +# directory where `make install' will put manual page. +man1dir = $(prefix)man/man1/ +infodir = $(prefix)info/ +includedir = $(prefix)include/ + +README: build build.scm scm.info + $(SCMEXE) -l build -e"(make-readme)" + +platform.txi: build.scm + $(SCMLIT) -r database-browse -l build.scm -e "(browse build 'platform)" \ + > platform.txi +features.txi: build build.scm + $(SCMLIT) -l build -e"(make-features-txi)" +scm.info: $(texifiles) + makeinfo scm.texi --no-split -o scm.info + mv scm.info scm-$(VERSION).info + if [ -f $(PREVDOCS)scm.info ]; \ + then infobar $(PREVDOCS)scm.info scm-$(VERSION).info scm.info; \ + else cp scm-$(VERSION).info scm.info; fi +$(DESTDIR)$(infodir)scm.info: scm.info + mkdir -p $(DESTDIR)$(infodir) + cp -p scm.info $(DESTDIR)$(infodir)scm.info + -install-info $(DESTDIR)$(infodir)scm.info $(DESTDIR)$(infodir)dir + -rm $(DESTDIR)$(infodir)scm.info.gz + +Xlibscm.info: version.txi Xlibscm.texi + makeinfo Xlibscm.texi --no-split -o Xlibscm.info +$(DESTDIR)$(infodir)Xlibscm.info: Xlibscm.info + mkdir -p $(DESTDIR)$(infodir) + cp Xlibscm.info $(DESTDIR)$(infodir)Xlibscm.info + -install-info $(DESTDIR)$(infodir)Xlibscm.info $(DESTDIR)$(infodir)dir + -rm $(DESTDIR)$(infodir)Xlibscm.info*.gz + +hobbit.info: version.txi hobbit.texi + makeinfo hobbit.texi --no-split -o hobbit.info +$(DESTDIR)$(infodir)hobbit.info: hobbit.info + mkdir -p $(DESTDIR)$(infodir) + cp hobbit.info $(DESTDIR)$(infodir)hobbit.info + -install-info $(DESTDIR)$(infodir)hobbit.info $(DESTDIR)$(infodir)dir + -rm $(DESTDIR)$(infodir)hobbit.info*.gz + +info: installinfo +installinfo: $(DESTDIR)$(infodir)scm.info $(DESTDIR)$(infodir)Xlibscm.info $(DESTDIR)$(infodir)hobbit.info + +infoz: installinfoz +installinfoz: $(DESTDIR)$(infodir)scm.info.gz $(DESTDIR)$(infodir)Xlibscm.info.gz $(DESTDIR)$(infodir)hobbit.info.gz +$(DESTDIR)$(infodir)scm.info.gz: $(DESTDIR)$(infodir)scm.info + gzip -f $(DESTDIR)$(infodir)scm.info +$(DESTDIR)$(infodir)Xlibscm.info.gz: $(DESTDIR)$(infodir)Xlibscm.info + gzip -f $(DESTDIR)$(infodir)Xlibscm.info +$(DESTDIR)$(infodir)hobbit.info.gz: $(DESTDIR)$(infodir)hobbit.info + gzip -f $(DESTDIR)$(infodir)hobbit.info + +lsdfiles = $(ifiles) $(hobfiles) COPYING COPYING.LESSER r4rstest.scm \ + build build.scm mkimpcat.scm $(SHOBJS) patchlvl.h \ + Iedline.scm $(xafiles) db.so wbtab.scm rwb-isam.scm + +install: scm.1 + mkdir -p $(DESTDIR)$(bindir) + mkdir -p $(DESTDIR)$(man1dir) + -cp scm scmlit $(DESTDIR)$(bindir) + -strip $(DESTDIR)$(bindir)scmlit + -cp scm.1 $(DESTDIR)$(man1dir) + mkdir -p $(DESTDIR)$(libscmdir) + test -f $(DESTDIR)$(libscmdir)require.scm || \ + cp requires.scm $(DESTDIR)$(libscmdir)require.scm + -cp $(lsdfiles) $(DESTDIR)$(libscmdir) + +installlib: + mkdir -p $(DESTDIR)$(includedir) + cp scm.h scmfig.h scmflags.h $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(libdir) + cp libscm.a $(DESTDIR)$(libdir)libscm.a + +uninstall: + -rm $(DESTDIR)$(bindir)scm $(DESTDIR)$(bindir)scmlit + -rm $(DESTDIR)$(man1dir)scm.1 + -rm $(DESTDIR)$(includedir)scm.h $(DESTDIR)$(includedir)scmfig.h $(DESTDIR)$(includedir)scmflags.h + -rm $(DESTDIR)$(libdir)libscm.a + -(cd $(DESTDIR)$(libscmdir); rm $(lsdfiles) require.scm) + +uninstallinfo: + -rm $(DESTDIR)$(infodir)scm.info.gz $(DESTDIR)$(infodir)Xlibscm.info.gz\ + $(DESTDIR)$(infodir)hobbit.info.gz + +scm.doc: scm.1 + nroff -man $< | ul -tunknown >$@ + +docs: $(DESTDIR)$(infodir)scm.info.gz $(htmldir)scm_toc.html scm.doc \ + scm.dvi Xlibscm.dvi hobbit.dvi \ + $(htmldir)scm.pdf $(htmldir)Xlibscm.pdf $(htmldir)hobbit.pdf + xdvi -s 4 scm.dvi + +winscm5.opt: + echo "-F arrays array-for-each byte i/o-extensions" >> winscm5.opt + echo "-F bignums inexact engineering-notation" >> winscm5.opt + echo "-F cautious rev2-procedures macro" >> winscm5.opt + echo "-F wb" >> winscm5.opt +gw32scmwb.sh: winscm5.opt build.scm Makefile version.txi scmlit + ./build -p gnu-win32 -f winscm5.opt -w gw32scmwb.sh +scm.exe: gw32scmwb.sh + ./gw32scmwb.sh + +hobbit.html: hobbit.texi + makeinfo --html --no-split --no-warn hobbit.texi +scm.html: $(texifiles) + makeinfo --html --no-split --no-warn --force scm.texi + +## to build a windows installer +## make sure makeinfo and NSIS are available on the commandline +w32install: scm.exe hobbit.html scm.html + makensis scm.nsi + +#### Stuff for maintaining SCM below #### + +ver = $(VERSION) +version.txi: patchlvl.h + echo @set SCMVERSION $(ver) > version.txi + echo @set SCMDATE `date +"%B %Y"` >> version.txi + +RM_R = rm -rf + +confiles = scmconfig.h.in mkinstalldirs acconfig-1.5.h install-sh \ + configure configure.in Makefile.in COPYING COPYING.LESSER \ + README.unix + +tfiles = r4rstest.scm example.scm pi.scm pi.c split.scm bench.scm \ + syntest2.scm syntest1.scm +texifiles = version.txi scm.texi fdl.texi indexes.texi platform.txi features.txi +dfiles = ANNOUNCE README COPYING COPYING.LESSER scm.1 scm.doc QUICKREF \ + $(texifiles) scm.info Xlibscm.info Xlibscm.texi \ + hobbit.info hobbit.texi ChangeLog +mfiles = Makefile build.scm build build.bat requires.scm \ + .gdbinit mkimpcat.scm disarm.scm scm.spec scm.nsi +sfiles = setjump.mar setjump.s ugsetjump.s continue-ia64.S \ + get-contoffset-ia64.c +wbfiles = wbtab.scm rwb-isam.scm +afiles = $(dfiles) $(cfiles) $(hfiles) $(ifiles) $(tfiles) $(mfiles) \ + $(hobfiles) $(sfiles) $(ufiles) $(xfiles) $(turfiles) $(wbfiles) + +makedev = make -f $(HOME)/makefile.dev +CHPAT=$(HOME)/bin/chpat +RSYNC=rsync -bav +UPLOADEE=swissnet_upload +dest = $(HOME)/dist/ +DOSCM = /c/Voluntocracy/dist/ + +temp/scm: $(afiles) + -$(RM_R) temp + mkdir -p temp/scm + ln $(afiles) temp/scm + +release: dist pdf # rpm + cvs tag -F scm-$(VERSION) + cp ANNOUNCE $(htmldir)SCM_ANNOUNCE.txt + $(RSYNC) $(htmldir)SCM.html $(htmldir)SCM_ANNOUNCE.txt $(UPLOADEE):public_html/ + $(RSYNC) $(dest)README $(dest)scm-$(VERSION).zip \ + $(dest)scm-$(VERSION)-$(RELEASE).src.rpm $(dest)scm-$(VERSION)-$(RELEASE).i386.rpm \ + $(htmldir)hobbit.pdf $(htmldir)Xlibscm.pdf $(UPLOADEE):dist/ +# upload $(dest)README $(dest)scm-$(VERSION).zip ftp.gnu.org:gnu/jacal/ + +upzip: $(HOME)/pub/scm.zip + $(RSYNC) $(HOME)/pub/scm.zip $(UPLOADEE):pub/ + $(RSYNC) r4rstest.scm $(HOME)/dist/ + $(RSYNC) r4rstest.scm $(UPLOADEE):dist/ + +dist: $(dest)scm-$(VERSION).zip +$(dest)scm-$(VERSION).zip: temp/scm + $(makedev) DEST=$(dest) PROD=scm ver=-$(VERSION) zip + +rpm: pubzip +# $(dest)scm-$(VERSION)-$(RELEASE).i386.rpm: $(dest)scm-$(VERSION).zip + cp -f $(HOME)/pub/scm.zip $(rpm_prefix)SOURCES/scm-$(VERSION).zip + rpmbuild -ba scm.spec # --clean + rm $(rpm_prefix)SOURCES/scm-$(VERSION).zip + mv $(rpm_prefix)RPMS/i386/scm-$(VERSION)-$(RELEASE).i386.rpm \ + $(rpm_prefix)SRPMS/scm-$(VERSION)-$(RELEASE).src.rpm $(dest) + +shar: scm.shar +scm.shar: temp/scm + $(makedev) PROD=scm shar +dclshar: scm.com +com: scm.com +scm.com: temp/scm + $(makedev) PROD=scm com +zip: scm.zip +scm.zip: temp/scm + $(makedev) PROD=scm zip +doszip: $(DOSCM)scm-$(VERSION).zip +$(DOSCM)scm-$(VERSION).zip: temp/scm turtle turtlegr.c grtest.scm SCM.ico scm.html hobbit.html + $(makedev) DEST=$(DOSCM) PROD=scm ver=-$(VERSION) zip + -cd ..; zip -9ur $(DOSCM)scm-$(VERSION).zip \ + scm/turtle scm/turtlegr.c scm/grtest.scm \ + scm/SCM.ico \ + scm/scm.html scm/hobbit.html + zip -d $(DOSCM)scm-$(VERSION).zip scm/scm.info scm/Xlibscm.info scm/hobbit.info +pubzip: $(HOME)/pub/scm.zip +$(HOME)/pub/scm.zip: temp/scm + $(makedev) DEST=$(HOME)/pub/ PROD=scm zip + +diffs: pubdiffs +pubdiffs: temp/scm + $(makedev) DEST=$(HOME)/pub/ PROD=scm pubdiffs +distdiffs: temp/scm + $(makedev) DEST=$(dest) PROD=scm ver=$(ver) distdiffs + +CITERS = ANNOUNCE hobbit.texi hobbit.scm \ + ../jacal/ANNOUNCE ../jacal/jacal.texi \ + ../wb/ANNOUNCE ../wb/README ../wb/wb.texi \ + ../synch/ANNOUNCE \ + ../dist/README \ + $(DOSCM)unzipall.bat $(DOSCM)buildall \ + $(htmldir)JACAL.html $(htmldir)README.html \ + $(htmldir)SIMSYNCH.html $(htmldir)SLIB.html \ + $(htmldir)FreeSnell/ANNOUNCE $(htmldir)FreeSnell/index.html +CITES = scm.spec scm.nsi ../wb/wb.spec $(htmldir)SCM.html + +updates: Init$(ver).scm + $(CHPAT) slib-$(VERSION) slib-$(ver) $(CITERS) + $(CHPAT) $(VERSION) $(ver) $(CITES) + make README + +Init$(ver).scm: + mv -f Init$(VERSION).scm Init$(ver).scm + $(CHPAT) $(VERSION) $(ver) patchlvl.h Init$(ver).scm + +new: updates + echo `date -I` \ Aubrey Jaffer \ \<`whoami`@`hostname`\>> change + echo>> change + echo \ \* patchlvl.h \(SCMVERSION\): Bumped from $(VERSION) to $(ver).>>change + echo>> change + cat ChangeLog >> change + mv -f change ChangeLog + cvs remove Init$(VERSION).scm + cvs add Init$(ver).scm + cvs commit -m 'Init$(VERSION).scm changed to Init$(ver).scm' \ + Init$(VERSION).scm Init$(ver).scm + cvs commit -m '(SCMVERSION): Bumped from $(VERSION) to $(ver).' + cvs tag -F scm-$(ver) + +configtemp/scm: $(confiles) + -$(RM_R) configtemp/scm + -mkdir -p configtemp/scm + ln $(confiles) configtemp/scm +confdist: scmconfig.tar.gz +scmconfig.tar.gz: configtemp/scm + cd configtemp; tar cohf ../scmconfig.tar scm + chmod 664 scmconfig.tar + -rm -f scmconfig.tar.*z + gzip scmconfig.tar + chmod 664 scmconfig.tar.*z + +lint: lints +lints: $(cfiles) $(hfiles) + lint $(CPPFLAGS) $(ALL_CFLAGS) $(cfiles) | tee lints +# lint $(CPPFLAGS) $(ALL_CFLAGS) $(cfiles) | tee lintes + +#seds to help find names not unique in first 8 characters (name8s) +# for BSD nm format +SED_TO_STRIP_NM=sed -e '/.*\.o$$/d' -e 's/.* _//' -e 's/.* T //' +#old, bad for T [^_] on suns: SED_TO_STRIP_NM=sed -e '/.*\.o$$/d' -e 's/.* _//' +# For a System V nm where plain C identifiers have _ prepended: +#SED_TO_STRIP_NM=sed -e '/^_[A-Za-z][A-za-z0-9_]*[ |].*|extern|!d' -e 's/|/ /g' -e 's/^_//' +# For a System V nm where plain C identifiers have nothing prepended: +#SED_TO_STRIP_NM=sed -e '/^[A-Za-z][A-za-z0-9_]*[ |].*|extern|!d' -e 's/|/ /g' + +name8: name8s +name8s: scmlit + nm scmlit |\ + $(SED_TO_STRIP_NM) |\ + sort -u|\ + awk '{ if (substr(l,1,8)==substr($$1,1,8)) {\ + if (p) print l;\ + print $$1;p=0;stat=1\ + }else p=1;\ + l=$$1\ + }END{exit stat}' - + +ctagfiles = $(hfiles) $(cfiles) $(xfiles) +ctags: $(ctagfiles) + etags $(ctagfiles) + +TAGFILES = $(hfiles) $(cfiles) $(ifiles) $(sfiles) $(xfiles) $(mfiles)\ + $(txifiles) Xlibscm.texi hobbit.texi build hobbit.scm +# # $(ufiles) ChangeLog +TAGS: $(TAGFILES) + etags $(TAGFILES) +tags: TAGS + +mostlyclean: +clean: + -rm -f core a.out ramap.o ramap.obj $(ofiles) scmmain.o lints + -$(RM_R) *temp +distclean: clean + -rm -f $(EXECFILES) *.o *.obj a.out TAGS implcat slibcat gdbscm +realclean: distclean + -rm -f scm.doc scm.html hobbit.html scm.exe scmlit.exe scm~ SCM-*.exe +realempty: temp/scm + -rm -f $(afiles) +myclean: clean + -rm -f *~ *.bak *.orig *.rej tmp* \#* *\# diff --git a/SCM/README b/SCM/README new file mode 100644 index 0000000..e6d4e57 --- /dev/null +++ b/SCM/README @@ -0,0 +1,381 @@ +This directory contains the distribution of scm5e5. SCM conforms to +Revised^5 Report on the Algorithmic Language Scheme and the IEEE P1178 +specification. SCM runs under Amiga, Atari-ST, MacOS, MS-DOS, OS/2, +NOS/VE, Unicos, VMS, Unix and similar systems. SCM supports the SLIB +Scheme library; both SCM and SLIB are GNU packages. + + `http://swiss.csail.mit.edu/~jaffer/SCM' + +0.1 Manifest +============ + +`.gdbinit' provides commands for debugging SCM with GDB +`COPYING' GNU GENERAL PUBLIC LICENSE +`COPYING.LESSER' GNU LESSER GENERAL PUBLIC LICENSE +`ChangeLog' changes to SCM. +`Idiffer.scm' Linear-space O(PN) sequence comparison. +`Iedline.scm' Gnu readline input editing. +`Init.scm' Scheme initialization. +`Link.scm' Dynamic link/loading. +`Macro.scm' Supports Syntax-Rules Macros. +`Makefile' builds SCMLIT using the `make' program. +`QUICKREF' Quick Reference card for R4RS and IEEE Scheme. +`README' contains a MANIFEST, INSTALLATION INSTRUCTIONS, hints + for EDITING SCHEME CODE, and a TROUBLE SHOOTING GUIDE. +`Transcen.scm' inexact builtin procedures. +`bench.scm' computes and records performance statistics of pi.scm. +`build.bat' invokes build.scm for MS-DOS +`build.scm' database for compiling and linking new SCM programs. +`byte.c' strings as bytes. +`bytenumb.c' Byte-number conversions. +`compile.scm' Hobbit compilation to C. +`continue-ia64.S'replaces make_root_continuation(), make_continuation(), + and dynthrow() in continue.c +`continue.c' continuations. +`continue.h' continuations. +`crs.c' interactive terminal control. +`debug.c' debugging, printing code. +`differ.c' Linear-space O(PN) sequence comparison. +`dynl.c' dynamically load object files. +`ecrt0.c' discover the start of initialized data space + dynamically at runtime. +`edline.c' Gnu readline input editing (get + ftp.sys.toronto.edu:/pub/rc/editline.shar). +`eval.c' evaluator, apply, map, and foreach. +`example.scm' example from R4RS which uses inexact numbers. +`fdl.texi' GNU Free Documentation License. +`findexec.c' find the executable file function. +`get-contoffset-ia64.c'makes contoffset-ia64.S for inclusion by continue-ia64.S +`gmalloc.c' Gnu malloc(); used for unexec. +`gsubr.c' make_gsubr for arbitrary (< 11) arguments to C + functions. +`ioext.c' system calls in common between PC compilers and unix. +`lastfile.c' find the point in data space between data and libraries. +`macos-config.h' Included by unexmacosx.c and lastfile.c. +`mkimpcat.scm' build SCM-specific catalog for SLIB. +`patchlvl.h' patchlevel of this release. +`pi.c' computes digits of pi [cc -o pi pi.c;time pi 100 5]. +`pi.scm' computes digits of pi [type (pi 100 5)]. Test + performance against pi.c. +`posix.c' posix library interface. +`pre-crt0.c' loaded before crt0.o on machines which do not remap + part of the data space into text space in unexec. +`r4rstest.scm' tests conformance with Scheme specifications. +`ramap.c' array mapping +`record.c' proposed `Record' user definable datatypes. +`repl.c' error, read-eval-print loop, read, write and load. +`rgx.c' string regular expression match. +`rope.c' C interface functions. +`sc2.c' procedures from R2RS and R3RS not in R4RS. +`scl.c' inexact arithmetic +`scm.1' unix style man page. +`scm.c' initialization, interrupts, and non-IEEE utility + functions. +`scm.doc' man page generated from scm.1. +`scm.h' data type and external definitions of SCM. +`scm.texi' SCM installation and use. +`scmfig.h' contains system dependent definitions. +`scmmain.c' initialization, interrupts, and non-IEEE utility + functions. +`script.c' utilities for running as `#!' script. +`setjump.h' continuations, stacks, and memory allocation. +`setjump.mar' provides setjump and longjump which do not use $unwind + utility on VMS. +`setjump.s' provides setjump and longjump for the Cray YMP. +`socket.c' BSD socket interface. +`split.scm' example use of crs.c. Input, output, and diagnostic + output directed to separate windows. +`subr.c' the rest of IEEE functions. +`sys.c' call-with-current-continuation, opening and closing + files, storage allocation and garbage collection. +`time.c' functions dealing with time. +`ugsetjump.s' provides setjump and longjump which work on Ultrix VAX. +`unexalpha.c' Convert a running program into an Alpha executable file. +`unexec.c' Convert a running program into an executable file. +`unexelf.c' Convert a running ELF program into an executable file. +`unexhp9k800.c' Convert a running HP-UX program into an executable file. +`unexmacosx.c' Convert a running program into an executable file under + MacOS X. +`unexsgi.c' Convert a running program into an IRIX executable file. +`unexsunos4.c' Convert a running program into an executable file. +`unif.c' uniform vectors. +`unix.c' non-posix system calls on unix systems. + + + +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: 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: 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: 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 + <stdlib.h> and <sys/types.h>. + Remove STDC_HEADERS in scmfig.h. + Edit <sys/types.h> 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<kb> or INIT_HEAP_SIZE. +ERROR: Could not allocate. Check sizet definition. + Use 32 bit compiler mode. + Don't try to run as subproccess. +remove <FLAG> in scmfig.h and Do so and recompile files. +recompile scm. +add <FLAG> 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) + #<primitive-procedure boolean?> + #<primitive-procedure char?> + #<primitive-procedure null?> + #<primitive-procedure number?> + ... + +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 + #<unspecified> + > (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 + #<unspecified> + +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'. + diff --git a/SCM/continue-ia64.S b/SCM/continue-ia64.S new file mode 100644 index 0000000..ba61e38 --- /dev/null +++ b/SCM/continue-ia64.S @@ -0,0 +1,339 @@ +/* "continue-ia64.S" continuation support for ia64. + * Copyright (C) 2006 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* Author: Richard E. Harke */ + +/* +struct Continuation {jump_buf jmpbuf; + long thrwval; + long length; + STACKITEM *stkbse; +#ifdef __ia64__ + long *bspbse; + long bsplength; + long rnat; +#endif + CONTINUATION_OTHER other; + struct Continuation *parent; + }; +*/ +/* Define offsets for elements of a Continuation structure */ +#include "contoffset-ia64.S" + + + .global must_malloc + .text + .align 32 + .global make_root_continuation + .proc make_root_continuation +make_root_continuation: + .prologue + .save ar.pfs,r33 + alloc r33 = ar.pfs,1,3,2,0 + .save rp,r34 + mov r34 = b0 + .body + addl r14 = @ltoffx(s_call_cc), r1 + mov out0 = cont_size + mov loc2 = gp + ;; + ld8.mov r14 = [r14], s_call_cc + ;; + adds out1 = 18, r14 + ;; + br.call.sptk.many b0=must_malloc + ;; + mov gp = r35 + cmp.eq p6,p0 = r8,r0 + adds r14 = stkbse_off,r8 + adds r15 = bspbse_off,r8 + (p6) br.cond.dpnt mrcexit + ;; + flushrs + st8 [r14] = r12 + ;; + mov r31 = ar.bsp + ;; + adds r14 = length_off,r8 + st8 [r15] = r31 + adds r16 = bsplength_off,r8 + ;; + st8 [r14] = r0 + st8 [r16] = r0 + adds r15 = parent_off,r8 + ;; + st8 [r15] = r8 +mrcexit: + mov ar.pfs = r33 + mov b0 = r34 + ;; + br.ret.sptk.many b0 + .endp make_root_continuation + + /* + register usage + r32 - r39 used in modulo loop (requires multiple of 8) + r40 save r32 from input + r41 save return - b0 + r42 ar.pfs + r43 save gp (r1) + r44 ar.bsp + r45 out0 + r46 out1 + */ + .global make_continuation + .proc make_continuation +make_continuation: + .prologue + .save ar.pfs, r42 + alloc r42 = ar.pfs, 1,12, 2, 8 + mov r43 = r1 + .save rp, r41 + mov r41 = b0 + mov r40 = r32 + ;; + .body + adds r14 = bspbse_off,r40 + adds r17 = stkbse_off,r40 + ;; + mov r44 = ar.bsp + ld8 r15 = [r14] // bspbse from parent + ld8 r18 = [r17] // stkbse from parent + ;; + sub r16 = r44,r15 // length of bsp to save + sub r19 = r18,r12 // length of stack to save + addl r15 = @ltoffx(s_call_cc), r1 + ;; + add r45 = r16,r19 // bsp len plus stack len + ld8.mov r14 = [r15], s_call_cc + ;; + adds r14 = 18, r14 + adds r45 = cont_size, r45 // add in length of continuation struct + ;; + mov r46 = r14 + br.call.sptk.many b0 = must_malloc + mov r1 = r43 + cmp.eq p6, p7 = 0, r8 + (p6) br.cond.dptk .L5 + ;; +.L1: + flushrs + adds r14 = bspbse_off,r40 + adds r17 = stkbse_off,r40 + ;; + mov r31 = ar.rsc + ld8 r15 = [r14] // bsp in parent + ld8 r18 = [r17] // stack base in parent + ;; + and r30 = ~0x3,r31 + sub r16 = r44,r15 // length of bsp to save + sub r19 = r18,r12 // length of stack to save + ;; + mov ar.rsc = r30 // set enforced idle + shr r16 = r16,3 // number of longs not bytes + adds r21 = length_off,r8 + adds r22 = bsplength_off,r8 + shr r19 = r19,3 // number of longs not bytes + ;; + mov r30 = ar.rnat + add r20 = r16,r19 // total length to save + st8 [r22] = r16 // store the bsp length + adds r14 = bspbse_off,r8 + adds r17 = stkbse_off,r8 + ;; + st8 [r14] = r44 // save current bsp + st8 [r17] = r18 // stkbse same as parent stkbse + adds r22 = parent_off,r8 + st8 [r21] = r20 // store the length + ;; + adds r21 = rnat_off,r8 + st8 [r22] = r40 // store parent continuation + mov r29 = ar.lc // need to preserve ar.lc + mov r28 = pr // need to preserve pr.rot + adds r16 = -1,r16 + ;; + st8 [r21] = r30 // store rnat's + mov ar.lc = r16 + mov ar.ec = 3 + mov pr.rot = 0x10000 + adds r27 = cont_size,r8 + adds r19 = -1,r19 + ;; +.L6: + (p16) ld8 r32 = [r15],8 + (p18) st8 [r27] = r34,8 + br.ctop.sptk.few .L6 + ;; + mov r26 = r12 + clrrrb + ;; + mov ar.ec = 3 + mov pr.rot = 0x10000 + mov ar.lc = r19 + ;; +.L7: + (p16) ld8 r32 = [r26],8 + (p18) st8 [r27] = r34,8 + br.ctop.sptk.few .L7 + ;; + mov ar.lc = r29 // restore ar.lc + mov pr = r28,0x1003e // restore pr + mov ar.rsc = r31 // restore ar.rsc + ;; +.L5: + mov ar.pfs = r42 + mov b0 = r41 + br.ret.sptk.many b0 + .endp make_continuation + + + .global thrown_value + .global longjmp + .global dynthrow + .proc dynthrow +dynthrow: + .prologue + .save ar.pfs, r42 + alloc r42 = ar.pfs, 1,12, 2, 8 + mov r43 = r1 + .save rp, r44 + mov r44 = b0 + ld8 r40 = [r32],8 + mov r31 = ar.rsc + movl r2 = ~0x3fff0003 + ;; +.L3: + flushrs + adds r14 = bspbse_off,r40 + adds r17 = stkbse_off,r40 + and r30 = r2,r31 + ;; + ld8 r41 = [r32] + ld8 r15 = [r14] // bsp + ld8 r18 = [r17] // stack base + mov ar.rsc = r30 // set enforced idle + ;; +.L2: + loadrs + adds r21 = length_off,r40 + adds r22 = bsplength_off,r40 + ;; + mov ar.bspstore = r15 + ld8 r16 = [r21] // get total length (number of longs) + ld8 r17 = [r22] // get bsp length (number of longs) + ;; + sub r20 = r16,r17 // compute stack length + shl r25 = r17,3 + ;; + mov r29 = ar.lc // need to preserve ar.lc + mov r28 = pr // need to preserve pr.rot + sub r15 = r15,r25 // adjust bsp beginning + shl r14 = r20,3 + adds r17 = -1,r17 + adds r21 = rnat_off,r40 + ;; + sub r18 = r18,r14 // adjust stack to lowest + mov ar.lc = r17 + mov ar.ec = 3 + mov pr.rot = 0x10000 + adds r27 = cont_size,r40 + adds r20 = -1,r20 + ;; +.L8: + (p16) ld8 r32 = [r27],8 + (p18) st8 [r15] = r34,8 + br.ctop.sptk.few .L8 + ;; + ld8 r14 = [r21] // get the rnat's + clrrrb + ;; + mov ar.ec = 3 + mov pr.rot = 0x10000 + mov ar.lc = r20 + ;; +.L9: + (p16) ld8 r32 = [r27],8 + (p18) st8 [r18] = r34,8 + br.ctop.sptk.few .L9 + ;; + mov ar.rnat = r14 + mov ar.lc = r29 // restore ar.lc + mov pr = r28,0x1003e // restore pr + addl r26 = @gprel(thrown_value),gp + ;; + mov ar.rsc = r31 // restore ar.rsc + st8 [r26] = r41 + mov r45 = r40 + mov r46 = 1 + ;; + br.call.sptk.many b0 = longjmp +// the following should not be executed + mov r1 = r43 + mov ar.pfs = r42 + mov b0 = r44 + br.ret.sptk.many b0 + .endp dynthrow + + .global mark_locations + .global mark_regs_ia64 + .proc mark_regs_ia64 +mark_regs_ia64: + .prologue + .save ar.pfs, r35 + alloc r35 = ar.pfs, 1, 4, 2, 0 + .save rp, r33 + mov r33 = b0 + mov r36 = r1 + mov r34 = r12 + adds r17 = stkbse_off, r32 + ;; + adds r12 = -32, r12 + ld8 r19 = [r17] + ;; + adds r18 = 16,r12 + ;; + sub r38 = r19, r18 + ;; + st8 [r18] = r4, 8 + shr r38 = r38, 3 + ;; + st8 [r18] = r5, 8 + ;; + st8 [r18] = r6, 8 + ;; + st8 [r18] = r7 + mov r37 = r12 + br.call.sptk.many b0 = mark_locations + flushrs + mov r1 = r36 + adds r17 = bspbse_off, r32 + ;; + mov r20 = ar.bsp + ;; + ld8 r37 = [r17] + ;; + sub r38 = r20, r37 + ;; + shr r38 = r38, 3 + br.call.sptk.many b0 = mark_locations + mov r1 = r36 + mov r12 = r34 + mov ar.pfs = r35 + mov b0 = r33 + br.ret.sptk.many b0 + .endp mark_regs_ia64 diff --git a/SCM/continue.c b/SCM/continue.c new file mode 100644 index 0000000..1f8c6de --- /dev/null +++ b/SCM/continue.c @@ -0,0 +1,242 @@ +/* "continue.c" Scheme Continuations for C. + * Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* Author: Aubrey Jaffer */ + +/* "setjump.h" contains definitions for the `other' field (type + CONTINUATION_OTHER) the struct Continuation. "setjump.h" must + #include "continue.h". CONTINUATION_OTHER defaults to `long' */ + +#define IN_CONTINUE_C +#ifdef USE_CONTINUE_H +# include "continue.h" +#else +# include "setjump.h" +#endif + +/* For platforms with short integers, we use thrown_value instead of + the value returned from setjump so that any (long) value can be + returned. */ + +#ifdef SHORT_INT +long thrown_value; +#endif + +/* stack_size() returns the number of units of size STACKITEM which + fit between @var{start} and the current top of stack. No check is + done in this routine to ensure that @var{start} is actually in the + current stack segment. */ + +long stack_size(start) + STACKITEM *start; +{ + STACKITEM stack; +#ifdef STACK_GROWS_UP + return &stack - start; +#else + return start - &stack; +#endif /* def STACK_GROWS_UP */ +} + +/* make_root_continuation() allocates (malloc) storage for a + CONTINUATION near the current extent of stack. This newly + allocated CONTINUATION is returned if successful, 0 if not. After + make_root_continuation() returns, the calling routine still needs + to `setjump(new_continuation->jmpbuf)' in order to complete the + capture of this continuation. */ + +#ifndef __ia64__ +CONTINUATION *make_root_continuation(stack_base) + STACKITEM *stack_base; +{ + CONTINUATION *cont; + cont = (CONTINUATION *)malloc(sizeof(CONTINUATION)); + if (!cont) return 0; + cont->length = 0; + cont->stkbse = stack_base; + cont->parent = cont; + return cont; +} + +/* make_continuation() allocates storage for the current continuation, + copying (or encapsulating) the stack state from parent_cont->stkbse + to the current top of stack. The newly allocated CONTINUATION is + returned if successful, 0 if not. After make_continuation() + returns, the calling routine still needs to + `setjump(new_continuation->jmpbuf)' in order to complete the capture + of this continuation. */ + +/* Note: allocating local (stack) storage for the CONTINUATION would + not work; Think about it. */ + +CONTINUATION *make_continuation(parent_cont) + CONTINUATION *parent_cont; +{ + CONTINUATION *cont; +# ifdef CHEAP_CONTINUATIONS + cont = (CONTINUATION *)malloc(sizeof(CONTINUATION)); + if (!cont) return 0; + cont->length = 0; + cont->stkbse = parent_cont->stkbse; +# else + long j; + register STACKITEM *src, *dst; + FLUSH_REGISTER_WINDOWS; + j = stack_size(parent_cont->stkbse); + cont = (CONTINUATION *)malloc((sizeof(CONTINUATION) + j*sizeof(STACKITEM))); + if (!cont) return 0; + cont->length = j; + cont->stkbse = parent_cont->stkbse; + src = cont->stkbse; +# ifdef STACK_GROWS_UP + src += parent_cont->length; +# else + src -= parent_cont->length + cont->length; +# endif/* ndef STACK_GROWS_UP */ + dst = (STACKITEM *)(cont + 1); + for (j = cont->length; 0 <= --j; ) *dst++ = *src++; +# endif /* ndef CHEAP_CONTINUATIONS */ + cont->parent = parent_cont; + return cont; +} +#endif + +/* free_continuation() is trivial, but who knows what the future + holds. */ + +void free_continuation(cont) + CONTINUATION *cont; +{ + free(cont); +} + +/* Final routine involved in throw()ing to a continuation. After + ensuring that there is sufficient room on the stack for the saved + continuation, dynthrow() copies the continuation onto the stack and + longjump()s into it. The routine does not return. */ + +/* If you use conservative GC and your 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 make-CONTINUATION. + + Possibly adding the following before the thrown_value = val; line + might help to clear out unused stack above the continuation (a + small part of the problem). + +#ifdef sparc + bzero((void *)&a, sizeof(STACKITEM) * + (((STACKITEM *)&a) - (dst - cont->length))) +#endif + + Let me know if you try it. */ + +/* SCM_GROWTH is how many `long's to grow the stack by when we need room. */ +#define SCM_GROWTH 100 + +#ifndef __ia64__ +void dynthrow(a) + long *a; +{ + register CONTINUATION *cont = (CONTINUATION *)(a[0]); + long val = a[1]; +# ifndef CHEAP_CONTINUATIONS + register long j; + register STACKITEM *src, *dst = cont->stkbse; +# ifdef STACK_GROWS_UP +# ifndef hpux + if (a[2] && (a - ((long *)a[3]) < SCM_GROWTH)) + puts("grow_throw: check if long growth[]; being optimized out"); +# endif + /* if (a[2]) fprintf(stderr, " ct = %ld, dist = %ld\n", a[2], (((long *)a[3]) - a)); */ + if (PTR_GE(dst + (cont->length), (STACKITEM *)&a)) grow_throw(a); +# else +# ifndef hpux + if (a[2] && (((long *)a[3]) - a < SCM_GROWTH)) + puts("grow_throw: check if long growth[]; being optimized out"); +# endif + /* if (a[2]) fprintf(stderr, " ct = %ld, dist = %ld\n", a[2], (((long *)a[3]) - a)); */ + dst -= cont->length; + if (PTR_LE(dst, (STACKITEM *)&a)) grow_throw(a); +# endif/* def STACK_GROWS_UP */ + FLUSH_REGISTER_WINDOWS; + src = (STACKITEM *)(cont + 1); + for (j = cont->length;0 <= --j;) *dst++ = *src++; +# endif /* ndef CHEAP_CONTINUATIONS */ +# ifdef SHORT_INT + thrown_value = val; + longjump(cont->jmpbuf, 1); +# else + longjump(cont->jmpbuf, val); +# endif +} + +/* grow_throw() grows the stack by SCM_GROWTH long words. If the + "sizeof growth" assignment is not sufficient to restrain your + overly optimistic compiler, the stack will grow by much less and + grow_throw() and dynthrow() will waste time calling each other. To + fix this you will have to compile grow_throw() in a separate file + so the compiler won't be able to guess that the growth array isn't + all used. */ + +# ifndef CHEAP_CONTINUATIONS +void grow_throw(a) /* Grow the stack so that there is room */ + long *a; /* to copy in the continuation. Then */ +{ /* retry the throw. */ + long growth[SCM_GROWTH]; + growth[0] = a[0]; + growth[1] = a[1]; + growth[2] = a[2] + 1; + growth[3] = (long) a; + growth[SCM_GROWTH-1] = sizeof growth; + dynthrow(growth); +} +# endif /* ndef CHEAP_CONTINUATIONS */ +#endif + +/* throw_to_continuation() restores the stack in effect when + @var{cont} was made and resumes @var{cont}'s processor state. If + the stack cannot be resotred because @var{cont} and @var{root_cont} + do not have the same stkbase, @code{throw_to_continuation() + returns. */ + +/* Note: If 2 or more @var{cont}s share a parent continuation and if + the values of stack allocated variables in that parent continuation + are changed, the results are unspecified. This is because the + parent continuation may or may not be reloaded, depending on what + other throws have intervened. */ + +void throw_to_continuation(cont, val, root_cont) + CONTINUATION *cont; + long val; + CONTINUATION *root_cont; +{ + long a[3]; + a[0] = (long)cont; + a[1] = val; + a[2] = 0; + if (cont->stkbse != root_cont->stkbse) + return; /* Stale continuation */ + dynthrow(a); +} diff --git a/SCM/continue.h b/SCM/continue.h new file mode 100644 index 0000000..d901e01 --- /dev/null +++ b/SCM/continue.h @@ -0,0 +1,185 @@ +/* Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 2006 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* "continue.h" Scheme Continuations for C. + Author: Aubrey Jaffer. */ + +#ifndef STDC_HEADERS +#define STDC_HEADERS 1 +#endif + +#include <stdlib.h> + +/* If stack is not longword aligned then */ + +/* #define SHORT_ALIGN */ +#ifdef THINK_C +# define SHORT_ALIGN +#endif +#ifdef __MWERKS__ +# ifdef __MC68K__ +# define SHORT_ALIGN +# endif +#endif +#ifdef MSDOS +# ifndef _M_ARM +/* arm processors need DWORD aligned data access */ +# define SHORT_ALIGN +# endif +#endif +#ifdef atarist +# define SHORT_ALIGN +#endif + +#ifdef SHORT_ALIGN +typedef short STACKITEM; +#else +typedef long STACKITEM; +#endif + +/* If stacks grow up then */ + +/* #define STACK_GROWS_UP */ +#ifdef hp9000s800 +# define STACK_GROWS_UP +#endif +#ifdef pyr +# define STACK_GROWS_UP +#endif +#ifdef nosve +# define STACK_GROWS_UP +#endif +#ifdef _UNICOS +# define STACK_GROWS_UP +#endif + +/* James Clark came up with this neat one instruction fix for + continuations on the SPARC. It flushes the register windows so + that all the state of the process is contained in the stack. */ + +#ifdef sparc +# define FLUSH_REGISTER_WINDOWS asm("ta 3") +#else +# define FLUSH_REGISTER_WINDOWS /* empty */ +#endif + +#ifdef vax +# ifndef CHEAP_CONTINUATIONS + +typedef int jump_buf[17]; +extern int setjump(jump_buf env); +extern int longjump(jump_buf env, int ret); + +# else +# include <setjmp.h> +# define jump_buf jmp_buf +# define setjump setjmp +# define longjump longjmp +# endif +#else /* ndef vax */ +# ifdef _CRAY1 + +typedef int jump_buf[112]; +extern int setjump(jump_buf env); +extern int longjump(jump_buf env, int ret); + +# else /* ndef _CRAY1 */ +# ifndef PLAN9 +# include <setjmp.h> +# include <signal.h> +# endif +# ifdef SIG_UNBLOCK +# define jump_buf sigjmp_buf +# define setjump(buf) sigsetjmp((buf), !0) +# define longjump siglongjmp +# else +# define jump_buf jmp_buf +# define setjump setjmp +# define longjump longjmp +# endif /* ndef SIG_UNBLOCK */ +# endif /* ndef _CRAY1 */ +#endif /* ndef vax */ + +/* `other' is a CONTINUATION slot for miscellaneous data of type + CONTINUATION_OTHER. */ + +#ifndef CONTINUATION_OTHER +# define CONTINUATION_OTHER int +#endif + +struct Continuation {jump_buf jmpbuf; + long thrwval; + long length; + STACKITEM *stkbse; +#ifdef __ia64__ + long *bspbse; + long bsplength; + long rnat; +#endif + CONTINUATION_OTHER other; + struct Continuation *parent; + }; +typedef struct Continuation CONTINUATION; + +#ifndef P +# ifdef USE_ANSI_PROTOTYPES +# define P(s) s +# else +# define P(s) () +# endif +#endif + +extern long thrown_value; +long stack_size P((STACKITEM *start)); +CONTINUATION *make_root_continuation P((STACKITEM *stack_base)); +CONTINUATION *make_continuation P((CONTINUATION *parent_cont)); +void free_continuation P((CONTINUATION *cont)); +void dynthrow P((long *a)); +void grow_throw P((long *a)); +void throw_to_continuation P((CONTINUATION *cont, long val, + CONTINUATION *root_cont)); + +/* how to get the local definition for malloc */ + +#ifndef STDC_HEADERS +# ifndef malloc + char *malloc P((sizet size)); +# endif + char *realloc P((char *ptr, sizet size)); +#endif + +/* PTR_LT defines how to compare two addresses (which may not be in + the same array). */ + +#if defined(__TURBOC__) && !defined(__TOS__) +# ifdef PROT386 +# define PTR_LT(x, y) (((long)(x)) < ((long)(y))) +# else +# define PTR_LT(x, y) ((x) < (y)) +# endif +#else /* not __TURBOC__ */ +# ifdef nosve +# define PTR_MASK 0xffffffffffff +# define PTR_LT(x, y) (((int)(x)&PTR_MASK) < ((int)(y)&PTR_MASK)) +# else +# define PTR_LT(x, y) ((x) < (y)) +# endif +#endif + +#define PTR_GT(x, y) PTR_LT(y, x) +#define PTR_LE(x, y) (!PTR_GT(x, y)) +#define PTR_GE(x, y) (!PTR_LT(x, y)) diff --git a/SCM/scm.h b/SCM/scm.h new file mode 100644 index 0000000..763f2b2 --- /dev/null +++ b/SCM/scm.h @@ -0,0 +1,1145 @@ +/* "scm.h" SCM data types and external functions. + * Copyright (C) 1990-2006 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 +# include <windows.h> +#endif + +#ifdef _WIN32_WCE +# include <windows.h> +#endif + +#ifdef hpux +# ifndef __GNUC__ +# define const /**/ +# endif +#endif + +#ifdef PLAN9 +# include <u.h> +# include <libc.h> +/* Simple imitation of some Unix system calls */ +# define exit(val) exits("") +# define getcwd getwd +/* we have our own isatty */ +int isatty (int); +#endif + +typedef long SCM; +typedef struct {SCM car, cdr;} cell; +typedef struct {long sname;SCM (*cproc)();} subr; +typedef struct {long sname;double (*dproc)();} dsubr; +typedef struct {const char *string;SCM (*cproc)();} iproc; +typedef struct {const char *name;} subr_info; + +#include <stdio.h> +#include "scmfig.h" + +#ifdef _WIN32 +# ifdef SCM_WIN_DLL +# define SCM_DLL_EXPORT __declspec(dllexport) +# define SCM_EXPORT SCM_DLL_EXPORT +# else +# define SCM_DLL_EXPORT /**/ +# define SCM_EXPORT extern +# endif +#else +# define SCM_DLL_EXPORT /**/ +# define SCM_EXPORT extern +#endif + + +typedef struct { + sizet eltsize; + sizet len; + sizet alloclen; + sizet maxlen; + const char *what; + char *elts;} scm_gra; + +#ifdef USE_ANSI_PROTOTYPES +# define P(s) s +#else +# define P(s) () +#endif + +#ifndef STDC_HEADERS + int isatty P((int)); +#endif + +typedef struct { + SCM (*mark)P((SCM)); + sizet (*free)P((CELLPTR)); + int (*print)P((SCM exp, SCM port, int writing)); + SCM (*equalp)P((SCM, SCM)); +} smobfuns; + +typedef struct { + char *name; + SCM (*mark)P((SCM ptr)); + int (*free)P((FILE *p)); + int (*print)P((SCM exp, SCM port, int writing)); + SCM (*equalp)P((SCM, SCM)); + int (*fputc)P((int c, FILE *p)); +/* int (*fputs)P((char *s, FILE *p)); */ +/* sizet (*fwrite)P((char *s, sizet siz, sizet num, FILE *p)); */ + int (*fputs)P((const char *s, FILE *p)); + sizet (*fwrite)P((const void *s, sizet siz, sizet num, FILE *p)); + int (*fflush)P((FILE *stream)); + int (*fgetc)P((FILE *p)); + int (*fclose)P((FILE *p)); + int (*ungetc)P((int c, SCM p)); +} ptobfuns; + +typedef struct { + SCM data; + SCM port; + long flags; + long line; + int unread; + short col; + short colprev; +} port_info; + +typedef struct { + SCM v; + sizet base; +} array; +typedef struct { + long lbnd; + long ubnd; + long inc; +} array_dim; + +#ifdef FLOATS +typedef struct {char *string;double (*cproc)P((double));} dblproc; +# ifdef SINGLES +# ifdef CDR_DOUBLES +typedef struct {SCM type;double num;} flo; +# else +typedef struct {SCM type;float num;} flo; +# endif +# endif +typedef struct {SCM type;double *real;} dbl; +#endif + + /* Conditionals should always expect immediates */ + /* GCC __builtin_expect() is stubbed in scmfig.h */ +#define IMP(x) SCM_EXPECT_TRUE(6 & PTR2INT(x)) +#define NIMP(x) (!IMP(x)) + +#define INUMP(x) SCM_EXPECT_TRUE(2 & PTR2INT(x)) +#define NINUMP(x) (!INUMP(x)) +#define INUM0 ((SCM) 2) +#define ICHRP(x) ((0xff & PTR2INT(x))==0xf4) +#define ICHR(x) ((unsigned char)((x)>>8)) +#define MAKICHR(x) (((x)<<8)+0xf4L) + +#define ILOC00 (0x000000fcL) +#define ILOCP(n) ((0xff & PTR2INT(n))==PTR2INT(ILOC00)) +#define MAKILOC(if, id) (ILOC00 + (((long)id)<<8) + (((long)if)<<16)) +#define IDIST(n) ((PTR2INT(n)>>8) & 0x7f) +#define IFRAME(n) ((PTR2INT(n)>>16)) +#define ICDRP(n) (ICDR & (n)) +#define ICDR (1L<<15) + +/* ISYMP tests for ISPCSYM and ISYM */ +#define ISYMP(n) ((0x187 & PTR2INT(n))==4) +/* IFLAGP tests for ISPCSYM, ISYM and IFLAG */ +#define IFLAGP(n) ((0x87 & PTR2INT(n))==4) +#define ISYMNUM(n) ((PTR2INT((n)>>9)) & 0x7f) +#define ISYMVAL(n) (PTR2INT((n)>>16)) +#define MAKISYMVAL(isym, val) ((isym) | ((long)(val) <<16)) +#define ISYMCHARS(n) (isymnames[ISYMNUM(n)]) +#define MAKSPCSYM(n) (((n)<<9)+((n)<<3)+4L) +#define MAKISYM(n) (((n)<<9)+0x74L) +#define MAKIFLAG(n) (((n)<<9)+0x174L) +/* This is to make the print representation of some evaluated code, + as in backtraces, make a little more sense. */ +#define MAKSPCSYM2(work, look) ((127L & (work)) | ((127L<<9) & (look))) + +SCM_EXPORT char *isymnames[]; +#define NUM_ISPCSYM 14 +#define IM_AND MAKSPCSYM(0) +#define IM_BEGIN MAKSPCSYM(1) +#define IM_CASE MAKSPCSYM(2) +#define IM_COND MAKSPCSYM(3) +#define IM_DO MAKSPCSYM(4) +#define IM_IF MAKSPCSYM(5) +#define IM_LAMBDA MAKSPCSYM(6) +#define IM_LET MAKSPCSYM(7) +#define IM_LETSTAR MAKSPCSYM(8) +#define IM_LETREC MAKSPCSYM(9) +#define IM_OR MAKSPCSYM(10) +#define IM_QUOTE MAKSPCSYM(11) +#define IM_SET MAKSPCSYM(12) +#define IM_FUNCALL MAKSPCSYM(13) + +#define s_and (ISYMCHARS(IM_AND)+2) +#define s_begin (ISYMCHARS(IM_BEGIN)+2) +#define s_case (ISYMCHARS(IM_CASE)+2) +#define s_cond (ISYMCHARS(IM_COND)+2) +#define s_do (ISYMCHARS(IM_DO)+2) +#define s_if (ISYMCHARS(IM_IF)+2) +#define s_lambda (ISYMCHARS(IM_LAMBDA)+2) +#define s_let (ISYMCHARS(IM_LET)+2) +#define s_letstar (ISYMCHARS(IM_LETSTAR)+2) +#define s_letrec (ISYMCHARS(IM_LETREC)+2) +#define s_or (ISYMCHARS(IM_OR)+2) +#define s_quote (ISYMCHARS(IM_QUOTE)+2) +#define s_set (ISYMCHARS(IM_SET)+2) +#define s_define (ISYMCHARS(IM_DEFINE)+2) +#define s_delay (ISYMCHARS(IM_DELAY)+2) +#define s_quasiquote (ISYMCHARS(IM_QUASIQUOTE)+2) +#define s_let_syntax (ISYMCHARS(IM_LET_SYNTAX)+2) + +SCM_EXPORT SCM i_dot, i_quote, i_quasiquote, i_unquote, i_uq_splicing; +#define s_apply (ISYMCHARS(IM_APPLY)+2) + +/* each symbol defined here must have a unique number which + corresponds to it's position in isymnames[] in repl.c */ + /* These are used for dispatch in eval.c */ +#define IM_APPLY MAKISYM(14) +#define IM_FARLOC_CAR MAKISYM(15) +#define IM_FARLOC_CDR MAKISYM(16) +#define IM_DELAY MAKISYM(17) +#define IM_QUASIQUOTE MAKISYM(18) +#define IM_EVAL_FOR_APPLY MAKISYM(19) +#define IM_LET_SYNTAX MAKISYM(20) +#define IM_ACRO_CALL MAKISYM(21) +#define IM_LINUM MAKISYM(22) +#define IM_DEFINE MAKISYM(23) +#define IM_EVAL_VALUES MAKISYM(24) + + /* These are not used for dispatch. */ +#define IM_UNQUOTE MAKISYM(25) +#define IM_UQ_SPLICING MAKISYM(26) +#define IM_ELSE MAKISYM(27) +#define IM_ARROW MAKISYM(28) +#define IM_VALUES_TOKEN MAKISYM(29) +#define IM_KEYWORD MAKISYM(30) + +#define NUM_ISYMS 31 + +#define SCM_MAKE_LINUM(n) (IM_LINUM | ((unsigned long)(n))<<16) +#define SCM_LINUM(x) ((unsigned long)(x)>>16) +#define SCM_LINUMP(x) ((0xffffL & (x))==IM_LINUM) + +#define BOOL_F MAKIFLAG(NUM_ISYMS+0) +#define BOOL_T MAKIFLAG(NUM_ISYMS+1) +#define UNDEFINED MAKIFLAG(NUM_ISYMS+2) +#define EOF_VAL MAKIFLAG(NUM_ISYMS+3) +#ifdef SICP +# define EOL BOOL_F +#else +# define EOL MAKIFLAG(NUM_ISYMS+4) +#endif +#define UNSPECIFIED MAKIFLAG(NUM_ISYMS+5) +#define NUM_IFLAGS NUM_ISYMS+6 + +/* Now some unnamed flags used as magic cookies by scm_top_level. */ +/* Argument n can range from -4 to 16 */ +#ifdef SHORT_INT +# define COOKIE(n) (n) +# define UNCOOK(f) (f) +#else +# define COOKIE(n) MAKIFLAG(NUM_IFLAGS+4+n) +# define UNCOOK(f) (ISYMNUM(f)-(NUM_IFLAGS+4)) +#endif + +#define FALSEP(x) (BOOL_F==(x)) +#define NFALSEP(x) (BOOL_F != (x)) +/* BOOL_NOT returns the other boolean. The order of ^s here is + important for Borland C++. */ +#define BOOL_NOT(x) ((x) ^ (BOOL_T ^ BOOL_F)) +#define NULLP(x) (EOL==(x)) +#define NNULLP(x) (EOL != (x)) +#define UNBNDP(x) (UNDEFINED==(x)) +#define CELLP(x) (!NCELLP(x)) +#define NCELLP(x) ((sizeof(cell)-1) & PTR2INT(x)) + +#define GCMARKP(x) (1 & PTR2INT(CDR(x))) +#define GC8MARKP(x) (0x80 & PTR2INT(CAR(x))) +#define SETGCMARK(x) CDR(x) |= 1; +#define CLRGCMARK(x) CDR(x) &= ~1L; +#define SETGC8MARK(x) CAR(x) |= 0x80; +#define CLRGC8MARK(x) CAR(x) &= ~0x80L; +#define TYP3(x) (7 & PTR2INT(CAR(x))) +#define TYP7(x) (0x7f & PTR2INT(CAR(x))) +#define TYP7S(x) (0x7d & PTR2INT(CAR(x))) +#define TYP16(x) (0xffff & PTR2INT(CAR(x))) +#define TYP16S(x) (0xfeff & PTR2INT(CAR(x))) +#define GCTYP16(x) (0xff7f & PTR2INT(CAR(x))) + +#define NCONSP(x) (1 & PTR2INT(CAR(x))) +#define CONSP(x) (!NCONSP(x)) +#define ECONSP(x) (CONSP(x) || (1==TYP3(x))) +#define NECONSP(x) (NCONSP(x) && (1 != TYP3(x))) +#define SCM_GLOCP(x) (tc3_cons_gloc==(7 & PTR2INT(x))) + +#define CAR(x) (((cell *)(SCM2PTR(x)))->car) +#define CDR(x) (((cell *)(SCM2PTR(x)))->cdr) +#define GCCDR(x) (~1L & CDR(x)) +#define SETCDR(x, v) CDR(x) = (SCM)(v) + +#ifdef _M_ARM +/* MS CLARM compiler bug workaround. */ +volatile SCM MS_CLARM_dumy; +# define CODE(x) (MS_CLARM_dumy = (CAR(x)-tc3_closure)) +#else +# define CODE(x) (CAR(x)-tc3_closure) +#endif +#define CLOSUREP(x) (TYP3(x)==tc3_closure) +#define SETCODE(x, e) CAR(x) = (e)+tc3_closure +#define ENV(x) ((~7L & CDR(x)) ? (~7L & CDR(x)) : EOL) +#define GCENV ENV +#define ARGC(x) ((6L & CDR(x))>>1) +#ifdef CAUTIOUS +# define SCM_ESTK_FRLEN 4 +#else +# define SCM_ESTK_FRLEN 3 +#endif +#define SCM_ESTK_BASE 4 +#define SCM_ESTK_PARENT(v) (VELTS(v)[0]) +#define SCM_ESTK_PARENT_WRITABLEP(v) (VELTS(v)[1]) +#define SCM_ESTK_PARENT_INDEX(v) (VELTS(v)[2]) +SCM_EXPORT long tc16_env, tc16_ident; +#define ENVP(x) (tc16_env==TYP16(x)) +#define SCM_ENV_FORMALS CAR +#ifdef MACRO +# define M_IDENTP(x) (tc16_ident==TYP16(x)) +# define M_IDENT_LEXP(x) ((tc16_ident | (1L<<16))==CAR(x)) +# define IDENTP(x) (SYMBOLP(x) || M_IDENTP(x)) +# define IDENT_PARENT(x) (M_IDENT_LEXP(x) ? CAR(CDR(x)) : CDR(x)) +# define IDENT_ENV(x) (M_IDENT_LEXP(x) ? CDR(CDR(x)) : BOOL_F) +#else +# define IDENTP SYMBOLP +# define M_IDENTP(x) (0) +#endif + + /* markers for various static environment frame types */ + /* FIXME these need to be exported somehow to Scheme */ +#ifdef CAUTIOUS +# define SCM_ENV_FILENAME MAKINUM(1) +# define SCM_ENV_PROCNAME MAKINUM(2) +#endif +#define SCM_ENV_DOC MAKINUM(3) +#define SCM_ENV_ANNOTATION MAKINUM(4) +#define SCM_ENV_CONSTANT MAKINUM(5) +#define SCM_ENV_SYNTAX MAKINUM(6) +#define SCM_ENV_END MAKINUM(7) + +#define PORTP(x) (TYP7(x)==tc7_port) +#define OPPORTP(x) (((0x7f | OPN) & CAR(x))==(tc7_port | OPN)) +#define OPINPORTP(x) (((0x7f | OPN | RDNG) & CAR(x))==(tc7_port | OPN | RDNG)) +#define OPOUTPORTP(x) (((0x7f | OPN | WRTNG) & CAR(x))==(tc7_port | OPN | WRTNG)) +#define OPIOPORTP(x) (((0x7f | OPN | RDNG | WRTNG) & CAR(x))==(tc7_port | OPN | RDNG | WRTNG)) +#define FPORTP(x) (TYP16S(x)==tc7_port) +#define OPFPORTP(x) (((0xfeff | OPN) & CAR(x))==(tc7_port | OPN)) +#define OPINFPORTP(x) (((0xfeff | OPN | RDNG) & CAR(x))==(tc7_port | OPN | RDNG)) +#define OPOUTFPORTP(x) (((0xfeff | OPN | WRTNG) & CAR(x))==(tc7_port | OPN | WRTNG)) + +#define INPORTP(x) (((0x7f | RDNG) & CAR(x))==(tc7_port | RDNG)) +#define OUTPORTP(x) (((0x7f | WRTNG) & CAR(x))==(tc7_port | WRTNG)) +#define OPENP(x) (OPN & CAR(x)) +#define CLOSEDP(x) (!OPENP(x)) +#define STREAM(x) ((FILE *)(CDR(x))) +#define SETSTREAM SETCDR +#define CRDYP(port) ((CAR(port) & CRDY) && (EOF != CGETUN(port))) +#define CLRDY(port) (CAR(port) &= (SCM_PORTFLAGS(port) | (~0xf0000))) +#define CGETUN(port) (scm_port_table[SCM_PORTNUM(port)].unread) + +#define tc_socket (tc7_port | OPN) +#define SOCKP(x) (((0x7f | OPN | RDNG | WRTNG) & CAR(x))==(tc_socket)) +#define SOCKTYP(x) (INUM(SCM_PORTDATA(x))) + +#define DIRP(x) (NIMP(x) && (TYP16(x)==(tc16_dir))) +#define OPDIRP(x) (NIMP(x) && (CAR(x)==(tc16_dir | OPN))) + +#ifdef FLOATS +# define INEXP(x) (TYP16(x)==tc16_flo) +# define CPLXP(x) (CAR(x)==tc_dblc) +# define REAL(x) (*(((dbl *) (SCM2PTR(x)))->real)) +# define IMAG(x) (*((double *)(CHARS(x)+sizeof(double)))) +/* ((&REAL(x))[1]) */ +# ifdef SINGLES +# define REALP(x) ((~REAL_PART & CAR(x))==tc_flo) +# define SINGP(x) SCM_EXPECT_TRUE(CAR(x)==tc_flo) +# define FLO(x) (((flo *)(SCM2PTR(x)))->num) +# define REALPART(x) (SINGP(x)?0.0+FLO(x):REAL(x)) +# else /* SINGLES */ +# define REALP(x) (CAR(x)==tc_dblr) +# define REALPART REAL +# endif /* SINGLES */ +#endif + +#ifdef FLOATS +# define NUMBERP(x) (INUMP(x) || (NIMP(x) && NUMP(x))) +#else +# ifdef BIGDIG +# define NUMBERP(x) (INUMP(x) || (NIMP(x) && NUMP(x))) +# else +# define NUMBERP INUMP +# endif +#endif +#define NUMP(x) ((0xfcff & PTR2INT(CAR(x)))==tc7_smob) +#define BIGP(x) (TYP16S(x)==tc16_bigpos) +#define BIGSIGN(x) (0x0100 & PTR2INT(CAR(x))) +#define BDIGITS(x) ((BIGDIG *)(CDR(x))) +#define NUMDIGS(x) ((sizet)(((unsigned long)CAR(x))>>16)) +#define MAKE_NUMDIGS(v, t) ((((v)+0L)<<16)+(t)) +#define SETNUMDIGS(x, v, t) CAR(x) = MAKE_NUMDIGS(v, t) + +#define SNAME(x) ((char *)(subrs[NUMDIGS(x)].name)) +#define SUBRF(x) (((subr *)(SCM2PTR(x)))->cproc) +#define DSUBRF(x) (((dsubr *)(SCM2PTR(x)))->dproc) +#define CCLO_SUBR(x) (VELTS(x)[0]) +#define CCLO_LENGTH NUMDIGS +#define CXR_OP SMOBNUM + +#define SYMBOLP(x) (TYP7S(x)==tc7_ssymbol) +#define STRINGP(x) (TYP7(x)==tc7_string) +#define NSTRINGP(x) (!STRINGP(x)) +#define BYTESP(x) (TYP7(x)==tc7_VfixN8) +#define VECTORP(x) (TYP7(x)==tc7_vector) +#define NVECTORP(x) (!VECTORP(x)) +#define LENGTH(x) (((unsigned long)CAR(x))>>8) +#define LENGTH_MAX (((unsigned long)-1L)>>8) +#define MAKE_LENGTH(v, t) ((((v)+0L)<<8) + (t)) +#define SETLENGTH(x, v, t) CAR(x) = MAKE_LENGTH(v, t) +#define CHARS(x) ((char *)(CDR(x))) +#define UCHARS(x) ((unsigned char *)(CDR(x))) +#define VELTS(x) ((SCM *)CDR(x)) +#define SETCHARS SETCDR +#define SETVELTS SETCDR + +SCM_EXPORT long tc16_array; +#define ARRAYP(a) (tc16_array==TYP16(a)) +#define ARRAY_V(a) (((array *)CDR(a))->v) +/*#define ARRAY_NDIM(x) NUMDIGS(x)*/ +#define ARRAY_NDIM(x) ((sizet)(CAR(x)>>17)) +#define ARRAY_CONTIGUOUS 0x10000 +#define ARRAY_CONTP(x) (ARRAY_CONTIGUOUS & PTR2INT(CAR(x))) +#define ARRAY_BASE(a) (((array *)CDR(a))->base) +#define ARRAY_DIMS(a) ((array_dim *)(CHARS(a)+sizeof(array))) + +#define FREEP(x) (CAR(x)==tc_free_cell) +#define NFREEP(x) (!FREEP(x)) + +#define SMOBNUM(x) (0x0ff & (CAR(x)>>8)) +#define PTOBNUM(x) (0x0ff & (CAR(x)>>8)) +#define SCM_PORTNUM(x) ((int)(((unsigned long)CAR(x))>>20)) +#define SCM_PORTNUM_MAX ((int)((0x7fffUL<<20)>>20)) +#define SCM_PORTFLAGS(x) (scm_port_table[SCM_PORTNUM(x)].flags) +#define SCM_PORTDATA(x) (scm_port_table[SCM_PORTNUM(x)].data) +#define SCM_SETFLAGS(x, flags) (CAR(x) = (CAR(x) & ~0x0f0000L) | (flags)) +/* This is used (only) for closing ports. */ +#define SCM_SET_PTOBNUM(x, typ) (CAR(x)=(typ)|(CAR(x) & ~0x0ffffL)) + +#define DIGITS '0':case '1':case '2':case '3':case '4':\ + case '5':case '6':case '7':case '8':case '9' + +/* Aggregated types for dispatch in switch statements. */ + +#define tcs_cons_inum 2: case 6:case 10:case 14:\ + case 18:case 22:case 26:case 30:\ + case 34:case 38:case 42:case 46:\ + case 50:case 54:case 58:case 62:\ + case 66:case 70:case 74:case 78:\ + case 82:case 86:case 90:case 94:\ + case 98:case 102:case 106:case 110:\ + case 114:case 118:case 122:case 126 +#define tcs_cons_iloc 124 +#define tcs_cons_ispcsym 4:case 12:case 20:case 28:\ + case 36:case 44:case 52:case 60:\ + case 68:case 76:case 84:case 92:\ + case 100:case 108 +#define tcs_cons_chflag 116 /* char *or* flag */ +#define tcs_cons_imcar tcs_cons_inum:\ + case tcs_cons_iloc:\ + case tcs_cons_ispcsym:\ + case tcs_cons_chflag + +#define tcs_cons_nimcar 0:case 8:case 16:case 24:\ + case 32:case 40:case 48:case 56:\ + case 64:case 72:case 80:case 88:\ + case 96:case 104:case 112:case 120 +#define tcs_cons_gloc 1:case 9:case 17:case 25:\ + case 33:case 41:case 49:case 57:\ + case 65:case 73:case 81:case 89:\ + case 97:case 105:case 113:case 121 + +#define tcs_closures 3:case 11:case 19:case 27:\ + case 35:case 43:case 51:case 59:\ + case 67:case 75:case 83:case 91:\ + case 99:case 107:case 115:case 123 +#define tcs_subrs tc7_asubr:case tc7_subr_0:case tc7_subr_1:case tc7_cxr:\ + case tc7_subr_3:case tc7_subr_2:case tc7_rpsubr:case tc7_subr_1o:\ + case tc7_subr_2o:case tc7_lsubr_2:case tc7_lsubr +#define tcs_symbols tc7_ssymbol:case tc7_msymbol +#define tcs_bignums tc16_bigpos:case tc16_bigneg +#define tcs_uves tc7_string:case tc7_Vbool:case tc7_VfixN8:case tc7_VfixZ8:\ + case tc7_VfixN16:case tc7_VfixZ16:case tc7_VfixN32:case tc7_VfixZ32:\ + case tc7_VfloR32:case tc7_VfloC32:case tc7_VfloR64:case tc7_VfloC64 + +#define tc3_cons_nimcar 0 +#define tc3_cons_imcar 2:case 4:case 6 +#define tc3_cons_gloc 1 +#define tc3_closure 3 +#define tc3_tc7_types 5:case 7 + +#define tc7_ssymbol 5 +#define tc7_msymbol 7 +#define tc7_string 13 +#define tc7_vector 15 +#define tc7_Vbool 21 + +/* 23 */ + +#define tc7_VfixN8 29 +#define tc7_VfixZ8 31 +#define tc7_VfixN16 37 +#define tc7_VfixZ16 39 +#define tc7_VfixN32 45 +#define tc7_VfixZ32 47 + +#define tc7_VfloR32 53 +#define tc7_VfloC32 55 +#define tc7_VfloR64 61 +#define tc7_VfloC64 63 + +/* 69 */ + +#define tc7_port 71 +#define tc7_contin 77 +#define tc7_specfun 79 + +#define tc7_subr_0 85 +#define tc7_subr_1 87 +#define tc7_cxr 93 +#define tc7_subr_3 95 +#define tc7_subr_2 101 +#define tc7_asubr 103 +#define tc7_subr_1o 109 +#define tc7_subr_2o 111 +#define tc7_lsubr_2 117 +#define tc7_lsubr 119 +#define tc7_rpsubr 125 + +#define tc7_smob 127 +#define tc_free_cell 127 +#define tc_broken_heart (tc_free_cell+0x10000) + +#define tc16_apply (tc7_specfun | (0L<<8)) +#define tc16_call_cc (tc7_specfun | (1L<<8)) +#define tc16_cclo (tc7_specfun | (2L<<8)) +#define tc16_eval (tc7_specfun | (3L<<8)) +#define tc16_values (tc7_specfun | (4L<<8)) +#define tc16_call_wv (tc7_specfun | (5L<<8)) + +#define tc16_flo 0x017f +#define tc_flo 0x017fL + +#define REAL_PART (1L<<16) +#define IMAG_PART (2L<<16) +#define tc_dblr (tc16_flo|REAL_PART) +#define tc_dblc (tc16_flo|REAL_PART|IMAG_PART) + +#define tc16_bigpos 0x027f +#define tc16_bigneg 0x037f + + /* The first four flags fit in the car of a port cell, remaining + flags only in the port table */ +#define OPN (1L<<16) +#define RDNG (2L<<16) +#define WRTNG (4L<<16) +#define CRDY (8L<<16) + +#define TRACKED (16L<<16) +#define BINARY (32L<<16) +#define BUF0 (64L<<16) +#define EXCLUSIVE (128L<<16) + /* LSB is used for gc mark */ + +SCM_EXPORT scm_gra subrs_gra; +#define subrs ((subr_info *)(subrs_gra.elts)) +/* SCM_EXPORT sizet numsmob, numptob; + SCM_EXPORT smobfuns *smobs; + SCM_EXPORT ptobfuns *ptobs; + SCM_EXPORT ptobfuns pipob; */ +SCM_EXPORT scm_gra smobs_gra; +#define numsmob (smobs_gra.len) +#define smobs ((smobfuns *)(smobs_gra.elts)) +SCM_EXPORT scm_gra ptobs_gra; +#define numptob (ptobs_gra.len) +#define ptobs ((ptobfuns *)(ptobs_gra.elts)) +SCM_EXPORT port_info *scm_port_table; + +#define tc16_fport (tc7_port + 0*256L) +#define tc16_pipe (tc7_port + 1*256L) +#define tc16_strport (tc7_port + 2*256L) +#define tc16_sfport (tc7_port + 3*256L) +SCM_EXPORT long tc16_dir; +SCM_EXPORT long tc16_clport; + +SCM_EXPORT SCM sys_protects[]; +#define cur_inp sys_protects[0] +#define cur_outp sys_protects[1] +#define cur_errp sys_protects[2] +#define def_inp sys_protects[3] +#define def_outp sys_protects[4] +#define def_errp sys_protects[5] +#define sys_errp sys_protects[6] +#define sys_safep sys_protects[7] +#define listofnull sys_protects[8] +#define undefineds sys_protects[9] +#define nullvect sys_protects[10] +#define nullstr sys_protects[11] +#define progargs sys_protects[12] +#define loadports sys_protects[13] +#define rootcont sys_protects[14] +#define dynwinds sys_protects[15] +#define list_unspecified sys_protects[16] +#define f_evapply sys_protects[17] +#define eval_env sys_protects[18] +#define f_apply_closure sys_protects[19] +#define flo0 sys_protects[20] +#define scm_uprotects sys_protects[21] +#define scm_narn sys_protects[22] +#define NUM_PROTECTS 23 + +/* now for connects between source files */ + +/* SCM_EXPORT sizet num_finals; + SCM_EXPORT void (**finals)P((void)); + SCM_EXPORT sizet num_finals; */ +SCM_EXPORT scm_gra finals_gra; +#define num_finals (finals_gra.len) +#define finals ((void (**)())(finals_gra.elts)) + +SCM_EXPORT unsigned char upcase[], downcase[]; +SCM_EXPORT SCM symhash; +SCM_EXPORT int symhash_dim; +SCM_EXPORT long heap_cells; +SCM_EXPORT CELLPTR heap_org; +SCM_EXPORT VOLATILE SCM freelist; +SCM_EXPORT long gc_cells_collected, gc_malloc_collected, gc_ports_collected; +SCM_EXPORT long gc_syms_collected; +SCM_EXPORT long cells_allocated, lcells_allocated, mallocated, lmallocated; +SCM_EXPORT long mtrigger; +SCM_EXPORT SCM *loc_loadpath; +SCM_EXPORT SCM *loc_errobj; +SCM_EXPORT SCM loadport; +SCM_EXPORT char *errjmp_bad; +SCM_EXPORT VOLATILE int ints_disabled; +SCM_EXPORT int output_deferred, gc_hook_pending, gc_hook_active; +SCM_EXPORT unsigned long SIG_deferred; +SCM_EXPORT SCM exitval; +SCM_EXPORT int cursinit; +SCM_EXPORT unsigned int poll_count, tick_count; +SCM_EXPORT int dumped; +SCM_EXPORT char *execpath; +SCM_EXPORT char s_no_execpath[]; +SCM_EXPORT int scm_verbose; +#define verbose (scm_verbose+0) + +SCM_EXPORT const char dirsep[]; + +/* strings used in several source files */ + +SCM_EXPORT char s_write[], s_newline[], s_system[]; +SCM_EXPORT char s_make_string[], s_make_vector[], s_list[], s_op_pipe[]; +#define s_string (s_make_string+5) +#define s_vector (s_make_vector+5) +#define s_pipe (s_op_pipe+5) +SCM_EXPORT char s_make_sh_array[]; +SCM_EXPORT char s_array_fill[]; +#define s_array (s_make_sh_array+12) +SCM_EXPORT char s_ccl[]; +#define s_limit (s_ccl+10) +SCM_EXPORT char s_close_port[]; +#define s_port_type (s_close_port+6) +SCM_EXPORT char s_call_cc[]; +#define s_cont (s_call_cc+18) +SCM_EXPORT char s_try_create_file[]; +SCM_EXPORT char s_badenv[]; + +SCM_EXPORT void (*init_user_scm) P((void)); + +/* function prototypes */ + +SCM_EXPORT void (* deferred_proc) P((void)); +SCM_EXPORT void process_signals P((void)); +SCM_EXPORT int handle_it P((int i)); +SCM_EXPORT SCM must_malloc_cell P((long len, SCM c, const char *what)); +SCM_EXPORT void must_realloc_cell P((SCM z, long olen, long len, const char *what)); +SCM_EXPORT char *must_malloc P((long len, const char *what)); +SCM_EXPORT char *must_realloc P((char *where, long olen, long len, const char *what)); +SCM_EXPORT void must_free P((char *obj, sizet len)); +SCM_EXPORT void scm_protect_temp P((SCM *ptr)); +SCM_EXPORT long ilength P((SCM sx)); +SCM_EXPORT SCM hash P((SCM obj, SCM n)); +SCM_EXPORT SCM hashv P((SCM obj, SCM n)); +SCM_EXPORT SCM hashq P((SCM obj, SCM n)); +SCM_EXPORT SCM obhash P((SCM obj)); +SCM_EXPORT SCM obunhash P((SCM obj)); +SCM_EXPORT unsigned long strhash P((unsigned char *str, sizet len, unsigned long n)); +SCM_EXPORT unsigned long hasher P((SCM obj, unsigned long n, sizet d)); +SCM_EXPORT SCM lroom P((SCM args)); +SCM_EXPORT void lfflush P((SCM port)); +SCM_EXPORT SCM scm_force_output P((SCM port)); +SCM_EXPORT void scm_init_gra P((scm_gra *gra, sizet eltsize, sizet len, + sizet maxlen, const char *what)); +SCM_EXPORT int scm_grow_gra P((scm_gra *gra, char *elt)); +SCM_EXPORT void scm_trim_gra P((scm_gra *gra)); +SCM_EXPORT void scm_free_gra P((scm_gra *gra)); +SCM_EXPORT long newsmob P((smobfuns *smob)); +SCM_EXPORT long newptob P((ptobfuns *ptob)); +SCM_EXPORT SCM scm_port_entry P((FILE *stream, long ptype, long flags)); +SCM_EXPORT SCM scm_open_ports P((void)); +SCM_EXPORT void prinport P((SCM exp, SCM port, char *type)); +SCM_EXPORT SCM repl P((void)); +SCM_EXPORT void repl_report P((void)); +SCM_EXPORT void growth_mon P((char *obj, long size, char *units, int grewp)); +SCM_EXPORT void gc_start P((const char *what)); +SCM_EXPORT void gc_end P((void)); +SCM_EXPORT void gc_mark P((SCM p)); +SCM_EXPORT void scm_gc_hook P((void)); +SCM_EXPORT SCM scm_gc_protect P((SCM obj)); +SCM_EXPORT SCM scm_add_finalizer P((SCM value, SCM finalizer)); +SCM_EXPORT void scm_run_finalizers P((int exiting)); +SCM_EXPORT void scm_egc_start P((void)); +SCM_EXPORT void scm_egc_end P((void)); +SCM_EXPORT void heap_report P((void)); +SCM_EXPORT void gra_report P((void)); +SCM_EXPORT void exit_report P((void)); +SCM_EXPORT void stack_report P((void)); +SCM_EXPORT SCM scm_stack_trace P((SCM contin)); +SCM_EXPORT SCM scm_scope_trace P((SCM env)); +SCM_EXPORT SCM scm_frame_trace P((SCM contin, SCM nf)); +SCM_EXPORT SCM scm_frame2env P((SCM contin, SCM nf)); +SCM_EXPORT SCM scm_frame_eval P((SCM contin, SCM nf, SCM expr)); +SCM_EXPORT void scm_iprin1 P((SCM exp, SCM port, int writing)); +SCM_EXPORT void scm_intprint P((long n, int radix, SCM port)); +SCM_EXPORT void scm_iprlist P((char *hdr, SCM exp, int tlr, SCM port, int writing)); +SCM_EXPORT SCM scm_env_lookup P((SCM var, SCM stenv)); +SCM_EXPORT SCM scm_env_rlookup P((SCM addr, SCM stenv, const char *what)); +SCM_EXPORT SCM scm_env_getprop P((SCM prop, SCM env)); +SCM_EXPORT SCM scm_env_addprop P((SCM prop, SCM val, SCM env)); +SCM_EXPORT long num_frames P((SCM estk, int i)); +SCM_EXPORT SCM *estk_frame P((SCM estk, int i, int nf)); +SCM_EXPORT SCM *cont_frame P((SCM contin, int nf)); +SCM_EXPORT SCM stacktrace1 P((SCM estk, int i)); +SCM_EXPORT void scm_princode P((SCM code, SCM env, SCM port, int writing)); +SCM_EXPORT void scm_princlosure P((SCM proc, SCM port, int writing)); +SCM_EXPORT void lputc P((int c, SCM port)); +SCM_EXPORT void lputs P((const char *s, SCM port)); +SCM_EXPORT sizet lfwrite P((char *ptr, sizet size, sizet nitems, SCM port)); +SCM_EXPORT int lgetc P((SCM port)); +SCM_EXPORT void lungetc P((int c, SCM port)); +SCM_EXPORT char *grow_tok_buf P((SCM tok_buf)); +SCM_EXPORT long mode_bits P((char *modes, char *cmodes)); +SCM_EXPORT long time_in_msec P((long x)); +SCM_EXPORT SCM my_time P((void)); +SCM_EXPORT SCM your_time P((void)); +SCM_EXPORT void init_iprocs P((iproc *subra, int type)); + +SCM_EXPORT void final_scm P((int)); +SCM_EXPORT void init_sbrk P((void)); +SCM_EXPORT int init_buf0 P((FILE *inport)); +SCM_EXPORT void scm_init_from_argv P((int argc, const char * const *argv, char *script_arg, + int iverbose, int buf0stdin)); +SCM_EXPORT void init_signals P((void)); +SCM_EXPORT SCM scm_top_level P((char *initpath, SCM (*toplvl_fun)())); +SCM_EXPORT void restore_signals P((void)); +SCM_EXPORT void free_storage P((void)); +SCM_EXPORT char *dld_find_executable P((const char* command)); +SCM_EXPORT char *scm_find_execpath P((int argc, const char * const *argv, const char *script_arg)); +SCM_EXPORT void init_scm P((int iverbose, int buf0stdin, long init_heap_size)); +SCM_EXPORT void scm_init_INITS P((void)); +SCM_EXPORT SCM scm_init_extensions P((void)); +SCM_EXPORT void ignore_signals P((void)); +SCM_EXPORT void unignore_signals P((void)); + +SCM_EXPORT void add_feature P((char *str)); +SCM_EXPORT int raprin1 P((SCM exp, SCM port, int writing)); +SCM_EXPORT SCM markcdr P((SCM ptr)); +#define mark0 (0) /*SCM mark0 P((SCM ptr)); */ +SCM_EXPORT SCM equal0 P((SCM ptr1, SCM ptr2)); +SCM_EXPORT sizet free0 P((CELLPTR ptr)); +SCM_EXPORT void scm_warn P((char *str1, char *str2, SCM obj)); +SCM_EXPORT void everr P((SCM exp, SCM env, SCM arg, const char *pos, const char *s_subr, int codep)); +SCM_EXPORT void wta P((SCM arg, const char *pos, const char *s_subr)); +SCM_EXPORT void scm_experr P((SCM arg, const char *pos, const char *s_subr)); +SCM_EXPORT SCM intern P((char *name, sizet len)); +SCM_EXPORT SCM sysintern P((const char *name, SCM val)); +SCM_EXPORT SCM sym2vcell P((SCM sym)); +SCM_EXPORT SCM makstr P((long len)); +SCM_EXPORT SCM scm_maksubr P((const char *name, int type, SCM (*fcn)())); +SCM_EXPORT SCM make_subr P((const char *name, int type, SCM (*fcn)())); +SCM_EXPORT SCM make_synt P((const char *name, long flags, SCM (*fcn)())); +SCM_EXPORT SCM make_gsubr P((const char *name, int req, int opt, int rst, + SCM (*fcn)())); +SCM_EXPORT SCM closure P((SCM code, int nargs)); +SCM_EXPORT SCM makprom P((SCM code)); +SCM_EXPORT SCM force P((SCM x)); +SCM_EXPORT SCM makarb P((SCM name)); +SCM_EXPORT SCM tryarb P((SCM arb)); +SCM_EXPORT SCM relarb P((SCM arb)); +SCM_EXPORT SCM ceval P((SCM x, SCM static_env, SCM env)); +SCM_EXPORT SCM scm_wrapcode P((SCM code, SCM env)); +SCM_EXPORT SCM scm_current_env P((void)); +SCM_EXPORT SCM prolixity P((SCM arg)); +SCM_EXPORT SCM gc_for_newcell P((void)); +SCM_EXPORT void gc_for_open_files P((void)); +SCM_EXPORT SCM gc P((SCM arg)); +SCM_EXPORT SCM tryload P((SCM filename, SCM reader)); +SCM_EXPORT SCM acons P((SCM w, SCM x, SCM y)); +SCM_EXPORT SCM cons2 P((SCM w, SCM x, SCM y)); +SCM_EXPORT SCM resizuve P((SCM vect, SCM len)); +SCM_EXPORT SCM lnot P((SCM x)); +SCM_EXPORT SCM booleanp P((SCM obj)); +SCM_EXPORT SCM eq P((SCM x, SCM y)); +SCM_EXPORT SCM equal P((SCM x, SCM y)); +SCM_EXPORT SCM consp P((SCM x)); +SCM_EXPORT SCM cons P((SCM x, SCM y)); +SCM_EXPORT SCM nullp P((SCM x)); +SCM_EXPORT SCM setcar P((SCM pair, SCM value)); +SCM_EXPORT SCM setcdr P((SCM pair, SCM value)); +SCM_EXPORT SCM listp P((SCM x)); +SCM_EXPORT SCM list P((SCM objs)); +SCM_EXPORT SCM length P((SCM x)); +SCM_EXPORT SCM append P((SCM args)); +SCM_EXPORT SCM reverse P((SCM lst)); +SCM_EXPORT SCM list_ref P((SCM lst, SCM k)); +SCM_EXPORT SCM memq P((SCM x, SCM lst)); +SCM_EXPORT SCM member P((SCM x, SCM lst)); +SCM_EXPORT SCM memv P((SCM x, SCM lst)); +SCM_EXPORT SCM assq P((SCM x, SCM alist)); +SCM_EXPORT SCM assoc P((SCM x, SCM alist)); +SCM_EXPORT SCM symbolp P((SCM x)); +SCM_EXPORT SCM symbol2string P((SCM s)); +SCM_EXPORT SCM string2symbol P((SCM s)); +SCM_EXPORT SCM string_copy P((SCM s)); +SCM_EXPORT SCM numberp P((SCM x)); +SCM_EXPORT SCM exactp P((SCM x)); +SCM_EXPORT SCM inexactp P((SCM x)); +SCM_EXPORT SCM eqp P((SCM x, SCM y)); +SCM_EXPORT SCM lessp P((SCM x, SCM y)); +SCM_EXPORT SCM greaterp P((SCM x, SCM y)); +SCM_EXPORT SCM leqp P((SCM x, SCM y)); +SCM_EXPORT SCM greqp P((SCM x, SCM y)); +SCM_EXPORT SCM zerop P((SCM z)); +SCM_EXPORT SCM positivep P((SCM x)); +SCM_EXPORT SCM negativep P((SCM x)); +SCM_EXPORT SCM oddp P((SCM n)); +SCM_EXPORT SCM evenp P((SCM n)); +SCM_EXPORT SCM lmax P((SCM x, SCM y)); +SCM_EXPORT SCM lmin P((SCM x, SCM y)); +SCM_EXPORT SCM sum P((SCM x, SCM y)); +SCM_EXPORT SCM difference P((SCM x, SCM y)); +SCM_EXPORT SCM product P((SCM x, SCM y)); +SCM_EXPORT SCM divide P((SCM x, SCM y)); +SCM_EXPORT SCM lquotient P((SCM x, SCM y)); +SCM_EXPORT SCM scm_iabs P((SCM x)); +SCM_EXPORT SCM scm_abs P((SCM x)); +SCM_EXPORT SCM lremainder P((SCM x, SCM y)); +SCM_EXPORT SCM modulo P((SCM x, SCM y)); +SCM_EXPORT SCM lgcd P((SCM x, SCM y)); +SCM_EXPORT SCM llcm P((SCM n1, SCM n2)); +SCM_EXPORT SCM number2string P((SCM x, SCM radix)); +SCM_EXPORT SCM istring2number P((char *str, long len, long radix)); +SCM_EXPORT SCM string2number P((SCM str, SCM radix)); +SCM_EXPORT SCM istr2flo P((char *str, long len, long radix)); +SCM_EXPORT SCM mkbig P((sizet nlen, int sign)); +SCM_EXPORT SCM mkstrport P((SCM pos, SCM str, long modes, char *caller)); +SCM_EXPORT SCM mksafeport P((int maxlen, SCM port)); +SCM_EXPORT int reset_safeport P((SCM sfp, int maxlen, SCM port)); +SCM_EXPORT SCM long2big P((long n)); +SCM_EXPORT SCM ulong2big P((unsigned long n)); +SCM_EXPORT SCM big2inum P((SCM b, sizet l)); +SCM_EXPORT sizet iint2str P((long num, int rad, char *p)); +SCM_EXPORT SCM floequal P((SCM x, SCM y)); +SCM_EXPORT SCM uve_equal P((SCM u, SCM v)); +SCM_EXPORT SCM uve_read P((SCM v, SCM port)); +SCM_EXPORT SCM uve_write P((SCM v, SCM port)); +SCM_EXPORT SCM raequal P((SCM ra0, SCM ra1)); +SCM_EXPORT SCM array_equal P((SCM u, SCM v)); +SCM_EXPORT SCM array_rank P((SCM ra)); +SCM_EXPORT int rafill P((SCM ra, SCM fill, SCM ignore)); +SCM_EXPORT SCM uve_fill P((SCM uve, SCM fill)); +SCM_EXPORT SCM array_fill P((SCM ra, SCM fill)); +SCM_EXPORT SCM array_prot P((SCM ra)); +SCM_EXPORT SCM array_rank P((SCM ra)); +SCM_EXPORT SCM array_contents P((SCM ra, SCM strict)); +SCM_EXPORT int bigprint P((SCM exp, SCM port, int writing)); +SCM_EXPORT int floprint P((SCM sexp, SCM port, int writing)); +SCM_EXPORT SCM istr2int P((char *str, long len, long radix)); +SCM_EXPORT SCM istr2bve P((char *str, long len)); +SCM_EXPORT void scm_ipruk P((char *hdr, SCM ptr, SCM port)); +SCM_EXPORT SCM charp P((SCM x)); +SCM_EXPORT SCM char_lessp P((SCM x, SCM y)); +SCM_EXPORT SCM chci_eq P((SCM x, SCM y)); +SCM_EXPORT SCM chci_lessp P((SCM x, SCM y)); +SCM_EXPORT SCM char_alphap P((SCM chr)); +SCM_EXPORT SCM char_nump P((SCM chr)); +SCM_EXPORT SCM char_whitep P((SCM chr)); +SCM_EXPORT SCM char_upperp P((SCM chr)); +SCM_EXPORT SCM char_lowerp P((SCM chr)); +SCM_EXPORT SCM char2int P((SCM chr)); +SCM_EXPORT SCM int2char P((SCM n)); +SCM_EXPORT SCM char_upcase P((SCM chr)); +SCM_EXPORT SCM char_downcase P((SCM chr)); +SCM_EXPORT SCM stringp P((SCM x)); +SCM_EXPORT SCM string P((SCM chrs)); +SCM_EXPORT SCM make_string P((SCM k, SCM chr)); +SCM_EXPORT SCM string2list P((SCM str)); +SCM_EXPORT SCM st_length P((SCM str)); +SCM_EXPORT SCM st_ref P((SCM str, SCM k)); +SCM_EXPORT SCM st_set P((SCM str, SCM k, SCM chr)); +SCM_EXPORT SCM st_equal P((SCM s1, SCM s2)); +SCM_EXPORT SCM stci_equal P((SCM s1, SCM s2)); +SCM_EXPORT SCM st_lessp P((SCM s1, SCM s2)); +SCM_EXPORT SCM stci_lessp P((SCM s1, SCM s2)); +SCM_EXPORT SCM substring P((SCM str, SCM start, SCM end)); +SCM_EXPORT SCM st_append P((SCM args)); +SCM_EXPORT SCM vectorp P((SCM x)); +SCM_EXPORT SCM vector_length P((SCM v)); +SCM_EXPORT SCM vector P((SCM l)); +SCM_EXPORT SCM vector_ref P((SCM v, SCM k)); +SCM_EXPORT SCM vector_set P((SCM v, SCM k, SCM obj)); +SCM_EXPORT SCM make_vector P((SCM k, SCM fill)); +SCM_EXPORT SCM vector2list P((SCM v)); +SCM_EXPORT SCM for_each P((SCM proc, SCM arg1, SCM args)); +SCM_EXPORT SCM procedurep P((SCM obj)); +SCM_EXPORT SCM apply P((SCM proc, SCM arg1, SCM args)); +SCM_EXPORT SCM scm_cvapply P((SCM proc, long n, SCM *argv)); +SCM_EXPORT int scm_arity_check P((SCM proc, long argc, const char *what)); +SCM_EXPORT SCM map P((SCM proc, SCM arg1, SCM args)); +SCM_EXPORT SCM scm_make_cont P((void)); +SCM_EXPORT SCM copytree P((SCM obj)); +SCM_EXPORT SCM eval P((SCM obj)); +SCM_EXPORT SCM scm_values P((SCM arg1, SCM arg2, SCM rest, const char *what)); +SCM_EXPORT SCM scm_eval_values P((SCM x, SCM static_env, SCM env)); +SCM_EXPORT SCM identp P((SCM obj)); +SCM_EXPORT SCM ident2sym P((SCM id)); +SCM_EXPORT SCM ident_eqp P((SCM id1, SCM id2, SCM env)); +SCM_EXPORT int scm_nullenv_p P((SCM env)); +SCM_EXPORT SCM env2tree P((SCM env)); +SCM_EXPORT SCM renamed_ident P((SCM id, SCM env)); +SCM_EXPORT SCM scm_check_linum P((SCM x, SCM *linum)); +SCM_EXPORT SCM scm_add_linum P((SCM linum, SCM x)); +SCM_EXPORT SCM input_portp P((SCM x)); +SCM_EXPORT SCM output_portp P((SCM x)); +SCM_EXPORT SCM cur_input_port P((void)); +SCM_EXPORT SCM cur_output_port P((void)); +SCM_EXPORT SCM i_setbuf0 P((SCM port)); +SCM_EXPORT SCM try_open_file P((SCM filename, SCM modes)); +SCM_EXPORT SCM open_file P((SCM filename, SCM modes)); +SCM_EXPORT SCM open_pipe P((SCM pipestr, SCM modes)); +SCM_EXPORT SCM close_port P((SCM port)); +SCM_EXPORT SCM scm_file_position P((SCM port, SCM pos)); +#define file_position(port) scm_file_position(port, BOOL_F) +#define file_set_position scm_file_position +SCM_EXPORT SCM scm_read P((SCM port)); +SCM_EXPORT SCM scm_read_char P((SCM port)); +SCM_EXPORT SCM scm_peek_char P((SCM port)); +SCM_EXPORT SCM eof_objectp P((SCM x)); +SCM_EXPORT int scm_io_error P((SCM port, const char *what)); +SCM_EXPORT SCM scm_write P((SCM obj, SCM port)); +SCM_EXPORT SCM scm_display P((SCM obj, SCM port)); +SCM_EXPORT SCM scm_newline P((SCM port)); +SCM_EXPORT SCM scm_write_char P((SCM chr, SCM port)); +SCM_EXPORT SCM scm_port_line P((SCM port)); +SCM_EXPORT SCM scm_port_col P((SCM port)); +SCM_EXPORT void scm_line_msg P((SCM file, SCM linum, SCM port)); +SCM_EXPORT void scm_err_line P((const char *what, SCM file, SCM linum, SCM port)); +SCM_EXPORT SCM lgetenv P((SCM nam)); +SCM_EXPORT SCM prog_args P((void)); +SCM_EXPORT SCM makacro P((SCM code)); +SCM_EXPORT SCM makmacro P((SCM code)); +SCM_EXPORT SCM makmmacro P((SCM code)); +SCM_EXPORT SCM makidmacro P((SCM code)); +SCM_EXPORT void poll_routine P((void)); +SCM_EXPORT void tick_signal P((void)); +SCM_EXPORT void stack_check P((void)); +SCM_EXPORT SCM list2ura P((SCM ndim, SCM prot, SCM lst)); +SCM_EXPORT SCM make_ra P((int ndim)); +SCM_EXPORT SCM makflo P((float x)); +SCM_EXPORT SCM arrayp P((SCM v, SCM prot)); +SCM_EXPORT SCM aset P((SCM v, SCM obj, SCM args)); +SCM_EXPORT SCM aref P((SCM v, SCM args)); +SCM_EXPORT SCM scm_array_ref P((SCM args)); +SCM_EXPORT SCM cvref P((SCM v, sizet pos, SCM last)); +SCM_EXPORT SCM quit P((SCM n)); +#ifdef CAREFUL_INTS +SCM_EXPORT void ints_viol P((ints_infot *info, int sense)); +SCM_EXPORT void ints_warn P((char *s1, char* s2, char *fname, int linum)); +#endif +SCM_EXPORT void add_final P((void (*final)(void))); +SCM_EXPORT SCM makcclo P((SCM proc, long len)); +SCM_EXPORT SCM make_uve P((long k, SCM prot)); +SCM_EXPORT long scm_prot2type P((SCM prot)); +SCM_EXPORT long aind P((SCM ra, SCM args, const char *what)); +SCM_EXPORT SCM scm_eval_string P((SCM str)); +SCM_EXPORT SCM scm_load_string P((SCM str)); +SCM_EXPORT SCM scm_unexec P((const SCM pathname)); +SCM_EXPORT SCM scm_logbitp P((SCM index, SCM j1)); +SCM_EXPORT SCM scm_logtest P((SCM x, SCM y)); +SCM_EXPORT SCM scm_logxor P((SCM x, SCM y)); +SCM_EXPORT SCM scm_logand P((SCM x, SCM y)); +SCM_EXPORT SCM scm_logior P((SCM x, SCM y)); +SCM_EXPORT SCM scm_lognot P((SCM n)); +SCM_EXPORT SCM scm_intexpt P((SCM z1, SCM z2)); +SCM_EXPORT SCM scm_ash P((SCM n, SCM cnt)); +SCM_EXPORT SCM scm_bitfield P((SCM n, SCM start, SCM end)); +SCM_EXPORT SCM scm_logcount P((SCM n)); +SCM_EXPORT SCM scm_intlength P((SCM n)); +SCM_EXPORT SCM scm_copybit P((SCM index, SCM j1, SCM bit)); +SCM_EXPORT SCM scm_bitif P((SCM mask, SCM n0, SCM n1)); +SCM_EXPORT SCM scm_copybitfield P((SCM to, SCM start, SCM rest)); + + /* Defined in "rope.c" */ +SCM_EXPORT SCM long2num P((long n)); +SCM_EXPORT SCM ulong2num P((unsigned long n)); +SCM_EXPORT unsigned char num2uchar P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT signed char num2char P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT unsigned short num2ushort P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT short num2short P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT unsigned long num2ulong P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT long num2long P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT double num2dbl P((SCM num, char *pos, char *s_caller)); +SCM_EXPORT SCM makfromstr P((const char *src, sizet len)); +SCM_EXPORT SCM makfromstrs P((int argc, const char * const *argv)); +SCM_EXPORT SCM makfrom0str P((const char *scr)); +SCM_EXPORT char **makargvfrmstrs P((SCM args, const char *s_v)); +SCM_EXPORT void must_free_argv P((char **argv)); +SCM_EXPORT SCM scm_evstr P((char *str)); +SCM_EXPORT void scm_ldstr P((char *str)); +SCM_EXPORT int scm_ldfile P((char *path)); +SCM_EXPORT int scm_ldprog P((char *path)); +SCM_EXPORT unsigned long scm_addr P((SCM args, const char *name)); +SCM_EXPORT unsigned long scm_base_addr P((SCM v, const char *name)); +SCM_EXPORT int scm_cell_p P((SCM x)); + +#ifdef FLOATS +SCM_EXPORT SCM makdbl P((double x, double y)); +SCM_EXPORT SCM dbl2big P((double d)); +SCM_EXPORT double big2dbl P((SCM b)); +SCM_EXPORT double scm_truncate P((double x)); +SCM_EXPORT double scm_round P((double x)); +SCM_EXPORT double floident P((double x)); +#endif + +#ifdef BIGDIG +SCM_EXPORT void longdigs P((long x, BIGDIG digs[DIGSPERLONG])); +SCM_EXPORT SCM adjbig P((SCM b, sizet nlen)); +SCM_EXPORT SCM normbig P((SCM b)); +SCM_EXPORT SCM copybig P((SCM b, int sign)); +SCM_EXPORT SCM addbig P((BIGDIG *x, sizet nx, int xsgn, SCM bigy, int sgny)); +SCM_EXPORT SCM mulbig P((BIGDIG *x, sizet nx, BIGDIG *y, sizet ny, int sgn)); +SCM_EXPORT unsigned int divbigdig P((BIGDIG *ds, sizet h, BIGDIG div)); +SCM_EXPORT SCM divbigint P((SCM x, long z, int sgn, int mode)); +SCM_EXPORT SCM divbigbig P((BIGDIG *x, sizet nx, BIGDIG *y, sizet ny, int sgn, + int modes)); +SCM_EXPORT long pseudolong P((long x)); +#endif +SCM_EXPORT int bigcomp P((SCM x, SCM y)); +SCM_EXPORT SCM bigequal P((SCM x, SCM y)); +SCM_EXPORT int scm_bigdblcomp P((SCM b, double d)); + +/* "script.c" functions */ +SCM_EXPORT char * scm_cat_path P((char *str1, const char *str2, long n)); +SCM_EXPORT char * scm_try_path P((char *path)); +SCM_EXPORT char * script_find_executable P((const char *command)); +SCM_EXPORT char ** script_process_argv P((int argc, const char **argv)); +SCM_EXPORT int script_count_argv P((const char **argv)); +SCM_EXPORT char * find_impl_file P((const char *exec_path, const char *generic_name, + const char *initname, const char *sep)); + +/* environment cache functions */ +SCM_EXPORT void scm_ecache_report P((void)); +SCM_EXPORT void scm_estk_reset P((sizet size)); +SCM_EXPORT void scm_env_cons P((SCM x, SCM y)); +SCM_EXPORT void scm_env_cons2 P((SCM w, SCM x, SCM y)); +SCM_EXPORT void scm_env_cons3 P((SCM v, SCM w, SCM x, SCM y)); +SCM_EXPORT void scm_env_v2lst P((long argc, SCM *argv)); +SCM_EXPORT void scm_extend_env P((void)); +SCM_EXPORT void scm_egc P((void)); + +/* Global state for environment cache */ +SCM_EXPORT CELLPTR scm_ecache; +SCM_EXPORT VOLATILE long scm_ecache_index, scm_ecache_len; +SCM_EXPORT SCM scm_env, scm_env_tmp; +SCM_EXPORT SCM scm_egc_roots[]; +SCM_EXPORT VOLATILE long scm_egc_root_index; +SCM_EXPORT SCM scm_estk; +SCM_EXPORT SCM *scm_estk_v, *scm_estk_ptr; +SCM_EXPORT long scm_estk_size; +#ifndef RECKLESS +SCM_EXPORT SCM scm_trace, scm_trace_env; +#endif + +#ifdef RECKLESS +# define ASRTER(_cond, _arg, _pos, _subr) ; +# define ASRTGO(_cond, _label) ; +#else +# define ASRTER(_cond, _arg, _pos, _subr) if (SCM_EXPECT_FALSE(!(_cond))) wta(_arg, (char *)(_pos), _subr); +# define ASRTGO(_cond, _label) if (SCM_EXPECT_FALSE(!(_cond))) goto _label; +#endif + +#define ARGn 1 +#define ARG1 2 +#define ARG2 3 +#define ARG3 4 +#define ARG4 5 +#define ARG5 6 + /* following must match entry indexes in errmsgs[] */ +#define WNA 7 +#define OVFLOW 8 +#define OUTOFRANGE 9 +#define NALLOC 10 +#define THRASH 11 +#define EXIT 12 +#define HUP_SIGNAL 13 +#define INT_SIGNAL 14 +#define FPE_SIGNAL 15 +#define BUS_SIGNAL 16 +#define SEGV_SIGNAL 17 +#define ALRM_SIGNAL 18 +#define VTALRM_SIGNAL 19 +#define PROF_SIGNAL 20 + +#define EVAL(x, env, venv) (IMP(x)?(x):ceval((x), (SCM)(env), (SCM)(venv))) +#define SIDEVAL(x, env, venv) if (NIMP(x)) ceval((x), (SCM)(env), (SCM)(venv)) + +#define NEWCELL(_into) {if (IMP(freelist)) _into = gc_for_newcell();\ + else {_into = freelist;freelist = CDR(freelist);++cells_allocated;}} +/* +#define NEWCELL(_into) {DEFER_INTS;if (IMP(freelist)) _into = gc_for_newcell();\ + else {_into = freelist;freelist = CDR(freelist);++cells_allocated;}\ + ALLOW_INTS;} +*/ + +#ifdef __cplusplus +} +#endif diff --git a/SCM/scmfig.h b/SCM/scmfig.h new file mode 100644 index 0000000..a8e8667 --- /dev/null +++ b/SCM/scmfig.h @@ -0,0 +1,870 @@ +/* "scmfig.h" system-dependent configuration. + * Copyright (C) 1990-2006 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* Author: Aubrey Jaffer */ + +#ifdef sequent +# include <strings.h> +# define strchr index +# define strrchr rindex +#else +# ifndef PLAN9 +# include <string.h> +# endif +#endif + +/* MS Windows signal handling hack added by Rainer Urian */ +/* + SCM crashes on WindowsNT after hitting control-c. + + This is because signal handling in windows console applications is + rather different from unix apps. If control-c is hit on a console + application Windows creates a new thread which executes the + control-c signal handler. Now, if the SCM handler does the longjmp + back to the repl loop it does it via the stack of the signal + handler thread which results always ever is an access violation. + + The solution to this problem is to let the signal handler thread + raise a software interrupt in the main thread. + + This is done with the following steps: + + 1. contol-c is hit + + 2. Windows creates the signal handler thread which in turn executes + the routine win32_sigint as its signal handler. + + 3. The handler suspends the main thread and gets the main threads + register context. + + 4. The handler simulates an interrupt call on the main thread by + pointing Eip to the sigintstub stub function and also simulates a + pushad , pushf of the main threads registers + + 5. The handler resumes the main thread which when scheduled will + execute sigintstub, which in turn calls the proper signal interupt + (scamble_signal) +*/ +#ifdef _WIN32 +/* POCKETCONSOLE has the signal handler implemented in the runtime */ +# ifndef POCKETCONSOLE +# define WINSIGNALS +# endif +#endif + + +#include "scmflags.h" /* user specified, system independent flags */ + +/* IMPLINIT is the full pathname (surrounded by double quotes) of + Init.scm, the Scheme initialization code. This is best defined in + the makefile. If available, SCM uses the value of environment + variable SCM_INIT_PATH instead of IMPLINIT. */ + +/* #define IMPLINIT "/usr/jaffer/scm/Init.scm" */ + +/* INITS is calls to initialization routines for any compiled + libraries being linked into scm. This is best done in the makefile. +File: INITS line: functions defined: + +sc2.c init_sc2(); substring-move-left!, substring-move-right!, + substring-fill!, append!, and last-pair +rgx.c init_rgx(); regcomp and regexec. */ + +/* #define INITS init_sc2(); */ + +/* #define SICP */ + +/* setbuf(0) needs to be done for tty ports in order for CHAR-READY? + to work. This can cause problems under MSDOS and other systems. */ + +/* #define NOSETBUF */ + +/* #define RECKLESS */ + +/* #define CAUTIOUS */ + +/* #define BIGNUMS */ + +/* #define ARRAYS */ + +/* #define FLOATS */ + +/* Define SINGLES if you want single precision floats and + (sizeof(float)==sizeof(long)) */ + +#ifdef FLOATS +# ifndef _MSC_VER +# define SINGLES +# endif +#endif + +/* #define SINGLESONLY */ + +/* Define CDR_DOUBLES if (sizeof(double)==sizeof(long)), i.e. + a `single' is really a double. */ +#ifdef FLOATS +# ifdef __alpha +# define CDR_DOUBLES +# endif + +# ifdef _UNICOS /* doubles are no better than singles on Cray. */ +# define SINGLESONLY +# endif + +# ifdef CDR_DOUBLES +# define SINGLES +# define SINGLESONLY +# endif +#endif + +/* #define ENGNOT */ + +/* Define SUN_DL to configure code in "dynl.c" so that dynamic linking + is done using the SUN dynamic linking library "dl". */ + +/* #define SUN_DL */ + +/* Define DLD to configure code in "dynl.c" so that dynamic linking is + done using the "dld" library. DLD is ported to Linux, VAX + (Ultrix), Sun 3 (SunOS 3.4 and 4.0), SPARCstation (SunOS 4.0), + Sequent Symmetry (Dynix), and Atari ST. See scm/README or + scm/ANNOUNCE for ftp sites offering dld. */ + +/* #define DLD */ + +/* Define HAVE_DYNL if dynamic linking is available */ + +#ifdef DLD +# define HAVE_DYNL +#endif +#ifdef SUN_DL +# define HAVE_DYNL +#endif +#ifdef HP_SHL +# define HAVE_DYNL +#endif + +#ifdef HAVE_DYNL +# define CCLO +#endif + +/* Define GC_FREE_SEGMENTS if you want segments of unused heap to + be freed up after garbage collection. Don't define it if you + never want the heap to shrink. */ +#ifndef DONT_GC_FREE_SEGMENTS +# define GC_FREE_SEGMENTS +#endif + +/* MEMOIZE_LOCALS means to convert references to local variables to ILOCs, + (relative lexical addresses into the environment). This memoization + makes evaluated Scheme code harder to read, so you may want to undefine + this flag for debugging -- but SCM will run 3 to 6 times slower */ +#ifndef DONT_MEMOIZE_LOCALS +# define MEMOIZE_LOCALS +#endif + +/* #define CHEAP_CONTINUATIONS */ + +/* #define TICKS */ + +/* PROT386 should be defined on the compilation command line if the + program is to be run on an intel 386 in protected mode. `Huge' + pointers common on MSDOS compilers do not work in protected mode. + PROT386 is required if scm is to run as part of a Microsoft Windows + application. Added by Stephen Adams 8 May 92 */ + +/* #define PROT386 */ + +/* #define NON_PREEMPTIVE if you are using an non-preemptive operating + system in which periodic polling for interrupts is necessary. + Provide your own main procedure (e.g., WinMain, in Windows) or + modify "scmmain.c". Define and initialize unsigned int poll_count, + and provide a procedure named poll_routine(), which POLL calls each + time poll_count reaches zero. poll_routine() must reinitialize + poll_count. It may also check for external actions, such as + Windows messages. The value assigned to poll_count can be quite + large, e.g., 1000, while still maintaining good response time. */ + +/* #define CAREFUL_INTS */ + +/* Define MACRO if you want C level support for hygienic and referentially + transparent macros. */ + +/* #define MACRO */ + +/* STDC_HEADERS indicates that the include file names are the same as + ANSI C. For most modern systems this is the case. */ + +/* added by Yasuaki Honda */ +#ifdef THINK_C +# define __STDC__ +# ifndef macintosh +# define macintosh +# endif +#endif + +/* added by Bob Schumaker, cobblers@netcom.com */ +#ifdef __MWERKS__ +# ifndef macintosh +# define macintosh +# endif +# define bzero(p, n) memset(p, 0, n) +# define bcopy memcpy +#endif +/* added by Denys Duchier */ +#ifndef SVR4 +# ifdef __SVR4 +# define SVR4 +# endif +#endif + +#ifdef __STDC__ +# ifndef __HIGHC__ /* overly fussy compiler */ +# define USE_ANSI_PROTOTYPES +# endif +# ifndef __GNUC__ +# define STDC_HEADERS +# else +# ifdef sparc +# ifdef SVR4 +# define STDC_HEADERS +# endif +# else +# ifndef tahoe +# ifndef sun +# define STDC_HEADERS +# endif +# endif +# endif +# endif +#endif +#ifdef __alpha +# define SHORT_INT +#endif +#ifdef __ia64__ +# define SHORT_INT +# define CDR_DOUBLES +#endif +#ifdef __x86_64 +# define SHORT_INT +# define CDR_DOUBLES +#endif +#ifdef MSDOS /* Microsoft C 5.10 and 6.00A */ +# ifndef GO32 +# define SHORT_INT +# define SHORT_SIZET +# endif +#endif +#ifdef _QC +# define SHORT_INT +# define SHORT_SIZET +#endif +#ifdef __TURBOC__ +# define SHORT_INT +# define SHORT_SIZET +# define LACK_SBRK +# ifndef __TOS__ +# define MSDOS +# endif +#endif +#ifdef __HIGHC__ +# define LACK_SBRK +#endif +#ifdef _WIN32 +# define MSDOS +# define LACK_SBRK +# define LACK_TIMES +#endif +#ifdef _MSDOS +# define MSDOS +#endif +#ifdef MSDOS +# define STDC_HEADERS +#endif + +#ifdef POCKETCONSOLE +# define NOSETBUF +# define LACK_FTIME +#endif + +#ifdef vms +# define STDC_HEADERS +#endif + +#ifdef nosve +# define STDC_HEADERS +#endif + +#ifdef linux +# define HAVE_SELECT +# define HAVE_SYS_TIME_H +# define STDC_HEADERS +#endif + +#ifdef _UNICOS +# define STDC_HEADERS +#endif + +#ifdef _AIX +# define _POSIX_SOURCE +# define LACK_FTIME +#endif + +#ifdef __sgi__ +# define LACK_FTIME +# define STDC_HEADERS +# define USE_ANSI_PROTOTYPES +# define HAVE_SYS_TIME_H +# define __SVR4 +#endif + +#ifdef __SVR4 +# define HAVE_SELECT +#endif + +#ifdef PLAN9 +# define STDC_HEADERS +#endif + +#ifdef hpux +# define LACK_E_IDs +#endif + +/* C-Set++ for OS/2 */ +#ifdef __IBMC__ +# define STDC_HEADERS +# define LACK_TIMES +# define LACK_SBRK +#endif + +#ifdef __CYGWIN__ +/* # define LACK_FTIME */ +# define HAVE_SELECT +# define HAVE_SYS_TIME_H +# undef MSDOS +#endif + +#ifdef __amigaos__ +# define HAVE_SELECT +# define HAVE_SYS_TIME_H +# define LACK_SBRK +#endif + +/* PROMPT is the prompt string printed at top level */ + +#ifndef PROMPT +# ifdef SICP +# define PROMPT "==> " +# else +# define PROMPT "> " +# endif +#endif + +/* #define BRACKETS_AS_PARENS to have [ and ] be read as ( and ) in forms. */ + +/* #define BRACKETS_AS_PARENS */ + +/* LINE_INCREMENTORS are the characters which cause the line count to + be incremented for the purposes of error reporting. This feature + is only used for scheme code loaded from files. + + WHITE_SPACES are other characters which should be treated like spaces + in programs. in both cases sparate characters with ":case " */ + +#define LINE_INCREMENTORS '\n' +#ifdef MSDOS +# define WHITE_SPACES ' ':case '\t':case '\r':case '\f':case 26 +#else +# define WHITE_SPACES ' ':case '\t':case '\r':case '\f' +#endif + +#ifdef __ia64__ +# define PTR2INT(x) ((long)(x)) +#else +# ifdef __x86_64 +# define PTR2INT(x) ((long)(x)) +# else +# define PTR2INT(x) ((int)(x)) +# endif +#endif + +/* Define BIGDIG to an integer type whose size is smaller than long if + you want bignums. BIGRAD is one greater than the biggest BIGDIG. */ +/* Define DIGSTOOBIG if the digits equivalent to a long won't fit in a long. */ +#ifdef BIGNUMS +# ifdef _UNICOS +# define DIGSTOOBIG +# if (1L << 31) <= USHRT_MAX +# define BIGDIG unsigned short +# else +# define BIGDIG unsigned int +# endif +# define BITSPERDIG 32 +# else +# define BIGDIG unsigned short +# define BITSPERDIG (sizeof(BIGDIG)*CHAR_BIT) +# endif +# define BIGRAD (1L << BITSPERDIG) +# define DIGSPERLONG ((sizet)((sizeof(long)*CHAR_BIT+BITSPERDIG-1)/BITSPERDIG)) +# define BIGUP(x) ((unsigned long)(x) << BITSPERDIG) +# define BIGDN(x) ((x) >> BITSPERDIG) +# define BIGLO(x) ((x) & (BIGRAD-1)) +/* NUMDIGS_MAX is the maximum number of digits for BIGNUMS */ +# ifndef NUMDIGS_MAX +# define NUMDIGS_MAX 1000 +# endif +#endif + +#ifndef BIGDIG +# ifndef FLOATS +# define INUMS_ONLY +# endif +#endif + +#ifndef __builtin_expect +# ifndef __GNUC__ +# define __builtin_expect(expr, expected) (expr) +# else +# if (__GNUC__ < 3) +# define __builtin_expect(expr, expected) (expr) +# endif +# endif +#endif + +#define SCM_EXPECT_TRUE(expr) (__builtin_expect(expr, !0)) +#define SCM_EXPECT_FALSE(expr) (__builtin_expect(expr, 0)) + +#ifdef __GNUC__ +# define FENCE asm volatile ("") +#else +# define FENCE /**/ +#endif + +#ifdef NON_PREEMPTIVE +# define VERIFY_INTS(s1, s2) /**/ +# define DEFER_INTS /**/ +# ifdef TICKS +# define POLL {if (0==poll_count--) poll_routine(); \ + if (0==tick_count--) tick_signal();} +# else +# define POLL {if (0==poll_count--) poll_routine();} +# endif +# define CHECK_INTS POLL +# define ALLOW_INTS POLL +# define DEFER_INTS_EGC /**/ +# define ALLOW_INTS_EGC /**/ +#else +# ifdef CAREFUL_INTS +typedef struct {char *fname; int linum;} ints_infot; +extern ints_infot *ints_info; +# define VERIFY_INTS(s1, s2) {if (!ints_disabled)\ + ints_warn(s1, s2, __FILE__, __LINE__); } +# define DEFER_INTS \ + {static ints_infot info = {__FILE__, __LINE__};\ + FENCE;if (1==ints_disabled) ints_viol(&info, 1);\ + else {ints_info = &info; ints_disabled = 1;FENCE;}} +# define ALLOW_INTS \ + {static ints_infot info = {__FILE__, __LINE__};\ + FENCE;if (1!=ints_disabled) ints_viol(&info, 0);\ + else {ints_info = &info; ints_disabled = 0;FENCE;CHECK_INTS}} +# define DEFER_INTS_EGC \ + {static ints_infot info = {__FILE__, __LINE__};\ + FENCE;if (1==ints_disabled) ints_viol(&info, 1);\ + else {ints_info = &info; ints_disabled = 2;FENCE;}} +# define ALLOW_INTS_EGC \ + {static ints_infot info = {__FILE__, __LINE__};\ + FENCE;if (1==ints_disabled) ints_viol(&info, 0);\ + else {ints_info = &info; ints_disabled = 0;FENCE;CHECK_INTS}} +# else +# define VERIFY_INTS(s1, s2) /**/ +# define DEFER_INTS {FENCE;ints_disabled = 1;FENCE;} +# define ALLOW_INTS {FENCE;ints_disabled = 0;FENCE;CHECK_INTS} +# define DEFER_INTS_EGC {FENCE;ints_disabled = 2;FENCE;} +# define ALLOW_INTS_EGC {FENCE;ints_disabled = 0;FENCE;CHECK_INTS} +# endif +# ifdef TICKS +# define CHECK_INTS {if (deferred_proc) (*deferred_proc)(); POLL;} +# define POLL {if (0==tick_count--) tick_signal();} +# else +# define CHECK_INTS {if (deferred_proc) (*deferred_proc)();} +# define POLL /**/ +# endif +#endif + +#ifndef STACK_LIMIT +# define STACK_LIMIT (HEAP_SEG_SIZE) +#endif + +#define CHECK_STACK {if (2 < scm_verbose) stack_check();} + +/* Cray machines have pointers that are incremented once for each word, + rather than each byte, the 3 most significant bits encode the byte + within the word. The following macros deal with this by storing the + native Cray pointers like the ones that looks like scm expects. This + is done for any pointers that might appear in the car of a cell, pointers + to vector elts, functions, &c are not munged. */ +#ifdef _UNICOS +# define SCM2PTR(x) ((int)(x) >> 3) +# define PTR2SCM(x) (((SCM)(x)) << 3) +# define POINTERS_MUNGED +#else +# ifdef TEST_SCM2PTR +# define SCM2PTR(x) ((x) ^ 0xf0L) +# define PTR2SCM(x) (((SCM)(x)) ^ 0xf0L) +# define POINTERS_MUNGED +# else +# define SCM2PTR(x) (x) +# define PTR2SCM(x) ((SCM)(x)) +# endif +#endif + +/* FIXABLE is non-null if its long argument can be encoded in an INUM. */ + +#define POSFIXABLE(n) SCM_EXPECT_TRUE((n) <= MOST_POSITIVE_FIXNUM) +#define NEGFIXABLE(n) SCM_EXPECT_TRUE((n) >= MOST_NEGATIVE_FIXNUM) +#define UNEGFIXABLE(n) SCM_EXPECT_TRUE((n) <= -MOST_NEGATIVE_FIXNUM) +#define FIXABLE(n) (POSFIXABLE(n) && NEGFIXABLE(n)) + +/* The following 8 definitions are defined automatically by the C + pre-processor. You will need to override these if you are + cross-compiling or if the C pre-processor has different properties + than the compiler. */ + +#if (((-1)%2==-1) && ((-1)%(-2)==-1) && (1%2==1) && (1%(-2)==1)) +#else +# define BADIVSGNS +#endif + +/* SRS is signed right shift */ +/*--- Turbo C++ v1.0 has a bug with right shifts of signed longs! + It is believed to be fixed in Turbo C++ v1.01 ---*/ +#if (-1==(((-1)<<2)+2)>>2) && (__TURBOC__ != 0x295) +# define SRS(x, y) ((x)>>y) +# ifdef __TURBOC__ +# define INUM(x) (((x)>>1)>>1) +# else +# define INUM(x) SRS(x, 2) +# endif +#else +# define SRS(x, y) (((x)<0) ? ~((~(x))>>y) : (x)>>y) +# define INUM(x) SRS(x, 2) +#endif + +#ifdef __TURBOC__ +/* shifts of more than one are done by a library call, single shifts are + performed in registers */ +# define MAKINUM(x) ((((x)<<1)<<1)+2L) +#else +# define MAKINUM(x) (((x)<<2)+2L) +#endif + +#ifdef _DCC +# define ASCII +#else +# if (('\n'=='\025') && (' '=='\100') && ('a'=='\201') && ('A'=='\301')) +# define EBCDIC +# endif +# if (('\n'=='\012') && (' '=='\040') && ('a'=='\141') && ('A'=='\101')) +# define ASCII +# endif +#endif + +/* CHAR_CODE_LIMIT is the number of distinct characters represented by + the unsigned char datatype. */ +/* MOST_POSITIVE_FIXNUM is the INUM closest to positive infinity. */ +/* MOST_NEGATIVE_FIXNUM is the INUM closest to negative infinity. */ + +#ifdef __STDC__ +# define HAVE_LIMITSH +#endif +#ifdef MWC +# define HAVE_LIMITSH +#endif + +#ifdef HAVE_LIMITSH +# include <limits.h> +# ifdef UCHAR_MAX +# define CHAR_CODE_LIMIT (UCHAR_MAX+1L) +# else +# define CHAR_CODE_LIMIT 256L +# endif +# define MOST_POSITIVE_FIXNUM (LONG_MAX>>2) +# ifdef _UNICOS /* Stupid cray bug */ +# define MOST_NEGATIVE_FIXNUM ((long)LONG_MIN/4) +# else +# define MOST_NEGATIVE_FIXNUM SRS((long)LONG_MIN, 2) +# endif /* UNICOS */ +#else +# define CHAR_CODE_LIMIT 256L +# define MOST_POSITIVE_FIXNUM ((long)((unsigned long)~0L>>3)) +# if (0 != ~0) +# define MOST_NEGATIVE_FIXNUM (-MOST_POSITIVE_FIXNUM-1) +# else +# define MOST_NEGATIVE_FIXNUM (-MOST_POSITIVE_FIXNUM) +# endif +#endif + +/* INTBUFLEN is the maximum number of characters neccessary for the + printed or string representation of an exact number. */ + +#ifndef CHAR_BIT +# define CHAR_BIT 8 +#endif +#ifndef LONG_BIT +# define LONG_BIT (CHAR_BIT*sizeof(long)/sizeof(char)) +#endif +#define INTBUFLEN (5+LONG_BIT) + +/* FLOBUFLEN is the maximum number of characters neccessary for the + printed or string representation of an inexact number. */ + +#ifdef FLOATS +# define FLOBUFLEN (10+2*(sizeof(double)/sizeof(char)*CHAR_BIT*3+9)/10) +#endif /* FLOATS */ + +/* MAXEXP is the maximum double precision exponent */ +/* FLTMAX is less than or equal the largest single precision float */ + +#ifdef FLOATS +# ifdef STDC_HEADERS +# ifndef macintosh +# ifndef PLAN9 +# include <float.h> +# endif +# endif +# endif +# ifdef DBL_MAX_10_EXP +# define MAXEXP DBL_MAX_10_EXP +# else +# define MAXEXP 308 /* IEEE doubles */ +# endif +# ifndef DBL_DIG +# define DBL_DIG 15 +# endif +# ifndef DBL_MAX_EXP +# define DBL_MAX_EXP 1024 +# endif +# ifdef FLT_MAX +# define FLTMAX FLT_MAX +# else +# define FLTMAX 1e+23 +# endif +#endif + +#ifdef FLOATS +# ifndef __MINGW32__ +/* Also asinh and acosh */ +# define HAVE_ATANH +# endif +#endif + +#ifdef unix +# define HAVE_UNIX +#endif +#ifdef __unix__ +# define HAVE_UNIX +#endif +#ifdef _IBMR2 +# define HAVE_UNIX +# define STDC_HEADERS +#endif + +/* Only some machines have pipes */ +#ifdef HAVE_UNIX + /* DJGPP (gcc for i386) defines unix! */ +# define HAVE_PIPE +#endif + +#ifndef macintosh +# ifndef _M_ARM +# ifndef _M_ARMT +# ifdef __WINDOWS__ /* there should be a better flag for this. */ +# define PROT386 +# endif +# endif +# endif +#endif + +/* PTR_LT defines how to compare two CELLPTRs (which may not be in the + same array). CELLPTR is a pointer to a cons cell which may be + compared or differenced. SCMPTR is used for stack bounds. */ + +#if defined(__TURBOC__) && !defined(__TOS__) +# ifdef PROT386 +typedef cell *CELLPTR; +typedef SCM *SCMPTR; +# define PTR_LT(x, y) (((long)(x)) < ((long)(y))) +# else +typedef cell huge *CELLPTR; +typedef SCM huge *SCMPTR; +# define PTR_LT(x, y) ((x) < (y)) +# endif +#else /* not __TURBOC__ */ +typedef cell *CELLPTR; +typedef SCM *SCMPTR; +# ifdef nosve +# define PTR_MASK 0xffffffffffff +# define PTR_LT(x, y) (((int)(x)&PTR_MASK) < ((int)(y)&PTR_MASK)) +# else +# define PTR_LT(x, y) ((x) < (y)) +# endif +#endif + +#define PTR_GT(x, y) PTR_LT(y, x) +#define PTR_LE(x, y) (!PTR_GT(x, y)) +#define PTR_GE(x, y) (!PTR_LT(x, y)) + +#ifdef STDC_HEADERS +# ifdef PLAN9 +# define sizet long +# else +# include <stdlib.h> +# ifdef AMIGA +# include <stddef.h> +# endif +# define sizet size_t +# endif +#else +# ifdef _SIZE_T +# define sizet size_t +# else +# define sizet unsigned int +# endif +#endif + +#ifdef macintosh +# include <unistd.h> +#endif + +#ifdef __FreeBSD__ +# include <unistd.h> +#endif + +#ifdef linux +# include <unistd.h> +#endif + +/* On VMS, GNU C's errno.h contains a special hack to get link attributes + for errno correct for linking with libc. */ + +#ifndef PLAN9 +# include <errno.h> +#endif + +/* SYSCALL retries system calls that have been interrupted (EINTR) */ +#ifdef vms +# ifndef __GNUC__ +# include <ssdef.h> +# define SCM_INTERRUPTED(errno) (EVMSERR==errno && \ + (vaxc$errno>>3)==(SS$_CONTROLC>>3)) +# endif +#endif + +#ifndef SCM_INTERRUPTED +# ifdef EINTR +# if (EINTR > 0) +# define SCM_INTERRUPTED(errno) (EINTR==errno) +# endif +# endif +#endif + +#ifndef SCM_INTERRUPTED +# define SCM_INTERRUPTED(errno) (0) +#endif + +#ifdef _WIN32 +// Windows doesn't set errno = EINTR +# define SYSCALL(line) do{line;while(GetLastError() == ERROR_OPERATION_ABORTED){SetLastError(0);Sleep(10);line};}while(0) +#else +# define SYSCALL(line) do{errno = 0;line}while(SCM_INTERRUPTED(errno)) +#endif + +#ifdef EMFILE +# ifdef ENFILE +# define SCM_NEED_FDS(errno) (EMFILE==errno || ENFILE==errno) +# else +# define SCM_NEED_FDS(errno) (EMFILE==errno) +# endif +#else +# define SCM_NEED_FDS(errno) (0) +#endif + +#define SCM_OPENCALL(line) {int gcs = 0;\ + while (!0) {errno = 0; if (line) break;\ + if (0==gcs++ && SCM_NEED_FDS(errno)) \ + gc_for_open_files();\ + else if (!SCM_INTERRUPTED(errno)) break;}} + +#ifndef MSDOS +# ifdef ARM_ULIB + extern volatile int errno; +# else + extern int errno; +# endif +#endif +#ifdef __TURBOC__ +# if (__TURBOC__==1) + /* Needed for TURBOC V1.0 */ + extern int errno; +# endif +#endif + +/* EXIT_SUCCESS is the default code to return from SCM if no errors + were encountered. EXIT_FAILURE is the default code to return from + SCM if errors were encountered. The return code can be explicitly + specified in a SCM program with (quit <n>). */ + +#ifndef EXIT_SUCCESS +# ifdef vms +# define EXIT_SUCCESS 1 +# else +# define EXIT_SUCCESS 0 +# endif +#endif +#ifndef EXIT_FAILURE +# ifdef vms +# define EXIT_FAILURE 2 +# else +# define EXIT_FAILURE 1 +# endif +#endif + +/* Yasuaki Honda, Bob Schumaker */ +/* Think C and Metrowerks lack isascii macro */ +#ifdef macintosh +# define isascii(c) ((unsigned)(c) <= 0x7f) +#endif +#ifdef _DCC +# define isascii(c) ((unsigned)(c) <= 0x7f) +#endif + +#ifdef __STDC__ +# define VOLATILE volatile +#else +# define VOLATILE /**/ +#endif + +#ifdef _MSC_VER + // Disable annoying warnings for: +# pragma warning (disable: 4102) // unreferenced label +# pragma warning (disable: 4018) // signed/unsigned mismatch +# pragma warning (disable: 4101) // unreferenced variables +# pragma warning (disable: 4244) // conversion from unsigned long to unsigned short +#endif + +/* end of automatic C pre-processor definitions */ diff --git a/SCM/scmflags.h b/SCM/scmflags.h new file mode 100644 index 0000000..a3c5ea6 --- /dev/null +++ b/SCM/scmflags.h @@ -0,0 +1,4 @@ +//#undef SHORT_ALIGN +//#define CHEAP_CONTINUATIONS +//#undef STACK_GROWS_UP +//#define CONTINUATION_OTHER diff --git a/SCM/setjump.h b/SCM/setjump.h new file mode 100644 index 0000000..e63423e --- /dev/null +++ b/SCM/setjump.h @@ -0,0 +1,125 @@ +/* "setjump.h" memory and stack parameters. + * Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + */ + +/* Author: Aubrey Jaffer */ + +/* CELL_UP and CELL_DN are used by init_heap_seg to find cell aligned inner + bounds for allocated storage */ + +#ifdef PROT386 +/*in 386 protected mode we must only adjust the offset */ +# define CELL_UP(p) MK_FP(FP_SEG(p), ~7&(FP_OFF(p)+7)) +# define CELL_DN(p) MK_FP(FP_SEG(p), ~7&FP_OFF(p)) +#else +# ifdef _UNICOS +# define CELL_UP(p) (CELLPTR)(~1L & ((long)(p)+1L)) +# define CELL_DN(p) (CELLPTR)(~1L & (long)(p)) +# else +# define CELL_UP(p) (CELLPTR)(~(sizeof(cell)-1L) & ((long)(p)+sizeof(cell)-1L)) +# define CELL_DN(p) (CELLPTR)(~(sizeof(cell)-1L) & (long)(p)) +# endif /* UNICOS */ +#endif /* PROT386 */ + +/* These are parameters for controlling memory allocation. The heap + is the area out of which cons and object headers is allocated. + Each heap object is 8 bytes on a 32 bit machine and 16 bytes on a + 64 bit machine. The units of the _SIZE parameters are bytes. + + INIT_HEAP_SIZE is the initial size of heap. If this much heap is + allocated initially the heap will grow by half its current size + each subsequent time more heap is needed. + + If INIT_HEAP_SIZE heap cannot be allocated initially, HEAP_SEG_SIZE + will be used, and the heap will grow by HEAP_SEG_SIZE when more + heap is needed. HEAP_SEG_SIZE must fit into type sizet. This code + is in init_storage() and alloc_some_heap() in sys.c + + If INIT_HEAP_SIZE can be allocated initially, the heap will grow by + EXPHEAP(heap_cells) when more heap is needed. + + MIN_HEAP_SEG_SIZE is minimum size of heap to accept when more heap + is needed. + + INIT_MALLOC_LIMIT is the initial amount of malloc usage which will + trigger a GC. */ + +#define INIT_HEAP_SIZE (25000L*sizeof(cell)) +#define MIN_HEAP_SEG_SIZE (2000L*sizeof(cell)) +#ifdef _QC +# define HEAP_SEG_SIZE 32400L +#else +# ifdef sequent +# define HEAP_SEG_SIZE (7000L*sizeof(cell)) +# else +# define HEAP_SEG_SIZE (8100L*sizeof(cell)) +# endif +#endif +#define EXPHEAP(heap_cells) (heap_cells*2) +#define INIT_MALLOC_LIMIT 100000 + +/* ECACHE_SIZE is the number of cells in the copy-collected environment + cache used for environment frames */ +#define ECACHE_SIZE 2000 + +/* If fewer than MIN_GC_YIELD cells are recovered during a + cell-requested garbage collection (GC), then another heap segment + is allocated. */ + +#define MIN_GC_YIELD (heap_cells / 4) + +/* If fewer than MIN_MALLOC_YIELD cells are free after a + malloc-requested garbage collection (GC), then the mtrigger limit + is raised. */ + +#define MIN_MALLOC_YIELD (mtrigger / 8) + +/* NUM_HASH_BUCKETS is the number of symbol hash table buckets. */ + +#define NUM_HASH_BUCKETS 137 + +#ifdef IN_CONTINUE_C +# include "scm.h" +# define malloc(size) must_malloc((long)(size), s_cont) +# define free(obj) must_free((char *)(obj), 0) +#endif + +/* other.dynenv and other.parent get GCed just by being there. */ +struct scm_other {SCM dynenv; + SCM parent; +#ifdef RECKLESS + SCM stkframe[2]; +#else + SCM stkframe[4]; +#endif + SCM estk; + SCM *estk_ptr; + }; +#define CONTINUATION_OTHER struct scm_other +#define CONT(x) ((CONTINUATION *)CDR(x)) +#define SETCONT SETCDR +void dowinds P((SCM to)); + +#include "continue.h" + +typedef struct safeport { + SCM port; + jmp_buf jmpbuf; /* The usual C jmp_buf, not SCM's jump_buf */ + int ccnt; +} safeport; + +#define SAFEP_JMPBUF(sfp) (((safeport *)STREAM(sfp))->jmpbuf) diff --git a/SCM/setjump.mar b/SCM/setjump.mar new file mode 100644 index 0000000..3fc223c --- /dev/null +++ b/SCM/setjump.mar @@ -0,0 +1,39 @@ + .title setjump and longjump + +; The VAX C runtime library uses the $unwind utility for +; implementing longjmp. That fails if your program does not +; follow normal stack decipline. This is a dirty implementation +; of setjmp and longjmp that does not have that problem. The +; names longjmp and setjmp are avoided so that the code can be +; linked with the vax c runtime library without name clashes. + +; This code was contributed by an anonymous reviewer from +; comp.sources.reviewed. + + .entry setjump,^M<IV> + movl 4(ap),r0 + movq r2,(r0)+ + movq r4,(r0)+ + movq r6,(r0)+ + movq r8,(r0)+ + movq r10,(r0)+ + movl fp,(r0)+ + movo 4(fp),(r0)+ + movq 20(fp),(r0) + clrl r0 + ret + + .entry longjump,^M<IV> + movl 4(ap),r0 + movq (r0)+,r2 + movq (r0)+,r4 + movq (r0)+,r6 + movq (r0)+,r8 + movq (r0)+,r10 + movl (r0)+,r1 + movo (r0)+,4(r1) + movq (r0),20(r1) + movl 8(ap),r0 + movl r1,fp + ret + .end diff --git a/SCM/setjump.s b/SCM/setjump.s new file mode 100644 index 0000000..b96fb05 --- /dev/null +++ b/SCM/setjump.s @@ -0,0 +1,40 @@ +* setjmp on the Cray YMP does not save all registers. Although this +* conforms to the ANSI standard, it is not sufficient for SCM garbage +* collection and continuations. +* +* This is a version of setjump for the Cray YMP that does save all non- +* temporary registers. It might work for the XMP. It definitely will +* not work on the Cray 2. I do not know if the setjmp on the Cray 2 will +* work with SCM or not. +* +* This has been tested under Unicos 6.1. +* +* --Radey Shouman <rshouman@chpc.utexas.edu> +* + IDENT SETJUMP + ENTRY setjump +setjump = * + A1 1,A6 + A2 56 + A0 A1 + ,A0 T00,A2 + A0 A1+A2 + ,A0 B00,A2 + S1 0 + J B00 +* + ENTRY longjump +longjump = * + A1 1,A6 + A0 A1 + A2 56 + T00,A2 ,A0 + A0 A1+A2 + B00,A2 ,A0 + S1 2,A6 + J B00 + END +** Local Variables: +** tab-stop-list: (12 28 45) +** indent-tabs-mode: nil +** End: diff --git a/SCM/toilet-scm.c b/SCM/toilet-scm.c new file mode 100644 index 0000000..b3f2f12 --- /dev/null +++ b/SCM/toilet-scm.c @@ -0,0 +1,33 @@ +/* -*- mode: objc; coding: utf-8 -*- */ +/* Toilet Lisp, a Common Lisp subset for the Étoilé runtime. + * Copyright (C) 2008 Matthias Andreas Benkard. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdlib.h> +#include <stdint.h> + +char s_call_cc[] = "call-with-current-continuation"; + +char *must_malloc (size_t len, const char *what) +{ + return (char *)malloc(len); +} + +void must_free (char *obj, size_t len) +{ + if (obj) + free(obj); +} diff --git a/SCM/ugsetjump.s b/SCM/ugsetjump.s new file mode 100644 index 0000000..e9e29f4 --- /dev/null +++ b/SCM/ugsetjump.s @@ -0,0 +1,35 @@ +#NO_APP +.text + .align 1 +.globl _setjump +_setjump: + .word 0x0 + movl 4(ap),r0 + movq r2,(r0)+ + movq r4,(r0)+ + movq r6,(r0)+ + movq r8,(r0)+ + movq r10,(r0)+ + movl fp,(r0)+ + movo 4(fp),(r0)+ + movq 20(fp),(r0) + clrl r0 + ret + ret + .align 1 +.globl _longjump +_longjump: + .word 0x0 + movl 4(ap),r0 + movq (r0)+,r2 + movq (r0)+,r4 + movq (r0)+,r6 + movq (r0)+,r8 + movq (r0)+,r10 + movl (r0)+,r1 + movo (r0)+,4(r1) + movq (r0),20(r1) + movl 8(ap),r0 + movl r1,fp + ret + ret |