Annotation of OpenXM/doc/calc2000/openxm-clients.tex, Revision 1.1.1.1
1.1 noro 1: % $OpenXM: OpenXM/doc/issac2000/openxm-clients.tex,v 1.12 2000/01/17 07:15:52 noro Exp $
2:
3: \section{OpenXM Clients}
4:
5: \subsection{Risa/Asir}
6:
7: Risa/Asir provides a launcher {\tt ox\_launch}
8: to invoke an OpenXM server and to set up the
9: communication between the server and itself.
10: Fundamental operations on OpenXM servers are
11: exchange of OX data and sending of stack machine commands.
12: As a client, Asir provides the following functions
13: to execute these primitive operations:
14: {\tt ox\_push\_cmo()} for pushing data,
15: {\tt ox\_push\_cmd()} for sending a stack machine command
16: and {\tt ox\_get()} for receiving data from a stream.
17:
18: Some operations including the reset operation are implemented by
19: combining these primitives. Among them, frequently used ones are
20: provided as built-in functions. We show some of them.
21:
22: \begin{itemize}
23: \item {\tt ox\_pop\_cmo()}
24:
25: It requests a server to send data on the stack to the stream, then
26: it receives the data from the stream.
27:
28: \item {\tt ox\_cmo\_rpc()}
29:
30: After pushing the name of a function, arguments and the number of the
31: arguments to the stack of a server, it requests the server to execute
32: the function. It does not wait the termination of the function call.
33:
34: \item {\tt ox\_reset()}
35:
36: After sending {\tt SM\_control\_reset\_connection} to a control server,
37: it completes the operations stated in Section \ref{control}.
38: \end{itemize}
39: Furthermore {\tt ox\_select()} is provided to detect if streams are ready for
40: reading. It is implemented by the {\tt select()} system call and is used
41: to avoid blocking on read operations.
42:
43: \subsection{Mathematica}
44:
45: We provide an OpenXM client {\tt math2ox} written as an external module
46: for Mathematica.
47: The module {\tt math2ox} communicates with Mathematica by MathLink and
48: with any OpenXM server by the OpenXM protocol.
49: By using the module {\tt math2ox},
50: we can call OpenXM servers from Mathematica;
51: here is a demonstration of a computation of the de Rham cohomology groups
52: of ${\bf C}^2 \setminus V(x^3-y^2)$ from Mathematica.
53: {\footnotesize
54: \begin{verbatim}
55: In[1]:= Install["math2ox"]
56: In[2]:= OxStart["../lib/sm1/bin/ox_sm1_forAsir"]
57: In[3]:= OxExecute[" [(x^3-y^2) (x,y)] deRham "]
58: In[4]:= OxPopString[]
59: Out[4]= [ 1 , 1 , 0 ] (* The dimension of
60: cohomology groups *)
61: \end{verbatim}
62: }
63:
64: The {\tt math2ox} adds the following functions to Mathematica.
65: \begin{quote}
66: {\tt OxStart[s\_String]},
67: {\tt OxStartInsecure[s\_String]} \\
68: {\tt OxExecuteString[s\_String]},
69: {\tt OxParse[s\_String]},
70: {\tt OxGet[]},
71: {\tt OxPopCMO[]},
72: {\tt OxPopString[]},
73: {\tt OxClose[]},
74: {\tt OxReset[]}
75: \end{quote}
76: Although the list of functions speaks itself,
77: we add some explanations.
78: The function {\tt OxPopCMO[]} executes the same operation
79: as {\tt ox\_pop\_cmo()} in Risa/Asir;
80: it pops data from the server stack.
81: The {\tt OxGet[]} receives an OX data message
82: and returns its translation to an local object.
83: The function {\tt OxParse[]} helps debugging to connect Mathematica
84: and ox servers.
85: By using the function, one can send OX messages,
86: written by the OX expression, to a server.
87: OX expressions are Lisp-like expressions for OX messages and are defined
88: in~\cite{noro-takayama}.
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>