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