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

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

1.1       maekawa     1: %%%%%%%%%%%% Configuration: Specify your server path
                      2: %%%%% ox, ox_sm1, oxlog are contained in kxx.tgz
                      3: %%%%% These should be under /usr/local/lib/sm1 or LOAD_SM1_PATH
                      4: /oxpath.ox (bin/ox) def
                      5: /oxpath.oxsm1 (bin/ox_sm1) def
                      6: /oxpath.oxlog (bin/oxlog) def
                      7: /oxpath.xterm (/usr/X11R6/bin/xterm  -icon  -e ) def
                      8: /oxpath.null  (  ) def
                      9: /oxpath.null00  ( >& /dev/null ) def   %% cf oxNoX
                     10: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                     11: %% Old full path.
                     12: %/oxpath.ox (/home/nobuki/kxx/ox) def
                     13: %/oxpath.oxsm1 (/home/nobuki/kxx/ox_sm1) def
                     14: %/oxpath.oxlog (/home/nobuki/kxx/oxlog) def
                     15: %/oxpath.xterm (/usr/X11R6/bin/xterm  -icon  -e ) def
                     16:
                     17: %% This macro is invoked when this package is loaded.
                     18: /initializePathNamesForOx  {
                     19:    [oxpath.ox] getPathNameSm1 /oxpath.ox set
                     20:    [oxpath.oxsm1] getPathNameSm1 /oxpath.oxsm1 set
                     21:    [oxpath.oxlog] getPathNameSm1 /oxpath.oxlog set
                     22:    /oxpath.oxlog.xterm [oxpath.oxlog ( ) oxpath.xterm] cat def
                     23: } def
                     24:
                     25: %% Execute this macro, then xterm will not be executed and the output
                     26: %% will be redirected to /dev/null.
                     27: /oxNoX {
                     28:    /oxpath.null oxpath.null00 def
                     29:    /oxpath.oxlog.xterm [oxpath.oxlog ( )] cat def
                     30:    (oxpath.oxlog.xterm is set to ) messagen
                     31:    oxpath.oxlog.xterm message
                     32: } def
                     33:
                     34: /ox.ccc.init { ox.ccc ( [(oxPrintMessage) 0] extension pop ) oxsubmit } def
                     35:
                     36: /ox.verbose 0   def
                     37: /ox.version (2.981105) def
                     38: ox.version [(Version)] system_variable gt
                     39: { (This package requires the latest version of kan/sm1) message
                     40:   (Please get it from http://www.math.kobe-u.ac.jp/KAN) message
                     41:   error
                     42: } { } ifelse
                     43: (ox.sm1, --- open sm1 protocol module 10/1,1999  (C) N.Takayama. oxhelp for help) message-quiet
                     44:
                     45: /ox.ccc load isArray
                     46: { }
                     47: { /ox.ccc [ ] def } ifelse
                     48:
                     49:
                     50:
                     51: /ox.logsize 10 def
                     52: /ox.log [1 1 ox.logsize {pop 0} for ] def
                     53: /ox.mod { dup ox.logsize idiv ox.logsize mul sub } def
                     54: /ox.takelog 1 def
                     55:
                     56: /SM_executeStringByLocalParser 268 def
                     57: /SM_execute 268 def
                     58: /SM_popString  263  def
                     59: /SM_mathcap 264 def
                     60:
                     61: /SM_popCMO 262 def
                     62: /SM_executeFunction 269 def
                     63: /SM_DUMMY_sendcmo  280 def
                     64: /SM_sync_ball 281 def
                     65:
                     66: /SM_pops  265  def
                     67: /SM_setName 266  def
                     68: /SM_evalName 267  def
                     69:
                     70: /SM_setMathCap 273 def
                     71:
                     72: /SM_getsp     275  def
                     73: /SM_dupErrors 276  def
                     74:
                     75: /SM_control_kill 1024 def
                     76: /SM_control_reset_connection  1030 def
                     77:
                     78: /Etag_error 257 def
                     79:
                     80: /enginesList [
                     81:   [(localhost) 1300 1200]
                     82:   [(localhost) 2300 2200]
                     83: ] def
                     84: %% cf. startengines
                     85: /enginesList.2 [
                     86:   [(dc1) 1300 1200]
                     87:   [(dc2) 2300 2200]
                     88: ] def
                     89: %% cf. se12
                     90:
                     91: /oxconnect {
                     92:   /arg1 set
                     93:   [(oxCreateClient) arg1 aload pop] extension
                     94: } def
                     95: [(oxconnect)
                     96:  [([hostname data-port control-port] oxconnect pid)
                     97:   (oxconnect is used to connect this to a server on the hostname with data-port)
                     98:   (and control-port)
                     99:   (Example 1:  ox -ox ox_sm1 -data 1300 -control 1200    <== on server.)
                    100:   (            [$localhost$ 1300 1200] oxconnect /ox.ccc set  <== on client.)
                    101:   (Example 2:  ox -ox ox_sm1 -host s.OpenXM.org -insecure -data 1300 -control 1200    <== on server.)
                    102:   (            [$s.OpenXM.org$ 1300 1200] oxconnect /ox.ccc set  <== on client.)
                    103:   (Example 3:  ox -ox ox_sm1 -data 1300 -control 1200  >& /dev/null &<== on server.)
                    104:   (            [$localhost$ 1300 1200] oxconnect /ox.ccc set  <== on client.)
                    105:   (           cf. oxNoX)
                    106:   (See also ox)
                    107:  ]
                    108: ] putUsages
                    109:
                    110: [(ox)
                    111:  [
                    112:   (client aa oxpushcmo (oxsendcmo), client oxpopcmo dd, client popstring dd, client ss oxrpc)
                    113:  (Example: ox.ccc [1 2 3] oxpushcmo ox.ccc oxpopcmo /ff set  ff :: )
                    114:  (  )
                    115:  (client ss oxexecutestring(oxsubmit) <<executeString>>, client ss oxexec <<executeFunction>>)
                    116:
                    117:  (Example: ox.ccc (0 1 10 { pop $Hello$ message } for) oxexecutestring )
                    118:  (Example: ox.ccc (2).. oxpushcmo ox.ccc (10).. oxpushcmo )
                    119:  (         ox.ccc (power) oxexec  ox.ccc oxpopcmo :: )
                    120:  (  )
                    121:  (client str oxevalname, client str oxsetname, client num oxpops, client oxget)
                    122:  (   )
                    123:  (client oxmathcap, client oxsetmathcap, oxgenportfile, oxremoveportfile)
                    124:  (   )
                    125:  (client oxgetsp --- get stack pointer,  client oxgeterrors --- get all errors)
                    126:  (cleint oxisData, client oxreset, client oxshutdown)
                    127:  (oxhelp for this message, [(oxWatch) client] extension to start a log.)
                    128:  ([(oxSerial)] extension serial-number-of-out-going-ox-packet.)
                    129:  (oxpopcmo1, oxpopcmo2,  sm1connect2, sm1connect3)
                    130:  (sm1connectr )
                    131:  (oxNoX : set an environment to invoke oxlog without xterm and to call oxlog with >& /dev/null)
                    132:  $        ex 1.  (ox.sm1) run oxNoX sm1connectr $
                    133:  $        ex 2.  (oxasir.sm1) run oxNoX (x^2-1). fctr pmat ; $
                    134:  ]
                    135: ] putUsages
                    136:
                    137: /oxhelp {
                    138:  (oxconnect) usage
                    139:  (  ) message
                    140:  (ox) usage
                    141: } def
                    142: [(oxhelp)
                    143:  [(oxhelp  outputs help messages for ox commands.)
                    144: ]] putUsages
                    145:
                    146: ox.verbose { oxhelp } {  } ifelse
                    147:
                    148: /sm1connect2 {
                    149:  [oxpath.oxlog.xterm   oxpath.ox ( -ox ) oxpath.oxsm1
                    150:   oxpath.null
                    151:   ( &)] cat system
                    152: % (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_sm1 &) system
                    153: % For MSRI, or Eterm,
                    154: %(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_sm1 &) system
                    155:  (If you start the server automatically, you may have a trouble to) message
                    156:  (oxreset. In order to avoid this trouble, start the server by hand.) message
                    157:  (sleep 5) system
                    158:   [(localhost) 1300 1200] oxconnect /ox.ccc set
                    159:  (The server is binded to the variable ox.ccc) message
                    160:  ox.ccc.init
                    161: } def
                    162:
                    163: /sm1connect3 {
                    164:  [oxpath.oxlog.xterm   oxpath.ox ( -ox ) oxpath.oxsm1
                    165:   (  -data 2300 -control 2200 )
                    166:   oxpath.null
                    167:   ( &)] cat system
                    168: % (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_sm1 -data 2300 -control 2200 &) system
                    169: % For MSRI
                    170: %(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_sm1 -data 2300 -control 2200&) system
                    171:  (If you start the server automatically, you may have a trouble to) message
                    172:  (oxreset. In order to avoid this trouble, start the server by hand.) message
                    173:  (sleep 5) system
                    174:   [(localhost) 2300 2200] oxconnect /ox.ccc2 set
                    175:  (The server is binded to the variable ox.ccc2) message
                    176: } def
                    177:
                    178: /sm1connect4 {
                    179:  %% test version.
                    180:  /ox.ccc.portfile oxgenportfile def
                    181:  [oxpath.oxlog.xterm   oxpath.ox ( -ox ) oxpath.oxsm1
                    182:   ( -portfile ) ox.ccc.portfile
                    183:   oxpath.null
                    184:   ( &)] cat system
                    185:  (sleep 5) system
                    186:  [(oxReadPortFile) ox.ccc.portfile] extension /ox.ccc.control set
                    187:  ox.ccc.control message
                    188:  [(localhost) ox.ccc.control 1200] /ox.ccc set
                    189:  (The server is binded to the variable ox.ccc) message
                    190:  oxremoveportfile
                    191: } def
                    192:
                    193: /oxpushcmo { oxsendcmo } def
                    194: /oxsendcmo {
                    195:   /arg1 set
                    196:   /arg2 set
                    197:   ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    198:   } {  } ifelse
                    199:   [(oxReq) arg2 SM_DUMMY_sendcmo arg1] extension pop
                    200: } def
                    201:
                    202: /oxpopcmo {
                    203:   /arg1 set
                    204:   [(oxReq) arg1 SM_popCMO ] extension pop
                    205:   [(oxGet) arg1] extension
                    206: } def
                    207:
                    208: /oxgetsp {
                    209:   /arg1 set
                    210:   [(oxReq) arg1 SM_getsp ] extension pop
                    211:   [(oxReq) arg1 SM_popCMO ] extension pop
                    212:   [(oxGet) arg1] extension
                    213: } def
                    214:
                    215: /oxgeterrors {
                    216:   /arg1 set
                    217:   [(oxReq) arg1 SM_dupErrors ] extension pop
                    218:   [(oxReq) arg1 SM_popCMO ] extension pop
                    219:   [(oxGet) arg1] extension
                    220: } def
                    221:
                    222: /oxmathcap0 {
                    223:   /arg1 set
                    224:   [(oxReq) arg1 SM_mathcap ] extension pop
                    225: } def
                    226: /oxmathcap {
                    227:   /arg1 set
                    228:   [/in-oxmathcap /mypeer /mmm] pushVariables
                    229:   [ /mypeer arg1 def
                    230:     mypeer oxmathcap0
                    231:     mypeer oxpopcmo /mmm set
                    232:     mypeer 10 mmm put  %% set math cap.
                    233:   ] pop
                    234:   popVariables
                    235: } def
                    236: /oxsetmathcap {
                    237:   /arg1 set
                    238:   [/in-oxsetmathcap /mypeer /mymathcap] pushVariables
                    239:   [
                    240:     /mypeer arg1 def
                    241:     /mymathcap     [(cmoMathCap)] extension (array) dc def
                    242:     [(oxReq)
                    243:       mypeer   SM_setMathCap
                    244:       mymathcap
                    245:     ] extension pop
                    246:   ] pop
                    247:   popVariables
                    248: } def
                    249: /oxsetmathcap.old {
                    250:   /arg1 set
                    251:   [(oxReq)
                    252:     arg1   SM_setMathCap
                    253:     [(mathcap-object)
                    254:      [[199901160 (sm1)]
                    255:       [2130706434 , 1 , 2 , 4 , 17 , 19 , 20 , 22 , 23 , 24 , 25 , 26 , 30 ]
                    256:       %% mathcap for sm1.
                    257:       %% [1 2 3 4 5]   %% for test.   cf. cmoCheckMathCap, Sm1_mathcap()
                    258:      ]
                    259:     ]  %% Never write a broken data here.
                    260:   ] extension pop
                    261: } def
                    262: /oxpopcmo1 {  %% ask of the transmission.
                    263:   /arg1 set
                    264:   [(oxReq) arg1 SM_popCMO ] extension pop
                    265: } def
                    266: /oxpopcmo2 {  %% wait the data.
                    267:   /arg1 set
                    268:   [(oxGet) arg1] extension
                    269: } def
                    270:
                    271:
                    272: /oxpopstring {
                    273:   /arg1 set
                    274:   [(oxReq) arg1 SM_popString ] extension pop
                    275:   [(oxGet) arg1] extension
                    276: } def
                    277:
                    278: /oxrpc {
                    279:   /arg1 set
                    280:   /arg2 set
                    281:   [/ans /ff] pushVariables
                    282:   [
                    283:    /ff arg2 def
                    284:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    285:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeString) put
                    286:    } {  } ifelse
                    287:    [(oxReq) ff SM_execute arg1] extension pop
                    288:    [(oxReq) ff SM_popCMO] extension pop
                    289:    [(oxGet) ff] extension /ans set
                    290:    ans etag Etag_error  eq {
                    291:      (Got an error object.) message
                    292:      /arg1 ans def
                    293:    }
                    294:    {  /arg1 ans def
                    295:     } ifelse
                    296:   ] pop
                    297:   popVariables
                    298:   arg1
                    299: } def
                    300:
                    301: /oxexecutestring { oxsubmit } def
                    302: /oxsubmit {
                    303:   /arg1 set
                    304:   /arg2 set
                    305:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    306:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeString) put
                    307:    } {  } ifelse
                    308:   [(oxReq) arg2 SM_execute arg1] extension pop
                    309: } def
                    310:
                    311: /oxexec {
                    312:   /arg1 set
                    313:   /arg2 set
                    314:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    315:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeFunction) put
                    316:    } {  } ifelse
                    317:   [(oxReq) arg2 SM_executeFunction arg1] extension pop
                    318: } def
                    319: /oxsubmit2 {
                    320:   oxexec
                    321: } def
                    322:
                    323: /oxpops {
                    324:   /arg1 set
                    325:   /arg2 set
                    326:   [(oxReq) arg2 SM_pops arg1] extension pop
                    327: } def
                    328:
                    329: /oxsetname {
                    330:   /arg1 set
                    331:   /arg2 set
                    332:   [(oxReq) arg2 SM_setName arg1] extension pop
                    333: } def
                    334:
                    335: /oxevalname {
                    336:   /arg1 set
                    337:   /arg2 set
                    338:   [(oxReq) arg2 SM_evalName arg1] extension pop
                    339: } def
                    340:
                    341:
                    342: /oxreset {
                    343:   /arg1 set
                    344:   [(oxReq) arg1 SM_control_reset_connection] extension pop
                    345:   [(oxGetFromControl) arg1 ] extension pop
                    346:   [(oxGet) arg1] extension message
                    347: } def
                    348:
                    349: /oxisData {
                    350:   /arg1 set
                    351:   [/pp /ff] pushVariables
                    352:   [
                    353:     /ff arg1 def
                    354:     [(oxMultiSelect) [ff] 10] extension /pp set
                    355:     pp message
                    356:     pp 0 get 1 eq {
                    357:       pp 1 get 0 get 1 eq {  %% data is in the data stream.
                    358:         /arg1 [(oxGet) ff] extension def
                    359:       } {/arg1 (no data) def  } ifelse
                    360:     }
                    361:     { /arg1 (no data) def }
                    362:     ifelse
                    363:   ] pop
                    364:   popVariables
                    365:   arg1
                    366: } def
                    367:
                    368: /oxget {
                    369:   oxisData
                    370: } def
                    371:
                    372:
                    373: /oxshutdown {
                    374:   /arg1 set
                    375:   [(fp2fclose) arg1 1 get] extension
                    376:   [(oxReq) arg1 SM_control_kill] extension
                    377:   arg1 0 (closed) put
                    378: } def
                    379:
                    380: /oxgenportfile {
                    381:   [(oxGenPortFile)] extension
                    382: }def
                    383: /oxremoveportfile {
                    384:   [(oxRemovePortFile)] extension
                    385: }def
                    386:
                    387: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    388: /enginescmd
                    389:   $ /computesp {
                    390:        /arg1 set
                    391:        [arg1 myid] arg1 message
                    392:     } def
                    393:   $
                    394: def
                    395:
                    396:
                    397: /genPairs {
                    398:   /arg1 set
                    399:   [/n /i /j] pushVariables
                    400:   [
                    401:     /n arg1 def
                    402:     /genPairs.list [  ] def
                    403:     /genPairs.i 0 def
                    404:     0 1 n 1 sub {
                    405:       /i set
                    406:       i 1 add 1 n 1 sub {
                    407:          /j set
                    408:          genPairs.list [i j] append /genPairs.list set
                    409:       } for
                    410:     } for
                    411:     /genPairs.n genPairs.list length def
                    412:   ] pop
                    413:   popVariables
                    414: } def
                    415:
                    416: /getPair {
                    417:   [/i ] pushVariables
                    418:   [
                    419:     genPairs.i genPairs.n lt {
                    420:       genPairs.list genPairs.i get /ans set
                    421:       genPairs.i 1 add /genPairs.i set
                    422:     }
                    423:     { [-1 -1] /ans set} ifelse
                    424:     /arg1 ans def
                    425:   ] pop
                    426:   popVariables
                    427:   arg1
                    428: } def
                    429:
                    430: /sumUp {
                    431:   /arg1 set
                    432:   [/ans /v /i /n] pushVariables
                    433:   [
                    434:     /v arg1 def
                    435:     /n v length def
                    436:     /ans 0 def
                    437:     0 1 n 1 sub {
                    438:       /i set
                    439:       ans v i get add /ans set
                    440:     } for
                    441:     /arg1 ans def
                    442:    ] pop
                    443:    popVariables
                    444:    arg1
                    445: } def
                    446:
                    447:
                    448: /dist {
                    449:   /dist.debug 0 def
                    450:   /result [  ] def
                    451:   enginesList {oxconnect} map /engines set
                    452:   /enginesN engines length def
                    453:   % broadcast the program.
                    454:   (ox-1.sm1) pushfile /enginescmd set  %% read a file.
                    455:   [(parse) enginescmd] extension
                    456:   engines {enginescmd oxsubmit} map
                    457:   engines { (slave-start) oxsubmit} map    %% initialize slave codes.
                    458:                                            %% send pid.
                    459:   0 1 enginesN 1 sub {
                    460:     /i set
                    461:     engines i get i oxsendcmo
                    462:     engines i get (/myid set) oxsubmit
                    463:   } for
                    464:
                    465:   master-start %% initialize master codes
                    466:   %% gbsize genPairs   %% obsolete
                    467:   /gbsize ans length def
                    468:   ans makePairs /genPairs.list set
                    469:   /genPairs.i 0 def  /genPairs.n genPairs.list length def
                    470:
                    471:
                    472:   /exhausted 0 def
                    473:   % clear the busy flag.
                    474:   /busy [1 1 enginesN { pop 0 } for ] def
                    475:   (date) system
                    476:   {{
                    477:   exhausted 0 eq {
                    478:     0 1 enginesN 1 sub {
                    479:       /i set
                    480:       busy i get 0 eq {
                    481:         getPair /p set
                    482:         p 0 get -1 eq {/exhausted 1 def exit} { } ifelse
                    483:         busy i 1 put
                    484:         engines i get p oxsendcmo
                    485:         engines i get ( computesp ) oxsubmit
                    486:         engines i get oxpopcmo1
                    487:       } { } ifelse
                    488:     } for
                    489:   } {  } ifelse
                    490:   dist.debug { (busy=) messagen busy message } { } ifelse
                    491:   busy sumUp 0 eq { result message exit error  } {  } ifelse
                    492:   [(oxMultiSelect) engines -1] extension /status set
                    493:   /datastatus status 1 get def
                    494:   dist.debug { (datastatus=) messagen datastatus message } { } ifelse
                    495:   0 1 enginesN 1 sub {
                    496:     /i set
                    497:     datastatus i get 1 eq {
                    498:       engines i get oxpopcmo2 /ans set
                    499:       busy i 0 put
                    500:       result ans append /result set
                    501:     } { } ifelse
                    502:   } for
                    503:   } loop } timer
                    504:   (date) system
                    505:   (result is in result) message
                    506:   (Number of s-pairs checked is ) messagen result length message
                    507: } def
                    508:
                    509: ox.verbose {
                    510:  (dist for experiments for distributed computing. cf. startengines) message
                    511: } { } ifelse
                    512:
                    513: /oxIsServerReady {
                    514:   /arg1 set
                    515:   [/in-isServerReady /sdata /ans] pushVariables
                    516:   [
                    517:     /sdata arg1 def
                    518:     /ans 0 def
                    519:     sdata isArray {
                    520:      sdata length 1 gt {
                    521:        sdata 0 get (client) eq { /ans 1 def } { } ifelse
                    522:      } { } ifelse
                    523:     } { } ifelse
                    524:     /arg1 ans def
                    525:   ] pop
                    526:   popVariables
                    527:   arg1
                    528: } def
                    529:
                    530:
                    531: %%%%%%%%%%%%%%%  tests
                    532: ox.verbose {
                    533:   (test10 : test to read and write ox-data and ox-command to a file) message
                    534: } {  } ifelse
                    535:
                    536: /test10 {
                    537:   [(oxCreateClientFile) (afo) (w)] extension /ccc set
                    538:   [(oxWatch) ccc] extension
                    539:   ccc (x-1). oxsendcmo
                    540:   [(oxReq) ccc SM_executeStringByLocalParser
                    541:    ( dup add message )] extension pop
                    542:   ccc (quit) oxsendcmo
                    543:
                    544:   [(oxCloseClient) ccc] extension
                    545: } def
                    546:
                    547: /test11 {
                    548:   [(oxCreateClientFile) (afo) (r)] extension /ccc set
                    549:   [(oxGet) ccc] extension ::
                    550:   [(oxGet) ccc] extension ::
                    551: } def
                    552:
                    553: ox.verbose {
                    554:  (test12 : ccc is the client. ff poly in Q<x,y,z,dx,dy,dz>  ) message
                    555: } { } ifelse
                    556: /test12 {
                    557:   [(localhost) 1300 1200] oxconnect /ccc set
                    558:   [(x,y,z) ring_of_differential_operators ( ) elimination_order 0] define_ring
                    559:   (x+y). /ff set
                    560:   /eee (hello) (error) dc def
                    561:   /eee0 eee (error) dc def
                    562:   (eee is the CMO_ERROR2 object [CMO_ERROR2 hello], eee0 is the CMO_ERROR object) message
                    563: } def
                    564:
                    565: /sm1connectr {
                    566:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    567:  [
                    568:  /pass [(oxGenPass)] extension def
                    569:  /peer [(oxGetPort) (localhost)] extension def
                    570:  /data peer 1 get toString def
                    571:  /control peer 3 get toString def
                    572:  peer message
                    573:  [oxpath.oxlog.xterm  oxpath.ox ( -reverse -ox ) oxpath.oxsm1
                    574:   ( -data ) data ( -control ) control  ( -pass ) pass
                    575:   oxpath.null
                    576:   ( &)] cat system
                    577:  [(oxCreateClient2) peer 0 pass] extension /ox.ccc set
                    578:                      %% 0 means connect from only localhost.
                    579:  (The server is binded to the variable ox.ccc) message
                    580:   ox.ccc.init
                    581:  ] pop
                    582:  popVariables
                    583: } def
                    584:
                    585: /addSlash {
                    586:   /arg1 set
                    587:   [/in-addSlash /ss /aaa /ans] pushVariables
                    588:   [
                    589:     /ss arg1 def
                    590:     ss (array) dc /aaa set
                    591:     aaa length 0 eq {
                    592:       /ans (/) def
                    593:     }{
                    594:       aaa aaa length 1 sub get  47  eq %% The last equals / ?
                    595:       {
                    596:         /ans ss def
                    597:       }{
                    598:         /ans [ss (/)] cat def
                    599:       } ifelse
                    600:     } ifelse
                    601:     /arg1 ans def
                    602:   ] pop
                    603:   arg1
                    604: } def
                    605:
                    606: /getPathNameSm1 {
                    607:   /arg1 set
                    608:   [/in-getPathNameSm1 /fname /fullname /tname] pushVariables
                    609:   [
                    610:      /fname arg1 0 get def
                    611:      %% If fullname is given, use it.
                    612:      fname (array) dc 0 get
                    613:      (/) (array) dc 0 get eq
                    614:      {  /fullname fname def
                    615:         /getPathNameSm1.LLL goto
                    616:      } { } ifelse
                    617:
                    618:      %% Else first try to find it in LOAD_SM1_PATH
                    619:      [(getenv) (LOAD_SM1_PATH)] extension /tname set
                    620:      tname isString
                    621:      {
                    622:        tname addSlash /tname set
                    623:        [(stat) [tname fname] cat] extension
                    624:        0 get isInteger  %% The file was found.
                    625:        {  /fullname [tname fname] cat def
                    626:           /getPathNameSm1.LLL goto
                    627:        } { } ifelse
                    628:      } {  } ifelse
                    629:
                    630:      %% Else try to find it in /usr/local/lib/sm1
                    631:      [(stat) [(/usr/local/lib/sm1/) fname] cat] extension
                    632:      0 get isInteger  %% The file was found.
                    633:      {  /fullname [(/usr/local/lib/sm1/) fname] cat def
                    634:         /getPathNameSm1.LLL goto
                    635:      } { } ifelse
                    636:
                    637:      %% Otherwise error.
                    638:        [(getPathNameSm1: The file ) fname
                    639:         ( could not be found )
                    640:         (neigher in LOAD_SM1_PATH=)
                    641:         [(getenv) (LOAD_SM1_PATH)] extension
                    642:         ( nor in /usr/local/lib/sm1)
                    643:        ] cat /getPathNameSm1.errorMessage set
                    644:        getPathNameSm1.errorMessage message
                    645:      ] pop popVariables getPathNameSm1.errorMessage error
                    646:
                    647:      /getPathNameSm1.LLL
                    648:      /arg1 fullname def
                    649:   ] pop
                    650:   popVariables
                    651:   arg1
                    652: } def
                    653: [(getPathNameSm1)
                    654: [([fname] getPathNameSm1 fullname)
                    655:  (string fname, fullname)
                    656:  (This command searches the fname in /usr/local/lib/sm1 and LOAD_SM1_PATH)
                    657:  (and returns the fullname.)
                    658: ]] putUsages
                    659:
                    660: /getPathNameAsir {
                    661:   /arg1 set
                    662:   [/in-getPathNameAsir /fname /fullname /tname] pushVariables
                    663:   [
                    664:      /fname arg1 0 get def
                    665:      %% If fullname is given, use it.
                    666:      fname (array) dc 0 get
                    667:      (/) (array) dc 0 get eq
                    668:      {  /fullname fname def
                    669:         /getPathNameAsir.LLL goto
                    670:      } { } ifelse
                    671:
                    672:      %% Else first try to find it in /usr/local/lib/asir
                    673:      [(stat) [(/usr/local/lib/asir/) fname] cat] extension
                    674:      0 get isInteger  %% The file was found.
                    675:      {  /fullname [(/usr/local/lib/asir/) fname] cat def
                    676:         /getPathNameAsir.LLL goto
                    677:      } { } ifelse
                    678:
                    679:      %% Else try to find it in ASIR_LIBDIR
                    680:      [(getenv) (ASIR_LIBDIR)] extension /tname set
                    681:      tname isString
                    682:      {
                    683:        [(stat) [tname (/) fname] cat] extension
                    684:        0 get isInteger  %% The file was found.
                    685:        {  /fullname [tname (/) fname] cat def
                    686:           /getPathNameAsir.LLL goto
                    687:        } { } ifelse
                    688:
                    689:      } {  } ifelse
                    690:
                    691:      %% Otherwise error.
                    692:        [ (getPathNameAsir: The file )  fname
                    693:        ( could not be found )
                    694:        (neigher in /usr/local/lib/asir nor in ASIR_LIBDIR. )
                    695:        ] cat /getPathNameAsir.errorMessage set
                    696:        getPathNameAsir.errorMessage message
                    697:      ] pop popVariables getPathNameAsir.errorMessage error
                    698:
                    699:      /getPathNameAsir.LLL
                    700:      /arg1 fullname def
                    701:   ] pop
                    702:   popVariables
                    703:   arg1
                    704: } def
                    705: [(getPathNameAsir)
                    706: [([fname] getPathNameAsir fullname)
                    707:  (string fname, fullname)
                    708:  (This command searches the fname in /usr/local/lib/asir and ASIR_LIBDIR)
                    709:  (and returns the fullname.)
                    710: ]] putUsages
                    711:
                    712:
                    713:
                    714: initializePathNamesForOx  %% This should be

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