Browse Source

Plan 9 from Bell Labs 2003-11-26

David du Colombier 20 years ago
parent
commit
6c820203da
100 changed files with 30991 additions and 16 deletions
  1. 132 12
      dist/replica/plan9.db
  2. 364 0
      dist/replica/plan9.log
  3. 1 0
      lib/face/48x48x4/.dict
  4. 16 0
      rc/bin/doc2ps
  5. 303 0
      sys/lib/antiword/8859-1.txt
  6. 303 0
      sys/lib/antiword/8859-10.txt
  7. 299 0
      sys/lib/antiword/8859-13.txt
  8. 301 0
      sys/lib/antiword/8859-14.txt
  9. 303 0
      sys/lib/antiword/8859-15.txt
  10. 299 0
      sys/lib/antiword/8859-16.txt
  11. 303 0
      sys/lib/antiword/8859-2.txt
  12. 296 0
      sys/lib/antiword/8859-3.txt
  13. 303 0
      sys/lib/antiword/8859-4.txt
  14. 303 0
      sys/lib/antiword/8859-5.txt
  15. 260 0
      sys/lib/antiword/8859-6.txt
  16. 302 0
      sys/lib/antiword/8859-7.txt
  17. 270 0
      sys/lib/antiword/8859-8.txt
  18. 307 0
      sys/lib/antiword/8859-9.txt
  19. 81 0
      sys/lib/antiword/Default
  20. 80 0
      sys/lib/antiword/Example
  21. 364 0
      sys/lib/antiword/MacRoman.txt
  22. 3 0
      sys/lib/antiword/UTF-8.txt
  23. 306 0
      sys/lib/antiword/Unicode01
  24. 305 0
      sys/lib/antiword/Unicode15
  25. 274 0
      sys/lib/antiword/cp1250.txt
  26. 274 0
      sys/lib/antiword/cp1251.txt
  27. 274 0
      sys/lib/antiword/cp1252.txt
  28. 273 0
      sys/lib/antiword/cp437.txt
  29. 273 0
      sys/lib/antiword/cp850.txt
  30. 273 0
      sys/lib/antiword/cp852.txt
  31. 273 0
      sys/lib/antiword/cp862.txt
  32. 273 0
      sys/lib/antiword/cp866.txt
  33. 117 0
      sys/lib/antiword/fontnames
  34. 43 0
      sys/lib/antiword/fontnames.russian
  35. 302 0
      sys/lib/antiword/koi8-r.txt
  36. 303 0
      sys/lib/antiword/koi8-u.txt
  37. 0 0
      sys/lib/antiword/roman.txt
  38. 4 4
      sys/lib/plumb/basic
  39. 342 0
      sys/src/cmd/aux/antiword/COPYING
  40. 180 0
      sys/src/cmd/aux/antiword/ChangeLog
  41. 134 0
      sys/src/cmd/aux/antiword/Emacs
  42. 14 0
      sys/src/cmd/aux/antiword/Exmh
  43. 97 0
      sys/src/cmd/aux/antiword/FAQ
  44. 44 0
      sys/src/cmd/aux/antiword/History
  45. 88 0
      sys/src/cmd/aux/antiword/Mozilla
  46. 24 0
      sys/src/cmd/aux/antiword/Mutt
  47. 129 0
      sys/src/cmd/aux/antiword/Netscape
  48. 56 0
      sys/src/cmd/aux/antiword/QandA
  49. 113 0
      sys/src/cmd/aux/antiword/ReadMe
  50. 143 0
      sys/src/cmd/aux/antiword/antiword.1.txt
  51. 638 0
      sys/src/cmd/aux/antiword/antiword.h
  52. 146 0
      sys/src/cmd/aux/antiword/antiword.man
  53. 34 0
      sys/src/cmd/aux/antiword/antiword.php
  54. 154 0
      sys/src/cmd/aux/antiword/asc85enc.c
  55. 682 0
      sys/src/cmd/aux/antiword/blocklist.c
  56. 606 0
      sys/src/cmd/aux/antiword/chartrans.c
  57. 374 0
      sys/src/cmd/aux/antiword/datalist.c
  58. 102 0
      sys/src/cmd/aux/antiword/debug.h
  59. 114 0
      sys/src/cmd/aux/antiword/depot.c
  60. 509 0
      sys/src/cmd/aux/antiword/dib2eps.c
  61. 594 0
      sys/src/cmd/aux/antiword/dib2sprt.c
  62. 1076 0
      sys/src/cmd/aux/antiword/draw.c
  63. 46 0
      sys/src/cmd/aux/antiword/draw.h
  64. 26 0
      sys/src/cmd/aux/antiword/fail.c
  65. 22 0
      sys/src/cmd/aux/antiword/fail.h
  66. 154 0
      sys/src/cmd/aux/antiword/finddata.c
  67. 299 0
      sys/src/cmd/aux/antiword/findtext.c
  68. 2251 0
      sys/src/cmd/aux/antiword/fontinfo.h
  69. 207 0
      sys/src/cmd/aux/antiword/fontinfo.pl
  70. 164 0
      sys/src/cmd/aux/antiword/fontlist.c
  71. 849 0
      sys/src/cmd/aux/antiword/fonts.c
  72. 249 0
      sys/src/cmd/aux/antiword/fonts_r.c
  73. 287 0
      sys/src/cmd/aux/antiword/fonts_u.c
  74. 94 0
      sys/src/cmd/aux/antiword/icons.c
  75. 1014 0
      sys/src/cmd/aux/antiword/imgexam.c
  76. 71 0
      sys/src/cmd/aux/antiword/imgtrans.c
  77. 74 0
      sys/src/cmd/aux/antiword/jpeg2eps.c
  78. 97 0
      sys/src/cmd/aux/antiword/jpeg2sprt.c
  79. 330 0
      sys/src/cmd/aux/antiword/listlist.c
  80. 386 0
      sys/src/cmd/aux/antiword/main_r.c
  81. 278 0
      sys/src/cmd/aux/antiword/main_u.c
  82. 647 0
      sys/src/cmd/aux/antiword/misc.c
  83. 27 0
      sys/src/cmd/aux/antiword/mkfile
  84. 397 0
      sys/src/cmd/aux/antiword/notes.c
  85. 786 0
      sys/src/cmd/aux/antiword/options.c
  86. 670 0
      sys/src/cmd/aux/antiword/out2window.c
  87. 466 0
      sys/src/cmd/aux/antiword/output.c
  88. 100 0
      sys/src/cmd/aux/antiword/pictlist.c
  89. 191 0
      sys/src/cmd/aux/antiword/png2eps.c
  90. 26 0
      sys/src/cmd/aux/antiword/png2sprt.c
  91. 929 0
      sys/src/cmd/aux/antiword/postscript.c
  92. 368 0
      sys/src/cmd/aux/antiword/prop0.c
  93. 974 0
      sys/src/cmd/aux/antiword/prop2.c
  94. 1010 0
      sys/src/cmd/aux/antiword/prop6.c
  95. 1356 0
      sys/src/cmd/aux/antiword/prop8.c
  96. 145 0
      sys/src/cmd/aux/antiword/properties.c
  97. 110 0
      sys/src/cmd/aux/antiword/propmod.c
  98. 290 0
      sys/src/cmd/aux/antiword/riscos.c
  99. 118 0
      sys/src/cmd/aux/antiword/rowlist.c
  100. 330 0
      sys/src/cmd/aux/antiword/saveas.c

+ 132 - 12
dist/replica/plan9.db

@@ -90,6 +90,7 @@
 386/bin/aux/X509gen - 775 sys sys 1048341826 129186
 386/bin/aux/accupoint - 775 sys sys 1064598059 40841
 386/bin/aux/acidleak - 775 sys sys 1064598060 67816
+386/bin/aux/antiword - 775 sys sys 1069793954 511478
 386/bin/aux/apm - 775 sys sys 1064598061 175778
 386/bin/aux/astarld - 775 sys sys 1064598061 63276
 386/bin/aux/cddb - 775 sys sys 1064598062 70192
@@ -313,7 +314,7 @@
 386/bin/mtime - 775 sys sys 1064598257 57628
 386/bin/mv - 775 sys sys 1064598258 64748
 386/bin/ndb - 20000000775 sys sys 985743147 0
-386/bin/ndb/cs - 775 sys sys 1069592370 144678
+386/bin/ndb/cs - 775 sys sys 1069766560 144581
 386/bin/ndb/csquery - 775 sys sys 1064598259 59890
 386/bin/ndb/dns - 775 sys sys 1069592370 218704
 386/bin/ndb/dnsdebug - 775 sys sys 1069592371 191053
@@ -332,7 +333,7 @@
 386/bin/nntpfs - 775 sys sys 1064598272 162969
 386/bin/ns - 775 sys sys 1064598273 63582
 386/bin/p - 775 sys sys 1064598274 63537
-386/bin/page - 775 sys sys 1064598275 216156
+386/bin/page - 775 sys sys 1069793956 216396
 386/bin/paqfs - 775 sys sys 1064598276 107830
 386/bin/passwd - 775 sys sys 1069592374 80215
 386/bin/pbd - 775 sys sys 1038443175 4663
@@ -526,7 +527,7 @@
 386/lib/libgeometry.a - 664 sys sys 1068385839 50806
 386/lib/libhtml.a - 664 sys sys 1068385840 220944
 386/lib/libhttpd.a - 664 sys sys 1068385841 98914
-386/lib/libip.a - 664 sys sys 1068385841 34340
+386/lib/libip.a - 664 sys sys 1069766546 34142
 386/lib/libl.a - 664 sys sys 1068385841 5412
 386/lib/libmach.a - 664 sys sys 1068558293 748290
 386/lib/libmemdraw.a - 664 sys sys 1068385844 292604
@@ -1247,7 +1248,7 @@ lib/face/48x48x2/x - 20000000755 sys sys 944941683 0
 lib/face/48x48x2/y - 20000000755 sys sys 944941683 0
 lib/face/48x48x2/z - 20000000755 sys sys 944941683 0
 lib/face/48x48x4 - 20000000775 sys sys 944941894 0
-lib/face/48x48x4/.dict - 664 sys sys 1067873122 2032
+lib/face/48x48x4/.dict - 664 sys sys 1069781039 2061
 lib/face/48x48x4/Z - 20000000775 sys sys 944945342 0
 lib/face/48x48x4/a - 20000000775 sys sys 944945701 0
 lib/face/48x48x4/a/adb.1 - 664 sys sys 944941890 962
@@ -2973,6 +2974,7 @@ rc/bin/c: - 775 sys sys 1015089511 86
 rc/bin/cpurc - 775 sys sys 1048777186 1338
 rc/bin/dial - 20000000775 sys sys 1059180057 0
 rc/bin/dircp - 775 sys sys 953344769 113
+rc/bin/doc2ps - 775 sys sys 1069793831 244
 rc/bin/doc2txt - 775 sys sys 1025197880 563
 rc/bin/doctype - 775 sys sys 945617206 1726
 rc/bin/dosmnt - 775 sys sys 958526437 285
@@ -3430,6 +3432,40 @@ sys/lib/acid/truss - 664 sys sys 1036381004 5271
 sys/lib/acid/window - 775 sys sys 954566816 515
 sys/lib/agent.config - 664 sys sys 984788242 1827
 sys/lib/amspell - 664 sys sys 944956051 169218
+sys/lib/antiword - 20000000775 sys sys 1069793892 0
+sys/lib/antiword/8859-1.txt - 664 sys sys 1069793886 10592
+sys/lib/antiword/8859-10.txt - 664 sys sys 1069793886 10989
+sys/lib/antiword/8859-13.txt - 664 sys sys 1069793886 10588
+sys/lib/antiword/8859-14.txt - 664 sys sys 1069793886 11003
+sys/lib/antiword/8859-15.txt - 664 sys sys 1069793886 10583
+sys/lib/antiword/8859-16.txt - 664 sys sys 1069793886 10868
+sys/lib/antiword/8859-2.txt - 664 sys sys 1069793887 10816
+sys/lib/antiword/8859-3.txt - 664 sys sys 1069793887 10498
+sys/lib/antiword/8859-4.txt - 664 sys sys 1069793887 10792
+sys/lib/antiword/8859-5.txt - 664 sys sys 1069793887 10427
+sys/lib/antiword/8859-6.txt - 664 sys sys 1069793887 8308
+sys/lib/antiword/8859-7.txt - 664 sys sys 1069793888 10365
+sys/lib/antiword/8859-8.txt - 664 sys sys 1069793888 8553
+sys/lib/antiword/8859-9.txt - 664 sys sys 1069793888 10628
+sys/lib/antiword/Default - 664 sys sys 1069793888 3211
+sys/lib/antiword/Example - 664 sys sys 1069793888 3038
+sys/lib/antiword/MacRoman.txt - 664 sys sys 1069793889 14030
+sys/lib/antiword/UTF-8.txt - 664 sys sys 1069793889 107
+sys/lib/antiword/Unicode01 - 664 sys sys 1069793889 10858
+sys/lib/antiword/Unicode15 - 664 sys sys 1069793889 10818
+sys/lib/antiword/cp1250.txt - 664 sys sys 1069793889 9799
+sys/lib/antiword/cp1251.txt - 664 sys sys 1069793890 9474
+sys/lib/antiword/cp1252.txt - 664 sys sys 1069793890 9624
+sys/lib/antiword/cp437.txt - 664 sys sys 1069793890 9847
+sys/lib/antiword/cp850.txt - 664 sys sys 1069793890 9693
+sys/lib/antiword/cp852.txt - 664 sys sys 1069793890 9992
+sys/lib/antiword/cp862.txt - 664 sys sys 1069793891 9448
+sys/lib/antiword/cp866.txt - 664 sys sys 1069793891 9817
+sys/lib/antiword/fontnames - 664 sys sys 1069793891 4696
+sys/lib/antiword/fontnames.russian - 664 sys sys 1069793891 1565
+sys/lib/antiword/koi8-r.txt - 664 sys sys 1069793891 11204
+sys/lib/antiword/koi8-u.txt - 664 sys sys 1069793891 11259
+sys/lib/antiword/roman.txt - 664 sys sys 1069793892 14030
 sys/lib/astar - 20000000775 sys sys 954272855 0
 sys/lib/astar/a100i.cp - 644 sys sys 954272855 30662
 sys/lib/astar/a100p.cp - 444 sys sys 954272855 21984
@@ -3903,7 +3939,7 @@ sys/lib/man/trademarks - 664 sys sys 958527089 1838
 sys/lib/mimetype - 664 sys sys 1064393944 5563
 sys/lib/newuser - 775 sys sys 1018386991 1229
 sys/lib/plumb - 20000000775 sys sys 944957365 0
-sys/lib/plumb/basic - 664 sys sys 1032058379 2908
+sys/lib/plumb/basic - 664 sys sys 1069794119 2906
 sys/lib/plumb/fileaddr - 664 sys sys 944957365 88
 sys/lib/postscript - 20000000775 sys sys 950322802 0
 sys/lib/postscript/afm - 20000000775 sys sys 950322802 0
@@ -6793,6 +6829,90 @@ sys/src/cmd/aux - 20000000775 sys sys 1015008975 0
 sys/src/cmd/aux/9pcon.c - 664 sys sys 1032059259 6283
 sys/src/cmd/aux/accupoint.c - 664 sys sys 985124882 2166
 sys/src/cmd/aux/acidleak.c - 664 sys sys 1050441591 5931
+sys/src/cmd/aux/antiword - 20000000775 sys sys 1069793877 0
+sys/src/cmd/aux/antiword/COPYING - 664 sys sys 1069793863 17985
+sys/src/cmd/aux/antiword/ChangeLog - 664 sys sys 1069793863 7543
+sys/src/cmd/aux/antiword/Emacs - 664 sys sys 1069793863 4368
+sys/src/cmd/aux/antiword/Exmh - 664 sys sys 1069793863 463
+sys/src/cmd/aux/antiword/FAQ - 664 sys sys 1069793864 4682
+sys/src/cmd/aux/antiword/History - 664 sys sys 1069793864 1528
+sys/src/cmd/aux/antiword/Mozilla - 664 sys sys 1069793864 1983
+sys/src/cmd/aux/antiword/Mutt - 664 sys sys 1069793864 717
+sys/src/cmd/aux/antiword/Netscape - 664 sys sys 1069793864 4313
+sys/src/cmd/aux/antiword/QandA - 664 sys sys 1069793864 2709
+sys/src/cmd/aux/antiword/ReadMe - 664 sys sys 1069793864 3539
+sys/src/cmd/aux/antiword/antiword.1.txt - 664 sys sys 1069793865 4443
+sys/src/cmd/aux/antiword/antiword.h - 664 sys sys 1069793865 23228
+sys/src/cmd/aux/antiword/antiword.man - 664 sys sys 1069793865 5447
+sys/src/cmd/aux/antiword/antiword.php - 664 sys sys 1069793865 926
+sys/src/cmd/aux/antiword/asc85enc.c - 664 sys sys 1069793865 3910
+sys/src/cmd/aux/antiword/blocklist.c - 664 sys sys 1069793865 18691
+sys/src/cmd/aux/antiword/chartrans.c - 664 sys sys 1069793866 18395
+sys/src/cmd/aux/antiword/datalist.c - 664 sys sys 1069793866 8933
+sys/src/cmd/aux/antiword/debug.h - 664 sys sys 1069793866 2915
+sys/src/cmd/aux/antiword/depot.c - 664 sys sys 1069793866 2724
+sys/src/cmd/aux/antiword/dib2eps.c - 664 sys sys 1069793866 12146
+sys/src/cmd/aux/antiword/dib2sprt.c - 664 sys sys 1069793866 14217
+sys/src/cmd/aux/antiword/draw.c - 664 sys sys 1069793867 27039
+sys/src/cmd/aux/antiword/draw.h - 664 sys sys 1069793867 1012
+sys/src/cmd/aux/antiword/fail.c - 664 sys sys 1069793867 613
+sys/src/cmd/aux/antiword/fail.h - 664 sys sys 1069793867 401
+sys/src/cmd/aux/antiword/finddata.c - 664 sys sys 1069793867 3797
+sys/src/cmd/aux/antiword/findtext.c - 664 sys sys 1069793867 7654
+sys/src/cmd/aux/antiword/fontinfo.h - 664 sys sys 1069793868 126349
+sys/src/cmd/aux/antiword/fontinfo.pl - 664 sys sys 1069793868 7360
+sys/src/cmd/aux/antiword/fontlist.c - 664 sys sys 1069793868 4135
+sys/src/cmd/aux/antiword/fonts.c - 664 sys sys 1069793868 22217
+sys/src/cmd/aux/antiword/fonts_r.c - 664 sys sys 1069793869 5701
+sys/src/cmd/aux/antiword/fonts_u.c - 664 sys sys 1069793869 6964
+sys/src/cmd/aux/antiword/icons.c - 664 sys sys 1069793869 2328
+sys/src/cmd/aux/antiword/imgexam.c - 664 sys sys 1069793869 25704
+sys/src/cmd/aux/antiword/imgtrans.c - 664 sys sys 1069793869 1703
+sys/src/cmd/aux/antiword/jpeg2eps.c - 664 sys sys 1069793869 1482
+sys/src/cmd/aux/antiword/jpeg2sprt.c - 664 sys sys 1069793870 2159
+sys/src/cmd/aux/antiword/listlist.c - 664 sys sys 1069793870 7855
+sys/src/cmd/aux/antiword/main_r.c - 664 sys sys 1069793870 8346
+sys/src/cmd/aux/antiword/main_u.c - 664 sys sys 1069793870 7015
+sys/src/cmd/aux/antiword/misc.c - 664 sys sys 1069793870 15240
+sys/src/cmd/aux/antiword/mkfile - 664 sys sys 1069793871 943
+sys/src/cmd/aux/antiword/notes.c - 664 sys sys 1069793871 11146
+sys/src/cmd/aux/antiword/options.c - 664 sys sys 1069793871 20371
+sys/src/cmd/aux/antiword/out2window.c - 664 sys sys 1069793871 16844
+sys/src/cmd/aux/antiword/output.c - 664 sys sys 1069793871 9013
+sys/src/cmd/aux/antiword/pictlist.c - 664 sys sys 1069793872 2294
+sys/src/cmd/aux/antiword/png2eps.c - 664 sys sys 1069793872 4032
+sys/src/cmd/aux/antiword/png2sprt.c - 664 sys sys 1069793872 572
+sys/src/cmd/aux/antiword/postscript.c - 664 sys sys 1069793872 26420
+sys/src/cmd/aux/antiword/prop0.c - 664 sys sys 1069793872 9513
+sys/src/cmd/aux/antiword/prop2.c - 664 sys sys 1069793872 25584
+sys/src/cmd/aux/antiword/prop6.c - 664 sys sys 1069793873 26935
+sys/src/cmd/aux/antiword/prop8.c - 664 sys sys 1069793873 36372
+sys/src/cmd/aux/antiword/properties.c - 664 sys sys 1069793873 3874
+sys/src/cmd/aux/antiword/propmod.c - 664 sys sys 1069793873 2427
+sys/src/cmd/aux/antiword/riscos.c - 664 sys sys 1069793873 6885
+sys/src/cmd/aux/antiword/rowlist.c - 664 sys sys 1069793874 2842
+sys/src/cmd/aux/antiword/saveas.c - 664 sys sys 1069793874 8173
+sys/src/cmd/aux/antiword/sectlist.c - 664 sys sys 1069793874 2957
+sys/src/cmd/aux/antiword/startup.c - 664 sys sys 1069793874 3563
+sys/src/cmd/aux/antiword/stylelist.c - 664 sys sys 1069793874 11414
+sys/src/cmd/aux/antiword/stylesheet.c - 664 sys sys 1069793874 21419
+sys/src/cmd/aux/antiword/summary.c - 664 sys sys 1069793875 22128
+sys/src/cmd/aux/antiword/tabstop.c - 664 sys sys 1069793875 5442
+sys/src/cmd/aux/antiword/testdoc.doc - 664 sys sys 1069793875 23552
+sys/src/cmd/aux/antiword/text.c - 664 sys sys 1069793875 3892
+sys/src/cmd/aux/antiword/unix.c - 664 sys sys 1069793875 820
+sys/src/cmd/aux/antiword/utf8.c - 664 sys sys 1069793875 8491
+sys/src/cmd/aux/antiword/version.h - 664 sys sys 1069793876 614
+sys/src/cmd/aux/antiword/word2text.c - 664 sys sys 1069793876 30234
+sys/src/cmd/aux/antiword/wordconst.h - 664 sys sys 1069793876 11243
+sys/src/cmd/aux/antiword/worddos.c - 664 sys sys 1069793876 2700
+sys/src/cmd/aux/antiword/wordlib.c - 664 sys sys 1069793876 7850
+sys/src/cmd/aux/antiword/wordmac.c - 664 sys sys 1069793876 2256
+sys/src/cmd/aux/antiword/wordole.c - 664 sys sys 1069793877 21957
+sys/src/cmd/aux/antiword/wordtypes.h - 664 sys sys 1069793877 7489
+sys/src/cmd/aux/antiword/wordwin.c - 664 sys sys 1069793877 5447
+sys/src/cmd/aux/antiword/xmalloc.c - 664 sys sys 1069793877 2185
+sys/src/cmd/aux/antiword/xml.c - 664 sys sys 1069793877 30883
 sys/src/cmd/aux/apm.c - 664 sys sys 1046654953 20263
 sys/src/cmd/aux/astarld.c - 664 sys sys 1015008684 4638
 sys/src/cmd/aux/cddb.c - 664 sys sys 1032059267 4303
@@ -7180,7 +7300,7 @@ sys/src/cmd/disk/kfs/sub.c - 664 sys sys 1022008488 10804
 sys/src/cmd/disk/kfs/uid.c - 664 sys sys 1022008489 6719
 sys/src/cmd/disk/kfscmd.c - 664 sys sys 1015009135 1109
 sys/src/cmd/disk/mbr.c - 664 sys sys 1063855285 4325
-sys/src/cmd/disk/mkext.c - 664 sys sys 1015009135 5427
+sys/src/cmd/disk/mkext.c - 664 sys sys 1069818199 5500
 sys/src/cmd/disk/mkfile - 664 sys sys 1022385851 500
 sys/src/cmd/disk/mkfs.c - 664 sys sys 1032059493 14298
 sys/src/cmd/disk/prep - 20000000775 sys sys 988249968 0
@@ -7307,7 +7427,7 @@ sys/src/cmd/fossil/9excl.c - 664 sys sys 1042005502 1887
 sys/src/cmd/fossil/9fid.c - 664 sys sys 1045600016 5521
 sys/src/cmd/fossil/9fsys.c - 664 sys sys 1068591358 29979
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1042005503 2865
-sys/src/cmd/fossil/9p.c - 664 sys sys 1066098096 21486
+sys/src/cmd/fossil/9p.c - 664 sys sys 1069818231 21498
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
 sys/src/cmd/fossil/9proc.c - 664 sys sys 1069683861 14521
 sys/src/cmd/fossil/9srv.c - 664 sys sys 1066098097 3682
@@ -9529,13 +9649,13 @@ sys/src/cmd/nntpfs.c - 664 sys sys 1055699250 18903
 sys/src/cmd/ns.c - 664 sys sys 984717934 3558
 sys/src/cmd/p.c - 664 sys sys 1043516305 1497
 sys/src/cmd/page - 20000000775 sys sys 956344628 0
-sys/src/cmd/page/filter.c - 664 sys sys 1014926743 2008
+sys/src/cmd/page/filter.c - 664 sys sys 1069793856 2166
 sys/src/cmd/page/gfx.c - 664 sys sys 1032060334 6631
 sys/src/cmd/page/gs.c - 664 sys sys 1038517813 6544
 sys/src/cmd/page/mkfile - 664 sys sys 1035998247 411
 sys/src/cmd/page/nrotate.c - 664 sys sys 944961365 5806
-sys/src/cmd/page/page.c - 664 sys sys 1035695486 4292
-sys/src/cmd/page/page.h - 664 sys sys 1045606937 2000
+sys/src/cmd/page/page.c - 664 sys sys 1069793855 4413
+sys/src/cmd/page/page.h - 664 sys sys 1069793856 2056
 sys/src/cmd/page/pdf.c - 664 sys sys 1038517814 2884
 sys/src/cmd/page/pdfprolog.ps - 664 sys sys 1035695487 699
 sys/src/cmd/page/ps.c - 664 sys sys 1045505467 9176
@@ -10512,7 +10632,7 @@ sys/src/cmd/unix/u9fs/safecpy.c - 664 sys sys 1043768486 212
 sys/src/cmd/unix/u9fs/strecpy.c - 664 sys sys 1015092353 193
 sys/src/cmd/unix/u9fs/sun-inttypes.h - 664 sys sys 1039110816 441
 sys/src/cmd/unix/u9fs/tokenize.c - 664 sys sys 1015092353 602
-sys/src/cmd/unix/u9fs/u9fs.c - 664 sys sys 1056163716 30830
+sys/src/cmd/unix/u9fs/u9fs.c - 664 sys sys 1069814541 30917
 sys/src/cmd/unix/u9fs/u9fs.h - 664 sys sys 1043768488 649
 sys/src/cmd/unix/u9fs/u9fsauth.h - 664 sys sys 1015092354 126
 sys/src/cmd/unix/u9fs/utfrune.c - 664 sys sys 1015092354 387
@@ -11666,7 +11786,7 @@ sys/src/libip/ip.h - 664 sys sys 944961727 1438
 sys/src/libip/ipaux.c - 664 sys sys 985038059 1515
 sys/src/libip/mkfile - 664 sys sys 1065576347 320
 sys/src/libip/myetheraddr.c - 664 sys sys 1066515138 837
-sys/src/libip/myipaddr.c - 664 sys sys 1063853830 942
+sys/src/libip/myipaddr.c - 664 sys sys 1069766545 841
 sys/src/libip/parseether.c - 664 sys sys 944961726 318
 sys/src/libip/parseip.c - 664 sys sys 950104689 2130
 sys/src/libip/ptclbsum.c - 664 sys sys 1014927943 1158

+ 364 - 0
dist/replica/plan9.log

@@ -12449,3 +12449,367 @@
 1069684229 3 c sys/src/cmd/fossil/fossil.c - 664 sys sys 1069683860 2114
 1069707632 0 c sys/man/3/proc - 664 sys sys 1069706068 11896
 1069707632 1 d sys/man/3/realtime - 664 sys sys 1067722856 0
+1069767042 0 c 386/bin/ndb/cs - 775 sys sys 1069766560 144581
+1069767042 1 c 386/lib/libip.a - 664 sys sys 1069766546 34142
+1069767042 2 c sys/src/libip/myipaddr.c - 664 sys sys 1069766545 841
+1069781415 0 c lib/face/48x48x4/.dict - 664 sys sys 1069781039 2061
+1069794016 0 c 386/bin/page - 775 sys sys 1069793956 216396
+1069794016 1 a 386/bin/aux/antiword - 775 sys sys 1069793954 511478
+1069794016 2 a rc/bin/doc2ps - 775 sys sys 1069793831 244
+1069794016 3 a sys/lib/antiword - 20000000775 sys sys 1069793892 0
+1069794016 4 a sys/lib/antiword/8859-1.txt - 640 sys sys 1069793886 10592
+1069794016 5 a sys/lib/antiword/8859-10.txt - 640 sys sys 1069793886 10989
+1069794016 6 a sys/lib/antiword/8859-13.txt - 640 sys sys 1069793886 10588
+1069794016 7 a sys/lib/antiword/8859-14.txt - 640 sys sys 1069793886 11003
+1069794016 8 a sys/lib/antiword/8859-15.txt - 640 sys sys 1069793886 10583
+1069794016 9 a sys/lib/antiword/8859-16.txt - 640 sys sys 1069793886 10868
+1069794016 10 a sys/lib/antiword/8859-2.txt - 640 sys sys 1069793887 10816
+1069794016 11 a sys/lib/antiword/8859-3.txt - 640 sys sys 1069793887 10498
+1069794016 12 a sys/lib/antiword/8859-4.txt - 640 sys sys 1069793887 10792
+1069794016 13 a sys/lib/antiword/8859-5.txt - 640 sys sys 1069793887 10427
+1069794016 14 a sys/lib/antiword/8859-6.txt - 640 sys sys 1069793887 8308
+1069794016 15 a sys/lib/antiword/8859-7.txt - 640 sys sys 1069793888 10365
+1069794016 16 a sys/lib/antiword/8859-8.txt - 640 sys sys 1069793888 8553
+1069794016 17 a sys/lib/antiword/8859-9.txt - 640 sys sys 1069793888 10628
+1069794016 18 a sys/lib/antiword/Default - 640 sys sys 1069793888 3211
+1069794016 19 a sys/lib/antiword/Example - 640 sys sys 1069793888 3038
+1069794016 20 a sys/lib/antiword/MacRoman.txt - 640 sys sys 1069793889 14030
+1069794016 21 a sys/lib/antiword/UTF-8.txt - 640 sys sys 1069793889 107
+1069794016 22 a sys/lib/antiword/Unicode01 - 640 sys sys 1069793889 10858
+1069794016 23 a sys/lib/antiword/Unicode15 - 640 sys sys 1069793889 10818
+1069794016 24 a sys/lib/antiword/cp1250.txt - 640 sys sys 1069793889 9799
+1069794016 25 a sys/lib/antiword/cp1251.txt - 640 sys sys 1069793890 9474
+1069794016 26 a sys/lib/antiword/cp1252.txt - 640 sys sys 1069793890 9624
+1069794016 27 a sys/lib/antiword/cp437.txt - 640 sys sys 1069793890 9847
+1069794016 28 a sys/lib/antiword/cp850.txt - 640 sys sys 1069793890 9693
+1069794016 29 a sys/lib/antiword/cp852.txt - 640 sys sys 1069793890 9992
+1069794016 30 a sys/lib/antiword/cp862.txt - 640 sys sys 1069793891 9448
+1069794016 31 a sys/lib/antiword/cp866.txt - 640 sys sys 1069793891 9817
+1069794016 32 a sys/lib/antiword/fontnames - 640 sys sys 1069793891 4696
+1069794016 33 a sys/lib/antiword/fontnames.russian - 640 sys sys 1069793891 1565
+1069794016 34 a sys/lib/antiword/koi8-r.txt - 640 sys sys 1069793891 11204
+1069794016 35 a sys/lib/antiword/koi8-u.txt - 640 sys sys 1069793891 11259
+1069794016 36 a sys/lib/antiword/roman.txt - 640 sys sys 1069793892 14030
+1069794016 37 a sys/src/cmd/aux/antiword - 20000000775 sys sys 1069793877 0
+1069794016 38 a sys/src/cmd/aux/antiword/COPYING - 640 sys sys 1069793863 17985
+1069794016 39 a sys/src/cmd/aux/antiword/ChangeLog - 640 sys sys 1069793863 7543
+1069794016 40 a sys/src/cmd/aux/antiword/Emacs - 640 sys sys 1069793863 4368
+1069794016 41 a sys/src/cmd/aux/antiword/Exmh - 640 sys sys 1069793863 463
+1069794016 42 a sys/src/cmd/aux/antiword/FAQ - 640 sys sys 1069793864 4682
+1069794016 43 a sys/src/cmd/aux/antiword/History - 640 sys sys 1069793864 1528
+1069794016 44 a sys/src/cmd/aux/antiword/Mozilla - 640 sys sys 1069793864 1983
+1069794016 45 a sys/src/cmd/aux/antiword/Mutt - 640 sys sys 1069793864 717
+1069794016 46 a sys/src/cmd/aux/antiword/Netscape - 640 sys sys 1069793864 4313
+1069794016 47 a sys/src/cmd/aux/antiword/QandA - 640 sys sys 1069793864 2709
+1069794016 48 a sys/src/cmd/aux/antiword/ReadMe - 640 sys sys 1069793864 3539
+1069794016 49 a sys/src/cmd/aux/antiword/antiword.1.txt - 640 sys sys 1069793865 4443
+1069794016 50 a sys/src/cmd/aux/antiword/antiword.h - 640 sys sys 1069793865 23228
+1069794016 51 a sys/src/cmd/aux/antiword/antiword.man - 640 sys sys 1069793865 5447
+1069794016 52 a sys/src/cmd/aux/antiword/antiword.php - 640 sys sys 1069793865 926
+1069794016 53 a sys/src/cmd/aux/antiword/asc85enc.c - 640 sys sys 1069793865 3910
+1069794016 54 a sys/src/cmd/aux/antiword/blocklist.c - 640 sys sys 1069793865 18691
+1069794016 55 a sys/src/cmd/aux/antiword/chartrans.c - 640 sys sys 1069793866 18395
+1069794016 56 a sys/src/cmd/aux/antiword/datalist.c - 640 sys sys 1069793866 8933
+1069794016 57 a sys/src/cmd/aux/antiword/debug.h - 640 sys sys 1069793866 2915
+1069794016 58 a sys/src/cmd/aux/antiword/depot.c - 640 sys sys 1069793866 2724
+1069794016 59 a sys/src/cmd/aux/antiword/dib2eps.c - 640 sys sys 1069793866 12146
+1069794016 60 a sys/src/cmd/aux/antiword/dib2sprt.c - 640 sys sys 1069793866 14217
+1069794016 61 a sys/src/cmd/aux/antiword/draw.c - 640 sys sys 1069793867 27039
+1069794016 62 a sys/src/cmd/aux/antiword/draw.h - 640 sys sys 1069793867 1012
+1069794016 63 a sys/src/cmd/aux/antiword/fail.c - 640 sys sys 1069793867 613
+1069794016 64 a sys/src/cmd/aux/antiword/fail.h - 640 sys sys 1069793867 401
+1069794016 65 a sys/src/cmd/aux/antiword/finddata.c - 640 sys sys 1069793867 3797
+1069794016 66 a sys/src/cmd/aux/antiword/findtext.c - 640 sys sys 1069793867 7654
+1069794016 67 a sys/src/cmd/aux/antiword/fontinfo.h - 640 sys sys 1069793868 126349
+1069794016 68 a sys/src/cmd/aux/antiword/fontinfo.pl - 750 sys sys 1069793868 7360
+1069794016 69 a sys/src/cmd/aux/antiword/fontlist.c - 640 sys sys 1069793868 4135
+1069794016 70 a sys/src/cmd/aux/antiword/fonts.c - 640 sys sys 1069793868 22217
+1069794016 71 a sys/src/cmd/aux/antiword/fonts_r.c - 640 sys sys 1069793869 5701
+1069794016 72 a sys/src/cmd/aux/antiword/fonts_u.c - 640 sys sys 1069793869 6964
+1069794016 73 a sys/src/cmd/aux/antiword/icons.c - 640 sys sys 1069793869 2328
+1069794016 74 a sys/src/cmd/aux/antiword/imgexam.c - 640 sys sys 1069793869 25704
+1069794016 75 a sys/src/cmd/aux/antiword/imgtrans.c - 640 sys sys 1069793869 1703
+1069794016 76 a sys/src/cmd/aux/antiword/jpeg2eps.c - 640 sys sys 1069793869 1482
+1069794016 77 a sys/src/cmd/aux/antiword/jpeg2sprt.c - 640 sys sys 1069793870 2159
+1069794016 78 a sys/src/cmd/aux/antiword/listlist.c - 640 sys sys 1069793870 7855
+1069794016 79 a sys/src/cmd/aux/antiword/main_r.c - 640 sys sys 1069793870 8346
+1069794016 80 a sys/src/cmd/aux/antiword/main_u.c - 640 sys sys 1069793870 7015
+1069794016 81 a sys/src/cmd/aux/antiword/misc.c - 640 sys sys 1069793870 15240
+1069794016 82 a sys/src/cmd/aux/antiword/mkfile - 640 sys sys 1069793871 943
+1069794016 83 a sys/src/cmd/aux/antiword/notes.c - 640 sys sys 1069793871 11146
+1069794016 84 a sys/src/cmd/aux/antiword/options.c - 640 sys sys 1069793871 20371
+1069794016 85 a sys/src/cmd/aux/antiword/out2window.c - 640 sys sys 1069793871 16844
+1069794016 86 a sys/src/cmd/aux/antiword/output.c - 640 sys sys 1069793871 9013
+1069794016 87 a sys/src/cmd/aux/antiword/pictlist.c - 640 sys sys 1069793872 2294
+1069794016 88 a sys/src/cmd/aux/antiword/png2eps.c - 640 sys sys 1069793872 4032
+1069794016 89 a sys/src/cmd/aux/antiword/png2sprt.c - 640 sys sys 1069793872 572
+1069794016 90 a sys/src/cmd/aux/antiword/postscript.c - 640 sys sys 1069793872 26420
+1069794016 91 a sys/src/cmd/aux/antiword/prop0.c - 640 sys sys 1069793872 9513
+1069794016 92 a sys/src/cmd/aux/antiword/prop2.c - 640 sys sys 1069793872 25584
+1069794016 93 a sys/src/cmd/aux/antiword/prop6.c - 640 sys sys 1069793873 26935
+1069794016 94 a sys/src/cmd/aux/antiword/prop8.c - 640 sys sys 1069793873 36372
+1069794016 95 a sys/src/cmd/aux/antiword/properties.c - 640 sys sys 1069793873 3874
+1069794016 96 a sys/src/cmd/aux/antiword/propmod.c - 640 sys sys 1069793873 2427
+1069794016 97 a sys/src/cmd/aux/antiword/riscos.c - 640 sys sys 1069793873 6885
+1069794016 98 a sys/src/cmd/aux/antiword/rowlist.c - 640 sys sys 1069793874 2842
+1069794016 99 a sys/src/cmd/aux/antiword/saveas.c - 640 sys sys 1069793874 8173
+1069794016 100 a sys/src/cmd/aux/antiword/sectlist.c - 640 sys sys 1069793874 2957
+1069794016 101 a sys/src/cmd/aux/antiword/startup.c - 640 sys sys 1069793874 3563
+1069794016 102 a sys/src/cmd/aux/antiword/stylelist.c - 640 sys sys 1069793874 11414
+1069794016 103 a sys/src/cmd/aux/antiword/stylesheet.c - 640 sys sys 1069793874 21419
+1069794016 104 a sys/src/cmd/aux/antiword/summary.c - 640 sys sys 1069793875 22128
+1069794016 105 a sys/src/cmd/aux/antiword/tabstop.c - 640 sys sys 1069793875 5442
+1069794016 106 a sys/src/cmd/aux/antiword/testdoc.doc - 640 sys sys 1069793875 23552
+1069794016 107 a sys/src/cmd/aux/antiword/text.c - 640 sys sys 1069793875 3892
+1069794016 108 a sys/src/cmd/aux/antiword/unix.c - 640 sys sys 1069793875 820
+1069794016 109 a sys/src/cmd/aux/antiword/utf8.c - 640 sys sys 1069793875 8491
+1069794016 110 a sys/src/cmd/aux/antiword/version.h - 640 sys sys 1069793876 614
+1069794016 111 a sys/src/cmd/aux/antiword/word2text.c - 640 sys sys 1069793876 30234
+1069794016 112 a sys/src/cmd/aux/antiword/wordconst.h - 640 sys sys 1069793876 11243
+1069794016 113 a sys/src/cmd/aux/antiword/worddos.c - 640 sys sys 1069793876 2700
+1069794016 114 a sys/src/cmd/aux/antiword/wordlib.c - 640 sys sys 1069793876 7850
+1069794016 115 a sys/src/cmd/aux/antiword/wordmac.c - 640 sys sys 1069793876 2256
+1069794016 116 a sys/src/cmd/aux/antiword/wordole.c - 640 sys sys 1069793877 21957
+1069794016 117 a sys/src/cmd/aux/antiword/wordtypes.h - 640 sys sys 1069793877 7489
+1069794016 118 a sys/src/cmd/aux/antiword/wordwin.c - 640 sys sys 1069793877 5447
+1069794016 119 a sys/src/cmd/aux/antiword/xmalloc.c - 640 sys sys 1069793877 2185
+1069794016 120 a sys/src/cmd/aux/antiword/xml.c - 640 sys sys 1069793877 30883
+1069794016 121 c sys/src/cmd/page/filter.c - 664 sys sys 1069793856 2166
+1069794016 122 c sys/src/cmd/page/page.c - 664 sys sys 1069793855 4413
+1069794016 123 c sys/src/cmd/page/page.h - 664 sys sys 1069793856 2056
+1069795816 0 c sys/lib/plumb/basic - 664 sys sys 1069794119 2906
+1069799416 0 m sys/lib/antiword/8859-1.txt - 644 sys sys 1069793886 10592
+1069799416 1 m sys/lib/antiword/8859-10.txt - 644 sys sys 1069793886 10989
+1069799416 2 m sys/lib/antiword/8859-13.txt - 644 sys sys 1069793886 10588
+1069799416 3 m sys/lib/antiword/8859-14.txt - 644 sys sys 1069793886 11003
+1069799416 4 m sys/lib/antiword/8859-15.txt - 644 sys sys 1069793886 10583
+1069799416 5 m sys/lib/antiword/8859-16.txt - 644 sys sys 1069793886 10868
+1069799416 6 m sys/lib/antiword/8859-2.txt - 644 sys sys 1069793887 10816
+1069799416 7 m sys/lib/antiword/8859-3.txt - 644 sys sys 1069793887 10498
+1069799416 8 m sys/lib/antiword/8859-4.txt - 644 sys sys 1069793887 10792
+1069799416 9 m sys/lib/antiword/8859-5.txt - 644 sys sys 1069793887 10427
+1069799416 10 m sys/lib/antiword/8859-6.txt - 644 sys sys 1069793887 8308
+1069799416 11 m sys/lib/antiword/8859-7.txt - 644 sys sys 1069793888 10365
+1069799416 12 m sys/lib/antiword/8859-8.txt - 644 sys sys 1069793888 8553
+1069799416 13 m sys/lib/antiword/8859-9.txt - 644 sys sys 1069793888 10628
+1069799416 14 m sys/lib/antiword/Default - 644 sys sys 1069793888 3211
+1069799416 15 m sys/lib/antiword/Example - 644 sys sys 1069793888 3038
+1069799416 16 m sys/lib/antiword/MacRoman.txt - 644 sys sys 1069793889 14030
+1069799416 17 m sys/lib/antiword/UTF-8.txt - 644 sys sys 1069793889 107
+1069799416 18 m sys/lib/antiword/Unicode01 - 644 sys sys 1069793889 10858
+1069799416 19 m sys/lib/antiword/Unicode15 - 644 sys sys 1069793889 10818
+1069799416 20 m sys/lib/antiword/cp1250.txt - 644 sys sys 1069793889 9799
+1069799416 21 m sys/lib/antiword/cp1251.txt - 644 sys sys 1069793890 9474
+1069799416 22 m sys/lib/antiword/cp1252.txt - 644 sys sys 1069793890 9624
+1069799416 23 m sys/lib/antiword/cp437.txt - 644 sys sys 1069793890 9847
+1069799416 24 m sys/lib/antiword/cp850.txt - 644 sys sys 1069793890 9693
+1069799416 25 m sys/lib/antiword/cp852.txt - 644 sys sys 1069793890 9992
+1069799416 26 m sys/lib/antiword/cp862.txt - 644 sys sys 1069793891 9448
+1069799416 27 m sys/lib/antiword/cp866.txt - 644 sys sys 1069793891 9817
+1069799416 28 m sys/lib/antiword/fontnames - 644 sys sys 1069793891 4696
+1069799416 29 m sys/lib/antiword/fontnames.russian - 644 sys sys 1069793891 1565
+1069799416 30 m sys/lib/antiword/koi8-r.txt - 644 sys sys 1069793891 11204
+1069799416 31 m sys/lib/antiword/koi8-u.txt - 644 sys sys 1069793891 11259
+1069799416 32 m sys/lib/antiword/roman.txt - 644 sys sys 1069793892 14030
+1069799416 33 m sys/src/cmd/aux/antiword/COPYING - 644 sys sys 1069793863 17985
+1069799416 34 m sys/src/cmd/aux/antiword/ChangeLog - 644 sys sys 1069793863 7543
+1069799416 35 m sys/src/cmd/aux/antiword/Emacs - 644 sys sys 1069793863 4368
+1069799416 36 m sys/src/cmd/aux/antiword/Exmh - 644 sys sys 1069793863 463
+1069799416 37 m sys/src/cmd/aux/antiword/FAQ - 644 sys sys 1069793864 4682
+1069799416 38 m sys/src/cmd/aux/antiword/History - 644 sys sys 1069793864 1528
+1069799416 39 m sys/src/cmd/aux/antiword/Mozilla - 644 sys sys 1069793864 1983
+1069799416 40 m sys/src/cmd/aux/antiword/Mutt - 644 sys sys 1069793864 717
+1069799416 41 m sys/src/cmd/aux/antiword/Netscape - 644 sys sys 1069793864 4313
+1069799416 42 m sys/src/cmd/aux/antiword/QandA - 644 sys sys 1069793864 2709
+1069799416 43 m sys/src/cmd/aux/antiword/ReadMe - 644 sys sys 1069793864 3539
+1069799416 44 m sys/src/cmd/aux/antiword/antiword.1.txt - 644 sys sys 1069793865 4443
+1069799416 45 m sys/src/cmd/aux/antiword/antiword.h - 644 sys sys 1069793865 23228
+1069799416 46 m sys/src/cmd/aux/antiword/antiword.man - 644 sys sys 1069793865 5447
+1069799416 47 m sys/src/cmd/aux/antiword/antiword.php - 644 sys sys 1069793865 926
+1069799416 48 m sys/src/cmd/aux/antiword/asc85enc.c - 644 sys sys 1069793865 3910
+1069799416 49 m sys/src/cmd/aux/antiword/blocklist.c - 644 sys sys 1069793865 18691
+1069799416 50 m sys/src/cmd/aux/antiword/chartrans.c - 644 sys sys 1069793866 18395
+1069799416 51 m sys/src/cmd/aux/antiword/datalist.c - 644 sys sys 1069793866 8933
+1069799416 52 m sys/src/cmd/aux/antiword/debug.h - 644 sys sys 1069793866 2915
+1069799416 53 m sys/src/cmd/aux/antiword/depot.c - 644 sys sys 1069793866 2724
+1069799416 54 m sys/src/cmd/aux/antiword/dib2eps.c - 644 sys sys 1069793866 12146
+1069799416 55 m sys/src/cmd/aux/antiword/dib2sprt.c - 644 sys sys 1069793866 14217
+1069799416 56 m sys/src/cmd/aux/antiword/draw.c - 644 sys sys 1069793867 27039
+1069799416 57 m sys/src/cmd/aux/antiword/draw.h - 644 sys sys 1069793867 1012
+1069799416 58 m sys/src/cmd/aux/antiword/fail.c - 644 sys sys 1069793867 613
+1069799416 59 m sys/src/cmd/aux/antiword/fail.h - 644 sys sys 1069793867 401
+1069799416 60 m sys/src/cmd/aux/antiword/finddata.c - 644 sys sys 1069793867 3797
+1069799416 61 m sys/src/cmd/aux/antiword/findtext.c - 644 sys sys 1069793867 7654
+1069799416 62 m sys/src/cmd/aux/antiword/fontinfo.h - 644 sys sys 1069793868 126349
+1069799416 63 m sys/src/cmd/aux/antiword/fontinfo.pl - 755 sys sys 1069793868 7360
+1069799416 64 m sys/src/cmd/aux/antiword/fontlist.c - 644 sys sys 1069793868 4135
+1069799416 65 m sys/src/cmd/aux/antiword/fonts.c - 644 sys sys 1069793868 22217
+1069799416 66 m sys/src/cmd/aux/antiword/fonts_r.c - 644 sys sys 1069793869 5701
+1069799416 67 m sys/src/cmd/aux/antiword/fonts_u.c - 644 sys sys 1069793869 6964
+1069799416 68 m sys/src/cmd/aux/antiword/icons.c - 644 sys sys 1069793869 2328
+1069799416 69 m sys/src/cmd/aux/antiword/imgexam.c - 644 sys sys 1069793869 25704
+1069799416 70 m sys/src/cmd/aux/antiword/imgtrans.c - 644 sys sys 1069793869 1703
+1069799416 71 m sys/src/cmd/aux/antiword/jpeg2eps.c - 644 sys sys 1069793869 1482
+1069799416 72 m sys/src/cmd/aux/antiword/jpeg2sprt.c - 644 sys sys 1069793870 2159
+1069799416 73 m sys/src/cmd/aux/antiword/listlist.c - 644 sys sys 1069793870 7855
+1069799416 74 m sys/src/cmd/aux/antiword/main_r.c - 644 sys sys 1069793870 8346
+1069799416 75 m sys/src/cmd/aux/antiword/main_u.c - 644 sys sys 1069793870 7015
+1069799416 76 m sys/src/cmd/aux/antiword/misc.c - 644 sys sys 1069793870 15240
+1069799416 77 m sys/src/cmd/aux/antiword/mkfile - 644 sys sys 1069793871 943
+1069799416 78 m sys/src/cmd/aux/antiword/notes.c - 644 sys sys 1069793871 11146
+1069799416 79 m sys/src/cmd/aux/antiword/options.c - 644 sys sys 1069793871 20371
+1069799416 80 m sys/src/cmd/aux/antiword/out2window.c - 644 sys sys 1069793871 16844
+1069799416 81 m sys/src/cmd/aux/antiword/output.c - 644 sys sys 1069793871 9013
+1069799416 82 m sys/src/cmd/aux/antiword/pictlist.c - 644 sys sys 1069793872 2294
+1069799416 83 m sys/src/cmd/aux/antiword/png2eps.c - 644 sys sys 1069793872 4032
+1069799416 84 m sys/src/cmd/aux/antiword/png2sprt.c - 644 sys sys 1069793872 572
+1069799416 85 m sys/src/cmd/aux/antiword/postscript.c - 644 sys sys 1069793872 26420
+1069799416 86 m sys/src/cmd/aux/antiword/prop0.c - 644 sys sys 1069793872 9513
+1069799416 87 m sys/src/cmd/aux/antiword/prop2.c - 644 sys sys 1069793872 25584
+1069799416 88 m sys/src/cmd/aux/antiword/prop6.c - 644 sys sys 1069793873 26935
+1069799416 89 m sys/src/cmd/aux/antiword/prop8.c - 644 sys sys 1069793873 36372
+1069799416 90 m sys/src/cmd/aux/antiword/properties.c - 644 sys sys 1069793873 3874
+1069799416 91 m sys/src/cmd/aux/antiword/propmod.c - 644 sys sys 1069793873 2427
+1069799416 92 m sys/src/cmd/aux/antiword/riscos.c - 644 sys sys 1069793873 6885
+1069799416 93 m sys/src/cmd/aux/antiword/rowlist.c - 644 sys sys 1069793874 2842
+1069799416 94 m sys/src/cmd/aux/antiword/saveas.c - 644 sys sys 1069793874 8173
+1069799416 95 m sys/src/cmd/aux/antiword/sectlist.c - 644 sys sys 1069793874 2957
+1069799416 96 m sys/src/cmd/aux/antiword/startup.c - 644 sys sys 1069793874 3563
+1069799416 97 m sys/src/cmd/aux/antiword/stylelist.c - 644 sys sys 1069793874 11414
+1069799416 98 m sys/src/cmd/aux/antiword/stylesheet.c - 644 sys sys 1069793874 21419
+1069799416 99 m sys/src/cmd/aux/antiword/summary.c - 644 sys sys 1069793875 22128
+1069799416 100 m sys/src/cmd/aux/antiword/tabstop.c - 644 sys sys 1069793875 5442
+1069799416 101 m sys/src/cmd/aux/antiword/testdoc.doc - 644 sys sys 1069793875 23552
+1069799416 102 m sys/src/cmd/aux/antiword/text.c - 644 sys sys 1069793875 3892
+1069799416 103 m sys/src/cmd/aux/antiword/unix.c - 644 sys sys 1069793875 820
+1069799416 104 m sys/src/cmd/aux/antiword/utf8.c - 644 sys sys 1069793875 8491
+1069799416 105 m sys/src/cmd/aux/antiword/version.h - 644 sys sys 1069793876 614
+1069799416 106 m sys/src/cmd/aux/antiword/word2text.c - 644 sys sys 1069793876 30234
+1069799416 107 m sys/src/cmd/aux/antiword/wordconst.h - 644 sys sys 1069793876 11243
+1069799416 108 m sys/src/cmd/aux/antiword/worddos.c - 644 sys sys 1069793876 2700
+1069799416 109 m sys/src/cmd/aux/antiword/wordlib.c - 644 sys sys 1069793876 7850
+1069799416 110 m sys/src/cmd/aux/antiword/wordmac.c - 644 sys sys 1069793876 2256
+1069799416 111 m sys/src/cmd/aux/antiword/wordole.c - 644 sys sys 1069793877 21957
+1069799416 112 m sys/src/cmd/aux/antiword/wordtypes.h - 644 sys sys 1069793877 7489
+1069799416 113 m sys/src/cmd/aux/antiword/wordwin.c - 644 sys sys 1069793877 5447
+1069799416 114 m sys/src/cmd/aux/antiword/xmalloc.c - 644 sys sys 1069793877 2185
+1069799416 115 m sys/src/cmd/aux/antiword/xml.c - 644 sys sys 1069793877 30883
+1069801217 0 m sys/lib/antiword/8859-1.txt - 664 sys sys 1069793886 10592
+1069801217 1 m sys/lib/antiword/8859-10.txt - 664 sys sys 1069793886 10989
+1069801217 2 m sys/lib/antiword/8859-13.txt - 664 sys sys 1069793886 10588
+1069801217 3 m sys/lib/antiword/8859-14.txt - 664 sys sys 1069793886 11003
+1069801217 4 m sys/lib/antiword/8859-15.txt - 664 sys sys 1069793886 10583
+1069801217 5 m sys/lib/antiword/8859-16.txt - 664 sys sys 1069793886 10868
+1069801217 6 m sys/lib/antiword/8859-2.txt - 664 sys sys 1069793887 10816
+1069801217 7 m sys/lib/antiword/8859-3.txt - 664 sys sys 1069793887 10498
+1069801217 8 m sys/lib/antiword/8859-4.txt - 664 sys sys 1069793887 10792
+1069801217 9 m sys/lib/antiword/8859-5.txt - 664 sys sys 1069793887 10427
+1069801217 10 m sys/lib/antiword/8859-6.txt - 664 sys sys 1069793887 8308
+1069801217 11 m sys/lib/antiword/8859-7.txt - 664 sys sys 1069793888 10365
+1069801217 12 m sys/lib/antiword/8859-8.txt - 664 sys sys 1069793888 8553
+1069801217 13 m sys/lib/antiword/8859-9.txt - 664 sys sys 1069793888 10628
+1069801217 14 m sys/lib/antiword/Default - 664 sys sys 1069793888 3211
+1069801217 15 m sys/lib/antiword/Example - 664 sys sys 1069793888 3038
+1069801217 16 m sys/lib/antiword/MacRoman.txt - 664 sys sys 1069793889 14030
+1069801217 17 m sys/lib/antiword/UTF-8.txt - 664 sys sys 1069793889 107
+1069801217 18 m sys/lib/antiword/Unicode01 - 664 sys sys 1069793889 10858
+1069801217 19 m sys/lib/antiword/Unicode15 - 664 sys sys 1069793889 10818
+1069801217 20 m sys/lib/antiword/cp1250.txt - 664 sys sys 1069793889 9799
+1069801217 21 m sys/lib/antiword/cp1251.txt - 664 sys sys 1069793890 9474
+1069801217 22 m sys/lib/antiword/cp1252.txt - 664 sys sys 1069793890 9624
+1069801217 23 m sys/lib/antiword/cp437.txt - 664 sys sys 1069793890 9847
+1069801217 24 m sys/lib/antiword/cp850.txt - 664 sys sys 1069793890 9693
+1069801217 25 m sys/lib/antiword/cp852.txt - 664 sys sys 1069793890 9992
+1069801217 26 m sys/lib/antiword/cp862.txt - 664 sys sys 1069793891 9448
+1069801217 27 m sys/lib/antiword/cp866.txt - 664 sys sys 1069793891 9817
+1069801217 28 m sys/lib/antiword/fontnames - 664 sys sys 1069793891 4696
+1069801217 29 m sys/lib/antiword/fontnames.russian - 664 sys sys 1069793891 1565
+1069801217 30 m sys/lib/antiword/koi8-r.txt - 664 sys sys 1069793891 11204
+1069801217 31 m sys/lib/antiword/koi8-u.txt - 664 sys sys 1069793891 11259
+1069801217 32 m sys/lib/antiword/roman.txt - 664 sys sys 1069793892 14030
+1069801217 33 m sys/src/cmd/aux/antiword/COPYING - 664 sys sys 1069793863 17985
+1069801217 34 m sys/src/cmd/aux/antiword/ChangeLog - 664 sys sys 1069793863 7543
+1069801217 35 m sys/src/cmd/aux/antiword/Emacs - 664 sys sys 1069793863 4368
+1069801217 36 m sys/src/cmd/aux/antiword/Exmh - 664 sys sys 1069793863 463
+1069801217 37 m sys/src/cmd/aux/antiword/FAQ - 664 sys sys 1069793864 4682
+1069801217 38 m sys/src/cmd/aux/antiword/History - 664 sys sys 1069793864 1528
+1069801217 39 m sys/src/cmd/aux/antiword/Mozilla - 664 sys sys 1069793864 1983
+1069801217 40 m sys/src/cmd/aux/antiword/Mutt - 664 sys sys 1069793864 717
+1069801217 41 m sys/src/cmd/aux/antiword/Netscape - 664 sys sys 1069793864 4313
+1069801217 42 m sys/src/cmd/aux/antiword/QandA - 664 sys sys 1069793864 2709
+1069801217 43 m sys/src/cmd/aux/antiword/ReadMe - 664 sys sys 1069793864 3539
+1069801217 44 m sys/src/cmd/aux/antiword/antiword.1.txt - 664 sys sys 1069793865 4443
+1069801217 45 m sys/src/cmd/aux/antiword/antiword.h - 664 sys sys 1069793865 23228
+1069801217 46 m sys/src/cmd/aux/antiword/antiword.man - 664 sys sys 1069793865 5447
+1069801217 47 m sys/src/cmd/aux/antiword/antiword.php - 664 sys sys 1069793865 926
+1069801217 48 m sys/src/cmd/aux/antiword/asc85enc.c - 664 sys sys 1069793865 3910
+1069801217 49 m sys/src/cmd/aux/antiword/blocklist.c - 664 sys sys 1069793865 18691
+1069801217 50 m sys/src/cmd/aux/antiword/chartrans.c - 664 sys sys 1069793866 18395
+1069801217 51 m sys/src/cmd/aux/antiword/datalist.c - 664 sys sys 1069793866 8933
+1069801217 52 m sys/src/cmd/aux/antiword/debug.h - 664 sys sys 1069793866 2915
+1069801217 53 m sys/src/cmd/aux/antiword/depot.c - 664 sys sys 1069793866 2724
+1069801217 54 m sys/src/cmd/aux/antiword/dib2eps.c - 664 sys sys 1069793866 12146
+1069801217 55 m sys/src/cmd/aux/antiword/dib2sprt.c - 664 sys sys 1069793866 14217
+1069801217 56 m sys/src/cmd/aux/antiword/draw.c - 664 sys sys 1069793867 27039
+1069801217 57 m sys/src/cmd/aux/antiword/draw.h - 664 sys sys 1069793867 1012
+1069801217 58 m sys/src/cmd/aux/antiword/fail.c - 664 sys sys 1069793867 613
+1069801217 59 m sys/src/cmd/aux/antiword/fail.h - 664 sys sys 1069793867 401
+1069801217 60 m sys/src/cmd/aux/antiword/finddata.c - 664 sys sys 1069793867 3797
+1069801217 61 m sys/src/cmd/aux/antiword/findtext.c - 664 sys sys 1069793867 7654
+1069801217 62 m sys/src/cmd/aux/antiword/fontinfo.h - 664 sys sys 1069793868 126349
+1069801217 63 m sys/src/cmd/aux/antiword/fontinfo.pl - 664 sys sys 1069793868 7360
+1069801217 64 m sys/src/cmd/aux/antiword/fontlist.c - 664 sys sys 1069793868 4135
+1069801217 65 m sys/src/cmd/aux/antiword/fonts.c - 664 sys sys 1069793868 22217
+1069801217 66 m sys/src/cmd/aux/antiword/fonts_r.c - 664 sys sys 1069793869 5701
+1069801217 67 m sys/src/cmd/aux/antiword/fonts_u.c - 664 sys sys 1069793869 6964
+1069801217 68 m sys/src/cmd/aux/antiword/icons.c - 664 sys sys 1069793869 2328
+1069801217 69 m sys/src/cmd/aux/antiword/imgexam.c - 664 sys sys 1069793869 25704
+1069801217 70 m sys/src/cmd/aux/antiword/imgtrans.c - 664 sys sys 1069793869 1703
+1069801217 71 m sys/src/cmd/aux/antiword/jpeg2eps.c - 664 sys sys 1069793869 1482
+1069801217 72 m sys/src/cmd/aux/antiword/jpeg2sprt.c - 664 sys sys 1069793870 2159
+1069801217 73 m sys/src/cmd/aux/antiword/listlist.c - 664 sys sys 1069793870 7855
+1069801217 74 m sys/src/cmd/aux/antiword/main_r.c - 664 sys sys 1069793870 8346
+1069801217 75 m sys/src/cmd/aux/antiword/main_u.c - 664 sys sys 1069793870 7015
+1069801217 76 m sys/src/cmd/aux/antiword/misc.c - 664 sys sys 1069793870 15240
+1069801217 77 m sys/src/cmd/aux/antiword/mkfile - 664 sys sys 1069793871 943
+1069801217 78 m sys/src/cmd/aux/antiword/notes.c - 664 sys sys 1069793871 11146
+1069801217 79 m sys/src/cmd/aux/antiword/options.c - 664 sys sys 1069793871 20371
+1069801217 80 m sys/src/cmd/aux/antiword/out2window.c - 664 sys sys 1069793871 16844
+1069801217 81 m sys/src/cmd/aux/antiword/output.c - 664 sys sys 1069793871 9013
+1069801217 82 m sys/src/cmd/aux/antiword/pictlist.c - 664 sys sys 1069793872 2294
+1069801217 83 m sys/src/cmd/aux/antiword/png2eps.c - 664 sys sys 1069793872 4032
+1069801217 84 m sys/src/cmd/aux/antiword/png2sprt.c - 664 sys sys 1069793872 572
+1069801217 85 m sys/src/cmd/aux/antiword/postscript.c - 664 sys sys 1069793872 26420
+1069801217 86 m sys/src/cmd/aux/antiword/prop0.c - 664 sys sys 1069793872 9513
+1069801217 87 m sys/src/cmd/aux/antiword/prop2.c - 664 sys sys 1069793872 25584
+1069801217 88 m sys/src/cmd/aux/antiword/prop6.c - 664 sys sys 1069793873 26935
+1069801217 89 m sys/src/cmd/aux/antiword/prop8.c - 664 sys sys 1069793873 36372
+1069801217 90 m sys/src/cmd/aux/antiword/properties.c - 664 sys sys 1069793873 3874
+1069801217 91 m sys/src/cmd/aux/antiword/propmod.c - 664 sys sys 1069793873 2427
+1069801217 92 m sys/src/cmd/aux/antiword/riscos.c - 664 sys sys 1069793873 6885
+1069801217 93 m sys/src/cmd/aux/antiword/rowlist.c - 664 sys sys 1069793874 2842
+1069801217 94 m sys/src/cmd/aux/antiword/saveas.c - 664 sys sys 1069793874 8173
+1069801217 95 m sys/src/cmd/aux/antiword/sectlist.c - 664 sys sys 1069793874 2957
+1069801217 96 m sys/src/cmd/aux/antiword/startup.c - 664 sys sys 1069793874 3563
+1069801217 97 m sys/src/cmd/aux/antiword/stylelist.c - 664 sys sys 1069793874 11414
+1069801217 98 m sys/src/cmd/aux/antiword/stylesheet.c - 664 sys sys 1069793874 21419
+1069801217 99 m sys/src/cmd/aux/antiword/summary.c - 664 sys sys 1069793875 22128
+1069801217 100 m sys/src/cmd/aux/antiword/tabstop.c - 664 sys sys 1069793875 5442
+1069801217 101 m sys/src/cmd/aux/antiword/testdoc.doc - 664 sys sys 1069793875 23552
+1069801217 102 m sys/src/cmd/aux/antiword/text.c - 664 sys sys 1069793875 3892
+1069801217 103 m sys/src/cmd/aux/antiword/unix.c - 664 sys sys 1069793875 820
+1069801217 104 m sys/src/cmd/aux/antiword/utf8.c - 664 sys sys 1069793875 8491
+1069801217 105 m sys/src/cmd/aux/antiword/version.h - 664 sys sys 1069793876 614
+1069801217 106 m sys/src/cmd/aux/antiword/word2text.c - 664 sys sys 1069793876 30234
+1069801217 107 m sys/src/cmd/aux/antiword/wordconst.h - 664 sys sys 1069793876 11243
+1069801217 108 m sys/src/cmd/aux/antiword/worddos.c - 664 sys sys 1069793876 2700
+1069801217 109 m sys/src/cmd/aux/antiword/wordlib.c - 664 sys sys 1069793876 7850
+1069801217 110 m sys/src/cmd/aux/antiword/wordmac.c - 664 sys sys 1069793876 2256
+1069801217 111 m sys/src/cmd/aux/antiword/wordole.c - 664 sys sys 1069793877 21957
+1069801217 112 m sys/src/cmd/aux/antiword/wordtypes.h - 664 sys sys 1069793877 7489
+1069801217 113 m sys/src/cmd/aux/antiword/wordwin.c - 664 sys sys 1069793877 5447
+1069801217 114 m sys/src/cmd/aux/antiword/xmalloc.c - 664 sys sys 1069793877 2185
+1069801217 115 m sys/src/cmd/aux/antiword/xml.c - 664 sys sys 1069793877 30883
+1069815619 0 c sys/src/cmd/unix/u9fs/u9fs.c - 664 sys sys 1069814541 30917
+1069819220 0 c sys/src/cmd/disk/mkext.c - 664 sys sys 1069818199 5500
+1069819220 1 c sys/src/cmd/fossil/9p.c - 664 sys sys 1069818231 21498

+ 1 - 0
lib/face/48x48x4/.dict

@@ -74,6 +74,7 @@ lanl.gov/andrey a/andrey.1
 lanl.gov/dpx d/dpx.1
 lanl.gov/rminnich r/rminnich.1
 microsoft.com/cwf c/cwf.1
+mightycheese.com/rob r/rob.1
 mit.edu/rsc r/rsc.1
 morphisms.net/rsc r/rsc.1
 morphisms.net/wkj w/wkj.1

+ 16 - 0
rc/bin/doc2ps

@@ -0,0 +1,16 @@
+#!/bin/rc
+rfork e
+if(! ~ $#* 0 1 && ~ $1 -*){
+	echo 'usage: doc2ps file.doc' >[1=2]
+	exit usage
+}
+file=$1
+if(~ $#* 0){
+	file=/tmp/antiword.doc.$pid
+	cat >$file
+}
+aux/antiword -i0 -p letter $file 
+s=$status
+if(~ $#* 0)
+	rm -f $file
+exit $status

+ 303 - 0
sys/lib/antiword/8859-1.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             ISO/IEC 8859-1:1998 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-1:1998 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-1 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-1 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x00A1	#	INVERTED EXCLAMATION MARK
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x00A5	#	YEN SIGN
+0xA6	0x00A6	#	BROKEN BAR
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x00AA	#	FEMININE ORDINAL INDICATOR
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x00BA	#	MASCULINE ORDINAL INDICATOR
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x00BC	#	VULGAR FRACTION ONE QUARTER
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBE	0x00BE	#	VULGAR FRACTION THREE QUARTERS
+0xBF	0x00BF	#	INVERTED QUESTION MARK
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x00D0	#	LATIN CAPITAL LETTER ETH (Icelandic)
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x00DE	#	LATIN CAPITAL LETTER THORN (Icelandic)
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S (German)
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x00F0	#	LATIN SMALL LETTER ETH (Icelandic)
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x00FE	#	LATIN SMALL LETTER THORN (Icelandic)
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS

+ 303 - 0
sys/lib/antiword/8859-10.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             ISO/IEC 8859-10:1998 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.1
+#	Table format:     Format A
+#	Date:             1999 October 11
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-10:1998 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-10 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-10 order.
+#
+#	Version history
+#	1.0 version new.
+#       1.1 corrected mistake in mapping of 0xA4
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x0104	#	LATIN CAPITAL LETTER A WITH OGONEK
+0xA2	0x0112	#	LATIN CAPITAL LETTER E WITH MACRON
+0xA3	0x0122	#	LATIN CAPITAL LETTER G WITH CEDILLA
+0xA4	0x012A	#	LATIN CAPITAL LETTER I WITH MACRON
+0xA5	0x0128	#	LATIN CAPITAL LETTER I WITH TILDE
+0xA6	0x0136	#	LATIN CAPITAL LETTER K WITH CEDILLA
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x013B	#	LATIN CAPITAL LETTER L WITH CEDILLA
+0xA9	0x0110	#	LATIN CAPITAL LETTER D WITH STROKE
+0xAA	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xAB	0x0166	#	LATIN CAPITAL LETTER T WITH STROKE
+0xAC	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x016A	#	LATIN CAPITAL LETTER U WITH MACRON
+0xAF	0x014A	#	LATIN CAPITAL LETTER ENG
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x0105	#	LATIN SMALL LETTER A WITH OGONEK
+0xB2	0x0113	#	LATIN SMALL LETTER E WITH MACRON
+0xB3	0x0123	#	LATIN SMALL LETTER G WITH CEDILLA
+0xB4	0x012B	#	LATIN SMALL LETTER I WITH MACRON
+0xB5	0x0129	#	LATIN SMALL LETTER I WITH TILDE
+0xB6	0x0137	#	LATIN SMALL LETTER K WITH CEDILLA
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x013C	#	LATIN SMALL LETTER L WITH CEDILLA
+0xB9	0x0111	#	LATIN SMALL LETTER D WITH STROKE
+0xBA	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xBB	0x0167	#	LATIN SMALL LETTER T WITH STROKE
+0xBC	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xBD	0x2015	#	HORIZONTAL BAR
+0xBE	0x016B	#	LATIN SMALL LETTER U WITH MACRON
+0xBF	0x014B	#	LATIN SMALL LETTER ENG
+0xC0	0x0100	#	LATIN CAPITAL LETTER A WITH MACRON
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x012E	#	LATIN CAPITAL LETTER I WITH OGONEK
+0xC8	0x010C	#	LATIN CAPITAL LETTER C WITH CARON
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x0118	#	LATIN CAPITAL LETTER E WITH OGONEK
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x0116	#	LATIN CAPITAL LETTER E WITH DOT ABOVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x00D0	#	LATIN CAPITAL LETTER ETH (Icelandic)
+0xD1	0x0145	#	LATIN CAPITAL LETTER N WITH CEDILLA
+0xD2	0x014C	#	LATIN CAPITAL LETTER O WITH MACRON
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x0168	#	LATIN CAPITAL LETTER U WITH TILDE
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x0172	#	LATIN CAPITAL LETTER U WITH OGONEK
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x00DE	#	LATIN CAPITAL LETTER THORN (Icelandic)
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S (German)
+0xE0	0x0101	#	LATIN SMALL LETTER A WITH MACRON
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x012F	#	LATIN SMALL LETTER I WITH OGONEK
+0xE8	0x010D	#	LATIN SMALL LETTER C WITH CARON
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x0119	#	LATIN SMALL LETTER E WITH OGONEK
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x0117	#	LATIN SMALL LETTER E WITH DOT ABOVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x00F0	#	LATIN SMALL LETTER ETH (Icelandic)
+0xF1	0x0146	#	LATIN SMALL LETTER N WITH CEDILLA
+0xF2	0x014D	#	LATIN SMALL LETTER O WITH MACRON
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x0169	#	LATIN SMALL LETTER U WITH TILDE
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x0173	#	LATIN SMALL LETTER U WITH OGONEK
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x00FE	#	LATIN SMALL LETTER THORN (Icelandic)
+0xFF	0x0138	#	LATIN SMALL LETTER KRA

+ 299 - 0
sys/lib/antiword/8859-13.txt

@@ -0,0 +1,299 @@
+#
+#	Name:             ISO/IEC 8859-13:1998  to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1998 - 1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-13:1998 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-13 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-13 order.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x201D	#	RIGHT DOUBLE QUOTATION MARK
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x201E	#	DOUBLE LOW-9 QUOTATION MARK
+0xA6	0x00A6	#	BROKEN BAR
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x0156	#	LATIN CAPITAL LETTER R WITH CEDILLA
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00C6	#	LATIN CAPITAL LETTER AE
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x201C	#	LEFT DOUBLE QUOTATION MARK
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x0157	#	LATIN SMALL LETTER R WITH CEDILLA
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x00BC	#	VULGAR FRACTION ONE QUARTER
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBE	0x00BE	#	VULGAR FRACTION THREE QUARTERS
+0xBF	0x00E6	#	LATIN SMALL LETTER AE
+0xC0	0x0104	#	LATIN CAPITAL LETTER A WITH OGONEK
+0xC1	0x012E	#	LATIN CAPITAL LETTER I WITH OGONEK
+0xC2	0x0100	#	LATIN CAPITAL LETTER A WITH MACRON
+0xC3	0x0106	#	LATIN CAPITAL LETTER C WITH ACUTE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x0118	#	LATIN CAPITAL LETTER E WITH OGONEK
+0xC7	0x0112	#	LATIN CAPITAL LETTER E WITH MACRON
+0xC8	0x010C	#	LATIN CAPITAL LETTER C WITH CARON
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x0179	#	LATIN CAPITAL LETTER Z WITH ACUTE
+0xCB	0x0116	#	LATIN CAPITAL LETTER E WITH DOT ABOVE
+0xCC	0x0122	#	LATIN CAPITAL LETTER G WITH CEDILLA
+0xCD	0x0136	#	LATIN CAPITAL LETTER K WITH CEDILLA
+0xCE	0x012A	#	LATIN CAPITAL LETTER I WITH MACRON
+0xCF	0x013B	#	LATIN CAPITAL LETTER L WITH CEDILLA
+0xD0	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xD1	0x0143	#	LATIN CAPITAL LETTER N WITH ACUTE
+0xD2	0x0145	#	LATIN CAPITAL LETTER N WITH CEDILLA
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x014C	#	LATIN CAPITAL LETTER O WITH MACRON
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x0172	#	LATIN CAPITAL LETTER U WITH OGONEK
+0xD9	0x0141	#	LATIN CAPITAL LETTER L WITH STROKE
+0xDA	0x015A	#	LATIN CAPITAL LETTER S WITH ACUTE
+0xDB	0x016A	#	LATIN CAPITAL LETTER U WITH MACRON
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x017B	#	LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xDE	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S (German)
+0xE0	0x0105	#	LATIN SMALL LETTER A WITH OGONEK
+0xE1	0x012F	#	LATIN SMALL LETTER I WITH OGONEK
+0xE2	0x0101	#	LATIN SMALL LETTER A WITH MACRON
+0xE3	0x0107	#	LATIN SMALL LETTER C WITH ACUTE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x0119	#	LATIN SMALL LETTER E WITH OGONEK
+0xE7	0x0113	#	LATIN SMALL LETTER E WITH MACRON
+0xE8	0x010D	#	LATIN SMALL LETTER C WITH CARON
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x017A	#	LATIN SMALL LETTER Z WITH ACUTE
+0xEB	0x0117	#	LATIN SMALL LETTER E WITH DOT ABOVE
+0xEC	0x0123	#	LATIN SMALL LETTER G WITH CEDILLA
+0xED	0x0137	#	LATIN SMALL LETTER K WITH CEDILLA
+0xEE	0x012B	#	LATIN SMALL LETTER I WITH MACRON
+0xEF	0x013C	#	LATIN SMALL LETTER L WITH CEDILLA
+0xF0	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xF1	0x0144	#	LATIN SMALL LETTER N WITH ACUTE
+0xF2	0x0146	#	LATIN SMALL LETTER N WITH CEDILLA
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x014D	#	LATIN SMALL LETTER O WITH MACRON
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x0173	#	LATIN SMALL LETTER U WITH OGONEK
+0xF9	0x0142	#	LATIN SMALL LETTER L WITH STROKE
+0xFA	0x015B	#	LATIN SMALL LETTER S WITH ACUTE
+0xFB	0x016B	#	LATIN SMALL LETTER U WITH MACRON
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x017C	#	LATIN SMALL LETTER Z WITH DOT ABOVE
+0xFE	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xFF	0x2019	#	RIGHT SINGLE QUOTATION MARK

+ 301 - 0
sys/lib/antiword/8859-14.txt

@@ -0,0 +1,301 @@
+#
+#	Name:             ISO/IEC 8859-14:1998 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Markus Kuhn <mkuhn@acm.org>
+#			  Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1998 - 1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-14:1998 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-14 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-14 order.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x1E02	#	LATIN CAPITAL LETTER B WITH DOT ABOVE
+0xA2	0x1E03	#	LATIN SMALL LETTER B WITH DOT ABOVE
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x010A	#	LATIN CAPITAL LETTER C WITH DOT ABOVE
+0xA5	0x010B	#	LATIN SMALL LETTER C WITH DOT ABOVE
+0xA6	0x1E0A	#	LATIN CAPITAL LETTER D WITH DOT ABOVE
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x1E80	#	LATIN CAPITAL LETTER W WITH GRAVE
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x1E82	#	LATIN CAPITAL LETTER W WITH ACUTE
+0xAB	0x1E0B	#	LATIN SMALL LETTER D WITH DOT ABOVE
+0xAC	0x1EF2	#	LATIN CAPITAL LETTER Y WITH GRAVE
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x0178	#	LATIN CAPITAL LETTER Y WITH DIAERESIS
+0xB0	0x1E1E	#	LATIN CAPITAL LETTER F WITH DOT ABOVE
+0xB1	0x1E1F	#	LATIN SMALL LETTER F WITH DOT ABOVE
+0xB2	0x0120	#	LATIN CAPITAL LETTER G WITH DOT ABOVE
+0xB3	0x0121	#	LATIN SMALL LETTER G WITH DOT ABOVE
+0xB4	0x1E40	#	LATIN CAPITAL LETTER M WITH DOT ABOVE
+0xB5	0x1E41	#	LATIN SMALL LETTER M WITH DOT ABOVE
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x1E56	#	LATIN CAPITAL LETTER P WITH DOT ABOVE
+0xB8	0x1E81	#	LATIN SMALL LETTER W WITH GRAVE
+0xB9	0x1E57	#	LATIN SMALL LETTER P WITH DOT ABOVE
+0xBA	0x1E83	#	LATIN SMALL LETTER W WITH ACUTE
+0xBB	0x1E60	#	LATIN CAPITAL LETTER S WITH DOT ABOVE
+0xBC	0x1EF3	#	LATIN SMALL LETTER Y WITH GRAVE
+0xBD	0x1E84	#	LATIN CAPITAL LETTER W WITH DIAERESIS
+0xBE	0x1E85	#	LATIN SMALL LETTER W WITH DIAERESIS
+0xBF	0x1E61	#	LATIN SMALL LETTER S WITH DOT ABOVE
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x0174	#	LATIN CAPITAL LETTER W WITH CIRCUMFLEX
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x1E6A	#	LATIN CAPITAL LETTER T WITH DOT ABOVE
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x0176	#	LATIN CAPITAL LETTER Y WITH CIRCUMFLEX
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x0175	#	LATIN SMALL LETTER W WITH CIRCUMFLEX
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x1E6B	#	LATIN SMALL LETTER T WITH DOT ABOVE
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x0177	#	LATIN SMALL LETTER Y WITH CIRCUMFLEX
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS
+

+ 303 - 0
sys/lib/antiword/8859-15.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             ISO/IEC 8859-15:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Markus Kuhn <mkuhn@acm.org>
+#			  Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1998 - 1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-15:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-15 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-15 order.
+#
+#	Version history
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x00A1	#	INVERTED EXCLAMATION MARK
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x20AC	#	EURO SIGN
+0xA5	0x00A5	#	YEN SIGN
+0xA6	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x00AA	#	FEMININE ORDINAL INDICATOR
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x00BA	#	MASCULINE ORDINAL INDICATOR
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x0152	#	LATIN CAPITAL LIGATURE OE
+0xBD	0x0153	#	LATIN SMALL LIGATURE OE
+0xBE	0x0178	#	LATIN CAPITAL LETTER Y WITH DIAERESIS
+0xBF	0x00BF	#	INVERTED QUESTION MARK
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x00D0	#	LATIN CAPITAL LETTER ETH
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x00DE	#	LATIN CAPITAL LETTER THORN
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x00F0	#	LATIN SMALL LETTER ETH
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x00FE	#	LATIN SMALL LETTER THORN
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS
+

+ 299 - 0
sys/lib/antiword/8859-16.txt

@@ -0,0 +1,299 @@
+#
+#	Name:             ISO/IEC 8859-16:2001 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             2001 July 26
+#	Authors:          Markus Kuhn <mkuhn@acm.org>
+#
+#	Copyright (c) 1999-2001 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-16:2001 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-16 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-16 order.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x0104	#	LATIN CAPITAL LETTER A WITH OGONEK
+0xA2	0x0105	#	LATIN SMALL LETTER A WITH OGONEK
+0xA3	0x0141	#	LATIN CAPITAL LETTER L WITH STROKE
+0xA4	0x20AC	#	EURO SIGN
+0xA5	0x201E	#	DOUBLE LOW-9 QUOTATION MARK
+0xA6	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x0218	#	LATIN CAPITAL LETTER S WITH COMMA BELOW
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x0179	#	LATIN CAPITAL LETTER Z WITH ACUTE
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x017A	#	LATIN SMALL LETTER Z WITH ACUTE
+0xAF	0x017B	#	LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x010C	#	LATIN CAPITAL LETTER C WITH CARON
+0xB3	0x0142	#	LATIN SMALL LETTER L WITH STROKE
+0xB4	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xB5	0x201D	#	RIGHT DOUBLE QUOTATION MARK
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xB9	0x010D	#	LATIN SMALL LETTER C WITH CARON
+0xBA	0x0219	#	LATIN SMALL LETTER S WITH COMMA BELOW
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x0152	#	LATIN CAPITAL LIGATURE OE
+0xBD	0x0153	#	LATIN SMALL LIGATURE OE
+0xBE	0x0178	#	LATIN CAPITAL LETTER Y WITH DIAERESIS
+0xBF	0x017C	#	LATIN SMALL LETTER Z WITH DOT ABOVE
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x0102	#	LATIN CAPITAL LETTER A WITH BREVE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x0106	#	LATIN CAPITAL LETTER C WITH ACUTE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x0110	#	LATIN CAPITAL LETTER D WITH STROKE
+0xD1	0x0143	#	LATIN CAPITAL LETTER N WITH ACUTE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x0150	#	LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x015A	#	LATIN CAPITAL LETTER S WITH ACUTE
+0xD8	0x0170	#	LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x0118	#	LATIN CAPITAL LETTER E WITH OGONEK
+0xDE	0x021A	#	LATIN CAPITAL LETTER T WITH COMMA BELOW
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x0103	#	LATIN SMALL LETTER A WITH BREVE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x0107	#	LATIN SMALL LETTER C WITH ACUTE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x0111	#	LATIN SMALL LETTER D WITH STROKE
+0xF1	0x0144	#	LATIN SMALL LETTER N WITH ACUTE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x0151	#	LATIN SMALL LETTER O WITH DOUBLE ACUTE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x015B	#	LATIN SMALL LETTER S WITH ACUTE
+0xF8	0x0171	#	LATIN SMALL LETTER U WITH DOUBLE ACUTE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x0119	#	LATIN SMALL LETTER E WITH OGONEK
+0xFE	0x021B	#	LATIN SMALL LETTER T WITH COMMA BELOW
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS

+ 303 - 0
sys/lib/antiword/8859-2.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             ISO 8859-2:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-2:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-2 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-2 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x0104	#	LATIN CAPITAL LETTER A WITH OGONEK
+0xA2	0x02D8	#	BREVE
+0xA3	0x0141	#	LATIN CAPITAL LETTER L WITH STROKE
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x013D	#	LATIN CAPITAL LETTER L WITH CARON
+0xA6	0x015A	#	LATIN CAPITAL LETTER S WITH ACUTE
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xAA	0x015E	#	LATIN CAPITAL LETTER S WITH CEDILLA
+0xAB	0x0164	#	LATIN CAPITAL LETTER T WITH CARON
+0xAC	0x0179	#	LATIN CAPITAL LETTER Z WITH ACUTE
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xAF	0x017B	#	LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x0105	#	LATIN SMALL LETTER A WITH OGONEK
+0xB2	0x02DB	#	OGONEK
+0xB3	0x0142	#	LATIN SMALL LETTER L WITH STROKE
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x013E	#	LATIN SMALL LETTER L WITH CARON
+0xB6	0x015B	#	LATIN SMALL LETTER S WITH ACUTE
+0xB7	0x02C7	#	CARON
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xBA	0x015F	#	LATIN SMALL LETTER S WITH CEDILLA
+0xBB	0x0165	#	LATIN SMALL LETTER T WITH CARON
+0xBC	0x017A	#	LATIN SMALL LETTER Z WITH ACUTE
+0xBD	0x02DD	#	DOUBLE ACUTE ACCENT
+0xBE	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xBF	0x017C	#	LATIN SMALL LETTER Z WITH DOT ABOVE
+0xC0	0x0154	#	LATIN CAPITAL LETTER R WITH ACUTE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x0102	#	LATIN CAPITAL LETTER A WITH BREVE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x0139	#	LATIN CAPITAL LETTER L WITH ACUTE
+0xC6	0x0106	#	LATIN CAPITAL LETTER C WITH ACUTE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x010C	#	LATIN CAPITAL LETTER C WITH CARON
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x0118	#	LATIN CAPITAL LETTER E WITH OGONEK
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x011A	#	LATIN CAPITAL LETTER E WITH CARON
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x010E	#	LATIN CAPITAL LETTER D WITH CARON
+0xD0	0x0110	#	LATIN CAPITAL LETTER D WITH STROKE
+0xD1	0x0143	#	LATIN CAPITAL LETTER N WITH ACUTE
+0xD2	0x0147	#	LATIN CAPITAL LETTER N WITH CARON
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x0150	#	LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x0158	#	LATIN CAPITAL LETTER R WITH CARON
+0xD9	0x016E	#	LATIN CAPITAL LETTER U WITH RING ABOVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x0170	#	LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x0162	#	LATIN CAPITAL LETTER T WITH CEDILLA
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x0155	#	LATIN SMALL LETTER R WITH ACUTE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x0103	#	LATIN SMALL LETTER A WITH BREVE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x013A	#	LATIN SMALL LETTER L WITH ACUTE
+0xE6	0x0107	#	LATIN SMALL LETTER C WITH ACUTE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x010D	#	LATIN SMALL LETTER C WITH CARON
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x0119	#	LATIN SMALL LETTER E WITH OGONEK
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x011B	#	LATIN SMALL LETTER E WITH CARON
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x010F	#	LATIN SMALL LETTER D WITH CARON
+0xF0	0x0111	#	LATIN SMALL LETTER D WITH STROKE
+0xF1	0x0144	#	LATIN SMALL LETTER N WITH ACUTE
+0xF2	0x0148	#	LATIN SMALL LETTER N WITH CARON
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x0151	#	LATIN SMALL LETTER O WITH DOUBLE ACUTE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x0159	#	LATIN SMALL LETTER R WITH CARON
+0xF9	0x016F	#	LATIN SMALL LETTER U WITH RING ABOVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x0171	#	LATIN SMALL LETTER U WITH DOUBLE ACUTE
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x0163	#	LATIN SMALL LETTER T WITH CEDILLA
+0xFF	0x02D9	#	DOT ABOVE

+ 296 - 0
sys/lib/antiword/8859-3.txt

@@ -0,0 +1,296 @@
+#
+#	Name:             ISO/IEC 8859-3:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-3:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-3 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-3 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x0126	#	LATIN CAPITAL LETTER H WITH STROKE
+0xA2	0x02D8	#	BREVE
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA6	0x0124	#	LATIN CAPITAL LETTER H WITH CIRCUMFLEX
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x0130	#	LATIN CAPITAL LETTER I WITH DOT ABOVE
+0xAA	0x015E	#	LATIN CAPITAL LETTER S WITH CEDILLA
+0xAB	0x011E	#	LATIN CAPITAL LETTER G WITH BREVE
+0xAC	0x0134	#	LATIN CAPITAL LETTER J WITH CIRCUMFLEX
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAF	0x017B	#	LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x0127	#	LATIN SMALL LETTER H WITH STROKE
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x0125	#	LATIN SMALL LETTER H WITH CIRCUMFLEX
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x0131	#	LATIN SMALL LETTER DOTLESS I
+0xBA	0x015F	#	LATIN SMALL LETTER S WITH CEDILLA
+0xBB	0x011F	#	LATIN SMALL LETTER G WITH BREVE
+0xBC	0x0135	#	LATIN SMALL LETTER J WITH CIRCUMFLEX
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBF	0x017C	#	LATIN SMALL LETTER Z WITH DOT ABOVE
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x010A	#	LATIN CAPITAL LETTER C WITH DOT ABOVE
+0xC6	0x0108	#	LATIN CAPITAL LETTER C WITH CIRCUMFLEX
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x0120	#	LATIN CAPITAL LETTER G WITH DOT ABOVE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x011C	#	LATIN CAPITAL LETTER G WITH CIRCUMFLEX
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x016C	#	LATIN CAPITAL LETTER U WITH BREVE
+0xDE	0x015C	#	LATIN CAPITAL LETTER S WITH CIRCUMFLEX
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x010B	#	LATIN SMALL LETTER C WITH DOT ABOVE
+0xE6	0x0109	#	LATIN SMALL LETTER C WITH CIRCUMFLEX
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x0121	#	LATIN SMALL LETTER G WITH DOT ABOVE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x011D	#	LATIN SMALL LETTER G WITH CIRCUMFLEX
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x016D	#	LATIN SMALL LETTER U WITH BREVE
+0xFE	0x015D	#	LATIN SMALL LETTER S WITH CIRCUMFLEX
+0xFF	0x02D9	#	DOT ABOVE

+ 303 - 0
sys/lib/antiword/8859-4.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             ISO/IEC 8859-4:1998 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-4:1998 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-4 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-4 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x0104	#	LATIN CAPITAL LETTER A WITH OGONEK
+0xA2	0x0138	#	LATIN SMALL LETTER KRA
+0xA3	0x0156	#	LATIN CAPITAL LETTER R WITH CEDILLA
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x0128	#	LATIN CAPITAL LETTER I WITH TILDE
+0xA6	0x013B	#	LATIN CAPITAL LETTER L WITH CEDILLA
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xAA	0x0112	#	LATIN CAPITAL LETTER E WITH MACRON
+0xAB	0x0122	#	LATIN CAPITAL LETTER G WITH CEDILLA
+0xAC	0x0166	#	LATIN CAPITAL LETTER T WITH STROKE
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x0105	#	LATIN SMALL LETTER A WITH OGONEK
+0xB2	0x02DB	#	OGONEK
+0xB3	0x0157	#	LATIN SMALL LETTER R WITH CEDILLA
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x0129	#	LATIN SMALL LETTER I WITH TILDE
+0xB6	0x013C	#	LATIN SMALL LETTER L WITH CEDILLA
+0xB7	0x02C7	#	CARON
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xBA	0x0113	#	LATIN SMALL LETTER E WITH MACRON
+0xBB	0x0123	#	LATIN SMALL LETTER G WITH CEDILLA
+0xBC	0x0167	#	LATIN SMALL LETTER T WITH STROKE
+0xBD	0x014A	#	LATIN CAPITAL LETTER ENG
+0xBE	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xBF	0x014B	#	LATIN SMALL LETTER ENG
+0xC0	0x0100	#	LATIN CAPITAL LETTER A WITH MACRON
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x012E	#	LATIN CAPITAL LETTER I WITH OGONEK
+0xC8	0x010C	#	LATIN CAPITAL LETTER C WITH CARON
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x0118	#	LATIN CAPITAL LETTER E WITH OGONEK
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x0116	#	LATIN CAPITAL LETTER E WITH DOT ABOVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x012A	#	LATIN CAPITAL LETTER I WITH MACRON
+0xD0	0x0110	#	LATIN CAPITAL LETTER D WITH STROKE
+0xD1	0x0145	#	LATIN CAPITAL LETTER N WITH CEDILLA
+0xD2	0x014C	#	LATIN CAPITAL LETTER O WITH MACRON
+0xD3	0x0136	#	LATIN CAPITAL LETTER K WITH CEDILLA
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x0172	#	LATIN CAPITAL LETTER U WITH OGONEK
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x0168	#	LATIN CAPITAL LETTER U WITH TILDE
+0xDE	0x016A	#	LATIN CAPITAL LETTER U WITH MACRON
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x0101	#	LATIN SMALL LETTER A WITH MACRON
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x012F	#	LATIN SMALL LETTER I WITH OGONEK
+0xE8	0x010D	#	LATIN SMALL LETTER C WITH CARON
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x0119	#	LATIN SMALL LETTER E WITH OGONEK
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x0117	#	LATIN SMALL LETTER E WITH DOT ABOVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x012B	#	LATIN SMALL LETTER I WITH MACRON
+0xF0	0x0111	#	LATIN SMALL LETTER D WITH STROKE
+0xF1	0x0146	#	LATIN SMALL LETTER N WITH CEDILLA
+0xF2	0x014D	#	LATIN SMALL LETTER O WITH MACRON
+0xF3	0x0137	#	LATIN SMALL LETTER K WITH CEDILLA
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x0173	#	LATIN SMALL LETTER U WITH OGONEK
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x0169	#	LATIN SMALL LETTER U WITH TILDE
+0xFE	0x016B	#	LATIN SMALL LETTER U WITH MACRON
+0xFF	0x02D9	#	DOT ABOVE

+ 303 - 0
sys/lib/antiword/8859-5.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             ISO 8859-5:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-5:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-5 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-5 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x0401	#	CYRILLIC CAPITAL LETTER IO
+0xA2	0x0402	#	CYRILLIC CAPITAL LETTER DJE
+0xA3	0x0403	#	CYRILLIC CAPITAL LETTER GJE
+0xA4	0x0404	#	CYRILLIC CAPITAL LETTER UKRAINIAN IE
+0xA5	0x0405	#	CYRILLIC CAPITAL LETTER DZE
+0xA6	0x0406	#	CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+0xA7	0x0407	#	CYRILLIC CAPITAL LETTER YI
+0xA8	0x0408	#	CYRILLIC CAPITAL LETTER JE
+0xA9	0x0409	#	CYRILLIC CAPITAL LETTER LJE
+0xAA	0x040A	#	CYRILLIC CAPITAL LETTER NJE
+0xAB	0x040B	#	CYRILLIC CAPITAL LETTER TSHE
+0xAC	0x040C	#	CYRILLIC CAPITAL LETTER KJE
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x040E	#	CYRILLIC CAPITAL LETTER SHORT U
+0xAF	0x040F	#	CYRILLIC CAPITAL LETTER DZHE
+0xB0	0x0410	#	CYRILLIC CAPITAL LETTER A
+0xB1	0x0411	#	CYRILLIC CAPITAL LETTER BE
+0xB2	0x0412	#	CYRILLIC CAPITAL LETTER VE
+0xB3	0x0413	#	CYRILLIC CAPITAL LETTER GHE
+0xB4	0x0414	#	CYRILLIC CAPITAL LETTER DE
+0xB5	0x0415	#	CYRILLIC CAPITAL LETTER IE
+0xB6	0x0416	#	CYRILLIC CAPITAL LETTER ZHE
+0xB7	0x0417	#	CYRILLIC CAPITAL LETTER ZE
+0xB8	0x0418	#	CYRILLIC CAPITAL LETTER I
+0xB9	0x0419	#	CYRILLIC CAPITAL LETTER SHORT I
+0xBA	0x041A	#	CYRILLIC CAPITAL LETTER KA
+0xBB	0x041B	#	CYRILLIC CAPITAL LETTER EL
+0xBC	0x041C	#	CYRILLIC CAPITAL LETTER EM
+0xBD	0x041D	#	CYRILLIC CAPITAL LETTER EN
+0xBE	0x041E	#	CYRILLIC CAPITAL LETTER O
+0xBF	0x041F	#	CYRILLIC CAPITAL LETTER PE
+0xC0	0x0420	#	CYRILLIC CAPITAL LETTER ER
+0xC1	0x0421	#	CYRILLIC CAPITAL LETTER ES
+0xC2	0x0422	#	CYRILLIC CAPITAL LETTER TE
+0xC3	0x0423	#	CYRILLIC CAPITAL LETTER U
+0xC4	0x0424	#	CYRILLIC CAPITAL LETTER EF
+0xC5	0x0425	#	CYRILLIC CAPITAL LETTER HA
+0xC6	0x0426	#	CYRILLIC CAPITAL LETTER TSE
+0xC7	0x0427	#	CYRILLIC CAPITAL LETTER CHE
+0xC8	0x0428	#	CYRILLIC CAPITAL LETTER SHA
+0xC9	0x0429	#	CYRILLIC CAPITAL LETTER SHCHA
+0xCA	0x042A	#	CYRILLIC CAPITAL LETTER HARD SIGN
+0xCB	0x042B	#	CYRILLIC CAPITAL LETTER YERU
+0xCC	0x042C	#	CYRILLIC CAPITAL LETTER SOFT SIGN
+0xCD	0x042D	#	CYRILLIC CAPITAL LETTER E
+0xCE	0x042E	#	CYRILLIC CAPITAL LETTER YU
+0xCF	0x042F	#	CYRILLIC CAPITAL LETTER YA
+0xD0	0x0430	#	CYRILLIC SMALL LETTER A
+0xD1	0x0431	#	CYRILLIC SMALL LETTER BE
+0xD2	0x0432	#	CYRILLIC SMALL LETTER VE
+0xD3	0x0433	#	CYRILLIC SMALL LETTER GHE
+0xD4	0x0434	#	CYRILLIC SMALL LETTER DE
+0xD5	0x0435	#	CYRILLIC SMALL LETTER IE
+0xD6	0x0436	#	CYRILLIC SMALL LETTER ZHE
+0xD7	0x0437	#	CYRILLIC SMALL LETTER ZE
+0xD8	0x0438	#	CYRILLIC SMALL LETTER I
+0xD9	0x0439	#	CYRILLIC SMALL LETTER SHORT I
+0xDA	0x043A	#	CYRILLIC SMALL LETTER KA
+0xDB	0x043B	#	CYRILLIC SMALL LETTER EL
+0xDC	0x043C	#	CYRILLIC SMALL LETTER EM
+0xDD	0x043D	#	CYRILLIC SMALL LETTER EN
+0xDE	0x043E	#	CYRILLIC SMALL LETTER O
+0xDF	0x043F	#	CYRILLIC SMALL LETTER PE
+0xE0	0x0440	#	CYRILLIC SMALL LETTER ER
+0xE1	0x0441	#	CYRILLIC SMALL LETTER ES
+0xE2	0x0442	#	CYRILLIC SMALL LETTER TE
+0xE3	0x0443	#	CYRILLIC SMALL LETTER U
+0xE4	0x0444	#	CYRILLIC SMALL LETTER EF
+0xE5	0x0445	#	CYRILLIC SMALL LETTER HA
+0xE6	0x0446	#	CYRILLIC SMALL LETTER TSE
+0xE7	0x0447	#	CYRILLIC SMALL LETTER CHE
+0xE8	0x0448	#	CYRILLIC SMALL LETTER SHA
+0xE9	0x0449	#	CYRILLIC SMALL LETTER SHCHA
+0xEA	0x044A	#	CYRILLIC SMALL LETTER HARD SIGN
+0xEB	0x044B	#	CYRILLIC SMALL LETTER YERU
+0xEC	0x044C	#	CYRILLIC SMALL LETTER SOFT SIGN
+0xED	0x044D	#	CYRILLIC SMALL LETTER E
+0xEE	0x044E	#	CYRILLIC SMALL LETTER YU
+0xEF	0x044F	#	CYRILLIC SMALL LETTER YA
+0xF0	0x2116	#	NUMERO SIGN
+0xF1	0x0451	#	CYRILLIC SMALL LETTER IO
+0xF2	0x0452	#	CYRILLIC SMALL LETTER DJE
+0xF3	0x0453	#	CYRILLIC SMALL LETTER GJE
+0xF4	0x0454	#	CYRILLIC SMALL LETTER UKRAINIAN IE
+0xF5	0x0455	#	CYRILLIC SMALL LETTER DZE
+0xF6	0x0456	#	CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+0xF7	0x0457	#	CYRILLIC SMALL LETTER YI
+0xF8	0x0458	#	CYRILLIC SMALL LETTER JE
+0xF9	0x0459	#	CYRILLIC SMALL LETTER LJE
+0xFA	0x045A	#	CYRILLIC SMALL LETTER NJE
+0xFB	0x045B	#	CYRILLIC SMALL LETTER TSHE
+0xFC	0x045C	#	CYRILLIC SMALL LETTER KJE
+0xFD	0x00A7	#	SECTION SIGN
+0xFE	0x045E	#	CYRILLIC SMALL LETTER SHORT U
+0xFF	0x045F	#	CYRILLIC SMALL LETTER DZHE

+ 260 - 0
sys/lib/antiword/8859-6.txt

@@ -0,0 +1,260 @@
+#
+#	Name:             ISO 8859-6:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-6:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-6 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-6 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#	0x30..0x39 remapped to the ASCII digits (U+0030..U+0039) instead
+#	of the Arabic digits (U+0660..U+0669).
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA4	0x00A4	#	CURRENCY SIGN
+0xAC	0x060C	#	ARABIC COMMA
+0xAD	0x00AD	#	SOFT HYPHEN
+0xBB	0x061B	#	ARABIC SEMICOLON
+0xBF	0x061F	#	ARABIC QUESTION MARK
+0xC1	0x0621	#	ARABIC LETTER HAMZA
+0xC2	0x0622	#	ARABIC LETTER ALEF WITH MADDA ABOVE
+0xC3	0x0623	#	ARABIC LETTER ALEF WITH HAMZA ABOVE
+0xC4	0x0624	#	ARABIC LETTER WAW WITH HAMZA ABOVE
+0xC5	0x0625	#	ARABIC LETTER ALEF WITH HAMZA BELOW
+0xC6	0x0626	#	ARABIC LETTER YEH WITH HAMZA ABOVE
+0xC7	0x0627	#	ARABIC LETTER ALEF
+0xC8	0x0628	#	ARABIC LETTER BEH
+0xC9	0x0629	#	ARABIC LETTER TEH MARBUTA
+0xCA	0x062A	#	ARABIC LETTER TEH
+0xCB	0x062B	#	ARABIC LETTER THEH
+0xCC	0x062C	#	ARABIC LETTER JEEM
+0xCD	0x062D	#	ARABIC LETTER HAH
+0xCE	0x062E	#	ARABIC LETTER KHAH
+0xCF	0x062F	#	ARABIC LETTER DAL
+0xD0	0x0630	#	ARABIC LETTER THAL
+0xD1	0x0631	#	ARABIC LETTER REH
+0xD2	0x0632	#	ARABIC LETTER ZAIN
+0xD3	0x0633	#	ARABIC LETTER SEEN
+0xD4	0x0634	#	ARABIC LETTER SHEEN
+0xD5	0x0635	#	ARABIC LETTER SAD
+0xD6	0x0636	#	ARABIC LETTER DAD
+0xD7	0x0637	#	ARABIC LETTER TAH
+0xD8	0x0638	#	ARABIC LETTER ZAH
+0xD9	0x0639	#	ARABIC LETTER AIN
+0xDA	0x063A	#	ARABIC LETTER GHAIN
+0xE0	0x0640	#	ARABIC TATWEEL
+0xE1	0x0641	#	ARABIC LETTER FEH
+0xE2	0x0642	#	ARABIC LETTER QAF
+0xE3	0x0643	#	ARABIC LETTER KAF
+0xE4	0x0644	#	ARABIC LETTER LAM
+0xE5	0x0645	#	ARABIC LETTER MEEM
+0xE6	0x0646	#	ARABIC LETTER NOON
+0xE7	0x0647	#	ARABIC LETTER HEH
+0xE8	0x0648	#	ARABIC LETTER WAW
+0xE9	0x0649	#	ARABIC LETTER ALEF MAKSURA
+0xEA	0x064A	#	ARABIC LETTER YEH
+0xEB	0x064B	#	ARABIC FATHATAN
+0xEC	0x064C	#	ARABIC DAMMATAN
+0xED	0x064D	#	ARABIC KASRATAN
+0xEE	0x064E	#	ARABIC FATHA
+0xEF	0x064F	#	ARABIC DAMMA
+0xF0	0x0650	#	ARABIC KASRA
+0xF1	0x0651	#	ARABIC SHADDA
+0xF2	0x0652	#	ARABIC SUKUN

+ 302 - 0
sys/lib/antiword/8859-7.txt

@@ -0,0 +1,302 @@
+#
+#	Name:             ISO 8859-7:1987 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO 8859-7:1987 characters map into Unicode.
+#
+#	ISO 8859-7:1987 is equivalent to ISO-IR-126, ELOT 928,
+#	and ECMA 118.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO 8859-7 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO 8859-7 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#	Remap 0xA1 to U+2018 (instead of 0x02BD) to match text of 8859-7
+#	Remap 0xA2 to U+2019 (instead of 0x02BC) to match text of 8859-7
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x2018	#	LEFT SINGLE QUOTATION MARK
+0xA2	0x2019	#	RIGHT SINGLE QUOTATION MARK
+0xA3	0x00A3	#	POUND SIGN
+0xA6	0x00A6	#	BROKEN BAR
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAF	0x2015	#	HORIZONTAL BAR
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x0384	#	GREEK TONOS
+0xB5	0x0385	#	GREEK DIALYTIKA TONOS
+0xB6	0x0386	#	GREEK CAPITAL LETTER ALPHA WITH TONOS
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x0388	#	GREEK CAPITAL LETTER EPSILON WITH TONOS
+0xB9	0x0389	#	GREEK CAPITAL LETTER ETA WITH TONOS
+0xBA	0x038A	#	GREEK CAPITAL LETTER IOTA WITH TONOS
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x038C	#	GREEK CAPITAL LETTER OMICRON WITH TONOS
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBE	0x038E	#	GREEK CAPITAL LETTER UPSILON WITH TONOS
+0xBF	0x038F	#	GREEK CAPITAL LETTER OMEGA WITH TONOS
+0xC0	0x0390	#	GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS
+0xC1	0x0391	#	GREEK CAPITAL LETTER ALPHA
+0xC2	0x0392	#	GREEK CAPITAL LETTER BETA
+0xC3	0x0393	#	GREEK CAPITAL LETTER GAMMA
+0xC4	0x0394	#	GREEK CAPITAL LETTER DELTA
+0xC5	0x0395	#	GREEK CAPITAL LETTER EPSILON
+0xC6	0x0396	#	GREEK CAPITAL LETTER ZETA
+0xC7	0x0397	#	GREEK CAPITAL LETTER ETA
+0xC8	0x0398	#	GREEK CAPITAL LETTER THETA
+0xC9	0x0399	#	GREEK CAPITAL LETTER IOTA
+0xCA	0x039A	#	GREEK CAPITAL LETTER KAPPA
+0xCB	0x039B	#	GREEK CAPITAL LETTER LAMDA
+0xCC	0x039C	#	GREEK CAPITAL LETTER MU
+0xCD	0x039D	#	GREEK CAPITAL LETTER NU
+0xCE	0x039E	#	GREEK CAPITAL LETTER XI
+0xCF	0x039F	#	GREEK CAPITAL LETTER OMICRON
+0xD0	0x03A0	#	GREEK CAPITAL LETTER PI
+0xD1	0x03A1	#	GREEK CAPITAL LETTER RHO
+0xD3	0x03A3	#	GREEK CAPITAL LETTER SIGMA
+0xD4	0x03A4	#	GREEK CAPITAL LETTER TAU
+0xD5	0x03A5	#	GREEK CAPITAL LETTER UPSILON
+0xD6	0x03A6	#	GREEK CAPITAL LETTER PHI
+0xD7	0x03A7	#	GREEK CAPITAL LETTER CHI
+0xD8	0x03A8	#	GREEK CAPITAL LETTER PSI
+0xD9	0x03A9	#	GREEK CAPITAL LETTER OMEGA
+0xDA	0x03AA	#	GREEK CAPITAL LETTER IOTA WITH DIALYTIKA
+0xDB	0x03AB	#	GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA
+0xDC	0x03AC	#	GREEK SMALL LETTER ALPHA WITH TONOS
+0xDD	0x03AD	#	GREEK SMALL LETTER EPSILON WITH TONOS
+0xDE	0x03AE	#	GREEK SMALL LETTER ETA WITH TONOS
+0xDF	0x03AF	#	GREEK SMALL LETTER IOTA WITH TONOS
+0xE0	0x03B0	#	GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS
+0xE1	0x03B1	#	GREEK SMALL LETTER ALPHA
+0xE2	0x03B2	#	GREEK SMALL LETTER BETA
+0xE3	0x03B3	#	GREEK SMALL LETTER GAMMA
+0xE4	0x03B4	#	GREEK SMALL LETTER DELTA
+0xE5	0x03B5	#	GREEK SMALL LETTER EPSILON
+0xE6	0x03B6	#	GREEK SMALL LETTER ZETA
+0xE7	0x03B7	#	GREEK SMALL LETTER ETA
+0xE8	0x03B8	#	GREEK SMALL LETTER THETA
+0xE9	0x03B9	#	GREEK SMALL LETTER IOTA
+0xEA	0x03BA	#	GREEK SMALL LETTER KAPPA
+0xEB	0x03BB	#	GREEK SMALL LETTER LAMDA
+0xEC	0x03BC	#	GREEK SMALL LETTER MU
+0xED	0x03BD	#	GREEK SMALL LETTER NU
+0xEE	0x03BE	#	GREEK SMALL LETTER XI
+0xEF	0x03BF	#	GREEK SMALL LETTER OMICRON
+0xF0	0x03C0	#	GREEK SMALL LETTER PI
+0xF1	0x03C1	#	GREEK SMALL LETTER RHO
+0xF2	0x03C2	#	GREEK SMALL LETTER FINAL SIGMA
+0xF3	0x03C3	#	GREEK SMALL LETTER SIGMA
+0xF4	0x03C4	#	GREEK SMALL LETTER TAU
+0xF5	0x03C5	#	GREEK SMALL LETTER UPSILON
+0xF6	0x03C6	#	GREEK SMALL LETTER PHI
+0xF7	0x03C7	#	GREEK SMALL LETTER CHI
+0xF8	0x03C8	#	GREEK SMALL LETTER PSI
+0xF9	0x03C9	#	GREEK SMALL LETTER OMEGA
+0xFA	0x03CA	#	GREEK SMALL LETTER IOTA WITH DIALYTIKA
+0xFB	0x03CB	#	GREEK SMALL LETTER UPSILON WITH DIALYTIKA
+0xFC	0x03CC	#	GREEK SMALL LETTER OMICRON WITH TONOS
+0xFD	0x03CD	#	GREEK SMALL LETTER UPSILON WITH TONOS
+0xFE	0x03CE	#	GREEK SMALL LETTER OMEGA WITH TONOS

+ 270 - 0
sys/lib/antiword/8859-8.txt

@@ -0,0 +1,270 @@
+#
+#	Name:             ISO/IEC 8859-8:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.1
+#	Table format:     Format A
+#	Date:             2000-Jan-03
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-8:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-8 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-8 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#       1.1 version updates to the published 8859-8:1999, correcting
+#          the mapping of 0xAF and adding mappings for LRM and RLM.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x00A5	#	YEN SIGN
+0xA6	0x00A6	#	BROKEN BAR
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x00D7	#	MULTIPLICATION SIGN
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x00F7	#	DIVISION SIGN
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x00BC	#	VULGAR FRACTION ONE QUARTER
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBE	0x00BE	#	VULGAR FRACTION THREE QUARTERS
+0xDF	0x2017	#	DOUBLE LOW LINE
+0xE0	0x05D0	#	HEBREW LETTER ALEF
+0xE1	0x05D1	#	HEBREW LETTER BET
+0xE2	0x05D2	#	HEBREW LETTER GIMEL
+0xE3	0x05D3	#	HEBREW LETTER DALET
+0xE4	0x05D4	#	HEBREW LETTER HE
+0xE5	0x05D5	#	HEBREW LETTER VAV
+0xE6	0x05D6	#	HEBREW LETTER ZAYIN
+0xE7	0x05D7	#	HEBREW LETTER HET
+0xE8	0x05D8	#	HEBREW LETTER TET
+0xE9	0x05D9	#	HEBREW LETTER YOD
+0xEA	0x05DA	#	HEBREW LETTER FINAL KAF
+0xEB	0x05DB	#	HEBREW LETTER KAF
+0xEC	0x05DC	#	HEBREW LETTER LAMED
+0xED	0x05DD	#	HEBREW LETTER FINAL MEM
+0xEE	0x05DE	#	HEBREW LETTER MEM
+0xEF	0x05DF	#	HEBREW LETTER FINAL NUN
+0xF0	0x05E0	#	HEBREW LETTER NUN
+0xF1	0x05E1	#	HEBREW LETTER SAMEKH
+0xF2	0x05E2	#	HEBREW LETTER AYIN
+0xF3	0x05E3	#	HEBREW LETTER FINAL PE
+0xF4	0x05E4	#	HEBREW LETTER PE
+0xF5	0x05E5	#	HEBREW LETTER FINAL TSADI
+0xF6	0x05E6	#	HEBREW LETTER TSADI
+0xF7	0x05E7	#	HEBREW LETTER QOF
+0xF8	0x05E8	#	HEBREW LETTER RESH
+0xF9	0x05E9	#	HEBREW LETTER SHIN
+0xFA	0x05EA	#	HEBREW LETTER TAV
+0xFD	0x200E	#	LEFT-TO-RIGHT MARK
+0xFE	0x200F	#	RIGHT-TO-LEFT MARK
+

+ 307 - 0
sys/lib/antiword/8859-9.txt

@@ -0,0 +1,307 @@
+#
+#	Name:             ISO/IEC 8859-9:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on magnetic media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-9:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-9 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-9 order.
+#
+#	ISO/IEC 8859-9 is also equivalent to ISO-IR-148.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0081	#	<control>
+0x82	0x0082	#	<control>
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0085	#	<control>
+0x86	0x0086	#	<control>
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x008C	#	<control>
+0x8D	0x008D	#	<control>
+0x8E	0x008E	#	<control>
+0x8F	0x008F	#	<control>
+0x90	0x0090	#	<control>
+0x91	0x0091	#	<control>
+0x92	0x0092	#	<control>
+0x93	0x0093	#	<control>
+0x94	0x0094	#	<control>
+0x95	0x0095	#	<control>
+0x96	0x0096	#	<control>
+0x97	0x0097	#	<control>
+0x98	0x0098	#	<control>
+0x99	0x0099	#	<control>
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x009C	#	<control>
+0x9D	0x009D	#	<control>
+0x9E	0x009E	#	<control>
+0x9F	0x009F	#	<control>
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x00A1	#	INVERTED EXCLAMATION MARK
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x00A5	#	YEN SIGN
+0xA6	0x00A6	#	BROKEN BAR
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x00AA	#	FEMININE ORDINAL INDICATOR
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x00BA	#	MASCULINE ORDINAL INDICATOR
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x00BC	#	VULGAR FRACTION ONE QUARTER
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBE	0x00BE	#	VULGAR FRACTION THREE QUARTERS
+0xBF	0x00BF	#	INVERTED QUESTION MARK
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x011E	#	LATIN CAPITAL LETTER G WITH BREVE
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x0130	#	LATIN CAPITAL LETTER I WITH DOT ABOVE
+0xDE	0x015E	#	LATIN CAPITAL LETTER S WITH CEDILLA
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x011F	#	LATIN SMALL LETTER G WITH BREVE
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x0131	#	LATIN SMALL LETTER DOTLESS I
+0xFE	0x015F	#	LATIN SMALL LETTER S WITH CEDILLA
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS
+
+

+ 81 - 0
sys/lib/antiword/Default

@@ -0,0 +1,81 @@
+# Default fontnames translation table
+# uses only fonts present in the RISC OS 3 ROMs
+#
+# MS-Word fontname,	Italic,	Bold,	Acorn fontname,		Special
+Arial,			0,	0,	Homerton.Medium,	0
+Arial,			0,	1,	Homerton.Bold,		0
+Arial,			1,	0,	Homerton.Medium.Oblique,0
+Arial,			1,	1,	Homerton.Bold.Oblique,	0
+Arial Black,		0,	0,	Homerton.Medium,	0
+Arial Black,		0,	1,	Homerton.Bold,		0
+Arial Black,		1,	0,	Homerton.Medium.Oblique,0
+Arial Black,		1,	1,	Homerton.Bold.Oblique,	0
+Arial CE,		0,	0,	Homerton.Medium,	0
+Arial CE,		0,	1,	Homerton.Bold,		0
+Arial CE,		1,	0,	Homerton.Medium.Oblique,0
+Arial CE,		1,	1,	Homerton.Bold.Oblique,	0
+Arial Narrow,		0,	0,	Homerton.Medium,	0
+Arial Narrow,		0,	1,	Homerton.Bold,		0
+Arial Narrow,		1,	0,	Homerton.Medium.Oblique,0
+Arial Narrow,		1,	1,	Homerton.Bold.Oblique,	0
+Comic Sans MS,		0,	0,	Homerton.Medium,	0
+Comic Sans MS,		0,	1,	Homerton.Bold,		0
+Comic Sans MS,		1,	0,	Homerton.Medium.Oblique,0
+Comic Sans MS,		1,	1,	Homerton.Bold.Oblique,	0
+Courier,		0,	0,	Corpus.Medium,		0
+Courier,		0,	1,	Corpus.Bold,		0
+Courier,		1,	0,	Corpus.Medium.Oblique,	0
+Courier,		1,	1,	Corpus.Bold.Oblique,	0
+Courier New,		0,	0,	Corpus.Medium,		0
+Courier New,		0,	1,	Corpus.Bold,		0
+Courier New,		1,	0,	Corpus.Medium.Oblique,	0
+Courier New,		1,	1,	Corpus.Bold.Oblique,	0
+Fixedsys,		0,	0,	Corpus.Medium,		0
+Fixedsys,		0,	1,	Corpus.Bold,		0
+Fixedsys,		1,	0,	Corpus.Medium.Oblique,	0
+Fixedsys,		1,	1,	Corpus.Bold.Oblique,	0
+Helvetica,		0,	0,	Homerton.Medium,	0
+Helvetica,		0,	1,	Homerton.Bold,		0
+Helvetica,		1,	0,	Homerton.Medium.Oblique,0
+Helvetica,		1,	1,	Homerton.Bold.Oblique,	0
+Helvetica-Narrow,	0,	0,	Homerton.Medium,	0
+Helvetica-Narrow,	0,	1,	Homerton.Bold,		0
+Helvetica-Narrow,	1,	0,	Homerton.Medium.Oblique,0
+Helvetica-Narrow,	1,	1,	Homerton.Bold.Oblique,	0
+Lucida Console,		0,	0,	Corpus.Medium,		0
+Lucida Console,		0,	1,	Corpus.Bold,		0
+Lucida Console,		1,	0,	Corpus.Medium.Oblique,	0
+Lucida Console,		1,	1,	Corpus.Bold.Oblique,	0
+Monotype.com,		0,	0,	Corpus.Medium,		0
+Monotype.com,		0,	1,	Corpus.Bold,		0
+Monotype.com,		1,	0,	Corpus.Medium.Oblique,	0
+Monotype.com,		1,	1,	Corpus.Bold.Oblique,	0
+MS Sans Serif,		0,	0,	Homerton.Medium,	0
+MS Sans Serif,		0,	1,	Homerton.Bold,		0
+MS Sans Serif,		1,	0,	Homerton.Medium.Oblique,0
+MS Sans Serif,		1,	1,	Homerton.Bold.Oblique,	0
+Swiss,			0,	0,	Homerton.Medium,	0
+Swiss,			0,	1,	Homerton.Bold,		0
+Swiss,			1,	0,	Homerton.Medium.Oblique,0
+Swiss,			1,	1,	Homerton.Bold.Oblique,	0
+Tahoma,			0,	0,	Homerton.Medium,	0
+Tahoma,			0,	1,	Homerton.Bold,		0
+Tahoma,			1,	0,	Homerton.Medium.Oblique,0
+Tahoma,			1,	1,	Homerton.Bold.Oblique,	0
+Trebuchet MS,		0,	0,	Homerton.Medium,	0
+Trebuchet MS,		0,	1,	Homerton.Bold,		0
+Trebuchet MS,		1,	0,	Homerton.Medium.Oblique,0
+Trebuchet MS,		1,	1,	Homerton.Bold.Oblique,	0
+Verdana,		0,	0,	Homerton.Medium,	0
+Verdana,		0,	1,	Homerton.Bold,		0
+Verdana,		1,	0,	Homerton.Medium.Oblique,0
+Verdana,		1,	1,	Homerton.Bold.Oblique,	0
+Univers,		0,	0,	Homerton.Medium,	0
+Univers,		0,	1,	Homerton.Bold,		0
+Univers,		1,	0,	Homerton.Medium.Oblique,0
+Univers,		1,	1,	Homerton.Bold.Oblique,	0
+# All the other fonts
+*,			0,	0,	Trinity.Medium,		0
+*,			0,	1,	Trinity.Bold,		0
+*,			1,	0,	Trinity.Medium.Italic,	0
+*,			1,	1,	Trinity.Bold.Italic,	0

+ 80 - 0
sys/lib/antiword/Example

@@ -0,0 +1,80 @@
+# An example of a fontnames translation table
+#
+# MS-Word fontname,	Italic,	Bold,	Acorn fontname,		Special
+Arial,			0,	0,	Homerton.Medium,	0
+Arial,			0,	1,	Homerton.Bold,		0
+Arial,			1,	0,	Homerton.Medium.Oblique,0
+Arial,			1,	1,	Homerton.Bold.Oblique,	0
+Arial Black,		0,	0,	Homerton.Medium,	0
+Arial Black,		0,	1,	Homerton.Bold,		0
+Arial Black,		1,	0,	Homerton.Medium.Oblique,0
+Arial Black,		1,	1,	Homerton.Bold.Oblique,	0
+AvantGarde,		0,	0,	Clare.Medium,		0
+AvantGarde,		0,	1,	Clare.Demi,		0
+AvantGarde,		1,	0,	Clare.Medium.Oblique,	0
+AvantGarde,		1,	1,	Clare.Demi.Oblique,	0
+Bookman,		0,	0,	Robinson.Light,		0
+Bookman,		0,	1,	Robinson.Demi,		0
+Bookman,		1,	0,	Robinson.Light.Italic,	0
+Bookman,		1,	1,	Robinson.Demi.Italic,	0
+Bookman Old Style,	0,	0,	Robinson.Light,		0
+Bookman Old Style,	0,	1,	Robinson.Demi,		0
+Bookman Old Style,	1,	0,	Robinson.Light.Italic,	0
+Bookman Old Style,	1,	1,	Robinson.Demi.Italic,	0
+Courier,		0,	0,	Corpus.Medium,		0
+Courier,		0,	1,	Corpus.Bold,		0
+Courier,		1,	0,	Corpus.Medium.Oblique,	0
+Courier,		1,	1,	Corpus.Bold.Oblique,	0
+Courier New,		0,	0,	Corpus.Medium,		0
+Courier New,		0,	1,	Corpus.Bold,		0
+Courier New,		1,	0,	Corpus.Medium.Oblique,	0
+Courier New,		1,	1,	Corpus.Bold.Oblique,	0
+Fixedsys,		0,	0,	Corpus.Medium,		0
+Fixedsys,		0,	1,	Corpus.Bold,		0
+Fixedsys,		1,	0,	Corpus.Medium.Oblique,	0
+Fixedsys,		1,	1,	Corpus.Bold.Oblique,	0
+Helvetica,		0,	0,	Homerton.Medium,	0
+Helvetica,		0,	1,	Homerton.Bold,		0
+Helvetica,		1,	0,	Homerton.Medium.Oblique,0
+Helvetica,		1,	1,	Homerton.Bold.Oblique,	0
+Lucida Console,		0,	0,	Corpus.Medium,		0
+Lucida Console,		0,	1,	Corpus.Bold,		0
+Lucida Console,		1,	0,	Corpus.Medium.Oblique,	0
+Lucida Console,		1,	1,	Corpus.Bold.Oblique,	0
+Palatino,		0,	0,	Pembroke.Medium,	0
+Palatino,		0,	1,	Pembroke.Bold,		0
+Palatino,		1,	0,	Pembroke.Medium.Italic,	0
+Palatino,		1,	1,	Pembroke.Bold.Italic,	0
+Swiss,			0,	0,	Homerton.Medium,	0
+Swiss,			0,	1,	Homerton.Bold,		0
+Swiss,			1,	0,	Homerton.Medium.Oblique,0
+Swiss,			1,	1,	Homerton.Bold.Oblique,	0
+Symbol,			0,	0,	Sidney,			1
+Symbol,			0,	1,	Sidney,			1
+Symbol,			1,	0,	Sidney,			1
+Symbol,			1,	1,	Sidney,			1
+Times,			0,	0,	Trinity.Medium,		0
+Times,			0,	1,	Trinity.Bold,		0
+Times,			1,	0,	Trinity.Medium.Italic,	0
+Times,			1,	1,	Trinity.Bold.Italic,	0
+Times New Roman,	0,	0,	Trinity.Medium,		0
+Times New Roman,	0,	1,	Trinity.Bold,		0
+Times New Roman,	1,	0,	Trinity.Medium.Italic,	0
+Times New Roman,	1,	1,	Trinity.Bold.Italic,	0
+Times Roman,		0,	0,	Trinity.Medium,		0
+Times Roman,		0,	1,	Trinity.Bold,		0
+Times Roman,		1,	0,	Trinity.Medium.Italic,	0
+Times Roman,		1,	1,	Trinity.Bold.Italic,	0
+Univers,		0,	0,	Homerton.Medium,	0
+Univers,		0,	1,	Homerton.Bold,		0
+Univers,		1,	0,	Homerton.Medium.Oblique,0
+Univers,		1,	1,	Homerton.Bold.Oblique,	0
+ZapfDingbats,		0,	0,	Selwyn,			2
+ZapfDingbats,		0,	1,	Selwyn,			2
+ZapfDingbats,		1,	0,	Selwyn,			2
+ZapfDingbats,		1,	1,	Selwyn,			2
+# All the other fonts
+*,			0,	0,	Trinity.Medium,		0
+*,			0,	1,	Trinity.Bold,		0
+*,			1,	0,	Trinity.Medium.Italic,	0
+*,			1,	1,	Trinity.Bold.Italic,	0

+ 364 - 0
sys/lib/antiword/MacRoman.txt

@@ -0,0 +1,364 @@
+#=======================================================================
+#   FTP file name:  ROMAN.TXT
+#
+#   Contents:       Map (external version) from Mac OS Roman
+#                   character set to Unicode 2.1
+#
+#   Copyright:      (c) 1994-1999 by Apple Computer, Inc., all rights
+#                   reserved.
+#
+#   Contact:        charsets@apple.com
+#
+#   Changes:
+#
+#       b03  1999-Sep-22    Update contact e-mail address. Matches
+#                           internal utom<b4>, ufrm<b3>, and Text
+#                           Encoding Converter version 1.5.
+#       b02  1998-Aug-18    Encoding changed for Mac OS 8.5; change
+#                           mapping of 0xDB from CURRENCY SIGN to
+#                           EURO SIGN. Matches internal utom<b3>,
+#                           ufrm<b3>.
+#       n08  1998-Feb-05    Minor update to header comments
+#       n06  1997-Dec-14    Add warning about future changes to 0xDB
+#                           from CURRENCY SIGN to EURO SIGN. Clarify
+#                           some header information
+#       n04  1997-Dec-01    Update to match internal utom<n3>, ufrm<n22>:
+#                           Change standard mapping for 0xBD from U+2126
+#                           to its canonical decomposition, U+03A9.
+#       n03  1995-Apr-15    First version (after fixing some typos).
+#                           Matches internal ufrm<n9>.
+#
+# Standard header:
+# ----------------
+#
+#   Apple, the Apple logo, and Macintosh are trademarks of Apple
+#   Computer, Inc., registered in the United States and other countries.
+#   Unicode is a trademark of Unicode Inc. For the sake of brevity,
+#   throughout this document, "Macintosh" can be used to refer to
+#   Macintosh computers and "Unicode" can be used to refer to the
+#   Unicode standard.
+#
+#   Apple makes no warranty or representation, either express or
+#   implied, with respect to these tables, their quality, accuracy, or
+#   fitness for a particular purpose. In no event will Apple be liable
+#   for direct, indirect, special, incidental, or consequential damages 
+#   resulting from any defect or inaccuracy in this document or the
+#   accompanying tables.
+#
+#   These mapping tables and character lists are subject to change.
+#   The latest tables should be available from the following:
+#
+#   <ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/APPLE/>
+#   <ftp://dev.apple.com/devworld/Technical_Documentation/Misc._Standards/>
+#
+#   For general information about Mac OS encodings and these mapping
+#   tables, see the file "README.TXT".
+#
+# Format:
+# -------
+#
+#   Three tab-separated columns;
+#   '#' begins a comment which continues to the end of the line.
+#     Column #1 is the Mac OS Roman code (in hex as 0xNN)
+#     Column #2 is the corresponding Unicode (in hex as 0xNNNN)
+#     Column #3 is a comment containing the Unicode name
+#
+#   The entries are in Mac OS Roman code order.
+#
+#   One of these mappings requires the use of a corporate character.
+#   See the file "CORPCHAR.TXT" and notes below.
+#
+#   Control character mappings are not shown in this table, following
+#   the conventions of the standard UTC mapping tables. However, the
+#   Mac OS Roman character set uses the standard control characters at
+#   0x00-0x1F and 0x7F.
+#
+# Notes on Mac OS Roman:
+# ----------------------
+#
+#   This character set is used for at least the following Mac OS
+#   localizations: U.S., British, Canadian French, French, Swiss
+#   French, German, Swiss German, Italian, Swiss Italian, Dutch,
+#   Swedish, Norwegian, Danish, Finnish, Spanish, Catalan,
+#   Portuguese, Brazilian, and the default International system.
+#
+#   Variants of Mac OS Roman are used for Croatian, Icelandic,
+#   Turkish, Romanian, and other encodings. Separate mapping tables
+#   are available for these encodings.
+#
+#   Before Mac OS 8.5, code point 0xDB was CURRENCY SIGN, and was
+#   mapped to U+00A4. In Mac OS 8.5 and later versions, code point
+#   0xDB is changed to EURO SIGN and maps to U+20AC; the standard
+#   Apple fonts are updated for Mac OS 8.5 to reflect this. There is
+#   a "currency sign" variant of the Mac OS Roman encoding that still
+#   maps 0xDB to U+00A4; this can be used for older fonts.
+#   Note: U+20AC is new with Unicode 2.1; for earlier Unicode
+#   versions, Mac OS Roman 0xDB may be mapped to private-use character
+#   U+F8A0.
+#
+#   Before Mac OS 8.5, the ROM bitmap versions of the fonts Chicago,
+#   New York, Geneva, and Monaco did not implement the full Mac OS
+#   Roman character set; they only supported character codes up to
+#   0xD8. The TrueType versions of these fonts have always implemented
+#   the full character set, as with the bitmap and TrueType versions
+#   of the other standard Roman fonts.
+#
+#   In all Mac OS encodings, fonts such as Chicago which are used
+#   as "system" fonts (for menus, dialogs, etc.) have four glyphs
+#   at code points 0x11-0x14 for transient use by the Menu Manager.
+#   These glyphs are not intended as characters for use in normal
+#   text, and the associated code points are not generally
+#   interpreted as associated with these glyphs; they are usually
+#   interpreted (if at all) as the control codes DC1-DC4.
+#
+# Unicode mapping issues and notes:
+# ---------------------------------
+#
+#   The following corporate zone Unicode character is used in this
+#   mapping:
+#
+#     0xF8FF  Apple logo
+#
+#   NOTE: The graphic image associated with the Apple logo character
+#   is not authorized for use without permission of Apple, and
+#   unauthorized use might constitute trademark infringement.
+#
+# Details of mapping changes in each version:
+# -------------------------------------------
+#
+#   Changes from version n08 to version b02:
+#
+#   - Encoding changed for Mac OS 8.5; change mapping of 0xDB from
+#   CURRENCY SIGN (U+00A4) to EURO SIGN (U+20AC).
+#
+#   Changes from version n03 to version n04:
+#
+#   - Change mapping of 0xBD from U+2126 to its canonical
+#     decomposition, U+03A9.
+#
+##################
+
+0x20	0x0020	# SPACE
+0x21	0x0021	# EXCLAMATION MARK
+0x22	0x0022	# QUOTATION MARK
+0x23	0x0023	# NUMBER SIGN
+0x24	0x0024	# DOLLAR SIGN
+0x25	0x0025	# PERCENT SIGN
+0x26	0x0026	# AMPERSAND
+0x27	0x0027	# APOSTROPHE
+0x28	0x0028	# LEFT PARENTHESIS
+0x29	0x0029	# RIGHT PARENTHESIS
+0x2A	0x002A	# ASTERISK
+0x2B	0x002B	# PLUS SIGN
+0x2C	0x002C	# COMMA
+0x2D	0x002D	# HYPHEN-MINUS
+0x2E	0x002E	# FULL STOP
+0x2F	0x002F	# SOLIDUS
+0x30	0x0030	# DIGIT ZERO
+0x31	0x0031	# DIGIT ONE
+0x32	0x0032	# DIGIT TWO
+0x33	0x0033	# DIGIT THREE
+0x34	0x0034	# DIGIT FOUR
+0x35	0x0035	# DIGIT FIVE
+0x36	0x0036	# DIGIT SIX
+0x37	0x0037	# DIGIT SEVEN
+0x38	0x0038	# DIGIT EIGHT
+0x39	0x0039	# DIGIT NINE
+0x3A	0x003A	# COLON
+0x3B	0x003B	# SEMICOLON
+0x3C	0x003C	# LESS-THAN SIGN
+0x3D	0x003D	# EQUALS SIGN
+0x3E	0x003E	# GREATER-THAN SIGN
+0x3F	0x003F	# QUESTION MARK
+0x40	0x0040	# COMMERCIAL AT
+0x41	0x0041	# LATIN CAPITAL LETTER A
+0x42	0x0042	# LATIN CAPITAL LETTER B
+0x43	0x0043	# LATIN CAPITAL LETTER C
+0x44	0x0044	# LATIN CAPITAL LETTER D
+0x45	0x0045	# LATIN CAPITAL LETTER E
+0x46	0x0046	# LATIN CAPITAL LETTER F
+0x47	0x0047	# LATIN CAPITAL LETTER G
+0x48	0x0048	# LATIN CAPITAL LETTER H
+0x49	0x0049	# LATIN CAPITAL LETTER I
+0x4A	0x004A	# LATIN CAPITAL LETTER J
+0x4B	0x004B	# LATIN CAPITAL LETTER K
+0x4C	0x004C	# LATIN CAPITAL LETTER L
+0x4D	0x004D	# LATIN CAPITAL LETTER M
+0x4E	0x004E	# LATIN CAPITAL LETTER N
+0x4F	0x004F	# LATIN CAPITAL LETTER O
+0x50	0x0050	# LATIN CAPITAL LETTER P
+0x51	0x0051	# LATIN CAPITAL LETTER Q
+0x52	0x0052	# LATIN CAPITAL LETTER R
+0x53	0x0053	# LATIN CAPITAL LETTER S
+0x54	0x0054	# LATIN CAPITAL LETTER T
+0x55	0x0055	# LATIN CAPITAL LETTER U
+0x56	0x0056	# LATIN CAPITAL LETTER V
+0x57	0x0057	# LATIN CAPITAL LETTER W
+0x58	0x0058	# LATIN CAPITAL LETTER X
+0x59	0x0059	# LATIN CAPITAL LETTER Y
+0x5A	0x005A	# LATIN CAPITAL LETTER Z
+0x5B	0x005B	# LEFT SQUARE BRACKET
+0x5C	0x005C	# REVERSE SOLIDUS
+0x5D	0x005D	# RIGHT SQUARE BRACKET
+0x5E	0x005E	# CIRCUMFLEX ACCENT
+0x5F	0x005F	# LOW LINE
+0x60	0x0060	# GRAVE ACCENT
+0x61	0x0061	# LATIN SMALL LETTER A
+0x62	0x0062	# LATIN SMALL LETTER B
+0x63	0x0063	# LATIN SMALL LETTER C
+0x64	0x0064	# LATIN SMALL LETTER D
+0x65	0x0065	# LATIN SMALL LETTER E
+0x66	0x0066	# LATIN SMALL LETTER F
+0x67	0x0067	# LATIN SMALL LETTER G
+0x68	0x0068	# LATIN SMALL LETTER H
+0x69	0x0069	# LATIN SMALL LETTER I
+0x6A	0x006A	# LATIN SMALL LETTER J
+0x6B	0x006B	# LATIN SMALL LETTER K
+0x6C	0x006C	# LATIN SMALL LETTER L
+0x6D	0x006D	# LATIN SMALL LETTER M
+0x6E	0x006E	# LATIN SMALL LETTER N
+0x6F	0x006F	# LATIN SMALL LETTER O
+0x70	0x0070	# LATIN SMALL LETTER P
+0x71	0x0071	# LATIN SMALL LETTER Q
+0x72	0x0072	# LATIN SMALL LETTER R
+0x73	0x0073	# LATIN SMALL LETTER S
+0x74	0x0074	# LATIN SMALL LETTER T
+0x75	0x0075	# LATIN SMALL LETTER U
+0x76	0x0076	# LATIN SMALL LETTER V
+0x77	0x0077	# LATIN SMALL LETTER W
+0x78	0x0078	# LATIN SMALL LETTER X
+0x79	0x0079	# LATIN SMALL LETTER Y
+0x7A	0x007A	# LATIN SMALL LETTER Z
+0x7B	0x007B	# LEFT CURLY BRACKET
+0x7C	0x007C	# VERTICAL LINE
+0x7D	0x007D	# RIGHT CURLY BRACKET
+0x7E	0x007E	# TILDE
+#
+0x80	0x00C4	# LATIN CAPITAL LETTER A WITH DIAERESIS
+0x81	0x00C5	# LATIN CAPITAL LETTER A WITH RING ABOVE
+0x82	0x00C7	# LATIN CAPITAL LETTER C WITH CEDILLA
+0x83	0x00C9	# LATIN CAPITAL LETTER E WITH ACUTE
+0x84	0x00D1	# LATIN CAPITAL LETTER N WITH TILDE
+0x85	0x00D6	# LATIN CAPITAL LETTER O WITH DIAERESIS
+0x86	0x00DC	# LATIN CAPITAL LETTER U WITH DIAERESIS
+0x87	0x00E1	# LATIN SMALL LETTER A WITH ACUTE
+0x88	0x00E0	# LATIN SMALL LETTER A WITH GRAVE
+0x89	0x00E2	# LATIN SMALL LETTER A WITH CIRCUMFLEX
+0x8A	0x00E4	# LATIN SMALL LETTER A WITH DIAERESIS
+0x8B	0x00E3	# LATIN SMALL LETTER A WITH TILDE
+0x8C	0x00E5	# LATIN SMALL LETTER A WITH RING ABOVE
+0x8D	0x00E7	# LATIN SMALL LETTER C WITH CEDILLA
+0x8E	0x00E9	# LATIN SMALL LETTER E WITH ACUTE
+0x8F	0x00E8	# LATIN SMALL LETTER E WITH GRAVE
+0x90	0x00EA	# LATIN SMALL LETTER E WITH CIRCUMFLEX
+0x91	0x00EB	# LATIN SMALL LETTER E WITH DIAERESIS
+0x92	0x00ED	# LATIN SMALL LETTER I WITH ACUTE
+0x93	0x00EC	# LATIN SMALL LETTER I WITH GRAVE
+0x94	0x00EE	# LATIN SMALL LETTER I WITH CIRCUMFLEX
+0x95	0x00EF	# LATIN SMALL LETTER I WITH DIAERESIS
+0x96	0x00F1	# LATIN SMALL LETTER N WITH TILDE
+0x97	0x00F3	# LATIN SMALL LETTER O WITH ACUTE
+0x98	0x00F2	# LATIN SMALL LETTER O WITH GRAVE
+0x99	0x00F4	# LATIN SMALL LETTER O WITH CIRCUMFLEX
+0x9A	0x00F6	# LATIN SMALL LETTER O WITH DIAERESIS
+0x9B	0x00F5	# LATIN SMALL LETTER O WITH TILDE
+0x9C	0x00FA	# LATIN SMALL LETTER U WITH ACUTE
+0x9D	0x00F9	# LATIN SMALL LETTER U WITH GRAVE
+0x9E	0x00FB	# LATIN SMALL LETTER U WITH CIRCUMFLEX
+0x9F	0x00FC	# LATIN SMALL LETTER U WITH DIAERESIS
+0xA0	0x2020	# DAGGER
+0xA1	0x00B0	# DEGREE SIGN
+0xA2	0x00A2	# CENT SIGN
+0xA3	0x00A3	# POUND SIGN
+0xA4	0x00A7	# SECTION SIGN
+0xA5	0x2022	# BULLET
+0xA6	0x00B6	# PILCROW SIGN
+0xA7	0x00DF	# LATIN SMALL LETTER SHARP S
+0xA8	0x00AE	# REGISTERED SIGN
+0xA9	0x00A9	# COPYRIGHT SIGN
+0xAA	0x2122	# TRADE MARK SIGN
+0xAB	0x00B4	# ACUTE ACCENT
+0xAC	0x00A8	# DIAERESIS
+0xAD	0x2260	# NOT EQUAL TO
+0xAE	0x00C6	# LATIN CAPITAL LETTER AE
+0xAF	0x00D8	# LATIN CAPITAL LETTER O WITH STROKE
+0xB0	0x221E	# INFINITY
+0xB1	0x00B1	# PLUS-MINUS SIGN
+0xB2	0x2264	# LESS-THAN OR EQUAL TO
+0xB3	0x2265	# GREATER-THAN OR EQUAL TO
+0xB4	0x00A5	# YEN SIGN
+0xB5	0x00B5	# MICRO SIGN
+0xB6	0x2202	# PARTIAL DIFFERENTIAL
+0xB7	0x2211	# N-ARY SUMMATION
+0xB8	0x220F	# N-ARY PRODUCT
+0xB9	0x03C0	# GREEK SMALL LETTER PI
+0xBA	0x222B	# INTEGRAL
+0xBB	0x00AA	# FEMININE ORDINAL INDICATOR
+0xBC	0x00BA	# MASCULINE ORDINAL INDICATOR
+0xBD	0x03A9	# GREEK CAPITAL LETTER OMEGA
+0xBE	0x00E6	# LATIN SMALL LETTER AE
+0xBF	0x00F8	# LATIN SMALL LETTER O WITH STROKE
+0xC0	0x00BF	# INVERTED QUESTION MARK
+0xC1	0x00A1	# INVERTED EXCLAMATION MARK
+0xC2	0x00AC	# NOT SIGN
+0xC3	0x221A	# SQUARE ROOT
+0xC4	0x0192	# LATIN SMALL LETTER F WITH HOOK
+0xC5	0x2248	# ALMOST EQUAL TO
+0xC6	0x2206	# INCREMENT
+0xC7	0x00AB	# LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xC8	0x00BB	# RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xC9	0x2026	# HORIZONTAL ELLIPSIS
+0xCA	0x00A0	# NO-BREAK SPACE
+0xCB	0x00C0	# LATIN CAPITAL LETTER A WITH GRAVE
+0xCC	0x00C3	# LATIN CAPITAL LETTER A WITH TILDE
+0xCD	0x00D5	# LATIN CAPITAL LETTER O WITH TILDE
+0xCE	0x0152	# LATIN CAPITAL LIGATURE OE
+0xCF	0x0153	# LATIN SMALL LIGATURE OE
+0xD0	0x2013	# EN DASH
+0xD1	0x2014	# EM DASH
+0xD2	0x201C	# LEFT DOUBLE QUOTATION MARK
+0xD3	0x201D	# RIGHT DOUBLE QUOTATION MARK
+0xD4	0x2018	# LEFT SINGLE QUOTATION MARK
+0xD5	0x2019	# RIGHT SINGLE QUOTATION MARK
+0xD6	0x00F7	# DIVISION SIGN
+0xD7	0x25CA	# LOZENGE
+0xD8	0x00FF	# LATIN SMALL LETTER Y WITH DIAERESIS
+0xD9	0x0178	# LATIN CAPITAL LETTER Y WITH DIAERESIS
+0xDA	0x2044	# FRACTION SLASH
+0xDB	0x20AC	# EURO SIGN
+0xDC	0x2039	# SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+0xDD	0x203A	# SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+0xDE	0xFB01	# LATIN SMALL LIGATURE FI
+0xDF	0xFB02	# LATIN SMALL LIGATURE FL
+0xE0	0x2021	# DOUBLE DAGGER
+0xE1	0x00B7	# MIDDLE DOT
+0xE2	0x201A	# SINGLE LOW-9 QUOTATION MARK
+0xE3	0x201E	# DOUBLE LOW-9 QUOTATION MARK
+0xE4	0x2030	# PER MILLE SIGN
+0xE5	0x00C2	# LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xE6	0x00CA	# LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xE7	0x00C1	# LATIN CAPITAL LETTER A WITH ACUTE
+0xE8	0x00CB	# LATIN CAPITAL LETTER E WITH DIAERESIS
+0xE9	0x00C8	# LATIN CAPITAL LETTER E WITH GRAVE
+0xEA	0x00CD	# LATIN CAPITAL LETTER I WITH ACUTE
+0xEB	0x00CE	# LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xEC	0x00CF	# LATIN CAPITAL LETTER I WITH DIAERESIS
+0xED	0x00CC	# LATIN CAPITAL LETTER I WITH GRAVE
+0xEE	0x00D3	# LATIN CAPITAL LETTER O WITH ACUTE
+0xEF	0x00D4	# LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xF0	0xF8FF	# Apple logo
+0xF1	0x00D2	# LATIN CAPITAL LETTER O WITH GRAVE
+0xF2	0x00DA	# LATIN CAPITAL LETTER U WITH ACUTE
+0xF3	0x00DB	# LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xF4	0x00D9	# LATIN CAPITAL LETTER U WITH GRAVE
+0xF5	0x0131	# LATIN SMALL LETTER DOTLESS I
+0xF6	0x02C6	# MODIFIER LETTER CIRCUMFLEX ACCENT
+0xF7	0x02DC	# SMALL TILDE
+0xF8	0x00AF	# MACRON
+0xF9	0x02D8	# BREVE
+0xFA	0x02D9	# DOT ABOVE
+0xFB	0x02DA	# RING ABOVE
+0xFC	0x00B8	# CEDILLA
+0xFD	0x02DD	# DOUBLE ACUTE ACCENT
+0xFE	0x02DB	# OGONEK
+0xFF	0x02C7	# CARON

+ 3 - 0
sys/lib/antiword/UTF-8.txt

@@ -0,0 +1,3 @@
+# UTF-8 to Unicode
+# This file is a dummy.
+# The conversion is done algorithmicly, not by a table look-up.

+ 306 - 0
sys/lib/antiword/Unicode01

@@ -0,0 +1,306 @@
+#
+#	Name:             ISO/IEC 8859-1:1998 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-1:1998 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-1 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-1 order.
+#
+#	Version history
+#	1.0 version updates 0.1 version by adding mappings for all
+#	control characters.
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+#RISC OS
+# This file was changed to match RISC OS specific characters (0x80 - 0x9f)
+#RISC OS
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0174	#	CAPITAL W CIRCUMFLEX ACCENT
+0x82	0x0175	#	SMALL W CIRCUMFLEX ACCENT
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0176	#	CAPITAL Y CIRCUMFLEX ACCENT
+0x86	0x0177	#	SMALL Y CIRCUMFLEX ACCENT
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x2026	#	ELLIPSIS
+0x8D	0x2122	#	TRADEMARK
+0x8E	0x2030	#	PER MILLE SIGN
+0x8F	0x2022	#	BULLET
+0x90	0x2018	#	LEFT SINGLE QUOTE
+0x91	0x2019	#	RIGHT SINGLE QUOTE
+0x92	0x2039	#	LEFT SINGLE QUOTATION MARK
+0x93	0x203A	#	RIGHT SINGLE QUOTATION MARK
+0x94	0x201C	#	OPENING DOUBLE QUOTE
+0x95	0x201D	#	CLOSING DOUBLE QUOTE
+0x96	0x201E	#	LOW DOUBLE QUOTE
+0x97	0x2013	#	EN DASH
+0x98	0x2014	#	EM_DASH
+0x99	0x2011	#	NON BREAKING HYPHEN
+0x9A	0x0152	#	LATIN CAPITAL LIGATURE OE
+0x9B	0x0153	#	LATIN SMALL LIGATURE OE
+0x9C	0x2020	#	DAGGER
+0x9D	0x2021	#	DOUBLE DAGGER
+0x9E	0xFB01	#	Fi
+0x9F	0xFB02	#	Fl
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x00A1	#	INVERTED EXCLAMATION MARK
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x00A4	#	CURRENCY SIGN
+0xA5	0x00A5	#	YEN SIGN
+0xA6	0x00A6	#	BROKEN BAR
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x00A8	#	DIAERESIS
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x00AA	#	FEMININE ORDINAL INDICATOR
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x00B4	#	ACUTE ACCENT
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x00B8	#	CEDILLA
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x00BA	#	MASCULINE ORDINAL INDICATOR
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x00BC	#	VULGAR FRACTION ONE QUARTER
+0xBD	0x00BD	#	VULGAR FRACTION ONE HALF
+0xBE	0x00BE	#	VULGAR FRACTION THREE QUARTERS
+0xBF	0x00BF	#	INVERTED QUESTION MARK
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x00D0	#	LATIN CAPITAL LETTER ETH (Icelandic)
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x00DE	#	LATIN CAPITAL LETTER THORN (Icelandic)
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S (German)
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x00F0	#	LATIN SMALL LETTER ETH (Icelandic)
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x00FE	#	LATIN SMALL LETTER THORN (Icelandic)
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS

+ 305 - 0
sys/lib/antiword/Unicode15

@@ -0,0 +1,305 @@
+#
+#	Name:             ISO/IEC 8859-15:1999 to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             1999 July 27
+#	Authors:          Markus Kuhn <mkuhn@acm.org>
+#			  Ken Whistler <kenw@sybase.com>
+#
+#	Copyright (c) 1998 - 1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       ISO/IEC 8859-15:1999 characters map into Unicode.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the ISO/IEC 8859-15 code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in ISO/IEC 8859-15 order.
+#
+#	Version history
+#
+#	Updated versions of this file may be found in:
+#		<ftp://ftp.unicode.org/Public/MAPPINGS/>
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+#RISC OS
+# This file was changed to match RISC OS specific characters (0x80 - 0x9f)
+#RISC OS
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x0080	#	<control>
+0x81	0x0174	#	CAPITAL W CIRCUMFLEX ACCENT
+0x82	0x0175	#	SMALL W CIRCUMFLEX ACCENT
+0x83	0x0083	#	<control>
+0x84	0x0084	#	<control>
+0x85	0x0176	#	CAPITAL Y CIRCUMFLEX ACCENT
+0x86	0x0177	#	SMALL Y CIRCUMFLEX ACCENT
+0x87	0x0087	#	<control>
+0x88	0x0088	#	<control>
+0x89	0x0089	#	<control>
+0x8A	0x008A	#	<control>
+0x8B	0x008B	#	<control>
+0x8C	0x2026	#	ELLIPSIS
+0x8D	0x2122	#	TRADEMARK
+0x8E	0x2030	#	PER MILLE SIGN
+0x8F	0x2022	#	BULLET
+0x90	0x2018	#	LEFT SINGLE QUOTE
+0x91	0x2019	#	RIGHT SINGLE QUOTE
+0x92	0x2039	#	LEFT SINGLE QUOTATION MARK
+0x93	0x203A	#	RIGHT SINGLE QUOTATION MARK
+0x94	0x201C	#	OPENING DOUBLE QUOTE
+0x95	0x201D	#	CLOSING DOUBLE QUOTE
+0x96	0x201E	#	LOW DOUBLE QUOTE
+0x97	0x2013	#	EN DASH
+0x98	0x2014	#	EM_DASH
+0x99	0x2011	#	NON BREAKING HYPHEN
+0x9A	0x009A	#	<control>
+0x9B	0x009B	#	<control>
+0x9C	0x2020	#	DAGGER
+0x9D	0x2021	#	DOUBLE DAGGER
+0x9E	0xFB01	#	Fi
+0x9F	0xFB02	#	Fl
+0xA0	0x00A0	#	NO-BREAK SPACE
+0xA1	0x00A1	#	INVERTED EXCLAMATION MARK
+0xA2	0x00A2	#	CENT SIGN
+0xA3	0x00A3	#	POUND SIGN
+0xA4	0x20AC	#	EURO SIGN
+0xA5	0x00A5	#	YEN SIGN
+0xA6	0x0160	#	LATIN CAPITAL LETTER S WITH CARON
+0xA7	0x00A7	#	SECTION SIGN
+0xA8	0x0161	#	LATIN SMALL LETTER S WITH CARON
+0xA9	0x00A9	#	COPYRIGHT SIGN
+0xAA	0x00AA	#	FEMININE ORDINAL INDICATOR
+0xAB	0x00AB	#	LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#	NOT SIGN
+0xAD	0x00AD	#	SOFT HYPHEN
+0xAE	0x00AE	#	REGISTERED SIGN
+0xAF	0x00AF	#	MACRON
+0xB0	0x00B0	#	DEGREE SIGN
+0xB1	0x00B1	#	PLUS-MINUS SIGN
+0xB2	0x00B2	#	SUPERSCRIPT TWO
+0xB3	0x00B3	#	SUPERSCRIPT THREE
+0xB4	0x017D	#	LATIN CAPITAL LETTER Z WITH CARON
+0xB5	0x00B5	#	MICRO SIGN
+0xB6	0x00B6	#	PILCROW SIGN
+0xB7	0x00B7	#	MIDDLE DOT
+0xB8	0x017E	#	LATIN SMALL LETTER Z WITH CARON
+0xB9	0x00B9	#	SUPERSCRIPT ONE
+0xBA	0x00BA	#	MASCULINE ORDINAL INDICATOR
+0xBB	0x00BB	#	RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x0152	#	LATIN CAPITAL LIGATURE OE
+0xBD	0x0153	#	LATIN SMALL LIGATURE OE
+0xBE	0x0178	#	LATIN CAPITAL LETTER Y WITH DIAERESIS
+0xBF	0x00BF	#	INVERTED QUESTION MARK
+0xC0	0x00C0	#	LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#	LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#	LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#	LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#	LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#	LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#	LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#	LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#	LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#	LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#	LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#	LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#	LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#	LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#	LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#	LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x00D0	#	LATIN CAPITAL LETTER ETH
+0xD1	0x00D1	#	LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#	LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#	LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#	LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#	LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#	LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#	MULTIPLICATION SIGN
+0xD8	0x00D8	#	LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#	LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#	LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#	LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#	LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#	LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x00DE	#	LATIN CAPITAL LETTER THORN
+0xDF	0x00DF	#	LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#	LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#	LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#	LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#	LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#	LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#	LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#	LATIN SMALL LETTER AE
+0xE7	0x00E7	#	LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#	LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#	LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#	LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#	LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#	LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#	LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#	LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#	LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x00F0	#	LATIN SMALL LETTER ETH
+0xF1	0x00F1	#	LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#	LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#	LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#	LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#	LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#	LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#	DIVISION SIGN
+0xF8	0x00F8	#	LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#	LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#	LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#	LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#	LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#	LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x00FE	#	LATIN SMALL LETTER THORN
+0xFF	0x00FF	#	LATIN SMALL LETTER Y WITH DIAERESIS

+ 274 - 0
sys/lib/antiword/cp1250.txt

@@ -0,0 +1,274 @@
+#
+#    Name:     cp1250 to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.01
+#    Table format:  Format A
+#    Date:          04/15/98
+#
+#    Contact:       cpxlate@microsoft.com
+#
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp1250 code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp1250 order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0A	0x000A	#LINE FEED
+0x0B	0x000B	#VERTICAL TABULATION
+0x0C	0x000C	#FORM FEED
+0x0D	0x000D	#CARRIAGE RETURN
+0x0E	0x000E	#SHIFT OUT
+0x0F	0x000F	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1A	0x001A	#SUBSTITUTE
+0x1B	0x001B	#ESCAPE
+0x1C	0x001C	#FILE SEPARATOR
+0x1D	0x001D	#GROUP SEPARATOR
+0x1E	0x001E	#RECORD SEPARATOR
+0x1F	0x001F	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2A	0x002A	#ASTERISK
+0x2B	0x002B	#PLUS SIGN
+0x2C	0x002C	#COMMA
+0x2D	0x002D	#HYPHEN-MINUS
+0x2E	0x002E	#FULL STOP
+0x2F	0x002F	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3A	0x003A	#COLON
+0x3B	0x003B	#SEMICOLON
+0x3C	0x003C	#LESS-THAN SIGN
+0x3D	0x003D	#EQUALS SIGN
+0x3E	0x003E	#GREATER-THAN SIGN
+0x3F	0x003F	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4A	0x004A	#LATIN CAPITAL LETTER J
+0x4B	0x004B	#LATIN CAPITAL LETTER K
+0x4C	0x004C	#LATIN CAPITAL LETTER L
+0x4D	0x004D	#LATIN CAPITAL LETTER M
+0x4E	0x004E	#LATIN CAPITAL LETTER N
+0x4F	0x004F	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5A	0x005A	#LATIN CAPITAL LETTER Z
+0x5B	0x005B	#LEFT SQUARE BRACKET
+0x5C	0x005C	#REVERSE SOLIDUS
+0x5D	0x005D	#RIGHT SQUARE BRACKET
+0x5E	0x005E	#CIRCUMFLEX ACCENT
+0x5F	0x005F	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6A	0x006A	#LATIN SMALL LETTER J
+0x6B	0x006B	#LATIN SMALL LETTER K
+0x6C	0x006C	#LATIN SMALL LETTER L
+0x6D	0x006D	#LATIN SMALL LETTER M
+0x6E	0x006E	#LATIN SMALL LETTER N
+0x6F	0x006F	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7A	0x007A	#LATIN SMALL LETTER Z
+0x7B	0x007B	#LEFT CURLY BRACKET
+0x7C	0x007C	#VERTICAL LINE
+0x7D	0x007D	#RIGHT CURLY BRACKET
+0x7E	0x007E	#TILDE
+0x7F	0x007F	#DELETE
+0x80	0x20AC	#EURO SIGN
+0x81	      	#UNDEFINED
+0x82	0x201A	#SINGLE LOW-9 QUOTATION MARK
+0x83	      	#UNDEFINED
+0x84	0x201E	#DOUBLE LOW-9 QUOTATION MARK
+0x85	0x2026	#HORIZONTAL ELLIPSIS
+0x86	0x2020	#DAGGER
+0x87	0x2021	#DOUBLE DAGGER
+0x88	      	#UNDEFINED
+0x89	0x2030	#PER MILLE SIGN
+0x8A	0x0160	#LATIN CAPITAL LETTER S WITH CARON
+0x8B	0x2039	#SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+0x8C	0x015A	#LATIN CAPITAL LETTER S WITH ACUTE
+0x8D	0x0164	#LATIN CAPITAL LETTER T WITH CARON
+0x8E	0x017D	#LATIN CAPITAL LETTER Z WITH CARON
+0x8F	0x0179	#LATIN CAPITAL LETTER Z WITH ACUTE
+0x90	      	#UNDEFINED
+0x91	0x2018	#LEFT SINGLE QUOTATION MARK
+0x92	0x2019	#RIGHT SINGLE QUOTATION MARK
+0x93	0x201C	#LEFT DOUBLE QUOTATION MARK
+0x94	0x201D	#RIGHT DOUBLE QUOTATION MARK
+0x95	0x2022	#BULLET
+0x96	0x2013	#EN DASH
+0x97	0x2014	#EM DASH
+0x98	      	#UNDEFINED
+0x99	0x2122	#TRADE MARK SIGN
+0x9A	0x0161	#LATIN SMALL LETTER S WITH CARON
+0x9B	0x203A	#SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+0x9C	0x015B	#LATIN SMALL LETTER S WITH ACUTE
+0x9D	0x0165	#LATIN SMALL LETTER T WITH CARON
+0x9E	0x017E	#LATIN SMALL LETTER Z WITH CARON
+0x9F	0x017A	#LATIN SMALL LETTER Z WITH ACUTE
+0xA0	0x00A0	#NO-BREAK SPACE
+0xA1	0x02C7	#CARON
+0xA2	0x02D8	#BREVE
+0xA3	0x0141	#LATIN CAPITAL LETTER L WITH STROKE
+0xA4	0x00A4	#CURRENCY SIGN
+0xA5	0x0104	#LATIN CAPITAL LETTER A WITH OGONEK
+0xA6	0x00A6	#BROKEN BAR
+0xA7	0x00A7	#SECTION SIGN
+0xA8	0x00A8	#DIAERESIS
+0xA9	0x00A9	#COPYRIGHT SIGN
+0xAA	0x015E	#LATIN CAPITAL LETTER S WITH CEDILLA
+0xAB	0x00AB	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#NOT SIGN
+0xAD	0x00AD	#SOFT HYPHEN
+0xAE	0x00AE	#REGISTERED SIGN
+0xAF	0x017B	#LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xB0	0x00B0	#DEGREE SIGN
+0xB1	0x00B1	#PLUS-MINUS SIGN
+0xB2	0x02DB	#OGONEK
+0xB3	0x0142	#LATIN SMALL LETTER L WITH STROKE
+0xB4	0x00B4	#ACUTE ACCENT
+0xB5	0x00B5	#MICRO SIGN
+0xB6	0x00B6	#PILCROW SIGN
+0xB7	0x00B7	#MIDDLE DOT
+0xB8	0x00B8	#CEDILLA
+0xB9	0x0105	#LATIN SMALL LETTER A WITH OGONEK
+0xBA	0x015F	#LATIN SMALL LETTER S WITH CEDILLA
+0xBB	0x00BB	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x013D	#LATIN CAPITAL LETTER L WITH CARON
+0xBD	0x02DD	#DOUBLE ACUTE ACCENT
+0xBE	0x013E	#LATIN SMALL LETTER L WITH CARON
+0xBF	0x017C	#LATIN SMALL LETTER Z WITH DOT ABOVE
+0xC0	0x0154	#LATIN CAPITAL LETTER R WITH ACUTE
+0xC1	0x00C1	#LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x0102	#LATIN CAPITAL LETTER A WITH BREVE
+0xC4	0x00C4	#LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x0139	#LATIN CAPITAL LETTER L WITH ACUTE
+0xC6	0x0106	#LATIN CAPITAL LETTER C WITH ACUTE
+0xC7	0x00C7	#LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x010C	#LATIN CAPITAL LETTER C WITH CARON
+0xC9	0x00C9	#LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x0118	#LATIN CAPITAL LETTER E WITH OGONEK
+0xCB	0x00CB	#LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x011A	#LATIN CAPITAL LETTER E WITH CARON
+0xCD	0x00CD	#LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x010E	#LATIN CAPITAL LETTER D WITH CARON
+0xD0	0x0110	#LATIN CAPITAL LETTER D WITH STROKE
+0xD1	0x0143	#LATIN CAPITAL LETTER N WITH ACUTE
+0xD2	0x0147	#LATIN CAPITAL LETTER N WITH CARON
+0xD3	0x00D3	#LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x0150	#LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+0xD6	0x00D6	#LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#MULTIPLICATION SIGN
+0xD8	0x0158	#LATIN CAPITAL LETTER R WITH CARON
+0xD9	0x016E	#LATIN CAPITAL LETTER U WITH RING ABOVE
+0xDA	0x00DA	#LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x0170	#LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+0xDC	0x00DC	#LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x0162	#LATIN CAPITAL LETTER T WITH CEDILLA
+0xDF	0x00DF	#LATIN SMALL LETTER SHARP S
+0xE0	0x0155	#LATIN SMALL LETTER R WITH ACUTE
+0xE1	0x00E1	#LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x0103	#LATIN SMALL LETTER A WITH BREVE
+0xE4	0x00E4	#LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x013A	#LATIN SMALL LETTER L WITH ACUTE
+0xE6	0x0107	#LATIN SMALL LETTER C WITH ACUTE
+0xE7	0x00E7	#LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x010D	#LATIN SMALL LETTER C WITH CARON
+0xE9	0x00E9	#LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x0119	#LATIN SMALL LETTER E WITH OGONEK
+0xEB	0x00EB	#LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x011B	#LATIN SMALL LETTER E WITH CARON
+0xED	0x00ED	#LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x010F	#LATIN SMALL LETTER D WITH CARON
+0xF0	0x0111	#LATIN SMALL LETTER D WITH STROKE
+0xF1	0x0144	#LATIN SMALL LETTER N WITH ACUTE
+0xF2	0x0148	#LATIN SMALL LETTER N WITH CARON
+0xF3	0x00F3	#LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x0151	#LATIN SMALL LETTER O WITH DOUBLE ACUTE
+0xF6	0x00F6	#LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#DIVISION SIGN
+0xF8	0x0159	#LATIN SMALL LETTER R WITH CARON
+0xF9	0x016F	#LATIN SMALL LETTER U WITH RING ABOVE
+0xFA	0x00FA	#LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x0171	#LATIN SMALL LETTER U WITH DOUBLE ACUTE
+0xFC	0x00FC	#LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x0163	#LATIN SMALL LETTER T WITH CEDILLA
+0xFF	0x02D9	#DOT ABOVE

+ 274 - 0
sys/lib/antiword/cp1251.txt

@@ -0,0 +1,274 @@
+#
+#    Name:     cp1251 to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.01
+#    Table format:  Format A
+#    Date:          04/15/98
+#
+#    Contact:       cpxlate@microsoft.com
+#
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp1251 code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp1251 order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0A	0x000A	#LINE FEED
+0x0B	0x000B	#VERTICAL TABULATION
+0x0C	0x000C	#FORM FEED
+0x0D	0x000D	#CARRIAGE RETURN
+0x0E	0x000E	#SHIFT OUT
+0x0F	0x000F	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1A	0x001A	#SUBSTITUTE
+0x1B	0x001B	#ESCAPE
+0x1C	0x001C	#FILE SEPARATOR
+0x1D	0x001D	#GROUP SEPARATOR
+0x1E	0x001E	#RECORD SEPARATOR
+0x1F	0x001F	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2A	0x002A	#ASTERISK
+0x2B	0x002B	#PLUS SIGN
+0x2C	0x002C	#COMMA
+0x2D	0x002D	#HYPHEN-MINUS
+0x2E	0x002E	#FULL STOP
+0x2F	0x002F	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3A	0x003A	#COLON
+0x3B	0x003B	#SEMICOLON
+0x3C	0x003C	#LESS-THAN SIGN
+0x3D	0x003D	#EQUALS SIGN
+0x3E	0x003E	#GREATER-THAN SIGN
+0x3F	0x003F	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4A	0x004A	#LATIN CAPITAL LETTER J
+0x4B	0x004B	#LATIN CAPITAL LETTER K
+0x4C	0x004C	#LATIN CAPITAL LETTER L
+0x4D	0x004D	#LATIN CAPITAL LETTER M
+0x4E	0x004E	#LATIN CAPITAL LETTER N
+0x4F	0x004F	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5A	0x005A	#LATIN CAPITAL LETTER Z
+0x5B	0x005B	#LEFT SQUARE BRACKET
+0x5C	0x005C	#REVERSE SOLIDUS
+0x5D	0x005D	#RIGHT SQUARE BRACKET
+0x5E	0x005E	#CIRCUMFLEX ACCENT
+0x5F	0x005F	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6A	0x006A	#LATIN SMALL LETTER J
+0x6B	0x006B	#LATIN SMALL LETTER K
+0x6C	0x006C	#LATIN SMALL LETTER L
+0x6D	0x006D	#LATIN SMALL LETTER M
+0x6E	0x006E	#LATIN SMALL LETTER N
+0x6F	0x006F	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7A	0x007A	#LATIN SMALL LETTER Z
+0x7B	0x007B	#LEFT CURLY BRACKET
+0x7C	0x007C	#VERTICAL LINE
+0x7D	0x007D	#RIGHT CURLY BRACKET
+0x7E	0x007E	#TILDE
+0x7F	0x007F	#DELETE
+0x80	0x0402	#CYRILLIC CAPITAL LETTER DJE
+0x81	0x0403	#CYRILLIC CAPITAL LETTER GJE
+0x82	0x201A	#SINGLE LOW-9 QUOTATION MARK
+0x83	0x0453	#CYRILLIC SMALL LETTER GJE
+0x84	0x201E	#DOUBLE LOW-9 QUOTATION MARK
+0x85	0x2026	#HORIZONTAL ELLIPSIS
+0x86	0x2020	#DAGGER
+0x87	0x2021	#DOUBLE DAGGER
+0x88	0x20AC	#EURO SIGN
+0x89	0x2030	#PER MILLE SIGN
+0x8A	0x0409	#CYRILLIC CAPITAL LETTER LJE
+0x8B	0x2039	#SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+0x8C	0x040A	#CYRILLIC CAPITAL LETTER NJE
+0x8D	0x040C	#CYRILLIC CAPITAL LETTER KJE
+0x8E	0x040B	#CYRILLIC CAPITAL LETTER TSHE
+0x8F	0x040F	#CYRILLIC CAPITAL LETTER DZHE
+0x90	0x0452	#CYRILLIC SMALL LETTER DJE
+0x91	0x2018	#LEFT SINGLE QUOTATION MARK
+0x92	0x2019	#RIGHT SINGLE QUOTATION MARK
+0x93	0x201C	#LEFT DOUBLE QUOTATION MARK
+0x94	0x201D	#RIGHT DOUBLE QUOTATION MARK
+0x95	0x2022	#BULLET
+0x96	0x2013	#EN DASH
+0x97	0x2014	#EM DASH
+0x98	      	#UNDEFINED
+0x99	0x2122	#TRADE MARK SIGN
+0x9A	0x0459	#CYRILLIC SMALL LETTER LJE
+0x9B	0x203A	#SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+0x9C	0x045A	#CYRILLIC SMALL LETTER NJE
+0x9D	0x045C	#CYRILLIC SMALL LETTER KJE
+0x9E	0x045B	#CYRILLIC SMALL LETTER TSHE
+0x9F	0x045F	#CYRILLIC SMALL LETTER DZHE
+0xA0	0x00A0	#NO-BREAK SPACE
+0xA1	0x040E	#CYRILLIC CAPITAL LETTER SHORT U
+0xA2	0x045E	#CYRILLIC SMALL LETTER SHORT U
+0xA3	0x0408	#CYRILLIC CAPITAL LETTER JE
+0xA4	0x00A4	#CURRENCY SIGN
+0xA5	0x0490	#CYRILLIC CAPITAL LETTER GHE WITH UPTURN
+0xA6	0x00A6	#BROKEN BAR
+0xA7	0x00A7	#SECTION SIGN
+0xA8	0x0401	#CYRILLIC CAPITAL LETTER IO
+0xA9	0x00A9	#COPYRIGHT SIGN
+0xAA	0x0404	#CYRILLIC CAPITAL LETTER UKRAINIAN IE
+0xAB	0x00AB	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#NOT SIGN
+0xAD	0x00AD	#SOFT HYPHEN
+0xAE	0x00AE	#REGISTERED SIGN
+0xAF	0x0407	#CYRILLIC CAPITAL LETTER YI
+0xB0	0x00B0	#DEGREE SIGN
+0xB1	0x00B1	#PLUS-MINUS SIGN
+0xB2	0x0406	#CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I
+0xB3	0x0456	#CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I
+0xB4	0x0491	#CYRILLIC SMALL LETTER GHE WITH UPTURN
+0xB5	0x00B5	#MICRO SIGN
+0xB6	0x00B6	#PILCROW SIGN
+0xB7	0x00B7	#MIDDLE DOT
+0xB8	0x0451	#CYRILLIC SMALL LETTER IO
+0xB9	0x2116	#NUMERO SIGN
+0xBA	0x0454	#CYRILLIC SMALL LETTER UKRAINIAN IE
+0xBB	0x00BB	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x0458	#CYRILLIC SMALL LETTER JE
+0xBD	0x0405	#CYRILLIC CAPITAL LETTER DZE
+0xBE	0x0455	#CYRILLIC SMALL LETTER DZE
+0xBF	0x0457	#CYRILLIC SMALL LETTER YI
+0xC0	0x0410	#CYRILLIC CAPITAL LETTER A
+0xC1	0x0411	#CYRILLIC CAPITAL LETTER BE
+0xC2	0x0412	#CYRILLIC CAPITAL LETTER VE
+0xC3	0x0413	#CYRILLIC CAPITAL LETTER GHE
+0xC4	0x0414	#CYRILLIC CAPITAL LETTER DE
+0xC5	0x0415	#CYRILLIC CAPITAL LETTER IE
+0xC6	0x0416	#CYRILLIC CAPITAL LETTER ZHE
+0xC7	0x0417	#CYRILLIC CAPITAL LETTER ZE
+0xC8	0x0418	#CYRILLIC CAPITAL LETTER I
+0xC9	0x0419	#CYRILLIC CAPITAL LETTER SHORT I
+0xCA	0x041A	#CYRILLIC CAPITAL LETTER KA
+0xCB	0x041B	#CYRILLIC CAPITAL LETTER EL
+0xCC	0x041C	#CYRILLIC CAPITAL LETTER EM
+0xCD	0x041D	#CYRILLIC CAPITAL LETTER EN
+0xCE	0x041E	#CYRILLIC CAPITAL LETTER O
+0xCF	0x041F	#CYRILLIC CAPITAL LETTER PE
+0xD0	0x0420	#CYRILLIC CAPITAL LETTER ER
+0xD1	0x0421	#CYRILLIC CAPITAL LETTER ES
+0xD2	0x0422	#CYRILLIC CAPITAL LETTER TE
+0xD3	0x0423	#CYRILLIC CAPITAL LETTER U
+0xD4	0x0424	#CYRILLIC CAPITAL LETTER EF
+0xD5	0x0425	#CYRILLIC CAPITAL LETTER HA
+0xD6	0x0426	#CYRILLIC CAPITAL LETTER TSE
+0xD7	0x0427	#CYRILLIC CAPITAL LETTER CHE
+0xD8	0x0428	#CYRILLIC CAPITAL LETTER SHA
+0xD9	0x0429	#CYRILLIC CAPITAL LETTER SHCHA
+0xDA	0x042A	#CYRILLIC CAPITAL LETTER HARD SIGN
+0xDB	0x042B	#CYRILLIC CAPITAL LETTER YERU
+0xDC	0x042C	#CYRILLIC CAPITAL LETTER SOFT SIGN
+0xDD	0x042D	#CYRILLIC CAPITAL LETTER E
+0xDE	0x042E	#CYRILLIC CAPITAL LETTER YU
+0xDF	0x042F	#CYRILLIC CAPITAL LETTER YA
+0xE0	0x0430	#CYRILLIC SMALL LETTER A
+0xE1	0x0431	#CYRILLIC SMALL LETTER BE
+0xE2	0x0432	#CYRILLIC SMALL LETTER VE
+0xE3	0x0433	#CYRILLIC SMALL LETTER GHE
+0xE4	0x0434	#CYRILLIC SMALL LETTER DE
+0xE5	0x0435	#CYRILLIC SMALL LETTER IE
+0xE6	0x0436	#CYRILLIC SMALL LETTER ZHE
+0xE7	0x0437	#CYRILLIC SMALL LETTER ZE
+0xE8	0x0438	#CYRILLIC SMALL LETTER I
+0xE9	0x0439	#CYRILLIC SMALL LETTER SHORT I
+0xEA	0x043A	#CYRILLIC SMALL LETTER KA
+0xEB	0x043B	#CYRILLIC SMALL LETTER EL
+0xEC	0x043C	#CYRILLIC SMALL LETTER EM
+0xED	0x043D	#CYRILLIC SMALL LETTER EN
+0xEE	0x043E	#CYRILLIC SMALL LETTER O
+0xEF	0x043F	#CYRILLIC SMALL LETTER PE
+0xF0	0x0440	#CYRILLIC SMALL LETTER ER
+0xF1	0x0441	#CYRILLIC SMALL LETTER ES
+0xF2	0x0442	#CYRILLIC SMALL LETTER TE
+0xF3	0x0443	#CYRILLIC SMALL LETTER U
+0xF4	0x0444	#CYRILLIC SMALL LETTER EF
+0xF5	0x0445	#CYRILLIC SMALL LETTER HA
+0xF6	0x0446	#CYRILLIC SMALL LETTER TSE
+0xF7	0x0447	#CYRILLIC SMALL LETTER CHE
+0xF8	0x0448	#CYRILLIC SMALL LETTER SHA
+0xF9	0x0449	#CYRILLIC SMALL LETTER SHCHA
+0xFA	0x044A	#CYRILLIC SMALL LETTER HARD SIGN
+0xFB	0x044B	#CYRILLIC SMALL LETTER YERU
+0xFC	0x044C	#CYRILLIC SMALL LETTER SOFT SIGN
+0xFD	0x044D	#CYRILLIC SMALL LETTER E
+0xFE	0x044E	#CYRILLIC SMALL LETTER YU
+0xFF	0x044F	#CYRILLIC SMALL LETTER YA

+ 274 - 0
sys/lib/antiword/cp1252.txt

@@ -0,0 +1,274 @@
+#
+#    Name:     cp1252 to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.01
+#    Table format:  Format A
+#    Date:          04/15/98
+#
+#    Contact:       cpxlate@microsoft.com
+#
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp1252 code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp1252 order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0A	0x000A	#LINE FEED
+0x0B	0x000B	#VERTICAL TABULATION
+0x0C	0x000C	#FORM FEED
+0x0D	0x000D	#CARRIAGE RETURN
+0x0E	0x000E	#SHIFT OUT
+0x0F	0x000F	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1A	0x001A	#SUBSTITUTE
+0x1B	0x001B	#ESCAPE
+0x1C	0x001C	#FILE SEPARATOR
+0x1D	0x001D	#GROUP SEPARATOR
+0x1E	0x001E	#RECORD SEPARATOR
+0x1F	0x001F	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2A	0x002A	#ASTERISK
+0x2B	0x002B	#PLUS SIGN
+0x2C	0x002C	#COMMA
+0x2D	0x002D	#HYPHEN-MINUS
+0x2E	0x002E	#FULL STOP
+0x2F	0x002F	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3A	0x003A	#COLON
+0x3B	0x003B	#SEMICOLON
+0x3C	0x003C	#LESS-THAN SIGN
+0x3D	0x003D	#EQUALS SIGN
+0x3E	0x003E	#GREATER-THAN SIGN
+0x3F	0x003F	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4A	0x004A	#LATIN CAPITAL LETTER J
+0x4B	0x004B	#LATIN CAPITAL LETTER K
+0x4C	0x004C	#LATIN CAPITAL LETTER L
+0x4D	0x004D	#LATIN CAPITAL LETTER M
+0x4E	0x004E	#LATIN CAPITAL LETTER N
+0x4F	0x004F	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5A	0x005A	#LATIN CAPITAL LETTER Z
+0x5B	0x005B	#LEFT SQUARE BRACKET
+0x5C	0x005C	#REVERSE SOLIDUS
+0x5D	0x005D	#RIGHT SQUARE BRACKET
+0x5E	0x005E	#CIRCUMFLEX ACCENT
+0x5F	0x005F	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6A	0x006A	#LATIN SMALL LETTER J
+0x6B	0x006B	#LATIN SMALL LETTER K
+0x6C	0x006C	#LATIN SMALL LETTER L
+0x6D	0x006D	#LATIN SMALL LETTER M
+0x6E	0x006E	#LATIN SMALL LETTER N
+0x6F	0x006F	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7A	0x007A	#LATIN SMALL LETTER Z
+0x7B	0x007B	#LEFT CURLY BRACKET
+0x7C	0x007C	#VERTICAL LINE
+0x7D	0x007D	#RIGHT CURLY BRACKET
+0x7E	0x007E	#TILDE
+0x7F	0x007F	#DELETE
+0x80	0x20AC	#EURO SIGN
+0x81	      	#UNDEFINED
+0x82	0x201A	#SINGLE LOW-9 QUOTATION MARK
+0x83	0x0192	#LATIN SMALL LETTER F WITH HOOK
+0x84	0x201E	#DOUBLE LOW-9 QUOTATION MARK
+0x85	0x2026	#HORIZONTAL ELLIPSIS
+0x86	0x2020	#DAGGER
+0x87	0x2021	#DOUBLE DAGGER
+0x88	0x02C6	#MODIFIER LETTER CIRCUMFLEX ACCENT
+0x89	0x2030	#PER MILLE SIGN
+0x8A	0x0160	#LATIN CAPITAL LETTER S WITH CARON
+0x8B	0x2039	#SINGLE LEFT-POINTING ANGLE QUOTATION MARK
+0x8C	0x0152	#LATIN CAPITAL LIGATURE OE
+0x8D	      	#UNDEFINED
+0x8E	0x017D	#LATIN CAPITAL LETTER Z WITH CARON
+0x8F	      	#UNDEFINED
+0x90	      	#UNDEFINED
+0x91	0x2018	#LEFT SINGLE QUOTATION MARK
+0x92	0x2019	#RIGHT SINGLE QUOTATION MARK
+0x93	0x201C	#LEFT DOUBLE QUOTATION MARK
+0x94	0x201D	#RIGHT DOUBLE QUOTATION MARK
+0x95	0x2022	#BULLET
+0x96	0x2013	#EN DASH
+0x97	0x2014	#EM DASH
+0x98	0x02DC	#SMALL TILDE
+0x99	0x2122	#TRADE MARK SIGN
+0x9A	0x0161	#LATIN SMALL LETTER S WITH CARON
+0x9B	0x203A	#SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
+0x9C	0x0153	#LATIN SMALL LIGATURE OE
+0x9D	      	#UNDEFINED
+0x9E	0x017E	#LATIN SMALL LETTER Z WITH CARON
+0x9F	0x0178	#LATIN CAPITAL LETTER Y WITH DIAERESIS
+0xA0	0x00A0	#NO-BREAK SPACE
+0xA1	0x00A1	#INVERTED EXCLAMATION MARK
+0xA2	0x00A2	#CENT SIGN
+0xA3	0x00A3	#POUND SIGN
+0xA4	0x00A4	#CURRENCY SIGN
+0xA5	0x00A5	#YEN SIGN
+0xA6	0x00A6	#BROKEN BAR
+0xA7	0x00A7	#SECTION SIGN
+0xA8	0x00A8	#DIAERESIS
+0xA9	0x00A9	#COPYRIGHT SIGN
+0xAA	0x00AA	#FEMININE ORDINAL INDICATOR
+0xAB	0x00AB	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xAC	0x00AC	#NOT SIGN
+0xAD	0x00AD	#SOFT HYPHEN
+0xAE	0x00AE	#REGISTERED SIGN
+0xAF	0x00AF	#MACRON
+0xB0	0x00B0	#DEGREE SIGN
+0xB1	0x00B1	#PLUS-MINUS SIGN
+0xB2	0x00B2	#SUPERSCRIPT TWO
+0xB3	0x00B3	#SUPERSCRIPT THREE
+0xB4	0x00B4	#ACUTE ACCENT
+0xB5	0x00B5	#MICRO SIGN
+0xB6	0x00B6	#PILCROW SIGN
+0xB7	0x00B7	#MIDDLE DOT
+0xB8	0x00B8	#CEDILLA
+0xB9	0x00B9	#SUPERSCRIPT ONE
+0xBA	0x00BA	#MASCULINE ORDINAL INDICATOR
+0xBB	0x00BB	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xBC	0x00BC	#VULGAR FRACTION ONE QUARTER
+0xBD	0x00BD	#VULGAR FRACTION ONE HALF
+0xBE	0x00BE	#VULGAR FRACTION THREE QUARTERS
+0xBF	0x00BF	#INVERTED QUESTION MARK
+0xC0	0x00C0	#LATIN CAPITAL LETTER A WITH GRAVE
+0xC1	0x00C1	#LATIN CAPITAL LETTER A WITH ACUTE
+0xC2	0x00C2	#LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xC3	0x00C3	#LATIN CAPITAL LETTER A WITH TILDE
+0xC4	0x00C4	#LATIN CAPITAL LETTER A WITH DIAERESIS
+0xC5	0x00C5	#LATIN CAPITAL LETTER A WITH RING ABOVE
+0xC6	0x00C6	#LATIN CAPITAL LETTER AE
+0xC7	0x00C7	#LATIN CAPITAL LETTER C WITH CEDILLA
+0xC8	0x00C8	#LATIN CAPITAL LETTER E WITH GRAVE
+0xC9	0x00C9	#LATIN CAPITAL LETTER E WITH ACUTE
+0xCA	0x00CA	#LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xCB	0x00CB	#LATIN CAPITAL LETTER E WITH DIAERESIS
+0xCC	0x00CC	#LATIN CAPITAL LETTER I WITH GRAVE
+0xCD	0x00CD	#LATIN CAPITAL LETTER I WITH ACUTE
+0xCE	0x00CE	#LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xCF	0x00CF	#LATIN CAPITAL LETTER I WITH DIAERESIS
+0xD0	0x00D0	#LATIN CAPITAL LETTER ETH
+0xD1	0x00D1	#LATIN CAPITAL LETTER N WITH TILDE
+0xD2	0x00D2	#LATIN CAPITAL LETTER O WITH GRAVE
+0xD3	0x00D3	#LATIN CAPITAL LETTER O WITH ACUTE
+0xD4	0x00D4	#LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xD5	0x00D5	#LATIN CAPITAL LETTER O WITH TILDE
+0xD6	0x00D6	#LATIN CAPITAL LETTER O WITH DIAERESIS
+0xD7	0x00D7	#MULTIPLICATION SIGN
+0xD8	0x00D8	#LATIN CAPITAL LETTER O WITH STROKE
+0xD9	0x00D9	#LATIN CAPITAL LETTER U WITH GRAVE
+0xDA	0x00DA	#LATIN CAPITAL LETTER U WITH ACUTE
+0xDB	0x00DB	#LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xDC	0x00DC	#LATIN CAPITAL LETTER U WITH DIAERESIS
+0xDD	0x00DD	#LATIN CAPITAL LETTER Y WITH ACUTE
+0xDE	0x00DE	#LATIN CAPITAL LETTER THORN
+0xDF	0x00DF	#LATIN SMALL LETTER SHARP S
+0xE0	0x00E0	#LATIN SMALL LETTER A WITH GRAVE
+0xE1	0x00E1	#LATIN SMALL LETTER A WITH ACUTE
+0xE2	0x00E2	#LATIN SMALL LETTER A WITH CIRCUMFLEX
+0xE3	0x00E3	#LATIN SMALL LETTER A WITH TILDE
+0xE4	0x00E4	#LATIN SMALL LETTER A WITH DIAERESIS
+0xE5	0x00E5	#LATIN SMALL LETTER A WITH RING ABOVE
+0xE6	0x00E6	#LATIN SMALL LETTER AE
+0xE7	0x00E7	#LATIN SMALL LETTER C WITH CEDILLA
+0xE8	0x00E8	#LATIN SMALL LETTER E WITH GRAVE
+0xE9	0x00E9	#LATIN SMALL LETTER E WITH ACUTE
+0xEA	0x00EA	#LATIN SMALL LETTER E WITH CIRCUMFLEX
+0xEB	0x00EB	#LATIN SMALL LETTER E WITH DIAERESIS
+0xEC	0x00EC	#LATIN SMALL LETTER I WITH GRAVE
+0xED	0x00ED	#LATIN SMALL LETTER I WITH ACUTE
+0xEE	0x00EE	#LATIN SMALL LETTER I WITH CIRCUMFLEX
+0xEF	0x00EF	#LATIN SMALL LETTER I WITH DIAERESIS
+0xF0	0x00F0	#LATIN SMALL LETTER ETH
+0xF1	0x00F1	#LATIN SMALL LETTER N WITH TILDE
+0xF2	0x00F2	#LATIN SMALL LETTER O WITH GRAVE
+0xF3	0x00F3	#LATIN SMALL LETTER O WITH ACUTE
+0xF4	0x00F4	#LATIN SMALL LETTER O WITH CIRCUMFLEX
+0xF5	0x00F5	#LATIN SMALL LETTER O WITH TILDE
+0xF6	0x00F6	#LATIN SMALL LETTER O WITH DIAERESIS
+0xF7	0x00F7	#DIVISION SIGN
+0xF8	0x00F8	#LATIN SMALL LETTER O WITH STROKE
+0xF9	0x00F9	#LATIN SMALL LETTER U WITH GRAVE
+0xFA	0x00FA	#LATIN SMALL LETTER U WITH ACUTE
+0xFB	0x00FB	#LATIN SMALL LETTER U WITH CIRCUMFLEX
+0xFC	0x00FC	#LATIN SMALL LETTER U WITH DIAERESIS
+0xFD	0x00FD	#LATIN SMALL LETTER Y WITH ACUTE
+0xFE	0x00FE	#LATIN SMALL LETTER THORN
+0xFF	0x00FF	#LATIN SMALL LETTER Y WITH DIAERESIS

+ 273 - 0
sys/lib/antiword/cp437.txt

@@ -0,0 +1,273 @@
+#
+#    Name:     cp437_DOSLatinUS to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp437_DOSLatinUS code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp437_DOSLatinUS order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0a	0x000a	#LINE FEED
+0x0b	0x000b	#VERTICAL TABULATION
+0x0c	0x000c	#FORM FEED
+0x0d	0x000d	#CARRIAGE RETURN
+0x0e	0x000e	#SHIFT OUT
+0x0f	0x000f	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1a	0x001a	#SUBSTITUTE
+0x1b	0x001b	#ESCAPE
+0x1c	0x001c	#FILE SEPARATOR
+0x1d	0x001d	#GROUP SEPARATOR
+0x1e	0x001e	#RECORD SEPARATOR
+0x1f	0x001f	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2a	0x002a	#ASTERISK
+0x2b	0x002b	#PLUS SIGN
+0x2c	0x002c	#COMMA
+0x2d	0x002d	#HYPHEN-MINUS
+0x2e	0x002e	#FULL STOP
+0x2f	0x002f	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3a	0x003a	#COLON
+0x3b	0x003b	#SEMICOLON
+0x3c	0x003c	#LESS-THAN SIGN
+0x3d	0x003d	#EQUALS SIGN
+0x3e	0x003e	#GREATER-THAN SIGN
+0x3f	0x003f	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4a	0x004a	#LATIN CAPITAL LETTER J
+0x4b	0x004b	#LATIN CAPITAL LETTER K
+0x4c	0x004c	#LATIN CAPITAL LETTER L
+0x4d	0x004d	#LATIN CAPITAL LETTER M
+0x4e	0x004e	#LATIN CAPITAL LETTER N
+0x4f	0x004f	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5a	0x005a	#LATIN CAPITAL LETTER Z
+0x5b	0x005b	#LEFT SQUARE BRACKET
+0x5c	0x005c	#REVERSE SOLIDUS
+0x5d	0x005d	#RIGHT SQUARE BRACKET
+0x5e	0x005e	#CIRCUMFLEX ACCENT
+0x5f	0x005f	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6a	0x006a	#LATIN SMALL LETTER J
+0x6b	0x006b	#LATIN SMALL LETTER K
+0x6c	0x006c	#LATIN SMALL LETTER L
+0x6d	0x006d	#LATIN SMALL LETTER M
+0x6e	0x006e	#LATIN SMALL LETTER N
+0x6f	0x006f	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7a	0x007a	#LATIN SMALL LETTER Z
+0x7b	0x007b	#LEFT CURLY BRACKET
+0x7c	0x007c	#VERTICAL LINE
+0x7d	0x007d	#RIGHT CURLY BRACKET
+0x7e	0x007e	#TILDE
+0x7f	0x007f	#DELETE
+0x80	0x00c7	#LATIN CAPITAL LETTER C WITH CEDILLA
+0x81	0x00fc	#LATIN SMALL LETTER U WITH DIAERESIS
+0x82	0x00e9	#LATIN SMALL LETTER E WITH ACUTE
+0x83	0x00e2	#LATIN SMALL LETTER A WITH CIRCUMFLEX
+0x84	0x00e4	#LATIN SMALL LETTER A WITH DIAERESIS
+0x85	0x00e0	#LATIN SMALL LETTER A WITH GRAVE
+0x86	0x00e5	#LATIN SMALL LETTER A WITH RING ABOVE
+0x87	0x00e7	#LATIN SMALL LETTER C WITH CEDILLA
+0x88	0x00ea	#LATIN SMALL LETTER E WITH CIRCUMFLEX
+0x89	0x00eb	#LATIN SMALL LETTER E WITH DIAERESIS
+0x8a	0x00e8	#LATIN SMALL LETTER E WITH GRAVE
+0x8b	0x00ef	#LATIN SMALL LETTER I WITH DIAERESIS
+0x8c	0x00ee	#LATIN SMALL LETTER I WITH CIRCUMFLEX
+0x8d	0x00ec	#LATIN SMALL LETTER I WITH GRAVE
+0x8e	0x00c4	#LATIN CAPITAL LETTER A WITH DIAERESIS
+0x8f	0x00c5	#LATIN CAPITAL LETTER A WITH RING ABOVE
+0x90	0x00c9	#LATIN CAPITAL LETTER E WITH ACUTE
+0x91	0x00e6	#LATIN SMALL LIGATURE AE
+0x92	0x00c6	#LATIN CAPITAL LIGATURE AE
+0x93	0x00f4	#LATIN SMALL LETTER O WITH CIRCUMFLEX
+0x94	0x00f6	#LATIN SMALL LETTER O WITH DIAERESIS
+0x95	0x00f2	#LATIN SMALL LETTER O WITH GRAVE
+0x96	0x00fb	#LATIN SMALL LETTER U WITH CIRCUMFLEX
+0x97	0x00f9	#LATIN SMALL LETTER U WITH GRAVE
+0x98	0x00ff	#LATIN SMALL LETTER Y WITH DIAERESIS
+0x99	0x00d6	#LATIN CAPITAL LETTER O WITH DIAERESIS
+0x9a	0x00dc	#LATIN CAPITAL LETTER U WITH DIAERESIS
+0x9b	0x00a2	#CENT SIGN
+0x9c	0x00a3	#POUND SIGN
+0x9d	0x00a5	#YEN SIGN
+0x9e	0x20a7	#PESETA SIGN
+0x9f	0x0192	#LATIN SMALL LETTER F WITH HOOK
+0xa0	0x00e1	#LATIN SMALL LETTER A WITH ACUTE
+0xa1	0x00ed	#LATIN SMALL LETTER I WITH ACUTE
+0xa2	0x00f3	#LATIN SMALL LETTER O WITH ACUTE
+0xa3	0x00fa	#LATIN SMALL LETTER U WITH ACUTE
+0xa4	0x00f1	#LATIN SMALL LETTER N WITH TILDE
+0xa5	0x00d1	#LATIN CAPITAL LETTER N WITH TILDE
+0xa6	0x00aa	#FEMININE ORDINAL INDICATOR
+0xa7	0x00ba	#MASCULINE ORDINAL INDICATOR
+0xa8	0x00bf	#INVERTED QUESTION MARK
+0xa9	0x2310	#REVERSED NOT SIGN
+0xaa	0x00ac	#NOT SIGN
+0xab	0x00bd	#VULGAR FRACTION ONE HALF
+0xac	0x00bc	#VULGAR FRACTION ONE QUARTER
+0xad	0x00a1	#INVERTED EXCLAMATION MARK
+0xae	0x00ab	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xaf	0x00bb	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xb0	0x2591	#LIGHT SHADE
+0xb1	0x2592	#MEDIUM SHADE
+0xb2	0x2593	#DARK SHADE
+0xb3	0x2502	#BOX DRAWINGS LIGHT VERTICAL
+0xb4	0x2524	#BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xb5	0x2561	#BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xb6	0x2562	#BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+0xb7	0x2556	#BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+0xb8	0x2555	#BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+0xb9	0x2563	#BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xba	0x2551	#BOX DRAWINGS DOUBLE VERTICAL
+0xbb	0x2557	#BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xbc	0x255d	#BOX DRAWINGS DOUBLE UP AND LEFT
+0xbd	0x255c	#BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+0xbe	0x255b	#BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+0xbf	0x2510	#BOX DRAWINGS LIGHT DOWN AND LEFT
+0xc0	0x2514	#BOX DRAWINGS LIGHT UP AND RIGHT
+0xc1	0x2534	#BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xc2	0x252c	#BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xc3	0x251c	#BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xc4	0x2500	#BOX DRAWINGS LIGHT HORIZONTAL
+0xc5	0x253c	#BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xc6	0x255e	#BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xc7	0x255f	#BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+0xc8	0x255a	#BOX DRAWINGS DOUBLE UP AND RIGHT
+0xc9	0x2554	#BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xca	0x2569	#BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xcb	0x2566	#BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xcc	0x2560	#BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xcd	0x2550	#BOX DRAWINGS DOUBLE HORIZONTAL
+0xce	0x256c	#BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xcf	0x2567	#BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+0xd0	0x2568	#BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+0xd1	0x2564	#BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+0xd2	0x2565	#BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+0xd3	0x2559	#BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+0xd4	0x2558	#BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+0xd5	0x2552	#BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+0xd6	0x2553	#BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+0xd7	0x256b	#BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+0xd8	0x256a	#BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xd9	0x2518	#BOX DRAWINGS LIGHT UP AND LEFT
+0xda	0x250c	#BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xdb	0x2588	#FULL BLOCK
+0xdc	0x2584	#LOWER HALF BLOCK
+0xdd	0x258c	#LEFT HALF BLOCK
+0xde	0x2590	#RIGHT HALF BLOCK
+0xdf	0x2580	#UPPER HALF BLOCK
+0xe0	0x03b1	#GREEK SMALL LETTER ALPHA
+0xe1	0x00df	#LATIN SMALL LETTER SHARP S
+0xe2	0x0393	#GREEK CAPITAL LETTER GAMMA
+0xe3	0x03c0	#GREEK SMALL LETTER PI
+0xe4	0x03a3	#GREEK CAPITAL LETTER SIGMA
+0xe5	0x03c3	#GREEK SMALL LETTER SIGMA
+0xe6	0x00b5	#MICRO SIGN
+0xe7	0x03c4	#GREEK SMALL LETTER TAU
+0xe8	0x03a6	#GREEK CAPITAL LETTER PHI
+0xe9	0x0398	#GREEK CAPITAL LETTER THETA
+0xea	0x03a9	#GREEK CAPITAL LETTER OMEGA
+0xeb	0x03b4	#GREEK SMALL LETTER DELTA
+0xec	0x221e	#INFINITY
+0xed	0x03c6	#GREEK SMALL LETTER PHI
+0xee	0x03b5	#GREEK SMALL LETTER EPSILON
+0xef	0x2229	#INTERSECTION
+0xf0	0x2261	#IDENTICAL TO
+0xf1	0x00b1	#PLUS-MINUS SIGN
+0xf2	0x2265	#GREATER-THAN OR EQUAL TO
+0xf3	0x2264	#LESS-THAN OR EQUAL TO
+0xf4	0x2320	#TOP HALF INTEGRAL
+0xf5	0x2321	#BOTTOM HALF INTEGRAL
+0xf6	0x00f7	#DIVISION SIGN
+0xf7	0x2248	#ALMOST EQUAL TO
+0xf8	0x00b0	#DEGREE SIGN
+0xf9	0x2219	#BULLET OPERATOR
+0xfa	0x00b7	#MIDDLE DOT
+0xfb	0x221a	#SQUARE ROOT
+0xfc	0x207f	#SUPERSCRIPT LATIN SMALL LETTER N
+0xfd	0x00b2	#SUPERSCRIPT TWO
+0xfe	0x25a0	#BLACK SQUARE
+0xff	0x00a0	#NO-BREAK SPACE

+ 273 - 0
sys/lib/antiword/cp850.txt

@@ -0,0 +1,273 @@
+#
+#    Name:     cp850_DOSLatin1 to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp850_DOSLatin1 code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp850_DOSLatin1 order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0a	0x000a	#LINE FEED
+0x0b	0x000b	#VERTICAL TABULATION
+0x0c	0x000c	#FORM FEED
+0x0d	0x000d	#CARRIAGE RETURN
+0x0e	0x000e	#SHIFT OUT
+0x0f	0x000f	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1a	0x001a	#SUBSTITUTE
+0x1b	0x001b	#ESCAPE
+0x1c	0x001c	#FILE SEPARATOR
+0x1d	0x001d	#GROUP SEPARATOR
+0x1e	0x001e	#RECORD SEPARATOR
+0x1f	0x001f	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2a	0x002a	#ASTERISK
+0x2b	0x002b	#PLUS SIGN
+0x2c	0x002c	#COMMA
+0x2d	0x002d	#HYPHEN-MINUS
+0x2e	0x002e	#FULL STOP
+0x2f	0x002f	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3a	0x003a	#COLON
+0x3b	0x003b	#SEMICOLON
+0x3c	0x003c	#LESS-THAN SIGN
+0x3d	0x003d	#EQUALS SIGN
+0x3e	0x003e	#GREATER-THAN SIGN
+0x3f	0x003f	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4a	0x004a	#LATIN CAPITAL LETTER J
+0x4b	0x004b	#LATIN CAPITAL LETTER K
+0x4c	0x004c	#LATIN CAPITAL LETTER L
+0x4d	0x004d	#LATIN CAPITAL LETTER M
+0x4e	0x004e	#LATIN CAPITAL LETTER N
+0x4f	0x004f	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5a	0x005a	#LATIN CAPITAL LETTER Z
+0x5b	0x005b	#LEFT SQUARE BRACKET
+0x5c	0x005c	#REVERSE SOLIDUS
+0x5d	0x005d	#RIGHT SQUARE BRACKET
+0x5e	0x005e	#CIRCUMFLEX ACCENT
+0x5f	0x005f	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6a	0x006a	#LATIN SMALL LETTER J
+0x6b	0x006b	#LATIN SMALL LETTER K
+0x6c	0x006c	#LATIN SMALL LETTER L
+0x6d	0x006d	#LATIN SMALL LETTER M
+0x6e	0x006e	#LATIN SMALL LETTER N
+0x6f	0x006f	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7a	0x007a	#LATIN SMALL LETTER Z
+0x7b	0x007b	#LEFT CURLY BRACKET
+0x7c	0x007c	#VERTICAL LINE
+0x7d	0x007d	#RIGHT CURLY BRACKET
+0x7e	0x007e	#TILDE
+0x7f	0x007f	#DELETE
+0x80	0x00c7	#LATIN CAPITAL LETTER C WITH CEDILLA
+0x81	0x00fc	#LATIN SMALL LETTER U WITH DIAERESIS
+0x82	0x00e9	#LATIN SMALL LETTER E WITH ACUTE
+0x83	0x00e2	#LATIN SMALL LETTER A WITH CIRCUMFLEX
+0x84	0x00e4	#LATIN SMALL LETTER A WITH DIAERESIS
+0x85	0x00e0	#LATIN SMALL LETTER A WITH GRAVE
+0x86	0x00e5	#LATIN SMALL LETTER A WITH RING ABOVE
+0x87	0x00e7	#LATIN SMALL LETTER C WITH CEDILLA
+0x88	0x00ea	#LATIN SMALL LETTER E WITH CIRCUMFLEX
+0x89	0x00eb	#LATIN SMALL LETTER E WITH DIAERESIS
+0x8a	0x00e8	#LATIN SMALL LETTER E WITH GRAVE
+0x8b	0x00ef	#LATIN SMALL LETTER I WITH DIAERESIS
+0x8c	0x00ee	#LATIN SMALL LETTER I WITH CIRCUMFLEX
+0x8d	0x00ec	#LATIN SMALL LETTER I WITH GRAVE
+0x8e	0x00c4	#LATIN CAPITAL LETTER A WITH DIAERESIS
+0x8f	0x00c5	#LATIN CAPITAL LETTER A WITH RING ABOVE
+0x90	0x00c9	#LATIN CAPITAL LETTER E WITH ACUTE
+0x91	0x00e6	#LATIN SMALL LIGATURE AE
+0x92	0x00c6	#LATIN CAPITAL LIGATURE AE
+0x93	0x00f4	#LATIN SMALL LETTER O WITH CIRCUMFLEX
+0x94	0x00f6	#LATIN SMALL LETTER O WITH DIAERESIS
+0x95	0x00f2	#LATIN SMALL LETTER O WITH GRAVE
+0x96	0x00fb	#LATIN SMALL LETTER U WITH CIRCUMFLEX
+0x97	0x00f9	#LATIN SMALL LETTER U WITH GRAVE
+0x98	0x00ff	#LATIN SMALL LETTER Y WITH DIAERESIS
+0x99	0x00d6	#LATIN CAPITAL LETTER O WITH DIAERESIS
+0x9a	0x00dc	#LATIN CAPITAL LETTER U WITH DIAERESIS
+0x9b	0x00f8	#LATIN SMALL LETTER O WITH STROKE
+0x9c	0x00a3	#POUND SIGN
+0x9d	0x00d8	#LATIN CAPITAL LETTER O WITH STROKE
+0x9e	0x00d7	#MULTIPLICATION SIGN
+0x9f	0x0192	#LATIN SMALL LETTER F WITH HOOK
+0xa0	0x00e1	#LATIN SMALL LETTER A WITH ACUTE
+0xa1	0x00ed	#LATIN SMALL LETTER I WITH ACUTE
+0xa2	0x00f3	#LATIN SMALL LETTER O WITH ACUTE
+0xa3	0x00fa	#LATIN SMALL LETTER U WITH ACUTE
+0xa4	0x00f1	#LATIN SMALL LETTER N WITH TILDE
+0xa5	0x00d1	#LATIN CAPITAL LETTER N WITH TILDE
+0xa6	0x00aa	#FEMININE ORDINAL INDICATOR
+0xa7	0x00ba	#MASCULINE ORDINAL INDICATOR
+0xa8	0x00bf	#INVERTED QUESTION MARK
+0xa9	0x00ae	#REGISTERED SIGN
+0xaa	0x00ac	#NOT SIGN
+0xab	0x00bd	#VULGAR FRACTION ONE HALF
+0xac	0x00bc	#VULGAR FRACTION ONE QUARTER
+0xad	0x00a1	#INVERTED EXCLAMATION MARK
+0xae	0x00ab	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xaf	0x00bb	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xb0	0x2591	#LIGHT SHADE
+0xb1	0x2592	#MEDIUM SHADE
+0xb2	0x2593	#DARK SHADE
+0xb3	0x2502	#BOX DRAWINGS LIGHT VERTICAL
+0xb4	0x2524	#BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xb5	0x00c1	#LATIN CAPITAL LETTER A WITH ACUTE
+0xb6	0x00c2	#LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xb7	0x00c0	#LATIN CAPITAL LETTER A WITH GRAVE
+0xb8	0x00a9	#COPYRIGHT SIGN
+0xb9	0x2563	#BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xba	0x2551	#BOX DRAWINGS DOUBLE VERTICAL
+0xbb	0x2557	#BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xbc	0x255d	#BOX DRAWINGS DOUBLE UP AND LEFT
+0xbd	0x00a2	#CENT SIGN
+0xbe	0x00a5	#YEN SIGN
+0xbf	0x2510	#BOX DRAWINGS LIGHT DOWN AND LEFT
+0xc0	0x2514	#BOX DRAWINGS LIGHT UP AND RIGHT
+0xc1	0x2534	#BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xc2	0x252c	#BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xc3	0x251c	#BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xc4	0x2500	#BOX DRAWINGS LIGHT HORIZONTAL
+0xc5	0x253c	#BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xc6	0x00e3	#LATIN SMALL LETTER A WITH TILDE
+0xc7	0x00c3	#LATIN CAPITAL LETTER A WITH TILDE
+0xc8	0x255a	#BOX DRAWINGS DOUBLE UP AND RIGHT
+0xc9	0x2554	#BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xca	0x2569	#BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xcb	0x2566	#BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xcc	0x2560	#BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xcd	0x2550	#BOX DRAWINGS DOUBLE HORIZONTAL
+0xce	0x256c	#BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xcf	0x00a4	#CURRENCY SIGN
+0xd0	0x00f0	#LATIN SMALL LETTER ETH
+0xd1	0x00d0	#LATIN CAPITAL LETTER ETH
+0xd2	0x00ca	#LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+0xd3	0x00cb	#LATIN CAPITAL LETTER E WITH DIAERESIS
+0xd4	0x00c8	#LATIN CAPITAL LETTER E WITH GRAVE
+0xd5	0x0131	#LATIN SMALL LETTER DOTLESS I
+0xd6	0x00cd	#LATIN CAPITAL LETTER I WITH ACUTE
+0xd7	0x00ce	#LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xd8	0x00cf	#LATIN CAPITAL LETTER I WITH DIAERESIS
+0xd9	0x2518	#BOX DRAWINGS LIGHT UP AND LEFT
+0xda	0x250c	#BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xdb	0x2588	#FULL BLOCK
+0xdc	0x2584	#LOWER HALF BLOCK
+0xdd	0x00a6	#BROKEN BAR
+0xde	0x00cc	#LATIN CAPITAL LETTER I WITH GRAVE
+0xdf	0x2580	#UPPER HALF BLOCK
+0xe0	0x00d3	#LATIN CAPITAL LETTER O WITH ACUTE
+0xe1	0x00df	#LATIN SMALL LETTER SHARP S
+0xe2	0x00d4	#LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xe3	0x00d2	#LATIN CAPITAL LETTER O WITH GRAVE
+0xe4	0x00f5	#LATIN SMALL LETTER O WITH TILDE
+0xe5	0x00d5	#LATIN CAPITAL LETTER O WITH TILDE
+0xe6	0x00b5	#MICRO SIGN
+0xe7	0x00fe	#LATIN SMALL LETTER THORN
+0xe8	0x00de	#LATIN CAPITAL LETTER THORN
+0xe9	0x00da	#LATIN CAPITAL LETTER U WITH ACUTE
+0xea	0x00db	#LATIN CAPITAL LETTER U WITH CIRCUMFLEX
+0xeb	0x00d9	#LATIN CAPITAL LETTER U WITH GRAVE
+0xec	0x00fd	#LATIN SMALL LETTER Y WITH ACUTE
+0xed	0x00dd	#LATIN CAPITAL LETTER Y WITH ACUTE
+0xee	0x00af	#MACRON
+0xef	0x00b4	#ACUTE ACCENT
+0xf0	0x00ad	#SOFT HYPHEN
+0xf1	0x00b1	#PLUS-MINUS SIGN
+0xf2	0x2017	#DOUBLE LOW LINE
+0xf3	0x00be	#VULGAR FRACTION THREE QUARTERS
+0xf4	0x00b6	#PILCROW SIGN
+0xf5	0x00a7	#SECTION SIGN
+0xf6	0x00f7	#DIVISION SIGN
+0xf7	0x00b8	#CEDILLA
+0xf8	0x00b0	#DEGREE SIGN
+0xf9	0x00a8	#DIAERESIS
+0xfa	0x00b7	#MIDDLE DOT
+0xfb	0x00b9	#SUPERSCRIPT ONE
+0xfc	0x00b3	#SUPERSCRIPT THREE
+0xfd	0x00b2	#SUPERSCRIPT TWO
+0xfe	0x25a0	#BLACK SQUARE
+0xff	0x00a0	#NO-BREAK SPACE

+ 273 - 0
sys/lib/antiword/cp852.txt

@@ -0,0 +1,273 @@
+#
+#    Name:     cp852_DOSLatin2 to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp852_DOSLatin2 code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp852_DOSLatin2 order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0a	0x000a	#LINE FEED
+0x0b	0x000b	#VERTICAL TABULATION
+0x0c	0x000c	#FORM FEED
+0x0d	0x000d	#CARRIAGE RETURN
+0x0e	0x000e	#SHIFT OUT
+0x0f	0x000f	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1a	0x001a	#SUBSTITUTE
+0x1b	0x001b	#ESCAPE
+0x1c	0x001c	#FILE SEPARATOR
+0x1d	0x001d	#GROUP SEPARATOR
+0x1e	0x001e	#RECORD SEPARATOR
+0x1f	0x001f	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2a	0x002a	#ASTERISK
+0x2b	0x002b	#PLUS SIGN
+0x2c	0x002c	#COMMA
+0x2d	0x002d	#HYPHEN-MINUS
+0x2e	0x002e	#FULL STOP
+0x2f	0x002f	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3a	0x003a	#COLON
+0x3b	0x003b	#SEMICOLON
+0x3c	0x003c	#LESS-THAN SIGN
+0x3d	0x003d	#EQUALS SIGN
+0x3e	0x003e	#GREATER-THAN SIGN
+0x3f	0x003f	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4a	0x004a	#LATIN CAPITAL LETTER J
+0x4b	0x004b	#LATIN CAPITAL LETTER K
+0x4c	0x004c	#LATIN CAPITAL LETTER L
+0x4d	0x004d	#LATIN CAPITAL LETTER M
+0x4e	0x004e	#LATIN CAPITAL LETTER N
+0x4f	0x004f	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5a	0x005a	#LATIN CAPITAL LETTER Z
+0x5b	0x005b	#LEFT SQUARE BRACKET
+0x5c	0x005c	#REVERSE SOLIDUS
+0x5d	0x005d	#RIGHT SQUARE BRACKET
+0x5e	0x005e	#CIRCUMFLEX ACCENT
+0x5f	0x005f	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6a	0x006a	#LATIN SMALL LETTER J
+0x6b	0x006b	#LATIN SMALL LETTER K
+0x6c	0x006c	#LATIN SMALL LETTER L
+0x6d	0x006d	#LATIN SMALL LETTER M
+0x6e	0x006e	#LATIN SMALL LETTER N
+0x6f	0x006f	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7a	0x007a	#LATIN SMALL LETTER Z
+0x7b	0x007b	#LEFT CURLY BRACKET
+0x7c	0x007c	#VERTICAL LINE
+0x7d	0x007d	#RIGHT CURLY BRACKET
+0x7e	0x007e	#TILDE
+0x7f	0x007f	#DELETE
+0x80	0x00c7	#LATIN CAPITAL LETTER C WITH CEDILLA
+0x81	0x00fc	#LATIN SMALL LETTER U WITH DIAERESIS
+0x82	0x00e9	#LATIN SMALL LETTER E WITH ACUTE
+0x83	0x00e2	#LATIN SMALL LETTER A WITH CIRCUMFLEX
+0x84	0x00e4	#LATIN SMALL LETTER A WITH DIAERESIS
+0x85	0x016f	#LATIN SMALL LETTER U WITH RING ABOVE
+0x86	0x0107	#LATIN SMALL LETTER C WITH ACUTE
+0x87	0x00e7	#LATIN SMALL LETTER C WITH CEDILLA
+0x88	0x0142	#LATIN SMALL LETTER L WITH STROKE
+0x89	0x00eb	#LATIN SMALL LETTER E WITH DIAERESIS
+0x8a	0x0150	#LATIN CAPITAL LETTER O WITH DOUBLE ACUTE
+0x8b	0x0151	#LATIN SMALL LETTER O WITH DOUBLE ACUTE
+0x8c	0x00ee	#LATIN SMALL LETTER I WITH CIRCUMFLEX
+0x8d	0x0179	#LATIN CAPITAL LETTER Z WITH ACUTE
+0x8e	0x00c4	#LATIN CAPITAL LETTER A WITH DIAERESIS
+0x8f	0x0106	#LATIN CAPITAL LETTER C WITH ACUTE
+0x90	0x00c9	#LATIN CAPITAL LETTER E WITH ACUTE
+0x91	0x0139	#LATIN CAPITAL LETTER L WITH ACUTE
+0x92	0x013a	#LATIN SMALL LETTER L WITH ACUTE
+0x93	0x00f4	#LATIN SMALL LETTER O WITH CIRCUMFLEX
+0x94	0x00f6	#LATIN SMALL LETTER O WITH DIAERESIS
+0x95	0x013d	#LATIN CAPITAL LETTER L WITH CARON
+0x96	0x013e	#LATIN SMALL LETTER L WITH CARON
+0x97	0x015a	#LATIN CAPITAL LETTER S WITH ACUTE
+0x98	0x015b	#LATIN SMALL LETTER S WITH ACUTE
+0x99	0x00d6	#LATIN CAPITAL LETTER O WITH DIAERESIS
+0x9a	0x00dc	#LATIN CAPITAL LETTER U WITH DIAERESIS
+0x9b	0x0164	#LATIN CAPITAL LETTER T WITH CARON
+0x9c	0x0165	#LATIN SMALL LETTER T WITH CARON
+0x9d	0x0141	#LATIN CAPITAL LETTER L WITH STROKE
+0x9e	0x00d7	#MULTIPLICATION SIGN
+0x9f	0x010d	#LATIN SMALL LETTER C WITH CARON
+0xa0	0x00e1	#LATIN SMALL LETTER A WITH ACUTE
+0xa1	0x00ed	#LATIN SMALL LETTER I WITH ACUTE
+0xa2	0x00f3	#LATIN SMALL LETTER O WITH ACUTE
+0xa3	0x00fa	#LATIN SMALL LETTER U WITH ACUTE
+0xa4	0x0104	#LATIN CAPITAL LETTER A WITH OGONEK
+0xa5	0x0105	#LATIN SMALL LETTER A WITH OGONEK
+0xa6	0x017d	#LATIN CAPITAL LETTER Z WITH CARON
+0xa7	0x017e	#LATIN SMALL LETTER Z WITH CARON
+0xa8	0x0118	#LATIN CAPITAL LETTER E WITH OGONEK
+0xa9	0x0119	#LATIN SMALL LETTER E WITH OGONEK
+0xaa	0x00ac	#NOT SIGN
+0xab	0x017a	#LATIN SMALL LETTER Z WITH ACUTE
+0xac	0x010c	#LATIN CAPITAL LETTER C WITH CARON
+0xad	0x015f	#LATIN SMALL LETTER S WITH CEDILLA
+0xae	0x00ab	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xaf	0x00bb	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xb0	0x2591	#LIGHT SHADE
+0xb1	0x2592	#MEDIUM SHADE
+0xb2	0x2593	#DARK SHADE
+0xb3	0x2502	#BOX DRAWINGS LIGHT VERTICAL
+0xb4	0x2524	#BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xb5	0x00c1	#LATIN CAPITAL LETTER A WITH ACUTE
+0xb6	0x00c2	#LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+0xb7	0x011a	#LATIN CAPITAL LETTER E WITH CARON
+0xb8	0x015e	#LATIN CAPITAL LETTER S WITH CEDILLA
+0xb9	0x2563	#BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xba	0x2551	#BOX DRAWINGS DOUBLE VERTICAL
+0xbb	0x2557	#BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xbc	0x255d	#BOX DRAWINGS DOUBLE UP AND LEFT
+0xbd	0x017b	#LATIN CAPITAL LETTER Z WITH DOT ABOVE
+0xbe	0x017c	#LATIN SMALL LETTER Z WITH DOT ABOVE
+0xbf	0x2510	#BOX DRAWINGS LIGHT DOWN AND LEFT
+0xc0	0x2514	#BOX DRAWINGS LIGHT UP AND RIGHT
+0xc1	0x2534	#BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xc2	0x252c	#BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xc3	0x251c	#BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xc4	0x2500	#BOX DRAWINGS LIGHT HORIZONTAL
+0xc5	0x253c	#BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xc6	0x0102	#LATIN CAPITAL LETTER A WITH BREVE
+0xc7	0x0103	#LATIN SMALL LETTER A WITH BREVE
+0xc8	0x255a	#BOX DRAWINGS DOUBLE UP AND RIGHT
+0xc9	0x2554	#BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xca	0x2569	#BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xcb	0x2566	#BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xcc	0x2560	#BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xcd	0x2550	#BOX DRAWINGS DOUBLE HORIZONTAL
+0xce	0x256c	#BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xcf	0x00a4	#CURRENCY SIGN
+0xd0	0x0111	#LATIN SMALL LETTER D WITH STROKE
+0xd1	0x0110	#LATIN CAPITAL LETTER D WITH STROKE
+0xd2	0x010e	#LATIN CAPITAL LETTER D WITH CARON
+0xd3	0x00cb	#LATIN CAPITAL LETTER E WITH DIAERESIS
+0xd4	0x010f	#LATIN SMALL LETTER D WITH CARON
+0xd5	0x0147	#LATIN CAPITAL LETTER N WITH CARON
+0xd6	0x00cd	#LATIN CAPITAL LETTER I WITH ACUTE
+0xd7	0x00ce	#LATIN CAPITAL LETTER I WITH CIRCUMFLEX
+0xd8	0x011b	#LATIN SMALL LETTER E WITH CARON
+0xd9	0x2518	#BOX DRAWINGS LIGHT UP AND LEFT
+0xda	0x250c	#BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xdb	0x2588	#FULL BLOCK
+0xdc	0x2584	#LOWER HALF BLOCK
+0xdd	0x0162	#LATIN CAPITAL LETTER T WITH CEDILLA
+0xde	0x016e	#LATIN CAPITAL LETTER U WITH RING ABOVE
+0xdf	0x2580	#UPPER HALF BLOCK
+0xe0	0x00d3	#LATIN CAPITAL LETTER O WITH ACUTE
+0xe1	0x00df	#LATIN SMALL LETTER SHARP S
+0xe2	0x00d4	#LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+0xe3	0x0143	#LATIN CAPITAL LETTER N WITH ACUTE
+0xe4	0x0144	#LATIN SMALL LETTER N WITH ACUTE
+0xe5	0x0148	#LATIN SMALL LETTER N WITH CARON
+0xe6	0x0160	#LATIN CAPITAL LETTER S WITH CARON
+0xe7	0x0161	#LATIN SMALL LETTER S WITH CARON
+0xe8	0x0154	#LATIN CAPITAL LETTER R WITH ACUTE
+0xe9	0x00da	#LATIN CAPITAL LETTER U WITH ACUTE
+0xea	0x0155	#LATIN SMALL LETTER R WITH ACUTE
+0xeb	0x0170	#LATIN CAPITAL LETTER U WITH DOUBLE ACUTE
+0xec	0x00fd	#LATIN SMALL LETTER Y WITH ACUTE
+0xed	0x00dd	#LATIN CAPITAL LETTER Y WITH ACUTE
+0xee	0x0163	#LATIN SMALL LETTER T WITH CEDILLA
+0xef	0x00b4	#ACUTE ACCENT
+0xf0	0x00ad	#SOFT HYPHEN
+0xf1	0x02dd	#DOUBLE ACUTE ACCENT
+0xf2	0x02db	#OGONEK
+0xf3	0x02c7	#CARON
+0xf4	0x02d8	#BREVE
+0xf5	0x00a7	#SECTION SIGN
+0xf6	0x00f7	#DIVISION SIGN
+0xf7	0x00b8	#CEDILLA
+0xf8	0x00b0	#DEGREE SIGN
+0xf9	0x00a8	#DIAERESIS
+0xfa	0x02d9	#DOT ABOVE
+0xfb	0x0171	#LATIN SMALL LETTER U WITH DOUBLE ACUTE
+0xfc	0x0158	#LATIN CAPITAL LETTER R WITH CARON
+0xfd	0x0159	#LATIN SMALL LETTER R WITH CARON
+0xfe	0x25a0	#BLACK SQUARE
+0xff	0x00a0	#NO-BREAK SPACE

+ 273 - 0
sys/lib/antiword/cp862.txt

@@ -0,0 +1,273 @@
+#
+#    Name:     cp862_DOSHebrew to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp862_DOSHebrew code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp862_DOSHebrew order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0a	0x000a	#LINE FEED
+0x0b	0x000b	#VERTICAL TABULATION
+0x0c	0x000c	#FORM FEED
+0x0d	0x000d	#CARRIAGE RETURN
+0x0e	0x000e	#SHIFT OUT
+0x0f	0x000f	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1a	0x001a	#SUBSTITUTE
+0x1b	0x001b	#ESCAPE
+0x1c	0x001c	#FILE SEPARATOR
+0x1d	0x001d	#GROUP SEPARATOR
+0x1e	0x001e	#RECORD SEPARATOR
+0x1f	0x001f	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2a	0x002a	#ASTERISK
+0x2b	0x002b	#PLUS SIGN
+0x2c	0x002c	#COMMA
+0x2d	0x002d	#HYPHEN-MINUS
+0x2e	0x002e	#FULL STOP
+0x2f	0x002f	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3a	0x003a	#COLON
+0x3b	0x003b	#SEMICOLON
+0x3c	0x003c	#LESS-THAN SIGN
+0x3d	0x003d	#EQUALS SIGN
+0x3e	0x003e	#GREATER-THAN SIGN
+0x3f	0x003f	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4a	0x004a	#LATIN CAPITAL LETTER J
+0x4b	0x004b	#LATIN CAPITAL LETTER K
+0x4c	0x004c	#LATIN CAPITAL LETTER L
+0x4d	0x004d	#LATIN CAPITAL LETTER M
+0x4e	0x004e	#LATIN CAPITAL LETTER N
+0x4f	0x004f	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5a	0x005a	#LATIN CAPITAL LETTER Z
+0x5b	0x005b	#LEFT SQUARE BRACKET
+0x5c	0x005c	#REVERSE SOLIDUS
+0x5d	0x005d	#RIGHT SQUARE BRACKET
+0x5e	0x005e	#CIRCUMFLEX ACCENT
+0x5f	0x005f	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6a	0x006a	#LATIN SMALL LETTER J
+0x6b	0x006b	#LATIN SMALL LETTER K
+0x6c	0x006c	#LATIN SMALL LETTER L
+0x6d	0x006d	#LATIN SMALL LETTER M
+0x6e	0x006e	#LATIN SMALL LETTER N
+0x6f	0x006f	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7a	0x007a	#LATIN SMALL LETTER Z
+0x7b	0x007b	#LEFT CURLY BRACKET
+0x7c	0x007c	#VERTICAL LINE
+0x7d	0x007d	#RIGHT CURLY BRACKET
+0x7e	0x007e	#TILDE
+0x7f	0x007f	#DELETE
+0x80	0x05d0	#HEBREW LETTER ALEF
+0x81	0x05d1	#HEBREW LETTER BET
+0x82	0x05d2	#HEBREW LETTER GIMEL
+0x83	0x05d3	#HEBREW LETTER DALET
+0x84	0x05d4	#HEBREW LETTER HE
+0x85	0x05d5	#HEBREW LETTER VAV
+0x86	0x05d6	#HEBREW LETTER ZAYIN
+0x87	0x05d7	#HEBREW LETTER HET
+0x88	0x05d8	#HEBREW LETTER TET
+0x89	0x05d9	#HEBREW LETTER YOD
+0x8a	0x05da	#HEBREW LETTER FINAL KAF
+0x8b	0x05db	#HEBREW LETTER KAF
+0x8c	0x05dc	#HEBREW LETTER LAMED
+0x8d	0x05dd	#HEBREW LETTER FINAL MEM
+0x8e	0x05de	#HEBREW LETTER MEM
+0x8f	0x05df	#HEBREW LETTER FINAL NUN
+0x90	0x05e0	#HEBREW LETTER NUN
+0x91	0x05e1	#HEBREW LETTER SAMEKH
+0x92	0x05e2	#HEBREW LETTER AYIN
+0x93	0x05e3	#HEBREW LETTER FINAL PE
+0x94	0x05e4	#HEBREW LETTER PE
+0x95	0x05e5	#HEBREW LETTER FINAL TSADI
+0x96	0x05e6	#HEBREW LETTER TSADI
+0x97	0x05e7	#HEBREW LETTER QOF
+0x98	0x05e8	#HEBREW LETTER RESH
+0x99	0x05e9	#HEBREW LETTER SHIN
+0x9a	0x05ea	#HEBREW LETTER TAV
+0x9b	0x00a2	#CENT SIGN
+0x9c	0x00a3	#POUND SIGN
+0x9d	0x00a5	#YEN SIGN
+0x9e	0x20a7	#PESETA SIGN
+0x9f	0x0192	#LATIN SMALL LETTER F WITH HOOK
+0xa0	0x00e1	#LATIN SMALL LETTER A WITH ACUTE
+0xa1	0x00ed	#LATIN SMALL LETTER I WITH ACUTE
+0xa2	0x00f3	#LATIN SMALL LETTER O WITH ACUTE
+0xa3	0x00fa	#LATIN SMALL LETTER U WITH ACUTE
+0xa4	0x00f1	#LATIN SMALL LETTER N WITH TILDE
+0xa5	0x00d1	#LATIN CAPITAL LETTER N WITH TILDE
+0xa6	0x00aa	#FEMININE ORDINAL INDICATOR
+0xa7	0x00ba	#MASCULINE ORDINAL INDICATOR
+0xa8	0x00bf	#INVERTED QUESTION MARK
+0xa9	0x2310	#REVERSED NOT SIGN
+0xaa	0x00ac	#NOT SIGN
+0xab	0x00bd	#VULGAR FRACTION ONE HALF
+0xac	0x00bc	#VULGAR FRACTION ONE QUARTER
+0xad	0x00a1	#INVERTED EXCLAMATION MARK
+0xae	0x00ab	#LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xaf	0x00bb	#RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
+0xb0	0x2591	#LIGHT SHADE
+0xb1	0x2592	#MEDIUM SHADE
+0xb2	0x2593	#DARK SHADE
+0xb3	0x2502	#BOX DRAWINGS LIGHT VERTICAL
+0xb4	0x2524	#BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xb5	0x2561	#BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xb6	0x2562	#BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+0xb7	0x2556	#BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+0xb8	0x2555	#BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+0xb9	0x2563	#BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xba	0x2551	#BOX DRAWINGS DOUBLE VERTICAL
+0xbb	0x2557	#BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xbc	0x255d	#BOX DRAWINGS DOUBLE UP AND LEFT
+0xbd	0x255c	#BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+0xbe	0x255b	#BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+0xbf	0x2510	#BOX DRAWINGS LIGHT DOWN AND LEFT
+0xc0	0x2514	#BOX DRAWINGS LIGHT UP AND RIGHT
+0xc1	0x2534	#BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xc2	0x252c	#BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xc3	0x251c	#BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xc4	0x2500	#BOX DRAWINGS LIGHT HORIZONTAL
+0xc5	0x253c	#BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xc6	0x255e	#BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xc7	0x255f	#BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+0xc8	0x255a	#BOX DRAWINGS DOUBLE UP AND RIGHT
+0xc9	0x2554	#BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xca	0x2569	#BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xcb	0x2566	#BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xcc	0x2560	#BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xcd	0x2550	#BOX DRAWINGS DOUBLE HORIZONTAL
+0xce	0x256c	#BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xcf	0x2567	#BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+0xd0	0x2568	#BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+0xd1	0x2564	#BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+0xd2	0x2565	#BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+0xd3	0x2559	#BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+0xd4	0x2558	#BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+0xd5	0x2552	#BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+0xd6	0x2553	#BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+0xd7	0x256b	#BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+0xd8	0x256a	#BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xd9	0x2518	#BOX DRAWINGS LIGHT UP AND LEFT
+0xda	0x250c	#BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xdb	0x2588	#FULL BLOCK
+0xdc	0x2584	#LOWER HALF BLOCK
+0xdd	0x258c	#LEFT HALF BLOCK
+0xde	0x2590	#RIGHT HALF BLOCK
+0xdf	0x2580	#UPPER HALF BLOCK
+0xe0	0x03b1	#GREEK SMALL LETTER ALPHA
+0xe1	0x00df	#LATIN SMALL LETTER SHARP S (GERMAN)
+0xe2	0x0393	#GREEK CAPITAL LETTER GAMMA
+0xe3	0x03c0	#GREEK SMALL LETTER PI
+0xe4	0x03a3	#GREEK CAPITAL LETTER SIGMA
+0xe5	0x03c3	#GREEK SMALL LETTER SIGMA
+0xe6	0x00b5	#MICRO SIGN
+0xe7	0x03c4	#GREEK SMALL LETTER TAU
+0xe8	0x03a6	#GREEK CAPITAL LETTER PHI
+0xe9	0x0398	#GREEK CAPITAL LETTER THETA
+0xea	0x03a9	#GREEK CAPITAL LETTER OMEGA
+0xeb	0x03b4	#GREEK SMALL LETTER DELTA
+0xec	0x221e	#INFINITY
+0xed	0x03c6	#GREEK SMALL LETTER PHI
+0xee	0x03b5	#GREEK SMALL LETTER EPSILON
+0xef	0x2229	#INTERSECTION
+0xf0	0x2261	#IDENTICAL TO
+0xf1	0x00b1	#PLUS-MINUS SIGN
+0xf2	0x2265	#GREATER-THAN OR EQUAL TO
+0xf3	0x2264	#LESS-THAN OR EQUAL TO
+0xf4	0x2320	#TOP HALF INTEGRAL
+0xf5	0x2321	#BOTTOM HALF INTEGRAL
+0xf6	0x00f7	#DIVISION SIGN
+0xf7	0x2248	#ALMOST EQUAL TO
+0xf8	0x00b0	#DEGREE SIGN
+0xf9	0x2219	#BULLET OPERATOR
+0xfa	0x00b7	#MIDDLE DOT
+0xfb	0x221a	#SQUARE ROOT
+0xfc	0x207f	#SUPERSCRIPT LATIN SMALL LETTER N
+0xfd	0x00b2	#SUPERSCRIPT TWO
+0xfe	0x25a0	#BLACK SQUARE
+0xff	0x00a0	#NO-BREAK SPACE

+ 273 - 0
sys/lib/antiword/cp866.txt

@@ -0,0 +1,273 @@
+#
+#    Name:     cp866_DOSCyrillicRussian to Unicode table
+#    Unicode version: 2.0
+#    Table version: 2.00
+#    Table format:  Format A
+#    Date:          04/24/96
+#    Authors:       Lori Brownell <loribr@microsoft.com>
+#                   K.D. Chang    <a-kchang@microsoft.com>
+#    General notes: none
+#
+#    Format: Three tab-separated columns
+#        Column #1 is the cp866_DOSCyrillicRussian code (in hex)
+#        Column #2 is the Unicode (in hex as 0xXXXX)
+#        Column #3 is the Unicode name (follows a comment sign, '#')
+#
+#    The entries are in cp866_DOSCyrillicRussian order
+#
+0x00	0x0000	#NULL
+0x01	0x0001	#START OF HEADING
+0x02	0x0002	#START OF TEXT
+0x03	0x0003	#END OF TEXT
+0x04	0x0004	#END OF TRANSMISSION
+0x05	0x0005	#ENQUIRY
+0x06	0x0006	#ACKNOWLEDGE
+0x07	0x0007	#BELL
+0x08	0x0008	#BACKSPACE
+0x09	0x0009	#HORIZONTAL TABULATION
+0x0a	0x000a	#LINE FEED
+0x0b	0x000b	#VERTICAL TABULATION
+0x0c	0x000c	#FORM FEED
+0x0d	0x000d	#CARRIAGE RETURN
+0x0e	0x000e	#SHIFT OUT
+0x0f	0x000f	#SHIFT IN
+0x10	0x0010	#DATA LINK ESCAPE
+0x11	0x0011	#DEVICE CONTROL ONE
+0x12	0x0012	#DEVICE CONTROL TWO
+0x13	0x0013	#DEVICE CONTROL THREE
+0x14	0x0014	#DEVICE CONTROL FOUR
+0x15	0x0015	#NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#SYNCHRONOUS IDLE
+0x17	0x0017	#END OF TRANSMISSION BLOCK
+0x18	0x0018	#CANCEL
+0x19	0x0019	#END OF MEDIUM
+0x1a	0x001a	#SUBSTITUTE
+0x1b	0x001b	#ESCAPE
+0x1c	0x001c	#FILE SEPARATOR
+0x1d	0x001d	#GROUP SEPARATOR
+0x1e	0x001e	#RECORD SEPARATOR
+0x1f	0x001f	#UNIT SEPARATOR
+0x20	0x0020	#SPACE
+0x21	0x0021	#EXCLAMATION MARK
+0x22	0x0022	#QUOTATION MARK
+0x23	0x0023	#NUMBER SIGN
+0x24	0x0024	#DOLLAR SIGN
+0x25	0x0025	#PERCENT SIGN
+0x26	0x0026	#AMPERSAND
+0x27	0x0027	#APOSTROPHE
+0x28	0x0028	#LEFT PARENTHESIS
+0x29	0x0029	#RIGHT PARENTHESIS
+0x2a	0x002a	#ASTERISK
+0x2b	0x002b	#PLUS SIGN
+0x2c	0x002c	#COMMA
+0x2d	0x002d	#HYPHEN-MINUS
+0x2e	0x002e	#FULL STOP
+0x2f	0x002f	#SOLIDUS
+0x30	0x0030	#DIGIT ZERO
+0x31	0x0031	#DIGIT ONE
+0x32	0x0032	#DIGIT TWO
+0x33	0x0033	#DIGIT THREE
+0x34	0x0034	#DIGIT FOUR
+0x35	0x0035	#DIGIT FIVE
+0x36	0x0036	#DIGIT SIX
+0x37	0x0037	#DIGIT SEVEN
+0x38	0x0038	#DIGIT EIGHT
+0x39	0x0039	#DIGIT NINE
+0x3a	0x003a	#COLON
+0x3b	0x003b	#SEMICOLON
+0x3c	0x003c	#LESS-THAN SIGN
+0x3d	0x003d	#EQUALS SIGN
+0x3e	0x003e	#GREATER-THAN SIGN
+0x3f	0x003f	#QUESTION MARK
+0x40	0x0040	#COMMERCIAL AT
+0x41	0x0041	#LATIN CAPITAL LETTER A
+0x42	0x0042	#LATIN CAPITAL LETTER B
+0x43	0x0043	#LATIN CAPITAL LETTER C
+0x44	0x0044	#LATIN CAPITAL LETTER D
+0x45	0x0045	#LATIN CAPITAL LETTER E
+0x46	0x0046	#LATIN CAPITAL LETTER F
+0x47	0x0047	#LATIN CAPITAL LETTER G
+0x48	0x0048	#LATIN CAPITAL LETTER H
+0x49	0x0049	#LATIN CAPITAL LETTER I
+0x4a	0x004a	#LATIN CAPITAL LETTER J
+0x4b	0x004b	#LATIN CAPITAL LETTER K
+0x4c	0x004c	#LATIN CAPITAL LETTER L
+0x4d	0x004d	#LATIN CAPITAL LETTER M
+0x4e	0x004e	#LATIN CAPITAL LETTER N
+0x4f	0x004f	#LATIN CAPITAL LETTER O
+0x50	0x0050	#LATIN CAPITAL LETTER P
+0x51	0x0051	#LATIN CAPITAL LETTER Q
+0x52	0x0052	#LATIN CAPITAL LETTER R
+0x53	0x0053	#LATIN CAPITAL LETTER S
+0x54	0x0054	#LATIN CAPITAL LETTER T
+0x55	0x0055	#LATIN CAPITAL LETTER U
+0x56	0x0056	#LATIN CAPITAL LETTER V
+0x57	0x0057	#LATIN CAPITAL LETTER W
+0x58	0x0058	#LATIN CAPITAL LETTER X
+0x59	0x0059	#LATIN CAPITAL LETTER Y
+0x5a	0x005a	#LATIN CAPITAL LETTER Z
+0x5b	0x005b	#LEFT SQUARE BRACKET
+0x5c	0x005c	#REVERSE SOLIDUS
+0x5d	0x005d	#RIGHT SQUARE BRACKET
+0x5e	0x005e	#CIRCUMFLEX ACCENT
+0x5f	0x005f	#LOW LINE
+0x60	0x0060	#GRAVE ACCENT
+0x61	0x0061	#LATIN SMALL LETTER A
+0x62	0x0062	#LATIN SMALL LETTER B
+0x63	0x0063	#LATIN SMALL LETTER C
+0x64	0x0064	#LATIN SMALL LETTER D
+0x65	0x0065	#LATIN SMALL LETTER E
+0x66	0x0066	#LATIN SMALL LETTER F
+0x67	0x0067	#LATIN SMALL LETTER G
+0x68	0x0068	#LATIN SMALL LETTER H
+0x69	0x0069	#LATIN SMALL LETTER I
+0x6a	0x006a	#LATIN SMALL LETTER J
+0x6b	0x006b	#LATIN SMALL LETTER K
+0x6c	0x006c	#LATIN SMALL LETTER L
+0x6d	0x006d	#LATIN SMALL LETTER M
+0x6e	0x006e	#LATIN SMALL LETTER N
+0x6f	0x006f	#LATIN SMALL LETTER O
+0x70	0x0070	#LATIN SMALL LETTER P
+0x71	0x0071	#LATIN SMALL LETTER Q
+0x72	0x0072	#LATIN SMALL LETTER R
+0x73	0x0073	#LATIN SMALL LETTER S
+0x74	0x0074	#LATIN SMALL LETTER T
+0x75	0x0075	#LATIN SMALL LETTER U
+0x76	0x0076	#LATIN SMALL LETTER V
+0x77	0x0077	#LATIN SMALL LETTER W
+0x78	0x0078	#LATIN SMALL LETTER X
+0x79	0x0079	#LATIN SMALL LETTER Y
+0x7a	0x007a	#LATIN SMALL LETTER Z
+0x7b	0x007b	#LEFT CURLY BRACKET
+0x7c	0x007c	#VERTICAL LINE
+0x7d	0x007d	#RIGHT CURLY BRACKET
+0x7e	0x007e	#TILDE
+0x7f	0x007f	#DELETE
+0x80	0x0410	#CYRILLIC CAPITAL LETTER A
+0x81	0x0411	#CYRILLIC CAPITAL LETTER BE
+0x82	0x0412	#CYRILLIC CAPITAL LETTER VE
+0x83	0x0413	#CYRILLIC CAPITAL LETTER GHE
+0x84	0x0414	#CYRILLIC CAPITAL LETTER DE
+0x85	0x0415	#CYRILLIC CAPITAL LETTER IE
+0x86	0x0416	#CYRILLIC CAPITAL LETTER ZHE
+0x87	0x0417	#CYRILLIC CAPITAL LETTER ZE
+0x88	0x0418	#CYRILLIC CAPITAL LETTER I
+0x89	0x0419	#CYRILLIC CAPITAL LETTER SHORT I
+0x8a	0x041a	#CYRILLIC CAPITAL LETTER KA
+0x8b	0x041b	#CYRILLIC CAPITAL LETTER EL
+0x8c	0x041c	#CYRILLIC CAPITAL LETTER EM
+0x8d	0x041d	#CYRILLIC CAPITAL LETTER EN
+0x8e	0x041e	#CYRILLIC CAPITAL LETTER O
+0x8f	0x041f	#CYRILLIC CAPITAL LETTER PE
+0x90	0x0420	#CYRILLIC CAPITAL LETTER ER
+0x91	0x0421	#CYRILLIC CAPITAL LETTER ES
+0x92	0x0422	#CYRILLIC CAPITAL LETTER TE
+0x93	0x0423	#CYRILLIC CAPITAL LETTER U
+0x94	0x0424	#CYRILLIC CAPITAL LETTER EF
+0x95	0x0425	#CYRILLIC CAPITAL LETTER HA
+0x96	0x0426	#CYRILLIC CAPITAL LETTER TSE
+0x97	0x0427	#CYRILLIC CAPITAL LETTER CHE
+0x98	0x0428	#CYRILLIC CAPITAL LETTER SHA
+0x99	0x0429	#CYRILLIC CAPITAL LETTER SHCHA
+0x9a	0x042a	#CYRILLIC CAPITAL LETTER HARD SIGN
+0x9b	0x042b	#CYRILLIC CAPITAL LETTER YERU
+0x9c	0x042c	#CYRILLIC CAPITAL LETTER SOFT SIGN
+0x9d	0x042d	#CYRILLIC CAPITAL LETTER E
+0x9e	0x042e	#CYRILLIC CAPITAL LETTER YU
+0x9f	0x042f	#CYRILLIC CAPITAL LETTER YA
+0xa0	0x0430	#CYRILLIC SMALL LETTER A
+0xa1	0x0431	#CYRILLIC SMALL LETTER BE
+0xa2	0x0432	#CYRILLIC SMALL LETTER VE
+0xa3	0x0433	#CYRILLIC SMALL LETTER GHE
+0xa4	0x0434	#CYRILLIC SMALL LETTER DE
+0xa5	0x0435	#CYRILLIC SMALL LETTER IE
+0xa6	0x0436	#CYRILLIC SMALL LETTER ZHE
+0xa7	0x0437	#CYRILLIC SMALL LETTER ZE
+0xa8	0x0438	#CYRILLIC SMALL LETTER I
+0xa9	0x0439	#CYRILLIC SMALL LETTER SHORT I
+0xaa	0x043a	#CYRILLIC SMALL LETTER KA
+0xab	0x043b	#CYRILLIC SMALL LETTER EL
+0xac	0x043c	#CYRILLIC SMALL LETTER EM
+0xad	0x043d	#CYRILLIC SMALL LETTER EN
+0xae	0x043e	#CYRILLIC SMALL LETTER O
+0xaf	0x043f	#CYRILLIC SMALL LETTER PE
+0xb0	0x2591	#LIGHT SHADE
+0xb1	0x2592	#MEDIUM SHADE
+0xb2	0x2593	#DARK SHADE
+0xb3	0x2502	#BOX DRAWINGS LIGHT VERTICAL
+0xb4	0x2524	#BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0xb5	0x2561	#BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xb6	0x2562	#BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+0xb7	0x2556	#BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+0xb8	0x2555	#BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+0xb9	0x2563	#BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xba	0x2551	#BOX DRAWINGS DOUBLE VERTICAL
+0xbb	0x2557	#BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xbc	0x255d	#BOX DRAWINGS DOUBLE UP AND LEFT
+0xbd	0x255c	#BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+0xbe	0x255b	#BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+0xbf	0x2510	#BOX DRAWINGS LIGHT DOWN AND LEFT
+0xc0	0x2514	#BOX DRAWINGS LIGHT UP AND RIGHT
+0xc1	0x2534	#BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0xc2	0x252c	#BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0xc3	0x251c	#BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0xc4	0x2500	#BOX DRAWINGS LIGHT HORIZONTAL
+0xc5	0x253c	#BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0xc6	0x255e	#BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xc7	0x255f	#BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+0xc8	0x255a	#BOX DRAWINGS DOUBLE UP AND RIGHT
+0xc9	0x2554	#BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xca	0x2569	#BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xcb	0x2566	#BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xcc	0x2560	#BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xcd	0x2550	#BOX DRAWINGS DOUBLE HORIZONTAL
+0xce	0x256c	#BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xcf	0x2567	#BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+0xd0	0x2568	#BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+0xd1	0x2564	#BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+0xd2	0x2565	#BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+0xd3	0x2559	#BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+0xd4	0x2558	#BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+0xd5	0x2552	#BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+0xd6	0x2553	#BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+0xd7	0x256b	#BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+0xd8	0x256a	#BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xd9	0x2518	#BOX DRAWINGS LIGHT UP AND LEFT
+0xda	0x250c	#BOX DRAWINGS LIGHT DOWN AND RIGHT
+0xdb	0x2588	#FULL BLOCK
+0xdc	0x2584	#LOWER HALF BLOCK
+0xdd	0x258c	#LEFT HALF BLOCK
+0xde	0x2590	#RIGHT HALF BLOCK
+0xdf	0x2580	#UPPER HALF BLOCK
+0xe0	0x0440	#CYRILLIC SMALL LETTER ER
+0xe1	0x0441	#CYRILLIC SMALL LETTER ES
+0xe2	0x0442	#CYRILLIC SMALL LETTER TE
+0xe3	0x0443	#CYRILLIC SMALL LETTER U
+0xe4	0x0444	#CYRILLIC SMALL LETTER EF
+0xe5	0x0445	#CYRILLIC SMALL LETTER HA
+0xe6	0x0446	#CYRILLIC SMALL LETTER TSE
+0xe7	0x0447	#CYRILLIC SMALL LETTER CHE
+0xe8	0x0448	#CYRILLIC SMALL LETTER SHA
+0xe9	0x0449	#CYRILLIC SMALL LETTER SHCHA
+0xea	0x044a	#CYRILLIC SMALL LETTER HARD SIGN
+0xeb	0x044b	#CYRILLIC SMALL LETTER YERU
+0xec	0x044c	#CYRILLIC SMALL LETTER SOFT SIGN
+0xed	0x044d	#CYRILLIC SMALL LETTER E
+0xee	0x044e	#CYRILLIC SMALL LETTER YU
+0xef	0x044f	#CYRILLIC SMALL LETTER YA
+0xf0	0x0401	#CYRILLIC CAPITAL LETTER IO
+0xf1	0x0451	#CYRILLIC SMALL LETTER IO
+0xf2	0x0404	#CYRILLIC CAPITAL LETTER UKRAINIAN IE
+0xf3	0x0454	#CYRILLIC SMALL LETTER UKRAINIAN IE
+0xf4	0x0407	#CYRILLIC CAPITAL LETTER YI
+0xf5	0x0457	#CYRILLIC SMALL LETTER YI
+0xf6	0x040e	#CYRILLIC CAPITAL LETTER SHORT U
+0xf7	0x045e	#CYRILLIC SMALL LETTER SHORT U
+0xf8	0x00b0	#DEGREE SIGN
+0xf9	0x2219	#BULLET OPERATOR
+0xfa	0x00b7	#MIDDLE DOT
+0xfb	0x221a	#SQUARE ROOT
+0xfc	0x2116	#NUMERO SIGN
+0xfd	0x00a4	#CURRENCY SIGN
+0xfe	0x25a0	#BLACK SQUARE
+0xff	0x00a0	#NO-BREAK SPACE

+ 117 - 0
sys/lib/antiword/fontnames

@@ -0,0 +1,117 @@
+# Default fontnames translation table
+# uses only Standard PostScript (TM) fonts
+#
+# MS-Word fontname,	Italic,	Bold,	PostScript fontname,	Special
+Arial,			0,	0,	Helvetica,		0
+Arial,			0,	1,	Helvetica-Bold,		0
+Arial,			1,	0,	Helvetica-Oblique,	0
+Arial,			1,	1,	Helvetica-BoldOblique,	0
+Arial Black,		0,	0,	Helvetica,		0
+Arial Black,		0,	1,	Helvetica-Bold,		0
+Arial Black,		1,	0,	Helvetica-Oblique,	0
+Arial Black,		1,	1,	Helvetica-BoldOblique,	0
+Arial CE,		0,	0,	Helvetica,		0
+Arial CE,		0,	1,	Helvetica-Bold,		0
+Arial CE,		1,	0,	Helvetica-Oblique,	0
+Arial CE,		1,	1,	Helvetica-BoldOblique,	0
+Arial Narrow,		0,	0,	Helvetica-Narrow,	0
+Arial Narrow,		0,	1,	Helvetica-Narrow-Bold,	0
+Arial Narrow,		1,	0,	Helvetica-Narrow-Oblique,	0
+Arial Narrow,		1,	1,	Helvetica-Narrow-BoldOblique,	0
+AvantGarde,		0,	0,	AvantGarde-Book,	0
+AvantGarde,		0,	1,	AvantGarde-Demi,	0
+AvantGarde,		1,	0,	AvantGarde-BookOblique,	0
+AvantGarde,		1,	1,	AvantGarde-DemiOblique,	0
+Bookman Old Style,	0,	0,	Bookman-Light,		0
+Bookman Old Style,	0,	1,	Bookman-Demi,		0
+Bookman Old Style,	1,	0,	Bookman-LightItalic,	0
+Bookman Old Style,	1,	1,	Bookman-DemiItalic,	0
+Century Schoolbook,	0,	0,	NewCenturySchlbk-Roman,	0
+Century Schoolbook,	0,	1,	NewCenturySchlbk-Bold,	0
+Century Schoolbook,	1,	0,	NewCenturySchlbk-Italic,	0
+Century Schoolbook,	1,	1,	NewCenturySchlbk-BoldItalic,	0
+CG Omega,		0,	0,	Helvetica,		0
+CG Omega,		0,	1,	Helvetica-Bold,		0
+CG Omega,		1,	0,	Helvetica-Oblique,	0
+CG Omega,		1,	1,	Helvetica-BoldOblique,	0
+Comic Sans MS,		0,	0,	Helvetica,		0
+Comic Sans MS,		0,	1,	Helvetica-Bold,		0
+Comic Sans MS,		1,	0,	Helvetica-Oblique,	0
+Comic Sans MS,		1,	1,	Helvetica-BoldOblique,	0
+Courier,		0,	0,	Courier,		0
+Courier,		0,	1,	Courier-Bold,		0
+Courier,		1,	0,	Courier-Oblique,	0
+Courier,		1,	1,	Courier-BoldOblique,	0
+Courier New,		0,	0,	Courier,		0
+Courier New,		0,	1,	Courier-Bold,		0
+Courier New,		1,	0,	Courier-Oblique,	0
+Courier New,		1,	1,	Courier-BoldOblique,	0
+Fixedsys,		0,	0,	Courier,		0
+Fixedsys,		0,	1,	Courier-Bold,		0
+Fixedsys,		1,	0,	Courier-Oblique,	0
+Fixedsys,		1,	1,	Courier-BoldOblique,	0
+Helvetica,		0,	0,	Helvetica,		0
+Helvetica,		0,	1,	Helvetica-Bold,		0
+Helvetica,		1,	0,	Helvetica-Oblique,	0
+Helvetica,		1,	1,	Helvetica-BoldOblique,	0
+Helvetica-Narrow,	0,	0,	Helvetica-Narrow,	0
+Helvetica-Narrow,	0,	1,	Helvetica-Narrow-Bold,	0
+Helvetica-Narrow,	1,	0,	Helvetica-Narrow-Oblique,	0
+Helvetica-Narrow,	1,	1,	Helvetica-Narrow-BoldOblique,	0
+ITC Bookman,		0,	0,	Bookman-Light,		0
+ITC Bookman,		0,	1,	Bookman-Demi,		0
+ITC Bookman,		1,	0,	Bookman-LightItalic,	0
+ITC Bookman,		1,	1,	Bookman-DemiItalic,	0
+Lucida Console,		0,	0,	Courier,		0
+Lucida Console,		0,	1,	Courier-Bold,		0
+Lucida Console,		1,	0,	Courier-Oblique,	0
+Lucida Console,		1,	1,	Courier-BoldOblique,	0
+Lucida Sans Typewriter,	0,	0,	Courier,		0
+Lucida Sans Typewriter,	0,	1,	Courier-Bold,		0
+Lucida Sans Typewriter,	1,	0,	Courier-Oblique,	0
+Lucida Sans Typewriter,	1,	1,	Courier-BoldOblique,	0
+Monotype.com,		0,	0,	Courier,		0
+Monotype.com,		0,	1,	Courier-Bold,		0
+Monotype.com,		1,	0,	Courier-Oblique,	0
+Monotype.com,		1,	1,	Courier-BoldOblique,	0
+MS Sans Serif,		0,	0,	Helvetica,		0
+MS Sans Serif,		0,	1,	Helvetica-Bold,		0
+MS Sans Serif,		1,	0,	Helvetica-Oblique,	0
+MS Sans Serif,		1,	1,	Helvetica-BoldOblique,	0
+New Century Schlbk,	0,	0,	NewCenturySchlbk-Roman,	0
+New Century Schlbk,	0,	1,	NewCenturySchlbk-Bold,	0
+New Century Schlbk,	1,	0,	NewCenturySchlbk-Italic,	0
+New Century Schlbk,	1,	1,	NewCenturySchlbk-BoldItalic,	0
+NewCenturySchlbk,	0,	0,	NewCenturySchlbk-Roman,	0
+NewCenturySchlbk,	0,	1,	NewCenturySchlbk-Bold,	0
+NewCenturySchlbk,	1,	0,	NewCenturySchlbk-Italic,	0
+NewCenturySchlbk,	1,	1,	NewCenturySchlbk-BoldItalic,	0
+Palatino,		0,	0,	Palatino-Roman,		0
+Palatino,		0,	1,	Palatino-Bold,		0
+Palatino,		1,	0,	Palatino-Italic,	0
+Palatino,		1,	1,	Palatino-BoldItalic,	0
+Swiss,			0,	0,	Helvetica,		0
+Swiss,			0,	1,	Helvetica-Bold,		0
+Swiss,			1,	0,	Helvetica-Oblique,	0
+Swiss,			1,	1,	Helvetica-BoldOblique,	0
+Tahoma,			0,	0,	Helvetica,		0
+Tahoma,			0,	1,	Helvetica-Bold,		0
+Tahoma,			1,	0,	Helvetica-Oblique,	0
+Tahoma,			1,	1,	Helvetica-BoldOblique,	0
+Trebuchet MS,		0,	0,	Helvetica,		0
+Trebuchet MS,		0,	1,	Helvetica-Bold,		0
+Trebuchet MS,		1,	0,	Helvetica-Oblique,	0
+Trebuchet MS,		1,	1,	Helvetica-BoldOblique,	0
+Univers,		0,	0,	Helvetica,		0
+Univers,		0,	1,	Helvetica-Bold,		0
+Univers,		1,	0,	Helvetica-Oblique,	0
+Univers,		1,	1,	Helvetica-BoldOblique,	0
+Verdana,		0,	0,	Helvetica,		0
+Verdana,		0,	1,	Helvetica-Bold,		0
+Verdana,		1,	0,	Helvetica-Oblique,	0
+Verdana,		1,	1,	Helvetica-BoldOblique,	0
+# All the other fonts
+*,			0,	0,	Times-Roman,		0
+*,			0,	1,	Times-Bold,		0
+*,			1,	0,	Times-Italic,		0
+*,			1,	1,	Times-BoldItalic,	0

+ 43 - 0
sys/lib/antiword/fontnames.russian

@@ -0,0 +1,43 @@
+# Default fontnames translation table
+# for Cyrillic
+#
+# by: Dmitry Chernyak <cdl@inkasbank.ru>
+#
+# MS-Word fontname,	Italic,	Bold,	PostScript fontname,	Special
+Arial,			0,	0,	ArialCyrMT,		0
+Arial,			0,	1,	ArialCyrMT-Bold,	0
+Arial,			1,	0,	ArialCyrMT-Italic,	0
+Arial,			1,	1,	ArialCyrMT-BoldItalic,	0
+Courier,		0,	0,	CourierCyrPS,		0
+Courier,		0,	1,	CourierCyrPS-Bold,	0
+Courier,		1,	0,	CourierCyrPS-Inclined,	0
+Courier,		1,	1,	CourierCyrPS-BoldInclined,	0
+Courier New,		0,	0,	CourierCyrPS,		0
+Courier New,		0,	1,	CourierCyrPS-Bold,	0
+Courier New,		1,	0,	CourierCyrPS-Inclined,	0
+Courier New,		1,	1,	CourierCyrPS-BoldInclined,	0
+Fixedsys,		0,	0,	CourierCyrPS,		0
+Fixedsys,		0,	1,	CourierCyrPS-Bold,	0
+Fixedsys,		1,	0,	CourierCyrPS-Inclined,	0
+Fixedsys,		1,	1,	CourierCyrPS-BoldInclined,	0
+Helvetica,		0,	0,	ArialCyrMT,		0
+Helvetica,		0,	1,	ArialCyrMT-Bold,	0
+Helvetica,		1,	0,	ArialCyrMT-Italic,	0
+Helvetica,		1,	1,	ArialCyrMT-BoldItalic,	0
+Lucida Console,		0,	0,	CourierCyrPS,		0
+Lucida Console,		0,	1,	CourierCyrPS-Bold,	0
+Lucida Console,		1,	0,	CourierCyrPS-Inclined,	0
+Lucida Console,		1,	1,	CourierCyrPS-BoldInclined,	0
+Swiss,			0,	0,	Helvetica,		0
+Swiss,			0,	1,	Helvetica-Bold,		0
+Swiss,			1,	0,	Helvetica-Oblique,	0
+Swiss,			1,	1,	Helvetica-BoldOblique,	0
+Univers,		0,	0,	Helvetica,		0
+Univers,		0,	1,	Helvetica-Bold,		0
+Univers,		1,	0,	Helvetica-Oblique,	0
+Univers,		1,	1,	Helvetica-BoldOblique,	0
+# All the other fonts
+*,			0,	0,	TimesNRCyrMT,		0
+*,			0,	1,	TimesNRCyrMT-Bold,	0
+*,			1,	0,	TimesNRCyrMT-Inclined,	0
+*,			1,	1,	TimesNRCyrMT-BoldInclined,	0

+ 302 - 0
sys/lib/antiword/koi8-r.txt

@@ -0,0 +1,302 @@
+#
+#	Name:             KOI8-R (RFC1489) to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             18 August 1999
+#	Authors:          Helmut Richter <richter@lrz.de>
+#
+#	Copyright (c) 1991-1999 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       KOI8-R characters map into Unicode. The underlying document is the
+#	mapping described in RFC 1489. No statements are made as to whether
+#	this mapping is the same as the mapping defined as "Code Page 878"
+#	with some vendors.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the KOI8-R code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in KOI8-R order.
+#
+#	Version history
+#	1.0 version: created.
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x2500	#	BOX DRAWINGS LIGHT HORIZONTAL
+0x81	0x2502	#	BOX DRAWINGS LIGHT VERTICAL
+0x82	0x250C	#	BOX DRAWINGS LIGHT DOWN AND RIGHT
+0x83	0x2510	#	BOX DRAWINGS LIGHT DOWN AND LEFT
+0x84	0x2514	#	BOX DRAWINGS LIGHT UP AND RIGHT
+0x85	0x2518	#	BOX DRAWINGS LIGHT UP AND LEFT
+0x86	0x251C	#	BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0x87	0x2524	#	BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0x88	0x252C	#	BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0x89	0x2534	#	BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0x8A	0x253C	#	BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0x8B	0x2580	#	UPPER HALF BLOCK
+0x8C	0x2584	#	LOWER HALF BLOCK
+0x8D	0x2588	#	FULL BLOCK
+0x8E	0x258C	#	LEFT HALF BLOCK
+0x8F	0x2590	#	RIGHT HALF BLOCK
+0x90	0x2591	#	LIGHT SHADE
+0x91	0x2592	#	MEDIUM SHADE
+0x92	0x2593	#	DARK SHADE
+0x93	0x2320	#	TOP HALF INTEGRAL
+0x94	0x25A0	#	BLACK SQUARE
+0x95	0x2219	#	BULLET OPERATOR
+0x96	0x221A	#	SQUARE ROOT
+0x97	0x2248	#	ALMOST EQUAL TO
+0x98	0x2264	#	LESS-THAN OR EQUAL TO
+0x99	0x2265	#	GREATER-THAN OR EQUAL TO
+0x9A	0x00A0	#	NO-BREAK SPACE
+0x9B	0x2321	#	BOTTOM HALF INTEGRAL
+0x9C	0x00B0	#	DEGREE SIGN
+0x9D	0x00B2	#	SUPERSCRIPT TWO
+0x9E	0x00B7	#	MIDDLE DOT
+0x9F	0x00F7	#	DIVISION SIGN
+0xA0	0x2550	#	BOX DRAWINGS DOUBLE HORIZONTAL
+0xA1	0x2551	#	BOX DRAWINGS DOUBLE VERTICAL
+0xA2	0x2552	#	BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+0xA3	0x0451	#	CYRILLIC SMALL LETTER IO
+0xA4	0x2553	#	BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+0xA5	0x2554	#	BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xA6	0x2555	#	BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+0xA7	0x2556	#	BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+0xA8	0x2557	#	BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xA9	0x2558	#	BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+0xAA	0x2559	#	BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+0xAB	0x255A	#	BOX DRAWINGS DOUBLE UP AND RIGHT
+0xAC	0x255B	#	BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+0xAD	0x255C	#	BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+0xAE	0x255D	#	BOX DRAWINGS DOUBLE UP AND LEFT
+0xAF	0x255E	#	BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xB0	0x255F	#	BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+0xB1	0x2560	#	BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xB2	0x2561	#	BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xB3	0x0401	#	CYRILLIC CAPITAL LETTER IO
+0xB4	0x2562	#	BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+0xB5	0x2563	#	BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xB6	0x2564	#	BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+0xB7	0x2565	#	BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+0xB8	0x2566	#	BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xB9	0x2567	#	BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+0xBA	0x2568	#	BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+0xBB	0x2569	#	BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xBC	0x256A	#	BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xBD	0x256B	#	BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+0xBE	0x256C	#	BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xBF	0x00A9	#	COPYRIGHT SIGN
+0xC0	0x044E	#	CYRILLIC SMALL LETTER YU
+0xC1	0x0430	#	CYRILLIC SMALL LETTER A
+0xC2	0x0431	#	CYRILLIC SMALL LETTER BE
+0xC3	0x0446	#	CYRILLIC SMALL LETTER TSE
+0xC4	0x0434	#	CYRILLIC SMALL LETTER DE
+0xC5	0x0435	#	CYRILLIC SMALL LETTER IE
+0xC6	0x0444	#	CYRILLIC SMALL LETTER EF
+0xC7	0x0433	#	CYRILLIC SMALL LETTER GHE
+0xC8	0x0445	#	CYRILLIC SMALL LETTER HA
+0xC9	0x0438	#	CYRILLIC SMALL LETTER I
+0xCA	0x0439	#	CYRILLIC SMALL LETTER SHORT I
+0xCB	0x043A	#	CYRILLIC SMALL LETTER KA
+0xCC	0x043B	#	CYRILLIC SMALL LETTER EL
+0xCD	0x043C	#	CYRILLIC SMALL LETTER EM
+0xCE	0x043D	#	CYRILLIC SMALL LETTER EN
+0xCF	0x043E	#	CYRILLIC SMALL LETTER O
+0xD0	0x043F	#	CYRILLIC SMALL LETTER PE
+0xD1	0x044F	#	CYRILLIC SMALL LETTER YA
+0xD2	0x0440	#	CYRILLIC SMALL LETTER ER
+0xD3	0x0441	#	CYRILLIC SMALL LETTER ES
+0xD4	0x0442	#	CYRILLIC SMALL LETTER TE
+0xD5	0x0443	#	CYRILLIC SMALL LETTER U
+0xD6	0x0436	#	CYRILLIC SMALL LETTER ZHE
+0xD7	0x0432	#	CYRILLIC SMALL LETTER VE
+0xD8	0x044C	#	CYRILLIC SMALL LETTER SOFT SIGN
+0xD9	0x044B	#	CYRILLIC SMALL LETTER YERU
+0xDA	0x0437	#	CYRILLIC SMALL LETTER ZE
+0xDB	0x0448	#	CYRILLIC SMALL LETTER SHA
+0xDC	0x044D	#	CYRILLIC SMALL LETTER E
+0xDD	0x0449	#	CYRILLIC SMALL LETTER SHCHA
+0xDE	0x0447	#	CYRILLIC SMALL LETTER CHE
+0xDF	0x044A	#	CYRILLIC SMALL LETTER HARD SIGN
+0xE0	0x042E	#	CYRILLIC CAPITAL LETTER YU
+0xE1	0x0410	#	CYRILLIC CAPITAL LETTER A
+0xE2	0x0411	#	CYRILLIC CAPITAL LETTER BE
+0xE3	0x0426	#	CYRILLIC CAPITAL LETTER TSE
+0xE4	0x0414	#	CYRILLIC CAPITAL LETTER DE
+0xE5	0x0415	#	CYRILLIC CAPITAL LETTER IE
+0xE6	0x0424	#	CYRILLIC CAPITAL LETTER EF
+0xE7	0x0413	#	CYRILLIC CAPITAL LETTER GHE
+0xE8	0x0425	#	CYRILLIC CAPITAL LETTER HA
+0xE9	0x0418	#	CYRILLIC CAPITAL LETTER I
+0xEA	0x0419	#	CYRILLIC CAPITAL LETTER SHORT I
+0xEB	0x041A	#	CYRILLIC CAPITAL LETTER KA
+0xEC	0x041B	#	CYRILLIC CAPITAL LETTER EL
+0xED	0x041C	#	CYRILLIC CAPITAL LETTER EM
+0xEE	0x041D	#	CYRILLIC CAPITAL LETTER EN
+0xEF	0x041E	#	CYRILLIC CAPITAL LETTER O
+0xF0	0x041F	#	CYRILLIC CAPITAL LETTER PE
+0xF1	0x042F	#	CYRILLIC CAPITAL LETTER YA
+0xF2	0x0420	#	CYRILLIC CAPITAL LETTER ER
+0xF3	0x0421	#	CYRILLIC CAPITAL LETTER ES
+0xF4	0x0422	#	CYRILLIC CAPITAL LETTER TE
+0xF5	0x0423	#	CYRILLIC CAPITAL LETTER U
+0xF6	0x0416	#	CYRILLIC CAPITAL LETTER ZHE
+0xF7	0x0412	#	CYRILLIC CAPITAL LETTER VE
+0xF8	0x042C	#	CYRILLIC CAPITAL LETTER SOFT SIGN
+0xF9	0x042B	#	CYRILLIC CAPITAL LETTER YERU
+0xFA	0x0417	#	CYRILLIC CAPITAL LETTER ZE
+0xFB	0x0428	#	CYRILLIC CAPITAL LETTER SHA
+0xFC	0x042D	#	CYRILLIC CAPITAL LETTER E
+0xFD	0x0429	#	CYRILLIC CAPITAL LETTER SHCHA
+0xFE	0x0427	#	CYRILLIC CAPITAL LETTER CHE
+0xFF	0x042A	#	CYRILLIC CAPITAL LETTER HARD SIGN

+ 303 - 0
sys/lib/antiword/koi8-u.txt

@@ -0,0 +1,303 @@
+#
+#	Name:             KOI8-U (RFC2319) to Unicode
+#	Unicode version:  3.0
+#	Table version:    1.0
+#	Table format:     Format A
+#	Date:             08 September 2001
+#	Authors:          Andriy Rysin <arysin@yahoo.com>
+#
+#	Copyright (c) 1991-2001 Unicode, Inc.  All Rights reserved.
+#
+#	This file is provided as-is by Unicode, Inc. (The Unicode Consortium).
+#	No claims are made as to fitness for any particular purpose.  No
+#	warranties of any kind are expressed or implied.  The recipient
+#	agrees to determine applicability of information provided.  If this
+#	file has been provided on optical media by Unicode, Inc., the sole
+#	remedy for any claim will be exchange of defective media within 90
+#	days of receipt.
+#
+#	Unicode, Inc. hereby grants the right to freely use the information
+#	supplied in this file in the creation of products supporting the
+#	Unicode Standard, and to make copies of this file in any form for
+#	internal or external distribution as long as this notice remains
+#	attached.
+#
+#	General notes:
+#
+#	This table contains the data the Unicode Consortium has on how
+#       KOI8-U characters map into Unicode. The underlying document is the
+#	mapping described in RFC 2319. No statements are made as to whether
+#	this mapping is the same as the mapping defined as "Code Page 878"
+#	with some vendors.
+#
+#	Format:  Three tab-separated columns
+#		 Column #1 is the KOI8-U code (in hex as 0xXX)
+#		 Column #2 is the Unicode (in hex as 0xXXXX)
+#		 Column #3 the Unicode name (follows a comment sign, '#')
+#
+#	The entries are in KOI8-U order.
+#
+#	Version history
+#	1.0 version: created.
+#
+#	Any comments or problems, contact <errata@unicode.org>
+#	Please note that <errata@unicode.org> is an archival address;
+#	notices will be checked, but do not expect an immediate response.
+#
+0x00	0x0000	#	NULL
+0x01	0x0001	#	START OF HEADING
+0x02	0x0002	#	START OF TEXT
+0x03	0x0003	#	END OF TEXT
+0x04	0x0004	#	END OF TRANSMISSION
+0x05	0x0005	#	ENQUIRY
+0x06	0x0006	#	ACKNOWLEDGE
+0x07	0x0007	#	BELL
+0x08	0x0008	#	BACKSPACE
+0x09	0x0009	#	HORIZONTAL TABULATION
+0x0A	0x000A	#	LINE FEED
+0x0B	0x000B	#	VERTICAL TABULATION
+0x0C	0x000C	#	FORM FEED
+0x0D	0x000D	#	CARRIAGE RETURN
+0x0E	0x000E	#	SHIFT OUT
+0x0F	0x000F	#	SHIFT IN
+0x10	0x0010	#	DATA LINK ESCAPE
+0x11	0x0011	#	DEVICE CONTROL ONE
+0x12	0x0012	#	DEVICE CONTROL TWO
+0x13	0x0013	#	DEVICE CONTROL THREE
+0x14	0x0014	#	DEVICE CONTROL FOUR
+0x15	0x0015	#	NEGATIVE ACKNOWLEDGE
+0x16	0x0016	#	SYNCHRONOUS IDLE
+0x17	0x0017	#	END OF TRANSMISSION BLOCK
+0x18	0x0018	#	CANCEL
+0x19	0x0019	#	END OF MEDIUM
+0x1A	0x001A	#	SUBSTITUTE
+0x1B	0x001B	#	ESCAPE
+0x1C	0x001C	#	FILE SEPARATOR
+0x1D	0x001D	#	GROUP SEPARATOR
+0x1E	0x001E	#	RECORD SEPARATOR
+0x1F	0x001F	#	UNIT SEPARATOR
+0x20	0x0020	#	SPACE
+0x21	0x0021	#	EXCLAMATION MARK
+0x22	0x0022	#	QUOTATION MARK
+0x23	0x0023	#	NUMBER SIGN
+0x24	0x0024	#	DOLLAR SIGN
+0x25	0x0025	#	PERCENT SIGN
+0x26	0x0026	#	AMPERSAND
+0x27	0x0027	#	APOSTROPHE
+0x28	0x0028	#	LEFT PARENTHESIS
+0x29	0x0029	#	RIGHT PARENTHESIS
+0x2A	0x002A	#	ASTERISK
+0x2B	0x002B	#	PLUS SIGN
+0x2C	0x002C	#	COMMA
+0x2D	0x002D	#	HYPHEN-MINUS
+0x2E	0x002E	#	FULL STOP
+0x2F	0x002F	#	SOLIDUS
+0x30	0x0030	#	DIGIT ZERO
+0x31	0x0031	#	DIGIT ONE
+0x32	0x0032	#	DIGIT TWO
+0x33	0x0033	#	DIGIT THREE
+0x34	0x0034	#	DIGIT FOUR
+0x35	0x0035	#	DIGIT FIVE
+0x36	0x0036	#	DIGIT SIX
+0x37	0x0037	#	DIGIT SEVEN
+0x38	0x0038	#	DIGIT EIGHT
+0x39	0x0039	#	DIGIT NINE
+0x3A	0x003A	#	COLON
+0x3B	0x003B	#	SEMICOLON
+0x3C	0x003C	#	LESS-THAN SIGN
+0x3D	0x003D	#	EQUALS SIGN
+0x3E	0x003E	#	GREATER-THAN SIGN
+0x3F	0x003F	#	QUESTION MARK
+0x40	0x0040	#	COMMERCIAL AT
+0x41	0x0041	#	LATIN CAPITAL LETTER A
+0x42	0x0042	#	LATIN CAPITAL LETTER B
+0x43	0x0043	#	LATIN CAPITAL LETTER C
+0x44	0x0044	#	LATIN CAPITAL LETTER D
+0x45	0x0045	#	LATIN CAPITAL LETTER E
+0x46	0x0046	#	LATIN CAPITAL LETTER F
+0x47	0x0047	#	LATIN CAPITAL LETTER G
+0x48	0x0048	#	LATIN CAPITAL LETTER H
+0x49	0x0049	#	LATIN CAPITAL LETTER I
+0x4A	0x004A	#	LATIN CAPITAL LETTER J
+0x4B	0x004B	#	LATIN CAPITAL LETTER K
+0x4C	0x004C	#	LATIN CAPITAL LETTER L
+0x4D	0x004D	#	LATIN CAPITAL LETTER M
+0x4E	0x004E	#	LATIN CAPITAL LETTER N
+0x4F	0x004F	#	LATIN CAPITAL LETTER O
+0x50	0x0050	#	LATIN CAPITAL LETTER P
+0x51	0x0051	#	LATIN CAPITAL LETTER Q
+0x52	0x0052	#	LATIN CAPITAL LETTER R
+0x53	0x0053	#	LATIN CAPITAL LETTER S
+0x54	0x0054	#	LATIN CAPITAL LETTER T
+0x55	0x0055	#	LATIN CAPITAL LETTER U
+0x56	0x0056	#	LATIN CAPITAL LETTER V
+0x57	0x0057	#	LATIN CAPITAL LETTER W
+0x58	0x0058	#	LATIN CAPITAL LETTER X
+0x59	0x0059	#	LATIN CAPITAL LETTER Y
+0x5A	0x005A	#	LATIN CAPITAL LETTER Z
+0x5B	0x005B	#	LEFT SQUARE BRACKET
+0x5C	0x005C	#	REVERSE SOLIDUS
+0x5D	0x005D	#	RIGHT SQUARE BRACKET
+0x5E	0x005E	#	CIRCUMFLEX ACCENT
+0x5F	0x005F	#	LOW LINE
+0x60	0x0060	#	GRAVE ACCENT
+0x61	0x0061	#	LATIN SMALL LETTER A
+0x62	0x0062	#	LATIN SMALL LETTER B
+0x63	0x0063	#	LATIN SMALL LETTER C
+0x64	0x0064	#	LATIN SMALL LETTER D
+0x65	0x0065	#	LATIN SMALL LETTER E
+0x66	0x0066	#	LATIN SMALL LETTER F
+0x67	0x0067	#	LATIN SMALL LETTER G
+0x68	0x0068	#	LATIN SMALL LETTER H
+0x69	0x0069	#	LATIN SMALL LETTER I
+0x6A	0x006A	#	LATIN SMALL LETTER J
+0x6B	0x006B	#	LATIN SMALL LETTER K
+0x6C	0x006C	#	LATIN SMALL LETTER L
+0x6D	0x006D	#	LATIN SMALL LETTER M
+0x6E	0x006E	#	LATIN SMALL LETTER N
+0x6F	0x006F	#	LATIN SMALL LETTER O
+0x70	0x0070	#	LATIN SMALL LETTER P
+0x71	0x0071	#	LATIN SMALL LETTER Q
+0x72	0x0072	#	LATIN SMALL LETTER R
+0x73	0x0073	#	LATIN SMALL LETTER S
+0x74	0x0074	#	LATIN SMALL LETTER T
+0x75	0x0075	#	LATIN SMALL LETTER U
+0x76	0x0076	#	LATIN SMALL LETTER V
+0x77	0x0077	#	LATIN SMALL LETTER W
+0x78	0x0078	#	LATIN SMALL LETTER X
+0x79	0x0079	#	LATIN SMALL LETTER Y
+0x7A	0x007A	#	LATIN SMALL LETTER Z
+0x7B	0x007B	#	LEFT CURLY BRACKET
+0x7C	0x007C	#	VERTICAL LINE
+0x7D	0x007D	#	RIGHT CURLY BRACKET
+0x7E	0x007E	#	TILDE
+0x7F	0x007F	#	DELETE
+0x80	0x2500	#	BOX DRAWINGS LIGHT HORIZONTAL
+0x81	0x2502	#	BOX DRAWINGS LIGHT VERTICAL
+0x82	0x250C	#	BOX DRAWINGS LIGHT DOWN AND RIGHT
+0x83	0x2510	#	BOX DRAWINGS LIGHT DOWN AND LEFT
+0x84	0x2514	#	BOX DRAWINGS LIGHT UP AND RIGHT
+0x85	0x2518	#	BOX DRAWINGS LIGHT UP AND LEFT
+0x86	0x251C	#	BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0x87	0x2524	#	BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0x88	0x252C	#	BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0x89	0x2534	#	BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0x8A	0x253C	#	BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0x8B	0x2580	#	UPPER HALF BLOCK
+0x8C	0x2584	#	LOWER HALF BLOCK
+0x8D	0x2588	#	FULL BLOCK
+0x8E	0x258C	#	LEFT HALF BLOCK
+0x8F	0x2590	#	RIGHT HALF BLOCK
+0x90	0x2591	#	LIGHT SHADE
+0x91	0x2592	#	MEDIUM SHADE
+0x92	0x2593	#	DARK SHADE
+0x93	0x2320	#	TOP HALF INTEGRAL
+0x94	0x25A0	#	BLACK SQUARE
+0x95	0x2219	#	BULLET OPERATOR
+0x96	0x221A	#	SQUARE ROOT
+0x97	0x2248	#	ALMOST EQUAL TO
+0x98	0x2264	#	LESS-THAN OR EQUAL TO
+0x99	0x2265	#	GREATER-THAN OR EQUAL TO
+0x9A	0x00A0	#	NO-BREAK SPACE
+0x9B	0x2321	#	BOTTOM HALF INTEGRAL
+0x9C	0x00B0	#	DEGREE SIGN
+0x9D	0x00B2	#	SUPERSCRIPT TWO
+0x9E	0x00B7	#	MIDDLE DOT
+0x9F	0x00F7	#	DIVISION SIGN
+0xA0	0x2550	#	BOX DRAWINGS DOUBLE HORIZONTAL
+0xA1	0x2551	#	BOX DRAWINGS DOUBLE VERTICAL
+0xA2	0x2552	#	BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+0xA3	0x0451	#	CYRILLIC SMALL LETTER IO
+0xA4	0x0454	#	CYRILLIC SMALL LETTER UKRAINIAN IE
+0xA5	0x2554	#	BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xA6	0x0456	#	CYRILLIC SMALL LETTER BELORUSSIAN-UKRAINIAN I
+0xA7	0x0457	#	CYRILLIC SMALL LETTER YI (UKRAINIAN)
+0xA8	0x2557	#	BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xA9	0x2558	#	BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+0xAA	0x2559	#	BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+0xAB	0x255A	#	BOX DRAWINGS DOUBLE UP AND RIGHT
+0xAC	0x255B	#	BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+0xAD	0x0491	#	CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN
+0xAE	0x255D	#	BOX DRAWINGS DOUBLE UP AND LEFT
+0xAF	0x255E	#	BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xB0	0x255F	#	BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+0xB1	0x2560	#	BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xB2	0x2561	#	BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xB3	0x0401	#	CYRILLIC CAPITAL LETTER IO
+0xB4	0x0404	#	CYRILLIC CAPITAL LETTER UKRAINIAN IE
+0xB5	0x2563	#	BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xB6	0x0406	#	CYRILLIC CAPITAL LETTER BELORUSSIAN-UKRAINIAN I
+0xB7	0x0407	#	CYRILLIC CAPITAL LETTER YI (UKRAINIAN)
+0xB8	0x2566	#	BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xB9	0x2567	#	BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+0xBA	0x2568	#	BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+0xBB	0x2569	#	BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xBC	0x256A	#	BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xBD	0x0490	#	CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN
+0xBD	0x256B	#	BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+0xBE	0x256C	#	BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xBF	0x00A9	#	COPYRIGHT SIGN
+0xC0	0x044E	#	CYRILLIC SMALL LETTER YU
+0xC1	0x0430	#	CYRILLIC SMALL LETTER A
+0xC2	0x0431	#	CYRILLIC SMALL LETTER BE
+0xC3	0x0446	#	CYRILLIC SMALL LETTER TSE
+0xC4	0x0434	#	CYRILLIC SMALL LETTER DE
+0xC5	0x0435	#	CYRILLIC SMALL LETTER IE
+0xC6	0x0444	#	CYRILLIC SMALL LETTER EF
+0xC7	0x0433	#	CYRILLIC SMALL LETTER GHE
+0xC8	0x0445	#	CYRILLIC SMALL LETTER HA
+0xC9	0x0438	#	CYRILLIC SMALL LETTER I
+0xCA	0x0439	#	CYRILLIC SMALL LETTER SHORT I
+0xCB	0x043A	#	CYRILLIC SMALL LETTER KA
+0xCC	0x043B	#	CYRILLIC SMALL LETTER EL
+0xCD	0x043C	#	CYRILLIC SMALL LETTER EM
+0xCE	0x043D	#	CYRILLIC SMALL LETTER EN
+0xCF	0x043E	#	CYRILLIC SMALL LETTER O
+0xD0	0x043F	#	CYRILLIC SMALL LETTER PE
+0xD1	0x044F	#	CYRILLIC SMALL LETTER YA
+0xD2	0x0440	#	CYRILLIC SMALL LETTER ER
+0xD3	0x0441	#	CYRILLIC SMALL LETTER ES
+0xD4	0x0442	#	CYRILLIC SMALL LETTER TE
+0xD5	0x0443	#	CYRILLIC SMALL LETTER U
+0xD6	0x0436	#	CYRILLIC SMALL LETTER ZHE
+0xD7	0x0432	#	CYRILLIC SMALL LETTER VE
+0xD8	0x044C	#	CYRILLIC SMALL LETTER SOFT SIGN
+0xD9	0x044B	#	CYRILLIC SMALL LETTER YERU
+0xDA	0x0437	#	CYRILLIC SMALL LETTER ZE
+0xDB	0x0448	#	CYRILLIC SMALL LETTER SHA
+0xDC	0x044D	#	CYRILLIC SMALL LETTER E
+0xDD	0x0449	#	CYRILLIC SMALL LETTER SHCHA
+0xDE	0x0447	#	CYRILLIC SMALL LETTER CHE
+0xDF	0x044A	#	CYRILLIC SMALL LETTER HARD SIGN
+0xE0	0x042E	#	CYRILLIC CAPITAL LETTER YU
+0xE1	0x0410	#	CYRILLIC CAPITAL LETTER A
+0xE2	0x0411	#	CYRILLIC CAPITAL LETTER BE
+0xE3	0x0426	#	CYRILLIC CAPITAL LETTER TSE
+0xE4	0x0414	#	CYRILLIC CAPITAL LETTER DE
+0xE5	0x0415	#	CYRILLIC CAPITAL LETTER IE
+0xE6	0x0424	#	CYRILLIC CAPITAL LETTER EF
+0xE7	0x0413	#	CYRILLIC CAPITAL LETTER GHE
+0xE8	0x0425	#	CYRILLIC CAPITAL LETTER HA
+0xE9	0x0418	#	CYRILLIC CAPITAL LETTER I
+0xEA	0x0419	#	CYRILLIC CAPITAL LETTER SHORT I
+0xEB	0x041A	#	CYRILLIC CAPITAL LETTER KA
+0xEC	0x041B	#	CYRILLIC CAPITAL LETTER EL
+0xED	0x041C	#	CYRILLIC CAPITAL LETTER EM
+0xEE	0x041D	#	CYRILLIC CAPITAL LETTER EN
+0xEF	0x041E	#	CYRILLIC CAPITAL LETTER O
+0xF0	0x041F	#	CYRILLIC CAPITAL LETTER PE
+0xF1	0x042F	#	CYRILLIC CAPITAL LETTER YA
+0xF2	0x0420	#	CYRILLIC CAPITAL LETTER ER
+0xF3	0x0421	#	CYRILLIC CAPITAL LETTER ES
+0xF4	0x0422	#	CYRILLIC CAPITAL LETTER TE
+0xF5	0x0423	#	CYRILLIC CAPITAL LETTER U
+0xF6	0x0416	#	CYRILLIC CAPITAL LETTER ZHE
+0xF7	0x0412	#	CYRILLIC CAPITAL LETTER VE
+0xF8	0x042C	#	CYRILLIC CAPITAL LETTER SOFT SIGN
+0xF9	0x042B	#	CYRILLIC CAPITAL LETTER YERU
+0xFA	0x0417	#	CYRILLIC CAPITAL LETTER ZE
+0xFB	0x0428	#	CYRILLIC CAPITAL LETTER SHA
+0xFC	0x042D	#	CYRILLIC CAPITAL LETTER E
+0xFD	0x0429	#	CYRILLIC CAPITAL LETTER SHCHA
+0xFE	0x0427	#	CYRILLIC CAPITAL LETTER CHE
+0xFF	0x042A	#	CYRILLIC CAPITAL LETTER HARD SIGN

File diff suppressed because it is too large
+ 0 - 0
sys/lib/antiword/roman.txt


+ 4 - 4
sys/lib/plumb/basic

@@ -12,10 +12,10 @@ type is text
 data matches '(https?|ftp|file|gopher|mailto|news|nntp|telnet|wais|prospero)://[a-zA-Z0-9_@\-]+([.:][a-zA-Z0-9_@\-]+)*/?[a-zA-Z0-9_?,%#~&/\-+=]+([:.][a-zA-Z0-9_?,%#~&/\-+=]+)*\.(jpe?g|JPE?G|gif|GIF|ps|PS|pdf|PDF)'
 plumb start rc -c 'hget '$0' | page -w'
 
-# doc and rtf files go to wdoc2txt
+# rtf files go to wdoc2txt
 type is text
 data matches '[a-zA-Z¡-￿0-9_\-./]+'
-data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(doc|rtf)'
+data matches '([a-zA-Z¡-￿0-9_\-./]+)\.rtf'
 arg isfile	$0
 plumb to msword
 plumb start wdoc2txt $file
@@ -40,11 +40,11 @@ arg isfile	$0
 plumb to image
 plumb client page -wi
 
-# postscript/pdf/dvi go to page but not over the a plumb port
+# postscript/pdf/dvi/doc go to page but not over the a plumb port
 # the port is here for reference but is unused
 type is text
 data matches '[a-zA-Z¡-￿0-9_\-./]+'
-data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI)'
+data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(ps|PS|eps|EPS|pdf|PDF|dvi|DVI|doc|DOC)'
 arg isfile	$0
 plumb to postscript
 plumb start page -w $file

+ 342 - 0
sys/src/cmd/aux/antiword/COPYING

@@ -0,0 +1,342 @@
+
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                          675 Mass Ave, Cambridge, MA 02139, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	Appendix: How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) 19yy  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) 19yy name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
+

+ 180 - 0
sys/src/cmd/aux/antiword/ChangeLog

@@ -0,0 +1,180 @@
+****************************************************************************
+* Changes in Antiword from versions 0.22 to 0.34                           *
+****************************************************************************
+
+Changes 0.33 to 0.34
+--------------------
+Bug fixes:
+- Bug in UTF-8 tables fixed
+- Bug reported by Stewart Goldwater <sg@janus.freeserve.co.uk> fixed
+- Bug reported by Karl-Otto Linn <linn@informatik.fh-wiesbaden.de> fixed
+- Fixed a bug that made DOS hang when Antiword processed a document > 8 MB.
+New features:
+- Better approximations for fancy characters in the output
+- A Word document can now be saved as XML/DocBook.
+- Linux Makefile is now closer to conventions.
+- Support for Text Boxes
+- An environment variable ANTIWORDHOME was added to create a more flexable
+  place for the mapping files.
+- Antiword is now Latin9 enabled. Thanks to Stefan Bellon
+  <sbellon@sbellon.de> (RISC OS only)
+- Some support for MacWord 4 and 5 documents
+- More support for Word-for-DOS documents
+- Support for superscripts and subscripts
+- Displays slightly more images.
+- Improved lists, especially in documents from Word 97 or later.
+
+Changes 0.32 to 0.33
+--------------------
+Bug fixes:
+- Bug reported by Yannick PERRET <yperret@bat710.univ-lyon1.fr> fixed
+Old features:
+- The -X option is no longer supported. Replace "-X 2" by "-m 8859-2.txt"
+New features:
+- Slightly more accurate font translation
+- Full support for WinWord 2.0 documents
+- Some support for Word-for-DOS and WinWord 1.x documents
+- Selective header numbering
+- Implementation of stylesheets
+- The system-wide directory for the mapping files was changed from
+  "/opt/antiword/share" to "/usr/share/antiword", in accordance with FHS,
+  the file-system hierarchy standard, as suggested by Anand Buddhdev
+  <arb@anand.org>.
+- Antiword now turns white text into light gray text.
+- Antiword is now closer to "64-bit clean". Based on information supplied by
+  Duncan Haldane <f.duncan.m.haldane@worldnet.att.net>.
+
+Changes 0.31 to 0.32
+--------------------
+Bug fixes:
+- Bug reported by Forrest J. Cavalier III <mibsoft@mibsoftware.com> fixed
+- Bug reported by Jan ONDREJ (SAL) <ondrejj@salstar.sk> fixed
+- Bug in dealing with RLE compressed bitmap images fixed
+- Bug in image scaling fixed (RISC OS only)
+New features:
+- Improved leading (Unix only; PostScript version only)
+- Antiword can now read from the standard input. This is based on an idea by
+  Matthew Miller <mattdm@mattdm.org>. (Unix only)
+- A white background looks much better. (RISC OS only)
+- A system-wide directory for the mapping files, as suggested by Sven Geggus
+  <sven@geggus.net> and many others. (Unix only)
+- Antiword can now deal with documents larger than 7 MB.
+
+Changes 0.30 to 0.31
+--------------------
+Bug fixes:
+- Bug in the "Show hidden (by Word) text" feature fixed
+- Bug reported by David Aspinwall <aspinwall@timesten.com> fixed
+- Bug reported by Robert Steinmetz <rob@steinmetznet.com> fixed
+Old features:
+- The -g and -c options are no longer supported. The -c option was the default
+  and is now used automatically. (Unix only)
+New features:
+- Ability to display some of the images
+- Ability to use landscape mode (Unix only; PostScript version only)
+- Support for all ISO-8859 character sets plus KOI8 and some code pages
+  (Unix only; text version only)
+- Antiword will now give a warning if the specified PostScript paper size is
+  unsupported. Thanks to Greg Robinson <Greg.Robinson@dsto.defence.gov.au>
+- Changed from PostScript version 1 to version 2
+- Antiword now returns 1 if no Word document is found among the files listed
+  on the command line, as suggested by Jens Schleusener
+  <Jens.Schleusener@dlr.de>.
+- Takes the right margin into account
+- The PostScript part now supports the AvantGarde, Bookman, Helvetica-Narrow,
+  NewCenturySchlbk and Palatino fonts (Unix only)
+- More accurate fontnames translation table
+- Initial scale factor is now configurable (RISC OS only)
+
+Changes 0.29 to 0.30
+--------------------
+Bug fixes:
+- Bug in the generated PostScript (nocurrentpoint) fixed
+- Bug reported by Keith Bamford <kbamford@eurobell.co.uk> fixed
+- Bug in the chapter numbering font fixed
+New features:
+- Improved handling of changes in the font size on a single line.
+- Some support for long file names (RISC OS only)
+- Thanks to David Kanareck <david@davidkanareck.demon.co.uk>, Antiword can
+  now deal with documents made by "Word for Asian languages", but only
+  when these documents are written in a European language.
+- Character properties "Caps" and "SmallCaps" for accented characters
+- More accurate fontnames translation table. (RISC OS only)
+- PostScript part now supports the Times and Helvetica fonts. (Unix only)
+
+Changes 0.28 to 0.29
+--------------------
+Bug fixes:
+- Bug reported by Paul McCann <P.J.McCann@cfm1220.x400.icl.co.uk> fixed
+- Character property "SmallCaps" works better now
+- Bug reported by Richard Lambley <richard@wireless.demon.co.uk> fixed
+- Fixed a bug in the linewidth computation (Unix only)
+New features:
+- A Word document can now be saved as PostScript (Unix only, Courier font only)
+- Left, Center, Right and Justify alignment added for Word 97
+- Supports the Macintosh character set
+
+Changes 0.27 to 0.28
+--------------------
+Licence:
+- Distributed under the GNU General Public License
+Bug fixes:
+- Bug reported by Richard Lambley <richard@wireless.demon.co.uk> has not
+  been fixed yet.
+- Deals correctly with fancy quotes in files from a Macintosh
+New features:
+- Supports character properties "SmallCaps", "Caps" and "Hidden Text"
+- The use of fonts and font sizes for "fast saved" documents is now supported.
+- Separators between the text, the footnotes and the endnotes
+- Footnotes are now numbered in Arabic numericals (1, 2, 3), endnotes are now
+  numbered in Roman numericals (i, ii, iii).
+
+Changes 0.26 to 0.27
+--------------------
+Bug fixes:
+- The main title now shows the first 12 characters of the file name.
+New features:
+- "Fast saved" documents are now supported for Word 97.
+- All tables are now supported for Word 97.
+- It is now possible to scale the text.
+
+Changes 0.25 to 0.26
+--------------------
+Bug fixes:
+- Fixed several problems with the Choices file
+- Closed a small memory leak
+New features:
+- The use of fonts and font sizes for "full saved" documents is now supported.
+- Most tables are now supported for Word 97.
+- Header numbers are now supported for Word 97.
+
+Changes 0.24 to 0.25
+--------------------
+Bug fixes:
+- Improved handling of memory shortages
+- Some special tables were messed up.
+New features:
+- "Fast saved" documents are now supported for Word 6 and 7.
+- A new option to permit Antiword to change the filetype of Word documents to
+  MSWord (&ae6).
+- A Wordfile can now be saved as a Drawfile.
+- The look and feel has been changed from editor-like to browser-like
+
+Changes 0.23 to 0.24
+--------------------
+Bug fixes:
+- Empty paragraphs in numbered list were not always numbered correctly.
+- In very complex tables some text could get lost.
+New features:
+- F3 is now a shortcut to the "Save as" dialogue box.
+- Left, Center, Right and Justify alignment added for Word 6 and 7
+- [pic] marks the place where an image should have been.
+- It is now possible to have a writeable Choices file, even when Antiword
+  itself is on a read-only medium.
+
+Changes 0.22 to 0.23
+--------------------
+New features:
+- Paragraph breaks are now an option.
+- Bulleted single level lists for files from Word 6 and 7
+- Numbered single level lists (some styles) for files from Word 6 and 7

+ 134 - 0
sys/src/cmd/aux/antiword/Emacs

@@ -0,0 +1,134 @@
+From: Alex Schroeder <alex@emacswiki.org>
+Subject: Re: MS Word mode?
+Date: Fri, 08 Nov 2002 00:40:15 +0100
+
+Roger Mason <rmason@sparky2.esd.mun.ca> writes:
+
+> There was a question about this recently on this forum.  Look for
+> undoc.el, I got it from the wiki (I think).  It has worked very well for
+> me to date, although I have not attempted ro read complex documents.
+
+Well, it makes things readable, but it is far from perfect -- it seems
+to just delete any non-ascii characters, such that sometimes you will
+see words such as "Alex8" where "8" is some garbage that just looked
+like being part of a real word...  In other words, interfacing to
+something like catdoc, antiword, or wvText (included with AbiWord)
+might be cool.  Actually all you need is this:
+
+(add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word))
+
+(defun no-word ()
+  "Run antiword on the entire buffer."
+  (shell-command-on-region (point-min) (point-max) "antiword - " t t))
+
+Alex.
+
+===============================================================================
+
+From: Arnaldo Mandel <am@ime.usp.br>
+Subject: Re: MS Word mode?
+Date: Fri, 8 Nov 2002 11:52:33 -0200
+
+Alex Schroeder wrote (on Nov 8, 2002):
+
+ >                 Actually all you need is this:
+ > 
+ > (add-to-list 'auto-mode-alist '("\\.doc\\'" . no-word))
+ > 
+ > (defun no-word ()
+ >   "Run antiword on the entire buffer."
+ >   (shell-command-on-region (point-min) (point-max) "antiword - " t t))
+
+On my system there are lots of filenames ending in .doc whose files
+are not Word files.  So I modified your function thusly
+
+(defun no-word ()
+  "Run antiword on the entire buffer."
+  (if (string-match "Microsoft "
+		    (shell-command-to-string (concat "file " buffer-file-name)))
+      (shell-command-on-region (point-min) (point-max) "antiword - " t t)))
+
+Works in Solaris and Linux, and should work on other unixes as well.
+
+am
+
+===============================================================================
+
+From: Alex Schroeder <alex@emacswiki.org>
+Subject: Re: MS Word mode?
+Date: Fri, 08 Nov 2002 18:24:07 +0100
+
+Arnaldo Mandel <am@ime.usp.br> writes:
+
+> (defun no-word ()
+>   "Run antiword on the entire buffer."
+>   (if (string-match "Microsoft "
+> 		    (shell-command-to-string (concat "file " buffer-file-name)))
+>       (shell-command-on-region (point-min) (point-max) "antiword - " t t)))
+
+Cool.  I did not know about "file"...  :)
+
+My stuff is on the wiki, btw:
+
+* http://www.emacswiki.org/cgi-bin/wiki.pl?AntiWord
+
+Alex.
+
+===============================================================================
+
+From: Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de>
+Subject: Re: emacs rmail. How to convert .doc to plain text
+Date: 24 Nov 2002 18:08:22 +0100
+
+Hi,
+
+Puff Addison <puff@theaddisons.demon.co.uk> writes:
+> Yes, please post your Emacs integration code.
+
+Ok, see below.  I should note that it is probably also possible to
+(ab-)use jka-compr for this, which would make my two functions
+obsolete.
+
+so long, benny
+
+>>>>>>>
+
+(defun benny-antiword-file-handler (operation &rest args)
+  ;; First check for the specific operations
+  ;; that we have special handling for.
+  (cond ((eq operation 'insert-file-contents)
+	 (apply 'benny-antiword-insert-file args))
+	((eq operation 'file-writable-p)
+	 nil)
+	((eq operation 'write-region)
+	 (error "Word documents can't be written"))
+	;; Handle any operation we don't know about.
+	(t (let ((inhibit-file-name-handlers
+		  (cons 'benny-antiword-file-handler
+			(and (eq inhibit-file-name-operation operation)
+			     inhibit-file-name-handlers)))
+		 (inhibit-file-name-operation operation))
+	     (apply operation args)))))
+
+(defun benny-antiword-insert-file (filename &optional visit beg end replace)
+  (set-buffer-modified-p nil)
+  (setq buffer-file-name (file-truename filename))
+  (setq buffer-read-only t)
+  (let ((start (point))
+	(inhibit-read-only t))
+    (if replace (delete-region (point-min) (point-max)))
+    (save-excursion
+      (let ((coding-system-for-read 'utf-8)
+	    (filename (encode-coding-string
+		       buffer-file-name
+		       (or file-name-coding-system
+			   default-file-name-coding-system))))
+	(call-process "antiword" nil t nil "-m" "UTF-8.txt"
+		      filename))
+      (list buffer-file-name (- (point) start)))))
+
+(setq file-name-handler-alist
+      (cons '("\\.doc\\'" . benny-antiword-file-handler)
+	    file-name-handler-alist))
+
+<<<<<<<

+ 14 - 0
sys/src/cmd/aux/antiword/Exmh

@@ -0,0 +1,14 @@
+From: Glenn Burkhardt <glenn@vtecus.com>
+Subject: It's great!
+Date: Wed, 22 Aug 2001 12:02:54 -0400
+
+Thank you for this program.  Thank you very much!  Thank you immensely!!
+
+
+P.S.  I find entry helpful as a /etc/mailcap rule:
+
+application/msword;/usr/local/bin/antiword -t %s | less; needsterminal; \
+copiousoutput; print=antiword -p letter %s|lpr
+
+I completely integrates the text mode with my mailer, exmh.  You might
+want to include it in your documentation.

+ 97 - 0
sys/src/cmd/aux/antiword/FAQ

@@ -0,0 +1,97 @@
+Frequently Asked Questions
+==========================
+
+These questions and answers are mainly Linux/Unix oriented. For other
+Operating Systems you may want to read the documentation provided by the
+people who ported Antiword.
+
+Q1: How do I install Antiword?
+A1: (a) Make a suitable directory such as '$HOME/src/antiword' and copy the
+        'antiword.tar.gz' file to this directory.
+    (b) decompress: 'gunzip antiword.tar.gz'
+    (c) unpack: 'tar xvf antiword.tar'
+    (d) compile: 'make all'
+    (e) install: 'make install'. This will install Antiword in the $HOME/bin
+        directory.
+    (f) copy the file 'fontnames' and one or more mapping files from the
+        Resources directory to the $HOME/.antiword directory (note the dot
+        before antiword!).
+    NOTE: you can skip point (f) if your system administrator already copied
+          these files to /usr/share/antiword.
+
+Q2: I get the message "I can't open your mapping file (xxxx-x.txt)"
+A2: This means that the mapping file has not been installed. The installation
+    may have to be done manually. See above answer A1, point (f).
+    NOTE: Antiword assumes that a file that can't be opened for reading is a
+          file that doesn't exist.
+
+Q3: How do I use Antiword?
+A3: Type antiword -h and see.
+
+Q4: I tried "antiword -m /some/directory/8859-1.txt word.doc", but this
+    doesn't work.
+A4: The -m option is followed by the name of a mapping file, a full pathname
+    won't work.
+
+Q5: How does Antiword deal with Word macro viruses?
+A5: Antiword does not run any Word macros because it can't do so.
+    Therefore such a virus will not harm your computer system.
+
+Q6: What is the purpose of the file 'fontnames' in the '/usr/share/antiword/'
+    or '$HOME/.antiword' directory?
+A6: This file provides a translation table from the font names used in a Word
+    document to the font names used by a PostScript printer.
+    The file 'fontnames' can be edited to match the font collection used by
+    your PostScript printer.
+
+Q7: What is 'Hidden Text'?
+A7: Hidden Text is Microsoft speak for text that may or may not be shown
+    on the screen, subject to the user's preferences, but such text is never
+    printed.
+
+Q8: Antiword claims to support all ISO-8859 character sets, but I can't see
+    any of this.
+A8: There is support for all ISO-8859 character sets, but only in the text
+    output, not in the PostScript output.
+    The result can only be seen if your xterm, vtterm, kvt or similar
+    terminal emulation program uses a font compatible with that ISO-8859
+    character set.
+
+Q9: Which mapping file (-m option) is correct in my situation?
+A9: The correct mapping file depends on the character set you need for output
+    in a specific language.
+    For Western European languages (like English, French, German) this is
+    8859-1.txt. (OS/2: cp1252.txt) (DOS: cp850.txt)
+    For Eastern European languages (like Polish, Czech, Slovak, Croatian) this
+    is 8859-2.txt. (OS/2: cp1250.txt) (DOS: cp852.txt)
+    For Esperanto use 8859-3.txt.
+    For Russian use 8859-5.txt or koi8-r.txt. (OS/2: cp1251.txt)
+     (DOS: cp866.txt)
+    For Ukrainian use koi8-u.txt.
+    For Hebrew use 8859-8.txt. (DOS: cp862.txt)
+    If your system supports it, you might also try UTF-8.txt.
+
+    NOTE: UTF-8 also enables Antiword to show text in languages like Chinese,
+          Japanese and Korean.
+
+Q10: I tried UTF-8, but some documents show more garbage than text. Why?
+A10: UTF-8 will only work if the document was saved by a Unicode enabled
+    version of Word (or if Word used ISO-8859-1 as its internal encoding).
+    The following versions of Word are known to be Unicode enabled:
+    Word 6 and Word 7 for Asian languages, all versions of Word 97,
+    Word 98 (Mac), Word 2000, Word 2001 (Mac) and Word 2002 (aka Word XP).
+
+Q11: Why can't Antiword read from stdin directly? Why use a temporary file?
+A11: The information in a Word document is not stored sequentially. Therefore
+    the use of the "fseek" function can't be avoided. So Antiword must copy
+    stdin to a temporary file first and then process that file.
+
+Q12: Why does the XML output of Antiword sometimes contain such a strange
+     structure or practically no structure at all?
+A12: Remember that Word is basically 'text plus appearance' and XML is
+     basically 'text plus structure'. If a Word document is written by a
+     competent person there will be a balance between appearance and structure,
+     but if a Word document is written by an inexperienced or incompetent
+     person the Word document can end up without a structure, or worse, with a
+     terrible structure.
+     Antiword can't create a structure when there is none.

+ 44 - 0
sys/src/cmd/aux/antiword/History

@@ -0,0 +1,44 @@
+History of Antiword by (C) Adri van Os
+------------------------------------
+
+
+The Name
+--------
+The name comes from: "The antidote against people who send Microsoft(R) Word
+files to everybody, because they believe that everybody runs Windows(R) and
+therefore runs Word".
+
+
+Version 0.34 (25 Aug 2003)
+--------------------------
+Beta release, for evaluation by the public.
+
+
+Known Limitations
+-----------------
+
+1) The layout of Word documents is kept secret by Microsoft(R). Therefore
+   Antiword is based on information gathered from the Internet and on
+   guesswork.
+2) Antiword doesn't show all the images included in a Word document.
+3) Antiword doesn't do any hyphenation, because hyphenation is language
+   dependent.
+4) Antiword places footnotes at the end of the text.
+5) Antiword places box text after normal text and not in a box.
+6) Antiword doesn't try to emulate any of Word's DTP abilities.
+7) PostScript ouput will not work in combination with UTF-8. It only worask in
+   combination with character sets ISO 8859-1 and ISO 8859-2.
+8) Antiword's error messages are not very helpful.
+
+
+Known Bugs
+----------
+
+1) Antiword cannot handle encrypted documents.
+2) Antiword assumes default tab stops.
+3) Antiword doesn't handle frames.
+4) Antiword ignores page headers and footers.
+5) Antiword only handles lists in some of the styles.
+6) Antiword cannot handle some types of multilevel lists.
+7) Antiword assumes that all Word documents made on a Macintosh with Word
+   version 6 or older use the MacRoman character set.

+ 88 - 0
sys/src/cmd/aux/antiword/Mozilla

@@ -0,0 +1,88 @@
+Date: Mon, 11 Nov 2002 11:36:21 +0000
+From: Cam <camilo@mesias.co.uk>
+Subject: Re: antiword
+
+Hi
+
+I have updated the script for the latest Mozilla with plugger, as found 
+in RedHat 8. This makes the default action a very quick text view of a 
+document, much better IMHO than starting ooffice or abiword. If users 
+want to edit the file they can still save as.
+
+Here is a slightly improved script for gnome users:
+
+#!/bin/bash
+
+tmpfile=/tmp/aw$$.txt
+
+lastditch=`which vi`
+
+editor=${EDITOR:-$lastditch}
+
+if [ ! -x $editor ] ; then
+   editor=$lastditch
+fi
+
+
+tmpfile=/tmp/aw$$.txt
+
+gtopts="-t antiword-helper --hide-menubar"
+
+antiword "$1" > $tmpfile
+chmod -w $tmpfile
+gnome-terminal $gtopts -x $editor $tmpfile ; chmod +w $tmpfile ; rm $tmpfile
+
+
+
+Here is the script for non-gnome users:
+
+#!/bin/bash
+
+tmpfile=/tmp/aw$$.txt
+
+lastditch=`which vi`
+
+editor=${EDITOR:-$lastditch}
+
+if [ ! -x $editor ] ; then
+   editor=$lastditch
+fi
+
+
+antiword "$1" > $tmpfile
+chmod -w $tmpfile
+xterm -T "antiword-helper" -e $editor $tmpfile
+chmod +w $tmpfile
+rm $tmpfile
+
+
+
+To use the scripts add an entry into your plugger config file 
+(pluggerrc, for locations check man plugger). Mine is in 
+/home/cxm/.netscape/pluggerrc:
+
+The line to add is (it has a leading tab):
+
+   ignore_errors exits: antiword-helper "$file"
+
+
+Here is my config file after I added the line
+
+application/rtf: rtf: Rich Text Format
+application/x-msword: doc, dot: Microsoft Word Document
+application/msword: doc, dot: Microsoft Word Document
+         ignore_errors exits: antiword-helper "$file"
+         nokill exits: oowriter "$file"
+         repeat swallow(AbiWord) fill: AbiWord -nosplash -geometry 
++9000+9000 "$file" >/dev/null 2>/dev/null
+         repeat swallow(PCFileViewer) fill: sdtpcv "$file"
+         repeat swallow(PCFileViewer) fill: /opt/SUNWdtpcv/bin/sdtpcv 
+"$file"
+
+
+Then start Mozilla / Netscape and you should be able to quickly view 
+word docs from the browser and as email attachments.
+
+Hope that helps,
+
+-Cam

+ 24 - 0
sys/src/cmd/aux/antiword/Mutt

@@ -0,0 +1,24 @@
+From: Sven Geggus (sven@geggus.net)
+Subject: Re: Word attachments in Mutt
+Newsgroups: comp.mail.mutt
+Date: 2001-05-16 01:21:11 PST
+
+Bob Zimmerman <bobzim@no.spam.org> wrote:
+
+> I receive MS Word attachments in Mutt reguarly. Is there a way to
+> read these via Mutt in a Linux/Solaris environment? (e.g. Lynx or
+> some type of viewer)?
+
+The best M$-word to ASCII converter has to be antiword!
+
+Just put the following line into .mailcap:
+
+application/msword; antiword %s; copiousoutput
+
+Sven
+
+--
+"We just typed make"
+(Stephen Lambrigh, Director of Server Product Marketing at Informix
+                                      about porting their Database to Linux)
+/me is giggls@ircnet, http://geggus.net/sven/ on the Web

+ 129 - 0
sys/src/cmd/aux/antiword/Netscape

@@ -0,0 +1,129 @@
+From: "Craig D. Miller" <Craig.D.Miller@jpl.nasa.gov>
+
+Hi,
+
+Steps to integrate antiword into NetScape 4.73 (should also work with earlier
+versions).
+
+Programs that launch from netscape must startup an X window to display their
+output (otherwise output ends up it the bit bucket on your system).  I wrote the
+following script to do this for antiword (and saved it as
+"/usr/local/bin/xantiword":
+
+#!/bin/csh -f
+setenv FILE $1
+setenv NEWFILE ${FILE}.xantiword
+/usr/local/bin/antiword $FILE >&$NEWFILE
+/usr/bin/X11/xterm -title "$FILE (MS Word)" -e /usr/bsd/more $NEWFILE
+rm -f $NEWFILE
+
+The above script works, but may not be the best way to do it.  If you come up
+with a more elegant solution, then please let me know.
+
+Next you'll have to tell netscape to execute the "/usr/local/bin/xantiword"
+script when word documents are clicked on.  The easiest way to do this is to
+change the /usr/local/lib/netscape/mailcap netscape configuration file.  For
+SGI version of netscape the following two lines are changed.  For other versions
+of netscape, one should find similar lines or will need to add the new lines.
+
+Old lines (try to run SoftWindows, which is not installed on my system):
+
+    application/x-dos_ms_word; /usr/local/lib/netscape/swinexec %s winword; \
+        description="Microsoft Word-for-Windows Document";
+    application/msword; /usr/local/lib/netscape/swinexec %s winword; \
+        description="Microsoft Word-for-Windows Document";
+
+New lines (for antiword execution), which replace old lines on my system:
+
+    application/x-dos_ms_word; /usr/local/bin/xantiword %s; \
+        description="Microsoft Word-for-Windows Document";
+    application/msword; /usr/local/bin/xantiword %s; \
+        description="Microsoft Word-for-Windows Document";
+
+These changes can also be made via the netscape preferences, under
+Navigator/Applications, but then the changes would only be for the user that
+changed them.  The above change to the mailcap file affects all users, which is
+what you'll usually want.
+
+ Note that the above file paths may be different for your system.  On our linux
+box, a quick search DID NOT show where the mailcap for netscape was stored, but
+I did find one in /etc/mailcap.  I don't have time to experiment to see if this
+is the same one that netscape uses.
+
+If you have questions then please E-mail me.
+
+- Craig
+
+===============================================================================
+
+From: "Craig D. Miller" <Craig.D.Miller@jpl.nasa.gov>
+
+Hi,
+
+I just discovered a program called "xless".  It would actually be easier to use
+than my previous xterm/more solution.  To use it change the
+"/usr/local/bin/xantiword" script to: 
+
+#!/bin/csh -f
+setenv FILE $1
+/usr/local/bin/antiword $FILE | /usr/freeware/bin/xless \
+            -title "$FILE (MS Word)" -geometry 100x60
+
+Note that one also needs to have xless installed.  It can be found on the
+SGI Freeware Feb 1999 (or later) CD-ROM.
+
+- Craig
+
+===============================================================================
+
+From: Bruno Crochet <bruno.crochet@pse.unige.ch>
+
+Hi!
+
+Another way to integrate antiword into netscape is to copy the following
+line in your .mailcap file :
+
+application/msword; ns="%s"\; nf="${ns}".ps\; antiword -pa4 "${ns}" >
+"${nf}"\; gv "${nf}"\; sleep 2 \; rm "${nf}"
+
+Bruno.
+
+===============================================================================
+
+From: Andoni Zarate <azarate@saincotrafico.com>
+
+In order to view the file into netscape you can write the xantiword file
+like this:
+ 
+#!/bin/csh -f
+setenv FILE $1
+setenv NEWFILE ${FILE}.xantiword
+/usr/local/bin/antiword $FILE >&$NEWFILE
+netscape -remote 'openFile('$NEWFILE')'
+ 
+Andoni Zárate.
+
+===============================================================================
+
+From: Evelyne Pinter <epinter@ptcs.ch>
+
+I include a script for netscape to see the document with ghostview.
+ 
+#!/bin/csh -f
+setenv FILE $1
+setenv NEWFILE ${FILE}.xantiword
+/usr/local/bin/antiword -pa4 $FILE >&$NEWFILE
+/usr/X11R6/bin/gv $NEWFILE
+rm -f $NEWFILE
+ 
+In netscape the application must be called like that
+"/usr/local/bin/xantiword %s"
+ 
+This is just a small change(done by Roger Luechinger) to the xantiword
+you included in the distribution 0.31
+ 
+Thanks
+ 
+SG E.M.S.P.
+
+===============================================================================

+ 56 - 0
sys/src/cmd/aux/antiword/QandA

@@ -0,0 +1,56 @@
+Questions and Answers (RISC OS version)
+=======================================
+
+Q1: How do I install Antiword?
+A1: Copy the application-directory and all the files within it to a
+    suitable directory.
+
+Q2: How do I use Antiword?
+A2: Double click on a Word document, filetype MSWord (&ae6). Or drag and drop
+    a file onto the Antiword icon on the iconbar.
+
+Q3: How does Antiword deal with Word macro viruses?
+A3: Antiword does not run any Word macros because it cannot do so.
+    Therefore your Archimedes will not be harmed by such a virus.
+
+Q4: What does the 'Paragraph breaks' option do?
+A4: This option controls the maximum number of characters per line in
+    paragraphs. If your screen is 640 pixels wide (like modes 20 and 27)
+    than 76 is probably best. If your screen is 800 or more pixels wide
+    (like mode 31) then numbers near 94 work best. You can switch this
+    option off if the (text only) output of Antiword will be the input to a
+    wordprocessor or a DTP program.
+
+Q5: What does the 'Auto filetype' option do?
+A5: When auto filetype is allowed, Antiword will change the filetype of
+    Word documents to MSWord (&ae6)
+
+Q6: When Antiword uses outline fonts it becomes terribly slow. What can I
+    do about this?
+A6: When Antiword uses outline fonts it needs a large font cache. A small
+    font cache will make Antiword (very) slow. The larger the font cache the
+    better, but usually 160K or 256K will do.
+
+Q7: What is the purpose of the file 'FontNames' in the Choices directory?
+A7: This file provides a translation table from the font names found in a
+    Word document to the font names used by the RISC OS font-manager.
+    The file 'FontNames' is can be edited to match your font collection.
+    Some examples are provided in the Resources directory.
+
+Q8: What is 'Hidden Text'?
+A8: Hidden Text is Microsoft speak for text that may or may not be shown
+    on the screen, subject to the user's preferences, but such text is never
+    printed.
+
+Q9: After upgrading to a new version of Antiword, I found that Antiword does
+    not put a new _updated_ version of FontNames in !Choices. Why not?
+A9: The user can change the file Fontnames to reflect the fonts available
+    on a specific computer. Antiword cannot be permitted to overwrite changes
+    made by a user. So after upgrading you should remove or rename the old
+    FontNames file.
+
+Q10: Why does Antiword freeze my computer while converting the Word document?
+A10: This can happen when the Word document contains a very large image and
+     the image must be scaled to a much smaller size before displaying. The
+     delay occurs while RISC OS does the scaling, so there is not much
+     Antiword can do about it.

+ 113 - 0
sys/src/cmd/aux/antiword/ReadMe

@@ -0,0 +1,113 @@
+                    ___        _   _                       _
+                   / _ \      | | (_)                     | |
+                  | |_| |_ __ | |_ ___      _____  _ __ __| |
+                  |  _  | '_ \| __| \ \ /\ / / _ \| '__/ _` |
+                  | | | | | | | |_| |\ V  V / (_) | | | (_| |
+                  |_| |_|_| |_|\__|_| \_/\_/ \___/|_|  \__,_|
+
+Antiword
+========
+
+Version 0.34 (25 Aug 2003)
+--------------------------     
+
+Introduction
+------------
+
+Antiword is an application for displaying Microsoft(R) Word documents.
+
+
+License
+-------
+
+This program is distributed under the GNU General Public License - see the
+accompanying COPYING file for more details.
+
+
+Problems
+--------
+
+Any bugs found should be reported to the author with full details of how to
+get the problem to occur, but don't *expect* support for a product that you
+have not paid for!
+
+Please include Antiword's version number and version date, otherwise you
+make it impossible for the author to help.
+
+
+Thanks To
+---------
+
+Victor B. Wagner <vitus@agropc.msk.su> creator of "catdoc"
+Duncan Simpson <word2x@duncan.telstar.net> creator of "word2x"
+Martin Schwartz <schwartz@cs.tu-berlin.de> creator of "laola" and "elser"
+Caolan McNamara <Caolan.McNamara@ul.ie> creator of "mswordview"
+Andrew Scriven <andy.scriven@research.natpower.co.uk> creator of "OLEdecode"
+Craig Southeren <geoffw@extro.ucc.oz.au> creator of "nenscript"
+Thomas Merz <tm@muc.de> creator of "jpeg2ps"
+Ulrich von Zadow <uzadow@cs.tu-berlin.de> creator of "paintlib"
+
+
+Contributors
+------------
+
+ISO-8859-2 support by: Pawel Turnau <uzturnau@cyf-kr.edu.pl>
+Character set mapping by: Dmitry Chernyak
+                          <Dmitry.Chernyak@p998.f983.n5030.z2.fidonet.org>
+UTF-8 support by: Karl Koehler <koehler@or.uni-bonn.de> and
+                  Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk>
+
+
+Ports
+-----
+
+Antiword was ported to BeOS by Pete Goodeve <pete@jwgibbs.cchem.berkeley.edu>
+Antiword was ported to OS/2 by Dave Yeo <dave_yeo@mindlink.bc.ca>
+Antiword was ported to Mac OS X by Ronaldo Nascimento <ronaldo@ronaldo.com>
+Antiword was ported to Amiga by Raffaele Pisapia <rafpis@libero.it>
+Antiword was ported to VMS by Joseph Huber <huber@mppmu.mpg.de>
+Antiword was ported to NetWare by Guenter Knauf <info@gknw.de>
+Antiword was ported to EPOC by Max Tomin <tomin@samaramail.ru>
+Antiword was ported to Zaurus PDA by Piotr Jachimczyk
+                                     <P.Jachimczyk@prioris.mini.pw.edu.pl>
+Antiword was ported to DOS by myself ;-)
+Yen-Ming Lee <leeym@freebsd.org> is the maintainer of the FreeBSD version of
+Antiword.
+
+
+Acknowledgements
+----------------
+
+Microsoft is a registered trademark and Windows is a trademark of Microsoft
+Corporation.
+UNIX is a registered trademark of the X/Open Company, Ltd.
+Linux is a registered trademark of Linus Torvalds.
+Postscript is a trademark of Adobe Systems Incorporated.
+All other trademarks are acknowledged.
+
+
+Future Versions
+---------------
+
+If you have any comments, bug reports or suggestions for future versions
+don't hesitate to write to me.
+New versions of the program will only be available if sufficient people
+are using this program. So let me know!
+
+
+Most recent version
+-------------------
+
+Most recent version of Antiword can be found on the author's website:
+==>>  http://www.winfield.demon.nl/index.html  <<==
+==>>  http://antiword.cjb.net/  <<==
+
+
+Author
+------
+
+The author can be reached by e-mail:
+antiword@winfield.demon.nl
+comments@antiword.cjb.net
+
+But PLEASE read the FAQ before you write!!

+ 143 - 0
sys/src/cmd/aux/antiword/antiword.1.txt

@@ -0,0 +1,143 @@
+.TH ANTIWORD 1 "Jun 24, 2003" "Antiword 0.34" "Linux User\'s Manual"
+.SH NAME
+antiword - show the text and images of MS Word documents
+.SH SYNOPSIS
+.B antiword
+[
+.I options
+]
+.I wordfiles
+.SH DESCRIPTION
+.I Antiword
+is an application that displays the text and the images of Microsoft Word
+documents.
+.br
+A wordfile named - stands for a Word document read from the standard input.
+.br
+Only documents made by MS Word version 2 and version 6 or later are supported.
+.SH OPTIONS
+.TP
+.B \-h
+Give a help message.
+.TP
+.BI "\-i " "image level"
+The image level determines how images will be shown.
+.RS
+.TP 3
+0:
+Use non-standard extensions from Ghostscript. This output may not print on
+any PostScript printer, but is useful in case no hard copy is needed. It is
+also useful when Ghostscript is used as a filter to print a PostScript file to
+a non-PostScript printer.
+.TP 3
+1:
+Show no images.
+.TP 3
+2:
+PostScript level 2 compatible. (default)
+.TP 3
+3:
+PostScript level 3 compatible. (EXPERIMENTAL, Portable Network Graphics (PNG)
+images are not printed correctly)
+.RE
+.TP
+.BI "\-m " "mapping file"
+This file is used to map Unicode characters to your local character set.
+The default is UTF-8.txt in locales that support UTF-8 and 8859-1.txt in other
+locales.
+.TP
+.BI "\-p " papersize
+Output in PostScript form. Printable on paper of the specified size: 10x14,
+a3, a4, a5, b4, b5, executive, folio, legal, letter, note, quarto, statement
+or tabloid.
+.TP
+.B \-s
+Include text with the so-called "hidden text" attribute.
+.TP
+.B \-t
+Output in text form. (default)
+.TP
+.BI "\-w " width
+In text mode this is the line width in characters. A value of zero puts an
+entire paragraph on a line, useful when the text is to used as input for
+another wordprocessor. This value is ignored in PostScript mode.
+.TP
+.BI "\-x " "document type definition"
+Output in XML form. Currently the only document type definition is db
+(for DocBook).
+.TP
+.B \-L
+In PostScript mode: use landscape mode.
+.RE
+.SH FILES
+.TP
+Mapping files like 8859-1.txt
+.br
+Antiword looks for its mapping files in three directories, in the order given:
+.br
+(1) The directory specified by $ANTIWORDHOME
+.br
+(2) The directory specified by $HOME/.antiword
+.br
+(3) Directory /usr/share/antiword
+.TP
+The fontnames file
+.br
+Antiword will look for its fontname file in the same directories as used for the
+mapping files.
+.br
+The fontnames file contains the translation table from font names used by MS
+Word to font names used by PostScript.
+.TP
+NOTE:
+.br
+Antiword cannot tell the difference between a file that does not exist and a
+file that cannot be opened for reading.
+.SH ENVIRONMENT
+Antiword uses the environment variable ``ANTIWORDHOME'' as the first directory
+to look for its files. Antiword uses the environment variable ``HOME'' to find
+the user's home directory. When in text mode it uses the variable ``COLUMNS''
+to set the width of the output (unless overridden by the -w option).
+.SH BUGS
+Antiword is far from complete. Many features are still missing. Many images are
+not shown yet. Some of the images that are shown, are shown in the wrong place.
+PostScript output is only available in ISO 8859-1 and ISO 8859-2.
+.SH WEB SITES
+The most recent released version of Antiword is always available from:
+.br
+http://www.winfield.demon.nl/index.html
+.br
+or try
+.br
+http://antiword.cjb.net/
+.SH AUTHOR
+Adri van Os <antiword@winfield.demon.nl>
+.br
+or try <comments@antiword.cjb.net>
+.sp
+R.F. Smith <rsmith@xs4all.nl> and
+.br
+Sindi Keesan <keesan@cyberspace.org>
+.br
+contributed to this manual page.
+.SH LICENSE
+Antiword is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+.SH ACKNOWLEDGEMENTS
+Linux is a registered trademark of Linus Torvalds.
+.br
+PostScript is a trademark of Adobe Systems Incorporated.
+.br
+Microsoft is a registered trademark and Windows is a trademark of Microsoft
+Corporation.

+ 638 - 0
sys/src/cmd/aux/antiword/antiword.h

@@ -0,0 +1,638 @@
+/*
+ * antiword.h
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GNU GPL
+ *
+ * Description:
+ * Generic include file for project 'Antiword'
+ */
+
+#if !defined(__antiword_h)
+#define __antiword_h 1
+
+#if defined(DEBUG) == defined(NDEBUG)
+#error Exactly one of the DEBUG and NDEBUG flags MUST be set
+#endif /* DEBUG == NDEBUG */
+
+#include <stdio.h>
+#include <limits.h>
+#if defined(__riscos)
+#include "wimp.h"
+#include "drawfobj.h"
+#include "font.h"
+#include "werr.h"
+#include "draw.h"
+#else
+#include <sys/types.h>
+#endif /* __riscos */
+#include "wordconst.h"
+#include "wordtypes.h"
+#include "fail.h"
+#include "debug.h"
+
+/* Constants */
+#if !defined(PATH_MAX)
+ #if defined(__riscos)
+ #define PATH_MAX		 255
+ #else
+  #if defined(MAXPATHLEN)
+  #define PATH_MAX		MAXPATHLEN
+  #else
+  #define PATH_MAX		1024
+  #endif /* MAXPATHLEN */
+ #endif /* __riscos */
+#endif /* !PATH_MAX */
+
+#if !defined(CHAR_BIT)
+#define CHAR_BIT		8
+#endif /* CHAR_BIT */
+
+#if !defined(TIME_T_MIN)
+#define TIME_T_MIN		((time_t)0 < (time_t)-1 ?\
+				(time_t)0 :\
+				(time_t)1 << (sizeof(time_t) * CHAR_BIT - 1))
+#endif /* TIMER_T_MIN */
+
+#if !defined(TIME_T_MAX)
+#if defined(__TURBOC__)	/* Turbo C chokes on the subtraction below */
+#define TIME_T_MAX		(LONG_MAX)
+#else	/* All others */
+#define TIME_T_MAX		(~(time_t)0 - TIME_T_MIN)
+#endif /* __TURBOC__ */
+#endif /* TIME_T_MAX */
+
+#if !defined(SIZE_T_MAX)
+#define SIZE_T_MAX		(~(size_t)0)
+#endif /* SIZE_T_MAX */
+
+#if defined(__riscos)
+#define FILE_SEPARATOR		"."
+#elif defined(__dos)
+#define FILE_SEPARATOR		"\\"
+#else	/* All others */
+#define FILE_SEPARATOR		"/"
+#endif /* __riscos */
+
+/* PNG chunk names */
+#define PNG_CN_IDAT		0x49444154
+#define PNG_CN_IEND		0x49454e44
+#define PNG_CN_IHDR		0x49484452
+#define PNG_CN_PLTE		0x504c5445
+
+/* The screen width */
+#define MIN_SCREEN_WIDTH	 45
+#define DEFAULT_SCREEN_WIDTH	 76
+#define MAX_SCREEN_WIDTH	145
+
+#if defined(__riscos)
+/* The scale factors as percentages */
+#define MIN_SCALE_FACTOR	 25
+#define DEFAULT_SCALE_FACTOR	100
+#define MAX_SCALE_FACTOR	400
+
+/* Filetypes */
+#define FILETYPE_MSWORD		0xae6
+#define FILETYPE_DRAW		0xaff
+#define FILETYPE_JPEG		0xc85
+#define FILETYPE_POSCRIPT	0xff5
+#define FILETYPE_SPRITE		0xff9
+#define FILETYPE_TEXT		0xfff
+
+/* The button numbers in the choices window */
+#define CHOICES_DEFAULT_BUTTON		 3
+#define CHOICES_SAVE_BUTTON		 2
+#define CHOICES_CANCEL_BUTTON		 1
+#define CHOICES_APPLY_BUTTON		 0
+#define CHOICES_BREAK_BUTTON		 6
+#define CHOICES_BREAK_WRITEABLE		 7
+#define CHOICES_BREAK_UP_BUTTON		 8
+#define CHOICES_BREAK_DOWN_BUTTON	 9
+#define CHOICES_NO_BREAK_BUTTON		11
+#define CHOICES_AUTOFILETYPE_BUTTON	14
+#define CHOICES_HIDDEN_TEXT_BUTTON	22
+#define CHOICES_WITH_IMAGES_BUTTON	17
+#define CHOICES_NO_IMAGES_BUTTON	18
+#define CHOICES_TEXTONLY_BUTTON		19
+#define CHOICES_SCALE_WRITEABLE		25
+#define CHOICES_SCALE_UP_BUTTON		26
+#define CHOICES_SCALE_DOWN_BUTTON	27
+
+/* The button numbers in the scale view window */
+#define SCALE_CANCEL_BUTTON		 1
+#define SCALE_SCALE_BUTTON		 0
+#define SCALE_SCALE_WRITEABLE		 3
+#define SCALE_50_PCT			 5
+#define SCALE_75_PCT			 6
+#define SCALE_100_PCT			 7
+#define SCALE_150_PCT			 8
+
+/* New draw objects */
+#define draw_OBJJPEG		16
+#else
+/* Margins for the PostScript version */
+#define PS_LEFT_MARGIN			(72 * 640L)
+#define PS_RIGHT_MARGIN			(48 * 640L)
+#define PS_TOP_MARGIN			(72 * 640L)
+#define PS_BOTTOM_MARGIN		(72 * 640L)
+#endif /* __riscos */
+
+/* Macros */
+#define STREQ(x,y)	(*(x) == *(y) && strcmp(x,y) == 0)
+#define STRNEQ(x,y,n)	(*(x) == *(y) && strncmp(x,y,n) == 0)
+#if defined(__dos)
+#define STRCEQ(x,y)	(stricmp(x,y) == 0)
+#else
+#define STRCEQ(x,y)	(strcasecmp(x,y) == 0)
+#endif /* __dos */
+#define elementsof(a)	(sizeof(a) / sizeof(a[0]))
+#define odd(x)		(((x)&0x01)!=0)
+#define ROUND4(x)	(((x)+3)&~0x03)
+#define ROUND128(x)	(((x)+127)&~0x7f)
+#define BIT(x)		(1UL << (x))
+#if !defined(max)
+#define max(x,y)	((x)>(y)?(x):(y))
+#endif /* !max */
+#if !defined(min)
+#define min(x,y)	((x)<(y)?(x):(y))
+#endif /* !min */
+
+#if defined(__riscos)
+/* The name of the table font */
+#define TABLE_FONT			"Corpus.Medium"
+/* Names of the default fonts */
+#define FONT_MONOSPACED_PLAIN		"Corpus.Medium"
+#define FONT_MONOSPACED_BOLD		"Corpus.Bold"
+#define FONT_MONOSPACED_ITALIC		"Corpus.Medium.Oblique"
+#define FONT_MONOSPACED_BOLDITALIC	"Corpus.Bold.Oblique"
+#define FONT_SERIF_PLAIN		"Trinity.Medium"
+#define FONT_SERIF_BOLD			"Trinity.Bold"
+#define FONT_SERIF_ITALIC		"Trinity.Medium.Italic"
+#define FONT_SERIF_BOLDITALIC		"Trinity.Bold.Italic"
+#define FONT_SANS_SERIF_PLAIN		"Homerton.Medium"
+#define FONT_SANS_SERIF_BOLD		"Homerton.Bold"
+#define FONT_SANS_SERIF_ITALIC		"Homerton.Medium.Oblique"
+#define FONT_SANS_SERIF_BOLDITALIC	"Homerton.Bold.Oblique"
+#else
+/* The name of the table font */
+#define TABLE_FONT			"Courier"
+/* Names of the default fonts */
+#define FONT_MONOSPACED_PLAIN		"Courier"
+#define FONT_MONOSPACED_BOLD		"Courier-Bold"
+#define FONT_MONOSPACED_ITALIC		"Courier-Oblique"
+#define FONT_MONOSPACED_BOLDITALIC	"Courier-BoldOblique"
+#define FONT_SERIF_PLAIN		"Times-Roman"
+#define FONT_SERIF_BOLD			"Times-Bold"
+#define FONT_SERIF_ITALIC		"Times-Italic"
+#define FONT_SERIF_BOLDITALIC		"Times-BoldItalic"
+#define FONT_SANS_SERIF_PLAIN		"Helvetica"
+#define FONT_SANS_SERIF_BOLD		"Helvetica-Bold"
+#define FONT_SANS_SERIF_ITALIC		"Helvetica-Oblique"
+#define FONT_SANS_SERIF_BOLDITALIC	"Helvetica-BoldOblique"
+/* The name of the antiword directories and the font information file */
+#if defined(__dos)
+#define GLOBAL_ANTIWORD_DIR	"C:\\antiword"
+#define ANTIWORD_DIR		"antiword"
+#define FONTNAMES_FILE		"fontname.txt"
+#elif defined(__amigaos)
+#define GLOBAL_ANTIWORD_DIR	"SYS:.antiword"
+#define ANTIWORD_DIR		".antiword"
+#define FONTNAMES_FILE		"fontnames"
+#elif defined(__vms)
+#define GLOBAL_ANTIWORD_DIR	"/usr/share/antiword"
+#define ANTIWORD_DIR		"antiword"
+#define FONTNAMES_FILE		"fontnames"
+#elif defined(__BEOS__)
+#define GLOBAL_ANTIWORD_DIR	"/boot/home/config/apps/antiword"
+#define ANTIWORD_DIR		"antiword"
+#define FONTNAMES_FILE		"fontnames"
+#elif defined(__Plan9__)
+#define GLOBAL_ANTIWORD_DIR	"/sys/lib/antiword"
+#define ANTIWORD_DIR		"lib/antiword"
+#define FONTNAMES_FILE		"fontnames"
+#else	/* All others */
+#define GLOBAL_ANTIWORD_DIR	"/usr/share/antiword"
+#define ANTIWORD_DIR		".antiword"
+#define FONTNAMES_FILE		"fontnames"
+#endif /* __dos */
+/* The name of the default mapping file */
+#define MAPPING_FILE_DEFAULT_1	"8859-1.txt"
+#define MAPPING_FILE_DEFAULT_2	"8859-2.txt"
+#define MAPPING_FILE_DEFAULT_8	"UTF-8.txt"
+#endif /* __riscos */
+
+/* Prototypes */
+
+/* asc85enc.c */
+extern void	vASCII85EncodeByte(FILE *, int);
+extern void	vASCII85EncodeArray(FILE *, FILE *, size_t);
+extern void	vASCII85EncodeFile(FILE *, FILE *, size_t);
+/* blocklist.c */
+extern void	vDestroyTextBlockList(void);
+extern BOOL	bAdd2TextBlockList(const text_block_type *);
+extern void	vSplitBlockList(FILE *, ULONG, ULONG, ULONG, ULONG, ULONG,
+			ULONG, ULONG, ULONG, BOOL);
+extern BOOL	bExistsTextBox(void);
+extern BOOL	bExistsHdrTextBox(void);
+extern USHORT	usNextChar(FILE *, list_id_enum, ULONG *, ULONG *, USHORT *);
+extern ULONG	ulCharPos2FileOffset(ULONG);
+extern ULONG	ulGetSeqNumber(ULONG);
+#if defined(__riscos)
+extern ULONG	ulGetDocumentLength(void);
+#endif /* __riscos */
+/* chartrans.c */
+extern UCHAR	ucGetNbspValue(void);
+extern BOOL	bReadCharacterMappingTable(const char *);
+extern ULONG	ulTranslateCharacters(USHORT, ULONG, int, conversion_type,
+			encoding_type, BOOL);
+extern ULONG	ulToUpper(ULONG);
+/* datalist.c */
+extern void	vDestroyDataBlockList(void);
+extern BOOL	bAdd2DataBlockList(const data_block_type *);
+extern ULONG	ulGetDataOffset(FILE *);
+extern BOOL	bSetDataOffset(FILE *, ULONG);
+extern int	iNextByte(FILE *);
+extern USHORT	usNextWord(FILE *);
+extern ULONG	ulNextLong(FILE *);
+extern USHORT	usNextWordBE(FILE *);
+extern ULONG	ulNextLongBE(FILE *);
+extern size_t	tSkipBytes(FILE *, size_t);
+extern ULONG	ulDataPos2FileOffset(ULONG);
+/* depot.c */
+extern void	vDestroySmallBlockList(void);
+extern BOOL	bCreateSmallBlockList(ULONG, const ULONG *, size_t);
+extern ULONG	ulDepotOffset(ULONG, size_t);
+/* dib2eps & dib2sprt.c */
+extern BOOL	bTranslateDIB(diagram_type *,
+			FILE *, ULONG, const imagedata_type *);
+/* draw.c & output.c */
+extern BOOL	bAddDummyImage(diagram_type *, const imagedata_type *);
+extern diagram_type *pCreateDiagram(const char *, const char *);
+extern void	vPrologue2(diagram_type *, int);
+extern void	vMove2NextLine(diagram_type *, draw_fontref, USHORT);
+extern void	vSubstring2Diagram(diagram_type *,
+			char *, size_t, long, UCHAR, USHORT,
+			draw_fontref, USHORT, USHORT);
+extern void	vStartOfParagraph1(diagram_type *, long);
+extern void	vStartOfParagraph2(diagram_type *);
+extern void	vEndOfParagraph(diagram_type *, draw_fontref, USHORT, long);
+extern void	vEndOfPage(diagram_type *, long);
+extern void	vSetHeaders(diagram_type *, USHORT);
+extern void	vStartOfList(diagram_type *, UCHAR, BOOL);
+extern void	vEndOfList(diagram_type *);
+extern void	vStartOfListItem(diagram_type *, BOOL);
+extern void	vEndOfTable(diagram_type *);
+extern BOOL	bAddTableRow(diagram_type *, char **, int,
+			const short *, UCHAR);
+#if defined(__riscos)
+extern void	vImage2Diagram(diagram_type *, const imagedata_type *,
+			UCHAR *, size_t);
+extern BOOL	bVerifyDiagram(diagram_type *);
+extern void	vShowDiagram(diagram_type *);
+extern void	vMainEventHandler(wimp_eventstr *, void *);
+extern void	vScaleOpenAction(diagram_type *);
+extern void	vSetTitle(diagram_type *);
+extern void	vScaleEventHandler(wimp_eventstr *, void *);
+#else
+extern void	vImagePrologue(diagram_type *, const imagedata_type *);
+extern void	vImageEpilogue(diagram_type *);
+extern void	vDestroyDiagram(diagram_type *);
+#endif /* __riscos */
+/* finddata.c */
+extern BOOL	bAddDataBlocks(ULONG , ULONG, ULONG, const ULONG *, size_t);
+extern BOOL	bGet6DocumentData(FILE *, ULONG,
+				const ULONG *, size_t, const UCHAR *);
+/* findtext.c */
+extern BOOL	bAddTextBlocks(ULONG , ULONG, BOOL,
+				USHORT, ULONG, const ULONG *, size_t);
+extern BOOL	bGet6DocumentText(FILE *, BOOL, ULONG,
+				const ULONG *, size_t, const UCHAR *);
+extern BOOL	bGet8DocumentText(FILE *, const pps_info_type *,
+				const ULONG *, size_t, const ULONG *, size_t,
+				const UCHAR *);
+/* fontlist.c */
+extern void	vDestroyFontInfoList(void);
+extern void	vCorrectFontValues(font_block_type *);
+extern void	vAdd2FontInfoList(const font_block_type *);
+extern const font_block_type	*pGetNextFontInfoListItem(
+					const font_block_type *);
+/* fonts.c */
+extern int	iGetFontByNumber(UCHAR, USHORT);
+extern const char	*szGetOurFontname(int);
+extern int	iFontname2Fontnumber(const char *, USHORT);
+extern void	vCreate0FontTable(void);
+extern void	vCreate2FontTable(FILE *, const UCHAR *);
+extern void	vCreate6FontTable(FILE *, ULONG,
+			const ULONG *, size_t, const UCHAR *);
+extern void	vCreate8FontTable(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vDestroyFontTable(void);
+extern const font_table_type	*pGetNextFontTableRecord(
+						const font_table_type *);
+extern size_t	tGetFontTableLength(void);
+/* fonts_r.c & fonts_u.c */
+extern FILE	*pOpenFontTableFile(void);
+extern void	vCloseFont(void);
+extern draw_fontref	tOpenFont(UCHAR, USHORT, USHORT);
+extern draw_fontref	tOpenTableFont(USHORT);
+extern long	lComputeStringWidth(const char *, size_t, draw_fontref, USHORT);
+extern size_t	tCountColumns(const char *, size_t);
+extern size_t	tGetCharacterLength(const char *);
+/* fonts_u.c */
+#if !defined(__riscos)
+extern const char	*szGetFontname(draw_fontref);
+#endif /* !__riscos */
+#if defined(__riscos)
+/* icons.c */
+extern void	vUpdateIcon(wimp_w, wimp_icon *);
+extern void	vUpdateRadioButton(wimp_w, wimp_i, BOOL);
+extern void	vUpdateWriteable(wimp_w, wimp_i, char *);
+extern void	vUpdateWriteableNumber(wimp_w, wimp_i, int);
+#endif /* __riscos */
+/* imgexam.c */
+extern image_info_enum	eExamineImage(FILE *, ULONG, imagedata_type *);
+/* imgtrans */
+extern BOOL	bTranslateImage(diagram_type *,
+			FILE *, BOOL, ULONG, const imagedata_type *);
+/* jpeg2eps.c & jpeg2spr.c */
+extern BOOL	bTranslateJPEG(diagram_type *,
+			FILE *, ULONG, size_t, const imagedata_type *);
+/* listlist.c */
+extern void	vDestroyListInfoList(void);
+extern void	vBuildLfoList(const UCHAR *, size_t);
+extern void	vAdd2ListInfoList(ULONG, USHORT, UCHAR,
+			const list_block_type *);
+extern const list_block_type	*pGetListInfo(USHORT, UCHAR);
+extern USHORT	usGetListValue(int, int, const style_block_type *);
+/* misc.c */
+#if !defined(__riscos)
+extern const char	*szGetHomeDirectory(void);
+extern const char	*szGetAntiwordDirectory(void);
+#endif /* !__riscos */
+extern long	lGetFilesize(const char *);
+#if defined(DEBUG)
+extern void	vPrintBlock(const char *, int, const UCHAR *, size_t);
+extern void	vPrintUnicode(const char *, int, const UCHAR *, size_t);
+extern BOOL	bCheckDoubleLinkedList(output_type *);
+#endif /* DEBUG */
+extern BOOL	bReadBytes(UCHAR *, size_t, ULONG, FILE *);
+extern BOOL	bReadBuffer(FILE *, ULONG, const ULONG *, size_t, size_t,
+			UCHAR *, ULONG, size_t);
+extern ULONG	ulColor2Color(UCHAR);
+extern output_type *pSplitList(output_type *);
+extern size_t	tNumber2Roman(UINT, BOOL, char *);
+extern size_t	tNumber2Alpha(UINT, BOOL, char *);
+extern char	*unincpy(char *, const UCHAR *, size_t);
+extern size_t	unilen(const UCHAR *);
+extern const char	*szBasename(const char *);
+extern long	lComputeLeading(USHORT);
+extern size_t	tUcs2Utf8(ULONG, char *, size_t);
+extern void	vGetBulletValue(conversion_type, encoding_type, char *, size_t);
+extern BOOL	bAllZero(const UCHAR *, size_t);
+/* notes.c */
+extern void	vDestroyNotesInfoLists(void);
+extern void	vGetNotesInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *, int);
+extern notetype_enum eGetNotetype(ULONG);
+/* options.c */
+extern int	iReadOptions(int, char **);
+extern void	vGetOptions(options_type *);
+#if defined(__riscos)
+extern void	vChoicesOpenAction(wimp_w);
+extern void	vChoicesMouseClick(wimp_mousestr *);
+extern void	vChoicesKeyPressed(wimp_caretstr *);
+#endif /* __riscos */
+/* out2window.c */
+extern void	vSetLeftIndentation(diagram_type *, long);
+extern void	vAlign2Window(diagram_type *, output_type *,
+			long, UCHAR);
+extern void	vJustify2Window(diagram_type *, output_type *,
+			long, long, UCHAR);
+extern void	vResetStyles(void);
+extern size_t	tStyle2Window(char *, const style_block_type *,
+			const section_block_type *);
+extern void	vTableRow2Window(diagram_type *,
+			output_type *, const row_block_type *);
+/* pictlist.c */
+extern void	vDestroyPictInfoList(void);
+extern void	vAdd2PictInfoList(const picture_block_type *);
+extern ULONG	ulGetPictInfoListItem(ULONG);
+/* png2eps.c & png2spr.c */
+extern BOOL	bTranslatePNG(diagram_type *,
+			FILE *, ULONG, size_t, const imagedata_type *);
+/* postscript.c */
+extern void	vProloguePS(diagram_type *,
+			const char *, const char *, const options_type *);
+extern void	vEpiloguePS(diagram_type *);
+extern void	vImageProloguePS(diagram_type *, const imagedata_type *);
+extern void	vImageEpiloguePS(diagram_type *);
+extern BOOL	bAddDummyImagePS(diagram_type *, const imagedata_type *);
+extern void	vAddFontsPS(diagram_type *);
+extern void	vMove2NextLinePS(diagram_type *, USHORT);
+extern void	vSubstringPS(diagram_type *,
+				char *, size_t, long, UCHAR, USHORT,
+				draw_fontref, USHORT, USHORT);
+extern void	vStartOfParagraphPS(diagram_type *, long);
+extern void	vEndOfParagraphPS(diagram_type *, draw_fontref, USHORT, long);
+extern void	vEndOfPagePS(diagram_type *);
+/* prop0.c */
+extern void	vGet0SepInfo(FILE *, const UCHAR *);
+extern void	vGet0PapInfo(FILE *, const UCHAR *);
+extern void	vGet0ChrInfo(FILE *, const UCHAR *);
+/* prop2.c */
+extern void	vGet2SepInfo(FILE *, const UCHAR *);
+extern row_info_enum	eGet2RowInfo(int,
+			const UCHAR *, int, row_block_type *);
+extern void	vGet2StyleInfo(int,
+			const UCHAR *, int, style_block_type *);
+extern void	vGet2PapInfo(FILE *, const UCHAR *);
+extern void	vGet1FontInfo(int,
+			const UCHAR *, size_t, font_block_type *);
+extern void	vGet2FontInfo(int,
+			const UCHAR *, size_t, font_block_type *);
+extern void	vGet2ChrInfo(FILE *, int, const UCHAR *);
+/* prop6.c */
+extern void	vGet6SepInfo(FILE *, ULONG, const ULONG *, size_t,
+			const UCHAR *);
+extern row_info_enum	eGet6RowInfo(int,
+			const UCHAR *, int, row_block_type *);
+extern void	vGet6StyleInfo(int,
+			const UCHAR *, int, style_block_type *);
+extern void	vGet6PapInfo(FILE *, ULONG, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vGet6FontInfo(int, USHORT,
+			const UCHAR *, int, font_block_type *);
+extern void	vGet6ChrInfo(FILE *, ULONG, const ULONG *, size_t,
+			const UCHAR *);
+/* prop8.c */
+extern void	vGet8SepInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern row_info_enum	eGet8RowInfo(int,
+			const UCHAR *, int, row_block_type *);
+extern void	vGet8StyleInfo(int,
+			const UCHAR *, int, style_block_type *);
+extern void	vGet8LstInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vGet8PapInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vGet8FontInfo(int, USHORT,
+			const UCHAR *, int, font_block_type *);
+extern void	vGet8ChrInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+/* properties.c */
+extern void	vGetPropertyInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *, int);
+extern row_info_enum	ePropMod2RowInfo(USHORT, int);
+/* propmod.c */
+extern void	vDestroyPropModList(void);
+extern void	vAdd2PropModList(const UCHAR *);
+extern const UCHAR	*aucReadPropModListItem(USHORT);
+/* rowlist.c */
+extern void	vDestroyRowInfoList(void);
+extern void	vAdd2RowInfoList(const row_block_type *);
+extern const row_block_type	*pGetNextRowInfoListItem(void);
+/* riscos.c */
+#if defined(__riscos)
+extern int	iGetFiletype(const char *);
+extern void	vSetFiletype(const char *, int);
+extern BOOL	bMakeDirectory(const char *);
+extern int	iReadCurrentAlphabetNumber(void);
+extern int	iGetRiscOsVersion(void);
+extern BOOL	bDrawRenderDiag360(draw_diag *,
+			draw_redrawstr *, double, draw_error *);
+#if defined(DEBUG)
+extern BOOL	bGetJpegInfo(UCHAR *, size_t);
+#endif /* DEBUG */
+#endif /* __riscos */
+/* saveas.c */
+#if defined(__riscos)
+extern void	vSaveTextfile(diagram_type *);
+extern void	vSaveDrawfile(diagram_type *);
+#endif /* __riscos */
+/* sectlist.c */
+extern void	vDestroySectionInfoList(void);
+extern void	vAdd2SectionInfoList(const section_block_type *, ULONG);
+extern void	vGetDefaultSection(section_block_type *);
+extern void	vDefault2SectionInfoList(ULONG);
+extern const section_block_type *
+		pGetSectionInfo(const section_block_type *, ULONG);
+/* stylelist.c */
+extern void	vDestroyStyleInfoList(void);
+extern level_type_enum	eGetNumType(UCHAR);
+extern void	vCorrectStyleValues(style_block_type *);
+extern void	vAdd2StyleInfoList(const style_block_type *);
+extern const style_block_type	*pGetNextStyleInfoListItem(
+					const style_block_type *);
+extern USHORT	usGetIstd(ULONG);
+extern BOOL	bStyleImpliesList(const style_block_type *, int);
+/* stylesheet.c */
+extern void	vDestroyStylesheetList(void);
+extern USHORT	usStc2istd(UCHAR);
+extern void	vGet2Stylesheet(FILE *, int, const UCHAR *);
+extern void	vGet6Stylesheet(FILE *, ULONG, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vGet8Stylesheet(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vFillStyleFromStylesheet(USHORT, style_block_type *);
+extern void	vFillFontFromStylesheet(USHORT, font_block_type *);
+/* summary.c */
+extern void	vDestroySummaryInfo(void);
+extern void	vSet0SummaryInfo(FILE *, const UCHAR *);
+extern void	vSet2SummaryInfo(FILE *, int, const UCHAR *);
+extern void	vSet6SummaryInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern void	vSet8SummaryInfo(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *);
+extern const char	*szGetTitle(void);
+extern const char	*szGetSubject(void);
+extern const char	*szGetAuthor(void);
+extern const char	*szGetLastSaveDtm(void);
+extern const char	*szGetCompany(void);
+extern const char	*szGetLanguage(void);
+/* tabstop.c */
+extern void	vSetDefaultTabWidth(FILE *, const pps_info_type *,
+			const ULONG *, size_t, const ULONG *, size_t,
+			const UCHAR *, int);
+extern long	lGetDefaultTabWidth(void);
+/* text.c */
+extern void	vPrologueTXT(diagram_type *, const options_type *);
+extern void	vEpilogueTXT(FILE *);
+extern void	vMove2NextLineTXT(diagram_type *);
+extern void	vSubstringTXT(diagram_type *, const char *, size_t, long);
+extern void	vStartOfParagraphTXT(diagram_type *, long);
+extern void	vEndOfParagraphTXT(diagram_type *, long);
+extern void	vEndOfPageTXT(diagram_type *, long);
+/* unix.c */
+#if !defined(__riscos)
+extern void	werr(int, const char *, ...);
+extern void	visdelay_begin(void);
+extern void	visdelay_end(void);
+#endif /* !__riscos */
+/* utf8.c */
+#if !defined(__riscos)
+extern long	utf8_strwidth(const char *, size_t);
+extern int	utf8_chrlength(const char *);
+extern BOOL	is_locale_utf8(void);
+#endif /* !__riscos */
+/* word2text.c */
+extern BOOL	bWordDecryptor(FILE *, long, diagram_type *);
+/* worddos.c */
+extern int	iInitDocumentDOS(FILE *, long);
+/* wordlib.c */
+extern BOOL	bIsWordForDosFile(FILE *, long);
+extern BOOL	bIsRtfFile(FILE *);
+extern BOOL	bIsWordPerfectFile(FILE *);
+extern BOOL	bIsWinWord12File(FILE *, long);
+extern BOOL	bIsMacWord45File(FILE *);
+extern int	iGuessVersionNumber(FILE *, long);
+extern int	iGetVersionNumber(const UCHAR *);
+extern BOOL	bIsOldMacFile(void);
+extern int	iInitDocument(FILE *, long);
+extern void	vFreeDocument(void);
+/* wordmac.c */
+extern int	iInitDocumentMAC(FILE *, long);
+/* wordole.c */
+extern int	iInitDocumentOLE(FILE *, long);
+/* wordwin.c */
+extern int	iInitDocumentWIN(FILE *, long);
+/* xmalloc.c */
+extern void 	*xmalloc(size_t);
+extern void	*xcalloc(size_t, size_t);
+extern void 	*xrealloc(void *, size_t);
+extern char	*xstrdup(const char *);
+extern void 	*xfree(void *);
+/* xml.c */
+extern void	vCreateBookIntro(diagram_type *, int, encoding_type);
+extern void	vPrologueXML(diagram_type *);
+extern void	vEpilogueXML(diagram_type *);
+extern void	vMove2NextLineXML(diagram_type *);
+extern void	vSubstringXML(diagram_type *,
+				const char *, size_t, long, USHORT);
+extern void	vStartOfParagraphXML(diagram_type *, int);
+extern void	vEndOfParagraphXML(diagram_type *, int);
+extern void	vEndOfPageXML(diagram_type *);
+extern void	vSetHeadersXML(diagram_type *, USHORT);
+extern void	vStartOfListXML(diagram_type *, UCHAR, BOOL);
+extern void	vEndOfListXML(diagram_type *);
+extern void	vStartOfListItemXML(diagram_type *, BOOL);
+extern void	vEndOfTableXML(diagram_type *);
+extern void	vAddTableRowXML(diagram_type *, char **, int,
+			const short *, UCHAR);
+
+
+/* For use with Gray Watson dmalloc library */
+#if defined(DMALLOC)
+#include "dmalloc.h"
+/* The xfree in Antiword is incompatible with the one in dmalloc */
+#undef xfree
+#endif /* DMALLOC */
+
+#endif /* __antiword_h */

+ 146 - 0
sys/src/cmd/aux/antiword/antiword.man

@@ -0,0 +1,146 @@
+ANTIWORD(1)            Linux User's Manual            ANTIWORD(1)
+
+
+
+NAME
+       antiword - show the text and images of MS Word documents
+
+SYNOPSIS
+       antiword [ options ] wordfiles
+
+DESCRIPTION
+       Antiword  is an application that displays the text and the
+       images of Microsoft Word documents.
+       A wordfile named - stands for a Word  document  read  from
+       the standard input.
+       Only  documents made by MS Word version 2 and version 6 or
+       later are supported.
+
+OPTIONS
+       -h     Give a help message.
+
+       -i image level
+              The image  level  determines  how  images  will  be
+              shown.
+
+              0: Use  non-standard  extensions  from Ghostscript.
+                 This output may  not  print  on  any  PostScript
+                 printer,  but  is useful in case no hard copy is
+                 needed. It is also useful  when  Ghostscript  is
+                 used as a filter to print a PostScript file to a
+                 non-PostScript printer.
+
+              1: Show no images.
+
+              2: PostScript level 2 compatible. (default)
+
+              3: PostScript level  3  compatible.  (EXPERIMENTAL,
+                 Portable  Network  Graphics (PNG) images are not
+                 printed correctly)
+
+       -m mapping file
+              This file is used to map Unicode characters to your
+              local  character  set.  The default is UTF-8.txt in
+              locales that support UTF-8 and 8859-1.txt in  other
+              locales.
+
+       -p papersize
+              Output  in  PostScript  form. Printable on paper of
+              the specified size: 10x14,  a3,  a4,  a5,  b4,  b5,
+              executive,  folio,  legal,  letter,  note,  quarto,
+              statement or tabloid.
+
+       -s     Include  text  with  the  so-called  "hidden  text"
+              attribute.
+
+       -t     Output in text form. (default)
+
+       -w width
+              In  text mode this is the line width in characters.
+              A value of zero puts an entire paragraph on a line,
+              useful  when  the  text  is  to  used  as input for
+              another wordprocessor. This  value  is  ignored  in
+              PostScript mode.
+
+       -x document type definition
+              Output  in  XML  form.  Currently the only document
+              type definition is db (for DocBook).
+
+       -L     In PostScript mode: use landscape mode.
+
+FILES
+       Mapping files like 8859-1.txt
+              Antiword looks  for  its  mapping  files  in  three
+              directories, in the order given:
+              (1) The directory specified by $ANTIWORDHOME
+              (2) The directory specified by $HOME/.antiword
+              (3) Directory /usr/share/antiword
+
+       The fontnames file
+              Antiword  will  look  for  its fontname file in the
+              same directories as used for the mapping files.
+              The fontnames file contains the  translation  table
+              from  font names used by MS Word to font names used
+              by PostScript.
+
+       NOTE:
+              Antiword cannot tell the difference between a  file
+              that  does  not  exist  and  a  file that cannot be
+              opened for reading.
+
+ENVIRONMENT
+       Antiword uses the environment variable ``ANTIWORDHOME'' as
+       the  first  directory to look for its files. Antiword uses
+       the environment variable ``HOME'' to find the user's  home
+       directory.   When  in  text  mode  it  uses  the  variable
+       ``COLUMNS'' to set the width of the output  (unless  over-
+       ridden by the -w option).
+
+BUGS
+       Antiword  is  far  from  complete. Many features are still
+       missing. Many images are not shown yet. Some of the images
+       that  are shown, are shown in the wrong place.  PostScript
+       output is only available in ISO 8859-1 and ISO 8859-2.
+
+WEB SITES
+       The most recent released version  of  Antiword  is  always
+       available from:
+       http://www.winfield.demon.nl/index.html
+       or try
+       http://antiword.cjb.net/
+
+AUTHOR
+       Adri van Os <antiword@winfield.demon.nl>
+       or try <comments@antiword.cjb.net>
+
+       R.F. Smith <rsmith@xs4all.nl> and
+       Sindi Keesan <keesan@cyberspace.org>
+       contributed to this manual page.
+
+LICENSE
+       Antiword  is free software; you can redistribute it and/or
+       modify it under  the  terms  of  the  GNU  General  Public
+       License  as  published  by  the  Free Software Foundation;
+       either version 2 of the License, or (at your  option)  any
+       later version.
+
+       This  program  is  distributed in the hope that it will be
+       useful but WITHOUT ANY WARRANTY; without even the  implied
+       warranty  of  MERCHANTABILITY  or FITNESS FOR A PARTICULAR
+       PURPOSE. See the  GNU  General  Public  License  for  more
+       details.
+
+       You  should have received a copy of the GNU General Public
+       License along with this program; if not, write to the Free
+       Software  Foundation,  Inc.,  59  Temple Place, Suite 330,
+       Boston, MA 02111-1307 USA
+
+ACKNOWLEDGEMENTS
+       Linux is a registered trademark of Linus Torvalds.
+       PostScript is a trademark of Adobe Systems Incorporated.
+       Microsoft is a  registered  trademark  and  Windows  is  a
+       trademark of Microsoft Corporation.
+
+
+
+Antiword 0.34              Jun 24, 2003               ANTIWORD(1)

+ 34 - 0
sys/src/cmd/aux/antiword/antiword.php

@@ -0,0 +1,34 @@
+From: Paul Southworth <pauls@etext.org>
+Subject: antiword PHP script
+Date: Thu, 24 Oct 2002 14:01:05 -0700 (PDT)
+
+Please find attached a trivial example of using a web form to process an
+uploaded Word doc to text using antiword.  Perhaps other antiword users
+would find it useful.
+
+--Paul
+
+<?
+/* antiword.php
+   A PHP script to convert uploaded MS Word docs to text using antiword.
+   This script is public domain, no copyright.
+   September 11, 2002
+   Paul Southworth
+*/
+function print_form() {
+?>
+<html><head><title>antiword</title></head><body>
+<form method=post action=antiword.php enctype="multipart/form-data">
+<input name=upload type=file>
+<input type=submit name=submit value=convert>
+</form>
+</body></html>
+<?
+}
+if ($_FILES['upload']) {
+    header ("Content-type: text/plain");
+    system("/usr/local/bin/antiword " . $_FILES['upload']['tmp_name']);
+} else {
+    print_form();
+}
+?>

+ 154 - 0
sys/src/cmd/aux/antiword/asc85enc.c

@@ -0,0 +1,154 @@
+/*
+ * asc85enc.c
+ * Copyright (C) 2000-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to for ASCII 85 encoding
+ *
+ *====================================================================
+ * This part of the software is based on:
+ * asc85ec.c - ASCII85 and Hex encoding for PostScript Level 2 and PDF
+ * Copyright (C) 1994-99 Thomas Merz (tm@muc.de)
+ *====================================================================
+ * The credit should go to him, but all the bugs are mine.
+ */
+
+#include <stdio.h>
+#include "antiword.h"
+
+static const ULONG	aulPower85[5] = {
+	1UL, 85UL, 85UL * 85, 85UL * 85 * 85, 85UL * 85 * 85 * 85,
+};
+static int	iOutBytes = 0;	/* Number of characters in an output line */
+static char	cCharPrev = '\0';
+
+/*
+ * Two percent characters at the start of a line will cause trouble
+ * with some post-processing software. In order to avoid this, we
+ * simply insert a line break if we encounter two percent characters
+ * at the start of the line. Of course, this rather simplistic
+ * algorithm may lead to a large line count in pathological cases,
+ * but the chance for hitting such a case is very small, and even
+ * so it's only a cosmetic flaw and not a functional restriction.
+ */
+
+/*
+ * vOutputByte - output one byte
+ */
+static void
+vOutputByte(ULONG ulChar, FILE *pOutFile)
+{
+	if (iOutBytes == 1 && cCharPrev == '%' && ulChar == (ULONG)'%') {
+		if (putc('\n', pOutFile) != EOF) {
+			iOutBytes = 0;
+		}
+	}
+	if (putc((int)ulChar, pOutFile) == EOF) {
+		return;
+	}
+	iOutBytes++;
+	if (iOutBytes > 63) {
+		if (putc('\n', pOutFile) != EOF) {
+			iOutBytes = 0;
+		}
+	}
+	cCharPrev = (char)ulChar;
+} /* end of vOutputByte */
+
+/*
+ * vASCII85EncodeByte - ASCII 85 encode a byte
+ */
+void
+vASCII85EncodeByte(FILE *pOutFile, int iByte)
+{
+	static ULONG	ulBuffer[4] = { 0, 0, 0, 0 };
+	static int	iInBuffer = 0;
+	ULONG	ulValue, ulTmp;
+	int	iIndex;
+
+	fail(pOutFile == NULL);
+	fail(iInBuffer < 0);
+	fail(iInBuffer > 3);
+
+	if (iByte == EOF) {
+		/* End Of File, time to clean up */
+		if (iInBuffer > 0 && iInBuffer < 4) {
+			/* Encode the remaining bytes */
+			ulValue = 0;
+			for (iIndex = iInBuffer - 1; iIndex >= 0; iIndex--) {
+				ulValue |=
+					ulBuffer[iIndex] << (8 * (3 - iIndex));
+			}
+			for (iIndex = 4; iIndex >= 4 - iInBuffer; iIndex--) {
+				ulTmp = ulValue / aulPower85[iIndex];
+				vOutputByte(ulTmp + '!', pOutFile);
+				ulValue -= ulTmp * aulPower85[iIndex];
+			}
+		}
+		/* Add the End Of Data marker */
+		(void)putc('~', pOutFile);
+		(void)putc('>', pOutFile);
+		(void)putc('\n', pOutFile);
+		/* Reset the control variables */
+		iInBuffer = 0;
+		iOutBytes = 0;
+		cCharPrev = '\0';
+		return;
+	}
+
+	ulBuffer[iInBuffer] = (ULONG)iByte & 0xff;
+	iInBuffer++;
+
+	if (iInBuffer >= 4) {
+		ulValue = (ulBuffer[0] << 24) | (ulBuffer[1] << 16) |
+			(ulBuffer[2] << 8) | ulBuffer[3];
+		if (ulValue == 0) {
+			vOutputByte((ULONG)'z', pOutFile); /* Shortcut for 0 */
+		} else {
+			for (iIndex = 4; iIndex >= 0; iIndex--) {
+				ulTmp = ulValue / aulPower85[iIndex];
+				vOutputByte(ulTmp + '!', pOutFile);
+				ulValue -= ulTmp * aulPower85[iIndex];
+			}
+		}
+		/* Reset the buffer */
+		iInBuffer = 0;
+	}
+} /* end of vASCII85EncodeByte */
+
+/*
+ * vASCII85EncodeArray - ASCII 85 encode a byte array
+ */
+void
+vASCII85EncodeArray(FILE *pInFile, FILE *pOutFile, size_t tLength)
+{
+	size_t	tCount;
+	int	iByte;
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+
+	DBG_DEC(tLength);
+
+	for (tCount = 0; tCount < tLength; tCount++) {
+		iByte = iNextByte(pInFile);
+		if (iByte == EOF) {
+			break;
+		}
+		vASCII85EncodeByte(pOutFile, iByte);
+	}
+} /* end of vASCII85EncodeArray */
+
+/*
+ * vASCII85EncodeFile - ASCII 85 encode part of a file
+ */
+void
+vASCII85EncodeFile(FILE *pInFile, FILE *pOutFile, size_t tLength)
+{
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(tLength == 0);
+
+	vASCII85EncodeArray(pInFile, pOutFile, tLength);
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vASCII85EncodeFile */

+ 682 - 0
sys/src/cmd/aux/antiword/blocklist.c

@@ -0,0 +1,682 @@
+/*
+ * blocklist.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy the lists of Word "text" blocks
+ */
+
+#include <stdlib.h>
+#include "antiword.h"
+
+
+/*
+ * Private structure to hide the way the information
+ * is stored from the rest of the program
+ */
+typedef struct list_mem_tag {
+	text_block_type		tInfo;
+	struct list_mem_tag	*pNext;
+} list_mem_type;
+
+/* Variables to describe the start of the block lists */
+static list_mem_type	*pTextAnchor = NULL;
+static list_mem_type	*pFootAnchor = NULL;
+static list_mem_type	*pHdrFtrAnchor = NULL;
+static list_mem_type	*pMacroAnchor = NULL;
+static list_mem_type	*pAnnotationAnchor = NULL;
+static list_mem_type	*pEndAnchor = NULL;
+static list_mem_type	*pTextBoxAnchor = NULL;
+static list_mem_type	*pHdrTextBoxAnchor = NULL;
+/* Variable needed to build the block list */
+static list_mem_type	*pBlockLast = NULL;
+/* Variable needed to read a block list */
+static list_mem_type	*pBlockCurrent = NULL;
+/* Last block read */
+static UCHAR		aucBlock[BIG_BLOCK_SIZE];
+
+
+/*
+ * pFreeOneList - free a text block list
+ *
+ * Will always return NULL
+ */
+static list_mem_type *
+pFreeOneList(list_mem_type *pAnchor)
+{
+	list_mem_type	*pCurr, *pNext;
+
+	pCurr = pAnchor;
+	while (pCurr != NULL) {
+		pNext = pCurr->pNext;
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+	}
+	return NULL;
+} /* end of pFreeOneList */
+
+/*
+ * vDestroyTextBlockList - destroy the text block lists
+ */
+void
+vDestroyTextBlockList(void)
+{
+	DBG_MSG("vDestroyTextBlockList");
+
+	/* Free the lists one by one */
+	pTextAnchor = pFreeOneList(pTextAnchor);
+	pFootAnchor = pFreeOneList(pFootAnchor);
+	pHdrFtrAnchor = pFreeOneList(pHdrFtrAnchor);
+	pMacroAnchor = pFreeOneList(pMacroAnchor);
+	pAnnotationAnchor = pFreeOneList(pAnnotationAnchor);
+	pEndAnchor = pFreeOneList(pEndAnchor);
+	pTextBoxAnchor = pFreeOneList(pTextBoxAnchor);
+	pHdrTextBoxAnchor = pFreeOneList(pHdrTextBoxAnchor);
+	/* Reset all the controle variables */
+	pBlockLast = NULL;
+	pBlockCurrent = NULL;
+} /* end of vDestroyTextBlockList */
+
+/*
+ * bAdd2TextBlockList - add an element to the text block list
+ *
+ * returns: TRUE when successful, otherwise FALSE
+ */
+BOOL
+bAdd2TextBlockList(const text_block_type *pTextBlock)
+{
+	list_mem_type	*pListMember;
+
+	fail(pTextBlock == NULL);
+	fail(pTextBlock->ulFileOffset == FC_INVALID);
+	fail(pTextBlock->ulCharPos == CP_INVALID);
+	fail(pTextBlock->ulLength == 0);
+	fail(pTextBlock->bUsesUnicode && odd(pTextBlock->ulLength));
+
+	NO_DBG_MSG("bAdd2TextBlockList");
+	NO_DBG_HEX(pTextBlock->ulFileOffset);
+	NO_DBG_HEX(pTextBlock->ulCharPos);
+	NO_DBG_HEX(pTextBlock->ulLength);
+	NO_DBG_DEC(pTextBlock->bUsesUnicode);
+	NO_DBG_DEC(pTextBlock->usPropMod);
+
+	if (pTextBlock->ulFileOffset == FC_INVALID ||
+	    pTextBlock->ulCharPos == CP_INVALID ||
+	    pTextBlock->ulLength == 0 ||
+	    (pTextBlock->bUsesUnicode && odd(pTextBlock->ulLength))) {
+		werr(0, "Software (textblock) error");
+		return FALSE;
+	}
+	/*
+	 * Check for continuous blocks of the same character size and
+	 * the same properties modifier
+	 */
+	if (pBlockLast != NULL &&
+	    pBlockLast->tInfo.ulFileOffset +
+	     pBlockLast->tInfo.ulLength == pTextBlock->ulFileOffset &&
+	    pBlockLast->tInfo.ulCharPos +
+	     pBlockLast->tInfo.ulLength == pTextBlock->ulCharPos &&
+	    pBlockLast->tInfo.bUsesUnicode == pTextBlock->bUsesUnicode &&
+	    pBlockLast->tInfo.usPropMod == pTextBlock->usPropMod) {
+		/* These are continous blocks */
+		pBlockLast->tInfo.ulLength += pTextBlock->ulLength;
+		return TRUE;
+	}
+	/* Make a new block */
+	pListMember = xmalloc(sizeof(list_mem_type));
+	/* Add the block to the list */
+	pListMember->tInfo = *pTextBlock;
+	pListMember->pNext = NULL;
+	if (pTextAnchor == NULL) {
+		pTextAnchor = pListMember;
+	} else {
+		fail(pBlockLast == NULL);
+		pBlockLast->pNext = pListMember;
+	}
+	pBlockLast = pListMember;
+	return TRUE;
+} /* end of bAdd2TextBlockList */
+
+/*
+ * vSpitList - Split the list in two
+ */
+static void
+vSpitList(list_mem_type **ppAnchorCurr, list_mem_type **ppAnchorNext,
+	ULONG ulListLen)
+{
+	list_mem_type	*pCurr;
+	long		lCharsToGo, lBytesTooFar;
+
+	fail(ppAnchorCurr == NULL);
+	fail(ppAnchorNext == NULL);
+	fail(ulListLen > (ULONG)LONG_MAX);
+
+	pCurr = NULL;
+	lCharsToGo = (long)ulListLen;
+	lBytesTooFar = -1;
+	if (ulListLen != 0) {
+		DBG_DEC(ulListLen);
+		for (pCurr = *ppAnchorCurr;
+		     pCurr != NULL;
+		     pCurr = pCurr->pNext) {
+			NO_DBG_DEC(pCurr->tInfo.ulLength);
+			fail(pCurr->tInfo.ulLength == 0);
+			fail(pCurr->tInfo.ulLength > (ULONG)LONG_MAX);
+			if (pCurr->tInfo.bUsesUnicode) {
+				fail(odd(pCurr->tInfo.ulLength));
+				lCharsToGo -= (long)(pCurr->tInfo.ulLength / 2);
+				if (lCharsToGo < 0) {
+					lBytesTooFar = -2 * lCharsToGo;
+				}
+			} else {
+				lCharsToGo -= (long)pCurr->tInfo.ulLength;
+				if (lCharsToGo < 0) {
+					lBytesTooFar = -lCharsToGo;
+				}
+			}
+			if (lCharsToGo <= 0) {
+				break;
+			}
+		}
+	}
+/* Split the list */
+	if (ulListLen == 0) {
+		/* Current blocklist is empty */
+		*ppAnchorNext = *ppAnchorCurr;
+		*ppAnchorCurr = NULL;
+	} else if (pCurr == NULL) {
+		/* No blocks for the next list */
+		*ppAnchorNext = NULL;
+	} else if (lCharsToGo == 0) {
+		/* Move the integral number of blocks to the next list */
+		*ppAnchorNext = pCurr->pNext;
+		pCurr->pNext = NULL;
+	} else {
+		/* Split the part current block list, part next block list */
+		DBG_DEC(lBytesTooFar);
+		fail(lBytesTooFar <= 0);
+		*ppAnchorNext = xmalloc(sizeof(list_mem_type));
+		DBG_HEX(pCurr->tInfo.ulFileOffset);
+		(*ppAnchorNext)->tInfo.ulFileOffset =
+				pCurr->tInfo.ulFileOffset +
+				pCurr->tInfo.ulLength -
+				lBytesTooFar;
+		DBG_HEX((*ppAnchorNext)->tInfo.ulFileOffset);
+		DBG_HEX(pCurr->tInfo.ulCharPos);
+		(*ppAnchorNext)->tInfo.ulCharPos =
+				pCurr->tInfo.ulCharPos +
+				pCurr->tInfo.ulLength -
+				lBytesTooFar;
+		DBG_HEX((*ppAnchorNext)->tInfo.ulCharPos);
+		(*ppAnchorNext)->tInfo.ulLength = (ULONG)lBytesTooFar;
+		pCurr->tInfo.ulLength -= (ULONG)lBytesTooFar;
+		(*ppAnchorNext)->tInfo.bUsesUnicode = pCurr->tInfo.bUsesUnicode;
+		(*ppAnchorNext)->tInfo.usPropMod = pCurr->tInfo.usPropMod;
+		/* Move the integral number of blocks to the next list */
+		(*ppAnchorNext)->pNext = pCurr->pNext;
+		pCurr->pNext = NULL;
+	}
+} /* end of vSpitList */
+
+#if defined(DEBUG) || defined(__riscos)
+/*
+ * ulComputeListLength - compute the length of a list
+ *
+ * returns the list length in characters
+ */
+static ULONG
+ulComputeListLength(const list_mem_type *pAnchor)
+{
+	const list_mem_type	*pCurr;
+	ULONG		ulTotal;
+
+	ulTotal = 0;
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		fail(pCurr->tInfo.ulLength == 0);
+		if (pCurr->tInfo.bUsesUnicode) {
+			fail(odd(pCurr->tInfo.ulLength));
+			ulTotal += pCurr->tInfo.ulLength / 2;
+		} else {
+			ulTotal += pCurr->tInfo.ulLength;
+		}
+	}
+	return ulTotal;
+} /* end of ulComputeListLength */
+#endif /* DEBUG || __riscos */
+
+#if defined(DEBUG)
+/*
+ * vCheckList - check the number of bytes in a block list
+ */
+static void
+vCheckList(const list_mem_type *pAnchor, ULONG ulListLen, char *szMsg)
+{
+	ULONG		ulTotal;
+
+	ulTotal = ulComputeListLength(pAnchor);
+	DBG_DEC(ulTotal);
+	if (ulTotal != ulListLen) {
+		DBG_DEC(ulListLen);
+		werr(1, szMsg);
+	}
+} /* end of vCheckList */
+#endif /* DEBUG */
+
+/*
+ * bIsEmptyBox - check to see if the given text box is empty
+ */
+static BOOL
+bIsEmptyBox(FILE *pFile, const list_mem_type *pAnchor)
+{
+	const list_mem_type	*pCurr;
+	size_t	tIndex, tSize;
+	UCHAR	*aucBuffer;
+	char	cChar;
+
+	fail(pFile == NULL);
+
+	if (pAnchor == NULL) {
+		return TRUE;
+	}
+
+	aucBuffer = NULL;
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		fail(pCurr->tInfo.ulLength == 0);
+		tSize = (size_t)pCurr->tInfo.ulLength;
+#if defined(__dos)
+		if (pCurr->tInfo.ulLength > 0xffffUL) {
+			tSize = 0xffff;
+		}
+#endif /* __dos */
+		aucBuffer = xmalloc(tSize);
+		if (!bReadBytes(aucBuffer, tSize,
+				pCurr->tInfo.ulFileOffset, pFile)) {
+			aucBuffer = xfree(aucBuffer);
+			return FALSE;
+		}
+		for (tIndex = 0; tIndex < tSize; tIndex++) {
+			cChar = (char)aucBuffer[tIndex];
+			switch (cChar) {
+			case '\0': case '\r': case '\n':
+			case '\f': case '\t': case '\v':
+			case ' ':
+				break;
+			default:
+				aucBuffer = xfree(aucBuffer);
+				return FALSE;
+			}
+		}
+	}
+	aucBuffer = xfree(aucBuffer);
+	return TRUE;
+} /* end of bIsEmptyBox */
+
+/*
+ * vSplitBlockList - split the block list in the various parts
+ *
+ * Split the blocklist in a Text block list, a Footnote block list, a
+ * HeaderFooter block list, a Macro block list, an Annotation block list,
+ * an Endnote block list, a TextBox list and a HeaderTextBox list.
+ *
+ * NOTE:
+ * The various ul*Len input parameters are given in characters, but the
+ * length of the blocks are in bytes.
+ */
+void
+vSplitBlockList(FILE *pFile, ULONG ulTextLen, ULONG ulFootnoteLen,
+	ULONG ulHdrFtrLen, ULONG ulMacroLen, ULONG ulAnnotationLen,
+	ULONG ulEndnoteLen, ULONG ulTextBoxLen, ULONG ulHdrTextBoxLen,
+	BOOL bMustExtend)
+{
+	list_mem_type	*apAnchors[8];
+	list_mem_type	*pGarbageAnchor, *pCurr;
+	size_t		tIndex;
+
+	DBG_MSG("vSplitBlockList");
+
+	pGarbageAnchor = NULL;
+
+	DBG_MSG_C(ulTextLen != 0, "Text block list");
+	vSpitList(&pTextAnchor, &pFootAnchor, ulTextLen);
+	DBG_MSG_C(ulFootnoteLen != 0, "Footnote block list");
+	vSpitList(&pFootAnchor, &pHdrFtrAnchor, ulFootnoteLen);
+	DBG_MSG_C(ulHdrFtrLen != 0, "Header/Footer block list");
+	vSpitList(&pHdrFtrAnchor, &pMacroAnchor, ulHdrFtrLen);
+	DBG_MSG_C(ulMacroLen != 0, "Macro block list");
+	vSpitList(&pMacroAnchor, &pAnnotationAnchor, ulMacroLen);
+	DBG_MSG_C(ulAnnotationLen != 0, "Annotation block list");
+	vSpitList(&pAnnotationAnchor, &pEndAnchor, ulAnnotationLen);
+	DBG_MSG_C(ulEndnoteLen != 0, "Endnote block list");
+	vSpitList(&pEndAnchor, &pTextBoxAnchor, ulEndnoteLen);
+	DBG_MSG_C(ulTextBoxLen != 0, "Textbox block list");
+	vSpitList(&pTextBoxAnchor, &pHdrTextBoxAnchor, ulTextBoxLen);
+	DBG_MSG_C(ulHdrTextBoxLen != 0, "HeaderTextbox block list");
+	vSpitList(&pHdrTextBoxAnchor, &pGarbageAnchor, ulHdrTextBoxLen);
+
+	/* Free the garbage block list, this should not be needed */
+	DBG_DEC_C(pGarbageAnchor != NULL, pGarbageAnchor->tInfo.ulLength);
+	pGarbageAnchor = pFreeOneList(pGarbageAnchor);
+
+#if defined(DEBUG)
+	vCheckList(pTextAnchor, ulTextLen, "Software error (Text)");
+	vCheckList(pFootAnchor, ulFootnoteLen, "Software error (Footnote)");
+	vCheckList(pHdrFtrAnchor, ulHdrFtrLen, "Software error (Hdr/Ftr)");
+	vCheckList(pMacroAnchor, ulMacroLen, "Software error (Macro)");
+	vCheckList(pAnnotationAnchor, ulAnnotationLen,
+						"Software error (Annotation)");
+	vCheckList(pEndAnchor, ulEndnoteLen, "Software error (Endnote)");
+	vCheckList(pTextBoxAnchor, ulTextBoxLen, "Software error (TextBox)");
+	vCheckList(pHdrTextBoxAnchor, ulHdrTextBoxLen,
+						"Software error (HdrTextBox)");
+#endif /* DEBUG */
+
+	/* Remove the list if the text box is empty */
+	if (bIsEmptyBox(pFile, pTextBoxAnchor)) {
+		pTextBoxAnchor = pFreeOneList(pTextBoxAnchor);
+	}
+	if (bIsEmptyBox(pFile, pHdrTextBoxAnchor)) {
+		pHdrTextBoxAnchor = pFreeOneList(pHdrTextBoxAnchor);
+	}
+
+	if (!bMustExtend) {
+		return;
+	}
+	/*
+	 * All blocks (except the last one) must have a length that
+	 * is a multiple of the Big Block Size
+	 */
+
+	apAnchors[0] = pTextAnchor;
+	apAnchors[1] = pFootAnchor;
+	apAnchors[2] = pHdrFtrAnchor;
+	apAnchors[3] = pMacroAnchor;
+	apAnchors[4] = pAnnotationAnchor;
+	apAnchors[5] = pEndAnchor;
+	apAnchors[6] = pTextBoxAnchor;
+	apAnchors[7] = pHdrTextBoxAnchor;
+
+	for (tIndex = 0; tIndex < elementsof(apAnchors); tIndex++) {
+		for (pCurr = apAnchors[tIndex];
+		     pCurr != NULL;
+		     pCurr = pCurr->pNext) {
+			if (pCurr->pNext != NULL &&
+			    pCurr->tInfo.ulLength % BIG_BLOCK_SIZE != 0) {
+				DBG_DEC(tIndex);
+				DBG_HEX(pCurr->tInfo.ulFileOffset);
+				DBG_HEX(pCurr->tInfo.ulCharPos);
+				DBG_DEC(pCurr->tInfo.ulLength);
+				pCurr->tInfo.ulLength /= BIG_BLOCK_SIZE;
+				pCurr->tInfo.ulLength++;
+				pCurr->tInfo.ulLength *= BIG_BLOCK_SIZE;
+				DBG_DEC(pCurr->tInfo.ulLength);
+			}
+		}
+	}
+} /* end of vSplitBlockList */
+
+#if defined(__riscos)
+/*
+ * ulGetDocumentLength - get the total character length of the printable lists
+ *
+ * returns: The total number of characters
+ */
+ULONG
+ulGetDocumentLength(void)
+{
+	long		ulTotal;
+
+	DBG_MSG("ulGetDocumentLength");
+
+	ulTotal = ulComputeListLength(pTextAnchor);
+	ulTotal += ulComputeListLength(pFootAnchor);
+	ulTotal += ulComputeListLength(pEndAnchor);
+	ulTotal += ulComputeListLength(pTextBoxAnchor);
+	ulTotal += ulComputeListLength(pHdrTextBoxAnchor);
+	DBG_DEC(ulTotal);
+	return ulTotal;
+} /* end of ulGetDocumentLength */
+#endif /* __riscos */
+
+/*
+ * bExistsTextBox - is there a text box?
+ */
+BOOL
+bExistsTextBox(void)
+{
+	return pTextBoxAnchor != NULL &&
+		pTextBoxAnchor->tInfo.ulLength != 0;
+} /* end of bExistsTextBox */
+
+/*
+ * bExistsHdrTextBox - is there a header text box?
+ */
+BOOL
+bExistsHdrTextBox(void)
+{
+	return pHdrTextBoxAnchor != NULL &&
+		pHdrTextBoxAnchor->tInfo.ulLength != 0;
+} /* end of bExistsHdrTextBox */
+/*
+ * usGetNextByte - get the next byte from the specified block list
+ */
+static USHORT
+usGetNextByte(FILE *pFile, list_mem_type *pAnchor,
+	ULONG *pulFileOffset, ULONG *pulCharPos, USHORT *pusPropMod)
+{
+	static ULONG	ulBlockOffset = 0;
+	static size_t	tByteNext = 0;
+	ULONG	ulReadOff;
+	size_t	tReadLen;
+
+	if (pBlockCurrent == NULL ||
+	    tByteNext >= sizeof(aucBlock) ||
+	    ulBlockOffset + tByteNext >= pBlockCurrent->tInfo.ulLength) {
+		if (pBlockCurrent == NULL) {
+			/* First block, first part */
+			pBlockCurrent = pAnchor;
+			ulBlockOffset = 0;
+		} else if (ulBlockOffset + sizeof(aucBlock) <
+				pBlockCurrent->tInfo.ulLength) {
+			/* Same block, next part */
+			ulBlockOffset += sizeof(aucBlock);
+		} else {
+			/* Next block, first part */
+			pBlockCurrent = pBlockCurrent->pNext;
+			ulBlockOffset = 0;
+		}
+		if (pBlockCurrent == NULL) {
+			/* Past the last part of the last block */
+			return (USHORT)EOF;
+		}
+		tReadLen = (size_t)
+			(pBlockCurrent->tInfo.ulLength - ulBlockOffset);
+		if (tReadLen > sizeof(aucBlock)) {
+			tReadLen = sizeof(aucBlock);
+		}
+		ulReadOff = pBlockCurrent->tInfo.ulFileOffset +
+				ulBlockOffset;
+		if (!bReadBytes(aucBlock, tReadLen, ulReadOff, pFile)) {
+			/* Don't read from this list any longer */
+			pBlockCurrent = NULL;
+			return (USHORT)EOF;
+		}
+		tByteNext = 0;
+	}
+	if (pulFileOffset != NULL) {
+		*pulFileOffset = pBlockCurrent->tInfo.ulFileOffset +
+			ulBlockOffset + tByteNext;
+	}
+	if (pulCharPos != NULL) {
+		*pulCharPos = pBlockCurrent->tInfo.ulCharPos +
+			ulBlockOffset + tByteNext;
+	}
+	if (pusPropMod != NULL) {
+		*pusPropMod = pBlockCurrent->tInfo.usPropMod;
+	}
+	return (USHORT)aucBlock[tByteNext++];
+} /* end of usGetNextByte */
+
+/*
+ * usGetNextChar - get the next character from the specified block list
+ */
+static USHORT
+usGetNextChar(FILE *pFile, list_mem_type *pAnchor,
+	ULONG *pulFileOffset, ULONG *pulCharPos, USHORT *pusPropMod)
+{
+	USHORT	usLSB, usMSB;
+
+	usLSB = usGetNextByte(pFile, pAnchor,
+			pulFileOffset, pulCharPos, pusPropMod);
+	if (usLSB == (USHORT)EOF) {
+		return (USHORT)EOF;
+	}
+	if (pBlockCurrent->tInfo.bUsesUnicode) {
+		usMSB = usGetNextByte(pFile, pAnchor,
+				NULL, NULL, NULL);
+	} else {
+		usMSB = 0x00;
+	}
+	if (usMSB == (USHORT)EOF) {
+		DBG_MSG("usGetNextChar: Unexpected EOF");
+		DBG_HEX_C(pulFileOffset != NULL, *pulFileOffset);
+		DBG_HEX_C(pulCharPos != NULL, *pulCharPos);
+		return (USHORT)EOF;
+	}
+	return (usMSB << 8) | usLSB;
+} /* end of usGetNextChar */
+
+/*
+ * usNextChar - get the next character from the given block list
+ */
+USHORT
+usNextChar(FILE *pFile, list_id_enum eListID,
+	ULONG *pulFileOffset, ULONG *pulCharPos, USHORT *pusPropMod)
+{
+	USHORT	usRetVal;
+
+	fail(pFile == NULL);
+
+	switch (eListID) {
+	case text_list:
+		usRetVal = usGetNextChar(pFile, pTextAnchor,
+				pulFileOffset, pulCharPos, pusPropMod);
+		break;
+	case footnote_list:
+		usRetVal = usGetNextChar(pFile, pFootAnchor,
+				pulFileOffset, pulCharPos, pusPropMod);
+		break;
+	case endnote_list:
+		usRetVal = usGetNextChar(pFile, pEndAnchor,
+				pulFileOffset, pulCharPos, pusPropMod);
+		break;
+	case textbox_list:
+		usRetVal = usGetNextChar(pFile, pTextBoxAnchor,
+				pulFileOffset, pulCharPos, pusPropMod);
+		break;
+	case hdrtextbox_list:
+		usRetVal = usGetNextChar(pFile, pHdrTextBoxAnchor,
+				pulFileOffset, pulCharPos, pusPropMod);
+		break;
+	default:
+		DBG_DEC(eListID);
+		usRetVal = (USHORT)EOF;
+		break;
+	}
+
+	if (usRetVal == (USHORT)EOF) {
+		if (pulFileOffset != NULL) {
+			*pulFileOffset = FC_INVALID;
+		}
+		if (pulCharPos != NULL) {
+			*pulCharPos = CP_INVALID;
+		}
+		if (pusPropMod != NULL) {
+			*pusPropMod = IGNORE_PROPMOD;
+		}
+	}
+	return usRetVal;
+} /* end of usNextChar */
+
+/*
+ * Translate a character position to an offset in the file.
+ * Logical to physical offset.
+ *
+ * Returns:	FC_INVALID: in case of error
+ *		otherwise: the computed file offset
+ */
+ULONG
+ulCharPos2FileOffset(ULONG ulCharPos)
+{
+	list_mem_type	*apAnchors[5];
+	list_mem_type	*pCurr;
+	ULONG		ulBestGuess;
+	size_t		tIndex;
+
+	apAnchors[0] = pTextAnchor;
+	apAnchors[1] = pFootAnchor;
+	apAnchors[2] = pEndAnchor;
+	apAnchors[3] = pTextBoxAnchor;
+	apAnchors[4] = pHdrTextBoxAnchor;
+
+	ulBestGuess = FC_INVALID; /* Best guess is "fileoffset not found" */
+
+	for (tIndex = 0; tIndex < elementsof(apAnchors); tIndex++) {
+		for (pCurr = apAnchors[tIndex];
+		     pCurr != NULL;
+		     pCurr = pCurr->pNext) {
+			if (ulCharPos == pCurr->tInfo.ulCharPos +
+			     pCurr->tInfo.ulLength &&
+			    pCurr->pNext != NULL) {
+				/*
+				 * The character position is one beyond this
+				 * block, so we guess it's the first byte of
+				 * the next block (if there is a next block)
+				 */
+				ulBestGuess = pCurr->pNext->tInfo.ulFileOffset;
+			}
+
+			if (ulCharPos < pCurr->tInfo.ulCharPos ||
+			    ulCharPos >= pCurr->tInfo.ulCharPos +
+			     pCurr->tInfo.ulLength) {
+				/* Character position is not in this block */
+				continue;
+			}
+
+			/* The character position is in the current block */
+			return pCurr->tInfo.ulFileOffset +
+				ulCharPos - pCurr->tInfo.ulCharPos;
+		}
+	}
+	/* Passed beyond the end of the last list */
+	NO_DBG_HEX(ulCharPos);
+	NO_DBG_HEX(ulBestGuess);
+	return ulBestGuess;
+} /* end of ulCharPos2FileOffset */
+
+/*
+ * Get the sequence number beloning to the given file offset
+ *
+ * Returns the sequence number
+ */
+ULONG
+ulGetSeqNumber(ULONG ulFileOffset)
+{
+	list_mem_type	*pCurr;
+	ULONG		ulSeq;
+
+	if (ulFileOffset == FC_INVALID) {
+		return FC_INVALID;
+	}
+
+	ulSeq = 0;
+	for (pCurr = pTextAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (ulFileOffset >= pCurr->tInfo.ulFileOffset &&
+		    ulFileOffset < pCurr->tInfo.ulFileOffset +
+		     pCurr->tInfo.ulLength) {
+			/* The file offset is within the current textblock */
+			return ulSeq + ulFileOffset - pCurr->tInfo.ulFileOffset;
+		}
+		ulSeq += pCurr->tInfo.ulLength;
+	}
+	return FC_INVALID;
+} /* end of ulGetSeqNumber */

+ 606 - 0
sys/src/cmd/aux/antiword/chartrans.c

@@ -0,0 +1,606 @@
+/*
+ * chartrans.c
+ * Copyright (C) 1999-2003 A.J. van Os; Released under GNU GPL
+ *
+ * Description:
+ * Translate Word characters to local representation
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#if defined(__STDC_ISO_10646__)
+#include <wctype.h>
+#endif /* __STDC_ISO_10646__ */
+#include "antiword.h"
+
+static const USHORT usCp850[] = {
+	0x00c7, 0x00fc, 0x00e9, 0x00e2, 0x00e4, 0x00e0, 0x00e5, 0x00e7,
+	0x00ea, 0x00eb, 0x00e8, 0x00ef, 0x00ee, 0x00ec, 0x00c4, 0x00c5,
+	0x00c9, 0x00e6, 0x00c6, 0x00f4, 0x00f6, 0x00f2, 0x00fb, 0x00f9,
+	0x00ff, 0x00d6, 0x00dc, 0x00f8, 0x00a3, 0x00d8, 0x00d7, 0x0192,
+	0x00e1, 0x00ed, 0x00f3, 0x00fa, 0x00f1, 0x00d1, 0x00aa, 0x00ba,
+	0x00bf, 0x00ae, 0x00ac, 0x00bd, 0x00bc, 0x00a1, 0x00ab, 0x00bb,
+	0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00c1, 0x00c2, 0x00c0,
+	0x00a9, 0x2563, 0x2551, 0x2557, 0x255d, 0x00a2, 0x00a5, 0x2510,
+	0x2514, 0x2534, 0x252c, 0x251c, 0x2500, 0x253c, 0x00e3, 0x00c3,
+	0x255a, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256c, 0x00a4,
+	0x00f0, 0x00d0, 0x00ca, 0x00cb, 0x00c8, 0x0131, 0x00cd, 0x00ce,
+	0x00cf, 0x2518, 0x250c, 0x2588, 0x2584, 0x00a6, 0x00cc, 0x2580,
+	0x00d3, 0x00df, 0x00d4, 0x00d2, 0x00f5, 0x00d5, 0x00b5, 0x00fe,
+	0x00de, 0x00da, 0x00db, 0x00d9, 0x00fd, 0x00dd, 0x00af, 0x00b4,
+	0x00ad, 0x00b1, 0x2017, 0x00be, 0x00b6, 0x00a7, 0x00f7, 0x00b8,
+	0x00b0, 0x00a8, 0x00b7, 0x00b9, 0x00b3, 0x00b2, 0x25a0, 0x00a0,
+};
+
+static const USHORT usCp1250[] = {
+	0x20ac, 0x003f, 0x201a, 0x003f, 0x201e, 0x2026, 0x2020, 0x2021,
+	0x003f, 0x2030, 0x0160, 0x2039, 0x015a, 0x0164, 0x017d, 0x0179,
+	0x003f, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
+	0x003f, 0x2122, 0x0161, 0x203a, 0x015b, 0x0165, 0x017e, 0x017a,
+	0x00a0, 0x02c7, 0x02d8, 0x0141, 0x00a4, 0x0104, 0x00a6, 0x00a7,
+	0x00a8, 0x00a9, 0x015e, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x017b,
+	0x00b0, 0x00b1, 0x02db, 0x0142, 0x00b4, 0x00b5, 0x00b6, 0x00b7,
+	0x00b8, 0x0105, 0x015f, 0x00bb, 0x013d, 0x02dd, 0x013e, 0x017c,
+	0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7,
+	0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e,
+	0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7,
+	0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df,
+	0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7,
+	0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f,
+	0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7,
+	0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9,
+};
+
+static const USHORT usCp1252[] = {
+	0x20ac, 0x003f, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021,
+	0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x003f, 0x017d, 0x003f,
+	0x003f, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014,
+	0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x003f, 0x017e, 0x0178,
+};
+
+static const USHORT usMacRoman[] = {
+	0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1,
+	0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
+	0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3,
+	0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
+	0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df,
+	0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x00c6, 0x00d8,
+	0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211,
+	0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x2126, 0x00e6, 0x00f8,
+	0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab,
+	0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
+	0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca,
+	0x00ff, 0x0178, 0x2044, 0x00a4, 0x2039, 0x203a, 0xfb01, 0xfb02,
+	0x2021, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1,
+	0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
+	0x003f, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc,
+	0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7,
+};
+
+static const USHORT usPrivateArea[] = {
+	0x0020, 0x0021, 0x2200, 0x0023, 0x2203, 0x0025, 0x0026, 0x220d,
+	0x0028, 0x0029, 0x2217, 0x002b, 0x002c, 0x2212, 0x002e, 0x002f,
+	0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
+	0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x2019, 0x003e, 0x003f,
+	0x201d, 0x201c, 0x0392, 0x03a7, 0x0394, 0x0395, 0x03a6, 0x0393,
+	0x0397, 0x0399, 0x03d1, 0x039a, 0x039b, 0x039c, 0x039d, 0x039f,
+	0x03a0, 0x0398, 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03c2, 0x03a9,
+	0x039e, 0x03a8, 0x0396, 0x005b, 0x2234, 0x005d, 0x22a5, 0x005f,
+	0x003f, 0x03b1, 0x03b2, 0x03c7, 0x03b4, 0x03b5, 0x03c6, 0x03b3,
+	0x03b7, 0x03b9, 0x03d5, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03bf,
+	0x03c0, 0x03b8, 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03d6, 0x03c9,
+	0x03be, 0x03c8, 0x03b6, 0x007b, 0x007c, 0x007d, 0x223c, 0x003f,
+	0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+	0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+	0x003f, 0x003f, 0x003f, 0x2022, 0x003f, 0x003f, 0x003f, 0x003f,
+	0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f, 0x003f,
+	0x20ac, 0x03d2, 0x2032, 0x2264, 0x2044, 0x221e, 0x0192, 0x2663,
+	0x2666, 0x2665, 0x2660, 0x2194, 0x2190, 0x2191, 0x2192, 0x2193,
+	0x00b0, 0x00b1, 0x2033, 0x2265, 0x00d7, 0x221d, 0x2202, 0x2022,
+	0x00f7, 0x2260, 0x2261, 0x2248, 0x2026, 0x007c, 0x23af, 0x21b5,
+	0x2135, 0x2111, 0x211c, 0x2118, 0x2297, 0x2295, 0x2205, 0x2229,
+	0x222a, 0x2283, 0x2287, 0x2284, 0x2282, 0x2286, 0x2208, 0x2209,
+	0x2220, 0x2207, 0x00ae, 0x00a9, 0x2122, 0x220f, 0x221a, 0x22c5,
+	0x00ac, 0x2227, 0x2228, 0x21d4, 0x21d0, 0x21d1, 0x21d2, 0x21d3,
+	0x22c4, 0x3008, 0x00ae, 0x00a9, 0x2122, 0x2211, 0x239b, 0x239c,
+	0x239d, 0x23a1, 0x23a2, 0x23a3, 0x23a7, 0x23a8, 0x23a9, 0x23aa,
+	0x003f, 0x3009, 0x222b, 0x2320, 0x23ae, 0x2321, 0x239e, 0x239f,
+	0x23a0, 0x23a4, 0x23a5, 0x23a6, 0x23ab, 0x23ac, 0x23ad, 0x003f,
+};
+
+typedef struct char_table_tag {
+	USHORT	usLocal;
+	USHORT	usUnicode;
+} char_table_type;
+
+static char_table_type atCharTable[128];
+
+
+/*
+ * iCompare - compare two records
+ *
+ * Compares two records. For use by qsort(3C) and bsearch(3C).
+ *
+ * returns -1 if rec1 < rec2, 0 if rec1 == rec2, 1 if rec1 > rec2
+ */
+static int
+iCompare(const void *pvRecord1, const void *pvRecord2)
+{
+	USHORT	usUnicode1, usUnicode2;
+
+	usUnicode1 = ((char_table_type *)pvRecord1)->usUnicode;
+	usUnicode2 = ((char_table_type *)pvRecord2)->usUnicode;
+
+	if (usUnicode1 < usUnicode2) {
+		return -1;
+	}
+	if (usUnicode1 > usUnicode2) {
+		return 1;
+	}
+	return 0;
+} /* end of iCompare */
+
+/*
+ * pGetCharTableRecord - get the character table record
+ *
+ * returns a pointer to the record when found, otherwise NULL
+ */
+static const char_table_type *
+pGetCharTableRecord(USHORT usUnicode)
+{
+	char_table_type	tKey;
+
+	tKey.usUnicode = usUnicode;
+	tKey.usLocal = 0;
+	return (char_table_type *)bsearch(&tKey,
+			atCharTable,
+			elementsof(atCharTable), sizeof(atCharTable[0]),
+			iCompare);
+} /* end of pGetCharTableRecord */
+
+/*
+ * ucGetNbspValue - get the local representation of the non-breaking space
+ */
+UCHAR
+ucGetNbspValue(void)
+{
+	const char_table_type	*pRec;
+
+	pRec = pGetCharTableRecord(0x00a0);	/* Unicode non-breaking space */
+	if (pRec == NULL || pRec->usLocal > 0xff) {
+		DBG_MSG_C(pRec == NULL, "Non-breaking space record not found");
+		DBG_HEX_C(pRec != NULL, pRec->usLocal);
+		/* No value found, use the best guess */
+		return (UCHAR)0xa0;
+	}
+	return (UCHAR)pRec->usLocal;
+} /* end of ucGetNbspValue */
+
+/*
+ * bReadCharacterMappingTable - read the mapping table
+ *
+ * Read the character mapping table from file and have the contents sorted
+ *
+ * returns TRUE if successful, otherwise FALSE
+ */
+BOOL
+bReadCharacterMappingTable(const char *szFilename)
+{
+	FILE	*pFile;
+	char	*pcTmp;
+	ULONG	ulUnicode;
+	UINT	uiLocal;
+	int	iFields;
+	char	szLine[81];
+
+	DBG_MSG(szFilename);
+
+	fail(szFilename == NULL);
+
+	if (szFilename == NULL || szFilename[0] == '\0') {
+		return FALSE;
+	}
+	pFile = fopen(szFilename, "r");
+	if (pFile == NULL) {
+		DBG_MSG(szFilename);
+		return FALSE;
+	}
+	(void)memset(atCharTable, 0, sizeof(atCharTable));
+
+	while (fgets(szLine, (int)sizeof(szLine), pFile)) {
+		if (szLine[0] == '#' ||
+		    szLine[0] == '\r' ||
+		    szLine[0] == '\n') {
+			/* Comment or empty line */
+			continue;
+		}
+		iFields = sscanf(szLine, "%x %lx %*s", &uiLocal, &ulUnicode);
+		if (iFields != 2) {
+			pcTmp = strchr(szLine, '\r');
+			if (pcTmp != NULL) {
+				*pcTmp = '\0';
+			}
+			pcTmp = strchr(szLine, '\n');
+			if (pcTmp != NULL) {
+				*pcTmp = '\0';
+			}
+			werr(0, "Syntax error in: '%s'", szLine);
+			continue;
+		}
+		if (uiLocal > 0xff || ulUnicode > 0xffff) {
+			werr(0, "Syntax error in: '%02x %04lx'",
+					uiLocal, ulUnicode);
+			continue;
+		}
+		if (uiLocal >= 0x80) {
+			atCharTable[uiLocal - 0x80].usLocal =
+						(USHORT)uiLocal;
+			atCharTable[uiLocal - 0x80].usUnicode =
+						(USHORT)ulUnicode;
+		}
+	}
+	(void)fclose(pFile);
+
+	DBG_HEX(atCharTable[0].usUnicode);
+	DBG_HEX(atCharTable[elementsof(atCharTable)-1].usUnicode);
+
+	qsort(atCharTable,
+		elementsof(atCharTable), sizeof(atCharTable[0]),
+		iCompare);
+
+	DBG_HEX(atCharTable[0].usUnicode);
+	DBG_HEX(atCharTable[elementsof(atCharTable)-1].usUnicode);
+
+	return TRUE;
+} /* end of bReadCharacterMappingTable */
+
+/*
+ * ulTranslateCharacters - Translate characters to local representation
+ *
+ * Translate all characters to local representation
+ *
+ * returns the translated character
+ */
+ULONG
+ulTranslateCharacters(USHORT usChar, ULONG ulFileOffset, int iWordVersion,
+	conversion_type eConversionType, encoding_type eEncoding,
+	BOOL bUseMacCharSet)
+{
+	const char_table_type	*pTmp;
+
+	if (bUseMacCharSet) {
+		/* Translate special Macintosh characters */
+		if (usChar >= 0x80 && usChar <= 0xff) {
+			usChar = usMacRoman[usChar - 0x80];
+		}
+	} else if (iWordVersion == 0) {
+		/* From Code Page 850 to Unicode */
+		if (usChar >= 0x80 && usChar <= 0xff) {
+			usChar = usCp850[usChar - 0x80];
+		}
+	} else {
+		if (eEncoding == encoding_iso_8859_2) {
+			/* Translate implementation defined characters */
+			if (usChar >= 0x80 && usChar <= 0x9f) {
+				usChar = usCp1250[usChar - 0x80];
+			}
+			/* From Code Page 1250 to Unicode */
+			if (iWordVersion < 8 &&
+			    usChar >= 0xa0 && usChar <= 0xff) {
+				usChar = usCp1250[usChar - 0x80];
+			}
+		} else {
+			/* Translate implementation defined characters */
+			if (usChar >= 0x80 && usChar <= 0x9f) {
+				usChar = usCp1252[usChar - 0x80];
+			}
+		}
+	}
+
+	/* Microsoft Unicode to real Unicode */
+	if (usChar >= 0xf020 && usChar <= 0xf0ff) {
+		DBG_HEX_C(usPrivateArea[usChar - 0xf020] == 0x003f, usChar);
+		usChar = usPrivateArea[usChar - 0xf020];
+	}
+
+	/* Characters with a special meaning in Word */
+	switch (usChar) {
+	case IGNORE_CHARACTER:
+	case FOOTNOTE_SEPARATOR:
+	case FOOTNOTE_CONTINUATION:
+	case ANNOTATION:
+	case FRAME:
+	case LINE_FEED:
+	case WORD_SOFT_HYPHEN:
+	case UNICODE_HYPHENATION_POINT:
+		return IGNORE_CHARACTER;
+	case PICTURE:
+	case TABLE_SEPARATOR:
+	case TAB:
+	case HARD_RETURN:
+	case PAGE_BREAK:
+	case PAR_END:
+	case COLUMN_FEED:
+		return (ULONG)usChar;
+	case FOOTNOTE_OR_ENDNOTE:
+		NO_DBG_HEX(ulFileOffset);
+		switch (eGetNotetype(ulFileOffset)) {
+		case notetype_is_footnote:
+			return FOOTNOTE_CHAR;
+		case notetype_is_endnote:
+			return ENDNOTE_CHAR;
+		default:
+			return UNKNOWN_NOTE_CHAR;
+		}
+	case WORD_UNBREAKABLE_JOIN:
+		return (ULONG)OUR_UNBREAKABLE_JOIN;
+	default:
+		break;
+	}
+
+	if (eEncoding != encoding_utf8) {
+		/* Latin characters in an oriental text */
+		if (usChar >= 0xff01 && usChar <= 0xff5e) {
+			usChar -= 0xfee0;
+		}
+	}
+
+	if (eConversionType == conversion_ps &&
+	    eEncoding == encoding_iso_8859_1) {
+		switch (usChar) {
+		case UNICODE_ELLIPSIS:
+			return 140;
+		case UNICODE_TRADEMARK_SIGN:
+			return 141;
+		case UNICODE_PER_MILLE_SIGN:
+			return 142;
+		case UNICODE_BULLET:
+		case UNICODE_BLACK_CLUB_SUIT:
+			return (ULONG)(UCHAR)OUR_BULLET_PS;
+		case UNICODE_LEFT_SINGLE_QMARK:
+			return 144;
+		case UNICODE_RIGHT_SINGLE_QMARK:
+			return 145;
+		case UNICODE_SINGLE_LEFT_ANGLE_QMARK:
+			return 146;
+		case UNICODE_SINGLE_RIGHT_ANGLE_QMARK:
+			return 147;
+		case UNICODE_LEFT_DOUBLE_QMARK:
+			return 148;
+		case UNICODE_RIGHT_DOUBLE_QMARK:
+			return 149;
+		case UNICODE_DOUBLE_LOW_9_QMARK:
+			return 150;
+		case UNICODE_EN_DASH:
+			return 151;
+		case UNICODE_EM_DASH:
+			return 152;
+		case UNICODE_MINUS_SIGN:
+			return 153;
+		case UNICODE_CAPITAL_LIGATURE_OE:
+			return 154;
+		case UNICODE_SMALL_LIGATURE_OE:
+			return 155;
+		case UNICODE_DAGGER:
+			return 156;
+		case UNICODE_DOUBLE_DAGGER:
+			return 157;
+		case UNICODE_SMALL_LIGATURE_FI:
+			return 158;
+		case UNICODE_SMALL_LIGATURE_FL:
+			return 159;
+		default:
+			break;
+		}
+	}
+
+	if (usChar < 0x80) {
+		/* US ASCII */
+		if (usChar < 0x20 || usChar == 0x7f) {
+			/* Ignore control characters */
+			DBG_HEX(usChar);
+			DBG_FIXME();
+			return IGNORE_CHARACTER;
+		}
+		return (ULONG)usChar;
+	}
+
+	if (eEncoding == encoding_utf8) {
+		/* No need to convert Unicode characters */
+		return (ULONG)usChar;
+	}
+
+	/* Unicode to local representation */
+	pTmp = pGetCharTableRecord(usChar);
+	if (pTmp != NULL) {
+		DBG_HEX_C(usChar >= 0x7f && usChar <= 0x9f, usChar);
+		return (ULONG)pTmp->usLocal;
+	}
+
+	/* Fancy characters to simple US ASCII */
+	switch (usChar) {
+	case UNICODE_SMALL_F_HOOK:
+		return (ULONG)'f';
+	case UNICODE_GREEK_CAPITAL_CHI:
+		return (ULONG)'X';
+	case UNICODE_GREEK_SMALL_UPSILON:
+		return (ULONG)'v';
+	case UNICODE_MODIFIER_CIRCUMFLEX:
+	case UNICODE_UPWARDS_ARROW:
+		return (ULONG)'^';
+	case UNICODE_SMALL_TILDE:
+	case UNICODE_TILDE_OPERATOR:
+		return (ULONG)'~';
+	case UNICODE_EN_QUAD:
+	case UNICODE_EM_QUAD:
+	case UNICODE_EN_SPACE:
+	case UNICODE_EM_SPACE:
+	case UNICODE_THREE_PER_EM_SPACE:
+	case UNICODE_FOUR_PER_EM_SPACE:
+	case UNICODE_SIX_PER_EM_SPACE:
+	case UNICODE_FIGURE_SPACE:
+	case UNICODE_PUNCTUATION_SPACE:
+	case UNICODE_THIN_SPACE:
+	case UNICODE_LIGHT_SHADE:
+	case UNICODE_MEDIUM_SHADE:
+	case UNICODE_DARK_SHADE:
+		return (ULONG)' ';
+	case UNICODE_LEFT_DOUBLE_QMARK:
+	case UNICODE_RIGHT_DOUBLE_QMARK:
+	case UNICODE_DOUBLE_LOW_9_QMARK:
+	case UNICODE_DOUBLE_HIGH_REV_9_QMARK:
+	case UNICODE_DOUBLE_PRIME:
+		return (ULONG)'"';
+	case UNICODE_LEFT_SINGLE_QMARK:
+	case UNICODE_RIGHT_SINGLE_QMARK:
+	case UNICODE_SINGLE_LOW_9_QMARK:
+	case UNICODE_SINGLE_HIGH_REV_9_QMARK:
+	case UNICODE_PRIME:
+		return (ULONG)'\'';
+	case UNICODE_HYPHEN:
+	case UNICODE_NON_BREAKING_HYPHEN:
+	case UNICODE_FIGURE_DASH:
+	case UNICODE_EN_DASH:
+	case UNICODE_EM_DASH:
+	case UNICODE_HORIZONTAL_BAR:
+	case UNICODE_MINUS_SIGN:
+	case UNICODE_BD_LIGHT_HORIZONTAL:
+	case UNICODE_BD_DOUBLE_HORIZONTAL:
+		return (ULONG)'-';
+	case UNICODE_DOUBLE_VERTICAL_LINE:
+	case UNICODE_BD_LIGHT_VERTICAL:
+	case UNICODE_BD_DOUBLE_VERTICAL:
+		return (ULONG)'|';
+	case UNICODE_DOUBLE_LOW_LINE:
+		return (ULONG)'_';
+	case UNICODE_DAGGER:
+		return (ULONG)'+';
+	case UNICODE_DOUBLE_DAGGER:
+		return (ULONG)'#';
+	case UNICODE_BULLET:
+	case UNICODE_BLACK_CLUB_SUIT:
+		return (ULONG)OUR_BULLET_TEXT;
+	case UNICODE_ONE_DOT_LEADER:
+		return (ULONG)'.';
+	case UNICODE_ELLIPSIS:
+		return (ULONG)OUR_ELLIPSIS;
+	case UNICODE_TRIANGULAR_BULLET:
+	case UNICODE_SINGLE_LEFT_ANGLE_QMARK:
+	case UNICODE_LEFTWARDS_ARROW:
+		return (ULONG)'<';
+	case UNICODE_SINGLE_RIGHT_ANGLE_QMARK:
+	case UNICODE_RIGHTWARDS_ARROW:
+		return (ULONG)'>';
+	case UNICODE_UNDERTIE:
+		return (ULONG)'-';
+	case UNICODE_N_ARY_SUMMATION:
+		return (ULONG)'S';
+	case UNICODE_EURO_SIGN:
+		return (ULONG)'E';
+	case UNICODE_CIRCLE:
+	case UNICODE_SQUARE:
+		return (ULONG)'O';
+	case UNICODE_DIAMOND:
+		return (ULONG)OUR_DIAMOND;
+	case UNICODE_KELVIN_SIGN:
+		return (ULONG)'K';
+	case UNICODE_DOWNWARDS_ARROW:
+		return (ULONG)'v';
+	case UNICODE_FRACTION_SLASH:
+	case UNICODE_DIVISION_SLASH:
+		return (ULONG)'/';
+	case UNICODE_ASTERISK_OPERATOR:
+		return (ULONG)'*';
+	case UNICODE_RATIO:
+		return (ULONG)':';
+	case UNICODE_BD_LIGHT_DOWN_RIGHT:
+	case UNICODE_BD_LIGHT_DOWN_AND_LEFT:
+	case UNICODE_BD_LIGHT_UP_AND_RIGHT:
+	case UNICODE_BD_LIGHT_UP_AND_LEFT:
+	case UNICODE_BD_LIGHT_VERTICAL_AND_RIGHT:
+	case UNICODE_BD_LIGHT_VERTICAL_AND_LEFT:
+	case UNICODE_BD_LIGHT_DOWN_AND_HORIZONTAL:
+	case UNICODE_BD_LIGHT_UP_AND_HORIZONTAL:
+	case UNICODE_BD_LIGHT_VERTICAL_AND_HORIZONTAL:
+	case UNICODE_BD_DOUBLE_DOWN_AND_RIGHT:
+	case UNICODE_BD_DOUBLE_DOWN_AND_LEFT:
+	case UNICODE_BD_DOUBLE_UP_AND_RIGHT:
+	case UNICODE_BD_DOUBLE_UP_AND_LEFT:
+	case UNICODE_BD_DOUBLE_VERTICAL_AND_RIGHT:
+	case UNICODE_BD_DOUBLE_VERTICAL_AND_LEFT:
+	case UNICODE_BD_DOUBLE_DOWN_AND_HORIZONTAL:
+	case UNICODE_BD_DOUBLE_UP_AND_HORIZONTAL:
+	case UNICODE_BD_DOUBLE_VERTICAL_AND_HORIZONTAL:
+	case UNICODE_BLACK_SQUARE:
+		return (ULONG)'+';
+	case UNICODE_HAIR_SPACE:
+	case UNICODE_ZERO_WIDTH_SPACE:
+	case UNICODE_ZERO_WIDTH_NON_JOINER:
+	case UNICODE_ZERO_WIDTH_JOINER:
+	case UNICODE_LEFT_TO_RIGHT_MARK:
+	case UNICODE_RIGHT_TO_LEFT_MARK:
+	case UNICODE_LEFT_TO_RIGHT_EMBEDDING:
+	case UNICODE_RIGHT_TO_LEFT_EMBEDDING:
+		return IGNORE_CHARACTER;
+	default:
+		break;
+	}
+
+	if (usChar == UNICODE_TRADEMARK_SIGN) {
+		/*
+		 * No local representation, it doesn't look like anything in
+		 * US-ASCII and a question mark does more harm than good.
+		 */
+		return IGNORE_CHARACTER;
+	}
+
+	if (usChar >= 0xa0 && usChar <= 0xff) {
+		/* Before Word 97, Word did't use Unicode */
+		return (ULONG)usChar;
+	}
+
+	DBG_HEX_C(usChar < 0x3000 || usChar >= 0xd800, ulFileOffset);
+	DBG_HEX_C(usChar < 0x3000 || usChar >= 0xd800, usChar);
+	DBG_MSG_C(usChar >= 0xe000 && usChar < 0xf900, "Private Use Area");
+
+	/* Untranslated Unicode character */
+	return 0x3f;
+} /* end of ulTranslateCharacters */
+
+/*
+ * ulToUpper - convert letter to upper case
+ *
+ * This function converts a letter to upper case. Unlike toupper(3) this
+ * function is independent from the settings of locale. This comes in handy
+ * for people who have to read Word documents in more than one language or
+ * contain more than one language.
+ *
+ * returns the converted letter, or ulChar if the conversion was not possible.
+ */
+ULONG
+ulToUpper(ULONG ulChar)
+{
+	if (ulChar < 0x80) {
+		/* US ASCII: use standard function */
+		return (ULONG)toupper((int)ulChar);
+	}
+	if (ulChar >= 0xe0 && ulChar <= 0xfe && ulChar != 0xf7) {
+		/*
+		 * Lower case accented characters
+		 * 0xf7 is Division sign; 0xd7 is Multiplication sign
+		 * 0xff is y with diaeresis; 0xdf is Sharp s
+		 */
+		return ulChar & ~0x20;
+	}
+#if defined(__STDC_ISO_10646__)
+	/*
+	 * If this is ISO C99 and all locales have wchar_t = ISO 10646
+	 * (e.g., glibc 2.2 or newer), then use standard function
+	 */
+	if (ulChar > 0xff) {
+		return (ULONG)towupper((wint_t)ulChar);
+	}
+#endif /* __STDC_ISO_10646__ */
+	return ulChar;
+} /* end of ulToUpper */

+ 374 - 0
sys/src/cmd/aux/antiword/datalist.c

@@ -0,0 +1,374 @@
+/*
+ * datalist.c
+ * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy a list of Word data blocks
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include "antiword.h"
+
+#if defined(__riscos)
+#define EIO		42
+#endif /* __riscos */
+
+
+/*
+ * Private structure to hide the way the information
+ * is stored from the rest of the program
+ */
+typedef struct data_mem_tag {
+	data_block_type		tInfo;
+	struct data_mem_tag	*pNext;
+} data_mem_type;
+
+/* Variable to describe the start of the data block list */
+static data_mem_type	*pAnchor = NULL;
+/* Variable needed to read the data block list */
+static data_mem_type	*pBlockLast = NULL;
+/* Variable needed to read the data block list */
+static data_mem_type	*pBlockCurrent = NULL;
+static ULONG	ulBlockOffset = 0;
+static size_t	tByteNext = 0;
+/* Last block read */
+static UCHAR	aucBlock[BIG_BLOCK_SIZE];
+
+
+/*
+ * vDestroyDataBlockList - destroy the data block list
+ */
+void
+vDestroyDataBlockList(void)
+{
+	data_mem_type	*pCurr, *pNext;
+
+	DBG_MSG("vDestroyDataBlockList");
+
+	pCurr = pAnchor;
+	while (pCurr != NULL) {
+		pNext = pCurr->pNext;
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+	}
+	pAnchor = NULL;
+	/* Reset all the control variables */
+	pBlockLast = NULL;
+	pBlockCurrent = NULL;
+	ulBlockOffset = 0;
+	tByteNext = 0;
+} /* end of vDestroyDataBlockList */
+
+/*
+ * bAdd2DataBlockList - add an element to the data block list
+ *
+ * Returns TRUE when successful, otherwise FALSE
+ */
+BOOL
+bAdd2DataBlockList(const data_block_type *pDataBlock)
+{
+	data_mem_type	*pListMember;
+
+	fail(pDataBlock == NULL);
+	fail(pDataBlock->ulFileOffset == FC_INVALID);
+	fail(pDataBlock->ulDataPos == CP_INVALID);
+	fail(pDataBlock->ulLength == 0);
+
+	NO_DBG_MSG("bAdd2DataBlockList");
+	NO_DBG_HEX(pDataBlock->ulFileOffset);
+	NO_DBG_HEX(pDataBlock->ulDataPos);
+	NO_DBG_HEX(pDataBlock->ulLength);
+
+	if (pDataBlock->ulFileOffset == FC_INVALID ||
+	    pDataBlock->ulDataPos == CP_INVALID ||
+	    pDataBlock->ulLength == 0) {
+		werr(0, "Software (datablock) error");
+		return FALSE;
+	}
+	/* Check for continuous blocks */
+	if (pBlockLast != NULL &&
+	    pBlockLast->tInfo.ulFileOffset +
+	     pBlockLast->tInfo.ulLength == pDataBlock->ulFileOffset &&
+	    pBlockLast->tInfo.ulDataPos +
+	     pBlockLast->tInfo.ulLength == pDataBlock->ulDataPos) {
+		/* These are continous blocks */
+		pBlockLast->tInfo.ulLength += pDataBlock->ulLength;
+		return TRUE;
+	}
+	/* Make a new block */
+	pListMember = xmalloc(sizeof(data_mem_type));
+	/* Add the block to the data list */
+	pListMember->tInfo = *pDataBlock;
+	pListMember->pNext = NULL;
+	if (pAnchor == NULL) {
+		pAnchor = pListMember;
+	} else {
+		fail(pBlockLast == NULL);
+		pBlockLast->pNext = pListMember;
+	}
+	pBlockLast = pListMember;
+	return TRUE;
+} /* end of bAdd2DataBlockList */
+
+/*
+ * ulGetDataOffset - get the offset in the data block list
+ *
+ * Get the fileoffset the current position in the data block list
+ */
+ULONG
+ulGetDataOffset(FILE *pFile)
+{
+	return pBlockCurrent->tInfo.ulFileOffset + ulBlockOffset + tByteNext;
+} /* end of ulGetDataOffset */
+
+/*
+ * bSetDataOffset - set the offset in the data block list
+ *
+ * Make the given fileoffset the current position in the data block list
+ */
+BOOL
+bSetDataOffset(FILE *pFile, ULONG ulFileOffset)
+{
+	data_mem_type	*pCurr;
+	size_t	tReadLen;
+
+	DBG_HEX(ulFileOffset);
+
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (ulFileOffset < pCurr->tInfo.ulFileOffset ||
+		    ulFileOffset >= pCurr->tInfo.ulFileOffset +
+		     pCurr->tInfo.ulLength) {
+			/* The file offset is not in this block */
+			continue;
+		}
+		/* Compute the maximum number of bytes to read */
+		tReadLen = (size_t)(pCurr->tInfo.ulFileOffset +
+				pCurr->tInfo.ulLength -
+				ulFileOffset);
+		/* Compute the real number of bytes to read */
+		if (tReadLen > sizeof(aucBlock)) {
+			tReadLen = sizeof(aucBlock);
+		}
+		/* Read the bytes */
+		if (!bReadBytes(aucBlock, tReadLen, ulFileOffset, pFile)) {
+			return FALSE;
+		}
+		/* Set the control variables */
+		pBlockCurrent = pCurr;
+		ulBlockOffset = ulFileOffset - pCurr->tInfo.ulFileOffset;
+		tByteNext = 0;
+		return TRUE;
+	}
+	return FALSE;
+} /* end of bSetDataOffset */
+
+/*
+ * iNextByte - get the next byte from the data block list
+ */
+int
+iNextByte(FILE *pFile)
+{
+	ULONG	ulReadOff;
+	size_t	tReadLen;
+
+	fail(pBlockCurrent == NULL);
+
+	if (tByteNext >= sizeof(aucBlock) ||
+	    ulBlockOffset + tByteNext >= pBlockCurrent->tInfo.ulLength) {
+		if (ulBlockOffset + sizeof(aucBlock) <
+					pBlockCurrent->tInfo.ulLength) {
+			/* Same block, next part */
+			ulBlockOffset += sizeof(aucBlock);
+		} else {
+			/* Next block, first part */
+			pBlockCurrent = pBlockCurrent->pNext;
+			ulBlockOffset = 0;
+		}
+		if (pBlockCurrent == NULL) {
+			/* Past the last part of the last block */
+			errno = EIO;
+			return EOF;
+		}
+		tReadLen = (size_t)
+				(pBlockCurrent->tInfo.ulLength - ulBlockOffset);
+		if (tReadLen > sizeof(aucBlock)) {
+			tReadLen = sizeof(aucBlock);
+		}
+		ulReadOff = pBlockCurrent->tInfo.ulFileOffset + ulBlockOffset;
+		if (!bReadBytes(aucBlock, tReadLen, ulReadOff, pFile)) {
+			errno = EIO;
+			return EOF;
+		}
+		tByteNext = 0;
+	}
+	return (int)aucBlock[tByteNext++];
+} /* end of iNextByte */
+
+/*
+ * usNextWord - get the next word from the data block list
+ *
+ * Read a two byte value in Little Endian order, that means MSB last
+ *
+ * All return values can be valid so errno is set in case of error
+ */
+USHORT
+usNextWord(FILE *pFile)
+{
+	USHORT	usLSB, usMSB;
+
+	usLSB = (USHORT)iNextByte(pFile);
+	if (usLSB == (USHORT)EOF) {
+		errno = EIO;
+		return (USHORT)EOF;
+	}
+	usMSB = (USHORT)iNextByte(pFile);
+	if (usMSB == (USHORT)EOF) {
+		DBG_MSG("usNextWord: Unexpected EOF");
+		errno = EIO;
+		return (USHORT)EOF;
+	}
+	return (usMSB << 8) | usLSB;
+} /* end of usNextWord */
+
+/*
+ * ulNextLong - get the next long from the data block list
+ *
+ * Read a four byte value in Little Endian order, that means MSW last
+ *
+ * All return values can be valid so errno is set in case of error
+ */
+ULONG
+ulNextLong(FILE *pFile)
+{
+	ULONG	ulLSW, ulMSW;
+
+	ulLSW = (ULONG)usNextWord(pFile);
+	if (ulLSW == (ULONG)EOF) {
+		errno = EIO;
+		return (ULONG)EOF;
+	}
+	ulMSW = (ULONG)usNextWord(pFile);
+	if (ulMSW == (ULONG)EOF) {
+		DBG_MSG("ulNextLong: Unexpected EOF");
+		errno = EIO;
+		return (ULONG)EOF;
+	}
+	return (ulMSW << 16) | ulLSW;
+} /* end of ulNextLong */
+
+/*
+ * usNextWordBE - get the next two byte value
+ *
+ * Read a two byte value in Big Endian order, that means MSB first
+ *
+ * All return values can be valid so errno is set in case of error
+ */
+USHORT
+usNextWordBE(FILE *pFile)
+{
+	USHORT usLSB, usMSB;
+
+	usMSB = (USHORT)iNextByte(pFile);
+	if (usMSB == (USHORT)EOF) {
+		errno = EIO;
+		return (USHORT)EOF;
+	}
+	usLSB = (USHORT)iNextByte(pFile);
+	if (usLSB == (USHORT)EOF) {
+		DBG_MSG("usNextWordBE: Unexpected EOF");
+		errno = EIO;
+		return (USHORT)EOF;
+	}
+	return (usMSB << 8) | usLSB;
+} /* end of usNextWordBE */
+
+/*
+ * ulNextLongBE - get the next four byte value
+ *
+ * Read a four byte value in Big Endian order, that means MSW first
+ *
+ * All return values can be valid so errno is set in case of error
+ */
+ULONG
+ulNextLongBE(FILE *pFile)
+{
+	ULONG	ulLSW, ulMSW;
+
+	ulMSW = (ULONG)usNextWordBE(pFile);
+	if (ulMSW == (ULONG)EOF) {
+		errno = EIO;
+		return (ULONG)EOF;
+	}
+	ulLSW = (ULONG)usNextWordBE(pFile);
+	if (ulLSW == (ULONG)EOF) {
+		DBG_MSG("ulNextLongBE: Unexpected EOF");
+		errno = EIO;
+		return (ULONG)EOF;
+	}
+	return (ulMSW << 16) | ulLSW;
+} /* end of ulNextLongBE */
+
+/*
+ * tSkipBytes - skip over the given number of bytes
+ *
+ * Returns the number of skipped bytes
+ */
+size_t
+tSkipBytes(FILE *pFile, size_t tToSkip)
+{
+	size_t	tToGo, tMaxMove, tMove;
+
+	fail(pFile == NULL);
+	fail(pBlockCurrent == NULL);
+
+	tToGo = tToSkip;
+	while (tToGo != 0) {
+		/* Goto the end of the current block */
+		tMaxMove = min(sizeof(aucBlock) - tByteNext,
+				(size_t)(pBlockCurrent->tInfo.ulLength -
+				ulBlockOffset - tByteNext));
+		tMove = min(tMaxMove, tToGo);
+		tByteNext += tMove;
+		tToGo -= tMove;
+		if (tToGo != 0) {
+			/* Goto the next block */
+			if (iNextByte(pFile) == EOF) {
+				return tToSkip - tToGo;
+			}
+			tToGo--;
+		}
+	}
+	return tToSkip;
+} /* end of tSkipBytes */
+
+/*
+ * Translate  a data position to an offset in the file.
+ * Logical to physical offset.
+ *
+ * Returns:	FC_INVALID: in case of error
+ *		otherwise: the computed file offset
+ */
+ULONG
+ulDataPos2FileOffset(ULONG ulDataPos)
+{
+	data_mem_type	*pCurr;
+
+	fail(ulDataPos == CP_INVALID);
+
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (ulDataPos < pCurr->tInfo.ulDataPos ||
+		    ulDataPos >= pCurr->tInfo.ulDataPos +
+		     pCurr->tInfo.ulLength) {
+			/* The data offset is not in this block, try the next */
+			continue;
+		}
+		/* The data offset is in the current block */
+		return pCurr->tInfo.ulFileOffset +
+				ulDataPos -
+				pCurr->tInfo.ulDataPos;
+	}
+	/* Passed beyond the end of the list */
+	DBG_HEX_C(ulDataPos != 0, ulDataPos);
+	return FC_INVALID;
+} /* end of ulDataPos2FileOffset */

+ 102 - 0
sys/src/cmd/aux/antiword/debug.h

@@ -0,0 +1,102 @@
+/*
+ * debug.h
+ * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Macro's for debuging.
+ */
+
+#if !defined(__debug_h)
+#define __debug_h 1
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if defined(DEBUG)
+
+#define DBG_MSG(t)	(void)fprintf(stderr,\
+				"%s[%3d]: %.240s\n",\
+				__FILE__, __LINE__, (t))
+
+#define DBG_STRN(t,m)	(void)fprintf(stderr,\
+				"%s[%3d]: %d '%.*s'\n",\
+				__FILE__, __LINE__,\
+				(int)(m), (int)(m), (const char *)(t))
+
+#define DBG_CHR(m)    (void)fprintf(stderr,\
+				"%s[%3d]: "#m" = %3d 0x%02x '%c'\n",\
+				__FILE__, __LINE__,\
+				(int)(m), (unsigned int)(unsigned char)(m),\
+				isprint((int)(unsigned char)(m))?(char)(m):' ')
+
+#define DBG_DEC(m)	(void)fprintf(stderr,\
+				"%s[%3d]: "#m" = %ld\n",\
+				__FILE__, __LINE__, (long)(m))
+
+#define DBG_HEX(m)	(void)fprintf(stderr,\
+				"%s[%3d]: "#m" = 0x%02lx\n",\
+				__FILE__, __LINE__, (unsigned long)(m))
+
+#define DBG_FLT(m)	(void)fprintf(stderr,\
+				"%s[%3d]: "#m" = %.3f\n",\
+				__FILE__, __LINE__, (double)(m))
+
+#define DBG_FIXME()	(void)fprintf(stderr,\
+				"%s[%3d]: FIXME\n",\
+				__FILE__, __LINE__)
+
+#define DBG_PRINT_BLOCK(b,m)	vPrintBlock(__FILE__, __LINE__,(b),(m))
+#define DBG_UNICODE(t)		vPrintUnicode(__FILE__, __LINE__,\
+					(const UCHAR *)(t),unilen(t))
+#define DBG_UNICODE_N(t,m)	vPrintUnicode(__FILE__, __LINE__,\
+					(const UCHAR *)(t),(m))
+
+#define DBG_MSG_C(c,t)		do { if (c) DBG_MSG(t); } while(0)
+#define DBG_STRN_C(c,t,m)	do { if (c) DBG_STRN(t,m); } while(0)
+#define DBG_CHR_C(c,m)		do { if (c) DBG_CHR(m); } while(0)
+#define DBG_DEC_C(c,m)		do { if (c) DBG_DEC(m); } while(0)
+#define DBG_HEX_C(c,m)		do { if (c) DBG_HEX(m); } while(0)
+#define DBG_FLT_C(c,m)		do { if (c) DBG_FLT(m); } while(0)
+
+#else
+
+#define DBG_MSG(t)		/* EMPTY */
+#define DBG_STRN(t,m)		/* EMPTY */
+#define DBG_CHR(m)		/* EMPTY */
+#define DBG_DEC(m)		/* EMPTY */
+#define DBG_HEX(m)		/* EMPTY */
+#define DBG_FLT(m)		/* EMPTY */
+
+#define DBG_FIXME()		/* EMPTY */
+#define DBG_PRINT_BLOCK(b,m)	/* EMPTY */
+#define DBG_UNICODE(t)		/* EMPTY */
+#define DBG_UNICODE_N(t,m)	/* EMPTY */
+
+#define DBG_MSG_C(c,t)		/* EMPTY */
+#define DBG_STRN_C(c,t,m)	/* EMPTY */
+#define DBG_CHR_C(c,m)		/* EMPTY */
+#define DBG_DEC_C(c,m)		/* EMPTY */
+#define DBG_HEX_C(c,m)		/* EMPTY */
+#define DBG_FLT_C(c,m)		/* EMPTY */
+
+#endif /* DEBUG */
+
+#define NO_DBG_MSG(t)		/* EMPTY */
+#define NO_DBG_STRN(t,m)	/* EMPTY */
+#define NO_DBG_CHR(m)		/* EMPTY */
+#define NO_DBG_DEC(m)		/* EMPTY */
+#define NO_DBG_HEX(m)		/* EMPTY */
+#define NO_DBG_FLT(m)		/* EMPTY */
+
+#define NO_DBG_PRINT_BLOCK(b,m)	/* EMPTY */
+#define NO_DBG_UNICODE(t)	/* EMPTY */
+#define NO_DBG_UNICODE_N(t,m)	/* EMPTY */
+
+#define NO_DBG_MSG_C(c,t)	/* EMPTY */
+#define NO_DBG_STRN_C(c,t,m)	/* EMPTY */
+#define NO_DBG_CHR_C(c,m)	/* EMPTY */
+#define NO_DBG_DEC_C(c,m)	/* EMPTY */
+#define NO_DBG_HEX_C(c,m)	/* EMPTY */
+#define NO_DBG_FLT_C(c,m)	/* EMPTY */
+
+#endif /* !__debug_h */

+ 114 - 0
sys/src/cmd/aux/antiword/depot.c

@@ -0,0 +1,114 @@
+/*
+ * depot.c
+ * Copyright (C) 1998-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to compute the depot offset
+ */
+
+#include "antiword.h"
+
+#define SIZE_RATIO	(BIG_BLOCK_SIZE/SMALL_BLOCK_SIZE)
+
+static ULONG	*aulSmallBlockList = NULL;
+static size_t	tSmallBlockListLen = 0;
+
+
+/*
+ * vDestroySmallBlockList - destroy the small block list
+ */
+void
+vDestroySmallBlockList(void)
+{
+	DBG_MSG("vDestroySmallBlockList");
+
+	aulSmallBlockList = xfree(aulSmallBlockList);
+	tSmallBlockListLen = 0;
+} /* end of vDestroySmalBlockList */
+
+/*
+ * vCreateSmallBlockList - create the small block list
+ *
+ * returns: TRUE when successful, otherwise FALSE
+ */
+BOOL
+bCreateSmallBlockList(ULONG ulStartblock, const ULONG *aulBBD, size_t tBBDLen)
+{
+	ULONG	ulTmp;
+	size_t	tSize;
+	int	iIndex;
+
+	fail(aulSmallBlockList != NULL);
+	fail(tSmallBlockListLen != 0);
+	fail(ulStartblock > MAX_BLOCKNUMBER && ulStartblock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+	fail(tBBDLen == 0);
+
+	/* Find the length of the small block list */
+	for (tSmallBlockListLen = 0, ulTmp = ulStartblock;
+	     tSmallBlockListLen < tBBDLen && ulTmp != END_OF_CHAIN;
+	     tSmallBlockListLen++, ulTmp = aulBBD[ulTmp]) {
+		if (ulTmp >= (ULONG)tBBDLen) {
+			DBG_DEC(ulTmp);
+			DBG_DEC(tBBDLen);
+			werr(1, "The Big Block Depot is damaged");
+		}
+	}
+	DBG_DEC(tSmallBlockListLen);
+
+	if (tSmallBlockListLen == 0) {
+		/* There is no small block list */
+		fail(ulStartblock != END_OF_CHAIN);
+		aulSmallBlockList = NULL;
+		return TRUE;
+	}
+
+	/* Create the small block list */
+	tSize = tSmallBlockListLen * sizeof(ULONG);
+	aulSmallBlockList = xmalloc(tSize);
+	for (iIndex = 0, ulTmp = ulStartblock;
+	     iIndex < (int)tBBDLen && ulTmp != END_OF_CHAIN;
+	     iIndex++, ulTmp = aulBBD[ulTmp]) {
+		if (ulTmp >= (ULONG)tBBDLen) {
+			DBG_DEC(ulTmp);
+			DBG_DEC(tBBDLen);
+			werr(1, "The Big Block Depot is damaged");
+		}
+		aulSmallBlockList[iIndex] = ulTmp;
+		NO_DBG_DEC(aulSmallBlockList[iIndex]);
+	}
+	return TRUE;
+} /* end of bCreateSmallBlockList */
+
+/*
+ * ulDepotOffset - get the depot offset the block list
+ */
+ULONG
+ulDepotOffset(ULONG ulIndex, size_t tBlockSize)
+{
+	ULONG	ulTmp;
+	size_t	tTmp;
+
+	fail(ulIndex >= ULONG_MAX / BIG_BLOCK_SIZE);
+
+	switch (tBlockSize) {
+	case BIG_BLOCK_SIZE:
+		return (ulIndex + 1) * BIG_BLOCK_SIZE;
+	case SMALL_BLOCK_SIZE:
+		tTmp = (size_t)(ulIndex / SIZE_RATIO);
+		ulTmp = ulIndex % SIZE_RATIO;
+		if (aulSmallBlockList == NULL ||
+		    tTmp >= tSmallBlockListLen) {
+			DBG_HEX(aulSmallBlockList);
+			DBG_DEC(tSmallBlockListLen);
+			DBG_DEC(tTmp);
+			return 0;
+		}
+		return ((aulSmallBlockList[tTmp] + 1) * SIZE_RATIO +
+				ulTmp) * SMALL_BLOCK_SIZE;
+	default:
+		DBG_DEC(tBlockSize);
+		DBG_FIXME();
+		return 0;
+	}
+} /* end of ulDepotOffset */

+ 509 - 0
sys/src/cmd/aux/antiword/dib2eps.c

@@ -0,0 +1,509 @@
+/*
+ * dib2eps.c
+ * Copyright (C) 2000-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to translate dib pictures into eps
+ *
+ *================================================================
+ * This part of the software is based on:
+ * The Windows Bitmap Decoder Class part of paintlib
+ * Paintlib is copyright (c) 1996-2000 Ulrich von Zadow
+ *================================================================
+ * The credit should go to him, but all the bugs are mine.
+ */
+
+#include <stdio.h>
+#include "antiword.h"
+
+
+/*
+ * vDecode1bpp - decode an uncompressed 1 bit per pixel image
+ */
+static void
+vDecode1bpp(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	size_t	tPadding;
+	int	iX, iY, iN, iByte, iTmp, iEighthWidth, iUse;
+
+	DBG_MSG("vDecode1bpp");
+
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 2);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	iEighthWidth = (pImg->iWidth + 7) / 8;
+	tPadding = (size_t)(ROUND4(iEighthWidth) - iEighthWidth);
+
+	for (iY = 0; iY < pImg->iHeight; iY++) {
+		for (iX = 0; iX < iEighthWidth; iX++) {
+			iByte = iNextByte(pInFile);
+			if (iByte == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			if (iX == iEighthWidth - 1 && pImg->iWidth % 8 != 0) {
+				iUse = pImg->iWidth % 8;
+			} else {
+				iUse = 8;
+			}
+			for (iN = 0; iN < iUse; iN++) {
+				switch (iN) {
+				case 0: iTmp = (iByte & 0x80) / 128; break;
+				case 1: iTmp = (iByte & 0x40) / 64; break;
+				case 2: iTmp = (iByte & 0x20) / 32; break;
+				case 3: iTmp = (iByte & 0x10) / 16; break;
+				case 4: iTmp = (iByte & 0x08) / 8; break;
+				case 5: iTmp = (iByte & 0x04) / 4; break;
+				case 6: iTmp = (iByte & 0x02) / 2; break;
+				case 7: iTmp = (iByte & 0x01); break;
+				default: iTmp = 0; break;
+				}
+				vASCII85EncodeByte(pOutFile, iTmp);
+			}
+		}
+		(void)tSkipBytes(pInFile, tPadding);
+	}
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vDecode1bpp */
+
+/*
+ * vDecode4bpp - decode an uncompressed 4 bits per pixel image
+ */
+static void
+vDecode4bpp(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	size_t	tPadding;
+	int	iX, iY, iN, iByte, iTmp, iHalfWidth, iUse;
+
+	DBG_MSG("vDecode4bpp");
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 16);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	iHalfWidth = (pImg->iWidth + 1) / 2;
+	tPadding = (size_t)(ROUND4(iHalfWidth) - iHalfWidth);
+
+	for (iY = 0; iY < pImg->iHeight; iY++) {
+		for (iX = 0; iX < iHalfWidth; iX++) {
+			iByte = iNextByte(pInFile);
+			if (iByte == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			if (iX == iHalfWidth - 1 && odd(pImg->iWidth)) {
+				iUse = 1;
+			} else {
+				iUse = 2;
+			}
+			for (iN = 0; iN < iUse; iN++) {
+				if (odd(iN)) {
+					iTmp = iByte & 0x0f;
+				} else {
+					iTmp = (iByte & 0xf0) / 16;
+				}
+				vASCII85EncodeByte(pOutFile, iTmp);
+			}
+		}
+		(void)tSkipBytes(pInFile, tPadding);
+	}
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vDecode4bpp */
+
+/*
+ * vDecode8bpp - decode an uncompressed 8 bits per pixel image
+ */
+static void
+vDecode8bpp(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	size_t	tPadding;
+	int	iX, iY, iByte;
+
+	DBG_MSG("vDecode8bpp");
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 256);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	tPadding = (size_t)(ROUND4(pImg->iWidth) - pImg->iWidth);
+
+	for (iY = 0; iY < pImg->iHeight; iY++) {
+		for (iX = 0; iX < pImg->iWidth; iX++) {
+			iByte = iNextByte(pInFile);
+			if (iByte == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			vASCII85EncodeByte(pOutFile, iByte);
+		}
+		(void)tSkipBytes(pInFile, tPadding);
+	}
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vDecode8bpp */
+
+/*
+ * vDecode24bpp - decode an uncompressed 24 bits per pixel image
+ */
+static void
+vDecode24bpp(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	size_t	tPadding;
+	int	iX, iY, iBlue, iGreen, iRed, iTripleWidth;
+
+	DBG_MSG("vDecode24bpp");
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(!pImg->bColorImage);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	iTripleWidth = pImg->iWidth * 3;
+	tPadding = (size_t)(ROUND4(iTripleWidth) - iTripleWidth);
+
+	for (iY = 0; iY < pImg->iHeight; iY++) {
+		for (iX = 0; iX < pImg->iWidth; iX++) {
+			/* Change from BGR order to RGB order */
+			iBlue = iNextByte(pInFile);
+			if (iBlue == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			iGreen = iNextByte(pInFile);
+			if (iGreen == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			iRed = iNextByte(pInFile);
+			if (iRed == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			vASCII85EncodeByte(pOutFile, iRed);
+			vASCII85EncodeByte(pOutFile, iGreen);
+			vASCII85EncodeByte(pOutFile, iBlue);
+		}
+		(void)tSkipBytes(pInFile, tPadding);
+	}
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vDecode24bpp */
+
+/*
+ * vDecodeRle4 - decode a RLE compressed 4 bits per pixel image
+ */
+static void
+vDecodeRle4(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	int	iX, iY, iByte, iTmp, iRunLength, iRun;
+	BOOL	bEOF, bEOL;
+
+	DBG_MSG("vDecodeRle4");
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 16);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	bEOF = FALSE;
+
+	for (iY =  0; iY < pImg->iHeight && !bEOF; iY++) {
+		bEOL = FALSE;
+		iX = 0;
+		while (!bEOL) {
+			iRunLength = iNextByte(pInFile);
+			if (iRunLength == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			if (iRunLength != 0) {
+				/*
+				 * Encoded packet:
+				 * RunLength pixels, all the "same" value
+				 */
+				iByte = iNextByte(pInFile);
+				if (iByte == EOF) {
+					vASCII85EncodeByte(pOutFile, EOF);
+					return;
+				}
+				for (iRun = 0; iRun < iRunLength; iRun++) {
+					if (odd(iRun)) {
+						iTmp = iByte & 0x0f;
+					} else {
+						iTmp = (iByte & 0xf0) / 16;
+					}
+					if (iX < pImg->iWidth) {
+						vASCII85EncodeByte(pOutFile, iTmp);
+					}
+					iX++;
+				}
+				continue;
+			}
+			/* Literal or escape */
+			iRunLength = iNextByte(pInFile);
+			if (iRunLength == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			if (iRunLength == 0) {		/* End of line escape */
+				bEOL = TRUE;
+			} else if (iRunLength == 1) {	/* End of file escape */
+				bEOF = TRUE;
+				bEOL = TRUE;
+			} else if (iRunLength == 2) {	/* Delta escape */
+				DBG_MSG("RLE4: encountered delta escape");
+				bEOF = TRUE;
+				bEOL = TRUE;
+			} else {			/* Literal packet */
+				iByte = 0;
+				for (iRun = 0; iRun < iRunLength; iRun++) {
+					if (odd(iRun)) {
+						iTmp = iByte & 0x0f;
+					} else {
+						iByte = iNextByte(pInFile);
+						if (iByte == EOF) {
+							vASCII85EncodeByte(pOutFile, EOF);
+							return;
+						}
+						iTmp = (iByte & 0xf0) / 16;
+					}
+					if (iX < pImg->iWidth) {
+						vASCII85EncodeByte(pOutFile, iTmp);
+					}
+					iX++;
+				}
+				/* Padding if the number of bytes is odd */
+				if (odd((iRunLength + 1) / 2)) {
+					(void)tSkipBytes(pInFile, 1);
+				}
+			}
+		}
+		DBG_DEC_C(iX != pImg->iWidth, iX);
+	}
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vDecodeRle4 */
+
+/*
+ * vDecodeRle8 - decode a RLE compressed 8 bits per pixel image
+ */
+static void
+vDecodeRle8(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	int	iX, iY, iByte, iRunLength, iRun;
+	BOOL	bEOF, bEOL;
+
+	DBG_MSG("vDecodeRle8");
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 256);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	bEOF = FALSE;
+
+	for (iY = 0; iY < pImg->iHeight && !bEOF; iY++) {
+		bEOL = FALSE;
+		iX = 0;
+		while (!bEOL) {
+			iRunLength = iNextByte(pInFile);
+			if (iRunLength == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			if (iRunLength != 0) {
+				/*
+				 * Encoded packet:
+				 * RunLength pixels, all the same value
+				 */
+				iByte = iNextByte(pInFile);
+				if (iByte == EOF) {
+					vASCII85EncodeByte(pOutFile, EOF);
+					return;
+				}
+				for (iRun = 0; iRun < iRunLength; iRun++) {
+					if (iX < pImg->iWidth) {
+						vASCII85EncodeByte(pOutFile, iByte);
+					}
+					iX++;
+				}
+				continue;
+			}
+			/* Literal or escape */
+			iRunLength = iNextByte(pInFile);
+			if (iRunLength == EOF) {
+				vASCII85EncodeByte(pOutFile, EOF);
+				return;
+			}
+			if (iRunLength == 0) {		/* End of line escape */
+				bEOL = TRUE;
+			} else if (iRunLength == 1) {	/* End of file escape */
+				bEOF = TRUE;
+				bEOL = TRUE;
+			} else if (iRunLength == 2) {	/* Delta escape */
+				DBG_MSG("RLE8: encountered delta escape");
+				bEOF = TRUE;
+				bEOL = TRUE;
+			} else {			/* Literal packet */
+				for (iRun = 0; iRun < iRunLength; iRun++) {
+					iByte = iNextByte(pInFile);
+					if (iByte == EOF) {
+						vASCII85EncodeByte(pOutFile, EOF);
+						return;
+					}
+					if (iX < pImg->iWidth) {
+						vASCII85EncodeByte(pOutFile, iByte);
+					}
+					iX++;
+				}
+				/* Padding if the number of bytes is odd */
+				if (odd(iRunLength)) {
+					(void)tSkipBytes(pInFile, 1);
+				}
+			}
+		}
+		DBG_DEC_C(iX != pImg->iWidth, iX);
+	}
+	vASCII85EncodeByte(pOutFile, EOF);
+} /* end of vDecodeRle8 */
+
+/*
+ * vDecodeDIB - decode a dib picture
+ */
+static void
+vDecodeDIB(FILE *pInFile, FILE *pOutFile, const imagedata_type *pImg)
+{
+	size_t	tHeaderSize;
+
+	fail(pInFile == NULL);
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+
+	/* Skip the bitmap info header */
+	tHeaderSize = (size_t)ulNextLong(pInFile);
+	(void)tSkipBytes(pInFile, tHeaderSize - 4);
+	/* Skip the colortable */
+	if (pImg->uiBitsPerComponent <= 8) {
+		(void)tSkipBytes(pInFile,
+			(size_t)(pImg->iColorsUsed *
+			 ((tHeaderSize > 12) ? 4 : 3)));
+	}
+
+	switch (pImg->uiBitsPerComponent) {
+	case 1:
+		fail(pImg->eCompression != compression_none);
+		vDecode1bpp(pInFile, pOutFile, pImg);
+		break;
+	case 4:
+		fail(pImg->eCompression != compression_none &&
+				pImg->eCompression != compression_rle4);
+		if (pImg->eCompression == compression_rle4) {
+			vDecodeRle4(pInFile, pOutFile, pImg);
+		} else {
+			vDecode4bpp(pInFile, pOutFile, pImg);
+		}
+		break;
+	case 8:
+		fail(pImg->eCompression != compression_none &&
+				pImg->eCompression != compression_rle8);
+		if (pImg->eCompression == compression_rle8) {
+			vDecodeRle8(pInFile, pOutFile, pImg);
+		} else {
+			vDecode8bpp(pInFile, pOutFile, pImg);
+		}
+		break;
+	case 24:
+		fail(pImg->eCompression != compression_none);
+		vDecode24bpp(pInFile, pOutFile, pImg);
+		break;
+	default:
+		DBG_DEC(pImg->uiBitsPerComponent);
+		break;
+	}
+} /* end of vDecodeDIB */
+
+#if defined(DEBUG)
+/*
+ * vCopy2File
+ */
+static void
+vCopy2File(FILE *pInFile, ULONG ulFileOffset, size_t tPictureLen)
+{
+	static int	iPicCounter = 0;
+	FILE	*pOutFile;
+	size_t	tIndex;
+	int	iTmp;
+	char	szFilename[30];
+
+	if (!bSetDataOffset(pInFile, ulFileOffset)) {
+		return;
+	}
+
+	sprintf(szFilename, "/tmp/pic/pic%04d.bmp", ++iPicCounter);
+	pOutFile = fopen(szFilename, "wb");
+	if (pOutFile == NULL) {
+		return;
+	}
+	/* Turn a dib into a bmp by adding a fake 14 byte header */
+	(void)putc('B', pOutFile);
+	(void)putc('M', pOutFile);
+	for (iTmp = 0; iTmp < 12; iTmp++) {
+		if (putc(0, pOutFile) == EOF) {
+			break;
+		}
+	}
+	for (tIndex = 0; tIndex < tPictureLen; tIndex++) {
+		iTmp = iNextByte(pInFile);
+		if (putc(iTmp, pOutFile) == EOF) {
+			break;
+		}
+	}
+	(void)fclose(pOutFile);
+} /* end of vCopy2File */
+#endif /* DEBUG */
+
+/*
+ * bTranslateDIB - translate a DIB picture
+ *
+ * This function translates a picture from dib to eps
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslateDIB(diagram_type *pDiag, FILE *pInFile,
+		ULONG ulFileOffset, const imagedata_type *pImg)
+{
+#if defined(DEBUG)
+	fail(pImg->tPosition > pImg->tLength);
+	vCopy2File(pInFile, ulFileOffset, pImg->tLength - pImg->tPosition);
+#endif /* DEBUG */
+
+	/* Seek to start position of DIB data */
+	if (!bSetDataOffset(pInFile, ulFileOffset)) {
+		return FALSE;
+	}
+
+	vImagePrologue(pDiag, pImg);
+	vDecodeDIB(pInFile, pDiag->pOutFile, pImg);
+	vImageEpilogue(pDiag);
+
+	return TRUE;
+} /* end of bTranslateDIB */

+ 594 - 0
sys/src/cmd/aux/antiword/dib2sprt.c

@@ -0,0 +1,594 @@
+/*
+ * dib2sprt.c
+ * Copyright (C) 2000-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to translate dib pictures into sprites
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "wimpt.h"
+#include "antiword.h"
+
+#if 0 /* defined(DEBUG) */
+static int iPicCounter = 0;
+#endif /* DEBUG */
+
+
+/*
+ * iGetByteWidth - compute the number of bytes needed for a row of pixels
+ */
+static int
+iGetByteWidth(const imagedata_type *pImg)
+{
+	switch (pImg->uiBitsPerComponent) {
+	case  1:
+		return (pImg->iWidth + 31) / 32 * sizeof(int);
+	case  4:
+		return (pImg->iWidth + 7) / 8 * sizeof(int);
+	case  8:
+	case 24:
+		return (pImg->iWidth + 3) / 4 * sizeof(int);
+	default:
+		DBG_DEC(pImg->uiBitsPerComponent);
+		return 0;
+	}
+} /* end of iGetByteWidth */
+
+/*
+ * bCreateBlankSprite - Create a blank sprite.
+ *
+ * Create a blank sprite and add a palette if needed
+ *
+ * returns a pointer to the sprite when successful, otherwise NULL
+ */
+static UCHAR *
+pucCreateBlankSprite(const imagedata_type *pImg, size_t *ptSize)
+{
+	sprite_area	*pArea;
+	UCHAR	*pucTmp;
+	size_t	tSize;
+	int	iIndex, iMode, iPaletteEntries, iByteWidth;
+
+	DBG_MSG("pCreateBlankSprite");
+
+	fail(pImg == NULL);
+
+	switch (pImg->uiBitsPerComponent) {
+	case  1:
+		iMode = 18;
+		iPaletteEntries = 2;
+		break;
+	case  4:
+		iMode = 20;
+		iPaletteEntries = 16;
+		break;
+	case  8:
+	case 24:
+		iMode = 21;
+		iPaletteEntries = 0;
+		break;
+	default:
+		DBG_DEC(pImg->uiBitsPerComponent);
+		return NULL;
+	}
+	fail(iPaletteEntries < 0 || iPaletteEntries > 16);
+
+	/* Create the sprite */
+
+	iByteWidth = iGetByteWidth(pImg);
+
+	tSize = sizeof(sprite_area) +
+		sizeof(sprite_header) +
+		iPaletteEntries * 8 +
+		iByteWidth * pImg->iHeight;
+	DBG_DEC(tSize);
+	pArea = xmalloc(tSize);
+	sprite_area_initialise(pArea, tSize);
+
+	wimpt_noerr(sprite_create(pArea, "wordimage",
+		iPaletteEntries > 0 ? sprite_haspalette : sprite_nopalette,
+		pImg->iWidth, pImg->iHeight, iMode));
+
+	/* Add the palette */
+
+	pucTmp = (UCHAR *)pArea +
+		sizeof(sprite_area) + sizeof(sprite_header);
+	for (iIndex = 0; iIndex < iPaletteEntries; iIndex++) {
+		/* First color */
+		*pucTmp++ = 0;
+		*pucTmp++ = pImg->aucPalette[iIndex][0];
+		*pucTmp++ = pImg->aucPalette[iIndex][1];
+		*pucTmp++ = pImg->aucPalette[iIndex][2];
+		/* Second color */
+		*pucTmp++ = 0;
+		*pucTmp++ = pImg->aucPalette[iIndex][0];
+		*pucTmp++ = pImg->aucPalette[iIndex][1];
+		*pucTmp++ = pImg->aucPalette[iIndex][2];
+	}
+
+	if (ptSize != NULL) {
+		*ptSize = tSize;
+	}
+	return (UCHAR *)pArea;
+} /* end of pucCreateBlankSprite */
+
+/*
+ * iReduceColor - reduce from 24 bit to 8 bit color
+ *
+ * Reduce 24 bit true colors to RISC OS default 256 color palette
+ *
+ * returns the resulting color
+ */
+static int
+iReduceColor(int iRed, int iGreen, int iBlue)
+{
+	int	iResult;
+
+	iResult = (iBlue & 0x80) ? 0x80 : 0;
+	iResult |= (iGreen & 0x80) ? 0x40 : 0;
+	iResult |= (iGreen & 0x40) ? 0x20 : 0;
+	iResult |= (iRed & 0x80) ? 0x10 : 0;
+	iResult |= (iBlue & 0x40) ? 0x08 : 0;
+	iResult |= (iRed & 0x40) ? 0x04 : 0;
+	iResult |= ((iRed | iGreen | iBlue) & 0x20) ? 0x02 : 0;
+	iResult |= ((iRed | iGreen | iBlue) & 0x10) ? 0x01 : 0;
+	return iResult;
+} /* end of iReduceColor */
+
+/*
+ * vDecode1bpp - decode an uncompressed 1 bit per pixel image
+ */
+static void
+vDecode1bpp(FILE *pFile, UCHAR *pucData, const imagedata_type *pImg)
+{
+	int	iX, iY, iByteWidth, iOffset, iTmp, iEighthWidth, iPadding;
+	UCHAR	ucTmp;
+
+	DBG_MSG("vDecode1bpp");
+
+	fail(pFile == NULL);
+	fail(pucData == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 2);
+
+	iByteWidth = iGetByteWidth(pImg);
+
+	iEighthWidth = (pImg->iWidth + 7) / 8;
+	iPadding = ROUND4(iEighthWidth) - iEighthWidth;
+
+	for (iY = pImg->iHeight - 1; iY >= 0; iY--) {
+		for (iX = 0; iX < iEighthWidth; iX++) {
+			iTmp = iNextByte(pFile);
+			if (iTmp == EOF) {
+				return;
+			}
+			/* Reverse the bit order */
+			ucTmp  = (iTmp & BIT(0)) ? (UCHAR)BIT(7) : 0;
+			ucTmp |= (iTmp & BIT(1)) ? (UCHAR)BIT(6) : 0;
+			ucTmp |= (iTmp & BIT(2)) ? (UCHAR)BIT(5) : 0;
+			ucTmp |= (iTmp & BIT(3)) ? (UCHAR)BIT(4) : 0;
+			ucTmp |= (iTmp & BIT(4)) ? (UCHAR)BIT(3) : 0;
+			ucTmp |= (iTmp & BIT(5)) ? (UCHAR)BIT(2) : 0;
+			ucTmp |= (iTmp & BIT(6)) ? (UCHAR)BIT(1) : 0;
+			ucTmp |= (iTmp & BIT(7)) ? (UCHAR)BIT(0) : 0;
+			iOffset = iY * iByteWidth + iX;
+			*(pucData + iOffset) = ucTmp;
+		}
+		(void)tSkipBytes(pFile, iPadding);
+	}
+} /* end of vDecode1bpp */
+
+/*
+ * vDecode4bpp - decode an uncompressed 4 bits per pixel image
+ */
+static void
+vDecode4bpp(FILE *pFile, UCHAR *pucData, const imagedata_type *pImg)
+{
+	int	iX, iY, iByteWidth, iOffset, iTmp, iHalfWidth, iPadding;
+	UCHAR	ucTmp;
+
+	DBG_MSG("vDecode4bpp");
+
+	fail(pFile == NULL);
+	fail(pucData == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 16);
+
+	iByteWidth = iGetByteWidth(pImg);
+
+	iHalfWidth = (pImg->iWidth + 1) / 2;
+	iPadding = ROUND4(iHalfWidth) - iHalfWidth;
+
+	for (iY = pImg->iHeight - 1; iY >= 0; iY--) {
+		for (iX = 0; iX < iHalfWidth; iX++) {
+			iTmp = iNextByte(pFile);
+			if (iTmp == EOF) {
+				return;
+			}
+			/* Reverse the nibble order */
+			ucTmp = (iTmp & 0xf0) >> 4;
+			ucTmp |= (iTmp & 0x0f) << 4;
+			iOffset = iY * iByteWidth + iX;
+			*(pucData + iOffset) = ucTmp;
+		}
+		(void)tSkipBytes(pFile, iPadding);
+	}
+} /* end of vDecode4bpp */
+
+/*
+ * vDecode8bpp - decode an uncompressed 8 bits per pixel image
+ */
+static void
+vDecode8bpp(FILE *pFile, UCHAR *pucData, const imagedata_type *pImg)
+{
+	int	iX, iY, iByteWidth, iOffset, iIndex, iPadding;
+
+	DBG_MSG("vDecode8bpp");
+
+	fail(pFile == NULL);
+	fail(pucData == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 256);
+
+	iByteWidth = iGetByteWidth(pImg);
+
+	iPadding = ROUND4(pImg->iWidth) - pImg->iWidth;
+
+	for (iY = pImg->iHeight - 1; iY >= 0; iY--) {
+		for (iX = 0; iX < pImg->iWidth; iX++) {
+			iIndex = iNextByte(pFile);
+			if (iIndex == EOF) {
+				return;
+			}
+			iOffset = iY * iByteWidth + iX;
+			*(pucData + iOffset) = iReduceColor(
+				pImg->aucPalette[iIndex][0],
+				pImg->aucPalette[iIndex][1],
+				pImg->aucPalette[iIndex][2]);
+		}
+		(void)tSkipBytes(pFile, iPadding);
+	}
+} /* end of vDecode8bpp */
+
+/*
+ * vDecode24bpp - decode an uncompressed 24 bits per pixel image
+ */
+static void
+vDecode24bpp(FILE *pFile, UCHAR *pucData, const imagedata_type *pImg)
+{
+	int	iX, iY, iTripleWidth, iByteWidth, iOffset, iPadding;
+	int	iRed, iGreen, iBlue;
+
+	DBG_MSG("vDecode24bpp");
+
+	fail(pFile == NULL);
+	fail(pucData == NULL);
+	fail(pImg == NULL);
+
+	iByteWidth = iGetByteWidth(pImg);
+
+	iTripleWidth = pImg->iWidth * 3;
+	iPadding = ROUND4(iTripleWidth) - iTripleWidth;
+
+	for (iY = pImg->iHeight - 1; iY >= 0; iY--) {
+		for (iX = 0; iX < pImg->iWidth; iX++) {
+			iBlue = iNextByte(pFile);
+			if (iBlue == EOF) {
+				return;
+			}
+			iGreen = iNextByte(pFile);
+			if (iGreen == EOF) {
+				return;
+			}
+			iRed = iNextByte(pFile);
+			if (iRed == EOF) {
+				return;
+			}
+			iOffset = iY * iByteWidth + iX;
+			*(pucData + iOffset) =
+					iReduceColor(iRed, iGreen, iBlue);
+		}
+		(void)tSkipBytes(pFile, iPadding);
+	}
+} /* end of vDecode24bpp */
+
+/*
+ * vDecodeRle4 - decode a RLE compressed 4 bits per pixel image
+ */
+static void
+vDecodeRle4(FILE *pFile, UCHAR *pucData, const imagedata_type *pImg)
+{
+	int	iX, iY, iByteWidth, iOffset, iTmp, iHalfWidth;
+	int	iRun, iRunLength, iHalfRun;
+	BOOL	bEOL;
+	UCHAR	ucTmp;
+
+	DBG_MSG("vDecodeRle4");
+
+	fail(pFile == NULL);
+	fail(pucData == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 16);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	iByteWidth = iGetByteWidth(pImg);
+	iHalfWidth = (pImg->iWidth + 1) / 2;
+
+	for (iY = pImg->iHeight - 1; iY >= 0; iY--) {
+		bEOL = FALSE;
+		iX = 0;
+		while (!bEOL) {
+			iRunLength = iNextByte(pFile);
+			if (iRunLength == EOF) {
+				return;
+			}
+			if (iRunLength != 0) {
+			  	/*
+				 * Encoded packet:
+				 * RunLength pixels, all the "same" value
+				 */
+				iTmp = iNextByte(pFile);
+				if (iTmp == EOF) {
+					return;
+				}
+				/* Reverse the nibble order */
+				ucTmp = (iTmp & 0xf0) >> 4;
+				ucTmp |= (iTmp & 0x0f) << 4;
+				iHalfRun = (iRunLength + 1) / 2;
+				for (iRun = 0; iRun < iHalfRun; iRun++) {
+					if (iX < iHalfWidth) {
+						iOffset = iY * iByteWidth + iX;
+						*(pucData + iOffset) = ucTmp;
+					}
+					iX++;
+				}
+				continue;
+			}
+			/* Literal or escape */
+			iRunLength = iNextByte(pFile);
+			if (iRunLength == EOF) {
+				return;
+			}
+			if (iRunLength == 0) {		/* End of line escape */
+				bEOL = TRUE;
+			} else if (iRunLength == 1) {	/* End of file escape */
+				return;
+			} else if (iRunLength == 2) {	/* Delta escape */
+				DBG_MSG("RLE4: encountered delta escape");
+				return;
+			} else {			/* Literal packet */
+				iHalfRun = (iRunLength + 1) / 2;
+				for (iRun = 0; iRun < iHalfRun; iRun++) {
+					iTmp = iNextByte(pFile);
+					if (iTmp == EOF) {
+						return;
+					}
+					/* Reverse the nibble order */
+					ucTmp = (iTmp & 0xf0) >> 4;
+					ucTmp |= (iTmp & 0x0f) << 4;
+					if (iX < iHalfWidth) {
+						iOffset = iY * iByteWidth + iX;
+						*(pucData + iOffset) = ucTmp;
+					}
+					iX++;
+				}
+				/* Padding if the number of bytes is odd */
+				if (odd(iHalfRun)) {
+					(void)tSkipBytes(pFile, 1);
+				}
+			}
+		}
+		DBG_DEC_C(iX != iHalfWidth, iX);
+	}
+} /* end of vDecodeRle4 */
+
+/*
+ * vDecodeRle8 - decode a RLE compressed 8 bits per pixel image
+ */
+static void
+vDecodeRle8(FILE *pFile, UCHAR *pucData, const imagedata_type *pImg)
+{
+	int	iX, iY, iRun, iRunLength, iOffset, iIndex, iByteWidth;
+	BOOL	bEOL;
+
+	DBG_MSG("vDecodeRle8");
+
+	fail(pFile == NULL);
+	fail(pucData == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 1 || pImg->iColorsUsed > 256);
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+
+	iByteWidth = iGetByteWidth(pImg);
+
+	for (iY = pImg->iHeight - 1; iY >= 0; iY--) {
+		bEOL = FALSE;
+		iX = 0;
+		while (!bEOL) {
+			iRunLength = iNextByte(pFile);
+			if (iRunLength == EOF) {
+				return;
+			}
+			if (iRunLength != 0) {
+			  	/*
+				 * Encoded packet:
+				 * RunLength pixels, all the same value
+				 */
+				iIndex = iNextByte(pFile);
+				if (iIndex == EOF) {
+					return;
+				}
+				for (iRun = 0; iRun < iRunLength; iRun++) {
+					if (iX < pImg->iWidth) {
+						iOffset = iY * iByteWidth + iX;
+						*(pucData + iOffset) =
+							iReduceColor(
+							pImg->aucPalette[iIndex][0],
+							pImg->aucPalette[iIndex][1],
+							pImg->aucPalette[iIndex][2]);
+					}
+					iX++;
+				}
+				continue;
+			}
+			/* Literal or escape */
+			iRunLength = iNextByte(pFile);
+			if (iRunLength == EOF) {
+				return;
+			}
+			if (iRunLength == 0) {		/* End of line escape */
+				bEOL = TRUE;
+			} else if (iRunLength == 1) {	/* End of file escape */
+				return;
+			} else if (iRunLength == 2) {	/* Delta escape */
+				DBG_MSG("RLE8: encountered delta escape");
+				return;
+			} else {			/* Literal packet */
+				for (iRun = 0; iRun < iRunLength; iRun++) {
+					iIndex = iNextByte(pFile);
+					if (iIndex == EOF) {
+						return;
+					}
+					if (iX < pImg->iWidth) {
+						iOffset = iY * iByteWidth + iX;
+						*(pucData + iOffset) =
+							iReduceColor(
+							pImg->aucPalette[iIndex][0],
+							pImg->aucPalette[iIndex][1],
+							pImg->aucPalette[iIndex][2]);
+					}
+					iX++;
+				}
+				/* Padding if the number of bytes is odd */
+				if (odd(iRunLength)) {
+					(void)tSkipBytes(pFile, 1);
+				}
+			}
+		}
+		DBG_DEC_C(iX != pImg->iWidth, iX);
+	}
+} /* end of vDecodeRle8 */
+
+#if 0 /* defined(DEBUG) */
+static void
+vCopy2File(UCHAR *pucSprite, size_t tSpriteSize)
+{
+	FILE	*pOutFile;
+	int	iIndex;
+	char	szFilename[30];
+
+	sprintf(szFilename, "<Wimp$ScrapDir>.sprt%04d", ++iPicCounter);
+	pOutFile = fopen(szFilename, "wb");
+	if (pOutFile == NULL) {
+		return;
+	}
+	DBG_MSG(szFilename);
+	for (iIndex = 4; iIndex < (int)tSpriteSize; iIndex++) {
+		if (putc(pucSprite[iIndex], pOutFile) == EOF) {
+			break;
+		}
+	}
+	(void)fclose(pOutFile);
+	vSetFiletype(szFilename, FILETYPE_SPRITE);
+} /* end of vCopy2File */
+#endif /* DEBUG */
+
+/*
+ * vDecodeDIB - decode a dib picture
+ */
+static void
+vDecodeDIB(diagram_type *pDiag, FILE *pFile, const imagedata_type *pImg)
+{
+	UCHAR	*pucSprite, *pucPalette, *pucData;
+	size_t	tSpriteSize;
+	int	iHeaderSize;
+
+	/* Skip the bitmap info header */
+	iHeaderSize = (int)ulNextLong(pFile);
+	(void)tSkipBytes(pFile, iHeaderSize - 4);
+	/* Skip the colortable */
+	if (pImg->uiBitsPerComponent <= 8) {
+		(void)tSkipBytes(pFile,
+			pImg->iColorsUsed * ((iHeaderSize > 12) ? 4 : 3));
+	}
+
+	/* Create an empty sprite */
+	pucSprite = pucCreateBlankSprite(pImg, &tSpriteSize);
+	pucPalette = pucSprite + sizeof(sprite_area) + sizeof(sprite_header);
+
+	/* Add the pixel information */
+	switch (pImg->uiBitsPerComponent) {
+	case  1:
+		fail(pImg->eCompression != compression_none);
+		pucData = pucPalette + 2 * 8;
+		vDecode1bpp(pFile, pucData, pImg);
+		break;
+	case  4:
+		fail(pImg->eCompression != compression_none &&
+				pImg->eCompression != compression_rle4);
+		pucData = pucPalette + 16 * 8;
+		if (pImg->eCompression == compression_rle4) {
+			vDecodeRle4(pFile, pucData, pImg);
+		} else {
+			vDecode4bpp(pFile, pucData, pImg);
+		}
+		break;
+	case  8:
+		fail(pImg->eCompression != compression_none &&
+				pImg->eCompression != compression_rle8);
+		pucData = pucPalette;
+		if (pImg->eCompression == compression_rle8) {
+			vDecodeRle8(pFile, pucData, pImg);
+		} else {
+			vDecode8bpp(pFile, pucData, pImg);
+		}
+		break;
+	case 24:
+		fail(pImg->eCompression != compression_none);
+		pucData = pucPalette;
+		vDecode24bpp(pFile, pucData, pImg);
+		break;
+	default:
+		DBG_DEC(pImg->uiBitsPerComponent);
+		break;
+	}
+
+#if 0 /* defined(DEBUG) */
+	vCopy2File(pucSprite, tSpriteSize);
+#endif /* DEBUG */
+
+	/* Add the sprite to the Draw file */
+	vImage2Diagram(pDiag, pImg,
+		pucSprite + sizeof(sprite_area),
+		tSpriteSize - sizeof(sprite_area));
+
+	/* Clean up before you leave */
+	pucSprite = xfree(pucSprite);
+} /* end of vDecodeDIB */
+
+/*
+ * bTranslateDIB - translate a DIB picture
+ *
+ * This function translates a picture from dib to sprite
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslateDIB(diagram_type *pDiag, FILE *pFile,
+	ULONG ulFileOffset, const imagedata_type *pImg)
+{
+	/* Seek to start position of DIB data */
+	if (!bSetDataOffset(pFile, ulFileOffset)) {
+		return FALSE;
+	}
+
+	vDecodeDIB(pDiag, pFile, pImg);
+
+	return TRUE;
+} /* end of bTranslateDIB */

+ 1076 - 0
sys/src/cmd/aux/antiword/draw.c

@@ -0,0 +1,1076 @@
+/*
+ * draw.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to deal with the Draw format
+ */
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include "akbd.h"
+#include "flex.h"
+#include "wimp.h"
+#include "template.h"
+#include "wimpt.h"
+#include "win.h"
+#include "antiword.h"
+
+
+/* The work area must be a little bit larger than the diagram */
+#define WORKAREA_EXTENSION	    5
+/* Diagram memory */
+#define INITIAL_SIZE		32768	/* 32k */
+#define EXTENSION_SIZE		 4096	/*  4k */
+/* Main window title */
+#define WINDOW_TITLE_LEN	   28
+#define FILENAME_TITLE_LEN	(WINDOW_TITLE_LEN - 10)
+
+static BOOL	(*bDrawRenderDiag)(draw_diag *,
+			draw_redrawstr *, double, draw_error *) = NULL;
+
+/*
+ * vCreateMainWindow - create the Main Window
+ *
+ * remark: does not return if the Main Window can't be created
+ */
+static wimp_w
+tCreateMainWindow(void)
+{
+	static int	iY = 0;
+	template	*pTemplate;
+	wimp_w		tMainWindow;
+
+	/* Find and check the template */
+	pTemplate = template_find("MainWindow");
+	if (pTemplate == NULL) {
+		werr(1, "The 'MainWindow' template can't be found");
+	}
+	pTemplate = template_copy(pTemplate);
+	if (pTemplate == NULL) {
+		werr(1, "I can't copy the 'MainWindow' template");
+	}
+	if ((pTemplate->window.titleflags & wimp_INDIRECT) !=
+							wimp_INDIRECT) {
+		werr(1,
+	"The title of the 'MainWindow' template must be indirected text");
+	}
+	if (pTemplate->window.title.indirecttext.bufflen < WINDOW_TITLE_LEN) {
+		werr(1, "The 'MainWindow' title needs %d characters",
+			WINDOW_TITLE_LEN);
+	}
+
+	/*
+	 * Leave 48 OS units between two windows, as recommended by the
+	 * Style guide. And try to stay away from the iconbar.
+	 */
+	if (pTemplate->window.box.y0 < iY + 130) {
+		iY = 48;
+	} else {
+		pTemplate->window.box.y0 -= iY;
+		pTemplate->window.box.y1 -= iY;
+		iY += 48;
+	}
+
+	/* Create the window */
+	wimpt_noerr(wimp_create_wind(&pTemplate->window, &tMainWindow));
+	return tMainWindow;
+} /* end of tCreateMainWindow */
+
+/*
+ * vCreateScaleWindow - create the Scale view Window
+ *
+ * remark: does not return if the Scale view Window can't be created
+ */
+static wimp_w
+tCreateScaleWindow(void)
+{
+	wimp_wind	*pw;
+	wimp_w		tScaleWindow;
+
+	pw = template_syshandle("ScaleView");
+	if (pw == NULL) {
+		werr(1, "Template 'ScaleView' can't be found");
+	}
+	wimpt_noerr(wimp_create_wind(pw, &tScaleWindow));
+	return tScaleWindow;
+} /* end of tCreateScaleWindow */
+
+/*
+ * pCreateDiagram - create and initialize a diagram
+ *
+ * remark: does not return if the diagram can't be created
+ */
+diagram_type *
+pCreateDiagram(const char *szTask, const char *szFilename)
+{
+	diagram_type	*pDiag;
+	options_type	tOptions;
+	wimp_w		tMainWindow, tScaleWindow;
+	draw_box	tBox;
+
+	DBG_MSG("pCreateDiagram");
+
+	fail(szTask == NULL || szTask[0] == '\0');
+
+	/* Create the main window */
+	tMainWindow = tCreateMainWindow();
+	/* Create the scale view window */
+	tScaleWindow = tCreateScaleWindow();
+
+	/* Get the necessary memory */
+	pDiag = xmalloc(sizeof(diagram_type));
+	if (flex_alloc((flex_ptr)&pDiag->tInfo.data, INITIAL_SIZE) != 1) {
+		werr(1, "Memory allocation failed, unable to continue");
+	}
+
+	/* Determine which function to use for rendering the diagram */
+	if (iGetRiscOsVersion() >= 360) {
+		/* Home brew for RISC OS 3.6 functionality */
+	  	bDrawRenderDiag = bDrawRenderDiag360;
+	  } else {
+		/* The function from RISC_OSLib */
+		bDrawRenderDiag = draw_render_diag;
+	}
+
+	/* Initialize the diagram */
+	vGetOptions(&tOptions);
+	pDiag->tMainWindow = tMainWindow;
+	pDiag->tScaleWindow = tScaleWindow;
+	pDiag->iScaleFactorCurr = tOptions.iScaleFactor;
+	pDiag->iScaleFactorTemp = tOptions.iScaleFactor;
+	pDiag->tMemorySize = INITIAL_SIZE;
+	tBox.x0 = 0;
+	tBox.y0 = -(draw_screenToDraw(32 + 3) * 8 + 1);
+	tBox.x1 = draw_screenToDraw(16) * MIN_SCREEN_WIDTH + 1;
+	tBox.y1 = 0;
+	draw_create_diag(&pDiag->tInfo, (char *)szTask, tBox);
+	DBG_DEC(pDiag->tInfo.length);
+	pDiag->lXleft = 0;
+	pDiag->lYtop = 0;
+	strncpy(pDiag->szFilename,
+			szBasename(szFilename), sizeof(pDiag->szFilename) - 1);
+	pDiag->szFilename[sizeof(pDiag->szFilename) - 1] = '\0';
+	/* Return success */
+	return pDiag;
+} /* end of pCreateDiagram */
+
+/*
+ * vDestroyDiagram - remove a diagram by freeing the memory it uses
+ */
+static void
+vDestroyDiagram(wimp_w tWindow, diagram_type *pDiag)
+{
+	DBG_MSG("vDestroyDiagram");
+
+	fail(pDiag != NULL && pDiag->tMainWindow != tWindow);
+
+	wimpt_noerr(wimp_close_wind(tWindow));
+	if (pDiag == NULL) {
+		return;
+	}
+	if (pDiag->tInfo.data != NULL && pDiag->tMemorySize != 0) {
+		flex_free((flex_ptr)&pDiag->tInfo.data);
+	}
+	pDiag = xfree(pDiag);
+} /* end of vDestroyDiagram */
+
+/*
+ * vPrintDrawError - print an error reported by a draw function
+ */
+static void
+vPrintDrawError(draw_error *pError)
+{
+	DBG_MSG("vPrintDrawError");
+
+	fail(pError == NULL);
+
+	switch (pError->type) {
+	case DrawOSError:
+		DBG_DEC(pError->err.os.errnum);
+		DBG_MSG(pError->err.os.errmess);
+		werr(1, "DrawOSError: %d: %s",
+			pError->err.os.errnum, pError->err.os.errmess);
+		break;
+	case DrawOwnError:
+		DBG_DEC(pError->err.draw.code);
+		DBG_HEX(pError->err.draw.location);
+		werr(1, "DrawOwnError: Code %d - Location &%x",
+			pError->err.draw.code, pError->err.draw.location);
+		break;
+	case None:
+	default:
+		break;
+	}
+} /* end of vPrintDrawError */
+
+/*
+ * vExtendDiagramSize - make sure the diagram is big enough
+ */
+static void
+vExtendDiagramSize(diagram_type *pDiag, size_t tSize)
+{
+	fail(pDiag == NULL || tSize % 4 != 0);
+
+	while (pDiag->tInfo.length + tSize > pDiag->tMemorySize) {
+		if (flex_extend((flex_ptr)&pDiag->tInfo.data,
+				pDiag->tMemorySize + EXTENSION_SIZE) != 1) {
+			werr(1, "Memory extend failed, unable to continue");
+		}
+		pDiag->tMemorySize += EXTENSION_SIZE;
+		NO_DBG_DEC(pDiag->tMemorySize);
+	}
+} /* end of vExtendDiagramSize */
+
+/*
+ * vPrologue2 - prologue part 2; add a font list to a diagram
+ */
+void
+vPrologue2(diagram_type *pDiag, int iWordVersion)
+{
+	draw_objectType	tNew;
+	draw_error	tError;
+	draw_object	tHandle;
+	const font_table_type	*pTmp;
+	char	*pcTmp;
+	size_t	tRealSize, tSize;
+	int	iCount;
+
+	fail(pDiag == NULL);
+
+	if (tGetFontTableLength() == 0) {
+		return;
+	}
+	tRealSize = sizeof(draw_fontliststrhdr);
+	pTmp = NULL;
+	while ((pTmp = pGetNextFontTableRecord(pTmp)) != NULL) {
+		tRealSize += 2 + strlen(pTmp->szOurFontname);
+	}
+	tSize = ROUND4(tRealSize);
+	vExtendDiagramSize(pDiag, tSize);
+	tNew.fontList = xmalloc(tSize);
+	tNew.fontList->tag = draw_OBJFONTLIST;
+	tNew.fontList->size = tSize;
+	pcTmp = (char *)&tNew.fontList->fontref;
+	iCount = 0;
+	pTmp = NULL;
+	while ((pTmp = pGetNextFontTableRecord(pTmp)) != NULL) {
+		*pcTmp = ++iCount;
+		pcTmp++;
+		strcpy(pcTmp, pTmp->szOurFontname);
+		pcTmp += 1 + strlen(pTmp->szOurFontname);
+	}
+	memset((char *)tNew.fontList + tRealSize, 0, tSize - tRealSize);
+	if (draw_createObject(&pDiag->tInfo, tNew, draw_LastObject,
+						TRUE, &tHandle, &tError)) {
+		draw_translateText(&pDiag->tInfo);
+	} else {
+		DBG_MSG("draw_createObject() failed");
+		vPrintDrawError(&tError);
+	}
+	tNew.fontList = xfree(tNew.fontList);
+} /* end of vPrologue2 */
+
+/*
+ * vSubstring2Diagram - put a sub string into a diagram
+ */
+void
+vSubstring2Diagram(diagram_type *pDiag,
+	char *szString, size_t tStringLength, long lStringWidth,
+	UCHAR ucFontColor, USHORT usFontstyle, draw_fontref tFontRef,
+	USHORT usFontSize, USHORT usMaxFontSize)
+{
+	draw_objectType	tNew;
+	draw_error	tError;
+	draw_object	tHandle;
+	long	lSizeX, lSizeY, lOffset, l20, lYMove;
+	size_t	tRealSize, tSize;
+
+	fail(pDiag == NULL || szString == NULL);
+	fail(pDiag->lXleft < 0);
+	fail(tStringLength != strlen(szString));
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+	fail(usMaxFontSize < MIN_FONT_SIZE || usMaxFontSize > MAX_FONT_SIZE);
+	fail(usFontSize > usMaxFontSize);
+
+	if (szString[0] == '\0' || tStringLength == 0) {
+		return;
+	}
+
+	if (tFontRef == 0) {
+		lOffset = draw_screenToDraw(2);
+		l20 = draw_screenToDraw(32 + 3);
+		lSizeX = draw_screenToDraw(16);
+		lSizeY = draw_screenToDraw(32);
+	} else {
+		lOffset = lToBaseLine(usMaxFontSize);
+		l20 = lWord2DrawUnits20(usMaxFontSize);
+		lSizeX = lWord2DrawUnits00(usFontSize);
+		lSizeY = lWord2DrawUnits00(usFontSize);
+	}
+
+	lYMove = 0;
+
+	/* Up for superscript */
+	if (bIsSuperscript(usFontstyle)) {
+		lYMove = lMilliPoints2DrawUnits((((long)usFontSize + 1) / 2) * 375);
+	}
+	/* Down for subscript */
+	if (bIsSubscript(usFontstyle)) {
+		lYMove = -lMilliPoints2DrawUnits((long)usFontSize * 125);
+	}
+
+	tRealSize = sizeof(draw_textstr) + tStringLength;
+	tSize = ROUND4(tRealSize);
+	vExtendDiagramSize(pDiag, tSize);
+	tNew.text = xmalloc(tSize);
+	tNew.text->tag = draw_OBJTEXT;
+	tNew.text->size = tSize;
+	tNew.text->bbox.x0 = (int)pDiag->lXleft;
+	tNew.text->bbox.y0 = (int)(pDiag->lYtop + lYMove);
+	tNew.text->bbox.x1 = (int)(pDiag->lXleft + lStringWidth);
+	tNew.text->bbox.y1 = (int)(pDiag->lYtop + l20 + lYMove);
+	tNew.text->textcolour = (draw_coltyp)ulColor2Color(ucFontColor);
+	tNew.text->background = 0xffffff00;	/* White */
+	tNew.text->textstyle.fontref = tFontRef;
+	tNew.text->textstyle.reserved8 = 0;
+	tNew.text->textstyle.reserved16 = 0;
+	tNew.text->fsizex = (int)lSizeX;
+	tNew.text->fsizey = (int)lSizeY;
+	tNew.text->coord.x = (int)pDiag->lXleft;
+	tNew.text->coord.y = (int)(pDiag->lYtop + lOffset + lYMove);
+	strncpy(tNew.text->text, szString, tStringLength);
+	tNew.text->text[tStringLength] = '\0';
+	memset((char *)tNew.text + tRealSize, 0, tSize - tRealSize);
+	if (!draw_createObject(&pDiag->tInfo, tNew, draw_LastObject,
+						TRUE, &tHandle, &tError)) {
+		DBG_MSG("draw_createObject() failed");
+		vPrintDrawError(&tError);
+	}
+	tNew.text = xfree(tNew.text);
+	draw_translateText(&pDiag->tInfo);
+	pDiag->lXleft += lStringWidth;
+} /* end of vSubstring2Diagram */
+
+/*
+ * vImage2Diagram - put an image into a diagram
+ */
+void
+vImage2Diagram(diagram_type *pDiag, const imagedata_type *pImg,
+	UCHAR *pucImage, size_t tImageSize)
+{
+  	draw_objectType	tTmp;
+  	draw_imageType	tNew;
+	draw_error	tError;
+	draw_object	tHandle;
+	long	lWidth, lHeight;
+	size_t	tRealSize, tSize;
+
+	DBG_MSG("vImage2Diagram");
+
+	fail(pDiag == NULL);
+	fail(pImg == NULL);
+	fail(pDiag->lXleft < 0);
+	fail(pImg->eImageType != imagetype_is_dib &&
+	     pImg->eImageType != imagetype_is_jpeg);
+
+	DBG_DEC_C(pDiag->lXleft != 0, pDiag->lXleft);
+
+	lWidth = lPoints2DrawUnits(pImg->iHorSizeScaled);
+	lHeight = lPoints2DrawUnits(pImg->iVerSizeScaled);
+	DBG_DEC(lWidth);
+	DBG_DEC(lHeight);
+
+	pDiag->lYtop -= lHeight;
+
+	switch (pImg->eImageType) {
+	case imagetype_is_dib:
+		tRealSize = sizeof(draw_spristrhdr) + tImageSize;
+		tSize = ROUND4(tRealSize);
+		vExtendDiagramSize(pDiag, tSize);
+		tNew.sprite = xmalloc(tSize);
+		tNew.sprite->tag = draw_OBJSPRITE;
+		tNew.sprite->size = tSize;
+		tNew.sprite->bbox.x0 = (int)pDiag->lXleft;
+		tNew.sprite->bbox.y0 = (int)pDiag->lYtop;
+		tNew.sprite->bbox.x1 = (int)(pDiag->lXleft + lWidth);
+		tNew.sprite->bbox.y1 = (int)(pDiag->lYtop + lHeight);
+		memcpy(&tNew.sprite->sprite, pucImage, tImageSize);
+		memset((char *)tNew.sprite + tRealSize, 0, tSize - tRealSize);
+		break;
+	case imagetype_is_jpeg:
+#if defined(DEBUG)
+		(void)bGetJpegInfo(pucImage, tImageSize);
+#endif /* DEBUG */
+		tRealSize = sizeof(draw_jpegstrhdr) + tImageSize;
+		tSize = ROUND4(tRealSize);
+		vExtendDiagramSize(pDiag, tSize);
+		tNew.jpeg = xmalloc(tSize);
+		tNew.jpeg->tag = draw_OBJJPEG;
+		tNew.jpeg->size = tSize;
+		tNew.jpeg->bbox.x0 = (int)pDiag->lXleft;
+		tNew.jpeg->bbox.y0 = (int)pDiag->lYtop;
+		tNew.jpeg->bbox.x1 = (int)(pDiag->lXleft + lWidth);
+		tNew.jpeg->bbox.y1 = (int)(pDiag->lYtop + lHeight);
+		tNew.jpeg->width = (int)lWidth;
+		tNew.jpeg->height = (int)lHeight;
+		tNew.jpeg->xdpi = 90;
+		tNew.jpeg->ydpi = 90;
+		tNew.jpeg->trfm[0] = 0x10000;
+		tNew.jpeg->trfm[1] = 0;
+		tNew.jpeg->trfm[2] = 0;
+		tNew.jpeg->trfm[3] = 0x10000;
+		tNew.jpeg->trfm[4] = (int)pDiag->lXleft;
+		tNew.jpeg->trfm[5] = (int)pDiag->lYtop;
+		tNew.jpeg->len = tImageSize;
+		memcpy(&tNew.jpeg->jpeg, pucImage, tImageSize);
+		memset((char *)tNew.jpeg + tRealSize, 0, tSize - tRealSize);
+		break;
+	default:
+		DBG_DEC(pImg->eImageType);
+		break;
+	}
+
+	tTmp = *(draw_objectType *)&tNew;
+	if (!draw_createObject(&pDiag->tInfo, tTmp, draw_LastObject,
+						TRUE, &tHandle, &tError)) {
+		DBG_MSG("draw_createObject() failed");
+		vPrintDrawError(&tError);
+	}
+
+	switch (pImg->eImageType) {
+	case imagetype_is_dib:
+		tNew.sprite = xfree(tNew.sprite);
+		break;
+	case imagetype_is_jpeg:
+		tNew.jpeg = xfree(tNew.jpeg);
+		break;
+	default:
+		DBG_DEC(pImg->eImageType);
+		break;
+	}
+	pDiag->lXleft = 0;
+} /* end of vImage2Diagram */
+
+/*
+ * bAddDummyImage - add a dummy image
+ *
+ * return TRUE when successful, otherwise FALSE
+ */
+BOOL
+bAddDummyImage(diagram_type *pDiag, const imagedata_type *pImg)
+{
+  	draw_objectType	tNew;
+	draw_error	tError;
+	draw_object	tHandle;
+	int	*piTmp;
+	long	lWidth, lHeight;
+	size_t	tRealSize, tSize;
+
+	DBG_MSG("bAddDummyImage");
+
+	fail(pDiag == NULL);
+	fail(pImg == NULL);
+	fail(pDiag->lXleft < 0);
+
+	if (pImg->iVerSizeScaled <= 0 || pImg->iHorSizeScaled <= 0) {
+		return FALSE;
+	}
+
+	DBG_DEC_C(pDiag->lXleft != 0, pDiag->lXleft);
+
+	lWidth = lPoints2DrawUnits(pImg->iHorSizeScaled);
+	lHeight = lPoints2DrawUnits(pImg->iVerSizeScaled);
+
+	pDiag->lYtop -= lHeight;
+
+	tRealSize = sizeof(draw_pathstrhdr) + 14 * sizeof(int);
+	tSize = ROUND4(tRealSize);
+	vExtendDiagramSize(pDiag, tSize);
+	tNew.path = xmalloc(tSize);
+	tNew.path->tag = draw_OBJPATH;
+	tNew.path->size = tSize;
+	tNew.path->bbox.x0 = (int)pDiag->lXleft;
+	tNew.path->bbox.y0 = (int)pDiag->lYtop;
+	tNew.path->bbox.x1 = (int)(pDiag->lXleft + lWidth);
+	tNew.path->bbox.y1 = (int)(pDiag->lYtop + lHeight);
+	tNew.path->fillcolour = -1;
+	tNew.path->pathcolour = 0x4d4d4d00;	/* Gray 70 percent */
+	tNew.path->pathwidth = (int)lMilliPoints2DrawUnits(500);
+	tNew.path->pathstyle.joincapwind = 0;
+	tNew.path->pathstyle.reserved8 = 0;
+	tNew.path->pathstyle.tricapwid = 0;
+	tNew.path->pathstyle.tricaphei = 0;
+	piTmp = (int *)((char *)tNew.path + sizeof(draw_pathstrhdr));
+	*piTmp++ = draw_PathMOVE;
+	*piTmp++ = tNew.path->bbox.x0;
+	*piTmp++ = tNew.path->bbox.y0;
+	*piTmp++ = draw_PathLINE;
+	*piTmp++ = tNew.path->bbox.x0;
+	*piTmp++ = tNew.path->bbox.y1;
+	*piTmp++ = draw_PathLINE;
+	*piTmp++ = tNew.path->bbox.x1;
+	*piTmp++ = tNew.path->bbox.y1;
+	*piTmp++ = draw_PathLINE;
+	*piTmp++ = tNew.path->bbox.x1;
+	*piTmp++ = tNew.path->bbox.y0;
+	*piTmp++ = draw_PathCLOSE;
+	*piTmp++ = draw_PathTERM;
+	memset((char *)tNew.path + tRealSize, 0, tSize - tRealSize);
+	if (!draw_createObject(&pDiag->tInfo, tNew, draw_LastObject,
+						TRUE, &tHandle, &tError)) {
+		DBG_MSG("draw_createObject() failed");
+		vPrintDrawError(&tError);
+	}
+	tNew.path = xfree(tNew.path);
+	pDiag->lXleft = 0;
+	return TRUE;
+} /* end of bAddDummyImage */
+
+/*
+ * vMove2NextLine - move to the next line
+ */
+void
+vMove2NextLine(diagram_type *pDiag, draw_fontref tFontRef, USHORT usFontSize)
+{
+	long	l20;
+
+	fail(pDiag == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+
+	if (tFontRef == 0) {
+		l20 = draw_screenToDraw(32 + 3);
+	} else {
+		l20 = lWord2DrawUnits20(usFontSize);
+	}
+	pDiag->lYtop -= l20;
+} /* end of vMove2NextLine */
+
+/*
+ * Create an start of paragraph (Phase 1)
+ */
+void
+vStartOfParagraph1(diagram_type *pDiag, long lBeforeIndentation)
+{
+	fail(pDiag == NULL);
+	fail(lBeforeIndentation < 0);
+
+	pDiag->lXleft = 0;
+	pDiag->lYtop -= lMilliPoints2DrawUnits(lBeforeIndentation);
+} /* end of vStartOfParagraph1 */
+
+/*
+ * Create an start of paragraph (Phase 2)
+ */
+void
+vStartOfParagraph2(diagram_type *pDiag)
+{
+	/* DUMMY */
+} /* end of vStartOfParagraph2 */
+
+/*
+ * Create an end of paragraph
+ */
+void
+vEndOfParagraph(diagram_type *pDiag,
+	draw_fontref tFontRef, USHORT usFontSize, long lAfterIndentation)
+{
+	fail(pDiag == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+	fail(lAfterIndentation < 0);
+
+	pDiag->lXleft = 0;
+	pDiag->lYtop -= lMilliPoints2DrawUnits(lAfterIndentation);
+} /* end of vEndOfParagraph */
+
+/*
+ * Create an end of page
+ */
+void
+vEndOfPage(diagram_type *pDiag, long lAfterIndentation)
+{
+	fail(pDiag == NULL);
+	fail(lAfterIndentation < 0);
+
+	pDiag->lXleft = 0;
+	pDiag->lYtop -= lMilliPoints2DrawUnits(lAfterIndentation);
+} /* end of vEndOfPage */
+
+/*
+ * vSetHeaders - set the headers
+ */
+void
+vSetHeaders(diagram_type *pDiag, USHORT usIstd)
+{
+	/* DUMMY */
+} /* end of vSetHeaders */
+
+/*
+ * Create a start of list
+ */
+void
+vStartOfList(diagram_type *pDiag, UCHAR ucNFC, BOOL bIsEndOfTable)
+{
+	/* DUMMY */
+} /* end of vStartOfList */
+
+/*
+ * Create an end of list
+ */
+void
+vEndOfList(diagram_type *pDiag)
+{
+	/* DUMMY */
+} /* end of vEndOfList */
+
+/*
+ * Create a start of a list item
+ */
+void
+vStartOfListItem(diagram_type *pDiag, BOOL bNoMarks)
+{
+	/* DUMMY */
+} /* end of vStartOfListItem */
+
+/*
+ * Create an end of a table
+ */
+void
+vEndOfTable(diagram_type *pDiag)
+{
+	/* DUMMY */
+} /* end of vEndTable */
+
+/*
+ * Add a table row
+ *
+ * Returns TRUE when conversion type is XML
+ */
+BOOL
+bAddTableRow(diagram_type *pDiag, char **aszColTxt,
+	int iNbrOfColumns, const short *asColumnWidth, UCHAR ucBorderInfo)
+{
+	/* DUMMY */
+	return FALSE;
+} /* end of bAddTableRow */
+
+/*
+ * vForceRedraw - force a redraw of the main window
+ */
+static void
+vForceRedraw(diagram_type *pDiag)
+{
+	wimp_wstate	tWindowState;
+	wimp_redrawstr	tRedraw;
+
+	DBG_MSG("vForceRedraw");
+
+	fail(pDiag == NULL);
+
+	DBG_DEC(pDiag->iScaleFactorCurr);
+
+	/* Read the size of the current diagram */
+	draw_queryBox(&pDiag->tInfo, (draw_box *)&tRedraw.box, TRUE);
+	tRedraw.w = pDiag->tMainWindow;
+	/* Adjust the size of the work area */
+	tRedraw.box.x0 = tRedraw.box.x0 * pDiag->iScaleFactorCurr / 100 - 1;
+	tRedraw.box.y0 = tRedraw.box.y0 * pDiag->iScaleFactorCurr / 100 - 1;
+	tRedraw.box.x1 = tRedraw.box.x1 * pDiag->iScaleFactorCurr / 100 + 1;
+	tRedraw.box.y1 = tRedraw.box.y1 * pDiag->iScaleFactorCurr / 100 + 1;
+	/* Work area extension */
+	tRedraw.box.x0 -= WORKAREA_EXTENSION;
+	tRedraw.box.y0 -= WORKAREA_EXTENSION;
+	tRedraw.box.x1 += WORKAREA_EXTENSION;
+	tRedraw.box.y1 += WORKAREA_EXTENSION;
+	wimpt_noerr(wimp_set_extent(&tRedraw));
+	/* Widen the box slightly to be sure all the edges are drawn */
+	tRedraw.box.x0 -= 5;
+	tRedraw.box.y0 -= 5;
+	tRedraw.box.x1 += 5;
+	tRedraw.box.y1 += 5;
+	/* Force the redraw */
+	wimpt_noerr(wimp_force_redraw(&tRedraw));
+	/* Reopen the window to show the correct size */
+	wimpt_noerr(wimp_get_wind_state(pDiag->tMainWindow, &tWindowState));
+	tWindowState.o.behind = -1;
+	wimpt_noerr(wimp_open_wind(&tWindowState.o));
+} /* end of vForceRedraw */
+
+/*
+ * bVerifyDiagram - Verify the diagram generated from the Word file
+ *
+ * returns TRUE if the diagram is correct
+ */
+BOOL
+bVerifyDiagram(diagram_type *pDiag)
+{
+	draw_error	tError;
+
+	fail(pDiag == NULL);
+	DBG_MSG("bVerifyDiagram");
+
+	if (draw_verify_diag(&pDiag->tInfo, &tError)) {
+		return TRUE;
+	}
+	DBG_MSG("draw_verify_diag() failed");
+	vPrintDrawError(&tError);
+	return FALSE;
+} /* end of bVerifyDiagram */
+
+/*
+ * vShowDiagram - put the diagram on the screen
+ */
+void
+vShowDiagram(diagram_type *pDiag)
+{
+	wimp_wstate	tWindowState;
+	wimp_redrawstr	tRedraw;
+
+	fail(pDiag == NULL);
+
+	DBG_MSG("vShowDiagram");
+
+	wimpt_noerr(wimp_get_wind_state(pDiag->tMainWindow, &tWindowState));
+	tWindowState.o.behind = -1;
+	wimpt_noerr(wimp_open_wind(&tWindowState.o));
+
+	draw_queryBox(&pDiag->tInfo, (draw_box *)&tRedraw.box, TRUE);
+	tRedraw.w = pDiag->tMainWindow;
+	/* Work area extension */
+	tRedraw.box.x0 -= WORKAREA_EXTENSION;
+	tRedraw.box.y0 -= WORKAREA_EXTENSION;
+	tRedraw.box.x1 += WORKAREA_EXTENSION;
+	tRedraw.box.y1 += WORKAREA_EXTENSION;
+	wimpt_noerr(wimp_set_extent(&tRedraw));
+	vForceRedraw(pDiag);
+} /* end of vShowDiagram */
+
+/*
+ * vMainButtonClick - handle mouse buttons clicks for the main screen
+ */
+static void
+vMainButtonClick(wimp_mousestr *m)
+{
+	wimp_caretstr	c;
+	wimp_wstate	ws;
+
+	fail(m == NULL);
+
+	NO_DBG_HEX(m->bbits);
+	NO_DBG_DEC(m->i);
+
+	if (m->w >= 0 &&
+	    m->i == -1 &&
+	    ((m->bbits & wimp_BRIGHT) == wimp_BRIGHT ||
+	     (m->bbits & wimp_BLEFT) == wimp_BLEFT)) {
+		/* Get the input focus */
+		wimpt_noerr(wimp_get_wind_state(m->w, &ws));
+		c.w = m->w;
+		c.i = -1;
+		c.x = m->x - ws.o.box.x0;
+		c.y = m->y - ws.o.box.y1;
+		c.height = (int)BIT(25);
+		c.index = 0;
+		wimpt_noerr(wimp_set_caret_pos(&c));
+	}
+} /* end of vMainButtonClick */
+
+/*
+ * vMainKeyPressed - handle pressed keys for the main screen
+ */
+static void
+vMainKeyPressed(int chcode, wimp_caretstr *c, diagram_type *pDiag)
+{
+	fail(c == NULL || pDiag == NULL);
+	fail(c->w != pDiag->tMainWindow);
+
+	switch (chcode) {
+	case akbd_Ctl+akbd_Fn+2:	/* Ctrl F2 */
+		vDestroyDiagram(c->w, pDiag);
+		break;
+	case akbd_Fn+3:			/* F3 */
+		vSaveDrawfile(pDiag);
+		break;
+	case akbd_Sh+akbd_Fn+3:		/* Shift F3 */
+		vSaveTextfile(pDiag);
+		break;
+	default:
+		DBG_DEC(chcode);
+		wimpt_noerr(wimp_processkey(chcode));
+	}
+} /* end of vMainKeyPressed */
+
+/*
+ * vRedrawMainWindow - redraw the main window
+ */
+static void
+vRedrawMainWindow(wimp_w tWindow, diagram_type *pDiag)
+{
+	wimp_redrawstr	r;
+	draw_error	tError;
+	double		dScaleFactor;
+	draw_diag	*pInfo;
+	BOOL		bMore;
+
+	fail(pDiag == NULL);
+	fail(pDiag->tMainWindow != tWindow);
+	fail(pDiag->iScaleFactorCurr < MIN_SCALE_FACTOR);
+	fail(pDiag->iScaleFactorCurr > MAX_SCALE_FACTOR);
+	fail(bDrawRenderDiag == NULL);
+
+	dScaleFactor = (double)pDiag->iScaleFactorCurr / 100.0;
+	pInfo = &pDiag->tInfo;
+
+	r.w = tWindow;
+	wimpt_noerr(wimp_redraw_wind(&r, &bMore));
+
+	while (bMore) {
+		if (pInfo->data != NULL) {
+			if (!bDrawRenderDiag(pInfo,
+					(draw_redrawstr *)&r,
+					dScaleFactor,
+					&tError)) {
+				DBG_MSG("bDrawRenderDiag() failed");
+				vPrintDrawError(&tError);
+			}
+		}
+		wimp_get_rectangle(&r, &bMore);
+	}
+} /* end of vRedrawMainWindow */
+
+/*
+ * vMainEventHandler - event handler for the main screen
+ */
+void
+vMainEventHandler(wimp_eventstr *pEvent, void *pvHandle)
+{
+	diagram_type	*pDiag;
+
+	fail(pEvent == NULL);
+
+	pDiag = (diagram_type *)pvHandle;
+
+	switch (pEvent->e) {
+	case wimp_ENULL:
+		break;
+	case wimp_EREDRAW:
+		vRedrawMainWindow(pEvent->data.o.w, pDiag);
+		break;
+	case wimp_EOPEN:
+		wimpt_noerr(wimp_open_wind(&pEvent->data.o));
+		break;
+	case wimp_ECLOSE:
+		vDestroyDiagram(pEvent->data.o.w, pDiag);
+		break;
+	case wimp_EBUT:
+		vMainButtonClick(&pEvent->data.but.m);
+		break;
+	case wimp_EKEY:
+		vMainKeyPressed(pEvent->data.key.chcode,
+				&pEvent->data.key.c, pDiag);
+		break;
+	default:
+		break;
+	}
+} /* end of vMainEventHandler */
+
+/*
+ * vScaleOpenAction - action to be taken when the Scale view window opens
+ */
+void
+vScaleOpenAction(diagram_type *pDiag)
+{
+	wimp_wstate	tWindowState;
+	wimp_mousestr	tMouseInfo;
+	int		iMoveX, iMoveY;
+
+	fail(pDiag == NULL);
+
+	wimpt_noerr(wimp_get_wind_state(pDiag->tScaleWindow, &tWindowState));
+	if ((tWindowState.flags & wimp_WOPEN) == wimp_WOPEN) {
+		/* The window is already open */
+		return;
+	}
+
+	DBG_MSG("vScaleOpenAction");
+
+	/* Allow the window to move in relation to the mouse position */
+	wimpt_noerr(wimp_get_point_info(&tMouseInfo));
+	iMoveX = tMouseInfo.x - tWindowState.o.box.x0 + 24;
+	iMoveY = tMouseInfo.y - tWindowState.o.box.y1 + 20;
+
+	pDiag->iScaleFactorTemp = pDiag->iScaleFactorCurr;
+	vUpdateWriteableNumber(pDiag->tScaleWindow,
+			SCALE_SCALE_WRITEABLE, pDiag->iScaleFactorTemp);
+
+	tWindowState.o.box.x0 += iMoveX;
+	tWindowState.o.box.x1 += iMoveX;
+	tWindowState.o.box.y0 += iMoveY;
+	tWindowState.o.box.y1 += iMoveY;
+	tWindowState.o.behind = -1;
+	wimpt_noerr(wimp_open_wind(&tWindowState.o));
+} /* end of vScaleOpenAction */
+
+/*
+ * vSetTitle - set the title of a window
+ */
+void
+vSetTitle(diagram_type *pDiag)
+{
+	char	szTitle[WINDOW_TITLE_LEN];
+
+	fail(pDiag == NULL);
+	fail(pDiag->szFilename[0] == '\0');
+
+	(void)sprintf(szTitle, "%.*s at %d%%",
+				FILENAME_TITLE_LEN,
+				pDiag->szFilename,
+				pDiag->iScaleFactorCurr % 1000);
+	if (strlen(pDiag->szFilename) > FILENAME_TITLE_LEN) {
+		szTitle[FILENAME_TITLE_LEN - 1] = OUR_ELLIPSIS;
+	}
+
+	win_settitle(pDiag->tMainWindow, szTitle);
+} /* end of vSetTitle */
+
+
+/*
+ * vScaleButtonClick - handle a mouse button click in the Scale view window
+ */
+static void
+vScaleButtonClick(wimp_mousestr *m, diagram_type *pDiag)
+{
+	BOOL	bCloseWindow, bRedraw;
+
+	fail(m == NULL || pDiag == NULL);
+	fail(m->w != pDiag->tScaleWindow);
+
+	bCloseWindow = FALSE;
+	bRedraw = FALSE;
+	switch (m->i) {
+	case SCALE_CANCEL_BUTTON:
+		bCloseWindow = TRUE;
+		pDiag->iScaleFactorTemp = pDiag->iScaleFactorCurr;
+		break;
+	case SCALE_SCALE_BUTTON:
+		bCloseWindow = TRUE;
+		bRedraw = pDiag->iScaleFactorCurr != pDiag->iScaleFactorTemp;
+		pDiag->iScaleFactorCurr = pDiag->iScaleFactorTemp;
+		break;
+	case SCALE_50_PCT:
+		pDiag->iScaleFactorTemp = 50;
+		break;
+	case SCALE_75_PCT:
+		pDiag->iScaleFactorTemp = 75;
+		break;
+	case SCALE_100_PCT:
+		pDiag->iScaleFactorTemp = 100;
+		break;
+	case SCALE_150_PCT:
+		pDiag->iScaleFactorTemp = 150;
+		break;
+	default:
+		DBG_DEC(m->i);
+		break;
+	}
+	if (bCloseWindow) {
+		/* Close the scale window */
+		wimpt_noerr(wimp_close_wind(m->w));
+		if (bRedraw) {
+			/* Redraw the main window */
+			vSetTitle(pDiag);
+			vForceRedraw(pDiag);
+		}
+	} else {
+		vUpdateWriteableNumber(m->w,
+				SCALE_SCALE_WRITEABLE,
+				pDiag->iScaleFactorTemp);
+	}
+} /* end of vScaleButtonClick */
+
+static void
+vScaleKeyPressed(int chcode, wimp_caretstr *c, diagram_type *pDiag)
+{
+	wimp_icon	tIcon;
+	char		*pcChar;
+	int		iTmp;
+
+	DBG_MSG("vScaleKeyPressed");
+
+	fail(c == NULL || pDiag == NULL);
+	fail(c->w != pDiag->tScaleWindow);
+
+	DBG_DEC_C(c->i != SCALE_SCALE_WRITEABLE, c->i);
+	DBG_DEC_C(c->i == SCALE_SCALE_WRITEABLE, chcode);
+
+	if (chcode != '\r' ||
+	    c->w != pDiag->tScaleWindow ||
+	    c->i != SCALE_SCALE_WRITEABLE) {
+		wimpt_noerr(wimp_processkey(chcode));
+		return;
+	}
+
+	wimpt_noerr(wimp_get_icon_info(c->w, c->i, &tIcon));
+	if ((tIcon.flags & (wimp_ITEXT|wimp_INDIRECT)) !=
+	    (wimp_ITEXT|wimp_INDIRECT)) {
+		werr(1, "Icon %d must be indirected text", (int)c->i);
+		return;
+	}
+	iTmp = (int)strtol(tIcon.data.indirecttext.buffer, &pcChar, 10);
+	if (*pcChar != '\0' && *pcChar != '\r') {
+		DBG_DEC(*pcChar);
+	} else if (iTmp < MIN_SCALE_FACTOR) {
+		pDiag->iScaleFactorTemp = MIN_SCALE_FACTOR;
+	} else if (iTmp > MAX_SCALE_FACTOR) {
+		pDiag->iScaleFactorTemp = MAX_SCALE_FACTOR;
+	} else {
+		pDiag->iScaleFactorTemp = iTmp;
+	}
+	pDiag->iScaleFactorCurr = pDiag->iScaleFactorTemp;
+	/* Close the scale window */
+	wimpt_noerr(wimp_close_wind(c->w));
+	/* Redraw the main window */
+	vSetTitle(pDiag);
+	vForceRedraw(pDiag);
+} /* end of vScaleKeyPressed */
+
+/*
+ * vScaleEventHandler - event handler for the scale view screen
+ */
+void
+vScaleEventHandler(wimp_eventstr *pEvent, void *pvHandle)
+{
+	diagram_type	*pDiag;
+
+	DBG_MSG("vScaleEventHandler");
+
+	fail(pEvent == NULL);
+
+	DBG_DEC(pEvent->e);
+
+	pDiag = (diagram_type *)pvHandle;
+
+	switch (pEvent->e) {
+	case wimp_ENULL:
+		break;
+	case wimp_EREDRAW:
+		/* handled by the WIMP */
+		break;
+	case wimp_EOPEN:
+		wimpt_noerr(wimp_open_wind(&pEvent->data.o));
+		break;
+	case wimp_ECLOSE:
+		wimpt_noerr(wimp_close_wind(pEvent->data.o.w));
+		break;
+	case wimp_EBUT:
+		vScaleButtonClick(&pEvent->data.but.m, pDiag);
+		break;
+	case wimp_EKEY:
+		vScaleKeyPressed(pEvent->data.key.chcode,
+				&pEvent->data.key.c, pDiag);
+		break;
+	default:
+		break;
+	}
+} /* end of vScaleEventHandler */

+ 46 - 0
sys/src/cmd/aux/antiword/draw.h

@@ -0,0 +1,46 @@
+/*
+ * draw.h
+ * Copyright (C) 2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Constants and macros to deal with the Draw format
+ */
+
+#if !defined(__draw_h)
+#define __draw_h 1
+
+#include "drawftypes.h"
+
+typedef struct draw_jpegstrhdr_tag {
+	draw_tagtyp	tag;	/* 1 word  */
+	draw_sizetyp	size;	/* 1 word  */
+	draw_bboxtyp	bbox;	/* 4 words */
+	int	width;		/* 1 word  */
+	int	height;		/* 1 word  */
+	int	xdpi;		/* 1 word  */
+	int	ydpi;		/* 1 word  */
+	int	trfm[6];	/* 6 words */
+	int	len;		/* 1 word  */
+} draw_jpegstrhdr;
+
+typedef struct draw_jpegstr_tag {
+	draw_tagtyp	tag;	/* 1 word  */
+	draw_sizetyp	size;	/* 1 word  */
+	draw_bboxtyp	bbox;	/* 4 words */
+	int	width;		/* 1 word  */
+	int	height;		/* 1 word  */
+	int	xdpi;		/* 1 word  */
+	int	ydpi;		/* 1 word  */
+	int	trfm[6];	/* 6 words */
+	int	len;		/* 1 word  */
+	unsigned char	*jpeg;
+} draw_jpegstr;
+
+typedef union draw_imageType_tag {
+	draw_spristr	*sprite;
+	draw_jpegstr	*jpeg;
+	char		*bytep;
+	int		*wordp;
+} draw_imageType;
+
+#endif /* !__draw_h */

+ 26 - 0
sys/src/cmd/aux/antiword/fail.c

@@ -0,0 +1,26 @@
+/*
+ * fail.c
+ * Copyright (C) 1998 A.J. van Os
+ *
+ * Description:
+ * An alternative form of assert()
+ */
+
+#include <stdlib.h>
+#include "antiword.h"
+
+#if !defined(NDEBUG)
+void
+__fail(char *szExpression, char *szFilename, int iLineNumber)
+{
+	if (szExpression == NULL || szFilename == NULL) {
+		werr(1, "Internal error: no expression");
+	}
+#if defined(DEBUG)
+	fprintf(stderr, "%s[%3d]: Internal error in '%s'\n",
+		szFilename, iLineNumber, szExpression);
+#endif /* DEBUG */
+	werr(1, "Internal error in '%s' in file %s at line %d",
+		szExpression, szFilename, iLineNumber);
+} /* end of __fail */
+#endif /* !NDEBUG */

+ 22 - 0
sys/src/cmd/aux/antiword/fail.h

@@ -0,0 +1,22 @@
+/*
+ * fail.h
+ * Copyright (C) 1998-2000 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Support for an alternative form of assert()
+ */
+
+#if !defined(__fail_h)
+#define __fail_h 1
+
+#undef fail
+
+#if defined(NDEBUG)
+#define fail(e)	((void)0)
+#else
+#define fail(e)	((e) ? __fail(#e, __FILE__, __LINE__) : (void)0)
+#endif /* NDEBUG */
+
+extern void	__fail(char *, char *, int);
+
+#endif /* __fail_h */

+ 154 - 0
sys/src/cmd/aux/antiword/finddata.c

@@ -0,0 +1,154 @@
+/*
+ * finddata.c
+ * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Find the blocks that contain the data of MS Word files
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "antiword.h"
+
+
+/*
+ * bAddDataBlocks - Add the blocks to the data block list
+ *
+ * Returns TRUE when successful, otherwise FALSE
+ */
+BOOL
+bAddDataBlocks(ULONG ulDataPosFirst, ULONG ulTotalLength,
+	ULONG ulStartBlock, const ULONG *aulBBD, size_t tBBDLen)
+{
+	data_block_type	tDataBlock;
+	ULONG	ulDataPos, ulOffset, ulIndex;
+	long	lToGo;
+	BOOL	bSuccess;
+
+	fail(ulTotalLength > (ULONG)LONG_MAX);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	NO_DBG_HEX(ulDataPosFirst);
+	NO_DBG_DEC(ulTotalLength);
+
+	lToGo = (long)ulTotalLength;
+
+	ulDataPos = ulDataPosFirst;
+	ulOffset = ulDataPosFirst;
+	for (ulIndex = ulStartBlock;
+	     ulIndex != END_OF_CHAIN && lToGo > 0;
+	     ulIndex = aulBBD[ulIndex]) {
+		if (ulIndex == UNUSED_BLOCK || ulIndex >= (ULONG)tBBDLen) {
+			DBG_DEC(ulIndex);
+			DBG_DEC(tBBDLen);
+			return FALSE;
+		}
+		if (ulOffset >= BIG_BLOCK_SIZE) {
+			ulOffset -= BIG_BLOCK_SIZE;
+			continue;
+		}
+		tDataBlock.ulFileOffset =
+			(ulIndex + 1) * BIG_BLOCK_SIZE + ulOffset;
+		tDataBlock.ulDataPos = ulDataPos;
+		tDataBlock.ulLength = min(BIG_BLOCK_SIZE - ulOffset,
+						(ULONG)lToGo);
+		fail(tDataBlock.ulLength > BIG_BLOCK_SIZE);
+		ulOffset = 0;
+		if (!bAdd2DataBlockList(&tDataBlock)) {
+			DBG_HEX(tDataBlock.ulFileOffset);
+			DBG_HEX(tDataBlock.ulDataPos);
+			DBG_DEC(tDataBlock.ulLength);
+			return FALSE;
+		}
+		ulDataPos += tDataBlock.ulLength;
+		lToGo -= (long)tDataBlock.ulLength;
+	}
+	bSuccess = lToGo == 0 ||
+		(ulTotalLength == (ULONG)LONG_MAX && ulIndex == END_OF_CHAIN);
+	DBG_DEC_C(!bSuccess, lToGo);
+	DBG_DEC_C(!bSuccess, ulTotalLength);
+	DBG_DEC_C(!bSuccess, ulIndex);
+	return bSuccess;
+} /* end of bAddDataBlocks */
+
+/*
+ * bGet6DocumentData - make a list of the data blocks of Word 6/7 files
+ *
+ * Code for "fast saved" files.
+ *
+ * Returns TRUE when successful, otherwise FALSE
+ */
+BOOL
+bGet6DocumentData(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen, const UCHAR *aucHeader)
+{
+	UCHAR	*aucBuffer;
+	ULONG	ulBeginTextInfo, ulOffset, ulTotLength;
+	size_t	tTextInfoLen;
+	int	iIndex, iOff, iType, iLen, iPieces;
+
+	DBG_MSG("bGet6DocumentData");
+
+	fail(pFile == NULL);
+	fail(aulBBD == NULL);
+	fail(aucHeader == NULL);
+
+	ulBeginTextInfo = ulGetLong(0x160, aucHeader);
+	DBG_HEX(ulBeginTextInfo);
+	tTextInfoLen = (size_t)ulGetLong(0x164, aucHeader);
+	DBG_DEC(tTextInfoLen);
+
+	aucBuffer = xmalloc(tTextInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginTextInfo, tTextInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return FALSE;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tTextInfoLen);
+
+	iOff = 0;
+	while (iOff < (int)tTextInfoLen) {
+		iType = (int)ucGetByte(iOff, aucBuffer);
+		iOff++;
+		if (iType == 0) {
+			iOff++;
+			continue;
+		}
+		iLen = (int)usGetWord(iOff, aucBuffer);
+		iOff += 2;
+		if (iType == 1) {
+			iOff += iLen;
+			continue;
+		}
+		if (iType != 2) {
+			werr(0, "Unknown type of 'fastsaved' format");
+			aucBuffer = xfree(aucBuffer);
+			return FALSE;
+		}
+		/* Type 2 */
+		NO_DBG_DEC(iLen);
+		iOff += 2;
+		iPieces = (iLen - 4) / 12;
+		DBG_DEC(iPieces);
+		for (iIndex = 0; iIndex < iPieces; iIndex++) {
+			ulOffset = ulGetLong(
+				iOff + (iPieces + 1) * 4 + iIndex * 8 + 2,
+				aucBuffer);
+			ulTotLength = ulGetLong(iOff + (iIndex + 1) * 4,
+						aucBuffer) -
+					ulGetLong(iOff + iIndex * 4,
+						aucBuffer);
+			if (!bAddDataBlocks(ulOffset, ulTotLength,
+					ulStartBlock,
+					aulBBD, tBBDLen)) {
+				aucBuffer = xfree(aucBuffer);
+				return FALSE;
+			}
+		}
+		break;
+	}
+	aucBuffer = xfree(aucBuffer);
+	return TRUE;
+} /* end of bGet6DocumentData */

+ 299 - 0
sys/src/cmd/aux/antiword/findtext.c

@@ -0,0 +1,299 @@
+/*
+ * findtext.c
+ * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Find the blocks that contain the text of MS Word files
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "antiword.h"
+
+
+/*
+ * bAddTextBlocks - Add the blocks to the text block list
+ *
+ * Returns TRUE when successful, FALSE if not
+ */
+BOOL
+bAddTextBlocks(ULONG ulCharPosFirst, ULONG ulTotalLength,
+	BOOL bUsesUnicode, USHORT usPropMod,
+	ULONG ulStartBlock, const ULONG *aulBBD, size_t tBBDLen)
+{
+	text_block_type	tTextBlock;
+	ULONG	ulCharPos, ulOffset, ulIndex;
+	long	lToGo;
+
+	fail(ulTotalLength > (ULONG)LONG_MAX / 2);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	NO_DBG_HEX(ulCharPosFirst);
+	NO_DBG_DEC(ulTotalLength);
+
+	if (bUsesUnicode) {
+		/* One character equals two bytes */
+		NO_DBG_MSG("Uses Unicode");
+		lToGo = (long)ulTotalLength * 2;
+	} else {
+		/* One character equals one byte */
+		NO_DBG_MSG("Uses ASCII");
+		lToGo = (long)ulTotalLength;
+	}
+
+	ulCharPos = ulCharPosFirst;
+	ulOffset = ulCharPosFirst;
+	for (ulIndex = ulStartBlock;
+	     ulIndex != END_OF_CHAIN && lToGo > 0;
+	     ulIndex = aulBBD[ulIndex]) {
+		if (ulIndex >= (ULONG)tBBDLen) {
+			DBG_DEC(ulIndex);
+			DBG_DEC(tBBDLen);
+			werr(1, "The Big Block Depot is damaged");
+		}
+		if (ulOffset >= BIG_BLOCK_SIZE) {
+			ulOffset -= BIG_BLOCK_SIZE;
+			continue;
+		}
+		tTextBlock.ulFileOffset =
+			(ulIndex + 1) * BIG_BLOCK_SIZE + ulOffset;
+		tTextBlock.ulCharPos = ulCharPos;
+		tTextBlock.ulLength = min(BIG_BLOCK_SIZE - ulOffset,
+						(ULONG)lToGo);
+		tTextBlock.bUsesUnicode = bUsesUnicode;
+		tTextBlock.usPropMod = usPropMod;
+		ulOffset = 0;
+		if (!bAdd2TextBlockList(&tTextBlock)) {
+			DBG_HEX(tTextBlock.ulFileOffset);
+			DBG_HEX(tTextBlock.ulCharPos);
+			DBG_DEC(tTextBlock.ulLength);
+			DBG_DEC(tTextBlock.bUsesUnicode);
+			DBG_DEC(tTextBlock.usPropMod);
+			return FALSE;
+		}
+		ulCharPos += tTextBlock.ulLength;
+		lToGo -= (long)tTextBlock.ulLength;
+	}
+	DBG_DEC_C(lToGo != 0, lToGo);
+	return lToGo == 0;
+} /* end of bAddTextBlocks */
+
+/*
+ * bGet6DocumentText - make a list of the text blocks of Word 6/7 files
+ *
+ * Code for "fast saved" files.
+ *
+ * Returns TRUE when successful, FALSE if not
+ */
+BOOL
+bGet6DocumentText(FILE *pFile, BOOL bUsesUnicode, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen, const UCHAR *aucHeader)
+{
+	UCHAR	*aucBuffer;
+	ULONG	ulBeginTextInfo, ulTextOffset, ulTotLength;
+	size_t	tTextInfoLen;
+	int	iIndex, iType, iOff, iLen, iPieces;
+	USHORT	usPropMod;
+
+	DBG_MSG("bGet6DocumentText");
+
+	fail(pFile == NULL);
+	fail(aulBBD == NULL);
+	fail(aucHeader == NULL);
+
+	ulBeginTextInfo = ulGetLong(0x160, aucHeader);	/* fcClx */
+	DBG_HEX(ulBeginTextInfo);
+	tTextInfoLen = (size_t)ulGetLong(0x164, aucHeader);	/* lcbClx */
+	DBG_DEC(tTextInfoLen);
+
+	aucBuffer = xmalloc(tTextInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginTextInfo, tTextInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return FALSE;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tTextInfoLen);
+
+	iOff = 0;
+	while ((size_t)iOff < tTextInfoLen) {
+		iType = (int)ucGetByte(iOff, aucBuffer);
+		iOff++;
+		if (iType == 0) {
+			DBG_FIXME();
+			iOff++;
+			continue;
+		}
+		if (iType == 1) {
+			iLen = (int)usGetWord(iOff, aucBuffer);
+			vAdd2PropModList(aucBuffer + iOff);
+			iOff += iLen + 2;
+			continue;
+		}
+		if (iType != 2) {
+			werr(0, "Unknown type of 'fastsaved' format");
+			aucBuffer = xfree(aucBuffer);
+			return FALSE;
+		}
+		/* Type 2 */
+		iLen = (int)usGetWord(iOff, aucBuffer);
+		NO_DBG_DEC(iLen);
+		iOff += 4;
+		iPieces = (iLen - 4) / 12;
+		DBG_DEC(iPieces);
+		for (iIndex = 0; iIndex < iPieces; iIndex++) {
+			ulTextOffset = ulGetLong(
+				iOff + (iPieces + 1) * 4 + iIndex * 8 + 2,
+				aucBuffer);
+			usPropMod = usGetWord(
+				iOff + (iPieces + 1) * 4 + iIndex * 8 + 6,
+				aucBuffer);
+			ulTotLength = ulGetLong(iOff + (iIndex + 1) * 4,
+						aucBuffer) -
+					ulGetLong(iOff + iIndex * 4,
+						aucBuffer);
+			NO_DBG_HEX_C(usPropMod != 0, usPropMod);
+			if (!bAddTextBlocks(ulTextOffset, ulTotLength,
+					bUsesUnicode, usPropMod,
+					ulStartBlock,
+					aulBBD, tBBDLen)) {
+				aucBuffer = xfree(aucBuffer);
+				return FALSE;
+			}
+		}
+		break;
+	}
+	aucBuffer = xfree(aucBuffer);
+	return TRUE;
+} /* end of bGet6DocumentText */
+
+/*
+ * bGet8DocumentText - make a list of the text blocks of Word 8/97 files
+ *
+ * Returns TRUE when successful, FALSE if not
+ */
+BOOL
+bGet8DocumentText(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucBuffer;
+	ULONG	ulTextOffset, ulBeginTextInfo;
+	ULONG	ulTotLength, ulLen;
+	ULONG	ulTableStartBlock, ulTableSize;
+	long	lIndex, lPieces, lOff;
+	size_t	tTextInfoLen, tBlockDepotLen, tBlockSize;
+	int	iType, iLen;
+	BOOL	bUsesUnicode;
+	USHORT	usDocStatus, usPropMod;
+
+	DBG_MSG("bGet8DocumentText");
+
+	fail(pFile == NULL || pPPS == NULL);
+	fail(aulBBD == NULL || aulSBD == NULL);
+	fail(aucHeader == NULL);
+
+  	ulBeginTextInfo = ulGetLong(0x1a2, aucHeader);	/* fcClx */
+	DBG_HEX(ulBeginTextInfo);
+	tTextInfoLen = (size_t)ulGetLong(0x1a6, aucHeader);	/* lcbClx */
+	DBG_DEC(tTextInfoLen);
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_DEC(ulTableStartBlock);
+		return FALSE;
+	}
+	DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+	  	/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+	  	/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+	aucBuffer = xmalloc(tTextInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginTextInfo, tTextInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return FALSE;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tTextInfoLen);
+
+	lOff = 0;
+	while (lOff < (long)tTextInfoLen) {
+		iType = (int)ucGetByte(lOff, aucBuffer);
+		lOff++;
+		if (iType == 0) {
+			DBG_FIXME();
+			lOff++;
+			continue;
+		}
+		if (iType == 1) {
+			iLen = (int)usGetWord(lOff, aucBuffer);
+			vAdd2PropModList(aucBuffer + lOff);
+			lOff += (long)iLen + 2;
+			continue;
+		}
+		if (iType != 2) {
+			werr(0, "Unknown type of 'fastsaved' format");
+			aucBuffer = xfree(aucBuffer);
+			return FALSE;
+		}
+		/* Type 2 */
+		ulLen = ulGetLong(lOff, aucBuffer);
+		if (ulLen < 4) {
+			DBG_DEC(ulLen);
+			return FALSE;
+		}
+		lOff += 4;
+		lPieces = (long)((ulLen - 4) / 12);
+		DBG_DEC(lPieces);
+		for (lIndex = 0; lIndex < lPieces; lIndex++) {
+			ulTextOffset = ulGetLong(
+				lOff + (lPieces + 1) * 4 + lIndex * 8 + 2,
+				aucBuffer);
+			usPropMod = usGetWord(
+				lOff + (lPieces + 1) * 4 + lIndex * 8 + 6,
+				aucBuffer);
+			ulTotLength = ulGetLong(lOff + (lIndex + 1) * 4,
+						aucBuffer) -
+					ulGetLong(lOff + lIndex * 4,
+						aucBuffer);
+			if ((ulTextOffset & BIT(30)) == 0) {
+				bUsesUnicode = TRUE;
+			} else {
+				bUsesUnicode = FALSE;
+				ulTextOffset &= ~BIT(30);
+				ulTextOffset /= 2;
+			}
+			NO_DBG_HEX_C(usPropMod != 0, usPropMod);
+			if (!bAddTextBlocks(ulTextOffset, ulTotLength,
+					bUsesUnicode, usPropMod,
+					pPPS->tWordDocument.ulSB,
+					aulBBD, tBBDLen)) {
+				aucBuffer = xfree(aucBuffer);
+				return FALSE;
+			}
+		}
+		break;
+	}
+	aucBuffer = xfree(aucBuffer);
+	return TRUE;
+} /* end of bGet8DocumentText */

+ 2251 - 0
sys/src/cmd/aux/antiword/fontinfo.h

@@ -0,0 +1,2251 @@
+/* THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT! */
+static const char *szFontnames[32] = {
+	"Courier",
+	"Courier-Bold",
+	"Courier-Oblique",
+	"Courier-BoldOblique",
+	"Times-Roman",
+	"Times-Bold",
+	"Times-Italic",
+	"Times-BoldItalic",
+	"Helvetica",
+	"Helvetica-Bold",
+	"Helvetica-Oblique",
+	"Helvetica-BoldOblique",
+	"Palatino-Roman",
+	"Palatino-Bold",
+	"Palatino-Italic",
+	"Palatino-BoldItalic",
+	"Helvetica-Narrow",
+	"Helvetica-Narrow-Bold",
+	"Helvetica-Narrow-Oblique",
+	"Helvetica-Narrow-BoldOblique",
+	"Bookman-Light",
+	"Bookman-Demi",
+	"Bookman-LightItalic",
+	"Bookman-DemiItalic",
+	"AvantGarde-Book",
+	"AvantGarde-Demi",
+	"AvantGarde-BookOblique",
+	"AvantGarde-DemiOblique",
+	"NewCenturySchlbk-Roman",
+	"NewCenturySchlbk-Bold",
+	"NewCenturySchlbk-Italic",
+	"NewCenturySchlbk-BoldItalic",
+};
+static unsigned short ausCharacterWidths1[32][256] = {
+	{	/* Courier */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  600,  600,  600,  600,
+	/* 144 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 152 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Courier-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  600,  600,  600,  600,
+	/* 144 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 152 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Courier-Oblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  600,  600,  600,  600,
+	/* 144 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 152 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Courier-BoldOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  600,  600,  600,  600,
+	/* 144 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 152 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Times-Roman */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  408,  500,  500,  833,  778,  333,
+	/*  40 */   333,  333,  500,  564,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  278,  278,  564,  564,  564,  444,
+	/*  64 */   921,  722,  667,  667,  722,  611,  556,  722,
+	/*  72 */   722,  333,  389,  722,  611,  889,  722,  722,
+	/*  80 */   556,  722,  667,  556,  611,  722,  722,  944,
+	/*  88 */   722,  722,  611,  333,  278,  333,  469,  500,
+	/*  96 */   333,  444,  500,  444,  500,  444,  333,  500,
+	/* 104 */   500,  278,  278,  500,  278,  778,  500,  500,
+	/* 112 */   500,  500,  333,  389,  278,  500,  500,  722,
+	/* 120 */   500,  500,  444,  480,  200,  480,  541,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  980, 1000,  350,
+	/* 144 */   333,  333,  333,  333,  444,  444,  444,  500,
+	/* 152 */  1000,  564,  889,  722,  500,  500,  556,  556,
+	/* 160 */   250,  333,  500,  500,  500,  500,  200,  500,
+	/* 168 */   333,  760,  276,  500,  564,  333,  760,  333,
+	/* 176 */   400,  564,  300,  300,  333,  500,  453,  250,
+	/* 184 */   333,  300,  310,  500,  750,  750,  750,  444,
+	/* 192 */   722,  722,  722,  722,  722,  722,  889,  667,
+	/* 200 */   611,  611,  611,  611,  333,  333,  333,  333,
+	/* 208 */   722,  722,  722,  722,  722,  722,  722,  564,
+	/* 216 */   722,  722,  722,  722,  722,  722,  556,  500,
+	/* 224 */   444,  444,  444,  444,  444,  444,  667,  444,
+	/* 232 */   444,  444,  444,  444,  278,  278,  278,  278,
+	/* 240 */   500,  500,  500,  500,  500,  500,  500,  564,
+	/* 248 */   500,  500,  500,  500,  500,  500,  500,  500,
+	},
+	{	/* Times-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  555,  500,  500, 1000,  833,  333,
+	/*  40 */   333,  333,  500,  570,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  333,  333,  570,  570,  570,  500,
+	/*  64 */   930,  722,  667,  722,  722,  667,  611,  778,
+	/*  72 */   778,  389,  500,  778,  667,  944,  722,  778,
+	/*  80 */   611,  778,  722,  556,  667,  722,  722, 1000,
+	/*  88 */   722,  722,  667,  333,  278,  333,  581,  500,
+	/*  96 */   333,  500,  556,  444,  556,  444,  333,  500,
+	/* 104 */   556,  278,  333,  556,  278,  833,  556,  500,
+	/* 112 */   556,  556,  444,  389,  333,  556,  500,  722,
+	/* 120 */   500,  500,  444,  394,  220,  394,  520,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  350,
+	/* 144 */   333,  333,  333,  333,  500,  500,  500,  500,
+	/* 152 */  1000,  570, 1000,  722,  500,  500,  556,  556,
+	/* 160 */   250,  333,  500,  500,  500,  500,  220,  500,
+	/* 168 */   333,  747,  300,  500,  570,  333,  747,  333,
+	/* 176 */   400,  570,  300,  300,  333,  556,  540,  250,
+	/* 184 */   333,  300,  330,  500,  750,  750,  750,  500,
+	/* 192 */   722,  722,  722,  722,  722,  722, 1000,  722,
+	/* 200 */   667,  667,  667,  667,  389,  389,  389,  389,
+	/* 208 */   722,  722,  778,  778,  778,  778,  778,  570,
+	/* 216 */   778,  722,  722,  722,  722,  722,  611,  556,
+	/* 224 */   500,  500,  500,  500,  500,  500,  722,  444,
+	/* 232 */   444,  444,  444,  444,  278,  278,  278,  278,
+	/* 240 */   500,  556,  500,  500,  500,  500,  500,  570,
+	/* 248 */   500,  556,  556,  556,  556,  500,  556,  500,
+	},
+	{	/* Times-Italic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  420,  500,  500,  833,  778,  333,
+	/*  40 */   333,  333,  500,  675,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  333,  333,  675,  675,  675,  500,
+	/*  64 */   920,  611,  611,  667,  722,  611,  611,  722,
+	/*  72 */   722,  333,  444,  667,  556,  833,  667,  722,
+	/*  80 */   611,  722,  611,  500,  556,  722,  611,  833,
+	/*  88 */   611,  556,  556,  389,  278,  389,  422,  500,
+	/*  96 */   333,  500,  500,  444,  500,  444,  278,  500,
+	/* 104 */   500,  278,  278,  444,  278,  722,  500,  500,
+	/* 112 */   500,  500,  389,  389,  278,  500,  444,  667,
+	/* 120 */   444,  444,  389,  400,  275,  400,  541,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  889,  980, 1000,  350,
+	/* 144 */   333,  333,  333,  333,  556,  556,  556,  500,
+	/* 152 */   889,  675,  944,  667,  500,  500,  500,  500,
+	/* 160 */   250,  389,  500,  500,  500,  500,  275,  500,
+	/* 168 */   333,  760,  276,  500,  675,  333,  760,  333,
+	/* 176 */   400,  675,  300,  300,  333,  500,  523,  250,
+	/* 184 */   333,  300,  310,  500,  750,  750,  750,  500,
+	/* 192 */   611,  611,  611,  611,  611,  611,  889,  667,
+	/* 200 */   611,  611,  611,  611,  333,  333,  333,  333,
+	/* 208 */   722,  667,  722,  722,  722,  722,  722,  675,
+	/* 216 */   722,  722,  722,  722,  722,  556,  611,  500,
+	/* 224 */   500,  500,  500,  500,  500,  500,  667,  444,
+	/* 232 */   444,  444,  444,  444,  278,  278,  278,  278,
+	/* 240 */   500,  500,  500,  500,  500,  500,  500,  675,
+	/* 248 */   500,  500,  500,  500,  500,  444,  500,  444,
+	},
+	{	/* Times-BoldItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  389,  555,  500,  500,  833,  778,  333,
+	/*  40 */   333,  333,  500,  570,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  333,  333,  570,  570,  570,  500,
+	/*  64 */   832,  667,  667,  667,  722,  667,  667,  722,
+	/*  72 */   778,  389,  500,  667,  611,  889,  722,  722,
+	/*  80 */   611,  722,  667,  556,  611,  722,  667,  889,
+	/*  88 */   667,  611,  611,  333,  278,  333,  570,  500,
+	/*  96 */   333,  500,  500,  444,  500,  444,  333,  500,
+	/* 104 */   556,  278,  278,  500,  278,  778,  556,  500,
+	/* 112 */   500,  500,  389,  389,  278,  556,  444,  667,
+	/* 120 */   500,  444,  389,  348,  220,  348,  570,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  350,
+	/* 144 */   333,  333,  333,  333,  500,  500,  500,  500,
+	/* 152 */  1000,  606,  944,  722,  500,  500,  556,  556,
+	/* 160 */   250,  389,  500,  500,  500,  500,  220,  500,
+	/* 168 */   333,  747,  266,  500,  606,  333,  747,  333,
+	/* 176 */   400,  570,  300,  300,  333,  576,  500,  250,
+	/* 184 */   333,  300,  300,  500,  750,  750,  750,  500,
+	/* 192 */   667,  667,  667,  667,  667,  667,  944,  667,
+	/* 200 */   667,  667,  667,  667,  389,  389,  389,  389,
+	/* 208 */   722,  722,  722,  722,  722,  722,  722,  570,
+	/* 216 */   722,  722,  722,  722,  722,  611,  611,  500,
+	/* 224 */   500,  500,  500,  500,  500,  500,  722,  444,
+	/* 232 */   444,  444,  444,  444,  278,  278,  278,  278,
+	/* 240 */   500,  556,  500,  500,  500,  500,  500,  570,
+	/* 248 */   500,  556,  556,  556,  556,  444,  500,  444,
+	},
+	{	/* Helvetica */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  278,  355,  556,  556,  889,  667,  221,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  584,  584,  584,  556,
+	/*  64 */  1015,  667,  667,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  500,  667,  556,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  278,  278,  278,  469,  556,
+	/*  96 */   222,  556,  556,  500,  556,  556,  278,  556,
+	/* 104 */   556,  222,  222,  500,  222,  833,  556,  556,
+	/* 112 */   556,  556,  333,  500,  278,  556,  500,  722,
+	/* 120 */   500,  500,  500,  334,  260,  334,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  350,
+	/* 144 */   222,  221,  333,  333,  333,  333,  333,  556,
+	/* 152 */  1000,  584, 1000,  944,  556,  556,  500,  500,
+	/* 160 */   278,  333,  556,  556,  556,  556,  260,  556,
+	/* 168 */   333,  737,  370,  556,  584,  333,  737,  333,
+	/* 176 */   606,  584,  351,  351,  333,  556,  537,  278,
+	/* 184 */   333,  351,  365,  556,  869,  869,  869,  611,
+	/* 192 */   667,  667,  667,  667,  667,  667, 1000,  722,
+	/* 200 */   667,  667,  667,  667,  278,  278,  278,  278,
+	/* 208 */   722,  722,  778,  778,  778,  778,  778,  584,
+	/* 216 */   778,  722,  722,  722,  722,  666,  666,  611,
+	/* 224 */   556,  556,  556,  556,  556,  556,  889,  500,
+	/* 232 */   556,  556,  556,  556,  278,  278,  278,  278,
+	/* 240 */   556,  556,  556,  556,  556,  556,  556,  584,
+	/* 248 */   611,  556,  556,  556,  556,  500,  555,  500,
+	},
+	{	/* Helvetica-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  333,  474,  556,  556,  889,  722,  278,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  333,  333,  584,  584,  584,  611,
+	/*  64 */   975,  722,  722,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  556,  722,  611,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  333,  278,  333,  584,  556,
+	/*  96 */   278,  556,  611,  556,  611,  556,  333,  611,
+	/* 104 */   611,  278,  278,  556,  278,  889,  611,  611,
+	/* 112 */   611,  611,  389,  556,  333,  611,  556,  778,
+	/* 120 */   556,  556,  500,  389,  280,  389,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  350,
+	/* 144 */   278,  278,  333,  333,  500,  500,  500,  556,
+	/* 152 */  1000,  584, 1000,  944,  556,  556,  611,  611,
+	/* 160 */   278,  333,  556,  556,  556,  556,  280,  556,
+	/* 168 */   333,  737,  370,  556,  584,  333,  737,  333,
+	/* 176 */   606,  584,  351,  351,  333,  611,  556,  278,
+	/* 184 */   333,  351,  365,  556,  869,  869,  869,  611,
+	/* 192 */   722,  722,  722,  722,  722,  722, 1000,  722,
+	/* 200 */   667,  667,  667,  667,  278,  278,  278,  278,
+	/* 208 */   722,  722,  778,  778,  778,  778,  778,  584,
+	/* 216 */   778,  722,  722,  722,  722,  667,  667,  611,
+	/* 224 */   556,  556,  556,  556,  556,  556,  889,  556,
+	/* 232 */   556,  556,  556,  556,  278,  278,  278,  278,
+	/* 240 */   611,  611,  611,  611,  611,  611,  611,  584,
+	/* 248 */   611,  611,  611,  611,  611,  556,  611,  556,
+	},
+	{	/* Helvetica-Oblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  278,  355,  556,  556,  889,  667,  222,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  584,  584,  584,  556,
+	/*  64 */  1015,  667,  667,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  500,  667,  556,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  278,  278,  278,  469,  556,
+	/*  96 */   222,  556,  556,  500,  556,  556,  278,  556,
+	/* 104 */   556,  222,  222,  500,  222,  833,  556,  556,
+	/* 112 */   556,  556,  333,  500,  278,  556,  500,  722,
+	/* 120 */   500,  500,  500,  334,  260,  334,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  350,
+	/* 144 */   222,  222,  333,  333,  333,  333,  333,  556,
+	/* 152 */  1000,  584, 1000,  944,  556,  556,  500,  500,
+	/* 160 */   278,  333,  556,  556,  556,  556,  260,  556,
+	/* 168 */   333,  737,  370,  556,  584,  333,  737,  333,
+	/* 176 */   606,  584,  390,  390,  333,  556,  537,  278,
+	/* 184 */   333,  390,  365,  556,  947,  947,  947,  611,
+	/* 192 */   667,  667,  667,  667,  667,  667, 1000,  722,
+	/* 200 */   667,  667,  667,  667,  278,  278,  278,  278,
+	/* 208 */   722,  722,  778,  778,  778,  778,  778,  584,
+	/* 216 */   778,  722,  722,  722,  722,  667,  667,  611,
+	/* 224 */   556,  556,  556,  556,  556,  556,  889,  500,
+	/* 232 */   556,  556,  556,  556,  278,  278,  278,  278,
+	/* 240 */   556,  556,  556,  556,  556,  556,  556,  584,
+	/* 248 */   611,  556,  556,  556,  556,  500,  556,  500,
+	},
+	{	/* Helvetica-BoldOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  333,  474,  556,  556,  889,  722,  278,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  333,  333,  584,  584,  584,  611,
+	/*  64 */   975,  722,  722,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  556,  722,  611,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  333,  278,  333,  584,  556,
+	/*  96 */   278,  556,  611,  556,  611,  556,  333,  611,
+	/* 104 */   611,  278,  278,  556,  278,  889,  611,  611,
+	/* 112 */   611,  611,  389,  556,  333,  611,  556,  778,
+	/* 120 */   556,  556,  500,  389,  280,  389,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  350,
+	/* 144 */   278,  278,  333,  333,  500,  500,  500,  556,
+	/* 152 */  1000,  584, 1000,  944,  556,  556,  611,  611,
+	/* 160 */   278,  333,  556,  556,  556,  556,  280,  556,
+	/* 168 */   333,  737,  370,  556,  584,  333,  737,  333,
+	/* 176 */   606,  584,  444,  444,  333,  611,  556,  278,
+	/* 184 */   333,  444,  365,  556, 1055, 1055, 1055,  611,
+	/* 192 */   722,  722,  722,  722,  722,  722, 1000,  722,
+	/* 200 */   667,  667,  667,  667,  278,  278,  278,  278,
+	/* 208 */   722,  722,  778,  778,  778,  778,  778,  584,
+	/* 216 */   778,  722,  722,  722,  722,  667,  667,  611,
+	/* 224 */   556,  556,  556,  556,  556,  556,  889,  556,
+	/* 232 */   556,  556,  556,  556,  278,  278,  278,  278,
+	/* 240 */   611,  611,  611,  611,  611,  611,  611,  584,
+	/* 248 */   611,  611,  611,  611,  611,  556,  611,  556,
+	},
+	{	/* Palatino-Roman */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  278,  371,  500,  500,  840,  778,  278,
+	/*  40 */   333,  333,  389,  606,  250,  333,  250,  606,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  444,
+	/*  64 */   747,  778,  611,  709,  774,  611,  556,  763,
+	/*  72 */   832,  337,  333,  726,  611,  946,  831,  786,
+	/*  80 */   604,  786,  668,  525,  613,  778,  722, 1000,
+	/*  88 */   667,  667,  667,  333,  606,  333,  606,  500,
+	/*  96 */   278,  500,  553,  444,  611,  479,  333,  556,
+	/* 104 */   582,  291,  234,  556,  291,  883,  582,  546,
+	/* 112 */   601,  560,  395,  424,  326,  603,  565,  834,
+	/* 120 */   516,  556,  500,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  979, 1144,  606,
+	/* 144 */   278,  278,  331,  331,  500,  500,  500,  500,
+	/* 152 */  1000,  606,  998,  827,  500,  500,  605,  608,
+	/* 160 */   250,  278,  500,  500,  500,  500,  606,  500,
+	/* 168 */   333,  747,  333,  500,  606,  333,  747,  333,
+	/* 176 */   400,  606,  300,  300,  333,  603,  628,  250,
+	/* 184 */   333,  300,  333,  500,  750,  750,  750,  444,
+	/* 192 */   778,  778,  778,  778,  778,  778,  944,  709,
+	/* 200 */   611,  611,  611,  611,  337,  337,  337,  337,
+	/* 208 */   774,  831,  786,  786,  786,  786,  786,  606,
+	/* 216 */   833,  778,  778,  778,  778,  667,  604,  556,
+	/* 224 */   500,  500,  500,  500,  500,  500,  758,  444,
+	/* 232 */   479,  479,  479,  479,  287,  287,  287,  287,
+	/* 240 */   546,  582,  546,  546,  546,  546,  546,  606,
+	/* 248 */   556,  603,  603,  603,  603,  556,  601,  556,
+	},
+	{	/* Palatino-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  278,  402,  500,  500,  889,  833,  278,
+	/*  40 */   333,  333,  444,  606,  250,  333,  250,  296,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  444,
+	/*  64 */   747,  778,  667,  722,  833,  611,  556,  833,
+	/*  72 */   833,  389,  389,  778,  611, 1000,  833,  833,
+	/*  80 */   611,  833,  722,  611,  667,  778,  778, 1000,
+	/*  88 */   667,  667,  667,  333,  606,  333,  606,  500,
+	/*  96 */   278,  500,  611,  444,  611,  500,  389,  556,
+	/* 104 */   611,  333,  333,  611,  333,  889,  611,  556,
+	/* 112 */   611,  611,  389,  444,  333,  611,  556,  833,
+	/* 120 */   500,  556,  500,  310,  606,  310,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  998, 1000,  606,
+	/* 144 */   278,  278,  389,  389,  500,  500,  500,  500,
+	/* 152 */  1000,  606, 1000,  833,  500,  500,  611,  611,
+	/* 160 */   250,  278,  500,  500,  500,  500,  606,  500,
+	/* 168 */   333,  747,  438,  500,  606,  333,  747,  333,
+	/* 176 */   400,  606,  300,  300,  333,  611,  641,  250,
+	/* 184 */   333,  300,  488,  500,  750,  750,  750,  444,
+	/* 192 */   778,  778,  778,  778,  778,  778, 1000,  722,
+	/* 200 */   611,  611,  611,  611,  389,  389,  389,  389,
+	/* 208 */   833,  833,  833,  833,  833,  833,  833,  606,
+	/* 216 */   833,  778,  778,  778,  778,  667,  611,  611,
+	/* 224 */   500,  500,  500,  500,  500,  500,  778,  444,
+	/* 232 */   500,  500,  500,  500,  333,  333,  333,  333,
+	/* 240 */   556,  611,  556,  556,  556,  556,  556,  606,
+	/* 248 */   556,  611,  611,  611,  611,  556,  611,  556,
+	},
+	{	/* Palatino-Italic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  500,  500,  500,  889,  778,  278,
+	/*  40 */   333,  333,  389,  606,  250,  333,  250,  296,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  500,
+	/*  64 */   747,  722,  611,  667,  778,  611,  556,  722,
+	/*  72 */   778,  333,  333,  667,  556,  944,  778,  778,
+	/*  80 */   611,  778,  667,  556,  611,  778,  722,  944,
+	/*  88 */   722,  667,  667,  333,  606,  333,  606,  500,
+	/*  96 */   278,  444,  463,  407,  500,  389,  278,  500,
+	/* 104 */   500,  278,  278,  444,  278,  778,  556,  444,
+	/* 112 */   500,  463,  389,  389,  333,  556,  500,  722,
+	/* 120 */   500,  500,  444,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  500,
+	/* 144 */   278,  278,  333,  333,  500,  500,  500,  500,
+	/* 152 */  1000,  606, 1028,  669,  500,  500,  528,  545,
+	/* 160 */   250,  333,  500,  500,  500,  500,  606,  500,
+	/* 168 */   333,  747,  333,  500,  606,  333,  747,  333,
+	/* 176 */   400,  606,  300,  300,  333,  556,  500,  250,
+	/* 184 */   333,  300,  333,  500,  750,  750,  750,  500,
+	/* 192 */   722,  722,  722,  722,  722,  722,  941,  667,
+	/* 200 */   611,  611,  611,  611,  333,  333,  333,  333,
+	/* 208 */   778,  778,  778,  778,  778,  778,  778,  606,
+	/* 216 */   778,  778,  778,  778,  778,  667,  611,  500,
+	/* 224 */   444,  444,  444,  444,  444,  444,  638,  407,
+	/* 232 */   389,  389,  389,  389,  278,  278,  278,  278,
+	/* 240 */   444,  556,  444,  444,  444,  444,  444,  606,
+	/* 248 */   444,  556,  556,  556,  556,  500,  500,  500,
+	},
+	{	/* Palatino-BoldItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  500,  500,  500,  889,  833,  278,
+	/*  40 */   333,  333,  444,  606,  250,  389,  250,  315,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  444,
+	/*  64 */   833,  722,  667,  685,  778,  611,  556,  778,
+	/*  72 */   778,  389,  389,  722,  611,  944,  778,  833,
+	/*  80 */   667,  833,  722,  556,  611,  778,  667, 1000,
+	/*  88 */   722,  611,  667,  333,  606,  333,  606,  500,
+	/*  96 */   278,  556,  537,  444,  556,  444,  333,  500,
+	/* 104 */   556,  333,  333,  556,  333,  833,  556,  556,
+	/* 112 */   556,  537,  389,  444,  389,  556,  556,  833,
+	/* 120 */   500,  556,  500,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  606,
+	/* 144 */   278,  278,  333,  333,  500,  500,  500,  500,
+	/* 152 */  1000,  606,  944,  778,  556,  556,  611,  611,
+	/* 160 */   250,  333,  500,  500,  500,  500,  606,  556,
+	/* 168 */   333,  747,  333,  500,  606,  389,  747,  333,
+	/* 176 */   400,  606,  300,  300,  333,  556,  556,  250,
+	/* 184 */   333,  300,  333,  500,  750,  750,  750,  444,
+	/* 192 */   722,  722,  722,  722,  722,  722,  944,  685,
+	/* 200 */   611,  611,  611,  611,  389,  389,  389,  389,
+	/* 208 */   778,  778,  833,  833,  833,  833,  833,  606,
+	/* 216 */   833,  778,  778,  778,  778,  611,  667,  556,
+	/* 224 */   556,  556,  556,  556,  556,  556,  738,  444,
+	/* 232 */   444,  444,  444,  444,  333,  333,  333,  333,
+	/* 240 */   556,  556,  556,  556,  556,  556,  556,  606,
+	/* 248 */   556,  556,  556,  556,  556,  556,  556,  556,
+	},
+	{	/* Helvetica-Narrow */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  228,  291,  456,  456,  729,  547,  182,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  228,  228,  479,  479,  479,  456,
+	/*  64 */   832,  547,  547,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  410,  547,  456,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  228,  228,  228,  385,  456,
+	/*  96 */   182,  456,  456,  410,  456,  456,  228,  456,
+	/* 104 */   456,  182,  182,  410,  182,  683,  456,  456,
+	/* 112 */   456,  456,  273,  410,  228,  456,  410,  592,
+	/* 120 */   410,  410,  410,  274,  213,  274,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  820,  820,  820,  287,
+	/* 144 */   182,  182,  273,  273,  273,  273,  273,  456,
+	/* 152 */   820,  479,  820,  774,  456,  456,  410,  410,
+	/* 160 */   228,  273,  456,  456,  456,  456,  213,  456,
+	/* 168 */   273,  604,  303,  456,  479,  273,  604,  273,
+	/* 176 */   328,  479,  273,  273,  273,  456,  440,  228,
+	/* 184 */   273,  273,  299,  456,  684,  684,  684,  501,
+	/* 192 */   547,  547,  547,  547,  547,  547,  820,  592,
+	/* 200 */   547,  547,  547,  547,  228,  228,  228,  228,
+	/* 208 */   592,  592,  638,  638,  638,  638,  638,  479,
+	/* 216 */   638,  592,  592,  592,  592,  547,  547,  501,
+	/* 224 */   456,  456,  456,  456,  456,  456,  729,  410,
+	/* 232 */   456,  456,  456,  456,  228,  228,  228,  228,
+	/* 240 */   456,  456,  456,  456,  456,  456,  456,  479,
+	/* 248 */   501,  456,  456,  456,  456,  410,  456,  410,
+	},
+	{	/* Helvetica-Narrow-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  273,  389,  456,  456,  729,  592,  228,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  273,  273,  479,  479,  479,  501,
+	/*  64 */   800,  592,  592,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  456,  592,  501,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  273,  228,  273,  479,  456,
+	/*  96 */   228,  456,  501,  456,  501,  456,  273,  501,
+	/* 104 */   501,  228,  228,  456,  228,  729,  501,  501,
+	/* 112 */   501,  501,  319,  456,  273,  501,  456,  638,
+	/* 120 */   456,  456,  410,  319,  230,  319,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  820,  820,  820,  287,
+	/* 144 */   228,  228,  273,  273,  410,  410,  410,  456,
+	/* 152 */   820,  479,  820,  774,  456,  456,  501,  501,
+	/* 160 */   228,  273,  456,  456,  456,  456,  230,  456,
+	/* 168 */   273,  604,  303,  456,  479,  273,  604,  273,
+	/* 176 */   328,  479,  273,  273,  273,  501,  456,  228,
+	/* 184 */   273,  273,  299,  456,  684,  684,  684,  501,
+	/* 192 */   592,  592,  592,  592,  592,  592,  820,  592,
+	/* 200 */   547,  547,  547,  547,  228,  228,  228,  228,
+	/* 208 */   592,  592,  638,  638,  638,  638,  638,  479,
+	/* 216 */   638,  592,  592,  592,  592,  547,  547,  501,
+	/* 224 */   456,  456,  456,  456,  456,  456,  729,  456,
+	/* 232 */   456,  456,  456,  456,  228,  228,  228,  228,
+	/* 240 */   501,  501,  501,  501,  501,  501,  501,  479,
+	/* 248 */   501,  501,  501,  501,  501,  456,  501,  456,
+	},
+	{	/* Helvetica-Narrow-Oblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  228,  291,  456,  456,  729,  547,  182,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  228,  228,  479,  479,  479,  456,
+	/*  64 */   832,  547,  547,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  410,  547,  456,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  228,  228,  228,  385,  456,
+	/*  96 */   182,  456,  456,  410,  456,  456,  228,  456,
+	/* 104 */   456,  182,  182,  410,  182,  683,  456,  456,
+	/* 112 */   456,  456,  273,  410,  228,  456,  410,  592,
+	/* 120 */   410,  410,  410,  274,  213,  274,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  820,  820,  820,  287,
+	/* 144 */   182,  182,  273,  273,  273,  273,  273,  456,
+	/* 152 */   820,  479,  820,  774,  456,  456,  410,  410,
+	/* 160 */   228,  273,  456,  456,  456,  456,  213,  456,
+	/* 168 */   273,  604,  303,  456,  479,  273,  604,  273,
+	/* 176 */   328,  479,  273,  273,  273,  456,  440,  228,
+	/* 184 */   273,  273,  299,  456,  684,  684,  684,  501,
+	/* 192 */   547,  547,  547,  547,  547,  547,  820,  592,
+	/* 200 */   547,  547,  547,  547,  228,  228,  228,  228,
+	/* 208 */   592,  592,  638,  638,  638,  638,  638,  479,
+	/* 216 */   638,  592,  592,  592,  592,  547,  547,  501,
+	/* 224 */   456,  456,  456,  456,  456,  456,  729,  410,
+	/* 232 */   456,  456,  456,  456,  228,  228,  228,  228,
+	/* 240 */   456,  456,  456,  456,  456,  456,  456,  479,
+	/* 248 */   501,  456,  456,  456,  456,  410,  456,  410,
+	},
+	{	/* Helvetica-Narrow-BoldOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  273,  389,  456,  456,  729,  592,  228,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  273,  273,  479,  479,  479,  501,
+	/*  64 */   800,  592,  592,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  456,  592,  501,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  273,  228,  273,  479,  456,
+	/*  96 */   228,  456,  501,  456,  501,  456,  273,  501,
+	/* 104 */   501,  228,  228,  456,  228,  729,  501,  501,
+	/* 112 */   501,  501,  319,  456,  273,  501,  456,  638,
+	/* 120 */   456,  456,  410,  319,  230,  319,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,  820,  820,  820,  287,
+	/* 144 */   228,  228,  273,  273,  410,  410,  410,  456,
+	/* 152 */   820,  479,  820,  774,  456,  456,  501,  501,
+	/* 160 */   228,  273,  456,  456,  456,  456,  230,  456,
+	/* 168 */   273,  604,  303,  456,  479,  273,  604,  273,
+	/* 176 */   328,  479,  273,  273,  273,  501,  456,  228,
+	/* 184 */   273,  273,  299,  456,  684,  684,  684,  501,
+	/* 192 */   592,  592,  592,  592,  592,  592,  820,  592,
+	/* 200 */   547,  547,  547,  547,  228,  228,  228,  228,
+	/* 208 */   592,  592,  638,  638,  638,  638,  638,  479,
+	/* 216 */   638,  592,  592,  592,  592,  547,  547,  501,
+	/* 224 */   456,  456,  456,  456,  456,  456,  729,  456,
+	/* 232 */   456,  456,  456,  456,  228,  228,  228,  228,
+	/* 240 */   501,  501,  501,  501,  501,  501,  501,  479,
+	/* 248 */   501,  501,  501,  501,  501,  456,  501,  456,
+	},
+	{	/* Bookman-Light */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   320,  300,  380,  620,  620,  900,  800,  220,
+	/*  40 */   300,  300,  440,  600,  320,  400,  320,  600,
+	/*  48 */   620,  620,  620,  620,  620,  620,  620,  620,
+	/*  56 */   620,  620,  320,  320,  600,  600,  600,  540,
+	/*  64 */   820,  680,  740,  740,  800,  720,  640,  800,
+	/*  72 */   800,  340,  600,  720,  600,  920,  740,  800,
+	/*  80 */   620,  820,  720,  660,  620,  780,  700,  960,
+	/*  88 */   720,  640,  640,  300,  600,  300,  600,  500,
+	/*  96 */   220,  580,  620,  520,  620,  520,  320,  540,
+	/* 104 */   660,  300,  300,  620,  300,  940,  660,  560,
+	/* 112 */   620,  580,  440,  520,  380,  680,  520,  780,
+	/* 120 */   560,  540,  480,  280,  600,  280,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  980, 1280,  460,
+	/* 144 */   220,  220,  240,  240,  400,  400,  400,  500,
+	/* 152 */  1000,  600, 1240,  900,  540,  540,  620,  620,
+	/* 160 */   320,  300,  620,  620,  620,  620,  600,  520,
+	/* 168 */   420,  740,  420,  360,  600,  400,  740,  440,
+	/* 176 */   400,  600,  372,  372,  340,  680,  600,  320,
+	/* 184 */   320,  372,  420,  360,  930,  930,  930,  540,
+	/* 192 */   680,  680,  680,  680,  680,  680, 1260,  740,
+	/* 200 */   720,  720,  720,  720,  340,  340,  340,  340,
+	/* 208 */   800,  740,  800,  800,  800,  800,  800,  600,
+	/* 216 */   800,  780,  780,  780,  780,  640,  620,  660,
+	/* 224 */   580,  580,  580,  580,  580,  580,  860,  520,
+	/* 232 */   520,  520,  520,  520,  300,  300,  300,  300,
+	/* 240 */   560,  660,  560,  560,  560,  560,  560,  600,
+	/* 248 */   560,  680,  680,  680,  680,  540,  620,  540,
+	},
+	{	/* Bookman-Demi */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   340,  360,  420,  660,  660,  940,  800,  320,
+	/*  40 */   320,  320,  460,  600,  340,  360,  340,  600,
+	/*  48 */   660,  660,  660,  660,  660,  660,  660,  660,
+	/*  56 */   660,  660,  340,  340,  600,  600,  600,  660,
+	/*  64 */   820,  720,  720,  740,  780,  720,  680,  780,
+	/*  72 */   820,  400,  640,  800,  640,  940,  740,  800,
+	/*  80 */   660,  800,  780,  660,  700,  740,  720,  940,
+	/*  88 */   780,  700,  640,  300,  600,  300,  600,  500,
+	/*  96 */   320,  580,  600,  580,  640,  580,  380,  580,
+	/* 104 */   680,  360,  340,  660,  340, 1000,  680,  620,
+	/* 112 */   640,  620,  460,  520,  460,  660,  600,  800,
+	/* 120 */   600,  620,  560,  320,  600,  320,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  980, 1360,  460,
+	/* 144 */   320,  320,  220,  220,  540,  540,  540,  500,
+	/* 152 */  1000,  600, 1220,  940,  440,  380,  740,  740,
+	/* 160 */   340,  360,  660,  660,  660,  660,  600,  600,
+	/* 168 */   500,  740,  400,  400,  600,  360,  740,  460,
+	/* 176 */   400,  600,  396,  396,  400,  660,  800,  340,
+	/* 184 */   360,  396,  400,  400,  990,  990,  990,  660,
+	/* 192 */   720,  720,  720,  720,  720,  720, 1140,  740,
+	/* 200 */   720,  720,  720,  720,  400,  400,  400,  400,
+	/* 208 */   780,  740,  800,  800,  800,  800,  800,  600,
+	/* 216 */   800,  740,  740,  740,  740,  700,  660,  660,
+	/* 224 */   580,  580,  580,  580,  580,  580,  880,  580,
+	/* 232 */   580,  580,  580,  580,  360,  360,  360,  360,
+	/* 240 */   620,  680,  620,  620,  620,  620,  620,  600,
+	/* 248 */   620,  660,  660,  660,  660,  620,  640,  620,
+	},
+	{	/* Bookman-LightItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   300,  320,  360,  620,  620,  800,  820,  280,
+	/*  40 */   280,  280,  440,  600,  300,  320,  300,  600,
+	/*  48 */   620,  620,  620,  620,  620,  620,  620,  620,
+	/*  56 */   620,  620,  300,  300,  600,  600,  600,  540,
+	/*  64 */   780,  700,  720,  720,  740,  680,  620,  760,
+	/*  72 */   800,  320,  560,  720,  580,  860,  720,  760,
+	/*  80 */   600,  780,  700,  640,  600,  720,  680,  960,
+	/*  88 */   700,  660,  580,  260,  600,  260,  600,  500,
+	/*  96 */   280,  620,  600,  480,  640,  540,  340,  560,
+	/* 104 */   620,  280,  280,  600,  280,  880,  620,  540,
+	/* 112 */   600,  560,  400,  540,  340,  620,  540,  880,
+	/* 120 */   540,  600,  520,  360,  600,  380,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  980, 1180,  460,
+	/* 144 */   280,  280,  180,  180,  440,  440,  480,  500,
+	/* 152 */  1000,  600, 1180,  900,  620,  620,  640,  660,
+	/* 160 */   300,  320,  620,  620,  620,  620,  600,  620,
+	/* 168 */   420,  740,  440,  300,  600,  320,  740,  440,
+	/* 176 */   400,  600,  372,  372,  320,  620,  620,  300,
+	/* 184 */   320,  372,  400,  300,  930,  930,  930,  540,
+	/* 192 */   700,  700,  700,  700,  700,  700, 1220,  720,
+	/* 200 */   680,  680,  680,  680,  320,  320,  320,  320,
+	/* 208 */   740,  720,  760,  760,  760,  760,  760,  600,
+	/* 216 */   760,  720,  720,  720,  720,  660,  600,  620,
+	/* 224 */   620,  620,  620,  620,  620,  620,  880,  480,
+	/* 232 */   540,  540,  540,  540,  280,  280,  280,  280,
+	/* 240 */   540,  620,  540,  540,  540,  540,  540,  600,
+	/* 248 */   540,  620,  620,  620,  620,  600,  600,  600,
+	},
+	{	/* Bookman-DemiItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   340,  320,  380,  680,  680,  880,  980,  320,
+	/*  40 */   260,  260,  460,  600,  340,  280,  340,  360,
+	/*  48 */   680,  680,  680,  680,  680,  680,  680,  680,
+	/*  56 */   680,  680,  340,  340,  620,  600,  620,  620,
+	/*  64 */   780,  720,  720,  700,  760,  720,  660,  760,
+	/*  72 */   800,  380,  620,  780,  640,  860,  740,  760,
+	/*  80 */   640,  760,  740,  700,  700,  740,  660, 1000,
+	/*  88 */   740,  660,  680,  260,  580,  260,  620,  500,
+	/*  96 */   320,  680,  600,  560,  680,  560,  420,  620,
+	/* 104 */   700,  380,  320,  700,  380,  960,  680,  600,
+	/* 112 */   660,  620,  500,  540,  440,  680,  540,  860,
+	/* 120 */   620,  600,  560,  300,  620,  300,  620,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  940, 1360,  360,
+	/* 144 */   320,  320,  220,  220,  520,  520,  520,  500,
+	/* 152 */  1000,  600, 1180,  920,  420,  420,  820,  820,
+	/* 160 */   340,  320,  680,  680,  680,  680,  620,  620,
+	/* 168 */   520,  780,  440,  380,  620,  280,  780,  480,
+	/* 176 */   400,  600,  408,  408,  340,  680,  680,  340,
+	/* 184 */   360,  408,  440,  380, 1020, 1020, 1020,  620,
+	/* 192 */   720,  720,  720,  720,  720,  720, 1140,  700,
+	/* 200 */   720,  720,  720,  720,  380,  380,  380,  380,
+	/* 208 */   760,  740,  760,  760,  760,  760,  760,  600,
+	/* 216 */   760,  740,  740,  740,  740,  660,  640,  660,
+	/* 224 */   680,  680,  680,  680,  680,  680,  880,  560,
+	/* 232 */   560,  560,  560,  560,  380,  380,  380,  380,
+	/* 240 */   600,  680,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  680,  680,  680,  680,  600,  660,  600,
+	},
+	{	/* AvantGarde-Book */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   277,  295,  309,  554,  554,  775,  757,  351,
+	/*  40 */   369,  369,  425,  606,  277,  332,  277,  437,
+	/*  48 */   554,  554,  554,  554,  554,  554,  554,  554,
+	/*  56 */   554,  554,  277,  277,  606,  606,  606,  591,
+	/*  64 */   867,  740,  574,  813,  744,  536,  485,  872,
+	/*  72 */   683,  226,  482,  591,  462,  919,  740,  869,
+	/*  80 */   592,  871,  607,  498,  426,  655,  702,  960,
+	/*  88 */   609,  592,  480,  351,  605,  351,  606,  500,
+	/*  96 */   351,  683,  682,  647,  685,  650,  314,  673,
+	/* 104 */   610,  200,  203,  502,  200,  938,  610,  655,
+	/* 112 */   682,  682,  301,  388,  339,  608,  554,  831,
+	/* 120 */   480,  536,  425,  351,  672,  351,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1174,  606,
+	/* 144 */   351,  351,  251,  251,  502,  484,  502,  500,
+	/* 152 */  1000,  606, 1194, 1137,  553,  553,  487,  485,
+	/* 160 */   277,  295,  554,  554,  554,  554,  672,  615,
+	/* 168 */   369,  747,  369,  425,  606,  332,  747,  485,
+	/* 176 */   400,  606,  332,  332,  375,  608,  564,  277,
+	/* 184 */   324,  332,  369,  425,  831,  831,  831,  591,
+	/* 192 */   740,  740,  740,  740,  740,  740,  992,  813,
+	/* 200 */   536,  536,  536,  536,  226,  226,  226,  226,
+	/* 208 */   790,  740,  869,  869,  869,  869,  869,  606,
+	/* 216 */   868,  655,  655,  655,  655,  592,  592,  554,
+	/* 224 */   683,  683,  683,  683,  683,  683, 1157,  647,
+	/* 232 */   650,  650,  650,  650,  200,  200,  200,  200,
+	/* 240 */   655,  610,  655,  655,  655,  655,  655,  606,
+	/* 248 */   653,  608,  608,  608,  608,  536,  682,  536,
+	},
+	{	/* AvantGarde-Demi */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   280,  280,  360,  560,  560,  860,  680,  280,
+	/*  40 */   380,  380,  440,  600,  280,  420,  280,  460,
+	/*  48 */   560,  560,  560,  560,  560,  560,  560,  560,
+	/*  56 */   560,  560,  280,  280,  600,  600,  600,  560,
+	/*  64 */   740,  740,  580,  780,  700,  520,  480,  840,
+	/*  72 */   680,  280,  480,  620,  440,  900,  740,  840,
+	/*  80 */   560,  840,  580,  520,  420,  640,  700,  900,
+	/*  88 */   680,  620,  500,  320,  640,  320,  600,  500,
+	/*  96 */   280,  660,  660,  640,  660,  640,  280,  660,
+	/* 104 */   600,  240,  260,  580,  240,  940,  600,  640,
+	/* 112 */   660,  660,  320,  440,  300,  600,  560,  800,
+	/* 120 */   560,  580,  460,  340,  600,  340,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1280,  600,
+	/* 144 */   280,  280,  240,  240,  480,  480,  480,  500,
+	/* 152 */  1000,  600, 1060, 1080,  560,  560,  520,  520,
+	/* 160 */   280,  280,  560,  560,  560,  560,  600,  560,
+	/* 168 */   500,  740,  360,  460,  600,  420,  740,  420,
+	/* 176 */   400,  600,  336,  336,  420,  576,  600,  280,
+	/* 184 */   340,  336,  360,  460,  840,  840,  840,  560,
+	/* 192 */   740,  740,  740,  740,  740,  740,  900,  780,
+	/* 200 */   520,  520,  520,  520,  280,  280,  280,  280,
+	/* 208 */   742,  740,  840,  840,  840,  840,  840,  600,
+	/* 216 */   840,  640,  640,  640,  640,  620,  560,  600,
+	/* 224 */   660,  660,  660,  660,  660,  660, 1080,  640,
+	/* 232 */   640,  640,  640,  640,  240,  240,  240,  240,
+	/* 240 */   640,  600,  640,  640,  640,  640,  640,  600,
+	/* 248 */   660,  600,  600,  600,  600,  580,  660,  580,
+	},
+	{	/* AvantGarde-BookOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   277,  295,  309,  554,  554,  775,  757,  351,
+	/*  40 */   369,  369,  425,  606,  277,  332,  277,  437,
+	/*  48 */   554,  554,  554,  554,  554,  554,  554,  554,
+	/*  56 */   554,  554,  277,  277,  606,  606,  606,  591,
+	/*  64 */   867,  740,  574,  813,  744,  536,  485,  872,
+	/*  72 */   683,  226,  482,  591,  462,  919,  740,  869,
+	/*  80 */   592,  871,  607,  498,  426,  655,  702,  960,
+	/*  88 */   609,  592,  480,  351,  605,  351,  606,  500,
+	/*  96 */   351,  683,  682,  647,  685,  650,  314,  673,
+	/* 104 */   610,  200,  203,  502,  200,  938,  610,  655,
+	/* 112 */   682,  682,  301,  388,  339,  608,  554,  831,
+	/* 120 */   480,  536,  425,  351,  672,  351,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1174,  606,
+	/* 144 */   351,  351,  251,  251,  502,  484,  502,  500,
+	/* 152 */  1000,  606, 1194, 1137,  553,  553,  487,  485,
+	/* 160 */   277,  295,  554,  554,  554,  554,  672,  615,
+	/* 168 */   369,  747,  369,  425,  606,  332,  747,  485,
+	/* 176 */   400,  606,  332,  332,  375,  608,  564,  277,
+	/* 184 */   324,  332,  369,  425,  831,  831,  831,  591,
+	/* 192 */   740,  740,  740,  740,  740,  740,  992,  813,
+	/* 200 */   536,  536,  536,  536,  226,  226,  226,  226,
+	/* 208 */   790,  740,  869,  869,  869,  869,  869,  606,
+	/* 216 */   868,  655,  655,  655,  655,  592,  592,  554,
+	/* 224 */   683,  683,  683,  683,  683,  683, 1157,  647,
+	/* 232 */   650,  650,  650,  650,  200,  200,  200,  200,
+	/* 240 */   655,  610,  655,  655,  655,  655,  655,  606,
+	/* 248 */   653,  608,  608,  608,  608,  536,  682,  536,
+	},
+	{	/* AvantGarde-DemiOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   280,  280,  360,  560,  560,  860,  680,  280,
+	/*  40 */   380,  380,  440,  600,  280,  420,  280,  460,
+	/*  48 */   560,  560,  560,  560,  560,  560,  560,  560,
+	/*  56 */   560,  560,  280,  280,  600,  600,  600,  560,
+	/*  64 */   740,  740,  580,  780,  700,  520,  480,  840,
+	/*  72 */   680,  280,  480,  620,  440,  900,  740,  840,
+	/*  80 */   560,  840,  580,  520,  420,  640,  700,  900,
+	/*  88 */   680,  620,  500,  320,  640,  320,  600,  500,
+	/*  96 */   280,  660,  660,  640,  660,  640,  280,  660,
+	/* 104 */   600,  240,  260,  580,  240,  940,  600,  640,
+	/* 112 */   660,  660,  320,  440,  300,  600,  560,  800,
+	/* 120 */   560,  580,  460,  340,  600,  340,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1280,  600,
+	/* 144 */   280,  280,  240,  240,  480,  480,  480,  500,
+	/* 152 */  1000,  600, 1060, 1080,  560,  560,  520,  520,
+	/* 160 */   280,  280,  560,  560,  560,  560,  600,  560,
+	/* 168 */   500,  740,  360,  460,  600,  420,  740,  420,
+	/* 176 */   400,  600,  336,  336,  420,  576,  600,  280,
+	/* 184 */   340,  336,  360,  460,  840,  840,  840,  560,
+	/* 192 */   740,  740,  740,  740,  740,  740,  900,  780,
+	/* 200 */   520,  520,  520,  520,  280,  280,  280,  280,
+	/* 208 */   742,  740,  840,  840,  840,  840,  840,  600,
+	/* 216 */   840,  640,  640,  640,  640,  620,  560,  600,
+	/* 224 */   660,  660,  660,  660,  660,  660, 1080,  640,
+	/* 232 */   640,  640,  640,  640,  240,  240,  240,  240,
+	/* 240 */   640,  600,  640,  640,  640,  640,  640,  600,
+	/* 248 */   660,  600,  600,  600,  600,  580,  660,  580,
+	},
+	{	/* NewCenturySchlbk-Roman */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  296,  389,  556,  556,  833,  815,  204,
+	/*  40 */   333,  333,  500,  606,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  606,  606,  606,  444,
+	/*  64 */   737,  722,  722,  722,  778,  722,  667,  778,
+	/*  72 */   833,  407,  556,  778,  667,  944,  815,  778,
+	/*  80 */   667,  778,  722,  630,  667,  815,  722,  981,
+	/*  88 */   704,  704,  611,  333,  606,  333,  606,  500,
+	/*  96 */   204,  556,  556,  444,  574,  500,  333,  537,
+	/* 104 */   611,  315,  296,  593,  315,  889,  611,  500,
+	/* 112 */   574,  556,  444,  463,  389,  611,  537,  778,
+	/* 120 */   537,  537,  481,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  606,
+	/* 144 */   204,  204,  259,  259,  389,  389,  389,  556,
+	/* 152 */  1000,  606, 1000,  833,  500,  500,  611,  611,
+	/* 160 */   278,  296,  556,  556,  556,  556,  606,  500,
+	/* 168 */   333,  737,  334,  426,  606,  333,  737,  333,
+	/* 176 */   400,  606,  333,  333,  333,  611,  606,  278,
+	/* 184 */   333,  333,  300,  426,  834,  834,  834,  444,
+	/* 192 */   722,  722,  722,  722,  722,  722, 1000,  722,
+	/* 200 */   722,  722,  722,  722,  407,  407,  407,  407,
+	/* 208 */   778,  815,  778,  778,  778,  778,  778,  606,
+	/* 216 */   778,  815,  815,  815,  815,  704,  667,  574,
+	/* 224 */   556,  556,  556,  556,  556,  556,  796,  444,
+	/* 232 */   500,  500,  500,  500,  315,  315,  315,  315,
+	/* 240 */   500,  611,  500,  500,  500,  500,  500,  606,
+	/* 248 */   500,  611,  611,  611,  611,  537,  574,  537,
+	},
+	{	/* NewCenturySchlbk-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   287,  296,  333,  574,  574,  833,  852,  241,
+	/*  40 */   389,  389,  500,  606,  278,  333,  278,  278,
+	/*  48 */   574,  574,  574,  574,  574,  574,  574,  574,
+	/*  56 */   574,  574,  278,  278,  606,  606,  606,  500,
+	/*  64 */   747,  759,  778,  778,  833,  759,  722,  833,
+	/*  72 */   870,  444,  648,  815,  722,  981,  833,  833,
+	/*  80 */   759,  833,  815,  667,  722,  833,  759,  981,
+	/*  88 */   722,  722,  667,  389,  606,  389,  606,  500,
+	/*  96 */   241,  611,  648,  556,  667,  574,  389,  611,
+	/* 104 */   685,  370,  352,  667,  352,  963,  685,  611,
+	/* 112 */   667,  648,  519,  500,  426,  685,  611,  889,
+	/* 120 */   611,  611,  537,  389,  606,  389,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000, 1000, 1000,  606,
+	/* 144 */   241,  241,  333,  333,  481,  481,  481,  500,
+	/* 152 */  1000,  606, 1000,  907,  500,  500,  685,  685,
+	/* 160 */   287,  296,  574,  574,  574,  574,  606,  500,
+	/* 168 */   333,  747,  367,  500,  606,  333,  747,  333,
+	/* 176 */   400,  606,  344,  344,  333,  685,  747,  278,
+	/* 184 */   333,  344,  367,  500,  861,  861,  861,  500,
+	/* 192 */   759,  759,  759,  759,  759,  759,  981,  778,
+	/* 200 */   759,  759,  759,  759,  444,  444,  444,  444,
+	/* 208 */   833,  833,  833,  833,  833,  833,  833,  606,
+	/* 216 */   833,  833,  833,  833,  833,  722,  759,  611,
+	/* 224 */   611,  611,  611,  611,  611,  611,  870,  556,
+	/* 232 */   574,  574,  574,  574,  370,  370,  370,  370,
+	/* 240 */   611,  685,  611,  611,  611,  611,  611,  606,
+	/* 248 */   611,  685,  685,  685,  685,  611,  667,  611,
+	},
+	{	/* NewCenturySchlbk-Italic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  333,  400,  556,  556,  833,  852,  204,
+	/*  40 */   333,  333,  500,  606,  278,  333,  278,  606,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  606,  606,  606,  444,
+	/*  64 */   747,  704,  722,  722,  778,  722,  667,  778,
+	/*  72 */   833,  407,  611,  741,  667,  944,  815,  778,
+	/*  80 */   667,  778,  741,  667,  685,  815,  704,  926,
+	/*  88 */   704,  685,  667,  333,  606,  333,  606,  500,
+	/*  96 */   204,  574,  556,  444,  611,  444,  333,  537,
+	/* 104 */   611,  333,  315,  556,  333,  889,  611,  500,
+	/* 112 */   574,  556,  444,  444,  352,  611,  519,  778,
+	/* 120 */   500,  500,  463,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  950, 1000,  606,
+	/* 144 */   204,  204,  333,  333,  389,  389,  389,  500,
+	/* 152 */  1000,  606,  981,  778,  500,  500,  611,  611,
+	/* 160 */   278,  333,  556,  556,  556,  556,  606,  500,
+	/* 168 */   333,  747,  422,  426,  606,  333,  747,  333,
+	/* 176 */   400,  606,  333,  333,  333,  611,  650,  278,
+	/* 184 */   333,  333,  372,  426,  834,  834,  834,  444,
+	/* 192 */   704,  704,  704,  704,  704,  704,  870,  722,
+	/* 200 */   722,  722,  722,  722,  407,  407,  407,  407,
+	/* 208 */   778,  815,  778,  778,  778,  778,  778,  606,
+	/* 216 */   778,  815,  815,  815,  815,  685,  667,  556,
+	/* 224 */   574,  574,  574,  574,  574,  574,  722,  444,
+	/* 232 */   444,  444,  444,  444,  333,  333,  333,  333,
+	/* 240 */   500,  611,  500,  500,  500,  500,  500,  606,
+	/* 248 */   500,  611,  611,  611,  611,  500,  574,  500,
+	},
+	{	/* NewCenturySchlbk-BoldItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   287,  333,  400,  574,  574,  889,  889,  259,
+	/*  40 */   407,  407,  500,  606,  287,  333,  287,  278,
+	/*  48 */   574,  574,  574,  574,  574,  574,  574,  574,
+	/*  56 */   574,  574,  287,  287,  606,  606,  606,  481,
+	/*  64 */   747,  741,  759,  759,  833,  741,  704,  815,
+	/*  72 */   870,  444,  667,  778,  704,  944,  852,  833,
+	/*  80 */   741,  833,  796,  685,  722,  833,  741,  944,
+	/*  88 */   741,  704,  704,  407,  606,  407,  606,  500,
+	/*  96 */   259,  667,  611,  537,  667,  519,  389,  611,
+	/* 104 */   685,  389,  370,  648,  389,  944,  685,  574,
+	/* 112 */   648,  630,  519,  481,  407,  685,  556,  833,
+	/* 120 */   574,  519,  519,  407,  606,  407,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0, 1000,  950, 1167,  606,
+	/* 144 */   259,  259,  278,  278,  481,  481,  481,  500,
+	/* 152 */  1000,  606,  963,  852,  500,  500,  685,  685,
+	/* 160 */   287,  333,  574,  574,  574,  574,  606,  500,
+	/* 168 */   333,  747,  412,  481,  606,  333,  747,  333,
+	/* 176 */   400,  606,  344,  344,  333,  685,  650,  287,
+	/* 184 */   333,  344,  356,  481,  861,  861,  861,  481,
+	/* 192 */   741,  741,  741,  741,  741,  741,  889,  759,
+	/* 200 */   741,  741,  741,  741,  444,  444,  444,  444,
+	/* 208 */   833,  852,  833,  833,  833,  833,  833,  606,
+	/* 216 */   833,  833,  833,  833,  833,  704,  741,  574,
+	/* 224 */   667,  667,  667,  667,  667,  667,  815,  537,
+	/* 232 */   519,  519,  519,  519,  389,  389,  389,  389,
+	/* 240 */   574,  685,  574,  574,  574,  574,  574,  606,
+	/* 248 */   574,  685,  685,  685,  685,  519,  648,  519,
+	},
+};
+static unsigned short ausCharacterWidths2[32][256] = {
+	{	/* Courier */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Courier-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Courier-Oblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Courier-BoldOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  40 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  48 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  56 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  64 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  72 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  80 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  88 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/*  96 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 104 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 112 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 120 */   600,  600,  600,  600,  600,  600,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 168 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 176 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 184 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 192 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 200 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 208 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 216 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 224 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 232 */   600,  600,  600,  600,  600,  600,  600,  740,
+	/* 240 */   600,  600,  600,  600,  600,  600,  600,  600,
+	/* 248 */   600,  600,  600,  600,  600,  600,  600,  600,
+	},
+	{	/* Times-Roman */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  408,  500,  500,  833,  778,  180,
+	/*  40 */   333,  333,  500,  564,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  278,  278,  564,  564,  564,  444,
+	/*  64 */   921,  722,  667,  667,  722,  611,  556,  722,
+	/*  72 */   722,  333,  389,  722,  611,  889,  722,  722,
+	/*  80 */   556,  722,  667,  556,  611,  722,  722,  944,
+	/*  88 */   722,  722,  611,  333,  278,  333,  469,  500,
+	/*  96 */   333,  444,  500,  444,  500,  444,  333,  500,
+	/* 104 */   500,  278,  278,  500,  278,  778,  500,  500,
+	/* 112 */   500,  500,  333,  389,  278,  500,  500,  722,
+	/* 120 */   500,  500,  444,  480,  200,  480,  541,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  722,  333,  611,  500,  611,  556,  500,
+	/* 168 */   333,  556,  556,  611,  611,  333,  611,  611,
+	/* 176 */   333,  444,  333,  278,  333,  348,  389,  333,
+	/* 184 */   333,  389,  389,  278,  444,  333,  444,  444,
+	/* 192 */   667,  722,  722,  722,  722,  611,  667,  667,
+	/* 200 */   667,  611,  611,  611,  611,  333,  333,  722,
+	/* 208 */   722,  722,  722,  722,  722,  722,  722,  564,
+	/* 216 */   667,  722,  722,  722,  722,  722,  611,  500,
+	/* 224 */   333,  444,  444,  444,  444,  278,  444,  444,
+	/* 232 */   444,  444,  444,  444,  444,  278,  278,  600,
+	/* 240 */   500,  500,  500,  500,  500,  500,  500,  564,
+	/* 248 */   333,  500,  500,  500,  500,  500,  278,  333,
+	},
+	{	/* Times-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  555,  500,  500, 1000,  833,  278,
+	/*  40 */   333,  333,  500,  570,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  333,  333,  570,  570,  570,  500,
+	/*  64 */   930,  722,  667,  722,  722,  667,  611,  778,
+	/*  72 */   778,  389,  500,  778,  667,  944,  722,  778,
+	/*  80 */   611,  778,  722,  556,  667,  722,  722, 1000,
+	/*  88 */   722,  722,  667,  333,  278,  333,  581,  500,
+	/*  96 */   333,  500,  556,  444,  556,  444,  333,  500,
+	/* 104 */   556,  278,  333,  556,  278,  833,  556,  500,
+	/* 112 */   556,  556,  444,  389,  333,  556,  500,  722,
+	/* 120 */   500,  500,  444,  394,  220,  394,  520,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  722,  333,  667,  500,  667,  556,  500,
+	/* 168 */   333,  556,  556,  667,  667,  333,  667,  667,
+	/* 176 */   333,  500,  333,  278,  333,  396,  389,  333,
+	/* 184 */   333,  389,  389,  400,  444,  333,  444,  444,
+	/* 192 */   722,  722,  722,  722,  722,  667,  722,  722,
+	/* 200 */   722,  667,  667,  667,  667,  389,  389,  722,
+	/* 208 */   722,  722,  722,  778,  778,  778,  778,  570,
+	/* 216 */   722,  722,  722,  722,  722,  722,  667,  556,
+	/* 224 */   444,  500,  500,  500,  500,  278,  444,  444,
+	/* 232 */   444,  444,  444,  444,  444,  278,  278,  665,
+	/* 240 */   556,  556,  556,  500,  500,  500,  500,  570,
+	/* 248 */   444,  556,  556,  556,  556,  500,  333,  333,
+	},
+	{	/* Times-Italic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  420,  500,  500,  833,  778,  214,
+	/*  40 */   333,  333,  500,  675,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  333,  333,  675,  675,  675,  500,
+	/*  64 */   920,  611,  611,  667,  722,  611,  611,  722,
+	/*  72 */   722,  333,  444,  667,  556,  833,  667,  722,
+	/*  80 */   611,  722,  611,  500,  556,  722,  611,  833,
+	/*  88 */   611,  556,  556,  389,  278,  389,  422,  500,
+	/*  96 */   333,  500,  500,  444,  500,  444,  278,  500,
+	/* 104 */   500,  278,  278,  444,  278,  722,  500,  500,
+	/* 112 */   500,  500,  389,  389,  278,  500,  444,  667,
+	/* 120 */   444,  444,  389,  400,  275,  400,  541,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  611,  333,  556,  500,  556,  500,  500,
+	/* 168 */   333,  500,  500,  556,  556,  333,  556,  556,
+	/* 176 */   333,  500,  333,  278,  333,  278,  389,  333,
+	/* 184 */   333,  389,  389,  278,  389,  333,  389,  389,
+	/* 192 */   611,  611,  611,  611,  611,  556,  667,  667,
+	/* 200 */   667,  611,  611,  611,  611,  333,  333,  722,
+	/* 208 */   722,  667,  667,  722,  722,  722,  722,  675,
+	/* 216 */   611,  722,  722,  722,  722,  556,  556,  500,
+	/* 224 */   389,  500,  500,  500,  500,  278,  444,  444,
+	/* 232 */   444,  444,  444,  444,  444,  278,  278,  521,
+	/* 240 */   500,  500,  500,  500,  500,  500,  500,  675,
+	/* 248 */   389,  500,  500,  500,  500,  444,  278,  333,
+	},
+	{	/* Times-BoldItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  389,  555,  500,  500,  833,  778,  278,
+	/*  40 */   333,  333,  500,  570,  250,  333,  250,  278,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  333,  333,  570,  570,  570,  500,
+	/*  64 */   832,  667,  667,  667,  722,  667,  667,  722,
+	/*  72 */   778,  389,  500,  667,  611,  889,  722,  722,
+	/*  80 */   611,  722,  667,  556,  611,  722,  667,  889,
+	/*  88 */   667,  611,  611,  333,  278,  333,  570,  500,
+	/*  96 */   333,  500,  500,  444,  500,  444,  333,  500,
+	/* 104 */   556,  278,  278,  500,  278,  778,  556,  500,
+	/* 112 */   500,  500,  389,  389,  278,  556,  444,  667,
+	/* 120 */   500,  444,  389,  348,  220,  348,  570,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  667,  333,  611,  500,  611,  556,  500,
+	/* 168 */   333,  556,  556,  611,  611,  333,  611,  611,
+	/* 176 */   333,  500,  333,  278,  333,  382,  389,  333,
+	/* 184 */   333,  389,  389,  345,  389,  333,  389,  389,
+	/* 192 */   667,  667,  667,  667,  667,  611,  667,  667,
+	/* 200 */   667,  667,  667,  667,  667,  389,  389,  722,
+	/* 208 */   722,  722,  722,  722,  722,  722,  722,  570,
+	/* 216 */   667,  722,  722,  722,  722,  611,  611,  500,
+	/* 224 */   389,  500,  500,  500,  500,  278,  444,  444,
+	/* 232 */   444,  444,  444,  444,  444,  278,  278,  600,
+	/* 240 */   500,  556,  556,  500,  500,  500,  500,  570,
+	/* 248 */   389,  556,  556,  556,  556,  444,  278,  333,
+	},
+	{	/* Helvetica */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  278,  355,  556,  556,  889,  667,  191,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  584,  584,  584,  556,
+	/*  64 */  1015,  667,  667,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  500,  667,  556,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  278,  278,  278,  469,  556,
+	/*  96 */   333,  556,  556,  500,  556,  556,  278,  556,
+	/* 104 */   556,  222,  222,  500,  222,  833,  556,  556,
+	/* 112 */   556,  556,  333,  500,  278,  556,  500,  722,
+	/* 120 */   500,  500,  500,  334,  260,  334,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   278,  667,  333,  556,  556,  556,  667,  556,
+	/* 168 */   333,  667,  667,  611,  611,  333,  611,  611,
+	/* 176 */   333,  556,  333,  222,  333,  292,  500,  333,
+	/* 184 */   333,  500,  500,  308,  500,  333,  500,  500,
+	/* 192 */   722,  667,  667,  667,  667,  556,  722,  722,
+	/* 200 */   722,  667,  667,  667,  667,  278,  278,  722,
+	/* 208 */   722,  722,  722,  778,  778,  778,  778,  584,
+	/* 216 */   722,  722,  722,  722,  722,  666,  611,  611,
+	/* 224 */   333,  556,  556,  556,  556,  222,  500,  500,
+	/* 232 */   500,  556,  556,  556,  556,  278,  278,  635,
+	/* 240 */   556,  556,  556,  556,  556,  556,  556,  584,
+	/* 248 */   333,  556,  556,  556,  556,  500,  278,  333,
+	},
+	{	/* Helvetica-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  333,  474,  556,  556,  889,  722,  238,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  333,  333,  584,  584,  584,  611,
+	/*  64 */   975,  722,  722,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  556,  722,  611,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  333,  278,  333,  584,  556,
+	/*  96 */   333,  556,  611,  556,  611,  556,  333,  611,
+	/* 104 */   611,  278,  278,  556,  278,  889,  611,  611,
+	/* 112 */   611,  611,  389,  556,  333,  611,  556,  778,
+	/* 120 */   556,  556,  500,  389,  280,  389,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   278,  722,  333,  611,  556,  611,  667,  556,
+	/* 168 */   333,  667,  667,  611,  611,  333,  611,  611,
+	/* 176 */   333,  556,  333,  278,  333,  369,  556,  333,
+	/* 184 */   333,  556,  556,  385,  500,  333,  500,  500,
+	/* 192 */   722,  722,  722,  722,  722,  611,  722,  722,
+	/* 200 */   722,  667,  667,  667,  667,  278,  278,  722,
+	/* 208 */   722,  722,  722,  778,  778,  778,  778,  584,
+	/* 216 */   722,  722,  722,  722,  722,  667,  611,  611,
+	/* 224 */   389,  556,  556,  556,  556,  278,  556,  556,
+	/* 232 */   556,  556,  556,  556,  556,  278,  278,  707,
+	/* 240 */   611,  611,  611,  611,  611,  611,  611,  584,
+	/* 248 */   389,  611,  611,  611,  611,  556,  333,  333,
+	},
+	{	/* Helvetica-Oblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  278,  355,  556,  556,  889,  667,  191,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  584,  584,  584,  556,
+	/*  64 */  1015,  667,  667,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  500,  667,  556,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  278,  278,  278,  469,  556,
+	/*  96 */   333,  556,  556,  500,  556,  556,  278,  556,
+	/* 104 */   556,  222,  222,  500,  222,  833,  556,  556,
+	/* 112 */   556,  556,  333,  500,  278,  556,  500,  722,
+	/* 120 */   500,  500,  500,  334,  260,  334,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   278,  667,  333,  556,  556,  556,  667,  556,
+	/* 168 */   333,  667,  667,  611,  611,  333,  611,  611,
+	/* 176 */   333,  556,  333,  222,  333,  307,  500,  333,
+	/* 184 */   333,  500,  500,  319,  500,  333,  500,  500,
+	/* 192 */   722,  667,  667,  667,  667,  556,  722,  722,
+	/* 200 */   722,  667,  667,  667,  667,  278,  278,  722,
+	/* 208 */   722,  722,  722,  778,  778,  778,  778,  584,
+	/* 216 */   722,  722,  722,  722,  722,  667,  611,  611,
+	/* 224 */   333,  556,  556,  556,  556,  222,  500,  500,
+	/* 232 */   500,  556,  556,  556,  556,  278,  278,  650,
+	/* 240 */   556,  556,  556,  556,  556,  556,  556,  584,
+	/* 248 */   333,  556,  556,  556,  556,  500,  278,  333,
+	},
+	{	/* Helvetica-BoldOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  333,  474,  556,  556,  889,  722,  238,
+	/*  40 */   333,  333,  389,  584,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  333,  333,  584,  584,  584,  611,
+	/*  64 */   975,  722,  722,  722,  722,  667,  611,  778,
+	/*  72 */   722,  278,  556,  722,  611,  833,  722,  778,
+	/*  80 */   667,  778,  722,  667,  611,  722,  667,  944,
+	/*  88 */   667,  667,  611,  333,  278,  333,  584,  556,
+	/*  96 */   333,  556,  611,  556,  611,  556,  333,  611,
+	/* 104 */   611,  278,  278,  556,  278,  889,  611,  611,
+	/* 112 */   611,  611,  389,  556,  333,  611,  556,  778,
+	/* 120 */   556,  556,  500,  389,  280,  389,  584,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   278,  722,  333,  611,  556,  611,  667,  556,
+	/* 168 */   333,  667,  667,  611,  611,  333,  611,  611,
+	/* 176 */   333,  556,  333,  278,  333,  384,  556,  333,
+	/* 184 */   333,  556,  556,  404,  500,  333,  500,  500,
+	/* 192 */   722,  722,  722,  722,  722,  611,  722,  722,
+	/* 200 */   722,  667,  667,  667,  667,  278,  278,  722,
+	/* 208 */   722,  722,  722,  778,  778,  778,  778,  584,
+	/* 216 */   722,  722,  722,  722,  722,  667,  611,  611,
+	/* 224 */   389,  556,  556,  556,  556,  278,  556,  556,
+	/* 232 */   556,  556,  556,  556,  556,  278,  278,  722,
+	/* 240 */   611,  611,  611,  611,  611,  611,  611,  584,
+	/* 248 */   389,  611,  611,  611,  611,  556,  333,  333,
+	},
+	{	/* Palatino-Roman */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  278,  371,  500,  500,  840,  778,  208,
+	/*  40 */   333,  333,  389,  606,  250,  333,  250,  606,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  444,
+	/*  64 */   747,  778,  611,  709,  774,  611,  556,  763,
+	/*  72 */   832,  337,  333,  726,  611,  946,  831,  786,
+	/*  80 */   604,  786,  668,  525,  613,  778,  722, 1000,
+	/*  88 */   667,  667,  667,  333,  606,  333,  606,  500,
+	/*  96 */   333,  500,  553,  444,  611,  479,  333,  556,
+	/* 104 */   582,  291,  234,  556,  291,  883,  582,  546,
+	/* 112 */   601,  560,  395,  424,  326,  603,  565,  834,
+	/* 120 */   516,  556,  500,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  778,  333,  611,  500,  611,  525,  500,
+	/* 168 */   333,  525,  525,  613,  667,  333,  667,  667,
+	/* 176 */   333,  500,  313,  291,  333,  375,  424,  333,
+	/* 184 */   333,  424,  424,  375,  500,  380,  500,  500,
+	/* 192 */   668,  778,  778,  778,  778,  611,  709,  709,
+	/* 200 */   709,  611,  611,  611,  611,  337,  337,  774,
+	/* 208 */   774,  831,  831,  786,  786,  786,  786,  606,
+	/* 216 */   668,  778,  778,  778,  778,  667,  613,  556,
+	/* 224 */   395,  500,  500,  500,  500,  291,  444,  444,
+	/* 232 */   444,  479,  479,  479,  479,  287,  287,  671,
+	/* 240 */   611,  582,  582,  546,  546,  546,  546,  606,
+	/* 248 */   395,  603,  603,  603,  603,  556,  326,  250,
+	},
+	{	/* Palatino-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  278,  402,  500,  500,  889,  833,  227,
+	/*  40 */   333,  333,  444,  606,  250,  333,  250,  296,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  444,
+	/*  64 */   747,  778,  667,  722,  833,  611,  556,  833,
+	/*  72 */   833,  389,  389,  778,  611, 1000,  833,  833,
+	/*  80 */   611,  833,  722,  611,  667,  778,  778, 1000,
+	/*  88 */   667,  667,  667,  333,  606,  333,  606,  500,
+	/*  96 */   333,  500,  611,  444,  611,  500,  389,  556,
+	/* 104 */   611,  333,  333,  611,  333,  889,  611,  556,
+	/* 112 */   611,  611,  389,  444,  333,  611,  556,  833,
+	/* 120 */   500,  556,  500,  310,  606,  310,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  778,  333,  611,  500,  611,  611,  500,
+	/* 168 */   333,  611,  611,  667,  667,  333,  667,  667,
+	/* 176 */   333,  500,  333,  333,  333,  433,  444,  333,
+	/* 184 */   333,  444,  444,  402,  500,  333,  500,  500,
+	/* 192 */   722,  778,  778,  778,  778,  611,  722,  722,
+	/* 200 */   722,  611,  611,  611,  611,  389,  389,  833,
+	/* 208 */   833,  833,  833,  833,  833,  833,  833,  606,
+	/* 216 */   722,  778,  778,  778,  778,  667,  667,  611,
+	/* 224 */   389,  500,  500,  500,  500,  333,  444,  444,
+	/* 232 */   444,  500,  500,  500,  500,  333,  333,  711,
+	/* 240 */   611,  611,  611,  556,  556,  556,  556,  606,
+	/* 248 */   389,  611,  611,  611,  611,  556,  333,  333,
+	},
+	{	/* Palatino-Italic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  500,  500,  500,  889,  778,  333,
+	/*  40 */   333,  333,  389,  606,  250,  333,  250,  296,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  500,
+	/*  64 */   747,  722,  611,  667,  778,  611,  556,  722,
+	/*  72 */   778,  333,  333,  667,  556,  944,  778,  778,
+	/*  80 */   611,  778,  667,  556,  611,  778,  722,  944,
+	/*  88 */   722,  667,  667,  333,  606,  333,  606,  500,
+	/*  96 */   333,  444,  463,  407,  500,  389,  278,  500,
+	/* 104 */   500,  278,  278,  444,  278,  778,  556,  444,
+	/* 112 */   500,  463,  389,  389,  333,  556,  500,  722,
+	/* 120 */   500,  500,  444,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  722,  333,  556,  500,  556,  556,  500,
+	/* 168 */   333,  556,  556,  611,  667,  333,  667,  667,
+	/* 176 */   333,  444,  333,  278,  333,  346,  389,  333,
+	/* 184 */   333,  389,  389,  361,  444,  333,  444,  444,
+	/* 192 */   667,  722,  722,  722,  722,  556,  667,  667,
+	/* 200 */   667,  611,  611,  611,  611,  333,  333,  778,
+	/* 208 */   778,  778,  778,  778,  778,  778,  778,  606,
+	/* 216 */   667,  778,  778,  778,  778,  667,  611,  500,
+	/* 224 */   389,  444,  444,  444,  444,  278,  407,  407,
+	/* 232 */   407,  389,  389,  389,  389,  278,  278,  577,
+	/* 240 */   500,  556,  556,  444,  444,  444,  444,  606,
+	/* 248 */   389,  556,  556,  556,  556,  500,  333,  333,
+	},
+	{	/* Palatino-BoldItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   250,  333,  500,  500,  500,  889,  833,  250,
+	/*  40 */   333,  333,  444,  606,  250,  389,  250,  315,
+	/*  48 */   500,  500,  500,  500,  500,  500,  500,  500,
+	/*  56 */   500,  500,  250,  250,  606,  606,  606,  444,
+	/*  64 */   833,  722,  667,  685,  778,  611,  556,  778,
+	/*  72 */   778,  389,  389,  722,  611,  944,  778,  833,
+	/*  80 */   667,  833,  722,  556,  611,  778,  667, 1000,
+	/*  88 */   722,  611,  667,  333,  606,  333,  606,  500,
+	/*  96 */   333,  556,  537,  444,  556,  444,  333,  500,
+	/* 104 */   556,  333,  333,  556,  333,  833,  556,  556,
+	/* 112 */   556,  537,  389,  444,  389,  556,  556,  833,
+	/* 120 */   500,  556,  500,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   250,  722,  333,  611,  500,  611,  556,  556,
+	/* 168 */   333,  556,  556,  611,  667,  389,  667,  667,
+	/* 176 */   556,  556,  333,  333,  333,  429,  444,  333,
+	/* 184 */   333,  444,  444,  389,  500,  333,  500,  500,
+	/* 192 */   722,  722,  722,  722,  722,  611,  685,  685,
+	/* 200 */   685,  611,  611,  611,  611,  389,  389,  778,
+	/* 208 */   778,  778,  778,  833,  833,  833,  833,  606,
+	/* 216 */   722,  778,  778,  778,  778,  611,  611,  556,
+	/* 224 */   389,  556,  556,  556,  556,  333,  444,  444,
+	/* 232 */   444,  444,  444,  444,  444,  333,  333,  667,
+	/* 240 */   556,  556,  556,  556,  556,  556,  556,  606,
+	/* 248 */   389,  556,  556,  556,  556,  556,  389,  333,
+	},
+	{	/* Helvetica-Narrow */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  228,  291,  456,  456,  729,  547,  157,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  228,  228,  479,  479,  479,  456,
+	/*  64 */   832,  547,  547,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  410,  547,  456,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  228,  228,  228,  385,  456,
+	/*  96 */   273,  456,  456,  410,  456,  456,  228,  456,
+	/* 104 */   456,  182,  182,  410,  182,  683,  456,  456,
+	/* 112 */   456,  456,  273,  410,  228,  456,  410,  592,
+	/* 120 */   410,  410,  410,  274,  213,  274,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   228,  547,  273,  456,  456,  456,  547,  456,
+	/* 168 */   273,  547,  547,  501,  501,  273,  501,  501,
+	/* 176 */   273,  456,  273,  182,  273,  212,  410,  273,
+	/* 184 */   273,  410,  410,  248,  410,  273,  410,  410,
+	/* 192 */   592,  547,  547,  547,  547,  456,  592,  592,
+	/* 200 */   592,  547,  547,  547,  547,  228,  228,  592,
+	/* 208 */   592,  592,  592,  638,  638,  638,  638,  479,
+	/* 216 */   592,  592,  592,  592,  592,  547,  501,  501,
+	/* 224 */   273,  456,  456,  456,  456,  182,  410,  410,
+	/* 232 */   410,  456,  456,  456,  456,  228,  228,  496,
+	/* 240 */   456,  456,  456,  456,  456,  456,  456,  479,
+	/* 248 */   273,  456,  456,  456,  456,  410,  228,  273,
+	},
+	{	/* Helvetica-Narrow-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  273,  389,  456,  456,  729,  592,  195,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  273,  273,  479,  479,  479,  501,
+	/*  64 */   800,  592,  592,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  456,  592,  501,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  273,  228,  273,  479,  456,
+	/*  96 */   273,  456,  501,  456,  501,  456,  273,  501,
+	/* 104 */   501,  228,  228,  456,  228,  729,  501,  501,
+	/* 112 */   501,  501,  319,  456,  273,  501,  456,  638,
+	/* 120 */   456,  456,  410,  319,  230,  319,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   228,  592,  273,  501,  456,  501,  547,  456,
+	/* 168 */   273,  547,  547,  501,  501,  273,  501,  501,
+	/* 176 */   273,  456,  273,  228,  273,  280,  456,  273,
+	/* 184 */   273,  456,  456,  338,  410,  273,  410,  410,
+	/* 192 */   592,  592,  592,  592,  592,  501,  592,  592,
+	/* 200 */   592,  547,  547,  547,  547,  228,  228,  592,
+	/* 208 */   592,  592,  592,  638,  638,  638,  638,  479,
+	/* 216 */   592,  592,  592,  592,  592,  547,  501,  501,
+	/* 224 */   319,  456,  456,  456,  456,  228,  456,  456,
+	/* 232 */   456,  456,  456,  456,  456,  228,  228,  561,
+	/* 240 */   501,  501,  501,  501,  501,  501,  501,  479,
+	/* 248 */   319,  501,  501,  501,  501,  456,  273,  273,
+	},
+	{	/* Helvetica-Narrow-Oblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  228,  291,  456,  456,  729,  547,  157,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  228,  228,  479,  479,  479,  456,
+	/*  64 */   832,  547,  547,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  410,  547,  456,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  228,  228,  228,  385,  456,
+	/*  96 */   273,  456,  456,  410,  456,  456,  228,  456,
+	/* 104 */   456,  182,  182,  410,  182,  683,  456,  456,
+	/* 112 */   456,  456,  273,  410,  228,  456,  410,  592,
+	/* 120 */   410,  410,  410,  274,  213,  274,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   228,  547,  273,  456,  456,  456,  547,  456,
+	/* 168 */   273,  547,  547,  501,  501,  273,  501,  501,
+	/* 176 */   273,  456,  273,  182,  273,  217,  410,  273,
+	/* 184 */   273,  410,  410,  254,  410,  273,  410,  410,
+	/* 192 */   592,  547,  547,  547,  547,  456,  592,  592,
+	/* 200 */   592,  547,  547,  547,  547,  228,  228,  592,
+	/* 208 */   592,  592,  592,  638,  638,  638,  638,  479,
+	/* 216 */   592,  592,  592,  592,  592,  547,  501,  501,
+	/* 224 */   273,  456,  456,  456,  456,  182,  410,  410,
+	/* 232 */   410,  456,  456,  456,  456,  228,  228,  503,
+	/* 240 */   456,  456,  456,  456,  456,  456,  456,  479,
+	/* 248 */   273,  456,  456,  456,  456,  410,  228,  273,
+	},
+	{	/* Helvetica-Narrow-BoldOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   228,  273,  389,  456,  456,  729,  592,  195,
+	/*  40 */   273,  273,  319,  479,  228,  273,  228,  228,
+	/*  48 */   456,  456,  456,  456,  456,  456,  456,  456,
+	/*  56 */   456,  456,  273,  273,  479,  479,  479,  501,
+	/*  64 */   800,  592,  592,  592,  592,  547,  501,  638,
+	/*  72 */   592,  228,  456,  592,  501,  683,  592,  638,
+	/*  80 */   547,  638,  592,  547,  501,  592,  547,  774,
+	/*  88 */   547,  547,  501,  273,  228,  273,  479,  456,
+	/*  96 */   273,  456,  501,  456,  501,  456,  273,  501,
+	/* 104 */   501,  228,  228,  456,  228,  729,  501,  501,
+	/* 112 */   501,  501,  319,  456,  273,  501,  456,  638,
+	/* 120 */   456,  456,  410,  319,  230,  319,  479,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   228,  592,  273,  501,  456,  501,  547,  456,
+	/* 168 */   273,  547,  547,  501,  501,  273,  501,  501,
+	/* 176 */   273,  456,  273,  228,  273,  283,  456,  273,
+	/* 184 */   273,  456,  456,  312,  410,  273,  410,  410,
+	/* 192 */   592,  592,  592,  592,  592,  501,  592,  592,
+	/* 200 */   592,  547,  547,  547,  547,  228,  228,  592,
+	/* 208 */   592,  592,  592,  638,  638,  638,  638,  479,
+	/* 216 */   592,  592,  592,  592,  592,  547,  501,  501,
+	/* 224 */   319,  456,  456,  456,  456,  228,  456,  456,
+	/* 232 */   456,  456,  456,  456,  456,  228,  228,  561,
+	/* 240 */   501,  501,  501,  501,  501,  501,  501,  479,
+	/* 248 */   319,  501,  501,  501,  501,  456,  273,  273,
+	},
+	{	/* Bookman-Light */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   320,  300,  380,  620,  620,  900,  800,  220,
+	/*  40 */   300,  300,  440,  600,  320,  400,  320,  600,
+	/*  48 */   620,  620,  620,  620,  620,  620,  620,  620,
+	/*  56 */   620,  620,  320,  320,  600,  600,  600,  540,
+	/*  64 */   820,  680,  740,  740,  800,  720,  640,  800,
+	/*  72 */   800,  340,  600,  720,  600,  920,  740,  800,
+	/*  80 */   620,  820,  720,  660,  620,  780,  700,  960,
+	/*  88 */   720,  640,  640,  300,  600,  300,  600,  500,
+	/*  96 */   340,  580,  620,  520,  620,  520,  320,  540,
+	/* 104 */   660,  300,  300,  620,  300,  940,  660,  560,
+	/* 112 */   620,  580,  440,  520,  380,  680,  520,  780,
+	/* 120 */   560,  540,  480,  280,  600,  280,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   320,  680,  460,  600,  620,  600,  660,  520,
+	/* 168 */   420,  660,  660,  620,  640,  400,  640,  640,
+	/* 176 */   320,  580,  320,  320,  340,  336,  520,  420,
+	/* 184 */   320,  520,  520,  380,  480,  380,  480,  480,
+	/* 192 */   720,  680,  680,  680,  680,  600,  740,  740,
+	/* 200 */   740,  720,  720,  720,  720,  340,  340,  800,
+	/* 208 */   800,  740,  740,  800,  800,  800,  800,  600,
+	/* 216 */   720,  780,  780,  780,  780,  640,  620,  660,
+	/* 224 */   440,  580,  580,  580,  580,  300,  520,  520,
+	/* 232 */   520,  520,  520,  520,  520,  300,  300,  620,
+	/* 240 */   620,  660,  660,  560,  560,  560,  560,  600,
+	/* 248 */   440,  680,  680,  680,  680,  540,  380,  260,
+	},
+	{	/* Bookman-Demi */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   340,  360,  420,  660,  660,  940,  800,  240,
+	/*  40 */   320,  320,  460,  600,  340,  360,  340,  600,
+	/*  48 */   660,  660,  660,  660,  660,  660,  660,  660,
+	/*  56 */   660,  660,  340,  340,  600,  600,  600,  660,
+	/*  64 */   820,  720,  720,  740,  780,  720,  680,  780,
+	/*  72 */   820,  400,  640,  800,  640,  940,  740,  800,
+	/*  80 */   660,  800,  780,  660,  700,  740,  720,  940,
+	/*  88 */   780,  700,  640,  300,  600,  300,  600,  500,
+	/*  96 */   400,  580,  600,  580,  640,  580,  380,  580,
+	/* 104 */   680,  360,  340,  660,  340, 1000,  680,  620,
+	/* 112 */   640,  620,  460,  520,  460,  660,  600,  800,
+	/* 120 */   600,  620,  560,  320,  600,  320,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   340,  720,  500,  640,  660,  640,  660,  600,
+	/* 168 */   500,  660,  660,  700,  640,  360,  640,  640,
+	/* 176 */   340,  580,  320,  340,  400,  430,  520,  500,
+	/* 184 */   360,  520,  520,  470,  560,  440,  560,  560,
+	/* 192 */   780,  720,  720,  720,  720,  640,  740,  740,
+	/* 200 */   740,  720,  720,  720,  720,  400,  400,  780,
+	/* 208 */   780,  740,  740,  800,  800,  800,  800,  600,
+	/* 216 */   780,  740,  740,  740,  740,  700,  700,  660,
+	/* 224 */   460,  580,  580,  580,  580,  340,  580,  580,
+	/* 232 */   580,  580,  580,  580,  580,  360,  360,  720,
+	/* 240 */   640,  680,  680,  620,  620,  620,  620,  600,
+	/* 248 */   460,  660,  660,  660,  660,  620,  460,  320,
+	},
+	{	/* Bookman-LightItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   300,  320,  360,  620,  620,  800,  820,  200,
+	/*  40 */   280,  280,  440,  600,  300,  320,  300,  600,
+	/*  48 */   620,  620,  620,  620,  620,  620,  620,  620,
+	/*  56 */   620,  620,  300,  300,  600,  600,  600,  540,
+	/*  64 */   780,  700,  720,  720,  740,  680,  620,  760,
+	/*  72 */   800,  320,  560,  720,  580,  860,  720,  760,
+	/*  80 */   600,  780,  700,  640,  600,  720,  680,  960,
+	/*  88 */   700,  660,  580,  260,  600,  260,  600,  500,
+	/*  96 */   340,  620,  600,  480,  640,  540,  340,  560,
+	/* 104 */   620,  280,  280,  600,  280,  880,  620,  540,
+	/* 112 */   600,  560,  400,  540,  340,  620,  540,  880,
+	/* 120 */   540,  600,  520,  360,  600,  380,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   300,  700,  440,  580,  620,  580,  640,  620,
+	/* 168 */   420,  640,  640,  600,  580,  320,  580,  580,
+	/* 176 */   300,  620,  260,  340,  320,  380,  540,  440,
+	/* 184 */   320,  540,  540,  340,  520,  340,  520,  520,
+	/* 192 */   700,  700,  700,  700,  700,  580,  720,  720,
+	/* 200 */   720,  680,  680,  680,  680,  320,  320,  740,
+	/* 208 */   740,  720,  720,  760,  760,  760,  760,  600,
+	/* 216 */   700,  720,  720,  720,  720,  660,  600,  620,
+	/* 224 */   400,  620,  620,  620,  620,  280,  480,  480,
+	/* 232 */   480,  540,  540,  540,  540,  280,  280,  730,
+	/* 240 */   640,  620,  620,  540,  540,  540,  540,  600,
+	/* 248 */   400,  620,  620,  620,  620,  600,  340,  260,
+	},
+	{	/* Bookman-DemiItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   340,  320,  380,  680,  680,  880,  980,  180,
+	/*  40 */   260,  260,  460,  600,  340,  280,  340,  360,
+	/*  48 */   680,  680,  680,  680,  680,  680,  680,  680,
+	/*  56 */   680,  680,  340,  340,  620,  600,  620,  620,
+	/*  64 */   780,  720,  720,  700,  760,  720,  660,  760,
+	/*  72 */   800,  380,  620,  780,  640,  860,  740,  760,
+	/*  80 */   640,  760,  740,  700,  700,  740,  660, 1000,
+	/*  88 */   740,  660,  680,  260,  580,  260,  620,  500,
+	/*  96 */   380,  680,  600,  560,  680,  560,  420,  620,
+	/* 104 */   700,  380,  320,  700,  380,  960,  680,  600,
+	/* 112 */   660,  620,  500,  540,  440,  680,  540,  860,
+	/* 120 */   620,  600,  560,  300,  620,  300,  620,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   340,  720,  460,  640,  680,  640,  700,  620,
+	/* 168 */   520,  700,  700,  700,  680,  280,  680,  680,
+	/* 176 */   360,  680,  320,  380,  340,  509,  540,  480,
+	/* 184 */   360,  540,  540,  520,  560,  560,  560,  560,
+	/* 192 */   740,  720,  720,  720,  720,  640,  700,  700,
+	/* 200 */   700,  720,  720,  720,  720,  380,  380,  760,
+	/* 208 */   760,  740,  740,  760,  760,  760,  760,  600,
+	/* 216 */   740,  740,  740,  740,  740,  660,  700,  660,
+	/* 224 */   500,  680,  680,  680,  680,  380,  560,  560,
+	/* 232 */   560,  560,  560,  560,  560,  380,  380,  810,
+	/* 240 */   680,  680,  680,  600,  600,  600,  600,  600,
+	/* 248 */   500,  680,  680,  680,  680,  600,  440,  380,
+	},
+	{	/* AvantGarde-Book */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   277,  295,  309,  554,  554,  775,  757,  198,
+	/*  40 */   369,  369,  425,  606,  277,  332,  277,  437,
+	/*  48 */   554,  554,  554,  554,  554,  554,  554,  554,
+	/*  56 */   554,  554,  277,  277,  606,  606,  606,  591,
+	/*  64 */   867,  740,  574,  813,  744,  536,  485,  872,
+	/*  72 */   683,  226,  482,  591,  462,  919,  740,  869,
+	/*  80 */   592,  871,  607,  498,  426,  655,  702,  960,
+	/*  88 */   609,  592,  480,  351,  605,  351,  606,  500,
+	/*  96 */   378,  683,  682,  647,  685,  650,  314,  673,
+	/* 104 */   610,  200,  203,  502,  200,  938,  610,  655,
+	/* 112 */   682,  682,  301,  388,  339,  608,  554,  831,
+	/* 120 */   480,  536,  425,  351,  672,  351,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   277,  740,  453,  517,  554,  462,  498,  615,
+	/* 168 */   369,  498,  498,  426,  480,  332,  480,  480,
+	/* 176 */   332,  683,  302,  300,  375,  245,  388,  502,
+	/* 184 */   324,  388,  388,  339,  425,  552,  425,  425,
+	/* 192 */   607,  740,  740,  740,  740,  462,  813,  813,
+	/* 200 */   813,  536,  536,  536,  536,  226,  226,  744,
+	/* 208 */   790,  740,  740,  869,  869,  869,  869,  606,
+	/* 216 */   607,  655,  655,  655,  655,  592,  426,  554,
+	/* 224 */   301,  683,  683,  683,  683,  200,  647,  647,
+	/* 232 */   647,  650,  650,  650,  650,  200,  200,  725,
+	/* 240 */   685,  610,  610,  655,  655,  655,  655,  606,
+	/* 248 */   301,  608,  608,  608,  608,  536,  339,  222,
+	},
+	{	/* AvantGarde-Demi */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   280,  280,  360,  560,  560,  860,  680,  220,
+	/*  40 */   380,  380,  440,  600,  280,  420,  280,  460,
+	/*  48 */   560,  560,  560,  560,  560,  560,  560,  560,
+	/*  56 */   560,  560,  280,  280,  600,  600,  600,  560,
+	/*  64 */   740,  740,  580,  780,  700,  520,  480,  840,
+	/*  72 */   680,  280,  480,  620,  440,  900,  740,  840,
+	/*  80 */   560,  840,  580,  520,  420,  640,  700,  900,
+	/*  88 */   680,  620,  500,  320,  640,  320,  600,  500,
+	/*  96 */   420,  660,  660,  640,  660,  640,  280,  660,
+	/* 104 */   600,  240,  260,  580,  240,  940,  600,  640,
+	/* 112 */   660,  660,  320,  440,  300,  600,  560,  800,
+	/* 120 */   560,  580,  460,  340,  600,  340,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   280,  740,  480,  480,  560,  440,  520,  560,
+	/* 168 */   500,  520,  520,  420,  500,  420,  500,  500,
+	/* 176 */   360,  660,  340,  320,  420,  330,  440,  540,
+	/* 184 */   340,  440,  440,  369,  460,  700,  460,  460,
+	/* 192 */   580,  740,  740,  740,  740,  440,  780,  780,
+	/* 200 */   780,  520,  520,  520,  520,  280,  280,  700,
+	/* 208 */   742,  740,  740,  840,  840,  840,  840,  600,
+	/* 216 */   580,  640,  640,  640,  640,  620,  420,  600,
+	/* 224 */   320,  660,  660,  660,  660,  240,  640,  640,
+	/* 232 */   640,  640,  640,  640,  640,  240,  240,  754,
+	/* 240 */   660,  600,  600,  640,  640,  640,  640,  600,
+	/* 248 */   320,  600,  600,  600,  600,  580,  300,  280,
+	},
+	{	/* AvantGarde-BookOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   277,  295,  309,  554,  554,  775,  757,  198,
+	/*  40 */   369,  369,  425,  606,  277,  332,  277,  437,
+	/*  48 */   554,  554,  554,  554,  554,  554,  554,  554,
+	/*  56 */   554,  554,  277,  277,  606,  606,  606,  591,
+	/*  64 */   867,  740,  574,  813,  744,  536,  485,  872,
+	/*  72 */   683,  226,  482,  591,  462,  919,  740,  869,
+	/*  80 */   592,  871,  607,  498,  426,  655,  702,  960,
+	/*  88 */   609,  592,  480,  351,  605,  351,  606,  500,
+	/*  96 */   378,  683,  682,  647,  685,  650,  314,  673,
+	/* 104 */   610,  200,  203,  502,  200,  938,  610,  655,
+	/* 112 */   682,  682,  301,  388,  339,  608,  554,  831,
+	/* 120 */   480,  536,  425,  351,  672,  351,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   277,  740,  453,  517,  554,  462,  498,  615,
+	/* 168 */   369,  498,  498,  426,  480,  332,  480,  480,
+	/* 176 */   332,  683,  302,  300,  375,  231,  388,  502,
+	/* 184 */   324,  388,  388,  339,  425,  552,  425,  425,
+	/* 192 */   607,  740,  740,  740,  740,  462,  813,  813,
+	/* 200 */   813,  536,  536,  536,  536,  226,  226,  744,
+	/* 208 */   790,  740,  740,  869,  869,  869,  869,  606,
+	/* 216 */   607,  655,  655,  655,  655,  592,  426,  554,
+	/* 224 */   301,  683,  683,  683,  683,  200,  647,  647,
+	/* 232 */   647,  650,  650,  650,  650,  200,  200,  714,
+	/* 240 */   685,  610,  610,  655,  655,  655,  655,  606,
+	/* 248 */   301,  608,  608,  608,  608,  536,  339,  222,
+	},
+	{	/* AvantGarde-DemiOblique */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   280,  280,  360,  560,  560,  860,  680,  220,
+	/*  40 */   380,  380,  440,  600,  280,  420,  280,  460,
+	/*  48 */   560,  560,  560,  560,  560,  560,  560,  560,
+	/*  56 */   560,  560,  280,  280,  600,  600,  600,  560,
+	/*  64 */   740,  740,  580,  780,  700,  520,  480,  840,
+	/*  72 */   680,  280,  480,  620,  440,  900,  740,  840,
+	/*  80 */   560,  840,  580,  520,  420,  640,  700,  900,
+	/*  88 */   680,  620,  500,  320,  640,  320,  600,  500,
+	/*  96 */   420,  660,  660,  640,  660,  640,  280,  660,
+	/* 104 */   600,  240,  260,  580,  240,  940,  600,  640,
+	/* 112 */   660,  660,  320,  440,  300,  600,  560,  800,
+	/* 120 */   560,  580,  460,  340,  600,  340,  600,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   280,  740,  480,  480,  560,  440,  520,  560,
+	/* 168 */   500,  520,  520,  420,  500,  420,  500,  500,
+	/* 176 */   360,  660,  340,  320,  420,  326,  440,  540,
+	/* 184 */   340,  440,  440,  364,  460,  700,  460,  460,
+	/* 192 */   580,  740,  740,  740,  740,  440,  780,  780,
+	/* 200 */   780,  520,  520,  520,  520,  280,  280,  700,
+	/* 208 */   742,  740,  740,  840,  840,  840,  840,  600,
+	/* 216 */   580,  640,  640,  640,  640,  620,  420,  600,
+	/* 224 */   320,  660,  660,  660,  660,  240,  640,  640,
+	/* 232 */   640,  640,  640,  640,  640,  240,  240,  752,
+	/* 240 */   660,  600,  600,  640,  640,  640,  640,  600,
+	/* 248 */   320,  600,  600,  600,  600,  580,  300,  280,
+	},
+	{	/* NewCenturySchlbk-Roman */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  296,  389,  556,  556,  833,  815,  204,
+	/*  40 */   333,  333,  500,  606,  278,  333,  278,  278,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  606,  606,  606,  444,
+	/*  64 */   737,  722,  722,  722,  778,  722,  667,  778,
+	/*  72 */   833,  407,  556,  778,  667,  944,  815,  778,
+	/*  80 */   667,  778,  722,  630,  667,  815,  722,  981,
+	/*  88 */   704,  704,  611,  333,  606,  333,  606,  500,
+	/*  96 */   333,  556,  556,  444,  574,  500,  333,  537,
+	/* 104 */   611,  315,  296,  593,  315,  889,  611,  500,
+	/* 112 */   574,  556,  444,  463,  389,  611,  537,  778,
+	/* 120 */   537,  537,  481,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   278,  722,  333,  667,  556,  667,  630,  500,
+	/* 168 */   333,  630,  630,  667,  611,  333,  611,  611,
+	/* 176 */   333,  556,  333,  315,  333,  339,  463,  333,
+	/* 184 */   333,  463,  463,  389,  481,  333,  481,  481,
+	/* 192 */   722,  722,  722,  722,  722,  667,  722,  722,
+	/* 200 */   722,  722,  722,  722,  722,  407,  407,  778,
+	/* 208 */   778,  815,  815,  778,  778,  778,  778,  606,
+	/* 216 */   722,  815,  815,  815,  815,  704,  667,  574,
+	/* 224 */   444,  556,  556,  556,  556,  315,  444,  444,
+	/* 232 */   444,  500,  500,  500,  500,  315,  315,  606,
+	/* 240 */   574,  611,  611,  500,  500,  500,  500,  606,
+	/* 248 */   444,  611,  611,  611,  611,  537,  389,  333,
+	},
+	{	/* NewCenturySchlbk-Bold */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   287,  296,  333,  574,  574,  833,  852,  241,
+	/*  40 */   389,  389,  500,  606,  278,  333,  278,  278,
+	/*  48 */   574,  574,  574,  574,  574,  574,  574,  574,
+	/*  56 */   574,  574,  278,  278,  606,  606,  606,  500,
+	/*  64 */   747,  759,  778,  778,  833,  759,  722,  833,
+	/*  72 */   870,  444,  648,  815,  722,  981,  833,  833,
+	/*  80 */   759,  833,  815,  667,  722,  833,  759,  981,
+	/*  88 */   722,  722,  667,  389,  606,  389,  606,  500,
+	/*  96 */   333,  611,  648,  556,  667,  574,  389,  611,
+	/* 104 */   685,  370,  352,  667,  352,  963,  685,  611,
+	/* 112 */   667,  648,  519,  500,  426,  685,  611,  889,
+	/* 120 */   611,  611,  537,  389,  606,  389,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   287,  759,  333,  722,  574,  722,  667,  500,
+	/* 168 */   333,  667,  667,  722,  667,  333,  667,  667,
+	/* 176 */   333,  611,  333,  352,  333,  436,  500,  333,
+	/* 184 */   333,  500,  500,  446,  537,  333,  537,  537,
+	/* 192 */   815,  759,  759,  759,  759,  722,  778,  778,
+	/* 200 */   778,  759,  759,  759,  759,  444,  444,  833,
+	/* 208 */   833,  833,  833,  833,  833,  833,  833,  606,
+	/* 216 */   815,  833,  833,  833,  833,  722,  722,  611,
+	/* 224 */   519,  611,  611,  611,  611,  352,  556,  556,
+	/* 232 */   556,  574,  574,  574,  574,  370,  370,  747,
+	/* 240 */   667,  685,  685,  611,  611,  611,  611,  606,
+	/* 248 */   519,  685,  685,  685,  685,  611,  426,  333,
+	},
+	{	/* NewCenturySchlbk-Italic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   278,  333,  400,  556,  556,  833,  852,  278,
+	/*  40 */   333,  333,  500,  606,  278,  333,  278,  606,
+	/*  48 */   556,  556,  556,  556,  556,  556,  556,  556,
+	/*  56 */   556,  556,  278,  278,  606,  606,  606,  444,
+	/*  64 */   747,  704,  722,  722,  778,  722,  667,  778,
+	/*  72 */   833,  407,  611,  741,  667,  944,  815,  778,
+	/*  80 */   667,  778,  741,  667,  685,  815,  704,  926,
+	/*  88 */   704,  685,  667,  333,  606,  333,  606,  500,
+	/*  96 */   333,  574,  556,  444,  611,  444,  333,  537,
+	/* 104 */   611,  333,  315,  556,  333,  889,  611,  500,
+	/* 112 */   574,  556,  444,  444,  352,  611,  519,  778,
+	/* 120 */   500,  500,  463,  333,  606,  333,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   278,  704,  333,  667,  556,  667,  667,  500,
+	/* 168 */   333,  667,  667,  685,  667,  333,  667,  667,
+	/* 176 */   333,  574,  333,  333,  333,  359,  444,  333,
+	/* 184 */   333,  444,  444,  368,  463,  333,  463,  463,
+	/* 192 */   741,  704,  704,  704,  704,  667,  722,  722,
+	/* 200 */   722,  722,  722,  722,  722,  407,  407,  778,
+	/* 208 */   778,  815,  815,  778,  778,  778,  778,  606,
+	/* 216 */   741,  815,  815,  815,  815,  685,  685,  556,
+	/* 224 */   444,  574,  574,  574,  574,  333,  444,  444,
+	/* 232 */   444,  444,  444,  444,  444,  333,  333,  651,
+	/* 240 */   611,  611,  611,  500,  500,  500,  500,  606,
+	/* 248 */   444,  611,  611,  611,  611,  500,  352,  333,
+	},
+	{	/* NewCenturySchlbk-BoldItalic */
+	/*   0 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*   8 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  16 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  24 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/*  32 */   287,  333,  400,  574,  574,  889,  889,  287,
+	/*  40 */   407,  407,  500,  606,  287,  333,  287,  278,
+	/*  48 */   574,  574,  574,  574,  574,  574,  574,  574,
+	/*  56 */   574,  574,  287,  287,  606,  606,  606,  481,
+	/*  64 */   747,  741,  759,  759,  833,  741,  704,  815,
+	/*  72 */   870,  444,  667,  778,  704,  944,  852,  833,
+	/*  80 */   741,  833,  796,  685,  722,  833,  741,  944,
+	/*  88 */   741,  704,  704,  407,  606,  407,  606,  500,
+	/*  96 */   333,  667,  611,  537,  667,  519,  389,  611,
+	/* 104 */   685,  389,  370,  648,  389,  944,  685,  574,
+	/* 112 */   648,  630,  519,  481,  407,  685,  556,  833,
+	/* 120 */   574,  519,  519,  407,  606,  407,  606,    0,
+	/* 128 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 136 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 144 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 152 */     0,    0,    0,    0,    0,    0,    0,    0,
+	/* 160 */   287,  741,  333,  704,  574,  704,  685,  500,
+	/* 168 */   333,  685,  685,  722,  704,  333,  704,  704,
+	/* 176 */   333,  667,  333,  389,  333,  486,  481,  333,
+	/* 184 */   333,  481,  481,  483,  519,  333,  519,  519,
+	/* 192 */   796,  741,  741,  741,  741,  704,  759,  759,
+	/* 200 */   759,  741,  741,  741,  741,  444,  444,  833,
+	/* 208 */   833,  852,  852,  833,  833,  833,  833,  606,
+	/* 216 */   796,  833,  833,  833,  833,  704,  722,  574,
+	/* 224 */   519,  667,  667,  667,  667,  389,  537,  537,
+	/* 232 */   537,  519,  519,  519,  519,  389,  389,  780,
+	/* 240 */   667,  685,  685,  574,  574,  574,  574,  606,
+	/* 248 */   519,  685,  685,  685,  685,  519,  407,  333,
+	},
+};
+#if 0 /* Until this array is needed */
+static int aiUnderlineInfo[32][2] = {
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -151, 50 },
+	{ -155, 69 },
+	{ -151, 50 },
+	{ -111, 69 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -100, 50 },
+	{ -125, 60 },
+	{ -125, 60 },
+	{ -125, 60 },
+	{ -125, 60 },
+	{ -96, 58 },
+	{ -93, 90 },
+	{ -96, 58 },
+	{ -93, 90 },
+	{ -104, 61 },
+	{ -103, 90 },
+	{ -102, 42 },
+	{ -102, 54 },
+};
+#endif /* 0 */

+ 207 - 0
sys/src/cmd/aux/antiword/fontinfo.pl

@@ -0,0 +1,207 @@
+#! /usr/bin/perl -w
+#
+# Generate the fontinformation tables for the required fonts (Linux version)
+#
+
+@charnames1 = (
+"ellipsis", "trademark", "perthousand", "bullet",
+"quoteleft", "quoteright", "guilsinglleft", "guilsinglright",
+"quotedblleft", "quotedblright", "quotedblbase", "endash", "emdash",
+"minus", "OE", "oe", "dagger", "daggerdbl", "fi", "fl",
+"space", "exclamdown", "cent", "sterling", "currency",
+"yen", "brokenbar", "section", "dieresis", "copyright",
+"ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered",
+"macron", "degree", "plusminus", "twosuperior", "threesuperior",
+"acute", "mu", "paragraph", "periodcentered", "cedilla",
+"onesuperior", "ordmasculine", "guillemotright", "onequarter",
+"onehalf", "threequarters", "questiondown", "Agrave", "Aacute",
+"Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla",
+"Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute",
+"Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute",
+"Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash",
+"Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn",
+"germandbls", "agrave", "aacute", "acircumflex", "atilde",
+"adieresis", "aring", "ae", "ccedilla", "egrave", "eacute",
+"ecircumflex", "edieresis", "igrave", "iacute", "icircumflex",
+"idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex",
+"otilde", "odieresis", "divide", "oslash", "ugrave", "uacute",
+"ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"
+);
+
+@charnames2 = (
+"space", "Aogonek", "breve", "Lslash", "currency", "Lcaron",
+"Sacute", "section", "dieresis", "Scaron", "Scedilla",
+"Tcaron", "Zacute", "hyphen", "Zcaron", "Zdotaccent", "ring",
+"aogonek", "ogonek", "lslash", "acute", "lcaron", "sacute",
+"caron", "cedilla", "scaron", "scedilla", "tcaron",
+"zacute", "hungarumlaut", "zcaron", "zdotaccent", "Racute",
+"Aacute", "Acircumflex", "Abreve", "Adieresis", "Lacute",
+"Cacute", "Ccedilla", "Ccaron", "Eacute", "Eogonek",
+"Edieresis", "Ecaron", "Iacute", "Icircumflex", "Dcaron",
+"Dslash", "Nacute", "Ncaron", "Oacute", "Ocircumflex",
+"Ohungarumlaut", "Odieresis", "multiply", "Rcaron", "Uring",
+"Uacute", "Uhungarumlaut", "Udieresis", "Yacute", "Tcommaaccent",
+"germandbls", "racute", "aacute", "acircumflex", "abreve",
+"adieresis", "lacute", "cacute", "ccedilla", "ccaron", "eacute",
+"eogonek", "edieresis", "ecaron", "iacute", "icircumflex",
+"dcaron", "dmacron", "nacute", "ncaron", "oacute", "ocircumflex",
+"ohungarumlaut", "odieresis", "divide", "rcaron", "uring",
+"uacute", "uhungarumlaut", "udieresis", "yacute", "tcommaaccent",
+"dotaccent"
+);
+
+$gs_dir1 = '/usr/share/ghostscript/fonts';
+$gs_dir2 = '/usr/share/ghostscript/fonts2';
+
+@fontnames = (
+"Courier", "Courier-Bold", "Courier-Oblique", "Courier-BoldOblique",
+"Times-Roman", "Times-Bold", "Times-Italic", "Times-BoldItalic",
+"Helvetica", "Helvetica-Bold", "Helvetica-Oblique", "Helvetica-BoldOblique",
+"Palatino-Roman", "Palatino-Bold", "Palatino-Italic", "Palatino-BoldItalic",
+"Helvetica-Narrow", "Helvetica-Narrow-Bold", "Helvetica-Narrow-Oblique", "Helvetica-Narrow-BoldOblique",
+"Bookman-Light", "Bookman-Demi", "Bookman-LightItalic", "Bookman-DemiItalic",
+"AvantGarde-Book", "AvantGarde-Demi", "AvantGarde-BookOblique", "AvantGarde-DemiOblique",
+"NewCenturySchlbk-Roman", "NewCenturySchlbk-Bold", "NewCenturySchlbk-Italic", "NewCenturySchlbk-BoldItalic",
+);
+
+@files = (
+"n022003l.afm", "n022004l.afm", "n022023l.afm", "n022024l.afm",
+"n021003l.afm", "n021004l.afm", "n021023l.afm", "n021024l.afm",
+"n019003l.afm", "n019004l.afm", "n019023l.afm", "n019024l.afm",
+"p052003l.afm", "p052004l.afm", "p052023l.afm", "p052024l.afm",
+"n019043l.afm", "n019044l.afm", "n019063l.afm", "n019064l.afm",
+"b018012l.afm", "b018015l.afm", "b018032l.afm", "b018035l.afm",
+"a010013l.afm", "a010015l.afm", "a010033l.afm", "a010035l.afm",
+"c059013l.afm", "c059016l.afm", "c059033l.afm", "c059036l.afm",
+);
+
+
+# Generate the array with the fontnames
+sub generate_fontnames
+{
+	printf STDOUT "static const char *szFontnames[%d] = {\n", $#fontnames + 1;
+	for ($n = 0; $n <= $#fontnames; $n++) {
+		printf STDOUT "\t\"%s\",\n", $fontnames[$n];
+	}
+	printf STDOUT "};\n";
+}
+
+# Generate the array with the character widths
+sub generate_character_widths
+{
+	my ($char_set, $gs_dir, @charnames) = @_;
+	my ($n, $i, $file, $name, $start);
+	my (@a, @charwidth);
+
+	if ($char_set == 1) {
+		$start = 140;
+	} else {
+		$start = 160;
+	}
+	printf STDOUT "static unsigned short ausCharacterWidths%d[%d][256] = {\n", $char_set, $#files + 1;
+	for ($n = 0; $n <= $#files; $n++) {
+		$file = $files[$n];
+		$name = $fontnames[$n];
+		open(F_IN, "<$gs_dir/$file") || die "Cannot open $gs_dir/$file";
+		printf STDOUT "\t{\t/* %s */\n", $name;
+		while (<F_IN>) {
+			chop();
+			@a = split(/\s+/);
+			if ($a[0] eq 'UnderlinePosition') {
+				$underlineposition[$n] = $a[1];
+			} elsif ($a[0] eq 'UnderlineThickness') {
+				#printf STDERR "%d %d\n", $a[0], $a[1];
+				$underlinethickness[$n] = $a[1];
+			} elsif ($a[0] eq 'C' && $a[2] eq ';' && $a[3] eq 'WX') {
+				#printf STDERR "%d %d %s\n", $a[1], $a[4], $a[7];
+				if (($a[1] < 0 || $a[1] >= 129) && defined($a[7])) {
+					for ($i = 0; $i <= $#charnames; $i++) {
+						if ($charnames[$i] eq $a[7]) {
+							$charwidth[$start + $i] = $a[4];
+							last;
+						}
+					}
+				}
+				if ($a[1] >= 0 && $a[1] <= 128 && !defined($charwidth[$a[1]])) {
+					$charwidth[$a[1]] = $a[4];
+				}
+			}
+			if (defined($a[7])) {
+				for ($i = 0; $i <= $#charnames; $i++) {
+					if ($charnames[$i] eq $a[7]) {
+						$charwidth[$start + $i] = $a[4];
+						last;
+					}
+				}
+			}
+		}
+		close(F_IN);
+
+		# Set the width of the control characters zero
+		for ($i = 0; $i < 32; $i++) {
+			$charwidth[$i] = 0;
+		}
+		# Set the width of the unused characters to zero
+		for ($i = 127; $i < $start; $i++) {
+			$charwidth[$i] = 0;
+		}
+
+		# Print the results
+		for ($i = 0; $i < 256; $i += 8) {
+			printf STDOUT "\t/* %3d */ ", $i;
+			for ($j = 0; $j < 8; $j++) {
+				if (!defined($charwidth[$i + $j])) {
+					printf STDERR "%d:%s: character %3d is undefined\n", $char_set, $name, $i + $j;
+					$charwidth[$i + $j] = 0;
+				}
+				printf STDOUT "%5d,", $charwidth[$i + $j];
+			}
+			printf STDOUT "\n";
+		}
+		printf STDOUT "\t},\n";
+		undef @charwidth;
+	}
+	printf STDOUT "};\n";
+}
+
+# Generate the array with the underline information
+sub generate_underline_information
+{
+	printf STDOUT "#if 0 /* Until this array is needed */\n";
+
+	printf STDOUT "static int aiUnderlineInfo[%d][2] = {\n", $#fontnames + 1;
+	for ($n = 0; $n <= $#fontnames; $n++) {
+		if (!defined($underlineposition[$n])) {
+			$underlineposition[$n] = 0;
+		}
+		if (!defined($underlinethickness[$n])) {
+			$underlinethickness[$n] = 0;
+		}
+		printf STDOUT "\t{ %d, %d },\n", $underlineposition[$n], $underlinethickness[$n];
+	}
+	printf STDOUT "};\n";
+
+	printf STDOUT "#endif /* 0 */\n";
+}
+
+
+# main()
+
+if ($#fontnames != $#files) {
+	die "The fontnames-array and the files-array are of unequel length";
+}
+if ($#charnames1 != 255 - 140) {
+	die "The charname1 table length is $#charnames1";
+}
+if ($#charnames2 != 255 - 160) {
+	die "The charname2 table length is $#charnames2";
+}
+
+printf STDOUT "/* THIS FILE IS AUTOMATICALLY GENERATED - DO NOT EDIT! */\n";
+
+&generate_fontnames();
+&generate_character_widths(1, $gs_dir1, @charnames1);
+&generate_character_widths(2, $gs_dir2, @charnames2);
+&generate_underline_information();
+
+exit 0;

+ 164 - 0
sys/src/cmd/aux/antiword/fontlist.c

@@ -0,0 +1,164 @@
+/*
+ * fontlist.c
+ * Copyright (C) 1998-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy a list of Word font information
+ */
+
+#include <stdlib.h>
+#include <stddef.h>
+#include "antiword.h"
+
+
+/* Variables needed to write the Font Information List */
+static font_desc_type	*pAnchor = NULL;
+static font_desc_type	*pFontLast = NULL;
+
+
+/*
+ * vDestroyFontInfoList - destroy the Font Information List
+ */
+void
+vDestroyFontInfoList(void)
+{
+	font_desc_type	*pCurr, *pNext;
+
+	DBG_MSG("vDestroyFontInfoList");
+
+	/* Free the Font Information List */
+	pCurr = pAnchor;
+	while (pCurr != NULL) {
+		pNext = pCurr->pNext;
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+	}
+	pAnchor = NULL;
+	/* Reset all control variables */
+	pFontLast = NULL;
+} /* end of vDestroyFontInfoList */
+
+/*
+ * vCorrectFontValues - correct font values to values Antiword can use
+ */
+void
+vCorrectFontValues(font_block_type *pFontBlock)
+{
+	UINT	uiRealSize;
+	USHORT	usRealStyle;
+
+	uiRealSize = pFontBlock->usFontSize;
+	usRealStyle = pFontBlock->usFontStyle;
+	if (bIsSmallCapitals(pFontBlock->usFontStyle)) {
+		/* Small capitals become normal capitals in a smaller font */
+		uiRealSize = (uiRealSize * 4 + 2) / 5;
+		usRealStyle &= ~FONT_SMALL_CAPITALS;
+		usRealStyle |= FONT_CAPITALS;
+	}
+	if (bIsSuperscript(pFontBlock->usFontStyle) ||
+	    bIsSubscript(pFontBlock->usFontStyle)) {
+		/* Superscript and subscript use a smaller fontsize */
+		uiRealSize = (uiRealSize * 2 + 1) / 3;
+	}
+
+	if (uiRealSize < MIN_FONT_SIZE) {
+		DBG_DEC(uiRealSize);
+		uiRealSize = MIN_FONT_SIZE;
+	} else if (uiRealSize > MAX_FONT_SIZE) {
+		DBG_DEC(uiRealSize);
+		uiRealSize = MAX_FONT_SIZE;
+	}
+
+	pFontBlock->usFontSize = (USHORT)uiRealSize;
+	if (pFontBlock->ucFontColor == 8) {
+		/* White text to light gray text */
+		pFontBlock->ucFontColor = 16;
+	}
+	pFontBlock->usFontStyle = usRealStyle;
+} /* end of vCorrectFontValues */
+
+/*
+ * vAdd2FontInfoList - Add an element to the Font Information List
+ */
+void
+vAdd2FontInfoList(const font_block_type *pFontBlock)
+{
+	font_desc_type	*pListMember;
+
+	fail(pFontBlock == NULL);
+
+	NO_DBG_MSG("bAdd2FontInfoList");
+
+	if (pFontBlock->ulFileOffset == FC_INVALID) {
+		/*
+		 * This offset is really past the end of the file,
+		 * so don't waste any memory by storing it.
+		 */
+		return;
+	}
+
+	NO_DBG_HEX(pFontBlock->ulFileOffset);
+	NO_DBG_DEC_C(pFontBlock->ucFontNumber != 0,
+					pFontBlock->ucFontNumber);
+	NO_DBG_DEC_C(pFontBlock->usFontSize != DEFAULT_FONT_SIZE,
+					pFontBlock->usFontSize);
+	NO_DBG_DEC_C(pFontBlock->ucFontColor != 0,
+					pFontBlock->ucFontColor);
+	NO_DBG_HEX_C(pFontBlock->usFontStyle != 0x00,
+					pFontBlock->usFontStyle);
+
+	if (pFontLast != NULL &&
+	    pFontLast->tInfo.ulFileOffset == pFontBlock->ulFileOffset) {
+		/*
+		 * If two consecutive fonts share the same
+		 * offset, remember only the last font
+		 */
+		fail(pFontLast->pNext != NULL);
+		pFontLast->tInfo = *pFontBlock;
+		return;
+	}
+
+	/* Create list member */
+	pListMember = xmalloc(sizeof(font_desc_type));
+	/* Fill the list member */
+	pListMember->tInfo = *pFontBlock;
+	pListMember->pNext = NULL;
+	/* Correct the values where needed */
+	vCorrectFontValues(&pListMember->tInfo);
+	/* Add the new member to the list */
+	if (pAnchor == NULL) {
+		pAnchor = pListMember;
+	} else {
+		fail(pFontLast == NULL);
+		pFontLast->pNext = pListMember;
+	}
+	pFontLast = pListMember;
+} /* end of vAdd2FontInfoList */
+
+/*
+ * Get the record that follows the given recored in the Font Information List
+ */
+const font_block_type *
+pGetNextFontInfoListItem(const font_block_type *pCurr)
+{
+	const font_desc_type	*pRecord;
+	size_t	tOffset;
+
+	if (pCurr == NULL) {
+		if (pAnchor == NULL) {
+			/* There are no records */
+			return NULL;
+		}
+		/* The first record is the only one without a predecessor */
+		return &pAnchor->tInfo;
+	}
+	tOffset = offsetof(font_desc_type, tInfo);
+	/* Many casts to prevent alignment warnings */
+	pRecord = (font_desc_type *)(void *)((char *)pCurr - tOffset);
+	fail(pCurr != &pRecord->tInfo);
+	if (pRecord->pNext == NULL) {
+		/* The last record has no successor */
+		return NULL;
+	}
+	return &pRecord->pNext->tInfo;
+} /* end of pGetNextFontInfoListItem */

+ 849 - 0
sys/src/cmd/aux/antiword/fonts.c

@@ -0,0 +1,849 @@
+/*
+ * fonts.c
+ * Copyright (C) 1998-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to deal with fonts (generic)
+ */
+
+#include <ctype.h>
+#include <string.h>
+#include "antiword.h"
+
+/* Maximum line length in the font file */
+#define FONT_LINE_LENGTH	81
+
+/* Pitch */
+#define PITCH_UNKNOWN		0
+#define PITCH_FIXED		1
+#define PITCH_VARIABLE		2
+
+/* Font Family */
+#define FAMILY_UNKNOWN		0
+#define FAMILY_ROMAN		1
+#define FAMILY_SWISS		2
+#define FAMILY_MODERN		3
+#define FAMILY_SCRIPT		4
+#define FAMILY_DECORATIVE	5
+
+/* Font Translation Table */
+static size_t		tFontTableRecords = 0;
+static font_table_type	*pFontTable = NULL;
+
+/*
+ * Find the given font in the font table
+ *
+ * returns the index into the FontTable, -1 if not found
+ */
+int
+iGetFontByNumber(UCHAR ucWordFontNumber, USHORT usFontStyle)
+{
+	int	iIndex;
+
+	for (iIndex = 0; iIndex < (int)tFontTableRecords; iIndex++) {
+		if (ucWordFontNumber == pFontTable[iIndex].ucWordFontNumber &&
+		    usFontStyle == pFontTable[iIndex].usFontStyle &&
+		    pFontTable[iIndex].szOurFontname[0] != '\0') {
+			return iIndex;
+		}
+	}
+	DBG_DEC(ucWordFontNumber);
+	DBG_HEX(usFontStyle);
+	return -1;
+} /* end of iGetFontByNumber */
+
+/*
+ * szGetOurFontname - Get our font name
+ *
+ * return our font name from the given index, NULL if not found
+ */
+const char *
+szGetOurFontname(int iIndex)
+{
+	if (iIndex < 0 || iIndex >= (int)tFontTableRecords) {
+		return NULL;
+	}
+	return pFontTable[iIndex].szOurFontname;
+} /* end of szGetOurFontname */
+
+/*
+ * Find the given font in the font table
+ *
+ * returns the Word font number, -1 if not found
+ */
+int
+iFontname2Fontnumber(const char *szOurFontname, USHORT usFontStyle)
+{
+	int	iIndex;
+
+	for (iIndex = 0; iIndex < (int)tFontTableRecords; iIndex++) {
+		if (pFontTable[iIndex].usFontStyle == usFontStyle &&
+		    STREQ(pFontTable[iIndex].szOurFontname, szOurFontname)) {
+			return (int)pFontTable[iIndex].ucWordFontNumber;
+		}
+	}
+	return -1;
+} /* end of iFontname2Fontnumber */
+
+/*
+ * See if the fontname from the Word file matches the fontname from the
+ * font translation file.
+ * If iBytesPerChar is one than aucWord is in ISO-8859-x (Word 2/6/7),
+ * if iBytesPerChar is two than aucWord is in Unicode (Word 8/9/10).
+ */
+static BOOL
+bFontEqual(const UCHAR *aucWord, const char *szTable, int iBytesPerChar)
+{
+	const UCHAR	*pucTmp;
+	const char	*pcTmp;
+
+	fail(aucWord == NULL || szTable == NULL);
+	fail(iBytesPerChar != 1 && iBytesPerChar != 2);
+
+	for (pucTmp = aucWord, pcTmp = szTable;
+	     *pucTmp != 0;
+	     pucTmp += iBytesPerChar, pcTmp++) {
+		if (ulToUpper((ULONG)*pucTmp) !=
+		    ulToUpper((ULONG)(UCHAR)*pcTmp)) {
+			return FALSE;
+		}
+	}
+	return *pcTmp == '\0';
+} /* end of bFontEqual */
+
+/*
+ *
+ */
+static void
+vFontname2Table(const UCHAR *aucFont, const UCHAR *aucAltFont,
+	int iBytesPerChar, int iEmphasis, UCHAR ucFFN,
+	const char *szWordFont, const char *szOurFont,
+	font_table_type *pFontTableRecord)
+{
+	BOOL	bMatchFound;
+	UCHAR	ucPrq, ucFf;
+
+	fail(aucFont == NULL || aucFont[0] == 0);
+	fail(aucAltFont != NULL && aucAltFont[0] == 0);
+	fail(iBytesPerChar != 1 && iBytesPerChar != 2);
+	fail(iEmphasis < 0 || iEmphasis > 3);
+	fail(szWordFont == NULL || szWordFont[0] == '\0');
+	fail(szOurFont == NULL || szOurFont[0] == '\0');
+	fail(pFontTableRecord == NULL);
+
+	bMatchFound = bFontEqual(aucFont, szWordFont, iBytesPerChar);
+
+	if (!bMatchFound && aucAltFont != NULL) {
+		bMatchFound = bFontEqual(aucAltFont, szWordFont, iBytesPerChar);
+	}
+
+	if (!bMatchFound &&
+	    pFontTableRecord->szWordFontname[0] == '\0' &&
+	    szWordFont[0] == '*' &&
+	    szWordFont[1] == '\0') {
+		/*
+		 * szWordFont contains a "*", so szOurFont will contain the
+		 * "default default" font. See if we can do better than that.
+		 */
+		ucPrq = ucFFN & 0x03;
+		ucFf = (ucFFN & 0x70) >> 4;
+		NO_DBG_DEC(ucPrq);
+		NO_DBG_DEC(ucFf);
+		if (ucPrq == PITCH_FIXED) {
+			/* Set to the default monospaced font */
+			switch (iEmphasis) {
+			case 0: szOurFont = FONT_MONOSPACED_PLAIN; break;
+			case 1: szOurFont = FONT_MONOSPACED_BOLD; break;
+			case 2: szOurFont = FONT_MONOSPACED_ITALIC; break;
+			case 3: szOurFont = FONT_MONOSPACED_BOLDITALIC; break;
+			default: break;
+			}
+		} else if (ucFf == FAMILY_ROMAN) {
+			/* Set to the default serif font */
+			switch (iEmphasis) {
+			case 0: szOurFont = FONT_SERIF_PLAIN; break;
+			case 1: szOurFont = FONT_SERIF_BOLD; break;
+			case 2: szOurFont = FONT_SERIF_ITALIC; break;
+			case 3: szOurFont = FONT_SERIF_BOLDITALIC; break;
+			default: break;
+			}
+		} else if (ucFf == FAMILY_SWISS) {
+			/* Set to the default sans serif font */
+			switch (iEmphasis) {
+			case 0: szOurFont = FONT_SANS_SERIF_PLAIN; break;
+			case 1: szOurFont = FONT_SANS_SERIF_BOLD; break;
+			case 2: szOurFont = FONT_SANS_SERIF_ITALIC; break;
+			case 3: szOurFont = FONT_SANS_SERIF_BOLDITALIC; break;
+			default: break;
+			}
+		}
+		bMatchFound = TRUE;
+	}
+
+	if (bMatchFound) {
+		switch (iBytesPerChar) {
+		case 1:
+			(void)strncpy(pFontTableRecord->szWordFontname,
+				(const char *)aucFont,
+				sizeof(pFontTableRecord->szWordFontname) - 1);
+			break;
+		case 2:
+			(void)unincpy(pFontTableRecord->szWordFontname,
+				aucFont,
+				sizeof(pFontTableRecord->szWordFontname) - 1);
+			break;
+		default:
+			DBG_FIXME();
+			pFontTableRecord->szWordFontname[0] = '\0';
+			break;
+		}
+		pFontTableRecord->szWordFontname[
+			sizeof(pFontTableRecord->szWordFontname) - 1] = '\0';
+		(void)strncpy(pFontTableRecord->szOurFontname, szOurFont,
+			sizeof(pFontTableRecord->szOurFontname) - 1);
+		pFontTableRecord->szOurFontname[
+			sizeof(pFontTableRecord->szOurFontname) - 1] = '\0';
+		NO_DBG_MSG(pFontTableRecord->szWordFontname);
+		NO_DBG_MSG(pFontTableRecord->szOurFontname);
+	}
+} /* end of vFontname2Table */
+
+/*
+ * vCreateFontTable - Create and initialize the internal font table
+ */
+static void
+vCreateFontTable(void)
+{
+	font_table_type	*pTmp;
+	int	iNbr;
+
+	if (tFontTableRecords == 0) {
+		pFontTable = xfree(pFontTable);
+		return;
+	}
+
+	/* Create the font table */
+	pFontTable = xcalloc(tFontTableRecords, sizeof(*pFontTable));
+
+	/* Initialize the font table */
+	for (iNbr = 0, pTmp = pFontTable;
+	     pTmp < pFontTable + tFontTableRecords;
+	     iNbr++, pTmp++) {
+		pTmp->ucWordFontNumber = (UCHAR)(iNbr / 4);
+		switch (iNbr % 4) {
+		case 0:
+			pTmp->usFontStyle = FONT_REGULAR;
+			break;
+		case 1:
+			pTmp->usFontStyle = FONT_BOLD;
+			break;
+		case 2:
+			pTmp->usFontStyle = FONT_ITALIC;
+			break;
+		case 3:
+			pTmp->usFontStyle = FONT_BOLD|FONT_ITALIC;
+			break;
+		default:
+			DBG_DEC(iNbr);
+			break;
+		}
+	}
+} /* end of vCreateFontTable */
+
+/*
+ * vMinimizeFontTable - make the font table as small as possible
+ */
+static void
+vMinimizeFontTable(void)
+{
+	font_block_type		tFontNext;
+	const style_block_type	*pStyle;
+	const font_block_type	*pFont;
+	font_table_type		*pTmp;
+	int	iUnUsed;
+	BOOL	bMustAddTableFont;
+
+	NO_DBG_MSG("vMinimizeFontTable");
+
+	if (tFontTableRecords == 0) {
+		pFontTable = xfree(pFontTable);
+		return;
+	}
+
+#if 0
+	DBG_MSG("Before");
+	DBG_DEC(tFontTableRecords);
+	for (pTmp = pFontTable;
+	     pTmp < pFontTable + tFontTableRecords;
+	     pTmp++) {
+		DBG_DEC(pTmp->ucWordFontNumber);
+		DBG_HEX(pTmp->usFontStyle);
+		DBG_MSG(pTmp->szWordFontname);
+		DBG_MSG(pTmp->szOurFontname);
+	}
+#endif /* DEBUG */
+
+	/* Default font/style is by definition in use */
+	pFontTable[0].ucInUse = 1;
+
+	/* See which fonts/styles are really being used */
+	bMustAddTableFont = TRUE;
+
+	/* The fonts/styles that will be used */
+	pFont = NULL;
+	while((pFont = pGetNextFontInfoListItem(pFont)) != NULL) {
+		pTmp = pFontTable + 4 * (int)pFont->ucFontNumber;
+		if (bIsBold(pFont->usFontStyle)) {
+			pTmp++;
+		}
+		if (bIsItalic(pFont->usFontStyle)) {
+			pTmp += 2;
+		}
+		if (pTmp >= pFontTable + tFontTableRecords) {
+			continue;
+		}
+		if (STREQ(pTmp->szOurFontname, TABLE_FONT)) {
+			/* The table font is already present */
+			bMustAddTableFont = FALSE;
+		}
+		pTmp->ucInUse = 1;
+	}
+
+	/* The fonts/styles that might be used */
+	pStyle = NULL;
+	while((pStyle = pGetNextStyleInfoListItem(pStyle)) != NULL) {
+		vFillFontFromStylesheet(pStyle->usIstdNext, &tFontNext);
+		vCorrectFontValues(&tFontNext);
+		pTmp = pFontTable + 4 * (int)tFontNext.ucFontNumber;
+		if (bIsBold(tFontNext.usFontStyle)) {
+			pTmp++;
+		}
+		if (bIsItalic(tFontNext.usFontStyle)) {
+			pTmp += 2;
+		}
+		if (pTmp >= pFontTable + tFontTableRecords) {
+			continue;
+		}
+		if (STREQ(pTmp->szOurFontname, TABLE_FONT)) {
+			/* The table font is already present */
+			bMustAddTableFont = FALSE;
+		}
+		pTmp->ucInUse = 1;
+	}
+
+	/* Remove the unused font entries from the font table */
+	iUnUsed = 0;
+	for (pTmp = pFontTable;
+	     pTmp < pFontTable + tFontTableRecords;
+	     pTmp++) {
+		if (pTmp->ucInUse == 0) {
+			iUnUsed++;
+			continue;
+		}
+		if (iUnUsed > 0) {
+			fail(pTmp - iUnUsed <= pFontTable);
+			*(pTmp - iUnUsed) = *pTmp;
+		}
+	}
+	tFontTableRecords -= (size_t)iUnUsed;
+	fail(tFontTableRecords == 0);
+
+	if (bMustAddTableFont) {
+		pTmp = pFontTable + tFontTableRecords;
+		pTmp->ucWordFontNumber = (pTmp - 1)->ucWordFontNumber + 1;
+		pTmp->usFontStyle = FONT_REGULAR;
+		pTmp->ucInUse = 1;
+		strcpy(pTmp->szWordFontname, "Extra Table Font");
+		strcpy(pTmp->szOurFontname, TABLE_FONT);
+		tFontTableRecords++;
+		iUnUsed--;
+	}
+	if (iUnUsed > 0) {
+		/* Resize the font table */
+		pFontTable = xrealloc(pFontTable,
+				tFontTableRecords * sizeof(*pFontTable));
+	}
+#if defined(DEBUG)
+	DBG_MSG("After");
+	DBG_DEC(tFontTableRecords);
+	for (pTmp = pFontTable;
+	     pTmp < pFontTable + tFontTableRecords;
+	     pTmp++) {
+		DBG_DEC(pTmp->ucWordFontNumber);
+		DBG_HEX(pTmp->usFontStyle);
+		DBG_MSG(pTmp->szWordFontname);
+		DBG_MSG(pTmp->szOurFontname);
+	}
+#endif /* DEBUG */
+} /* end of vMinimizeFontTable */
+
+/*
+ * bReadFontFile - read and check a line from the font translation file
+ *
+ * returns TRUE when a correct line has been read, otherwise FALSE
+ */
+static BOOL
+bReadFontFile(FILE *pFontTableFile, char *szWordFont,
+	int *piItalic, int *piBold, char *szOurFont, int *piSpecial)
+{
+	char	*pcTmp;
+	int	iFields;
+	char	szLine[FONT_LINE_LENGTH];
+
+	fail(szWordFont == NULL || szOurFont == NULL);
+	fail(piItalic == NULL || piBold == NULL || piSpecial == NULL);
+
+	while (fgets(szLine, (int)sizeof(szLine), pFontTableFile) != NULL) {
+		if (szLine[0] == '#' ||
+		    szLine[0] == '\n' ||
+		    szLine[0] == '\r') {
+			continue;
+		}
+		iFields = sscanf(szLine, "%[^,],%d,%d,%1s%[^,],%d",
+			szWordFont, piItalic, piBold,
+			&szOurFont[0], &szOurFont[1], piSpecial);
+		if (iFields != 6) {
+			pcTmp = strchr(szLine, '\r');
+			if (pcTmp != NULL) {
+				*pcTmp = '\0';
+			}
+			pcTmp = strchr(szLine, '\n');
+			if (pcTmp != NULL) {
+				*pcTmp = '\0';
+			}
+			DBG_DEC(iFields);
+			werr(0, "Syntax error in: '%s'", szLine);
+			continue;
+		}
+		if (strlen(szWordFont) >=
+				sizeof(pFontTable[0].szWordFontname)) {
+			werr(0, "Word fontname too long: '%s'", szWordFont);
+			continue;
+		}
+		if (strlen(szOurFont) >=
+				sizeof(pFontTable[0].szOurFontname)) {
+			werr(0, "Local fontname too long: '%s'", szOurFont);
+			continue;
+		}
+		/* The current line passed all the tests */
+		return TRUE;
+	}
+	return FALSE;
+} /* end of bReadFontFile */
+
+/*
+ * vCreate0FontTable - create a font table from Word for DOS
+ */
+void
+vCreate0FontTable(void)
+{
+	FILE	*pFontTableFile;
+	font_table_type	*pTmp;
+	UCHAR	*aucFont;
+	int	iBold, iItalic, iSpecial, iEmphasis, iFtc;
+	UCHAR	ucPrq, ucFf, ucFFN;
+	char	szWordFont[FONT_LINE_LENGTH], szOurFont[FONT_LINE_LENGTH];
+
+	tFontTableRecords = 0;
+	pFontTable = xfree(pFontTable);
+
+	pFontTableFile = pOpenFontTableFile();
+	if (pFontTableFile == NULL) {
+		/* No translation table file, no translation table */
+		return;
+	}
+
+	/* Get the maximum number of entries in the font table */
+	tFontTableRecords = 64;
+	tFontTableRecords *= 4;	/* Plain, Bold, Italic and Bold/italic */
+	tFontTableRecords++;	/* One extra for the table-font */
+	vCreateFontTable();
+
+	/* Read the font translation file */
+	while (bReadFontFile(pFontTableFile, szWordFont,
+			&iItalic, &iBold, szOurFont, &iSpecial)) {
+		iEmphasis = 0;
+		if (iBold != 0) {
+			iEmphasis++;
+		}
+		if (iItalic != 0) {
+			iEmphasis += 2;
+		}
+		for (iFtc = 0, pTmp = pFontTable + iEmphasis;
+		     pTmp < pFontTable + tFontTableRecords;
+		     iFtc++, pTmp += 4) {
+			if (iFtc >= 16 && iFtc <= 55) {
+				ucPrq = PITCH_VARIABLE;
+				ucFf = FAMILY_ROMAN;
+				aucFont = (UCHAR *)"Times";
+			} else {
+				ucPrq = PITCH_FIXED;
+				ucFf = FAMILY_MODERN;
+				aucFont = (UCHAR *)"Courier";
+			}
+			ucFFN = (ucFf << 4) | ucPrq;
+			vFontname2Table(aucFont, NULL, 1, iEmphasis,
+					ucFFN, szWordFont, szOurFont, pTmp);
+		}
+	}
+	(void)fclose(pFontTableFile);
+	vMinimizeFontTable();
+} /* end of vCreate0FontTable */
+
+/*
+ * vCreate2FontTable - create a font table from WinWord 1/2
+ */
+void
+vCreate2FontTable(FILE *pFile, const UCHAR *aucHeader)
+{
+	FILE	*pFontTableFile;
+	font_table_type	*pTmp;
+	UCHAR	*aucFont;
+	UCHAR	*aucBuffer;
+	ULONG	ulBeginFontInfo;
+	size_t	tFontInfoLen;
+	int	iPos, iRecLen;
+	int	iBold, iItalic, iSpecial, iEmphasis;
+	UCHAR	ucFFN;
+	char	szWordFont[FONT_LINE_LENGTH], szOurFont[FONT_LINE_LENGTH];
+
+	fail(pFile == NULL || aucHeader == NULL);
+
+	tFontTableRecords = 0;
+	pFontTable = xfree(pFontTable);
+
+	pFontTableFile = pOpenFontTableFile();
+	if (pFontTableFile == NULL) {
+		/* No translation table file, no translation table */
+		return;
+	}
+
+	ulBeginFontInfo = ulGetLong(0xb2, aucHeader); /* fcSttbfffn */
+	DBG_HEX(ulBeginFontInfo);
+	tFontInfoLen = (size_t)usGetWord(0xb6, aucHeader); /* cbSttbfffn */
+	DBG_DEC(tFontInfoLen);
+	fail(tFontInfoLen < 6);
+
+	if (ulBeginFontInfo > (ULONG)LONG_MAX) {
+		/* Don't ask me why this is needed */
+		DBG_HEX(ulBeginFontInfo);
+		(void)fclose(pFontTableFile);
+		return;
+	}
+
+	aucBuffer = xmalloc(tFontInfoLen);
+	if (!bReadBytes(aucBuffer, tFontInfoLen, ulBeginFontInfo, pFile)) {
+		aucBuffer = xfree(aucBuffer);
+		(void)fclose(pFontTableFile);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tFontInfoLen);
+	DBG_DEC(usGetWord(0, aucBuffer));
+
+	/* Compute the maximum number of entries in the font table */
+	tFontTableRecords = 0;
+	iPos = 2;
+	while (iPos + 3 < (int)tFontInfoLen) {
+		iRecLen = (int)ucGetByte(iPos, aucBuffer);
+		NO_DBG_DEC(iRecLen);
+		NO_DBG_MSG(aucBuffer + iPos + 3);
+		iPos += iRecLen + 1;
+		tFontTableRecords++;
+	}
+	tFontTableRecords *= 4;	/* Plain, Bold, Italic and Bold/italic */
+	tFontTableRecords++;	/* One extra for the table-font */
+	vCreateFontTable();
+
+	/* Read the font translation file */
+	while (bReadFontFile(pFontTableFile, szWordFont,
+			&iItalic, &iBold, szOurFont, &iSpecial)) {
+		iEmphasis = 0;
+		if (iBold != 0) {
+			iEmphasis++;
+		}
+		if (iItalic != 0) {
+			iEmphasis += 2;
+		}
+		pTmp = pFontTable + iEmphasis;
+		iPos = 2;
+		while (iPos + 3 < (int)tFontInfoLen) {
+			iRecLen = (int)ucGetByte(iPos, aucBuffer);
+			ucFFN = ucGetByte(iPos + 1, aucBuffer);
+			aucFont = aucBuffer + iPos + 3;
+			vFontname2Table(aucFont, NULL, 1, iEmphasis,
+					ucFFN, szWordFont, szOurFont, pTmp);
+			pTmp += 4;
+			iPos += iRecLen + 1;
+		}
+	}
+	(void)fclose(pFontTableFile);
+	aucBuffer = xfree(aucBuffer);
+	vMinimizeFontTable();
+} /* end of vCreate2FontTable */
+
+/*
+ * vCreate6FontTable - create a font table from Word 6/7
+ */
+void
+vCreate6FontTable(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const UCHAR *aucHeader)
+{
+	FILE	*pFontTableFile;
+	font_table_type	*pTmp;
+	UCHAR	*aucFont, *aucAltFont;
+	UCHAR	*aucBuffer;
+	ULONG	ulBeginFontInfo;
+	size_t	tFontInfoLen;
+	int	iPos, iRecLen, iOffsetAltName;
+	int	iBold, iItalic, iSpecial, iEmphasis;
+	UCHAR	ucFFN;
+	char	szWordFont[FONT_LINE_LENGTH], szOurFont[FONT_LINE_LENGTH];
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	tFontTableRecords = 0;
+	pFontTable = xfree(pFontTable);
+
+	pFontTableFile = pOpenFontTableFile();
+	if (pFontTableFile == NULL) {
+		/* No translation table file, no translation table */
+		return;
+	}
+
+	ulBeginFontInfo = ulGetLong(0xd0, aucHeader); /* fcSttbfffn */
+	DBG_HEX(ulBeginFontInfo);
+	tFontInfoLen = (size_t)ulGetLong(0xd4, aucHeader); /* lcbSttbfffn */
+	DBG_DEC(tFontInfoLen);
+	fail(tFontInfoLen < 9);
+
+	aucBuffer = xmalloc(tFontInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginFontInfo, tFontInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		(void)fclose(pFontTableFile);
+		return;
+	}
+	DBG_DEC(usGetWord(0, aucBuffer));
+
+	/* Compute the maximum number of entries in the font table */
+	tFontTableRecords = 0;
+	iPos = 2;
+	while (iPos + 6 < (int)tFontInfoLen) {
+		iRecLen = (int)ucGetByte(iPos, aucBuffer);
+		NO_DBG_DEC(iRecLen);
+		iOffsetAltName = (int)ucGetByte(iPos + 5, aucBuffer);
+		NO_DBG_MSG(aucBuffer + iPos + 6);
+		NO_DBG_MSG_C(iOffsetAltName > 0,
+				aucBuffer + iPos + 6 + iOffsetAltName);
+		iPos += iRecLen + 1;
+		tFontTableRecords++;
+	}
+	tFontTableRecords *= 4;	/* Plain, Bold, Italic and Bold/italic */
+	tFontTableRecords++;	/* One extra for the table-font */
+	vCreateFontTable();
+
+	/* Read the font translation file */
+	while (bReadFontFile(pFontTableFile, szWordFont,
+			&iItalic, &iBold, szOurFont, &iSpecial)) {
+		iEmphasis = 0;
+		if (iBold != 0) {
+			iEmphasis++;
+		}
+		if (iItalic != 0) {
+			iEmphasis += 2;
+		}
+		pTmp = pFontTable + iEmphasis;
+		iPos = 2;
+		while (iPos + 6 < (int)tFontInfoLen) {
+			iRecLen = (int)ucGetByte(iPos, aucBuffer);
+			ucFFN = ucGetByte(iPos + 1, aucBuffer);
+			aucFont = aucBuffer + iPos + 6;
+			iOffsetAltName = (int)ucGetByte(iPos + 5, aucBuffer);
+			if (iOffsetAltName <= 0) {
+				aucAltFont = NULL;
+			} else {
+				aucAltFont = aucFont + iOffsetAltName;
+				NO_DBG_MSG(aucFont);
+				NO_DBG_MSG(aucAltFont);
+			}
+			vFontname2Table(aucFont, aucAltFont, 1, iEmphasis,
+					ucFFN, szWordFont, szOurFont, pTmp);
+			pTmp += 4;
+			iPos += iRecLen + 1;
+		}
+	}
+	(void)fclose(pFontTableFile);
+	aucBuffer = xfree(aucBuffer);
+	vMinimizeFontTable();
+} /* end of vCreate6FontTable */
+
+/*
+ * vCreate8FontTable - create a font table from Word 8/9/10
+ */
+void
+vCreate8FontTable(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	FILE	*pFontTableFile;
+	font_table_type	*pTmp;
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucFont, *aucAltFont;
+	UCHAR	*aucBuffer;
+	ULONG	ulBeginFontInfo;
+	ULONG	ulTableSize, ulTableStartBlock;
+	size_t	tFontInfoLen, tBlockDepotLen, tBlockSize;
+	int	iPos, iRecLen, iOffsetAltName;
+	int	iBold, iItalic, iSpecial, iEmphasis;
+	USHORT	usDocStatus;
+	UCHAR	ucFFN;
+	char	szWordFont[FONT_LINE_LENGTH], szOurFont[FONT_LINE_LENGTH];
+
+	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
+	fail(aulBBD == NULL || aulSBD == NULL);
+
+	tFontTableRecords = 0;
+	pFontTable = xfree(pFontTable);
+
+	pFontTableFile = pOpenFontTableFile();
+	if (pFontTableFile == NULL) {
+		/* No translation table file, no translation table */
+		return;
+	}
+
+	ulBeginFontInfo = ulGetLong(0x112, aucHeader); /* fcSttbfffn */
+	DBG_HEX(ulBeginFontInfo);
+	tFontInfoLen = (size_t)ulGetLong(0x116, aucHeader); /* lcbSttbfffn */
+	DBG_DEC(tFontInfoLen);
+	fail(tFontInfoLen < 46);
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_DEC(ulTableStartBlock);
+		DBG_MSG("No fontname table");
+		(void)fclose(pFontTableFile);
+		return;
+	}
+	DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+		/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+		/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+	aucBuffer = xmalloc(tFontInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginFontInfo, tFontInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		(void)fclose(pFontTableFile);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tFontInfoLen);
+
+	/* Get the maximum number of entries in the font table */
+	tFontTableRecords = (size_t)usGetWord(0, aucBuffer);
+	tFontTableRecords *= 4;	/* Plain, Bold, Italic and Bold/italic */
+	tFontTableRecords++;	/* One extra for the table-font */
+	vCreateFontTable();
+
+	/* Read the font translation file */
+	while (bReadFontFile(pFontTableFile, szWordFont,
+			&iItalic, &iBold, szOurFont, &iSpecial)) {
+		iEmphasis = 0;
+		if (iBold != 0) {
+			iEmphasis++;
+		}
+		if (iItalic != 0) {
+			iEmphasis += 2;
+		}
+		pTmp = pFontTable + iEmphasis;
+		iPos = 4;
+		while (iPos + 40 < (int)tFontInfoLen) {
+			iRecLen = (int)ucGetByte(iPos, aucBuffer);
+			ucFFN = ucGetByte(iPos + 1, aucBuffer);
+			aucFont = aucBuffer + iPos + 40;
+			iOffsetAltName = (int)unilen(aucFont);
+			if (iPos + 40 + iOffsetAltName + 4 >= iRecLen) {
+				aucAltFont = NULL;
+			} else {
+				aucAltFont = aucFont + iOffsetAltName + 2;
+				NO_DBG_UNICODE(aucFont);
+				NO_DBG_UNICODE(aucAltFont);
+			}
+			vFontname2Table(aucFont, aucAltFont, 2, iEmphasis,
+					ucFFN, szWordFont, szOurFont, pTmp);
+			pTmp += 4;
+			iPos += iRecLen + 1;
+		}
+	}
+	(void)fclose(pFontTableFile);
+	aucBuffer = xfree(aucBuffer);
+	vMinimizeFontTable();
+} /* end of vCreate8FontTable */
+
+/*
+ * Destroy the internal font table by freeing its memory
+ */
+void
+vDestroyFontTable(void)
+{
+	DBG_MSG("vDestroyFontTable");
+
+	tFontTableRecords = 0;
+	pFontTable = xfree(pFontTable);
+} /* end of vDestroyFontTable */
+
+/*
+ * pGetNextFontTableRecord
+ *
+ * returns the next record in the table or NULL if there is no next record
+ */
+const font_table_type *
+pGetNextFontTableRecord(const font_table_type *pRecordCurr)
+{
+	int	iIndexCurr;
+
+	if (pRecordCurr == NULL) {
+		/* No current record, so start with the first */
+		return &pFontTable[0];
+	}
+
+	iIndexCurr = pRecordCurr - pFontTable;
+	if (iIndexCurr + 1 < (int)tFontTableRecords) {
+		/* There is a next record, so return it */
+		return &pFontTable[iIndexCurr + 1];
+	}
+	/* There is no next record */
+	return NULL;
+} /* end of pGetNextFontTableRecord */
+
+/*
+ * tGetFontTableLength
+ *
+ * returns the number of records in the internal font table
+ */
+size_t
+tGetFontTableLength(void)
+{
+	return tFontTableRecords;
+} /* end of tGetFontTableLength */

+ 249 - 0
sys/src/cmd/aux/antiword/fonts_r.c

@@ -0,0 +1,249 @@
+/*
+ * fonts_r.c
+ * Copyright (C) 1999-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to deal with fonts (RiscOs version)
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "antiword.h"
+
+static font		tFontCurr = (font)-1;
+
+/*
+ * pOpenFontTableFile - open the Font translation file
+ * Copy the file to the proper place if necessary.
+ *
+ * Returns the file pointer or NULL
+ */
+FILE *
+pOpenFontTableFile(void)
+{
+	FILE	*pFileR, *pFileW;
+	char	*szFontNamesFile;
+	size_t	tSize;
+	BOOL	bFailed;
+	char	acBuffer[256];
+
+	pFileR = fopen("<AntiWord$FontNamesFile>", "r");
+	if (pFileR != NULL) {
+		/* The font table is already in the right directory */
+		return pFileR;
+	}
+
+	szFontNamesFile = getenv("AntiWord$FontNamesSave");
+	if (szFontNamesFile == NULL) {
+		werr(0, "Warning: Name of the FontNames file not found");
+		return NULL;
+	}
+	DBG_MSG(szFontNamesFile);
+
+	pFileR = fopen("<AntiWord$Dir>.Resources.Default", "r");
+	if (pFileR == NULL) {
+		werr(0, "I can't find 'Resources.Default'");
+		return NULL;
+	}
+	/* Here the default font translation table is known to exist */
+
+	if (!bMakeDirectory(szFontNamesFile)) {
+		werr(0,
+		"I can't make a directory for the FontNames file");
+		return NULL;
+	}
+	/* Here the proper directory is known to exist */
+
+	pFileW = fopen(szFontNamesFile, "w");
+	if (pFileW == NULL) {
+		(void)fclose(pFileR);
+		werr(0, "I can't create a default FontNames file");
+		return NULL;
+	}
+	/* Here the proper directory is known to be writeable */
+
+	/* Copy the default FontNames file */
+	bFailed = FALSE;
+	while (!feof(pFileR)) {
+		tSize = fread(acBuffer, 1, sizeof(acBuffer), pFileR);
+		if (ferror(pFileR)) {
+			DBG_MSG("Read error");
+			bFailed = TRUE;
+			break;
+		}
+		if (fwrite(acBuffer, 1, tSize, pFileW) != tSize) {
+			DBG_MSG("Write error");
+			bFailed = TRUE;
+			break;
+		}
+	}
+	(void)fclose(pFileW);
+	(void)fclose(pFileR);
+	if (bFailed) {
+		DBG_MSG("Copying the FontNames file failed");
+		(void)remove(szFontNamesFile);
+		return NULL;
+	}
+	return fopen(szFontNamesFile, "r");
+} /* end of pOpenFontTableFile */
+
+/*
+ * vCloseFont - close the current font, if any
+ */
+void
+vCloseFont(void)
+{
+	os_error	*e;
+
+	NO_DBG_MSG("vCloseFont");
+
+	if (tFontCurr == (font)-1) {
+		return;
+	}
+	e = font_lose(tFontCurr);
+	if (e != NULL) {
+		werr(0, "Close font error %d: %s", e->errnum, e->errmess);
+	}
+	tFontCurr = -1;
+} /* end of vCloseFont */
+
+/*
+ * tOpenFont - make the specified font the current font
+ *
+ * Returns the font reference number for use in a draw file
+ */
+draw_fontref
+tOpenFont(UCHAR ucWordFontNumber, USHORT usFontStyle, USHORT usWordFontSize)
+{
+	os_error	*e;
+	const char	*szOurFontname;
+	font	tFont;
+	int	iFontnumber;
+
+	NO_DBG_MSG("tOpenFont");
+	NO_DBG_DEC(ucWordFontNumber);
+	NO_DBG_HEX(usFontStyle);
+	NO_DBG_DEC(usWordFontSize);
+
+	/* Keep the relevant bits */
+	usFontStyle &= FONT_BOLD|FONT_ITALIC;
+	NO_DBG_HEX(usFontStyle);
+
+	iFontnumber = iGetFontByNumber(ucWordFontNumber, usFontStyle);
+	szOurFontname = szGetOurFontname(iFontnumber);
+	if (szOurFontname == NULL || szOurFontname[0] == '\0') {
+		tFontCurr = (font)-1;
+		return (draw_fontref)0;
+	}
+	NO_DBG_MSG(szOurFontname);
+	e = font_find((char *)szOurFontname,
+			(int)usWordFontSize * 8, (int)usWordFontSize * 8,
+			0, 0, &tFont);
+	if (e != NULL) {
+		switch (e->errnum) {
+		case 523:
+			werr(0, "%s", e->errmess);
+			break;
+		default:
+			werr(0, "Open font error %d: %s",
+				e->errnum, e->errmess);
+			break;
+		}
+		tFontCurr = (font)-1;
+		return (draw_fontref)0;
+	}
+	tFontCurr = tFont;
+	NO_DBG_DEC(tFontCurr);
+	return (draw_fontref)(iFontnumber + 1);
+} /* end of tOpenFont */
+
+/*
+ * tOpenTableFont - make the table font the current font
+ *
+ * Returns the font reference number for use in a draw file
+ */
+draw_fontref
+tOpenTableFont(USHORT usWordFontSize)
+{
+	int	iWordFontnumber;
+
+	NO_DBG_MSG("tOpenTableFont");
+
+	iWordFontnumber = iFontname2Fontnumber(TABLE_FONT, FONT_REGULAR);
+	if (iWordFontnumber < 0 || iWordFontnumber > (int)UCHAR_MAX) {
+		DBG_DEC(iWordFontnumber);
+		tFontCurr = (font)-1;
+		return (draw_fontref)0;
+	}
+
+	return tOpenFont((UCHAR)iWordFontnumber, FONT_REGULAR, usWordFontSize);
+} /* end of tOpenTableFont */
+
+/*
+ * lComputeStringWidth - compute the string width
+ *
+ * Returns the string width in millipoints
+ */
+long
+lComputeStringWidth(const char *szString, size_t tStringLength,
+		draw_fontref tFontRef, USHORT usFontSize)
+{
+	font_string	tStr;
+	os_error	*e;
+
+	fail(szString == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+
+	if (szString[0] == '\0' || tStringLength == 0) {
+		/* Empty string */
+		return 0;
+	}
+	if (tStringLength == 1 && szString[0] == TABLE_SEPARATOR) {
+		/* Font_strwidth doesn't like control characters */
+		return 0;
+	}
+	if (tFontCurr == (font)-1) {
+		/* No current font, use systemfont */
+		return lChar2MilliPoints(tStringLength);
+	}
+	tStr.s = (char *)szString;
+	tStr.x = INT_MAX;
+	tStr.y = INT_MAX;
+	tStr.split = -1;
+	tStr.term = tStringLength;
+	e = font_strwidth(&tStr);
+	if (e == NULL) {
+		return (long)tStr.x;
+	}
+	DBG_DEC(e->errnum);
+	DBG_MSG(e->errmess);
+	DBG_DEC(tStringLength);
+	DBG_MSG(szString);
+	werr(0, "String width error %d: %s", e->errnum, e->errmess);
+	return lChar2MilliPoints(tStringLength);
+} /* end of lComputeStringWidth */
+
+/*
+ * tCountColumns - count the number of columns in a string
+ *
+ * Returns the number of columns
+ */
+size_t
+tCountColumns(const char *szString, size_t tLength)
+{
+	fail(szString == NULL);
+
+	/* One byte, one character, one column */
+	return tLength;
+} /* end of tCountColumns */
+
+/*
+ * tGetCharacterLength - the length of the specified character in bytes
+ *
+ * Returns the length in bytes
+ */
+size_t
+tGetCharacterLength(const char *szString)
+{
+	return 1;
+} /* end of tGetCharacterLength */

+ 287 - 0
sys/src/cmd/aux/antiword/fonts_u.c

@@ -0,0 +1,287 @@
+/*
+ * fonts_u.c
+ * Copyright (C) 1999-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to deal with fonts (Unix version)
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "antiword.h"
+#include "fontinfo.h"
+
+/* Don't use fonts, just plain text */
+static BOOL		bUsePlainText = TRUE;
+/* Which character set should be used */
+static encoding_type	eEncoding = encoding_neutral;
+
+
+/*
+ * pOpenFontTableFile - open the Font translation file
+ *
+ * Returns the file pointer or NULL
+ */
+FILE *
+pOpenFontTableFile(void)
+{
+	FILE		*pFile;
+	const char	*szHome, *szAntiword;
+	const char	*szGlobalFile;
+	char		szEnvironmentFile[PATH_MAX+1];
+	char		szLocalFile[PATH_MAX+1];
+
+	/* Try the environment version of the fontnames file */
+	szAntiword = szGetAntiwordDirectory();
+	if (szAntiword != NULL && szAntiword[0] != '\0') {
+		if (strlen(szAntiword) +
+		    sizeof(FILE_SEPARATOR FONTNAMES_FILE) >=
+		    sizeof(szEnvironmentFile)) {
+			werr(0,
+			"The name of your ANTIWORDHOME directory is too long");
+			return NULL;
+		}
+		sprintf(szEnvironmentFile, "%s%s",
+			szAntiword,
+			FILE_SEPARATOR FONTNAMES_FILE);
+		DBG_MSG(szEnvironmentFile);
+
+		pFile = fopen(szLocalFile, "r");
+		if (pFile != NULL) {
+			return pFile;
+		}
+	}
+
+	/* Try the local version of the fontnames file */
+	szHome = szGetHomeDirectory();
+	if (strlen(szHome) +
+	    sizeof(FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR FONTNAMES_FILE) >=
+	    sizeof(szLocalFile)) {
+		werr(0, "The name of your HOME directory is too long");
+		return NULL;
+	}
+
+	sprintf(szLocalFile, "%s%s",
+		szHome,
+		FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR FONTNAMES_FILE);
+	DBG_MSG(szLocalFile);
+
+	pFile = fopen(szLocalFile, "r");
+	if (pFile != NULL) {
+		return pFile;
+	}
+
+	/* Try the global version of the fontnames file */
+	szGlobalFile = GLOBAL_ANTIWORD_DIR FILE_SEPARATOR FONTNAMES_FILE;
+	DBG_MSG(szGlobalFile);
+
+	pFile = fopen(szGlobalFile, "r");
+	if (pFile != NULL) {
+		return pFile;
+	}
+
+	werr(0, "I can not open your fontnames file.\n"
+		"Neither '%s' nor\n"
+		"'%s' can be opened for reading.",
+		szLocalFile, szGlobalFile);
+	return NULL;
+} /* end of pOpenFontTableFile */
+
+/*
+ * vCloseFont - close the current font, if any
+ */
+void
+vCloseFont(void)
+{
+	NO_DBG_MSG("vCloseFont");
+	/* For safety: to be overwritten at the next call of tOpenfont() */
+	bUsePlainText = TRUE;
+	eEncoding = encoding_neutral;
+} /* end of vCloseFont */
+
+/*
+ * tOpenFont - make the specified font the current font
+ *
+ * Returns the font reference number
+ */
+draw_fontref
+tOpenFont(UCHAR ucWordFontNumber, USHORT usFontStyle, USHORT usWordFontSize)
+{
+	options_type	tOptions;
+	const char	*szOurFontname;
+	int	iIndex, iFontnumber;
+
+	NO_DBG_MSG("tOpenFont");
+	NO_DBG_DEC(ucWordFontNumber);
+	NO_DBG_HEX(usFontStyle);
+	NO_DBG_DEC(usWordFontSize);
+
+	/* Keep the relevant bits */
+	usFontStyle &= FONT_BOLD|FONT_ITALIC;
+	NO_DBG_HEX(usFontStyle);
+
+	vGetOptions(&tOptions);
+	bUsePlainText = tOptions.eConversionType != conversion_draw &&
+			tOptions.eConversionType != conversion_ps;
+	eEncoding = tOptions.eEncoding;
+
+	if (bUsePlainText) {
+		/* Plain text, no fonts */
+		return (draw_fontref)0;
+	}
+
+	iFontnumber = iGetFontByNumber(ucWordFontNumber, usFontStyle);
+	szOurFontname = szGetOurFontname(iFontnumber);
+	if (szOurFontname == NULL || szOurFontname[0] == '\0') {
+		DBG_DEC(iFontnumber);
+		return (draw_fontref)0;
+	}
+	NO_DBG_MSG(szOurFontname);
+
+	for (iIndex = 0; iIndex < (int)elementsof(szFontnames); iIndex++) {
+		if (STREQ(szFontnames[iIndex], szOurFontname)) {
+			NO_DBG_DEC(iIndex);
+			return (draw_fontref)iIndex;
+		}
+	}
+	return (draw_fontref)0;
+} /* end of tOpenFont */
+
+/*
+ * tOpenTableFont - make the table font the current font
+ *
+ * Returns the font reference number
+ */
+draw_fontref
+tOpenTableFont(USHORT usWordFontSize)
+{
+	options_type	tOptions;
+	int	iWordFontnumber;
+
+	NO_DBG_MSG("tOpenTableFont");
+
+	vGetOptions(&tOptions);
+	bUsePlainText = tOptions.eConversionType != conversion_draw &&
+			tOptions.eConversionType != conversion_ps;
+	eEncoding = tOptions.eEncoding;
+
+	if (bUsePlainText) {
+		/* Plain text, no fonts */
+		return (draw_fontref)0;
+	}
+
+	iWordFontnumber = iFontname2Fontnumber(TABLE_FONT, FONT_REGULAR);
+	if (iWordFontnumber < 0 || iWordFontnumber > (int)UCHAR_MAX) {
+		DBG_DEC(iWordFontnumber);
+		return (draw_fontref)0;
+	}
+
+	return tOpenFont((UCHAR)iWordFontnumber, FONT_REGULAR, usWordFontSize);
+} /* end of tOpenTableFont */
+
+/*
+ * szGetFontname - get the fontname
+ */
+const char *
+szGetFontname(draw_fontref tFontRef)
+{
+	fail((size_t)(UCHAR)tFontRef >= elementsof(szFontnames));
+	return szFontnames[(int)(UCHAR)tFontRef];
+} /* end of szGetFontname */
+
+/*
+ * lComputeStringWidth - compute the string width
+ *
+ * Note: the fontsize is specified in half-points!
+ *       the stringlength is specified in bytes, not characters!
+ *
+ * Returns the string width in millipoints
+ */
+long
+lComputeStringWidth(const char *szString, size_t tStringLength,
+		draw_fontref tFontRef, USHORT usFontSize)
+{
+	USHORT	*ausCharWidths;
+	UCHAR	*pucChar;
+	long	lRelWidth;
+	size_t	tIndex;
+	int	iFontRef;
+
+	fail(szString == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+
+	if (szString[0] == '\0' || tStringLength == 0) {
+		/* Empty string */
+		return 0;
+	}
+
+	if (eEncoding == encoding_utf8) {
+		fail(!bUsePlainText);
+		return lChar2MilliPoints(
+			utf8_strwidth(szString, tStringLength));
+	}
+
+	if (bUsePlainText) {
+		/* No current font, use "systemfont" */
+		return lChar2MilliPoints(tStringLength);
+	}
+
+	DBG_DEC_C(eEncoding != encoding_iso_8859_1 &&
+		eEncoding != encoding_iso_8859_2, eEncoding);
+	fail(eEncoding != encoding_iso_8859_1 &&
+		eEncoding != encoding_iso_8859_2);
+
+	/* Compute the relative string width */
+	iFontRef = (int)(UCHAR)tFontRef;
+	if (eEncoding == encoding_iso_8859_2) {
+		ausCharWidths = ausCharacterWidths2[iFontRef];
+	} else {
+		ausCharWidths = ausCharacterWidths1[iFontRef];
+	}
+	lRelWidth = 0;
+	for (tIndex = 0, pucChar = (UCHAR *)szString;
+	     tIndex < tStringLength;
+	     tIndex++, pucChar++) {
+		lRelWidth += (long)ausCharWidths[(int)*pucChar];
+	}
+
+	/* Compute the absolute string width */
+	return (lRelWidth * usFontSize + 1) / 2;
+} /* end of lComputeStringWidth */
+
+/*
+ * tCountColumns - count the number of columns in a string
+ *
+ * Note: the length is specified in bytes!
+ *       A UTF-8 a character can be 0, 1 or 2 columns wide.
+ *
+ * Returns the number of columns
+ */
+size_t
+tCountColumns(const char *szString, size_t tLength)
+{
+	fail(szString == NULL);
+
+	if (eEncoding != encoding_utf8) {
+		/* One byte, one character, one column */
+		return tLength;
+	}
+	return (size_t)utf8_strwidth(szString, tLength);
+} /* end of tCountColumns */
+
+/*
+ * tGetCharacterLength - the length of the specified character in bytes
+ *
+ * Returns the length in bytes
+ */
+size_t
+tGetCharacterLength(const char *szString)
+{
+	fail(szString == NULL);
+
+	if (eEncoding != encoding_utf8) {
+		return 1;
+	}
+	return (size_t)utf8_chrlength(szString);
+} /* end of tGetCharacterLength */

+ 94 - 0
sys/src/cmd/aux/antiword/icons.c

@@ -0,0 +1,94 @@
+/*
+ * icons.c
+ * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Update window icons
+ */
+
+#include <string.h>
+#include "wimpt.h"
+#include "antiword.h"
+
+void
+vUpdateIcon(wimp_w tWindow, wimp_icon *pIcon)
+{
+	wimp_redrawstr	r;
+	BOOL		bMore;
+
+	r.w = tWindow;
+	r.box = pIcon->box;
+	wimpt_noerr(wimp_update_wind(&r, &bMore));
+	while (bMore) {
+		(void)wimp_ploticon(pIcon);
+		wimpt_noerr(wimp_get_rectangle(&r, &bMore));
+	}
+} /* end of vUpdateIcon */
+
+void
+vUpdateRadioButton(wimp_w tWindow, wimp_i tIconNumber, BOOL bSelected)
+{
+	wimp_icon	tIcon;
+
+	wimpt_noerr(wimp_get_icon_info(tWindow, tIconNumber, &tIcon));
+	DBG_DEC(tIconNumber);
+	DBG_HEX(tIcon.flags);
+	if (bSelected ==
+	    ((tIcon.flags & wimp_ISELECTED) == wimp_ISELECTED)) {
+		/* No update needed */
+		return;
+	}
+	wimpt_noerr(wimp_set_icon_state(tWindow, tIconNumber,
+			bSelected ? wimp_ISELECTED : 0, wimp_ISELECTED));
+	vUpdateIcon(tWindow, &tIcon);
+} /* end of vUpdateRadioButton */
+
+/*
+ * vUpdateWriteable - update a writeable icon with a string
+ */
+void
+vUpdateWriteable(wimp_w tWindow, wimp_i tIconNumber, char *szString)
+{
+	wimp_icon	tIcon;
+	wimp_caretstr	tCaret;
+	int		iLen;
+
+	fail(szString == NULL);
+
+	NO_DBG_DEC(tIconNumber);
+	NO_DBG_MSG(szString);
+
+	wimpt_noerr(wimp_get_icon_info(tWindow, tIconNumber, &tIcon));
+	NO_DBG_HEX(tIcon.flags);
+	if ((tIcon.flags & (wimp_ITEXT|wimp_INDIRECT)) !=
+	    (wimp_ITEXT|wimp_INDIRECT)) {
+		werr(1, "Icon %d must be indirected text", (int)tIconNumber);
+		return;
+	}
+	strncpy(tIcon.data.indirecttext.buffer,
+		szString,
+		tIcon.data.indirecttext.bufflen - 1);
+	/* Ensure the caret is behind the last character of the text */
+	wimpt_noerr(wimp_get_caret_pos(&tCaret));
+	if (tCaret.w == tWindow && tCaret.i == tIconNumber) {
+		iLen = strlen(tIcon.data.indirecttext.buffer);
+		if (tCaret.index != iLen) {
+			tCaret.index = iLen;
+			wimpt_noerr(wimp_set_caret_pos(&tCaret));
+		}
+	}
+	wimpt_noerr(wimp_set_icon_state(tWindow, tIconNumber, 0,0));
+	vUpdateIcon(tWindow, &tIcon);
+} /* end of vUpdateWriteable */
+
+/*
+ * vUpdateWriteableNumber - update a writeable icon with a number
+ */
+void
+vUpdateWriteableNumber(wimp_w tWindow, wimp_i tIconNumber, int iNumber)
+{
+	char	szTmp[12];
+
+	(void)sprintf(szTmp, "%d", iNumber);
+	vUpdateWriteable(tWindow, tIconNumber, szTmp);
+} /* end of vUpdateWriteableNumber */

+ 1014 - 0
sys/src/cmd/aux/antiword/imgexam.c

@@ -0,0 +1,1014 @@
+/*
+ * imgexam.c
+ * Copyright (C) 2000-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to examine image headers
+ *
+ *================================================================
+ * Part of this software is based on:
+ * jpeg2ps - convert JPEG compressed images to PostScript Level 2
+ * Copyright (C) 1994-99 Thomas Merz (tm@muc.de)
+ *================================================================
+ * The credit should go to him, but all the bugs are mine.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+#include "antiword.h"
+
+/* BMP compression types */
+#define BI_RGB		0
+#define BI_RLE8		1
+#define BI_RLE4		2
+
+/* PNG colortype bits */
+#define PNG_CB_PALETTE		0x01
+#define PNG_CB_COLOR		0x02
+#define PNG_CB_ALPHA		0x04
+
+/* The following enum is stolen from the IJG JPEG library */
+typedef enum {		/* JPEG marker codes			*/
+	M_SOF0	= 0xc0,	/* baseline DCT				*/
+	M_SOF1	= 0xc1,	/* extended sequential DCT		*/
+	M_SOF2	= 0xc2,	/* progressive DCT			*/
+	M_SOF3	= 0xc3,	/* lossless (sequential)		*/
+
+	M_SOF5	= 0xc5,	/* differential sequential DCT		*/
+	M_SOF6	= 0xc6,	/* differential progressive DCT		*/
+	M_SOF7	= 0xc7,	/* differential lossless		*/
+
+	M_JPG	= 0xc8,	/* JPEG extensions			*/
+	M_SOF9	= 0xc9,	/* extended sequential DCT		*/
+	M_SOF10	= 0xca,	/* progressive DCT			*/
+	M_SOF11	= 0xcb,	/* lossless (sequential)		*/
+
+	M_SOF13	= 0xcd,	/* differential sequential DCT		*/
+	M_SOF14	= 0xce,	/* differential progressive DCT		*/
+	M_SOF15	= 0xcf,	/* differential lossless		*/
+
+	M_DHT	= 0xc4,	/* define Huffman tables		*/
+
+	M_DAC	= 0xcc,	/* define arithmetic conditioning table	*/
+
+	M_RST0	= 0xd0,	/* restart				*/
+	M_RST1	= 0xd1,	/* restart				*/
+	M_RST2	= 0xd2,	/* restart				*/
+	M_RST3	= 0xd3,	/* restart				*/
+	M_RST4	= 0xd4,	/* restart				*/
+	M_RST5	= 0xd5,	/* restart				*/
+	M_RST6	= 0xd6,	/* restart				*/
+	M_RST7	= 0xd7,	/* restart				*/
+
+	M_SOI	= 0xd8,	/* start of image			*/
+	M_EOI	= 0xd9,	/* end of image				*/
+	M_SOS	= 0xda,	/* start of scan			*/
+	M_DQT	= 0xdb,	/* define quantization tables		*/
+	M_DNL	= 0xdc,	/* define number of lines		*/
+	M_DRI	= 0xdd,	/* define restart interval		*/
+	M_DHP	= 0xde,	/* define hierarchical progression	*/
+	M_EXP	= 0xdf,	/* expand reference image(s)		*/
+
+	M_APP0	= 0xe0,	/* application marker, used for JFIF	*/
+	M_APP1	= 0xe1,	/* application marker			*/
+	M_APP2	= 0xe2,	/* application marker			*/
+	M_APP3	= 0xe3,	/* application marker			*/
+	M_APP4	= 0xe4,	/* application marker			*/
+	M_APP5	= 0xe5,	/* application marker			*/
+	M_APP6	= 0xe6,	/* application marker			*/
+	M_APP7	= 0xe7,	/* application marker			*/
+	M_APP8	= 0xe8,	/* application marker			*/
+	M_APP9	= 0xe9,	/* application marker			*/
+	M_APP10	= 0xea,	/* application marker			*/
+	M_APP11	= 0xeb,	/* application marker			*/
+	M_APP12	= 0xec,	/* application marker			*/
+	M_APP13	= 0xed,	/* application marker			*/
+	M_APP14	= 0xee,	/* application marker, used by Adobe	*/
+	M_APP15	= 0xef,	/* application marker			*/
+
+	M_JPG0	= 0xf0,	/* reserved for JPEG extensions		*/
+	M_JPG13	= 0xfd,	/* reserved for JPEG extensions		*/
+	M_COM	= 0xfe,	/* comment				*/
+
+	M_TEM	= 0x01	/* temporary use			*/
+} JPEG_MARKER;
+
+
+/*
+ * bFillPaletteDIB - fill the palette part of the imagesdata
+ *
+ * returns TRUE if the images must be a color image, otherwise FALSE;
+ */
+static BOOL
+bFillPaletteDIB(FILE *pFile, imagedata_type *pImg, BOOL bNewFormat)
+{
+	int	iIndex;
+	BOOL	bIsColorPalette;
+
+	fail(pFile == NULL);
+	fail(pImg == NULL);
+
+	if (pImg->uiBitsPerComponent > 8) {
+		/* No palette, image uses more than 256 colors */
+		return TRUE;
+	}
+
+	if (pImg->iColorsUsed <= 0) {
+		/* Not specified, so compute the number of colors used */
+		pImg->iColorsUsed = 1 << pImg->uiBitsPerComponent;
+	}
+
+	fail(pImg->iColorsUsed > 256);
+	if (pImg->iColorsUsed > 256) {
+		pImg->iColorsUsed = 256;
+	}
+
+	bIsColorPalette = FALSE;
+	for (iIndex = 0; iIndex < pImg->iColorsUsed; iIndex++) {
+		/* From BGR order to RGB order */
+		pImg->aucPalette[iIndex][2] = (UCHAR)iNextByte(pFile);
+		pImg->aucPalette[iIndex][1] = (UCHAR)iNextByte(pFile);
+		pImg->aucPalette[iIndex][0] = (UCHAR)iNextByte(pFile);
+		if (bNewFormat) {
+			(void)iNextByte(pFile);
+		}
+		NO_DBG_PRINT_BLOCK(pImg->aucPalette[iIndex], 3);
+		if (pImg->aucPalette[iIndex][0] !=
+		     pImg->aucPalette[iIndex][1] ||
+		    pImg->aucPalette[iIndex][1] !=
+		     pImg->aucPalette[iIndex][2]) {
+			bIsColorPalette = TRUE;
+		}
+	}
+
+	return bIsColorPalette;
+} /* end of bFillPaletteDIB */
+
+/*
+ * bExamineDIB - Examine a DIB header
+ *
+ * return TRUE if successful, otherwise FALSE
+ */
+static BOOL
+bExamineDIB(FILE *pFile, imagedata_type *pImg)
+{
+	size_t	tHeaderSize;
+	int	iPlanes, iCompression;
+
+	tHeaderSize = (size_t)ulNextLong(pFile);
+	switch (tHeaderSize) {
+	case 12:
+		pImg->iWidth = (int)usNextWord(pFile);
+		pImg->iHeight = (int)usNextWord(pFile);
+		iPlanes = (int)usNextWord(pFile);
+		pImg->uiBitsPerComponent = (UINT)usNextWord(pFile);
+		iCompression = BI_RGB;
+		pImg->iColorsUsed = 0;
+		break;
+	case 40:
+	case 64:
+		pImg->iWidth = (int)ulNextLong(pFile);
+		pImg->iHeight = (int)ulNextLong(pFile);
+		iPlanes = (int)usNextWord(pFile);
+		pImg->uiBitsPerComponent = (UINT)usNextWord(pFile);
+		iCompression = (int)ulNextLong(pFile);
+		(void)tSkipBytes(pFile, 12);
+		pImg->iColorsUsed = (int)ulNextLong(pFile);
+		(void)tSkipBytes(pFile, tHeaderSize - 36);
+		break;
+	default:
+		DBG_DEC(tHeaderSize);
+		return FALSE;
+	}
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+	DBG_DEC(pImg->uiBitsPerComponent);
+	DBG_DEC(iCompression);
+	DBG_DEC(pImg->iColorsUsed);
+
+	/* Do some sanity checks with the parameters */
+	if (iPlanes != 1) {
+		DBG_DEC(iPlanes);
+		return FALSE;
+	}
+	if (pImg->iWidth <= 0 || pImg->iHeight <= 0) {
+		DBG_DEC(pImg->iWidth);
+		DBG_DEC(pImg->iHeight);
+		return FALSE;
+	}
+	if (pImg->uiBitsPerComponent != 1 && pImg->uiBitsPerComponent != 4 &&
+	    pImg->uiBitsPerComponent != 8 && pImg->uiBitsPerComponent != 24) {
+		DBG_DEC(pImg->uiBitsPerComponent);
+		return FALSE;
+	}
+	if (iCompression != BI_RGB &&
+	    (pImg->uiBitsPerComponent == 1 || pImg->uiBitsPerComponent == 24)) {
+		return FALSE;
+	}
+	if (iCompression == BI_RLE8 && pImg->uiBitsPerComponent == 4) {
+		return FALSE;
+	}
+	if (iCompression == BI_RLE4 && pImg->uiBitsPerComponent == 8) {
+		return FALSE;
+	}
+
+	switch (iCompression) {
+	case BI_RGB:
+		pImg->eCompression = compression_none;
+		break;
+	case BI_RLE4:
+		pImg->eCompression = compression_rle4;
+		break;
+	case BI_RLE8:
+		pImg->eCompression = compression_rle8;
+		break;
+	default:
+		DBG_DEC(iCompression);
+		return FALSE;
+	}
+
+	pImg->bColorImage = bFillPaletteDIB(pFile, pImg, tHeaderSize > 12);
+
+	if (pImg->uiBitsPerComponent <= 8) {
+		pImg->iComponents = 1;
+	} else {
+		pImg->iComponents = (int)(pImg->uiBitsPerComponent / 8);
+	}
+
+	return TRUE;
+} /* end of bExamineDIB */
+
+/*
+ * iNextMarker - read the next JPEG marker
+ */
+static int
+iNextMarker(FILE *pFile)
+{
+	int	iMarker;
+
+	do {
+		do {
+			iMarker = iNextByte(pFile);
+		} while (iMarker != 0xff && iMarker != EOF);
+		if (iMarker == EOF) {
+			return EOF;
+		}
+		do {
+			iMarker = iNextByte(pFile);
+		} while (iMarker == 0xff);
+	} while (iMarker == 0x00);			/* repeat if ff/00 */
+
+	return iMarker;
+} /* end of iNextMarker */
+
+/*
+ * bExamineJPEG - Examine a JPEG header
+ *
+ * return TRUE if successful, otherwise FALSE
+ */
+static BOOL
+bExamineJPEG(FILE *pFile, imagedata_type *pImg)
+{
+	size_t	tLength;
+	int	iMarker, iIndex;
+	char	appstring[10];
+	BOOL	bSOFDone;
+
+	tLength = 0;
+	bSOFDone = FALSE;
+
+	/* process JPEG markers */
+	while (!bSOFDone && (iMarker = iNextMarker(pFile)) != (int)M_EOI) {
+		switch (iMarker) {
+		case EOF:
+			DBG_MSG("Error: unexpected end of JPEG file");
+			return FALSE;
+	/* The following are not officially supported in PostScript level 2 */
+		case M_SOF2:
+		case M_SOF3:
+		case M_SOF5:
+		case M_SOF6:
+		case M_SOF7:
+		case M_SOF9:
+		case M_SOF10:
+		case M_SOF11:
+		case M_SOF13:
+		case M_SOF14:
+		case M_SOF15:
+			DBG_HEX(iMarker);
+			return FALSE;
+		case M_SOF0:
+		case M_SOF1:
+			tLength = (size_t)usNextWordBE(pFile);
+			pImg->uiBitsPerComponent = (UINT)iNextByte(pFile);
+			pImg->iHeight = (int)usNextWordBE(pFile);
+			pImg->iWidth = (int)usNextWordBE(pFile);
+			pImg->iComponents = iNextByte(pFile);
+			bSOFDone = TRUE;
+			break;
+		case M_APP14:
+		/*
+		 * Check for Adobe application marker. It is known (per Adobe's
+		 * TN5116) to contain the string "Adobe" at the start of the
+		 * APP14 marker.
+		 */
+			tLength = (size_t)usNextWordBE(pFile);
+			if (tLength < 12) {
+				(void)tSkipBytes(pFile, tLength - 2);
+			} else {
+				for (iIndex = 0; iIndex < 5; iIndex++) {
+					appstring[iIndex] =
+							(char)iNextByte(pFile);
+				}
+				appstring[5] = '\0';
+				if (STREQ(appstring, "Adobe")) {
+					pImg->bAdobe = TRUE;
+				}
+				(void)tSkipBytes(pFile, tLength - 7);
+			}
+			break;
+		case M_SOI:		/* ignore markers without parameters */
+		case M_EOI:
+		case M_TEM:
+		case M_RST0:
+		case M_RST1:
+		case M_RST2:
+		case M_RST3:
+		case M_RST4:
+		case M_RST5:
+		case M_RST6:
+		case M_RST7:
+			break;
+		default:		/* skip variable length markers */
+			tLength = (size_t)usNextWordBE(pFile);
+			(void)tSkipBytes(pFile, tLength - 2);
+			break;
+		}
+	}
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+	DBG_DEC(pImg->uiBitsPerComponent);
+	DBG_DEC(pImg->iComponents);
+
+	/* Do some sanity checks with the parameters */
+	if (pImg->iHeight <= 0 ||
+	    pImg->iWidth <= 0 ||
+	    pImg->iComponents <= 0) {
+		DBG_DEC(pImg->iHeight);
+		DBG_DEC(pImg->iWidth);
+		DBG_DEC(pImg->iComponents);
+		return FALSE;
+	}
+
+	/* Some broken JPEG files have this but they print anyway... */
+	if (pImg->iComponents * 3 + 8 != (int)tLength) {
+		DBG_MSG("Warning: SOF marker has incorrect length - ignored");
+	}
+
+	if (pImg->uiBitsPerComponent != 8) {
+		DBG_DEC(pImg->uiBitsPerComponent);
+		DBG_MSG("Not supported in PostScript level 2");
+		return FALSE;
+	}
+
+	if (pImg->iComponents != 1 &&
+	    pImg->iComponents != 3 &&
+	    pImg->iComponents != 4) {
+		DBG_DEC(pImg->iComponents);
+		return FALSE;
+	}
+
+	pImg->bColorImage = pImg->iComponents >= 3;
+	pImg->iColorsUsed = 0;
+	pImg->eCompression = compression_jpeg;
+
+	return TRUE;
+} /* end of bExamineJPEG */
+
+/*
+ * bFillPalettePNG - fill the palette part of the imagesdata
+ *
+ * returns TRUE if sucessful, otherwise FALSE;
+ */
+static BOOL
+bFillPalettePNG(FILE *pFile, imagedata_type *pImg, size_t tLength)
+{
+	int	iIndex, iEntries;
+
+	fail(pFile == NULL);
+	fail(pImg == NULL);
+
+	if (pImg->uiBitsPerComponent > 8) {
+		/* No palette, image uses more than 256 colors */
+		return TRUE;
+	}
+
+	if (!pImg->bColorImage) {
+		/* Only color images can have a palette */
+		return FALSE;
+	}
+
+	if (tLength % 3 != 0) {
+		/* Each palette entry takes three bytes */
+		DBG_DEC(tLength);
+		return FALSE;
+	}
+
+	iEntries = (int)(tLength / 3);
+	DBG_DEC(iEntries);
+	pImg->iColorsUsed = 1 << pImg->uiBitsPerComponent;
+	DBG_DEC(pImg->iColorsUsed);
+
+	if (iEntries > 256) {
+		DBG_DEC(iEntries);
+		return FALSE;
+	}
+
+	for (iIndex = 0; iIndex < iEntries; iIndex++) {
+		pImg->aucPalette[iIndex][0] = (UCHAR)iNextByte(pFile);
+		pImg->aucPalette[iIndex][1] = (UCHAR)iNextByte(pFile);
+		pImg->aucPalette[iIndex][2] = (UCHAR)iNextByte(pFile);
+		NO_DBG_PRINT_BLOCK(pImg->aucPalette[iIndex], 3);
+	}
+	for (;iIndex < pImg->iColorsUsed; iIndex++) {
+		pImg->aucPalette[iIndex][0] = 0;
+		pImg->aucPalette[iIndex][1] = 0;
+		pImg->aucPalette[iIndex][2] = 0;
+	}
+
+	return TRUE;
+} /* end of bFillPalettePNG */
+
+/*
+ * bExaminePNG - Examine a PNG header
+ *
+ * return TRUE if successful, otherwise FALSE
+ */
+static BOOL
+bExaminePNG(FILE *pFile, imagedata_type *pImg)
+{
+	size_t		tLength;
+	ULONG		ulLong1, ulLong2, ulName;
+	int		iIndex, iTmp;
+	int		iCompressionMethod, iFilterMethod, iInterlaceMethod;
+	int		iColor, iIncrement;
+	BOOL		bHasPalette, bHasAlpha;
+	UCHAR	aucBuf[4];
+
+	/* Check signature */
+	ulLong1 = ulNextLongBE(pFile);
+	ulLong2 = ulNextLongBE(pFile);
+	if (ulLong1 != 0x89504e47UL || ulLong2 != 0x0d0a1a0aUL) {
+		DBG_HEX(ulLong1);
+		DBG_HEX(ulLong2);
+		return FALSE;
+	}
+
+	ulName = 0x00;
+	bHasPalette = FALSE;
+
+	/* Examine chunks */
+	while (ulName != PNG_CN_IEND) {
+		tLength = (size_t)ulNextLongBE(pFile);
+		ulName = 0x00;
+		for (iIndex = 0; iIndex < (int)elementsof(aucBuf); iIndex++) {
+			aucBuf[iIndex] = (UCHAR)iNextByte(pFile);
+			if (!isalpha(aucBuf[iIndex])) {
+				DBG_HEX(aucBuf[iIndex]);
+				return FALSE;
+			}
+			ulName <<= 8;
+			ulName |= aucBuf[iIndex];
+		}
+
+		switch (ulName) {
+		case PNG_CN_IHDR:
+			/* Header chunck */
+			if (tLength < 13) {
+				DBG_DEC(tLength);
+				return FALSE;
+			}
+			pImg->iWidth = (int)ulNextLongBE(pFile);
+			pImg->iHeight = (int)ulNextLongBE(pFile);
+			pImg->uiBitsPerComponent = (UINT)iNextByte(pFile);
+			iTmp = iNextByte(pFile);
+			NO_DBG_HEX(iTmp);
+			pImg->bColorImage = (iTmp & PNG_CB_COLOR) != 0;
+			bHasPalette = (iTmp & PNG_CB_PALETTE) != 0;
+			bHasAlpha = (iTmp & PNG_CB_ALPHA) != 0;
+			if (bHasPalette && pImg->uiBitsPerComponent > 8) {
+				/* This should not happen */
+				return FALSE;
+			}
+			pImg->iComponents =
+				(bHasPalette || !pImg->bColorImage) ? 1 : 3;
+			if (bHasAlpha) {
+				pImg->iComponents++;
+			}
+			iCompressionMethod = iNextByte(pFile);
+			if (iCompressionMethod != 0) {
+				DBG_DEC(iCompressionMethod);
+				return FALSE;
+			}
+			iFilterMethod = iNextByte(pFile);
+			if (iFilterMethod != 0) {
+				DBG_DEC(iFilterMethod);
+				return FALSE;
+			}
+			iInterlaceMethod = iNextByte(pFile);
+			if (iInterlaceMethod != 0) {
+				DBG_DEC(iInterlaceMethod);
+				return FALSE;
+			}
+			pImg->iColorsUsed = 0;
+			(void)tSkipBytes(pFile, tLength - 13 + 4);
+			break;
+		case PNG_CN_PLTE:
+			if (!bHasPalette) {
+				return FALSE;
+			}
+			if (!bFillPalettePNG(pFile, pImg, tLength)) {
+				return FALSE;
+			}
+			(void)tSkipBytes(pFile, 4);
+			break;
+		default:
+			(void)tSkipBytes(pFile, tLength + 4);
+			break;
+		}
+	}
+
+	DBG_DEC(pImg->iWidth);
+	DBG_DEC(pImg->iHeight);
+	DBG_DEC(pImg->uiBitsPerComponent);
+	DBG_DEC(pImg->iColorsUsed);
+	DBG_DEC(pImg->iComponents);
+
+	/* Do some sanity checks with the parameters */
+	if (pImg->iWidth <= 0 || pImg->iHeight <= 0) {
+		return FALSE;
+	}
+
+	if (pImg->uiBitsPerComponent != 1 && pImg->uiBitsPerComponent != 2 &&
+	    pImg->uiBitsPerComponent != 4 && pImg->uiBitsPerComponent != 8 &&
+	    pImg->uiBitsPerComponent != 16) {
+		DBG_DEC(pImg->uiBitsPerComponent);
+		return  FALSE;
+	}
+
+	if (pImg->iComponents != 1 && pImg->iComponents != 3) {
+		/* Not supported */
+		DBG_DEC(pImg->iComponents);
+		return FALSE;
+	}
+
+	if (pImg->uiBitsPerComponent > 8) {
+		/* Not supported */
+		DBG_DEC(pImg->uiBitsPerComponent);
+		return FALSE;
+	}
+
+	if (pImg->iColorsUsed == 0 &&
+	    pImg->iComponents == 1 &&
+	    pImg->uiBitsPerComponent <= 4) {
+		/*
+		 * No palette is supplied, but PostScript needs one in these
+		 * cases, so we add a default palette here
+		 */
+		pImg->iColorsUsed = 1 << pImg->uiBitsPerComponent;
+		iIncrement = 0xff / (pImg->iColorsUsed - 1);
+		for (iIndex = 0, iColor = 0x00;
+		     iIndex < pImg->iColorsUsed;
+		     iIndex++, iColor += iIncrement) {
+			pImg->aucPalette[iIndex][0] = (UCHAR)iColor;
+			pImg->aucPalette[iIndex][1] = (UCHAR)iColor;
+			pImg->aucPalette[iIndex][2] = (UCHAR)iColor;
+		}
+		/* Just to be sure */
+		pImg->bColorImage = FALSE;
+	}
+
+	pImg->eCompression = compression_zlib;
+
+	return TRUE;
+} /* end of bExaminePNG */
+
+/*
+ * bExamineWMF - Examine a WMF header
+ *
+ * return TRUE if successful, otherwise FALSE
+ */
+static BOOL
+bExamineWMF(FILE *pFile, imagedata_type *pImg)
+{
+	ULONG	ulFileSize, ulMaxRecord, ulMagic;
+	USHORT	usType, usHeaderSize, usVersion, usNoObjects;
+
+	usType = usNextWord(pFile);
+	usHeaderSize = usNextWord(pFile);
+	ulMagic = ((ULONG)usHeaderSize << 16) | (ULONG)usType;
+	usVersion = usNextWord(pFile);
+	ulFileSize = ulNextLong(pFile);
+	usNoObjects = usNextWord(pFile);
+	ulMaxRecord = ulNextLong(pFile);
+
+	DBG_HEX(ulMagic);
+	DBG_DEC(usType);
+	DBG_DEC(usHeaderSize);
+	DBG_HEX(usVersion);
+	DBG_DEC(ulFileSize);
+	DBG_DEC(usNoObjects);
+	DBG_DEC(ulMaxRecord);
+
+	return FALSE;
+} /* end of bExamineWMF */
+
+#if !defined(__riscos)
+/*
+ * vImage2Papersize - make sure the image fits on the paper
+ *
+ * This function should not be needed if Word would do a proper job
+ */
+static void
+vImage2Papersize(imagedata_type *pImg)
+{
+	static int	iNetPageHeight = -1;
+	static int	iNetPageWidth = -1;
+	options_type	tOptions;
+        double  dVerFactor, dHorFactor, dFactor;
+
+	DBG_MSG("vImage2Papersize");
+
+	fail(pImg == NULL);
+
+	if (iNetPageHeight < 0 || iNetPageWidth < 0) {
+		/* Get the page dimensions from the options */
+		vGetOptions(&tOptions);
+		/* Add 999 to err on the save side */
+		iNetPageHeight = tOptions.iPageHeight -
+				(lDrawUnits2MilliPoints(
+					PS_TOP_MARGIN + PS_BOTTOM_MARGIN) +
+					999) / 1000;
+		iNetPageWidth = tOptions.iPageWidth -
+				(lDrawUnits2MilliPoints(
+					PS_LEFT_MARGIN + PS_RIGHT_MARGIN) +
+					999) / 1000;
+		DBG_DEC(iNetPageHeight);
+		DBG_DEC(iNetPageWidth);
+	}
+
+	if (pImg->iVerSizeScaled < iNetPageHeight &&
+	    pImg->iHorSizeScaled < iNetPageWidth) {
+		/* The image fits on the paper */
+		return;
+	}
+
+	dVerFactor = (double)iNetPageHeight / (double)pImg->iVerSizeScaled;
+	dHorFactor = (double)iNetPageWidth / (double)pImg->iHorSizeScaled;
+        dFactor = min(dVerFactor, dHorFactor);
+        DBG_FLT(dFactor);
+        /* Round down, just to be on the save side */
+        pImg->iVerSizeScaled = (int)(pImg->iVerSizeScaled * dFactor);
+        pImg->iHorSizeScaled = (int)(pImg->iHorSizeScaled * dFactor);
+} /* end of vImage2Papersize */
+#endif /* !__riscos */
+
+/*
+ * tFind6Image - skip until the image is found
+ *
+ * Find the image in Word 6/7 files
+ *
+ * returns the new position when a image is found, otherwise -1
+ */
+static size_t
+tFind6Image(FILE *pFile, size_t tPosition, size_t tLength,
+	imagetype_enum *peImageType)
+{
+	ULONG	ulMarker;
+	size_t	tElementLen, tToSkip;
+	USHORT	usMarker;
+
+	fail(pFile == NULL);
+	fail(peImageType == NULL);
+
+	*peImageType = imagetype_is_unknown;
+	if (tPosition + 18 >= tLength) {
+		return (size_t)-1;
+	}
+
+	ulMarker = ulNextLong(pFile);
+	if (ulMarker != 0x00090001) {
+		DBG_HEX(ulMarker);
+		return (size_t)-1;
+	}
+	usMarker = usNextWord(pFile);
+	if (usMarker != 0x0300) {
+		DBG_HEX(usMarker);
+		return (size_t)-1;
+	}
+	(void)tSkipBytes(pFile, 10);
+	usMarker = usNextWord(pFile);
+	if (usMarker != 0x0000) {
+		DBG_HEX(usMarker);
+		return (size_t)-1;
+	}
+	tPosition += 18;
+
+	while (tPosition + 6 <= tLength) {
+		tElementLen = (size_t)ulNextLong(pFile);
+		usMarker = usNextWord(pFile);
+		tPosition += 6;
+		NO_DBG_DEC(tElementLen);
+		NO_DBG_HEX(usMarker);
+		switch (usMarker) {
+		case 0x0000:
+			DBG_HEX(ulGetDataOffset(pFile));
+			return (size_t)-1;
+		case 0x0b41:
+			DBG_MSG("DIB");
+			*peImageType = imagetype_is_dib;
+			tPosition += tSkipBytes(pFile, 20);
+			return tPosition;
+		case 0x0f43:
+			DBG_MSG("DIB");
+			*peImageType = imagetype_is_dib;
+			tPosition += tSkipBytes(pFile, 22);
+			return tPosition;
+		default:
+			if (tElementLen < 3) {
+				break;
+			}
+			if (tElementLen > SIZE_T_MAX / 2) {
+				/*
+				 * No need to compute the number of bytes
+				 * to skip
+				 */
+				DBG_DEC(tElementLen);
+				DBG_HEX(tElementLen);
+				DBG_FIXME();
+				return (size_t)-1;
+			}
+			tToSkip = tElementLen * 2 - 6;
+			if (tToSkip > tLength - tPosition) {
+				/* You can't skip this number of bytes */
+				DBG_DEC(tToSkip);
+				DBG_DEC(tLength - tPosition);
+				return (size_t)-1;
+			}
+			tPosition += tSkipBytes(pFile, tToSkip);
+			break;
+		}
+	}
+
+	return (size_t)-1;
+} /* end of tFind6Image */
+
+/*
+ * tFind8Image - skip until the image is found
+ *
+ * Find the image in Word 8/9/10 files
+ *
+ * returns the new position when a image is found, otherwise -1
+ */
+static size_t
+tFind8Image(FILE *pFile, size_t tPosition, size_t tLength,
+	imagetype_enum *peImageType)
+{
+	size_t	tElementLen, tNameLen;
+	USHORT	usID, usElementTag;
+
+	fail(pFile == NULL);
+	fail(peImageType == NULL);
+
+	*peImageType = imagetype_is_unknown;
+	while (tPosition + 8 <= tLength) {
+		usID = usNextWord(pFile) >> 4;
+		usElementTag = usNextWord(pFile);
+		tElementLen = (size_t)ulNextLong(pFile);
+		tPosition += 8;
+		NO_DBG_HEX(usID);
+		NO_DBG_HEX(usElementTag);
+		NO_DBG_DEC(tElementLen);
+		switch (usElementTag) {
+		case 0xf000: case 0xf001: case 0xf002: case 0xf003:
+		case 0xf004: case 0xf005:
+			break;
+		case 0xf007:
+			tPosition += tSkipBytes(pFile, 33);
+			tNameLen = (size_t)iNextByte(pFile);
+			tPosition++;
+			DBG_DEC_C(tNameLen != 0, tNameLen);
+			tPosition += tSkipBytes(pFile, 2 + tNameLen * 2);
+			break;
+		case 0xf008:
+			tPosition += tSkipBytes(pFile, 8);
+			break;
+		case 0xf009:
+			tPosition += tSkipBytes(pFile, 16);
+			break;
+		case 0xf006: case 0xf00a: case 0xf00b: case 0xf00d:
+		case 0xf00e: case 0xf00f: case 0xf010: case 0xf011:
+		case 0xf122:
+			tPosition += tSkipBytes(pFile, tElementLen);
+			break;
+		case 0xf01a:
+			DBG_MSG("EMF");
+			*peImageType = imagetype_is_emf;
+			tPosition += tSkipBytes(pFile, usID == 0x3d4 ? 50 : 66);
+			return tPosition;
+		case 0xf01b:
+			DBG_MSG("WMF");
+			*peImageType = imagetype_is_wmf;
+			tPosition += tSkipBytes(pFile, usID == 0x216 ? 50 : 66);
+			return tPosition;
+		case 0xf01c:
+			DBG_MSG("PICT");
+			*peImageType = imagetype_is_pict;
+			tPosition += tSkipBytes(pFile, usID == 0x542 ? 17 : 33);
+			return tPosition;
+		case 0xf01d:
+			DBG_MSG("JPEG");
+			*peImageType = imagetype_is_jpeg;
+			tPosition += tSkipBytes(pFile, usID == 0x46a ? 17 : 33);
+			return tPosition;
+		case 0xf01e:
+			DBG_MSG("PNG");
+			*peImageType = imagetype_is_png;
+			tPosition += tSkipBytes(pFile, usID == 0x6e0 ? 17 : 33);
+			return tPosition;
+		case 0xf01f:
+			DBG_MSG("DIB");
+			/* DIB is a BMP minus its 14 byte header */
+			*peImageType = imagetype_is_dib;
+			tPosition += tSkipBytes(pFile, usID == 0x7a8 ? 17 : 33);
+			return tPosition;
+		case 0xf00c:
+		default:
+			DBG_HEX(usElementTag);
+			DBG_DEC_C(tElementLen % 4 != 0, tElementLen);
+			DBG_FIXME();
+			return (size_t)-1;
+		}
+	}
+
+	return (size_t)-1;
+} /* end of tFind8Image */
+
+/*
+ * eExamineImage - Examine the image
+ *
+ * Returns an indication of the amount of information found
+ */
+image_info_enum
+eExamineImage(FILE *pFile, ULONG ulFileOffsetImage, imagedata_type *pImg)
+{
+	long	lTmp;
+	size_t	tWordHeaderLen, tLength, tPos;
+	int	iType, iHorSize, iVerSize;
+	USHORT	usHorScalingFactor, usVerScalingFactor;
+
+	if (ulFileOffsetImage == FC_INVALID) {
+		return image_no_information;
+	}
+	DBG_HEX(ulFileOffsetImage);
+
+	if (!bSetDataOffset(pFile, ulFileOffsetImage)) {
+		return image_no_information;
+	}
+
+	tLength = (size_t)ulNextLong(pFile);
+	DBG_DEC(tLength);
+	if (tLength < 46) {
+		/* Smaller than the smallest known header */
+		DBG_FIXME();
+		return image_no_information;
+	}
+	tWordHeaderLen = (size_t)usNextWord(pFile);
+	DBG_DEC(tWordHeaderLen);
+	fail(tWordHeaderLen != 46 &&
+		tWordHeaderLen != 58 &&
+		tWordHeaderLen != 68);
+
+	if (tLength < tWordHeaderLen) {
+		/* Smaller than the current header */
+		return image_no_information;
+	}
+	iType = (int)usNextWord(pFile);
+	DBG_DEC(iType);
+	(void)tSkipBytes(pFile, 28 - 8);
+
+	lTmp = lTwips2MilliPoints(usNextWord(pFile));
+	iHorSize = (int)(lTmp / 1000);
+	if (lTmp % 1000 != 0) {
+		iHorSize++;
+	}
+	DBG_DEC(iHorSize);
+	lTmp = lTwips2MilliPoints(usNextWord(pFile));
+	iVerSize = (int)(lTmp / 1000);
+	if (lTmp % 1000 != 0) {
+		iVerSize++;
+	}
+	DBG_DEC(iVerSize);
+
+	usHorScalingFactor = usNextWord(pFile);
+	DBG_DEC(usHorScalingFactor);
+	usVerScalingFactor = usNextWord(pFile);
+	DBG_DEC(usVerScalingFactor);
+
+	/* Sanity checks */
+	lTmp = (long)iHorSize * (long)usHorScalingFactor;
+	if (lTmp < 2835) {
+		/* This image would be less than 1 millimeter wide */
+		DBG_DEC(lTmp);
+		return image_no_information;
+	}
+	lTmp = (long)iVerSize * (long)usVerScalingFactor;
+	if (lTmp < 2835) {
+		/* This image would be less than 1 millimeter high */
+		DBG_DEC(lTmp);
+		return image_no_information;
+	}
+
+	/* Skip the rest of the header */
+	(void)tSkipBytes(pFile, tWordHeaderLen - 36);
+	tPos = tWordHeaderLen;
+
+	(void)memset(pImg, 0, sizeof(*pImg));
+
+	switch (iType) {
+	case   7:
+	case   8:
+		tPos = tFind6Image(pFile, tPos, tLength, &pImg->eImageType);
+		if (tPos == (size_t)-1) {
+			/* No image found */
+			return image_no_information;
+		}
+		DBG_HEX(tPos);
+		break;
+	case  94:	/* Word 6/7, no image just a pathname */
+		pImg->eImageType = imagetype_is_external;
+		DBG_HEX(ulFileOffsetImage + tPos);
+		break;
+	case 100:
+		tPos = tFind8Image(pFile, tPos, tLength, &pImg->eImageType);
+		if (tPos == (size_t)-1) {
+			/* No image found */
+			return image_no_information;
+		}
+		DBG_HEX(tPos);
+		break;
+	case 102:	/* Word 8/9/10, no image just a pathname or URL */
+		pImg->eImageType = imagetype_is_external;
+		DBG_HEX(ulFileOffsetImage + tPos);
+		break;
+	default:
+		DBG_DEC(iType);
+		DBG_HEX(ulFileOffsetImage + tPos);
+		DBG_FIXME();
+		return image_no_information;
+	}
+
+	/* Minimal information is now available */
+	pImg->tLength = tLength;
+	pImg->tPosition = tPos;
+	pImg->iHorSizeScaled =
+		(int)(((long)iHorSize * (long)usHorScalingFactor + 500) / 1000);
+	pImg->iVerSizeScaled =
+		(int)(((long)iVerSize * (long)usVerScalingFactor + 500) / 1000);
+#if !defined(__riscos)
+	vImage2Papersize(pImg);
+#endif /* !__riscos */
+
+	/* Image type specific examinations */
+	switch (pImg->eImageType) {
+	case imagetype_is_dib:
+		if (bExamineDIB(pFile, pImg)) {
+			return image_full_information;
+		}
+		return image_minimal_information;
+	case imagetype_is_jpeg:
+		if (bExamineJPEG(pFile, pImg)) {
+			return image_full_information;
+		}
+		return image_minimal_information;
+	case imagetype_is_png:
+		if (bExaminePNG(pFile, pImg)) {
+			return image_full_information;
+		}
+		return image_minimal_information;
+	case imagetype_is_wmf:
+		if (bExamineWMF(pFile, pImg)) {
+			return image_full_information;
+		}
+		return image_minimal_information;
+	case imagetype_is_emf:
+	case imagetype_is_pict:
+	case imagetype_is_external:
+		return image_minimal_information;
+	case imagetype_is_unknown:
+	default:
+		return image_no_information;
+	}
+} /* end of eExamineImage */

+ 71 - 0
sys/src/cmd/aux/antiword/imgtrans.c

@@ -0,0 +1,71 @@
+/*
+ * imgtrans.c
+ * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Generic functions to translate Word images
+ */
+
+#include <stdio.h>
+#include "antiword.h"
+
+
+/*
+ * bTranslateImage - translate the image
+ *
+ * This function reads the type of the given image and and gets it translated.
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslateImage(diagram_type *pDiag, FILE *pFile, BOOL bMinimalInformation,
+	ULONG ulFileOffsetImage, const imagedata_type *pImg)
+{
+	options_type	tOptions;
+
+	DBG_MSG("bTranslateImage");
+
+	fail(pDiag == NULL);
+	fail(pFile == NULL);
+	fail(ulFileOffsetImage == FC_INVALID);
+	fail(pImg == NULL);
+	fail(pImg->iHorSizeScaled <= 0);
+	fail(pImg->iVerSizeScaled <= 0);
+
+	vGetOptions(&tOptions);
+	fail(tOptions.eImageLevel == level_no_images);
+
+	if (bMinimalInformation) {
+		return bAddDummyImage(pDiag, pImg);
+	}
+
+	switch (pImg->eImageType) {
+	case imagetype_is_dib:
+		return bTranslateDIB(pDiag, pFile,
+				ulFileOffsetImage + pImg->tPosition,
+				pImg);
+	case imagetype_is_jpeg:
+		return bTranslateJPEG(pDiag, pFile,
+				ulFileOffsetImage + pImg->tPosition,
+				pImg->tLength - pImg->tPosition,
+				pImg);
+	case imagetype_is_png:
+		if (tOptions.eImageLevel == level_ps_2) {
+			return bAddDummyImage(pDiag, pImg);
+		}
+		return bTranslatePNG(pDiag, pFile,
+				ulFileOffsetImage + pImg->tPosition,
+				pImg->tLength - pImg->tPosition,
+				pImg);
+	case imagetype_is_emf:
+	case imagetype_is_wmf:
+	case imagetype_is_pict:
+	case imagetype_is_external:
+		/* FIXME */
+		return bAddDummyImage(pDiag, pImg);
+	case imagetype_is_unknown:
+	default:
+		DBG_DEC(pImg->eImageType);
+		return bAddDummyImage(pDiag, pImg);
+	}
+} /* end of bTranslateImage */

+ 74 - 0
sys/src/cmd/aux/antiword/jpeg2eps.c

@@ -0,0 +1,74 @@
+/*
+ * jpeg2eps.c
+ * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to translate jpeg pictures into eps
+ *
+ */
+
+#include <stdio.h>
+#include "antiword.h"
+
+#if defined(DEBUG)
+static int	iPicCounter = 0;
+#endif /* DEBUG */
+
+
+#if defined(DEBUG)
+/*
+ * vCopy2File
+ */
+static void
+vCopy2File(FILE *pFile, ULONG ulFileOffset, size_t tPictureLen)
+{
+	FILE	*pOutFile;
+	size_t	tIndex;
+	int	iTmp;
+	char	szFilename[30];
+
+	if (!bSetDataOffset(pFile, ulFileOffset)) {
+		return;
+	}
+
+	sprintf(szFilename, "/tmp/pic/pic%04d.jpg", ++iPicCounter);
+	pOutFile = fopen(szFilename, "wb");
+	if (pOutFile == NULL) {
+		return;
+	}
+	for (tIndex = 0; tIndex < tPictureLen; tIndex++) {
+		iTmp = iNextByte(pFile);
+		if (putc(iTmp, pOutFile) == EOF) {
+			break;
+		}
+	}
+	(void)fclose(pOutFile);
+} /* end of vCopy2File */
+#endif /* DEBUG */
+
+/*
+ * bTranslateJPEG - translate a JPEG picture
+ *
+ * This function translates a picture from jpeg to eps
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslateJPEG(diagram_type *pDiag, FILE *pFile,
+	ULONG ulFileOffset, size_t tPictureLen, const imagedata_type *pImg)
+{
+#if defined(DEBUG)
+	vCopy2File(pFile, ulFileOffset, tPictureLen);
+#endif /* DEBUG */
+
+	/* Seek to start position of JPEG data */
+	if (!bSetDataOffset(pFile, ulFileOffset)) {
+		return FALSE;
+	}
+
+	vImagePrologue(pDiag, pImg);
+	vASCII85EncodeFile(pFile, pDiag->pOutFile, tPictureLen);
+	vImageEpilogue(pDiag);
+
+	return TRUE;
+} /* end of bTranslateJPEG */

+ 97 - 0
sys/src/cmd/aux/antiword/jpeg2sprt.c

@@ -0,0 +1,97 @@
+/*
+ * jpeg2sprt.c
+ * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to translate jpeg pictures into sprites
+ */
+
+#include <stdio.h>
+#include "antiword.h"
+
+#if 0 /* defined(DEBUG) */
+static int iPicCounter = 0;
+#endif /* DEBUG */
+
+
+#if 0 /* defined(DEBUG) */
+static void
+vCopy2File(UCHAR *pucJpeg, size_t tJpegSize)
+{
+	FILE	*pOutFile;
+	size_t	tIndex;
+	char	szFilename[30];
+
+	sprintf(szFilename, "<Wimp$ScrapDir>.jpeg%04d", ++iPicCounter);
+	pOutFile = fopen(szFilename, "wb");
+	if (pOutFile == NULL) {
+		return;
+	}
+	DBG_MSG(szFilename);
+	for (tIndex = 0; tIndex < tJpegSize; tIndex++) {
+		if (putc(pucJpeg[tIndex], pOutFile) == EOF) {
+			break;
+		}
+	}
+	(void)fclose(pOutFile);
+	vSetFiletype(szFilename, FILETYPE_JPEG);
+} /* end of vCopy2File */
+#endif /* DEBUG */
+
+/*
+ * bSave2Draw - save the JPEG picture to the Draw file
+ *
+ * This function puts a JPEG picture in a Draw file
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bSave2Draw(diagram_type *pDiag, FILE *pFile,
+	size_t tJpegSize, const imagedata_type *pImg)
+{
+	UCHAR	*pucJpeg, *pucTmp;
+	size_t	tLen;
+	int	iByte;
+
+	pucJpeg = xmalloc(tJpegSize);
+	for (pucTmp = pucJpeg, tLen = 0; tLen < tJpegSize; pucTmp++, tLen++) {
+		iByte = iNextByte(pFile);
+		if (iByte == EOF) {
+			return FALSE;
+		}
+		*pucTmp = (UCHAR)iByte;
+	}
+
+#if 0 /* defined(DEBUG) */
+	vCopy2File(pucJpeg, tJpegSize);
+#endif /* DEBUG */
+
+	/* Add the JPEG to the Draw file */
+	vImage2Diagram(pDiag, pImg, pucJpeg, tJpegSize);
+
+	xfree(pucJpeg);
+	return TRUE;
+} /* end of bSave2Draw */
+
+/*
+ * bTranslateJPEG - translate a JPEG picture
+ *
+ * This function translates a picture from jpeg to sprite
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslateJPEG(diagram_type *pDiag, FILE *pFile,
+	ULONG ulFileOffset, size_t tPictureLen, const imagedata_type *pImg)
+{
+  	/* Seek to start position of JPEG data */
+	if (!bSetDataOffset(pFile, ulFileOffset)) {
+		return FALSE;
+	}
+
+	if (iGetRiscOsVersion() >= 360) {
+		return bSave2Draw(pDiag, pFile, tPictureLen, pImg);
+	}
+  	/* JPEG is not supported until RISC OS 3.6 */
+	return bAddDummyImage(pDiag, pImg);
+} /* end of bTranslateJPEG */

+ 330 - 0
sys/src/cmd/aux/antiword/listlist.c

@@ -0,0 +1,330 @@
+/*
+ * listlist.c
+ * Copyright (C) 2002,2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy a list of Word list information
+ *
+ * Note:
+ * This list only exists when the Word document is saved by Word 8 or later
+ */
+
+#include "antiword.h"
+
+/*
+ * Private structure to hide the way the information
+ * is stored from the rest of the program
+ */
+typedef struct list_desc_tag {
+	list_block_type		tInfo;
+	ULONG			ulListID;
+	USHORT			usIstd;
+	UCHAR			ucListLevel;
+	struct list_desc_tag	*pNext;
+} list_desc_type;
+
+typedef struct list_value_tag {
+	USHORT			usValue;
+	USHORT			usListIndex;
+	UCHAR			ucListLevel;
+	struct list_value_tag	*pNext;
+} list_value_type;
+
+/* Variables needed to describe the LFO list (pllfo) */
+static ULONG		*aulLfoList = NULL;
+static USHORT		usLfoLen = 0;
+/* Variables needed to write the List Information List */
+static list_desc_type	*pAnchor = NULL;
+static list_desc_type	*pBlockLast = NULL;
+/* Variable needed for numbering new lists */
+static list_value_type	*pValues = NULL;
+/* Variables needed for numbering old lists */
+static int	iOldListSeqNumber = 0;
+static USHORT	usOldListValue = 0;
+
+
+/*
+ * vDestroyListInfoList - destroy the List Information List
+ */
+void
+vDestroyListInfoList(void)
+{
+	list_desc_type	*pCurr, *pNext;
+	list_value_type	*pValueCurr, *pValueNext;
+
+	DBG_MSG("vDestroyListInfoList");
+
+	/* Free the LFO list */
+	usLfoLen = 0;
+	aulLfoList = xfree(aulLfoList);
+
+	/* Free the List Information List */
+	pCurr = pAnchor;
+	while (pCurr != NULL) {
+		pNext = pCurr->pNext;
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+	}
+	pAnchor = NULL;
+	/* Reset all control variables */
+	pBlockLast = NULL;
+
+	/* Free the values list */
+	pValueCurr = pValues;
+	while (pValueCurr != NULL) {
+		pValueNext = pValueCurr->pNext;
+		pValueCurr = xfree(pValueCurr);
+		pValueCurr = pValueNext;
+	}
+	pValues = NULL;
+	/* Reset the values for the old lists */
+	iOldListSeqNumber = 0;
+	usOldListValue = 0;
+} /* end of vDestroyListInfoList */
+
+/*
+ * vBuildLfoList - build the LFO list (pllfo)
+ */
+void
+vBuildLfoList(const UCHAR *aucBuffer, size_t tBufLen)
+{
+	size_t	tRecords;
+	int	iIndex;
+
+	fail(aucBuffer == NULL);
+
+	if (tBufLen < 4) {
+		return;
+	}
+	tRecords = (size_t)ulGetLong(0, aucBuffer);
+	NO_DBG_DEC(tRecords);
+	if (4 + 16 * tRecords > tBufLen || tRecords >= 0x7fff) {
+		/* Just a sanity check */
+		DBG_DEC(tRecords);
+		DBG_DEC(4 + 16 * tRecords);
+		DBG_DEC(tBufLen);
+		return;
+	}
+	aulLfoList = xcalloc(tRecords, sizeof(ULONG));
+	for (iIndex = 0; iIndex < (int)tRecords; iIndex++) {
+		aulLfoList[iIndex] = ulGetLong(4 + 16 * iIndex, aucBuffer);
+		NO_DBG_HEX(aulLfoList[iIndex]);
+	}
+	usLfoLen = (USHORT)tRecords;
+} /* end of vBuildLfoList */
+
+/*
+ * vAdd2ListInfoList - add an element to the List Information list
+ */
+void
+vAdd2ListInfoList(ULONG ulListID, USHORT usIstd, UCHAR ucListLevel,
+	const list_block_type *pListBlock)
+{
+	list_desc_type	*pListMember;
+
+	fail(pListBlock == NULL);
+
+	NO_DBG_HEX(ulListID);
+	NO_DBG_DEC(usIstd);
+	NO_DBG_DEC(ucListLevel);
+	NO_DBG_DEC(pListBlock->ulStartAt);
+	NO_DBG_DEC(pListBlock->bNoRestart);
+	NO_DBG_DEC(pListBlock->sLeftIndent);
+	NO_DBG_HEX(pListBlock->ucNFC);
+	NO_DBG_HEX(pListBlock->usListChar);
+
+	/* Create list member */
+	pListMember = xmalloc(sizeof(list_desc_type));
+	/* Fill the list member */
+	pListMember->tInfo = *pListBlock;
+	pListMember->ulListID = ulListID;
+	pListMember->usIstd = usIstd;
+	pListMember->ucListLevel = ucListLevel;
+	pListMember->pNext = NULL;
+	/* Correct the values where needed */
+	if (pListMember->tInfo.ulStartAt > 0xffff) {
+		DBG_DEC(pListMember->tInfo.ulStartAt);
+		pListMember->tInfo.ulStartAt = 1;
+	}
+	/* Add the new member to the list */
+	if (pAnchor == NULL) {
+		pAnchor = pListMember;
+	} else {
+		fail(pBlockLast == NULL);
+		pBlockLast->pNext = pListMember;
+	}
+	pBlockLast = pListMember;
+} /* end of vAdd2ListInfoList */
+
+/*
+ * Get a matching record from the List Information List
+ *
+ * Returns NULL if no matching records is found
+ */
+const list_block_type *
+pGetListInfo(USHORT usListIndex, UCHAR ucListLevel)
+{
+	list_desc_type	*pCurr;
+	list_block_type	*pNearMatch;
+	ULONG	ulListID;
+
+	if (usListIndex == 0) {
+		return NULL;
+	}
+	if (usListIndex - 1 >= usLfoLen || ucListLevel > 8) {
+		DBG_DEC(usListIndex);
+		DBG_DEC(ucListLevel);
+		return NULL;
+	}
+	fail(aulLfoList == NULL);
+	ulListID = aulLfoList[usListIndex - 1];
+	NO_DBG_HEX(ulListID);
+
+	pNearMatch = NULL;
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (pCurr->ulListID != ulListID) {
+			/* No match */
+			continue;
+		}
+		if (pCurr->ucListLevel == ucListLevel) {
+			/* Exact match */
+			return &pCurr->tInfo;
+		}
+		if (pCurr->ucListLevel == 0) {
+			/* Near match */
+			pNearMatch = &pCurr->tInfo;
+		}
+	}
+	/* No exact match, use a near match if any */
+	return pNearMatch;
+} /* end of pGetListInfo */
+
+/*
+ * Get a matching record from the List Information List
+ *
+ * Returns NULL if no matching records is found
+ */
+const list_block_type *
+pGetListInfoByIstd(USHORT usIstd)
+{
+	list_desc_type	*pCurr;
+
+	if (usIstd == ISTD_INVALID || usIstd == STI_NIL || usIstd == STI_USER) {
+		return NULL;
+	}
+
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (pCurr->usIstd == usIstd) {
+			return &pCurr->tInfo;
+		}
+	}
+	return NULL;
+} /* end of pGetListInfoByIstd */
+
+/*
+ * vRestartListValues - reset the less significant list levels
+ */
+static void
+vRestartListValues(USHORT usListIndex, UCHAR ucListLevel)
+{
+	list_value_type	*pPrev, *pCurr, *pNext;
+	int		iCounter;
+
+	iCounter = 0;
+	pPrev = NULL;
+	pCurr = pValues;
+
+	while (pCurr != NULL) {
+		if (pCurr->usListIndex != usListIndex ||
+		    pCurr->ucListLevel <= ucListLevel) {
+			pPrev = pCurr;
+			pCurr = pCurr->pNext;
+			continue;
+		}
+		/* Reset the level by deleting the record */
+		pNext = pCurr->pNext;
+		if (pPrev == NULL) {
+			pValues = pNext;
+		} else {
+			pPrev->pNext = pNext;
+		}
+		DBG_DEC(pCurr->usListIndex);
+		DBG_DEC(pCurr->ucListLevel);
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+		iCounter++;
+	}
+	DBG_DEC_C(iCounter > 0, iCounter);
+} /* end of vRestartListValues */
+
+/*
+ * usGetListValue - Get the current value of the given list
+ *
+ * Returns the value of the given list
+ */
+USHORT
+usGetListValue(int iListSeqNumber, int iWordVersion,
+	const style_block_type *pStyle)
+{
+	list_value_type	*pCurr;
+	USHORT		usValue;
+
+	fail(iListSeqNumber < 0);
+	fail(iListSeqNumber < iOldListSeqNumber);
+	fail(iWordVersion < 0);
+	fail(pStyle == NULL);
+
+	if (iListSeqNumber <= 0) {
+		return 0;
+	}
+
+	if (iWordVersion < 8) {
+		/* Old style list */
+		if (iListSeqNumber == iOldListSeqNumber ||
+		    (iListSeqNumber == iOldListSeqNumber + 1 &&
+		     eGetNumType(pStyle->ucNumLevel) == level_type_sequence)) {
+			if (!pStyle->bNumPause) {
+				usOldListValue++;
+			}
+		} else {
+			usOldListValue = pStyle->usStartAt;
+		}
+		iOldListSeqNumber = iListSeqNumber;
+		return usOldListValue;
+	}
+
+	/* New style list */
+	if (pStyle->usListIndex == 0 ||
+	    pStyle->usListIndex - 1 >= usLfoLen ||
+	    pStyle->ucListLevel > 8) {
+		/* Out of range; no need to search */
+		return 0;
+	}
+
+	for (pCurr = pValues; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (pCurr->usListIndex == pStyle->usListIndex &&
+		    pCurr->ucListLevel == pStyle->ucListLevel) {
+			/* Record found; increment and return the value */
+			pCurr->usValue++;
+			usValue = pCurr->usValue;
+			if (!pStyle->bNoRestart) {
+				vRestartListValues(pStyle->usListIndex,
+						pStyle->ucListLevel);
+			}
+			return usValue;
+		}
+	}
+
+	/* Record not found; create it and add it to the front of the list */
+	pCurr = xmalloc(sizeof(list_value_type));
+	pCurr->usValue = pStyle->usStartAt;
+	pCurr->usListIndex = pStyle->usListIndex;
+	pCurr->ucListLevel = pStyle->ucListLevel;
+	pCurr->pNext = pValues;
+	pValues = pCurr;
+	usValue = pCurr->usValue;
+	if (!pStyle->bNoRestart) {
+		vRestartListValues(pStyle->usListIndex, pStyle->ucListLevel);
+	}
+	return usValue;
+} /* end of usGetListValue */

+ 386 - 0
sys/src/cmd/aux/antiword/main_r.c

@@ -0,0 +1,386 @@
+/*
+ * main_r.c
+ *
+ * Released under GPL
+ *
+ * Copyright (C) 1998-2003 A.J. van Os
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Description:
+ * The main program of !Antiword (RISC OS version)
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "baricon.h"
+#include "dbox.h"
+#include "event.h"
+#include "flex.h"
+#include "kernel.h"
+#include "menu.h"
+#include "res.h"
+#include "resspr.h"
+#include "wimp.h"
+#include "template.h"
+#include "wimpt.h"
+#include "win.h"
+#include "xferrecv.h"
+#include "version.h"
+#include "antiword.h"
+
+/* The name of this program */
+static char	*szTask = "!Antiword";
+
+/* The window handle of the choices window */
+static wimp_w	tChoicesWindow;
+
+/* Info box fields */
+#define PURPOSE_INFO_FIELD	2
+#define AUTHOR_INFO_FIELD	3
+#define VERSION_INFO_FIELD	4
+#define STATUS_INFO_FIELD	5
+
+
+static void
+vBarInfo(void)
+{
+	dbox		d;
+
+	d = dbox_new("ProgInfo");
+	if (d != NULL) {
+		dbox_setfield(d, PURPOSE_INFO_FIELD, PURPOSESTRING);
+		dbox_setfield(d, AUTHOR_INFO_FIELD, AUTHORSTRING);
+		dbox_setfield(d, VERSION_INFO_FIELD, VERSIONSTRING);
+		dbox_setfield(d, STATUS_INFO_FIELD, STATUSSTRING);
+		dbox_show(d);
+		dbox_fillin(d);
+		dbox_dispose(&d);
+	}
+} /* end of vBarInfo */
+
+static void
+vMouseButtonClick(wimp_mousestr *m)
+{
+	if (m->w == tChoicesWindow) {
+		vChoicesMouseClick(m);
+		return;
+	}
+	DBG_DEC(m->w);
+} /* end of vMouseButtonClick */
+
+static void
+vKeyPressed(int chcode, wimp_caretstr *c)
+{
+	DBG_MSG("vKeyPressed");
+
+	if (chcode != '\r') {
+		wimpt_noerr(wimp_processkey(chcode));
+		return;
+	}
+	if (c->w == tChoicesWindow) {
+		vChoicesKeyPressed(c);
+	}
+} /* end of vKeyPressed */
+
+/*
+ * Move the given window to the top of the pile.
+ */
+static void
+vWindowToFront(wimp_w tWindow)
+{
+	wimp_wstate	tWindowState;
+
+	wimpt_noerr(wimp_get_wind_state(tWindow, &tWindowState));
+	tWindowState.o.behind = -1;
+	wimpt_noerr(wimp_open_wind(&tWindowState.o));
+} /* end of vWindowToFront */
+
+/*
+ *
+ */
+static void
+vIconclick(wimp_i tUnused)
+{
+} /* end of vIconclick */
+
+static void
+vSaveSelect(void *pvHandle, char *pcInput)
+{
+	diagram_type	*pDiag;
+
+	fail(pvHandle == NULL || pcInput == NULL);
+
+	pDiag = (diagram_type *)pvHandle;
+	switch (pcInput[0]) {
+	case 1:
+		vScaleOpenAction(pDiag);
+		break;
+	case 2:
+		vSaveDrawfile(pDiag);
+		break;
+	case 3:
+		vSaveTextfile(pDiag);
+		break;
+	default:
+		DBG_DEC(pcInput[0]);
+		break;
+	}
+} /* end of vMenuSelect */
+
+/*
+ * Create the window for the text from the given file
+ */
+static diagram_type *
+pCreateTextWindow(const char *szFilename)
+{
+	diagram_type	*pDiag;
+	menu		pSaveMenu;
+
+	DBG_MSG("pCreateTextWindow");
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+
+	pDiag = pCreateDiagram(szTask+1, szFilename);
+	if (pDiag == NULL) {
+		werr(0, "No new diagram object");
+		return NULL;
+	}
+	win_register_event_handler(pDiag->tMainWindow,
+				vMainEventHandler, pDiag);
+	win_register_event_handler(pDiag->tScaleWindow,
+				vScaleEventHandler, pDiag);
+	pSaveMenu = menu_new(szTask+1,
+		">Scale view,"
+		">Save (Drawfile)   F3,"
+		">Save (Text only) \213F3");
+	if (pSaveMenu == NULL) {
+		werr(0, "No new menu object");
+		return NULL;
+	}
+	if (!event_attachmenu(pDiag->tMainWindow,
+				pSaveMenu, vSaveSelect, pDiag)) {
+		werr(0, "I can't attach to event");
+		return NULL;
+	}
+	/* Set the window title */
+	vSetTitle(pDiag);
+	return pDiag;
+} /* end of pCreateTextWindow */
+
+static void
+vProcessFile(const char *szFilename, int iFiletype)
+{
+	options_type	tOptions;
+	FILE		*pFile;
+	diagram_type	*pDiag;
+	long		lFilesize;
+	int		iWordVersion;
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+
+	DBG_MSG(szFilename);
+
+	pFile = fopen(szFilename, "rb");
+	if (pFile == NULL) {
+		werr(0, "I can't open '%s' for reading", szFilename);
+		return;
+	}
+
+	lFilesize = lGetFilesize(szFilename);
+	if (lFilesize < 0) {
+		(void)fclose(pFile);
+		werr(0, "I can't get the size of '%s'", szFilename);
+		return;
+	}
+
+	iWordVersion = iGuessVersionNumber(pFile, lFilesize);
+	if (iWordVersion < 0 || iWordVersion == 3) {
+		if (bIsRtfFile(pFile)) {
+			werr(0, "%s is not a Word Document."
+				" It is probably a Rich Text Format file",
+				szFilename);
+		} if (bIsWordPerfectFile(pFile)) {
+			werr(0, "%s is not a Word Document."
+				" It is probably a Word Perfect file",
+				szFilename);
+		} else {
+			werr(0, "%s is not a Word Document.", szFilename);
+		}
+		(void)fclose(pFile);
+		return;
+	}
+	/* Reset any reading done during file testing */
+	rewind(pFile);
+
+	if (iFiletype != FILETYPE_MSWORD) {
+		vGetOptions(&tOptions);
+		if (tOptions.bAutofiletypeAllowed) {
+			vSetFiletype(szFilename, FILETYPE_MSWORD);
+		}
+	}
+
+	pDiag = pCreateTextWindow(szFilename);
+	if (pDiag == NULL) {
+		(void)fclose(pFile);
+		return;
+	}
+
+	(void)bWordDecryptor(pFile, lFilesize, pDiag);
+	if (bVerifyDiagram(pDiag)) {
+		vShowDiagram(pDiag);
+	}
+
+	(void)fclose(pFile);
+} /* end of vProcessFile */
+
+static void
+vProcessDraggedFile(void)
+{
+	char	*szTmp;
+	int	iFiletype;
+	char	szFilename[PATH_MAX+1];
+
+	iFiletype = xferrecv_checkinsert(&szTmp);
+	if (iFiletype == -1) {
+		werr(0, "I failed to import a file");
+		return;
+	}
+	DBG_HEX(iFiletype);
+	if (strlen(szTmp) >= sizeof(szFilename)) {
+		werr(1, "Internal error: filename too long");
+	}
+	(void)strcpy(szFilename, szTmp);
+	DBG_MSG(szFilename);
+	vProcessFile(szFilename, iFiletype);
+	xferrecv_insertfileok();
+} /* end of vProcessDraggedFile */
+
+static void
+vEventHandler(wimp_eventstr *pEvent, void *pvUnused)
+{
+	switch (pEvent->e) {
+	case wimp_ENULL:
+		break;
+	case wimp_EREDRAW:
+		/* handled by the WIMP */
+		break;
+	case wimp_EOPEN:
+		wimpt_noerr(wimp_open_wind(&pEvent->data.o));
+		break;
+	case wimp_ECLOSE:
+		wimpt_noerr(wimp_close_wind(pEvent->data.o.w));
+		break;
+	case wimp_EBUT:
+		vMouseButtonClick(&pEvent->data.but.m);
+		break;
+	case wimp_EKEY:
+		vKeyPressed(pEvent->data.key.chcode, &pEvent->data.key.c);
+		break;
+	case wimp_ESEND:
+	case wimp_ESENDWANTACK:
+		switch (pEvent->data.msg.hdr.action) {
+		case wimp_MCLOSEDOWN:
+			exit(EXIT_SUCCESS);
+			break;
+		case wimp_MDATALOAD:
+		case wimp_MDATAOPEN:
+			vProcessDraggedFile();
+			break;
+		}
+	}
+} /* end of vEventHandler */
+
+static void
+vMenuSelect(void *pvUnused, char *Input)
+{
+	switch (*Input) {
+	case 1:
+		vBarInfo();
+		break;
+	case 2:
+		vChoicesOpenAction(tChoicesWindow);
+		vWindowToFront(tChoicesWindow);
+		break;
+	case 3:
+		exit(EXIT_SUCCESS);
+		break;
+	default:
+		break;
+	}
+} /* end of vMenuSelect */
+
+static void
+vTemplates(void)
+{
+	wimp_wind	*pw;
+
+	pw = template_syshandle("Choices");
+	if (pw == NULL) {
+		werr(1, "Template 'Choices' can't be found");
+	}
+	wimpt_noerr(wimp_create_wind(pw, &tChoicesWindow));
+	win_register_event_handler(tChoicesWindow, vEventHandler, NULL);
+} /* end of vTemplates */
+
+static void
+vInitialise(void)
+{
+	menu	pBarMenu;
+
+	(void)wimpt_init(szTask+1);
+	res_init(szTask+1);
+	template_init();
+	dbox_init();
+	flex_init();
+	_kernel_register_slotextend(flex_budge);
+	drawfobj_init();
+	vTemplates();
+	pBarMenu = menu_new(szTask+1, ">Info,Choices...,Quit");
+	if (pBarMenu == NULL) {
+		werr(1, "I can't initialise (menu_new)");
+	}
+	baricon(szTask, (int)resspr_area(), vIconclick);
+	if (!event_attachmenu(win_ICONBAR, pBarMenu, vMenuSelect, NULL)) {
+		werr(1, "I can't initialise (event_attachmenu)");
+	}
+	win_register_event_handler(win_ICONBARLOAD, vEventHandler, NULL);
+} /* end of vInitialise */
+
+int
+main(int argc, char **argv)
+{
+	int	iFirst, iFiletype;
+
+	vInitialise();
+	iFirst = iReadOptions(argc, argv);
+	if (iFirst != 1) {
+		return EXIT_FAILURE;
+	}
+
+	if (argc > 1) {
+		iFiletype = iGetFiletype(argv[1]);
+		if (iFiletype < 0) {
+			return EXIT_FAILURE;
+		}
+		vProcessFile(argv[1], iFiletype);
+	}
+
+	event_setmask(wimp_EMNULL|wimp_EMPTRENTER|wimp_EMPTRLEAVE);
+	for (;;) {
+		event_process();
+	}
+} /* end of main */

+ 278 - 0
sys/src/cmd/aux/antiword/main_u.c

@@ -0,0 +1,278 @@
+/*
+ * main_u.c
+ *
+ * Released under GPL
+ *
+ * Copyright (C) 1998-2003 A.J. van Os
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * Description:
+ * The main program of 'antiword' (Unix version)
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#if defined(__dos)
+#include <fcntl.h>
+#include <io.h>
+#endif /* __dos */
+#if defined(__STDC_ISO_10646__)
+#include <locale.h>
+#endif /* __STDC_ISO_10646__ */
+#include "version.h"
+#include "antiword.h"
+
+/* The name of this program */
+static const char	*szTask = NULL;
+
+
+static void
+vUsage(void)
+{
+	fprintf(stderr, "\tName: %s\n", szTask);
+	fprintf(stderr, "\tPurpose: "PURPOSESTRING"\n");
+	fprintf(stderr, "\tAuthor: "AUTHORSTRING"\n");
+	fprintf(stderr, "\tVersion: "VERSIONSTRING"\n");
+	fprintf(stderr, "\tStatus: "STATUSSTRING"\n");
+	fprintf(stderr,
+		"\tUsage: %s [switches] wordfile1 [wordfile2 ...]\n", szTask);
+	fprintf(stderr,
+		"\tSwitches: [-t|-p papersize|-x dtd][-m mapping][-w #][-i #]"
+		"[-Ls]\n");
+	fprintf(stderr, "\t\t-t text output (default)\n");
+	fprintf(stderr, "\t\t-p <paper size name> PostScript output\n");
+	fprintf(stderr, "\t\t   like: a4, letter or legal\n");
+	fprintf(stderr, "\t\t-x <dtd> XML output\n");
+	fprintf(stderr, "\t\t   like: db (DocBook)\n");
+	fprintf(stderr, "\t\t-m <mapping> character mapping file\n");
+	fprintf(stderr, "\t\t-w <width> in characters of text output\n");
+	fprintf(stderr, "\t\t-i <level> image level (PostScript only)\n");
+	fprintf(stderr, "\t\t-L use landscape mode (PostScript only)\n");
+	fprintf(stderr, "\t\t-s Show hidden (by Word) text\n");
+} /* end of vUsage */
+
+/*
+ * pStdin2TmpFile - save stdin in a temporary file
+ *
+ * returns: the pointer to the temporary file or NULL
+ */
+static FILE *
+pStdin2TmpFile(long *lFilesize)
+{
+	FILE	*pTmpFile;
+	size_t	tSize;
+	BOOL	bFailure;
+	UCHAR	aucBytes[BUFSIZ];
+
+	DBG_MSG("pStdin2TmpFile");
+
+	fail(lFilesize == NULL);
+
+	/* Open the temporary file */
+	pTmpFile = tmpfile();
+	if (pTmpFile == NULL) {
+		return NULL;
+	}
+
+#if defined(__dos)
+	/* Stdin must be read as a binary stream */
+	setmode(fileno(stdin), O_BINARY);
+#endif /* __dos */
+
+	/* Copy stdin to the temporary file */
+	*lFilesize = 0;
+	bFailure = TRUE;
+	for (;;) {
+		tSize = fread(aucBytes, 1, sizeof(aucBytes), stdin);
+		if (tSize == 0) {
+			bFailure = feof(stdin) == 0;
+			break;
+		}
+		if (fwrite(aucBytes, 1, tSize, pTmpFile) != tSize) {
+			bFailure = TRUE;
+			break;
+		}
+		*lFilesize += (long)tSize;
+	}
+
+#if defined(__dos)
+	/* Switch stdin back to a text stream */
+	setmode(fileno(stdin), O_TEXT);
+#endif /* __dos */
+
+	/* Deal with the result of the copy action */
+	if (bFailure) {
+		*lFilesize = 0;
+		(void)fclose(pTmpFile);
+		return NULL;
+	}
+	rewind(pTmpFile);
+	return pTmpFile;
+} /* end of pStdin2TmpFile */
+
+/*
+ * bProcessFile - process a single file
+ *
+ * returns: TRUE when the given file is a supported Word file, otherwise FALSE
+ */
+static BOOL
+bProcessFile(const char *szFilename)
+{
+	FILE		*pFile;
+	diagram_type	*pDiag;
+	long		lFilesize;
+	int		iWordVersion;
+	BOOL		bResult;
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+
+	DBG_MSG(szFilename);
+
+	if (szFilename[0] == '-' && szFilename[1] == '\0') {
+		pFile = pStdin2TmpFile(&lFilesize);
+		if (pFile == NULL) {
+			werr(0, "I can't save the standard input to a file");
+			return FALSE;
+		}
+	} else {
+		pFile = fopen(szFilename, "rb");
+		if (pFile == NULL) {
+			werr(0, "I can't open '%s' for reading", szFilename);
+			return FALSE;
+		}
+
+		lFilesize = lGetFilesize(szFilename);
+		if (lFilesize < 0) {
+			(void)fclose(pFile);
+			werr(0, "I can't get the size of '%s'", szFilename);
+			return FALSE;
+		}
+	}
+
+	iWordVersion = iGuessVersionNumber(pFile, lFilesize);
+	if (iWordVersion < 0 || iWordVersion == 3) {
+		if (bIsRtfFile(pFile)) {
+			werr(0, "%s is not a Word Document."
+				" It is probably a Rich Text Format file",
+				szFilename);
+		} if (bIsWordPerfectFile(pFile)) {
+			werr(0, "%s is not a Word Document."
+				" It is probably a Word Perfect file",
+				szFilename);
+		} else {
+#if defined(__dos)
+			werr(0, "%s is not a Word Document or the filename"
+				" is not in the 8+3 format.", szFilename);
+#else
+			werr(0, "%s is not a Word Document.", szFilename);
+#endif /* __dos */
+		}
+		(void)fclose(pFile);
+		return FALSE;
+	}
+	/* Reset any reading done during file testing */
+	rewind(pFile);
+
+	pDiag = pCreateDiagram(szTask, szFilename);
+	if (pDiag == NULL) {
+		(void)fclose(pFile);
+		return FALSE;
+	}
+
+	bResult = bWordDecryptor(pFile, lFilesize, pDiag);
+	vDestroyDiagram(pDiag);
+
+	(void)fclose(pFile);
+	return bResult;
+} /* end of bProcessFile */
+
+int
+main(int argc, char **argv)
+{
+	options_type	tOptions;
+	const char	*szWordfile;
+	int	iFirst, iIndex, iGoodCount;
+	BOOL	bUsage, bMultiple, bUseTXT, bUseXML;
+
+	if (argc <= 0) {
+		return EXIT_FAILURE;
+	}
+
+	szTask = szBasename(argv[0]);
+
+	if (argc <= 1) {
+		iFirst = 1;
+		bUsage = TRUE;
+	} else {
+		iFirst = iReadOptions(argc, argv);
+		bUsage = iFirst <= 0;
+	}
+	if (bUsage) {
+		vUsage();
+		return iFirst < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+	}
+
+	vGetOptions(&tOptions);
+
+#if defined(__STDC_ISO_10646__)
+	/*
+	 * If the user wants UTF-8 and the envirionment variables support
+	 * UTF-8, than set the locale accordingly
+	 */
+	if (tOptions.eEncoding == encoding_utf8 && is_locale_utf8()) {
+		if (setlocale(LC_CTYPE, "") == NULL) {
+			werr(1, "Can't set the UTF-8 locale! "
+				"Check LANG, LC_CTYPE, LC_ALL.");
+		}
+		DBG_MSG("The UTF-8 locale has been set");
+	}
+#endif /* __STDC_ISO_10646__ */
+
+	bMultiple = argc - iFirst > 1;
+	bUseTXT = tOptions.eConversionType == conversion_text;
+	bUseXML = tOptions.eConversionType == conversion_xml;
+	iGoodCount = 0;
+
+	if (bUseXML) {
+		fprintf(stdout,
+	"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+	"<!DOCTYPE %s PUBLIC \"-//OASIS//DTD DocBook XML V4.1.2//EN\"\n"
+	"\t\"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd\">\n",
+		bMultiple ? "set" : "book");
+		if (bMultiple) {
+			fprintf(stdout, "<set>\n");
+		}
+	}
+
+	for (iIndex = iFirst; iIndex < argc; iIndex++) {
+		if (bMultiple && bUseTXT) {
+			szWordfile = szBasename(argv[iIndex]);
+			fprintf(stdout, "::::::::::::::\n");
+			fprintf(stdout, "%s\n", szWordfile);
+			fprintf(stdout, "::::::::::::::\n");
+		}
+		if (bProcessFile(argv[iIndex])) {
+			iGoodCount++;
+		}
+	}
+
+	if (bMultiple && bUseXML) {
+		fprintf(stdout, "</set>\n");
+	}
+
+	DBG_DEC(iGoodCount);
+	return iGoodCount <= 0 ? EXIT_FAILURE : EXIT_SUCCESS;
+} /* end of main */

+ 647 - 0
sys/src/cmd/aux/antiword/misc.c

@@ -0,0 +1,647 @@
+/*
+ * misc.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GNU GPL
+ *
+ * Description:
+ * Miscellaneous functions
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+#if defined(__riscos)
+#include "kernel.h"
+#include "swis.h"
+#else
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif /* __riscos */
+#if defined(__dos)
+#define S_ISDIR(x)	(((x) & S_IFMT) == S_IFDIR)
+#define S_ISREG(x)	(((x) & S_IFMT) == S_IFREG)
+#endif /* __dos */
+#include "antiword.h"
+
+
+#if !defined(__riscos)
+/*
+ * szGetHomeDirectory - get the name of the home directory
+ */
+const char *
+szGetHomeDirectory(void)
+{
+	const char	*szHome;
+
+#if defined(__vms)
+#include <unixlib.h>
+	szHome = decc$translate_vms(getenv("HOME"));
+#elif defined(__Plan9__)
+	szHome = getenv("home");
+#else 
+	szHome = getenv("HOME");
+#endif
+
+	if (szHome == NULL || szHome[0] == '\0') {
+#if defined(__dos)
+		szHome = "C:";
+#else
+		werr(0, "I can't find the name of your HOME directory");
+		szHome = "";
+#endif /* __dos */
+	}
+	return szHome;
+} /* end of szGetHomeDirectory */
+
+/*
+ * szGetAntiwordDirectory - get the name of the Antiword directory
+ */
+const char *
+szGetAntiwordDirectory(void)
+{
+#if defined(__vms)
+#include <unixlib.h>
+	return decc$translate_vms(getenv("ANTIWORDHOME"));
+#else
+	return getenv("ANTIWORDHOME");
+#endif /* __vms */
+} /* end of szGetHomeDirectory */
+#endif /* !__riscos */
+
+/*
+ * Get the size of the specified file.
+ * Returns -1 if the file does not exist or is not a proper file.
+ */
+long
+lGetFilesize(const char *szFilename)
+{
+#if defined(__riscos)
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+
+	(void)memset(&regs, 0, sizeof(regs));
+	regs.r[0] = 17;
+	regs.r[1] = (int)szFilename;
+	e = _kernel_swi(OS_File, &regs, &regs);
+	if (e != NULL) {
+		werr(0, "Get Filesize error %d: %s",
+			e->errnum, e->errmess);
+		return -1;
+	}
+	if (regs.r[0] != 1) {
+		/* It's not a proper file or the file does not exist */
+		return -1;
+	}
+	return (long)regs.r[4];
+#else
+	struct stat	tBuffer;
+
+	if (stat(szFilename, &tBuffer) != 0) {
+		werr(0, "Get Filesize error %d", errno);
+		return -1;
+	}
+	if (!S_ISREG(tBuffer.st_mode)) {
+		/* It's not a regular file */
+		return -1;
+	}
+	return (long)tBuffer.st_size;
+#endif /* __riscos */
+} /* end of lGetFilesize */
+
+#if defined(DEBUG)
+void
+vPrintBlock(const char	*szFile, int iLine,
+		const UCHAR *aucBlock, size_t tLength)
+{
+	int i, j;
+
+	fail(szFile == NULL || iLine < 0 || aucBlock == NULL);
+
+	fprintf(stderr, "%s[%3d]:\n", szFile, iLine);
+	for (i = 0; i < 32; i++) {
+		if (16 * i >= (int)tLength) {
+			return;
+		}
+		fprintf(stderr, "%03x: ", (unsigned int)(16 * i));
+		for (j = 0; j < 16; j++) {
+			if (16 * i + j < (int)tLength) {
+				fprintf(stderr, "%02x ",
+					(unsigned int)aucBlock[16 * i + j]);
+			}
+		}
+		fprintf(stderr, "\n");
+	}
+} /* end of vPrintBlock */
+
+void
+vPrintUnicode(const char  *szFile, int iLine, const UCHAR *aucUni, size_t tLen)
+{
+	char	*szASCII;
+
+	fail(tLen % 2 != 0);
+
+	tLen /= 2;	/* Length in bytes to length in characters */
+	szASCII = xmalloc(tLen + 1);
+	(void)unincpy(szASCII, aucUni, tLen);
+	szASCII[tLen] = '\0';
+	(void)fprintf(stderr, "%s[%3d]: %.*s\n",
+				szFile, iLine, (int)tLen, szASCII);
+	szASCII = xfree(szASCII);
+} /* end of vPrintUnicode */
+
+BOOL
+bCheckDoubleLinkedList(output_type *pAnchor)
+{
+	output_type	*pCurr, *pLast;
+	int		iInList;
+
+	pLast = pAnchor;
+	iInList = 0;
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		pLast = pCurr;
+		iInList++;
+	}
+	NO_DBG_DEC(iInList);
+	for (pCurr = pLast; pCurr != NULL; pCurr = pCurr->pPrev) {
+		pLast = pCurr;
+		iInList--;
+	}
+	DBG_DEC_C(iInList != 0, iInList);
+	return pAnchor == pLast && iInList == 0;
+} /* end of bCheckDoubleLinkedList */
+#endif /* DEBUG */
+
+/*
+ * bReadBytes
+ * This function reads the specified number of bytes from the specified file,
+ * starting from the specified offset.
+ * Returns TRUE when successfull, otherwise FALSE
+ */
+BOOL
+bReadBytes(UCHAR *aucBytes, size_t tMemb, ULONG ulOffset, FILE *pFile)
+{
+	fail(aucBytes == NULL || pFile == NULL || ulOffset > (ULONG)LONG_MAX);
+
+	if (ulOffset > (ULONG)LONG_MAX) {
+		return FALSE;
+	}
+	if (fseek(pFile, (long)ulOffset, SEEK_SET) != 0) {
+		return FALSE;
+	}
+	if (fread(aucBytes, sizeof(UCHAR), tMemb, pFile) != tMemb) {
+		return FALSE;
+	}
+	return TRUE;
+} /* end of bReadBytes */
+
+/*
+ * bReadBuffer
+ * This function fills the specified buffer with the specified number of bytes,
+ * starting at the specified offset within the Big/Small Block Depot.
+ *
+ * Returns TRUE when successful, otherwise FALSE
+ */
+BOOL
+bReadBuffer(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBlockDepot, size_t tBlockDepotLen, size_t tBlockSize,
+	UCHAR *aucBuffer, ULONG ulOffset, size_t tToRead)
+{
+	ULONG	ulBegin, ulIndex;
+	size_t	tLen;
+
+	fail(pFile == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBlockDepot == NULL);
+	fail(tBlockSize != BIG_BLOCK_SIZE && tBlockSize != SMALL_BLOCK_SIZE);
+	fail(aucBuffer == NULL);
+	fail(tToRead == 0);
+
+	for (ulIndex = ulStartBlock;
+	     ulIndex != END_OF_CHAIN && tToRead != 0;
+	     ulIndex = aulBlockDepot[ulIndex]) {
+		if (ulIndex >= (ULONG)tBlockDepotLen) {
+			DBG_DEC(ulIndex);
+			DBG_DEC(tBlockDepotLen);
+			if (tBlockSize >= BIG_BLOCK_SIZE) {
+				werr(1, "The Big Block Depot is damaged");
+			} else {
+				werr(1, "The Small Block Depot is damaged");
+			}
+		}
+		if (ulOffset >= (ULONG)tBlockSize) {
+			ulOffset -= tBlockSize;
+			continue;
+		}
+		ulBegin = ulDepotOffset(ulIndex, tBlockSize) + ulOffset;
+		tLen = min(tBlockSize - (size_t)ulOffset, tToRead);
+		ulOffset = 0;
+		if (!bReadBytes(aucBuffer, tLen, ulBegin, pFile)) {
+			werr(0, "Read big block 0x%lx not possible", ulBegin);
+			return FALSE;
+		}
+		aucBuffer += tLen;
+		tToRead -= tLen;
+	}
+	DBG_DEC_C(tToRead != 0, tToRead);
+	return tToRead == 0;
+} /* end of bReadBuffer */
+
+/*
+ * Translate a Word colornumber into a true color for use in a drawfile
+ *
+ * Returns the true color
+ */
+ULONG
+ulColor2Color(UCHAR ucFontColor)
+{
+	static const ULONG	aulColorTable[] = {
+		/*  0 */	0x00000000UL,	/* Automatic */
+		/*  1 */	0x00000000UL,	/* Black */
+		/*  2 */	0xff000000UL,	/* Blue */
+		/*  3 */	0xffff0000UL,	/* Turquoise */
+		/*  4 */	0x00ff0000UL,	/* Bright Green */
+		/*  5 */	0xff00ff00UL,	/* Pink */
+		/*  6 */	0x0000ff00UL,	/* Red */
+		/*  7 */	0x00ffff00UL,	/* Yellow */
+		/*  8 */	0xffffff00UL,	/* White */
+		/*  9 */	0x80000000UL,	/* Dark Blue */
+		/* 10 */	0x80800000UL,	/* Teal */
+		/* 11 */	0x00800000UL,	/* Green */
+		/* 12 */	0x80008000UL,	/* Violet */
+		/* 13 */	0x00008000UL,	/* Dark Red */
+		/* 14 */	0x00808000UL,	/* Dark Yellow */
+		/* 15 */	0x80808000UL,	/* Gray 50% */
+		/* 16 */	0xc0c0c000UL,	/* Gray 25% */
+	};
+	if ((size_t)ucFontColor >= elementsof(aulColorTable)) {
+		return aulColorTable[0];
+	}
+	return aulColorTable[(int)ucFontColor];
+} /* end of ulColor2Color */
+
+/*
+ * iFindSplit - find a place to split the string
+ *
+ * returns the index of the split character or -1 if no split found.
+ */
+static int
+iFindSplit(const char *szString, size_t tStringLen)
+{
+	size_t	tSplit;
+
+	if (tStringLen == 0) {
+		return -1;
+	}
+	tSplit = tStringLen - 1;
+	while (tSplit >= 1) {
+		if (szString[tSplit] == ' ' ||
+		    (szString[tSplit] == '-' && szString[tSplit - 1] != ' ')) {
+			return (int)tSplit;
+		}
+		tSplit--;
+	}
+	return -1;
+} /* end of iFindSplit */
+
+/*
+ * pSplitList - split the specified list in a printable part and a leftover part
+ *
+ * returns the pointer to the leftover part
+ */
+output_type *
+pSplitList(output_type *pAnchor)
+{
+	output_type	*pCurr, *pLeftOver;
+	int		iIndex;
+
+ 	fail(pAnchor == NULL);
+
+	for (pCurr = pAnchor; pCurr->pNext != NULL; pCurr = pCurr->pNext)
+		;	/* EMPTY */
+	iIndex = -1;
+	for (; pCurr != NULL; pCurr = pCurr->pPrev) {
+		iIndex = iFindSplit(pCurr->szStorage, pCurr->tNextFree);
+		if (iIndex >= 0) {
+			break;
+		}
+	}
+
+	if (pCurr == NULL || iIndex < 0) {
+		/* No split, no leftover */
+		return NULL;
+	}
+	/* Split over the iIndex-th character */
+	NO_DBG_MSG("pLeftOver");
+	pLeftOver = xmalloc(sizeof(*pLeftOver));
+	fail(pCurr->tNextFree < (size_t)iIndex);
+	pLeftOver->tStorageSize = pCurr->tNextFree - (size_t)iIndex;
+	pLeftOver->szStorage = xmalloc(pLeftOver->tStorageSize);
+	pLeftOver->tNextFree = pCurr->tNextFree - (size_t)iIndex - 1;
+	(void)strncpy(pLeftOver->szStorage,
+		pCurr->szStorage + iIndex + 1, pLeftOver->tNextFree);
+	pLeftOver->szStorage[pLeftOver->tNextFree] = '\0';
+	NO_DBG_MSG(pLeftOver->szStorage);
+	pLeftOver->ucFontColor = pCurr->ucFontColor;
+	pLeftOver->usFontStyle = pCurr->usFontStyle;
+	pLeftOver->tFontRef = pCurr->tFontRef;
+	pLeftOver->usFontSize = pCurr->usFontSize;
+	pLeftOver->lStringWidth = lComputeStringWidth(
+					pLeftOver->szStorage,
+					pLeftOver->tNextFree,
+					pLeftOver->tFontRef,
+					pLeftOver->usFontSize);
+	pLeftOver->pPrev = NULL;
+	pLeftOver->pNext = pCurr->pNext;
+	if (pLeftOver->pNext != NULL) {
+		pLeftOver->pNext->pPrev = pLeftOver;
+	}
+	fail(!bCheckDoubleLinkedList(pLeftOver));
+
+	NO_DBG_MSG("pAnchor");
+	NO_DBG_HEX(pCurr->szStorage[iIndex]);
+	while (iIndex >= 0 && isspace((int)(UCHAR)pCurr->szStorage[iIndex])) {
+		iIndex--;
+	}
+	pCurr->tNextFree = (size_t)iIndex + 1;
+	pCurr->szStorage[pCurr->tNextFree] = '\0';
+	NO_DBG_MSG(pCurr->szStorage);
+	pCurr->lStringWidth = lComputeStringWidth(
+					pCurr->szStorage,
+					pCurr->tNextFree,
+					pCurr->tFontRef,
+					pCurr->usFontSize);
+	pCurr->pNext = NULL;
+	fail(!bCheckDoubleLinkedList(pAnchor));
+
+	return pLeftOver;
+} /* end of pSplitList */
+
+/*
+ * tNumber2Roman - convert a number to Roman Numerals
+ *
+ * returns the number of characters written
+ */
+size_t
+tNumber2Roman(UINT uiNumber, BOOL bUpperCase, char *szOutput)
+{
+	char	*outp, *p, *q;
+	UINT	uiNextVal, uiValue;
+
+	fail(szOutput == NULL);
+
+	uiNumber %= 4000;	/* Very high numbers can't be represented */
+	if (uiNumber == 0) {
+		szOutput[0] = '\0';
+		return 0;
+	}
+
+	outp = szOutput;
+	p = bUpperCase ? "M\2D\5C\2L\5X\2V\5I" : "m\2d\5c\2l\5x\2v\5i";
+	uiValue = 1000;
+	for (;;) {
+		while (uiNumber >= uiValue) {
+			*outp++ = *p;
+			uiNumber -= uiValue;
+		}
+		if (uiNumber == 0) {
+			*outp = '\0';
+			fail(outp < szOutput);
+			return (size_t)(outp - szOutput);
+		}
+		q = p + 1;
+		uiNextVal = uiValue / (UINT)(UCHAR)*q;
+		if ((int)*q == 2) {		/* magic */
+			uiNextVal /= (UINT)(UCHAR)*(q += 2);
+		}
+		if (uiNumber + uiNextVal >= uiValue) {
+			*outp++ = *++q;
+			uiNumber += uiNextVal;
+		} else {
+			p++;
+			uiValue /= (UINT)(UCHAR)(*p++);
+		}
+	}
+} /* end of tNumber2Roman */
+
+/*
+ * iNumber2Alpha - convert a number to alphabetic "numbers"
+ *
+ * returns the number of characters written
+ */
+size_t
+tNumber2Alpha(UINT uiNumber, BOOL bUpperCase, char *szOutput)
+{
+	char	*outp;
+	UINT	uiTmp;
+
+	fail(szOutput == NULL);
+
+	if (uiNumber == 0) {
+		szOutput[0] = '\0';
+		return 0;
+	}
+
+	outp = szOutput;
+	uiTmp = (UINT)(bUpperCase ? 'A': 'a');
+	if (uiNumber <= 26) {
+		uiNumber -= 1;
+		*outp++ = (char)(uiTmp + uiNumber);
+	} else if (uiNumber <= 26U + 26U*26U) {
+		uiNumber -= 26 + 1;
+		*outp++ = (char)(uiTmp + uiNumber / 26);
+		*outp++ = (char)(uiTmp + uiNumber % 26);
+	} else if (uiNumber <= 26U + 26U*26U + 26U*26U*26U) {
+		uiNumber -= 26 + 26*26 + 1;
+		*outp++ = (char)(uiTmp + uiNumber / (26*26));
+		*outp++ = (char)(uiTmp + uiNumber / 26 % 26);
+		*outp++ = (char)(uiTmp + uiNumber % 26);
+	}
+	*outp = '\0';
+	fail(outp < szOutput);
+	return (size_t)(outp - szOutput);
+} /* end of tNumber2Alpha */
+
+/*
+ * unincpy - copy a counted Unicode string to an single-byte string
+ */
+char *
+unincpy(char *s1, const UCHAR *s2, size_t n)
+{
+	char	*dest;
+	ULONG	ulChar;
+	size_t	tLen;
+	USHORT	usUni;
+
+	for (dest = s1, tLen = 0; tLen < n; dest++, tLen++) {
+		usUni = usGetWord(tLen * 2, s2);
+		if (usUni == 0) {
+			break;
+		}
+		ulChar = ulTranslateCharacters(usUni, 0, 8,
+				conversion_unknown, encoding_neutral, FALSE);
+		if (ulChar == IGNORE_CHARACTER) {
+			ulChar = (ULONG)'?';
+		}
+		*dest = (char)ulChar;
+	}
+	for (; tLen < n; tLen++) {
+		*dest++ = '\0';
+	}
+	return s1;
+} /* end of unincpy */
+
+/*
+ * unilen - calculate the length of a Unicode string
+ *
+ * returns the length in bytes
+ */
+size_t
+unilen(const UCHAR *s)
+{
+	size_t	tLen;
+	USHORT	usUni;
+
+	tLen = 0;
+	for (;;) {
+		usUni = usGetWord(tLen, s);
+		if (usUni == 0) {
+			return tLen;
+		}
+		tLen += 2;
+	}
+} /* end of unilen */
+
+/*
+ * szBaseName - get the basename of the specified filename
+ */
+const char *
+szBasename(const char *szFilename)
+{
+	const char	*szTmp;
+
+	fail(szFilename == NULL);
+
+	if (szFilename == NULL || szFilename[0] == '\0') {
+		return "null";
+	}
+
+	szTmp = strrchr(szFilename, FILE_SEPARATOR[0]);
+	if (szTmp == NULL) {
+		return szFilename;
+	}
+	return ++szTmp;
+} /* end of szBasename */
+
+/*
+ * lComputeLeading - compute the leading
+ *
+ * NOTE: the fontsize is specified in half points
+ *
+ * Returns the leading in drawunits
+ */
+long
+lComputeLeading(USHORT usFontSize)
+{
+	long	lLeading;
+
+	lLeading = (long)usFontSize * 500L;
+	if (usFontSize < 18) {		/* Small text: 112% */
+		lLeading *= 112;
+	} else if (usFontSize < 28) {	/* Normal text: 124% */
+		lLeading *= 124;
+	} else if (usFontSize < 48) {	/* Small headlines: 104% */
+		lLeading *= 104;
+	} else {			/* Large headlines: 100% */
+		lLeading *= 100;
+	}
+	lLeading = lMilliPoints2DrawUnits(lLeading);
+	lLeading += 50;
+	lLeading /= 100;
+	return lLeading;
+} /* end of lComputeLeading */
+
+/*
+ * Convert a UCS character to an UTF-8 string
+ *
+ * Returns the string length of the result
+ */
+size_t
+tUcs2Utf8(ULONG ulChar, char *szResult, size_t tMaxResultLen)
+{
+	if (szResult == NULL || tMaxResultLen == 0) {
+		return 0;
+	}
+
+	if (ulChar < 0x80 && tMaxResultLen >= 2) {
+		szResult[0] = (char)ulChar;
+		szResult[1] = '\0';
+		return 1;
+	}
+	if (ulChar < 0x800 && tMaxResultLen >= 3) {
+		szResult[0] = (char)(0xc0 | ulChar >> 6);
+		szResult[1] = (char)(0x80 | (ulChar & 0x3f));
+		szResult[2] = '\0';
+		return 2;
+	}
+	if (ulChar < 0x10000 && tMaxResultLen >= 4) {
+		szResult[0] = (char)(0xe0 | ulChar >> 12);
+		szResult[1] = (char)(0x80 | (ulChar >> 6 & 0x3f));
+		szResult[2] = (char)(0x80 | (ulChar & 0x3f));
+		szResult[3] = '\0';
+		return 3;
+	}
+	if (ulChar < 0x200000 && tMaxResultLen >= 5) {
+		szResult[0] = (char)(0xf0 | ulChar >> 18);
+		szResult[1] = (char)(0x80 | (ulChar >> 12 & 0x3f));
+		szResult[2] = (char)(0x80 | (ulChar >> 6 & 0x3f));
+		szResult[3] = (char)(0x80 | (ulChar & 0x3f));
+		szResult[4] = '\0';
+		return 4;
+	}
+	szResult[0] = '\0';
+	return 0;
+} /* end of tUcs2Utf8 */
+
+/*
+ * vGetBulletValue - get the bullet value for the conversing type and encoding
+ */
+void
+vGetBulletValue(conversion_type eConversionType, encoding_type eEncoding,
+	char *szResult, size_t tMaxResultLen)
+{
+	fail(szResult == NULL);
+	fail(tMaxResultLen < 2);
+
+	if (eEncoding == encoding_utf8) {
+		(void)tUcs2Utf8(UNICODE_BULLET, szResult, tMaxResultLen);
+	} else if (eEncoding == encoding_iso_8859_1 &&
+		   eConversionType == conversion_ps) {
+		szResult[0] = OUR_BULLET_PS;
+		szResult[1] = '\0';
+	} else {
+		szResult[0] = OUR_BULLET_TEXT;
+		szResult[1] = '\0';
+	}
+} /* end of vGetBulletValue */
+
+/*
+ * bAllZero - are all bytes zero?
+ */
+BOOL
+bAllZero(const UCHAR *aucBytes, size_t tLength)
+{
+	size_t	tIndex;
+
+	if (aucBytes == NULL || tLength == 0) {
+		return TRUE;
+	}
+
+	for (tIndex = 0; tIndex < tLength; tIndex++) {
+		if (aucBytes[tIndex] != 0) {
+			return FALSE;
+		}
+	}
+	return TRUE;
+} /* end of bAllZero */

+ 27 - 0
sys/src/cmd/aux/antiword/mkfile

@@ -0,0 +1,27 @@
+</$objtype/mkfile
+
+TARG=antiword
+
+CFLAGS=-Bp -I/sys/include/ape -I/$objtype/include/ape -DNDEBUG -D_POSIX_SOURCE -D__Plan9__
+
+TARG=antiword
+OFILES= main_u.$O asc85enc.$O blocklist.$O chartrans.$O datalist.$O depot.$O\
+	dib2eps.$O fail.$O finddata.$O findtext.$O fontlist.$O fonts.$O fonts_u.$O\
+	imgexam.$O imgtrans.$O jpeg2eps.$O listlist.$O misc.$O notes.$O options.$O\
+	out2window.$O output.$O pictlist.$O png2eps.$O postscript.$O prop0.$O prop2.$O\
+	prop6.$O prop8.$O properties.$O propmod.$O rowlist.$O sectlist.$O stylelist.$O\
+	stylesheet.$O summary.$O tabstop.$O text.$O unix.$O utf8.$O word2text.$O\
+	worddos.$O wordlib.$O wordmac.$O wordole.$O wordwin.$O xmalloc.$O xml.$O
+
+HFILES=antiword.h debug.h draw.h fail.h fontinfo.h version.h wordconst.h wordtypes.h
+
+BIN=/$objtype/bin/aux
+
+</sys/src/cmd/mkone
+
+main_u.$O: version.h
+postscript.$O: version.h
+fonts_u.$O: fontinfo.h
+
+# fontinfo.h: Unix-fontinfo.pl
+# 	fontinfo.pl > fontinfo.h

+ 397 - 0
sys/src/cmd/aux/antiword/notes.c

@@ -0,0 +1,397 @@
+/*
+ * notes.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to tell the difference between footnotes and endnotes
+ */
+
+#include "antiword.h"
+
+/* Variables needed to write the Footnote and Endnote Lists */
+static ULONG	*aulFootnoteList = NULL;
+static size_t	tFootnoteListLength = 0;
+static ULONG	*aulEndnoteList = NULL;
+static size_t	tEndnoteListLength = 0;
+
+
+/*
+ * Destroy the lists with footnote and endnote information
+ */
+void
+vDestroyNotesInfoLists(void)
+{
+	DBG_MSG("vDestroyNotesInfoLists");
+
+	/* Free the lists and reset all control variables */
+	aulEndnoteList = xfree(aulEndnoteList);
+	aulFootnoteList = xfree(aulFootnoteList);
+	tEndnoteListLength = 0;
+	tFootnoteListLength = 0;
+} /* end of vDestroyNotesInfoLists */
+
+/*
+ * Build the list with footnote information for Word 6/7 files
+ */
+static void
+vGet6FootnotesInfo(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const UCHAR *aucHeader)
+{
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginFootnoteInfo;
+	size_t	tFootnoteInfoLen;
+	int	iIndex;
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	ulBeginOfText = ulGetLong(0x18, aucHeader);
+	NO_DBG_HEX(ulBeginOfText);
+	ulBeginFootnoteInfo = ulGetLong(0x68, aucHeader);
+	NO_DBG_HEX(ulBeginFootnoteInfo);
+	tFootnoteInfoLen = (size_t)ulGetLong(0x6c, aucHeader);
+	NO_DBG_DEC(tFootnoteInfoLen);
+
+	if (tFootnoteInfoLen < 10) {
+		DBG_MSG("No Footnotes in this document");
+		return;
+	}
+
+	aucBuffer = xmalloc(tFootnoteInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginFootnoteInfo, tFootnoteInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tFootnoteInfoLen);
+
+	fail(tFootnoteListLength != 0);
+	tFootnoteListLength = (tFootnoteInfoLen - 4) / 6;
+	fail(tFootnoteListLength == 0);
+
+	fail(aulFootnoteList != NULL);
+	aulFootnoteList = xcalloc(tFootnoteListLength, sizeof(ULONG));
+
+	for (iIndex = 0; iIndex < (int)tFootnoteListLength; iIndex++) {
+		ulOffset = ulGetLong(iIndex * 4, aucBuffer);
+		NO_DBG_HEX(ulOffset);
+		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);
+		NO_DBG_HEX(ulFileOffset);
+		aulFootnoteList[iIndex] = ulFileOffset;
+	}
+	aucBuffer = xfree(aucBuffer);
+} /* end of vGet6FootnotesInfo */
+
+/*
+ * Build the list with endnote information for Word 6/7 files
+ */
+static void
+vGet6EndnotesInfo(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const UCHAR *aucHeader)
+{
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginEndnoteInfo;
+	size_t	tEndnoteInfoLen;
+	int	iIndex;
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	ulBeginOfText = ulGetLong(0x18, aucHeader);
+	NO_DBG_HEX(ulBeginOfText);
+	ulBeginEndnoteInfo = ulGetLong(0x1d2, aucHeader);
+	NO_DBG_HEX(ulBeginEndnoteInfo);
+	tEndnoteInfoLen = (size_t)ulGetLong(0x1d6, aucHeader);
+	NO_DBG_DEC(tEndnoteInfoLen);
+
+	if (tEndnoteInfoLen < 10) {
+		DBG_MSG("No Endnotes in this document");
+		return;
+	}
+
+	aucBuffer = xmalloc(tEndnoteInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginEndnoteInfo, tEndnoteInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tEndnoteInfoLen);
+
+	fail(tEndnoteListLength != 0);
+	tEndnoteListLength = (tEndnoteInfoLen - 4) / 6;
+	fail(tEndnoteListLength == 0);
+
+	fail(aulEndnoteList != NULL);
+	aulEndnoteList = xcalloc(tEndnoteListLength, sizeof(ULONG));
+
+	for (iIndex = 0; iIndex < (int)tEndnoteListLength; iIndex++) {
+		ulOffset = ulGetLong(iIndex * 4, aucBuffer);
+		NO_DBG_HEX(ulOffset);
+		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);
+		NO_DBG_HEX(ulFileOffset);
+		aulEndnoteList[iIndex] = ulFileOffset;
+	}
+	aucBuffer = xfree(aucBuffer);
+} /* end of vGet6EndnotesInfo */
+
+/*
+ * Build the lists note information for Word 6/7 files
+ */
+static void
+vGet6NotesInfo(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const UCHAR *aucHeader)
+{
+	vGet6FootnotesInfo(pFile, ulStartBlock,
+			aulBBD, tBBDLen, aucHeader);
+	vGet6EndnotesInfo(pFile, ulStartBlock,
+			aulBBD, tBBDLen, aucHeader);
+} /* end of vGet6NotesInfo */
+
+/*
+ * Build the list with footnote information for Word 8/9/10 files
+ */
+static void
+vGet8FootnotesInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginFootnoteInfo;
+	ULONG	ulTableSize, ulTableStartBlock;
+	size_t	tFootnoteInfoLen, tBlockDepotLen, tBlockSize;
+	int	iIndex;
+	USHORT	usDocStatus;
+
+	ulBeginOfText = ulGetLong(0x18, aucHeader);
+	NO_DBG_HEX(ulBeginOfText);
+	ulBeginFootnoteInfo = ulGetLong(0xaa, aucHeader);
+	NO_DBG_HEX(ulBeginFootnoteInfo);
+	tFootnoteInfoLen = (size_t)ulGetLong(0xae, aucHeader);
+	NO_DBG_DEC(tFootnoteInfoLen);
+
+	if (tFootnoteInfoLen < 10) {
+		DBG_MSG("No Footnotes in this document");
+		return;
+	}
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	NO_DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_MSG("No notes information");
+		return;
+	}
+	NO_DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+	  	/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+	  	/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+	aucBuffer = xmalloc(tFootnoteInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginFootnoteInfo, tFootnoteInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tFootnoteInfoLen);
+
+	fail(tFootnoteListLength != 0);
+	tFootnoteListLength = (tFootnoteInfoLen - 4) / 6;
+	fail(tFootnoteListLength == 0);
+
+	fail(aulFootnoteList != NULL);
+	aulFootnoteList = xcalloc(tFootnoteListLength, sizeof(ULONG));
+
+	for (iIndex = 0; iIndex < (int)tFootnoteListLength; iIndex++) {
+		ulOffset = ulGetLong(iIndex * 4, aucBuffer);
+		NO_DBG_HEX(ulOffset);
+		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);
+		NO_DBG_HEX(ulFileOffset);
+		aulFootnoteList[iIndex] = ulFileOffset;
+	}
+	aucBuffer = xfree(aucBuffer);
+} /* end of vGet8FootnotesInfo */
+
+/*
+ * Build the list with endnote information for Word 8/9/10 files
+ */
+static void
+vGet8EndnotesInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulBeginOfText, ulOffset, ulBeginEndnoteInfo;
+	ULONG	ulTableSize, ulTableStartBlock;
+	size_t	tEndnoteInfoLen, tBlockDepotLen, tBlockSize;
+	int	iIndex;
+	USHORT	usDocStatus;
+
+	ulBeginOfText = ulGetLong(0x18, aucHeader);
+	NO_DBG_HEX(ulBeginOfText);
+	ulBeginEndnoteInfo = ulGetLong(0x20a, aucHeader);
+	NO_DBG_HEX(ulBeginEndnoteInfo);
+	tEndnoteInfoLen = (size_t)ulGetLong(0x20e, aucHeader);
+	NO_DBG_DEC(tEndnoteInfoLen);
+
+	if (tEndnoteInfoLen < 10) {
+		DBG_MSG("No Endnotes in this document");
+		return;
+	}
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	NO_DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_MSG("No notes information");
+		return;
+	}
+	NO_DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+	  	/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+	  	/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+	aucBuffer = xmalloc(tEndnoteInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginEndnoteInfo, tEndnoteInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tEndnoteInfoLen);
+
+	fail(tEndnoteListLength != 0);
+	tEndnoteListLength = (tEndnoteInfoLen - 4) / 6;
+	fail(tEndnoteListLength == 0);
+
+	fail(aulEndnoteList != NULL);
+	aulEndnoteList = xcalloc(tEndnoteListLength, sizeof(ULONG));
+
+	for (iIndex = 0; iIndex < (int)tEndnoteListLength; iIndex++) {
+		ulOffset = ulGetLong(iIndex * 4, aucBuffer);
+		NO_DBG_HEX(ulOffset);
+		ulFileOffset = ulCharPos2FileOffset(ulBeginOfText + ulOffset);
+		NO_DBG_HEX(ulFileOffset);
+		aulEndnoteList[iIndex] = ulFileOffset;
+	}
+	aucBuffer = xfree(aucBuffer);
+} /* end of vGet8EndnotesInfo */
+
+/*
+ * Build the lists with footnote and endnote information for Word 8/9/10 files
+ */
+static void
+vGet8NotesInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	vGet8FootnotesInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+	vGet8EndnotesInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+} /* end of vGet8NotesInfo */
+
+/*
+ * Build the lists with footnote and endnote information
+ */
+void
+vGetNotesInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader, int iWordVersion)
+{
+	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
+	fail(iWordVersion < 6 || iWordVersion > 8);
+	fail(aulBBD == NULL || aulSBD == NULL);
+
+	switch (iWordVersion) {
+	case 6:
+	case 7:
+		vGet6NotesInfo(pFile, pPPS->tWordDocument.ulSB,
+			aulBBD, tBBDLen, aucHeader);
+		break;
+	case 8:
+		vGet8NotesInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		break;
+	default:
+		werr(0, "Sorry, no notes information");
+		break;
+	}
+} /* end of vGetNotesInfo */
+
+/*
+ * Get the notetype of the note at the given fileoffset
+ */
+notetype_enum
+eGetNotetype(ULONG ulFileOffset)
+{
+	size_t	tIndex;
+
+	fail(aulFootnoteList == NULL && tFootnoteListLength != 0);
+	fail(aulEndnoteList == NULL && tEndnoteListLength != 0);
+
+	/* Go for the easy answers first */
+	if (tFootnoteListLength == 0 && tEndnoteListLength == 0) {
+		return notetype_is_unknown;
+	}
+	if (tEndnoteListLength == 0) {
+		return notetype_is_footnote;
+	}
+	if (tFootnoteListLength == 0) {
+		return notetype_is_endnote;
+	}
+	/* No easy answer, so we search */
+	for (tIndex = 0; tIndex < tFootnoteListLength; tIndex++) {
+		if (aulFootnoteList[tIndex] == ulFileOffset) {
+			return notetype_is_footnote;
+		}
+	}
+	for (tIndex = 0; tIndex < tEndnoteListLength; tIndex++) {
+		if (aulEndnoteList[tIndex] == ulFileOffset) {
+			return notetype_is_endnote;
+		}
+	}
+	/* Not found */
+	return notetype_is_unknown;
+} /* end of eGetNotetype */

+ 786 - 0
sys/src/cmd/aux/antiword/options.c

@@ -0,0 +1,786 @@
+/*
+ * options.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Read and write the options
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#if defined(__riscos)
+#include "wimpt.h"
+#else
+#include <stdlib.h>
+#if defined(__dos)
+extern int getopt(int, char **, const char *);
+#else
+#include <unistd.h>
+#endif /* __dos */
+#endif /* __riscos */
+#include "antiword.h"
+
+#if defined(__riscos)
+#define PARAGRAPH_BREAK		"set paragraph_break=%d"
+#define AUTOFILETYPE		"set autofiletype_allowed=%d"
+#define USE_OUTLINEFONTS	"set use_outlinefonts=%d"
+#define SHOW_IMAGES		"set show_images=%d"
+#define HIDE_HIDDEN_TEXT	"set hide_hidden_text=%d"
+#define SCALE_FACTOR_START	"set scale_factor_start=%d"
+#endif /* __riscos */
+
+/* Current values for options */
+static options_type	tOptionsCurr;
+#if defined(__riscos)
+/* Temporary values for options */
+static options_type	tOptionsTemp;
+#else
+typedef struct papersize_tag {
+	char	szName[16];	/* Papersize name */
+	USHORT	usWidth;	/* In points */
+	USHORT	usHeight;	/* In points */
+} papersize_type;
+
+static const papersize_type atPaperSizes[] = {
+	{	"10x14",	 720,	1008	},
+	{	"a3",		 842,	1191	},
+	{	"a4",		 595,	 842	},
+	{	"a5",		 420,	 595	},
+	{	"b4",		 729,	1032	},
+	{	"b5",		 516,	 729	},
+	{	"executive",	 540,	 720	},
+	{	"folio",	 612,	 936	},
+	{	"legal",	 612,	1008	},
+	{	"letter",	 612,	 792	},
+	{	"note",		 540,	 720	},
+	{	"quarto",	 610,	 780	},
+	{	"statement",	 396,	 612	},
+	{	"tabloid",	 792,	1224	},
+	{	"",		   0,	   0	},
+};
+#endif /* __riscos */
+/* Default values for options */
+static const options_type	tOptionsDefault = {
+	DEFAULT_SCREEN_WIDTH,
+#if defined(__riscos)
+	conversion_draw,
+#else
+	conversion_text,
+#endif /* __riscos */
+	TRUE,
+	FALSE,
+	encoding_iso_8859_1,
+	INT_MAX,
+	INT_MAX,
+	level_default,
+#if defined(__riscos)
+	TRUE,
+	DEFAULT_SCALE_FACTOR,
+#endif /* __riscos */
+};
+
+
+/*
+ * iReadOptions - read options
+ *
+ * returns:	-1: error
+ *		 0: help
+ *		>0: index first file argument
+ */
+int
+iReadOptions(int argc, char **argv)
+{
+#if defined(__riscos)
+	FILE	*pFile;
+	const char	*szAlphabet;
+	int	iAlphabet;
+	char	szLine[81];
+#else
+	extern	char	*optarg;
+	extern int	optind;
+	const papersize_type	*pPaperSize;
+	const char	*szHome, *szAntiword;
+	char	*pcChar, *szTmp;
+	int	iChar;
+	BOOL	bFound;
+	char	szLeafname[32+1];
+	char	szMappingFile[PATH_MAX+1];
+#endif /* __riscos */
+	int	iTmp;
+
+	DBG_MSG("iReadOptions");
+
+/* Defaults */
+	tOptionsCurr = tOptionsDefault;
+
+#if defined(__riscos)
+/* Choices file */
+	pFile = fopen("<AntiWord$ChoicesFile>", "r");
+	DBG_MSG_C(pFile == NULL, "Choices file not found");
+	DBG_HEX_C(pFile != NULL, pFile);
+	if (pFile != NULL) {
+		while (fgets(szLine, (int)sizeof(szLine), pFile) != NULL) {
+			DBG_MSG(szLine);
+			if (szLine[0] == '#' ||
+			    szLine[0] == '\r' ||
+			    szLine[0] == '\n') {
+				continue;
+			}
+			if (sscanf(szLine, PARAGRAPH_BREAK, &iTmp) == 1 &&
+			    (iTmp == 0 ||
+			    (iTmp >= MIN_SCREEN_WIDTH &&
+			     iTmp <= MAX_SCREEN_WIDTH))) {
+				tOptionsCurr.iParagraphBreak = iTmp;
+				DBG_DEC(tOptionsCurr.iParagraphBreak);
+			} else if (sscanf(szLine, AUTOFILETYPE, &iTmp)
+								== 1) {
+				tOptionsCurr.bAutofiletypeAllowed =
+								iTmp != 0;
+				DBG_DEC(tOptionsCurr.bAutofiletypeAllowed);
+			} else if (sscanf(szLine, USE_OUTLINEFONTS, &iTmp)
+								== 1) {
+				tOptionsCurr.eConversionType =
+					iTmp == 0 ?
+					conversion_text : conversion_draw;
+				DBG_DEC(tOptionsCurr.eConversionType);
+			} else if (sscanf(szLine, SHOW_IMAGES, &iTmp)
+								== 1) {
+				tOptionsCurr.eImageLevel = iTmp != 0 ?
+					level_default : level_no_images;
+			} else if (sscanf(szLine, HIDE_HIDDEN_TEXT, &iTmp)
+								== 1) {
+				tOptionsCurr.bHideHiddenText = iTmp != 0;
+				DBG_DEC(tOptionsCurr.bHideHiddenText);
+			} else if (sscanf(szLine, SCALE_FACTOR_START, &iTmp)
+								== 1) {
+				if (iTmp >= MIN_SCALE_FACTOR &&
+				    iTmp <= MAX_SCALE_FACTOR) {
+					tOptionsCurr.iScaleFactor = iTmp;
+					DBG_DEC(tOptionsCurr.iScaleFactor);
+				}
+			}
+		}
+		(void)fclose(pFile);
+	}
+	iAlphabet = iReadCurrentAlphabetNumber();
+	switch (iAlphabet) {
+	case 101:	/* ISO-8859-1 aka Latin1 */
+		szAlphabet = "<AntiWord$Latin1>";
+		break;
+	case 112:	/* ISO-8859-15 aka Latin9 */
+		szAlphabet = "<AntiWord$Latin9>";
+		break;
+	default:
+		werr(0, "Alphabet '%d' is not supported", iAlphabet);
+		return -1;
+	}
+	if (bReadCharacterMappingTable(szAlphabet)) {
+		return 1;
+	}
+	return -1;
+#else
+/* Environment */
+	szTmp = getenv("COLUMNS");
+	if (szTmp != NULL) {
+		DBG_MSG(szTmp);
+		iTmp = (int)strtol(szTmp, &pcChar, 10);
+		if (*pcChar == '\0') {
+			iTmp -= 4;	/* This is for the edge */
+			if (iTmp < MIN_SCREEN_WIDTH) {
+				iTmp = MIN_SCREEN_WIDTH;
+			} else if (iTmp > MAX_SCREEN_WIDTH) {
+				iTmp = MAX_SCREEN_WIDTH;
+			}
+			tOptionsCurr.iParagraphBreak = iTmp;
+			DBG_DEC(tOptionsCurr.iParagraphBreak);
+		}
+	}
+	if (is_locale_utf8()) {
+		tOptionsCurr.eEncoding = encoding_utf8;
+		strcpy(szLeafname, MAPPING_FILE_DEFAULT_8);
+	} else {
+		tOptionsCurr.eEncoding = encoding_iso_8859_1;
+		strcpy(szLeafname, MAPPING_FILE_DEFAULT_1);
+	}
+/* Command line */
+	while ((iChar = getopt(argc, argv, "Lhi:m:p:stw:x:")) != -1) {
+		switch (iChar) {
+		case 'L':
+			tOptionsCurr.bUseLandscape = TRUE;
+			break;
+		case 'h':
+			return 0;
+		case 'i':
+			iTmp = (int)strtol(optarg, &pcChar, 10);
+			if (*pcChar != '\0') {
+				break;
+			}
+			switch (iTmp) {
+			case 0:
+				tOptionsCurr.eImageLevel = level_gs_special;
+				break;
+			case 1:
+				tOptionsCurr.eImageLevel = level_no_images;
+				break;
+			case 2:
+				tOptionsCurr.eImageLevel = level_ps_2;
+				break;
+			case 3:
+				tOptionsCurr.eImageLevel = level_ps_3;
+				break;
+			default:
+				tOptionsCurr.eImageLevel = level_default;
+				break;
+			}
+			DBG_DEC(tOptionsCurr.eImageLevel);
+			break;
+		case 'm':
+			if (tOptionsCurr.eConversionType == conversion_xml) {
+				werr(0, "XML doesn't need a mapping file");
+				break;
+			}
+			strncpy(szLeafname, optarg, sizeof(szLeafname) - 1);
+			szLeafname[sizeof(szLeafname) - 1] = '\0';
+			DBG_MSG(szLeafname);
+			if (STRCEQ(szLeafname, MAPPING_FILE_DEFAULT_8)) {
+				tOptionsCurr.eEncoding = encoding_utf8;
+			} else if (STRCEQ(szLeafname, MAPPING_FILE_DEFAULT_2)) {
+				tOptionsCurr.eEncoding = encoding_iso_8859_2;
+			} else {
+				tOptionsCurr.eEncoding = encoding_iso_8859_1;
+			}
+			DBG_DEC(tOptionsCurr.eEncoding);
+			break;
+		case 'p':
+			bFound = FALSE;
+			for (pPaperSize = atPaperSizes;
+			     pPaperSize->szName[0] != '\0';
+			     pPaperSize++) {
+				if (!STREQ(pPaperSize->szName,  optarg)) {
+					continue;
+				}
+				DBG_DEC(pPaperSize->usWidth);
+				DBG_DEC(pPaperSize->usHeight);
+				tOptionsCurr.eConversionType = conversion_ps;
+				tOptionsCurr.iPageHeight =
+						(int)pPaperSize->usHeight;
+				tOptionsCurr.iPageWidth =
+						(int)pPaperSize->usWidth;
+				bFound = TRUE;
+				break;
+			}
+			if (!bFound) {
+				werr(0, "-p without a valid papersize");
+				return -1;
+			}
+			break;
+		case 's':
+			tOptionsCurr.bHideHiddenText = FALSE;
+			break;
+		case 't':
+			tOptionsCurr.eConversionType = conversion_text;
+			break;
+		case 'w':
+			iTmp = (int)strtol(optarg, &pcChar, 10);
+			if (*pcChar == '\0') {
+				if (iTmp != 0 && iTmp < MIN_SCREEN_WIDTH) {
+					iTmp = MIN_SCREEN_WIDTH;
+				} else if (iTmp > MAX_SCREEN_WIDTH) {
+					iTmp = MAX_SCREEN_WIDTH;
+				}
+				tOptionsCurr.iParagraphBreak = iTmp;
+				DBG_DEC(tOptionsCurr.iParagraphBreak);
+			}
+			break;
+		case 'x':
+			if (STREQ(optarg, "db")) {
+				tOptionsCurr.iParagraphBreak = 0;
+				tOptionsCurr.eConversionType = conversion_xml;
+				tOptionsCurr.eEncoding = encoding_utf8;
+			} else {
+				werr(0, "-x %s is not supported", optarg);
+				return -1;
+			}
+			break;
+		default:
+			return -1;
+		}
+	}
+
+	if (tOptionsCurr.eConversionType == conversion_ps &&
+	    tOptionsCurr.eEncoding == encoding_utf8) {
+		werr(0,
+		"The combination PostScript and UTF-8 is not supported");
+		return -1;
+	}
+
+	if (tOptionsCurr.eConversionType == conversion_ps) {
+		/* PostScript mode */
+		if (tOptionsCurr.bUseLandscape) {
+			/* Swap the page height and width */
+			iTmp = tOptionsCurr.iPageHeight;
+			tOptionsCurr.iPageHeight = tOptionsCurr.iPageWidth;
+			tOptionsCurr.iPageWidth = iTmp;
+		}
+		/* The paragraph break depends on the width of the paper */
+		tOptionsCurr.iParagraphBreak = iMilliPoints2Char(
+			(long)tOptionsCurr.iPageWidth * 1000 -
+			lDrawUnits2MilliPoints(
+				PS_LEFT_MARGIN + PS_RIGHT_MARGIN));
+		DBG_DEC(tOptionsCurr.iParagraphBreak);
+	}
+
+	/* Try the environment version of the mapping file */
+	szAntiword = szGetAntiwordDirectory();
+	if (szAntiword != NULL && szAntiword[0] != '\0') {
+	    if (strlen(szAntiword) + strlen(szLeafname) <
+		sizeof(szMappingFile) -
+		sizeof(FILE_SEPARATOR)) {
+			sprintf(szMappingFile,
+				"%s" FILE_SEPARATOR "%s",
+				szAntiword, szLeafname);
+			DBG_MSG(szMappingFile);
+			if (bReadCharacterMappingTable(szMappingFile)) {
+				return optind;
+			}
+		} else {
+			werr(0, "Environment mappingfilename ignored");
+		}
+	}
+	/* Try the local version of the mapping file */
+	szHome = szGetHomeDirectory();
+	if (strlen(szHome) + strlen(szLeafname) <
+	    sizeof(szMappingFile) -
+	    sizeof(ANTIWORD_DIR) -
+	    2 * sizeof(FILE_SEPARATOR)) {
+		sprintf(szMappingFile,
+			"%s" FILE_SEPARATOR ANTIWORD_DIR FILE_SEPARATOR "%s",
+			szHome, szLeafname);
+		DBG_MSG(szMappingFile);
+		if (bReadCharacterMappingTable(szMappingFile)) {
+			return optind;
+		}
+	} else {
+		werr(0, "Local mappingfilename too long, ignored");
+	}
+	/* Try the global version of the mapping file */
+	if (strlen(szLeafname) <
+	    sizeof(szMappingFile) -
+	    sizeof(GLOBAL_ANTIWORD_DIR) -
+	    sizeof(FILE_SEPARATOR)) {
+		sprintf(szMappingFile,
+			GLOBAL_ANTIWORD_DIR FILE_SEPARATOR "%s",
+			szLeafname);
+		DBG_MSG(szMappingFile);
+		if (bReadCharacterMappingTable(szMappingFile)) {
+			return optind;
+		}
+	} else {
+		werr(0, "Global mappingfilename too long, ignored");
+	}
+	werr(0, "I can't open your mapping file (%s)\n"
+		"It is not in '%s" FILE_SEPARATOR ANTIWORD_DIR "' nor in '"
+		GLOBAL_ANTIWORD_DIR "'.", szLeafname, szHome);
+	return -1;
+#endif /* __riscos */
+} /* end of iReadOptions */
+
+/*
+ * vGetOptions - get a copy of the current option values
+ */
+void
+vGetOptions(options_type *pOptions)
+{
+	fail(pOptions == NULL);
+
+	*pOptions = tOptionsCurr;
+} /* end of vGetOptions */
+
+#if defined(__riscos)
+/*
+ * vWriteOptions - write the current options to the Options file
+ */
+static void
+vWriteOptions(void)
+{
+	FILE	*pFile;
+	char	*szOptionsFile;
+
+	DBG_MSG("vWriteOptions");
+
+	szOptionsFile = getenv("AntiWord$ChoicesSave");
+	if (szOptionsFile == NULL) {
+		werr(0, "Warning: Name of the Choices file not found");
+		return;
+	}
+	if (!bMakeDirectory(szOptionsFile)) {
+		werr(0,
+		"Warning: I can't make a directory for the Choices file");
+		return;
+	}
+	pFile = fopen(szOptionsFile, "w");
+	if (pFile == NULL) {
+		werr(0, "Warning: I can't write the Choices file");
+		return;
+	}
+	(void)fprintf(pFile, PARAGRAPH_BREAK"\n",
+		tOptionsCurr.iParagraphBreak);
+	(void)fprintf(pFile, AUTOFILETYPE"\n",
+		tOptionsCurr.bAutofiletypeAllowed);
+	(void)fprintf(pFile, USE_OUTLINEFONTS"\n",
+		tOptionsCurr.eConversionType == conversion_text ? 0 : 1);
+	(void)fprintf(pFile, SHOW_IMAGES"\n",
+		tOptionsCurr.eImageLevel == level_no_images ? 0 : 1);
+	(void)fprintf(pFile, HIDE_HIDDEN_TEXT"\n",
+		tOptionsCurr.bHideHiddenText);
+	(void)fprintf(pFile, SCALE_FACTOR_START"\n",
+		tOptionsCurr.iScaleFactor);
+	(void)fclose(pFile);
+} /* end of vWriteOptions */
+
+/*
+ * vChoicesOpenAction - action to be taken when the Choices window opens
+ */
+void
+vChoicesOpenAction(wimp_w tWindow)
+{
+	DBG_MSG("vChoicesOpenAction");
+
+	tOptionsTemp = tOptionsCurr;
+	if (tOptionsTemp.iParagraphBreak == 0) {
+		vUpdateRadioButton(tWindow, CHOICES_BREAK_BUTTON, FALSE);
+		vUpdateRadioButton(tWindow, CHOICES_NO_BREAK_BUTTON, TRUE);
+		vUpdateWriteableNumber(tWindow, CHOICES_BREAK_WRITEABLE,
+					DEFAULT_SCREEN_WIDTH);
+	} else {
+		vUpdateRadioButton(tWindow, CHOICES_BREAK_BUTTON, TRUE);
+		vUpdateRadioButton(tWindow, CHOICES_NO_BREAK_BUTTON, FALSE);
+		vUpdateWriteableNumber(tWindow,
+			CHOICES_BREAK_WRITEABLE,
+			tOptionsTemp.iParagraphBreak);
+	}
+	vUpdateRadioButton(tWindow, CHOICES_AUTOFILETYPE_BUTTON,
+					tOptionsTemp.bAutofiletypeAllowed);
+	vUpdateRadioButton(tWindow, CHOICES_HIDDEN_TEXT_BUTTON,
+					tOptionsTemp.bHideHiddenText);
+	if (tOptionsTemp.eConversionType == conversion_draw) {
+		vUpdateRadioButton(tWindow,
+			CHOICES_WITH_IMAGES_BUTTON,
+			tOptionsTemp.eImageLevel != level_no_images);
+		vUpdateRadioButton(tWindow,
+			CHOICES_NO_IMAGES_BUTTON,
+			tOptionsTemp.eImageLevel == level_no_images);
+		vUpdateRadioButton(tWindow,
+			CHOICES_TEXTONLY_BUTTON, FALSE);
+	} else {
+		vUpdateRadioButton(tWindow,
+			CHOICES_WITH_IMAGES_BUTTON, FALSE);
+		vUpdateRadioButton(tWindow,
+			CHOICES_NO_IMAGES_BUTTON, FALSE);
+		vUpdateRadioButton(tWindow,
+			CHOICES_TEXTONLY_BUTTON, TRUE);
+	}
+	vUpdateWriteableNumber(tWindow,
+		CHOICES_SCALE_WRITEABLE, tOptionsTemp.iScaleFactor);
+} /* end of vChoicesOpenAction */
+
+/*
+ * vDefaultButtonAction - action when the default button is clicked
+ */
+static void
+vDefaultButtonAction(wimp_w tWindow)
+{
+	DBG_MSG("vDefaultButtonAction");
+
+	tOptionsTemp = tOptionsDefault;
+	vUpdateRadioButton(tWindow, CHOICES_BREAK_BUTTON, TRUE);
+	vUpdateRadioButton(tWindow, CHOICES_NO_BREAK_BUTTON, FALSE);
+	vUpdateWriteableNumber(tWindow, CHOICES_BREAK_WRITEABLE,
+			tOptionsTemp.iParagraphBreak);
+	vUpdateRadioButton(tWindow, CHOICES_AUTOFILETYPE_BUTTON,
+			tOptionsTemp.bAutofiletypeAllowed);
+	vUpdateRadioButton(tWindow, CHOICES_HIDDEN_TEXT_BUTTON,
+			tOptionsTemp.bHideHiddenText);
+	vUpdateRadioButton(tWindow, CHOICES_WITH_IMAGES_BUTTON,
+			tOptionsTemp.eConversionType == conversion_draw &&
+			tOptionsTemp.eImageLevel != level_no_images);
+	vUpdateRadioButton(tWindow, CHOICES_NO_IMAGES_BUTTON,
+			tOptionsTemp.eConversionType == conversion_draw &&
+			tOptionsTemp.eImageLevel == level_no_images);
+	vUpdateRadioButton(tWindow, CHOICES_TEXTONLY_BUTTON,
+			tOptionsTemp.eConversionType == conversion_text);
+	vUpdateWriteableNumber(tWindow, CHOICES_SCALE_WRITEABLE,
+			tOptionsTemp.iScaleFactor);
+} /* end of vDefaultButtonAction */
+
+/*
+ * vApplyButtonAction - action to be taken when the OK button is clicked
+ */
+static void
+vApplyButtonAction(void)
+{
+	DBG_MSG("vApplyButtonAction");
+
+	tOptionsCurr = tOptionsTemp;
+} /* end of vApplyButtonAction */
+
+/*
+ * vSaveButtonAction - action to be taken when the save button is clicked
+ */
+static void
+vSaveButtonAction(void)
+{
+	DBG_MSG("vSaveButtonAction");
+
+	vApplyButtonAction();
+	vWriteOptions();
+} /* end of vSaveButtonAction */
+
+/*
+ * vSetParagraphBreak - set the paragraph break to the given number
+ */
+static void
+vSetParagraphBreak(wimp_w tWindow, int iNumber)
+{
+	tOptionsTemp.iParagraphBreak = iNumber;
+	if (tOptionsTemp.iParagraphBreak == 0) {
+		return;
+	}
+	vUpdateWriteableNumber(tWindow,
+			CHOICES_BREAK_WRITEABLE,
+			tOptionsTemp.iParagraphBreak);
+} /* end of vSetParagraphBreak */
+
+/*
+ * vChangeParagraphBreak - change the paragraph break with the given number
+ */
+static void
+vChangeParagraphBreak(wimp_w tWindow, int iNumber)
+{
+	int	iTmp;
+
+	iTmp = tOptionsTemp.iParagraphBreak + iNumber;
+	if (iTmp < MIN_SCREEN_WIDTH || iTmp > MAX_SCREEN_WIDTH) {
+	  	/* Ignore */
+		return;
+	}
+	tOptionsTemp.iParagraphBreak = iTmp;
+	vUpdateWriteableNumber(tWindow,
+			CHOICES_BREAK_WRITEABLE,
+			tOptionsTemp.iParagraphBreak);
+} /* end of vChangeParagraphBreak */
+
+/*
+ * vChangeAutofiletype - invert the permission to autofiletype
+ */
+static void
+vChangeAutofiletype(wimp_w tWindow)
+{
+	tOptionsTemp.bAutofiletypeAllowed =
+				!tOptionsTemp.bAutofiletypeAllowed;
+	vUpdateRadioButton(tWindow,
+			CHOICES_AUTOFILETYPE_BUTTON,
+			tOptionsTemp.bAutofiletypeAllowed);
+} /* end of vChangeAutofiletype */
+
+/*
+ * vChangeHiddenText - invert the hide/show hidden text
+ */
+static void
+vChangeHiddenText(wimp_w tWindow)
+{
+	tOptionsTemp.bHideHiddenText = !tOptionsTemp.bHideHiddenText;
+	vUpdateRadioButton(tWindow,
+			CHOICES_HIDDEN_TEXT_BUTTON,
+			tOptionsTemp.bHideHiddenText);
+} /* end of vChangeHiddenText */
+
+/*
+ * vUseFontsImages - use outline fonts, show images
+ */
+static void
+vUseFontsImages(BOOL bUseOutlineFonts, BOOL bShowImages)
+{
+	tOptionsTemp.eConversionType =
+		bUseOutlineFonts ? conversion_draw : conversion_text;
+	tOptionsTemp.eImageLevel =
+		bUseOutlineFonts && bShowImages ?
+		level_default : level_no_images;
+} /* end of vUseFontsImages */
+
+/*
+ * vSetScaleFactor - set the scale factor to the given number
+ */
+static void
+vSetScaleFactor(wimp_w tWindow, int iNumber)
+{
+  	tOptionsTemp.iScaleFactor = iNumber;
+	vUpdateWriteableNumber(tWindow,
+			CHOICES_SCALE_WRITEABLE,
+			tOptionsTemp.iScaleFactor);
+} /* end of vSetScaleFactor */
+
+/*
+ * vChangeScaleFactor - change the scale factor with the given number
+ */
+static void
+vChangeScaleFactor(wimp_w tWindow, int iNumber)
+{
+	int	iTmp;
+
+	iTmp = tOptionsTemp.iScaleFactor + iNumber;
+	if (iTmp < MIN_SCALE_FACTOR || iTmp > MAX_SCALE_FACTOR) {
+	  	/* Ignore */
+		return;
+	}
+	tOptionsTemp.iScaleFactor = iTmp;
+	vUpdateWriteableNumber(tWindow,
+			CHOICES_SCALE_WRITEABLE,
+			tOptionsTemp.iScaleFactor);
+} /* end of vChangeScaleFactor */
+
+/*
+ * bChoicesMouseClick - handle a mouse click in the Choices window
+ */
+void
+vChoicesMouseClick(wimp_mousestr *m)
+{
+	wimp_i	tAction;
+	BOOL	bCloseWindow, bLeft, bRight;
+
+	bLeft = (m->bbits & wimp_BLEFT) == wimp_BLEFT;
+	bRight = (m->bbits & wimp_BRIGHT) == wimp_BRIGHT;
+	if (!bLeft && !bRight) {
+		DBG_HEX(m->bbits);
+		return;
+	}
+
+	/* Which action should be taken */
+	tAction = m->i;
+	if (bRight) {
+	  	/* The right button reverses the direction */
+		switch (m->i) {
+		case CHOICES_BREAK_UP_BUTTON:
+			tAction = CHOICES_BREAK_DOWN_BUTTON;
+			break;
+		case CHOICES_BREAK_DOWN_BUTTON:
+			tAction = CHOICES_BREAK_UP_BUTTON;
+			break;
+		case CHOICES_SCALE_UP_BUTTON:
+			tAction = CHOICES_SCALE_DOWN_BUTTON;
+			break;
+		case CHOICES_SCALE_DOWN_BUTTON:
+			tAction = CHOICES_SCALE_UP_BUTTON;
+			break;
+		default:
+			break;
+		}
+	}
+
+	/* Actions */
+	bCloseWindow = FALSE;
+	switch (tAction) {
+	case CHOICES_DEFAULT_BUTTON:
+		vDefaultButtonAction(m->w);
+		break;
+	case CHOICES_SAVE_BUTTON:
+		vSaveButtonAction();
+		break;
+	case CHOICES_CANCEL_BUTTON:
+		bCloseWindow = TRUE;
+		break;
+	case CHOICES_APPLY_BUTTON:
+		vApplyButtonAction();
+		bCloseWindow = TRUE;
+		break;
+	case CHOICES_BREAK_BUTTON:
+		vSetParagraphBreak(m->w, DEFAULT_SCREEN_WIDTH);
+		break;
+	case CHOICES_BREAK_UP_BUTTON:
+		vChangeParagraphBreak(m->w, 1);
+		break;
+	case CHOICES_BREAK_DOWN_BUTTON:
+		vChangeParagraphBreak(m->w, -1);
+		break;
+	case CHOICES_NO_BREAK_BUTTON:
+		vSetParagraphBreak(m->w, 0);
+		break;
+	case CHOICES_AUTOFILETYPE_BUTTON:
+		vChangeAutofiletype(m->w);
+		break;
+	case CHOICES_HIDDEN_TEXT_BUTTON:
+		vChangeHiddenText(m->w);
+		break;
+	case CHOICES_WITH_IMAGES_BUTTON:
+		vUseFontsImages(TRUE, TRUE);
+		break;
+	case CHOICES_NO_IMAGES_BUTTON:
+		vUseFontsImages(TRUE, FALSE);
+		break;
+	case CHOICES_TEXTONLY_BUTTON:
+		vUseFontsImages(FALSE, FALSE);
+		break;
+	case CHOICES_SCALE_UP_BUTTON:
+		vChangeScaleFactor(m->w, 5);
+		break;
+	case CHOICES_SCALE_DOWN_BUTTON:
+		vChangeScaleFactor(m->w, -5);
+		break;
+	default:
+		DBG_DEC(m->i);
+		break;
+	}
+	if (bCloseWindow) {
+		wimpt_noerr(wimp_close_wind(m->w));
+	}
+} /* end of vChoicesMouseClick */
+
+void
+vChoicesKeyPressed(wimp_caretstr *c)
+{
+	wimp_icon	tIcon;
+	char		*pcChar;
+	int		iNumber;
+
+	DBG_MSG("vChoicesKeyPressed");
+
+	fail(c == NULL);
+
+	wimpt_noerr(wimp_get_icon_info(c->w, c->i, &tIcon));
+	if ((tIcon.flags & (wimp_ITEXT|wimp_INDIRECT)) !=
+	    (wimp_ITEXT|wimp_INDIRECT)) {
+		werr(1, "Icon %d must be indirected text", (int)c->i);
+		return;
+	}
+	iNumber = (int)strtol(tIcon.data.indirecttext.buffer, &pcChar, 10);
+
+	switch(c->i) {
+	case CHOICES_BREAK_WRITEABLE:
+		if (*pcChar != '\0' && *pcChar != '\r') {
+			DBG_DEC(*pcChar);
+			iNumber = DEFAULT_SCREEN_WIDTH;
+		} else if (iNumber < MIN_SCREEN_WIDTH) {
+			iNumber = MIN_SCREEN_WIDTH;
+		} else if (iNumber > MAX_SCREEN_WIDTH) {
+			iNumber = MAX_SCREEN_WIDTH;
+		}
+		vSetParagraphBreak(c->w, iNumber);
+		break;
+	case CHOICES_SCALE_WRITEABLE:
+		if (*pcChar != '\0' && *pcChar != '\r') {
+			DBG_DEC(*pcChar);
+			iNumber = DEFAULT_SCALE_FACTOR;
+		} else if (iNumber < MIN_SCALE_FACTOR) {
+			iNumber = MIN_SCALE_FACTOR;
+		} else if (iNumber > MAX_SCALE_FACTOR) {
+			iNumber = MAX_SCALE_FACTOR;
+		}
+		vSetScaleFactor(c->w, iNumber);
+		break;
+	default:
+		DBG_DEC(c->i);
+		break;
+	}
+} /* end of vChoicesKeyPressed */
+#endif /* __riscos */

+ 670 - 0
sys/src/cmd/aux/antiword/out2window.c

@@ -0,0 +1,670 @@
+/*
+ * out2window.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Output to a text window
+ */
+
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include "antiword.h"
+
+
+/* Used for numbering the chapters */
+static unsigned int	auiHdrCounter[9];
+
+
+/*
+ * vString2Diagram - put a string into a diagram
+ */
+static void
+vString2Diagram(diagram_type *pDiag, output_type *pAnchor)
+{
+	output_type	*pOutput;
+	long		lWidth;
+	USHORT		usMaxFontSize;
+
+	fail(pDiag == NULL);
+	fail(pAnchor == NULL);
+
+	/* Compute the maximum fontsize in this string */
+	usMaxFontSize = MIN_FONT_SIZE;
+	for (pOutput = pAnchor; pOutput != NULL; pOutput = pOutput->pNext) {
+		if (pOutput->usFontSize > usMaxFontSize) {
+			usMaxFontSize = pOutput->usFontSize;
+		}
+	}
+
+	/* Goto the next line */
+	vMove2NextLine(pDiag, pAnchor->tFontRef, usMaxFontSize);
+
+	/* Output all substrings */
+	for (pOutput = pAnchor; pOutput != NULL; pOutput = pOutput->pNext) {
+		lWidth = lMilliPoints2DrawUnits(pOutput->lStringWidth);
+		vSubstring2Diagram(pDiag, pOutput->szStorage,
+			pOutput->tNextFree, lWidth, pOutput->ucFontColor,
+			pOutput->usFontStyle, pOutput->tFontRef,
+			pOutput->usFontSize, usMaxFontSize);
+	}
+
+	/* Goto the start of the line */
+	pDiag->lXleft = 0;
+} /* end of vString2Diagram */
+
+/*
+ * vSetLeftIndentation - set the left indentation of the specified diagram
+ */
+void
+vSetLeftIndentation(diagram_type *pDiag, long lLeftIndentation)
+{
+	long	lX;
+
+	fail(pDiag == NULL);
+	fail(lLeftIndentation < 0);
+
+	lX = lMilliPoints2DrawUnits(lLeftIndentation);
+	if (lX > 0) {
+		pDiag->lXleft = lX;
+	} else {
+		pDiag->lXleft = 0;
+	}
+} /* end of vSetLeftIndentation */
+
+/*
+ * lComputeNetWidth - compute the net string width
+ */
+static long
+lComputeNetWidth(output_type *pAnchor)
+{
+	output_type	*pTmp;
+	long		lNetWidth;
+
+	fail(pAnchor == NULL);
+
+	/* Step 1: Count all but the last sub-string */
+	lNetWidth = 0;
+	for (pTmp = pAnchor; pTmp->pNext != NULL; pTmp = pTmp->pNext) {
+		fail(pTmp->lStringWidth < 0);
+		lNetWidth += pTmp->lStringWidth;
+	}
+	fail(pTmp == NULL);
+	fail(pTmp->pNext != NULL);
+
+	/* Step 2: remove the white-space from the end of the string */
+	while (pTmp->tNextFree != 0 &&
+	       isspace((int)(UCHAR)pTmp->szStorage[pTmp->tNextFree - 1])) {
+		pTmp->szStorage[pTmp->tNextFree - 1] = '\0';
+		pTmp->tNextFree--;
+		NO_DBG_DEC(pTmp->lStringWidth);
+		pTmp->lStringWidth = lComputeStringWidth(
+						pTmp->szStorage,
+						pTmp->tNextFree,
+						pTmp->tFontRef,
+						pTmp->usFontSize);
+		NO_DBG_DEC(pTmp->lStringWidth);
+	}
+
+	/* Step 3: Count the last sub-string */
+	lNetWidth += pTmp->lStringWidth;
+	return lNetWidth;
+} /* end of lComputeNetWidth */
+
+/*
+ * iComputeHoles - compute number of holes
+ * (A hole is a number of whitespace characters followed by a
+ *  non-whitespace character)
+ */
+static int
+iComputeHoles(output_type *pAnchor)
+{
+	output_type	*pTmp;
+	size_t	tIndex;
+	int	iCounter;
+	BOOL	bWasSpace, bIsSpace;
+
+	fail(pAnchor == NULL);
+
+	iCounter = 0;
+	bIsSpace = FALSE;
+	/* Count the holes */
+	for (pTmp = pAnchor; pTmp != NULL; pTmp = pTmp->pNext) {
+		fail(pTmp->tNextFree != strlen(pTmp->szStorage));
+		for (tIndex = 0; tIndex <= pTmp->tNextFree; tIndex++) {
+			bWasSpace = bIsSpace;
+			bIsSpace = isspace((int)(UCHAR)pTmp->szStorage[tIndex]);
+			if (bWasSpace && !bIsSpace) {
+				iCounter++;
+			}
+		}
+	}
+	return iCounter;
+} /* end of iComputeHoles */
+
+/*
+ * Align a string and insert it into the text
+ */
+void
+vAlign2Window(diagram_type *pDiag, output_type *pAnchor,
+	long lScreenWidth, UCHAR ucAlignment)
+{
+	long	lNetWidth, lLeftIndentation;
+
+	fail(pDiag == NULL || pAnchor == NULL);
+	fail(lScreenWidth < lChar2MilliPoints(MIN_SCREEN_WIDTH));
+
+	NO_DBG_MSG("vAlign2Window");
+
+	lNetWidth = lComputeNetWidth(pAnchor);
+
+	if (lScreenWidth > lChar2MilliPoints(MAX_SCREEN_WIDTH) ||
+	    lNetWidth <= 0) {
+		/*
+		 * Screenwidth is "infinite", so no alignment is possible
+		 * Don't bother to align an empty line
+		 */
+		vString2Diagram(pDiag, pAnchor);
+		return;
+	}
+
+	switch (ucAlignment) {
+	case ALIGNMENT_CENTER:
+		lLeftIndentation = (lScreenWidth - lNetWidth) / 2;
+		DBG_DEC_C(lLeftIndentation < 0, lLeftIndentation);
+		if (lLeftIndentation > 0) {
+			vSetLeftIndentation(pDiag, lLeftIndentation);
+		}
+		break;
+	case ALIGNMENT_RIGHT:
+		lLeftIndentation = lScreenWidth - lNetWidth;
+		DBG_DEC_C(lLeftIndentation < 0, lLeftIndentation);
+		if (lLeftIndentation > 0) {
+			vSetLeftIndentation(pDiag, lLeftIndentation);
+		}
+		break;
+	case ALIGNMENT_JUSTIFY:
+	case ALIGNMENT_LEFT:
+	default:
+		break;
+	}
+	vString2Diagram(pDiag, pAnchor);
+} /* end of vAlign2Window */
+
+/*
+ * vJustify2Window
+ */
+void
+vJustify2Window(diagram_type *pDiag, output_type *pAnchor,
+	long lScreenWidth, long lRightIndentation, UCHAR ucAlignment)
+{
+	output_type	*pTmp;
+	char	*pcNew, *pcOld, *szStorage;
+	long	lNetWidth, lSpaceWidth, lToAdd;
+	int	iFillerLen, iHoles;
+
+	fail(pDiag == NULL || pAnchor == NULL);
+	fail(lScreenWidth < MIN_SCREEN_WIDTH);
+	fail(lRightIndentation > 0);
+
+	NO_DBG_MSG("vJustify2Window");
+
+	if (ucAlignment != ALIGNMENT_JUSTIFY) {
+		vAlign2Window(pDiag, pAnchor, lScreenWidth, ucAlignment);
+		return;
+	}
+
+	lNetWidth = lComputeNetWidth(pAnchor);
+
+	if (lScreenWidth > lChar2MilliPoints(MAX_SCREEN_WIDTH) ||
+	    lNetWidth <= 0) {
+		/*
+		 * Screenwidth is "infinite", so justify is not possible
+		 * Don't bother to align an empty line
+		 */
+		vString2Diagram(pDiag, pAnchor);
+		return;
+	}
+
+	/* Justify */
+	fail(ucAlignment != ALIGNMENT_JUSTIFY);
+	lSpaceWidth = lComputeStringWidth(" ", 1,
+				pAnchor->tFontRef, pAnchor->usFontSize);
+	lToAdd = lScreenWidth -
+			lNetWidth -
+			lDrawUnits2MilliPoints(pDiag->lXleft) +
+			lRightIndentation;
+#if defined(DEBUG)
+	if (lToAdd / lSpaceWidth < -1) {
+		DBG_DEC(lSpaceWidth);
+		DBG_DEC(lToAdd);
+		DBG_DEC(lScreenWidth);
+		DBG_DEC(lNetWidth);
+		DBG_DEC(lDrawUnits2MilliPoints(pDiag->lXleft));
+		DBG_DEC(pDiag->lXleft);
+		DBG_DEC(lRightIndentation);
+	}
+#endif /* DEBUG */
+	lToAdd /= lSpaceWidth;
+	DBG_DEC_C(lToAdd < 0, lToAdd);
+	if (lToAdd <= 0) {
+		vString2Diagram(pDiag, pAnchor);
+		return;
+	}
+
+	iHoles = iComputeHoles(pAnchor);
+	/* Justify by adding spaces */
+	for (pTmp = pAnchor; pTmp != NULL; pTmp = pTmp->pNext) {
+		fail(pTmp->tNextFree != strlen(pTmp->szStorage));
+		fail(lToAdd < 0);
+		szStorage = xmalloc(pTmp->tNextFree + (size_t)lToAdd + 1);
+		pcNew = szStorage;
+		for (pcOld = pTmp->szStorage; *pcOld != '\0'; pcOld++) {
+			*pcNew++ = *pcOld;
+			if (*pcOld == ' ' &&
+			    *(pcOld + 1) != ' ' &&
+			    iHoles > 0) {
+				iFillerLen = (int)(lToAdd / iHoles);
+				lToAdd -= iFillerLen;
+				iHoles--;
+				for (; iFillerLen > 0; iFillerLen--) {
+					*pcNew++ = ' ';
+				}
+			}
+		}
+		*pcNew = '\0';
+		pTmp->szStorage = xfree(pTmp->szStorage);
+		pTmp->szStorage = szStorage;
+		pTmp->tStorageSize = pTmp->tNextFree + (size_t)lToAdd + 1;
+		pTmp->lStringWidth +=
+			(pcNew - szStorage - (long)pTmp->tNextFree) *
+			lSpaceWidth;
+		fail(pcNew < szStorage);
+		pTmp->tNextFree = (size_t)(pcNew - szStorage);
+		fail(pTmp->tNextFree != strlen(pTmp->szStorage));
+	}
+	DBG_DEC_C(lToAdd != 0, lToAdd);
+	vString2Diagram(pDiag, pAnchor);
+} /* end of vJustify2Window */
+
+/*
+ * vResetStyles - reset the style information variables
+ */
+void
+vResetStyles(void)
+{
+	(void)memset(auiHdrCounter, 0, sizeof(auiHdrCounter));
+} /* end of vResetStyles */
+
+/*
+ * Add the style characters to the line
+ *
+ * Returns the length of the resulting string
+ */
+size_t
+tStyle2Window(char *szLine, const style_block_type *pStyle,
+	const section_block_type *pSection)
+{
+	char	*pcTxt;
+	int	iIndex;
+	BOOL	bNeedPrevLvl;
+	level_type_enum	eNumType;
+	USHORT	usStyleIndex;
+	UCHAR	ucNFC;
+
+	fail(szLine == NULL || pStyle == NULL || pSection == NULL);
+
+	if (pStyle->usIstd == 0 || pStyle->usIstd > 9) {
+		szLine[0] = '\0';
+		return 0;
+	}
+
+	usStyleIndex = pStyle->usIstd - 1;
+	/* Set the numbers */
+	for (iIndex = 0; iIndex < 9; iIndex++) {
+		if (iIndex == (int)usStyleIndex) {
+			auiHdrCounter[iIndex]++;
+		} else if (iIndex > (int)usStyleIndex) {
+			auiHdrCounter[iIndex] = 0;
+		} else if (auiHdrCounter[iIndex] == 0) {
+			auiHdrCounter[iIndex] = 1;
+		}
+	}
+
+	eNumType = eGetNumType(pStyle->ucNumLevel);
+	if (eNumType != level_type_outline) {
+		szLine[0] = '\0';
+		return 0;
+	}
+
+	pcTxt = szLine;
+	bNeedPrevLvl = (pSection->usNeedPrevLvl & BIT(usStyleIndex)) != 0;
+	/* Print the numbers */
+	for (iIndex = 0; iIndex <= (int)usStyleIndex; iIndex++) {
+		if (iIndex == (int)usStyleIndex ||
+		    (bNeedPrevLvl && iIndex < (int)usStyleIndex)) {
+			ucNFC = pSection->aucNFC[iIndex];
+			switch(ucNFC) {
+			case LIST_ARABIC_NUM:
+				pcTxt += sprintf(pcTxt, "%u",
+					auiHdrCounter[iIndex]);
+				break;
+			case LIST_UPPER_ROMAN:
+			case LIST_LOWER_ROMAN:
+				pcTxt += tNumber2Roman(
+					auiHdrCounter[iIndex],
+					ucNFC == LIST_UPPER_ROMAN,
+					pcTxt);
+				break;
+			case LIST_UPPER_ALPHA:
+			case LIST_LOWER_ALPHA:
+				pcTxt += tNumber2Alpha(
+					auiHdrCounter[iIndex],
+					ucNFC == LIST_UPPER_ALPHA,
+					pcTxt);
+				break;
+			default:
+				DBG_DEC(ucNFC);
+				DBG_FIXME();
+				pcTxt += sprintf(pcTxt, "%u",
+					auiHdrCounter[iIndex]);
+				break;
+			}
+			if (iIndex < (int)usStyleIndex) {
+				*pcTxt++ = '.';
+			} else if (iIndex == (int)usStyleIndex) {
+				*pcTxt++ = ' ';
+			}
+		}
+	}
+	*pcTxt = '\0';
+	NO_DBG_MSG_C((int)pStyle->usIstd >= 1 &&
+		(int)pStyle->usIstd <= 9 &&
+		eNumType != level_type_none &&
+		eNumType != level_type_outline, szLine);
+	NO_DBG_MSG_C(szLine[0] != '\0', szLine);
+	fail(pcTxt < szLine);
+	return (size_t)(pcTxt - szLine);
+} /* end of tStyle2Window */
+
+/*
+ * vRemoveRowEnd - remove the end of table row indicator
+ *
+ * Remove the double TABLE_SEPARATOR characters from the end of the string.
+ * Special: remove the TABLE_SEPARATOR, 0x0a sequence
+ */
+static void
+vRemoveRowEnd(char *szRowTxt)
+{
+	int	iLastIndex;
+
+	fail(szRowTxt == NULL || szRowTxt[0] == '\0');
+
+	iLastIndex = (int)strlen(szRowTxt) - 1;
+
+	if (szRowTxt[iLastIndex] == TABLE_SEPARATOR ||
+	    szRowTxt[iLastIndex] == '\n') {
+		szRowTxt[iLastIndex] = '\0';
+		iLastIndex--;
+	} else {
+		DBG_HEX(szRowTxt[iLastIndex]);
+	}
+
+	if (iLastIndex >= 0 && szRowTxt[iLastIndex] == '\n') {
+		szRowTxt[iLastIndex] = '\0';
+		iLastIndex--;
+	}
+
+	if (iLastIndex >= 0 && szRowTxt[iLastIndex] == TABLE_SEPARATOR) {
+		szRowTxt[iLastIndex] = '\0';
+		return;
+	}
+
+	DBG_DEC(iLastIndex);
+	DBG_HEX(szRowTxt[iLastIndex]);
+	DBG_MSG(szRowTxt);
+} /* end of vRemoveRowEnd */
+
+/*
+ * tComputeStringLengthMax - max string length in relation to max column width
+ *
+ * Return the maximum string length
+ */
+static size_t
+tComputeStringLengthMax(const char *szString, size_t tColumnWidthMax)
+{
+	const char	*pcTmp;
+	size_t	tLengthMax, tLenPrev, tLen, tWidth;
+
+	fail(szString == NULL);
+	fail(tColumnWidthMax == 0);
+
+	pcTmp = strchr(szString, '\n');
+	if (pcTmp != NULL) {
+		tLengthMax = (size_t)(pcTmp - szString + 1);
+	} else {
+		tLengthMax = strlen(szString);
+	}
+	if (tLengthMax == 0) {
+		return 0;
+	}
+
+	tLen = 0;
+	tWidth = 0;
+	for (;;) {
+		tLenPrev = tLen;
+		tLen += tGetCharacterLength(szString + tLen);
+		DBG_DEC_C(tLen > tLengthMax, tLen);
+		DBG_DEC_C(tLen > tLengthMax, tLengthMax);
+		fail(tLen > tLengthMax);
+		tWidth = tCountColumns(szString, tLen);
+		if (tWidth > tColumnWidthMax) {
+			return tLenPrev;
+		}
+		if (tLen >= tLengthMax) {
+			return tLengthMax;
+		}
+	}
+} /* end of tComputeStringLengthMax */
+
+/*
+ * tGetBreakingPoint - get the number of bytes that fit the column
+ *
+ * Returns the number of bytes that fit the column
+ */
+static size_t
+tGetBreakingPoint(const char *szString,
+	size_t tLen, size_t tWidth, size_t tColumnWidthMax)
+{
+	int	iIndex;
+
+	fail(szString == NULL);
+	fail(tLen > strlen(szString));
+	fail(tWidth > tColumnWidthMax);
+
+	if (tWidth < tColumnWidthMax ||
+	    (tWidth == tColumnWidthMax &&
+	     (szString[tLen] == ' ' ||
+	      szString[tLen] == '\n' ||
+	      szString[tLen] == '\0'))) {
+		/* The string already fits, do nothing */
+		return tLen;
+	}
+	/* Search for a breaking point */
+	for (iIndex = (int)tLen - 1; iIndex >= 0; iIndex--) {
+		if (szString[iIndex] == ' ') {
+			return (size_t)iIndex;
+		}
+	}
+	/* No breaking point found, just fill the column */
+	return tLen;
+} /* end of tGetBreakingPoint */
+
+/*
+ * vTableRow2Window - put a table row into a diagram
+ */
+void
+vTableRow2Window(diagram_type *pDiag, output_type *pOutput,
+		const row_block_type *pRowInfo)
+{
+	output_type	tRow;
+	char	*aszColTxt[TABLE_COLUMN_MAX];
+	char	*szLine, *pcTxt;
+	long	lCharWidthLarge, lCharWidthSmall;
+	size_t	tSize, tColumnWidthMax, tWidth, tLen;
+	int	iIndex, iNbrOfColumns, iTmp;
+	BOOL	bNotReady;
+
+	fail(pDiag == NULL || pOutput == NULL || pRowInfo == NULL);
+	fail(pOutput->szStorage == NULL);
+	fail(pOutput->pNext != NULL);
+
+	/* Character sizes */
+	lCharWidthLarge = lComputeStringWidth("W", 1,
+				pOutput->tFontRef, pOutput->usFontSize);
+	NO_DBG_DEC(lCharWidthLarge);
+	lCharWidthSmall = lComputeStringWidth("i", 1,
+				pOutput->tFontRef, pOutput->usFontSize);
+	NO_DBG_DEC(lCharWidthSmall);
+	/* For the time being: use a fixed width font */
+	fail(lCharWidthLarge != lCharWidthSmall);
+
+	vRemoveRowEnd(pOutput->szStorage);
+
+	/* Split the row text into a set of column texts */
+	aszColTxt[0] = pOutput->szStorage;
+	for (iNbrOfColumns = 1;
+	     iNbrOfColumns < TABLE_COLUMN_MAX;
+	     iNbrOfColumns++) {
+		aszColTxt[iNbrOfColumns] =
+				strchr(aszColTxt[iNbrOfColumns - 1],
+					TABLE_SEPARATOR);
+		if (aszColTxt[iNbrOfColumns] == NULL) {
+			break;
+		}
+		*aszColTxt[iNbrOfColumns] = '\0';
+		aszColTxt[iNbrOfColumns]++;
+		NO_DBG_DEC(iNbrOfColumns);
+		NO_DBG_MSG(aszColTxt[iNbrOfColumns]);
+	}
+
+	DBG_DEC_C(iNbrOfColumns != (int)pRowInfo->ucNumberOfColumns,
+		iNbrOfColumns);
+	DBG_DEC_C(iNbrOfColumns != (int)pRowInfo->ucNumberOfColumns,
+		pRowInfo->ucNumberOfColumns);
+	if (iNbrOfColumns != (int)pRowInfo->ucNumberOfColumns) {
+		werr(0, "Skipping an unmatched table row");
+		return;
+	}
+
+	if (bAddTableRow(pDiag, aszColTxt, iNbrOfColumns,
+			pRowInfo->asColumnWidth, pRowInfo->ucBorderInfo)) {
+		/* All work has been done */
+		return;
+	}
+
+	/*
+	 * Get enough space for the row.
+	 * Worst case: three bytes per UTF-8 character
+	 */
+	tSize = 3 * (size_t)(lTwips2MilliPoints(pRowInfo->iColumnWidthSum) /
+				lCharWidthSmall +
+				(long)pRowInfo->ucNumberOfColumns + 3);
+	szLine = xmalloc(tSize);
+
+	do {
+		/* Print one line of a table row */
+		bNotReady = FALSE;
+		pcTxt = szLine;
+		*pcTxt++ = TABLE_SEPARATOR_CHAR;
+		for (iIndex = 0; iIndex < iNbrOfColumns; iIndex++) {
+			tColumnWidthMax =
+				(size_t)(lTwips2MilliPoints(
+					pRowInfo->asColumnWidth[iIndex]) /
+					lCharWidthLarge);
+			if (tColumnWidthMax == 0) {
+				/* Minimum column width */
+				tColumnWidthMax = 1;
+			} else if (tColumnWidthMax > 1) {
+				/* Make room for the TABLE_SEPARATOR_CHAR */
+				tColumnWidthMax--;
+			}
+			NO_DBG_DEC(tColumnWidthMax);
+			if (aszColTxt[iIndex] == NULL) {
+				/* Add an empty column */
+				for (iTmp = 0;
+				     iTmp < (int)tColumnWidthMax;
+				     iTmp++) {
+					*pcTxt++ = (char)FILLER_CHAR;
+				}
+				*pcTxt++ = TABLE_SEPARATOR_CHAR;
+				*pcTxt = '\0';
+				continue;
+			}
+			/* Compute the length and width of the column text */
+			tLen = tComputeStringLengthMax(
+					aszColTxt[iIndex], tColumnWidthMax);
+			NO_DBG_DEC(tLen);
+			while (tLen != 0 &&
+					(aszColTxt[iIndex][tLen - 1] == '\n' ||
+					 aszColTxt[iIndex][tLen - 1] == ' ')) {
+				aszColTxt[iIndex][tLen - 1] = ' ';
+				tLen--;
+			}
+			tWidth = tCountColumns(aszColTxt[iIndex], tLen);
+			fail(tWidth > tColumnWidthMax);
+			tLen = tGetBreakingPoint(aszColTxt[iIndex],
+					tLen, tWidth, tColumnWidthMax);
+			tWidth = tCountColumns(aszColTxt[iIndex], tLen);
+			if (tLen == 0 && *aszColTxt[iIndex] == '\0') {
+				/* No text at all */
+				aszColTxt[iIndex] = NULL;
+			} else {
+				/* Add the text */
+				pcTxt += sprintf(pcTxt,
+					"%.*s", (int)tLen, aszColTxt[iIndex]);
+				if (tLen == 0 && *aszColTxt[iIndex] != ' ') {
+					tLen = tGetCharacterLength(
+							aszColTxt[iIndex]);
+					DBG_CHR(*aszColTxt[iIndex]);
+					DBG_FIXME();
+					fail(tLen == 0);
+				}
+				aszColTxt[iIndex] += tLen;
+				while (*aszColTxt[iIndex] == ' ') {
+					aszColTxt[iIndex]++;
+				}
+				if (*aszColTxt[iIndex] == '\0') {
+					/* This row is now complete */
+					aszColTxt[iIndex] = NULL;
+				} else {
+					/* This row needs more lines */
+					bNotReady = TRUE;
+				}
+			}
+			/* Fill up the rest */
+			for (iTmp = 0;
+			     iTmp < (int)tColumnWidthMax - (int)tWidth;
+			     iTmp++) {
+				*pcTxt++ = (char)FILLER_CHAR;
+			}
+			/* End of column */
+			*pcTxt++ = TABLE_SEPARATOR_CHAR;
+			*pcTxt = '\0';
+		}
+		/* Output the table row line */
+		*pcTxt = '\0';
+		tRow = *pOutput;
+		tRow.szStorage = szLine;
+		fail(pcTxt < szLine);
+		tRow.tNextFree = (size_t)(pcTxt - szLine);
+		tRow.lStringWidth = lComputeStringWidth(
+					tRow.szStorage,
+					tRow.tNextFree,
+					tRow.tFontRef,
+					tRow.usFontSize);
+		vString2Diagram(pDiag, &tRow);
+	} while (bNotReady);
+	/* Clean up before you leave */
+	szLine = xfree(szLine);
+} /* end of vTableRow2Window */

+ 466 - 0
sys/src/cmd/aux/antiword/output.c

@@ -0,0 +1,466 @@
+/*
+ * output.c
+ * Copyright (C) 2002,2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Generic output generating functions
+ */
+
+#include "antiword.h"
+
+static conversion_type	eConversionType = conversion_unknown;
+static encoding_type	eEncoding = encoding_neutral;
+
+
+/*
+ * vPrologue1 - get options and call a specific initialization
+ */
+static void
+vPrologue1(diagram_type *pDiag, const char *szTask, const char *szFilename)
+{
+	options_type	tOptions;
+
+	fail(pDiag == NULL);
+	fail(szTask == NULL || szTask[0] == '\0');
+
+	vGetOptions(&tOptions);
+	eConversionType = tOptions.eConversionType;
+	eEncoding = tOptions.eEncoding;
+
+	switch (eConversionType) {
+	case conversion_text:
+		vPrologueTXT(pDiag, &tOptions);
+		break;
+	case conversion_ps:
+		vProloguePS(pDiag, szTask, szFilename, &tOptions);
+		break;
+	case conversion_xml:
+		vPrologueXML(pDiag);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vPrologue1 */
+
+/*
+ * vEpilogue - clean up after everything is done
+ */
+static void
+vEpilogue(diagram_type *pDiag)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		vEpilogueTXT(pDiag->pOutFile);
+		break;
+	case conversion_ps:
+		vEpiloguePS(pDiag);
+		break;
+	case conversion_xml:
+		vEpilogueXML(pDiag);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vEpilogue */
+
+/*
+ * vImagePrologue - perform image initialization
+ */
+void
+vImagePrologue(diagram_type *pDiag, const imagedata_type *pImg)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		vImageProloguePS(pDiag, pImg);
+		break;
+	case conversion_xml:
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vImagePrologue */
+
+/*
+ * vImageEpilogue - clean up an image
+ */
+void
+vImageEpilogue(diagram_type *pDiag)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		vImageEpiloguePS(pDiag);
+		break;
+	case conversion_xml:
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vImageEpilogue */
+
+/*
+ * bAddDummyImage - add a dummy image
+ *
+ * return TRUE when successful, otherwise FALSE
+ */
+BOOL
+bAddDummyImage(diagram_type *pDiag, const imagedata_type *pImg)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		return FALSE;
+	case conversion_ps:
+		return bAddDummyImagePS(pDiag, pImg);
+	case conversion_xml:
+		return FALSE;
+	default:
+		DBG_DEC(eConversionType);
+		return FALSE;
+	}
+} /* end of bAddDummyImage */
+
+/*
+ * pCreateDiagram - create and initialize a diagram
+ *
+ * remark: does not return if the diagram can't be created
+ */
+diagram_type *
+pCreateDiagram(const char *szTask, const char *szFilename)
+{
+	diagram_type	*pDiag;
+
+	fail(szTask == NULL || szTask[0] == '\0');
+	DBG_MSG("pCreateDiagram");
+
+	/* Get the necessary memory */
+	pDiag = xmalloc(sizeof(diagram_type));
+	/* Initialization */
+	pDiag->pOutFile = stdout;
+	vPrologue1(pDiag, szTask, szFilename);
+	/* Return success */
+	return pDiag;
+} /* end of pCreateDiagram */
+
+/*
+ * vDestroyDiagram - remove a diagram by freeing the memory it uses
+ */
+void
+vDestroyDiagram(diagram_type *pDiag)
+{
+	DBG_MSG("vDestroyDiagram");
+
+	fail(pDiag == NULL);
+
+	if (pDiag == NULL) {
+		return;
+	}
+	vEpilogue(pDiag);
+	pDiag = xfree(pDiag);
+} /* end of vDestroyDiagram */
+
+/*
+ * vPrologue2 - call a specific initialization
+ */
+void
+vPrologue2(diagram_type *pDiag, int iWordVersion)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		vAddFontsPS(pDiag);
+		break;
+	case conversion_xml:
+		vCreateBookIntro(pDiag, iWordVersion, eEncoding);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vPrologue2 */
+
+/*
+ * vMove2NextLine - move to the next line
+ */
+void
+vMove2NextLine(diagram_type *pDiag, draw_fontref tFontRef, USHORT usFontSize)
+{
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+
+	switch (eConversionType) {
+	case conversion_text:
+		vMove2NextLineTXT(pDiag);
+		break;
+	case conversion_ps:
+		vMove2NextLinePS(pDiag, usFontSize);
+		break;
+	case conversion_xml:
+		vMove2NextLineXML(pDiag);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vMove2NextLine */
+
+/*
+ * vSubstring2Diagram - put a sub string into a diagram
+ */
+void
+vSubstring2Diagram(diagram_type *pDiag,
+	char *szString, size_t tStringLength, long lStringWidth,
+	UCHAR ucFontColor, USHORT usFontstyle, draw_fontref tFontRef,
+	USHORT usFontSize, USHORT usMaxFontSize)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		vSubstringTXT(pDiag, szString, tStringLength, lStringWidth);
+		break;
+	case conversion_ps:
+		vSubstringPS(pDiag, szString, tStringLength, lStringWidth,
+				ucFontColor, usFontstyle, tFontRef,
+				usFontSize, usMaxFontSize);
+		break;
+	case conversion_xml:
+		vSubstringXML(pDiag, szString, tStringLength, lStringWidth,
+				usFontstyle);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+	pDiag->lXleft += lStringWidth;
+} /* end of vSubstring2Diagram */
+
+/*
+ * Create a start of paragraph (phase 1)
+ * Before indentation, list numbering, bullets etc.
+ */
+void
+vStartOfParagraph1(diagram_type *pDiag, long lBeforeIndentation)
+{
+	fail(pDiag == NULL);
+
+	switch (eConversionType) {
+	case conversion_text:
+		vStartOfParagraphTXT(pDiag, lBeforeIndentation);
+		break;
+	case conversion_ps:
+		vStartOfParagraphPS(pDiag, lBeforeIndentation);
+		break;
+	case conversion_xml:
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vStartOfParagraph1 */
+
+/*
+ * Create a start of paragraph (phase 2)
+ * After indentation, list numbering, bullets etc.
+ */
+void
+vStartOfParagraph2(diagram_type *pDiag)
+{
+	fail(pDiag == NULL);
+
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vStartOfParagraphXML(pDiag, 1);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vStartOfParagraph2 */
+
+/*
+ * Create an end of paragraph
+ */
+void
+vEndOfParagraph(diagram_type *pDiag,
+	draw_fontref tFontRef, USHORT usFontSize, long lAfterIndentation)
+{
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+	fail(lAfterIndentation < 0);
+
+	switch (eConversionType) {
+	case conversion_text:
+		vEndOfParagraphTXT(pDiag, lAfterIndentation);
+		break;
+	case conversion_ps:
+		vEndOfParagraphPS(pDiag,
+				tFontRef, usFontSize, lAfterIndentation);
+		break;
+	case conversion_xml:
+		vEndOfParagraphXML(pDiag, 1);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vEndOfParagraph */
+
+/*
+ * Create an end of page
+ */
+void
+vEndOfPage(diagram_type *pDiag, long lAfterIndentation)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		vEndOfPageTXT(pDiag, lAfterIndentation);
+		break;
+	case conversion_ps:
+		vEndOfPagePS(pDiag);
+		break;
+	case conversion_xml:
+		vEndOfPageXML(pDiag);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vEndOfPage */
+
+/*
+ * vSetHeaders - set the headers
+ */
+void
+vSetHeaders(diagram_type *pDiag, USHORT usIstd)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vSetHeadersXML(pDiag, usIstd);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vSetHeaders */
+
+/*
+ * Create a start of list
+ */
+void
+vStartOfList(diagram_type *pDiag, UCHAR ucNFC, BOOL bIsEndOfTable)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vStartOfListXML(pDiag, ucNFC, bIsEndOfTable);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vStartOfList */
+
+/*
+ * Create an end of list
+ */
+void
+vEndOfList(diagram_type *pDiag)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vEndOfListXML(pDiag);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vEndOfList */
+
+/*
+ * Create a start of a list item
+ */
+void
+vStartOfListItem(diagram_type *pDiag, BOOL bNoMarks)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vStartOfListItemXML(pDiag, bNoMarks);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vStartOfListItem */
+
+/*
+ * Create an end of a table
+ */
+void
+vEndOfTable(diagram_type *pDiag)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vEndOfTableXML(pDiag);
+		break;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+} /* end of vEndOfTable */
+
+/*
+ * Add a table row
+ *
+ * Returns TRUE when conversion type is XML
+ */
+BOOL
+bAddTableRow(diagram_type *pDiag, char **aszColTxt,
+	int iNbrOfColumns, const short *asColumnWidth, UCHAR ucBorderInfo)
+{
+	switch (eConversionType) {
+	case conversion_text:
+		break;
+	case conversion_ps:
+		break;
+	case conversion_xml:
+		vAddTableRowXML(pDiag, aszColTxt,
+				iNbrOfColumns, asColumnWidth,
+				ucBorderInfo);
+		return TRUE;
+	default:
+		DBG_DEC(eConversionType);
+		break;
+	}
+	return FALSE;
+} /* end of bAddTableRow */

+ 100 - 0
sys/src/cmd/aux/antiword/pictlist.c

@@ -0,0 +1,100 @@
+/*
+ * pictlist.c
+ * Copyright (C) 2000,2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy a list of Word picture information
+ */
+
+#include <stdlib.h>
+#include "antiword.h"
+
+
+/* Variables needed to write the Picture Information List */
+static picture_desc_type	*pAnchor = NULL;
+static picture_desc_type	*pPictureLast = NULL;
+
+
+/*
+ * vDestroyPictInfoList - destroy the Picture Information List
+ */
+void
+vDestroyPictInfoList(void)
+{
+	picture_desc_type	*pCurr, *pNext;
+
+	DBG_MSG("vDestroyPictInfoList");
+
+	/* Free the Picture Information List */
+	pCurr = pAnchor;
+	while (pCurr != NULL) {
+		pNext = pCurr->pNext;
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+	}
+	pAnchor = NULL;
+	/* Reset all control variables */
+	pPictureLast = NULL;
+} /* end of vDestroyPictInfoList */
+
+/*
+ * vAdd2PictInfoList - Add an element to the Picture Information List
+ */
+void
+vAdd2PictInfoList(const picture_block_type *pPictureBlock)
+{
+	picture_desc_type	*pListMember;
+
+	fail(pPictureBlock == NULL);
+
+	NO_DBG_MSG("bAdd2PictInfoList");
+
+	if (pPictureBlock->ulFileOffset == FC_INVALID) {
+		/*
+		 * This offset is really past the end of the file,
+		 * so don't waste any memory by storing it.
+		 */
+		return;
+	}
+	if (pPictureBlock->ulFileOffsetPicture == FC_INVALID) {
+		/*
+		 * The place where this picture is supposed to be stored
+		 * doesn't exist.
+		 */
+		return;
+	}
+
+	NO_DBG_HEX(pPictureBlock->ulFileOffset);
+	NO_DBG_HEX(pPictureBlock->ulFileOffsetPicture);
+	NO_DBG_HEX(pPictureBlock->ulPictureOffset);
+
+	/* Create list member */
+	pListMember = xmalloc(sizeof(picture_desc_type));
+	/* Fill the list member */
+	pListMember->tInfo = *pPictureBlock;
+	pListMember->pNext = NULL;
+	/* Add the new member to the list */
+	if (pAnchor == NULL) {
+		pAnchor = pListMember;
+	} else {
+		fail(pPictureLast == NULL);
+		pPictureLast->pNext = pListMember;
+	}
+	pPictureLast = pListMember;
+} /* end of vAdd2PictInfoList */
+
+/*
+ * Get the info with the given file offset from the Picture Information List
+ */
+ULONG
+ulGetPictInfoListItem(ULONG ulFileOffset)
+{
+	picture_desc_type	*pCurr;
+
+	for (pCurr = pAnchor; pCurr != NULL; pCurr = pCurr->pNext) {
+		if (pCurr->tInfo.ulFileOffset == ulFileOffset) {
+			return pCurr->tInfo.ulFileOffsetPicture;
+		}
+	}
+	return FC_INVALID;
+} /* end of ulGetPictInfoListItem */

+ 191 - 0
sys/src/cmd/aux/antiword/png2eps.c

@@ -0,0 +1,191 @@
+/*
+ * png2eps.c
+ * Copyright (C) 2000-2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to translate png images into eps
+ *
+ */
+
+#include <stdio.h>
+#include <ctype.h>
+#include "antiword.h"
+
+#if defined(DEBUG)
+static int	iPicCounter = 0;
+#endif /* DEBUG */
+
+
+/*
+ * tSkipToData - skip until a IDAT chunk is found
+ *
+ * returns the length of the pixeldata or -1 in case of error
+ */
+static size_t
+tSkipToData(FILE *pFile, size_t tMaxBytes, size_t *ptSkipped)
+{
+	ULONG	ulName, ulTmp;
+	size_t	tDataLength, tToSkip;
+	int	iCounter;
+
+	fail(pFile == NULL);
+	fail(ptSkipped == NULL);
+
+	/* Examine chunks */
+	while (*ptSkipped + 8 < tMaxBytes) {
+		tDataLength = (size_t)ulNextLongBE(pFile);
+		DBG_DEC(tDataLength);
+		*ptSkipped += 4;
+
+		ulName = 0x00;
+		for (iCounter = 0; iCounter < 4; iCounter++) {
+			ulTmp = (ULONG)iNextByte(pFile);
+			if (!isalpha((int)ulTmp)) {
+				DBG_HEX(ulTmp);
+				return (size_t)-1;
+			}
+			ulName <<= 8;
+			ulName |= ulTmp;
+		}
+		DBG_HEX(ulName);
+		*ptSkipped += 4;
+
+		if (ulName == PNG_CN_IEND) {
+			break;
+		}
+		if (ulName == PNG_CN_IDAT) {
+			return tDataLength;
+		}
+
+		tToSkip = tDataLength + 4;
+		if (tToSkip >= tMaxBytes - *ptSkipped) {
+			DBG_DEC(tToSkip);
+			DBG_DEC(tMaxBytes - *ptSkipped);
+			return (size_t)-1;
+		}
+		(void)tSkipBytes(pFile, tToSkip);
+		*ptSkipped += tToSkip;
+	}
+
+	return (size_t)-1;
+} /* end of iSkipToData */
+
+/*
+ * iFindFirstPixelData - find the first pixeldata if a PNG image
+ *
+ * returns the length of the pixeldata or -1 in case of error
+ */
+static size_t
+tFindFirstPixelData(FILE *pFile, size_t tMaxBytes, size_t *ptSkipped)
+{
+	fail(pFile == NULL);
+	fail(tMaxBytes == 0);
+	fail(ptSkipped == NULL);
+
+	if (tMaxBytes < 8) {
+		DBG_DEC(tMaxBytes);
+		return (size_t)-1;
+	}
+
+	/* Skip over the PNG signature */
+	(void)tSkipBytes(pFile, 8);
+	*ptSkipped = 8;
+
+	return tSkipToData(pFile, tMaxBytes, ptSkipped);
+} /* end of iFindFirstPixelData */
+
+/*
+ * tFindNextPixelData - find the next pixeldata if a PNG image
+ *
+ * returns the length of the pixeldata or -1 in case of error
+ */
+static size_t
+tFindNextPixelData(FILE *pFile, size_t tMaxBytes, size_t *ptSkipped)
+{
+	fail(pFile == NULL);
+	fail(tMaxBytes == 0);
+	fail(ptSkipped == NULL);
+
+	if (tMaxBytes < 4) {
+		DBG_DEC(tMaxBytes);
+		return (size_t)-1;
+	}
+
+	/* Skip over the crc */
+	(void)tSkipBytes(pFile, 4);
+	*ptSkipped = 4;
+
+	return tSkipToData(pFile, tMaxBytes, ptSkipped);
+} /* end of tFindNextPixelData */
+
+#if defined(DEBUG)
+/*
+ * vCopy2File
+ */
+static void
+vCopy2File(FILE *pFile, ULONG ulFileOffset, size_t tPictureLen)
+{
+	FILE	*pOutFile;
+	size_t	tIndex;
+	int	iTmp;
+	char	szFilename[30];
+
+	if (!bSetDataOffset(pFile, ulFileOffset)) {
+		return;
+	}
+
+	sprintf(szFilename, "/tmp/pic/pic%04d.png", ++iPicCounter);
+	pOutFile = fopen(szFilename, "wb");
+	if (pOutFile == NULL) {
+		return;
+	}
+	for (tIndex = 0; tIndex < tPictureLen; tIndex++) {
+		iTmp = iNextByte(pFile);
+		if (putc(iTmp, pOutFile) == EOF) {
+			break;
+		}
+	}
+	(void)fclose(pOutFile);
+} /* end of vCopy2File */
+#endif /* DEBUG */
+
+/*
+ * bTranslatePNG - translate a PNG image
+ *
+ * This function translates an image from png to eps
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslatePNG(diagram_type *pDiag, FILE *pFile,
+	ULONG ulFileOffset, size_t tPictureLen, const imagedata_type *pImg)
+{
+	size_t	tMaxBytes, tDataLength, tSkipped;
+
+#if defined(DEBUG)
+	vCopy2File(pFile, ulFileOffset, tPictureLen);
+#endif /* DEBUG */
+
+	/* Seek to start position of PNG data */
+	if (!bSetDataOffset(pFile, ulFileOffset)) {
+		return FALSE;
+	}
+
+	tMaxBytes = tPictureLen;
+	tDataLength = tFindFirstPixelData(pFile, tMaxBytes, &tSkipped);
+	if (tDataLength == (size_t)-1) {
+		return FALSE;
+	}
+
+	vImagePrologue(pDiag, pImg);
+	do {
+		tMaxBytes -= tSkipped;
+		vASCII85EncodeArray(pFile, pDiag->pOutFile, tDataLength);
+		tMaxBytes -= tDataLength;
+		tDataLength = tFindNextPixelData(pFile, tMaxBytes, &tSkipped);
+	} while (tDataLength != (size_t)-1);
+	vASCII85EncodeByte(pDiag->pOutFile, EOF);
+	vImageEpilogue(pDiag);
+
+	return TRUE;
+} /* end of bTranslatePNG */

+ 26 - 0
sys/src/cmd/aux/antiword/png2sprt.c

@@ -0,0 +1,26 @@
+/*
+ * png2sprt.c
+ * Copyright (C) 2000 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to translate png pictures into sprites
+ */
+
+#include <stdio.h>
+#include "antiword.h"
+
+
+/*
+ * bTranslatePNG - translate a PNG picture
+ *
+ * This function translates a picture from png to sprite
+ *
+ * return TRUE when sucessful, otherwise FALSE
+ */
+BOOL
+bTranslatePNG(diagram_type *pDiag, FILE *pFile,
+	ULONG ulFileOffset, size_t tPictureLen, const imagedata_type *pImg)
+{
+	/* PNG is not supported yet */
+	return bAddDummyImage(pDiag, pImg);
+} /* end of bTranslatePNG */

+ 929 - 0
sys/src/cmd/aux/antiword/postscript.c

@@ -0,0 +1,929 @@
+/*
+ * postscript.c
+ * Copyright (C) 1999-2003 A.J. van Os; Released under GNU GPL
+ *
+ * Description:
+ * Functions to deal with the PostScript format
+ *
+ *================================================================
+ * The function vImagePrologue is based on:
+ * jpeg2ps - convert JPEG compressed images to PostScript Level 2
+ * Copyright (C) 1994-99 Thomas Merz (tm@muc.de)
+ *================================================================
+ * The credit should go to him, but all the bugs are mine.
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <time.h>
+#include <string.h>
+#include "version.h"
+#include "antiword.h"
+
+/* The character set */
+static encoding_type	eEncoding = encoding_neutral;
+/* The image level */
+static image_level_enum	eImageLevel = level_default;
+/* The output must use landscape orientation */
+static BOOL		bUseLandscape = FALSE;
+/* The height and width of a PostScript page (in DrawUnits) */
+static long		lPageHeight = LONG_MAX;
+static long		lPageWidth = LONG_MAX;
+/* Current time for a PS header */
+static const char	*szCreationDate = NULL;
+/* Current creator for a PS header */
+static const char	*szCreator = NULL;
+/* Current font information */
+static draw_fontref	tFontRefCurr = (draw_fontref)-1;
+static USHORT		usFontSizeCurr = 0;
+static int		iFontColorCurr = -1;
+/* Current vertical position information */
+static long		lYtopCurr = -1;
+/* PostScript page counter */
+static int		iPageCount = 0;
+/* Image counter */
+static int		iImageCount = 0;
+
+static const char *iso_8859_1_data[] = {
+"/newcodes	% ISO-8859-1 character encodings",
+"[",
+"140/ellipsis 141/trademark 142/perthousand 143/bullet",
+"144/quoteleft 145/quoteright 146/guilsinglleft 147/guilsinglright",
+"148/quotedblleft 149/quotedblright 150/quotedblbase 151/endash 152/emdash",
+"153/minus 154/OE 155/oe 156/dagger 157/daggerdbl 158/fi 159/fl",
+"160/space 161/exclamdown 162/cent 163/sterling 164/currency",
+"165/yen 166/brokenbar 167/section 168/dieresis 169/copyright",
+"170/ordfeminine 171/guillemotleft 172/logicalnot 173/hyphen 174/registered",
+"175/macron 176/degree 177/plusminus 178/twosuperior 179/threesuperior",
+"180/acute 181/mu 182/paragraph 183/periodcentered 184/cedilla",
+"185/onesuperior 186/ordmasculine 187/guillemotright 188/onequarter",
+"189/onehalf 190/threequarters 191/questiondown 192/Agrave 193/Aacute",
+"194/Acircumflex 195/Atilde 196/Adieresis 197/Aring 198/AE 199/Ccedilla",
+"200/Egrave 201/Eacute 202/Ecircumflex 203/Edieresis 204/Igrave 205/Iacute",
+"206/Icircumflex 207/Idieresis 208/Eth 209/Ntilde 210/Ograve 211/Oacute",
+"212/Ocircumflex 213/Otilde 214/Odieresis 215/multiply 216/Oslash",
+"217/Ugrave 218/Uacute 219/Ucircumflex 220/Udieresis 221/Yacute 222/Thorn",
+"223/germandbls 224/agrave 225/aacute 226/acircumflex 227/atilde",
+"228/adieresis 229/aring 230/ae 231/ccedilla 232/egrave 233/eacute",
+"234/ecircumflex 235/edieresis 236/igrave 237/iacute 238/icircumflex",
+"239/idieresis 240/eth 241/ntilde 242/ograve 243/oacute 244/ocircumflex",
+"245/otilde 246/odieresis 247/divide 248/oslash 249/ugrave 250/uacute",
+"251/ucircumflex 252/udieresis 253/yacute 254/thorn 255/ydieresis",
+"] bind def",
+"",
+"/reencdict 12 dict def",
+"",
+};
+
+static const char *iso_8859_2_data[] = {
+"/newcodes	% ISO-8859-2 character encodings",
+"[",
+"160/space 161/Aogonek 162/breve 163/Lslash 164/currency 165/Lcaron",
+"166/Sacute 167/section 168/dieresis 169/Scaron 170/Scommaaccent",
+"171/Tcaron 172/Zacute 173/hyphen 174/Zcaron 175/Zdotaccent 176/degree",
+"177/aogonek 178/ogonek 179/lslash 180/acute 181/lcaron 182/sacute",
+"183/caron 184/cedilla 185/scaron 186/scommaaccent 187/tcaron",
+"188/zacute 189/hungarumlaut 190/zcaron 191/zdotaccent 192/Racute",
+"193/Aacute 194/Acircumflex 195/Abreve 196/Adieresis 197/Lacute",
+"198/Cacute 199/Ccedilla 200/Ccaron 201/Eacute 202/Eogonek",
+"203/Edieresis 204/Ecaron 205/Iacute 206/Icircumflex 207/Dcaron",
+"208/Dcroat 209/Nacute 210/Ncaron 211/Oacute 212/Ocircumflex",
+"213/Ohungarumlaut 214/Odieresis 215/multiply 216/Rcaron 217/Uring",
+"218/Uacute 219/Uhungarumlaut 220/Udieresis 221/Yacute 222/Tcommaaccent",
+"223/germandbls 224/racute 225/aacute 226/acircumflex 227/abreve",
+"228/adieresis 229/lacute 230/cacute 231/ccedilla 232/ccaron 233/eacute",
+"234/eogonek 235/edieresis 236/ecaron 237/iacute 238/icircumflex",
+"239/dcaron 240/dcroat 241/nacute 242/ncaron 243/oacute 244/ocircumflex",
+"245/ohungarumlaut 246/odieresis 247/divide 248/rcaron 249/uring",
+"250/uacute 251/uhungarumlaut 252/udieresis 253/yacute 254/tcommaaccent",
+"255/dotaccent",
+"] bind def",
+"",
+"/reencdict 12 dict def",
+"",
+};
+
+static const char *iso_8859_x_func[] = {
+"% change fonts using ISO-8859-x characters",
+"/ChgFnt		% size psname natname => font",
+"{",
+"	dup FontDirectory exch known		% is re-encoded name known?",
+"	{ exch pop }				% yes, get rid of long name",
+"	{ dup 3 1 roll ReEncode } ifelse	% no, re-encode it",
+"	findfont exch scalefont setfont",
+"} bind def",
+"",
+"/ReEncode",
+"{",
+"reencdict begin",
+"	/newname exch def",
+"	/basename exch def",
+"	/basedict basename findfont def",
+"	/newfont basedict maxlength dict def",
+"	basedict",
+"	{ exch dup /FID ne",
+"		{ dup /Encoding eq",
+"			{ exch dup length array copy newfont 3 1 roll put }",
+"			{ exch newfont 3 1 roll put } ifelse",
+"		}",
+"		{ pop pop } ifelse",
+"	} forall",
+"	newfont /FontName newname put",
+"	newcodes aload pop newcodes length 2 idiv",
+"	{ newfont /Encoding get 3 1 roll put } repeat",
+"	newname newfont definefont pop",
+"end",
+"} bind def",
+"",
+};
+
+static const char *misc_func[] = {
+"% draw a line and show the string",
+"/LineShow	% string linewidth movement",
+"{",
+"	gsave",
+"		0 exch rmoveto",
+"		setlinewidth",
+"		dup",
+"		stringwidth pop",
+"		0 rlineto stroke",
+"	grestore",
+"	show",
+"} bind def",
+"",
+"% begin an EPS file (level 2 and up)",
+"/BeginEPSF",
+"{",
+"	/b4_Inc_state save def",
+"	/dict_count countdictstack def",
+"	/op_count count 1 sub def",
+"	userdict begin",
+"		/showpage { } def",
+"		0 setgray 0 setlinecap",
+"		1 setlinewidth 0 setlinejoin",
+"		10 setmiterlimit [ ] 0 setdash newpath",
+"		false setstrokeadjust false setoverprint",
+"} bind def",
+"",
+"% end an EPS file",
+"/EndEPSF {",
+"	count op_count sub { pop } repeat",
+"	countdictstack dict_count sub { end } repeat",
+"	b4_Inc_state restore",
+"} bind def",
+"",
+};
+
+
+/*
+ * vAddPageSetup - add the page setup
+ */
+static void
+vAddPageSetup(FILE *pOutFile)
+{
+	if (bUseLandscape) {
+		fprintf(pOutFile, "%%%%BeginPageSetup\n");
+		fprintf(pOutFile, "90 rotate\n");
+		fprintf(pOutFile, "0.00 %.2f translate\n",
+					-dDrawUnits2Points(lPageHeight));
+		fprintf(pOutFile, "%%%%EndPageSetup\n");
+	}
+} /* end of vAddPageSetup */
+
+/*
+ * vMove2NextPage - move to the start of the next page
+ */
+static void
+vMove2NextPage(diagram_type *pDiag)
+{
+	fail(pDiag == NULL);
+
+	fprintf(pDiag->pOutFile, "showpage\n");
+	iPageCount++;
+	fprintf(pDiag->pOutFile, "%%%%Page: %d %d\n", iPageCount, iPageCount);
+	vAddPageSetup(pDiag->pOutFile);
+	pDiag->lYtop = lPageHeight - PS_TOP_MARGIN;
+	lYtopCurr = -1;
+} /* end of vMove2NextPage */
+
+/*
+ * vMoveToPS - move to the specified X,Y coordinates
+ *
+ * Move the current position of the specified diagram to its X,Y coordinates,
+ * start on a new page if needed
+ */
+static void
+vMoveToPS(diagram_type *pDiag, long lLastVerticalMovement)
+{
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+
+	if (pDiag->lYtop < PS_BOTTOM_MARGIN) {
+		vMove2NextPage(pDiag);
+		/* Repeat the last vertical movement on the new page */
+		pDiag->lYtop -= lLastVerticalMovement;
+	}
+	fail(pDiag->lYtop < PS_BOTTOM_MARGIN);
+
+	if (pDiag->lYtop != lYtopCurr) {
+		fprintf(pDiag->pOutFile, "%.2f %.2f moveto\n",
+			dDrawUnits2Points(pDiag->lXleft + PS_LEFT_MARGIN),
+			dDrawUnits2Points(pDiag->lYtop));
+		lYtopCurr = pDiag->lYtop;
+	}
+} /* end of vMoveToPS */
+
+/*
+ * vProloguePS - set options and perform the PostScript initialization
+ */
+void
+vProloguePS(diagram_type *pDiag,
+	const char *szTask, const char *szFilename,
+	const options_type *pOptions)
+{
+	FILE	*pOutFile;
+	const char	*szTmp;
+	time_t	tTime;
+
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(szTask == NULL || szTask[0] == '\0');
+	fail(pOptions == NULL);
+
+	pOutFile = pDiag->pOutFile;
+
+	bUseLandscape = pOptions->bUseLandscape;
+	eEncoding = pOptions->eEncoding;
+	eImageLevel = pOptions->eImageLevel;
+
+	if (pOptions->iPageHeight == INT_MAX) {
+		lPageHeight = LONG_MAX;
+	} else {
+		lPageHeight = lPoints2DrawUnits(pOptions->iPageHeight);
+	}
+	DBG_DEC(lPageHeight);
+	if (pOptions->iPageWidth == INT_MAX) {
+		lPageWidth = LONG_MAX;
+	} else {
+		lPageWidth = lPoints2DrawUnits(pOptions->iPageWidth);
+	}
+	DBG_DEC(lPageWidth);
+	tFontRefCurr = (draw_fontref)-1;
+	usFontSizeCurr = 0;
+	iFontColorCurr = -1;
+	lYtopCurr = -1;
+	iImageCount = 0;
+	iPageCount = 0;
+	pDiag->lXleft = 0;
+	pDiag->lYtop = lPageHeight - PS_TOP_MARGIN;
+
+	szCreator = szTask;
+
+	fprintf(pOutFile, "%%!PS-Adobe-2.0\n");
+	fprintf(pOutFile, "%%%%Title: %s\n", szBasename(szFilename));
+	fprintf(pOutFile, "%%%%Creator: %s %s\n", szCreator, VERSIONSTRING);
+	szTmp = getenv("LOGNAME");
+	if (szTmp == NULL || szTmp[0] == '\0') {
+		szTmp = getenv("USER");
+		if (szTmp == NULL || szTmp[0] == '\0') {
+			szTmp = "unknown";
+		}
+	}
+	fprintf(pOutFile, "%%%%For: %.50s\n", szTmp);
+	errno = 0;
+	tTime = time(NULL);
+	if (tTime == (time_t)-1 && errno != 0) {
+		szCreationDate = NULL;
+	} else {
+		szCreationDate = ctime(&tTime);
+	}
+	if (szCreationDate == NULL || szCreationDate[0] == '\0') {
+		szCreationDate = "unknown\n";
+	}
+	fprintf(pOutFile, "%%%%CreationDate: %s", szCreationDate);
+	if (bUseLandscape) {
+		fprintf(pOutFile, "%%%%Orientation: Landscape\n");
+		fprintf(pOutFile, "%%%%BoundingBox: 0 0 %.0f %.0f\n",
+				dDrawUnits2Points(lPageHeight),
+				dDrawUnits2Points(lPageWidth));
+	} else {
+		fprintf(pOutFile, "%%%%Orientation: Portrait\n");
+		fprintf(pOutFile, "%%%%BoundingBox: 0 0 %.0f %.0f\n",
+				dDrawUnits2Points(lPageWidth),
+				dDrawUnits2Points(lPageHeight));
+	}
+} /* end of vProloguePS */
+
+/*
+ * vEpiloguePS - clean up after everything is done
+ */
+void
+vEpiloguePS(diagram_type *pDiag)
+{
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+
+	if (pDiag->lYtop < lPageHeight - PS_TOP_MARGIN) {
+		fprintf(pDiag->pOutFile, "showpage\n");
+	}
+	fprintf(pDiag->pOutFile, "%%%%Trailer\n");
+	fprintf(pDiag->pOutFile, "%%%%Pages: %d\n", iPageCount);
+	fprintf(pDiag->pOutFile, "%%%%EOF\n");
+	szCreationDate = NULL;
+	szCreator = NULL;
+} /* end of vEpiloguePS */
+
+/*
+ * vPrintPalette - print a postscript palette
+ */
+static void
+vPrintPalette(FILE *pOutFile, const imagedata_type *pImg)
+{
+	int	iIndex;
+
+	fail(pOutFile == NULL);
+	fail(pImg == NULL);
+	fail(pImg->iColorsUsed < 2);
+	fail(pImg->iColorsUsed > 256);
+
+	fprintf(pOutFile, "[ /Indexed\n");
+	fprintf(pOutFile, "\t/Device%s %d\n",
+		pImg->bColorImage ? "RGB" : "Gray", pImg->iColorsUsed - 1);
+	fprintf(pOutFile, "<");
+	for (iIndex = 0; iIndex < pImg->iColorsUsed; iIndex++) {
+		fprintf(pOutFile, "%02x",
+				(unsigned int)pImg->aucPalette[iIndex][0]);
+		if (pImg->bColorImage) {
+			fprintf(pOutFile, "%02x%02x",
+				(unsigned int)pImg->aucPalette[iIndex][1],
+				(unsigned int)pImg->aucPalette[iIndex][2]);
+		}
+		if (iIndex % 8 == 7) {
+			fprintf(pOutFile, "\n");
+		} else {
+			fprintf(pOutFile, " ");
+		}
+	}
+	fprintf(pOutFile, ">\n");
+	fprintf(pOutFile, "] setcolorspace\n");
+} /* end of vPrintPalette */
+
+/*
+ * vImageProloguePS - perform the Encapsulated PostScript initialization
+ */
+void
+vImageProloguePS(diagram_type *pDiag, const imagedata_type *pImg)
+{
+	FILE	*pOutFile;
+
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(pImg == NULL);
+
+	if (pImg->iVerSizeScaled <= 0 || pImg->iHorSizeScaled <= 0) {
+		return;
+	}
+
+	fail(szCreationDate == NULL);
+	fail(szCreator == NULL);
+	fail(eImageLevel == level_no_images);
+
+	iImageCount++;
+
+	DBG_DEC_C(pDiag->lXleft != 0, pDiag->lXleft);
+
+	pDiag->lYtop -= lPoints2DrawUnits(pImg->iVerSizeScaled);
+	vMoveToPS(pDiag, lPoints2DrawUnits(pImg->iVerSizeScaled));
+
+	pOutFile = pDiag->pOutFile;
+
+	fprintf(pOutFile, "BeginEPSF\n");
+	fprintf(pOutFile, "%%%%BeginDocument: image%03d.eps\n", iImageCount);
+	fprintf(pOutFile, "%%!PS-Adobe-2.0 EPSF-2.0\n");
+	fprintf(pOutFile, "%%%%Creator: %s %s\n", szCreator, VERSIONSTRING);
+	fprintf(pOutFile, "%%%%Title: Image %03d\n", iImageCount);
+	fprintf(pOutFile, "%%%%CreationDate: %s", szCreationDate);
+	fprintf(pOutFile, "%%%%BoundingBox: 0 0 %d %d\n",
+				pImg->iHorSizeScaled, pImg->iVerSizeScaled);
+	fprintf(pOutFile, "%%%%DocumentData: Clean7Bit\n");
+	fprintf(pOutFile, "%%%%LanguageLevel: 2\n");
+	fprintf(pOutFile, "%%%%EndComments\n");
+	fprintf(pOutFile, "%%%%BeginProlog\n");
+	fprintf(pOutFile, "%%%%EndProlog\n");
+	fprintf(pOutFile, "%%%%Page: 1 1\n");
+
+	fprintf(pOutFile, "save\n");
+
+	switch (pImg->eImageType) {
+	case imagetype_is_jpeg:
+		fprintf(pOutFile, "/Data1 currentfile ");
+		fprintf(pOutFile, "/ASCII85Decode filter def\n");
+		fprintf(pOutFile, "/Data Data1 << ");
+		fprintf(pOutFile, ">> /DCTDecode filter def\n");
+		switch (pImg->iComponents) {
+		case 1:
+			fprintf(pOutFile, "/DeviceGray setcolorspace\n");
+			break;
+		case 3:
+			fprintf(pOutFile, "/DeviceRGB setcolorspace\n");
+			break;
+		case 4:
+			fprintf(pOutFile, "/DeviceCMYK setcolorspace\n");
+			break;
+		default:
+			DBG_DEC(pImg->iComponents);
+			break;
+		}
+		break;
+	case imagetype_is_png:
+		if (eImageLevel == level_gs_special) {
+			fprintf(pOutFile,
+			"/Data2 currentfile /ASCII85Decode filter def\n");
+			fprintf(pOutFile,
+			"/Data1 Data2 << >> /FlateDecode filter def\n");
+			fprintf(pOutFile, "/Data Data1 <<\n");
+			fprintf(pOutFile, "\t/Colors %d\n", pImg->iComponents);
+			fprintf(pOutFile, "\t/BitsPerComponent %u\n",
+						pImg->uiBitsPerComponent);
+			fprintf(pOutFile, "\t/Columns %d\n", pImg->iWidth);
+			fprintf(pOutFile,
+				">> /PNGPredictorDecode filter def\n");
+		} else {
+			fprintf(pOutFile,
+			"/Data1 currentfile /ASCII85Decode filter def\n");
+			fprintf(pOutFile,
+			"/Data Data1 << >> /FlateDecode filter def\n");
+		}
+		if (pImg->iComponents == 3) {
+			fprintf(pOutFile, "/DeviceRGB setcolorspace\n");
+		} else if (pImg->iColorsUsed > 0) {
+			vPrintPalette(pOutFile, pImg);
+		} else {
+			fprintf(pOutFile, "/DeviceGray setcolorspace\n");
+		}
+		break;
+	case imagetype_is_dib:
+		fprintf(pOutFile, "/Data currentfile ");
+		fprintf(pOutFile, "/ASCII85Decode filter def\n");
+		if (pImg->uiBitsPerComponent <= 8) {
+			vPrintPalette(pOutFile, pImg);
+		} else {
+			fprintf(pOutFile, "/DeviceRGB setcolorspace\n");
+		}
+		break;
+	default:
+		fprintf(pOutFile, "/Data currentfile ");
+		fprintf(pOutFile, "/ASCIIHexDecode filter def\n");
+		fprintf(pOutFile, "/Device%s setcolorspace\n",
+			pImg->bColorImage ? "RGB" : "Gray");
+		break;
+	}
+
+	/* Translate to lower left corner of image */
+	fprintf(pOutFile, "%.2f %.2f translate\n",
+			dDrawUnits2Points(pDiag->lXleft + PS_LEFT_MARGIN),
+			dDrawUnits2Points(pDiag->lYtop));
+
+	fprintf(pOutFile, "%d %d scale\n",
+				pImg->iHorSizeScaled, pImg->iVerSizeScaled);
+
+	fprintf(pOutFile, "{ <<\n");
+	fprintf(pOutFile, "\t/ImageType 1\n");
+	fprintf(pOutFile, "\t/Width %d\n", pImg->iWidth);
+	fprintf(pOutFile, "\t/Height %d\n", pImg->iHeight);
+	if (pImg->eImageType == imagetype_is_dib) {
+		/* Scanning from left to right and bottom to top */
+		fprintf(pOutFile, "\t/ImageMatrix [ %d 0 0 %d 0 0 ]\n",
+			pImg->iWidth, pImg->iHeight);
+	} else {
+		/* Scanning from left to right and top to bottom */
+		fprintf(pOutFile, "\t/ImageMatrix [ %d 0 0 %d 0 %d ]\n",
+			pImg->iWidth, -pImg->iHeight, pImg->iHeight);
+	}
+	fprintf(pOutFile, "\t/DataSource Data\n");
+
+	switch (pImg->eImageType) {
+	case imagetype_is_jpeg:
+		fprintf(pOutFile, "\t/BitsPerComponent 8\n");
+		switch (pImg->iComponents) {
+		case 1:
+			fprintf(pOutFile, "\t/Decode [0 1]\n");
+			break;
+		case 3:
+			fprintf(pOutFile, "\t/Decode [0 1 0 1 0 1]\n");
+			break;
+		case 4:
+			if (pImg->bAdobe) {
+				/*
+				 * Adobe-conforming CMYK file
+				 * applying workaround for color inversion
+				 */
+				fprintf(pOutFile,
+					"\t/Decode [1 0 1 0 1 0 1 0]\n");
+			} else {
+				fprintf(pOutFile,
+					"\t/Decode [0 1 0 1 0 1 0 1]\n");
+			}
+			break;
+		default:
+			DBG_DEC(pImg->iComponents);
+			break;
+		}
+		break;
+	case imagetype_is_png:
+		if (pImg->iComponents == 3) {
+			fprintf(pOutFile, "\t/BitsPerComponent 8\n");
+			fprintf(pOutFile, "\t/Decode [0 1 0 1 0 1]\n");
+		} else if (pImg->iColorsUsed > 0) {
+			fail(pImg->uiBitsPerComponent > 8);
+			fprintf(pOutFile, "\t/BitsPerComponent %u\n",
+					pImg->uiBitsPerComponent);
+			fprintf(pOutFile, "\t/Decode [0 %d]\n",
+					(1 << pImg->uiBitsPerComponent) - 1);
+		} else {
+			fprintf(pOutFile, "\t/BitsPerComponent 8\n");
+			fprintf(pOutFile, "\t/Decode [0 1]\n");
+		}
+		break;
+	case imagetype_is_dib:
+		fprintf(pOutFile, "\t/BitsPerComponent 8\n");
+		if (pImg->uiBitsPerComponent <= 8) {
+			fprintf(pOutFile, "\t/Decode [0 255]\n");
+		} else {
+			fprintf(pOutFile, "\t/Decode [0 1 0 1 0 1]\n");
+		}
+		break;
+	default:
+		fprintf(pOutFile, "\t/BitsPerComponent 8\n");
+		if (pImg->bColorImage) {
+			fprintf(pOutFile, "\t/Decode [0 1 0 1 0 1]\n");
+		} else {
+			fprintf(pOutFile, "\t/Decode [0 1]\n");
+		}
+		break;
+	}
+
+	fprintf(pOutFile, "  >> image\n");
+	fprintf(pOutFile, "  Data closefile\n");
+	fprintf(pOutFile, "  showpage\n");
+	fprintf(pOutFile, "  restore\n");
+	fprintf(pOutFile, "} exec\n");
+} /* end of vImageProloguePS */
+
+/*
+ * vImageEpiloguePS - clean up after Encapsulated PostScript
+ */
+void
+vImageEpiloguePS(diagram_type *pDiag)
+{
+	FILE	*pOutFile;
+
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+
+	pOutFile = pDiag->pOutFile;
+
+	fprintf(pOutFile, "%%%%EOF\n");
+	fprintf(pOutFile, "%%%%EndDocument\n");
+	fprintf(pOutFile, "EndEPSF\n");
+
+	pDiag->lXleft = 0;
+} /* end of vImageEpiloguePS */
+
+/*
+ * bAddDummyImagePS - add a dummy image
+ *
+ * return TRUE when successful, otherwise FALSE
+ */
+BOOL
+bAddDummyImagePS(diagram_type *pDiag, const imagedata_type *pImg)
+{
+	FILE	*pOutFile;
+
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(pImg == NULL);
+
+	if (pImg->iVerSizeScaled <= 0 || pImg->iHorSizeScaled <= 0) {
+		return FALSE;
+	}
+
+	iImageCount++;
+
+	DBG_DEC_C(pDiag->lXleft != 0, pDiag->lXleft);
+
+	pDiag->lYtop -= lPoints2DrawUnits(pImg->iVerSizeScaled);
+	vMoveToPS(pDiag, lPoints2DrawUnits(pImg->iVerSizeScaled));
+
+	pOutFile = pDiag->pOutFile;
+
+	fprintf(pOutFile, "gsave %% Image %03d\n", iImageCount);
+	fprintf(pOutFile, "\tnewpath\n");
+	fprintf(pOutFile, "\t%.2f %.2f moveto\n",
+			dDrawUnits2Points(pDiag->lXleft + PS_LEFT_MARGIN),
+			dDrawUnits2Points(pDiag->lYtop));
+	fprintf(pOutFile, "\t1.0 setlinewidth\n");
+	fprintf(pOutFile, "\t0.3 setgray\n");
+	fprintf(pOutFile, "\t0 %d rlineto\n", pImg->iVerSizeScaled);
+	fprintf(pOutFile, "\t%d 0 rlineto\n", pImg->iHorSizeScaled);
+	fprintf(pOutFile, "\t0 %d rlineto\n", -pImg->iVerSizeScaled);
+	fprintf(pOutFile, "\tclosepath\n");
+	fprintf(pOutFile, "\tstroke\n");
+	fprintf(pOutFile, "grestore\n");
+
+	pDiag->lXleft = 0;
+
+	return TRUE;
+} /* end of bAddDummyImagePS */
+
+/*
+ * vAddFontsPS - add the list of fonts and complete the prologue
+ */
+void
+vAddFontsPS(diagram_type *pDiag)
+{
+	FILE	*pOutFile;
+	const font_table_type *pTmp, *pTmp2;
+	size_t	tIndex;
+	int	iLineLen;
+	BOOL	bFound;
+
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+
+	pOutFile = pDiag->pOutFile;
+	iLineLen = fprintf(pOutFile, "%%%%DocumentFonts:");
+
+	if (tGetFontTableLength() == 0) {
+		iLineLen += fprintf(pOutFile, " Courier");
+	} else {
+		pTmp = NULL;
+		while ((pTmp = pGetNextFontTableRecord(pTmp)) != NULL) {
+			/* Print the document fonts */
+			bFound = FALSE;
+			pTmp2 = NULL;
+			while ((pTmp2 = pGetNextFontTableRecord(pTmp2))
+					!= NULL && pTmp2 < pTmp) {
+				bFound = STREQ(pTmp2->szOurFontname,
+						pTmp->szOurFontname);
+				if (bFound) {
+					break;
+				}
+			}
+			if (bFound) {
+				continue;
+			}
+			if (iLineLen + (int)strlen(pTmp->szOurFontname) > 78) {
+				fprintf(pOutFile, "\n%%%%+");
+				iLineLen = 3;
+			}
+			iLineLen += fprintf(pOutFile,
+					" %s", pTmp->szOurFontname);
+		}
+	}
+	fprintf(pOutFile, "\n");
+	fprintf(pOutFile, "%%%%Pages: (atend)\n");
+	fprintf(pOutFile, "%%%%EndComments\n");
+	fprintf(pOutFile, "%%%%BeginProlog\n");
+
+	switch (eEncoding) {
+	case encoding_iso_8859_1:
+		for (tIndex = 0;
+		     tIndex < elementsof(iso_8859_1_data);
+		     tIndex++) {
+			fprintf(pOutFile, "%s\n", iso_8859_1_data[tIndex]);
+		}
+		fprintf(pOutFile, "\n");
+		for (tIndex = 0;
+		     tIndex < elementsof(iso_8859_x_func);
+		     tIndex++) {
+			fprintf(pOutFile, "%s\n", iso_8859_x_func[tIndex]);
+		}
+		break;
+	case encoding_iso_8859_2:
+		for (tIndex = 0;
+		     tIndex < elementsof(iso_8859_2_data);
+		     tIndex++) {
+			fprintf(pOutFile, "%s\n", iso_8859_2_data[tIndex]);
+		}
+		fprintf(pOutFile, "\n");
+		for (tIndex = 0;
+		     tIndex < elementsof(iso_8859_x_func);
+		     tIndex++) {
+			fprintf(pOutFile, "%s\n", iso_8859_x_func[tIndex]);
+		}
+		break;
+	case encoding_utf8:
+		werr(1,
+		"The combination PostScript and UTF-8 is not supported");
+		break;
+	default:
+		DBG_DEC(eEncoding);
+		break;
+	}
+
+	/* The rest of the functions */
+	for (tIndex = 0; tIndex < elementsof(misc_func); tIndex++) {
+		fprintf(pOutFile, "%s\n", misc_func[tIndex]);
+	}
+	fprintf(pOutFile, "%%%%EndProlog\n");
+	iPageCount = 1;
+	fprintf(pDiag->pOutFile, "%%%%Page: %d %d\n", iPageCount, iPageCount);
+	vAddPageSetup(pDiag->pOutFile);
+} /* end of vAddFontsPS */
+
+/*
+ * vPrintPS - print a PostScript string
+ */
+static void
+vPrintPS(FILE *pFile, const char *szString, size_t tStringLength,
+		USHORT usFontstyle)
+{
+	double		dSuperscriptMove, dSubscriptMove;
+	const UCHAR	*ucBytes;
+	size_t		tCount;
+
+	fail(szString == NULL);
+
+	if (szString == NULL || szString[0] == '\0' || tStringLength == 0) {
+		return;
+	}
+	DBG_DEC_C(usFontSizeCurr < MIN_FONT_SIZE, usFontSizeCurr);
+
+	dSuperscriptMove = 0.0;
+	dSubscriptMove = 0.0;
+
+	/* Up for superscript */
+	if (bIsSuperscript(usFontstyle) && usFontSizeCurr != 0) {
+		dSuperscriptMove = (double)((usFontSizeCurr + 1) / 2) * 0.375;
+		fprintf(pFile, "0 %.2f rmoveto\n", dSuperscriptMove);
+	}
+
+	/* Down for subscript */
+	if (bIsSubscript(usFontstyle) && usFontSizeCurr != 0) {
+		dSubscriptMove = (double)usFontSizeCurr * 0.125;
+		fprintf(pFile, "0 %.2f rmoveto\n", -dSubscriptMove);
+	}
+
+	/* Generate and print the PostScript output */
+	ucBytes = (UCHAR *)szString;
+	(void)putc('(', pFile);
+	for (tCount = 0; tCount < tStringLength ; tCount++) {
+		switch (ucBytes[tCount]) {
+		case '(':
+		case ')':
+		case '\\':
+			(void)putc('\\', pFile);
+			(void)putc(szString[tCount], pFile);
+			break;
+		default:
+			if (ucBytes[tCount] < 0x20 ||
+			    (ucBytes[tCount] >= 0x7f &&
+			     ucBytes[tCount] < 0x8c)) {
+				DBG_HEX(ucBytes[tCount]);
+				(void)putc(' ', pFile);
+			} else if (ucBytes[tCount] >= 0x80) {
+				fprintf(pFile, "\\%03o", (UINT)ucBytes[tCount]);
+			} else {
+				(void)putc(szString[tCount], pFile);
+			}
+			break;
+		}
+	}
+	fprintf(pFile, ") ");
+	if ((bIsStrike(usFontstyle) || bIsMarkDel(usFontstyle)) &&
+			usFontSizeCurr != 0) {
+		fprintf(pFile, "%.2f %.2f LineShow\n",
+			(double)usFontSizeCurr * 0.02,
+			(double)usFontSizeCurr * 0.12);
+	} else if (bIsUnderline(usFontstyle) && usFontSizeCurr != 0) {
+		fprintf(pFile, "%.2f %.2f LineShow\n",
+			(double)usFontSizeCurr * 0.02,
+			(double)usFontSizeCurr * -0.06);
+	} else {
+		fprintf(pFile, "show\n");
+	}
+
+	/* Undo the superscript move */
+	if (bIsSuperscript(usFontstyle) && usFontSizeCurr != 0) {
+		fprintf(pFile, "0 %.2f rmoveto\n", -dSuperscriptMove);
+	}
+
+	/* Undo the subscript move */
+	if (bIsSubscript(usFontstyle) && usFontSizeCurr != 0) {
+		fprintf(pFile, "0 %.2f rmoveto\n", dSubscriptMove);
+	}
+} /* end of vPrintPS */
+
+/*
+ * vSetColor - move to the specified color
+ */
+static void
+vSetColor(FILE *pFile, UCHAR ucFontColor)
+{
+	ULONG	ulTmp, ulRed, ulGreen, ulBlue;
+
+	ulTmp = ulColor2Color(ucFontColor);
+	ulRed   = (ulTmp & 0x0000ff00) >> 8;
+	ulGreen = (ulTmp & 0x00ff0000) >> 16;
+	ulBlue  = (ulTmp & 0xff000000) >> 24;
+	fprintf(pFile, "%.3f %.3f %.3f setrgbcolor\n",
+				ulRed / 255.0, ulGreen / 255.0, ulBlue / 255.0);
+} /* end of vSetColor */
+
+/*
+ * vMove2NextLinePS - move to the next line
+ */
+void
+vMove2NextLinePS(diagram_type *pDiag, USHORT usFontSize)
+{
+	fail(pDiag == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+
+	pDiag->lYtop -= lComputeLeading(usFontSize);
+} /* end of vMove2NextLinePS */
+
+/*
+ * vSubstringPS - print a sub string
+ */
+void
+vSubstringPS(diagram_type *pDiag,
+	char *szString, size_t tStringLength, long lStringWidth,
+	UCHAR ucFontColor, USHORT usFontstyle, draw_fontref tFontRef,
+	USHORT usFontSize, USHORT usMaxFontSize)
+{
+	const char	*szOurFontname;
+
+	fail(pDiag == NULL || szString == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(pDiag->lXleft < 0);
+	fail(tStringLength != strlen(szString));
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+	fail(usMaxFontSize < MIN_FONT_SIZE || usMaxFontSize > MAX_FONT_SIZE);
+	fail(usFontSize > usMaxFontSize);
+
+	if (szString[0] == '\0' || tStringLength == 0) {
+		return;
+	}
+
+	if (tFontRef != tFontRefCurr || usFontSize != usFontSizeCurr) {
+		szOurFontname = szGetFontname(tFontRef);
+		fail(szOurFontname == NULL);
+		fprintf(pDiag->pOutFile,
+			"%.1f /%s /%s-ISO-8859-x ChgFnt\n",
+			(double)usFontSize / 2.0,
+			szOurFontname, szOurFontname);
+		tFontRefCurr = tFontRef;
+		usFontSizeCurr = usFontSize;
+	}
+	if ((int)ucFontColor != iFontColorCurr) {
+		vSetColor(pDiag->pOutFile, ucFontColor);
+		iFontColorCurr = (int)ucFontColor;
+	}
+	vMoveToPS(pDiag, lComputeLeading(usMaxFontSize));
+	vPrintPS(pDiag->pOutFile, szString, tStringLength, usFontstyle);
+	pDiag->lXleft += lStringWidth;
+} /* end of vSubstringPS */
+
+/*
+ * Create an start of paragraph by moving the y-top mark
+ */
+void
+vStartOfParagraphPS(diagram_type *pDiag, long lBeforeIndentation)
+{
+	fail(pDiag == NULL);
+	fail(lBeforeIndentation < 0);
+
+	pDiag->lXleft = 0;
+	pDiag->lYtop -= lMilliPoints2DrawUnits(lBeforeIndentation);
+} /* end of vStartOfParagraphPS */
+
+/*
+ * Create an end of paragraph by moving the y-top mark
+ */
+void
+vEndOfParagraphPS(diagram_type *pDiag,
+	draw_fontref tFontRef, USHORT usFontSize, long lAfterIndentation)
+{
+	fail(pDiag == NULL);
+	fail(pDiag->pOutFile == NULL);
+	fail(usFontSize < MIN_FONT_SIZE || usFontSize > MAX_FONT_SIZE);
+	fail(lAfterIndentation < 0);
+
+	if (pDiag->lXleft > 0) {
+		/* To the start of the line */
+		vMove2NextLine(pDiag, tFontRef, usFontSize);
+	}
+
+	pDiag->lXleft = 0;
+	pDiag->lYtop -= lMilliPoints2DrawUnits(lAfterIndentation);
+} /* end of vEndOfParagraphPS */
+
+/*
+ * Create an end of page
+ */
+void
+vEndOfPagePS(diagram_type *pDiag)
+{
+	vMove2NextPage(pDiag);
+} /* end of vEndOfPagePS */

+ 368 - 0
sys/src/cmd/aux/antiword/prop0.c

@@ -0,0 +1,368 @@
+/*
+ * prop0.c
+ * Copyright (C) 2002,2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Read the property information from a Word for DOS file
+ */
+
+#include <string.h>
+#include "antiword.h"
+
+
+/*
+ * Fill the section information block with information
+ * from a Word for DOS file.
+ */
+static void
+vGet0SectionInfo(const UCHAR *aucGrpprl, size_t tBytes,
+		section_block_type *pSection)
+{
+	USHORT	usCcol;
+	UCHAR	ucTmp;
+
+	fail(aucGrpprl == NULL || pSection == NULL);
+
+	if (tBytes < 2) {
+		return;
+	}
+	/* bkc */
+	ucTmp = ucGetByte(1, aucGrpprl);
+	DBG_HEX(ucTmp);
+	ucTmp &= 0x07;
+	DBG_HEX(ucTmp);
+	pSection->bNewPage = ucTmp != 0 && ucTmp != 1;
+	if (tBytes < 18) {
+		return;
+	}
+	/* ccolM1 */
+	usCcol = (USHORT)ucGetByte(17, aucGrpprl);
+	DBG_DEC(usCcol);
+} /* end of vGet0SectionInfo */
+
+/*
+ * Build the lists with Section Property Information for Word for DOS files
+ */
+void
+vGet0SepInfo(FILE *pFile, const UCHAR *aucHeader)
+{
+	section_block_type	tSection;
+	UCHAR	*aucBuffer;
+	ULONG	ulBeginSectInfo, ulBeginNextBlock;
+	ULONG	ulSectPage, ulTextOffset;
+	size_t	tSectInfoLen, tBytes;
+	int	iIndex, iSections;
+	UCHAR	aucTmp[2], aucFpage[35];
+
+	fail(pFile == NULL || aucHeader == NULL);
+
+	ulBeginSectInfo = 128 * (ULONG)usGetWord(0x18, aucHeader);
+	DBG_HEX(ulBeginSectInfo);
+	ulBeginNextBlock = 128 * (ULONG)usGetWord(0x1a, aucHeader);
+	DBG_HEX(ulBeginNextBlock);
+	if (ulBeginSectInfo == ulBeginNextBlock) {
+		/* There is no section information block */
+		return;
+	}
+
+	/* Get the the number of sections */
+	if (!bReadBytes(aucTmp, 2, ulBeginSectInfo, pFile)) {
+		return;
+	}
+	iSections = (int)usGetWord(0, aucTmp);
+	NO_DBG_DEC(iSections);
+
+	/* Read the Section Descriptors */
+	tSectInfoLen = 10 * (size_t)iSections;
+	NO_DBG_DEC(tSectInfoLen);
+	aucBuffer = xmalloc(tSectInfoLen);
+	if (!bReadBytes(aucBuffer, tSectInfoLen, ulBeginSectInfo + 4, pFile)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tSectInfoLen);
+
+	/* Read the Section Properties */
+	for (iIndex = 0; iIndex < iSections; iIndex++) {
+		ulTextOffset = ulGetLong(10 * iIndex, aucBuffer);
+		NO_DBG_HEX(ulTextOffset);
+		ulSectPage = ulGetLong(10 * iIndex + 6, aucBuffer);
+		NO_DBG_HEX(ulSectPage);
+		if (ulSectPage == FC_INVALID ||		/* Must use defaults */
+		    ulSectPage < 128 ||			/* Should not happen */
+		    ulSectPage >= ulBeginSectInfo) {	/* Should not happen */
+			DBG_HEX_C(ulSectPage != FC_INVALID, ulSectPage);
+			vDefault2SectionInfoList(ulTextOffset);
+			continue;
+		}
+		/* Get the number of bytes to read */
+		if (!bReadBytes(aucTmp, 1, ulSectPage, pFile)) {
+			continue;
+		}
+		tBytes = 1 + (size_t)ucGetByte(0, aucTmp);
+		NO_DBG_DEC(tBytes);
+		fail(tBytes > sizeof(aucFpage));
+		if (tBytes > sizeof(aucFpage)) {
+			DBG_DEC(tBytes);
+			tBytes = sizeof(aucFpage);
+		}
+		/* Read the bytes */
+		if (!bReadBytes(aucFpage, tBytes, ulSectPage, pFile)) {
+			continue;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, tBytes);
+		/* Process the bytes */
+		vGetDefaultSection(&tSection);
+		vGet0SectionInfo(aucFpage + 1, tBytes - 1, &tSection);
+		vAdd2SectionInfoList(&tSection, ulTextOffset);
+	}
+	/* Clean up before you leave */
+	aucBuffer = xfree(aucBuffer);
+} /* end of vGet0SepInfo */
+
+/*
+ * Fill the style information block with information
+ * from a Word for DOS file.
+ */
+static void
+vGet0StyleInfo(int iFodo, const UCHAR *aucGrpprl, style_block_type *pStyle)
+{
+	int	iBytes;
+	UCHAR	ucTmp;
+
+	fail(iFodo <= 0 || aucGrpprl == NULL || pStyle == NULL);
+
+	pStyle->usIstdNext = ISTD_NORMAL;
+
+	iBytes = (int)ucGetByte(iFodo, aucGrpprl);
+	if (iBytes < 1) {
+		return;
+	}
+	/* stc if styled */
+	ucTmp = ucGetByte(iFodo + 1, aucGrpprl);
+	if ((ucTmp & BIT(0)) != 0) {
+		ucTmp >>= 1;
+		if (ucTmp >= 88 && ucTmp <= 94) {
+			/* Header levels 1 through 7 */
+			pStyle->usIstd = ucTmp - 87;
+			pStyle->ucNumLevel = 1;
+		}
+	}
+	if (iBytes < 2) {
+		return;
+	}
+	/* jc */
+	ucTmp = ucGetByte(iFodo + 2, aucGrpprl);
+	pStyle->ucAlignment = ucTmp & 0x02;
+	if (iBytes < 3) {
+		return;
+	}
+	/* stc */
+	ucTmp = ucGetByte(iFodo + 3, aucGrpprl);
+	ucTmp &= 0x7f;
+	if (ucTmp >= 88 && ucTmp <= 94) {
+		/* Header levels 1 through 7 */
+		pStyle->usIstd = ucTmp - 87;
+		pStyle->ucNumLevel = 1;
+	}
+	if (iBytes < 6) {
+		return;
+	}
+	/* dxaRight */
+	pStyle->sRightIndent = (short)usGetWord(iFodo + 5, aucGrpprl);
+	NO_DBG_DEC(pStyle->sRightIndent);
+	if (iBytes < 8) {
+		return;
+	}
+	/* dxaLeft */
+	pStyle->sLeftIndent = (short)usGetWord(iFodo + 7, aucGrpprl);
+	NO_DBG_DEC(pStyle->sLeftIndent);
+	if (iBytes < 10) {
+		return;
+	}
+	/* dxaLeft1 */
+	pStyle->sLeftIndent1 = (short)usGetWord(iFodo + 9, aucGrpprl);
+	NO_DBG_DEC(pStyle->sLeftIndent1);
+	if (iBytes < 14) {
+		return;
+	}
+	/* dyaBefore */
+	pStyle->usBeforeIndent = usGetWord(iFodo + 13, aucGrpprl);
+	NO_DBG_DEC(pStyle->usBeforeIndent);
+	if (iBytes < 16) {
+		return;
+	}
+	/* dyaAfter */
+	pStyle->usAfterIndent = usGetWord(iFodo + 15, aucGrpprl);
+	NO_DBG_DEC(pStyle->usAfterIndent);
+} /* end of vGet0StyleInfo */
+
+/*
+ * Build the lists with Paragraph Information for Word for DOS files
+ */
+void
+vGet0PapInfo(FILE *pFile, const UCHAR *aucHeader)
+{
+	style_block_type	tStyle;
+	ULONG	ulBeginParfInfo, ulCharPos, ulCharPosNext;
+	int	iIndex, iRun, iFodo;
+	UCHAR	aucFpage[128];
+
+	fail(pFile == NULL || aucHeader == NULL);
+
+	ulBeginParfInfo = 128 * (ULONG)usGetWord(0x12, aucHeader);
+	NO_DBG_HEX(ulBeginParfInfo);
+
+	do {
+		if (!bReadBytes(aucFpage, 128, ulBeginParfInfo, pFile)) {
+			return;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, 128);
+		ulCharPosNext = ulGetLong(0, aucFpage);
+		iRun = (int)ucGetByte(0x7f, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex = 0; iIndex < iRun; iIndex++) {
+			iFodo = (int)usGetWord(6 * iIndex + 8, aucFpage);
+			if (iFodo <= 0 || iFodo > 0x79) {
+				DBG_DEC_C(iFodo != (int)0xffff, iFodo);
+				continue;
+			}
+			vFillStyleFromStylesheet(0, &tStyle);
+			vGet0StyleInfo(iFodo, aucFpage + 4, &tStyle);
+			ulCharPos = ulCharPosNext;
+			ulCharPosNext = ulGetLong(6 * iIndex + 4, aucFpage);
+			tStyle.ulFileOffset = ulCharPos;
+			vAdd2StyleInfoList(&tStyle);
+		}
+		ulBeginParfInfo += 128;
+	} while (ulCharPosNext == ulBeginParfInfo);
+} /* end of vGet0PapInfo */
+
+/*
+ * Fill the font information block with information
+ * from a Word for DOS file.
+ */
+static void
+vGet0FontInfo(int iFodo, const UCHAR *aucGrpprl, font_block_type *pFont)
+{
+	int	iBytes;
+	UCHAR	ucTmp;
+
+	fail(iFodo <= 0 || aucGrpprl == NULL || pFont == NULL);
+
+	iBytes = (int)ucGetByte(iFodo, aucGrpprl);
+	if (iBytes < 2) {
+		return;
+	}
+	/* fBold, fItalic, cFtc */
+	ucTmp = ucGetByte(iFodo + 2, aucGrpprl);
+	if ((ucTmp & BIT(0)) != 0) {
+		pFont->usFontStyle |= FONT_BOLD;
+	}
+	if ((ucTmp & BIT(1)) != 0) {
+		pFont->usFontStyle |= FONT_ITALIC;
+	}
+	pFont->ucFontNumber = ucTmp >> 2;
+	NO_DBG_DEC(pFont->ucFontNumber);
+	if (iBytes < 3) {
+		return;
+	}
+	/* cHps */
+	pFont->usFontSize = ucGetByte(iFodo + 3, aucGrpprl);
+	NO_DBG_DEC(pFont->usFontSize);
+	if (iBytes < 4) {
+		return;
+	}
+	/* cKul, fStrike, fCaps, fSmallCaps, fVanish */
+	ucTmp = ucGetByte(iFodo + 4, aucGrpprl);
+	if ((ucTmp & BIT(0)) != 0 || (ucTmp & BIT(2)) != 0) {
+		pFont->usFontStyle |= FONT_UNDERLINE;
+	}
+	if ((ucTmp & BIT(1)) != 0) {
+		pFont->usFontStyle |= FONT_STRIKE;
+	}
+	if ((ucTmp & BIT(4)) != 0) {
+		pFont->usFontStyle |= FONT_CAPITALS;
+	}
+	if ((ucTmp & BIT(5)) != 0) {
+		pFont->usFontStyle |= FONT_SMALL_CAPITALS;
+	}
+	if ((ucTmp & BIT(7)) != 0) {
+		pFont->usFontStyle |= FONT_HIDDEN;
+	}
+	DBG_HEX(pFont->usFontStyle);
+	if (iBytes < 6) {
+		return;
+	}
+	/* cIss */
+	ucTmp = ucGetByte(iFodo + 6, aucGrpprl);
+	if (ucTmp != 0) {
+		if (ucTmp < 128) {
+			pFont->usFontStyle |= FONT_SUPERSCRIPT;
+			DBG_MSG("Superscript");
+		} else {
+			pFont->usFontStyle |= FONT_SUBSCRIPT;
+			DBG_MSG("Subscript");
+		}
+	}
+	if (iBytes < 7) {
+		return;
+	}
+	/* cIco */
+	ucTmp = ucGetByte(iFodo + 7, aucGrpprl);
+	switch (ucTmp & 0x07) {
+	case 0: pFont->ucFontColor = FONT_COLOR_BLACK; break;
+	case 1: pFont->ucFontColor = FONT_COLOR_RED; break;
+	case 2: pFont->ucFontColor = FONT_COLOR_GREEN; break;
+	case 3: pFont->ucFontColor = FONT_COLOR_BLUE; break;
+	case 4: pFont->ucFontColor = FONT_COLOR_CYAN; break;
+	case 5: pFont->ucFontColor = FONT_COLOR_MAGENTA; break;
+	case 6: pFont->ucFontColor = FONT_COLOR_YELLOW; break;
+	case 7: pFont->ucFontColor = FONT_COLOR_WHITE; break;
+	default:pFont->ucFontColor = FONT_COLOR_BLACK; break;
+	}
+	NO_DBG_DEC(pFont->ucFontColor);
+} /* end of vGet0FontInfo */
+
+/*
+ * Build the lists with Character Information for Word for DOS files
+ */
+void
+vGet0ChrInfo(FILE *pFile, const UCHAR *aucHeader)
+{
+	font_block_type		tFont;
+	ULONG	ulBeginCharInfo, ulCharPos, ulCharPosNext;
+	int	iIndex, iRun, iFodo;
+	UCHAR	aucFpage[128];
+
+	fail(pFile == NULL || aucHeader == NULL);
+
+	ulBeginCharInfo = ulGetLong(0x0e, aucHeader);
+	NO_DBG_HEX(ulBeginCharInfo);
+	ulBeginCharInfo = ROUND128(ulBeginCharInfo);
+	NO_DBG_HEX(ulBeginCharInfo);
+
+	do {
+		if (!bReadBytes(aucFpage, 128, ulBeginCharInfo, pFile)) {
+			return;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, 128);
+		ulCharPosNext = ulGetLong(0, aucFpage);
+		iRun = (int)ucGetByte(0x7f, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex = 0; iIndex < iRun; iIndex++) {
+			iFodo = (int)usGetWord(6 * iIndex + 8, aucFpage);
+			if (iFodo <= 0 || iFodo > 0x79) {
+				DBG_DEC_C(iFodo != (int)0xffff, iFodo);
+				continue;
+			}
+			vFillFontFromStylesheet(0, &tFont);
+			vGet0FontInfo(iFodo, aucFpage + 4, &tFont);
+			ulCharPos = ulCharPosNext;
+			ulCharPosNext = ulGetLong(6 * iIndex + 4, aucFpage);
+			tFont.ulFileOffset = ulCharPos;
+			vAdd2FontInfoList(&tFont);
+		}
+		ulBeginCharInfo += 128;
+	} while (ulCharPosNext == ulBeginCharInfo);
+} /* end of vGet0ChrInfo */

+ 974 - 0
sys/src/cmd/aux/antiword/prop2.c

@@ -0,0 +1,974 @@
+/*
+ * prop2.c
+ * Copyright (C) 2002,2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Read the property information from a WinWord 1 or 2 file
+ */
+
+#include <string.h>
+#include "antiword.h"
+
+
+/*
+ * iGet2InfoLength - the length of the information for WinWord 1/2 files
+ */
+static int
+iGet2InfoLength(int iByteNbr, const UCHAR *aucGrpprl)
+{
+	int	iTmp, iDel, iAdd;
+
+	switch (ucGetByte(iByteNbr, aucGrpprl)) {
+	case   3: case  15: case  78: case 152: case 154: case 155:
+		return 2 + (int)ucGetByte(iByteNbr + 1, aucGrpprl);
+	case  16: case  17: case  18: case  19: case  21: case  22: case  26:
+	case  27: case  28: case  30: case  31: case  32: case  33: case  34:
+	case  35: case  36: case  38: case  39: case  40: case  41: case  42:
+	case  43: case  45: case  46: case  47: case  48: case  49: case  68:
+	case  71: case  72: case  82: case  83: case  96: case  97: case  98:
+	case  99: case 115: case 116: case 119: case 120: case 123: case 124:
+	case 129: case 130: case 131: case 132: case 135: case 136: case 139:
+	case 140: case 141: case 142: case 143: case 144: case 145: case 146:
+	case 147: case 148: case 153: case 159: case 161: case 162:
+		return 1 + 2;
+	case  23:
+		iTmp = (int)ucGetByte(iByteNbr + 1, aucGrpprl);
+		if (iTmp == 255) {
+			iDel = (int)ucGetByte(iByteNbr + 2, aucGrpprl);
+			iAdd = (int)ucGetByte(
+					iByteNbr + 3 + iDel * 4, aucGrpprl);
+			iTmp = 2 + iDel * 4 + iAdd * 3;
+		}
+		return 2 + iTmp;
+	case  70:
+		return 1 + 3;
+	case  95:
+		return 1 + 13;
+	case 157: case 163:
+		return 1 + 5;
+	case 158: case 160: case 164:
+		return 1 + 4;
+	default:
+		return 1 + 1;
+	}
+} /* end of iGet2InfoLength */
+
+/*
+ * Fill the section information block with information
+ * from a WinWord 1/2 file.
+ */
+static void
+vGet2SectionInfo(const UCHAR *aucGrpprl, size_t tBytes,
+		section_block_type *pSection)
+{
+	int	iFodoOff, iInfoLen;
+	USHORT	usCcol;
+	UCHAR	ucTmp;
+
+	fail(aucGrpprl == NULL || pSection == NULL);
+
+	iFodoOff = 0;
+	while (tBytes >= (size_t)iFodoOff + 1) {
+		switch (ucGetByte(iFodoOff, aucGrpprl)) {
+		case 117:	/* bkc */
+			ucTmp = ucGetByte(iFodoOff + 1, aucGrpprl);
+			DBG_DEC(ucTmp);
+			pSection->bNewPage = ucTmp != 0 && ucTmp != 1;
+			break;
+		case 119:	/* ccolM1 */
+			usCcol = 1 + usGetWord(iFodoOff + 1, aucGrpprl);
+			DBG_DEC(usCcol);
+			break;
+		default:
+			break;
+		}
+		iInfoLen = iGet2InfoLength(iFodoOff, aucGrpprl);
+		fail(iInfoLen <= 0);
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet2SectionInfo */
+
+/*
+ * Build the lists with Section Property Information for WinWord 1/2 files
+ */
+void
+vGet2SepInfo(FILE *pFile, const UCHAR *aucHeader)
+{
+	section_block_type	tSection;
+	ULONG	*aulSectPage, *aulTextOffset;
+	UCHAR	*aucBuffer, *aucFpage;
+	ULONG	ulBeginSectInfo;
+	size_t	tSectInfoLen, tOffset, tLen, tBytes;
+	int	iIndex;
+	UCHAR	aucTmp[1];
+
+	fail(pFile == NULL || aucHeader == NULL);
+
+	ulBeginSectInfo = ulGetLong(0x7c, aucHeader); /* fcPlcfsed */
+	DBG_HEX(ulBeginSectInfo);
+	tSectInfoLen = (size_t)usGetWord(0x80, aucHeader); /* cbPlcfsed */
+	DBG_DEC(tSectInfoLen);
+	if (tSectInfoLen < 4) {
+		DBG_DEC(tSectInfoLen);
+		return;
+	}
+
+	aucBuffer = xmalloc(tSectInfoLen);
+	if (!bReadBytes(aucBuffer, tSectInfoLen, ulBeginSectInfo, pFile)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tSectInfoLen);
+
+	/* Read the Section Descriptors */
+	tLen = (tSectInfoLen - 4) / 10;
+	/* Save the section offsets */
+	aulTextOffset = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = 0;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 4) {
+		aulTextOffset[iIndex] = ulGetLong(tOffset, aucBuffer);
+	}
+	/* Save the Sepx offsets */
+	aulSectPage = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 6) {
+		aulSectPage[iIndex] = ulGetLong(tOffset + 2, aucBuffer);
+		NO_DBG_HEX(aulSectPage[iIndex]); /* fcSepx */
+	}
+	aucBuffer = xfree(aucBuffer);
+
+	/* Read the Section Properties */
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (aulSectPage[iIndex] == FC_INVALID) {
+			vDefault2SectionInfoList(aulTextOffset[iIndex]);
+			continue;
+		}
+		/* Get the number of bytes to read */
+		if (!bReadBytes(aucTmp, 1, aulSectPage[iIndex], pFile)) {
+			continue;
+		}
+		tBytes = 1 + (size_t)ucGetByte(0, aucTmp);
+		NO_DBG_DEC(tBytes);
+		/* Read the bytes */
+		aucFpage = xmalloc(tBytes);
+		if (!bReadBytes(aucFpage, tBytes, aulSectPage[iIndex], pFile)) {
+			aucFpage = xfree(aucFpage);
+			continue;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, tBytes);
+		/* Process the bytes */
+		vGetDefaultSection(&tSection);
+		vGet2SectionInfo(aucFpage + 1, tBytes - 1, &tSection);
+		vAdd2SectionInfoList(&tSection, aulTextOffset[iIndex]);
+		aucFpage = xfree(aucFpage);
+	}
+	aulTextOffset = xfree(aulTextOffset);
+	aulSectPage = xfree(aulSectPage);
+} /* end of vGet2SepInfo */
+
+/*
+ * Translate the rowinfo to a member of the row_info enumeration
+ */
+row_info_enum
+eGet2RowInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, row_block_type *pRow)
+{
+	int	iFodoOff, iInfoLen;
+	int	iIndex, iSize, iCol;
+	int	iPosCurr, iPosPrev;
+	USHORT	usTmp;
+	BOOL	bFound24_0, bFound24_1, bFound25_0, bFound25_1, bFound154;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pRow == NULL);
+
+	iFodoOff = 0;
+	bFound24_0 = FALSE;
+	bFound24_1 = FALSE;
+	bFound25_0 = FALSE;
+	bFound25_1 = FALSE;
+	bFound154 = FALSE;
+	while (iBytes >= iFodoOff + 1) {
+		iInfoLen = 0;
+		switch (ucGetByte(iFodo + iFodoOff, aucGrpprl)) {
+		case  24:	/* fIntable */
+			if (odd(ucGetByte(iFodo + iFodoOff + 1, aucGrpprl))) {
+				bFound24_1 = TRUE;
+			} else {
+				bFound24_0 = TRUE;
+			}
+			break;
+		case  25:	/* fTtp */
+			if (odd(ucGetByte(iFodo + iFodoOff + 1, aucGrpprl))) {
+				bFound25_1 = TRUE;
+			} else {
+				bFound25_0 = TRUE;
+			}
+			break;
+		case 30:	/* brcTop10 */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x01ff;
+			NO_DBG_DEC(usTmp >> 6);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_TOP;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_TOP;
+			}
+			break;
+		case 31:	/* brcLeft10 */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x01ff;
+			NO_DBG_DEC(usTmp >> 6);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_LEFT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_LEFT;
+			}
+			break;
+		case 32:	/* brcBottom10 */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x01ff;
+			NO_DBG_DEC(usTmp >> 6);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_BOTTOM;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_BOTTOM;
+			}
+			break;
+		case 33:	/* brcRight10 */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x01ff;
+			NO_DBG_DEC(usTmp >> 6);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_RIGHT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_RIGHT;
+			}
+			break;
+		case 38:	/* brcTop */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_TOP;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_TOP;
+			}
+			break;
+		case 39:	/* brcLeft */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_LEFT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_LEFT;
+			}
+			break;
+		case 40:	/* brcBottom */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_BOTTOM;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_BOTTOM;
+			}
+			break;
+		case 41:	/* brcRight */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_RIGHT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_RIGHT;
+			}
+			break;
+		case 152:	/* cDefTable10 */
+		case 154:	/* cDefTable */
+			iSize = (int)usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			if (iSize < 6 || iBytes < iFodoOff + 7) {
+				DBG_DEC(iSize);
+				DBG_DEC(iBytes);
+				DBG_DEC(iFodoOff);
+				iInfoLen = 1;
+				break;
+			}
+			iCol = (int)ucGetByte(iFodo + iFodoOff + 3, aucGrpprl);
+			if (iCol < 1 ||
+			    iBytes < iFodoOff + 3 + (iCol + 1) * 2) {
+				DBG_DEC(iCol);
+				DBG_DEC(iBytes);
+				DBG_DEC(iFodoOff);
+				DBG_DEC(ucGetByte(iFodo + iFodoOff, aucGrpprl));
+				iInfoLen = 1;
+				break;
+			}
+			if (iCol >= (int)elementsof(pRow->asColumnWidth)) {
+				DBG_DEC(iCol);
+				werr(1, "The number of columns is corrupt");
+			}
+			pRow->ucNumberOfColumns = (UCHAR)iCol;
+			pRow->iColumnWidthSum = 0;
+			iPosPrev = (int)(short)usGetWord(
+					iFodo + iFodoOff + 4,
+					aucGrpprl);
+			for (iIndex = 0; iIndex < iCol; iIndex++) {
+				iPosCurr = (int)(short)usGetWord(
+					iFodo + iFodoOff + 6 + iIndex * 2,
+					aucGrpprl);
+				pRow->asColumnWidth[iIndex] =
+						(short)(iPosCurr - iPosPrev);
+				pRow->iColumnWidthSum +=
+					pRow->asColumnWidth[iIndex];
+				iPosPrev = iPosCurr;
+			}
+			bFound154 = TRUE;
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen =
+				iGet2InfoLength(iFodo + iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+	if (bFound24_1 && bFound25_1 && bFound154) {
+		return found_end_of_row;
+	}
+	if (bFound24_0 && bFound25_0 && !bFound154) {
+		return found_not_end_of_row;
+	}
+	if (bFound24_1) {
+		return found_a_cell;
+	}
+	if (bFound24_0) {
+		return found_not_a_cell;
+	}
+	return found_nothing;
+} /* end of eGet2RowInfo */
+
+/*
+ * Fill the style information block with information
+ * from a WinWord 1/2 file.
+ */
+void
+vGet2StyleInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, style_block_type *pStyle)
+{
+	int	iFodoOff, iInfoLen;
+	int	iTmp, iDel, iAdd;
+	short	sTmp;
+	UCHAR	ucTmp;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pStyle == NULL);
+
+	NO_DBG_DEC(pStyle->usIstd);
+
+	iFodoOff = 0;
+	while (iBytes >= iFodoOff + 1) {
+		iInfoLen = 0;
+		switch (ucGetByte(iFodo + iFodoOff, aucGrpprl)) {
+		case   2:	/* istd */
+			sTmp = (short)ucGetByte(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(sTmp);
+			break;
+		case   5:	/* jc */
+			pStyle->ucAlignment = ucGetByte(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			break;
+		case  12:	/* nfcSeqNumb */
+			pStyle->ucNFC = ucGetByte(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			break;
+		case  13:	/* nLvlAnm */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			pStyle->ucNumLevel = ucTmp;
+			pStyle->bNumPause =
+				eGetNumType(ucTmp) == level_type_pause;
+			break;
+		case  15:	/* ChgTabsPapx */
+			iTmp = (int)ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (iTmp < 2) {
+				iInfoLen = 1;
+				break;
+			}
+			NO_DBG_DEC(iTmp);
+			iDel = (int)ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (iTmp < 2 + 2 * iDel) {
+				iInfoLen = 1;
+				break;
+			}
+			NO_DBG_DEC(iDel);
+			iAdd = (int)ucGetByte(
+				iFodo + iFodoOff + 3 + 2 * iDel, aucGrpprl);
+			if (iTmp < 2 + 2 * iDel + 2 * iAdd) {
+				iInfoLen = 1;
+				break;
+			}
+			NO_DBG_DEC(iAdd);
+			break;
+		case  16:	/* dxaRight */
+			pStyle->sRightIndent = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->sRightIndent);
+			break;
+		case  17:	/* dxaLeft */
+			pStyle->sLeftIndent = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->sLeftIndent);
+			break;
+		case  18:	/* Nest dxaLeft */
+			sTmp = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			pStyle->sLeftIndent += sTmp;
+			if (pStyle->sLeftIndent < 0) {
+				pStyle->sLeftIndent = 0;
+			}
+			NO_DBG_DEC(sTmp);
+			NO_DBG_DEC(pStyle->sLeftIndent);
+			break;
+		case  19:	/* dxaLeft1 */
+			pStyle->sLeftIndent1 = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->sLeftIndent1);
+			break;
+		case  21:	/* dyaBefore */
+			pStyle->usBeforeIndent = usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->usBeforeIndent);
+			break;
+		case  22:	/* dyaAfter */
+			pStyle->usAfterIndent = usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->usAfterIndent);
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen =
+				iGet2InfoLength(iFodo + iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet2StyleInfo */
+
+/*
+ * Build the lists with Paragraph Information for WinWord 1/2 files
+ */
+void
+vGet2PapInfo(FILE *pFile, const UCHAR *aucHeader)
+{
+	row_block_type		tRow;
+	style_block_type	tStyle;
+	USHORT	*ausParfPage;
+	UCHAR	*aucBuffer;
+	ULONG	ulCharPos, ulCharPosFirst, ulCharPosLast;
+	ULONG	ulBeginParfInfo;
+	size_t	tParfInfoLen, tParfPageNum, tOffset, tSize, tLenOld, tLen;
+	int	iIndex, iIndex2, iRun, iFodo, iLen;
+	row_info_enum	eRowInfo;
+	USHORT	usParfFirstPage, usCount, usIstd;
+	UCHAR	ucStc;
+	UCHAR	aucFpage[BIG_BLOCK_SIZE];
+
+	fail(pFile == NULL || aucHeader == NULL);
+
+	ulBeginParfInfo = ulGetLong(0xa6, aucHeader); /* fcPlcfbtePapx */
+	NO_DBG_HEX(ulBeginParfInfo);
+	tParfInfoLen = (size_t)usGetWord(0xaa, aucHeader); /* cbPlcfbtePapx */
+	NO_DBG_DEC(tParfInfoLen);
+	if (tParfInfoLen < 4) {
+		DBG_DEC(tParfInfoLen);
+		return;
+	}
+
+	aucBuffer = xmalloc(tParfInfoLen);
+	if (!bReadBytes(aucBuffer, tParfInfoLen, ulBeginParfInfo, pFile)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tParfInfoLen);
+
+	tLen = (tParfInfoLen - 4) / 6;
+	ausParfPage = xcalloc(tLen, sizeof(USHORT));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 2) {
+		ausParfPage[iIndex] = usGetWord(tOffset, aucBuffer);
+		NO_DBG_DEC(ausParfPage[iIndex]);
+	}
+	DBG_HEX(ulGetLong(0, aucBuffer));
+	aucBuffer = xfree(aucBuffer);
+	tParfPageNum = (size_t)usGetWord(0x144, aucHeader); /* cpnBtePap */
+	DBG_DEC(tParfPageNum);
+	if (tLen < tParfPageNum) {
+		/* Replace ParfPage by a longer version */
+		tLenOld = tLen;
+		usParfFirstPage = usGetWord(0x140, aucHeader); /* pnPapFirst */
+		DBG_DEC(usParfFirstPage);
+		tLen += tParfPageNum - 1;
+		tSize = tLen * sizeof(USHORT);
+		ausParfPage = xrealloc(ausParfPage, tSize);
+		/* Add new values */
+		usCount = usParfFirstPage + 1;
+		for (iIndex = (int)tLenOld; iIndex < (int)tLen; iIndex++) {
+			ausParfPage[iIndex] = usCount;
+			NO_DBG_DEC(ausParfPage[iIndex]);
+			usCount++;
+		}
+	}
+
+	(void)memset(&tRow, 0, sizeof(tRow));
+	ulCharPosFirst = CP_INVALID;
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (!bReadBytes(aucFpage, BIG_BLOCK_SIZE,
+				(ULONG)ausParfPage[iIndex] * BIG_BLOCK_SIZE,
+				pFile)) {
+			break;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, BIG_BLOCK_SIZE);
+		iRun = (int)ucGetByte(0x1ff, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) {
+			if ((iRun + 1) * 4 + iIndex2 * 1 >= BIG_BLOCK_SIZE) {
+				break;
+			}
+			NO_DBG_HEX(ulGetLong(iIndex2 * 4, aucFpage));
+			iFodo = 2 * (int)ucGetByte(
+				(iRun + 1) * 4 + iIndex2 * 1, aucFpage);
+			if (iFodo <= 0) {
+				continue;
+			}
+
+			iLen = 2 * (int)ucGetByte(iFodo, aucFpage);
+
+			ucStc = ucGetByte(iFodo + 1, aucFpage);
+			usIstd = usStc2istd(ucStc);
+
+			vFillStyleFromStylesheet(usIstd, &tStyle);
+			vGet2StyleInfo(iFodo, aucFpage + 8, iLen - 8, &tStyle);
+			ulCharPos = ulGetLong(iIndex2 * 4, aucFpage);
+			NO_DBG_HEX(ulCharPos);
+			tStyle.ulFileOffset = ulCharPos;
+			vAdd2StyleInfoList(&tStyle);
+
+			eRowInfo = eGet2RowInfo(iFodo,
+					aucFpage + 8, iLen - 8, &tRow);
+
+			switch(eRowInfo) {
+			case found_a_cell:
+				if (ulCharPosFirst != CP_INVALID) {
+					break;
+				}
+				ulCharPosFirst = ulGetLong(
+						iIndex2 * 4, aucFpage);
+				NO_DBG_HEX(ulCharPosFirst);
+				tRow.ulCharPosStart = ulCharPosFirst;
+				tRow.ulFileOffsetStart = ulCharPosFirst;
+				break;
+			case found_end_of_row:
+				ulCharPosLast = ulGetLong(
+						iIndex2 * 4, aucFpage);
+				NO_DBG_HEX(ulCharPosLast);
+				tRow.ulCharPosEnd = ulCharPosLast;
+				/* Add 1 for compatiblity with Word 6 and up */
+				tRow.ulFileOffsetEnd = ulCharPosLast + 1;
+				vAdd2RowInfoList(&tRow);
+				(void)memset(&tRow, 0, sizeof(tRow));
+				ulCharPosFirst = CP_INVALID;
+				break;
+			case found_nothing:
+				break;
+			default:
+				DBG_DEC(eRowInfo);
+				break;
+			}
+		}
+	}
+	ausParfPage = xfree(ausParfPage);
+} /* end of vGet2PapInfo */
+
+/*
+ * Fill the font information block with information
+ * from a WinWord 1 file.
+ */
+void
+vGet1FontInfo(int iFodo,
+	const UCHAR *aucGrpprl, size_t tBytes, font_block_type *pFont)
+{
+	BOOL	bIcoChange, bFtcChange, bHpsChange, bKulChange;
+	USHORT	usTmp;
+	UCHAR	ucTmp;
+	UCHAR	aucChpx[12];
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL);
+
+	if (tBytes > sizeof(aucChpx)) {
+		NO_DBG_PRINT_BLOCK(aucGrpprl + iFodo, tBytes);
+		return;
+	}
+
+	/* Build the CHPX structure */
+	(void)memset(aucChpx, 0, sizeof(aucChpx));
+	(void)memcpy(aucChpx, aucGrpprl + iFodo, min(tBytes, sizeof(aucChpx)));
+
+	usTmp = usGetWord(0, aucChpx);
+	if ((usTmp & BIT(0)) != 0) {
+		pFont->usFontStyle ^= FONT_BOLD;
+	}
+	if ((usTmp & BIT(1)) != 0) {
+		pFont->usFontStyle ^= FONT_ITALIC;
+	}
+	if ((usTmp & BIT(2)) != 0) {
+		pFont->usFontStyle ^= FONT_STRIKE;
+	}
+	if ((usTmp & BIT(5)) != 0) {
+		pFont->usFontStyle ^= FONT_SMALL_CAPITALS;
+	}
+	if ((usTmp & BIT(6)) != 0) {
+		pFont->usFontStyle ^= FONT_CAPITALS;
+	}
+	if ((usTmp & BIT(7)) != 0) {
+		pFont->usFontStyle ^= FONT_HIDDEN;
+	}
+
+	ucTmp = ucGetByte(5, aucChpx);
+	if (ucTmp != 0) {
+		if (ucTmp < 128) {
+			pFont->usFontStyle |= FONT_SUPERSCRIPT;
+			DBG_MSG("Superscript");
+		} else {
+			pFont->usFontStyle |= FONT_SUBSCRIPT;
+			DBG_MSG("Subscript");
+		}
+	}
+
+	bIcoChange = (usTmp & BIT(10)) != 0;
+	bFtcChange = (usTmp & BIT(11)) != 0;
+	bHpsChange = (usTmp & BIT(12)) != 0;
+	bKulChange = (usTmp & BIT(13)) != 0;
+
+	if (bFtcChange) {
+		usTmp = usGetWord(2, aucChpx);
+		if (usTmp <= (USHORT)UCHAR_MAX) {
+			pFont->ucFontNumber = (UCHAR)usTmp;
+		} else {
+			pFont->ucFontNumber = 0;
+		}
+	}
+
+	if (bHpsChange) {
+		pFont->usFontSize = (USHORT)ucGetByte(4, aucChpx);
+	}
+
+	if (bIcoChange || bKulChange) {
+		usTmp = usGetWord(6, aucChpx);
+		if (bIcoChange) {
+			pFont->ucFontColor = (UCHAR)((usTmp & 0x0f00) >> 8);
+			if (pFont->ucFontColor <= 7) {
+				/* Add 1 for compatibility with Word 2 and up */
+				pFont->ucFontColor++;
+			} else {
+				DBG_DEC(pFont->ucFontColor);
+				pFont->ucFontColor = 0;
+			}
+		}
+		if (bKulChange) {
+			usTmp = (usTmp & 0x7000) >> 12;
+			DBG_DEC_C(usTmp > 4, usTmp);
+			if (usTmp == 0) {
+				pFont->usFontStyle &= ~FONT_UNDERLINE;
+			} else {
+				pFont->usFontStyle |= FONT_UNDERLINE;
+			}
+		}
+	}
+} /* end of vGet1FontInfo */
+
+/*
+ * Fill the font information block with information
+ * from a WinWord 1/2 file.
+ */
+void
+vGet2FontInfo(int iFodo,
+	const UCHAR *aucGrpprl, size_t tBytes, font_block_type *pFont)
+{
+	BOOL	bIcoChange, bFtcChange, bHpsChange, bKulChange;
+	USHORT	usTmp;
+	UCHAR	ucTmp;
+	UCHAR	aucChpx[18];
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL);
+
+	if (tBytes > sizeof(aucChpx)) {
+		NO_DBG_PRINT_BLOCK(aucGrpprl + iFodo, tBytes);
+		return;
+	}
+
+	/* Build the CHPX structure */
+	(void)memset(aucChpx, 0, sizeof(aucChpx));
+	(void)memcpy(aucChpx, aucGrpprl + iFodo, min(tBytes, sizeof(aucChpx)));
+
+	usTmp = usGetWord(0, aucChpx);
+	if ((usTmp & BIT(0)) != 0) {
+		pFont->usFontStyle ^= FONT_BOLD;
+	}
+	if ((usTmp & BIT(1)) != 0) {
+		pFont->usFontStyle ^= FONT_ITALIC;
+	}
+	if (usTmp & BIT(3)) {
+		pFont->usFontStyle ^= FONT_MARKDEL;
+	}
+	if ((usTmp & BIT(5)) != 0) {
+		pFont->usFontStyle ^= FONT_SMALL_CAPITALS;
+	}
+	if ((usTmp & BIT(6)) != 0) {
+		pFont->usFontStyle ^= FONT_CAPITALS;
+	}
+	if ((usTmp & BIT(7)) != 0) {
+		pFont->usFontStyle ^= FONT_HIDDEN;
+	}
+	if (usTmp & BIT(10)) {
+		pFont->usFontStyle ^= FONT_STRIKE;
+	}
+
+	ucTmp = ucGetByte(10, aucChpx);
+	DBG_MSG_C(ucTmp != 0 && ucTmp < 128, "Superscript");
+	DBG_MSG_C(ucTmp >= 128, "Subscript");
+
+	usTmp = usGetWord(2, aucChpx);
+	if (usTmp == 0) {
+		/* No changes, nothing to do */
+		return;
+	}
+
+	bIcoChange = (usTmp & BIT(0)) != 0;
+	bFtcChange = (usTmp & BIT(1)) != 0;
+	bHpsChange = (usTmp & BIT(2)) != 0;
+	bKulChange = (usTmp & BIT(3)) != 0;
+
+	if (bFtcChange) {
+		usTmp = usGetWord(4, aucChpx);
+		if (usTmp <= (USHORT)UCHAR_MAX) {
+			pFont->ucFontNumber = (UCHAR)usTmp;
+		} else {
+			pFont->ucFontNumber = 0;
+		}
+	}
+
+	if (bHpsChange) {
+		pFont->usFontSize = usGetWord(6, aucChpx);
+	}
+
+	if (bIcoChange || bKulChange) {
+		ucTmp = ucGetByte(9, aucChpx);
+		if (bIcoChange) {
+			pFont->ucFontColor = ucTmp & 0x1f;
+			if (pFont->ucFontColor > 16) {
+				DBG_DEC(pFont->ucFontColor);
+				pFont->ucFontColor = 0;
+			}
+		}
+		if (bKulChange) {
+			ucTmp = (ucTmp & 0xe0) >> 5;
+			DBG_DEC_C(ucTmp > 4, ucTmp);
+			if (ucTmp == 0) {
+				pFont->usFontStyle &= ~FONT_UNDERLINE;
+			} else {
+				pFont->usFontStyle |= FONT_UNDERLINE;
+			}
+		}
+	}
+} /* end of vGet2FontInfo */
+
+/*
+ * Fill the picture information block with information from a WinWord 1 file.
+ * Returns TRUE when successful, otherwise FALSE
+ */
+static BOOL
+bGet1PicInfo(int iFodo,
+	const UCHAR *aucGrpprl, size_t tBytes, picture_block_type *pPicture)
+{
+	ULONG	ulTmp;
+	UCHAR	aucChpx[12];
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pPicture == NULL);
+
+	if (tBytes > sizeof(aucChpx)) {
+		NO_DBG_PRINT_BLOCK(aucGrpprl + iFodo, tBytes);
+		return FALSE;
+	}
+
+	/* Build the CHPX structure */
+	(void)memset(aucChpx, 0, sizeof(aucChpx));
+	(void)memcpy(aucChpx, aucGrpprl + iFodo, min(tBytes, sizeof(aucChpx)));
+
+	ulTmp = ulGetLong(8, aucChpx);
+	if (ulTmp != 0) {
+		pPicture->ulPictureOffset = ulTmp;
+		DBG_HEX(pPicture->ulPictureOffset);
+		return TRUE;
+	}
+	return FALSE;
+} /* end of bGet1PicInfo */
+
+/*
+ * Fill the picture information block with information from a WinWord 2 file.
+ * Returns TRUE when successful, otherwise FALSE
+ */
+static BOOL
+bGet2PicInfo(int iFodo,
+	const UCHAR *aucGrpprl, size_t tBytes, picture_block_type *pPicture)
+{
+	ULONG	ulTmp;
+	UCHAR	aucChpx[18];
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pPicture == NULL);
+
+	if (tBytes > sizeof(aucChpx)) {
+		NO_DBG_PRINT_BLOCK(aucGrpprl + iFodo, tBytes);
+		return FALSE;
+	}
+
+	/* Build the CHPX structure */
+	(void)memset(aucChpx, 0, sizeof(aucChpx));
+	(void)memcpy(aucChpx, aucGrpprl + iFodo, min(tBytes, sizeof(aucChpx)));
+
+	ulTmp = ulGetLong(14, aucChpx);
+	if (ulTmp != 0) {
+		pPicture->ulPictureOffset = ulTmp;
+		DBG_HEX(pPicture->ulPictureOffset);
+		DBG_DEC(tBytes);
+		return TRUE;
+	}
+	return FALSE;
+} /* end of bGet2PicInfo */
+
+/*
+ * Build the lists with Character Information for WinWord 1/2 files
+ */
+void
+vGet2ChrInfo(FILE *pFile, int iWordVersion, const UCHAR *aucHeader)
+{
+	font_block_type		tFont;
+	picture_block_type	tPicture;
+	USHORT	*ausCharPage;
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulCharPos, ulBeginCharInfo;
+	size_t	tCharInfoLen, tOffset, tSize, tChrLen, tCharPageNum;
+	size_t	tLenOld, tLen;
+	int	iIndex, iIndex2, iRun, iFodo;
+	BOOL	bSuccess1, bSuccess2;
+	USHORT	usCharFirstPage, usCount, usIstd;
+	UCHAR	aucFpage[BIG_BLOCK_SIZE];
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(iWordVersion != 1 && iWordVersion != 2);
+
+	ulBeginCharInfo = ulGetLong(0xa0, aucHeader); /* fcPlcfbteChpx */
+	DBG_HEX(ulBeginCharInfo);
+	tCharInfoLen = (size_t)usGetWord(0xa4, aucHeader); /* cbPlcfbteChpx */
+	DBG_DEC(tCharInfoLen);
+	if (tCharInfoLen < 4) {
+		DBG_DEC(tCharInfoLen);
+	}
+
+	aucBuffer = xmalloc(tCharInfoLen);
+	if (!bReadBytes(aucBuffer, tCharInfoLen, ulBeginCharInfo, pFile)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tCharInfoLen);
+
+	tLen = (tCharInfoLen - 4) / 6;
+	ausCharPage = xcalloc(tLen, sizeof(USHORT));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 2) {
+		ausCharPage[iIndex] = usGetWord(tOffset, aucBuffer);
+		NO_DBG_DEC(ausCharPage[iIndex]);
+	}
+	DBG_HEX(ulGetLong(0, aucBuffer));
+	aucBuffer = xfree(aucBuffer);
+	tCharPageNum = (size_t)usGetWord(0x142, aucHeader); /* cpnBteChp */
+	DBG_DEC(tCharPageNum);
+	if (tLen < tCharPageNum) {
+		/* Replace CharPage by a longer version */
+		tLenOld = tLen;
+		usCharFirstPage = usGetWord(0x13e, aucHeader); /* pnChrFirst */
+		NO_DBG_DEC(usCharFirstPage);
+		tLen += tCharPageNum - 1;
+		tSize = tLen * sizeof(USHORT);
+		ausCharPage = xrealloc(ausCharPage, tSize);
+		/* Add new values */
+		usCount = usCharFirstPage + 1;
+		for (iIndex = (int)tLenOld; iIndex < (int)tLen; iIndex++) {
+			ausCharPage[iIndex] = usCount;
+			NO_DBG_DEC(ausCharPage[iIndex]);
+			usCount++;
+		}
+	}
+
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (!bReadBytes(aucFpage, BIG_BLOCK_SIZE,
+				(ULONG)ausCharPage[iIndex] * BIG_BLOCK_SIZE,
+				pFile)) {
+			break;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, BIG_BLOCK_SIZE);
+		iRun = (int)ucGetByte(0x1ff, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) {
+			if ((iRun + 1) * 4 + iIndex2 >= BIG_BLOCK_SIZE) {
+				break;
+			}
+			ulCharPos = ulGetLong(iIndex2 * 4, aucFpage);
+			ulFileOffset = ulCharPos;
+			iFodo = 2 * (int)ucGetByte(
+				(iRun + 1) * 4 + iIndex2, aucFpage);
+
+			tChrLen = (size_t)ucGetByte(iFodo, aucFpage);
+
+			usIstd = usGetIstd(ulFileOffset);
+			vFillFontFromStylesheet(usIstd, &tFont);
+			if (iFodo != 0) {
+				if (iWordVersion == 1) {
+					vGet1FontInfo(iFodo,
+						aucFpage + 1, tChrLen, &tFont);
+				} else if (iWordVersion == 2) {
+					vGet2FontInfo(iFodo,
+						aucFpage + 1, tChrLen, &tFont);
+				}
+			}
+			tFont.ulFileOffset = ulFileOffset;
+			vAdd2FontInfoList(&tFont);
+
+			if (iFodo <= 0) {
+				continue;
+			}
+
+			(void)memset(&tPicture, 0, sizeof(tPicture));
+			bSuccess1 = iWordVersion == 1 &&
+					bGet1PicInfo(iFodo, aucFpage + 1,
+						tChrLen, &tPicture);
+			bSuccess2 = iWordVersion == 2 &&
+					bGet2PicInfo(iFodo, aucFpage + 1,
+						tChrLen, &tPicture);
+			if (bSuccess1 || bSuccess2) {
+				tPicture.ulFileOffset = ulFileOffset;
+				tPicture.ulFileOffsetPicture =
+						tPicture.ulPictureOffset;
+				vAdd2PictInfoList(&tPicture);
+			}
+		}
+	}
+	ausCharPage = xfree(ausCharPage);
+} /* end of vGet2ChrInfo */

+ 1010 - 0
sys/src/cmd/aux/antiword/prop6.c

@@ -0,0 +1,1010 @@
+/*
+ * prop6.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Read the property information from a MS Word 6 or 7 file
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "antiword.h"
+
+
+/*
+ * iGet6InfoLength - the length of the information for Word 6/7 files
+ */
+static int
+iGet6InfoLength(int iByteNbr, const UCHAR *aucGrpprl)
+{
+	int	iTmp, iDel, iAdd;
+
+	switch (ucGetByte(iByteNbr, aucGrpprl)) {
+	case   2: case  16: case  17: case  18: case  19: case  21: case  22:
+	case  26: case  27: case  28: case  30: case  31: case  32: case  33:
+	case  34: case  35: case  36: case  38: case  39: case  40: case  41:
+	case  42: case  43: case  45: case  46: case  47: case  48: case  49:
+	case  69: case  72: case  80: case  93: case  96: case  97: case  99:
+	case 101: case 105: case 106: case 107: case 109: case 110: case 121:
+	case 122: case 123: case 124: case 140: case 141: case 144: case 145:
+	case 148: case 149: case 154: case 155: case 156: case 157: case 160:
+	case 161: case 164: case 165: case 166: case 167: case 168: case 169:
+	case 170: case 171: case 182: case 183: case 184: case 189: case 195:
+	case 197: case 198:
+		return 1 + 2;
+	case   3: case  12: case  15: case  81: case 103: case 108: case 188:
+	case 190: case 191:
+		return 2 + (int)ucGetByte(iByteNbr + 1, aucGrpprl);
+	case  20: case  70: case  74: case 192: case 194: case 196: case 200:
+		return 1 + 4;
+	case  23:
+		iTmp = (int)ucGetByte(iByteNbr + 1, aucGrpprl);
+		if (iTmp == 255) {
+			iDel = (int)ucGetByte(iByteNbr + 2, aucGrpprl);
+			iAdd = (int)ucGetByte(
+					iByteNbr + 3 + iDel * 4, aucGrpprl);
+			iTmp = 2 + iDel * 4 + iAdd * 3;
+		}
+		return 2 + iTmp;
+	case  68: case 193: case 199:
+		return 1 + 5;
+	case  73: case  95: case 136: case 137:
+		return 1 + 3;
+	case 120:
+		return 1 + 13;
+	case 187:
+		return 1 + 12;
+	default:
+		return 1 + 1;
+	}
+} /* end of iGet6InfoLength */
+
+/*
+ * Fill the section information block with information
+ * from a Word 6/7 file.
+ */
+static void
+vGet6SectionInfo(const UCHAR *aucGrpprl, size_t tBytes,
+		section_block_type *pSection)
+{
+	UINT	uiIndex;
+	int	iFodoOff, iInfoLen, iSize, iTmp;
+	USHORT	usCcol;
+	UCHAR	ucTmp;
+
+	fail(aucGrpprl == NULL || pSection == NULL);
+
+	iFodoOff = 0;
+	while (tBytes >= (size_t)iFodoOff + 1) {
+		iInfoLen = 0;
+		switch (ucGetByte(iFodoOff, aucGrpprl)) {
+		case 133:	/* olstAnm */
+			iSize = (int)ucGetByte(iFodoOff + 1, aucGrpprl);
+			DBG_DEC_C(iSize != 212, iSize);
+			for (uiIndex = 0, iTmp = iFodoOff + 2;
+			     uiIndex < 9 && iTmp < iFodoOff + 2 + iSize - 15;
+			     uiIndex++, iTmp += 16) {
+				pSection->aucNFC[uiIndex] =
+						ucGetByte(iTmp, aucGrpprl);
+				NO_DBG_DEC(pSection->aucNFC[uiIndex]);
+				ucTmp = ucGetByte(iTmp + 3, aucGrpprl);
+				NO_DBG_HEX(ucTmp);
+				if ((ucTmp & BIT(2)) != 0) {
+					pSection->usNeedPrevLvl |=
+							(USHORT)BIT(uiIndex);
+				}
+				if ((ucTmp & BIT(3)) != 0) {
+					pSection->usHangingIndent |=
+							(USHORT)BIT(uiIndex);
+				}
+			}
+			DBG_HEX(pSection->usNeedPrevLvl);
+			DBG_HEX(pSection->usHangingIndent);
+			break;
+		case 142:	/* bkc */
+			ucTmp = ucGetByte(iFodoOff + 1, aucGrpprl);
+			DBG_DEC(ucTmp);
+			pSection->bNewPage = ucTmp != 0 && ucTmp != 1;
+			break;
+		case 144:	/* ccolM1 */
+			usCcol = 1 + usGetWord(iFodoOff + 1, aucGrpprl);
+			DBG_DEC(usCcol);
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen = iGet6InfoLength(iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet6SectionInfo */
+
+/*
+ * Build the lists with Section Property Information for Word 6/7 files
+ */
+void
+vGet6SepInfo(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const UCHAR *aucHeader)
+{
+	section_block_type	tSection;
+	ULONG		*aulSectPage, *aulTextOffset;
+	UCHAR	*aucBuffer, *aucFpage;
+	ULONG	ulBeginSectInfo;
+	size_t	tSectInfoLen, tOffset, tLen, tBytes;
+	int	iIndex;
+	UCHAR	aucTmp[2];
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	ulBeginSectInfo = ulGetLong(0x88, aucHeader); /* fcPlcfsed */
+	DBG_HEX(ulBeginSectInfo);
+	tSectInfoLen = (size_t)ulGetLong(0x8c, aucHeader); /* lcbPlcfsed */
+	DBG_DEC(tSectInfoLen);
+	if (tSectInfoLen < 4) {
+		DBG_DEC(tSectInfoLen);
+		return;
+	}
+
+	aucBuffer = xmalloc(tSectInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginSectInfo, tSectInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tSectInfoLen);
+
+	/* Read the Section Descriptors */
+	tLen = (tSectInfoLen - 4) / 16;
+	/* Save the section offsets */
+	aulTextOffset = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = 0;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 4) {
+		aulTextOffset[iIndex] = ulGetLong(tOffset, aucBuffer);
+	}
+	/* Save the Sepx offsets */
+	aulSectPage = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 12) {
+		aulSectPage[iIndex] = ulGetLong(tOffset + 2, aucBuffer);
+		NO_DBG_HEX(aulSectPage[iIndex]); /* fcSepx */
+	}
+	aucBuffer = xfree(aucBuffer);
+
+	/* Read the Section Properties */
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (aulSectPage[iIndex] == FC_INVALID) {
+			vDefault2SectionInfoList(aulTextOffset[iIndex]);
+			continue;
+		}
+		/* Get the number of bytes to read */
+		if (!bReadBuffer(pFile, ulStartBlock,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucTmp, aulSectPage[iIndex], 2)) {
+			continue;
+		}
+		tBytes = 2 + (size_t)usGetWord(0, aucTmp);
+		NO_DBG_DEC(tBytes);
+		/* Read the bytes */
+		aucFpage = xmalloc(tBytes);
+		if (!bReadBuffer(pFile, ulStartBlock,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucFpage, aulSectPage[iIndex], tBytes)) {
+			aucFpage = xfree(aucFpage);
+			continue;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, tBytes);
+		/* Process the bytes */
+		vGetDefaultSection(&tSection);
+		vGet6SectionInfo(aucFpage + 2, tBytes - 2, &tSection);
+		vAdd2SectionInfoList(&tSection, aulTextOffset[iIndex]);
+		aucFpage = xfree(aucFpage);
+	}
+	aulTextOffset = xfree(aulTextOffset);
+	aulSectPage = xfree(aulSectPage);
+} /* end of vGet6SepInfo */
+
+/*
+ * Translate the rowinfo to a member of the row_info enumeration
+ */
+row_info_enum
+eGet6RowInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, row_block_type *pRow)
+{
+	int	iFodoOff, iInfoLen;
+	int	iIndex, iSize, iCol;
+	int	iPosCurr, iPosPrev;
+	USHORT	usTmp;
+	BOOL	bFound24_0, bFound24_1, bFound25_0, bFound25_1, bFound190;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pRow == NULL);
+
+	iFodoOff = 0;
+	bFound24_0 = FALSE;
+	bFound24_1 = FALSE;
+	bFound25_0 = FALSE;
+	bFound25_1 = FALSE;
+	bFound190 = FALSE;
+	while (iBytes >= iFodoOff + 1) {
+		iInfoLen = 0;
+		switch (ucGetByte(iFodo + iFodoOff, aucGrpprl)) {
+		case  24:	/* fIntable */
+			if (odd(ucGetByte(iFodo + iFodoOff + 1, aucGrpprl))) {
+				bFound24_1 = TRUE;
+			} else {
+				bFound24_0 = TRUE;
+			}
+			break;
+		case  25:	/* fTtp */
+			if (odd(ucGetByte(iFodo + iFodoOff + 1, aucGrpprl))) {
+				bFound25_1 = TRUE;
+			} else {
+				bFound25_0 = TRUE;
+			}
+			break;
+		case 38:	/* brcTop */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_TOP;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_TOP;
+			}
+			break;
+		case 39:	/* brcLeft */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_LEFT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_LEFT;
+			}
+			break;
+		case 40:	/* brcBottom */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_BOTTOM;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_BOTTOM;
+			}
+			break;
+		case 41:	/* brcRight */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			usTmp &= 0x0018;
+			NO_DBG_DEC(usTmp >> 3);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_RIGHT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_RIGHT;
+			}
+			break;
+		case 190:	/* cDefTable */
+			iSize = (int)usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			if (iSize < 6 || iBytes < iFodoOff + 7) {
+				DBG_DEC(iSize);
+				DBG_DEC(iFodoOff);
+				iInfoLen = 1;
+				break;
+			}
+			iCol = (int)ucGetByte(iFodo + iFodoOff + 3, aucGrpprl);
+			if (iCol < 1 ||
+			    iBytes < iFodoOff + 3 + (iCol + 1) * 2) {
+				DBG_DEC(iCol);
+				DBG_DEC(iFodoOff);
+				iInfoLen = 1;
+				break;
+			}
+			if (iCol >= (int)elementsof(pRow->asColumnWidth)) {
+				DBG_DEC(iCol);
+				werr(1, "The number of columns is corrupt");
+			}
+			pRow->ucNumberOfColumns = (UCHAR)iCol;
+			pRow->iColumnWidthSum = 0;
+			iPosPrev = (int)(short)usGetWord(
+					iFodo + iFodoOff + 4,
+					aucGrpprl);
+			for (iIndex = 0; iIndex < iCol; iIndex++) {
+				iPosCurr = (int)(short)usGetWord(
+					iFodo + iFodoOff + 6 + iIndex * 2,
+					aucGrpprl);
+				pRow->asColumnWidth[iIndex] =
+						(short)(iPosCurr - iPosPrev);
+				pRow->iColumnWidthSum +=
+					pRow->asColumnWidth[iIndex];
+				iPosPrev = iPosCurr;
+			}
+			bFound190 = TRUE;
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen =
+				iGet6InfoLength(iFodo + iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+	if (bFound24_1 && bFound25_1 && bFound190) {
+		return found_end_of_row;
+	}
+	if (bFound24_0 && bFound25_0 && !bFound190) {
+		return found_not_end_of_row;
+	}
+	if (bFound24_1) {
+		return found_a_cell;
+	}
+	if (bFound24_0) {
+		return found_not_a_cell;
+	}
+	return found_nothing;
+} /* end of eGet6RowInfo */
+
+/*
+ * Fill the style information block with information
+ * from a Word 6/7 file.
+ */
+void
+vGet6StyleInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, style_block_type *pStyle)
+{
+	int	iFodoOff, iInfoLen;
+	int	iTmp, iDel, iAdd, iBefore;
+	short	sTmp;
+	UCHAR	ucTmp;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pStyle == NULL);
+
+	NO_DBG_DEC(pStyle->usIstd);
+
+	iFodoOff = 0;
+	while (iBytes >= iFodoOff + 1) {
+		iInfoLen = 0;
+		switch (ucGetByte(iFodo + iFodoOff, aucGrpprl)) {
+		case   2:	/* istd */
+			sTmp = (short)ucGetByte(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(sTmp);
+			break;
+		case   5:	/* jc */
+			pStyle->ucAlignment = ucGetByte(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			break;
+		case  12:	/* anld */
+			iTmp = (int)ucGetByte(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			DBG_DEC_C(iTmp < 52, iTmp);
+			if (iTmp >= 1) {
+				pStyle->ucNFC = ucGetByte(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			}
+			if (pStyle->ucNFC != LIST_BULLETS && iTmp >= 2) {
+				iBefore = (int)ucGetByte(
+					iFodo + iFodoOff + 3, aucGrpprl);
+			} else {
+				iBefore = 0;
+			}
+			if (iTmp >= 12) {
+				pStyle->usStartAt = usGetWord(
+					iFodo + iFodoOff + 12, aucGrpprl);
+			}
+			if (iTmp >= iBefore + 21) {
+				pStyle->usListChar = (USHORT)ucGetByte(
+					iFodo + iFodoOff + iBefore + 22,
+					aucGrpprl);
+				NO_DBG_HEX(pStyle->usListChar);
+			}
+			break;
+		case  13:	/* nLvlAnm */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			pStyle->ucNumLevel = ucTmp;
+			pStyle->bNumPause =
+				eGetNumType(ucTmp) == level_type_pause;
+			break;
+		case  15:	/* ChgTabsPapx */
+			iTmp = (int)ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (iTmp < 2) {
+				iInfoLen = 1;
+				break;
+			}
+			NO_DBG_DEC(iTmp);
+			iDel = (int)ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (iTmp < 2 + 2 * iDel) {
+				iInfoLen = 1;
+				break;
+			}
+			NO_DBG_DEC(iDel);
+			iAdd = (int)ucGetByte(
+				iFodo + iFodoOff + 3 + 2 * iDel, aucGrpprl);
+			if (iTmp < 2 + 2 * iDel + 2 * iAdd) {
+				iInfoLen = 1;
+				break;
+			}
+			NO_DBG_DEC(iAdd);
+			break;
+		case  16:	/* dxaRight */
+			pStyle->sRightIndent = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->sRightIndent);
+			break;
+		case  17:	/* dxaLeft */
+			pStyle->sLeftIndent = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->sLeftIndent);
+			break;
+		case  18:	/* Nest dxaLeft */
+			sTmp = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			pStyle->sLeftIndent += sTmp;
+			if (pStyle->sLeftIndent < 0) {
+				pStyle->sLeftIndent = 0;
+			}
+			NO_DBG_DEC(sTmp);
+			NO_DBG_DEC(pStyle->sLeftIndent);
+			break;
+		case  19:	/* dxaLeft1 */
+			pStyle->sLeftIndent1 = (short)usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->sLeftIndent1);
+			break;
+		case  21:	/* dyaBefore */
+			pStyle->usBeforeIndent = usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->usBeforeIndent);
+			break;
+		case  22:	/* dyaAfter */
+			pStyle->usAfterIndent = usGetWord(
+					iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(pStyle->usAfterIndent);
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen =
+				iGet6InfoLength(iFodo + iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet6StyleInfo */
+
+/*
+ * Build the lists with Paragraph Information for Word 6/7 files
+ */
+void
+vGet6PapInfo(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const UCHAR *aucHeader)
+{
+	row_block_type		tRow;
+	style_block_type	tStyle;
+	USHORT	*ausParfPage;
+	UCHAR	*aucBuffer;
+	ULONG	ulCharPos, ulCharPosFirst, ulCharPosLast;
+	ULONG	ulBeginParfInfo;
+	size_t	tParfInfoLen, tParfPageNum, tOffset, tSize, tLenOld, tLen;
+	int	iIndex, iIndex2, iRun, iFodo, iLen;
+	row_info_enum	eRowInfo;
+	USHORT	usParfFirstPage, usCount, usIstd;
+	UCHAR	aucFpage[BIG_BLOCK_SIZE];
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	ulBeginParfInfo = ulGetLong(0xc0, aucHeader); /* fcPlcfbtePapx */
+	NO_DBG_HEX(ulBeginParfInfo);
+	tParfInfoLen = (size_t)ulGetLong(0xc4, aucHeader); /* lcbPlcfbtePapx */
+	NO_DBG_DEC(tParfInfoLen);
+	if (tParfInfoLen < 4) {
+		DBG_DEC(tParfInfoLen);
+		return;
+	}
+
+	aucBuffer = xmalloc(tParfInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginParfInfo, tParfInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tParfInfoLen);
+
+	tLen = (tParfInfoLen - 4) / 6;
+	ausParfPage = xcalloc(tLen, sizeof(USHORT));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 2) {
+		 ausParfPage[iIndex] = usGetWord(tOffset, aucBuffer);
+		 NO_DBG_DEC(ausParfPage[iIndex]);
+	}
+	DBG_HEX(ulGetLong(0, aucBuffer));
+	aucBuffer = xfree(aucBuffer);
+	tParfPageNum = (size_t)usGetWord(0x190, aucHeader); /* cpnBtePap */
+	DBG_DEC(tParfPageNum);
+	if (tLen < tParfPageNum) {
+		/* Replace ParfPage by a longer version */
+		tLenOld = tLen;
+		usParfFirstPage = usGetWord(0x18c, aucHeader); /* pnPapFirst */
+		DBG_DEC(usParfFirstPage);
+		tLen += tParfPageNum - 1;
+		tSize = tLen * sizeof(USHORT);
+		ausParfPage = xrealloc(ausParfPage, tSize);
+		/* Add new values */
+		usCount = usParfFirstPage + 1;
+		for (iIndex = (int)tLenOld; iIndex < (int)tLen; iIndex++) {
+			ausParfPage[iIndex] = usCount;
+			NO_DBG_DEC(ausParfPage[iIndex]);
+			usCount++;
+		}
+	}
+
+	(void)memset(&tRow, 0, sizeof(tRow));
+	ulCharPosFirst = CP_INVALID;
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (!bReadBuffer(pFile, ulStartBlock,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucFpage,
+				(ULONG)ausParfPage[iIndex] * BIG_BLOCK_SIZE,
+				BIG_BLOCK_SIZE)) {
+			break;
+		}
+		iRun = (int)ucGetByte(0x1ff, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) {
+			NO_DBG_HEX(ulGetLong(iIndex2 * 4, aucFpage));
+			iFodo = 2 * (int)ucGetByte(
+				(iRun + 1) * 4 + iIndex2 * 7, aucFpage);
+			if (iFodo <= 0) {
+				continue;
+			}
+
+			iLen = 2 * (int)ucGetByte(iFodo, aucFpage);
+
+			usIstd = (USHORT)ucGetByte(iFodo + 1, aucFpage);
+			vFillStyleFromStylesheet(usIstd, &tStyle);
+			vGet6StyleInfo(iFodo, aucFpage + 3, iLen - 3, &tStyle);
+			ulCharPos = ulGetLong(iIndex2 * 4, aucFpage);
+			NO_DBG_HEX(ulCharPos);
+			tStyle.ulFileOffset = ulCharPos2FileOffset(ulCharPos);
+			vAdd2StyleInfoList(&tStyle);
+
+			eRowInfo = eGet6RowInfo(iFodo,
+					aucFpage + 3, iLen - 3, &tRow);
+			switch(eRowInfo) {
+			case found_a_cell:
+				if (ulCharPosFirst != CP_INVALID) {
+					break;
+				}
+				ulCharPosFirst = ulGetLong(
+						iIndex2 * 4, aucFpage);
+				NO_DBG_HEX(ulCharPosFirst);
+				tRow.ulCharPosStart = ulCharPosFirst;
+				tRow.ulFileOffsetStart =
+					ulCharPos2FileOffset(ulCharPosFirst);
+				DBG_HEX_C(tRow.ulFileOffsetStart == FC_INVALID,
+							ulCharPosFirst);
+				break;
+			case found_end_of_row:
+				ulCharPosLast = ulGetLong(
+						iIndex2 * 4, aucFpage);
+				NO_DBG_HEX(ulCharPosLast);
+				tRow.ulCharPosEnd = ulCharPosLast;
+				tRow.ulFileOffsetEnd = ulCharPos2FileOffset(
+							ulCharPosLast);
+				DBG_HEX_C(tRow.ulFileOffsetEnd == FC_INVALID,
+							ulCharPosLast);
+				vAdd2RowInfoList(&tRow);
+				(void)memset(&tRow, 0, sizeof(tRow));
+				ulCharPosFirst = CP_INVALID;
+				break;
+			case found_nothing:
+				break;
+			default:
+				DBG_DEC(eRowInfo);
+				break;
+			}
+		}
+	}
+	ausParfPage = xfree(ausParfPage);
+} /* end of vGet6PapInfo */
+
+/*
+ * Fill the font information block with information
+ * from a Word 6/7 file.
+ * Returns TRUE when successful, otherwise FALSE
+ */
+void
+vGet6FontInfo(int iFodo, USHORT usIstd,
+	const UCHAR *aucGrpprl, int iBytes, font_block_type *pFont)
+{
+	long	lTmp;
+	int	iFodoOff, iInfoLen;
+	USHORT	usTmp;
+	UCHAR	ucTmp;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL);
+
+	iFodoOff = 0;
+	while (iBytes >= iFodoOff + 1) {
+		switch (ucGetByte(iFodo + iFodoOff, aucGrpprl)) {
+		case  65:	/* fRMarkDel */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (ucTmp == 0) {
+				pFont->usFontStyle &= ~FONT_MARKDEL;
+			} else {
+				pFont->usFontStyle |= FONT_MARKDEL;
+			}
+			break;
+		case  80:	/* cIstd */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			NO_DBG_DEC(usTmp);
+                        break;
+		case  82:	/* cDefault */
+			pFont->usFontStyle &= FONT_HIDDEN;
+			pFont->ucFontColor = FONT_COLOR_DEFAULT;
+			break;
+		case  83:	/* cPlain */
+			DBG_MSG("83: cPlain");
+			vFillFontFromStylesheet(usIstd, pFont);
+			break;
+		case  85:	/* fBold */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_BOLD;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_BOLD;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_BOLD;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case  86:	/* fItalic */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_ITALIC;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_ITALIC;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_ITALIC;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case  87:	/* fStrike */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_STRIKE;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_STRIKE;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_STRIKE;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case  90:	/* fSmallCaps */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_SMALL_CAPITALS;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_SMALL_CAPITALS;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_SMALL_CAPITALS;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case  91:	/* fCaps */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_CAPITALS;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_CAPITALS;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_CAPITALS;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case  92:	/* fVanish */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_HIDDEN;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_HIDDEN;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_HIDDEN;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case  93:	/* cFtc */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			if (usTmp <= (USHORT)UCHAR_MAX) {
+				pFont->ucFontNumber = (UCHAR)usTmp;
+			} else {
+				pFont->ucFontNumber = 0;
+			}
+			break;
+		case  94:	/* cKul */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (ucTmp == 0 || ucTmp == 5) {
+				pFont->usFontStyle &= ~FONT_UNDERLINE;
+			} else {
+				NO_DBG_MSG("Underline text");
+				pFont->usFontStyle |= FONT_UNDERLINE;
+				if (ucTmp == 6) {
+					DBG_MSG("Bold text");
+					pFont->usFontStyle |= FONT_BOLD;
+				}
+			}
+			break;
+		case  95:	/* cHps, cHpsPos */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (ucTmp != 0) {
+				pFont->usFontSize = (USHORT)ucTmp;
+			}
+			DBG_DEC(ucTmp);
+			break;
+		case  98:	/* cIco */
+			pFont->ucFontColor =
+				ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			break;
+		case  99:	/* cHps */
+			pFont->usFontSize =
+				usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			break;
+		case 104:	/* cIss */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			ucTmp &= 0x07;
+			if (ucTmp == 1) {
+				pFont->usFontStyle |= FONT_SUPERSCRIPT;
+				NO_DBG_MSG("Superscript");
+			} else if (ucTmp == 2) {
+				pFont->usFontStyle |= FONT_SUBSCRIPT;
+				NO_DBG_MSG("Subscript");
+			}
+			break;
+		case 106:	/* cHps */
+			usTmp = usGetWord(iFodo + iFodoOff + 1, aucGrpprl);
+			lTmp = (long)pFont->usFontSize + (long)usTmp;
+			if (lTmp < 8) {
+				pFont->usFontSize = 8;
+			} else if (lTmp > 32766) {
+				pFont->usFontSize = 32766;
+			} else {
+				pFont->usFontSize = (USHORT)lTmp;
+			}
+			break;
+		default:
+			break;
+		}
+		iInfoLen = iGet6InfoLength(iFodo + iFodoOff, aucGrpprl);
+		fail(iInfoLen <= 0);
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet6FontInfo */
+
+/*
+ * Fill the picture information block with information
+ * from a Word 6/7 file.
+ * Returns TRUE when successful, otherwise FALSE
+ */
+static BOOL
+bGet6PicInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, picture_block_type *pPicture)
+{
+	int	iFodoOff, iInfoLen;
+	BOOL	bFound;
+	UCHAR	ucTmp;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pPicture == NULL);
+
+	iFodoOff = 0;
+	bFound = FALSE;
+	while (iBytes >= iFodoOff + 1) {
+		switch (ucGetByte(iFodo + iFodoOff, aucGrpprl)) {
+		case  68:	/* fcPic */
+			pPicture->ulPictureOffset = ulGetLong(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			bFound = TRUE;
+			break;
+		case  71:	/* dttm */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (ucTmp == 0x01) {
+				/* Not a picture, but a form field */
+				return FALSE;
+			}
+			DBG_DEC_C(ucTmp != 0, ucTmp);
+			break;
+		case  75:	/* fOle2 */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 1, aucGrpprl);
+			if (ucTmp == 0x01) {
+				/* Not a picture, but an OLE object */
+				return FALSE;
+			}
+			DBG_DEC_C(ucTmp != 0, ucTmp);
+			break;
+		default:
+			break;
+		}
+		iInfoLen = iGet6InfoLength(iFodo + iFodoOff, aucGrpprl);
+		fail(iInfoLen <= 0);
+		iFodoOff += iInfoLen;
+	}
+	return bFound;
+} /* end of bGet6PicInfo */
+
+/*
+ * Build the lists with Character Information for Word 6/7 files
+ */
+void
+vGet6ChrInfo(FILE *pFile, ULONG ulStartBlock,
+	const ULONG *aulBBD, size_t tBBDLen, const UCHAR *aucHeader)
+{
+	font_block_type		tFont;
+	picture_block_type	tPicture;
+	USHORT	*ausCharPage;
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulCharPos, ulBeginCharInfo;
+	size_t	tCharInfoLen, tOffset, tSize, tLenOld, tLen, tCharPageNum;
+	int	iIndex, iIndex2, iRun, iFodo, iLen;
+	USHORT	usCharFirstPage, usCount, usIstd;
+	UCHAR	aucFpage[BIG_BLOCK_SIZE];
+
+	fail(pFile == NULL || aucHeader == NULL);
+	fail(ulStartBlock > MAX_BLOCKNUMBER && ulStartBlock != END_OF_CHAIN);
+	fail(aulBBD == NULL);
+
+	ulBeginCharInfo = ulGetLong(0xb8, aucHeader); /* fcPlcfbteChpx */
+	NO_DBG_HEX(lBeginCharInfo);
+	tCharInfoLen = (size_t)ulGetLong(0xbc, aucHeader); /* lcbPlcfbteChpx */
+	NO_DBG_DEC(tCharInfoLen);
+	if (tCharInfoLen < 4) {
+		DBG_DEC(tCharInfoLen);
+		return;
+	}
+
+	aucBuffer = xmalloc(tCharInfoLen);
+	if (!bReadBuffer(pFile, ulStartBlock,
+			aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+			aucBuffer, ulBeginCharInfo, tCharInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+
+	tLen = (tCharInfoLen - 4) / 6;
+	ausCharPage = xcalloc(tLen, sizeof(USHORT));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 2) {
+		 ausCharPage[iIndex] = usGetWord(tOffset, aucBuffer);
+		 NO_DBG_DEC(ausCharPage[iIndex]);
+	}
+	DBG_HEX(ulGetLong(0, aucBuffer));
+	aucBuffer = xfree(aucBuffer);
+	tCharPageNum = (size_t)usGetWord(0x18e, aucHeader); /* cpnBteChp */
+	DBG_DEC(tCharPageNum);
+	if (tLen < tCharPageNum) {
+		/* Replace CharPage by a longer version */
+		tLenOld = tLen;
+		usCharFirstPage = usGetWord(0x18a, aucHeader); /* pnChrFirst */
+		DBG_DEC(usCharFirstPage);
+		tLen += tCharPageNum - 1;
+		tSize = tLen * sizeof(USHORT);
+		ausCharPage = xrealloc(ausCharPage, tSize);
+		/* Add new values */
+		usCount = usCharFirstPage + 1;
+		for (iIndex = (int)tLenOld; iIndex < (int)tLen; iIndex++) {
+			ausCharPage[iIndex] = usCount;
+			NO_DBG_DEC(ausCharPage[iIndex]);
+			usCount++;
+		}
+	}
+
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (!bReadBuffer(pFile, ulStartBlock,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucFpage,
+				(ULONG)ausCharPage[iIndex] * BIG_BLOCK_SIZE,
+				BIG_BLOCK_SIZE)) {
+			break;
+		}
+		iRun = (int)ucGetByte(0x1ff, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) {
+		  	ulCharPos = ulGetLong(iIndex2 * 4, aucFpage);
+			ulFileOffset = ulCharPos2FileOffset(ulCharPos);
+			iFodo = 2 * (int)ucGetByte(
+				(iRun + 1) * 4 + iIndex2, aucFpage);
+
+			iLen = (int)ucGetByte(iFodo, aucFpage);
+
+			usIstd = usGetIstd(ulFileOffset);
+			vFillFontFromStylesheet(usIstd, &tFont);
+			if (iFodo != 0) {
+				vGet6FontInfo(iFodo, usIstd,
+					aucFpage + 1, iLen - 1, &tFont);
+			}
+			tFont.ulFileOffset = ulFileOffset;
+			vAdd2FontInfoList(&tFont);
+
+			if (iFodo <= 0) {
+				continue;
+			}
+
+			(void)memset(&tPicture, 0, sizeof(tPicture));
+			if (bGet6PicInfo(iFodo, aucFpage + 1,
+						iLen - 1, &tPicture)) {
+				tPicture.ulFileOffset = ulFileOffset;
+				tPicture.ulFileOffsetPicture =
+					ulDataPos2FileOffset(
+						tPicture.ulPictureOffset);
+				vAdd2PictInfoList(&tPicture);
+			}
+		}
+	}
+	ausCharPage = xfree(ausCharPage);
+} /* end of vGet6ChrInfo */

+ 1356 - 0
sys/src/cmd/aux/antiword/prop8.c

@@ -0,0 +1,1356 @@
+/*
+ * prop8.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Read the property information from a MS Word 8, 9 or 10 file
+ *
+ * Word  8 is better known as Word 97 or as Word 98 for Mac
+ * Word  9 is better known as Word 2000 or as Word 2001 for Mac
+ * Word 10 is better known as Word 2002 or as Word XP
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "antiword.h"
+
+#define DEFAULT_LISTCHAR	0x002e	/* A full stop */
+
+
+/*
+ * iGet8InfoLength - the length of the information for Word 8/9/10 files
+ */
+static int
+iGet8InfoLength(int iByteNbr, const UCHAR *aucGrpprl)
+{
+	int	iTmp, iDel, iAdd;
+	USHORT	usOpCode;
+
+	usOpCode = usGetWord(iByteNbr, aucGrpprl);
+
+	switch (usOpCode & 0xe000) {
+	case 0x0000: case 0x2000:
+		return 3;
+	case 0x4000: case 0x8000: case 0xa000:
+		return 4;
+	case 0xe000:
+		return 5;
+	case 0x6000:
+		return 6;
+	case 0xc000:
+		iTmp = (int)ucGetByte(iByteNbr + 2, aucGrpprl);
+		if (usOpCode == 0xc615 && iTmp == 255) {
+			iDel = (int)ucGetByte(iByteNbr + 3, aucGrpprl);
+			iAdd = (int)ucGetByte(
+					iByteNbr + 4 + iDel * 4, aucGrpprl);
+			iTmp = 2 + iDel * 4 + iAdd * 3;
+		}
+		return 3 + iTmp;
+	default:
+		DBG_HEX(usOpCode);
+		DBG_FIXME();
+		return 1;
+	}
+} /* end of iGet8InfoLength */
+
+/*
+ * Fill the section information block with information
+ * from a Word 8/9/10 file.
+ */
+static void
+vGet8SectionInfo(const UCHAR *aucGrpprl, size_t tBytes,
+		section_block_type *pSection)
+{
+	UINT	uiIndex;
+	int	iFodoOff, iInfoLen, iSize, iTmp;
+	USHORT	usCcol;
+	UCHAR	ucTmp;
+
+	fail(aucGrpprl == NULL || pSection == NULL);
+
+	iFodoOff = 0;
+	while (tBytes >= (size_t)iFodoOff + 2) {
+		iInfoLen = 0;
+		switch (usGetWord(iFodoOff, aucGrpprl)) {
+		case 0x3009:	/* bkc */
+			ucTmp = ucGetByte(iFodoOff + 2, aucGrpprl);
+			DBG_DEC(ucTmp);
+			pSection->bNewPage = ucTmp != 0 && ucTmp != 1;
+			break;
+		case 0x500b:	/* ccolM1 */
+			usCcol = 1 + usGetWord(iFodoOff + 2, aucGrpprl);
+			DBG_DEC(usCcol);
+			break;
+		case 0xd202:	/* olstAnm */
+			iSize = (int)ucGetByte(iFodoOff + 2, aucGrpprl);
+			DBG_DEC_C(iSize != 212, iSize);
+			for (uiIndex = 0, iTmp = iFodoOff + 3;
+			     uiIndex < 9 && iTmp < iFodoOff + 3 + iSize - 15;
+			     uiIndex++, iTmp += 16) {
+				pSection->aucNFC[uiIndex] =
+						ucGetByte(iTmp, aucGrpprl);
+				DBG_DEC(pSection->aucNFC[uiIndex]);
+				ucTmp = ucGetByte(iTmp + 3, aucGrpprl);
+				DBG_HEX(ucTmp);
+				if ((ucTmp & BIT(2)) != 0) {
+					pSection->usNeedPrevLvl |=
+							(USHORT)BIT(uiIndex);
+				}
+				if ((ucTmp & BIT(3)) != 0) {
+					pSection->usHangingIndent |=
+							(USHORT)BIT(uiIndex);
+				}
+			}
+			DBG_HEX(pSection->usNeedPrevLvl);
+			DBG_HEX(pSection->usHangingIndent);
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen = iGet8InfoLength(iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet8SectionInfo */
+
+/*
+ * Build the lists with Section Property Information for Word 8/9/10 files
+ */
+void
+vGet8SepInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	section_block_type	tSection;
+	ULONG		*aulSectPage, *aulTextOffset;
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucBuffer, *aucFpage;
+	ULONG	ulBeginSectInfo;
+	ULONG	ulTableSize, ulTableStartBlock;
+	size_t	tSectInfoLen, tBlockDepotLen;
+	size_t	tBlockSize, tOffset, tLen, tBytes;
+	int	iIndex;
+	USHORT	usDocStatus;
+	UCHAR	aucTmp[2];
+
+	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
+	fail(aulBBD == NULL || aulSBD == NULL);
+
+	ulBeginSectInfo = ulGetLong(0xca, aucHeader); /* fcPlcfsed */
+	NO_DBG_HEX(ulBeginSectInfo);
+	tSectInfoLen = (size_t)ulGetLong(0xce, aucHeader); /* lcbPlcfsed */
+	NO_DBG_DEC(tSectInfoLen);
+	if (tSectInfoLen < 4) {
+		DBG_DEC(tSectInfoLen);
+		return;
+	}
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_MSG("No section information");
+		return;
+	}
+	DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+		/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+		/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+	aucBuffer = xmalloc(tSectInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginSectInfo, tSectInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tSectInfoLen);
+
+	/* Read the Section Descriptors */
+	tLen = (tSectInfoLen - 4) / 16;
+	/* Save the section offsets */
+	aulTextOffset = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = 0;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 4) {
+		aulTextOffset[iIndex] = ulGetLong(tOffset, aucBuffer);
+	}
+	/* Save the Sepx offsets */
+	aulSectPage = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 12) {
+		 aulSectPage[iIndex] = ulGetLong(tOffset + 2, aucBuffer);
+		 NO_DBG_HEX(aulSectPage[iIndex]); /* fcSepx */
+	}
+	aucBuffer = xfree(aucBuffer);
+
+	/* Read the Section Properties */
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		if (aulSectPage[iIndex] == FC_INVALID) {
+			vDefault2SectionInfoList(aulTextOffset[iIndex]);
+			continue;
+		}
+		/* Get the number of bytes to read */
+		if (!bReadBuffer(pFile, pPPS->tWordDocument.ulSB,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucTmp, aulSectPage[iIndex], 2)) {
+			continue;
+		}
+		tBytes = 2 + (size_t)usGetWord(0, aucTmp);
+		NO_DBG_DEC(tBytes);
+		/* Read the bytes */
+		aucFpage = xmalloc(tBytes);
+		if (!bReadBuffer(pFile, pPPS->tWordDocument.ulSB,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucFpage, aulSectPage[iIndex], tBytes)) {
+			aucFpage = xfree(aucFpage);
+			continue;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, tBytes);
+		/* Process the bytes */
+		vGetDefaultSection(&tSection);
+		vGet8SectionInfo(aucFpage + 2, tBytes - 2, &tSection);
+		vAdd2SectionInfoList(&tSection, aulTextOffset[iIndex]);
+		aucFpage = xfree(aucFpage);
+	}
+	aulTextOffset = xfree(aulTextOffset);
+	aulSectPage = xfree(aulSectPage);
+} /* end of vGet8SepInfo */
+
+/*
+ * Translate the rowinfo to a member of the row_info enumeration
+ */
+row_info_enum
+eGet8RowInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, row_block_type *pRow)
+{
+	int	iFodoOff, iInfoLen;
+	int	iIndex, iSize, iCol;
+	int	iPosCurr, iPosPrev;
+	USHORT	usTmp;
+	BOOL	bFound2416_0, bFound2416_1, bFound2417_0, bFound2417_1;
+	BOOL	bFoundd608;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pRow == NULL);
+
+	iFodoOff = 0;
+	bFound2416_0 = FALSE;
+	bFound2416_1 = FALSE;
+	bFound2417_0 = FALSE;
+	bFound2417_1 = FALSE;
+	bFoundd608 = FALSE;
+	while (iBytes >= iFodoOff + 2) {
+		iInfoLen = 0;
+		switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) {
+		case 0x2416:	/* fIntable */
+			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {
+				bFound2416_1 = TRUE;
+			} else {
+				bFound2416_0 = TRUE;
+			}
+			break;
+		case 0x2417:	/* fTtp */
+			if (odd(ucGetByte(iFodo + iFodoOff + 2, aucGrpprl))) {
+				bFound2417_1 = TRUE;
+			} else {
+				bFound2417_0 = TRUE;
+			}
+			break;
+		case 0x6424:	/* brcTop */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			usTmp &= 0xff00;
+			NO_DBG_DEC(usTmp >> 8);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_TOP;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_TOP;
+			}
+			break;
+		case 0x6425:	/* brcLeft */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			usTmp &= 0xff00;
+			NO_DBG_DEC(usTmp >> 8);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_LEFT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_LEFT;
+			}
+			break;
+		case 0x6426:	/* brcBottom */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			usTmp &= 0xff00;
+			NO_DBG_DEC(usTmp >> 8);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_BOTTOM;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_BOTTOM;
+			}
+			break;
+		case 0x6427:	/* brcRight */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			usTmp &= 0xff00;
+			NO_DBG_DEC(usTmp >> 8);
+			if (usTmp == 0) {
+				pRow->ucBorderInfo &= ~TABLE_BORDER_RIGHT;
+			} else {
+				pRow->ucBorderInfo |= TABLE_BORDER_RIGHT;
+			}
+			break;
+		case 0xd608:	/* cDefTable */
+			iSize = (int)usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			if (iSize < 6 || iBytes < iFodoOff + 8) {
+				DBG_DEC(iSize);
+				DBG_DEC(iFodoOff);
+				iInfoLen = 2;
+				break;
+			}
+			iCol = (int)ucGetByte(iFodo + iFodoOff + 4, aucGrpprl);
+			if (iCol < 1 ||
+			    iBytes < iFodoOff + 4 + (iCol + 1) * 2) {
+				DBG_DEC(iCol);
+				DBG_DEC(iFodoOff);
+				iInfoLen = 2;
+				break;
+			}
+			if (iCol >= (int)elementsof(pRow->asColumnWidth)) {
+				DBG_DEC(iCol);
+				werr(1, "The number of columns is corrupt");
+			}
+			pRow->ucNumberOfColumns = (UCHAR)iCol;
+			pRow->iColumnWidthSum = 0;
+			iPosPrev = (int)(short)usGetWord(
+					iFodo + iFodoOff + 5,
+					aucGrpprl);
+			for (iIndex = 0; iIndex < iCol; iIndex++) {
+				iPosCurr = (int)(short)usGetWord(
+					iFodo + iFodoOff + 7 + iIndex * 2,
+					aucGrpprl);
+				pRow->asColumnWidth[iIndex] =
+						(short)(iPosCurr - iPosPrev);
+				pRow->iColumnWidthSum +=
+					pRow->asColumnWidth[iIndex];
+				iPosPrev = iPosCurr;
+			}
+			bFoundd608 = TRUE;
+			break;
+		default:
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen =
+				iGet8InfoLength(iFodo + iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+	if (bFound2416_1 && bFound2417_1 && bFoundd608) {
+		return found_end_of_row;
+	}
+	if (bFound2416_0 && bFound2417_0 && !bFoundd608) {
+		return found_not_end_of_row;
+	}
+	if (bFound2416_1) {
+		return found_a_cell;
+	}
+	if (bFound2416_0) {
+		return found_not_a_cell;
+	}
+	return found_nothing;
+} /* end of eGet8RowInfo */
+
+/*
+ * Fill the style information block with information
+ * from a Word 8/9/10 file.
+ */
+void
+vGet8StyleInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, style_block_type *pStyle)
+{
+	list_block_type	tList6;
+	const list_block_type	*pList;
+	int	iFodoOff, iInfoLen;
+	int	iTmp, iDel, iAdd, iBefore;
+	USHORT	usOpCode, usTmp;
+	short	sTmp;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pStyle == NULL);
+
+	NO_DBG_DEC_C(pStyle->usListIndex != 0, pStyle->usIstd);
+	NO_DBG_DEC_C(pStyle->usListIndex != 0, pStyle->usListIndex);
+
+	(void)memset(&tList6, 0, sizeof(tList6));
+
+	iFodoOff = 0;
+	while (iBytes >= iFodoOff + 2) {
+		iInfoLen = 0;
+		usOpCode = usGetWord(iFodo + iFodoOff, aucGrpprl);
+		switch (usOpCode) {
+		case 0x2403:	/* jc */
+			pStyle->ucAlignment = ucGetByte(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			break;
+		case 0x260a:	/* ilvl */
+			pStyle->ucListLevel =
+				ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->ucListLevel);
+			pStyle->ucNumLevel = pStyle->ucListLevel;
+			break;
+		case 0x4600:	/* istd */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(usTmp);
+			break;
+		case 0x460b:	/* ilfo */
+			pStyle->usListIndex =
+				usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->usListIndex);
+			break;
+		case 0x4610: /* Nest dxaLeft */
+			sTmp = (short)usGetWord(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			pStyle->sLeftIndent += sTmp;
+			if (pStyle->sLeftIndent < 0) {
+				pStyle->sLeftIndent = 0;
+			}
+			DBG_DEC(sTmp);
+			DBG_DEC(pStyle->sLeftIndent);
+			break;
+		case 0x6c0d:	/* ChgTabsPapx */
+			iTmp = (int)ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (iTmp < 2) {
+				iInfoLen = 1;
+				break;
+			}
+			DBG_DEC(iTmp);
+			iDel = (int)ucGetByte(iFodo + iFodoOff + 3, aucGrpprl);
+			if (iTmp < 2 + 2 * iDel) {
+				iInfoLen = 1;
+				break;
+			}
+			DBG_DEC(iDel);
+			iAdd = (int)ucGetByte(
+				iFodo + iFodoOff + 4 + 2 * iDel, aucGrpprl);
+			if (iTmp < 2 + 2 * iDel + 2 * iAdd) {
+				iInfoLen = 1;
+				break;
+			}
+			DBG_DEC(iAdd);
+			break;
+		case 0x840e:	/* dxaRight */
+			pStyle->sRightIndent = (short)usGetWord(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->sRightIndent);
+			break;
+		case 0x840f:	/* dxaLeft */
+			pStyle->sLeftIndent = (short)usGetWord(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->sLeftIndent);
+			break;
+		case 0x8411:	/* dxaLeft1 */
+			pStyle->sLeftIndent1 = (short)usGetWord(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->sLeftIndent1);
+			break;
+		case 0xa413:	/* dyaBefore */
+			pStyle->usBeforeIndent = usGetWord(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->usBeforeIndent);
+			break;
+		case 0xa414:	/* dyaAfter */
+			pStyle->usAfterIndent = usGetWord(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pStyle->usAfterIndent);
+			break;
+		case 0xc63e:	/* anld */
+			iTmp = (int)ucGetByte(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			DBG_DEC_C(iTmp < 84, iTmp);
+			if (iTmp >= 1) {
+				tList6.ucNFC = ucGetByte(
+					iFodo + iFodoOff + 3, aucGrpprl);
+			}
+			if (tList6.ucNFC != LIST_BULLETS && iTmp >= 2) {
+				iBefore = (int)ucGetByte(
+					iFodo + iFodoOff + 4, aucGrpprl);
+			} else {
+				iBefore = 0;
+			}
+			if (iTmp >= 12) {
+				tList6.ulStartAt = (ULONG)usGetWord(
+					iFodo + iFodoOff + 13, aucGrpprl);
+			}
+			if (iTmp >= iBefore + 22) {
+				tList6.usListChar = usGetWord(
+					iFodo + iFodoOff + iBefore + 23,
+					aucGrpprl);
+				DBG_HEX(tList6.usListChar);
+			}
+			break;
+		default:
+			NO_DBG_HEX(usOpCode);
+			break;
+		}
+		if (iInfoLen <= 0) {
+			iInfoLen =
+				iGet8InfoLength(iFodo + iFodoOff, aucGrpprl);
+			fail(iInfoLen <= 0);
+		}
+		iFodoOff += iInfoLen;
+	}
+
+	if (pStyle->usListIndex == 2047) {
+		/* Old style list */
+		pStyle->usStartAt = (USHORT)tList6.ulStartAt;
+		pStyle->usListChar = tList6.usListChar;
+		pStyle->ucNFC = tList6.ucNFC;
+	} else {
+		/* New style list */
+		pList = pGetListInfo(pStyle->usListIndex, pStyle->ucListLevel);
+		if (pList != NULL) {
+			pStyle->bNoRestart = pList->bNoRestart;
+			fail(pList->ulStartAt > (ULONG)USHRT_MAX);
+			pStyle->usStartAt = (USHORT)pList->ulStartAt;
+			pStyle->usListChar = pList->usListChar;
+			pStyle->ucNFC = pList->ucNFC;
+			if (pStyle->sLeftIndent <= 0) {
+				pStyle->sLeftIndent = pList->sLeftIndent;
+			}
+		}
+	}
+} /* end of vGet8StyleInfo */
+
+/*
+ * Get the left indentation value from the style information block
+ *
+ * Returns the value when found, otherwise 0
+ */
+static short
+sGetLeftIndent(const UCHAR *aucGrpprl, size_t tBytes)
+{
+	int	iOffset, iInfoLen;
+	USHORT	usOpCode, usTmp;
+
+	fail(aucGrpprl == NULL);
+
+	iOffset = 0;
+	while (tBytes >= (size_t)iOffset + 4) {
+		usOpCode = usGetWord(iOffset, aucGrpprl);
+		if (usOpCode == 0x840f) {	/* dxaLeft */
+			usTmp = usGetWord(iOffset + 2, aucGrpprl);
+			if (usTmp <= 0x7fff) {
+				NO_DBG_DEC(usTmp);
+				return (short)usTmp;
+			}
+		}
+		iInfoLen = iGet8InfoLength(iOffset, aucGrpprl);
+		fail(iInfoLen <= 0);
+		iOffset += iInfoLen;
+	}
+	return 0;
+} /* end of sGetLeftIndent */
+
+/*
+ * Build the list with List Information for Word 8/9/10 files
+ */
+void
+vGet8LstInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	list_block_type	tList;
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucLfoInfo, *aucLstfInfo, *aucPapx, *aucXString;
+	ULONG	ulTableStartBlock, ulTableSize;
+	ULONG	ulBeginLfoInfo, ulBeginLstfInfo, ulBeginLvlfInfo;
+	ULONG	ulListID, ulStart;
+	size_t	tBlockDepotLen, tBlockSize;
+	size_t	tLfoInfoLen, tLstfInfoLen, tPapxLen, tXstLen, tOff;
+	size_t	tLstfRecords, tStart, tIndex;
+	int	iNums;
+	USHORT	usDocStatus, usIstd;
+	UCHAR	ucTmp, ucListLevel, ucMaxLevel, ucChpxLen;
+	UCHAR	aucLvlfInfo[28], aucXst[2];
+
+	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
+	fail(aulBBD == NULL || aulSBD == NULL);
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_MSG("No list information");
+		return;
+	}
+	DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+		/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+		/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+
+	/* LFO (List Format Override) */
+	ulBeginLfoInfo = ulGetLong(0x2ea, aucHeader); /* fcPlfLfo */
+	DBG_HEX(ulBeginLfoInfo);
+	tLfoInfoLen = (size_t)ulGetLong(0x2ee, aucHeader); /* lcbPlfLfo */
+	DBG_DEC(tLfoInfoLen);
+	if (tLfoInfoLen == 0) {
+		DBG_MSG("No lists in this document");
+		return;
+	}
+
+	aucLfoInfo = xmalloc(tLfoInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucLfoInfo, ulBeginLfoInfo, tLfoInfoLen)) {
+		aucLfoInfo = xfree(aucLfoInfo);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucLfoInfo, tLfoInfoLen);
+	vBuildLfoList(aucLfoInfo, tLfoInfoLen);
+	aucLfoInfo = xfree(aucLfoInfo);
+
+	/* LSTF (LiST data on File) */
+	ulBeginLstfInfo = ulGetLong(0x2e2, aucHeader); /* fcPlcfLst */
+	DBG_HEX(ulBeginLstfInfo);
+	tLstfInfoLen = (size_t)ulGetLong(0x2e6, aucHeader); /* lcbPlcfLst */
+	DBG_DEC(tLstfInfoLen);
+	if (tLstfInfoLen == 0) {
+		DBG_MSG("No list data on file");
+		return;
+	}
+
+	aucLstfInfo = xmalloc(tLstfInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucLstfInfo, ulBeginLstfInfo, tLstfInfoLen)) {
+		aucLstfInfo = xfree(aucLstfInfo);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucLstfInfo, tLstfInfoLen);
+
+	tLstfRecords = (size_t)usGetWord(0, aucLstfInfo);
+	if (2 + tLstfRecords * 28 < tLstfInfoLen) {
+		DBG_DEC(2 + tLstfRecords * 28);
+		DBG_DEC(tLstfInfoLen);
+		aucLstfInfo = xfree(aucLstfInfo);
+		return;
+	}
+
+	/* LVLF (List leVeL on File) */
+	ulBeginLvlfInfo = ulBeginLstfInfo + tLstfInfoLen;
+	DBG_HEX(ulBeginLvlfInfo);
+
+	aucXString = NULL;
+	ulStart = ulBeginLvlfInfo;
+
+	for (tIndex = 0, tStart = 2;
+	     tIndex < tLstfRecords;
+	     tIndex++, tStart += 28) {
+		ulListID = ulGetLong(tStart, aucLstfInfo);
+		NO_DBG_HEX(ulListID);
+		ucTmp = ucGetByte(tStart + 26, aucLstfInfo);
+		ucMaxLevel = odd(ucTmp) ? 1 : 9;
+		for (ucListLevel = 0; ucListLevel < ucMaxLevel; ucListLevel++) {
+			fail(aucXString != NULL);
+			usIstd = usGetWord(
+					tStart + 8 + 2 * (size_t)ucListLevel,
+					aucLstfInfo);
+			DBG_DEC_C(usIstd != STI_NIL, usIstd);
+			NO_DBG_HEX(ulStart);
+			(void)memset(&tList, 0, sizeof(tList));
+			/* Read the lvlf (List leVeL on File) */
+			if (!bReadBuffer(pFile, ulTableStartBlock,
+					aulBlockDepot, tBlockDepotLen,
+					tBlockSize, aucLvlfInfo,
+					ulStart, sizeof(aucLvlfInfo))) {
+				aucLstfInfo = xfree(aucLstfInfo);
+				return;
+			}
+			NO_DBG_PRINT_BLOCK(aucLvlfInfo, sizeof(aucLvlfInfo));
+			if (bAllZero(aucLvlfInfo, sizeof(aucLvlfInfo))) {
+				tList.ulStartAt = 1;
+				tList.ucNFC = 0x00;
+				tList.bNoRestart = FALSE;
+			} else {
+				tList.ulStartAt = ulGetLong(0, aucLvlfInfo);
+				tList.ucNFC = ucGetByte(4, aucLvlfInfo);
+				ucTmp = ucGetByte(5, aucLvlfInfo);
+				tList.bNoRestart = (ucTmp & BIT(3)) != 0;
+			}
+			ulStart += sizeof(aucLvlfInfo);
+			tPapxLen = (size_t)ucGetByte(25, aucLvlfInfo);
+			if (tPapxLen != 0) {
+				aucPapx = xmalloc(tPapxLen);
+				/* Read the Papx */
+				if (!bReadBuffer(pFile, ulTableStartBlock,
+						aulBlockDepot, tBlockDepotLen,
+						tBlockSize, aucPapx,
+						ulStart, tPapxLen)) {
+					aucPapx = xfree(aucPapx);
+					aucLstfInfo = xfree(aucLstfInfo);
+					return;
+				}
+				NO_DBG_PRINT_BLOCK(aucPapx, tPapxLen);
+				tList.sLeftIndent =
+					sGetLeftIndent(aucPapx, tPapxLen);
+				aucPapx = xfree(aucPapx);
+			}
+			ulStart += tPapxLen;
+			ucChpxLen = ucGetByte(24, aucLvlfInfo);
+			ulStart += (ULONG)ucChpxLen;
+			/* Read the length of the XString */
+			if (!bReadBuffer(pFile, ulTableStartBlock,
+					aulBlockDepot, tBlockDepotLen,
+					tBlockSize, aucXst,
+					ulStart, sizeof(aucXst))) {
+				aucLstfInfo = xfree(aucLstfInfo);
+				return;
+			}
+			NO_DBG_PRINT_BLOCK(aucXst, sizeof(aucXst));
+			tXstLen = (size_t)usGetWord(0, aucXst);
+			ulStart += sizeof(aucXst);
+			if (tXstLen == 0) {
+				tList.usListChar = DEFAULT_LISTCHAR;
+				vAdd2ListInfoList(ulListID,
+						usIstd,
+						ucListLevel,
+						&tList);
+				continue;
+			}
+			tXstLen *= 2;	/* Length in chars to length in bytes */
+			aucXString = xmalloc(tXstLen);
+			/* Read the XString */
+			if (!bReadBuffer(pFile, ulTableStartBlock,
+					aulBlockDepot, tBlockDepotLen,
+					tBlockSize, aucXString,
+					ulStart, tXstLen)) {
+				aucXString = xfree(aucXString);
+				aucLstfInfo = xfree(aucLstfInfo);
+				return;
+			}
+			NO_DBG_PRINT_BLOCK(aucXString, tXstLen);
+			tOff = 0;
+			for (iNums = 6; iNums < 15; iNums++) {
+				ucTmp = ucGetByte(iNums, aucLvlfInfo);
+				if (ucTmp == 0) {
+					break;
+				}
+				tOff = (size_t)ucTmp;
+			}
+			tOff *= 2;	/* Offset in chars to offset in bytes */
+			NO_DBG_DEC(tOff);
+			if (tList.ucNFC == LIST_SPECIAL ||
+			    tList.ucNFC == LIST_BULLETS) {
+				tList.usListChar = usGetWord(0, aucXString);
+			} else if (tOff != 0 && tOff < tXstLen) {
+				tList.usListChar = usGetWord(tOff, aucXString);
+			} else {
+				tList.usListChar = DEFAULT_LISTCHAR;
+			}
+			vAdd2ListInfoList(ulListID,
+					usIstd,
+					ucListLevel,
+					&tList);
+			ulStart += tXstLen;
+			aucXString = xfree(aucXString);
+		}
+	}
+	aucLstfInfo = xfree(aucLstfInfo);
+} /* end of vGet8LstInfo */
+
+/*
+ * Build the lists with Paragraph Information for Word 8/9/10 files
+ */
+void
+vGet8PapInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	row_block_type		tRow;
+	style_block_type	tStyle;
+	ULONG		*aulParfPage;
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucBuffer;
+	ULONG	ulCharPos, ulCharPosFirst, ulCharPosLast;
+	ULONG	ulBeginParfInfo;
+	ULONG	ulTableSize, ulTableStartBlock;
+	size_t	tParfInfoLen, tBlockDepotLen;
+	size_t	tBlockSize, tOffset, tLen;
+	int	iIndex, iIndex2, iRun, iFodo, iLen;
+	row_info_enum	eRowInfo;
+	USHORT	usDocStatus, usIstd;
+	UCHAR	aucFpage[BIG_BLOCK_SIZE];
+
+	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
+	fail(aulBBD == NULL || aulSBD == NULL);
+
+	ulBeginParfInfo = ulGetLong(0x102, aucHeader); /* fcPlcfbtePapx */
+	NO_DBG_HEX(ulBeginParfInfo);
+	tParfInfoLen = (size_t)ulGetLong(0x106, aucHeader); /* lcbPlcfbtePapx */
+	NO_DBG_DEC(tParfInfoLen);
+	if (tParfInfoLen < 4) {
+		DBG_DEC(tParfInfoLen);
+		return;
+	}
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_MSG("No paragraph information");
+		return;
+	}
+	DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+		/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+		/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+
+	aucBuffer = xmalloc(tParfInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginParfInfo, tParfInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tParfInfoLen);
+
+	tLen = (tParfInfoLen / 4 - 1) / 2;
+	aulParfPage = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 4) {
+		 aulParfPage[iIndex] = ulGetLong(tOffset, aucBuffer);
+		 NO_DBG_DEC(aulParfPage[iIndex]);
+	}
+	DBG_HEX(ulGetLong(0, aucBuffer));
+	aucBuffer = xfree(aucBuffer);
+	NO_DBG_PRINT_BLOCK(aucHeader, HEADER_SIZE);
+
+	(void)memset(&tRow, 0, sizeof(tRow));
+	ulCharPosFirst = CP_INVALID;
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		fail(aulParfPage[iIndex] > ULONG_MAX / BIG_BLOCK_SIZE);
+		if (!bReadBuffer(pFile, pPPS->tWordDocument.ulSB,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucFpage,
+				aulParfPage[iIndex] * BIG_BLOCK_SIZE,
+				BIG_BLOCK_SIZE)) {
+			break;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, BIG_BLOCK_SIZE);
+		iRun = (int)ucGetByte(0x1ff, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) {
+			NO_DBG_HEX(ulGetLong(iIndex2 * 4, aucFpage));
+			iFodo = 2 * (int)ucGetByte(
+				(iRun + 1) * 4 + iIndex2 * 13, aucFpage);
+			if (iFodo <= 0) {
+				continue;
+			}
+
+			iLen = 2 * (int)ucGetByte(iFodo, aucFpage);
+			if (iLen == 0) {
+				iFodo++;
+				iLen = 2 * (int)ucGetByte(iFodo, aucFpage);
+			}
+
+			usIstd = usGetWord(iFodo + 1, aucFpage);
+			vFillStyleFromStylesheet(usIstd, &tStyle);
+			vGet8StyleInfo(iFodo, aucFpage + 3, iLen - 3, &tStyle);
+			ulCharPos = ulGetLong(iIndex2 * 4, aucFpage);
+			NO_DBG_HEX(ulCharPos);
+			tStyle.ulFileOffset = ulCharPos2FileOffset(ulCharPos);
+			vAdd2StyleInfoList(&tStyle);
+
+			eRowInfo = eGet8RowInfo(iFodo,
+					aucFpage + 3, iLen - 3, &tRow);
+			switch (eRowInfo) {
+			case found_a_cell:
+				if (ulCharPosFirst != CP_INVALID) {
+					break;
+				}
+				ulCharPosFirst = ulGetLong(
+						iIndex2 * 4, aucFpage);
+				NO_DBG_HEX(ulCharPosFirst);
+				tRow.ulCharPosStart = ulCharPosFirst;
+				tRow.ulFileOffsetStart =
+					ulCharPos2FileOffset(ulCharPosFirst);
+				NO_DBG_HEX_C(
+					tRow.ulFileOffsetStart == FC_INVALID,
+					ulCharPosFirst);
+				break;
+			case found_end_of_row:
+				ulCharPosLast = ulGetLong(
+						iIndex2 * 4, aucFpage);
+				NO_DBG_HEX(ulCharPosLast);
+				tRow.ulCharPosEnd = ulCharPosLast;
+				tRow.ulFileOffsetEnd =
+					ulCharPos2FileOffset(ulCharPosLast);
+				NO_DBG_HEX_C(tRow.ulFileOffsetEnd == FC_INVALID,
+							ulCharPosLast);
+				vAdd2RowInfoList(&tRow);
+				(void)memset(&tRow, 0, sizeof(tRow));
+				ulCharPosFirst = CP_INVALID;
+				break;
+			case found_nothing:
+				break;
+			default:
+				DBG_DEC(eRowInfo);
+				break;
+			}
+		}
+	}
+	aulParfPage = xfree(aulParfPage);
+} /* end of vGet8PapInfo */
+
+/*
+ * Fill the font information block with information
+ * from a Word 8/9/10 file.
+ */
+void
+vGet8FontInfo(int iFodo, USHORT usIstd,
+	const UCHAR *aucGrpprl, int iBytes, font_block_type *pFont)
+{
+	long	lTmp;
+	int	iFodoOff, iInfoLen;
+	USHORT	usTmp;
+	UCHAR	ucTmp;
+
+	fail(iFodo < 0 || aucGrpprl == NULL || pFont == NULL);
+
+	iFodoOff = 0;
+	while (iBytes >= iFodoOff + 2) {
+		switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) {
+		case 0x0800:	/* fRMarkDel */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (ucTmp == 0) {
+				pFont->usFontStyle &= ~FONT_MARKDEL;
+			} else {
+				pFont->usFontStyle |= FONT_MARKDEL;
+			}
+			break;
+		case 0x0835:	/* fBold */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_BOLD;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_BOLD;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_BOLD;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case 0x0836:	/* fItalic */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_ITALIC;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_ITALIC;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_ITALIC;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case 0x0837:	/* fStrike */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_STRIKE;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_STRIKE;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_STRIKE;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case 0x083a:	/* fSmallCaps */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_SMALL_CAPITALS;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_SMALL_CAPITALS;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_SMALL_CAPITALS;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case 0x083b:	/* fCaps */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_CAPITALS;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_CAPITALS;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_CAPITALS;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case 0x083c:	/* fVanish */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			switch (ucTmp) {
+			case   0:	/* Unset */
+				pFont->usFontStyle &= ~FONT_HIDDEN;
+				break;
+			case   1:	/* Set */
+				pFont->usFontStyle |= FONT_HIDDEN;
+				break;
+			case 128:	/* Unchanged */
+				break;
+			case 129:	/* Negation */
+				pFont->usFontStyle ^= FONT_HIDDEN;
+				break;
+			default:
+				DBG_DEC(ucTmp);
+				DBG_FIXME();
+				break;
+			}
+			break;
+		case 0x2a32:	/* cDefault */
+			pFont->usFontStyle &= FONT_HIDDEN;
+			pFont->ucFontColor = FONT_COLOR_DEFAULT;
+			break;
+		case 0x2a33:	/* cPlain */
+			DBG_MSG("2a33: cPlain");
+			vFillFontFromStylesheet(usIstd, pFont);
+			break;
+		case 0x2a3e:	/* cKul */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (ucTmp == 0 || ucTmp == 5) {
+				pFont->usFontStyle &= ~FONT_UNDERLINE;
+			} else {
+				NO_DBG_MSG("Underline text");
+				pFont->usFontStyle |= FONT_UNDERLINE;
+				if (ucTmp == 6) {
+					DBG_MSG("Bold text");
+					pFont->usFontStyle |= FONT_BOLD;
+				}
+			}
+			break;
+		case 0x2a42:	/* cIco */
+			pFont->ucFontColor =
+				ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pFont->ucFontColor);
+			break;
+		case 0x2a48:	/* cIss */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			ucTmp &= 0x07;
+			if (ucTmp == 1) {
+				pFont->usFontStyle |= FONT_SUPERSCRIPT;
+				NO_DBG_MSG("Superscript");
+			} else if (ucTmp == 2) {
+				pFont->usFontStyle |= FONT_SUBSCRIPT;
+				NO_DBG_MSG("Subscript");
+			}
+			break;
+		case 0x4a30:	/* cIstd */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(usTmp);
+			break;
+		case 0x4a43:	/* cHps */
+			pFont->usFontSize =
+				usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			NO_DBG_DEC(pFont->usFontSize);
+			break;
+		case 0x4a51:	/* cFtc */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			if (usTmp <= (USHORT)UCHAR_MAX) {
+				pFont->ucFontNumber = (UCHAR)usTmp;
+			} else {
+				pFont->ucFontNumber = 0;
+			}
+			break;
+		case 0xca4a:	/* cHps */
+			usTmp = usGetWord(iFodo + iFodoOff + 2, aucGrpprl);
+			lTmp = (long)pFont->usFontSize + (long)usTmp;
+			if (lTmp < 8) {
+				pFont->usFontSize = 8;
+			} else if (lTmp > 32766) {
+				pFont->usFontSize = 32766;
+			} else {
+				pFont->usFontSize = (USHORT)lTmp;
+			}
+			break;
+		case 0xea3f:	/* cHps, cHpsPos */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (ucTmp != 0) {
+				pFont->usFontSize = (USHORT)ucTmp;
+			}
+			DBG_DEC(ucTmp);
+			break;
+		default:
+			break;
+		}
+		iInfoLen = iGet8InfoLength(iFodo + iFodoOff, aucGrpprl);
+		fail(iInfoLen <= 0);
+		iFodoOff += iInfoLen;
+	}
+} /* end of vGet8FontInfo */
+
+/*
+ * Fill the picture information block with information
+ * from a Word 8/9/10 file.
+ * Returns TRUE when successful, otherwise FALSE
+ */
+static BOOL
+bGet8PicInfo(int iFodo,
+	const UCHAR *aucGrpprl, int iBytes, picture_block_type *pPicture)
+{
+	int	iFodoOff, iInfoLen;
+	BOOL	bFound;
+	UCHAR	ucTmp;
+
+	fail(iFodo <= 0 || aucGrpprl == NULL || pPicture == NULL);
+
+	iFodoOff = 0;
+	bFound = FALSE;
+	while (iBytes >= iFodoOff + 2) {
+		switch (usGetWord(iFodo + iFodoOff, aucGrpprl)) {
+		case 0x0806:	/* fData */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (ucTmp == 0x01) {
+				/* Not a picture, but a form field */
+				return FALSE;
+			}
+			DBG_DEC_C(ucTmp != 0, ucTmp);
+			break;
+		case 0x080a:	/* fOle2 */
+			ucTmp = ucGetByte(iFodo + iFodoOff + 2, aucGrpprl);
+			if (ucTmp == 0x01) {
+				/* Not a picture, but an OLE object */
+				return FALSE;
+			}
+			DBG_DEC_C(ucTmp != 0, ucTmp);
+			break;
+		case 0x6a03:	/* fcPic */
+			pPicture->ulPictureOffset = ulGetLong(
+					iFodo + iFodoOff + 2, aucGrpprl);
+			bFound = TRUE;
+			break;
+		default:
+			break;
+		}
+		iInfoLen = iGet8InfoLength(iFodo + iFodoOff, aucGrpprl);
+		fail(iInfoLen <= 0);
+		iFodoOff += iInfoLen;
+	}
+	return bFound;
+} /* end of bGet8PicInfo */
+
+/*
+ * Build the lists with Character Information for Word 8/9/10 files
+ */
+void
+vGet8ChrInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader)
+{
+	font_block_type		tFont;
+	picture_block_type	tPicture;
+	ULONG		*aulCharPage;
+	const ULONG	*aulBlockDepot;
+	UCHAR	*aucBuffer;
+	ULONG	ulFileOffset, ulCharPos, ulBeginCharInfo;
+	ULONG	ulTableSize, ulTableStartBlock;
+	size_t	tCharInfoLen, tBlockDepotLen;
+	size_t	tOffset, tBlockSize, tLen;
+	int	iIndex, iIndex2, iRun, iFodo, iLen;
+	USHORT	usDocStatus, usIstd;
+	UCHAR	aucFpage[BIG_BLOCK_SIZE];
+
+	fail(pFile == NULL || pPPS == NULL || aucHeader == NULL);
+	fail(aulBBD == NULL || aulSBD == NULL);
+
+	ulBeginCharInfo = ulGetLong(0xfa, aucHeader); /* fcPlcfbteChpx */
+	NO_DBG_HEX(ulBeginCharInfo);
+	tCharInfoLen = (size_t)ulGetLong(0xfe, aucHeader); /* lcbPlcfbteChpx */
+	NO_DBG_DEC(tCharInfoLen);
+	if (tCharInfoLen < 4) {
+		DBG_DEC(tCharInfoLen);
+		return;
+	}
+
+	/* Use 0Table or 1Table? */
+	usDocStatus = usGetWord(0x0a, aucHeader);
+	if (usDocStatus & BIT(9)) {
+		ulTableStartBlock = pPPS->t1Table.ulSB;
+		ulTableSize = pPPS->t1Table.ulSize;
+	} else {
+		ulTableStartBlock = pPPS->t0Table.ulSB;
+		ulTableSize = pPPS->t0Table.ulSize;
+	}
+	DBG_DEC(ulTableStartBlock);
+	if (ulTableStartBlock == 0) {
+		DBG_MSG("No character information");
+		return;
+	}
+	DBG_HEX(ulTableSize);
+	if (ulTableSize < MIN_SIZE_FOR_BBD_USE) {
+		/* Use the Small Block Depot */
+		aulBlockDepot = aulSBD;
+		tBlockDepotLen = tSBDLen;
+		tBlockSize = SMALL_BLOCK_SIZE;
+	} else {
+		/* Use the Big Block Depot */
+		aulBlockDepot = aulBBD;
+		tBlockDepotLen = tBBDLen;
+		tBlockSize = BIG_BLOCK_SIZE;
+	}
+	aucBuffer = xmalloc(tCharInfoLen);
+	if (!bReadBuffer(pFile, ulTableStartBlock,
+			aulBlockDepot, tBlockDepotLen, tBlockSize,
+			aucBuffer, ulBeginCharInfo, tCharInfoLen)) {
+		aucBuffer = xfree(aucBuffer);
+		return;
+	}
+	NO_DBG_PRINT_BLOCK(aucBuffer, tCharInfoLen);
+
+	tLen = (tCharInfoLen / 4 - 1) / 2;
+	aulCharPage = xcalloc(tLen, sizeof(ULONG));
+	for (iIndex = 0, tOffset = (tLen + 1) * 4;
+	     iIndex < (int)tLen;
+	     iIndex++, tOffset += 4) {
+		 aulCharPage[iIndex] = ulGetLong(tOffset, aucBuffer);
+		 NO_DBG_DEC(aulCharPage[iIndex]);
+	}
+	DBG_HEX(ulGetLong(0, aucBuffer));
+	aucBuffer = xfree(aucBuffer);
+	NO_DBG_PRINT_BLOCK(aucHeader, HEADER_SIZE);
+
+	for (iIndex = 0; iIndex < (int)tLen; iIndex++) {
+		fail(aulCharPage[iIndex] > ULONG_MAX / BIG_BLOCK_SIZE);
+		if (!bReadBuffer(pFile, pPPS->tWordDocument.ulSB,
+				aulBBD, tBBDLen, BIG_BLOCK_SIZE,
+				aucFpage,
+				aulCharPage[iIndex] * BIG_BLOCK_SIZE,
+				BIG_BLOCK_SIZE)) {
+			break;
+		}
+		NO_DBG_PRINT_BLOCK(aucFpage, BIG_BLOCK_SIZE);
+		iRun = (int)ucGetByte(0x1ff, aucFpage);
+		NO_DBG_DEC(iRun);
+		for (iIndex2 = 0; iIndex2 < iRun; iIndex2++) {
+			ulCharPos = ulGetLong(iIndex2 * 4, aucFpage);
+			ulFileOffset = ulCharPos2FileOffset(ulCharPos);
+			iFodo = 2 * (int)ucGetByte(
+				(iRun + 1) * 4 + iIndex2, aucFpage);
+
+			iLen = (int)ucGetByte(iFodo, aucFpage);
+
+			usIstd = usGetIstd(ulFileOffset);
+			vFillFontFromStylesheet(usIstd, &tFont);
+			if (iFodo != 0) {
+				vGet8FontInfo(iFodo, usIstd,
+					aucFpage + 1, iLen - 1, &tFont);
+			}
+			tFont.ulFileOffset = ulFileOffset;
+			vAdd2FontInfoList(&tFont);
+
+			if (iFodo <= 0) {
+				continue;
+			}
+
+			(void)memset(&tPicture, 0, sizeof(tPicture));
+			if (bGet8PicInfo(iFodo, aucFpage + 1,
+						iLen - 1, &tPicture)) {
+				tPicture.ulFileOffset = ulFileOffset;
+				tPicture.ulFileOffsetPicture =
+					ulDataPos2FileOffset(
+						tPicture.ulPictureOffset);
+				vAdd2PictInfoList(&tPicture);
+			}
+		}
+	}
+	aulCharPage = xfree(aulCharPage);
+} /* end of vGet8ChrInfo */

+ 145 - 0
sys/src/cmd/aux/antiword/properties.c

@@ -0,0 +1,145 @@
+/*
+ * properties.c
+ * Copyright (C) 1998-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Read the properties information from a MS Word file
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "antiword.h"
+
+
+/*
+ * Build the lists with Property Information
+ */
+void
+vGetPropertyInfo(FILE *pFile, const pps_info_type *pPPS,
+	const ULONG *aulBBD, size_t tBBDLen,
+	const ULONG *aulSBD, size_t tSBDLen,
+	const UCHAR *aucHeader, int iWordVersion)
+{
+	options_type	tOptions;
+
+	fail(pFile == NULL);
+	fail(pPPS == NULL && iWordVersion >= 6);
+	fail(aulBBD == NULL && tBBDLen != 0);
+	fail(aulSBD == NULL && tSBDLen != 0);
+	fail(aucHeader == NULL);
+
+	vGetOptions(&tOptions);
+
+	switch (iWordVersion) {
+	case 0:
+		vGet0SepInfo(pFile, aucHeader);
+		vGet0PapInfo(pFile, aucHeader);
+		if (tOptions.eConversionType == conversion_draw ||
+		    tOptions.eConversionType == conversion_ps ||
+		    tOptions.eConversionType == conversion_xml) {
+			vGet0ChrInfo(pFile, aucHeader);
+			vCreate0FontTable();
+		}
+		vSet0SummaryInfo(pFile, aucHeader);
+		break;
+	case 1:
+	case 2:
+		vGet2Stylesheet(pFile, iWordVersion, aucHeader);
+		vGet2SepInfo(pFile, aucHeader);
+		vGet2PapInfo(pFile, aucHeader);
+		if (tOptions.eConversionType == conversion_draw ||
+		    tOptions.eConversionType == conversion_ps ||
+		    tOptions.eConversionType == conversion_xml) {
+			vGet2ChrInfo(pFile, iWordVersion, aucHeader);
+			vCreate2FontTable(pFile, aucHeader);
+		}
+		vSet2SummaryInfo(pFile, iWordVersion, aucHeader);
+		break;
+	case 4:
+	case 5:
+		break;
+	case 6:
+	case 7:
+		vGet6Stylesheet(pFile, pPPS->tWordDocument.ulSB,
+			aulBBD, tBBDLen, aucHeader);
+		vGet6SepInfo(pFile, pPPS->tWordDocument.ulSB,
+			aulBBD, tBBDLen, aucHeader);
+		vGet6PapInfo(pFile, pPPS->tWordDocument.ulSB,
+			aulBBD, tBBDLen, aucHeader);
+		if (tOptions.eConversionType == conversion_draw ||
+		    tOptions.eConversionType == conversion_ps ||
+		    tOptions.eConversionType == conversion_xml) {
+			vGet6ChrInfo(pFile, pPPS->tWordDocument.ulSB,
+				aulBBD, tBBDLen, aucHeader);
+			vCreate6FontTable(pFile, pPPS->tWordDocument.ulSB,
+				aulBBD, tBBDLen, aucHeader);
+		}
+		vSet6SummaryInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		break;
+	case 8:
+		vGet8LstInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		vGet8Stylesheet(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		vGet8SepInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		vGet8PapInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		if (tOptions.eConversionType == conversion_draw ||
+		    tOptions.eConversionType == conversion_ps ||
+		    tOptions.eConversionType == conversion_xml) {
+			vGet8ChrInfo(pFile, pPPS,
+				aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+			vCreate8FontTable(pFile, pPPS,
+				aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		}
+		vSet8SummaryInfo(pFile, pPPS,
+			aulBBD, tBBDLen, aulSBD, tSBDLen, aucHeader);
+		break;
+	default:
+		DBG_DEC(iWordVersion);
+		DBG_FIXME();
+		werr(0, "Sorry, no property information");
+		break;
+	}
+} /* end of vGetPropertyInfo */
+
+/*
+ * ePropMod2RowInfo - Turn the Property Modifier into row information
+ *
+ * Returns: the row information
+ */
+row_info_enum
+ePropMod2RowInfo(USHORT usPropMod, int iWordVersion)
+{
+	row_block_type	tRow;
+	const UCHAR	*aucPropMod;
+	int	iLen;
+
+	aucPropMod = aucReadPropModListItem(usPropMod);
+	if (aucPropMod == NULL) {
+		return found_nothing;
+	}
+	iLen = (int)usGetWord(0, aucPropMod);
+
+	switch (iWordVersion) {
+	case 0:
+		return found_nothing;
+	case 1:
+	case 2:
+		return eGet2RowInfo(0, aucPropMod + 2, iLen, &tRow);
+	case 4:
+	case 5:
+		return found_nothing;
+	case 6:
+	case 7:
+		return eGet6RowInfo(0, aucPropMod + 2, iLen, &tRow);
+	case 8:
+		return eGet8RowInfo(0, aucPropMod + 2, iLen, &tRow);
+	default:
+		DBG_DEC(iWordVersion);
+		DBG_FIXME();
+		return found_nothing;
+	}
+} /* end of ePropMod2RowInfo */

+ 110 - 0
sys/src/cmd/aux/antiword/propmod.c

@@ -0,0 +1,110 @@
+/*
+ * propmod.c
+ * Copyright (C) 2001-2003 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy a list (array) of Word property modifiers
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "antiword.h"
+
+#if defined(DEBUG)
+#define ELEMENTS_TO_ADD	 3
+#else
+#define ELEMENTS_TO_ADD	30
+#endif /* DEBUG */
+
+/* Variables needed to write the property modifier list */
+static UCHAR	**ppAnchor = NULL;
+static size_t	tNextFree = 0;
+static size_t	tMaxElements = 0;
+
+
+/*
+ * vDestroyPropModList - destroy the property modifier list
+ */
+void
+vDestroyPropModList(void)
+{
+	size_t	tIndex;
+
+	DBG_MSG("vDestroyPropModList");
+
+	/* Free all the elements of the list */
+	for (tIndex = 0; tIndex < tNextFree; tIndex++) {
+		ppAnchor[tIndex] = xfree(ppAnchor[tIndex]);
+	}
+	/* Free the list itself */
+	ppAnchor = xfree(ppAnchor);
+	/* Reset all control variables */
+	tNextFree = 0;
+	tMaxElements = 0;
+} /* end of vDestroyPropModList */
+
+/*
+ * vAdd2PropModList - add an element to the property modifier list
+ */
+void
+vAdd2PropModList(const UCHAR *aucPropMod)
+{
+	size_t	tSize, tLen;
+
+	fail(aucPropMod == NULL);
+
+	NO_DBG_MSG("vAdd2PropModList");
+
+	if (tNextFree >= tMaxElements) {
+		tMaxElements += ELEMENTS_TO_ADD;
+		tSize = tMaxElements * sizeof(UCHAR **);
+		ppAnchor = xrealloc(ppAnchor, tSize);
+	}
+	NO_DBG_DEC(tNextFree);
+
+	tLen = 2 + (size_t)usGetWord(0, aucPropMod);
+	NO_DBG_HEX(tLen);
+	NO_DBG_PRINT_BLOCK(pucPropMod, tLen);
+	ppAnchor[tNextFree] = xmalloc(tLen);
+	memcpy(ppAnchor[tNextFree], aucPropMod, tLen);
+	tNextFree++;
+} /* end of vAdd2PropModList */
+
+/*
+ * aucReadPropModListItem - get an item of the property modifier list
+ */
+const UCHAR *
+aucReadPropModListItem(USHORT usPropMod)
+{
+	static UCHAR	aucBuffer[4];
+	size_t	tIndex;
+
+	if (usPropMod == IGNORE_PROPMOD) {
+		/* This Properties Modifier must be ignored */
+		return NULL;
+	}
+
+	if (!odd(usPropMod)) {
+		/* Variant 1: The information is in the input ifself */
+		aucBuffer[0] = 2;
+		aucBuffer[1] = 0;
+		aucBuffer[2] = (UCHAR)((usPropMod & 0x00fe) >> 1);
+		aucBuffer[3] = (UCHAR)((usPropMod & 0xff00) >> 8);
+		return aucBuffer;
+	}
+
+	if (ppAnchor == NULL) {
+		/* No information available */
+		return NULL;
+	}
+
+	/* Variant 2: The input contains an index */
+	tIndex = (size_t)(usPropMod >> 1);
+	if (tIndex >= tNextFree) {
+		DBG_HEX(usPropMod);
+		DBG_DEC(tIndex);
+		DBG_DEC(tNextFree);
+		return NULL;
+	}
+	return ppAnchor[tIndex];
+} /* end of aucGetPropModListItem */

+ 290 - 0
sys/src/cmd/aux/antiword/riscos.c

@@ -0,0 +1,290 @@
+/*
+ * riscos.c
+ * Copyright (C) 2001,2002 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * RISC OS only functions
+ */
+
+#include <string.h>
+#include "kernel.h"
+#include "swis.h"
+#include "antiword.h"
+
+#if !defined(DrawFile_Render)
+#define DrawFile_Render		0x045540
+#endif /* !DrawFile_Render */
+#if !defined(JPEG_Info)
+#define JPEG_Info		0x049980
+#endif /* !JPEG_Info */
+
+
+/*
+ * iGetFiletype
+ * This function will get the filetype of the given file.
+ * returns the filetype.
+ */
+int
+iGetFiletype(const char *szFilename)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 23;
+	regs.r[1] = (int)szFilename;
+	e = _kernel_swi(OS_File, &regs, &regs);
+	if (e == NULL) {
+		return regs.r[6];
+	}
+	werr(0, "Get Filetype error %d: %s", e->errnum, e->errmess);
+	return -1;
+} /* end of iGetFiletype */
+
+/*
+ * vSetFiletype
+ * This procedure will set the filetype of the given file to the given
+ * type.
+ */
+void
+vSetFiletype(const char *szFilename, int iFiletype)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+
+	if (iFiletype < 0x000 || iFiletype > 0xfff) {
+		return;
+	}
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 18;
+	regs.r[1] = (int)szFilename;
+	regs.r[2] = iFiletype;
+	e = _kernel_swi(OS_File, &regs, &regs);
+	if (e != NULL) {
+		switch (e->errnum) {
+		case 0x000113:	/* ROM */
+		case 0x0104e1:	/* Read-only floppy DOSFS */
+		case 0x0108c9:	/* Read-only floppy ADFS */
+		case 0x013803:	/* Read-only ArcFS */
+		case 0x80344a:	/* CD-ROM */
+			break;
+		default:
+			werr(0, "Set Filetype error %d: %s",
+				e->errnum, e->errmess);
+			break;
+		}
+	}
+} /* end of vSetFileType */
+
+/*
+ * Check if the directory part of the given file exists, make the directory
+ * if it does not exist yet.
+ * Returns TRUE in case of success, otherwise FALSE.
+ */
+BOOL
+bMakeDirectory(const char *szFilename)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+	char	*pcLastDot;
+	char	szDirectory[PATH_MAX+1];
+
+	DBG_MSG("bMakeDirectory");
+	fail(szFilename == NULL || szFilename[0] == '\0');
+	DBG_MSG(szFilename);
+
+	if (strlen(szFilename) >= sizeof(szDirectory)) {
+		DBG_DEC(strlen(szFilename));
+		return FALSE;
+	}
+	strcpy(szDirectory, szFilename);
+	pcLastDot = strrchr(szDirectory, '.');
+	if (pcLastDot == NULL) {
+		/* No directory equals current directory */
+		DBG_MSG("No directory part given");
+		return TRUE;
+	}
+	*pcLastDot = '\0';
+	DBG_MSG(szDirectory);
+	/* Check if the name exists */
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 17;
+	regs.r[1] = (int)szDirectory;
+	e = _kernel_swi(OS_File, &regs, &regs);
+	if (e != NULL) {
+		werr(0, "Directory check %d: %s", e->errnum, e->errmess);
+		return FALSE;
+	}
+	if (regs.r[0] == 2) {
+		/* The name exists and it is a directory */
+		DBG_MSG("The directory already exists");
+		return TRUE;
+	}
+	if (regs.r[0] != 0) {
+		/* The name exists and it is not a directory */
+		DBG_DEC(regs.r[0]);
+		return FALSE;
+	}
+	/* The name does not exist, make the directory */
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 8;
+	regs.r[1] = (int)szDirectory;
+	regs.r[4] = 0;
+	e = _kernel_swi(OS_File, &regs, &regs);
+	if (e != NULL) {
+		werr(0, "I can't make a directory %d: %s",
+			e->errnum, e->errmess);
+		return FALSE;
+	}
+	return TRUE;
+} /* end of bMakeDirectory */
+
+/*
+ * iReadCurrentAlphabetNumber
+ * This function reads the current Alphabet number.
+ * Returns the current Alphabet number when successful, otherwise -1
+ */
+int
+iReadCurrentAlphabetNumber(void)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 71;
+	regs.r[1] = 127;
+	e = _kernel_swi(OS_Byte, &regs, &regs);
+	if (e == NULL) {
+		return regs.r[1];
+	}
+	werr(0, "Read alphabet error %d: %s", e->errnum, e->errmess);
+	return -1;
+} /* end of iReadCurrentAlphabetNumber */
+
+/*
+ * iGetRiscOsVersion - get the RISC OS version number
+ *
+ * returns the RISC OS version * 100
+ */
+int
+iGetRiscOsVersion(void)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 129;
+	regs.r[1] = 0;
+	regs.r[2] = 0xff;
+	e = _kernel_swi(OS_Byte, &regs, &regs);
+	if (e != NULL) {
+		werr(0, "Read RISC OS version error %d: %s",
+			e->errnum, e->errmess);
+		return 0;
+	}
+	switch (regs.r[1]) {
+	case 0xa0:	/* Arthur 1.20 */
+		return 120;
+	case 0xa1:	/* RISC OS 2.00 */
+		return 200;
+	case 0xa2:	/* RISC OS 2.01 */
+		return 201;
+	case 0xa3:	/* RISC OS 3.00 */
+		return 300;
+	case 0xa4:	/* RISC OS 3.1x */
+		return 310;
+	case 0xa5:	/* RISC OS 3.50 */
+		return 350;
+	case 0xa6:	/* RISC OS 3.60 */
+		return 360;
+	case 0xa7:	/* RISC OS 3.7x */
+		return 370;
+	case 0xa8:	/* RISC OS 4.0x */
+		return 400;
+	default:
+		if (regs.r[1] >= 0xa9 && regs.r[1] <= 0xaf) {
+			/* RISC OS 4.10 and up */
+			return 410;
+		}
+		/* Unknown version */
+		return 0;
+	}
+} /* end of iGetRiscOsVersion */
+
+/*
+ * Replaces the draw_render_diag function from RISC_OSLib when using
+ * RISC OS version 3.60 or higher
+ * This function calls a SWI that does not exist in earlier versions
+ */
+BOOL
+bDrawRenderDiag360(draw_diag *pInfo,
+	draw_redrawstr *pRedraw, double dScale, draw_error *pError)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+	int	aiTransform[6];
+
+	fail(pInfo == NULL);
+	fail(pRedraw == NULL);
+	fail(dScale < 0.01);
+	fail(pError == NULL);
+	fail(iGetRiscOsVersion() < 360);
+
+	aiTransform[0] = (int)(dScale * 0x10000);
+	aiTransform[1] = 0;
+	aiTransform[2] = 0;
+	aiTransform[3] = (int)(dScale * 0x10000);
+	aiTransform[4] = (pRedraw->box.x0 - pRedraw->scx) * 256;
+	aiTransform[5] = (pRedraw->box.y1 - pRedraw->scy) * 256;
+
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 0;
+	regs.r[1] = (int)pInfo->data;
+	regs.r[2] = pInfo->length;
+	regs.r[3] = (int)aiTransform;
+	regs.r[4] = (int)&pRedraw->box;
+	regs.r[5] = 0;
+	e = _kernel_swi(DrawFile_Render, &regs, &regs);
+	if (e == NULL) {
+		return TRUE;
+	}
+	werr(0, "DrawFile render error %d: %s", e->errnum, e->errmess);
+	pError->type = DrawOSError;
+	pError->err.os.errnum = e->errnum;
+	strncpy(pError->err.os.errmess,
+		e->errmess,
+		sizeof(pError->err.os.errmess) - 1);
+	pError->err.os.errmess[sizeof(pError->err.os.errmess) - 1] = '\0';
+	return FALSE;
+} /* end of bDrawRenderDiag360 */
+
+#if defined(DEBUG)
+BOOL
+bGetJpegInfo(UCHAR *pucJpeg, size_t tJpegSize)
+{
+	_kernel_swi_regs	regs;
+	_kernel_oserror		*e;
+
+	(void)memset((void *)&regs, 0, sizeof(regs));
+	regs.r[0] = 0x00;
+	regs.r[1] = (int)pucJpeg;
+	regs.r[2] = (int)tJpegSize;
+	e = _kernel_swi(JPEG_Info, &regs, &regs);
+	if (e == NULL) {
+		if (regs.r[0] & BIT(2)) {
+			DBG_MSG("Pixel density is a simple ratio");
+		} else {
+			DBG_MSG("Pixel density is in dpi");
+		}
+		DBG_DEC(regs.r[4]);
+		DBG_DEC(regs.r[5]);
+		return TRUE;
+	}
+	werr(0, "JPEG Info error %d: %s", e->errnum, e->errmess);
+	return FALSE;
+} /* end of bGetJpegInfo */
+#endif /* DEBUG */

+ 118 - 0
sys/src/cmd/aux/antiword/rowlist.c

@@ -0,0 +1,118 @@
+/*
+ * rowlist.c
+ * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Build, read and destroy a list of Word table-row information
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "antiword.h"
+
+/*
+ * Private structure to hide the way the information
+ * is stored from the rest of the program
+ */
+typedef struct row_desc_tag {
+	row_block_type		tInfo;
+	struct row_desc_tag	*pNext;
+} row_desc_type;
+
+/* Variables needed to write the Row Information List */
+static row_desc_type	*pAnchor = NULL;
+static row_desc_type	*pRowLast = NULL;
+/* Variable needed to read the Row Information List */
+static row_desc_type	*pRowCurrent = NULL;
+
+
+/*
+ * vDestroyRowInfoList - destroy the Row Information List
+ */
+void
+vDestroyRowInfoList(void)
+{
+	row_desc_type	*pCurr, *pNext;
+
+	DBG_MSG("vDestroyRowInfoList");
+
+	/* Free the Row Information List */
+	pCurr = pAnchor;
+	while (pCurr != NULL) {
+		pNext = pCurr->pNext;
+		pCurr = xfree(pCurr);
+		pCurr = pNext;
+	}
+	pAnchor = NULL;
+	/* Reset all control variables */
+	pRowLast = NULL;
+	pRowCurrent = NULL;
+} /* end of vDestroyRowInfoList */
+
+/*
+ * vAdd2RowInfoList - Add an element to the Row Information List
+ */
+void
+vAdd2RowInfoList(const row_block_type *pRowBlock)
+{
+	row_desc_type	*pListMember;
+	short		*psTmp;
+	int		iIndex;
+
+	fail(pRowBlock == NULL);
+
+	if (pRowBlock->ulFileOffsetStart == FC_INVALID ||
+	    pRowBlock->ulFileOffsetEnd == FC_INVALID ||
+	    pRowBlock->ulFileOffsetStart == pRowBlock->ulFileOffsetEnd) {
+		DBG_HEX_C(pRowBlock->ulFileOffsetStart != FC_INVALID,
+			pRowBlock->ulFileOffsetStart);
+		DBG_HEX_C(pRowBlock->ulFileOffsetEnd != FC_INVALID,
+			pRowBlock->ulFileOffsetEnd);
+		return;
+	}
+
+	NO_DBG_HEX(pRowBlock->ulFileOffsetStart);
+	NO_DBG_HEX(pRowBlock->ulFileOffsetEnd);
+	NO_DBG_DEC(pRowBlock->ucNumberOfColumns);
+	NO_DBG_DEC(pRowBlock->iColumnWidthSum);
+
+	/* Create the new list member */
+	pListMember = xmalloc(sizeof(row_desc_type));
+	/* Fill the new list member */
+	pListMember->tInfo = *pRowBlock;
+	pListMember->pNext = NULL;
+	/* Correct the values where needed */
+	for (iIndex = 0, psTmp = pListMember->tInfo.asColumnWidth;
+	     iIndex < (int)pListMember->tInfo.ucNumberOfColumns;
+	     iIndex++, psTmp++) {
+		if (*psTmp < 0) {
+			*psTmp = 0;
+			DBG_MSG("The column width was negative");
+		}
+	}
+	/* Add the new member to the list */
+	if (pAnchor == NULL) {
+		pAnchor = pListMember;
+		pRowCurrent = pListMember;
+	} else {
+		fail(pRowLast == NULL);
+		pRowLast->pNext = pListMember;
+	}
+	pRowLast = pListMember;
+} /* end of vAdd2RowInfoList */
+
+/*
+ * Get the next item in the Row Information List
+ */
+const row_block_type *
+pGetNextRowInfoListItem(void)
+{
+	const row_block_type	*pItem;
+
+	if (pRowCurrent == NULL) {
+		return NULL;
+	}
+	pItem = &pRowCurrent->tInfo;
+	pRowCurrent = pRowCurrent->pNext;
+	return pItem;
+} /* end of pGetNextRowInfoListItem */

+ 330 - 0
sys/src/cmd/aux/antiword/saveas.c

@@ -0,0 +1,330 @@
+/*
+ * saveas.c
+ * Copyright (C) 1998-2001 A.J. van Os; Released under GPL
+ *
+ * Description:
+ * Functions to save the results as a textfile or a drawfile
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include "saveas.h"
+#include "event.h"
+#include "antiword.h"
+
+static BOOL
+bWrite2File(void *pvBytes, size_t tSize, FILE *pFile, const char *szFilename)
+{
+	if (fwrite(pvBytes, sizeof(char), tSize, pFile) != tSize) {
+		werr(0, "I can't write to '%s'", szFilename);
+		return FALSE;
+	}
+	return TRUE;
+} /* end of bWrite2File */
+
+/*
+ * bText2File - Save the generated draw file to a Text file
+ */
+static BOOL
+bText2File(char *szFilename, void *pvHandle)
+{
+	FILE	*pFile;
+	diagram_type	*pDiag;
+	draw_textstrhdr	tText;
+	char	*pcTmp;
+	int	iToGo, iSize, iX, iYtopPrev, iHeight, iLines;
+	BOOL	bFirst, bIndent, bSuccess;
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+	fail(pvHandle == NULL);
+
+	DBG_MSG("bText2File");
+	DBG_MSG(szFilename);
+
+	pDiag = (diagram_type *)pvHandle;
+	pFile = fopen(szFilename, "w");
+	if (pFile == NULL) {
+		werr(0, "I can't open '%s' for writing", szFilename);
+		return FALSE;
+	}
+	bFirst = TRUE;
+	iYtopPrev = 0;
+	iHeight = (int)lWord2DrawUnits20(DEFAULT_FONT_SIZE);
+	bSuccess = TRUE;
+	iToGo = pDiag->tInfo.length - sizeof(draw_fileheader);
+	DBG_DEC(iToGo);
+	pcTmp = pDiag->tInfo.data + sizeof(draw_fileheader);
+	while (iToGo > 0 && bSuccess) {
+		tText = *(draw_textstrhdr *)pcTmp;
+		switch (tText.tag) {
+		case draw_OBJFONTLIST:
+			/* These are not relevant in a textfile */
+			iSize = ((draw_fontliststrhdr *)pcTmp)->size;
+			pcTmp += iSize;
+			iToGo -= iSize;
+			break;
+		case draw_OBJTEXT:
+			/* Compute the number of lines */
+			iLines =
+			(iYtopPrev - tText.bbox.y1 + iHeight / 2) / iHeight;
+			fail(iLines < 0);
+			bIndent = iLines > 0 || bFirst;
+			bFirst = FALSE;
+			/* Print the newlines */
+			while (iLines > 0 && bSuccess) {
+				bSuccess = bWrite2File("\n",
+					1, pFile, szFilename);
+				iLines--;
+			}
+			/* Print the indentation */
+			if (bIndent && bSuccess) {
+				for (iX = draw_screenToDraw(8);
+				     iX <= tText.bbox.x0 && bSuccess;
+				     iX += draw_screenToDraw(16)) {
+					bSuccess = bWrite2File(" ",
+						1, pFile, szFilename);
+				}
+			}
+			if (!bSuccess) {
+				break;
+			}
+			/* Print the text object */
+			pcTmp += sizeof(tText);
+			bSuccess = bWrite2File(pcTmp,
+				strlen(pcTmp), pFile, szFilename);
+			pcTmp += tText.size - sizeof(tText);
+			/* Setup for the next text object */
+			iToGo -= tText.size;
+			iYtopPrev = tText.bbox.y1;
+			iHeight = tText.bbox.y1 - tText.bbox.y0;
+			break;
+		case draw_OBJPATH:
+			/* These are not relevant in a textfile */
+			iSize = ((draw_pathstrhdr *)pcTmp)->size;
+			pcTmp += iSize;
+			iToGo -= iSize;
+			break;
+		case draw_OBJSPRITE:
+		case draw_OBJJPEG:
+			/* These are not relevant in a textfile */
+			iSize = ((draw_spristrhdr *)pcTmp)->size;
+			pcTmp += iSize;
+			iToGo -= iSize;
+			break;
+		default:
+			DBG_DEC(tText.tag);
+			bSuccess = FALSE;
+			break;
+		}
+	}
+	DBG_DEC_C(iToGo != 0, iToGo);
+	if (bSuccess) {
+		bSuccess = bWrite2File("\n", 1, pFile, szFilename);
+	}
+	(void)fclose(pFile);
+	if (bSuccess) {
+		vSetFiletype(szFilename, FILETYPE_TEXT);
+	} else {
+		(void)remove(szFilename);
+		werr(0, "Unable to save textfile '%s'", szFilename);
+	}
+	return bSuccess;
+} /* end of bText2File */
+
+/*
+ * vSaveTextfile
+ */
+void
+vSaveTextfile(diagram_type *pDiagram)
+{
+	wimp_emask	tMask;
+	int		iRecLen, iNbrRecs, iEstSize;
+
+	fail(pDiagram == NULL);
+
+	DBG_MSG("vSaveTextfile");
+	iRecLen = sizeof(draw_textstrhdr) + DEFAULT_SCREEN_WIDTH * 2 / 3;
+	iNbrRecs = pDiagram->tInfo.length / iRecLen + 1;
+	iEstSize = iNbrRecs * DEFAULT_SCREEN_WIDTH * 2 / 3;
+	DBG_DEC(iEstSize);
+
+	tMask = event_getmask();
+	event_setmask(0);
+	saveas(FILETYPE_TEXT, "WordText",
+		iEstSize, bText2File,
+		NULL, NULL, pDiagram);
+	event_setmask(tMask);
+} /* end of vSaveTextfile */
+
+/*
+ * bDraw2File - Save the generated draw file to a Draw file
+ *
+ * Remark: This is not a simple copy action. The origin of the
+ * coordinates (0,0) must move from the top-left corner to the
+ * bottom-left corner.
+ */
+static BOOL
+bDraw2File(char *szFilename, void *pvHandle)
+{
+	FILE		*pFile;
+	diagram_type	*pDiagram;
+	draw_fileheader tHdr;
+	draw_textstrhdr	tText;
+	draw_pathstrhdr	tPath;
+	draw_spristrhdr	tSprite;
+	draw_jpegstrhdr tJpeg;
+	int	*piPath;
+	char	*pcTmp;
+	int	iYadd, iToGo, iSize;
+	BOOL	bSuccess;
+
+	fail(szFilename == NULL || szFilename[0] == '\0');
+	fail(pvHandle == NULL);
+
+	DBG_MSG("bDraw2File");
+	NO_DBG_MSG(szFilename);
+
+	pDiagram = (diagram_type *)pvHandle;
+	pFile = fopen(szFilename, "wb");
+	if (pFile == NULL) {
+		werr(0, "I can't open '%s' for writing", szFilename);
+		return FALSE;
+	}
+	iToGo = pDiagram->tInfo.length;
+	DBG_DEC(iToGo);
+	pcTmp = pDiagram->tInfo.data;
+	tHdr = *(draw_fileheader *)pcTmp;
+	iYadd = -tHdr.bbox.y0;
+	tHdr.bbox.y0 += iYadd;
+	tHdr.bbox.y1 += iYadd;
+	bSuccess = bWrite2File(&tHdr, sizeof(tHdr), pFile, szFilename);
+	iToGo -= sizeof(tHdr);
+	DBG_DEC(iToGo);
+	pcTmp += sizeof(tHdr);
+	while (iToGo > 0 && bSuccess) {
+		tText = *(draw_textstrhdr *)pcTmp;
+		switch (tText.tag) {
+		case draw_OBJFONTLIST:
+			iSize = ((draw_fontliststrhdr *)pcTmp)->size;
+			bSuccess = bWrite2File(pcTmp,
+					iSize, pFile, szFilename);
+			pcTmp += iSize;
+			iToGo -= iSize;
+			break;
+		case draw_OBJTEXT:
+			/* First correct the coordinates */
+			tText.bbox.y0 += iYadd;
+			tText.bbox.y1 += iYadd;
+			tText.coord.y += iYadd;
+			/* Now write the information to file */
+			bSuccess = bWrite2File(&tText,
+				sizeof(tText), pFile, szFilename);
+			pcTmp += sizeof(tText);
+			iSize = tText.size - sizeof(tText);
+			if (bSuccess) {
+				bSuccess = bWrite2File(pcTmp,
+					iSize, pFile, szFilename);
+				pcTmp += iSize;
+			}
+			iToGo -= tText.size;
+			break;
+		case draw_OBJPATH:
+			tPath = *(draw_pathstrhdr *)pcTmp;
+			/* First correct the coordinates */
+			tPath.bbox.y0 += iYadd;
+			tPath.bbox.y1 += iYadd;
+			/* Now write the information to file */
+			bSuccess = bWrite2File(&tPath,
+				sizeof(tPath), pFile, szFilename);
+			pcTmp += sizeof(tPath);
+			iSize = tPath.size - sizeof(tPath);
+			fail(iSize < 14 * sizeof(int));
+			/* Second correct the path coordinates */
+			piPath = xmalloc(iSize);
+			memcpy(piPath, pcTmp, iSize);
+			piPath[ 2] += iYadd;
+			piPath[ 5] += iYadd;
+			piPath[ 8] += iYadd;
+			piPath[11] += iYadd;
+			if (bSuccess) {
+				bSuccess = bWrite2File(piPath,
+					iSize, pFile, szFilename);
+				pcTmp += iSize;
+			}
+			piPath = xfree(piPath);
+			iToGo -= tPath.size;
+			break;
+		case draw_OBJSPRITE:
+			tSprite = *(draw_spristrhdr *)pcTmp;
+			/* First correct the coordinates */
+			tSprite.bbox.y0 += iYadd;
+			tSprite.bbox.y1 += iYadd;
+			/* Now write the information to file */
+			bSuccess = bWrite2File(&tSprite,
+				sizeof(tSprite), pFile, szFilename);
+			pcTmp += sizeof(tSprite);
+			iSize = tSprite.size - sizeof(tSprite);
+			if (bSuccess) {
+				bSuccess = bWrite2File(pcTmp,
+					iSize, pFile, szFilename);
+				pcTmp += iSize;
+			}
+			iToGo -= tSprite.size;
+			break;
+		case draw_OBJJPEG:
+			tJpeg = *(draw_jpegstrhdr *)pcTmp;
+			/* First correct the coordinates */
+			tJpeg.bbox.y0 += iYadd;
+			tJpeg.bbox.y1 += iYadd;
+			tJpeg.trfm[5] += iYadd;
+			/* Now write the information to file */
+			bSuccess = bWrite2File(&tJpeg,
+				sizeof(tJpeg), pFile, szFilename);
+			pcTmp += sizeof(tJpeg);
+			iSize = tJpeg.size - sizeof(tJpeg);
+			if (bSuccess) {
+				bSuccess = bWrite2File(pcTmp,
+					iSize, pFile, szFilename);
+				pcTmp += iSize;
+			}
+			iToGo -= tJpeg.size;
+			break;
+		default:
+			DBG_DEC(tText.tag);
+			bSuccess = FALSE;
+			break;
+		}
+	}
+	DBG_DEC_C(iToGo != 0, iToGo);
+	(void)fclose(pFile);
+	if (bSuccess) {
+		vSetFiletype(szFilename, FILETYPE_DRAW);
+	} else {
+		(void)remove(szFilename);
+		werr(0, "Unable to save drawfile '%s'", szFilename);
+	}
+	return bSuccess;
+} /* end of bDraw2File */
+
+/*
+ * vSaveDrawfile
+ */
+void
+vSaveDrawfile(diagram_type *pDiagram)
+{
+	wimp_emask	tMask;
+	int		iEstSize;
+
+	fail(pDiagram == NULL);
+
+	DBG_MSG("vSaveDrawfile");
+	iEstSize = pDiagram->tInfo.length;
+	DBG_DEC(iEstSize);
+
+	tMask = event_getmask();
+	event_setmask(0);
+	saveas(FILETYPE_DRAW, "WordDraw",
+		iEstSize, bDraw2File,
+		NULL, NULL, pDiagram);
+	event_setmask(tMask);
+} /* end of vSaveDrawfile */

Some files were not shown because too many files changed in this diff