From 2b99881a880d101ae32a94b3d1e0a792224cb74c Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sat, 10 Jan 2015 09:27:21 +0200 Subject: Switch to guile-www-2.38 * am/guile.m4: Remove. * Makefile.am (install-html): Fix generation of symlinks * configure.ac: Fall back to info prefix, if guile-config info bindir returns empty string. * data/db.struct: Minor change * data/pl/Makefile.am: Add missing silent rule markers * data/ru/Makefile.am: Likewise. * scm/dictrans.scm: Call setlocale. * scm/neatrans.scm: Likewise. * scm/verbop.scm: Likewise. * src/cgi-bin/conj.scm4: Call setlocale. Use cgi:value-u8 instead of cgi:value-u8. * src/cgi-bin/dict.scm4: Likewise. * src/cgi-bin/nea.scm4: Likewise. * src/ellinika/cgi.scm4 (cgi-script-name) (cgi-server-hostname,cgi-server-protocol-name) (cgi-server-protocol-version): Define in CGI mode. (cgi:value-u8): New public function. * src/ellinika/i18n.scm: Conditionally use syncase. --- Makefile.am | 3 +- am/guile.m4 | 110 -------------------------------------------------- configure.ac | 11 ++++- data/db.struct | 6 +-- data/pl/Makefile.am | 4 +- data/ru/Makefile.am | 4 +- scm/dictrans.scm | 4 +- scm/neatrans.scm | 2 + scm/verbop.scm | 4 +- src/cgi-bin/conj.scm4 | 9 +++-- src/cgi-bin/dict.scm4 | 28 +++++++------ src/cgi-bin/nea.scm4 | 22 +++++----- src/ellinika/cgi.scm4 | 25 +++++++++--- src/ellinika/i18n.scm | 6 ++- xml/ru/ellinika.xml | 3 +- xml/ru/rhmata.xml | 8 +++- 16 files changed, 91 insertions(+), 158 deletions(-) delete mode 100644 am/guile.m4 diff --git a/Makefile.am b/Makefile.am index 521b3e0..7fac923 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,7 +41,8 @@ install-html: if test -r $$top_srcdir/xml/$$dir/symlinks; then \ grep -v '^[ \t]*[;#]' $$top_srcdir/xml/$$dir/symlinks | \ sed 's,^/,_,;s,\\.\\./,__/,g' | \ - while read S T; do ln -sf $$S $$T; done; \ + (cd $(DESTDIR)$(HTMLDIR)/$$dir; \ + while read S T; do ln -sf $$S $$T; done); \ fi; \ cd $$here; \ fi; \ diff --git a/am/guile.m4 b/am/guile.m4 deleted file mode 100644 index c793a70..0000000 --- a/am/guile.m4 +++ /dev/null @@ -1,110 +0,0 @@ -dnl This file is part of GNU mailutils. -dnl Copyright (C) 2001,2004 Free Software Foundation, Inc. -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -dnl GNU General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -dnl - -dnl MU_RESULT_ACTIONS -- generate shell code for the result of a test -dnl $1 -- CVAR -- cache variable to check -dnl $2 -- NAME -- if not empty, used to generate a default value TRUE: -dnl `AC_DEFINE(HAVE_NAME)' -dnl $2 -- TRUE -- what to do if the CVAR is not `no' -dnl $3 -- FALSE -- what to do otherwise; defaults to `:' -dnl -AC_DEFUN([MU_RESULT_ACTIONS], [ -[if test "$$1" != "" -a "$$1" != no; then - ]ifelse([$3], , - [AC_DEFINE(HAVE_]translit($2, [a-z ./<>], [A-Z___])[,1,[FIXME])], - [$3])[ -else - ]ifelse([$4], , [:], [$4])[ -fi]])dnl - -AC_DEFUN([MU_CHECK_GUILE], -[ - if test "x$mu_cv_lib_guile" = x; then - cached="" - AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $PATH) - if test $GUILE_CONFIG = no; then - mu_cv_lib_guile=no - else - GUILE_INCLUDES=`guile-config compile` - GUILE_LIBS=`guile-config link` - fi - - if test $GUILE_CONFIG != no; then - AC_MSG_CHECKING(for guile version 1.6 or higher) - GUILE_VERSION=`($GUILE_CONFIG --version 2>&1; echo '')|sed -n 's/guile-config - Guile version \([[0-9]][[0-9]]*\)\.\([[0-9]][[0-9]]*\).*/\1\2/p'` - case "x$GUILE_VERSION" in - x[[0-9]]*) - if test $GUILE_VERSION -lt 16; then - AC_MSG_RESULT(Nope. Version number too low.) - mu_cv_lib_guile=no - else - AC_DEFINE_UNQUOTED(GUILE_VERSION, $GUILE_VERSION, - [Guile version number: MAX*10 + MIN]) - AC_MSG_RESULT(OK) - save_LIBS=$LIBS - save_CFLAGS=$CFLAGS - LIBS="$LIBS $GUILE_LIBS" - CFLAGS="$CFLAGS $GUILE_INCLUDES" - AC_TRY_LINK([#include ], - ifelse([$1], , scm_shell(0, NULL);, [$1]), - [mu_cv_lib_guile=yes], - [mu_cv_lib_guile=no]) - LIBS=$save_LIBS - CFLAGS=$save_CFLAGS - fi ;; - *) AC_MSG_RESULT(Nope. Unknown version number) - mu_cv_lib_guile=no;; - esac - fi - else - cached=" (cached) " - GUILE_INCLUDES=`$GUILE_CONFIG compile` - GUILE_LIBS=`$GUILE_CONFIG link` - fi - AC_MSG_CHECKING(whether to build guile support) - MU_RESULT_ACTIONS([mu_cv_lib_guile],[LIBGUILE],[$2],[$3]) - AC_MSG_RESULT(${cached}$mu_cv_lib_guile) - - if test $mu_cv_lib_guile = yes; then - AC_ARG_WITH([guiledir], - AC_HELP_STRING([--with-guiledir=DIR], - [Specify the directory to install guile modules to]), - [case $withval in - /*) GUILE_SITE=$withval;; - yes) GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site;; - *) AC_MSG_ERROR([Argument to --with-guiledir must be an absolute directory name]);; - esac], - [GUILE_SITE=`$GUILE_CONFIG info pkgdatadir`/site - pfx=$prefix - test "x$pfx" = xNONE && pfx=$ac_default_prefix - case $GUILE_SITE in - $pfx/*) ;; # OK - *) AC_MSG_WARN([guile site directory "$GUILE_SITE" lies outside your current prefix ($pfx).]) - GUILE_SITE='$(datadir)/guile/site' - AC_MSG_WARN([Falling back to ${GUILE_SITE} instead. Use --with-guiledir to force using site directory.]) - ;; - esac]) - fi - - AC_SUBST(GUILE_SITE) - AC_SUBST(GUILE_INCLUDES) - AC_SUBST(GUILE_LIBS) -]) - - - diff --git a/configure.ac b/configure.ac index e545dfa..302f2df 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.61) -AC_REVISION(2015-01-06 14:33:57 gray) +AC_REVISION(2015-01-07 14:56:15 gray) AC_INIT(ellinika, 1.99.99, [gray+ellinika@gnu.org.ua]) AC_CONFIG_SRCDIR(src/cgi-bin/dict.scm4) AC_CONFIG_AUX_DIR([build-aux]) @@ -58,7 +58,16 @@ LIBS="$LIBS $ra_cv_lib_mysqlclient" ## ************** AC_SUBST(GUILE_BINDIR) + GUILE_BINDIR=`guile-config info bindir` +if test -z "$GUILE_BINDIR"; then + GUILE_BINDIR=`guile-config info prefix` + if test -n "$GUILE_BINDIR"; then + GUILE_BINDIR="$GUILE_BINDIR/bin" + else + AC_MSG_ERROR([Cannot determine guile bin directory]) + fi +fi case `guile -c "(display (member \"$GUILE_SITE\" %load-path))(newline)"` in \#f) GUILE_COMMENT=;; diff --git a/data/db.struct b/data/db.struct index 1b2f160..61e3d25 100644 --- a/data/db.struct +++ b/data/db.struct @@ -1,5 +1,5 @@ -- This file is part of Ellinika --- Copyright (C) 2004, 2005, 2007 Sergey Poznyakoff +-- Copyright (C) 2004, 2005, 2007, 2015 Sergey Poznyakoff -- -- Ellinika is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by @@ -160,5 +160,5 @@ CREATE TABLE newsart( ---- -source dbverb.struct; - \ No newline at end of file +source ./dbverb.struct; + diff --git a/data/pl/Makefile.am b/data/pl/Makefile.am index 8707cf2..0965f9b 100644 --- a/data/pl/Makefile.am +++ b/data/pl/Makefile.am @@ -1,5 +1,5 @@ # This file is part of Ellinika project. -# Copyright (C) 2004, 2007 Sergey Poznyakoff +# Copyright (C) 2004, 2007, 2015 Sergey Poznyakoff # # Ellinika is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,6 +19,6 @@ BASEXML=\ 0.xml dict: - $(top_builddir)/scm/dictrans $(BASEXML) + $(AM_V_GEN)LC_ALL=en_US.UTF-8 $(top_builddir)/scm/dictrans $(BASEXML) diff --git a/data/ru/Makefile.am b/data/ru/Makefile.am index 18d1441..b8eb7c7 100644 --- a/data/ru/Makefile.am +++ b/data/ru/Makefile.am @@ -1,5 +1,5 @@ # This file is part of Ellinika project. -# Copyright (C) 2004, 2007 Sergey Poznyakoff +# Copyright (C) 2004, 2007, 2015 Sergey Poznyakoff # # Ellinika is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -48,6 +48,6 @@ EXTRA_DIST=\ iliada/2.4.xml dict: - $(top_builddir)/scm/dictrans $(BASEXML) + $(AM_V_GEN)LC_ALL=en_US.UTF-8 $(top_builddir)/scm/dictrans $(BASEXML) diff --git a/scm/dictrans.scm b/scm/dictrans.scm index 2148929..9f1cfd5 100644 --- a/scm/dictrans.scm +++ b/scm/dictrans.scm @@ -2,7 +2,7 @@ =AUTOGENERATED= !# ;;;; This file is part of Ellinika -;;;; Copyright (C) 2004, 2005, 2007, 2010 Sergey Poznyakoff +;;;; Copyright (C) 2004, 2005, 2007, 2010, 2015 Sergey Poznyakoff ;;;; ;;;; Ellinika is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -93,6 +93,8 @@ (if (= (string->number (major-version)) 1) (use-modules (ice-9 syncase))) +(setlocale LC_ALL "") + (define compile-only #f) (define cleanup-option #f) (define preserve-option #f) diff --git a/scm/neatrans.scm b/scm/neatrans.scm index 333453f..4f0fea3 100644 --- a/scm/neatrans.scm +++ b/scm/neatrans.scm @@ -40,6 +40,8 @@ (if (= (string->number (major-version)) 1) (use-modules (ice-9 syncase))) +(setlocale LC_ALL "") + (define compile-only #f) (define cleanup-option #f) (define force-option #f) diff --git a/scm/verbop.scm b/scm/verbop.scm index 0ad0f90..b500213 100644 --- a/scm/verbop.scm +++ b/scm/verbop.scm @@ -4,7 +4,7 @@ main='(module-ref (resolve-module '\''(src verbop)) '\'main')' exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$@" !# ;;;; This file is part of Ellinika -;;;; Copyright (C) 2011 Sergey Poznyakoff +;;;; Copyright (C) 2011, 2015 Sergey Poznyakoff ;;;; ;;;; Ellinika is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -31,6 +31,8 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$@" (ellinika tenses) (ice-9 getopt-long)) +(setlocale LC_ALL "") + (define cleanup-option #f) (define force-option #f) (define debug-level 0) diff --git a/src/cgi-bin/conj.scm4 b/src/cgi-bin/conj.scm4 index 83fb846..6a49c62 100644 --- a/src/cgi-bin/conj.scm4 +++ b/src/cgi-bin/conj.scm4 @@ -1,5 +1,5 @@ ;;;; Greek Dictionary Web Engine -;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011 Sergey Poznyakoff +;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011, 2015 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -18,6 +18,7 @@ ;;; Tailor this statement to your needs if necessary. (set! %load-path (cons "GUILE_SITE" %load-path)) +(setlocale LC_ALL "") (use-modules ifelse(IFACE,[CGI],(www cgi),(guile-user)) (srfi srfi-1) (ice-9 rdelim) @@ -61,7 +62,7 @@ ifelse(IFACE,[CGI],(cgi:init)) number s) #f)) @@ -112,7 +115,7 @@ ifelse(IFACE,[CGI],(cgi:init)) ") - (let ((selected-choice (or (let ((s (cgi:value "pos"))) + (let ((selected-choice (or (let ((s (cgi:value-u8 "pos"))) (if s (string->number s) #f)) @@ -166,7 +169,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (display "") (display (list-ref category 1)) (display "") - (let ((selected-choice (or (let ((s (cgi:value (list-ref category 0)))) + (let ((selected-choice (or (let ((s (cgi:value-u8 (list-ref category 0)))) (if s (string->number s) #f)) @@ -353,7 +356,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (list-ref part-of-speech (string->number pos)))) (if (or (not (string-null? key)) (not (null? theme))) (set! where-cond (cons - (if (string=? (cgi:value "joinpos") "0") + (if (string=? (cgi:value-u8 "joinpos") "0") " AND" " OR") where-cond))) @@ -418,21 +421,20 @@ ifelse(IFACE,[CGI],(cgi:init)) (define (dict-search) - (let ((keyval (if (cgi:value "ident") - (dict:decode-string (cgi:value "ident")) - (cgi:value "key"))) + (let ((keyval (or (cgi:value-u8 "ident") + (cgi:value-u8 "key"))) (theme (do ((catlist (get-topic-list) (cdr catlist)) (ret '())) ((null? catlist) ret) (let ((name (caar catlist))) - (let ((v (cgi:value name))) + (let ((v (cgi:value-u8 name))) (if (and v (> (string->number v) 0)) (set! ret (append ret (list (= (string->number - (cgi:value (string-append "join" name))) 0) + (cgi:value-u8 (string-append "join" name))) 0) v)))))))) - (pos (or (cgi:value "pos") "0"))) + (pos (or (cgi:value-u8 "pos") "0"))) (sql-catch-failure (cond @@ -521,7 +523,7 @@ dict.forms,articles.subindex,articles.meaning,(dict.pos & conv(\"100000\",16,10) (cond ((string=? name "lang")) (else - (let ((v (cgi:value name))) + (let ((v (cgi:value-u8 name))) (cond ((and v (not (string-null? v))) (display "&") (display name) diff --git a/src/cgi-bin/nea.scm4 b/src/cgi-bin/nea.scm4 index f64aca2..e366a7c 100644 --- a/src/cgi-bin/nea.scm4 +++ b/src/cgi-bin/nea.scm4 @@ -1,5 +1,5 @@ ;;;; News page for Ellinika -;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011 Sergey Poznyakoff +;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010, 2011, 2015 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (define tmpl (if (and monima-nea-template-file-name - (cgi:value "timestamp")) + (cgi:value-u8 "timestamp")) monima-nea-template-file-name nea-template-file-name)) @@ -177,13 +177,13 @@ ifelse(IFACE,[CGI],(cgi:init)) 0))) (from (catch #t (lambda () - (let ((x (string->number (cgi:value "from")))) + (let ((x (string->number (cgi:value-u8 "from")))) (if (< x count) x 0))) (lambda args 0))) - (fwd (let ((dir (cgi:value "dir"))) + (fwd (let ((dir (cgi:value-u8 "dir"))) (or (not dir) (string=? dir "1")))) (entries (collect-entries from fwd))) @@ -199,7 +199,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (let ((num-entries (length result)) (begin (if fwd from start)) (end (if fwd start from)) - (id (cgi:value "id"))) + (id (cgi:value-u8 "id"))) (cond ((not (and (= from 0) (< num-entries nea-max-rows))) @@ -273,7 +273,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (display "\n") (display (list-ref item 2)) (display "") - (if (not (cgi:value "timestamp")) + (if (not (cgi:value-u8 "timestamp")) (permalink "span" (list-ref item 1))) (display "")) @@ -337,7 +337,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (cond ((string=? name "lang")) (else - (let ((v (cgi:value name))) + (let ((v (cgi:value-u8 name))) (cond ((and v (not (string-null? v))) (display "&") (display name) @@ -435,7 +435,7 @@ ifelse(IFACE,[CGI],(cgi:init)) ;;; Main (cond - ((cgi:value "rss") + ((cgi:value-u8 "rss") ifelse(IFACE,[CGI], (display ["Content-type: text/xml; charset=utf-8\r\n\r\n"]), (request-rec:set-content-type! Request ["text/xml; charset=UTF-8"])) @@ -447,15 +447,15 @@ ifelse(IFACE,[CGI],(cgi:init)) (display ["Content-type: text/html; charset=utf-8\r\n\r\n"])) (ellinika:sql-connect ellinika-sql-connection) (cond - ((or (cgi:value "timestamp") (cgi:value "id")) + ((or (cgi:value-u8 "timestamp") (cgi:value-u8 "id")) (let ((tuples (cond - ((cgi:value "timestamp") => + ((cgi:value-u8 "timestamp") => (lambda (ts) (ellinika:sql-query "SELECT date,unix_timestamp(date),ident\ FROM news WHERE unix_timestamp(date)=~Q" ts))) - ((cgi:value "id") => + ((cgi:value-u8 "id") => (lambda (id) (ellinika:sql-query "SELECT date,unix_timestamp(date),ident\ diff --git a/src/ellinika/cgi.scm4 b/src/ellinika/cgi.scm4 index 8c9b54d..51f9570 100644 --- a/src/ellinika/cgi.scm4 +++ b/src/ellinika/cgi.scm4 @@ -1,6 +1,5 @@ -;;;; -*- scheme -*- -;;;; Greek Dictionary Web Engine -;;;; Copyright (C) 2005, 2007, 2010 Sergey Poznyakoff +;;;; Greek Dictionary Web Engine -*- scheme -*- +;;;; Copyright (C) 2005, 2007, 2010, 2015 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -19,12 +18,28 @@ #:use-module (ellinika config) #:use-module (ellinika i18n) #:use-module ifelse(IFACE,[CGI],(www cgi),(guile-user)) + #:use-module (ice-9 iconv) + #:use-module (rnrs bytevectors) #:re-export (base-dir html-dir sysconf-dir locale-path ellinika-sql-connection config-file-name )) -ifelse(IFACE,[CGI],,dnl +ifelse(IFACE,[CGI],[ +(define-public cgi-script-name + (cgi:getenv 'script-name)) +(define-public cgi-server-hostname + (cgi:getenv 'server-hostname)) +(define-public cgi-server-protocol-name + (cgi:getenv 'server-protocol-name)) +(define-public cgi-server-protocol-version + (cgi:getenv 'server-protocol-version)) +(define-public (cgi:value-u8 key) + (let ((x (cgi:value key))) + (if x + (utf8->string (string->bytevector x "ISO-8859-1")) + x))) +],[ (define form-data (append (parse-form-data @@ -59,7 +74,7 @@ ifelse(IFACE,[CGI],,dnl (set! cgi-server-protocol-version (substring server-protocol (1+ slash)))))) -) +]) ;;; User-definable variables diff --git a/src/ellinika/i18n.scm b/src/ellinika/i18n.scm index c05d727..40cb47d 100644 --- a/src/ellinika/i18n.scm +++ b/src/ellinika/i18n.scm @@ -1,5 +1,5 @@ ;;;; This file is part of Greek Dictionary Web Engine -;;;; Copyright (C) 2006, 2007 Sergey Poznyakoff +;;;; Copyright (C) 2006, 2007, 2015 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -15,10 +15,12 @@ ;;;; along with this program. If not, see . (define-module (ellinika i18n) - #:use-syntax (ice-9 syncase) #:export-syntax (_) #:export (locale-setup)) +(if (= (string->number (major-version)) 1) + (use-modules (ice-9 syncase))) + (define-syntax _ (syntax-rules () ((_ msg) (gettext msg)))) diff --git a/xml/ru/ellinika.xml b/xml/ru/ellinika.xml index 2a0068d..97a801f 100644 --- a/xml/ru/ellinika.xml +++ b/xml/ru/ellinika.xml @@ -1,5 +1,5 @@ - -- cgit v1.2.1