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