Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add isalpha_l and friends.
details: https://anonhg.NetBSD.org/src/rev/9e0c4fe48058
branches: trunk
changeset: 786121:9e0c4fe48058
user: joerg <joerg%NetBSD.org@localhost>
date: Tue Apr 16 11:29:12 2013 +0000
description:
Add isalpha_l and friends.
diffstat:
include/ctype.h | 24 +++++++++++++++++++++++-
lib/libc/gen/isctype.c | 27 +++++++++++++++++++++++++--
2 files changed, 48 insertions(+), 3 deletions(-)
diffs (99 lines):
diff -r 6cbea25543a6 -r 9e0c4fe48058 include/ctype.h
--- a/include/ctype.h Tue Apr 16 10:54:53 2013 +0000
+++ b/include/ctype.h Tue Apr 16 11:29:12 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: ctype.h,v 1.32 2013/04/16 11:29:12 joerg Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -57,6 +57,28 @@
int tolower(int);
int toupper(int);
+#if (_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE)
+# ifndef __LOCALE_T_DECLARED
+typedef struct _locale *locale_t;
+# define __LOCALE_T_DECLARED
+# endif
+
+int isalnum_l(int, locale_t);
+int isalpha_l(int, locale_t);
+int isblank_l(int, locale_t);
+int iscntrl_l(int, locale_t);
+int isdigit_l(int, locale_t);
+int isgraph_l(int, locale_t);
+int islower_l(int, locale_t);
+int isprint_l(int, locale_t);
+int ispunct_l(int, locale_t);
+int isspace_l(int, locale_t);
+int isupper_l(int, locale_t);
+int isxdigit_l(int, locale_t);
+int tolower_l(int, locale_t);
+int toupper_l(int, locale_t);
+#endif
+
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
int isascii(int);
int toascii(int);
diff -r 6cbea25543a6 -r 9e0c4fe48058 lib/libc/gen/isctype.c
--- a/lib/libc/gen/isctype.c Tue Apr 16 10:54:53 2013 +0000
+++ b/lib/libc/gen/isctype.c Tue Apr 16 11:29:12 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isctype.c,v 1.22 2013/04/13 10:21:20 joerg Exp $ */
+/* $NetBSD: isctype.c,v 1.23 2013/04/16 11:29:13 joerg Exp $ */
/*-
* Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isctype.c,v 1.22 2013/04/13 10:21:20 joerg Exp $");
+__RCSID("$NetBSD: isctype.c,v 1.23 2013/04/16 11:29:13 joerg Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -53,6 +53,13 @@
is##name(int c) \
{ \
return (int)(_CTYPE_TAB(ctype_tab, c) & (bit)); \
+} \
+int \
+is##name ## _l(int c, locale_t loc) \
+{ \
+ if (loc == NULL) \
+ loc = _C_locale; \
+ return (int)(((loc->cache->ctype_tab + 1)[c]) & (bit)); \
}
_ISCTYPE_FUNC(alnum, (_CTYPE_A|_CTYPE_D))
@@ -75,12 +82,28 @@
}
int
+toupper_l(int c, locale_t loc)
+{
+ if (loc == NULL)
+ loc = _C_locale;
+ return (int)(((loc->cache->toupper_tab + 1)[c]));
+}
+
+int
tolower(int c)
{
return (int)_CTYPE_TAB(tolower_tab, c);
}
int
+tolower_l(int c, locale_t loc)
+{
+ if (loc == NULL)
+ loc = _C_locale;
+ return (int)(((loc->cache->tolower_tab + 1)[c]));
+}
+
+int
_toupper(int c)
{
return (c - 'a' + 'A');
Home |
Main Index |
Thread Index |
Old Index