[BACK]Return to ox-win.sm1 CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Doc

Annotation of OpenXM/src/kan96xx/Doc/ox-win.sm1, Revision 1.6

1.6     ! takayama    1: %%%%%%%%%%%  $OpenXM: OpenXM/src/kan96xx/Doc/ox-win.sm1,v 1.5 2001/08/10 13:48:40 takayama Exp $
1.1       takayama    2: %%%%%%%%%%%% Configuration: Specify your server path
                      3: %%%%% ox, ox_sm1, oxlog are contained in kxx.tgz
                      4: %%%%% These should be under /usr/local/lib/sm1 or LOAD_SM1_PATH
1.5       takayama    5: 
                      6: %% This variable is used in sm1connectr_win
                      7: %% It should be set, for example, to c:/cygwin/home/nobuki/OpenXM
                      8: %% See  kan96xx/win/websm1.bat
1.4       takayama    9: [(getenv) (OPENXMHOMEWIN)] extension
                     10: /OpenXM_HOME_WIN set
1.6     ! takayama   11: OpenXM_HOME_WIN tag 0 eq {
        !            12:   [(getenv) (OpenXM_HOME)] extension
        !            13:   /OpenXM_HOME_WIN set
        !            14: } { } ifelse
1.5       takayama   15: 
                     16: %% This is used in asirconnectr_win
                     17: /OX_LAUNCH (c:\home\asir\bin\ox_launch.exe) def
                     18: %%%%%%%%%%%%%%% end configuration  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.4       takayama   19: 
1.1       takayama   20: /oxpath.ox (bin/ox.exe) def
                     21: /oxpath.oxsm1 (bin/ox_sm1.exe) def
                     22: /oxpath.oxlog (bin/oxlog.exe) def
                     23: /oxpath.xterm (start ) def
                     24: /oxpath.null  (  ) def
                     25: /oxpath.null00  ( >& /dev/null ) def  %%cf. oxNoX
                     26: /oxpath.null00-pure-sh ( 2>&1 >/dev/null) def %%TODO:It does not work in our case
                     27: %%%%%%%%%%%%%  The following is used only for sm1connectr-ssh.
                     28: %%%%%%%%%%%%%  Configure path for ox and ox_sm1 on your remote machine.
                     29: /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def
                     30: /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def
                     31: /oxpath.ox-ssh    (/home/taka/OpenXM/bin/ox) def
                     32: /myhostname-ssh   (yama.math.kobe-u.ac.jp) def
                     33: %% for debugging.
                     34: %/oxpath.oxlog.xterm-ssh ( ) def  
                     35: %/oxpath.oxsm1-ssh (/home/nobuki/OpenXM/bin/ox_sm1) def
                     36: %/oxpath.ox-ssh    (/home/nobuki/OpenXM/bin/ox) def
                     37: %/myhostname-ssh   (localhost) def
                     38: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                     39: %% Old full path.
                     40: %/oxpath.ox (/home/nobuki/kxx/ox) def
                     41: %/oxpath.oxsm1 (/home/nobuki/kxx/ox_sm1) def
                     42: %/oxpath.oxlog (/home/nobuki/kxx/oxlog) def
                     43: %/oxpath.xterm (/usr/X11R6/bin/xterm  -icon  -e ) def
                     44: 
                     45: %% This macro is invoked when this package is loaded.
                     46: /initializePathNamesForOx  {
                     47: %%   [oxpath.ox] getPathNameSm1 /oxpath.ox set
                     48: %%   [oxpath.oxsm1] getPathNameSm1 /oxpath.oxsm1 set
                     49: %%   [oxpath.oxlog] getPathNameSm1 /oxpath.oxlog set
                     50: %%   /oxpath.oxlog.xterm [oxpath.oxlog ( ) oxpath.xterm] cat def
                     51: } def
                     52: 
                     53: %% Execute this macro, then xterm will not be executed and the output
                     54: %% will be redirected to /dev/null.
                     55: /oxNoX {
                     56:    /oxpath.null oxpath.null00 def
                     57:    /oxpath.oxlog.xterm [oxpath.oxlog ( )] cat def
                     58:    (oxpath.oxlog.xterm is set to ) messagen
                     59:    oxpath.oxlog.xterm message
                     60: } def
                     61: 
                     62: /ox.ccc.init { ox.ccc ( [(oxPrintMessage) 0] extension pop ) oxsubmit } def
                     63: 
                     64: /ox.verbose 0   def
                     65: /ox.version (2.981105) def
                     66: ox.version [(Version)] system_variable gt 
                     67: { (This package requires the latest version of kan/sm1) message
                     68:   (Please get it from http://www.math.kobe-u.ac.jp/KAN) message
                     69:   error
                     70: } { } ifelse
1.3       takayama   71: (ox-win.sm1, --- open sm1 protocol module for Windows (TM) 8/9, 2001  (C) N.Takayama. oxhelp for help) message-quiet
1.1       takayama   72: 
                     73: /ox.ccc load isArray 
                     74: { }
                     75: { /ox.ccc [ ] def } ifelse
                     76: 
                     77: 
                     78: 
                     79: /ox.logsize 10 def
                     80: /ox.log [1 1 ox.logsize {pop 0} for ] def
                     81: /ox.mod { dup ox.logsize idiv ox.logsize mul sub } def
                     82: /ox.takelog 1 def
                     83: 
                     84: /SM_executeStringByLocalParser 268 def
                     85: /SM_execute 268 def
                     86: /SM_popString  263  def
                     87: /SM_mathcap 264 def
                     88: 
                     89: /SM_popCMO 262 def
                     90: /SM_executeFunction 269 def
                     91: /SM_DUMMY_sendcmo   2147418112 1 add def    %%% SM_PRIVATE+1
                     92: /SM_sync_ball 281 def
                     93: 
                     94: /SM_pops  265  def
                     95: /SM_setName 266  def
                     96: /SM_evalName 267  def
                     97: 
                     98: /SM_setMathCap 273 def
                     99: 
                    100: /SM_getsp     275  def
                    101: /SM_dupErrors 276  def
                    102: 
                    103: /SM_control_kill 1024 def
                    104: /SM_control_reset_connection  1030 def
                    105: /SM_control_spawn_server  1027 def
                    106: 
                    107: /Etag_error 257 def
                    108: 
                    109: /enginesList [
                    110:   [(localhost) 1300 1200]
                    111:   [(localhost) 2300 2200]
                    112: ] def
                    113: %% cf. startengines
                    114: /enginesList.2 [
                    115:   [(dc1) 1300 1200]
                    116:   [(dc2) 2300 2200]
                    117: ] def
                    118: %% cf. se12
                    119: 
                    120: /oxconnect {
                    121:   /arg1 set
                    122:   [(oxCreateClient) arg1 aload pop] extension 
                    123: } def
                    124: [(oxconnect)
                    125:  [([hostname data-port control-port] oxconnect pid)
                    126:   (oxconnect is used to connect this to a server on the hostname with data-port)
                    127:   (and control-port)
                    128:   (Example 1:  ox -ox ox_sm1 -data 1300 -control 1200    <== on server.)
                    129:   (            [$localhost$ 1300 1200] oxconnect /ox.ccc set  <== on client.)
                    130:   (Example 2:  ox -ox ox_sm1 -host s.OpenXM.org -insecure -data 1300 -control 1200    <== on server.)
                    131:   (            [$s.OpenXM.org$ 1300 1200] oxconnect /ox.ccc set  <== on client.)
                    132:   (Example 3:  ox -ox ox_sm1 -data 1300 -control 1200  >& /dev/null &<== on server.)
                    133:   (            [$localhost$ 1300 1200] oxconnect /ox.ccc set  <== on client.)
                    134:   (           cf. oxNoX)
                    135:   (See also ox)
                    136:  ]
                    137: ] putUsages
                    138: 
                    139: [(ox)
                    140:  [
                    141:   (client aa oxpushcmo (oxsendcmo), client oxpopcmo dd, client popstring dd, client ss oxrpc) 
                    142:  (Example: ox.ccc [1 2 3] oxpushcmo ox.ccc oxpopcmo /ff set  ff :: ) 
                    143:  (  )
                    144:  (client ss oxexecutestring(oxsubmit) <<executeString>>, client ss oxexec <<executeFunction>>) 
                    145:  
                    146:  (Example: ox.ccc (0 1 10 { pop $Hello$ message } for) oxexecutestring ) 
                    147:  (Example: ox.ccc (2).. oxpushcmo ox.ccc (10).. oxpushcmo )
                    148:  (         ox.ccc (power) oxexec  ox.ccc oxpopcmo :: )
                    149:  (  )
                    150:  (client str oxevalname, client str oxsetname, client num oxpops, client oxget) 
                    151:  (   )
                    152:  (client oxmathcap, client oxsetmathcap, oxgenportfile, oxremoveportfile)
                    153:  (   )
                    154:  (client oxgetsp --- get stack pointer,  client oxgeterrors --- get all errors)
                    155:  (cleint oxisData, client oxreset, client oxshutdown)
                    156:  (oxhelp for this message, [(oxWatch) client] extension to start a log.)
                    157:  ([(oxSerial)] extension serial-number-of-out-going-ox-packet.)
                    158:  (oxpopcmo1, oxpopcmo2,  sm1connect2, sm1connect3) 
                    159:  (sm1connectr ox_launch, ox_launch_nox)
                    160:  (oxNoX : set an environment to invoke oxlog without xterm and to call oxlog with >& /dev/null)
                    161:  $        ex 1.  (ox.sm1) run oxNoX sm1connectr $
                    162:  $        ex 2.  (oxasir.sm1) run oxNoX (x^2-1). fctr pmat ; $
                    163:  ]
                    164: ] putUsages
                    165: 
                    166: /oxhelp {
                    167:  (oxconnect) usage
                    168:  (  ) message
                    169:  (ox) usage
                    170: } def
                    171: [(oxhelp)
                    172:  [(oxhelp  outputs help messages for ox commands.)
                    173: ]] putUsages
                    174: 
                    175: ox.verbose { oxhelp } {  } ifelse
                    176: 
                    177: /sm1connect2 {
                    178:  [oxpath.oxlog.xterm   oxpath.ox ( -ox ) oxpath.oxsm1 
                    179:   oxpath.null
                    180:   ( &)] cat system-csh
                    181: % (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_sm1 &) system
                    182: % For MSRI, or Eterm, 
                    183: %(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_sm1 &) system
                    184:  (If you start the server automatically, you may have a trouble to) message
                    185:  (oxreset. In order to avoid this trouble, start the server by hand.) message
                    186:  (sleep 5) system-csh
                    187:   [(localhost) 1300 1200] oxconnect /ox.ccc set
                    188:  (The server is binded to the variable ox.ccc) message
                    189:  ox.ccc.init
                    190: } def
                    191: 
                    192: /sm1connect3 {
                    193:  [oxpath.oxlog.xterm   oxpath.ox ( -ox ) oxpath.oxsm1 
                    194:   (  -data 2300 -control 2200 )  
                    195:   oxpath.null
                    196:   ( &)] cat system-csh
                    197: % (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_sm1 -data 2300 -control 2200 &) system-csh
                    198: % For MSRI
                    199: %(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_sm1 -data 2300 -control 2200&) system-csh
                    200:  (If you start the server automatically, you may have a trouble to) message
                    201:  (oxreset. In order to avoid this trouble, start the server by hand.) message
                    202:  (sleep 5) system-csh
                    203:   [(localhost) 2300 2200] oxconnect /ox.ccc2 set
                    204:  (The server is binded to the variable ox.ccc2) message
                    205: } def
                    206: 
                    207: /sm1connect4 {
                    208:  %% test version.
                    209:  /ox.ccc.portfile oxgenportfile def
                    210:  [oxpath.oxlog.xterm   oxpath.ox ( -ox ) oxpath.oxsm1 
                    211:   ( -portfile ) ox.ccc.portfile
                    212:   oxpath.null
                    213:   ( &)] cat system-csh
                    214:  (sleep 5) system-csh
                    215:  [(oxReadPortFile) ox.ccc.portfile] extension /ox.ccc.control set
                    216:  ox.ccc.control message
                    217:  [(localhost) ox.ccc.control 1200] /ox.ccc set
                    218:  (The server is binded to the variable ox.ccc) message
                    219:  oxremoveportfile
                    220: } def
                    221: 
                    222: /oxpushcmo { oxsendcmo } def
                    223: /oxsendcmo {
                    224:   /arg1 set
                    225:   /arg2 set
                    226:   ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put 
                    227:   } {  } ifelse
                    228:   [(oxReq) arg2 SM_DUMMY_sendcmo arg1] extension pop
                    229: } def
                    230: 
                    231: /oxpopcmo {
                    232:   /arg1 set
                    233:   [(oxReq) arg1 SM_popCMO ] extension pop
                    234:   [(oxGet) arg1] extension 
                    235: } def
                    236: 
                    237: /oxgetsp {
                    238:   /arg1 set
                    239:   [(oxReq) arg1 SM_getsp ] extension pop
                    240:   [(oxReq) arg1 SM_popCMO ] extension pop
                    241:   [(oxGet) arg1] extension 
                    242: } def
                    243: 
                    244: /oxgeterrors {
                    245:   /arg1 set
                    246:   [(oxReq) arg1 SM_dupErrors ] extension pop
                    247:   [(oxReq) arg1 SM_popCMO ] extension pop
                    248:   [(oxGet) arg1] extension 
                    249: } def
                    250: 
                    251: /oxmathcap0 {
                    252:   /arg1 set
                    253:   [(oxReq) arg1 SM_mathcap ] extension pop
                    254: } def
                    255: /oxmathcap {
                    256:   /arg1 set
                    257:   [/in-oxmathcap /mypeer /mmm] pushVariables
                    258:   [ /mypeer arg1 def
                    259:     mypeer oxmathcap0 
                    260:     mypeer oxpopcmo /mmm set
                    261:     mypeer 10 mmm put  %% set math cap.
                    262:   ] pop
                    263:   popVariables
                    264: } def
                    265: /oxsetmathcap {
                    266:   /arg1 set
                    267:   [/in-oxsetmathcap /mypeer /mymathcap] pushVariables
                    268:   [
                    269:     /mypeer arg1 def
                    270:     /mymathcap     [(cmoMathCap)] extension (array) dc def
                    271:     [(oxReq) 
                    272:       mypeer   SM_setMathCap
                    273:       mymathcap
                    274:     ] extension pop
                    275:   ] pop
                    276:   popVariables
                    277: } def
                    278: /oxsetmathcap.old {
                    279:   /arg1 set
                    280:   [(oxReq) 
                    281:     arg1   SM_setMathCap
                    282:     [(mathcap-object)
                    283:      [[199901160 (sm1)]
                    284:       [2130706434 , 1 , 2 , 4 , 17 , 19 , 20 , 22 , 23 , 24 , 25 , 26 , 30 ]
                    285:       %% mathcap for sm1.
                    286:       %% [1 2 3 4 5]   %% for test.   cf. cmoCheckMathCap, Sm1_mathcap()
                    287:      ]
                    288:     ]  %% Never write a broken data here.
                    289:   ] extension pop
                    290: } def
                    291: /oxpopcmo1 {  %% ask of the transmission.
                    292:   /arg1 set
                    293:   [(oxReq) arg1 SM_popCMO ] extension pop
                    294: } def
                    295: /oxpopcmo2 {  %% wait the data.
                    296:   /arg1 set
                    297:   [(oxGet) arg1] extension 
                    298: } def
                    299: 
                    300: 
                    301: /oxpopstring {
                    302:   /arg1 set
                    303:   [(oxReq) arg1 SM_popString ] extension pop
                    304:   [(oxGet) arg1] extension 
                    305: } def
                    306: 
                    307: /oxrpc {
                    308:   /arg1 set
                    309:   /arg2 set
                    310:   [/ans /ff] pushVariables
                    311:   [
                    312:    /ff arg2 def
                    313:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put 
                    314:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeString) put
                    315:    } {  } ifelse
                    316:    [(oxReq) ff SM_execute arg1] extension pop
                    317:    [(oxReq) ff SM_popCMO] extension pop
                    318:    [(oxGet) ff] extension /ans set
                    319:    ans etag Etag_error  eq {
                    320:      (Got an error object.) message
                    321:      /arg1 ans def
                    322:    }
                    323:    {  /arg1 ans def
                    324:     } ifelse
                    325:   ] pop
                    326:   popVariables
                    327:   arg1
                    328: } def
                    329: 
                    330: /oxexecutestring { oxsubmit } def
                    331: /oxsubmit {
                    332:   /arg1 set
                    333:   /arg2 set
                    334:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put 
                    335:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeString) put
                    336:    } {  } ifelse
                    337:   [(oxReq) arg2 SM_execute arg1] extension pop
                    338: } def
                    339: 
                    340: /oxexec {
                    341:   /arg1 set
                    342:   /arg2 set
                    343:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    344:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeFunction) put
                    345:    } {  } ifelse
                    346:   [(oxReq) arg2 SM_executeFunction arg1] extension pop
                    347: } def
                    348: /oxsubmit2 {
                    349:   oxexec
                    350: } def
                    351: 
                    352: /oxpops {
                    353:   /arg1 set
                    354:   /arg2 set
                    355:   [(oxReq) arg2 SM_pops arg1] extension pop
                    356: } def
                    357: 
                    358: /oxsetname {
                    359:   /arg1 set
                    360:   /arg2 set
                    361:   [(oxReq) arg2 SM_setName arg1] extension pop
                    362: } def
                    363: 
                    364: /oxevalname {
                    365:   /arg1 set
                    366:   /arg2 set
                    367:   [(oxReq) arg2 SM_evalName arg1] extension pop
                    368: } def
                    369: 
                    370: 
                    371: /oxreset {
                    372:   /arg1 set
                    373:   [(oxReq) arg1 SM_control_reset_connection] extension pop
                    374: %%  [(oxGetFromControl) arg1 ] extension pop
                    375:   [(oxGet) arg1] extension message
                    376: } def
                    377: 
                    378: /oxisData {
                    379:   /arg1 set
                    380:   [/pp /ff] pushVariables
                    381:   [
                    382:     /ff arg1 def
                    383:     [(oxMultiSelect) [ff] 10] extension /pp set
                    384:     pp message
                    385:     pp 0 get 1 eq {
                    386:       pp 1 get 0 get 1 eq {  %% data is in the data stream.
                    387:         /arg1 [(oxGet) ff] extension def
                    388:       } {/arg1 (no data) def  } ifelse
                    389:     }
                    390:     { /arg1 (no data) def }
                    391:     ifelse
                    392:   ] pop
                    393:   popVariables
                    394:   arg1
                    395: } def
                    396: 
                    397: /oxget {
                    398:   oxisData
                    399: } def
                    400: 
                    401: 
                    402: /oxshutdown {
                    403:   /arg1 set
                    404:   [(fp2fclose) arg1 1 get] extension
                    405:   [(oxReq) arg1 SM_control_kill] extension
                    406:   arg1 0 (closed) put
                    407: } def
                    408: 
                    409: /oxgenportfile {
                    410:   [(oxGenPortFile)] extension
                    411: }def
                    412: /oxremoveportfile {
                    413:   [(oxRemovePortFile)] extension
                    414: }def
                    415: 
                    416: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    417: /enginescmd
                    418:   $ /computesp {
                    419:        /arg1 set
                    420:        [arg1 myid] arg1 message
                    421:     } def
                    422:   $
                    423: def
                    424: 
                    425: 
                    426: /genPairs {
                    427:   /arg1 set
                    428:   [/n /i /j] pushVariables
                    429:   [
                    430:     /n arg1 def
                    431:     /genPairs.list [  ] def
                    432:     /genPairs.i 0 def
                    433:     0 1 n 1 sub {
                    434:       /i set
                    435:       i 1 add 1 n 1 sub {
                    436:          /j set
                    437:          genPairs.list [i j] append /genPairs.list set
                    438:       } for
                    439:     } for
                    440:     /genPairs.n genPairs.list length def
                    441:   ] pop
                    442:   popVariables
                    443: } def
                    444: 
                    445: /getPair {
                    446:   [/i ] pushVariables
                    447:   [
                    448:     genPairs.i genPairs.n lt {
                    449:       genPairs.list genPairs.i get /ans set
                    450:       genPairs.i 1 add /genPairs.i set
                    451:     }
                    452:     { [-1 -1] /ans set} ifelse
                    453:     /arg1 ans def
                    454:   ] pop
                    455:   popVariables
                    456:   arg1
                    457: } def
                    458: 
                    459: /sumUp {
                    460:   /arg1 set
                    461:   [/ans /v /i /n] pushVariables
                    462:   [
                    463:     /v arg1 def
                    464:     /n v length def
                    465:     /ans 0 def
                    466:     0 1 n 1 sub {
                    467:       /i set
                    468:       ans v i get add /ans set
                    469:     } for
                    470:     /arg1 ans def
                    471:    ] pop
                    472:    popVariables
                    473:    arg1
                    474: } def
                    475: 
                    476: 
                    477: /dist {
                    478:   /dist.debug 0 def
                    479:   /result [  ] def
                    480:   enginesList {oxconnect} map /engines set
                    481:   /enginesN engines length def
                    482:   % broadcast the program.
                    483:   (ox-1.sm1) pushfile /enginescmd set  %% read a file.
                    484:   [(parse) enginescmd] extension
                    485:   engines {enginescmd oxsubmit} map
                    486:   engines { (slave-start) oxsubmit} map    %% initialize slave codes.
                    487:                                            %% send pid.
                    488:   0 1 enginesN 1 sub {
                    489:     /i set
                    490:     engines i get i oxsendcmo
                    491:     engines i get (/myid set) oxsubmit
                    492:   } for
                    493: 
                    494:   master-start %% initialize master codes
                    495:   %% gbsize genPairs   %% obsolete
                    496:   /gbsize ans length def
                    497:   ans makePairs /genPairs.list set
                    498:   /genPairs.i 0 def  /genPairs.n genPairs.list length def
                    499:   
                    500: 
                    501:   /exhausted 0 def
                    502:   % clear the busy flag.
                    503:   /busy [1 1 enginesN { pop 0 } for ] def
                    504:   (date) system-csh
                    505:   {{
                    506:   exhausted 0 eq {
                    507:     0 1 enginesN 1 sub {
                    508:       /i set
                    509:       busy i get 0 eq {
                    510:         getPair /p set
                    511:         p 0 get -1 eq {/exhausted 1 def exit} { } ifelse
                    512:         busy i 1 put
                    513:         engines i get p oxsendcmo
                    514:         engines i get ( computesp ) oxsubmit
                    515:         engines i get oxpopcmo1
                    516:       } { } ifelse
                    517:     } for
                    518:   } {  } ifelse
                    519:   dist.debug { (busy=) messagen busy message } { } ifelse
                    520:   busy sumUp 0 eq { result message exit error  } {  } ifelse
                    521:   [(oxMultiSelect) engines -1] extension /status set   
                    522:   /datastatus status 1 get def
                    523:   dist.debug { (datastatus=) messagen datastatus message } { } ifelse
                    524:   0 1 enginesN 1 sub {
                    525:     /i set
                    526:     datastatus i get 1 eq {
                    527:       engines i get oxpopcmo2 /ans set
                    528:       busy i 0 put
                    529:       result ans append /result set
                    530:     } { } ifelse
                    531:   } for
                    532:   } loop } timer
                    533:   (date) system-csh
                    534:   (result is in result) message
                    535:   (Number of s-pairs checked is ) messagen result length message
                    536: } def
                    537: 
                    538: ox.verbose {  
                    539:  (dist for experiments for distributed computing. cf. startengines) message
                    540: } { } ifelse
                    541: 
                    542: /oxIsServerReady {
                    543:   /arg1 set
                    544:   [/in-isServerReady /sdata /ans] pushVariables
                    545:   [
                    546:     /sdata arg1 def
                    547:     /ans 0 def
                    548:     sdata isArray {
                    549:      sdata length 1 gt {
                    550:        sdata 0 get (client) eq { /ans 1 def } { } ifelse
                    551:      } { } ifelse
                    552:     } { } ifelse
                    553:     /arg1 ans def
                    554:   ] pop
                    555:   popVariables
                    556:   arg1
                    557: } def
                    558: 
                    559: 
                    560: %%%%%%%%%%%%%%%  tests 
                    561: ox.verbose {
                    562:   (test10 : test to read and write ox-data and ox-command to a file) message
                    563: } {  } ifelse
                    564: 
                    565: /test10 {
                    566:   [(oxCreateClientFile) (afo) (w)] extension /ccc set
                    567:   [(oxWatch) ccc] extension
                    568:   ccc (x-1). oxsendcmo
                    569:   [(oxReq) ccc SM_executeStringByLocalParser
                    570:    ( dup add message )] extension pop
                    571:   ccc (quit) oxsendcmo
                    572: 
                    573:   [(oxCloseClient) ccc] extension
                    574: } def
                    575: 
                    576: /test11 {
                    577:   [(oxCreateClientFile) (afo) (r)] extension /ccc set
                    578:   [(oxGet) ccc] extension ::
                    579:   [(oxGet) ccc] extension ::
                    580: } def
                    581: 
                    582: ox.verbose {
                    583:  (test12 : ccc is the client. ff poly in Q<x,y,z,dx,dy,dz>  ) message
                    584: } { } ifelse
                    585: /test12 {
                    586:   [(localhost) 1300 1200] oxconnect /ccc set
                    587:   [(x,y,z) ring_of_differential_operators ( ) elimination_order 0] define_ring
                    588:   (x+y). /ff set
                    589:   /eee (hello) (error) dc def
                    590:   /eee0 eee (error) dc def
                    591:   (eee is the CMO_ERROR2 object [CMO_ERROR2 hello], eee0 is the CMO_ERROR object) message
                    592: } def
                    593: 
                    594: /sm1connectr {
                    595:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    596:  [
                    597:  /pass [(oxGenPass)] extension def
                    598:  /peer [(oxGetPort) (localhost)] extension def
                    599:  /data peer 1 get toString def
                    600:  /control peer 3 get toString def
                    601:  peer message
                    602:  [(start ox ) ( -reverse -ox ) (/home/nobuki/OpenXM/src/kxx/ox_sm1.exe)
                    603:   ( -data ) data ( -control ) control  ( -pass ) pass 
                    604:   oxpath.null
                    605:   ( )] cat system 
1.4       takayama  606:  [(oxCreateClient2) peer 0 pass] extension /ox.ccc set
                    607:                      %% 0 means connect from only localhost. 
                    608:  (The server is binded to the variable ox.ccc) message
                    609:   ox.ccc.init 
                    610:  ] pop
                    611:  popVariables
                    612: } def
                    613: 
                    614: /sm1connectr_win {
                    615:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    616:  [
                    617:  /pass [(oxGenPass)] extension def
                    618:  /peer [(oxGetPort) (localhost)] extension def
                    619:  /data peer 1 get toString def
                    620:  /control peer 3 get toString def
                    621:  peer message
                    622:  [(forkExec) [
                    623:     (c:/windows/command/start)
                    624:     [OpenXM_HOME_WIN  (/bin/ox)] cat
                    625:     (-reverse)
                    626:     (-ox)
                    627:     [OpenXM_HOME_WIN (/bin/ox_sm1.exe)] cat
                    628:     (-data)
                    629:      data
                    630:      (-control)
                    631:      control
                    632:      (-pass)
                    633:      pass
                    634:   ]
                    635:   [  ] 3] extension
                    636: 
1.2       takayama  637:  [(oxCreateClient2) peer 0 pass] extension /ox.ccc set
                    638:                      %% 0 means connect from only localhost. 
                    639:  (The server is binded to the variable ox.ccc) message
                    640:   ox.ccc.init 
                    641:  ] pop
                    642:  popVariables
                    643: } def
                    644: 
1.5       takayama  645: /asirconnectr_win {
1.2       takayama  646:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    647:  [
1.5       takayama  648:  /pass [ ] cat def  %% Do not use one time password.
1.2       takayama  649:  /peer [(oxGetPort) (localhost)] extension def
                    650:  /data peer 1 get toString def
                    651:  /control peer 3 get toString def
                    652:  peer message
1.5       takayama  653:  [control data] message
                    654:  [(forkExec)
                    655:   [OX_LAUNCH
                    656:    (ox_launch)
                    657:    (localhost)
                    658:    (0)
                    659:    control toString
                    660:    data toString
                    661:    (ox_asir)
                    662:    (1)
                    663:   ]
                    664:   [ ]
                    665:   7 %% 1 1 1
                    666:  ] extension ;
                    667:  [(oxCreateClient2) peer 0 pass] extension /oxasir.ccc set
1.1       takayama  668:                      %% 0 means connect from only localhost. 
1.5       takayama  669:  (The server is binded to the variable oxasir.ccc) message
                    670:   %% Initialization code for asir.
1.1       takayama  671:  ] pop
                    672:  popVariables
                    673: } def
                    674: 
                    675: /sm1connectr-ssh {
                    676:  /arg1 set
                    677:  [/in-sm1connectr /pass /peer /data /control /name /machine
                    678:   /your-peer /comm
                    679:  ] pushVariables
                    680:  [
                    681:  /machine arg1 0 get def
                    682:  /name arg1 1 get def
                    683: 
                    684:  /pass [(oxGenPass)] extension def
                    685:  /peer [(oxGetPort) myhostname-ssh] extension def
                    686:  /data peer 1 get toString def
                    687:  /control peer 3 get toString def
                    688:  peer message
                    689:  [(ssh -f ) machine ( -l ) name ( ")
                    690:   oxpath.oxlog.xterm-ssh  oxpath.ox-ssh ( -reverse -ox ) oxpath.oxsm1-ssh
                    691:   ( -host ) myhostname-ssh
                    692:   ( -data ) data ( -control ) control  ( -pass ) pass 
                    693:   oxpath.null
                    694:   ( ")
                    695:  ] cat /comm set
                    696:  (Executing the command : ) messagen comm message message
                    697:   comm system
                    698:  (sleep 5) system-csh
                    699:  [(oxCreateClient2) peer 1 pass] extension /your-peer set
                    700:  /arg1 your-peer def
                    701:  ] pop
                    702:  popVariables
                    703:  arg1
                    704: } def
                    705: [(sm1connectr-ssh)
                    706: [([hostname login-name] sm1connectr-ssh client)
                    707:  (Starting oxpath.oxsm1-ssh by the launcher oxpath.ox-ssh on the "hostname".)
                    708:  (cf. oxNoX )
                    709:  (Set the following varialbes to appropriate values:)
                    710:  (oxpath.oxlog.xterm-ssh  oxpath.oxsm1-ssh  oxpath.ox-ssh myhostname-ssh )
                    711:  $Example 1: $
                    712:  $  *** Path names on the remote machine dc1.math.kobe-u.ac.jp $
                    713:  $    /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def $
                    714:  $    /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def $
                    715:  $    /oxpath.ox-ssh    (/home/taka/OpenXM/bin/ox) def $
                    716:  $  *** The machine name on which you are running sm1. $
                    717:  $    /myhostname-ssh   (yama.math.kobe-u.ac.jp) def $
                    718:  $         [(dc1.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set  $
                    719:  $Example 2: $
                    720:  $  *** Path names on the remote machine dc2.math.kobe-u.ac.jp $
                    721:  $  *** We will not use X11 debug windows. $
                    722:  $    oxNoX $
                    723:  $    /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog ) def $
                    724:  $    /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def $
                    725:  $    /oxpath.ox-ssh    (/home/taka/OpenXM/bin/ox) def $
                    726:  $  *** the machine name on which you are running sm1. $
                    727:  $    /myhostname-ssh   (dc1.math.kobe-u.ac.jp) def $
                    728:  $         [(dc2.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set  $
                    729: ]] putUsages
                    730: 
                    731: /addSlash {
                    732:   /arg1 set
                    733:   [/in-addSlash /ss /aaa /ans] pushVariables
                    734:   [
                    735:     /ss arg1 def
                    736:     ss (array) dc /aaa set
                    737:     aaa length 0 eq {
                    738:       /ans (/) def
                    739:     }{
                    740:       aaa aaa length 1 sub get  47  eq %% The last equals / ?
                    741:       {
                    742:         /ans ss def
                    743:       }{
                    744:         /ans [ss (/)] cat def
                    745:       } ifelse
                    746:     } ifelse
                    747:     /arg1 ans def
                    748:   ] pop
                    749:   arg1 
                    750: } def
                    751: 
                    752: /getPathNameSm1 {
                    753:   /arg1 set
                    754:   [/in-getPathNameSm1 /fname /fullname /tname] pushVariables
                    755:   [
                    756:      /fname arg1 0 get def
                    757:      %% If fullname is given, use it.
                    758:      fname (array) dc 0 get 
                    759:      (/) (array) dc 0 get eq
                    760:      {  /fullname fname def
                    761:         /getPathNameSm1.LLL goto
                    762:      } { } ifelse
                    763: 
                    764:      %% Else first try to find it in LOAD_SM1_PATH
                    765:      [(getenv) (LOAD_SM1_PATH)] extension /tname set
                    766:      tname isString 
                    767:      { 
                    768:        tname addSlash /tname set
                    769:        [(stat) [tname fname] cat] extension
                    770:        0 get isInteger  %% The file was found.
                    771:        {  /fullname [tname fname] cat def
                    772:           /getPathNameSm1.LLL goto
                    773:        } { } ifelse
                    774:      } {  } ifelse
                    775: 
                    776:      %% Else first try to find it in OpenXM_HOME
                    777:      [(getenv) (OpenXM_HOME)] extension /tname set
                    778:      tname isString 
                    779:      { 
                    780:        tname addSlash /tname set
                    781:        [tname (lib/sm1/)] cat /tname set
                    782:        [(stat) [tname fname] cat] extension
                    783:        0 get isInteger  %% The file was found.
                    784:        {  /fullname [tname fname] cat def
                    785:           /getPathNameSm1.LLL goto
                    786:        } { } ifelse
                    787:      } {  } ifelse
                    788: 
                    789:      %% Else try to find it in /usr/local/lib/sm1
                    790:      [(stat) [(/usr/local/lib/sm1/) fname] cat] extension
                    791:      0 get isInteger  %% The file was found.
                    792:      {  /fullname [(/usr/local/lib/sm1/) fname] cat def
                    793:         /getPathNameSm1.LLL goto
                    794:      } { } ifelse
                    795: 
                    796:      %% Otherwise error.
                    797:        [(getPathNameSm1: The file ) fname 
                    798:         ( could not be found ) 
                    799:         (neigher in LOAD\_SM1\_PATH=)
                    800:         [(getenv) (LOAD_SM1_PATH)] extension
                    801:         ( nor in OpenXM\_HOME/lib/sm1=)
                    802:         [(getenv) (OpenXM_HOME)] extension
                    803:         (/lib/sm1)
                    804:         ( nor in /usr/local/lib/sm1)
                    805:        ] cat /getPathNameSm1.errorMessage set
                    806:        getPathNameSm1.errorMessage message
                    807:      ] pop popVariables getPathNameSm1.errorMessage error
                    808: 
                    809:      /getPathNameSm1.LLL
                    810:      /arg1 fullname def
                    811:   ] pop
                    812:   popVariables
                    813:   arg1
                    814: } def
                    815: [(getPathNameSm1)
                    816: [([fname] getPathNameSm1 fullname)
                    817:  (string fname, fullname)
                    818:  (This command searches the fname in LOAD_SM1_PATH, )
                    819:  (OpenXM_HOME/lib/sm1, and /usr/local/lib/sm1)
                    820:  (It returns the fullname.)
                    821: ]] putUsages
                    822: 
                    823: /getPathNameAsir {
                    824:   /arg1 set
                    825:   [/in-getPathNameAsir /fname /fullname /tname] pushVariables
                    826:   [
                    827:      /fname arg1 0 get def
                    828:      %% If fullname is given, use it.
                    829:      fname (array) dc 0 get 
                    830:      (/) (array) dc 0 get eq
                    831:      {  /fullname fname def
                    832:         /getPathNameAsir.LLL goto
                    833:      } { } ifelse
                    834: 
                    835:      %% Else try to find it in ASIR_LIBDIR
                    836:      [(getenv) (ASIR_LIBDIR)] extension /tname set
                    837:      tname isString 
                    838:      { 
                    839:        [(stat) [tname (/) fname] cat] extension
                    840:        0 get isInteger  %% The file was found.
                    841:        {  /fullname [tname (/) fname] cat def
                    842:           /getPathNameAsir.LLL goto
                    843:        } { } ifelse
                    844:  
                    845:      } {  } ifelse
                    846:      
                    847:      %% Else try to find it in /usr/local/lib/asir
                    848:      [(stat) [(/usr/local/lib/asir/) fname] cat] extension
                    849:      0 get isInteger  %% The file was found.
                    850:      {  /fullname [(/usr/local/lib/asir/) fname] cat def
                    851:         /getPathNameAsir.LLL goto
                    852:      } { } ifelse
                    853: 
                    854:      %% Otherwise error.
                    855:        [ (getPathNameAsir: The file )  
                    856:           fname  (ox_asir) eq
                    857:           {(ox\_asir)} { fname }ifelse
                    858:        ( could not be found ) 
                    859:        (neigher in /usr/local/lib/asir nor in ASIR\_LIBDIR. )
                    860:        ] cat /getPathNameAsir.errorMessage set
                    861:        getPathNameAsir.errorMessage message
                    862:      ] pop popVariables getPathNameAsir.errorMessage error
                    863: 
                    864:      /getPathNameAsir.LLL
                    865:      /arg1 fullname def
                    866:   ] pop
                    867:   popVariables
                    868:   arg1
                    869: } def
                    870: [(getPathNameAsir)
                    871: [([fname] getPathNameAsir fullname)
                    872:  (string fname, fullname)
                    873:  (This command searches the fname in /usr/local/lib/asir and ASIR_LIBDIR)
                    874:  (and returns the fullname.)
                    875: ]] putUsages
                    876: 
                    877: 
                    878: /ox_launch_nox { 
                    879:   /@@@.ox_launch_nox  1 def
                    880:   ox_launch_aux
                    881: } def
                    882: /ox_launch { 
                    883:   /@@@.ox_launch_nox  0 def
                    884:   ox_launch_aux
                    885: } def
                    886: 
                    887: /ox_launch_aux {
                    888:  /arg1 set
                    889:  [/in-launch_nox /pass /peer /data /control /name /machine
                    890:   /your-peer /comm /remoteOpenXMbin /remoteServer /myhost
                    891:   /argNumber /aaa 
                    892:  ] pushVariables
                    893:  [
                    894:    /aaa arg1 def
                    895:    /argNumber aaa length def 
                    896:    /machine aaa 0 get def
                    897:    machine (localhost) eq argNumber 5 lt and {
                    898:      aaa 1 get ox_launch_localhost /your-peer set
                    899:      /LLL.end goto
                    900:    } {
                    901:      /remoteOpenXMbin aaa 1 get def
                    902:      /remoteServer aaa 2 get def
                    903:      /name aaa 3 get def
                    904:      /myhost aaa 4 get def
                    905:    } ifelse
                    906: 
                    907:    /pass [(oxGenPass)] extension def
                    908:    /peer [(oxGetPort) myhost] extension def
                    909:    /data peer 1 get toString def
                    910:    /control peer 3 get toString def
                    911:    peer message
                    912:  [(ssh -f ) machine ( -l ) name ( ")
                    913: 
                    914:    @@@.ox_launch_nox {
                    915:    } {
                    916:      remoteOpenXMbin(/oxlog )
                    917:      ( /usr/X11R6/bin/xterm -icon -e )
                    918:    } ifelse
                    919: 
                    920:   ( ) remoteOpenXMbin (/ox ) 
                    921:   ( -reverse -ox ) remoteServer
                    922:   ( -host ) myhost
                    923:   ( -data ) data ( -control ) control  ( -pass ) pass 
                    924:   oxpath.null
                    925:   ( ")
                    926:  ] cat /comm set
                    927:  (Executing the command : ) messagen comm message message
                    928:   comm system
                    929:  (sleep 5) system-csh
                    930:  [(oxCreateClient2) peer 1 pass] extension /your-peer set
                    931:  /LLL.end
                    932:  /arg1 your-peer def
                    933:  ] pop
                    934:  popVariables
                    935:  arg1
                    936: } def
                    937: 
                    938: [(ox_launch)
                    939: [( [remote remote-OpenXM-bin remote-ox-server remote-login-name myhostname] )
                    940:  (  ox_launch  client )
                    941:  $or $
                    942:  $ [(localhost) ox-server-name] ox_launch client$
                    943:  (Example 1: )
                    944:  $ [(tau.math.kobe-u.ac.jp) (/home/taka/OpenXM/bin) $
                    945:  $  (/home/taka/OpenXM/src/ox_math/ox_math) (taka) (dc4.math.kobe-u.ac.jp) $
                    946:  $ ] ox_launch /@@@.oxmath set $
                    947: ]] putUsages
                    948: 
                    949: [(ox_launch_nox)
                    950: [( [remote remote-OpenXM-bin remote-ox-server remote-login-name myhostname] )
                    951:  (  ox_launch_nox  client )
                    952:  (Example 1: )
                    953:  $ [(tau.math.kobe-u.ac.jp) (/home/taka/OpenXM/bin) $
                    954:  $  (/home/taka/OpenXM/src/ox_math/ox_math) (taka) (dc4.math.kobe-u.ac.jp) $
                    955:  $ ] ox_launch_nox /@@@.oxmath set $
                    956: ]] putUsages
                    957: 
                    958: /system-csh {
                    959:   /arg1 set
                    960:   [/in-system-csh /com /com2] pushVariables
                    961:   [
                    962:     /com arg1 def
                    963:     [(/bin/csh -c ") com (")] cat
                    964:     /com2 set
                    965:     %%com2 message
                    966:     com2 system
                    967:   ] pop
                    968:   popVariables
                    969: } def
                    970: 
                    971: /ox_launch_localhost {
                    972:  /arg1 set
                    973:  [/in-ox_launch_localhost /pass /peer /data /control /oxserver
                    974:   /my-peer] pushVariables
                    975:  [
                    976:     /oxserver arg1 def
                    977:     /pass [(oxGenPass)] extension def
                    978:     /peer [(oxGetPort) (localhost)] extension def
                    979:     /data peer 1 get toString def
                    980:     /control peer 3 get toString def
                    981:     peer message
                    982:     [oxpath.oxlog.xterm  oxpath.ox ( -reverse -ox ) oxserver
                    983:      ( -data ) data ( -control ) control  ( -pass ) pass 
                    984:       oxpath.null
                    985:      ( &)] cat system-csh
                    986:     [(oxCreateClient2) peer 0 pass] extension /my-peer set
                    987:                          %% 0 means connect from only localhost. 
                    988:     (The server is binded to the variable ox.ccc) message
                    989:     /arg1 my-peer def
                    990:  ] pop
                    991:  popVariables
                    992:  arg1
                    993: } def
                    994: 
                    995: %% Test code for oxCreateControl_RFC_101
                    996: /sm1StartControl101 {
                    997:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    998:  [
                    999:  /pass [(oxGenPass)] extension def
                   1000:  /peer [(oxGetPort1) (localhost)] extension def
                   1001:  /data peer 1 get toString def
                   1002:  peer message
                   1003:  [(/home/nobuki/OpenXM/src/oxc/oxc)
                   1004:   ( -c ) pass ( -h ) (localhost) ( -p ) data ( -x )
                   1005:   oxpath.null
                   1006:   ( &)] cat system-csh
                   1007: 
                   1008:  [(oxCreateControl_RFC_101) peer 0 pass] extension /ox.ccc set
                   1009:                      %% 0 means connect from only localhost. 
                   1010:  (The server is binded to the variable ox.ccc) message
                   1011:   ox.ccc
                   1012:  ] pop
                   1013:  popVariables
                   1014: } def
                   1015: 
                   1016: /sm1StartEngine101 {
                   1017:  [/in-sm1StartEngine101 /peer /data /control /engineID] pushVariables
                   1018:  [
                   1019:     /peer [(oxGetPort1) (localhost)] extension def
                   1020:     /data peer 1 get def
                   1021: 
                   1022:     ox.ccc data oxpushcmo
                   1023:     ox.ccc (/home/nobuki/OpenXM/bin/ox_sm1) oxpushcmo
                   1024:     [(oxPushCMD) ox.ccc SM_control_spawn_server] extension
                   1025:     ox.ccc oxpopcmo /engineID set
                   1026:     [(oxCreateEngine_RFC_101) peer 0 (Empty) engineID] extension
                   1027:     /ox.ddd set
                   1028:     (The engine is binded to the variables ox.ddd) message
                   1029:  ] pop
                   1030:  popVariables
                   1031:  arg1
                   1032: } def
                   1033: 
                   1034: initializePathNamesForOx  %% This should be 

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