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