Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Rebol Server Pages: erebol 2

 [1/6] from: koopmans:itr:ing:nl at: 5-Feb-2002 10:51


Hi All, My erebol script for embedded rebol in text (XML, HTML) etc. for web server use to out-everything JSP, ASP, SSI and PHP has been rewritten by Ernie. The actual erebol parsing has been reduced dramatically. What have we learned? Complex rules (the one with subrules) first in parsing! Otherwise matches may not occur while parsing. If you inline the parse stuff it can be reduce to one line. See below.... --Maarten REBOL [ Title: {eRebol embedded rebol code evaluator.} Author: {Maarten Koopmans, Ernie van der Meer} Comment: {Added console capturing, thanx to dockimbel. So... now with /as-string refinement. Rewrite by Ernie.} ] ctx-console-capture: context [ out: none sys-print: get in system/words 'print sys-prin: get in system/words 'prin set 'get-captured does [out] print-out: func [value][append out reform [reduce value newline]] prin-out: func [value][append out reform value] set 'capture func [ {Capture console output} flag [logic!] ] [ either flag [ out: copy {} set 'print :print-out set 'prin :prin-out ] [ set 'print :sys-print set 'prin :sys-prin ] ] ] erebol: func [ {Preprocesses a text file and evaluates all rebol code between <% and %> tags. Everything that is printed is visible in the output. Who needs PHP?} content [file! string!] {The content to erebol} /as-string {Return the processed content as a string} /local text comment-rule exec-rule code other ] [ if as-string [ capture on ] text: either file? content [read content][copy content] comment-rule: [ "<%#" thru "%>" ] exec-rule: [ "<%" copy code to "%>" thru "%>" ] ; Parse input text, skipping comments, executing code and printing ; whatever other stuff we run into. parse/all text [ any [ comment-rule | exec-rule (error? try reduce [ 'do code ]) | copy other skip (prin other) ] ] if as-string [ capture off return get-captured ] ]

 [2/6] from: petr:krenzelok:trz:cz at: 5-Feb-2002 11:36


I would abstract it a little bit though :-) 1) I use following tagging when I cooperate with my friend who does design: <!--[table_x_start]--> stuff ... <!--[table_x_end]--> hmm, different technique. My friend wants the design to be visible, whne doing design using visual tool (e.g. FrontPage). So he basically lays out whole site, and then marks section I will replace by rebol generated code ... Maybe I could switch to your tags <% ... 2) Nice capturing, although a little bit complicated :-) What is real-life example of erebol usage? cgi script resulting into erebol/as-string %some-site.html ? 3) As for "who needs php" message. Well, we should now focus on .NET. Their framework allows to plug-in other languages than C#, e.g. Perl, Python are planned, in compiled versions. I wonder if Rebol could be plugged-in too ... btw: waiting for your new Rugby release to give it a test. I can imagine one FastCGIExternal server - fast-cgi listening loop + Rugby client, doing just redirections(simple deffered rexecs)/simple-kind-of-load-balancing to another 3 or 5 instances of Rugby servers, doing the job. More complex query in my environment lasts 0.5 sec, so it will be interesting, how it scales down :-) Cheers, -pekr-

 [3/6] from: m:koopmans2:chello:nl at: 6-Feb-2002 17:07


> btw: waiting for your new Rugby release to give it a test. I can imagine one > FastCGIExternal server - fast-cgi listening loop + Rugby client, doing just > redirections(simple deffered rexecs)/simple-kind-of-load-balancing to another 3 > or 5 instances of Rugby servers, doing the job. More complex query in my > environment lasts 0.5 sec, so it will be interesting, how it scales down :-) >
This will take time. Fixing the leak in 4.3 effectively broke the marshaling :( XPib3 is basically current RUgby in more stable version, and secure as well. Only uses http transport. I'll put it on later this week. --Maarten

 [4/6] from: petr:krenzelok:trz:cz at: 6-Feb-2002 19:09


[m--koopmans2--chello--nl] wrote:
>>btw: waiting for your new Rugby release to give it a test. I can imagine one >>FastCGIExternal server - fast-cgi listening loop + Rugby client, doing just
<<quoted lines omitted: 3>>
>> >This will take time. Fixing the leak in 4.3 effectively broke the marshaling :(
eh, what is "marshaling"? :-) -pekr-

 [5/6] from: joel::neely::fedex::com at: 6-Feb-2002 14:51


Hi, Petr, Petr Krenzelok wrote:
> [m--koopmans2--chello--nl] wrote: > >
<<quoted lines omitted: 3>>
> eh, what is "marshaling"? :-) > -pekr-
Transforming the internal representation of some entity in a program (object/data/structure/whatever) into a form suitable for external transport. Especially if the external form is specifically defined to be independent of whatever boxen may be at either end of the transport. -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;

 [6/6] from: m:koopmans2:chello:nl at: 7-Feb-2002 9:31


> [m--koopmans2--chello--nl] wrote: > > >>btw: waiting for your new Rugby release to give it a test. I can imagine
one
> >>FastCGIExternal server - fast-cgi listening loop + Rugby client, doing
just
> >>redirections(simple deffered rexecs)/simple-kind-of-load-balancing to
another 3
> >>or 5 instances of Rugby servers, doing the job. More complex query in my > >>environment lasts 0.5 sec, so it will be interesting, how it scales down
:-)
> >> > > > >This will take time. Fixing the leak in 4.3 effectively broke the
marshaling :(
> > > > eh, what is "marshaling"? :-) >
Marshaling is the process of converting whatever type to a string or set of bytes and back. This allows you to send an object over the wire, for example. --Maarten

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted