Discussion:
SRFI 106: minor bugs in code
Sudarshan S Chawathe
2017-07-24 14:59:14 UTC
Permalink
There appear to be a few small bugs (missing closing-parentheses,
different library name) in the code included in SRFI-106 in the Example
and Implementation sections.

Since the code is inlined in the SRFI document, I am attaching diffs
based on the files into which I copied the code. In any case, a quick
visual inspection of the diffs probably suffices to determine the
changes.

I tested the modified code with Ypsilon 0.9.6-update3 and it seems to
work as expected.

Regards,

-chaw
Arthur A. Gleckler
2017-07-24 22:28:39 UTC
Permalink
Hello, Mr. Kato. May I have your permission to apply the bug fixes
submitted by Sudarshan?

Regards,


SRFI Editor

---------- Forwarded message ----------
From: Sudarshan S Chawathe <***@eip10.org>
Date: Mon, Jul 24, 2017 at 7:59 AM
Subject: SRFI 106: minor bugs in code
To: srfi-***@srfi.schemers.org


There appear to be a few small bugs (missing closing-parentheses,
different library name) in the code included in SRFI-106 in the Example
and Implementation sections.

Since the code is inlined in the SRFI document, I am attaching diffs
based on the files into which I copied the code. In any case, a quick
visual inspection of the diffs probably suffices to determine the
changes.

I tested the modified code with Ypsilon 0.9.6-update3 and it seems to
work as expected.

Regards,

-chaw


--- echo-server.scm.~1.1~ 2017-07-23 18:54:14.729416437 -0400
+++ echo-server.scm 2017-07-23 18:40:56.013383324 -0400
@@ -12,7 +12,7 @@
(case b
((#xA) #t) ;; newline
((#xD) (loop (get-u8 bin))) ;; carriage return
- (else (put-u8 out b) (loop (get-u8 bin))))))))
+ (else (put-u8 out b) (loop (get-u8 bin)))))))))
(call-with-socket (socket-accept echo-server-socket)
(lambda (sock)
(let ((in (socket-input-port sock))
@@ -20,4 +20,5 @@
(let lp2 ((r (get-line-from-binary-port in)))
(put-bytevector out (string-<utf8 (string-append r "\r\n")))
(lp2 (get-line-from-binary-port in)))))))
+
(server-run)

--- socket.scm.~1.2~ 2017-07-23 18:50:33.249407255 -0400
+++ socket.scm 2017-07-23 18:49:44.969405253 -0400
@@ -14,11 +14,12 @@
*shut-rd* *shut-wr* *shut-rdwr*
address-family socket-domain address-info
ip-protocol message-type shutdown-method)
- (import (rnrs) (except (socket impl) socket-port))
+ (import (rnrs) (except (srfi :106 socket impl) socket-port))

(define %address-family `((inet ,*af-inet*)
(inet6 ,*af-inet6*)
(unspec ,*af-unspec*)))
+
(define %address-info `((canoname ,*ai-canonname*)
(numerichost ,*ai-numerichost*)
(v4mapped ,*ai-v4mapped*)
@@ -39,7 +40,7 @@

(define (lookup who sets name)
(cond ((assq name sets) => cadr)
- (else (assertion-violation who "no name defined" name)))
+ (else (assertion-violation who "no name defined" name))))

(define-syntax address-family
(syntax-rules ()
@@ -82,7 +83,7 @@
"duplicate method" m)
(loop (cdr methods) (cons (car m) seen)))))
(else (assertion-violation 'shutdown-method
- "unknown method" (car
methods)))))
+ "unknown method" (car
methods))))))
(check-methods methods)
(if (null? (cdr methods))
(case (car methods)
@@ -105,6 +106,4 @@
(bytevector-copy! bv start buf 0 count)
(socket-send socket buf)))
(make-custom-binary-input/output-port
- "socket-port" read! write! #f #f #f))
-
- )
+ "socket-port" read! write! #f #f #f)))
Takashi Kato
2017-07-25 08:42:04 UTC
Permalink
Hi Arthur,

Please do so.

Cheers,
Post by Arthur A. Gleckler
Hello, Mr. Kato. May I have your permission to apply the bug fixes
submitted by Sudarshan?
Regards,
SRFI Editor
---------- Forwarded message ----------
Date: Mon, Jul 24, 2017 at 7:59 AM
Subject: SRFI 106: minor bugs in code
There appear to be a few small bugs (missing closing-parentheses,
different library name) in the code included in SRFI-106 in the Example
and Implementation sections.
Since the code is inlined in the SRFI document, I am attaching diffs
based on the files into which I copied the code. In any case, a quick
visual inspection of the diffs probably suffices to determine the
changes.
I tested the modified code with Ypsilon 0.9.6-update3 and it seems to
work as expected.
Regards,
-chaw
--- echo-server.scm.~1.1~ 2017-07-23 18:54:14.729416437 -0400
+++ echo-server.scm 2017-07-23 18:40:56.013383324 -0400
@@ -12,7 +12,7 @@
(case b
((#xA) #t) ;; newline
((#xD) (loop (get-u8 bin))) ;; carriage return
- (else (put-u8 out b) (loop (get-u8 bin))))))))
+ (else (put-u8 out b) (loop (get-u8 bin)))))))))
(call-with-socket (socket-accept echo-server-socket)
(lambda (sock)
(let ((in (socket-input-port sock))
@@ -20,4 +20,5 @@
(let lp2 ((r (get-line-from-binary-port in)))
(put-bytevector out (string-<utf8 (string-append r "\r\n")))
(lp2 (get-line-from-binary-port in)))))))
+
(server-run)
--- socket.scm.~1.2~ 2017-07-23 18:50:33.249407255 -0400
+++ socket.scm 2017-07-23 18:49:44.969405253 -0400
@@ -14,11 +14,12 @@
*shut-rd* *shut-wr* *shut-rdwr*
address-family socket-domain address-info
ip-protocol message-type shutdown-method)
- (import (rnrs) (except (socket impl) socket-port))
+ (import (rnrs) (except (srfi :106 socket impl) socket-port))
(define %address-family `((inet ,*af-inet*)
(inet6 ,*af-inet6*)
(unspec ,*af-unspec*)))
+
(define %address-info `((canoname ,*ai-canonname*)
(numerichost ,*ai-numerichost*)
(v4mapped ,*ai-v4mapped*)
@@ -39,7 +40,7 @@
(define (lookup who sets name)
(cond ((assq name sets) => cadr)
- (else (assertion-violation who "no name defined" name)))
+ (else (assertion-violation who "no name defined" name))))
(define-syntax address-family
(syntax-rules ()
@@ -82,7 +83,7 @@
"duplicate method" m)
(loop (cdr methods) (cons (car m) seen)))))
(else (assertion-violation 'shutdown-method
- "unknown method" (car
methods)))))
+ "unknown method" (car
methods))))))
(check-methods methods)
(if (null? (cdr methods))
(case (car methods)
@@ -105,6 +106,4 @@
(bytevector-copy! bv start buf 0 count)
(socket-send socket buf)))
(make-custom-binary-input/output-port
- "socket-port" read! write! #f #f #f))
-
- )
+ "socket-port" read! write! #f #f #f)))
--
_/_/
Takashi Kato
E-mail: ***@gmail.com
Sudarshan S Chawathe
2017-07-24 22:38:29 UTC
Permalink
My earlier message accidentally omitted another minor fix:

In the Example code, there is one instance of string-<utf8 which should
be string->utf8 instead.

Regards,

-chaw
Loading...