aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-15 00:13:17 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-06-15 00:13:17 +0300
commita27881a1c5bd7d8f8f42cd6526adf80815acfe63 (patch)
tree821fa9529cf0989fbad1a61ecf7873aa754b18aa
parent1ffd88231386c104474103fe641cad7fa535f3ec (diff)
downloadellinika-a27881a1c5bd7d8f8f42cd6526adf80815acfe63.tar.gz
ellinika-a27881a1c5bd7d8f8f42cd6526adf80815acfe63.tar.bz2
Minor change:
* scm/verbop.scm: Use module syntax.
-rw-r--r--scm/verbop.scm159
1 files changed, 85 insertions, 74 deletions
diff --git a/scm/verbop.scm b/scm/verbop.scm
index 5192b87..ee86035 100644
--- a/scm/verbop.scm
+++ b/scm/verbop.scm
@@ -1,5 +1,7 @@
1#! =GUILE_BINDIR=/guile -s 1#! /bin/sh
2=AUTOGENERATED= 2# aside from this initial boilerplate, this is actually -*- scheme -*- code
3main='(module-ref (resolve-module '\''(src verbop)) '\'main')'
4exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$@"
3!# 5!#
4;;;; This file is part of Ellinika 6;;;; This file is part of Ellinika
5;;;; Copyright (C) 2011 Sergey Poznyakoff 7;;;; Copyright (C) 2011 Sergey Poznyakoff
@@ -17,6 +19,11 @@
17;;;; You should have received a copy of the GNU General Public License 19;;;; You should have received a copy of the GNU General Public License
18;;;; along with this program. If not, see <http://www.gnu.org/licenses/>. 20;;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
19;;;; 21;;;;
22
23;;; Main procedure
24(define-module (src verbop)
25 :export (verbop))
26
20(use-modules (srfi srfi-1) 27(use-modules (srfi srfi-1)
21 (xmltools xmltrans) 28 (xmltools xmltrans)
22 (ellinika elmorph) 29 (ellinika elmorph)
@@ -742,78 +749,82 @@ Informational options:
742(define (cons? p) 749(define (cons? p)
743 (and (pair? p) (not (list? p)))) 750 (and (pair? p) (not (list? p))))
744 751
745(for-each 752(define (main . args)
746 (lambda (x) 753 (for-each
747 (cond 754 (lambda (x)
748 ((cons? x) 755 (cond
749 (case (car x) 756 ((cons? x)
750 ((cleanup) 757 (case (car x)
751 (set! cleanup-option #t)) 758 ((cleanup)
752 ((database) 759 (set! cleanup-option #t))
753 (add-conn-param #:db (cdr x))) 760 ((database)
754 ((host) 761 (add-conn-param #:db (cdr x)))
755 (add-conn-param #:host (cdr x))) 762 ((host)
756 ((port) 763 (add-conn-param #:host (cdr x)))
757 (add-conn-param #:port (string->number (cdr x)))) 764 ((port)
758 ((password) 765 (add-conn-param #:port (string->number (cdr x))))
759 (add-conn-param #:pass (cdr x))) 766 ((password)
760 ((user) 767 (add-conn-param #:pass (cdr x)))
761 (add-conn-param #:user (cdr x))) 768 ((user)
762 ((interface) 769 (add-conn-param #:user (cdr x)))
763 (add-conn-param #:iface (cdr x))) 770 ((interface)
764 ((verbose) 771 (add-conn-param #:iface (cdr x)))
765 (set! verbose-option #t)) 772 ((verbose)
766 ((preserve) 773 (set! verbose-option #t))
767 (set! preserve-option #t)) 774 ((preserve)
768 ((debug) 775 (set! preserve-option #t))
769 (set! debug-level (string->number (cdr x))) 776 ((debug)
770 (set! ellinika:sql-verbose #t)) 777 (set! debug-level (string->number (cdr x)))
771 ((dry-run) 778 (set! ellinika:sql-verbose #t))
772 (set! ellinika:sql-dry-run #t) 779 ((dry-run)
773 (set! ellinika:sql-verbose #t)) 780 (set! ellinika:sql-dry-run #t)
774 ((help) 781 (set! ellinika:sql-verbose #t))
775 (usage) 782 ((help)
776 (exit 0)))) 783 (usage)
777 (else 784 (exit 0))))
778 (set! input-files (cdr x))))) 785 (else
779 (getopt-long (command-line) grammar)) 786 (set! input-files (cdr x)))))
780 787 (getopt-long args grammar))
781(if (null? input-files) 788
782 (begin 789 (if (null? input-files)
783 (display "Input files not specified\n" (current-error-port)) 790 (begin
784 (exit 1))) 791 (display "Input files not specified\n" (current-error-port))
785 792 (exit 1)))
786(if (not (ellinika:sql-connect ellinika-sql-connection)) 793
787 (begin 794 (if (not (ellinika:sql-connect ellinika-sql-connection))
788 (display "Cannot connect to the database\n" (current-error-port)) 795 (begin
789 (exit 1))) 796 (display "Cannot connect to the database\n" (current-error-port))
790(set! flect-ident (query-number "SELECT MAX(ident) FROM verbflect")) 797 (exit 1)))
791 798 (set! flect-ident (query-number "SELECT MAX(ident) FROM verbflect"))
792(cond 799
793 (cleanup-option 800 (cond
794 (ellinika:sql-query "DELETE FROM verbflect where ident > 99") 801 (cleanup-option
795 (ellinika:sql-query "DELETE FROM verbclass") 802 (ellinika:sql-query "DELETE FROM verbflect where ident > 99")
796 (ellinika:sql-query "DELETE FROM verbtense") 803 (ellinika:sql-query "DELETE FROM verbclass")
797 (ellinika:sql-query "DELETE FROM irregular_root") 804 (ellinika:sql-query "DELETE FROM verbtense")
798 (ellinika:sql-query "DELETE FROM individual_verb"))) 805 (ellinika:sql-query "DELETE FROM irregular_root")
799 806 (ellinika:sql-query "DELETE FROM individual_verb")))
800(set! class-list 807
801 (cons "I" 808 (set! class-list
802 (if ellinika:sql-dry-run 809 (cons "I"
803 (list "A" "B1" "B2") 810 (if ellinika:sql-dry-run
804 (map 811 (list "A" "B1" "B2")
805 car 812 (map
806 (ellinika:sql-query 813 car
807 "SELECT DISTINCT conj FROM conjugation ORDER BY 1"))))) 814 (ellinika:sql-query
808 815 "SELECT DISTINCT conj FROM conjugation ORDER BY 1")))))
809 816
810(for-each 817
811 (lambda (x) 818 (for-each
812 (if (not (xmltrans:parse-file x)) 819 (lambda (x)
813 (exit 1))) 820 (if (not (xmltrans:parse-file x))
814 input-files) 821 (exit 1)))
815 822 input-files)
816(ellinika:sql-disconnect) 823
824 (ellinika:sql-disconnect))
825
826;;;; EOF
827
817 828
818 829
819 830

Return to:

Send suggestions and report system problems to the System administrator.