Module Name:    src
Committed By:   tnozaki
Date:           Sun Jun 13 04:14:57 UTC 2010

Modified Files:
        src/lib/libc/citrus: citrus_lc_ctype.c citrus_lc_messages.c
            citrus_lc_monetary.c citrus_lc_numeric.c citrus_lc_time.c
        src/lib/libc/locale: _wctrans.c _wctype.c bsdctype.c ctype_local.h
            global_locale.c iswctype_mb.c localeio_lc_ctype.c multibyte_amd1.c
            multibyte_c90.c rune.c runeglue.c runetable.c runetype_local.h
        src/usr.bin/mklocale: lex.l yacc.y
        src/usr.sbin/chrtbl: ctypeio.c
Added Files:
        src/lib/libc/locale: bsdctype_file.h bsdctype_local.h runetype_file.h
Removed Files:
        src/lib/libc/locale: bsdctype.h rune_local.h

Log Message:
1. split runetype_local.h -> runetype_file.h
   and remove renameing _Rune* -> _NBRune* namespace protection.

   FreeBSD traditionaly exposes struct _Rune* in runetype.h
   which included by ctype.h. it may cause conflicting type error
   in our cross build process, former we use renaming namespace
   to avoid this problem, now i reworked more resonable way.

2. merge rune_local.h to runetype_local.h, and remove it.
3. split bsdctype.h -> bsdctype_{file,local}.h


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/citrus/citrus_lc_ctype.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/citrus/citrus_lc_messages.c \
    src/lib/libc/citrus/citrus_lc_monetary.c \
    src/lib/libc/citrus/citrus_lc_numeric.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/citrus/citrus_lc_time.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/locale/_wctrans.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/locale/_wctype.c \
    src/lib/libc/locale/multibyte_amd1.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/locale/bsdctype.c
cvs rdiff -u -r1.5 -r0 src/lib/libc/locale/bsdctype.h
cvs rdiff -u -r0 -r1.1 src/lib/libc/locale/bsdctype_file.h \
    src/lib/libc/locale/bsdctype_local.h src/lib/libc/locale/runetype_file.h
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/locale/ctype_local.h
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/locale/global_locale.c \
    src/lib/libc/locale/runetype_local.h
cvs rdiff -u -r1.10 -r1.11 src/lib/libc/locale/iswctype_mb.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/locale/localeio_lc_ctype.c
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/locale/multibyte_c90.c
cvs rdiff -u -r1.37 -r1.38 src/lib/libc/locale/rune.c
cvs rdiff -u -r1.16 -r0 src/lib/libc/locale/rune_local.h
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/locale/runeglue.c
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/locale/runetable.c
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/mklocale/lex.l
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/mklocale/yacc.y
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/chrtbl/ctypeio.c

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

Modified files:

Index: src/lib/libc/citrus/citrus_lc_ctype.c
diff -u src/lib/libc/citrus/citrus_lc_ctype.c:1.7 src/lib/libc/citrus/citrus_lc_ctype.c:1.8
--- src/lib/libc/citrus/citrus_lc_ctype.c:1.7	Mon Jun  7 13:52:29 2010
+++ src/lib/libc/citrus/citrus_lc_ctype.c	Sun Jun 13 04:14:56 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_ctype.c,v 1.7 2010/06/07 13:52:29 tnozaki Exp $ */
+/* $NetBSD: citrus_lc_ctype.c,v 1.8 2010/06/13 04:14:56 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.7 2010/06/07 13:52:29 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_lc_ctype.c,v 1.8 2010/06/13 04:14:56 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "reentrant.h"
@@ -57,7 +57,7 @@
 #include "citrus_module.h"
 #include "citrus_ctype.h"
 
-#include "rune_local.h"
+#include "runetype_local.h"
 #include "multibyte.h"
 
 /*

Index: src/lib/libc/citrus/citrus_lc_messages.c
diff -u src/lib/libc/citrus/citrus_lc_messages.c:1.3 src/lib/libc/citrus/citrus_lc_messages.c:1.4
--- src/lib/libc/citrus/citrus_lc_messages.c:1.3	Sat May 22 08:13:18 2010
+++ src/lib/libc/citrus/citrus_lc_messages.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_messages.c,v 1.3 2010/05/22 08:13:18 tnozaki Exp $ */
+/* $NetBSD: citrus_lc_messages.c,v 1.4 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_messages.c,v 1.3 2010/05/22 08:13:18 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_lc_messages.c,v 1.4 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -61,7 +61,7 @@
 #include "citrus_db.h"
 #include "citrus_db_hash.h"
 #include "citrus_memstream.h"
-#include "rune_local.h"
+#include "runetype_local.h"
 
 /*
  * macro required by all template headers
Index: src/lib/libc/citrus/citrus_lc_monetary.c
diff -u src/lib/libc/citrus/citrus_lc_monetary.c:1.3 src/lib/libc/citrus/citrus_lc_monetary.c:1.4
--- src/lib/libc/citrus/citrus_lc_monetary.c:1.3	Sat May 22 08:13:18 2010
+++ src/lib/libc/citrus/citrus_lc_monetary.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_monetary.c,v 1.3 2010/05/22 08:13:18 tnozaki Exp $ */
+/* $NetBSD: citrus_lc_monetary.c,v 1.4 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_monetary.c,v 1.3 2010/05/22 08:13:18 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_lc_monetary.c,v 1.4 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -61,7 +61,7 @@
 #include "citrus_db.h"
 #include "citrus_db_hash.h"
 #include "citrus_memstream.h"
-#include "rune_local.h"
+#include "runetype_local.h"
 
 #include "fix_grouping.h"
 #include "citrus_fix_grouping.h"
Index: src/lib/libc/citrus/citrus_lc_numeric.c
diff -u src/lib/libc/citrus/citrus_lc_numeric.c:1.3 src/lib/libc/citrus/citrus_lc_numeric.c:1.4
--- src/lib/libc/citrus/citrus_lc_numeric.c:1.3	Sat May 22 08:13:18 2010
+++ src/lib/libc/citrus/citrus_lc_numeric.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_numeric.c,v 1.3 2010/05/22 08:13:18 tnozaki Exp $ */
+/* $NetBSD: citrus_lc_numeric.c,v 1.4 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_numeric.c,v 1.3 2010/05/22 08:13:18 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_lc_numeric.c,v 1.4 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -61,7 +61,7 @@
 #include "citrus_db.h"
 #include "citrus_db_hash.h"
 #include "citrus_memstream.h"
-#include "rune_local.h"
+#include "runetype_local.h"
 
 #include "fix_grouping.h"
 #include "citrus_fix_grouping.h"

Index: src/lib/libc/citrus/citrus_lc_time.c
diff -u src/lib/libc/citrus/citrus_lc_time.c:1.4 src/lib/libc/citrus/citrus_lc_time.c:1.5
--- src/lib/libc/citrus/citrus_lc_time.c:1.4	Sat May 22 08:13:18 2010
+++ src/lib/libc/citrus/citrus_lc_time.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: citrus_lc_time.c,v 1.4 2010/05/22 08:13:18 tnozaki Exp $ */
+/* $NetBSD: citrus_lc_time.c,v 1.5 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_lc_time.c,v 1.4 2010/05/22 08:13:18 tnozaki Exp $");
+__RCSID("$NetBSD: citrus_lc_time.c,v 1.5 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -61,7 +61,7 @@
 #include "citrus_db.h"
 #include "citrus_db_hash.h"
 #include "citrus_memstream.h"
-#include "rune_local.h"
+#include "runetype_local.h"
 
 /*
  * macro required by all template headers

Index: src/lib/libc/locale/_wctrans.c
diff -u src/lib/libc/locale/_wctrans.c:1.16 src/lib/libc/locale/_wctrans.c:1.17
--- src/lib/libc/locale/_wctrans.c:1.16	Wed Jun  2 15:47:25 2010
+++ src/lib/libc/locale/_wctrans.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: _wctrans.c,v 1.16 2010/06/02 15:47:25 tnozaki Exp $	*/
+/*	$NetBSD: _wctrans.c,v 1.17 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)2003 Citrus Project,
@@ -60,7 +60,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctrans.c,v 1.16 2010/06/02 15:47:25 tnozaki Exp $");
+__RCSID("$NetBSD: _wctrans.c,v 1.17 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -69,7 +69,7 @@
 #include <assert.h>
 #include <wctype.h>
 
-#include "rune_local.h"
+#include "runetype_local.h"
 #include "_wctrans_local.h"
 
 /*

Index: src/lib/libc/locale/_wctype.c
diff -u src/lib/libc/locale/_wctype.c:1.8 src/lib/libc/locale/_wctype.c:1.9
--- src/lib/libc/locale/_wctype.c:1.8	Wed Jun  2 15:47:25 2010
+++ src/lib/libc/locale/_wctype.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: _wctype.c,v 1.8 2010/06/02 15:47:25 tnozaki Exp $ */
+/* $NetBSD: _wctype.c,v 1.9 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -60,14 +60,14 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _wctype.c,v 1.8 2010/06/02 15:47:25 tnozaki Exp $");
+__RCSID("$NetBSD: _wctype.c,v 1.9 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
 #include <assert.h>
 #include <wctype.h>
 
-#include "rune_local.h"
+#include "runetype_local.h"
 #include "_wctrans_local.h"
 #include "_wctype_local.h"
 
Index: src/lib/libc/locale/multibyte_amd1.c
diff -u src/lib/libc/locale/multibyte_amd1.c:1.8 src/lib/libc/locale/multibyte_amd1.c:1.9
--- src/lib/libc/locale/multibyte_amd1.c:1.8	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/multibyte_amd1.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: multibyte_amd1.c,v 1.8 2010/05/22 07:18:43 tnozaki Exp $	*/
+/*	$NetBSD: multibyte_amd1.c,v 1.9 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)2002, 2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: multibyte_amd1.c,v 1.8 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: multibyte_amd1.c,v 1.9 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -43,7 +43,7 @@
 
 #include "citrus_module.h"
 #include "citrus_ctype.h"
-#include "rune_local.h"
+#include "runetype_local.h"
 #include "multibyte.h"
 
 #define _RUNE_LOCALE() \

Index: src/lib/libc/locale/bsdctype.c
diff -u src/lib/libc/locale/bsdctype.c:1.6 src/lib/libc/locale/bsdctype.c:1.7
--- src/lib/libc/locale/bsdctype.c:1.6	Wed Jun  2 16:04:52 2010
+++ src/lib/libc/locale/bsdctype.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: bsdctype.c,v 1.6 2010/06/02 16:04:52 tnozaki Exp $ */
+/* $NetBSD: bsdctype.c,v 1.7 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: bsdctype.c,v 1.6 2010/06/02 16:04:52 tnozaki Exp $");
+__RCSID("$NetBSD: bsdctype.c,v 1.7 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/stat.h>
@@ -41,7 +41,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "bsdctype.h"
+#include "bsdctype_local.h"
 
 const _BSDCTypeLocale _DefaultBSDCTypeLocale = {
     _C_ctype_,

Index: src/lib/libc/locale/ctype_local.h
diff -u src/lib/libc/locale/ctype_local.h:1.3 src/lib/libc/locale/ctype_local.h:1.4
--- src/lib/libc/locale/ctype_local.h:1.3	Sun May 30 11:36:12 2010
+++ src/lib/libc/locale/ctype_local.h	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ctype_local.h,v 1.3 2010/05/30 11:36:12 tnozaki Exp $ */
+/* $NetBSD: ctype_local.h,v 1.4 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c) 2010 Citrus Project,
@@ -33,9 +33,6 @@
 #define _CTYPE_NUM_CHARS	(1 << CHAR_BIT)
 #define _CTYPE_CACHE_SIZE	(1 << 8)
 
-#define _CTYPE_ID		"BSDCTYPE"
-#define _CTYPE_REV		2
-
 extern const unsigned char _C_ctype_[];
 extern const short _C_toupper_[];
 extern const short _C_tolower_[];

Index: src/lib/libc/locale/global_locale.c
diff -u src/lib/libc/locale/global_locale.c:1.9 src/lib/libc/locale/global_locale.c:1.10
--- src/lib/libc/locale/global_locale.c:1.9	Tue Jun  1 13:52:08 2010
+++ src/lib/libc/locale/global_locale.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: global_locale.c,v 1.9 2010/06/01 13:52:08 tnozaki Exp $ */
+/* $NetBSD: global_locale.c,v 1.10 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: global_locale.c,v 1.9 2010/06/01 13:52:08 tnozaki Exp $");
+__RCSID("$NetBSD: global_locale.c,v 1.10 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -40,9 +40,9 @@
 #include <locale.h>
 #include <stdlib.h>
 #ifdef WITH_RUNE
-#include "rune_local.h"
+#include "runetype_local.h"
 #else
-#include "bsdctype.h"
+#include "bsdctype_locale.h"
 #endif
 
 #include "setlocale_local.h"
Index: src/lib/libc/locale/runetype_local.h
diff -u src/lib/libc/locale/runetype_local.h:1.9 src/lib/libc/locale/runetype_local.h:1.10
--- src/lib/libc/locale/runetype_local.h:1.9	Sat Jun  5 16:37:13 2010
+++ src/lib/libc/locale/runetype_local.h	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: runetype_local.h,v 1.9 2010/06/05 16:37:13 tnozaki Exp $	*/
+/*	$NetBSD: runetype_local.h,v 1.10 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -31,6 +31,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
+ *	@(#)rune.h	8.1 (Berkeley) 6/27/93
  *	@(#)runetype.h	8.1 (Berkeley) 6/2/93
  */
 
@@ -39,95 +40,11 @@
 
 #include <sys/cdefs.h>
 #include <sys/types.h>
+#include <stdio.h>
 
-#include "ctype_local.h"
+#include "runetype_file.h"
 
-/* for cross host tools on older systems */
-#ifndef UINT32_C
-/* assumes sizeof(unsigned int)>=4 */
-#define UINT32_C(c) ((uint32_t)(c##U))
-#endif
-
-typedef uint32_t	__nbrune_t;
-typedef uint64_t	__runepad_t;
-
-#define _NB_RUNE_ISCACHED(c)	((c)>=0 && (c)<_CTYPE_CACHE_SIZE)
-
-#define _NB_DEFAULT_INVALID_RUNE ((__nbrune_t)-3)
-
-/*
- * The lower 8 bits of runetype[] contain the digit value of the rune.
- */
-typedef uint32_t _RuneType;
-#define	_RUNETYPE_A	UINT32_C(0x00000100)	/* Alpha */
-#define	_RUNETYPE_C	UINT32_C(0x00000200)	/* Control */
-#define	_RUNETYPE_D	UINT32_C(0x00000400)	/* Digit */
-#define	_RUNETYPE_G	UINT32_C(0x00000800)	/* Graph */
-#define	_RUNETYPE_L	UINT32_C(0x00001000)	/* Lower */
-#define	_RUNETYPE_P	UINT32_C(0x00002000)	/* Punct */
-#define	_RUNETYPE_S	UINT32_C(0x00004000)	/* Space */
-#define	_RUNETYPE_U	UINT32_C(0x00008000)	/* Upper */
-#define	_RUNETYPE_X	UINT32_C(0x00010000)	/* X digit */
-#define	_RUNETYPE_B	UINT32_C(0x00020000)	/* Blank */
-#define	_RUNETYPE_R	UINT32_C(0x00040000)	/* Print */
-#define	_RUNETYPE_I	UINT32_C(0x00080000)	/* Ideogram */
-#define	_RUNETYPE_T	UINT32_C(0x00100000)	/* Special */
-#define	_RUNETYPE_Q	UINT32_C(0x00200000)	/* Phonogram */
-#define	_RUNETYPE_SWM	UINT32_C(0xc0000000)/* Mask to get screen width data */
-#define	_RUNETYPE_SWS	30		/* Bits to shift to get width */
-#define	_RUNETYPE_SW0	UINT32_C(0x20000000)	/* 0 width character */
-#define	_RUNETYPE_SW1	UINT32_C(0x40000000)	/* 1 width character */
-#define	_RUNETYPE_SW2	UINT32_C(0x80000000)	/* 2 width character */
-#define	_RUNETYPE_SW3	UINT32_C(0xc0000000)	/* 3 width character */
-
-
-/*
- * rune file format.  network endian.
- */
-typedef struct {
-	int32_t		fre_min;	/* First rune of the range */
-	int32_t		fre_max;	/* Last rune (inclusive) of the range */
-	int32_t		fre_map;	/* What first maps to in maps */
-	uint32_t	fre_pad1;	/* backward compatibility */
-	__runepad_t	fre_pad2;	/* backward compatibility */
-} __packed _FileRuneEntry;
-
-
-typedef struct {
-	uint32_t	frr_nranges;	/* Number of ranges stored */
-	uint32_t	frr_pad1;	/* backward compatibility */
-	__runepad_t	frr_pad2;	/* backward compatibility */
-} __packed _FileRuneRange;
-
-
-typedef struct {
-	char		frl_magic[8];	/* Magic saying what version we are */
-	char		frl_encoding[32];/* ASCII name of this encoding */
-
-	__runepad_t	frl_pad1;	/* backward compatibility */
-	__runepad_t	frl_pad2;	/* backward compatibility */
-	int32_t		frl_invalid_rune;
-	uint32_t	frl_pad3;	/* backward compatibility */
-
-	_RuneType	frl_runetype[_CTYPE_CACHE_SIZE];
-	int32_t		frl_maplower[_CTYPE_CACHE_SIZE];
-	int32_t		frl_mapupper[_CTYPE_CACHE_SIZE];
-
-	/*
-	 * The following are to deal with Runes larger than _CTYPE_CACHE_SIZE - 1.
-	 * Their data is actually contiguous with this structure so as to make
-	 * it easier to read/write from/to disk.
-	 */
-	_FileRuneRange	frl_runetype_ext;
-	_FileRuneRange	frl_maplower_ext;
-	_FileRuneRange	frl_mapupper_ext;
-
-	__runepad_t	frl_pad4;	/* backward compatibility */
-	int32_t		frl_variable_len;/* how long that data is */
-	uint32_t	frl_pad5;	/* backward compatibility */
-
-	/* variable size data follows */
-} __packed _FileRuneLocale;
+#define _RUNE_ISCACHED(c)	((c)>=0 && (c)<_CTYPE_CACHE_SIZE)
 
 
 /*
@@ -138,13 +55,13 @@
 	__nbrune_t	re_max;		/* Last rune (inclusive) of the range */
 	__nbrune_t	re_map;		/* What first maps to in maps */
 	_RuneType	*re_rune_types;	/* Array of types in range */
-} _NBRuneEntry;
+} _RuneEntry;
 
 
 typedef struct {
 	uint32_t	rr_nranges;	/* Number of ranges stored */
-	_NBRuneEntry	*rr_rune_ranges;
-} _NBRuneRange;
+	_RuneEntry	*rr_rune_ranges;
+} _RuneRange;
 
 
 /*
@@ -153,7 +70,7 @@
 typedef struct _WCTransEntry {
 	const char	*te_name;
 	__nbrune_t	*te_cached;
-	_NBRuneRange	*te_extmap;
+	_RuneRange	*te_extmap;
 } _WCTransEntry;
 #define _WCTRANS_INDEX_LOWER	0
 #define _WCTRANS_INDEX_UPPER	1
@@ -184,7 +101,7 @@
  * ctype stuffs
  */
 
-typedef struct _NBRuneLocale {
+typedef struct _RuneLocale {
 	/*
 	 * copied from _FileRuneLocale
 	 */
@@ -194,9 +111,9 @@
 	_RuneType	rl_runetype[_CTYPE_CACHE_SIZE];
 	__nbrune_t	rl_maplower[_CTYPE_CACHE_SIZE];
 	__nbrune_t	rl_mapupper[_CTYPE_CACHE_SIZE];
-	_NBRuneRange	rl_runetype_ext;
-	_NBRuneRange	rl_maplower_ext;
-	_NBRuneRange	rl_mapupper_ext;
+	_RuneRange	rl_runetype_ext;
+	_RuneRange	rl_maplower_ext;
+	_RuneRange	rl_mapupper_ext;
 
 	void		*rl_variable;
 	size_t		rl_variable_len;
@@ -212,13 +129,22 @@
 	const unsigned char		*rl_ctype_tab;
 	const short			*rl_tolower_tab;
 	const short			*rl_toupper_tab;
-} _NBRuneLocale;
+} _RuneLocale;
 
+/*
+ * global variables
+ */
+extern const _RuneLocale _DefaultRuneLocale;
+extern const _RuneLocale *_CurrentRuneLocale;
 
-/* magic number for LC_CTYPE (rune)locale declaration */
-#define	_NB_RUNE_MAGIC_1 "RuneCT10"	/* Indicates version 0 of RuneLocale */
+__BEGIN_DECLS
+/* rune.c */
+extern _RuneLocale *_Read_RuneMagi(FILE *fp);
+extern _RuneLocale *_Read_CTypeAsRune(FILE *fp);
+extern void _NukeRune(_RuneLocale *);
 
-/* codeset tag */
-#define _NB_RUNE_CODESET "CODESET="
+/* runeglue.c */
+extern int __runetable_to_netbsd_ctype(_RuneLocale *);
+__END_DECLS
 
 #endif	/* !_RUNETYPE_LOCAL_H_ */

Index: src/lib/libc/locale/iswctype_mb.c
diff -u src/lib/libc/locale/iswctype_mb.c:1.10 src/lib/libc/locale/iswctype_mb.c:1.11
--- src/lib/libc/locale/iswctype_mb.c:1.10	Sat Jun 12 05:54:05 2010
+++ src/lib/libc/locale/iswctype_mb.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: iswctype_mb.c,v 1.10 2010/06/12 05:54:05 tnozaki Exp $ */
+/* $NetBSD: iswctype_mb.c,v 1.11 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: iswctype_mb.c,v 1.10 2010/06/12 05:54:05 tnozaki Exp $");
+__RCSID("$NetBSD: iswctype_mb.c,v 1.11 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -38,11 +38,12 @@
 #define __SETLOCALE_SOURCE__
 #include <locale.h>
 #include <string.h>
+#include <wchar.h>
 #include <wctype.h>
 
 #include "setlocale_local.h"
 
-#include "rune_local.h"
+#include "runetype_local.h"
 #include "_wctype_local.h"
 #include "_wctrans_local.h"
 

Index: src/lib/libc/locale/localeio_lc_ctype.c
diff -u src/lib/libc/locale/localeio_lc_ctype.c:1.4 src/lib/libc/locale/localeio_lc_ctype.c:1.5
--- src/lib/libc/locale/localeio_lc_ctype.c:1.4	Tue Jun  1 18:00:28 2010
+++ src/lib/libc/locale/localeio_lc_ctype.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: localeio_lc_ctype.c,v 1.4 2010/06/01 18:00:28 tnozaki Exp $ */
+/* $NetBSD: localeio_lc_ctype.c,v 1.5 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*-
  * Copyright (c)2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: localeio_lc_ctype.c,v 1.4 2010/06/01 18:00:28 tnozaki Exp $");
+__RCSID("$NetBSD: localeio_lc_ctype.c,v 1.5 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "reentrant.h"
@@ -45,10 +45,10 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "setlocale_local.h"
-
+#include "bsdctype_local.h"
 #include "aliasname_local.h"
-#include "bsdctype.h"
+
+#include "setlocale_local.h"
 
 /*
  * macro required by all template headers

Index: src/lib/libc/locale/multibyte_c90.c
diff -u src/lib/libc/locale/multibyte_c90.c:1.7 src/lib/libc/locale/multibyte_c90.c:1.8
--- src/lib/libc/locale/multibyte_c90.c:1.7	Sat May 22 07:18:43 2010
+++ src/lib/libc/locale/multibyte_c90.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: multibyte_c90.c,v 1.7 2010/05/22 07:18:43 tnozaki Exp $	*/
+/*	$NetBSD: multibyte_c90.c,v 1.8 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)2002, 2008 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: multibyte_c90.c,v 1.7 2010/05/22 07:18:43 tnozaki Exp $");
+__RCSID("$NetBSD: multibyte_c90.c,v 1.8 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -44,7 +44,7 @@
 
 #include "citrus_module.h"
 #include "citrus_ctype.h"
-#include "rune_local.h"
+#include "runetype_local.h"
 
 #define _RUNE_LOCALE() \
     ((_RuneLocale *)(*_current_locale())->part_impl[(size_t)LC_CTYPE])

Index: src/lib/libc/locale/rune.c
diff -u src/lib/libc/locale/rune.c:1.37 src/lib/libc/locale/rune.c:1.38
--- src/lib/libc/locale/rune.c:1.37	Sat Jun 12 05:54:05 2010
+++ src/lib/libc/locale/rune.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rune.c,v 1.37 2010/06/12 05:54:05 tnozaki Exp $	*/
+/*	$NetBSD: rune.c,v 1.38 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)rune.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: rune.c,v 1.37 2010/06/12 05:54:05 tnozaki Exp $");
+__RCSID("$NetBSD: rune.c,v 1.38 2010/06/13 04:14:57 tnozaki Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -81,8 +81,8 @@
 #include "citrus_module.h"
 #include "citrus_ctype.h"
 
-#include "bsdctype.h"
-#include "rune_local.h"
+#include "bsdctype_local.h"
+#include "runetype_local.h"
 
 static int readrange __P((_RuneLocale *, _RuneRange *, _FileRuneRange *, void *, FILE *));
 static void _freeentry __P((_RuneRange *));
@@ -251,7 +251,7 @@
 
 	if (fread(&frl, sizeof(frl), 1, fp) != 1)
 		return NULL;
-	if (memcmp(frl.frl_magic, _RUNE_MAGIC_1, sizeof(frl.frl_magic)))
+	if (memcmp(frl.frl_magic, _RUNECT10_MAGIC, sizeof(frl.frl_magic)))
 		return NULL;
 
 	hostdatalen = sizeof(*rl) + ntohl((u_int32_t)frl.frl_variable_len) +
@@ -416,7 +416,7 @@
 	rl = (_RuneLocale *)(void *)hostdata;
 	rl->rl_variable = NULL;
 
-	memcpy(rl->rl_magic, _RUNE_MAGIC_1, sizeof(rl->rl_magic));
+	memcpy(rl->rl_magic, _RUNECT10_MAGIC, sizeof(rl->rl_magic));
 	memcpy(rl->rl_encoding, "NONE", 4);
 
 	rl->rl_invalid_rune = _DefaultRuneLocale.rl_invalid_rune;	/*XXX*/

Index: src/lib/libc/locale/runeglue.c
diff -u src/lib/libc/locale/runeglue.c:1.19 src/lib/libc/locale/runeglue.c:1.20
--- src/lib/libc/locale/runeglue.c:1.19	Sat Jun 12 05:54:05 2010
+++ src/lib/libc/locale/runeglue.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: runeglue.c,v 1.19 2010/06/12 05:54:05 tnozaki Exp $	*/
+/*	$NetBSD: runeglue.c,v 1.20 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: runeglue.c,v 1.19 2010/06/12 05:54:05 tnozaki Exp $");
+__RCSID("$NetBSD: runeglue.c,v 1.20 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -49,7 +49,7 @@
 #include "citrus_module.h"
 #include "citrus_ctype.h"
 
-#include "rune_local.h"
+#include "runetype_local.h"
 
 #if EOF != -1
 #error "EOF != -1"

Index: src/lib/libc/locale/runetable.c
diff -u src/lib/libc/locale/runetable.c:1.25 src/lib/libc/locale/runetable.c:1.26
--- src/lib/libc/locale/runetable.c:1.25	Sat Jun 12 05:54:05 2010
+++ src/lib/libc/locale/runetable.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: runetable.c,v 1.25 2010/06/12 05:54:05 tnozaki Exp $	*/
+/*	$NetBSD: runetable.c,v 1.26 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)table.c	8.1 (Berkeley) 6/27/93";
 #else
-__RCSID("$NetBSD: runetable.c,v 1.25 2010/06/12 05:54:05 tnozaki Exp $");
+__RCSID("$NetBSD: runetable.c,v 1.26 2010/06/13 04:14:57 tnozaki Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -49,11 +49,10 @@
 
 #include "citrus_module.h"
 #include "citrus_ctype.h"
-
-#include "rune_local.h"
+#include "runetype_local.h"
 
 const _RuneLocale _DefaultRuneLocale = {
-    _RUNE_MAGIC_1,
+    _RUNECT10_MAGIC,
     "NONE",
     _DEFAULT_INVALID_RUNE,
 

Index: src/usr.bin/mklocale/lex.l
diff -u src/usr.bin/mklocale/lex.l:1.17 src/usr.bin/mklocale/lex.l:1.18
--- src/usr.bin/mklocale/lex.l:1.17	Sat Jun 12 02:51:34 2010
+++ src/usr.bin/mklocale/lex.l	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.l,v 1.17 2010/06/12 02:51:34 tnozaki Exp $	*/
+/*	$NetBSD: lex.l,v 1.18 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 %{
 /*-
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.l	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: lex.l,v 1.17 2010/06/12 02:51:34 tnozaki Exp $");
+__RCSID("$NetBSD: lex.l,v 1.18 2010/06/13 04:14:57 tnozaki Exp $");
 #endif
 #endif /* not lint */
 
@@ -52,7 +52,7 @@
 #include "citrus_namespace.h"
 #include "citrus_bcs.h"
 
-#include "runetype_local.h"
+#include "runetype_file.h"
 
 #include "ldef.h"
 #include "yacc.h"

Index: src/usr.bin/mklocale/yacc.y
diff -u src/usr.bin/mklocale/yacc.y:1.30 src/usr.bin/mklocale/yacc.y:1.31
--- src/usr.bin/mklocale/yacc.y:1.30	Sat Jun 12 02:51:34 2010
+++ src/usr.bin/mklocale/yacc.y	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: yacc.y,v 1.30 2010/06/12 02:51:34 tnozaki Exp $	*/
+/*	$NetBSD: yacc.y,v 1.31 2010/06/13 04:14:57 tnozaki Exp $	*/
 
 %{
 /*-
@@ -43,7 +43,7 @@
 static char sccsid[] = "@(#)yacc.y	8.1 (Berkeley) 6/6/93";
 static char rcsid[] = "$FreeBSD$";
 #else
-__RCSID("$NetBSD: yacc.y,v 1.30 2010/06/12 02:51:34 tnozaki Exp $");
+__RCSID("$NetBSD: yacc.y,v 1.31 2010/06/13 04:14:57 tnozaki Exp $");
 #endif
 #endif /* not lint */
 
@@ -60,7 +60,7 @@
 #include <unistd.h>
 #include <ctype.h>
 
-#include "runetype_local.h"
+#include "runetype_file.h"
 
 #include "ldef.h"
 
@@ -313,8 +313,8 @@
 	maplower.map[x] = x;
     }
 
-    new_locale.frl_invalid_rune = htonl((u_int32_t)_NB_DEFAULT_INVALID_RUNE);
-    memcpy(new_locale.frl_magic, _NB_RUNE_MAGIC_1, sizeof(new_locale.frl_magic));
+    new_locale.frl_invalid_rune = htonl((u_int32_t)_DEFAULT_INVALID_RUNE);
+    memcpy(new_locale.frl_magic, _RUNECT10_MAGIC, sizeof(new_locale.frl_magic));
 
     yyparse();
 

Index: src/usr.sbin/chrtbl/ctypeio.c
diff -u src/usr.sbin/chrtbl/ctypeio.c:1.4 src/usr.sbin/chrtbl/ctypeio.c:1.5
--- src/usr.sbin/chrtbl/ctypeio.c:1.4	Sat Jun 12 18:02:31 2010
+++ src/usr.sbin/chrtbl/ctypeio.c	Sun Jun 13 04:14:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: ctypeio.c,v 1.4 2010/06/12 18:02:31 tnozaki Exp $ */
+/* $NetBSD: ctypeio.c,v 1.5 2010/06/13 04:14:57 tnozaki Exp $ */
 
 /*
  * Copyright (c) 1997 Christos Zoulas.  All rights reserved.
@@ -26,7 +26,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ctypeio.c,v 1.4 2010/06/12 18:02:31 tnozaki Exp $");
+__RCSID("$NetBSD: ctypeio.c,v 1.5 2010/06/13 04:14:57 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -38,7 +38,7 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "ctype_local.h"
+#include "bsdctype_local.h"
 #include "ctypeio.h"
 
 int

Added files:

Index: src/lib/libc/locale/bsdctype_file.h
diff -u /dev/null src/lib/libc/locale/bsdctype_file.h:1.1
--- /dev/null	Sun Jun 13 04:14:58 2010
+++ src/lib/libc/locale/bsdctype_file.h	Sun Jun 13 04:14:57 2010
@@ -0,0 +1,46 @@
+/* $NetBSD: bsdctype_file.h,v 1.1 2010/06/13 04:14:57 tnozaki Exp $ */
+
+/*-
+ * Copyright (c)2008 Citrus Project,
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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 _BSDCTYPE_FILE_H_
+#define _BSDCTYPE_FILE_H_
+
+#include "ctype_local.h"
+
+typedef struct {
+	char			fbl_id[8];
+	uint32_t		fbl_rev;
+	uint32_t		fbl_num_chars;
+	uint8_t			fbl_ctype_tab  [_CTYPE_CACHE_SIZE];
+	int16_t			fbl_tolower_tab[_CTYPE_CACHE_SIZE];
+	int16_t			fbl_toupper_tab[_CTYPE_CACHE_SIZE];
+} __packed _FileBSDCTypeLocale;
+
+#define _CTYPE_ID		"BSDCTYPE"
+#define _CTYPE_REV		2
+
+#endif /*_BSDCTYPE_FILE_H_*/
Index: src/lib/libc/locale/bsdctype_local.h
diff -u /dev/null src/lib/libc/locale/bsdctype_local.h:1.1
--- /dev/null	Sun Jun 13 04:14:58 2010
+++ src/lib/libc/locale/bsdctype_local.h	Sun Jun 13 04:14:57 2010
@@ -0,0 +1,47 @@
+/* $NetBSD: bsdctype_local.h,v 1.1 2010/06/13 04:14:57 tnozaki Exp $ */
+
+/*-
+ * Copyright (c)2008 Citrus Project,
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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 _BSDCTYPE_LOCAL_H_
+#define _BSDCTYPE_LOCAL_H_
+
+#include "bsdctype_file.h"
+
+typedef struct {
+	const unsigned char	*bl_ctype_tab;
+	const short		*bl_tolower_tab;
+	const short		*bl_toupper_tab;
+} _BSDCTypeLocale;
+
+extern const _BSDCTypeLocale _DefaultBSDCTypeLocale;
+extern const _BSDCTypeLocale *_CurrentBSDCTypeLocale;
+
+__BEGIN_DECLS
+int _bsdctype_load(const char * __restrict, _BSDCTypeLocale ** __restrict);
+__END_DECLS
+
+#endif /*_BSDCTYPE_LOCAL_H_*/
Index: src/lib/libc/locale/runetype_file.h
diff -u /dev/null src/lib/libc/locale/runetype_file.h:1.1
--- /dev/null	Sun Jun 13 04:14:58 2010
+++ src/lib/libc/locale/runetype_file.h	Sun Jun 13 04:14:57 2010
@@ -0,0 +1,137 @@
+/* $NetBSD: runetype_file.h,v 1.1 2010/06/13 04:14:57 tnozaki Exp $ */
+
+/*-
+ * Copyright (c) 1993
+ *	The Regents of the University of California.  All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Paul Borman at Krystal Technologies.
+ *
+ * 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.
+ *
+ *	@(#)runetype.h	8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef	_RUNETYPE_FILE_H_
+#define	_RUNETYPE_FILE_H_
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include "ctype_local.h"
+
+/* for cross host tools on older systems */
+#ifndef UINT32_C
+/* assumes sizeof(unsigned int)>=4 */
+#define UINT32_C(c) ((uint32_t)(c##U))
+#endif
+
+typedef uint32_t	__nbrune_t;
+typedef uint64_t	__runepad_t;
+
+#define _DEFAULT_INVALID_RUNE ((__nbrune_t)-3)
+
+/*
+ * The lower 8 bits of runetype[] contain the digit value of the rune.
+ */
+typedef uint32_t _RuneType;
+#define	_RUNETYPE_A	UINT32_C(0x00000100)	/* Alpha */
+#define	_RUNETYPE_C	UINT32_C(0x00000200)	/* Control */
+#define	_RUNETYPE_D	UINT32_C(0x00000400)	/* Digit */
+#define	_RUNETYPE_G	UINT32_C(0x00000800)	/* Graph */
+#define	_RUNETYPE_L	UINT32_C(0x00001000)	/* Lower */
+#define	_RUNETYPE_P	UINT32_C(0x00002000)	/* Punct */
+#define	_RUNETYPE_S	UINT32_C(0x00004000)	/* Space */
+#define	_RUNETYPE_U	UINT32_C(0x00008000)	/* Upper */
+#define	_RUNETYPE_X	UINT32_C(0x00010000)	/* X digit */
+#define	_RUNETYPE_B	UINT32_C(0x00020000)	/* Blank */
+#define	_RUNETYPE_R	UINT32_C(0x00040000)	/* Print */
+#define	_RUNETYPE_I	UINT32_C(0x00080000)	/* Ideogram */
+#define	_RUNETYPE_T	UINT32_C(0x00100000)	/* Special */
+#define	_RUNETYPE_Q	UINT32_C(0x00200000)	/* Phonogram */
+#define	_RUNETYPE_SWM	UINT32_C(0xc0000000)/* Mask to get screen width data */
+#define	_RUNETYPE_SWS	30		/* Bits to shift to get width */
+#define	_RUNETYPE_SW0	UINT32_C(0x20000000)	/* 0 width character */
+#define	_RUNETYPE_SW1	UINT32_C(0x40000000)	/* 1 width character */
+#define	_RUNETYPE_SW2	UINT32_C(0x80000000)	/* 2 width character */
+#define	_RUNETYPE_SW3	UINT32_C(0xc0000000)	/* 3 width character */
+
+
+/*
+ * rune file format.  network endian.
+ */
+typedef struct {
+	int32_t		fre_min;	/* First rune of the range */
+	int32_t		fre_max;	/* Last rune (inclusive) of the range */
+	int32_t		fre_map;	/* What first maps to in maps */
+	uint32_t	fre_pad1;	/* backward compatibility */
+	__runepad_t	fre_pad2;	/* backward compatibility */
+} __packed _FileRuneEntry;
+
+
+typedef struct {
+	uint32_t	frr_nranges;	/* Number of ranges stored */
+	uint32_t	frr_pad1;	/* backward compatibility */
+	__runepad_t	frr_pad2;	/* backward compatibility */
+} __packed _FileRuneRange;
+
+
+typedef struct {
+	char		frl_magic[8];	/* Magic saying what version we are */
+	char		frl_encoding[32];/* ASCII name of this encoding */
+
+	__runepad_t	frl_pad1;	/* backward compatibility */
+	__runepad_t	frl_pad2;	/* backward compatibility */
+	int32_t		frl_invalid_rune;
+	uint32_t	frl_pad3;	/* backward compatibility */
+
+	_RuneType	frl_runetype[_CTYPE_CACHE_SIZE];
+	int32_t		frl_maplower[_CTYPE_CACHE_SIZE];
+	int32_t		frl_mapupper[_CTYPE_CACHE_SIZE];
+
+	/*
+	 * The following are to deal with Runes larger than _CTYPE_CACHE_SIZE - 1.
+	 * Their data is actually contiguous with this structure so as to make
+	 * it easier to read/write from/to disk.
+	 */
+	_FileRuneRange	frl_runetype_ext;
+	_FileRuneRange	frl_maplower_ext;
+	_FileRuneRange	frl_mapupper_ext;
+
+	__runepad_t	frl_pad4;	/* backward compatibility */
+	int32_t		frl_variable_len;/* how long that data is */
+	uint32_t	frl_pad5;	/* backward compatibility */
+
+	/* variable size data follows */
+} __packed _FileRuneLocale;
+
+
+/* magic number for LC_CTYPE (rune)locale declaration */
+#define	_RUNECT10_MAGIC	"RuneCT10"	/* Indicates version 0 of RuneLocale */
+
+/* codeset tag */
+#define _RUNE_CODESET "CODESET="
+
+#endif	/* !_RUNETYPE_FILE_H_ */

Reply via email to