unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Thien-Thi Nguyen <ttn@gnuvola.org>
To: bug-guile@gnu.org
Subject: Re: string-ci* oddity
Date: Mon, 02 Feb 2009 01:00:22 +0100	[thread overview]
Message-ID: <87iqntzp0p.fsf@ambire.localdomain> (raw)
In-Reply-To: 873ag2igdi.fsf@ambire.localdomain

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	other threads:[~2009-02-02  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-19 14:55 string-ci* oddity Bill Schottstaedt
2009-01-02  2:36 ` Thien-Thi Nguyen
2009-02-02  0:00   ` Thien-Thi Nguyen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87iqntzp0p.fsf@ambire.localdomain \
    --to=ttn@gnuvola.org \
    --cc=bug-guile@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).