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