summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2003-06-04 23:22:54 +0000
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2003-06-04 23:22:54 +0000
commit47dbd81e77c41cd3c5b78582ef1307ee5a34f899 (patch)
tree9a7c32052233015bebdba876d2e0e5ecaa3e40f2
parent18f7ef38590b0db0ce116883ba08f705bb9c5a5c (diff)
downloadguile-47dbd81e77c41cd3c5b78582ef1307ee5a34f899.tar.gz
* test-suite/tests/chars.test: Added test, attempting to apply a
character. This test will only pass if the other changes that are submitted together with this patch are also applied. * libguile/tags.h: Fixed comment about the immediate type code layout. * libguile/eval.c: Fixed handling of non-special instructions. Without this patch, guile will segfault on (#\0) and similar instructions.
-rw-r--r--libguile/ChangeLog7
-rw-r--r--libguile/eval.c3
-rw-r--r--libguile/tags.h20
-rw-r--r--test-suite/ChangeLog6
-rw-r--r--test-suite/tests/chars.test15
5 files changed, 40 insertions, 11 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index b6ae562f3..f3922fac5 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,10 @@
+2003-06-05 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * tags.h: Fixed comment about the immediate type code layout.
+
+ * eval.c: Fixed handling of non-special instructions. Without
+ this patch, guile will segfault on (#\0) and similar instructions.
+
2003-06-05 Kevin Ryde <user42@zip.com.au>
* numbers.c (scm_max, scm_min): For inum, bignum and real, if other
diff --git a/libguile/eval.c b/libguile/eval.c
index 60e82d54d..48a76e731 100644
--- a/libguile/eval.c
+++ b/libguile/eval.c
@@ -2448,6 +2448,9 @@ dispatch:
/* new syntactic forms go here. */
case SCM_BIT7 (SCM_MAKISYM (0)):
proc = SCM_CAR (x);
+ if (!SCM_IFLAGP (proc))
+ goto evapply;
+
switch (SCM_ISYMNUM (proc))
{
diff --git a/libguile/tags.h b/libguile/tags.h
index 5e041114e..e9df04af3 100644
--- a/libguile/tags.h
+++ b/libguile/tags.h
@@ -3,7 +3,7 @@
#ifndef SCM_TAGS_H
#define SCM_TAGS_H
-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -156,7 +156,7 @@ typedef unsigned long scm_t_bits;
* 0011-100 short instruction
* 0100-100 short instruction
* 0101-100 short instruction
- * 0110-100 various immediates and long instructions
+ * 0110-100 short instruction
* 0111-100 short instruction
* 1000-100 short instruction
* 1001-100 short instruction
@@ -164,13 +164,14 @@ typedef unsigned long scm_t_bits;
* 1011-100 short instruction
* 1100-100 short instruction
* 1101-100 short instruction
- * 1110-100 immediate characters
+ * 1110-100 immediate characters, various immediates and long instructions
* 1111-100 ilocs
*
- * Some of the 0110100 immediates are long instructions (they dispatch
- * in two steps compared to one step for a short instruction).
- * The two steps are, (1) dispatch on 7 bits to the long instruction
- * handler, (2) dispatch on 7 additional bits.
+ * Some of the 1110100 immediates are long instructions (they dispatch in
+ * three steps compared to one step for a short instruction). The three steps
+ * are, (1) dispatch on 7 bits to the long instruction handler, (2) check, if
+ * the immediate indicates a long instruction (rather than a character or
+ * other immediate) (3) dispatch on the additional bits.
*
* One way to think of it is that there are 128 short instructions,
* with the 13 immediates above being some of the most interesting.
@@ -235,9 +236,7 @@ typedef unsigned long scm_t_bits;
* TYP16S functions similarly wrt to TYP16 as TYP7S to TYP7,
* but a different option bit is used (bit 2 for TYP7S,
* bit 8 for TYP16S).
- * */
-
-
+ */
/* {Non-immediate values.}
@@ -397,7 +396,6 @@ SCM_API char *scm_isymnames[]; /* defined in print.c */
*
* These are used only in eval but their values
* have to be allocated here.
- *
*/
#define SCM_IM_AND SCM_MAKSPCSYM (0)
diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog
index 9a3dbf798..af8cfda4a 100644
--- a/test-suite/ChangeLog
+++ b/test-suite/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-05 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * tests/chars.test: Added test, attempting to apply a character.
+ This test will only pass if the other changes that are submitted
+ together with this patch are also applied.
+
2003-06-05 Kevin Ryde <user42@zip.com.au>
* tests/numbers.test (logcount): Add a few more tests, to exercise
diff --git a/test-suite/tests/chars.test b/test-suite/tests/chars.test
index de75d85eb..7b86dea19 100644
--- a/test-suite/tests/chars.test
+++ b/test-suite/tests/chars.test
@@ -21,6 +21,21 @@
(use-modules (test-suite lib))
+(define exception:wrong-type-to-apply
+ (cons 'misc-error "^Wrong type to apply:"))
+
+
+(with-test-prefix "basic char handling"
+
+ (with-test-prefix "evaluator"
+
+ ;; Guile prior to 2003-06-05 segfaulted on the following test, because
+ ;; within the evaluator there was no distinction between the
+ ;; evaluator-internal instruction codes and characters.
+ (pass-if-exception "evaluating chars"
+ exception:wrong-type-to-apply
+ (eval '(#\0) (interaction-environment)))))
+
(pass-if "char-is-both? works"
(and
(not (char-is-both? #\?))