summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libguile/ChangeLog13
-rw-r--r--libguile/gdbint.c4
-rw-r--r--libguile/ports.c2
-rw-r--r--libguile/ports.h9
-rw-r--r--libguile/strports.c8
-rw-r--r--libguile/vports.c10
6 files changed, 30 insertions, 16 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index a791c2334..98be38ad2 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,3 +1,16 @@
+2000-03-31 Dirk Herrmann <D.Herrmann@tu-bs.de>
+
+ * ports.h (scm_port): Change type of stream member to scm_bits_t.
+
+ * gdbint.c (unmark_port, remark_port), ports.c (scm_markstream),
+ strports.c (st_resize_port, scm_mkstrport), vports (sf_flush,
+ sf_write, sf_fill_input, sf_close, scm_make_soft_port): Since
+ streams are now of type scm_bits_t, SCM streams have to be
+ unpacked/packed.
+
+ * ports.h (SCM_SETPTAB_ENTRY, SCM_SETSTREAM): Cast input to
+ scm_bits_t.
+
2000-03-31 Mikael Djurfeldt <mdj@thalamus.nada.kth.se>
* coop-defs.h (struct coop_t): Added `sto'-field again because of
diff --git a/libguile/gdbint.c b/libguile/gdbint.c
index 435afb559..1ce183094 100644
--- a/libguile/gdbint.c
+++ b/libguile/gdbint.c
@@ -145,7 +145,7 @@ unmark_port (SCM port)
SCM stream, string;
port_mark_p = SCM_GC8MARKP (port);
SCM_CLRGC8MARK (port);
- stream = SCM_STREAM (port);
+ stream = SCM_PACK (SCM_STREAM (port));
stream_mark_p = SCM_GCMARKP (stream);
SCM_CLRGCMARK (stream);
string = SCM_CDR (stream);
@@ -157,7 +157,7 @@ unmark_port (SCM port)
static void
remark_port (SCM port)
{
- SCM stream = SCM_STREAM (port);
+ SCM stream = SCM_PACK (SCM_STREAM (port));
SCM string = SCM_CDR (stream);
if (string_mark_p) SCM_SETGC8MARK (string);
if (stream_mark_p) SCM_SETGCMARK (stream);
diff --git a/libguile/ports.c b/libguile/ports.c
index 2215b4529..5f941c5b6 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -93,7 +93,7 @@ scm_markstream (SCM ptr)
int openp;
openp = SCM_UNPACK_CAR (ptr) & SCM_OPN;
if (openp)
- return SCM_STREAM (ptr);
+ return SCM_PACK (SCM_STREAM (ptr));
else
return SCM_BOOL_F;
}
diff --git a/libguile/ports.h b/libguile/ports.h
index f8c56fa32..152264535 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -74,9 +74,8 @@ typedef struct
int revealed; /* 0 not revealed, > 1 revealed.
* Revealed ports do not get GC'd.
*/
- /* data for the underlying port implementation. may be an SCM cell or
- cast to a pointer to C data. */
- SCM stream;
+ /* data for the underlying port implementation as a raw C value. */
+ scm_bits_t stream;
SCM file_name; /* debugging support. */
int line_number; /* debugging support. */
@@ -163,9 +162,9 @@ extern int scm_port_table_size; /* Number of ports in scm_port_table. */
#define SCM_CLOSEDP(x) (!SCM_OPENP(x))
#define SCM_PTAB_ENTRY(x) ((scm_port *) SCM_CELL_WORD_1 (x))
-#define SCM_SETPTAB_ENTRY(x,ent) (SCM_SET_CELL_WORD_1 ((x), (ent)))
+#define SCM_SETPTAB_ENTRY(x,ent) (SCM_SET_CELL_WORD_1 ((x), (scm_bits_t) (ent)))
#define SCM_STREAM(x) (SCM_PTAB_ENTRY(x)->stream)
-#define SCM_SETSTREAM(x,s) (SCM_PTAB_ENTRY(x)->stream = (SCM) (s))
+#define SCM_SETSTREAM(x,s) (SCM_PTAB_ENTRY(x)->stream = (scm_bits_t) (s))
#define SCM_FILENAME(x) (SCM_PTAB_ENTRY(x)->file_name)
#define SCM_LINUM(x) (SCM_PTAB_ENTRY(x)->line_number)
#define SCM_COL(x) (SCM_PTAB_ENTRY(x)->column_number)
diff --git a/libguile/strports.c b/libguile/strports.c
index 31d92f36d..4a1fc09c5 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -95,15 +95,17 @@ stfill_buffer (SCM port)
static void
st_resize_port (scm_port *pt, off_t new_size)
{
+ SCM stream = SCM_PACK (pt->stream);
+
off_t index = pt->write_pos - pt->write_buf;
pt->write_buf_size = new_size;
- scm_vector_set_length_x (pt->stream, SCM_MAKINUM (new_size));
+ scm_vector_set_length_x (stream, SCM_MAKINUM (new_size));
/* reset buffer in case reallocation moved the string. */
{
- pt->read_buf = pt->write_buf = SCM_CHARS (pt->stream);
+ pt->read_buf = pt->write_buf = SCM_CHARS (stream);
pt->read_pos = pt->write_pos = pt->write_buf + index;
pt->write_end = pt->write_buf + pt->write_buf_size;
pt->read_end = pt->read_buf + pt->read_buf_size;
@@ -273,7 +275,7 @@ scm_mkstrport (SCM pos, SCM str, long modes, const char *caller)
pt = scm_add_to_port_table (z);
SCM_SETCAR (z, scm_tc16_strport | modes);
SCM_SETPTAB_ENTRY (z, pt);
- SCM_SETSTREAM (z, str);
+ SCM_SETSTREAM (z, SCM_UNPACK (str));
pt->write_buf = pt->read_buf = SCM_ROCHARS (str);
pt->read_pos = pt->write_pos = pt->read_buf + SCM_INUM (pos);
pt->write_buf_size = pt->read_buf_size = str_len;
diff --git a/libguile/vports.c b/libguile/vports.c
index 3a7cd99cc..fb3a6fb7a 100644
--- a/libguile/vports.c
+++ b/libguile/vports.c
@@ -71,7 +71,7 @@ static void
sf_flush (SCM port)
{
scm_port *pt = SCM_PTAB_ENTRY (port);
- SCM stream = pt->stream;
+ SCM stream = SCM_PACK (pt->stream);
if (pt->write_pos > pt->write_buf)
{
@@ -93,7 +93,7 @@ sf_flush (SCM port)
static void
sf_write (SCM port, const void *data, size_t size)
{
- SCM p = SCM_STREAM (port);
+ SCM p = SCM_PACK (SCM_STREAM (port));
scm_apply (SCM_VELTS (p)[1],
scm_cons (scm_makfromstr ((char *) data, size, 0), SCM_EOL),
@@ -108,7 +108,7 @@ sf_write (SCM port, const void *data, size_t size)
static int
sf_fill_input (SCM port)
{
- SCM p = SCM_STREAM (port);
+ SCM p = SCM_PACK (SCM_STREAM (port));
SCM ans;
ans = scm_apply (SCM_VELTS (p)[3], SCM_EOL, SCM_EOL); /* get char. */
@@ -129,7 +129,7 @@ sf_fill_input (SCM port)
static int
sf_close (SCM port)
{
- SCM p = SCM_STREAM (port);
+ SCM p = SCM_PACK (SCM_STREAM (port));
SCM f = SCM_VELTS (p)[4];
if (SCM_BOOL_F == f)
return 0;
@@ -190,7 +190,7 @@ SCM_DEFINE (scm_make_soft_port, "make-soft-port", 2, 0, 0,
scm_port_non_buffer (pt);
SCM_SETCAR (z, scm_tc16_sfport | scm_mode_bits (SCM_ROCHARS (modes)));
SCM_SETPTAB_ENTRY (z, pt);
- SCM_SETSTREAM (z, pv);
+ SCM_SETSTREAM (z, SCM_UNPACK (pv));
SCM_ALLOW_INTS;
return z;
}