diff --git a/include/locale.h b/include/locale.h new file mode 100644 index 00000000000..2d61f8d7537 --- /dev/null +++ b/include/locale.h @@ -0,0 +1,68 @@ +/**************************************************************************** + * include/locale.h + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __INCLUDE_LOCALE_H +#define __INCLUDE_LOCALE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +FAR char *setlocale(int category, FAR const char *locale); + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_LOCALE_H */ diff --git a/libc/Makefile b/libc/Makefile index 1399de558a8..b903fe47376 100644 --- a/libc/Makefile +++ b/libc/Makefile @@ -67,6 +67,7 @@ include dirent/Make.defs include fixedmath/Make.defs include hex2bin/Make.defs include libgen/Make.defs +include locale/Make.defs include math/Make.defs include misc/Make.defs include net/Make.defs diff --git a/libc/README.txt b/libc/README.txt index 4b329205ebf..c964749e28c 100644 --- a/libc/README.txt +++ b/libc/README.txt @@ -31,6 +31,7 @@ we have: audio - This part of he audio system: nuttx/audio/audio.h hex2bin - hex2bin.h libgen - libgen.h + locale - locale.h fixedmath - fixedmath.h math - math.h net - Various network-related header files: netinet/ether.h, arpa/inet.h diff --git a/libc/locale/Make.defs b/libc/locale/Make.defs new file mode 100644 index 00000000000..a7a40e190b9 --- /dev/null +++ b/libc/locale/Make.defs @@ -0,0 +1,43 @@ +############################################################################ +# libc/locale/Make.defs +# +# Copyright (C) 2016 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# Add the locale files to the build + +CSRCS += lib_setlocale.c + +# Add the locale directory to the build + +DEPPATH += --dep-path locale +VPATH += :locale diff --git a/libc/locale/lib_setlocale.c b/libc/locale/lib_setlocale.c new file mode 100644 index 00000000000..8f5fffd62e9 --- /dev/null +++ b/libc/locale/lib_setlocale.c @@ -0,0 +1,66 @@ +/**************************************************************************** + * libc/locale/lib_setlocale.c + * + * Copyright (C) 2016 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: setlocale + * + * Description: + * locales are not supported by NuttX + * + * Input Parameters: + * category and locale - Select the appropriate piece of the program's + * locale. + * + ****************************************************************************/ + +FAR char *setlocale(int category, FAR const char *locale) +{ + /* NULL indicates the the locale was not changed */ + + return NULL; +} diff --git a/libc/misc/lib_uadd32x64.c b/libc/misc/lib_uadd32x64.c index 291a282d7c7..ea9b851da6b 100644 --- a/libc/misc/lib_uadd32x64.c +++ b/libc/misc/lib_uadd32x64.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_uadd32x64.c + * libc/misc/lib_uadd32x64.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/misc/lib_uadd64.c b/libc/misc/lib_uadd64.c index 8d071687915..60baf6867c7 100644 --- a/libc/misc/lib_uadd64.c +++ b/libc/misc/lib_uadd64.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_uadd64.c + * libc/misc/lib_uadd64.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/misc/lib_umul32.c b/libc/misc/lib_umul32.c index 27540c08efa..f3906737344 100644 --- a/libc/misc/lib_umul32.c +++ b/libc/misc/lib_umul32.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_umul32.c + * libc/misc/lib_umul32.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/misc/lib_umul32x64.c b/libc/misc/lib_umul32x64.c index b7c4510f013..326b3d4d7db 100644 --- a/libc/misc/lib_umul32x64.c +++ b/libc/misc/lib_umul32x64.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_umul32x64.c + * libc/misc/lib_umul32x64.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/misc/lib_umul64.c b/libc/misc/lib_umul64.c index 29cbd37a9e2..4a5b3f41517 100644 --- a/libc/misc/lib_umul64.c +++ b/libc/misc/lib_umul64.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_umul64.c + * libc/misc/lib_umul64.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/misc/lib_usub64.c b/libc/misc/lib_usub64.c index 49742ac27d8..5b1deaa77b2 100644 --- a/libc/misc/lib_usub64.c +++ b/libc/misc/lib_usub64.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_usub64.c + * libc/misc/lib_usub64.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/libc/misc/lib_usub64x32.c b/libc/misc/lib_usub64x32.c index 7bda326e2a2..5996c35b305 100644 --- a/libc/misc/lib_usub64x32.c +++ b/libc/misc/lib_usub64x32.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/fixedmath/lib_usub64x32.c + * libc/misc/lib_usub64x32.c * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt