On 2/20/24 4:15 PM, Bruno Haible wrote:
> It's better if this metadata is generated from gen-uni-tables.c. This
> eliminates a manual step. These patches do it.

Would it make sense to provide a macro to check if the current version
is greater than or equal to a given version? Or should that just be left
up to whoever wants to use this variable.

The person who submitted the feature request sent this example. It's
sort of a strange interface but it does the job.

UVersionInfo uver;
u_getUnicodeVersion(uver);
if (uver[0] < 12) {
        /* work around whatever was broken with
          HANGUL CHOSEONG CEONGCHIEUMSSANGCIEUC (**)
          in previous versions of unicode ...*/
}

I was thinking something like this:

#define LIBUNISTRING_UNICODE_VERSION_P(major, minor) \
  (_libunistring_unicode_version >= ((major << 8) + minor))

It works with these tests but they would fail as soon as the version is
updated...

ASSERT (LIBUNISTRING_UNICODE_VERSION_P (14, 0));
ASSERT (LIBUNISTRING_UNICODE_VERSION_P (15, 0));
ASSERT (!LIBUNISTRING_UNICODE_VERSION_P (16, 0));
ASSERT (LIBUNISTRING_UNICODE_VERSION_P (15, 0));
ASSERT (LIBUNISTRING_UNICODE_VERSION_P (15, 1));
ASSERT (!LIBUNISTRING_UNICODE_VERSION_P (15, 2));

Collin

Reply via email to