isspace() & i18n

J. Johnston
Wed Jun 6 12:57:00 GMT 2001

egor duda wrote:
> Hi!
> Wednesday, 30 May, 2001 Christopher Faylor wrote:
> CF> On Thu, May 31, 2001 at 01:29:28AM +0900, Kazuhiro Fujieda wrote:
> >>>>> On Wed, 30 May 2001 18:11:56 +0400
> >>>>> egor duda <> said:
> >>
> >>> i think we should either conform to standard and explicitly convert
> >>> types or define appropriate strings as unsigned char*, (typedef PATH_STR,
> >>> perhaps), or define cygwin_is*() as macros that do the conversion, or,
> >>> as glibc does, expand _ctype to allow indices in range [-128,256].
> >>
> >>The last is preferable.
> >>
> >>The ISO C standard specifies is* facilities operate properly on
> >>all values representable as type `char' and type `unsigned char'.
> >>It depends on implementation whether char is signed or unsigned.
> >>The is* facilities should operate on range [-128,256] on the
> >>implementation where char is singied.
> CF> I agree.  I think that this is the preferable solution.
> here's the patch that works ok for me. unfortunately, it relies on
> nonstandard gccism, but at least it always initializes all _ctype_
> array elements. when compiled with gcc, it additionally allows
> [-128, -1] range for indices, too.


  Why not instead use the __CHAR_UNSIGNED__ flag?  You could initialize the table based on this flag
and also check for it in ctype.h.  In ctype.h, the macros currently add +1 to _ctype_.  This offset
would be determined by the flag.  This removes the check for gnuc and doesn't unnecessarily use
additional storage for unsigned char implementations.  

  For unsigned char platforms, the table would remain as it is and the starting offset in ctype.h
would remain +1.  For signed-char platforms, the table would be the new larger table and the offset
in ctype.h would be set to +128.

-- Jeff J.

More information about the Newlib mailing list