summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2018-06-02 12:09:54 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2018-06-02 12:20:24 +0200
commitb489f28373b6567fcace9160b506a811a506c8e0 (patch)
tree037d9656d7ddb4087ced72c226108f9baf3a48d5
parentea7d5699d39c418101c9c0f01fe96acc19b27582 (diff)
downloadmailutils-b489f28373b6567fcace9160b506a811a506c8e0.tar.gz
mailutils-b489f28373b6567fcace9160b506a811a506c8e0.tar.bz2
Switch to Guile 2.2.0
* configure.ac" Set minimum supported Guile version to 2.2.0 * libmu_scm/mu_body.c: Rewrite. * libmu_scm/mu_dbgport.c: Rewrite. * libmu_scm/mu_mailbox.c: Update types. * libmu_scm/mu_message.c: Likewise. * libmu_scm/mu_mime.c: Likewise. * libmu_scm/mu_port.c: Likewise.
-rw-r--r--.gitignore2
-rw-r--r--NEWS4
-rw-r--r--configure.ac2
-rw-r--r--libmu_scm/mu_body.c2
-rw-r--r--libmu_scm/mu_dbgport.c74
-rw-r--r--libmu_scm/mu_mailbox.c2
-rw-r--r--libmu_scm/mu_message.c2
-rw-r--r--libmu_scm/mu_mime.c2
-rw-r--r--libmu_scm/mu_port.c230
-rw-r--r--po/.gitignore8
10 files changed, 70 insertions, 258 deletions
diff --git a/.gitignore b/.gitignore
index 76a1ffccc..60b2e0dbe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+/ABOUT-NLS
+/build-aux
/config.rpath
*.a
*.cflow
diff --git a/NEWS b/NEWS
index 261d3fb6b..268615fb2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU mailutils NEWS -- history of user-visible changes. 2018-01-19
+GNU mailutils NEWS -- history of user-visible changes. 2018-06-02
Copyright (C) 2002-2018 Free Software Foundation, Inc.
See the end of file for copying conditions.
@@ -6,6 +6,8 @@ Please send mailutils bug reports to <bug-mailutils@gnu.org>.
Version 3.4.90 (Git)
+* Dropped support for Guile version prior to 2.2.0
+
* headline variable in the mail utility
The new %D specifier has been implemented, which allows the user to
diff --git a/configure.ac b/configure.ac
index 9351f137c..a21a1561a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1160,7 +1160,7 @@ AC_SUBST([GUILE_BINDIR])
AC_SUBST([LIBMU_SCM])
AC_SUBST([LIBMU_SCM_DEPS])
AC_SUBST([MU_GUILE_SIEVE_MOD_DIR])
-GINT_INIT([gint],[1.8 with-guile],
+GINT_INIT([gint],[2.2.0 with-guile],
[useguile=yes
AC_DEFINE([WITH_GUILE],1,[Enable Guile support])
GUILE_BINDIR=`guile-config info bindir`
diff --git a/libmu_scm/mu_body.c b/libmu_scm/mu_body.c
index c54fabbce..fa4652da1 100644
--- a/libmu_scm/mu_body.c
+++ b/libmu_scm/mu_body.c
@@ -40,7 +40,7 @@ mu_scm_body_mark (SCM body_smob)
return mbp->msg;
}
-static scm_sizet
+static size_t
mu_scm_body_free (SCM body_smob)
{
struct mu_body *mbp = (struct mu_body *) SCM_CDR (body_smob);
diff --git a/libmu_scm/mu_dbgport.c b/libmu_scm/mu_dbgport.c
index f4a0032e9..304714cf9 100644
--- a/libmu_scm/mu_dbgport.c
+++ b/libmu_scm/mu_dbgport.c
@@ -23,81 +23,45 @@ struct _mu_debug_port
int level;
};
-static long scm_tc16_mu_debug_port;
+static scm_t_port_type *scm_mu_debug_port_type;
SCM
mu_scm_make_debug_port (int level)
{
struct _mu_debug_port *dp;
- SCM port;
- scm_port *pt;
mu_stream_t str;
if (mu_dbgstream_create (&str, level))
return SCM_BOOL_F;
- dp = scm_gc_malloc (sizeof (struct _mu_debug_port), "mu-debug-port");
+
+ dp = scm_gc_typed_calloc (struct _mu_debug_port);
dp->level = level;
dp->stream = str;
- port = scm_cell (scm_tc16_mu_debug_port, 0);
- pt = scm_add_to_port_table (port);
- SCM_SETPTAB_ENTRY (port, pt);
- pt->rw_random = 0;
- SCM_SET_CELL_TYPE (port,
- (scm_tc16_mu_debug_port | SCM_OPN | SCM_WRTNG |
- SCM_BUF0));
- SCM_SETSTREAM (port, dp);
- return port;
+ return scm_c_make_port (scm_mu_debug_port_type, SCM_WRTNG, (scm_t_bits) dp);
}
#define MU_DEBUG_PORT(x) ((struct _mu_debug_port *) SCM_STREAM (x))
-static SCM
-_mu_debug_port_mark (SCM port)
-{
- return SCM_BOOL_F;
-}
-
static void
-_mu_debug_port_flush (SCM port)
-{
- /* struct _mu_debug_port *dp = MU_DEBUG_PORT (port); */
-
- /* FIXME: */
-}
-
-static int
_mu_debug_port_close (SCM port)
{
struct _mu_debug_port *dp = MU_DEBUG_PORT (port);
- if (dp)
+ if (dp && dp->stream)
{
- _mu_debug_port_flush (port);
- SCM_SETSTREAM (port, NULL);
- scm_gc_free (dp, sizeof (struct _mu_debug_port), "mu-debug-port");
+ mu_stream_flush (dp->stream);
+ mu_stream_destroy (&dp->stream);
}
- return 0;
}
-static scm_sizet
-_mu_debug_port_free (SCM port)
-{
- _mu_debug_port_close (port);
- return 0;
-}
-
-static int
-_mu_debug_port_fill_input (SCM port)
-{
- return EOF;
-}
-
-static void
-_mu_debug_port_write (SCM port, const void *data, size_t size)
+static size_t
+_mu_debug_port_write (SCM port, SCM src, size_t start, size_t count)
{
struct _mu_debug_port *dp = MU_DEBUG_PORT (port);
- mu_stream_write (dp->stream, data, size, NULL);
+ mu_stream_write (dp->stream, SCM_BYTEVECTOR_CONTENTS (src) + start, count,
+ NULL);
+ return count;
}
static int
@@ -108,14 +72,12 @@ _mu_debug_port_print (SCM exp, SCM port, scm_print_state * pstate)
}
void
-mu_scm_debug_port_init ()
+mu_scm_debug_port_init (void)
{
- scm_tc16_mu_debug_port = scm_make_port_type ("mu-debug-port",
- _mu_debug_port_fill_input,
+ scm_mu_debug_port_type = scm_make_port_type ("mu-debug-port",
+ NULL,
_mu_debug_port_write);
- scm_set_port_mark (scm_tc16_mu_debug_port, _mu_debug_port_mark);
- scm_set_port_free (scm_tc16_mu_debug_port, _mu_debug_port_free);
- scm_set_port_print (scm_tc16_mu_debug_port, _mu_debug_port_print);
- scm_set_port_flush (scm_tc16_mu_debug_port, _mu_debug_port_flush);
- scm_set_port_close (scm_tc16_mu_debug_port, _mu_debug_port_close);
+ scm_set_port_print (scm_mu_debug_port_type, _mu_debug_port_print);
+ scm_set_port_close (scm_mu_debug_port_type, _mu_debug_port_close);
+ scm_set_port_needs_close_on_gc (scm_mu_debug_port_type, 1);
}
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index 4949fa2c1..68d1f68c7 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -37,7 +37,7 @@ mu_scm_mailbox_mark (SCM mailbox_smob)
return SCM_BOOL_F;
}
-static scm_sizet
+static size_t
mu_scm_mailbox_free (SCM mailbox_smob)
{
struct mu_mailbox *mum = (struct mu_mailbox *) SCM_CDR (mailbox_smob);
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index 6208bdec2..ee77d6d4b 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -39,7 +39,7 @@ mu_scm_message_mark (SCM message_smob)
return mum->mbox;
}
-static scm_sizet
+static size_t
mu_scm_message_free (SCM message_smob)
{
struct mu_message *mum = (struct mu_message *) SCM_CDR (message_smob);
diff --git a/libmu_scm/mu_mime.c b/libmu_scm/mu_mime.c
index 1cf34b13c..2346d2c48 100644
--- a/libmu_scm/mu_mime.c
+++ b/libmu_scm/mu_mime.c
@@ -35,7 +35,7 @@ mu_scm_mime_mark (SCM mime_smob)
return mum->owner;
}
-static scm_sizet
+static size_t
mu_scm_mime_free (SCM mime_smob)
{
struct mu_mime *mum = (struct mu_mime *) SCM_CDR (mime_smob);
diff --git a/libmu_scm/mu_port.c b/libmu_scm/mu_port.c
index 702034e35..f24042046 100644
--- a/libmu_scm/mu_port.c
+++ b/libmu_scm/mu_port.c
@@ -29,227 +29,69 @@ struct mu_port
SCM msg; /* Message the port belongs to */
};
-#define DEFAULT_BUF_SIZE 1024
#define MU_PORT(x) ((struct mu_port *) SCM_STREAM (x))
-static void
-mu_port_alloc_buffer (SCM port, size_t read_size, size_t write_size)
-{
- scm_port *pt = SCM_PTAB_ENTRY (port);
- static char *s_mu_port_alloc_buffer = "mu_port_alloc_buffer";
-
- if (!read_size)
- read_size = DEFAULT_BUF_SIZE;
- if (!write_size)
- write_size = DEFAULT_BUF_SIZE;
-
- if (SCM_INPUT_PORT_P (port))
- {
- pt->read_buf = malloc (read_size);
- if (pt->read_buf == NULL)
- scm_memory_error (s_mu_port_alloc_buffer);
- pt->read_pos = pt->read_end = pt->read_buf;
- pt->read_buf_size = read_size;
- }
- else
- {
- pt->read_pos = pt->read_buf = pt->read_end = &pt->shortbuf;
- pt->read_buf_size = 1;
- }
-
- if (SCM_OUTPUT_PORT_P (port))
- {
- pt->write_buf = malloc (write_size);
- if (pt->write_buf == NULL)
- scm_memory_error (s_mu_port_alloc_buffer);
- pt->write_pos = pt->write_buf;
- pt->write_buf_size = write_size;
- pt->write_end = pt->write_buf + pt->write_buf_size;
- }
- else
- {
- pt->write_buf = pt->write_pos = &pt->shortbuf;
- pt->write_buf_size = 1;
- }
-
- SCM_SET_CELL_WORD_0 (port, SCM_CELL_WORD_0 (port) & ~SCM_BUF0);
-}
-
-static long scm_tc16_smuport;
+static scm_t_port_type *scm_mu_port_type;
SCM
mu_port_make_from_stream (SCM msg, mu_stream_t stream, long mode)
{
struct mu_port *mp;
- SCM port;
- scm_port *pt;
- int flags;
-
- mp = scm_gc_malloc (sizeof (struct mu_port), "mu-port");
+
+ mp = scm_gc_typed_calloc (struct mu_port);
mp->msg = msg;
mp->stream = stream;
-
- port = scm_new_port_table_entry (scm_tc16_smuport | mode);
- pt = SCM_PTAB_ENTRY (port);
- mu_stream_get_flags (stream, &flags);
- pt->rw_random = flags & MU_STREAM_SEEK;
- SCM_SETSTREAM (port, mp);
- mu_port_alloc_buffer (port, 0, 0);
- /* FIXME:
- SCM_PTAB_ENTRY (port)->file_name = "name";*/
- return port;
-}
-
-static SCM
-mu_port_mark (SCM port)
-{
- if (SCM_CELL_WORD_0 (port) & SCM_OPN)
- {
- struct mu_port *mp = MU_PORT (port);
- return mp->msg;
- }
- return SCM_BOOL_F;
+ return scm_c_make_port (scm_mu_port_type, mode, (scm_t_bits) mp);
}
static void
-mu_port_flush (SCM port)
-{
- struct mu_port *mp = MU_PORT (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
- int wrsize = pt->write_pos - pt->write_buf;
-
- if (wrsize)
- {
- int status = mu_stream_write (mp->stream, pt->write_buf, wrsize, NULL);
- if (status)
- mu_scm_error ("mu_port_flush", status,
- "Error writing to stream", SCM_BOOL_F);
- }
- pt->write_pos = pt->write_buf;
- pt->rw_active = SCM_PORT_NEITHER;
-}
-
-static int
mu_port_close (SCM port)
{
struct mu_port *mp = MU_PORT (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
-
- mu_port_flush (port);
- mu_stream_close (mp->stream);
- SCM_SETSTREAM (port, NULL);
-
- if (pt->read_buf != &pt->shortbuf)
- free (pt->read_buf);
- if (pt->write_buf != &pt->shortbuf)
- free (pt->write_buf);
- free (mp);
- return 0;
-}
-
-static scm_sizet
-mu_port_free (SCM port)
-{
- struct mu_port *mp = MU_PORT (port);
- mu_stream_unref (mp->stream);
- mu_port_close (port);
- return 0;
+ mu_stream_destroy (&mp->stream);
}
-static int
-mu_port_fill_input (SCM port)
+static size_t
+mu_port_read (SCM port, SCM dst, size_t start, size_t count)
{
struct mu_port *mp = MU_PORT (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
- size_t nread = 0;
int status;
+ size_t nread;
- status = mu_stream_read (mp->stream, (char*) pt->read_buf, pt->read_buf_size,
+ status = mu_stream_read (mp->stream,
+ SCM_BYTEVECTOR_CONTENTS (dst) + start,
+ count,
&nread);
if (status)
- mu_scm_error ("mu_port_fill_input", status,
+ mu_scm_error ("mu_port_read", status,
"Error reading from stream", SCM_BOOL_F);
-
- if (nread == 0)
- return EOF;
-
- pt->read_pos = pt->read_buf;
- pt->read_end = pt->read_buf + nread;
- return *pt->read_buf;
+ return nread;
}
-
-static void
-mu_port_write (SCM port, const void *data, size_t size)
-{
- scm_port *pt = SCM_PTAB_ENTRY (port);
- size_t remaining = size;
- char *input = (char*) data;
- while (remaining > 0)
- {
- int space = pt->write_end - pt->write_pos;
- int write_len = (remaining > space) ? space : remaining;
-
- memcpy (pt->write_pos, input, write_len);
- pt->write_pos += write_len;
- remaining -= write_len;
- input += write_len;
- if (write_len == space)
- mu_port_flush (port);
- }
-}
-
-/* Perform the synchronisation required for switching from input to
- output on the port.
- Clear the read buffer and adjust the file position for unread bytes. */
-static void
-mu_port_end_input (SCM port, int offset)
+static size_t
+mu_port_write (SCM port, SCM src, size_t start, size_t count)
{
struct mu_port *mp = MU_PORT (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
- int delta = pt->read_end - pt->read_pos;
-
- offset += delta;
+ int status;
+ size_t nwrite;
- if (offset > 0)
- {
- pt->read_pos = pt->read_end;
- mu_stream_seek (mp->stream, - delta, MU_SEEK_CUR, NULL);
- }
- pt->rw_active = SCM_PORT_NEITHER;
+ status = mu_stream_write (mp->stream,
+ SCM_BYTEVECTOR_CONTENTS (src) + start, count,
+ &nwrite);
+ if (status)
+ mu_scm_error ("mu_port_read", status,
+ "Error reading from stream", SCM_BOOL_F);
+ return nwrite;
}
static scm_t_off
mu_port_seek (SCM port, scm_t_off offset, int whence)
{
struct mu_port *mp = MU_PORT (port);
- scm_port *pt = SCM_PTAB_ENTRY (port);
- int mwhence;
mu_off_t pos;
int status;
-
- if (pt->rw_active == SCM_PORT_WRITE)
- {
- mu_port_flush (port);
- }
- else if (pt->rw_active == SCM_PORT_READ)
- {
- scm_end_input (port);
- }
-
- switch (whence)
- {
- case SEEK_SET:
- mwhence = MU_SEEK_SET;
- break;
- case SEEK_CUR:
- mwhence = MU_SEEK_CUR;
- break;
- case SEEK_END:
- mwhence = MU_SEEK_END;
- }
- status = mu_stream_seek (mp->stream, offset, mwhence, &pos);
+ status = mu_stream_seek (mp->stream, offset, whence, &pos);
if (status)
pos = -1;
return (scm_t_off) pos;
@@ -262,7 +104,7 @@ mu_port_truncate (SCM port, mu_off_t length)
int status;
status = mu_stream_truncate (mp->stream, length);
if (status)
- mu_scm_error ("mu_stream_truncate", status,
+ mu_scm_error ("mu_port_truncate", status,
"Error truncating stream", SCM_BOOL_F);
}
@@ -290,17 +132,13 @@ mu_port_print (SCM exp, SCM port, scm_print_state *pstate)
}
void
-mu_scm_port_init ()
+mu_scm_port_init (void)
{
- scm_tc16_smuport = scm_make_port_type ("mu-port",
- mu_port_fill_input, mu_port_write);
- scm_set_port_mark (scm_tc16_smuport, mu_port_mark);
- scm_set_port_free (scm_tc16_smuport, mu_port_free);
- scm_set_port_print (scm_tc16_smuport, mu_port_print);
- scm_set_port_flush (scm_tc16_smuport, mu_port_flush);
- scm_set_port_end_input (scm_tc16_smuport, mu_port_end_input);
- scm_set_port_close (scm_tc16_smuport, mu_port_close);
- scm_set_port_seek (scm_tc16_smuport, mu_port_seek);
- scm_set_port_truncate (scm_tc16_smuport, mu_port_truncate);
- /* scm_set_port_input_waiting (scm_tc16_smuport, mu_port_input_waiting);*/
+ scm_mu_port_type = scm_make_port_type ("mu-port",
+ mu_port_read, mu_port_write);
+ scm_set_port_print (scm_mu_port_type, mu_port_print);
+ scm_set_port_close (scm_mu_port_type, mu_port_close);
+ scm_set_port_needs_close_on_gc (scm_mu_port_type, 1);
+ scm_set_port_seek (scm_mu_port_type, mu_port_seek);
+ scm_set_port_truncate (scm_mu_port_type, mu_port_truncate);
}
diff --git a/po/.gitignore b/po/.gitignore
index 5ae495e4d..17f17c6fb 100644
--- a/po/.gitignore
+++ b/po/.gitignore
@@ -1,3 +1,11 @@
+/remove-potcdate.sin
+/quot.sed
+/insert-header.sin
+/en@quot.header
+/en@boldquot.header
+/boldquot.sed
+/Rules-quot
+/Makevars.template
/Makefile.in.in
/Makevars.template~
/Makefile.in.in~

Return to:

Send suggestions and report system problems to the System administrator.