Last change
on this file since 444 was 444, checked in by coas-nagasima, 4 years ago |
muslのソースコードを追加
|
-
Property svn:eol-style
set to
native
-
Property svn:mime-type
set to
text/x-csrc;charset=UTF-8
|
File size:
1.5 KB
|
Line | |
---|
1 | #include <wctype.h>
|
---|
2 | #include <string.h>
|
---|
3 | #include "libc.h"
|
---|
4 |
|
---|
5 | #define WCTYPE_ALNUM 1
|
---|
6 | #define WCTYPE_ALPHA 2
|
---|
7 | #define WCTYPE_BLANK 3
|
---|
8 | #define WCTYPE_CNTRL 4
|
---|
9 | #define WCTYPE_DIGIT 5
|
---|
10 | #define WCTYPE_GRAPH 6
|
---|
11 | #define WCTYPE_LOWER 7
|
---|
12 | #define WCTYPE_PRINT 8
|
---|
13 | #define WCTYPE_PUNCT 9
|
---|
14 | #define WCTYPE_SPACE 10
|
---|
15 | #define WCTYPE_UPPER 11
|
---|
16 | #define WCTYPE_XDIGIT 12
|
---|
17 |
|
---|
18 | int iswctype(wint_t wc, wctype_t type)
|
---|
19 | {
|
---|
20 | switch (type) {
|
---|
21 | case WCTYPE_ALNUM:
|
---|
22 | return iswalnum(wc);
|
---|
23 | case WCTYPE_ALPHA:
|
---|
24 | return iswalpha(wc);
|
---|
25 | case WCTYPE_BLANK:
|
---|
26 | return iswblank(wc);
|
---|
27 | case WCTYPE_CNTRL:
|
---|
28 | return iswcntrl(wc);
|
---|
29 | case WCTYPE_DIGIT:
|
---|
30 | return iswdigit(wc);
|
---|
31 | case WCTYPE_GRAPH:
|
---|
32 | return iswgraph(wc);
|
---|
33 | case WCTYPE_LOWER:
|
---|
34 | return iswlower(wc);
|
---|
35 | case WCTYPE_PRINT:
|
---|
36 | return iswprint(wc);
|
---|
37 | case WCTYPE_PUNCT:
|
---|
38 | return iswpunct(wc);
|
---|
39 | case WCTYPE_SPACE:
|
---|
40 | return iswspace(wc);
|
---|
41 | case WCTYPE_UPPER:
|
---|
42 | return iswupper(wc);
|
---|
43 | case WCTYPE_XDIGIT:
|
---|
44 | return iswxdigit(wc);
|
---|
45 | }
|
---|
46 | return 0;
|
---|
47 | }
|
---|
48 |
|
---|
49 | wctype_t wctype(const char *s)
|
---|
50 | {
|
---|
51 | int i;
|
---|
52 | const char *p;
|
---|
53 | /* order must match! */
|
---|
54 | static const char names[] =
|
---|
55 | "alnum\0" "alpha\0" "blank\0"
|
---|
56 | "cntrl\0" "digit\0" "graph\0"
|
---|
57 | "lower\0" "print\0" "punct\0"
|
---|
58 | "space\0" "upper\0" "xdigit";
|
---|
59 | for (i=1, p=names; *p; i++, p+=6)
|
---|
60 | if (*s == *p && !strcmp(s, p))
|
---|
61 | return i;
|
---|
62 | return 0;
|
---|
63 | }
|
---|
64 |
|
---|
65 | int __iswctype_l(wint_t c, wctype_t t, locale_t l)
|
---|
66 | {
|
---|
67 | return iswctype(c, t);
|
---|
68 | }
|
---|
69 |
|
---|
70 | wctype_t __wctype_l(const char *s, locale_t l)
|
---|
71 | {
|
---|
72 | return wctype(s);
|
---|
73 | }
|
---|
74 |
|
---|
75 | weak_alias(__iswctype_l, iswctype_l);
|
---|
76 | weak_alias(__wctype_l, wctype_l);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.