xref: /titanic_50/usr/src/lib/iconv_modules/euro/genincl (revision 880d797826457b77414b37d531cc3e1aa166ecbe)
1*880d7978SAlexander Pyhalov#!/bin/bash
2*880d7978SAlexander Pyhalov#
3*880d7978SAlexander Pyhalov# CDDL HEADER START
4*880d7978SAlexander Pyhalov#
5*880d7978SAlexander Pyhalov# The contents of this file are subject to the terms of the
6*880d7978SAlexander Pyhalov# Common Development and Distribution License (the "License").
7*880d7978SAlexander Pyhalov# You may not use this file except in compliance with the License.
8*880d7978SAlexander Pyhalov#
9*880d7978SAlexander Pyhalov# You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
10*880d7978SAlexander Pyhalov# or http://www.opensolaris.org/os/licensing.
11*880d7978SAlexander Pyhalov# See the License for the specific language governing permissions
12*880d7978SAlexander Pyhalov# and limitations under the License.
13*880d7978SAlexander Pyhalov#
14*880d7978SAlexander Pyhalov# When distributing Covered Code, include this CDDL HEADER in each
15*880d7978SAlexander Pyhalov# file and include the License file at src/OPENSOLARIS.LICENSE.
16*880d7978SAlexander Pyhalov# If applicable, add the following below this CDDL HEADER, with the
17*880d7978SAlexander Pyhalov# fields enclosed by brackets "[]" replaced with your own identifying
18*880d7978SAlexander Pyhalov# information: Portions Copyright [yyyy] [name of copyright owner]
19*880d7978SAlexander Pyhalov#
20*880d7978SAlexander Pyhalov# CDDL HEADER END
21*880d7978SAlexander Pyhalov#
22*880d7978SAlexander Pyhalov#
23*880d7978SAlexander Pyhalov# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
24*880d7978SAlexander Pyhalov# Use is subject to license terms.
25*880d7978SAlexander Pyhalov#
26*880d7978SAlexander Pyhalov
27*880d7978SAlexander Pyhalov# Create the table of includes for euro.h
28*880d7978SAlexander Pyhalov# from the list recoding tables in tbls/.
29*880d7978SAlexander Pyhalov# Sanitize '-'.
30*880d7978SAlexander Pyhalov
31*880d7978SAlexander Pyhalovprint_includes() {
32*880d7978SAlexander Pyhalov
33*880d7978SAlexander Pyhalov	[[ -z "$1" ]] && { echo "ERROR: missing files: tbls/*tbl"; exit 1; }
34*880d7978SAlexander Pyhalov
35*880d7978SAlexander Pyhalov	perlre='s:tbls/:T_: ; s:\.tbl:: ; s:-::g'
36*880d7978SAlexander Pyhalov
37*880d7978SAlexander Pyhalov	# first entry
38*880d7978SAlexander Pyhalov	T_=`echo $1 | perl -pe "$perlre"`;
39*880d7978SAlexander Pyhalov	printf "#if defined($T_)\n"
40*880d7978SAlexander Pyhalov	printf "#include \"$1\"\n"
41*880d7978SAlexander Pyhalov	shift
42*880d7978SAlexander Pyhalov
43*880d7978SAlexander Pyhalov	# elifs
44*880d7978SAlexander Pyhalov	while [[ -n "$1" ]]; do
45*880d7978SAlexander Pyhalov		T_=`echo $1 | perl -pe "$perlre"`;
46*880d7978SAlexander Pyhalov		printf "\n#elif defined ($T_)\n"
47*880d7978SAlexander Pyhalov		printf "#include \"$1\"\n"
48*880d7978SAlexander Pyhalov		shift
49*880d7978SAlexander Pyhalov	done
50*880d7978SAlexander Pyhalov
51*880d7978SAlexander Pyhalov	# else
52*880d7978SAlexander Pyhalov	printf "\n#else\n"
53*880d7978SAlexander Pyhalov	printf "#error	\"Error - nothing defined.\"\n"
54*880d7978SAlexander Pyhalov	printf "#endif\n"
55*880d7978SAlexander Pyhalov}
56*880d7978SAlexander Pyhalov
57*880d7978SAlexander Pyhalovprint_includes $(ls tbls/*tbl)
58