aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-05-10 08:02:03 +0300
committerSergey Poznyakoff <gray@gnu.org>2019-05-10 08:02:03 +0300
commit9223032f5025f8bc4820dfdfb081be1c7fcd1c4e (patch)
treee1209bcc78f5a48673c36ea5ad4d820f4ab1bd98
parent462c760d4605787a6f5baecc87dfee5e8ee5238b (diff)
downloadsmap-9223032f5025f8bc4820dfdfb081be1c7fcd1c4e.tar.gz
smap-9223032f5025f8bc4820dfdfb081be1c7fcd1c4e.tar.bz2
Support for Guile 2.2
* NEWS: Update. * README: Update. * configure.ac: Drop support for Guile versions prior to 2.2 and Mailutils prior to 3.0 * modules/guile/getpw.scm: Use inet-ntop instead of the withdrawn inet-ntoa. * modules/guile/guile.c: Rewrite for Guile 2.2
-rw-r--r--NEWS9
-rw-r--r--README8
-rw-r--r--configure.ac10
-rw-r--r--modules/guile/getpw.scm4
-rw-r--r--modules/guile/guile.c89
5 files changed, 36 insertions, 84 deletions
diff --git a/NEWS b/NEWS
index efe0707..d8b87f3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,2 @@
1Smap NEWS -- history of user-visible changes. 2015-06-20 1Smap NEWS -- history of user-visible changes. 2019-05-10
2Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff
3See the end of file for copying conditions. 2See the end of file for copying conditions.
@@ -5,2 +4,6 @@ See the end of file for copying conditions.
5Please send Smap bug reports to <gray+smap@gnu.org.ua> 4Please send Smap bug reports to <gray+smap@gnu.org.ua>
5
6Version 2.0.90 (git)
7
8* Support for Guile 2.2
6 9
@@ -76,3 +79,3 @@ Copyright information:
76 79
77Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff 80Copyright (C) 2006-2019 Sergey Poznyakoff
78 81
diff --git a/README b/README
index 170a593..5130d82 100644
--- a/README
+++ b/README
@@ -1,3 +1,3 @@
1Smap README 1Smap README
2Copyright (C) 2006-2010, 2014 Sergey Poznyakoff 2See end of file for copying conditions.
3 3
@@ -72,3 +72,3 @@ Compile with GNU Mailutils, build the `mailutils' module. By default,
72this is enabled if configure determines that a sufficiently new 72this is enabled if configure determines that a sufficiently new
73version of GNU Mailutils (i.e. 2.0 or newer) is installed. 73version of GNU Mailutils (i.e. 3.0 or newer) is installed.
74 74
@@ -81,3 +81,3 @@ Compile with Guile support; build the `guile' module. By default,
81this is enabled if configure determines that a sufficiently new 81this is enabled if configure determines that a sufficiently new
82version of Guile (i.e. 1.8 or newer) is installed. 82version of Guile (i.e. 2.2 or newer) is installed.
83 83
@@ -111,3 +111,3 @@ will remain intact.
111 111
112Copyright (C) 2006, 2007, 2008, 2009, 2010 Sergey Poznyakoff 112Copyright (C) 2006-2019 Sergey Poznyakoff
113 113
diff --git a/configure.ac b/configure.ac
index 8bec28d..46774b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,3 +1,3 @@
1# This file is part of Smap. -*- autoconf -*- 1# This file is part of Smap. -*- autoconf -*-
2# Copyright (C) 2010, 2014-2016 Sergey Poznyakoff 2# Copyright (C) 2010, 2014-2019 Sergey Poznyakoff
3# 3#
@@ -22,3 +22,5 @@ AC_INIT([smap],
22 SMAP_VERSION_MAJOR.SMAP_VERSION_MINOR[]m4_ifdef([SMAP_VERSION_PATCH],.SMAP_VERSION_PATCH), 22 SMAP_VERSION_MAJOR.SMAP_VERSION_MINOR[]m4_ifdef([SMAP_VERSION_PATCH],.SMAP_VERSION_PATCH),
23 [gray+smap@gnu.org.ua]) 23 [gray+smap@gnu.org.ua],
24 [smap],
25 [http://smap.software.gnu.org.ua])
24AC_CONFIG_SRCDIR([src/smapd.c]) 26AC_CONFIG_SRCDIR([src/smapd.c])
@@ -103,3 +105,3 @@ AC_ARG_WITH([mailutils],
103if test $status_mailutils != no; then 105if test $status_mailutils != no; then
104 AM_GNU_MAILUTILS(2.99.992, [all], 106 AM_GNU_MAILUTILS(3.0, [all],
105 [status_mailutils=yes], 107 [status_mailutils=yes],
@@ -114,3 +116,3 @@ AM_CONDITIONAL([MAILUTILS_COND],[test $status_mailutils = yes])
114# Guile 116# Guile
115GINT_INIT([gint],[1.8 with-guile nodoc], 117GINT_INIT([gint],[2.2.0 with-guile nodoc],
116 [status_guile=yes], 118 [status_guile=yes],
diff --git a/modules/guile/getpw.scm b/modules/guile/getpw.scm
index 168badb..2a8bc39 100644
--- a/modules/guile/getpw.scm
+++ b/modules/guile/getpw.scm
@@ -1,3 +1,3 @@
1;;;; This file is part of Smap. 1;;;; This file is part of Smap.
2;;;; Copyright (C) 2010, 2014 Sergey Poznyakoff 2;;;; Copyright (C) 2010, 2014, 2019 Sergey Poznyakoff
3;;;; 3;;;;
@@ -89,3 +89,3 @@
89 (if (= (sockaddr:fam src) AF_INET) 89 (if (= (sockaddr:fam src) AF_INET)
90 (inet-ntoa (sockaddr:addr src)) 90 (inet-ntop AF_INET (sockaddr:addr src))
91 "UNIX socket"))) 91 "UNIX socket")))
diff --git a/modules/guile/guile.c b/modules/guile/guile.c
index ae63a51..2ce66c5 100644
--- a/modules/guile/guile.c
+++ b/modules/guile/guile.c
@@ -1,3 +1,3 @@
1/* This file is part of Smap. 1/* This file is part of Smap.
2 Copyright (C) 2010, 2014, 2015 Sergey Poznyakoff 2 Copyright (C) 2010, 2014, 2015, 2019 Sergey Poznyakoff
3 3
@@ -173,3 +173,3 @@ argv_to_scm(int argc, char **argv)
173 173
174static scm_t_bits scm_tc16_smap_output_port; 174static scm_t_port_type *scm_smap_output_port_type;
175struct _guile_smap_output_port { 175struct _guile_smap_output_port {
@@ -182,17 +182,8 @@ _make_smap_output_port(smap_stream_t stream)
182 struct _guile_smap_output_port *dp; 182 struct _guile_smap_output_port *dp;
183 SCM port;
184 scm_port *pt;
185 183
186 dp = scm_gc_malloc(sizeof (struct _guile_smap_output_port), 184 dp = scm_gc_typed_calloc (struct _guile_smap_output_port);
187 "smap-output_-port");
188 dp->stream = stream; 185 dp->stream = stream;
189 186 return scm_c_make_port (scm_smap_output_port_type,
190 port = scm_new_port_table_entry(scm_tc16_smap_output_port); 187 SCM_WRTNG | SCM_BUF0,
191 pt = SCM_PTAB_ENTRY(port); 188 (scm_t_bits) dp);
192 pt->rw_random = 0;
193 SCM_SET_CELL_TYPE(port,
194 (scm_tc16_smap_output_port |
195 SCM_OPN | SCM_WRTNG | SCM_BUF0));
196 SCM_SETSTREAM(port, dp);
197 return port;
198} 189}
@@ -201,18 +192,3 @@ _make_smap_output_port(smap_stream_t stream)
201 192
202static SCM
203_smap_output_port_mark(SCM port)
204{
205 return SCM_BOOL_F;
206}
207
208static void 193static void
209_smap_output_port_flush(SCM port)
210{
211 scm_port *pt = SCM_PTAB_ENTRY(port);
212 struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port);
213 if (dp && pt->write_pos > pt->write_buf)
214 smap_stream_write(dp->stream, "\n", 1, NULL);
215}
216
217static int
218_smap_output_port_close(SCM port) 194_smap_output_port_close(SCM port)
@@ -221,35 +197,13 @@ _smap_output_port_close(SCM port)
221 197
222 if (dp) { 198 if (dp && dp->stream) {
223 _smap_output_port_flush(port); 199 smap_stream_flush(dp->stream);
224 SCM_SETSTREAM(port, NULL);
225 scm_gc_free(dp, sizeof(struct _guile_smap_output_port),
226 "smap-output-port");
227 } 200 }
228 return 0;
229} 201}
230 202
231static scm_sizet 203static size_t
232_smap_output_port_free(SCM port) 204_smap_output_port_write(SCM port, SCM src, size_t start, size_t count)
233{
234 _smap_output_port_close(port);
235 return 0;
236}
237
238static int
239_smap_output_port_fill_input(SCM port)
240{
241 return EOF;
242}
243
244static void
245_smap_output_port_write(SCM port, const void *data, size_t size)
246{ 205{
247 struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port); 206 struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port);
248 smap_stream_write(dp->stream, data, size, NULL); 207 smap_stream_write(dp->stream, SCM_BYTEVECTOR_CONTENTS (src) + start, count, NULL);
249} 208 return count;
250
251static scm_t_off
252_smap_output_port_seek (SCM port, scm_t_off offset, int whence)
253{
254 return -1;
255} 209}
@@ -266,15 +220,8 @@ _init_smap_output_port()
266{ 220{
267 scm_tc16_smap_output_port = scm_make_port_type("smap-output-port", 221 scm_smap_output_port_type = scm_make_port_type("smap-output-port",
268 _smap_output_port_fill_input, 222 NULL,
269 _smap_output_port_write); 223 _smap_output_port_write);
270 scm_set_port_mark (scm_tc16_smap_output_port, _smap_output_port_mark); 224 scm_set_port_print(scm_smap_output_port_type, _smap_output_port_print);
271 scm_set_port_free (scm_tc16_smap_output_port, _smap_output_port_free); 225 scm_set_port_close(scm_smap_output_port_type, _smap_output_port_close);
272 scm_set_port_print (scm_tc16_smap_output_port, 226 scm_set_port_needs_close_on_gc(scm_smap_output_port_type, 1);
273 _smap_output_port_print);
274 scm_set_port_flush (scm_tc16_smap_output_port,
275 _smap_output_port_flush);
276 scm_set_port_close (scm_tc16_smap_output_port,
277 _smap_output_port_close);
278 scm_set_port_seek (scm_tc16_smap_output_port,
279 _smap_output_port_seek);
280} 227}

Return to:

Send suggestions and report system problems to the System administrator.