1(* 2 Title: Standard Basis Library: Commands to build the library 3 Copyright David C.J. Matthews 2000, 2005, 2015-16, 2018-20 4 5 This library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License version 2.1 as published by the Free Software Foundation. 8 9 This library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with this library; if not, write to the Free Software 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17*) 18 19(* Thread, Weak and Signal are Poly/ML extensions. *) 20 21val () = Bootstrap.use "basis/InitialBasis.ML"; 22val () = Bootstrap.use "basis/Universal.ML"; 23val () = Bootstrap.use "basis/General.sml"; 24val () = Bootstrap.use "basis/LibrarySupport.sml"; 25val () = Bootstrap.use "basis/PolyMLException.sml"; 26val () = Bootstrap.use "basis/Option.sml"; 27val () = Bootstrap.use "basis/ListSignature.sml"; 28val () = Bootstrap.use "basis/List.sml"; 29val () = Bootstrap.use "basis/VectorOperations.sml"; 30val () = Bootstrap.use "basis/PolyVectorOperations.sml"; 31val () = Bootstrap.use "basis/VectorSliceOperations.sml"; 32val () = Bootstrap.use "basis/MONO_VECTOR.sml"; 33val () = Bootstrap.use "basis/MONO_VECTOR_SLICE.sml"; 34val () = Bootstrap.use "basis/MONO_ARRAY.sml"; 35val () = Bootstrap.use "basis/MONO_ARRAY_SLICE.sml"; 36val () = Bootstrap.use "basis/StringSignatures.sml"; 37val () = Bootstrap.use "basis/String.sml"; 38 39structure Int = struct type int = int end; 40val () = Bootstrap.use "basis/INTEGER.sml"; 41val () = Bootstrap.use "basis/Int.sml"; 42val () = Bootstrap.use (if Bootstrap.intIsArbitraryPrecision then "basis/IntAsLargeInt.sml" else "basis/IntAsFixedInt.sml"); 43val () = 44 case FixedInt.precision of SOME 31 => Bootstrap.use "basis/Int31.sml" | SOME 63 => Bootstrap.use "basis/Int63.sml" | _ => (); 45val () = Bootstrap.use "basis/WordSignature.sml"; 46val () = Bootstrap.use "basis/LargeWord.sml"; 47val () = Bootstrap.use "basis/VectorSignature.sml"; 48val () = Bootstrap.use "basis/VectorSliceSignature.sml"; 49val () = Bootstrap.use "basis/Vector.sml"; 50val () = Bootstrap.use "basis/ArraySignature.sml"; 51val () = Bootstrap.use "basis/ArraySliceSignature.sml"; (* Depends on VectorSlice. *) 52val () = Bootstrap.use "basis/Array.sml"; 53 54val () = Bootstrap.use "basis/Text.sml"; (* Declares Char, String, CharArray, CharVector *) 55val () = Bootstrap.use "basis/Bool.sml"; 56val () = Bootstrap.use "basis/ListPair.sml"; 57 58(* Declare the appropriate additional structures. *) 59(* The version of Word32 we use depends on whether this is 60 32-bit or 64-bit. *) 61val () = 62 if LargeWord.wordSize = 32 63 then Bootstrap.use "basis/Word32.sml" 64 else if Word.wordSize >= 32 65 then Bootstrap.use "basis/Word32In64.sml" 66 else if LargeWord.wordSize = 64 67 then Bootstrap.use "basis/Word32InLargeWord64.sml" 68 else (); 69 70val () = Bootstrap.use "basis/Word16.sml"; 71val () = Bootstrap.use "basis/Word8.sml"; 72val () = Bootstrap.use "basis/IntInf.sml"; 73val () = Bootstrap.use "basis/Int32.sml"; 74val () = Bootstrap.use "basis/Word8Array.sml"; 75val () = Bootstrap.use "basis/Byte.sml"; 76val () = Bootstrap.use "basis/BoolArray.sml"; 77val () = Bootstrap.use "basis/IntArray.sml"; 78val () = Bootstrap.use "basis/RealArray.sml"; 79val () = Bootstrap.use "basis/IEEE_REAL.sml"; 80val () = Bootstrap.use "basis/IEEEReal.sml"; 81val () = Bootstrap.use "basis/MATH.sml"; 82val () = Bootstrap.use "basis/MATH.sml"; 83structure LargeReal = struct type real = real end; 84val () = Bootstrap.use "basis/RealSignature.sml"; 85val () = Bootstrap.use "basis/Real.sml"; 86val () = Bootstrap.use "basis/Real32.sml"; 87val () = Bootstrap.use "basis/Time.sml"; 88val () = Bootstrap.use "basis/DATE.sig"; 89val () = Bootstrap.use "basis/Date.sml"; 90val () = Bootstrap.use "basis/Thread.sml"; (* Non-standard. *) 91val () = Bootstrap.use "basis/ThreadLib.sml"; (* Non-standard. *) 92val () = Bootstrap.use "basis/Timer.sml"; 93val () = Bootstrap.use "basis/CommandLine.sml"; 94val () = Bootstrap.use "basis/ExnPrinter.sml"; 95val () = Bootstrap.use "basis/ForeignConstants.sml"; 96val () = Bootstrap.use "basis/ForeignMemory.sml"; 97val () = Bootstrap.useWithParms [Bootstrap.Universal.tagInject Bootstrap.maxInlineSizeTag 1000] "basis/Foreign.sml"; 98val () = Bootstrap.use "basis/IO.sml"; 99val () = Bootstrap.use "basis/OS.sml"; 100val () = Bootstrap.use "basis/PRIM_IO.sml"; 101val () = Bootstrap.use "basis/PrimIO.sml"; 102(*val () = Bootstrap.use "basis/TextPrimIO.sml"; 103val () = Bootstrap.use "basis/BinPrimIO.sml"; *) 104val () = Bootstrap.use "basis/LibraryIOSupport.sml"; 105val () = Bootstrap.use "basis/STREAM_IO.sml"; 106val () = Bootstrap.use "basis/BasicStreamIO.sml"; 107val () = Bootstrap.use "basis/IMPERATIVE_IO.sml"; 108val () = Bootstrap.use "basis/ImperativeIO.sml"; 109val () = Bootstrap.use "basis/TextIO.sml"; 110val () = Bootstrap.use "basis/BinIO.sml"; 111val () = Bootstrap.use "basis/Socket.sml"; 112val () = Bootstrap.use "basis/NetProtDB.sml"; 113val () = Bootstrap.use "basis/NetServDB.sml"; 114val () = Bootstrap.use "basis/GenericSock.sml"; 115val () = Bootstrap.use "basis/INetSock.sml"; 116val () = Bootstrap.use "basis/INet6Sock.sml"; 117val () = Bootstrap.use "basis/PackRealBig.sml"; (* also declares PackRealLittle *) 118val () = Bootstrap.use "basis/PackWord8Big.sml"; (* also declares Pack8Little. ...*) 119val () = Bootstrap.use "basis/Array2Signature.sml"; 120val () = Bootstrap.use "basis/Array2.sml"; 121val () = Bootstrap.use "basis/IntArray2.sml"; 122val () = Bootstrap.use "basis/SML90.sml"; 123val () = Bootstrap.use "basis/Weak.sml"; 124val () = Bootstrap.use "basis/Signal.sml"; 125val () = Bootstrap.use "basis/BIT_FLAGS.sml"; 126val () = Bootstrap.use "basis/SingleAssignment.sml"; 127 128 129(* Build Windows or Unix structure as appropriate. *) 130local 131 val getOS: int = LibrarySupport.getOSType() 132in 133 val () = 134 if getOS = 0 135 then 136 ( 137 Bootstrap.use "basis/Posix.sml"; 138 Bootstrap.use "basis/Unix.sml"; 139 Bootstrap.use "basis/UnixSock.sml" 140 ) 141 else if getOS = 1 then (Bootstrap.use "basis/Windows.sml") 142 else () 143end; 144 145val () = Bootstrap.use "basis/HashArray.ML"; 146val () = Bootstrap.use "basis/UniversalArray.ML"; 147val () = Bootstrap.use "basis/PrettyPrinter.sml"; (* Add PrettyPrinter to PolyML structure. *) 148val () = Bootstrap.use "basis/ASN1.sml"; 149val () = Bootstrap.use "basis/Statistics.ML"; (* Add Statistics to PolyML structure. *) 150val () = Bootstrap.use "basis/InitialPolyML.ML"; (* Relies on OS. *) 151val () = Bootstrap.use "basis/FinalPolyML.sml"; 152val () = Bootstrap.use "basis/TopLevelPolyML.sml"; (* Add rootFunction to Poly/ML. *) 153 154val use = PolyML.use; 155 156(* Copy everything out of the original name space. *) 157(* Do this AFTER we've finished compiling PolyML and after adding "use". *) 158val () = List.app (#enterVal PolyML.globalNameSpace) (#allVal Bootstrap.globalSpace ()) 159and () = List.app (#enterFix PolyML.globalNameSpace) (#allFix Bootstrap.globalSpace ()) 160and () = List.app (#enterSig PolyML.globalNameSpace) (#allSig Bootstrap.globalSpace ()) 161and () = List.app (#enterType PolyML.globalNameSpace) (#allType Bootstrap.globalSpace ()) 162and () = List.app (#enterFunct PolyML.globalNameSpace) (#allFunct Bootstrap.globalSpace ()) 163and () = List.app (#enterStruct PolyML.globalNameSpace) (#allStruct Bootstrap.globalSpace ()) 164 165(* We don't want Bootstrap copied over. *) 166val () = PolyML.Compiler.forgetStructure "Bootstrap"; 167 168(* Clean out structures and functors which are only used to build 169 the library. *) 170PolyML.Compiler.forgetValue "it"; 171PolyML.Compiler.forgetStructure "LibrarySupport"; 172PolyML.Compiler.forgetStructure "LibraryIOSupport"; 173PolyML.Compiler.forgetStructure "MachineConstants"; 174PolyML.Compiler.forgetStructure "ForeignConstants"; 175PolyML.Compiler.forgetStructure "ForeignMemory"; 176PolyML.Compiler.forgetFunctor "BasicStreamIO"; 177PolyML.Compiler.forgetFunctor "VectorOperations"; 178PolyML.Compiler.forgetFunctor "PolyVectorOperations"; 179PolyML.Compiler.forgetFunctor "VectorSliceOperations"; 180PolyML.Compiler.forgetFunctor "BasicImperativeIO"; 181PolyML.Compiler.forgetFunctor "ASN1"; 182PolyML.Compiler.forgetSignature "ASN1"; 183 184(* Now we've created the new name space we must use PolyML.make/use. N.B. Unlike Bootstrap.use 185 these don't automatically look at the -I option. *) 186 187 188 189