bug-guile
[Top][All Lists]
Advanced

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

Re: string-ci* oddity


From: Thien-Thi Nguyen
Subject: Re: string-ci* oddity
Date: Mon, 02 Feb 2009 01:00:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

FYI, below is the code that all ci comparison
funcs will be using in the next Guile 1.4.x release.

This means, for example:
(char-ci<? #\a #\_) => #f.

thi


___________________________________________________________________
// libguile/chars.c

#define ISLOWER(c)  (islower (c) ? (1 + c - 'a') : 0)
#define ISUPPER(c)  (isupper (c) ? (1 + c - 'A') : 0)

static int
ccmp_ci (int x, int y)
{
  int lx, ux = 0, ly, uy = 0, rv;

  rv = ((! ((lx = ISLOWER (x)) || (ux = ISUPPER (x))))
        ||
        (! ((ly = ISLOWER (y)) || (uy = ISUPPER (y)))))
    /* One or both do not satisfy `isalpha'; subtract directly.  */
    ? (x - y)
    /* Both satisfy `isalpha'; subtract in one domain or another.  */
    : (lx
       ? (lx - (ly
                ? ly
                : uy))
       : (ux - (uy
                ? uy
                : ly)));
  return !rv
    ? 0
    : (GOOD (rv)
       ?  1
       : -1);
}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]