[BACK]Return to openxm-stackmachines.tex CVS log [TXT][DIR] Up to [local] / OpenXM / doc / issac2000

Annotation of OpenXM/doc/issac2000/openxm-stackmachines.tex, Revision 1.13

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>