(_dl_new_object): Allocate symbolic searchlist as part of the object.
[glibc/history.git] / localedata / tst-wctype.c
blob8fd8ce5186ec05b0954b2c024cb45b646df6b9dc
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
19 02111-1307 USA. */
21 #include <error.h>
22 #include <locale.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <wchar.h>
26 #include <wctype.h>
28 int
29 main (void)
31 wctype_t wct;
32 wchar_t buf[1000];
33 int result = 1;
35 setlocale (LC_ALL, "");
36 wprintf (L"locale = %s\n", setlocale (LC_CTYPE, NULL));
38 wct = wctype ("jhira");
39 if (wct == 0)
40 error (EXIT_FAILURE, 0, "jhira: no such character class");
42 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
44 int n;
46 wprintf (L"buf[] = \"%ls\"\n", buf);
48 result = 0;
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");
60 if (wct == 0)
61 error (EXIT_FAILURE, 0, "jkata: no such character class");
63 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
65 int n;
67 wprintf (L"buf[] = \"%ls\"\n", buf);
69 result = 0;
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");
81 if (wct == 0)
82 error (EXIT_FAILURE, 0, "jdigit: no such character class");
84 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
86 int n;
88 wprintf (L"buf[] = \"%ls\"\n", buf);
90 result = 0;
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");
102 if (wct == 0)
103 error (EXIT_FAILURE, 0, "jspace: no such character class");
105 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
107 int n;
109 wprintf (L"buf[] = \"%ls\"\n", buf);
111 result = 0;
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");
123 if (wct == 0)
124 error (EXIT_FAILURE, 0, "jkanji: no such character class");
126 if (fgetws (buf, sizeof (buf) / sizeof (buf[0]), stdin) != NULL)
128 int n;
130 wprintf (L"buf[] = \"%ls\"\n", buf);
132 result = 0;
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)));
143 return result;