[REBOL] Philosophising

2000-02-15 Thread Al . Bri

I'm philosophising about directions REBOL could take. I've been working on a
C based editor/IDE for REBOL (just Ctrl+R, your script is saved and REBOL is
run on the script), and I've also downloaded two varieties of SmallTalk and
had a little play with both.
So what do C and SmallTalk have to do with REBOL? Well, at least one of
the SmallTalks had been self-extended by having (as I understand it) a
SmallTalk to C translator. With this, development for a new interface (for
example, reading, playing and writing midi or other media files) is done in
the SmallTalk environment, then when the code works correctly, C code is
generated and compiler, then included into the SmallTalk 'image'.
With the aid of REBOL/Command (when it comes out), a malleable REBOL
environment with _native_ look and feel (or with a default look and feel),
could be developed. With a simplistic REBOL to C or machine code translator
(one that operates on script that isn't self modifying), a fast, intuitive,
easily enhanced environment could be created. This could lead to, as with
SmallTalk, a environment or even operating system, based entirely on REBOL.

pekr and others, what do you think?

Andrew Martin
REBOLution the OS...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



[REBOL] Philosophising Re:

2000-02-15 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

 I'm philosophising about directions REBOL could take. I've been working on a
 C based editor/IDE for REBOL (just Ctrl+R, your script is saved and REBOL is
 run on the script), and I've also downloaded two varieties of SmallTalk and
 had a little play with both.
 So what do C and SmallTalk have to do with REBOL? Well, at least one of
 the SmallTalks had been self-extended by having (as I understand it) a
 SmallTalk to C translator. With this, development for a new interface (for
 example, reading, playing and writing midi or other media files) is done in
 the SmallTalk environment, then when the code works correctly, C code is
 generated and compiler, then included into the SmallTalk 'image'.
 With the aid of REBOL/Command (when it comes out), a malleable REBOL
 environment with _native_ look and feel (or with a default look and feel),
 could be developed. With a simplistic REBOL to C or machine code translator
 (one that operates on script that isn't self modifying), a fast, intuitive,
 easily enhanced environment could be created. This could lead to, as with
 SmallTalk, a environment or even operating system, based entirely on REBOL.

 pekr and others, what do you think?

Well, first - why me? :-) I am not familiar with low level stuff as language
compilers, etc.

Second - I am not sure I feel like to express my thoughts, visions and requests
for improvements, as such simple message asking about status of Rebol Netware
version generated email sent to me, expressing I want too much from Rebol Tech
and that I should be glad with what I get.

I am sad now, as Rebol (together with TaoAmiga and QNX Neutrino) are
technologies I want to follow, definitely. So, is it the right time now to ask
such questions? I am not sure RT folks will not feel offended by constant
requests of change this, do that, etc. stuff.  I felt the same during the long
discussion about what should be released first - Command or View.

Hell, I am not only programmer (although not so good), but also a press person.
I am used to ask questions. We've developed system for sales department here.
Folks didn't want to implement abstraction on the level I was thinking about.
Things are showing now from time to time. Just look at W9x line - you can still
feel W3.1 philosophy there. And why? Because of bad W3.1 design.

So, the reason I am asking "too much" sometimes is because I feel there is still
enough time to change things, if it would make sense to do some changes.
Remember - once millions will use Rebol, it's too late for some possible design
changes. That's also the reason why one of my first reactions on View was - why
this works this way, why this is not possible, etc. There are others to say
"hey, it's great product". Does it mean I don't think Rebol is great? Absolutly
not. If so, I wouldn't be here anymore.

So now to your vision, Andrew. Can we make it without RT support? Rebol doesn't
offer any plug-in, modules, whatever mechanisms YET. I think we will have to
wait for /Command release to see, what RT thinks about the direction you
suggested. I know interpreted Matlab for e.g. allows generation of C code too
...

IIRC, REBOL/Author was one of planned REBOL products. During 1.x times, Jrm
tried to implement Rebol compiler (or Rebol compatible language?) called
Scherman. Official words of Carl (not related to Scherman) were something like
it would be possible to partially compile some set of expressions, or something
like that. I don't know it is still planned or essential for RT. Similar
discussions were held here already.

I feel one and only REBOL.exe and /View, /Draw, and others in the form of
loadable, unloadable modules is essential, as it could prevent us from dealing
with two (or more?) different versions of Core. My friends which are in web
development feel that Apache modul has to get database support, or it will fail.
Some of us would like to prevent the code to be seen by others, from whatever
reasons. Runtime Rebol? Embeddable rebol? Script compilation and obj generation?
You and others would like to see C code generated.

Where is the answer? What to do first? What to do at all? :-)

However, I would be really glad, if everyone could express his oppinion without
the fear of negative reactions 

Best wishes,

-pekr-



 Andrew Martin
 REBOLution the OS...
 ICQ: 26227169
 http://members.xoom.com/AndrewMartin/
 --



[REBOL] Philosophising Re:(2)

2000-02-15 Thread Al . Bri

Hi, pekr!
You wrote:
 Well, first - why me? :-) I am not familiar with low level stuff as
language compilers, etc.

Why not? I wanted to get people's opinion on the end result. :-)

 So now to your vision, Andrew. Can we make it without RT support? Rebol
doesn't offer any plug-in, modules, whatever mechanisms YET. I think we will
have to wait for /Command release to see, what RT thinks about the direction
you suggested. I know interpreted Matlab for e.g. allows generation of C
code too ...

It could be done now with using Karl's C++ port that talks to REBOL.
Unfortunately, I can't untar/unzip his archive. :-(

 IIRC, REBOL/Author was one of planned REBOL products. During 1.x times,
Jrm tried to implement Rebol compiler (or Rebol compatible language?) called
Scherman. Official words of Carl (not related to Scherman) were something
like it would be possible to partially compile some set of expressions, or
something like that. I don't know it is still planned or essential for RT.
Similar discussions were held here already.

I've passed by the Sherman site a while back. It looked liked development
had stopped.

 I feel one and only REBOL.exe and /View, /Draw, and others in the form of
loadable, unloadable modules is essential, as it could prevent us from
dealing with two (or more?) different versions of Core. My friends which are
in web development feel that Apache module has to get database support, or
it will fail. Some of us would like to prevent the code to be seen by
others, from whatever reasons. Runtime Rebol? Embeddable rebol? Script
compilation and obj generation? You and others would like to see C code
generated.

 Where is the answer? What to do first? What to do at all? :-)

 However, I would be really glad, if everyone could express his opinion
without the fear of negative reactions 

Me, too.

As for REBOL and REBOL/View, if they were separate modules, what would they
be good for? It's a rhetorical question. More on Ally list, as it discusses
View more deeply.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



[REBOL] [REBOL] Prime number generator Re:(2)

2000-02-15 Thread rebol

thanks, [EMAIL PROTECTED], that is what I was trying to achieve. 
"change" sure does the trick. However, it is interesting that REBOL let you 
do this:
  blk: [["A" "B" "C"] ["D" "E" "F"]]
== [["A" "B" "C"] ["D" "E" "F"]]
 blk/1/1: "X"
== ["X" "B" "C"]
but not this:
 i: 1
== 1
 blk/:i/:i: "Y"
** Syntax Error: Invalid word -- :i:.
** Where: (line 1) blk/:i/:i: "Y"
 [blk/:i/:i]: "Y"
** Syntax Error: Invalid word-get -- :.
** Where: (line 1) [blk/:i/:i]: "Y"
all I am trying to do is substitute the "value" 1 with :i both are 
equivalent, are they not? IMHO expressions like these should be evaluatable 
as they are so convenient to construct and I can think of lots of other 
advantages for this type of syntax.

Nitish
[EMAIL PROTECTED]
http://www.loka.net/
PS: Sorry, folks - for sending my first message out twice..I am 
learning...:)

-Original Message-
From:  [EMAIL PROTECTED]  [SMTP:[EMAIL PROTECTED]]
Sent:   Tuesday, 15 February 2000 20:32
To: [EMAIL PROTECTED]
Subject:[REBOL] [REBOL] Prime number generator Re:



[EMAIL PROTECTED] wrote:

  I have one question, though (several actually, but this one will do for
 now, I think :)
 [flags/:mult: 0  gives this error
 ** Syntax Error: Invalid word -- :mult:.
 ** Where: (line 45) flags/:mult: 0 ;-- this does not work. why? NV 
6/2/2000
 This stumped me. Earlier I had declared [mult: make integer! 1] Surely, 
it
 is in scope.


REBOL doesn't support this kind of syntax:

- i: 1
== 1
 j: 2
== 2
- blk: [["A" "B" "C"] ["D" "E" "F"]]
== [["A" "B" "C"] ["D" "E" "F"]]
- blk/:i
== ["A" "B" "C"]
- blk/:i/:j
== "B"
- blk/:i/:j: "Q"
** Syntax Error: Invalid word -- :j:.
** Where: (line 1) blk/:i/:j: "Q"

- change blk/:i/:j "Q"
== ""
- blk
== [["A" "Q" "C"] ["D" "E" "F"]]
-

Is that what you wanted to achieve?

-pekr-

 Nitish.
 [EMAIL PROTECTED]
 http://www.loka.net/

begin 600 WINMAIL.DAT
M)\^(A(*`0:0" `$```!``$``00!@`(Y 0```#H``$(@ `
M ```$E032Y-:6-R;W-O9G0@36%I;"Y.;W1E`#$(`0V ! `"`@`"``$$
MD 8`= $```$0`P``, (+``\.``(!_P\!.P``
M``"!*Q^DOJ,09UN`-T!#U0"`QIW1 F5B;VPN8V]M`%--5% `;ES
M=$!R96)O;"YC;VT``!X``C !!0```%--5% `'@`#, $/
M;ES=$!R96)O;"YC;VT```,`%0P!`P#^#P8``$P`0```!$G
M;ES=$!R96)O;"YC;VTG``(!"S !% ```%--5% Z3$E35$!214)/
M3"Y#3TT``P``.0`+`$ Z`0```!X`]E\!#P```QIW1 F5B;VPN
M8V]M```"`?=?`0```#L`@2L?I+ZC$!F=;@#=`0]4`@!L:7-T
M0')E8F]L+F-O;0!33510`QIW1 F5B;VPN8V]M```#`/U?`0,`_U\`
M`@'V#P$$`IE`02 `0`O4D4Z(%M214)/3%T@6U)%
M0D],72!0FEM92!N=6UB97(@9V5N97)A=]R(%)E.@`G#P$%@ ,`#@```- '
M`@`/`!`) `Q``(`5@$!(( #``X```#0!P(`#P`7`" ``0`"`"(!`0F `0`A
M.$$Y-3DP.48T04$Y,34T,4$U,S Q.#4S-#5!1$(U-#$`_08!`Y `/P(
M```A"P`"``$+`",```,`)@``"P`I```#`"X`
M``,`-@``0 `Y`."BKI"@=[\!'@!P``$O4D4Z(%M214)/3%T@
M6U)%0D],72!0FEM92!N=6UB97(@9V5N97)A=]R(%)E.@```@%Q``$6
M`;]WH)!)[/G/W!IZ2*.)+]/8MCJ7]0``'@`# $%4TU44 ``
M!\,`0\```!R96)O;$!L;VMA+FYE= ```P`$!0:C,P#``0?P4`
M`!X`"! !90```%1(04Y+4RQ015122U)%3EI%3$]+0%126D-:+%1(051)
M4U=(051)5T%35%)924Y'5$]!0TA)159%(D-(04Y'12)355)%1$]%4U1(1512
M24-+2$]7159%4BQ)5$E324Y415)%4U0``@$)$ $```#-!0``R04``(\*
M``!,6D9U-9Y'E@,`"@!R8W!G,3(U1C(`^ M@;FU#B YG0'W( *D`^,"`-H
M"L#@V5T," '$P*#`%#A$'9PG$R$7D.4!)*F1#??7T*@ C((#L);\T.,#4"
M@ J!=6,`4 L#AF,`00\",3 S,PNFA"!T$0!N:W,L`S"', "T1(B,38@4!% 
MB'(N2PEP;GIE"0"$:T ;@'HN8WH:*:$05 ! `@=QSB21U 5F$$(!N 0N 
M9QH`;PH@`-!H")!V92X@AB(0\0\@92(@PAP\4@9\'D1H0'_ ;@$4-XL?
M$$AO=Q[AFT:D=`PN = 20!Y!T`QXS'.)214)/3"#R;!% ('D(8" !@$$
M`(8Z"J(*@#X^(" "8(!K.B!;6R)!'Z!$(D(EH4,B7250(JI$):%%):%)B!=
M)'0\/3TE7R9O)+,E$2\QXRI0)4 B6"(G."JQ*!?))'1B=05 ;F\%0"0L/FDE
M0!A3)W,N-2GU.FE++Z$JD5DJU2HJ!@!Y00(P87@@17(#8'*1)4!);G8'0ED
M'4"C!; R("TM("_A+C!7KE@ EP)4 H,@!N'_"L,2DO;R256S2773 /^S$?
M,B0M'X %0#*2,O\T!Y\V#R2#!T #(!V@86T=^=C\1TA'\!B(F%T++ @@=T@
M2(QX0I0'Z Q'4 AH'YH,K$E`"SP0! *P!_P9=AQ=6DQX0GP=!IP0+(5(%Y
M+-(_'9!-2$_]0.!X$L 'D "0`B $(#(`KFL^XQ$P'[!H"!L,B#^8D#1/U(
M\ @(W D"!#^T(@0+)S'H %H#'0"? (D.\",!YB1J$B8'(8, 5 `' [,B =
MH,#D20AD @;_YF(V L\ 0@22% 020'I#^9#'@-[$?@ 0@`A %P"0BV1H`
M7 ?\$DASC.7M)'1.(: $`@D= ,`34+20!P182XT,'1,91C""42 (@"
M0' Z+R_J=U @+DY6+QJ31( !0.DD@U!3)4!3!; $!IP_P(0)2 $(#*@2N(1
M,$@P'C)R;4(@9FD1( 5 !X%S5TJ121 LL70#\,?`"X_/0,C K `P`/(%5@
M+CH^*4[9"[9,=PLP,@`S-O\!0!JB$L L\ 603L :YC*0]5HA3P409PN !T %
MT%1D/UHC399-%%C"S%9-FDM#$T- % ,@`Q.##'`4 ,T%W#8B!`V$D8/T,
MDF)9!Q%@H(`4 PR$Z/W$#,%^Q:6!4L\;W KA`UDT)/!;4TU44#I_8O\
MBE7N$8 (P7U8@(E0*4'-D85)1,37Y7P!E8D?0"L!"( '07E"9:5$Z,PY0
M9L94;V'^S(`(F! "7 X1R `W!FN.T^8I986'6R,3*)%MQY0!1 '@"S0
M=0;02@$?@.TT,'(\ 6Q4C/06\]VO]8A \5T],EVN33D=0%DR_W!')),D
M\!V@$0`\$D0-#%?00`B4@(@'+((8= $"C_$3 A45K1`- ^L#S!4E$LHO]+
M(W=2`_ \T2/Q2N%V5BS@?G:!V@2,16AC7A#O%GVG,TPU$@=P(!16J#_
M'O @0ATA!) X(796-V\QS\]]PSG%?[,SFS0U-'!]7?X[,I%+(R 3+.(R02#A
M'5 "4)P3E8@-B\R]X0:7%V5E1+,B)@;R!+D/R(  'Q!%"L R`$H!=N+_
M,B %@0M@"7$GL'W$`,!#P?,B`A^ B$N("B0;+ )/]YDB@=E8ATQ^P!:!+
MD()9TQJ(Q0@$FXG!4 ?P'#V D12Q1K"X R($O'=OV+2W?)'=J)4!I]21

[REBOL] [REBOL] Prime number generator Re:(2)

2000-02-15 Thread rebol


thanks, [EMAIL PROTECTED], that is what I was trying to achieve. 
"change" sure does the trick. However, it is interesting that REBOL let you 
do this:
  blk: [["A" "B" "C"] ["D" "E" "F"]]
== [["A" "B" "C"] ["D" "E" "F"]]
 blk/1/1: "X"
== ["X" "B" "C"]
but not this:
 i: 1
== 1
 blk/:i/:i: "Y"
** Syntax Error: Invalid word -- :i:.
** Where: (line 1) blk/:i/:i: "Y"
 [blk/:i/:i]: "Y"
** Syntax Error: Invalid word-get -- :.
** Where: (line 1) [blk/:i/:i]: "Y"
all I am trying to do is substitute the "value" 1 with :i both are 
equivalent, are they not? IMHO expressions like these should be evaluatable 
as they are so convenient to construct and I can think of lots of other 
advantages for this type of syntax.

Nitish
[EMAIL PROTECTED]
http://www.loka.net/
PS: Sorry, folks - for sending my first message out twice..I am 
learning...:)

-Original Message-
From:  [EMAIL PROTECTED]  [SMTP:[EMAIL PROTECTED]]
Sent:   Tuesday, 15 February 2000 20:32
To: [EMAIL PROTECTED]
Subject:[REBOL] [REBOL] Prime number generator Re:



[EMAIL PROTECTED] wrote:

  I have one question, though (several actually, but this one will do for
 now, I think :)
 [flags/:mult: 0  gives this error
 ** Syntax Error: Invalid word -- :mult:.
 ** Where: (line 45) flags/:mult: 0 ;-- this does not work. why? NV 
6/2/2000
 This stumped me. Earlier I had declared [mult: make integer! 1] Surely, 
it
 is in scope.


REBOL doesn't support this kind of syntax:

- i: 1
== 1
 j: 2
== 2
- blk: [["A" "B" "C"] ["D" "E" "F"]]
== [["A" "B" "C"] ["D" "E" "F"]]
- blk/:i
== ["A" "B" "C"]
- blk/:i/:j
== "B"
- blk/:i/:j: "Q"
** Syntax Error: Invalid word -- :j:.
** Where: (line 1) blk/:i/:j: "Q"

- change blk/:i/:j "Q"
== ""
- blk
== [["A" "Q" "C"] ["D" "E" "F"]]
-

Is that what you wanted to achieve?

-pekr-

 Nitish.
 [EMAIL PROTECTED]
 http://www.loka.net/



[REBOL] [REBOL] Prime number generator Re:(3)

2000-02-15 Thread Al . Bri

Nitish. wrote:
 all I am trying to do is substitute the "value" 1 with :i both are
equivalent, are they not? IMHO expressions like these should be evaluatable
as they are so convenient to construct and I can think of lots of other
advantages for this type of syntax.

It's coming in the next version of REBOL, according to REBOL crew. This was
discussed earlier on, on this list. New version of core will allow this:
blk/:i/:i: "Y"

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



[REBOL] [REBOL] Prime number generator Re:(3)

2000-02-15 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

 thanks, [EMAIL PROTECTED], that is what I was trying to achieve.
 "change" sure does the trick. However, it is interesting that REBOL let you
 do this:
   blk: [["A" "B" "C"] ["D" "E" "F"]]
 == [["A" "B" "C"] ["D" "E" "F"]]
  blk/1/1: "X"
 == ["X" "B" "C"]
 but not this:
  i: 1
 == 1
  blk/:i/:i: "Y"
 ** Syntax Error: Invalid word -- :i:.
 ** Where: (line 1) blk/:i/:i: "Y"
  [blk/:i/:i]: "Y"
 ** Syntax Error: Invalid word-get -- :.
 ** Where: (line 1) [blk/:i/:i]: "Y"
 all I am trying to do is substitute the "value" 1 with :i both are
 equivalent, are they not? IMHO expressions like these should be evaluatable
 as they are so convenient to construct and I can think of lots of other
 advantages for this type of syntax.

Well, this discussion was held on beta ml before 2.x came out. I don't remember
exactly, what were all the pros and cons. But yes, it seems logical to have
blk/:i/:j: value available, as it works for blk/1/2: value.

Maybe Elan or Ladislav could say more here, as I feel they are good at
explaining similiar stuff ... :-)

-pekr-


 Nitish
 [EMAIL PROTECTED]
 http://www.loka.net/
 PS: Sorry, folks - for sending my first message out twice..I am
 learning...:)

 -Original Message-
 From:  [EMAIL PROTECTED]  [SMTP:[EMAIL PROTECTED]]
 Sent:   Tuesday, 15 February 2000 20:32
 To: [EMAIL PROTECTED]
 Subject:[REBOL] [REBOL] Prime number generator Re:

 [EMAIL PROTECTED] wrote:

   I have one question, though (several actually, but this one will do for
  now, I think :)
  [flags/:mult: 0  gives this error
  ** Syntax Error: Invalid word -- :mult:.
  ** Where: (line 45) flags/:mult: 0 ;-- this does not work. why? NV
 6/2/2000
  This stumped me. Earlier I had declared [mult: make integer! 1] Surely,
 it
  is in scope.
 

 REBOL doesn't support this kind of syntax:

 - i: 1
 == 1
  j: 2
 == 2
 - blk: [["A" "B" "C"] ["D" "E" "F"]]
 == [["A" "B" "C"] ["D" "E" "F"]]
 - blk/:i
 == ["A" "B" "C"]
 - blk/:i/:j
 == "B"
 - blk/:i/:j: "Q"
 ** Syntax Error: Invalid word -- :j:.
 ** Where: (line 1) blk/:i/:j: "Q"

 - change blk/:i/:j "Q"
 == ""
 - blk
 == [["A" "Q" "C"] ["D" "E" "F"]]
 -

 Is that what you wanted to achieve?

 -pekr-

  Nitish.
  [EMAIL PROTECTED]
  http://www.loka.net/



[REBOL] Running from batch file? Re:(2)

2000-02-15 Thread bpaddock


 How do you start rebol  program from batch file?
start /w rebol -sq kurzy-seznam.r

Using the 'start' made it do what I expected it to do.

Nothing else did; I tried all of the suggestions that others
had made here.  Rebol is in my path, I have its home environment
variable set to it.  Both my home machine and my machine at
work acted the same way.

Didn't matter if I was in the C:\Rebol directory or out side
of it when I moved/ran my batch file.

With solution in hand its on to the next problem, even tho I
still don't understand the cause of this one.

The wonder of windoze,  I wonder why it did that



[REBOL] EOF? Help please

2000-02-15 Thread Tiana . Zhang

Hello, 

I have a question about the file reading in REBOL. Does Rebol has sth like EOF
(end of file) function? 

I wrote a script which read through a directory and does sth on each file.
I use a while loop to do this:

files: read %.
foreach file files [
if find file ".dat
[
blk: read/lines file
print join "processing on " file
;some code

while [not empty? blk] ;maybe I should use sth else to test the end of
blk???
[
; some code
blk: next blk
]
]
]

when I run it. sometimes it gave me the error msg: 
processing on text1.dat
processing on text2.dat
processing on text3.dat
** Script Error: Out of range or past end.
** Where: d2: second (to-block first blk) 

Without changing anything I ran the same script again, the error msg is:
processing on text1.dat
processing on text2.dat
processing on text3.dat
processing on text4.dat
** Script Error: Out of range or past end.
** Where: d2: second (to-block first blk) 

It looks like text3.dat is ok for the second time.
When I change the .dat file (clear out the tail empty spaces manually), it
worked. but obviously I can't do that every time for each .dat file

This is so weird. Is this because of my files? or I use the wrong function to
test the end of the file?

Your help will be highly appreciated.

Tiana




[REBOL] Running from batch file? Re:(3)

2000-02-15 Thread brian . hawley

At 09:02 PM 2/14/00 -0500, you wrote:
I've tried these variations, while being in the same
directory as rebol.exe:

rebol dns.r
rebol %dns.r
"rebol.exe" %dns.r
"rebol.exe" dns.r"

while being in a different directory:

"C:\REBOL\Rebol.exe" %dsn.r
"C:\REBOL\Rebol.exe" dsn.r

they all just go to the "" prompt.

REBOL starts in the REBOL home directory, not the current
directory. If your script is in a different directory, you
have to specify the whole path to the script on the command
line to REBOL.

If you want to get around this, use my #!REBOL.BAT method.
It was updated yesterday, so a copy is attached to this
message. It allows you to make REBOL batch files and put
them anywhere you can find them on the %PATH%. You will
have to edit the call to REBOL at the beginning to reflect
the actual place you put the #!REBOL.BAT file.

BTW, is the "%" required on the command line?  Seems to work
with or with-out it.

You don't need it. If you do use it, you must specify the
file using REBOL file syntax, %/C/AUTOEXEC.BAT rather than
C:\AUTOEXEC.BAT, for instance.

Enjoy!
Brian Hawley


@ECHO OFF
shift
rem *** The folowing call must be on ONE line ***
C:\Lang\Rebol\REBOL.exe --do "application-dirs: parse/all {%PATH%} {;}" --script 
C:\Utilities\bin\#!REBOL.BAT %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end-of-REBOL-launcher

REBOL [
Title: "#!REBOL Script Launcher"
Date: 14-Feb-2000
File: %#!REBOL.BAT
Author: "Brian Hawley"
Email: [EMAIL PROTECTED]
Rights: "Copyright (C) Brian Hawley 2000, rights under GPL"
Purpose: "Make it easy to run a REBOL script as a DOS batch file."
Usage: trim/auto {
#!REBOL.BAT helps you to express a REBOL script as a DOS batch
file. The first argument is the name of the calling batch file
(expressed best as {%0} to handle spaces, etc.). A REBOL batch
file that uses #!REBOL.BAT looks something like this:

@echo off
#!REBOL {%0} -q %1 %2 %3 %4 %5 %6 %7 %8 %9

REBOL [
Title: "Hello World"
]
print "Hello World!"
print system/script/args

if confirm "Do you want to quit? (Y or N) " [quit]
}
Comments: trim/auto {
In order to work, you must name this file #!REBOL.BAT so that
it will be treated as a batch file. The .BAT is essential, but
the #! is only there as part of the #!language script calling
convention from Unix, useful on other OS's too. #!REBOL can
now handle batch files that aren't on the path or whose name
can change by passing {%0} as the batch name. You must put
#!REBOL.BAT somewhere on the OS path and change the call to
REBOL.exe above to reflect the location of the files REBOL.exe
and #!REBOL.BAT.
This script incorporates the function to-rebol-file which is
seperately licensed under the LGPL.
}
Category: [file script]
]

if unset? 'to-rebol-file [
; The wierd bit with init here is to work around a GC bug :(
use [init] [
init: make object! [
alpha: charset [#"A" - #"Z" #"a" - #"z"]
dos-char: complement charset [
#"^(0)" - #"^(1f)" {\/:*?|"}
]
amiga-char: complement charset ":/"
]

to-rebol-file: func [
"Changes a valid platform filename into a rebol file."
file-name [string!] "A platform-format filename."
/default "Return this file instead of none when not valid."
default-file [file!]
/dir "Add a trailing /, if needed, to indicate a directory."
/platform "Follow the filename conventions of a given platform."
which [integer!] "A REBOL major platform number"
/local
DOS Amiga MacOS Unix alpha file-char rebol-file tmp
] head insert bind/copy [
; Initialize the transformation rules
DOS: [
rebol-file: make file! length? file-name
if not parse/all file-name [
[ ; Prefix, if any
; Drive letter
copy tmp alpha ":" [
"\" (
insert insert insert
tail rebol-file #"/" tmp #"/"
) | none (
if (to-char tmp)  (second what-dir) [
insert insert insert
tail rebol-file #"/" tmp #"/"
]
)
] |
; UNC path (no single-letter computer names!)
"\\" (insert tail rebol-file #"/") |
; Root dir of current drive
"\" (insert tail rebol-file "//") |
none
] [ ; File path, if any
copy tmp some dos-char (insert tail rebol-file tmp)
any ["\" copy tmp some dos-char (
insert insert tail rebol-file #"/" tmp
) ]
["\" (insert tail rebol-file #"/") | none] |
none
]
] [ ; Parse failed
rebol-file: none
  

[REBOL] Dialecting...Stack Overflow ?!

2000-02-15 Thread Jean . Holzammer

Hi ,

I tried to learn th. about writing dialects. So I did the following code, to
begin with.
I exspected it to putput the following:

HTMLHEADTITLETitel/TITLE/HEADBODYDas ist ein Text
!/BODY/HTML

but I got an error msg of type: stack overflow , though I had increased
stack to 3.000.000 Bytes.

Here's my program:


REBOL []
;definition part
html: func [block1] [join "HTML" [block1 "/HTML"]]
head: func [block2] [join "HEAD" [block2 "/HEAD"]]
body: func [block3] [join "BODY" [block3 "/BODY"]]
title: func [block4] [join "TITLE" [block4 "/TITLE"]]
;test part
a: html
[
 head
 [
  title "Titel"
 ]
 body
 [
  "Das ist ein Text !"
 ]
]
print a



 myhtml.r 

 myhtml.r


[REBOL] Dialecting...Stack Overflow ?! Re:

2000-02-15 Thread Al . Bri

'head is also the name of word used a lot by REBOL. Have a look at the
source for 'append, and you will see why.

If you have a look at my %HTML.r script on http://www.rebol.org, or from
http://openip.org, you'll see my early approach to writing a HTML dialect,
using a similar method.

Andrew Martin
Who's up bright and early downloading the Windows Platform SDK. It's only
taken all night so far! :-)
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 16 February 2000 4:46 AM
Subject: [REBOL] Dialecting...Stack Overflow ?!


 Hi ,

 I tried to learn about writing dialects. So I did the following code, to
begin with.
 I expected it to output the following:

 HTMLHEADTITLETitel/TITLE/HEADBODYDas ist ein Text
 !/BODY/HTML

 but I got an error msg of type: stack overflow, though I had increased
stack to 3.000.000 Bytes.

 Here's my program:


 REBOL []
 ;definition part
 html: func [block1] [join "HTML" [block1 "/HTML"]]
 head: func [block2] [join "HEAD" [block2 "/HEAD"]]
 body: func [block3] [join "BODY" [block3 "/BODY"]]
 title: func [block4] [join "TITLE" [block4 "/TITLE"]]
 ;test part
 a: html
 [
  head
  [
   title "Titel"
  ]
  body
  [
   "Das ist ein Text !"
  ]
 ]
 print a



  myhtml.r




[REBOL] EOF? Help please Re:

2000-02-15 Thread Al . Bri

That looks OK.
Perhaps there's a problem with the code in the 'while.

Andrew Martin
Sleepy REBOL...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, 16 February 2000 4:09 AM
Subject: [REBOL] EOF? Help please


 Hello,

 I have a question about the file reading in REBOL. Does Rebol has sth like
EOF
 (end of file) function?

 I wrote a script which read through a directory and does sth on each file.
 I use a while loop to do this:

 files: read %.
 foreach file files [
 if find file ".dat
 [
 blk: read/lines file
 print join "processing on " file
 ;some code

 while [not empty? blk] ;maybe I should use sth else to test the
end of
 blk???
 [
 ; some code
 blk: next blk
 ]
 ]
 ]

 when I run it. sometimes it gave me the error msg:
 processing on text1.dat
 processing on text2.dat
 processing on text3.dat
 ** Script Error: Out of range or past end.
 ** Where: d2: second (to-block first blk)

 Without changing anything I ran the same script again, the error msg is:
 processing on text1.dat
 processing on text2.dat
 processing on text3.dat
 processing on text4.dat
 ** Script Error: Out of range or past end.
 ** Where: d2: second (to-block first blk)

 It looks like text3.dat is ok for the second time.
 When I change the .dat file (clear out the tail empty spaces manually), it
 worked. but obviously I can't do that every time for each .dat file

 This is so weird. Is this because of my files? or I use the wrong function
to
 test the end of the file?

 Your help will be highly appreciated.

 Tiana





[REBOL] Emailing Files from a form

2000-02-15 Thread dhopkins

Hi,
Here's my problem, I have a form from which a user will choose a file to
upload from thier computer(using input type=file). I want to mail that file
to an address. Here's the code I hoped would do this.
--
#!C:\rebol\rebol --cgi --secure none
cgi: make object! decode-cgi system/options/cgi/query-string

set-net [ [EMAIL PROTECTED] mail.mailserver.com none none none ]
cgi: make object! decode-cgi system/options/cgi/query-string
send [EMAIL PROTECTED] [cgi/uploadfile] ;--The form field is called
uploadfile
-

But this code just hangs my server. What did I do wrong?

Derrick
[EMAIL PROTECTED]
[ Game Review Index - http://rothrock.intercoastal.com/gri
[ Cynthia Rothrock World Order - http://rothrock.intercoastal.com



[REBOL] Project Submissions

2000-02-15 Thread ptretter

Please continue to submit projects.  We need more submissions.  Currently
only 6 projects have been submitted.  Im sure we have more ideas than those
submitted.  Remember, you can submit more than one project.

Paul Tretter
Paul's Rebol Page
http://p1-110.charter-stl.com/rebolsearch
The Rebol Docs Index




[REBOL] EOF? Help please Re:(2)

2000-02-15 Thread Tiana . Zhang

Hi, Andrew,
Thanks for your reply. I don't think it is the problem of a simple while loop. I
attached my script and input file in this msg:

blk: read/lines %test.dat   
while [not empty? blk]
[
d1:  second (to-block first blk) 
d1: parse d1 "-"
d1: to-date d1/1
print d1
blk: next blk 
print blk   
either not empty? blk [print "not empty"][print "empty"]
]

test.dat:

21-Feb-2000{ 2000/02/01-00:20  -  2000/02/08-21:48 }7629
20-Feb-2000{ 2000/02/02-00:20  -  2000/02/08-21:48 }7629
19-Feb-2000{ 2000/02/03-00:20  -  2000/02/08-21:48 }7629


This test.dat file is generated by machine. The weird thing is if I open the
file and clear its tail, the script worked fine. But if I added an empty newline
at the end of file, it won't work. 
** Script Error: Out of range or past end.
** Where: d1: second (to-block first blk) 

When rebol execute 

either not empty? blk [print "not empty"][print "empty"]

it always prints 'not empty' even the content of blk printed is blank.

I'm so frustrated about this. Can u help me out?

Thanks a million.

Tiana



[REBOL] Emailing Files from a form Re:

2000-02-15 Thread strejcek

[Charset iso-8859-1 unsupported, filtering to ASCII...]
 Hi,
 Here's my problem, I have a form from which a user will choose a file to
 upload from thier computer(using input type=file). I want to mail that file
 to an address. Here's the code I hoped would do this.
 --
 #!C:\rebol\rebol --cgi --secure none
 cgi: make object! decode-cgi system/options/cgi/query-string
 
 set-net [ [EMAIL PROTECTED] mail.mailserver.com none none none ]
 cgi: make object! decode-cgi system/options/cgi/query-string
 send [EMAIL PROTECTED] [cgi/uploadfile] ;--The form field is called
 uploadfile
 -
 
 But this code just hangs my server. What did I do wrong?
 
 Derrick
 [EMAIL PROTECTED]
 [ Game Review Index - http://rothrock.intercoastal.com/gri
 [ Cynthia Rothrock World Order - http://rothrock.intercoastal.com
 

--
Jan Strejcek
[EMAIL PROTECTED]



[REBOL] Emailing Files from a form Re:

2000-02-15 Thread strejcek


At first, sorry for previous mail without any reaction.

 Hi Derrick.

There's a problem:

If you use default ENCTYPE (i.e. "application/x-www-form-urlencoded"), only
filenyme is submitted from INPUT TYPE="FILE" ... tag.
If you wanna received the file content too, you should use:
METHOD="POST" ENCTYPE="multipart/form-data"
But this encoding has no built-in support in REBOL as default ENCTYPE has
(decode-cgi works only for default encoding).

Solution for your problem may be found in script POST.r by Andrew Grossman 
(available at www.rebol.org/web/)

Regards,
Jan

 Hi,
 Here's my problem, I have a form from which a user will choose a file to
 upload from thier computer(using input type=file). I want to mail that file
 to an address. Here's the code I hoped would do this.
 --
 #!C:\rebol\rebol --cgi --secure none
 cgi: make object! decode-cgi system/options/cgi/query-string
 
 set-net [ [EMAIL PROTECTED] mail.mailserver.com none none none ]
 cgi: make object! decode-cgi system/options/cgi/query-string
 send [EMAIL PROTECTED] [cgi/uploadfile] ;--The form field is called
 uploadfile
 -
 
 But this code just hangs my server. What did I do wrong?
 
 Derrick
 [EMAIL PROTECTED]
 [ Game Review Index - http://rothrock.intercoastal.com/gri
 [ Cynthia Rothrock World Order - http://rothrock.intercoastal.com
 

--
Jan Strejcek
[EMAIL PROTECTED]



[REBOL] Running from batch file? Re:(4)

2000-02-15 Thread brian . hawley

Whoops!

The copy of #!REBOL.BAT I included had 2 bugs and one
slower part, all fixed in the version I've included
with this message. My bad!

At 09:32 AM 2/15/00 -0600, I wrote:
REBOL starts in the REBOL home directory, not the current
directory. If your script is in a different directory, you
have to specify the whole path to the script on the command
line to REBOL.

Apparently this is different with /View. #!REBOL.BAT still
works with /View, but I should take /View into account when
it is released.

Brian Hawley


@ECHO OFF
shift
rem *** The folowing call must be on ONE line ***
C:\Lang\Rebol\REBOL.exe --do "application-dirs: parse/all {%PATH%} {;}" --script 
C:\Utilities\bin\#!REBOL.BAT %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end-of-REBOL-launcher

REBOL [
Title: "#!REBOL Script Launcher"
Date: 15-Feb-2000
File: %#!REBOL.BAT
Author: "Brian Hawley"
Email: [EMAIL PROTECTED]
Rights: "Copyright (C) Brian Hawley 2000, rights under GPL"
Purpose: "Make it easy to run a REBOL script as a DOS batch file."
Usage: trim/auto {
#!REBOL.BAT helps you to express a REBOL script as a DOS batch
file. The first argument is the name of the calling batch file
(expressed best as {%0} to handle spaces, etc.). A REBOL batch
file that uses #!REBOL.BAT looks something like this:

@echo off
#!REBOL {%0} -q %1 %2 %3 %4 %5 %6 %7 %8 %9

REBOL [
Title: "Hello World"
]
print "Hello World!"
print system/script/args

if confirm "Do you want to quit? (Y or N) " [quit]
}
Comments: trim/auto {
In order to work, you must name this file #!REBOL.BAT so that
it will be treated as a batch file. The .BAT is essential, but
the #! is only there as part of the #!language script calling
convention from Unix, useful on other OS's too. #!REBOL can
now handle batch files that aren't on the path or whose name
can change by passing {%0} as the batch name. You must put
#!REBOL.BAT somewhere on the OS path and change the call to
REBOL.exe above to reflect the location of the files REBOL.exe
and #!REBOL.BAT.
This script incorporates the function to-rebol-file which is
seperately licensed under the LGPL.
}
Category: [file script]
]

if not value? 'to-rebol-file [
; The wierd bit with init here is to work around a GC bug :(
use [init] [
init: make object! [
alpha: charset [#"A" - #"Z" #"a" - #"z"]
dos-char: complement charset [
#"^(0)" - #"^(1f)" {\/:*?|"}
]
amiga-char: complement charset ":/"
]

to-rebol-file: func [
"Changes a valid platform filename into a rebol file."
file-name [string!] "A platform-format filename."
/default "Return this file instead of none when not valid."
default-file [file!]
/dir "Add a trailing /, if needed, to indicate a directory."
/platform "Follow the filename conventions of a given platform."
which [integer!] "A REBOL major platform number"
/local
DOS Amiga MacOS Unix rebol-file tmp
] head insert bind/copy [
; Initialize the transformation rules
DOS: [
rebol-file: make file! length? file-name
if not parse/all file-name [
[ ; Prefix, if any
; Drive letter
copy tmp alpha ":\" (
insert insert insert rebol-file #"/" tmp #"/"
) | copy tmp alpha ":" (
if (to-char tmp)  (second what-dir) [
insert insert insert rebol-file #"/" tmp #"/"
]
) |
; UNC path (no single-letter computer names!)
"\\" (insert rebol-file #"/") |
; Root dir of current drive
"\" (insert rebol-file "//") |
none
] [ ; File path, if any
copy tmp some dos-char (insert tail rebol-file tmp)
any ["\" copy tmp some dos-char (
insert insert tail rebol-file #"/" tmp
) ]
["\" (insert tail rebol-file #"/") | none] |
none
]
] [ ; Parse failed
rebol-file: none
]
]
Amiga: [
rebol-file: make file! length? file-name
if not parse/all file-name [
; Device
[copy tmp 0 30 amiga-char ":" (
insert insert insert rebol-file #"/" any [tmp ""] #"/"
) | none]
; Directory path
copy tmp any "/" (
if tmp [insert/dup rebol-file "../" length? tmp]
)
any [ 
copy tmp 1 30 amiga-char "/" (
insert insert tail rebol-file tmp #"/"
)
copy tmp any "/" (
if tmp [
insert/dup tail rebol-file "../" length? tmp
]
   

[REBOL] Philosophising Re:

2000-02-15 Thread tjohnson

Hello Martin:
I'm a C/C++ programmer just beginning to learn rebol. If you want
a different slant on this, check the mailing list for last week, on 
a letter I sent with "imbedding rebol" in the subject header. If you
want a copy, I will send it. It didn't engender much comment, except
on a mistaken reference that I made in the opening allegory.
I'm using the Boxer 99 editor for rebol (on WinNT). I believe that
there are rebol extensions for emacs (and emacs is now available
for Windooz)
regards
tim
At 12:00 AM 2/15/00 -0800, you wrote:
I'm philosophising about directions REBOL could take. I've been working on a
C based editor/IDE for REBOL (just Ctrl+R, your script is saved and REBOL is
run on the script), and I've also downloaded two varieties of SmallTalk and
had a little play with both.
So what do C and SmallTalk have to do with REBOL? Well, at least one of
the SmallTalks had been self-extended by having (as I understand it) a
SmallTalk to C translator. With this, development for a new interface (for
example, reading, playing and writing midi or other media files) is done in
the SmallTalk environment, then when the code works correctly, C code is
generated and compiler, then included into the SmallTalk 'image'.
With the aid of REBOL/Command (when it comes out), a malleable REBOL
environment with _native_ look and feel (or with a default look and feel),
could be developed. With a simplistic REBOL to C or machine code translator
(one that operates on script that isn't self modifying), a fast, intuitive,
easily enhanced environment could be created. This could lead to, as with
SmallTalk, a environment or even operating system, based entirely on REBOL.

pekr and others, what do you think?

Andrew Martin
REBOLution the OS...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--





[REBOL] Philosphizing/Imbedding and Extending Rebol Re:

2000-02-15 Thread tjohnson

Hi All:
Am reposting this in reponse to Andrew Marting..
Having said that, look at Python: With Python, you can both
call other programs from the script, AND you can imbed the
script in C/C++ by linking in Python Libraries. 

As a C/C++ programmer, I would guess that there would be some
hurdles to overcome with multiple platforms as targets to implement
system calls in Rebol.

Looking at the reverse: that is imbedding Rebol in C/C++ (I can
only comment on this medium, not other languages).
If the necessary resources were provided, it shouldn't be too
difficult to arrange for a rebol library to be linked into a C
executable. And I don't think then, that it would be too difficult
to make the first step a very simple interface like so:

use_rebol(char* rebol_syntax_string);
//and overloading in C++
use_rebol(char* rebol_syntax_string, char* simple_data_string);
OR use_rebol(int number_of_args,/*variable argument list*/)
// etc
The implementation would be VERY simple, and definitely limited,
but it would be a first step, and wouldn't have to be made obsolete
by later enhancements.

Even at that very simple first step, I could see an easier implementation
of ftp, cgi, and email than the components provided to me by Borland.
(And Borland CGI services are available to the programmer only with a VERY
expensive "interprise" version. 

By overlaying the code with the preprocessor, one could then create any number
of very powerful calls with very brief coding.

As cesar state quite correctly resolving datastructure would be somewhat
more complicated, but doable.

On a related note, I have seen comments about databases: And I do a lot of
CGI database programming. Let me put in a plug here:

I recently purchased the Mix C/Database Library, it is available for differnt
Windows modes, as well as for Linux. And is very complete and powerful.
Now I don't pretend to advise rebol
as to purchasing someone else's work or joint ventures, but if I could find
a way to compile rebol's core with Mix's database libraries, I would be
one VERY happy camper. 

Just a thought.
Thanks for listening
Tim
At 09:22 AM 2/10/00 -0600, you wrote:


[EMAIL PROTECTED] wrote:

 And what do you think about a Rebol extension language tool?


I think Rebol would make a fine extension language.  The major problem all
extension language integrators face is how to glue to language to the
application's core datastructures.  Series are a simple yet obviously
powerful
abstraction;  RT has given us ample examples of how to bridge that
abstraction to
a variety of problem domains with their tight integration of series and
various
network protocols.  I suspect that a thoughtful way to wrap host-app
datastructures up in series would in a natural way lead to very
expressive, very
tight extension code.

$0.02,

jb


 thanks   /cesar





[REBOL] hostname parse rule Re:(4)

2000-02-15 Thread peoyli

 Hi /PeO
...

These were the rules I was using...

let-char: charset[#"a" - #"z" #"A" - #"Z"]
let-digit-char: charset[#"a" - #"z" #"A" - #"Z" #"0" - #"9"]
let-digit-hyph-char: charset[#"a" - #"z" #"A" - #"Z" #"0" - #"9" #"-"]

 The problem is combining them to a working ruleset...
 
 The problem is how you formulate your specification. You say:
 ; may have any number of letters, digits and
 ; hyphens in between, but this sequence must
 ; end with a letter or digit if it exists
 
 This is too general. You need to redefine your rules so that you precisely
 state that a hyphen - if it occurs - must be followed by a letter or digit.
 I.e., I believe you have a let-digit-char rule, your let-digit-hyph-char
 rule then must be:
 
The hyphen must not be followed by a letter or a digit unless it is the
first of the two last characters.. According to the RFC "a--a" should be a
valid host name (part)... 

BNF rule was.. (not retyped from the RFC, but what I want to implement as a
parse rule)..

let-char [*[let-digit-hyph-char] let-digit-char]

with "[" and "]" marking optional parts as in BNF

That is.. valid host names begins with a letter, ends with a letter or a
digit (which could be the same as the first letter, since one-character
host names are allowed), in between there could be any number of letters,
digits and hyphens in any order.

 let-digit-hyph-char: [ "-" let-digit-char]
 
That rule will require every hyphen to be followed by a letter or a digit..

 This rule only evaluates to true if a hyphen is immediately followed by a
 character. It permits that a hyphen appear, provided that the hyphen is
 followed by a an obligatory character and thereby excludes the possibility
 of a trailing hyphen.
 
 Hope this helps
 
 
 ;- Elan  [: - )]
 
 



[REBOL] EOF? Help please Re:(3)

2000-02-15 Thread icimjs

Hi Tiana,

if you run the following version of your code you will easily see what is
happening:

REBOL []

blk: read/lines %test.dat   

print "blk contains:"
foreach string blk [print mold string]
print "end blk contains"

while [not empty? blk]
[
print ["=" newline
mold to-block first blk newline
"="
]

d1:  second (to-block first blk) 
d1: parse d1 "-"
d1: to-date d1/1
print d1
blk: next blk 
print blk   
either not empty? blk [print "not empty"][print "empty"]
]

In short what happens is that when you read/lines your file, empty lines in
the file are contained in blk as emtpy strings:

[""]

When you check 
empty? blk

and blk is [""] then blk is not empty of course (it contains an element
which is an empty string). But the string is empty and therefore there is
no second element in the string. So 

d1:  second (to-block first blk) 

fails. to-block first blk will return an empty block [] and there is no
second element in the empty block.

It's safer to use pick (to-block first blk) 2 instead of second. The
advantage is that pick series index returns none when there is nothing to
pick instead of generating an error. 

  So you can say:

if d1: pick (to-block first blk) 2 [
  d1: parse d1 "-"
  d1: to-date d1/1
  print d1
]
blk: next blk 
print blk   
either not empty? blk [print "not empty"][print "empty"]

and only attempt to process d1 if it is not none.

Hope this helps,


;- Elan  [: - )]



[REBOL] Re: EOF? Help please Re:(2)

2000-02-15 Thread giesse

Hello [EMAIL PROTECTED]!

On 15-Feb-00, you wrote:

 Td1:  second (to-block first blk) 

It seems like the problem is in this line. The result of FIRST BLK
will be a string (since BLK is a block of strings); then you are
converting it to a block with TO-BLOCK. Now look here:

 to-block "something inside the string"
== [something inside the string]
 to-block "   "
== []

When FIRST BLOCK returns an empty string (or a string with just
spaces) you get an empty block as result. So when you try to
access the second element you get an error:

 second []
** Script Error: Out of range or past end.
** Where: second []

As you said, the error happens when your file ends with an empty
line. You can solve the problem with:

   d1: to-block first blk
   if empty? d1 [break] ; exit from the loop
   d1: second d1
   ; etc.

Regards,
Gabriele.
-- 
o) .-^-. (--o
| Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
| GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
o) `-v-' (--o




[REBOL] Re:EOF? Help please

2000-02-15 Thread Tiana . Zhang

oops, I know what's going on with my script. actually, nth wrong. It is just
because in the machine-generated file, I added a newline by accident.


Tiana
 



[REBOL] EOF? Help please Re:(3)

2000-02-15 Thread ingo

Hi Tiana,

when your file has an empty last line, pointing at this line
your block is not yet empty, because it is pointing at "".
now try

to-block ""
== []

which has no second element. Thus the error.

One possible solution is:

blk: read/lines %test.dat
while [
   all [
   not empty? blk
   not none? d1: pick (to-block first blk) 2
   ]
] [
d1: parse d1 "-"
d1: to-date d1/1
print d1
blk: next blk
print blk
either not empty? blk [print "not empty"][print "empty"]
]

'pick does not raise an error, if the refereneced element does
not exist, but returns 'none.
'all returns 'true, if all of it's elemets return 'true


hope this helps,

regards,

Ingo


Those were the words of [EMAIL PROTECTED]:
 Hi, Andrew,
 Thanks for your reply. I don't think it is the problem of a simple while loop. I
 attached my script and input file in this msg:
 
 blk: read/lines %test.dat   
 while [not empty? blk]
 [
 d1:  second (to-block first blk) 
 d1: parse d1 "-"
 d1: to-date d1/1
 print d1
 blk: next blk 
 print blk   
 either not empty? blk [print "not empty"][print "empty"]
 ]
 
 test.dat:
 
 21-Feb-2000{ 2000/02/01-00:20  -  2000/02/08-21:48 }7629
 20-Feb-2000{ 2000/02/02-00:20  -  2000/02/08-21:48 }7629
 19-Feb-2000{ 2000/02/03-00:20  -  2000/02/08-21:48 }7629
 
 
 This test.dat file is generated by machine. The weird thing is if I open the
 file and clear its tail, the script worked fine. But if I added an empty newline
 at the end of file, it won't work. 
 ** Script Error: Out of range or past end.
 ** Where: d1: second (to-block first blk) 
 
 When rebol execute 
 
 either not empty? blk [print "not empty"][print "empty"]
 
 it always prints 'not empty' even the content of blk printed is blank.
 
 I'm so frustrated about this. Can u help me out?
 
 Thanks a million.
 
 Tiana
 

--  _ ._
ingo@)|_ /|  _| _  We ARE all ONE   www._|_o _   _ ._ _  
www./_|_) |o(_|(/_  We ARE all FREE ingo@| |(_|o(_)| (_| 
http://www.2b1.de/Rebol/ ._|  ._|



[REBOL] Computer date? Re:

2000-02-15 Thread dolmen

 Is there a way to get the date in -mm-dd format, without parsing the
basic
 date?
 --

The following code may help to find the way...


 a: now
== 15-Feb-2000/0:03:17+1:00
 a/year
== 2000
 print join a/year [ "-" a/month "-" a/day ]
2000-2-15





[REBOL] Re: XML-RPC

2000-02-15 Thread krobillard

Thank you for your comments about XML, Dan and jbone.


On Sun, 13 Feb 2000, [EMAIL PROTECTED] wrote:
 I've had something very similar to this discussion with someone else
 regarding Newtonscript-like frames vs. XML.  Both are tree-structured data
 formats.  The real key difference, and the reason XML "wins," is that (while
 more verbose) XML is much more of a "metadata structure."  The ability to
 "dialect" the data language via DTDs and the separation of structure
 definition from data representation make it much more flexible.  The cost is
 some increase in complexity and size of data, but this is more than
 compensated by increased utility.  A pure-block Rebol implementation, even if
 dealing with all-Rebol componentry, still suffers from the same deficiencies
 -wrt- XML as, say, Newstonscript frames.


I don't understand how XML is more a metadata structure than REBOL.  There is
no reason you can't define certain REBOL dialects as representing data and
requiring an associated REBOL Type Definition.

I found this in the current XML FAQ (dated 1 June 1999):

 C.11   I keep hearing about alternatives to DTDs. What's a schema?

 Bob DuCharme writes: `Many XML developers are dissatisfied with the syntax of
 the markup declarations described in the XML spec for two reasons. First, they
 feel that if XML documents are so good at describing structured information,
 then the description of a document type's structure (its `schema') should be
 in an XML document instead of written with its own special syntax. In addition
 to being more consistent, this would make it easier to edit and manipulate the
 schema with regular document manipulation tools.'

The quote of Mr. DuCharme follows this seemingly contradictory DTD definition:
"A DTD is a file (or several files to be used together), written in XML, which
contains a formal definition of a particular type of document."  But then it
talks about converting DTDs to XML!

Are DTDs written in XML?

 
-Karl Robillard



[REBOL] Philosphizing/Imbedding and Extending Rebol Re:(2)

2000-02-15 Thread rebol

U-Oh.. Philosphizing with REBOL is just so compelling.. :)

I am excited about REBOLs code=data philosophy. code=data works so well 
with EMACS/Scheme which is a dialect of LISP.

Also, that REBOL wants be complimentary to XML and REBOL claims that it can 
be used in place of XML. XML is great at defining interfaces.Therefore, 
using an XML mindset, I propose a 
"REBOL-Interface-Definition-Language-DTD-like" REBOL script(Document) that 
will publish the interface in IDL or XML.
This will strongly support the pattern 
InterfacesIndepenentOfImplementation. For something that 
RunsAlmostAnywhere, this is an important consideration. (Having said that, 
I am very interested in learning exacltly *how* I could write XML-like 
documents in REBOL. )

Then, it will be up to separate platform developers to build highly 
efficient compilers for their platforms
like MIDL for Windows etc. Here, C++/C/Other programs can implement the 
interface.

Maybe, this will allow extensive re-use of existing C++/IDL interface work 
done in the
industry so far and REBOL could ride that wave. REBOL can also use 
middleware on 3-(N) tier systems

Maybe, that way, the problem of exposing a REBOL script will also vanish:
then,  peer services will only "see" the "IDL"d  Services, not the REBOL or 
Rebol Script

Also REBOL Scripts could be built that act as services to interfaces 
published by external C/C++/Java/other requests.

About Andew's point on an neat ,extensible, Object Oriented, ScriptBased 
 Development, Debugging environment, it would be very interesting to hear 
 thoughts on the idea of a RAD visual development environment using 
REBOL/View and automatic code generation/debugging and possibly round-trip 
from REBOL script to visual (VisualBasic like ) elements. I am daring to 
propose this because of (a) REBOL's awesome language features and (b) I see 
so much talent within this ml J (c) When Turbo Pascal/Turbo Vision came out 
I was *really* impressed that their IDE was built using TurboVision and 
that really sold Turbo Pascal to me.
It would leapfrog REBOL well into the popular domain of scripting 
languages. I can see one
drawback - the lack of speed: but looking at toys out now like DreamCast 
and Playstation 2 being truly 128-bit CPU-based machines that might not be 
such a major factor when it comes to even embedded devices in the future.


Regards,
Nitish.
http://www.loka.net/
"You may say, I'm a dreamer, but I'm not the only one..." -J.Lennon

-Original Message-
From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, 16 February 2000 07:31
To: [EMAIL PROTECTED]
Subject:[REBOL] Philosphizing/Imbedding and Extending Rebol Re:

Hi All:
Am reposting this in reponse to Andrew Marting..
Having said that, look at Python: With Python, you can both
call other programs from the script, AND you can imbed the
script in C/C++ by linking in Python Libraries.

As a C/C++ programmer, I would guess that there would be some
hurdles to overcome with multiple platforms as targets to implement
system calls in Rebol.

Looking at the reverse: that is imbedding Rebol in C/C++ (I can
only comment on this medium, not other languages).
If the necessary resources were provided, it shouldn't be too
difficult to arrange for a rebol library to be linked into a C
executable. And I don't think then, that it would be too difficult
to make the first step a very simple interface like so:

use_rebol(char* rebol_syntax_string);
//and overloading in C++
use_rebol(char* rebol_syntax_string, char* simple_data_string);
OR use_rebol(int number_of_args,/*variable argument list*/)
// etc
The implementation would be VERY simple, and definitely limited,
but it would be a first step, and wouldn't have to be made obsolete
by later enhancements.

Even at that very simple first step, I could see an easier implementation
of ftp, cgi, and email than the components provided to me by Borland.
(And Borland CGI services are available to the programmer only with a VERY
expensive "interprise" version.

By overlaying the code with the preprocessor, one could then create any 
number
of very powerful calls with very brief coding.

As cesar state quite correctly resolving datastructure would be somewhat
more complicated, but doable.

On a related note, I have seen comments about databases: And I do a lot of
CGI database programming. Let me put in a plug here:

I recently purchased the Mix C/Database Library, it is available for 
differnt
Windows modes, as well as for Linux. And is very complete and powerful.
Now I don't pretend to advise rebol
as to purchasing someone else's work or joint ventures, but if I could find
a way to compile rebol's core with Mix's database libraries, I would be
one VERY happy camper.

Just a thought.
Thanks for listening
Tim
At 09:22 AM 2/10/00 -0600, you wrote:


[EMAIL PROTECTED] wrote:

 And what do you think about a Rebol extension language tool?


I think Rebol would make a fine 

[REBOL] UPS for freight calculation

2000-02-15 Thread gvadivelrajan

Hello ,



We are using say UPS for freight calculation. I want to give the to and from

zip code, weight and dimension to the UPS site. Then I would like to 
download the freight charges in to some local table/ascii file.
My url will be https://www.ups.com/ups.app/iss.class. Is it possible to 
invoke this and enter the information directly into the URL.And get back the
information needed


Regards
Gobiraj

 winmail.dat


[REBOL] URL-encoding

2000-02-15 Thread chris

Hello folks,

I'm currently rewriting a simple Wiki-like system I wrote in Python a
month ago in REBOL.

To easily transfer the existing content to the new system, I need to
know ...

Is there any way to convert a string to an URL-encoded form in REBOL
yet?
A la "Chris L" to "Chris%20L"?
Or do I have to write a translator for special characters myself?

Thank you very much for any answers.

For the records, I have to say that REBOL is definitely blessed with
elegance as hardly ever seen before (especially in the field of computer
languages). There are a few random crashes (bad thing about them - I'm
often unable to reproduce them), but otherwise I'm totally fascinated!

Best regards,
-- Chris
_
c h r i s langreiter - - - unterlangkampfen 3 2 7
f o r m  is function -- autriche 6322 langkampfen
0 0 4 3 / (0) 5 3 3 2 / 8 7 6 0 7 c a l l - n o w
w   w   w   .  l a n g r e i t e r  .   c   o   m

There are three kinds of lies:
lies, damn lies, and statistics.
--Benjamin Disraeli




[REBOL] URL-encoding Re:

2000-02-15 Thread larry

Hi Chris

Try:

myurl: to-url "Chris L"
== Chris%20L

Cheers

Larry

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 15, 2000 3:52 PM
Subject: [REBOL] URL-encoding


 Hello folks,
 
 I'm currently rewriting a simple Wiki-like system I wrote in Python a
 month ago in REBOL.
 
 To easily transfer the existing content to the new system, I need to
 know ...
 
 Is there any way to convert a string to an URL-encoded form in REBOL
 yet?
 A la "Chris L" to "Chris%20L"?
 Or do I have to write a translator for special characters myself?
 
 Thank you very much for any answers.
 
 For the records, I have to say that REBOL is definitely blessed with
 elegance as hardly ever seen before (especially in the field of computer
 languages). There are a few random crashes (bad thing about them - I'm
 often unable to reproduce them), but otherwise I'm totally fascinated!
 
 Best regards,
 -- Chris
 _
 c h r i s langreiter - - - unterlangkampfen 3 2 7
 f o r m  is function -- autriche 6322 langkampfen
 0 0 4 3 / (0) 5 3 3 2 / 8 7 6 0 7 c a l l - n o w
 w   w   w   .  l a n g r e i t e r  .   c   o   m
 
 There are three kinds of lies:
 lies, damn lies, and statistics.
 --Benjamin Disraeli
 



[REBOL] XML-RPC Re:(2)

2000-02-15 Thread rebol

hello Karl, Dan and Jbone

In  response to Karl's question, are DTD's written in XML?

The answer is that *part* of the formal definition can be written in XML. 
Other parts like semantics of elements and attributes or specific 
application conventions cannot be expressed formally in XML/SGML and are 
written in their own special syntax.

What Mr DuCharme means when he says converting DTDs to XML is that DTD's 
are special files that state the rules for production of the XML 
*Documents*. The XML parser uses the DTD to generate the XML document as 
per rules specified in the DTD. For example, usually there are XML element 
declarations in the DTD like !ELEMENT name This XML Declaration  in the 
DTD tells the parser that all xml documents it parses of this document type 
can have the element NAME in it.

The DTD (Document Type Definition) is  a specifier of a class of XML 
Documents.

I hope that makes it clearer.

I am discussing one of the possible uses of XML in another thread "Philo  
sphizing/Imbedding and Extending Rebol". Perhaps some of you would like to 
contribute?

About  jbone's question: you wrote
The ability to
 "dialect" the data language via DTDs and the separation of structure
   definition from data representation ...
 REBOL provides  a convenient way of defining values. It think it would be 
easy  to  create, for instance an ELEMENT declaration in REBOL that 
evaluated to  a tagged text like Fname= "Walt" lname= "Disney"
Off the top of my head  ELEMENT would have to be a function like
ELEMENT: func [a b][return rejoin ["NAME=" a " " "LNAME= " b ""]]

(this is by no means a great way to build a DTD but .. :)   would make way 
for documents that had ELEMENT Walt Disney markups in them. When executed 
they will produce
== "NAME=Walt LNAME= Disney"
A collection of such ELEMENT declarations would provide the "separation of 
structure definition from data representation" you are seeking.

However, XML/SGML  is a very powerful and widely accepted open standard. I 
think it would be interesting to look at ways in which REBOL and XML could 
complement each other..


Regards,
Nitish
[EMAIL PROTECTED]
http://www.loka.net/




-Original Message-
From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, 16 February 2000 10:32
To: [EMAIL PROTECTED]
Subject:[REBOL] Re: XML-RPC

Thank you for your comments about XML, Dan and jbone.


On Sun, 13 Feb 2000, [EMAIL PROTECTED] wrote:
 I've had something very similar to this discussion with someone else
 regarding Newtonscript-like frames vs. XML.  Both are tree-structured 
data
 formats.  The real key difference, and the reason XML "wins," is that 
(while
 more verbose) XML is much more of a "metadata structure."  The ability to
 "dialect" the data language via DTDs and the separation of structure
 definition from data representation make it much more flexible.  The cost 
is
 some increase in complexity and size of data, but this is more than
 compensated by increased utility.  A pure-block Rebol implementation, 
even if
 dealing with all-Rebol componentry, still suffers from the same 
deficiencies
 -wrt- XML as, say, Newstonscript frames.


I don't understand how XML is more a metadata structure than REBOL.  There 
is
no reason you can't define certain REBOL dialects as representing data and
requiring an associated REBOL Type Definition.

I found this in the current XML FAQ (dated 1 June 1999):

 C.11   I keep hearing about alternatives to DTDs. What's a schema?

 Bob DuCharme writes: `Many XML developers are dissatisfied with the 
syntax of
 the markup declarations described in the XML spec for two reasons. First, 
they
 feel that if XML documents are so good at describing structured 
information,
 then the description of a document type's structure (its `schema') should 
be
 in an XML document instead of written with its own special syntax. In 
addition
 to being more consistent, this would make it easier to edit and 
manipulate the
 schema with regular document manipulation tools.'

The quote of Mr. DuCharme follows this seemingly contradictory DTD 
definition:
"A DTD is a file (or several files to be used together), written in XML, 
which
contains a formal definition of a particular type of document."  But then 
it
talks about converting DTDs to XML!

Are DTDs written in XML?


-Karl Robillard

begin 600 WINMAIL.DAT
M)\^(@D``0:0" `$```!``$``00!@`(Y 0```#H``$(@ `
M ```$E032Y-:6-R;W-O9G0@36%I;"Y.;W1E`#$(`0V ! `"`@`"``$$
MD 8`= $```$0`P``, (+``\.``(!_P\!.P``
M``"!*Q^DOJ,09UN`-T!#U0"`QIW1 F5B;VPN8V]M`%--5% `;ES
M=$!R96)O;"YC;VT``!X``C !!0```%--5% `'@`#, $/
M;ES=$!R96)O;"YC;VT```,`%0P!`P#^#P8``$P`0```!$G
M;ES=$!R96)O;"YC;VTG``(!"S !% ```%--5% Z3$E35$!214)/
M3"Y#3TT``P``.0`+`$ Z`0```!X`]E\!#P```QIW1 F5B;VPN
M8V]M```"`?=?`0```#L`@2L?I+ZC$!F=;@#=`0]4`@!L:7-T
M0')E8F]L+F-O;0!33510`QIW1 F5B;VPN8V]M```#`/U?`0,`_U\`

[REBOL] [REBOL] Re: XML-RPC

2000-02-15 Thread rebol


hello Karl, Dan and Jbone

In  response to Karl's question, are DTD's written in XML?

The answer is that *part* of the formal definition can be written in XML. 
Other parts like semantics of elements and attributes or specific 
application conventions cannot be expressed formally in XML/SGML and are 
written in their own special syntax.

What Mr DuCharme means when he says converting DTDs to XML is that DTD's 
are special files that state the rules for production of the XML 
*Documents*. The XML parser uses the DTD to generate the XML document as 
per rules specified in the DTD. For example, usually there are XML element 
declarations in the DTD like !ELEMENT name This  Declaration  in the DTD 
tells the parser that all xml documents it parses of this document type can 
have the element NAME in it.

The DTD (Document Type Definition) is  a specifier of a class of XML 
Documents.

I hope that makes it clearer.

I am discussing one of the possible uses of XML in another thread "Philo  
sphizing/Imbedding and Extending Rebol". Perhaps some of you would like to 
contribute?

About  jbone's question: you wrote
The ability to
 "dialect" the data language via DTDs and the separation of structure
   definition from data representation ...
 REBOL provides  a convenient way of defining values. It think it would be 
easy  to  create, for instance an ELEMENT declaration in REBOL that 
evaluated to  a tagged text like Fname= "Walt" lname= "Disney"
Off the top of my head  ELEMENT would have to be a function like
ELEMENT: func [a b][return rejoin ["NAME=" a " " "LNAME= " b ""]]

(this is  a trivial way  build a DTD but .. :)   would make way for 
documents that had ELEMENT Walt Disney markups in them. When executed they 
will produce
== "NAME=Walt LNAME= Disney"
A collection of such ELEMENT declarations would provide the "separation of 
structure definition from data representation"

However, XML/SGML  is a very powerful and widely accepted open standard. I 
think it would be interesting to look at ways in which REBOL and XML could 
complement each other..


Regards,
Nitish
[EMAIL PROTECTED]
http://www.loka.net/




-Original Message-
From:   [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
Sent:   Wednesday, 16 February 2000 10:32
To: [EMAIL PROTECTED]
Subject:[REBOL] Re: XML-RPC

Thank you for your comments about XML, Dan and jbone.


On Sun, 13 Feb 2000, [EMAIL PROTECTED] wrote:
 I've had something very similar to this discussion with someone else
 regarding Newtonscript-like frames vs. XML.  Both are tree-structured 
data
 formats.  The real key difference, and the reason XML "wins," is that 
(while
 more verbose) XML is much more of a "metadata structure."  The ability to
 "dialect" the data language via DTDs and the separation of structure
 definition from data representation make it much more flexible.  The cost 
is
 some increase in complexity and size of data, but this is more than
 compensated by increased utility.  A pure-block Rebol implementation, 
even if
 dealing with all-Rebol componentry, still suffers from the same 
deficiencies
 -wrt- XML as, say, Newstonscript frames.


I don't understand how XML is more a metadata structure than REBOL.  There 
is
no reason you can't define certain REBOL dialects as representing data and
requiring an associated REBOL Type Definition.

I found this in the current XML FAQ (dated 1 June 1999):

 C.11   I keep hearing about alternatives to DTDs. What's a schema?

 Bob DuCharme writes: `Many XML developers are dissatisfied with the 
syntax of
 the markup declarations described in the XML spec for two reasons. First, 
they
 feel that if XML documents are so good at describing structured 
information,
 then the description of a document type's structure (its `schema') should 
be
 in an XML document instead of written with its own special syntax. In 
addition
 to being more consistent, this would make it easier to edit and 
manipulate the
 schema with regular document manipulation tools.'

The quote of Mr. DuCharme follows this seemingly contradictory DTD 
definition:
"A DTD is a file (or several files to be used together), written in XML, 
which
contains a formal definition of a particular type of document."  But then 
it
talks about converting DTDs to XML!

Are DTDs written in XML?


-Karl Robillard



[REBOL] Project Submissions Re:

2000-02-15 Thread laidback

How do you review what has already been submitted on the site?

Dave.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 15, 2000 5:02 PM
Subject: [REBOL] Project Submissions


 Please continue to submit projects.  We need more submissions.  Currently
 only 6 projects have been submitted.  Im sure we have more ideas than
those
 submitted.  Remember, you can submit more than one project.

 Paul Tretter
 Paul's Rebol Page
 http://p1-110.charter-stl.com/rebolsearch
 The Rebol Docs Index






[REBOL] Project Submissions Re:(2)

2000-02-15 Thread ptretter

Just join on the newsgroup from the main page at
http://p1-110.charter-stl.com/rebolsearch.

or news://p1-110.charter-stl.com/rebol.discuss

I hope this helps.

Paul Tretter
Paul's Rebol Page



- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 15, 2000 07:36 PM
Subject: [REBOL] Project Submissions Re:


 How do you review what has already been submitted on the site?

 Dave.

 - Original Message -
 From: [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, February 15, 2000 5:02 PM
 Subject: [REBOL] Project Submissions


  Please continue to submit projects.  We need more submissions.
Currently
  only 6 projects have been submitted.  Im sure we have more ideas than
 those
  submitted.  Remember, you can submit more than one project.
 
  Paul Tretter
  Paul's Rebol Page
  http://p1-110.charter-stl.com/rebolsearch
  The Rebol Docs Index
 
 
 




[REBOL] hostname parse rule Re:

2000-02-15 Thread KGD03011


Hi there,

This might be a good chance to plug my regular expression emulator,
search-text.r :)

http://www.rebol.org/utility/search-text.r

As far as I understand it, this should be the direct translation of the
BNF rule for hostnames as given by /PeO :

   let-char [*[let-digit-hyph-char] let-digit-char]

should be:

 l: to-bits #!a-z; TO-BITS is included in search-text.r
== make bitset! #{ ; ! means upper and lower case
FE07FE07
}
 ld: to-bits #!a-z0-9
== make bitset! #{
FF03FE07FE07
}
 ldh: to-bits #!a-z0-9\- ; \ escapes the hyphen
== make bitset! #{
0020FF03FE07FE07
}
 name-rule: [l 0 1 [any ldh ld]]
== [l 0 1 [any ldh ld]]

Unfortunately this almost never returns true when it should:

 parse/all "abc-ef" name-rule
== false
 parse/all "abcef" name-rule
== false
 parse/all "a" name-rule
== true


This is very easy to do with SEARCH from search-text.r, and you don't
even have to prepare the bitsets beforehand:

 search "abcdef" [head #!a-z  maybe [any #!a-z0-9\- #!a-z] tail]
== [1 6 "abcdef"]
 search "abc-def" [head #!a-z  maybe [any #!a-z0-9\- #!a-z] tail]
== [1 7 "abc-def"]
 search "abc--def" [head #!a-z  maybe [any #!a-z0-9\- #!a-z] tail]
== [1 8 "abc--def"]
 search "abcdef-" [head #!a-z  maybe [any #!a-z0-9\- #!a-z] tail]
== none
 search "0abcdef" [head #!a-z  maybe [any #!a-z0-9\- #!a-z] tail]
== none



SEARCH emulates the backtracking behavior of regular expressions.
PARSE on the other hand will match to the end of the line with
LET-DIGIT-HYPH-CHAR, leaving nothing for the last LET-DIGIT-CHAR to
match.


Actually, I have to admit this isn't so difficult with PARSE either.
You just have to look for sequences of any number of optional hyphens
followed by one or more alphanumerics:

 name-rule: [l any [any "-" some ld ]]
== [l any [any "-" ld]]
 parse/all "abcdef" name-rule
== true
 parse/all "abc-def" name-rule
== true
 parse/all "abc--def" name-rule
== true
 parse/all "abcdef-" name-rule
== false
 parse/all "0abcdef" name-rule
== false


See you,
Eric



[REBOL] AW: [REBOL] Dialecting...Stack Overflow ?! Re:

2000-02-15 Thread Jean . Holzammer

 -Ursprüngliche Nachricht-
 Von:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Gesendet am:  Dienstag, 15. Februar 2000 17:15
 An:   [EMAIL PROTECTED]
 Betreff:  [REBOL] Dialecting...Stack Overflow ?! Re:
 
 'head is also the name of word used a lot by REBOL. Have a look at the
 source for 'append, and you will see why.

using a reserved word is not a good idea, right ?! 

Thanks,

   Jean




[REBOL] AW: [REBOL] Dialecting...Stack Overflow ?! Re:

2000-02-15 Thread Jean . Holzammer

 -Ursprüngliche Nachricht-
 Von:  [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
 Gesendet am:  Dienstag, 15. Februar 2000 19:41
 An:   [EMAIL PROTECTED]
 Betreff:  [REBOL] Dialecting...Stack Overflow ?! Re:
 
 Hi Jean,
 
 that's a funny one.
 
 join uses append. append uses the REBOL functio head to return the series
 it appended to at its head.
 
 You redefine head to be
 
 head: func [block2] [join "HEAD" [block2 "/HEAD"]]
 
 So, what happens is whenever join is called within your functions,
 eventually head is called (the intention is to call REBOL's predefined
 head!) and instead of REBOL's head function your head function is called,
 which in turn does a join, which leads to calling head ... and you have
 happily constructed an infinite loop. :-)
 
 If you rename head to something else:
 
 html-head
 
 then you script runs (with problems), producing
 
  do %myhtml.r
 Script: "Untitled" (none)
 HTMLhtml-head title Titel body Das ist ein Text !/HTML
 
 
 Note that the next problem you encounter is that you get title Titel
 instead of your intended TITLE/TITLE and you get body Das ...
 instead of your intended BODY.../BODY.
 
 The reason you get this is that you pass the block [title "Titel"] etc.
and
 therefore title is not reduced. You need to use rejoin in your functions
 and - because the block you are passing to html consists of two embedded
 blocks, the html-head block and the body block - you need to use an
 additional reduce in addition to rejoin. Now the thing returns:
 
  do %myhtml.r
 Script: "Untitled" (none)
 HTMLHEADtitle Titel/HEAD BODYDas ist ein Text !/BODY/HTML
 
 and the complete, slightly modified code is:
 
 REBOL []
 ;definition part
 
 html: func [block1 ] [rejoin ["HTML" reduce block1 "/HTML"]]
 html-head: func [block2] [rejoin ["HEAD" block2 "/HEAD"]]
 body: func [block3] [rejoin ["BODY" block3 "/BODY"]]
 title: func [block4] [rejoin ["TITLE" block4 "/TITLE"]]
 
 ;test part
 a: html
 [
  html-head
  [
   title "Titel"
  ]
  body
  [
   "Das ist ein Text !"
  ]
 ]
 print a
  
 ;- Elan  [: - )]


Thanks a lot. Now it works :)

So if I use a block within a block I need reduce to tell rebol to evaluate
the embedded block.
But why do I need rejoin in this case ?

 join "HTML" [reduce block1 "/HTML"]

also worked as I tried it.


Theoretically,

 rejoin ["HTML" block1 "/HTML"]

should work,too. The Rebol doc says:
Rejoin: Reduces and joins a block of values.

ciao,

  Jean




[REBOL] AW: [REBOL] Dialecting...Stack Overflow ?! Re:(2)

2000-02-15 Thread Al . Bri

Andrew wrote:
 'head is also the name of word used a lot by REBOL. Have a look at the
source for 'append, and you will see why.

Jean wrote:
 using a reserved word is not a good idea, right ?!

'head is not reserved. It can be replaced like virtually all words in REBOL.
It's just that a lot of other software relies on 'head returning the head of
a series. 'head and other words with all ready defined meanings/value in
REBOL, are becoming magical.

Have a look at my %html.r at:
http://www.rebol.org
I've blazed a trail there into the HTML dialect that you're looking for.
My latest work on the HTML dialect requires REBOL/View with the new parse
block capability.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--



[REBOL] AW: [REBOL] Dialecting...Stack Overflow ?! Re:(2)

2000-02-15 Thread Al . Bri

Jean wrote:
 So if I use a block within a block I need reduce to tell rebol to evaluate
the embedded block.
 But why do I need rejoin in this case ?

join "HTML" [reduce block1 "/HTML"]

 also worked as I tried it.


 Theoretically,

rejoin ["HTML" block1 "/HTML"]

 should work,too. The Rebol doc says:
Rejoin: Reduces and joins a block of values.

Unfortunately, not quite correct as you interpret. The 'rejoin reduces and
joins this block:
["HTML" block1 "/HTML"]
NOT this block:
block1

Here's a nicer way:
rejoin [
""
HTML reduce block1 /HTML
]
Note the empty string. This returns a string, and uses REBOL native tag
values.

Of course what we really, really want is:

print HTML/Dialect [
Head [
Title "HTML/Dialect Title"
]
Body [
"Body Attributes"
][
H1 Title
center "Body Contents"
Br
"Time is:" now/time
]
]

Note the use of the word 'head, the interesting uses of the word 'title,
_optional_ inclusion of tag attributes, and the inclusion of REBOL
functions/words. This version of my HTML dialect is very, very close to
completion.

Andrew Martin
REBOlutionary solutions...
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--