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

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

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

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