[BACK]Return to init-openxm.scm CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

Annotation of OpenXM/src/kxx/init-openxm.scm, Revision 1.14

1.14    ! ohara       1: ; $OpenXM: OpenXM/src/kxx/init-openxm.scm,v 1.13 2004/04/16 07:50:22 ohara Exp $
1.13      ohara       2:
                      3: (define (alist-search alist)
                      4:   (let* ((lang (or (getenv "LANG") "C"))
                      5:          (ent (assoc (substring lang 0 (min (string-length lang) 2)) alist)))
                      6:     (if ent (cdr ent) (cdr (assoc "C" alist)))))
                      7:
                      8: (define manual-asir2000
                      9:   (alist-search
                     10:    '(("C"  . "doc/asir2000/html-eg/man_toc.html") ("ja" . "doc/asir2000/html-jp/man_toc.html"))))
                     11:
                     12: (define manual-asir-contrib
                     13:   (alist-search
                     14:    '(("C"  . "doc/asir-contrib/html-en/cman-en_toc.html") ("ja" . "doc/asir-contrib/html-ja/cman-ja_toc.html"))))
1.3       ohara      15:
1.7       ohara      16: (define (openxm-eval t)
1.3       ohara      17:   (import-from (texmacs plugin plugin-cmd))
                     18:   (import-from (texmacs plugin plugin-convert))
                     19:   (plugin-eval "openxm" "default" (object->tree t)))
                     20:
1.7       ohara      21: (define (openxm-eval-paste t)
                     22:   (insert-tree (object->tree (openxm-eval t))))
1.5       ohara      23:
                     24: (define (openxm-path t)
                     25:   (if (string? t)
                     26:     (let* ((openxm-home (or (getenv "OpenXM_HOME") "/usr/local/OpenXM"))
1.7       ohara      27:            (local-path (string-append openxm-home "/" t))
                     28:            (web-prefix "http://www.math.kobe-u.ac.jp/OpenXM/Current/")
                     29:            (web-path   (string-append web-prefix t)))
1.5       ohara      30:       (if (url-exists? local-path) local-path web-path))))
1.2       ohara      31:
1.8       ohara      32: (define w3m-cmd
                     33:   (cond
                     34:    ((url-exists-in-path? "w3m")
1.9       ohara      35:     (cond ((url-exists-in-path? "rxvt")  "rxvt  -g 100x50 -e w3m")
1.11      ohara      36:           ((url-exists-in-path? "kterm") "kterm -g 100x50 -e w3m")
1.9       ohara      37:           ((url-exists-in-path? "xterm") "xterm -g 100x50 -e w3m")
                     38:           (else #f)))
1.8       ohara      39:    ((url-exists-in-path? "mozilla" ) "mozilla" )
                     40:    ((url-exists-in-path? "netscape") "netscape")
                     41:    ((url-exists-in-path? "iexplore") "iexplore")
                     42:    (else #f)))
                     43:
1.2       ohara      44: (define (w3m t)
1.8       ohara      45:   (if (and (string? t) w3m-cmd)
                     46:     (system (string-append w3m-cmd " " t " &"))))
1.2       ohara      47:
1.5       ohara      48: (define (w3m-search t)
                     49:   (w3m (openxm-path t)))
1.1       ohara      50:
                     51: (define (openxm-initialize)
                     52:   (menu-extend texmacs-session-help-icons
1.5       ohara      53:     (if (in-openxm?)
1.1       ohara      54:     |
                     55:     ((balloon (icon "tm_help.xpm") "Risa/Asir manual")
1.13      ohara      56:      (w3m-search manual-asir2000))))
1.1       ohara      57:   (menu-extend texmacs-extra-menu
                     58:     (if (in-openxm?)
                     59:       (=> "OpenXM"
1.3       ohara      60:         (-> "Select engines"
                     61:           ("Risa/Asir" (insert-string "!asir;"))
                     62:           ("Kan/sm1"   (insert-string "!sm1;")))
1.7       ohara      63:         (-> "Select display style"
                     64:           ("LaTeX"     (openxm-eval "!latex;"))
                     65:           ("verbatim"  (openxm-eval "!verbatim;")))
                     66:         (-> "Load Modules (Asir)"
1.11      ohara      67:           ("ccurve"    (openxm-eval "load(\"ccurve.rr\");"))
1.7       ohara      68:           ("dsolv"     (openxm-eval "load(\"dsolv\");"))
1.11      ohara      69:           ("ratint"    (openxm-eval "load(\"ratint\");"))
                     70:           ("solv"      (openxm-eval "load(\"solv\");"))
                     71:           ("sp"        (openxm-eval "load(\"sp\");"))
                     72:           ("sturm"     (openxm-eval "load(\"sturm\");"))
                     73:           ("sym"       (openxm-eval "load(\"sym\");"))
                     74:           ("weight"    (openxm-eval "load(\"weight\");"))
1.7       ohara      75:           ("yang"      (openxm-eval "load(\"yang.rr\");"))
                     76:           )
                     77:         (-> "Display Configuration (Asir)"
                     78:           ("Load default"   (openxm-eval "noro_print_env(0);"))
                     79:           ("Weyl algebra"   (openxm-eval "noro_print_env(\"weyl\");"))
                     80:           ("Euler OPs"      (openxm-eval "noro_print_env(\"yang\");"))
                     81:           )
1.3       ohara      82:         ---
                     83:         (-> "Manuals"
1.5       ohara      84:           ("Risa/Asir manual"
1.13      ohara      85:            (w3m-search manual-asir2000))
1.5       ohara      86:           ("Asir-contrib manual"
1.13      ohara      87:            (w3m-search manual-asir-contrib)))
1.3       ohara      88:         (-> "Web"
1.10      ohara      89:           ("The OpenXM Project"  (w3m "http://www.math.kobe-u.ac.jp/OpenXM/"))
                     90:           ("Risa/Asir web page"  (w3m "http://www.math.kobe-u.ac.jp/Asir/index-ja.html")))
1.3       ohara      91:         )))
1.1       ohara      92: )
                     93:
1.12      ohara      94: (define (openxm-serialize lan t)
                     95:   (import-from (texmacs plugin plugin-cmd))
                     96:   (with u (pre-serialize lan t)
1.14    ! ohara      97:     (with s (texmacs->verbatim (stree->tree u))
1.12      ohara      98:       (string-append (string-replace s "\n" "\v") "\n")
                     99:       )))
                    100:
1.1       ohara     101: (plugin-configure openxm
1.6       ohara     102:   (:require (url-exists-in-path? "openxm"))
1.1       ohara     103:   (:initialize (openxm-initialize))
1.12      ohara     104:   (:serializer ,openxm-serialize)
1.4       ohara     105:   (:launch "exec openxm ox_texmacs")
1.5       ohara     106:   (:session "OpenXM[asir,sm1]"))

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>