[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Allow "unsetting" read syntax
From: |
Felix |
Subject: |
Re: [Chicken-hackers] [PATCH] Allow "unsetting" read syntax |
Date: |
Tue, 30 Oct 2012 10:48:03 +0100 (CET) |
> What's going on? This patch seems to include the patch for process-fork.
> Maybe you can resend the isolated one, or explain why the original patch
> wasn't okay.
The explanation is that I was confused. Here is the correct patch.
cheers,
felix
>From c68589f1b4955954565cd46263ece36aa2c29756 Mon Sep 17 00:00:00 2001
From: felix <address@hidden>
Date: Tue, 30 Oct 2012 10:47:15 +0100
Subject: [PATCH] allow unsetting read-syntax
---
library.scm | 8 ++++++--
manual/Unit library | 4 ++++
types.db | 15 ++++++++++++---
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/library.scm b/library.scm
index ffd0191..8cb2b7e 100644
--- a/library.scm
+++ b/library.scm
@@ -3065,9 +3065,13 @@ EOF
(unless (##sys#slot crt slot)
(##sys#setslot crt slot (##sys#make-vector 256 #f)) )
(##sys#check-char chr loc)
- (let ([i (char->integer chr)])
+ (let ((i (char->integer chr)))
(##sys#check-range i 0 256 loc)
- (##sys#setslot (##sys#slot crt slot) i (wrap proc)) ) ) ) ) )
+ (cond (proc
+ (##sys#check-closure proc loc)
+ (##sys#setslot (##sys#slot crt slot) i (wrap proc)))
+ (else
+ (##sys#setslot (##sys#slot crt slot) i #f))))))))
(set! set-read-syntax!
(syntax-setter
diff --git a/manual/Unit library b/manual/Unit library
index 2bc1045..232d42c 100644
--- a/manual/Unit library
+++ b/manual/Unit library
@@ -1224,6 +1224,8 @@ To disable built-in read-syntax, define a handler that
triggers an error (for ex
Similar to {{set-read-syntax!}}, but allows defining new {{#<CHAR> ...}}
reader syntax.
If the first argument is a symbol, then this procedure is equivalent to
{{set-read-syntax!}}.
+{{PROC}} may be {{#f}} to disable previously defined "sharp" read syntax.
+
==== set-parameterized-read-syntax!
@@ -1235,6 +1237,8 @@ arguments: the input port and the number preceding
the dispatching character.
If the first argument is a symbol, then this procedure is equivalent to
{{set-read-syntax!}}.
+{{PROC}} may be {{#f}} to disable previously defined parameterized read syntax.
+
==== copy-read-table
diff --git a/types.db b/types.db
index b7b6121..2e6e45d 100644
--- a/types.db
+++ b/types.db
@@ -1034,13 +1034,22 @@
(set-gc-report! (#(procedure #:clean) set-gc-report! (*) undefined))
(set-parameterized-read-syntax!
- (#(procedure #:clean #:enforce) set-parameterized-read-syntax! (char
(procedure (input-port fixnum) . *)) undefined))
+ (#(procedure #:clean #:enforce) set-parameterized-read-syntax!
+ (char (or boolean (procedure (input-port fixnum) . *)))
+ undefined))
(set-port-name! (#(procedure #:clean #:enforce) set-port-name! (port string)
undefined)
((port string) (##sys#setslot #(1) '3 #(2))))
-(set-read-syntax! (#(procedure #:clean #:enforce) set-read-syntax! (char
(procedure (input-port) . *)) undefined))
-(set-sharp-read-syntax! (#(procedure #:clean #:enforce) set-sharp-read-syntax!
(char (procedure (input-port) . *)) undefined))
+(set-read-syntax!
+ (#(procedure #:clean #:enforce) set-read-syntax!
+ (char (or boolean (procedure (input-port) . *)))
+ undefined))
+
+(set-sharp-read-syntax!
+ (#(procedure #:clean #:enforce) set-sharp-read-syntax!
+ (char (or boolean (procedure (input-port) . *))) undefined))
+
(setter (#(procedure #:clean #:enforce) setter (procedure) procedure))
(signal (procedure signal (*) . *))
(signum (#(procedure #:clean #:enforce) signum (number) number))
--
1.7.0.4