Skip to content

Commit

Permalink
2964 need POSIX 2008 locale object support
Browse files Browse the repository at this point in the history
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Approved by: Dan McDonald <danmcd@omniti.com>
  • Loading branch information
gdamore committed Jul 12, 2014
1 parent 961519c commit 2d08521
Show file tree
Hide file tree
Showing 161 changed files with 6,408 additions and 3,248 deletions.
3 changes: 2 additions & 1 deletion usr/src/cmd/localedef/messages.c
Expand Up @@ -10,6 +10,7 @@
*/

/*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
*/

Expand All @@ -28,7 +29,7 @@
#include "parser.tab.h"
#include "lmessages.h"

static struct lc_messages_T msgs;
static struct lc_messages msgs;

void
init_messages(void)
Expand Down
3 changes: 2 additions & 1 deletion usr/src/cmd/localedef/monetary.c
Expand Up @@ -10,6 +10,7 @@
*/

/*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
*/

Expand All @@ -27,7 +28,7 @@
#include "parser.tab.h"
#include "lmonetary.h"

static struct lc_monetary_T mon;
static struct lc_monetary mon;

void
init_monetary(void)
Expand Down
3 changes: 2 additions & 1 deletion usr/src/cmd/localedef/numeric.c
Expand Up @@ -10,6 +10,7 @@
*/

/*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
*/

Expand All @@ -27,7 +28,7 @@
#include "parser.tab.h"
#include "lnumeric.h"

static struct lc_numeric_T numeric;
static struct lc_numeric numeric;

void
init_numeric(void)
Expand Down
3 changes: 2 additions & 1 deletion usr/src/cmd/localedef/time.c
Expand Up @@ -10,6 +10,7 @@
*/

/*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
*/

Expand All @@ -27,7 +28,7 @@
#include "parser.tab.h"
#include "timelocal.h"

struct lc_time_T tm;
struct lc_time tm;

void
init_time(void)
Expand Down
14 changes: 12 additions & 2 deletions usr/src/cmd/mdb/common/kmdb/mapfile_skel
Expand Up @@ -21,6 +21,7 @@
/* BEGIN PROLOGUE */
/*
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/

/*
Expand All @@ -44,10 +45,19 @@ SYMBOL_SCOPE {
* Secret additions to the module API
*/

/* Implementation detail of the ctype macros */
__ctype; /* variable */
/* There should be only one - ours */
errno; /* variable */
isprint;
isalnum;
isalpha;
isgraph;
iscntrl;
isdigit;
isxdigit;
isupper;
islower;
ispunct;
isspace;

mdb_tgt_aread;
mdb_dis_create;
Expand Down
135 changes: 91 additions & 44 deletions usr/src/cmd/mdb/common/libstand/ctype.c
@@ -1,50 +1,97 @@
/*
* CDDL HEADER START
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/

/*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/

/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* ASCII versions of ctype character classification functions. This avoids
* pulling in the entire locale framework that is in libc.
*/

#pragma ident "%Z%%M% %I% %E% SMI"

#include <ctype.h>

unsigned char __ctype[129] =
{
0, /* EOF */
_C, _C, _C, _C, _C, _C, _C, _C,
_C, _S|_C, _S|_C, _S|_C, _S|_C, _S|_C, _C, _C,
_C, _C, _C, _C, _C, _C, _C, _C,
_C, _C, _C, _C, _C, _C, _C, _C,
_S|_B, _P, _P, _P, _P, _P, _P, _P,
_P, _P, _P, _P, _P, _P, _P, _P,
_N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X, _N|_X,
_N|_X, _N|_X, _P, _P, _P, _P, _P, _P,
_P, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U|_X, _U,
_U, _U, _U, _U, _U, _U, _U, _U,
_U, _U, _U, _U, _U, _U, _U, _U,
_U, _U, _U, _P, _P, _P, _P, _P,
_P, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L|_X, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
_L, _L, _L, _L, _L, _L, _L, _L,
_L, _L, _L, _P, _P, _P, _P, _C,
};
int
isdigit(int c)
{
return ((c >= '0' && c <= '9') ? 1 : 0);
}

int
isupper(int c)
{
return ((c >= 'A' && c <= 'Z') ? 1 : 0);
}


int
islower(int c)
{
return ((c >= 'a' && c <= 'z') ? 1 : 0);
}

int
isspace(int c)
{
return (((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n') ||
(c == '\v') || (c == '\f')) ? 1 : 0);
}

int
isxdigit(int c)
{
return ((isdigit(c) || (c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f')) ? 1 : 0);
}

int
isalpha(int c)
{
return ((isupper(c) || islower(c)) ? 1 : 0);
}


int
isalnum(int c)
{
return ((isalpha(c) || isdigit(c)) ? 1 : 0);
}

int
ispunct(int c)
{
return (((c >= '!') && (c <= '/')) ||
((c >= ':') && (c <= '@')) ||
((c >= '[') && (c <= '`')) ||
((c >= '{') && (c <= '~')));
}

int
iscntrl(int c)
{
return ((c < 0x20) || (c == 0x7f));
}

int
isprint(int c)
{
/*
* Almost the inverse of iscntrl, but be careful that c > 0x7f
* returns false for everything.
*/
return ((c >= ' ') && (c <= '~'));
}

int
isgraph(int c)
{
/* isgraph is like is print, but excludes <space> */
return ((c >= '!') && (c <= '~'));
}
50 changes: 50 additions & 0 deletions usr/src/cmd/sgs/rtld/common/external.c
Expand Up @@ -21,6 +21,7 @@

/*
* Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
*/

/*
Expand Down Expand Up @@ -668,3 +669,52 @@ write(int fd, const void *buf, size_t size)
extern ssize_t __write(int, const void *, size_t);
return (__write(fd, buf, size));
}

/*
* ASCII versions of ctype character classification functions. This avoids
* pulling in the entire locale framework that is in libc.
*/

int
isdigit(int c)
{
return ((c >= '0' && c <= '9') ? 1 : 0);
}

int
isupper(int c)
{
return ((c >= 'A' && c <= 'Z') ? 1 : 0);
}

int
islower(int c)
{
return ((c >= 'a' && c <= 'z') ? 1 : 0);
}

int
isspace(int c)
{
return (((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n') ||
(c == '\v') || (c == '\f')) ? 1 : 0);
}

int
isxdigit(int c)
{
return ((isdigit(c) || (c >= 'A' && c <= 'F') ||
(c >= 'a' && c <= 'f')) ? 1 : 0);
}

int
isalpha(int c)
{
return ((isupper(c) || islower(c)) ? 1 : 0);
}

int
isalnum(int c)
{
return ((isalpha(c) || isdigit(c)) ? 1 : 0);
}
5 changes: 3 additions & 2 deletions usr/src/head/Makefile
Expand Up @@ -22,6 +22,8 @@
# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# Copyright 2013 Garrett D'Amore <garrett@damore.org>
#
# head/Makefile
#
# include global definitions
Expand Down Expand Up @@ -203,12 +205,12 @@ HDRS= $($(MACH)_HDRS) $(ATTRDB_HDRS) \
wctype.h \
widec.h \
wordexp.h \
xlocale.h \
xti.h \
xti_inet.h \
zone.h

ISOHDRS = \
ctype_c99.h \
ctype_iso.h \
limits_iso.h \
locale_iso.h \
Expand All @@ -225,7 +227,6 @@ ISOHDRS = \
time_iso.h \
wchar_c99.h \
wchar_iso.h \
wctype_c99.h \
wctype_iso.h

ARPAHDRS = \
Expand Down

0 comments on commit 2d08521

Please sign in to comment.