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