• 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
r4wp917
r3wp9345
total:10262

results window for this page: [start: 107 end: 206]

world-name: r4wp

Group: #Red ... Red language group [web-public]
DocKimbel:
22-Aug-2012
I don't receive notification emails anymore for the newly added github 
issues...If I activate Settings->Notification->Watching->Email, I 
get them again, but also from all others repo I'm watching...Is there 
a way to only get the notifications by email for the repos I'm owning?
MagnussonC:
23-Aug-2012
I don't get any output, just a question if I'm allowing to open a 
port for read/write ...
Pekr:
23-Aug-2012
I might try to compile the library myself. How do I get different 
branch onto my PC?
DocKimbel:
23-Aug-2012
How do I get different branch onto my PC?

 If you're using TortoiseGit client, just search in the context menu 
 for "Switch/Checkout", then select the `dyn-lib-emitter`branch. If 
 you don't have it, you need to click on "..." button and create a 
 remote to dockimbel/dyn-lib-emitter.
DocKimbel:
23-Aug-2012
Ah ok, the info you get there are Windows file metadata (probably 
a resource section in the file), these are not from DLL core structures.
DocKimbel:
23-Aug-2012
Pekr: I wonder if there's not an issue with the lack of entry point 
in the DLL, I just don't get why REBOL would choke on it sometimes 
and never the C apps (except your testing tool).
Pekr:
23-Aug-2012
I will better redownload .zip archive. Is there any way how to get 
link to particular branch, so that I can keep my working directories 
intact and not mix a stuff from various branches into one directory?
DocKimbel:
23-Aug-2012
Pekr: be sure to get the lastest commit (pushed a minute ago).
DocKimbel:
23-Aug-2012
Would be nice if more ppl on Windows could test it, so we maybe get 
a clue why it doesn't load on 
some configs.
DocKimbel:
24-Aug-2012
Pekr and Rebolek: could you try to use ProcessMonitor (PM) to see 
if we can get a clue about what is blocking the DLL loading from 
R2?


1) Download it from: http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx
2) Run it

3) Open a REBOL console and CD to the folder where the DLL is located

4) In PM, drag'n drop the "target" icon to the REBOL console window
5) Type in console: lib: load/library %temp.dll

6) Scroll down in the PM window to look for rebol.exe process entries, 
look for failure reports in Result and Detail columns...
DocKimbel:
25-Aug-2012
If it still doesn't work, we'll have to get your hands dirty by diving 
in Windows guts using WinDbg. ;-)
Pekr:
25-Aug-2012
I mean - now we can make wrapper libs, coding almost in REBOL (syntax), 
no need to become dirty with C, and hence get more libraries to work 
with R2, via a wrapper libraries written in Red/System?
Robert:
25-Aug-2012
yes, to get one binary.
DocKimbel:
25-Aug-2012
For static libs linking, if someone could contribute by providing 
a .lib and .a file reader/parser, that would help get that feature 
implemented sooner.
Pekr:
25-Aug-2012
some kind of brige is required, if we want to get into an Android 
API. Ditto for .NET?
Robert:
27-Aug-2012
Porting / binding R3 GUI to Red shouldn't be hard to do. It's a lot 
of work but we would get a simple and fast to use GUI. One of the 
major USPs of Rebol. I don't know any other simple to use interpreter 
that gives you a GUI out of the box. And, in these app days, it's 
no longer so critical to support native look & feel in all aspects.
Group: Ann-Reply ... Reply to Announce group [web-public]
Rebolek:
2-Jul-2012
ah, now I get your error. Maybe Arnold changed something in the code?
Henrik:
16-Jul-2012
No, this was an old effort for Saphirion to get access to the source 
code privately. It didn't work.
Henrik:
16-Jul-2012
It's too early to get hopes up. The restrictions may be quite severe 
(NDA and such).
Andreas:
17-Jul-2012
For both, R2 and R3, you can use HELP on a console to get a listing 
of all global values of a certain type. So to see all functions, 
try
>> HELP function!
Endo:
26-Jul-2012
I've an issue with RebolIDE,

I get "Script Error: Face object reused (in more than one pane): 
Example..."

Here is the steps to reproduce: open shape document from help menu, 
click on an example (opens a new window), close the example window 
and the document window, then click on help menu.
Great work by the way, I especially like the documents.
Arnold:
26-Jul-2012
Get the error too, just downloaded 10 minutes ago. ** Script Error: 
Face object reused (in more than one pane): Binds words to a specified 
context
** Where: set-focus
** Near: show face
After closing the help core
Group: Rebol School ... REBOL School [web-public]
Henrik:
29-Jun-2012
try this interactive test:

view layout [p: panel [button]]

escape to console and type:

p/pane: get in layout/tight [field 100] 'pane

show p
Henrik:
30-Jun-2012
You can study different styles using GET-STYLE.

For example:

probe get-style 'field


It's a bit misleading, though, as many styles share the same code. 
To really see how styles are built, you need to read the sourcecode 
for VID.
Arnold:
30-Jun-2012
When I name the labels lr1 thru lr8 and use the trick I found on 
www.pat665.free.fr/gtk/rebol-view.html which is w: to-word rejoin 
["lr" n] (for n is 1, 2, 3 or    8 you get the picture.) and f: get 
:w 

f/font/color: white and directly show the label: show f I can set 
them seperately. But it is a bit ugly to do it like this if I may 
say so.
Sujoy:
3-Jul-2012
this works great for fields in a simple object series:
sort-object-series: func [
  series
  field
] [

  sort/compare series func[a b][lesser? get in a field get in b field]
]
Sujoy:
3-Jul-2012
am fumbling with the get in bit...
Maxim:
3-Jul-2012
I think you get blocks of fields when you use /compare with /skip
Maxim:
3-Jul-2012
ok, so to get complete records, you need the /all refinement...
Maxim:
3-Jul-2012
yes, you just need to adapt the paths you lookup.  the sort func 
gets a pair of blocks which are the whole records, which is why I 
start with a /2 to get the second field, which is the block ... in 
your case, that would be the object
Maxim:
3-Jul-2012
we neededed to support, xml rest, SOAP and direct get/post interface 
to the same functions, and that is now working via a configuration, 
which allows you to tweak how the url is read and switch interfaces 
on the fly.
Sujoy:
3-Jul-2012
any chance i can get to play with the code?
Sujoy:
3-Jul-2012
i get:
>> sort/compare comps :sf
** Script Error: Invalid argument: ?function?
** Near: sort/compare comps :sf
Sujoy:
3-Jul-2012
if i do:

>> sort/skip/compare/all comps 2 func [a b][length? a/mcapz > length? 
b/mcapz ]
i get an invalid path error
Maxim:
3-Jul-2012
when you use /all,   you get two BLOCKS.  one for each record of 
length /skip

so your function is called like so: 

sort-func [   "2009-2010"  #[object! [  ... ]]  ]      [ "2011-2012" 
 #[object! [ ... ]]   ]
Arnold:
4-Jul-2012
Well it was quite a problem to get the selected value. I ended up 
first initialising all /data fields to their respective values beforehand 
to true for the one on and false for the two unselected ones. After 
that the fields behaved like you would expect, being true in case 
the selection was on this button and false if not selected.
Radio-line is new to me.
Maxim:
4-Jul-2012
here is a simple way to get the code for a face within the layout 
function ( I found it the easiest to remember):

view layout [
	across
	text "1"
	my-radio: radio on 
	do [probe my-radio]
	text "2"
	radio
]


the advantage of this system is that you get the actual face with 
any facets setup as they really are in your gui.  this is often the 
easiest way to identify just where and how a specific facet affects 
a face... probe it without your change, and then run it again, with 
your change... comparing both probes in a diff or merge tool.
Maxim:
4-Jul-2012
the other way is to use get-style.   the advantage here is that is 
preserves the init block, instead of clearing it after VID has done 
its work


a good look at the 'init block is often useful to understand why 
changing some of the face values is ineffective (like changing face/color 
is often useles... since that face is setup to use face/colors). 
 

this block is run after all the facets have been applied. 

note that you can set or append to this block in your own styles.
ChristianE:
4-Jul-2012
get-radio-buttons: does [
    reduce [
        get-face option-1
        get-face option-2
        get-face option-3
    ]
]

reset-radio-buttons: does [
    clear-face option-1
    clear-face option-2
    clear-face option-3
]

view layout [

    option-1: radio-line "Option 1" of 'options [probe get-radio-buttons]

    option-2: radio-line "Option 2" of 'options [probe get-radio-buttons]

    option-3: radio-line "Option 3" of 'options [probe get-radio-buttons]

    btn "reset radios" [reset-radio-buttons]
]
Chris:
7-Jul-2012
Arnold, I came up with one solution to the radio question here:

http://stackoverflow.com/questions/6401469/how-do-i-get-the-radio-button-value-in-rebol
Kaj:
12-Jul-2012
I think Henrik means that you can get bitten by REBOL hanging for 
short periods of time in the garbage collector
Endo:
23-Jul-2012
How can I get the error text when I use TRY, I want to show the original 
error text to the user: 
if error? set/any 'err try [1 / 0] [probe disarm err]


I think I saw something similar in UniServe sources but couldn't 
find it.
DocKimbel:
23-Jul-2012
This function should help you:

form-error: func [err [object!]][
	foreach w [arg1 arg2 arg3][
		set w either unset? get/any in err w [none][
			get/any in err w
		]
	]
	reform [
		"***" system/error/(err/type)/type #":"
		reduce system/error/(err/type)/(err/id) newline
		"*** Where:" mold/flat get in err 'where newline
		"*** Near: " mold/flat get in err 'near newline
	]
]
Sunanda:
30-Jul-2012
Maxim....Thanks!


I rarely think of using R2-forward to get all those R3 goodies like 
value-of. Makes life much simpler :)


Your only way to fail can be fixed by checking the 'difference of 
the words-of before the main 'all.


Perhaps worth noting for anyone thinking of using the code as written: 
obj2 gets changed in the process.

Thanks again!
Endo:
30-Jul-2012
Sunanda: I wrote this function a few months ago for the same task: 
It may not a very good solution but its ok (I think)

similar?: func [
    {Returns true if both object has same words in same types.}
    o [object!] p [object!] /local test
][

    test: [if not equal? type? get in o word type? get in p word [return 
    false]]
    foreach word sort first o test
    foreach word sort first p test
    true
]
MaxV:
31-Jul-2012
a: [ 1 2 3 4 5 6]
b: copy  find/tail a 3 ; you get [4 5 6]
c: reverse copy/part a ((index? find a 3 ) - 1)
MaxV:
31-Jul-2012
and so you get [2 1]
Arnold:
31-Jul-2012
And now for something completely different. I have a php based form 
I want to make into a REBOL cgi program. It is to upload some fields 
into an article-base in my mysql database. Where action is article.php 
in the php version I changed this to article.r for the REBOL version. 
I have now the article form shown and when I fill in some fields 
(but not all) and send the form I get the cgi object ( I use safe-cgi-data-read) 
but the contents of the formfields is now empty? Any clues what may 
be the case please?
SWhite:
31-Jul-2012
I believe that if you do not fill in a field on the form, you do 
not get an item in the cgi objectl.  I seem to recall being confused 
by that for a while.
Sunanda:
31-Jul-2012
Client-side validation is a nice courtesy touch for the user -- they 
get told of errors without a network delay. But the server-side code 
needs to also do full validation as there is no way of guaranteeing 
the data has been POSTed from your form....Or perhaps the user had 
Javascript turned off.
Arnold:
1-Aug-2012
On the form validation issue. I managed to get things working as 
I initially intented. Using a Javascript function to change the text 
of the field: 
var changer = document.getElementById('fieldid');
changer.value = fieldvalue;
Where fieldvalue was filled from the cgi data block cgi/fieldname

It was really fun to get this right with all the needed double-quotes 
and curly braces that alle represent comments in rebol as you know 
and generate this from within the well-known function emit: func 
[code] [ repend html code]
I had to add an id tag to all the form fields.
BrianH:
8-Aug-2012
Put in an exception for blocks, parens and integers too. In your 
code above, blocks get treated like sub-rules, parens get executed, 
and integers can result in an endless loop.
DocKimbel:
9-Aug-2012
Endo: you should rather bench on one long series rather than 1M times 
on a small one in order to avoid function calls overhead and get 
a more fair comparison. When I try with a 1M size string with random 
a,b,c chars, my parse solution is twice faster than the mezz one 
(Brian's one is crashing so can't test it). I was expecting a greater 
difference though.
Steeve:
9-Aug-2012
is-a: func [f v][
	not not all [
		f: get/any load f
		any-function? :f
		f load v
	]
]
BrianH:
9-Aug-2012
You can get rid of this line too for a slight speedup:
				end pos2: emit break |

It's a leftover when I was trying to work around the bug in PARSE.
BrianH:
10-Aug-2012
In mezzanine style:

decode-rle: func [
	"Decode a run length encoded block"
	rle [any-block!] "Block of [integer value]"

 /into "Insert into a buffer instead (returns position after insert)"
	output [series!] "The output buffer (modified)"
	/local x
] [
	unless into [
		x: 0  foreach [i v] :rle [x: x + :i]  output: make block! x
	]

 foreach [i v] :rle [output: insert/only/dup :output get/any 'v :i]
	either into [:output] [head :output]
]


Instead of testing for strict format compliance of the input block, 
it uses get-words to keep people from sneaking in functions and then 
passes the length value to + and INSERT/dup, counting on the type 
tests of those functions to do the screening for us.
BrianH:
10-Aug-2012
Slightly more optimal version for R3, taking advantage of how get-words 
and get-paths mean GET/any, and how FORSKIP is faster than FOREACH:
BrianH:
11-Aug-2012
Steeve, that's basically the same as my R2 RLE's block rule, but 
with the IF workaround replaced with IF. It has a few gotchas:
- Executes function values in block data
- Doesn't handle unset! or error! values

- Converts lit-paths to paths and lit-words to words before comparison 
and again before putting in the output.
- Lots of intermediate block creation overhead

- Considers bindings of words when comparing them, not just case-sensitive 
spelling


The first 3 can be handled by using :p/1 and :e/1 instead of p/1 
and e/1, and the fourth by using REDUCE/into instead of REPEND. The 
last one can't be handled by any built-in function or operator in 
R3 (see http://issue.cc/r3/1834for details) but you could do a combination 
of functions and operators to get case-sensitive comparison without 
considering bindings. PARSE/case's QUOTE operation is the fastest 
method for doing that at the moment.


Nice job on neatly bypassing the relaxed bounds checking of R3 blocks. 
Though the if (p/1 == e/1) would succeed if p/1 is none and e is 
at the end of the block, the skip would still fail. That trick saves 
one e: operation.
BrianH:
14-Aug-2012
Yes. It uses the IF and QUOTE operations, SET working on string parsing, 
PARSE default /all, :x meaning GET/any 'x, REDUCE/into, and equality 
finctions handling unset! values.
BrianH:
14-Aug-2012
Gabriele has done a great job of reimplementing many of R3's PARSE 
enhancements in R2 using rule generators. If you're stuck on R2 or 
REBOL-alikes with R2-like behavior, that's a good place to start. 
It also helps to look at the parse project page, since there are 
a lot of code equivalent examples in the proposals there. That way 
you can translate your rules manually, and in some cases get faster 
rules as a result. Be careful with unset! vlaues though since there 
are a lot of bugs and limitations to R2's unset value handling, as 
demonstrated in the R2 RLE code above.
GrahamC:
27-Aug-2012
So, I guess my question is .. when do local variables get garbage 
collected?
Ladislav:
27-Aug-2012
When do local variables get garbage collected?
 - never, only in case they are not accessible
BrianH:
27-Aug-2012
Sorry, didn't get that. In R2 if you are using functions not defined 
by the CLOSURE function then you might want to set some local variables 
to none before returning - that's what ALSO was for, btw. In R3 you 
don't need to unset anything because the GC will collect the set 
of values associated with the function's local variables after the 
function returns, or the whole context after a closure returns.
GrahamC:
27-Aug-2012
Sure we have various idioms that people get used to using, but that's 
not the same thing
Endo:
28-Aug-2012
map-each [x: y] [...] is an interesting use. I sometimes needed to 
get that "index" value but I didn't know that usage so I used forall 
instead. Good to learn.
DocKimbel:
28-Aug-2012
In your first try (bind 'e self), you're binding only this 'e word, 
not the :e function body, so if you replace it with: bind second 
:e self, it will work.


In second try, you're never binding 'e function body, you've just 
binded a new instance of 'f word that you have created using FIRST. 
That's why it works when you add DO, you're evaluating that new 'f 
instance which has the correct binding. Just remove FIRST, it will 
bind 'e body block and you'll get the result you've expected.

>> e: func [] [f]
>> o: context [f: does [print "ok"]]
>> bind second :e o
== [f]
>> e
ok
Endo:
28-Aug-2012
Got it, thanks a lot. I didn't know that FIRST gives me a "new" word, 
I thought that I'm BINDing *the* word itself and it should stay BINDed.

This confused me a bit:
>> o: context [a: 1 b: 2 c: 3]

>> foreach x bind [a b c] o [probe get x] ;this works, BINDs block 
to O

>> foreach x [a b c] [probe get bind x o] ;this works too, BINDs 
the word 'X to O
BrianH:
28-Aug-2012
Endo, when you are using set-words with MAP-EACH and R3's FOREACH, 
be sure to include at least one regular word, or it won't advance 
and you'll get an endless loop. We made that possible in order to 
support the foreach [x:] data [... take x ...] code pattern. It's 
the type of thing that would generate a warning in other languages, 
but REBOL is inherently incompatible with warnings.
caelum:
5-Sep-2012
A beginners question. I have some code that allows a user to input 
a date or leave it blank;

datetime: field

I get the data by accessing;

datetime/text


My question is, if the user leaves the field empty, how do I test 
for this? I have tried none? And empty?

If none? datetime/text [print "Select a date"]


produces a Script Error: 'datetime has no value'. How do I test if 
datetime/text is null so I can ask the user to go back and fill in 
the datetime field?
GrahamC:
5-Sep-2012
you get that vid error because you are referring to it before the 
layout function has run.
Arnold:
7-Sep-2012
Hi I am trying to replicate this in Rebol: http://www.alistapart.com/articles/succeed/
I have the redirect setup but I want to know what url the user entered. 
Where can I get $DOCUMENT_ROOT.$REQUEST_URI ??
DocKimbel:
7-Sep-2012
If you are using REBOL in CGI mode:

    get-env "DOCUMENT_ROOT"
    get-env  "REQUEST_URI"
Arnold:
7-Sep-2012
Thank you, this works! I found and old conversation on ALTME this 
afternoon but that could not convince me being the answer, this answer 
will replace the old one. (I even typed get_env the first time). 
And for completeness I will write how to use it (cut and paste code) 
requestedurl: get-env "REQUEST_URI"
Arnold:
7-Sep-2012
And the next step get-env "SCRIPT_FILENAME" 
guess I will have to post the complete script when I finish it.
Arnold:
11-Sep-2012
Found some code/documentation about playing a sound (wav) on www.rebol.com/docs/sound.html 
 

but although rebol/view 2.7.8 (Win XP) has Sound 1.4.0 on board it 
seems using the sound:// port is reserved for use by the SDK version? 
** Access Error: Cannot open sound
** Where: halt-view
** Near: sound-port: open sound://
on MacOSX I get
** Access Error: Invalid port spec: sound://
** Where: halt-view
** Near: sound-port: open sound://

But that is less surprising since there is no Sound module available 
there.
So what is Sound (1.4.0) about?
BrianH:
13-Sep-2012
There was a plan to make device extensions, but Carl didn't know 
what API to use. He did a callout for advice, but that didn't get 
much response.
Gregg:
16-Sep-2012
Will this work?

    LPINT-def: [value [integer!]] none
    LPINT: make struct! LPINT-def none

    make-LPINT: does [make struct! LPINT-def none]

    get-dereferenced-data: func [

        {Given a pointer to memory, copy the target data into a REBOL struct.}
        pointer [struct!]   "LPINT structure"

        struct-def [block!] "Contains a sub-struct that is the real struct 
        you want."
        /local struct data orig-pointer result
    ] [

        struct: make struct! compose/deep/only [ ; make wrapper struct
            sub [struct! (struct-def)]
        ] none

        orig-pointer: third struct              ; store original inner pointer

        change third struct third pointer       ; change inner pointer to 
        ref'd data

        data: copy third struct/sub             ; copy data from the inner 
        struct
        ;print mold data

        change third struct orig-pointer        ; restore inner pointer

        result: make struct! struct-def none    ; make result struct

        change third result data                ; change data in result struct
        ;probe result
        struct: data: orig-pointer: none
        ;recycle
        result
    ]

It's from some old code, so no guarantees.
Gregg:
16-Sep-2012
Also, get-dereferenced-data maps the buffer into another REBOL struct. 
If you just want the binary data, you can adapt it not to do that.
Marco:
16-Sep-2012
ok it seems to work. it becomes:

 integer-address: get-address "hello" ; function courtesy of Anton 
 Rolls
	pointer: make-LPINT
	pointer/value: integer-address
	probe third get-dereferenced-data pointer [l1 [int] l2 [int]]
NickD:
23-Sep-2012
There has to be something Rebol is doing beyond a simple language 
api to get level of security purported by Carl. 
What kind of pipes does it use?
MarcS:
3-Oct-2012
that was originally _args_ but i switched it out so that you could 
get a more readable recur call (i.e., cheekily make use of 'with' 
so that it read better)
Gregg:
3-Oct-2012
Ah, no, I think I get it now.
Steeve:
3-Oct-2012
It's Rebol School group here. Why would your post be a pollution 
? I don't get it
Ladislav:
3-Oct-2012
OK, this is the long version:

tail-func: func [
    {

  Define a recursive user function with the supplied SPEC and BODY.
     	The function can use a special TAIL-CALL local function
     	to perform a tail-recursive function call.
    }
    [catch]


 spec [block!] {Help string (opt) followed by arg words (and opt type 
 and string)}
    body [block!] {The body block of the function}
    /local the-function tail-call context-word
] [
	; define a new 'tail-call local variable
	tail-call: use [tail-call] ['tail-call]
	
	; bind the given BODY to "know" the 'tail-call variable
	body: bind/copy body tail-call
	
	; find a local word in SPEC
	context-word: find spec word!
	if context-word [context-word: first context-word]
	
	; define the TAIL-CALL function
	set tail-call func spec compose [
		(
			either context-word [
				; set parameters to the new arguments
				compose [set parameters values? (context-word)]
			] [[]]
		)
		throw/name none 'tail-call
	]
	
	; define the function
	the-function: throw-on-error [
		func spec compose/deep [
			(either context-word [context-word] [[]])
			while [true] [
				catch/name [
					return do [(body)]
				] 'tail-call
			]
		]
	]
	
	if context-word [
		; get the function context
		context-word: bind? first second :the-function
		
		; replace the context word in the function body by NONE
		change second :the-function none

		; adjust the TAIL-CALL body
		; replace the 'parameters word

  change/only at second get tail-call 2 bind first context-word context-word
	]

    :the-function
]

values?: func ['word] [second bind? word]
Steeve:
3-Oct-2012
yeah I see that the purpose is to get ride of the block passing style 
of the arguments, but it looks not anymore as simple
Steeve:
5-Oct-2012
;Go back to recur as a function.
;Still recur can't be used as a parameter, local or a refinement.

;This implementation is much more clean (no shitty compose/deep) 
and still very short.

;The collision of words is avoided by the use of singleton functions 
#[function!]
;I'm confident with this one. It could be the last one -_-;


rfunc: func [[catch] spec [block!] body [block!] /local ctx args][
    ctx: bind? first second throw-on-error [
        ;* Temporary function created to retrieve parameters
        ;* and to get a new context for 'recur.
        ;* The context will remain alive (not GC'ed).
        func append copy spec /recur [recur]
    ]
    args: bind to-block form first ctx ctx
    ctx/recur: func spec reduce [

        quote #[function! ['word] [throw/name second bind? word 'recur]] 

        first args ;* may be 'recur if empty specs (still, it's ok)
    ]
    func spec reduce [
        quote #[function! [args body][

            while [true][set/any args catch/name [return do body] 'recur]
        ]] 
        head remove back tail args ;* remove 'recur
        bind/copy body ctx         ;* bound 'recur
    ]
]
Steeve:
5-Oct-2012
;Go back to recur as a function.
;Still recur can't be used as a parameter, local or a refinement.

;This implementation is much more clean (no shitty compose/deep) 
and still very short.

;The collision of words is avoided by the use of singleton functions 
#[function!]
;I'm confident with this one. It could be the last one -_-;


rfunc: func [[catch] spec [block!] body [block!] /local ctx args][
    ctx: bind? first second throw-on-error [
        ;* Temporary function created to retrieve parameters
        ;* and to get a new context for 'recur.
        ;* The context will remain alive (not GC'ed).
        func append copy spec /recur [recur]
    ]
    args: bind to-block form first ctx ctx
    ctx/recur: func spec reduce [

        quote #[function! ['word] [throw/name second bind? word 'recur]] 

        first args ;* may be 'recur if empty specs (still, it's ok)
    ]
    func spec reduce [
        quote #[function! [args body][

            while [true][set/any args catch/name [return do body] 'recur]
        ]] 
        head remove back tail args ;* remove 'recur
        bind/copy body ctx         ;* bound 'recur
    ]
]
Ladislav:
5-Oct-2012
Rebol [
    Title: "Catch"
    File: %catch.r
    Date: 5-Oct-2012/17:49:58+2:00
    Author: "Ladislav Mecir"
    Purpose: {
    	Catches local throw'
    	Ignores non-local throws
    }
]

; Error definition
system/error: make system/error [
	throw': make object! [
		code: system/error/throw/code + 50
		type: "throw' error"
    	not-caught: ["throw' not caught"]
    ]
]

catch': func [
    {Catches a throw' from a block and returns the value.}
    [throw]
    block [block!] "Block to evaluate"
    /local err disarmed
] [
	use [throw'] copy/deep compose/only [
		; "localize" 'throw' in the block
		block: (block)

		throw': func [[catch] value [any-type!]] [
			disarmed: disarm err: make error! [throw' not-caught]
			set/any in disarmed 'arg1 get/any 'value
			disarmed/arg2: 'throw'
			throw err
		]

		get/any either all [
			error? set/any 'err try block
			(
				disarmed: disarm err
				disarmed/type = 'throw'
			)
			disarmed/id = 'not-caught
			disarmed/arg2 =? 'throw'
		] [
			in disarmed 'arg1
		] [
			'err
		]
	]
]
Steeve:
5-Oct-2012
; Sorry Ladislav I've stolen your idea one should avoid catch/throw 
interferences

; As an extra (also your idea ?), f/recur and recur are now both 
allowed.

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    ctx: bind? take second fun: throw-on-error [
        func append copy spec /recur reduce ['recur body]
    ]
    insert second :fun reduce [

        quote #[function! [[throw] ctx args 'fun body /local ret][

            if :ctx/recur [ctx/recur: ctx throw/name second ctx 'recur]
            ctx/recur: :fun
            while [true][
                set/any 'ret catch/name [return do body] 'recur

                unless all [value? 'ret block? :ret same? ctx last ret][
                    throw/name get/any 'ret 'recur
                ]
                set/any args ret
            ]
        ]]

        ctx (bind head remove back tail to-block form first ctx ctx) :fun
    ]
    :fun
]
Steeve:
5-Oct-2012
; Ladislav I can't see if you posted new code (WTF Altme)

; So I've tried your idea one should avoid catch/throw interferences

; As an extra (also your idea ?), f/recur and recur are now both 
allowed.

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    ctx: bind? take second fun: throw-on-error [
        func append copy spec /recur reduce ['recur body]
    ]
    insert second :fun reduce [

        quote #[function! [[throw] ctx args 'fun body /local ret][

            if :ctx/recur [ctx/recur: ctx throw/name second ctx 'recur]
            ctx/recur: :fun
            while [true][
                set/any 'ret catch/name [return do body] 'recur

                unless all [value? 'ret block? :ret same? ctx last ret][
                    throw/name get/any 'ret 'recur
                ]
                set/any args ret
            ]
        ]]

        ctx (bind head remove back tail to-block form first ctx ctx) :fun
    ]
    :fun
]
Steeve:
5-Oct-2012
; Ladislav I can't see if you posted new code (WTF Altme)

; So I've tried your idea one should avoid catch/throw interferences

; As an extra (also your idea ?), f/recur and recur are now both 
allowed.

rfunc: func [[catch] spec [block!] body [block!] /local ctx fun][
    ctx: bind? take second fun: throw-on-error [
        func append copy spec /recur reduce ['recur body]
    ]
    insert second :fun reduce [

        quote #[function! [[throw] ctx args 'fun body /local ret][

            if :ctx/recur [ctx/recur: ctx throw/name second ctx 'recur]
            ctx/recur: :fun
            while [true][
                set/any 'ret catch/name [return do body] 'recur

                unless all [value? 'ret block? :ret same? ctx last ret][
                    throw/name get/any 'ret 'recur
                ]
                set/any args ret
            ]
        ]]

        ctx (bind head remove back tail to-block form first ctx ctx) :fun
    ]
    :fun
]
Steeve:
5-Oct-2012
This time it's really really my final version T_T
- Both f/recur and recur allowed
- Catch/throw interferences ok.

NB: The code would be simpler in R3 since several workarounds are 
used to correct misbehaviors of object related natives of R2.

Also the lack of the reflexive capability for a function to read 
its own context in a easy way is definitivly a huge miss.

(On can't create anonymous functions without analysing their specs 
first. What a pain)

One would need a reserved word holding the context (like SELF for 
objects).

These shortcomings are making the code too much obfuscated and huge 
for my taste.
I hope it will be corrected in R3..

rfunc: func [
    [catch] spec [block!] body [block!] 
    /local ctx args call-tail
][
    ctx: bind? first second throw-on-error [
        func spec: append copy spec /recur [recur]
    ]
    args: bind head remove back tail to-block form first ctx ctx
    call-tail: func ['word] compose/deep [
        set/any [(args)] second bind? word 
        throw/name (ctx) 'recur
    ]
    ctx/recur: func spec reduce [:call-tail 'recur]
    func spec reduce [
        quote #[function! [
            [throw] 'recur 'call-tail ctx args body /local ret
        ][
            if get/any recur [call-tail :recur]
            set recur get in ctx 'recur
            while [true][
                set/any 'ret catch/name [return do body] 'recur
                unless all [value? 'ret same? :ret ctx][
                    throw/name get/any 'ret 'recur
                ]
                set/any args second ctx
            ]
        ]]
        'recur :call-tail ctx args body
    ]
]
Arnold:
7-Oct-2012
That is a idea. The text to emphasize is the text that you get to 
read. Then it disappear and you have to type it yourself. It is a 
progam from a schoolprogram for young children. I want to replicate 
it and maybe add a little fun for my daughter thinks it is boring 
as it is now.
Sunanda:
7-Oct-2012
Does this get close?
   http://www.rebol.org/view-script.r?script=render-rich-text.r
Sujoy:
10-Oct-2012
so i copied the files over to a new directory, then when i try
>> do %uni-engine.r
>> uniserve/boot
...i get a bunch of errors saying cheyenne is not defined


using the old (0.99) sources on the softinnov website, i can use 
the starter.r script just fine. However, i set up a simple service 
and a module to process tasks, but get:

** Script Error: Cannot use path on none! value
** Where: process-task
** Near: if shared/pool-max > shared/pool-count [
    fork
    if verbose > 0 [log/info "launching new process"]
]
Group: !Syllable ... Syllable free operating system family [web-public]
Pekr:
29-Jun-2012
Well, without R3 core being compiled to droid, there's no chance 
to get R3 running there, no? So your tests involved pure AGG test, 
with no relation to REBOL?
Kaj:
1-Aug-2012
On the other hand, I've just spent the equivalent of a full work 
week just to get the legacy fonts in X that R2/View needs
AdrianS:
22-Sep-2012
I did choose that option when installing, but I can re-create the 
VM to try to fix a little hassle with the startup menu. What happens 
now is that on the default first option, 'Start Syllable', you get 
an error saying that the selected disk does not exist. Choosing the 
second option, 'Start Syllable (automatic boot drive search), finds 
the OS and boots. I'm not sure what went wron there - I tried to 
install grub to the MBR - basically, I pretty much accepted the defaults 
or suggestions when installing. I'll go through it again just to 
make sure that I didn't mess something up, though, since it doesn't 
take very long.
Kaj:
22-Sep-2012
Does it retain the VMware settings? The problem with loading images 
from other emulators is that you don't get the emulation settings, 
so it can break when for example it defaults to SATA instead of ATA
AdrianS:
22-Sep-2012
btw, are you interested in having 50 GB on box.net? I see they're 
asking me to invite friends to get this amount for free
101 / 102621[2] 345...99100101102103