30#define _RWSTD_TEST_SRC
45#ifndef _RWSTD_NO_WCHAR_H
49#ifndef _RWSTD_NO_WCTYPE_H
70#define BITNAME(qual, name) { #qual "::" #name, #name, qual::name }
84 const char* all_clear =
"0";
86 for (
size_t i = 0;
i !=
size; ++
i) {
88 if ((bits & bmap [
i].bits) == bmap [
i].bits) {
95 bits &= ~bmap [
i].bits;
110 sprintf (
buffer,
"%#x", bits);
112 strcpy (
buffer, all_clear);
114 buffersize = strlen (
buffer);
117 buffersize = strlen (
buffer);
123 const int n = sprintf (bitstr,
"%#x | ", bits);
128 memcpy (
buffer, bitstr,
size_t (
n));
133 buffersize = strlen (
buffer);
175#ifndef _RWSTD_NO_EXT_BIN_IO
182#ifndef _RWSTD_NO_EXT_REENTRANT_IO
190 {
"std::ios::fmtflags(0)",
"fmtflags(0)", std::ios::fmtflags () }
194 static const size_t count =
sizeof names /
sizeof *names;
201 int len = _rw_bmpfmt (spec,
buf, names,
count, bits);
208#ifndef _RWSTD_NO_EXT_BIN_IO
210 if (bits & std::ios::bin)
216 "%{+} | %{?}std::ios::%{;}base(%d)",
245 static const size_t count =
sizeof names /
sizeof *names;
247 return _rw_bmpfmt (spec,
buf, names,
count, bits);
257#ifndef _RWSTD_NO_EXTENSIONS
259 {
"std::ios::nocreate",
"nocreate", std::ios::nocreate },
260 {
"std::ios::noreplace",
"noreplace", std::ios::noreplace },
264 {
"__rw:::__rw_nocreate",
"__rw_nocreate", _RW::__rw_nocreate },
265 {
"__rw::__rw_noreplace",
"__rw_noreplace", _RW::__rw_noreplace },
269#ifndef _RWSTD_NO_EXT_STDIO
271 {
"std::ios::stdio",
"stdio", std::ios::stdio },
272 {
"std::ios::native",
"native", std::ios::native },
276 {
"__rw::__rw_stdio",
"__rw_stdio", _RW::__rw_stdio },
277 {
"__rw::__rw_native",
"__rw_native", _RW::__rw_native },
288 {
"std::ios::openmode(0)",
"openmode(0)", std::ios::openmode () }
291 static const size_t count =
sizeof names /
sizeof *names;
293 return _rw_bmpfmt (spec,
buf, names,
count, bits);
308 static const size_t count =
sizeof names /
sizeof *names;
310 return _rw_bmpfmt (spec,
buf, names,
count, bits);
318 const char*
const str =
319 std::ios::copyfmt_event ==
event ?
"copyfmt_event"
320 : std::ios::imbue_event ==
event ?
"imbue_event"
321 : std::ios::erase_event ==
event ?
"erase_event"
336 "%{+}%{?}std::ios::%{;}%{?}%s%{:}event(%d)%{;}",
390 BITNAME (std::locale, collate),
392 BITNAME (std::locale, monetary),
393 BITNAME (std::locale, numeric),
394 BITNAME (std::locale, messages),
398 static const size_t count =
sizeof names /
sizeof *names;
408 static const char qual[] =
"std::money_base::";
414 for (
int i = 0;
i != 4; ++
i) {
416 case std::money_base::symbol:
419 strcat (
buffer,
"symbol ");
422 case std::money_base::sign:
428 case std::money_base::none:
434 case std::money_base::value:
437 strcat (
buffer,
"value ");
440 case std::money_base::space:
443 strcat (
buffer,
"space ");
463 static const struct {
469#define SIGNAL(val) { val, #val }
633 const char *
name = 0;
635 for (
size_t i = 0;
i !=
sizeof names /
sizeof *names; ++
i) {
637 name = names [
i].str;
644 sprintf (smallbuf,
"SIG#%d",
val);
659 static const struct {
665#define ERRNO(val) { val, #val }
841#ifdef ENOTRECOVERABLE
842 ERRNO (ENOTRECOVERABLE),
878 ERRNO (ELOCKUNMAPPED),
890 ERRNO (ENAMETOOLONG),
944 ERRNO (EDESTADDRREQ),
955#ifdef EPROTONOSUPPORT
956 ERRNO (EPROTONOSUPPORT),
958#ifdef ESOCKTNOSUPPORT
959 ERRNO (ESOCKTNOSUPPORT),
965 ERRNO (EPFNOSUPPORT),
968 ERRNO (EAFNOSUPPORT),
974 ERRNO (EADDRNOTAVAIL),
986 ERRNO (ECONNABORTED),
1004 ERRNO (ETOOMANYREFS),
1010 ERRNO (ECONNREFUSED),
1016 ERRNO (EHOSTUNREACH),
1019 ERRNO (EWOULDBLOCK),
1025 ERRNO (EINPROGRESS),
1033 const char*
str = strerror (
val);
1039 const char *
name = 0;
1041 for (
size_t i = 0;
i !=
sizeof names /
sizeof *names; ++
i) {
1043 name = names [
i].str;
1049 sprintf (smallbuf,
"E#%d",
val);
1071 FormatMessage ( FORMAT_MESSAGE_ALLOCATE_BUFFER
1072 | FORMAT_MESSAGE_FROM_SYSTEM
1073 | FORMAT_MESSAGE_IGNORE_INSERTS,
1075 MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
1105 BITNAME (std::ctype_base, alnum),
1106 BITNAME (std::ctype_base, alpha),
1108 BITNAME (std::ctype_base, digit),
1113 BITNAME (std::ctype_base, space),
1115 BITNAME (std::ctype_base, xdigit)
1118 static const size_t count =
sizeof names /
sizeof *names;
1120 return _rw_bmpfmt (spec,
buf, names,
count, bits);
1146#ifndef _RWSTD_NO_WCHAR_H
1164 const unsigned char uc =
c;
1180 char *
str = mask_str;
1184#define APPEND(bit) \
1185 if (mask & bit_ ## bit) \
1186 strcat (strcat (str, #bit), "|"); \
1201 if (
str == mask_str)
1216 const void *pelems,
size_t elemsize)
1218 const size_t nbits = spec.
prec;
1221 char *pbits = nbits <
sizeof bitbuf ? bitbuf :
new char [nbits + 1];
1223 for (
size_t bitno = 0; bitno != nbits; ++bitno) {
1225 if (bitno && 0 == (bitno % (elemsize * _RWSTD_CHAR_BIT)))
1228 size_t bit = 1 << (bitno & (_RWSTD_CHAR_BIT * elemsize - 1));
1231 case _RWSTD_CHAR_SIZE:
1235#if _RWSTD_CHAR_SIZE < _RWSTD_SHRT_SIZE
1236 case _RWSTD_SHRT_SIZE:
1241#if _RWSTD_SHRT_SIZE < _RWSTD_INT_SIZE
1242 case _RWSTD_INT_SIZE:
1247#if _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE
1248 case _RWSTD_LONG_SIZE:
1253#if _RWSTD_LONG_SIZE < _RWSTD_LLONG_SIZE
1254 case _RWSTD_LLONG_SIZE:
1260 RW_ASSERT (!
"logic error: bad element size");
1263 pbits [bitno] = bit ?
'1' :
'0';
1268 if (pbits != bitbuf)
void count(T, T, const U &,...)
#define _RWSTD_STATIC_CAST(T, x)
#define _RWSTD_IOS_BASEOFF
#define _RWSTD_IOS_BASEMASK
int _rw_fmtcharmask(const FmtSpec &spec, Buffer &buf, int c)
int _rw_fmtmonpat(const FmtSpec &spec, Buffer &buf, const char pat[4])
int _rw_fmtlasterror(const FmtSpec &spec, Buffer &buf, int val)
int _rw_fmtbits(const FmtSpec &spec, Buffer &buf, const void *pelems, size_t elemsize)
int _rw_fmtmask(const FmtSpec &spec, Buffer &buf, int bits)
int _rw_fmtiostate(const FmtSpec &spec, Buffer &buf, int bits)
int _rw_fmtevent(const FmtSpec &spec, Buffer &buf, int event)
int _rw_fmtflags(const FmtSpec &spec, Buffer &buf, int bits)
int _rw_fmtlc(const FmtSpec &spec, Buffer &buf, int val)
int _rw_fmterrno(const FmtSpec &spec, Buffer &buf, int val)
int _rw_fmtseekdir(const FmtSpec &spec, Buffer &buf, int bits)
#define BITNAME(qual, name)
int _rw_fmtopenmode(const FmtSpec &spec, Buffer &buf, int bits)
int _rw_fmtsignal(const FmtSpec &spec, Buffer &buf, int val)
int _rw_fmtstr(const FmtSpec &, Buffer &, const char *, size_t)
_TEST_EXPORT int rw_asnprintf(char **pbuf, _RWSTD_SIZE_T *pbufsize, const char *fmt,...)