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

1.39    ! takayama    1: %%%%%%%%%%%  $OpenXM: OpenXM/src/kan96xx/Doc/ox.sm1,v 1.38 2004/03/04 05:18:26 takayama Exp $
1.18      takayama    2:
1.23      takayama    3: /ox.sm1.myname (ox-new.sm1) def
1.1       maekawa     4:
1.23      takayama    5: [(ostype)] extension 0 get (unix) eq {
                      6:   /oxstart100
                      7:     [[(getenv) (OpenXM_HOME)] extension (/bin/ox100start )] cat
                      8:   def
                      9: } {
                     10:   /oxstart100
                     11:    [[(getenv) (OpenXM_HOME)] extension
                     12:     (/bin/ox100start.exe )] cat
                     13:   def
                     14: } ifelse
                     15: [(getenv) (OXSTART100)] extension tag 0 eq not {
                     16:   /oxstart100 [(getenv) (OXSTART100)] extension def
                     17: } {  } ifelse
1.34      takayama   18: oxstart100  message-quiet
1.1       maekawa    19:
1.23      takayama   20: /ox.sm1.loaded 1 def
                     21: /oxasir.sm1.loaded 1 def
                     22: /ox.k0.loaded 1 def
                     23: /Ox103_loaded 1 def
1.1       maekawa    24:
                     25: /ox.verbose 0   def
1.23      takayama   26: /ox.version (3.030000) def
1.1       maekawa    27: ox.version [(Version)] system_variable gt
                     28: { (This package requires the latest version of kan/sm1) message
                     29:   (Please get it from http://www.math.kobe-u.ac.jp/KAN) message
                     30:   error
                     31: } { } ifelse
1.23      takayama   32: (ox.sm1, ---OpenXM protocol module 07/20, 2003  (C) N.Takayama.) message-quiet
                     33: (           for ox_sm1, ox_asir, ox_k0 ) message-quiet
1.1       maekawa    34:
                     35: /ox.ccc load isArray
                     36: { }
                     37: { /ox.ccc [ ] def } ifelse
1.23      takayama   38: /oxsm1.ccc load isArray
                     39: { }
                     40: { /oxsm1.ccc [ ] def } ifelse
                     41: /ox.takelog 0 def
1.1       maekawa    42:
1.23      takayama   43: (@@@.Xm_noX) boundp {
                     44: }{
                     45:   /@@@.Xm_noX 0 def
                     46: } ifelse
                     47: (Xm_noX) boundp {
                     48:   /@@@.Xm_noX Xm_noX def
                     49: }{  } ifelse
                     50: /Xm_noX @@@.Xm_noX def
1.1       maekawa    51:
1.23      takayama   52: /oxNoX {
                     53:    /Xm_noX 1 def
                     54: } def
1.1       maekawa    55:
                     56:
1.23      takayama   57: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                     58: %%%   basic functions for OX-RFC 100
                     59: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.1       maekawa    60: /SM_executeStringByLocalParser 268 def
                     61: /SM_execute 268 def
                     62: /SM_popString  263  def
                     63: /SM_mathcap 264 def
                     64:
                     65: /SM_popCMO 262 def
                     66: /SM_executeFunction 269 def
1.11      takayama   67: /SM_DUMMY_sendcmo   2147418112 1 add def    %%% SM_PRIVATE+1
1.1       maekawa    68: /SM_sync_ball 281 def
                     69:
                     70: /SM_pops  265  def
                     71: /SM_setName 266  def
                     72: /SM_evalName 267  def
                     73:
                     74: /SM_setMathCap 273 def
                     75:
                     76: /SM_getsp     275  def
                     77: /SM_dupErrors 276  def
                     78:
1.36      takayama   79: /SM_pushCMOtag 277 def
1.39    ! takayama   80: /SM_executeFunctionWithOptionalArgument 282 def
1.36      takayama   81:
1.1       maekawa    82: /SM_control_kill 1024 def
                     83: /SM_control_reset_connection  1030 def
1.15      takayama   84: /SM_control_spawn_server  1027 def
1.1       maekawa    85:
                     86: /Etag_error 257 def
                     87:
                     88: [(ox)
                     89:  [
                     90:   (client aa oxpushcmo (oxsendcmo), client oxpopcmo dd, client popstring dd, client ss oxrpc)
1.23      takayama   91:  (Example: oxsm1.ccc [1 2 3] oxpushcmo oxsm1.ccc oxpopcmo /ff set  ff :: )
1.1       maekawa    92:  (  )
                     93:  (client ss oxexecutestring(oxsubmit) <<executeString>>, client ss oxexec <<executeFunction>>)
1.39    ! takayama   94:  (client ss oxexecWithOpt )
1.1       maekawa    95:
1.23      takayama   96:  (Example: oxsm1.ccc (0 1 10 { pop $Hello$ message } for) oxexecutestring )
                     97:  (Example: oxsm1.ccc (2).. oxpushcmo oxsm1.ccc (10).. oxpushcmo )
                     98:  (         oxsm1.ccc (power) oxexec  oxsm1.ccc oxpopcmo :: )
1.1       maekawa    99:  (  )
                    100:  (client str oxevalname, client str oxsetname, client num oxpops, client oxget)
                    101:  (   )
                    102:  (client oxmathcap, client oxsetmathcap, oxgenportfile, oxremoveportfile)
1.36      takayama  103:  (client oxpushcmotag)
1.1       maekawa   104:  (   )
                    105:  (client oxgetsp --- get stack pointer,  client oxgeterrors --- get all errors)
                    106:  (cleint oxisData, client oxreset, client oxshutdown)
1.27      takayama  107:  (oxhelp for this message)
                    108:  ([(oxWatch) client] extension to start a log.)
                    109:  $        ex 1.  (ox.sm1) run sm1connectr [(oxWatch) oxsm1.ccc] extension  $
                    110:  $               oxsm1.ccc ( [(cmoLispLike) 0] extension ) oxsubmit $
                    111:  $               oxsm1.ccc ( [(cmoLispLike) 1] extension ) oxsubmit $
1.1       maekawa   112:  ([(oxSerial)] extension serial-number-of-out-going-ox-packet.)
1.23      takayama  113:  (oxpopcmo1, oxpopcmo2, sm1connectr ox_launch, ox_launch_nox)
1.1       maekawa   114:  (oxNoX : set an environment to invoke oxlog without xterm and to call oxlog with >& /dev/null)
                    115:  $        ex 1.  (ox.sm1) run oxNoX sm1connectr $
1.23      takayama  116:  $        ex 2.  (ox.sm1) run oxNoX (x^2-1). fctr pmat ; $
1.27      takayama  117:  $   $
                    118:  $cf. extension-oxLog $
1.1       maekawa   119:  ]
                    120: ] putUsages
1.27      takayama  121:
                    122: [(extension-oxLog)
                    123: [
                    124: $Take the log of communication in files.$
                    125: $[(oxLog) client logfile_for_incomming_data logfile_for_outgoing_data] extension $
                    126: $Example:$
                    127: $  [(parse) (ox.sm1) pushfile] extension$
                    128: $  sm1connectr$
                    129: $  (i.t) (w) file /ii set$
                    130: $  (o.t) (w) file /oo set$
                    131: $  [(oxLog) oxsm1.ccc ii oo] extension $
                    132: $  [(oxWatch) oxsm1.ccc ] extension$
                    133: $  oxsm1.ccc 1 oxpushcmo ;$
                    134: $  oxsm1.ccc oxpopcmo ;$
                    135: $  [(oxLogStop) oxsm1.ccc] extension$
                    136: ]] putUsages
1.1       maekawa   137:
1.23      takayama  138: /oxconnect {
                    139:   /arg1 set
                    140:   [(oxCreateClient) arg1 aload pop] extension
1.1       maekawa   141: } def
                    142:
                    143: ox.verbose { oxhelp } {  } ifelse
                    144:
                    145: /oxpushcmo { oxsendcmo } def
                    146: /oxsendcmo {
                    147:   /arg1 set
                    148:   /arg2 set
                    149:   ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    150:   } {  } ifelse
                    151:   [(oxReq) arg2 SM_DUMMY_sendcmo arg1] extension pop
1.36      takayama  152: } def
                    153:
                    154: /oxpushcmotag {
                    155:   /arg2 set
                    156:   [(oxReq) arg2 SM_pushCMOtag ] extension pop
1.1       maekawa   157: } def
                    158:
                    159: /oxpopcmo {
                    160:   /arg1 set
                    161:   [(oxReq) arg1 SM_popCMO ] extension pop
                    162:   [(oxGet) arg1] extension
                    163: } def
                    164:
                    165: /oxgetsp {
                    166:   /arg1 set
                    167:   [(oxReq) arg1 SM_getsp ] extension pop
                    168:   [(oxReq) arg1 SM_popCMO ] extension pop
                    169:   [(oxGet) arg1] extension
                    170: } def
                    171:
                    172: /oxgeterrors {
                    173:   /arg1 set
                    174:   [(oxReq) arg1 SM_dupErrors ] extension pop
                    175:   [(oxReq) arg1 SM_popCMO ] extension pop
                    176:   [(oxGet) arg1] extension
                    177: } def
                    178:
                    179: /oxmathcap0 {
                    180:   /arg1 set
                    181:   [(oxReq) arg1 SM_mathcap ] extension pop
                    182: } def
                    183: /oxmathcap {
                    184:   /arg1 set
                    185:   [/in-oxmathcap /mypeer /mmm] pushVariables
                    186:   [ /mypeer arg1 def
                    187:     mypeer oxmathcap0
                    188:     mypeer oxpopcmo /mmm set
                    189:     mypeer 10 mmm put  %% set math cap.
                    190:   ] pop
                    191:   popVariables
                    192: } def
                    193: /oxsetmathcap {
                    194:   /arg1 set
                    195:   [/in-oxsetmathcap /mypeer /mymathcap] pushVariables
                    196:   [
                    197:     /mypeer arg1 def
                    198:     /mymathcap     [(cmoMathCap)] extension (array) dc def
                    199:     [(oxReq)
                    200:       mypeer   SM_setMathCap
                    201:       mymathcap
                    202:     ] extension pop
                    203:   ] pop
                    204:   popVariables
                    205: } def
1.23      takayama  206:
1.1       maekawa   207: /oxpopcmo1 {  %% ask of the transmission.
                    208:   /arg1 set
                    209:   [(oxReq) arg1 SM_popCMO ] extension pop
                    210: } def
                    211: /oxpopcmo2 {  %% wait the data.
                    212:   /arg1 set
                    213:   [(oxGet) arg1] extension
                    214: } def
                    215:
                    216:
                    217: /oxpopstring {
                    218:   /arg1 set
                    219:   [(oxReq) arg1 SM_popString ] extension pop
                    220:   [(oxGet) arg1] extension
                    221: } def
                    222:
                    223: /oxrpc {
                    224:   /arg1 set
                    225:   /arg2 set
                    226:   [/ans /ff] pushVariables
                    227:   [
                    228:    /ff arg2 def
                    229:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    230:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeString) put
                    231:    } {  } ifelse
                    232:    [(oxReq) ff SM_execute arg1] extension pop
                    233:    [(oxReq) ff SM_popCMO] extension pop
                    234:    [(oxGet) ff] extension /ans set
                    235:    ans etag Etag_error  eq {
                    236:      (Got an error object.) message
                    237:      /arg1 ans def
                    238:    }
                    239:    {  /arg1 ans def
                    240:     } ifelse
                    241:   ] pop
                    242:   popVariables
                    243:   arg1
                    244: } def
                    245:
                    246: /oxexecutestring { oxsubmit } def
                    247: /oxsubmit {
                    248:   /arg1 set
                    249:   /arg2 set
                    250:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    251:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeString) put
                    252:    } {  } ifelse
                    253:   [(oxReq) arg2 SM_execute arg1] extension pop
                    254: } def
                    255:
                    256: /oxexec {
                    257:   /arg1 set
                    258:   /arg2 set
                    259:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
                    260:                 ox.log [(oxSerial)] extension 1 add ox.mod (executeFunction) put
                    261:    } {  } ifelse
                    262:   [(oxReq) arg2 SM_executeFunction arg1] extension pop
                    263: } def
1.39    ! takayama  264: /oxexecWithOpt {
        !           265:   /arg1 set
        !           266:   /arg2 set
        !           267:    ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put
        !           268:                 ox.log [(oxSerial)] extension 1 add ox.mod
        !           269:                (executeFunctionWithOptionalArgument) put
        !           270:    } {  } ifelse
        !           271:   [(oxReq) arg2 SM_executeFunctionWithOptionalArgument arg1] extension pop
        !           272: } def
        !           273: [(oxexecWithOpt)
        !           274:  [
        !           275:   $Example: $
        !           276:   $oxsm1.ccc (/foo { message message message } def) oxsubmit ;$
        !           277:   $oxsm1.ccc (hello) oxpushcmo oxsm1.ccc 1 oxpushcmo oxsm1.ccc [[(opt) 0]] oxpushcmo ;$
        !           278:   $oxsm1.ccc (foo) oxexecWithOpt $
        !           279:  ]
        !           280: ] putUsages
1.1       maekawa   281: /oxsubmit2 {
                    282:   oxexec
                    283: } def
                    284:
                    285: /oxpops {
                    286:   /arg1 set
                    287:   /arg2 set
                    288:   [(oxReq) arg2 SM_pops arg1] extension pop
                    289: } def
                    290:
                    291: /oxsetname {
                    292:   /arg1 set
                    293:   /arg2 set
                    294:   [(oxReq) arg2 SM_setName arg1] extension pop
                    295: } def
                    296:
                    297: /oxevalname {
                    298:   /arg1 set
                    299:   /arg2 set
                    300:   [(oxReq) arg2 SM_evalName arg1] extension pop
                    301: } def
                    302:
                    303:
                    304: /oxreset {
                    305:   /arg1 set
                    306:   [(oxReq) arg1 SM_control_reset_connection] extension pop
1.13      takayama  307: %%  [(oxGetFromControl) arg1 ] extension pop
1.1       maekawa   308:   [(oxGet) arg1] extension message
                    309: } def
                    310:
                    311: /oxisData {
                    312:   /arg1 set
                    313:   [/pp /ff] pushVariables
                    314:   [
                    315:     /ff arg1 def
                    316:     [(oxMultiSelect) [ff] 10] extension /pp set
                    317:     pp message
                    318:     pp 0 get 1 eq {
                    319:       pp 1 get 0 get 1 eq {  %% data is in the data stream.
                    320:         /arg1 [(oxGet) ff] extension def
                    321:       } {/arg1 (no data) def  } ifelse
                    322:     }
                    323:     { /arg1 (no data) def }
                    324:     ifelse
                    325:   ] pop
                    326:   popVariables
                    327:   arg1
                    328: } def
                    329:
                    330: /oxget {
                    331:   oxisData
                    332: } def
                    333:
                    334:
                    335: /oxshutdown {
                    336:   /arg1 set
                    337:   [(fp2fclose) arg1 1 get] extension
                    338:   [(oxReq) arg1 SM_control_kill] extension
                    339:   arg1 0 (closed) put
                    340: } def
                    341:
                    342: /oxgenportfile {
                    343:   [(oxGenPortFile)] extension
                    344: }def
                    345: /oxremoveportfile {
                    346:   [(oxRemovePortFile)] extension
                    347: }def
                    348:
                    349: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.4       takayama  350: /ox_launch_nox {
                    351:   /@@@.ox_launch_nox  1 def
                    352:   ox_launch_aux
                    353: } def
                    354: /ox_launch {
                    355:   /@@@.ox_launch_nox  0 def
                    356:   ox_launch_aux
                    357: } def
                    358:
                    359: /ox_launch_aux {
                    360:  /arg1 set
                    361:  [/in-launch_nox /pass /peer /data /control /name /machine
                    362:   /your-peer /comm /remoteOpenXMbin /remoteServer /myhost
1.10      takayama  363:   /argNumber /aaa
1.4       takayama  364:  ] pushVariables
                    365:  [
1.10      takayama  366:    /aaa arg1 def
                    367:    /argNumber aaa length def
                    368:    /machine aaa 0 get def
                    369:    machine (localhost) eq argNumber 5 lt and {
                    370:      aaa 1 get ox_launch_localhost /your-peer set
                    371:      /LLL.end goto
                    372:    } {
                    373:      /remoteOpenXMbin aaa 1 get def
                    374:      /remoteServer aaa 2 get def
                    375:      /name aaa 3 get def
                    376:      /myhost aaa 4 get def
                    377:    } ifelse
1.4       takayama  378:
                    379:    /pass [(oxGenPass)] extension def
                    380:    /peer [(oxGetPort) myhost] extension def
                    381:    /data peer 1 get toString def
                    382:    /control peer 3 get toString def
                    383:    peer message
                    384:  [(ssh -f ) machine ( -l ) name ( ")
                    385:
                    386:    @@@.ox_launch_nox {
                    387:    } {
                    388:      remoteOpenXMbin(/oxlog )
                    389:      ( /usr/X11R6/bin/xterm -icon -e )
                    390:    } ifelse
                    391:
                    392:   ( ) remoteOpenXMbin (/ox )
                    393:   ( -reverse -ox ) remoteServer
                    394:   ( -host ) myhost
                    395:   ( -data ) data ( -control ) control  ( -pass ) pass
                    396:   oxpath.null
                    397:   ( ")
                    398:  ] cat /comm set
                    399:  (Executing the command : ) messagen comm message message
                    400:   comm system
1.5       takayama  401:  (sleep 5) system-csh
1.4       takayama  402:  [(oxCreateClient2) peer 1 pass] extension /your-peer set
1.10      takayama  403:  /LLL.end
1.4       takayama  404:  /arg1 your-peer def
                    405:  ] pop
                    406:  popVariables
                    407:  arg1
                    408: } def
                    409:
                    410: [(ox_launch)
                    411: [( [remote remote-OpenXM-bin remote-ox-server remote-login-name myhostname] )
                    412:  (  ox_launch  client )
1.10      takayama  413:  $or $
                    414:  $ [(localhost) ox-server-name] ox_launch client$
1.4       takayama  415:  (Example 1: )
                    416:  $ [(tau.math.kobe-u.ac.jp) (/home/taka/OpenXM/bin) $
                    417:  $  (/home/taka/OpenXM/src/ox_math/ox_math) (taka) (dc4.math.kobe-u.ac.jp) $
                    418:  $ ] ox_launch /@@@.oxmath set $
                    419: ]] putUsages
                    420:
                    421: [(ox_launch_nox)
                    422: [( [remote remote-OpenXM-bin remote-ox-server remote-login-name myhostname] )
                    423:  (  ox_launch_nox  client )
                    424:  (Example 1: )
                    425:  $ [(tau.math.kobe-u.ac.jp) (/home/taka/OpenXM/bin) $
                    426:  $  (/home/taka/OpenXM/src/ox_math/ox_math) (taka) (dc4.math.kobe-u.ac.jp) $
                    427:  $ ] ox_launch_nox /@@@.oxmath set $
                    428: ]] putUsages
                    429:
1.10      takayama  430: /ox_launch_localhost {
                    431:  /arg1 set
                    432:  [/in-ox_launch_localhost /pass /peer /data /control /oxserver
                    433:   /my-peer] pushVariables
                    434:  [
                    435:     /oxserver arg1 def
                    436:     /pass [(oxGenPass)] extension def
                    437:     /peer [(oxGetPort) (localhost)] extension def
                    438:     /data peer 1 get toString def
                    439:     /control peer 3 get toString def
                    440:     peer message
                    441:     [oxpath.oxlog.xterm  oxpath.ox ( -reverse -ox ) oxserver
                    442:      ( -data ) data ( -control ) control  ( -pass ) pass
                    443:       oxpath.null
                    444:      ( &)] cat system-csh
                    445:     [(oxCreateClient2) peer 0 pass] extension /my-peer set
                    446:                          %% 0 means connect from only localhost.
                    447:     /arg1 my-peer def
                    448:  ] pop
                    449:  popVariables
                    450:  arg1
1.5       takayama  451: } def
1.1       maekawa   452:
1.23      takayama  453: /oxrpc2 {
                    454:   /arg2 set
                    455:   /arg1 set
                    456:  [/in-oxrpc2 /pid /n /comm /i] pushVariables
1.12      takayama  457:  [
1.23      takayama  458:    /pid arg1 def
                    459:    /comm arg2 def
                    460:    /n comm length def
                    461:    n 1 sub -1 1 {
                    462:        /i set
                    463:        pid comm i get oxsendcmo
                    464:    } for
                    465:    pid n 1 sub oxsendcmo
                    466:    pid comm 0 get oxexec
                    467:  ] pop
                    468:  popVariables
                    469: } def
                    470:
                    471: [(oxrpc2)
                    472:   [(Remote procedure call by using oxexec)
                    473:    (client [function-name  arg1 arg2 ...] oxrpc2 )
                    474:    (cf. ox-cmo-rpc in Risa/Asir)
                    475:    (Example: )
                    476:    $ (oxasir.sm1) run (x^2-1). fctr $
                    477:    (oxasir.ccc [(igcd) (6).. (10)..] oxrpc2)
                    478:    (oxasir.ccc oxpopcmo :: )
                    479:   ]
                    480: ] putUsages
                    481:
                    482: /oxIsServerReady {
                    483:   /arg1 set
                    484:   [/in-isServerReady /sdata /ans] pushVariables
                    485:   [
                    486:     /sdata arg1 def
                    487:     /ans 0 def
                    488:     sdata isArray {
                    489:      sdata length 1 gt {
                    490:        sdata 0 get (client) eq { /ans 1 def } { } ifelse
                    491:      } { } ifelse
                    492:     } { } ifelse
                    493:     /arg1 ans def
                    494:   ] pop
                    495:   popVariables
                    496:   arg1
                    497: } def
                    498:
                    499: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    500: %%%  Functions to start server by OX-RFC-101
                    501: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    502: /sm1StartControl101 {
                    503:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    504:  [
                    505:  /pass [(oxGenPass)] extension def
                    506:  /peer [(oxGetPort1) (localhost)] extension def
                    507:  /data peer 1 get toString def
                    508:  peer message
                    509:  [(/home/nobuki/OpenXM/src/oxc/oxc)
                    510:   ( -c ) pass ( -h ) (localhost) ( -p ) data ( -x )
                    511:   oxpath.null
                    512:   ( &)] cat system-csh
                    513:
                    514:  [(oxCreateControl_RFC_101) peer 0 pass] extension /oxsm1.ccc set
                    515:                      %% 0 means connect from only localhost.
                    516:  /ox.ccc oxsm1.ccc def
1.34      takayama  517:  (The server is binded to the variable oxsm1.ccc) message-quiet
1.23      takayama  518:   oxsm1.ccc
1.12      takayama  519:  ] pop
                    520:  popVariables
1.14      takayama  521: } def
                    522:
                    523: /sm1StartEngine101 {
1.15      takayama  524:  [/in-sm1StartEngine101 /peer /data /control /engineID] pushVariables
1.14      takayama  525:  [
                    526:     /peer [(oxGetPort1) (localhost)] extension def
                    527:     /data peer 1 get def
1.15      takayama  528:
1.23      takayama  529:     oxsm1.ccc data oxpushcmo
                    530:     oxsm1.ccc (/home/nobuki/OpenXM/bin/ox_sm1) oxpushcmo
                    531:     [(oxPushCMD) oxsm1.ccc SM_control_spawn_server] extension
                    532:     oxsm1.ccc oxpopcmo /engineID set
1.15      takayama  533:     [(oxCreateEngine_RFC_101) peer 0 (Empty) engineID] extension
                    534:     /ox.ddd set
1.34      takayama  535:     (The engine is binded to the variables ox.ddd) message-quiet
1.14      takayama  536:  ] pop
                    537:  popVariables
                    538:  arg1
1.12      takayama  539: } def
1.16      takayama  540:
1.23      takayama  541: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    542: %%% Functions for OX-RFC 103
                    543: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.24      takayama  544: [(chattr) 0 /ctrlC-hook] extension
1.23      takayama  545: /ctrlC-hook {
                    546:   ox103_reset
                    547: } def
                    548: /ox103_disable {
1.24      takayama  549:   [(chattr) 0 /ctrlC-hook] extension
1.23      takayama  550:   /ctrlC-hook {  } def
                    551: } def
                    552:
                    553: [(ox103_reset)
                    554:  [(ox103_reset broadcasts the OX reset to all processes)
                    555:   (cf. ctrlC-hook, register_hander)
                    556: ]] putUsages
                    557: /ox103_reset {
                    558:   [/in-ox103_reset /L /n /i] pushVariables
                    559:   [
                    560:      /L [(oxGetClientList)] extension def
                    561:     (In ox103_reset...) message
1.28      takayama  562:     (killall in oxshell...) message [(killall)] oxshell pop
1.23      takayama  563:      /n L length def
                    564:      0 1 n 1 sub {
                    565:        /i set
                    566:        L i get oxreset
                    567:      } for
                    568:      (Done) message
                    569:   ] pop
                    570:   popVariables
                    571: } def
                    572:
                    573: %%%%%%%
                    574: /ox103_asir_init {
                    575:   /arg1 set
                    576:   [/ttt] pushVariables
                    577:   [
                    578:     /ttt arg1 def
                    579:     %% ttt oxsetmathcap     ttt oxmathcap  %% It is done in asir.init
                    580:     %% Do nothing special for now.
                    581:   ] pop
                    582:   popVariables
                    583: } def
                    584: /ox103_sm1_init {
                    585:   /arg1 set
                    586:   [/ttt] pushVariables
                    587:   [
                    588:     /ttt arg1 def
                    589:     ttt oxsetmathcap
                    590:     ttt oxmathcap
                    591:     ttt ([(parse) (oxrfc103.sm1) pushfile] extension ) oxsubmit
                    592:   ] pop
                    593:   popVariables
                    594: } def
                    595: %%%
                    596:
                    597: /Xm_rfc103_shared [ ] def
                    598:
                    599: [(ox103_set_shared_variable)
                    600:  [(value name 2 ox103_set_shared_variable)
                    601:   (It broadcasts the <<value>> of a shared variable <<name>>)
                    602:   (to all processes.)
                    603:   (cf. Xm_rfc103_shared, )
                    604:   $Example:  (2).. (hoge) 2 ox103_set_shared_variable$
                    605: ]] putUsages
                    606: /ox103_set_shared_variable {
                    607:   /arg0 set  %% Dummy to be called by rpc2. Number of args
                    608:   /arg1 set  %% Name
                    609:   /arg2 set  %% Value,  [Name Value] not [Value Name]
                    610:   [/in-ox103_set_shared_variable /Name /Value
                    611:    /Found /N /i  /L
                    612:   ] pushVariables
                    613:   [
                    614:     /Name arg1 def
                    615:     /Value arg2 def
                    616:     Value message
                    617:     /Found 0 def
                    618:     /N  Xm_rfc103_shared length def
                    619:     0 1 N 1 sub {
                    620:       /i set
                    621:       Xm_rfc103_shared i get 0 get
                    622:       Name eq {
                    623:         Xm_rfc103_shared i [Name Value] put
                    624:         /Found 1 def
                    625:         exit
                    626:       } {  } ifelse
                    627:     } for
                    628:     Found 1 eq { }
                    629:     {
                    630:       Xm_rfc103_shared [Name Value] append
                    631:       /Xm_rfc103_shared set
                    632:     } ifelse
                    633:     /L [(oxGetClientList)] extension def
                    634:     0 1 L length 1 sub {
                    635:       /i set
                    636:       L i get [(ox103_set_shared_variable) Name Value] oxrpc2
                    637:     } for
                    638:
                    639:     (ox103_set_shared_variable: Xm_rfc103_shared=) message
                    640:     Xm_rfc103_shared message
                    641:     %% [(parse) [(/) Name ( ) Value toString ( def )] cat] extension
                    642:     %% Add $ $ when Value is a string.
                    643:
                    644:     /arg1 [Name Value] def
                    645:   ] pop
                    646:   popVariables
                    647:   arg1
                    648: } def
                    649:
                    650: /ox103_test {
                    651:   (x^2-1). fctr
                    652:   oxasir.ccc ( sm1_start(); ) oxexecutestring
                    653:   sm1connectr
                    654: } def
                    655:
                    656: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    657: %%%%%%%%   Starting ox_sm1.
                    658: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    659: /sm1connectr {
                    660:  [/in-sm1connectr /pass /peer /data /control ] pushVariables
                    661:  [
1.25      takayama  662:    [(getServerEnv) (bin/ox_sm1)] extension tag 0 eq {
                    663:      (Server bin/ox_sm1 is not found.) error
                    664:    }{ } ifelse
1.23      takayama  665:  /pass [(oxGenPass)] extension def
                    666:  /peer [(oxGetPort) (localhost)] extension def
                    667:  /data peer 1 get toString def
                    668:  /control peer 3 get toString def
1.35      takayama  669:  peer message-quiet
1.23      takayama  670:  [
                    671:   oxstart100
1.34      takayama  672:   @@@.quiet { ( -quiet ) } {  } ifelse
1.23      takayama  673:   Xm_noX { ( -nox ) } {  } ifelse
                    674:   ( -oxserver bin/ox_sm1 -e ) ( -reverse )
                    675:   ( -data ) data ( -control ) control  ( -pass ) pass
                    676:   ( )] cat execve
                    677:  [(oxCreateClient2) peer 0 pass] extension /oxsm1.ccc set
                    678:                      %% 0 means connect from only localhost.
1.34      takayama  679:  (The server is binded to the variable oxsm1.ccc) message-quiet
1.23      takayama  680:   /ox.ccc oxsm1.ccc def
                    681:   oxsm1.ccc.init
                    682:   oxsm1.ccc
                    683:  ] pop
                    684:  popVariables
                    685: } def
                    686:
                    687: /oxsm1.ccc.init {
                    688:    oxsm1.ccc ( [(oxPrintMessage) 0] extension pop ) oxsubmit
                    689:    Xm_noX { oxsm1.ccc ( /@@@.Xm_noX 1 def ) oxsubmit }
                    690:           { oxsm1.ccc ( /@@@.Xm_noX 0 def ) oxsubmit } ifelse
                    691:    (Ox103_loaded) boundp
                    692:    { oxsm1.ccc ox103_sm1_init }
                    693:    { }  ifelse
                    694: } def
                    695:
                    696: /sm1connectr-ssh {
                    697: %% It has not yet implemented.
                    698:  /arg1 set
                    699:  [/in-sm1connectr /pass /peer /data /control /name /machine
                    700:   /your-peer /comm
                    701:  ] pushVariables
                    702:  [
                    703:  /machine arg1 0 get def
                    704:  /name arg1 1 get def
                    705:
                    706:  /pass [(oxGenPass)] extension def
                    707:  /peer [(oxGetPort) myhostname-ssh] extension def
                    708:  /data peer 1 get toString def
                    709:  /control peer 3 get toString def
1.35      takayama  710:  peer message-quiet
1.23      takayama  711:  [(ssh -f ) machine ( -l ) name ( ")
                    712:   oxpath.oxlog.xterm-ssh  oxpath.ox-ssh ( -reverse -ox ) oxpath.oxsm1-ssh
                    713:   ( -host ) myhostname-ssh
                    714:   ( -data ) data ( -control ) control  ( -pass ) pass
                    715:   oxpath.null
                    716:   ( ")
                    717:  ] cat /comm set
                    718:  (Executing the command : ) messagen comm message message
                    719:   comm system
                    720:  (sleep 5) system-csh
                    721:  [(oxCreateClient2) peer 1 pass] extension /your-peer set
                    722:  /arg1 your-peer def
                    723:  ] pop
                    724:  popVariables
                    725:  arg1
                    726: } def
                    727: [(sm1connectr-ssh)
                    728: [([hostname login-name] sm1connectr-ssh client)
                    729:  (Starting oxpath.oxsm1-ssh by the launcher oxpath.ox-ssh on the "hostname".)
                    730:  (cf. oxNoX )
                    731:  (Set the following varialbes to appropriate values:)
                    732:  (oxpath.oxlog.xterm-ssh  oxpath.oxsm1-ssh  oxpath.ox-ssh myhostname-ssh )
                    733:  $Example 1: $
                    734:  $  *** Path names on the remote machine dc1.math.kobe-u.ac.jp $
                    735:  $    /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def $
                    736:  $    /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def $
                    737:  $    /oxpath.ox-ssh    (/home/taka/OpenXM/bin/ox) def $
                    738:  $  *** The machine name on which you are running sm1. $
                    739:  $    /myhostname-ssh   (yama.math.kobe-u.ac.jp) def $
                    740:  $         [(dc1.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set  $
                    741:  $Example 2: $
                    742:  $  *** Path names on the remote machine dc2.math.kobe-u.ac.jp $
                    743:  $  *** We will not use X11 debug windows. $
                    744:  $    oxNoX $
                    745:  $    /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog ) def $
                    746:  $    /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def $
                    747:  $    /oxpath.ox-ssh    (/home/taka/OpenXM/bin/ox) def $
                    748:  $  *** the machine name on which you are running sm1. $
                    749:  $    /myhostname-ssh   (dc1.math.kobe-u.ac.jp) def $
                    750:  $         [(dc2.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set  $
                    751: ]] putUsages
1.26      takayama  752:
                    753: %%% ntl
                    754: /ntlconnectr {
                    755:  [/in-ntlconnectr /pass /peer /data /control ] pushVariables
                    756:  [
                    757:    [(getServerEnv) (bin/ox_ntl)] extension tag 0 eq {
                    758:      (Server bin/ox_ntl is not found.) error
                    759:    }{ } ifelse
                    760:  /pass [(oxGenPass)] extension def
                    761:  /peer [(oxGetPort) (localhost)] extension def
                    762:  /data peer 1 get toString def
                    763:  /control peer 3 get toString def
1.35      takayama  764:  peer message-quiet
1.26      takayama  765:  [
                    766:   oxstart100
                    767:   Xm_noX { ( -nox ) } {  } ifelse
                    768:   ( -oxserver bin/ox_ntl -e ) ( -reverse )
                    769:   ( -data ) data ( -control ) control  ( -pass ) pass
                    770:   ( )] cat execve
                    771:  [(oxCreateClient2) peer 0 pass] extension /oxntl.ccc set
                    772:                      %% 0 means connect from only localhost.
1.34      takayama  773:  (The server is binded to the variable oxntl.ccc) message-quiet
1.26      takayama  774: %  oxntl.ccc.init
                    775:    oxntl.ccc
                    776:  ] pop
                    777:  popVariables
                    778: } def
1.23      takayama  779:
                    780: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    781: %%%   Aux functions for ox_asir
                    782: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    783: /ox_asirConnectMethod { asirconnectr /oxasir.ccc set } def
                    784: /oxasir.loadmethod 1 def   %% "..." oxsendcmo (load) ox...
                    785: /oxasir.verbose 0   def
                    786: /oxasir.ccc load isArray
                    787: { }
                    788: { /oxasir.ccc [ ] def } ifelse
                    789: /loadAsirFile {
                    790:   /arg1 set
                    791:   [/in-loadAsirFile /peer /fname] pushVariables
                    792:   [
                    793:     /peer arg1 0 get def
                    794:     /fname arg1 1 get def
                    795:     oxasir.loadmethod  {
                    796:       peer  fname oxsendcmo peer 1 oxsendcmo
                    797:       peer (load) oxexec
1.16      takayama  798:     }{
1.23      takayama  799:       peer  [$load("$ fname $");$] cat oxsubmit
1.16      takayama  800:     }ifelse
1.23      takayama  801:   ] pop
                    802:   popVariables
                    803: } def
                    804: [(loadAsirFile)
                    805: [$[client fname] loadAsirFile   (ox_asir function)$
                    806:  $Load a file into the client$
                    807: ]] putUsages
                    808:
                    809: /set_oxasir.rr_path {
                    810:  [(ostype)] extension  0 get (windows) eq {
                    811:   [(getenv) (OSTYPE)] extension tag 0 eq {
                    812:      /oxasir.rr.name  (oxasir-win.rr) def
                    813:   }{
                    814:    [(getenv) (OSTYPE)] extension (cygwin) eq {
                    815:      /oxasir.rr.name  (oxasir.asir) def
                    816:    }{
                    817:      /oxasir.rr.name  (oxasir-win.rr) def
                    818:    } ifelse
                    819:   } ifelse
                    820:  }{
                    821:      /oxasir.rr.name  (oxasir.asir) def
                    822:  } ifelse
                    823: } def
                    824: set_oxasir.rr_path
                    825: /oxasirpath.asirlib [[(getenv) (OpenXM_HOME)] extension
                    826:                       (/lib/sm1/) oxasir.rr.name] cat  def
                    827: oxasir.verbose {
                    828:  oxasirpath.asirlib message
                    829: } { } ifelse
                    830:
                    831: %% Note.  oxasir.asir is under OpenXM/src/kan96xx/lib/
                    832: %%        oxasir-win.asir is generated under OpenXM/misc/packages/Windows
                    833: %%       They are installed under $OpenXM_HOME/lib/sm1
                    834: %%       Todo:  ox_asir has to understand /cygdrive/c/... on windows-native.
                    835: %%              Since ox_asir is generated by cygwin, it will be OK.
                    836: /asir.init {
                    837:  %% gr and primdec are loaded by .asirrc
                    838:  /asir.init.peer set
                    839:  [(ostype)] extension  0 get (windows) eq {
                    840:   [(getenv) (OSTYPE)] extension tag 0 eq {
                    841:     [asir.init.peer (oxasir-win.rr)] oxasirParseFile
                    842:   }{
                    843:    [(getenv) (OSTYPE)] extension (cygwin) eq {
                    844:      [asir.init.peer  oxasirpath.asirlib] loadAsirFile
                    845:    }{
                    846:      [asir.init.peer  (oxasir-win.rr)] oxasirParseFile
                    847:    } ifelse
                    848:   } ifelse
                    849:  }{
                    850:    [asir.init.peer  oxasirpath.asirlib] loadAsirFile
                    851:  } ifelse
                    852:  asir.init.peer oxmathcap
                    853:  asir.init.peer oxsetmathcap
                    854:  Xm_noX {
                    855:    asir.init.peer (Xm_noX=1;) oxsubmit
                    856:  }{
                    857:    asir.init.peer (Xm_noX=0;) oxsubmit
                    858:  } ifelse
                    859:  (Ox103_loaded) boundp
                    860:  {
                    861:    asir.init.peer ox103_asir_init
                    862:  }{  } ifelse
                    863: } def
                    864:
                    865: [(asir)
                    866:  [(pid [asir-command, asir-arg1, asir-arg2, ...] asir result  (ox_asir function))
                    867:   (Call open asir server. You need to install ox_asir on your system)
                    868:   (to use this function. cf. primadec, fctr, asirconnect2, asirconnectr.)
                    869:   (If you interrupted the computation by typing ctrl-C, type in )
                    870:   (   oxasir.ccc oxreset  ; )
                    871:   (to interrupt the ox_asir server.)
1.38      takayama  872:   (NOTE: all asir-args must belong to the same ring. cf.oxasir.changeRing. )
1.23      takayama  873:   (Example: oxasir.ccc [(fctr) (x^10-1).] asir )
                    874:   (  )
                    875:   (This function requires plugins cmo, socket and ox_asir server. cf. oxasir)
1.38      takayama  876:   (See, http://www.math.kobe-u.ac.jp/Asir on asir)
1.23      takayama  877:  ]
                    878: ] putUsages
                    879:
                    880: /asir {
                    881:   /arg2 set
                    882:   /arg1 set
                    883:   [/pid  /asir-comm /comm /n /i /rr] pushVariables
                    884:   [(CurrentRingp)] pushEnv
                    885:   [
                    886:      /pid arg1 def
                    887:      /asir-comm arg2 def
                    888:      pid tag 6 eq {  } { (Invalid pid. See asir.) error } ifelse
                    889:      pid 0 get (client) eq { } { (Invalid pid. See asir.) error } ifelse
                    890:      asir-comm tag 6 eq {  } { (Invalid argument asir-comm. See asir) error } ifelse
                    891:
                    892:     [ %% Change the current ring if necessary to send a correct OxVlist.
                    893:       asir-comm oxasir.changeRing
                    894:     ] pop
                    895:     %%% Setting OxVlist to tell asir a way to change dist-poly <==> poly.
                    896:     (OxVlist=) getVlist2 toString (;) 3 cat_n /comm set
                    897:      %% comm message
                    898:      pid comm oxsubmit
                    899:      pid (print(OxVlist);) oxsubmit
                    900:
                    901:
                    902:      /n asir-comm length def
                    903:      n 1 sub -1 1 {
                    904:        /i set
                    905:        pid asir-comm i get oxsendcmo
                    906:        pid 1 oxsendcmo pid (ox_dtop) oxexec
                    907:      } for
                    908:      pid n 1 sub oxsendcmo
                    909:      pid asir-comm 0 get oxexec
                    910:
                    911:      pid 1 oxsendcmo pid (ox_ptod) oxexec
                    912:      pid oxpopcmo /arg1 set
                    913:
1.16      takayama  914:
1.23      takayama  915:   ] pop
                    916:   popEnv
                    917:   popVariables
                    918:   arg1
                    919: } def
                    920:
                    921: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    922: %%% Mathematical functions for asir
                    923: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                    924: /oxasir.changeRing {
1.38      takayama  925:   /oxasir.changeRing.rr.prev 0 def
                    926:   oxasir.changeRing2
                    927: } def
                    928: /oxasir.changeRing2 {
1.23      takayama  929:   /arg1 set
1.38      takayama  930:   [/in-oxasir.changeRing2 /f /rr ] pushVariables
1.23      takayama  931:   [
                    932:      /f arg1 def
                    933:      f isArray {
1.38      takayama  934:        f {oxasir.changeRing2} map
1.23      takayama  935:      }{
                    936:        f isPolynomial {
                    937:          f (0). eq { }
1.38      takayama  938:          { f (ring) dc /rr set [(CurrentRingp) rr] system_variable
                    939:            oxasir.changeRing.rr.prev tag 1 eq { }
                    940:            {
                    941:               oxasir.changeRing.rr.prev rr eq  {  }
                    942:               {  (asir : arguments must belong to the same ring.) error } ifelse
                    943:            } ifelse
                    944:            /oxasir.changeRing.rr.prev rr def
                    945:          } ifelse
1.23      takayama  946:        } {  } ifelse
                    947:      } ifelse
                    948:   ] pop
                    949:   popVariables
                    950: } def
                    951:
                    952: /fctr {
                    953:   /arg1 set
                    954:   [/f /comm /vv] pushVariables
                    955:   [(CurrentRingp)] pushEnv
                    956:   [
                    957:     /f arg1 def
                    958:     oxasir.ccc [ ] eq {
                    959:        (Starting ox_asir server.) message
                    960:         ox_asirConnectMethod
                    961:     } {  } ifelse
                    962:
                    963:     f isPolynomial not {
                    964:       /vv f 1 get def
                    965:       vv isArray { /vv vv from_records  def } {  } ifelse
                    966:       /f f 0 get def
                    967:       [vv ring_of_polynomials 0] define_ring
                    968:       f . /f set
1.16      takayama  969:     }{ } ifelse
1.23      takayama  970:     oxasir.ccc [(fctr) f] asir /arg1 set
1.16      takayama  971:   ] pop
1.23      takayama  972:   popEnv
1.16      takayama  973:   popVariables
                    974:   arg1
                    975: } def
                    976:
1.23      takayama  977: [(fctr)
                    978:  [(You need to install ox_asir server to use this function. (ox_asir function))
                    979:   (f fctr g)
                    980:   (poly f; array g;)
                    981:   ([f v] fctr g ;  string f, string or array of string v)
                    982:   (This function factors the polynomial f over Q.)
                    983:   ( )
                    984:   (Example 1:  [(x^10-y^10) (x,y)] fctr ::)
                    985:   (Example 2:  (x^10-1). fctr ::)
                    986:   ( )
                    987:   (If you interrupted the computation by typing ctrl-C, type in )
                    988:   (   oxasir.ccc oxreset  ; )
                    989:   (to interrupt the ox_asir server.)
                    990:   (  )
                    991:   (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
                    992: ]] putUsages
                    993:
                    994:
                    995: [(primadec)
                    996:  [(You need to install ox_asir server to use this function. (ox_asir function))
                    997:   ([ ii ] primadec [[q1 p1] [q2 p2] ... ] )
                    998:   ( array of poly ii; array of poly q1, p1, q2, p2 ...;)
                    999:   ( q1, q2, ... are primary components of the primary ideal decomposition)
                   1000:   ( of the ideal generated by << ii >>.)
                   1001:   (  )
                   1002:   ([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
                   1003:   ( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
                   1004:   (<< v >> is an array of independent variables.)
                   1005:   (  )
                   1006:   ([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
                   1007:   ( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
                   1008:   ( v  is a string of variables separated by , )
                   1009:   (  )
                   1010:   (Example:  [(x,y) ring_of_polynomials 0] define_ring)
                   1011:   (          [ [(x^2-1). (x y).] ] primadec pmat ;)
                   1012:   (  )
                   1013:   (Example:  [ [(x^2-1) (x y)] [(x) (y)]] primadec pmat ;)
                   1014:   (  )
                   1015:   (If you interrupted the computation by typing ctrl-C, type in )
                   1016:   (   oxasir.ccc oxreset  ; )
                   1017:   (to interrupt the ox_asir server.)
                   1018:   (  )
                   1019:   (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
                   1020: ]] putUsages
                   1021:
                   1022: /primadec {
                   1023:   /arg1 set
                   1024:   [/in-primadec /aa /f  /comm /vvv /r /setarg] pushVariables
                   1025:   [(CurrentRingp)] pushEnv
                   1026:   [
                   1027:     /aa arg1 def
                   1028:     aa isArray { } { (<<array>> primadec) error } ifelse
                   1029:     /setarg 0 def
                   1030:     oxasir.ccc [ ] eq {
                   1031:        (Starting ox_asir server.) message
                   1032:         ox_asirConnectMethod
                   1033:     } {  } ifelse
                   1034:     aa { tag } map /typev set
                   1035:     typev [ ArrayP ] eq
                   1036:     {  /f aa 0 get def
                   1037:        f 0 get (ring) dc /r set
                   1038:        [(CurrentRingp) r] system_variable
                   1039:        /vvv getVariableNames def
                   1040:        /setarg 1 def
                   1041:     } { } ifelse
                   1042:     typev [ArrayP StringP] eq
                   1043:     {  /f aa 0 get def
                   1044:        /vvv [ aa 1 get to_records pop ] def
                   1045:        /setarg 1 def
                   1046:     } { } ifelse
                   1047:     typev [ArrayP ArrayP] eq
                   1048:     {  /f aa 0 get def
                   1049:        /vvv aa 1 get {toString} map def
                   1050:        /setarg 1 def
                   1051:     } { } ifelse
                   1052:     setarg { } { (primadec : Argument mismatch) error } ifelse
                   1053:
                   1054:     f 0 get isPolynomial {
                   1055:       /r f 0 get (ring) dc def
                   1056:       /vvv vvv { r ,, } map def
                   1057:     }
                   1058:     {
                   1059:       [vvv from_records ring_of_polynomials 0] define_ring
                   1060:       f { toString . } map /f set
                   1061:       vvv { . } map /vvv set
                   1062:     } ifelse
                   1063:     oxasir.ccc [(primadec) f vvv] asir /arg1 set
1.16      takayama 1064:   ] pop
1.23      takayama 1065:   popEnv
1.16      takayama 1066:   popVariables
                   1067:   arg1
                   1068: } def
1.20      takayama 1069:
1.23      takayama 1070:
                   1071: /getVlist2 {
                   1072:   [/n  /i ] pushVariables
1.20      takayama 1073:   [
1.23      takayama 1074:     /n [(N)] system_variable def
                   1075:     [
                   1076:       0 1 n 1 sub { /i set (x) i (dollar) dc 2 cat_n } for
                   1077:       0 1 n 1 sub { /i set (d) i (dollar) dc 2 cat_n } for
                   1078:     ] /arg1 set
1.20      takayama 1079:   ] pop
                   1080:   popVariables
                   1081:   arg1
                   1082: } def
                   1083:
1.23      takayama 1084: %%%%%%%%%%%%%%%%%%%
                   1085: /getVlist {
                   1086:   [/n  /i ] pushVariables
                   1087:   [
                   1088:     /n [(N)] system_variable def
                   1089:     [
                   1090:       0 1 n 1 sub { /i set [(x) (var) i] system_variable } for
                   1091:       0 1 n 1 sub { /i set [(D) (var) i] system_variable } for
                   1092:     ] /arg1 set
                   1093:   ] pop
                   1094:   popVariables
                   1095:   arg1
                   1096: } def
1.20      takayama 1097:
1.23      takayama 1098: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   1099: [(chattr) 0 /findIntegralRoots] extension pop
                   1100: /findIntegralRoots {
                   1101:   /arg1 set
                   1102:   [/in-findIntegralRoots /pp ] pushVariables
1.20      takayama 1103:   [
1.23      takayama 1104:     /pp arg1 def
                   1105:     oxasir.ccc [ ] eq {
                   1106:       (Starting ox_asir server.) message
                   1107:        ox_asirConnectMethod
                   1108:     } {  } ifelse
                   1109:     oxasir.ccc oxIsServerReady
                   1110:     { pp findIntegralRoots.oxasir /arg1 set}
                   1111:     { pp findIntegralRoots.slow /arg1 set} ifelse
1.20      takayama 1112:   ] pop
                   1113:   popVariables
                   1114:   arg1
                   1115: } def
1.23      takayama 1116:
                   1117: /findIntegralRoots.oxasir {
1.20      takayama 1118:   /arg1 set
1.23      takayama 1119:   [/in-findIntegralRoots /f /r /g /aa /rlist] pushVariables
                   1120:   [(CurrentRingp) (KanGBmessage)] pushEnv
1.20      takayama 1121:   [
1.23      takayama 1122:     /f arg1 def
                   1123:     [(s) ring_of_polynomials 0] define_ring
                   1124:     f toString . /f set
                   1125:     f fctr rest /g set
                   1126:     g {
                   1127:          0 get /aa set
                   1128:          aa (s). degree 1 eq {
                   1129:            aa (s). coeff 1 get /aa set
                   1130:            aa length 1 eq { 0 }
                   1131:            {  aa 0 get (1). eq {
                   1132:                  0 << aa 1 get (integer) dc >> sub
                   1133:               } { } ifelse
                   1134:            } ifelse
                   1135:          }{ } ifelse
                   1136:      } map
                   1137:     /rlist set
                   1138:     %% rlist ::
                   1139:     [-1000000] rlist join shell rest /arg1 set
1.20      takayama 1140:   ] pop
1.23      takayama 1141:   popEnv
1.20      takayama 1142:   popVariables
                   1143:   arg1
1.21      takayama 1144: } def
                   1145:
1.23      takayama 1146: %%%%%%%%%%%%%   From gbhg3/Int/intw.sm1
                   1147: %% This function needs solv1.asir and ox_asir.
                   1148: %% See solv1.asir for the usage of this function.
                   1149: /rationalRoots2 {
                   1150:   /arg1 set
                   1151:   [/in-rationalRoots2 /aa /f  /comm /vvv /r /setarg
                   1152:    /w /ans
                   1153:   ] pushVariables
                   1154:   [(CurrentRingp) (KanGBmessage)] pushEnv
1.21      takayama 1155:   [
1.23      takayama 1156:     /aa arg1 def
                   1157:     aa isArray { } { (<<array>> rationalRoots2) error } ifelse
                   1158:     /setarg 0 def
                   1159:     oxasir.ccc [ ] eq {
                   1160:        (Starting ox_asir server.) message
                   1161:         ox_asirConnectMethod
                   1162:     } {  } ifelse
                   1163:     aa { tag } map /typev set
                   1164:     typev [ArrayP StringP ArrayP] eq
                   1165:     {  /f aa 0 get def
                   1166:        /vvv [ aa 1 get to_records pop ] def
                   1167:        /w aa 2 get def
                   1168:        /setarg 1 def
                   1169:     } { } ifelse
                   1170:     typev [ArrayP ArrayP ArrayP] eq
                   1171:     {  /f aa 0 get def
                   1172:        /vvv aa 1 get {toString} map def
                   1173:        /setarg 1 def
                   1174:        /w aa 2 get def
                   1175:     } { } ifelse
                   1176:     setarg { } { (rationalRoots2 : Argument mismatch) error } ifelse
                   1177:
                   1178:
                   1179:     [vvv from_records ring_of_polynomials 0] define_ring
                   1180:     f { toString . } map /f set
                   1181:     vvv { . } map /vvv set
                   1182:     w { toString . } map /w set
                   1183:
                   1184:     (rationalRoots2 -- f = ) messagen f messagen
                   1185:     ( , vvv= ) messagen vvv messagen ( , w = ) messagen w message
                   1186:
                   1187:     vvv length 1 eq w 0 get (1). eq and
                   1188:     {
                   1189:        [(KanGBmessage) 0] system_variable
                   1190:        [f] groebner_sugar 0 get /f set
                   1191:        vvv 0 get toString (s) eq {
                   1192:        }{ [[vvv 0 get toString (s)] from_records ring_of_polynomials 0] define_ring}
                   1193:        ifelse
                   1194:        f 0 get toString . [[vvv 0 get toString . (s).]] replace
                   1195:        findIntegralRoots /ans set
                   1196:     }
                   1197:     {
                   1198:       oxasir.ccc [(sm1_rationalRoots2) f vvv w] asir
                   1199:       {(integer) dc} map
                   1200:       /ans set
1.21      takayama 1201:     } ifelse
1.23      takayama 1202:
1.21      takayama 1203:     /arg1 ans def
                   1204:   ] pop
1.23      takayama 1205:   popEnv
                   1206:   popVariables
                   1207:   arg1
                   1208: } def
                   1209: [(rationalRoots2)
                   1210: [(rationalRoots2  (ox_asir function) called from intw.sm1 to analyze integral)
                   1211:  (roots.)
                   1212: ]] putUsages
                   1213:
                   1214: /ptozp_subst  {
                   1215:   /arg1 set
                   1216:   [/in-ptozp_subst /aaa /fff /xxx /vvv /vlist] pushVariables
                   1217:   [(CurrentRingp)] pushEnv
                   1218:   [
                   1219:      /aaa arg1 def
                   1220:      /fff aaa 0 get def
                   1221:      /xxx aaa 1 get toString def
                   1222:      /vvv aaa 2 get {toString ..} map def
                   1223:      aaa length 4 eq {
                   1224:        /vlist aaa 3 get def
                   1225:      } {
                   1226:        /vlist 0 def
                   1227:      } ifelse
                   1228:      oxasir.ccc [ ] eq {
                   1229:         (Starting ox_asir server.) message
                   1230:         ox_asirConnectMethod
                   1231:      } {  } ifelse
                   1232:      fff isPolynomial {
                   1233:        fff (ring) dc ring_def
                   1234:        fff toString /fff set
                   1235:      }
                   1236:      { vlist isInteger { (ptozp_subst: need variable names.) error } {  } ifelse
                   1237:        [vlist ring_of_differential_operators 0] define_ring
                   1238:      } ifelse
                   1239:      oxasir.ccc [(sm1_ptozp_subst) fff . xxx .  vvv] asir
                   1240:      /arg1 set
                   1241:   ] pop
                   1242:   popEnv
                   1243:   popVariables
                   1244:   arg1
                   1245: } def
                   1246:
                   1247: [(ptozp_subst)
                   1248:  [$[f  s  [p q] v] ptozp_subst g   (ox_asir function)$
                   1249:   $It returns ptozp(subst(f,s,p/q))$
                   1250:   $Example 1:  [ (x Dx - s) (s) [2 3] (x,s)] ptozp_subst $
                   1251:   $   ===>     3 x Dx - 2 $
                   1252: ]] putUsages
                   1253:
                   1254: /reduceByAsir  {
                   1255:   /arg1 set
                   1256:   [/in-reduceByAsir /aaa /fff /fff0 /fff1 /vlist] pushVariables
                   1257:   [(CurrentRingp)] pushEnv
                   1258:   [
                   1259:      /aaa arg1 def
                   1260:      /fff aaa 0 get def
                   1261:      aaa length 2 eq {
                   1262:        /vlist aaa 1 get def
                   1263:      } {
                   1264:        /vlist 0 def
                   1265:      } ifelse
                   1266:      oxasir.ccc [ ] eq {
                   1267:         (Starting ox_asir server.) message
                   1268:         ox_asirConnectMethod
                   1269:      } {  } ifelse
                   1270:      fff isArray {
                   1271:        fff length 2 eq {
                   1272:          /fff0 fff 0 get def
                   1273:          /fff1 fff 1 get def
                   1274:        } {
                   1275:          ([ << [f g] >> vlist ] reduceByAsir ) error
                   1276:        } ifelse
                   1277:      } {
                   1278:        ([ << [f g] >> vlist ] reduceByAsir ) error
                   1279:      } ifelse
                   1280:      fff0 isPolynomial fff1 isPolynomial and {
                   1281:        fff0 (ring) dc ring_def
                   1282:        fff0 toString . /fff0 set
                   1283:        fff1 (ring) dc ring_def
                   1284:        fff1 toString . /fff1 set
                   1285:      }
                   1286:      { vlist isInteger { (reduceByAsir: need variable names.) error } {  } ifelse
                   1287:        [vlist ring_of_differential_operators 0] define_ring
                   1288:        fff0 toString . /fff0 set
                   1289:        fff1 toString . /fff1 set
                   1290:      } ifelse
                   1291:      oxasir.ccc [(sm1_rat2plist2) [fff0 fff1]] asir
                   1292:      /arg1 set
                   1293:   ] pop
                   1294:   popEnv
                   1295:   popVariables
                   1296:   arg1
                   1297: } def
                   1298:
                   1299: [(reduceByAsir)
                   1300: [$ [[f g] v] reduceByAsir [ff gg]   (ox_asir function)$
                   1301:  $ [[f g]] reduceByAsir [ff gg]  $
                   1302:  $Example 1: [[(2 x -2) (4 x - 8)] (x)] reduceByAsir $
                   1303:  (Note that there may be a gcd that is more than 1 among the coefficients.)
                   1304: ]] putUsages
                   1305:
                   1306: %% File should be preprocessed by OpenXM/misc/packages/Windows/oxpp
                   1307: %% and ./oxapp --removeSharp
                   1308: [(oxasirParseFile)
                   1309: [$[peer filename] oxasirParseFile $
                   1310:  $File should be preprocessed by OpenXM/misc/packages/Windows/oxpp$
                   1311:  $and ./oxapp --removeSharp $
                   1312: ]] putUsages
                   1313:
                   1314: /oxasirParseFile {
                   1315:   /arg1 set
                   1316:   [/in-oxasirParseFile /fname /sss] pushVariables
                   1317:   [
                   1318:     /fname arg1 1 get def
                   1319:     /peer  arg1 0 get def
                   1320:     fname pushfile /sss set
                   1321:     peer
                   1322:     [$if (1) { ; $ sss (}$)] cat
                   1323:     oxsubmit
                   1324:   ] pop
                   1325:   popVariables
                   1326: } def
                   1327:
                   1328: [(bfct)
                   1329:  [
                   1330:   ( f bfct b )
                   1331:   ( poly f; poly b)
                   1332:   ([f v] bfct b)
                   1333:   ( string f )
                   1334:   ( b is the global b-function of the polynomial f.)
                   1335:   (Example: [(x^3-y^2) (x,y)] bfct fctr :: )
                   1336:   (Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.)
                   1337:   (  )
                   1338:   (If you interrupted the computation by typing ctrl-C, type in )
                   1339:   (   oxasir.ccc oxreset  ; )
                   1340:   (to interrupt the ox_asir server.)
                   1341:   (  )
                   1342:   (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
                   1343:   (You need to install ox_asir server to use this function. (ox_asir function))
                   1344: ]] putUsages
                   1345:
                   1346: /bfct {
                   1347:   /arg1 set
                   1348:   [/in-bfct /f /comm /vv] pushVariables
                   1349:   [(CurrentRingp)] pushEnv
                   1350:   [
                   1351:     /f arg1 def
                   1352:     oxasir.ccc [ ] eq {
                   1353:        (Starting ox_asir server.) message
                   1354:         ox_asirConnectMethod
                   1355:     } {  } ifelse
                   1356:
                   1357:     f isPolynomial not {
                   1358:       /vv f 1 get def
                   1359:       vv isArray { /vv vv from_records  def } {  } ifelse
                   1360:       /f f 0 get def
                   1361:       [vv ring_of_polynomials 0] define_ring
                   1362:       f . /f set
                   1363:     }{ } ifelse
                   1364:     oxasir.ccc [(oxasir_bfct) f] asir /f set
                   1365:     [(s) ring_of_polynomials 0] define_ring
                   1366:     f . /f set
                   1367:     [f f fctr] /arg1 set
                   1368:   ] pop
                   1369:   popEnv
1.21      takayama 1370:   popVariables
                   1371:   arg1
                   1372: } def
                   1373:
1.23      takayama 1374: [(generic_bfct)
                   1375:  [
                   1376:   ( [ii weight] generic_bfct b )
                   1377:   ( list of poly ii; list weight)
                   1378:   ([ii weight variables] generic_bfct b)
                   1379:   ( list of string ii; list weight; list variables)
                   1380:   ( b is the general b-function of the ideal ii w.r.t the weight.)
                   1381:   (Example: [[(Dx^2) (Dy^2)] [(x) -1 (Dx) 1] [(x) (y)]] generic_bfct :: )
                   1382:   (Notion: Saito, Sturmfels, Takayama, Grobner deformations of hypergeometric differential equaitons)
                   1383:   (Algorithm:  M.Noro, Mathematical Software, icms 2002, pp.147--157.)
                   1384:   (  )
                   1385:   (If you interrupted the computation by typing ctrl-C, type in )
                   1386:   (   oxasir.ccc oxreset  ; )
                   1387:   (to interrupt the ox_asir server.)
                   1388:   (  )
                   1389:   (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
                   1390:   (You need to install ox_asir server to use this function. (ox_asir function))
                   1391: ]] putUsages
                   1392:
                   1393: /generic_bfct {
                   1394:   /arg1 set
                   1395:   [/in-generic_bfct /aa /f  /comm /vvv0 /n /vvv /ddd /r /setarg
                   1396:    /bf /wt ] pushVariables
                   1397:   [(CurrentRingp)] pushEnv
                   1398:   [
                   1399:     /aa arg1 def
                   1400:     aa isArray { } { (<<array>> generic_bfct) error } ifelse
                   1401:     /setarg 0 def
                   1402:     aa { tag } map /typev set
                   1403:     typev [ ArrayP ArrayP] eq
                   1404:     {  /f aa 0 get def
                   1405:        f 0 tag PolyP { } {  (The first argument must be a list of differential operators. Give the third variable: a list of variables) error } ifelse
                   1406:        f 0 get (ring) dc /r set
                   1407:        [(CurrentRingp) r] system_variable
                   1408:        /wt aa 1 get def
                   1409:
                   1410:        /vvv0 getVariableNames def
                   1411:        /n [(N)] system_variable def
                   1412:        /vvv vvv0 n carN rest reverse rest reverse def
                   1413:        /ddd vvv0 reverse n carN reverse
                   1414:                    rest reverse rest reverse def
                   1415:
                   1416:        /wt wt generic_bfct.aux1 def
                   1417:
                   1418:        /setarg 1 def
                   1419:     } { } ifelse
                   1420:     typev [ArrayP ArrayP StringP] eq
                   1421:     {  /f aa 0 get def
                   1422:        /vvv [ aa 2 get to_records pop ] def
                   1423:        /wt aa 1 get def
                   1424:
                   1425:        /n vvv length def
                   1426:        /ddd vvv { (D) 2 1 roll 2 cat_n } map def
                   1427:
                   1428:        /setarg 1 def
                   1429:     } { } ifelse
                   1430:     typev [ArrayP ArrayP ArrayP] eq
                   1431:     {  /f aa 0 get def
                   1432:        /vvv aa 2 get {toString} map def
                   1433:        /wt aa 1 get def
                   1434:
                   1435:        /n vvv length def
                   1436:        /ddd vvv { (D) 2 1 roll 2 cat_n } map def
                   1437:
                   1438:        /setarg 1 def
                   1439:     } { } ifelse
                   1440:     setarg { } { (generic_bfct : Argument mismatch) error } ifelse
                   1441:
                   1442:     f 0 get isPolynomial {
                   1443:
                   1444:     }
                   1445:     {
                   1446:       [vvv from_records ring_of_differential_operators 0] define_ring
                   1447:       f { toString . } map /f set
                   1448:       vvv { . } map /vvv set
                   1449:       ddd { . } map /ddd set
1.33      takayama 1450:       /wt [vvv ddd wt] generic_bfct.aux1 def
1.23      takayama 1451:     } ifelse
                   1452:     [f vvv ddd wt] message
                   1453:
                   1454:     oxasir.ccc [ ] eq {
                   1455:        (Starting ox_asir server.) message
                   1456:         ox_asirConnectMethod
                   1457:     } {  } ifelse
                   1458:
                   1459:     oxasir.ccc [(oxasir_generic_bfct) f vvv ddd wt] asir /bf set
                   1460:     [(s) ring_of_polynomials 0] define_ring
                   1461:     bf . /bf set
                   1462:     [bf bf fctr] /arg1 set
                   1463:   ] pop
                   1464:   popEnv
                   1465:   popVariables
                   1466:   arg1
1.20      takayama 1467: } def
1.22      takayama 1468:
1.23      takayama 1469: /generic_bfct.aux1 {
1.22      takayama 1470:   /arg1 set
1.33      takayama 1471:   [/in-generic_bfct.aux1 /ii /jj /wt /wtx /wtd /vv /dd /n]  pushVariables
1.23      takayama 1472:   [
1.33      takayama 1473:     arg1 2 get /wt set
                   1474:     arg1 0 get /vv set
                   1475:     arg1 1 get /dd set
                   1476:     /wtx [ 0 1 vv length 1 sub { pop (0).. } for ] def
                   1477:     /n wt length def
                   1478:     0 2 n 1 sub {
                   1479:       /ii set
                   1480:       0 1 vv length 1 sub {
                   1481:         /jj set
                   1482:         wt ii get toString dd jj get toString eq {
                   1483:           wtx jj << wt ii 1 add get >> put
                   1484:         } {  } ifelse
                   1485:       } for
                   1486:     } for
                   1487:
                   1488:     wtx /wt set
1.23      takayama 1489:     wt { dup tag IntegerP eq { (universalNumber) dc } {    } ifelse } map /wt set
                   1490:     wt /arg1 set
                   1491:   ] pop
                   1492:   popVariables
                   1493:   arg1
                   1494: } def
1.30      takayama 1495: /verbose.wgr  1 def
                   1496: %[ ff vv ww ] asir.wgb [gb  init]
                   1497: /asir.wgr {
                   1498:   /arg1 set
                   1499:   [/in-asir.gb  /ff /vv /ww /vvx /vvd /avv /comm /wvec /i] pushVariables
                   1500:   [
                   1501:     /ff arg1 0 get def
                   1502:     /vv arg1 1 get def
                   1503:     /ww arg1 2 get def
                   1504:
                   1505:     oxasir.ccc [ ] eq {
                   1506:        (Starting ox_asir server.) message
                   1507:         ox_asirConnectMethod
                   1508:     } {  } ifelse
                   1509:
                   1510:     vv isArray {
                   1511:       vv from_records /vv set
                   1512:     } {  } ifelse
                   1513:     oxasir.ccc [(dp_gr_print) (2)..] asir
                   1514:     [vv to_records pop] /vvx set
                   1515:     vvx { toString (D) 2 1 roll 2 cat_n  } map /vvd set
                   1516:
                   1517:     [
                   1518:       0 1 vvx length 1 sub {
                   1519:         /i set
                   1520:        vvx i get
                   1521:        0 ww i get  sub
                   1522:        vvd i get
                   1523:        ww i get
                   1524:       } for
                   1525:      ] /wvec set
                   1526:
                   1527:     [vv ring_of_differential_operators
                   1528:      [wvec] weight_vector
                   1529:     0] define_ring
                   1530:
1.38      takayama 1531:     ff { toString . dehomogenize homogenize } map /ff set
1.30      takayama 1532:     vvx { . } map /vvx set %%ex  [x,y]
                   1533:     vvd { . } map /vvd set %%ex  [Dx,Dy]
                   1534:     vvx vvd join [(h).] join /avv set
                   1535:
                   1536:     verbose.wgr {
                   1537:     (Asir (-w,w) gb in the Weyl algebra) message
                   1538:     (wvec=) messagen wvec message
                   1539:     (ff=) messagen ff message
                   1540:     (avv=) messagen avv message
                   1541:     } {  } ifelse
                   1542:
1.32      takayama 1543:     [$dp_weyl_set_weight(newvect($  ww length toString $,$
1.30      takayama 1544:      ww toString $));$ ] cat /comm set
                   1545:
                   1546:     verbose.wgr {
                   1547:       comm message
                   1548:     } { } ifelse
                   1549:
                   1550:     oxasir.ccc comm oxsubmit ;
                   1551:
                   1552:     oxasir.ccc [(dp_weyl_gr_main) ff avv (0).. (1).. (11)..] asir
                   1553:     /arg1 set
                   1554:   ] pop
                   1555:   popVariables
                   1556:   arg1
                   1557: } def
                   1558: [(asir.wgr)
                   1559: [([ ff vv ww ] asir.wgr g)
1.31      takayama 1560:  $It computes the (-ww,ww) Grobner basis of ff in the homogenized Weyl algebra.$
1.30      takayama 1561:  (Homogenization is automatically done.)
                   1562:  $Example 1: $
                   1563:  $ [ [(x*Dx+y*Dy-1)  (Dx*Dy)] $
                   1564:  $   (x,y)  $
                   1565:  $   [1 2 ] ] asir.wgr   $
                   1566: ]] putUsages
                   1567:
1.23      takayama 1568: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   1569: %%% functions to start ox_asir
                   1570: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   1571: /asirconnectr {
                   1572:  [/in-asirconnectr /pass /peer /data /control /oxasir] pushVariables
                   1573:  [
1.25      takayama 1574:    [(getServerEnv) (bin/ox_asir)] extension tag 0 eq {
                   1575:      (Server bin/ox_sm1 is not found.) error
                   1576:    }{ } ifelse
                   1577:
1.23      takayama 1578:  /pass [(oxGenPass)] extension def
                   1579:  /peer [(oxGetPort) (localhost)] extension def
                   1580:  /data peer 1 get toString def
                   1581:  /control peer 3 get toString def
1.35      takayama 1582:  peer message-quiet
1.22      takayama 1583:  [
1.23      takayama 1584:   oxstart100
1.34      takayama 1585:   @@@.quiet { ( -quiet ) } {  } ifelse
1.23      takayama 1586:   Xm_noX { ( -nox ) } {  } ifelse
                   1587:   ( -oxserver bin/ox_asir -e ) ( -reverse )
                   1588:   ( -data ) data ( -control ) control  ( -pass ) pass
                   1589:   ( )] cat execve
                   1590:  [(oxCreateClient2) peer 0 pass] extension /oxasir.ccc set
                   1591:                      %% 0 means connect from only localhost.
                   1592:  oxasir.ccc asir.init
                   1593:  /arg1 oxasir.ccc def
1.22      takayama 1594:  ] pop
                   1595:  popVariables
1.23      takayama 1596:  arg1
1.22      takayama 1597: } def
                   1598:
1.23      takayama 1599: [(asirconnectr)
                   1600:  [(asirconnectr server  (ox_asir function))
                   1601:   (array server;)
                   1602:   (Example: asirconnectr /oxasir.ccc set)
                   1603: ]] putUsages
                   1604:
                   1605: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   1606: %%% functions to start ox_k0
                   1607: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
                   1608: /oxk0.ccc load isArray
                   1609: { }
                   1610: { /oxk0.ccc [ ] def } ifelse
1.22      takayama 1611:
1.23      takayama 1612: /ox.k0.init {
                   1613:   % oxk0.ccc ( Print("Hello!"); ) oxsubmit
                   1614:   Xm_noX { oxk0.ccc (Xm_noX=true;) oxsubmit }
                   1615:          { oxk0.ccc (Xm_noX=false;) oxsubmit } ifelse
                   1616: } def
1.1       maekawa  1617:
1.23      takayama 1618: /k0connectr {
                   1619:  [/in-k0connectr /pass /peer /data /control ] pushVariables
                   1620:  [
1.25      takayama 1621:    [(getServerEnv) (bin/ox_k0)] extension tag 0 eq {
                   1622:      (Server bin/ox_sm1 is not found.) error
                   1623:    }{ } ifelse
                   1624:
1.23      takayama 1625:  /pass [(oxGenPass)] extension def
                   1626:  /peer [(oxGetPort) (localhost)] extension def
                   1627:  /data peer 1 get toString def
                   1628:  /control peer 3 get toString def
1.35      takayama 1629:  peer message-quiet
1.23      takayama 1630:  [
                   1631:   oxstart100
                   1632:   Xm_noX { ( -nox ) } {  } ifelse
                   1633:   ( -oxserver bin/ox_k0 -e ) ( -reverse )
                   1634:   ( -data ) data ( -control ) control  ( -pass ) pass
                   1635:   ( )] cat execve
                   1636:  [(oxCreateClient2) peer 0 pass] extension /oxk0.ccc set
                   1637:                      %% 0 means connect from only localhost.
1.34      takayama 1638:  (The server is binded to the variable oxk0.ccc) message-quiet
1.23      takayama 1639:   ox.k0.init
                   1640:   /arg1 oxk0.ccc def
                   1641:  ] pop
                   1642:  popVariables
                   1643:  arg1
                   1644: } def
1.29      takayama 1645: /@@@polymake.k0.ccc [ ] def
                   1646:
1.37      takayama 1647: /ox_server_mode {
                   1648:   /:: {   } def  % do nothing
                   1649:
                   1650: } def

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