- support for the additional code area of zh_CN.GB18030 locale,
- make sure that __nbrune_t is unsigned 32bit clean and - fix wrong copyright notice in the last commit. this patch is contributed by Takehiko NOZAKI <sigsegv at s25 dot xrea dot com>.
This commit is contained in:
parent
978748a964
commit
6ca2252907
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ___runetype_mb.c,v 1.7 2003/03/04 15:09:54 yamt Exp $ */
|
||||
/* $NetBSD: ___runetype_mb.c,v 1.8 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: ___runetype_mb.c,v 1.7 2003/03/04 15:09:54 yamt Exp $");
|
||||
__RCSID("$NetBSD: ___runetype_mb.c,v 1.8 2003/04/06 18:33:23 tshiozak Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <wctype.h>
|
||||
@ -53,15 +53,16 @@ ___runetype_mb(c)
|
||||
_RuneRange *rr = &_CurrentRuneLocale->rl_runetype_ext;
|
||||
_RuneEntry *re = rr->rr_rune_ranges;
|
||||
|
||||
if (c < 0 || c == WEOF)
|
||||
if (c == WEOF)
|
||||
return(0U);
|
||||
|
||||
for (x = 0; x < rr->rr_nranges; ++x, ++re) {
|
||||
if (c < re->re_min)
|
||||
/* XXX assumes wchar_t = int */
|
||||
if ((__nbrune_t)c < re->re_min)
|
||||
return(0U);
|
||||
if (c <= re->re_max) {
|
||||
if ((__nbrune_t)c <= re->re_max) {
|
||||
if (re->re_rune_types)
|
||||
return(re->re_rune_types[c - re->re_min]);
|
||||
return(re->re_rune_types[(__nbrune_t)c - re->re_min]);
|
||||
else
|
||||
return(re->re_map);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _wctrans.c,v 1.3 2003/03/11 17:23:07 tshiozak Exp $ */
|
||||
/* $NetBSD: _wctrans.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2003 Citrus Project,
|
||||
@ -64,7 +64,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: _wctrans.c,v 1.3 2003/03/11 17:23:07 tshiozak Exp $");
|
||||
__RCSID("$NetBSD: _wctrans.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
@ -102,14 +102,15 @@ _towctrans_ext(wint_t c, struct _WCTransEntry *te)
|
||||
_RuneRange *rr = te->te_extmap;
|
||||
_RuneEntry *re = rr->rr_rune_ranges;
|
||||
|
||||
if (c < 0 || c == WEOF)
|
||||
if (c == WEOF)
|
||||
return(c);
|
||||
|
||||
for (x = 0; x < rr->rr_nranges; ++x, ++re) {
|
||||
if (c < re->re_min)
|
||||
/* XXX assumes wchar_t = int */
|
||||
if ((__nbrune_t)c < re->re_min)
|
||||
return(c);
|
||||
if (c <= re->re_max)
|
||||
return(re->re_map + c - re->re_min);
|
||||
if ((__nbrune_t)c <= re->re_max)
|
||||
return(re->re_map + (__nbrune_t)c - re->re_min);
|
||||
}
|
||||
return(c);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: _wctrans_local.h,v 1.1 2003/03/02 22:18:14 tshiozak Exp $ */
|
||||
/* $NetBSD: _wctrans_local.h,v 1.2 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)2003 Citrus Project,
|
||||
@ -35,7 +35,8 @@ void _wctrans_init(_RuneLocale *);
|
||||
static __inline wint_t
|
||||
_towctrans(wint_t c, _WCTransEntry *te)
|
||||
{
|
||||
return (_RUNE_ISCACHED(c) ? te->te_cached[c]:_towctrans_ext(c, te));
|
||||
return (_RUNE_ISCACHED(c) ?
|
||||
te->te_cached[(__nbrune_t)c]:_towctrans_ext(c, te));
|
||||
}
|
||||
|
||||
static __inline struct _WCTransEntry *
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: iswctype.c,v 1.12 2003/03/21 13:48:53 scw Exp $ */
|
||||
/* $NetBSD: iswctype.c,v 1.13 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989 The Regents of the University of California.
|
||||
@ -40,7 +40,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: iswctype.c,v 1.12 2003/03/21 13:48:53 scw Exp $");
|
||||
__RCSID("$NetBSD: iswctype.c,v 1.13 2003/04/06 18:33:23 tshiozak Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
@ -70,7 +70,8 @@ __runetype_w(c)
|
||||
{
|
||||
_RuneLocale *rl = _CurrentRuneLocale;
|
||||
|
||||
return (_RUNE_ISCACHED(c) ? rl->rl_runetype[c] : ___runetype_mb(c));
|
||||
return (_RUNE_ISCACHED(c) ?
|
||||
rl->rl_runetype[c] : ___runetype_mb(c));
|
||||
}
|
||||
|
||||
static __inline int
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: runetype.h,v 1.16 2003/03/11 17:23:07 tshiozak Exp $ */
|
||||
/* $NetBSD: runetype.h,v 1.17 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@ -50,7 +50,7 @@
|
||||
#define UINT32_C(c) ((uint32_t)(c##U))
|
||||
#endif
|
||||
|
||||
typedef int32_t __nbrune_t;
|
||||
typedef uint32_t __nbrune_t;
|
||||
typedef uint64_t __runepad_t;
|
||||
|
||||
#define _NB_CACHED_RUNES (1 << 8) /* Must be a power of 2 */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $ */
|
||||
/* $NetBSD: wcscmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -41,12 +41,13 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
|
||||
__RCSID("$NetBSD: wcscmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#include "locale/runetype.h"
|
||||
|
||||
/*
|
||||
* Compare strings.
|
||||
@ -63,5 +64,5 @@ wcscmp(s1, s2)
|
||||
if (*s1++ == 0)
|
||||
return (0);
|
||||
/* XXX assumes wchar_t = int */
|
||||
return (*(const unsigned int *)s1 - *(const unsigned int *)--s2);
|
||||
return (*(const __nbrune_t *)s1 - *(const __nbrune_t *)--s2);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $ */
|
||||
/* $NetBSD: wcsncmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -38,12 +38,13 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
|
||||
__RCSID("$NetBSD: wcsncmp.c,v 1.4 2003/04/06 18:33:23 tshiozak Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#include "locale/runetype.h"
|
||||
|
||||
int
|
||||
wcsncmp(s1, s2, n)
|
||||
@ -59,8 +60,8 @@ wcsncmp(s1, s2, n)
|
||||
do {
|
||||
if (*s1 != *s2++) {
|
||||
/* XXX assumes wchar_t = int */
|
||||
return (*(const unsigned int *)s1 -
|
||||
*(const unsigned int *)--s2);
|
||||
return (*(const __nbrune_t *)s1 -
|
||||
*(const __nbrune_t *)--s2);
|
||||
}
|
||||
if (*s1++ == 0)
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wmemcmp.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */
|
||||
/* $NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@ -30,11 +30,12 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wmemcmp.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
|
||||
__RCSID("$NetBSD: wmemcmp.c,v 1.3 2003/04/06 18:33:23 tshiozak Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
#include "locale/runetype.h"
|
||||
|
||||
int
|
||||
wmemcmp(s1, s2, n)
|
||||
@ -50,7 +51,8 @@ wmemcmp(s1, s2, n)
|
||||
for (i = 0; i < n; i++) {
|
||||
if (*s1 != *s2) {
|
||||
/* wchar might be unsigned */
|
||||
return *s1 > *s2 ? 1 : -1;
|
||||
return *(const __nbrune_t *)s1 >
|
||||
*(const __nbrune_t *)s2 ? 1 : -1;
|
||||
}
|
||||
s1++;
|
||||
s2++;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lex.l,v 1.8 2003/03/10 21:18:50 tshiozak Exp $ */
|
||||
/* $NetBSD: lex.l,v 1.9 2003/04/06 18:33:24 tshiozak Exp $ */
|
||||
|
||||
%{
|
||||
/*-
|
||||
@ -46,7 +46,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)lex.l 8.1 (Berkeley) 6/6/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: lex.l,v 1.8 2003/03/10 21:18:50 tshiozak Exp $");
|
||||
__RCSID("$NetBSD: lex.l,v 1.9 2003/04/06 18:33:24 tshiozak Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@ -84,11 +84,11 @@ W [\t\n\r ]
|
||||
'\\v' { yylval.rune = '\v';
|
||||
return(RUNE); }
|
||||
|
||||
0x{XDIGIT}+ { yylval.rune = strtol(yytext, 0, 16);
|
||||
0x{XDIGIT}+ { yylval.rune = strtoul(yytext, 0, 16);
|
||||
return(RUNE); }
|
||||
0{ODIGIT}+ { yylval.rune = strtol(yytext, 0, 8);
|
||||
0{ODIGIT}+ { yylval.rune = strtoul(yytext, 0, 8);
|
||||
return(RUNE); }
|
||||
{DIGIT}+ { yylval.rune = strtol(yytext, 0, 10);
|
||||
{DIGIT}+ { yylval.rune = strtoul(yytext, 0, 10);
|
||||
return(RUNE); }
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user