Ray Racine
2008-02-07 05:21:00 UTC
There is a fence post bug in get-string-n in portio.sch. The do loop
reads a char on loop initialization and then one for count iterations.
Therefore one more then count chars are consumed in the call to
get-string-n.
See sample below. Notice '5' was skipped.
Ray
----
Process scheme finished
Larceny v0.961 "Fluoridation" (Feb 4 2008 23:49:20,
precise:Linux:unified)
larceny.heap, built on Mon Feb 4 23:53:29 EST 2008
ERR5RS mode (no libraries have been imported)
Autoloading (rnrs enums)
Autoloading (rnrs lists)
Autoloading (rnrs syntax-case)
Autoloading (rnrs hashtables)
Autoloading (rnrs arithmetic bitwise)
Autoloading (rnrs programs)
Autoloading (rnrs files)
Autoloading (rnrs io ports)
Autoloading (larceny deprecated)
Autoloading (rnrs conditions)
Autoloading (rnrs exceptions)
Autoloading (rnrs records syntactic)
Autoloading (err5rs records procedural)
Autoloading (rnrs records procedural)
Autoloading (rnrs control)
Autoloading (rnrs sorting)
Autoloading (rnrs bytevectors)
Autoloading (rnrs unicode)
Notice '5' was skipped.
reads a char on loop initialization and then one for count iterations.
Therefore one more then count chars are consumed in the call to
get-string-n.
See sample below. Notice '5' was skipped.
Ray
----
Process scheme finished
Larceny v0.961 "Fluoridation" (Feb 4 2008 23:49:20,
precise:Linux:unified)
larceny.heap, built on Mon Feb 4 23:53:29 EST 2008
ERR5RS mode (no libraries have been imported)
(import (rnrs))
Autoloading (rnrs)Autoloading (rnrs enums)
Autoloading (rnrs lists)
Autoloading (rnrs syntax-case)
Autoloading (rnrs hashtables)
Autoloading (rnrs arithmetic bitwise)
Autoloading (rnrs programs)
Autoloading (rnrs files)
Autoloading (rnrs io ports)
Autoloading (larceny deprecated)
Autoloading (rnrs conditions)
Autoloading (rnrs exceptions)
Autoloading (rnrs records syntactic)
Autoloading (err5rs records procedural)
Autoloading (rnrs records procedural)
Autoloading (rnrs control)
Autoloading (rnrs sorting)
Autoloading (rnrs bytevectors)
Autoloading (rnrs unicode)
(import (rnrs io ports))
(define ip (open-string-input-port "12345678"))
(get-string-n ip 4)
"1234"(define ip (open-string-input-port "12345678"))
(get-string-n ip 4)
(get-string-n ip 4)
"678"Notice '5' was skipped.