changeset 1301:4359e185d3af

Demo improvements
author Adam Chlipala <adam@chlipala.net>
date Thu, 30 Sep 2010 18:29:59 -0400
parents e3944a8a128a
children d008c4c43a0a
files demo/counter.ur demo/prose src/demo.sig src/demo.sml src/main.mlton.sml
diffstat 5 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/demo/counter.ur	Thu Sep 30 18:12:04 2010 -0400
+++ b/demo/counter.ur	Thu Sep 30 18:29:59 2010 -0400
@@ -1,3 +1,4 @@
+(* Workhorse function, which [main] will call *)
 fun counter n = return <xml><body>
   Current counter: {[n]}<br/>
   <a link={counter (n + 1)}>Increment</a><br/>
--- a/demo/prose	Thu Sep 30 18:12:04 2010 -0400
+++ b/demo/prose	Thu Sep 30 18:29:59 2010 -0400
@@ -5,7 +5,7 @@
 <blockquote><pre>./configure
 make
 sudo make install
-urweb -demo /Demo demo</pre></blockquote></p>
+urweb -noEmacs -demo /Demo demo</pre></blockquote></p>
 
 <p>The <tt>-demo /Demo</tt> flag says that we want to build a demo application that expects its URIs to begin with <tt>/Demo</tt>.  The final argument <tt>demo</tt> gives the path to a directory housing demo files.  One of the files in that directory is <tt>prose</tt>, a file describing the different demo pieces with HTML.  Some lines of <tt>prose</tt> have the form <tt><i>foo</i>.urp</tt>, naming particular project files (with the extension <tt>.urp</tt>) in that directory.</p>
 
--- a/src/demo.sig	Thu Sep 30 18:12:04 2010 -0400
+++ b/src/demo.sig	Thu Sep 30 18:29:59 2010 -0400
@@ -30,4 +30,6 @@
     val make : {prefix : string, dirname : string, guided : bool} -> unit
     val make' : {prefix : string, dirname : string, guided : bool} -> bool
 
+    val noEmacs : bool ref
+
 end
--- a/src/demo.sml	Thu Sep 30 18:12:04 2010 -0400
+++ b/src/demo.sml	Thu Sep 30 18:29:59 2010 -0400
@@ -27,6 +27,8 @@
 
 structure Demo :> DEMO = struct
 
+val noEmacs = ref false
+
 fun make' {prefix, dirname, guided} =
     let
         val prose = OS.Path.joinDirFile {dir = dirname,
@@ -333,6 +335,8 @@
                                              else
                                                  ()
                                          end)
+
+                            val highlight = fn () => if !noEmacs then () else highlight ()
                         in
                             if OS.Path.base file = "demo" then
                                 ()
--- a/src/main.mlton.sml	Thu Sep 30 18:12:04 2010 -0400
+++ b/src/main.mlton.sml	Thu Sep 30 18:29:59 2010 -0400
@@ -88,6 +88,9 @@
       | "-moduleOf" :: fname :: _ =>
         (print (Compiler.moduleOf fname ^ "\n");
          OS.Process.exit OS.Process.success)
+      | "-noEmacs" :: rest =>
+        (Demo.noEmacs := true;
+         doArgs rest)
       | arg :: rest =>
         (if size arg > 0 andalso String.sub (arg, 0) = #"-" then
              raise Fail ("Unknown flag " ^ arg)