about summary refs log tree commit diff stats
path: root/src/LYStructs.h
blob: 1fe9dc66415c8a7cdd025c52907ae33d297ceba5 (plain) (blame)
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
#ifndef LYSTRUCTS_H
#define LYSTRUCTS_H

#ifndef HTANCHOR_H
#include <HTAnchor.h>
#endif /* HTANCHOR_H */

typedef struct {
    char *hl_text;
    short hl_x;
} HiliteInfo;

typedef struct {
    HiliteInfo *hl_info;
    HiliteInfo hl_base;
    short hl_len;              /* number of strings in this struct */
} HiliteList;

typedef struct {
    char *lname;
    char *target;
    char *l_hightext;
    char *l_hightext2;
    int l_hightext2_offset;
    BOOL inUnderline;	/* TRUE when this link is in underlined context. */
    int lx;
    int ly;
    int type;		/* Type of link, Forms, WWW, etc. */
    int anchor_number;	/* The anchor number within the HText structure.  */
    int anchor_line_num;/* The anchor line number in the HText structure. */
    HiliteList list;
    struct _FormInfo *l_form;	/* Pointer to form info. */
} LinkInfo;
extern LinkInfo links[MAXLINKS];
extern int nlinks;

typedef struct {
    /* FIXME: see DocAddress */
    char * title;
    char * address;
    bstring * post_data;
    char * post_content_type;
    char * bookmark;
    BOOL   isHEAD;
    BOOL   safe;

    int    link;
    int    line;
    BOOL   internal_link;	/* whether doc was reached via an internal
				 (fragment) link. - kw */
#ifdef USE_COLOR_STYLE
    char * style;
#endif
} DocInfo;

#ifndef HTFORMS_H
#include <HTForms.h>
#endif /* HTFORMS_H */

typedef struct {
    DocInfo hdoc;
    int    intern_seq_start;	/* indicates which element on the history
				   is the start of this sequence of
				   "internal links", otherwise -1 */
} HistInfo;

#define HDOC(n) history[n].hdoc

extern int Visited_Links_As;

#define VISITED_LINKS_AS_FIRST_V 0
#define VISITED_LINKS_AS_TREE    1
#define VISITED_LINKS_AS_LATEST  2
#define VISITED_LINKS_REVERSE    4

typedef struct _VisitedLink {
    char * title;
    char * address;
    int level;
    struct _VisitedLink *next_tree;
    struct _VisitedLink *prev_latest;
    struct _VisitedLink *next_latest;
    struct _VisitedLink *prev_first;
} VisitedLink;

extern HistInfo history[MAXHIST];
extern int nhist;

/******************************************************************************/

typedef struct _lynx_list_item_type {
    struct _lynx_list_item_type *next;  /* the next item in the linked list */
    char *name; 			/* a description of the item */
    char *command;			/* the command to execute */
    int  always_enabled;		/* a constant to tell whether or
					* not to disable the printer
					* when the no_print option is on
					*/
    /* HTML lists: */
    BOOL override_primary_action;	/* whether primary action will be
					* overridden by this - e.g. this allows
					* invoking user's MUA when mailto: link
					* is activated using normal "activate"
					* command. This field is only examined
					* by code that handles EXTERNAL command.
					*/
    /* PRINTER lists: */
    int pagelen;			/* an integer to store the printer's
					* page length
					*/
} lynx_list_item_type;

extern lynx_list_item_type *printers;

/* for download commands */
extern lynx_list_item_type *downloaders;

/* for upload commands */
extern lynx_list_item_type *uploaders;

#ifdef USE_EXTERNALS
/* for external commands */
extern lynx_list_item_type *externals;
#endif

/******************************************************************************/

typedef struct
{
    CONST char *name;
    int value;
}
Config_Enum;

typedef int (*ParseFunc) PARAMS((char *));

#define ParseUnionMembers \
	lynx_list_item_type** add_value; \
	BOOLEAN * set_value; \
	int *     int_value; \
	char **   str_value; \
	ParseFunc fun_value; \
	long	  def_value

typedef union {
	ParseUnionMembers;
} ParseUnion;

#ifdef	PARSE_DEBUG
#define ParseUnionPtr Config_Type *
#define ParseUnionOf(tbl) tbl
#define ParseData ParseUnionMembers
#define UNION_ADD(v) &v,  0,  0,  0,  0,  0
#define UNION_SET(v)  0, &v,  0,  0,  0,  0
#define UNION_INT(v)  0,  0, &v,  0,  0,  0
#define UNION_STR(v)  0,  0,  0, &v,  0,  0
#define UNION_ENV(v)  0,  0,  0,  v,  0,  0
#define UNION_FUN(v)  0,  0,  0,  0,  v,  0
#define UNION_DEF(v)  0,  0,  0,  0,  0,  v
#else
#define ParseUnionPtr ParseUnion *
#define ParseUnionOf(tbl) (ParseUnionPtr)(&(tbl->value))
#define ParseData long value
#define UNION_ADD(v) (long)&(v)
#define UNION_SET(v) (long)&(v)
#define UNION_INT(v) (long)&(v)
#define UNION_STR(v) (long)&(v)
#define UNION_ENV(v) (long) (v)
#define UNION_FUN(v) (long) (v)
#define UNION_DEF(v) (long) (v)
#endif

#endif /* LYSTRUCTS_H */