antiword.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735
  1. /*
  2. * antiword.h
  3. * Copyright (C) 1998-2004 A.J. van Os; Released under GNU GPL
  4. *
  5. * Description:
  6. * Generic include file for project 'Antiword'
  7. */
  8. #if !defined(__antiword_h)
  9. #define __antiword_h 1
  10. #if defined(DEBUG) == defined(NDEBUG)
  11. #error Exactly one of the DEBUG and NDEBUG flags MUST be set
  12. #endif /* DEBUG == NDEBUG */
  13. #include <stdio.h>
  14. #include <limits.h>
  15. #if defined(__riscos)
  16. #include "DeskLib:Font.h"
  17. #include "DeskLib:Wimp.h"
  18. #include "Desklib:Window.h"
  19. #include "drawfile.h"
  20. #define window_ANY event_ANY
  21. #define icon_ANY event_ANY
  22. #else
  23. #include <sys/types.h>
  24. #endif /* __riscos */
  25. #include "wordconst.h"
  26. #include "wordtypes.h"
  27. #include "fail.h"
  28. #include "debug.h"
  29. /* Constants */
  30. #if !defined(PATH_MAX)
  31. #if defined(__riscos)
  32. #define PATH_MAX 255
  33. #else
  34. #if defined(MAXPATHLEN)
  35. #define PATH_MAX MAXPATHLEN
  36. #else
  37. #define PATH_MAX 1024
  38. #endif /* MAXPATHLEN */
  39. #endif /* __riscos */
  40. #endif /* !PATH_MAX */
  41. #if !defined(CHAR_BIT)
  42. #define CHAR_BIT 8
  43. #endif /* CHAR_BIT */
  44. #if !defined(TIME_T_MIN)
  45. #define TIME_T_MIN ((time_t)0 < (time_t)-1 ?\
  46. (time_t)0 :\
  47. (time_t)1 << (sizeof(time_t) * CHAR_BIT - 1))
  48. #endif /* TIMER_T_MIN */
  49. #if !defined(TIME_T_MAX)
  50. #if defined(__TURBOC__) /* Turbo C chokes on the subtraction below */
  51. #define TIME_T_MAX (LONG_MAX)
  52. #else /* All others */
  53. #define TIME_T_MAX (~(time_t)0 - TIME_T_MIN)
  54. #endif /* __TURBOC__ */
  55. #endif /* TIME_T_MAX */
  56. #if !defined(SIZE_T_MAX)
  57. #define SIZE_T_MAX (~(size_t)0)
  58. #endif /* SIZE_T_MAX */
  59. #if defined(__riscos)
  60. #define FILE_SEPARATOR "."
  61. #elif defined(__dos) || defined(__CYGMING__)
  62. #define FILE_SEPARATOR "\\"
  63. #else /* All others */
  64. #define FILE_SEPARATOR "/"
  65. #endif /* __riscos */
  66. /* PNG chunk names */
  67. #define PNG_CN_IDAT 0x49444154
  68. #define PNG_CN_IEND 0x49454e44
  69. #define PNG_CN_IHDR 0x49484452
  70. #define PNG_CN_PLTE 0x504c5445
  71. /* The screen width */
  72. #define MIN_SCREEN_WIDTH 45
  73. #define DEFAULT_SCREEN_WIDTH 76
  74. #define MAX_SCREEN_WIDTH 145
  75. #if defined(__riscos)
  76. /* The scale factors as percentages */
  77. #define MIN_SCALE_FACTOR 25
  78. #define DEFAULT_SCALE_FACTOR 100
  79. #define MAX_SCALE_FACTOR 400
  80. /* Filetypes */
  81. #define FILETYPE_MSWORD 0xae6
  82. #define FILETYPE_DRAW 0xaff
  83. #define FILETYPE_JPEG 0xc85
  84. #define FILETYPE_POSCRIPT 0xff5
  85. #define FILETYPE_SPRITE 0xff9
  86. #define FILETYPE_TEXT 0xfff
  87. /* The button numbers in the choices window */
  88. #define CHOICES_DEFAULT_BUTTON 3
  89. #define CHOICES_SAVE_BUTTON 2
  90. #define CHOICES_CANCEL_BUTTON 1
  91. #define CHOICES_APPLY_BUTTON 0
  92. #define CHOICES_BREAK_BUTTON 6
  93. #define CHOICES_BREAK_WRITEABLE 7
  94. #define CHOICES_BREAK_UP_BUTTON 8
  95. #define CHOICES_BREAK_DOWN_BUTTON 9
  96. #define CHOICES_NO_BREAK_BUTTON 11
  97. #define CHOICES_AUTOFILETYPE_BUTTON 14
  98. #define CHOICES_HIDDEN_TEXT_BUTTON 22
  99. #define CHOICES_WITH_IMAGES_BUTTON 17
  100. #define CHOICES_NO_IMAGES_BUTTON 18
  101. #define CHOICES_TEXTONLY_BUTTON 19
  102. #define CHOICES_SCALE_WRITEABLE 25
  103. #define CHOICES_SCALE_UP_BUTTON 26
  104. #define CHOICES_SCALE_DOWN_BUTTON 27
  105. /* The button numbers in the scale view window */
  106. #define SCALE_CANCEL_BUTTON 1
  107. #define SCALE_SCALE_BUTTON 0
  108. #define SCALE_SCALE_WRITEABLE 3
  109. #define SCALE_50_PCT 5
  110. #define SCALE_75_PCT 6
  111. #define SCALE_100_PCT 7
  112. #define SCALE_150_PCT 8
  113. /* Save menu fields */
  114. #define SAVEMENU_SCALEVIEW 0
  115. #define SAVEMENU_SAVEDRAW 1
  116. #define SAVEMENU_SAVETEXT 2
  117. #else
  118. /* Margins for the PostScript version */
  119. #define PS_LEFT_MARGIN (72 * 640L)
  120. #define PS_RIGHT_MARGIN (48 * 640L)
  121. #define PS_TOP_MARGIN (72 * 640L)
  122. #define PS_BOTTOM_MARGIN (72 * 640L)
  123. #endif /* __riscos */
  124. /* Macros */
  125. #define STREQ(x,y) (*(x) == *(y) && strcmp(x,y) == 0)
  126. #define STRNEQ(x,y,n) (*(x) == *(y) && strncmp(x,y,n) == 0)
  127. #if defined(__dos) || defined(__EMX__)
  128. #define STRCEQ(x,y) (stricmp(x,y) == 0)
  129. #else
  130. #define STRCEQ(x,y) (strcasecmp(x,y) == 0)
  131. #endif /* __dos or __EMX__ */
  132. #define elementsof(a) (sizeof(a) / sizeof(a[0]))
  133. #define odd(x) (((x)&0x01)!=0)
  134. #define ROUND4(x) (((x)+3)&~0x03)
  135. #define ROUND128(x) (((x)+127)&~0x7f)
  136. #define BIT(x) (1UL << (x))
  137. #if !defined(max)
  138. #define max(x,y) ((x)>(y)?(x):(y))
  139. #endif /* !max */
  140. #if !defined(min)
  141. #define min(x,y) ((x)<(y)?(x):(y))
  142. #endif /* !min */
  143. #if defined(__riscos)
  144. /* The name of the table font */
  145. #define TABLE_FONT "Corpus.Medium"
  146. /* Names of the default fonts */
  147. #define FONT_MONOSPACED_PLAIN "Corpus.Medium"
  148. #define FONT_MONOSPACED_BOLD "Corpus.Bold"
  149. #define FONT_MONOSPACED_ITALIC "Corpus.Medium.Oblique"
  150. #define FONT_MONOSPACED_BOLDITALIC "Corpus.Bold.Oblique"
  151. #define FONT_SERIF_PLAIN "Trinity.Medium"
  152. #define FONT_SERIF_BOLD "Trinity.Bold"
  153. #define FONT_SERIF_ITALIC "Trinity.Medium.Italic"
  154. #define FONT_SERIF_BOLDITALIC "Trinity.Bold.Italic"
  155. #define FONT_SANS_SERIF_PLAIN "Homerton.Medium"
  156. #define FONT_SANS_SERIF_BOLD "Homerton.Bold"
  157. #define FONT_SANS_SERIF_ITALIC "Homerton.Medium.Oblique"
  158. #define FONT_SANS_SERIF_BOLDITALIC "Homerton.Bold.Oblique"
  159. #else
  160. /* The name of the table font */
  161. #define TABLE_FONT "Courier"
  162. /* Names of the default fonts */
  163. #define FONT_MONOSPACED_PLAIN "Courier"
  164. #define FONT_MONOSPACED_BOLD "Courier-Bold"
  165. #define FONT_MONOSPACED_ITALIC "Courier-Oblique"
  166. #define FONT_MONOSPACED_BOLDITALIC "Courier-BoldOblique"
  167. #define FONT_SERIF_PLAIN "Times-Roman"
  168. #define FONT_SERIF_BOLD "Times-Bold"
  169. #define FONT_SERIF_ITALIC "Times-Italic"
  170. #define FONT_SERIF_BOLDITALIC "Times-BoldItalic"
  171. #define FONT_SANS_SERIF_PLAIN "Helvetica"
  172. #define FONT_SANS_SERIF_BOLD "Helvetica-Bold"
  173. #define FONT_SANS_SERIF_ITALIC "Helvetica-Oblique"
  174. #define FONT_SANS_SERIF_BOLDITALIC "Helvetica-BoldOblique"
  175. /* The name of the antiword directories and the font information file */
  176. #if defined(__dos)
  177. #define GLOBAL_ANTIWORD_DIR "C:\\antiword"
  178. #define ANTIWORD_DIR "antiword"
  179. #define FONTNAMES_FILE "fontname.txt"
  180. #elif defined(__amigaos)
  181. #define GLOBAL_ANTIWORD_DIR "SYS:.antiword"
  182. #define ANTIWORD_DIR ".antiword"
  183. #define FONTNAMES_FILE "fontnames"
  184. #elif defined(N_PLAT_NLM)
  185. #define GLOBAL_ANTIWORD_DIR "SYS:/antiword"
  186. #define ANTIWORD_DIR "antiword"
  187. #define FONTNAMES_FILE "fontname.txt"
  188. #elif defined(__vms)
  189. #define GLOBAL_ANTIWORD_DIR "/usr/share/antiword"
  190. #define ANTIWORD_DIR "antiword"
  191. #define FONTNAMES_FILE "fontnames"
  192. #elif defined(__BEOS__)
  193. #define GLOBAL_ANTIWORD_DIR "/boot/home/config/apps/antiword"
  194. #define ANTIWORD_DIR "antiword"
  195. #define FONTNAMES_FILE "fontnames"
  196. #elif defined(__CYGMING__)
  197. #define GLOBAL_ANTIWORD_DIR "C:\\antiword"
  198. #define ANTIWORD_DIR "antiword"
  199. #define FONTNAMES_FILE "fontnames"
  200. #elif defined(__Plan9__)
  201. #define GLOBAL_ANTIWORD_DIR "/sys/lib/antiword"
  202. #define ANTIWORD_DIR "lib/antiword"
  203. #define FONTNAMES_FILE "fontnames"
  204. #elif defined(__sun__)
  205. #define GLOBAL_ANTIWORD_DIR "/usr/local/share/antiword"
  206. #define ANTIWORD_DIR ".antiword"
  207. #define FONTNAMES_FILE "fontnames"
  208. #else /* All others */
  209. #define GLOBAL_ANTIWORD_DIR "/usr/share/antiword"
  210. #define ANTIWORD_DIR ".antiword"
  211. #define FONTNAMES_FILE "fontnames"
  212. #endif /* __dos */
  213. /* The names of grouped mapping files */
  214. /* ASCII */
  215. #define MAPPING_FILE_CP437 "cp437.txt"
  216. /* Latin1 */
  217. #define MAPPING_FILE_8859_1 "8859-1.txt"
  218. /* Latin2 */
  219. #define MAPPING_FILE_8859_2 "8859-2.txt"
  220. #define MAPPING_FILE_CP852 "cp852.txt"
  221. #define MAPPING_FILE_CP1250 "cp1250.txt"
  222. /* Cyrillic */
  223. #define MAPPING_FILE_8859_5 "8859-5.txt"
  224. #define MAPPING_FILE_KOI8_R "koi8-r.txt"
  225. #define MAPPING_FILE_KOI8_U "koi8-u.txt"
  226. #define MAPPING_FILE_CP866 "cp866.txt"
  227. #define MAPPING_FILE_CP1251 "cp1251.txt"
  228. /* Latin9 */
  229. #define MAPPING_FILE_8859_15 "8859-15.txt"
  230. /* UTF-8 */
  231. #define MAPPING_FILE_UTF_8 "UTF-8.txt"
  232. #endif /* __riscos */
  233. /* Prototypes */
  234. /* asc85enc.c */
  235. extern void vASCII85EncodeByte(FILE *, int);
  236. extern void vASCII85EncodeArray(FILE *, FILE *, size_t);
  237. extern void vASCII85EncodeFile(FILE *, FILE *, size_t);
  238. /* blocklist.c */
  239. extern void vDestroyTextBlockList(void);
  240. extern BOOL bAdd2TextBlockList(const text_block_type *);
  241. extern void vSplitBlockList(FILE *, ULONG, ULONG, ULONG, ULONG, ULONG,
  242. ULONG, ULONG, ULONG, BOOL);
  243. extern BOOL bExistsHdrFtr(void);
  244. extern BOOL bExistsTextBox(void);
  245. extern BOOL bExistsHdrTextBox(void);
  246. extern USHORT usNextChar(FILE *, list_id_enum, ULONG *, ULONG *, USHORT *);
  247. extern USHORT usToHdrFtrPosition(FILE *, ULONG);
  248. extern USHORT usToFootnotePosition(FILE *, ULONG);
  249. extern ULONG ulCharPos2FileOffsetX(ULONG, list_id_enum *);
  250. extern ULONG ulCharPos2FileOffset(ULONG);
  251. extern ULONG ulHdrFtrOffset2CharPos(ULONG);
  252. extern ULONG ulGetSeqNumber(ULONG);
  253. #if defined(__riscos)
  254. extern ULONG ulGetDocumentLength(void);
  255. #endif /* __riscos */
  256. /* chartrans.c */
  257. extern UCHAR ucGetBulletCharacter(conversion_type, encoding_type);
  258. extern UCHAR ucGetNbspCharacter(void);
  259. extern BOOL bReadCharacterMappingTable(FILE *);
  260. extern ULONG ulTranslateCharacters(USHORT, ULONG, int, conversion_type,
  261. encoding_type, BOOL);
  262. extern ULONG ulToUpper(ULONG);
  263. /* datalist.c */
  264. extern void vDestroyDataBlockList(void);
  265. extern BOOL bAdd2DataBlockList(const data_block_type *);
  266. extern ULONG ulGetDataOffset(FILE *);
  267. extern BOOL bSetDataOffset(FILE *, ULONG);
  268. extern int iNextByte(FILE *);
  269. extern USHORT usNextWord(FILE *);
  270. extern ULONG ulNextLong(FILE *);
  271. extern USHORT usNextWordBE(FILE *);
  272. extern ULONG ulNextLongBE(FILE *);
  273. extern size_t tSkipBytes(FILE *, size_t);
  274. extern ULONG ulDataPos2FileOffset(ULONG);
  275. /* depot.c */
  276. extern void vDestroySmallBlockList(void);
  277. extern BOOL bCreateSmallBlockList(ULONG, const ULONG *, size_t);
  278. extern ULONG ulDepotOffset(ULONG, size_t);
  279. /* dib2eps & dib2sprt.c */
  280. extern BOOL bTranslateDIB(diagram_type *,
  281. FILE *, ULONG, const imagedata_type *);
  282. #if defined(__dos)
  283. /* dos.c */
  284. extern int iGetCodepage(void);
  285. #endif /* __dos */
  286. /* doclist.c */
  287. extern void vDestroyDocumentInfoList(void);
  288. extern void vCreateDocumentInfoList(const document_block_type *);
  289. extern UCHAR ucGetDopHdrFtrSpecification(void);
  290. /* draw.c & output.c */
  291. extern BOOL bAddDummyImage(diagram_type *, const imagedata_type *);
  292. extern diagram_type *pCreateDiagram(const char *, const char *);
  293. extern void vPrologue2(diagram_type *, int);
  294. extern void vMove2NextLine(diagram_type *, drawfile_fontref, USHORT);
  295. extern void vSubstring2Diagram(diagram_type *,
  296. char *, size_t, long, UCHAR, USHORT,
  297. drawfile_fontref, USHORT, USHORT);
  298. extern void vStartOfParagraph1(diagram_type *, long);
  299. extern void vStartOfParagraph2(diagram_type *);
  300. extern void vEndOfParagraph(diagram_type *, drawfile_fontref, USHORT, long);
  301. extern void vEndOfPage(diagram_type *, long, BOOL);
  302. extern void vSetHeaders(diagram_type *, USHORT);
  303. extern void vStartOfList(diagram_type *, UCHAR, BOOL);
  304. extern void vEndOfList(diagram_type *);
  305. extern void vStartOfListItem(diagram_type *, BOOL);
  306. extern void vEndOfTable(diagram_type *);
  307. extern BOOL bAddTableRow(diagram_type *, char **, int,
  308. const short *, UCHAR);
  309. #if defined(__riscos)
  310. extern BOOL bDestroyDiagram(event_pollblock *, void *);
  311. extern void vImage2Diagram(diagram_type *, const imagedata_type *,
  312. UCHAR *, size_t);
  313. extern BOOL bVerifyDiagram(diagram_type *);
  314. extern void vShowDiagram(diagram_type *);
  315. extern void vMainButtonClick(mouse_block *);
  316. extern BOOL bMainKeyPressed(event_pollblock *, void *);
  317. extern BOOL bMainEventHandler(event_pollblock *, void *);
  318. extern BOOL bRedrawMainWindow(event_pollblock *, void *);
  319. extern BOOL bScaleOpenAction(event_pollblock *, void *);
  320. extern void vSetTitle(diagram_type *);
  321. extern void vScaleButtonClick(mouse_block *, diagram_type *);
  322. extern BOOL bScaleKeyPressed(event_pollblock *, void *);
  323. extern BOOL bScaleEventHandler(event_pollblock *, void *);
  324. #else
  325. extern void vImagePrologue(diagram_type *, const imagedata_type *);
  326. extern void vImageEpilogue(diagram_type *);
  327. extern void vDestroyDiagram(diagram_type *);
  328. #endif /* __riscos */
  329. /* finddata.c */
  330. extern BOOL bAddDataBlocks(ULONG , ULONG, ULONG, const ULONG *, size_t);
  331. extern BOOL bGet6DocumentData(FILE *, ULONG,
  332. const ULONG *, size_t, const UCHAR *);
  333. /* findtext.c */
  334. extern BOOL bAddTextBlocks(ULONG , ULONG, BOOL,
  335. USHORT, ULONG, const ULONG *, size_t);
  336. extern BOOL bGet6DocumentText(FILE *, BOOL, ULONG,
  337. const ULONG *, size_t, const UCHAR *);
  338. extern BOOL bGet8DocumentText(FILE *, const pps_info_type *,
  339. const ULONG *, size_t, const ULONG *, size_t,
  340. const UCHAR *);
  341. /* fmt_text.c */
  342. extern void vPrologueFMT(diagram_type *, const options_type *);
  343. extern void vSubstringFMT(diagram_type *, const char *, size_t, long,
  344. USHORT);
  345. /* fontlist.c */
  346. extern void vDestroyFontInfoList(void);
  347. extern void vCorrectFontValues(font_block_type *);
  348. extern void vAdd2FontInfoList(const font_block_type *);
  349. extern const font_block_type *pGetNextFontInfoListItem(
  350. const font_block_type *);
  351. /* fonts.c */
  352. extern int iGetFontByNumber(UCHAR, USHORT);
  353. extern const char *szGetOurFontname(int);
  354. extern int iFontname2Fontnumber(const char *, USHORT);
  355. extern void vCreate0FontTable(void);
  356. extern void vCreate2FontTable(FILE *, int, const UCHAR *);
  357. extern void vCreate6FontTable(FILE *, ULONG,
  358. const ULONG *, size_t, const UCHAR *);
  359. extern void vCreate8FontTable(FILE *, const pps_info_type *,
  360. const ULONG *, size_t, const ULONG *, size_t,
  361. const UCHAR *);
  362. extern void vDestroyFontTable(void);
  363. extern const font_table_type *pGetNextFontTableRecord(
  364. const font_table_type *);
  365. extern size_t tGetFontTableLength(void);
  366. extern void vCorrectFontTable(conversion_type, encoding_type);
  367. extern long lComputeSpaceWidth(drawfile_fontref, USHORT);
  368. /* fonts_r.c & fonts_u.c */
  369. extern FILE *pOpenFontTableFile(void);
  370. extern void vCloseFont(void);
  371. extern drawfile_fontref tOpenFont(UCHAR, USHORT, USHORT);
  372. extern drawfile_fontref tOpenTableFont(USHORT);
  373. extern long lComputeStringWidth(const char *, size_t, drawfile_fontref, USHORT);
  374. extern size_t tCountColumns(const char *, size_t);
  375. extern size_t tGetCharacterLength(const char *);
  376. /* fonts_u.c */
  377. #if !defined(__riscos)
  378. extern const char *szGetFontname(drawfile_fontref);
  379. #endif /* !__riscos */
  380. /* hdrftrlist.c */
  381. extern void vDestroyHdrFtrInfoList(void);
  382. extern void vCreat8HdrFtrInfoList(const ULONG *, size_t);
  383. extern void vCreat6HdrFtrInfoList(const ULONG *, size_t);
  384. extern void vCreat2HdrFtrInfoList(const ULONG *, size_t);
  385. extern const hdrftr_block_type *pGetHdrFtrInfo(int, BOOL, BOOL, BOOL);
  386. extern void vPrepareHdrFtrText(FILE *);
  387. #if defined(__riscos)
  388. /* icons.c */
  389. extern void vUpdateIcon(window_handle, icon_block *);
  390. extern void vUpdateRadioButton(window_handle, icon_handle, BOOL);
  391. extern void vUpdateWriteable(window_handle, icon_handle, const char *);
  392. extern void vUpdateWriteableNumber(window_handle, icon_handle, int);
  393. #endif /* __riscos */
  394. /* imgexam.c */
  395. extern image_info_enum eExamineImage(FILE *, ULONG, imagedata_type *);
  396. /* imgtrans */
  397. extern BOOL bTranslateImage(diagram_type *,
  398. FILE *, BOOL, ULONG, const imagedata_type *);
  399. /* jpeg2eps.c & jpeg2spr.c */
  400. extern BOOL bTranslateJPEG(diagram_type *,
  401. FILE *, ULONG, size_t, const imagedata_type *);
  402. /* listlist.c */
  403. extern void vDestroyListInfoList(void);
  404. extern void vBuildLfoList(const UCHAR *, size_t);
  405. extern void vAdd2ListInfoList(ULONG, USHORT, UCHAR,
  406. const list_block_type *);
  407. extern const list_block_type *pGetListInfo(USHORT, UCHAR);
  408. extern USHORT usGetListValue(int, int, const style_block_type *);
  409. /* misc.c */
  410. #if !defined(__riscos)
  411. extern const char *szGetHomeDirectory(void);
  412. extern const char *szGetAntiwordDirectory(void);
  413. #endif /* !__riscos */
  414. extern long lGetFilesize(const char *);
  415. #if defined(DEBUG)
  416. extern void vPrintBlock(const char *, int, const UCHAR *, size_t);
  417. extern void vPrintUnicode(const char *, int, const UCHAR *, size_t);
  418. extern BOOL bCheckDoubleLinkedList(output_type *);
  419. #endif /* DEBUG */
  420. extern BOOL bReadBytes(UCHAR *, size_t, ULONG, FILE *);
  421. extern BOOL bReadBuffer(FILE *, ULONG, const ULONG *, size_t, size_t,
  422. UCHAR *, ULONG, size_t);
  423. extern ULONG ulColor2Color(UCHAR);
  424. extern output_type *pSplitList(output_type *);
  425. extern size_t tNumber2Roman(UINT, BOOL, char *);
  426. extern size_t tNumber2Alpha(UINT, BOOL, char *);
  427. extern char *unincpy(char *, const UCHAR *, size_t);
  428. extern size_t unilen(const UCHAR *);
  429. extern const char *szBasename(const char *);
  430. extern long lComputeLeading(USHORT);
  431. extern size_t tUcs2Utf8(ULONG, char *, size_t);
  432. extern void vGetBulletValue(conversion_type, encoding_type, char *, size_t);
  433. extern BOOL bAllZero(const UCHAR *, size_t);
  434. extern BOOL bGetNormalizedCodeset(char *, size_t, BOOL *);
  435. extern const char *szGetDefaultMappingFile(void);
  436. extern time_t tConvertDTTM(ULONG);
  437. /* notes.c */
  438. extern void vDestroyNotesInfoLists(void);
  439. extern void vGetNotesInfo(FILE *, const pps_info_type *,
  440. const ULONG *, size_t, const ULONG *, size_t,
  441. const UCHAR *, int);
  442. extern void vPrepareFootnoteText(FILE *);
  443. extern const char *szGetFootnootText(UINT);
  444. extern notetype_enum eGetNotetype(ULONG);
  445. /* options.c */
  446. extern int iReadOptions(int, char **);
  447. extern void vGetOptions(options_type *);
  448. #if defined(__riscos)
  449. extern void vChoicesOpenAction(window_handle);
  450. extern BOOL bChoicesMouseClick(event_pollblock *, void *);
  451. extern BOOL bChoicesKeyPressed(event_pollblock *, void *);
  452. #endif /* __riscos */
  453. /* out2window.c */
  454. extern void vSetLeftIndentation(diagram_type *, long);
  455. extern void vAlign2Window(diagram_type *, output_type *,
  456. long, UCHAR);
  457. extern void vJustify2Window(diagram_type *, output_type *,
  458. long, long, UCHAR);
  459. extern void vResetStyles(void);
  460. extern size_t tStyle2Window(char *, size_t, const style_block_type *,
  461. const section_block_type *);
  462. extern void vTableRow2Window(diagram_type *, output_type *,
  463. const row_block_type *, conversion_type, int);
  464. /* pdf.c */
  465. extern void vCreateInfoDictionary(diagram_type *, int);
  466. extern void vProloguePDF(diagram_type *,
  467. const char *, const options_type *);
  468. extern void vEpiloguePDF(diagram_type *);
  469. extern void vImageProloguePDF(diagram_type *, const imagedata_type *);
  470. extern void vImageEpiloguePDF(diagram_type *);
  471. extern BOOL bAddDummyImagePDF(diagram_type *, const imagedata_type *);
  472. extern void vAddFontsPDF(diagram_type *);
  473. extern void vMove2NextLinePDF(diagram_type *, USHORT);
  474. extern void vSubstringPDF(diagram_type *,
  475. char *, size_t, long, UCHAR, USHORT,
  476. drawfile_fontref, USHORT, USHORT);
  477. extern void vStartOfParagraphPDF(diagram_type *, long);
  478. extern void vEndOfParagraphPDF(diagram_type *, USHORT, long);
  479. extern void vEndOfPagePDF(diagram_type *, BOOL);
  480. /* pictlist.c */
  481. extern void vDestroyPictInfoList(void);
  482. extern void vAdd2PictInfoList(const picture_block_type *);
  483. extern ULONG ulGetPictInfoListItem(ULONG);
  484. /* png2eps.c & png2spr.c */
  485. extern BOOL bTranslatePNG(diagram_type *,
  486. FILE *, ULONG, size_t, const imagedata_type *);
  487. /* postscript.c */
  488. extern void vProloguePS(diagram_type *,
  489. const char *, const char *, const options_type *);
  490. extern void vEpiloguePS(diagram_type *);
  491. extern void vImageProloguePS(diagram_type *, const imagedata_type *);
  492. extern void vImageEpiloguePS(diagram_type *);
  493. extern BOOL bAddDummyImagePS(diagram_type *, const imagedata_type *);
  494. extern void vAddFontsPS(diagram_type *);
  495. extern void vMove2NextLinePS(diagram_type *, USHORT);
  496. extern void vSubstringPS(diagram_type *,
  497. char *, size_t, long, UCHAR, USHORT,
  498. drawfile_fontref, USHORT, USHORT);
  499. extern void vStartOfParagraphPS(diagram_type *, long);
  500. extern void vEndOfParagraphPS(diagram_type *, USHORT, long);
  501. extern void vEndOfPagePS(diagram_type *, BOOL);
  502. /* prop0.c */
  503. extern void vGet0DopInfo(FILE *, const UCHAR *);
  504. extern void vGet0SepInfo(FILE *, const UCHAR *);
  505. extern void vGet0PapInfo(FILE *, const UCHAR *);
  506. extern void vGet0ChrInfo(FILE *, const UCHAR *);
  507. /* prop2.c */
  508. extern void vGet2DopInfo(FILE *, const UCHAR *);
  509. extern void vGet2SepInfo(FILE *, const UCHAR *);
  510. extern void vGet2HdrFtrInfo(FILE *, const UCHAR *);
  511. extern row_info_enum eGet2RowInfo(int,
  512. const UCHAR *, int, row_block_type *);
  513. extern void vGet2StyleInfo(int,
  514. const UCHAR *, int, style_block_type *);
  515. extern void vGet2PapInfo(FILE *, const UCHAR *);
  516. extern void vGet1FontInfo(int,
  517. const UCHAR *, size_t, font_block_type *);
  518. extern void vGet2FontInfo(int,
  519. const UCHAR *, size_t, font_block_type *);
  520. extern void vGet2ChrInfo(FILE *, int, const UCHAR *);
  521. /* prop6.c */
  522. extern void vGet6DopInfo(FILE *, ULONG, const ULONG *, size_t,
  523. const UCHAR *);
  524. extern void vGet6SepInfo(FILE *, ULONG, const ULONG *, size_t,
  525. const UCHAR *);
  526. extern void vGet6HdrFtrInfo(FILE *, ULONG, const ULONG *, size_t,
  527. const UCHAR *);
  528. extern row_info_enum eGet6RowInfo(int,
  529. const UCHAR *, int, row_block_type *);
  530. extern void vGet6StyleInfo(int,
  531. const UCHAR *, int, style_block_type *);
  532. extern void vGet6PapInfo(FILE *, ULONG, const ULONG *, size_t,
  533. const UCHAR *);
  534. extern void vGet6FontInfo(int, USHORT,
  535. const UCHAR *, int, font_block_type *);
  536. extern void vGet6ChrInfo(FILE *, ULONG, const ULONG *, size_t,
  537. const UCHAR *);
  538. /* prop8.c */
  539. extern void vGet8DopInfo(FILE *, const pps_type *,
  540. const ULONG *, size_t, const ULONG *, size_t,
  541. const UCHAR *);
  542. extern void vGet8SepInfo(FILE *, const pps_info_type *,
  543. const ULONG *, size_t, const ULONG *, size_t,
  544. const UCHAR *);
  545. extern void vGet8HdrFtrInfo(FILE *, const pps_type *,
  546. const ULONG *, size_t, const ULONG *, size_t,
  547. const UCHAR *);
  548. extern row_info_enum eGet8RowInfo(int,
  549. const UCHAR *, int, row_block_type *);
  550. extern void vGet8StyleInfo(int,
  551. const UCHAR *, int, style_block_type *);
  552. extern void vGet8LstInfo(FILE *, const pps_info_type *,
  553. const ULONG *, size_t, const ULONG *, size_t,
  554. const UCHAR *);
  555. extern void vGet8PapInfo(FILE *, const pps_info_type *,
  556. const ULONG *, size_t, const ULONG *, size_t,
  557. const UCHAR *);
  558. extern void vGet8FontInfo(int, USHORT,
  559. const UCHAR *, int, font_block_type *);
  560. extern void vGet8ChrInfo(FILE *, const pps_info_type *,
  561. const ULONG *, size_t, const ULONG *, size_t,
  562. const UCHAR *);
  563. /* properties.c */
  564. extern void vGetPropertyInfo(FILE *, const pps_info_type *,
  565. const ULONG *, size_t, const ULONG *, size_t,
  566. const UCHAR *, int);
  567. extern row_info_enum ePropMod2RowInfo(USHORT, int);
  568. /* propmod.c */
  569. extern void vDestroyPropModList(void);
  570. extern void vAdd2PropModList(const UCHAR *);
  571. extern const UCHAR *aucReadPropModListItem(USHORT);
  572. /* rowlist.c */
  573. extern void vDestroyRowInfoList(void);
  574. extern void vAdd2RowInfoList(const row_block_type *);
  575. extern const row_block_type *pGetNextRowInfoListItem(void);
  576. /* riscos.c */
  577. #if defined(__riscos)
  578. extern int iGetFiletype(const char *);
  579. extern void vSetFiletype(const char *, int);
  580. extern BOOL bMakeDirectory(const char *);
  581. extern int iReadCurrentAlphabetNumber(void);
  582. extern int iGetRiscOsVersion(void);
  583. extern BOOL bDrawRenderDiag360(void *, size_t,
  584. window_redrawblock *, double, os_error *);
  585. #if defined(DEBUG)
  586. extern BOOL bGetJpegInfo(UCHAR *, size_t);
  587. #endif /* DEBUG */
  588. #endif /* __riscos */
  589. /* saveas.c */
  590. #if defined(__riscos)
  591. extern BOOL bSaveTextfile(event_pollblock *, void *);
  592. extern BOOL bSaveDrawfile(event_pollblock *, void *);
  593. #endif /* __riscos */
  594. /* sectlist.c */
  595. extern void vDestroySectionInfoList(void);
  596. extern void vAdd2SectionInfoList(const section_block_type *, ULONG);
  597. extern void vGetDefaultSection(section_block_type *);
  598. extern void vDefault2SectionInfoList(ULONG);
  599. extern const section_block_type *
  600. pGetSectionInfo(const section_block_type *, ULONG);
  601. extern size_t tGetNumberOfSections(void);
  602. extern UCHAR ucGetSepHdrFtrSpecification(size_t);
  603. /* stylelist.c */
  604. extern void vDestroyStyleInfoList(void);
  605. extern level_type_enum eGetNumType(UCHAR);
  606. extern void vCorrectStyleValues(style_block_type *);
  607. extern void vAdd2StyleInfoList(const style_block_type *);
  608. extern const style_block_type *pGetNextStyleInfoListItem(
  609. const style_block_type *);
  610. extern const style_block_type *pGetNextTextStyle(const style_block_type *);
  611. extern USHORT usGetIstd(ULONG);
  612. extern BOOL bStyleImpliesList(const style_block_type *, int);
  613. /* stylesheet.c */
  614. extern void vDestroyStylesheetList(void);
  615. extern USHORT usStc2istd(UCHAR);
  616. extern void vGet2Stylesheet(FILE *, int, const UCHAR *);
  617. extern void vGet6Stylesheet(FILE *, ULONG, const ULONG *, size_t,
  618. const UCHAR *);
  619. extern void vGet8Stylesheet(FILE *, const pps_info_type *,
  620. const ULONG *, size_t, const ULONG *, size_t,
  621. const UCHAR *);
  622. extern void vFillStyleFromStylesheet(USHORT, style_block_type *);
  623. extern void vFillFontFromStylesheet(USHORT, font_block_type *);
  624. /* summary.c */
  625. extern void vDestroySummaryInfo(void);
  626. extern void vSet0SummaryInfo(FILE *, const UCHAR *);
  627. extern void vSet2SummaryInfo(FILE *, int, const UCHAR *);
  628. extern void vSet6SummaryInfo(FILE *, const pps_info_type *,
  629. const ULONG *, size_t, const ULONG *, size_t,
  630. const UCHAR *);
  631. extern void vSet8SummaryInfo(FILE *, const pps_info_type *,
  632. const ULONG *, size_t, const ULONG *, size_t,
  633. const UCHAR *);
  634. extern const char *szGetTitle(void);
  635. extern const char *szGetSubject(void);
  636. extern const char *szGetAuthor(void);
  637. extern const char *szGetLastSaveDtm(void);
  638. extern const char *szGetModDate(void);
  639. extern const char *szGetCreationDate(void);
  640. extern const char *szGetCompany(void);
  641. extern const char *szGetLanguage(void);
  642. /* tabstop.c */
  643. extern void vSetDefaultTabWidth(FILE *, const pps_info_type *,
  644. const ULONG *, size_t, const ULONG *, size_t,
  645. const UCHAR *, int);
  646. extern long lGetDefaultTabWidth(void);
  647. /* text.c */
  648. extern void vPrologueTXT(diagram_type *, const options_type *);
  649. extern void vEpilogueTXT(FILE *);
  650. extern void vMove2NextLineTXT(diagram_type *);
  651. extern void vSubstringTXT(diagram_type *, const char *, size_t, long);
  652. extern void vStartOfParagraphTXT(diagram_type *, long);
  653. extern void vEndOfParagraphTXT(diagram_type *, long);
  654. extern void vEndOfPageTXT(diagram_type *, long);
  655. /* unix.c */
  656. extern void werr(int, const char *, ...);
  657. #if !defined(__riscos)
  658. extern void Hourglass_On(void);
  659. extern void Hourglass_Off(void);
  660. #endif /* !__riscos */
  661. /* utf8.c */
  662. #if !defined(__riscos)
  663. extern long utf8_strwidth(const char *, size_t);
  664. extern int utf8_chrlength(const char *);
  665. extern BOOL is_locale_utf8(void);
  666. #endif /* !__riscos */
  667. /* word2text.c */
  668. extern BOOL bOutputContainsText(const output_type *);
  669. extern BOOL bWordDecryptor(FILE *, long, diagram_type *);
  670. extern output_type *pHdrFtrDecryptor(FILE *, ULONG, ULONG);
  671. extern char *szFootnoteDecryptor(FILE *, ULONG, ULONG);
  672. /* worddos.c */
  673. extern int iInitDocumentDOS(FILE *, long);
  674. /* wordlib.c */
  675. extern BOOL bIsWordForDosFile(FILE *, long);
  676. extern BOOL bIsRtfFile(FILE *);
  677. extern BOOL bIsWordPerfectFile(FILE *);
  678. extern BOOL bIsWinWord12File(FILE *, long);
  679. extern BOOL bIsMacWord45File(FILE *);
  680. extern int iGuessVersionNumber(FILE *, long);
  681. extern int iGetVersionNumber(const UCHAR *);
  682. extern BOOL bIsOldMacFile(void);
  683. extern int iInitDocument(FILE *, long);
  684. extern void vFreeDocument(void);
  685. /* wordmac.c */
  686. extern int iInitDocumentMAC(FILE *, long);
  687. /* wordole.c */
  688. extern int iInitDocumentOLE(FILE *, long);
  689. /* wordwin.c */
  690. extern int iInitDocumentWIN(FILE *, long);
  691. /* xmalloc.c */
  692. extern void *xmalloc(size_t);
  693. extern void *xcalloc(size_t, size_t);
  694. extern void *xrealloc(void *, size_t);
  695. extern char *xstrdup(const char *);
  696. extern void *xfree(void *);
  697. /* xml.c */
  698. extern void vCreateBookIntro(diagram_type *, int);
  699. extern void vPrologueXML(diagram_type *, const options_type *);
  700. extern void vEpilogueXML(diagram_type *);
  701. extern void vMove2NextLineXML(diagram_type *);
  702. extern void vSubstringXML(diagram_type *,
  703. const char *, size_t, long, USHORT);
  704. extern void vStartOfParagraphXML(diagram_type *, UINT);
  705. extern void vEndOfParagraphXML(diagram_type *, UINT);
  706. extern void vEndOfPageXML(diagram_type *);
  707. extern void vSetHeadersXML(diagram_type *, USHORT);
  708. extern void vStartOfListXML(diagram_type *, UCHAR, BOOL);
  709. extern void vEndOfListXML(diagram_type *);
  710. extern void vStartOfListItemXML(diagram_type *, BOOL);
  711. extern void vEndOfTableXML(diagram_type *);
  712. extern void vAddTableRowXML(diagram_type *, char **, int,
  713. const short *, UCHAR);
  714. #endif /* __antiword_h */