annotate demo/crud2.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 669ac5e9a69e
children
rev   line source
adamc@422 1 table t : {Id : int, Nam : string, Ready : bool}
adamc@708 2 PRIMARY KEY Id
adamc@422 3
adamc@422 4 open Crud.Make(struct
adamc@422 5 val tab = t
adamc@422 6
adamc@422 7 val title = "Are you ready?"
adamc@422 8
adamc@422 9 val cols = {Nam = Crud.string "Name",
adamc@422 10 Ready = {Nam = "Ready",
adamc@422 11 Show = (fn b => if b then
adamc@422 12 <xml>Ready!</xml>
adamc@422 13 else
adamc@422 14 <xml>Not ready</xml>),
adamc@823 15 Widget = (fn [nm :: Name] => <xml>
adamc@422 16 <select{nm}>
adamc@422 17 <option>Ready</option>
adamc@422 18 <option>Not ready</option>
adamc@422 19 </select>
adamc@422 20 </xml>),
adamc@823 21 WidgetPopulated = (fn [nm :: Name] b => <xml>
adamc@422 22 <select{nm}>
adamc@422 23 <option selected={b}>Ready</option>
adamc@422 24 <option selected={not b}>Not ready</option>
adamc@422 25 </select>
adamc@422 26 </xml>),
adamc@422 27 Parse = (fn s =>
adamc@422 28 case s of
adamc@422 29 "Ready" => True
adamc@422 30 | "Not ready" => False
adamc@422 31 | _ => error <xml>Invalid ready/not ready</xml>),
adamc@422 32 Inject = _
adamc@422 33 }
adamc@422 34 }
adamc@422 35 end)