% $OpenXM: OpenXM/doc/calc2000/data-format.tex,v 1.1.1.1 2000/04/24 04:20:11 noro Exp $ \section{Data Format} OpenXM admits multiple mathematical encodings such as OpenMath, MP, CMO (Common Mathematical Object format). OpenXM itself does not exhibit a bias towards a particular encodings as a main mathematical data carrier and an OpenXM compliant system do not need to implement all possible data formats. However they should at least implement seven primitive data types of the CMO, which are necessary to carry several control informations such as a {\it mathcap}. Mathcap is a list of supported CMO's, OpenXM stack machine codes, and necessary extra informations. If a program sends an OX messages unknown to its peer, an unrecoverable error may occur. By exchanging mathcaps, a program knows its peer's capability and such an error can be avoided. Mathcap is also defined as a CMO. See \cite{noro-takayama} for the details. Encoding types of OX data are distinguished with tags of OX messages. For example, an OX message with the tag {\tt OX\_DATA} is followed by a CMO packet. An OX message with the tag {\tt OX\_DATA\_OPENMATH\_XML} is followed by an OpenMath XML string. Let us explain the data format of CMO. Any CMO packet consists of a header and a body. The size of the header is 4 bytes that tags the data type of the body. Data type tags are signed 32 bit integers which is called {\sl int32} in this paper. Following tags are registered in the OpenXM. \begin{verbatim} CMO_ERROR2, CMO_NULL, CMO_INT32, CMO_DATUM, CMO_STRING, CMO_MATHCAP, CMO_LIST, CMO_MONOMIAL32, CMO_ZZ, CMO_QQ, CMO_ZERO, CMO_DMS_GENERIC, CMO_DMS_OF_N_VARIABLES, CMO_RING_BY_NAME, CMO_RECURSIVE_POLYNOMIAL, CMO_LIST_R, CMO_INT32COEFF, CMO_DISTRIBUTED_POLYNOMIAL, CMO_POLYNOMIAL_IN_ONE_VARIABLE, CMO_RATIONAL, CMO_64BIT_MACHINE_DOUBLE, CMO_ARRAY_OF_64BIT_MACHINE_DOUBLE, CMO_BIGFLOAT, CMO_IEEE_DOUBLE_FLOAT, CMO_INDETERMINATE, CMO_TREE, CMO_LAMBDA \end{verbatim} The first seven primitive types should be implemented on all OpenXM compliant systems. The formats are as follows. \\ \begin{tabular}{|c|c|} \hline {\sl int32} {\tt CMO\_ERROR2} & {\sl CMObject} {\rm ob} \\ \hline \end{tabular} \\ \begin{tabular}{|c|c|} \hline {\sl int32} {\tt CMO\_NULL} \\ \hline \end{tabular} \\ \begin{tabular}{|c|c|} \hline {\sl int32} {\tt CMO\_INT32}& {\sl int32} {\rm n} \\ \hline \end{tabular} \\ \begin{tabular}{|c|c|c|c|c|} \hline {\sl int32} {\tt CMO\_STRING}& {\sl int32} {\rm n} & {\sl byte} {\rm data[0]} $\cdots$ & {\sl byte} {\rm data[n-1]} \\ \hline \end{tabular} \\ \begin{tabular}{|c|c|} \hline {\sl int32} {\tt CMO\_MATHCAP} & {\sl CMObject} {\rm ob} \\ \hline \end{tabular} \\ \begin{tabular}{|c|c|c|c|c|} \hline {\sl int32} {\tt CMO\_LIST}& {\sl int32} {\rm n} & {\sl CMObject} {\rm ob[0]} $\cdots$ & {\sl CMObject} {\rm ob[n-1]} \\ \hline \end{tabular} \\ As to the formats of other CMO's, see \cite{noro-takayama}. When one wants to implement CMO on a server, the person proceeds as follows. \begin{enumerate} \item Look for the list of CMO's at the web cite \cite{openxm-web}. If there is a CMO that fits to one's requirement, then use this CMO. \item If there is no suitable CMO, design a new CMO and register the new CMO to \cite{openxm-web} with a description and examples. \end{enumerate}