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