[BACK]Return to xm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / lib

Annotation of OpenXM_contrib2/asir2000/lib/xm, Revision 1.8

1.8     ! takayama    1: /* $OpenXM: OpenXM_contrib2/asir2000/lib/xm,v 1.7 2000/02/11 04:30:16 takayama Exp $ */
1.1       noro        2: /**  xm  **/
                      3: Xm_noX = 0$
                      4: /* 1 : using X-window system. 0 : not using X-window system. */
                      5: /* TODO: db.restore should be called after sm1 error and interruption.
                      6:          cf. var.sm1,  debugMode
                      7: */
                      8:
1.6       takayama    9: print("xm version 20000202. Copyright (C) OpenXM Developing Team. 2000.")$
1.8     ! takayama   10: print("http://www.math.sci.kobe-u.ac.jp/OpenXM ")$
1.6       takayama   11: print("ox_help(0); ox_help(\"keyword\"); ox_grep(\"keyword\"); for help message ")$
1.4       takayama   12: XM_debug=1$
1.1       noro       13:
                     14: /*&C-texi
                     15: @c DO NOT EDIT THIS FILE   oxxm.texi
                     16: */
                     17: /*&jp-texi
                     18: @node OpenXM-Contrib $B0lHLH!?t(B,,, Top
                     19: @chapter OpenXM-Contrib $B0lHLH!?t(B
                     20: */
                     21: /*&eg-texi
                     22: @node OpenXM-Contrib General Functions,,, Top
                     23: @chapter OpenXM-Contrib General Functions
                     24: */
                     25: /*&jp-texi
                     26: @section{$BH!?t0lMw(B}
                     27: */
                     28: /*&eg-texi
                     29: @section{Functions}
                     30: */
                     31:
                     32:
                     33: Sm1_lib = getenv("OpenXM_HOME")$
                     34: if (Sm1_lib == 0) {
                     35:   Sm1_lib = "/usr/local/lib/sm1"$
                     36: } else {
                     37:   Sm1_lib = Sm1_lib+"/lib/sm1"$
                     38: }
                     39: ToAsir_Debug = 0$
                     40:
                     41: def ox_help(A) {
                     42:   if (type(A) == 0) {
1.2       takayama   43:     shell("ls "+getenv("OpenXM_HOME")+"/lib/asir/help/xm.help");
1.1       noro       44:   }else{
1.2       takayama   45:     help("xm.help/"+A)$
1.1       noro       46:   }
                     47: }
                     48:
                     49:
                     50: def ox_get_errors(P) {
                     51:   ox_push_cmd(P,276);
                     52:   return(ox_pop_cmo(P));
                     53: }
                     54: def ox_check_errors(P) {
                     55:   E = ox_get_errors(P);
                     56:   if (E == [ ]) return(P);
                     57:   else {
                     58:     print("Error during the initialization : double check binary ox-files, library files and environmental variables.");
                     59:     print(E);
                     60:     debug;
                     61:   }
                     62:   return(P);
                     63: }
                     64:
                     65: /*&eg-texi
                     66: @menu
                     67: * ox_check_errors2::
                     68: @end menu
                     69: @node ox_check_errors2,,, Top
                     70: @subsection{@code{ox_check_errors2}}
                     71: @findex ox_check_errors2
                     72: @table @t
                     73: @item ox_check_errors2(@var{p})
                     74: ::  get a list of error objects on the statck of the server @var{p}.
                     75: @end table
                     76:
                     77: @table @var
                     78: @item return
                     79: List
                     80: @item p
                     81: Number
                     82: @end table
                     83:
                     84: @itemize @bullet
                     85: @item It gets a list of error objects on the server stack.
                     86: @item It does not pop the error objects.
                     87: @end itemize
                     88: */
                     89: /*&jp-texi
                     90: @menu
                     91: * ox_check_errors2::
                     92: @end menu
                     93: @node ox_check_errors2,,, Top
                     94: @subsection{@code{ox_check_errors2}}
                     95: @findex ox_check_errors2
                     96: @table @t
                     97: @item ox_check_errors2(@var{p})
                     98: ::  $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.
                     99: @end table
                    100:
                    101: @table @var
                    102: @item return
                    103: $B%j%9%H(B
                    104: @item p
                    105: $B?t(B
                    106: @end table
                    107:
                    108: @itemize @bullet
                    109: @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.
                    110: @item $B%(%i!<%*%V%8%'%/%H$N%]%C%W$O$7$J$$(B.
                    111: @end itemize
                    112: */
                    113: /*&C-texi
                    114: @example
                    115: [219] P=sm1_start();
                    116: 0
                    117: [220] sm1(P," 0 get ");
                    118: 0
                    119: [221] ox_check_errors2(P);
                    120: [error([7,4294967295,executeString: Usage:get])]
1.4       takayama  121: Error on the server of the process number = 1
                    122: To clean the stack of the ox server,
                    123: type in ox_pops(P,N) (P: process number, N: the number of data you need to pop)
                    124: out of the debug mode.
                    125: If you like to automatically clean data on the server stack,
                    126: set XM_debug=0;
                    127:
1.1       noro      128: @end example
                    129: */
                    130: def ox_check_errors2(P) {
1.4       takayama  131:   extern XM_debug;
1.1       noro      132:   E = ox_get_errors(P);
                    133:   if (E == [ ]) return(P);
                    134:   else {
                    135:     print(E);
1.4       takayama  136:     print("Error on the server of the process number = ",0)$
                    137:     print(P);
                    138:     if (XM_debug == 0) {
                    139:        print("Automatically cleaning the stack (pop 100 data)....",0)$
                    140:        ox_pops(P,100)$
                    141:        print("done.")$
                    142:        print("If you want to do it by hand, set XM_debug = 1.");
                    143:     }else{
                    144:        print("To clean the stack of the ox server,");
                    145:        print("type in ox_pops(P,N) (P: process number, N: the number of data you need to pop) out of the debug mode");
                    146:        print("If you like to automatically clean data on the server stack,");
                    147:        print("set XM_debug=0;");
                    148:        debug;
                    149:     }
1.1       noro      150:   }
                    151:   return(P);
                    152: }
1.3       takayama  153:
                    154: def first(A) {return(A[0]);}
1.6       takayama  155:
                    156:
                    157: def ox_grep(A) {
                    158:   if (getenv("LANG") == "ja_JP.EUC") {
                    159:     F = get_rootdir()+"/help-jp/";
                    160:   }else{
                    161:     F = get_rootdir()+"/help-eg/";
                    162:   }
                    163:   Pager = getenv("PAGER");
                    164:   if (Pager == 0) Pager="more";
                    165:   OF = F+"xm.help";
                    166:
                    167:   print("---------- Result of grep  (ox_grep) ---------------------")$
                    168:   shell("(cd " + F + " ; " + " grep "+A+" * xm.help/* | "+Pager+" )");
                    169:
                    170:   print("---------- Possible help keyword  for help -------------")$
                    171:   shell("ls "+F+" | grep "+A);
                    172:   print("---------- Possible help keyword  for ox_help ----------")$
                    173:   shell("ls "+OF+" | grep "+A);
                    174:
                    175:   return(0);
                    176: }
                    177:
                    178:
1.1       noro      179:
                    180: load("sm1")$
                    181: load("gnuplot")$
                    182: load("tigers")$
                    183: load("phc")$
1.7       takayama  184: load("longname")$
1.1       noro      185:
                    186: end$

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>