⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 antiword.h

📁 这是一个同样来自贝尔实验室的和UNIX有着渊源的操作系统, 其简洁的设计和实现易于我们学习和理解
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * antiword.h * Copyright (C) 1998-2004 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 "DeskLib:Font.h"#include "DeskLib:Wimp.h"#include "Desklib:Window.h"#include "drawfile.h"#define window_ANY	event_ANY#define icon_ANY	event_ANY#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) || defined(__CYGMING__)#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/* Save menu fields */#define SAVEMENU_SCALEVIEW		0#define SAVEMENU_SAVEDRAW		1#define SAVEMENU_SAVETEXT		2#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) || defined(__EMX__)#define STRCEQ(x,y)	(stricmp(x,y) == 0)#else#define STRCEQ(x,y)	(strcasecmp(x,y) == 0)#endif /* __dos or __EMX__ */#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(N_PLAT_NLM)#define GLOBAL_ANTIWORD_DIR	"SYS:/antiword"#define ANTIWORD_DIR		"antiword"#define FONTNAMES_FILE		"fontname.txt"#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(__CYGMING__)#define GLOBAL_ANTIWORD_DIR	"C:\\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"#elif defined(__sun__)#define GLOBAL_ANTIWORD_DIR	"/usr/local/share/antiword"#define ANTIWORD_DIR		".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 names of grouped mapping files */	/* ASCII */#define MAPPING_FILE_CP437	"cp437.txt"	/* Latin1 */#define MAPPING_FILE_8859_1	"8859-1.txt"	/* Latin2 */#define MAPPING_FILE_8859_2	"8859-2.txt"#define MAPPING_FILE_CP852	"cp852.txt"#define MAPPING_FILE_CP1250	"cp1250.txt"	/* Cyrillic */#define MAPPING_FILE_8859_5	"8859-5.txt"#define MAPPING_FILE_KOI8_R	"koi8-r.txt"#define MAPPING_FILE_KOI8_U	"koi8-u.txt"#define MAPPING_FILE_CP866	"cp866.txt"#define MAPPING_FILE_CP1251	"cp1251.txt"	/* Latin9 */#define MAPPING_FILE_8859_15	"8859-15.txt"	/* UTF-8 */#define MAPPING_FILE_UTF_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	bExistsHdrFtr(void);extern BOOL	bExistsTextBox(void);extern BOOL	bExistsHdrTextBox(void);extern USHORT	usNextChar(FILE *, list_id_enum, ULONG *, ULONG *, USHORT *);extern USHORT	usToHdrFtrPosition(FILE *, ULONG);extern USHORT	usToFootnotePosition(FILE *, ULONG);extern ULONG	ulCharPos2FileOffsetX(ULONG, list_id_enum *);extern ULONG	ulCharPos2FileOffset(ULONG);extern ULONG	ulHdrFtrOffset2CharPos(ULONG);extern ULONG	ulGetSeqNumber(ULONG);#if defined(__riscos)extern ULONG	ulGetDocumentLength(void);#endif /* __riscos *//* chartrans.c */extern UCHAR	ucGetBulletCharacter(conversion_type, encoding_type);extern UCHAR	ucGetNbspCharacter(void);extern BOOL	bReadCharacterMappingTable(FILE *);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 *);#if defined(__dos)/* dos.c */extern int	iGetCodepage(void);#endif /* __dos *//* doclist.c */extern void	vDestroyDocumentInfoList(void);extern void	vCreateDocumentInfoList(const document_block_type *);extern UCHAR	ucGetDopHdrFtrSpecification(void);/* 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 *, drawfile_fontref, USHORT);extern void	vSubstring2Diagram(diagram_type *,			char *, size_t, long, UCHAR, USHORT,			drawfile_fontref, USHORT, USHORT);extern void	vStartOfParagraph1(diagram_type *, long);extern void	vStartOfParagraph2(diagram_type *);extern void	vEndOfParagraph(diagram_type *, drawfile_fontref, USHORT, long);extern void	vEndOfPage(diagram_type *, long, BOOL);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 BOOL	bDestroyDiagram(event_pollblock *, void *);extern void	vImage2Diagram(diagram_type *, const imagedata_type *,			UCHAR *, size_t);extern BOOL	bVerifyDiagram(diagram_type *);extern void	vShowDiagram(diagram_type *);extern void	vMainButtonClick(mouse_block *);extern BOOL	bMainKeyPressed(event_pollblock *, void *);extern BOOL	bMainEventHandler(event_pollblock *, void *);extern BOOL	bRedrawMainWindow(event_pollblock *, void *);extern BOOL	bScaleOpenAction(event_pollblock *, void *);extern void	vSetTitle(diagram_type *);extern void	vScaleButtonClick(mouse_block *, diagram_type *);extern BOOL	bScaleKeyPressed(event_pollblock *, void *);extern BOOL	bScaleEventHandler(event_pollblock *, void *);#elseextern 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 *);/* fmt_text.c */extern void	vPrologueFMT(diagram_type *, const options_type *);extern void	vSubstringFMT(diagram_type *, const char *, size_t, long,				USHORT);/* fontlist.c */extern void	vDestroyFontInfoList(void);extern void	vCorrectFontValues(font_block_type *);extern void	vAdd2FontInfoList(const font_block_type *);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -