1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-19 02:00:26 +02:00

* ports.c: add SCM_PROC declarations for pt-size and pt-member.

* Makefile.am: remove AWK=@AWK@.
	Add a rule for generating errnos.list.
	(CLEANFILES): put errnos.list here instead of in DISTCLEANFILES.

	* configure.in: add AC_SUBST(AWK) and AC_SUBST(ERRNO_EXTRACT).
	don't extract errnos, just set a variable (avoids the
	need to recompile error.c just because configure is run.)

	* unif.h: update prototypes.
	* unif.c (scm_uniform_array_read,write): change the offset and
	length arguments to start and end, for consistency.

	* __scm.h: uncomment SCM_ARG6 and SCM_ARG7, I needed SCM_ARG6.

	* ioext.h: update prototypes.
*	* ioext.c (scm_read_delimited_x): replaces scm_read_line and
	scm_read_line_x, it's a more general procedure using an
	interface from scsh.  read-line and read-line! are now defined
	in boot-9.scm.
*  	Note that the new read-line trims the terminator
	by default, previously it was appended to the returned string.  An
	optional argument specifies how to process the terminator (scsh
	compatible).  For the old behaviour: (read-line port 'concat).
	scm_read_line, scm_read_line_x: deleted.  (read-line port 'split)
	returns a pair, but is converted to multiple values if the scsh
	module is loaded.

	socket.h: update prototypes.
	* socket.c (scm_recvfrom): for consistency with other procedures,
	take start and end as separate optional arguments.
*	(scm_recv, scm_recvfrom): don't allow the second argument
	to be a size, only a buffer.  Change the scheme names to
	recv! and recvfrom!.  Don't return the buffer.

	* ioext.h, posix.h: move prototypes too.
	* ioext.c, posix.c (scm_read_line, scm_read_line_x, scm_write_line:
	moved back from posix.c to ioext.c.  Also move #includes of "genio.h"
	"read.h" and "unif.h".
	* ioext.c: include "chars.h"
This commit is contained in:
Gary Houston 1997-01-25 18:23:49 +00:00
parent ea00ecbade
commit 1146b6cda2
15 changed files with 275 additions and 301 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1995 Free Software Foundation, Inc.
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -44,7 +44,11 @@
#include <stdio.h>
#include "fd.h"
#include "_scm.h"
#include "genio.h"
#include "read.h"
#include "fports.h"
#include "unif.h"
#include "chars.h"
#include "ioext.h"
@ -56,6 +60,96 @@
#endif
SCM_PROC (s_read_delimited_x, "%read-delimited!", 3, 3, 0, scm_read_delimited_x);
SCM
scm_read_delimited_x (delims, buf, gobble, port, start, end)
SCM delims;
SCM buf;
SCM gobble;
SCM port;
SCM start;
SCM end;
{
long j;
char *cbuf;
long cstart;
long cend;
int c;
char *cdelims;
int num_delims;
SCM_ASSERT (SCM_NIMP (delims) && SCM_STRINGP (delims),
delims, SCM_ARG1, s_read_delimited_x);
cdelims = SCM_CHARS (delims);
num_delims = SCM_LENGTH (delims);
SCM_ASSERT (SCM_NIMP (buf) && SCM_STRINGP (buf),
buf, SCM_ARG2, s_read_delimited_x);
cbuf = SCM_CHARS (buf);
cend = SCM_LENGTH (buf);
if (SCM_UNBNDP (port))
port = scm_cur_inp;
else
{
SCM_ASSERT (SCM_NIMP (port) && SCM_OPINPORTP (port),
port, SCM_ARG1, s_read_delimited_x);
}
if (SCM_UNBNDP (start))
cstart = 0;
else
{
cstart = scm_num2long (start,
(char *) SCM_ARG5, s_read_delimited_x);
if (cstart < 0 || cstart >= cend)
scm_out_of_range (s_read_delimited_x, start);
if (!SCM_UNBNDP (end))
{
long tend = scm_num2long (end, (char *) SCM_ARG6,
s_read_delimited_x);
if (tend <= cstart || tend > cend)
scm_out_of_range (s_read_delimited_x, end);
cend = tend;
}
}
for (j = cstart; j < cend; j++)
{
int k;
c = scm_gen_getc (port);
for (k = 0; k < num_delims; k++)
{
if (cdelims[k] == c)
{
if (SCM_FALSEP (gobble))
scm_gen_ungetc (c, port);
return scm_cons (SCM_MAKICHR (c),
scm_long2num (j - cstart));
}
}
if (c == EOF)
return scm_cons (SCM_EOF_VAL,
scm_long2num (j - cstart));
cbuf[j] = c;
}
return scm_cons (SCM_BOOL_F, scm_long2num (j - cstart));
}
SCM_PROC (s_write_line, "write-line", 1, 1, 0, scm_write_line);
SCM
scm_write_line (obj, port)
SCM obj;
SCM port;
{
scm_display (obj, port);
return scm_newline (port);
}
SCM_PROC (s_sys_ftell, "ftell", 1, 0, 0, scm_sys_ftell);
SCM