summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-02-06 15:34:41 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-02-06 15:34:41 -0500
commita978113ec89492e3c612e2409b8dfd0f3c9682cb (patch)
tree030689d7f60d1b5a580b8c638f1c297899b068d7 /src
parent0771f5711f1bfcd0b958049957f91289622e5f85 (diff)
Allow .urp files without initial blank lines
Diffstat (limited to 'src')
-rw-r--r--src/compiler.sml25
-rw-r--r--src/demo.sml9
2 files changed, 29 insertions, 5 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index e72d8b4b..ab3ec10a 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -282,7 +282,25 @@ fun parseUrp' accLibs fname =
fun pu filename =
let
val dir = OS.Path.dir filename
- val inf = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"})
+ fun opener () = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"})
+
+ val inf = opener ()
+
+ fun hasAnyLine () =
+ case TextIO.inputLine inf of
+ NONE => false
+ | SOME "\n" => false
+ | _ => true
+
+ fun hasBlankLine () =
+ case TextIO.inputLine inf of
+ NONE => false
+ | SOME "\n" => hasAnyLine ()
+ | _ => hasBlankLine ()
+
+ val hasBlankLine = hasBlankLine ()
+
+ val inf = (TextIO.closeIn inf; opener ())
fun pathify fname =
if size fname > 0 andalso String.sub (fname, 0) = #"$" then
@@ -591,7 +609,10 @@ fun parseUrp' accLibs fname =
read ()
end
- val job = read ()
+ val job = if hasBlankLine then
+ read ()
+ else
+ finish (readSources [])
in
TextIO.closeIn inf;
Settings.setUrlPrefix (#prefix job);
diff --git a/src/demo.sml b/src/demo.sml
index 55615173..71f72fbf 100644
--- a/src/demo.sml
+++ b/src/demo.sml
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008, Adam Chlipala
+(* Copyright (c) 2008-2010, Adam Chlipala
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -197,7 +197,8 @@ fun make' {prefix, dirname, guided} =
ext = SOME s}
val src' = OS.Path.file src
in
- if String.isPrefix (OS.Path.mkCanonical dirname) src
+ if String.isPrefix (OS.Path.mkAbsolute {path = dirname,
+ relativeTo = OS.FileSys.getDir ()}) src
andalso OS.FileSys.access (src, []) then
(TextIO.output (out, " | <a target=\"showcase\" href=\"");
TextIO.output (out, src');
@@ -205,7 +206,9 @@ fun make' {prefix, dirname, guided} =
TextIO.output (out, src');
TextIO.output (out, "</tt></a>"))
else
- ()
+ print (src ^ " "
+ ^ OS.Path.mkAbsolute {path = dirname,
+ relativeTo = OS.FileSys.getDir ()} ^ "\n")
end
in
ifEx "urs";