Commit graph

135 commits

Author SHA1 Message Date
Gareth Rees
44b734b3a0 Separate the interactive and non-interactive loops for clarity.
New function "load" loads a file; call this in the non-interactive case.
Fix bug: close file handle after loading (if no error).

Copied from Perforce
 Change: 180299
 ServerID: perforce.ravenbrook.com
2012-11-03 15:49:59 +00:00
Gareth Rees
2ee1746ea8 Integrate quasiquote improvements from scheme.c.
Copied from Perforce
 Change: 180297
 ServerID: perforce.ravenbrook.com
2012-11-02 22:45:41 +00:00
Gareth Rees
0130b9fe05 Integrate quasiquote improvements.
Copied from Perforce
 Change: 180296
 ServerID: perforce.ravenbrook.com
2012-11-02 22:39:26 +00:00
Gareth Rees
fef5178a3a Improve quasiquote implementation.
Copied from Perforce
 Change: 180295
 ServerID: perforce.ravenbrook.com
2012-11-02 22:38:05 +00:00
Gareth Rees
7f34f0e8cb Implement the global symbol table as a weak-value hash table from strings to symbols.
Copied from Perforce
 Change: 180294
 ServerID: perforce.ravenbrook.com
2012-11-02 21:23:12 +00:00
Gareth Rees
d18dd95c1f Integrate error implementation from scheme-malloc.c.
Copied from Perforce
 Change: 180293
 ServerID: perforce.ravenbrook.com
2012-11-02 19:12:58 +00:00
Gareth Rees
99d142ffd6 Implement "error".
Copied from Perforce
 Change: 180292
 ServerID: perforce.ravenbrook.com
2012-11-02 19:07:55 +00:00
Gareth Rees
ae557d16c9 New test case for weak hash tables (doesn't pass yet).
Copied from Perforce
 Change: 180291
 ServerID: perforce.ravenbrook.com
2012-11-02 17:35:39 +00:00
Gareth Rees
f05835b3ae Refactor test code now that we can load it.
Copied from Perforce
 Change: 180290
 ServerID: perforce.ravenbrook.com
2012-11-02 17:35:05 +00:00
Gareth Rees
3633d3b64a Merge scheme.c changes (load, eqv) into scheme-advanced.c.
Improve weak hash table interface.
Fix a couple of bugs in handling of dependent objects.

Copied from Perforce
 Change: 180289
 ServerID: perforce.ravenbrook.com
2012-11-02 17:34:49 +00:00
Gareth Rees
186cafaa5c Integrate load from scheme-malloc.c.
Copied from Perforce
 Change: 180288
 ServerID: perforce.ravenbrook.com
2012-11-02 16:40:22 +00:00
Gareth Rees
5225f07f06 Implement load.
Copied from Perforce
 Change: 180287
 ServerID: perforce.ravenbrook.com
2012-11-02 16:38:44 +00:00
Gareth Rees
7bca0dfad5 Integrate eq-hash and eqv-hash from scheme-malloc.c.
Copied from Perforce
 Change: 180285
 ServerID: perforce.ravenbrook.com
2012-11-02 16:04:06 +00:00
Gareth Rees
3dcc9800ad Support more kinds of hashtable via make-hashtable.
Fix bug in eqv (character objects now test equal if they represent the same character).

Copied from Perforce
 Change: 180284
 ServerID: perforce.ravenbrook.com
2012-11-02 16:02:05 +00:00
Gareth Rees
dabc0e0ecf Integrate string=?, make-eqv-hashtable, and make-hashtable.
Copied from Perforce
 Change: 180283
 ServerID: perforce.ravenbrook.com
2012-11-02 15:54:41 +00:00
Gareth Rees
1b5fffe0dc Integrate string=?, make-eqv-hashtable, make-hashtable from scheme-malloc.c.
Copied from Perforce
 Change: 180282
 ServerID: perforce.ravenbrook.com
2012-11-02 15:43:07 +00:00
Gareth Rees
700291e07c New constructor make_bool avoids boilerplate.
Hash function takes a length so that it (1) it can support strings containing NULs; (2) it doesn't have to check for NULs so runs a bit faster; and (3) it performs OK on addresses (which often contain zero bytes).
Hash tables have hash and comparison functions.
Implement string=?, make-eqv-hashtable and make-hashtable.

Copied from Perforce
 Change: 180281
 ServerID: perforce.ravenbrook.com
2012-11-02 15:39:19 +00:00
Gareth Rees
c0b04cd3ff Fix the dependent object.
Copied from Perforce
 Change: 180279
 ServerID: perforce.ravenbrook.com
2012-11-02 14:25:09 +00:00
Gareth Rees
6a14ac6631 New test case for leaf objects.
Copied from Perforce
 Change: 180276
 ServerID: perforce.ravenbrook.com
2012-11-02 13:40:20 +00:00
Gareth Rees
8c84469650 Merge change from scheme.c (implementation apply).
Share generation chain between pools.
No need for leaf_fmt at the moment.

Copied from Perforce
 Change: 180275
 ServerID: perforce.ravenbrook.com
2012-11-02 13:40:08 +00:00
Gareth Rees
aaf7920007 Integrate apply from scheme-malloc.c.
Copied from Perforce
 Change: 180270
 ServerID: perforce.ravenbrook.com
2012-11-02 12:45:22 +00:00
Gareth Rees
a33c71a346 Implement apply.
Copied from Perforce
 Change: 180269
 ServerID: perforce.ravenbrook.com
2012-11-02 12:44:20 +00:00
Gareth Rees
468a79a99c Integrate references to documentation.
Copied from Perforce
 Change: 180258
 ServerID: perforce.ravenbrook.com
2012-11-02 11:58:38 +00:00
Gareth Rees
045c45a18c Add references to documentation.
Copied from Perforce
 Change: 180256
 ServerID: perforce.ravenbrook.com
2012-11-02 11:57:16 +00:00
Gareth Rees
2fb8140c68 Merge changes from scheme.c into scheme-advanced.c:
1. Deletion of keys in hash tables.
2. Forwarding of character objects on 64-bit platforms.
3. Fix to hash table probe sequence.
4. Comments in Scheme source.
5. Fix to define (implicit begin).
6. Extend equal? to vectors and strings.
7. Add references to R4RS documentation.
8. Implement list-tail, list-ref, open-output-file, close-input-port, close-output-port, write, write-string, newline, hashtable?, hashtable-size, hashtable-delete!, hashtable-contains?, hashtable-keys.
9. Fix bug (buckets might be scanned before dependent object is set).
10. Non-interactive mode.

Copied from Perforce
 Change: 180255
 ServerID: perforce.ravenbrook.com
2012-11-02 11:50:33 +00:00
Gareth Rees
0d17ceb416 Integrate changes from scheme-malloc to scheme.
Add test target to Makefile.

Copied from Perforce
 Change: 180253
 ServerID: perforce.ravenbrook.com
2012-11-02 11:19:45 +00:00
Gareth Rees
e42bab4f76 Make sure that probe sequence visits all buckets in the hash table by (a) ensuring that hash tables are a power of 2 in size; (b) ensuring that the probe step is odd.
Copied from Perforce
 Change: 180252
 ServerID: perforce.ravenbrook.com
2012-11-02 11:16:10 +00:00
Gareth Rees
bf1480c169 Chatter only if interactive.
Copied from Perforce
 Change: 180251
 ServerID: perforce.ravenbrook.com
2012-11-02 10:58:29 +00:00
Gareth Rees
879231be2d Add non-interactive execution.
Implement list-tail and list-ref.

Copied from Perforce
 Change: 180249
 ServerID: perforce.ravenbrook.com
2012-11-02 10:24:39 +00:00
Gareth Rees
b68fc45c4a Implement string-hash and correct error messages.
Copied from Perforce
 Change: 180244
 ServerID: perforce.ravenbrook.com
2012-11-01 22:07:33 +00:00
Gareth Rees
d3d7372e88 Merge changes from scheme-malloc.c to scheme.c.
Copied from Perforce
 Change: 180242
 ServerID: perforce.ravenbrook.com
2012-11-01 19:16:34 +00:00
Gareth Rees
57859a8d1a Segregate leaf objects into an amcz pool.
Copied from Perforce
 Change: 180240
 ServerID: perforce.ravenbrook.com
2012-11-01 18:14:41 +00:00
Gareth Rees
5b50c401c3 Fix bug in "define": no implied "begin" around function body.
Implement open-output-file, close-input-port, close-output-port, write, write-string, and newline.
Add Scheme test cases.

Copied from Perforce
 Change: 180238
 ServerID: perforce.ravenbrook.com
2012-11-01 18:05:34 +00:00
Gareth Rees
f9acc18caa Merge new hashtable stuff from scheme-malloc.c.
Fix bug in scheme.c (characters were only 8 bytes on 64-bit platforms, so can't be forwarded).

Copied from Perforce
 Change: 180231
 ServerID: perforce.ravenbrook.com
2012-11-01 15:37:43 +00:00
Gareth Rees
5e275103ed Add more hashtable features, including deletion (which we'll need for weak hashtables).
Copied from Perforce
 Change: 180225
 ServerID: perforce.ravenbrook.com
2012-11-01 14:37:45 +00:00
Gareth Rees
a8d8e95934 Try segregating leaf objects.
Copied from Perforce
 Change: 180209
 ServerID: perforce.ravenbrook.com
2012-10-31 22:52:39 +00:00
Gareth Rees
13af2f01a4 Weak hash tables in scheme-advanced.c.
Copied from Perforce
 Change: 180208
 ServerID: perforce.ravenbrook.com
2012-10-31 22:13:46 +00:00
Gareth Rees
760d198ea9 Branch scheme.c to scheme-advanced.c.
Copied from Perforce
 Change: 180204
 ServerID: perforce.ravenbrook.com
2012-10-31 19:10:58 +00:00
Gareth Rees
5e62407261 Move old scheme to example/scheme/scheme-malloc.c
Provide instructions to build it.

Copied from Perforce
 Change: 180185
 ServerID: perforce.ravenbrook.com
2012-10-31 12:02:11 +00:00
Gareth Rees
d894dd466a Improve the scheme example hashtable implementation:
1. Follow R6RS for naming of functions and arguments.
2. Grow the hashtable when half full.

Copied from Perforce
 Change: 180184
 ServerID: perforce.ravenbrook.com
2012-10-31 11:54:25 +00:00
Gareth Rees
6f01e17f9f Put explanations of the location dependency code into scheme.c. also, add lots of cross-references to the manual.
Copied from Perforce
 Change: 180121
 ServerID: perforce.ravenbrook.com
2012-10-28 19:13:56 +00:00
Gareth Rees
d4e3e73d9f Simplify scheme hash table implementation by folding the hash into buckets_find.
Copied from Perforce
 Change: 180086
 ServerID: perforce.ravenbrook.com
2012-10-25 21:18:40 +01:00
Gareth Rees
300a183b5b Write location chapter.
Copied from Perforce
 Change: 180080
 ServerID: perforce.ravenbrook.com
2012-10-25 17:58:49 +01:00
Gareth Rees
2a5e529ba4 Simple address-based (eq?) hash table implementation without location dependency.
Copied from Perforce
 Change: 180079
 ServerID: perforce.ravenbrook.com
2012-10-25 16:03:35 +01:00
Gareth Rees
591065565e (gc) takes no arguments, so check this.
Copied from Perforce
 Change: 180075
 ServerID: perforce.ravenbrook.com
2012-10-25 14:03:07 +01:00
Gareth Rees
c7b7b017a3 Be clear about the need to reserve lots of address space in a virtual memory arena.
Copied from Perforce
 Change: 180071
 ServerID: perforce.ravenbrook.com
2012-10-25 11:34:45 +01:00
Gareth Rees
031f75382d Complete actions from meeting with rb.
Copied from Perforce
 Change: 180056
 ServerID: perforce.ravenbrook.com
2012-10-24 16:25:19 +01:00
Gareth Rees
962a4c8934 R4rs is the "one true scheme" according to rb, so refer to that.
Copied from Perforce
 Change: 180033
 ServerID: perforce.ravenbrook.com
2012-10-23 17:35:51 +01:00
Gareth Rees
fe9212db5f Give correct reference for open-input-file (it's in the standard library, not the language).
Remove string-set! (was removed in R6RS).

Copied from Perforce
 Change: 180019
 ServerID: perforce.ravenbrook.com
2012-10-22 23:09:37 +01:00
Gareth Rees
05a8eced97 Enable finalization messages.
Rename entry_open_in to entry_open_input for consistency.
Add comments with specification from R6RS.

Copied from Perforce
 Change: 180008
 ServerID: perforce.ravenbrook.com
2012-10-22 15:54:20 +01:00
Gareth Rees
c3a91c815c Fix bug in append when the first argument is nil.
Copied from Perforce
 Change: 180004
 ServerID: perforce.ravenbrook.com
2012-10-22 12:54:35 +01:00
Gareth Rees
8dcd6ddb97 Implement procedure?, char?, char->integer, integer->char, string->list, and list->string.
Copied from Perforce
 Change: 179991
 ServerID: perforce.ravenbrook.com
2012-10-21 20:38:27 +01:00
Gareth Rees
1be5d945f2 Implement some string procedures: string?, make-string, string, string-length, string-ref, string-set!, substring, string-append, string-copy.
Copied from Perforce
 Change: 179990
 ServerID: perforce.ravenbrook.com
2012-10-21 19:59:47 +01:00
Gareth Rees
f859353280 Propagate changes from scheme-after.c to scheme.c; the former is no longer needed.
Convert license.txt and built.txt to reStructuredText and include them directly in the manual.

Copied from Perforce
 Change: 179957
 ServerID: perforce.ravenbrook.com
2012-10-19 11:26:25 +01:00
Gareth Rees
ab2c28cae4 Make sure that errors can be reported during initialization.
Fix cross-reference (now "start", not "main").

Copied from Perforce
 Change: 179902
 ServerID: perforce.ravenbrook.com
2012-10-16 16:22:45 +01:00
Gareth Rees
572b6624ae Fix url.
Copied from Perforce
 Change: 179896
 ServerID: perforce.ravenbrook.com
2012-10-16 12:17:19 +01:00
Richard Brooksby
861863389a Improving the start-up message on the scheme example as suggested by gdr.
Copied from Perforce
 Change: 179576
 ServerID: perforce.ravenbrook.com
2012-09-20 08:56:00 +01:00
Richard Brooksby
e819bf596f Implemented tail recursion.
Copied from Perforce
 Change: 179572
 ServerID: perforce.ravenbrook.com
2012-09-19 23:02:51 +01:00
Richard Brooksby
1b3c817ac8 Generating the scheme example makefile using autoconf, so that it gets the right flags for the platform.
Copied from Perforce
 Change: 179569
 ServerID: perforce.ravenbrook.com
2012-09-19 21:45:32 +01:00
Nick Barnes
cd4ece9201 Added > and < operators so i could write (define (tak a b c) ...) and other things.
Copied from Perforce
 Change: 179469
 ServerID: perforce.ravenbrook.com
2012-09-13 13:45:21 +01:00
Richard Brooksby
72def5850d Adding finalization to ports to show how it's done.
Printing statistics at the end of a collection.
Adding a Scheme function to force a full GC.
Adding the global syntax symbols as roots.  Oops!

Copied from Perforce
 Change: 179447
 ServerID: perforce.ravenbrook.com
2012-09-12 19:07:36 +01:00
Richard Brooksby
d39f090ba8 Integrating deletions from branch/2012-09-10/scheme-example. oops.
Copied from Perforce
 Change: 179430
 ServerID: perforce.ravenbrook.com
2012-09-11 16:44:39 +01:00
Richard Brooksby
5d4afc7f51 Integrating branch/2012-09-10/scheme-example
Copied from Perforce
 Change: 179429
 ServerID: perforce.ravenbrook.com
2012-09-11 16:41:33 +01:00
Richard Brooksby
3407e7354e Fixing another %%mps marker.
Copied from Perforce
 Change: 179422
 ServerID: perforce.ravenbrook.com
2012-09-11 15:08:00 +01:00
Richard Brooksby
6a0b934525 Making %%mps markers consistent and adding one to the symbol table.
Copied from Perforce
 Change: 179421
 ServerID: perforce.ravenbrook.com
2012-09-11 15:07:17 +01:00
Richard Brooksby
68a3760ce9 Adding a note about integration time.
Copied from Perforce
 Change: 179420
 ServerID: perforce.ravenbrook.com
2012-09-11 15:04:59 +01:00
Richard Brooksby
396d111709 Expunging the "hello world" example and replacing it with the scheme interpreter example where appropriate.
Copied from Perforce
 Change: 179419
 ServerID: perforce.ravenbrook.com
2012-09-11 14:52:27 +01:00
Richard Brooksby
4e39299392 Further improvements to documentation in the scheme example.
Copied from Perforce
 Change: 179418
 ServerID: perforce.ravenbrook.com
2012-09-11 14:51:45 +01:00
Richard Brooksby
cca2921f2d Converting old "@@@@" markers into todos as appropriate.
Removing FIXMEs that are already fixed.

Copied from Perforce
 Change: 179416
 ServerID: perforce.ravenbrook.com
2012-09-11 10:59:12 +01:00
Richard Brooksby
c856f16c96 Fixed line endings. they were classic mac (cr)!
Added MPS TO DO list.
Added printing of GC messages.
Further documentation improvements.

Copied from Perforce
 Change: 179415
 ServerID: perforce.ravenbrook.com
2012-09-11 10:54:29 +01:00
Richard Brooksby
fc79c1f1a4 Adding explanations of how the mps is used in the scheme example.
Copied from Perforce
 Change: 179412
 ServerID: perforce.ravenbrook.com
2012-09-11 10:23:52 +01:00
Richard Brooksby
c1288ace1d Integrated scheme interpreter with the mps.
Copied from Perforce
 Change: 179409
 ServerID: perforce.ravenbrook.com
2012-09-11 01:43:50 +01:00
Richard Brooksby
b1496378dc Updating title, copyright, and licence.
Copied from Perforce
 Change: 179408
 ServerID: perforce.ravenbrook.com
2012-09-10 23:25:58 +01:00
Richard Brooksby
470da18aaf Adding a simple scheme interpreter originally developed as a potential mps test harness.
Copied from Perforce
 Change: 179407
 ServerID: perforce.ravenbrook.com
2012-09-10 23:23:28 +01:00
Richard Kistruck
dd51a69296 Mps master: readme et al changes for version 1.108.2
Copied from Perforce
 Change: 164906
 ServerID: perforce.ravenbrook.com
2008-05-01 17:45:07 +01:00
Richard Kistruck
110b66a227 Mps master: version-name and release notes for release 1.108.1
Copied from Perforce
 Change: 163676
 ServerID: perforce.ravenbrook.com
2007-12-21 18:16:34 +00:00
Richard Kistruck
3e074da643 Mps master: version.c, w3build.bat, hello-world: for 1.108.0
Copied from Perforce
 Change: 162801
 ServerID: perforce.ravenbrook.com
2007-07-06 16:09:32 +01:00
Richard Kistruck
ac7eb998b9 mps integ -r -b mps/version/1.107/example/hello-world to master. except... i had to do this 'integ -r' by hand, because i erroneously already did an empty-integ in change 161219, so p4 rightly thinks it's done it already.
Copied from Perforce
 Change: 161249
 ServerID: perforce.ravenbrook.com
2006-12-15 15:57:56 +00:00
Richard Kistruck
a907035b66 Mps: example code: hello-world: line-wrap code, tweak success message.
Copied from Perforce
 Change: 158083
 ServerID: perforce.ravenbrook.com
2006-04-10 16:56:29 +01:00
Richard Kistruck
f1589b9d3b Mps: example code: rename 01hello as hello-world
Copied from Perforce
 Change: 158082
 ServerID: perforce.ravenbrook.com
2006-04-10 16:37:14 +01:00
Richard Kistruck
261bfb8351 Mps: example code: write index page.
Copied from Perforce
 Change: 158081
 ServerID: perforce.ravenbrook.com
2006-04-10 16:25:12 +01:00
Richard Kistruck
8efd5c0f21 Mps: example code: hello-world: word-wrap text to 72
Copied from Perforce
 Change: 158080
 ServerID: perforce.ravenbrook.com
2006-04-10 15:59:34 +01:00
Richard Kistruck
8216b9e47b Mps: example code: tidy up hello-world for release 1.106.2
Copied from Perforce
 Change: 158079
 ServerID: perforce.ravenbrook.com
2006-04-10 15:52:32 +01:00
Richard Kistruck
e3076562fa Mps: example code: 01hello.c
Copied from Perforce
 Change: 158078
 ServerID: perforce.ravenbrook.com
2006-04-10 15:01:46 +01:00
Richard Kistruck
85d47c7d3c Mps example code: create index page
Copied from Perforce
 Change: 158076
 ServerID: perforce.ravenbrook.com
2006-04-10 14:36:54 +01:00