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