Annotation of OpenXM_contrib2/asir2000/lib/xm, Revision 1.14
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.14 ! takayama 48: * $OpenXM: OpenXM_contrib2/asir2000/lib/xm,v 1.13 2001/03/09 00:50:37 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: */
56:
1.14 ! takayama 57: print("Asir-Contrib xm version 20010310. Copyright 2000-2001, OpenXM Committers.")$
1.13 takayama 58: /* print("http://www.openxm.org")$ */
59: print("help(\"keyword\"); ox_help(0); ox_help(\"keyword\"); ox_grep(\"keyword\");")$
60: print(" for help messages. ")$
1.4 takayama 61: XM_debug=1$
1.1 noro 62:
63: /*&C-texi
64: @c DO NOT EDIT THIS FILE oxxm.texi
65: */
66: /*&jp-texi
67: @node OpenXM-Contrib $B0lHLH!?t(B,,, Top
68: @chapter OpenXM-Contrib $B0lHLH!?t(B
69: */
70: /*&eg-texi
71: @node OpenXM-Contrib General Functions,,, Top
72: @chapter OpenXM-Contrib General Functions
73: */
74: /*&jp-texi
75: @section{$BH!?t0lMw(B}
76: */
77: /*&eg-texi
78: @section{Functions}
79: */
80:
81:
82: Sm1_lib = getenv("OpenXM_HOME")$
83: if (Sm1_lib == 0) {
84: Sm1_lib = "/usr/local/lib/sm1"$
85: } else {
86: Sm1_lib = Sm1_lib+"/lib/sm1"$
87: }
88: ToAsir_Debug = 0$
89:
90: def ox_help(A) {
91: if (type(A) == 0) {
1.2 takayama 92: shell("ls "+getenv("OpenXM_HOME")+"/lib/asir/help/xm.help");
1.1 noro 93: }else{
1.2 takayama 94: help("xm.help/"+A)$
1.1 noro 95: }
96: }
97:
98:
99: def ox_get_errors(P) {
100: ox_push_cmd(P,276);
101: return(ox_pop_cmo(P));
102: }
103: def ox_check_errors(P) {
104: E = ox_get_errors(P);
105: if (E == [ ]) return(P);
106: else {
107: print("Error during the initialization : double check binary ox-files, library files and environmental variables.");
108: print(E);
109: debug;
110: }
111: return(P);
112: }
113:
114: /*&eg-texi
115: @menu
116: * ox_check_errors2::
117: @end menu
118: @node ox_check_errors2,,, Top
119: @subsection{@code{ox_check_errors2}}
120: @findex ox_check_errors2
121: @table @t
122: @item ox_check_errors2(@var{p})
123: :: get a list of error objects on the statck of the server @var{p}.
124: @end table
125:
126: @table @var
127: @item return
128: List
129: @item p
130: Number
131: @end table
132:
133: @itemize @bullet
134: @item It gets a list of error objects on the server stack.
135: @item It does not pop the error objects.
136: @end itemize
137: */
138: /*&jp-texi
139: @menu
140: * ox_check_errors2::
141: @end menu
142: @node ox_check_errors2,,, Top
143: @subsection{@code{ox_check_errors2}}
144: @findex ox_check_errors2
145: @table @t
146: @item ox_check_errors2(@var{p})
147: :: $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.
148: @end table
149:
150: @table @var
151: @item return
152: $B%j%9%H(B
153: @item p
154: $B?t(B
155: @end table
156:
157: @itemize @bullet
158: @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.
159: @item $B%(%i!<%*%V%8%'%/%H$N%]%C%W$O$7$J$$(B.
160: @end itemize
161: */
162: /*&C-texi
163: @example
164: [219] P=sm1_start();
165: 0
166: [220] sm1(P," 0 get ");
167: 0
168: [221] ox_check_errors2(P);
169: [error([7,4294967295,executeString: Usage:get])]
1.4 takayama 170: Error on the server of the process number = 1
171: To clean the stack of the ox server,
172: type in ox_pops(P,N) (P: process number, N: the number of data you need to pop)
173: out of the debug mode.
174: If you like to automatically clean data on the server stack,
175: set XM_debug=0;
176:
1.1 noro 177: @end example
178: */
179: def ox_check_errors2(P) {
1.4 takayama 180: extern XM_debug;
1.1 noro 181: E = ox_get_errors(P);
182: if (E == [ ]) return(P);
183: else {
184: print(E);
1.4 takayama 185: print("Error on the server of the process number = ",0)$
186: print(P);
187: if (XM_debug == 0) {
188: print("Automatically cleaning the stack (pop 100 data)....",0)$
189: ox_pops(P,100)$
190: print("done.")$
191: print("If you want to do it by hand, set XM_debug = 1.");
192: }else{
193: print("To clean the stack of the ox server,");
194: print("type in ox_pops(P,N) (P: process number, N: the number of data you need to pop) out of the debug mode");
195: print("If you like to automatically clean data on the server stack,");
196: print("set XM_debug=0;");
197: debug;
198: }
1.1 noro 199: }
200: return(P);
201: }
1.3 takayama 202:
203: def first(A) {return(A[0]);}
1.6 takayama 204:
205:
206: def ox_grep(A) {
207: if (getenv("LANG") == "ja_JP.EUC") {
208: F = get_rootdir()+"/help-jp/";
209: }else{
210: F = get_rootdir()+"/help-eg/";
211: }
212: Pager = getenv("PAGER");
213: if (Pager == 0) Pager="more";
214: OF = F+"xm.help";
215:
216: print("---------- Result of grep (ox_grep) ---------------------")$
217: shell("(cd " + F + " ; " + " grep "+A+" * xm.help/* | "+Pager+" )");
218:
219: print("---------- Possible help keyword for help -------------")$
220: shell("ls "+F+" | grep "+A);
221: print("---------- Possible help keyword for ox_help ----------")$
222: shell("ls "+OF+" | grep "+A);
223:
224: return(0);
225: }
226:
227:
1.1 noro 228:
229: load("sm1")$
230: load("gnuplot")$
231: load("tigers")$
232: load("phc")$
1.7 takayama 233: load("longname")$
1.1 noro 234:
235: end$
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>