1 /* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
20 * ISO Standard: 7.16.4 General wide-string utilities <wchar.h>
30 /* Get size_t, wchar_t, uwchar_t and NULL from <stddef.h>. */
32 #define __need_wchar_t
33 /* #define __need_uwchar_t */
35 /* __need_WCHAR_MAX */
36 /* __need_WCHAR_MIN */
39 /* FIXME: Should go with this or another name in stddef.h. */
40 typedef unsigned int uwchar_t
;
42 /* Conversion state information. */
43 typedef int mbstate_t; /* FIXME */
45 /* Should come from <stddef.h> */
46 #define WCHAR_MIN ((wchar_t) 0) /* FIXME */
47 #define WCHAR_MAX (~WCHAR_MIN) /* FIXME */
50 # define WEOF (0xffffffffu)
53 /* FIXME: should this go into <stddef.h>??? */
58 /* Integral type unchanged by default argument promotions that can
59 hold any value corresponding to members of the extended character
60 set, as well as at least one value that does not correspond to any
61 member of the extended character set. */
62 typedef unsigned int wint_t;
66 /* Copy SRC to DEST. */
67 extern wchar_t *wcscpy
__P ((wchar_t *__dest
, __const
wchar_t *__src
));
68 /* Copy no more than N wide-characters of SRC to DEST. */
69 extern wchar_t *wcsncpy
__P ((wchar_t *__dest
, __const
wchar_t *__src
,
72 /* Append SRC onto DEST. */
73 extern wchar_t *wcscat
__P ((wchar_t *__dest
, __const
wchar_t *__src
));
74 /* Append no more than N wide-characters of SRC onto DEST. */
75 extern wchar_t *wcsncat
__P ((wchar_t *__dest
, __const
wchar_t *__src
,
78 /* Compare S1 and S2. */
79 extern int wcscmp
__P ((__const
wchar_t *__s1
, __const
wchar_t *__s2
));
80 /* Compare N wide-characters of S1 and S2. */
81 extern int wcsncmp
__P ((__const
wchar_t *__s1
, __const
wchar_t *__s2
,
84 /* Duplicate S, returning an identical malloc'd string. */
85 extern wchar_t *wcsdup
__P ((__const
wchar_t *__s
));
87 /* Find the first occurence of WC in WCS. */
88 extern wchar_t *wcschr
__P ((__const
wchar_t *__wcs
, wchar_t __wc
));
89 /* Find the last occurence of WC in WCS. */
90 extern wchar_t *wcsrchr
__P ((__const
wchar_t *__wcs
, wchar_t __wc
));
92 /* Return the length of the initial segmet of WCS which
93 consists entirely of wide-characters not in REJECT. */
94 extern size_t wcscspn
__P ((__const
wchar_t *__wcs
,
95 __const
wchar_t *__reject
));
96 /* Return the length of the initial segmet of WCS which
97 consists entirely of wide-characters in ACCEPT. */
98 extern size_t wcsspn
__P ((__const
wchar_t *__wcs
, __const
wchar_t *__accept
));
99 /* Find the first occurence in WCS of any character in ACCEPT. */
100 extern wchar_t *wcspbrk
__P ((__const
wchar_t *__wcs
,
101 __const
wchar_t *__accept
));
102 /* Find the first occurence of NEEDLE in HAYSTACK. */
103 extern wchar_t *wcsstr
__P ((__const
wchar_t *__haystack
,
104 __const
wchar_t *__needle
));
105 /* Divide WCS into tokens separated by characters in DELIM. */
106 extern wchar_t *wcstok
__P ((wchar_t *__s
, __const
wchar_t *__delim
,
109 /* Return the number of wide-characters in S. */
110 extern size_t wcslen
__P ((__const
wchar_t *__s
));
113 /* Search N bytes of S for C. */
114 extern wchar_t *wmemchr
__P ((__const
wchar_t *__s
, wchar_t __c
, size_t __n
));
116 /* Compare N bytes of S1 and S2. */
117 extern int wmemcmp
__P ((__const
wchar_t *__s1
, __const
wchar_t *__s2
,
120 /* Copy N bytes of SRC to DEST. */
121 extern wchar_t *wmemcpy
__P ((wchar_t *__s1
, __const
wchar_t *__s2
,
124 /* Copy N bytes of SRC to DEST, guaranteeing
125 correct behavior for overlapping strings. */
126 extern wchar_t *wmemmove
__P ((wchar_t *__s1
, __const
wchar_t *__s2
,
129 /* Set N bytes of S to C. */
130 extern wchar_t *wmemset
__P ((wchar_t *__s
, wchar_t __c
, size_t __n
));
133 /* Determine whether C constitutes a valid (one-byte) multibyte
135 extern wint_t btowc
__P ((int __c
));
137 /* Determine whether C corresponds to a member of the extended
138 character set whose multibyte representation is a single byte. */
139 extern int wctob
__P ((wint_t __c
));
141 /* Determine whether PS points to an object representing the initial
143 extern int mbsinit
__P ((__const
mbstate_t *__ps
));
145 /* Return number of bytes in multibyte character pointed to by S. */
146 extern size_t mbrlen
__P ((__const
char *__s
, size_t __n
, mbstate_t *ps
));
148 /* Write wide character representation of multibyte character pointed
150 extern size_t mbrtowc
__P ((wchar_t *__pwc
, __const
char *__s
, size_t __n
,
153 /* Write multibyte representation of wide character WC to S. */
154 extern size_t wcrtomb
__P ((char *__s
, wchar_t __wc
, mbstate_t *__ps
));
156 /* Write wide character representation of multibyte chracter string SRC
158 extern size_t mbsrtowcs
__P ((wchar_t *__dst
, __const
char **__src
,
159 size_t __len
, mbstate_t *__ps
));
161 /* Write multibyte character representation of wide character string
163 extern size_t wcsrtombs
__P ((char *__dst
, __const
wchar_t **__src
,
164 size_t __len
, mbstate_t *__ps
));