Annotation of OpenXM/doc/calc2000/openxm-stackmachines.tex, Revision 1.2
1.2 ! noro 1: % $OpenXM: OpenXM/doc/calc2000/openxm-stackmachines.tex,v 1.1.1.1 2000/04/24 04:20:11 noro Exp $
1.1 noro 2:
3: \section{OpenXM Stack machines}\label{sec:ox-stackmachines}
4:
5: In OpenXM specification, all servers are stack machines.
6: %These are called OpenXM stack machines.
7: When a server ox\_xyz gets an OX data message,
8: it translates the data into a local object of ox\_xyz
9: and pushes the object onto the stack.
10: The translation scheme
11: %% together with definitions of mathematical operations
12: %% of the system ox\_xyz
13: is called the {\it PhraseBook} of ox\_xyz (cf. OpenMath \cite{OpenMath}).
14: For example, the Asir command {\tt ox\_push\_cmo(P,1)}
15: (push integer $1$ onto the server $P$)
16: sends an OX data message
17: {\tt (OX\_DATA,(CMO\_ZZ,1))} to the server $P$.
18: Here,
19: {\tt OX\_DATA} stands for {\tt OX\_DATA} header and
20: {\tt (CMO\_ZZ,1)} is a body standing for $1$ expressed
21: by the CMO.
22: The server translates {\tt (CMO\_ZZ, 1)} to its internal object of
23: the integer $1$
24: and pushes the object onto the stack.
25:
26: If the server gets an {\it OX command} message, then the server
27: executes the command.
1.2 ! noro 28: Any OX command message starts with the int32 tag {\tt OX\_COMMAND}.
1.1 noro 29: The body is a stack machine operation code expressed by int32.
30: The codes are listed below \cite{noro-takayama}.
31: \begin{verbatim}
32: SM_popSerializedLocalObject, SM_popCMO, SM_popString,
33: SM_mathcap, SM_pops, SM_setName, SM_evalName,
34: SM_executeStringByLocalParser, SM_executeFunction,
35: SM_beginBlock, SM_endBlock, SM_shutdown, SM_setMathCap,
36: SM_executeStringByLocalParserInBatchMode, SM_getsp,
37: SM_dupErrors, SM_control_kill, SM_control_to_debug_mode,
38: SM_control_exit_debug_mode, SM_control_reset_connection
39: \end{verbatim}
40:
41: OpenXM does not have a standard for mathematical operation sets
42: while it is a work in progress in the GAP group \cite{gap}.
43: Each OpenXM server has its own set of mathematical operations,
44: which are performed as follows.
45: First, arguments for a mathematical operation
46: and the number of the arguments are pushed.
47: Second,
48: the mathematical operator name,
49: such as {\tt fctr} (the factorization command of Asir),
50: is pushed as a string.
51: Finally, the stack machine command
52: {\tt SM\_executeFunction} (269) evaluates the operator and
53: pushes the result onto the stack
54: after poping the operator name, the number of arguments
55: and arguments.
56: For example, the following code factorizes $x^{100}-1$ by calling
57: {\tt ox\_asir} from Asir.
58: \begin{verbatim}
59: P = ox_launch();
60: ox_push_cmo(P,x^100-1); ox_push_cmo(P,ntoint32(1));
61: ox_push_cmo(P,"fctr"); ox_push_cmd(P,269);
62: Ans = ox_pop_cmo(P);
63: \end{verbatim}
64:
65: When an error has occurred on an OpenXM server,
66: an error object is pushed onto the stack
67: instead of a result of the computation.
68: The error object consists of the serial number of the OX message
69: which caused the error, and an error message.
70: \begin{verbatim}
71: [340] P = ox_launch()$
72: [341] ox_rpc(P,"fctr",1.2*x)$
73: [342] ox_pop_cmo(P);
74: error([8,fctr : invalid argument])
75: \end{verbatim}
76:
77: OpenXM server won't send error messages to the client
78: except when it receives a {\tt SM\_pop*} command.
79: OX stack machines work in the asynchronous mode which is similar
80: to X servers.
81: For servers of graphic and sound applications,
82: it may be an advantageous feature.
83: It is also possible to emulate RPC and a web server for MCP \cite{iamc}
84: on our asynchronous OX stack machines.
85:
86:
87:
88:
89:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>