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