]> git.saurik.com Git - wxWidgets.git/blob - wxPython/SWIG/swig.xmlout.patch
These files just changed in SWIG again, so update the patches again.
[wxWidgets.git] / wxPython / SWIG / swig.xmlout.patch
1 Index: Source/Swig/swig.h
2 ===================================================================
3 RCS file: /cvsroot/SWIG/Source/Swig/swig.h,v
4 retrieving revision 1.80
5 diff -u -4 -r1.80 swig.h
6 --- Source/Swig/swig.h 22 Jan 2004 22:42:18 -0000 1.80
7 +++ Source/Swig/swig.h 22 Jan 2004 22:51:44 -0000
8 @@ -364,8 +364,10 @@
9 extern void Swig_print_tags(File *obj, Node *root);
10 extern void Swig_print_tree(Node *obj);
11 extern void Swig_print_node(Node *obj);
12
13 +extern void Swig_print_xml(Node *obj, String* filename);
14 +
15 /* -- Wrapper function Object */
16
17 typedef struct {
18 Hash *localh;
19 Index: Source/Modules/main.cxx
20 ===================================================================
21 RCS file: /cvsroot/SWIG/Source/Modules/main.cxx,v
22 retrieving revision 1.33
23 diff -u -4 -r1.33 main.cxx
24 --- Source/Modules/main.cxx 22 Jan 2004 22:42:15 -0000 1.33
25 +++ Source/Modules/main.cxx 22 Jan 2004 22:51:45 -0000
26 @@ -91,15 +91,17 @@
27 -w+321,401,-402 \n\
28 \n\
29 where code 321(+) is added, and 401(no sign) and 402(-) \n\
30 are suppressed. See documentation for code meanings.\n\
31 + -xmlout <file> - Write an XML version of the parse tree to file after normal processing\n\
32 \n";
33
34 // Local variables
35 static int freeze = 0;
36 static String *lang_config = 0;
37 static char *cpp_extension = (char *) "cxx";
38 static String *outdir = 0;
39 +static String *xmlout = 0;
40
41 // -----------------------------------------------------------------------------
42 // check_suffix(char *name)
43 //
44 @@ -215,8 +217,9 @@
45 char *includefiles[256];
46 int includecount = 0;
47 int dump_tags = 0;
48 int dump_tree = 0;
49 + int dump_xml = 0;
50 int browse = 0;
51 int dump_typedef = 0;
52 int dump_classes = 0;
53 int werror = 0;
54 @@ -483,8 +486,20 @@
55 Swig_mark_arg(i);
56 } else if (strcmp(argv[i],"-dump_tree") == 0) {
57 dump_tree = 1;
58 Swig_mark_arg(i);
59 + } else if (strcmp(argv[i],"-dump_xml") == 0) {
60 + dump_xml = 1;
61 + Swig_mark_arg(i);
62 + } else if (strcmp(argv[i],"-xmlout") == 0) {
63 + dump_xml = 1;
64 + Swig_mark_arg(i);
65 + if (argv[i+1]) {
66 + xmlout = NewString(argv[i+1]);
67 + Swig_mark_arg(i+1);
68 + } else {
69 + Swig_arg_error();
70 + }
71 } else if (strcmp(argv[i],"-nocontract") == 0) {
72 Swig_mark_arg(i);
73 Swig_contract_mode_set(0);
74 } else if (strcmp(argv[i],"-browse") == 0) {
75 @@ -734,8 +749,11 @@
76 }
77 }
78 if (dump_tree) {
79 Swig_print_tree(top);
80 + }
81 + if (dump_xml) {
82 + Swig_print_xml(top, xmlout);
83 }
84 }
85 if (tm_debug) Swig_typemap_debug();
86 if (memory_debug) DohMemoryDebug();
87 Index: Source/Modules/xml.cxx
88 ===================================================================
89 RCS file: /cvsroot/SWIG/Source/Modules/xml.cxx,v
90 retrieving revision 1.10
91 diff -u -4 -r1.10 xml.cxx
92 --- Source/Modules/xml.cxx 22 Jan 2004 22:42:18 -0000 1.10
93 +++ Source/Modules/xml.cxx 22 Jan 2004 22:51:45 -0000
94 @@ -197,18 +197,19 @@
95 Replaceall( o, "&", "&amp;" );
96 Replaceall( o, "<", "&lt;" );
97 Replaceall( o, "\"", "&quot;" );
98 Replaceall( o, "\\", "\\\\" );
99 - Printf(out,"<attribute name=\"%s\" value=\"%s\" id=\"%ld\" addr=\"%x\" />\n", ck, o, ++id, o );
100 + Replaceall( o, "\n", "&#10;" );
101 + Printf(out,"<attribute name=\"%s\" value=\"%s\" id=\"%ld\" addr=\"%x\" />\n", ck, o, ++id, o );
102 Delete(o);
103 Delete(ck);
104 }
105 else
106 {
107 o = Getattr(obj,k);
108 String *ck = NewString(k);
109 Replaceall( ck, ":", "_" );
110 - Printf(out,"<attribute name=\"%s\" value=\"%x\" id=\"%ld\" addr=\"%x\" />\n", ck, o, ++id, o );
111 + Printf(out,"<attribute name=\"%s\" value=\"%x\" id=\"%ld\" addr=\"%x\" />\n", ck, o, ++id, o );
112 Delete(ck);
113 }
114 }
115 ki = Next(ki);
116 @@ -318,11 +319,10 @@
117 {
118 print_indent(0);
119 Printf( out, "<%ssitem id=\"%ld\" addr=\"%x\" >\n", markup, ++id, n.item );
120 Xml_print_attributes( n.item );
121 - Printf( out, "</%ssitem >\n", markup );
122 print_indent(0);
123 - Printf( out, " />\n" );
124 + Printf( out, "</%ssitem >\n", markup );
125 n = Next(n);
126 }
127 indent_level -= 4;
128 print_indent(0);
129 @@ -336,5 +336,36 @@
130 return new XML();
131 }
132 extern "C" Language * swig_xml( void ) {
133 return new_swig_xml();
134 +}
135 +
136 +
137 +/* -----------------------------------------------------------------------------
138 + * Swig_print_xml
139 + *
140 + * Dump an XML version of the parse tree. This is different from using the -xml
141 + * language module normally as it allows the real language module to process the
142 + * tree first, possibly stuffing in new attributes, so the XML that is output ends
143 + * up being a post-processing version of the tree.
144 + * ----------------------------------------------------------------------------- */
145 +
146 +void
147 +Swig_print_xml(DOH *obj, String* filename)
148 +{
149 + XML xml;
150 + xmllite = 1;
151 +
152 + if (! filename) {
153 + out = stdout;
154 + }
155 + else {
156 + out = NewFile(filename, "w");
157 + if (!out) {
158 + Printf(stderr,"*** Can't open '%s'\n", filename);
159 + SWIG_exit(EXIT_FAILURE);
160 + }
161 + }
162 +
163 + Printf( out, "<?xml version=\"1.0\" ?> \n" );
164 + xml.Xml_print_tree(obj);
165 }