summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-05-10 05:02:03 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-05-10 05:02:03 (GMT)
commit9223032f5025f8bc4820dfdfb081be1c7fcd1c4e (patch) (unidiff)
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
Diffstat (more/less context) (ignore whitespace changes)
-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,8 +1,11 @@
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.
4 3
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
7 10
8Version 2.0, 2015-06-20 11Version 2.0, 2015-06-20
@@ -74,7 +77,7 @@ Version 1.0, 2010-06-19
74========================================================================= 77=========================================================================
75Copyright information: 78Copyright information:
76 79
77Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff 80Copyright (C) 2006-2019 Sergey Poznyakoff
78 81
79 Permission is granted to anyone to make or distribute verbatim copies 82 Permission is granted to anyone to make or distribute verbatim copies
80 of this document as received, in any medium, provided that the 83 of this document as received, in any medium, provided that the
diff --git a/README b/README
index 170a593..5130d82 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
1Smap README 1Smap README
2Copyright (C) 2006-2010, 2014 Sergey Poznyakoff 2See end of file for copying conditions.
3 3
4* Introduction 4* Introduction
5============== 5==============
@@ -70,7 +70,7 @@ Compile with TCP wrappers (libwrap) support. This is the default.
70 70
71Compile with GNU Mailutils, build the `mailutils' module. By default, 71Compile 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
75See http://www.gnu.org/software/mailutils for more information on GNU 75See http://www.gnu.org/software/mailutils for more information on GNU
76Mailutils including file downloads. 76Mailutils including file downloads.
@@ -79,7 +79,7 @@ Mailutils including file downloads.
79 79
80Compile with Guile support; build the `guile' module. By default, 80Compile 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
84See http://www.gnu.org/software/guile for additional information on 84See http://www.gnu.org/software/guile for additional information on
85Guile including file downloads. 85Guile including file downloads.
@@ -109,7 +109,7 @@ will remain intact.
109 109
110* Copyright information 110* Copyright information
111 111
112Copyright (C) 2006, 2007, 2008, 2009, 2010 Sergey Poznyakoff 112Copyright (C) 2006-2019 Sergey Poznyakoff
113 113
114 Permission is granted to anyone to make or distribute verbatim copies 114 Permission is granted to anyone to make or distribute verbatim copies
115 of this document as received, in any medium, provided that the 115 of this document as received, in any medium, provided that the
diff --git a/configure.ac b/configure.ac
index 8bec28d..46774b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,5 +1,5 @@
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#
4# Smap is free software; you can redistribute it and/or modify 4# Smap is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by 5# it under the terms of the GNU General Public License as published by
@@ -20,7 +20,9 @@ m4_define([SMAP_VERSION_MINOR], 0)
20m4_define([SMAP_VERSION_PATCH], 90) 20m4_define([SMAP_VERSION_PATCH], 90)
21AC_INIT([smap], 21AC_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])
25AC_CONFIG_HEADERS([config.h]) 27AC_CONFIG_HEADERS([config.h])
26AC_CONFIG_AUX_DIR([build-aux]) 28AC_CONFIG_AUX_DIR([build-aux])
@@ -101,7 +103,7 @@ AC_ARG_WITH([mailutils],
101 [status_mailutils=maybe]) 103 [status_mailutils=maybe])
102 104
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],
106 [if test $status_mailutils = yes; then 108 [if test $status_mailutils = yes; then
107 AC_MSG_ERROR([GNU Mailutils not found]) 109 AC_MSG_ERROR([GNU Mailutils not found])
@@ -112,7 +114,7 @@ fi
112AM_CONDITIONAL([MAILUTILS_COND],[test $status_mailutils = yes]) 114AM_CONDITIONAL([MAILUTILS_COND],[test $status_mailutils = yes])
113 115
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],
117 [status_guile=no]) 119 [status_guile=no])
118AM_CONDITIONAL([GUILE_COND],[test $status_guile = yes]) 120AM_CONDITIONAL([GUILE_COND],[test $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,5 +1,5 @@
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;;;;
4;;;; Smap is free software; you can redistribute it and/or modify 4;;;; Smap is free software; you can redistribute it and/or modify
5;;;; it under the terms of the GNU General Public License as published by 5;;;; it under the terms of the GNU General Public License as published by
@@ -87,7 +87,7 @@
87 (let ((src (car rest))) 87 (let ((src (car rest)))
88 (format (current-error-port) "connect from ~A~%" 88 (format (current-error-port) "connect from ~A~%"
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")))
92 ;; Select appropriate handler and call it 92 ;; Select appropriate handler and call it
93 (let ((elt (assoc map map-list))) 93 (let ((elt (assoc map map-list)))
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,5 +1,5 @@
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
4 Smap is free software; you can redistribute it and/or modify 4 Smap is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -171,7 +171,7 @@ argv_to_scm(int argc, char **argv)
171 return scm_first; 171 return scm_first;
172} 172}
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 {
176 smap_stream_t stream; 176 smap_stream_t stream;
177}; 177};
@@ -180,78 +180,32 @@ static SCM
180_make_smap_output_port(smap_stream_t stream) 180_make_smap_output_port(smap_stream_t stream)
181{ 181{
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}
199 190
200#define SMAP_OUTPUT_PORT(x) ((struct _guile_smap_output_port *) SCM_STREAM (x)) 191#define SMAP_OUTPUT_PORT(x) ((struct _guile_smap_output_port *) SCM_STREAM (x))
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)
219{ 195{
220 struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port); 196 struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(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}
256 210
257static int 211static int
@@ -264,19 +218,12 @@ _smap_output_port_print(SCM exp, SCM port, scm_print_state *pstate)
264static void 218static void
265_init_smap_output_port() 219_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}
281 228
282static void 229static void

Return to:

Send suggestions and report system problems to the System administrator.