@@ 132,7 132,9 @@ text2cstring txt = Txt.withCStringLen txt $ \s -> (peekCStringLen s >>= newCStri
foreign export ccall c_docLinksAndRendering :: StablePtr Session -> StablePtr Page -> IO (CArray CString)
c_docLinksAndRendering c_session c_page = do
- (c_links, ssml) <- c_extractLinks c_page `concurrently` c_renderDoc c_session c_page
+ c_links <- c_extractLinks c_page
+ ssml <- c_renderDoc c_session c_page
+ -- (c_links, ssml) <- c_extractLinks c_page `concurrently` c_renderDoc c_session c_page
nil <- newCString ""
links <- peekArray0 nil c_links
newArray0 nil (ssml : links)
@@ 9,21 9,22 @@ void c_freeSession(struct session*);
struct page;
struct page *c_initialReferer();
-void *c_fetchURL(struct session*, char*, char*);
-//struct page **c_fetchURLs(struct session*, struct page*, char**);
+void *c_fetchURL(struct session*, char*, struct page*, char*);
+//struct page **c_fetchURLs(struct session*, struct page*, char**); // FIXME segfaults.
void c_freePage(struct page*);
char *c_renderDoc(struct session*, struct page*);
char **c_extractLinks(struct page*);
-char **c_docLinksAndRendering(struct session*, struct page*);
+char **c_docLinksAndRendering(struct session*, struct page*); // FIXME segfaults.
int main(int argc, char **argv) {
hs_init(&argc, &argv);
struct session *session = c_newSession();
struct page *referer = c_initialReferer();
- struct page *page = c_fetchURL(session, "text/xml text/html text/plain", argv[1]);
- // char *ssml = c_renderDoc(session, page); // FIXME segfaults alongside extractLinks & the combined function.
+ struct page *page = c_fetchURL(session, "text/xml text/html text/plain", referer, argv[1]);
+ char *ssml = c_renderDoc(session, page);
+ char **links = c_extractLinks(page);
printf("%i Hello, world!\n", argc);