stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Travis Vitek" <Travis.Vi...@roguewave.com>
Subject RE: [Stdcxx Wiki] Update of "LocaleLookup" by TravisVitek
Date Thu, 27 Mar 2008 19:42:30 GMT
>
>Look at you: you've become a regular wiki formatting artist! ;-)
>

Yup. I'm getting used to clicking through the Wiki formatting guide.

>> + || Test || Criteria ||
>
>Great breakdown. I assume the Criteria are the current conditions.
>We should also try to come up with the ideal conditions that we'll
>want to implement using the new API.

Yeah, that is the hard part.

>> + || 22.LOCALE.CODECVT.MT.CPP || *1,+ ||
>
>Any particular reason these names are all caps? :)
>

That is just the format of the output that I got when gathering the names
of all tests that use `rw_locales()'

>> + || 22.LOCALE.CODECVT.OUT.CPP || *2 ||
>
>IIRC, this test tries to exercise all values of MB_CUR_MAX, not
>just the largest.
>

Nope. It calls a function named `find_mb_locale()' which looks through the
list of installed locales for the one that has the largest return from the
function `get_mb_chars()'. The comment from `find_mb_locale()' says...

   finds the multibyte locale with the largest MB_CUR_MAX value and
   fills consecutive elemenets of the `mb_chars' array with multibyte
   characters between 1 and MB_CUR_MAX bytes long for such a locale

>> + || 22.LOCALE.CONS.MT.CPP || *1,+ ||
>> + || 22.LOCALE.CTYPE.CPP || *2 ||
>> + || 22.LOCALE.CTYPE.IS.CPP || *2 ||
>> + || 22.LOCALE.CTYPE.MT.CPP || *1,+ ||
>> + || 22.LOCALE.CTYPE.NARROW.CPP || *2 ||
>> + || 22.LOCALE.CTYPE.SCAN.CPP || *2 ||
>> + || 22.LOCALE.CTYPE.TOLOWER.CPP || *2 ||
>> + || 22.LOCALE.CTYPE.TOUPPER.CPP || *2 ||
>
>I thought the ctype tests were being run in all installed locales,
>just like the numpunct one? Which is what we want to move away from.
>IMO, exercising a small set (less than a dozen) of known locales and
>encodings should be plenty.
>

Yes, the non-mt ctype tests iterate over each locale for which the function
call `setlocale (LC_CTYPE, name)' succeeds. The mt ctype tests all limit
the number of tested locales to 32.

>> + || 22.LOCALE.TIME.GET.CPP || *5,6 ||
>
>I think in the time tests we look for a locale using a specific
>language (e.g., Danish, English, German). The encoding doesn't
>really matter, unless we throw in some Asian language as well.
>Grepping for the locale using a regular expression was the best
>we could do using the old interface. I suppose we'll still be
>using a regular expression with the new API, unless you have
>support for just language names (e.g., "da, de, en").
>

Yes. Using the grammar from the Wiki page, you can get the name of a single
Danish language locale for any country, codeset or MB_CUR_LEN value using
the following call...

  const char* name = rw_locale_query (LC_TIME, "da-*-*-*", 1);

If, as an enhancement, we wanted to allow the user to provide just the
language name, or language and country, we could probably do that.

Travis

Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message