annotate demo/nested.ur @ 1739:c414850f206f

Add support for -boot flag, which allows in-tree execution of Ur/Web The boot flag rewrites most hardcoded paths to point to the build directory, and also forces static compilation. This is convenient for developing Ur/Web, or if you cannot 'sudo make install' Ur/Web. The following changes were made: * Header files were moved to include/urweb instead of include; this lets FFI users point their C_INCLUDE_PATH at this directory at write <urweb/urweb.h>. For internal Ur/Web executables, we simply pass -I$PATH/include/urweb as normal. * Differentiate between LIB and SRCLIB; SRCLIB is Ur and JavaScript source files, while LIB is compiled products from libtool. For in-tree compilation these live in different places. * No longer reference Config for paths; instead use Settings; these settings can be changed dynamically by Compiler.enableBoot () (TODO: add a disableBoot function.) * config.h is now generated directly in include/urweb/config.h, for consistency's sake (especially since it gets installed along with the rest of the headers!) * All of the autotools build products got updated. * The linkStatic field in protocols now only contains the name of the build product, and not the absolute path. Future users have to be careful not to reference the Settings files to early, lest they get an old version (this was the source of two bugs during development of this patch.)
author Edward Z. Yang <ezyang@mit.edu>
date Wed, 02 May 2012 17:17:57 -0400
parents d4a81273d4b1
children
rev   line source
adamc@455 1 fun pageA () = return <xml>
adamc@455 2 <head>
adamc@455 3 <title>A</title>
adamc@455 4 </head>
adamc@455 5 <body>
adamc@455 6 <form>
adamc@455 7 <table>
adamc@455 8 <tr>
adamc@455 9 <td>Forename:</td>
adamc@455 10 <td><textbox{#Forename}/></td>
adamc@455 11 </tr>
adamc@455 12 <tr>
adamc@455 13 <td>Enter a Surname?</td>
adamc@455 14 <td><checkbox{#EnterSurname}/></td>
adamc@455 15 </tr>
adamc@455 16 </table>
adamc@455 17 <submit action={fromA} />
adamc@455 18 </form>
adamc@455 19 </body>
adamc@455 20 </xml>
adamc@455 21
adamc@455 22 and fromA r =
adamc@455 23 let
adamc@455 24 val forename = r.Forename
adamc@455 25
adamc@455 26 fun pageB () = return <xml>
adamc@455 27 <head>
adamc@455 28 <title>B</title>
adamc@455 29 </head>
adamc@455 30 <body>
adamc@455 31 <form>
adamc@455 32 Surname:
adamc@455 33 <textbox{#Surname}/>
adamc@455 34 <submit action={pageC'} />
adamc@455 35 </form>
adamc@455 36 <a link={pageA ()}>Previous</a>
adamc@455 37 </body>
adamc@455 38 </xml>
adamc@455 39
adamc@455 40 and pageC' r = pageC (Some r.Surname)
adamc@455 41
adamc@455 42 and pageC surname = return <xml>
adamc@455 43 <head>
adamc@455 44 <title>C</title>
adamc@455 45 </head>
adamc@455 46 <body>
adamc@455 47 <p>Hello {[forename]}{case surname of
adamc@455 48 None => <xml/>
adamc@455 49 | Some s => <xml> {[s]}</xml>}</p>
adamc@455 50 {case surname of
adamc@455 51 None => <xml><a link={pageA ()}>Previous</a></xml>
adamc@455 52 | Some _ => <xml><a link={pageB ()}>Previous</a></xml>}
adamc@455 53 </body>
adamc@455 54 </xml>
adamc@455 55 in
adamc@455 56 if r.EnterSurname then
adamc@455 57 pageB ()
adamc@455 58 else
adamc@455 59 pageC None
adamc@455 60 end
adamc@455 61
adamc@455 62 val main = pageA