* Added a file-port? primitive.

This commit is contained in:
Dirk Herrmann 2001-01-25 17:40:50 +00:00
commit efa40607b1
4 changed files with 20 additions and 0 deletions

4
NEWS
View file

@ -262,6 +262,10 @@ Instead, use scm_c_memq or scm_memq, scm_memv, scm_member.
Returns a boolean indicating whether X is a port. Equivalent to
`(or (input-port? X) (output-port? X))'.
** New function: file-port?
Determines whether a given object is a port that is related to a file.
** New function: port-for-each proc
Apply PROC to each port in the Guile port table in turn. The

View file

@ -1,3 +1,7 @@
2001-01-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
* fports.[ch] (scm_file_port_p): New primitive.
2001-01-25 Dirk Herrmann <D.Herrmann@tu-bs.de>
* tags.h (scm_tc16_fport, scm_tc16_strport, scm_tc16_sfport):

View file

@ -226,6 +226,17 @@ scm_evict_ports (int fd)
}
}
SCM_DEFINE (scm_file_port_p, "file-port?", 1, 0, 0,
(SCM obj),
"Determine whether OBJ is a port that is related to a file.")
#define FUNC_NAME s_scm_file_port_p
{
return SCM_BOOL (SCM_FPORTP (obj));
}
#undef FUNC_NAME
/* scm_open_file
* Return a new port open on a given file.
*

View file

@ -77,6 +77,7 @@ extern SCM scm_setvbuf (SCM port, SCM mode, SCM size);
extern void scm_evict_ports (int fd);
extern SCM scm_open_file (SCM filename, SCM modes);
extern SCM scm_fdes_to_port (int fdes, char *mode, SCM name);
extern SCM scm_file_port_p (SCM obj);
extern void scm_init_fports (void);
#endif /* FPORTSH */