parser for rebel player
[1/4] from: inetw3:mindspring at: 9-Jul-2002 22:22
Hello Reboler's
I completed a GUI parser for a java rebelet player
(the java+activeX rebelet players' made allready)
and i would like to know if anyone could tell me
how to format what i print out one tag or key = value per
line to a string or block to save as a file.
example:
print {<REBEL_EMBEDLET VERSION=0.1>
<PROPERTIES>}
PRINT rejoin["SIZE=" getsize1 {,} getsize2]
print {BACKCOLOR=142,128,110
NOICONS=TRUE
</PROPERTIES>} etc.
Calling print works but i want to save to a file.
I need:
<REBELEMBEDLET VERSION=1.1>
SIZE=200x100
BACKCOLOR=142,128,110
NOICONS=TRUE
</PROPERTIES> etc.
but:
append myblock {<REBELEMBEDLET VERSION=1.1>
<PROPERTIES>}
append myblock rejoin["SIZE=" getsize1 {,} getsize2]
append myblock {BACKCOLOR=142,128,110
NOICONS=TRUE
</PROPERTIES>} etc.
gives me:
<REBELEMBEDLET VERSION=1.1>SIZE=200x100
BACKCOLOR=142,128,110NOICONS=TRUE </PROPERTIES> etc.
any answeres are welcome.
[2/4] from: anton:lexicon at: 10-Jul-2002 17:25
Hi, try this program:
//////////////////////////////////
text: copy "" ; a new string
; when you insert into a string (which is what append does),
; the value gets converted to a string, or whatever datatype
; the first argument is. So this reduced block becomes a string.
append text reduce [
<REBEL_EMBEDLET VERSION=0.1> newline
<PROPERTIES>
]
getsize1: 200
getsize2: 100
append text rejoin [newline "SIZE=" getsize1 {,} getsize2]
append text {
BACKCOLOR=142,128,110
NOICONS=TRUE
</PROPERTIES>
}
file: %afile.txt
write file text
print read file ; read it back in to test it
delete file ; clean up
/////////////////////////
By the way, I think it's "reblet".
And it should be "REBOL_EMBEDLET".
Sounds like good stuff.
Anton.
[3/4] from: al::bri::xtra::co::nz at: 10-Jul-2002 19:51
Try something like this:
myblock: make block! 10
append myblock <REBELEMBEDLET VERSION=1.1>
append myblock <PROPERTIES>
append myblock rejoin["SIZE=" getsize1 {,} getsize2]
append myblock {BACKCOLOR=142,128,110}
append myblock "NOICONS=TRUE"
append myblock </PROPERTIES>
write/lines %MyFile.txt myblock
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[4/4] from: dmurrill:mindspring at: 10-Jul-2002 22:26
Thanks alot Anton and Andrew, i was doing both
of your example but i did'nt know i could wrap
some strings with " " and some with { },
and i i was putting the "newline" after the append.
I wish i could have found that in the RT docs or Rebol
Guide book.