1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
|
/*
* "$Id: html.h,v 1.14 1999/01/04 17:45:23 mike Exp $"
*
* HTML parsing definitions for HTMLDOC, a HTML document processing program.
*
* Copyright 1997-1999 by Michael Sweet.
*
* HTMLDOC is distributed under the terms of the GNU General Public License
* which is described in the file "COPYING-2.0".
*/
#ifndef _HTML_H_
# define _HTML_H_
/*
* Include necessary headers...
*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include "iso8859.h"
/*
* Define some compatibility macros for Microsoft Windows...
*/
# if defined(WIN32) || defined(__EMX__)
# define strcasecmp(s,t) stricmp(s,t)
# define strncasecmp(s,t,n) strnicmp(s,t,n)
# endif /* WIN32 || __EMX__ */
/*
* Markup constants...
*/
typedef enum
{
MARKUP_ERROR = -1,
MARKUP_NONE = 0,
MARKUP_COMMENT,
MARKUP_DOCTYPE,
MARKUP_A,
MARKUP_ACRONYM,
MARKUP_ADDRESS,
MARKUP_APPLET,
MARKUP_AREA,
MARKUP_B,
MARKUP_BASE,
MARKUP_BASEFONT,
MARKUP_BIG,
MARKUP_BLINK,
MARKUP_BLOCKQUOTE,
MARKUP_BODY,
MARKUP_BR,
MARKUP_CAPTION,
MARKUP_CENTER,
MARKUP_CITE,
MARKUP_CODE,
MARKUP_COL,
MARKUP_COLGROUP,
MARKUP_DD,
MARKUP_DEL,
MARKUP_DFN,
MARKUP_DIR,
MARKUP_DIV,
MARKUP_DL,
MARKUP_DT,
MARKUP_EM,
MARKUP_EMBED,
MARKUP_FONT,
MARKUP_FORM,
MARKUP_FRAME,
MARKUP_FRAMESET,
MARKUP_H1,
MARKUP_H2,
MARKUP_H3,
MARKUP_H4,
MARKUP_H5,
MARKUP_H6,
MARKUP_H7,
MARKUP_HEAD,
MARKUP_HR,
MARKUP_HTML,
MARKUP_I,
MARKUP_IMG,
MARKUP_INPUT,
MARKUP_INS,
MARKUP_ISINDEX,
MARKUP_KBD,
MARKUP_LI,
MARKUP_LINK,
MARKUP_MAP,
MARKUP_MENU,
MARKUP_META,
MARKUP_MULTICOL,
MARKUP_NOBR,
MARKUP_NOFRAMES,
MARKUP_OL,
MARKUP_OPTION,
MARKUP_P,
MARKUP_PRE,
MARKUP_S,
MARKUP_SAMP,
MARKUP_SCRIPT,
MARKUP_SELECT,
MARKUP_SMALL,
MARKUP_SPACER,
MARKUP_STRIKE,
MARKUP_STRONG,
MARKUP_STYLE,
MARKUP_SUB,
MARKUP_SUP,
MARKUP_TABLE,
MARKUP_TBODY,
MARKUP_TD,
MARKUP_TEXTAREA,
MARKUP_TFOOT,
MARKUP_TH,
MARKUP_THEAD,
MARKUP_TITLE,
MARKUP_TR,
MARKUP_TT,
MARKUP_U,
MARKUP_UL,
MARKUP_VAR,
MARKUP_WBR
} markup_t;
/*
* Horizontal alignment...
*/
typedef enum
{
ALIGN_LEFT = 0,
ALIGN_CENTER,
ALIGN_RIGHT
} halignment_t;
/*
* Vertical alignment...
*/
typedef enum
{
ALIGN_TOP = 0,
ALIGN_MIDDLE,
ALIGN_BOTTOM
} valignment_t;
/*
* Typeface...
*/
typedef enum
{
TYPE_COURIER = 0,
TYPE_TIMES,
TYPE_HELVETICA,
TYPE_SYMBOL
} typeface_t;
/*
* Style...
*/
typedef enum
{
STYLE_NORMAL = 0,
STYLE_BOLD,
STYLE_ITALIC,
STYLE_BOLD_ITALIC
} style_t;
/*
* Sizes...
*/
# define SIZE_H1 6
# define SIZE_H2 5
# define SIZE_H3 4
# define SIZE_H4 3
# define SIZE_H5 2
# define SIZE_H6 1
# define SIZE_H7 0
# define SIZE_P 3
# define SIZE_PRE 2
# define SIZE_SUB 1
# define SIZE_SUP 1
/*
* Markup variables...
*/
typedef struct
{
uchar *name, /* Variable name */
*value; /* Variable value */
} var_t;
/*
* Parsing tree...
*/
typedef struct tree_str
{
struct tree_str *parent, /* Parent tree entry */
*child, /* First child entry */
*last_child, /* Last child entry */
*prev, /* Previous entry on this level */
*next, /* Next entry on this level */
*link; /* Linked-to */
markup_t markup; /* Markup code */
uchar *data; /* Text (MARKUP_NONE or MARKUP_COMMENT) */
unsigned halignment:2, /* Horizontal alignment */
valignment:2, /* Vertical alignment */
typeface:2, /* Typeface code */
size:3, /* Size of text */
style:2, /* Style of text */
underline:1, /* Text is underlined? */
strikethrough:1,/* Text is struck-through? */
subscript:1, /* Text is subscripted? */
superscript:1, /* Text is superscripted? */
preformatted:1, /* Preformatted text? */
indent:4; /* Indentation level 0-15 */
uchar red, /* Color of this fragment */
green,
blue;
float width, /* Width of this fragment in points */
height; /* Height of this fragment in points */
int nvars; /* Number of variables... */
var_t *vars; /* Variables... */
} tree_t;
/*
* Globals...
*/
extern char *_htmlMarkups[];
extern float _htmlSizes[],
_htmlSpacings[];
extern typeface_t _htmlBodyFont,
_htmlHeadingFont;
/*
* Prototypes...
*/
extern tree_t *htmlReadFile(tree_t *parent, FILE *fp, char *base);
extern int htmlWriteFile(tree_t *parent, FILE *fp);
extern tree_t *htmlAddTree(tree_t *parent, markup_t markup, uchar *data);
extern int htmlDeleteTree(tree_t *parent);
extern tree_t *htmlInsertTree(tree_t *parent, markup_t markup, uchar *data);
extern tree_t *htmlNewTree(tree_t *parent, markup_t markup, uchar *data);
extern uchar *htmlGetText(tree_t *tree);
extern uchar *htmlGetMeta(tree_t *tree, uchar *name);
extern uchar *htmlGetVariable(tree_t *t, uchar *name);
extern int htmlSetVariable(tree_t *t, uchar *name, uchar *value);
extern void htmlSetBaseSize(float p, float s);
#endif /* !_HTML_H_ */
/*
* End of "$Id: html.h,v 1.14 1999/01/04 17:45:23 mike Exp $".
*/
|