Changeset 20828 for lang/cplusplus

Show
Ignore:
Timestamp:
10/06/08 09:21:47 (2 months ago)
Author:
tokuhirom
Message:

use dom.c! thanks to pajas++, Christian Glahn++

Location:
lang/cplusplus/llv8call/trunk
Files:
3 added
5 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/llv8call/trunk/ext/libxml/SConscript

    r20827 r20828  
    1212    env.SharedLibrary( 
    1313        "libxml", 
    14         [Split('libxml.cc document.cc')], 
     14        [Split('libxml.cc document.cc node.cc dom.c')], 
    1515        LIBS=['v8'] + env['LIBS'], 
    1616    ) 
  • lang/cplusplus/llv8call/trunk/ext/libxml/document.cc

    r20827 r20828  
    2525#define EXTERNAL_DOC() EXTERNAL(xmlDocPtr, doc, args.This(), 0); 
    2626 
    27 FUNCTION(_ReadFile) 
     27FUNCTION(_readFile) 
    2828    ARG_COUNT(1); 
    2929    ARG_str(fname, 0); 
     
    3434END 
    3535 
    36 FUNCTION(_Encoding) 
     36FUNCTION(_encoding) 
    3737    ARG_COUNT(0); 
    3838    EXTERNAL_DOC(); 
     
    4040END 
    4141 
    42 FUNCTION(_Version) 
     42FUNCTION(_version) 
    4343    ARG_COUNT(0); 
    4444    EXTERNAL_DOC(); 
     
    4646END 
    4747 
    48 FUNCTION(_Close) 
     48FUNCTION(_documentElement) 
     49    ARG_COUNT(0); 
     50    EXTERNAL_DOC(); 
     51 
     52    xmlNodePtr node_raw = xmlDocGetRootElement(doc); 
     53    assert(node_raw); 
     54 
     55    Handle<Value> consarg[1]; 
     56    consarg[0] = External::New(node_raw); 
     57    Handle<Object> node = node_class()->NewInstance(1, consarg); 
     58    return node; 
     59END 
     60 
     61FUNCTION(_close) 
    4962    ARG_COUNT(0); 
    5063    EXTERNAL_DOC(); 
     
    5568SUBMODULE(init_document) 
    5669    CLASS(); 
    57     BIND_IM("ReadFile",               _ReadFile); 
    58     BIND_IM("Encoding",               _Encoding); 
    59     BIND_IM("Version",                _Version); 
    60     BIND_IM("Close",                  _Close); 
     70    BIND_IM("readFile",               _readFile); 
     71    BIND_IM("encoding",               _encoding); 
     72    BIND_IM("version",                _version); 
     73    BIND_IM("documentElement",        _documentElement); 
     74    BIND_IM("close",                  _close); 
    6175    INTERNALCOUNT(1); 
    6276    EXPORT_CLASS("Document"); 
  • lang/cplusplus/llv8call/trunk/ext/libxml/libxml.cc

    r20827 r20828  
    3434 
    3535extern void init_document(Handle<Object> target); 
     36extern void init_node(Handle<Object> target); 
    3637 
    3738V8EXTINIT_FUNC  
     
    4142 
    4243    init_document(target); 
     44    init_node(target); 
    4345 
    4446    return target; 
  • lang/cplusplus/llv8call/trunk/ext/libxml/libxml.h

    r20827 r20828  
    66#include <libxml/parser.h> 
    77#include <libxml/tree.h> 
     8#include "dom.h" 
    89#include "v8ext.h" 
    910#include "llv8-macros.h" 
  • lang/cplusplus/llv8call/trunk/t/070_libxml/01_simple.js

    r20827 r20828  
    66var libxml = org.coderepos.libxml; 
    77var doc = new libxml.Document(); 
    8 doc.ReadFile("t/070_libxml/simple.xml"); 
    9 is(doc.Encoding(), "UTF-8"); 
    10 is(doc.Version(),  "1.0"); 
    11 doc.Close(); 
     8doc.readFile("t/070_libxml/simple.xml"); 
     9is(doc.encoding(), "UTF-8"); 
     10is(doc.version(),  "1.0"); 
     11is(doc.documentElement().nodeName(), "foo"); 
     12doc.close(); 
    1213 
    1314ok(true);