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