Changeset 4727


Ignore:
Timestamp:
Feb 1, 2011, 2:41:37 PM (10 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Added V8 test
  • command line test and usage display
Location:
gaycko/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gaycko/trunk/src/dom/dom.c

    r4723 r4727  
     1#include <stdio.h>
     2#include <string.h>
    13#include "dom.h"
    2 #include <string.h>
    34#include "helpers/str.h"
    45
  • gaycko/trunk/src/gaycko.cpp

    r4726 r4727  
    88int main(int argc, char *argv[]) {
    99
     10
     11        char *tstr = testV8();
     12        if(strncmp(tstr, "Hello, World!", 11)) {
     13                printf("V8 doesn't seem to work : returned '%s', should return 'Hello, World!'\n", tstr);
     14        } else {
     15                printf("V8 Javascript engine seems to work ok\n");
     16        }       
     17
     18        if(argc!=2) {
     19                printf("Usage : %s URL\n", argv[0]);
     20                return -1;
     21        }
     22
    1023        printf("Opening %s\n", argv[1]);
    1124
     
    1629        }
    1730
    18         //gDOM *dom = gaycko_parse(gaycko_get_data(stream), gaycko_get_size(stream));
    19         //gaycko_close(stream);
     31        gDOM *dom = gaycko_parse(gaycko_get_data(stream), gaycko_get_size(stream));
     32        gaycko_close(stream);
    2033
    21         fprintf(stderr, "Test : \n");
    22         testV8();       
    23         printf("Ok\n");
    2434
    2535}
  • gaycko/trunk/src/js/glue.cpp

    r4725 r4727  
     1#include <string.h>
    12#include <v8.h>
    23#include "js/glue.h"
     
    45using namespace v8;
    56
    6 int testV8(void) {
     7char* testV8(void) {
    78        // Create a stack-allocated handle scope.
    89        HandleScope handle_scope;
     
    2930        // Convert the result to an ASCII string and print it.
    3031        String::AsciiValue ascii(result);
    31         printf("'%s'\n", *ascii);
    32         return 0;
    33 
     32        return strdup(*ascii);
    3433}
    3534
  • gaycko/trunk/src/js/glue.h

    r4725 r4727  
    11extern "C" {
    2         int testV8(void);
     2        char* testV8(void);
    33};
Note: See TracChangeset for help on using the changeset viewer.