Date: Tue, 3 Sep 2002 17:11:10 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Mike Barcroft <mike@FreeBSD.org> Cc: standards@FreeBSD.org Subject: Re: Conformance bugs in <ctype.h>, by way of <runetype.h> Message-ID: <20020903165059.Q6101-100000@gamplex.bde.org> In-Reply-To: <20020902140549.E94253@espresso.q9media.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 2 Sep 2002, Mike Barcroft wrote: > >From rev 1.5 of ctype.h: > ... > o TODO: fix conformance bugs brought by including <runetype.h>. > > I'd appreciate comments of the attached patch which fixes this issue > and brings <ctype.h> up to conformance. > ctype.diff > > o Fix namespace scope issues in <ctype.h> by using the relatively new > visibility primitives. > o Implement _tolower() and _toupper() POSIX.1-2001 (XSI) macros in > <ctype.h>. > o Make <runetype.h> pollutant-free so that it can safely be included > in <ctype.h>. > o Add a typedef in <rune.h> to compensate for <runetype.h> being > pollutant-free. > > Index: ctype.h > =================================================================== > RCS file: /work/repo/src/include/ctype.h,v > retrieving revision 1.22 > diff -u -r1.22 ctype.h > --- ctype.h 21 Aug 2002 16:19:55 -0000 1.22 > +++ ctype.h 2 Sep 2002 18:07:04 -0000 > ... > @@ -85,9 +81,15 @@ > int tolower(int); > int toupper(int); > > -#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) > -int digittoint(int); > +#if __XSI_VISIBLE > +int _tolower(int); > +int _toupper(int); > int isascii(int); > +int toascii(int); > +#endif It would be nice to not support mistakes like XSI. > Index: runetype.h > =================================================================== > RCS file: /work/repo/src/include/runetype.h,v > retrieving revision 1.7 > diff -u -r1.7 runetype.h > --- runetype.h 21 Aug 2002 16:19:55 -0000 1.7 > +++ runetype.h 2 Sep 2002 17:18:18 -0000 > ... > @@ -67,9 +50,9 @@ > * The lower 8 bits of runetype[] contain the digit value of the rune. > */ > typedef struct { > - rune_t min; /* First rune of the range */ > - rune_t max; /* Last rune (inclusive) of the range */ > - rune_t map; /* What first maps to in maps */ > + __rune_t min; /* First rune of the range */ > + __rune_t max; /* Last rune (inclusive) of the range */ > + __rune_t map; /* What first maps to in maps */ > unsigned long *types; /* Array of types in range */ > } _RuneEntry; > > ... There is still a lot of pollution here: all the struct member names, which don't even have a runetype-specific prefix (#define min runetype loses). There doesn't seem to be any good way to fix this. The inline functions in ctype need to reference at least the runetype[] struct member. Renaming the struct members to have a prefix like __ru_ would be ugly and might break documented runetype interfaces. Most of the interfaces seem to be private so this might not be a problem. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020903165059.Q6101-100000>