Subject: Re: isprint() and isblank()
To: None <itojun@iijlab.net, soda@sra.co.jp>
From: Noriyuki Soda <soda@sra.co.jp>
List: tech-userlevel
Date: 01/21/2001 15:43:06
> - we now ship with correct locale table, and lib/libc/locale/runeglue.c
> converts it into _ctype_. now _ctype_ can have correct locale bit
> declarations and isprint() can behave strange.
I think we didn't ship _ctype_[] table with ((_ctype_+1)['\t'] & _B) != 0
in any release version. Is this right?
If so, because we don't have to keep bug-compatibility with -current, ...
> 1c. don't change ctype.h declarations.
> when we load locale declaration file, we make some trick about _B.
> PROS: smallest amont of changes.
> CONS: new binaries will have incorrect isprint() and isblank(),
> forever.
How about a variant of this?
e.g.
1c1. don't change ctype.h declarations.
never define isblank() as macro, but allways define it as
function as follows:
isblank(int c) {
return (c == '\t' || ((_ctype_ + 1)[c] & _B);
}
1c2. don't change ctype.h declarations.
isblank() may be defined as macro, but never use 0x80 (_B) bit
as blank bit. (i.e. reserve 0x80 bit for future extensions.)
we may have to find a way to make isblank() dynamic in future,
but current behaviour (hardcoded as ' ' and '\t') is ok for
some time.
The above 1c1 and 1c2 doesn't have problem of 1c.
--
soda