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