ctype.c revision 5080145bebcdf447671b26bba8c9815a208dff4f
/*
* 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.
*
* 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
*/
/*
* Copyright 2010,2011 Nexenta Systems, Inc. All rights reserved.
* Copyright 2012 Garrett D'Amore <garrett@damore.org> All rights reserved.
*/
/*
* LC_CTYPE database generation routines for localedef.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
#include <ctype.h>
#include <wctype.h>
#include <unistd.h>
#include "localedef.h"
#include "parser.tab.h"
#include "runefile.h"
static avl_tree_t ctypes;
static wchar_t last_ctype;
typedef struct ctype_node {
} ctype_node_t;
static int
{
}
void
init_ctype(void)
{
}
static void
{
switch (last_kw) {
case T_ISUPPER:
break;
case T_ISLOWER:
break;
case T_ISALPHA:
break;
case T_ISDIGIT:
break;
case T_ISSPACE:
break;
case T_ISCNTRL:
break;
case T_ISGRAPH:
break;
case T_ISPRINT:
break;
case T_ISPUNCT:
break;
case T_ISXDIGIT:
break;
case T_ISBLANK:
break;
case T_ISPHONOGRAM:
break;
case T_ISIDEOGRAM:
break;
case T_ISENGLISH:
break;
case T_ISNUMBER:
break;
case T_ISSPECIAL:
break;
case T_ISALNUM:
/*
* We can't do anything with this. The character
* should already be specified as a digit or alpha.
*/
break;
default:
errf(_("not a valid character class"));
}
}
static ctype_node_t *
{
errf(_("out of memory"));
return (NULL);
}
}
return (ctn);
}
void
{
return;
}
}
void
add_ctype_range(int end)
{
if (end < last_ctype) {
errf(_("malformed character range (%u ... %u))"),
last_ctype, end);
return;
}
return;
}
}
last_ctype = end;
}
void
{
return;
}
switch (last_kw) {
case T_TOUPPER:
break;
case T_TOLOWER:
break;
default:
break;
}
}
void
dump_ctype(void)
{
FILE *f;
if ((f = open_category()) == NULL)
return;
int conflict = 0;
/*
* POSIX requires certain portable characters have
* certain types. Add them if they are missing.
*/
/*
* Technically these settings are only
* required for the C locale. However, it
* turns out that because of the historical
* version of isprint(), we need them for all
* locales as well. Note that these are not
* necessarily valid punctation characters in
* the current language, but ispunct() needs
* to return TRUE for them.
*/
if (strchr("!\"'#$%&()*+,-./:;<=>?@[\\]^_`{|}~",
(char)wc))
}
/*
* POSIX also requires that certain types imply
* others. Add any inferred types here.
*/
/*
* Finally, POSIX requires that certain combinations
* are invalid. We don't flag this as a fatal error,
* but we will warn about.
*/
conflict++;
conflict++;
conflict++;
conflict++;
conflict++;
if (conflict) {
warn("conflicting classes for character 0x%x (%x)",
}
/*
* Handle the lower 256 characters using the simple
* optimization. Note that if we have not defined the
*/
if ((unsigned)wc < _CACHED_RUNES) {
continue;
}
} else {
}
} else {
}
} else {
}
}
return;
}
close_category(f);
}