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

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

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