commit - fe84b7508f733106d346acf1b120951c78ad77a1
commit + 1bcb8303e1b913df31980ca332a5619424a72b01
blob - 44bab64a89cb50c8229446662395b7912dc7e7f6
blob + a44cdba406d715fdfc5e068f0848918ce48fb8d7
--- parser.c
+++ parser.c
#include "parser.h"
#include "telescope.h"
-#include "ui.h"
-/*
- * Load a text/gemini page given the string page. Always returns 0.
- */
-int
-load_page_from_str(struct tab *tab, const char *page)
-{
- parser_init(tab, gemtext_initparser);
- if (!tab->buffer.page.parse(&tab->buffer.page, page, strlen(page)))
- abort();
- if (!tab->buffer.page.free(&tab->buffer.page))
- abort();
- ui_on_tab_refresh(tab);
- ui_on_tab_loaded(tab);
- return 0;
-}
-
void
parser_init(struct tab *tab, parserfn fn)
{
blob - b4cb238fd315805241fb22da61a10bbc6d54b1b7
blob + 372529021fd1833629b45acdab87efb6e8a76704
--- parser.h
+++ parser.h
typedef void (*parserfn)(struct parser *);
-/* parser.c */
-int load_page_from_str(struct tab *, const char *);
-
void parser_init(struct tab *, parserfn);
int parser_parse(struct tab *, const char *, size_t);
int parser_free(struct tab *);
blob - eda6299eff5213af93e572d7143665cc0db0d7eb
blob + 5662481216175398fd6fab6157e02e1886a1b674
--- telescope.c
+++ telescope.c
make_request(tab, &req, PROTO_GOPHER, NULL);
}
+int
+load_page_from_str(struct tab *tab, const char *page)
+{
+ parser_init(tab, gemtext_initparser);
+ if (!tab->buffer.page.parse(&tab->buffer.page, page, strlen(page)))
+ abort();
+ if (!tab->buffer.page.free(&tab->buffer.page))
+ abort();
+ ui_on_tab_refresh(tab);
+ ui_on_tab_loaded(tab);
+ return 0;
+}
+
/*
* Effectively load the given url in the given tab. Return 1 when
* loading the page asynchronously, and thus when an erase_buffer can
blob - 0d382ec23caf170cc4fcefab743e0b2626029bea
blob + 06a9bd417000d3c81facb3e263499c6baefaa976
--- telescope.h
+++ telescope.h
#define LU_MODE_NOCACHE 0x2
void gopher_send_search_req(struct tab *, const char *);
+int load_page_from_str(struct tab *, const char *);
void load_url(struct tab *, const char *, const char *, int);
void load_url_in_tab(struct tab *, const char *, const char *, int);
int load_previous_page(struct tab*);