|
Boost Testing : |
From: Jim Douglas (jim_at_[hidden])
Date: 2006-01-09 05:20:10
Eric Niebler wrote:
> Jim Douglas wrote:
>
> I'm confused. qcc/gcc is using the GNU libs, right? Do you mean
> __GLIBCPP__ and _CPPLIB_VER are defined but __GLIBC__ is not? How odd.
I don't speak from authority, but my understanding is that there is only
one common core C library and this is unique to QNX. This C library
provides the foundation for both the GNU and Dinkum C++ standard
libraries. So it is correct that '__GLIBC__' is undefined. In this case
you should look for '__QNXNTO__' instead, because that will tell you
what lies at the heart of the system.
IMHO QNX's big mistake is to define _CPPLIB_VER when using the GNU
library. I will try to get them to correct this.
The introduction of QNX6 to Boost has resulted in the slaughter of many
sacred cows:-) You seem to be assuming that the parts of the C++ library
that provide the C functionality _must_ both be from the same supplier.
Similarly many Boost developers have assumed that if you are using the
GNU compiler i.e. __GNUC__ is defined, then you _must_ be using the GNU
C++ library. Not so...
You can't assume anything with QNX as they adopt a mix-and-match
approach. It ships with two versions of gcc (2.95.3 & 3.3.5) each with
its associated GNU C++ std lib, but both compilers can use a common
Dinkum C++ std lib. You can even use the Intel compiler in place of the
GNU compiler when you are cross-developing on Windows.
> Every version of the Dinkumware std lib that has ever shipped with
> Visual C++ has these, AFAIK. They are in ctype.h, and they are sadly
> non-standard. That's because, while iswctype() is standard, there is no
> narrow-char equivalent. Most std libs provide one anyway, but each one
> does it differently. GLIBC has __isctype() and _ISalpha, _ISdigit, etc.,
> VC++ has _isctype() and _ALPHA, _DIGIT, etc., Cygwin has yet another
> variant, MinGW another, etc.
>
> So does qcc have something like this in its ctype.h?
>
I think this is what you need - taken from ctype.h:
/* _Ctype code bits */
#define _XB 0x400 /* extra blank */
#define _XA 0x200 /* extra alphabetic */
#define _XS 0x100 /* extra space */
#define _BB 0x80 /* BEL, BS, etc. */
#define _CN 0x40 /* CR, FF, HT, NL, VT */
#define _DI 0x20 /* '0'-'9' */
#define _LO 0x10 /* 'a'-'z' */
#define _PU 0x08 /* punctuation */
#define _SP 0x04 /* space */
#define _UP 0x02 /* 'A'-'Z' */
#define _XD 0x01 /* '0'-'9', 'A'-'F', 'a'-'f' */
It seems to use a variable of type short i.e. 16 bits.
There is also a set of ANSI & POSIX 1003.1 functions isalpha(),
iswalpha() etc. that work with narrow and wide characters. Are they of
any use?
If that is not enough information I can mail you the complete header file.
The above definitions are referenced by both the GNU and Dinkum C++
libraries, so I guess you will have to use the #if defined(__QNXNTO__)
test after all.
HTH - Jim