Label: ♦english ♦feature request

[219] DAO_ONLY_UTF8 or similar

Comment
I read that 'string' is an UTF8 string while "string" is a WC-string.

In our game, we will only use UTF8. Always.
It would thus be really useful if there was a compiler flag that tells Dao that "string" should be UTF-8 too. Something like compiling with -DDAO_ONLY_UTF8 so that any string is always UTF8.

Or does it make more sense to define a syntax that transforms "string" into 'string', and automatically include this syntax at the beginning of every script? This feels quite hacky though.
Comments
You can use @@X(Y), such as @@PATH() @@ECHO() @@LOCALE(), @@ON(), @@OFF(), to change some of the internal settings. So far, only @@PATH() is documented here: http://daovm.net/space/dao/page/dao_quick_guide#6.3 .

Adding @@ON(MBS) in your codes will allow all "string" to be parsed as multi-byte (utf8) strings. For the rest, see this table,
@@ECHO( information_string ) print "information_string" during parsing
@@ON( MBS ) parse all strings as multi-byte (utf8) strings
@@ON( WCS ) parse all strings as wide character strings
@@OFF( MBS ) turn off the @@ON( MBS ) setting
@@OFF( WCS ) turn off the @@ON( WCS ) setting
@@LOCALE( locale ) set the locale of the program to "locale"
@@PATH( + path ) add path to the path list for module searching
@@PATH( - path ) remove path from the path list for module searching

I see, nice to know there is such a feature. But to enable it with @@ON(MBS), this has to be done in the script, right? How can I enable this feature in my application?

I digged into the code and found out that it can probably be done by the following:
vms  =  DaoInit();
vms->options  |=  DAO_EXEC_MBS_ONLY;
Is this the correct way to do it, or is there another (better) way?
That's the correct way to do it in your application. It is for all scripts, as long as vms is the only DaoVmSpace struct you use to handle the scripts.

Change picture:

Choose file:

123 4
56 78910 11
121314151617 18
192021222324 25
26272829

fu: ... I forgot to say something about the plan for the whole new year in my previous reply. Well, besides w ... (Jan.19,01:40)

fu: ... Happy new dragon year (which will start from this sunday)! Actually, it was a busy month (I wish th ... (Jan.18,22:46)

ybabel: What's the plan for the new year ? Hello 'vry budy :- ) happy new year (when is the new year for you Fu ?) I saw you come back and comm ... (Jan.18,18:59)

This site is powered by Dao
Copyright (C) 2009,2010, daovm.net.
Webmaster: admin@daovm.net