1 /* 2 * $LynxId: LYStructs.h,v 1.30 2010/12/08 23:30:08 tom Exp $ 3 */ 4 #ifndef LYSTRUCTS_H 5 #define LYSTRUCTS_H 6 7 #ifndef HTANCHOR_H 8 #include <HTAnchor.h> 9 #endif /* HTANCHOR_H */ 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 typedef struct { 15 char *hl_text; 16 short hl_x; 17 } HiliteInfo; 18 19 typedef struct { 20 HiliteInfo *hl_info; 21 HiliteInfo hl_base; 22 short hl_len; /* number of strings in this struct */ 23 } HiliteList; 24 25 typedef struct { 26 char *lname; 27 char *target; 28 char *l_hightext; 29 char *l_hightext2; 30 int l_hightext2_offset; 31 BOOL inUnderline; /* TRUE when this link is in underlined context. */ 32 int lx; 33 int ly; 34 int type; /* Type of link, Forms, WWW, etc. */ 35 int sgml_offset; /* document offset used in reparsing */ 36 int anchor_number; /* The anchor number within the HText structure. */ 37 int anchor_line_num; /* The anchor line number in the HText structure. */ 38 HiliteList list; 39 struct _FormInfo *l_form; /* Pointer to form info. */ 40 } LinkInfo; 41 extern LinkInfo links[MAXLINKS]; 42 extern int nlinks; 43 44 typedef struct { 45 /* FIXME: see DocAddress */ 46 char *title; 47 char *address; 48 bstring *post_data; 49 char *post_content_type; 50 char *bookmark; 51 BOOL isHEAD; 52 BOOL safe; 53 54 int link; 55 int line; 56 BOOL internal_link; /* whether doc was reached via an internal 57 (fragment) link. - kw */ 58 #ifdef USE_COLOR_STYLE 59 char *style; 60 #endif 61 } DocInfo; 62 63 typedef struct { 64 DocInfo hdoc; 65 int intern_seq_start; /* indicates which element on the history 66 is the start of this sequence of 67 "internal links", otherwise -1 */ 68 } HistInfo; 69 70 #define HDOC(n) history[n].hdoc 71 72 extern int Visited_Links_As; 73 74 #define VISITED_LINKS_AS_FIRST_V 0 75 #define VISITED_LINKS_AS_TREE 1 76 #define VISITED_LINKS_AS_LATEST 2 77 #define VISITED_LINKS_REVERSE 4 78 79 typedef struct _VisitedLink { 80 char *title; 81 char *address; 82 int level; 83 struct _VisitedLink *next_tree; 84 struct _VisitedLink *prev_latest; 85 struct _VisitedLink *next_latest; 86 struct _VisitedLink *prev_first; 87 } VisitedLink; 88 89 extern HistInfo *history; 90 extern int nhist; 91 extern int size_history; 92 93 /******************************************************************************/ 94 95 typedef struct _lynx_list_item_type { 96 struct _lynx_list_item_type *next; /* the next item in the linked list */ 97 char *name; /* a description of the item */ 98 char *menu_name; /* menu-name for EXTERNAL / EXTERNAL_MENU */ 99 char *command; /* the command to execute */ 100 BOOL always_enabled; /* a constant to tell whether or 101 * not to disable the printer 102 * when the no_print option is on 103 */ 104 /* HTML lists: */ 105 BOOL override_action; /* whether primary action will be 106 * overridden by this - e.g. this 107 * allows invoking user's MUA when 108 * mailto: link is activated using 109 * normal "activate" command. This 110 * field is only examined by code that 111 * handles EXTERNAL command. 112 */ 113 /* PRINTER lists: */ 114 int pagelen; /* an integer to store the printer's 115 * page length 116 */ 117 } lynx_list_item_type; 118 119 extern lynx_list_item_type *printers; 120 121 /* for download commands */ 122 extern lynx_list_item_type *downloaders; 123 124 /* for upload commands */ 125 extern lynx_list_item_type *uploaders; 126 127 #ifdef USE_EXTERNALS 128 /* for external commands */ 129 extern lynx_list_item_type *externals; 130 #endif 131 132 /******************************************************************************/ 133 134 typedef struct { 135 const char *name; 136 int value; 137 } Config_Enum; 138 139 typedef int (*ParseFunc) (char *); 140 141 #define ParseUnionMembers \ 142 lynx_list_item_type** add_value; \ 143 BOOLEAN * set_value; \ 144 int * int_value; \ 145 char ** str_value; \ 146 ParseFunc fun_value; \ 147 long def_value; \ 148 HTList** lst_value 149 150 typedef union { 151 ParseUnionMembers; 152 } ParseUnion; 153 154 #define PARSE_DEBUG 1 155 #ifdef PARSE_DEBUG 156 157 #define ParseUnionPtr Config_Type * 158 #define ParseUnionOf(tbl) tbl 159 #define ParseData ParseUnionMembers 160 161 #define UNION_ADD(v) &v, 0, 0, 0, 0, 0, 0 162 #define UNION_SET(v) 0, &v, 0, 0, 0, 0, 0 163 #define UNION_INT(v) 0, 0, &v, 0, 0, 0, 0 164 #define UNION_STR(v) 0, 0, 0, &v, 0, 0, 0 165 #define UNION_ENV(v) 0, 0, 0, v, 0, 0, 0 166 #define UNION_FUN(v) 0, 0, 0, 0, v, 0, 0 167 #define UNION_DEF(v) 0, 0, 0, 0, 0, v, 0 168 #define UNION_LST(v) 0, 0, 0, 0, 0, 0, &v 169 170 #else 171 172 typedef void *ParseType; 173 174 #define ParseUnionPtr ParseUnion * 175 #define ParseUnionOf(tbl) (ParseUnionPtr)(&(tbl->value)) 176 #define ParseData ParseType value 177 178 #define UNION_ADD(v) (ParseType)&(v) 179 #define UNION_SET(v) (ParseType)&(v) 180 #define UNION_INT(v) (ParseType)&(v) 181 #define UNION_STR(v) (ParseType)&(v) 182 #define UNION_ENV(v) (ParseType) (v) 183 #define UNION_FUN(v) (ParseType) (v) 184 #define UNION_DEF(v) (ParseType) (v) 185 #define UNION_LST(v) (ParseType)&(v) 186 187 #endif 188 189 #ifdef __cplusplus 190 } 191 #endif 192 #endif /* LYSTRUCTS_H */ 193