diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2005-04-30 09:14:24 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2005-04-30 09:14:24 +0000 |
commit | 86c423fca9e4df63c5cfd487e548f449d681361f (patch) | |
tree | d22554d836dc3686f5037b405446ba836e40ade2 /lib | |
parent | 935fa89286b968b8719b409c33faeb7b78e8219e (diff) |
isw* classification functions from citrus, with a `stub' implementation
for the default locale.
comments, tests, okay: kettenis@, otto@, jmc@
functions addition -> Minor bump.
There's a large bump coming in a separate commit.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/locale/Makefile.inc | 20 | ||||
-rw-r--r-- | lib/libc/locale/iswalnum.3 | 117 | ||||
-rw-r--r-- | lib/libc/locale/iswctype_sb.c | 135 | ||||
-rw-r--r-- | lib/libc/locale/towlower.3 | 69 | ||||
-rw-r--r-- | lib/libc/shlib_version | 2 |
5 files changed, 338 insertions, 5 deletions
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc index d5b0ae30a2c..67edae18770 100644 --- a/lib/libc/locale/Makefile.inc +++ b/lib/libc/locale/Makefile.inc @@ -1,12 +1,24 @@ -# $OpenBSD: Makefile.inc,v 1.5 2005/04/14 20:59:10 espie Exp $ +# $OpenBSD: Makefile.inc,v 1.6 2005/04/30 09:14:23 espie Exp $ # locale sources .PATH: ${LIBCSRCDIR}/arch/${MACHINE_ARCH}/locale ${LIBCSRCDIR}/locale SRCS+= _def_messages.c _def_monetary.c _def_numeric.c _def_time.c \ - localeconv.c nl_langinfo.c setlocale.c + localeconv.c nl_langinfo.c setlocale.c iswctype_sb.c -MAN+= nl_langinfo.3 setlocale.3 -MLINKS+=setlocale.3 localeconv.3 +MAN+= nl_langinfo.3 setlocale.3 iswalnum.3 towlower.3 +MLINKS+=setlocale.3 localeconv.3 \ + iswalnum.3 iswalpha.3 \ + iswalnum.3 iswblank.3 \ + iswalnum.3 iswcntrl.3 \ + iswalnum.3 iswdigit.3 \ + iswalnum.3 iswgraph.3 \ + iswalnum.3 iswlower.3 \ + iswalnum.3 iswprint.3 \ + iswalnum.3 iswpunct.3 \ + iswalnum.3 iswspace.3 \ + iswalnum.3 iswupper.3 \ + iswalnum.3 iswxdigit.3 \ + towlower.3 towupper.3 CFLAGS+=-I${.CURDIR} diff --git a/lib/libc/locale/iswalnum.3 b/lib/libc/locale/iswalnum.3 new file mode 100644 index 00000000000..19f99b04b07 --- /dev/null +++ b/lib/libc/locale/iswalnum.3 @@ -0,0 +1,117 @@ +.\" $OpenBSD: iswalnum.3,v 1.1 2005/04/30 09:14:23 espie Exp $ +.\" $NetBSD: iswalnum.3,v 1.8 2003/09/08 17:54:31 wiz Exp $ +.\" +.\" Copyright (c) 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" the American National Standards Committee X3, on Information +.\" Processing Systems. +.\" +.\" 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 of the University 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 REGENTS 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 REGENTS 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. +.\" +.\" @(#)isalnum.3 5.2 (Berkeley) 6/29/91 +.\" +.Dd December 22, 2000 +.Dt ISWALNUM 3 +.Os +.Sh NAME +.Nm iswalnum , +.Nm iswalpha , +.Nm iswblank , +.Nm iswcntrl , +.Nm iswdigit , +.Nm iswgraph , +.Nm iswlower , +.Nm iswprint , +.Nm iswpunct , +.Nm iswspace , +.Nm iswupper , +.Nm iswxdigit +.Nd wide character classification utilities +.Sh SYNOPSIS +.Fd #include <wctype.h> +.Ft int +.Fn iswalnum "wint_t wc" +.Ft int +.Fn iswalpha "wint_t wc" +.Ft int +.Fn iswblank "wint_t wc" +.Ft int +.Fn iswcntrl "wint_t wc" +.Ft int +.Fn iswdigit "wint_t wc" +.Ft int +.Fn iswgraph "wint_t wc" +.Ft int +.Fn iswlower "wint_t wc" +.Ft int +.Fn iswprint "wint_t wc" +.Ft int +.Fn iswpunct "wint_t wc" +.Ft int +.Fn iswspace "wint_t wc" +.Ft int +.Fn iswupper "wint_t wc" +.Ft int +.Fn iswxdigit "wint_t wc" +.Sh DESCRIPTION +The functions are character classification utility functions, +for use with wide characters +.Po +.Fa wchar_t +or +.Fa wint_t +.Pc . +See the description of singlebyte classification functions, like +.Xr isalnum 3 , +for details. +.Sh RETURN VALUES +The functions return zero if the character tests false and +return non-zero if the character tests true. +.Sh SEE ALSO +.Xr isalnum 3 , +.Xr isalpha 3 , +.Xr isblank 3 , +.Xr iscntrl 3 , +.Xr isdigit 3 , +.Xr isgraph 3 , +.Xr islower 3 , +.Xr isprint 3 , +.Xr ispunct 3 , +.Xr isspace 3 , +.Xr isupper 3 , +.Xr isxdigit 3 +.Sh STANDARDS +The functions conform to +.\" .St -isoC99 . +ISO/IEC 9899:1999 +.Pq Dq ISO C99 . +.Sh CAVEATS +The argument to these functions must be +.Dv WEOF +or a valid +.Fa wchar_t +value with the current locale; otherwise, the result is undefined. diff --git a/lib/libc/locale/iswctype_sb.c b/lib/libc/locale/iswctype_sb.c new file mode 100644 index 00000000000..85d6cc97e9a --- /dev/null +++ b/lib/libc/locale/iswctype_sb.c @@ -0,0 +1,135 @@ +/* $OpenBSD: iswctype_sb.c,v 1.1 2005/04/30 09:14:23 espie Exp $ */ +/* $NetBSD: iswctype_sb.c,v 1.3 2003/08/07 16:43:04 agc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. + * + * 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 of the University 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 REGENTS 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 REGENTS 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char rcsid[] = "$OpenBSD: iswctype_sb.c,v 1.1 2005/04/30 09:14:23 espie Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <wchar.h> +#include <wctype.h> +#include <ctype.h> + +int +iswalnum(wint_t c) +{ + return isalnum((int)c); +} + +int +iswalpha(wint_t c) +{ + return isalpha((int)c); +} + +int +iswblank(wint_t c) +{ + return isblank((int)c); +} + +int +iswcntrl(wint_t c) +{ + return iscntrl((int)c); +} + +int +iswdigit(wint_t c) +{ + return isdigit((int)c); +} + +int +iswgraph(wint_t c) +{ + return isgraph((int)c); +} + +int +iswlower(wint_t c) +{ + return islower((int)c); +} + +int +iswprint(wint_t c) +{ + return isprint((int)c); +} + +int +iswpunct(wint_t c) +{ + return ispunct((int)c); +} + +int +iswspace(wint_t c) +{ + return isspace((int)c); +} + +int +iswupper(wint_t c) +{ + return isupper((int)c); +} + +int +iswxdigit(wint_t c) +{ + return isxdigit((int)c); +} + +wint_t +towupper(wint_t c) +{ + return toupper((int)c); +} + +wint_t +towlower(wint_t c) +{ + return tolower((int)c); +} + +int +wcwidth(wint_t c) +{ + return 1; +} + diff --git a/lib/libc/locale/towlower.3 b/lib/libc/locale/towlower.3 new file mode 100644 index 00000000000..d8d49fb37c7 --- /dev/null +++ b/lib/libc/locale/towlower.3 @@ -0,0 +1,69 @@ +.\" $OpenBSD: towlower.3,v 1.1 2005/04/30 09:14:23 espie Exp $ +.\" $NetBSD: towlower.3,v 1.7 2003/09/08 17:54:31 wiz Exp $ +.\" +.\" Copyright (c) 1989, 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to Berkeley by +.\" the American National Standards Committee X3, on Information +.\" Processing Systems. +.\" +.\" 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 of the University 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 REGENTS 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 REGENTS 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. +.\" +.\" @(#)tolower.3 5.2 (Berkeley) 6/29/91 +.\" +.Dd December 22, 2000 +.Dt TOWLOWER 3 +.Os +.Sh NAME +.Nm towlower +.Nd wide character case letter conversion utilities +.Sh SYNOPSIS +.In wctype.h +.Ft wint_t +.Fn towlower "wint_t wc" +.Ft wint_t +.Fn towupper "wint_t wc" +.Sh DESCRIPTION +The +.Fn towlower +function converts an upper-case wide character to the corresponding lower-case +letter. +The +.Fn towupper +function converts an lower-case wide character to the corresponding upper-case +letter. +.Sh RETURN VALUES +If the argument is an upper/lower-case letter, the +.Fn tolower +function returns the corresponding counterpart if there is +one; otherwise the argument is returned unchanged. +.Sh SEE ALSO +.Xr tolower 3 , +.Xr toupper 3 +.Sh STANDARDS +The functions conform to +.St isoC-amd1 , +.St -isoC-99 . diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version index 413ae7a8418..eaa383b64ee 100644 --- a/lib/libc/shlib_version +++ b/lib/libc/shlib_version @@ -1,4 +1,4 @@ major=35 -minor=1 +minor=2 # note: If changes were made to include/thread_private.h or if system # calls were added/changed then libpthread must also be updated. |