/*
rtf.h - RTF document processing stuff. Distribution 1.06a2.
*/
/*
Twentieths of a point (twips) per inch (Many RTF measurements
are in twips per inch (tpi) units). Assumes 72 points/inch.
*/
# define rtfTpi 1440
/*
RTF buffer size (avoids BUFSIZ, which differs across systems)
*/
# define rtfBufSiz 1024
/*
Tokens are associated with up to three classification numbers:
Class number: Broadest (least detailed) breakdown. For programs
that only care about gross token distinctions.
Major/minor numbers: Within their class, tokens have a major
number, and may also have a minor number to further
distinquish tokens with the same major number.
*** Class, major and minor token numbers are all >= 0 ***
Tokens that can't be classified are put in the "unknown" class.
For such, the major and minor numbers are meaningless, although
rtfTextBuf may be of interest then.
Text tokens are a single character, and the major number indicates
the character value (note: can be non-ascii, i.e., greater than 127).
There is no minor number.
Control symbols may have a parameter value, which will be found in
rtfParam. If no parameter was given, rtfParam = rtfNoParam.
RTFGetToken() return value is the class number, but it sets all the
global token vars.
rtfEOF is a fake token used by the reader; the writer never sees
it (except in the token reader hook, if it installs one).
*/
/*
Information pertaining to last token read by RTFToken. The
text is exactly as it occurs in the input file, e.g., "\{"
will be found in rtfTextBuf as "\{", even though it means "{".
These variables are also set when styles are reprocessed.
*/
extern char rtfTextBuf[rtfBufSiz]; /* text of token */
extern int rtfTextLen; /* length of token in rtfTextBuf */
extern int rtfClass; /* token class */
extern int rtfMajor; /* token major number */
extern int rtfMinor; /* token minor number */
extern int rtfParam; /* control symbol parameter */
# define rtfNoParam (-1000000)
/*
Token classes (must be zero-based and sequential)
*/
struct RTFFont
{
char *rtfFName; /* font name */
int rtfFNum; /* font number */
int rtfFFamily; /* font family */
RTFFont *rtfNextFont; /* next font in list */
};
/*
Color values are -1 if the default color for the the color
number should be used. The default color is writer-dependent.
*/
struct RTFColor
{
int rtfCNum; /* color number */
int rtfCRed; /* red value */
int rtfCGreen; /* green value */
int rtfCBlue; /* blue value */
RTFColor *rtfNextColor; /* next color in list */
};
struct RTFStyle
{
char *rtfSName; /* style name */
int rtfSNum; /* style number */
int rtfSBasedOn; /* style this one's based on */
int rtfSNextPar; /* style next paragraph style */
RTFStyleElt *rtfSSEList; /* list of style words */
int rtfExpanding; /* non-zero = being expanded */
RTFStyle *rtfNextStyle; /* next style in style list */
};
# define rtfBasedOnNone 222 /* "no based-on style" */
struct RTFStyleElt
{
int rtfSEClass; /* token class */
int rtfSEMajor; /* token major number */
int rtfSEMinor; /* token minor number */
int rtfSEParam; /* control symbol parameter */
char *rtfSEText; /* text of symbol */
RTFStyleElt *rtfNextSE; /* next element in style */
};
typedef void (*RTFFuncPtr) (); /* generic function pointer */