mit-scheme.git
13 years agoMerge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme
Taylor R Campbell [Wed, 27 Apr 2011 19:23:38 +0000 (19:23 +0000)]
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme

13 years agoOops, for-all?'s arguments are "backward".
Matt Birkholz [Tue, 26 Apr 2011 20:09:24 +0000 (13:09 -0700)]
Oops, for-all?'s arguments are "backward".

13 years agoTurned off c-include-noisily? by default.
Matt Birkholz [Tue, 26 Apr 2011 17:48:28 +0000 (10:48 -0700)]
Turned off c-include-noisily? by default.

Turned it on in the FFI generator.  Use it to suppress the "Loading
gtk-types.bin..." notifications when compiling files that c-include.

13 years agoFixed compile-ffi to use run-shell-command.
Matt Birkholz [Tue, 26 Apr 2011 17:47:42 +0000 (10:47 -0700)]
Fixed compile-ffi to use run-shell-command.

Now sets the working directory and checks make's exit code.

13 years agoIgnore unknown options/descriptions in .pkg files.
Matt Birkholz [Tue, 26 Apr 2011 17:42:52 +0000 (10:42 -0700)]
Ignore unknown options/descriptions in .pkg files.

13 years agoRemoved redundant --preserve-timestamps.
Matt Birkholz [Mon, 25 Apr 2011 20:39:50 +0000 (13:39 -0700)]
Removed redundant --preserve-timestamps.

13 years agoFixed recent enhancement to compile-file.
Matt Birkholz [Mon, 25 Apr 2011 20:00:09 +0000 (13:00 -0700)]
Fixed recent enhancement to compile-file.

13 years agoFix compile-system to load into the correct environment.
Matt Birkholz [Wed, 20 Apr 2011 15:26:08 +0000 (08:26 -0700)]
Fix compile-system to load into the correct environment.

13 years agoNew compile-system procedure. Replaced ffi.sf and ffi.cbf.
Matt Birkholz [Tue, 19 Apr 2011 07:49:14 +0000 (00:49 -0700)]
New compile-system procedure.  Replaced ffi.sf and ffi.cbf.

* src/compiler/base/toplev.scm (compile-file): Only declare
integrate-external when dependencies have no type.  Thus a dependency
on e.g. "gtk-const.bin" might cause the dependent file to be
re-compiled without a spurious warning about a missing .ext file.

* src/cref/: butils.scm, cref.pkg: Added new file butils.scm,
containing a compile-system procedure that applies compile-file to
each file mentioned in a .pkg file.

* src/ffi/: compile.scm, ffi.cbf, ffi.sf: Replaced the old .cbf and
.sf files with a new, modern compile.scm file.

13 years agoFixed ffi/Makefile-fragment install target.
Matt Birkholz [Mon, 18 Apr 2011 15:25:25 +0000 (08:25 -0700)]
Fixed ffi/Makefile-fragment install target.

* src/Setup.sh: Create src/lib/ links to the ffi-test FFI.

* src/ffi/Makefile-fragment: Punt installing the ffi-test FFI, which
is intended for `make check', which developers run in the source tree.
The links in src/lib/ are enough; no need to copy files there.

13 years agoMerge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme
Taylor R Campbell [Mon, 18 Apr 2011 02:33:51 +0000 (02:33 +0000)]
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme

13 years agoAdded FFI test.
Matt Birkholz [Mon, 18 Apr 2011 00:08:38 +0000 (17:08 -0700)]
Added FFI test.

* doc/ffi/ffi.texinfo: Punt the Makefile fragments for the example,
and the logic behind the leak-proof malloc/free procedures.

* doc/user-manual/user.texinfo: Needlessly picked some consistency nits.

* src/Clean.sh, src/Setup.sh: Link config.sub and config.guess to
microcode/*, and clean them too.  These scripts are used by
src/configure.ac, which uses AC_CANONICAL_HOST to configure the
compilation and linking of FFIs.

* src/Makefile.in (FFIS, build-ffis): Added FFIS, the list of
configured foreign library interfaces (subdirs).  These are built by
the new build-ffis target, which follows build-bands in most places,
and does `make build' in each ffi subdir.

* src/configure.ac: Added --enable-debugging, FFIS, CCLD, DEFS,
CFLAGS, CPPFLAGS, LDFLAGS, SHIM_CFLAGS and SHIM_LDFLAGS.  Include
microcode/achost.ac.  Added FFIS to the bundles list.

* src/etc/compile.scm (compile-ffi): New.  This procedure arranges to
compile an FFI subdir as a LIARC bundle when LIARC is in use.

* src/etc/functions.sh (maybe_rm): Remove symlinks too.

* src/etc/make-liarc.sh: Added build-ffis after build-bands.

* src/etc/std-makefile-prefix: Added CC, CCLD, DEFS, CFLAGS, CPPFLAGS,
LDFLAGS, COMPILE, LINK, SHIM_CFLAGS, SHIM_LDFLAGS, COMPILE_SHIM and
LINK_SHIM, useful when building a foreign library interface shim.

* src/ffi/.gitignore: Ignore ffi-test-* build products.

* src/ffi/Clean.sh: Punt prhello example.  Clean up ffi-test-* build
products.

* src/ffi/Makefile-fragment: Punt prhello example.  Build and install
an FFI test lib instead.

* src/ffi/: ffi-test.c.stay, ffi-test.cdecl, ffi-test.h: The new test
foreign library and interface.

* src/ffi/: prhello.cdecl, prhello.scm: Removed.  Now in doc/;
replaced in src/ by ffi-test*.*.

* src/microcode/: achost.ac, configure.ac: Moved the host
configuration from configure.ac to the new achost.ac, to share with
src/configure.ac.

* src/runtime/ffi.scm (guarantee-alien, error:not-alien): Use the
standard arglist (object operator), not (operator object #!optional
ctype), and do not loop insisting on a qualifying object.  Integrate
the test, separated from the restart code, which goes in the new,
global error:not-alien procedure.

(guarantee-alien-function, error:not-alien-function): New, like
guarantee-alien and error:not-alien.  Use them in call-alien.

(make-alien-to-free): New, for interfacing to C functions like
malloc() that return something that needs to be freed with free().
Use it in the Scheme malloc procedure, and the test FFI.

* src/runtime/runtime.pkg: Added error:not-alien,
guarantee-alien-function, error:not-alien-function and
make-alien-to-free.

* tests/Clean.sh: New, for cleaning up after tests.

* tests/check.scm: Added tests/ffi/test-ffi.scm.  Hacked handling of
test-flonum-casts.com so that `make check' works on portable C.

* tests/ffi/test-ffi-wrapper.scm: New.  Code that needs to be
syntaxed/compiled as part of the FFI test.

* tests/ffi/test-ffi.scm: New.  A test of the C/Unix FFI.

13 years agoRun Scheme in batch mode in the scripts in src/etc/.
Taylor R Campbell [Sat, 16 Apr 2011 00:40:37 +0000 (00:40 +0000)]
Run Scheme in batch mode in the scripts in src/etc/.

13 years agoMake `--batch-mode' without `--interactive' imply non-interactive.
Taylor R Campbell [Sat, 16 Apr 2011 00:25:41 +0000 (00:25 +0000)]
Make `--batch-mode' without `--interactive' imply non-interactive.

In this case, don't check whether stdin/stdout/stderr are ttys to
determine whether we are interactive.

This keeps `scheme --batch-mode' from futzing with the tty interrupt
characters, so that if you run it from a script, there is no window
during which ^G becomes the terminal's interrupt character and ^C its
quit character.  E.g., if you have set `stty intr ^C', then Scheme
won't interfere with that while you run your script.

13 years agoUse do { ... } while (0) for command macros in uxproc.c.
Taylor R Campbell [Sun, 10 Apr 2011 21:17:29 +0000 (21:17 +0000)]
Use do { ... } while (0) for command macros in uxproc.c.

Omit needless curly braces in subprocess_death.

13 years agoCheck for tcsetpgrp failure.
Taylor R Campbell [Sun, 10 Apr 2011 19:34:53 +0000 (19:34 +0000)]
Check for tcsetpgrp failure.

13 years agoDon't fflush stdout and stderr before forking.
Taylor R Campbell [Sun, 10 Apr 2011 19:31:52 +0000 (19:31 +0000)]
Don't fflush stdout and stderr before forking.

Not necessary; the child will never use them before exec'ing.
The simpler this whole mess can be made, the better...

13 years agoMinor cosmetic changes to uxproc.c.
Taylor R Campbell [Sun, 10 Apr 2011 19:24:31 +0000 (19:24 +0000)]
Minor cosmetic changes to uxproc.c.

13 years agoUse the closefrom system call if available to close all fds.
Taylor R Campbell [Sun, 10 Apr 2011 19:21:06 +0000 (19:21 +0000)]
Use the closefrom system call if available to close all fds.

If not available, fall back to fcntl(F_CLOSEM); if that's not
available, fall back to closing all fds up to and including
fcntl(F_MAXFD); if that's not available, fall back to closing all
fds below UX_SC_OPEN_MAX like before.

Each case tested under NetBSD by running runtime/test-process.scm,
evaluating (RUN-SHELL-COMMAND "ls"), and ktracing Scheme during

   (RUN-SUBPROCESS-IN-FOREGROUND "/usr/bin/true" '#("true") '#())

with `ktrace -d -i' to make sure that it uses the right sequence of
system calls.

13 years agoWhen spawning subprocesses, handle the setpgid race more gracefully.
Taylor R Campbell [Sun, 10 Apr 2011 19:04:50 +0000 (19:04 +0000)]
When spawning subprocesses, handle the setpgid race more gracefully.

13 years agoAdd some disparaging comments about my code...yechhh.
Taylor R Campbell [Sun, 10 Apr 2011 05:03:06 +0000 (05:03 +0000)]
Add some disparaging comments about my code...yechhh.

13 years agoPre-compile the regexps in IMAIL-SUMMARY-MATCH-LINE.
Taylor R Campbell [Sun, 10 Apr 2011 05:01:51 +0000 (05:01 +0000)]
Pre-compile the regexps in IMAIL-SUMMARY-MATCH-LINE.

This slightly reduces some of the constant factors in the O(n)-time
(!) operation to expand summary buffers...

13 years agoIgnore some variables in test-floenv.scm.
Taylor R Campbell [Sat, 9 Apr 2011 23:46:01 +0000 (23:46 +0000)]
Ignore some variables in test-floenv.scm.

13 years agoIgnore variable I in MAKE-RANDOM-SVL in character set tests.
Taylor R Campbell [Sat, 9 Apr 2011 22:17:38 +0000 (22:17 +0000)]
Ignore variable I in MAKE-RANDOM-SVL in character set tests.

13 years agoFix environment for runtime/test-wttree in tests/check.scm.
Taylor R Campbell [Sat, 9 Apr 2011 22:00:26 +0000 (22:00 +0000)]
Fix environment for runtime/test-wttree in tests/check.scm.

13 years agoImplement `make check' in the top-level makefile.
Taylor R Campbell [Sat, 9 Apr 2011 21:46:34 +0000 (21:46 +0000)]
Implement `make check' in the top-level makefile.

The implementation is totally kludgey, and the tests take an
unreasonably long time to run (since we've mixed stress tests with
simple tests), but this is better than nothing, and may help to
complement firing up Edwin as the general way to test Scheme.

13 years agoRefactor microcode/test-flonum-casts.scm into lots of little tests.
Taylor R Campbell [Sat, 9 Apr 2011 21:25:55 +0000 (21:25 +0000)]
Refactor microcode/test-flonum-casts.scm into lots of little tests.

13 years agoWork around brain damage in Linux's madvise.
Taylor R Campbell [Wed, 6 Apr 2011 02:55:11 +0000 (02:55 +0000)]
Work around brain damage in Linux's madvise.

13 years agoFix diagram of memory in memmag.c to reflect Microcode 15.
Taylor R Campbell [Tue, 5 Apr 2011 01:02:32 +0000 (01:02 +0000)]
Fix diagram of memory in memmag.c to reflect Microcode 15.

13 years agoAdd comment about (not) dynamically scoping madvice.
Taylor R Campbell [Tue, 5 Apr 2011 00:52:36 +0000 (00:52 +0000)]
Add comment about (not) dynamically scoping madvice.

13 years agoAdvise operating system about memory access during GC.
Taylor R Campbell [Tue, 5 Apr 2011 00:33:40 +0000 (00:33 +0000)]
Advise operating system about memory access during GC.

- Expect sequential access to oldspace during gc_scan_oldspace.
- Free heap pages (newspace) before copying tospace over them.
- Free tospace pages after saving tospace.

The OS hooks are implemented only for Unix, in terms of posix_madvise
and madvise.  Implementing them for Windows and/or OS/2 is left as an
exercise for the reader.

13 years agoUse a (hidden) top-level variable for tag in structure predicates.
Taylor R Campbell [Sun, 3 Apr 2011 21:14:59 +0000 (21:14 +0000)]
Use a (hidden) top-level variable for tag in structure predicates.

This allows the predicates to be usefully integrated.

Integrating the predicate and guarantor, and ignoring reference traps
to the tag, measurably improves performance at least of contrived
programs.

13 years agoBack out recent misguided changes.
Taylor R Campbell [Sun, 3 Apr 2011 17:48:50 +0000 (17:48 +0000)]
Back out recent misguided changes.

It turns out dynamic scope and vi don't work very well.

This also fixes a grammatical error reported to Arthur by an angry
centurion.

13 years agoFixed bug that caused (load-option 'xml) to fail with this error
Arthur A. Gleckler [Sun, 3 Apr 2011 06:56:59 +0000 (23:56 -0700)]
Fixed bug that caused (load-option 'xml) to fail with this error
message:

  ;The object #[uri 11 ""], passed as an argument to make-xml-name, is not in the correct range.

The bug was caused by the fix to `->absolute-uri' in change
562020fdf80823b5825ad901e208b10a4d3b058b.

13 years agoFix typo in termination message.
Taylor R Campbell [Fri, 1 Apr 2011 15:11:23 +0000 (15:11 +0000)]
Fix typo in termination message.

13 years agoChange Edwin's default key bindings to match vi conventions.
Taylor R Campbell [Fri, 1 Apr 2011 15:05:28 +0000 (15:05 +0000)]
Change Edwin's default key bindings to match vi conventions.

All the world is Unix (except for the small irrelevant part in
Redmond that's VMS), so this should improve Edwin's widespread
adoption.

13 years agoSwitch to dynamic scope by default.
Taylor R Campbell [Fri, 1 Apr 2011 14:30:55 +0000 (14:30 +0000)]
Switch to dynamic scope by default.

13 years agoMerge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme
Taylor R Campbell [Tue, 29 Mar 2011 00:57:38 +0000 (00:57 +0000)]
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme

13 years agoAdd and export GUARANTEE-PROMISE.
Joe Marshall [Mon, 28 Mar 2011 17:41:18 +0000 (10:41 -0700)]
Add and export GUARANTEE-PROMISE.

13 years agoAdd numerator->exact and denominator->exact.
Joe Marshall [Thu, 24 Mar 2011 20:48:13 +0000 (13:48 -0700)]
Add numerator->exact and denominator->exact.

13 years agoWhen signalling a file open error, read channel type before closing.
Taylor R Campbell [Wed, 23 Mar 2011 04:34:00 +0000 (04:34 +0000)]
When signalling a file open error, read channel type before closing.

13 years agoCopy example files to doc/ffi/ directory to avoid relative paths,
Chris Hanson [Sun, 20 Mar 2011 09:26:07 +0000 (02:26 -0700)]
Copy example files to doc/ffi/ directory to avoid relative paths,
which aren't working on my machine.

13 years agoBump version number and current year.
Chris Hanson [Sun, 20 Mar 2011 09:25:59 +0000 (02:25 -0700)]
Bump version number and current year.

13 years agoFor some reason, fatal_buf doesn't have a NUL under certain circumstances on my Mac...
Chris Hanson [Sun, 20 Mar 2011 09:25:38 +0000 (02:25 -0700)]
For some reason, fatal_buf doesn't have a NUL under certain circumstances on my Mac.  Instead of calling strlen, do a more careful scan that stops at the end of the buffer.

13 years agoBump version number and current year.
Chris Hanson [Sun, 20 Mar 2011 05:59:34 +0000 (22:59 -0700)]
Bump version number and current year.

13 years agoUpdate copyright dates in reference headers.
Chris Hanson [Sun, 20 Mar 2011 05:57:05 +0000 (22:57 -0700)]
Update copyright dates in reference headers.

13 years agoAdd GUARANTEEs for positive, negative, non-positive, and non-negative numbers.
Joe Marshall [Wed, 9 Mar 2011 18:27:42 +0000 (10:27 -0800)]
Add GUARANTEEs for positive, negative, non-positive, and non-negative numbers.

13 years agoMerge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme
Taylor R Campbell [Sat, 26 Feb 2011 15:13:02 +0000 (15:13 +0000)]
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme

13 years agoExport some predicates.
Joe Marshall [Fri, 25 Feb 2011 20:58:30 +0000 (12:58 -0800)]
Export some predicates.

13 years agoFix typo in `mail-relay-service' documentation string.
Taylor R Campbell [Thu, 17 Feb 2011 20:51:56 +0000 (20:51 +0000)]
Fix typo in `mail-relay-service' documentation string.

13 years agoNew (Unix) primitive CHANNEL-FILE-ATTRIBUTES for fstat.
Taylor R Campbell [Mon, 14 Feb 2011 18:51:08 +0000 (18:51 +0000)]
New (Unix) primitive CHANNEL-FILE-ATTRIBUTES for fstat.

Also, I meant `eastern hemisphere' in the previous commit, unless the
earth's magnetic field has just reversed again...no, wait...

13 years agoFix ENCODE-TIME to correctly handle negative time zones.
Taylor R Campbell [Mon, 14 Feb 2011 17:39:45 +0000 (17:39 +0000)]
Fix ENCODE-TIME to correctly handle negative time zones.

This bug has been lying here for fifteen years.  Obviously we need
more MIT Scheme hackers in the western hemisphere...

All this time and date code desperately needs a lot of automatic
tests, too.

13 years agoBump microcode version number.
Taylor R Campbell [Tue, 8 Feb 2011 01:19:01 +0000 (01:19 +0000)]
Bump microcode version number.

New primitive NANOTIME-SINCE-UTC-EPOCH, and a bajillion others.

13 years agoNew primitive NANOTIME-SINCE-UTC-EPOCH.
Taylor R Campbell [Mon, 7 Feb 2011 21:49:52 +0000 (21:49 +0000)]
New primitive NANOTIME-SINCE-UTC-EPOCH.

This returns the number of seconds, with at most nanosecond
resolution, that have elapsed since the start of 1972 in UTC.
Representation is fixed-point, stored in a pair given as input.

See the comments in uxenv.c for more details.

13 years agoTwo minor cosmetic changes to runtime/wttree.scm.
Taylor R Campbell [Mon, 24 Jan 2011 14:43:42 +0000 (14:43 +0000)]
Two minor cosmetic changes to runtime/wttree.scm.

13 years agoFix wt-tree balancing. Add some trivial tests.
Taylor R Campbell [Mon, 24 Jan 2011 14:26:36 +0000 (14:26 +0000)]
Fix wt-tree balancing.  Add some trivial tests.

Thanks to Yoichi Hirai and Kazuhiko Yamamoto for analyzing the nature
of the bug and finding a good fix.

The trivial tests are enough to catch trivial errors, and one
manifestation of the balancing bug, but they should be replaced by a
more comprehensive test suite later.

13 years agoCheck URI record arguments more carefully in ->MUMBLE-URI.
Taylor R Campbell [Sat, 15 Jan 2011 04:36:39 +0000 (04:36 +0000)]
Check URI record arguments more carefully in ->MUMBLE-URI.

->ABSOLUTE-URI would formerly accept URI records representing
relative references, even though it would reject their string
representations.  Now it rejects both.

13 years agoLook in /usr/local/share/info for Info files in Edwin by default.
Taylor R Campbell [Tue, 4 Jan 2011 03:35:38 +0000 (03:35 +0000)]
Look in /usr/local/share/info for Info files in Edwin by default.

This is where the doc/ makefile actually installs them by default.

13 years agoMerge branch 'master' of git.sv.gnu.org:/srv/git/mit-scheme
Chris Hanson [Fri, 24 Dec 2010 04:57:35 +0000 (20:57 -0800)]
Merge branch 'master' of git.sv.gnu.org:/srv/git/mit-scheme

13 years agoFix floenv issues with MacOSX.
Chris Hanson [Fri, 24 Dec 2010 04:37:31 +0000 (20:37 -0800)]
Fix floenv issues with MacOSX.

13 years agoFFI support for 64bit architectures.
Matt Birkholz [Tue, 21 Dec 2010 17:28:03 +0000 (10:28 -0700)]
FFI support for 64bit architectures.

* src/ffi/generator.scm: Declare long callback IDs, large enough to
avoid truncation warnings when the toolkit type is also large.  Use
%ld instead of %d for sizeof and member offsets, and cast them to
long.  On x86_64, these have types ulong and long respectively.

* src/microcode/: pruxffi.c, pruxffi.h: (callback_run_kernel)
(callback_run_handler): Declare long callback_id params.  Use %ld.

* src/runtime/ffi.scm (radix): Parameterize alien operations to
support 64bit or 32bit addresses.

13 years agoFix tag table entry for flonum for 64-bit platforms.
Joe Marshall [Sat, 18 Dec 2010 01:32:08 +0000 (17:32 -0800)]
Fix tag table entry for flonum for 64-bit platforms.

13 years agoFix copying of ACCESS.
Joe Marshall [Fri, 17 Dec 2010 23:31:36 +0000 (15:31 -0800)]
Fix copying of ACCESS.

13 years agoFix STRIP-SUBJECT-RE on "Re: ".
Taylor R Campbell [Fri, 10 Dec 2010 06:46:35 +0000 (06:46 +0000)]
Fix STRIP-SUBJECT-RE on "Re: ".

13 years agoFix datime.scm's time formats to accept up to 61 seconds in a minute.
Taylor R Campbell [Tue, 7 Dec 2010 23:37:59 +0000 (23:37 +0000)]
Fix datime.scm's time formats to accept up to 61 seconds in a minute.

Minutes in any UTC-based time system, which covers every system of
which representations are parsed in datime.scm, can have 59, 60, or
61 seconds; previously we refused to parse representations of the
61st second.

Unfortunately, our notion of `universal time' is still essentially
Common Lisp's ill-specified notion of universal time, and implemented
by POSIX's mind-bogglingly brain-damaged notion of `number of seconds
since the Epoch' which actually means `number of seconds since the
Epoch, minus the number of them that were leap seconds in UTC'.

13 years agoFix silly thinko in definition of STRIP-SUBJECT-RE.
Taylor R Campbell [Tue, 30 Nov 2010 19:16:08 +0000 (19:16 +0000)]
Fix silly thinko in definition of STRIP-SUBJECT-RE.

Also omit needless unsafe fixnum specialization.

13 years agoHandle EINTR from opendir.
Taylor R Campbell [Wed, 24 Nov 2010 18:29:14 +0000 (18:29 +0000)]
Handle EINTR from opendir.

13 years agoFix comment about euclidean division -- r may be zero.
Taylor R Campbell [Fri, 19 Nov 2010 18:54:11 +0000 (18:54 +0000)]
Fix comment about euclidean division -- r may be zero.

13 years agoWork around bug in glibc's fegetenv on amd64.
Taylor R Campbell [Fri, 19 Nov 2010 07:24:54 +0000 (07:24 +0000)]
Work around bug in glibc's fegetenv on amd64.

13 years agoMerge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme
Taylor R Campbell [Fri, 19 Nov 2010 06:49:07 +0000 (06:49 +0000)]
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/mit-scheme

13 years agoReplace `masking exceptions' by `trapping exceptions'.
Taylor R Campbell [Fri, 19 Nov 2010 06:10:27 +0000 (06:10 +0000)]
Replace `masking exceptions' by `trapping exceptions'.

Reversing the sense makes it clearer -- `trap on division by zero' is
a positive request, versus `mask division by zero traps', i.e. `don't
trap on division by zero'.  This better reflects the IEEE 754 notion
of actions to take on exceptions.  Also, the sense of `mask' is often
confusing (Scheme's `interrupt mask' is not the interrupts that are
masked, but the bit mask of interrupts that are *enabled*; the BSD
fpgetmask and fpsetmask library routines control the bit mask of
floating-point exceptions for which trapping is enabled; but, on the
other hand, a POSIX process's `signal mask' is the set of signals
that are disabled).

13 years agoImplement a complete set of integer division operator pairs.
Taylor R Campbell [Fri, 19 Nov 2010 05:02:58 +0000 (05:02 +0000)]
Implement a complete set of integer division operator pairs.

Given a numerator n and a denominator d, each operator pair computes
an integral quotient q and the induced remainder r = n - d q such
that |r| < |d|.  There are five pairs: ceiling, euclidean, floor,
round, and truncate.  Ceiling, floor, round, and truncate compute the
rounded quotient as their names suggest.  Euclidean division is floor
division for positive denominators, and ceiling division for negative
denominators, so that it exhibits the stronger property 0 <= r < |d|.

13 years agoFix example code in "Type and range checking".
Matt Birkholz [Fri, 12 Nov 2010 21:30:57 +0000 (14:30 -0700)]
Fix example code in "Type and range checking".

13 years agoCreate lib/lib symlinks in microcode/configure.
Matt Birkholz [Fri, 12 Nov 2010 21:18:15 +0000 (14:18 -0700)]
Create lib/lib symlinks in microcode/configure.

* src/Setup.sh, src/microcode/configure.ac: Create the src/lib/lib/
symlinks in microcode/configure, which has the list of enabled
modules.

13 years agoFixed src/README.txt. Portable C Installation instructions.
Matt Birkholz [Fri, 12 Nov 2010 21:16:11 +0000 (14:16 -0700)]
Fixed src/README.txt.  Portable C Installation instructions.

* doc/user-manual/user.texinfo: Added node "Portable C Installation".
Added "Type and range checking" describing the no-type-checks and
no-range-checks declarations.

* src/README.txt: Added a preface for the newbie that runs across this
file in a binary distribution.  Removed "CVS".  Added "portable C
distribution" and "MIT_SCHEME_EXE".  Removed mention of "bin/" in
binary distributions, and "SCHEME_LARGE" and "SCHEME_COMPILER"
variables in build scripts; these are no longer used.  Replaced
"system" with "program" or "build tree" or whatnot, reserving "system"
for the thing that runs the "operating system".  Punted sections
"Building from source... ```The Hard Way''" and "... Tabula Rasa''",
which were mostly about re-compiling / re-linking the microcode.  The
solution to such problems is now automated by the compile-microcode
step in the Unix installation instructions.

14 years agoMake BSD feraiseexcept actually raise the exception.
Taylor R Campbell [Tue, 2 Nov 2010 01:42:15 +0000 (01:42 +0000)]
Make BSD feraiseexcept actually raise the exception.

Forcing a floating-point operation by storing the (double) sum of
two volatile variables in a volatile variable is pretty kludgey,
but it works.

14 years agoReplace FPE_RESET_TRAPS by generic clear_float_exceptions.
Taylor R Campbell [Tue, 2 Nov 2010 01:41:18 +0000 (01:41 +0000)]
Replace FPE_RESET_TRAPS by generic clear_float_exceptions.

14 years agoMore fixes to floenv.h.
Taylor R Campbell [Mon, 1 Nov 2010 06:56:06 +0000 (06:56 +0000)]
More fixes to floenv.h.

14 years agoVarious fixes to floenv.h's emulation of fenv.h in terms of ieeefp.h.
Taylor R Campbell [Mon, 1 Nov 2010 06:34:36 +0000 (06:34 +0000)]
Various fixes to floenv.h's emulation of fenv.h in terms of ieeefp.h.

Still kinda broken.  More to come.

14 years agoFix name of UPDATE-FLOAT-ENVIRONMENT primitive's C procedure.
Taylor R Campbell [Mon, 1 Nov 2010 06:33:58 +0000 (06:33 +0000)]
Fix name of UPDATE-FLOAT-ENVIRONMENT primitive's C procedure.

14 years agoCheck more carefully for fenv_t and fexcept_t.
Taylor R Campbell [Mon, 1 Nov 2010 06:33:38 +0000 (06:33 +0000)]
Check more carefully for fenv_t and fexcept_t.

14 years agoCheck for the C99 fenv operations in microcode/configure.
Taylor R Campbell [Mon, 1 Nov 2010 05:18:42 +0000 (05:18 +0000)]
Check for the C99 fenv operations in microcode/configure.

14 years agoFix typo.
Taylor R Campbell [Mon, 1 Nov 2010 05:10:56 +0000 (05:10 +0000)]
Fix typo.

14 years agoCheck for fenv_t and fexcept_t in microcode/configure.
Taylor R Campbell [Mon, 1 Nov 2010 05:03:59 +0000 (05:03 +0000)]
Check for fenv_t and fexcept_t in microcode/configure.

14 years agoImplement support for a floating-point environment.
Taylor R Campbell [Mon, 1 Nov 2010 04:37:31 +0000 (04:37 +0000)]
Implement support for a floating-point environment.

14 years agoAdded c-cast, struct member peeks, param syntax checking.
Matt Birkholz [Sun, 31 Oct 2010 00:05:05 +0000 (17:05 -0700)]
Added c-cast, struct member peeks, param syntax checking.

* src/ffi/cdecls.scm (valid-param): Check that the param name does not
contain `-', nor any other non-C identifier chars.  These names go
into the generated .c files.

* src/ffi/syntax.scm (expand-peek): Allow peeks at struct members to
create or set an alien, just as peeking an array member does already.

* src/ffi/ffi.scm (c-cast): New.  Basically set-%alien/ctype! with a
convenient return value.

(alien/address, copy-alien-address!, alien-null?, alien-null!, alien=?):
Declare these as integrable operators, not via define-integrable.
Their arguments are referenced multiple times.

* src/runtime/runtime.pkg (runtime ffi): Export c-cast to ().

14 years agoMinor robustness improvement to microcode/makegen/makeinit.sh.
Taylor R Campbell [Fri, 29 Oct 2010 06:01:08 +0000 (06:01 +0000)]
Minor robustness improvement to microcode/makegen/makeinit.sh.

Don't clean up on SIGQUIT.

Use the wretched ${@:+"${@}"} idiom for APPLY.

14 years agoConvert INTERRUPTABLE_EXTENT to use `do { ... } while (0)'.
Taylor R Campbell [Fri, 29 Oct 2010 05:57:41 +0000 (05:57 +0000)]
Convert INTERRUPTABLE_EXTENT to use `do { ... } while (0)'.

14 years agoOmit procedure arity check in HASH-TABLE/MODIFY!.
Taylor R Campbell [Sun, 24 Oct 2010 06:27:02 +0000 (06:27 +0000)]
Omit procedure arity check in HASH-TABLE/MODIFY!.

This causes problems in the cold load, and doesn't enhance the safety
of the relevant code.  It only marginally increases the debuggability
of the mistake it catches.

14 years agoMake #@n always read as a quotation of the nth hashed object.
Taylor R Campbell [Sun, 24 Oct 2010 06:16:33 +0000 (06:16 +0000)]
Make #@n always read as a quotation of the nth hashed object.

Previously, #@n sometimes read as the nth hashed object, and
sometimes read as a quotation of it.  The advantage of the old
behaviour is that non-scode objects could be mentioned inside
quotations with #@n.  Personally, most of the time I referred to
non-scode objects inside quotations with #@n was as '#@n to work
around the problems this fixes:

(lambda (x) x)
;Value 12: #[compound-procedure 12]

(#@12 0)
;The object #[compound-procedure 12], passed as an argument to make-combination, is not an operator expression.

(list 1 2 3)
;Value 18: (1 2 3)

(pp #@18)
;The object 1 is not applicable.

14 years agoKludge to fix pct-encoding of authority part of IMAP URLs in IMAIL.
Taylor R Campbell [Sun, 24 Oct 2010 01:21:02 +0000 (01:21 +0000)]
Kludge to fix pct-encoding of authority part of IMAP URLs in IMAIL.

14 years agoFix FLUID-LET of ACCESS.
Taylor R Campbell [Sun, 17 Oct 2010 20:33:23 +0000 (20:33 +0000)]
Fix FLUID-LET of ACCESS.

14 years agoAdd previously omitted SRFI 33 operation TEST-BIT-FIELD?.
Taylor R Campbell [Sun, 17 Oct 2010 20:32:28 +0000 (20:32 +0000)]
Add previously omitted SRFI 33 operation TEST-BIT-FIELD?.

14 years agoNew operations on the two's-complement representation of integers.
Taylor R Campbell [Sun, 17 Oct 2010 20:00:34 +0000 (20:00 +0000)]
New operations on the two's-complement representation of integers.

These include the SRFI 33 operations, as well as some other useful
operations.

Although these are implemented as primitives with native definitions
for bignums, the primitives are not yet open-coded for the fixnum
case.  Eventually they should be open-coded, so that you don't need
to make a choice between safe code using the integer operations and
fast code using FIX:AND, FIX:LSH, &c.  Some operations are easy to
open-code for the fixnum case, such as all the bitwise operations.
Others are not so easy, such as SHIFT-LEFT, and it would be better to
open-code common aggregate operations such as EXTRACT-BIT-FIELD for
the fixnum case.  In any case, at least we now have names for the
safe operations.

14 years agoBack out i386 rewriting rule to optimize OBJECT->FIXNUM operands.
Taylor R Campbell [Sun, 17 Oct 2010 02:01:19 +0000 (02:01 +0000)]
Back out i386 rewriting rule to optimize OBJECT->FIXNUM operands.

This causes conpar.scm, for example, to be miscompiled.

14 years agoNuke old Unix-specific I/O selection primitives.
Taylor R Campbell [Sun, 17 Oct 2010 01:43:56 +0000 (01:43 +0000)]
Nuke old Unix-specific I/O selection primitives.

These have been unused for a decade and broken for half that.

14 years agoSimplify and fix X-DISPLAY-PROCESS-EVENTS primitive.
Taylor R Campbell [Sat, 16 Oct 2010 06:13:43 +0000 (06:13 +0000)]
Simplify and fix X-DISPLAY-PROCESS-EVENTS primitive.

This primitive no longer supports options for blocking vs
non-blocking or selecting vs not selecting; these are now the
responsibility of the caller.

The cached event trick previously used the value of the
uninitialized variable `event', rather than the event that was
cached.  Now it correctly uses the event that was cached.

14 years agoFix and simplify recent change to xterm_dump_rectangle.
Taylor R Campbell [Fri, 15 Oct 2010 03:28:33 +0000 (03:28 +0000)]
Fix and simplify recent change to xterm_dump_rectangle.

14 years agoFinish fix in last change to entity unparsers.
Taylor R Campbell [Thu, 14 Oct 2010 05:32:03 +0000 (05:32 +0000)]
Finish fix in last change to entity unparsers.

14 years agoFix bug in recent change to entity unparsers.
Taylor R Campbell [Thu, 14 Oct 2010 05:17:20 +0000 (05:17 +0000)]
Fix bug in recent change to entity unparsers.