From 94911abf57ac2b00e4f628758bb9bb5c082d6c27 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Wed, 13 Oct 2004 18:58:56 +0000 Subject: #:topic was handled incorrectly. Improved --help output git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@238 941c8c0f-9102-463b-b60b-cd22ce0e6858 --- scm/dictrans.scm | 72 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 21 deletions(-) (limited to 'scm') diff --git a/scm/dictrans.scm b/scm/dictrans.scm index fb4064f..d0724b0 100644 --- a/scm/dictrans.scm +++ b/scm/dictrans.scm @@ -84,7 +84,7 @@ ;;; Tailor this statement to your needs if necessary. ;=GUILE_COMMENT=;(set! %load-path (cons "=GUILE_SITE=" %load-path)) - +(set! %load-path (cons "/home/gray/linguae/ellinika/" %load-path)) (use-modules (xmltools xmltrans) (gamma sql) (ellinika xlat) @@ -212,32 +212,25 @@ (mark-invalid))) (vector-set! node 1 f))) ((node-set #:xref node x) - (cond - ((node-get #:xref node) => - (lambda (xlist) - (vector-set! node 2 (append xlist (list x))))) - (else - (vector-set! node 2 (list x))))) + (vector-set! node 2 (append (node-get #:xref node) (list x)))) ((node-set #:p-article node p) - (cond - ((node-get #:p-list node) => - (lambda (plist) - (vector-set! node 3 (append plist (list p))))) - (else - (vector-set! node 3 (list p))))) + (vector-set! node 3 (append (node-get #:p-list node) (list p)))) ((node-set #:topic node t) ;; FIXME: Scope of is position-dependent relative to

- (for-each - (lambda (p) - (p-article-set #:topic p t)) - (node-get #:p-list node))) + (let ((pl (node-get #:p-list node))) + (if (null? pl) + (current-article-set #:topic t) + (for-each + (lambda (p) + (p-article-set #:topic p t)) + pl)))) ((node-set #:locus node loc) (vector-set! node 4 loc)))) + (define-macro (current-node-set key val) `(node-set ,key current-node ,val)) - (define p-article #f) (define-syntax p-article-get @@ -280,9 +273,13 @@ ((p-article-set #:topic article val) (p-set #:topic article 4 val)))) -(define-macro (current-article-set key val) - `(p-article-set ,key p-article ,val)) +;(define-macro (current-article-set key val) +; `(p-article-set ,key p-article ,val)) +(define-syntax current-article-set + (syntax-rules () + ((current-article-set key val) + (p-article-set key p-article val)))) ;;; Node list (define node-list '()) @@ -809,7 +806,40 @@ (help))) (define (usage) - (display "usage: dictrans OPTIONS FILES\n")) + (display "usage: dictrans OPTIONS FILES +dictrans parses XML dictionary files in Ellinika dictionary format +and stores them into SQL database. + +General options: + + --check Only check input syntax and consistency. Do not + update the database. This means that dictrans will + not access the database at all, so some errors + (mistyped parts of speech and the like) may slip in + unnoticed. + --verbose Verbosely display SQL queries and their results. + --debug NUMBER Set debugging level (0 < NUMBER <= 100) + +SQL related options: + + --interface STRING Select SQL interface to use. STRING may be + either \"mysql\" (the default) or \"postgres\". + --host HOST-OR-PATH Set name or IP address of the host running SQL + database, or path to the database I/O socket. + --database NAME Set name of the database to use. + --port NUMBER Set the SQL port number + --user USER-NAME Set SQL user name. + --password STRING Set the SQL password + + --cleanup Clean up the database (delete all entries from all the + tables) before proceeding. Use this option with care. + --preserve Do not delete resolved entries from pending_links + table. This is intended mainly for debugging. + +Informational options: + + --help Output this help info +\n")) (define (cons? p) (and (pair? p) (not (list? p)))) -- cgit v1.2.1