adamc@380: (* Copyright (c) 2008, Adam Chlipala adamc@380: * All rights reserved. adamc@380: * adamc@380: * Redistribution and use in source and binary forms, with or without adamc@380: * modification, are permitted provided that the following conditions are met: adamc@380: * adamc@380: * - Redistributions of source code must retain the above copyright notice, adamc@380: * this list of conditions and the following disclaimer. adamc@380: * - Redistributions in binary form must reproduce the above copyright notice, adamc@380: * this list of conditions and the following disclaimer in the documentation adamc@380: * and/or other materials provided with the distribution. adamc@380: * - The names of contributors may not be used to endorse or promote products adamc@380: * derived from this software without specific prior written permission. adamc@380: * adamc@380: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" adamc@380: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE adamc@380: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE adamc@380: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE adamc@380: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR adamc@380: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF adamc@380: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS adamc@380: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN adamc@380: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) adamc@380: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE adamc@380: * POSSIBILITY OF SUCH DAMAGE. adamc@380: *) adamc@380: adamc@380: structure Demo :> DEMO = struct adamc@380: adamc@380: fun make {prefix, dirname} = adamc@380: let adamc@380: val prose = OS.Path.joinDirFile {dir = dirname, adamc@380: file = "prose"} adamc@380: val inf = TextIO.openIn prose adamc@380: adamc@380: val demo_urp = OS.Path.joinDirFile {dir = dirname, adamc@380: file = "demo.urp"} adamc@380: adamc@380: val outDir = OS.Path.concat (dirname, "out") adamc@380: adamc@380: val () = if OS.FileSys.access (outDir, []) then adamc@380: () adamc@380: else adamc@380: OS.FileSys.mkDir outDir adamc@380: adamc@380: val fname = OS.Path.joinDirFile {dir = outDir, adamc@380: file = "index.html"} adamc@380: adamc@380: val out = TextIO.openOut fname adamc@380: val () = (TextIO.output (out, "\n"); adamc@380: TextIO.output (out, "\n"); adamc@380: TextIO.output (out, "\n"); adamc@380: TextIO.output (out, "\n"); adamc@380: TextIO.closeOut out) adamc@380: adamc@380: val fname = OS.Path.joinDirFile {dir = outDir, adamc@380: file = "demos.html"} adamc@380: adamc@380: val demosOut = TextIO.openOut fname adamc@380: val () = (TextIO.output (demosOut, "\n"); adamc@380: TextIO.closeOut demosOut adamc@380: end adamc@380: adamc@380: end