~alcinnz/rhapsode

ref: 489dd5c7d2e71f8b8e2427c8d3895e0537213e8c rhapsode/src/main.c -rw-r--r-- 1001 bytes
489dd5c7 — Adrian Cochrane Switch to C for I/O. FIXME currently segfaults. 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "HsFFI.h"

struct session;
struct session *c_newSession();
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_freePage(struct page*);

char *c_renderDoc(struct session*, struct page*);
char **c_extractLinks(struct page*);
char **c_docLinksAndRendering(struct session*, struct page*);

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.

    printf("%i Hello, world!\n", argc);

    c_freePage(page);
    c_freePage(referer);
    c_freeSession(session);
    hs_exit();
}