* Implement a different way to delete a password from the cache.
[alpine.git] / pith / filter.h
blob4061333c3ddcf17656cd333c9cd5759c1a89c8e7
1 /*
2 * $Id: filter.h 1169 2008-08-27 06:42:06Z hubert@u.washington.edu $
4 * ========================================================================
5 * Copyright 2013-2022 Eduardo Chappa
6 * Copyright 2006-2007 University of Washington
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * ========================================================================
17 #ifndef PITH_FILTER_INCLUDED
18 #define PITH_FILTER_INCLUDED
21 #include "../pith/filttype.h"
22 #include "../pith/handle.h"
23 #include "../pith/store.h"
24 #include "../pith/osdep/pipe.h"
27 /* gf_html2plain flags */
28 #define GFHP_STRIPPED 0x01
29 #define GFHP_HANDLES 0x02
30 #define GFHP_LOCAL_HANDLES 0x04
31 #define GFHP_NO_RELATIVE 0x08
32 #define GFHP_RELATED_CONTENT 0x10
33 #define GFHP_SHOW_SERVER 0x20
34 #define GFHP_HTML 0x40
35 #define GFHP_HTML_IMAGES 0x80
38 /* gf_wrap flags */
39 #define GFW_NONE 0x000 /* no flags */
40 #define GFW_HANDLES 0x001 /* anticipate handle data */
41 #define GFW_ONCOMMA 0x002 /* prefer comma wrap to spaces */
42 #define GFW_FLOWED 0x004
43 #define GFW_FLOW_RESULT 0x008
44 #define GFW_DELSP 0x010
45 #define GFW_USECOLOR 0x020
46 #define GFW_HDRCOLOR 0x040
47 #define GFW_FORCOMPOSE 0x080
48 #define GFW_SOFTHYPHEN 0x100 /* do something special with soft-hyphens */
51 /* gf_url_hilite flags */
52 #define URH_NONE 0x00 /* no flags */
53 #define URH_HDRCOLOR 0x01 /* in header, use header base color */
56 #define TAG_EMBED '\377' /* Announces embedded data in text string */
57 #define TAG_INVON 'A' /* Supported character attributes */
58 #define TAG_INVOFF 'a'
59 #define TAG_BOLDON 'B'
60 #define TAG_BOLDOFF 'b'
61 #define TAG_ULINEON 'C'
62 #define TAG_ULINEOFF 'c'
63 #define TAG_FGCOLOR 'D' /* Change to this foreground color */
64 #define TAG_BGCOLOR 'd' /* Change to this background color */
65 #define TAG_ITALICON 'E'
66 #define TAG_ITALICOFF 'e'
67 #define TAG_STRIKEON 'F'
68 #define TAG_STRIKEOFF 'f'
69 #define TAG_BIGON 'G'
70 #define TAG_BIGOFF 'g'
71 #define TAG_SMALLON 'H'
72 #define TAG_SMALLOFF 'h'
73 #define TAG_HANDLE 'Z' /* indicate's a handle to an action */
74 #define TAG_HANDLEOFF 'z' /* indicate's end of handle text */
77 typedef struct url_hilite_s {
78 HANDLE_S **handlesp;
79 int hdr_color;
80 } URL_HILITE_S;
82 typedef struct _rss_item_s {
83 char *title;
84 char *link;
85 char *description;
86 char *source;
87 struct _rss_item_s *next;
88 } RSS_ITEM_S;
90 typedef struct _rss_feed_s {
91 char *title;
92 char *image;
93 char *link;
94 char *description;
95 char *source;
96 int ttl;
97 struct _rss_item_s *items;
98 } RSS_FEED_S;
102 * This searches for lines beginning with From<space> so that we can QP-encode
103 * them. It also searches for lines consisting of only a dot. Some mailers
104 * will mangle these lines. The reason it is ifdef'd is because most people
105 * seem to prefer the >From style escape provided by a lot of mail software
106 * to the QP-encoding.
107 * Froms, dots, bmap, and dmap may be any integer type. C is the next char.
108 * bmap and dmap should be initialized to 1.
109 * froms is incremented by 1 whenever a line beginning From_ is found.
110 * dots is incremented by 1 whenever a line with only a dot is found.
112 #define Find_Froms(froms,dots,bmap,dmap,c) { int x,y; \
113 switch (c) { \
114 case '\n': case '\r': \
115 x = 0x1; \
116 y = 0x7; \
117 bmap = 0; \
118 break; \
119 case 'F': \
120 x = 0x3; \
121 y = 0; \
122 break; \
123 case 'r': \
124 x = 0x7; \
125 y = 0; \
126 break; \
127 case 'o': \
128 x = 0xf; \
129 y = 0; \
130 break; \
131 case 'm': \
132 x = 0x1f; \
133 y = 0; \
134 break; \
135 case ' ': \
136 x = 0x3f; \
137 y = 0; \
138 break; \
139 case '.': \
140 x = 0; \
141 y = 0x3; \
142 break; \
143 default: \
144 x = 0; \
145 y = 0; \
146 break; \
148 bmap = ((x >> 1) == bmap) ? x : 0; \
149 froms += (bmap == 0x3f ? 1 : 0); \
150 if(y == 0x7 && dmap != 0x3){ \
151 y = 0x1; \
152 dmap = 0; \
154 dmap = ((y >> 1) == dmap) ? y : 0; \
155 dots += (dmap == 0x7 ? 1 : 0); \
159 /* exported prototypes */
160 int generic_readc_locale(unsigned char *c,
161 int (*get_a_char)(unsigned char *, void *),
162 void *extraarg,
163 CBUF_S *cb);
164 int pc_is_picotext(gf_o_t);
165 void gf_set_readc(gf_i_t *, void *, unsigned long, SourceType, int);
166 void gf_set_writec(gf_o_t *, void *, unsigned long, SourceType, int);
167 void gf_set_so_readc(gf_i_t *, STORE_S *);
168 void gf_clear_so_readc(STORE_S *);
169 void gf_set_so_writec(gf_o_t *, STORE_S *);
170 void gf_clear_so_writec(STORE_S *);
171 int gf_puts(char *, gf_o_t);
172 int gf_nputs(char *, long, gf_o_t);
173 void gf_filter_init(void);
174 void gf_link_filter(filter_t, void *);
175 void gf_set_terminal(gf_o_t);
176 char *gf_pipe(gf_i_t, gf_o_t);
177 long gf_bytes_piped(void);
178 char *gf_filter(char *, char *, STORE_S *, gf_o_t, FILTLIST_S *, int,
179 int, void (*)(PIPE_S *, int, void *));
180 void gf_binary_b64(FILTER_S *, int);
181 void gf_b64_binary(FILTER_S *, int);
182 void gf_qp_8bit(FILTER_S *, int);
183 void gf_8bit_qp(FILTER_S *, int);
184 void gf_convert_8bit_charset(FILTER_S *, int);
185 void gf_convert_utf8_charset(FILTER_S *, int);
186 void *gf_convert_utf8_charset_opt(void *, int);
187 void gf_2022_jp_to_euc(FILTER_S *, int);
188 void gf_native8bitjapanese_to_2022_jp(FILTER_S *, int);
189 void gf_euc_to_2022_jp(FILTER_S *, int);
190 void gf_sjis_to_2022_jp(FILTER_S *, int);
191 void gf_utf8(FILTER_S *, int);
192 void *gf_utf8_opt(char *);
193 void gf_rich2plain(FILTER_S *, int);
194 void *gf_rich2plain_opt(int *);
195 void gf_enriched2plain(FILTER_S *, int);
196 void *gf_enriched2plain_opt(int *);
197 void gf_html2plain(FILTER_S *, int);
198 void *gf_html2plain_opt(char *, int, int *, HANDLE_S **, htmlrisk_t, int);
199 void *gf_html2plain_rss_opt(RSS_FEED_S **, int);
200 void gf_html2plain_rss_free(RSS_FEED_S **);
201 void gf_html2plain_rss_free_items(RSS_ITEM_S **);
202 void gf_escape_filter(FILTER_S *, int);
203 void gf_html_cid2file(FILTER_S *, int);
204 void gf_control_filter(FILTER_S *, int);
205 void *gf_control_filter_opt(int *);
206 void gf_tag_filter(FILTER_S *, int);
207 void gf_wrap(FILTER_S *, int);
208 void *gf_wrap_filter_opt(int, int, int *, int, int);
209 void gf_preflow(FILTER_S *, int);
210 void gf_prefix(FILTER_S *, int);
211 void *gf_prefix_opt(char *);
212 void gf_line_test(FILTER_S *, int);
213 void *gf_line_test_opt(linetest_t, void *);
214 LT_INS_S **gf_line_test_new_ins(LT_INS_S **, char *, char *, int);
215 void gf_line_test_free_ins(LT_INS_S **);
216 void gf_prepend_editorial(FILTER_S *, int);
217 void *gf_prepend_editorial_opt(prepedtest_t, char *);
218 void gf_nvtnl_local(FILTER_S *, int);
219 void gf_local_nvtnl(FILTER_S *, int);
220 void *gf_url_hilite_opt(URL_HILITE_S *, HANDLE_S **, int);
221 void free_filter_module_globals(void);
223 #endif /* PITH_FILTER_INCLUDED */