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

World: r3wp

[Core] Discuss core issues

Ammon
14-Mar-2005
[741]
'compose evaluates any parens in the block passed to it.  If you 
are passing 'compose a block containing blocks that contain values 
you would like composed then you need to use the /deep refinement 
of compose
BrianW
14-Mar-2005
[742]
ow.
Ammon
14-Mar-2005
[743]
; (i.e. 
test-case-test: make test-case compose/deep [
    ...
    test-result-formating: func [/local ed][
        ed: make (test-result)
        ...
    ]
]
BrianW
14-Mar-2005
[744x2]
I think I'll avoid 'compose for now, and leave it for when I'm done 
with the basic stuff in the test book.
but that's good to know, thanks again.
Ammon
14-Mar-2005
[746]
Np, you're welcome!
Gregg
14-Mar-2005
[747]
obj-spec: func [
    "Returns the object spec as a single line (flat) string."
    obj [object!]
    /only "no surrounding brackets"
    /mold "Multi-line MOLDed format"
    /local res
][
    res: copy find/tail system/words/mold obj "make object! "
    if not mold [trim/lines res]
    if only [res: trim/auto next head remove back tail next res]
    res
]

remove-words: func [

    "Returns a copy of the object with the specified words removed."
    object [object!]
    words  [word! block!] "The word, or words, to remove"
    /local spec
][
    spec: load obj-spec object
    foreach word compose [(words)] [
        remove/part find spec to set-word! word 2
    ]
    make object! spec
]
Micha
15-Mar-2005
[748]
how to count difference time
 x:  now/precise
== 15-Mar-2005/11:01:58.139+1:00
 y: now/precise
== 15-Mar-2005/11:02:38.733+1:00

x - y  =
Graham
15-Mar-2005
[749]
help difference
Micha
15-Mar-2005
[750]
subtract
Graham
15-Mar-2005
[751]
difference now/precise now/precise
Micha
15-Mar-2005
[752x3]
block: [ "a:" "string1" "b:" "string2"    ]

Fremowe: func [x y][return remove remove find x  y ]

Fremowe block "a:"
not remove a ?
what this function does not act ?
Pekr
15-Mar-2005
[755x2]
1) You don't have to use return word ...., function does return the 
last point of its evaluation
and besides that, it works here ...
DideC
16-Mar-2005
[757]
He guys, I need you !!!
Volker
16-Mar-2005
[758]
ping?
DideC
16-Mar-2005
[759]
I want to get in a Rebol script what I print on a standard windows 
printer.

I use Redmon (part of ghostview) to redirect what the printer get 
to my rebol script
RedMon : http://www.cs.wisc.edu/~ghost/redmon/index.htm
I'm under Windows.

How can I get data from the standard input ?

I have tried "copy system/standard/input" and also "input", but get 
nothing !!
plis help ;-)
Volker
16-Mar-2005
[760x4]
have you tried -w? that uses dos-window as console AFAIK.
or use a temporary file?
Ah, this looks like a cgi-stype call. i would try --cgi then. it 
should do this "call and get data from stdin".
cgi-stype -> cgi-style
Micha
16-Mar-2005
[764x2]
;serwer proxy


p: make port! tcp://:80

p/awake: func [ port /local  data conn targed cmd partner url 
] [



conn: first port
wait conn
data: to-string copy conn

replace/all data "^M" ""
source data

targed: copy/part data find data "HTTP/1.1"
data: find/tail data "^/"
print targed

cmd: parse targed none

url:  decode-url cmd/2 

if not url/path  [url/path: "" ]

if not url/target  [url/target: ""]

partner: open/no-wait to-url rejoin [ "tcp://" url/host ":80" ]




insert partner rejoin [ cmd/1" /" url/path url/target " HTTP/1.1^/" 
 data]

wait partner

tmp: copy partner




close partner



insert conn tmp



close conn 

]


append system/ports/wait-list p


open/binary/no-wait p
 wait []


halt
what this server not act ?
Anton
16-Mar-2005
[766x2]
what this server not act ?
  -->  "why does this server not work ?"
print [rebol/product rebol/version]
Micha
16-Mar-2005
[768x2]
View 1.2.55.3.1
partner sends to conn only first packet
Anton
16-Mar-2005
[770x4]
insert partner rejoin [ cmd/1" /" url/path url/target " HTTP/1.1^/" 
 data]
?? data
wait partner
data looks ok ?
partner: open/direct/no-wait ....
OR...
partner: open/no-wait ...
insert partner ...
update partner  ; <-------
wait partner
Volker
16-Mar-2005
[774x3]
conn: first port
wait conn ; such things in /awake may be a problem.
i would not use /awake in your case. more like
  forever[ wait port  your-code-here ]
also you have both server and client in the same process? this 'partner? 
i write such things using two consoles, one for client, one for server.
Gabriele
16-Mar-2005
[777]
DideC: try to start REBOL with -cw
DideC
16-Mar-2005
[778x3]
I have tried -c -w -cw, but I'm unable to pick anything from the 
standard input.

But I don't know how to handle that in the script :-\ (ports are 
not my tea cup).
My script :
   Rebol []
   probe copy system/ports/input
(Script is in %inp.r)
I have tried this command line (I'm on Win2k, Core 2.5.6) :

C:\> echo this is a test | rebol.exe inp.r
C:\> rebol.exe inp.r < test.txt
C:\> type test.txt | rebol.exe inp.r
Volker
16-Mar-2005
[781]
i understand from the webpage that redmon launches the program and 
send it input, just as a webserver does with cgi. then try it from 
the real program, not from the console. i don't know about xp, but 
in win9x console-pipes are pretty broken.
Gabriele
16-Mar-2005
[782x5]
REBOL []

write %test.txt copy system/ports/input
echo this is a test | rebol.exe -cw test.r
(hit ctrl-c to terminate it)
you get "this is a test" in test.txt
if you PROBE it, to see it on the command window you need a | more 
or something like that.
DideC
16-Mar-2005
[787]
Thanks,  it works :-))
sqlab
17-Mar-2005
[788]
Micha:
regarding your Async Server

You can modify your awake function like this

p/awake: func [ port /local  data  ] [
 	data: copy port
	either data [
		append tmp data
	] [
		close p 
		remove find system/ports/wait-list p
	]
]
BrianH
17-Mar-2005
[789]
I used to know this, but for which datatypes is a hash! indexed? 
Just strings, or words too?
Ladislav
18-Mar-2005
[790]
words, strings, integers, AFAIK