% This file was created automatically from openmath.msk.
% DO NOT EDIT!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%A  openmath.msk                GAP documentation              Andrew Solomon
%%
%A  @(#)$Id: openmath.msk,v 1.6 2006/01/11 22:44:57 gap Exp $
%%
%Y  (C) 1999 School Math and Comp. Sci., University of St.  Andrews, Scotland
%%
\Chapter{OpenMath functionality in GAP}

After loading the package:
\beginexample
gap> LoadPackage( "openmath" );
true
\endexample
the following operations are available.

\>OMPrint( <obj> ) F

OMPrint writes the XML OpenMath encoding of GAP object <obj> 
to the standard output.


\beginexample
gap> g := Group((1,2,3));;
gap> OMPrint(g);
<OMOBJ>
	<OMA>
		<OMS cd="group1" name="Group"/>
		<OMA>
			<OMS cd="permut1" name="Permutation"/>
			<OMI> 2</OMI>
			<OMI> 3</OMI>
			<OMI> 1</OMI>
		</OMA>
	</OMA>
</OMOBJ>
\endexample


\>OMGetObject( <stream> ) F

<stream> is an input stream (see "ref: InputTextFile", "ref:
InputTextUser", "ref: InputTextString", 
"ref: InputOutputLocalProcess" ) with an OpenMath object on it.
OMGetObject takes precisely one object off <stream> 
and returns it as a GAP object.
Both XML and binary OpenMath encoding are supported, autodetection
is used.
This function requires that the external program `gpipe', included
in this package, has been compiled.

This may be used to retrieve objects from a file,
for example:
\beginexample
gap> test3:=Filename(DirectoriesPackageLibrary("openmath","tst"),"test3.omt");;
gap> stream := InputTextFile( test3 );;
gap> OMGetObject(stream);
912873912381273891
gap> OMGetObject(stream);
E(4)
gap> CloseStream(stream);
\endexample
or it can be used to retrieve them from standard input -
one may paste an OpenMath object directly into standard input
after issuing GAP with the following commands:
%notest
\beginexample
gap> stream := InputTextUser();;
gap> g := OMGetObject(stream);CloseStream(stream);
\endexample


\>OMPutObject( <stream>, <obj> ) F

OMPutObject writes (appends) the XML OpenMath encoding of the GAP
object <obj> to output stream <stream> (see "ref: OutputTextFile",
"ref: OutputTextUser", "ref: OutputTextString",
"ref: InputOutputLocalProcess" ).


\beginexample
gap> g := [[1,2],[1,0]];;
gap> t := "";
""
gap> s := OutputTextString(t, true);;
gap> OMPutObject(s, g);
gap> CloseStream(s);
gap> Print(t);
<OMOBJ>
	<OMA>
		<OMS cd="linalg2" name="matrix"/>
		<OMA>
			<OMS cd="linalg2" name="matrixrow"/>
			<OMI> 1</OMI>
			<OMI> 2</OMI>
		</OMA>
		<OMA>
			<OMS cd="linalg2" name="matrixrow"/>
			<OMI> 1</OMI>
			<OMI> 0</OMI>
		</OMA>
	</OMA>
</OMOBJ>
\endexample

\>OMTest( <obj> ) F


Converts <obj> to OpenMath and back. Returns true iff <obj> is unchanged
(as a GAP object) by this operation. The OpenMath standard does not 
stipulate that converting to and from OpenMath should be the identity
function so this is a useful diagnostic tool.








%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%E
