Skip to content

Commit 68d40d4

Browse files
Donny9btashton
authored andcommitted
libc/locale: support iconv_open,iconv,iconv_close
Refs to:https://github.com/bminor/musl Signed-off-by: dongjiuzhu1 <[email protected]>
1 parent 40d0776 commit 68d40d4

File tree

13 files changed

+6962
-1
lines changed

13 files changed

+6962
-1
lines changed

LICENSE

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6615,6 +6615,38 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
66156615
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
66166616
SUCH DAMAGE.
66176617

6618+
libs/libc/locale/big5.h
6619+
libs/libc/locale/codepages.h
6620+
libs/libc/locale/gb18030.h
6621+
libs/libc/locale/hkscs.h
6622+
libs/libc/locale/jis0208.h
6623+
libs/libc/locale/ksc.h
6624+
libs/libc/locale/legacychars.h
6625+
libs/libc/locale/revjis.h
6626+
libs/libc/locale/lib_iconv.c
6627+
===================
6628+
6629+
Copyright © 2005-2020 Rich Felker, et al.
6630+
6631+
Permission is hereby granted, free of charge, to any person obtaining
6632+
a copy of this software and associated documentation files (the
6633+
"Software"), to deal in the Software without restriction, including
6634+
without limitation the rights to use, copy, modify, merge, publish,
6635+
distribute, sublicense, and/or sell copies of the Software, and to
6636+
permit persons to whom the Software is furnished to do so, subject to
6637+
the following conditions:
6638+
6639+
The above copyright notice and this permission notice shall be
6640+
included in all copies or substantial portions of the Software.
6641+
6642+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
6643+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
6644+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
6645+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
6646+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
6647+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
6648+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6649+
66186650
drivers/wireless/bluetooth/bt_uart.c
66196651
drivers/wireless/bluetooth/bt_uart.h
66206652
wireless/bluetooth

include/iconv.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/****************************************************************************
2+
* include/iconv.h
3+
*
4+
* Licensed to the Apache Software Foundation (ASF) under one or more
5+
* contributor license agreements. See the NOTICE file distributed with
6+
* this work for additional information regarding copyright ownership. The
7+
* ASF licenses this file to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance with the
9+
* License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
18+
*
19+
****************************************************************************/
20+
21+
#ifndef __INCLUDE_ICONV_H
22+
#define __INCLUDE_ICONV_H
23+
24+
/****************************************************************************
25+
* Included Files
26+
****************************************************************************/
27+
28+
#include <nuttx/compiler.h>
29+
#include <sys/types.h>
30+
31+
/****************************************************************************
32+
* Public Types
33+
****************************************************************************/
34+
35+
typedef FAR void *iconv_t;
36+
37+
/****************************************************************************
38+
* Public Function Prototypes
39+
****************************************************************************/
40+
41+
#undef EXTERN
42+
#if defined(__cplusplus)
43+
#define EXTERN extern "C"
44+
extern "C"
45+
{
46+
#else
47+
#define EXTERN extern
48+
#endif
49+
50+
iconv_t iconv_open(FAR const char *to, FAR const char *from);
51+
size_t iconv(iconv_t cd, FAR char **in, FAR size_t *inb,
52+
FAR char **out, FAR size_t *outb);
53+
int iconv_close(iconv_t cd);
54+
55+
#undef EXTERN
56+
#if defined(__cplusplus)
57+
}
58+
#endif
59+
60+
#endif /* __INCLUDE_ICONV_H */

libs/libc/locale/Kconfig

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ config LIBC_LOCALE_PATH
3535
This is the default search path to the location where
3636
the message catalog file is expected to be found.
3737

38+
config LIBC_LOCALE_CHINESE
39+
bool "Enable chinese encoding"
40+
default n
41+
42+
config LIBC_LOCALE_CODEPAGES
43+
bool "Enable codepages encoding"
44+
default n
45+
46+
config LIBC_LOCALE_JAPANESE
47+
bool "Enable japanese encoding"
48+
default n
49+
50+
config LIBC_LOCALE_KOREAN
51+
bool "Enable korean encoding"
52+
default n
53+
3854
endif
3955

4056
endmenu # Locale Support

libs/libc/locale/Make.defs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ifeq ($(CONFIG_LIBC_LOCALE),y)
2424

2525
CSRCS += lib_duplocale.c lib_freelocale.c lib_localeconv.c
2626
CSRCS += lib_newlocale.c lib_setlocale.c lib_uselocale.c
27-
CSRCS += lib_catalog.c lib_gettext.c lib_langinfo.c
27+
CSRCS += lib_catalog.c lib_gettext.c lib_langinfo.c lib_iconv.c
2828

2929
# Add the locale directory to the build
3030

0 commit comments

Comments
 (0)