lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> And what about the UNICODE/wchar_t issue? I saw comments on that in postings
> from 98-99. It should be possible to handle that as well, shouldn't it,
> using something like the scheme Microsoft is using in their code... If there
> is something I can do to help, I will be glad to do so!

It would be nice if we could make easy in Lua to change the "char" type
to support Unicode. But I think there are many details that are difficult
to handle only through macros.

The naive approach seems like to define a type Char (or lua_char), which 
can be both char or wchar_t. We must make sure that we do not assume that 
sizeof(Char) == 1, that we have some macro to convert all 'char' and 
"string" literals to wide (something that creates the `L'), and other such 
details. Then, all functions in the API work with this new type; not only 
lua_pushstring/lua_tostring, but also lua_getglobal, etc. Most functions 
that work over char types (such as ctype.h) can be redefined with macros, 
too. That is the easy part ;-)

But there are other problems. All format strings should be parameterzided
between '%s' and '%ls'; how to do that in an easy way? Also, I think
some functions do not have a wide equivalent (for instance, fopen).
The swprintf function takes one argument more than sprintf; we cannot
handle that with macros, because they have variable number of
arguments. How to handle those things?

-- Roberto