r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3 Schemes] Implementors guide

Andreas
29-Jan-2010
[1960]
I assume that somewhere there is a mapping between indices into this 
array to names like 'tcp
Steeve
29-Jan-2010
[1961]
maybe including a row device allowing to build our own datagrams 
would be the best :-)
Andreas
29-Jan-2010
[1962x2]
in reb-device.h we have an enum for those indices
RDI_NET is the index for the tcp port device
BrianH
29-Jan-2010
[1964]
Not assuming that yet. All you have to do is say that you are taking 
charge of R3 SSL and you will get all the help you need. I would 
suggest using the Putty SSL code as a start because it's small and 
license compatible (i.e. not a GPL derivative).
Graham
29-Jan-2010
[1965]
Hmm... Andreas already volunteered to do the Arm port ...and had 
no reply.
Andreas
29-Jan-2010
[1966x4]
And I posted the ready-to-be-merged changes for dll loading on Linux, 
no reply there
I'd be happy to give SSL a go, to get something to experiment with
The main information I miss for now, is how to wire up a device defined 
in the hostkit
And from all I can see, that is for now somewhere hidden in libr3.so
Cyphre
1-Feb-2010
[1970]
Andreas, yes, looks like the symbol table for devices is inside the 
.so for now.  But if you are really impatient, I think it would be 
possible to override for example 'clipboard device  and 'turn' it 
into sll port?
ChristianE
17-Feb-2010
[1971]
I'm lost in current somewhat fragmented documentation on asynchronous 
networking. Does anyone happen to know of an example somewhere on 
how to do a http request and meanwhile displaying a progress bar 
or just print some progress info to the console? I know I have to 
use a AWAKE handler, but I just don't grasp what to do therein.


Let's say I want to PRIN "." to the console (or draw something to 
the GUI) every 0.25 secs the http request is taking . Are there any 
docs out there on how to accomplish something like that?
Graham
17-Feb-2010
[1972x4]
You would have to modify the existing awake handler to print.

I don't think you can display a progress bar as the only way to update 
the GUI is by creating a GUI event, and that is not documented yet.
So, in this example of sending a fax http://rebol.wik.is/Rebol3/R3_GUI/Sendfax.r


the net-log function is altered to update the GUI ... but in fact 
nothing happens until all the network actiivty ceases.
In R2 you'd do a wait to allow the GUI to update ... but you can't 
do a wait inside a wait
The http protocol lacks any net-log or debugging so could write one 
and insert it into the awake handler ...
ChristianE
17-Feb-2010
[1976]
Thanks, Graham, your answer is appreciated. I was thinking along 
the lines of repeatedly waiting on an open http port for only a short 
while and on every loop iteration updating a busy indicator just 
to show that something is going on. Sounds like that's not possible, 
so I think I'll leave it as it is for now.
Gabriele
18-Feb-2010
[1977]
request-download shows a progress bar.
Graham
18-Feb-2010
[1978]
>> value? 'request-download
== false
ChristianE
18-Feb-2010
[1979]
Gabriele, it seems as if that REQUEST-DOWNLOAD has yet to find it's 
way into R3. Though on the other hand, it's seems very likely to 
me that you know about R3 resources I'm not aware of.
Henrik
18-Feb-2010
[1980x2]
if you can do a read and get the number of bytes read into a callback 
then you have the possibility of creating your own progress bar.
R2's read-thru does this.
ChristianE
18-Feb-2010
[1982]
Ok, Henrik, are you saying that theoretically it should be possible 
to adapt REQUEST-DOWNLOAD or alike to R3 with current R3/HTTP-scheme? 
If so, I'll have a go and study the source, it's just that I am not 
able to tell wether I just dont get it or if something is missing 
for now. Is it expected to be possible yet?
Henrik
18-Feb-2010
[1983]
I don't know if it's possible with the current R3/HTTP scheme.
ChristianE
18-Feb-2010
[1984]
Thanks, Henrik, anyway. I'll take Gabriele's answer for a "yes, it's 
possible" because he has written the scheme, so he would know for 
sure ;-) I'll study his protocol and the underlying TCP stuff deeper 
after the weekend.
Gabriele
19-Feb-2010
[1985x5]
ah, sorry guys, didn't notice this was a R3 group. hmm, it shoud 
in principle be even easier for R3, but i guess there are no examples 
to show...
starting from here: http://www.rebol.net/wiki/Scheme:_HTTP
what you want is the bottom of the page, "Lowest level: asynchronous 
operation"
you need basically to respond to 'connect and do a read, use 'read 
events to report progress, and use 'done to know when all the data 
is ready.
(this assumes that there have been no major changes to http since 
last time i touched it.)
Graham
19-Feb-2010
[1990]
As I mentioned before ... you can't still update the gui without 
the information on how to create a gui event
Henrik
19-Feb-2010
[1991]
Graham, do you mean use 'do-style to run an actor?
Graham
19-Feb-2010
[1992]
No, I mean how do you update the gui while in the middle of a network 
operation ?  The only way to force the gui to change is to generate 
a GUi event, like a mouse click etc but a fake event
Henrik
19-Feb-2010
[1993x2]
I'd say the useful solution in R2 at least is to use a call-back 
like read-thru does, so you solve the issue in the networking code, 
not in the GUI cide.
code.
Gabriele
19-Feb-2010
[1995]
graham, in my vid, you would just use set-face on the progress bar. 
i don't know about Carl's version. it would be very surprising if 
it required creating an event.
Henrik
19-Feb-2010
[1996]
it's not much different in Carl's version.
Graham
19-Feb-2010
[1997x2]
set-face doesn't update until the network activity has ceased
Maybe I did something wrong ... perhaps someone else can try it
Henrik
19-Feb-2010
[1999]
how are you doing it? the set-face has to be called from somewhere 
within the networking code. alternatively something is synced which 
shouldn't be synced.
Graham
19-Feb-2010
[2000]
http://rebol.wik.is/Rebol3/R3_GUI/Sendfax.r

I update the GUI in the awake handler
Henrik
19-Feb-2010
[2001]
inside prot-fax-r?
Graham
19-Feb-2010
[2002]
Yes ... as I redefine net-log in the gui to do the updating, and 
net-log is used inside pro-fax.r
Henrik
19-Feb-2010
[2003x2]
ok, I see it
what good does the last line do?
Graham
19-Feb-2010
[2005]
what last line?
Henrik
19-Feb-2010
[2006]
set-face/field a1 tail get-face a1 'locate 
txt
Graham
19-Feb-2010
[2007x3]
sets the text cursor ?
been a while since I wrote that code .. hard to remember now!
I wonder if it's there to force the text to scroll to that point 
...