1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
|
#############################################################################
##
#W init.g OpenMath Package Andrew Solomon
#W Marco Costantini
##
#Y Copyright (C) 1999, 2000, 2001, 2006
#Y School Math and Comp. Sci., University of St. Andrews, Scotland
#Y Copyright (C) 2004, 2005, 2006 Marco Costantini
##
## init.g file
##
#############################################################################
#
# Reading configuration file
#
ReadPackage("openmath", "config.g");
#############################################################################
#
# Reading *.gd files
#
ReadPackage("openmath", "/gap/parse.gd");
ReadPackage("openmath", "/gap/xmltree.gd");
ReadPackage("openmath", "/gap/omget.gd");
ReadPackage("openmath", "/gap/omput.gd");
ReadPackage("openmath", "/gap/test.gd");
#############################################################################
##
## Reading *.g files organised into modules
##
#############################################################################
## Module 1: conversion from OpenMath to Gap
#################################################################
## Module 1.1
## This module contains the semantic mappings from parsed openmath
## symbols to GAP objects and provides the function OMsymLookup
ReadPackage("openmath", "/gap/gap.g");
#################################################################
## Module 1.2.b
## This module converts the OpenMath XML into a tree and parses it;
## requires the function OMsymLookup (and the function
## ParseTreeXMLString from package GapDoc) and provides
## the function OMgetObjectXMLTree
if IsBound( ParseTreeXMLString ) then
ReadPackage("openmath", "/gap/xmltree.g");
fi;
#################################################
# patch for HexStringBlist
if not CompareVersionNumbers( GAPInfo.Version, "4.5.0") then
MakeReadWriteGlobal("HexStringBlist");
HexStringBlist := function ( b )
local i, n, s;
HexBlistSetup( );
n := Length( b );
i := 1;
s := "";
while i + 7 <= n do
Append( s, HEXBYTES[PositionSorted( BLISTBYTES, b{[ i .. i + 7 ]} )] );
i := i + 8;
od;
b := b{[ i .. n ]};
if Length( b ) = 0 then
return s;
fi;
while Length( b ) < 8 do
Add( b, false );
od;
Append( s, HEXBYTES[PositionSorted( BLISTBYTES, b )] );
return s;
end;
MakeReadOnlyGlobal("HexStringBlist");
fi;
#################################################################
## Module 1.3
## This module gets exactly one OpenMath object from <input stream>;
## provides the function PipeOpenMathObject
ReadPackage("openmath", "/gap/pipeobj.g");
#############################################################################
##
## Binary OpenMath --> GAP
##
ReadPackage("openmath", "/gap/const.g");
ReadPackage("openmath", "/gap/binread.g");
#################################################################
## Module 1.4
## This module converts one OpenMath object to a Gap object; requires
## PipeOpenMathObject and one of the functions OMpipeObject or
## OMgetObjectXMLTree and provides OMGetObject
ReadPackage("openmath", "/gap/omget.g");
# file containing updates
ReadPackage("openmath", "/gap/new.g");
#############################################################################
## Module 2: conversion from Gap to OpenMath
## (Modules 1 and 2 are independent)
#################################################################
## Module 2.1
## This module is concerned with outputting OpenMath;
## It provides OMPutObject and OMPrint in "/gap/omput.gi"
#################################################################
## Module 2.2
## This module is concerned with viewing Hasse diagrams;
## requires the variables defined in gap/omput.gd
ReadPackage("openmath", "/hasse/config.g");
ReadPackage("openmath", "/hasse/hasse.g");
#############################################################################
## Module 3: test
## Provides the function OMTest for testing OMGetObject.OMPutObject = id
## requires OMGetObject and OMPutObject
ReadPackage("openmath", "/gap/test.g");
#############################################################################
#E
|