aboutsummaryrefslogtreecommitdiff
path: root/Source/Modules/xml.cxx
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2024-04-10 14:15:29 -0700
committerAlistair Delva <adelva@google.com>2024-04-11 12:58:28 -0700
commitd0f0f90be16c2ac553b5fa08512045273135147a (patch)
tree5d9ebb7a04807ea8a609ddd18b0162bc87530e4b /Source/Modules/xml.cxx
parent6ffc1dbf29ba98c4d8aa71ebc9b484e973fe1030 (diff)
downloadswig-d0f0f90be16c2ac553b5fa08512045273135147a.tar.gz
Change-Id: I47cef2be94299220d80265d949a95b58eee2c23b
Diffstat (limited to 'Source/Modules/xml.cxx')
-rw-r--r--Source/Modules/xml.cxx65
1 files changed, 21 insertions, 44 deletions
diff --git a/Source/Modules/xml.cxx b/Source/Modules/xml.cxx
index 5f090561a..28611c5d4 100644
--- a/Source/Modules/xml.cxx
+++ b/Source/Modules/xml.cxx
@@ -4,7 +4,7 @@
* terms also apply to certain portions of SWIG. The full details of the SWIG
* license and copyrights can be found in the LICENSE and COPYRIGHT files
* included with the SWIG source code as distributed by the SWIG developers
- * and at http://www.swig.org/legal.html.
+ * and at https://www.swig.org/legal.html.
*
* xml.cxx
*
@@ -16,9 +16,7 @@
static const char *usage = "\
XML Options (available with -xml)\n\
-xmllang <lang> - Typedef language\n\
- -xmllite - More lightweight version of XML\n\
- ------\n\
- deprecated (use -o): -xml <output.xml> - Use <output.xml> as output file (extension .xml mandatory)\n";
+ -xmllite - More lightweight version of XML\n";
static File *out = 0;
static int xmllite = 0;
@@ -39,23 +37,6 @@ public:
virtual void main(int argc, char *argv[]) {
SWIG_typemap_lang("xml");
for (int iX = 0; iX < argc; iX++) {
- if (strcmp(argv[iX], "-xml") == 0) {
- char *extension = 0;
- if (iX + 1 >= argc)
- continue;
- extension = argv[iX + 1] + strlen(argv[iX + 1]) - 4;
- if (strcmp(extension, ".xml"))
- continue;
- iX++;
- Swig_mark_arg(iX);
- String *outfile = NewString(argv[iX]);
- out = NewFile(outfile, "w", SWIG_output_files());
- if (!out) {
- FileErrorDisplay(outfile);
- SWIG_exit(EXIT_FAILURE);
- }
- continue;
- }
if (strcmp(argv[iX], "-xmllang") == 0) {
Swig_mark_arg(iX);
iX++;
@@ -89,7 +70,7 @@ public:
out = NewFile(outfile, "w", SWIG_output_files());
if (!out) {
FileErrorDisplay(outfile);
- SWIG_exit(EXIT_FAILURE);
+ Exit(EXIT_FAILURE);
}
}
Printf(out, "<?xml version=\"1.0\" ?> \n");
@@ -118,7 +99,7 @@ public:
String *k;
indent_level += 4;
print_indent(0);
- Printf(out, "<attributelist id=\"%ld\" addr=\"%p\" >\n", ++id, obj);
+ Printf(out, "<attributelist id=\"%ld\" addr=\"%p\">\n", ++id, obj);
indent_level += 4;
Iterator ki;
ki = First(obj);
@@ -175,7 +156,7 @@ public:
}
indent_level -= 4;
print_indent(0);
- Printf(out, "</attributelist >\n");
+ Printf(out, "</attributelist>\n");
indent_level -= 4;
}
@@ -183,7 +164,7 @@ public:
Node *cobj;
print_indent(0);
- Printf(out, "<%s id=\"%ld\" addr=\"%p\" >\n", nodeType(obj), ++id, obj);
+ Printf(out, "<%s id=\"%ld\" addr=\"%p\">\n", nodeType(obj), ++id, obj);
Xml_print_attributes(obj);
cobj = firstChild(obj);
if (cobj) {
@@ -196,32 +177,32 @@ public:
Printf(out, "\n");
}
print_indent(0);
- Printf(out, "</%s >\n", nodeType(obj));
+ Printf(out, "</%s>\n", nodeType(obj));
}
void Xml_print_parmlist(ParmList *p, const char* markup = "parmlist") {
print_indent(0);
- Printf(out, "<%s id=\"%ld\" addr=\"%p\" >\n", markup, ++id, p);
+ Printf(out, "<%s id=\"%ld\" addr=\"%p\">\n", markup, ++id, p);
indent_level += 4;
while (p) {
print_indent(0);
Printf(out, "<parm id=\"%ld\">\n", ++id);
Xml_print_attributes(p);
print_indent(0);
- Printf(out, "</parm >\n");
+ Printf(out, "</parm>\n");
p = nextSibling(p);
}
indent_level -= 4;
print_indent(0);
- Printf(out, "</%s >\n", markup);
+ Printf(out, "</%s>\n", markup);
}
void Xml_print_baselist(List *p) {
print_indent(0);
- Printf(out, "<baselist id=\"%ld\" addr=\"%p\" >\n", ++id, p);
+ Printf(out, "<baselist id=\"%ld\" addr=\"%p\">\n", ++id, p);
indent_level += 4;
Iterator s;
for (s = First(p); s.item; s = Next(s)) {
@@ -232,7 +213,7 @@ public:
}
indent_level -= 4;
print_indent(0);
- Printf(out, "</baselist >\n");
+ Printf(out, "</baselist>\n");
}
String *Xml_escape_string(String *str) {
@@ -272,21 +253,21 @@ public:
void Xml_print_hash(Hash *p, const char *markup) {
print_indent(0);
- Printf(out, "<%s id=\"%ld\" addr=\"%p\" >\n", markup, ++id, p);
+ Printf(out, "<%s id=\"%ld\" addr=\"%p\">\n", markup, ++id, p);
Xml_print_attributes(p);
indent_level += 4;
Iterator n = First(p);
while (n.key) {
print_indent(0);
- Printf(out, "<%ssitem id=\"%ld\" addr=\"%p\" >\n", markup, ++id, n.item);
+ Printf(out, "<%ssitem id=\"%ld\" addr=\"%p\">\n", markup, ++id, n.item);
Xml_print_attributes(n.item);
print_indent(0);
- Printf(out, "</%ssitem >\n", markup);
+ Printf(out, "</%ssitem>\n", markup);
n = Next(n);
}
indent_level -= 4;
print_indent(0);
- Printf(out, "</%s >\n", markup);
+ Printf(out, "</%s>\n", markup);
}
};
@@ -300,18 +281,14 @@ public:
* up being a post-processing version of the tree.
* ----------------------------------------------------------------------------- */
-void Swig_print_xml(DOH *obj, String *filename) {
+void Swig_print_xml(Node *obj, String *filename) {
XML xml;
xmllite = 1;
- if (!filename) {
- out = stdout;
- } else {
- out = NewFile(filename, "w", SWIG_output_files());
- if (!out) {
- FileErrorDisplay(filename);
- SWIG_exit(EXIT_FAILURE);
- }
+ out = NewFile(filename, "w", SWIG_output_files());
+ if (!out) {
+ FileErrorDisplay(filename);
+ Exit(EXIT_FAILURE);
}
Printf(out, "<?xml version=\"1.0\" ?> \n");