paynekj wrote:
saulgoode wrote:
and that a missing closing parenthesis will result in the expression being read getting discarded and an #<EOF> being returned.
This is not what happens (At least on the Windows XP systems I've tried it on)Code:
(let loop ((object (catch 'eof (read port))))
The (read port) command never returns. If you want to pursue this, try reading from a file containing only this:I am unable to try it in Script-fu at present, but running TinyScheme on GNU/Linux things appear to behave as I described. I am more inclined to think that the problem lies with Script-fu and not with Windows (Script-fu has some C-style hacks in its I/O which aren't in the original TinyScheme, or maybe it's that Script-fu's TinyScheme is a little outdated).
Code:
TinyScheme 1.39
ts> (define obj)
ts> (define port (open-input-file "payne.scm"))
ts> (set! obj (read port))
#<EOF>
ts> (eof-object? obj)
#t
ts> (close-input-port port)
ts> (define port (open-input-file "payne.scm"))
port
ts> (set! obj (catch 'eof (read port)))
#<EOF>
ts> (eof-object? obj)
#t
ts> (close-input-port port)
#t
ts>
paynekj wrote:
I realise it would be possible to read the files one character at a time, but quite frankly I think the law of diminishing returns has kicked in at this point. I don't feel inclined to put a lot of effort into finding a solution to this one exception. But if you, or anyone else for that matter, would like to take up the cause, please do.
I pretty much agree that using read-char is not worth the effort. Also, I am currently not very trusting of Script-fu's read-char; I've encountered problems with garbage values being returned when trying to read lots of files in sequence (trying to create previews of a directory of gradients).
I hope to look into it in the future but it is not a high priority.