annotate demo/tree.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 d069b193ed6b
children
rev   line source
adamc@471 1 sequence s
adamc@469 2 table t : { Id : int, Parent : option int, Nam : string }
adamc@715 3 PRIMARY KEY Id,
adamc@715 4 CONSTRAINT F FOREIGN KEY Parent REFERENCES t (Id) ON DELETE CASCADE
adamc@469 5
adamc@469 6 open TreeFun.Make(struct
adamc@1078 7 con id = #Id
adamc@1078 8 con parent = #Parent
adamc@1079 9 val tab = t
adamc@469 10 end)
adamc@469 11
adamc@469 12 fun row r = <xml>
adamc@732 13 #{[r.Id]}: {[r.Nam]} <form><submit action={del r.Id} value="Delete"/></form>
adamc@471 14
adamc@471 15 <form>
adamc@471 16 Add child: <textbox{#Nam}/> <submit action={add (Some r.Id)}/>
adamc@471 17 </form>
adamc@469 18 </xml>
adamc@469 19
adamc@471 20 and main () =
adamc@469 21 xml <- tree row None;
adamc@469 22 return <xml><body>
adamc@469 23 {xml}
adamc@471 24
adamc@471 25 <form>
adamc@471 26 Add a top-level node: <textbox{#Nam}/> <submit action={add None}/>
adamc@471 27 </form>
adamc@469 28 </body></xml>
adamc@471 29
adamc@471 30 and add parent r =
adamc@471 31 id <- nextval s;
adamc@471 32 dml (INSERT INTO t (Id, Parent, Nam) VALUES ({[id]}, {[parent]}, {[r.Nam]}));
adamc@471 33 main ()
adamc@471 34
adamc@732 35 and del id () =
adamc@471 36 dml (DELETE FROM t WHERE Id = {[id]});
adamc@471 37 main ()