xref: /titanic_41/usr/src/cmd/localedef/data/ctype.sh (revision 98d13071122e3aa951a0becc4361e9a696c11bb1)
1#! /usr/bin/sh
2#
3#
4# This file and its contents are supplied under the terms of the
5# Common Development and Distribution License ("CDDL"), version 1.0.
6# You may only use this file in accordance with the terms of version
7# 1.0 of the CDDL.
8#
9# A full copy of the text of the CDDL should have accompanied this
10# source.  A copy of the CDDL is also available via the Internet at
11# http://www.illumos.org/license/CDDL.
12#
13
14#
15# Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
16#
17
18# Combine LC_CTYPE classes from all .UTF-8.src files to be compiled by localedef
19# into one LC_CTYPE/LCL_DATA used by all locales, so we have the same case
20# mapping tables, character classes, etc. for all of them. This is not general
21# purpose parser but is good enough for the stock files supplied with CLDR.
22
23printf "\nLC_CTYPE\n"
24
25for i in upper lower alpha space cntrl graph print punct digit xdigit blank \
26	toupper tolower; do
27	# sed can't match both range patterns on the same line so we just make
28	# it look like valid multiline class by duplicating the definition
29	sed "/^$i.*>$/ {
30		s,$,;/,
31		h
32		s,^$i\(.*>\);/$,\1,
33		H
34		x
35	}" $@ |\
36	sed -n "/^$i/,/\([>)]\)$/ {
37		s,^$i,,
38		"'s,\([>)]\)$,\1;/,'"
39		/^$/d
40		p
41	}" |\
42	sort -u |\
43	sed "1 s,^,$i,;$ s,\([>)]\);/,\1,"
44done
45
46printf "\nEND LC_CTYPE\n"
47