• 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
r4wp4382
r3wp44224
total:48606

results window for this page: [start: 301 end: 400]

world-name: r4wp

Group: #Red ... Red language group [web-public]
Kaj:
12-Jul-2012
That should work, and be more secure
Rebolek:
13-Jul-2012
Just an update, I just tried latest Kaj's code on Ubuntu under VirtualBox 
and I get *** Runtime Error 9: float invalid operation
DocKimbel:
15-Jul-2012
For the ARM isse, I'm testing with an emulated ARMv5TEJL, and both 
Fibonacci and Mandelbrot perform correctly. I've added some questions 
to the ticket on the bugtracker.
Pekr:
18-Jul-2012
There's even some mention of the Amiga in the above article comments, 
and even Carl liked it, IIRC :-)
Rebolek:
18-Jul-2012
Well the timing is consistently more or less same and square-osc 
is always about 50% slover than sine-osc. I think that it's not caused 
by Windows timing.
DocKimbel:
18-Jul-2012
I had a quick look at the code paths of both generated `square-osc` 
and `sin-osc` functions, all seems fine. But I do concurr that the 
results are not intuitive. I guess that the relative performances 
in such case are just too hardware-dependent.
Rebolek:
22-Jul-2012
Ah, that's not the reason. It happens when the condition is FALSE 
and FALSE block ends with expession.So the above code works for x 
= 1.0
DocKimbel:
24-Jul-2012
For people wondering what I was working on these last couple of month, 
here's a screenshot of the customer app I'm finishing now: http://sidl.fr/tmp/generator01.png


It's a visual editor for trading strategies that emits MQL4 code 
for Metatrader-based solutions (FOREX trading). The tree is editable 
and redraws itself automatically (no need to drag all the nodes around 
manually). This app also relies on an intermediary DSL for serializing 
the strategy on disk or before compiling it to MQL4. Here's an extract 
from the corresponding dialect representation of the tree from screenshot: 

start on 1 
if 1 buy 5 take 10 stop 10 on-profit [
    buy 6 take 10 stop 10 on-profit [
        buy 10 take 10 stop 10 loop
    ]
] on-loss [
    sell 7 take 10 stop 10 on-profit [
        buy 4 take 10 stop 10 loop
    ]
] 


All is done in REBOL/View 2.7.6 (to avoid CALL bug in 2.7.8) and 
all the source code is 47KB (25KB for the custom styles and VID events 
callbacks).


I'm at 99% completion of that app, so I've resume the work on Red 
since a couple of days.
Pekr:
24-Jul-2012
Hopefully you got also refreshed, and got some new ideas for RED 
:-)
DocKimbel:
24-Jul-2012
Certainly! But I must admit that I have hesitated in the beginning 
between HTML5 and VID for the GUI.
DocKimbel:
24-Jul-2012
I chosed VID only because I knew I could do it faster than messing 
around with HTML/JS libs and intricacies. I was just a bit concerned 
about hitting some performance walls or native bugs I couldn't workaround. 
Fortunately, all went well.
Janko:
24-Jul-2012
I don't know. Please don't be bogged down by things like gui in Red 
too fast! You first have to make a langauge / a platform that others 
(we) can use and build upon and add libs when we need them. And for 
all the love to VID and like, my oppinion is still that usability 
matters the most and it's hard to beat usability (all the little 
conventions) with non-native GUI-s. Or big delevoloped libraries 
that emaulate them well enough (Qt, GTK, ...)
DocKimbel:
24-Jul-2012
I've pushed the enhanced get-word syntax support, so it's now possible 
to get a pointer on integer!, byte!, float! and float32! variables 
(without having to wrap them in a struct!). For example:

	s: declare int-ptr!
	a: 123
	s: :a
	print s/value		;-- will output 123


I will add the ARM backend support for that and update the documentation 
tonight.
Janko:
24-Jul-2012
OT: Did I see right on FB that you moved to Montenegro? If you are 
passing Slovenia at any time you could present Red at it's biggest 
CyberCenter / Hackerspace ... Kiberpipa (and/or Hekovnik) if you 
wisted to. basically if you do let me know (they don't operate in 
the summer though) http://www.kiberpipa.org/en/
Rebolek:
24-Jul-2012
see comment in #222 and also see #223 for another variant of this 
problem.
Arnold:
24-Jul-2012
Vid frees you from the browser and its limitations. If REBOL only 
had a HTML interface I would have dropped the language without further 
hesitation.
Kaj:
24-Jul-2012
You would have missed great batch and server programming :-)
MaxV:
25-Jul-2012
Ok, but Rebol is better than html5. You write your script and it 
works on MacOS, Windows, Linux, in a browser. "write once and use 
it every where" better than Java.
Henrik:
25-Jul-2012
We shouldn't forget the idea of ReBrowse, which is Carl's idea of 
a browser written in R3 and is mean to replace the Viewtop. It's 
true that it doesn't run inside other browsers or leverages HTML, 
but it will still be a great technology demonstration of what a webbrowser 
should be.
Pekr:
25-Jul-2012
yes, and it would be cool to run rebrowser in real browser. Remember 
- making a NS plugin is wrapping something like 20 function calls? 
Not a problem for C skilled coder. I am even willing to start a bounty 
for that :-) But - first things first - R3 has to have a future first, 
so waiting for Carl's next step ...
GrahamC:
25-Jul-2012
for most purposes HTML5 will be good enough for desktop applications. 
 And that's all it needs.
DocKimbel:
25-Jul-2012
But #213 and #192 are partially related.
DocKimbel:
26-Jul-2012
Issues #222 and #223 fixed.
Pekr:
26-Jul-2012
But in short - Red is going to be compiled language, and it will 
probably get some kind of JIT too, to allow interactive stuff like 
console. Red language compiles down to Red/System, which is kind 
of VM for it. In fact, it is REBOL-like low level wrapper to C, allowing 
some bindings. Red/System apps recently run even on ARM, eg I am 
able to run it on my HTC Sensation. But that's raw ARM Linux, no 
Android API linking yet ....
Rebolek:
27-Jul-2012
Thanks, I hope so too :) I will test it and see.
DocKimbel:
27-Jul-2012
I found the cause of this new FPU stack leaking (x87 stack has 7 
slots) and fixed it (it was a regression).
PeterWood:
27-Jul-2012
Rebolek: "Thanks, I hope so too :) I will test it and see." - it 
would be really helpful if you could use qutick-test.reds to wriite 
your tests. We could then add them to the Red/System test suite which 
would allow Nenad to discover regressions before he relaeses fixes.
Rebolek:
27-Jul-2012
Also I've run into some weird problems with float32!. I try to separate 
the code and write some simple examples.
Gerard:
27-Jul-2012
Hi Doc and everybody, since I'm studying the opportunity to create 
myself - in a loooong future - a test  version of Red/system running 
over the JVM - I asked myself, after reading some doc titled "Create 
ypour own programming language" by Marc-Andre Cournoyer, if in any 
case Doc had thought about this way of doing things for his future 
implementation of Red (not Red/system), as described by this excerpt 
from the doc itself under the section :  PROTOTYPE-BASED

Except for Javascript, no Prototype-based languages have reached 
widespread

popularity yet. This model is the easiest one to implement and also 
the most
flexible because everything is a clone of an object.

Ian Piumarta describes how to design an Open, Extensible Object Model 
that
allows the language’s users to modify its behavior at runtime.

Look at the appendix at the end of this book for a sample prototype-based

language: Appendix: Mio, a minimalist homoiconic language. For a 
follow-up about these concerns here is the URL related to the Extensible 
Object Model upon which the author has based his own Mio language, 
itself inspired by the IO language  -  http://piumarta.com/software/cola/objmodel2.pdf
Rebolek:
28-Jul-2012
I've put some (I think) useful functions to https://github.com/rebolek/user.reds

There are things like int-to-float and float-to-int conversion and 
some string support functions.
Rebolek:
28-Jul-2012
It's unfortunately integer! only, I need float! version, so maybe 
for next release I find something :) i'm most happy with float-to-int 
and int-to-float, I was really missing it from Red/System.
Gerard:
29-Jul-2012
Hi Doc, I didn't express correctly in my last post and you missed 
the point - I already know that Red will be prototype-based but the 
question is : will the object model implementation you'll use be 
flexible enough to permit you and/or the end-user  to easily extend 
  Red with other  new types, or change primitive functionality and 
semantics at some later time. The author of this article has done 
some studies and experiments about this fact and within his 16 pages, 
he explains how it could circumvent these possible limitations without 
sacrificing efficiency - even if I'm not advanced enough to take 
his word as truth per se. I thought it would be useful to you to 
see such writing before you committed to much material, based on 
your current architecture and internal implementation details - about 
which I don't know anything, I must confess. Sorry if this is more 
of an annoyance than a useful tip but I thought it could be useful 
as a reading to anyone interested in implementing some programming 
language - be it not fully Red related.
Rebolek:
31-Jul-2012
Doc, thank you for your swift response to my bug reports. There's 
clearly visible daily progress in Red/System and it's getting more 
and more usable every day. Red/System clearly shows advantages of 
open sourced language compared to closed source ones. I'm really 
happy with it and I look forward to next versions of Red/System.
Rebolek:
31-Jul-2012
BTW, yesterday I've encountered a strange bug that's very hard to 
separate. The bug is that EITHER will always execute FALSE block, 
even if the condition is TRUE (EITHER is in function and the function 
is in WHILE loop, but that's not enough to trigger the bug). When 
I try to separate the problem the bug is gone. When I leave the function 
as is and just remove all unrelated stuff, the bug is also gone. 
It happens only when I compile my whole project. When I have more 
time, I will once again try to separate the problem and when unsuccesful, 
I will post the project as is for you to check it.
DocKimbel:
31-Jul-2012
@Gerard: 


Red will allow to extend itself in several ways. New types could 
be added easily by defining a set of new action! functions associated 
with a new datatype!. Also, the language syntax and semantics themselves 
could be changed by using the internal compiler API (not sure I will 
implement that in the bootstrapped version to avoid compatibility 
issues with the final compiler version).
Jerry:
31-Jul-2012
I am also look forward to the first version of Red. And I am willing 
to rewrite my REBOL book into a Red Book.
Gerard:
1-Aug-2012
Keep up the good work Doc - we're ALL behind and with you  !
Rebolek:
2-Aug-2012
Doc, have a look at http://box.lebeda.ws/~rebolek/sintezar.zip

Compile file %sintezar.reds and see function ADSR in %env.reds. Even 
when I pass TRUE, EITHER always executes FALSE block. I tried to 
simplify it, but I wasn't succesfull, so it's bit bigger project 
than just few lines, sorry :)
DocKimbel:
3-Aug-2012
Rebolek: thanks, I've reproduced the issue and I'm searching for 
the cause.
Jerry:
5-Aug-2012
Doc, Not to rush you, just curious about the progress of Red and 
its Unicode support. Unicode is very important here in China. :-)
DocKimbel:
5-Aug-2012
Red: I'm still working on both the compiler and the minimal runtime 
required to run simple Red programs. I have only the very basic datatypes 
working for now, no objects (so no ports) yet. I not yet at the point 
where I can give an accurate ETA for the first alpha, but I hope 
to be able to provide that ETA in a week.


Red string! datatype will support Unicode (UTF-8 and UTF-16 encoding 
internally). I haven't implemented Unicode yet, so if some of you 
are willing to provide efficient code for supporting Unicode, that 
would greatly speedup Red progress. 

The following functions would be needed (coded in Red/System):

- UTF-8 <=> UTF-16 LE conversion routines

- (by order of importance) length?, compare (two strings), compare-case, 
pick, poke, at, find, find-case
- optinally: uppercase, lowercase, sort


All the above functions should be coded both for UTF-8 and UTF-16 
LE.
DocKimbel:
5-Aug-2012
Porting existing C code to Red/System is fine as long as:
- the C source code license allows it.
- the used C algorithms are fast and light on memory usage.
Arnold:
5-Aug-2012
Please take some time to give good thought about this kind of things 
and specifying in more detail what is needed, so other people get 
a chance to help out with doing a little programming for Red (/system). 
While not everybody is a topgun like yourself, there is a lot of 
legwork that could be taken out of your hands.
DocKimbel:
5-Aug-2012
In case, you wonder why Red needs both UTF formats, well, it's simple, 
 Windows and UNIX worlds use different encodings, so we need to support 
both. Red will use by default UTF-8 for string values, but on Windows 
platform, it will convert the string to UTF-16 on first call to an 
OS API, and will keep that encoding later on (and avoid the overhead 
of converting it each time). 


We might want to make the UTF-16 related code platform-depend and 
not include it for other platforms, but I think that some text processing 
algorithms might benefit from a fixed-size encoding, so for now, 
I'm for including both encoding for all targets.


It will be also possible for users to check and change the encoding 
of a Red string! value at runtime.
Arnold:
5-Aug-2012
This is exactly the point! If you look in the archives you will notice 
some remarks by Carl where he was disappointed in that others didnot 
pick up some tasks. Okay first of all REBOL being not open source 
it makes no sense helping documenting stuff but there is no chance 
to do this kind of thing if there is no info of what exactly is to 
be done, as an outsider you are always one step behind and if you 
invest precious time into some work only to discoved they already 
did this. This is not an invite to do anything.
Kaj:
5-Aug-2012
It's really nice, and puts Red/System definitively above C
DocKimbel:
5-Aug-2012
I could live without that feature for Red compiler, but it will help 
it be cleaner and easier to debug. Currently, I'm using prefixes 
to mark contexts for variables and function calls in Red compiler 
output code, I hope to be able to remove them and use contexts instead 
once I merge this new branch.
Kaj:
5-Aug-2012
We'll get two great languages for the price of one, and one is already 
here
Kaj:
11-Aug-2012
In Syllable, I repackage Red and Cheyenne in a package with a Unix-like 
structure, such as a separate subdirectory for the executable, but 
it gets cluttered because they find all their other files related 
to that executable. Actually, that's the way we want it to work for 
Syllable Desktop GUI applications, but for a console program that 
needs to be in the system path, you need the Unix structure with 
separate search paths for separate subdirectories
DocKimbel:
11-Aug-2012
first context has the highest priority

: the nearest nested WITH has the higher priority (implemented but 
not tested yet).


Also, when specifying a block of namespaces, the first one in the 
list has priority other the next one, and so on.
Steeve:
11-Aug-2012
the IN block! block! is a must have at least. It's a pain in the 
ass to have to rebind the same block several times.
Kaj, I also worked on VMs and it was a shame.
Steeve:
11-Aug-2012
is: func [
		[catch]
		{Current face inherits from a block!}
		spec [block!]
		/local locals old when init
	][
		either all [
			find spec set-word!	; locals founds
			not empty? exclude  ; new ones (not found in the current face)

    first locals: construct copy spec ; copy: because [construct] modifies 
    the block (R2 bug ?)
				first face
		][

   ; Would be simpler, faster and safer using R3 (objects can be expanded)
			; rebuild face with new locals 

   ; (make face spec : can't be used here because of the special bounding 
   rules)

   when: face/when					; prevent copy/deep of when and init blocks
			init: face/init
			face/when: face/init: none
			set locals none

   resolve* locals face			; initialize locals with current face (if 
   intersect)

   face: make old: face locals		; rebuild current face with new locals
			face/when: when
			face/init: init
			do-safe bind bind spec face self; run style constructor 

   bind bind init face self		; rebound current face constructor (which 
   is currently running)

   error? set old :bound-err		; prevent old object from being used anymore
			old: none
		][
			; no new locals

   do-safe bind bind spec face self		; just run style's constructor 
		]
		if error throw-exit
	]
DocKimbel:
11-Aug-2012
I haven't followed R3 contexts and binding evolutions, but as Red 
will use a slightly different model (more statical), I guess we'll 
come up with different solutions than with R2/R3.
BrianH:
11-Aug-2012
WITH makes more sense for Red. DO IN is inherently more dynamic and 
runtime, while WITH can be more static.
DocKimbel:
13-Aug-2012
I just need to upgrade Red/System specifications, improve the Red/System 
runtime with this new feature, and I'll be ready to merge this branch 
into master. I might also make a new global release (v0.2.6).
DocKimbel:
14-Aug-2012
If you need to pass a 64-bit integer as argument, currently you would 
need to split it in two integers and pass them instead. A struct 
is passed by reference, not by value (yet).
DocKimbel:
14-Aug-2012
If you need to make some 64-bit calculations as suggested by the 
description, it is more difficult to achieve, but not impossible. 
I think that Peter has coded some 64-bit addition and subtraction 
functions that operate on two 32-bit integers.
PeterWood:
14-Aug-2012
Actually, I wrote a small lib to perform the 64-bit arithmetic ... 
but I only needed subtract and divide.

it's at:

https://github.com/PeterWAWood/Red-System-Libs/tree/master/Int64
PeterWood:
14-Aug-2012
It wouldn't take long to add addition and multiplication if that 
would help.
DocKimbel:
15-Aug-2012
IF and others keywords: you surely don't want to mess up your code 
(and the compiler) by redefining them. For CONTEXT, you can't use 
it inside a function body to create a namespace (would need to test 
if this case is correctly caught and raise an error), so it's ok 
to allow it as local name, no possible ambiguity.
DocKimbel:
15-Aug-2012
#enum: nope, as #define, they are global. I wonder if it is worth 
(and possible) making them namespace-sensitive. 

Oldes (who implemented them), what do you think?
Kaj:
15-Aug-2012
I have a lot of #define's in the bindings that I'm now migrating 
to #enum's, and that would be left behind looking out of place once 
I move the bindings into contexts
Kaj:
16-Aug-2012
I've updated all my bindings to use enumerations now, and found some 
bugs in the process
DocKimbel:
16-Aug-2012
Yes, that would require to add a lot of new code to existing features 
and would take probably several days to code and debug regressions. 
If we could avoid it, that would be nice.
Kaj:
16-Aug-2012
Aliases are special because they work at the symbol table level, 
allowing them to be used for refinements and dialect words as well.
Kaj:
16-Aug-2012
So it would be the only way to translate refinements and such
Kaj:
16-Aug-2012
Now that non-English languages are up-and-coming in programming, 
it could solve the fragmentation of the available code pool, if you 
would implement an extra feature that would allow code to be saved 
and loaded with an ordered list of preferred alias languages
ACook:
16-Aug-2012
Just write a parser that calls Google Translate and does in place 
substitution.
ACook:
16-Aug-2012
I actually had to do something like that once, a configuration file 
contained a bunch of strings in english and they needed them in spanish 
but weren't willing to actually get someone to translate them. So.. 
I used Google Translate.
ACook:
16-Aug-2012
And that was maybe 5 years ago, so I'm sure Google Translate is better 
than it was. A context free dictionary conversion from one word to 
another in a different language would probably not give the desired 
result.
Kaj:
16-Aug-2012
Our crown prince got himself in trouble at a speech in Mexico, for 
the only reason that our crown princess, and probably by extension 
his translators, are Argentinian and a certain Spanish word meant 
something else in Mexico than it does in Argentina :-)
Kaj:
16-Aug-2012
Hm, there are several words that change to embarassing between English 
and Dutch
ACook:
16-Aug-2012
Afrikaans is an offshoot of Dutch and they seem to have incorporated 
a lot of interesting slang.
Kaj:
16-Aug-2012
Yes, there are also such cases between Dutch and German :-)
ACook:
16-Aug-2012
Question about Red, as I understand it, the Parser and Compiler are 
written in REBOL, but the Runtime is written in Red?
Kaj:
16-Aug-2012
The parser and compiler will be rewritten in Red once it's ready
ACook:
16-Aug-2012
And Red/System is a subset/simplification of Red?
Group: Rebol School ... REBOL School [web-public]
Marco:
4-Mar-2012
Is there a way to wait for a period of time asyncronously?

I mean that I do same action and then I want start a timer, i do 
something else and when period expires i will wake up.
Gregg:
6-Mar-2012
Gabriele (and DOc?) wrote a timer module for R2.
Marco:
10-Mar-2012
Very nice the scheduler, but I have not understand if it blocks program 
activity while waiting and if no why. I have solved my problem by 
using a View timer (face/rate: 0:0:1) since that does not block program 
activity.
caelum:
23-Mar-2012
Question: I open a port using rebol2 on my server. It is started 
by cron once every 24 hours and is programmed to shut down after 
1 hour. I need to check if the port is still open and listening or 
has completed and the program has closed. How do I test to see if 
the port is still open from another rebol2 program running on the 
same server?
Maxim:
23-Mar-2012
you can also have the first app open up a second port and give it 
a very simple interface to reply to "are you done?" type messages.
Rondon:
27-Mar-2012
Hi guys, anyone have a library in Rebol to get Amazon Records passing 
a keyword and sorted by daterank?
caelum:
16-Apr-2012
I have the SDK (full encryption strength) and I've been playing with 
the rijndael encryption algorithm. I cut and pasted the code below 
from http://www.rebol.com/how-to/encrypt.htmland it produces 256 
as the port strength despite the strength being stated as 512. Is 
it 256 or 512? The web page says Rebol can provide 512 with rijndael. 
Can it?

port: open [
    scheme: 'crypt
    direction: 'encrypt
    key: akey
    strength: 512
    algorithm: 'rijndael
    padding: true
]
print port/strength


When I switch the algorithm to blowfish I get the expected 512 port 
strength. Is blowfish actually 512?

I need to know what level of encryption I am working with. TIA.
caelum:
16-Apr-2012
That makes sense. The strength: 512 in the code misled me to believe 
it should be possible.


The blowfish algorithm works fine, but I presume it actually uses 
a key of 448 bits and not 512. https://en.wikipedia.org/wiki/Blowfish_%28cipher%29. 
In which case the value returned by the print port/strength is deceptively 
wrong when I test it with blowfish? Or am I missing something?
Sujoy:
21-Apr-2012
online! was looking for something light and fast (in dev terms)
Sujoy:
21-Apr-2012
nope. i corrected that and still the same error.


i have data stored in json. i use json.r to convert to rebol objects. 
i want to create a query layer on top of this - which is why the 
expression builder...
the fact1 is an attr of the data object. these can be nested.
how best can i build the expression to retrieve the value i want?
Steeve:
21-Apr-2012
and fact1 must be initialized accodingly.
Either with 'a either with 'a/a
caelum:
22-Apr-2012
Is it possible to change the background color of the view led? Or 
are the only states available 'true' and 'false' which are green 
and red? I want different background colors for 'true' and 'false' 
states.

view center-face layout [
	across
	l1: led
	label "State" state: field

	btn "Change led state" [
		either l1/data [
			l1/data: false
			state/text: "False"
		][
			l1/data: true
			l1/data: true
			state/text: "True"
		]
		show [l1 state]
	]
]
Gregg:
22-Apr-2012
As Steeve has pointed out "it can be done" is *almost* always the 
answer with REBOL, and usually done in many ways. REBOL is great 
for practical use, as well as learning to think about problems in 
new ways.
Gregg:
24-Apr-2012
He's one of us now Endo. Next thing, he'll b3 wondering why every 
other programming language has only 6 or 8 datatypes and why they 
don't have a PARSE function. :-)
GrahamC:
24-Apr-2012
has anyone written parse rules for phone numbers?   I need to setup 
a set of rules for international numbers, local numbers, cell numbers, 
1800 etc for use in asterisk and prevent users from making toll calls 
unless authorise
GrahamC:
24-Apr-2012
I guess i should just make a rule for each type of call and then 
combine them.
Gregg:
24-Apr-2012
And a formatter that goes the other way:
GrahamC:
24-Apr-2012
These rules are going into a cgi script to allow local and national 
dialiing (and emergency) but stop international
Gregg:
24-Apr-2012
Ah, there you go. Validate against your local and national rules 
and fail everything else.
Gregg:
24-Apr-2012
parse-int-values: func [

    "Parses and returns integer values, each <n> chars long in a string."
    input [any-string!]

    spec [block!] "Dialected block of commands: <n>, skip <n>, done, 
    char, or string"
    /local
        gen'd-rules ; generated rules
        result      ; what we return to the caller

        emit emit-data-rule emit-skip-rule emit-literal-rule emit-data
        digit= n= literal=
        int-rule= skip-rule= literal-rule= done= build-rule=
        data-rule skip-rule
][

    ; This is where we put the rules we build; our gernated parse rules.
    gen'd-rules: copy []
    ; This is where we put the integer results
    result: copy []

    ; helper functions

    emit: func [rule n] [append gen'd-rules replace copy rule 'n n]
    emit-data-rule: func [n] [emit data-rule n]
    emit-skip-rule: func [n] [emit skip-rule n]
    emit-literal-rule: func [value] [append gen'd-rules value]
    emit-data: does [append result to integer! =chars]

    ; Rule templates; used to generate rules

    ;data-rule: [copy =chars n digit= (append result to integer! =chars)]
    data-rule: [copy =chars n digit= (emit-data)]
    skip-rule: [n skip]

    ; helper parse rules
	digit=: charset [#"0" - #"9"]
    n=: [set n integer!]
    literal=: [set lit-val [char! | any-string!]]

    ; Rule generation helper parse rules
    int-rule=: [n= (emit-data-rule n)]
    skip-rule=: ['skip n= (emit-skip-rule n)]
    literal-rule=: [literal= (emit-literal-rule lit-val)]
    done=: ['done (append gen'd-rules [to end])]

    ; This generates the parse rules used against the input

    build-rule=: [some [skip-rule= | int-rule= | literal-rule=] opt done=]


    ; We parse the spec they give us, and use that to generate the

    ; parse rules used against the actual input. If the spec parse

    ; fails, we return none (maybe we should throw an error though);

    ; if the data parse fails, we return false; otherwise they get
    ; back a block of integers. Have to decide what to do if they
    ; give us negative numbers as well.
    either parse spec build-rule= [
        either parse input gen'd-rules [result] [false]
    ] [none]
]
GrahamC:
24-Apr-2012
zero: charset [ #"0" ]
digit: charset [ #"0" - #"9" ]
digits: [ some digit ]
local-number: charset [ #"3" #"4" #"6" #"9" ]
not01-number: charset [ #"2" - #"9" ]

national-rule: [ zero local-number not01-number digits]
local-rule: [ not01-number digits ]
emergency-rule: [ "111" ]

; toll free numbers are 0800 and 0508
toll-free: [ zero [ "800" | "508" ] digits ]

; directory assistance 018, 0172,
directory-assistance: [ "01" [ "8" | "72" ]]
 
; faults 120, 125 and business 126
faults: [ "12" [ "0" | "5" | "6" ]]

; cellular are 021, 022, 027, 028, 029
cellular-rule: [ "02" digits ]

; international 00 - country code - number
international-rule: [[ "00" | "+" ] digits ]

allowed-phone-rule: [
	local-rule |
	national-rule |
	emergency-rule |
	toll-free |
	directory-assistance |
	faults |
	cellular-rule
]

all-phone-rule: [ allowed-phone-rule | international-rule ]
Endo:
25-Apr-2012
Also check E164 formatting:
http://en.wikipedia.org/wiki/E.164
and
http://www.wtng.info/wtng-tt.html
Endo:
26-Apr-2012
And for the oposite:
Date2Int: func [d /local c][
    c: 1-Jan-1970/0:00
    d - c * 86400 + to-integer d/time - c/time
]
301 / 48606123[4] 56...483484485486487