Thanks for your quick response. Here's what I'm seeing now, after recompiling with the changes you suggested:
% gsi/gsi Gambit Version 4.0 beta 20
(define f (open-input-file "README")) (input-port-byte-position f)
0
(read-char f)
#\R
(input-port-byte-position f)
1024
(read-char f)
#\E
(input-port-byte-position f)
1024
(read-char f)
#\A
(input-port-byte-position f)
1024
(input-port-byte-position f 0)
0
(read-char f)
#\R
(input-port-byte-position f)
1024
A different problem, but still a problem. Any ideas?
JM
+++ Marc Feeley [Oct 17 06 14:20 ]:
Thanks for the bug report. The problem is in the function ___device_file_seek_raw_virt in lib/os_io.c (the new position was not being returned). Please update that function as follows and recompile Gambit, and the system will be consistent with the documentation.
Marc
___HIDDEN ___SCMOBJ ___device_file_seek_raw_virt ___P((___device_stream *self, ___stream_index *pos, int whence), (self, pos, whence) ___device_stream *self; ___stream_index *pos; int whence;) { ___device_file *d = ___CAST(___device_file*,self);
if (d->base.base.read_stage == ___STAGE_OPEN || d->base.base.write_stage == ___STAGE_OPEN) { #ifndef USE_POSIX #ifndef USE_WIN32
int new_pos; FILE *stream = d->stream; if (stream == 0) stream = stdout; if (fseek (stream, *pos, whence) < 0 || (new_pos = ftell (stream)) < 0) return err_code_from_errno (); *pos = new_pos; /************** ADD THIS *******************/
#endif #endif
#ifdef USE_POSIX
int new_pos; if ((new_pos = lseek (d->fd, *pos, whence)) < 0) return err_code_from_errno (); *pos = new_pos; /************** ADD THIS *******************/
#endif
#ifdef USE_WIN32
...
#endif }
return ___FIX(___NO_ERR); }