version 1.18, 2001/12/28 01:20:25 |
version 1.55, 2006/03/03 02:30:09 |
|
|
%%%%%%%%%%% $OpenXM: OpenXM/src/kan96xx/Doc/ox.sm1,v 1.17 2001/08/22 03:23:25 takayama Exp $ |
%%%%%%%%%%% $OpenXM: OpenXM/src/kan96xx/Doc/ox.sm1,v 1.54 2006/03/03 00:43:02 takayama Exp $ |
|
|
/ox.sm1.loaded 1 def |
/ox.sm1.myname (ox-new.sm1) def |
%%%%%%%%%%%% Configuration: Specify your server path |
|
%%%%% ox, ox_sm1, oxlog are contained in kxx.tgz |
|
%%%%% These should be under /usr/local/lib/sm1 or LOAD_SM1_PATH |
|
/oxpath.ox (bin/ox) def |
|
/oxpath.oxsm1 (bin/ox_sm1) def |
|
/oxpath.oxlog (bin/oxlog) def |
|
/oxpath.xterm (/usr/X11R6/bin/xterm -icon -e ) def |
|
/oxpath.null ( ) def |
|
/oxpath.null00 ( >& /dev/null ) def %%cf. oxNoX |
|
/oxpath.null00-pure-sh ( 2>&1 >/dev/null) def %%TODO:It does not work in our case |
|
%%%%%%%%%%%%% The following is used only for sm1connectr-ssh. |
|
%%%%%%%%%%%%% Configure path for ox and ox_sm1 on your remote machine. |
|
/oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def |
|
/oxpath.oxsm1-ssh (/home/taka/OpenXM/bin/ox_sm1) def |
|
/oxpath.ox-ssh (/home/taka/OpenXM/bin/ox) def |
|
/myhostname-ssh (yama.math.kobe-u.ac.jp) def |
|
%% for debugging. |
|
%/oxpath.oxlog.xterm-ssh ( ) def |
|
%/oxpath.oxsm1-ssh (/home/nobuki/OpenXM/bin/ox_sm1) def |
|
%/oxpath.ox-ssh (/home/nobuki/OpenXM/bin/ox) def |
|
%/myhostname-ssh (localhost) def |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%% Old full path. |
|
%/oxpath.ox (/home/nobuki/kxx/ox) def |
|
%/oxpath.oxsm1 (/home/nobuki/kxx/ox_sm1) def |
|
%/oxpath.oxlog (/home/nobuki/kxx/oxlog) def |
|
%/oxpath.xterm (/usr/X11R6/bin/xterm -icon -e ) def |
|
|
|
%% This macro is invoked when this package is loaded. |
[(ostype)] extension 0 get (unix) eq { |
/initializePathNamesForOx { |
/oxstart100 |
[oxpath.ox] getPathNameSm1 /oxpath.ox set |
[[(getenv) (OpenXM_HOME)] extension (/bin/ox100start )] cat |
[oxpath.oxsm1] getPathNameSm1 /oxpath.oxsm1 set |
def |
[oxpath.oxlog] getPathNameSm1 /oxpath.oxlog set |
} { |
/oxpath.oxlog.xterm [oxpath.oxlog ( ) oxpath.xterm] cat def |
/oxstart100 |
} def |
[[(getenv) (OpenXM_HOME)] extension |
|
(/bin/ox100start.exe )] cat |
|
def |
|
} ifelse |
|
[(getenv) (OXSTART100)] extension tag 0 eq not { |
|
/oxstart100 [(getenv) (OXSTART100)] extension def |
|
} { } ifelse |
|
oxstart100 message-quiet |
|
|
%% Execute this macro, then xterm will not be executed and the output |
/ox.sm1.loaded 1 def |
%% will be redirected to /dev/null. |
/oxasir.sm1.loaded 1 def |
/oxNoX { |
/ox.k0.loaded 1 def |
/oxpath.null oxpath.null00 def |
/Ox103_loaded 1 def |
/oxpath.oxlog.xterm [oxpath.oxlog ( )] cat def |
|
(oxpath.oxlog.xterm is set to ) messagen |
|
oxpath.oxlog.xterm message |
|
} def |
|
|
|
/ox.ccc.init { ox.ccc ( [(oxPrintMessage) 0] extension pop ) oxsubmit } def |
|
|
|
/ox.verbose 0 def |
/ox.verbose 0 def |
/ox.version (2.981105) def |
/ox.version (3.030000) def |
ox.version [(Version)] system_variable gt |
ox.version [(Version)] system_variable gt |
{ (This package requires the latest version of kan/sm1) message |
{ (This package requires the latest version of kan/sm1) message |
(Please get it from http://www.math.kobe-u.ac.jp/KAN) message |
(Please get it from http://www.math.kobe-u.ac.jp/KAN) message |
error |
error |
} { } ifelse |
} { } ifelse |
(ox.sm1, ---OpenXM protocol module 08/22, 2001 (C) N.Takayama. oxhelp for help) message-quiet |
(ox.sm1, ---OpenXM protocol module 07/20, 2003 (C) N.Takayama.) message-quiet |
|
( for ox_sm1, ox_asir, ox_k0 ) message-quiet |
|
|
/ox.ccc load isArray |
/ox.ccc load isArray |
{ } |
{ } |
{ /ox.ccc [ ] def } ifelse |
{ /ox.ccc [ ] def } ifelse |
|
/oxsm1.ccc load isArray |
|
{ } |
|
{ /oxsm1.ccc [ ] def } ifelse |
|
/ox.takelog 0 def |
|
|
|
(@@@.Xm_noX) boundp { |
|
}{ |
|
/@@@.Xm_noX 0 def |
|
} ifelse |
|
(Xm_noX) boundp { |
|
/@@@.Xm_noX Xm_noX def |
|
}{ } ifelse |
|
/Xm_noX @@@.Xm_noX def |
|
/Xm_engineLogToStdout 0 def |
|
|
|
/oxNoX { |
|
/Xm_noX 1 def |
|
} def |
|
|
/ox.logsize 10 def |
|
/ox.log [1 1 ox.logsize {pop 0} for ] def |
|
/ox.mod { dup ox.logsize idiv ox.logsize mul sub } def |
|
/ox.takelog 1 def |
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%%% basic functions for OX-RFC 100 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
/SM_executeStringByLocalParser 268 def |
/SM_executeStringByLocalParser 268 def |
/SM_execute 268 def |
/SM_execute 268 def |
/SM_popString 263 def |
/SM_popString 263 def |
Line 87 ox.version [(Version)] system_variable gt |
|
Line 77 ox.version [(Version)] system_variable gt |
|
/SM_getsp 275 def |
/SM_getsp 275 def |
/SM_dupErrors 276 def |
/SM_dupErrors 276 def |
|
|
|
/SM_pushCMOtag 277 def |
|
/SM_executeFunctionWithOptionalArgument 282 def |
|
|
/SM_control_kill 1024 def |
/SM_control_kill 1024 def |
/SM_control_reset_connection 1030 def |
/SM_control_reset_connection 1030 def |
/SM_control_spawn_server 1027 def |
/SM_control_spawn_server 1027 def |
|
|
/Etag_error 257 def |
/Etag_error 257 def |
|
|
/enginesList [ |
|
[(localhost) 1300 1200] |
|
[(localhost) 2300 2200] |
|
] def |
|
%% cf. startengines |
|
/enginesList.2 [ |
|
[(dc1) 1300 1200] |
|
[(dc2) 2300 2200] |
|
] def |
|
%% cf. se12 |
|
|
|
/oxconnect { |
|
/arg1 set |
|
[(oxCreateClient) arg1 aload pop] extension |
|
} def |
|
[(oxconnect) |
|
[([hostname data-port control-port] oxconnect pid) |
|
(oxconnect is used to connect this to a server on the hostname with data-port) |
|
(and control-port) |
|
(Example 1: ox -ox ox_sm1 -data 1300 -control 1200 <== on server.) |
|
( [$localhost$ 1300 1200] oxconnect /ox.ccc set <== on client.) |
|
(Example 2: ox -ox ox_sm1 -host s.OpenXM.org -insecure -data 1300 -control 1200 <== on server.) |
|
( [$s.OpenXM.org$ 1300 1200] oxconnect /ox.ccc set <== on client.) |
|
(Example 3: ox -ox ox_sm1 -data 1300 -control 1200 >& /dev/null &<== on server.) |
|
( [$localhost$ 1300 1200] oxconnect /ox.ccc set <== on client.) |
|
( cf. oxNoX) |
|
(See also ox) |
|
] |
|
] putUsages |
|
|
|
[(ox) |
[(ox) |
[ |
[ |
(client aa oxpushcmo (oxsendcmo), client oxpopcmo dd, client popstring dd, client ss oxrpc) |
(client aa oxpushcmo (oxsendcmo), client oxpopcmo dd, client popstring dd, client ss oxrpc) |
(Example: ox.ccc [1 2 3] oxpushcmo ox.ccc oxpopcmo /ff set ff :: ) |
(Example: oxsm1.ccc [1 2 3] oxpushcmo oxsm1.ccc oxpopcmo /ff set ff :: ) |
( ) |
( ) |
(client ss oxexecutestring(oxsubmit) <<executeString>>, client ss oxexec <<executeFunction>>) |
(client ss oxexecutestring(oxsubmit) <<executeString>>, client ss oxexec <<executeFunction>>) |
|
(client ss oxexecWithOpt ) |
|
|
(Example: ox.ccc (0 1 10 { pop $Hello$ message } for) oxexecutestring ) |
(Example: oxsm1.ccc (0 1 10 { pop $Hello$ message } for) oxexecutestring ) |
(Example: ox.ccc (2).. oxpushcmo ox.ccc (10).. oxpushcmo ) |
(Example: oxsm1.ccc (2).. oxpushcmo oxsm1.ccc (10).. oxpushcmo ) |
( ox.ccc (power) oxexec ox.ccc oxpopcmo :: ) |
( oxsm1.ccc (power) oxexec oxsm1.ccc oxpopcmo :: ) |
( ) |
( ) |
(client str oxevalname, client str oxsetname, client num oxpops, client oxget) |
(client str oxevalname, client str oxsetname, client num oxpops, client oxget) |
( ) |
( ) |
(client oxmathcap, client oxsetmathcap, oxgenportfile, oxremoveportfile) |
(client oxmathcap, client oxsetmathcap, oxgenportfile, oxremoveportfile) |
|
(client oxpushcmotag) |
( ) |
( ) |
(client oxgetsp --- get stack pointer, client oxgeterrors --- get all errors) |
(client oxgetsp --- get stack pointer, client oxgeterrors --- get all errors) |
|
(client oxclearstack --- clear the stack of the ox server.) |
(cleint oxisData, client oxreset, client oxshutdown) |
(cleint oxisData, client oxreset, client oxshutdown) |
(oxhelp for this message, [(oxWatch) client] extension to start a log.) |
(oxhelp for this message) |
|
([(oxWatch) client] extension to start a log.) |
|
$ ex 1. (ox.sm1) run sm1connectr [(oxWatch) oxsm1.ccc] extension $ |
|
$ oxsm1.ccc ( [(cmoLispLike) 0] extension ) oxsubmit $ |
|
$ oxsm1.ccc ( [(cmoLispLike) 1] extension ) oxsubmit $ |
([(oxSerial)] extension serial-number-of-out-going-ox-packet.) |
([(oxSerial)] extension serial-number-of-out-going-ox-packet.) |
(oxpopcmo1, oxpopcmo2, sm1connect2, sm1connect3) |
(oxpopcmo1, oxpopcmo2, sm1connectr ox_launch, ox_launch_nox) |
(sm1connectr ox_launch, ox_launch_nox) |
|
(oxNoX : set an environment to invoke oxlog without xterm and to call oxlog with >& /dev/null) |
(oxNoX : set an environment to invoke oxlog without xterm and to call oxlog with >& /dev/null) |
$ ex 1. (ox.sm1) run oxNoX sm1connectr $ |
$ ex 1. (ox.sm1) run oxNoX sm1connectr $ |
$ ex 2. (oxasir.sm1) run oxNoX (x^2-1). fctr pmat ; $ |
$ ex 2. (ox.sm1) run oxNoX (x^2-1). fctr pmat ; $ |
|
$ $ |
|
$cf. extension-oxLog $ |
] |
] |
] putUsages |
] putUsages |
|
|
/oxhelp { |
[(extension-oxLog) |
(oxconnect) usage |
[ |
( ) message |
$Take the log of communication in files.$ |
(ox) usage |
$[(oxLog) client logfile_for_incomming_data logfile_for_outgoing_data] extension $ |
} def |
$Example:$ |
[(oxhelp) |
$ [(parse) (ox.sm1) pushfile] extension$ |
[(oxhelp outputs help messages for ox commands.) |
$ sm1connectr$ |
|
$ (i.t) (w) file /ii set$ |
|
$ (o.t) (w) file /oo set$ |
|
$ [(oxLog) oxsm1.ccc ii oo] extension $ |
|
$ [(oxWatch) oxsm1.ccc ] extension$ |
|
$ oxsm1.ccc 1 oxpushcmo ;$ |
|
$ oxsm1.ccc oxpopcmo ;$ |
|
$ [(oxLogStop) oxsm1.ccc] extension$ |
]] putUsages |
]] putUsages |
|
|
ox.verbose { oxhelp } { } ifelse |
/oxconnect { |
|
/arg1 set |
/sm1connect2 { |
[(oxCreateClient) arg1 aload pop] extension |
[oxpath.oxlog.xterm oxpath.ox ( -ox ) oxpath.oxsm1 |
|
oxpath.null |
|
( &)] cat system-csh |
|
% (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_sm1 &) system |
|
% For MSRI, or Eterm, |
|
%(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_sm1 &) system |
|
(If you start the server automatically, you may have a trouble to) message |
|
(oxreset. In order to avoid this trouble, start the server by hand.) message |
|
(sleep 5) system-csh |
|
[(localhost) 1300 1200] oxconnect /ox.ccc set |
|
(The server is binded to the variable ox.ccc) message |
|
ox.ccc.init |
|
} def |
} def |
|
|
/sm1connect3 { |
ox.verbose { oxhelp } { } ifelse |
[oxpath.oxlog.xterm oxpath.ox ( -ox ) oxpath.oxsm1 |
|
( -data 2300 -control 2200 ) |
|
oxpath.null |
|
( &)] cat system-csh |
|
% (kterm -iconic -e /home/nobuki/kxx/ox -ox /home/nobuki/kxx/ox_sm1 -data 2300 -control 2200 &) system-csh |
|
% For MSRI |
|
%(xterm -icon -e /u/nobuki/tmp/kxx/ox -ox /u/nobuki/tmp/Ox/ox_sm1 -data 2300 -control 2200&) system-csh |
|
(If you start the server automatically, you may have a trouble to) message |
|
(oxreset. In order to avoid this trouble, start the server by hand.) message |
|
(sleep 5) system-csh |
|
[(localhost) 2300 2200] oxconnect /ox.ccc2 set |
|
(The server is binded to the variable ox.ccc2) message |
|
} def |
|
|
|
/sm1connect4 { |
|
%% test version. |
|
/ox.ccc.portfile oxgenportfile def |
|
[oxpath.oxlog.xterm oxpath.ox ( -ox ) oxpath.oxsm1 |
|
( -portfile ) ox.ccc.portfile |
|
oxpath.null |
|
( &)] cat system-csh |
|
(sleep 5) system-csh |
|
[(oxReadPortFile) ox.ccc.portfile] extension /ox.ccc.control set |
|
ox.ccc.control message |
|
[(localhost) ox.ccc.control 1200] /ox.ccc set |
|
(The server is binded to the variable ox.ccc) message |
|
oxremoveportfile |
|
} def |
|
|
|
/oxpushcmo { oxsendcmo } def |
/oxpushcmo { oxsendcmo } def |
/oxsendcmo { |
/oxsendcmo { |
/arg1 set |
/arg1 set |
Line 215 ox.verbose { oxhelp } { } ifelse |
|
Line 153 ox.verbose { oxhelp } { } ifelse |
|
[(oxReq) arg2 SM_DUMMY_sendcmo arg1] extension pop |
[(oxReq) arg2 SM_DUMMY_sendcmo arg1] extension pop |
} def |
} def |
|
|
|
/oxpushcmotag { |
|
/arg2 set |
|
[(oxReq) arg2 SM_pushCMOtag ] extension pop |
|
} def |
|
|
/oxpopcmo { |
/oxpopcmo { |
/arg1 set |
/arg1 set |
[(oxReq) arg1 SM_popCMO ] extension pop |
[(oxReq) arg1 SM_popCMO ] extension pop |
Line 262 ox.verbose { oxhelp } { } ifelse |
|
Line 205 ox.verbose { oxhelp } { } ifelse |
|
] pop |
] pop |
popVariables |
popVariables |
} def |
} def |
/oxsetmathcap.old { |
|
/arg1 set |
|
[(oxReq) |
|
arg1 SM_setMathCap |
|
[(mathcap-object) |
|
[[199901160 (sm1)] |
|
[2130706434 , 1 , 2 , 4 , 17 , 19 , 20 , 22 , 23 , 24 , 25 , 26 , 30 ] |
|
%% mathcap for sm1. |
|
%% [1 2 3 4 5] %% for test. cf. cmoCheckMathCap, Sm1_mathcap() |
|
] |
|
] %% Never write a broken data here. |
|
] extension pop |
|
} def |
|
/oxpopcmo1 { %% ask of the transmission. |
/oxpopcmo1 { %% ask of the transmission. |
/arg1 set |
/arg1 set |
[(oxReq) arg1 SM_popCMO ] extension pop |
[(oxReq) arg1 SM_popCMO ] extension pop |
Line 332 ox.verbose { oxhelp } { } ifelse |
|
Line 263 ox.verbose { oxhelp } { } ifelse |
|
} { } ifelse |
} { } ifelse |
[(oxReq) arg2 SM_executeFunction arg1] extension pop |
[(oxReq) arg2 SM_executeFunction arg1] extension pop |
} def |
} def |
|
/oxexecWithOpt { |
|
/arg1 set |
|
/arg2 set |
|
ox.takelog { ox.log [(oxSerial)] extension ox.mod arg1 put |
|
ox.log [(oxSerial)] extension 1 add ox.mod |
|
(executeFunctionWithOptionalArgument) put |
|
} { } ifelse |
|
[(oxReq) arg2 SM_executeFunctionWithOptionalArgument arg1] extension pop |
|
} def |
|
[(oxexecWithOpt) |
|
[ |
|
$Example: $ |
|
$oxsm1.ccc (/foo { message message message } def) oxsubmit ;$ |
|
$oxsm1.ccc (hello) oxpushcmo oxsm1.ccc 1 oxpushcmo oxsm1.ccc [[(opt) 0]] oxpushcmo ;$ |
|
$oxsm1.ccc (foo) oxexecWithOpt $ |
|
] |
|
] putUsages |
/oxsubmit2 { |
/oxsubmit2 { |
oxexec |
oxexec |
} def |
} def |
Line 401 ox.verbose { oxhelp } { } ifelse |
|
Line 349 ox.verbose { oxhelp } { } ifelse |
|
}def |
}def |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
/enginescmd |
/ox_launch_nox { |
$ /computesp { |
Xm_noX /ox_launch_nox.save set |
/arg1 set |
oxNoX |
[arg1 myid] arg1 message |
ox_launch_aux |
} def |
/Xm_noX ox_launch_nox.save def |
$ |
} def |
def |
/ox_launch { |
|
ox_launch_aux |
|
} def |
|
|
|
/ox_launch_aux { |
|
/arg1 set |
|
[/in-launch_nox /pass /peer /data /control /name /machine |
|
/your-peer /comm /remoteOpenXMbin /remoteServer /myhost |
|
/argNumber /aaa /myssh |
|
] pushVariables |
|
[ |
|
/aaa arg1 def |
|
/argNumber aaa length def |
|
/machine aaa 0 get def |
|
machine (localhost) eq argNumber 5 lt and { |
|
aaa 1 get ox_launch_localhost /your-peer set |
|
/LLL.end goto |
|
} { |
|
/remoteServer aaa 1 get def |
|
/name aaa 2 get def |
|
} ifelse |
|
|
/genPairs { |
/myssh [(which) (ssh)] oxshell def |
/arg1 set |
myssh tag 0 eq { |
[/n /i /j] pushVariables |
(ssh is not found.) error |
[ |
} { } ifelse |
/n arg1 def |
|
/genPairs.list [ ] def |
|
/genPairs.i 0 def |
|
0 1 n 1 sub { |
|
/i set |
|
i 1 add 1 n 1 sub { |
|
/j set |
|
genPairs.list [i j] append /genPairs.list set |
|
} for |
|
} for |
|
/genPairs.n genPairs.list length def |
|
] pop |
|
popVariables |
|
} def |
|
|
|
/getPair { |
[(gethostname)] extension /myhost set |
[/i ] pushVariables |
|
[ |
|
genPairs.i genPairs.n lt { |
|
genPairs.list genPairs.i get /ans set |
|
genPairs.i 1 add /genPairs.i set |
|
} |
|
{ [-1 -1] /ans set} ifelse |
|
/arg1 ans def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
/sumUp { |
/pass ox_encrypt_104_genPass def |
/arg1 set |
/peer [(oxGetPort) myhost] extension def |
[/ans /v /i /n] pushVariables |
/data peer 1 get toString def |
[ |
/control peer 3 get toString def |
/v arg1 def |
peer message |
/n v length def |
peer 0 get -1 eq { |
/ans 0 def |
(Error in oxGetPort) error |
0 1 n 1 sub { |
} { } ifelse |
/i set |
[myssh ( -X -f ) machine ( -l ) name ( ) |
ans v i get add /ans set |
[ |
} for |
(ox100start ) % it must be on a path of the remote host |
/arg1 ans def |
@@@.quiet { ( -quiet ) } { } ifelse |
] pop |
Xm_noX { ( -nox ) } { } ifelse |
popVariables |
( -oxserver ) remoteServer ( -e ) |
arg1 |
( -reverse ) |
|
( -host ) myhost |
|
( -data ) data ( -control ) control pass [1 2] get |
|
] cat |
|
] cat /comm set |
|
(Executing the command : ) messagen comm message |
|
comm execve 0 lt { |
|
(Fork exec failed) error |
|
} { } ifelse |
|
% ipmask must be 1 to accept from a global address. |
|
[(oxCreateClient2) peer 1 , pass 0 get] extension /your-peer set |
|
/LLL.end |
|
/arg1 your-peer def |
|
] pop |
|
popVariables |
|
arg1 |
} def |
} def |
|
|
|
[(ox_launch) |
|
[( [remote-machine remote-ox-server-name remote-login-name] ) |
|
( ox_launch client ) |
|
$or $ |
|
$ [(localhost) ox-server-name] ox_launch client$ |
|
(This command launches ox server via ssh.) |
|
(My hostname is set by the function gethostname.) |
|
(Example 1: ) |
|
$ [(orange2-clone) $ |
|
$ (bin/ox_sm1) (taka)$ |
|
$ ] ox_launch /@@@.oxsm1 set $ |
|
]] putUsages |
|
|
/dist { |
[(ox_launch_nox) |
/dist.debug 0 def |
[( [remote-machine remote-ox-server-name remote-login-name] ) |
/result [ ] def |
( ox_launch_nox client ) |
enginesList {oxconnect} map /engines set |
(Example 1: ) |
/enginesN engines length def |
$ [(tau.math.kobe-u.ac.jp) $ |
% broadcast the program. |
$ (bin/ox_math) (taka) $ |
(ox-1.sm1) pushfile /enginescmd set %% read a file. |
$ ] ox_launch_nox /@@@.oxmath set $ |
[(parse) enginescmd] extension |
]] putUsages |
engines {enginescmd oxsubmit} map |
|
engines { (slave-start) oxsubmit} map %% initialize slave codes. |
|
%% send pid. |
|
0 1 enginesN 1 sub { |
|
/i set |
|
engines i get i oxsendcmo |
|
engines i get (/myid set) oxsubmit |
|
} for |
|
|
|
master-start %% initialize master codes |
/ox_launch_localhost { |
%% gbsize genPairs %% obsolete |
/arg1 set |
/gbsize ans length def |
[/in-ox_launch_localhost /pass /peer /data /control /oxserver |
ans makePairs /genPairs.list set |
/my-peer] pushVariables |
/genPairs.i 0 def /genPairs.n genPairs.list length def |
[ |
|
/oxserver arg1 def |
|
/pass ox_encrypt_104_genPass def |
|
/peer [(oxGetPort) (localhost)] extension def |
|
/data peer 1 get toString def |
|
/control peer 3 get toString def |
|
peer message |
|
[ |
|
oxstart100 |
|
@@@.quiet { ( -quiet ) } { } ifelse |
|
Xm_noX { ( -nox ) } { } ifelse |
|
( -oxserver ) oxserver ( -e ) |
|
( -reverse ) |
|
( -data ) data ( -control ) control pass [1 2] get |
|
] cat execve |
|
[(oxCreateClient2) peer 0 pass 0 get] extension /my-peer set |
|
%% 0 means connect from only localhost. |
|
/arg1 my-peer def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
/exhausted 0 def |
/oxrpc2 { |
% clear the busy flag. |
/arg2 set |
/busy [1 1 enginesN { pop 0 } for ] def |
/arg1 set |
(date) system-csh |
[/in-oxrpc2 /pid /n /comm /i] pushVariables |
{{ |
[ |
exhausted 0 eq { |
/pid arg1 def |
0 1 enginesN 1 sub { |
/comm arg2 def |
/i set |
/n comm length def |
busy i get 0 eq { |
n 1 sub -1 1 { |
getPair /p set |
/i set |
p 0 get -1 eq {/exhausted 1 def exit} { } ifelse |
pid comm i get oxsendcmo |
busy i 1 put |
} for |
engines i get p oxsendcmo |
pid n 1 sub oxsendcmo |
engines i get ( computesp ) oxsubmit |
pid comm 0 get oxexec |
engines i get oxpopcmo1 |
] pop |
} { } ifelse |
popVariables |
} for |
|
} { } ifelse |
|
dist.debug { (busy=) messagen busy message } { } ifelse |
|
busy sumUp 0 eq { result message exit error } { } ifelse |
|
[(oxMultiSelect) engines -1] extension /status set |
|
/datastatus status 1 get def |
|
dist.debug { (datastatus=) messagen datastatus message } { } ifelse |
|
0 1 enginesN 1 sub { |
|
/i set |
|
datastatus i get 1 eq { |
|
engines i get oxpopcmo2 /ans set |
|
busy i 0 put |
|
result ans append /result set |
|
} { } ifelse |
|
} for |
|
} loop } timer |
|
(date) system-csh |
|
(result is in result) message |
|
(Number of s-pairs checked is ) messagen result length message |
|
} def |
} def |
|
|
ox.verbose { |
[(oxrpc2) |
(dist for experiments for distributed computing. cf. startengines) message |
[(Remote procedure call by using oxexec) |
} { } ifelse |
(client [function-name arg1 arg2 ...] oxrpc2 ) |
|
(cf. ox-cmo-rpc in Risa/Asir) |
|
(Example: ) |
|
$ (oxasir.sm1) run (x^2-1). fctr $ |
|
(oxasir.ccc [(igcd) (6).. (10)..] oxrpc2) |
|
(oxasir.ccc oxpopcmo :: ) |
|
] |
|
] putUsages |
|
|
/oxIsServerReady { |
/oxIsServerReady { |
/arg1 set |
/arg1 set |
|
|
arg1 |
arg1 |
} def |
} def |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%%% Functions to start server by OX-RFC-101 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
/sm1StartControl101 { |
|
[/in-sm1connectr /pass /peer /data /control ] pushVariables |
|
[ |
|
/pass ox_encrypt_104_genPass def |
|
/peer [(oxGetPort1) (localhost)] extension def |
|
/data peer 1 get toString def |
|
peer message |
|
[(/home/nobuki/OpenXM/src/oxc/oxc) |
|
( -c ) pass ( -h ) (localhost) ( -p ) data ( -x ) |
|
oxpath.null |
|
( &)] cat system-csh |
|
|
%%%%%%%%%%%%%%% tests |
[(oxCreateControl_RFC_101) peer 0 pass] extension /oxsm1.ccc set |
ox.verbose { |
%% 0 means connect from only localhost. |
(test10 : test to read and write ox-data and ox-command to a file) message |
/ox.ccc oxsm1.ccc def |
} { } ifelse |
(The server is binded to the variable oxsm1.ccc) message-quiet |
|
oxsm1.ccc |
|
] pop |
|
popVariables |
|
} def |
|
|
/test10 { |
/sm1StartEngine101 { |
[(oxCreateClientFile) (afo) (w)] extension /ccc set |
[/in-sm1StartEngine101 /peer /data /control /engineID] pushVariables |
[(oxWatch) ccc] extension |
[ |
ccc (x-1). oxsendcmo |
/peer [(oxGetPort1) (localhost)] extension def |
[(oxReq) ccc SM_executeStringByLocalParser |
/data peer 1 get def |
( dup add message )] extension pop |
|
ccc (quit) oxsendcmo |
|
|
|
[(oxCloseClient) ccc] extension |
oxsm1.ccc data oxpushcmo |
|
oxsm1.ccc (/home/nobuki/OpenXM/bin/ox_sm1) oxpushcmo |
|
[(oxPushCMD) oxsm1.ccc SM_control_spawn_server] extension |
|
oxsm1.ccc oxpopcmo /engineID set |
|
[(oxCreateEngine_RFC_101) peer 0 (Empty) engineID] extension |
|
/ox.ddd set |
|
(The engine is binded to the variables ox.ddd) message-quiet |
|
] pop |
|
popVariables |
|
arg1 |
} def |
} def |
|
|
/test11 { |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
[(oxCreateClientFile) (afo) (r)] extension /ccc set |
%%% Functions for OX-RFC 103 |
[(oxGet) ccc] extension :: |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
[(oxGet) ccc] extension :: |
[(chattr) 0 /ctrlC-hook] extension |
|
/ctrlC-hook { |
|
ox103_reset |
} def |
} def |
|
/ox103_disable { |
|
[(chattr) 0 /ctrlC-hook] extension |
|
/ctrlC-hook { } def |
|
} def |
|
|
ox.verbose { |
[(ox103_reset) |
(test12 : ccc is the client. ff poly in Q<x,y,z,dx,dy,dz> ) message |
[(ox103_reset broadcasts the OX reset to all processes) |
} { } ifelse |
(cf. ctrlC-hook, register_hander) |
/test12 { |
]] putUsages |
[(localhost) 1300 1200] oxconnect /ccc set |
/ox103_reset { |
[(x,y,z) ring_of_differential_operators ( ) elimination_order 0] define_ring |
[/in-ox103_reset /L /n /i] pushVariables |
(x+y). /ff set |
[ |
/eee (hello) (error) dc def |
/L [(oxGetClientList)] extension def |
/eee0 eee (error) dc def |
(In ox103_reset...) message |
(eee is the CMO_ERROR2 object [CMO_ERROR2 hello], eee0 is the CMO_ERROR object) message |
(killall in oxshell...) message [(killall)] oxshell pop |
|
/n L length def |
|
0 1 n 1 sub { |
|
/i set |
|
L i get oxreset |
|
} for |
|
(Done) message |
|
] pop |
|
popVariables |
} def |
} def |
|
|
|
%%%%%%% |
|
/ox103_asir_init { |
|
/arg1 set |
|
[/ttt] pushVariables |
|
[ |
|
/ttt arg1 def |
|
%% ttt oxsetmathcap ttt oxmathcap %% It is done in asir.init |
|
%% Do nothing special for now. |
|
] pop |
|
popVariables |
|
} def |
|
/ox103_sm1_init { |
|
/arg1 set |
|
[/ttt] pushVariables |
|
[ |
|
/ttt arg1 def |
|
ttt oxsetmathcap |
|
ttt oxmathcap |
|
ttt ([(parse) (oxrfc103.sm1) pushfile] extension ) oxsubmit |
|
] pop |
|
popVariables |
|
} def |
|
%%% |
|
|
|
/Xm_rfc103_shared [ ] def |
|
|
|
[(ox103_set_shared_variable) |
|
[(value name 2 ox103_set_shared_variable) |
|
(It broadcasts the <<value>> of a shared variable <<name>>) |
|
(to all processes.) |
|
(cf. Xm_rfc103_shared, ) |
|
$Example: (2).. (hoge) 2 ox103_set_shared_variable$ |
|
]] putUsages |
|
/ox103_set_shared_variable { |
|
/arg0 set %% Dummy to be called by rpc2. Number of args |
|
/arg1 set %% Name |
|
/arg2 set %% Value, [Name Value] not [Value Name] |
|
[/in-ox103_set_shared_variable /Name /Value |
|
/Found /N /i /L |
|
] pushVariables |
|
[ |
|
/Name arg1 def |
|
/Value arg2 def |
|
Value message |
|
/Found 0 def |
|
/N Xm_rfc103_shared length def |
|
0 1 N 1 sub { |
|
/i set |
|
Xm_rfc103_shared i get 0 get |
|
Name eq { |
|
Xm_rfc103_shared i [Name Value] put |
|
/Found 1 def |
|
exit |
|
} { } ifelse |
|
} for |
|
Found 1 eq { } |
|
{ |
|
Xm_rfc103_shared [Name Value] append |
|
/Xm_rfc103_shared set |
|
} ifelse |
|
/L [(oxGetClientList)] extension def |
|
0 1 L length 1 sub { |
|
/i set |
|
L i get [(ox103_set_shared_variable) Name Value] oxrpc2 |
|
} for |
|
|
|
(ox103_set_shared_variable: Xm_rfc103_shared=) message |
|
Xm_rfc103_shared message |
|
%% [(parse) [(/) Name ( ) Value toString ( def )] cat] extension |
|
%% Add $ $ when Value is a string. |
|
|
|
/arg1 [Name Value] def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
/ox103_test { |
|
(x^2-1). fctr |
|
oxasir.ccc ( sm1_start(); ) oxexecutestring |
|
sm1connectr |
|
} def |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%%%%%%%% Starting ox_sm1. |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
/sm1connectr { |
/sm1connectr { |
[/in-sm1connectr /pass /peer /data /control ] pushVariables |
[/in-sm1connectr /pass /peer /data /control ] pushVariables |
[ |
[ |
/pass [(oxGenPass)] extension def |
[(getServerEnv) (bin/ox_sm1)] extension tag 0 eq { |
|
(Server bin/ox_sm1 is not found.) error |
|
}{ } ifelse |
|
/pass ox_encrypt_104_genPass def |
/peer [(oxGetPort) (localhost)] extension def |
/peer [(oxGetPort) (localhost)] extension def |
/data peer 1 get toString def |
/data peer 1 get toString def |
/control peer 3 get toString def |
/control peer 3 get toString def |
peer message |
peer message-quiet |
[oxpath.oxlog.xterm oxpath.ox ( -reverse -ox ) oxpath.oxsm1 |
[ |
( -data ) data ( -control ) control ( -pass ) pass |
oxstart100 |
oxpath.null |
@@@.quiet { ( -quiet ) } { } ifelse |
( &)] cat system-csh |
Xm_noX { ( -nox ) } { } ifelse |
[(oxCreateClient2) peer 0 pass] extension /ox.ccc set |
Xm_engineLogToStdout { ( -nox -engineLogToStdout ) } { } ifelse %bug.onlyForsm1 |
|
( -oxserver bin/ox_sm1 -e ) ( -reverse ) |
|
( -data ) data ( -control ) control pass [1 2] get |
|
( )] cat execve |
|
[(oxCreateClient2) peer 0 pass 0 get] extension /oxsm1.ccc set |
%% 0 means connect from only localhost. |
%% 0 means connect from only localhost. |
(The server is binded to the variable ox.ccc) message |
(The server is binded to the variable oxsm1.ccc) message-quiet |
ox.ccc.init |
/ox.ccc oxsm1.ccc def |
|
oxsm1.ccc.init |
|
oxsm1.ccc |
] pop |
] pop |
popVariables |
popVariables |
} def |
} def |
|
|
|
/oxsm1.ccc.init { |
|
oxsm1.ccc ( [(oxPrintMessage) 0] extension pop ) oxsubmit |
|
Xm_noX { oxsm1.ccc ( /@@@.Xm_noX 1 def ) oxsubmit } |
|
{ oxsm1.ccc ( /@@@.Xm_noX 0 def ) oxsubmit } ifelse |
|
(Ox103_loaded) boundp |
|
{ oxsm1.ccc ox103_sm1_init } |
|
{ } ifelse |
|
} def |
|
|
/sm1connectr-ssh { |
/sm1connectr-ssh { |
|
%% It has not yet implemented. |
/arg1 set |
/arg1 set |
[/in-sm1connectr /pass /peer /data /control /name /machine |
[/in-sm1connectr /pass /peer /data /control /name /machine |
/your-peer /comm |
/your-peer /comm |
|
|
/machine arg1 0 get def |
/machine arg1 0 get def |
/name arg1 1 get def |
/name arg1 1 get def |
|
|
/pass [(oxGenPass)] extension def |
/pass ox_encrypt_104_genPass def |
/peer [(oxGetPort) myhostname-ssh] extension def |
/peer [(oxGetPort) myhostname-ssh] extension def |
/data peer 1 get toString def |
/data peer 1 get toString def |
/control peer 3 get toString def |
/control peer 3 get toString def |
peer message |
peer message-quiet |
[(ssh -f ) machine ( -l ) name ( ") |
[(ssh -f ) machine ( -l ) name ( ") |
oxpath.oxlog.xterm-ssh oxpath.ox-ssh ( -reverse -ox ) oxpath.oxsm1-ssh |
oxpath.oxlog.xterm-ssh oxpath.ox-ssh ( -reverse -ox ) oxpath.oxsm1-ssh |
( -host ) myhostname-ssh |
( -host ) myhostname-ssh |
( -data ) data ( -control ) control ( -pass ) pass |
( -data ) data ( -control ) control pass [1 2] get |
oxpath.null |
oxpath.null |
( ") |
( ") |
] cat /comm set |
] cat /comm set |
(Executing the command : ) messagen comm message message |
(Executing the command : ) messagen comm message message |
comm system |
comm system |
(sleep 5) system-csh |
(sleep 5) system-csh |
[(oxCreateClient2) peer 1 pass] extension /your-peer set |
[(oxCreateClient2) peer 1 pass 0 get] extension /your-peer set |
/arg1 your-peer def |
/arg1 your-peer def |
] pop |
] pop |
popVariables |
popVariables |
|
|
$ [(dc2.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set $ |
$ [(dc2.math.kobe-u.ac.jp) (taka)] sm1connectr-ssh /ox.ccc set $ |
]] putUsages |
]] putUsages |
|
|
/addSlash { |
%%% ntl |
|
/ntlconnectr { |
|
[/in-ntlconnectr /pass /peer /data /control ] pushVariables |
|
[ |
|
[(getServerEnv) (bin/ox_ntl)] extension tag 0 eq { |
|
(Server bin/ox_ntl is not found.) error |
|
}{ } ifelse |
|
/pass ox_encrypt_104_genPass def |
|
/peer [(oxGetPort) (localhost)] extension def |
|
/data peer 1 get toString def |
|
/control peer 3 get toString def |
|
peer message-quiet |
|
[ |
|
oxstart100 |
|
Xm_noX { ( -nox ) } { } ifelse |
|
( -oxserver bin/ox_ntl -e ) ( -reverse ) |
|
( -data ) data ( -control ) control pass [1 2] get |
|
( )] cat execve |
|
[(oxCreateClient2) peer 0 pass 0 get] extension /oxntl.ccc set |
|
%% 0 means connect from only localhost. |
|
(The server is binded to the variable oxntl.ccc) message-quiet |
|
% oxntl.ccc.init |
|
oxntl.ccc |
|
] pop |
|
popVariables |
|
} def |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%%% Aux functions for ox_asir |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
/ox_asirConnectMethod { asirconnectr /oxasir.ccc set } def |
|
/oxasir.loadmethod 1 def %% "..." oxsendcmo (load) ox... |
|
/oxasir.verbose 0 def |
|
/oxasir.ccc load isArray |
|
{ } |
|
{ /oxasir.ccc [ ] def } ifelse |
|
/loadAsirFile { |
/arg1 set |
/arg1 set |
[/in-addSlash /ss /aaa /ans] pushVariables |
[/in-loadAsirFile /peer /fname] pushVariables |
[ |
[ |
/ss arg1 def |
/peer arg1 0 get def |
ss (array) dc /aaa set |
/fname arg1 1 get def |
aaa length 0 eq { |
oxasir.loadmethod { |
/ans (/) def |
peer fname oxsendcmo peer 1 oxsendcmo |
|
peer (load) oxexec |
}{ |
}{ |
aaa aaa length 1 sub get 47 eq %% The last equals / ? |
peer [$load("$ fname $");$] cat oxsubmit |
{ |
}ifelse |
/ans ss def |
|
}{ |
|
/ans [ss (/)] cat def |
|
} ifelse |
|
} ifelse |
|
/arg1 ans def |
|
] pop |
] pop |
arg1 |
popVariables |
} def |
} def |
|
[(loadAsirFile) |
|
[$[client fname] loadAsirFile (ox_asir function)$ |
|
$Load a file into the client$ |
|
]] putUsages |
|
|
/getPathNameSm1 { |
/set_oxasir.rr_path { |
|
[(ostype)] extension 0 get (windows) eq { |
|
[(getenv) (OSTYPE)] extension tag 0 eq { |
|
/oxasir.rr.name (oxasir-win.rr) def |
|
}{ |
|
[(getenv) (OSTYPE)] extension (cygwin) eq { |
|
/oxasir.rr.name (oxasir.asir) def |
|
}{ |
|
/oxasir.rr.name (oxasir-win.rr) def |
|
} ifelse |
|
} ifelse |
|
}{ |
|
/oxasir.rr.name (oxasir.asir) def |
|
} ifelse |
|
} def |
|
set_oxasir.rr_path |
|
/oxasirpath.asirlib [[(getenv) (OpenXM_HOME)] extension |
|
(/lib/sm1/) oxasir.rr.name] cat def |
|
oxasir.verbose { |
|
oxasirpath.asirlib message |
|
} { } ifelse |
|
|
|
%% Note. oxasir.asir is under OpenXM/src/kan96xx/lib/ |
|
%% oxasir-win.asir is generated under OpenXM/misc/packages/Windows |
|
%% They are installed under $OpenXM_HOME/lib/sm1 |
|
%% Todo: ox_asir has to understand /cygdrive/c/... on windows-native. |
|
%% Since ox_asir is generated by cygwin, it will be OK. |
|
/asir.init { |
|
%% gr and primdec are loaded by .asirrc |
|
/asir.init.peer set |
|
[(ostype)] extension 0 get (windows) eq { |
|
[(getenv) (OSTYPE)] extension tag 0 eq { |
|
[asir.init.peer (oxasir-win.rr)] oxasirParseFile |
|
}{ |
|
[(getenv) (OSTYPE)] extension (cygwin) eq { |
|
[asir.init.peer oxasirpath.asirlib] loadAsirFile |
|
}{ |
|
[asir.init.peer (oxasir-win.rr)] oxasirParseFile |
|
} ifelse |
|
} ifelse |
|
}{ |
|
[asir.init.peer oxasirpath.asirlib] loadAsirFile |
|
} ifelse |
|
asir.init.peer oxmathcap |
|
asir.init.peer oxsetmathcap |
|
Xm_noX { |
|
asir.init.peer (Xm_noX=1;) oxsubmit |
|
}{ |
|
asir.init.peer (Xm_noX=0;) oxsubmit |
|
} ifelse |
|
(Ox103_loaded) boundp |
|
{ |
|
asir.init.peer ox103_asir_init |
|
}{ } ifelse |
|
} def |
|
|
|
[(asir) |
|
[(pid [asir-command, asir-arg1, asir-arg2, ...] asir result (ox_asir function)) |
|
(Call open asir server. You need to install ox_asir on your system) |
|
(to use this function. cf. primadec, fctr, asirconnect2, asirconnectr.) |
|
(If you interrupted the computation by typing ctrl-C, type in ) |
|
( oxasir.ccc oxreset ; ) |
|
(to interrupt the ox_asir server.) |
|
(NOTE: all asir-args must belong to the same ring. cf.oxasir.changeRing. ) |
|
(Example: oxasir.ccc [(fctr) (x^10-1).] asir ) |
|
( ) |
|
(This function requires plugins cmo, socket and ox_asir server. cf. oxasir) |
|
(See, http://www.math.kobe-u.ac.jp/Asir on asir) |
|
] |
|
] putUsages |
|
|
|
/asir { |
|
/arg2 set |
/arg1 set |
/arg1 set |
[/in-getPathNameSm1 /fname /fullname /tname] pushVariables |
[/pid /asir-comm /comm /n /i /rr] pushVariables |
|
[(CurrentRingp)] pushEnv |
[ |
[ |
/fname arg1 0 get def |
/pid arg1 def |
%% If fullname is given, use it. |
/asir-comm arg2 def |
fname (array) dc 0 get |
pid tag 6 eq { } { (Invalid pid. See asir.) error } ifelse |
(/) (array) dc 0 get eq |
pid 0 get (client) eq { } { (Invalid pid. See asir.) error } ifelse |
{ /fullname fname def |
asir-comm tag 6 eq { } { (Invalid argument asir-comm. See asir) error } ifelse |
/getPathNameSm1.LLL goto |
|
} { } ifelse |
|
|
|
%% Else first try to find it in LOAD_SM1_PATH |
[ %% Change the current ring if necessary to send a correct OxVlist. |
[(getenv) (LOAD_SM1_PATH)] extension /tname set |
asir-comm oxasir.changeRing |
tname isString |
] pop |
{ |
%%% Setting OxVlist to tell asir a way to change dist-poly <==> poly. |
tname addSlash /tname set |
(OxVlist=) getVlist2 toString (;) 3 cat_n /comm set |
[(stat) [tname fname] cat] extension |
%% comm message |
0 get isInteger %% The file was found. |
pid comm oxsubmit |
{ /fullname [tname fname] cat def |
pid (print(OxVlist);) oxsubmit |
/getPathNameSm1.LLL goto |
|
} { } ifelse |
|
} { } ifelse |
|
|
|
%% Else first try to find it in OpenXM_HOME |
|
[(getenv) (OpenXM_HOME)] extension /tname set |
|
tname isString |
|
{ |
|
tname addSlash /tname set |
|
[tname (lib/sm1/)] cat /tname set |
|
[(stat) [tname fname] cat] extension |
|
0 get isInteger %% The file was found. |
|
{ /fullname [tname fname] cat def |
|
/getPathNameSm1.LLL goto |
|
} { } ifelse |
|
} { } ifelse |
|
|
|
%% Else try to find it in /usr/local/lib/sm1 |
/n asir-comm length def |
[(stat) [(/usr/local/lib/sm1/) fname] cat] extension |
n 1 sub -1 1 { |
0 get isInteger %% The file was found. |
/i set |
{ /fullname [(/usr/local/lib/sm1/) fname] cat def |
pid asir-comm i get oxsendcmo |
/getPathNameSm1.LLL goto |
pid 1 oxsendcmo pid (ox_dtop) oxexec |
} { } ifelse |
} for |
|
pid n 1 sub oxsendcmo |
|
pid asir-comm 0 get oxexec |
|
|
%% Otherwise error. |
pid 1 oxsendcmo pid (ox_ptod) oxexec |
[(getPathNameSm1: The file ) fname |
pid oxpopcmo /arg1 set |
( could not be found ) |
|
(neigher in LOAD\_SM1\_PATH=) |
|
[(getenv) (LOAD_SM1_PATH)] extension |
|
( nor in OpenXM\_HOME/lib/sm1=) |
|
[(getenv) (OpenXM_HOME)] extension |
|
(/lib/sm1) |
|
( nor in /usr/local/lib/sm1) |
|
] cat /getPathNameSm1.errorMessage set |
|
getPathNameSm1.errorMessage message |
|
] pop popVariables getPathNameSm1.errorMessage error |
|
|
|
/getPathNameSm1.LLL |
|
/arg1 fullname def |
|
] pop |
] pop |
|
popEnv |
popVariables |
popVariables |
arg1 |
arg1 |
} def |
} def |
[(getPathNameSm1) |
|
[([fname] getPathNameSm1 fullname) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
(string fname, fullname) |
%%% Mathematical functions for asir |
(This command searches the fname in LOAD_SM1_PATH, ) |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
(OpenXM_HOME/lib/sm1, and /usr/local/lib/sm1) |
/oxasir.changeRing { |
(It returns the fullname.) |
/oxasir.changeRing.rr.prev 0 def |
|
oxasir.changeRing2 |
|
} def |
|
/oxasir.changeRing2 { |
|
/arg1 set |
|
[/in-oxasir.changeRing2 /f /rr ] pushVariables |
|
[ |
|
/f arg1 def |
|
f isArray { |
|
f {oxasir.changeRing2} map |
|
}{ |
|
f isPolynomial { |
|
f (0). eq { } |
|
{ f (ring) dc /rr set [(CurrentRingp) rr] system_variable |
|
oxasir.changeRing.rr.prev tag 1 eq { } |
|
{ |
|
oxasir.changeRing.rr.prev rr eq { } |
|
{ (asir : arguments must belong to the same ring.) error } ifelse |
|
} ifelse |
|
/oxasir.changeRing.rr.prev rr def |
|
} ifelse |
|
} { } ifelse |
|
} ifelse |
|
] pop |
|
popVariables |
|
} def |
|
|
|
/fctr { |
|
/arg1 set |
|
[/f /comm /vv] pushVariables |
|
[(CurrentRingp)] pushEnv |
|
[ |
|
/f arg1 def |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
|
|
f isPolynomial not { |
|
/vv f 1 get def |
|
vv isArray { /vv vv from_records def } { } ifelse |
|
/f f 0 get def |
|
[vv ring_of_polynomials 0] define_ring |
|
f . /f set |
|
}{ } ifelse |
|
oxasir.ccc [(fctr) f] asir /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
[(fctr) |
|
[(You need to install ox_asir server to use this function. (ox_asir function)) |
|
(f fctr g) |
|
(poly f; array g;) |
|
([f v] fctr g ; string f, string or array of string v) |
|
(This function factors the polynomial f over Q.) |
|
( ) |
|
(Example 1: [(x^10-y^10) (x,y)] fctr ::) |
|
(Example 2: (x^10-1). fctr ::) |
|
( ) |
|
(If you interrupted the computation by typing ctrl-C, type in ) |
|
( oxasir.ccc oxreset ; ) |
|
(to interrupt the ox_asir server.) |
|
( ) |
|
(This function requires plugins cmo, socket and ox_asir server. cf.oxasir) |
]] putUsages |
]] putUsages |
|
|
/getPathNameAsir { |
|
|
[(primadec) |
|
[(You need to install ox_asir server to use this function. (ox_asir function)) |
|
([ ii ] primadec [[q1 p1] [q2 p2] ... ] ) |
|
( array of poly ii; array of poly q1, p1, q2, p2 ...;) |
|
( q1, q2, ... are primary components of the primary ideal decomposition) |
|
( of the ideal generated by << ii >>.) |
|
( ) |
|
([ ii v ] primadec [[q1 p1] [q2 p2] ... ] ) |
|
( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;) |
|
(<< v >> is an array of independent variables.) |
|
( ) |
|
([ ii v ] primadec [[q1 p1] [q2 p2] ... ] ) |
|
( array of poly or string ii; array of string v; array of poly q1, p1, q2, p2 ...;) |
|
( v is a string of variables separated by , ) |
|
( ) |
|
(Example: [(x,y) ring_of_polynomials 0] define_ring) |
|
( [ [(x^2-1). (x y).] ] primadec pmat ;) |
|
( ) |
|
(Example: [ [(x^2-1) (x y)] [(x) (y)]] primadec pmat ;) |
|
( ) |
|
(If you interrupted the computation by typing ctrl-C, type in ) |
|
( oxasir.ccc oxreset ; ) |
|
(to interrupt the ox_asir server.) |
|
( ) |
|
(This function requires plugins cmo, socket and ox_asir server. cf.oxasir) |
|
]] putUsages |
|
|
|
/primadec { |
/arg1 set |
/arg1 set |
[/in-getPathNameAsir /fname /fullname /tname] pushVariables |
[/in-primadec /aa /f /comm /vvv /r /setarg] pushVariables |
|
[(CurrentRingp)] pushEnv |
[ |
[ |
/fname arg1 0 get def |
/aa arg1 def |
%% If fullname is given, use it. |
aa isArray { } { (<<array>> primadec) error } ifelse |
fname (array) dc 0 get |
/setarg 0 def |
(/) (array) dc 0 get eq |
oxasir.ccc [ ] eq { |
{ /fullname fname def |
(Starting ox_asir server.) message |
/getPathNameAsir.LLL goto |
ox_asirConnectMethod |
} { } ifelse |
} { } ifelse |
|
aa { tag } map /typev set |
|
typev [ ArrayP ] eq |
|
{ /f aa 0 get def |
|
f 0 get (ring) dc /r set |
|
[(CurrentRingp) r] system_variable |
|
/vvv getVariableNames def |
|
/setarg 1 def |
|
} { } ifelse |
|
typev [ArrayP StringP] eq |
|
{ /f aa 0 get def |
|
/vvv [ aa 1 get to_records pop ] def |
|
/setarg 1 def |
|
} { } ifelse |
|
typev [ArrayP ArrayP] eq |
|
{ /f aa 0 get def |
|
/vvv aa 1 get {toString} map def |
|
/setarg 1 def |
|
} { } ifelse |
|
setarg { } { (primadec : Argument mismatch) error } ifelse |
|
|
%% Else try to find it in ASIR_LIBDIR |
f 0 get isPolynomial { |
[(getenv) (ASIR_LIBDIR)] extension /tname set |
/r f 0 get (ring) dc def |
tname isString |
/vvv vvv { r __ } map def |
{ |
} |
[(stat) [tname (/) fname] cat] extension |
{ |
0 get isInteger %% The file was found. |
[vvv from_records ring_of_polynomials 0] define_ring |
{ /fullname [tname (/) fname] cat def |
f { toString . } map /f set |
/getPathNameAsir.LLL goto |
vvv { . } map /vvv set |
} { } ifelse |
} ifelse |
|
oxasir.ccc [(primadec) f vvv] asir /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
|
|
/getVlist2 { |
|
[/n /i ] pushVariables |
|
[ |
|
/n [(N)] system_variable def |
|
[ |
|
0 1 n 1 sub { /i set (x) i (dollar) dc 2 cat_n } for |
|
0 1 n 1 sub { /i set (d) i (dollar) dc 2 cat_n } for |
|
] /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
%%%%%%%%%%%%%%%%%%% |
|
/getVlist { |
|
[/n /i ] pushVariables |
|
[ |
|
/n [(N)] system_variable def |
|
[ |
|
0 1 n 1 sub { /i set [(x) (var) i] system_variable } for |
|
0 1 n 1 sub { /i set [(D) (var) i] system_variable } for |
|
] /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
/polygcd { |
|
/arg1 set |
|
[/pp /f /g /comm /vv] pushVariables |
|
[(CurrentRingp)] pushEnv |
|
[ |
|
/pp arg1 def |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
|
|
pp isArray { |
|
/f pp 0 get def |
|
/g pp 1 get def |
|
pp length 3 eq { |
|
/vv pp 2 get def |
|
vv isArray { /vv vv from_records def } { } ifelse |
|
[vv ring_of_polynomials 0] define_ring |
|
f . /f set |
|
g . /g set |
|
} { } ifelse |
|
}{ (usage: [f g] polygcd) error } ifelse |
|
oxasir.ccc [(gcd) f g] asir /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
[(polygcd) |
|
[( [f g] polygcd r ) |
|
( [f g v] polygcd r) |
|
(Example: [(x^2-1) (x-1) [(x)]] polygcd ) |
|
] |
|
] putUsages |
|
/polylcm { |
|
/arg1 set |
|
[/pp /f /g /comm /vv] pushVariables |
|
[(CurrentRingp)] pushEnv |
|
[ |
|
/pp arg1 def |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
|
|
pp isArray { |
|
/f pp 0 get def |
|
/g pp 1 get def |
|
pp length 3 eq { |
|
/vv pp 2 get def |
|
vv isArray { /vv vv from_records def } { } ifelse |
|
[vv ring_of_polynomials 0] define_ring |
|
f . /f set |
|
g . /g set |
|
} { } ifelse |
|
}{ (usage: [f g] polylcm) error } ifelse |
|
oxasir.ccc [(lcm) f g] asir /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
[(polylcm) |
|
[( [f g] polylcm r ) |
|
( [f g v] polylcm r) |
|
(Example: [(x^2-1) (x-1) [(x)]] polylcm ) |
|
] |
|
] putUsages |
|
|
|
/asir_red { |
|
/arg1 set |
|
[/pp /f /g /rr /vv] pushVariables |
|
[(CurrentRingp)] pushEnv |
|
[ |
|
/pp arg1 def |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
{ |
|
pp isRational { |
|
/f pp numerator def |
|
/g pp denominator def |
|
[[f g]] reduceByAsir /rr set |
|
}{ } ifelse |
|
exit |
|
|
|
pp isArray { |
|
/vv pp 2 get def |
|
/f pp 0 get 0 get def |
|
/g pp 0 get 1 get def |
|
[[f toString g toString] vv] reduceByAsir /rr set |
} { } ifelse |
} { } ifelse |
|
exit |
%% Else try to find it in /usr/local/lib/asir |
|
[(stat) [(/usr/local/lib/asir/) fname] cat] extension |
|
0 get isInteger %% The file was found. |
|
{ /fullname [(/usr/local/lib/asir/) fname] cat def |
|
/getPathNameAsir.LLL goto |
|
} { } ifelse |
|
|
|
%% Otherwise error. |
(asir_red: not implemented) error exit |
[ (getPathNameAsir: The file ) |
} loop |
fname (ox_asir) eq |
|
{(ox\_asir)} { fname }ifelse |
|
( could not be found ) |
|
(neigher in /usr/local/lib/asir nor in ASIR\_LIBDIR. ) |
|
] cat /getPathNameAsir.errorMessage set |
|
getPathNameAsir.errorMessage message |
|
] pop popVariables getPathNameAsir.errorMessage error |
|
|
|
/getPathNameAsir.LLL |
rr 1 get isPolynomial { |
/arg1 fullname def |
rr 0 get rr 1 get div /rr set |
|
}{ |
|
rr 1 get (1).. eq { |
|
rr 0 get /rr set |
|
}{ |
|
rr 0 get rr 1 get div /rr set |
|
} ifelse |
|
} ifelse |
|
|
|
/arg1 rr def |
] pop |
] pop |
|
popEnv |
popVariables |
popVariables |
arg1 |
arg1 |
} def |
} def |
[(getPathNameAsir) |
[(asir_red) |
[([fname] getPathNameAsir fullname) |
[(Calling the function red of asir. It simplifies a rational function.) |
(string fname, fullname) |
(cf. cancel) |
(This command searches the fname in /usr/local/lib/asir and ASIR_LIBDIR) |
(Example: (x^2). (x). div asir_red ) |
(and returns the fullname.) |
|
]] putUsages |
]] putUsages |
|
|
|
/asir_fctr { fctr } def |
|
[(asir_fctr) |
|
[(Calling the factorizer of asir.) |
|
]] putUsages |
|
|
/ox_launch_nox { |
/asir_primadec { primadec } def |
/@@@.ox_launch_nox 1 def |
[(asir_primadec) |
ox_launch_aux |
[(Calling the primadec of asir.) |
|
]] putUsages |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
[(chattr) 0 /findIntegralRoots] extension pop |
|
/findIntegralRoots { |
|
/arg1 set |
|
[/in-findIntegralRoots /pp ] pushVariables |
|
[ |
|
/pp arg1 def |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
oxasir.ccc oxIsServerReady |
|
{ pp findIntegralRoots.oxasir /arg1 set} |
|
{ pp findIntegralRoots.slow /arg1 set} ifelse |
|
] pop |
|
popVariables |
|
arg1 |
} def |
} def |
/ox_launch { |
|
/@@@.ox_launch_nox 0 def |
/findIntegralRoots.oxasir { |
ox_launch_aux |
/arg1 set |
|
[/in-findIntegralRoots /f /r /g /aa /rlist] pushVariables |
|
[(CurrentRingp) (KanGBmessage)] pushEnv |
|
[ |
|
/f arg1 def |
|
[(s) ring_of_polynomials 0] define_ring |
|
f toString . /f set |
|
f fctr rest /g set |
|
g { |
|
0 get /aa set |
|
aa (s). degree 1 eq { |
|
aa (s). coeff 1 get /aa set |
|
aa length 1 eq { 0 } |
|
{ aa 0 get (1). eq { |
|
0 << aa 1 get (integer) dc >> sub |
|
} { } ifelse |
|
} ifelse |
|
}{ } ifelse |
|
} map |
|
/rlist set |
|
%% rlist :: |
|
[-1000000] rlist join shell rest /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
} def |
} def |
|
|
/ox_launch_aux { |
%%%%%%%%%%%%% From gbhg3/Int/intw.sm1 |
/arg1 set |
%% This function needs solv1.asir and ox_asir. |
[/in-launch_nox /pass /peer /data /control /name /machine |
%% See solv1.asir for the usage of this function. |
/your-peer /comm /remoteOpenXMbin /remoteServer /myhost |
/rationalRoots2 { |
/argNumber /aaa |
/arg1 set |
] pushVariables |
[/in-rationalRoots2 /aa /f /comm /vvv /r /setarg |
[ |
/w /ans |
/aaa arg1 def |
] pushVariables |
/argNumber aaa length def |
[(CurrentRingp) (KanGBmessage)] pushEnv |
/machine aaa 0 get def |
[ |
machine (localhost) eq argNumber 5 lt and { |
/aa arg1 def |
aaa 1 get ox_launch_localhost /your-peer set |
aa isArray { } { (<<array>> rationalRoots2) error } ifelse |
/LLL.end goto |
/setarg 0 def |
} { |
oxasir.ccc [ ] eq { |
/remoteOpenXMbin aaa 1 get def |
(Starting ox_asir server.) message |
/remoteServer aaa 2 get def |
ox_asirConnectMethod |
/name aaa 3 get def |
} { } ifelse |
/myhost aaa 4 get def |
aa { tag } map /typev set |
} ifelse |
typev [ArrayP StringP ArrayP] eq |
|
{ /f aa 0 get def |
|
/vvv [ aa 1 get to_records pop ] def |
|
/w aa 2 get def |
|
/setarg 1 def |
|
} { } ifelse |
|
typev [ArrayP ArrayP ArrayP] eq |
|
{ /f aa 0 get def |
|
/vvv aa 1 get {toString} map def |
|
/setarg 1 def |
|
/w aa 2 get def |
|
} { } ifelse |
|
setarg { } { (rationalRoots2 : Argument mismatch) error } ifelse |
|
|
/pass [(oxGenPass)] extension def |
|
/peer [(oxGetPort) myhost] extension def |
|
/data peer 1 get toString def |
|
/control peer 3 get toString def |
|
peer message |
|
[(ssh -f ) machine ( -l ) name ( ") |
|
|
|
@@@.ox_launch_nox { |
[vvv from_records ring_of_polynomials 0] define_ring |
} { |
f { toString . } map /f set |
remoteOpenXMbin(/oxlog ) |
vvv { . } map /vvv set |
( /usr/X11R6/bin/xterm -icon -e ) |
w { toString . } map /w set |
} ifelse |
|
|
(rationalRoots2 -- f = ) messagen f messagen |
|
( , vvv= ) messagen vvv messagen ( , w = ) messagen w message |
|
|
( ) remoteOpenXMbin (/ox ) |
vvv length 1 eq w 0 get (1). eq and |
( -reverse -ox ) remoteServer |
{ |
( -host ) myhost |
[(KanGBmessage) 0] system_variable |
( -data ) data ( -control ) control ( -pass ) pass |
[f] groebner_sugar 0 get /f set |
oxpath.null |
vvv 0 get toString (s) eq { |
( ") |
}{ [[vvv 0 get toString (s)] from_records ring_of_polynomials 0] define_ring} |
] cat /comm set |
ifelse |
(Executing the command : ) messagen comm message message |
f 0 get toString . [[vvv 0 get toString . (s).]] replace |
comm system |
findIntegralRoots /ans set |
(sleep 5) system-csh |
} |
[(oxCreateClient2) peer 1 pass] extension /your-peer set |
{ |
/LLL.end |
oxasir.ccc [(sm1_rationalRoots2) f vvv w] asir |
/arg1 your-peer def |
{(integer) dc} map |
] pop |
/ans set |
popVariables |
} ifelse |
arg1 |
|
|
/arg1 ans def |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
} def |
} def |
|
[(rationalRoots2) |
|
[(rationalRoots2 (ox_asir function) called from intw.sm1 to analyze integral) |
|
(roots.) |
|
]] putUsages |
|
|
[(ox_launch) |
/ptozp_subst { |
[( [remote remote-OpenXM-bin remote-ox-server remote-login-name myhostname] ) |
/arg1 set |
( ox_launch client ) |
[/in-ptozp_subst /aaa /fff /xxx /vvv /vlist] pushVariables |
$or $ |
[(CurrentRingp)] pushEnv |
$ [(localhost) ox-server-name] ox_launch client$ |
[ |
(Example 1: ) |
/aaa arg1 def |
$ [(tau.math.kobe-u.ac.jp) (/home/taka/OpenXM/bin) $ |
/fff aaa 0 get def |
$ (/home/taka/OpenXM/src/ox_math/ox_math) (taka) (dc4.math.kobe-u.ac.jp) $ |
/xxx aaa 1 get toString def |
$ ] ox_launch /@@@.oxmath set $ |
/vvv aaa 2 get {toString ..} map def |
|
aaa length 4 eq { |
|
/vlist aaa 3 get def |
|
} { |
|
/vlist 0 def |
|
} ifelse |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
fff isPolynomial { |
|
fff (ring) dc ring_def |
|
fff toString /fff set |
|
} |
|
{ vlist isInteger { (ptozp_subst: need variable names.) error } { } ifelse |
|
[vlist ring_of_differential_operators 0] define_ring |
|
} ifelse |
|
oxasir.ccc [(sm1_ptozp_subst) fff . xxx . vvv] asir |
|
/arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
[(ptozp_subst) |
|
[$[f s [p q] v] ptozp_subst g (ox_asir function)$ |
|
$It returns ptozp(subst(f,s,p/q))$ |
|
$Example 1: [ (x Dx - s) (s) [2 3] (x,s)] ptozp_subst $ |
|
$ ===> 3 x Dx - 2 $ |
]] putUsages |
]] putUsages |
|
|
[(ox_launch_nox) |
/reduceByAsir { |
[( [remote remote-OpenXM-bin remote-ox-server remote-login-name myhostname] ) |
/arg1 set |
( ox_launch_nox client ) |
[/in-reduceByAsir /aaa /fff /fff0 /fff1 /vlist] pushVariables |
(Example 1: ) |
[(CurrentRingp)] pushEnv |
$ [(tau.math.kobe-u.ac.jp) (/home/taka/OpenXM/bin) $ |
[ |
$ (/home/taka/OpenXM/src/ox_math/ox_math) (taka) (dc4.math.kobe-u.ac.jp) $ |
/aaa arg1 def |
$ ] ox_launch_nox /@@@.oxmath set $ |
/fff aaa 0 get def |
|
aaa length 2 eq { |
|
/vlist aaa 1 get def |
|
} { |
|
/vlist 0 def |
|
} ifelse |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
fff isArray { |
|
fff length 2 eq { |
|
/fff0 fff 0 get def |
|
/fff1 fff 1 get def |
|
} { |
|
([ << [f g] >> vlist ] reduceByAsir ) error |
|
} ifelse |
|
} { |
|
([ << [f g] >> vlist ] reduceByAsir ) error |
|
} ifelse |
|
fff0 isPolynomial fff1 isPolynomial and { |
|
fff0 (ring) dc ring_def |
|
fff0 toString . /fff0 set |
|
fff1 (ring) dc ring_def |
|
fff1 toString . /fff1 set |
|
} |
|
{ vlist isInteger { (reduceByAsir: need variable names.) error } { } ifelse |
|
[vlist ring_of_differential_operators 0] define_ring |
|
fff0 toString . /fff0 set |
|
fff1 toString . /fff1 set |
|
} ifelse |
|
oxasir.ccc [(sm1_rat2plist2) [fff0 fff1]] asir |
|
/arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
[(reduceByAsir) |
|
[$ [[f g] v] reduceByAsir [ff gg] (ox_asir function)$ |
|
$ [[f g]] reduceByAsir [ff gg] $ |
|
$Example 1: [[(2 x -2) (4 x - 8)] (x)] reduceByAsir $ |
|
(Note that there may be a gcd that is more than 1 among the coefficients.) |
]] putUsages |
]] putUsages |
|
|
/system-csh { |
%% File should be preprocessed by OpenXM/misc/packages/Windows/oxpp |
|
%% and ./oxapp --removeSharp |
|
[(oxasirParseFile) |
|
[$[peer filename] oxasirParseFile $ |
|
$File should be preprocessed by OpenXM/misc/packages/Windows/oxpp$ |
|
$and ./oxapp --removeSharp $ |
|
]] putUsages |
|
|
|
/oxasirParseFile { |
/arg1 set |
/arg1 set |
[/in-system-csh /com /com2] pushVariables |
[/in-oxasirParseFile /fname /sss] pushVariables |
[ |
[ |
/com arg1 def |
/fname arg1 1 get def |
[(/bin/csh -c ") com (")] cat |
/peer arg1 0 get def |
/com2 set |
fname pushfile /sss set |
%%com2 message |
peer |
com2 system |
[$if (1) { ; $ sss (}$)] cat |
|
oxsubmit |
] pop |
] pop |
popVariables |
popVariables |
} def |
} def |
|
|
/ox_launch_localhost { |
[(bfct) |
/arg1 set |
|
[/in-ox_launch_localhost /pass /peer /data /control /oxserver |
|
/my-peer] pushVariables |
|
[ |
[ |
/oxserver arg1 def |
( f bfct b ) |
/pass [(oxGenPass)] extension def |
( poly f; poly b) |
/peer [(oxGetPort) (localhost)] extension def |
([f v] bfct b) |
/data peer 1 get toString def |
( string f ) |
/control peer 3 get toString def |
( b is the global b-function of the polynomial f.) |
peer message |
(Example: [(x^3-y^2) (x,y)] bfct fctr :: ) |
[oxpath.oxlog.xterm oxpath.ox ( -reverse -ox ) oxserver |
(Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.) |
( -data ) data ( -control ) control ( -pass ) pass |
( ) |
oxpath.null |
(If you interrupted the computation by typing ctrl-C, type in ) |
( &)] cat system-csh |
( oxasir.ccc oxreset ; ) |
[(oxCreateClient2) peer 0 pass] extension /my-peer set |
(to interrupt the ox_asir server.) |
%% 0 means connect from only localhost. |
( ) |
(The server is binded to the variable ox.ccc) message |
(This function requires plugins cmo, socket and ox_asir server. cf.oxasir) |
/arg1 my-peer def |
(You need to install ox_asir server to use this function. (ox_asir function)) |
] pop |
]] putUsages |
popVariables |
|
arg1 |
/bfct { |
|
/arg1 set |
|
[/in-bfct /f /comm /vv] pushVariables |
|
[(CurrentRingp)] pushEnv |
|
[ |
|
/f arg1 def |
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
|
|
f isPolynomial not { |
|
/vv f 1 get def |
|
vv isArray { /vv vv from_records def } { } ifelse |
|
/f f 0 get def |
|
[vv ring_of_polynomials 0] define_ring |
|
f . /f set |
|
}{ } ifelse |
|
oxasir.ccc [(oxasir_bfct) f] asir /f set |
|
[(s) ring_of_polynomials 0] define_ring |
|
f . /f set |
|
[f f fctr] /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
} def |
} def |
|
|
%% Test code for oxCreateControl_RFC_101 |
[(generic_bfct) |
/sm1StartControl101 { |
|
[/in-sm1connectr /pass /peer /data /control ] pushVariables |
|
[ |
[ |
/pass [(oxGenPass)] extension def |
( [ii weight] generic_bfct b ) |
/peer [(oxGetPort1) (localhost)] extension def |
( list of poly ii; list weight) |
/data peer 1 get toString def |
([ii weight variables] generic_bfct b) |
peer message |
( list of string ii; list weight; list variables) |
[(/home/nobuki/OpenXM/src/oxc/oxc) |
( b is the general b-function of the ideal ii w.r.t the weight.) |
( -c ) pass ( -h ) (localhost) ( -p ) data ( -x ) |
(Example: [[(Dx^2) (Dy^2)] [(x) -1 (Dx) 1] [(x) (y)]] generic_bfct :: ) |
oxpath.null |
(Notion: Saito, Sturmfels, Takayama, Grobner deformations of hypergeometric differential equaitons) |
( &)] cat system-csh |
(Algorithm: M.Noro, Mathematical Software, icms 2002, pp.147--157.) |
|
( ) |
|
(If you interrupted the computation by typing ctrl-C, type in ) |
|
( oxasir.ccc oxreset ; ) |
|
(to interrupt the ox_asir server.) |
|
( ) |
|
(This function requires plugins cmo, socket and ox_asir server. cf.oxasir) |
|
(You need to install ox_asir server to use this function. (ox_asir function)) |
|
]] putUsages |
|
|
[(oxCreateControl_RFC_101) peer 0 pass] extension /ox.ccc set |
/generic_bfct { |
|
/arg1 set |
|
[/in-generic_bfct /aa /f /comm /vvv0 /n /vvv /ddd /r /setarg |
|
/bf /wt ] pushVariables |
|
[(CurrentRingp)] pushEnv |
|
[ |
|
/aa arg1 def |
|
aa isArray { } { (<<array>> generic_bfct) error } ifelse |
|
/setarg 0 def |
|
aa { tag } map /typev set |
|
typev [ ArrayP ArrayP] eq |
|
{ /f aa 0 get def |
|
f 0 tag PolyP { } { (The first argument must be a list of differential operators. Give the third variable: a list of variables) error } ifelse |
|
f 0 get (ring) dc /r set |
|
[(CurrentRingp) r] system_variable |
|
/wt aa 1 get def |
|
|
|
/vvv0 getVariableNames def |
|
/n [(N)] system_variable def |
|
/vvv vvv0 n carN rest reverse rest reverse def |
|
/ddd vvv0 reverse n carN reverse |
|
rest reverse rest reverse def |
|
|
|
/wt wt generic_bfct.aux1 def |
|
|
|
/setarg 1 def |
|
} { } ifelse |
|
typev [ArrayP ArrayP StringP] eq |
|
{ /f aa 0 get def |
|
/vvv [ aa 2 get to_records pop ] def |
|
/wt aa 1 get def |
|
|
|
/n vvv length def |
|
/ddd vvv { (D) 2 1 roll 2 cat_n } map def |
|
|
|
/setarg 1 def |
|
} { } ifelse |
|
typev [ArrayP ArrayP ArrayP] eq |
|
{ /f aa 0 get def |
|
/vvv aa 2 get {toString} map def |
|
/wt aa 1 get def |
|
|
|
/n vvv length def |
|
/ddd vvv { (D) 2 1 roll 2 cat_n } map def |
|
|
|
/setarg 1 def |
|
} { } ifelse |
|
setarg { } { (generic_bfct : Argument mismatch) error } ifelse |
|
|
|
f 0 get isPolynomial { |
|
|
|
} |
|
{ |
|
[vvv from_records ring_of_differential_operators 0] define_ring |
|
f { toString . } map /f set |
|
vvv { . } map /vvv set |
|
ddd { . } map /ddd set |
|
/wt [vvv ddd wt] generic_bfct.aux1 def |
|
} ifelse |
|
[f vvv ddd wt] message |
|
|
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
|
|
oxasir.ccc [(oxasir_generic_bfct) f vvv ddd wt] asir /bf set |
|
[(s) ring_of_polynomials 0] define_ring |
|
bf . /bf set |
|
[bf bf fctr] /arg1 set |
|
] pop |
|
popEnv |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
/generic_bfct.aux1 { |
|
/arg1 set |
|
[/in-generic_bfct.aux1 /ii /jj /wt /wtx /wtd /vv /dd /n] pushVariables |
|
[ |
|
arg1 2 get /wt set |
|
arg1 0 get /vv set |
|
arg1 1 get /dd set |
|
/wtx [ 0 1 vv length 1 sub { pop (0).. } for ] def |
|
/n wt length def |
|
0 2 n 1 sub { |
|
/ii set |
|
0 1 vv length 1 sub { |
|
/jj set |
|
wt ii get toString dd jj get toString eq { |
|
wtx jj << wt ii 1 add get >> put |
|
} { } ifelse |
|
} for |
|
} for |
|
|
|
wtx /wt set |
|
wt { dup tag IntegerP eq { (universalNumber) dc } { } ifelse } map /wt set |
|
wt /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
/verbose.wgr 1 def |
|
%[ ff vv ww ] asir.wgb [gb init] |
|
/asir.wgr { |
|
/arg1 set |
|
[/in-asir.gb /ff /vv /ww /vvx /vvd /avv /comm /wvec /i] pushVariables |
|
[ |
|
/ff arg1 0 get def |
|
/vv arg1 1 get def |
|
/ww arg1 2 get def |
|
|
|
oxasir.ccc [ ] eq { |
|
(Starting ox_asir server.) message |
|
ox_asirConnectMethod |
|
} { } ifelse |
|
|
|
vv isArray { |
|
vv from_records /vv set |
|
} { } ifelse |
|
oxasir.ccc [(dp_gr_print) (2)..] asir |
|
[vv to_records pop] /vvx set |
|
vvx { toString (D) 2 1 roll 2 cat_n } map /vvd set |
|
|
|
[ |
|
0 1 vvx length 1 sub { |
|
/i set |
|
vvx i get |
|
0 ww i get sub |
|
vvd i get |
|
ww i get |
|
} for |
|
] /wvec set |
|
|
|
[vv ring_of_differential_operators |
|
[wvec] weight_vector |
|
0] define_ring |
|
|
|
ff { toString . dehomogenize homogenize } map /ff set |
|
vvx { . } map /vvx set %%ex [x,y] |
|
vvd { . } map /vvd set %%ex [Dx,Dy] |
|
vvx vvd join [(h).] join /avv set |
|
|
|
verbose.wgr { |
|
(Asir (-w,w) gb in the Weyl algebra) message |
|
(wvec=) messagen wvec message |
|
(ff=) messagen ff message |
|
(avv=) messagen avv message |
|
} { } ifelse |
|
|
|
[$dp_weyl_set_weight(newvect($ ww length toString $,$ |
|
ww toString $));$ ] cat /comm set |
|
|
|
verbose.wgr { |
|
comm message |
|
} { } ifelse |
|
|
|
oxasir.ccc comm oxsubmit ; |
|
|
|
oxasir.ccc [(dp_weyl_gr_main) ff avv (0).. (1).. (11)..] asir |
|
/arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
[(asir.wgr) |
|
[([ ff vv ww ] asir.wgr g) |
|
$It computes the (-ww,ww) Grobner basis of ff in the homogenized Weyl algebra.$ |
|
(Homogenization is automatically done.) |
|
$Example 1: $ |
|
$ [ [(x*Dx+y*Dy-1) (Dx*Dy)] $ |
|
$ (x,y) $ |
|
$ [1 2 ] ] asir.wgr $ |
|
]] putUsages |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%%% functions to start ox_asir |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
/asirconnectr { |
|
[/in-asirconnectr /pass /peer /data /control /oxasir] pushVariables |
|
[ |
|
[(getServerEnv) (bin/ox_asir)] extension tag 0 eq { |
|
(Server bin/ox_sm1 is not found.) error |
|
}{ } ifelse |
|
|
|
/pass ox_encrypt_104_genPass def |
|
/peer [(oxGetPort) (localhost)] extension def |
|
/data peer 1 get toString def |
|
/control peer 3 get toString def |
|
peer message-quiet |
|
[ |
|
oxstart100 |
|
@@@.quiet { ( -quiet ) } { } ifelse |
|
Xm_noX { ( -nox ) } { } ifelse |
|
Xm_engineLogToStdout { ( -nox -engineLogToStdout ) } { } ifelse %bug.onlyForasir |
|
( -oxserver bin/ox_asir -e ) ( -reverse ) |
|
( -data ) data ( -control ) control pass [1 2] get |
|
( )] cat execve |
|
[(oxCreateClient2) peer 0 pass 0 get] extension /oxasir.ccc set |
%% 0 means connect from only localhost. |
%% 0 means connect from only localhost. |
(The server is binded to the variable ox.ccc) message |
oxasir.ccc asir.init |
ox.ccc |
/arg1 oxasir.ccc def |
] pop |
] pop |
popVariables |
popVariables |
|
arg1 |
} def |
} def |
|
|
/sm1StartEngine101 { |
[(asirconnectr) |
[/in-sm1StartEngine101 /peer /data /control /engineID] pushVariables |
[(asirconnectr server (ox_asir function)) |
|
(array server;) |
|
(Example: asirconnectr /oxasir.ccc set) |
|
]] putUsages |
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
%%% functions to start ox_k0 |
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
/oxk0.ccc load isArray |
|
{ } |
|
{ /oxk0.ccc [ ] def } ifelse |
|
|
|
/ox.k0.init { |
|
% oxk0.ccc ( Print("Hello!"); ) oxsubmit |
|
Xm_noX { oxk0.ccc (Xm_noX=true;) oxsubmit } |
|
{ oxk0.ccc (Xm_noX=false;) oxsubmit } ifelse |
|
} def |
|
|
|
/k0connectr { |
|
[/in-k0connectr /pass /peer /data /control ] pushVariables |
[ |
[ |
/peer [(oxGetPort1) (localhost)] extension def |
[(getServerEnv) (bin/ox_k0)] extension tag 0 eq { |
/data peer 1 get def |
(Server bin/ox_sm1 is not found.) error |
|
}{ } ifelse |
|
|
ox.ccc data oxpushcmo |
/pass ox_encrypt_104_genPass def |
ox.ccc (/home/nobuki/OpenXM/bin/ox_sm1) oxpushcmo |
/peer [(oxGetPort) (localhost)] extension def |
[(oxPushCMD) ox.ccc SM_control_spawn_server] extension |
/data peer 1 get toString def |
ox.ccc oxpopcmo /engineID set |
/control peer 3 get toString def |
[(oxCreateEngine_RFC_101) peer 0 (Empty) engineID] extension |
peer message-quiet |
/ox.ddd set |
[ |
(The engine is binded to the variables ox.ddd) message |
oxstart100 |
|
Xm_noX { ( -nox ) } { } ifelse |
|
( -oxserver bin/ox_k0 -e ) ( -reverse ) |
|
( -data ) data ( -control ) control pass [1 2] get |
|
( )] cat execve |
|
[(oxCreateClient2) peer 0 pass 0 get] extension /oxk0.ccc set |
|
%% 0 means connect from only localhost. |
|
(The server is binded to the variable oxk0.ccc) message-quiet |
|
ox.k0.init |
|
/arg1 oxk0.ccc def |
] pop |
] pop |
popVariables |
popVariables |
arg1 |
arg1 |
} def |
} def |
|
/@@@polymake.k0.ccc [ ] def |
|
|
/OxWorkDirCreated false def |
/ox_server_mode { |
/oxWorkDir { |
/:: { } def % do nothing |
[/in-oxWorkDir /workHome /work] pushVariables |
} def |
|
|
|
%% Encryption methods |
|
/ox_encrypt_104.NONE 0 def |
|
/ox_encrypt_104.FILE 1 def |
|
/ox_encrypt_104.RSA 2 def |
|
/@@@.ox_encrypt_104.method ox_encrypt_104.NONE def |
|
/ox_encrypt_104.1 { |
|
/arg1 set |
|
[/sss /rrr] pushVariables |
[ |
[ |
[(getenv) (OpenXM_tmp)] extension tag 0 eq { |
/sss arg1 def |
/workHome [ |
sss toString /sss set |
[(getenv) (HOME)] extension |
{ |
(/OpenXM_tmp) |
@@@.ox_encrypt_104.method ox_encrypt_104.NONE eq { |
] cat def |
/rrr [sss] def |
}{ |
exit |
/workHome |
} { } ifelse |
[(getenv) (OpenXM_tmp)] extension |
(The encryption method has not yet been implemented.) error |
def |
} loop |
}ifelse |
/arg1 rrr def |
/work [workHome (/) [(getpid)] extension toString] cat def |
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
OxWorkDirCreated not { |
%< |
[(stat) workHome] extension 0 get tag 0 eq { |
% Usages: ox_encrypt_104_genPass |
[(Working directory ) workHome ( will be created.)] cat |
% [[ c-pass d-pass ] [c-pass-encrypted d-pass-encrypted ox-command-str ] ...] |
message |
%> |
[(mkdir ) workHome] cat system |
/ox_encrypt_104_genPass { |
}{ |
[/sss /p1 /p2 /e1 /e2 /rrr] pushVariables |
} ifelse |
[ |
|
/r1 [(oxGenPass)] extension def |
|
/r2 [(oxGenPass)] extension def |
|
r1 ox_encrypt_104.1 /e1 set |
|
r2 ox_encrypt_104.1 /e2 set |
|
{ |
|
@@@.ox_encrypt_104.method ox_encrypt_104.NONE eq { |
|
[( -passControl ) e1 0 get ( -passData ) e2 0 get ( )] cat /sss set |
|
[[r1 r2] [e1 0 get , e2 0 get , sss]] /rrr set |
|
exit |
|
} { } ifelse |
|
(The encryption method has not been implemented.) error |
|
} loop |
|
rrr /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
[(stat) work] extension 0 get tag 0 eq { |
[[(lines),[10,-1]], |
[(Working directory ) work ( will be created.)] cat |
[(where),[(shell), (length)]], |
message |
[(reason_of_error), (invalid argument)], |
[(mkdir ) work] cat system |
[(asir_where),[[(toplevel),10],[(string),(foo),3],[(string),(hoge),-1]] |
}{ |
] |
|
/i1 set |
|
%% /translateErrorForCfep.sampleInput set |
|
|
|
[(translateErrorForCfep) |
|
[ |
|
(translate the error packet defined in ox-rfc-103 into series of commands for cfep.) |
|
] |
|
] putUsages |
|
/translateErrorForCfep { |
|
/arg1 set |
|
[/ee /ans /tt /lf /i /nn /ee.orig /tt2] pushVariables |
|
[ |
|
/ee arg1 def |
|
{ |
|
ee etag 257 eq { |
|
ee (body) dc 1 get /ee set ee /ee.orig set |
|
ee length 3 gt { |
|
ee 3 get /ee set |
|
ee [[(reason_of_error) ee.orig 2 get toString ]] join /ee set |
|
}{ |
|
%% nn should be 2, [serial, common error no, short message] |
|
ee length /nn set |
|
nn 0 gt { |
|
/ee [(reason_of_error) ee nn 1 sub get toString ] def |
|
} { /ee [ ] def } ifelse |
} ifelse |
} ifelse |
/OxWorkDirCreated true def |
|
}{ } ifelse |
}{ } ifelse |
/arg1 work def |
ee etag 6 eq not { /ans [ ] def exit } { } ifelse |
|
/ans [ ] def |
|
/lf 12 (string) dc def % line feed. |
|
ans [(Begin) nl lf] join /ans set |
|
|
|
ee (lines) getNode /tt set |
|
tt tag 0 eq { |
|
ee (parse_error_at) getNode /tt set |
|
} { } ifelse |
|
tt isArray { |
|
tt length 0 gt { |
|
ans |
|
[(gotoLine, ) tt 0 get toString nl lf] join /ans set |
|
}{ } ifelse |
|
} { } ifelse |
|
tt isInteger { |
|
[(gotoLine, ) tt toString nl lf] join /ans set |
|
} { } ifelse |
|
|
|
ee (where) getNode /tt set |
|
tt isArray { |
|
tt length 0 gt { |
|
ans |
|
[(findAndSelect, ) tt 0 get (string) dc nl lf] join /ans set |
|
}{ } ifelse |
|
1 1, tt length 1 sub { |
|
/i set |
|
ans |
|
[(findAndShow, ) tt i get (string) dc nl lf] join /ans set |
|
} for |
|
} { } ifelse |
|
|
|
ee (reason_of_error) getNode /tt set |
|
tt tag 0 eq { |
|
ee (reason_of_parse_error) getNode /tt set |
|
} { } ifelse |
|
tt tag 0 eq not { |
|
ans [(printErrorMessage, ) |
|
tt (string) dc localizedString % for translation. |
|
nl lf] join /ans set |
|
}{ } ifelse |
|
|
|
%% Keyword from asir. [(asir_where) [[(toplevel),3],[(string),(foo),3],[(filename),(func),4]]] |
|
ee (asir_where) getNode /tt set |
|
tt (toplevel) getNode /tt2 set |
|
tt2 isInteger, tt2 tag 15 eq, or { |
|
ans [(gotoLine, ) tt2 toString nl lf] join /ans set |
|
} { } ifelse |
|
tt isArray { |
|
0 1 tt length 1 sub { |
|
/i set |
|
tt i get /tt2 set |
|
tt2 (string) getNode tag 0 eq { } |
|
{ |
|
tt2 length 2 gt { |
|
tt2 2 get /tt2 set |
|
tt2 isInteger, tt2 tag 15 eq, or { |
|
tt2 toString .. /tt2 set |
|
tt2 (-1).. gt, tt2 (4294967295).. lt, and { |
|
ans [(gotoLine, ) tt2 toString nl lf] join /ans set |
|
} { } ifelse |
|
} { } ifelse |
|
}{ } ifelse |
|
} ifelse |
|
} for |
|
}{ } ifelse |
|
|
|
exit |
|
} loop |
|
ans [(End) nl lf] join /ans set |
|
ans cat /arg1 set |
] pop |
] pop |
popVariables |
popVariables |
arg1 |
arg1 |
} def |
} def |
[(oxWorkDir) |
|
[(oxWorkDir returns a name of working directory for OpenXM processes.) |
|
(If the working direcotry does not exist, it creates ~/OpenXM_tmp/[pid].) |
|
(The name can be changed by setting a value to the environmental variable) |
|
(OpenXM_tmp. cf. oxNewFileName) |
|
] |
|
] putUsages |
|
|
|
/OxFileName 0 def |
/oxclearstack { |
/oxNewFileName { |
/arg1 set |
[/in-oxNewFileName /name] pushVariables |
[/cl /n] pushVariables |
[ |
[ |
/name [(work) OxFileName toString] cat def |
/cl arg1 def |
/OxFileName OxFileName 1 add def |
cl oxgetsp /n set |
/arg1 name def |
n tag 0 eq { /n 0 def } { } ifelse |
|
n tag 15 eq { n (integer) dc /n set } { } ifelse |
|
cl n oxpops |
] pop |
] pop |
popVariables |
popVariables |
arg1 |
|
} def |
} def |
[(oxNewFileName) |
|
[(oxNewFileName returns a unique file name for a working file.) |
|
(cf. oxWorkDir) |
|
] |
|
] putUsages |
|
|
|
[(ostype)] extension 0 get |
|
(windows) eq { |
|
/ox-win.sm1.loaded boundp { |
|
}{ |
|
[(parse) (ox-win.sm1) pushfile] extension |
|
} ifelse |
|
}{ |
|
initializePathNamesForOx %% This should be |
|
} ifelse |
|