Annotation of OpenXM/src/kan96xx/Doc/ox.sm1, Revision 1.24
1.24 ! takayama 1: %%%%%%%%%%% $OpenXM: OpenXM/src/kan96xx/Doc/ox.sm1,v 1.23 2003/07/21 07:31:59 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: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1.24 ! takayama 495: [(chattr) 0 /ctrlC-hook] extension
1.23 takayama 496: /ctrlC-hook {
497: ox103_reset
498: } def
499: /ox103_disable {
1.24 ! takayama 500: [(chattr) 0 /ctrlC-hook] extension
1.23 takayama 501: /ctrlC-hook { } def
502: } def
503:
504: [(ox103_reset)
505: [(ox103_reset broadcasts the OX reset to all processes)
506: (cf. ctrlC-hook, register_hander)
507: ]] putUsages
508: /ox103_reset {
509: [/in-ox103_reset /L /n /i] pushVariables
510: [
511: /L [(oxGetClientList)] extension def
512: (In ox103_reset...) message
513: /n L length def
514: 0 1 n 1 sub {
515: /i set
516: L i get oxreset
517: } for
518: (Done) message
519: ] pop
520: popVariables
521: } def
522:
523: %%%%%%%
524: /ox103_asir_init {
525: /arg1 set
526: [/ttt] pushVariables
527: [
528: /ttt arg1 def
529: %% ttt oxsetmathcap ttt oxmathcap %% It is done in asir.init
530: %% Do nothing special for now.
531: ] pop
532: popVariables
533: } def
534: /ox103_sm1_init {
535: /arg1 set
536: [/ttt] pushVariables
537: [
538: /ttt arg1 def
539: ttt oxsetmathcap
540: ttt oxmathcap
541: ttt ([(parse) (oxrfc103.sm1) pushfile] extension ) oxsubmit
542: ] pop
543: popVariables
544: } def
545: %%%
546:
547: /Xm_rfc103_shared [ ] def
548:
549: [(ox103_set_shared_variable)
550: [(value name 2 ox103_set_shared_variable)
551: (It broadcasts the <<value>> of a shared variable <<name>>)
552: (to all processes.)
553: (cf. Xm_rfc103_shared, )
554: $Example: (2).. (hoge) 2 ox103_set_shared_variable$
555: ]] putUsages
556: /ox103_set_shared_variable {
557: /arg0 set %% Dummy to be called by rpc2. Number of args
558: /arg1 set %% Name
559: /arg2 set %% Value, [Name Value] not [Value Name]
560: [/in-ox103_set_shared_variable /Name /Value
561: /Found /N /i /L
562: ] pushVariables
563: [
564: /Name arg1 def
565: /Value arg2 def
566: Value message
567: /Found 0 def
568: /N Xm_rfc103_shared length def
569: 0 1 N 1 sub {
570: /i set
571: Xm_rfc103_shared i get 0 get
572: Name eq {
573: Xm_rfc103_shared i [Name Value] put
574: /Found 1 def
575: exit
576: } { } ifelse
577: } for
578: Found 1 eq { }
579: {
580: Xm_rfc103_shared [Name Value] append
581: /Xm_rfc103_shared set
582: } ifelse
583: /L [(oxGetClientList)] extension def
584: 0 1 L length 1 sub {
585: /i set
586: L i get [(ox103_set_shared_variable) Name Value] oxrpc2
587: } for
588:
589: (ox103_set_shared_variable: Xm_rfc103_shared=) message
590: Xm_rfc103_shared message
591: %% [(parse) [(/) Name ( ) Value toString ( def )] cat] extension
592: %% Add $ $ when Value is a string.
593:
594: /arg1 [Name Value] def
595: ] pop
596: popVariables
597: arg1
598: } def
599:
600: /ox103_test {
601: (x^2-1). fctr
602: oxasir.ccc ( sm1_start(); ) oxexecutestring
603: sm1connectr
604: } def
605:
606: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
607: %%%%%%%% Starting ox_sm1.
608: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609: /sm1connectr {
610: [/in-sm1connectr /pass /peer /data /control ] pushVariables
611: [
612: /pass [(oxGenPass)] extension def
613: /peer [(oxGetPort) (localhost)] extension def
614: /data peer 1 get toString def
615: /control peer 3 get toString def
616: peer message
617: [
618: oxstart100
619: Xm_noX { ( -nox ) } { } ifelse
620: ( -oxserver bin/ox_sm1 -e ) ( -reverse )
621: ( -data ) data ( -control ) control ( -pass ) pass
622: ( )] cat execve
623: [(oxCreateClient2) peer 0 pass] extension /oxsm1.ccc set
624: %% 0 means connect from only localhost.
625: (The server is binded to the variable oxsm1.ccc) message
626: /ox.ccc oxsm1.ccc def
627: oxsm1.ccc.init
628: oxsm1.ccc
629: ] pop
630: popVariables
631: } def
632:
633: /oxsm1.ccc.init {
634: oxsm1.ccc ( [(oxPrintMessage) 0] extension pop ) oxsubmit
635: Xm_noX { oxsm1.ccc ( /@@@.Xm_noX 1 def ) oxsubmit }
636: { oxsm1.ccc ( /@@@.Xm_noX 0 def ) oxsubmit } ifelse
637: (Ox103_loaded) boundp
638: { oxsm1.ccc ox103_sm1_init }
639: { } ifelse
640: } def
641:
642: /sm1connectr-ssh {
643: %% It has not yet implemented.
644: /arg1 set
645: [/in-sm1connectr /pass /peer /data /control /name /machine
646: /your-peer /comm
647: ] pushVariables
648: [
649: /machine arg1 0 get def
650: /name arg1 1 get def
651:
652: /pass [(oxGenPass)] extension def
653: /peer [(oxGetPort) myhostname-ssh] extension def
654: /data peer 1 get toString def
655: /control peer 3 get toString def
656: peer message
657: [(ssh -f ) machine ( -l ) name ( ")
658: oxpath.oxlog.xterm-ssh oxpath.ox-ssh ( -reverse -ox ) oxpath.oxsm1-ssh
659: ( -host ) myhostname-ssh
660: ( -data ) data ( -control ) control ( -pass ) pass
661: oxpath.null
662: ( ")
663: ] cat /comm set
664: (Executing the command : ) messagen comm message message
665: comm system
666: (sleep 5) system-csh
667: [(oxCreateClient2) peer 1 pass] extension /your-peer set
668: /arg1 your-peer def
669: ] pop
670: popVariables
671: arg1
672: } def
673: [(sm1connectr-ssh)
674: [([hostname login-name] sm1connectr-ssh client)
675: (Starting oxpath.oxsm1-ssh by the launcher oxpath.ox-ssh on the "hostname".)
676: (cf. oxNoX )
677: (Set the following varialbes to appropriate values:)
678: (oxpath.oxlog.xterm-ssh oxpath.oxsm1-ssh oxpath.ox-ssh myhostname-ssh )
679: $Example 1: $
680: $ *** Path names on the remote machine dc1.math.kobe-u.ac.jp $
681: $ /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def $
682: $ /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def $
683: $ /oxpath.ox-ssh (/home/taka/OpenXM/bin/ox) def $
684: $ *** The machine name on which you are running sm1. $
685: $ /myhostname-ssh (yama.math.kobe-u.ac.jp) def $
686: $ [(dc1.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set $
687: $Example 2: $
688: $ *** Path names on the remote machine dc2.math.kobe-u.ac.jp $
689: $ *** We will not use X11 debug windows. $
690: $ oxNoX $
691: $ /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog ) def $
692: $ /oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def $
693: $ /oxpath.ox-ssh (/home/taka/OpenXM/bin/ox) def $
694: $ *** the machine name on which you are running sm1. $
695: $ /myhostname-ssh (dc1.math.kobe-u.ac.jp) def $
696: $ [(dc2.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set $
697: ]] putUsages
698:
699: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
700: %%% Aux functions for ox_asir
701: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
702: /ox_asirConnectMethod { asirconnectr /oxasir.ccc set } def
703: /oxasir.loadmethod 1 def %% "..." oxsendcmo (load) ox...
704: /oxasir.verbose 0 def
705: /oxasir.ccc load isArray
706: { }
707: { /oxasir.ccc [ ] def } ifelse
708: /loadAsirFile {
709: /arg1 set
710: [/in-loadAsirFile /peer /fname] pushVariables
711: [
712: /peer arg1 0 get def
713: /fname arg1 1 get def
714: oxasir.loadmethod {
715: peer fname oxsendcmo peer 1 oxsendcmo
716: peer (load) oxexec
1.16 takayama 717: }{
1.23 takayama 718: peer [$load("$ fname $");$] cat oxsubmit
1.16 takayama 719: }ifelse
1.23 takayama 720: ] pop
721: popVariables
722: } def
723: [(loadAsirFile)
724: [$[client fname] loadAsirFile (ox_asir function)$
725: $Load a file into the client$
726: ]] putUsages
727:
728: /set_oxasir.rr_path {
729: [(ostype)] extension 0 get (windows) eq {
730: [(getenv) (OSTYPE)] extension tag 0 eq {
731: /oxasir.rr.name (oxasir-win.rr) def
732: }{
733: [(getenv) (OSTYPE)] extension (cygwin) eq {
734: /oxasir.rr.name (oxasir.asir) def
735: }{
736: /oxasir.rr.name (oxasir-win.rr) def
737: } ifelse
738: } ifelse
739: }{
740: /oxasir.rr.name (oxasir.asir) def
741: } ifelse
742: } def
743: set_oxasir.rr_path
744: /oxasirpath.asirlib [[(getenv) (OpenXM_HOME)] extension
745: (/lib/sm1/) oxasir.rr.name] cat def
746: oxasir.verbose {
747: oxasirpath.asirlib message
748: } { } ifelse
749:
750: %% Note. oxasir.asir is under OpenXM/src/kan96xx/lib/
751: %% oxasir-win.asir is generated under OpenXM/misc/packages/Windows
752: %% They are installed under $OpenXM_HOME/lib/sm1
753: %% Todo: ox_asir has to understand /cygdrive/c/... on windows-native.
754: %% Since ox_asir is generated by cygwin, it will be OK.
755: /asir.init {
756: %% gr and primdec are loaded by .asirrc
757: /asir.init.peer set
758: [(ostype)] extension 0 get (windows) eq {
759: [(getenv) (OSTYPE)] extension tag 0 eq {
760: [asir.init.peer (oxasir-win.rr)] oxasirParseFile
761: }{
762: [(getenv) (OSTYPE)] extension (cygwin) eq {
763: [asir.init.peer oxasirpath.asirlib] loadAsirFile
764: }{
765: [asir.init.peer (oxasir-win.rr)] oxasirParseFile
766: } ifelse
767: } ifelse
768: }{
769: [asir.init.peer oxasirpath.asirlib] loadAsirFile
770: } ifelse
771: asir.init.peer oxmathcap
772: asir.init.peer oxsetmathcap
773: Xm_noX {
774: asir.init.peer (Xm_noX=1;) oxsubmit
775: }{
776: asir.init.peer (Xm_noX=0;) oxsubmit
777: } ifelse
778: (Ox103_loaded) boundp
779: {
780: asir.init.peer ox103_asir_init
781: }{ } ifelse
782: } def
783:
784: [(asir)
785: [(pid [asir-command, asir-arg1, asir-arg2, ...] asir result (ox_asir function))
786: (Call open asir server. You need to install ox_asir on your system)
787: (to use this function. cf. primadec, fctr, asirconnect2, asirconnectr.)
788: (If you interrupted the computation by typing ctrl-C, type in )
789: ( oxasir.ccc oxreset ; )
790: (to interrupt the ox_asir server.)
791: (Example: oxasir.ccc [(fctr) (x^10-1).] asir )
792: ( )
793: (This function requires plugins cmo, socket and ox_asir server. cf. oxasir)
794: (See, ftp://endeavor.fujitsu.co.jp/pub/isis/asir on asir)
795: ]
796: ] putUsages
797:
798: /asir {
799: /arg2 set
800: /arg1 set
801: [/pid /asir-comm /comm /n /i /rr] pushVariables
802: [(CurrentRingp)] pushEnv
803: [
804: /pid arg1 def
805: /asir-comm arg2 def
806: pid tag 6 eq { } { (Invalid pid. See asir.) error } ifelse
807: pid 0 get (client) eq { } { (Invalid pid. See asir.) error } ifelse
808: asir-comm tag 6 eq { } { (Invalid argument asir-comm. See asir) error } ifelse
809:
810: [ %% Change the current ring if necessary to send a correct OxVlist.
811: asir-comm oxasir.changeRing
812: ] pop
813: %%% Setting OxVlist to tell asir a way to change dist-poly <==> poly.
814: (OxVlist=) getVlist2 toString (;) 3 cat_n /comm set
815: %% comm message
816: pid comm oxsubmit
817: pid (print(OxVlist);) oxsubmit
818:
819:
820: /n asir-comm length def
821: n 1 sub -1 1 {
822: /i set
823: pid asir-comm i get oxsendcmo
824: pid 1 oxsendcmo pid (ox_dtop) oxexec
825: } for
826: pid n 1 sub oxsendcmo
827: pid asir-comm 0 get oxexec
828:
829: pid 1 oxsendcmo pid (ox_ptod) oxexec
830: pid oxpopcmo /arg1 set
831:
1.16 takayama 832:
1.23 takayama 833: ] pop
834: popEnv
835: popVariables
836: arg1
837: } def
838:
839: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
840: %%% Mathematical functions for asir
841: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
842: /oxasir.changeRing {
843: /arg1 set
844: [/in-oxasir.changeRing /f /rr] pushVariables
845: [
846: /f arg1 def
847: f isArray {
848: f {oxasir.changeRing} map
849: }{
850: f isPolynomial {
851: f (0). eq { }
852: { f (ring) dc /rr set [(CurrentRingp) rr] system_variable } ifelse
853: } { } ifelse
854: } ifelse
855: ] pop
856: popVariables
857: } def
858:
859: /fctr {
860: /arg1 set
861: [/f /comm /vv] pushVariables
862: [(CurrentRingp)] pushEnv
863: [
864: /f arg1 def
865: oxasir.ccc [ ] eq {
866: (Starting ox_asir server.) message
867: ox_asirConnectMethod
868: } { } ifelse
869:
870: f isPolynomial not {
871: /vv f 1 get def
872: vv isArray { /vv vv from_records def } { } ifelse
873: /f f 0 get def
874: [vv ring_of_polynomials 0] define_ring
875: f . /f set
1.16 takayama 876: }{ } ifelse
1.23 takayama 877: oxasir.ccc [(fctr) f] asir /arg1 set
1.16 takayama 878: ] pop
1.23 takayama 879: popEnv
1.16 takayama 880: popVariables
881: arg1
882: } def
883:
1.23 takayama 884: [(fctr)
885: [(You need to install ox_asir server to use this function. (ox_asir function))
886: (f fctr g)
887: (poly f; array g;)
888: ([f v] fctr g ; string f, string or array of string v)
889: (This function factors the polynomial f over Q.)
890: ( )
891: (Example 1: [(x^10-y^10) (x,y)] fctr ::)
892: (Example 2: (x^10-1). fctr ::)
893: ( )
894: (If you interrupted the computation by typing ctrl-C, type in )
895: ( oxasir.ccc oxreset ; )
896: (to interrupt the ox_asir server.)
897: ( )
898: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
899: ]] putUsages
900:
901:
902: [(primadec)
903: [(You need to install ox_asir server to use this function. (ox_asir function))
904: ([ ii ] primadec [[q1 p1] [q2 p2] ... ] )
905: ( array of poly ii; array of poly q1, p1, q2, p2 ...;)
906: ( q1, q2, ... are primary components of the primary ideal decomposition)
907: ( of the ideal generated by << ii >>.)
908: ( )
909: ([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
910: ( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
911: (<< v >> is an array of independent variables.)
912: ( )
913: ([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
914: ( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
915: ( v is a string of variables separated by , )
916: ( )
917: (Example: [(x,y) ring_of_polynomials 0] define_ring)
918: ( [ [(x^2-1). (x y).] ] primadec pmat ;)
919: ( )
920: (Example: [ [(x^2-1) (x y)] [(x) (y)]] primadec pmat ;)
921: ( )
922: (If you interrupted the computation by typing ctrl-C, type in )
923: ( oxasir.ccc oxreset ; )
924: (to interrupt the ox_asir server.)
925: ( )
926: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
927: ]] putUsages
928:
929: /primadec {
930: /arg1 set
931: [/in-primadec /aa /f /comm /vvv /r /setarg] pushVariables
932: [(CurrentRingp)] pushEnv
933: [
934: /aa arg1 def
935: aa isArray { } { (<<array>> primadec) error } ifelse
936: /setarg 0 def
937: oxasir.ccc [ ] eq {
938: (Starting ox_asir server.) message
939: ox_asirConnectMethod
940: } { } ifelse
941: aa { tag } map /typev set
942: typev [ ArrayP ] eq
943: { /f aa 0 get def
944: f 0 get (ring) dc /r set
945: [(CurrentRingp) r] system_variable
946: /vvv getVariableNames def
947: /setarg 1 def
948: } { } ifelse
949: typev [ArrayP StringP] eq
950: { /f aa 0 get def
951: /vvv [ aa 1 get to_records pop ] def
952: /setarg 1 def
953: } { } ifelse
954: typev [ArrayP ArrayP] eq
955: { /f aa 0 get def
956: /vvv aa 1 get {toString} map def
957: /setarg 1 def
958: } { } ifelse
959: setarg { } { (primadec : Argument mismatch) error } ifelse
960:
961: f 0 get isPolynomial {
962: /r f 0 get (ring) dc def
963: /vvv vvv { r ,, } map def
964: }
965: {
966: [vvv from_records ring_of_polynomials 0] define_ring
967: f { toString . } map /f set
968: vvv { . } map /vvv set
969: } ifelse
970: oxasir.ccc [(primadec) f vvv] asir /arg1 set
1.16 takayama 971: ] pop
1.23 takayama 972: popEnv
1.16 takayama 973: popVariables
974: arg1
975: } def
1.20 takayama 976:
1.23 takayama 977:
978: /getVlist2 {
979: [/n /i ] pushVariables
1.20 takayama 980: [
1.23 takayama 981: /n [(N)] system_variable def
982: [
983: 0 1 n 1 sub { /i set (x) i (dollar) dc 2 cat_n } for
984: 0 1 n 1 sub { /i set (d) i (dollar) dc 2 cat_n } for
985: ] /arg1 set
1.20 takayama 986: ] pop
987: popVariables
988: arg1
989: } def
990:
1.23 takayama 991: %%%%%%%%%%%%%%%%%%%
992: /getVlist {
993: [/n /i ] pushVariables
994: [
995: /n [(N)] system_variable def
996: [
997: 0 1 n 1 sub { /i set [(x) (var) i] system_variable } for
998: 0 1 n 1 sub { /i set [(D) (var) i] system_variable } for
999: ] /arg1 set
1000: ] pop
1001: popVariables
1002: arg1
1003: } def
1.20 takayama 1004:
1.23 takayama 1005: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1006: [(chattr) 0 /findIntegralRoots] extension pop
1007: /findIntegralRoots {
1008: /arg1 set
1009: [/in-findIntegralRoots /pp ] pushVariables
1.20 takayama 1010: [
1.23 takayama 1011: /pp arg1 def
1012: oxasir.ccc [ ] eq {
1013: (Starting ox_asir server.) message
1014: ox_asirConnectMethod
1015: } { } ifelse
1016: oxasir.ccc oxIsServerReady
1017: { pp findIntegralRoots.oxasir /arg1 set}
1018: { pp findIntegralRoots.slow /arg1 set} ifelse
1.20 takayama 1019: ] pop
1020: popVariables
1021: arg1
1022: } def
1.23 takayama 1023:
1024: /findIntegralRoots.oxasir {
1.20 takayama 1025: /arg1 set
1.23 takayama 1026: [/in-findIntegralRoots /f /r /g /aa /rlist] pushVariables
1027: [(CurrentRingp) (KanGBmessage)] pushEnv
1.20 takayama 1028: [
1.23 takayama 1029: /f arg1 def
1030: [(s) ring_of_polynomials 0] define_ring
1031: f toString . /f set
1032: f fctr rest /g set
1033: g {
1034: 0 get /aa set
1035: aa (s). degree 1 eq {
1036: aa (s). coeff 1 get /aa set
1037: aa length 1 eq { 0 }
1038: { aa 0 get (1). eq {
1039: 0 << aa 1 get (integer) dc >> sub
1040: } { } ifelse
1041: } ifelse
1042: }{ } ifelse
1043: } map
1044: /rlist set
1045: %% rlist ::
1046: [-1000000] rlist join shell rest /arg1 set
1.20 takayama 1047: ] pop
1.23 takayama 1048: popEnv
1.20 takayama 1049: popVariables
1050: arg1
1.21 takayama 1051: } def
1052:
1.23 takayama 1053: %%%%%%%%%%%%% From gbhg3/Int/intw.sm1
1054: %% This function needs solv1.asir and ox_asir.
1055: %% See solv1.asir for the usage of this function.
1056: /rationalRoots2 {
1057: /arg1 set
1058: [/in-rationalRoots2 /aa /f /comm /vvv /r /setarg
1059: /w /ans
1060: ] pushVariables
1061: [(CurrentRingp) (KanGBmessage)] pushEnv
1.21 takayama 1062: [
1.23 takayama 1063: /aa arg1 def
1064: aa isArray { } { (<<array>> rationalRoots2) error } ifelse
1065: /setarg 0 def
1066: oxasir.ccc [ ] eq {
1067: (Starting ox_asir server.) message
1068: ox_asirConnectMethod
1069: } { } ifelse
1070: aa { tag } map /typev set
1071: typev [ArrayP StringP ArrayP] eq
1072: { /f aa 0 get def
1073: /vvv [ aa 1 get to_records pop ] def
1074: /w aa 2 get def
1075: /setarg 1 def
1076: } { } ifelse
1077: typev [ArrayP ArrayP ArrayP] eq
1078: { /f aa 0 get def
1079: /vvv aa 1 get {toString} map def
1080: /setarg 1 def
1081: /w aa 2 get def
1082: } { } ifelse
1083: setarg { } { (rationalRoots2 : Argument mismatch) error } ifelse
1084:
1085:
1086: [vvv from_records ring_of_polynomials 0] define_ring
1087: f { toString . } map /f set
1088: vvv { . } map /vvv set
1089: w { toString . } map /w set
1090:
1091: (rationalRoots2 -- f = ) messagen f messagen
1092: ( , vvv= ) messagen vvv messagen ( , w = ) messagen w message
1093:
1094: vvv length 1 eq w 0 get (1). eq and
1095: {
1096: [(KanGBmessage) 0] system_variable
1097: [f] groebner_sugar 0 get /f set
1098: vvv 0 get toString (s) eq {
1099: }{ [[vvv 0 get toString (s)] from_records ring_of_polynomials 0] define_ring}
1100: ifelse
1101: f 0 get toString . [[vvv 0 get toString . (s).]] replace
1102: findIntegralRoots /ans set
1103: }
1104: {
1105: oxasir.ccc [(sm1_rationalRoots2) f vvv w] asir
1106: {(integer) dc} map
1107: /ans set
1.21 takayama 1108: } ifelse
1.23 takayama 1109:
1.21 takayama 1110: /arg1 ans def
1111: ] pop
1.23 takayama 1112: popEnv
1113: popVariables
1114: arg1
1115: } def
1116: [(rationalRoots2)
1117: [(rationalRoots2 (ox_asir function) called from intw.sm1 to analyze integral)
1118: (roots.)
1119: ]] putUsages
1120:
1121: /ptozp_subst {
1122: /arg1 set
1123: [/in-ptozp_subst /aaa /fff /xxx /vvv /vlist] pushVariables
1124: [(CurrentRingp)] pushEnv
1125: [
1126: /aaa arg1 def
1127: /fff aaa 0 get def
1128: /xxx aaa 1 get toString def
1129: /vvv aaa 2 get {toString ..} map def
1130: aaa length 4 eq {
1131: /vlist aaa 3 get def
1132: } {
1133: /vlist 0 def
1134: } ifelse
1135: oxasir.ccc [ ] eq {
1136: (Starting ox_asir server.) message
1137: ox_asirConnectMethod
1138: } { } ifelse
1139: fff isPolynomial {
1140: fff (ring) dc ring_def
1141: fff toString /fff set
1142: }
1143: { vlist isInteger { (ptozp_subst: need variable names.) error } { } ifelse
1144: [vlist ring_of_differential_operators 0] define_ring
1145: } ifelse
1146: oxasir.ccc [(sm1_ptozp_subst) fff . xxx . vvv] asir
1147: /arg1 set
1148: ] pop
1149: popEnv
1150: popVariables
1151: arg1
1152: } def
1153:
1154: [(ptozp_subst)
1155: [$[f s [p q] v] ptozp_subst g (ox_asir function)$
1156: $It returns ptozp(subst(f,s,p/q))$
1157: $Example 1: [ (x Dx - s) (s) [2 3] (x,s)] ptozp_subst $
1158: $ ===> 3 x Dx - 2 $
1159: ]] putUsages
1160:
1161: /reduceByAsir {
1162: /arg1 set
1163: [/in-reduceByAsir /aaa /fff /fff0 /fff1 /vlist] pushVariables
1164: [(CurrentRingp)] pushEnv
1165: [
1166: /aaa arg1 def
1167: /fff aaa 0 get def
1168: aaa length 2 eq {
1169: /vlist aaa 1 get def
1170: } {
1171: /vlist 0 def
1172: } ifelse
1173: oxasir.ccc [ ] eq {
1174: (Starting ox_asir server.) message
1175: ox_asirConnectMethod
1176: } { } ifelse
1177: fff isArray {
1178: fff length 2 eq {
1179: /fff0 fff 0 get def
1180: /fff1 fff 1 get def
1181: } {
1182: ([ << [f g] >> vlist ] reduceByAsir ) error
1183: } ifelse
1184: } {
1185: ([ << [f g] >> vlist ] reduceByAsir ) error
1186: } ifelse
1187: fff0 isPolynomial fff1 isPolynomial and {
1188: fff0 (ring) dc ring_def
1189: fff0 toString . /fff0 set
1190: fff1 (ring) dc ring_def
1191: fff1 toString . /fff1 set
1192: }
1193: { vlist isInteger { (reduceByAsir: need variable names.) error } { } ifelse
1194: [vlist ring_of_differential_operators 0] define_ring
1195: fff0 toString . /fff0 set
1196: fff1 toString . /fff1 set
1197: } ifelse
1198: oxasir.ccc [(sm1_rat2plist2) [fff0 fff1]] asir
1199: /arg1 set
1200: ] pop
1201: popEnv
1202: popVariables
1203: arg1
1204: } def
1205:
1206: [(reduceByAsir)
1207: [$ [[f g] v] reduceByAsir [ff gg] (ox_asir function)$
1208: $ [[f g]] reduceByAsir [ff gg] $
1209: $Example 1: [[(2 x -2) (4 x - 8)] (x)] reduceByAsir $
1210: (Note that there may be a gcd that is more than 1 among the coefficients.)
1211: ]] putUsages
1212:
1213: %% File should be preprocessed by OpenXM/misc/packages/Windows/oxpp
1214: %% and ./oxapp --removeSharp
1215: [(oxasirParseFile)
1216: [$[peer filename] oxasirParseFile $
1217: $File should be preprocessed by OpenXM/misc/packages/Windows/oxpp$
1218: $and ./oxapp --removeSharp $
1219: ]] putUsages
1220:
1221: /oxasirParseFile {
1222: /arg1 set
1223: [/in-oxasirParseFile /fname /sss] pushVariables
1224: [
1225: /fname arg1 1 get def
1226: /peer arg1 0 get def
1227: fname pushfile /sss set
1228: peer
1229: [$if (1) { ; $ sss (}$)] cat
1230: oxsubmit
1231: ] pop
1232: popVariables
1233: } def
1234:
1235: [(bfct)
1236: [
1237: ( f bfct b )
1238: ( poly f; poly b)
1239: ([f v] bfct b)
1240: ( string f )
1241: ( b is the global b-function of the polynomial f.)
1242: (Example: [(x^3-y^2) (x,y)] bfct fctr :: )
1243: (Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.)
1244: ( )
1245: (If you interrupted the computation by typing ctrl-C, type in )
1246: ( oxasir.ccc oxreset ; )
1247: (to interrupt the ox_asir server.)
1248: ( )
1249: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
1250: (You need to install ox_asir server to use this function. (ox_asir function))
1251: ]] putUsages
1252:
1253: /bfct {
1254: /arg1 set
1255: [/in-bfct /f /comm /vv] pushVariables
1256: [(CurrentRingp)] pushEnv
1257: [
1258: /f arg1 def
1259: oxasir.ccc [ ] eq {
1260: (Starting ox_asir server.) message
1261: ox_asirConnectMethod
1262: } { } ifelse
1263:
1264: f isPolynomial not {
1265: /vv f 1 get def
1266: vv isArray { /vv vv from_records def } { } ifelse
1267: /f f 0 get def
1268: [vv ring_of_polynomials 0] define_ring
1269: f . /f set
1270: }{ } ifelse
1271: oxasir.ccc [(oxasir_bfct) f] asir /f set
1272: [(s) ring_of_polynomials 0] define_ring
1273: f . /f set
1274: [f f fctr] /arg1 set
1275: ] pop
1276: popEnv
1.21 takayama 1277: popVariables
1278: arg1
1279: } def
1280:
1.23 takayama 1281: [(generic_bfct)
1282: [
1283: ( [ii weight] generic_bfct b )
1284: ( list of poly ii; list weight)
1285: ([ii weight variables] generic_bfct b)
1286: ( list of string ii; list weight; list variables)
1287: ( b is the general b-function of the ideal ii w.r.t the weight.)
1288: (Example: [[(Dx^2) (Dy^2)] [(x) -1 (Dx) 1] [(x) (y)]] generic_bfct :: )
1289: (Notion: Saito, Sturmfels, Takayama, Grobner deformations of hypergeometric differential equaitons)
1290: (Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.)
1291: ( )
1292: (If you interrupted the computation by typing ctrl-C, type in )
1293: ( oxasir.ccc oxreset ; )
1294: (to interrupt the ox_asir server.)
1295: ( )
1296: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
1297: (You need to install ox_asir server to use this function. (ox_asir function))
1298: ]] putUsages
1299:
1300: /generic_bfct {
1301: /arg1 set
1302: [/in-generic_bfct /aa /f /comm /vvv0 /n /vvv /ddd /r /setarg
1303: /bf /wt ] pushVariables
1304: [(CurrentRingp)] pushEnv
1305: [
1306: /aa arg1 def
1307: aa isArray { } { (<<array>> generic_bfct) error } ifelse
1308: /setarg 0 def
1309: aa { tag } map /typev set
1310: typev [ ArrayP ArrayP] eq
1311: { /f aa 0 get def
1312: f 0 tag PolyP { } { (The first argument must be a list of differential operators. Give the third variable: a list of variables) error } ifelse
1313: f 0 get (ring) dc /r set
1314: [(CurrentRingp) r] system_variable
1315: /wt aa 1 get def
1316:
1317: /vvv0 getVariableNames def
1318: /n [(N)] system_variable def
1319: /vvv vvv0 n carN rest reverse rest reverse def
1320: /ddd vvv0 reverse n carN reverse
1321: rest reverse rest reverse def
1322:
1323: /wt wt generic_bfct.aux1 def
1324:
1325: /setarg 1 def
1326: } { } ifelse
1327: typev [ArrayP ArrayP StringP] eq
1328: { /f aa 0 get def
1329: /vvv [ aa 2 get to_records pop ] def
1330: /wt aa 1 get def
1331:
1332: /n vvv length def
1333: /ddd vvv { (D) 2 1 roll 2 cat_n } map def
1334:
1335: /setarg 1 def
1336: } { } ifelse
1337: typev [ArrayP ArrayP ArrayP] eq
1338: { /f aa 0 get def
1339: /vvv aa 2 get {toString} map def
1340: /wt aa 1 get def
1341:
1342: /n vvv length def
1343: /ddd vvv { (D) 2 1 roll 2 cat_n } map def
1344:
1345: /setarg 1 def
1346: } { } ifelse
1347: setarg { } { (generic_bfct : Argument mismatch) error } ifelse
1348:
1349: f 0 get isPolynomial {
1350:
1351: }
1352: {
1353: [vvv from_records ring_of_differential_operators 0] define_ring
1354: f { toString . } map /f set
1355: vvv { . } map /vvv set
1356: ddd { . } map /ddd set
1357: /wt wt generic_bfct.aux1 def
1358: } ifelse
1359: [f vvv ddd wt] message
1360:
1361: oxasir.ccc [ ] eq {
1362: (Starting ox_asir server.) message
1363: ox_asirConnectMethod
1364: } { } ifelse
1365:
1366: oxasir.ccc [(oxasir_generic_bfct) f vvv ddd wt] asir /bf set
1367: [(s) ring_of_polynomials 0] define_ring
1368: bf . /bf set
1369: [bf bf fctr] /arg1 set
1370: ] pop
1371: popEnv
1372: popVariables
1373: arg1
1.20 takayama 1374: } def
1.22 takayama 1375:
1.23 takayama 1376: /generic_bfct.aux1 {
1.22 takayama 1377: /arg1 set
1.23 takayama 1378: [/in-generic_bfct.aux1 /wt /wtx /wtd /n] pushVariables
1379: [
1380: arg1 /wt set
1381: /n [(N)] system_variable def
1382: wt { dup tag PolyP eq { toString } { } ifelse } map /wt set
1383: wt weightv /wt set
1384: /wtx wt n carN rest reverse rest reverse def
1385: /wtd wt reverse n carN reverse
1386: rest reverse rest reverse def
1387: wtx wtd join /wt set
1388: wt { dup tag IntegerP eq { (universalNumber) dc } { } ifelse } map /wt set
1389: wt /arg1 set
1390: ] pop
1391: popVariables
1392: arg1
1393: } def
1394: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1395: %%% functions to start ox_asir
1396: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1397: /asirconnectr {
1398: [/in-asirconnectr /pass /peer /data /control /oxasir] pushVariables
1399: [
1400: /pass [(oxGenPass)] extension def
1401: /peer [(oxGetPort) (localhost)] extension def
1402: /data peer 1 get toString def
1403: /control peer 3 get toString def
1404: peer message
1.22 takayama 1405: [
1.23 takayama 1406: oxstart100
1407: Xm_noX { ( -nox ) } { } ifelse
1408: ( -oxserver bin/ox_asir -e ) ( -reverse )
1409: ( -data ) data ( -control ) control ( -pass ) pass
1410: ( )] cat execve
1411: [(oxCreateClient2) peer 0 pass] extension /oxasir.ccc set
1412: %% 0 means connect from only localhost.
1413: oxasir.ccc asir.init
1414: /arg1 oxasir.ccc def
1.22 takayama 1415: ] pop
1416: popVariables
1.23 takayama 1417: arg1
1.22 takayama 1418: } def
1419:
1.23 takayama 1420: [(asirconnectr)
1421: [(asirconnectr server (ox_asir function))
1422: (array server;)
1423: (Example: asirconnectr /oxasir.ccc set)
1424: ]] putUsages
1425:
1426: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1427: %%% functions to start ox_k0
1428: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1429: /oxk0.ccc load isArray
1430: { }
1431: { /oxk0.ccc [ ] def } ifelse
1.22 takayama 1432:
1.23 takayama 1433: /ox.k0.init {
1434: % oxk0.ccc ( Print("Hello!"); ) oxsubmit
1435: Xm_noX { oxk0.ccc (Xm_noX=true;) oxsubmit }
1436: { oxk0.ccc (Xm_noX=false;) oxsubmit } ifelse
1437: } def
1.1 maekawa 1438:
1.23 takayama 1439: /k0connectr {
1440: [/in-k0connectr /pass /peer /data /control ] pushVariables
1441: [
1442: /pass [(oxGenPass)] extension def
1443: /peer [(oxGetPort) (localhost)] extension def
1444: /data peer 1 get toString def
1445: /control peer 3 get toString def
1446: peer message
1447: [
1448: oxstart100
1449: Xm_noX { ( -nox ) } { } ifelse
1450: ( -oxserver bin/ox_k0 -e ) ( -reverse )
1451: ( -data ) data ( -control ) control ( -pass ) pass
1452: ( )] cat execve
1453: [(oxCreateClient2) peer 0 pass] extension /oxk0.ccc set
1454: %% 0 means connect from only localhost.
1455: (The server is binded to the variable oxk0.ccc) message
1456: ox.k0.init
1457: /arg1 oxk0.ccc def
1458: ] pop
1459: popVariables
1460: arg1
1461: } def
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>