Skip to content

Commit e858b40

Browse files
RobertLauferElektrobittcormackMWToby Cormack
authored
Update Tiny Scheme to 1.42 (CppMicroServices#1056) (CppMicroServices#1124)
* update tiny scheme version * reapply patches * update endif * format --------- Co-authored-by: tcormackMW <113473781+tcormackMW@users.noreply.github.com> Co-authored-by: Toby Cormack <tcormack@vdi-ah2ddp-086.dhcp.mathworks.com>
1 parent b4d6b12 commit e858b40

14 files changed

Lines changed: 511 additions & 44 deletions

File tree

third_party/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ tinyscheme
5858
BSD-style license
5959

6060
http://tinyscheme.sourceforge.net/home.html
61-
1.41
61+
1.42
6262

6363
Patches
6464

third_party/tinyscheme/BUILDING

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ general compiles out of the box.
5757

5858
USE_PLIST
5959
Enables property lists (not Standard Scheme stuff). Off by default.
60-
60+
6161
USE_NO_FEATURES
6262
Shortcut to disable USE_MATH, USE_CHAR_CLASSIFIERS, USE_ASCII_NAMES,
6363
USE_STRING_PORTS, USE_ERROR_HOOK, USE_TRACING, USE_COLON_HOOK,
6464
USE_DL.
6565

6666
USE_SCHEME_STACK
67-
Enables 'cons' stack (the alternative is a faster calling scheme, which
67+
Enables 'cons' stack (the alternative is a faster calling scheme, which
6868
breaks continuations). Undefine it if you don't care about strict compatibility
6969
but you do care about faster execution.
7070

@@ -85,7 +85,7 @@ tinyscheme-1.32-new/dynload.c
8585
24c24
8686
< #define SUN_DL
8787
---
88-
>
88+
>
8989
Only in tinyscheme-1.32-new/: dynload.o
9090
Only in tinyscheme-1.32-new/: libtinyscheme.a Only in tinyscheme-1.32-new/: libtinyscheme.so diff -r tinyscheme-1.32/makefile tinyscheme-1.32-new/makefile
9191
33,34c33,43
@@ -97,7 +97,7 @@ Only in tinyscheme-1.32-new/: libtinyscheme.a Only in tinyscheme-1.32-new/: libt
9797
> #DEBUG=-g -Wno-char-subscripts -O
9898
> #SYS_LIBS= -ldl
9999
> #PLATFORM_FEATURES= -DSUN_DL=1
100-
>
100+
>
101101
> # Mac OS X
102102
> CC = gcc
103103
> CFLAGS = -I/usr/local/fink/include
@@ -114,7 +114,7 @@ $(DL_FLAGS) $<
114114
> $(CC) $(CFLAGS) -I. -c $(DEBUG)
115115
$(FEATURES) $(DL_FLAGS) $<
116116
66c75
117-
< $(CC) -o $@ $(DEBUG) $(OBJS) $(SYS_LIBS)
117+
< $(CC) -o $@ $(DEBUG) $(OBJS) $(SYS_LIBS)
118118
---
119119
> $(CC) $(LDFLAGS) -o $@ $(DEBUG) $(OBJS)
120120
$(SYS_LIBS)

third_party/tinyscheme/CHANGES

Lines changed: 341 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,341 @@
1+
Change Log
2+
----------
3+
4+
Version 1.42
5+
Other changes:
6+
- Fixed segfault crash caused by invalid syntax to cond (PG)
7+
- Fixed a bug in the close-port routine in init.scm
8+
- Fixed possible crash loading file due to uninitialized variable (MP)
9+
- Don't use snprintf() in atom2str to return some fixed strings (KC/MP)
10+
- Added "tinyscheme" to the features list (JaW)
11+
- Added Sconstruct to allow building using scons (AG)
12+
- Fixed function prototype for scheme_init_new (JuW)
13+
- Make various limits configurable (JuW)
14+
15+
Contributors:
16+
Kevin Cozens, Mauro Persano, Pedro Gimeno, James Woodcock, Atanu Ghosh,
17+
and Justus Winter.
18+
19+
Version 1.41
20+
Bugs fixed:
21+
#3020389 - Added makefile section for Mac OS X (SL)
22+
#3286135 - Fixed num_mod routine which caused errors in use of modulo
23+
#3290232 - Corrected version number shown on startup (GM)
24+
#3394882 - Added missing #if in opdefines.h around get and put (DC)
25+
#3395547 - Fix for the modulo procedure (DC)
26+
#3400290 - Optimized append to make it an O(n) operation (DC)
27+
#3493926 - Corrected flag used when building shared files on OSX (J)
28+
29+
R5RS related changes:
30+
#2866196 - Parser does not handle delimiters correctly
31+
#3395548 - Add a decimal point to inexact numbers in atom2str (DC)
32+
#3399331 - Make min/max return inexact when any argument is inexact
33+
#3399332 - Compatability fix for expt.
34+
#3399335 - Optional radix for string->number and number->string (DC)
35+
#3400202 - Append with one argument should not return a list (DC)
36+
#3400284 - Compatability fix for integer?
37+
38+
Other changes:
39+
- Added flags to makefile for MinGW/MSYS (TC)
40+
- Moved variable declarations to avoid warnings with some compilers
41+
- Don't print space after initial #( when printing vectors.
42+
- Minor optimization for is_nonneg().
43+
- No need to round integers in OP_ROUND (#3400284)
44+
- Fixes to code that reports line number with error (RC)
45+
46+
Contributors:
47+
Kevin Cozens, Gordon McNutt, Doug Currie, Sean Long, Tim Cas, Joey,
48+
Richard Copley, and CMarinier.
49+
50+
Version 1.40
51+
Bugs fixed:
52+
#1964950 - Stop core dumps due to bad syntax in LET (and variants)
53+
#2826594 - allow reverse to work on empty list (Tony Garnock-Jones)
54+
Potential problem of arglist to foreign calls being wrongly GC'ed.
55+
Fixed bug that read could loop forever (tehom).
56+
57+
API changes:
58+
Exposed is_list and list_length.
59+
Added scheme_register_foreign_func_list and declarations for it (tehom)
60+
Defined *compile-hook* (tehom)
61+
62+
Other changes:
63+
Updated is_list and list_length to handle circular lists.
64+
Nested calling thru C has been made now safer (tehom)
65+
Peter Michaux cleaned up port_rep_from_file
66+
Added unwind-protect (tehom)
67+
Some cleanups to in/outport and Eval_Cycle by Peter Michaux
68+
Report error line number (Mostly by Sanel Zukan, back-compatibility by Tehom)
69+
70+
Contributors:
71+
Kevin Cozens, Dimitrios Souflis, Tom Breton, Peter Michaux, Sanel Zukan,
72+
and Tony Garnock-Jones.
73+
74+
Version 1.39
75+
Bugs fixed:
76+
Fix for the load bug
77+
Fixed parsing of octal coded characters. Fixes bug #1818018.
78+
Added tests for when mk_vector is out of memory. Can't rely on sc->sink.
79+
Fix for bug #1794369
80+
Finished feature-request 1599947: scheme_apply0 etc return values.
81+
Partly provided feature-request 1599947: Expose list_length, eqv, etc
82+
Provided feature-request 1599945, Scheme->C->Scheme calling.
83+
Fix for bug 1593861 (behavior of is_integer)
84+
Fix for bug 1589711
85+
Error checking of binding spec syntax in LET and LETREC. The bad syntax
86+
was causing a segmentation fault in Linux. Complete fixes for bug #1817986.
87+
Error checking of binding spec syntax in LET*
88+
Bad syntax was causing core dump in Linux.
89+
Fix for nasty gc bug
90+
91+
R5RS changes:
92+
R5RS requires numbers to be of equal value AND of the same type (ie. both
93+
exact or inexact) in order to return #t from eqv?. R5RS compliance fix.
94+
String output ports now conform to SRFI-6
95+
96+
Other changes:
97+
Drew Yao fixed buffer overflow problems in mk_sharp_const.
98+
put OP_T0LVL in charge of reacting to EOF
99+
file_push checks array bounds (patch from Ray Lehtiniemi)
100+
Changed to always use snprintf (Patch due to Ramiro bsd1628)
101+
Updated usage information using text from the Manual.txt file.
102+
103+
Version 1.38
104+
Interim release until the rewrite, mostly incorporating modifications
105+
from Kevin Cozens. Small addition for Cygwin in the makefile, and
106+
modifications by Andrew Guenther for Apple platforms.
107+
108+
Version 1.37
109+
Joe Buehler submitted reserve_cells.
110+
111+
Version 1.36
112+
Joe Buehler fixed a patch in the allocator.
113+
Alexander Shendi moved the comment handling in the scanner, which
114+
fixed an obscure bug for which Mike E had provided a patch as well.
115+
Kevin Cozens has submitted some fixes and modifications which have
116+
not been incorporated yet in their entirety.
117+
118+
Version 1.35
119+
Todd Showalter discovered that the number of free cells reported
120+
after GC was incorrect, which could also cause unnecessary allocations.
121+
122+
Version 1.34
123+
Long missing version. Lots of bugfixes have accumulated in my email, so
124+
I had to start using them. In this version, Keenan Pepper has submitted
125+
a bugfix for the string comparison library procedure, Wouter Boeke
126+
modified some code that was casting to the wrong type and crashed on
127+
some machines, "SheppardCo" submitted a replacement "modulo" code and
128+
Scott Fenton submitted lots of corrections that shut up some compiler
129+
warnings. Brian Maher submitted instructions on how to build on OS-X.
130+
I have to dig deeper into my mailbox and find earlier emails, too.
131+
132+
Version 1.33
133+
Charles Hayden fixed a nasty GC bug of the new stack frame, while in
134+
the process of porting TinyScheme to C++. He also submitted other
135+
changes, and other people also had comments or requests, but the GC
136+
bug was so important that this version is put through the door to
137+
correct it.
138+
139+
Version 1.32
140+
Stephen Gildea put some quality time on TinyScheme again, and made
141+
a whole lot of changes to the interpreter that made it noticeably
142+
faster.
143+
144+
Version 1.31
145+
Patches to the hastily-done version 1.30. Stephen Gildea fixed
146+
some things done wrongly, and Richard Russo fixed the makefile
147+
for building on Windows. Property lists (heritage from MiniScheme)
148+
are now optional and have dissappeared from the interface. They
149+
should be considered as deprecated.
150+
151+
Version 1.30
152+
After many months, I followed Preston Bannister's advice of
153+
using macros and a single source text to keep the enums and the
154+
dispatch table in sync, and I used his contributed "opdefines.h".
155+
Timothy Downs contributed a helpful function, "scheme_call".
156+
Stephen Gildea contributed new versions of the makefile and
157+
practically all other sources. He created a built-in STRING-APPEND,
158+
and fixed a lot of other bugs.
159+
Ruhi Bloodworth reported fixes necessary for OS X and a small
160+
bug in dynload.c.
161+
162+
Version 1.29
163+
The previous version contained a lot of corrections, but there
164+
were a lot more that still wait on a sheet of paper lost in a
165+
carton someplace after my house move... Manuel Heras-Gilsanz
166+
noticed this and resent his own contribution, which relies on
167+
another bugfix that v.1.28 was missing: a problem with string
168+
output, that this version fixes. I hope other people will take
169+
the time to resend their contributions, if they didn't make it
170+
to v.1.28.
171+
172+
Version 1.28
173+
Many people have contacted me with bugfixes or remarks in
174+
the three months I was inactive. A lot of them spotted that
175+
scheme_deinit crashed while reporting gc results. They suggested
176+
that sc->outport be set to NIL in scheme_deinit, which I did.
177+
Dennis Taylor remarked that OP_VALUEPRINT reset sc->value instead
178+
of preserving it. He submitted a modification which I adopted
179+
partially. David Hovemeyer sent me many little changes, that you
180+
will find in version 1.28, and Partice Stoessel modified the
181+
float reader to conform to R5RS.
182+
183+
Version 1.27
184+
Version 1.27 is the successor of 1.25. Bug fixes only, but I had to
185+
release them so that everybody can profit. 'Backchar' tried to write
186+
back to the string, which obviously didn't work for const strings.
187+
'Substring' didn't check for crossed start and end indices. Defines
188+
changed to restore the ability to compile under MSVC.
189+
190+
Version 1.26
191+
Version 1.26 was never released. I changed a lot of things, in fact
192+
too much, even the garbage collector, and hell broke loose. I'll
193+
try a more gradual approach next time.
194+
195+
Version 1.25
196+
Types have been homogenized to be able to accommodate a different
197+
representation. Plus, promises are no longer closures. Unfortunately,
198+
I discovered that continuations and force/delay do not pass the SCM
199+
test (and never did)... However, on the bright side, what little
200+
modifications I did had a large impact on the footprint:
201+
USE_NO_FEATURES now produces an object file of 63960 bytes on Linux!
202+
203+
Version 1.24
204+
SCM tests now pass again after change in atom2str.
205+
206+
Version 1.23
207+
Finally I managed to mess it up with my version control. Version
208+
1.22 actually lacked some of the things I have been fixing in the
209+
meantime. This should be considered as a complete replacement for
210+
1.22.
211+
212+
Version 1.22
213+
The new ports had a bug in LOAD. MK_CLOSURE is introduced.
214+
Shawn Wagner inquired about string->number and number->string.
215+
I added string->atom and atom->string and defined the number
216+
functions from them. Doing that, I fixed WRITE applied to symbols
217+
(it didn't quote them). Unfortunately, minimum build is now
218+
slightly larger than 64k... I postpone action because Jason's idea
219+
might solve it elegantly.
220+
221+
Version 1.21
222+
Jason Felice submitted a radically different datatype representation
223+
which he had implemented. While discussing its pros and cons, it
224+
became apparent that the current implementation of ports suffered
225+
from a grave fault: ports were not garbage-collected. I changed the
226+
ports to be heap-allocated, which enabled the use of string ports
227+
for loading. Jason also fixed errors in the garbage collection of
228+
vectors. USE_VERBATIM is gone. "ssp_compiler.c" has a better solution
229+
on HTML generation. A bug involving backslash notation in strings
230+
has been fixed. '-c' flag now executes next argument as a stream of
231+
Scheme commands. Foreign functions are now also heap allocated,
232+
and scheme_define is used to define everything.
233+
234+
Version 1.20
235+
Tracing has been added. The toplevel loop has been slightly
236+
rearranged. Backquote reading for vector templates has been
237+
sanitized. Symbol interning is now correct. Arithmetic functions
238+
have been corrected. APPLY, MAP, FOR-EACH, numeric comparison
239+
functions fixed. String reader/writer understands \xAA notation.
240+
241+
Version 1.19
242+
Carriage Return now delimits identifiers. DOS-formatted Scheme files
243+
can be used by Unix. Random number generator added to library.
244+
Fixed some glitches of the new type-checking scheme. Fixed erroneous
245+
(append '() 'a) behavior. Will continue with r4rstest.scm to
246+
fix errors.
247+
248+
Version 1.18
249+
The FFI has been extended. USE_VERBOSE_GC has gone. Anyone wanting
250+
the same functionality can put (gcverbose #t) in init.scm.
251+
print-width was removed, along with three corresponding op-codes.
252+
Extended character constants with ASCII names were added.
253+
mk_counted_string paves the way for full support of binary strings.
254+
As much as possible of the type-checking chores were delegated
255+
to the inner loop, thus reducing the code size to less than 4200 loc!
256+
257+
Version 1.17
258+
Dynamically-loaded extensions are more fully integrated.
259+
TinyScheme is now distributed under the BSD open-source license.
260+
261+
Version 1.16
262+
Dynamically-loaded extensions introduced (USE_DL).
263+
Santeri Paavolainen found a race condition: When a cons is executed,
264+
and each of the two arguments is a constructing function, GC could
265+
happen before all arguments are evaluated and cons() is called, and
266+
the evaluated arguments would all be reclaimed!
267+
Fortunately, such a case was rare in the code, although it is
268+
a pitfall in new code and code in foreign functions. Currently, only
269+
one such case remains, when COLON_HOOK is defined.
270+
271+
Version 1.15
272+
David Gould also contributed some changes that speed up operation.
273+
Kirk Zurell fixed HASPROP.
274+
The Garbage Collection didn't collect all the garbage...fixed.
275+
276+
Version 1.14
277+
Unfortunately, after Andre fixed the GC it became obvious that the
278+
algorithm was too slow... Fortunately, David Gould found a way to
279+
speed it up.
280+
281+
Version 1.13
282+
Silly bug involving division by zero resolved by Roland Kaufman.
283+
Macintoch support from Shmulik Regev.
284+
Float parser bug fixed by Alexander Shendi.
285+
GC bug from Andru Luvisi.
286+
287+
Version 1.12
288+
Cis* incorrectly called isalpha() instead of isascii()
289+
Added USE_CHAR_CLASSIFIERS, USE_STRING_PORTS.
290+
291+
Version 1.11
292+
BSDI defines isnumber... changed all similar functions to is_*
293+
EXPT now has correct definition. Added FLOOR,CEILING,TRUNCATE
294+
and ROUND, courtesy of Bengt Kleberg. Preprocessor symbols now
295+
have values 1 or 0, and can be set as compiler defines (proposed
296+
by Andy Ganor *months* ago). 'prompt' and 'InitFile' can now be
297+
defined during compilation, too.
298+
299+
Version 1.10
300+
Another bug when file ends with comment!
301+
Added DEFINE-MACRO in init.scm, courtesy of Andy Gaynor.
302+
303+
Version 1.09
304+
Removed bug when READ met EOF. lcm.
305+
306+
Version 1.08
307+
quotient,remainder and modulo. gcd.
308+
309+
Version 1.07
310+
'=>' in cond now exists
311+
list? now checks for circularity
312+
some reader bugs removed
313+
Reader is more consistent wrt vectors
314+
Quote and Quasiquote work with vectors
315+
316+
Version 1.06
317+
#! is now skipped
318+
generic-assoc bug removed
319+
strings are now managed differently, hack.txt is removed
320+
various delicate points fixed
321+
322+
Version 1.05
323+
Support for scripts, *args*, "-1" option.
324+
Various R5RS procedures.
325+
*sharp-hook*
326+
Handles unmatched parentheses.
327+
New architecture for procedures.
328+
329+
Version 1.04
330+
Added missing T_ATOM bits...
331+
Added vectors
332+
Free-list is sorted by address, since vectors need consecutive cells.
333+
(quit <exitcode>) for use with scripts
334+
335+
Version 1.03 (26 Aug 1998):
336+
Extended .h with useful functions for FFI
337+
Library: with-input-* etc.
338+
Finished R5RS I/O, added string ports.
339+
340+
Version 1.02 (25 Aug 1998):
341+
First part of R5RS I/O.

0 commit comments

Comments
 (0)