Mercurial > repos > rhope
changeset 148:f582fd6c75ee
Fixed framework port, works for said.rhope example
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 22 Nov 2010 01:37:05 -0500 |
parents | f3686f60985d |
children | 804e48af1027 |
files | framework.rhope kernel.rhope said.rhope webserver.rhope |
diffstat | 4 files changed, 60 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- 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]
--- 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] {
--- 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[?]] } }