This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: First-class environment proposal


| > Thanks anyway for the explaination for the gdb problem.  I hadn't
| > gotten around to trying to fix it.  The seek in the ptob probably
| > doesn't need to be set for string ports, but scm_fseek/scm_ftell
| > should be generalised to work with any kind of port.  I'll do it soon.
| 
| I was thinking it'd probably be easier to just implement scm_fseek
| around the port's own seek method (rather than trying to figure it out
| in scm_fseek... it's not that it's difficult, but it'd probably help
| avoid this problem coming up again); the gdb bit is basically trying
| to empty the strport first, and I didn't come across anything that did
| it easily (without munging the buffer directly, which felt sorta
| wrong; I could've been looking at the wrong file again, though ;).

It took a bit longer than I expected, since the port buffers were
still excessively oriented towards FPORTs.  I think the version on my
web page fixes the gdb interface (at least the "dp" macro works, I
didn't test anything else).  Since there are new ptob entries and the
changes got a bit out of hand, there isn't a simple patch for the old
version.

Output string ports are now seekable and truncatable:

guile> (call-with-output-string (lambda (str)
                            (display "foo" str)
                    (lseek str -1 SEEK_CUR)
                    (ftruncate str)))
"fo"