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