]> git.saurik.com Git - wxWidgets.git/blob - misc/unictabl/mk_encodings.sh
quite ugly workaround, but even the engineers at WWDC couldn't give me a better alter...
[wxWidgets.git] / misc / unictabl / mk_encodings.sh
1 #!/bin/sh
2 # CVS-ID: $Id$
3
4
5 echo " * compiling C source generator..."
6
7 cc mk_ctable.c -o mk_ctable
8
9 echo " * writing copyright info..."
10
11 echo "
12
13 /*
14 * This file is #included by encconv.cpp
15 *
16 * CVS-ID: \$Id\$
17 *
18 * *** *** CAUTION! *** ***
19 * Do not modify this file by hand! It is generated by shell
20 * script \$(WXWIN)/misc/unictabl/regenerate
21 *
22 * Parts of this file are based on tables published by Unicode, Inc.
23 * Original tables are freely available at
24 * ftp://ftp.unicode.org/Public/MAPPINGS
25 *
26 * Original copyright info as present in mapping tables follows:
27 *
28 *
29 * Copyright (c) 1991-1999 Unicode, Inc. All Rights reserved.
30 *
31 * This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
32 * No claims are made as to fitness for any particular purpose. No
33 * warranties of any kind are expressed or implied. The recipient
34 * agrees to determine applicability of information provided. If this
35 * file has been provided on optical media by Unicode, Inc., the sole
36 * remedy for any claim will be exchange of defective media within 90
37 * days of receipt.
38 *
39 * Unicode, Inc. hereby grants the right to freely use the information
40 * supplied in this file in the creation of products supporting the
41 * Unicode Standard, and to make copies of this file in any form for
42 * internal or external distribution as long as this notice remains
43 * attached.
44 */
45
46 " > unictabl.inc
47
48
49 echo " * creating C tables..."
50
51 all_encodings=""
52
53 for i in mappings/*.TXT ; do
54
55 enc=`echo $i | cut -c10- | tr - _ | sed 's/\.TXT//g' |\
56 sed 's/8859_\(.*\)/ISO8859_\1/g
57 s/KOI8_R/KOI8/g'`
58 cat $i | sed -n '/^0x...0x..../p' | cut -f1,2 | \
59 ./mk_ctable $i $enc >> unictabl.inc
60 all_encodings="$all_encodings $enc"
61
62 done
63
64 rm -f mk_ctable
65
66
67 echo " * adding fallback..."
68
69 echo "
70
71
72
73
74 /*
75 *
76 * Unicode to 7bit ASCII fallback
77 * (for use with wxRECODE_SUBSTITUTE recoding mode)
78 *
79 */
80
81 static const struct {
82 wxUint16 c /*code*/;
83 wxUint8 s /*inaccurate substitution*/;
84 } encoding_unicode_fallback[] = {
85 " >> unictabl.inc
86
87 cat Fallbacks | while read i ; do
88 code=`echo "$i" | cut -f1`
89 subs=`echo "$i" | cut -f2 | cut -c1-2,5-6`
90 echo " {$code, $subs}," >> unictabl.inc
91 done
92 echo " {0, 0}" >> unictabl.inc
93 echo " };" >> unictabl.inc
94 echo "
95 static const unsigned encoding_unicode_fallback_count = "`cat Fallbacks | wc -l`";" >> unictabl.inc
96
97
98 echo " * adding reference table..."
99
100
101 echo "
102
103
104
105 /*
106 *
107 * Table of all supported encodings:
108 *
109 */
110
111 static const struct {
112 wxFontEncoding encoding; // encoding identifier
113 const wxUint16 *table; // 8bit to unicode table
114 } encodings_list[] = {
115 " >> unictabl.inc
116
117 for i in $all_encodings ; do
118 echo " { wxFONTENCODING_$i, encoding_table__$i}," >> unictabl.inc
119 done
120
121 echo " {wxFONTENCODING_MAX /*anything*/, NULL}" >> unictabl.inc
122 echo " };" >> unictabl.inc