Better way to change the string-mode

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Lebostein
Addict
Addict
Posts: 826
Joined: Fri Jun 11, 2004 7:07 am

Better way to change the string-mode

Post by Lebostein »

The new Flag in some functions to change the string-mode is nonpractical (e.g. to set the length=-1 in some functions):

Code: Select all

Result = CompareMemoryString(*String1, *String2 [, Mode [, Length [, Flags]]])
Result = MemoryStringLength(*String [, Flags])
Text$ = PeekS(*MemoryBuffer [, Length [, Flags]])
PokeS(*MemoryBuffer, Text$ [, Length [, Flags]])
Text$ = ReadString(#File [, Flags])
WriteString(#File, Text$ [, Flags])
WriteStringN(#File, Text$ [, Flags])

  #PB_Ascii  : Read\Write\Compares the strings as ascii, even when the program is compiled in unicode mode
  #PB_UTF8   : Read\Write\Compares the strings as UTF8 (the program can be either in unicode or ascii mode)
  #PB_Unicode: Read\Write\Compares the strings as unicode string, even when the program is compiled in ascii mode
Better way - remove all these new parameters and add a new function like DrawingMode(Mode) or UseBuffer():

For example "StringMode(Mode)" or UseStringSystem(Mode) with the constants:

#PB_Default - Default Mode
#PB_Ascii : Read\Write\Compares the strings as ascii, even when the program is compiled in unicode mode
#PB_UTF8 : Read\Write\Compares the strings as UTF8 (the program can be either in unicode or ascii mode)
#PB_Unicode: Read\Write\Compares the strings as unicode string, even when the program is compiled in ascii mode

So you can set this in the first lines of your code or when you want...
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

It will remove a lot of flexibility, i don't see where is the problem with the current implementation.
Lebostein
Addict
Addict
Posts: 826
Joined: Fri Jun 11, 2004 7:07 am

Post by Lebostein »

ok, it was only an idea....
Post Reply