Module Name:    src
Committed By:   tnozaki
Date:           Tue Jun  1 13:52:08 UTC 2010

Modified Files:
        src/distrib/sets/lists/comp: mi
        src/include: ctype.h
        src/lib/libc/citrus: citrus_lc_ctype.c
        src/lib/libc/gen: ctype_.c isascii.c isctype.c tolower_.c toupper_.c
        src/lib/libc/locale: _wctrans.c _wctype.c ctypeio.c fix_grouping.c
            global_locale.c iswctype_mb.c iswctype_sb.c localeio_lc_ctype.c
            rune.c runeglue.c runetable.c
        src/sys/sys: Makefile
Added Files:
        src/sys/sys: ctype_bits.h ctype_inline.h

Log Message:
more split ctype.h -> sys/ctype_inline.h, sys/ctype_bits.h


To generate a diff of this commit:
cvs rdiff -u -r1.1454 -r1.1455 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.30 -r1.31 src/include/ctype.h
cvs rdiff -u -r1.5 -r1.6 src/lib/libc/citrus/citrus_lc_ctype.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/gen/ctype_.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/gen/isascii.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/gen/isctype.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/gen/tolower_.c \
    src/lib/libc/gen/toupper_.c
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/locale/_wctrans.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/locale/_wctype.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/locale/ctypeio.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/locale/fix_grouping.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/locale/global_locale.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/locale/iswctype_mb.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/locale/iswctype_sb.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/locale/localeio_lc_ctype.c
cvs rdiff -u -r1.35 -r1.36 src/lib/libc/locale/rune.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/locale/runeglue.c
cvs rdiff -u -r1.23 -r1.24 src/lib/libc/locale/runetable.c
cvs rdiff -u -r1.126 -r1.127 src/sys/sys/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/sys/ctype_bits.h src/sys/sys/ctype_inline.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1454 src/distrib/sets/lists/comp/mi:1.1455
--- src/distrib/sets/lists/comp/mi:1.1454	Fri May 21 21:46:48 2010
+++ src/distrib/sets/lists/comp/mi	Tue Jun  1 13:52:07 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1454 2010/05/21 21:46:48 njoly Exp $
+#	$NetBSD: mi,v 1.1455 2010/06/01 13:52:07 tnozaki Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1973,6 +1973,8 @@
 ./usr/include/sys/core.h			comp-c-include
 ./usr/include/sys/cpu_data.h			comp-obsolete		obsolete
 ./usr/include/sys/cpuio.h			comp-c-include
+./usr/include/sys/ctype_bits.h			comp-c-include
+./usr/include/sys/ctype_inline.h		comp-c-include
 ./usr/include/sys/device.h			comp-c-include
 ./usr/include/sys/device_if.h			comp-c-include
 ./usr/include/sys/dir.h				comp-c-include

Index: src/include/ctype.h
diff -u src/include/ctype.h:1.30 src/include/ctype.h:1.31
--- src/include/ctype.h:1.30	Sat May 22 06:38:15 2010
+++ src/include/ctype.h	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp $	*/
+/*	$NetBSD: ctype.h,v 1.31 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -42,20 +42,6 @@
 #include <sys/cdefs.h>
 #include <sys/featuretest.h>
 
-#define	_U	0x01
-#define	_L	0x02
-#define	_N	0x04
-#define	_S	0x08
-#define	_P	0x10
-#define	_C	0x20
-#define	_X	0x40
-#define	_B	0x80
-
-extern const unsigned char	*_ctype_;
-extern const short	*_tolower_tab_;
-extern const short	*_toupper_tab_;
-
-
 __BEGIN_DECLS
 int	isalnum(int);
 int	isalpha(int);
@@ -84,38 +70,8 @@
 #endif
 __END_DECLS
 
-#define	isdigit(c)	((int)((_ctype_ + 1)[(c)] & _N))
-#define	islower(c)	((int)((_ctype_ + 1)[(c)] & _L))
-#define	isspace(c)	((int)((_ctype_ + 1)[(c)] & _S))
-#define	ispunct(c)	((int)((_ctype_ + 1)[(c)] & _P))
-#define	isupper(c)	((int)((_ctype_ + 1)[(c)] & _U))
-#define	isalpha(c)	((int)((_ctype_ + 1)[(c)] & (_U|_L)))
-#define	isxdigit(c)	((int)((_ctype_ + 1)[(c)] & (_N|_X)))
-#define	isalnum(c)	((int)((_ctype_ + 1)[(c)] & (_U|_L|_N)))
-#define	isprint(c)	((int)((_ctype_ + 1)[(c)] & (_P|_U|_L|_N|_B)))
-#define	isgraph(c)	((int)((_ctype_ + 1)[(c)] & (_P|_U|_L|_N)))
-#define	iscntrl(c)	((int)((_ctype_ + 1)[(c)] & _C))
-#define	tolower(c)	((int)((_tolower_tab_ + 1)[(c)]))
-#define	toupper(c)	((int)((_toupper_tab_ + 1)[(c)]))
-
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
-#define	isascii(c)	((unsigned)(c) <= 0177)
-#define	toascii(c)	((c) & 0177)
-#define _tolower(c)	((c) - 'A' + 'a')
-#define _toupper(c)	((c) - 'a' + 'A')
-#endif
-
-#if defined(_ISO_C99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
-    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
-
-/*
- * isblank() is implemented as C function, due to insufficient bitwidth in
- * _ctype_.  Note that _B does not mean isblank - it means isprint && !isgraph.
- */
-#if 0
-#define isblank(c)	((int)((_ctype_ + 1)[(c)] & _B))
-#endif
-
+#if defined(_NETBSD_SOURCE) && !defined(_CTYPE_NOINLINE)
+#include <sys/ctype_inline.h>
 #endif
 
 #endif /* !_CTYPE_H_ */

Index: src/lib/libc/citrus/citrus_lc_ctype.c
diff -u src/lib/libc/citrus/citrus_lc_ctype.c:1.5 src/lib/libc/citrus/citrus_lc_ctype.c:1.6
--- src/lib/libc/citrus/citrus_lc_ctype.c:1.5	Sat May 22 08:13:18 2010
+++ src/lib/libc/citrus/citrus_lc_ctype.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_ctype.c,v 1.5 2010/05/22 08:13:18 tnozaki Exp $ */
+/* $NetBSD: citrus_lc_ctype.c,v 1.6 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,14 +28,14 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.5 2010/05/22 08:13:18 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.6 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "reentrant.h"
 #include <sys/types.h>
+#include <sys/ctype_bits.h>
 #include <sys/queue.h>
 #include <assert.h>
-#include <ctype.h>
 #include <errno.h>
 #include <langinfo.h>
 #include <limits.h>

Index: src/lib/libc/gen/ctype_.c
diff -u src/lib/libc/gen/ctype_.c:1.17 src/lib/libc/gen/ctype_.c:1.18
--- src/lib/libc/gen/ctype_.c:1.17	Sat May 22 06:38:15 2010
+++ src/lib/libc/gen/ctype_.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctype_.c,v 1.17 2010/05/22 06:38:15 tnozaki Exp $	*/
+/*	$NetBSD: ctype_.c,v 1.18 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -39,11 +39,11 @@
 #if 0
 /*static char *sccsid = "from: @(#)ctype_.c	5.6 (Berkeley) 6/1/90";*/
 #else
-__RCSID("$NetBSD: ctype_.c,v 1.17 2010/05/22 06:38:15 tnozaki Exp $");
+__RCSID("$NetBSD: ctype_.c,v 1.18 2010/06/01 13:52:08 tnozaki Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
-#include <ctype.h>
+#include <sys/ctype_bits.h>
 #include <stdio.h>
 #include "ctype_local.h"
 

Index: src/lib/libc/gen/isascii.c
diff -u src/lib/libc/gen/isascii.c:1.2 src/lib/libc/gen/isascii.c:1.3
--- src/lib/libc/gen/isascii.c:1.2	Thu Aug  7 16:42:51 2003
+++ src/lib/libc/gen/isascii.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: isascii.c,v 1.2 2003/08/07 16:42:51 agc Exp $	*/
+/*	$NetBSD: isascii.c,v 1.3 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*
  * Copyright (c) 1989 The Regents of the University of California.
@@ -38,12 +38,12 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isascii.c,v 1.2 2003/08/07 16:42:51 agc Exp $");
+__RCSID("$NetBSD: isascii.c,v 1.3 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#define _CTYPE_NOINLINE
 #include <ctype.h>
 
-#undef isascii
 int
 isascii(c)
 	int c;

Index: src/lib/libc/gen/isctype.c
diff -u src/lib/libc/gen/isctype.c:1.19 src/lib/libc/gen/isctype.c:1.20
--- src/lib/libc/gen/isctype.c:1.19	Sat May 22 13:15:59 2010
+++ src/lib/libc/gen/isctype.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: isctype.c,v 1.19 2010/05/22 13:15:59 tnozaki Exp $ */
+/* $NetBSD: isctype.c,v 1.20 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,11 +28,13 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: isctype.c,v 1.19 2010/05/22 13:15:59 tnozaki Exp $");
+__RCSID("$NetBSD: isctype.c,v 1.20 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #include <sys/types.h>
+#include <sys/ctype_bits.h>
+#define _CTYPE_NOINLINE
 #include <ctype.h>
 #include <langinfo.h>
 #define __SETLOCALE_SOURCE__
@@ -46,18 +48,6 @@
 
 #define _CTYPE_TAB(table, i)	((_current_cache()->table + 1)[i])
 
-#undef isalnum
-#undef isalpha
-#undef iscntrl
-#undef isdigit
-#undef isgraph
-#undef islower
-#undef isprint
-#undef ispunct
-#undef isspace
-#undef isupper
-#undef isxdigit
-
 #define _ISCTYPE_FUNC(name, bit) \
 int \
 is##name(int c) \
@@ -77,7 +67,6 @@
 _ISCTYPE_FUNC(upper,  _U            )
 _ISCTYPE_FUNC(xdigit, _N|_X         )
 
-#undef isblank
 int
 isblank(int c)
 {
@@ -85,28 +74,24 @@
         return c == ' ' || c == '\t';
 }
 
-#undef toupper
 int
 toupper(int c)
 {
 	return (int)_CTYPE_TAB(toupper_tab, c);
 }
 
-#undef tolower
 int
 tolower(int c)
 {
 	return (int)_CTYPE_TAB(tolower_tab, c);
 }
 
-#undef _toupper
 int
 _toupper(int c)
 {
 	return (c - 'a' + 'A');
 }
 
-#undef _tolower
 int
 _tolower(int c)
 {

Index: src/lib/libc/gen/tolower_.c
diff -u src/lib/libc/gen/tolower_.c:1.12 src/lib/libc/gen/tolower_.c:1.13
--- src/lib/libc/gen/tolower_.c:1.12	Sat May 22 06:38:15 2010
+++ src/lib/libc/gen/tolower_.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: tolower_.c,v 1.12 2010/05/22 06:38:15 tnozaki Exp $	*/
+/*	$NetBSD: tolower_.c,v 1.13 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*
  * Written by J.T. Conklin <j...@netbsd.org>.
@@ -7,10 +7,10 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_RCS) && !defined(lint)
-__RCSID("$NetBSD: tolower_.c,v 1.12 2010/05/22 06:38:15 tnozaki Exp $");
+__RCSID("$NetBSD: tolower_.c,v 1.13 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_RCS and not lint */
 
-#include <ctype.h>
+#include <sys/ctype_bits.h>
 #include <stdio.h>
 #include "ctype_local.h"
 
Index: src/lib/libc/gen/toupper_.c
diff -u src/lib/libc/gen/toupper_.c:1.12 src/lib/libc/gen/toupper_.c:1.13
--- src/lib/libc/gen/toupper_.c:1.12	Sat May 22 06:38:15 2010
+++ src/lib/libc/gen/toupper_.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: toupper_.c,v 1.12 2010/05/22 06:38:15 tnozaki Exp $	*/
+/*	$NetBSD: toupper_.c,v 1.13 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*
  * Written by J.T. Conklin <j...@netbsd.org>.
@@ -7,10 +7,10 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_RCS) && !defined(lint)
-__RCSID("$NetBSD: toupper_.c,v 1.12 2010/05/22 06:38:15 tnozaki Exp $");
+__RCSID("$NetBSD: toupper_.c,v 1.13 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_RCS and not lint */
 
-#include <ctype.h>
+#include <sys/ctype_bits.h>
 #include <stdio.h>
 #include "ctype_local.h"
 

Index: src/lib/libc/locale/_wctrans.c
diff -u src/lib/libc/locale/_wctrans.c:1.14 src/lib/libc/locale/_wctrans.c:1.15
--- src/lib/libc/locale/_wctrans.c:1.14	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/_wctrans.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: _wctrans.c,v 1.14 2010/05/22 07:18:43 tnozaki Exp $	*/
+/*	$NetBSD: _wctrans.c,v 1.15 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -60,15 +60,15 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctrans.c,v 1.14 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: _wctrans.c,v 1.15 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 
+#include <sys/types.h>
 #include <assert.h>
 #include <wctype.h>
-#include <stdlib.h>
-#include <string.h>
+
 #include "rune_local.h"
 #include "_wctrans_local.h"
 
@@ -84,6 +84,8 @@
 	_RuneRange *rr;
 	_RuneEntry *base, *re;
 
+	_DIAGASSERT(te != NULL);
+
 	if (c == WEOF)
 		return (c);
 

Index: src/lib/libc/locale/_wctype.c
diff -u src/lib/libc/locale/_wctype.c:1.6 src/lib/libc/locale/_wctype.c:1.7
--- src/lib/libc/locale/_wctype.c:1.6	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/_wctype.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: _wctype.c,v 1.6 2010/05/22 07:18:43 tnozaki Exp $ */
+/* $NetBSD: _wctype.c,v 1.7 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -60,13 +60,12 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctype.c,v 1.6 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: _wctype.c,v 1.7 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
+#include <sys/types.h>
 #include <assert.h>
-#include <ctype.h>
-#include <errno.h>
-#include <string.h>
+#include <wctype.h>
 
 #include "rune_local.h"
 #include "_wctrans_local.h"

Index: src/lib/libc/locale/ctypeio.c
diff -u src/lib/libc/locale/ctypeio.c:1.12 src/lib/libc/locale/ctypeio.c:1.13
--- src/lib/libc/locale/ctypeio.c:1.12	Sat May 22 06:38:15 2010
+++ src/lib/libc/locale/ctypeio.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ctypeio.c,v 1.12 2010/05/22 06:38:15 tnozaki Exp $ */
+/* $NetBSD: ctypeio.c,v 1.13 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -26,12 +26,11 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ctypeio.c,v 1.12 2010/05/22 06:38:15 tnozaki Exp $");
+__RCSID("$NetBSD: ctypeio.c,v 1.13 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <assert.h>
-#include <ctype.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>

Index: src/lib/libc/locale/fix_grouping.c
diff -u src/lib/libc/locale/fix_grouping.c:1.4 src/lib/libc/locale/fix_grouping.c:1.5
--- src/lib/libc/locale/fix_grouping.c:1.4	Sun Jan 11 02:46:28 2009
+++ src/lib/libc/locale/fix_grouping.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: fix_grouping.c,v 1.4 2009/01/11 02:46:28 christos Exp $ */
+/* $NetBSD: fix_grouping.c,v 1.5 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*
  * Copyright (c) 2001 Alexey Zelkin <phan...@freebsd.org>
@@ -35,10 +35,9 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fix_grouping.c,v 1.4 2009/01/11 02:46:28 christos Exp $");
+__RCSID("$NetBSD: fix_grouping.c,v 1.5 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
-#include <ctype.h>
 #include <limits.h>
 #include <stddef.h>
 
@@ -55,7 +54,6 @@
 static const char nogrouping[] = { NBCHAR_MAX, '\0' };
 
 /* don't use libc's isdigit, it owes locale. */
-#undef isdigit
 #define isdigit(c)	(c >= '0' && c <= '9')
 
 /*

Index: src/lib/libc/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.8 src/lib/libc/locale/global_locale.c:1.9
--- src/lib/libc/locale/global_locale.c:1.8	Sat May 22 13:15:59 2010
+++ src/lib/libc/locale/global_locale.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.8 2010/05/22 13:15:59 tnozaki Exp $ */
+/* $NetBSD: global_locale.c,v 1.9 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,12 +28,12 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.8 2010/05/22 13:15:59 tnozaki Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.9 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
+#include <sys/ctype_bits.h>
 #include <sys/localedef.h>
-#include <ctype.h>
 #include <langinfo.h>
 #include <limits.h>
 #define __SETLOCALE_SOURCE__

Index: src/lib/libc/locale/iswctype_mb.c
diff -u src/lib/libc/locale/iswctype_mb.c:1.7 src/lib/libc/locale/iswctype_mb.c:1.8
--- src/lib/libc/locale/iswctype_mb.c:1.7	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/iswctype_mb.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: iswctype_mb.c,v 1.7 2010/05/22 07:18:43 tnozaki Exp $ */
+/* $NetBSD: iswctype_mb.c,v 1.8 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,18 +28,15 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iswctype_mb.c,v 1.7 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: iswctype_mb.c,v 1.8 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #include <sys/types.h>
 #include <assert.h>
-#include <ctype.h>
 #include <errno.h>
-#include <langinfo.h>
 #define __SETLOCALE_SOURCE__
 #include <locale.h>
-#include <stdlib.h>
 #include <string.h>
 #include <wctype.h>
 

Index: src/lib/libc/locale/iswctype_sb.c
diff -u src/lib/libc/locale/iswctype_sb.c:1.9 src/lib/libc/locale/iswctype_sb.c:1.10
--- src/lib/libc/locale/iswctype_sb.c:1.9	Sun May 30 08:28:53 2010
+++ src/lib/libc/locale/iswctype_sb.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: iswctype_sb.c,v 1.9 2010/05/30 08:28:53 tnozaki Exp $ */
+/* $NetBSD: iswctype_sb.c,v 1.10 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,18 +28,16 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iswctype_sb.c,v 1.9 2010/05/30 08:28:53 tnozaki Exp $");
+__RCSID("$NetBSD: iswctype_sb.c,v 1.10 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
 #include <assert.h>
+#define _CTYPE_NOINLINE
 #include <ctype.h>
 #include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 #include <wctype.h>
-#include <wchar.h>
 
 #define _ISWCTYPE_FUNC(name)				\
 int							\

Index: src/lib/libc/locale/localeio_lc_ctype.c
diff -u src/lib/libc/locale/localeio_lc_ctype.c:1.2 src/lib/libc/locale/localeio_lc_ctype.c:1.3
--- src/lib/libc/locale/localeio_lc_ctype.c:1.2	Sun Jan 11 02:46:28 2009
+++ src/lib/libc/locale/localeio_lc_ctype.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: localeio_lc_ctype.c,v 1.2 2009/01/11 02:46:28 christos Exp $ */
+/* $NetBSD: localeio_lc_ctype.c,v 1.3 2010/06/01 13:52:08 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,14 +28,14 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: localeio_lc_ctype.c,v 1.2 2009/01/11 02:46:28 christos Exp $");
+__RCSID("$NetBSD: localeio_lc_ctype.c,v 1.3 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "reentrant.h"
 #include <sys/types.h>
+#include <sys/ctype_bits.h>
 #include <sys/queue.h>
 #include <assert.h>
-#include <ctype.h>
 #include <errno.h>
 #include <langinfo.h>
 #include <limits.h>

Index: src/lib/libc/locale/rune.c
diff -u src/lib/libc/locale/rune.c:1.35 src/lib/libc/locale/rune.c:1.36
--- src/lib/libc/locale/rune.c:1.35	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/rune.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rune.c,v 1.35 2010/05/22 07:18:43 tnozaki Exp $	*/
+/*	$NetBSD: rune.c,v 1.36 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -63,19 +63,20 @@
 #if 0
 static char sccsid[] = "@(#)rune.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: rune.c,v 1.35 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: rune.c,v 1.36 2010/06/01 13:52:08 tnozaki Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
+#include <sys/types.h>
+#include <sys/ctype_bits.h>
+#include <sys/stat.h>
 #include <assert.h>
+#include <errno.h>
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
-#include <errno.h>
+#include <string.h>
 #include <wchar.h>
-#include <sys/types.h>
-#include <sys/stat.h>
 
 #include "citrus_module.h"
 #include "citrus_ctype.h"
@@ -351,9 +352,6 @@
 /*
  * read in old LC_CTYPE declaration file, convert into runelocale info
  */
-#include <limits.h>
-#include <ctype.h>
-
 _RuneLocale *
 _Read_CTypeAsRune(fp)
 	FILE *fp;

Index: src/lib/libc/locale/runeglue.c
diff -u src/lib/libc/locale/runeglue.c:1.17 src/lib/libc/locale/runeglue.c:1.18
--- src/lib/libc/locale/runeglue.c:1.17	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/runeglue.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: runeglue.c,v 1.17 2010/05/22 07:18:43 tnozaki Exp $	*/
+/*	$NetBSD: runeglue.c,v 1.18 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -35,13 +35,12 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: runeglue.c,v 1.17 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: runeglue.c,v 1.18 2010/06/01 13:52:08 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
+#include <sys/ctype_bits.h>
 #include <assert.h>
-#include <ctype.h>
-#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

Index: src/lib/libc/locale/runetable.c
diff -u src/lib/libc/locale/runetable.c:1.23 src/lib/libc/locale/runetable.c:1.24
--- src/lib/libc/locale/runetable.c:1.23	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/runetable.c	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: runetable.c,v 1.23 2010/05/22 07:18:43 tnozaki Exp $	*/
+/*	$NetBSD: runetable.c,v 1.24 2010/06/01 13:52:08 tnozaki Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -39,14 +39,12 @@
 #if 0
 static char sccsid[] = "@(#)table.c	8.1 (Berkeley) 6/27/93";
 #else
-__RCSID("$NetBSD: runetable.c,v 1.23 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: runetable.c,v 1.24 2010/06/01 13:52:08 tnozaki Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
+#include <sys/types.h>
 #include <assert.h>
-#include <ctype.h>
-#include <locale.h>
-#include <stdlib.h>
 #include <wchar.h>
 
 #include "citrus_module.h"

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.126 src/sys/sys/Makefile:1.127
--- src/sys/sys/Makefile:1.126	Mon Mar  1 21:10:13 2010
+++ src/sys/sys/Makefile	Tue Jun  1 13:52:08 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.126 2010/03/01 21:10:13 darran Exp $
+#	$NetBSD: Makefile,v 1.127 2010/06/01 13:52:08 tnozaki Exp $
 
 .include <bsd.sys.mk>
 
@@ -8,7 +8,7 @@
 	bitops.h bootblock.h bswap.h buf.h \
 	callback.h callout.h cdefs.h cdefs_aout.h \
 	cdefs_elf.h cdio.h chio.h clockctl.h condvar.h conf.h core.h \
-	cpuio.h \
+	cpuio.h ctype_bits.h ctype_inline.h \
 	device.h device_if.h \
 	dir.h dirent.h \
 	disk.h disklabel.h disklabel_acorn.h disklabel_gpt.h disklabel_rdb.h \

Added files:

Index: src/sys/sys/ctype_bits.h
diff -u /dev/null src/sys/sys/ctype_bits.h:1.1
--- /dev/null	Tue Jun  1 13:52:09 2010
+++ src/sys/sys/ctype_bits.h	Tue Jun  1 13:52:08 2010
@@ -0,0 +1,56 @@
+/* $NetBSD: ctype_bits.h,v 1.1 2010/06/01 13:52:08 tnozaki 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.
+ *
+ *	@(#)ctype.h	5.3 (Berkeley) 4/3/91
+ *	NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp
+ */
+
+#ifndef _SYS_CTYPE_BITS_H_
+#define _SYS_CTYPE_BITS_H_
+
+#define	_U	0x01
+#define	_L	0x02
+#define	_N	0x04
+#define	_S	0x08
+#define	_P	0x10
+#define	_C	0x20
+#define	_X	0x40
+#define	_B	0x80
+
+extern const unsigned char	*_ctype_;
+extern const short	*_tolower_tab_;
+extern const short	*_toupper_tab_;
+
+#endif /* !_SYS_CTYPE_BITS_H_ */
Index: src/sys/sys/ctype_inline.h
diff -u /dev/null src/sys/sys/ctype_inline.h:1.1
--- /dev/null	Tue Jun  1 13:52:09 2010
+++ src/sys/sys/ctype_inline.h	Tue Jun  1 13:52:08 2010
@@ -0,0 +1,82 @@
+/* $NetBSD: ctype_inline.h,v 1.1 2010/06/01 13:52:08 tnozaki 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.
+ *
+ *	@(#)ctype.h	5.3 (Berkeley) 4/3/91
+ *	NetBSD: ctype.h,v 1.30 2010/05/22 06:38:15 tnozaki Exp
+ */
+
+#ifndef _CTYPE_INLINE_H_
+#define _CTYPE_INLINE_H_
+
+#include <sys/cdefs.h>
+#include <sys/featuretest.h>
+
+#include <sys/ctype_bits.h>
+
+#define	isdigit(c)	((int)((_ctype_ + 1)[(c)] & _N))
+#define	islower(c)	((int)((_ctype_ + 1)[(c)] & _L))
+#define	isspace(c)	((int)((_ctype_ + 1)[(c)] & _S))
+#define	ispunct(c)	((int)((_ctype_ + 1)[(c)] & _P))
+#define	isupper(c)	((int)((_ctype_ + 1)[(c)] & _U))
+#define	isalpha(c)	((int)((_ctype_ + 1)[(c)] & (_U|_L)))
+#define	isxdigit(c)	((int)((_ctype_ + 1)[(c)] & (_N|_X)))
+#define	isalnum(c)	((int)((_ctype_ + 1)[(c)] & (_U|_L|_N)))
+#define	isprint(c)	((int)((_ctype_ + 1)[(c)] & (_P|_U|_L|_N|_B)))
+#define	isgraph(c)	((int)((_ctype_ + 1)[(c)] & (_P|_U|_L|_N)))
+#define	iscntrl(c)	((int)((_ctype_ + 1)[(c)] & _C))
+#define	tolower(c)	((int)((_tolower_tab_ + 1)[(c)]))
+#define	toupper(c)	((int)((_toupper_tab_ + 1)[(c)]))
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define	isascii(c)	((unsigned)(c) <= 0177)
+#define	toascii(c)	((c) & 0177)
+#define _tolower(c)	((c) - 'A' + 'a')
+#define _toupper(c)	((c) - 'a' + 'A')
+#endif
+
+#if defined(_ISO_C99_SOURCE) || (_POSIX_C_SOURCE - 0) > 200112L || \
+    (_XOPEN_SOURCE - 0) > 600 || defined(_NETBSD_SOURCE)
+
+/*
+ * isblank() is implemented as C function, due to insufficient bitwidth in
+ * _ctype_.  Note that _B does not mean isblank - it means isprint && !isgraph.
+ */
+#if 0
+#define isblank(c)	((int)((_ctype_ + 1)[(c)] & _B))
+#endif
+
+#endif
+
+#endif /* !_CTYPE_INLINE_H_ */

Reply via email to