/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 1996-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Glenn Fowler <[email protected]> *17* *18***********************************************************************/19#pragma prototyped20/*21* Glenn Fowler22* AT&T Research23*24* html to rtf definitions25*/2627#ifndef _HTML2RTF_H28#define _HTML2RTF_H 12930#include <ast.h>31#include <ctype.h>32#include <hash.h>3334#define twips(x) ((x)*2)3536#define FONTSIZE 12 /* default font size */3738#define ENT_SPACE (1<<0) /* translates to trailing space */3940#define STK_HEADING (1<<0) /* element contains <Hn> */41#define STK_NOEND (1<<1) /* don't call </x> */42#define STK_TAG (1<<8) /* first tag specific bit */4344#define TAG_UNBALANCED (1<<0) /* </x> without <x> ok */45#define TAG_IGNORE (1<<1) /* ignore element text */4647typedef struct Attribute_s48{49char* name; /* attribute name */50char* value; /* optional attribute value */51} Attribute_t;5253struct Tag_s;5455typedef int (*Call_f)(struct Tag_s*, Attribute_t*);5657typedef struct Entity_s58{59const char* name; /* entity name */60const char* value; /* entity value */61unsigned long flags; /* ENT_* flags */62} Entity_t;6364typedef struct Tag_s65{66const char* name; /* html tag name */67Call_f start; /* tag start */68Call_f end; /* optional tag end */69void* data; /* optional data */70unsigned long flags; /* TAG_* flags */71} Tag_t;7273typedef struct74{75int tags; /* # tags in rendering */76Tag_t* tag[1]; /* rendering tags */77} Render_t;7879typedef union Data_u80{81Sfio_t* io;82int number;83void* pointer;84char* string;85} Data_t;8687typedef struct Stack_s88{89Tag_t* tag; /* active tag */90unsigned int line; /* line */91unsigned int flags; /* STK_* flags */92Data_t data[8]; /* tag specific data */93} Stack_t;9495typedef struct State_s96{97int center; /* center nesting level */98int fontsize; /* current font size */99int hanging; /* current left hanging indent */100int indent; /* current left indent */101int pre; /* <PRE> nesting level */102int sep; /* output control needs sep */103int verbose; /* verbose messages */104105char* project; /* project file name */106char* prefix; /* label prefix */107108Sfio_t* in; /* input file pointer */109Sfio_t* nul; /* ignored buffer */110Sfio_t* out; /* output file pointer */111Sfio_t* tmp; /* temporary buffer */112113Stack_t* sp; /* tag stack pointer */114Stack_t* sp_max; /* highest sp */115Stack_t* sp_min; /* lowest sp */116117Hash_table_t* entities; /* entity dictionary */118Hash_table_t* files; /* project file dictionary */119Hash_table_t* tags; /* tag dictionary */120121} State_t;122123extern State_t state;124125#endif126127128