1(* 2 Title: Bootstrap code. 3 Author: David Matthews 4 Copyright David Matthews 2005-2008, 2017 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License version 2.1 as published by the Free Software Foundation. 9 10 This library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with this library; if not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18*) 19val () = RunCall.addOverload Bootstrap.convString Bootstrap.convStringName; 20val () = RunCall.addOverload Bootstrap.convInt "convInt"; 21val () = RunCall.addOverload Bootstrap.convWord "convWord"; 22 23(* Build the main basis library. *) 24val () = Bootstrap.use "basis/build.sml"; 25 26(* We've now set up the new name space so everything has to be 27 compiled into that rather than the old space. *) 28 (* XWindows/Motif *) 29val () = 30let 31 val xWindowsGeneralCall = RunCall.rtsCallFull1 "PolyXWindowsGeneral" 32 val xcall: int*int->int*int = xWindowsGeneralCall 33 (* See if the RTS supports the X GetTimeOfDay call. *) 34 val isX = (xcall(30, 0); true) handle _ => false 35in 36 if isX 37 then 38 ( 39 PolyML.make "mlsource/extra/XWindows"; 40 PolyML.make "mlsource/extra/Motif" 41 ) 42 else () 43end; 44 45val () = PolyML.print_depth 10; 46 47(* Write out the result as an export file. *) 48local 49 val args = CommandLine.arguments(); 50 (* If we have -o filename use that as the output name. 51 N.B. polyImport takes the first argument that is not recognised as 52 an RTS argument and treats that as the file name so any -o must occur 53 AFTER the import file. *) 54 fun getFile [] = "polyexport" (* Default file name *) 55 | getFile ("-o" :: outFile :: _) = outFile 56 | getFile (_::tl) = getFile tl 57 val fileName = getFile args 58in 59 val () = PolyML.shareCommonData PolyML.rootFunction; 60 val () = PolyML.export(fileName, PolyML.rootFunction) 61end; 62 63