Home   Archive   Permalink



httpd.r

Chris,
    
How should I start the server in R2? For now the script goes back to the command prompt.
    
I tried start 60111
    
import generates an error in Ren-C
    
Can you provide more info?
    
Thanks

posted by:   VIDpuzzle     6-Mar-2019/15:53:14-8:00



There are efforts to make Ren-C emulate a common subset of Rebol2/R3-Alpha/Red. The name for that is "Redbol". But it is a work in progress.
    
Working with Ren-C is about being part of an evolving experiment (well, I guess in all things Rebolish, that's true, but the thing is that Ren-C is discussed and modified daily). If that's your cup of tea: https://forum.rebol.info/
    
There are efforts to put Ren-C on the web (currently you must enable WASM threading in your browser, though it can run without it, it's 30x slower, we are not yet deploying a bridge to that inferior version but we will as a pragmatic fallback if browsers do not start enabling wasm threads by default mid-2019):
    
http://hostilefork.com/media/shared/replpad-js/
    
Not that running in a browser would help a http server. But the point is, Rebol2 has not been developed, and Carl ceased committing to R3-Alpha GitHub. De facto, Ren-C is the only branch of active Rebol development--besides a few patches by user Oldes. I do not agree with him on very much. But if his priorities speak to you, feel free to look at his branch:
    
https://github.com/Oldes/Rebol3
    
Right now, if you are interested in GUI the right place to ask is Red:
    
https://gitter.im/red/red
    
They are staying closer to Rebol2's VID model and not really trying to adapt the language that much. Ren-C is more "radical", but, I think we're trying to put reason at the center of it all.

posted by:   Fork     6-Mar-2019/18:20:36-8:00



I am aware of Red.
    
I focus on Ren-C because it is portable code I want embed in C.
    
Until I finalize target GUI, I'd like to use R2 (OSX Linux Winx) as the pretty face with as much Ren-C in the backend as possible.
    
The only reason httpd.r got in the mix was to serve random file access on Gigabye size file,
    
R2 copy/part being slow for large file random access.
    
The other usecase is to push layout blocks onto the R2 GUI allowing GUI development using a Ren-C codebase.
    
All I need is a socket to exchange messages between R2 and Ren-C.
    
Granted if this is not possible I can always fall back onto exchanging messages back and forth through a file.
    
In looking for an embeddable scripting language, I am ready to use Ren-C when it works and find other solutions otherwise.

posted by:   VIDpuzzle     6-Mar-2019/19:53:05-8:00



In Rebol 2, you should just be able to `DO %HTTPD.R` (or wherever you have it stored, you can then open a server:
    
     port-no: 3000
    
     ; make sure this support file is in the same folder
     ; https://github.com/rgchris/Scripts-For-Rebol-2/blob/master/httpd.r
     do %httpd.r
    
     the-display: center-face layout [
         text blue underline rejoin ["Serving on Port No. " port-no] [
             browse rejoin [http://localhost: port-no %/foo/bar]
         ]
         text-list 400x400
     ]
    
     the-server: open/custom join httpd://: port-no [
         append the-display/pane/2/data request/action
         show the-display/pane/2
    
         response/status: 200
         response/content: "Look at the GUI..."
     ]
    
     ; DO-EVENTS is implicit in VIEW so will wait on both GUI and PORT events
     view the-display

posted by:   Chris     6-Mar-2019/23:49:06-8:00



You can use zeromq to communicate between ren-c and R2

posted by:   Graham     7-Mar-2019/0:59:30-8:00



Graham,
    
The Red R2 R3 bindings are no longer available, at least at
    
http://zeromq.org/bindings:_start
    
Thanks for the idea.

posted by:   VIDpuzzle     7-Mar-2019/5:05:25-8:00



ZeroMQ in Ren-C is a work in progress that is tested only occasionally, but it is there, if you wanted to read through it:
    
https://github.com/metaeducation/ren-c/blob/master/src/extensions/zeromq/mod-zeromq.c
    
Andreas's original R3 extension is here:
    
https://github.com/earl/r3-zmq

posted by:   Fork     8-Mar-2019/9:15:44-8:00



Let me try to clarify the game plan.
    
Is the suggestion to use 0MQ to connect to a R2 socket?
    
in https://github.com/earl/r3-zmq/blob/master/zmqext.c
I find the C function cmd_zmq_socket
    
in the REBOL 3 extension
https://github.com/earl/r3-zmq/blob/master/zmqext.r3
    
zmq-socket
    
export zmq-socket: command [
     "Create 0MQ socket"
     ctx [handle!]
     type [integer!]
]
    
probe ctx-zmq-socket
has no value
    
What is the correct syntax to access those functions?
    
According to
https://github.com/metaeducation/ren-c/blob/master/.travis.yml
    
Feb 2019 build - 0MQ should be present on OSX, Linux 64 but not on Windows?
    
As a side note, according to
https://github.com/metaeducation/ren-c/blob/master/scripts/r2warn.reb
    
NULL? () should be true, but not on my build
    
Thanks for any tip.


posted by:   VIDpuzzle     8-Mar-2019/18:12:59-8:00



I found the Ren-C examples:
    
https://github.com/metaeducation/ren-c/tree/master/src/extensions/zeromq/examples
    
I'll try those.

posted by:   VIDpuzzle     8-Mar-2019/18:21:15-8:00



> NULL? () should be true, but not on my build
    
Alas, not every comment is up to date. :-/ Files like %r2warn.reb are "vision statements" on how compatibility may be discussed, but don't really have active users or projects backing them...yet.
    
It's also hard because forum posts which discuss controversial design points get out of date as well. (That's one of the reasons I prefer discussion on the Discourse forum, so it *can* be updated!)
    
For the reasoning on the decision of why `do [1 + 2 ()]` is 3 and not null, see:
    
https://forum.rebol.info/t/what-to-do-about-do-and/772
    
Then...rather than make a lone () synthesize a falsey value out of thin air--or error in the moment--it passes the buck and generates VOID!.
    
More remarks on void's purpose here:
    
https://forum.rebol.info/t/why-void-is-not-like-unset-and-why-its-more-ornery/947

posted by:   Fork     11-Mar-2019/11:25:37-7:00



I'd like to use elements of redbol.reb at least until I figure why things are.
    
I've been trying to launch Ren-C with a startup script to add the TYPE? function from redbol.reb
    
How can I exit a script into the console like HALT in R2?
    
Ren-C zero-mq extension runs at circa 6000 messages per second using REQ-REP sockets on the same machine between Ren-C instances.
    
I ran into what seems to be modifications since R3:
    
return: [ word!]
    
opt match word! e
    
results in "can't return void!"
    
The answer may lay herein https://forum.rebol.info - if it only were SEO-ed!
    


posted by:   VIDpuzzle     13-Mar-2019/17:23:32-7:00



Good to hear you managed to get the ZeroMQ working. (If you have any familiarity with how R3-Alpha and extensions worked, hopefully you can see that the API approach being applied here has way more viability.)
    
Note that little priority has been given to performance of the API at this point. Yet even though the baseline is a string-and-splices API, there are ideas in the vein of "stored procedures" that could speed it up. You could still express yourself that way--but do a bit to make it so you only do the scanning and binding once and reuse it over many calls.
    
> opt match word! e
    
If you wish support on any of these issues, please use the Discourse forum or GitHub issues!!
    
But...MATCH returns a NULL, not a BLANK!. The OPT is superfluous, and the void conversion is signaling that. See the last section heading in this post (the section titled "Even Deeper: Shuffling the logic of OPT and TRY")
    
https://forum.rebol.info/t/why-void-is-not-like-unset-and-why-its-more-ornery/947?u=hostilefork
    
> How can I exit a script into the console like HALT in R2?
    
Same.
    
     >> loop 100 [print "Hi" halt]
     Hi
     [interrupted by Ctrl-C or HALT instruction]
    
If you've found a circumstance in which you expect it to work and it is not, then please report on GitHub issues.
    
@draegtun wrote the load-time hooks for the console extension, but I don't make very much use of them. They might require attention and maintenance from interested parties. Documentation:
    
https://github.com/r3n/reboldocs/wiki/User-and-Console
    
Nearly all of it is in usermode:
    
https://github.com/metaeducation/ren-c/blob/master/src/extensions/console/ext-console-init.reb

posted by:   Fork     14-Mar-2019/13:35:35-7:00



See https://gitlab.com/Zhaoshirong/zmq for r2 0mq

posted by:   Graham     14-Mar-2019/13:47:24-7:00



And here's a video of using a r2/Vid app communing with 8th via 0mq - but you could use ren-c
    
https://youtu.be/5ZXL6qLEYbU

posted by:   Graham     14-Mar-2019/13:49:41-7:00



Graham, thanks for the sample code and video.
    
I am trying to connect R2 to R3 without the R2 0MQ bindings hoping it will enhance the solution portability.

posted by:   VIDpuzzle     21-Mar-2019/13:15:39-7:00