source: gaycko/trunk/src/gaycko.cpp @ 4753

Last change on this file since 4753 was 4753, checked in by Jean-Yves Lamoureux, 9 years ago
  • Assign DOM to Window, paves the way to tabs
File size: 1.4 KB
Line 
1/*
2 *  Gaycko        Text mode web browser
3 *  Copyright (c) 2011 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  This library is free software. It comes without any warranty, to
7 *  the extent permitted by applicable law. You can redistribute it
8 *  and/or modify it under the terms of the Do What The Fuck You Want
9 *  To Public License, Version 2, as published by Sam Hocevar. See
10 *  http://sam.zoy.org/wtfpl/COPYING for more details.
11 */
12extern "C" {
13#include "gaycko.h"
14#include "io/io.h"
15#include "parsing/parse.h"
16#include "js/glue.h"
17#include "render/renderer.h"
18#include "window/window.h"
19}
20
21int main(int argc, char *argv[]) {
22
23        char *tstr = testV8();
24        if(strncmp(tstr, "Hello, World!", 13)) {
25                printf("V8 doesn't seem to work : returned '%s', should return 'Hello, World!'\n", tstr);
26        } else {
27                printf("V8 Javascript engine seems to work ok\n");
28        }       
29
30        if(argc!=2) {
31                printf("Usage : %s URL\n", argv[0]);
32                return -1;
33        }
34
35        printf("Opening %s\n", argv[1]);
36
37        gIO *stream = gaycko_open(argv[1]);
38        if(!stream) {
39                printf("Can't open %s\n", argv[1]);   
40                return -1;
41        }
42
43        char *data = gaycko_get_data(stream);
44        int   size = gaycko_get_size(stream);
45
46        gDOM *dom = gaycko_parse(data, size);
47        gaycko_close(stream);
48
49    gWindow *window = gaycko_create_window(150, 20);
50    gaycko_window_set_dom(window, dom);
51    gaycko_render(window);
52    gaycko_display_window(window);
53   
54   
55        destroy_node(dom->root);
56
57}
58
59
Note: See TracBrowser for help on using the repository browser.