Annotation of OpenXM/doc/ascm2001p/openxm-stackmachines.tex, Revision 1.1
1.1 ! noro 1: % $OpenXM$
! 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.
! 28: Any OX command message starts with the int32 tag OX\_COMMAND.
! 29: The body is a stack machine operation code expressed by int32.
! 30: %The codes are listed below \cite{ox-rfc-100}.
! 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
! 55: while it is a work in progress in the GAP group \cite{gap}.
! 56: Each OpenXM server has its own set of mathematical operations,
! 57: which are performed as follows.
! 58: First, arguments for a mathematical operation
! 59: and the number of the arguments are pushed.
! 60: Second,
! 61: the mathematical operator name,
! 62: such as {\tt fctr} (the factorization command of Asir),
! 63: is pushed as a string.
! 64: Finally, the stack machine command
! 65: {\tt SM\_executeFunction} evaluates the operator and
! 66: pushes the result onto the stack
! 67: after poping the operator name, the number of arguments
! 68: and arguments.
! 69: %For example, the following code factorizes $x^{100}-1$ by calling
! 70: %{\tt ox\_asir} from Asir.
! 71: %\begin{verbatim}
! 72: %P = ox_launch();
! 73: %ox_push_cmo(P,x^100-1); ox_push_cmo(P,ntoint32(1));
! 74: %ox_push_cmo(P,"fctr"); ox_push_cmd(P,269);
! 75: %Ans = ox_pop_cmo(P);
! 76: %\end{verbatim}
! 77:
! 78: When an error has occurred on an OpenXM server,
! 79: an error object is pushed onto the stack
! 80: instead of a result of the computation.
! 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}
! 84: %[340] P = ox_launch()$
! 85: %[341] ox_rpc(P,"fctr",1.2*x)$
! 86: %[342] ox_pop_cmo(P);
! 87: %error([8,fctr : invalid argument])
! 88: %\end{verbatim}
! 89:
! 90: OpenXM server won't send error messages to the client
! 91: except when it receives a {\tt SM\_pop*} command.
! 92: OX stack machines work in the asynchronous mode which is similar
! 93: to X servers.
! 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}
! 97: %on our asynchronous OX stack machines.
! 98:
! 99:
! 100:
! 101:
! 102:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>