2002-06-26 Rachel Hestilow <hestilow@ximian.com>
* generator/*.cs: Deal with whitespace XmlNodes. * parser/build.pl: Dump non-indented file to local directory. * parser/makefile, parser/formatXml.c: Added. * generator/gtkapi.xml: Nicely indented now. woo! svn path=/trunk/gtk-sharp/; revision=5465
This commit is contained in:
parent
34cf63f0cc
commit
b203c33bb7
14 changed files with 22246 additions and 12 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
|
||||||
|
|
||||||
|
* generator/*.cs: Deal with whitespace XmlNodes.
|
||||||
|
|
||||||
|
* parser/build.pl: Dump non-indented file to local directory.
|
||||||
|
|
||||||
|
* parser/makefile, parser/formatXml.c: Added.
|
||||||
|
|
||||||
|
* generator/gtkapi.xml: Nicely indented now. woo!
|
||||||
|
|
||||||
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
|
2002-06-26 Rachel Hestilow <hestilow@ximian.com>
|
||||||
|
|
||||||
* parser/Gtk.metadata: Change gtk_label_new to be the
|
* parser/Gtk.metadata: Change gtk_label_new to be the
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace GtkSharp.Generation {
|
||||||
Hashtable clash_map = new Hashtable();
|
Hashtable clash_map = new Hashtable();
|
||||||
|
|
||||||
foreach (XmlNode node in Elem.ChildNodes) {
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
|
if (!(node is XmlElement)) continue;
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
switch (node.Name) {
|
switch (node.Name) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ namespace GtkSharp.Generation {
|
||||||
|
|
||||||
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
|
protected ClassBase (XmlElement ns, XmlElement elem) : base (ns, elem) {
|
||||||
foreach (XmlNode node in elem.ChildNodes) {
|
foreach (XmlNode node in elem.ChildNodes) {
|
||||||
|
if (!(node is XmlElement)) continue;
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
switch (node.Name) {
|
switch (node.Name) {
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
||||||
foreach (XmlNode node in Elem.ChildNodes) {
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
if (node.Name != "member") {
|
if (!(node is XmlElement) || node.Name != "member") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace GtkSharp.Generation {
|
||||||
{
|
{
|
||||||
foreach (XmlNode node in elem.ChildNodes) {
|
foreach (XmlNode node in elem.ChildNodes) {
|
||||||
|
|
||||||
|
if (!(node is XmlElement)) continue;
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
switch (node.Name) {
|
switch (node.Name) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace GtkSharp.Generation {
|
||||||
public bool Validate ()
|
public bool Validate ()
|
||||||
{
|
{
|
||||||
foreach (XmlNode parm in elem.ChildNodes) {
|
foreach (XmlNode parm in elem.ChildNodes) {
|
||||||
if (parm.Name != "parameter") {
|
if (!(parm is XmlElement) || parm.Name != "parameter") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ namespace GtkSharp.Generation {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
string pass_as = "";
|
string pass_as = "";
|
||||||
foreach (XmlNode parm in elem.ChildNodes) {
|
foreach (XmlNode parm in elem.ChildNodes) {
|
||||||
if (parm.Name != "parameter") {
|
if (!(parm is XmlElement) || parm.Name != "parameter") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,12 @@ namespace GtkSharp.Generation {
|
||||||
if ((elem.ChildNodes == null) || (elem.ChildNodes.Count < 1))
|
if ((elem.ChildNodes == null) || (elem.ChildNodes.Count < 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
XmlElement p_elem = (XmlElement) elem.ChildNodes[elem.ChildNodes.Count - 1];
|
XmlElement p_elem = null;
|
||||||
|
foreach (XmlNode parm in elem.ChildNodes) {
|
||||||
|
if (!(parm is XmlElement) || parm.Name != "parameter")
|
||||||
|
continue;
|
||||||
|
p_elem = (XmlElement) parm;
|
||||||
|
}
|
||||||
string type = p_elem.GetAttribute("type");
|
string type = p_elem.GetAttribute("type");
|
||||||
return (type == "GError**");
|
return (type == "GError**");
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (XmlNode ns in root.ChildNodes) {
|
foreach (XmlNode ns in root.ChildNodes) {
|
||||||
if (ns.Name != "namespace") {
|
if (!(ns is XmlElement) || ns.Name != "namespace") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace GtkSharp.Generation {
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (XmlNode parm in params_elem.ChildNodes) {
|
foreach (XmlNode parm in params_elem.ChildNodes) {
|
||||||
if (parm.Name != "parameter") continue;
|
if (!(parm is XmlElement) || parm.Name != "parameter") continue;
|
||||||
|
|
||||||
XmlElement elem = (XmlElement) parm;
|
XmlElement elem = (XmlElement) parm;
|
||||||
String type = elem.GetAttribute("type");
|
String type = elem.GetAttribute("type");
|
||||||
|
|
|
@ -175,7 +175,7 @@ namespace GtkSharp.Generation {
|
||||||
bool need_comma = false;
|
bool need_comma = false;
|
||||||
|
|
||||||
foreach (XmlNode parm in parms.ChildNodes) {
|
foreach (XmlNode parm in parms.ChildNodes) {
|
||||||
if (parm.Name != "parameter") {
|
if (!(parm is XmlElement) || parm.Name != "parameter") {
|
||||||
Console.Write(parm.Name + " node ");
|
Console.Write(parm.Name + " node ");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ namespace GtkSharp.Generation {
|
||||||
bool need_comma = false;
|
bool need_comma = false;
|
||||||
|
|
||||||
foreach (XmlNode parm in parms.ChildNodes) {
|
foreach (XmlNode parm in parms.ChildNodes) {
|
||||||
if (parm.Name != "parameter") {
|
if (!(parm is XmlElement) || parm.Name != "parameter") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace GtkSharp.Generation {
|
||||||
sw.WriteLine ();
|
sw.WriteLine ();
|
||||||
|
|
||||||
foreach (XmlNode node in Elem.ChildNodes) {
|
foreach (XmlNode node in Elem.ChildNodes) {
|
||||||
|
if (!(node is XmlElement)) continue;
|
||||||
XmlElement member = (XmlElement) node;
|
XmlElement member = (XmlElement) node;
|
||||||
|
|
||||||
switch (node.Name) {
|
switch (node.Name) {
|
||||||
|
|
22168
generator/gtkapi.xml
22168
generator/gtkapi.xml
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
$file = "../generator/gtkapi.xml";
|
$file = "gtkapi.xml";
|
||||||
|
|
||||||
unlink ($file);
|
unlink ($file);
|
||||||
|
|
||||||
|
|
41
parser/formatXml.c
Normal file
41
parser/formatXml.c
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#include <glib.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <libxml/xmlmemory.h>
|
||||||
|
#include <libxml/parser.h>
|
||||||
|
|
||||||
|
static int
|
||||||
|
formatFile (const gchar *input, const gchar *output)
|
||||||
|
{
|
||||||
|
xmlDocPtr doc;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* build an XML tree from a the file;
|
||||||
|
*/
|
||||||
|
doc = xmlParseFile (input);
|
||||||
|
if (doc == NULL){
|
||||||
|
g_warning ("File %s empty or not well-formed.", input);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (xmlSaveFormatFile (output, doc, TRUE) == -1){
|
||||||
|
g_warning ("Error saving config data to %s", input);
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlFreeDoc (doc);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc != 3){
|
||||||
|
g_print ("Usage: formatXml inputfile outputfile\n\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlKeepBlanksDefault(0);
|
||||||
|
formatFile (argv [1], argv [2]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
10
parser/makefile
Normal file
10
parser/makefile
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
all: generated-stamp
|
||||||
|
|
||||||
|
generated-stamp: formatXml gtkapi.xml
|
||||||
|
./formatXml gtkapi.xml ../generator/gtkapi.xml && touch generated-stamp
|
||||||
|
|
||||||
|
formatXml: formatXml.c
|
||||||
|
cc -o formatXml formatXml.c `pkg-config --cflags --libs libxml-2.0 glib-2.0`
|
||||||
|
|
||||||
|
gtkapi.xml: build.pl
|
||||||
|
./build.pl
|
Loading…
Reference in a new issue