Annotation of OpenXM_contrib2/asir2000/lib/xm, Revision 1.16
1.10 noro 1: /*
2: * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
3: * All rights reserved.
4: *
5: * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
6: * non-exclusive and royalty-free license to use, copy, modify and
7: * redistribute, solely for non-commercial and non-profit purposes, the
8: * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
9: * conditions of this Agreement. For the avoidance of doubt, you acquire
10: * only a limited right to use the SOFTWARE hereunder, and FLL or any
11: * third party developer retains all rights, including but not limited to
12: * copyrights, in and to the SOFTWARE.
13: *
14: * (1) FLL does not grant you a license in any way for commercial
15: * purposes. You may use the SOFTWARE only for non-commercial and
16: * non-profit purposes only, such as academic, research and internal
17: * business use.
18: * (2) The SOFTWARE is protected by the Copyright Law of Japan and
19: * international copyright treaties. If you make copies of the SOFTWARE,
20: * with or without modification, as permitted hereunder, you shall affix
21: * to all such copies of the SOFTWARE the above copyright notice.
22: * (3) An explicit reference to this SOFTWARE and its copyright owner
23: * shall be made on your publication or presentation in any form of the
24: * results obtained by use of the SOFTWARE.
25: * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.11 noro 26: * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.10 noro 27: * for such modification or the source code of the modified part of the
28: * SOFTWARE.
29: *
30: * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
31: * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
32: * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
33: * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
34: * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
35: * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
36: * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
37: * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
38: * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
39: * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
40: * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
41: * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
42: * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
43: * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
44: * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
45: * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
46: * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
47: *
1.16 ! takayama 48: * $OpenXM: OpenXM_contrib2/asir2000/lib/xm,v 1.15 2001/05/27 07:18:03 takayama Exp $
1.10 noro 49: */
1.1 noro 50: /** xm **/
51: Xm_noX = 0$
52: /* 1 : using X-window system. 0 : not using X-window system. */
53: /* TODO: db.restore should be called after sm1 error and interruption.
54: cf. var.sm1, debugMode
55: */
1.16 ! takayama 56: Xm_use_timer_to_start_server = 1$
1.1 noro 57:
1.14 takayama 58: print("Asir-Contrib xm version 20010310. Copyright 2000-2001, OpenXM Committers.")$
1.13 takayama 59: /* print("http://www.openxm.org")$ */
60: print("help(\"keyword\"); ox_help(0); ox_help(\"keyword\"); ox_grep(\"keyword\");")$
61: print(" for help messages. ")$
1.4 takayama 62: XM_debug=1$
1.1 noro 63:
64: /*&C-texi
65: @c DO NOT EDIT THIS FILE oxxm.texi
66: */
67: /*&jp-texi
68: @node OpenXM-Contrib $B0lHLH!?t(B,,, Top
69: @chapter OpenXM-Contrib $B0lHLH!?t(B
70: */
71: /*&eg-texi
72: @node OpenXM-Contrib General Functions,,, Top
73: @chapter OpenXM-Contrib General Functions
74: */
75: /*&jp-texi
1.15 takayama 76: @section $BH!?t0lMw(B
1.1 noro 77: */
78: /*&eg-texi
1.15 takayama 79: @section Functions
1.1 noro 80: */
81:
82:
83: Sm1_lib = getenv("OpenXM_HOME")$
84: if (Sm1_lib == 0) {
85: Sm1_lib = "/usr/local/lib/sm1"$
86: } else {
87: Sm1_lib = Sm1_lib+"/lib/sm1"$
88: }
89: ToAsir_Debug = 0$
90:
91: def ox_help(A) {
92: if (type(A) == 0) {
1.2 takayama 93: shell("ls "+getenv("OpenXM_HOME")+"/lib/asir/help/xm.help");
1.1 noro 94: }else{
1.2 takayama 95: help("xm.help/"+A)$
1.1 noro 96: }
97: }
98:
99:
100: def ox_get_errors(P) {
101: ox_push_cmd(P,276);
102: return(ox_pop_cmo(P));
103: }
104: def ox_check_errors(P) {
105: E = ox_get_errors(P);
106: if (E == [ ]) return(P);
107: else {
108: print("Error during the initialization : double check binary ox-files, library files and environmental variables.");
109: print(E);
110: debug;
111: }
112: return(P);
113: }
114:
115: /*&eg-texi
116: @menu
117: * ox_check_errors2::
118: @end menu
119: @node ox_check_errors2,,, Top
1.15 takayama 120: @subsection @code{ox_check_errors2}
1.1 noro 121: @findex ox_check_errors2
122: @table @t
123: @item ox_check_errors2(@var{p})
124: :: get a list of error objects on the statck of the server @var{p}.
125: @end table
126:
127: @table @var
128: @item return
129: List
130: @item p
131: Number
132: @end table
133:
134: @itemize @bullet
135: @item It gets a list of error objects on the server stack.
136: @item It does not pop the error objects.
137: @end itemize
138: */
139: /*&jp-texi
140: @menu
141: * ox_check_errors2::
142: @end menu
143: @node ox_check_errors2,,, Top
1.15 takayama 144: @subsection @code{ox_check_errors2}
1.1 noro 145: @findex ox_check_errors2
146: @table @t
147: @item ox_check_errors2(@var{p})
148: :: $B<1JLHV9f(B @var{p} $B$N%5!<%P$N%9%?%C%/>e$K$"$k%(%i!<%*%V%8%'%/%H$r%j%9%H$GLa$9(B.
149: @end table
150:
151: @table @var
152: @item return
153: $B%j%9%H(B
154: @item p
155: $B?t(B
156: @end table
157:
158: @itemize @bullet
159: @item $B<1JLHV9f(B @var{p} $B$N%5!<%P$N%9%?%C%/>e$K$"$k%(%i!<%*%V%8%'%/%H$r%j%9%H$GLa$9(B.
160: @item $B%(%i!<%*%V%8%'%/%H$N%]%C%W$O$7$J$$(B.
161: @end itemize
162: */
163: /*&C-texi
164: @example
165: [219] P=sm1_start();
166: 0
167: [220] sm1(P," 0 get ");
168: 0
169: [221] ox_check_errors2(P);
170: [error([7,4294967295,executeString: Usage:get])]
1.4 takayama 171: Error on the server of the process number = 1
172: To clean the stack of the ox server,
173: type in ox_pops(P,N) (P: process number, N: the number of data you need to pop)
174: out of the debug mode.
175: If you like to automatically clean data on the server stack,
176: set XM_debug=0;
177:
1.1 noro 178: @end example
179: */
180: def ox_check_errors2(P) {
1.4 takayama 181: extern XM_debug;
1.1 noro 182: E = ox_get_errors(P);
183: if (E == [ ]) return(P);
184: else {
185: print(E);
1.4 takayama 186: print("Error on the server of the process number = ",0)$
187: print(P);
188: if (XM_debug == 0) {
189: print("Automatically cleaning the stack (pop 100 data)....",0)$
190: ox_pops(P,100)$
191: print("done.")$
192: print("If you want to do it by hand, set XM_debug = 1.");
193: }else{
194: print("To clean the stack of the ox server,");
195: print("type in ox_pops(P,N) (P: process number, N: the number of data you need to pop) out of the debug mode");
196: print("If you like to automatically clean data on the server stack,");
197: print("set XM_debug=0;");
198: debug;
199: }
1.1 noro 200: }
201: return(P);
202: }
1.3 takayama 203:
204: def first(A) {return(A[0]);}
1.6 takayama 205:
206:
207: def ox_grep(A) {
208: if (getenv("LANG") == "ja_JP.EUC") {
209: F = get_rootdir()+"/help-jp/";
210: }else{
211: F = get_rootdir()+"/help-eg/";
212: }
213: Pager = getenv("PAGER");
214: if (Pager == 0) Pager="more";
215: OF = F+"xm.help";
216:
217: print("---------- Result of grep (ox_grep) ---------------------")$
218: shell("(cd " + F + " ; " + " grep "+A+" * xm.help/* | "+Pager+" )");
219:
220: print("---------- Possible help keyword for help -------------")$
221: shell("ls "+F+" | grep "+A);
222: print("---------- Possible help keyword for ox_help ----------")$
223: shell("ls "+OF+" | grep "+A);
224:
225: return(0);
226: }
227:
228:
1.1 noro 229:
230: load("sm1")$
231: load("gnuplot")$
232: load("tigers")$
233: load("phc")$
1.7 takayama 234: load("longname")$
1.1 noro 235:
236: end$
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>