Xref: utzoo comp.sys.ibm.pc:16809 comp.binaries.ibm.pc.d:490 comp.emacs:3722
Path: utzoo!utgpu!water!watmath!clyde!skep2!wcs
From: wcs@skep2.ATT.COM (Bill.Stewart.)
Newsgroups: comp.sys.ibm.pc,comp.binaries.ibm.pc.d,comp.emacs
Subject: Re: US PC programmers still live in a 7-bit world!
Message-ID: <168@skep2.ATT.COM>
Date: 29 Jun 88 18:30:46 GMT
References: <1988Jun22.223158.1366@LTH.Se> <126@dcs.UUCP> <920@infbs.UUCP> <4635@killer.UUCP>
Reply-To: wcs@skep2.UUCP (46323-Bill.Stewart.,2G218,x0705,)
Organization: AT&T Bell Labs Center 4632, Holmdel, NJ
Lines: 27
In article <4635@killer.UUCP> wnp@killer.UUCP (Wolf Paul) writes:
: >WNP> The way IBM implemented it, all case functions would have to be
: >WNP> table-driven, which is much less elegant than working with the
: >WNP> parallel ranges of characters in standard ASCII.
: >Why is the table-driven approach "much less elegant"? A syntax-table
:Because of the harebrained way IBM assigned characters to the eight-bit
:positions, you would actually need two tables -- one to go from upper
:to lower case, and another vice-versa. THAT's inelegant.
But you have to do the equivalent now, in the sense of
islower(c) ? toupper(c) : c vs.
isupper(c) ? tolower(c) : c
(System V uses a function call that does this)
When I'm doing this kind of work, I almost always use a table -
TOUPPER(c) or TOLOWER(c)
- it always does the right thing, even if the character
wasn't upper or lower case. If you *must* have
specific-case character results, it's easy to get.
- it only takes one step, so it's efficient
- it only references the character once, so macros are safe
- it works on BSD and System V
- it's extensible to non-ASCII character sets
- if you have shared libraries it doesn't waste much space.
--
# Thanks;
# Bill Stewart, AT&T Bell Labs 2G218, Holmdel NJ 1-201-949-0705 ihnp4!ho95c!wcs