Changeset 4724


Ignore:
Timestamp:
Feb 1, 2011, 2:04:31 PM (10 years ago)
Author:
Jean-Yves Lamoureux
Message:
  • Fixed V8 search paths
  • added dumb V8 test
Location:
gaycko/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • gaycko/trunk/configure.ac

    r4721 r4724  
    8686TIDY_INCLUDES="-I/usr/include/tidy"
    8787TIDY_LIBS="-ltidy"
    88 V8_INCLUDES="-I${V8}/includes"
     88V8_INCLUDES="-I${V8}/include"
    8989V8_LIBS="-L${V8}/ -lv8_g"
    9090CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare -std=c99 -O0 -g -ggdb"
  • gaycko/trunk/src/Makefile.am

    r4721 r4724  
    33bin_PROGRAMS = Gaycko
    44
    5 Gaycko_SOURCES = gaycko.c gaycko.h io/file.c io/file.h io/http.c io/http.h io/io.c io/io.h parsing/parse.c parsing/parse.h dom/dom.c dom/dom.h helpers/str.c helpers/str.h
    6 Gaycko_CFLAGS  = @CACA_INCLUDES@ @XML2_INCLUDES@ @CURL_INCLUDES@ @TIDY_INCLUDES@ @V8_INCLUDES@
     5Gaycko_SOURCES = gaycko.c gaycko.h io/file.c io/file.h io/http.c io/http.h io/io.c io/io.h parsing/parse.c parsing/parse.h dom/dom.c dom/dom.h helpers/str.c helpers/str.h js/glue.cpp js/glue.h
     6Gaycko_CFLAGS  = @CACA_INCLUDES@ @XML2_INCLUDES@ @CURL_INCLUDES@ @TIDY_INCLUDES@
     7Gaycko_CPPFLAGS=@CACA_INCLUDES@ @XML2_INCLUDES@ @CURL_INCLUDES@ @TIDY_INCLUDES@ @V8_INCLUDES@
    78Gaycko_LDADD = @CACA_LIBS@ @XML2_LIBS@ @CURL_LIBS@ @TIDY_LIBS@ @V8_LIBS@
    89
  • gaycko/trunk/src/js/glue.cpp

    r4722 r4724  
     1#include <v8.h>
     2
     3using namespace v8;
     4
     5int testV8(void) {
     6        // Create a stack-allocated handle scope.
     7        HandleScope handle_scope;
     8
     9        // Create a new context.
     10        Persistent<Context> context = Context::New();
     11
     12        // Enter the created context for compiling and
     13        // running the hello world script.
     14        Context::Scope context_scope(context);
     15
     16        // Create a string containing the JavaScript source code.
     17        Handle<String> source = String::New("'Hello' + ', World!'");
     18
     19        // Compile the source code.
     20        Handle<Script> script = Script::Compile(source);
     21
     22        // Run the script to get the result.
     23        Handle<Value> result = script->Run();
     24
     25        // Dispose the persistent context.
     26        context.Dispose();
     27
     28        // Convert the result to an ASCII string and print it.
     29        String::AsciiValue ascii(result);
     30        printf("%s\n", *ascii);
     31        return 0;
     32
     33}
     34
Note: See TracChangeset for help on using the changeset viewer.