From bc97364ab72cb3999b7482c3c23fb404bbe1d5a6 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Sun, 15 Aug 2004 20:28:24 +0000 Subject: [PATCH 01/21] *** empty log message *** --- THANKS | 1 + srfi/ChangeLog | 4 ++++ test-suite/ChangeLog | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/THANKS b/THANKS index daa40c722..d3ba549b3 100644 --- a/THANKS +++ b/THANKS @@ -5,6 +5,7 @@ Contributors since the last release: Neil Jerram Thien-Thi Nguyen Han-Wen Nienhuys + Jose A Ortega Ruiz Kevin Ryde Bill Schottstaedt Richard Todd diff --git a/srfi/ChangeLog b/srfi/ChangeLog index 6176d9204..3219b470e 100644 --- a/srfi/ChangeLog +++ b/srfi/ChangeLog @@ -1,3 +1,7 @@ +2004-08-15 Marius Vollmer + + * srfi-39.scm: New, from Jose A Ortega Ruiz. Thanks! + 2004-08-14 Kevin Ryde * srfi-13.c (scm_string_any, scm_string_every): Add support for char diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog index fb6e58059..a7ad39fe7 100644 --- a/test-suite/ChangeLog +++ b/test-suite/ChangeLog @@ -1,3 +1,7 @@ +2004-08-15 Marius Vollmer + + * tests/srfi-39.test: New, from Jose A Ortega Ruiz. Thanks! + 2004-08-14 Kevin Ryde * tests/srfi-13.test (string-any, string-every): Exercise char and From 95a58b3c32067c7dd1350a0630e62f4b25a1f557 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:13:06 +0000 Subject: [PATCH 02/21] (FETCH_STORE): New macro. (SCM_LOCK_VAL, SCM_UNLOCK_VAL): New constants. (SCM_LOCK_ARB, SCM_UNLOCK_ARB): Remove, effectively absorbed into scm_try_arbiter and scm_release_arbiter. (scm_try_arbiter, scm_release_arbiter): Use FETCH_STORE to get xchg for speed on i386, otherwise using mutex. --- libguile/arbiters.c | 107 +++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 42 deletions(-) diff --git a/libguile/arbiters.c b/libguile/arbiters.c index ce53b1580..57f2c65cb 100644 --- a/libguile/arbiters.c +++ b/libguile/arbiters.c @@ -26,21 +26,61 @@ #include "libguile/arbiters.h" -/* ENHANCE-ME: If the cpu has an atomic test-and-set instruction it could be - used instead of a mutex in try-arbiter and release-arbiter. +/* FETCH_STORE sets "fet" to the value fetched from "mem" and then stores + "sto" there. The fetch and store are done atomically, so once the fetch + has been done no other thread or processor can fetch from there before + the store is done. + + The operands are scm_t_bits, fet and sto are plain variables, mem is a + memory location (ie. an lvalue). + + ENHANCE-ME: Add more cpu-specifics. glibc atomicity.h has some of the + sort of thing required. FETCH_STORE could become some sort of + compare-and-store if that better suited what various cpus do. */ + +#if defined (__GNUC__) && defined (i386) && SIZEOF_SCM_T_BITS == 4 +/* This is for i386 with the normal 32-bit scm_t_bits. The xchg instruction + is atomic on a single processor, and it automatically asserts the "lock" + bus signal so it's atomic on a multi-processor (no need for the lock + prefix on the instruction). + + The mem operand is read-write but "+" is not used since old gcc + (eg. 2.7.2) doesn't support that. "1" for the mem input doesn't work + (eg. gcc 3.3) when mem is a pointer dereference like current usage below. + Having mem as a plain input should be ok though. It tells gcc the value + is live, but as an "m" gcc won't fetch it itself (though that would be + harmless). */ + +#define FETCH_STORE(fet,mem,sto) \ + do { \ + asm ("xchg %0, %1" \ + : "=r" (fet), "=m" (mem) \ + : "0" (sto), "m" (mem)); \ + } while (0) +#endif + +#ifndef FETCH_STORE +/* This is a generic version, with a mutex to ensure the operation is + atomic. Unfortunately this approach probably makes arbiters no faster + than mutexes (though still using less memory of course), so some + CPU-specifics are highly desirable. */ +#define FETCH_STORE(fet,mem,sto) \ + do { \ + scm_mutex_lock (&scm_i_misc_mutex); \ + (fet) = (mem); \ + (mem) = (sto); \ + scm_mutex_unlock (&scm_i_misc_mutex); \ + } while (0) +#endif - For the i386 family, cmpxchg would suit but it's only available on 80486 - and higher so that would have to be checked, perhaps at run-time when - setting up the definitions of the scheme procedures, or at compile time - if we interpret a host cpu type like "i686" to mean not less than that - chip. */ static scm_t_bits scm_tc16_arbiter; +#define SCM_LOCK_VAL (scm_tc16_arbiter | (1L << 16)) +#define SCM_UNLOCK_VAL scm_tc16_arbiter #define SCM_ARB_LOCKED(arb) ((SCM_CELL_WORD_0 (arb)) & (1L << 16)) -#define SCM_LOCK_ARB(arb) (SCM_SET_CELL_WORD_0 ((arb), scm_tc16_arbiter | (1L << 16))); -#define SCM_UNLOCK_ARB(arb) (SCM_SET_CELL_WORD_0 ((arb), scm_tc16_arbiter)); + static int arbiter_print (SCM exp, SCM port, scm_print_state *pstate) @@ -64,10 +104,10 @@ SCM_DEFINE (scm_make_arbiter, "make-arbiter", 1, 0, 0, #undef FUNC_NAME -/* The mutex here is so two threads can't both see the arbiter unlocked and - both proceed to lock and return #t. The arbiter itself wouldn't be - corrupted by this, but two threads both getting #t would be entirely - contrary to the intended semantics. */ +/* The atomic FETCH_STORE here is so two threads can't both see the arbiter + unlocked and return #t. The arbiter itself wouldn't be corrupted by + this, but two threads both getting #t would be contrary to the intended + semantics. */ SCM_DEFINE (scm_try_arbiter, "try-arbiter", 1, 0, 0, (SCM arb), @@ -77,27 +117,19 @@ SCM_DEFINE (scm_try_arbiter, "try-arbiter", 1, 0, 0, #define FUNC_NAME s_scm_try_arbiter { SCM_VALIDATE_SMOB (1, arb, arbiter); - - scm_mutex_lock (&scm_i_misc_mutex); - if (SCM_ARB_LOCKED(arb)) - arb = SCM_BOOL_F; - else - { - SCM_LOCK_ARB(arb); - arb = SCM_BOOL_T; - } - scm_mutex_unlock (&scm_i_misc_mutex); - return arb; + scm_t_bits old; + FETCH_STORE (old, * (scm_t_bits *) SCM_CELL_OBJECT_LOC(arb,0), SCM_LOCK_VAL); + return scm_from_bool (old == SCM_UNLOCK_VAL); } #undef FUNC_NAME -/* The mutex here is so two threads can't both see the arbiter locked and - both proceed to unlock and return #t. The arbiter itself wouldn't be - corrupted by this, but we don't want two threads both thinking they were - the unlocker. The intended usage is for the code which locked to be - responsible for unlocking, but we guarantee the return value even if - multiple threads compete. */ +/* The atomic FETCH_STORE here is so two threads can't both see the arbiter + locked and return #t. The arbiter itself wouldn't be corrupted by this, + but we don't want two threads both thinking they were the unlocker. The + intended usage is for the code which locked to be responsible for + unlocking, but we guarantee the return value even if multiple threads + compete. */ SCM_DEFINE (scm_release_arbiter, "release-arbiter", 1, 0, 0, (SCM arb), @@ -110,19 +142,10 @@ SCM_DEFINE (scm_release_arbiter, "release-arbiter", 1, 0, 0, "release it.") #define FUNC_NAME s_scm_release_arbiter { - SCM ret; SCM_VALIDATE_SMOB (1, arb, arbiter); - - scm_mutex_lock (&scm_i_misc_mutex); - if (!SCM_ARB_LOCKED(arb)) - ret = SCM_BOOL_F; - else - { - SCM_UNLOCK_ARB (arb); - ret = SCM_BOOL_T; - } - scm_mutex_unlock (&scm_i_misc_mutex); - return ret; + scm_t_bits old; + FETCH_STORE (old, *(scm_t_bits*)SCM_CELL_OBJECT_LOC(arb,0), SCM_UNLOCK_VAL); + return scm_from_bool (old == SCM_LOCK_VAL); } #undef FUNC_NAME From 7056d7c2e3917c413c18d14541b3cbb520c06169 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:15:14 +0000 Subject: [PATCH 03/21] New file. --- test-suite/tests/arbiters.test | 102 +++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 test-suite/tests/arbiters.test diff --git a/test-suite/tests/arbiters.test b/test-suite/tests/arbiters.test new file mode 100644 index 000000000..49d6a9508 --- /dev/null +++ b/test-suite/tests/arbiters.test @@ -0,0 +1,102 @@ +;;;; arbiters.test --- test arbiters functions -*- scheme -*- +;;;; +;;;; Copyright (C) 2004 Free Software Foundation, Inc. +;;;; +;;;; This library is free software; you can redistribute it and/or +;;;; modify it under the terms of the GNU Lesser General Public +;;;; License as published by the Free Software Foundation; either +;;;; version 2.1 of the License, or (at your option) any later version. +;;;; +;;;; This library is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;;; Lesser General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU Lesser General Public +;;;; License along with this library; if not, write to the Free Software +;;;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +(define-module (test-suite test-arbiters) + #:use-module (test-suite lib)) + +;;; +;;; arbiter display +;;; + +(with-test-prefix "arbiter display" + ;; nothing fancy, just exercise the printing code + + (pass-if "never locked" + (let ((arb (make-arbiter "foo")) + (port (open-output-string))) + (display arb port) + #t)) + + (pass-if "locked" + (let ((arb (make-arbiter "foo")) + (port (open-output-string))) + (try-arbiter arb) + (display arb port) + #t)) + + (pass-if "unlocked" + (let ((arb (make-arbiter "foo")) + (port (open-output-string))) + (try-arbiter arb) + (release-arbiter arb) + (display arb port) + #t))) + +;;; +;;; try-arbiter +;;; + +(with-test-prefix "try-arbiter" + + (pass-if "lock" + (let ((arb (make-arbiter "foo"))) + (try-arbiter arb))) + + (pass-if "already locked" + (let ((arb (make-arbiter "foo"))) + (try-arbiter arb) + (not (try-arbiter arb)))) + + (pass-if "already locked twice" + (let ((arb (make-arbiter "foo"))) + (try-arbiter arb) + (try-arbiter arb) + (not (try-arbiter arb))))) + +;;; +;;; release-arbiter +;;; + +(with-test-prefix "release-arbiter" + + (pass-if "lock" + (let ((arb (make-arbiter "foo"))) + (try-arbiter arb) + (release-arbiter arb))) + + (pass-if "never locked" + (let ((arb (make-arbiter "foo"))) + (not (release-arbiter arb)))) + + (pass-if "never locked twice" + (let ((arb (make-arbiter "foo"))) + (release-arbiter arb) + (not (release-arbiter arb)))) + + (pass-if "already unlocked" + (let ((arb (make-arbiter "foo"))) + (try-arbiter arb) + (release-arbiter arb) + (not (release-arbiter arb)))) + + (pass-if "already unlocked twice" + (let ((arb (make-arbiter "foo"))) + (try-arbiter arb) + (release-arbiter arb) + (release-arbiter arb) + (not (release-arbiter arb))))) From 4f21b9e83fbdf1a14d4f22af0065b97e5e238cb2 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:17:06 +0000 Subject: [PATCH 04/21] * tests/arbiters.test: New file * Makefile.am (SCM_TESTS): Add it. --- test-suite/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am index aa26fbc06..076724aa8 100644 --- a/test-suite/Makefile.am +++ b/test-suite/Makefile.am @@ -22,6 +22,7 @@ SUBDIRS = standalone SCM_TESTS = tests/alist.test \ + tests/arbiters.test \ tests/bit-operations.test \ tests/c-api.test \ tests/chars.test \ From b1fbeb53bb8666bfcbdaf8c796772cd4d31f27ff Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:17:34 +0000 Subject: [PATCH 05/21] *** empty log message *** --- test-suite/ChangeLog | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog index a7ad39fe7..0d1308802 100644 --- a/test-suite/ChangeLog +++ b/test-suite/ChangeLog @@ -1,3 +1,8 @@ +2004-08-18 Kevin Ryde + + * tests/arbiters.test: New file + * Makefile.am (SCM_TESTS): Add it. + 2004-08-15 Marius Vollmer * tests/srfi-39.test: New, from Jose A Ortega Ruiz. Thanks! From 728ad4b7cd022a94fd4a396f50ce599c5ccf7fbf Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:19:04 +0000 Subject: [PATCH 06/21] (scm_equal_p): Remove real==fraction and fraction==real, they must be #f according to R5RS. (equal? follows eqv?, and for eqv? an exact and inexact is #f.) --- libguile/eq.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/libguile/eq.c b/libguile/eq.c index fa9dcdebc..e7d4b0ce1 100644 --- a/libguile/eq.c +++ b/libguile/eq.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,1998,2000,2001,2003 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,2000,2001,2003, 2004 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -173,24 +173,6 @@ SCM_PRIMITIVE_GENERIC_1 (scm_equal_p, "equal?", scm_tc7_rpsubr, && SCM_COMPLEX_IMAG (x) == 0.0); } - /* should we handle fractions here also? */ - else if ((SCM_FRACTIONP (x)) && (SCM_INEXACTP (y))) - { - if (SCM_REALP (y)) - return scm_from_bool (scm_i_fraction2double (x) == SCM_REAL_VALUE (y)); - else - return scm_from_bool (SCM_COMPLEX_REAL (y) == scm_i_fraction2double (x) - && SCM_COMPLEX_IMAG (y) == 0.0); - } - else if ((SCM_FRACTIONP (y)) && (SCM_INEXACTP (x))) - { - if (SCM_REALP (x)) - return scm_from_bool (scm_i_fraction2double (y) == SCM_REAL_VALUE (x)); - else - return scm_from_bool (SCM_COMPLEX_REAL (x) == scm_i_fraction2double (y) - && SCM_COMPLEX_IMAG (x) == 0.0); - } - return SCM_BOOL_F; } switch (SCM_TYP7 (x)) From b82cab94d643ed307cd077b7be4a9baab64ac1ea Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:20:11 +0000 Subject: [PATCH 07/21] (fractions): Correction, equal? 3/4 .75 should be #f, according to R5RS. --- test-suite/tests/fractions.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-suite/tests/fractions.test b/test-suite/tests/fractions.test index ae900a256..28fd12aa4 100644 --- a/test-suite/tests/fractions.test +++ b/test-suite/tests/fractions.test @@ -248,7 +248,7 @@ (testeq (eqv? 3/4 .75) #f) (testeq (eqv? 3/4 3/4) #t) (testeq (eqv? 10197734562406803221/17452826108659293487 10197734562406803221/17452826108659293487) #t) - (testeq (equal? 3/4 .75) #t) + (testeq (equal? 3/4 .75) #f) (testeq (number? 3/4) #t) (testeq (real? 3/4) #t) (testeq (integer? 3/4) #f) From 8e4d7cdf060a229bbfc567c7e241f05c3ac817cd Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:22:23 +0000 Subject: [PATCH 08/21] (ttyname): Remove prototype, unused. --- libguile/ports.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libguile/ports.c b/libguile/ports.c index d0931ed71..de9a19158 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -1552,10 +1552,6 @@ SCM_DEFINE (scm_set_port_filename_x, "set-port-filename!", 2, 0, 0, } #undef FUNC_NAME -#ifndef ttyname -extern char * ttyname(); -#endif - void scm_print_port_mode (SCM exp, SCM port) { From eb372585279c32f68e950080d852f549da0a0bb2 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:27:11 +0000 Subject: [PATCH 09/21] (fport_print): Use scm_ttyname instead of ttyname directly, to get thread safety of scm_ttyname. --- libguile/fports.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libguile/fports.c b/libguile/fports.c index 769474952..ad03ad913 100644 --- a/libguile/fports.c +++ b/libguile/fports.c @@ -27,6 +27,7 @@ #include "libguile/strings.h" #include "libguile/validate.h" #include "libguile/gc.h" +#include "libguile/posix.h" #include "libguile/dynwind.h" #include "libguile/fports.h" @@ -509,7 +510,7 @@ fport_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) #ifdef HAVE_TTYNAME if (isatty (fdes)) - scm_puts (ttyname (fdes), port); + scm_display (scm_ttyname (exp), port); else #endif /* HAVE_TTYNAME */ scm_intprint (fdes, 10, port); From 8a807b26c3d8ad88cc5617470d7736e6053a7914 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:28:16 +0000 Subject: [PATCH 10/21] *** empty log message *** --- libguile/ChangeLog | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 6e4600112..cde4cecd5 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,21 @@ +2004-08-18 Kevin Ryde + + * arbiters.c (FETCH_STORE): New macro. + (SCM_LOCK_VAL, SCM_UNLOCK_VAL): New constants. + (SCM_LOCK_ARB, SCM_UNLOCK_ARB): Remove, effectively absorbed into + scm_try_arbiter and scm_release_arbiter. + (scm_try_arbiter, scm_release_arbiter): Use FETCH_STORE to get xchg + for speed on i386, otherwise using mutex. + + * eq.c (scm_equal_p): Remove real==fraction and fraction==real, they + must be #f according to R5RS. (equal? follows eqv?, and for eqv? an + exact and inexact is #f.) + + * fports.c (fport_print): Use scm_ttyname instead of ttyname directly, + to get thread safety of scm_ttyname. + + * ports.c (ttyname): Remove prototype, unused. + 2004-08-13 Marius Vollmer * load.c (scm_init_load_path): Do not pass NULL to From 52d1e968ac7df6df8a31ef7ebce63f3a8249c2c5 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:34:53 +0000 Subject: [PATCH 11/21] *** empty log message *** --- test-suite/ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-suite/ChangeLog b/test-suite/ChangeLog index 0d1308802..c6492ff9e 100644 --- a/test-suite/ChangeLog +++ b/test-suite/ChangeLog @@ -1,5 +1,8 @@ 2004-08-18 Kevin Ryde + * tests/fractions.test (fractions): Correction, equal? 3/4 .75 should + be #f, according to R5RS. + * tests/arbiters.test: New file * Makefile.am (SCM_TESTS): Add it. From 6f637a1bc0a597bf0fe87dc950617804d2092394 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:44:25 +0000 Subject: [PATCH 12/21] (scm_init_socket): Add SOCK_SEQPACKET and SOCK_RDM. --- libguile/socket.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libguile/socket.c b/libguile/socket.c index 53034f678..374c162c7 100644 --- a/libguile/socket.c +++ b/libguile/socket.c @@ -1364,16 +1364,26 @@ scm_init_socket () scm_c_define ("INADDR_LOOPBACK", scm_from_ulong (INADDR_LOOPBACK)); #endif - /* socket types. */ + /* socket types. + + SOCK_PACKET is deliberately omitted, the GNU/Linux socket(2) and + packet(7) advise that it's obsolete and strongly deprecated. */ + #ifdef SOCK_STREAM scm_c_define ("SOCK_STREAM", scm_from_int (SOCK_STREAM)); #endif #ifdef SOCK_DGRAM scm_c_define ("SOCK_DGRAM", scm_from_int (SOCK_DGRAM)); #endif +#ifdef SOCK_SEQPACKET + scm_c_define ("SOCK_SEQPACKET", scm_from_int (SOCK_SEQPACKET)); +#endif #ifdef SOCK_RAW scm_c_define ("SOCK_RAW", scm_from_int (SOCK_RAW)); #endif +#ifdef SOCK_RDM + scm_c_define ("SOCK_RDM", scm_from_int (SOCK_RDM)); +#endif /* setsockopt level. */ #ifdef SOL_SOCKET From d6cd4c36017c0978168c830bd7d6e1ec4187fa0d Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:53:07 +0000 Subject: [PATCH 13/21] *** empty log message *** --- libguile/ChangeLog | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index cde4cecd5..53d6bb49f 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -16,6 +16,8 @@ * ports.c (ttyname): Remove prototype, unused. + * socket.c (scm_init_socket): Add SOCK_SEQPACKET and SOCK_RDM. + 2004-08-13 Marius Vollmer * load.c (scm_init_load_path): Do not pass NULL to From 1f3cc0d312133c5194a8999f8368105aa1e06aae Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:57:01 +0000 Subject: [PATCH 14/21] *** empty log message *** --- libguile/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 53d6bb49f..c33080565 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -17,6 +17,7 @@ * ports.c (ttyname): Remove prototype, unused. * socket.c (scm_init_socket): Add SOCK_SEQPACKET and SOCK_RDM. + Reported by Michael Tuexen. 2004-08-13 Marius Vollmer From 0bd094c2ad90ab2dceec90c942de7a0936d8469e Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Tue, 17 Aug 2004 23:58:56 +0000 Subject: [PATCH 15/21] (Network Sockets and Communication): Add SOCK_RDM and SOCK_SEQPACKET. --- doc/ref/posix.texi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index 70ddadb96..c05242e5b 100644 --- a/doc/ref/posix.texi +++ b/doc/ref/posix.texi @@ -2296,6 +2296,8 @@ supported by the system, @defvar SOCK_STREAM @defvarx SOCK_DGRAM @defvarx SOCK_RAW +@defvarx SOCK_RDM +@defvarx SOCK_SEQPACKET @end defvar @var{proto} can be obtained from a protocol name using From a8d0313f69fe9507c8d5b3bc8eab9561248719f8 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 18 Aug 2004 00:12:44 +0000 Subject: [PATCH 16/21] (Internet Socket Examples): Correction to socket calls, should be PF_INET not AF_INET (though generally the two are the same value). --- doc/ref/posix.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/ref/posix.texi b/doc/ref/posix.texi index c05242e5b..105193426 100644 --- a/doc/ref/posix.texi +++ b/doc/ref/posix.texi @@ -2665,7 +2665,7 @@ It connects to the HTTP daemon running on the local machine and returns the contents of the root index URL. @example -(let ((s (socket AF_INET SOCK_STREAM 0))) +(let ((s (socket PF_INET SOCK_STREAM 0))) (connect s AF_INET (inet-aton "127.0.0.1") 80) (display "GET / HTTP/1.0\r\n\r\n" s) @@ -2684,7 +2684,7 @@ port 2904 for incoming connections and sends a greeting back to the client. @example -(let ((s (socket AF_INET SOCK_STREAM 0))) +(let ((s (socket PF_INET SOCK_STREAM 0))) (setsockopt s SOL_SOCKET SO_REUSEADDR 1) ;; @r{Specific address?} ;; @r{(bind s AF_INET (inet-aton "127.0.0.1") 2904)} From 86ff1823d57d8898e43153cec254b1725cc74b49 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 18 Aug 2004 00:13:51 +0000 Subject: [PATCH 17/21] *** empty log message *** --- doc/ref/ChangeLog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/ref/ChangeLog b/doc/ref/ChangeLog index c57a05ffa..3b5014bac 100644 --- a/doc/ref/ChangeLog +++ b/doc/ref/ChangeLog @@ -1,3 +1,12 @@ +2004-08-18 Kevin Ryde + + * posix.texi (Network Sockets and Communication): Add SOCK_RDM and + SOCK_SEQPACKET. + + * posix.texi (Internet Socket Examples): Correction to socket calls, + should be PF_INET not AF_INET (though generally the two are the same + value). + 2004-08-14 Kevin Ryde * api-scheduling.texi (Mutexes): New datatype-centric section, adding From b4c0da9ce773ba3f6a28b195e1d991debcf6d3e5 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 18 Aug 2004 00:22:25 +0000 Subject: [PATCH 18/21] Add cond-expand-provide srfi-2, since this module provides that feature. --- ice-9/and-let-star.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ice-9/and-let-star.scm b/ice-9/and-let-star.scm index 4057fb498..9bd01d138 100644 --- a/ice-9/and-let-star.scm +++ b/ice-9/and-let-star.scm @@ -43,3 +43,5 @@ (error "not a proper list" vars)))) (expand vars body)) + +(cond-expand-provide (current-module) '(srfi-2)) From 00ed256c76cca201530f9103f5613895f3528f11 Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 18 Aug 2004 00:24:59 +0000 Subject: [PATCH 19/21] *** empty log message *** --- ice-9/ChangeLog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ice-9/ChangeLog b/ice-9/ChangeLog index b67ababe3..f34938dac 100644 --- a/ice-9/ChangeLog +++ b/ice-9/ChangeLog @@ -1,3 +1,10 @@ +2004-08-18 Kevin Ryde + + * and-let-star.scm: Add cond-expand-provide srfi-2, since this module + provides that feature. + * receive.scm: Add cond-expand-provide srfi-8, since this module + provides that feature. + 2004-08-09 Marius Vollmer From Matthias Koeppe. Thanks! From 6ee5281f4e59dafae86ead3b012b716f9492f9cf Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 18 Aug 2004 00:25:39 +0000 Subject: [PATCH 20/21] Add cond-expand-provide srfi-8, since this module provides that feature. --- ice-9/receive.scm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ice-9/receive.scm b/ice-9/receive.scm index 0b6754b13..2fbed5fed 100644 --- a/ice-9/receive.scm +++ b/ice-9/receive.scm @@ -1,6 +1,6 @@ ;;;; SRFI-8 -;;; Copyright (C) 2000, 2001 Free Software Foundation, Inc. +;;; Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. ;;; ;; This library is free software; you can redistribute it and/or ;; modify it under the terms of the GNU Lesser General Public @@ -24,3 +24,5 @@ (define-macro (receive vars vals . body) `(call-with-values (lambda () ,vals) (lambda ,vars ,@body))) + +(cond-expand-provide (current-module) '(srfi-8)) From 66aa0ef0c59e4c897b9154e176832d6896f240fe Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Wed, 18 Aug 2004 00:29:19 +0000 Subject: [PATCH 21/21] New file. --- test-suite/tests/receive.test | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test-suite/tests/receive.test diff --git a/test-suite/tests/receive.test b/test-suite/tests/receive.test new file mode 100644 index 000000000..838f64c7e --- /dev/null +++ b/test-suite/tests/receive.test @@ -0,0 +1,32 @@ +;;;; receive.test --- Test suite for Guile receive module. -*- scheme -*- +;;;; +;;;; Copyright (C) 2004 Free Software Foundation, Inc. +;;;; +;;;; This program is free software; you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation; either version 2, or (at your option) +;;;; any later version. +;;;; +;;;; This program is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with this software; see the file COPYING. If not, write to +;;;; the Free Software Foundation, Inc., 59 Temple Place, Suite 330, +;;;; Boston, MA 02111-1307 USA + +(define-module (test-suite test-receive) + #:use-module (test-suite lib) + #:use-module (ice-9 receive)) + +;;; +;;; receive +;;; + +(with-test-prefix "receive" + + (pass-if "cond-expand srfi-8" + (cond-expand (srfi-8 #t) + (else #f))))