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