Revision.("openmath/read.g") :=
    "@(#)$Id: read.g,v 1.21 2006/01/27 14:55:55 gap Exp $";



#################################################################
##
##  OMDefineTokens()
##
##  Look through the include file binding "gapOM..." names to values,
##  but deleting the "gap" prefix.
##

OMDefineTokens := function()

  local inf, s, sp, infile;
  
	infile := Filename(DirectoriesPackageLibrary("openmath","include"), "gap_tokens.h");
  inf := InputTextFile(infile);


  s := ReadLine(inf);
  while s <> fail do
    # if it is a definition line, then read the definition
    if Length(s) >= 3 and s{[1..3]} = "gap" then
      sp := SplitString(s,','," \t\n");
      #Print("Operation : BindGlobal(",sp[1]{[4 .. Length(sp[1])]},",",
				#Int(sp[3]),")\n");
      BindGlobal(sp[1]{[4 .. Length(sp[1])]}, Int(sp[3]));
    fi;
    s := ReadLine(inf);
  od;
  CloseStream(inf);
end;

OMDefineTokens();
Unbind(OMDefineTokens);


# the *.gd files are now read by init.g


# these files are concerned with outputting OpenMath

# ReadPackage("openmath", "/gap/omput.gd");
ReadPackage("openmath", "/gap/omput.gi");


# Frank Luebeck's utility for obtaining view strings.
ReadPackage("openmath", "/gap/printutil.g");

# these files are required for reading an  OpenMath encoded object 
# from a stream

ReadPackage("openmath", "/gap/lex.g");
ReadPackage("openmath", "/gap/gap.g");
# ReadPackage("openmath", "/gap/parse.gd");
ReadPackage("openmath", "/gap/parse.gi");
ReadPackage("openmath", "/gap/pipeobj.g");
# ReadPackage("openmath", "/gap/omget.gd");
ReadPackage("openmath", "/gap/omget.g");

# a function for testing OMGetObject.OMPutObject = id
# ReadPackage("openmath", "/gap/test.gd");
ReadPackage("openmath", "/gap/test.g");


# files concerned with viewing Hasse diagrams.
ReadPackage("openmath", "/hasse/config.g");
ReadPackage("openmath", "/hasse/hasse.g");

# file containing updates
ReadPackage("openmath", "/gap/new.g");


# test for existence of the compiled binary
if Filename(DirectoriesPackagePrograms("openmath"), "gpipe") = fail  then
    Info( InfoWarning, 1,
     "Warning: package openmath, the program `gpipe' is not compiled." );
fi;


#################################################################
#E
