From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.lisp.guile.bugs Subject: Re: string-ci* oddity Date: Mon, 02 Feb 2009 01:00:22 +0100 Organization: sometimes Message-ID: <87iqntzp0p.fsf@ambire.localdomain> References: <20081219145350.M61823@ccrma.Stanford.EDU> <873ag2igdi.fsf@ambire.localdomain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233533090 19620 80.91.229.12 (2 Feb 2009 00:04:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Feb 2009 00:04:50 +0000 (UTC) To: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Feb 02 01:06:04 2009 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LTmJu-0004Gq-Up for guile-bugs@m.gmane.org; Mon, 02 Feb 2009 01:05:57 +0100 Original-Received: from localhost ([127.0.0.1]:42697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTmIc-00047T-FF for guile-bugs@m.gmane.org; Sun, 01 Feb 2009 19:04:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LTmIX-00046I-Ok for bug-guile@gnu.org; Sun, 01 Feb 2009 19:04:21 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LTmIW-00045Y-0q for bug-guile@gnu.org; Sun, 01 Feb 2009 19:04:21 -0500 Original-Received: from [199.232.76.173] (port=50845 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LTmIV-00045Q-RY for bug-guile@gnu.org; Sun, 01 Feb 2009 19:04:19 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:59632 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LTmIV-0002m3-AO for bug-guile@gnu.org; Sun, 01 Feb 2009 19:04:19 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LTmIT-0003f0-FP for bug-guile@gnu.org; Mon, 02 Feb 2009 00:04:17 +0000 Original-Received: from host179-22-dynamic.24-79-r.retail.telecomitalia.it ([79.24.22.179]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Feb 2009 00:04:17 +0000 Original-Received: from ttn by host179-22-dynamic.24-79-r.retail.telecomitalia.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 Feb 2009 00:04:17 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 39 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: host179-22-dynamic.24-79-r.retail.telecomitalia.it User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:/xA/8VREP/8wRwH/jDvhj5CfhC8= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4166 Archived-At: 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 #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); }