mit-scheme.git
6 years agoMerge branch 'master' into pucked.
Matt Birkholz [Tue, 5 Jun 2018 06:20:56 +0000 (23:20 -0700)]
Merge branch 'master' into pucked.

6 years agogdbm: version 0.3.4 mit-scheme-pucked-gdbm-0.3.4
Matt Birkholz [Wed, 30 May 2018 15:48:39 +0000 (08:48 -0700)]
gdbm: version 0.3.4

6 years agogdbm: Accommodate gdbm 1.14.
Matt Birkholz [Wed, 30 May 2018 14:43:32 +0000 (07:43 -0700)]
gdbm: Accommodate gdbm 1.14.

Add const declarations.  Rename struct member gdbm_errno, which
conflicts with a new pre-processor macro.

Presume external locking is already in place where necessary.  Add
GDBM_NOLOCK to the gdbm_open flags in versions >= 1.13.  Gdbm 1.14 on
Ubuntu 18.04 fails to lock a DB file it just created (during `make
check`).

6 years agodevops: Capitalize error messages; end them with a colon or period.
Matt Birkholz [Mon, 28 May 2018 21:55:59 +0000 (14:55 -0700)]
devops: Capitalize error messages; end them with a colon or period.

6 years agouser.texinfo: A typo. And punt mention of gdbm microcode module.
Matt Birkholz [Mon, 28 May 2018 21:52:45 +0000 (14:52 -0700)]
user.texinfo: A typo.  And punt mention of gdbm microcode module.

6 years agoruntime/ffi: Do not dynamic-wind around callouts and callbacks.
Matt Birkholz [Wed, 30 May 2018 14:39:36 +0000 (07:39 -0700)]
runtime/ffi: Do not dynamic-wind around callouts and callbacks.

6 years agoRefactor promises again, to support delay-force.
Chris Hanson [Tue, 29 May 2018 06:53:16 +0000 (23:53 -0700)]
Refactor promises again, to support delay-force.

This no longer uses scode DELAY expressions, which can be deleted after 9.3 is
released.  It does continue to use DELAYED objects for type convenience.

6 years agoImplement make-promise for R7RS.
Chris Hanson [Tue, 29 May 2018 01:22:13 +0000 (18:22 -0700)]
Implement make-promise for R7RS.

Also clean up promise implementation a bit.

6 years agoFill in pseudo-keywords so that they can be imported from libraries.
Chris Hanson [Tue, 29 May 2018 00:55:24 +0000 (17:55 -0700)]
Fill in pseudo-keywords so that they can be imported from libraries.

6 years agoImplement call-with-port for R7RS.
Chris Hanson [Tue, 29 May 2018 00:35:07 +0000 (17:35 -0700)]
Implement call-with-port for R7RS.

6 years agoAdd definitions of standard libraries.
Chris Hanson [Mon, 28 May 2018 20:54:43 +0000 (13:54 -0700)]
Add definitions of standard libraries.

6 years agoFix thinko: forgot to provide definition of file-error?.
Chris Hanson [Mon, 28 May 2018 20:54:17 +0000 (13:54 -0700)]
Fix thinko: forgot to provide definition of file-error?.

6 years agoImplement target-metadata declaration.
Chris Hanson [Mon, 28 May 2018 05:05:33 +0000 (22:05 -0700)]
Implement target-metadata declaration.

This declaration has a body that's an alist keyed by symbols.  The information
in the declaration is carried through the compiler and attached to the compiled
code in the wrapper comment.

The short-term purpose of this declaration is to attach R7RS library information
to compiled code.  But it's general enough for other uses too.

6 years agoImplement vector-any and vector-every.
Chris Hanson [Mon, 28 May 2018 02:47:13 +0000 (19:47 -0700)]
Implement vector-any and vector-every.

6 years agoFix equal-hash to return the same value as eq-hash on non-pointers.
Chris Hanson [Thu, 24 May 2018 03:49:51 +0000 (20:49 -0700)]
Fix equal-hash to return the same value as eq-hash on non-pointers.

6 years agoUse the new hashing primitives to simplify standard hashes.
Chris Hanson [Wed, 23 May 2018 07:18:42 +0000 (00:18 -0700)]
Use the new hashing primitives to simplify standard hashes.

Also, the standard hashes now always return a fixnum.

6 years agoRewrite the hashing primitives to support runtime-level hashing.
Chris Hanson [Wed, 23 May 2018 07:17:55 +0000 (00:17 -0700)]
Rewrite the hashing primitives to support runtime-level hashing.

6 years agoFix thinko in hash-simple-object and add primitive-memory-hash.
Chris Hanson [Wed, 23 May 2018 05:17:51 +0000 (22:17 -0700)]
Fix thinko in hash-simple-object and add primitive-memory-hash.

6 years agoUse bytevector instead of string when detecting endianness.
Chris Hanson [Wed, 23 May 2018 05:03:15 +0000 (22:03 -0700)]
Use bytevector instead of string when detecting endianness.

6 years agoImplement hash-simple-object.
Chris Hanson [Tue, 22 May 2018 07:47:12 +0000 (00:47 -0700)]
Implement hash-simple-object.

This works for any object that can be viewed as a contiguous sequence of bytes
in memory, so includes strings, bytevectors, symbols, bignums, flonums, and
non-pointer objects.

This is not tested but also not yet used.

6 years agoMove knowledge of unicode strings into sdata.h and object.h.
Chris Hanson [Tue, 22 May 2018 07:46:51 +0000 (00:46 -0700)]
Move knowledge of unicode strings into sdata.h and object.h.

6 years agoActually implement a library and imports parser.
Chris Hanson [Mon, 21 May 2018 06:16:48 +0000 (23:16 -0700)]
Actually implement a library and imports parser.

This one isn't done as macros, since these "forms" are a specialized syntax that
is available only in constrained contexts.  This implementation handles both
cond-expand and include-library-declarations.

This isn't yet tested, so don't expect it to work.

6 years agoRefactor cond-expand to separate out the clauses evaluator.
Chris Hanson [Mon, 21 May 2018 05:42:00 +0000 (22:42 -0700)]
Refactor cond-expand to separate out the clauses evaluator.

Also change cond-expand to use new id!=? for else clause.

6 years agoImplement spar-arg:id!=? to handle useful case.
Chris Hanson [Mon, 21 May 2018 05:35:26 +0000 (22:35 -0700)]
Implement spar-arg:id!=? to handle useful case.

6 years agoChange symbol<? to sort interned symbols before uninterned.
Chris Hanson [Mon, 21 May 2018 00:27:50 +0000 (17:27 -0700)]
Change symbol<? to sort interned symbols before uninterned.

6 years agoClean up loader's handling of pathname and environment.
Chris Hanson [Sun, 20 May 2018 23:59:38 +0000 (16:59 -0700)]
Clean up loader's handling of pathname and environment.

6 years agoMove magit-diff-arguments from custom.el to init.el.
Chris Hanson [Sun, 20 May 2018 23:59:02 +0000 (16:59 -0700)]
Move magit-diff-arguments from custom.el to init.el.

6 years agoImplement interaction-environment for R7RS.
Chris Hanson [Sun, 20 May 2018 21:03:22 +0000 (14:03 -0700)]
Implement interaction-environment for R7RS.

6 years agoFix title.
Chris Hanson [Sun, 20 May 2018 21:03:13 +0000 (14:03 -0700)]
Fix title.

6 years agoImplement include and include-ci for R7RS.
Chris Hanson [Sun, 20 May 2018 05:30:49 +0000 (22:30 -0700)]
Implement include and include-ci for R7RS.

6 years agoREAD no longer uses its environment arg, so remove it.
Chris Hanson [Sun, 20 May 2018 05:21:07 +0000 (22:21 -0700)]
READ no longer uses its environment arg, so remove it.

6 years agoNon-functioning implementation of import and define-library.
Chris Hanson [Sun, 20 May 2018 01:05:44 +0000 (18:05 -0700)]
Non-functioning implementation of import and define-library.

6 years agoCapture useful pattern with spar-pattern-fixed-point.
Chris Hanson [Sun, 20 May 2018 00:47:08 +0000 (17:47 -0700)]
Capture useful pattern with spar-pattern-fixed-point.

6 years agoRewrite cond-expand-pattern as cond-expand-clause-pattern.
Chris Hanson [Sun, 20 May 2018 00:23:29 +0000 (17:23 -0700)]
Rewrite cond-expand-pattern as cond-expand-clause-pattern.

This will allow it to be reused for define-library.

6 years agoTweak pattern->spar to make it more useful.
Chris Hanson [Sun, 20 May 2018 00:23:03 +0000 (17:23 -0700)]
Tweak pattern->spar to make it more useful.

Also add (cons* ...) pattern.

6 years agoFix typo in DISPLAY.
Chris Hanson [Sat, 19 May 2018 22:06:29 +0000 (15:06 -0700)]
Fix typo in DISPLAY.

6 years agoImplement define-values for R7RS.
Chris Hanson [Sat, 19 May 2018 06:42:54 +0000 (23:42 -0700)]
Implement define-values for R7RS.

6 years agoSplit command-line processing out of load into its own file.
Chris Hanson [Sat, 19 May 2018 06:21:05 +0000 (23:21 -0700)]
Split command-line processing out of load into its own file.

Also implement command-line for R7RS, renaming existing command-line to
command-line-arguments.

6 years agoImplement exact-integer-sqrt for R7RS.
Chris Hanson [Sat, 19 May 2018 04:24:53 +0000 (21:24 -0700)]
Implement exact-integer-sqrt for R7RS.

6 years agoImplement CASE-LAMBDA for R7RS.
Chris Hanson [Thu, 17 May 2018 07:08:53 +0000 (00:08 -0700)]
Implement CASE-LAMBDA for R7RS.

6 years agoMake sure that value of r4rs-lambda-list-arity is simplified.
Chris Hanson [Thu, 17 May 2018 05:37:24 +0000 (22:37 -0700)]
Make sure that value of r4rs-lambda-list-arity is simplified.

6 years agoImplement fold-r4rs-lambda-list and r4rs-lambda-list-arity.
Chris Hanson [Thu, 17 May 2018 05:16:19 +0000 (22:16 -0700)]
Implement fold-r4rs-lambda-list and r4rs-lambda-list-arity.

6 years agoImplement GUARD for R7RS.
Chris Hanson [Wed, 16 May 2018 05:32:46 +0000 (22:32 -0700)]
Implement GUARD for R7RS.

6 years agoChange users of arity-dispatched-procedure to use the abstraction.
Chris Hanson [Tue, 15 May 2018 04:48:25 +0000 (21:48 -0700)]
Change users of arity-dispatched-procedure to use the abstraction.

6 years agoMove the arity-dispatcher-tag from the microcode to the runtime system.
Chris Hanson [Tue, 15 May 2018 04:36:22 +0000 (21:36 -0700)]
Move the arity-dispatcher-tag from the microcode to the runtime system.

6 years agoRewrite microcode-tables.scm for simplicity.
Chris Hanson [Tue, 15 May 2018 04:35:24 +0000 (21:35 -0700)]
Rewrite microcode-tables.scm for simplicity.

Also add a 'fixed-objects boot-actions list and change record.scm to use it.

6 years agoA few more fall-through comments.
Chris Hanson [Mon, 14 May 2018 19:31:25 +0000 (12:31 -0700)]
A few more fall-through comments.

6 years agoAdd comments to suppress fall-through warnings in GCC 7.
Chris Hanson [Mon, 14 May 2018 19:29:35 +0000 (12:29 -0700)]
Add comments to suppress fall-through warnings in GCC 7.

6 years agoApple doesn't need special definition for jiffies-per-second.
Chris Hanson [Mon, 14 May 2018 04:54:30 +0000 (21:54 -0700)]
Apple doesn't need special definition for jiffies-per-second.

6 years agoDon't use CLOCKS_PER_SEC for the value returned by times().
Chris Hanson [Mon, 14 May 2018 04:52:51 +0000 (21:52 -0700)]
Don't use CLOCKS_PER_SEC for the value returned by times().

6 years agoAdd missing procedure in host-adapter.
Chris Hanson [Mon, 14 May 2018 04:29:35 +0000 (21:29 -0700)]
Add missing procedure in host-adapter.

6 years agoImplement CURRENT-JIFFY and JIFFIES-PER-SECOND for R7RS.
Chris Hanson [Mon, 14 May 2018 04:20:23 +0000 (21:20 -0700)]
Implement CURRENT-JIFFY and JIFFIES-PER-SECOND for R7RS.

Very rough implementation, may return process time instead of real time on
non-POSIX systems.

6 years agoImplement CURRENT-SECOND for R7RS.
Chris Hanson [Mon, 14 May 2018 03:06:41 +0000 (20:06 -0700)]
Implement CURRENT-SECOND for R7RS.

6 years agoFix bug: earlier rewrite of printer broke pp.
Chris Hanson [Mon, 14 May 2018 03:02:16 +0000 (20:02 -0700)]
Fix bug: earlier rewrite of printer broke pp.

6 years agoImplement get-environment-variables for R7RS.
Chris Hanson [Mon, 14 May 2018 02:43:57 +0000 (19:43 -0700)]
Implement get-environment-variables for R7RS.

6 years agoMore R7RS tags.
Chris Hanson [Mon, 14 May 2018 02:43:42 +0000 (19:43 -0700)]
More R7RS tags.

6 years agoRename GET-SUPPORTED-FEATURES to FEATURES for R7RS.
Chris Hanson [Mon, 14 May 2018 00:15:59 +0000 (17:15 -0700)]
Rename GET-SUPPORTED-FEATURES to FEATURES for R7RS.

Also add some more R7RS comments to runtime.pkg.

6 years agoA bunch of changes to implement R7RS exit/emergency-exit.
Chris Hanson [Mon, 14 May 2018 00:13:21 +0000 (17:13 -0700)]
A bunch of changes to implement R7RS exit/emergency-exit.

* The EXIT procedure has been removed.
* The %EXIT procedure has been renamed to EXIT.
* The EMERGENCY-EXIT procedure has been added.
* The optional argument to the above has been generalized to meet R7RS
  requirements.
* The QUIT procedure has been renamed to SUSPEND to more accurately reflect what
  it does.
* The names %EXIT and QUIT are deprecated aliases for EXIT and SUSPEND.

6 years agoDon't expose internal structure of continuations.
Chris Hanson [Sun, 13 May 2018 23:05:37 +0000 (16:05 -0700)]
Don't expose internal structure of continuations.

6 years agoEliminate two unused exports.
Chris Hanson [Sun, 13 May 2018 06:22:28 +0000 (23:22 -0700)]
Eliminate two unused exports.

6 years agoEliminate uses of unparser/set-tagged-{pair,vector}-unparser!.
Chris Hanson [Sun, 13 May 2018 06:19:18 +0000 (23:19 -0700)]
Eliminate uses of unparser/set-tagged-{pair,vector}-unparser!.

Also change their implementation to use define-print-method.

6 years agoRename a bunch of places from "unparse" to "print".
Chris Hanson [Sun, 13 May 2018 06:18:05 +0000 (23:18 -0700)]
Rename a bunch of places from "unparse" to "print".

6 years agoEliminate other references to "unparser" in the documentation.
Chris Hanson [Sun, 13 May 2018 06:15:36 +0000 (23:15 -0700)]
Eliminate other references to "unparser" in the documentation.

6 years agoSimplify *print-with-brackets a bit.
Chris Hanson [Sun, 13 May 2018 05:33:03 +0000 (22:33 -0700)]
Simplify *print-with-brackets a bit.

6 years agoAssume that named vector/list unparsers are in fact print methods.
Chris Hanson [Sun, 13 May 2018 05:32:36 +0000 (22:32 -0700)]
Assume that named vector/list unparsers are in fact print methods.

6 years agoClean up printer bindings.
Chris Hanson [Sun, 13 May 2018 05:30:48 +0000 (22:30 -0700)]
Clean up printer bindings.

6 years agoChange "unparser" to "printer" in number printer.
Chris Hanson [Sun, 13 May 2018 05:30:12 +0000 (22:30 -0700)]
Change "unparser" to "printer" in number printer.

6 years agoUpdate document to reflect new print-method implementation.
Chris Hanson [Sun, 13 May 2018 04:36:32 +0000 (21:36 -0700)]
Update document to reflect new print-method implementation.

6 years agoMajor refactor to how printer methods work.
Chris Hanson [Sun, 13 May 2018 04:23:21 +0000 (21:23 -0700)]
Major refactor to how printer methods work.

* Replaced define-unparser-method with define-print-method.  A print method is
  an ordinary procedure that accepts an object and an output port as its
  arguments and prints whatever it wants to.  The translation layer required by
  older unparser methods is no longer needed.

* New standard-print-method is roughly equivalent to simple-unparser-method.

* New bracketed-print-method is roughly equivalent to standard-unparser-method.

* Changed the printer to handle standard-print-method specially when detecting
  cycles and shared structure, so that an object using that print method has its
  parts walked when looking for shared/cyclic structure.

6 years agoImplement R7RS write procedures with datum labels.
Chris Hanson [Sat, 12 May 2018 06:20:31 +0000 (23:20 -0700)]
Implement R7RS write procedures with datum labels.

For now, write and write-shared do the same thing.  Limiting the labeling to
circularities is harder than doing all sharing, and unless I can find some new
algorithms, it is slower too.  So write will generate more datum labels than
strictly necessary, but it is safe for printing circular structures.

6 years agoRemove unneeded environment arguments from various printers.
Chris Hanson [Sat, 12 May 2018 06:20:14 +0000 (23:20 -0700)]
Remove unneeded environment arguments from various printers.

6 years agoEliminate optional environment arg to write/display/etc.
Chris Hanson [Sat, 12 May 2018 04:11:25 +0000 (21:11 -0700)]
Eliminate optional environment arg to write/display/etc.

Also eliminate output-port/write-object and make-unparser-state.

6 years agoBig refactor: rename parser/unparser to reader/printer.
Chris Hanson [Thu, 10 May 2018 06:08:35 +0000 (23:08 -0700)]
Big refactor: rename parser/unparser to reader/printer.

Updated all references and left a couple of renames in place for documented
functionality.

6 years agoImplement console-error-port and initialize current-error-port to it.
Chris Hanson [Wed, 9 May 2018 05:03:23 +0000 (22:03 -0700)]
Implement console-error-port and initialize current-error-port to it.

6 years agoImplement current-error-port.
Chris Hanson [Wed, 9 May 2018 04:59:47 +0000 (21:59 -0700)]
Implement current-error-port.

6 years agoImplement tty-error-channel and export to console I/O.
Chris Hanson [Wed, 9 May 2018 04:58:35 +0000 (21:58 -0700)]
Implement tty-error-channel and export to console I/O.

6 years agoImplement replace-binary-port! on generic I/O ports.
Chris Hanson [Wed, 9 May 2018 04:56:42 +0000 (21:56 -0700)]
Implement replace-binary-port! on generic I/O ports.

6 years agoProvide access to the channels in a binary port.
Chris Hanson [Wed, 9 May 2018 04:54:21 +0000 (21:54 -0700)]
Provide access to the channels in a binary port.

6 years agoSimplify console port exports.
Chris Hanson [Wed, 9 May 2018 04:50:15 +0000 (21:50 -0700)]
Simplify console port exports.

* Eliminate console-input-port, console-output-port, and set-console-i/o-port!.
* Change console-i/o-port to be a thunk that returns the port.

6 years agoImplement support for stderr.
Chris Hanson [Wed, 9 May 2018 04:45:21 +0000 (21:45 -0700)]
Implement support for stderr.

6 years agoImplement R7RS exceptions.
Chris Hanson [Tue, 8 May 2018 05:08:19 +0000 (22:08 -0700)]
Implement R7RS exceptions.

6 years agoFix typo in previous change.
Chris Hanson [Tue, 8 May 2018 05:08:01 +0000 (22:08 -0700)]
Fix typo in previous change.

6 years agoFix bug: error:file-operation couldn't work properly.
Chris Hanson [Mon, 7 May 2018 07:00:24 +0000 (00:00 -0700)]
Fix bug: error:file-operation couldn't work properly.

This is because substitutable-value-condition-signaller was mis-designed.  It
added retries *after* building the condition, so they weren't in the condition
and would never be shown.

I rewrote error:file-operation based on the model in microcode-errors.scm which
was apparently a workaround for the fact that error:file-operation didn't work.

This entailed a small but incompatible change to the procedure's arguments.

6 years agoAdd support for parsing nan.0, +inf.0, and -inf.0.
Chris Hanson [Thu, 3 May 2018 06:15:02 +0000 (23:15 -0700)]
Add support for parsing nan.0, +inf.0, and -inf.0.

Not sure if nan.0 is meaningful, but it shouldn't do any harm.

6 years agoUpdate to reflect changes in runtime system.
Chris Hanson [Thu, 3 May 2018 06:08:03 +0000 (23:08 -0700)]
Update to reflect changes in runtime system.

6 years agoAdd procedures to generate infinities and a nan.
Chris Hanson [Thu, 3 May 2018 06:07:46 +0000 (23:07 -0700)]
Add procedures to generate infinities and a nan.

6 years agoDon't constant-fold an application if it generates an error.
Chris Hanson [Thu, 3 May 2018 05:52:12 +0000 (22:52 -0700)]
Don't constant-fold an application if it generates an error.

Also fix overlong lines and pages in object.scm.

6 years agoImplement finite?, infinite?, and nan? from R7RS.
Chris Hanson [Wed, 2 May 2018 06:45:02 +0000 (23:45 -0700)]
Implement finite?, infinite?, and nan? from R7RS.

6 years agoFix typo in previous edit.
Chris Hanson [Wed, 2 May 2018 06:42:45 +0000 (23:42 -0700)]
Fix typo in previous edit.

6 years agoChange rational? to be false for inf/nan.
Chris Hanson [Wed, 2 May 2018 06:36:10 +0000 (23:36 -0700)]
Change rational? to be false for inf/nan.

6 years agoChange printed representation of inf/nan to match R7RS.
Chris Hanson [Wed, 2 May 2018 06:35:32 +0000 (23:35 -0700)]
Change printed representation of inf/nan to match R7RS.

6 years agoAdd support for C99 floating-point predicates.
Chris Hanson [Wed, 2 May 2018 06:27:57 +0000 (23:27 -0700)]
Add support for C99 floating-point predicates.

Also expose those predicates in Scheme, and implement flo:eqv? properly.

6 years agoUpdate documentation of booleans.
Chris Hanson [Tue, 1 May 2018 06:52:22 +0000 (23:52 -0700)]
Update documentation of booleans.

6 years agoGeneralize boolean=? to support multiple arguments.
Chris Hanson [Tue, 1 May 2018 06:48:06 +0000 (23:48 -0700)]
Generalize boolean=? to support multiple arguments.

6 years agoTweak char and string chapters to be closer to R7RS.
Chris Hanson [Tue, 1 May 2018 06:26:24 +0000 (23:26 -0700)]
Tweak char and string chapters to be closer to R7RS.

6 years agoEliminate bundle types; original design using predicates is better.
Chris Hanson [Mon, 30 Apr 2018 18:59:57 +0000 (11:59 -0700)]
Eliminate bundle types; original design using predicates is better.

6 years agoConvert object hasher to be a bundle.
Chris Hanson [Mon, 30 Apr 2018 18:14:36 +0000 (11:14 -0700)]
Convert object hasher to be a bundle.

6 years agoFix thinko as reported by Patric Jonsson.
Chris Hanson [Mon, 30 Apr 2018 17:55:24 +0000 (10:55 -0700)]
Fix thinko as reported by Patric Jonsson.

Incorrectly computed length of result in exact-nonnegative-integer->bytevector.

6 years agoConvert metadata tables to be bundles.
Chris Hanson [Sun, 29 Apr 2018 22:57:51 +0000 (15:57 -0700)]
Convert metadata tables to be bundles.

6 years agoInitialize applicable records much earlier in the cold load.
Chris Hanson [Sun, 29 Apr 2018 22:50:11 +0000 (15:50 -0700)]
Initialize applicable records much earlier in the cold load.