6 /* This is the relevant piece from the charmap:
7 <UFF61> /x8e/xa1 HALFWIDTH IDEOGRAPHIC FULL STOP
8 <UFF62> /x8e/xa2 HALFWIDTH LEFT CORNER BRACKET
9 <UFF63> /x8e/xa3 HALFWIDTH RIGHT CORNER BRACKET
10 <UFF64> /x8e/xa4 HALFWIDTH IDEOGRAPHIC COMMA
13 const char input
[] = "\x8e\xa1g\x8e\xa2h\x8e\xa3i\x8e\xa4j";
19 #define nbuf (sizeof (buf) / sizeof (buf[0]))
23 if (setlocale (LC_ALL
, "ja_JP.EUC-JP") == NULL
)
25 puts ("cannot set locale");
29 #define CHECK(fmt, nexp, exp) \
30 n = swprintf (buf, nbuf, fmt, input); \
33 printf ("swprintf (.., .., L\"%ls\", \"%ls\") return %d, not %d\n", \
34 fmt, (wchar_t*) input, (int) n, (int) nexp); \
37 else if (wcscmp (buf, exp) != 0) \
40 swprintf (.., .., L\"%ls\", \"%ls\") produced \"%ls\", not \"%ls\"\n", \
41 fmt, (wchar_t *) input, buf, exp ); \
45 CHECK (L
"[%-6.0s]", 8, L
"[ ]");
46 CHECK (L
"[%-6.1s]", 8, L
"[\xff61 ]");
47 CHECK (L
"[%-6.2s]", 8, L
"[\xff61g ]");
48 CHECK (L
"[%-6.3s]", 8, L
"[\xff61g\xff62 ]");
49 CHECK (L
"[%-6.4s]", 8, L
"[\xff61g\xff62h ]");
50 CHECK (L
"[%-6.5s]", 8, L
"[\xff61g\xff62h\xff63 ]");
51 CHECK (L
"[%-6.6s]", 8, L
"[\xff61g\xff62h\xff63i]");
52 CHECK (L
"[%-6.7s]", 9, L
"[\xff61g\xff62h\xff63i\xff64]");
53 CHECK (L
"[%-6.8s]", 10, L
"[\xff61g\xff62h\xff63i\xff64j]");