annotate demo/roundTrip.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 ed06e25c70ef
children
rev   line source
adamc@698 1 table channels : { Client : client, Channel : channel (string * int * float) }
adamc@708 2 PRIMARY KEY Client
adamc@698 3
adamc@698 4 fun writeBack v =
adamc@698 5 me <- self;
adamc@698 6 r <- oneRow (SELECT channels.Channel FROM channels WHERE channels.Client = {[me]});
adamc@698 7 send r.Channels.Channel v
adamc@698 8
adamc@733 9 fun action () =
adamc@698 10 me <- self;
adamc@698 11 ch <- channel;
adamc@698 12 dml (INSERT INTO channels (Client, Channel) VALUES ({[me]}, {[ch]}));
adamc@698 13
adamc@698 14 buf <- Buffer.create;
adamc@698 15
adamc@698 16 let
adamc@698 17 fun receiver () =
adamc@698 18 v <- recv ch;
adamc@698 19 Buffer.write buf ("(" ^ v.1 ^ ", " ^ show v.2 ^ ", " ^ show v.3 ^ ")");
adamc@698 20 receiver ()
adamc@698 21
adamc@698 22 fun sender s n f =
adamc@698 23 sleep 2000;
adamc@908 24 rpc (writeBack (s, n, f));
adamc@698 25 sender (s ^ "!") (n + 1) (f + 1.23)
adamc@698 26 in
adamc@698 27 return <xml><body onload={spawn (receiver ()); sender "" 0 0.0}>
adamc@698 28 <dyn signal={Buffer.render buf}/>
adamc@698 29 </body></xml>
adamc@698 30 end
adamc@733 31
adamc@733 32 fun main () = return <xml><body>
adamc@733 33 <form><submit value="Begin demo" action={action}/></form>
adamc@733 34 </body></xml>