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