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

Annotation of OpenXM/src/kan96xx/Doc/ox.sm1, Revision 1.8

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

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