Initial commit
This commit is contained in:
19
node_modules/libxmljs/LICENSE
generated
vendored
Normal file
19
node_modules/libxmljs/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright 2009, Squish Tech, LLC. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
BIN
node_modules/libxmljs/build/Release/xmljs.node
generated
vendored
Executable file
BIN
node_modules/libxmljs/build/Release/xmljs.node
generated
vendored
Executable file
Binary file not shown.
41
node_modules/libxmljs/index.js
generated
vendored
Normal file
41
node_modules/libxmljs/index.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// js acts as a wrapper to the c++ bindings
|
||||
// prefer to do error handling and other abstrctions in the
|
||||
// js layer and only go to c++ when we need to hit libxml
|
||||
var bindings = require('./lib/bindings');
|
||||
|
||||
// document parsing for backwards compat
|
||||
var Document = require('./lib/document');
|
||||
|
||||
/// parse an xml string and return a Document
|
||||
module.exports.parseXml = Document.fromXml;
|
||||
|
||||
/// parse an html string and return a Document
|
||||
module.exports.parseHtml = Document.fromHtml;
|
||||
module.exports.parseHtmlFragment = Document.fromHtmlFragment;
|
||||
|
||||
// constants
|
||||
module.exports.version = require('./package.json').version;
|
||||
module.exports.libxml_version = bindings.libxml_version;
|
||||
module.exports.libxml_parser_version = bindings.libxml_parser_version;
|
||||
module.exports.libxml_debug_enabled = bindings.libxml_debug_enabled;
|
||||
module.exports.features = bindings.features;
|
||||
|
||||
// lib exports
|
||||
module.exports.Comment = require('./lib/comment');
|
||||
module.exports.Document = Document;
|
||||
module.exports.Element = require('./lib/element');
|
||||
module.exports.Text = require('./lib/text');
|
||||
|
||||
// Compatibility synonyms
|
||||
Document.fromXmlString = Document.fromXml;
|
||||
Document.fromHtmlString = Document.fromHtml;
|
||||
module.exports.parseXmlString = module.exports.parseXml;
|
||||
module.exports.parseHtmlString = module.exports.parseHtml;
|
||||
|
||||
var sax_parser = require('./lib/sax_parser');
|
||||
module.exports.SaxParser = sax_parser.SaxParser;
|
||||
module.exports.SaxPushParser = sax_parser.SaxPushParser;
|
||||
|
||||
module.exports.memoryUsage = bindings.xmlMemUsed;
|
||||
|
||||
module.exports.nodeCount = bindings.xmlNodeCount;
|
||||
1
node_modules/libxmljs/lib/bindings.js
generated
vendored
Normal file
1
node_modules/libxmljs/lib/bindings.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
module.exports = require('bindings')('xmljs');
|
||||
23
node_modules/libxmljs/lib/comment.js
generated
vendored
Normal file
23
node_modules/libxmljs/lib/comment.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
var bindings = require('./bindings');
|
||||
|
||||
var Document = require('./document');
|
||||
|
||||
/// create a new comment on the given document
|
||||
/// @param doc the Document to create the comment for
|
||||
/// @param {String} [content] comment content
|
||||
/// @constructor
|
||||
var Comment = function(doc, content) {
|
||||
if (!doc) {
|
||||
throw new Error('document argument required');
|
||||
} else if (! (doc instanceof bindings.Document)) {
|
||||
throw new Error('document argument must be an ' +
|
||||
'instance of Document');
|
||||
}
|
||||
|
||||
return new bindings.Comment(doc, content);
|
||||
};
|
||||
|
||||
Comment.prototype = bindings.Comment.prototype;
|
||||
|
||||
module.exports = Comment;
|
||||
|
||||
170
node_modules/libxmljs/lib/document.js
generated
vendored
Normal file
170
node_modules/libxmljs/lib/document.js
generated
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
var bindings = require('./bindings');
|
||||
|
||||
var Element = require('./element');
|
||||
|
||||
function assertRoot(doc) {
|
||||
if(!doc.root()) {
|
||||
throw new Error('Document has no root element');
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new document
|
||||
/// @param {string} version xml version, default 1.0
|
||||
/// @param {string} encoding the encoding, default utf8
|
||||
/// @constructor
|
||||
function Document(version, encoding) {
|
||||
version = version || '1.0';
|
||||
var doc = new bindings.Document(version);
|
||||
doc.encoding(encoding || 'utf8');
|
||||
return doc;
|
||||
}
|
||||
|
||||
Document.prototype = bindings.Document.prototype;
|
||||
|
||||
/// get or set the root element
|
||||
/// if called without any arguments, this will return the document root
|
||||
/// @param {Element} [elem] if specified, this will become the new document root
|
||||
Document.prototype.root = function(elem) {
|
||||
return this._root(elem);
|
||||
};
|
||||
|
||||
/// add a child node to the document
|
||||
/// this will set the document root
|
||||
Document.prototype.node = function(name, content) {
|
||||
return this.root(Element(this, name, content));
|
||||
};
|
||||
|
||||
/// xpath search
|
||||
/// @return array of matching elements
|
||||
Document.prototype.find = function(xpath, ns_uri) {
|
||||
assertRoot(this);
|
||||
|
||||
return this.root().find(xpath, ns_uri);
|
||||
};
|
||||
|
||||
/// xpath search
|
||||
/// @return first element matching
|
||||
Document.prototype.get = function(xpath, ns_uri) {
|
||||
assertRoot(this);
|
||||
|
||||
return this.root().get(xpath, ns_uri);
|
||||
};
|
||||
|
||||
/// @return a given child
|
||||
Document.prototype.child = function(id) {
|
||||
if (id === undefined || typeof id !== 'number') {
|
||||
throw new Error('id argument required for #child');
|
||||
}
|
||||
|
||||
assertRoot(this);
|
||||
|
||||
return this.root().child(id);
|
||||
};
|
||||
|
||||
/// @return an Array of child nodes of the document root
|
||||
Document.prototype.childNodes = function() {
|
||||
assertRoot(this);
|
||||
|
||||
return this.root().childNodes();
|
||||
};
|
||||
|
||||
/// @return a string representation of the document
|
||||
Document.prototype.toString = function(formatted) {
|
||||
return this._toString(formatted !== undefined ? formatted : true);
|
||||
};
|
||||
|
||||
/// @return the document version
|
||||
Document.prototype.version = function() {
|
||||
return this._version();
|
||||
};
|
||||
|
||||
/// @return the document encoding
|
||||
Document.prototype.encoding = function(encoding) {
|
||||
return this._encoding(encoding);
|
||||
};
|
||||
|
||||
/// @return whether the XmlDocument is valid
|
||||
Document.prototype.validate = function(xsd) {
|
||||
return this._validate(xsd);
|
||||
};
|
||||
|
||||
/// @return whether the XmlDocument is valid using Relaxed NG
|
||||
Document.prototype.rngValidate = function(rng) {
|
||||
return this._rngValidate(rng);
|
||||
};
|
||||
|
||||
Document.prototype.getDtd = function() {
|
||||
return this._getDtd();
|
||||
};
|
||||
|
||||
Document.prototype.setDtd = function(name, ext, sys) {
|
||||
if (!name) {
|
||||
throw new Error('Must pass in a DTD name');
|
||||
} else if (typeof name !== 'string') {
|
||||
throw new Error('Must pass in a valid DTD name');
|
||||
}
|
||||
|
||||
var params = [name];
|
||||
if (typeof ext !== 'undefined') {
|
||||
params.push(ext);
|
||||
}
|
||||
if (ext && typeof sys !== 'undefined') {
|
||||
params.push(sys);
|
||||
}
|
||||
|
||||
return this._setDtd.apply(this, params);
|
||||
};
|
||||
|
||||
/// @return array of namespaces in document
|
||||
Document.prototype.namespaces = function() {
|
||||
assertRoot(this);
|
||||
|
||||
return this.root().namespaces();
|
||||
};
|
||||
|
||||
Document.prototype.type = function() {
|
||||
return 'document';
|
||||
};
|
||||
|
||||
module.exports = Document;
|
||||
|
||||
/// parse a string into a html document
|
||||
/// @param string html string to parse
|
||||
/// @param {encoding:string, baseUrl:string} opts html string to parse
|
||||
/// @return a Document
|
||||
module.exports.fromHtml = function(string, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
// if for some reason user did not specify an object for the options
|
||||
if (typeof(opts) !== 'object') {
|
||||
throw new Error('fromHtml options must be an object');
|
||||
}
|
||||
|
||||
return bindings.fromHtml(string, opts);
|
||||
};
|
||||
|
||||
/// parse a string into a html document fragment
|
||||
/// @param string html string to parse
|
||||
/// @param {encoding:string, baseUrl:string} opts html string to parse
|
||||
/// @return a Document
|
||||
module.exports.fromHtmlFragment = function(string, opts) {
|
||||
opts = opts || {};
|
||||
|
||||
// if for some reason user did not specify an object for the options
|
||||
if (typeof(opts) !== 'object') {
|
||||
throw new Error('fromHtmlFragment options must be an object');
|
||||
}
|
||||
|
||||
opts.doctype = false;
|
||||
opts.implied = false;
|
||||
|
||||
return bindings.fromHtml(string, opts);
|
||||
};
|
||||
|
||||
/// parse a string into a xml document
|
||||
/// @param string xml string to parse
|
||||
/// @return a Document
|
||||
module.exports.fromXml = function(string, options) {
|
||||
return bindings.fromXml(string, options || {});
|
||||
};
|
||||
|
||||
82
node_modules/libxmljs/lib/element.js
generated
vendored
Normal file
82
node_modules/libxmljs/lib/element.js
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
var bindings = require('./bindings');
|
||||
|
||||
/// create a new element on the given document
|
||||
/// @param doc the Document to create the element for
|
||||
/// @param name the element name
|
||||
/// @param {String} [contenn] element content
|
||||
/// @constructor
|
||||
function Element(doc, name, content) {
|
||||
if (!doc) {
|
||||
throw new Error('document argument required');
|
||||
} else if (! (doc instanceof bindings.Document)) {
|
||||
throw new Error('document argument must be an ' +
|
||||
'instance of Document');
|
||||
} else if (!name) {
|
||||
throw new Error('name argument required');
|
||||
}
|
||||
|
||||
return new bindings.Element(doc, name, content);
|
||||
}
|
||||
|
||||
Element.prototype = bindings.Element.prototype;
|
||||
|
||||
Element.prototype.attr = function() {
|
||||
if (arguments.length === 1) {
|
||||
var arg = arguments[0];
|
||||
if (typeof arg === 'object') {
|
||||
// object setter
|
||||
// iterate keys/value to set attributes
|
||||
for (var k in arg) {
|
||||
this._attr(k, arg[k]);
|
||||
};
|
||||
return this;
|
||||
} else if (typeof arg === 'string') {
|
||||
// getter
|
||||
return this._attr(arg);
|
||||
}
|
||||
} else if (arguments.length === 2) {
|
||||
// 2 arg setter
|
||||
var name = arguments[0];
|
||||
var value = arguments[1];
|
||||
this._attr(name, value);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
/// helper method to attach a new node to this element
|
||||
/// @param name the element name
|
||||
/// @param {String} [content] element content
|
||||
Element.prototype.node = function(name, content) {
|
||||
var elem = Element(this.doc(), name, content);
|
||||
this.addChild(elem);
|
||||
return elem;
|
||||
};
|
||||
|
||||
/// helper method to attach a cdata to this element
|
||||
/// @param name the element name
|
||||
/// @param {String} [content] element content
|
||||
Element.prototype.cdata = function(content) {
|
||||
this.addCData(content);
|
||||
return this;
|
||||
};
|
||||
|
||||
Element.prototype.get = function() {
|
||||
var res = this.find.apply(this, arguments);
|
||||
if (res instanceof Array) {
|
||||
return res[0];
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
};
|
||||
|
||||
Element.prototype.defineNamespace = function(prefix, href) {
|
||||
// if no prefix specified
|
||||
if (!href) {
|
||||
href = prefix;
|
||||
prefix = null;
|
||||
}
|
||||
return new bindings.Namespace(this, prefix, href);
|
||||
};
|
||||
|
||||
module.exports = Element;
|
||||
|
||||
39
node_modules/libxmljs/lib/sax_parser.js
generated
vendored
Normal file
39
node_modules/libxmljs/lib/sax_parser.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var events = require('events');
|
||||
|
||||
var bindings = require('./bindings');
|
||||
|
||||
var SaxParser = function(callbacks) {
|
||||
var parser = new bindings.SaxParser();
|
||||
|
||||
// attach callbacks
|
||||
for (var callback in callbacks) {
|
||||
parser.on(callback, callbacks[callback]);
|
||||
}
|
||||
|
||||
return parser;
|
||||
};
|
||||
|
||||
// Overriding the prototype, like util.inherit, wipes out the native binding.
|
||||
// Copy over the methods instead.
|
||||
for (var k in events.EventEmitter.prototype)
|
||||
bindings.SaxParser.prototype[k] = events.EventEmitter.prototype[k];
|
||||
|
||||
var SaxPushParser = function(callbacks) {
|
||||
var parser = new bindings.SaxPushParser();
|
||||
|
||||
// attach callbacks
|
||||
for (var callback in callbacks) {
|
||||
parser.on(callback, callbacks[callback]);
|
||||
}
|
||||
|
||||
return parser;
|
||||
};
|
||||
|
||||
// Overriding the prototype, like util.inherit, wipes out the native binding.
|
||||
// Copy over the methods instead.
|
||||
for (var k in events.EventEmitter.prototype)
|
||||
bindings.SaxPushParser.prototype[k] = events.EventEmitter.prototype[k];
|
||||
|
||||
module.exports.SaxParser = SaxParser;
|
||||
module.exports.SaxPushParser = SaxPushParser;
|
||||
|
||||
28
node_modules/libxmljs/lib/text.js
generated
vendored
Normal file
28
node_modules/libxmljs/lib/text.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var bindings = require("./bindings");
|
||||
|
||||
/// create a new element on the given document
|
||||
/// @param doc the Document to create the element for
|
||||
/// @param name the element name
|
||||
/// @param {String} [contenn] element content
|
||||
/// @constructor
|
||||
|
||||
|
||||
function Text(doc, content) {
|
||||
if (!doc) {
|
||||
throw new Error('document argument required');
|
||||
}
|
||||
|
||||
if (!(doc instanceof bindings.Document)) {
|
||||
throw new Error('document argument must be an instance of Document');
|
||||
}
|
||||
|
||||
if (!content) {
|
||||
throw new Error('content argument required');
|
||||
}
|
||||
|
||||
return new bindings.Text(doc, content);
|
||||
}
|
||||
|
||||
Text.prototype = bindings.Text.prototype;
|
||||
|
||||
module.exports = Text;
|
||||
1
node_modules/libxmljs/node_modules/nan/include_dirs.js
generated
vendored
Normal file
1
node_modules/libxmljs/node_modules/nan/include_dirs.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
console.log(require('path').relative('.', __dirname));
|
||||
2761
node_modules/libxmljs/node_modules/nan/nan.h
generated
vendored
Normal file
2761
node_modules/libxmljs/node_modules/nan/nan.h
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
88
node_modules/libxmljs/node_modules/nan/nan_callbacks.h
generated
vendored
Normal file
88
node_modules/libxmljs/node_modules/nan/nan_callbacks.h
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_CALLBACKS_H_
|
||||
#define NAN_CALLBACKS_H_
|
||||
|
||||
template<typename T> class FunctionCallbackInfo;
|
||||
template<typename T> class PropertyCallbackInfo;
|
||||
template<typename T> class Global;
|
||||
|
||||
typedef void(*FunctionCallback)(const FunctionCallbackInfo<v8::Value>&);
|
||||
typedef void(*GetterCallback)
|
||||
(v8::Local<v8::String>, const PropertyCallbackInfo<v8::Value>&);
|
||||
typedef void(*SetterCallback)(
|
||||
v8::Local<v8::String>,
|
||||
v8::Local<v8::Value>,
|
||||
const PropertyCallbackInfo<void>&);
|
||||
typedef void(*PropertyGetterCallback)(
|
||||
v8::Local<v8::String>,
|
||||
const PropertyCallbackInfo<v8::Value>&);
|
||||
typedef void(*PropertySetterCallback)(
|
||||
v8::Local<v8::String>,
|
||||
v8::Local<v8::Value>,
|
||||
const PropertyCallbackInfo<v8::Value>&);
|
||||
typedef void(*PropertyEnumeratorCallback)
|
||||
(const PropertyCallbackInfo<v8::Array>&);
|
||||
typedef void(*PropertyDeleterCallback)(
|
||||
v8::Local<v8::String>,
|
||||
const PropertyCallbackInfo<v8::Boolean>&);
|
||||
typedef void(*PropertyQueryCallback)(
|
||||
v8::Local<v8::String>,
|
||||
const PropertyCallbackInfo<v8::Integer>&);
|
||||
typedef void(*IndexGetterCallback)(
|
||||
uint32_t,
|
||||
const PropertyCallbackInfo<v8::Value>&);
|
||||
typedef void(*IndexSetterCallback)(
|
||||
uint32_t,
|
||||
v8::Local<v8::Value>,
|
||||
const PropertyCallbackInfo<v8::Value>&);
|
||||
typedef void(*IndexEnumeratorCallback)
|
||||
(const PropertyCallbackInfo<v8::Array>&);
|
||||
typedef void(*IndexDeleterCallback)(
|
||||
uint32_t,
|
||||
const PropertyCallbackInfo<v8::Boolean>&);
|
||||
typedef void(*IndexQueryCallback)(
|
||||
uint32_t,
|
||||
const PropertyCallbackInfo<v8::Integer>&);
|
||||
|
||||
namespace imp {
|
||||
typedef v8::Local<v8::AccessorSignature> Sig;
|
||||
|
||||
static const int kDataIndex = 0;
|
||||
|
||||
static const int kFunctionIndex = 1;
|
||||
static const int kFunctionFieldCount = 2;
|
||||
|
||||
static const int kGetterIndex = 1;
|
||||
static const int kSetterIndex = 2;
|
||||
static const int kAccessorFieldCount = 3;
|
||||
|
||||
static const int kPropertyGetterIndex = 1;
|
||||
static const int kPropertySetterIndex = 2;
|
||||
static const int kPropertyEnumeratorIndex = 3;
|
||||
static const int kPropertyDeleterIndex = 4;
|
||||
static const int kPropertyQueryIndex = 5;
|
||||
static const int kPropertyFieldCount = 6;
|
||||
|
||||
static const int kIndexPropertyGetterIndex = 1;
|
||||
static const int kIndexPropertySetterIndex = 2;
|
||||
static const int kIndexPropertyEnumeratorIndex = 3;
|
||||
static const int kIndexPropertyDeleterIndex = 4;
|
||||
static const int kIndexPropertyQueryIndex = 5;
|
||||
static const int kIndexPropertyFieldCount = 6;
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
# include "nan_callbacks_12_inl.h" // NOLINT(build/include)
|
||||
#else
|
||||
# include "nan_callbacks_pre_12_inl.h" // NOLINT(build/include)
|
||||
#endif
|
||||
|
||||
#endif // NAN_CALLBACKS_H_
|
||||
512
node_modules/libxmljs/node_modules/nan/nan_callbacks_12_inl.h
generated
vendored
Normal file
512
node_modules/libxmljs/node_modules/nan/nan_callbacks_12_inl.h
generated
vendored
Normal file
@@ -0,0 +1,512 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_CALLBACKS_12_INL_H_
|
||||
#define NAN_CALLBACKS_12_INL_H_
|
||||
|
||||
template<typename T>
|
||||
class ReturnValue {
|
||||
v8::ReturnValue<T> value_;
|
||||
|
||||
public:
|
||||
template <class S>
|
||||
explicit inline ReturnValue(const v8::ReturnValue<S> &value) :
|
||||
value_(value) {}
|
||||
template <class S>
|
||||
explicit inline ReturnValue(const ReturnValue<S>& that)
|
||||
: value_(that.value_) {
|
||||
TYPE_CHECK(T, S);
|
||||
}
|
||||
|
||||
// Handle setters
|
||||
template <typename S> inline void Set(const v8::Local<S> &handle) {
|
||||
TYPE_CHECK(T, S);
|
||||
value_.Set(handle);
|
||||
}
|
||||
|
||||
template <typename S> inline void Set(const Global<S> &handle) {
|
||||
TYPE_CHECK(T, S);
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && \
|
||||
(V8_MINOR_VERSION > 5 || (V8_MINOR_VERSION == 5 && \
|
||||
defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER >= 8))))
|
||||
value_.Set(handle);
|
||||
#else
|
||||
value_.Set(*reinterpret_cast<const v8::Persistent<S>*>(&handle));
|
||||
const_cast<Global<S> &>(handle).Reset();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Fast primitive setters
|
||||
inline void Set(bool value) {
|
||||
TYPE_CHECK(T, v8::Boolean);
|
||||
value_.Set(value);
|
||||
}
|
||||
|
||||
inline void Set(double i) {
|
||||
TYPE_CHECK(T, v8::Number);
|
||||
value_.Set(i);
|
||||
}
|
||||
|
||||
inline void Set(int32_t i) {
|
||||
TYPE_CHECK(T, v8::Integer);
|
||||
value_.Set(i);
|
||||
}
|
||||
|
||||
inline void Set(uint32_t i) {
|
||||
TYPE_CHECK(T, v8::Integer);
|
||||
value_.Set(i);
|
||||
}
|
||||
|
||||
// Fast JS primitive setters
|
||||
inline void SetNull() {
|
||||
TYPE_CHECK(T, v8::Primitive);
|
||||
value_.SetNull();
|
||||
}
|
||||
|
||||
inline void SetUndefined() {
|
||||
TYPE_CHECK(T, v8::Primitive);
|
||||
value_.SetUndefined();
|
||||
}
|
||||
|
||||
inline void SetEmptyString() {
|
||||
TYPE_CHECK(T, v8::String);
|
||||
value_.SetEmptyString();
|
||||
}
|
||||
|
||||
// Convenience getter for isolate
|
||||
inline v8::Isolate *GetIsolate() const {
|
||||
return value_.GetIsolate();
|
||||
}
|
||||
|
||||
// Pointer setter: Uncompilable to prevent inadvertent misuse.
|
||||
template<typename S>
|
||||
inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class FunctionCallbackInfo {
|
||||
const v8::FunctionCallbackInfo<T> &info_;
|
||||
const v8::Local<v8::Value> data_;
|
||||
|
||||
public:
|
||||
explicit inline FunctionCallbackInfo(
|
||||
const v8::FunctionCallbackInfo<T> &info
|
||||
, v8::Local<v8::Value> data) :
|
||||
info_(info)
|
||||
, data_(data) {}
|
||||
|
||||
inline ReturnValue<T> GetReturnValue() const {
|
||||
return ReturnValue<T>(info_.GetReturnValue());
|
||||
}
|
||||
|
||||
inline v8::Local<v8::Function> Callee() const { return info_.Callee(); }
|
||||
inline v8::Local<v8::Value> Data() const { return data_; }
|
||||
inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
|
||||
inline bool IsConstructCall() const { return info_.IsConstructCall(); }
|
||||
inline int Length() const { return info_.Length(); }
|
||||
inline v8::Local<v8::Value> operator[](int i) const { return info_[i]; }
|
||||
inline v8::Local<v8::Object> This() const { return info_.This(); }
|
||||
inline v8::Isolate *GetIsolate() const { return info_.GetIsolate(); }
|
||||
|
||||
|
||||
protected:
|
||||
static const int kHolderIndex = 0;
|
||||
static const int kIsolateIndex = 1;
|
||||
static const int kReturnValueDefaultValueIndex = 2;
|
||||
static const int kReturnValueIndex = 3;
|
||||
static const int kDataIndex = 4;
|
||||
static const int kCalleeIndex = 5;
|
||||
static const int kContextSaveIndex = 6;
|
||||
static const int kArgsLength = 7;
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class PropertyCallbackInfo {
|
||||
const v8::PropertyCallbackInfo<T> &info_;
|
||||
const v8::Local<v8::Value> data_;
|
||||
|
||||
public:
|
||||
explicit inline PropertyCallbackInfo(
|
||||
const v8::PropertyCallbackInfo<T> &info
|
||||
, const v8::Local<v8::Value> data) :
|
||||
info_(info)
|
||||
, data_(data) {}
|
||||
|
||||
inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
|
||||
inline v8::Local<v8::Value> Data() const { return data_; }
|
||||
inline v8::Local<v8::Object> This() const { return info_.This(); }
|
||||
inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
|
||||
inline ReturnValue<T> GetReturnValue() const {
|
||||
return ReturnValue<T>(info_.GetReturnValue());
|
||||
}
|
||||
|
||||
protected:
|
||||
static const int kHolderIndex = 0;
|
||||
static const int kIsolateIndex = 1;
|
||||
static const int kReturnValueDefaultValueIndex = 2;
|
||||
static const int kReturnValueIndex = 3;
|
||||
static const int kDataIndex = 4;
|
||||
static const int kThisIndex = 5;
|
||||
static const int kArgsLength = 6;
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo)
|
||||
};
|
||||
|
||||
namespace imp {
|
||||
static
|
||||
void FunctionCallbackWrapper(const v8::FunctionCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
FunctionCallback callback = reinterpret_cast<FunctionCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kFunctionIndex).As<v8::External>()->Value()));
|
||||
FunctionCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
callback(cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeFunction)(const v8::FunctionCallbackInfo<v8::Value> &);
|
||||
|
||||
#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
static
|
||||
void GetterCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
GetterCallback callback = reinterpret_cast<GetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
|
||||
callback(property.As<v8::String>(), cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeGetter)
|
||||
(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void SetterCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::PropertyCallbackInfo<void> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<void>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
SetterCallback callback = reinterpret_cast<SetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
|
||||
callback(property.As<v8::String>(), value, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeSetter)(
|
||||
v8::Local<v8::Name>
|
||||
, v8::Local<v8::Value>
|
||||
, const v8::PropertyCallbackInfo<void> &);
|
||||
#else
|
||||
static
|
||||
void GetterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
GetterCallback callback = reinterpret_cast<GetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeGetter)
|
||||
(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void SetterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::PropertyCallbackInfo<void> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<void>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
SetterCallback callback = reinterpret_cast<SetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
|
||||
callback(property, value, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeSetter)(
|
||||
v8::Local<v8::String>
|
||||
, v8::Local<v8::Value>
|
||||
, const v8::PropertyCallbackInfo<void> &);
|
||||
#endif
|
||||
|
||||
#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
static
|
||||
void PropertyGetterCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyGetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property.As<v8::String>(), cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertyGetter)
|
||||
(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void PropertySetterCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertySetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property.As<v8::String>(), value, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertySetter)(
|
||||
v8::Local<v8::Name>
|
||||
, v8::Local<v8::Value>
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void PropertyEnumeratorCallbackWrapper(
|
||||
const v8::PropertyCallbackInfo<v8::Array> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Array>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyEnumeratorCallback callback =
|
||||
reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyEnumeratorIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertyEnumerator)
|
||||
(const v8::PropertyCallbackInfo<v8::Array> &);
|
||||
|
||||
static
|
||||
void PropertyDeleterCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Boolean>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyDeleterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property.As<v8::String>(), cbinfo);
|
||||
}
|
||||
|
||||
typedef void (NativePropertyDeleter)
|
||||
(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean> &);
|
||||
|
||||
static
|
||||
void PropertyQueryCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
, const v8::PropertyCallbackInfo<v8::Integer> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Integer>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyQueryIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property.As<v8::String>(), cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertyQuery)
|
||||
(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
#else
|
||||
static
|
||||
void PropertyGetterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyGetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertyGetter)
|
||||
(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void PropertySetterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertySetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, value, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertySetter)(
|
||||
v8::Local<v8::String>
|
||||
, v8::Local<v8::Value>
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void PropertyEnumeratorCallbackWrapper(
|
||||
const v8::PropertyCallbackInfo<v8::Array> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Array>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyEnumeratorCallback callback =
|
||||
reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyEnumeratorIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertyEnumerator)
|
||||
(const v8::PropertyCallbackInfo<v8::Array> &);
|
||||
|
||||
static
|
||||
void PropertyDeleterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Boolean>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyDeleterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (NativePropertyDeleter)
|
||||
(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean> &);
|
||||
|
||||
static
|
||||
void PropertyQueryCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, const v8::PropertyCallbackInfo<v8::Integer> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Integer>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyQueryIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativePropertyQuery)
|
||||
(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
#endif
|
||||
|
||||
static
|
||||
void IndexGetterCallbackWrapper(
|
||||
uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyGetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeIndexGetter)
|
||||
(uint32_t, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void IndexSetterCallbackWrapper(
|
||||
uint32_t index
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertySetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, value, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeIndexSetter)(
|
||||
uint32_t
|
||||
, v8::Local<v8::Value>
|
||||
, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
|
||||
static
|
||||
void IndexEnumeratorCallbackWrapper(
|
||||
const v8::PropertyCallbackInfo<v8::Array> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Array>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(
|
||||
kIndexPropertyEnumeratorIndex).As<v8::External>()->Value()));
|
||||
callback(cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeIndexEnumerator)
|
||||
(const v8::PropertyCallbackInfo<v8::Array> &);
|
||||
|
||||
static
|
||||
void IndexDeleterCallbackWrapper(
|
||||
uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Boolean>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyDeleterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeIndexDeleter)
|
||||
(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean> &);
|
||||
|
||||
static
|
||||
void IndexQueryCallbackWrapper(
|
||||
uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Integer>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyQueryIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeIndexQuery)
|
||||
(uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
} // end of namespace imp
|
||||
|
||||
#endif // NAN_CALLBACKS_12_INL_H_
|
||||
520
node_modules/libxmljs/node_modules/nan/nan_callbacks_pre_12_inl.h
generated
vendored
Normal file
520
node_modules/libxmljs/node_modules/nan/nan_callbacks_pre_12_inl.h
generated
vendored
Normal file
@@ -0,0 +1,520 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_CALLBACKS_PRE_12_INL_H_
|
||||
#define NAN_CALLBACKS_PRE_12_INL_H_
|
||||
|
||||
namespace imp {
|
||||
template<typename T> class ReturnValueImp;
|
||||
} // end of namespace imp
|
||||
|
||||
template<typename T>
|
||||
class ReturnValue {
|
||||
v8::Isolate *isolate_;
|
||||
v8::Persistent<T> *value_;
|
||||
friend class imp::ReturnValueImp<T>;
|
||||
|
||||
public:
|
||||
template <class S>
|
||||
explicit inline ReturnValue(v8::Isolate *isolate, v8::Persistent<S> *p) :
|
||||
isolate_(isolate), value_(p) {}
|
||||
template <class S>
|
||||
explicit inline ReturnValue(const ReturnValue<S>& that)
|
||||
: isolate_(that.isolate_), value_(that.value_) {
|
||||
TYPE_CHECK(T, S);
|
||||
}
|
||||
|
||||
// Handle setters
|
||||
template <typename S> inline void Set(const v8::Local<S> &handle) {
|
||||
TYPE_CHECK(T, S);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(handle);
|
||||
}
|
||||
|
||||
template <typename S> inline void Set(const Global<S> &handle) {
|
||||
TYPE_CHECK(T, S);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(handle.persistent);
|
||||
const_cast<Global<S> &>(handle).Reset();
|
||||
}
|
||||
|
||||
// Fast primitive setters
|
||||
inline void Set(bool value) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::Boolean);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::Boolean::New(value));
|
||||
}
|
||||
|
||||
inline void Set(double i) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::Number);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::Number::New(i));
|
||||
}
|
||||
|
||||
inline void Set(int32_t i) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::Integer);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::Int32::New(i));
|
||||
}
|
||||
|
||||
inline void Set(uint32_t i) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::Integer);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::Uint32::NewFromUnsigned(i));
|
||||
}
|
||||
|
||||
// Fast JS primitive setters
|
||||
inline void SetNull() {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::Primitive);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::Null());
|
||||
}
|
||||
|
||||
inline void SetUndefined() {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::Primitive);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::Undefined());
|
||||
}
|
||||
|
||||
inline void SetEmptyString() {
|
||||
v8::HandleScope scope;
|
||||
|
||||
TYPE_CHECK(T, v8::String);
|
||||
value_->Dispose();
|
||||
*value_ = v8::Persistent<T>::New(v8::String::Empty());
|
||||
}
|
||||
|
||||
// Convenience getter for isolate
|
||||
inline v8::Isolate *GetIsolate() const {
|
||||
return isolate_;
|
||||
}
|
||||
|
||||
// Pointer setter: Uncompilable to prevent inadvertent misuse.
|
||||
template<typename S>
|
||||
inline void Set(S *whatever) { TYPE_CHECK(S*, v8::Primitive); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class FunctionCallbackInfo {
|
||||
const v8::Arguments &args_;
|
||||
v8::Local<v8::Value> data_;
|
||||
ReturnValue<T> return_value_;
|
||||
v8::Persistent<T> retval_;
|
||||
|
||||
public:
|
||||
explicit inline FunctionCallbackInfo(
|
||||
const v8::Arguments &args
|
||||
, v8::Local<v8::Value> data) :
|
||||
args_(args)
|
||||
, data_(data)
|
||||
, return_value_(args.GetIsolate(), &retval_)
|
||||
, retval_(v8::Persistent<T>::New(v8::Undefined())) {}
|
||||
|
||||
inline ~FunctionCallbackInfo() {
|
||||
retval_.Dispose();
|
||||
retval_.Clear();
|
||||
}
|
||||
|
||||
inline ReturnValue<T> GetReturnValue() const {
|
||||
return ReturnValue<T>(return_value_);
|
||||
}
|
||||
|
||||
inline v8::Local<v8::Function> Callee() const { return args_.Callee(); }
|
||||
inline v8::Local<v8::Value> Data() const { return data_; }
|
||||
inline v8::Local<v8::Object> Holder() const { return args_.Holder(); }
|
||||
inline bool IsConstructCall() const { return args_.IsConstructCall(); }
|
||||
inline int Length() const { return args_.Length(); }
|
||||
inline v8::Local<v8::Value> operator[](int i) const { return args_[i]; }
|
||||
inline v8::Local<v8::Object> This() const { return args_.This(); }
|
||||
inline v8::Isolate *GetIsolate() const { return args_.GetIsolate(); }
|
||||
|
||||
|
||||
protected:
|
||||
static const int kHolderIndex = 0;
|
||||
static const int kIsolateIndex = 1;
|
||||
static const int kReturnValueDefaultValueIndex = 2;
|
||||
static const int kReturnValueIndex = 3;
|
||||
static const int kDataIndex = 4;
|
||||
static const int kCalleeIndex = 5;
|
||||
static const int kContextSaveIndex = 6;
|
||||
static const int kArgsLength = 7;
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(FunctionCallbackInfo)
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class PropertyCallbackInfoBase {
|
||||
const v8::AccessorInfo &info_;
|
||||
const v8::Local<v8::Value> data_;
|
||||
|
||||
public:
|
||||
explicit inline PropertyCallbackInfoBase(
|
||||
const v8::AccessorInfo &info
|
||||
, const v8::Local<v8::Value> data) :
|
||||
info_(info)
|
||||
, data_(data) {}
|
||||
|
||||
inline v8::Isolate* GetIsolate() const { return info_.GetIsolate(); }
|
||||
inline v8::Local<v8::Value> Data() const { return data_; }
|
||||
inline v8::Local<v8::Object> This() const { return info_.This(); }
|
||||
inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
|
||||
|
||||
protected:
|
||||
static const int kHolderIndex = 0;
|
||||
static const int kIsolateIndex = 1;
|
||||
static const int kReturnValueDefaultValueIndex = 2;
|
||||
static const int kReturnValueIndex = 3;
|
||||
static const int kDataIndex = 4;
|
||||
static const int kThisIndex = 5;
|
||||
static const int kArgsLength = 6;
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfoBase)
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class PropertyCallbackInfo : public PropertyCallbackInfoBase<T> {
|
||||
ReturnValue<T> return_value_;
|
||||
v8::Persistent<T> retval_;
|
||||
|
||||
public:
|
||||
explicit inline PropertyCallbackInfo(
|
||||
const v8::AccessorInfo &info
|
||||
, const v8::Local<v8::Value> data) :
|
||||
PropertyCallbackInfoBase<T>(info, data)
|
||||
, return_value_(info.GetIsolate(), &retval_)
|
||||
, retval_(v8::Persistent<T>::New(v8::Undefined())) {}
|
||||
|
||||
inline ~PropertyCallbackInfo() {
|
||||
retval_.Dispose();
|
||||
retval_.Clear();
|
||||
}
|
||||
|
||||
inline ReturnValue<T> GetReturnValue() const { return return_value_; }
|
||||
};
|
||||
|
||||
template<>
|
||||
class PropertyCallbackInfo<v8::Array> :
|
||||
public PropertyCallbackInfoBase<v8::Array> {
|
||||
ReturnValue<v8::Array> return_value_;
|
||||
v8::Persistent<v8::Array> retval_;
|
||||
|
||||
public:
|
||||
explicit inline PropertyCallbackInfo(
|
||||
const v8::AccessorInfo &info
|
||||
, const v8::Local<v8::Value> data) :
|
||||
PropertyCallbackInfoBase<v8::Array>(info, data)
|
||||
, return_value_(info.GetIsolate(), &retval_)
|
||||
, retval_(v8::Persistent<v8::Array>::New(v8::Local<v8::Array>())) {}
|
||||
|
||||
inline ~PropertyCallbackInfo() {
|
||||
retval_.Dispose();
|
||||
retval_.Clear();
|
||||
}
|
||||
|
||||
inline ReturnValue<v8::Array> GetReturnValue() const {
|
||||
return return_value_;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class PropertyCallbackInfo<v8::Boolean> :
|
||||
public PropertyCallbackInfoBase<v8::Boolean> {
|
||||
ReturnValue<v8::Boolean> return_value_;
|
||||
v8::Persistent<v8::Boolean> retval_;
|
||||
|
||||
public:
|
||||
explicit inline PropertyCallbackInfo(
|
||||
const v8::AccessorInfo &info
|
||||
, const v8::Local<v8::Value> data) :
|
||||
PropertyCallbackInfoBase<v8::Boolean>(info, data)
|
||||
, return_value_(info.GetIsolate(), &retval_)
|
||||
, retval_(v8::Persistent<v8::Boolean>::New(v8::Local<v8::Boolean>())) {}
|
||||
|
||||
inline ~PropertyCallbackInfo() {
|
||||
retval_.Dispose();
|
||||
retval_.Clear();
|
||||
}
|
||||
|
||||
inline ReturnValue<v8::Boolean> GetReturnValue() const {
|
||||
return return_value_;
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
class PropertyCallbackInfo<v8::Integer> :
|
||||
public PropertyCallbackInfoBase<v8::Integer> {
|
||||
ReturnValue<v8::Integer> return_value_;
|
||||
v8::Persistent<v8::Integer> retval_;
|
||||
|
||||
public:
|
||||
explicit inline PropertyCallbackInfo(
|
||||
const v8::AccessorInfo &info
|
||||
, const v8::Local<v8::Value> data) :
|
||||
PropertyCallbackInfoBase<v8::Integer>(info, data)
|
||||
, return_value_(info.GetIsolate(), &retval_)
|
||||
, retval_(v8::Persistent<v8::Integer>::New(v8::Local<v8::Integer>())) {}
|
||||
|
||||
inline ~PropertyCallbackInfo() {
|
||||
retval_.Dispose();
|
||||
retval_.Clear();
|
||||
}
|
||||
|
||||
inline ReturnValue<v8::Integer> GetReturnValue() const {
|
||||
return return_value_;
|
||||
}
|
||||
};
|
||||
|
||||
namespace imp {
|
||||
template<typename T>
|
||||
class ReturnValueImp : public ReturnValue<T> {
|
||||
public:
|
||||
explicit ReturnValueImp(ReturnValue<T> that) :
|
||||
ReturnValue<T>(that) {}
|
||||
inline v8::Handle<T> Value() {
|
||||
return *ReturnValue<T>::value_;
|
||||
}
|
||||
};
|
||||
|
||||
static
|
||||
v8::Handle<v8::Value> FunctionCallbackWrapper(const v8::Arguments &args) {
|
||||
v8::Local<v8::Object> obj = args.Data().As<v8::Object>();
|
||||
FunctionCallback callback = reinterpret_cast<FunctionCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kFunctionIndex).As<v8::External>()->Value()));
|
||||
FunctionCallbackInfo<v8::Value>
|
||||
cbinfo(args, obj->GetInternalField(kDataIndex));
|
||||
callback(cbinfo);
|
||||
return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Value> (*NativeFunction)(const v8::Arguments &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Value> GetterCallbackWrapper(
|
||||
v8::Local<v8::String> property, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
GetterCallback callback = reinterpret_cast<GetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kGetterIndex).As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Value> (*NativeGetter)
|
||||
(v8::Local<v8::String>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
void SetterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<void>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
SetterCallback callback = reinterpret_cast<SetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kSetterIndex).As<v8::External>()->Value()));
|
||||
callback(property, value, cbinfo);
|
||||
}
|
||||
|
||||
typedef void (*NativeSetter)
|
||||
(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Value> PropertyGetterCallbackWrapper(
|
||||
v8::Local<v8::String> property, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyGetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Value> (*NativePropertyGetter)
|
||||
(v8::Local<v8::String>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Value> PropertySetterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertySetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, value, cbinfo);
|
||||
return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Value> (*NativePropertySetter)
|
||||
(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Array> PropertyEnumeratorCallbackWrapper(
|
||||
const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Array>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyEnumeratorCallback callback =
|
||||
reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyEnumeratorIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(cbinfo);
|
||||
return ReturnValueImp<v8::Array>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Array> (*NativePropertyEnumerator)
|
||||
(const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Boolean> PropertyDeleterCallbackWrapper(
|
||||
v8::Local<v8::String> property
|
||||
, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Boolean>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyDeleterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
return ReturnValueImp<v8::Boolean>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Boolean> (NativePropertyDeleter)
|
||||
(v8::Local<v8::String>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Integer> PropertyQueryCallbackWrapper(
|
||||
v8::Local<v8::String> property, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Integer>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kPropertyQueryIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(property, cbinfo);
|
||||
return ReturnValueImp<v8::Integer>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Integer> (*NativePropertyQuery)
|
||||
(v8::Local<v8::String>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Value> IndexGetterCallbackWrapper(
|
||||
uint32_t index, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyGetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, cbinfo);
|
||||
return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Value> (*NativeIndexGetter)
|
||||
(uint32_t, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Value> IndexSetterCallbackWrapper(
|
||||
uint32_t index
|
||||
, v8::Local<v8::Value> value
|
||||
, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Value>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertySetterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, value, cbinfo);
|
||||
return ReturnValueImp<v8::Value>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Value> (*NativeIndexSetter)
|
||||
(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Array> IndexEnumeratorCallbackWrapper(
|
||||
const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Array>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyEnumeratorIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(cbinfo);
|
||||
return ReturnValueImp<v8::Array>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Array> (*NativeIndexEnumerator)
|
||||
(const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Boolean> IndexDeleterCallbackWrapper(
|
||||
uint32_t index, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Boolean>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyDeleterIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, cbinfo);
|
||||
return ReturnValueImp<v8::Boolean>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Boolean> (*NativeIndexDeleter)
|
||||
(uint32_t, const v8::AccessorInfo &);
|
||||
|
||||
static
|
||||
v8::Handle<v8::Integer> IndexQueryCallbackWrapper(
|
||||
uint32_t index, const v8::AccessorInfo &info) {
|
||||
v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
PropertyCallbackInfo<v8::Integer>
|
||||
cbinfo(info, obj->GetInternalField(kDataIndex));
|
||||
IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
|
||||
reinterpret_cast<intptr_t>(
|
||||
obj->GetInternalField(kIndexPropertyQueryIndex)
|
||||
.As<v8::External>()->Value()));
|
||||
callback(index, cbinfo);
|
||||
return ReturnValueImp<v8::Integer>(cbinfo.GetReturnValue()).Value();
|
||||
}
|
||||
|
||||
typedef v8::Handle<v8::Integer> (*NativeIndexQuery)
|
||||
(uint32_t, const v8::AccessorInfo &);
|
||||
} // end of namespace imp
|
||||
|
||||
#endif // NAN_CALLBACKS_PRE_12_INL_H_
|
||||
72
node_modules/libxmljs/node_modules/nan/nan_converters.h
generated
vendored
Normal file
72
node_modules/libxmljs/node_modules/nan/nan_converters.h
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_CONVERTERS_H_
|
||||
#define NAN_CONVERTERS_H_
|
||||
|
||||
namespace imp {
|
||||
template<typename T> struct ToFactoryBase {
|
||||
typedef MaybeLocal<T> return_t;
|
||||
};
|
||||
template<typename T> struct ValueFactoryBase { typedef Maybe<T> return_t; };
|
||||
|
||||
template<typename T> struct ToFactory;
|
||||
|
||||
template<>
|
||||
struct ToFactory<v8::Function> : ToFactoryBase<v8::Function> {
|
||||
static inline return_t convert(v8::Local<v8::Value> val) {
|
||||
if (val.IsEmpty() || !val->IsFunction()) return MaybeLocal<v8::Function>();
|
||||
return MaybeLocal<v8::Function>(val.As<v8::Function>());
|
||||
}
|
||||
};
|
||||
|
||||
#define X(TYPE) \
|
||||
template<> \
|
||||
struct ToFactory<v8::TYPE> : ToFactoryBase<v8::TYPE> { \
|
||||
static inline return_t convert(v8::Local<v8::Value> val); \
|
||||
};
|
||||
|
||||
X(Boolean)
|
||||
X(Number)
|
||||
X(String)
|
||||
X(Object)
|
||||
X(Integer)
|
||||
X(Uint32)
|
||||
X(Int32)
|
||||
|
||||
#undef X
|
||||
|
||||
#define X(TYPE) \
|
||||
template<> \
|
||||
struct ToFactory<TYPE> : ValueFactoryBase<TYPE> { \
|
||||
static inline return_t convert(v8::Local<v8::Value> val); \
|
||||
};
|
||||
|
||||
X(bool)
|
||||
X(double)
|
||||
X(int64_t)
|
||||
X(uint32_t)
|
||||
X(int32_t)
|
||||
|
||||
#undef X
|
||||
} // end of namespace imp
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
typename imp::ToFactory<T>::return_t To(v8::Local<v8::Value> val) {
|
||||
return imp::ToFactory<T>::convert(val);
|
||||
}
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
# include "nan_converters_43_inl.h"
|
||||
#else
|
||||
# include "nan_converters_pre_43_inl.h"
|
||||
#endif
|
||||
|
||||
#endif // NAN_CONVERTERS_H_
|
||||
48
node_modules/libxmljs/node_modules/nan/nan_converters_43_inl.h
generated
vendored
Normal file
48
node_modules/libxmljs/node_modules/nan/nan_converters_43_inl.h
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_CONVERTERS_43_INL_H_
|
||||
#define NAN_CONVERTERS_43_INL_H_
|
||||
|
||||
#define X(TYPE) \
|
||||
imp::ToFactory<v8::TYPE>::return_t \
|
||||
imp::ToFactory<v8::TYPE>::convert(v8::Local<v8::Value> val) { \
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent(); \
|
||||
v8::EscapableHandleScope scope(isolate); \
|
||||
return scope.Escape( \
|
||||
val->To ## TYPE(isolate->GetCurrentContext()) \
|
||||
.FromMaybe(v8::Local<v8::TYPE>())); \
|
||||
}
|
||||
|
||||
X(Boolean)
|
||||
X(Number)
|
||||
X(String)
|
||||
X(Object)
|
||||
X(Integer)
|
||||
X(Uint32)
|
||||
X(Int32)
|
||||
|
||||
#undef X
|
||||
|
||||
#define X(TYPE, NAME) \
|
||||
imp::ToFactory<TYPE>::return_t \
|
||||
imp::ToFactory<TYPE>::convert(v8::Local<v8::Value> val) { \
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent(); \
|
||||
v8::HandleScope scope(isolate); \
|
||||
return val->NAME ## Value(isolate->GetCurrentContext()); \
|
||||
}
|
||||
|
||||
X(bool, Boolean)
|
||||
X(double, Number)
|
||||
X(int64_t, Integer)
|
||||
X(uint32_t, Uint32)
|
||||
X(int32_t, Int32)
|
||||
|
||||
#undef X
|
||||
|
||||
#endif // NAN_CONVERTERS_43_INL_H_
|
||||
42
node_modules/libxmljs/node_modules/nan/nan_converters_pre_43_inl.h
generated
vendored
Normal file
42
node_modules/libxmljs/node_modules/nan/nan_converters_pre_43_inl.h
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_CONVERTERS_PRE_43_INL_H_
|
||||
#define NAN_CONVERTERS_PRE_43_INL_H_
|
||||
|
||||
#define X(TYPE) \
|
||||
imp::ToFactory<v8::TYPE>::return_t \
|
||||
imp::ToFactory<v8::TYPE>::convert(v8::Local<v8::Value> val) { \
|
||||
return val->To ## TYPE(); \
|
||||
}
|
||||
|
||||
X(Boolean)
|
||||
X(Number)
|
||||
X(String)
|
||||
X(Object)
|
||||
X(Integer)
|
||||
X(Uint32)
|
||||
X(Int32)
|
||||
|
||||
#undef X
|
||||
|
||||
#define X(TYPE, NAME) \
|
||||
imp::ToFactory<TYPE>::return_t \
|
||||
imp::ToFactory<TYPE>::convert(v8::Local<v8::Value> val) { \
|
||||
return Just(val->NAME ## Value()); \
|
||||
}
|
||||
|
||||
X(bool, Boolean)
|
||||
X(double, Number)
|
||||
X(int64_t, Integer)
|
||||
X(uint32_t, Uint32)
|
||||
X(int32_t, Int32)
|
||||
|
||||
#undef X
|
||||
|
||||
#endif // NAN_CONVERTERS_PRE_43_INL_H_
|
||||
29
node_modules/libxmljs/node_modules/nan/nan_define_own_property_helper.h
generated
vendored
Normal file
29
node_modules/libxmljs/node_modules/nan/nan_define_own_property_helper.h
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_DEFINE_OWN_PROPERTY_HELPER_H_
|
||||
#define NAN_DEFINE_OWN_PROPERTY_HELPER_H_
|
||||
|
||||
namespace imp {
|
||||
|
||||
inline Maybe<bool> DefineOwnPropertyHelper(
|
||||
v8::PropertyAttribute current
|
||||
, v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key
|
||||
, v8::Handle<v8::Value> value
|
||||
, v8::PropertyAttribute attribs = v8::None) {
|
||||
return !(current & v8::DontDelete) || // configurable OR
|
||||
(!(current & v8::ReadOnly) && // writable AND
|
||||
!((attribs ^ current) & ~v8::ReadOnly)) // same excluding RO
|
||||
? Just<bool>(obj->ForceSet(key, value, attribs))
|
||||
: Nothing<bool>();
|
||||
}
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
#endif // NAN_DEFINE_OWN_PROPERTY_HELPER_H_
|
||||
399
node_modules/libxmljs/node_modules/nan/nan_implementation_12_inl.h
generated
vendored
Normal file
399
node_modules/libxmljs/node_modules/nan/nan_implementation_12_inl.h
generated
vendored
Normal file
@@ -0,0 +1,399 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_IMPLEMENTATION_12_INL_H_
|
||||
#define NAN_IMPLEMENTATION_12_INL_H_
|
||||
//==============================================================================
|
||||
// node v0.11 implementation
|
||||
//==============================================================================
|
||||
|
||||
namespace imp {
|
||||
|
||||
//=== Array ====================================================================
|
||||
|
||||
Factory<v8::Array>::return_t
|
||||
Factory<v8::Array>::New() {
|
||||
return v8::Array::New(v8::Isolate::GetCurrent());
|
||||
}
|
||||
|
||||
Factory<v8::Array>::return_t
|
||||
Factory<v8::Array>::New(int length) {
|
||||
return v8::Array::New(v8::Isolate::GetCurrent(), length);
|
||||
}
|
||||
|
||||
//=== Boolean ==================================================================
|
||||
|
||||
Factory<v8::Boolean>::return_t
|
||||
Factory<v8::Boolean>::New(bool value) {
|
||||
return v8::Boolean::New(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
|
||||
//=== Boolean Object ===========================================================
|
||||
|
||||
Factory<v8::BooleanObject>::return_t
|
||||
Factory<v8::BooleanObject>::New(bool value) {
|
||||
#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
|
||||
return v8::BooleanObject::New(
|
||||
v8::Isolate::GetCurrent(), value).As<v8::BooleanObject>();
|
||||
#else
|
||||
return v8::BooleanObject::New(value).As<v8::BooleanObject>();
|
||||
#endif
|
||||
}
|
||||
|
||||
//=== Context ==================================================================
|
||||
|
||||
Factory<v8::Context>::return_t
|
||||
Factory<v8::Context>::New( v8::ExtensionConfiguration* extensions
|
||||
, v8::Local<v8::ObjectTemplate> tmpl
|
||||
, v8::Local<v8::Value> obj) {
|
||||
return v8::Context::New(v8::Isolate::GetCurrent(), extensions, tmpl, obj);
|
||||
}
|
||||
|
||||
//=== Date =====================================================================
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
Factory<v8::Date>::return_t
|
||||
Factory<v8::Date>::New(double value) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(v8::Date::New(isolate->GetCurrentContext(), value)
|
||||
.FromMaybe(v8::Local<v8::Value>()).As<v8::Date>());
|
||||
}
|
||||
#else
|
||||
Factory<v8::Date>::return_t
|
||||
Factory<v8::Date>::New(double value) {
|
||||
return v8::Date::New(v8::Isolate::GetCurrent(), value).As<v8::Date>();
|
||||
}
|
||||
#endif
|
||||
|
||||
//=== External =================================================================
|
||||
|
||||
Factory<v8::External>::return_t
|
||||
Factory<v8::External>::New(void * value) {
|
||||
return v8::External::New(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
|
||||
//=== Function =================================================================
|
||||
|
||||
Factory<v8::Function>::return_t
|
||||
Factory<v8::Function>::New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New(isolate);
|
||||
tpl->SetInternalFieldCount(imp::kFunctionFieldCount);
|
||||
v8::Local<v8::Object> obj = NewInstance(tpl).ToLocalChecked();
|
||||
|
||||
obj->SetInternalField(
|
||||
imp::kFunctionIndex
|
||||
, v8::External::New(isolate, reinterpret_cast<void *>(callback)));
|
||||
|
||||
v8::Local<v8::Value> val = v8::Local<v8::Value>::New(isolate, data);
|
||||
|
||||
if (!val.IsEmpty()) {
|
||||
obj->SetInternalField(imp::kDataIndex, val);
|
||||
}
|
||||
|
||||
return scope.Escape(v8::Function::New( isolate
|
||||
, imp::FunctionCallbackWrapper
|
||||
, obj));
|
||||
}
|
||||
|
||||
//=== Function Template ========================================================
|
||||
|
||||
Factory<v8::FunctionTemplate>::return_t
|
||||
Factory<v8::FunctionTemplate>::New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data
|
||||
, v8::Local<v8::Signature> signature) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
if (callback) {
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New(isolate);
|
||||
tpl->SetInternalFieldCount(imp::kFunctionFieldCount);
|
||||
v8::Local<v8::Object> obj = NewInstance(tpl).ToLocalChecked();
|
||||
|
||||
obj->SetInternalField(
|
||||
imp::kFunctionIndex
|
||||
, v8::External::New(isolate, reinterpret_cast<void *>(callback)));
|
||||
v8::Local<v8::Value> val = v8::Local<v8::Value>::New(isolate, data);
|
||||
|
||||
if (!val.IsEmpty()) {
|
||||
obj->SetInternalField(imp::kDataIndex, val);
|
||||
}
|
||||
|
||||
return scope.Escape(v8::FunctionTemplate::New( isolate
|
||||
, imp::FunctionCallbackWrapper
|
||||
, obj
|
||||
, signature));
|
||||
} else {
|
||||
return v8::FunctionTemplate::New(isolate, 0, data, signature);
|
||||
}
|
||||
}
|
||||
|
||||
//=== Number ===================================================================
|
||||
|
||||
Factory<v8::Number>::return_t
|
||||
Factory<v8::Number>::New(double value) {
|
||||
return v8::Number::New(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
|
||||
//=== Number Object ============================================================
|
||||
|
||||
Factory<v8::NumberObject>::return_t
|
||||
Factory<v8::NumberObject>::New(double value) {
|
||||
return v8::NumberObject::New( v8::Isolate::GetCurrent()
|
||||
, value).As<v8::NumberObject>();
|
||||
}
|
||||
|
||||
//=== Integer, Int32 and Uint32 ================================================
|
||||
|
||||
template <typename T>
|
||||
typename IntegerFactory<T>::return_t
|
||||
IntegerFactory<T>::New(int32_t value) {
|
||||
return To<T>(T::New(v8::Isolate::GetCurrent(), value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename IntegerFactory<T>::return_t
|
||||
IntegerFactory<T>::New(uint32_t value) {
|
||||
return To<T>(T::NewFromUnsigned(v8::Isolate::GetCurrent(), value));
|
||||
}
|
||||
|
||||
Factory<v8::Uint32>::return_t
|
||||
Factory<v8::Uint32>::New(int32_t value) {
|
||||
return To<v8::Uint32>(
|
||||
v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value));
|
||||
}
|
||||
|
||||
Factory<v8::Uint32>::return_t
|
||||
Factory<v8::Uint32>::New(uint32_t value) {
|
||||
return To<v8::Uint32>(
|
||||
v8::Uint32::NewFromUnsigned(v8::Isolate::GetCurrent(), value));
|
||||
}
|
||||
|
||||
//=== Object ===================================================================
|
||||
|
||||
Factory<v8::Object>::return_t
|
||||
Factory<v8::Object>::New() {
|
||||
return v8::Object::New(v8::Isolate::GetCurrent());
|
||||
}
|
||||
|
||||
//=== Object Template ==========================================================
|
||||
|
||||
Factory<v8::ObjectTemplate>::return_t
|
||||
Factory<v8::ObjectTemplate>::New() {
|
||||
return v8::ObjectTemplate::New(v8::Isolate::GetCurrent());
|
||||
}
|
||||
|
||||
//=== RegExp ===================================================================
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
Factory<v8::RegExp>::return_t
|
||||
Factory<v8::RegExp>::New(
|
||||
v8::Local<v8::String> pattern
|
||||
, v8::RegExp::Flags flags) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(
|
||||
v8::RegExp::New(isolate->GetCurrentContext(), pattern, flags)
|
||||
.FromMaybe(v8::Local<v8::RegExp>()));
|
||||
}
|
||||
#else
|
||||
Factory<v8::RegExp>::return_t
|
||||
Factory<v8::RegExp>::New(
|
||||
v8::Local<v8::String> pattern
|
||||
, v8::RegExp::Flags flags) {
|
||||
return v8::RegExp::New(pattern, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
//=== Script ===================================================================
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
Factory<v8::Script>::return_t
|
||||
Factory<v8::Script>::New( v8::Local<v8::String> source) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
v8::ScriptCompiler::Source src(source);
|
||||
return scope.Escape(
|
||||
v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src)
|
||||
.FromMaybe(v8::Local<v8::Script>()));
|
||||
}
|
||||
|
||||
Factory<v8::Script>::return_t
|
||||
Factory<v8::Script>::New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
v8::ScriptCompiler::Source src(source, origin);
|
||||
return scope.Escape(
|
||||
v8::ScriptCompiler::Compile(isolate->GetCurrentContext(), &src)
|
||||
.FromMaybe(v8::Local<v8::Script>()));
|
||||
}
|
||||
#else
|
||||
Factory<v8::Script>::return_t
|
||||
Factory<v8::Script>::New( v8::Local<v8::String> source) {
|
||||
v8::ScriptCompiler::Source src(source);
|
||||
return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src);
|
||||
}
|
||||
|
||||
Factory<v8::Script>::return_t
|
||||
Factory<v8::Script>::New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin) {
|
||||
v8::ScriptCompiler::Source src(source, origin);
|
||||
return v8::ScriptCompiler::Compile(v8::Isolate::GetCurrent(), &src);
|
||||
}
|
||||
#endif
|
||||
|
||||
//=== Signature ================================================================
|
||||
|
||||
Factory<v8::Signature>::return_t
|
||||
Factory<v8::Signature>::New(Factory<v8::Signature>::FTH receiver) {
|
||||
return v8::Signature::New(v8::Isolate::GetCurrent(), receiver);
|
||||
}
|
||||
|
||||
//=== String ===================================================================
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New() {
|
||||
return v8::String::Empty(v8::Isolate::GetCurrent());
|
||||
}
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(const char * value, int length) {
|
||||
return v8::String::NewFromUtf8(
|
||||
v8::Isolate::GetCurrent(), value, v8::NewStringType::kNormal, length);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(std::string const& value) {
|
||||
assert(value.size() <= INT_MAX && "string too long");
|
||||
return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),
|
||||
value.data(), v8::NewStringType::kNormal, static_cast<int>(value.size()));
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(const uint16_t * value, int length) {
|
||||
return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value,
|
||||
v8::NewStringType::kNormal, length);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(v8::String::ExternalStringResource * value) {
|
||||
return v8::String::NewExternalTwoByte(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(ExternalOneByteStringResource * value) {
|
||||
return v8::String::NewExternalOneByte(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
#else
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(const char * value, int length) {
|
||||
return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value,
|
||||
v8::String::kNormalString, length);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(
|
||||
std::string const& value) /* NOLINT(build/include_what_you_use) */ {
|
||||
assert(value.size() <= INT_MAX && "string too long");
|
||||
return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), value.data(),
|
||||
v8::String::kNormalString,
|
||||
static_cast<int>(value.size()));
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(const uint16_t * value, int length) {
|
||||
return v8::String::NewFromTwoByte(v8::Isolate::GetCurrent(), value,
|
||||
v8::String::kNormalString, length);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(v8::String::ExternalStringResource * value) {
|
||||
return v8::String::NewExternal(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(ExternalOneByteStringResource * value) {
|
||||
return v8::String::NewExternal(v8::Isolate::GetCurrent(), value);
|
||||
}
|
||||
#endif
|
||||
|
||||
//=== String Object ============================================================
|
||||
|
||||
Factory<v8::StringObject>::return_t
|
||||
Factory<v8::StringObject>::New(v8::Local<v8::String> value) {
|
||||
return v8::StringObject::New(value).As<v8::StringObject>();
|
||||
}
|
||||
|
||||
//=== Unbound Script ===========================================================
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
Factory<v8::UnboundScript>::return_t
|
||||
Factory<v8::UnboundScript>::New(v8::Local<v8::String> source) {
|
||||
v8::ScriptCompiler::Source src(source);
|
||||
return v8::ScriptCompiler::CompileUnboundScript(
|
||||
v8::Isolate::GetCurrent(), &src);
|
||||
}
|
||||
|
||||
Factory<v8::UnboundScript>::return_t
|
||||
Factory<v8::UnboundScript>::New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin) {
|
||||
v8::ScriptCompiler::Source src(source, origin);
|
||||
return v8::ScriptCompiler::CompileUnboundScript(
|
||||
v8::Isolate::GetCurrent(), &src);
|
||||
}
|
||||
#else
|
||||
Factory<v8::UnboundScript>::return_t
|
||||
Factory<v8::UnboundScript>::New(v8::Local<v8::String> source) {
|
||||
v8::ScriptCompiler::Source src(source);
|
||||
return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src);
|
||||
}
|
||||
|
||||
Factory<v8::UnboundScript>::return_t
|
||||
Factory<v8::UnboundScript>::New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin) {
|
||||
v8::ScriptCompiler::Source src(source, origin);
|
||||
return v8::ScriptCompiler::CompileUnbound(v8::Isolate::GetCurrent(), &src);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
//=== Presistents and Handles ==================================================
|
||||
|
||||
#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
|
||||
template <typename T>
|
||||
inline v8::Local<T> New(v8::Handle<T> h) {
|
||||
return v8::Local<T>::New(v8::Isolate::GetCurrent(), h);
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T, typename M>
|
||||
inline v8::Local<T> New(v8::Persistent<T, M> const& p) {
|
||||
return v8::Local<T>::New(v8::Isolate::GetCurrent(), p);
|
||||
}
|
||||
|
||||
template <typename T, typename M>
|
||||
inline v8::Local<T> New(Persistent<T, M> const& p) {
|
||||
return v8::Local<T>::New(v8::Isolate::GetCurrent(), p);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline v8::Local<T> New(Global<T> const& p) {
|
||||
return v8::Local<T>::New(v8::Isolate::GetCurrent(), p);
|
||||
}
|
||||
|
||||
#endif // NAN_IMPLEMENTATION_12_INL_H_
|
||||
263
node_modules/libxmljs/node_modules/nan/nan_implementation_pre_12_inl.h
generated
vendored
Normal file
263
node_modules/libxmljs/node_modules/nan/nan_implementation_pre_12_inl.h
generated
vendored
Normal file
@@ -0,0 +1,263 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_IMPLEMENTATION_PRE_12_INL_H_
|
||||
#define NAN_IMPLEMENTATION_PRE_12_INL_H_
|
||||
|
||||
//==============================================================================
|
||||
// node v0.10 implementation
|
||||
//==============================================================================
|
||||
|
||||
namespace imp {
|
||||
|
||||
//=== Array ====================================================================
|
||||
|
||||
Factory<v8::Array>::return_t
|
||||
Factory<v8::Array>::New() {
|
||||
return v8::Array::New();
|
||||
}
|
||||
|
||||
Factory<v8::Array>::return_t
|
||||
Factory<v8::Array>::New(int length) {
|
||||
return v8::Array::New(length);
|
||||
}
|
||||
|
||||
//=== Boolean ==================================================================
|
||||
|
||||
Factory<v8::Boolean>::return_t
|
||||
Factory<v8::Boolean>::New(bool value) {
|
||||
return v8::Boolean::New(value)->ToBoolean();
|
||||
}
|
||||
|
||||
//=== Boolean Object ===========================================================
|
||||
|
||||
Factory<v8::BooleanObject>::return_t
|
||||
Factory<v8::BooleanObject>::New(bool value) {
|
||||
return v8::BooleanObject::New(value).As<v8::BooleanObject>();
|
||||
}
|
||||
|
||||
//=== Context ==================================================================
|
||||
|
||||
Factory<v8::Context>::return_t
|
||||
Factory<v8::Context>::New( v8::ExtensionConfiguration* extensions
|
||||
, v8::Local<v8::ObjectTemplate> tmpl
|
||||
, v8::Local<v8::Value> obj) {
|
||||
v8::Persistent<v8::Context> ctx = v8::Context::New(extensions, tmpl, obj);
|
||||
v8::Local<v8::Context> lctx = v8::Local<v8::Context>::New(ctx);
|
||||
ctx.Dispose();
|
||||
return lctx;
|
||||
}
|
||||
|
||||
//=== Date =====================================================================
|
||||
|
||||
Factory<v8::Date>::return_t
|
||||
Factory<v8::Date>::New(double value) {
|
||||
return v8::Date::New(value).As<v8::Date>();
|
||||
}
|
||||
|
||||
//=== External =================================================================
|
||||
|
||||
Factory<v8::External>::return_t
|
||||
Factory<v8::External>::New(void * value) {
|
||||
return v8::External::New(value);
|
||||
}
|
||||
|
||||
//=== Function =================================================================
|
||||
|
||||
Factory<v8::Function>::return_t
|
||||
Factory<v8::Function>::New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
return scope.Close(Factory<v8::FunctionTemplate>::New(
|
||||
callback, data, v8::Local<v8::Signature>())
|
||||
->GetFunction());
|
||||
}
|
||||
|
||||
|
||||
//=== FunctionTemplate =========================================================
|
||||
|
||||
Factory<v8::FunctionTemplate>::return_t
|
||||
Factory<v8::FunctionTemplate>::New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data
|
||||
, v8::Local<v8::Signature> signature) {
|
||||
if (callback) {
|
||||
v8::HandleScope scope;
|
||||
|
||||
v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New();
|
||||
tpl->SetInternalFieldCount(imp::kFunctionFieldCount);
|
||||
v8::Local<v8::Object> obj = tpl->NewInstance();
|
||||
|
||||
obj->SetInternalField(
|
||||
imp::kFunctionIndex
|
||||
, v8::External::New(reinterpret_cast<void *>(callback)));
|
||||
|
||||
v8::Local<v8::Value> val = v8::Local<v8::Value>::New(data);
|
||||
|
||||
if (!val.IsEmpty()) {
|
||||
obj->SetInternalField(imp::kDataIndex, val);
|
||||
}
|
||||
|
||||
// Note(agnat): Emulate length argument here. Unfortunately, I couldn't find
|
||||
// a way. Have at it though...
|
||||
return scope.Close(
|
||||
v8::FunctionTemplate::New(imp::FunctionCallbackWrapper
|
||||
, obj
|
||||
, signature));
|
||||
} else {
|
||||
return v8::FunctionTemplate::New(0, data, signature);
|
||||
}
|
||||
}
|
||||
|
||||
//=== Number ===================================================================
|
||||
|
||||
Factory<v8::Number>::return_t
|
||||
Factory<v8::Number>::New(double value) {
|
||||
return v8::Number::New(value);
|
||||
}
|
||||
|
||||
//=== Number Object ============================================================
|
||||
|
||||
Factory<v8::NumberObject>::return_t
|
||||
Factory<v8::NumberObject>::New(double value) {
|
||||
return v8::NumberObject::New(value).As<v8::NumberObject>();
|
||||
}
|
||||
|
||||
//=== Integer, Int32 and Uint32 ================================================
|
||||
|
||||
template <typename T>
|
||||
typename IntegerFactory<T>::return_t
|
||||
IntegerFactory<T>::New(int32_t value) {
|
||||
return To<T>(T::New(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
typename IntegerFactory<T>::return_t
|
||||
IntegerFactory<T>::New(uint32_t value) {
|
||||
return To<T>(T::NewFromUnsigned(value));
|
||||
}
|
||||
|
||||
Factory<v8::Uint32>::return_t
|
||||
Factory<v8::Uint32>::New(int32_t value) {
|
||||
return To<v8::Uint32>(v8::Uint32::NewFromUnsigned(value));
|
||||
}
|
||||
|
||||
Factory<v8::Uint32>::return_t
|
||||
Factory<v8::Uint32>::New(uint32_t value) {
|
||||
return To<v8::Uint32>(v8::Uint32::NewFromUnsigned(value));
|
||||
}
|
||||
|
||||
|
||||
//=== Object ===================================================================
|
||||
|
||||
Factory<v8::Object>::return_t
|
||||
Factory<v8::Object>::New() {
|
||||
return v8::Object::New();
|
||||
}
|
||||
|
||||
//=== Object Template ==========================================================
|
||||
|
||||
Factory<v8::ObjectTemplate>::return_t
|
||||
Factory<v8::ObjectTemplate>::New() {
|
||||
return v8::ObjectTemplate::New();
|
||||
}
|
||||
|
||||
//=== RegExp ===================================================================
|
||||
|
||||
Factory<v8::RegExp>::return_t
|
||||
Factory<v8::RegExp>::New(
|
||||
v8::Local<v8::String> pattern
|
||||
, v8::RegExp::Flags flags) {
|
||||
return v8::RegExp::New(pattern, flags);
|
||||
}
|
||||
|
||||
//=== Script ===================================================================
|
||||
|
||||
Factory<v8::Script>::return_t
|
||||
Factory<v8::Script>::New( v8::Local<v8::String> source) {
|
||||
return v8::Script::New(source);
|
||||
}
|
||||
Factory<v8::Script>::return_t
|
||||
Factory<v8::Script>::New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin) {
|
||||
return v8::Script::New(source, const_cast<v8::ScriptOrigin*>(&origin));
|
||||
}
|
||||
|
||||
//=== Signature ================================================================
|
||||
|
||||
Factory<v8::Signature>::return_t
|
||||
Factory<v8::Signature>::New(Factory<v8::Signature>::FTH receiver) {
|
||||
return v8::Signature::New(receiver);
|
||||
}
|
||||
|
||||
//=== String ===================================================================
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New() {
|
||||
return v8::String::Empty();
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(const char * value, int length) {
|
||||
return v8::String::New(value, length);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(
|
||||
std::string const& value) /* NOLINT(build/include_what_you_use) */ {
|
||||
assert(value.size() <= INT_MAX && "string too long");
|
||||
return v8::String::New(value.data(), static_cast<int>(value.size()));
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(const uint16_t * value, int length) {
|
||||
return v8::String::New(value, length);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(v8::String::ExternalStringResource * value) {
|
||||
return v8::String::NewExternal(value);
|
||||
}
|
||||
|
||||
Factory<v8::String>::return_t
|
||||
Factory<v8::String>::New(v8::String::ExternalAsciiStringResource * value) {
|
||||
return v8::String::NewExternal(value);
|
||||
}
|
||||
|
||||
//=== String Object ============================================================
|
||||
|
||||
Factory<v8::StringObject>::return_t
|
||||
Factory<v8::StringObject>::New(v8::Local<v8::String> value) {
|
||||
return v8::StringObject::New(value).As<v8::StringObject>();
|
||||
}
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
//=== Presistents and Handles ==================================================
|
||||
|
||||
template <typename T>
|
||||
inline v8::Local<T> New(v8::Handle<T> h) {
|
||||
return v8::Local<T>::New(h);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline v8::Local<T> New(v8::Persistent<T> const& p) {
|
||||
return v8::Local<T>::New(p);
|
||||
}
|
||||
|
||||
template <typename T, typename M>
|
||||
inline v8::Local<T> New(Persistent<T, M> const& p) {
|
||||
return v8::Local<T>::New(p.persistent);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline v8::Local<T> New(Global<T> const& p) {
|
||||
return v8::Local<T>::New(p.persistent);
|
||||
}
|
||||
|
||||
#endif // NAN_IMPLEMENTATION_PRE_12_INL_H_
|
||||
166
node_modules/libxmljs/node_modules/nan/nan_json.h
generated
vendored
Normal file
166
node_modules/libxmljs/node_modules/nan/nan_json.h
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_JSON_H_
|
||||
#define NAN_JSON_H_
|
||||
|
||||
#if NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION
|
||||
#define NAN_JSON_H_NEED_PARSE 1
|
||||
#else
|
||||
#define NAN_JSON_H_NEED_PARSE 0
|
||||
#endif // NODE_MODULE_VERSION < NODE_0_12_MODULE_VERSION
|
||||
|
||||
#if NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION
|
||||
#define NAN_JSON_H_NEED_STRINGIFY 0
|
||||
#else
|
||||
#define NAN_JSON_H_NEED_STRINGIFY 1
|
||||
#endif // NODE_MODULE_VERSION >= NODE_7_0_MODULE_VERSION
|
||||
|
||||
class JSON {
|
||||
public:
|
||||
JSON() {
|
||||
#if NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY
|
||||
Nan::HandleScope scope;
|
||||
|
||||
Nan::MaybeLocal<v8::Value> maybe_global_json = Nan::Get(
|
||||
Nan::GetCurrentContext()->Global(),
|
||||
Nan::New("JSON").ToLocalChecked()
|
||||
);
|
||||
|
||||
assert(!maybe_global_json.IsEmpty() && "global JSON is empty");
|
||||
v8::Local<v8::Value> val_global_json = maybe_global_json.ToLocalChecked();
|
||||
|
||||
assert(val_global_json->IsObject() && "global JSON is not an object");
|
||||
Nan::MaybeLocal<v8::Object> maybe_obj_global_json =
|
||||
Nan::To<v8::Object>(val_global_json);
|
||||
|
||||
assert(!maybe_obj_global_json.IsEmpty() && "global JSON object is empty");
|
||||
v8::Local<v8::Object> global_json = maybe_obj_global_json.ToLocalChecked();
|
||||
|
||||
#if NAN_JSON_H_NEED_PARSE
|
||||
Nan::MaybeLocal<v8::Value> maybe_parse_method = Nan::Get(
|
||||
global_json, Nan::New("parse").ToLocalChecked()
|
||||
);
|
||||
|
||||
assert(!maybe_parse_method.IsEmpty() && "JSON.parse is empty");
|
||||
v8::Local<v8::Value> parse_method = maybe_parse_method.ToLocalChecked();
|
||||
|
||||
assert(parse_method->IsFunction() && "JSON.parse is not a function");
|
||||
parse_cb_.Reset(parse_method.As<v8::Function>());
|
||||
#endif // NAN_JSON_H_NEED_PARSE
|
||||
|
||||
#if NAN_JSON_H_NEED_STRINGIFY
|
||||
Nan::MaybeLocal<v8::Value> maybe_stringify_method = Nan::Get(
|
||||
global_json, Nan::New("stringify").ToLocalChecked()
|
||||
);
|
||||
|
||||
assert(!maybe_stringify_method.IsEmpty() && "JSON.stringify is empty");
|
||||
v8::Local<v8::Value> stringify_method =
|
||||
maybe_stringify_method.ToLocalChecked();
|
||||
|
||||
assert(
|
||||
stringify_method->IsFunction() && "JSON.stringify is not a function"
|
||||
);
|
||||
stringify_cb_.Reset(stringify_method.As<v8::Function>());
|
||||
#endif // NAN_JSON_H_NEED_STRINGIFY
|
||||
#endif // NAN_JSON_H_NEED_PARSE + NAN_JSON_H_NEED_STRINGIFY
|
||||
}
|
||||
|
||||
inline
|
||||
Nan::MaybeLocal<v8::Value> Parse(v8::Local<v8::String> json_string) {
|
||||
Nan::EscapableHandleScope scope;
|
||||
#if NAN_JSON_H_NEED_PARSE
|
||||
return scope.Escape(parse(json_string));
|
||||
#else
|
||||
Nan::MaybeLocal<v8::Value> result;
|
||||
#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION && \
|
||||
NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION
|
||||
result = v8::JSON::Parse(json_string);
|
||||
#else
|
||||
#if NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION
|
||||
v8::Local<v8::Context> context_or_isolate = Nan::GetCurrentContext();
|
||||
#else
|
||||
v8::Isolate* context_or_isolate = v8::Isolate::GetCurrent();
|
||||
#endif // NODE_MODULE_VERSION > NODE_6_0_MODULE_VERSION
|
||||
result = v8::JSON::Parse(context_or_isolate, json_string);
|
||||
#endif // NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION &&
|
||||
// NODE_MODULE_VERSION <= IOJS_2_0_MODULE_VERSION
|
||||
if (result.IsEmpty()) return v8::Local<v8::Value>();
|
||||
return scope.Escape(result.ToLocalChecked());
|
||||
#endif // NAN_JSON_H_NEED_PARSE
|
||||
}
|
||||
|
||||
inline
|
||||
Nan::MaybeLocal<v8::String> Stringify(v8::Local<v8::Object> json_object) {
|
||||
Nan::EscapableHandleScope scope;
|
||||
Nan::MaybeLocal<v8::String> result =
|
||||
#if NAN_JSON_H_NEED_STRINGIFY
|
||||
Nan::To<v8::String>(stringify(json_object));
|
||||
#else
|
||||
v8::JSON::Stringify(Nan::GetCurrentContext(), json_object);
|
||||
#endif // NAN_JSON_H_NEED_STRINGIFY
|
||||
if (result.IsEmpty()) return v8::Local<v8::String>();
|
||||
return scope.Escape(result.ToLocalChecked());
|
||||
}
|
||||
|
||||
inline
|
||||
Nan::MaybeLocal<v8::String> Stringify(v8::Local<v8::Object> json_object,
|
||||
v8::Local<v8::String> gap) {
|
||||
Nan::EscapableHandleScope scope;
|
||||
Nan::MaybeLocal<v8::String> result =
|
||||
#if NAN_JSON_H_NEED_STRINGIFY
|
||||
Nan::To<v8::String>(stringify(json_object, gap));
|
||||
#else
|
||||
v8::JSON::Stringify(Nan::GetCurrentContext(), json_object, gap);
|
||||
#endif // NAN_JSON_H_NEED_STRINGIFY
|
||||
if (result.IsEmpty()) return v8::Local<v8::String>();
|
||||
return scope.Escape(result.ToLocalChecked());
|
||||
}
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(JSON)
|
||||
#if NAN_JSON_H_NEED_PARSE
|
||||
Nan::Callback parse_cb_;
|
||||
#endif // NAN_JSON_H_NEED_PARSE
|
||||
#if NAN_JSON_H_NEED_STRINGIFY
|
||||
Nan::Callback stringify_cb_;
|
||||
#endif // NAN_JSON_H_NEED_STRINGIFY
|
||||
|
||||
#if NAN_JSON_H_NEED_PARSE
|
||||
inline v8::Local<v8::Value> parse(v8::Local<v8::Value> arg) {
|
||||
assert(!parse_cb_.IsEmpty() && "parse_cb_ is empty");
|
||||
AsyncResource resource("nan:JSON.parse");
|
||||
return parse_cb_.Call(1, &arg, &resource).FromMaybe(v8::Local<v8::Value>());
|
||||
}
|
||||
#endif // NAN_JSON_H_NEED_PARSE
|
||||
|
||||
#if NAN_JSON_H_NEED_STRINGIFY
|
||||
inline v8::Local<v8::Value> stringify(v8::Local<v8::Value> arg) {
|
||||
assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty");
|
||||
AsyncResource resource("nan:JSON.stringify");
|
||||
return stringify_cb_.Call(1, &arg, &resource)
|
||||
.FromMaybe(v8::Local<v8::Value>());
|
||||
}
|
||||
|
||||
inline v8::Local<v8::Value> stringify(v8::Local<v8::Value> arg,
|
||||
v8::Local<v8::String> gap) {
|
||||
assert(!stringify_cb_.IsEmpty() && "stringify_cb_ is empty");
|
||||
|
||||
v8::Local<v8::Value> argv[] = {
|
||||
arg,
|
||||
Nan::Null(),
|
||||
gap
|
||||
};
|
||||
AsyncResource resource("nan:JSON.stringify");
|
||||
return stringify_cb_.Call(3, argv, &resource)
|
||||
.FromMaybe(v8::Local<v8::Value>());
|
||||
}
|
||||
#endif // NAN_JSON_H_NEED_STRINGIFY
|
||||
};
|
||||
|
||||
#endif // NAN_JSON_H_
|
||||
369
node_modules/libxmljs/node_modules/nan/nan_maybe_43_inl.h
generated
vendored
Normal file
369
node_modules/libxmljs/node_modules/nan/nan_maybe_43_inl.h
generated
vendored
Normal file
@@ -0,0 +1,369 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_MAYBE_43_INL_H_
|
||||
#define NAN_MAYBE_43_INL_H_
|
||||
|
||||
template<typename T>
|
||||
using MaybeLocal = v8::MaybeLocal<T>;
|
||||
|
||||
template<typename T>
|
||||
using Maybe = v8::Maybe<T>;
|
||||
|
||||
template<typename T>
|
||||
inline Maybe<T> Nothing() {
|
||||
return v8::Nothing<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline Maybe<T> Just(const T& t) {
|
||||
return v8::Just<T>(t);
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::String> ToDetailString(v8::Local<v8::Value> val) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(val->ToDetailString(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::String>()));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Uint32> ToArrayIndex(v8::Local<v8::Value> val) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(val->ToArrayIndex(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::Uint32>()));
|
||||
}
|
||||
|
||||
inline
|
||||
Maybe<bool> Equals(v8::Local<v8::Value> a, v8::Local<v8::Value>(b)) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return a->Equals(isolate->GetCurrentContext(), b);
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Object> NewInstance(v8::Local<v8::Function> h) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(h->NewInstance(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::Object>()));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Object> NewInstance(
|
||||
v8::Local<v8::Function> h
|
||||
, int argc
|
||||
, v8::Local<v8::Value> argv[]) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(h->NewInstance(isolate->GetCurrentContext(), argc, argv)
|
||||
.FromMaybe(v8::Local<v8::Object>()));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Object> NewInstance(v8::Local<v8::ObjectTemplate> h) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(h->NewInstance(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::Object>()));
|
||||
}
|
||||
|
||||
|
||||
inline MaybeLocal<v8::Function> GetFunction(
|
||||
v8::Local<v8::FunctionTemplate> t) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(t->GetFunction(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::Function>()));
|
||||
}
|
||||
|
||||
inline Maybe<bool> Set(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::Value> key
|
||||
, v8::Local<v8::Value> value) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->Set(isolate->GetCurrentContext(), key, value);
|
||||
}
|
||||
|
||||
inline Maybe<bool> Set(
|
||||
v8::Local<v8::Object> obj
|
||||
, uint32_t index
|
||||
, v8::Local<v8::Value> value) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->Set(isolate->GetCurrentContext(), index, value);
|
||||
}
|
||||
|
||||
#if NODE_MODULE_VERSION < NODE_4_0_MODULE_VERSION
|
||||
#include "nan_define_own_property_helper.h" // NOLINT(build/include)
|
||||
#endif
|
||||
|
||||
inline Maybe<bool> DefineOwnProperty(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key
|
||||
, v8::Local<v8::Value> value
|
||||
, v8::PropertyAttribute attribs = v8::None) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
#if NODE_MODULE_VERSION >= NODE_4_0_MODULE_VERSION
|
||||
return obj->DefineOwnProperty(isolate->GetCurrentContext(), key, value,
|
||||
attribs);
|
||||
#else
|
||||
Maybe<v8::PropertyAttribute> maybeCurrent =
|
||||
obj->GetPropertyAttributes(isolate->GetCurrentContext(), key);
|
||||
if (maybeCurrent.IsNothing()) {
|
||||
return Nothing<bool>();
|
||||
}
|
||||
v8::PropertyAttribute current = maybeCurrent.FromJust();
|
||||
return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
NAN_DEPRECATED inline Maybe<bool> ForceSet(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::Value> key
|
||||
, v8::Local<v8::Value> value
|
||||
, v8::PropertyAttribute attribs = v8::None) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
#if NODE_MODULE_VERSION >= NODE_9_0_MODULE_VERSION
|
||||
return key->IsName()
|
||||
? obj->DefineOwnProperty(isolate->GetCurrentContext(),
|
||||
key.As<v8::Name>(), value, attribs)
|
||||
: Nothing<bool>();
|
||||
#else
|
||||
return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> Get(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::Value> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(obj->Get(isolate->GetCurrentContext(), key)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Value> Get(v8::Local<v8::Object> obj, uint32_t index) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(obj->Get(isolate->GetCurrentContext(), index)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
inline v8::PropertyAttribute GetPropertyAttributes(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::Value> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->GetPropertyAttributes(isolate->GetCurrentContext(), key)
|
||||
.FromJust();
|
||||
}
|
||||
|
||||
inline Maybe<bool> Has(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->Has(isolate->GetCurrentContext(), key);
|
||||
}
|
||||
|
||||
inline Maybe<bool> Has(v8::Local<v8::Object> obj, uint32_t index) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->Has(isolate->GetCurrentContext(), index);
|
||||
}
|
||||
|
||||
inline Maybe<bool> Delete(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->Delete(isolate->GetCurrentContext(), key);
|
||||
}
|
||||
|
||||
inline
|
||||
Maybe<bool> Delete(v8::Local<v8::Object> obj, uint32_t index) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->Delete(isolate->GetCurrentContext(), index);
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Array> GetPropertyNames(v8::Local<v8::Object> obj) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(obj->GetPropertyNames(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::Array>()));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Array> GetOwnPropertyNames(v8::Local<v8::Object> obj) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(obj->GetOwnPropertyNames(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::Array>()));
|
||||
}
|
||||
|
||||
inline Maybe<bool> SetPrototype(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::Value> prototype) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->SetPrototype(isolate->GetCurrentContext(), prototype);
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::String> ObjectProtoToString(
|
||||
v8::Local<v8::Object> obj) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(obj->ObjectProtoToString(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::String>()));
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasOwnProperty(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->HasOwnProperty(isolate->GetCurrentContext(), key);
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasRealNamedProperty(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->HasRealNamedProperty(isolate->GetCurrentContext(), key);
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasRealIndexedProperty(
|
||||
v8::Local<v8::Object> obj
|
||||
, uint32_t index) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->HasRealIndexedProperty(isolate->GetCurrentContext(), index);
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasRealNamedCallbackProperty(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return obj->HasRealNamedCallbackProperty(isolate->GetCurrentContext(), key);
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> GetRealNamedPropertyInPrototypeChain(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(obj->GetRealNamedPropertyInPrototypeChain(
|
||||
isolate->GetCurrentContext(), key)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> GetRealNamedProperty(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::String> key) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(
|
||||
obj->GetRealNamedProperty(isolate->GetCurrentContext(), key)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> CallAsFunction(
|
||||
v8::Local<v8::Object> obj
|
||||
, v8::Local<v8::Object> recv
|
||||
, int argc
|
||||
, v8::Local<v8::Value> argv[]) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(
|
||||
obj->CallAsFunction(isolate->GetCurrentContext(), recv, argc, argv)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> CallAsConstructor(
|
||||
v8::Local<v8::Object> obj
|
||||
, int argc, v8::Local<v8::Value> argv[]) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(
|
||||
obj->CallAsConstructor(isolate->GetCurrentContext(), argc, argv)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::String> GetSourceLine(v8::Local<v8::Message> msg) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(msg->GetSourceLine(isolate->GetCurrentContext())
|
||||
.FromMaybe(v8::Local<v8::String>()));
|
||||
}
|
||||
|
||||
inline Maybe<int> GetLineNumber(v8::Local<v8::Message> msg) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return msg->GetLineNumber(isolate->GetCurrentContext());
|
||||
}
|
||||
|
||||
inline Maybe<int> GetStartColumn(v8::Local<v8::Message> msg) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return msg->GetStartColumn(isolate->GetCurrentContext());
|
||||
}
|
||||
|
||||
inline Maybe<int> GetEndColumn(v8::Local<v8::Message> msg) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::HandleScope scope(isolate);
|
||||
return msg->GetEndColumn(isolate->GetCurrentContext());
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Object> CloneElementAt(
|
||||
v8::Local<v8::Array> array
|
||||
, uint32_t index) {
|
||||
#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
v8::Local<v8::Value> elem;
|
||||
v8::Local<v8::Object> obj;
|
||||
if (!array->Get(context, index).ToLocal(&elem)) {
|
||||
return scope.Escape(obj);
|
||||
}
|
||||
if (!elem->ToObject(context).ToLocal(&obj)) {
|
||||
return scope.Escape(v8::Local<v8::Object>());
|
||||
}
|
||||
return scope.Escape(obj->Clone());
|
||||
#else
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(array->CloneElementAt(isolate->GetCurrentContext(), index)
|
||||
.FromMaybe(v8::Local<v8::Object>()));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> Call(
|
||||
v8::Local<v8::Function> fun
|
||||
, v8::Local<v8::Object> recv
|
||||
, int argc
|
||||
, v8::Local<v8::Value> argv[]) {
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
return scope.Escape(fun->Call(isolate->GetCurrentContext(), recv, argc, argv)
|
||||
.FromMaybe(v8::Local<v8::Value>()));
|
||||
}
|
||||
|
||||
#endif // NAN_MAYBE_43_INL_H_
|
||||
316
node_modules/libxmljs/node_modules/nan/nan_maybe_pre_43_inl.h
generated
vendored
Normal file
316
node_modules/libxmljs/node_modules/nan/nan_maybe_pre_43_inl.h
generated
vendored
Normal file
@@ -0,0 +1,316 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_MAYBE_PRE_43_INL_H_
|
||||
#define NAN_MAYBE_PRE_43_INL_H_
|
||||
|
||||
template<typename T>
|
||||
class MaybeLocal {
|
||||
public:
|
||||
inline MaybeLocal() : val_(v8::Local<T>()) {}
|
||||
|
||||
template<typename S>
|
||||
# if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION
|
||||
inline
|
||||
MaybeLocal(v8::Local<S> that) : val_(that) {} // NOLINT(runtime/explicit)
|
||||
# else
|
||||
inline
|
||||
MaybeLocal(v8::Local<S> that) : // NOLINT(runtime/explicit)
|
||||
val_(*reinterpret_cast<v8::Local<T>*>(&that)) {}
|
||||
# endif
|
||||
|
||||
inline bool IsEmpty() const { return val_.IsEmpty(); }
|
||||
|
||||
template<typename S>
|
||||
inline bool ToLocal(v8::Local<S> *out) const {
|
||||
*out = val_;
|
||||
return !IsEmpty();
|
||||
}
|
||||
|
||||
inline v8::Local<T> ToLocalChecked() const {
|
||||
#if defined(V8_ENABLE_CHECKS)
|
||||
assert(!IsEmpty() && "ToLocalChecked is Empty");
|
||||
#endif // V8_ENABLE_CHECKS
|
||||
return val_;
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
inline v8::Local<S> FromMaybe(v8::Local<S> default_value) const {
|
||||
return IsEmpty() ? default_value : v8::Local<S>(val_);
|
||||
}
|
||||
|
||||
private:
|
||||
v8::Local<T> val_;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Maybe {
|
||||
public:
|
||||
inline bool IsNothing() const { return !has_value_; }
|
||||
inline bool IsJust() const { return has_value_; }
|
||||
|
||||
inline T FromJust() const {
|
||||
#if defined(V8_ENABLE_CHECKS)
|
||||
assert(IsJust() && "FromJust is Nothing");
|
||||
#endif // V8_ENABLE_CHECKS
|
||||
return value_;
|
||||
}
|
||||
|
||||
inline T FromMaybe(const T& default_value) const {
|
||||
return has_value_ ? value_ : default_value;
|
||||
}
|
||||
|
||||
inline bool operator==(const Maybe &other) const {
|
||||
return (IsJust() == other.IsJust()) &&
|
||||
(!IsJust() || FromJust() == other.FromJust());
|
||||
}
|
||||
|
||||
inline bool operator!=(const Maybe &other) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
|
||||
private:
|
||||
Maybe() : has_value_(false) {}
|
||||
explicit Maybe(const T& t) : has_value_(true), value_(t) {}
|
||||
bool has_value_;
|
||||
T value_;
|
||||
|
||||
template<typename U>
|
||||
friend Maybe<U> Nothing();
|
||||
template<typename U>
|
||||
friend Maybe<U> Just(const U& u);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline Maybe<T> Nothing() {
|
||||
return Maybe<T>();
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline Maybe<T> Just(const T& t) {
|
||||
return Maybe<T>(t);
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::String> ToDetailString(v8::Handle<v8::Value> val) {
|
||||
return MaybeLocal<v8::String>(val->ToDetailString());
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Uint32> ToArrayIndex(v8::Handle<v8::Value> val) {
|
||||
return MaybeLocal<v8::Uint32>(val->ToArrayIndex());
|
||||
}
|
||||
|
||||
inline
|
||||
Maybe<bool> Equals(v8::Handle<v8::Value> a, v8::Handle<v8::Value>(b)) {
|
||||
return Just<bool>(a->Equals(b));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Object> NewInstance(v8::Handle<v8::Function> h) {
|
||||
return MaybeLocal<v8::Object>(h->NewInstance());
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Object> NewInstance(
|
||||
v8::Local<v8::Function> h
|
||||
, int argc
|
||||
, v8::Local<v8::Value> argv[]) {
|
||||
return MaybeLocal<v8::Object>(h->NewInstance(argc, argv));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Object> NewInstance(v8::Handle<v8::ObjectTemplate> h) {
|
||||
return MaybeLocal<v8::Object>(h->NewInstance());
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Function> GetFunction(v8::Handle<v8::FunctionTemplate> t) {
|
||||
return MaybeLocal<v8::Function>(t->GetFunction());
|
||||
}
|
||||
|
||||
inline Maybe<bool> Set(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::Value> key
|
||||
, v8::Handle<v8::Value> value) {
|
||||
return Just<bool>(obj->Set(key, value));
|
||||
}
|
||||
|
||||
inline Maybe<bool> Set(
|
||||
v8::Handle<v8::Object> obj
|
||||
, uint32_t index
|
||||
, v8::Handle<v8::Value> value) {
|
||||
return Just<bool>(obj->Set(index, value));
|
||||
}
|
||||
|
||||
#include "nan_define_own_property_helper.h" // NOLINT(build/include)
|
||||
|
||||
inline Maybe<bool> DefineOwnProperty(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key
|
||||
, v8::Handle<v8::Value> value
|
||||
, v8::PropertyAttribute attribs = v8::None) {
|
||||
v8::PropertyAttribute current = obj->GetPropertyAttributes(key);
|
||||
return imp::DefineOwnPropertyHelper(current, obj, key, value, attribs);
|
||||
}
|
||||
|
||||
NAN_DEPRECATED inline Maybe<bool> ForceSet(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::Value> key
|
||||
, v8::Handle<v8::Value> value
|
||||
, v8::PropertyAttribute attribs = v8::None) {
|
||||
return Just<bool>(obj->ForceSet(key, value, attribs));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> Get(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::Value> key) {
|
||||
return MaybeLocal<v8::Value>(obj->Get(key));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> Get(
|
||||
v8::Handle<v8::Object> obj
|
||||
, uint32_t index) {
|
||||
return MaybeLocal<v8::Value>(obj->Get(index));
|
||||
}
|
||||
|
||||
inline Maybe<v8::PropertyAttribute> GetPropertyAttributes(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::Value> key) {
|
||||
return Just<v8::PropertyAttribute>(obj->GetPropertyAttributes(key));
|
||||
}
|
||||
|
||||
inline Maybe<bool> Has(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return Just<bool>(obj->Has(key));
|
||||
}
|
||||
|
||||
inline Maybe<bool> Has(
|
||||
v8::Handle<v8::Object> obj
|
||||
, uint32_t index) {
|
||||
return Just<bool>(obj->Has(index));
|
||||
}
|
||||
|
||||
inline Maybe<bool> Delete(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return Just<bool>(obj->Delete(key));
|
||||
}
|
||||
|
||||
inline Maybe<bool> Delete(
|
||||
v8::Handle<v8::Object> obj
|
||||
, uint32_t index) {
|
||||
return Just<bool>(obj->Delete(index));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Array> GetPropertyNames(v8::Handle<v8::Object> obj) {
|
||||
return MaybeLocal<v8::Array>(obj->GetPropertyNames());
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::Array> GetOwnPropertyNames(v8::Handle<v8::Object> obj) {
|
||||
return MaybeLocal<v8::Array>(obj->GetOwnPropertyNames());
|
||||
}
|
||||
|
||||
inline Maybe<bool> SetPrototype(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::Value> prototype) {
|
||||
return Just<bool>(obj->SetPrototype(prototype));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::String> ObjectProtoToString(
|
||||
v8::Handle<v8::Object> obj) {
|
||||
return MaybeLocal<v8::String>(obj->ObjectProtoToString());
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasOwnProperty(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return Just<bool>(obj->HasOwnProperty(key));
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasRealNamedProperty(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return Just<bool>(obj->HasRealNamedProperty(key));
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasRealIndexedProperty(
|
||||
v8::Handle<v8::Object> obj
|
||||
, uint32_t index) {
|
||||
return Just<bool>(obj->HasRealIndexedProperty(index));
|
||||
}
|
||||
|
||||
inline Maybe<bool> HasRealNamedCallbackProperty(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return Just<bool>(obj->HasRealNamedCallbackProperty(key));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> GetRealNamedPropertyInPrototypeChain(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return MaybeLocal<v8::Value>(
|
||||
obj->GetRealNamedPropertyInPrototypeChain(key));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> GetRealNamedProperty(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::String> key) {
|
||||
return MaybeLocal<v8::Value>(obj->GetRealNamedProperty(key));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> CallAsFunction(
|
||||
v8::Handle<v8::Object> obj
|
||||
, v8::Handle<v8::Object> recv
|
||||
, int argc
|
||||
, v8::Handle<v8::Value> argv[]) {
|
||||
return MaybeLocal<v8::Value>(obj->CallAsFunction(recv, argc, argv));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> CallAsConstructor(
|
||||
v8::Handle<v8::Object> obj
|
||||
, int argc
|
||||
, v8::Local<v8::Value> argv[]) {
|
||||
return MaybeLocal<v8::Value>(obj->CallAsConstructor(argc, argv));
|
||||
}
|
||||
|
||||
inline
|
||||
MaybeLocal<v8::String> GetSourceLine(v8::Handle<v8::Message> msg) {
|
||||
return MaybeLocal<v8::String>(msg->GetSourceLine());
|
||||
}
|
||||
|
||||
inline Maybe<int> GetLineNumber(v8::Handle<v8::Message> msg) {
|
||||
return Just<int>(msg->GetLineNumber());
|
||||
}
|
||||
|
||||
inline Maybe<int> GetStartColumn(v8::Handle<v8::Message> msg) {
|
||||
return Just<int>(msg->GetStartColumn());
|
||||
}
|
||||
|
||||
inline Maybe<int> GetEndColumn(v8::Handle<v8::Message> msg) {
|
||||
return Just<int>(msg->GetEndColumn());
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Object> CloneElementAt(
|
||||
v8::Handle<v8::Array> array
|
||||
, uint32_t index) {
|
||||
return MaybeLocal<v8::Object>(array->CloneElementAt(index));
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value> Call(
|
||||
v8::Local<v8::Function> fun
|
||||
, v8::Local<v8::Object> recv
|
||||
, int argc
|
||||
, v8::Local<v8::Value> argv[]) {
|
||||
return MaybeLocal<v8::Value>(fun->Call(recv, argc, argv));
|
||||
}
|
||||
|
||||
#endif // NAN_MAYBE_PRE_43_INL_H_
|
||||
340
node_modules/libxmljs/node_modules/nan/nan_new.h
generated
vendored
Normal file
340
node_modules/libxmljs/node_modules/nan/nan_new.h
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_NEW_H_
|
||||
#define NAN_NEW_H_
|
||||
|
||||
namespace imp { // scnr
|
||||
|
||||
// TODO(agnat): Generalize
|
||||
template <typename T> v8::Local<T> To(v8::Local<v8::Integer> i);
|
||||
|
||||
template <>
|
||||
inline
|
||||
v8::Local<v8::Integer>
|
||||
To<v8::Integer>(v8::Local<v8::Integer> i) {
|
||||
return Nan::To<v8::Integer>(i).ToLocalChecked();
|
||||
}
|
||||
|
||||
template <>
|
||||
inline
|
||||
v8::Local<v8::Int32>
|
||||
To<v8::Int32>(v8::Local<v8::Integer> i) {
|
||||
return Nan::To<v8::Int32>(i).ToLocalChecked();
|
||||
}
|
||||
|
||||
template <>
|
||||
inline
|
||||
v8::Local<v8::Uint32>
|
||||
To<v8::Uint32>(v8::Local<v8::Integer> i) {
|
||||
return Nan::To<v8::Uint32>(i).ToLocalChecked();
|
||||
}
|
||||
|
||||
template <typename T> struct FactoryBase {
|
||||
typedef v8::Local<T> return_t;
|
||||
};
|
||||
|
||||
template <typename T> struct MaybeFactoryBase {
|
||||
typedef MaybeLocal<T> return_t;
|
||||
};
|
||||
|
||||
template <typename T> struct Factory;
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Array> : FactoryBase<v8::Array> {
|
||||
static inline return_t New();
|
||||
static inline return_t New(int length);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Boolean> : FactoryBase<v8::Boolean> {
|
||||
static inline return_t New(bool value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::BooleanObject> : FactoryBase<v8::BooleanObject> {
|
||||
static inline return_t New(bool value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Context> : FactoryBase<v8::Context> {
|
||||
static inline
|
||||
return_t
|
||||
New( v8::ExtensionConfiguration* extensions = NULL
|
||||
, v8::Local<v8::ObjectTemplate> tmpl = v8::Local<v8::ObjectTemplate>()
|
||||
, v8::Local<v8::Value> obj = v8::Local<v8::Value>());
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Date> : MaybeFactoryBase<v8::Date> {
|
||||
static inline return_t New(double value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::External> : FactoryBase<v8::External> {
|
||||
static inline return_t New(void *value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Function> : FactoryBase<v8::Function> {
|
||||
static inline
|
||||
return_t
|
||||
New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data = v8::Local<v8::Value>());
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::FunctionTemplate> : FactoryBase<v8::FunctionTemplate> {
|
||||
static inline
|
||||
return_t
|
||||
New( FunctionCallback callback = NULL
|
||||
, v8::Local<v8::Value> data = v8::Local<v8::Value>()
|
||||
, v8::Local<v8::Signature> signature = v8::Local<v8::Signature>());
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Number> : FactoryBase<v8::Number> {
|
||||
static inline return_t New(double value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::NumberObject> : FactoryBase<v8::NumberObject> {
|
||||
static inline return_t New(double value);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct IntegerFactory : FactoryBase<T> {
|
||||
typedef typename FactoryBase<T>::return_t return_t;
|
||||
static inline return_t New(int32_t value);
|
||||
static inline return_t New(uint32_t value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Integer> : IntegerFactory<v8::Integer> {};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Int32> : IntegerFactory<v8::Int32> {};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Uint32> : FactoryBase<v8::Uint32> {
|
||||
static inline return_t New(int32_t value);
|
||||
static inline return_t New(uint32_t value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Object> : FactoryBase<v8::Object> {
|
||||
static inline return_t New();
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::ObjectTemplate> : FactoryBase<v8::ObjectTemplate> {
|
||||
static inline return_t New();
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::RegExp> : MaybeFactoryBase<v8::RegExp> {
|
||||
static inline return_t New(
|
||||
v8::Local<v8::String> pattern, v8::RegExp::Flags flags);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Script> : MaybeFactoryBase<v8::Script> {
|
||||
static inline return_t New( v8::Local<v8::String> source);
|
||||
static inline return_t New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::Signature> : FactoryBase<v8::Signature> {
|
||||
typedef v8::Local<v8::FunctionTemplate> FTH;
|
||||
static inline return_t New(FTH receiver = FTH());
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::String> : MaybeFactoryBase<v8::String> {
|
||||
static inline return_t New();
|
||||
static inline return_t New(const char *value, int length = -1);
|
||||
static inline return_t New(const uint16_t *value, int length = -1);
|
||||
static inline return_t New(std::string const& value);
|
||||
|
||||
static inline return_t New(v8::String::ExternalStringResource * value);
|
||||
static inline return_t New(ExternalOneByteStringResource * value);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Factory<v8::StringObject> : FactoryBase<v8::StringObject> {
|
||||
static inline return_t New(v8::Local<v8::String> value);
|
||||
};
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
#if (NODE_MODULE_VERSION >= 12)
|
||||
|
||||
namespace imp {
|
||||
|
||||
template <>
|
||||
struct Factory<v8::UnboundScript> : MaybeFactoryBase<v8::UnboundScript> {
|
||||
static inline return_t New( v8::Local<v8::String> source);
|
||||
static inline return_t New( v8::Local<v8::String> source
|
||||
, v8::ScriptOrigin const& origin);
|
||||
};
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
# include "nan_implementation_12_inl.h"
|
||||
|
||||
#else // NODE_MODULE_VERSION >= 12
|
||||
|
||||
# include "nan_implementation_pre_12_inl.h"
|
||||
|
||||
#endif
|
||||
|
||||
//=== API ======================================================================
|
||||
|
||||
template <typename T>
|
||||
typename imp::Factory<T>::return_t
|
||||
New() {
|
||||
return imp::Factory<T>::New();
|
||||
}
|
||||
|
||||
template <typename T, typename A0>
|
||||
typename imp::Factory<T>::return_t
|
||||
New(A0 arg0) {
|
||||
return imp::Factory<T>::New(arg0);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1>
|
||||
typename imp::Factory<T>::return_t
|
||||
New(A0 arg0, A1 arg1) {
|
||||
return imp::Factory<T>::New(arg0, arg1);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2>
|
||||
typename imp::Factory<T>::return_t
|
||||
New(A0 arg0, A1 arg1, A2 arg2) {
|
||||
return imp::Factory<T>::New(arg0, arg1, arg2);
|
||||
}
|
||||
|
||||
template <typename T, typename A0, typename A1, typename A2, typename A3>
|
||||
typename imp::Factory<T>::return_t
|
||||
New(A0 arg0, A1 arg1, A2 arg2, A3 arg3) {
|
||||
return imp::Factory<T>::New(arg0, arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
// Note(agnat): When passing overloaded function pointers to template functions
|
||||
// as generic arguments the compiler needs help in picking the right overload.
|
||||
// These two functions handle New<Function> and New<FunctionTemplate> with
|
||||
// all argument variations.
|
||||
|
||||
// v8::Function and v8::FunctionTemplate with one or two arguments
|
||||
template <typename T>
|
||||
typename imp::Factory<T>::return_t
|
||||
New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data = v8::Local<v8::Value>()) {
|
||||
return imp::Factory<T>::New(callback, data);
|
||||
}
|
||||
|
||||
// v8::Function and v8::FunctionTemplate with three arguments
|
||||
template <typename T, typename A2>
|
||||
typename imp::Factory<T>::return_t
|
||||
New( FunctionCallback callback
|
||||
, v8::Local<v8::Value> data = v8::Local<v8::Value>()
|
||||
, A2 a2 = A2()) {
|
||||
return imp::Factory<T>::New(callback, data, a2);
|
||||
}
|
||||
|
||||
// Convenience
|
||||
|
||||
#if NODE_MODULE_VERSION < IOJS_3_0_MODULE_VERSION
|
||||
template <typename T> inline v8::Local<T> New(v8::Handle<T> h);
|
||||
#endif
|
||||
|
||||
#if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
template <typename T, typename M>
|
||||
inline v8::Local<T> New(v8::Persistent<T, M> const& p);
|
||||
#else
|
||||
template <typename T> inline v8::Local<T> New(v8::Persistent<T> const& p);
|
||||
#endif
|
||||
template <typename T, typename M>
|
||||
inline v8::Local<T> New(Persistent<T, M> const& p);
|
||||
template <typename T>
|
||||
inline v8::Local<T> New(Global<T> const& p);
|
||||
|
||||
inline
|
||||
imp::Factory<v8::Boolean>::return_t
|
||||
New(bool value) {
|
||||
return New<v8::Boolean>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::Int32>::return_t
|
||||
New(int32_t value) {
|
||||
return New<v8::Int32>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::Uint32>::return_t
|
||||
New(uint32_t value) {
|
||||
return New<v8::Uint32>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::Number>::return_t
|
||||
New(double value) {
|
||||
return New<v8::Number>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(std::string const& value) { // NOLINT(build/include_what_you_use)
|
||||
return New<v8::String>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(const char * value, int length) {
|
||||
return New<v8::String>(value, length);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(const uint16_t * value, int length) {
|
||||
return New<v8::String>(value, length);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(const char * value) {
|
||||
return New<v8::String>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(const uint16_t * value) {
|
||||
return New<v8::String>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(v8::String::ExternalStringResource * value) {
|
||||
return New<v8::String>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::String>::return_t
|
||||
New(ExternalOneByteStringResource * value) {
|
||||
return New<v8::String>(value);
|
||||
}
|
||||
|
||||
inline
|
||||
imp::Factory<v8::RegExp>::return_t
|
||||
New(v8::Local<v8::String> pattern, v8::RegExp::Flags flags) {
|
||||
return New<v8::RegExp>(pattern, flags);
|
||||
}
|
||||
|
||||
#endif // NAN_NEW_H_
|
||||
155
node_modules/libxmljs/node_modules/nan/nan_object_wrap.h
generated
vendored
Normal file
155
node_modules/libxmljs/node_modules/nan/nan_object_wrap.h
generated
vendored
Normal file
@@ -0,0 +1,155 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_OBJECT_WRAP_H_
|
||||
#define NAN_OBJECT_WRAP_H_
|
||||
|
||||
class ObjectWrap {
|
||||
public:
|
||||
ObjectWrap() {
|
||||
refs_ = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual ~ObjectWrap() {
|
||||
if (persistent().IsEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert(persistent().IsNearDeath());
|
||||
persistent().ClearWeak();
|
||||
persistent().Reset();
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
static inline T* Unwrap(v8::Local<v8::Object> object) {
|
||||
assert(!object.IsEmpty());
|
||||
assert(object->InternalFieldCount() > 0);
|
||||
// Cast to ObjectWrap before casting to T. A direct cast from void
|
||||
// to T won't work right when T has more than one base class.
|
||||
void* ptr = GetInternalFieldPointer(object, 0);
|
||||
ObjectWrap* wrap = static_cast<ObjectWrap*>(ptr);
|
||||
return static_cast<T*>(wrap);
|
||||
}
|
||||
|
||||
|
||||
inline v8::Local<v8::Object> handle() const {
|
||||
return New(handle_);
|
||||
}
|
||||
|
||||
|
||||
inline Persistent<v8::Object>& persistent() {
|
||||
return handle_;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
inline void Wrap(v8::Local<v8::Object> object) {
|
||||
assert(persistent().IsEmpty());
|
||||
assert(object->InternalFieldCount() > 0);
|
||||
SetInternalFieldPointer(object, 0, this);
|
||||
persistent().Reset(object);
|
||||
MakeWeak();
|
||||
}
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
|
||||
inline void MakeWeak() {
|
||||
persistent().v8::PersistentBase<v8::Object>::SetWeak(
|
||||
this, WeakCallback, v8::WeakCallbackType::kParameter);
|
||||
persistent().MarkIndependent();
|
||||
}
|
||||
|
||||
#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
|
||||
inline void MakeWeak() {
|
||||
persistent().v8::PersistentBase<v8::Object>::SetWeak(this, WeakCallback);
|
||||
persistent().MarkIndependent();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline void MakeWeak() {
|
||||
persistent().persistent.MakeWeak(this, WeakCallback);
|
||||
persistent().MarkIndependent();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Ref() marks the object as being attached to an event loop.
|
||||
* Refed objects will not be garbage collected, even if
|
||||
* all references are lost.
|
||||
*/
|
||||
virtual void Ref() {
|
||||
assert(!persistent().IsEmpty());
|
||||
persistent().ClearWeak();
|
||||
refs_++;
|
||||
}
|
||||
|
||||
/* Unref() marks an object as detached from the event loop. This is its
|
||||
* default state. When an object with a "weak" reference changes from
|
||||
* attached to detached state it will be freed. Be careful not to access
|
||||
* the object after making this call as it might be gone!
|
||||
* (A "weak reference" means an object that only has a
|
||||
* persistant handle.)
|
||||
*
|
||||
* DO NOT CALL THIS FROM DESTRUCTOR
|
||||
*/
|
||||
virtual void Unref() {
|
||||
assert(!persistent().IsEmpty());
|
||||
assert(!persistent().IsWeak());
|
||||
assert(refs_ > 0);
|
||||
if (--refs_ == 0)
|
||||
MakeWeak();
|
||||
}
|
||||
|
||||
int refs_; // ro
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(ObjectWrap)
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
|
||||
static void
|
||||
WeakCallback(v8::WeakCallbackInfo<ObjectWrap> const& info) {
|
||||
ObjectWrap* wrap = info.GetParameter();
|
||||
assert(wrap->refs_ == 0);
|
||||
assert(wrap->handle_.IsNearDeath());
|
||||
wrap->handle_.Reset();
|
||||
delete wrap;
|
||||
}
|
||||
|
||||
#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
|
||||
static void
|
||||
WeakCallback(v8::WeakCallbackData<v8::Object, ObjectWrap> const& data) {
|
||||
ObjectWrap* wrap = data.GetParameter();
|
||||
assert(wrap->refs_ == 0);
|
||||
assert(wrap->handle_.IsNearDeath());
|
||||
wrap->handle_.Reset();
|
||||
delete wrap;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static void WeakCallback(v8::Persistent<v8::Value> value, void *data) {
|
||||
ObjectWrap *wrap = static_cast<ObjectWrap*>(data);
|
||||
assert(wrap->refs_ == 0);
|
||||
assert(wrap->handle_.IsNearDeath());
|
||||
wrap->handle_.Reset();
|
||||
delete wrap;
|
||||
}
|
||||
|
||||
#endif
|
||||
Persistent<v8::Object> handle_;
|
||||
};
|
||||
|
||||
|
||||
#endif // NAN_OBJECT_WRAP_H_
|
||||
132
node_modules/libxmljs/node_modules/nan/nan_persistent_12_inl.h
generated
vendored
Normal file
132
node_modules/libxmljs/node_modules/nan/nan_persistent_12_inl.h
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_PERSISTENT_12_INL_H_
|
||||
#define NAN_PERSISTENT_12_INL_H_
|
||||
|
||||
template<typename T, typename M> class Persistent :
|
||||
public v8::Persistent<T, M> {
|
||||
public:
|
||||
inline Persistent() : v8::Persistent<T, M>() {}
|
||||
|
||||
template<typename S> inline Persistent(v8::Local<S> that) :
|
||||
v8::Persistent<T, M>(v8::Isolate::GetCurrent(), that) {}
|
||||
|
||||
template<typename S, typename M2>
|
||||
inline
|
||||
Persistent(const v8::Persistent<S, M2> &that) : // NOLINT(runtime/explicit)
|
||||
v8::Persistent<T, M2>(v8::Isolate::GetCurrent(), that) {}
|
||||
|
||||
inline void Reset() { v8::PersistentBase<T>::Reset(); }
|
||||
|
||||
template <typename S>
|
||||
inline void Reset(const v8::Local<S> &other) {
|
||||
v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
inline void Reset(const v8::PersistentBase<S> &other) {
|
||||
v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
inline void SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type);
|
||||
|
||||
private:
|
||||
inline T *operator*() const { return *PersistentBase<T>::persistent; }
|
||||
|
||||
template<typename S, typename M2>
|
||||
inline void Copy(const Persistent<S, M2> &that) {
|
||||
TYPE_CHECK(T, S);
|
||||
|
||||
this->Reset();
|
||||
|
||||
if (!that.IsEmpty()) {
|
||||
this->Reset(that);
|
||||
M::Copy(that, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
template<typename T>
|
||||
class Global : public v8::Global<T> {
|
||||
public:
|
||||
inline Global() : v8::Global<T>() {}
|
||||
|
||||
template<typename S> inline Global(v8::Local<S> that) :
|
||||
v8::Global<T>(v8::Isolate::GetCurrent(), that) {}
|
||||
|
||||
template<typename S>
|
||||
inline
|
||||
Global(const v8::PersistentBase<S> &that) : // NOLINT(runtime/explicit)
|
||||
v8::Global<S>(v8::Isolate::GetCurrent(), that) {}
|
||||
|
||||
inline void Reset() { v8::PersistentBase<T>::Reset(); }
|
||||
|
||||
template <typename S>
|
||||
inline void Reset(const v8::Local<S> &other) {
|
||||
v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
inline void Reset(const v8::PersistentBase<S> &other) {
|
||||
v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
inline void SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
reinterpret_cast<Persistent<T>*>(this)->SetWeak(
|
||||
parameter, callback, type);
|
||||
}
|
||||
};
|
||||
#else
|
||||
template<typename T>
|
||||
class Global : public v8::UniquePersistent<T> {
|
||||
public:
|
||||
inline Global() : v8::UniquePersistent<T>() {}
|
||||
|
||||
template<typename S> inline Global(v8::Local<S> that) :
|
||||
v8::UniquePersistent<T>(v8::Isolate::GetCurrent(), that) {}
|
||||
|
||||
template<typename S>
|
||||
inline
|
||||
Global(const v8::PersistentBase<S> &that) : // NOLINT(runtime/explicit)
|
||||
v8::UniquePersistent<S>(v8::Isolate::GetCurrent(), that) {}
|
||||
|
||||
inline void Reset() { v8::PersistentBase<T>::Reset(); }
|
||||
|
||||
template <typename S>
|
||||
inline void Reset(const v8::Local<S> &other) {
|
||||
v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
inline void Reset(const v8::PersistentBase<S> &other) {
|
||||
v8::PersistentBase<T>::Reset(v8::Isolate::GetCurrent(), other);
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
inline void SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
reinterpret_cast<Persistent<T>*>(this)->SetWeak(
|
||||
parameter, callback, type);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // NAN_PERSISTENT_12_INL_H_
|
||||
242
node_modules/libxmljs/node_modules/nan/nan_persistent_pre_12_inl.h
generated
vendored
Normal file
242
node_modules/libxmljs/node_modules/nan/nan_persistent_pre_12_inl.h
generated
vendored
Normal file
@@ -0,0 +1,242 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_PERSISTENT_PRE_12_INL_H_
|
||||
#define NAN_PERSISTENT_PRE_12_INL_H_
|
||||
|
||||
template<typename T>
|
||||
class PersistentBase {
|
||||
v8::Persistent<T> persistent;
|
||||
template<typename U>
|
||||
friend v8::Local<U> New(const PersistentBase<U> &p);
|
||||
template<typename U, typename M>
|
||||
friend v8::Local<U> New(const Persistent<U, M> &p);
|
||||
template<typename U>
|
||||
friend v8::Local<U> New(const Global<U> &p);
|
||||
template<typename S> friend class ReturnValue;
|
||||
|
||||
public:
|
||||
inline PersistentBase() :
|
||||
persistent() {}
|
||||
|
||||
inline void Reset() {
|
||||
persistent.Dispose();
|
||||
persistent.Clear();
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
inline void Reset(const v8::Local<S> &other) {
|
||||
TYPE_CHECK(T, S);
|
||||
|
||||
if (!persistent.IsEmpty()) {
|
||||
persistent.Dispose();
|
||||
}
|
||||
|
||||
if (other.IsEmpty()) {
|
||||
persistent.Clear();
|
||||
} else {
|
||||
persistent = v8::Persistent<T>::New(other);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
inline void Reset(const PersistentBase<S> &other) {
|
||||
TYPE_CHECK(T, S);
|
||||
|
||||
if (!persistent.IsEmpty()) {
|
||||
persistent.Dispose();
|
||||
}
|
||||
|
||||
if (other.IsEmpty()) {
|
||||
persistent.Clear();
|
||||
} else {
|
||||
persistent = v8::Persistent<T>::New(other.persistent);
|
||||
}
|
||||
}
|
||||
|
||||
inline bool IsEmpty() const { return persistent.IsEmpty(); }
|
||||
|
||||
inline void Empty() { persistent.Clear(); }
|
||||
|
||||
template<typename S>
|
||||
inline bool operator==(const PersistentBase<S> &that) const {
|
||||
return this->persistent == that.persistent;
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
inline bool operator==(const v8::Local<S> &that) const {
|
||||
return this->persistent == that;
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
inline bool operator!=(const PersistentBase<S> &that) const {
|
||||
return !operator==(that);
|
||||
}
|
||||
|
||||
template<typename S>
|
||||
inline bool operator!=(const v8::Local<S> &that) const {
|
||||
return !operator==(that);
|
||||
}
|
||||
|
||||
template<typename P>
|
||||
inline void SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type);
|
||||
|
||||
inline void ClearWeak() { persistent.ClearWeak(); }
|
||||
|
||||
inline void MarkIndependent() { persistent.MarkIndependent(); }
|
||||
|
||||
inline bool IsIndependent() const { return persistent.IsIndependent(); }
|
||||
|
||||
inline bool IsNearDeath() const { return persistent.IsNearDeath(); }
|
||||
|
||||
inline bool IsWeak() const { return persistent.IsWeak(); }
|
||||
|
||||
private:
|
||||
inline explicit PersistentBase(v8::Persistent<T> that) :
|
||||
persistent(that) { }
|
||||
inline explicit PersistentBase(T *val) : persistent(val) {}
|
||||
template<typename S, typename M> friend class Persistent;
|
||||
template<typename S> friend class Global;
|
||||
friend class ObjectWrap;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class NonCopyablePersistentTraits {
|
||||
public:
|
||||
typedef Persistent<T, NonCopyablePersistentTraits<T> >
|
||||
NonCopyablePersistent;
|
||||
static const bool kResetInDestructor = false;
|
||||
template<typename S, typename M>
|
||||
inline static void Copy(const Persistent<S, M> &source,
|
||||
NonCopyablePersistent *dest) {
|
||||
Uncompilable<v8::Object>();
|
||||
}
|
||||
|
||||
template<typename O> inline static void Uncompilable() {
|
||||
TYPE_CHECK(O, v8::Primitive);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct CopyablePersistentTraits {
|
||||
typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
|
||||
static const bool kResetInDestructor = true;
|
||||
template<typename S, typename M>
|
||||
static inline void Copy(const Persistent<S, M> &source,
|
||||
CopyablePersistent *dest) {}
|
||||
};
|
||||
|
||||
template<typename T, typename M> class Persistent :
|
||||
public PersistentBase<T> {
|
||||
public:
|
||||
inline Persistent() {}
|
||||
|
||||
template<typename S> inline Persistent(v8::Handle<S> that)
|
||||
: PersistentBase<T>(v8::Persistent<T>::New(that)) {
|
||||
TYPE_CHECK(T, S);
|
||||
}
|
||||
|
||||
inline Persistent(const Persistent &that) : PersistentBase<T>() {
|
||||
Copy(that);
|
||||
}
|
||||
|
||||
template<typename S, typename M2>
|
||||
inline Persistent(const Persistent<S, M2> &that) :
|
||||
PersistentBase<T>() {
|
||||
Copy(that);
|
||||
}
|
||||
|
||||
inline Persistent &operator=(const Persistent &that) {
|
||||
Copy(that);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class S, class M2>
|
||||
inline Persistent &operator=(const Persistent<S, M2> &that) {
|
||||
Copy(that);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline ~Persistent() {
|
||||
if (M::kResetInDestructor) this->Reset();
|
||||
}
|
||||
|
||||
private:
|
||||
inline T *operator*() const { return *PersistentBase<T>::persistent; }
|
||||
|
||||
template<typename S, typename M2>
|
||||
inline void Copy(const Persistent<S, M2> &that) {
|
||||
TYPE_CHECK(T, S);
|
||||
|
||||
this->Reset();
|
||||
|
||||
if (!that.IsEmpty()) {
|
||||
this->persistent = v8::Persistent<T>::New(that.persistent);
|
||||
M::Copy(that, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class Global : public PersistentBase<T> {
|
||||
struct RValue {
|
||||
inline explicit RValue(Global* obj) : object(obj) {}
|
||||
Global* object;
|
||||
};
|
||||
|
||||
public:
|
||||
inline Global() : PersistentBase<T>(0) { }
|
||||
|
||||
template <typename S>
|
||||
inline Global(v8::Local<S> that) // NOLINT(runtime/explicit)
|
||||
: PersistentBase<T>(v8::Persistent<T>::New(that)) {
|
||||
TYPE_CHECK(T, S);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
inline Global(const PersistentBase<S> &that) // NOLINT(runtime/explicit)
|
||||
: PersistentBase<T>(that) {
|
||||
TYPE_CHECK(T, S);
|
||||
}
|
||||
/**
|
||||
* Move constructor.
|
||||
*/
|
||||
inline Global(RValue rvalue) // NOLINT(runtime/explicit)
|
||||
: PersistentBase<T>(rvalue.object->persistent) {
|
||||
rvalue.object->Reset();
|
||||
}
|
||||
inline ~Global() { this->Reset(); }
|
||||
/**
|
||||
* Move via assignment.
|
||||
*/
|
||||
template<typename S>
|
||||
inline Global &operator=(Global<S> rhs) {
|
||||
TYPE_CHECK(T, S);
|
||||
this->Reset(rhs.persistent);
|
||||
rhs.Reset();
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
* Cast operator for moves.
|
||||
*/
|
||||
inline operator RValue() { return RValue(this); }
|
||||
/**
|
||||
* Pass allows returning uniques from functions, etc.
|
||||
*/
|
||||
Global Pass() { return Global(RValue(this)); }
|
||||
|
||||
private:
|
||||
Global(Global &);
|
||||
void operator=(Global &);
|
||||
template<typename S> friend class ReturnValue;
|
||||
};
|
||||
|
||||
#endif // NAN_PERSISTENT_PRE_12_INL_H_
|
||||
73
node_modules/libxmljs/node_modules/nan/nan_private.h
generated
vendored
Normal file
73
node_modules/libxmljs/node_modules/nan/nan_private.h
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_PRIVATE_H_
|
||||
#define NAN_PRIVATE_H_
|
||||
|
||||
inline Maybe<bool>
|
||||
HasPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key) {
|
||||
HandleScope scope;
|
||||
#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
|
||||
return object->HasPrivate(context, private_key);
|
||||
#else
|
||||
return Just(!object->GetHiddenValue(key).IsEmpty());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline MaybeLocal<v8::Value>
|
||||
GetPrivate(v8::Local<v8::Object> object, v8::Local<v8::String> key) {
|
||||
#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::EscapableHandleScope scope(isolate);
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
|
||||
v8::MaybeLocal<v8::Value> v = object->GetPrivate(context, private_key);
|
||||
return scope.Escape(v.ToLocalChecked());
|
||||
#else
|
||||
EscapableHandleScope scope;
|
||||
v8::Local<v8::Value> v = object->GetHiddenValue(key);
|
||||
if (v.IsEmpty()) {
|
||||
v = Undefined();
|
||||
}
|
||||
return scope.Escape(v);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline Maybe<bool> SetPrivate(
|
||||
v8::Local<v8::Object> object,
|
||||
v8::Local<v8::String> key,
|
||||
v8::Local<v8::Value> value) {
|
||||
#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
|
||||
HandleScope scope;
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
|
||||
return object->SetPrivate(context, private_key, value);
|
||||
#else
|
||||
return Just(object->SetHiddenValue(key, value));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline Maybe<bool> DeletePrivate(
|
||||
v8::Local<v8::Object> object,
|
||||
v8::Local<v8::String> key) {
|
||||
#if NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION
|
||||
HandleScope scope;
|
||||
v8::Isolate *isolate = v8::Isolate::GetCurrent();
|
||||
v8::Local<v8::Private> private_key = v8::Private::ForApi(isolate, key);
|
||||
return object->DeletePrivate(isolate->GetCurrentContext(), private_key);
|
||||
#else
|
||||
return Just(object->DeleteHiddenValue(key));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // NAN_PRIVATE_H_
|
||||
|
||||
305
node_modules/libxmljs/node_modules/nan/nan_string_bytes.h
generated
vendored
Normal file
305
node_modules/libxmljs/node_modules/nan/nan_string_bytes.h
generated
vendored
Normal file
@@ -0,0 +1,305 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#ifndef NAN_STRING_BYTES_H_
|
||||
#define NAN_STRING_BYTES_H_
|
||||
|
||||
// Decodes a v8::Local<v8::String> or Buffer to a raw char*
|
||||
|
||||
namespace imp {
|
||||
|
||||
using v8::Local;
|
||||
using v8::Object;
|
||||
using v8::String;
|
||||
using v8::Value;
|
||||
|
||||
|
||||
//// Base 64 ////
|
||||
|
||||
#define base64_encoded_size(size) ((size + 2 - ((size + 2) % 3)) / 3 * 4)
|
||||
|
||||
|
||||
|
||||
//// HEX ////
|
||||
|
||||
static bool contains_non_ascii_slow(const char* buf, size_t len) {
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
if (buf[i] & 0x80) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool contains_non_ascii(const char* src, size_t len) {
|
||||
if (len < 16) {
|
||||
return contains_non_ascii_slow(src, len);
|
||||
}
|
||||
|
||||
const unsigned bytes_per_word = sizeof(void*);
|
||||
const unsigned align_mask = bytes_per_word - 1;
|
||||
const unsigned unaligned = reinterpret_cast<uintptr_t>(src) & align_mask;
|
||||
|
||||
if (unaligned > 0) {
|
||||
const unsigned n = bytes_per_word - unaligned;
|
||||
if (contains_non_ascii_slow(src, n)) return true;
|
||||
src += n;
|
||||
len -= n;
|
||||
}
|
||||
|
||||
|
||||
#if defined(__x86_64__) || defined(_WIN64)
|
||||
const uintptr_t mask = 0x8080808080808080ll;
|
||||
#else
|
||||
const uintptr_t mask = 0x80808080l;
|
||||
#endif
|
||||
|
||||
const uintptr_t* srcw = reinterpret_cast<const uintptr_t*>(src);
|
||||
|
||||
for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) {
|
||||
if (srcw[i] & mask) return true;
|
||||
}
|
||||
|
||||
const unsigned remainder = len & align_mask;
|
||||
if (remainder > 0) {
|
||||
const size_t offset = len - remainder;
|
||||
if (contains_non_ascii_slow(src + offset, remainder)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static void force_ascii_slow(const char* src, char* dst, size_t len) {
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
dst[i] = src[i] & 0x7f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void force_ascii(const char* src, char* dst, size_t len) {
|
||||
if (len < 16) {
|
||||
force_ascii_slow(src, dst, len);
|
||||
return;
|
||||
}
|
||||
|
||||
const unsigned bytes_per_word = sizeof(void*);
|
||||
const unsigned align_mask = bytes_per_word - 1;
|
||||
const unsigned src_unalign = reinterpret_cast<uintptr_t>(src) & align_mask;
|
||||
const unsigned dst_unalign = reinterpret_cast<uintptr_t>(dst) & align_mask;
|
||||
|
||||
if (src_unalign > 0) {
|
||||
if (src_unalign == dst_unalign) {
|
||||
const unsigned unalign = bytes_per_word - src_unalign;
|
||||
force_ascii_slow(src, dst, unalign);
|
||||
src += unalign;
|
||||
dst += unalign;
|
||||
len -= src_unalign;
|
||||
} else {
|
||||
force_ascii_slow(src, dst, len);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__x86_64__) || defined(_WIN64)
|
||||
const uintptr_t mask = ~0x8080808080808080ll;
|
||||
#else
|
||||
const uintptr_t mask = ~0x80808080l;
|
||||
#endif
|
||||
|
||||
const uintptr_t* srcw = reinterpret_cast<const uintptr_t*>(src);
|
||||
uintptr_t* dstw = reinterpret_cast<uintptr_t*>(dst);
|
||||
|
||||
for (size_t i = 0, n = len / bytes_per_word; i < n; ++i) {
|
||||
dstw[i] = srcw[i] & mask;
|
||||
}
|
||||
|
||||
const unsigned remainder = len & align_mask;
|
||||
if (remainder > 0) {
|
||||
const size_t offset = len - remainder;
|
||||
force_ascii_slow(src + offset, dst + offset, remainder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static size_t base64_encode(const char* src,
|
||||
size_t slen,
|
||||
char* dst,
|
||||
size_t dlen) {
|
||||
// We know how much we'll write, just make sure that there's space.
|
||||
assert(dlen >= base64_encoded_size(slen) &&
|
||||
"not enough space provided for base64 encode");
|
||||
|
||||
dlen = base64_encoded_size(slen);
|
||||
|
||||
unsigned a;
|
||||
unsigned b;
|
||||
unsigned c;
|
||||
unsigned i;
|
||||
unsigned k;
|
||||
unsigned n;
|
||||
|
||||
static const char table[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/";
|
||||
|
||||
i = 0;
|
||||
k = 0;
|
||||
n = slen / 3 * 3;
|
||||
|
||||
while (i < n) {
|
||||
a = src[i + 0] & 0xff;
|
||||
b = src[i + 1] & 0xff;
|
||||
c = src[i + 2] & 0xff;
|
||||
|
||||
dst[k + 0] = table[a >> 2];
|
||||
dst[k + 1] = table[((a & 3) << 4) | (b >> 4)];
|
||||
dst[k + 2] = table[((b & 0x0f) << 2) | (c >> 6)];
|
||||
dst[k + 3] = table[c & 0x3f];
|
||||
|
||||
i += 3;
|
||||
k += 4;
|
||||
}
|
||||
|
||||
if (n != slen) {
|
||||
switch (slen - n) {
|
||||
case 1:
|
||||
a = src[i + 0] & 0xff;
|
||||
dst[k + 0] = table[a >> 2];
|
||||
dst[k + 1] = table[(a & 3) << 4];
|
||||
dst[k + 2] = '=';
|
||||
dst[k + 3] = '=';
|
||||
break;
|
||||
|
||||
case 2:
|
||||
a = src[i + 0] & 0xff;
|
||||
b = src[i + 1] & 0xff;
|
||||
dst[k + 0] = table[a >> 2];
|
||||
dst[k + 1] = table[((a & 3) << 4) | (b >> 4)];
|
||||
dst[k + 2] = table[(b & 0x0f) << 2];
|
||||
dst[k + 3] = '=';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return dlen;
|
||||
}
|
||||
|
||||
|
||||
static size_t hex_encode(const char* src, size_t slen, char* dst, size_t dlen) {
|
||||
// We know how much we'll write, just make sure that there's space.
|
||||
assert(dlen >= slen * 2 &&
|
||||
"not enough space provided for hex encode");
|
||||
|
||||
dlen = slen * 2;
|
||||
for (uint32_t i = 0, k = 0; k < dlen; i += 1, k += 2) {
|
||||
static const char hex[] = "0123456789abcdef";
|
||||
uint8_t val = static_cast<uint8_t>(src[i]);
|
||||
dst[k + 0] = hex[val >> 4];
|
||||
dst[k + 1] = hex[val & 15];
|
||||
}
|
||||
|
||||
return dlen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static Local<Value> Encode(const char* buf,
|
||||
size_t buflen,
|
||||
enum Encoding encoding) {
|
||||
assert(buflen <= node::Buffer::kMaxLength);
|
||||
if (!buflen && encoding != BUFFER)
|
||||
return New("").ToLocalChecked();
|
||||
|
||||
Local<String> val;
|
||||
switch (encoding) {
|
||||
case BUFFER:
|
||||
return CopyBuffer(buf, buflen).ToLocalChecked();
|
||||
|
||||
case ASCII:
|
||||
if (contains_non_ascii(buf, buflen)) {
|
||||
char* out = new char[buflen];
|
||||
force_ascii(buf, out, buflen);
|
||||
val = New<String>(out, buflen).ToLocalChecked();
|
||||
delete[] out;
|
||||
} else {
|
||||
val = New<String>(buf, buflen).ToLocalChecked();
|
||||
}
|
||||
break;
|
||||
|
||||
case UTF8:
|
||||
val = New<String>(buf, buflen).ToLocalChecked();
|
||||
break;
|
||||
|
||||
case BINARY: {
|
||||
// TODO(isaacs) use ExternalTwoByteString?
|
||||
const unsigned char *cbuf = reinterpret_cast<const unsigned char*>(buf);
|
||||
uint16_t * twobytebuf = new uint16_t[buflen];
|
||||
for (size_t i = 0; i < buflen; i++) {
|
||||
// XXX is the following line platform independent?
|
||||
twobytebuf[i] = cbuf[i];
|
||||
}
|
||||
val = New<String>(twobytebuf, buflen).ToLocalChecked();
|
||||
delete[] twobytebuf;
|
||||
break;
|
||||
}
|
||||
|
||||
case BASE64: {
|
||||
size_t dlen = base64_encoded_size(buflen);
|
||||
char* dst = new char[dlen];
|
||||
|
||||
size_t written = base64_encode(buf, buflen, dst, dlen);
|
||||
assert(written == dlen);
|
||||
|
||||
val = New<String>(dst, dlen).ToLocalChecked();
|
||||
delete[] dst;
|
||||
break;
|
||||
}
|
||||
|
||||
case UCS2: {
|
||||
const uint16_t* data = reinterpret_cast<const uint16_t*>(buf);
|
||||
val = New<String>(data, buflen / 2).ToLocalChecked();
|
||||
break;
|
||||
}
|
||||
|
||||
case HEX: {
|
||||
size_t dlen = buflen * 2;
|
||||
char* dst = new char[dlen];
|
||||
size_t written = hex_encode(buf, buflen, dst, dlen);
|
||||
assert(written == dlen);
|
||||
|
||||
val = New<String>(dst, dlen).ToLocalChecked();
|
||||
delete[] dst;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assert(0 && "unknown encoding");
|
||||
break;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
#undef base64_encoded_size
|
||||
|
||||
} // end of namespace imp
|
||||
|
||||
#endif // NAN_STRING_BYTES_H_
|
||||
90
node_modules/libxmljs/node_modules/nan/nan_typedarray_contents.h
generated
vendored
Normal file
90
node_modules/libxmljs/node_modules/nan/nan_typedarray_contents.h
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_TYPEDARRAY_CONTENTS_H_
|
||||
#define NAN_TYPEDARRAY_CONTENTS_H_
|
||||
|
||||
template<typename T>
|
||||
class TypedArrayContents {
|
||||
public:
|
||||
inline explicit TypedArrayContents(v8::Local<v8::Value> from) :
|
||||
length_(0), data_(NULL) {
|
||||
HandleScope scope;
|
||||
|
||||
size_t length = 0;
|
||||
void* data = NULL;
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
|
||||
if (from->IsArrayBufferView()) {
|
||||
v8::Local<v8::ArrayBufferView> array =
|
||||
v8::Local<v8::ArrayBufferView>::Cast(from);
|
||||
|
||||
const size_t byte_length = array->ByteLength();
|
||||
const ptrdiff_t byte_offset = array->ByteOffset();
|
||||
v8::Local<v8::ArrayBuffer> buffer = array->Buffer();
|
||||
|
||||
length = byte_length / sizeof(T);
|
||||
data = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
if (from->IsObject() && !from->IsNull()) {
|
||||
v8::Local<v8::Object> array = v8::Local<v8::Object>::Cast(from);
|
||||
|
||||
MaybeLocal<v8::Value> buffer = Get(array,
|
||||
New<v8::String>("buffer").ToLocalChecked());
|
||||
MaybeLocal<v8::Value> byte_length = Get(array,
|
||||
New<v8::String>("byteLength").ToLocalChecked());
|
||||
MaybeLocal<v8::Value> byte_offset = Get(array,
|
||||
New<v8::String>("byteOffset").ToLocalChecked());
|
||||
|
||||
if (!buffer.IsEmpty() &&
|
||||
!byte_length.IsEmpty() && byte_length.ToLocalChecked()->IsUint32() &&
|
||||
!byte_offset.IsEmpty() && byte_offset.ToLocalChecked()->IsUint32()) {
|
||||
data = array->GetIndexedPropertiesExternalArrayData();
|
||||
if(data) {
|
||||
length = byte_length.ToLocalChecked()->Uint32Value() / sizeof(T);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1900 || __cplusplus >= 201103L
|
||||
assert(reinterpret_cast<uintptr_t>(data) % alignof (T) == 0);
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1600 || defined(__GNUC__)
|
||||
assert(reinterpret_cast<uintptr_t>(data) % __alignof(T) == 0);
|
||||
#else
|
||||
assert(reinterpret_cast<uintptr_t>(data) % sizeof (T) == 0);
|
||||
#endif
|
||||
|
||||
length_ = length;
|
||||
data_ = static_cast<T*>(data);
|
||||
}
|
||||
|
||||
inline size_t length() const { return length_; }
|
||||
inline T* operator*() { return data_; }
|
||||
inline const T* operator*() const { return data_; }
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(TypedArrayContents)
|
||||
|
||||
//Disable heap allocation
|
||||
void *operator new(size_t size);
|
||||
void operator delete(void *, size_t) {
|
||||
abort();
|
||||
}
|
||||
|
||||
size_t length_;
|
||||
T* data_;
|
||||
};
|
||||
|
||||
#endif // NAN_TYPEDARRAY_CONTENTS_H_
|
||||
432
node_modules/libxmljs/node_modules/nan/nan_weak.h
generated
vendored
Normal file
432
node_modules/libxmljs/node_modules/nan/nan_weak.h
generated
vendored
Normal file
@@ -0,0 +1,432 @@
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
#ifndef NAN_WEAK_H_
|
||||
#define NAN_WEAK_H_
|
||||
|
||||
static const int kInternalFieldsInWeakCallback = 2;
|
||||
static const int kNoInternalFieldIndex = -1;
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \
|
||||
v8::WeakCallbackInfo<WeakCallbackInfo<T> > const&
|
||||
# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \
|
||||
NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
|
||||
#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION
|
||||
# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \
|
||||
v8::PhantomCallbackData<WeakCallbackInfo<T> > const&
|
||||
# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \
|
||||
NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
|
||||
#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
# define NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ \
|
||||
v8::PhantomCallbackData<WeakCallbackInfo<T> > const&
|
||||
# define NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ \
|
||||
v8::InternalFieldsCallbackData<WeakCallbackInfo<T>, void> const&
|
||||
# define NAN_WEAK_PARAMETER_CALLBACK_SIG_ NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
# define NAN_WEAK_TWOFIELD_CALLBACK_SIG_ NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
|
||||
#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
# define NAN_WEAK_CALLBACK_DATA_TYPE_ \
|
||||
v8::WeakCallbackData<S, WeakCallbackInfo<T> > const&
|
||||
# define NAN_WEAK_CALLBACK_SIG_ NAN_WEAK_CALLBACK_DATA_TYPE_
|
||||
#else
|
||||
# define NAN_WEAK_CALLBACK_DATA_TYPE_ void *
|
||||
# define NAN_WEAK_CALLBACK_SIG_ \
|
||||
v8::Persistent<v8::Value>, NAN_WEAK_CALLBACK_DATA_TYPE_
|
||||
#endif
|
||||
|
||||
template<typename T>
|
||||
class WeakCallbackInfo {
|
||||
public:
|
||||
typedef void (*Callback)(const WeakCallbackInfo<T>& data);
|
||||
WeakCallbackInfo(
|
||||
Persistent<v8::Value> *persistent
|
||||
, Callback callback
|
||||
, void *parameter
|
||||
, void *field1 = 0
|
||||
, void *field2 = 0) :
|
||||
callback_(callback), isolate_(0), parameter_(parameter) {
|
||||
std::memcpy(&persistent_, persistent, sizeof (v8::Persistent<v8::Value>));
|
||||
internal_fields_[0] = field1;
|
||||
internal_fields_[1] = field2;
|
||||
}
|
||||
inline v8::Isolate *GetIsolate() const { return isolate_; }
|
||||
inline T *GetParameter() const { return static_cast<T*>(parameter_); }
|
||||
inline void *GetInternalField(int index) const {
|
||||
assert((index == 0 || index == 1) && "internal field index out of bounds");
|
||||
if (index == 0) {
|
||||
return internal_fields_[0];
|
||||
} else {
|
||||
return internal_fields_[1];
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
NAN_DISALLOW_ASSIGN_COPY_MOVE(WeakCallbackInfo)
|
||||
Callback callback_;
|
||||
v8::Isolate *isolate_;
|
||||
void *parameter_;
|
||||
void *internal_fields_[kInternalFieldsInWeakCallback];
|
||||
v8::Persistent<v8::Value> persistent_;
|
||||
template<typename S, typename M> friend class Persistent;
|
||||
template<typename S> friend class PersistentBase;
|
||||
#if NODE_MODULE_VERSION <= NODE_0_12_MODULE_VERSION
|
||||
# if NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
template<typename S>
|
||||
static void invoke(NAN_WEAK_CALLBACK_SIG_ data);
|
||||
template<typename S>
|
||||
static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data);
|
||||
# else
|
||||
static void invoke(NAN_WEAK_CALLBACK_SIG_ data);
|
||||
static WeakCallbackInfo *unwrap(NAN_WEAK_CALLBACK_DATA_TYPE_ data);
|
||||
# endif
|
||||
#else
|
||||
# if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
template<bool isFirstPass>
|
||||
static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data);
|
||||
template<bool isFirstPass>
|
||||
static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data);
|
||||
# else
|
||||
static void invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data);
|
||||
static void invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data);
|
||||
# endif
|
||||
static WeakCallbackInfo *unwrapparameter(
|
||||
NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data);
|
||||
static WeakCallbackInfo *unwraptwofield(
|
||||
NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
|
||||
template<typename T>
|
||||
template<bool isFirstPass>
|
||||
void
|
||||
WeakCallbackInfo<T>::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo = unwrapparameter(data);
|
||||
if (isFirstPass) {
|
||||
cbinfo->persistent_.Reset();
|
||||
data.SetSecondPassCallback(invokeparameter<false>);
|
||||
} else {
|
||||
cbinfo->callback_(*cbinfo);
|
||||
delete cbinfo;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template<bool isFirstPass>
|
||||
void
|
||||
WeakCallbackInfo<T>::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo = unwraptwofield(data);
|
||||
if (isFirstPass) {
|
||||
cbinfo->persistent_.Reset();
|
||||
data.SetSecondPassCallback(invoketwofield<false>);
|
||||
} else {
|
||||
cbinfo->callback_(*cbinfo);
|
||||
delete cbinfo;
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrapparameter(
|
||||
NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo =
|
||||
static_cast<WeakCallbackInfo<T>*>(data.GetParameter());
|
||||
cbinfo->isolate_ = data.GetIsolate();
|
||||
return cbinfo;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwraptwofield(
|
||||
NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo =
|
||||
static_cast<WeakCallbackInfo<T>*>(data.GetInternalField(0));
|
||||
cbinfo->isolate_ = data.GetIsolate();
|
||||
return cbinfo;
|
||||
}
|
||||
|
||||
#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_
|
||||
#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_
|
||||
#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
|
||||
# elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
WeakCallbackInfo<T>::invokeparameter(NAN_WEAK_PARAMETER_CALLBACK_SIG_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo = unwrapparameter(data);
|
||||
cbinfo->persistent_.Reset();
|
||||
cbinfo->callback_(*cbinfo);
|
||||
delete cbinfo;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
WeakCallbackInfo<T>::invoketwofield(NAN_WEAK_TWOFIELD_CALLBACK_SIG_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo = unwraptwofield(data);
|
||||
cbinfo->persistent_.Reset();
|
||||
cbinfo->callback_(*cbinfo);
|
||||
delete cbinfo;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrapparameter(
|
||||
NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo =
|
||||
static_cast<WeakCallbackInfo<T>*>(data.GetParameter());
|
||||
cbinfo->isolate_ = data.GetIsolate();
|
||||
return cbinfo;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwraptwofield(
|
||||
NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo =
|
||||
static_cast<WeakCallbackInfo<T>*>(data.GetInternalField1());
|
||||
cbinfo->isolate_ = data.GetIsolate();
|
||||
return cbinfo;
|
||||
}
|
||||
|
||||
#undef NAN_WEAK_PARAMETER_CALLBACK_SIG_
|
||||
#undef NAN_WEAK_TWOFIELD_CALLBACK_SIG_
|
||||
#undef NAN_WEAK_PARAMETER_CALLBACK_DATA_TYPE_
|
||||
#undef NAN_WEAK_TWOFIELD_CALLBACK_DATA_TYPE_
|
||||
#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
|
||||
template<typename T>
|
||||
template<typename S>
|
||||
void WeakCallbackInfo<T>::invoke(NAN_WEAK_CALLBACK_SIG_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo = unwrap(data);
|
||||
cbinfo->persistent_.Reset();
|
||||
cbinfo->callback_(*cbinfo);
|
||||
delete cbinfo;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template<typename S>
|
||||
WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrap(
|
||||
NAN_WEAK_CALLBACK_DATA_TYPE_ data) {
|
||||
void *parameter = data.GetParameter();
|
||||
WeakCallbackInfo<T> *cbinfo =
|
||||
static_cast<WeakCallbackInfo<T>*>(parameter);
|
||||
cbinfo->isolate_ = data.GetIsolate();
|
||||
return cbinfo;
|
||||
}
|
||||
|
||||
#undef NAN_WEAK_CALLBACK_SIG_
|
||||
#undef NAN_WEAK_CALLBACK_DATA_TYPE_
|
||||
#else
|
||||
|
||||
template<typename T>
|
||||
void WeakCallbackInfo<T>::invoke(NAN_WEAK_CALLBACK_SIG_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo = unwrap(data);
|
||||
cbinfo->persistent_.Dispose();
|
||||
cbinfo->persistent_.Clear();
|
||||
cbinfo->callback_(*cbinfo);
|
||||
delete cbinfo;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
WeakCallbackInfo<T> *WeakCallbackInfo<T>::unwrap(
|
||||
NAN_WEAK_CALLBACK_DATA_TYPE_ data) {
|
||||
WeakCallbackInfo<T> *cbinfo =
|
||||
static_cast<WeakCallbackInfo<T>*>(data);
|
||||
cbinfo->isolate_ = v8::Isolate::GetCurrent();
|
||||
return cbinfo;
|
||||
}
|
||||
|
||||
#undef NAN_WEAK_CALLBACK_SIG_
|
||||
#undef NAN_WEAK_CALLBACK_DATA_TYPE_
|
||||
#endif
|
||||
|
||||
#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
template<typename T, typename M>
|
||||
template<typename P>
|
||||
inline void Persistent<T, M>::SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
WeakCallbackInfo<P> *wcbd;
|
||||
if (type == WeakCallbackType::kParameter) {
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, parameter);
|
||||
v8::PersistentBase<T>::SetWeak(
|
||||
wcbd
|
||||
, WeakCallbackInfo<P>::template invokeparameter<true>
|
||||
, type);
|
||||
} else {
|
||||
v8::Local<T>* self = reinterpret_cast<v8::Local<T>*>(this);
|
||||
assert((*self)->IsObject());
|
||||
int count = (*self)->InternalFieldCount();
|
||||
void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
|
||||
for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
|
||||
internal_fields[i] = (*self)->GetAlignedPointerFromInternalField(i);
|
||||
}
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, 0
|
||||
, internal_fields[0]
|
||||
, internal_fields[1]);
|
||||
(*self)->SetAlignedPointerInInternalField(0, wcbd);
|
||||
v8::PersistentBase<T>::SetWeak(
|
||||
static_cast<WeakCallbackInfo<P>*>(0)
|
||||
, WeakCallbackInfo<P>::template invoketwofield<true>
|
||||
, type);
|
||||
}
|
||||
}
|
||||
#elif NODE_MODULE_VERSION > IOJS_1_1_MODULE_VERSION
|
||||
template<typename T, typename M>
|
||||
template<typename P>
|
||||
inline void Persistent<T, M>::SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
WeakCallbackInfo<P> *wcbd;
|
||||
if (type == WeakCallbackType::kParameter) {
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, parameter);
|
||||
v8::PersistentBase<T>::SetPhantom(
|
||||
wcbd
|
||||
, WeakCallbackInfo<P>::invokeparameter);
|
||||
} else {
|
||||
v8::Local<T>* self = reinterpret_cast<v8::Local<T>*>(this);
|
||||
assert((*self)->IsObject());
|
||||
int count = (*self)->InternalFieldCount();
|
||||
void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
|
||||
for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
|
||||
internal_fields[i] = (*self)->GetAlignedPointerFromInternalField(i);
|
||||
}
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, 0
|
||||
, internal_fields[0]
|
||||
, internal_fields[1]);
|
||||
(*self)->SetAlignedPointerInInternalField(0, wcbd);
|
||||
v8::PersistentBase<T>::SetPhantom(
|
||||
static_cast<WeakCallbackInfo<P>*>(0)
|
||||
, WeakCallbackInfo<P>::invoketwofield
|
||||
, 0
|
||||
, count > 1 ? 1 : kNoInternalFieldIndex);
|
||||
}
|
||||
}
|
||||
#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
template<typename T, typename M>
|
||||
template<typename P>
|
||||
inline void Persistent<T, M>::SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
WeakCallbackInfo<P> *wcbd;
|
||||
if (type == WeakCallbackType::kParameter) {
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, parameter);
|
||||
v8::PersistentBase<T>::SetPhantom(
|
||||
wcbd
|
||||
, WeakCallbackInfo<P>::invokeparameter);
|
||||
} else {
|
||||
v8::Local<T>* self = reinterpret_cast<v8::Local<T>*>(this);
|
||||
assert((*self)->IsObject());
|
||||
int count = (*self)->InternalFieldCount();
|
||||
void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
|
||||
for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
|
||||
internal_fields[i] = (*self)->GetAlignedPointerFromInternalField(i);
|
||||
}
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, 0
|
||||
, internal_fields[0]
|
||||
, internal_fields[1]);
|
||||
(*self)->SetAlignedPointerInInternalField(0, wcbd);
|
||||
v8::PersistentBase<T>::SetPhantom(
|
||||
WeakCallbackInfo<P>::invoketwofield
|
||||
, 0
|
||||
, count > 1 ? 1 : kNoInternalFieldIndex);
|
||||
}
|
||||
}
|
||||
#elif NODE_MODULE_VERSION > NODE_0_10_MODULE_VERSION
|
||||
template<typename T, typename M>
|
||||
template<typename P>
|
||||
inline void Persistent<T, M>::SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
WeakCallbackInfo<P> *wcbd;
|
||||
if (type == WeakCallbackType::kParameter) {
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, parameter);
|
||||
v8::PersistentBase<T>::SetWeak(wcbd, WeakCallbackInfo<P>::invoke);
|
||||
} else {
|
||||
v8::Local<T>* self = reinterpret_cast<v8::Local<T>*>(this);
|
||||
assert((*self)->IsObject());
|
||||
int count = (*self)->InternalFieldCount();
|
||||
void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
|
||||
for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
|
||||
internal_fields[i] = (*self)->GetAlignedPointerFromInternalField(i);
|
||||
}
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, 0
|
||||
, internal_fields[0]
|
||||
, internal_fields[1]);
|
||||
v8::PersistentBase<T>::SetWeak(wcbd, WeakCallbackInfo<P>::invoke);
|
||||
}
|
||||
}
|
||||
#else
|
||||
template<typename T>
|
||||
template<typename P>
|
||||
inline void PersistentBase<T>::SetWeak(
|
||||
P *parameter
|
||||
, typename WeakCallbackInfo<P>::Callback callback
|
||||
, WeakCallbackType type) {
|
||||
WeakCallbackInfo<P> *wcbd;
|
||||
if (type == WeakCallbackType::kParameter) {
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, parameter);
|
||||
persistent.MakeWeak(wcbd, WeakCallbackInfo<P>::invoke);
|
||||
} else {
|
||||
v8::Local<T>* self = reinterpret_cast<v8::Local<T>*>(this);
|
||||
assert((*self)->IsObject());
|
||||
int count = (*self)->InternalFieldCount();
|
||||
void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0};
|
||||
for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) {
|
||||
internal_fields[i] = (*self)->GetPointerFromInternalField(i);
|
||||
}
|
||||
wcbd = new WeakCallbackInfo<P>(
|
||||
reinterpret_cast<Persistent<v8::Value>*>(this)
|
||||
, callback
|
||||
, 0
|
||||
, internal_fields[0]
|
||||
, internal_fields[1]);
|
||||
persistent.MakeWeak(wcbd, WeakCallbackInfo<P>::invoke);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // NAN_WEAK_H_
|
||||
21
node_modules/libxmljs/node_modules/nan/package.json
generated
vendored
Normal file
21
node_modules/libxmljs/node_modules/nan/package.json
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "nan",
|
||||
"version": "2.10.0",
|
||||
"description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 9 compatibility",
|
||||
"main": "include_dirs.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nodejs/nan.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"bindings": "~1.2.1",
|
||||
"commander": "^2.8.1",
|
||||
"glob": "^5.0.14",
|
||||
"request": "=2.81.0",
|
||||
"node-gyp": "~3.6.2",
|
||||
"readable-stream": "^2.1.4",
|
||||
"tap": "~0.7.1",
|
||||
"xtend": "~4.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
412
node_modules/libxmljs/node_modules/nan/tools/1to2.js
generated
vendored
Executable file
412
node_modules/libxmljs/node_modules/nan/tools/1to2.js
generated
vendored
Executable file
@@ -0,0 +1,412 @@
|
||||
#!/usr/bin/env node
|
||||
/*********************************************************************
|
||||
* NAN - Native Abstractions for Node.js
|
||||
*
|
||||
* Copyright (c) 2018 NAN contributors
|
||||
*
|
||||
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
|
||||
********************************************************************/
|
||||
|
||||
var commander = require('commander'),
|
||||
fs = require('fs'),
|
||||
glob = require('glob'),
|
||||
groups = [],
|
||||
total = 0,
|
||||
warning1 = '/* ERROR: Rewrite using Buffer */\n',
|
||||
warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n',
|
||||
length,
|
||||
i;
|
||||
|
||||
fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
commander
|
||||
.version(JSON.parse(data).version)
|
||||
.usage('[options] <file ...>')
|
||||
.parse(process.argv);
|
||||
|
||||
if (!process.argv.slice(2).length) {
|
||||
commander.outputHelp();
|
||||
}
|
||||
});
|
||||
|
||||
/* construct strings representing regular expressions
|
||||
each expression contains a unique group allowing for identification of the match
|
||||
the index of this key group, relative to the regular expression in question,
|
||||
is indicated by the first array member */
|
||||
|
||||
/* simple substistutions, key group is the entire match, 0 */
|
||||
groups.push([0, [
|
||||
'_NAN_',
|
||||
'NODE_SET_METHOD',
|
||||
'NODE_SET_PROTOTYPE_METHOD',
|
||||
'NanAsciiString',
|
||||
'NanEscapeScope',
|
||||
'NanReturnValue',
|
||||
'NanUcs2String'].join('|')]);
|
||||
|
||||
/* substitutions of parameterless macros, key group is 1 */
|
||||
groups.push([1, ['(', [
|
||||
'NanEscapableScope',
|
||||
'NanReturnNull',
|
||||
'NanReturnUndefined',
|
||||
'NanScope'].join('|'), ')\\(\\)'].join('')]);
|
||||
|
||||
/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */
|
||||
groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']);
|
||||
|
||||
/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */
|
||||
groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]);
|
||||
|
||||
/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */
|
||||
groups.push([2, ['(', warning2, ')?', '^.*?(', [
|
||||
'GetIndexedPropertiesExternalArrayDataLength',
|
||||
'GetIndexedPropertiesExternalArrayData',
|
||||
'GetIndexedPropertiesExternalArrayDataType',
|
||||
'GetIndexedPropertiesPixelData',
|
||||
'GetIndexedPropertiesPixelDataLength',
|
||||
'HasIndexedPropertiesInExternalArrayData',
|
||||
'HasIndexedPropertiesInPixelData',
|
||||
'SetIndexedPropertiesToExternalArrayData',
|
||||
'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]);
|
||||
|
||||
/* No need for NanScope in V8-exposed methods, key group 2 */
|
||||
groups.push([2, ['((', [
|
||||
'NAN_METHOD',
|
||||
'NAN_GETTER',
|
||||
'NAN_SETTER',
|
||||
'NAN_PROPERTY_GETTER',
|
||||
'NAN_PROPERTY_SETTER',
|
||||
'NAN_PROPERTY_ENUMERATOR',
|
||||
'NAN_PROPERTY_DELETER',
|
||||
'NAN_PROPERTY_QUERY',
|
||||
'NAN_INDEX_GETTER',
|
||||
'NAN_INDEX_SETTER',
|
||||
'NAN_INDEX_ENUMERATOR',
|
||||
'NAN_INDEX_DELETER',
|
||||
'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]);
|
||||
|
||||
/* v8::Value::ToXXXXXXX returns v8::MaybeLocal<T>, key group 3 */
|
||||
groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [
|
||||
'Boolean',
|
||||
'Number',
|
||||
'String',
|
||||
'Object',
|
||||
'Integer',
|
||||
'Uint32',
|
||||
'Int32'].join('|'), ')\\('].join('')]);
|
||||
|
||||
/* v8::Value::XXXXXXXValue returns v8::Maybe<T>, key group 3 */
|
||||
groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [
|
||||
'Boolean',
|
||||
'Number',
|
||||
'Integer',
|
||||
'Uint32',
|
||||
'Int32'].join('|'), ')Value)\\('].join('')]);
|
||||
|
||||
/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */
|
||||
groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']);
|
||||
|
||||
/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */
|
||||
groups.push([1, ['(', [
|
||||
'NanDisposePersistent',
|
||||
'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]);
|
||||
|
||||
/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */
|
||||
groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']);
|
||||
|
||||
/* Many methods of v8::Object and others now return v8::MaybeLocal<T>, key group 3 */
|
||||
groups.push([3, ['([\\s])([^\\s]+)->(', [
|
||||
'GetEndColumn',
|
||||
'GetFunction',
|
||||
'GetLineNumber',
|
||||
'NewInstance',
|
||||
'GetPropertyNames',
|
||||
'GetOwnPropertyNames',
|
||||
'GetSourceLine',
|
||||
'GetStartColumn',
|
||||
'ObjectProtoToString',
|
||||
'ToArrayIndex',
|
||||
'ToDetailString',
|
||||
'CallAsConstructor',
|
||||
'CallAsFunction',
|
||||
'CloneElementAt',
|
||||
'Delete',
|
||||
'ForceSet',
|
||||
'Get',
|
||||
'GetPropertyAttributes',
|
||||
'GetRealNamedProperty',
|
||||
'GetRealNamedPropertyInPrototypeChain',
|
||||
'Has',
|
||||
'HasOwnProperty',
|
||||
'HasRealIndexedProperty',
|
||||
'HasRealNamedCallbackProperty',
|
||||
'HasRealNamedProperty',
|
||||
'Set',
|
||||
'SetAccessor',
|
||||
'SetIndexedPropertyHandler',
|
||||
'SetNamedPropertyHandler',
|
||||
'SetPrototype'].join('|'), ')\\('].join('')]);
|
||||
|
||||
/* You should get an error if any of these fail anyways,
|
||||
or handle the error better, it is indicated either way, key group 2 */
|
||||
groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]);
|
||||
|
||||
/* v8::Value::Equals now returns a v8::Maybe, key group 3 */
|
||||
groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']);
|
||||
|
||||
/* NanPersistent makes this unnecessary, key group 1 */
|
||||
groups.push([1, '(NanAssignPersistent)(?:<v8\\:\\:[^>]+>)?\\(([^,]+),\\s*']);
|
||||
|
||||
/* args has been renamed to info, key group 2 */
|
||||
groups.push([2, '(\\W)(args)(\\W)'])
|
||||
|
||||
/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */
|
||||
groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']);
|
||||
|
||||
/* v8::Persistent was replaced with NanPersistent, key group 2 */
|
||||
groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']);
|
||||
|
||||
/* counts the number of capturing groups in a well-formed regular expression,
|
||||
ignoring non-capturing groups and escaped parentheses */
|
||||
function groupcount(s) {
|
||||
var positive = s.match(/\((?!\?)/g),
|
||||
negative = s.match(/\\\(/g);
|
||||
return (positive ? positive.length : 0) - (negative ? negative.length : 0);
|
||||
}
|
||||
|
||||
/* compute the absolute position of each key group in the joined master RegExp */
|
||||
for (i = 1, length = groups.length; i < length; i++) {
|
||||
total += groupcount(groups[i - 1][1]);
|
||||
groups[i][0] += total;
|
||||
}
|
||||
|
||||
/* create the master RegExp, whis is the union of all the groups' expressions */
|
||||
master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm');
|
||||
|
||||
/* replacement function for String.replace, receives 21 arguments */
|
||||
function replace() {
|
||||
/* simple expressions */
|
||||
switch (arguments[groups[0][0]]) {
|
||||
case '_NAN_':
|
||||
return 'NAN_';
|
||||
case 'NODE_SET_METHOD':
|
||||
return 'NanSetMethod';
|
||||
case 'NODE_SET_PROTOTYPE_METHOD':
|
||||
return 'NanSetPrototypeMethod';
|
||||
case 'NanAsciiString':
|
||||
return 'NanUtf8String';
|
||||
case 'NanEscapeScope':
|
||||
return 'scope.Escape';
|
||||
case 'NanReturnNull':
|
||||
return 'info.GetReturnValue().SetNull';
|
||||
case 'NanReturnValue':
|
||||
return 'info.GetReturnValue().Set';
|
||||
case 'NanUcs2String':
|
||||
return 'v8::String::Value';
|
||||
default:
|
||||
}
|
||||
|
||||
/* macros without arguments */
|
||||
switch (arguments[groups[1][0]]) {
|
||||
case 'NanEscapableScope':
|
||||
return 'NanEscapableScope scope'
|
||||
case 'NanReturnUndefined':
|
||||
return 'return';
|
||||
case 'NanScope':
|
||||
return 'NanScope scope';
|
||||
default:
|
||||
}
|
||||
|
||||
/* TryCatch, emulate negative backref */
|
||||
if (arguments[groups[2][0]] === 'TryCatch') {
|
||||
return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch';
|
||||
}
|
||||
|
||||
/* NanNew("foo") --> NanNew("foo").ToLocalChecked() */
|
||||
if (arguments[groups[3][0]] === 'NanNew') {
|
||||
return [arguments[0], '.ToLocalChecked()'].join('');
|
||||
}
|
||||
|
||||
/* insert warning for removed functions as comment on new line above */
|
||||
switch (arguments[groups[4][0]]) {
|
||||
case 'GetIndexedPropertiesExternalArrayData':
|
||||
case 'GetIndexedPropertiesExternalArrayDataLength':
|
||||
case 'GetIndexedPropertiesExternalArrayDataType':
|
||||
case 'GetIndexedPropertiesPixelData':
|
||||
case 'GetIndexedPropertiesPixelDataLength':
|
||||
case 'HasIndexedPropertiesInExternalArrayData':
|
||||
case 'HasIndexedPropertiesInPixelData':
|
||||
case 'SetIndexedPropertiesToExternalArrayData':
|
||||
case 'SetIndexedPropertiesToPixelData':
|
||||
return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join('');
|
||||
default:
|
||||
}
|
||||
|
||||
/* remove unnecessary NanScope() */
|
||||
switch (arguments[groups[5][0]]) {
|
||||
case 'NAN_GETTER':
|
||||
case 'NAN_METHOD':
|
||||
case 'NAN_SETTER':
|
||||
case 'NAN_INDEX_DELETER':
|
||||
case 'NAN_INDEX_ENUMERATOR':
|
||||
case 'NAN_INDEX_GETTER':
|
||||
case 'NAN_INDEX_QUERY':
|
||||
case 'NAN_INDEX_SETTER':
|
||||
case 'NAN_PROPERTY_DELETER':
|
||||
case 'NAN_PROPERTY_ENUMERATOR':
|
||||
case 'NAN_PROPERTY_GETTER':
|
||||
case 'NAN_PROPERTY_QUERY':
|
||||
case 'NAN_PROPERTY_SETTER':
|
||||
return arguments[groups[5][0] - 1];
|
||||
default:
|
||||
}
|
||||
|
||||
/* Value converstion */
|
||||
switch (arguments[groups[6][0]]) {
|
||||
case 'Boolean':
|
||||
case 'Int32':
|
||||
case 'Integer':
|
||||
case 'Number':
|
||||
case 'Object':
|
||||
case 'String':
|
||||
case 'Uint32':
|
||||
return [arguments[groups[6][0] - 2], 'NanTo<v8::', arguments[groups[6][0]], '>(', arguments[groups[6][0] - 1]].join('');
|
||||
default:
|
||||
}
|
||||
|
||||
/* other value conversion */
|
||||
switch (arguments[groups[7][0]]) {
|
||||
case 'BooleanValue':
|
||||
return [arguments[groups[7][0] - 2], 'NanTo<bool>(', arguments[groups[7][0] - 1]].join('');
|
||||
case 'Int32Value':
|
||||
return [arguments[groups[7][0] - 2], 'NanTo<int32_t>(', arguments[groups[7][0] - 1]].join('');
|
||||
case 'IntegerValue':
|
||||
return [arguments[groups[7][0] - 2], 'NanTo<int64_t>(', arguments[groups[7][0] - 1]].join('');
|
||||
case 'Uint32Value':
|
||||
return [arguments[groups[7][0] - 2], 'NanTo<uint32_t>(', arguments[groups[7][0] - 1]].join('');
|
||||
default:
|
||||
}
|
||||
|
||||
/* NAN_WEAK_CALLBACK */
|
||||
if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') {
|
||||
return ['template<typename T>\nvoid ',
|
||||
arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo<T> &data)'].join('');
|
||||
}
|
||||
|
||||
/* use methods on NAN classes instead */
|
||||
switch (arguments[groups[9][0]]) {
|
||||
case 'NanDisposePersistent':
|
||||
return [arguments[groups[9][0] + 1], '.Reset('].join('');
|
||||
case 'NanObjectWrapHandle':
|
||||
return [arguments[groups[9][0] + 1], '->handle('].join('');
|
||||
default:
|
||||
}
|
||||
|
||||
/* use method on NanPersistent instead */
|
||||
if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') {
|
||||
return arguments[groups[10][0] + 1] + '.SetWeak(';
|
||||
}
|
||||
|
||||
/* These return Maybes, the upper ones take no arguments */
|
||||
switch (arguments[groups[11][0]]) {
|
||||
case 'GetEndColumn':
|
||||
case 'GetFunction':
|
||||
case 'GetLineNumber':
|
||||
case 'GetOwnPropertyNames':
|
||||
case 'GetPropertyNames':
|
||||
case 'GetSourceLine':
|
||||
case 'GetStartColumn':
|
||||
case 'NewInstance':
|
||||
case 'ObjectProtoToString':
|
||||
case 'ToArrayIndex':
|
||||
case 'ToDetailString':
|
||||
return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join('');
|
||||
case 'CallAsConstructor':
|
||||
case 'CallAsFunction':
|
||||
case 'CloneElementAt':
|
||||
case 'Delete':
|
||||
case 'ForceSet':
|
||||
case 'Get':
|
||||
case 'GetPropertyAttributes':
|
||||
case 'GetRealNamedProperty':
|
||||
case 'GetRealNamedPropertyInPrototypeChain':
|
||||
case 'Has':
|
||||
case 'HasOwnProperty':
|
||||
case 'HasRealIndexedProperty':
|
||||
case 'HasRealNamedCallbackProperty':
|
||||
case 'HasRealNamedProperty':
|
||||
case 'Set':
|
||||
case 'SetAccessor':
|
||||
case 'SetIndexedPropertyHandler':
|
||||
case 'SetNamedPropertyHandler':
|
||||
case 'SetPrototype':
|
||||
return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join('');
|
||||
default:
|
||||
}
|
||||
|
||||
/* Automatic ToLocalChecked(), take it or leave it */
|
||||
switch (arguments[groups[12][0]]) {
|
||||
case 'Date':
|
||||
case 'String':
|
||||
case 'RegExp':
|
||||
return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join('');
|
||||
default:
|
||||
}
|
||||
|
||||
/* NanEquals is now required for uniformity */
|
||||
if (arguments[groups[13][0]] === 'Equals') {
|
||||
return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join('');
|
||||
}
|
||||
|
||||
/* use method on replacement class instead */
|
||||
if (arguments[groups[14][0]] === 'NanAssignPersistent') {
|
||||
return [arguments[groups[14][0] + 1], '.Reset('].join('');
|
||||
}
|
||||
|
||||
/* args --> info */
|
||||
if (arguments[groups[15][0]] === 'args') {
|
||||
return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join('');
|
||||
}
|
||||
|
||||
/* ObjectWrap --> NanObjectWrap */
|
||||
if (arguments[groups[16][0]] === 'ObjectWrap') {
|
||||
return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join('');
|
||||
}
|
||||
|
||||
/* Persistent --> NanPersistent */
|
||||
if (arguments[groups[17][0]] === 'Persistent') {
|
||||
return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join('');
|
||||
}
|
||||
|
||||
/* This should not happen. A switch is probably missing a case if it does. */
|
||||
throw 'Unhandled match: ' + arguments[0];
|
||||
}
|
||||
|
||||
/* reads a file, runs replacement and writes it back */
|
||||
function processFile(file) {
|
||||
fs.readFile(file, {encoding: 'utf8'}, function (err, data) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
/* run replacement twice, might need more runs */
|
||||
fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/* process file names from command line and process the identified files */
|
||||
for (i = 2, length = process.argv.length; i < length; i++) {
|
||||
glob(process.argv[i], function (err, matches) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
matches.forEach(processFile);
|
||||
});
|
||||
}
|
||||
15
node_modules/libxmljs/node_modules/nan/tools/package.json
generated
vendored
Normal file
15
node_modules/libxmljs/node_modules/nan/tools/package.json
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "1to2",
|
||||
"version": "1.0.0",
|
||||
"description": "NAN 1 -> 2 Migration Script",
|
||||
"main": "1to2.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/nodejs/nan.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": "~5.0.10",
|
||||
"commander": "~2.8.1"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
27
node_modules/libxmljs/node_modules/node-pre-gyp/LICENSE
generated
vendored
Normal file
27
node_modules/libxmljs/node_modules/node-pre-gyp/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright (c), Mapbox
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of node-pre-gyp nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
134
node_modules/libxmljs/node_modules/node-pre-gyp/bin/node-pre-gyp
generated
vendored
Executable file
134
node_modules/libxmljs/node_modules/node-pre-gyp/bin/node-pre-gyp
generated
vendored
Executable file
@@ -0,0 +1,134 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Set the title.
|
||||
*/
|
||||
|
||||
process.title = 'node-pre-gyp';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var node_pre_gyp = require('../');
|
||||
var log = require('npmlog');
|
||||
|
||||
/**
|
||||
* Process and execute the selected commands.
|
||||
*/
|
||||
|
||||
var prog = new node_pre_gyp.Run();
|
||||
var completed = false;
|
||||
prog.parseArgv(process.argv);
|
||||
|
||||
if (prog.todo.length === 0) {
|
||||
if (~process.argv.indexOf('-v') || ~process.argv.indexOf('--version')) {
|
||||
console.log('v%s', prog.version);
|
||||
return process.exit(0);
|
||||
} else if (~process.argv.indexOf('-h') || ~process.argv.indexOf('--help')) {
|
||||
console.log('%s', prog.usage());
|
||||
return process.exit(0);
|
||||
}
|
||||
console.log('%s', prog.usage());
|
||||
return process.exit(1);
|
||||
}
|
||||
|
||||
// if --no-color is passed
|
||||
if (prog.opts && prog.opts.hasOwnProperty('color') && !prog.opts.color) {
|
||||
log.disableColor();
|
||||
}
|
||||
|
||||
log.info('it worked if it ends with', 'ok');
|
||||
log.verbose('cli', process.argv);
|
||||
log.info('using', process.title + '@%s', prog.version);
|
||||
log.info('using', 'node@%s | %s | %s', process.versions.node, process.platform, process.arch);
|
||||
|
||||
|
||||
/**
|
||||
* Change dir if -C/--directory was passed.
|
||||
*/
|
||||
|
||||
var dir = prog.opts.directory;
|
||||
if (dir) {
|
||||
var fs = require('fs');
|
||||
try {
|
||||
var stat = fs.statSync(dir);
|
||||
if (stat.isDirectory()) {
|
||||
log.info('chdir', dir);
|
||||
process.chdir(dir);
|
||||
} else {
|
||||
log.warn('chdir', dir + ' is not a directory');
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
log.warn('chdir', dir + ' is not a directory');
|
||||
} else {
|
||||
log.warn('chdir', 'error during chdir() "%s"', e.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function run () {
|
||||
var command = prog.todo.shift();
|
||||
if (!command) {
|
||||
// done!
|
||||
completed = true;
|
||||
log.info('ok');
|
||||
return;
|
||||
}
|
||||
|
||||
prog.commands[command.name](command.args, function (err) {
|
||||
if (err) {
|
||||
log.error(command.name + ' error');
|
||||
log.error('stack', err.stack);
|
||||
errorMessage();
|
||||
log.error('not ok');
|
||||
console.log(err.message);
|
||||
return process.exit(1);
|
||||
}
|
||||
var args_array = [].slice.call(arguments, 1);
|
||||
if (args_array.length) {
|
||||
console.log.apply(console, args_array);
|
||||
}
|
||||
// now run the next command in the queue
|
||||
process.nextTick(run);
|
||||
});
|
||||
}
|
||||
|
||||
process.on('exit', function (code) {
|
||||
if (!completed && !code) {
|
||||
log.error('Completion callback never invoked!');
|
||||
issueMessage();
|
||||
process.exit(6);
|
||||
}
|
||||
});
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
log.error('UNCAUGHT EXCEPTION');
|
||||
log.error('stack', err.stack);
|
||||
issueMessage();
|
||||
process.exit(7);
|
||||
});
|
||||
|
||||
function errorMessage () {
|
||||
// copied from npm's lib/util/error-handler.js
|
||||
var os = require('os');
|
||||
log.error('System', os.type() + ' ' + os.release());
|
||||
log.error('command', process.argv.map(JSON.stringify).join(' '));
|
||||
log.error('cwd', process.cwd());
|
||||
log.error('node -v', process.version);
|
||||
log.error(process.title+' -v', 'v' + prog.package.version);
|
||||
}
|
||||
|
||||
function issueMessage () {
|
||||
errorMessage();
|
||||
log.error('', [ 'This is a bug in `'+process.title+'`.',
|
||||
'Try to update '+process.title+' and file an issue if it does not help:',
|
||||
' <https://github.com/mapbox/'+process.title+'/issues>',
|
||||
].join('\n'));
|
||||
}
|
||||
|
||||
// start running the given commands!
|
||||
run();
|
||||
2
node_modules/libxmljs/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd
generated
vendored
Normal file
2
node_modules/libxmljs/node_modules/node-pre-gyp/bin/node-pre-gyp.cmd
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
node "%~dp0\node-pre-gyp" %*
|
||||
51
node_modules/libxmljs/node_modules/node-pre-gyp/lib/build.js
generated
vendored
Normal file
51
node_modules/libxmljs/node_modules/node-pre-gyp/lib/build.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = build;
|
||||
|
||||
exports.usage = 'Attempts to compile the module by dispatching to node-gyp or nw-gyp';
|
||||
|
||||
var napi = require('./util/napi.js');
|
||||
var compile = require('./util/compile.js');
|
||||
var handle_gyp_opts = require('./util/handle_gyp_opts.js');
|
||||
var configure = require('./configure.js');
|
||||
|
||||
function do_build(gyp,argv,callback) {
|
||||
handle_gyp_opts(gyp,argv,function(err,result) {
|
||||
var final_args = ['build'].concat(result.gyp).concat(result.pre);
|
||||
if (result.unparsed.length > 0) {
|
||||
final_args = final_args.
|
||||
concat(['--']).
|
||||
concat(result.unparsed);
|
||||
}
|
||||
if (!err && result.opts.napi_build_version) {
|
||||
napi.swap_build_dir_in(result.opts.napi_build_version);
|
||||
}
|
||||
compile.run_gyp(final_args,result.opts,function(err) {
|
||||
if (!err && result.opts.napi_build_version) {
|
||||
napi.swap_build_dir_out(result.opts.napi_build_version);
|
||||
}
|
||||
return callback(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function build(gyp, argv, callback) {
|
||||
|
||||
// Form up commands to pass to node-gyp:
|
||||
// We map `node-pre-gyp build` to `node-gyp configure build` so that we do not
|
||||
// trigger a clean and therefore do not pay the penalty of a full recompile
|
||||
if (argv.length && (argv.indexOf('rebuild') > -1)) {
|
||||
argv.shift(); // remove `rebuild`
|
||||
// here we map `node-pre-gyp rebuild` to `node-gyp rebuild` which internally means
|
||||
// "clean + configure + build" and triggers a full recompile
|
||||
compile.run_gyp(['clean'],{},function(err) {
|
||||
if (err) return callback(err);
|
||||
configure(gyp,argv,function(err) {
|
||||
if (err) return callback(err);
|
||||
return do_build(gyp,argv,callback);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
return do_build(gyp,argv,callback);
|
||||
}
|
||||
}
|
||||
32
node_modules/libxmljs/node_modules/node-pre-gyp/lib/clean.js
generated
vendored
Normal file
32
node_modules/libxmljs/node_modules/node-pre-gyp/lib/clean.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = clean;
|
||||
|
||||
exports.usage = 'Removes the entire folder containing the compiled .node module';
|
||||
|
||||
var fs = require('fs');
|
||||
var rm = require('rimraf');
|
||||
var exists = require('fs').exists || require('path').exists;
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var path = require('path');
|
||||
|
||||
function clean (gyp, argv, callback) {
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
var to_delete = opts.module_path;
|
||||
if (!to_delete) {
|
||||
return callback(new Error("module_path is empty, refusing to delete"));
|
||||
} else if (path.normalize(to_delete) == path.normalize(process.cwd())) {
|
||||
return callback(new Error("module_path is not set, refusing to delete"));
|
||||
} else {
|
||||
exists(to_delete, function(found) {
|
||||
if (found) {
|
||||
if (!gyp.opts.silent_clean) console.log('['+package_json.name+'] Removing "%s"', to_delete);
|
||||
return rm(to_delete, callback);
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
}
|
||||
52
node_modules/libxmljs/node_modules/node-pre-gyp/lib/configure.js
generated
vendored
Normal file
52
node_modules/libxmljs/node_modules/node-pre-gyp/lib/configure.js
generated
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = configure;
|
||||
|
||||
exports.usage = 'Attempts to configure node-gyp or nw-gyp build';
|
||||
|
||||
var napi = require('./util/napi.js');
|
||||
var compile = require('./util/compile.js');
|
||||
var handle_gyp_opts = require('./util/handle_gyp_opts.js');
|
||||
|
||||
function configure(gyp, argv, callback) {
|
||||
handle_gyp_opts(gyp,argv,function(err,result) {
|
||||
var final_args = result.gyp.concat(result.pre);
|
||||
// pull select node-gyp configure options out of the npm environ
|
||||
var known_gyp_args = ['dist-url','python','nodedir','msvs_version'];
|
||||
known_gyp_args.forEach(function(key) {
|
||||
var val = gyp.opts[key] || gyp.opts[key.replace('-','_')];
|
||||
if (val) {
|
||||
final_args.push('--'+key+'='+val);
|
||||
}
|
||||
});
|
||||
// --ensure=false tell node-gyp to re-install node development headers
|
||||
// but it is only respected by node-gyp install, so we have to call install
|
||||
// as a separate step if the user passes it
|
||||
if (gyp.opts.ensure === false) {
|
||||
var install_args = final_args.concat(['install','--ensure=false']);
|
||||
compile.run_gyp(install_args,result.opts,function(err) {
|
||||
if (err) return callback(err);
|
||||
if (result.unparsed.length > 0) {
|
||||
final_args = final_args.
|
||||
concat(['--']).
|
||||
concat(result.unparsed);
|
||||
}
|
||||
compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) {
|
||||
return callback(err);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
if (result.unparsed.length > 0) {
|
||||
final_args = final_args.
|
||||
concat(['--']).
|
||||
concat(result.unparsed);
|
||||
}
|
||||
compile.run_gyp(['configure'].concat(final_args),result.opts,function(err) {
|
||||
if (!err && result.opts.napi_build_version) {
|
||||
napi.swap_build_dir_out(result.opts.napi_build_version);
|
||||
}
|
||||
return callback(err);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
40
node_modules/libxmljs/node_modules/node-pre-gyp/lib/info.js
generated
vendored
Normal file
40
node_modules/libxmljs/node_modules/node-pre-gyp/lib/info.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = unpublish;
|
||||
|
||||
exports.usage = 'Lists all published binaries (requires aws-sdk)';
|
||||
|
||||
var fs = require('fs');
|
||||
var log = require('npmlog');
|
||||
var versioning = require('./util/versioning.js');
|
||||
var s3_setup = require('./util/s3_setup.js');
|
||||
var config = require('rc')("node_pre_gyp",{acl:"public-read"});
|
||||
|
||||
function unpublish(gyp, argv, callback) {
|
||||
var AWS = require("aws-sdk");
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var opts = versioning.evaluate(package_json, gyp.opts);
|
||||
s3_setup.detect(opts.hosted_path,config);
|
||||
AWS.config.update(config);
|
||||
var s3 = new AWS.S3();
|
||||
var s3_opts = { Bucket: config.bucket,
|
||||
Prefix: config.prefix
|
||||
};
|
||||
s3.listObjects(s3_opts, function(err, meta){
|
||||
if (err && err.code == 'NotFound') {
|
||||
return callback(new Error('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix));
|
||||
} else if(err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
log.verbose(JSON.stringify(meta,null,1));
|
||||
if (meta && meta.Contents) {
|
||||
meta.Contents.forEach(function(obj) {
|
||||
console.log(obj.Key);
|
||||
});
|
||||
} else {
|
||||
console.error('['+package_json.name+'] No objects found at https://' + s3_opts.Bucket + '.s3.amazonaws.com/'+config.prefix );
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
221
node_modules/libxmljs/node_modules/node-pre-gyp/lib/install.js
generated
vendored
Normal file
221
node_modules/libxmljs/node_modules/node-pre-gyp/lib/install.js
generated
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = install;
|
||||
|
||||
exports.usage = 'Attempts to install pre-built binary for module';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var log = require('npmlog');
|
||||
var existsAsync = fs.exists || path.exists;
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
var npgVersion = 'unknown';
|
||||
try {
|
||||
// Read own package.json to get the current node-pre-pyp version.
|
||||
var ownPackageJSON = fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8');
|
||||
npgVersion = JSON.parse(ownPackageJSON).version;
|
||||
} catch (e) {}
|
||||
|
||||
function download(uri,opts,callback) {
|
||||
log.http('GET', uri);
|
||||
|
||||
var req = null;
|
||||
|
||||
// Try getting version info from the currently running npm.
|
||||
var envVersionInfo = process.env.npm_config_user_agent ||
|
||||
'node ' + process.version;
|
||||
|
||||
var requestOpts = {
|
||||
uri: uri.replace('+','%2B'),
|
||||
headers: {
|
||||
'User-Agent': 'node-pre-gyp (v' + npgVersion + ', ' + envVersionInfo + ')'
|
||||
},
|
||||
follow_max: 10,
|
||||
};
|
||||
|
||||
if (opts.cafile) {
|
||||
try {
|
||||
requestOpts.ca = fs.readFileSync(opts.cafile);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
} else if (opts.ca) {
|
||||
requestOpts.ca = opts.ca;
|
||||
}
|
||||
|
||||
var proxyUrl = opts.proxy ||
|
||||
process.env.http_proxy ||
|
||||
process.env.HTTP_PROXY ||
|
||||
process.env.npm_config_proxy;
|
||||
if (proxyUrl) {
|
||||
if (/^https?:\/\//i.test(proxyUrl)) {
|
||||
log.verbose('download', 'using proxy url: "%s"', proxyUrl);
|
||||
requestOpts.proxy = proxyUrl;
|
||||
} else {
|
||||
log.warn('download', 'ignoring invalid "proxy" config setting: "%s"', proxyUrl);
|
||||
}
|
||||
}
|
||||
try {
|
||||
req = require('needle').get(requestOpts.uri, requestOpts);
|
||||
} catch (e) {
|
||||
return callback(e);
|
||||
}
|
||||
if (req) {
|
||||
req.on('response', function (res) {
|
||||
log.http(res.statusCode, uri);
|
||||
});
|
||||
}
|
||||
return callback(null,req);
|
||||
}
|
||||
|
||||
function place_binary(from,to,opts,callback) {
|
||||
download(from,opts,function(err,req) {
|
||||
if (err) return callback(err);
|
||||
if (!req) return callback(new Error("empty req"));
|
||||
var badDownload = false;
|
||||
var extractCount = 0;
|
||||
var tar = require('tar');
|
||||
|
||||
function afterTarball(err) {
|
||||
if (err) return callback(err);
|
||||
if (badDownload) return callback(new Error("bad download"));
|
||||
if (extractCount === 0) {
|
||||
return callback(new Error('There was a fatal problem while downloading/extracting the tarball'));
|
||||
}
|
||||
log.info('tarball', 'done parsing tarball');
|
||||
callback();
|
||||
}
|
||||
|
||||
function filter_func(entry) {
|
||||
log.info('install','unpacking ' + entry.path);
|
||||
extractCount++;
|
||||
}
|
||||
|
||||
req.on('error', function(err) {
|
||||
badDownload = true;
|
||||
return callback(err);
|
||||
});
|
||||
|
||||
req.on('close', function () {
|
||||
if (extractCount === 0) {
|
||||
return callback(new Error('Connection closed while downloading tarball file'));
|
||||
}
|
||||
});
|
||||
|
||||
req.on('response', function(res) {
|
||||
// ignore redirects, needle handles these automatically.
|
||||
if (res.headers.hasOwnProperty('location') && res.headers.location !== '') {
|
||||
return;
|
||||
}
|
||||
if (res.statusCode !== 200) {
|
||||
badDownload = true;
|
||||
var err = new Error(res.statusCode + ' status code downloading tarball ' + from);
|
||||
err.statusCode = res.statusCode;
|
||||
return callback(err);
|
||||
}
|
||||
// start unzipping and untaring
|
||||
req.pipe(tar.extract({
|
||||
cwd: to,
|
||||
strip: 1,
|
||||
onentry: filter_func
|
||||
}).on('close', afterTarball).on('error', callback));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function do_build(gyp,argv,callback) {
|
||||
var args = ['rebuild'].concat(argv);
|
||||
gyp.todo.push( { name: 'build', args: args } );
|
||||
process.nextTick(callback);
|
||||
}
|
||||
|
||||
function print_fallback_error(err,opts,package_json) {
|
||||
var fallback_message = ' (falling back to source compile with node-gyp)';
|
||||
var full_message = '';
|
||||
if (err.statusCode !== undefined) {
|
||||
// If we got a network response it but failed to download
|
||||
// it means remote binaries are not available, so let's try to help
|
||||
// the user/developer with the info to debug why
|
||||
full_message = "Pre-built binaries not found for " + package_json.name + "@" + package_json.version;
|
||||
full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
|
||||
full_message += fallback_message;
|
||||
log.error("Tried to download(" + err.statusCode + "): " + opts.hosted_tarball);
|
||||
log.error(full_message);
|
||||
log.http(err.message);
|
||||
} else {
|
||||
// If we do not have a statusCode that means an unexpected error
|
||||
// happened and prevented an http response, so we output the exact error
|
||||
full_message = "Pre-built binaries not installable for " + package_json.name + "@" + package_json.version;
|
||||
full_message += " and " + opts.runtime + "@" + (opts.target || process.versions.node) + " (" + opts.node_abi + " ABI, " + opts.libc + ")";
|
||||
full_message += fallback_message;
|
||||
log.error(full_message);
|
||||
log.error("Hit error " + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
function install(gyp, argv, callback) {
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var source_build = gyp.opts['build-from-source'] || gyp.opts.build_from_source;
|
||||
var update_binary = gyp.opts['update-binary'] || gyp.opts.update_binary;
|
||||
var should_do_source_build = source_build === package_json.name || (source_build === true || source_build === 'true');
|
||||
if (should_do_source_build) {
|
||||
log.info('build','requesting source compile');
|
||||
return do_build(gyp,argv,callback);
|
||||
} else {
|
||||
var fallback_to_build = gyp.opts['fallback-to-build'] || gyp.opts.fallback_to_build;
|
||||
var should_do_fallback_build = fallback_to_build === package_json.name || (fallback_to_build === true || fallback_to_build === 'true');
|
||||
// but allow override from npm
|
||||
if (process.env.npm_config_argv) {
|
||||
var cooked = JSON.parse(process.env.npm_config_argv).cooked;
|
||||
var match = cooked.indexOf("--fallback-to-build");
|
||||
if (match > -1 && cooked.length > match && cooked[match+1] == "false") {
|
||||
should_do_fallback_build = false;
|
||||
log.info('install','Build fallback disabled via npm flag: --fallback-to-build=false');
|
||||
}
|
||||
}
|
||||
var opts;
|
||||
try {
|
||||
opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
} catch (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
opts.ca = gyp.opts.ca;
|
||||
opts.cafile = gyp.opts.cafile;
|
||||
|
||||
var from = opts.hosted_tarball;
|
||||
var to = opts.module_path;
|
||||
var binary_module = path.join(to,opts.module_name + '.node');
|
||||
existsAsync(binary_module,function(found) {
|
||||
if (found && !update_binary) {
|
||||
console.log('['+package_json.name+'] Success: "' + binary_module + '" already installed');
|
||||
console.log('Pass --update-binary to reinstall or --build-from-source to recompile');
|
||||
return callback();
|
||||
} else {
|
||||
if (!update_binary) log.info('check','checked for "' + binary_module + '" (not found)');
|
||||
mkdirp(to,function(err) {
|
||||
if (err) {
|
||||
after_place(err);
|
||||
} else {
|
||||
place_binary(from,to,opts,after_place);
|
||||
}
|
||||
});
|
||||
}
|
||||
function after_place(err) {
|
||||
if (err && should_do_fallback_build) {
|
||||
print_fallback_error(err,opts,package_json);
|
||||
return do_build(gyp,argv,callback);
|
||||
} else if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
console.log('['+package_json.name+'] Success: "' + binary_module + '" is installed via remote');
|
||||
return callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
203
node_modules/libxmljs/node_modules/node-pre-gyp/lib/node-pre-gyp.js
generated
vendored
Normal file
203
node_modules/libxmljs/node_modules/node-pre-gyp/lib/node-pre-gyp.js
generated
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var nopt = require('nopt');
|
||||
var log = require('npmlog');
|
||||
log.disableProgress();
|
||||
var napi = require('./util/napi.js');
|
||||
|
||||
var EE = require('events').EventEmitter;
|
||||
var inherits = require('util').inherits;
|
||||
var commands = [
|
||||
'clean',
|
||||
'install',
|
||||
'reinstall',
|
||||
'build',
|
||||
'rebuild',
|
||||
'package',
|
||||
'testpackage',
|
||||
'publish',
|
||||
'unpublish',
|
||||
'info',
|
||||
'testbinary',
|
||||
'reveal',
|
||||
'configure'
|
||||
];
|
||||
var aliases = {};
|
||||
|
||||
// differentiate node-pre-gyp's logs from npm's
|
||||
log.heading = 'node-pre-gyp';
|
||||
|
||||
exports.find = require('./pre-binding').find;
|
||||
|
||||
function Run() {
|
||||
var self = this;
|
||||
|
||||
this.commands = {};
|
||||
|
||||
commands.forEach(function (command) {
|
||||
self.commands[command] = function (argv, callback) {
|
||||
log.verbose('command', command, argv);
|
||||
return require('./' + command)(self, argv, callback);
|
||||
};
|
||||
});
|
||||
}
|
||||
inherits(Run, EE);
|
||||
exports.Run = Run;
|
||||
var proto = Run.prototype;
|
||||
|
||||
/**
|
||||
* Export the contents of the package.json.
|
||||
*/
|
||||
|
||||
proto.package = require('../package.json');
|
||||
|
||||
/**
|
||||
* nopt configuration definitions
|
||||
*/
|
||||
|
||||
proto.configDefs = {
|
||||
help: Boolean, // everywhere
|
||||
arch: String, // 'configure'
|
||||
debug: Boolean, // 'build'
|
||||
directory: String, // bin
|
||||
proxy: String, // 'install'
|
||||
loglevel: String, // everywhere
|
||||
};
|
||||
|
||||
/**
|
||||
* nopt shorthands
|
||||
*/
|
||||
|
||||
proto.shorthands = {
|
||||
release: '--no-debug',
|
||||
C: '--directory',
|
||||
debug: '--debug',
|
||||
j: '--jobs',
|
||||
silent: '--loglevel=silent',
|
||||
silly: '--loglevel=silly',
|
||||
verbose: '--loglevel=verbose',
|
||||
};
|
||||
|
||||
/**
|
||||
* expose the command aliases for the bin file to use.
|
||||
*/
|
||||
|
||||
proto.aliases = aliases;
|
||||
|
||||
/**
|
||||
* Parses the given argv array and sets the 'opts',
|
||||
* 'argv' and 'command' properties.
|
||||
*/
|
||||
|
||||
proto.parseArgv = function parseOpts (argv) {
|
||||
this.opts = nopt(this.configDefs, this.shorthands, argv);
|
||||
this.argv = this.opts.argv.remain.slice();
|
||||
var commands = this.todo = [];
|
||||
|
||||
// create a copy of the argv array with aliases mapped
|
||||
argv = this.argv.map(function (arg) {
|
||||
// is this an alias?
|
||||
if (arg in this.aliases) {
|
||||
arg = this.aliases[arg];
|
||||
}
|
||||
return arg;
|
||||
}, this);
|
||||
|
||||
// process the mapped args into "command" objects ("name" and "args" props)
|
||||
argv.slice().forEach(function (arg) {
|
||||
if (arg in this.commands) {
|
||||
var args = argv.splice(0, argv.indexOf(arg));
|
||||
argv.shift();
|
||||
if (commands.length > 0) {
|
||||
commands[commands.length - 1].args = args;
|
||||
}
|
||||
commands.push({ name: arg, args: [] });
|
||||
}
|
||||
}, this);
|
||||
if (commands.length > 0) {
|
||||
commands[commands.length - 1].args = argv.splice(0);
|
||||
}
|
||||
|
||||
// expand commands entries for multiple napi builds
|
||||
var dir = this.opts.directory;
|
||||
if (dir == null) dir = process.cwd();
|
||||
var package_json = JSON.parse(fs.readFileSync(path.join(dir,'package.json')));
|
||||
|
||||
this.todo = napi.expand_commands (package_json, commands);
|
||||
|
||||
// support for inheriting config env variables from npm
|
||||
var npm_config_prefix = 'npm_config_';
|
||||
Object.keys(process.env).forEach(function (name) {
|
||||
if (name.indexOf(npm_config_prefix) !== 0) return;
|
||||
var val = process.env[name];
|
||||
if (name === npm_config_prefix + 'loglevel') {
|
||||
log.level = val;
|
||||
} else {
|
||||
// add the user-defined options to the config
|
||||
name = name.substring(npm_config_prefix.length);
|
||||
// avoid npm argv clobber already present args
|
||||
// which avoids problem of 'npm test' calling
|
||||
// script that runs unique npm install commands
|
||||
if (name === 'argv') {
|
||||
if (this.opts.argv &&
|
||||
this.opts.argv.remain &&
|
||||
this.opts.argv.remain.length) {
|
||||
// do nothing
|
||||
} else {
|
||||
this.opts[name] = val;
|
||||
}
|
||||
} else {
|
||||
this.opts[name] = val;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
|
||||
if (this.opts.loglevel) {
|
||||
log.level = this.opts.loglevel;
|
||||
}
|
||||
log.resume();
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the usage instructions for node-pre-gyp.
|
||||
*/
|
||||
|
||||
proto.usage = function usage () {
|
||||
var str = [
|
||||
'',
|
||||
' Usage: node-pre-gyp <command> [options]',
|
||||
'',
|
||||
' where <command> is one of:',
|
||||
commands.map(function (c) {
|
||||
return ' - ' + c + ' - ' + require('./' + c).usage;
|
||||
}).join('\n'),
|
||||
'',
|
||||
'node-pre-gyp@' + this.version + ' ' + path.resolve(__dirname, '..'),
|
||||
'node@' + process.versions.node
|
||||
].join('\n');
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Version number getter.
|
||||
*/
|
||||
|
||||
Object.defineProperty(proto, 'version', {
|
||||
get: function () {
|
||||
return this.package.version;
|
||||
},
|
||||
enumerable: true
|
||||
});
|
||||
|
||||
53
node_modules/libxmljs/node_modules/node-pre-gyp/lib/package.js
generated
vendored
Normal file
53
node_modules/libxmljs/node_modules/node-pre-gyp/lib/package.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = _package;
|
||||
|
||||
exports.usage = 'Packs binary (and enclosing directory) into locally staged tarball';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var log = require('npmlog');
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var write = require('fs').createWriteStream;
|
||||
var existsAsync = fs.exists || path.exists;
|
||||
var mkdirp = require('mkdirp');
|
||||
var tar = require('tar');
|
||||
|
||||
function _package(gyp, argv, callback) {
|
||||
var packlist = require('npm-packlist');
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
var from = opts.module_path;
|
||||
var binary_module = path.join(from,opts.module_name + '.node');
|
||||
existsAsync(binary_module,function(found) {
|
||||
if (!found) {
|
||||
return callback(new Error("Cannot package because " + binary_module + " missing: run `node-pre-gyp rebuild` first"));
|
||||
}
|
||||
var tarball = opts.staged_tarball;
|
||||
var filter_func = function(entry) {
|
||||
// ensure directories are +x
|
||||
// https://github.com/mapnik/node-mapnik/issues/262
|
||||
log.info('package','packing ' + entry.path);
|
||||
return true;
|
||||
};
|
||||
mkdirp(path.dirname(tarball),function(err) {
|
||||
from = path.dirname(from);
|
||||
if (err) return callback(err);
|
||||
packlist({ path: from }).then(function(files) {
|
||||
tar.create({
|
||||
portable: true,
|
||||
gzip: true,
|
||||
onentry: filter_func,
|
||||
file: tarball,
|
||||
cwd: from
|
||||
}, files, function(err) {
|
||||
if (err) console.error('['+package_json.name+'] ' + err.message);
|
||||
else log.info('package','Binary staged at "' + tarball + '"');
|
||||
return callback(err);
|
||||
});
|
||||
}, callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
30
node_modules/libxmljs/node_modules/node-pre-gyp/lib/pre-binding.js
generated
vendored
Normal file
30
node_modules/libxmljs/node_modules/node-pre-gyp/lib/pre-binding.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
var versioning = require('../lib/util/versioning.js');
|
||||
var napi = require('../lib/util/napi.js');
|
||||
var existsSync = require('fs').existsSync || require('path').existsSync;
|
||||
var path = require('path');
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
exports.usage = 'Finds the require path for the node-pre-gyp installed module';
|
||||
|
||||
exports.validate = function(package_json) {
|
||||
versioning.validate_config(package_json);
|
||||
};
|
||||
|
||||
exports.find = function(package_json_path,opts) {
|
||||
if (!existsSync(package_json_path)) {
|
||||
throw new Error("package.json does not exist at " + package_json_path);
|
||||
}
|
||||
var package_json = require(package_json_path);
|
||||
versioning.validate_config(package_json);
|
||||
var napi_build_version;
|
||||
if (napi.get_napi_build_versions (package_json)) {
|
||||
napi_build_version = napi.get_best_napi_build_version(package_json);
|
||||
}
|
||||
opts = opts || {};
|
||||
if (!opts.module_root) opts.module_root = path.dirname(package_json_path);
|
||||
var meta = versioning.evaluate(package_json,opts,napi_build_version);
|
||||
return meta.module;
|
||||
};
|
||||
79
node_modules/libxmljs/node_modules/node-pre-gyp/lib/publish.js
generated
vendored
Normal file
79
node_modules/libxmljs/node_modules/node-pre-gyp/lib/publish.js
generated
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = publish;
|
||||
|
||||
exports.usage = 'Publishes pre-built binary (requires aws-sdk)';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var log = require('npmlog');
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var s3_setup = require('./util/s3_setup.js');
|
||||
var existsAsync = fs.exists || path.exists;
|
||||
var url = require('url');
|
||||
var config = require('rc')("node_pre_gyp",{acl:"public-read"});
|
||||
|
||||
function publish(gyp, argv, callback) {
|
||||
var AWS = require("aws-sdk");
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
var tarball = opts.staged_tarball;
|
||||
existsAsync(tarball,function(found) {
|
||||
if (!found) {
|
||||
return callback(new Error("Cannot publish because " + tarball + " missing: run `node-pre-gyp package` first"));
|
||||
}
|
||||
log.info('publish', 'Detecting s3 credentials');
|
||||
s3_setup.detect(opts.hosted_path,config);
|
||||
var key_name = url.resolve(config.prefix,opts.package_name);
|
||||
log.info('publish', 'Authenticating with s3');
|
||||
AWS.config.update(config);
|
||||
var s3 = new AWS.S3();
|
||||
var s3_opts = { Bucket: config.bucket,
|
||||
Key: key_name
|
||||
};
|
||||
var remote_package = 'https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key;
|
||||
log.info('publish', 'Checking for existing binary at ' + remote_package);
|
||||
s3.headObject(s3_opts, function(err, meta){
|
||||
if (meta) log.info('publish', JSON.stringify(meta));
|
||||
if (err && err.code == 'NotFound') {
|
||||
// we are safe to publish because
|
||||
// the object does not already exist
|
||||
log.info('publish', 'Preparing to put object');
|
||||
var s3_put = new AWS.S3();
|
||||
var s3_put_opts = { ACL: config.acl,
|
||||
Body: fs.createReadStream(tarball),
|
||||
Bucket: config.bucket,
|
||||
Key: key_name
|
||||
};
|
||||
log.info('publish', 'Putting object');
|
||||
try {
|
||||
s3_put.putObject(s3_put_opts, function(err, resp){
|
||||
log.info('publish', 'returned from putting object');
|
||||
if(err) {
|
||||
log.info('publish', 's3 putObject error: "' + err + '"');
|
||||
return callback(err);
|
||||
}
|
||||
if (resp) log.info('publish', 's3 putObject response: "' + JSON.stringify(resp) + '"');
|
||||
log.info('publish', 'successfully put object');
|
||||
console.log('['+package_json.name+'] published to ' + remote_package);
|
||||
return callback();
|
||||
});
|
||||
} catch (err) {
|
||||
log.info('publish', 's3 putObject error: "' + err + '"');
|
||||
return callback(err);
|
||||
}
|
||||
} else if (err) {
|
||||
log.info('publish', 's3 headObject error: "' + err + '"');
|
||||
return callback(err);
|
||||
} else {
|
||||
log.error('publish','Cannot publish over existing version');
|
||||
log.error('publish',"Update the 'version' field in package.json and try again");
|
||||
log.error('publish','If the previous version was published in error see:');
|
||||
log.error('publish','\t node-pre-gyp unpublish');
|
||||
return callback(new Error('Failed publishing to ' + remote_package));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
21
node_modules/libxmljs/node_modules/node-pre-gyp/lib/rebuild.js
generated
vendored
Normal file
21
node_modules/libxmljs/node_modules/node-pre-gyp/lib/rebuild.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = rebuild;
|
||||
|
||||
exports.usage = 'Runs "clean" and "build" at once';
|
||||
|
||||
var fs = require('fs');
|
||||
var napi = require('./util/napi.js');
|
||||
|
||||
function rebuild (gyp, argv, callback) {
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var commands = [
|
||||
{ name: 'clean', args: [] },
|
||||
{ name: 'build', args: ['rebuild'] }
|
||||
];
|
||||
commands = napi.expand_commands(package_json, commands);
|
||||
for (var i = commands.length; i !== 0; i--) {
|
||||
gyp.todo.unshift(commands[i-1]);
|
||||
}
|
||||
process.nextTick(callback);
|
||||
}
|
||||
20
node_modules/libxmljs/node_modules/node-pre-gyp/lib/reinstall.js
generated
vendored
Normal file
20
node_modules/libxmljs/node_modules/node-pre-gyp/lib/reinstall.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = rebuild;
|
||||
|
||||
exports.usage = 'Runs "clean" and "install" at once';
|
||||
|
||||
var fs = require('fs');
|
||||
var napi = require('./util/napi.js');
|
||||
|
||||
function rebuild (gyp, argv, callback) {
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var installArgs = [];
|
||||
var napi_build_version = napi.get_best_napi_version(package_json);
|
||||
if (napi_build_version != null) installArgs = [ napi.get_command_arg (napi_build_version) ];
|
||||
gyp.todo.unshift(
|
||||
{ name: 'clean', args: [] },
|
||||
{ name: 'install', args: installArgs }
|
||||
);
|
||||
process.nextTick(callback);
|
||||
}
|
||||
33
node_modules/libxmljs/node_modules/node-pre-gyp/lib/reveal.js
generated
vendored
Normal file
33
node_modules/libxmljs/node_modules/node-pre-gyp/lib/reveal.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = reveal;
|
||||
|
||||
exports.usage = 'Reveals data on the versioned binary';
|
||||
|
||||
var fs = require('fs');
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
|
||||
function unix_paths(key, val) {
|
||||
return val && val.replace ? val.replace(/\\/g, '/') : val;
|
||||
}
|
||||
|
||||
function reveal(gyp, argv, callback) {
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
var hit = false;
|
||||
// if a second arg is passed look to see
|
||||
// if it is a known option
|
||||
//console.log(JSON.stringify(gyp.opts,null,1))
|
||||
var remain = gyp.opts.argv.remain[gyp.opts.argv.remain.length-1];
|
||||
if (remain && opts.hasOwnProperty(remain)) {
|
||||
console.log(opts[remain].replace(/\\/g, '/'));
|
||||
hit = true;
|
||||
}
|
||||
// otherwise return all options as json
|
||||
if (!hit) {
|
||||
console.log(JSON.stringify(opts,unix_paths,2));
|
||||
}
|
||||
return callback();
|
||||
}
|
||||
81
node_modules/libxmljs/node_modules/node-pre-gyp/lib/testbinary.js
generated
vendored
Normal file
81
node_modules/libxmljs/node_modules/node-pre-gyp/lib/testbinary.js
generated
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = testbinary;
|
||||
|
||||
exports.usage = 'Tests that the binary.node can be required';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var log = require('npmlog');
|
||||
var cp = require('child_process');
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var path = require('path');
|
||||
|
||||
function testbinary(gyp, argv, callback) {
|
||||
var args = [];
|
||||
var options = {};
|
||||
var shell_cmd = process.execPath;
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
// skip validation for runtimes we don't explicitly support (like electron)
|
||||
if (opts.runtime &&
|
||||
opts.runtime !== 'node-webkit' &&
|
||||
opts.runtime !== 'node') {
|
||||
return callback();
|
||||
}
|
||||
var nw = (opts.runtime && opts.runtime === 'node-webkit');
|
||||
// ensure on windows that / are used for require path
|
||||
var binary_module = opts.module.replace(/\\/g, '/');
|
||||
if ((process.arch != opts.target_arch) ||
|
||||
(process.platform != opts.target_platform)) {
|
||||
var msg = "skipping validation since host platform/arch (";
|
||||
msg += process.platform+'/'+process.arch+")";
|
||||
msg += " does not match target (";
|
||||
msg += opts.target_platform+'/'+opts.target_arch+")";
|
||||
log.info('validate', msg);
|
||||
return callback();
|
||||
}
|
||||
if (nw) {
|
||||
options.timeout = 5000;
|
||||
if (process.platform === 'darwin') {
|
||||
shell_cmd = 'node-webkit';
|
||||
} else if (process.platform === 'win32') {
|
||||
shell_cmd = 'nw.exe';
|
||||
} else {
|
||||
shell_cmd = 'nw';
|
||||
}
|
||||
var modulePath = path.resolve(binary_module);
|
||||
var appDir = path.join(__dirname, 'util', 'nw-pre-gyp');
|
||||
args.push(appDir);
|
||||
args.push(modulePath);
|
||||
log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'");
|
||||
cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) {
|
||||
// check for normal timeout for node-webkit
|
||||
if (err) {
|
||||
if (err.killed === true && err.signal && err.signal.indexOf('SIG') > -1) {
|
||||
return callback();
|
||||
}
|
||||
var stderrLog = stderr.toString();
|
||||
log.info('stderr', stderrLog);
|
||||
if( /^\s*Xlib:\s*extension\s*"RANDR"\s*missing\s*on\s*display\s*":\d+\.\d+"\.\s*$/.test(stderrLog) ){
|
||||
log.info('RANDR', 'stderr contains only RANDR error, ignored');
|
||||
return callback();
|
||||
}
|
||||
return callback(err);
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
return;
|
||||
}
|
||||
args.push('--eval');
|
||||
args.push("require('" + binary_module.replace(/'/g, '\'') +"')");
|
||||
log.info("validate","Running test command: '" + shell_cmd + ' ' + args.join(' ') + "'");
|
||||
cp.execFile(shell_cmd, args, options, function(err, stdout, stderr) {
|
||||
if (err) {
|
||||
return callback(err, { stdout:stdout, stderr:stderr});
|
||||
}
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
55
node_modules/libxmljs/node_modules/node-pre-gyp/lib/testpackage.js
generated
vendored
Normal file
55
node_modules/libxmljs/node_modules/node-pre-gyp/lib/testpackage.js
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = testpackage;
|
||||
|
||||
exports.usage = 'Tests that the staged package is valid';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var log = require('npmlog');
|
||||
var existsAsync = fs.exists || path.exists;
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var testbinary = require('./testbinary.js');
|
||||
var tar = require('tar');
|
||||
var mkdirp = require('mkdirp');
|
||||
|
||||
function testpackage(gyp, argv, callback) {
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
var tarball = opts.staged_tarball;
|
||||
existsAsync(tarball, function(found) {
|
||||
if (!found) {
|
||||
return callback(new Error("Cannot test package because " + tarball + " missing: run `node-pre-gyp package` first"));
|
||||
}
|
||||
var to = opts.module_path;
|
||||
function filter_func(entry) {
|
||||
log.info('install','unpacking [' + entry.path + ']');
|
||||
}
|
||||
|
||||
mkdirp(to, function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
tar.extract({
|
||||
file: tarball,
|
||||
cwd: to,
|
||||
strip: 1,
|
||||
onentry: filter_func
|
||||
}).then(after_extract, callback);
|
||||
}
|
||||
});
|
||||
|
||||
function after_extract() {
|
||||
testbinary(gyp,argv,function(err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
console.log('['+package_json.name+'] Package appears valid');
|
||||
return callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
43
node_modules/libxmljs/node_modules/node-pre-gyp/lib/unpublish.js
generated
vendored
Normal file
43
node_modules/libxmljs/node_modules/node-pre-gyp/lib/unpublish.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = unpublish;
|
||||
|
||||
exports.usage = 'Unpublishes pre-built binary (requires aws-sdk)';
|
||||
|
||||
var fs = require('fs');
|
||||
var log = require('npmlog');
|
||||
var versioning = require('./util/versioning.js');
|
||||
var napi = require('./util/napi.js');
|
||||
var s3_setup = require('./util/s3_setup.js');
|
||||
var url = require('url');
|
||||
var config = require('rc')("node_pre_gyp",{acl:"public-read"});
|
||||
|
||||
function unpublish(gyp, argv, callback) {
|
||||
var AWS = require("aws-sdk");
|
||||
var package_json = JSON.parse(fs.readFileSync('./package.json'));
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(package_json, gyp.opts, napi_build_version);
|
||||
s3_setup.detect(opts.hosted_path,config);
|
||||
AWS.config.update(config);
|
||||
var key_name = url.resolve(config.prefix,opts.package_name);
|
||||
var s3 = new AWS.S3();
|
||||
var s3_opts = { Bucket: config.bucket,
|
||||
Key: key_name
|
||||
};
|
||||
s3.headObject(s3_opts, function(err, meta) {
|
||||
if (err && err.code == 'NotFound') {
|
||||
console.log('['+package_json.name+'] Not found: https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
|
||||
return callback();
|
||||
} else if(err) {
|
||||
return callback(err);
|
||||
} else {
|
||||
log.info('unpublish', JSON.stringify(meta));
|
||||
s3.deleteObject(s3_opts, function(err, resp) {
|
||||
if (err) return callback(err);
|
||||
log.info(JSON.stringify(resp));
|
||||
console.log('['+package_json.name+'] Success: removed https://' + s3_opts.Bucket + '.s3.amazonaws.com/' + s3_opts.Key);
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
1682
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json
generated
vendored
Normal file
1682
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/abi_crosswalk.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
87
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/compile.js
generated
vendored
Normal file
87
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/compile.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var win = process.platform == 'win32';
|
||||
var existsSync = fs.existsSync || path.existsSync;
|
||||
var cp = require('child_process');
|
||||
|
||||
// try to build up the complete path to node-gyp
|
||||
/* priority:
|
||||
- node-gyp on ENV:npm_config_node_gyp (https://github.com/npm/npm/pull/4887)
|
||||
- node-gyp on NODE_PATH
|
||||
- node-gyp inside npm on NODE_PATH (ignore on iojs)
|
||||
- node-gyp inside npm beside node exe
|
||||
*/
|
||||
function which_node_gyp() {
|
||||
var node_gyp_bin;
|
||||
if (process.env.npm_config_node_gyp) {
|
||||
try {
|
||||
node_gyp_bin = process.env.npm_config_node_gyp;
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
} catch (err) { }
|
||||
}
|
||||
try {
|
||||
var node_gyp_main = require.resolve('node-gyp');
|
||||
node_gyp_bin = path.join(path.dirname(
|
||||
path.dirname(node_gyp_main)),
|
||||
'bin/node-gyp.js');
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
} catch (err) { }
|
||||
if (process.execPath.indexOf('iojs') === -1) {
|
||||
try {
|
||||
var npm_main = require.resolve('npm');
|
||||
node_gyp_bin = path.join(path.dirname(
|
||||
path.dirname(npm_main)),
|
||||
'node_modules/node-gyp/bin/node-gyp.js');
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
} catch (err) { }
|
||||
}
|
||||
var npm_base = path.join(path.dirname(
|
||||
path.dirname(process.execPath)),
|
||||
'lib/node_modules/npm/');
|
||||
node_gyp_bin = path.join(npm_base, 'node_modules/node-gyp/bin/node-gyp.js');
|
||||
if (existsSync(node_gyp_bin)) {
|
||||
return node_gyp_bin;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.run_gyp = function(args,opts,callback) {
|
||||
var shell_cmd = '';
|
||||
var cmd_args = [];
|
||||
if (opts.runtime && opts.runtime == 'node-webkit') {
|
||||
shell_cmd = 'nw-gyp';
|
||||
if (win) shell_cmd += '.cmd';
|
||||
} else {
|
||||
var node_gyp_path = which_node_gyp();
|
||||
if (node_gyp_path) {
|
||||
shell_cmd = process.execPath;
|
||||
cmd_args.push(node_gyp_path);
|
||||
} else {
|
||||
shell_cmd = 'node-gyp';
|
||||
if (win) shell_cmd += '.cmd';
|
||||
}
|
||||
}
|
||||
var final_args = cmd_args.concat(args);
|
||||
var cmd = cp.spawn(shell_cmd, final_args, {cwd: undefined, env: process.env, stdio: [ 0, 1, 2]});
|
||||
cmd.on('error', function (err) {
|
||||
if (err) {
|
||||
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + err + ")"));
|
||||
}
|
||||
callback(null,opts);
|
||||
});
|
||||
cmd.on('close', function (code) {
|
||||
if (code && code !== 0) {
|
||||
return callback(new Error("Failed to execute '" + shell_cmd + ' ' + final_args.join(' ') + "' (" + code + ")"));
|
||||
}
|
||||
callback(null,opts);
|
||||
});
|
||||
};
|
||||
100
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js
generated
vendored
Normal file
100
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/handle_gyp_opts.js
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports = handle_gyp_opts;
|
||||
|
||||
var fs = require('fs');
|
||||
var versioning = require('./versioning.js');
|
||||
var napi = require('./napi.js');
|
||||
|
||||
/*
|
||||
|
||||
Here we gather node-pre-gyp generated options (from versioning) and pass them along to node-gyp.
|
||||
|
||||
We massage the args and options slightly to account for differences in what commands mean between
|
||||
node-pre-gyp and node-gyp (e.g. see the difference between "build" and "rebuild" below)
|
||||
|
||||
Keep in mind: the values inside `argv` and `gyp.opts` below are different depending on whether
|
||||
node-pre-gyp is called directory, or if it is called in a `run-script` phase of npm.
|
||||
|
||||
We also try to preserve any command line options that might have been passed to npm or node-pre-gyp.
|
||||
But this is fairly difficult without passing way to much through. For example `gyp.opts` contains all
|
||||
the process.env and npm pushes a lot of variables into process.env which node-pre-gyp inherits. So we have
|
||||
to be very selective about what we pass through.
|
||||
|
||||
For example:
|
||||
|
||||
`npm install --build-from-source` will give:
|
||||
|
||||
argv == [ 'rebuild' ]
|
||||
gyp.opts.argv == { remain: [ 'install' ],
|
||||
cooked: [ 'install', '--fallback-to-build' ],
|
||||
original: [ 'install', '--fallback-to-build' ] }
|
||||
|
||||
`./bin/node-pre-gyp build` will give:
|
||||
|
||||
argv == []
|
||||
gyp.opts.argv == { remain: [ 'build' ],
|
||||
cooked: [ 'build' ],
|
||||
original: [ '-C', 'test/app1', 'build' ] }
|
||||
|
||||
*/
|
||||
|
||||
// select set of node-pre-gyp versioning info
|
||||
// to share with node-gyp
|
||||
var share_with_node_gyp = [
|
||||
'module',
|
||||
'module_name',
|
||||
'module_path',
|
||||
'napi_version',
|
||||
'node_abi_napi',
|
||||
'napi_build_version'
|
||||
];
|
||||
|
||||
function handle_gyp_opts(gyp, argv, callback) {
|
||||
|
||||
// Collect node-pre-gyp specific variables to pass to node-gyp
|
||||
var node_pre_gyp_options = [];
|
||||
// generate custom node-pre-gyp versioning info
|
||||
var napi_build_version = napi.get_napi_build_version_from_command_args(argv);
|
||||
var opts = versioning.evaluate(JSON.parse(fs.readFileSync('./package.json')), gyp.opts, napi_build_version);
|
||||
share_with_node_gyp.forEach(function(key) {
|
||||
var val = opts[key];
|
||||
if (val) {
|
||||
node_pre_gyp_options.push('--' + key + '=' + val);
|
||||
} else {
|
||||
if (key !== 'napi_version' && key !== 'node_abi_napi' && key !== 'napi_build_version')
|
||||
return callback(new Error("Option " + key + " required but not found by node-pre-gyp"));
|
||||
}
|
||||
});
|
||||
|
||||
// Collect options that follow the special -- which disables nopt parsing
|
||||
var unparsed_options = [];
|
||||
var double_hyphen_found = false;
|
||||
gyp.opts.argv.original.forEach(function(opt) {
|
||||
if (double_hyphen_found) {
|
||||
unparsed_options.push(opt);
|
||||
}
|
||||
if (opt == '--') {
|
||||
double_hyphen_found = true;
|
||||
}
|
||||
});
|
||||
|
||||
// We try respect and pass through remaining command
|
||||
// line options (like --foo=bar) to node-gyp
|
||||
var cooked = gyp.opts.argv.cooked;
|
||||
var node_gyp_options = [];
|
||||
cooked.forEach(function(value) {
|
||||
if (value.length > 2 && value.slice(0,2) == '--') {
|
||||
var key = value.slice(2);
|
||||
var val = cooked[cooked.indexOf(value)+1];
|
||||
if (val && val.indexOf('--') === -1) { // handle '--foo=bar' or ['--foo','bar']
|
||||
node_gyp_options.push('--' + key + '=' + val);
|
||||
} else { // pass through --foo
|
||||
node_gyp_options.push(value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var result = {'opts':opts,'gyp':node_gyp_options,'pre':node_pre_gyp_options,'unparsed':unparsed_options};
|
||||
return callback(null,result);
|
||||
}
|
||||
156
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/napi.js
generated
vendored
Normal file
156
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/napi.js
generated
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
"use strict";
|
||||
|
||||
var fs = require('fs');
|
||||
var rm = require('rimraf');
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
var versionArray = process.version
|
||||
.substr(1)
|
||||
.replace(/-.*$/, '')
|
||||
.split('.')
|
||||
.map(function(item) {
|
||||
return +item;
|
||||
});
|
||||
|
||||
var napi_multiple_commands = [
|
||||
'build',
|
||||
'clean',
|
||||
'configure',
|
||||
'package',
|
||||
'publish',
|
||||
'reveal',
|
||||
'testbinary',
|
||||
'testpackage',
|
||||
'unpublish'
|
||||
];
|
||||
|
||||
var napi_build_version_tag = 'napi_build_version=';
|
||||
|
||||
module.exports.get_napi_version = function() {
|
||||
// returns the non-zero numeric napi version or undefined if napi is not supported.
|
||||
var version = process.versions.napi; // can be undefined
|
||||
if (!version) { // this code should never need to be updated
|
||||
if (versionArray[0] === 9 && versionArray[1] >= 3) version = 2; // 9.3.0+
|
||||
else if (versionArray[0] === 8) version = 1; // 8.0.0+
|
||||
}
|
||||
return version;
|
||||
};
|
||||
|
||||
module.exports.get_napi_version_as_string = function() {
|
||||
// returns the napi version as a string or an empty string if napi is not supported.
|
||||
var version = module.exports.get_napi_version();
|
||||
return version ? ''+version : '';
|
||||
};
|
||||
|
||||
module.exports.validate_package_json = function(package_json) { // return err
|
||||
var binary = package_json.binary;
|
||||
var module_path_ok = binary.module_path && binary.module_path.indexOf('{napi_build_version}') !== -1;
|
||||
var remote_path_ok = binary.remote_path && binary.remote_path.indexOf('{napi_build_version}') !== -1;
|
||||
var package_name_ok = binary.package_name && binary.package_name.indexOf('{napi_build_version}') !== -1;
|
||||
var napi_build_versions = module.exports.get_napi_build_versions(package_json);
|
||||
|
||||
if (napi_build_versions) {
|
||||
napi_build_versions.forEach(function(napi_build_version){
|
||||
if (!(parseInt(napi_build_version,10) === napi_build_version && napi_build_version > 0)) {
|
||||
throw new Error("All values specified in napi_versions must be positive integers.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (napi_build_versions && (!module_path_ok || (!remote_path_ok && !package_name_ok))) {
|
||||
throw new Error("When napi_versions is specified; module_path and either remote_path or " +
|
||||
"package_name must contain the substitution string '{napi_build_version}`.");
|
||||
}
|
||||
|
||||
if ((module_path_ok || remote_path_ok || package_name_ok) && !napi_build_versions) {
|
||||
throw new Error("When the substitution string '{napi_build_version}` is specified in " +
|
||||
"module_path, remote_path, or package_name; napi_versions must also be specified.");
|
||||
}
|
||||
|
||||
if (napi_build_versions && !module.exports.get_best_napi_build_version(package_json)) {
|
||||
throw new Error(
|
||||
'The N-API version of this Node instance is ' + module.exports.get_napi_version() + '. ' +
|
||||
'This module supports N-API version(s) ' + module.exports.get_napi_build_versions(package_json) + '. ' +
|
||||
'This Node instance cannot run this module.');
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
module.exports.expand_commands = function(package_json, commands) {
|
||||
var expanded_commands = [];
|
||||
var napi_build_versions = module.exports.get_napi_build_versions(package_json);
|
||||
commands.forEach(function(command){
|
||||
if (napi_build_versions && command.name === 'install') {
|
||||
var napi_build_version = module.exports.get_best_napi_build_version(package_json);
|
||||
var args = napi_build_version ? [ napi_build_version_tag+napi_build_version ] : [ ];
|
||||
expanded_commands.push ({ name: command.name, args: args });
|
||||
} else if (napi_build_versions && napi_multiple_commands.includes(command.name)) {
|
||||
napi_build_versions.forEach(function(napi_build_version){
|
||||
var args = command.args.slice();
|
||||
args.push (napi_build_version_tag+napi_build_version);
|
||||
expanded_commands.push ({ name: command.name, args: args });
|
||||
});
|
||||
} else {
|
||||
expanded_commands.push (command);
|
||||
}
|
||||
});
|
||||
return expanded_commands;
|
||||
};
|
||||
|
||||
module.exports.get_napi_build_versions = function(package_json) {
|
||||
var napi_build_versions = [];
|
||||
if (package_json.binary && package_json.binary.napi_versions) { // remove duplicates
|
||||
package_json.binary.napi_versions.forEach(function(napi_version) {
|
||||
if (!napi_build_versions.includes(napi_version)) napi_build_versions.push(napi_version);
|
||||
});
|
||||
}
|
||||
return napi_build_versions.length ? napi_build_versions : undefined;
|
||||
};
|
||||
|
||||
module.exports.get_command_arg = function(napi_build_version) {
|
||||
return napi_build_version_tag + napi_build_version;
|
||||
};
|
||||
|
||||
module.exports.get_napi_build_version_from_command_args = function(command_args) {
|
||||
for (var i = 0; i < command_args.length; i++) {
|
||||
var arg = command_args[i];
|
||||
if (arg.indexOf(napi_build_version_tag) === 0) {
|
||||
return parseInt(arg.substr(napi_build_version_tag.length),10);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
module.exports.swap_build_dir_out = function(napi_build_version) {
|
||||
if (napi_build_version) {
|
||||
rm.sync(module.exports.get_build_dir(napi_build_version));
|
||||
fs.renameSync('build', module.exports.get_build_dir(napi_build_version));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.swap_build_dir_in = function(napi_build_version) {
|
||||
if (napi_build_version) {
|
||||
rm.sync('build');
|
||||
fs.renameSync(module.exports.get_build_dir(napi_build_version), 'build');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.get_build_dir = function(napi_build_version) {
|
||||
return 'build-tmp-napi-v'+napi_build_version;
|
||||
};
|
||||
|
||||
module.exports.get_best_napi_build_version = function(package_json) {
|
||||
var best_napi_build_version = 0;
|
||||
var napi_build_versions = module.exports.get_napi_build_versions (package_json);
|
||||
if (napi_build_versions) {
|
||||
var our_napi_version = module.exports.get_napi_version();
|
||||
napi_build_versions.forEach(function(napi_build_version){
|
||||
if (napi_build_version > best_napi_build_version &&
|
||||
napi_build_version <= our_napi_version) {
|
||||
best_napi_build_version = napi_build_version;
|
||||
}
|
||||
});
|
||||
}
|
||||
return best_napi_build_version === 0 ? undefined : best_napi_build_version;
|
||||
};
|
||||
26
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html
generated
vendored
Normal file
26
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/index.html
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Node-webkit-based module test</title>
|
||||
<script>
|
||||
function nwModuleTest(){
|
||||
var util = require('util');
|
||||
var moduleFolder = require('nw.gui').App.argv[0];
|
||||
try {
|
||||
require(moduleFolder);
|
||||
} catch(e) {
|
||||
if( process.platform !== 'win32' ){
|
||||
util.log('nw-pre-gyp error:');
|
||||
util.log(e.stack);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
||||
process.exit(0);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="nwModuleTest()">
|
||||
<h1>Node-webkit-based module test</h1>
|
||||
</body>
|
||||
</html>
|
||||
9
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json
generated
vendored
Normal file
9
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/nw-pre-gyp/package.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"main": "index.html",
|
||||
"name": "nw-pre-gyp-module-test",
|
||||
"description": "Node-webkit-based module test.",
|
||||
"version": "0.0.1",
|
||||
"window": {
|
||||
"show": false
|
||||
}
|
||||
}
|
||||
27
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/s3_setup.js
generated
vendored
Normal file
27
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/s3_setup.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
var url = require('url');
|
||||
|
||||
var URI_REGEX="^(.*)\.(s3(?:-.*)?)\.amazonaws\.com$";
|
||||
|
||||
module.exports.detect = function(to,config) {
|
||||
var uri = url.parse(to);
|
||||
var hostname_matches = uri.hostname.match(URI_REGEX);
|
||||
config.prefix = (!uri.pathname || uri.pathname == '/') ? '' : uri.pathname.replace('/','');
|
||||
if(!hostname_matches) {
|
||||
return;
|
||||
}
|
||||
if (!config.bucket) {
|
||||
config.bucket = hostname_matches[1];
|
||||
}
|
||||
if (!config.region) {
|
||||
var s3_domain = hostname_matches[2];
|
||||
if (s3_domain.slice(0,3) == 's3-' &&
|
||||
s3_domain.length >= 3) {
|
||||
// it appears the region is explicit in the url
|
||||
config.region = s3_domain.replace('s3-','');
|
||||
}
|
||||
}
|
||||
};
|
||||
330
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/versioning.js
generated
vendored
Normal file
330
node_modules/libxmljs/node_modules/node-pre-gyp/lib/util/versioning.js
generated
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = exports;
|
||||
|
||||
var path = require('path');
|
||||
var semver = require('semver');
|
||||
var url = require('url');
|
||||
var detect_libc = require('detect-libc');
|
||||
var napi = require('./napi.js');
|
||||
|
||||
var abi_crosswalk;
|
||||
|
||||
// This is used for unit testing to provide a fake
|
||||
// ABI crosswalk that emulates one that is not updated
|
||||
// for the current version
|
||||
if (process.env.NODE_PRE_GYP_ABI_CROSSWALK) {
|
||||
abi_crosswalk = require(process.env.NODE_PRE_GYP_ABI_CROSSWALK);
|
||||
} else {
|
||||
abi_crosswalk = require('./abi_crosswalk.json');
|
||||
}
|
||||
|
||||
var major_versions = {};
|
||||
Object.keys(abi_crosswalk).forEach(function(v) {
|
||||
var major = v.split('.')[0];
|
||||
if (!major_versions[major]) {
|
||||
major_versions[major] = v;
|
||||
}
|
||||
});
|
||||
|
||||
function get_electron_abi(runtime, target_version) {
|
||||
if (!runtime) {
|
||||
throw new Error("get_electron_abi requires valid runtime arg");
|
||||
}
|
||||
if (typeof target_version === 'undefined') {
|
||||
// erroneous CLI call
|
||||
throw new Error("Empty target version is not supported if electron is the target.");
|
||||
}
|
||||
// Electron guarantees that patch version update won't break native modules.
|
||||
var sem_ver = semver.parse(target_version);
|
||||
return runtime + '-v' + sem_ver.major + '.' + sem_ver.minor;
|
||||
}
|
||||
module.exports.get_electron_abi = get_electron_abi;
|
||||
|
||||
function get_node_webkit_abi(runtime, target_version) {
|
||||
if (!runtime) {
|
||||
throw new Error("get_node_webkit_abi requires valid runtime arg");
|
||||
}
|
||||
if (typeof target_version === 'undefined') {
|
||||
// erroneous CLI call
|
||||
throw new Error("Empty target version is not supported if node-webkit is the target.");
|
||||
}
|
||||
return runtime + '-v' + target_version;
|
||||
}
|
||||
module.exports.get_node_webkit_abi = get_node_webkit_abi;
|
||||
|
||||
function get_node_abi(runtime, versions) {
|
||||
if (!runtime) {
|
||||
throw new Error("get_node_abi requires valid runtime arg");
|
||||
}
|
||||
if (!versions) {
|
||||
throw new Error("get_node_abi requires valid process.versions object");
|
||||
}
|
||||
var sem_ver = semver.parse(versions.node);
|
||||
if (sem_ver.major === 0 && sem_ver.minor % 2) { // odd series
|
||||
// https://github.com/mapbox/node-pre-gyp/issues/124
|
||||
return runtime+'-v'+versions.node;
|
||||
} else {
|
||||
// process.versions.modules added in >= v0.10.4 and v0.11.7
|
||||
// https://github.com/joyent/node/commit/ccabd4a6fa8a6eb79d29bc3bbe9fe2b6531c2d8e
|
||||
return versions.modules ? runtime+'-v' + (+versions.modules) :
|
||||
'v8-' + versions.v8.split('.').slice(0,2).join('.');
|
||||
}
|
||||
}
|
||||
module.exports.get_node_abi = get_node_abi;
|
||||
|
||||
function get_runtime_abi(runtime, target_version) {
|
||||
if (!runtime) {
|
||||
throw new Error("get_runtime_abi requires valid runtime arg");
|
||||
}
|
||||
if (runtime === 'node-webkit') {
|
||||
return get_node_webkit_abi(runtime, target_version || process.versions['node-webkit']);
|
||||
} else if (runtime === 'electron') {
|
||||
return get_electron_abi(runtime, target_version || process.versions.electron);
|
||||
} else {
|
||||
if (runtime != 'node') {
|
||||
throw new Error("Unknown Runtime: '" + runtime + "'");
|
||||
}
|
||||
if (!target_version) {
|
||||
return get_node_abi(runtime,process.versions);
|
||||
} else {
|
||||
var cross_obj;
|
||||
// abi_crosswalk generated with ./scripts/abi_crosswalk.js
|
||||
if (abi_crosswalk[target_version]) {
|
||||
cross_obj = abi_crosswalk[target_version];
|
||||
} else {
|
||||
var target_parts = target_version.split('.').map(function(i) { return +i; });
|
||||
if (target_parts.length != 3) { // parse failed
|
||||
throw new Error("Unknown target version: " + target_version);
|
||||
}
|
||||
/*
|
||||
The below code tries to infer the last known ABI compatible version
|
||||
that we have recorded in the abi_crosswalk.json when an exact match
|
||||
is not possible. The reasons for this to exist are complicated:
|
||||
|
||||
- We support passing --target to be able to allow developers to package binaries for versions of node
|
||||
that are not the same one as they are running. This might also be used in combination with the
|
||||
--target_arch or --target_platform flags to also package binaries for alternative platforms
|
||||
- When --target is passed we can't therefore determine the ABI (process.versions.modules) from the node
|
||||
version that is running in memory
|
||||
- So, therefore node-pre-gyp keeps an "ABI crosswalk" (lib/util/abi_crosswalk.json) to be able to look
|
||||
this info up for all versions
|
||||
- But we cannot easily predict what the future ABI will be for released versions
|
||||
- And node-pre-gyp needs to be a `bundledDependency` in apps that depend on it in order to work correctly
|
||||
by being fully available at install time.
|
||||
- So, the speed of node releases and the bundled nature of node-pre-gyp mean that a new node-pre-gyp release
|
||||
need to happen for every node.js/io.js/node-webkit/nw.js/atom-shell/etc release that might come online if
|
||||
you want the `--target` flag to keep working for the latest version
|
||||
- Which is impractical ^^
|
||||
- Hence the below code guesses about future ABI to make the need to update node-pre-gyp less demanding.
|
||||
|
||||
In practice then you can have a dependency of your app like `node-sqlite3` that bundles a `node-pre-gyp` that
|
||||
only knows about node v0.10.33 in the `abi_crosswalk.json` but target node v0.10.34 (which is assumed to be
|
||||
ABI compatible with v0.10.33).
|
||||
|
||||
TODO: use semver module instead of custom version parsing
|
||||
*/
|
||||
var major = target_parts[0];
|
||||
var minor = target_parts[1];
|
||||
var patch = target_parts[2];
|
||||
// io.js: yeah if node.js ever releases 1.x this will break
|
||||
// but that is unlikely to happen: https://github.com/iojs/io.js/pull/253#issuecomment-69432616
|
||||
if (major === 1) {
|
||||
// look for last release that is the same major version
|
||||
// e.g. we assume io.js 1.x is ABI compatible with >= 1.0.0
|
||||
while (true) {
|
||||
if (minor > 0) --minor;
|
||||
if (patch > 0) --patch;
|
||||
var new_iojs_target = '' + major + '.' + minor + '.' + patch;
|
||||
if (abi_crosswalk[new_iojs_target]) {
|
||||
cross_obj = abi_crosswalk[new_iojs_target];
|
||||
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
|
||||
console.log('Warning: but node-pre-gyp successfully choose ' + new_iojs_target + ' as ABI compatible target');
|
||||
break;
|
||||
}
|
||||
if (minor === 0 && patch === 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (major >= 2) {
|
||||
// look for last release that is the same major version
|
||||
if (major_versions[major]) {
|
||||
cross_obj = abi_crosswalk[major_versions[major]];
|
||||
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
|
||||
console.log('Warning: but node-pre-gyp successfully choose ' + major_versions[major] + ' as ABI compatible target');
|
||||
}
|
||||
} else if (major === 0) { // node.js
|
||||
if (target_parts[1] % 2 === 0) { // for stable/even node.js series
|
||||
// look for the last release that is the same minor release
|
||||
// e.g. we assume node 0.10.x is ABI compatible with >= 0.10.0
|
||||
while (--patch > 0) {
|
||||
var new_node_target = '' + major + '.' + minor + '.' + patch;
|
||||
if (abi_crosswalk[new_node_target]) {
|
||||
cross_obj = abi_crosswalk[new_node_target];
|
||||
console.log('Warning: node-pre-gyp could not find exact match for ' + target_version);
|
||||
console.log('Warning: but node-pre-gyp successfully choose ' + new_node_target + ' as ABI compatible target');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cross_obj) {
|
||||
throw new Error("Unsupported target version: " + target_version);
|
||||
}
|
||||
// emulate process.versions
|
||||
var versions_obj = {
|
||||
node: target_version,
|
||||
v8: cross_obj.v8+'.0',
|
||||
// abi_crosswalk uses 1 for node versions lacking process.versions.modules
|
||||
// process.versions.modules added in >= v0.10.4 and v0.11.7
|
||||
modules: cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined
|
||||
};
|
||||
return get_node_abi(runtime, versions_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports.get_runtime_abi = get_runtime_abi;
|
||||
|
||||
var required_parameters = [
|
||||
'module_name',
|
||||
'module_path',
|
||||
'host'
|
||||
];
|
||||
|
||||
function validate_config(package_json) {
|
||||
var msg = package_json.name + ' package.json is not node-pre-gyp ready:\n';
|
||||
var missing = [];
|
||||
if (!package_json.main) {
|
||||
missing.push('main');
|
||||
}
|
||||
if (!package_json.version) {
|
||||
missing.push('version');
|
||||
}
|
||||
if (!package_json.name) {
|
||||
missing.push('name');
|
||||
}
|
||||
if (!package_json.binary) {
|
||||
missing.push('binary');
|
||||
}
|
||||
var o = package_json.binary;
|
||||
required_parameters.forEach(function(p) {
|
||||
if (missing.indexOf('binary') > -1) {
|
||||
missing.pop('binary');
|
||||
}
|
||||
if (!o || o[p] === undefined || o[p] === "") {
|
||||
missing.push('binary.' + p);
|
||||
}
|
||||
});
|
||||
if (missing.length >= 1) {
|
||||
throw new Error(msg+"package.json must declare these properties: \n" + missing.join('\n'));
|
||||
}
|
||||
if (o) {
|
||||
// enforce https over http
|
||||
var protocol = url.parse(o.host).protocol;
|
||||
if (protocol === 'http:') {
|
||||
throw new Error("'host' protocol ("+protocol+") is invalid - only 'https:' is accepted");
|
||||
}
|
||||
}
|
||||
napi.validate_package_json(package_json);
|
||||
}
|
||||
|
||||
module.exports.validate_config = validate_config;
|
||||
|
||||
function eval_template(template,opts) {
|
||||
Object.keys(opts).forEach(function(key) {
|
||||
var pattern = '{'+key+'}';
|
||||
while (template.indexOf(pattern) > -1) {
|
||||
template = template.replace(pattern,opts[key]);
|
||||
}
|
||||
});
|
||||
return template;
|
||||
}
|
||||
|
||||
// url.resolve needs single trailing slash
|
||||
// to behave correctly, otherwise a double slash
|
||||
// may end up in the url which breaks requests
|
||||
// and a lacking slash may not lead to proper joining
|
||||
function fix_slashes(pathname) {
|
||||
if (pathname.slice(-1) != '/') {
|
||||
return pathname + '/';
|
||||
}
|
||||
return pathname;
|
||||
}
|
||||
|
||||
// remove double slashes
|
||||
// note: path.normalize will not work because
|
||||
// it will convert forward to back slashes
|
||||
function drop_double_slashes(pathname) {
|
||||
return pathname.replace(/\/\//g,'/');
|
||||
}
|
||||
|
||||
function get_process_runtime(versions) {
|
||||
var runtime = 'node';
|
||||
if (versions['node-webkit']) {
|
||||
runtime = 'node-webkit';
|
||||
} else if (versions.electron) {
|
||||
runtime = 'electron';
|
||||
}
|
||||
return runtime;
|
||||
}
|
||||
|
||||
module.exports.get_process_runtime = get_process_runtime;
|
||||
|
||||
var default_package_name = '{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz';
|
||||
var default_remote_path = '';
|
||||
|
||||
module.exports.evaluate = function(package_json,options,napi_build_version) {
|
||||
options = options || {};
|
||||
validate_config(package_json);
|
||||
var v = package_json.version;
|
||||
var module_version = semver.parse(v);
|
||||
var runtime = options.runtime || get_process_runtime(process.versions);
|
||||
var opts = {
|
||||
name: package_json.name,
|
||||
configuration: Boolean(options.debug) ? 'Debug' : 'Release',
|
||||
debug: options.debug,
|
||||
module_name: package_json.binary.module_name,
|
||||
version: module_version.version,
|
||||
prerelease: module_version.prerelease.length ? module_version.prerelease.join('.') : '',
|
||||
build: module_version.build.length ? module_version.build.join('.') : '',
|
||||
major: module_version.major,
|
||||
minor: module_version.minor,
|
||||
patch: module_version.patch,
|
||||
runtime: runtime,
|
||||
node_abi: get_runtime_abi(runtime,options.target),
|
||||
node_abi_napi: napi.get_napi_version() ? 'napi' : get_runtime_abi(runtime,options.target),
|
||||
napi_version: napi.get_napi_version(), // non-zero numeric, undefined if unsupported
|
||||
napi_build_version: napi_build_version, // undefined if not specified
|
||||
target: options.target || '',
|
||||
platform: options.target_platform || process.platform,
|
||||
target_platform: options.target_platform || process.platform,
|
||||
arch: options.target_arch || process.arch,
|
||||
target_arch: options.target_arch || process.arch,
|
||||
libc: options.target_libc || detect_libc.family || 'unknown',
|
||||
module_main: package_json.main,
|
||||
toolset : options.toolset || '' // address https://github.com/mapbox/node-pre-gyp/issues/119
|
||||
};
|
||||
// support host mirror with npm config `--{module_name}_binary_host_mirror`
|
||||
// e.g.: https://github.com/node-inspector/v8-profiler/blob/master/package.json#L25
|
||||
// > npm install v8-profiler --profiler_binary_host_mirror=https://npm.taobao.org/mirrors/node-inspector/
|
||||
var host = process.env['npm_config_' + opts.module_name + '_binary_host_mirror'] || package_json.binary.host;
|
||||
opts.host = fix_slashes(eval_template(host,opts));
|
||||
opts.module_path = eval_template(package_json.binary.module_path,opts);
|
||||
// now we resolve the module_path to ensure it is absolute so that binding.gyp variables work predictably
|
||||
if (options.module_root) {
|
||||
// resolve relative to known module root: works for pre-binding require
|
||||
opts.module_path = path.join(options.module_root,opts.module_path);
|
||||
} else {
|
||||
// resolve relative to current working directory: works for node-pre-gyp commands
|
||||
opts.module_path = path.resolve(opts.module_path);
|
||||
}
|
||||
opts.module = path.join(opts.module_path,opts.module_name + '.node');
|
||||
opts.remote_path = package_json.binary.remote_path ? drop_double_slashes(fix_slashes(eval_template(package_json.binary.remote_path,opts))) : default_remote_path;
|
||||
var package_name = package_json.binary.package_name ? package_json.binary.package_name : default_package_name;
|
||||
opts.package_name = eval_template(package_name,opts);
|
||||
opts.staged_tarball = path.join('build/stage',opts.remote_path,opts.package_name);
|
||||
opts.hosted_path = url.resolve(opts.host,opts.remote_path);
|
||||
opts.hosted_tarball = url.resolve(opts.hosted_path,opts.package_name);
|
||||
return opts;
|
||||
};
|
||||
39
node_modules/libxmljs/node_modules/node-pre-gyp/package.json
generated
vendored
Normal file
39
node_modules/libxmljs/node_modules/node-pre-gyp/package.json
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "node-pre-gyp",
|
||||
"description": "Node.js native addon binary install tool",
|
||||
"version": "0.9.1",
|
||||
"license": "BSD-3-Clause",
|
||||
"author": "Dane Springmeyer <dane@mapbox.com>",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/mapbox/node-pre-gyp.git"
|
||||
},
|
||||
"bin": "./bin/node-pre-gyp",
|
||||
"main": "./lib/node-pre-gyp.js",
|
||||
"dependencies": {
|
||||
"detect-libc": "^1.0.2",
|
||||
"mkdirp": "^0.5.1",
|
||||
"needle": "^2.2.0",
|
||||
"nopt": "^4.0.1",
|
||||
"npm-packlist": "^1.1.6",
|
||||
"npmlog": "^4.0.2",
|
||||
"rc": "^1.1.7",
|
||||
"rimraf": "^2.6.1",
|
||||
"semver": "^5.3.0",
|
||||
"tar": "^4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"aws-sdk": "^2.28.0",
|
||||
"jshint": "^2.9.5",
|
||||
"nock": "^9.2.3",
|
||||
"retire": "^1.2.12",
|
||||
"tape": "^4.6.3"
|
||||
},
|
||||
"jshintConfig": {
|
||||
"node": true,
|
||||
"globalstrict": true,
|
||||
"undef": true,
|
||||
"unused": false,
|
||||
"noarg": true
|
||||
}
|
||||
}
|
||||
31
node_modules/libxmljs/package.json
generated
vendored
Normal file
31
node_modules/libxmljs/package.json
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "libxmljs",
|
||||
"author": "Marco Rogers",
|
||||
"binary": {
|
||||
"module_name": "xmljs",
|
||||
"module_path": "./build/Release/",
|
||||
"host": "https://github.com",
|
||||
"remote_path": "./libxmljs/libxmljs/releases/download/v{version}/",
|
||||
"package_name": "{node_abi}-{platform}-{arch}.tar.gz"
|
||||
},
|
||||
"description": "libxml bindings for v8 javascript engine",
|
||||
"version": "0.18.8",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/libxmljs/libxmljs.git"
|
||||
},
|
||||
"main": "./index",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"bindings": "^1.3.0",
|
||||
"nan": "~2.10.0",
|
||||
"node-pre-gyp": "^0.9.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodeunit": "^0.11.2",
|
||||
"semver": "5.5.0"
|
||||
}
|
||||
}
|
||||
19
node_modules/libxmljs/src/html_document.h
generated
vendored
Normal file
19
node_modules/libxmljs/src/html_document.h
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_HTML_DOCUMENT_H_
|
||||
#define SRC_HTML_DOCUMENT_H_
|
||||
|
||||
#include "libxmljs.h"
|
||||
#include "xml_document.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class HtmlDocument : public XmlDocument {
|
||||
public:
|
||||
|
||||
explicit HtmlDocument(xmlDoc* doc) : XmlDocument(doc) {}
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_HTML_DOCUMENT_H_
|
||||
34
node_modules/libxmljs/src/libxmljs.h
generated
vendored
Normal file
34
node_modules/libxmljs/src/libxmljs.h
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_LIBXMLJS_H_
|
||||
#define SRC_LIBXMLJS_H_
|
||||
|
||||
#include <v8.h>
|
||||
#include <node.h>
|
||||
#include "nan.h"
|
||||
|
||||
#define LIBXMLJS_ARGUMENT_TYPE_CHECK(arg, type, err) \
|
||||
if (!arg->type()) { \
|
||||
return Nan::ThrowTypeError(err); \
|
||||
}
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
#ifdef LIBXML_DEBUG_ENABLED
|
||||
static const bool debugging = true;
|
||||
#else
|
||||
static const bool debugging = false;
|
||||
#endif
|
||||
|
||||
// Ensure that libxml is properly initialised and destructed at shutdown
|
||||
class LibXMLJS {
|
||||
public:
|
||||
LibXMLJS();
|
||||
virtual ~LibXMLJS();
|
||||
|
||||
private:
|
||||
static LibXMLJS instance;
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_LIBXMLJS_H_
|
||||
42
node_modules/libxmljs/src/xml_attribute.h
generated
vendored
Normal file
42
node_modules/libxmljs/src/xml_attribute.h
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_ATTRIBUTE_H_
|
||||
#define SRC_XML_ATTRIBUTE_H_
|
||||
|
||||
#include "libxmljs.h"
|
||||
#include "xml_element.h"
|
||||
#include "xml_namespace.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlAttribute : public XmlNode {
|
||||
public:
|
||||
|
||||
explicit XmlAttribute(xmlAttr* node) :
|
||||
XmlNode(reinterpret_cast<xmlNode*>(node)) {}
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
static v8::Local<v8::Object> New(xmlNode* xml_obj,
|
||||
const xmlChar* name, const xmlChar* value);
|
||||
|
||||
static v8::Local<v8::Object> New(xmlAttr* attr);
|
||||
|
||||
protected:
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(Name);
|
||||
static NAN_METHOD(Value);
|
||||
static NAN_METHOD(Node);
|
||||
static NAN_METHOD(Namespace);
|
||||
|
||||
v8::Local<v8::Value> get_name();
|
||||
v8::Local<v8::Value> get_value();
|
||||
void set_value(const char* value);
|
||||
v8::Local<v8::Value> get_element();
|
||||
v8::Local<v8::Value> get_namespace();
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_ATTRIBUTE_H_
|
||||
32
node_modules/libxmljs/src/xml_comment.h
generated
vendored
Normal file
32
node_modules/libxmljs/src/xml_comment.h
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef SRC_XML_COMMENT_H_
|
||||
#define SRC_XML_COMMENT_H_
|
||||
|
||||
#include "libxmljs.h"
|
||||
#include "xml_node.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlComment : public XmlNode {
|
||||
public:
|
||||
|
||||
explicit XmlComment(xmlNode* node);
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
// create new xml comment to wrap the node
|
||||
static v8::Local<v8::Object> New(xmlNode* node);
|
||||
|
||||
protected:
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(Text);
|
||||
|
||||
void set_content(const char* content);
|
||||
v8::Local<v8::Value> get_content();
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_COMMENT_H_
|
||||
67
node_modules/libxmljs/src/xml_document.h
generated
vendored
Normal file
67
node_modules/libxmljs/src/xml_document.h
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_DOCUMENT_H_
|
||||
#define SRC_XML_DOCUMENT_H_
|
||||
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#include "libxmljs.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlDocument : public Nan::ObjectWrap {
|
||||
|
||||
// used to create new instanced of a document handle
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
public:
|
||||
// TODO make private with accessor
|
||||
xmlDoc* xml_obj;
|
||||
|
||||
virtual ~XmlDocument();
|
||||
|
||||
// setup the document handle bindings and internal constructor
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
|
||||
// create a new document handle initialized with the
|
||||
// given xmlDoc object, intended for use in c++ space
|
||||
static v8::Local<v8::Object> New(xmlDoc* doc);
|
||||
|
||||
// publicly expose ref functions
|
||||
using Nan::ObjectWrap::Ref;
|
||||
using Nan::ObjectWrap::Unref;
|
||||
|
||||
// expose ObjectWrap::refs_ (for testing)
|
||||
int refs() {
|
||||
return refs_;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// initialize a new document
|
||||
explicit XmlDocument(xmlDoc* doc);
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(FromHtml);
|
||||
static NAN_METHOD(FromXml);
|
||||
static NAN_METHOD(SetDtd);
|
||||
|
||||
// document handle methods
|
||||
static NAN_METHOD(Root);
|
||||
static NAN_METHOD(GetDtd);
|
||||
static NAN_METHOD(Encoding);
|
||||
static NAN_METHOD(Version);
|
||||
static NAN_METHOD(Doc);
|
||||
static NAN_METHOD(Errors);
|
||||
static NAN_METHOD(ToString);
|
||||
static NAN_METHOD(Validate);
|
||||
static NAN_METHOD(RngValidate);
|
||||
|
||||
|
||||
// Static member variables
|
||||
static const int DEFAULT_PARSING_OPTS;
|
||||
static const int EXCLUDE_IMPLIED_ELEMENTS;
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_DOCUMENT_H_
|
||||
65
node_modules/libxmljs/src/xml_element.h
generated
vendored
Normal file
65
node_modules/libxmljs/src/xml_element.h
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_ELEMENT_H_
|
||||
#define SRC_XML_ELEMENT_H_
|
||||
|
||||
#include "libxmljs.h"
|
||||
#include "xml_node.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlElement : public XmlNode {
|
||||
public:
|
||||
|
||||
explicit XmlElement(xmlNode* node);
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
// create new xml element to wrap the node
|
||||
static v8::Local<v8::Object> New(xmlNode* node);
|
||||
|
||||
protected:
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(Name);
|
||||
static NAN_METHOD(Attr);
|
||||
static NAN_METHOD(Attrs);
|
||||
static NAN_METHOD(Find);
|
||||
static NAN_METHOD(Text);
|
||||
static NAN_METHOD(Path);
|
||||
static NAN_METHOD(Child);
|
||||
static NAN_METHOD(ChildNodes);
|
||||
static NAN_METHOD(AddChild);
|
||||
static NAN_METHOD(AddCData);
|
||||
static NAN_METHOD(NextElement);
|
||||
static NAN_METHOD(PrevElement);
|
||||
static NAN_METHOD(AddPrevSibling);
|
||||
static NAN_METHOD(AddNextSibling);
|
||||
static NAN_METHOD(Replace);
|
||||
|
||||
void set_name(const char* name);
|
||||
|
||||
v8::Local<v8::Value> get_name();
|
||||
v8::Local<v8::Value> get_child(int32_t idx);
|
||||
v8::Local<v8::Value> get_child_nodes();
|
||||
v8::Local<v8::Value> get_path();
|
||||
v8::Local<v8::Value> get_attr(const char* name);
|
||||
v8::Local<v8::Value> get_attrs();
|
||||
void set_attr(const char* name, const char* value);
|
||||
void add_cdata(xmlNode* cdata);
|
||||
void unlink_children();
|
||||
void set_content(const char* content);
|
||||
v8::Local<v8::Value> get_content();
|
||||
v8::Local<v8::Value> get_next_element();
|
||||
v8::Local<v8::Value> get_prev_element();
|
||||
void replace_element(xmlNode* element);
|
||||
void replace_text(const char* content);
|
||||
bool child_will_merge(xmlNode* child);
|
||||
bool prev_sibling_will_merge(xmlNode* node);
|
||||
bool next_sibling_will_merge(xmlNode* node);
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_ELEMENT_H_
|
||||
41
node_modules/libxmljs/src/xml_namespace.h
generated
vendored
Normal file
41
node_modules/libxmljs/src/xml_namespace.h
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_NAMESPACE_H_
|
||||
#define SRC_XML_NAMESPACE_H_
|
||||
|
||||
#include <node.h>
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "nan.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlNamespace : public Nan::ObjectWrap {
|
||||
public:
|
||||
|
||||
xmlNs* xml_obj;
|
||||
|
||||
xmlDoc* context; // reference-managed context
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
explicit XmlNamespace(xmlNs* ns);
|
||||
XmlNamespace(xmlNs* node, const char* prefix, const char* href);
|
||||
~XmlNamespace();
|
||||
|
||||
static v8::Local<v8::Object> New(xmlNs* ns);
|
||||
|
||||
protected:
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(Href);
|
||||
static NAN_METHOD(Prefix);
|
||||
|
||||
v8::Local<v8::Value> get_href();
|
||||
v8::Local<v8::Value> get_prefix();
|
||||
|
||||
friend class Node;
|
||||
};
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_NAMESPACE_H_
|
||||
77
node_modules/libxmljs/src/xml_node.h
generated
vendored
Normal file
77
node_modules/libxmljs/src/xml_node.h
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_NODE_H_
|
||||
#define SRC_XML_NODE_H_
|
||||
|
||||
#include <libxml/tree.h>
|
||||
#include "nan.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlNode : public Nan::ObjectWrap {
|
||||
public:
|
||||
|
||||
xmlNode* xml_obj;
|
||||
|
||||
// reference to a parent XmlNode or XmlElement
|
||||
xmlNode* ancestor;
|
||||
|
||||
// referencing functions
|
||||
void ref_wrapped_ancestor();
|
||||
void unref_wrapped_ancestor();
|
||||
xmlNode* get_wrapped_ancestor();
|
||||
int refs() {
|
||||
return refs_;
|
||||
};
|
||||
|
||||
// the doc ref'd by this proxy
|
||||
xmlDoc* doc;
|
||||
|
||||
explicit XmlNode(xmlNode* node);
|
||||
virtual ~XmlNode();
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
// create new XmlElement, XmlAttribute, etc. to wrap a libxml xmlNode
|
||||
static v8::Local<v8::Value> New(xmlNode* node);
|
||||
|
||||
protected:
|
||||
|
||||
static NAN_METHOD(Doc);
|
||||
static NAN_METHOD(Namespace);
|
||||
static NAN_METHOD(Namespaces);
|
||||
static NAN_METHOD(Parent);
|
||||
static NAN_METHOD(NextSibling);
|
||||
static NAN_METHOD(PrevSibling);
|
||||
static NAN_METHOD(LineNumber);
|
||||
static NAN_METHOD(Type);
|
||||
static NAN_METHOD(ToString);
|
||||
static NAN_METHOD(Remove);
|
||||
static NAN_METHOD(Clone);
|
||||
|
||||
v8::Local<v8::Value> get_doc();
|
||||
v8::Local<v8::Value> remove_namespace();
|
||||
v8::Local<v8::Value> get_namespace();
|
||||
void set_namespace(xmlNs* ns);
|
||||
xmlNs * find_namespace(const char * search_str);
|
||||
v8::Local<v8::Value> get_all_namespaces();
|
||||
v8::Local<v8::Value> get_local_namespaces();
|
||||
v8::Local<v8::Value> get_parent();
|
||||
v8::Local<v8::Value> get_prev_sibling();
|
||||
v8::Local<v8::Value> get_next_sibling();
|
||||
v8::Local<v8::Value> get_line_number();
|
||||
v8::Local<v8::Value> clone(bool recurse);
|
||||
v8::Local<v8::Value> get_type();
|
||||
v8::Local<v8::Value> to_string(int options = 0);
|
||||
void remove();
|
||||
void add_child(xmlNode* child);
|
||||
void add_prev_sibling(xmlNode* element);
|
||||
void add_next_sibling(xmlNode* element);
|
||||
void replace_element(xmlNode* element);
|
||||
void replace_text(const char* content);
|
||||
xmlNode *import_node(xmlNode* node);
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_NODE_H_
|
||||
104
node_modules/libxmljs/src/xml_sax_parser.h
generated
vendored
Normal file
104
node_modules/libxmljs/src/xml_sax_parser.h
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_SAX_PARSER_H_
|
||||
#define SRC_XML_SAX_PARSER_H_
|
||||
|
||||
#include <node.h>
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlSaxParser : public Nan::ObjectWrap {
|
||||
public:
|
||||
|
||||
XmlSaxParser();
|
||||
virtual ~XmlSaxParser();
|
||||
|
||||
static void
|
||||
Initialize(v8::Handle<v8::Object> target);
|
||||
|
||||
static NAN_METHOD(NewParser);
|
||||
|
||||
static NAN_METHOD(NewPushParser);
|
||||
|
||||
static NAN_METHOD(ParseString);
|
||||
static NAN_METHOD(Push);
|
||||
|
||||
void
|
||||
Callback(const char* what,
|
||||
int argc = 0,
|
||||
v8::Local<v8::Value> argv[] = NULL);
|
||||
|
||||
void
|
||||
parse_string(const char* str,
|
||||
unsigned int size);
|
||||
|
||||
void
|
||||
initialize_push_parser();
|
||||
|
||||
void
|
||||
push(const char* str,
|
||||
unsigned int size,
|
||||
bool terminate);
|
||||
|
||||
/// callbacks
|
||||
|
||||
static void
|
||||
start_document(void* context);
|
||||
|
||||
static void
|
||||
end_document(void* context);
|
||||
|
||||
static void
|
||||
start_element(void* context,
|
||||
const xmlChar* name,
|
||||
const xmlChar** p);
|
||||
|
||||
static void
|
||||
end_element(void* context, const xmlChar* name);
|
||||
|
||||
static void
|
||||
start_element_ns(void* context,
|
||||
const xmlChar* localname,
|
||||
const xmlChar* prefix,
|
||||
const xmlChar* uri,
|
||||
int nb_namespaces,
|
||||
const xmlChar** namespaces,
|
||||
int nb_attributes,
|
||||
int nb_defaulted,
|
||||
const xmlChar** attributes);
|
||||
|
||||
static void
|
||||
end_element_ns(void* context,
|
||||
const xmlChar* localname,
|
||||
const xmlChar* prefix,
|
||||
const xmlChar* uri);
|
||||
|
||||
static void
|
||||
characters(void* context,
|
||||
const xmlChar* ch,
|
||||
int len);
|
||||
|
||||
static void
|
||||
comment(void* context, const xmlChar* value);
|
||||
|
||||
static void
|
||||
cdata_block(void* context, const xmlChar* value, int len);
|
||||
|
||||
static void
|
||||
warning(void* context, const char* msg, ...);
|
||||
|
||||
static void
|
||||
error(void* context, const char* msg, ...);
|
||||
|
||||
protected:
|
||||
|
||||
void initializeContext();
|
||||
void releaseContext();
|
||||
|
||||
xmlParserCtxt* context_;
|
||||
|
||||
xmlSAXHandler sax_handler_;
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_SAX_PARSER_H_
|
||||
25
node_modules/libxmljs/src/xml_syntax_error.h
generated
vendored
Normal file
25
node_modules/libxmljs/src/xml_syntax_error.h
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_SYNTAX_ERROR_H_
|
||||
#define SRC_XML_SYNTAX_ERROR_H_
|
||||
|
||||
#include <libxml/xmlerror.h>
|
||||
|
||||
#include "libxmljs.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
// basically being used like a namespace
|
||||
class XmlSyntaxError {
|
||||
public:
|
||||
// push xmlError onto v8::Array
|
||||
// helper method for xml library
|
||||
static void PushToArray(void* errs, xmlError* error);
|
||||
|
||||
// create a v8 object for the syntax eror
|
||||
// TODO make it a v8 Erorr object
|
||||
static v8::Local<v8::Value> BuildSyntaxError(xmlError* error);
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_SYNTAX_ERROR_H_
|
||||
48
node_modules/libxmljs/src/xml_text.h
generated
vendored
Normal file
48
node_modules/libxmljs/src/xml_text.h
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef SRC_XML_TEXT_H_
|
||||
#define SRC_XML_TEXT_H_
|
||||
|
||||
#include "libxmljs.h"
|
||||
#include "xml_node.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlText : public XmlNode {
|
||||
public:
|
||||
|
||||
explicit XmlText(xmlNode* node);
|
||||
|
||||
static void Initialize(v8::Handle<v8::Object> target);
|
||||
|
||||
static Nan::Persistent<v8::FunctionTemplate> constructor_template;
|
||||
|
||||
// create new xml element to wrap the node
|
||||
static v8::Local<v8::Object> New(xmlNode* node);
|
||||
|
||||
protected:
|
||||
|
||||
static NAN_METHOD(New);
|
||||
static NAN_METHOD(Text);
|
||||
static NAN_METHOD(Replace);
|
||||
|
||||
static NAN_METHOD(NextElement);
|
||||
static NAN_METHOD(PrevElement);
|
||||
static NAN_METHOD(AddPrevSibling);
|
||||
static NAN_METHOD(AddNextSibling);
|
||||
|
||||
|
||||
v8::Local<v8::Value> get_next_element();
|
||||
v8::Local<v8::Value> get_prev_element();
|
||||
v8::Local<v8::Value> get_content();
|
||||
void set_content(const char* content);
|
||||
void replace_text(const char* content);
|
||||
void replace_element(xmlNode* element);
|
||||
void add_prev_sibling(xmlNode* element);
|
||||
void add_next_sibling(xmlNode* element);
|
||||
bool prev_sibling_will_merge(xmlNode* node);
|
||||
bool next_sibling_will_merge(xmlNode* node);
|
||||
|
||||
};
|
||||
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_TEXT_H_
|
||||
24
node_modules/libxmljs/src/xml_xpath_context.h
generated
vendored
Normal file
24
node_modules/libxmljs/src/xml_xpath_context.h
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// Copyright 2009, Squish Tech, LLC.
|
||||
#ifndef SRC_XML_XPATH_CONTEXT_H_
|
||||
#define SRC_XML_XPATH_CONTEXT_H_
|
||||
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
#include "libxmljs.h"
|
||||
|
||||
namespace libxmljs {
|
||||
|
||||
class XmlXpathContext {
|
||||
public:
|
||||
|
||||
explicit XmlXpathContext(xmlNode* node);
|
||||
~XmlXpathContext();
|
||||
|
||||
void register_ns(const xmlChar* prefix, const xmlChar* uri);
|
||||
v8::Local<v8::Value> evaluate(const xmlChar* xpath);
|
||||
|
||||
xmlXPathContext *ctxt;
|
||||
};
|
||||
} // namespace libxmljs
|
||||
|
||||
#endif // SRC_XML_XPATH_CONTEXT_H_
|
||||
23
node_modules/libxmljs/vendor/libxml/Copyright
generated
vendored
Normal file
23
node_modules/libxmljs/vendor/libxml/Copyright
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
Except where otherwise noted in the source code (e.g. the files hash.c,
|
||||
list.c and the trio files, which are covered by a similar licence but
|
||||
with different Copyright notices) all the files are:
|
||||
|
||||
Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is fur-
|
||||
nished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
|
||||
NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
305
node_modules/libxmljs/vendor/libxml/DOCBparser.c
generated
vendored
Normal file
305
node_modules/libxmljs/vendor/libxml/DOCBparser.c
generated
vendored
Normal file
@@ -0,0 +1,305 @@
|
||||
/*
|
||||
* DOCBparser.c : an attempt to parse SGML Docbook documents
|
||||
*
|
||||
* This is deprecated !!!
|
||||
* Code removed with release 2.6.0 it was broken.
|
||||
* The doc are expect to be migrated to XML DocBook
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* daniel@veillard.com
|
||||
*/
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/DOCBparser.h>
|
||||
|
||||
/**
|
||||
* docbEncodeEntities:
|
||||
* @out: a pointer to an array of bytes to store the result
|
||||
* @outlen: the length of @out
|
||||
* @in: a pointer to an array of UTF-8 chars
|
||||
* @inlen: the length of @in
|
||||
* @quoteChar: the quote character to escape (' or ") or zero.
|
||||
*
|
||||
* Take a block of UTF-8 chars in and try to convert it to an ASCII
|
||||
* plus SGML entities block of chars out.
|
||||
*
|
||||
* Returns 0 if success, -2 if the transcoding fails, or -1 otherwise
|
||||
* The value of @inlen after return is the number of octets consumed
|
||||
* as the return value is positive, else unpredictable.
|
||||
* The value of @outlen after return is the number of octets consumed.
|
||||
*/
|
||||
int
|
||||
docbEncodeEntities(unsigned char *out ATTRIBUTE_UNUSED,
|
||||
int *outlen ATTRIBUTE_UNUSED,
|
||||
const unsigned char *in ATTRIBUTE_UNUSED,
|
||||
int *inlen ATTRIBUTE_UNUSED,
|
||||
int quoteChar ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbEncodeEntities() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseDocument:
|
||||
* @ctxt: an SGML parser context
|
||||
*
|
||||
* parse an SGML document (and build a tree if using the standard SAX
|
||||
* interface).
|
||||
*
|
||||
* Returns 0, -1 in case of error. the parser context is augmented
|
||||
* as a result of the parsing.
|
||||
*/
|
||||
|
||||
int
|
||||
docbParseDocument(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseDocument() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
return (xmlParseDocument(ctxt));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbFreeParserCtxt:
|
||||
* @ctxt: an SGML parser context
|
||||
*
|
||||
* Free all the memory used by a parser context. However the parsed
|
||||
* document in ctxt->myDoc is not freed.
|
||||
*/
|
||||
|
||||
void
|
||||
docbFreeParserCtxt(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbFreeParserCtxt() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
xmlFreeParserCtxt(ctxt);
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseChunk:
|
||||
* @ctxt: an XML parser context
|
||||
* @chunk: an char array
|
||||
* @size: the size in byte of the chunk
|
||||
* @terminate: last chunk indicator
|
||||
*
|
||||
* Parse a Chunk of memory
|
||||
*
|
||||
* Returns zero if no error, the xmlParserErrors otherwise.
|
||||
*/
|
||||
int
|
||||
docbParseChunk(docbParserCtxtPtr ctxt ATTRIBUTE_UNUSED,
|
||||
const char *chunk ATTRIBUTE_UNUSED,
|
||||
int size ATTRIBUTE_UNUSED,
|
||||
int terminate ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlParseChunk(ctxt, chunk, size, terminate));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbCreatePushParserCtxt:
|
||||
* @sax: a SAX handler
|
||||
* @user_data: The user data returned on SAX callbacks
|
||||
* @chunk: a pointer to an array of chars
|
||||
* @size: number of chars in the array
|
||||
* @filename: an optional file name or URI
|
||||
* @enc: an optional encoding
|
||||
*
|
||||
* Create a parser context for using the DocBook SGML parser in push mode
|
||||
* To allow content encoding detection, @size should be >= 4
|
||||
* The value of @filename is used for fetching external entities
|
||||
* and error/warning reports.
|
||||
*
|
||||
* Returns the new parser context or NULL
|
||||
*/
|
||||
docbParserCtxtPtr
|
||||
docbCreatePushParserCtxt(docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
|
||||
void *user_data ATTRIBUTE_UNUSED,
|
||||
const char *chunk ATTRIBUTE_UNUSED,
|
||||
int size ATTRIBUTE_UNUSED,
|
||||
const char *filename ATTRIBUTE_UNUSED,
|
||||
xmlCharEncoding enc ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return(xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbSAXParseDoc:
|
||||
* @cur: a pointer to an array of xmlChar
|
||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
||||
* @sax: the SAX handler block
|
||||
* @userData: if using SAX, this pointer will be provided on callbacks.
|
||||
*
|
||||
* parse an SGML in-memory document and build a tree.
|
||||
* It use the given SAX function block to handle the parsing callback.
|
||||
* If sax is NULL, fallback to the default DOM tree building routines.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbSAXParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED,
|
||||
docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
|
||||
void *userData ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlSAXParseMemoryWithData(sax, (const char *)cur,
|
||||
xmlStrlen((const xmlChar *) cur), 0, userData));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseDoc:
|
||||
* @cur: a pointer to an array of xmlChar
|
||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
||||
*
|
||||
* parse an SGML in-memory document and build a tree.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbParseDoc(xmlChar * cur ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseChunk() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlParseDoc(cur));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* docbCreateFileParserCtxt:
|
||||
* @filename: the filename
|
||||
* @encoding: the SGML document encoding, or NULL
|
||||
*
|
||||
* Create a parser context for a file content.
|
||||
* Automatic support for ZLIB/Compress compressed document is provided
|
||||
* by default if found at compile-time.
|
||||
*
|
||||
* Returns the new parser context or NULL
|
||||
*/
|
||||
docbParserCtxtPtr
|
||||
docbCreateFileParserCtxt(const char *filename ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbCreateFileParserCtxt() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlCreateFileParserCtxt(filename));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbSAXParseFile:
|
||||
* @filename: the filename
|
||||
* @encoding: a free form C string describing the SGML document encoding, or NULL
|
||||
* @sax: the SAX handler block
|
||||
* @userData: if using SAX, this pointer will be provided on callbacks.
|
||||
*
|
||||
* parse an SGML file and build a tree. Automatic support for ZLIB/Compress
|
||||
* compressed document is provided by default if found at compile-time.
|
||||
* It use the given SAX function block to handle the parsing callback.
|
||||
* If sax is NULL, fallback to the default DOM tree building routines.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbSAXParseFile(const char *filename ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED,
|
||||
docbSAXHandlerPtr sax ATTRIBUTE_UNUSED,
|
||||
void *userData ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbSAXParseFile() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlSAXParseFileWithData(sax, filename, 0, userData));
|
||||
}
|
||||
|
||||
/**
|
||||
* docbParseFile:
|
||||
* @filename: the filename
|
||||
* @encoding: a free form C string describing document encoding, or NULL
|
||||
*
|
||||
* parse a Docbook SGML file and build a tree. Automatic support for
|
||||
* ZLIB/Compress compressed document is provided by default if found
|
||||
* at compile-time.
|
||||
*
|
||||
* Returns the resulting document tree
|
||||
*/
|
||||
|
||||
docbDocPtr
|
||||
docbParseFile(const char *filename ATTRIBUTE_UNUSED,
|
||||
const char *encoding ATTRIBUTE_UNUSED)
|
||||
{
|
||||
static int deprecated = 0;
|
||||
|
||||
if (!deprecated) {
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"docbParseFile() deprecated function reached\n");
|
||||
deprecated = 1;
|
||||
}
|
||||
|
||||
return (xmlParseFile(filename));
|
||||
}
|
||||
#define bottom_DOCBparser
|
||||
#include "elfgcchack.h"
|
||||
#endif /* LIBXML_DOCB_ENABLED */
|
||||
7165
node_modules/libxmljs/vendor/libxml/HTMLparser.c
generated
vendored
Normal file
7165
node_modules/libxmljs/vendor/libxml/HTMLparser.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1281
node_modules/libxmljs/vendor/libxml/HTMLtree.c
generated
vendored
Normal file
1281
node_modules/libxmljs/vendor/libxml/HTMLtree.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
180
node_modules/libxmljs/vendor/libxml/SAX.c
generated
vendored
Normal file
180
node_modules/libxmljs/vendor/libxml/SAX.c
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* SAX.c : Old SAX v1 handlers to build a tree.
|
||||
* Deprecated except for compatibility
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Daniel Veillard <daniel@veillard.com>
|
||||
*/
|
||||
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/entities.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/debugXML.h>
|
||||
#include <libxml/xmlIO.h>
|
||||
#include <libxml/SAX.h>
|
||||
#include <libxml/uri.h>
|
||||
#include <libxml/valid.h>
|
||||
#include <libxml/HTMLtree.h>
|
||||
#include <libxml/globals.h>
|
||||
#include <libxml/SAX2.h>
|
||||
|
||||
#ifdef LIBXML_LEGACY_ENABLED
|
||||
#ifdef LIBXML_SAX1_ENABLED
|
||||
/**
|
||||
* initxmlDefaultSAXHandler:
|
||||
* @hdlr: the SAX handler
|
||||
* @warning: flag if non-zero sets the handler warning procedure
|
||||
*
|
||||
* Initialize the default XML SAX version 1 handler
|
||||
* DEPRECATED: use xmlSAX2InitDefaultSAXHandler() for the new SAX2 blocks
|
||||
*/
|
||||
void
|
||||
initxmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr, int warning)
|
||||
{
|
||||
|
||||
if(hdlr->initialized == 1)
|
||||
return;
|
||||
|
||||
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||
hdlr->externalSubset = xmlSAX2ExternalSubset;
|
||||
hdlr->isStandalone = xmlSAX2IsStandalone;
|
||||
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
|
||||
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
|
||||
hdlr->resolveEntity = xmlSAX2ResolveEntity;
|
||||
hdlr->getEntity = xmlSAX2GetEntity;
|
||||
hdlr->getParameterEntity = xmlSAX2GetParameterEntity;
|
||||
hdlr->entityDecl = xmlSAX2EntityDecl;
|
||||
hdlr->attributeDecl = xmlSAX2AttributeDecl;
|
||||
hdlr->elementDecl = xmlSAX2ElementDecl;
|
||||
hdlr->notationDecl = xmlSAX2NotationDecl;
|
||||
hdlr->unparsedEntityDecl = xmlSAX2UnparsedEntityDecl;
|
||||
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
||||
hdlr->startDocument = xmlSAX2StartDocument;
|
||||
hdlr->endDocument = xmlSAX2EndDocument;
|
||||
hdlr->startElement = xmlSAX2StartElement;
|
||||
hdlr->endElement = xmlSAX2EndElement;
|
||||
hdlr->reference = xmlSAX2Reference;
|
||||
hdlr->characters = xmlSAX2Characters;
|
||||
hdlr->cdataBlock = xmlSAX2CDataBlock;
|
||||
hdlr->ignorableWhitespace = xmlSAX2Characters;
|
||||
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
|
||||
if (warning == 0)
|
||||
hdlr->warning = NULL;
|
||||
else
|
||||
hdlr->warning = xmlParserWarning;
|
||||
hdlr->error = xmlParserError;
|
||||
hdlr->fatalError = xmlParserError;
|
||||
|
||||
hdlr->initialized = 1;
|
||||
}
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
/**
|
||||
* inithtmlDefaultSAXHandler:
|
||||
* @hdlr: the SAX handler
|
||||
*
|
||||
* Initialize the default HTML SAX version 1 handler
|
||||
* DEPRECATED: use xmlSAX2InitHtmlDefaultSAXHandler() for the new SAX2 blocks
|
||||
*/
|
||||
void
|
||||
inithtmlDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
|
||||
{
|
||||
if(hdlr->initialized == 1)
|
||||
return;
|
||||
|
||||
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||
hdlr->externalSubset = NULL;
|
||||
hdlr->isStandalone = NULL;
|
||||
hdlr->hasInternalSubset = NULL;
|
||||
hdlr->hasExternalSubset = NULL;
|
||||
hdlr->resolveEntity = NULL;
|
||||
hdlr->getEntity = xmlSAX2GetEntity;
|
||||
hdlr->getParameterEntity = NULL;
|
||||
hdlr->entityDecl = NULL;
|
||||
hdlr->attributeDecl = NULL;
|
||||
hdlr->elementDecl = NULL;
|
||||
hdlr->notationDecl = NULL;
|
||||
hdlr->unparsedEntityDecl = NULL;
|
||||
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
||||
hdlr->startDocument = xmlSAX2StartDocument;
|
||||
hdlr->endDocument = xmlSAX2EndDocument;
|
||||
hdlr->startElement = xmlSAX2StartElement;
|
||||
hdlr->endElement = xmlSAX2EndElement;
|
||||
hdlr->reference = NULL;
|
||||
hdlr->characters = xmlSAX2Characters;
|
||||
hdlr->cdataBlock = xmlSAX2CDataBlock;
|
||||
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
||||
hdlr->processingInstruction = xmlSAX2ProcessingInstruction;
|
||||
hdlr->comment = xmlSAX2Comment;
|
||||
hdlr->warning = xmlParserWarning;
|
||||
hdlr->error = xmlParserError;
|
||||
hdlr->fatalError = xmlParserError;
|
||||
|
||||
hdlr->initialized = 1;
|
||||
}
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
/**
|
||||
* initdocbDefaultSAXHandler:
|
||||
* @hdlr: the SAX handler
|
||||
*
|
||||
* Initialize the default DocBook SAX version 1 handler
|
||||
* DEPRECATED: use xmlSAX2InitDocbDefaultSAXHandler() for the new SAX2 blocks
|
||||
*/
|
||||
void
|
||||
initdocbDefaultSAXHandler(xmlSAXHandlerV1 *hdlr)
|
||||
{
|
||||
if(hdlr->initialized == 1)
|
||||
return;
|
||||
|
||||
hdlr->internalSubset = xmlSAX2InternalSubset;
|
||||
hdlr->externalSubset = NULL;
|
||||
hdlr->isStandalone = xmlSAX2IsStandalone;
|
||||
hdlr->hasInternalSubset = xmlSAX2HasInternalSubset;
|
||||
hdlr->hasExternalSubset = xmlSAX2HasExternalSubset;
|
||||
hdlr->resolveEntity = xmlSAX2ResolveEntity;
|
||||
hdlr->getEntity = xmlSAX2GetEntity;
|
||||
hdlr->getParameterEntity = NULL;
|
||||
hdlr->entityDecl = xmlSAX2EntityDecl;
|
||||
hdlr->attributeDecl = NULL;
|
||||
hdlr->elementDecl = NULL;
|
||||
hdlr->notationDecl = NULL;
|
||||
hdlr->unparsedEntityDecl = NULL;
|
||||
hdlr->setDocumentLocator = xmlSAX2SetDocumentLocator;
|
||||
hdlr->startDocument = xmlSAX2StartDocument;
|
||||
hdlr->endDocument = xmlSAX2EndDocument;
|
||||
hdlr->startElement = xmlSAX2StartElement;
|
||||
hdlr->endElement = xmlSAX2EndElement;
|
||||
hdlr->reference = xmlSAX2Reference;
|
||||
hdlr->characters = xmlSAX2Characters;
|
||||
hdlr->cdataBlock = NULL;
|
||||
hdlr->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
|
||||
hdlr->processingInstruction = NULL;
|
||||
hdlr->comment = xmlSAX2Comment;
|
||||
hdlr->warning = xmlParserWarning;
|
||||
hdlr->error = xmlParserError;
|
||||
hdlr->fatalError = xmlParserError;
|
||||
|
||||
hdlr->initialized = 1;
|
||||
}
|
||||
|
||||
#endif /* LIBXML_DOCB_ENABLED */
|
||||
|
||||
#endif /* LIBXML_SAX1_ENABLED */
|
||||
|
||||
#define bottom_SAX
|
||||
#include "elfgcchack.h"
|
||||
#endif /* LIBXML_LEGACY_ENABLED */
|
||||
3045
node_modules/libxmljs/vendor/libxml/SAX2.c
generated
vendored
Normal file
3045
node_modules/libxmljs/vendor/libxml/SAX2.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1345
node_modules/libxmljs/vendor/libxml/buf.c
generated
vendored
Normal file
1345
node_modules/libxmljs/vendor/libxml/buf.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
72
node_modules/libxmljs/vendor/libxml/buf.h
generated
vendored
Normal file
72
node_modules/libxmljs/vendor/libxml/buf.h
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Summary: Internal Interfaces for memory buffers in libxml2
|
||||
* Description: this module describes most of the new xmlBuf buffer
|
||||
* entry points, those are private routines, with a
|
||||
* few exceptions exported in tree.h. This was added
|
||||
* in 2.9.0.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_BUF_H__
|
||||
#define __XML_BUF_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
xmlBufPtr xmlBufCreate(void);
|
||||
xmlBufPtr xmlBufCreateSize(size_t size);
|
||||
xmlBufPtr xmlBufCreateStatic(void *mem, size_t size);
|
||||
|
||||
int xmlBufSetAllocationScheme(xmlBufPtr buf,
|
||||
xmlBufferAllocationScheme scheme);
|
||||
int xmlBufGetAllocationScheme(xmlBufPtr buf);
|
||||
|
||||
void xmlBufFree(xmlBufPtr buf);
|
||||
void xmlBufEmpty(xmlBufPtr buf);
|
||||
|
||||
/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
|
||||
int xmlBufGrow(xmlBufPtr buf, int len);
|
||||
int xmlBufInflate(xmlBufPtr buf, size_t len);
|
||||
int xmlBufResize(xmlBufPtr buf, size_t len);
|
||||
|
||||
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
|
||||
int xmlBufAddHead(xmlBufPtr buf, const xmlChar *str, int len);
|
||||
int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
|
||||
int xmlBufCCat(xmlBufPtr buf, const char *str);
|
||||
int xmlBufWriteCHAR(xmlBufPtr buf, const xmlChar *string);
|
||||
int xmlBufWriteChar(xmlBufPtr buf, const char *string);
|
||||
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
|
||||
|
||||
size_t xmlBufAvail(const xmlBufPtr buf);
|
||||
size_t xmlBufLength(const xmlBufPtr buf);
|
||||
/* size_t xmlBufUse(const xmlBufPtr buf); */
|
||||
int xmlBufIsEmpty(const xmlBufPtr buf);
|
||||
int xmlBufAddLen(xmlBufPtr buf, size_t len);
|
||||
int xmlBufErase(xmlBufPtr buf, size_t len);
|
||||
|
||||
/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
|
||||
/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
|
||||
|
||||
xmlChar * xmlBufDetach(xmlBufPtr buf);
|
||||
|
||||
size_t xmlBufDump(FILE *file, xmlBufPtr buf);
|
||||
|
||||
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
|
||||
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
|
||||
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
|
||||
|
||||
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
|
||||
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
|
||||
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
|
||||
size_t base, size_t cur);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_BUF_H__ */
|
||||
|
||||
2238
node_modules/libxmljs/vendor/libxml/c14n.c
generated
vendored
Normal file
2238
node_modules/libxmljs/vendor/libxml/c14n.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3825
node_modules/libxmljs/vendor/libxml/catalog.c
generated
vendored
Normal file
3825
node_modules/libxmljs/vendor/libxml/catalog.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
336
node_modules/libxmljs/vendor/libxml/chvalid.c
generated
vendored
Normal file
336
node_modules/libxmljs/vendor/libxml/chvalid.c
generated
vendored
Normal file
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* chvalid.c: this module implements the character range
|
||||
* validation APIs
|
||||
*
|
||||
* This file is automatically generated from the cvs source
|
||||
* definition files using the genChRanges.py Python script
|
||||
*
|
||||
* Generation date: Mon Mar 27 11:09:48 2006
|
||||
* Sources: chvalid.def
|
||||
* William Brack <wbrack@mmm.com.hk>
|
||||
*/
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
#include <libxml/chvalid.h>
|
||||
|
||||
/*
|
||||
* The initial tables ({func_name}_tab) are used to validate whether a
|
||||
* single-byte character is within the specified group. Each table
|
||||
* contains 256 bytes, with each byte representing one of the 256
|
||||
* possible characters. If the table byte is set, the character is
|
||||
* allowed.
|
||||
*
|
||||
*/
|
||||
const unsigned char xmlIsPubidChar_tab[256] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x01,
|
||||
0x01, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
|
||||
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00 };
|
||||
|
||||
static const xmlChSRange xmlIsBaseChar_srng[] = { {0x100, 0x131},
|
||||
{0x134, 0x13e}, {0x141, 0x148}, {0x14a, 0x17e}, {0x180, 0x1c3},
|
||||
{0x1cd, 0x1f0}, {0x1f4, 0x1f5}, {0x1fa, 0x217}, {0x250, 0x2a8},
|
||||
{0x2bb, 0x2c1}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c},
|
||||
{0x38e, 0x3a1}, {0x3a3, 0x3ce}, {0x3d0, 0x3d6}, {0x3da, 0x3da},
|
||||
{0x3dc, 0x3dc}, {0x3de, 0x3de}, {0x3e0, 0x3e0}, {0x3e2, 0x3f3},
|
||||
{0x401, 0x40c}, {0x40e, 0x44f}, {0x451, 0x45c}, {0x45e, 0x481},
|
||||
{0x490, 0x4c4}, {0x4c7, 0x4c8}, {0x4cb, 0x4cc}, {0x4d0, 0x4eb},
|
||||
{0x4ee, 0x4f5}, {0x4f8, 0x4f9}, {0x531, 0x556}, {0x559, 0x559},
|
||||
{0x561, 0x586}, {0x5d0, 0x5ea}, {0x5f0, 0x5f2}, {0x621, 0x63a},
|
||||
{0x641, 0x64a}, {0x671, 0x6b7}, {0x6ba, 0x6be}, {0x6c0, 0x6ce},
|
||||
{0x6d0, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x905, 0x939},
|
||||
{0x93d, 0x93d}, {0x958, 0x961}, {0x985, 0x98c}, {0x98f, 0x990},
|
||||
{0x993, 0x9a8}, {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9},
|
||||
{0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0xa05, 0xa0a},
|
||||
{0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33},
|
||||
{0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, {0xa5e, 0xa5e},
|
||||
{0xa72, 0xa74}, {0xa85, 0xa8b}, {0xa8d, 0xa8d}, {0xa8f, 0xa91},
|
||||
{0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9},
|
||||
{0xabd, 0xabd}, {0xae0, 0xae0}, {0xb05, 0xb0c}, {0xb0f, 0xb10},
|
||||
{0xb13, 0xb28}, {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb36, 0xb39},
|
||||
{0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb85, 0xb8a},
|
||||
{0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c},
|
||||
{0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb5},
|
||||
{0xbb7, 0xbb9}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28},
|
||||
{0xc2a, 0xc33}, {0xc35, 0xc39}, {0xc60, 0xc61}, {0xc85, 0xc8c},
|
||||
{0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9},
|
||||
{0xcde, 0xcde}, {0xce0, 0xce1}, {0xd05, 0xd0c}, {0xd0e, 0xd10},
|
||||
{0xd12, 0xd28}, {0xd2a, 0xd39}, {0xd60, 0xd61}, {0xe01, 0xe2e},
|
||||
{0xe30, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe45}, {0xe81, 0xe82},
|
||||
{0xe84, 0xe84}, {0xe87, 0xe88}, {0xe8a, 0xe8a}, {0xe8d, 0xe8d},
|
||||
{0xe94, 0xe97}, {0xe99, 0xe9f}, {0xea1, 0xea3}, {0xea5, 0xea5},
|
||||
{0xea7, 0xea7}, {0xeaa, 0xeab}, {0xead, 0xeae}, {0xeb0, 0xeb0},
|
||||
{0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xf40, 0xf47},
|
||||
{0xf49, 0xf69}, {0x10a0, 0x10c5}, {0x10d0, 0x10f6}, {0x1100, 0x1100},
|
||||
{0x1102, 0x1103}, {0x1105, 0x1107}, {0x1109, 0x1109}, {0x110b, 0x110c},
|
||||
{0x110e, 0x1112}, {0x113c, 0x113c}, {0x113e, 0x113e}, {0x1140, 0x1140},
|
||||
{0x114c, 0x114c}, {0x114e, 0x114e}, {0x1150, 0x1150}, {0x1154, 0x1155},
|
||||
{0x1159, 0x1159}, {0x115f, 0x1161}, {0x1163, 0x1163}, {0x1165, 0x1165},
|
||||
{0x1167, 0x1167}, {0x1169, 0x1169}, {0x116d, 0x116e}, {0x1172, 0x1173},
|
||||
{0x1175, 0x1175}, {0x119e, 0x119e}, {0x11a8, 0x11a8}, {0x11ab, 0x11ab},
|
||||
{0x11ae, 0x11af}, {0x11b7, 0x11b8}, {0x11ba, 0x11ba}, {0x11bc, 0x11c2},
|
||||
{0x11eb, 0x11eb}, {0x11f0, 0x11f0}, {0x11f9, 0x11f9}, {0x1e00, 0x1e9b},
|
||||
{0x1ea0, 0x1ef9}, {0x1f00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45},
|
||||
{0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b},
|
||||
{0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc},
|
||||
{0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3},
|
||||
{0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc},
|
||||
{0x2126, 0x2126}, {0x212a, 0x212b}, {0x212e, 0x212e}, {0x2180, 0x2182},
|
||||
{0x3041, 0x3094}, {0x30a1, 0x30fa}, {0x3105, 0x312c}, {0xac00, 0xd7a3}};
|
||||
const xmlChRangeGroup xmlIsBaseCharGroup =
|
||||
{197, 0, xmlIsBaseChar_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsChar_srng[] = { {0x100, 0xd7ff},
|
||||
{0xe000, 0xfffd}};
|
||||
static const xmlChLRange xmlIsChar_lrng[] = { {0x10000, 0x10ffff}};
|
||||
const xmlChRangeGroup xmlIsCharGroup =
|
||||
{2, 1, xmlIsChar_srng, xmlIsChar_lrng};
|
||||
|
||||
static const xmlChSRange xmlIsCombining_srng[] = { {0x300, 0x345},
|
||||
{0x360, 0x361}, {0x483, 0x486}, {0x591, 0x5a1}, {0x5a3, 0x5b9},
|
||||
{0x5bb, 0x5bd}, {0x5bf, 0x5bf}, {0x5c1, 0x5c2}, {0x5c4, 0x5c4},
|
||||
{0x64b, 0x652}, {0x670, 0x670}, {0x6d6, 0x6dc}, {0x6dd, 0x6df},
|
||||
{0x6e0, 0x6e4}, {0x6e7, 0x6e8}, {0x6ea, 0x6ed}, {0x901, 0x903},
|
||||
{0x93c, 0x93c}, {0x93e, 0x94c}, {0x94d, 0x94d}, {0x951, 0x954},
|
||||
{0x962, 0x963}, {0x981, 0x983}, {0x9bc, 0x9bc}, {0x9be, 0x9be},
|
||||
{0x9bf, 0x9bf}, {0x9c0, 0x9c4}, {0x9c7, 0x9c8}, {0x9cb, 0x9cd},
|
||||
{0x9d7, 0x9d7}, {0x9e2, 0x9e3}, {0xa02, 0xa02}, {0xa3c, 0xa3c},
|
||||
{0xa3e, 0xa3e}, {0xa3f, 0xa3f}, {0xa40, 0xa42}, {0xa47, 0xa48},
|
||||
{0xa4b, 0xa4d}, {0xa70, 0xa71}, {0xa81, 0xa83}, {0xabc, 0xabc},
|
||||
{0xabe, 0xac5}, {0xac7, 0xac9}, {0xacb, 0xacd}, {0xb01, 0xb03},
|
||||
{0xb3c, 0xb3c}, {0xb3e, 0xb43}, {0xb47, 0xb48}, {0xb4b, 0xb4d},
|
||||
{0xb56, 0xb57}, {0xb82, 0xb83}, {0xbbe, 0xbc2}, {0xbc6, 0xbc8},
|
||||
{0xbca, 0xbcd}, {0xbd7, 0xbd7}, {0xc01, 0xc03}, {0xc3e, 0xc44},
|
||||
{0xc46, 0xc48}, {0xc4a, 0xc4d}, {0xc55, 0xc56}, {0xc82, 0xc83},
|
||||
{0xcbe, 0xcc4}, {0xcc6, 0xcc8}, {0xcca, 0xccd}, {0xcd5, 0xcd6},
|
||||
{0xd02, 0xd03}, {0xd3e, 0xd43}, {0xd46, 0xd48}, {0xd4a, 0xd4d},
|
||||
{0xd57, 0xd57}, {0xe31, 0xe31}, {0xe34, 0xe3a}, {0xe47, 0xe4e},
|
||||
{0xeb1, 0xeb1}, {0xeb4, 0xeb9}, {0xebb, 0xebc}, {0xec8, 0xecd},
|
||||
{0xf18, 0xf19}, {0xf35, 0xf35}, {0xf37, 0xf37}, {0xf39, 0xf39},
|
||||
{0xf3e, 0xf3e}, {0xf3f, 0xf3f}, {0xf71, 0xf84}, {0xf86, 0xf8b},
|
||||
{0xf90, 0xf95}, {0xf97, 0xf97}, {0xf99, 0xfad}, {0xfb1, 0xfb7},
|
||||
{0xfb9, 0xfb9}, {0x20d0, 0x20dc}, {0x20e1, 0x20e1}, {0x302a, 0x302f},
|
||||
{0x3099, 0x3099}, {0x309a, 0x309a}};
|
||||
const xmlChRangeGroup xmlIsCombiningGroup =
|
||||
{95, 0, xmlIsCombining_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsDigit_srng[] = { {0x660, 0x669},
|
||||
{0x6f0, 0x6f9}, {0x966, 0x96f}, {0x9e6, 0x9ef}, {0xa66, 0xa6f},
|
||||
{0xae6, 0xaef}, {0xb66, 0xb6f}, {0xbe7, 0xbef}, {0xc66, 0xc6f},
|
||||
{0xce6, 0xcef}, {0xd66, 0xd6f}, {0xe50, 0xe59}, {0xed0, 0xed9},
|
||||
{0xf20, 0xf29}};
|
||||
const xmlChRangeGroup xmlIsDigitGroup =
|
||||
{14, 0, xmlIsDigit_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsExtender_srng[] = { {0x2d0, 0x2d0},
|
||||
{0x2d1, 0x2d1}, {0x387, 0x387}, {0x640, 0x640}, {0xe46, 0xe46},
|
||||
{0xec6, 0xec6}, {0x3005, 0x3005}, {0x3031, 0x3035}, {0x309d, 0x309e},
|
||||
{0x30fc, 0x30fe}};
|
||||
const xmlChRangeGroup xmlIsExtenderGroup =
|
||||
{10, 0, xmlIsExtender_srng, (xmlChLRangePtr)0};
|
||||
|
||||
static const xmlChSRange xmlIsIdeographic_srng[] = { {0x3007, 0x3007},
|
||||
{0x3021, 0x3029}, {0x4e00, 0x9fa5}};
|
||||
const xmlChRangeGroup xmlIsIdeographicGroup =
|
||||
{3, 0, xmlIsIdeographic_srng, (xmlChLRangePtr)0};
|
||||
|
||||
|
||||
/**
|
||||
* xmlCharInRange:
|
||||
* @val: character to be validated
|
||||
* @rptr: pointer to range to be used to validate
|
||||
*
|
||||
* Does a binary search of the range table to determine if char
|
||||
* is valid
|
||||
*
|
||||
* Returns: true if character valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlCharInRange (unsigned int val, const xmlChRangeGroup *rptr) {
|
||||
int low, high, mid;
|
||||
const xmlChSRange *sptr;
|
||||
const xmlChLRange *lptr;
|
||||
|
||||
if (rptr == NULL) return(0);
|
||||
if (val < 0x10000) { /* is val in 'short' or 'long' array? */
|
||||
if (rptr->nbShortRange == 0)
|
||||
return 0;
|
||||
low = 0;
|
||||
high = rptr->nbShortRange - 1;
|
||||
sptr = rptr->shortRange;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
if ((unsigned short) val < sptr[mid].low) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
if ((unsigned short) val > sptr[mid].high) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (rptr->nbLongRange == 0) {
|
||||
return 0;
|
||||
}
|
||||
low = 0;
|
||||
high = rptr->nbLongRange - 1;
|
||||
lptr = rptr->longRange;
|
||||
while (low <= high) {
|
||||
mid = (low + high) / 2;
|
||||
if (val < lptr[mid].low) {
|
||||
high = mid - 1;
|
||||
} else {
|
||||
if (val > lptr[mid].high) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsBaseChar:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsBaseChar_ch or xmlIsBaseCharQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsBaseChar(unsigned int ch) {
|
||||
return(xmlIsBaseCharQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsBlank:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsBlank_ch or xmlIsBlankQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsBlank(unsigned int ch) {
|
||||
return(xmlIsBlankQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsChar:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsChar_ch or xmlIsCharQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsChar(unsigned int ch) {
|
||||
return(xmlIsCharQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsCombining:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsCombiningQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsCombining(unsigned int ch) {
|
||||
return(xmlIsCombiningQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsDigit:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsDigit_ch or xmlIsDigitQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsDigit(unsigned int ch) {
|
||||
return(xmlIsDigitQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsExtender:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsExtender_ch or xmlIsExtenderQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsExtender(unsigned int ch) {
|
||||
return(xmlIsExtenderQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsIdeographic:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsIdeographicQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsIdeographic(unsigned int ch) {
|
||||
return(xmlIsIdeographicQ(ch));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xmlIsPubidChar:
|
||||
* @ch: character to validate
|
||||
*
|
||||
* This function is DEPRECATED.
|
||||
* Use xmlIsPubidChar_ch or xmlIsPubidCharQ instead
|
||||
*
|
||||
* Returns true if argument valid, false otherwise
|
||||
*/
|
||||
int
|
||||
xmlIsPubidChar(unsigned int ch) {
|
||||
return(xmlIsPubidCharQ(ch));
|
||||
}
|
||||
|
||||
#define bottom_chvalid
|
||||
#include "elfgcchack.h"
|
||||
342
node_modules/libxmljs/vendor/libxml/config.h
generated
vendored
Normal file
342
node_modules/libxmljs/vendor/libxml/config.h
generated
vendored
Normal file
@@ -0,0 +1,342 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Type cast for the gethostbyname() argument */
|
||||
#define GETHOSTBYNAME_ARG_CAST /**/
|
||||
|
||||
/* Define to 1 if you have the <ansidecl.h> header file. */
|
||||
/* #undef HAVE_ANSIDECL_H */
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define to 1 if you have the <arpa/nameser.h> header file. */
|
||||
#define HAVE_ARPA_NAMESER_H 1
|
||||
|
||||
/* Whether struct sockaddr::__ss_family exists */
|
||||
/* #undef HAVE_BROKEN_SS_FAMILY */
|
||||
|
||||
/* Define to 1 if you have the `class' function. */
|
||||
/* #undef HAVE_CLASS */
|
||||
|
||||
/* Define to 1 if you have the <ctype.h> header file. */
|
||||
#define HAVE_CTYPE_H 1
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file. */
|
||||
#define HAVE_DIRENT_H 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Have dlopen based dso */
|
||||
#define HAVE_DLOPEN /**/
|
||||
|
||||
/* Define to 1 if you have the <dl.h> header file. */
|
||||
/* #undef HAVE_DL_H */
|
||||
|
||||
/* Define to 1 if you have the <errno.h> header file. */
|
||||
#define HAVE_ERRNO_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `finite' function. */
|
||||
#define HAVE_FINITE 1
|
||||
|
||||
/* Define to 1 if you have the <float.h> header file. */
|
||||
#define HAVE_FLOAT_H 1
|
||||
|
||||
/* Define to 1 if you have the `fpclass' function. */
|
||||
/* #undef HAVE_FPCLASS */
|
||||
|
||||
/* Define to 1 if you have the `fprintf' function. */
|
||||
#define HAVE_FPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `fp_class' function. */
|
||||
/* #undef HAVE_FP_CLASS */
|
||||
|
||||
/* Define to 1 if you have the <fp_class.h> header file. */
|
||||
/* #undef HAVE_FP_CLASS_H */
|
||||
|
||||
/* Define to 1 if you have the `ftime' function. */
|
||||
#define HAVE_FTIME 1
|
||||
|
||||
/* Define if getaddrinfo is there */
|
||||
#define HAVE_GETADDRINFO /**/
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the <ieeefp.h> header file. */
|
||||
/* #undef HAVE_IEEEFP_H */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `isascii' function. */
|
||||
#define HAVE_ISASCII 1
|
||||
|
||||
/* Define if isinf is there */
|
||||
#define HAVE_ISINF /**/
|
||||
|
||||
/* Define if isnan is there */
|
||||
#define HAVE_ISNAN /**/
|
||||
|
||||
/* Define to 1 if you have the `isnand' function. */
|
||||
/* #undef HAVE_ISNAND */
|
||||
|
||||
/* Define if history library is there (-lhistory) */
|
||||
/* #undef HAVE_LIBHISTORY */
|
||||
|
||||
/* Have compression library */
|
||||
/* #define HAVE_LIBLZMA 1 */
|
||||
|
||||
/* Define if pthread library is there (-lpthread) */
|
||||
/* #define HAVE_LIBPTHREAD */
|
||||
|
||||
/* Define if readline library is there (-lreadline) */
|
||||
/* #undef HAVE_LIBREADLINE */
|
||||
|
||||
/* Have compression library */
|
||||
#define HAVE_LIBZ 1
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the `localtime' function. */
|
||||
#define HAVE_LOCALTIME 1
|
||||
|
||||
/* Define to 1 if you have the <lzma.h> header file. */
|
||||
/* #define HAVE_LZMA_H 1 */
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
/* #define HAVE_MALLOC_H */
|
||||
|
||||
/* Define to 1 if you have the <math.h> header file. */
|
||||
#define HAVE_MATH_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the `mmap' function. */
|
||||
#define HAVE_MMAP 1
|
||||
|
||||
/* Define to 1 if you have the `munmap' function. */
|
||||
#define HAVE_MUNMAP 1
|
||||
|
||||
/* mmap() is no good without munmap() */
|
||||
#if defined(HAVE_MMAP) && !defined(HAVE_MUNMAP)
|
||||
# undef /**/ HAVE_MMAP
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <nan.h> header file. */
|
||||
/* #undef HAVE_NAN_H */
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
/* #undef HAVE_NDIR_H */
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#define HAVE_NETDB_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <poll.h> header file. */
|
||||
#define HAVE_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the `printf' function. */
|
||||
#define HAVE_PRINTF 1
|
||||
|
||||
/* Define if <pthread.h> is there */
|
||||
/* #define HAVE_PTHREAD_H */
|
||||
|
||||
/* Define to 1 if you have the `putenv' function. */
|
||||
#define HAVE_PUTENV 1
|
||||
|
||||
/* Define to 1 if you have the `rand' function. */
|
||||
#define HAVE_RAND 1
|
||||
|
||||
/* Define to 1 if you have the `rand_r' function. */
|
||||
#ifndef _WIN32
|
||||
#define HAVE_RAND_R 1
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the <resolv.h> header file. */
|
||||
#define HAVE_RESOLV_H 1
|
||||
|
||||
/* Have shl_load based dso */
|
||||
/* #undef HAVE_SHLLOAD */
|
||||
|
||||
/* Define to 1 if you have the `signal' function. */
|
||||
#define HAVE_SIGNAL 1
|
||||
|
||||
/* Define to 1 if you have the <signal.h> header file. */
|
||||
#define HAVE_SIGNAL_H 1
|
||||
|
||||
/* snprintf macro for older MSVS versions */
|
||||
#if defined(_WIN32) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#define HAVE_SNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `sprintf' function. */
|
||||
#define HAVE_SPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `srand' function. */
|
||||
#define HAVE_SRAND 1
|
||||
|
||||
/* Define to 1 if you have the `sscanf' function. */
|
||||
#define HAVE_SSCANF 1
|
||||
|
||||
/* Define to 1 if you have the `stat' function. */
|
||||
#define HAVE_STAT 1
|
||||
|
||||
/* Define to 1 if you have the <stdarg.h> header file. */
|
||||
#define HAVE_STDARG_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strerror' function. */
|
||||
#define HAVE_STRERROR 1
|
||||
|
||||
/* Define to 1 if you have the `strftime' function. */
|
||||
#define HAVE_STRFTIME 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strndup' function. */
|
||||
#define HAVE_STRNDUP 1
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
/* #undef HAVE_SYS_DIR_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#define HAVE_SYS_MMAN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
/* #undef HAVE_SYS_NDIR_H */
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/timeb.h> header file. */
|
||||
#define HAVE_SYS_TIMEB_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `time' function. */
|
||||
#define HAVE_TIME 1
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#ifndef _WIN32
|
||||
#define HAVE_UNISTD_H 1
|
||||
#endif
|
||||
|
||||
/* Whether va_copy() is available */
|
||||
#define HAVE_VA_COPY 1
|
||||
|
||||
/* Define to 1 if you have the `vfprintf' function. */
|
||||
#define HAVE_VFPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#define HAVE_VSNPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the `vsprintf' function. */
|
||||
#define HAVE_VSPRINTF 1
|
||||
|
||||
/* Define to 1 if you have the <zlib.h> header file. */
|
||||
/* #define HAVE_ZLIB_H 1 */
|
||||
|
||||
/* Define to 1 if you have the `_stat' function. */
|
||||
/* #undef HAVE__STAT */
|
||||
|
||||
/* Whether __va_copy() is available */
|
||||
/* #undef HAVE___VA_COPY */
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
#define ICONV_CONST
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libxml2"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT ""
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "libxml2"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "libxml2 2.9.3"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libxml2"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "2.9.3"
|
||||
|
||||
/* Type cast for the send() function 2nd arg */
|
||||
#define SEND_ARG2_CAST /**/
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Support for IPv6 */
|
||||
#define SUPPORT_IP6 /**/
|
||||
|
||||
/* Define if va_list is an array type */
|
||||
#define VA_LIST_IS_ARRAY 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "2.9.3"
|
||||
|
||||
/* Determine what socket length (socklen_t) data type is */
|
||||
#define XML_SOCKLEN_T socklen_t
|
||||
|
||||
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
|
||||
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
|
||||
#define below would cause a syntax error. */
|
||||
/* #undef _UINT32_T */
|
||||
|
||||
/* Using the Win32 Socket implementation */
|
||||
/* #undef _WINSOCKAPI_ */
|
||||
|
||||
/* ss_family is not defined here, use __ss_family instead */
|
||||
/* #undef ss_family */
|
||||
|
||||
/* Define to the type of an unsigned integer type of width exactly 32 bits if
|
||||
such a type exists and the standard includes do not define it. */
|
||||
/* #undef uint32_t */
|
||||
BIN
node_modules/libxmljs/vendor/libxml/config.h.gch
generated
vendored
Normal file
BIN
node_modules/libxmljs/vendor/libxml/config.h.gch
generated
vendored
Normal file
Binary file not shown.
3428
node_modules/libxmljs/vendor/libxml/debugXML.c
generated
vendored
Normal file
3428
node_modules/libxmljs/vendor/libxml/debugXML.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1262
node_modules/libxmljs/vendor/libxml/dict.c
generated
vendored
Normal file
1262
node_modules/libxmljs/vendor/libxml/dict.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
17808
node_modules/libxmljs/vendor/libxml/elfgcchack.h
generated
vendored
Normal file
17808
node_modules/libxmljs/vendor/libxml/elfgcchack.h
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
32
node_modules/libxmljs/vendor/libxml/enc.h
generated
vendored
Normal file
32
node_modules/libxmljs/vendor/libxml/enc.h
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Summary: Internal Interfaces for encoding in libxml2
|
||||
* Description: this module describes a few interfaces which were
|
||||
* addded along with the API changes in 2.9.0
|
||||
* those are private routines at this point
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __XML_ENC_H__
|
||||
#define __XML_ENC_H__
|
||||
|
||||
#include <libxml/tree.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out,
|
||||
xmlBufferPtr in, int len);
|
||||
int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
|
||||
int xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
|
||||
int xmlCharEncOutput(xmlOutputBufferPtr output, int init);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __XML_ENC_H__ */
|
||||
|
||||
|
||||
4085
node_modules/libxmljs/vendor/libxml/encoding.c
generated
vendored
Normal file
4085
node_modules/libxmljs/vendor/libxml/encoding.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1105
node_modules/libxmljs/vendor/libxml/entities.c
generated
vendored
Normal file
1105
node_modules/libxmljs/vendor/libxml/entities.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
998
node_modules/libxmljs/vendor/libxml/error.c
generated
vendored
Normal file
998
node_modules/libxmljs/vendor/libxml/error.c
generated
vendored
Normal file
@@ -0,0 +1,998 @@
|
||||
/*
|
||||
* error.c: module displaying/handling XML parser errors
|
||||
*
|
||||
* See Copyright for the status of this software.
|
||||
*
|
||||
* Daniel Veillard <daniel@veillard.com>
|
||||
*/
|
||||
|
||||
#define IN_LIBXML
|
||||
#include "libxml.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/xmlerror.h>
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/globals.h>
|
||||
|
||||
void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
|
||||
const char *msg,
|
||||
...) LIBXML_ATTR_FORMAT(2,3);
|
||||
|
||||
#define XML_GET_VAR_STR(msg, str) { \
|
||||
int size, prev_size = -1; \
|
||||
int chars; \
|
||||
char *larger; \
|
||||
va_list ap; \
|
||||
\
|
||||
str = (char *) xmlMalloc(150); \
|
||||
if (str != NULL) { \
|
||||
\
|
||||
size = 150; \
|
||||
\
|
||||
while (size < 64000) { \
|
||||
va_start(ap, msg); \
|
||||
chars = vsnprintf(str, size, msg, ap); \
|
||||
va_end(ap); \
|
||||
if ((chars > -1) && (chars < size)) { \
|
||||
if (prev_size == chars) { \
|
||||
break; \
|
||||
} else { \
|
||||
prev_size = chars; \
|
||||
} \
|
||||
} \
|
||||
if (chars > -1) \
|
||||
size += chars + 1; \
|
||||
else \
|
||||
size += 100; \
|
||||
if ((larger = (char *) xmlRealloc(str, size)) == NULL) {\
|
||||
break; \
|
||||
} \
|
||||
str = larger; \
|
||||
}} \
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Handling of out of context errors *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* xmlGenericErrorDefaultFunc:
|
||||
* @ctx: an error context
|
||||
* @msg: the message to display/transmit
|
||||
* @...: extra parameters for the message display
|
||||
*
|
||||
* Default handler for out of context error messages.
|
||||
*/
|
||||
void XMLCDECL
|
||||
xmlGenericErrorDefaultFunc(void *ctx ATTRIBUTE_UNUSED, const char *msg, ...) {
|
||||
va_list args;
|
||||
|
||||
if (xmlGenericErrorContext == NULL)
|
||||
xmlGenericErrorContext = (void *) stderr;
|
||||
|
||||
va_start(args, msg);
|
||||
vfprintf((FILE *)xmlGenericErrorContext, msg, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
/**
|
||||
* initGenericErrorDefaultFunc:
|
||||
* @handler: the handler
|
||||
*
|
||||
* Set or reset (if NULL) the default handler for generic errors
|
||||
* to the builtin error function.
|
||||
*/
|
||||
void
|
||||
initGenericErrorDefaultFunc(xmlGenericErrorFunc * handler)
|
||||
{
|
||||
if (handler == NULL)
|
||||
xmlGenericError = xmlGenericErrorDefaultFunc;
|
||||
else
|
||||
xmlGenericError = (*handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlSetGenericErrorFunc:
|
||||
* @ctx: the new error handling context
|
||||
* @handler: the new handler function
|
||||
*
|
||||
* Function to reset the handler and the error context for out of
|
||||
* context error messages.
|
||||
* This simply means that @handler will be called for subsequent
|
||||
* error messages while not parsing nor validating. And @ctx will
|
||||
* be passed as first argument to @handler
|
||||
* One can simply force messages to be emitted to another FILE * than
|
||||
* stderr by setting @ctx to this file handle and @handler to NULL.
|
||||
* For multi-threaded applications, this must be set separately for each thread.
|
||||
*/
|
||||
void
|
||||
xmlSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
|
||||
xmlGenericErrorContext = ctx;
|
||||
if (handler != NULL)
|
||||
xmlGenericError = handler;
|
||||
else
|
||||
xmlGenericError = xmlGenericErrorDefaultFunc;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlSetStructuredErrorFunc:
|
||||
* @ctx: the new error handling context
|
||||
* @handler: the new handler function
|
||||
*
|
||||
* Function to reset the handler and the error context for out of
|
||||
* context structured error messages.
|
||||
* This simply means that @handler will be called for subsequent
|
||||
* error messages while not parsing nor validating. And @ctx will
|
||||
* be passed as first argument to @handler
|
||||
* For multi-threaded applications, this must be set separately for each thread.
|
||||
*/
|
||||
void
|
||||
xmlSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
|
||||
xmlStructuredErrorContext = ctx;
|
||||
xmlStructuredError = handler;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Handling of parsing errors *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* xmlParserPrintFileInfo:
|
||||
* @input: an xmlParserInputPtr input
|
||||
*
|
||||
* Displays the associated file and line informations for the current input
|
||||
*/
|
||||
|
||||
void
|
||||
xmlParserPrintFileInfo(xmlParserInputPtr input) {
|
||||
if (input != NULL) {
|
||||
if (input->filename)
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"%s:%d: ", input->filename,
|
||||
input->line);
|
||||
else
|
||||
xmlGenericError(xmlGenericErrorContext,
|
||||
"Entity: line %d: ", input->line);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParserPrintFileContext:
|
||||
* @input: an xmlParserInputPtr input
|
||||
*
|
||||
* Displays current context within the input content for error tracking
|
||||
*/
|
||||
|
||||
static void
|
||||
xmlParserPrintFileContextInternal(xmlParserInputPtr input ,
|
||||
xmlGenericErrorFunc channel, void *data ) {
|
||||
const xmlChar *cur, *base;
|
||||
unsigned int n, col; /* GCC warns if signed, because compared with sizeof() */
|
||||
xmlChar content[81]; /* space for 80 chars + line terminator */
|
||||
xmlChar *ctnt;
|
||||
|
||||
if ((input == NULL) || (input->cur == NULL))
|
||||
return;
|
||||
|
||||
cur = input->cur;
|
||||
base = input->base;
|
||||
/* skip backwards over any end-of-lines */
|
||||
while ((cur > base) && ((*(cur) == '\n') || (*(cur) == '\r'))) {
|
||||
cur--;
|
||||
}
|
||||
n = 0;
|
||||
/* search backwards for beginning-of-line (to max buff size) */
|
||||
while ((n++ < (sizeof(content)-1)) && (cur > base) &&
|
||||
(*(cur) != '\n') && (*(cur) != '\r'))
|
||||
cur--;
|
||||
if ((*(cur) == '\n') || (*(cur) == '\r')) cur++;
|
||||
/* calculate the error position in terms of the current position */
|
||||
col = input->cur - cur;
|
||||
/* search forward for end-of-line (to max buff size) */
|
||||
n = 0;
|
||||
ctnt = content;
|
||||
/* copy selected text to our buffer */
|
||||
while ((*cur != 0) && (*(cur) != '\n') &&
|
||||
(*(cur) != '\r') && (n < sizeof(content)-1)) {
|
||||
*ctnt++ = *cur++;
|
||||
n++;
|
||||
}
|
||||
*ctnt = 0;
|
||||
/* print out the selected text */
|
||||
channel(data ,"%s\n", content);
|
||||
/* create blank line with problem pointer */
|
||||
n = 0;
|
||||
ctnt = content;
|
||||
/* (leave buffer space for pointer + line terminator) */
|
||||
while ((n<col) && (n++ < sizeof(content)-2) && (*ctnt != 0)) {
|
||||
if (*(ctnt) != '\t')
|
||||
*(ctnt) = ' ';
|
||||
ctnt++;
|
||||
}
|
||||
*ctnt++ = '^';
|
||||
*ctnt = 0;
|
||||
channel(data ,"%s\n", content);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParserPrintFileContext:
|
||||
* @input: an xmlParserInputPtr input
|
||||
*
|
||||
* Displays current context within the input content for error tracking
|
||||
*/
|
||||
void
|
||||
xmlParserPrintFileContext(xmlParserInputPtr input) {
|
||||
xmlParserPrintFileContextInternal(input, xmlGenericError,
|
||||
xmlGenericErrorContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlReportError:
|
||||
* @err: the error
|
||||
* @ctx: the parser context or NULL
|
||||
* @str: the formatted error message
|
||||
*
|
||||
* Report an erro with its context, replace the 4 old error/warning
|
||||
* routines.
|
||||
*/
|
||||
static void
|
||||
xmlReportError(xmlErrorPtr err, xmlParserCtxtPtr ctxt, const char *str,
|
||||
xmlGenericErrorFunc channel, void *data)
|
||||
{
|
||||
char *file = NULL;
|
||||
int line = 0;
|
||||
int code = -1;
|
||||
int domain;
|
||||
const xmlChar *name = NULL;
|
||||
xmlNodePtr node;
|
||||
xmlErrorLevel level;
|
||||
xmlParserInputPtr input = NULL;
|
||||
xmlParserInputPtr cur = NULL;
|
||||
|
||||
if (err == NULL)
|
||||
return;
|
||||
|
||||
if (channel == NULL) {
|
||||
channel = xmlGenericError;
|
||||
data = xmlGenericErrorContext;
|
||||
}
|
||||
file = err->file;
|
||||
line = err->line;
|
||||
code = err->code;
|
||||
domain = err->domain;
|
||||
level = err->level;
|
||||
node = err->node;
|
||||
|
||||
if (code == XML_ERR_OK)
|
||||
return;
|
||||
|
||||
if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
|
||||
name = node->name;
|
||||
|
||||
/*
|
||||
* Maintain the compatibility with the legacy error handling
|
||||
*/
|
||||
if (ctxt != NULL) {
|
||||
input = ctxt->input;
|
||||
if ((input != NULL) && (input->filename == NULL) &&
|
||||
(ctxt->inputNr > 1)) {
|
||||
cur = input;
|
||||
input = ctxt->inputTab[ctxt->inputNr - 2];
|
||||
}
|
||||
if (input != NULL) {
|
||||
if (input->filename)
|
||||
channel(data, "%s:%d: ", input->filename, input->line);
|
||||
else if ((line != 0) && (domain == XML_FROM_PARSER))
|
||||
channel(data, "Entity: line %d: ", input->line);
|
||||
}
|
||||
} else {
|
||||
if (file != NULL)
|
||||
channel(data, "%s:%d: ", file, line);
|
||||
else if ((line != 0) &&
|
||||
((domain == XML_FROM_PARSER) || (domain == XML_FROM_SCHEMASV)||
|
||||
(domain == XML_FROM_SCHEMASP)||(domain == XML_FROM_DTD) ||
|
||||
(domain == XML_FROM_RELAXNGP)||(domain == XML_FROM_RELAXNGV)))
|
||||
channel(data, "Entity: line %d: ", line);
|
||||
}
|
||||
if (name != NULL) {
|
||||
channel(data, "element %s: ", name);
|
||||
}
|
||||
switch (domain) {
|
||||
case XML_FROM_PARSER:
|
||||
channel(data, "parser ");
|
||||
break;
|
||||
case XML_FROM_NAMESPACE:
|
||||
channel(data, "namespace ");
|
||||
break;
|
||||
case XML_FROM_DTD:
|
||||
case XML_FROM_VALID:
|
||||
channel(data, "validity ");
|
||||
break;
|
||||
case XML_FROM_HTML:
|
||||
channel(data, "HTML parser ");
|
||||
break;
|
||||
case XML_FROM_MEMORY:
|
||||
channel(data, "memory ");
|
||||
break;
|
||||
case XML_FROM_OUTPUT:
|
||||
channel(data, "output ");
|
||||
break;
|
||||
case XML_FROM_IO:
|
||||
channel(data, "I/O ");
|
||||
break;
|
||||
case XML_FROM_XINCLUDE:
|
||||
channel(data, "XInclude ");
|
||||
break;
|
||||
case XML_FROM_XPATH:
|
||||
channel(data, "XPath ");
|
||||
break;
|
||||
case XML_FROM_XPOINTER:
|
||||
channel(data, "parser ");
|
||||
break;
|
||||
case XML_FROM_REGEXP:
|
||||
channel(data, "regexp ");
|
||||
break;
|
||||
case XML_FROM_MODULE:
|
||||
channel(data, "module ");
|
||||
break;
|
||||
case XML_FROM_SCHEMASV:
|
||||
channel(data, "Schemas validity ");
|
||||
break;
|
||||
case XML_FROM_SCHEMASP:
|
||||
channel(data, "Schemas parser ");
|
||||
break;
|
||||
case XML_FROM_RELAXNGP:
|
||||
channel(data, "Relax-NG parser ");
|
||||
break;
|
||||
case XML_FROM_RELAXNGV:
|
||||
channel(data, "Relax-NG validity ");
|
||||
break;
|
||||
case XML_FROM_CATALOG:
|
||||
channel(data, "Catalog ");
|
||||
break;
|
||||
case XML_FROM_C14N:
|
||||
channel(data, "C14N ");
|
||||
break;
|
||||
case XML_FROM_XSLT:
|
||||
channel(data, "XSLT ");
|
||||
break;
|
||||
case XML_FROM_I18N:
|
||||
channel(data, "encoding ");
|
||||
break;
|
||||
case XML_FROM_SCHEMATRONV:
|
||||
channel(data, "schematron ");
|
||||
break;
|
||||
case XML_FROM_BUFFER:
|
||||
channel(data, "internal buffer ");
|
||||
break;
|
||||
case XML_FROM_URI:
|
||||
channel(data, "URI ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (level) {
|
||||
case XML_ERR_NONE:
|
||||
channel(data, ": ");
|
||||
break;
|
||||
case XML_ERR_WARNING:
|
||||
channel(data, "warning : ");
|
||||
break;
|
||||
case XML_ERR_ERROR:
|
||||
channel(data, "error : ");
|
||||
break;
|
||||
case XML_ERR_FATAL:
|
||||
channel(data, "error : ");
|
||||
break;
|
||||
}
|
||||
if (str != NULL) {
|
||||
int len;
|
||||
len = xmlStrlen((const xmlChar *)str);
|
||||
if ((len > 0) && (str[len - 1] != '\n'))
|
||||
channel(data, "%s\n", str);
|
||||
else
|
||||
channel(data, "%s", str);
|
||||
} else {
|
||||
channel(data, "%s\n", "out of memory error");
|
||||
}
|
||||
|
||||
if (ctxt != NULL) {
|
||||
xmlParserPrintFileContextInternal(input, channel, data);
|
||||
if (cur != NULL) {
|
||||
if (cur->filename)
|
||||
channel(data, "%s:%d: \n", cur->filename, cur->line);
|
||||
else if ((line != 0) && (domain == XML_FROM_PARSER))
|
||||
channel(data, "Entity: line %d: \n", cur->line);
|
||||
xmlParserPrintFileContextInternal(cur, channel, data);
|
||||
}
|
||||
}
|
||||
if ((domain == XML_FROM_XPATH) && (err->str1 != NULL) &&
|
||||
(err->int1 < 100) &&
|
||||
(err->int1 < xmlStrlen((const xmlChar *)err->str1))) {
|
||||
xmlChar buf[150];
|
||||
int i;
|
||||
|
||||
channel(data, "%s\n", err->str1);
|
||||
for (i=0;i < err->int1;i++)
|
||||
buf[i] = ' ';
|
||||
buf[i++] = '^';
|
||||
buf[i] = 0;
|
||||
channel(data, "%s\n", buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* __xmlRaiseError:
|
||||
* @schannel: the structured callback channel
|
||||
* @channel: the old callback channel
|
||||
* @data: the callback data
|
||||
* @ctx: the parser context or NULL
|
||||
* @ctx: the parser context or NULL
|
||||
* @domain: the domain for the error
|
||||
* @code: the code for the error
|
||||
* @level: the xmlErrorLevel for the error
|
||||
* @file: the file source of the error (or NULL)
|
||||
* @line: the line of the error or 0 if N/A
|
||||
* @str1: extra string info
|
||||
* @str2: extra string info
|
||||
* @str3: extra string info
|
||||
* @int1: extra int info
|
||||
* @col: column number of the error or 0 if N/A
|
||||
* @msg: the message to display/transmit
|
||||
* @...: extra parameters for the message display
|
||||
*
|
||||
* Update the appropriate global or contextual error structure,
|
||||
* then forward the error message down the parser or generic
|
||||
* error callback handler
|
||||
*/
|
||||
void XMLCDECL
|
||||
__xmlRaiseError(xmlStructuredErrorFunc schannel,
|
||||
xmlGenericErrorFunc channel, void *data, void *ctx,
|
||||
void *nod, int domain, int code, xmlErrorLevel level,
|
||||
const char *file, int line, const char *str1,
|
||||
const char *str2, const char *str3, int int1, int col,
|
||||
const char *msg, ...)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = NULL;
|
||||
xmlNodePtr node = (xmlNodePtr) nod;
|
||||
char *str = NULL;
|
||||
xmlParserInputPtr input = NULL;
|
||||
xmlErrorPtr to = &xmlLastError;
|
||||
xmlNodePtr baseptr = NULL;
|
||||
|
||||
if (code == XML_ERR_OK)
|
||||
return;
|
||||
if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING))
|
||||
return;
|
||||
if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
|
||||
(domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
|
||||
(domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
|
||||
ctxt = (xmlParserCtxtPtr) ctx;
|
||||
if ((schannel == NULL) && (ctxt != NULL) && (ctxt->sax != NULL) &&
|
||||
(ctxt->sax->initialized == XML_SAX2_MAGIC) &&
|
||||
(ctxt->sax->serror != NULL)) {
|
||||
schannel = ctxt->sax->serror;
|
||||
data = ctxt->userData;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Check if structured error handler set
|
||||
*/
|
||||
if (schannel == NULL) {
|
||||
schannel = xmlStructuredError;
|
||||
/*
|
||||
* if user has defined handler, change data ptr to user's choice
|
||||
*/
|
||||
if (schannel != NULL)
|
||||
data = xmlStructuredErrorContext;
|
||||
}
|
||||
/*
|
||||
* Formatting the message
|
||||
*/
|
||||
if (msg == NULL) {
|
||||
str = (char *) xmlStrdup(BAD_CAST "No error message provided");
|
||||
} else {
|
||||
XML_GET_VAR_STR(msg, str);
|
||||
}
|
||||
|
||||
/*
|
||||
* specific processing if a parser context is provided
|
||||
*/
|
||||
if (ctxt != NULL) {
|
||||
if (file == NULL) {
|
||||
input = ctxt->input;
|
||||
if ((input != NULL) && (input->filename == NULL) &&
|
||||
(ctxt->inputNr > 1)) {
|
||||
input = ctxt->inputTab[ctxt->inputNr - 2];
|
||||
}
|
||||
if (input != NULL) {
|
||||
file = input->filename;
|
||||
line = input->line;
|
||||
col = input->col;
|
||||
}
|
||||
}
|
||||
to = &ctxt->lastError;
|
||||
} else if ((node != NULL) && (file == NULL)) {
|
||||
int i;
|
||||
|
||||
if ((node->doc != NULL) && (node->doc->URL != NULL)) {
|
||||
baseptr = node;
|
||||
/* file = (const char *) node->doc->URL; */
|
||||
}
|
||||
for (i = 0;
|
||||
((i < 10) && (node != NULL) && (node->type != XML_ELEMENT_NODE));
|
||||
i++)
|
||||
node = node->parent;
|
||||
if ((baseptr == NULL) && (node != NULL) &&
|
||||
(node->doc != NULL) && (node->doc->URL != NULL))
|
||||
baseptr = node;
|
||||
|
||||
if ((node != NULL) && (node->type == XML_ELEMENT_NODE))
|
||||
line = node->line;
|
||||
if ((line == 0) || (line == 65535))
|
||||
line = xmlGetLineNo(node);
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the information about the error
|
||||
*/
|
||||
xmlResetError(to);
|
||||
to->domain = domain;
|
||||
to->code = code;
|
||||
to->message = str;
|
||||
to->level = level;
|
||||
if (file != NULL)
|
||||
to->file = (char *) xmlStrdup((const xmlChar *) file);
|
||||
else if (baseptr != NULL) {
|
||||
#ifdef LIBXML_XINCLUDE_ENABLED
|
||||
/*
|
||||
* We check if the error is within an XInclude section and,
|
||||
* if so, attempt to print out the href of the XInclude instead
|
||||
* of the usual "base" (doc->URL) for the node (bug 152623).
|
||||
*/
|
||||
xmlNodePtr prev = baseptr;
|
||||
int inclcount = 0;
|
||||
while (prev != NULL) {
|
||||
if (prev->prev == NULL)
|
||||
prev = prev->parent;
|
||||
else {
|
||||
prev = prev->prev;
|
||||
if (prev->type == XML_XINCLUDE_START) {
|
||||
if (--inclcount < 0)
|
||||
break;
|
||||
} else if (prev->type == XML_XINCLUDE_END)
|
||||
inclcount++;
|
||||
}
|
||||
}
|
||||
if (prev != NULL) {
|
||||
if (prev->type == XML_XINCLUDE_START) {
|
||||
prev->type = XML_ELEMENT_NODE;
|
||||
to->file = (char *) xmlGetProp(prev, BAD_CAST "href");
|
||||
prev->type = XML_XINCLUDE_START;
|
||||
} else {
|
||||
to->file = (char *) xmlGetProp(prev, BAD_CAST "href");
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
to->file = (char *) xmlStrdup(baseptr->doc->URL);
|
||||
if ((to->file == NULL) && (node != NULL) && (node->doc != NULL)) {
|
||||
to->file = (char *) xmlStrdup(node->doc->URL);
|
||||
}
|
||||
}
|
||||
to->line = line;
|
||||
if (str1 != NULL)
|
||||
to->str1 = (char *) xmlStrdup((const xmlChar *) str1);
|
||||
if (str2 != NULL)
|
||||
to->str2 = (char *) xmlStrdup((const xmlChar *) str2);
|
||||
if (str3 != NULL)
|
||||
to->str3 = (char *) xmlStrdup((const xmlChar *) str3);
|
||||
to->int1 = int1;
|
||||
to->int2 = col;
|
||||
to->node = node;
|
||||
to->ctxt = ctx;
|
||||
|
||||
if (to != &xmlLastError)
|
||||
xmlCopyError(to,&xmlLastError);
|
||||
|
||||
if (schannel != NULL) {
|
||||
schannel(data, to);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the callback channel if channel param is NULL
|
||||
*/
|
||||
if ((ctxt != NULL) && (channel == NULL) &&
|
||||
(xmlStructuredError == NULL) && (ctxt->sax != NULL)) {
|
||||
if (level == XML_ERR_WARNING)
|
||||
channel = ctxt->sax->warning;
|
||||
else
|
||||
channel = ctxt->sax->error;
|
||||
data = ctxt->userData;
|
||||
} else if (channel == NULL) {
|
||||
channel = xmlGenericError;
|
||||
if (ctxt != NULL) {
|
||||
data = ctxt;
|
||||
} else {
|
||||
data = xmlGenericErrorContext;
|
||||
}
|
||||
}
|
||||
if (channel == NULL)
|
||||
return;
|
||||
|
||||
if ((channel == xmlParserError) ||
|
||||
(channel == xmlParserWarning) ||
|
||||
(channel == xmlParserValidityError) ||
|
||||
(channel == xmlParserValidityWarning))
|
||||
xmlReportError(to, ctxt, str, NULL, NULL);
|
||||
else if ((channel == (xmlGenericErrorFunc) fprintf) ||
|
||||
(channel == xmlGenericErrorDefaultFunc))
|
||||
xmlReportError(to, ctxt, str, channel, data);
|
||||
else
|
||||
channel(data, "%s", str);
|
||||
}
|
||||
|
||||
/**
|
||||
* __xmlSimpleError:
|
||||
* @domain: where the error comes from
|
||||
* @code: the error code
|
||||
* @node: the context node
|
||||
* @extra: extra informations
|
||||
*
|
||||
* Handle an out of memory condition
|
||||
*/
|
||||
void
|
||||
__xmlSimpleError(int domain, int code, xmlNodePtr node,
|
||||
const char *msg, const char *extra)
|
||||
{
|
||||
|
||||
if (code == XML_ERR_NO_MEMORY) {
|
||||
if (extra)
|
||||
__xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
|
||||
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra,
|
||||
NULL, NULL, 0, 0,
|
||||
"Memory allocation failed : %s\n", extra);
|
||||
else
|
||||
__xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
|
||||
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL,
|
||||
NULL, NULL, 0, 0, "Memory allocation failed\n");
|
||||
} else {
|
||||
__xmlRaiseError(NULL, NULL, NULL, NULL, node, domain,
|
||||
code, XML_ERR_ERROR, NULL, 0, extra,
|
||||
NULL, NULL, 0, 0, msg, extra);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* xmlParserError:
|
||||
* @ctx: an XML parser context
|
||||
* @msg: the message to display/transmit
|
||||
* @...: extra parameters for the message display
|
||||
*
|
||||
* Display and format an error messages, gives file, line, position and
|
||||
* extra parameters.
|
||||
*/
|
||||
void XMLCDECL
|
||||
xmlParserError(void *ctx, const char *msg, ...)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlParserInputPtr input = NULL;
|
||||
xmlParserInputPtr cur = NULL;
|
||||
char * str;
|
||||
|
||||
if (ctxt != NULL) {
|
||||
input = ctxt->input;
|
||||
if ((input != NULL) && (input->filename == NULL) &&
|
||||
(ctxt->inputNr > 1)) {
|
||||
cur = input;
|
||||
input = ctxt->inputTab[ctxt->inputNr - 2];
|
||||
}
|
||||
xmlParserPrintFileInfo(input);
|
||||
}
|
||||
|
||||
xmlGenericError(xmlGenericErrorContext, "error: ");
|
||||
XML_GET_VAR_STR(msg, str);
|
||||
xmlGenericError(xmlGenericErrorContext, "%s", str);
|
||||
if (str != NULL)
|
||||
xmlFree(str);
|
||||
|
||||
if (ctxt != NULL) {
|
||||
xmlParserPrintFileContext(input);
|
||||
if (cur != NULL) {
|
||||
xmlParserPrintFileInfo(cur);
|
||||
xmlGenericError(xmlGenericErrorContext, "\n");
|
||||
xmlParserPrintFileContext(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParserWarning:
|
||||
* @ctx: an XML parser context
|
||||
* @msg: the message to display/transmit
|
||||
* @...: extra parameters for the message display
|
||||
*
|
||||
* Display and format a warning messages, gives file, line, position and
|
||||
* extra parameters.
|
||||
*/
|
||||
void XMLCDECL
|
||||
xmlParserWarning(void *ctx, const char *msg, ...)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlParserInputPtr input = NULL;
|
||||
xmlParserInputPtr cur = NULL;
|
||||
char * str;
|
||||
|
||||
if (ctxt != NULL) {
|
||||
input = ctxt->input;
|
||||
if ((input != NULL) && (input->filename == NULL) &&
|
||||
(ctxt->inputNr > 1)) {
|
||||
cur = input;
|
||||
input = ctxt->inputTab[ctxt->inputNr - 2];
|
||||
}
|
||||
xmlParserPrintFileInfo(input);
|
||||
}
|
||||
|
||||
xmlGenericError(xmlGenericErrorContext, "warning: ");
|
||||
XML_GET_VAR_STR(msg, str);
|
||||
xmlGenericError(xmlGenericErrorContext, "%s", str);
|
||||
if (str != NULL)
|
||||
xmlFree(str);
|
||||
|
||||
if (ctxt != NULL) {
|
||||
xmlParserPrintFileContext(input);
|
||||
if (cur != NULL) {
|
||||
xmlParserPrintFileInfo(cur);
|
||||
xmlGenericError(xmlGenericErrorContext, "\n");
|
||||
xmlParserPrintFileContext(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Handling of validation errors *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* xmlParserValidityError:
|
||||
* @ctx: an XML parser context
|
||||
* @msg: the message to display/transmit
|
||||
* @...: extra parameters for the message display
|
||||
*
|
||||
* Display and format an validity error messages, gives file,
|
||||
* line, position and extra parameters.
|
||||
*/
|
||||
void XMLCDECL
|
||||
xmlParserValidityError(void *ctx, const char *msg, ...)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlParserInputPtr input = NULL;
|
||||
char * str;
|
||||
int len = xmlStrlen((const xmlChar *) msg);
|
||||
static int had_info = 0;
|
||||
|
||||
if ((len > 1) && (msg[len - 2] != ':')) {
|
||||
if (ctxt != NULL) {
|
||||
input = ctxt->input;
|
||||
if ((input->filename == NULL) && (ctxt->inputNr > 1))
|
||||
input = ctxt->inputTab[ctxt->inputNr - 2];
|
||||
|
||||
if (had_info == 0) {
|
||||
xmlParserPrintFileInfo(input);
|
||||
}
|
||||
}
|
||||
xmlGenericError(xmlGenericErrorContext, "validity error: ");
|
||||
had_info = 0;
|
||||
} else {
|
||||
had_info = 1;
|
||||
}
|
||||
|
||||
XML_GET_VAR_STR(msg, str);
|
||||
xmlGenericError(xmlGenericErrorContext, "%s", str);
|
||||
if (str != NULL)
|
||||
xmlFree(str);
|
||||
|
||||
if ((ctxt != NULL) && (input != NULL)) {
|
||||
xmlParserPrintFileContext(input);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlParserValidityWarning:
|
||||
* @ctx: an XML parser context
|
||||
* @msg: the message to display/transmit
|
||||
* @...: extra parameters for the message display
|
||||
*
|
||||
* Display and format a validity warning messages, gives file, line,
|
||||
* position and extra parameters.
|
||||
*/
|
||||
void XMLCDECL
|
||||
xmlParserValidityWarning(void *ctx, const char *msg, ...)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
xmlParserInputPtr input = NULL;
|
||||
char * str;
|
||||
int len = xmlStrlen((const xmlChar *) msg);
|
||||
|
||||
if ((ctxt != NULL) && (len != 0) && (msg[len - 1] != ':')) {
|
||||
input = ctxt->input;
|
||||
if ((input->filename == NULL) && (ctxt->inputNr > 1))
|
||||
input = ctxt->inputTab[ctxt->inputNr - 2];
|
||||
|
||||
xmlParserPrintFileInfo(input);
|
||||
}
|
||||
|
||||
xmlGenericError(xmlGenericErrorContext, "validity warning: ");
|
||||
XML_GET_VAR_STR(msg, str);
|
||||
xmlGenericError(xmlGenericErrorContext, "%s", str);
|
||||
if (str != NULL)
|
||||
xmlFree(str);
|
||||
|
||||
if (ctxt != NULL) {
|
||||
xmlParserPrintFileContext(input);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* Extended Error Handling *
|
||||
* *
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* xmlGetLastError:
|
||||
*
|
||||
* Get the last global error registered. This is per thread if compiled
|
||||
* with thread support.
|
||||
*
|
||||
* Returns NULL if no error occured or a pointer to the error
|
||||
*/
|
||||
xmlErrorPtr
|
||||
xmlGetLastError(void)
|
||||
{
|
||||
if (xmlLastError.code == XML_ERR_OK)
|
||||
return (NULL);
|
||||
return (&xmlLastError);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlResetError:
|
||||
* @err: pointer to the error.
|
||||
*
|
||||
* Cleanup the error.
|
||||
*/
|
||||
void
|
||||
xmlResetError(xmlErrorPtr err)
|
||||
{
|
||||
if (err == NULL)
|
||||
return;
|
||||
if (err->code == XML_ERR_OK)
|
||||
return;
|
||||
if (err->message != NULL)
|
||||
xmlFree(err->message);
|
||||
if (err->file != NULL)
|
||||
xmlFree(err->file);
|
||||
if (err->str1 != NULL)
|
||||
xmlFree(err->str1);
|
||||
if (err->str2 != NULL)
|
||||
xmlFree(err->str2);
|
||||
if (err->str3 != NULL)
|
||||
xmlFree(err->str3);
|
||||
memset(err, 0, sizeof(xmlError));
|
||||
err->code = XML_ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlResetLastError:
|
||||
*
|
||||
* Cleanup the last global error registered. For parsing error
|
||||
* this does not change the well-formedness result.
|
||||
*/
|
||||
void
|
||||
xmlResetLastError(void)
|
||||
{
|
||||
if (xmlLastError.code == XML_ERR_OK)
|
||||
return;
|
||||
xmlResetError(&xmlLastError);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCtxtGetLastError:
|
||||
* @ctx: an XML parser context
|
||||
*
|
||||
* Get the last parsing error registered.
|
||||
*
|
||||
* Returns NULL if no error occured or a pointer to the error
|
||||
*/
|
||||
xmlErrorPtr
|
||||
xmlCtxtGetLastError(void *ctx)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
|
||||
if (ctxt == NULL)
|
||||
return (NULL);
|
||||
if (ctxt->lastError.code == XML_ERR_OK)
|
||||
return (NULL);
|
||||
return (&ctxt->lastError);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCtxtResetLastError:
|
||||
* @ctx: an XML parser context
|
||||
*
|
||||
* Cleanup the last global error registered. For parsing error
|
||||
* this does not change the well-formedness result.
|
||||
*/
|
||||
void
|
||||
xmlCtxtResetLastError(void *ctx)
|
||||
{
|
||||
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
|
||||
|
||||
if (ctxt == NULL)
|
||||
return;
|
||||
ctxt->errNo = XML_ERR_OK;
|
||||
if (ctxt->lastError.code == XML_ERR_OK)
|
||||
return;
|
||||
xmlResetError(&ctxt->lastError);
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlCopyError:
|
||||
* @from: a source error
|
||||
* @to: a target error
|
||||
*
|
||||
* Save the original error to the new place.
|
||||
*
|
||||
* Returns 0 in case of success and -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xmlCopyError(xmlErrorPtr from, xmlErrorPtr to) {
|
||||
char *message, *file, *str1, *str2, *str3;
|
||||
|
||||
if ((from == NULL) || (to == NULL))
|
||||
return(-1);
|
||||
|
||||
message = (char *) xmlStrdup((xmlChar *) from->message);
|
||||
file = (char *) xmlStrdup ((xmlChar *) from->file);
|
||||
str1 = (char *) xmlStrdup ((xmlChar *) from->str1);
|
||||
str2 = (char *) xmlStrdup ((xmlChar *) from->str2);
|
||||
str3 = (char *) xmlStrdup ((xmlChar *) from->str3);
|
||||
|
||||
if (to->message != NULL)
|
||||
xmlFree(to->message);
|
||||
if (to->file != NULL)
|
||||
xmlFree(to->file);
|
||||
if (to->str1 != NULL)
|
||||
xmlFree(to->str1);
|
||||
if (to->str2 != NULL)
|
||||
xmlFree(to->str2);
|
||||
if (to->str3 != NULL)
|
||||
xmlFree(to->str3);
|
||||
to->domain = from->domain;
|
||||
to->code = from->code;
|
||||
to->level = from->level;
|
||||
to->line = from->line;
|
||||
to->node = from->node;
|
||||
to->int1 = from->int1;
|
||||
to->int2 = from->int2;
|
||||
to->node = from->node;
|
||||
to->ctxt = from->ctxt;
|
||||
to->message = message;
|
||||
to->file = file;
|
||||
to->str1 = str1;
|
||||
to->str2 = str2;
|
||||
to->str3 = str3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define bottom_error
|
||||
#include "elfgcchack.h"
|
||||
1114
node_modules/libxmljs/vendor/libxml/globals.c
generated
vendored
Normal file
1114
node_modules/libxmljs/vendor/libxml/globals.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1124
node_modules/libxmljs/vendor/libxml/hash.c
generated
vendored
Normal file
1124
node_modules/libxmljs/vendor/libxml/hash.c
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
96
node_modules/libxmljs/vendor/libxml/include/libxml/DOCBparser.h
generated
vendored
Normal file
96
node_modules/libxmljs/vendor/libxml/include/libxml/DOCBparser.h
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* Summary: old DocBook SGML parser
|
||||
* Description: interface for a DocBook SGML non-verifying parser
|
||||
* This code is DEPRECATED, and should not be used anymore.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __DOCB_PARSER_H__
|
||||
#define __DOCB_PARSER_H__
|
||||
#include <libxml/xmlversion.h>
|
||||
|
||||
#ifdef LIBXML_DOCB_ENABLED
|
||||
|
||||
#include <libxml/parser.h>
|
||||
#include <libxml/parserInternals.h>
|
||||
|
||||
#ifndef IN_LIBXML
|
||||
#ifdef __GNUC__
|
||||
#warning "The DOCBparser module has been deprecated in libxml2-2.6.0"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Most of the back-end structures from XML and SGML are shared.
|
||||
*/
|
||||
typedef xmlParserCtxt docbParserCtxt;
|
||||
typedef xmlParserCtxtPtr docbParserCtxtPtr;
|
||||
typedef xmlSAXHandler docbSAXHandler;
|
||||
typedef xmlSAXHandlerPtr docbSAXHandlerPtr;
|
||||
typedef xmlParserInput docbParserInput;
|
||||
typedef xmlParserInputPtr docbParserInputPtr;
|
||||
typedef xmlDocPtr docbDocPtr;
|
||||
|
||||
/*
|
||||
* There is only few public functions.
|
||||
*/
|
||||
XMLPUBFUN int XMLCALL
|
||||
docbEncodeEntities(unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen, int quoteChar);
|
||||
|
||||
XMLPUBFUN docbDocPtr XMLCALL
|
||||
docbSAXParseDoc (xmlChar *cur,
|
||||
const char *encoding,
|
||||
docbSAXHandlerPtr sax,
|
||||
void *userData);
|
||||
XMLPUBFUN docbDocPtr XMLCALL
|
||||
docbParseDoc (xmlChar *cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN docbDocPtr XMLCALL
|
||||
docbSAXParseFile (const char *filename,
|
||||
const char *encoding,
|
||||
docbSAXHandlerPtr sax,
|
||||
void *userData);
|
||||
XMLPUBFUN docbDocPtr XMLCALL
|
||||
docbParseFile (const char *filename,
|
||||
const char *encoding);
|
||||
|
||||
/**
|
||||
* Interfaces for the Push mode.
|
||||
*/
|
||||
XMLPUBFUN void XMLCALL
|
||||
docbFreeParserCtxt (docbParserCtxtPtr ctxt);
|
||||
XMLPUBFUN docbParserCtxtPtr XMLCALL
|
||||
docbCreatePushParserCtxt(docbSAXHandlerPtr sax,
|
||||
void *user_data,
|
||||
const char *chunk,
|
||||
int size,
|
||||
const char *filename,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN int XMLCALL
|
||||
docbParseChunk (docbParserCtxtPtr ctxt,
|
||||
const char *chunk,
|
||||
int size,
|
||||
int terminate);
|
||||
XMLPUBFUN docbParserCtxtPtr XMLCALL
|
||||
docbCreateFileParserCtxt(const char *filename,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int XMLCALL
|
||||
docbParseDocument (docbParserCtxtPtr ctxt);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_DOCB_ENABLED */
|
||||
|
||||
#endif /* __DOCB_PARSER_H__ */
|
||||
306
node_modules/libxmljs/vendor/libxml/include/libxml/HTMLparser.h
generated
vendored
Normal file
306
node_modules/libxmljs/vendor/libxml/include/libxml/HTMLparser.h
generated
vendored
Normal file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
* Summary: interface for an HTML 4.0 non-verifying parser
|
||||
* Description: this module implements an HTML 4.0 non-verifying parser
|
||||
* with API compatible with the XML parser ones. It should
|
||||
* be able to parse "real world" HTML, even if severely
|
||||
* broken from a specification point of view.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __HTML_PARSER_H__
|
||||
#define __HTML_PARSER_H__
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/parser.h>
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Most of the back-end structures from XML and HTML are shared.
|
||||
*/
|
||||
typedef xmlParserCtxt htmlParserCtxt;
|
||||
typedef xmlParserCtxtPtr htmlParserCtxtPtr;
|
||||
typedef xmlParserNodeInfo htmlParserNodeInfo;
|
||||
typedef xmlSAXHandler htmlSAXHandler;
|
||||
typedef xmlSAXHandlerPtr htmlSAXHandlerPtr;
|
||||
typedef xmlParserInput htmlParserInput;
|
||||
typedef xmlParserInputPtr htmlParserInputPtr;
|
||||
typedef xmlDocPtr htmlDocPtr;
|
||||
typedef xmlNodePtr htmlNodePtr;
|
||||
|
||||
/*
|
||||
* Internal description of an HTML element, representing HTML 4.01
|
||||
* and XHTML 1.0 (which share the same structure).
|
||||
*/
|
||||
typedef struct _htmlElemDesc htmlElemDesc;
|
||||
typedef htmlElemDesc *htmlElemDescPtr;
|
||||
struct _htmlElemDesc {
|
||||
const char *name; /* The tag name */
|
||||
char startTag; /* Whether the start tag can be implied */
|
||||
char endTag; /* Whether the end tag can be implied */
|
||||
char saveEndTag; /* Whether the end tag should be saved */
|
||||
char empty; /* Is this an empty element ? */
|
||||
char depr; /* Is this a deprecated element ? */
|
||||
char dtd; /* 1: only in Loose DTD, 2: only Frameset one */
|
||||
char isinline; /* is this a block 0 or inline 1 element */
|
||||
const char *desc; /* the description */
|
||||
|
||||
/* NRK Jan.2003
|
||||
* New fields encapsulating HTML structure
|
||||
*
|
||||
* Bugs:
|
||||
* This is a very limited representation. It fails to tell us when
|
||||
* an element *requires* subelements (we only have whether they're
|
||||
* allowed or not), and it doesn't tell us where CDATA and PCDATA
|
||||
* are allowed. Some element relationships are not fully represented:
|
||||
* these are flagged with the word MODIFIER
|
||||
*/
|
||||
const char** subelts; /* allowed sub-elements of this element */
|
||||
const char* defaultsubelt; /* subelement for suggested auto-repair
|
||||
if necessary or NULL */
|
||||
const char** attrs_opt; /* Optional Attributes */
|
||||
const char** attrs_depr; /* Additional deprecated attributes */
|
||||
const char** attrs_req; /* Required attributes */
|
||||
};
|
||||
|
||||
/*
|
||||
* Internal description of an HTML entity.
|
||||
*/
|
||||
typedef struct _htmlEntityDesc htmlEntityDesc;
|
||||
typedef htmlEntityDesc *htmlEntityDescPtr;
|
||||
struct _htmlEntityDesc {
|
||||
unsigned int value; /* the UNICODE value for the character */
|
||||
const char *name; /* The entity name */
|
||||
const char *desc; /* the description */
|
||||
};
|
||||
|
||||
/*
|
||||
* There is only few public functions.
|
||||
*/
|
||||
XMLPUBFUN const htmlElemDesc * XMLCALL
|
||||
htmlTagLookup (const xmlChar *tag);
|
||||
XMLPUBFUN const htmlEntityDesc * XMLCALL
|
||||
htmlEntityLookup(const xmlChar *name);
|
||||
XMLPUBFUN const htmlEntityDesc * XMLCALL
|
||||
htmlEntityValueLookup(unsigned int value);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlIsAutoClosed(htmlDocPtr doc,
|
||||
htmlNodePtr elem);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlAutoCloseTag(htmlDocPtr doc,
|
||||
const xmlChar *name,
|
||||
htmlNodePtr elem);
|
||||
XMLPUBFUN const htmlEntityDesc * XMLCALL
|
||||
htmlParseEntityRef(htmlParserCtxtPtr ctxt,
|
||||
const xmlChar **str);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlParseCharRef(htmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlParseElement(htmlParserCtxtPtr ctxt);
|
||||
|
||||
XMLPUBFUN htmlParserCtxtPtr XMLCALL
|
||||
htmlNewParserCtxt(void);
|
||||
|
||||
XMLPUBFUN htmlParserCtxtPtr XMLCALL
|
||||
htmlCreateMemoryParserCtxt(const char *buffer,
|
||||
int size);
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlParseDocument(htmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlSAXParseDoc (xmlChar *cur,
|
||||
const char *encoding,
|
||||
htmlSAXHandlerPtr sax,
|
||||
void *userData);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlParseDoc (xmlChar *cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlSAXParseFile(const char *filename,
|
||||
const char *encoding,
|
||||
htmlSAXHandlerPtr sax,
|
||||
void *userData);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlParseFile (const char *filename,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int XMLCALL
|
||||
UTF8ToHtml (unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlEncodeEntities(unsigned char *out,
|
||||
int *outlen,
|
||||
const unsigned char *in,
|
||||
int *inlen, int quoteChar);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlIsScriptAttribute(const xmlChar *name);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlHandleOmittedElem(int val);
|
||||
|
||||
#ifdef LIBXML_PUSH_ENABLED
|
||||
/**
|
||||
* Interfaces for the Push mode.
|
||||
*/
|
||||
XMLPUBFUN htmlParserCtxtPtr XMLCALL
|
||||
htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
|
||||
void *user_data,
|
||||
const char *chunk,
|
||||
int size,
|
||||
const char *filename,
|
||||
xmlCharEncoding enc);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlParseChunk (htmlParserCtxtPtr ctxt,
|
||||
const char *chunk,
|
||||
int size,
|
||||
int terminate);
|
||||
#endif /* LIBXML_PUSH_ENABLED */
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
|
||||
|
||||
/*
|
||||
* New set of simpler/more flexible APIs
|
||||
*/
|
||||
/**
|
||||
* xmlParserOption:
|
||||
*
|
||||
* This is the set of XML parser options that can be passed down
|
||||
* to the xmlReadDoc() and similar calls.
|
||||
*/
|
||||
typedef enum {
|
||||
HTML_PARSE_RECOVER = 1<<0, /* Relaxed parsing */
|
||||
HTML_PARSE_NODEFDTD = 1<<2, /* do not default a doctype if not found */
|
||||
HTML_PARSE_NOERROR = 1<<5, /* suppress error reports */
|
||||
HTML_PARSE_NOWARNING= 1<<6, /* suppress warning reports */
|
||||
HTML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
|
||||
HTML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
|
||||
HTML_PARSE_NONET = 1<<11,/* Forbid network access */
|
||||
HTML_PARSE_NOIMPLIED= 1<<13,/* Do not add implied html/body... elements */
|
||||
HTML_PARSE_COMPACT = 1<<16,/* compact small text nodes */
|
||||
HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
|
||||
} htmlParserOption;
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlCtxtReset (htmlParserCtxtPtr ctxt);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlReadDoc (const xmlChar *cur,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlReadFile (const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlReadMemory (const char *buffer,
|
||||
int size,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlReadFd (int fd,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlReadIO (xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
|
||||
const xmlChar *cur,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
|
||||
const char *filename,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
|
||||
const char *buffer,
|
||||
int size,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
|
||||
int fd,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
|
||||
xmlInputReadCallback ioread,
|
||||
xmlInputCloseCallback ioclose,
|
||||
void *ioctx,
|
||||
const char *URL,
|
||||
const char *encoding,
|
||||
int options);
|
||||
|
||||
/* NRK/Jan2003: further knowledge of HTML structure
|
||||
*/
|
||||
typedef enum {
|
||||
HTML_NA = 0 , /* something we don't check at all */
|
||||
HTML_INVALID = 0x1 ,
|
||||
HTML_DEPRECATED = 0x2 ,
|
||||
HTML_VALID = 0x4 ,
|
||||
HTML_REQUIRED = 0xc /* VALID bit set so ( & HTML_VALID ) is TRUE */
|
||||
} htmlStatus ;
|
||||
|
||||
/* Using htmlElemDesc rather than name here, to emphasise the fact
|
||||
that otherwise there's a lookup overhead
|
||||
*/
|
||||
XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
|
||||
XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
|
||||
XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
|
||||
XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
|
||||
/**
|
||||
* htmlDefaultSubelement:
|
||||
* @elt: HTML element
|
||||
*
|
||||
* Returns the default subelement for this element
|
||||
*/
|
||||
#define htmlDefaultSubelement(elt) elt->defaultsubelt
|
||||
/**
|
||||
* htmlElementAllowedHereDesc:
|
||||
* @parent: HTML parent element
|
||||
* @elt: HTML element
|
||||
*
|
||||
* Checks whether an HTML element description may be a
|
||||
* direct child of the specified element.
|
||||
*
|
||||
* Returns 1 if allowed; 0 otherwise.
|
||||
*/
|
||||
#define htmlElementAllowedHereDesc(parent,elt) \
|
||||
htmlElementAllowedHere((parent), (elt)->name)
|
||||
/**
|
||||
* htmlRequiredAttrs:
|
||||
* @elt: HTML element
|
||||
*
|
||||
* Returns the attributes required for the specified element.
|
||||
*/
|
||||
#define htmlRequiredAttrs(elt) (elt)->attrs_req
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
#endif /* __HTML_PARSER_H__ */
|
||||
147
node_modules/libxmljs/vendor/libxml/include/libxml/HTMLtree.h
generated
vendored
Normal file
147
node_modules/libxmljs/vendor/libxml/include/libxml/HTMLtree.h
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Summary: specific APIs to process HTML tree, especially serialization
|
||||
* Description: this module implements a few function needed to process
|
||||
* tree in an HTML specific way.
|
||||
*
|
||||
* Copy: See Copyright for the status of this software.
|
||||
*
|
||||
* Author: Daniel Veillard
|
||||
*/
|
||||
|
||||
#ifndef __HTML_TREE_H__
|
||||
#define __HTML_TREE_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <libxml/xmlversion.h>
|
||||
#include <libxml/tree.h>
|
||||
#include <libxml/HTMLparser.h>
|
||||
|
||||
#ifdef LIBXML_HTML_ENABLED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* HTML_TEXT_NODE:
|
||||
*
|
||||
* Macro. A text node in a HTML document is really implemented
|
||||
* the same way as a text node in an XML document.
|
||||
*/
|
||||
#define HTML_TEXT_NODE XML_TEXT_NODE
|
||||
/**
|
||||
* HTML_ENTITY_REF_NODE:
|
||||
*
|
||||
* Macro. An entity reference in a HTML document is really implemented
|
||||
* the same way as an entity reference in an XML document.
|
||||
*/
|
||||
#define HTML_ENTITY_REF_NODE XML_ENTITY_REF_NODE
|
||||
/**
|
||||
* HTML_COMMENT_NODE:
|
||||
*
|
||||
* Macro. A comment in a HTML document is really implemented
|
||||
* the same way as a comment in an XML document.
|
||||
*/
|
||||
#define HTML_COMMENT_NODE XML_COMMENT_NODE
|
||||
/**
|
||||
* HTML_PRESERVE_NODE:
|
||||
*
|
||||
* Macro. A preserved node in a HTML document is really implemented
|
||||
* the same way as a CDATA section in an XML document.
|
||||
*/
|
||||
#define HTML_PRESERVE_NODE XML_CDATA_SECTION_NODE
|
||||
/**
|
||||
* HTML_PI_NODE:
|
||||
*
|
||||
* Macro. A processing instruction in a HTML document is really implemented
|
||||
* the same way as a processing instruction in an XML document.
|
||||
*/
|
||||
#define HTML_PI_NODE XML_PI_NODE
|
||||
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlNewDoc (const xmlChar *URI,
|
||||
const xmlChar *ExternalID);
|
||||
XMLPUBFUN htmlDocPtr XMLCALL
|
||||
htmlNewDocNoDtD (const xmlChar *URI,
|
||||
const xmlChar *ExternalID);
|
||||
XMLPUBFUN const xmlChar * XMLCALL
|
||||
htmlGetMetaEncoding (htmlDocPtr doc);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlSetMetaEncoding (htmlDocPtr doc,
|
||||
const xmlChar *encoding);
|
||||
#ifdef LIBXML_OUTPUT_ENABLED
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlDocDumpMemory (xmlDocPtr cur,
|
||||
xmlChar **mem,
|
||||
int *size);
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlDocDumpMemoryFormat (xmlDocPtr cur,
|
||||
xmlChar **mem,
|
||||
int *size,
|
||||
int format);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlDocDump (FILE *f,
|
||||
xmlDocPtr cur);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlSaveFile (const char *filename,
|
||||
xmlDocPtr cur);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlNodeDump (xmlBufferPtr buf,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlNodeDumpFile (FILE *out,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlNodeDumpFileFormat (FILE *out,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlSaveFileEnc (const char *filename,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlSaveFileFormat (const char *filename,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlDocContentDumpOutput(xmlOutputBufferPtr buf,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding);
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf,
|
||||
xmlDocPtr cur,
|
||||
const char *encoding,
|
||||
int format);
|
||||
XMLPUBFUN void XMLCALL
|
||||
htmlNodeDumpOutput (xmlOutputBufferPtr buf,
|
||||
xmlDocPtr doc,
|
||||
xmlNodePtr cur,
|
||||
const char *encoding);
|
||||
|
||||
#endif /* LIBXML_OUTPUT_ENABLED */
|
||||
|
||||
XMLPUBFUN int XMLCALL
|
||||
htmlIsBooleanAttr (const xmlChar *name);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBXML_HTML_ENABLED */
|
||||
|
||||
#endif /* __HTML_TREE_H__ */
|
||||
|
||||
54
node_modules/libxmljs/vendor/libxml/include/libxml/Makefile.am
generated
vendored
Normal file
54
node_modules/libxmljs/vendor/libxml/include/libxml/Makefile.am
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
xmlincdir = $(includedir)/libxml2/libxml
|
||||
|
||||
xmlinc_HEADERS = \
|
||||
SAX.h \
|
||||
entities.h \
|
||||
encoding.h \
|
||||
parser.h \
|
||||
parserInternals.h \
|
||||
xmlerror.h \
|
||||
HTMLparser.h \
|
||||
HTMLtree.h \
|
||||
debugXML.h \
|
||||
tree.h \
|
||||
list.h \
|
||||
hash.h \
|
||||
xpath.h \
|
||||
xpathInternals.h \
|
||||
xpointer.h \
|
||||
xinclude.h \
|
||||
xmlIO.h \
|
||||
xmlmemory.h \
|
||||
nanohttp.h \
|
||||
nanoftp.h \
|
||||
uri.h \
|
||||
valid.h \
|
||||
xlink.h \
|
||||
xmlversion.h \
|
||||
DOCBparser.h \
|
||||
catalog.h \
|
||||
threads.h \
|
||||
globals.h \
|
||||
c14n.h \
|
||||
xmlautomata.h \
|
||||
xmlregexp.h \
|
||||
xmlmodule.h \
|
||||
xmlschemas.h \
|
||||
schemasInternals.h \
|
||||
xmlschemastypes.h \
|
||||
xmlstring.h \
|
||||
xmlunicode.h \
|
||||
xmlreader.h \
|
||||
relaxng.h \
|
||||
dict.h \
|
||||
SAX2.h \
|
||||
xmlexports.h \
|
||||
xmlwriter.h \
|
||||
chvalid.h \
|
||||
pattern.h \
|
||||
xmlsave.h \
|
||||
schematron.h
|
||||
|
||||
EXTRA_DIST = xmlversion.h.in
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user