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

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

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