Compare commits

..

No commits in common. "5ba5ffc44da4943139fa27879df2aa748abf1c71" and "66a624fb53031f1e7de049c9ae493861d3dd4be4" have entirely different histories.

10 changed files with 31 additions and 85 deletions

View File

@ -30,6 +30,6 @@ Scott Watson, and Mike Wray. Oliver apologizes for any omissions from
this--necessarily incomplete--list.
Sam would like to thank James Bostock, Sven Hartrumpf, Mark Sapa, Phillip
Rulon, Martin Rumori and Sanel Zukan (support for [] delimiters) for their
useful bug reports and patches on the road to Elk 4.0.
Rulon and Martin Rumori for their useful bug reports and patches on the road
to Elk 4.0.

3
NEWS
View File

@ -3,9 +3,6 @@ $Id$
Changes between 3.0 and 4.0:
----------------------------
* New in 3.99.8 prerelease:
+ Maintenance release with minor bugfixes.
* New in 3.99.7 prerelease:
+ Last known garbage collector bug was fixed.

2
README
View File

@ -35,7 +35,7 @@ Getting Elk
You can obtain the Elk 3.99 distribution as well as additional information
about Elk in the World Wide Web at
http://sam.zoy.org/elk/
http://sam.zoy.org/projects/sam/
The distribution is also available for anonymous FTP from a number of
servers including these:

View File

@ -6,7 +6,7 @@ AC_PREREQ(2.50)
AC_CONFIG_AUX_DIR(.auto)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(elk, 3.99.8)
AM_INIT_AUTOMAKE(elk, 3.99.7)
dnl AM_MAINTAINER_MODE
AM_CONFIG_HEADER(config.h)

View File

@ -366,11 +366,8 @@ extern Object P_Macro (Object);
extern Object P_Macro_Body (Object);
extern Object P_Macro_Expand (Object);
extern Object P_Primitivep (Object);
extern Object P_Primitive_To_String (Object);
extern Object P_Compoundp (Object);
extern Object P_Compound_To_String (Object);
extern Object P_Macrop (Object);
extern Object P_Macro_To_String (Object);
extern void Check_Procedure (Object);
/* Delay and force

View File

@ -41,7 +41,7 @@ extern_c Object elk_import False2;
#define Numeric(t) (t == T_Fixnum || t == T_Flonum || t == T_Bignum)
#define Whitespace(c) (c == ' ' || c == '\t' || c == '\014' || c == '\n' || c == '\r')
#define Delimiter(c) (c == ';' || c == ')' || c == '(' || c == '[' || c == ']' || c == '"')
#define Delimiter(c) (c == ';' || c == ')' || c == '(' || c == '"')
/* Align heap addresses */

View File

@ -301,13 +301,8 @@ struct Prim_Init {
*/
{ P_Procedurep, "procedure?", 1, 1, EVAL },
{ P_Primitivep, "primitive?", 1, 1, EVAL },
{ P_Primitive_To_String,
"primitive->string", 1, 1, EVAL },
{ P_Compoundp, "compound?", 1, 1, EVAL },
{ P_Compound_To_String,
"compound->string", 1, 1, EVAL },
{ P_Macrop, "macro?", 1, 1, EVAL },
{ P_Macro_To_String, "macro->string", 1, 1, EVAL },
{ P_Eval, "eval", 1, 2, VARARGS },
{ P_Apply, "apply", 2, MANY, VARARGS },
{ P_Lambda, "lambda", 2, MANY, NOEVAL },

View File

@ -100,39 +100,14 @@ Object P_Primitivep (Object x) {
return TYPE(x) == T_Primitive ? True : False;
}
Object P_Primitive_To_String (Object x) {
Check_Type (x, T_Primitive);
return Make_String (PRIM(x)->name, strlen(PRIM(x)->name));
}
Object P_Compoundp (Object x) {
return TYPE(x) == T_Compound ? True : False;
}
Object P_Compound_To_String (Object x) {
Check_Type (x, T_Compound);
if (Nullp (COMPOUND(x)->name)) {
static char buf[64];
sprintf (buf, "#<compound %lu>", POINTER(x));
return Make_String (buf, strlen(buf));
}
return COMPOUND(x)->name;
}
Object P_Macrop (Object x) {
return TYPE(x) == T_Macro ? True : False;
}
Object P_Macro_To_String (Object x) {
Check_Type (x, T_Macro);
if (Nullp (MACRO(x)->name)) {
static char buf[64];
sprintf (buf, "#<macro %lu>", POINTER(x));
return Make_String (buf, strlen(buf));
}
return MACRO(x)->name;
}
Object Make_Compound () {
Object proc;

View File

@ -80,7 +80,7 @@ static void Read_Grow () {
Object General_Read(), Read_Sequence(), Read_Atom(), Read_Special();
Object Read_String(), Read_Sharp(), Read_True(), Read_False(), Read_Void();
Object Read_Kludge(), Read_Vector_Paren(), Read_Vector_Bracket(), Read_Radix(), Read_Char();
Object Read_Kludge(), Read_Vector(), Read_Radix(), Read_Char();
void Init_Read () {
Define_Symbol (&Sym_Quote, "quote");
@ -92,8 +92,7 @@ void Init_Read () {
Readers['f'] = Readers['F'] = Read_False;
Readers['v'] = Readers['V'] = Read_Void;
Readers['!'] = Read_Kludge; /* for interpreter files */
Readers['('] = Read_Vector_Paren;
Readers['['] = Read_Vector_Bracket;
Readers['('] = Read_Vector;
Readers['b'] = Readers['B'] =
Readers['o'] = Readers['O'] =
Readers['d'] = Readers['D'] =
@ -274,8 +273,8 @@ comment:
}
continue;
}
if (c == '(' || c == '[') {
ret = Read_Sequence (port, 0, konst, c);
if (c == '(') {
ret = Read_Sequence (port, 0, konst);
} else if (c == '#') {
ret = Read_Sharp (port, konst);
if (TYPE(ret) == T_Special) /* it was a #! */
@ -334,13 +333,11 @@ eof:
if (Skip_Comment (port) == EOF)
goto eof;
goto again;
case ']':
case ')':
SET(ret, T_Special, c);
return ret;
case '[':
case '(':
return Read_Sequence (port, 0, konst, c);
return Read_Sequence (port, 0, konst);
case '\'':
return READ_QUOTE(Sym_Quote);
case '`':
@ -397,7 +394,7 @@ eof:
/*NOTREACHED*/
}
Object Read_Sequence (Object port, int vec, int konst, int start_chr) {
Object Read_Sequence (Object port, int vec, int konst) {
Object ret, e, tail, t;
GC_Node3;
@ -406,14 +403,7 @@ Object Read_Sequence (Object port, int vec, int konst, int start_chr) {
while (1) {
e = Read_Special (port, konst);
if (TYPE(e) == T_Special) {
if (CHAR(e) == ')' || CHAR(e) == ']') {
if ((start_chr == '(' && CHAR(e) == ']')
|| (start_chr == '[' && CHAR(e) == ')')) {
char buf[64];
sprintf(buf, "expression starts with '%c' but ends "
"with '%c'", start_chr, CHAR(e));
Reader_Error (port, buf);
}
if (CHAR(e) == ')') {
GC_Unlink;
return ret;
}
@ -430,7 +420,7 @@ Object Read_Sequence (Object port, int vec, int konst, int start_chr) {
Cdr (tail) = e;
}
e = Read_Special (port, konst);
if (TYPE(e) == T_Special && (CHAR(e) == ')' || CHAR(e) == ']')) {
if (TYPE(e) == T_Special && CHAR(e) == ')') {
GC_Unlink;
return ret;
}
@ -532,13 +522,8 @@ Object Read_Kludge (Object port, int chr, int konst) {
}
/*ARGSUSED*/
Object Read_Vector_Paren (Object port, int chr, int konst) {
return List_To_Vector (Read_Sequence (port, 1, konst, '('), konst);
}
/*ARGSUSED*/
Object Read_Vector_Bracket (Object port, int chr, int konst) {
return List_To_Vector (Read_Sequence (port, 1, konst, '['), konst);
Object Read_Vector (Object port, int chr, int konst) {
return List_To_Vector (Read_Sequence (port, 1, konst), konst);
}
/*ARGSUSED*/

View File

@ -1,36 +1,33 @@
#!/bin/sh
ret=0
#
# Check that we have no tabs or trailing spaces in the source code
#
nfails=0
nfiles=0
nlines=0
failure=0
for dir in lib/misc lib/unix lib/xlib lib/xwidgets lib/xwidgets/motif \
lib/xwidgets/xaw src; do
if [ ! -d "../$dir" ]; then continue; fi
for x in $(make -s echo-sources -C ../$dir); do
case "$x" in
*.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl)
nfiles=$(($nfiles + 1));
nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;;
*)
continue ;;
esac
if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then
pushd ../$dir >/dev/null
for x in $(make echo-sources); do
if grep '[[:space:]]$' "$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains trailing spaces"
nfails=$(($nfails + 1))
failure=1
fi
if grep ' ' "../$dir/$x" >/dev/null 2>&1; then
if grep ' ' "$x" >/dev/null 2>&1; then
echo "error: $dir/$x contains tabs"
nfails=$(($nfails + 1))
failure=1
fi
done
popd >/dev/null
done
if test "$failure" != "0"; then
ret=1
else
echo "0 errors in source code"
fi
echo "$nfiles files, $nlines lines, $nfails errors in source code"
if test "$nfails" != "0"; then
if test "$ret" != "0"; then
exit 1
fi