Page 1 of 1

Better way to change the string-mode

Posted: Thu Mar 09, 2006 2:25 pm
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...

Posted: Thu Mar 09, 2006 2:40 pm
by Fred
It will remove a lot of flexibility, i don't see where is the problem with the current implementation.

Posted: Thu Mar 09, 2006 2:46 pm
by Lebostein
ok, it was only an idea....