[REBOL] using awake?

2002-06-15 Thread Volker Nitsch

Hi all,

i need a tcp-handler which is started/stopped by a button.
now there is already a do-events running,
an own wait is bad.
so i want to use port/awake to process a tcp-request and respond a result.
and not to stop the do-events.
would this work, and how do i use 'awake?

greetings
Volker

--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the
subject, without the quotes.




[REBOL] Re: generating XML ?

2002-06-15 Thread Cybarite

In the rebol script library
http://www.reboltech.com/library/library.html pick the table entry HTML/XML
Related

there is an entry XMLGEN.r dated 4-Jun-1999 which takes a REBOL block
structure like

example: [
movie [
title Star Trek: Insurrection
star  Patrick Stewart Brent Spiner
theater [
theater-name MonoPlex 2000
showtime 14:15 16:30 18:45 21:00
price [
adult $8.50
child $5.00
]
]
theater [
theater-name Bigscreen 1
showtime 19:30
price $6.00
]
]
]

and generates XML from it

movie
titleStar Trek: Insurrection/title
starPatrick Stewart/star
starBrent Spiner/star
theater
theater-nameMonoPlex 2000/theater-name
showtime14:15/showtime
showtime16:30/showtime
showtime18:45/showtime
showtime21:00/showtime
price
adult$8.50/adult
child$5.00/child
/price
/theater
theater
theater-nameBigscreen 1/theater-name
showtime19:30/showtime
price$6.00/price
/theater
/movie

which you may find adequate. I don't think it will compete with what Andrew
is offering but might be a gentle start on what you need to accomplish. I
used it when I needed just to get some sample XML structures out for
discussion and was able to change the REBOL structure more easily then the
XML.  It is just freeing you from the start long tag/end long tag
tedium ... but that may be what you are after.

No reply is needed either way.

- Original Message -
From: Jason Cunliffe [EMAIL PROTECTED]

 What do you suggest for writing XML from REBOL, in particular exporting
REBOL
 blocks and nested blocks as XML? I can only seem to find some cool tools
for
 import [parsing]


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.




[REBOL] Re: generating XML ?

2002-06-15 Thread Joel Neely

Hi, Jason,

Jason Cunliffe wrote:
 
 I need to generate XML from REBOL...
 

Do you mean from arbitrary REBOL block structures, or from block
similar in structure to the output of PARSE-XML?

If the latter, here is some work-in-progress that might be of
interest:

8--
xml-lib: make object! [

q1: to-char 39 ; single quote
q2: to-char 34 ; double quote

_xentities: reduce [
 amp;
 lt;
 gt;
q2  quot;
]

_xescape: func [s [string!] /local r] [
r: copy s
foreach [chr ent] _xentities [replace/all r chr ent]
r
]

_xenquote: func [s [string!] /local q] [
rejoin [
q: either find s q2 [
either find s q1 [ s: _xescape s q2 ][ q1 ]
][
q2
]
s q
]
]

_xformattrs: func [a [block! none!] /local r] [
r: copy 
foreach [name value] any [a []] [
repend r [  name {=} _xenquote value]
]
r
]

_xform: func [b [block!] pre [string!] /local r c d] [
r: copy 
append r rejoin [pre  first b _xformattrs second b]
either none? c: third b [
append r rejoin [ / newline]
][
append r 
either all [
1 = length? c
string? d: first c
60 = length? d
newline  last d
][
append r rejoin [
_xescape d / first b 
newline
]
][
append r newline
foreach item c [
append r either string? item [
rejoin [item newline]
][
_xform item join  pre
]
]
append r rejoin [pre / first b  newline]
]
]
r
]

xform: func [b [block!]] [
_xform either word? first b [first third b] [b] 
]

xtrim: func [b [block!] /local b3 b31] [
if found? b3: third b [
while [not empty? b3] [
either string? b31: first b3 [
either empty? trim/head/tail b31 [
remove b3
][
b3: next b3
]
][
xtrim b31
b3: next b3
]
]
if empty? head b3 [
b/3: none
]
]
b
]

]
8--

XML-LIB/XTRIM removes the ignorable whitespace from the content
of an XML-derived block structure, as in this case:

 foo: {
{drill model=DB-375
{motor rating=0.25h /
{chuck size=0.375 /
{description
{A wonderful Father's Day gift idea!  On sale now!
{/description
{price wholesale=27.45 retail=49.95 /
{/drill
{}
== {
drill model=DB-375
motor rating=0.25h /
chuck size=0.375 /
description
A wonderful Father's Day gift idea!  On s...

 bletch: parse-xml foo

after which BLETCH has the following structure (reformatted for
email):

[document none [
[drill [model DB-375] [
^/
[motor [rating 0.25h] none]
^/
[chuck [size 0.375] none]
^/
[description none [
{^/A wonderful Father's Day gift idea!  On sale now!^/}
]]
^/
[price [wholesale 27.45 retail 49.95] none]
^/
]]
]]

where the extra newlines (for example) are not relevant to the data-
oriented content.  We can say

xml-lib/xtrim bletch

to tidy up the content of BLETCH as follows:

[document none [
[drill [model DB-375] [
[motor [rating 0.25h] none]
[chuck [size 0.375] none]
[description none [
A wonderful Father's Day gift idea!  On sale now!
]]
[price [wholesale 27.45 retail 49.95] none]
]]
]]

Since this is still in the canonical XML-as-blocks form, we can say

 print xml-lib/xform bletch
drill model=DB-375
motor rating=0.25h /
chuck size=0.375 /
descriptionA wonderful Father's Day gift idea!  On sale
 now!/description
price wholesale=27.45 retail=49.95 /
/drill

(note that the description wrapped, the max length is tweakable).

OTOH, we can start with a block structure of the same scheme:

glorp: [
computer
[owner dilbert]
[   [
cpu
[model athlon speed 4.5GHz]
[]
]
[
ram
[type ddr size 4096Mb]
[]
]
[
disk
[size 512Gb speed 

[REBOL] Re: using awake?

2002-06-15 Thread Gabriele Santilli

Hi Volker,

On Saturday, June 15, 2002, 2:18:39 PM, you wrote:

VN so i want to use port/awake to process a tcp-request and respond a result.
VN and not to stop the do-events.
VN would this work, and how do i use 'awake?

Yes,  it will. You need to add your port to system/ports/wait-list
so  that it is waited for by DO-EVENTS. Then, you need to write an
handler:

port/awake: func [port /local data] [
; there's something in port
; with no-wait you could:
while [not empty? data: copy port] [prin data]
; you should return TRUE or FALSE
;  TRUE: the WAIT function should return
; FALSE: continue waiting
false
]

This is almost all.

Regards,
   Gabriele.
-- 
Gabriele Santilli [EMAIL PROTECTED]  --  REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.




[REBOL] news for my new life with linux

2002-06-15 Thread pat665

Hi rebollers

Here are some news from my new life with linux and rebol.

Good news :
- I like doing mysql with DocKimbel mysql-protocol.
- It's ok with CGI too.

Bad news:
- Oh My God, Rebol is so slow with linux. Especially the Desktop Editor, it
is almost U-N-U-S-A-B-L-E ! I have to go back to Windows 98 to edit my
script.

How come that on the same machine (I have a dual boot) the editor is so slow
under linux ?
Was all the linux is a full-32-bytes system and so on ... only bullshit?

Patrick

PS: I am using Mandrake 8.2 with minimal X-Windows (no KDE, no Gnome) on a
dual boot linux/98 Pentium 200 with 64 Mo RAM).

 
__
ifrance.com, l'email gratuit le plus complet de l'Internet !
vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP...
http://www.ifrance.com/_reloc/email.emailif


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.




[REBOL] Re: news for my new life with linux

2002-06-15 Thread Joanna Kurki

At 18:57 15.6.2002 +0200, you wrote:
Hi rebollers

Here are some news from my new life with linux and rebol.

Good news :
- I like doing mysql with DocKimbel mysql-protocol.
- It's ok with CGI too.

Bad news:
- Oh My God, Rebol is so slow with linux. Especially the Desktop Editor, it
is almost U-N-U-S-A-B-L-E ! I have to go back to Windows 98 to edit my
script.

How come that on the same machine (I have a dual boot) the editor is so slow
under linux ?
Was all the linux is a full-32-bytes system and so on ... only bullshit?

Nope. LInux kernel itself is very efficient and runs all services faster 
than Win98 (ok, things like 3D-GFX might be slower, but networking, files 
etc are definitely faster), besides it keeps on runing stable months 
without need for reboots ...

I suspect this is more problem on Rebol. I have not seen different versions 
of Rebol tested for speed, but I assume there is some nonoptimal code 
inside Rebol causing slowdown on Linux.


Patrick

PS: I am using Mandrake 8.2 with minimal X-Windows (no KDE, no Gnome) on a
dual boot linux/98 Pentium 200 with 64 Mo RAM).

Check amount of free memory .. If you Linux goes to Swap, it slows down 
considerably. It should not, but some Xwindow configurations may cause too 
much memory usage.. I would recommend increasing to 128MB..  Also some 
GFX-cards are not so well supported on Linux,... might be worth checking..



-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.




[REBOL] Re: news for my new life with linux

2002-06-15 Thread Chris

On 15-Jun-02, pat665 wrote:


 PS: I am using Mandrake 8.2 with minimal X-Windows (no KDE, no Gnome) on a
 dual boot linux/98 Pentium 200 with 64 Mo RAM).

Define minimal X-Windows - which window manager are you using? Blackbox,
Ice, Enlightenment? And what is your graphics card - if you are using any
NVidia chipset based cards you need to download and install the kernel
module off nvidia.com to get any form of acceleration (the
reverse-engineered nvidia driver is deathly slow). If it isn't an NVidia
card, check that your card is properly recognised and that you aren't
running in a famebuffer. 

Chris
-- 
 .--{ http://www.starforge.co.uk }-. .---.
=[ Explorer2260, Designer and Coder \=\ P: TexMaker, ROACH, site  \
=[___You_will_obey_your_corporate_masters___]==[ Stack: EETmTmTRRSS--- ]
May your Tongue stick to the Roof of your Mouth with the Force of a
Thousand Caramels.

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.




[REBOL] General REBOL questions

2002-06-15 Thread Brian

Hello,
I've been looking into REBOL/View recently and it looks really terrific. 
 I have some generic questions if someone knowledgable has a moment:

1) As everything in REBOL is compiled into a single executable (no 
seperate modules) and as more and more protocols, language enhancements, 
etc. are added, will the single executable ever get to the point where 
it's too large?  Just keep getting bigger and bigger.  At what point 
would it become too large and cumbersome?

2) How are obsolete features/protocols being retired?  e.g. if REBOL 
supports a protocol that no one uses enough anymore to justify it being 
in the executable, will they keep it in there indefinitely for backwards 
compatibility or are they removing/retiring those types of features with 
new versions?

3) When I fire up REBOL it brings up the REBOL desktop.  I assume the 
desktop is a REBOL script, but is this script imbedded into the 
executable itself?  If so, what if you want to modify it?  Shouldn't 
there just be some kind of default startup-script defined and the user 
can make that whatever they want without burdening the executable with a 
built-in script that they may not want to use anyways?

4)  I did a search on Dice.com and didn't find 1 job for REBOL. 
 Hopefully their new licensing terms I read about in the archives of 
this mailing list will change that.  More Java-like licensing where 
REBOL still controls the design but developers are allowed to use it 
freely for commercial purposes.  REBOL would then make their money 
licensing REBOL and associated applications to larger corporations for 
commercial purposes.


FYI - REBOL/View is already pretty tiny, so for the fun of it I 
compressed it with the UPX executable packer and it shrank significantly 
more!  It shrank from 503KB to 313KB!  (38% smaller!)   Here's the 
address for UPX: http://upx.sourceforge.net/

Thanks!
Brian


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.




[REBOL] Re: General REBOL questions

2002-06-15 Thread Carl Read

On 16-Jun-02, Brian wrote:

Hi Brian,

Welcome to the REBOL List.

A lot of tricky questions there. (:  I'll have a go at one of them,
anyway.  (And I'm sure the others will get answers as well.  They're
not all new questions, I assure you.)

 3) When I fire up REBOL it brings up the REBOL desktop. I assume the
 desktop is a REBOL script, but is this script imbedded into the
 executable itself? If so, what if you want to modify it? Shouldn't
 there just be some kind of default startup-script defined and the
 user can make that whatever they want without burdening the
 executable with a built-in script that they may not want to use
 anyways?

I think the Desktop script is loaded when you launch View, though I'm
not absolutely sure about that.  But I believe it's quite small so I'd
guess it wouldn't use up too many resources.

However, it's easy to make it so View launches to just the Console,
not the Desktop.  Just change the...

desktop: true

line in View's prefs.r file to...

desktop: false

and the Desktop won't display.  (Entering Desktop in the Console
will still allow you to run it if you want to though.)

As to a default startup-script, there is one.  Look for a file called
user.r.  (It and the prefs.r file should be where you installed
View.)  You can have that launch any scripts you like at startup. 
Make a backup of the original though of course, to prevent any
modifications you make to it mucking up the way View launches for you.

Hope that's of some help.

-- 
Carl Read

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with unsubscribe in the 
subject, without the quotes.