mk_encodings.sh 2.8 KB

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