Blame


1 5e11c00c 2021-03-02 op /*
2 5e11c00c 2021-03-02 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 5e11c00c 2021-03-02 op *
4 5e11c00c 2021-03-02 op * Permission to use, copy, modify, and distribute this software for any
5 5e11c00c 2021-03-02 op * purpose with or without fee is hereby granted, provided that the above
6 5e11c00c 2021-03-02 op * copyright notice and this permission notice appear in all copies.
7 5e11c00c 2021-03-02 op *
8 5e11c00c 2021-03-02 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 5e11c00c 2021-03-02 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 5e11c00c 2021-03-02 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 5e11c00c 2021-03-02 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 5e11c00c 2021-03-02 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 5e11c00c 2021-03-02 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 5e11c00c 2021-03-02 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 5e11c00c 2021-03-02 op */
16 5e11c00c 2021-03-02 op
17 5e11c00c 2021-03-02 op #ifndef TELESCOPE_H
18 5e11c00c 2021-03-02 op #define TELESCOPE_H
19 5e11c00c 2021-03-02 op
20 09312eb3 2021-05-14 op #include "cmd.h"
21 b0003f58 2021-03-08 op #include "compat.h"
22 e2226342 2021-05-12 op #include "phos/phos.h"
23 5e11c00c 2021-03-02 op
24 65d9b3ca 2021-03-14 op #include <event.h>
25 65d9b3ca 2021-03-14 op
26 dc5df781 2021-03-13 op #define MIN(a, b) ((a) < (b) ? (a) : (b))
27 dc5df781 2021-03-13 op #define MAX(a, b) ((a) > (b) ? (a) : (b))
28 dc5df781 2021-03-13 op
29 5e11c00c 2021-03-02 op #define GEMINI_URL_LEN 1024
30 5e11c00c 2021-03-02 op
31 5e11c00c 2021-03-02 op enum imsg_type {
32 740f578b 2021-03-15 op /* ui <-> client/fs */
33 5e11c00c 2021-03-02 op IMSG_GET, /* data is URL, peerid the tab id */
34 5e11c00c 2021-03-02 op IMSG_ERR,
35 5e11c00c 2021-03-02 op IMSG_CHECK_CERT,
36 5e11c00c 2021-03-02 op IMSG_CERT_STATUS,
37 5e11c00c 2021-03-02 op IMSG_GOT_CODE,
38 5e11c00c 2021-03-02 op IMSG_GOT_META,
39 0972d8b2 2021-03-02 op IMSG_PROCEED,
40 0972d8b2 2021-03-02 op IMSG_STOP,
41 5e11c00c 2021-03-02 op IMSG_BUF,
42 5e11c00c 2021-03-02 op IMSG_EOF,
43 5e11c00c 2021-03-02 op IMSG_QUIT,
44 740f578b 2021-03-15 op
45 740f578b 2021-03-15 op /* ui <-> fs */
46 740f578b 2021-03-15 op IMSG_BOOKMARK_PAGE,
47 740f578b 2021-03-15 op IMSG_BOOKMARK_OK,
48 3a227e9a 2021-03-18 op IMSG_SAVE_CERT,
49 3a227e9a 2021-03-18 op IMSG_SAVE_CERT_OK,
50 288fd238 2021-04-25 op IMSG_UPDATE_CERT,
51 288fd238 2021-04-25 op IMSG_UPDATE_CERT_OK,
52 c7107cec 2021-04-01 op
53 de2a69bb 2021-05-17 op IMSG_FILE_OPEN,
54 de2a69bb 2021-05-17 op IMSG_FILE_OPENED,
55 de2a69bb 2021-05-17 op
56 c7107cec 2021-04-01 op IMSG_SESSION_START,
57 c7107cec 2021-04-01 op IMSG_SESSION_TAB,
58 c7107cec 2021-04-01 op IMSG_SESSION_END,
59 c92e529c 2021-06-15 op };
60 1a99965e 2021-06-19 op
61 db7cc27a 2021-06-19 op extern char *new_tab_url;
62 db7cc27a 2021-06-19 op extern int fill_column;
63 72b18268 2021-06-19 op extern int olivetti_mode;
64 2c748a1f 2021-06-21 op extern int enable_colors;
65 c92e529c 2021-06-15 op
66 c92e529c 2021-06-15 op struct lineprefix {
67 c92e529c 2021-06-15 op const char *prfx1;
68 c92e529c 2021-06-15 op const char *prfx2;
69 c92e529c 2021-06-15 op };
70 c92e529c 2021-06-15 op extern struct lineprefix line_prefixes[];
71 c92e529c 2021-06-15 op
72 c92e529c 2021-06-15 op struct line_face {
73 c92e529c 2021-06-15 op int prefix_prop;
74 c92e529c 2021-06-15 op int text_prop;
75 d89b86d6 2021-06-21 op int trail_prop;
76 5e11c00c 2021-03-02 op };
77 c92e529c 2021-06-15 op extern struct line_face line_faces[];
78 5e11c00c 2021-03-02 op
79 c92e529c 2021-06-15 op struct tab_face {
80 33d904b6 2021-06-22 op int bg_attr, bg_bg, bg_fg;
81 33d904b6 2021-06-22 op int t_attr, t_bg, t_fg;
82 33d904b6 2021-06-22 op int c_attr, c_bg, c_fg;
83 33d904b6 2021-06-22 op
84 33d904b6 2021-06-22 op int background, tab, current;
85 c92e529c 2021-06-15 op };
86 c92e529c 2021-06-15 op extern struct tab_face tab_face;
87 d5493194 2021-06-15 op
88 b598590d 2021-06-21 op struct body_face {
89 160abe04 2021-06-21 op int lbg, lfg;
90 b598590d 2021-06-21 op int bg, fg;
91 160abe04 2021-06-21 op int rbg, rfg;
92 160abe04 2021-06-21 op
93 160abe04 2021-06-21 op int left, body, right;
94 b598590d 2021-06-21 op };
95 b598590d 2021-06-21 op extern struct body_face body_face;
96 b598590d 2021-06-21 op
97 d5493194 2021-06-15 op struct modeline_face {
98 d5493194 2021-06-15 op int background;
99 d5493194 2021-06-15 op };
100 d5493194 2021-06-15 op extern struct modeline_face modeline_face;
101 d5493194 2021-06-15 op
102 d5493194 2021-06-15 op struct minibuffer_face {
103 d5493194 2021-06-15 op int background;
104 d5493194 2021-06-15 op };
105 d5493194 2021-06-15 op extern struct minibuffer_face minibuffer_face;
106 c92e529c 2021-06-15 op
107 5e11c00c 2021-03-02 op enum line_type {
108 5e11c00c 2021-03-02 op LINE_TEXT,
109 5e11c00c 2021-03-02 op LINE_LINK,
110 5e11c00c 2021-03-02 op LINE_TITLE_1,
111 5e11c00c 2021-03-02 op LINE_TITLE_2,
112 5e11c00c 2021-03-02 op LINE_TITLE_3,
113 5e11c00c 2021-03-02 op LINE_ITEM,
114 5e11c00c 2021-03-02 op LINE_QUOTE,
115 5e11c00c 2021-03-02 op LINE_PRE_START,
116 5e11c00c 2021-03-02 op LINE_PRE_CONTENT,
117 5e11c00c 2021-03-02 op LINE_PRE_END,
118 5e11c00c 2021-03-02 op };
119 5e11c00c 2021-03-02 op
120 5e11c00c 2021-03-02 op struct line {
121 5e11c00c 2021-03-02 op enum line_type type;
122 5e11c00c 2021-03-02 op char *line;
123 5e11c00c 2021-03-02 op char *alt;
124 ebdcadbf 2021-03-12 op int flags;
125 5e11c00c 2021-03-02 op TAILQ_ENTRY(line) lines;
126 5e11c00c 2021-03-02 op };
127 5e11c00c 2021-03-02 op
128 9a25f829 2021-03-14 op struct vline {
129 9a25f829 2021-03-14 op const struct line *parent;
130 9a25f829 2021-03-14 op char *line;
131 9a25f829 2021-03-14 op int flags;
132 9a25f829 2021-03-14 op TAILQ_ENTRY(vline) vlines;
133 9a25f829 2021-03-14 op };
134 9a25f829 2021-03-14 op
135 5e11c00c 2021-03-02 op struct parser;
136 5e11c00c 2021-03-02 op struct page;
137 5e11c00c 2021-03-02 op
138 5e11c00c 2021-03-02 op typedef int (*parsechunkfn)(struct parser*, const char*, size_t);
139 a5c3e03d 2021-03-02 op typedef int (*parserfreefn)(struct parser*);
140 5e11c00c 2021-03-02 op
141 5e11c00c 2021-03-02 op typedef void (imsg_handlerfn)(struct imsg*, size_t);
142 5e11c00c 2021-03-02 op
143 5e11c00c 2021-03-02 op struct parser {
144 fc43eadd 2021-03-12 op const char *name;
145 dc5df781 2021-03-13 op char title[32+1];
146 5e11c00c 2021-03-02 op char *buf;
147 5e11c00c 2021-03-02 op size_t len;
148 5e11c00c 2021-03-02 op size_t cap;
149 5e11c00c 2021-03-02 op int flags;
150 5e11c00c 2021-03-02 op parsechunkfn parse;
151 5e11c00c 2021-03-02 op parserfreefn free;
152 5e11c00c 2021-03-02 op
153 5e11c00c 2021-03-02 op TAILQ_HEAD(, line) head;
154 5e11c00c 2021-03-02 op };
155 5e11c00c 2021-03-02 op
156 10346511 2021-03-17 op /*
157 10346511 2021-03-17 op * differnt types of trust for a certificate. Following
158 10346511 2021-03-17 op * gemini://thfr.info/gemini/modified-trust-verify.gmi
159 10346511 2021-03-17 op */
160 10346511 2021-03-17 op enum trust_state {
161 10346511 2021-03-17 op TS_UNKNOWN,
162 10346511 2021-03-17 op TS_UNTRUSTED,
163 10346511 2021-03-17 op TS_TRUSTED,
164 10346511 2021-03-17 op TS_VERIFIED,
165 10346511 2021-03-17 op };
166 10346511 2021-03-17 op
167 cbcc75fb 2021-03-17 op struct tofu_entry {
168 cbcc75fb 2021-03-17 op char domain[GEMINI_URL_LEN];
169 f1c6e31e 2021-05-12 op
170 f1c6e31e 2021-05-12 op /*
171 f1c6e31e 2021-05-12 op * enough space for ``PROTO:HASH''. probably isn't a good
172 f1c6e31e 2021-05-12 op * idea tho.
173 f1c6e31e 2021-05-12 op */
174 cbcc75fb 2021-03-17 op char hash[128+1];
175 cbcc75fb 2021-03-17 op int verified;
176 cbcc75fb 2021-03-17 op };
177 cbcc75fb 2021-03-17 op
178 2ba66cea 2021-03-22 op struct histhead {
179 2ba66cea 2021-03-22 op TAILQ_HEAD(mhisthead, hist) head;
180 2ba66cea 2021-03-22 op size_t len;
181 2ba66cea 2021-03-22 op };
182 2ba66cea 2021-03-22 op struct hist {
183 2ba66cea 2021-03-22 op char h[1025];
184 2ba66cea 2021-03-22 op TAILQ_ENTRY(hist) entries;
185 2ba66cea 2021-03-22 op };
186 2ba66cea 2021-03-22 op
187 46f6e974 2021-05-17 op struct buffer {
188 2ba66cea 2021-03-22 op struct parser page;
189 a00b4c97 2021-06-20 op
190 a00b4c97 2021-06-20 op size_t last_line_off;
191 a00b4c97 2021-06-20 op int force_redraw;
192 a00b4c97 2021-06-20 op
193 2ba66cea 2021-03-22 op int curs_x;
194 2ba66cea 2021-03-22 op int curs_y;
195 2ba66cea 2021-03-22 op size_t line_off;
196 2ba66cea 2021-03-22 op size_t line_max;
197 2ba66cea 2021-03-22 op struct vline *current_line;
198 2ba66cea 2021-03-22 op size_t cpoff;
199 2ba66cea 2021-03-22 op TAILQ_HEAD(vhead, vline) head;
200 2ba66cea 2021-03-22 op };
201 2ba66cea 2021-03-22 op
202 2b2d2872 2021-06-20 op #define TAB_CURRENT 0x1
203 2b2d2872 2021-06-20 op #define TAB_URGENT 0x2
204 2b2d2872 2021-06-20 op
205 2b2d2872 2021-06-20 op #define NEW_TAB_URL "about:new"
206 2b2d2872 2021-06-20 op
207 5e11c00c 2021-03-02 op extern TAILQ_HEAD(tabshead, tab) tabshead;
208 5e11c00c 2021-03-02 op struct tab {
209 5e11c00c 2021-03-02 op TAILQ_ENTRY(tab) tabs;
210 5e11c00c 2021-03-02 op uint32_t id;
211 5e11c00c 2021-03-02 op uint32_t flags;
212 0972d8b2 2021-03-02 op
213 288fd238 2021-04-25 op char *cert;
214 10346511 2021-03-17 op enum trust_state trust;
215 31f1a758 2021-04-22 op struct phos_uri uri;
216 2051e653 2021-03-13 op struct histhead hist;
217 2051e653 2021-03-13 op struct hist *hist_cur;
218 2051e653 2021-03-13 op size_t hist_off;
219 8af5e5ed 2021-03-08 op
220 0972d8b2 2021-03-02 op int code;
221 0972d8b2 2021-03-02 op char meta[GEMINI_URL_LEN];
222 0972d8b2 2021-03-02 op int redirect_count;
223 1d08c280 2021-03-06 op
224 46f6e974 2021-05-17 op struct buffer buffer;
225 2ba66cea 2021-03-22 op
226 2ba66cea 2021-03-22 op short loading_anim;
227 2ba66cea 2021-03-22 op short loading_anim_step;
228 2ba66cea 2021-03-22 op struct event loadingev;
229 de2a69bb 2021-05-17 op
230 de2a69bb 2021-05-17 op int fd;
231 de2a69bb 2021-05-17 op size_t bytes;
232 de2a69bb 2021-05-17 op char *path;
233 5e11c00c 2021-03-02 op };
234 5e11c00c 2021-03-02 op
235 4d3785b1 2021-03-09 op struct proto {
236 4d3785b1 2021-03-09 op const char *schema;
237 4d3785b1 2021-03-09 op
238 f1c6e31e 2021-05-12 op /*
239 f1c6e31e 2021-05-12 op * should load the given url in the tab. Optionally, it may
240 4d3785b1 2021-03-09 op * consider the given url as relative to the one already
241 4d3785b1 2021-03-09 op * present in tab. It must set tab->urlstr to a serialized
242 f1c6e31e 2021-05-12 op * human-friendly URL.
243 f1c6e31e 2021-05-12 op */
244 4d3785b1 2021-03-09 op void (*loadfn)(struct tab*, const char*);
245 4d3785b1 2021-03-09 op };
246 4d3785b1 2021-03-09 op
247 67c8ed7f 2021-03-13 op struct kmap {
248 67c8ed7f 2021-03-13 op TAILQ_HEAD(map, keymap) m;
249 67c8ed7f 2021-03-13 op void (*unhandled_input)(void);
250 67c8ed7f 2021-03-13 op };
251 67c8ed7f 2021-03-13 op
252 67c8ed7f 2021-03-13 op struct keymap {
253 67c8ed7f 2021-03-13 op int meta;
254 67c8ed7f 2021-03-13 op int key;
255 67c8ed7f 2021-03-13 op struct kmap map;
256 46f6e974 2021-05-17 op void (*fn)(struct buffer*);
257 67c8ed7f 2021-03-13 op
258 67c8ed7f 2021-03-13 op TAILQ_ENTRY(keymap) keymaps;
259 67c8ed7f 2021-03-13 op };
260 67c8ed7f 2021-03-13 op
261 69e1d1b6 2021-06-15 op /* defaults.c */
262 33fc3a8f 2021-06-21 op void config_init(void);
263 d89b86d6 2021-06-21 op int config_setprfx(const char *, const char *, const char *);
264 86e7d7b4 2021-06-19 op int config_setvari(const char *, int);
265 86e7d7b4 2021-06-19 op int config_setvars(const char *, char *);
266 d89b86d6 2021-06-21 op int config_setcolor(int, const char *, int, int, int);
267 d0149485 2021-06-22 op int config_setattr(const char *, int, int, int);
268 74a2587f 2021-06-21 op void config_apply_colors(void);
269 69e1d1b6 2021-06-15 op
270 35e1f40a 2021-03-14 op /* fs.c */
271 3a227e9a 2021-03-18 op int fs_init(void);
272 35e1f40a 2021-03-14 op int fs_main(struct imsgbuf*);
273 3a227e9a 2021-03-18 op int load_certs(struct ohash*);
274 c7107cec 2021-04-01 op int load_last_session(void(*)(const char*));
275 5e11c00c 2021-03-02 op
276 5e11c00c 2021-03-02 op /* gemini.c */
277 35e1f40a 2021-03-14 op int client_main(struct imsgbuf*);
278 5e11c00c 2021-03-02 op
279 5e11c00c 2021-03-02 op /* gemtext.c */
280 5e11c00c 2021-03-02 op void gemtext_initparser(struct parser*);
281 cbcc75fb 2021-03-17 op
282 2051e653 2021-03-13 op /* hist.c */
283 2051e653 2021-03-13 op void hist_clear_forward(struct histhead*, struct hist*);
284 2051e653 2021-03-13 op void hist_push(struct histhead*, struct hist*);
285 2051e653 2021-03-13 op
286 67c8ed7f 2021-03-13 op /* keymap.c */
287 67c8ed7f 2021-03-13 op int kbd(const char*);
288 67c8ed7f 2021-03-13 op const char *unkbd(int);
289 46f6e974 2021-05-17 op int kmap_define_key(struct kmap*, const char*, void(*)(struct buffer*));
290 67c8ed7f 2021-03-13 op
291 c07ac996 2021-03-12 op /* mime.c */
292 c07ac996 2021-03-12 op int setup_parser_for(struct tab*);
293 c07ac996 2021-03-12 op
294 0972d8b2 2021-03-02 op /* pages.c */
295 1b412079 2021-06-19 op extern const char *about_about;
296 1b412079 2021-06-19 op extern const char *about_blank;
297 1b412079 2021-06-19 op extern const char *about_help;
298 0972d8b2 2021-03-02 op extern const char *about_new;
299 0972d8b2 2021-03-02 op
300 0972d8b2 2021-03-02 op #define CANNOT_FETCH 0
301 0972d8b2 2021-03-02 op #define TOO_MUCH_REDIRECTS 1
302 5cd2ebb1 2021-03-11 op #define MALFORMED_RESPONSE 2
303 c07ac996 2021-03-12 op #define UNKNOWN_TYPE_OR_CSET 3
304 0972d8b2 2021-03-02 op extern const char *err_pages[70];
305 0972d8b2 2021-03-02 op
306 c92e529c 2021-06-15 op /* parse.y */
307 c92e529c 2021-06-15 op void parseconfig(const char *, int);
308 c92e529c 2021-06-15 op
309 3d70083d 2021-03-12 op /* parser.c */
310 3d70083d 2021-03-12 op int parser_append(struct parser*, const char*, size_t);
311 3d70083d 2021-03-12 op int parser_set_buf(struct parser*, const char*, size_t);
312 a5845bb5 2021-03-20 op int parser_foreach_line(struct parser*, const char*, size_t, parsechunkfn);
313 3d70083d 2021-03-12 op
314 ebdcadbf 2021-03-12 op /* sandbox.c */
315 ebdcadbf 2021-03-12 op void sandbox_network_process(void);
316 b1d4d01b 2021-03-14 op void sandbox_ui_process(void);
317 35e1f40a 2021-03-14 op void sandbox_fs_process(void);
318 ebdcadbf 2021-03-12 op
319 bcb0b073 2021-03-07 op /* telescope.c */
320 4d3785b1 2021-03-09 op void load_about_url(struct tab*, const char*);
321 4d3785b1 2021-03-09 op void load_gemini_url(struct tab*, const char*);
322 bcb0b073 2021-03-07 op void load_url(struct tab*, const char*);
323 2051e653 2021-03-13 op int load_previous_page(struct tab*);
324 2051e653 2021-03-13 op int load_next_page(struct tab*);
325 9ad4627d 2021-03-10 op void stop_tab(struct tab*);
326 740f578b 2021-03-15 op void add_to_bookmarks(const char*);
327 c7107cec 2021-04-01 op void save_session(void);
328 bcb0b073 2021-03-07 op
329 c49d61bc 2021-03-12 op /* textplain.c */
330 c49d61bc 2021-03-12 op void textplain_initparser(struct parser*);
331 c49d61bc 2021-03-12 op
332 c36d43ac 2021-04-25 op /* tofu.c */
333 c36d43ac 2021-04-25 op void tofu_init(struct ohash*, unsigned int, ptrdiff_t);
334 c36d43ac 2021-04-25 op struct tofu_entry *tofu_lookup(struct ohash*, const char*, const char*);
335 c36d43ac 2021-04-25 op void tofu_add(struct ohash*, struct tofu_entry*);
336 288fd238 2021-04-25 op void tofu_update(struct ohash*, struct tofu_entry*);
337 c36d43ac 2021-04-25 op
338 5e11c00c 2021-03-02 op /* ui.c */
339 2b2d2872 2021-06-20 op extern int body_lines;
340 2b2d2872 2021-06-20 op extern int body_cols;
341 2b2d2872 2021-06-20 op extern int in_minibuffer;
342 2b2d2872 2021-06-20 op
343 d89b86d6 2021-06-21 op enum pairs {
344 33d904b6 2021-06-22 op PTL_BG = 1,
345 33d904b6 2021-06-22 op PTL_TAB,
346 33d904b6 2021-06-22 op PTL_CURR,
347 33d904b6 2021-06-22 op
348 33d904b6 2021-06-22 op PBODY,
349 160abe04 2021-06-21 op PBLEFT,
350 160abe04 2021-06-21 op PBRIGHT,
351 160abe04 2021-06-21 op
352 b598590d 2021-06-21 op PT,
353 d89b86d6 2021-06-21 op PT_PRFX,
354 d89b86d6 2021-06-21 op PT_TRAIL,
355 d89b86d6 2021-06-21 op PL,
356 d89b86d6 2021-06-21 op PL_PRFX,
357 d89b86d6 2021-06-21 op PL_TRAIL,
358 d89b86d6 2021-06-21 op PT1,
359 d89b86d6 2021-06-21 op PT1_PRFX,
360 d89b86d6 2021-06-21 op PT1_TRAIL,
361 d89b86d6 2021-06-21 op PT2,
362 d89b86d6 2021-06-21 op PT2_PRFX,
363 d89b86d6 2021-06-21 op PT2_TRAIL,
364 d89b86d6 2021-06-21 op PT3,
365 d89b86d6 2021-06-21 op PT3_PRFX,
366 d89b86d6 2021-06-21 op PT3_TRAIL,
367 d89b86d6 2021-06-21 op PI,
368 d89b86d6 2021-06-21 op PI_PRFX,
369 d89b86d6 2021-06-21 op PI_TRAIL,
370 d89b86d6 2021-06-21 op PQ,
371 d89b86d6 2021-06-21 op PQ_PRFX,
372 d89b86d6 2021-06-21 op PQ_TRAIL,
373 d89b86d6 2021-06-21 op PPSTART,
374 d89b86d6 2021-06-21 op PPSTART_PRFX,
375 d89b86d6 2021-06-21 op PPSTART_TRAIL,
376 d89b86d6 2021-06-21 op PP,
377 d89b86d6 2021-06-21 op PP_PRFX,
378 d89b86d6 2021-06-21 op PP_TRAIL,
379 d89b86d6 2021-06-21 op PPEND,
380 d89b86d6 2021-06-21 op PPEND_PRFX,
381 d89b86d6 2021-06-21 op PPEND_TRAIL,
382 74a2587f 2021-06-21 op };
383 74a2587f 2021-06-21 op
384 2b2d2872 2021-06-20 op struct thiskey {
385 2b2d2872 2021-06-20 op short meta;
386 2b2d2872 2021-06-20 op int key;
387 2b2d2872 2021-06-20 op uint32_t cp;
388 2b2d2872 2021-06-20 op };
389 2b2d2872 2021-06-20 op extern struct thiskey thiskey;
390 2b2d2872 2021-06-20 op
391 2b2d2872 2021-06-20 op extern struct histhead eecmd_history,
392 2b2d2872 2021-06-20 op ir_history,
393 2b2d2872 2021-06-20 op lu_history,
394 2b2d2872 2021-06-20 op read_history;
395 2b2d2872 2021-06-20 op
396 2b2d2872 2021-06-20 op struct ministate {
397 2b2d2872 2021-06-20 op char *curmesg;
398 2b2d2872 2021-06-20 op
399 2b2d2872 2021-06-20 op char prompt[64];
400 2b2d2872 2021-06-20 op void (*donefn)(void);
401 2b2d2872 2021-06-20 op void (*abortfn)(void);
402 2b2d2872 2021-06-20 op
403 2b2d2872 2021-06-20 op char buf[1025];
404 2b2d2872 2021-06-20 op struct line line;
405 2b2d2872 2021-06-20 op struct vline vline;
406 2b2d2872 2021-06-20 op struct buffer buffer;
407 2b2d2872 2021-06-20 op
408 2b2d2872 2021-06-20 op struct histhead *history;
409 2b2d2872 2021-06-20 op struct hist *hist_cur;
410 2b2d2872 2021-06-20 op size_t hist_off;
411 2b2d2872 2021-06-20 op };
412 2b2d2872 2021-06-20 op extern struct ministate ministate;
413 2b2d2872 2021-06-20 op
414 2b2d2872 2021-06-20 op void restore_cursor(struct buffer *);
415 2b2d2872 2021-06-20 op void minibuffer_taint_hist(void);
416 2b2d2872 2021-06-20 op void eecmd_self_insert(void);
417 2b2d2872 2021-06-20 op void eecmd_select(void);
418 2b2d2872 2021-06-20 op void ir_self_insert(void);
419 2b2d2872 2021-06-20 op void ir_select(void);
420 2b2d2872 2021-06-20 op void lu_self_insert(void);
421 2b2d2872 2021-06-20 op void lu_select(void);
422 2b2d2872 2021-06-20 op void bp_select(void);
423 7f963c41 2021-06-20 op void vmessage(const char*, va_list);
424 7f963c41 2021-06-20 op void message(const char*, ...) __attribute__((format(printf, 1, 2)));
425 2b2d2872 2021-06-20 op void start_loading_anim(struct tab *tab);
426 2b2d2872 2021-06-20 op void load_url_in_tab(struct tab *, const char *);
427 2b2d2872 2021-06-20 op void enter_minibuffer(void(*)(void), void(*)(void), void(*)(void), struct histhead *);
428 2b2d2872 2021-06-20 op void exit_minibuffer(void);
429 2b2d2872 2021-06-20 op void switch_to_tab(struct tab *);
430 2b2d2872 2021-06-20 op struct tab *current_tab(void);
431 2b2d2872 2021-06-20 op struct tab *new_tab(const char *);
432 2eef3403 2021-04-22 op unsigned int tab_new_id(void);
433 6cd6a9e1 2021-03-20 op int ui_init(int, char * const*);
434 8af5e5ed 2021-03-08 op void ui_on_tab_loaded(struct tab*);
435 5e11c00c 2021-03-02 op void ui_on_tab_refresh(struct tab*);
436 2b2d2872 2021-06-20 op const char *ui_keyname(int);
437 2b2d2872 2021-06-20 op void ui_toggle_side_window(void);
438 2b2d2872 2021-06-20 op void ui_schedule_redraw(void);
439 5cd2ebb1 2021-03-11 op void ui_require_input(struct tab*, int);
440 de2a69bb 2021-05-17 op void ui_read(const char*, void(*)(const char*, unsigned int), unsigned int);
441 b3575139 2021-04-01 op void ui_yornp(const char*, void (*)(int, unsigned int), unsigned int);
442 5e11c00c 2021-03-02 op void ui_end(void);
443 5e11c00c 2021-03-02 op
444 174b3cdf 2021-03-21 op /* utf.8 */
445 8947c1f2 2021-03-21 op uint32_t utf8_decode(uint32_t*restrict, uint32_t*restrict, uint8_t);
446 17e5106b 2021-03-21 op size_t utf8_encode(uint32_t, char*);
447 174b3cdf 2021-03-21 op char *utf8_nth(char*, size_t);
448 174b3cdf 2021-03-21 op size_t utf8_cplen(char*);
449 174b3cdf 2021-03-21 op size_t utf8_chwidth(uint32_t);
450 174b3cdf 2021-03-21 op size_t utf8_snwidth(const char*, size_t);
451 174b3cdf 2021-03-21 op size_t utf8_swidth(const char*);
452 17e5106b 2021-03-21 op size_t utf8_swidth_between(const char*, const char*);
453 2ba66cea 2021-03-22 op char *utf8_next_cp(const char*);
454 2ba66cea 2021-03-22 op char *utf8_prev_cp(const char*, const char*);
455 174b3cdf 2021-03-21 op
456 5e11c00c 2021-03-02 op /* util.c */
457 5e11c00c 2021-03-02 op int mark_nonblock(int);
458 5c88f028 2021-03-09 op int has_prefix(const char*, const char*);
459 17e5106b 2021-03-21 op int unicode_isspace(uint32_t);
460 17e5106b 2021-03-21 op int unicode_isgraph(uint32_t);
461 1304bbdd 2021-03-15 op void dispatch_imsg(struct imsgbuf*, imsg_handlerfn**, size_t);
462 5e11c00c 2021-03-02 op
463 65d9b3ca 2021-03-14 op /* wrap.c */
464 46f6e974 2021-05-17 op void empty_linelist(struct buffer*);
465 46f6e974 2021-05-17 op void empty_vlist(struct buffer*);
466 46f6e974 2021-05-17 op int wrap_text(struct buffer*, const char*, struct line*, size_t);
467 46f6e974 2021-05-17 op int hardwrap_text(struct buffer*, struct line*, size_t);
468 65d9b3ca 2021-03-14 op
469 5e11c00c 2021-03-02 op #endif /* TELESCOPE_H */