1#!/bin/sh
2if test $# -ne 2 ; then
3	echo "Usage: $0 <charmap file> <CHARSET NAME>"
4	exit 1
5fi
6
7CHARMAP=$1
8CHARSETNAME=$2
9
10echo "/* "
11echo " * Conversion table for $CHARSETNAME charset "
12echo " * "
13echo " * Conversion tables are generated using $CHARMAP table "
14echo " * and source/script/gen-8bit-gap.sh script "
15echo " * "
16echo " * This program is free software; you can redistribute it and/or modify "
17echo " * it under the terms of the GNU General Public License as published by "
18echo " * the Free Software Foundation; either version 2 of the License, or "
19echo " * (at your option) any later version. "
20echo " *  "
21echo " * This program is distributed in the hope that it will be useful,"
22echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of "
23echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
24echo " * GNU General Public License for more details. "
25echo " *  "
26echo " * You should have received a copy of the GNU General Public License "
27echo " * along with this program; if not, write to the Free Software "
28echo " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. "
29echo " */"
30
31echo '#include "includes.h"'
32echo
33echo "static const uint16 to_ucs2[256] = {"
34cat "$CHARMAP" | @AWK@ -f @srcdir@/script/gen-8bit-gap.awk
35echo "};"
36echo
37echo "static const struct charset_gap_table from_idx[] = {"
38sed -ne 's/^<U\(....\).*/\1/p' \
39    "$CHARMAP" | sort -u | @AWK@ -f @srcdir@/script/gap.awk
40echo "  { 0xffff, 0xffff, 0 }"
41echo "};"
42echo
43echo "static const unsigned char from_ucs2[] = {"
44sed -ne 's/^<U\(....\)>[[:space:]]*.x\(..\).*/\1 \2/p' \
45    "$CHARMAP" | sort -u | @AWK@ -f @srcdir@/script/gaptab.awk
46echo "};"
47echo 
48echo "SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP($CHARSETNAME)"
49echo
50