[fpc-devel] ansistring <--> widestring conversion

peter green plugwash at bircd.org
Fri Mar 11 04:33:26 CET 2005


i post here a heavilly modified version of the widestring code (and a couple
of files from the xml code that depend on it)

i have made the ansi <--> wide conversion routines take a buffer and length
as input but make the return in an ansistring/widestring var parameter i
believe this gives a good compromise between performance and flexibility
(most other ways of returning a variable length string are hacky to say the
least) furthermore i think the cases where the output isn't being put into
an ansistring or widestring will be very rare anyway.

i also made the default/fallback conversion do a direct mapping of all
values up to 255 rather than just up to 127 and made it use a ? rather than
a space to replace unknown codes.

this code seems to all compile ok but for some reason some gtk2 stuff has
suddenly failed on me (which since grep didn't turn up anything widestring
related seems very strange) preventing me from completing a make all. im not
sure if this happens with the unmodified snapshot as well. the code has had
no functional testing yet (does anyone know how to fun a modified compiler
through the testsuite?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmlwrite.pp
Type: application/octet-stream
Size: 13530 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050311/b6a9d4da/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wstrings.inc
Type: application/octet-stream
Size: 39218 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050311/b6a9d4da/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wstringh.inc
Type: application/octet-stream
Size: 4649 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050311/b6a9d4da/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xmlread.pp
Type: application/octet-stream
Size: 37592 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20050311/b6a9d4da/attachment-0003.obj>


More information about the fpc-devel mailing list