Greg Ercolano wrote:
> matthiasm wrote:
>> Oh, which reminds me, did I mention libunicode which solves basically  
>> all of this?
>>
>> http://cvs.gnome.org/lxr/source/libunicode/ by Tom Tromey
> 
>     Is this the same one?
>     http://sourceforge.net/projects/libunicode/

    I just gave the latter a look-see.

    All the functions use Uchar* for their strings, which are all
    "typedef u_int16_t Uchar;", and not chars.

    Also, wow, I haven't seen the old 'one function per file' thing
    in a long time. I'm tempted to cat(1) them all together ;)

    But yes, they do have things like strcasecmp() et al. which
    seems efficient enough (reformatted a bit):

int uni_strcasecmp(Uchar *s1, Uchar *s2) {
  while (1) {
    if (uni_tolower(*s1) != uni_tolower(*s2)) {
      return uni_tolower(*s1) - uni_tolower(*s2);
    }
    if (!*s1) return 0;
  }
  return 0;
}

    At first I thought the missing test for !*s2 might be a bug
    (eg. if s2 was shorter than s1), but thinking about it, the
    if() would get triggered first.

    Anyway, that might be a better way to do it; walk the string
    doing single char compares with the single char function.
_______________________________________________
fltk-dev mailing list
fltk-dev@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to