'ABCDEFGH' quad sed availability on unicode mode

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

'ABCDEFGH' quad sed availability on unicode mode

Post by Olliv »

Now, eight characters quad set are unabled on unicode mode.
We can just type 'ABCD' what is a very limitating type.

Is it possible to truncate natively high 8 bits set and gain this by type 8 characters instead of 4 ?
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: 'ABCDEFGH' quad sed availability on unicode mode

Post by Josh »

How should this work?

At the moment you can use 4 characters in unicode mode and this is a quad (65536 * 65536 * 65536 * 65535)
Olliv wrote:Is it possible to truncate natively high 8 bits?
No, it's not possible. How would you show e.g. x/u = '€' in this case?


As far as I know, in Java is only one character allowed for character literals and this should be enough.
sorry for my bad english
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: 'ABCDEFGH' quad sed availability on unicode mode

Post by Lunasole »

Here is some related stuff by Wilbert.
Of course can also use some macro to "pack" quad, but that looks better as for me

Code: Select all

; an example of infinite-lenght ASCII strings in unicode executable
DataSection
  MyStr:
  !db '12345678901234567890123456789012345678901234567890123456789012345678901234567890'
  !db 13, 10
  !db 'ggggggggggggggggggggggggggggggggggggggggggggggggggg'
  !db 0
EndDataSection

Debug PeekS(?MyStr, -1, #PB_Ascii)
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: 'ABCDEFGH' quad sed availability on unicode mode

Post by wilbert »

Lunasole wrote:Of course can also use some macro to "pack" quad
A macro is actually a good idea if you need it for constants.

Code: Select all

CompilerIf #PB_Compiler_Unicode
  Macro _C(c)
    (((c)>>16|(c)>>24&$ffff0000)|((c)|(c)>>8&$ffff))
  EndMacro
CompilerElse
  Macro _C(c)
    (c)
  EndMacro
CompilerEndIf

Macro _C2(ch, cl)
  (_C(ch)<<32|_C(cl))
EndMacro

#Tiff = _C('Tiff')
#Jpeg = _C('Jpeg')
#JpegEnc_ = _C2('Jpeg','Enc_')

Debug Hex(#Tiff)
Debug Hex(#Jpeg)
Debug Hex(#JpegEnc_)
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
Olliv
Enthusiast
Enthusiast
Posts: 542
Joined: Tue Sep 22, 2009 10:41 pm

Re: 'ABCDEFGH' quad sed availability on unicode mode

Post by Olliv »

After a time of thinking, this wish is too hard to be integrated.

@Josh

That is not exactly the using I did as put a '€' char.
'€' was 'EURO' simply.
I use it to put a readable word\expression as 'BLANC', 'BLEU', 'ROUGE', 'VERT', 'NOIR', etc...

For english\american coders 'WHITE', 'BLACK', 'RED', 'GREEN', 'BLUE', etc...

For german 'WEISS', 'BLAU', 'ROT', etc...

Here I take colours example, but there is x examples or domains. And I limit my example to only 3 languages too.

But if PureBasic Team changed the 'Expr' quotes adding a truncating converter from Unicode to Ascii just inside these specific quotes, I forget how could chinese coders, or japanese coders (limiting my examples to only 2 languages) to code.

Code: Select all

Select Alpha
   Case '蓝'
       BlueSet()
   Case '黑'
       BlackSet()
   Case '绿'
       RedSet()
EndSelect
I doubt my wish would be really fair.

And finally, 'EURO' could be '€' more quickly and others usual symbols too...
:wink:
Post Reply