aboutsummaryrefslogtreecommitdiff
path: root/ellinika
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-06-17 18:35:54 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-06-17 18:35:54 +0000
commitd2ce7e645d27f63f4ffd1338208dc200d426a3e3 (patch)
treeda2b57f87013de5bd384a606b9d7bab403729d0d /ellinika
parent76446866d5fc6496d15bba9cff6dccdbf7dc3b25 (diff)
downloadellinika-d2ce7e645d27f63f4ffd1338208dc200d426a3e3.tar.gz
ellinika-d2ce7e645d27f63f4ffd1338208dc200d426a3e3.tar.bz2
Rewrite dico-ellinika as a module.
* ellinika/cgi.scm4: Use (ellinika config) and re-export its public symbols. (base-dir, html-dir, sysconf-dir, locale-path, sql-iface) (sql-host, sql-port, sql-database, sql-username, sql-password) (config-file-name): Remove. Symbols defined in config.scm (ellinika-cgi-init): Call ellinika-config-setup. * ellinika/Makefile.am (guile_DATA): Add config.scm. (config.scm): New rule. * ellinika/config.scm4: New file. * cgi-bin/dico-ellinika.scm4: Rewrite as a module. Use (ellinika config), instead of cgi. git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@517 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'ellinika')
-rw-r--r--ellinika/Makefile.am5
-rw-r--r--ellinika/cgi.scm436
-rw-r--r--ellinika/config.scm442
3 files changed, 58 insertions, 25 deletions
diff --git a/ellinika/Makefile.am b/ellinika/Makefile.am
index 85ead0c..248666d 100644
--- a/ellinika/Makefile.am
+++ b/ellinika/Makefile.am
@@ -1,5 +1,5 @@
# This file is part of Ellinika project.
-# Copyright (C) 2004,2006,2007 Sergey Poznyakoff
+# Copyright (C) 2004,2006,2007,2008 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
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
guiledir=$(GUILE_SITE)/$(PACKAGE)
-guile_DATA=xlat.scm cgi.scm i18n.scm
+guile_DATA=xlat.scm cgi.scm i18n.scm config.scm
cgi.m4: Makefile
echo 'divert(-1)' > $@
@@ -40,3 +40,4 @@ SUFFIXES = .scm4 .scm
m4 cgi.m4 $< > $@
cgi.scm: cgi.scm4 cgi.m4
+config.scm: config.scm4 cgi.m4 \ No newline at end of file
diff --git a/ellinika/cgi.scm4 b/ellinika/cgi.scm4
index 661bd4c..9a7dc11 100644
--- a/ellinika/cgi.scm4
+++ b/ellinika/cgi.scm4
@@ -15,7 +15,12 @@
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;;;
-(define-module (ellinika cgi))
+(define-module (ellinika cgi)
+ #:use-module (ellinika config)
+ #:re-export (base-dir html-dir sysconf-dir locale-path
+ sql-iface sql-host sql-port sql-database
+ sql-username sql-password
+ config-file-name ))
(use-modules ifelse(IFACE,[CGI],(www cgi),(guile-user))
(gamma gettext)
@@ -60,13 +65,6 @@ ifelse(IFACE,[CGI],,dnl
;;; User-definable variables
-(define-public base-dir "PREFIX")
-(define-public html-dir "HTMLDIR")
-(define-public sysconf-dir "SYSCONFDIR")
-(define-public locale-path "LOCALEDIR:/usr/share/locale:/usr/local/share/locale")
-(define-public ref-loc #f)
-
-(define-public config-file-name "ellinika.conf")
(define-public dict-template-file-name "dict.html")
(define-public nea-template-file-name "nea.html")
(define-public monima-nea-template-file-name "monima.html")
@@ -74,16 +72,10 @@ ifelse(IFACE,[CGI],,dnl
(define-public word-forms-reference '())
-(define-public sql-iface "mysql") ;; SQL interface ("mysql" or "postgres")
-(define-public sql-host "localhost") ;; SQL server hostname or a path to the UNIX
- ;; socket
-(define-public sql-port 3306) ;; SQL port number (0 for sockaddr_un
- ;; connection)
-(define-public sql-database "ellinika") ;; Name of the database
-(define-public sql-username "gray") ;; Database user name
-(define-public sql-password "") ;; Password for that user name
+(define-public ref-loc #f)
-(define-public match-list-columns 4) ;; Number of colums in fuzzy search output
+;; Number of colums in fuzzy search output
+(define-public match-list-columns 4)
;;; End of user-definable variables
(define-public (language-code lang)
@@ -162,17 +154,15 @@ THUNK.
(define-public (ellinika-cgi-init template-file-name)
;;; Load the site defaults
- (let ((rc-file (string-append sysconf-dir "/" config-file-name)))
- (if (file-exists? rc-file)
- (load rc-file)))
-
-;;; Load the language-specific defaults
+ (ellinika-config-setup)
+
+ ;;; Load the language-specific defaults
(cond
((cgi:value "LANG") =>
(lambda (x)
(if (file-exists? (template-file x template-file-name))
(set! target-language x)))))
-;;; Initialize i18n
+ ;;; Initialize i18n
(let ((x (locale-setup target-language "PACKAGE" locale-path)))
(if x
(set! target-language x))))
diff --git a/ellinika/config.scm4 b/ellinika/config.scm4
new file mode 100644
index 0000000..8032409
--- /dev/null
+++ b/ellinika/config.scm4
@@ -0,0 +1,42 @@
+;;;; -*- scheme -*-
+;;;; Greek Dictionary Web Engine
+;;;; Copyright (C) 2005, 2007, 2008 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
+;;;; the Free Software Foundation; either version 3 of the License, or
+;;;; (at your option) any later version.
+;;;;
+;;;; This program is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+;;;;
+
+(define-module (ellinika config))
+
+(define-public base-dir "PREFIX")
+(define-public html-dir "HTMLDIR")
+(define-public sysconf-dir "SYSCONFDIR")
+(define-public locale-path "LOCALEDIR:/usr/share/locale:/usr/local/share/locale")
+(define-public sql-iface "mysql") ;; SQL interface ("mysql" or "postgres")
+;; SQL server hostname or a path to the UNIX socket
+(define-public sql-host "localhost")
+(define-public sql-port 3306) ;; SQL port number (0 for sockaddr_un
+ ;; connection)
+(define-public sql-database "ellinika") ;; Name of the database
+(define-public sql-username "gray") ;; Database user name
+(define-public sql-password "") ;; Password for that user name
+
+(define-public config-file-name "ellinika.conf")
+
+(define-public (ellinika-config-setup)
+ ;;; Load the site defaults
+ (let ((rc-file (string-append sysconf-dir "/" config-file-name)))
+ (if (file-exists? rc-file)
+ (load rc-file))))
+
+

Return to:

Send suggestions and report system problems to the System administrator.