Annotation of OpenXM/src/kxx/init-openxm.scm, Revision 1.20
1.20 ! takayama 1: ; $OpenXM: OpenXM/src/kxx/init-openxm.scm,v 1.19 2009/02/22 17:30:03 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
1.19 ohara 10: '(("C" . "doc/asir2000/html-en/man_toc.html") ("ja" . "doc/asir2000/html-ja/man_toc.html"))))
1.13 ohara 11:
12: (define manual-asir-contrib
13: (alist-search
1.20 ! takayama 14: '(("C" . "doc/asir-contrib/en/cman-html/cman-en_toc.html") ("ja" . "doc/asir-contrib/ja/cman-html/cman-ja_toc.html"))))
1.3 ohara 15:
1.16 ohara 16: ; (define (openxm-eval t)
17: ; (import-from (texmacs plugin plugin-cmd))
18: ; (import-from (texmacs plugin plugin-convert))
19: ; (plugin-eval "openxm" "default" (object->tree t)))
1.3 ohara 20:
1.16 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.17 ohara 39: ((url-exists-in-path? "firefox" ) "firefox" )
1.8 ohara 40: ((url-exists-in-path? "mozilla" ) "mozilla" )
41: ((url-exists-in-path? "netscape") "netscape")
42: ((url-exists-in-path? "iexplore") "iexplore")
43: (else #f)))
44:
1.2 ohara 45: (define (w3m t)
1.8 ohara 46: (if (and (string? t) w3m-cmd)
47: (system (string-append w3m-cmd " " t " &"))))
1.2 ohara 48:
1.5 ohara 49: (define (w3m-search t)
50: (w3m (openxm-path t)))
1.1 ohara 51:
52: (define (openxm-initialize)
1.15 ohara 53: ; (menu-extend texmacs-session-help-icons
54: ; (if (in-openxm?)
55: ; |
56: ; ((balloon (icon "tm_help.xpm") "Risa/Asir manual")
57: ; (w3m-search manual-asir2000))))
1.1 ohara 58: (menu-extend texmacs-extra-menu
59: (if (in-openxm?)
60: (=> "OpenXM"
1.18 ohara 61: ; (-> "Select engines"
62: ; ("Risa/Asir" (insert-string "!asir;"))
63: ; ("Kan/sm1" (insert-string "!sm1;")))
1.17 ohara 64: ; (-> "Select display style"
65: ; ("LaTeX" (openxm-eval "!latex;"))
66: ; ("verbatim" (openxm-eval "!verbatim;")))
67: ; (-> "Load Modules (Asir)"
68: ; ("ccurve" (openxm-eval "load(\"ccurve.rr\");"))
69: ; ("dsolv" (openxm-eval "load(\"dsolv\");"))
70: ; ("ratint" (openxm-eval "load(\"ratint\");"))
71: ; ("solv" (openxm-eval "load(\"solv\");"))
72: ; ("sp" (openxm-eval "load(\"sp\");"))
73: ; ("sturm" (openxm-eval "load(\"sturm\");"))
74: ; ("sym" (openxm-eval "load(\"sym\");"))
75: ; ("weight" (openxm-eval "load(\"weight\");"))
76: ; ("yang" (openxm-eval "load(\"yang.rr\");"))
77: ; )
78: ; (-> "Display Configuration (Asir)"
79: ; ("Load default" (openxm-eval "noro_print_env(0);"))
80: ; ("Weyl algebra" (openxm-eval "noro_print_env(\"weyl\");"))
81: ; ("Euler OPs" (openxm-eval "noro_print_env(\"yang\");"))
82: ; )
1.18 ohara 83: ; ---
1.3 ohara 84: (-> "Manuals"
1.5 ohara 85: ("Risa/Asir manual"
1.13 ohara 86: (w3m-search manual-asir2000))
1.5 ohara 87: ("Asir-contrib manual"
1.13 ohara 88: (w3m-search manual-asir-contrib)))
1.3 ohara 89: (-> "Web"
1.10 ohara 90: ("The OpenXM Project" (w3m "http://www.math.kobe-u.ac.jp/OpenXM/"))
91: ("Risa/Asir web page" (w3m "http://www.math.kobe-u.ac.jp/Asir/index-ja.html")))
1.3 ohara 92: )))
1.1 ohara 93: )
94:
1.12 ohara 95: (define (openxm-serialize lan t)
1.17 ohara 96: (import-from (utils plugins plugin-cmd))
1.12 ohara 97: (with u (pre-serialize lan t)
1.14 ohara 98: (with s (texmacs->verbatim (stree->tree u))
1.12 ohara 99: (string-append (string-replace s "\n" "\v") "\n")
100: )))
101:
1.1 ohara 102: (plugin-configure openxm
1.6 ohara 103: (:require (url-exists-in-path? "openxm"))
1.1 ohara 104: (:initialize (openxm-initialize))
1.12 ohara 105: (:serializer ,openxm-serialize)
1.4 ohara 106: (:launch "exec openxm ox_texmacs")
1.5 ohara 107: (:session "OpenXM[asir,sm1]"))
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>