2
* $Id: filter.h 388 2007-01-24 18:57:42Z hubert@u.washington.edu $
4
* ========================================================================
5
* Copyright 2006-2007 University of Washington
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* ========================================================================
16
#ifndef PITH_FILTER_INCLUDED
17
#define PITH_FILTER_INCLUDED
20
#include "../pith/filttype.h"
21
#include "../pith/handle.h"
22
#include "../pith/store.h"
25
/* gf_html2plain flags */
26
#define GFHP_STRIPPED 0x01
27
#define GFHP_HANDLES 0x02
28
#define GFHP_LOCAL_HANDLES 0x04
29
#define GFHP_NO_RELATIVE 0x08
30
#define GFHP_RELATED_CONTENT 0x10
34
#define GFW_HANDLES 0x01 /* anticpate handle data */
35
#define GFW_ONCOMMA 0x02 /* prefer comma wrap to spaces */
36
#define GFW_UTF8 0x04 /* wrapping utf-8 text */
37
#define GFW_FLOWED 0x08
38
#define GFW_FLOW_RESULT 0x10
39
#define GFW_DELSP 0x20
40
#define GFW_USECOLOR 0x40
43
#define TAG_EMBED '\377' /* Announces embedded data in text string */
44
#define TAG_INVON 'A' /* Supported character attributes */
45
#define TAG_INVOFF 'a'
46
#define TAG_BOLDON 'B'
47
#define TAG_BOLDOFF 'b'
48
#define TAG_ULINEON 'C'
49
#define TAG_ULINEOFF 'c'
50
#define TAG_FGCOLOR 'D' /* Change to this foreground color */
51
#define TAG_BGCOLOR 'd' /* Change to this background color */
52
#define TAG_ITALICON 'E'
53
#define TAG_ITALICOFF 'e'
54
#define TAG_STRIKEON 'F'
55
#define TAG_STRIKEOFF 'f'
57
#define TAG_BIGOFF 'g'
58
#define TAG_SMALLON 'H'
59
#define TAG_SMALLOFF 'h'
60
#define TAG_HANDLE 'Z' /* indicate's a handle to an action */
61
#define TAG_HANDLEOFF 'z' /* indicate's end of handle text */
65
* This searchs for lines beginning with From<space> so that we can QP-encode
66
* them. It also searches for lines consisting of only a dot. Some mailers
67
* will mangle these lines. The reason it is ifdef'd is because most people
68
* seem to prefer the >From style escape provided by a lot of mail software
70
* Froms, dots, bmap, and dmap may be any integer type. C is the next char.
71
* bmap and dmap should be initialized to 1.
72
* froms is incremented by 1 whenever a line beginning From_ is found.
73
* dots is incremented by 1 whenever a line with only a dot is found.
75
#define Find_Froms(froms,dots,bmap,dmap,c) { int x,y; \
77
case '\n': case '\r': \
111
bmap = ((x >> 1) == bmap) ? x : 0; \
112
froms += (bmap == 0x3f ? 1 : 0); \
113
if(y == 0x7 && dmap != 0x3){ \
117
dmap = ((y >> 1) == dmap) ? y : 0; \
118
dots += (dmap == 0x7 ? 1 : 0); \
122
/* exported protoypes */
123
int pc_is_picotext(gf_io_t);
124
void gf_set_readc(gf_io_t *, void *, unsigned long, SourceType);
125
void gf_set_writec(gf_io_t *, void *, unsigned long, SourceType, int);
126
void gf_set_so_readc(gf_io_t *, STORE_S *);
127
void gf_clear_so_readc(STORE_S *);
128
void gf_set_so_writec(gf_io_t *, STORE_S *);
129
void gf_clear_so_writec(STORE_S *);
130
int gf_puts(char *, gf_io_t);
131
int gf_nputs(char *, long, gf_io_t);
132
void gf_filter_init(void);
133
void gf_link_filter(filter_t, void *);
134
void gf_set_terminal(gf_io_t);
135
char *gf_pipe(gf_io_t, gf_io_t);
136
long gf_bytes_piped(void);
137
char *gf_filter(char *, char *, STORE_S *, gf_io_t, FILTLIST_S *, int);
138
void gf_binary_b64(FILTER_S *, int);
139
void gf_b64_binary(FILTER_S *, int);
140
void gf_qp_8bit(FILTER_S *, int);
141
void gf_8bit_qp(FILTER_S *, int);
142
void gf_convert_8bit_charset(FILTER_S *, int);
143
void gf_convert_utf8_charset(FILTER_S *, int);
144
void *gf_convert_utf8_charset_opt(void *, int);
145
void gf_2022_jp_to_euc(FILTER_S *, int);
146
void gf_native8bitjapanese_to_2022_jp(FILTER_S *, int);
147
void gf_euc_to_2022_jp(FILTER_S *, int);
148
void gf_sjis_to_2022_jp(FILTER_S *, int);
149
void gf_utf8(FILTER_S *, int);
150
void *gf_utf8_opt(char *);
151
void gf_rich2plain(FILTER_S *, int);
152
void *gf_rich2plain_opt(int);
153
void gf_enriched2plain(FILTER_S *, int);
154
void *gf_enriched2plain_opt(int);
155
void gf_html2plain(FILTER_S *, int);
156
void *gf_html2plain_opt(char *, int, int *, HANDLE_S **, int);
157
void gf_escape_filter(FILTER_S *, int);
158
void gf_control_filter(FILTER_S *, int);
159
void *gf_control_filter_opt(int *);
160
void gf_tag_filter(FILTER_S *, int);
161
void gf_wrap(FILTER_S *, int);
162
void *gf_wrap_filter_opt(int, int, int *, int, int);
163
void gf_preflow(FILTER_S *, int);
164
void gf_prefix(FILTER_S *, int);
165
void *gf_prefix_opt(char *);
166
void gf_line_test(FILTER_S *, int);
167
void *gf_line_test_opt(linetest_t, void *);
168
LT_INS_S **gf_line_test_new_ins(LT_INS_S **, char *, char *, int);
169
void gf_line_test_free_ins(LT_INS_S **);
170
void gf_nvtnl_local(FILTER_S *, int);
171
void gf_local_nvtnl(FILTER_S *, int);
174
#endif /* PITH_FILTER_INCLUDED */