├── README ├── ChangeLog ├── AUTHORS ├── .gitignore ├── .github └── workflows │ ├── guile2.2.yml │ └── guile3.0.yml ├── env.in ├── redis ├── connection.scm ├── Makefile.am ├── main.scm ├── utils.scm ├── pubsub.scm └── commands.scm ├── Makefile.am ├── redis.scm ├── NEWS ├── configure.ac ├── README.md ├── INSTALL ├── m4 └── guile.m4 └── COPYING /README: -------------------------------------------------------------------------------- 1 | README.md -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | See the Git log. 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Aleix Conchillo Flaque is the author and current 2 | maintainer of guile-redis. 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /autom4te.cache 3 | /build-aux/install-sh 4 | /build-aux/missing 5 | 6 | /aclocal.m4 7 | /config.log 8 | /config.status 9 | /configure 10 | /env 11 | 12 | Makefile 13 | Makefile.in 14 | *.go 15 | 16 | guile-redis-* 17 | -------------------------------------------------------------------------------- /.github/workflows/guile2.2.yml: -------------------------------------------------------------------------------- 1 | name: GNU Guile 2.2 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-22.04 12 | steps: 13 | - name: Install dependencies 14 | run: | 15 | sudo apt update 16 | sudo apt install automake autoconf libtool pkg-config make gcc 17 | sudo apt install guile-2.2 guile-2.2-libs guile-2.2-dev 18 | - name: Checkout repository 19 | uses: actions/checkout@v2 20 | - name: Bootstrap 21 | run: autoreconf -vif 22 | - name: Configure 23 | run: ./configure 24 | - name: Make distribution 25 | run: make distcheck 26 | -------------------------------------------------------------------------------- /.github/workflows/guile3.0.yml: -------------------------------------------------------------------------------- 1 | name: GNU Guile 3.0 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-22.04 12 | steps: 13 | - name: Install dependencies 14 | run: | 15 | sudo apt update 16 | sudo apt install automake autoconf libtool pkg-config make gcc 17 | sudo apt install guile-3.0 guile-3.0-libs guile-3.0-dev 18 | - name: Checkout repository 19 | uses: actions/checkout@v2 20 | - name: Bootstrap 21 | run: autoreconf -vif 22 | - name: Configure 23 | run: ./configure 24 | - name: Make distribution 25 | run: make distcheck 26 | -------------------------------------------------------------------------------- /env.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright (C) 2018 Aleix Conchillo Flaque 4 | # 5 | # This file is part of guile-redis. 6 | # 7 | # guile-redis is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # guile-redis is distributed in the hope that it will be useful, but 13 | # WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | # General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | # 20 | 21 | if test -z "$GUILE_LOAD_PATH"; then 22 | GUILE_LOAD_PATH="@abs_top_srcdir@" 23 | else 24 | GUILE_LOAD_PATH="@abs_top_srcdir@":$GUILE_LOAD_PATH 25 | fi 26 | 27 | if test -z "$GUILE_LOAD_COMPILED_PATH"; then 28 | GUILE_LOAD_COMPILED_PATH="@abs_top_builddir@" 29 | else 30 | GUILE_LOAD_COMPILED_PATH="@abs_top_builddir@":$GUILE_LOAD_COMPILED_PATH 31 | fi 32 | 33 | export GUILE_LOAD_PATH GUILE_LOAD_COMPILED_PATH 34 | 35 | exec "$@" 36 | -------------------------------------------------------------------------------- /redis/connection.scm: -------------------------------------------------------------------------------- 1 | ;;; (redis connection) --- redis module for Guile. 2 | 3 | ;; Copyright (C) 2013-2018 Aleix Conchillo Flaque 4 | ;; 5 | ;; This file is part of guile-redis. 6 | ;; 7 | ;; guile-redis is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | ;; 12 | ;; guile-redis is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Redis module for Guile 23 | 24 | ;;; Code: 25 | 26 | (define-module (redis connection) 27 | #:use-module (srfi srfi-9) 28 | #:export (make-connection 29 | redis-connection? 30 | redis-host 31 | redis-port 32 | redis-socket)) 33 | 34 | (define-record-type 35 | (make-connection host port sock) 36 | redis-connection? 37 | (host redis-host) 38 | (port redis-port) 39 | (sock redis-socket)) 40 | 41 | ;;; (redis connection) ends here 42 | -------------------------------------------------------------------------------- /redis/Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am 3 | # 4 | # Copyright (C) 2013-2020 Aleix Conchillo Flaque 5 | # 6 | # This file is part of guile-redis. 7 | # 8 | # guile-redis is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # guile-redis is distributed in the hope that it will be useful, but 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with guile-redis. If not, see https://www.gnu.org/licenses/. 20 | # 21 | 22 | moddir=$(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION)/redis 23 | objdir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache/redis 24 | 25 | SOURCES = commands.scm connection.scm main.scm pubsub.scm utils.scm 26 | 27 | GOBJECTS = $(SOURCES:%.scm=%.go) 28 | 29 | nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES) 30 | nobase_nodist_obj_DATA = $(GOBJECTS) 31 | 32 | EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES) 33 | 34 | CLEANFILES = $(GOBJECTS) 35 | 36 | GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat 37 | SUFFIXES = .scm .go 38 | .scm.go: 39 | $(top_builddir)/env $(GUILD) compile $(GUILE_WARNINGS) -o "$@" "$<" 40 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile.am 3 | # 4 | # Copyright (C) 2013-2023 Aleix Conchillo Flaque 5 | # 6 | # This file is part of guile-redis. 7 | # 8 | # guile-redis is free software: you can redistribute it and/or modify 9 | # it under the terms of the GNU General Public License as published by 10 | # the Free Software Foundation; either version 3 of the License, or 11 | # (at your option) any later version. 12 | # 13 | # guile-redis is distributed in the hope that it will be useful, but 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | # General Public License for more details. 17 | # 18 | # You should have received a copy of the GNU General Public License 19 | # along with guile-redis. If not, see https://www.gnu.org/licenses/. 20 | # 21 | 22 | SUBDIRS = redis 23 | 24 | ACLOCAL_AMFLAGS = -I build-aux 25 | 26 | GOBJECTS = $(SOURCES:%.scm=%.go) 27 | 28 | moddir=$(datadir)/guile/site/$(GUILE_EFFECTIVE_VERSION) 29 | objdir=$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache 30 | 31 | nobase_mod_DATA = $(SOURCES) $(NOCOMP_SOURCES) 32 | nobase_nodist_obj_DATA = $(GOBJECTS) 33 | 34 | GUILE_WARNINGS = -Wunbound-variable -Warity-mismatch -Wformat 35 | SUFFIXES = .scm .go 36 | .scm.go: 37 | $(top_builddir)/env $(GUILD) compile $(GUILE_WARNINGS) -o "$@" "$<" 38 | 39 | SOURCES = redis.scm 40 | 41 | CLEANFILES = $(GOBJECTS) 42 | 43 | EXTRA_DIST = $(SOURCES) $(NOCOMP_SOURCES) 44 | -------------------------------------------------------------------------------- /redis.scm: -------------------------------------------------------------------------------- 1 | ;;; (redis) --- Redis module for Guile. 2 | 3 | ;; Copyright (C) 2013-2020 Aleix Conchillo Flaque 4 | ;; 5 | ;; This file is part of guile-redis. 6 | ;; 7 | ;; guile-redis is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | ;; 12 | ;; guile-redis is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Redis module for Guile 23 | 24 | ;;; Code: 25 | 26 | (define-module (redis) 27 | #:use-module (redis main) 28 | #:use-module (redis commands) 29 | #:use-module (redis pubsub)) 30 | 31 | (define-syntax re-export-modules 32 | (syntax-rules () 33 | ((_ (mod ...) ...) 34 | (begin 35 | (module-use! (module-public-interface (current-module)) 36 | (resolve-interface '(mod ...))) 37 | ...)))) 38 | 39 | (re-export-modules (redis main) 40 | (redis commands) 41 | (redis pubsub)) 42 | 43 | ;;; (redis) ends here 44 | -------------------------------------------------------------------------------- /redis/main.scm: -------------------------------------------------------------------------------- 1 | ;;; (redis main) --- redis module for Guile. 2 | 3 | ;; Copyright (C) 2013-2020 Aleix Conchillo Flaque 4 | ;; 5 | ;; This file is part of guile-redis. 6 | ;; 7 | ;; guile-redis is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | ;; 12 | ;; guile-redis is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Redis module for Guile 23 | 24 | ;;; Code: 25 | 26 | (define-module (redis main) 27 | #:use-module (redis connection) 28 | #:use-module (redis utils) 29 | #:export (redis-connect 30 | redis-close 31 | redis-send)) 32 | 33 | (define* (redis-connect #:key (host "127.0.0.1") (port 6379)) 34 | "Establish a connection to the redis server at the given @var{host} 35 | and @var{port}. The @var{host} defaults to 127.0.0.1 and @var{port} 36 | defaults to 6379. Returns a redis connection." 37 | (let ((sock (socket PF_INET SOCK_STREAM 0))) 38 | (connect sock AF_INET (inet-pton AF_INET host) port) 39 | (make-connection host port sock))) 40 | 41 | (define (redis-close connection) 42 | "Close the @var{connection} to the redis server." 43 | (close-port (redis-socket connection))) 44 | 45 | (define (redis-send connection commands) 46 | "Send the given @var{commands} to the redis @var{connection}. @var{commands} 47 | can be a single command or a list of commands. For a list of commands, a list 48 | of all the replies is returned." 49 | (send-commands connection commands) 50 | (receive-commands connection commands)) 51 | 52 | ;;; (redis main) ends here 53 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | 2 | * Version 2.2.0 (Feb 23, 2022) 3 | 4 | - Add Redis 7.0 commands. 5 | 6 | 7 | * Version 2.1.2 (May 19, 2021) 8 | 9 | - Fix empty strings. 10 | 11 | - Remove all uses of #nil. 12 | 13 | 14 | * Version 2.1.1 (May 19, 2021) 15 | 16 | - Fix build with Guile 3.0.7. 17 | 18 | 19 | * Version 2.1.0 (Feb 24, 2021) 20 | 21 | - Add Redis 6.2.0 commands. 22 | 23 | 24 | * Version 2.0.0 (Nov 16, 2020) 25 | 26 | - Add Redis 6.0.0 commands. 27 | 28 | - Fix support for Redis Pub/Sub. Before guile-redis 2.0.0, publish, 29 | subscribe & co. commands were treated as the rest of Redis 30 | commands. However, these commands are special and are now implemented as 31 | separate procedures. 32 | (Fixes #3) 33 | 34 | 35 | * Version 1.3.0 (Jan 26, 2019) 36 | 37 | - Added more redis 5.0.0 commands: (cluster replicas), (client id), (client 38 | unblock), (replicaof), (xack), (xgroup), (xinfo), (xtrim), (xdel), 39 | (xclaim). 40 | 41 | 42 | * Version 1.2.0 (Sep 24, 2018) 43 | 44 | - All command arguments (if any) are now passed as a single list. With this 45 | change, there's no need to use strings for every argument. 46 | 47 | 48 | * Version 1.1.0 (Aug 22, 2018) 49 | 50 | - Switch to GPLv3. 51 | 52 | 53 | * Version 1.0.0 (Aug 8, 2018) 54 | 55 | - This version is not backwards compatible with the initial release 56 | 0.1.0. The main change is that now all commands follow the 57 | specification defined by redis. All the arguments are now given as 58 | strings, this is because the commands are automatically 59 | generated. Before the commands were manually added which made it 60 | very hard to keep the library up-to-date plus each command would 61 | have its own procedure signature. The disadvantge of this approach 62 | is that the commands are less idiomatic, but the big benefit is 63 | that adding new commands is as simple as adding a new line with 64 | the command name. 65 | 66 | The idea of autogenerating the commands was taken from the chicken 67 | scheme redis-client implementation, thanks! 68 | 69 | 70 | * Version 0.1.0 (Jul 14, 2013) 71 | 72 | Initial release. 73 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | # 2 | # configure.ac 3 | # 4 | # Copyright (C) 2013-2022 Aleix Conchillo Flaque 5 | # Copyright (C) 2021 Bonface Munyoki Kilyungi 6 | # 7 | # This file is part of guile-redis. 8 | # 9 | # guile-redis is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # guile-redis is distributed in the hope that it will be useful, but 15 | # WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 | # General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with guile-redis. If not, see https://www.gnu.org/licenses/. 21 | # 22 | 23 | AC_INIT([guile-redis], [2.2.0], [aconchillo@gmail.com]) 24 | AC_CONFIG_MACRO_DIRS([m4]) 25 | AC_CONFIG_SRCDIR(redis.scm) 26 | AC_CONFIG_AUX_DIR([build-aux]) 27 | AM_INIT_AUTOMAKE([color-tests -Wall -Wno-portability]) 28 | AM_SILENT_RULES([yes]) 29 | 30 | dnl We require pkg.m4 (from pkg-config) and guile.m4. 31 | dnl Make sure they are available. 32 | m4_pattern_forbid([PKG_CHECK_MODULES]) 33 | m4_pattern_forbid([^GUILE_PKG]) 34 | 35 | dnl Check for Guile >= 2.2. 36 | GUILE_PKG([3.0 2.2]) 37 | GUILE_PROGS 38 | GUILE_SITE_DIR 39 | 40 | dnl Guile prefix and libdir. 41 | GUILE_PREFIX=`$PKG_CONFIG --print-errors --variable=prefix guile-$GUILE_EFFECTIVE_VERSION` 42 | GUILE_LIBDIR=`$PKG_CONFIG --print-errors --variable=libdir guile-$GUILE_EFFECTIVE_VERSION` 43 | AC_SUBST(GUILE_PREFIX) 44 | AC_SUBST(GUILE_LIBDIR) 45 | 46 | AC_CONFIG_FILES([Makefile redis/Makefile]) 47 | AC_CONFIG_FILES([env], [chmod +x env]) 48 | 49 | AC_OUTPUT 50 | 51 | dnl This is just for printing $libdir below. 52 | LIBDIR=`eval echo $libdir` 53 | LIBDIR=`eval echo $LIBDIR` 54 | AC_SUBST([LIBDIR]) 55 | 56 | echo 57 | echo "*** $PACKAGE $VERSION has been successfully configured ***" 58 | echo 59 | echo "$PACKAGE is using:" 60 | echo 61 | echo " --prefix=$prefix --libdir=$LIBDIR" 62 | echo 63 | echo "If you want to install in Guile system's directory re-run with:" 64 | echo 65 | echo " --prefix=$GUILE_PREFIX --libdir=$GUILE_LIBDIR" 66 | echo 67 | 68 | # configure.ac ends here 69 | -------------------------------------------------------------------------------- /redis/utils.scm: -------------------------------------------------------------------------------- 1 | ;;; (redis utils) --- redis module for Guile. 2 | 3 | ;; Copyright (C) 2013-2021 Aleix Conchillo Flaque 4 | ;; 5 | ;; This file is part of guile-redis. 6 | ;; 7 | ;; guile-redis is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | ;; 12 | ;; guile-redis is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Redis module for Guile 23 | 24 | ;;; Code: 25 | 26 | (define-module (redis utils) 27 | #:use-module (redis connection) 28 | #:use-module (redis commands) 29 | #:use-module (ice-9 rdelim) 30 | #:use-module (ice-9 textual-ports) 31 | #:use-module (rnrs bytevectors) 32 | #:use-module (srfi srfi-9) 33 | #:export (read-reply 34 | send-commands 35 | receive-commands)) 36 | 37 | (define (redis-read-delimited conn) 38 | (let* ((sock (redis-socket conn)) 39 | (str (read-delimited "\r" sock))) 40 | ;; Skip \n 41 | (read-char sock) 42 | str)) 43 | 44 | (define (build-list len proc) 45 | (let loop ((iter len) (result '())) 46 | (cond 47 | ((zero? iter) result) 48 | (else (loop (- iter 1) (cons (proc) result)))))) 49 | 50 | (define (read-reply conn) 51 | (let* ((sock (redis-socket conn)) 52 | (c (read-char sock))) 53 | (case c 54 | ;; Status 55 | ((#\+) (redis-read-delimited conn)) 56 | ;; Integer 57 | ((#\:) (string->number (redis-read-delimited conn))) 58 | ;; Bulk 59 | ((#\$) 60 | (let ((len (string->number (redis-read-delimited conn)))) 61 | (if (>= len 0) (redis-read-delimited conn) '()))) 62 | ;; Multi-bulk 63 | ((#\*) 64 | (let ((len (string->number (redis-read-delimited conn)))) 65 | (reverse (build-list len (lambda () (read-reply conn)))))) 66 | ;; Error 67 | ((#\-) 68 | (let ((err (redis-read-delimited conn))) 69 | (throw 'redis-error err conn))) 70 | (else (throw 'redis-invalid conn))))) 71 | 72 | (define (command->list cmd) 73 | (cons (redis-cmd-name cmd) 74 | (map (lambda (v) 75 | (cond 76 | ((string? v) v) 77 | ((symbol? v) (symbol->string v)) 78 | ((number? v) (number->string v)) 79 | (else (throw 'redis-invalid)))) 80 | (redis-cmd-args cmd)))) 81 | 82 | (define (command->string cmd) 83 | (let ((l (command->list cmd))) 84 | (call-with-output-string 85 | (lambda (port) 86 | (format port "*~a\r\n" (length l)) 87 | (for-each 88 | (lambda (e) 89 | (format port "$~a\r\n" (bytevector-length (string->utf8 e))) 90 | (format port "~a\r\n" e)) 91 | l))))) 92 | 93 | (define (send-command conn cmd) 94 | (let ((sock (redis-socket conn))) 95 | (put-string sock (command->string cmd)) 96 | (force-output sock))) 97 | 98 | (define (send-commands conn commands) 99 | (cond 100 | ((list? commands) 101 | (for-each 102 | (lambda (cmd) (send-command conn cmd)) 103 | commands)) 104 | (else (send-command conn commands)))) 105 | 106 | (define (receive-commands conn commands) 107 | (cond 108 | ((list? commands) 109 | (map 110 | (lambda (cmd) 111 | ((redis-cmd-reply cmd) conn)) 112 | commands)) 113 | (else 114 | ((redis-cmd-reply commands) conn)))) 115 | 116 | ;;; (redis utils) ends here 117 | -------------------------------------------------------------------------------- /redis/pubsub.scm: -------------------------------------------------------------------------------- 1 | ;;; (redis pubsub) --- redis module for Guile. 2 | 3 | ;; Copyright (C) 2013-2022 Aleix Conchillo Flaque 4 | ;; 5 | ;; This file is part of guile-redis. 6 | ;; 7 | ;; guile-redis is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | ;; 12 | ;; guile-redis is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Redis module for Guile 23 | 24 | ;;; Code: 25 | 26 | (define-module (redis pubsub) 27 | #:use-module (redis commands) 28 | #:use-module (redis utils) 29 | #:use-module (ice-9 match) 30 | #:use-module (srfi srfi-1) 31 | #:export (redis-publish 32 | redis-subscribe 33 | redis-unsubscribe 34 | redis-psubscribe 35 | redis-punsubscribe 36 | redis-spublish 37 | redis-ssubscribe 38 | redis-sunsubscribe 39 | redis-subscribe-read)) 40 | 41 | (define (redis-publish connection channel message) 42 | "Publish the given @var{message} to @var{channel} using the provided Redis 43 | client @var{connection}. All subscribers to that channel will receive the 44 | message. Returns the number of clients that received the message." 45 | (send-commands connection (publish channel message)) 46 | (read-reply connection)) 47 | 48 | (define* (redis-subscribe connection channels) 49 | "Subscribe to the given list of @var{channels} using the Redis client 50 | @var{connection}. Returns a list of pairs where the first value is the 51 | subscribed channel and the second value is the total number of subscribed 52 | channels (when that channel was subscribed)." 53 | (redis--subscribe connection (subscribe channels))) 54 | 55 | (define* (redis-unsubscribe connection #:optional channels) 56 | "Unsubscribe from the given optional list of @var{channels} using the Redis 57 | client @var{connection}. If @var{channels} is not specified it will 58 | unsubscribe from all the subscribed channels. Returns a list of pairs where 59 | the first value is the unsubscribed channel and the second value is the total 60 | number of remaining subscribed channels (when that channel was unsubscribed)." 61 | (redis--unsubscribe connection (unsubscribe (or channels '())) "unsubscribe")) 62 | 63 | (define* (redis-psubscribe connection patterns) 64 | "Subscribe to the given list of channel @var{patterns} using the Redis 65 | client @var{connection}. Returns a list of pairs where the first value is the 66 | subscribed pattern and the second value is the total number of subscribed 67 | channel patterns (when that pattern was subscribed)." 68 | (redis--subscribe connection (psubscribe (or patterns '())))) 69 | 70 | (define* (redis-punsubscribe connection #:optional patterns) 71 | "Unsubscribe from the given optional list of channel @var{patterns} using 72 | the Redis client @var{connection}. If @var{channels} is not specified it will 73 | unsubscribe from all the subscribed patterns. Returns a list of pairs where 74 | the first value is the unsubscribed pattern and the second value is the total 75 | number of remaining subscribed channel patterns (when that patterns was 76 | unsubscribed)." 77 | (redis--unsubscribe connection (punsubscribe (or patterns '())) "punsubscribe")) 78 | 79 | (define (redis-spublish connection channel message) 80 | "Publish the given @var{message} to the shard @var{channel} using the provided 81 | Redis client @var{connection}. All subscribers to that channel will receive the 82 | message. Returns the number of clients that received the message." 83 | (send-commands connection (spublish channel message)) 84 | (read-reply connection)) 85 | 86 | (define* (redis-ssubscribe connection channels) 87 | "Subscribe to the given list of shard @var{channels} using the Redis client 88 | @var{connection}. Returns a list of pairs where the first value is the 89 | subscribed channel and the second value is the total number of subscribed 90 | channels (when that channel was subscribed)." 91 | (redis--subscribe connection (ssubscribe channels))) 92 | 93 | (define* (redis-sunsubscribe connection #:optional channels) 94 | "Unsubscribe from the given optional list of shard @var{channels} using the 95 | Redis client @var{connection}. If @var{channels} is not specified it will 96 | unsubscribe from all the subscribed channels. Returns a list of pairs where the 97 | first value is the unsubscribed channel and the second value is the total number 98 | of remaining subscribed channels (when that channel was unsubscribed)." 99 | (redis--unsubscribe connection (sunsubscribe (or channels '())) "sunsubscribe")) 100 | 101 | (define (redis-subscribe-read connection) 102 | "Read the next message from one of the subscribed channels on the given 103 | @var{connection}. This is a blocking operation until a message is received. It 104 | returns a couple of values: the channel where the message was received and the 105 | actual message." 106 | (let ((reply (read-reply connection))) 107 | (match reply 108 | (("message" channel message) (values channel message)) 109 | (("pmessage" pattern channel message) (values channel message)) 110 | (("PONG") "PONG") 111 | (_ (throw 'redis-invalid connection reply))))) 112 | 113 | ;; Internal 114 | 115 | (define (publish channel message) 116 | (apply create-command "PUBLISH" (list channel message))) 117 | 118 | (define (subscribe channels) 119 | (apply create-command "SUBSCRIBE" channels)) 120 | 121 | (define* (unsubscribe #:optional channels) 122 | (apply create-command "UNSUBSCRIBE" (or channels '()))) 123 | 124 | (define (psubscribe patterns) 125 | (apply create-command "PSUBSCRIBE" patterns)) 126 | 127 | (define* (punsubscribe #:optional patterns) 128 | (apply create-command "PUNSUBSCRIBE" (or patterns '()))) 129 | 130 | (define (spublish channel message) 131 | (apply create-command "SPUBLISH" (list channel message))) 132 | 133 | (define (ssubscribe patterns) 134 | (apply create-command "SSUBSCRIBE" patterns)) 135 | 136 | (define* (sunsubscribe #:optional patterns) 137 | (apply create-command "SUNSUBSCRIBE" (or patterns '()))) 138 | 139 | (define* (redis--subscribe connection command) 140 | (send-commands connection command) 141 | (fold (lambda (res prev) 142 | (match-let (((type channel count) (read-reply connection))) 143 | (cons (cons channel count) prev))) 144 | '() (redis-cmd-args command))) 145 | 146 | (define* (redis--unsubscribe connection command expected) 147 | (define (read-multiple-messages continue?) 148 | (let loop ((reply (read-reply connection)) 149 | (result '()) 150 | (remaining (redis-cmd-args command))) 151 | (match reply 152 | ((expected channel count) 153 | (cond ((continue? count remaining) 154 | (loop (read-reply connection) 155 | (cons (cons channel count) result) 156 | (if (pair? remaining) (cdr remaining) '()))) 157 | (else (cons (cons channel count) result)))) 158 | (_ (throw 'redis-invalid connection reply))))) 159 | (send-commands connection command) 160 | (if (pair? (redis-cmd-args command)) 161 | (read-multiple-messages (lambda (count remaining) (pair? remaining))) 162 | (read-multiple-messages (lambda (count remaining) (> count 0))))) 163 | 164 | ;;; (redis pubsub) ends here 165 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # guile-redis 3 | 4 | [![GNU Guile 2.2](https://github.com/aconchillo/guile-redis/actions/workflows/guile2.2.yml/badge.svg)](https://github.com/aconchillo/guile-redis/actions/workflows/guile2.2.yml) 5 | [![GNU Guile 3.0](https://github.com/aconchillo/guile-redis/actions/workflows/guile3.0.yml/badge.svg)](https://github.com/aconchillo/guile-redis/actions/workflows/guile3.0.yml) 6 | 7 | guile-redis is a Guile module for the [Redis](https://redis.io) key-value data 8 | store. It provides all commands up to Redis 7.0 and supports multiple commands, 9 | pipelining and Pub/Sub. 10 | 11 | # Installation 12 | 13 | Download the latest tarball and untar it: 14 | 15 | - [guile-redis-2.2.0.tar.gz](https://download.savannah.gnu.org/releases/guile-redis/guile-redis-2.2.0.tar.gz) 16 | 17 | If you are cloning the repository make sure you run this first: 18 | 19 | $ autoreconf -vif 20 | 21 | Then, run the typical sequence: 22 | 23 | $ ./configure --prefix= 24 | $ make 25 | $ sudo make install 26 | 27 | Where `` should preferably be the same as your system Guile 28 | installation directory (e.g. /usr). 29 | 30 | If everything installed successfully you should be up and running: 31 | 32 | $ guile 33 | scheme@(guile-user)> (use-modules (redis)) 34 | scheme@(guile-user)> 35 | 36 | It might be that you installed guile-redis somewhere differently than 37 | your system's Guile. If so, you need to indicate Guile where to find 38 | guile-redis, for example: 39 | 40 | $ GUILE_LOAD_PATH=/usr/local/share/guile/site guile 41 | 42 | # Usage 43 | 44 | ## Procedures 45 | 46 | The main interface to the Redis server is really simply. It consists 47 | on three procedures, the most important one being /redis-send/ which 48 | basically sends commands to the server. 49 | 50 | - (**redis-connect** #:key host port) : Establish a connection to the redis 51 | server at the given *host* and *port* and return a Redis connection. 52 | 53 | - *host* : it defaults to 127.0.0.1. 54 | - *port* : it defaults to 6379. 55 | 56 | - (**redis-close** connection) : Close the *connection* to the Redis server. 57 | 58 | - (**redis-send** connection commands) : Send one or more *commands* to the 59 | Redis *connection*. When sending multiple commands a list of all the replies 60 | is returned. 61 | 62 | **Returns** : A reply or a list of replies if multiple commands were sent. 63 | 64 | **Throws** 65 | 66 | - *redis-error* : if the Redis server returns an error. The exception has 67 | the error string as an argument. 68 | 69 | - *redis-invalid* : if the user arguments or server's answer cannot be 70 | parsed (hopefully, this is unlikely to happen). 71 | 72 | 73 | ## Redis commands 74 | 75 | All commands in guile-redis are defined with lower-case and hyphenated in the 76 | case of commands that have two or more words. For example, the command 77 | "*CLIENT LIST*" is defined as *client-list*. 78 | 79 | The commands take exaclty the same arguments as defined in the Redis manual 80 | and all the arguments (if any) need to be passed as a single list. For 81 | example: 82 | 83 | (bitfield '(mykey INCRBY i5 100 1 GET u4 0)) 84 | 85 | Note that, internally, guile-redis will automatically convert symbols and 86 | numbers to strings before sending the command to Redis. 87 | 88 | 89 | ## Redis Pub/Sub 90 | 91 | guile-redis >= 2.0.0 adds proper support for [Redis 92 | Pub/Sub](https://redis.io/topics/pubsub). The Pub/Sub commands don't follow 93 | the approach of the rest of commands (except the *PUBSUB* command), instead 94 | there's a procedure for each of them: 95 | 96 | - (**redis-publish** connection channel message) : Publish the given *message* 97 | to *channel* using the provided Redis client *connection*. All subscribers 98 | to that channel will receive the message. 99 | 100 | **Returns** : number of clients that received the message. 101 | 102 | - (**redis-subscribe** connection channels) : Subscribe to the given list of 103 | *channels* using the Redis client *connection*. 104 | 105 | **Returns** : a list of pairs where the first value is the subscribed 106 | channel and the second value is the total number of subscribed channels 107 | (when that channel was subscribed). 108 | 109 | - (**redis-unsubscribe** connection [channels]) : Unsubscribe from the given 110 | optional list of *channels* using the Redis client *connection*. If 111 | *channels* is not specified it will unsubscribe from all the subscribed 112 | channels. 113 | 114 | **Returns** : a list of pairs where the first value is the unsubscribed 115 | channel and the second value is the total number of remaining subscribed 116 | channels (when that channel was unsubscribed). 117 | 118 | - (**redis-psubscribe** connection patterns) : Subscribe to the given list of 119 | channel *patterns* using the Redis client *connection*. 120 | 121 | **Returns** : a list of pairs where the first value is the subscribed 122 | pattern and the second value is the total number of subscribed channel 123 | patterns (when that pattern was subscribed). 124 | 125 | - (**redis-punsubscribe** connection [patterns]) : Unsubscribe from the given 126 | optional list of channel *patterns* using the Redis client *connection*. If 127 | *patterns* is not specified it will unsubscribe from all the subscribed 128 | patterns. 129 | 130 | **Returns** : a list of pairs where the first value is the unsubscribed 131 | pattern and the second value is the total number of remaining subscribed 132 | channel patterns (when that patterns was unsubscribed). 133 | 134 | - (**redis-subscribe-read** connection) : Read the next message from one of 135 | the subscribed channels on the given *connection*. This is a blocking 136 | operation until a message is received. 137 | 138 | **Returns**: a couple of values, the channel where the message was received 139 | and the actual message. 140 | 141 | # Examples 142 | 143 | - Load the module: 144 | 145 | ``` 146 | > (use-modules (redis)) 147 | ``` 148 | 149 | - Create a connection: 150 | 151 | ``` 152 | > (define conn (redis-connect)) 153 | ``` 154 | 155 | - Send a single *PING* command: 156 | 157 | ``` 158 | > (redis-send conn (ping)) 159 | "PONG" 160 | ``` 161 | 162 | - Send a couple of *PING* commands: 163 | 164 | ``` 165 | > (redis-send conn (list (ping) (ping '("hello from guile-redis")))) 166 | ("PONG" "hello from guile-redis") 167 | ``` 168 | 169 | - Set a couple of keys: 170 | 171 | ``` 172 | > (redis-send conn (mset '(hello "world" foo "bar"))) 173 | "OK" 174 | ``` 175 | 176 | - Retrieve the keys just set above: 177 | 178 | ``` 179 | > (redis-send conn (mget '(hello foo))) 180 | ("world" "bar") 181 | ``` 182 | 183 | - Subscribe to the *news* channel: 184 | 185 | ``` 186 | > (redis-subscribe conn '("news")) 187 | (("news" . 1)) 188 | ``` 189 | 190 | - Publish message to the *news* channel (from another REPL): 191 | 192 | ``` 193 | > (redis-publish conn "news" "hello from guile-redis") 194 | 1 195 | ``` 196 | 197 | - Read next message from subscribed channel: 198 | 199 | ``` 200 | > (redis-subscribe-read conn) 201 | "news" 202 | "hello from guile-redis" 203 | ``` 204 | 205 | - Unsubscribe from all channels: 206 | 207 | ``` 208 | > (redis-unsubscribe conn) 209 | (("news" . 0)) 210 | ``` 211 | 212 | - Finally, close the connection: 213 | 214 | ``` 215 | > (redis-close conn) 216 | ``` 217 | 218 | # License 219 | 220 | Copyright (C) 2013-2022 Aleix Conchillo Flaque 221 | 222 | This file is part of guile-redis. 223 | 224 | guile-redis is free software: you can redistribute it and/or modify it 225 | under the terms of the GNU General Public License as published by the 226 | Free Software Foundation; either version 3 of the License, or (at your 227 | option) any later version. 228 | 229 | guile-redis is distributed in the hope that it will be useful, but 230 | WITHOUT ANY WARRANTY; without even the implied warranty of 231 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 232 | General Public License for more details. 233 | 234 | You should have received a copy of the GNU General Public License 235 | along with guile-redis. If not, see https://www.gnu.org/licenses/. 236 | -------------------------------------------------------------------------------- /redis/commands.scm: -------------------------------------------------------------------------------- 1 | ;;; (redis commands) --- redis module for Guile. 2 | 3 | ;; Copyright (C) 2013-2022 Aleix Conchillo Flaque 4 | ;; 5 | ;; This file is part of guile-redis. 6 | ;; 7 | ;; guile-redis is free software: you can redistribute it and/or modify 8 | ;; it under the terms of the GNU General Public License as published by 9 | ;; the Free Software Foundation; either version 3 of the License, or 10 | ;; (at your option) any later version. 11 | ;; 12 | ;; guile-redis is distributed in the hope that it will be useful, but 13 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | ;; General Public License for more details. 16 | ;; 17 | ;; You should have received a copy of the GNU General Public License 18 | ;; along with guile-redis. If not, see https://www.gnu.org/licenses/. 19 | 20 | ;;; Commentary: 21 | 22 | ;; Redis module for Guile 23 | 24 | ;;; Code: 25 | 26 | (define-module (redis commands) 27 | #:use-module (redis utils) 28 | #:use-module (srfi srfi-9) 29 | #:export (create-command 30 | redis-command? 31 | redis-cmd-name 32 | redis-cmd-args 33 | redis-cmd-reply)) 34 | 35 | (define-record-type 36 | (make-command name args reply) 37 | redis-command? 38 | (name redis-cmd-name) 39 | (args redis-cmd-args) 40 | (reply redis-cmd-reply)) 41 | 42 | (define* (create-command name #:rest args) 43 | (make-command name args read-reply)) 44 | 45 | (define-syntax create-commands 46 | (syntax-rules () 47 | ((_ (cmd ...) ...) 48 | (eval 49 | `(begin 50 | ,@(map 51 | (lambda (args) 52 | (apply (lambda* (name #:rest subnames) 53 | (let* ((cmd-name (string-join `(,name ,@subnames) " ")) 54 | (func-name (string->symbol (string-join `(,name ,@subnames) "-")))) 55 | `(begin 56 | (define* (,func-name #:optional args) 57 | (apply create-command ,(string-upcase cmd-name) (or args '()))) 58 | (module-export! (current-module) '(,func-name))))) 59 | args)) 60 | `((,(symbol->string (syntax->datum #'cmd)) ...) ...))) 61 | (current-module))))) 62 | 63 | (create-commands 64 | ;; Bitmap 65 | (bitcount) 66 | (bitfield) 67 | (bitfield_ro) 68 | (bitop) 69 | (bitpos) 70 | (getbit) 71 | (setbit) 72 | ;; Cluster 73 | (asking) 74 | (cluster addslots) 75 | (cluster addslotsrange) 76 | (cluster bumpepoch) 77 | (cluster count-failure-reports) 78 | (cluster countkeysinslot) 79 | (cluster delslots) 80 | (cluster delslotsrange) 81 | (cluster failover) 82 | (cluster flushslots) 83 | (cluster forget) 84 | (cluster getkeysinslot) 85 | (cluster info) 86 | (cluster keyslot) 87 | (cluster links) 88 | (cluster meet) 89 | (cluster myid) 90 | (cluster nodes) 91 | (cluster replicas) 92 | (cluster replicate) 93 | (cluster reset) 94 | (cluster saveconfig) 95 | (cluster set-config-epoch) 96 | (cluster setslot) 97 | (cluster slaves) 98 | (cluster slots) 99 | (readonly) 100 | (readwrite) 101 | ;; Connection 102 | (auth) 103 | (client caching) 104 | (client getname) 105 | (client getredir) 106 | (client id) 107 | (client info) 108 | (client kill) 109 | (client list) 110 | (client no-evict) 111 | (client pause) 112 | (client reply) 113 | (client setname) 114 | (client tracking) 115 | (client trackinginfo) 116 | (client unblock) 117 | (client unpause) 118 | (echo) 119 | (hello) 120 | (ping) 121 | (quit) 122 | (reset) 123 | (select) 124 | ;; Geo 125 | (geoadd) 126 | (geodist) 127 | (geohash) 128 | (geopos) 129 | (georadius) 130 | (georadiusbymember) 131 | (georadiusbymember_ro) 132 | (georadius_ro) 133 | (geosearch) 134 | (geosearchstore) 135 | ;; Hashes 136 | (hdel) 137 | (hexists) 138 | (hget) 139 | (hgetall) 140 | (hincrby) 141 | (hincrbyfloat) 142 | (hkeys) 143 | (hlen) 144 | (hmget) 145 | (hmset) 146 | (hrandfield) 147 | (hscan) 148 | (hset) 149 | (hsetnx) 150 | (hstrlen) 151 | (hvals) 152 | ;; HyperLogLog 153 | (pfadd) 154 | (pfcount) 155 | (pfdebug) 156 | (pfmerge) 157 | (pfselftest) 158 | ;; Keys 159 | (copy) 160 | (del) 161 | (dump) 162 | (exists) 163 | (expire) 164 | (expireat) 165 | (expiretime) 166 | (keys) 167 | (migrate) 168 | (move) 169 | (object encoding) 170 | (object freq) 171 | (object idletime) 172 | (object refcount) 173 | (persist) 174 | (pexpire) 175 | (pexpireat) 176 | (pexpiretime) 177 | (pttl) 178 | (randomkey) 179 | (rename) 180 | (renamenx) 181 | (restore) 182 | (scan) 183 | (sort) 184 | (sort_ro) 185 | (touch) 186 | (ttl) 187 | (type) 188 | (unlink) 189 | (wait) 190 | ;; Lists 191 | (blmove) 192 | (blmpop) 193 | (blpop) 194 | (brpop) 195 | (brpoplpush) 196 | (lindex) 197 | (linsert) 198 | (llen) 199 | (lmove) 200 | (lmpop) 201 | (lpop) 202 | (lpos) 203 | (lpush) 204 | (lpushx) 205 | (lrange) 206 | (lrem) 207 | (lset) 208 | (ltrim) 209 | (rpop) 210 | (rpoplpush) 211 | (rpush) 212 | (rpushx) 213 | ;; Pub/Sub 214 | ;; publish, subscribe, unsubscribe, etc. are defined in pubsub.scm. 215 | (pubsub channels) 216 | (pubsub numpat) 217 | (pubsub numsub) 218 | (pubsub shardchannels) 219 | ;; Scripting 220 | (eval) 221 | (evalsha) 222 | (evalsha_ro) 223 | (eval_ro) 224 | (fcall) 225 | (fcall_ro) 226 | (function delete) 227 | (function dump) 228 | (function flush) 229 | (function kill) 230 | (function list) 231 | (function load) 232 | (function restore) 233 | (function stats) 234 | (script debug) 235 | (script exists) 236 | (script flush) 237 | (script kill) 238 | (script load) 239 | ;; Server 240 | (acl cat) 241 | (acl deluser) 242 | (acl dryrun) 243 | (acl genpass) 244 | (acl getuser) 245 | (acl list) 246 | (acl load) 247 | (acl log) 248 | (acl save) 249 | (acl setuser) 250 | (acl users) 251 | (acl whoami) 252 | (bgrewriteaof) 253 | (bgsave) 254 | (command) 255 | (command count) 256 | (command docs) 257 | (command getkeys) 258 | (command getkeysandflags) 259 | (command info) 260 | (command list) 261 | (config get) 262 | (config resetstat) 263 | (config rewrite) 264 | (config set) 265 | (dbsize) 266 | (failover) 267 | (flushall) 268 | (flushdb) 269 | (info) 270 | (lastsave) 271 | (latency doctor) 272 | (latency graph) 273 | (latency histogram) 274 | (latency history) 275 | (latency latest) 276 | (latency reset) 277 | (lolwut) 278 | (memory doctor) 279 | (memory malloc-stats) 280 | (memory purge) 281 | (memory stats) 282 | (memory usage) 283 | (module list) 284 | (module load) 285 | (module unload) 286 | (monitor) 287 | (psync) 288 | (replconf) 289 | (replicaof) 290 | (restore-asking) 291 | (role) 292 | (save) 293 | (shutdown) 294 | (slaveof) 295 | (slowlog get) 296 | (slowlog len) 297 | (slowlog reset) 298 | (swapdb) 299 | (sync) 300 | (time) 301 | ;; Sets 302 | (sadd) 303 | (scard) 304 | (sdiff) 305 | (sdiffstore) 306 | (sinter) 307 | (sintercard) 308 | (sinterstore) 309 | (sismember) 310 | (smembers) 311 | (smismember) 312 | (smove) 313 | (spop) 314 | (srandmember) 315 | (srem) 316 | (sscan) 317 | (sunion) 318 | (sunionstore) 319 | ;; Sorted Sets 320 | (bzmpop) 321 | (bzpopmax) 322 | (bzpopmin) 323 | (zadd) 324 | (zcard) 325 | (zcount) 326 | (zdiff) 327 | (zdiffstore) 328 | (zincrby) 329 | (zinter) 330 | (zintercard) 331 | (zinterstore) 332 | (zlexcount) 333 | (zmpop) 334 | (zmscore) 335 | (zpopmax) 336 | (zpopmin) 337 | (zrandmember) 338 | (zrange) 339 | (zrangebylex) 340 | (zrangebyscore) 341 | (zrangestore) 342 | (zrank) 343 | (zrem) 344 | (zremrangebylex) 345 | (zremrangebyrank) 346 | (zremrangebyscore) 347 | (zrevrange) 348 | (zrevrangebylex) 349 | (zrevrangebyscore) 350 | (zrevrank) 351 | (zscan) 352 | (zscore) 353 | (zunion) 354 | (zunionstore) 355 | ;; Streams 356 | (xack) 357 | (xadd) 358 | (xautoclaim) 359 | (xclaim) 360 | (xdel) 361 | (xgroup create) 362 | (xgroup createconsumer) 363 | (xgroup delconsumer) 364 | (xgroup destroy) 365 | (xgroup setid) 366 | (xinfo consumers) 367 | (xinfo groups) 368 | (xinfo stream) 369 | (xlen) 370 | (xpending) 371 | (xrange) 372 | (xread) 373 | (xreadgroup) 374 | (xrevrange) 375 | (xsetid) 376 | (xtrim) 377 | ;; Strings 378 | (append) 379 | (decr) 380 | (decrby) 381 | (get) 382 | (getdel) 383 | (getex) 384 | (getrange) 385 | (getset) 386 | (incr) 387 | (incrby) 388 | (incrbyfloat) 389 | (lcs) 390 | (mget) 391 | (mset) 392 | (msetnx) 393 | (psetex) 394 | (set) 395 | (setex) 396 | (setnx) 397 | (setrange) 398 | (strlen) 399 | (substr) 400 | ;; Transactions 401 | (discard) 402 | (exec) 403 | (multi) 404 | (unwatch) 405 | (watch)) 406 | 407 | ;;; (redis commands) ends here 408 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994-1996, 1999-2002, 2004-2017, 2020-2021 Free 5 | Software Foundation, Inc. 6 | 7 | Copying and distribution of this file, with or without modification, 8 | are permitted in any medium without royalty provided the copyright 9 | notice and this notice are preserved. This file is offered as-is, 10 | without warranty of any kind. 11 | 12 | Basic Installation 13 | ================== 14 | 15 | Briefly, the shell command './configure && make && make install' 16 | should configure, build, and install this package. The following 17 | more-detailed instructions are generic; see the 'README' file for 18 | instructions specific to this package. Some packages provide this 19 | 'INSTALL' file but do not implement all of the features documented 20 | below. The lack of an optional feature in a given package is not 21 | necessarily a bug. More recommendations for GNU packages can be found 22 | in *note Makefile Conventions: (standards)Makefile Conventions. 23 | 24 | The 'configure' shell script attempts to guess correct values for 25 | various system-dependent variables used during compilation. It uses 26 | those values to create a 'Makefile' in each directory of the package. 27 | It may also create one or more '.h' files containing system-dependent 28 | definitions. Finally, it creates a shell script 'config.status' that 29 | you can run in the future to recreate the current configuration, and a 30 | file 'config.log' containing compiler output (useful mainly for 31 | debugging 'configure'). 32 | 33 | It can also use an optional file (typically called 'config.cache' and 34 | enabled with '--cache-file=config.cache' or simply '-C') that saves the 35 | results of its tests to speed up reconfiguring. Caching is disabled by 36 | default to prevent problems with accidental use of stale cache files. 37 | 38 | If you need to do unusual things to compile the package, please try 39 | to figure out how 'configure' could check whether to do them, and mail 40 | diffs or instructions to the address given in the 'README' so they can 41 | be considered for the next release. If you are using the cache, and at 42 | some point 'config.cache' contains results you don't want to keep, you 43 | may remove or edit it. 44 | 45 | The file 'configure.ac' (or 'configure.in') is used to create 46 | 'configure' by a program called 'autoconf'. You need 'configure.ac' if 47 | you want to change it or regenerate 'configure' using a newer version of 48 | 'autoconf'. 49 | 50 | The simplest way to compile this package is: 51 | 52 | 1. 'cd' to the directory containing the package's source code and type 53 | './configure' to configure the package for your system. 54 | 55 | Running 'configure' might take a while. While running, it prints 56 | some messages telling which features it is checking for. 57 | 58 | 2. Type 'make' to compile the package. 59 | 60 | 3. Optionally, type 'make check' to run any self-tests that come with 61 | the package, generally using the just-built uninstalled binaries. 62 | 63 | 4. Type 'make install' to install the programs and any data files and 64 | documentation. When installing into a prefix owned by root, it is 65 | recommended that the package be configured and built as a regular 66 | user, and only the 'make install' phase executed with root 67 | privileges. 68 | 69 | 5. Optionally, type 'make installcheck' to repeat any self-tests, but 70 | this time using the binaries in their final installed location. 71 | This target does not install anything. Running this target as a 72 | regular user, particularly if the prior 'make install' required 73 | root privileges, verifies that the installation completed 74 | correctly. 75 | 76 | 6. You can remove the program binaries and object files from the 77 | source code directory by typing 'make clean'. To also remove the 78 | files that 'configure' created (so you can compile the package for 79 | a different kind of computer), type 'make distclean'. There is 80 | also a 'make maintainer-clean' target, but that is intended mainly 81 | for the package's developers. If you use it, you may have to get 82 | all sorts of other programs in order to regenerate files that came 83 | with the distribution. 84 | 85 | 7. Often, you can also type 'make uninstall' to remove the installed 86 | files again. In practice, not all packages have tested that 87 | uninstallation works correctly, even though it is required by the 88 | GNU Coding Standards. 89 | 90 | 8. Some packages, particularly those that use Automake, provide 'make 91 | distcheck', which can by used by developers to test that all other 92 | targets like 'make install' and 'make uninstall' work correctly. 93 | This target is generally not run by end users. 94 | 95 | Compilers and Options 96 | ===================== 97 | 98 | Some systems require unusual options for compilation or linking that 99 | the 'configure' script does not know about. Run './configure --help' 100 | for details on some of the pertinent environment variables. 101 | 102 | You can give 'configure' initial values for configuration parameters 103 | by setting variables in the command line or in the environment. Here is 104 | an example: 105 | 106 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix 107 | 108 | *Note Defining Variables::, for more details. 109 | 110 | Compiling For Multiple Architectures 111 | ==================================== 112 | 113 | You can compile the package for more than one kind of computer at the 114 | same time, by placing the object files for each architecture in their 115 | own directory. To do this, you can use GNU 'make'. 'cd' to the 116 | directory where you want the object files and executables to go and run 117 | the 'configure' script. 'configure' automatically checks for the source 118 | code in the directory that 'configure' is in and in '..'. This is known 119 | as a "VPATH" build. 120 | 121 | With a non-GNU 'make', it is safer to compile the package for one 122 | architecture at a time in the source code directory. After you have 123 | installed the package for one architecture, use 'make distclean' before 124 | reconfiguring for another architecture. 125 | 126 | On MacOS X 10.5 and later systems, you can create libraries and 127 | executables that work on multiple system types--known as "fat" or 128 | "universal" binaries--by specifying multiple '-arch' options to the 129 | compiler but only a single '-arch' option to the preprocessor. Like 130 | this: 131 | 132 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 133 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 134 | CPP="gcc -E" CXXCPP="g++ -E" 135 | 136 | This is not guaranteed to produce working output in all cases, you 137 | may have to build one architecture at a time and combine the results 138 | using the 'lipo' tool if you have problems. 139 | 140 | Installation Names 141 | ================== 142 | 143 | By default, 'make install' installs the package's commands under 144 | '/usr/local/bin', include files under '/usr/local/include', etc. You 145 | can specify an installation prefix other than '/usr/local' by giving 146 | 'configure' the option '--prefix=PREFIX', where PREFIX must be an 147 | absolute file name. 148 | 149 | You can specify separate installation prefixes for 150 | architecture-specific files and architecture-independent files. If you 151 | pass the option '--exec-prefix=PREFIX' to 'configure', the package uses 152 | PREFIX as the prefix for installing programs and libraries. 153 | Documentation and other data files still use the regular prefix. 154 | 155 | In addition, if you use an unusual directory layout you can give 156 | options like '--bindir=DIR' to specify different values for particular 157 | kinds of files. Run 'configure --help' for a list of the directories 158 | you can set and what kinds of files go in them. In general, the default 159 | for these options is expressed in terms of '${prefix}', so that 160 | specifying just '--prefix' will affect all of the other directory 161 | specifications that were not explicitly provided. 162 | 163 | The most portable way to affect installation locations is to pass the 164 | correct locations to 'configure'; however, many packages provide one or 165 | both of the following shortcuts of passing variable assignments to the 166 | 'make install' command line to change installation locations without 167 | having to reconfigure or recompile. 168 | 169 | The first method involves providing an override variable for each 170 | affected directory. For example, 'make install 171 | prefix=/alternate/directory' will choose an alternate location for all 172 | directory configuration variables that were expressed in terms of 173 | '${prefix}'. Any directories that were specified during 'configure', 174 | but not in terms of '${prefix}', must each be overridden at install time 175 | for the entire installation to be relocated. The approach of makefile 176 | variable overrides for each directory variable is required by the GNU 177 | Coding Standards, and ideally causes no recompilation. However, some 178 | platforms have known limitations with the semantics of shared libraries 179 | that end up requiring recompilation when using this method, particularly 180 | noticeable in packages that use GNU Libtool. 181 | 182 | The second method involves providing the 'DESTDIR' variable. For 183 | example, 'make install DESTDIR=/alternate/directory' will prepend 184 | '/alternate/directory' before all installation names. The approach of 185 | 'DESTDIR' overrides is not required by the GNU Coding Standards, and 186 | does not work on platforms that have drive letters. On the other hand, 187 | it does better at avoiding recompilation issues, and works well even 188 | when some directory options were not specified in terms of '${prefix}' 189 | at 'configure' time. 190 | 191 | Optional Features 192 | ================= 193 | 194 | If the package supports it, you can cause programs to be installed 195 | with an extra prefix or suffix on their names by giving 'configure' the 196 | option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. 197 | 198 | Some packages pay attention to '--enable-FEATURE' options to 199 | 'configure', where FEATURE indicates an optional part of the package. 200 | They may also pay attention to '--with-PACKAGE' options, where PACKAGE 201 | is something like 'gnu-as' or 'x' (for the X Window System). The 202 | 'README' should mention any '--enable-' and '--with-' options that the 203 | package recognizes. 204 | 205 | For packages that use the X Window System, 'configure' can usually 206 | find the X include and library files automatically, but if it doesn't, 207 | you can use the 'configure' options '--x-includes=DIR' and 208 | '--x-libraries=DIR' to specify their locations. 209 | 210 | Some packages offer the ability to configure how verbose the 211 | execution of 'make' will be. For these packages, running './configure 212 | --enable-silent-rules' sets the default to minimal output, which can be 213 | overridden with 'make V=1'; while running './configure 214 | --disable-silent-rules' sets the default to verbose, which can be 215 | overridden with 'make V=0'. 216 | 217 | Particular systems 218 | ================== 219 | 220 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC 221 | is not installed, it is recommended to use the following options in 222 | order to use an ANSI C compiler: 223 | 224 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" 225 | 226 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. 227 | 228 | HP-UX 'make' updates targets which have the same timestamps as their 229 | prerequisites, which makes it generally unusable when shipped generated 230 | files such as 'configure' are involved. Use GNU 'make' instead. 231 | 232 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot 233 | parse its '' header file. The option '-nodtk' can be used as a 234 | workaround. If GNU CC is not installed, it is therefore recommended to 235 | try 236 | 237 | ./configure CC="cc" 238 | 239 | and if that doesn't work, try 240 | 241 | ./configure CC="cc -nodtk" 242 | 243 | On Solaris, don't put '/usr/ucb' early in your 'PATH'. This 244 | directory contains several dysfunctional programs; working variants of 245 | these programs are available in '/usr/bin'. So, if you need '/usr/ucb' 246 | in your 'PATH', put it _after_ '/usr/bin'. 247 | 248 | On Haiku, software installed for all users goes in '/boot/common', 249 | not '/usr/local'. It is recommended to use the following options: 250 | 251 | ./configure --prefix=/boot/common 252 | 253 | Specifying the System Type 254 | ========================== 255 | 256 | There may be some features 'configure' cannot figure out 257 | automatically, but needs to determine by the type of machine the package 258 | will run on. Usually, assuming the package is built to be run on the 259 | _same_ architectures, 'configure' can figure that out, but if it prints 260 | a message saying it cannot guess the machine type, give it the 261 | '--build=TYPE' option. TYPE can either be a short name for the system 262 | type, such as 'sun4', or a canonical name which has the form: 263 | 264 | CPU-COMPANY-SYSTEM 265 | 266 | where SYSTEM can have one of these forms: 267 | 268 | OS 269 | KERNEL-OS 270 | 271 | See the file 'config.sub' for the possible values of each field. If 272 | 'config.sub' isn't included in this package, then this package doesn't 273 | need to know the machine type. 274 | 275 | If you are _building_ compiler tools for cross-compiling, you should 276 | use the option '--target=TYPE' to select the type of system they will 277 | produce code for. 278 | 279 | If you want to _use_ a cross compiler, that generates code for a 280 | platform different from the build platform, you should specify the 281 | "host" platform (i.e., that on which the generated programs will 282 | eventually be run) with '--host=TYPE'. 283 | 284 | Sharing Defaults 285 | ================ 286 | 287 | If you want to set default values for 'configure' scripts to share, 288 | you can create a site shell script called 'config.site' that gives 289 | default values for variables like 'CC', 'cache_file', and 'prefix'. 290 | 'configure' looks for 'PREFIX/share/config.site' if it exists, then 291 | 'PREFIX/etc/config.site' if it exists. Or, you can set the 292 | 'CONFIG_SITE' environment variable to the location of the site script. 293 | A warning: not all 'configure' scripts look for a site script. 294 | 295 | Defining Variables 296 | ================== 297 | 298 | Variables not defined in a site shell script can be set in the 299 | environment passed to 'configure'. However, some packages may run 300 | configure again during the build, and the customized values of these 301 | variables may be lost. In order to avoid this problem, you should set 302 | them in the 'configure' command line, using 'VAR=value'. For example: 303 | 304 | ./configure CC=/usr/local2/bin/gcc 305 | 306 | causes the specified 'gcc' to be used as the C compiler (unless it is 307 | overridden in the site shell script). 308 | 309 | Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an 310 | Autoconf limitation. Until the limitation is lifted, you can use this 311 | workaround: 312 | 313 | CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 314 | 315 | 'configure' Invocation 316 | ====================== 317 | 318 | 'configure' recognizes the following options to control how it 319 | operates. 320 | 321 | '--help' 322 | '-h' 323 | Print a summary of all of the options to 'configure', and exit. 324 | 325 | '--help=short' 326 | '--help=recursive' 327 | Print a summary of the options unique to this package's 328 | 'configure', and exit. The 'short' variant lists options used only 329 | in the top level, while the 'recursive' variant lists options also 330 | present in any nested packages. 331 | 332 | '--version' 333 | '-V' 334 | Print the version of Autoconf used to generate the 'configure' 335 | script, and exit. 336 | 337 | '--cache-file=FILE' 338 | Enable the cache: use and save the results of the tests in FILE, 339 | traditionally 'config.cache'. FILE defaults to '/dev/null' to 340 | disable caching. 341 | 342 | '--config-cache' 343 | '-C' 344 | Alias for '--cache-file=config.cache'. 345 | 346 | '--quiet' 347 | '--silent' 348 | '-q' 349 | Do not print messages saying which checks are being made. To 350 | suppress all normal output, redirect it to '/dev/null' (any error 351 | messages will still be shown). 352 | 353 | '--srcdir=DIR' 354 | Look for the package's source code in directory DIR. Usually 355 | 'configure' can determine that directory automatically. 356 | 357 | '--prefix=DIR' 358 | Use DIR as the installation prefix. *note Installation Names:: for 359 | more details, including other options available for fine-tuning the 360 | installation locations. 361 | 362 | '--no-create' 363 | '-n' 364 | Run the configure checks, but stop before creating any output 365 | files. 366 | 367 | 'configure' also accepts some other, not widely useful, options. Run 368 | 'configure --help' for more details. 369 | -------------------------------------------------------------------------------- /m4/guile.m4: -------------------------------------------------------------------------------- 1 | ## Autoconf macros for working with Guile. 2 | ## 3 | ## Copyright (C) 1998,2001, 2006, 2010, 2012, 2013, 2014 Free Software Foundation, Inc. 4 | ## 5 | ## This library is free software; you can redistribute it and/or 6 | ## modify it under the terms of the GNU Lesser General Public License 7 | ## as published by the Free Software Foundation; either version 3 of 8 | ## the License, or (at your option) any later version. 9 | ## 10 | ## This library is distributed in the hope that it will be useful, 11 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | ## Lesser General Public License for more details. 14 | ## 15 | ## You should have received a copy of the GNU Lesser General Public 16 | ## License along with this library; if not, write to the Free Software 17 | ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 18 | ## 02110-1301 USA 19 | 20 | # serial 11 21 | 22 | ## Index 23 | ## ----- 24 | ## 25 | ## GUILE_PKG -- find Guile development files 26 | ## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs 27 | ## GUILE_FLAGS -- set flags for compiling and linking with Guile 28 | ## GUILE_SITE_DIR -- find path to Guile "site" directories 29 | ## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value 30 | ## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module 31 | ## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module 32 | ## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable 33 | ## GUILE_MODULE_EXPORTS -- check if a module exports a variable 34 | ## GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable 35 | 36 | ## Code 37 | ## ---- 38 | 39 | ## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged 40 | ## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory). 41 | 42 | # GUILE_PKG -- find Guile development files 43 | # 44 | # Usage: GUILE_PKG([VERSIONS]) 45 | # 46 | # This macro runs the @code{pkg-config} tool to find development files 47 | # for an available version of Guile. 48 | # 49 | # By default, this macro will search for the latest stable version of 50 | # Guile (e.g. 2.2), falling back to the previous stable version 51 | # (e.g. 2.0) if it is available. If no guile-@var{VERSION}.pc file is 52 | # found, an error is signalled. The found version is stored in 53 | # @var{GUILE_EFFECTIVE_VERSION}. 54 | # 55 | # If @code{GUILE_PROGS} was already invoked, this macro ensures that the 56 | # development files have the same effective version as the Guile 57 | # program. 58 | # 59 | # @var{GUILE_EFFECTIVE_VERSION} is marked for substitution, as by 60 | # @code{AC_SUBST}. 61 | # 62 | AC_DEFUN([GUILE_PKG], 63 | [PKG_PROG_PKG_CONFIG 64 | _guile_versions_to_search="m4_default([$1], [2.2 2.0 1.8])" 65 | if test -n "$GUILE_EFFECTIVE_VERSION"; then 66 | _guile_tmp="" 67 | for v in $_guile_versions_to_search; do 68 | if test "$v" = "$GUILE_EFFECTIVE_VERSION"; then 69 | _guile_tmp=$v 70 | fi 71 | done 72 | if test -z "$_guile_tmp"; then 73 | AC_MSG_FAILURE([searching for guile development files for versions $_guile_versions_to_search, but previously found $GUILE version $GUILE_EFFECTIVE_VERSION]) 74 | fi 75 | _guile_versions_to_search=$GUILE_EFFECTIVE_VERSION 76 | fi 77 | GUILE_EFFECTIVE_VERSION="" 78 | _guile_errors="" 79 | for v in $_guile_versions_to_search; do 80 | if test -z "$GUILE_EFFECTIVE_VERSION"; then 81 | AC_MSG_NOTICE([checking for guile $v]) 82 | PKG_CHECK_EXISTS([guile-$v], [GUILE_EFFECTIVE_VERSION=$v], []) 83 | fi 84 | done 85 | 86 | if test -z "$GUILE_EFFECTIVE_VERSION"; then 87 | AC_MSG_ERROR([ 88 | No Guile development packages were found. 89 | 90 | Please verify that you have Guile installed. If you installed Guile 91 | from a binary distribution, please verify that you have also installed 92 | the development packages. If you installed it yourself, you might need 93 | to adjust your PKG_CONFIG_PATH; see the pkg-config man page for more. 94 | ]) 95 | fi 96 | AC_MSG_NOTICE([found guile $GUILE_EFFECTIVE_VERSION]) 97 | AC_SUBST([GUILE_EFFECTIVE_VERSION]) 98 | ]) 99 | 100 | # GUILE_FLAGS -- set flags for compiling and linking with Guile 101 | # 102 | # Usage: GUILE_FLAGS 103 | # 104 | # This macro runs the @code{pkg-config} tool to find out how to compile 105 | # and link programs against Guile. It sets four variables: 106 | # @var{GUILE_CFLAGS}, @var{GUILE_LDFLAGS}, @var{GUILE_LIBS}, and 107 | # @var{GUILE_LTLIBS}. 108 | # 109 | # @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that 110 | # uses Guile header files. This is almost always just one or more @code{-I} 111 | # flags. 112 | # 113 | # @var{GUILE_LDFLAGS}: flags to pass to the compiler to link a program 114 | # against Guile. This includes @code{-lguile-@var{VERSION}} for the 115 | # Guile library itself, and may also include one or more @code{-L} flag 116 | # to tell the compiler where to find the libraries. But it does not 117 | # include flags that influence the program's runtime search path for 118 | # libraries, and will therefore lead to a program that fails to start, 119 | # unless all necessary libraries are installed in a standard location 120 | # such as @file{/usr/lib}. 121 | # 122 | # @var{GUILE_LIBS} and @var{GUILE_LTLIBS}: flags to pass to the compiler or to 123 | # libtool, respectively, to link a program against Guile. It includes flags 124 | # that augment the program's runtime search path for libraries, so that shared 125 | # libraries will be found at the location where they were during linking, even 126 | # in non-standard locations. @var{GUILE_LIBS} is to be used when linking the 127 | # program directly with the compiler, whereas @var{GUILE_LTLIBS} is to be used 128 | # when linking the program is done through libtool. 129 | # 130 | # The variables are marked for substitution, as by @code{AC_SUBST}. 131 | # 132 | AC_DEFUN([GUILE_FLAGS], 133 | [AC_REQUIRE([GUILE_PKG]) 134 | PKG_CHECK_MODULES(GUILE, [guile-$GUILE_EFFECTIVE_VERSION]) 135 | 136 | dnl GUILE_CFLAGS and GUILE_LIBS are already defined and AC_SUBST'd by 137 | dnl PKG_CHECK_MODULES. But GUILE_LIBS to pkg-config is GUILE_LDFLAGS 138 | dnl to us. 139 | 140 | GUILE_LDFLAGS=$GUILE_LIBS 141 | 142 | dnl Determine the platform dependent parameters needed to use rpath. 143 | dnl AC_LIB_LINKFLAGS_FROM_LIBS is defined in gnulib/m4/lib-link.m4 and needs 144 | dnl the file gnulib/build-aux/config.rpath. 145 | AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LIBS], [$GUILE_LDFLAGS], []) 146 | GUILE_LIBS="$GUILE_LDFLAGS $GUILE_LIBS" 147 | AC_LIB_LINKFLAGS_FROM_LIBS([GUILE_LTLIBS], [$GUILE_LDFLAGS], [yes]) 148 | GUILE_LTLIBS="$GUILE_LDFLAGS $GUILE_LTLIBS" 149 | 150 | AC_SUBST([GUILE_EFFECTIVE_VERSION]) 151 | AC_SUBST([GUILE_CFLAGS]) 152 | AC_SUBST([GUILE_LDFLAGS]) 153 | AC_SUBST([GUILE_LIBS]) 154 | AC_SUBST([GUILE_LTLIBS]) 155 | ]) 156 | 157 | # GUILE_SITE_DIR -- find path to Guile site directories 158 | # 159 | # Usage: GUILE_SITE_DIR 160 | # 161 | # This looks for Guile's "site" directories. The variable @var{GUILE_SITE} will 162 | # be set to Guile's "site" directory for Scheme source files (usually something 163 | # like PREFIX/share/guile/site). @var{GUILE_SITE_CCACHE} will be set to the 164 | # directory for compiled Scheme files also known as @code{.go} files 165 | # (usually something like 166 | # PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/site-ccache). 167 | # @var{GUILE_EXTENSION} will be set to the directory for compiled C extensions 168 | # (usually something like 169 | # PREFIX/lib/guile/@var{GUILE_EFFECTIVE_VERSION}/extensions). The latter two 170 | # are set to blank if the particular version of Guile does not support 171 | # them. Note that this macro will run the macros @code{GUILE_PKG} and 172 | # @code{GUILE_PROGS} if they have not already been run. 173 | # 174 | # The variables are marked for substitution, as by @code{AC_SUBST}. 175 | # 176 | AC_DEFUN([GUILE_SITE_DIR], 177 | [AC_REQUIRE([GUILE_PKG]) 178 | AC_REQUIRE([GUILE_PROGS]) 179 | AC_MSG_CHECKING(for Guile site directory) 180 | GUILE_SITE=`$PKG_CONFIG --print-errors --variable=sitedir guile-$GUILE_EFFECTIVE_VERSION` 181 | AC_MSG_RESULT($GUILE_SITE) 182 | if test "$GUILE_SITE" = ""; then 183 | AC_MSG_FAILURE(sitedir not found) 184 | fi 185 | AC_SUBST(GUILE_SITE) 186 | AC_MSG_CHECKING([for Guile site-ccache directory using pkgconfig]) 187 | GUILE_SITE_CCACHE=`$PKG_CONFIG --variable=siteccachedir guile-$GUILE_EFFECTIVE_VERSION` 188 | if test "$GUILE_SITE_CCACHE" = ""; then 189 | AC_MSG_RESULT(no) 190 | AC_MSG_CHECKING([for Guile site-ccache directory using interpreter]) 191 | GUILE_SITE_CCACHE=`$GUILE -c "(display (if (defined? '%site-ccache-dir) (%site-ccache-dir) \"\"))"` 192 | if test $? != "0" -o "$GUILE_SITE_CCACHE" = ""; then 193 | AC_MSG_RESULT(no) 194 | GUILE_SITE_CCACHE="" 195 | AC_MSG_WARN([siteccachedir not found]) 196 | fi 197 | fi 198 | AC_MSG_RESULT($GUILE_SITE_CCACHE) 199 | AC_SUBST([GUILE_SITE_CCACHE]) 200 | AC_MSG_CHECKING(for Guile extensions directory) 201 | GUILE_EXTENSION=`$PKG_CONFIG --print-errors --variable=extensiondir guile-$GUILE_EFFECTIVE_VERSION` 202 | AC_MSG_RESULT($GUILE_EXTENSION) 203 | if test "$GUILE_EXTENSION" = ""; then 204 | GUILE_EXTENSION="" 205 | AC_MSG_WARN(extensiondir not found) 206 | fi 207 | AC_SUBST(GUILE_EXTENSION) 208 | ]) 209 | 210 | # GUILE_PROGS -- set paths to Guile interpreter, config and tool programs 211 | # 212 | # Usage: GUILE_PROGS([VERSION]) 213 | # 214 | # This macro looks for programs @code{guile} and @code{guild}, setting 215 | # variables @var{GUILE} and @var{GUILD} to their paths, respectively. 216 | # The macro will attempt to find @code{guile} with the suffix of 217 | # @code{-X.Y}, followed by looking for it with the suffix @code{X.Y}, and 218 | # then fall back to looking for @code{guile} with no suffix. If 219 | # @code{guile} is still not found, signal an error. The suffix, if any, 220 | # that was required to find @code{guile} will be used for @code{guild} 221 | # as well. 222 | # 223 | # By default, this macro will search for the latest stable version of 224 | # Guile (e.g. 2.2). x.y or x.y.z versions can be specified. If an older 225 | # version is found, the macro will signal an error. 226 | # 227 | # The effective version of the found @code{guile} is set to 228 | # @var{GUILE_EFFECTIVE_VERSION}. This macro ensures that the effective 229 | # version is compatible with the result of a previous invocation of 230 | # @code{GUILE_FLAGS}, if any. 231 | # 232 | # As a legacy interface, it also looks for @code{guile-config} and 233 | # @code{guile-tools}, setting @var{GUILE_CONFIG} and @var{GUILE_TOOLS}. 234 | # 235 | # The variables are marked for substitution, as by @code{AC_SUBST}. 236 | # 237 | AC_DEFUN([GUILE_PROGS], 238 | [_guile_required_version="m4_default([$1], [$GUILE_EFFECTIVE_VERSION])" 239 | if test -z "$_guile_required_version"; then 240 | _guile_required_version=2.2 241 | fi 242 | 243 | _guile_candidates=guile 244 | _tmp= 245 | for v in `echo "$_guile_required_version" | tr . ' '`; do 246 | if test -n "$_tmp"; then _tmp=$_tmp.; fi 247 | _tmp=$_tmp$v 248 | _guile_candidates="guile-$_tmp guile$_tmp $_guile_candidates" 249 | done 250 | 251 | AC_PATH_PROGS(GUILE,[$_guile_candidates]) 252 | if test -z "$GUILE"; then 253 | AC_MSG_ERROR([guile required but not found]) 254 | fi 255 | 256 | _guile_suffix=`echo "$GUILE" | sed -e 's,^.*/guile\(.*\)$,\1,'` 257 | _guile_effective_version=`$GUILE -c "(display (effective-version))"` 258 | if test -z "$GUILE_EFFECTIVE_VERSION"; then 259 | GUILE_EFFECTIVE_VERSION=$_guile_effective_version 260 | elif test "$GUILE_EFFECTIVE_VERSION" != "$_guile_effective_version"; then 261 | AC_MSG_ERROR([found development files for Guile $GUILE_EFFECTIVE_VERSION, but $GUILE has effective version $_guile_effective_version]) 262 | fi 263 | 264 | _guile_major_version=`$GUILE -c "(display (major-version))"` 265 | _guile_minor_version=`$GUILE -c "(display (minor-version))"` 266 | _guile_micro_version=`$GUILE -c "(display (micro-version))"` 267 | _guile_prog_version="$_guile_major_version.$_guile_minor_version.$_guile_micro_version" 268 | 269 | AC_MSG_CHECKING([for Guile version >= $_guile_required_version]) 270 | _major_version=`echo $_guile_required_version | cut -d . -f 1` 271 | _minor_version=`echo $_guile_required_version | cut -d . -f 2` 272 | _micro_version=`echo $_guile_required_version | cut -d . -f 3` 273 | if test "$_guile_major_version" -gt "$_major_version"; then 274 | true 275 | elif test "$_guile_major_version" -eq "$_major_version"; then 276 | if test "$_guile_minor_version" -gt "$_minor_version"; then 277 | true 278 | elif test "$_guile_minor_version" -eq "$_minor_version"; then 279 | if test -n "$_micro_version"; then 280 | if test "$_guile_micro_version" -lt "$_micro_version"; then 281 | AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found]) 282 | fi 283 | fi 284 | elif test "$GUILE_EFFECTIVE_VERSION" = "$_major_version.$_minor_version" -a -z "$_micro_version"; then 285 | # Allow prereleases that have the right effective version. 286 | true 287 | else 288 | as_fn_error $? "Guile $_guile_required_version required, but $_guile_prog_version found" "$LINENO" 5 289 | fi 290 | elif test "$GUILE_EFFECTIVE_VERSION" = "$_major_version.$_minor_version" -a -z "$_micro_version"; then 291 | # Allow prereleases that have the right effective version. 292 | true 293 | else 294 | AC_MSG_ERROR([Guile $_guile_required_version required, but $_guile_prog_version found]) 295 | fi 296 | AC_MSG_RESULT([$_guile_prog_version]) 297 | 298 | AC_PATH_PROGS(GUILD,[guild$_guile_suffix guild]) 299 | AC_SUBST(GUILD) 300 | 301 | AC_PATH_PROGS(GUILE_CONFIG,[guile-config$_guile_suffix guile-config]) 302 | AC_SUBST(GUILE_CONFIG) 303 | if test -n "$GUILD"; then 304 | GUILE_TOOLS=$GUILD 305 | else 306 | AC_PATH_PROGS(GUILE_TOOLS,[guile-tools$_guile_suffix guile-tools]) 307 | fi 308 | AC_SUBST(GUILE_TOOLS) 309 | ]) 310 | 311 | # GUILE_CHECK -- evaluate Guile Scheme code and capture the return value 312 | # 313 | # Usage: GUILE_CHECK_RETVAL(var,check) 314 | # 315 | # @var{var} is a shell variable name to be set to the return value. 316 | # @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and 317 | # returning either 0 or non-#f to indicate the check passed. 318 | # Non-0 number or #f indicates failure. 319 | # Avoid using the character "#" since that confuses autoconf. 320 | # 321 | AC_DEFUN([GUILE_CHECK], 322 | [AC_REQUIRE([GUILE_PROGS]) 323 | $GUILE -c "$2" > /dev/null 2>&1 324 | $1=$? 325 | ]) 326 | 327 | # GUILE_MODULE_CHECK -- check feature of a Guile Scheme module 328 | # 329 | # Usage: GUILE_MODULE_CHECK(var,module,featuretest,description) 330 | # 331 | # @var{var} is a shell variable name to be set to "yes" or "no". 332 | # @var{module} is a list of symbols, like: (ice-9 common-list). 333 | # @var{featuretest} is an expression acceptable to GUILE_CHECK, q.v. 334 | # @var{description} is a present-tense verb phrase (passed to AC_MSG_CHECKING). 335 | # 336 | AC_DEFUN([GUILE_MODULE_CHECK], 337 | [AC_MSG_CHECKING([if $2 $4]) 338 | GUILE_CHECK($1,(use-modules $2) (exit ((lambda () $3)))) 339 | if test "$$1" = "0" ; then $1=yes ; else $1=no ; fi 340 | AC_MSG_RESULT($$1) 341 | ]) 342 | 343 | # GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module 344 | # 345 | # Usage: GUILE_MODULE_AVAILABLE(var,module) 346 | # 347 | # @var{var} is a shell variable name to be set to "yes" or "no". 348 | # @var{module} is a list of symbols, like: (ice-9 common-list). 349 | # 350 | AC_DEFUN([GUILE_MODULE_AVAILABLE], 351 | [GUILE_MODULE_CHECK($1,$2,0,is available) 352 | ]) 353 | 354 | # GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable 355 | # 356 | # Usage: GUILE_MODULE_REQUIRED(symlist) 357 | # 358 | # @var{symlist} is a list of symbols, WITHOUT surrounding parens, 359 | # like: ice-9 common-list. 360 | # 361 | AC_DEFUN([GUILE_MODULE_REQUIRED], 362 | [GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1)) 363 | if test "$ac_guile_module_required" = "no" ; then 364 | AC_MSG_ERROR([required guile module not found: ($1)]) 365 | fi 366 | ]) 367 | 368 | # GUILE_MODULE_EXPORTS -- check if a module exports a variable 369 | # 370 | # Usage: GUILE_MODULE_EXPORTS(var,module,modvar) 371 | # 372 | # @var{var} is a shell variable to be set to "yes" or "no". 373 | # @var{module} is a list of symbols, like: (ice-9 common-list). 374 | # @var{modvar} is the Guile Scheme variable to check. 375 | # 376 | AC_DEFUN([GUILE_MODULE_EXPORTS], 377 | [GUILE_MODULE_CHECK($1,$2,$3,exports `$3') 378 | ]) 379 | 380 | # GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable 381 | # 382 | # Usage: GUILE_MODULE_REQUIRED_EXPORT(module,modvar) 383 | # 384 | # @var{module} is a list of symbols, like: (ice-9 common-list). 385 | # @var{modvar} is the Guile Scheme variable to check. 386 | # 387 | AC_DEFUN([GUILE_MODULE_REQUIRED_EXPORT], 388 | [GUILE_MODULE_EXPORTS(guile_module_required_export,$1,$2) 389 | if test "$guile_module_required_export" = "no" ; then 390 | AC_MSG_ERROR([module $1 does not export $2; required]) 391 | fi 392 | ]) 393 | 394 | ## guile.m4 ends here 395 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------