mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-06 15:40:29 +02:00
1999-08-12 Gary Houston <ghouston@easynet.co.uk>
* ports.c (scm_seek): one more: was scm_lseek. Also changed the Scheme name from lseek to seek, but lseek was added recently so it shouldn't be a big problem. * ports.c, gdbint.c, ioext.c: changed callers.
This commit is contained in:
parent
affc96b533
commit
c94577b445
5 changed files with 23 additions and 16 deletions
4
NEWS
4
NEWS
|
@ -1040,12 +1040,12 @@ work on any kind of port, not just ports which are open on a file.
|
||||||
as file ports. If the size argument is omitted, the current
|
as file ports. If the size argument is omitted, the current
|
||||||
file position is used.
|
file position is used.
|
||||||
|
|
||||||
** new procedure: lseek PORT/FDES OFFSET WHENCE
|
** new procedure: seek PORT/FDES OFFSET WHENCE
|
||||||
The arguments are the same as for the old fseek procedure, but it
|
The arguments are the same as for the old fseek procedure, but it
|
||||||
works on string ports as well as random-access file ports.
|
works on string ports as well as random-access file ports.
|
||||||
|
|
||||||
** the fseek procedure now works on string ports, since it has been
|
** the fseek procedure now works on string ports, since it has been
|
||||||
redefined using lseek.
|
redefined using seek.
|
||||||
|
|
||||||
** the setvbuf procedure now uses a default size if mode is _IOFBF and
|
** the setvbuf procedure now uses a default size if mode is _IOFBF and
|
||||||
size is not supplied.
|
size is not supplied.
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
1999-08-12 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
|
* ports.c (scm_seek): one more: was scm_lseek. Also changed the
|
||||||
|
Scheme name from lseek to seek, but lseek was added recently so
|
||||||
|
it shouldn't be a big problem.
|
||||||
|
* ports.c, gdbint.c, ioext.c: changed callers.
|
||||||
|
|
||||||
1999-08-11 Gary Houston <ghouston@easynet.co.uk>
|
1999-08-11 Gary Houston <ghouston@easynet.co.uk>
|
||||||
|
|
||||||
* fports.c (fport_input_waiting): if select is used, return 1
|
* fports.c (fport_input_waiting): if select is used, return 1
|
||||||
|
|
|
@ -205,10 +205,10 @@ gdb_read (str)
|
||||||
}
|
}
|
||||||
SCM_BEGIN_FOREIGN_BLOCK;
|
SCM_BEGIN_FOREIGN_BLOCK;
|
||||||
unmark_port (gdb_input_port);
|
unmark_port (gdb_input_port);
|
||||||
scm_lseek (gdb_input_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
scm_seek (gdb_input_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
||||||
scm_puts (str, gdb_input_port);
|
scm_puts (str, gdb_input_port);
|
||||||
scm_truncate_file (gdb_input_port, SCM_UNDEFINED);
|
scm_truncate_file (gdb_input_port, SCM_UNDEFINED);
|
||||||
scm_lseek (gdb_input_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
scm_seek (gdb_input_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
||||||
/* Read one object */
|
/* Read one object */
|
||||||
tok_buf_mark_p = SCM_GC8MARKP (tok_buf);
|
tok_buf_mark_p = SCM_GC8MARKP (tok_buf);
|
||||||
SCM_CLRGC8MARK (tok_buf);
|
SCM_CLRGC8MARK (tok_buf);
|
||||||
|
@ -267,7 +267,7 @@ gdb_print (obj)
|
||||||
RESET_STRING;
|
RESET_STRING;
|
||||||
SCM_BEGIN_FOREIGN_BLOCK;
|
SCM_BEGIN_FOREIGN_BLOCK;
|
||||||
/* Reset stream */
|
/* Reset stream */
|
||||||
scm_lseek (gdb_output_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
scm_seek (gdb_output_port, SCM_INUM0, SCM_MAKINUM (SEEK_SET));
|
||||||
scm_write (obj, gdb_output_port);
|
scm_write (obj, gdb_output_port);
|
||||||
scm_truncate_file (gdb_output_port, SCM_UNDEFINED);
|
scm_truncate_file (gdb_output_port, SCM_UNDEFINED);
|
||||||
SEND_STRING (SCM_CHARS (SCM_STREAM (gdb_output_port)));
|
SEND_STRING (SCM_CHARS (SCM_STREAM (gdb_output_port)));
|
||||||
|
|
|
@ -299,7 +299,7 @@ SCM
|
||||||
scm_ftell (object)
|
scm_ftell (object)
|
||||||
SCM object;
|
SCM object;
|
||||||
{
|
{
|
||||||
return scm_lseek (object, SCM_INUM0, SCM_MAKINUM (SEEK_CUR));
|
return scm_seek (object, SCM_INUM0, SCM_MAKINUM (SEEK_CUR));
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM_PROC (s_fseek, "fseek", 3, 0, 0, scm_fseek);
|
SCM_PROC (s_fseek, "fseek", 3, 0, 0, scm_fseek);
|
||||||
|
@ -310,7 +310,7 @@ scm_fseek (object, offset, whence)
|
||||||
SCM offset;
|
SCM offset;
|
||||||
SCM whence;
|
SCM whence;
|
||||||
{
|
{
|
||||||
scm_lseek (object, offset, whence);
|
scm_seek (object, offset, whence);
|
||||||
|
|
||||||
return SCM_UNSPECIFIED;
|
return SCM_UNSPECIFIED;
|
||||||
}
|
}
|
||||||
|
|
|
@ -978,9 +978,9 @@ scm_unread_string (str, port)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM_PROC (s_lseek, "lseek", 3, 0, 0, scm_lseek);
|
SCM_PROC (s_seek, "seek", 3, 0, 0, scm_seek);
|
||||||
SCM
|
SCM
|
||||||
scm_lseek (SCM object, SCM offset, SCM whence)
|
scm_seek (SCM object, SCM offset, SCM whence)
|
||||||
{
|
{
|
||||||
off_t off;
|
off_t off;
|
||||||
off_t rv;
|
off_t rv;
|
||||||
|
@ -988,18 +988,18 @@ scm_lseek (SCM object, SCM offset, SCM whence)
|
||||||
|
|
||||||
object = SCM_COERCE_OUTPORT (object);
|
object = SCM_COERCE_OUTPORT (object);
|
||||||
|
|
||||||
off = scm_num2long (offset, (char *)SCM_ARG2, s_lseek);
|
off = scm_num2long (offset, (char *)SCM_ARG2, s_seek);
|
||||||
SCM_ASSERT (SCM_INUMP (whence), whence, SCM_ARG3, s_lseek);
|
SCM_ASSERT (SCM_INUMP (whence), whence, SCM_ARG3, s_seek);
|
||||||
how = SCM_INUM (whence);
|
how = SCM_INUM (whence);
|
||||||
if (how != SEEK_SET && how != SEEK_CUR && how != SEEK_END)
|
if (how != SEEK_SET && how != SEEK_CUR && how != SEEK_END)
|
||||||
scm_out_of_range (s_lseek, whence);
|
scm_out_of_range (s_seek, whence);
|
||||||
if (SCM_NIMP (object) && SCM_OPPORTP (object))
|
if (SCM_NIMP (object) && SCM_OPPORTP (object))
|
||||||
{
|
{
|
||||||
scm_port *pt = SCM_PTAB_ENTRY (object);
|
scm_port *pt = SCM_PTAB_ENTRY (object);
|
||||||
scm_ptob_descriptor *ptob = scm_ptobs + SCM_PTOBNUM (object);
|
scm_ptob_descriptor *ptob = scm_ptobs + SCM_PTOBNUM (object);
|
||||||
|
|
||||||
if (!ptob->seek)
|
if (!ptob->seek)
|
||||||
scm_misc_error (s_lseek, "port is not seekable",
|
scm_misc_error (s_seek, "port is not seekable",
|
||||||
scm_cons (object, SCM_EOL));
|
scm_cons (object, SCM_EOL));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1013,10 +1013,10 @@ scm_lseek (SCM object, SCM offset, SCM whence)
|
||||||
}
|
}
|
||||||
else /* file descriptor?. */
|
else /* file descriptor?. */
|
||||||
{
|
{
|
||||||
SCM_ASSERT (SCM_INUMP (object), object, SCM_ARG1, s_lseek);
|
SCM_ASSERT (SCM_INUMP (object), object, SCM_ARG1, s_seek);
|
||||||
rv = lseek (SCM_INUM (object), off, how);
|
rv = lseek (SCM_INUM (object), off, how);
|
||||||
if (rv == -1)
|
if (rv == -1)
|
||||||
scm_syserror (s_lseek);
|
scm_syserror (s_seek);
|
||||||
}
|
}
|
||||||
return scm_long2num (rv);
|
return scm_long2num (rv);
|
||||||
}
|
}
|
||||||
|
@ -1037,7 +1037,7 @@ scm_truncate_file (SCM object, SCM length)
|
||||||
if (SCM_NIMP (object) && SCM_ROSTRINGP (object))
|
if (SCM_NIMP (object) && SCM_ROSTRINGP (object))
|
||||||
scm_wrong_num_args (scm_makfrom0str (s_truncate_file));
|
scm_wrong_num_args (scm_makfrom0str (s_truncate_file));
|
||||||
|
|
||||||
length = scm_lseek (object, SCM_INUM0, SCM_MAKINUM (SEEK_CUR));
|
length = scm_seek (object, SCM_INUM0, SCM_MAKINUM (SEEK_CUR));
|
||||||
}
|
}
|
||||||
c_length = scm_num2long (length, (char *)SCM_ARG2, s_truncate_file);
|
c_length = scm_num2long (length, (char *)SCM_ARG2, s_truncate_file);
|
||||||
if (c_length < 0)
|
if (c_length < 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue