# HG changeset patch # User Adam Chlipala # Date 1265488481 18000 # Node ID de48dc2c9ee863edc6030fbe52a96f89177b0adb # Parent 151837581b5e504794587481986f53ae2e57c0f8 Allow .urp files without initial blank lines diff -r 151837581b5e -r de48dc2c9ee8 demo/alert.urp --- a/demo/alert.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/alert.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - alert diff -r 151837581b5e -r de48dc2c9ee8 demo/batchFun.urp --- a/demo/batchFun.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/batchFun.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - batchFun diff -r 151837581b5e -r de48dc2c9ee8 demo/cookie.urp --- a/demo/cookie.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/cookie.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - cookie diff -r 151837581b5e -r de48dc2c9ee8 demo/counter.urp --- a/demo/counter.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/counter.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - counter diff -r 151837581b5e -r de48dc2c9ee8 demo/form.urp --- a/demo/form.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/form.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - form diff -r 151837581b5e -r de48dc2c9ee8 demo/hello.urp --- a/demo/hello.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/hello.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - hello diff -r 151837581b5e -r de48dc2c9ee8 demo/link.urp --- a/demo/link.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/link.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - link diff -r 151837581b5e -r de48dc2c9ee8 demo/listEdit.urp --- a/demo/listEdit.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/listEdit.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - listEdit diff -r 151837581b5e -r de48dc2c9ee8 demo/listShop.urp --- a/demo/listShop.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/listShop.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,4 +1,3 @@ - list listFun listShop diff -r 151837581b5e -r de48dc2c9ee8 demo/metaform1.urp --- a/demo/metaform1.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/metaform1.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,3 +1,2 @@ - metaform metaform1 diff -r 151837581b5e -r de48dc2c9ee8 demo/metaform2.urp --- a/demo/metaform2.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/metaform2.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,3 +1,2 @@ - metaform metaform2 diff -r 151837581b5e -r de48dc2c9ee8 demo/nested.urp --- a/demo/nested.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/nested.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - nested diff -r 151837581b5e -r de48dc2c9ee8 demo/react.urp --- a/demo/react.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/react.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - react diff -r 151837581b5e -r de48dc2c9ee8 demo/rec.urp --- a/demo/rec.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/rec.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - rec diff -r 151837581b5e -r de48dc2c9ee8 demo/subforms.urp --- a/demo/subforms.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/subforms.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - subforms diff -r 151837581b5e -r de48dc2c9ee8 demo/sum.urp --- a/demo/sum.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/sum.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - sum diff -r 151837581b5e -r de48dc2c9ee8 demo/tcSum.urp --- a/demo/tcSum.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/tcSum.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,2 +1,1 @@ - tcSum diff -r 151837581b5e -r de48dc2c9ee8 demo/threads.urp --- a/demo/threads.urp Sat Feb 06 13:53:26 2010 -0500 +++ b/demo/threads.urp Sat Feb 06 15:34:41 2010 -0500 @@ -1,3 +1,2 @@ - buffer threads diff -r 151837581b5e -r de48dc2c9ee8 doc/manual.tex --- a/doc/manual.tex Sat Feb 06 13:53:26 2010 -0500 +++ b/doc/manual.tex Sat Feb 06 15:34:41 2010 -0500 @@ -128,7 +128,7 @@ psql -f crud1.sql test \end{verbatim} -A blank line always separates the named directives from a list of modules to include in the project; if there are no named directives, a blank line must begin the file. +A blank line separates the named directives from a list of modules to include in the project. For each entry \texttt{M} in the module list, the file \texttt{M.urs} is included in the project if it exists, and the file \texttt{M.ur} must exist and is always included. diff -r 151837581b5e -r de48dc2c9ee8 src/compiler.sml --- a/src/compiler.sml Sat Feb 06 13:53:26 2010 -0500 +++ b/src/compiler.sml Sat Feb 06 15:34:41 2010 -0500 @@ -282,7 +282,25 @@ 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 @@ read () end - val job = read () + val job = if hasBlankLine then + read () + else + finish (readSources []) in TextIO.closeIn inf; Settings.setUrlPrefix (#prefix job); diff -r 151837581b5e -r de48dc2c9ee8 src/demo.sml --- a/src/demo.sml Sat Feb 06 13:53:26 2010 -0500 +++ b/src/demo.sml Sat Feb 06 15:34:41 2010 -0500 @@ -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 @@ 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, " | ")) else - () + print (src ^ " " + ^ OS.Path.mkAbsolute {path = dirname, + relativeTo = OS.FileSys.getDir ()} ^ "\n") end in ifEx "urs";