Lines Matching refs:xml2js

38 var xml2js = {  variable
128 xml2js.opts = opts;
142 var NAMESPACE_SPEC = xml2js.opts.inputdir + '/namespace' + xml2js.opts.module + '.xml';
143 var CLASS_SPEC = function(c) { return xml2js.opts.inputdir + '/' + c + '.xml'; }
144 var TYPES_SPEC = xml2js.opts.inputdir + '/types_8h.xml';
145 xml2js.MODULE = xml2js.opts.module;
147xml2js.opts.typemaps ? initCustomPointerTypemaps(xml2js.opts.typemaps) : Promise.resolve(),
152 _.extend(xml2js.ENUMS, getEnums(xmlparser.parse(xml_types)[0], false));
153 _.extend(xml2js.ENUMS_BY_GROUP, getEnums(xmlparser.parse(xml_types)[0], true));
156 _.extend(xml2js.ENUMS, getEnums(spec_c, false));
157 _.extend(xml2js.ENUMS_BY_GROUP, getEnums(spec_c, true));
158 _.extend(xml2js.METHODS, getMethods(spec_c));
159 _.each(getSubclassNames(spec_c), function(className) { xml2js.CLASSES[className] = {} });
165 _.extend(xml2js.CLASSES[className], {
178 var parseGroups = fs.readdirAsync(xml2js.opts.inputdir).then(function(files) {
183 return fs.readFileAsync(xml2js.opts.inputdir + '/' + fn, 'utf8').then(function(xml) {
188 xml2js.CLASSGROUPS[group] = {
193 if (_.has(xml2js.CLASSES, c)) {
194 xml2js.CLASSES[c].group = group;
205 if (!_.isEmpty(xml2js.CLASSGROUPS)) {
207 var grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
208 var ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
211 xml2js.CLASSGROUPS[group].classes.push(c);
214 grouped = _.flatten(_.pluck(_.values(xml2js.CLASSGROUPS), 'classes'));
215 ungrouped = _.difference(_.keys(xml2js.CLASSES), grouped);
217 _.each(xml2js.ENUMS_BY_GROUP, function(enumGroupSpec, enumGroupName) {
219 xml2js.CLASSES[c].enums_by_group[enumGroupName] = enumGroupSpec;
221 xml2js.CLASSES[c].enums[enumName] = xml2js.ENUMS[enumName];
222 delete xml2js.ENUMS[enumName];
224 delete xml2js.ENUMS_BY_GROUP[enumGroupName];
229 if (xml2js.opts.custom && fs.existsSync(xml2js.opts.custom)) {
230 return fs.readFileAsync(xml2js.opts.custom, 'utf8').then(function(custom) {
238 …console.log(xml2js.opts.custom ? ('Error: No such customization file exists: ' + xml2js.opts.custo…
244 … return _.pick(xml2js, 'MODULE', 'ENUMS', 'ENUMS_BY_GROUP', 'METHODS', 'CLASSES', 'CLASSGROUPS');
287 xml2js.ARRAY_TYPEMAPS[from] = { arrayType: to, classes: [] };
314 if (_.has(xml2js.ARRAY_TYPEMAPS, datatype)) {
315 xml2js.ARRAY_TYPEMAPS[datatype].classes.push(className);
331 if (!_.has(xml2js.POINTER_TYPEMAPS, className)) {
332 xml2js.POINTER_TYPEMAPS[className] = {};
334 xml2js.POINTER_TYPEMAPS[className][from] = to;
345 var arrayTypes = _.pluck(_.values(xml2js.ARRAY_TYPEMAPS), 'arrayType');
346 var pointerTypes = _.uniq(_.flatten(_.map(_.values(xml2js.POINTER_TYPEMAPS), _.values)));
348 …var dataType = _.findKey(xml2js.ARRAY_TYPEMAPS, function(to) { return to.arrayType == arrayType; }…
349 xml2js.CLASSES[arrayType] = {
356 xml2js.CLASSES[arrayType].methods[arrayType] = {
366 xml2js.CLASSES[arrayType].methods.getitem = {
379 xml2js.CLASSES[arrayType].methods.setitem = {
394 …var pointerDataTypeMap = _.reduce(_.map(_.values(xml2js.POINTER_TYPEMAPS), _.invert), function(mem…
399 xml2js.CLASSES[pointerType] = {
406 xml2js.CLASSES[pointerType].methods[pointerType] = {
411 xml2js.CLASSES[pointerType].methods.value = {
419 xml2js.CLASSES[pointerType].methods.assign = {
435 var filterClasses = function(fn) { return _.without(_.map(xml2js.CLASSES, fn), undefined); };
451 return _.without(_.uniq(_.pluck(_.pick(xml2js.CLASSES, classes), 'group')), undefined);
459 …_.extend(xml2js.CLASSES[className].methods, _.pick(classMethods, function(methodSpec, methodName) {
468 xml2js.METHODS = _.pick(xml2js.METHODS, function(methodSpec, methodName) {
471 _.each(xml2js.CLASSES, function(classSpec, className) {
475 if (xml2js.opts.strict) {
476 xml2js.CLASSES[className].methods = valid;
484 _.each(xml2js.CLASSES, function(classSpec, className) {
488 if (xml2js.opts.strict) {
489 xml2js.CLASSES[className].variables = valid;
498 … = _.once(function() { console.log(methodName + ' from ' + path.basename(xml2js.opts.custom) + ' i…
558 return getText(getChild(spec_c, 'compoundname'), 'name').replace(xml2js.opts.module + '::', '');
579 return getText(innerclass).replace(xml2js.opts.module + '::', '');
597 if (!_.has(xml2js.CLASSES, parent)) {
736 _.find(xml2js.TYPEMAPS, function(to, from) {
746 …if (_.has(xml2js.ARRAY_TYPEMAPS, dataType) && _.contains(xml2js.ARRAY_TYPEMAPS[dataType].classes, …
747 type_js = xml2js.ARRAY_TYPEMAPS[dataType].arrayType;
748 …} else if (_.has(xml2js.POINTER_TYPEMAPS, className) && _.has(xml2js.POINTER_TYPEMAPS[className], …
749 type_js = xml2js.POINTER_TYPEMAPS[className][dataType];
750 } else if (_.has(xml2js.CLASSES, dataType)) { // TODO: verify that swig does this mapping
763 var msg = (xml2js.opts.strict ? ' is omitted from JS documentation.' : ' has invalid type(s).');
786 var msgAddendum = (xml2js.opts.strict ? ' Omitted from JS documentation.' : '');
795 return (_.contains(_.values(xml2js.TYPEMAPS), type) ||
796 _.has(xml2js.CLASSES, type) ||
797 _.has(xml2js.ENUMS_BY_GROUP, type) ||
799 _.has((parent ? xml2js.CLASSES[parent].enums_by_group : []), type) ||
806 var arrayTypemap = _.find(xml2js.ARRAY_TYPEMAPS, function(to) { return to.arrayType == type; });
808 …(_.has(xml2js.POINTER_TYPEMAPS, className) && (_.contains(_.values(xml2js.POINTER_TYPEMAPS[classNa…
887 return text += ' \n \n![' + fn + '](' + xml2js.opts.imagedir + '/' + fn + ') ';
935 module.exports = xml2js;