• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp134
r3wp1094
total:1228

results window for this page: [start: 401 end: 500]

world-name: r3wp

Group: RAMBO ... The REBOL bug and enhancement database [web-public]
[unknown: 5]:
25-Nov-2006
mine doesn't skip over the empty value it gives an error on it - 
which is actually useful if you ask me - I don't see any purpose 
to have an empty case passed to the switch - this way we know if 
we coded something incorrectly.
[unknown: 5]:
25-Nov-2006
not error rather the skip
Group: Core ... Discuss core issues [web-public]
Pekr:
15-Oct-2005
form-decimal: function [num][tmp main rest sign base][

     either found? find tmp: to-string num "E" [

              parse tmp [
                 copy main to "."
                 skip
                 copy rest to "E"
                 skip
                 mark: (sign: copy/part mark 1)
                 skip
                 copy base to end
               ]


        either sign = "-" [

                tmp: "0."

                loop ((to-integer base) - 1) [insert tail tmp "0"]
                insert tail tmp rest
        ][
                tmp: copy ""

                insert tail tmp join main rest

                loop ((to-integer base) - (length? rest)) [insert tail tmp "0"]  
                    
                           
        ] 
     
      tmp                 

     ][num] 

]
Pekr:
15-Oct-2005
form-decimal: func [num /local tmp main rest sign base][

     either found? find tmp: to-string num "E" [

              parse tmp [
                 [copy main to "." 
                  skip
                  copy rest to "E"
                  |
                  copy rest to "E"
                  (main: copy "")  
                  ]
             
                 skip
                 mark: (sign: copy/part mark 1)
                 skip
                 copy base to end
               ]


        either sign = "-" [

                tmp: copy "0."

                loop ((to-integer base) - 1) [insert tail tmp "0"]
                insert tail tmp rest
        ][
                tmp: copy ""

                insert tail tmp join main rest

                loop ((to-integer base) - (length? rest)) [insert tail tmp "0"]  
                    
                           
        ] 
     
      tmp                 

     ][num] 

]
Geomol:
15-Oct-2005
I think, this version do the job:

form-decimal: func [n /local p d] [
	if p: find n #"E" [
		if d: remove find n #"." [d: index? d p: back p]
		if not d [if d: remove find n #"," [d: index? d p: back p]]
		if not d [d: 2]
		either p/2 = #"-" [
			insert/dup n #"0" (to-integer skip p 2) - 1
			insert n "0."
		][
			insert/dup p #"0" (to-integer next p) - (index? p) + d
		]
		clear find n #"E"
	]
	n
]
Geomol:
15-Oct-2005
form-decimal: func [n /local p d] [
	if p: find n #"E" [
		if d: remove find n #"." [d: index? d p: back p]
		if not d [if d: remove find n #"," [d: index? d p: back p]]
		if not d [d: index? p]
		either p/2 = #"-" [
			insert/dup n #"0" (to-integer skip p 2) - d + 1
			insert n "0."
		][
			insert/dup p #"0" (to-integer next p) - (index? p) + d
		]
		clear find n #"E"
	]
	n
]
Graham:
4-Nov-2005
that seems easier than copy/part skip string 4 2
JaimeVargas:
4-Nov-2005
substring: func [
    [catch]
    source [string!]
    spec [block!]
    /local start stop rule
][
    rule: [set start integer! '.. set stop integer!]
    unless parse spec rule [
        throw make error! "Invalid range spec."
    ]
    copy/part skip source start stop
]
BrianH:
4-Nov-2005
; 1-based indexing
slice: func [str start len] [copy/part at str start len]
; 0-based indexing
slice: func [str start len] [copy/part skip str start len]
Sunanda:
5-Nov-2005
does sort/skip directly do what you want?
Gordon:
5-Nov-2005
Something about reordering the records makes sort/skip not suitable.
BrianH:
5-Nov-2005
(Back to slicing briefly) REBOL already has functionality equivalent 
to slicing as copy-of-subsection, so this would be better represented 
as a very simple mezzanine function that does the work. If you mean 
slicing as reference-to-subsection-in-place, that would be worth 
adding new support for. Something like:

slice!: make object! [start: end: none]

slice: func [[catch] s [series!] /from b [integer!] /to e [integer!] 
/len l [integer!]] [
    b: either from [at :s b] [:s]
    e: case [
        to at :s e
        len skip :b l
        true tail :s
    ]
    if greater? index? :b index? :e [to: :e e: :b b: :to]
    make slice! [start: b end: e]
]
Sunanda:
5-Nov-2005
sort/skip --- I get you -- like it's not easy to sort on the 2-digit 
numbers here:
sort/skip [99 10 2       98 11 5        97 12 4] 3
But it is possible with /all and a parameter into the function
Sunanda:
5-Nov-2005
I mean the middle of the three fields, sorting a 3-field record:
  sort-func: func [a b] [return a/2 < b/2]

  sort/skip/all/compare [99 10 2       98 11 5        97 12 4] 3 :sort-func
== [99 10 2 98 11 5 97 12 4]
BrianH:
5-Nov-2005
sort/skip/compare data 3 2
MichaelB:
15-Dec-2005
this is from the blog-chat: 

I liked Ladislavs function and just extended it a little bit: maybe 
bind would be nice like that - one can bind only the words one wants 
to and also only the types one likes, unless using plain, then all 
words of the same spelling get bound

old-bind: :bind

bind: func append copy third :bind [
	/only only-words [block! any-word!]
    /plain
    /local pos rule item
][
	if copy [words: copy words]
		
	either only [
		if any-word? only-words [only-words: reduce [only-words]]
    	if any-word? known-word [known-word: bind? known-word]

     if plain [forall only-words [change only-words to word! only-words/1]]

		parse words rule: [
			any [
				pos:
				set item any-word! (
					if any [
                	    all [plain find only-words to word! item]
                	    find only-words item
                	][
						item: old-bind :item known-word
						change pos :item
					]
				) | into rule | skip
			]
		]	
	][
		old-bind words known-word
	]	
]

f: g: h: i: 1
bl: ['f g h i]
c: context [f: 2 g: 3 h: 'hello]

bind/only bl c [f 'h]
get-values: [
	get to-word first bl
	get to-word second bl
	get to-word third bl
	get to-word fourth bl
]
probe reduce get-values

bind/only/plain bl c [f 'h]
probe reduce get-values

bind bl 'system
probe reduce get-values

bind/only bl c 'g
probe reduce get-values
MichaelB:
15-Dec-2005
I hope a more correct version of only 'bind-only - just to have not 
something too wrong lurcking around

bind-only: func [

    {Binds only selected words to a context. If taken 'lit'erally even 
    just words of the same kind.} 
    words [block!]
    known-word [any-word! object! port!]
    only-words [block! any-word!]
    /lit
    /local pos rule item
][
    if any-word? only-words [only-words: reduce [only-words]]
    if any-word? known-word [known-word: bind? known-word]
    unless lit [
        only-words: copy only-words 

        forall only-words [change only-words to word! only-words/1]
    ]
	
      parse words rule: [
		any [
			pos:
			set item any-word! (
				if any [
                    				find only-words to word! :item
                    				all [lit find only-words :item]
                			][
					item: bind :item known-word
					change pos :item
				]
			) | into rule | skip
		]
	]
    words
]
JaimeVargas:
29-Dec-2005
Rebol []

comment [
	; example usage:
	kernel: load/library %kernel32.dll

 routine-call kernel "MulDiv" [int] [3 [integer!] 2 [integer!] 1 [integer!]] 
 ; == 6
]

routine-call: func [
	library [library!]
	routine-name [string!]
	return-spec [block!]
	arguments [block!] 

 /typed {Arguments is block structure is: [argument-value [datatype] 
 ...]}
	/local routine spec call argument type typed-rule
] [
	spec: make block! length? arguments
	call: make block! (length? arguments) / 2 + 1
	insert call [return routine]
	typed-rule: copy []
	if typed [typed-rule: [set type skip]]
	parse reduce arguments [
		any [
			set argument skip
			typed-rule
			(
				insert/only tail spec 'argument
				insert/only tail spec either typed [
					type
				][
					reduce [type?/word get/any 'argument]
				]
				insert/only tail call get/any 'argument
			)
		]
	]
	insert tail spec [return:]
	insert/only tail spec return-spec
	routine: make routine! spec library routine-name
	do call
]

use [libc zero-char as-rebol-string malloc][
	libc: load/library %/usr/lib/libc.dylib ; osx variable

	zero-char: #"^@"

	as-rebol-string: func [
		[catch]
		s [string!] 
		/local pos
	][

  unless pos: find s zero-char [throw make error! "s is not a c-string"]
		s: head remove/part pos tail s
		replace/all s "\n" newline
		replace/all s "\t" tab
	]
	
	malloc: func [
        size [integer!] "size in bytes"
    ][
        head insert/dup copy {} zero-char size
    ]

	sprintf: func [
		spec {block structure is: [format values ...]}
		/local s
	][
		s: malloc 4096
		insert/only head spec 's
		routine-call libc "sprintf" [int] spec
		as-rebol-string s
	]
	
	printf: func [
		spec {block structure is: [format values ...]}
	][
		print sprintf spec
	]
]
Volker:
6-Jan-2006
The object-part is quite smalltalk afaik. Only they skip the bytecode-interpreter 
and "inline" the calls to c.
Volker:
23-Jan-2006
!>>obj: context[bb: 1 cc: 4 dd: 7]
!>>probe context intersect/skip third obj [bb: - cc: -] 2   
make object! [
    bb: 1
    cc: 4
]
Gregg:
23-Jan-2006
Just dummy values to match the skip 2 format.
Louis:
7-Mar-2006
Thanks Claude! I just found some old code. This also works:


sort/skip/compare/all codes-block 2 func [a b] [return either a/2 
< b/2 [-1][either a/2 = b/2 [0][
+1]]]
Ashley:
7-Mar-2006
sort/skip/compare codes-block 2 2
Geomol:
21-Mar-2006
Robert, here is my solution used in Canvas:

form-decimal: func [n /local p d] [
	n: form n
	if p: find n #"E" [
		if d: remove find n #"." [d: index? d p: back p]
		if not d [if d: remove find n #"," [d: index? d p: back p]]
		if not d [d: index? p]
		either p/2 = #"-" [
			insert/dup n #"0" (to-integer skip p 2) - d + 1
			insert n "0."
		][
			insert/dup p #"0" (to-integer next p) - (index? p) + d
		]
		clear find n #"E"
	]
	n
]
sqlab:
22-Mar-2006
rebol []
form-decimal: func [n /local p d s] [
	all [s: negative? n n: abs n]
	n: form n
	if p: find n #"E" [
		d: index? any  [
			all [ d: remove find n #"." 	p: back p	d]
			all [ d: remove find n #"," 	p: back p	d]
			p
		]
		either p/2 = #"-" [
			insert/dup n #"0" (to-integer skip p 2) - d + 1
			insert n "0."
		][
			insert/dup p #"0" (to-integer next p) - (index? p) + d
		]
		clear find n #"E"
	]
	if s [insert n "-"]
	n
]
Graham:
27-Mar-2006
actually it was Jaime

substring: func [
    [catch]
    source [string!]
    spec [block!]
    /local start stop rule
][
    rule: [set start integer! '.. set stop integer!]
    unless parse spec rule [
        throw make error! "Invalid range spec."
    ]
    copy/part skip source start stop
]
Jarod:
27-Mar-2006
so skip is skipping into the string, then it is copying part of that 
string starting from that position to the end?
Gregg:
12-Apr-2006
; used in SHIFT below
    dup: func [value len [integer!] /local type] [

        type: either series? value [value] [either char? value [""] [[]]]
		head insert/only/dup make type len value len
    ]

    ; used in SHIFT below
    make-blank-value: func [type] [
        any [
            attempt [make type 0]
            attempt [make type ""]
            attempt [make type []]
            attempt [make type none]
        ]
    ]


    ; The new PAD/JUSTIFY func might be used to implement this as well.
    shift: func [
        "Shift values in a series; length doesn't change."
        series [series!]
        /left   "Shift left (the default)"
        /right  "Shift right"

        /part range [number!] "Shift this many positions"  ; TBD series! 
        support?
        /with fill "Fill vacated slots with this value"
        /local pad
    ][
        range: any [range 1]
        if any [empty? series  0 = range] [return series]
        pad: dup any [fill  make-blank-value last series] range
        either right [

            head insert head clear skip tail series negate range pad
        ][
            append remove/part series range pad
        ]
    ]

    rotate: func [
        "Rotate values in a series."
        series [series!]
        /left   "Rotate left (the default)"
        /right  "Rotate right"

        /part range [number!] "Rotate this many positions"  ; TBD series! 
        support?
        /local offset pad
    ][
        range: any [all [range  range // length? series] 1]
        if any [empty? series  zero? range] [return series]
        either right [
            offset: does [skip tail series negate range]
            pad: copy offset
            head insert head clear offset pad
        ][
            pad: copy/part series range
            append remove/part series range pad
        ]
    ]
Henrik:
26-Apr-2006
wouldn't it make sense for SKIP to support hex values? I'm trying 
to locate a specific position in a binary and it's tedious having 
to convert to number! every time.
Maxim:
26-Apr-2006
skip can be redefined to something which supports hex numbers...
Volker:
26-Apr-2006
why not write a converter and then
  skip bin &h #c4d9
Graham:
14-May-2006
to-comma: func [ n [number!]
	/local tx result
][
	tx: reverse form n
	result: copy ""
	while [ not tail? tx ][
		repend result [ part: copy/part tx 3]
		tx: skip tx 3
		if all [ not tail? tx 3 = length? part ][
			append result ","
		]
	]
	reverse result
]
Graham:
14-May-2006
to-comma: func [ n [number!]
	/local tx result parts left right
][
	one-comma: func [ tx /local result ][
		result: copy ""
		while [ not tail? tx ][
			repend result [ part: copy/part tx 3]
			tx: skip tx 3
			if all [ not tail? tx 3 = length? part ][
				append result ","
			]
		]
		result
	]
	parts: parse tx: form n "."
	left: reverse one-comma reverse parts/1	
	either found? parts/2 [
		right: one-comma parts/2
		rejoin [ left "." right ]
	][
		left
	]
]

handles decimal points as well.
Rebolek:
16-May-2006
I've got a question. open/skip does not work?
Volker:
16-May-2006
That was added later. /skip works thru some networking IIRC.
Volker:
16-May-2006
Try seek, and then use 'skip etc. IIRC that works. (needs the newer 
rebols)
Anton:
16-May-2006
port: open/direct/skip url size ; resume position <- this can fail 
when file is complete already
Rebolek:
19-May-2006
I though I've got it working but it was a mistake. I'm still not 
able to use /skip refinement on files succesfully. Does anybody now, 
if it's possible to OPEN or READ file from some offset? I saw some 
bug filled in RAMBO two years ago :(((
Volker:
19-May-2006
p: open file
p: skip p 123
data: copy p
IIRC
Rebolek:
19-May-2006
so /skip refinement is good for what?
Volker:
19-May-2006
/skip : Backward compatibility. It helps with resume through http 
AFAIK.
Rebolek:
19-May-2006
So how can I succesfully write read/binary/part/skip ?
Volker:
19-May-2006
I doubt  i find a good idea, so if i am boring just say stop.

Would it work to flatten the datastructure? /skip instead of nested 
blocks? Tehn 'reduce would work.
Volker:
25-May-2006
rest: [1 + 2 button 3 + 4] 
out: copy [] 
while [not tail? rest] [
    either find [button] first rest [
        append out first rest 
        rest: next rest
    ] [
        set [res rest] do/next rest 
        append/only out res
    ]
] 
?? out 
comment "or parse" 
rest: head rest 
out: copy [] 
parse rest [
    any [
        set word ['button] (append out :word) 
        | rest: skip (
            set [res rest] do/next rest 
            append/only out :res
        ) :rest
    ]
]
Robert:
16-Jun-2006
This is IMO inconsistent and should be changed:

>> ? for
USAGE:
    FOR 'word start end bump body

DESCRIPTION:
     Repeats a block over a range of values.
     FOR is a function value.

ARGUMENTS:
     word -- Variable to hold current value (Type: word)

     start -- Starting value (Type: number series money time date char)

     end -- Ending value (Type: number series money time date char)

     bump -- Amount to skip each time (Type: number money time char)
     body -- Block to evaluate (Type: block)

(SPECIAL ATTRIBUTES)
     catch
     throw
>> a: 2.0
== 2.0
>> for test 1 a 1 [print test]
** Script Error: for expected end argument of type: integer
** Near: for test 1 a 1
>> number? a
== true


It should be possible to use decimal! as well. The interpreter should 
implicitly convert it to an integer!
Gabriele:
27-Jun-2006
load-relaxed: func [string /local res sp parseblk] [
    sp: charset " ^/^-"
    parseblk: func [blk string /local val] [
        parse string [
            some [

                #"[" string: (string: parseblk val: make block! 16 string append/only 
                blk val) :string
                |

                #"(" string: (string: parseblk val: make paren! 16 string append/only 
                blk val) :string
                |

                #"]" string: (either block? blk [return string] [append blk "]"])
                |

                #")" string: (either paren? blk [return string] [append blk ")"])
                |

                string: skip (either error? try [set [val string] load/next string] 
                [

                    append blk copy/part string string: any [find string sp tail string]
                ] [
                    append blk :val
                ]) :string
            ]
        ]
        string
    ]
    parseblk res: make block! 16 string
    res
]
Pekr:
22-Aug-2006
yes, but what b: evaluates to? it is block ... I though that the 
syntax is - for word value-from value-to skip []
JaimeVargas:
22-Aug-2006
;; This example illustrates a bit better the behaviour of FOR with 
series

>> series: [a b c d e f g h i j k]  

== [a b c d e f g h i j k]

>> start: skip series 0

== [a b c d e f g h i j k]

>> stop: skip series 6

== [g h i j k]

>> for b start stop 1 [print mold b]

[a b c d e f g h i j k]

[b c d e f g h i j k]

[c d e f g h i j k]

[d e f g h i j k]

[e f g h i j k]

[f g h i j k]

[g h i j k]
>> for b start stop 2 [print mold b]

[a b c d e f g h i j k]

[c d e f g h i j k
]
[e f g h i j k]

[g h i j k]
>> for b start stop 6 [print mold b]

[a b c d e f g h i j k]

[g h i j k]

>> for b start stop 7 [print mold b]

[a b c d e f g h i j k]
Group: I'm new ... Ask any question, and a helpful person will try to answer. [web-public]
sqlab:
16-Apr-2009
This got very long, but i think it should work


ifrule: [ ifa: "interface"  some [ ife: "point-to-point"  break | 
ife: newline    break | skip  ]  (append/only  append wanted copy/part 
ifa ife   interf:  copy [] ) ]

drule: [ "description" copy descr to newline (append interf descr) 
]
iprule: ["ip address" copy ip to newline (append interf ip)  ]
norule: ["no" to newline]
pvcrule: ["pvc" to newline]
pprule: ["pppoe" to  newline]
!rule: ["!" to  newline]

rule: [(wanted: copy [] ) some [ifrule | some  [

 s: " interface"  | #" "   |  drule | iprule | norule | pvcrule | 
 pprule | !rule |   break ] thru newline  ]   
] 
parse/all lines rule
mhinson:
17-Apr-2009
I have been studying the code from sqlab but I cant understand it 
enough to modify it. This is a deconstruction of part of it with 
my comments added. I would love a hand to understand this a bit more. 
 I cant find any documentation for this sort of thing that I can 
understand. 

I have also been trying to retrieve an index number when reading 
lines so it can be used as suggested by Sunanda. drawn a blank so 
far.



parse/all lines [                ;; parse the whole block called 
lines /all makes parsing only use values given below 

                                            ;; I am not sure if this is itteratied or the whole block parsed 
                                            as one. 
	(wanted: copy [])  ;; initalise wanted 

 | some [                 ;; one or more matches needed to return 
 true

  ifa: "interface"  some [   ;; ifa is given a string value right in 
  the middle of the parsing code

                                            ;; I see why, but not how this is able to slip into the middle here

                                            ;; then some starts another block so perhaps the "interface" is used 
                                            by parse too??

   ife: "point-to-point"  break  ;; no idea how the syntax works here
			| ife: newline    break           ;; or here

   | skip                                      ;; this skips I think 
   till one of the OR conditions are met from below?
		]

  (append/only  append wanted copy/part ifa ife   interf:  copy []) 
    ;;  I dont understand what block append/only is working on here

                                                                                                                                           ;;  append to block wanted using a part copy between ifa & ife but 
                                                                                                                                           I 

                                                                                                                                           ;;  dont understand the source for the copy 

  | some [                                                     ;; I 
  think perhaps all the below rules are end or search paterns?   
			s: " interface" (interf: copy [])
	        | drule
	        | iprule
	        | norule
	        | pvcrul
	        | pprule
	        | !rule
	        | break 
		] thru newline           ;; final catchall end search pattern. 
	]
]


Sorry to ask so many questions, feel free to throw me out if this 
is just too much, but I have spent several hours on this fragment 
allready. Thanks.
Oldes:
17-Apr-2009
parse/all {ab hello cd} [3 skip copy result 5 skip to end]     ;; 
returns "hello"

parse/all {ab hello cd} [thru #" " copy result to #" " to end]  ;; 
returns "hello"
Gregg:
1-May-2009
If you want to be non-greedy, you may need to use alternate rules 
and skip. e.g.

s: {randomXXXrandom.log XXXrandom.txtrandom}
parse/all s [
    any [
        "XXX" mark-1:
        | [mark-2: ".txt"] (
           if all [mark-1 mark-2] [print copy/part mark-1 mark-2]
        )
        | skip
    ]
]
Gregg:
1-May-2009
My example above may not be exactly what you want. e.g. you might 
want to clear mark-1: in the skip rule.
Graham:
1-May-2009
or if .log neve appears in the random text you can just skip past 
it
PeterWood:
2-May-2009
I usually adopt a different approach which is to write a rule to 
match my target and use any and skip to apply that rule progressively 
through the input. It may not be the fastest way but it seems easier 
to grasp than backtracking.

>> haystack: {randomXXXrandom.log XXXrandom.txtrandom} 
>> alpha: charset [#"a" - #"z" #"A" - #"Z"]  

== make bitset! #{
0000000000000000FEFFFF07FEFFFF0700000000000000000000000000000000
}
>>   digit: charset [#"0" - #"9"

]
== make bitset! #{
000000000000FF03000000000000000000000000000000000000000000000000
}

>>   alphanumeric: union alpha digi

t
== make bitset! #{
000000000000FF03FEFFFF07FEFFFF0700000000000000000000000000000000
}
 
                             
>> needle: ["XXX" some alphanumeric 
".txt"]    

>> parse/all haystack [any [copy result needle (print skip result 
3) | skip]]

random.txt

== true


As you can see with this approach, you have to manually extract the 
"XXX" once you've grasped the needle.
Pekr:
3-May-2009
Here's my version:


parse/all {zybc} [ some ["b" break | "y"  break | skip] copy result 
thru "c"  (print result) ]


Simple explanation - we try to match at least one occurance of "b" 
or "y. There is currently no other chance than skip by one char (don't 
worry, it is not slow). Once you reach the char, you have to "break", 
or the rule will be still applied, because "skip" will always occur, 
even if "b" or "y" are not matched.
mhinson:
3-May-2009
Hi, I have been studying the example from Pekr and developed the 
following addaptation.

b: [to "bb" break]
y: [to "yy" break]

parse/all {zyybbc} [ some [b | y  break | skip] copy result thru 
"c"  (print result) ]


however this seems to loop for ever, but I don't understand why. 
Any wise words would be appreciated.  Sorry to be so needy, I am 
begining to wonder that as I am having so much trouble with this 
basic stuff, perhaps this is a programing language that I am just 
not suited to?  Let me know if I am causing a problem by posting 
here so often & I will admit defeat with the parsing & go back to 
something more familiar.s
Maxim:
3-May-2009
if we want to extract what is after that single tag, then you can 
easily use to or even better thru:


but lets do it using skip.  starting with a simple example will make 
the lesson 2 more obvious.
Maxim:
3-May-2009
parse/all data [
	some [ 

  ["<TAG>" here: (print rejoin ["we are passed the <TAG!> : '" here 
  "'"]) ] | skip
	]
]
Maxim:
3-May-2009
note, we are using skip, to get familliar with the basics of rollback...
mhinson:
3-May-2009
but skip will always succeed?
Maxim:
3-May-2009
so can you explain to me why the ["<TAG" ... ] rule is BEFORE the 
skip rule?
mhinson:
3-May-2009
Maxim.  Here is my first attempt at the homework you set me. This 
builds on what you showed me & also relates to the example given 
to me by Pekr.


data: "before first tag <TAG> after 1st pointy tag [TAG] after square 
tag <TAG> after pointy tag 2"

tag-square: "[TAG]"
tag-pointy: "<TAG>"

output: func [tag here] [
	print rejoin ["we are passed the " tag " : '" here "'"]
]

parse/all data [
	some [ 
		[tag-pointy here: (output tag-pointy here) ] 
		| [tag-square here: (output tag-square here) ] 
		| skip
	]
]


I thought it would make the action clearer if the output was in a 
function & the keys used variables.
Ladislav:
3-May-2009
so, my guess is, that you wanted something like
b: "bb"
y: "yy"
parse input [any [b | y |  skip]]

or some such, the above would find all occurrences of the parts you 
specified
Ladislav:
3-May-2009
if you want to find just the first occurrence, then you may use e.g.:

occurrence: [b | y]
parse input [any [occurrence break | skip]...]
Pekr:
3-May-2009
mhinson: there is simple rule to how to read TO: skip everything, 
unless you find the target. This is not what you wanted in your original 
example, because e.g. TO "b" might also mean, that "b" might be the 
last char of your string. So if you are looking for FIRST occurance 
of [a | b | c], you really have to forget TO and use skip based parsing 
by one char. Hence some [a break | b break | c break | skip] is your 
friend ...
Ladislav:
3-May-2009
b: [here: "B" :here copy result thru "."]
parse input [any [b break | skip]]
Pekr:
4-May-2009
'break is needed in Ladislav's code imo because after first match 
of "B" you want to escape (break from) repetitive 'any block, and 
continue your processing with furhter rules (which is not the case 
with Ladislav's example, but is the case with your example, where 
'copy followed. If there would be no break, after matching "B", the 
rule would still succeed, because if there is no "B", then there 
is always "skip option, which is always valid until the end of the 
script. So actually without the 'break, this 'any block would 'skip 
till the end of input string is reached ...
mhinson:
4-May-2009
I have been working out ways to extract IP addresses from a string 
today.  Is this a good way to do it? What could catch me out?


parse to-block "junk 111.111.111.111 0.0.0.0 255.255.255.128 junk" 
[
  any [
    set tup tuple! (print tup)
    | skip
  ]
]
Oldes:
4-May-2009
sorry.. :
some [
				any ch_rest
				rl_ip
				| skip
			]
so it handles cases like:
get-ips "err,.;s 111.111.111 0.0.0.0 255.255.255.128 junk"
Gregg:
11-May-2009
REBOL []

do %include.r
include %file-list.r


flash-wnd: flash "Finding test files..."

if file: request-file/only [
    files: read first split-path file
]
if none? file [halt]

items: collect/only item [
    foreach file files [item: reduce [file none]]
]

unview/only flash-wnd



;-------------------------------------------------------------------------------
;-- Generic functions

call*: func [cmd] [
    either find first :call /show [call/show cmd] [call cmd]
]

change-each: func [
    [throw]

    "Change each value in the series by applying a function to it"

    'word   [word!] "Word or block of words to set each time (will be 
    local)"
    series  [series!] "The series to traverse"

    body    [block!] "Block to evaluate. Return value to change current 
    item to."
    /local do-body
][
    do-body: func reduce [[throw] word] body
    forall series [change/only series do-body series/1]

    ; The newer FORALL doesn't return the series at the tail like the 
    old one

    ; did, but it will return the result of the block, which is CHANGE's 
    result,
    ; so we need to explicitly return the series here.
    series
]

collect: func [
    "Collects block evaluations." [throw]
    'word
    block [block!] "Block to evaluate."
    /into dest [block!] "Where to append results"
    /only "Insert series results as series"

    /local fn code marker at-marker? marker* mark replace-marker rules
][
    block: copy/deep block
    dest: any [dest make block! []]

    fn: func [val] compose [(pick [insert insert/only] not only) tail 
    dest get/any 'val

        get/any 'val
    ]
    code: 'fn
    marker: to set-word! word
    at-marker?: does [mark/1 = marker]
    replace-marker: does [change/part mark code 1]
    marker*: [mark: set-word! (if at-marker? [replace-marker])]
    parse block rules: [any [marker* | into rules | skip]]
    do block
    head :dest
]

edit-file: func [file] [
    ;print mold file

    call* join "notepad.exe " to-local-file file ;join test-file-dir 
    file
]

flatten: func [block [any-block!]][
    parse block [

        any [block: any-block! (change/part block first block 1) :block | 
        skip]
    ]
    head block
]

logic-to-words: func [block] [

    change-each val block [either logic? val [to word! form val] [:val]]
]

standardize: func [

    "Make sure a block contains standard key-value pairs, using a template 
    block"
    block    [block!] "Block to standardize"
    template [block!] "Key value template pairs"
][
    foreach [key val] template [
        if not found? find/skip block key 2 [
            repend block [key val]
        ]
    ]
]

tally: func [

    "Counts values in the series; returns a block of [value count] sub-blocks."
    series [series!]
    /local result blk
][
    result: make block! length? unique series

    foreach value unique series [repend result [value reduce [value 0]]]
    foreach value series [
        blk: first next find/skip result value 2
        blk/2: blk/2 + 1
    ]
    extract next result 2
]


;-------------------------------------------------------------------------------

counts: none

refresh: has [i] [
    reset-counts
    i: 0
    foreach item items [
        i: i + 1
        set-status reform ["Testing" mold item/1]
        item/2: random/only reduce [true false]
        show main-lst
        set-face f-prog i / length? items
        wait .25
    ]
    update-counts
    set-status mold counts
]

reset-counts: does [counts: copy [total 0 passed 0 failed 0]]

set-status: func [value] [set-face status form value]

update-counts: has [pass-fail] [
    counts/total: length? items

    pass-fail: logic-to-words flatten tally collect res [foreach item 
    items [res: item/2]]
    ;result (e.g.): [true 2012 false 232]
    standardize pass-fail [true 0 false 0]
    counts/passed: pass-fail/true
    counts/failed: pass-fail/false
]

;---------------------------------------------------------------


main-lst: sld: ; The list and slider faces
c-1:           ; A face we use for some sizing calculations
    none
ml-cnt:        ; Used to track the result list slider value.
visible-rows:  ; How many result items are visible at one time.
    0

lay: layout [
    origin 5x5
    space 1x0
    across

    style col-hdr text 100 center black mint - 20

    text 600 navy bold {

        This is a sample using file-list and updating progress as files are
        processed. 
    }
    return
    pad 0x10

    col-hdr "Result"  col-hdr 400 "File" col-hdr 100
    return
    pad -2x0

    ; The first block for a LIST specifies the sub-layout of a "row",

    ; which can be any valid layout, not just a simple "line" of data.

    ; The SUPPLY block for a list is the code that gets called to display

    ; data, in this case as the list is scrolled. Here COUNT tells us

    ; which ~visible~ row data is being requested for. We add that to 
    the

    ; offset (ML-CNT) set as the slider is moved. INDEX tells us which
    ; ~face~ in the sub-layout the data is going to.

    ; COUNT is defined in the list style itself, as a local variable 
    in
    ; the 'pane function.
    main-lst: list 607x300 [
        across space 1x0 origin 0x0
        style cell text 100x20 black mint + 25 center middle
        c-1: cell  cell 400 left   cell [edit-file item/1]
    ] supply [
        count: count + ml-cnt
        item: pick items count
        face/text: either item [
            switch index [
                1 [

                    face/color: switch item/2 reduce [none [gray] false [red] true [green]]
                    item/2
                ]
                2 [mold item/1]
                3 ["Edit"]
            ]
        ] [none]
    ]

    sld: scroller 16x298 [ ; use SLIDER for older versions of View

        if ml-cnt <> (val: to-integer value * subtract length? items visible-rows) 
        [
            ml-cnt: val
            show main-lst
        ]
    ]
    return
    pad 0x20
    f-prog: progress 600x16
    return
    status: text 500 return
    button 200 "Run" [refresh  show lay]
    pad 200
    button "Quit" #"^q" [quit]
]

visible-rows: to integer! (main-lst/size/y / c-1/size/y)

either visible-rows >= length? items [
    sld/step: 0
    sld/redrag 1
][
    sld/step: 1 / ((length? items) - visible-rows)
    sld/redrag (max 1 visible-rows) / length? items
]

view lay
mhinson:
13-May-2009
Hi, I have been puzzeling over this all evening & would love a few 
tips please.

I am trying to write a single parse rule that will extract the first 
number before the "/" in each case, but my logic must be faulty I 
think.

digit: charset [#"0" - #"9"]
data1: {random 10/2}
data2: {2/33-35,2/48}

parse/all data1 [ some [[h: 1 2 digit :h copy result to "/" thru 
end] | skip]]
result

parse/all data2 [ some [[h: 1 2 digit :h copy result to "/" thru 
end] | skip]]
result
Steeve:
13-May-2009
or 

parse/all data1 [any [copy x some digit opt [#"/" (probe x)] | skip]]
Group: Syllable ... The free desktop and server operating system family [web-public]
Kaj:
31-Dec-2005
If you want to skip this level as well, I have two soldering irons 
for you that I don't use anymore, and the Atari-BASIC source of a 
disassembler that bootstrapped me into my career ;-)
Graham:
15-Sep-2008
#!/sbin/rebol  -qw
Rebol [
 file: %update.r

 purpose: {Update the system clock based upon the nist.gov time server}
 author: {Graham Chiu}
 date: 15-Apr-2007
]

get-nist-correction: func [/local nist-time cpu-time mjd hms] [
 nist-time: read daytime://time-a.nist.gov
 cpu-time: now

 parse/all nist-time [skip copy mjd 5 skip 2 thru " " copy hms 8 skip]
 nist-time: 17/Nov/1858 + to integer! mjd
 nist-time/time: to time! hms
 nist-correction: difference nist-time cpu-time
]

forever [
 if error? set/any 'err try [
 print [ "Current time was: " now ]
 current-time: now + get-nist-correction
 print [ "New time is: " current-time ]

 s: rejoin [ "date -s " {"} current-time/month "/" current-time/day 
 "/" current-time/year " " current-time/time {"} ]
 probe s
 call s 
 ][ probe mold disarm err ]
 wait 00:02:00 ;; wait 2 mins
]
Group: AGG ... to discus new Rebol/View with AGG [web-public]
Cyphre:
19-May-2006
translate-draw: func [
	height [integer!]
	blk [block!]
	/local dr p
][

 parse blk [some ['draw set dr block! (parse dr [some [p: pair! (p/1: 
 as-pair p/1/x height - p/1/y) | skip]]) | skip]]
	blk
]

view layout [
	origin 0
	bx: box 400x400 black effect translate-draw 400 [
		draw [
			pen red
			line 50x50 350x50
			pen blue
			line 50x50 50x350
			pen yellow
			line 50x50 100x200 200x150 300x250 350x225
			pen white
			text aliased 10x350 "Y axis"
			text aliased 320x40 "X axis"
		]
	]
]
ICarii:
7-Jun-2007
yeah - a while back i used to toy a lot with terrain rendering.  
Back in 2001 I downloaded a large set of NASA data (1GB+ maps) and 
was using them for different rendering tasks.  Back then I had to 
use VB6 and C++ as REBOL didnt have a binary skip :)
Group: Rebol School ... Rebol School [web-public]
Gregg:
21-Nov-2008
transform: func [
	block [block!] "Datatset to transform"
	cmds  [block!] "Transformation commands to perform"
	/local
		run-map-transform
		main= map-blk= src= dest=
		      =map-blk =src =dest
][

 run-map-transform: func [src [integer!] dest [integer!] map [any-block!] 
 /local val] [
		foreach item block [
			if val: select/skip map item/:src 2 [change item/:dest val]
			;print [val mold item]
		]
	]
	map-blk=: ['using set =map-blk word!] 
	src=: ['field set =src integer!]
	dest=: ['into opt 'field set =dest integer!]
	map-cmd=: [
		['map src= map-blk= dest= | map-blk= 'map src= dest=]
		;(print [=map-blk =src =dest])
		(run-map-transform =src =dest get =map-blk)
	]
	main=: [some map-cmd=]

 either parse cmds main= [dataset] [none] ; decide how to handle bad 
 cmd scenario
]


transform copy dataset [map field 2  using glcodehash into field 
4]

transform copy dataset [using glcodehash  map field 2 into field 
4]
Geomol:
6-Feb-2009
The second argument to parse can be a string, and then parse split 
up the first argument, or the second argument can be a block of parsing 
rules. out is just my output block.

So the parsing rules go:
1) first any of a sub-block of sub-rules

2) sub-block copy the input string to a point, where two newlines 
are found, the result in the variable: arg

3) the paranthesis is evaluated (as normal REBOL code), and it append 
arg (the part of the string, we just copied) to the variable out
4) the parser then skip any number of newlines (2, 3 or more)

5) when the sub-rules are not valid any longer, the input string 
is copied till the end (and appended to out as before)
Steeve:
16-Feb-2009
in R3, replace the code (at tail) by: 
screen: system/view/screen-gob
unless system/view/event-port [
	system/view/event-port: open [scheme: 'event]
]

pixel_size: 1x1
grid_size: 160x100 
img: make image! probe gob-size: (grid_size * pixel_size)

append screen ekran: make gob! [offset: 50x50 size: gob-size draw: 
[image img]]

do [
	boja: pick paleta 15
	change/dup skip img 0x0 boja grid_size * pixel_size
	for i 0 127 1 [
			for yy -50 49 1 [
				for xx -50 49 1 [

     rr: square-root (((xx + 0.5) * (xx + 0.5)) + ((yy + 0.5) * (yy + 
     0.5)))
					if ((rr > 14) and (rr < 50)) [
						zz: (900 / rr)
						pozicija: (pixel_size * (grid_size / 2 + (as-pair xx yy)))
						dubina: :zz - 18 / 46
						red: to-integer dubina * 63 + 1
						red: red + i
						red: to integer! red // 63 / 2 + 1
						either xx = 0
							[ugao: arctangent 999999999999]
							[ugao: arctangent (yy / xx)]
						either xx >= 0
							[ugao: ugao + 360 // 360]
							[ugao: ugao + 180]
						ugao: to-integer ugao / 360 * 63
						ugao: ugao // 32
						ugao: ugao + 1
						p: level/:red/:ugao
						boja: pick paleta p
						change/dup skip img pozicija boja pixel_size
					]
				]
			]
			show ekran
	]
]
Steeve:
16-Feb-2009
see that, i do a scaling in R3:

screen: system/view/screen-gob
unless system/view/event-port [
	system/view/event-port: open [scheme: 'event]
]

pixel_size: 1x1
grid_size: 160x100 
img: make image! probe gob-size: (grid_size * pixel_size)

append screen ekran: make gob! compose [offset: 50x50 size: (gob-size 
* 4x4) draw: [scale 4 4 image img]]

do [
	boja: pick paleta 15
	change img boja grid_size
	for i 0 127 1 [
			for yy -50 49 1 [
				for xx -50 49 1 [

     rr: square-root ((xx + 0.5) * (xx + 0.5)) + ((yy + 0.5) * (yy + 0.5))
					if ((rr > 14) and (rr < 50)) [
						zz: 900 / rr
						pozicija: grid_size / 2 + as-pair xx yy
						dubina: zz - 18 / 46
						red: i + to-integer dubina * 63 + 1
						red: to integer! red // 63 / 2 + 1
						either xx = 0
							[ugao: arctangent 999999999999]
							[ugao: arctangent (yy / xx)]
						either xx >= 0
							[ugao: ugao + 360 // 360]
							[ugao: ugao + 180]
						ugao: to-integer ugao / 360 * 63
						ugao: ugao // 32
						ugao: ugao + 1
						p: level/:red/:ugao
						boja: pick paleta p
						change skip img pozicija boja 
					]
				]
			]
			show ekran
	]
]
Steeve:
16-Feb-2009
do you have a little gain with this ?

	repeat i 256 [
		foreach pixel lookup [
			set [pozicija red ugao] pixel
			red: red + i - 1 // 63 / 2 + 1
			p: pick pick level red ugao
			if (p > 0) [
				boja: pick paleta p
				change/dup skip ekran/image pozicija boja pixel_size
			]
		]
		show ekran
	]
Group: !REBOL3-OLD1 ... [web-public]
BrianH:
4-May-2006
As for the hash (or assoc) index and list data combo, it has some 
advantages. When you are inserting and removing data a lot lists 
have a known speed benefit but the real advantage as far as indexes 
are concerned is in how lists handle series offsets (I'm using the 
word offset here because I'm using the word index to refer to the 
external hash/assoc index).


Blocks encode their offsets as a number offset from the beginning 
of the series:

>> a: [a b c]
== [a b c]
>> b: skip a 2
== [c]
>> index? b
== 3
>> insert next a 'd
== [b c]
>> b
== [b c]
>> index? b
== 3

List offsets are pointers to the associated list element.

>> a: make list! [a b c]
== make list! [a b c]
>> b: skip a 2
== make list! [c]
>> index? b
== 3
>> insert next a 'd
== make list! [b c]
>> b
== make list! [c]
>> index? b
== 4


If you are indexing your data and your data in in a block, you need 
to update your index with almost every insertion and removal because 
the references to latter positions of the block in the index will 
be invalid. With list insertion and removal, external references 
are likely to still be valid unless the referenced elements themselves 
are deleted. If you are sure to delete the reference from the index 
(or replace it with nones) the rest of the index should be OK. New 
index references can just be tacked on the end, or put into the first 
empty entry. This makes live indexes a lot more practical.


On the down side, if you are using lists and they are long enough 
to make linear searches impractical, you really do need an external 
index for them to be useful. Also you need to balance the overhead 
and complexity of keeping the indexes updated against their benefit. 
This technique is not for the faint of heart unless you can get some 
guru to do algorithms for you.
Gregg:
14-May-2006
split: func [  ; subdivide, chunk, segment  ?

        {See: CLOS pg. 937. Not that mine works the same, but that was
        the inspiration.}
        series [series!]

        size   [integer!] "The size of the chunks (last chunk may be shorter)"

        /into  "split into a set number of chunks (last chunk may be longer 
        than others)."
        /local ct cur-piece result
    ][

        ct: either into [size] [round/down divide length? series size]
        if into [size: to-integer divide length? series size]
        result: copy []
        if zero? size [return result]
        parse series [
            ct [

                copy cur-piece size skip (append/only result cur-piece) mark:
            ]
        ]
        if any [into  not zero? remainder length? series size] [
            cur-piece: copy mark
            either into
                [append last result cur-piece]
                [append/only result cur-piece]
        ]
        result
    ]
Henrik:
22-Aug-2006
ladislav, I think that's OK. interestingly, you can skip with decimal! 
values to make a smaller step than 1. I noticed two funny things 
though:

>> repeat i 3 [probe i i: i - 0.5]
1
0.5
1.11022302462516E-16
-0.5
-1.0
-1.5
-2.0
-2.5


One is that 0 isn't exactly zero and the other thing is that it counts 
to the absolute value of 'i
Gregg:
12-Sep-2006
Wow. A lot of thought here. I've skimmed it (trying to catch up on 
things quickly), and will just post a couple quick thoughts.


* REJOIN is probably a good enough name to stick with; I don' t know 
that any of the others are that much more meaningful in the context 
of REBOL. 

* Changing JOIN's params would break a lot of code.


* I have a DELIMIT function as well, and like the name. Mine doesn't 
have /copy or /only refinements (it always uses insert/only), but 
it has /skip.
Anton:
25-Nov-2006
Stayed up all night, and succeeded in making a parse rule generator, 
so if we want to search a string for any substrings:

string: {Hello there Anton. Arrow in the box. What nice antlers you 
have.}
substrings: ["ant" "antler" "anton" "arrow" "bar" "box"]

rule: [start: [["a" [["nt" action ["ler" action | "on" action]] | 
"rrow" action]] | ["b" ["ar" action | "ox" action]]] | skip]
Found at: 13 Substring: "Ant"
Found at: 13 Substring: "Anton"
Found at: 20 Substring: "Arrow"
Found at: 33 Substring: "box"
Found at: 48 Substring: "ant"
Found at: 48 Substring: "antler"
true
JaimeVargas:
20-Dec-2006
But thinks like append "d" copy skip "cba" 2. Need to be written 
in multiple lines.
JaimeVargas:
20-Dec-2006
APPEND "d" \
   COPY \
      SKIP "cba" 2


Using the '\ as hint that the expression is expecion something to 
return from the next expresion.
Geomol:
10-Feb-2007
A function increasing something by 2, which can handle direct values 
and words holding values and series, today have to be something like:

inc2: func ['value] [
	either word? value [
		either series? get value [
			set value skip get value 2
		][
			set value (get value) + 2
		]
	][
		value + 2
	]
]

With set-word arguments, it might be:

inc2: [value:] [
	either series? value [
		skip value 2
	][
		value + 2
	]
]

With INC, it could be:

inc2: [value] [inc inc value]


Maybe an increase function taking two arguments should be native 
too (like INC and DEC):

increase value 2


All these are just ideas to think about, when you guys create REBOL3.
BrianH:
12-Feb-2007
; INC/DEC with lit-word arguments:
increment: func [
    [catch] 'x "Value to increase"
    y [integer!] "Amount to increase by"
    /local t
] [
    throw-on-error [
        if path? :x [
            x: in do copy/part :x back tail :x last :x
        ]
        t: either any [word? :x paren? :x] [do :x] [:x]
        case [
            series? :t (t: skip :t y)
            number? :t (t: t + y)
        ]
        either word? :x [set/any x :t] [:t]
    ]
]
inc: func [[catch] 'x] [increment :x 1]
dec: func [[catch] 'x] [increment :x -1]
decrement: func [
    [catch] 'x "Value to decrease"
    y [integer!] "Amount to decrease by"
] [increment :x negate y]
BrianH:
12-Feb-2007
; INC/DEC with regular arguments, must use lit-word! or lit-path! 
directly to get side effects:
increment: func [
    [catch] x "Value to increase"
    y [integer!] "Amount to increase by"
    /local t
] [
    throw-on-error [
        if path? :x [
            x: in do copy/part :x back tail :x last :x
        ]
        t: either word? :x [do :x] [:x]
        case [
            series? :t (t: skip :t y)
            number? :t (t: t + y)
        ]
        either word? :x [set/any x :t] [:t]
    ]
]
inc: func [[catch] x] [increment :x 1]
dec: func [[catch] x] [increment :x -1]
decrement: func [
    [catch] x "Value to decrease"
    y [integer!] "Amount to decrease by"
] [increment :x negate y]
Maxim:
13-Feb-2007
Carl had talked about allowing some set-word functions but I'd rather 
have a full set of accessors (set get pick poke skip, etc)
BrianH:
5-Apr-2007
The idea is to add a LOAD directive to the PARSE string dialect. 
LOAD would treat the sequence of characters at the current position 
as a REBOL value, and then check it against a block-dialect rule. 
If it is not a valid REBOL value or if the check fails, the directive 
fails and triggers any appropriate backtracking. If you are not interested 
in checking the value, just use SKIP for the rule. If you want the 
value, use SET (or COPY perhaps?) before the LOAD to assign it to 
a word.
Group: !Cheyenne ... Discussions about the Cheyenne Web Server [web-public]
btiffin:
30-Oct-2007
Terry;  I like what you have been saying.   You need some supporters. 
  Go Terry Go!  REBOL on Rockets sounds good.  If you get into conflict 
with RoR, you might try REBOL Rays.  Skip rockets, go for a lightspeed 
connotation.  ;)


Again, I like the idea.  The entire framework payload; base language, 
server, funky DB and kitchen sink would fit on a pinhead.  R EBOL 
A TOM C heyenne K itchen-sink.

Go Doc Go!
Dockimbel:
20-Dec-2007
HOW-TO make Cheyenne work with PHP for non-Windows OS


The purpose of the following patch is to make FastCGI in PHP work 
the same on all OSes.


1) If you have PHP v5.2.1 or higher with sources, you can skip 2) 
& 3) else :

2) Download latest PHP sources from http://www.php.net/downloads.php
3) Untar the archive anywhere yo want
4) Go to PHP install folder
5) Patching PHP source :

	Open a REBOL console, then :

;---- cut'n paste the following code in REBOL's console ----

patch-php: has [buffer pos][
	target: %sapi/cgi/fastcgi.c
	if none? attempt [buffer: read target][
		print "unable to find the file to patch!!"
		exit
	]
	either parse buffer [
		thru "int fcgi_accept_request("
		to "if (req->fd >= 0) {"
		pos: to end
	][
		insert pos "^/^-^-^-^-break;^/^-^-^-^-"
		write target buffer
		print "patch applied."
	][
		print "failed to locate the line to patch!!"
	]
]

patch-php
;---- end of code ----
		
6) Once the patch is applied :

	> ./configure --enable-fastcgi
	> make
	> sudo make install
	
7) Check if everything is ok :

	> php-cgi -h
	...
	you should see a -b option listed meaning you got proper
	FastCGI support.
	
	If it fails (occured on OSX), try with a full path instead :
	
	> /usr/local/bin/php-cgi -h
	

8) Edit Cheyenne's config file (httpd.cfg) to set the correct option 
in the PHP section. Non-Windows users have to also set the new 'delay 
option.
Will:
21-May-2008
impressed! 8) I finally gave another try at php support in cheyenne 
and after patching fastcgi.c as suggested it now works like a charm.

If you are on os x and use macports, here is a way to patch and compile:

sudo port install php5 +mysql5 +fastcgi
sudo port uninstall php5
cd /opt/local/var/macports/distfiles/php5/
sudo tar -xjf php-5.2.6.tar.bz2
>> run patch below
tar -cjf php-5.2.6.tar.bz2 php-5.2.6
sudo port install php5 +mysql5 +fastcgi checksum.skip=yes

copy of Dockimbel's patch with path fixed for this example

;---- cut'n paste the following code in REBOL's console ----

patch-php: has [buffer pos][ target: %php-5.2.6/sapi/cgi/fastcgi.c 
if none? attempt [buffer: read target][ print "unable to find the 
file to patch!!" exit ] either parse buffer [ thru "int fcgi_accept_request(" 
to "if (req->fd >= 0) {" pos: to end ][ insert pos "^/^-^-^-^-break;^/^-^-^-^-" 
write target buffer print "patch applied." ][ print "failed to locate 
the line to patch!!" ] ]
patch-php ;---- end of code ----
BrianH:
2-Apr-2009
2/4-22:54:04.266-## Error in [uniserve] : On-received call failed 
with error: make object! [
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'insert
    arg2: 'series
    arg3: [series! port! bitset!]
    near: [insert/part tmp/port s skip e]
    where: 'process-bounded-content
] !
BrianH:
3-Apr-2009
Same error after upgrading Chromium, here's the verbose 5 log of 
the request:


3/4-01:38:00.891-[HTTPd] ================== NEW REQUEST ==================

3/4-01:38:01.531-[HTTPd] Request Line=>POST /ecg/blah.rsp HTTP/1.1

3/4-01:38:02.109-[HTTPd] Trying phase method-support ( mod-static 
)

3/4-01:38:02.828-[HTTPd] Trying phase url-translate ( mod-static 
)
3/4-01:38:03.062-[uniserve] Calling >on-received< with {^M
Host: localhost:8080^M
Connection: keep-alive^M
Us}
3/4-01:38:03.547-[HTTPd] Request Headers=>
Host: localhost:8080
Connection: keep-alive

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.5 
(KHTML, like Gecko) Chrome/2.0.173.0 Safari/530.5
Referer: http://localhost:8080/ecg/blah.html
Content-Length: 153149
Cache-Control: max-age=0
Origin: http://localhost:8080

Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryEv3SZArZWdjyznJZ

Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip,deflate,bzip2,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3



3/4-01:38:03.797-[HTTPd] Trying phase url-to-filename ( mod-alias 
)
3/4-01:38:04.031-[HTTPd] => request processed
3/4-01:38:04.766-[HTTPd] Trying phase url-to-filename ( mod-rsp )
3/4-01:38:05-[HTTPd] => request processed

3/4-01:38:05.469-[HTTPd] Trying phase url-to-filename ( mod-internal 
)

3/4-01:38:05.719-[HTTPd] Trying phase url-to-filename ( mod-static 
)
3/4-01:38:05.969-[HTTPd] => request processed

3/4-01:38:06.453-[uniserve] >> Port: 3789, low-level reading: 17520

3/4-01:38:06.703-[uniserve] >> Port: 3789, low-level reading: 17520

3/4-01:38:06.953-[uniserve] >> Port: 3789, low-level reading: 17520

3/4-01:38:07.437-[uniserve] >> Port: 3789, low-level reading: 17520

3/4-01:38:07.906-[uniserve] >> Port: 3789, low-level reading: 19980

3/4-01:38:08.391-[uniserve] Calling >on-received< with "------WebKitFormBoundaryEv3SZArZWdjyznJZ^M^/Content-"

3/4-01:38:08.875-[uniserve] >> Port: 3789, low-level reading: 16680

3/4-01:38:09.344-[uniserve] >> Port: 3789, low-level reading: 17520

3/4-01:38:09.844-[uniserve] >> Port: 3789, low-level reading: 17520

3/4-01:38:10.312-[uniserve] >> Port: 3789, low-level reading: 1149

3/4-01:38:10.797-[uniserve] Calling >on-received< with {037.17923" 
"4429 SUNNYSLOPE RD SW" "Port Orchard" }

3/4-01:38:11.266-## Error in [uniserve] : On-received call failed 
with error: make object! [
    code: 303
    type: 'script
    id: 'expect-arg
    arg1: 'insert
    arg2: 'series
    arg3: [series! port! bitset!]
    near: [insert/part tmp/port s skip e]
    where: 'process-bounded-content
] !
3/4-01:38:11.734-[uniserve] Port closed : 127.0.0.1
Robert:
12-Jun-2009
I have a problem, that after some running time Cheyenne seems to 
get into an unstable state and my REST shopping-cart isn't working 
any longer. I got this error in the trace.log, which seems to be 
Cheyenne internal:


5/6-10:09:48.142823-## Error in [task-handler-40014] : Make object! 
[                                                                
                 
    code: 501                                  
                                                                 
                                      
    type: 'access         
                                                                 
                                                           
    id: 
'not-open                                                        
                                                                 
            
    arg1: "Port"                                    
                                                                 
                                 
    arg2: none                 
                                                                 
                                                      
    arg3: 
none                                                             
                                                                 
          
    near: [parse/all current: fourth entry [          
                                                                 
                               
            any [                
                                                                 
                                                    
            
    end break                                                    
                                                                 
        
                | "#[" copy value to #"]" skip (        
                                                                 
                             
                    append out reform 
[                                                                
                                               
                 
       " prin any [pick cat"                                     
                                                                 
   
                        locale/id? value                     
                                                                 
                        
                        mold value #"]" 
                                                                 
                                             
                   
 ]                                                               
                                                                 
 
                )                                              
                                                                 
                      
                | "<%" [#"=" (append out " 
prin ") | none]                                                  
                                          
                copy value 
[to "%>" | none] 2 skip (                                        
                                                          
      
              if value [repend out [value #" "]]                 
                                                                 
              
                )                                 
                                                                 
                                   
                | s: copy value 
[any [e: "<%" :e break | e: "#[" :e break | skip]] e: (          
                                                     
           
         append out reform [" txt" index? s offset? s e #" "]    
                                                                 
         
                )                                      
                                                                 
                              
            ]                     
                                                                 
                                                   
        ]]   
                                                                 
                                                                 
       
    where: 'confirm                                      
                                                                 
                            
] !                                 
                                                                 
                                                 
5/6-23:01:46.501455-## 
Error in [task-handler-40014] : Make object! [                   
                                                              
  
  code: 501                                                      
                                                                 
                  
    type: 'access                             
                                                                 
                                       
    id: 'not-open        
                                                                 
                                                            
    
arg1: "Port"                                                     
                                                                 
                
    arg2: none                                  
                                                                 
                                     
    arg3: none             
                                                                 
                                                          
    near: 
[unless no-lang [                                                
                                                                 
          
            id: locale/lang                           
                                                                 
                               
            locale/set-default-lang 
                                                                 
                                                 
        ]      
                                                                 
                                                                 
     
        out: make                                          
                                                                 
                          
    ]                                 
                                                                 
                                               
    where: 'confirm 
                                                                 
                                                                 

] !
401 / 12281234[5] 678910111213