From 984b6cc8df18c9b3bd311580bd509167e1c531cf Mon Sep 17 00:00:00 2001 From: theraven Date: Tue, 13 Mar 2012 20:02:41 +0000 Subject: First set of xlocale man pages. More to follow... Approved by: dim (mentor) --- lib/libc/locale/Makefile.inc | 1 + lib/libc/locale/btowc.3 | 9 +++ lib/libc/locale/ctype.3 | 2 +- lib/libc/locale/ctype_l.3 | 138 +++++++++++++++++++++++++++++++++++++++++++ lib/libc/locale/digittoint.3 | 11 +++- lib/libc/locale/isalnum.3 | 13 ++++ lib/libc/locale/isalpha.3 | 13 ++++ lib/libc/locale/isblank.3 | 13 ++++ lib/libc/locale/iscntrl.3 | 13 ++++ lib/libc/locale/isdigit.3 | 12 ++++ 10 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 lib/libc/locale/ctype_l.3 (limited to 'lib/libc/locale') diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc index 55800d0..adae8bd 100644 --- a/lib/libc/locale/Makefile.inc +++ b/lib/libc/locale/Makefile.inc @@ -26,6 +26,7 @@ SRCS+= ascii.c big5.c btowc.c collate.c collcmp.c euc.c fix_grouping.c \ SYM_MAPS+=${.CURDIR}/locale/Symbol.map MAN+= btowc.3 \ + ctype_l.3 \ ctype.3 digittoint.3 isalnum.3 isalpha.3 isascii.3 isblank.3 iscntrl.3 \ isdigit.3 isgraph.3 isideogram.3 islower.3 isphonogram.3 isprint.3 \ ispunct.3 isrune.3 isspace.3 isspecial.3 \ diff --git a/lib/libc/locale/btowc.3 b/lib/libc/locale/btowc.3 index 9eca437..d9c3e9c 100644 --- a/lib/libc/locale/btowc.3 +++ b/lib/libc/locale/btowc.3 @@ -39,6 +39,12 @@ .Fn btowc "int c" .Ft int .Fn wctob "wint_t c" +.In wchar.h +.In xlocale.h +.Ft wint_t +.Fn btowc "int c" +.Ft int +.Fn wctob "wint_t c" .Sh DESCRIPTION The .Fn btowc @@ -59,6 +65,9 @@ or not able to be represented as a single byte in the initial shift state, .Fn wctob returns .Dv EOF . +.Pp +The _l-suffixed versions take an explicit locale argument, while the +non-suffixed versions use the current global or per-thread locale. .Sh SEE ALSO .Xr mbrtowc 3 , .Xr multibyte 3 , diff --git a/lib/libc/locale/ctype.3 b/lib/libc/locale/ctype.3 index fdc1358..49a3902 100644 --- a/lib/libc/locale/ctype.3 +++ b/lib/libc/locale/ctype.3 @@ -55,7 +55,7 @@ .Nm toascii , .Nm tolower , .Nm toupper -.Nd character classification macros +.Nd character classification functions .Sh LIBRARY .Lb libc .Sh SYNOPSIS diff --git a/lib/libc/locale/ctype_l.3 b/lib/libc/locale/ctype_l.3 new file mode 100644 index 0000000..182e7cf --- /dev/null +++ b/lib/libc/locale/ctype_l.3 @@ -0,0 +1,138 @@ +.\" Copyright (c) 2011 The FreeBSD Foundation +.\" All rights reserved. +.\" +.\" This documentation was written by David Chisnall under sponsorship from +.\" the FreeBSD Foundation. +.\" +.\" 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. +.\" +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd March 6, 2012 +.Dt CTYPE_L 3 +.Os +.Sh NAME +.Nm digittoint_l , +.Nm isalnum_l , +.Nm isalpha_l , +.Nm isascii_l , +.Nm isblank_l , +.Nm iscntrl_l , +.Nm isdigit_l , +.Nm isgraph_l , +.Nm ishexnumber_l , +.Nm isideogram_l , +.Nm islower_l , +.Nm isnumber_l , +.Nm isphonogram_l , +.Nm isprint_l , +.Nm ispunct_l , +.Nm isrune_l , +.Nm isspace_l , +.Nm isspecial_l , +.Nm isupper_l , +.Nm isxdigit_l , +.Nm tolower_l , +.Nm toupper_l +.Nd character classification functions +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In ctype.h +.Ft int +.Fn digittoint_l "int c" "locale_t loc" +.Ft int +.Fn isalnum_l "int c" "locale_t loc" +.Ft int +.Fn isalpha_l "int c" "locale_t loc" +.Ft int +.Fn isascii_l "int c" "locale_t loc" +.Ft int +.Fn iscntrl_l "int c" "locale_t loc" +.Ft int +.Fn isdigit_l "int c" "locale_t loc" +.Ft int +.Fn isgraph_l "int c" "locale_t loc" +.Ft int +.Fn ishexnumber_l "int c" "locale_t loc" +.Ft int +.Fn isideogram_l "int c" "locale_t loc" +.Ft int +.Fn islower_l "int c" "locale_t loc" +.Ft int +.Fn isnumber_l "int c" "locale_t loc" +.Ft int +.Fn isphonogram_l "int c" "locale_t loc" +.Ft int +.Fn isspecial_l "int c" "locale_t loc" +.Ft int +.Fn isprint_l "int c" "locale_t loc" +.Ft int +.Fn ispunct_l "int c" "locale_t loc" +.Ft int +.Fn isrune_l "int c" "locale_t loc" +.Ft int +.Fn isspace_l "int c" "locale_t loc" +.Ft int +.Fn isupper_l "int c" "locale_t loc" +.Ft int +.Fn isxdigit_l "int c" "locale_t loc" +.Ft int +.Fn tolower_l "int c" "locale_t loc" +.Ft int +.Fn toupper_l "int c" "locale_t loc" +.Sh DESCRIPTION +The above functions perform character tests and conversions on the integer +.Fa c +in the locale +.Fa loc . +They behave in the same way as the versions without the _l suffix, but use the +specified locale rather than the global or per-thread locale. +.In ctype.h , +or as true functions in the C library. +See the specific manual pages for more information. +.Sh SEE ALSO +.Xr digittoint 3 , +.Xr isalnum 3 , +.Xr isalpha 3 , +.Xr isascii 3 , +.Xr isblank 3 , +.Xr iscntrl 3 , +.Xr isdigit 3 , +.Xr isgraph 3 , +.Xr isideogram 3 , +.Xr islower 3 , +.Xr isphonogram 3 , +.Xr isprint 3 , +.Xr ispunct 3 , +.Xr isrune 3 , +.Xr isspace 3 , +.Xr isspecial 3 , +.Xr isupper 3 , +.Xr isxdigit 3 , +.Xr tolower 3 , +.Xr toupper 3 , +.Xr wctype 3 , +.Xr xlocale 3 +.Sh STANDARDS +These functions conform to +.St -p1003.1-2008 . diff --git a/lib/libc/locale/digittoint.3 b/lib/libc/locale/digittoint.3 index 372e00f..eebd064 100644 --- a/lib/libc/locale/digittoint.3 +++ b/lib/libc/locale/digittoint.3 @@ -40,12 +40,20 @@ .In ctype.h .Ft int .Fn digittoint "int c" +.Ft int +.Fn digittoint_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn digittoint function converts a numeric character to its corresponding integer value. The character can be any decimal digit or hexadecimal digit. With hexadecimal characters, the case of the values does not matter. +.Pp +The +.Fn digittoint_l +function takes an explicit locale argument, whereas the +.Fn digittoint +function use the current global or per-thread locale. .Sh RETURN VALUES The .Fn digittoint @@ -56,4 +64,5 @@ the function will return 0. .Sh SEE ALSO .Xr ctype 3 , .Xr isdigit 3 , -.Xr isxdigit 3 +.Xr isxdigit 3, +.Xr xlocale 3 diff --git a/lib/libc/locale/isalnum.3 b/lib/libc/locale/isalnum.3 index 038c5cf..c9042b5 100644 --- a/lib/libc/locale/isalnum.3 +++ b/lib/libc/locale/isalnum.3 @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn isalnum "int c" +.Ft int +.Fn isalnum_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isalnum @@ -74,6 +76,12 @@ In the ASCII character set, this includes the following characters .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El +.Pp +The +.Fn isalnum_l +function takes an explicit locale argument, whereas the +.Fn isalnum +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isalnum @@ -94,9 +102,14 @@ function should be used instead. .Xr isalpha 3 , .Xr isdigit 3 , .Xr iswalnum 3 , +.Xr xlocale 3 , .Xr ascii 7 .Sh STANDARDS The .Fn isalnum function conforms to .St -isoC . +The +.Fn isalnum_l +function conforms to +.St -p1003.1-2008 . diff --git a/lib/libc/locale/isalpha.3 b/lib/libc/locale/isalpha.3 index 689b6cd..4e4dfb5 100644 --- a/lib/libc/locale/isalpha.3 +++ b/lib/libc/locale/isalpha.3 @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn isalpha "int c" +.Ft int +.Fn isalpha_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isalpha @@ -72,6 +74,11 @@ In the ASCII character set, this includes the following characters .It "\&164\ ``t'' \t165\ ``u'' \t166\ ``v'' \t167\ ``w'' \t170\ ``x''" .It "\&171\ ``y'' \t172\ ``z''" .El +The +.Fn isalpha_l +function takes an explicit locale argument, whereas the +.Fn isalpha +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isalpha @@ -92,9 +99,15 @@ function should be used instead. .Xr islower 3 , .Xr isupper 3 , .Xr iswalpha 3 , +.Xr xlocale 3 , .Xr ascii 7 .Sh STANDARDS The .Fn isalpha function conforms to .St -isoC . +The +.Fn isalpha_l +function conforms to +.St -p1003.1-2008 . + diff --git a/lib/libc/locale/isblank.3 b/lib/libc/locale/isblank.3 index 2668e93..8ef5c8d 100644 --- a/lib/libc/locale/isblank.3 +++ b/lib/libc/locale/isblank.3 @@ -40,6 +40,8 @@ .In ctype.h .Ft int .Fn isblank "int c" +.Ft int +.Fn isblank "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isblank @@ -56,6 +58,12 @@ The value of the argument must be representable as an .Vt "unsigned char" or the value of .Dv EOF . +.Pp +The +.Fn isblank_l +function takes an explicit locale argument, whereas the +.Fn isblank +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn isblank @@ -74,6 +82,7 @@ function should be used instead. .Sh SEE ALSO .Xr ctype 3 , .Xr iswblank 3 , +.Xr xlocale 3 , .Xr ascii 7 .Sh STANDARDS The @@ -81,3 +90,7 @@ The function conforms to .St -isoC-99 . +The +.Fn isblank_l +function conforms to +.St -p1003.1-2008 . diff --git a/lib/libc/locale/iscntrl.3 b/lib/libc/locale/iscntrl.3 index a67e6a4..21b98a7 100644 --- a/lib/libc/locale/iscntrl.3 +++ b/lib/libc/locale/iscntrl.3 @@ -44,6 +44,8 @@ .In ctype.h .Ft int .Fn iscntrl "int c" +.Ft int +.Fn iscntrl_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn iscntrl @@ -65,6 +67,12 @@ In the ASCII character set, this includes the following characters .It "\&031\ EM \t032\ SUB \t033\ ESC \t034\ FS \t035\ GS" .It "\&036\ RS \t037\ US \t177\ DEL" .El +.Pp +The +.Fn iscntrl_l +function takes an explicit locale argument, whereas the +.Fn iscntrl +function uses the current global or per-thread locale. .Sh RETURN VALUES The .Fn iscntrl @@ -83,9 +91,14 @@ function should be used instead. .Sh SEE ALSO .Xr ctype 3 , .Xr iswcntrl 3 , +.Xr xlocale 3 , .Xr ascii 7 .Sh STANDARDS The .Fn iscntrl function conforms to .St -isoC . +The +.Fn iscntrl_l +function conforms to +.St -p1003.1-2008 . diff --git a/lib/libc/locale/isdigit.3 b/lib/libc/locale/isdigit.3 index 53b1986..961d7e1 100644 --- a/lib/libc/locale/isdigit.3 +++ b/lib/libc/locale/isdigit.3 @@ -46,6 +46,10 @@ .Fn isdigit "int c" .Ft int .Fn isnumber "int c" +.Ft int +.Fn isdigit_l "int c" "locale_t loc" +.Ft int +.Fn isnumber_l "int c" "locale_t loc" .Sh DESCRIPTION The .Fn isdigit @@ -68,6 +72,9 @@ The value of the argument must be representable as an .Vt "unsigned char" or the value of .Dv EOF . +.Pp +The _l-suffixed versions take an explicit locale argument, whereas the +non-suffixed versions use the current global or per-thread locale. .Sh RETURN VALUES The .Fn isdigit @@ -89,12 +96,17 @@ function should be used instead. .Xr ctype 3 , .Xr iswdigit 3 , .Xr multibyte 3 , +.Xr xlocale 3 , .Xr ascii 7 .Sh STANDARDS The .Fn isdigit function conforms to .St -isoC . +The +.Fn isdigit_l +function conforms to +.St -p1003.1-2008 . .Sh HISTORY The .Fn isnumber -- cgit v1.1