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