#ifndef FPORTSH
#define FPORTSH
-/* Copyright (C) 1995,1996,1997,1998 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999, 2000 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
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice. */
+
+/* Software engineering face-lift by Greg J. Badros, 11-Dec-1999,
+ gjb@cs.washington.edu, http://www.cs.washington.edu/homes/gjb */
\f
#include "libguile/__scm.h"
\f
-extern scm_ptobfuns scm_fptob;
-extern scm_ptobfuns scm_pipob;
+/* struct allocated for each buffered FPORT. */
+struct scm_fport {
+ int fdes; /* file descriptor. */
+};
+
+extern scm_bits_t scm_tc16_fport;
+
+#define SCM_FSTREAM(x) ((struct scm_fport *) SCM_STREAM (x))
+#define SCM_FPORT_FDES(x) (SCM_FSTREAM (x)->fdes)
+
+#define SCM_FPORTP(x) (!SCM_IMP (x) && (SCM_TYP16 (x) == scm_tc16_fport))
+#define SCM_OPFPORTP(x) (SCM_FPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_OPN))
+#define SCM_OPINFPORTP(x) (SCM_OPFPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_RDNG))
+#define SCM_OPOUTFPORTP(x) (SCM_OPFPORTP (x) && (SCM_CELL_WORD_0 (x) & SCM_WRTNG))
+
+/* test whether fdes supports random access. */
+#define SCM_FDES_RANDOM_P(fdes) ((lseek (fdes, 0, SEEK_CUR) == -1) ? 0 : 1)
\f
extern SCM scm_setbuf0 (SCM port);
extern SCM scm_setvbuf (SCM port, SCM mode, SCM size);
-extern SCM scm_freopen SCM_P ((SCM filename, SCM modes, SCM port));
-extern void scm_setfileno (FILE *fs, int fd);
extern void scm_evict_ports (int fd);
extern SCM scm_open_file (SCM filename, SCM modes);
-extern SCM scm_stdio_to_port (FILE *file, char *mode, SCM name);
-extern SCM scm_standard_stream_to_port (FILE *file, char *mode, char *name);
-extern void scm_init_fports SCM_P ((void));
+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 */
+
+/*
+ Local Variables:
+ c-file-style: "gnu"
+ End:
+*/