diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-05-10 08:02:03 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-05-10 08:02:03 +0300 |
commit | 9223032f5025f8bc4820dfdfb081be1c7fcd1c4e (patch) | |
tree | e1209bcc78f5a48673c36ea5ad4d820f4ab1bd98 | |
parent | 462c760d4605787a6f5baecc87dfee5e8ee5238b (diff) | |
download | smap-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-- | NEWS | 9 | ||||
-rw-r--r-- | README | 8 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | modules/guile/getpw.scm | 4 | ||||
-rw-r--r-- | modules/guile/guile.c | 89 |
5 files changed, 36 insertions, 84 deletions
@@ -1,8 +1,11 @@ -Smap NEWS -- history of user-visible changes. 2015-06-20 -Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff +Smap NEWS -- history of user-visible changes. 2019-05-10 See the end of file for copying conditions. Please send Smap bug reports to <gray+smap@gnu.org.ua> + +Version 2.0.90 (git) + +* Support for Guile 2.2 Version 2.0, 2015-06-20 @@ -74,7 +77,7 @@ Version 1.0, 2010-06-19 ========================================================================= Copyright information: -Copyright (C) 2006-2010, 2014-1015 Sergey Poznyakoff +Copyright (C) 2006-2019 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies of this document as received, in any medium, provided that the @@ -1,5 +1,5 @@ Smap README -Copyright (C) 2006-2010, 2014 Sergey Poznyakoff +See end of file for copying conditions. * Introduction ============== @@ -70,7 +70,7 @@ Compile with TCP wrappers (libwrap) support. This is the default. Compile with GNU Mailutils, build the `mailutils' module. By default, this is enabled if configure determines that a sufficiently new -version of GNU Mailutils (i.e. 2.0 or newer) is installed. +version of GNU Mailutils (i.e. 3.0 or newer) is installed. See http://www.gnu.org/software/mailutils for more information on GNU Mailutils including file downloads. @@ -79,7 +79,7 @@ Mailutils including file downloads. Compile with Guile support; build the `guile' module. By default, this is enabled if configure determines that a sufficiently new -version of Guile (i.e. 1.8 or newer) is installed. +version of Guile (i.e. 2.2 or newer) is installed. See http://www.gnu.org/software/guile for additional information on Guile including file downloads. @@ -109,7 +109,7 @@ will remain intact. * Copyright information -Copyright (C) 2006, 2007, 2008, 2009, 2010 Sergey Poznyakoff +Copyright (C) 2006-2019 Sergey Poznyakoff Permission is granted to anyone to make or distribute verbatim copies 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 @@ # This file is part of Smap. -*- autoconf -*- -# Copyright (C) 2010, 2014-2016 Sergey Poznyakoff +# Copyright (C) 2010, 2014-2019 Sergey Poznyakoff # # Smap is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,7 +20,9 @@ m4_define([SMAP_VERSION_MINOR], 0) m4_define([SMAP_VERSION_PATCH], 90) AC_INIT([smap], SMAP_VERSION_MAJOR.SMAP_VERSION_MINOR[]m4_ifdef([SMAP_VERSION_PATCH],.SMAP_VERSION_PATCH), - [gray+smap@gnu.org.ua]) + [gray+smap@gnu.org.ua], + [smap], + [http://smap.software.gnu.org.ua]) AC_CONFIG_SRCDIR([src/smapd.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR([build-aux]) @@ -101,7 +103,7 @@ AC_ARG_WITH([mailutils], [status_mailutils=maybe]) if test $status_mailutils != no; then - AM_GNU_MAILUTILS(2.99.992, [all], + AM_GNU_MAILUTILS(3.0, [all], [status_mailutils=yes], [if test $status_mailutils = yes; then AC_MSG_ERROR([GNU Mailutils not found]) @@ -112,7 +114,7 @@ fi AM_CONDITIONAL([MAILUTILS_COND],[test $status_mailutils = yes]) # Guile -GINT_INIT([gint],[1.8 with-guile nodoc], +GINT_INIT([gint],[2.2.0 with-guile nodoc], [status_guile=yes], [status_guile=no]) AM_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 @@ ;;;; This file is part of Smap. -;;;; Copyright (C) 2010, 2014 Sergey Poznyakoff +;;;; Copyright (C) 2010, 2014, 2019 Sergey Poznyakoff ;;;; ;;;; Smap is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -87,7 +87,7 @@ (let ((src (car rest))) (format (current-error-port) "connect from ~A~%" (if (= (sockaddr:fam src) AF_INET) - (inet-ntoa (sockaddr:addr src)) + (inet-ntop AF_INET (sockaddr:addr src)) "UNIX socket"))) ;; Select appropriate handler and call it (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 @@ /* This file is part of Smap. - Copyright (C) 2010, 2014, 2015 Sergey Poznyakoff + Copyright (C) 2010, 2014, 2015, 2019 Sergey Poznyakoff Smap is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -171,7 +171,7 @@ argv_to_scm(int argc, char **argv) return scm_first; } -static scm_t_bits scm_tc16_smap_output_port; +static scm_t_port_type *scm_smap_output_port_type; struct _guile_smap_output_port { smap_stream_t stream; }; @@ -180,78 +180,32 @@ static SCM _make_smap_output_port(smap_stream_t stream) { struct _guile_smap_output_port *dp; - SCM port; - scm_port *pt; - dp = scm_gc_malloc(sizeof (struct _guile_smap_output_port), - "smap-output_-port"); + dp = scm_gc_typed_calloc (struct _guile_smap_output_port); dp->stream = stream; - - port = scm_new_port_table_entry(scm_tc16_smap_output_port); - pt = SCM_PTAB_ENTRY(port); - pt->rw_random = 0; - SCM_SET_CELL_TYPE(port, - (scm_tc16_smap_output_port | - SCM_OPN | SCM_WRTNG | SCM_BUF0)); - SCM_SETSTREAM(port, dp); - return port; + return scm_c_make_port (scm_smap_output_port_type, + SCM_WRTNG | SCM_BUF0, + (scm_t_bits) dp); } #define SMAP_OUTPUT_PORT(x) ((struct _guile_smap_output_port *) SCM_STREAM (x)) -static SCM -_smap_output_port_mark(SCM port) -{ - return SCM_BOOL_F; -} - static void -_smap_output_port_flush(SCM port) -{ - scm_port *pt = SCM_PTAB_ENTRY(port); - struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port); - if (dp && pt->write_pos > pt->write_buf) - smap_stream_write(dp->stream, "\n", 1, NULL); -} - -static int _smap_output_port_close(SCM port) { struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port); - if (dp) { - _smap_output_port_flush(port); - SCM_SETSTREAM(port, NULL); - scm_gc_free(dp, sizeof(struct _guile_smap_output_port), - "smap-output-port"); + if (dp && dp->stream) { + smap_stream_flush(dp->stream); } - return 0; } -static scm_sizet -_smap_output_port_free(SCM port) -{ - _smap_output_port_close(port); - return 0; -} - -static int -_smap_output_port_fill_input(SCM port) -{ - return EOF; -} - -static void -_smap_output_port_write(SCM port, const void *data, size_t size) +static size_t +_smap_output_port_write(SCM port, SCM src, size_t start, size_t count) { struct _guile_smap_output_port *dp = SMAP_OUTPUT_PORT(port); - smap_stream_write(dp->stream, data, size, NULL); -} - -static scm_t_off -_smap_output_port_seek (SCM port, scm_t_off offset, int whence) -{ - return -1; + smap_stream_write(dp->stream, SCM_BYTEVECTOR_CONTENTS (src) + start, count, NULL); + return count; } static int @@ -264,19 +218,12 @@ _smap_output_port_print(SCM exp, SCM port, scm_print_state *pstate) static void _init_smap_output_port() { - scm_tc16_smap_output_port = scm_make_port_type("smap-output-port", - _smap_output_port_fill_input, - _smap_output_port_write); - scm_set_port_mark (scm_tc16_smap_output_port, _smap_output_port_mark); - scm_set_port_free (scm_tc16_smap_output_port, _smap_output_port_free); - scm_set_port_print (scm_tc16_smap_output_port, - _smap_output_port_print); - scm_set_port_flush (scm_tc16_smap_output_port, - _smap_output_port_flush); - scm_set_port_close (scm_tc16_smap_output_port, - _smap_output_port_close); - scm_set_port_seek (scm_tc16_smap_output_port, - _smap_output_port_seek); + scm_smap_output_port_type = scm_make_port_type("smap-output-port", + NULL, + _smap_output_port_write); + scm_set_port_print(scm_smap_output_port_type, _smap_output_port_print); + scm_set_port_close(scm_smap_output_port_type, _smap_output_port_close); + scm_set_port_needs_close_on_gc(scm_smap_output_port_type, 1); } static void |