• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Gerard
28-Jul-2013
[9710x2]
It's used as my first step to get some code translation on the Perl 
Cookbook (pleac project ). the first exercises are about strings. 
I encoded the small snippets using Rebol 2 already and now I was 
testing the same code for Red and later I 'll attack the same for 
Rebol 3. I'll then submit in the REBOL SCHOOL  or another dedicated 
group this first trial for revision and correction. May be their 
introduction could aslo be revised to ttake into account Rebol and 
/or Red internals subtleties which I don't really master... yet!
Even the Windows help was not useful since they state that  some 
installed programs can't display the foreign UNICODE characters. 
In this cas they simply offer me to select the language in which 
these characters will be displayed. I selected French since it was 
already selected and since it is convenient to me if I want to understand 
anything displayed here !!!
Pekr
28-Jul-2013
[9712]
IIRC Red console does not support Unicode yet ...
Gerard
28-Jul-2013
[9713]
OK thanks. But then how could Doc test his Hello.red output ?
Pekr
28-Jul-2013
[9714x2]
Compiled?
But I might get it confused, so better wait for Doc or Kaj to appear 
:-)
Gerard
28-Jul-2013
[9716x9]
Yes it seems logical. I will try it then!
I also get some ? instead of the chars that Word is displaying ! 
May be our american products can't display this correctly from the 
Win Console too ...
Except if we change the regional language to be able to dusplay it 
but then I'll have to chage it for every foreign language and this 
is not the good way to go I hope !!!
May be that the character sets offerd for selection under the properties 
tab of the Win console don't offer this display choice but I don't 
know how to install others. Currently I only have True Type Lucida 
Console, True type Consolas and Raster... : (
Will look further in Windows Help - for how to install other char 
sets under the Win console ...
It' located under the Panneau de configuration (accessible using 
MSConfig) but the problem I have is that I don't have the admin privilege 
to add such a char set - I found one which is described as ARIAL 
MS UNICODE which could do the job. I'll try again...
;-----------------------------
mystr: "^/"        ; a newline character
print "test-1" probe mystr print length? mystr

mystr: "^(line)"   ; a newline character (alternative)
		     ; last one is converted into "^/"
print "test-2" probe mystr print length? mystr

mystr: "\n"        ; two characters, \ and n
print "test-3" probe mystr print length? mystr

;-----------------------------
mystr: "Jon 'Maddog' Orwant"  ; literal single quote inside 
                              ; double quotes
print "test-4" probe mystr print length? mystr

mystr: {Jon "Maddog" Orwant}  ; literal double quote inside 
                              ; braces (also used for multilines)
print "test-5" probe mystr print length? mystr
;-----------------------------
mystr: {
This is a multiline string literal
enclosed in single braces.
}
print "test-6" probe mystr print length? mystr

mystr: "^(line)"   { a newline character (alternative)
		      the last one is converted into "^/" by Rebol}
print "test-7" probe mystr print length? mystr

;-----------------------------

; There si no way to change the delimiters for strings
; No way either to define strings using "Here Documents" form

;-----------------------------
The last snippet of code was some test I did for verifying how the 
strings behaviour are similar between Rebol 2 and Red. Look by yoursel 
and you'll see some small difference for the Escaped characters which 
are interpreted differently. Was this supposed to be so Doc ? Just 
asking before posting my tests for revision and correction ...
The tests evaluated here are based on the Perl string related features 
which appear on the Perl Cookbook (pleac website).
DocKimbel
28-Jul-2013
[9725x4]
How do we install support for Unicode when using a Windows console 
?
 


You just need to select Lucida or Consolas font, raster font has 
no Unicode support. The CJK plans are not supported anyway by those 
fonts AFAIK.
The console script for Red supports only ASCII input.
You compile the script for full Unicode support for now.
You <should> compile...
Gerard
28-Jul-2013
[9729]
hello
DocKimbel
28-Jul-2013
[9730x2]
Hey Gerard :)
For named characters like "^(line)", IIRC, we don't support it yet.
Gerard
28-Jul-2013
[9732x5]
It seems I already did it without having seen the right results but 
now it works ... : )
OK For your information about what I have done today for the introduction 
to the Perl Cookbok  just go to the REBEL BB forum and see my last 
post, it will be quicker to judge by yourself. - please you can comment 
too if you have some time. but LEt the others do the real work for 
revision and correction please.
I noticed your answer for the escaped chars
Is it the same for the other codes given in the Rebol 3 doc ? as 
for example when I type #"^(3B1)"     in the Red console, I get some 
errors too ...
I suppose it is the same case as the one before ...
DocKimbel
28-Jul-2013
[9737]
when I type #
^(3B1)"     in the Red console, I get some errors too ..."

The console script for Red supports only ASCII input. :-)
Gerard
28-Jul-2013
[9738x3]
OK but in a sense what I typed is in full ASCII, isn't ?
Thanks Doc and I leave you now - going "à la soupe"... You will soon 
go to bed too I suppose.
Glad you came back already and safe
DocKimbel
28-Jul-2013
[9741]
Yes, you input ASCII characters, but the runtime lexer needs to decode 
your Unicode codepoint in hex format, and the lexer has no support 
for that.
Gerard
28-Jul-2013
[9742]
OK that's already fine as is for now.
DocKimbel
28-Jul-2013
[9743]
Right, I'm not far from going to bed. ;-)
Gerard
28-Jul-2013
[9744x2]
Keep up the good work - i'll support you by means of other donations, 
as soon as my next cheque is coming in.
Must go back to some real work now - I just played all the day with 
these other websites and books ...
DocKimbel
28-Jul-2013
[9746]
Thanks Gerard! I'll have a look at your posts on RebelBB and will 
send you my comments, if any.
Arnold
28-Jul-2013
[9747]
Results for the initialized state-table are now the same, finally. 
Thanks!
Arnold
29-Jul-2013
[9748x2]
Red/System: Could it be that if you 
#define MAX-SIZE 100
my-array: as int-ptr! allocate MAX-SIZE * size? integer!
then using  
my-array/MAX-SIZE 
gives a compilation error??
*** Compilation Error: undefined pointer index variable
Probably food for an issue?
DocKimbel
29-Jul-2013
[9750]
I remember that we allowed macro replacement in paths, but it might 
be only for macros with parameters. Have you found an existing ticket 
about that?
Arnold
29-Jul-2013
[9751]
doesn't look like it.
Kaj
29-Jul-2013
[9752x4]
That may indeed very well have been only about macro parameters
You could work around it:
i: MAX-SIZE
my-array/i
Arnold
29-Jul-2013
[9756x2]
Right but then I have a #define macro AND a variable. So I had better 
started of with the variable in this case.
But is really is a constant.
Kaj
30-Jul-2013
[9758]
Yes, it's imperfect
Arnold
30-Jul-2013
[9759]
That is why I created an issue for it #504.