Annotation of OpenXM/src/kan96xx/Doc/ox.sm1, Revision 1.38
1.38 ! takayama 1: %%%%%%%%%%% $OpenXM: OpenXM/src/kan96xx/Doc/ox.sm1,v 1.37 2004/03/03 06:09:29 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.)
1.38 ! takayama 853: (NOTE: all asir-args must belong to the same ring. cf.oxasir.changeRing. )
1.23 takayama 854: (Example: oxasir.ccc [(fctr) (x^10-1).] asir )
855: ( )
856: (This function requires plugins cmo, socket and ox_asir server. cf. oxasir)
1.38 ! takayama 857: (See, http://www.math.kobe-u.ac.jp/Asir on asir)
1.23 takayama 858: ]
859: ] putUsages
860:
861: /asir {
862: /arg2 set
863: /arg1 set
864: [/pid /asir-comm /comm /n /i /rr] pushVariables
865: [(CurrentRingp)] pushEnv
866: [
867: /pid arg1 def
868: /asir-comm arg2 def
869: pid tag 6 eq { } { (Invalid pid. See asir.) error } ifelse
870: pid 0 get (client) eq { } { (Invalid pid. See asir.) error } ifelse
871: asir-comm tag 6 eq { } { (Invalid argument asir-comm. See asir) error } ifelse
872:
873: [ %% Change the current ring if necessary to send a correct OxVlist.
874: asir-comm oxasir.changeRing
875: ] pop
876: %%% Setting OxVlist to tell asir a way to change dist-poly <==> poly.
877: (OxVlist=) getVlist2 toString (;) 3 cat_n /comm set
878: %% comm message
879: pid comm oxsubmit
880: pid (print(OxVlist);) oxsubmit
881:
882:
883: /n asir-comm length def
884: n 1 sub -1 1 {
885: /i set
886: pid asir-comm i get oxsendcmo
887: pid 1 oxsendcmo pid (ox_dtop) oxexec
888: } for
889: pid n 1 sub oxsendcmo
890: pid asir-comm 0 get oxexec
891:
892: pid 1 oxsendcmo pid (ox_ptod) oxexec
893: pid oxpopcmo /arg1 set
894:
1.16 takayama 895:
1.23 takayama 896: ] pop
897: popEnv
898: popVariables
899: arg1
900: } def
901:
902: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
903: %%% Mathematical functions for asir
904: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
905: /oxasir.changeRing {
1.38 ! takayama 906: /oxasir.changeRing.rr.prev 0 def
! 907: oxasir.changeRing2
! 908: } def
! 909: /oxasir.changeRing2 {
1.23 takayama 910: /arg1 set
1.38 ! takayama 911: [/in-oxasir.changeRing2 /f /rr ] pushVariables
1.23 takayama 912: [
913: /f arg1 def
914: f isArray {
1.38 ! takayama 915: f {oxasir.changeRing2} map
1.23 takayama 916: }{
917: f isPolynomial {
918: f (0). eq { }
1.38 ! takayama 919: { f (ring) dc /rr set [(CurrentRingp) rr] system_variable
! 920: oxasir.changeRing.rr.prev tag 1 eq { }
! 921: {
! 922: oxasir.changeRing.rr.prev rr eq { }
! 923: { (asir : arguments must belong to the same ring.) error } ifelse
! 924: } ifelse
! 925: /oxasir.changeRing.rr.prev rr def
! 926: } ifelse
1.23 takayama 927: } { } ifelse
928: } ifelse
929: ] pop
930: popVariables
931: } def
932:
933: /fctr {
934: /arg1 set
935: [/f /comm /vv] pushVariables
936: [(CurrentRingp)] pushEnv
937: [
938: /f arg1 def
939: oxasir.ccc [ ] eq {
940: (Starting ox_asir server.) message
941: ox_asirConnectMethod
942: } { } ifelse
943:
944: f isPolynomial not {
945: /vv f 1 get def
946: vv isArray { /vv vv from_records def } { } ifelse
947: /f f 0 get def
948: [vv ring_of_polynomials 0] define_ring
949: f . /f set
1.16 takayama 950: }{ } ifelse
1.23 takayama 951: oxasir.ccc [(fctr) f] asir /arg1 set
1.16 takayama 952: ] pop
1.23 takayama 953: popEnv
1.16 takayama 954: popVariables
955: arg1
956: } def
957:
1.23 takayama 958: [(fctr)
959: [(You need to install ox_asir server to use this function. (ox_asir function))
960: (f fctr g)
961: (poly f; array g;)
962: ([f v] fctr g ; string f, string or array of string v)
963: (This function factors the polynomial f over Q.)
964: ( )
965: (Example 1: [(x^10-y^10) (x,y)] fctr ::)
966: (Example 2: (x^10-1). fctr ::)
967: ( )
968: (If you interrupted the computation by typing ctrl-C, type in )
969: ( oxasir.ccc oxreset ; )
970: (to interrupt the ox_asir server.)
971: ( )
972: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
973: ]] putUsages
974:
975:
976: [(primadec)
977: [(You need to install ox_asir server to use this function. (ox_asir function))
978: ([ ii ] primadec [[q1 p1] [q2 p2] ... ] )
979: ( array of poly ii; array of poly q1, p1, q2, p2 ...;)
980: ( q1, q2, ... are primary components of the primary ideal decomposition)
981: ( of the ideal generated by << ii >>.)
982: ( )
983: ([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
984: ( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
985: (<< v >> is an array of independent variables.)
986: ( )
987: ([ ii v ] primadec [[q1 p1] [q2 p2] ... ] )
988: ( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;)
989: ( v is a string of variables separated by , )
990: ( )
991: (Example: [(x,y) ring_of_polynomials 0] define_ring)
992: ( [ [(x^2-1). (x y).] ] primadec pmat ;)
993: ( )
994: (Example: [ [(x^2-1) (x y)] [(x) (y)]] primadec pmat ;)
995: ( )
996: (If you interrupted the computation by typing ctrl-C, type in )
997: ( oxasir.ccc oxreset ; )
998: (to interrupt the ox_asir server.)
999: ( )
1000: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
1001: ]] putUsages
1002:
1003: /primadec {
1004: /arg1 set
1005: [/in-primadec /aa /f /comm /vvv /r /setarg] pushVariables
1006: [(CurrentRingp)] pushEnv
1007: [
1008: /aa arg1 def
1009: aa isArray { } { (<<array>> primadec) error } ifelse
1010: /setarg 0 def
1011: oxasir.ccc [ ] eq {
1012: (Starting ox_asir server.) message
1013: ox_asirConnectMethod
1014: } { } ifelse
1015: aa { tag } map /typev set
1016: typev [ ArrayP ] eq
1017: { /f aa 0 get def
1018: f 0 get (ring) dc /r set
1019: [(CurrentRingp) r] system_variable
1020: /vvv getVariableNames def
1021: /setarg 1 def
1022: } { } ifelse
1023: typev [ArrayP StringP] eq
1024: { /f aa 0 get def
1025: /vvv [ aa 1 get to_records pop ] def
1026: /setarg 1 def
1027: } { } ifelse
1028: typev [ArrayP ArrayP] eq
1029: { /f aa 0 get def
1030: /vvv aa 1 get {toString} map def
1031: /setarg 1 def
1032: } { } ifelse
1033: setarg { } { (primadec : Argument mismatch) error } ifelse
1034:
1035: f 0 get isPolynomial {
1036: /r f 0 get (ring) dc def
1037: /vvv vvv { r ,, } map def
1038: }
1039: {
1040: [vvv from_records ring_of_polynomials 0] define_ring
1041: f { toString . } map /f set
1042: vvv { . } map /vvv set
1043: } ifelse
1044: oxasir.ccc [(primadec) f vvv] asir /arg1 set
1.16 takayama 1045: ] pop
1.23 takayama 1046: popEnv
1.16 takayama 1047: popVariables
1048: arg1
1049: } def
1.20 takayama 1050:
1.23 takayama 1051:
1052: /getVlist2 {
1053: [/n /i ] pushVariables
1.20 takayama 1054: [
1.23 takayama 1055: /n [(N)] system_variable def
1056: [
1057: 0 1 n 1 sub { /i set (x) i (dollar) dc 2 cat_n } for
1058: 0 1 n 1 sub { /i set (d) i (dollar) dc 2 cat_n } for
1059: ] /arg1 set
1.20 takayama 1060: ] pop
1061: popVariables
1062: arg1
1063: } def
1064:
1.23 takayama 1065: %%%%%%%%%%%%%%%%%%%
1066: /getVlist {
1067: [/n /i ] pushVariables
1068: [
1069: /n [(N)] system_variable def
1070: [
1071: 0 1 n 1 sub { /i set [(x) (var) i] system_variable } for
1072: 0 1 n 1 sub { /i set [(D) (var) i] system_variable } for
1073: ] /arg1 set
1074: ] pop
1075: popVariables
1076: arg1
1077: } def
1.20 takayama 1078:
1.23 takayama 1079: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1080: [(chattr) 0 /findIntegralRoots] extension pop
1081: /findIntegralRoots {
1082: /arg1 set
1083: [/in-findIntegralRoots /pp ] pushVariables
1.20 takayama 1084: [
1.23 takayama 1085: /pp arg1 def
1086: oxasir.ccc [ ] eq {
1087: (Starting ox_asir server.) message
1088: ox_asirConnectMethod
1089: } { } ifelse
1090: oxasir.ccc oxIsServerReady
1091: { pp findIntegralRoots.oxasir /arg1 set}
1092: { pp findIntegralRoots.slow /arg1 set} ifelse
1.20 takayama 1093: ] pop
1094: popVariables
1095: arg1
1096: } def
1.23 takayama 1097:
1098: /findIntegralRoots.oxasir {
1.20 takayama 1099: /arg1 set
1.23 takayama 1100: [/in-findIntegralRoots /f /r /g /aa /rlist] pushVariables
1101: [(CurrentRingp) (KanGBmessage)] pushEnv
1.20 takayama 1102: [
1.23 takayama 1103: /f arg1 def
1104: [(s) ring_of_polynomials 0] define_ring
1105: f toString . /f set
1106: f fctr rest /g set
1107: g {
1108: 0 get /aa set
1109: aa (s). degree 1 eq {
1110: aa (s). coeff 1 get /aa set
1111: aa length 1 eq { 0 }
1112: { aa 0 get (1). eq {
1113: 0 << aa 1 get (integer) dc >> sub
1114: } { } ifelse
1115: } ifelse
1116: }{ } ifelse
1117: } map
1118: /rlist set
1119: %% rlist ::
1120: [-1000000] rlist join shell rest /arg1 set
1.20 takayama 1121: ] pop
1.23 takayama 1122: popEnv
1.20 takayama 1123: popVariables
1124: arg1
1.21 takayama 1125: } def
1126:
1.23 takayama 1127: %%%%%%%%%%%%% From gbhg3/Int/intw.sm1
1128: %% This function needs solv1.asir and ox_asir.
1129: %% See solv1.asir for the usage of this function.
1130: /rationalRoots2 {
1131: /arg1 set
1132: [/in-rationalRoots2 /aa /f /comm /vvv /r /setarg
1133: /w /ans
1134: ] pushVariables
1135: [(CurrentRingp) (KanGBmessage)] pushEnv
1.21 takayama 1136: [
1.23 takayama 1137: /aa arg1 def
1138: aa isArray { } { (<<array>> rationalRoots2) error } ifelse
1139: /setarg 0 def
1140: oxasir.ccc [ ] eq {
1141: (Starting ox_asir server.) message
1142: ox_asirConnectMethod
1143: } { } ifelse
1144: aa { tag } map /typev set
1145: typev [ArrayP StringP ArrayP] eq
1146: { /f aa 0 get def
1147: /vvv [ aa 1 get to_records pop ] def
1148: /w aa 2 get def
1149: /setarg 1 def
1150: } { } ifelse
1151: typev [ArrayP ArrayP ArrayP] eq
1152: { /f aa 0 get def
1153: /vvv aa 1 get {toString} map def
1154: /setarg 1 def
1155: /w aa 2 get def
1156: } { } ifelse
1157: setarg { } { (rationalRoots2 : Argument mismatch) error } ifelse
1158:
1159:
1160: [vvv from_records ring_of_polynomials 0] define_ring
1161: f { toString . } map /f set
1162: vvv { . } map /vvv set
1163: w { toString . } map /w set
1164:
1165: (rationalRoots2 -- f = ) messagen f messagen
1166: ( , vvv= ) messagen vvv messagen ( , w = ) messagen w message
1167:
1168: vvv length 1 eq w 0 get (1). eq and
1169: {
1170: [(KanGBmessage) 0] system_variable
1171: [f] groebner_sugar 0 get /f set
1172: vvv 0 get toString (s) eq {
1173: }{ [[vvv 0 get toString (s)] from_records ring_of_polynomials 0] define_ring}
1174: ifelse
1175: f 0 get toString . [[vvv 0 get toString . (s).]] replace
1176: findIntegralRoots /ans set
1177: }
1178: {
1179: oxasir.ccc [(sm1_rationalRoots2) f vvv w] asir
1180: {(integer) dc} map
1181: /ans set
1.21 takayama 1182: } ifelse
1.23 takayama 1183:
1.21 takayama 1184: /arg1 ans def
1185: ] pop
1.23 takayama 1186: popEnv
1187: popVariables
1188: arg1
1189: } def
1190: [(rationalRoots2)
1191: [(rationalRoots2 (ox_asir function) called from intw.sm1 to analyze integral)
1192: (roots.)
1193: ]] putUsages
1194:
1195: /ptozp_subst {
1196: /arg1 set
1197: [/in-ptozp_subst /aaa /fff /xxx /vvv /vlist] pushVariables
1198: [(CurrentRingp)] pushEnv
1199: [
1200: /aaa arg1 def
1201: /fff aaa 0 get def
1202: /xxx aaa 1 get toString def
1203: /vvv aaa 2 get {toString ..} map def
1204: aaa length 4 eq {
1205: /vlist aaa 3 get def
1206: } {
1207: /vlist 0 def
1208: } ifelse
1209: oxasir.ccc [ ] eq {
1210: (Starting ox_asir server.) message
1211: ox_asirConnectMethod
1212: } { } ifelse
1213: fff isPolynomial {
1214: fff (ring) dc ring_def
1215: fff toString /fff set
1216: }
1217: { vlist isInteger { (ptozp_subst: need variable names.) error } { } ifelse
1218: [vlist ring_of_differential_operators 0] define_ring
1219: } ifelse
1220: oxasir.ccc [(sm1_ptozp_subst) fff . xxx . vvv] asir
1221: /arg1 set
1222: ] pop
1223: popEnv
1224: popVariables
1225: arg1
1226: } def
1227:
1228: [(ptozp_subst)
1229: [$[f s [p q] v] ptozp_subst g (ox_asir function)$
1230: $It returns ptozp(subst(f,s,p/q))$
1231: $Example 1: [ (x Dx - s) (s) [2 3] (x,s)] ptozp_subst $
1232: $ ===> 3 x Dx - 2 $
1233: ]] putUsages
1234:
1235: /reduceByAsir {
1236: /arg1 set
1237: [/in-reduceByAsir /aaa /fff /fff0 /fff1 /vlist] pushVariables
1238: [(CurrentRingp)] pushEnv
1239: [
1240: /aaa arg1 def
1241: /fff aaa 0 get def
1242: aaa length 2 eq {
1243: /vlist aaa 1 get def
1244: } {
1245: /vlist 0 def
1246: } ifelse
1247: oxasir.ccc [ ] eq {
1248: (Starting ox_asir server.) message
1249: ox_asirConnectMethod
1250: } { } ifelse
1251: fff isArray {
1252: fff length 2 eq {
1253: /fff0 fff 0 get def
1254: /fff1 fff 1 get def
1255: } {
1256: ([ << [f g] >> vlist ] reduceByAsir ) error
1257: } ifelse
1258: } {
1259: ([ << [f g] >> vlist ] reduceByAsir ) error
1260: } ifelse
1261: fff0 isPolynomial fff1 isPolynomial and {
1262: fff0 (ring) dc ring_def
1263: fff0 toString . /fff0 set
1264: fff1 (ring) dc ring_def
1265: fff1 toString . /fff1 set
1266: }
1267: { vlist isInteger { (reduceByAsir: need variable names.) error } { } ifelse
1268: [vlist ring_of_differential_operators 0] define_ring
1269: fff0 toString . /fff0 set
1270: fff1 toString . /fff1 set
1271: } ifelse
1272: oxasir.ccc [(sm1_rat2plist2) [fff0 fff1]] asir
1273: /arg1 set
1274: ] pop
1275: popEnv
1276: popVariables
1277: arg1
1278: } def
1279:
1280: [(reduceByAsir)
1281: [$ [[f g] v] reduceByAsir [ff gg] (ox_asir function)$
1282: $ [[f g]] reduceByAsir [ff gg] $
1283: $Example 1: [[(2 x -2) (4 x - 8)] (x)] reduceByAsir $
1284: (Note that there may be a gcd that is more than 1 among the coefficients.)
1285: ]] putUsages
1286:
1287: %% File should be preprocessed by OpenXM/misc/packages/Windows/oxpp
1288: %% and ./oxapp --removeSharp
1289: [(oxasirParseFile)
1290: [$[peer filename] oxasirParseFile $
1291: $File should be preprocessed by OpenXM/misc/packages/Windows/oxpp$
1292: $and ./oxapp --removeSharp $
1293: ]] putUsages
1294:
1295: /oxasirParseFile {
1296: /arg1 set
1297: [/in-oxasirParseFile /fname /sss] pushVariables
1298: [
1299: /fname arg1 1 get def
1300: /peer arg1 0 get def
1301: fname pushfile /sss set
1302: peer
1303: [$if (1) { ; $ sss (}$)] cat
1304: oxsubmit
1305: ] pop
1306: popVariables
1307: } def
1308:
1309: [(bfct)
1310: [
1311: ( f bfct b )
1312: ( poly f; poly b)
1313: ([f v] bfct b)
1314: ( string f )
1315: ( b is the global b-function of the polynomial f.)
1316: (Example: [(x^3-y^2) (x,y)] bfct fctr :: )
1317: (Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.)
1318: ( )
1319: (If you interrupted the computation by typing ctrl-C, type in )
1320: ( oxasir.ccc oxreset ; )
1321: (to interrupt the ox_asir server.)
1322: ( )
1323: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
1324: (You need to install ox_asir server to use this function. (ox_asir function))
1325: ]] putUsages
1326:
1327: /bfct {
1328: /arg1 set
1329: [/in-bfct /f /comm /vv] pushVariables
1330: [(CurrentRingp)] pushEnv
1331: [
1332: /f arg1 def
1333: oxasir.ccc [ ] eq {
1334: (Starting ox_asir server.) message
1335: ox_asirConnectMethod
1336: } { } ifelse
1337:
1338: f isPolynomial not {
1339: /vv f 1 get def
1340: vv isArray { /vv vv from_records def } { } ifelse
1341: /f f 0 get def
1342: [vv ring_of_polynomials 0] define_ring
1343: f . /f set
1344: }{ } ifelse
1345: oxasir.ccc [(oxasir_bfct) f] asir /f set
1346: [(s) ring_of_polynomials 0] define_ring
1347: f . /f set
1348: [f f fctr] /arg1 set
1349: ] pop
1350: popEnv
1.21 takayama 1351: popVariables
1352: arg1
1353: } def
1354:
1.23 takayama 1355: [(generic_bfct)
1356: [
1357: ( [ii weight] generic_bfct b )
1358: ( list of poly ii; list weight)
1359: ([ii weight variables] generic_bfct b)
1360: ( list of string ii; list weight; list variables)
1361: ( b is the general b-function of the ideal ii w.r.t the weight.)
1362: (Example: [[(Dx^2) (Dy^2)] [(x) -1 (Dx) 1] [(x) (y)]] generic_bfct :: )
1363: (Notion: Saito, Sturmfels, Takayama, Grobner deformations of hypergeometric differential equaitons)
1364: (Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.)
1365: ( )
1366: (If you interrupted the computation by typing ctrl-C, type in )
1367: ( oxasir.ccc oxreset ; )
1368: (to interrupt the ox_asir server.)
1369: ( )
1370: (This function requires plugins cmo, socket and ox_asir server. cf.oxasir)
1371: (You need to install ox_asir server to use this function. (ox_asir function))
1372: ]] putUsages
1373:
1374: /generic_bfct {
1375: /arg1 set
1376: [/in-generic_bfct /aa /f /comm /vvv0 /n /vvv /ddd /r /setarg
1377: /bf /wt ] pushVariables
1378: [(CurrentRingp)] pushEnv
1379: [
1380: /aa arg1 def
1381: aa isArray { } { (<<array>> generic_bfct) error } ifelse
1382: /setarg 0 def
1383: aa { tag } map /typev set
1384: typev [ ArrayP ArrayP] eq
1385: { /f aa 0 get def
1386: f 0 tag PolyP { } { (The first argument must be a list of differential operators. Give the third variable: a list of variables) error } ifelse
1387: f 0 get (ring) dc /r set
1388: [(CurrentRingp) r] system_variable
1389: /wt aa 1 get def
1390:
1391: /vvv0 getVariableNames def
1392: /n [(N)] system_variable def
1393: /vvv vvv0 n carN rest reverse rest reverse def
1394: /ddd vvv0 reverse n carN reverse
1395: rest reverse rest reverse def
1396:
1397: /wt wt generic_bfct.aux1 def
1398:
1399: /setarg 1 def
1400: } { } ifelse
1401: typev [ArrayP ArrayP StringP] eq
1402: { /f aa 0 get def
1403: /vvv [ aa 2 get to_records pop ] def
1404: /wt aa 1 get def
1405:
1406: /n vvv length def
1407: /ddd vvv { (D) 2 1 roll 2 cat_n } map def
1408:
1409: /setarg 1 def
1410: } { } ifelse
1411: typev [ArrayP ArrayP ArrayP] eq
1412: { /f aa 0 get def
1413: /vvv aa 2 get {toString} map def
1414: /wt aa 1 get def
1415:
1416: /n vvv length def
1417: /ddd vvv { (D) 2 1 roll 2 cat_n } map def
1418:
1419: /setarg 1 def
1420: } { } ifelse
1421: setarg { } { (generic_bfct : Argument mismatch) error } ifelse
1422:
1423: f 0 get isPolynomial {
1424:
1425: }
1426: {
1427: [vvv from_records ring_of_differential_operators 0] define_ring
1428: f { toString . } map /f set
1429: vvv { . } map /vvv set
1430: ddd { . } map /ddd set
1.33 takayama 1431: /wt [vvv ddd wt] generic_bfct.aux1 def
1.23 takayama 1432: } ifelse
1433: [f vvv ddd wt] message
1434:
1435: oxasir.ccc [ ] eq {
1436: (Starting ox_asir server.) message
1437: ox_asirConnectMethod
1438: } { } ifelse
1439:
1440: oxasir.ccc [(oxasir_generic_bfct) f vvv ddd wt] asir /bf set
1441: [(s) ring_of_polynomials 0] define_ring
1442: bf . /bf set
1443: [bf bf fctr] /arg1 set
1444: ] pop
1445: popEnv
1446: popVariables
1447: arg1
1.20 takayama 1448: } def
1.22 takayama 1449:
1.23 takayama 1450: /generic_bfct.aux1 {
1.22 takayama 1451: /arg1 set
1.33 takayama 1452: [/in-generic_bfct.aux1 /ii /jj /wt /wtx /wtd /vv /dd /n] pushVariables
1.23 takayama 1453: [
1.33 takayama 1454: arg1 2 get /wt set
1455: arg1 0 get /vv set
1456: arg1 1 get /dd set
1457: /wtx [ 0 1 vv length 1 sub { pop (0).. } for ] def
1458: /n wt length def
1459: 0 2 n 1 sub {
1460: /ii set
1461: 0 1 vv length 1 sub {
1462: /jj set
1463: wt ii get toString dd jj get toString eq {
1464: wtx jj << wt ii 1 add get >> put
1465: } { } ifelse
1466: } for
1467: } for
1468:
1469: wtx /wt set
1.23 takayama 1470: wt { dup tag IntegerP eq { (universalNumber) dc } { } ifelse } map /wt set
1471: wt /arg1 set
1472: ] pop
1473: popVariables
1474: arg1
1475: } def
1.30 takayama 1476: /verbose.wgr 1 def
1477: %[ ff vv ww ] asir.wgb [gb init]
1478: /asir.wgr {
1479: /arg1 set
1480: [/in-asir.gb /ff /vv /ww /vvx /vvd /avv /comm /wvec /i] pushVariables
1481: [
1482: /ff arg1 0 get def
1483: /vv arg1 1 get def
1484: /ww arg1 2 get def
1485:
1486: oxasir.ccc [ ] eq {
1487: (Starting ox_asir server.) message
1488: ox_asirConnectMethod
1489: } { } ifelse
1490:
1491: vv isArray {
1492: vv from_records /vv set
1493: } { } ifelse
1494: oxasir.ccc [(dp_gr_print) (2)..] asir
1495: [vv to_records pop] /vvx set
1496: vvx { toString (D) 2 1 roll 2 cat_n } map /vvd set
1497:
1498: [
1499: 0 1 vvx length 1 sub {
1500: /i set
1501: vvx i get
1502: 0 ww i get sub
1503: vvd i get
1504: ww i get
1505: } for
1506: ] /wvec set
1507:
1508: [vv ring_of_differential_operators
1509: [wvec] weight_vector
1510: 0] define_ring
1511:
1.38 ! takayama 1512: ff { toString . dehomogenize homogenize } map /ff set
1.30 takayama 1513: vvx { . } map /vvx set %%ex [x,y]
1514: vvd { . } map /vvd set %%ex [Dx,Dy]
1515: vvx vvd join [(h).] join /avv set
1516:
1517: verbose.wgr {
1518: (Asir (-w,w) gb in the Weyl algebra) message
1519: (wvec=) messagen wvec message
1520: (ff=) messagen ff message
1521: (avv=) messagen avv message
1522: } { } ifelse
1523:
1.32 takayama 1524: [$dp_weyl_set_weight(newvect($ ww length toString $,$
1.30 takayama 1525: ww toString $));$ ] cat /comm set
1526:
1527: verbose.wgr {
1528: comm message
1529: } { } ifelse
1530:
1531: oxasir.ccc comm oxsubmit ;
1532:
1533: oxasir.ccc [(dp_weyl_gr_main) ff avv (0).. (1).. (11)..] asir
1534: /arg1 set
1535: ] pop
1536: popVariables
1537: arg1
1538: } def
1539: [(asir.wgr)
1540: [([ ff vv ww ] asir.wgr g)
1.31 takayama 1541: $It computes the (-ww,ww) Grobner basis of ff in the homogenized Weyl algebra.$
1.30 takayama 1542: (Homogenization is automatically done.)
1543: $Example 1: $
1544: $ [ [(x*Dx+y*Dy-1) (Dx*Dy)] $
1545: $ (x,y) $
1546: $ [1 2 ] ] asir.wgr $
1547: ]] putUsages
1548:
1.23 takayama 1549: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1550: %%% functions to start ox_asir
1551: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1552: /asirconnectr {
1553: [/in-asirconnectr /pass /peer /data /control /oxasir] pushVariables
1554: [
1.25 takayama 1555: [(getServerEnv) (bin/ox_asir)] extension tag 0 eq {
1556: (Server bin/ox_sm1 is not found.) error
1557: }{ } ifelse
1558:
1.23 takayama 1559: /pass [(oxGenPass)] extension def
1560: /peer [(oxGetPort) (localhost)] extension def
1561: /data peer 1 get toString def
1562: /control peer 3 get toString def
1.35 takayama 1563: peer message-quiet
1.22 takayama 1564: [
1.23 takayama 1565: oxstart100
1.34 takayama 1566: @@@.quiet { ( -quiet ) } { } ifelse
1.23 takayama 1567: Xm_noX { ( -nox ) } { } ifelse
1568: ( -oxserver bin/ox_asir -e ) ( -reverse )
1569: ( -data ) data ( -control ) control ( -pass ) pass
1570: ( )] cat execve
1571: [(oxCreateClient2) peer 0 pass] extension /oxasir.ccc set
1572: %% 0 means connect from only localhost.
1573: oxasir.ccc asir.init
1574: /arg1 oxasir.ccc def
1.22 takayama 1575: ] pop
1576: popVariables
1.23 takayama 1577: arg1
1.22 takayama 1578: } def
1579:
1.23 takayama 1580: [(asirconnectr)
1581: [(asirconnectr server (ox_asir function))
1582: (array server;)
1583: (Example: asirconnectr /oxasir.ccc set)
1584: ]] putUsages
1585:
1586: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1587: %%% functions to start ox_k0
1588: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1589: /oxk0.ccc load isArray
1590: { }
1591: { /oxk0.ccc [ ] def } ifelse
1.22 takayama 1592:
1.23 takayama 1593: /ox.k0.init {
1594: % oxk0.ccc ( Print("Hello!"); ) oxsubmit
1595: Xm_noX { oxk0.ccc (Xm_noX=true;) oxsubmit }
1596: { oxk0.ccc (Xm_noX=false;) oxsubmit } ifelse
1597: } def
1.1 maekawa 1598:
1.23 takayama 1599: /k0connectr {
1600: [/in-k0connectr /pass /peer /data /control ] pushVariables
1601: [
1.25 takayama 1602: [(getServerEnv) (bin/ox_k0)] extension tag 0 eq {
1603: (Server bin/ox_sm1 is not found.) error
1604: }{ } ifelse
1605:
1.23 takayama 1606: /pass [(oxGenPass)] extension def
1607: /peer [(oxGetPort) (localhost)] extension def
1608: /data peer 1 get toString def
1609: /control peer 3 get toString def
1.35 takayama 1610: peer message-quiet
1.23 takayama 1611: [
1612: oxstart100
1613: Xm_noX { ( -nox ) } { } ifelse
1614: ( -oxserver bin/ox_k0 -e ) ( -reverse )
1615: ( -data ) data ( -control ) control ( -pass ) pass
1616: ( )] cat execve
1617: [(oxCreateClient2) peer 0 pass] extension /oxk0.ccc set
1618: %% 0 means connect from only localhost.
1.34 takayama 1619: (The server is binded to the variable oxk0.ccc) message-quiet
1.23 takayama 1620: ox.k0.init
1621: /arg1 oxk0.ccc def
1622: ] pop
1623: popVariables
1624: arg1
1625: } def
1.29 takayama 1626: /@@@polymake.k0.ccc [ ] def
1627:
1.37 takayama 1628: /ox_server_mode {
1629: /:: { } def % do nothing
1630:
1631: } def
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>