[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.4

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

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