summaryrefslogtreecommitdiff
path: root/source3/script/gen-8bit-gap.sh.in
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2003-08-28 17:16:27 +0000
committerAlexander Bokovoy <ab@samba.org>2003-08-28 17:16:27 +0000
commite83031c84de410cb19c96a4084b95f26619ce5a9 (patch)
tree50b33a3eec293a04bf9b635a097bc15928377e4f /source3/script/gen-8bit-gap.sh.in
parenta75430992f6257815219f2301d872c67bcb00d76 (diff)
downloadsamba-e83031c84de410cb19c96a4084b95f26619ce5a9.tar.gz
samba-e83031c84de410cb19c96a4084b95f26619ce5a9.tar.bz2
samba-e83031c84de410cb19c96a4084b95f26619ce5a9.zip
Refactor charset plugins a bit and add CP437 module.
Now all 8-bit charsets with gaps (not all symbols defined) could be produced through one macro -- SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP(CHARSETNAME) within source file with three charset tables. Full source code for such modules can be generated by source/script/gen-8bit-gap.sh script which was taken from GNU libc and changed slightly to follow our data types and structure. (This used to be commit 37042c7bc0f349370e93e4bed37d8fa371013247)
Diffstat (limited to 'source3/script/gen-8bit-gap.sh.in')
-rwxr-xr-xsource3/script/gen-8bit-gap.sh.in51
1 files changed, 51 insertions, 0 deletions
diff --git a/source3/script/gen-8bit-gap.sh.in b/source3/script/gen-8bit-gap.sh.in
new file mode 100755
index 0000000000..e66c654c22
--- /dev/null
+++ b/source3/script/gen-8bit-gap.sh.in
@@ -0,0 +1,51 @@
+#!/bin/sh
+if test $# -ne 2 ; then
+ echo "Usage: $0 <charmap file> <CHARSET NAME>"
+ exit 1
+fi
+
+CHARMAP=$1
+CHARSETNAME=$2
+
+echo "/* "
+echo " * Conversion table for $CHARSETNAME charset "
+echo " * "
+echo " * Conversion tables are generated using $CHARMAP table "
+echo " * and source/script/gen-8bit-gap.sh script "
+echo " * "
+echo " * This program is free software; you can redistribute it and/or modify "
+echo " * it under the terms of the GNU General Public License as published by "
+echo " * the Free Software Foundation; either version 2 of the License, or "
+echo " * (at your option) any later version. "
+echo " * "
+echo " * This program is distributed in the hope that it will be useful,"
+echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of "
+echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
+echo " * GNU General Public License for more details. "
+echo " * "
+echo " * You should have received a copy of the GNU General Public License "
+echo " * along with this program; if not, write to the Free Software "
+echo " * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. "
+echo " */"
+
+echo '#include "includes.h"'
+echo
+echo "static const uint16 to_ucs2[256] = {"
+sed -ne '/^[^[:space:]]*[[:space:]]*.x00/d' \
+ -e 's/^<U\(....\)>[[:space:]]*.x\(..\).*/ [0x\2] = 0x\1,/p' \
+ "$CHARMAP" | sort -u
+echo "};"
+echo
+echo "static const struct charset_gap_table from_idx[] = {"
+sed -ne 's/^<U\(....\).*/\1/p' \
+ "$CHARMAP" | sort -u | @AWK@ -f @srcdir@/script/gap.awk
+echo " { 0xffff, 0xffff, 0 }"
+echo "};"
+echo
+echo "static const unsigned char from_ucs2[] = {"
+sed -ne 's/^<U\(....\)>[[:space:]]*.x\(..\).*/\1 \2/p' \
+ "$CHARMAP" | sort -u | @AWK@ -f @srcdir@/script/gaptab.awk
+echo "};"
+echo
+echo "SMB_GENERATE_CHARSET_MODULE_8_BIT_GAP($CHARSETNAME)"
+echo