annotate tests/gformText.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 71bafe66dbe1
children
rev   line source
adamc@151 1 con stringify = fold (fn nm :: Name => fn u :: Unit => fn t :: {Type} => [nm = string] ++ t) []
adamc@151 2
adamc@151 3 signature S = sig
adamc@151 4 con rs :: {Unit}
adamc@151 5 val names : $(stringify rs)
adamc@151 6 end
adamc@151 7
adamc@151 8 signature S' = sig
adamc@151 9 con rs :: {Unit}
adamc@151 10
adamc@151 11 val handler : $(stringify rs) -> page
adamc@151 12 val page : unit -> page
adamc@151 13 end
adamc@151 14
adamc@151 15 functor F (M : S) : S' where con rs = M.rs = struct
adamc@151 16 con rs = M.rs
adamc@151 17
adamc@151 18 val handler = fn x : $(stringify M.rs) => <html><body>
adamc@151 19 {fold [fn rs :: {Unit} => $(stringify rs) -> $(stringify rs) -> xml body [] []]
adamc@151 20 (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} =>
adamc@151 21 fn f : $(stringify rest) -> $(stringify rest) -> xml body [] [] =>
adamc@151 22 fn names : $(stringify ([nm] ++ rest)) =>
adamc@151 23 fn x : $(stringify ([nm] ++ rest)) =>
adamc@151 24 <body><li> {cdata names.nm}: {cdata x.nm}</li> {f (names -- nm) (x -- nm)}</body>)
adamc@151 25 (fn names => fn x => <body></body>)
adamc@151 26 [M.rs] M.names x}
adamc@151 27 </body></html>
adamc@151 28
adamc@151 29 val page = fn () => <html><body>
adamc@151 30 <lform>
adamc@151 31 {fold [fn rs :: {Unit} => xml lform [] (stringify rs)]
adamc@151 32 (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} =>
adamc@151 33 fn frag : xml lform [] (stringify rest) =>
adamc@151 34 <lform><li> <textbox{nm}/></li> {useMore frag}</lform>)
adamc@151 35 <lform></lform>
adamc@151 36 [rs]}
adamc@151 37
adamc@151 38 <submit action={handler}/>
adamc@151 39 </lform>
adamc@151 40 </body></html>
adamc@151 41 end
adamc@151 42
adamc@151 43 structure M = F(struct
adamc@151 44 con rs = [A, B, C]
adamc@151 45
adamc@151 46 val names = {A = "A", B = "B", C = "C"}
adamc@151 47 end)
adamc@151 48
adamc@151 49 open M
adamc@151 50