1 /* Test program for iswctype() function in ja_JP locale.
2 Copyright (C) 2000 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, write to the Free
18 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
35 setlocale (LC_ALL
, "");
36 wprintf (L
"locale = %s\n", setlocale (LC_CTYPE
, NULL
));
38 wct
= wctype ("jhira");
40 error (EXIT_FAILURE
, 0, "jhira: no such character class");
42 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
46 wprintf (L
"buf[] = \"%ls\"\n", buf
);
50 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
52 wprintf (L
"jhira(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
53 iswctype (buf
[n
], wct
));
54 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
55 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
59 wct
= wctype ("jkata");
61 error (EXIT_FAILURE
, 0, "jkata: no such character class");
63 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
67 wprintf (L
"buf[] = \"%ls\"\n", buf
);
71 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
73 wprintf (L
"jkata(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
74 iswctype (buf
[n
], wct
));
75 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
76 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
80 wct
= wctype ("jdigit");
82 error (EXIT_FAILURE
, 0, "jdigit: no such character class");
84 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
88 wprintf (L
"buf[] = \"%ls\"\n", buf
);
92 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
94 wprintf (L
"jdigit(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
95 iswctype (buf
[n
], wct
));
96 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
97 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
101 wct
= wctype ("jspace");
103 error (EXIT_FAILURE
, 0, "jspace: no such character class");
105 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
109 wprintf (L
"buf[] = \"%ls\"\n", buf
);
113 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
115 wprintf (L
"jspace(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
116 iswctype (buf
[n
], wct
));
117 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
118 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));
122 wct
= wctype ("jkanji");
124 error (EXIT_FAILURE
, 0, "jkanji: no such character class");
126 if (fgetws (buf
, sizeof (buf
) / sizeof (buf
[0]), stdin
) != NULL
)
130 wprintf (L
"buf[] = \"%ls\"\n", buf
);
134 for (n
= 0; buf
[n
] != L
'\0'; ++n
)
136 wprintf (L
"jkanji(U%04lx = %lc) = %d\n", (long) buf
[n
], buf
[n
],
137 iswctype (buf
[n
], wct
));
138 result
|= ((buf
[n
] < 0xff && iswctype (buf
[n
], wct
))
139 || (buf
[n
] > 0xff && !iswctype (buf
[n
], wct
)));