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