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