% oxmath.sm1 : An interface to Open Mathematica Server. (ox_math) % $OpenXM: OpenXM/src/kan96xx/Doc/oxmath.sm1,v 1.3 1999/11/11 08:23:14 takayama Exp $ %% This package requires ox.sm1 [(parse) (ox.sm1) pushfile] extension (oxmathconnectr-ssh ) message %%%%%%%%%%%%% Configure path for ox and ox_math on your remote machine. /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def /oxpath.oxmath-ssh (/home/taka/OpenXM/src/ox_math/ox_math) def /oxpath.ox-ssh (/home/taka/OpenXM/bin/ox) def /myhostname-ssh (dc1.math.kobe-u.ac.jp) def /oxmathconnectr-ssh { /arg1 set [/in-oxmathconnectr /pass /peer /data /control /name /machine /your-peer /comm ] pushVariables [ /machine arg1 0 get def /name arg1 1 get def /pass [(oxGenPass)] extension def /peer [(oxGetPort) myhostname-ssh] extension def /data peer 1 get toString def /control peer 3 get toString def peer message [(ssh -f ) machine ( -l ) name ( ") oxpath.oxlog.xterm-ssh oxpath.ox-ssh ( -reverse -ox ) oxpath.oxmath-ssh ( -host ) myhostname-ssh ( -data ) data ( -control ) control ( -pass ) pass oxpath.null ( ") ] cat /comm set (Executing the command : ) messagen comm message message comm system (sleep 5) system [(oxCreateClient2) peer 1 pass] extension /your-peer set %% /@@@.oxmath your-peer def %% (ox_math is set to @@@.oxmath) message /arg1 your-peer def ] pop popVariables arg1 } def [(oxmathconnectr-ssh) [([hostname login-name] oxmathconnectr-ssh client) (Starting oxpath.oxmath-ssh by the launcher oxpath.ox-ssh on the "hostname".) (Set the following varialbes at the beginning of oxmath.sm1 ) (to appropriate values:) (oxpath.oxlog.xterm-ssh oxpath.oxmath-ssh oxpath.ox-ssh myhostname-ssh ) $Example 1: $ $ *** Path names on the remote machine tau.math.kobe-u.ac.jp $ $ /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def $ $ /oxpath.oxmath-ssh (/home/taka/OpenXM/src/ox_math/ox_math) def $ $ /oxpath.ox-ssh (/home/taka/OpenXM/bin/ox) def $ $ *** The machine name on which you are running sm1. $ $ /myhostname-ssh (dc1.math.kobe-u.ac.jp) def $ $ [(tau.math.kobe-u.ac.jp) (taka)] oxmathconnectr-ssh /@@@.oxmath set $ ]] putUsages /o_aux { /arg1 set [/in-t_aux /ob /r /r2] pushVariables [ /ob arg1 def (_______________________________________) message (tag = ) messagen ob tag messagen (, ) messagen (Sending object :) messagen ob message @@@.oxmath ob oxpushcmo @@@.oxmath oxpopcmo /r set (Returned expression is:) messagen (tag = ) messagen r tag messagen (, ) messagen r message (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) message ] pop popVariables } def /o_aux2 { /arg1 set [/in-t_aux /ob /r /r2] pushVariables [ /ob arg1 def (_______________________________________) message (Evaluating object :) messagen ob message @@@.oxmath ob oxexecutestring @@@.oxmath oxpopcmo /r set (Returned cmo expression is:) messagen (tag = ) messagen r tag messagen (, ) messagen r message (Evaluating object :) messagen ob message @@@.oxmath ob oxexecutestring @@@.oxmath oxpopstring /r set (popstring of the result is:) messagen (tag = ) messagen r tag messagen (, ) messagen r message (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) message ] pop popVariables } def %% Just type in oxmath-testsuits1 /oxmath-testsuits1 { %% Configure below. /oxpath.oxlog.xterm-ssh (/home/taka/OpenXM/bin/oxlog /usr/X11R6/bin/xterm -icon -e ) def /oxpath.oxmath-ssh (/home/taka/OpenXM/src/ox_math/ox_math) def /oxpath.ox-ssh (/home/taka/OpenXM/bin/ox) def %% *** The machine name on which you are running sm1. /myhostname-ssh (dc4.math.kobe-u.ac.jp) def [(tau.math.kobe-u.ac.jp) (taka)] oxmathconnectr-ssh /@@@.oxmath set %% End of configuration. %% @@@.oxmath oxmathcap %% (Mathcap is ) messagen @@@.oxmath message null o_aux 123 o_aux (Hello World) o_aux [1 2 3] o_aux (123123).. o_aux % (-12).. (12345).. div o_aux %% not supported in sm1. % (x^2-1). o_aux %% It cause a hang of the communication line. (------------ test of oxExecuteString and oxpopcmo ----------------) (1+2) o_aux2 (Eigenvalues[{{1,2},{3,4}}]) o_aux2 (Factor[x^10-1]) o_aux2 (Eigenvalues[{{1,2},"Hello"}]) o_aux2 (End) message } def