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

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

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