# HG changeset patch # User Mike Pavone # Date 1290407825 18000 # Node ID f582fd6c75eeb066d882ee3972043fe3a349a1dc # Parent f3686f60985deb2927d1446576abb91fd7ebbba9 Fixed framework port, works for said.rhope example diff -r f3686f60985d -r f582fd6c75ee framework.rhope --- a/framework.rhope Mon Nov 22 01:15:02 2010 -0500 +++ b/framework.rhope Mon Nov 22 01:37:05 2010 -0500 @@ -37,10 +37,7 @@ } string,out headers <- [final page]Render - after headers <- HTTP OK[ncon, Get Content Type[".html"], [string]Byte Length, out headers] - { Print["Sent status"] - { [[string]Write to File[after headers]]Close - { Print["Wrote data"] }}} + [[string]Write to File[HTTP OK[ncon, Get Content Type[".html"], [string]Byte Length, out headers]]]Close } Handler Fixer[handler:out] @@ -423,7 +420,7 @@ Process POST[page,con,headers:out,ncon] { - ,ncon <- [con]Read[[headers]Index["Content-Length"]] + ,ncon <- [con]Read[Int32[[headers]Index["Content-Length"]]] { post string <- [String[~]]Replace["+"," "] } @@ -513,6 +510,48 @@ out <- in } +Render@String Cat[string:out,headers] +{ + out <- [Web Text[string,""]]Render +} + +Name@String Cat[string:out,none] +{ + none <- string +} + +Postback@String Cat[in,post data:out,events] +{ + out <- in + events <- List[] +} + +Set Session@String Cat[in,session:out] +{ + out <- in +} + +Render@String Slice[string:out,headers] +{ + out <- [Web Text[string,""]]Render +} + +Name@String Slice[string:out,none] +{ + none <- string +} + +Postback@String Slice[in,post data:out,events] +{ + out <- in + events <- List[] +} + +Set Session@String Slice[in,session:out] +{ + out <- in +} + Blueprint Web Field { Name @@ -612,20 +651,23 @@ Dirty } -Get Unique ID[:out] uses Session +_Get Counter[:out] uses Session { - Print["Get Unique ID"] - out <- [[String[Session::ID]]Append["_"]]Append[String[Random[]]] - { Session::ID <- [Session::ID]+[1] } + out <- Val[Session::ID] + { Session::ID <- [~]+[1] } +} + +Get Unique ID[:out] +{ + out <- [[String[_Get Counter[]]]Append["_"]]Append[String[Random[]]] } Session[:out] { out <- [[[[Build[Session()]]Session ID <<[Get Unique ID[]]]Use Cookies <<[No]]Data <<[Dictionary[]]]Dirty <<[No] - { Print["Built session"] } } -Load Session[queryvars,headers:out] uses Session +_Load Session[queryvars,headers:out,makenew] uses Session { ,checkquery <- [headers]Index["Cookie"] { @@ -647,8 +689,11 @@ out, makenew <- [Session::Sessions]Index[~] } } - - Val[makenew] +} + +Load Session[queryvars,headers:out] +{ + out <- _Load Session[queryvars,headers] {} { out <- Session[] } @@ -700,6 +745,7 @@ Save@Session[session:out] uses Session { Session::Sessions <- [Session::Sessions]Set[[session]Session ID >>, session] + out <- Yes } Finalize@Session[session,headers:out headers] diff -r f3686f60985d -r f582fd6c75ee kernel.rhope --- a/kernel.rhope Mon Nov 22 01:15:02 2010 -0500 +++ b/kernel.rhope Mon Nov 22 01:37:05 2010 -0500 @@ -316,7 +316,6 @@ _Seeded?[:yep,nope] uses _rand { - Print["Seeded"] yep,nope <- If[_rand::seeded] {} { _rand::seeded <- Yes @@ -331,7 +330,6 @@ Random[:out] { - Print["Random"] yep,nope <- _Seeded?[] Val[yep] { diff -r f3686f60985d -r f582fd6c75ee said.rhope --- a/said.rhope Mon Nov 22 01:15:02 2010 -0500 +++ b/said.rhope Mon Nov 22 01:37:05 2010 -0500 @@ -35,7 +35,7 @@ Web Button["blah","Click!"] //The Set Handler call here attaches the worker Save Text to the click event for the page //Events propagate can propagate themselves up the page hierarchy and handled wherever appropriate - ]]Set Handler["click","Save Text"] + ]]Set Handler["click",Save Text[?]] } } diff -r f3686f60985d -r f582fd6c75ee webserver.rhope --- a/webserver.rhope Mon Nov 22 01:15:02 2010 -0500 +++ b/webserver.rhope Mon Nov 22 01:37:05 2010 -0500 @@ -162,7 +162,6 @@ Connection Start[con,address,handlers] { - Print["New connection!"] ,client <- [con]Read Delim[["\r\n"]Buffer >>] { request <- String[~] } parts <- [request]Split[" "]