From 4da62952574a726266130eb6340128eb3463a06b Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 1 Oct 2003 21:42:29 +0000 Subject: [PATCH] 2003-10-01 Mike Kestner * README.generator : updates for new parser script * api/Makefile.in : add gtkhtml-api.xml * api/*-api.xml : regenerated * parser/makefile : install new parsing script * parser/gapi-parser : new xml-driven parsing script * sources/makefile : call new parsing script * sources/gtk-sharp-sources.xml : new parser input file * sources/gtk-sharp.sources : killed svn path=/trunk/gtk-sharp/; revision=18491 --- ChangeLog | 11 + README.generator | 71 ++- api/Makefile.in | 1 + api/gdk-api.xml | 4 +- api/gnome-api.xml | 2 +- api/gtk-api.xml | 960 --------------------------------- api/gtkhtml-api.xml | 969 ++++++++++++++++++++++++++++++++++ parser/Makefile.in | 1 + parser/gapi-parser | 65 +++ sources/gtk-sharp-sources.xml | 112 ++++ sources/gtk-sharp.sources | 18 - sources/makefile | 2 +- 12 files changed, 1213 insertions(+), 1003 deletions(-) create mode 100644 api/gtkhtml-api.xml create mode 100755 parser/gapi-parser create mode 100644 sources/gtk-sharp-sources.xml delete mode 100644 sources/gtk-sharp.sources diff --git a/ChangeLog b/ChangeLog index 4cf7356ba..cd1d76a18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2003-10-01 Mike Kestner + + * README.generator : updates for new parser script + * api/Makefile.in : add gtkhtml-api.xml + * api/*-api.xml : regenerated + * parser/makefile : install new parsing script + * parser/gapi-parser : new xml-driven parsing script + * sources/makefile : call new parsing script + * sources/gtk-sharp-sources.xml : new parser input file + * sources/gtk-sharp.sources : killed + 2003-09-29 Martin Willemoes Hansen * sources/Gnome.metadata: Use const-gchar* instead of const-guchar*, diff --git a/README.generator b/README.generator index eb6f1b2bd..d91496620 100644 --- a/README.generator +++ b/README.generator @@ -1,33 +1,62 @@ How to use the Gtk# code generator: Install dependencies: + * You need to install the XML::LibXML perl bindings and Gtk#. +Parse the library: + + * Create an xml file defining the libraries to be parsed. The + format of the XML is: + + + + + + atk-1.2.4/atk + + + + + + The api element filename attribute specifies the parser output file location. + The name attribute on the library output points to the native library name. If + you are creating a cross-platform project, you will want to specify the win32 dll + name here and use mono's config mechanism to map the name on other platforms. + The dir element points to a src directory to be parsed. Currently all .c and .h + files in the directory are parsed. + + All the elements inside the root can have multiples. The source/gtk-sharp-sources.xml + file has examples of producing multiple api files with a single parser input file, as + well as including muliple libraries in a single output file. + + * Create metadata rules files named .metadata in the directory where you invoke + the parser. Metadata rules allow you to massage the parsed api if necessary. Examples + of rule formats can be found in the sources directory. + + * Execute the parser on your xml input file: + gapi-parser + + * Distribute the xml file(s) produced by the parser with your project so that your + users don't need to have any native library source, or perl libraries installed in + order to build your project. + Within your project directory, do the following: + * Setup a toplevel subdirectory for each namespace/assembly you are wrapping. Instruct the makefile for this directory to compile, at minimum, generated/*. - * Write a .sources file listing the source directories for the - libraries you will be wrapping, one line per directory. The - format is: "directory namespace library". - * Run gapi.pl SOURCEFILE APIDIR where SOURCEFILE is the sources file - you just wrote, and APIDIR is the directory to place the API XML - descriptions in. - * Run gapi_codegen.exe on the API files you created. If you depend - on any other wrapped libraries (such as gtk-sharp.dll), you need to - include their API listings via the --include directive. - The code generator, if successful, will have populated the assembly - directories with generated/ directories. -It is generally helpful to automate this process with makefiles. Gtk# uses -the following organization: - sources/: Source directories, .sources listing, .metadata files. - Is not listed in SUBDIRS, developers run make manually here when - they want to update the API files. - api/: API files written here. They are committed to CVS and included - in releases for the convenience of the lib user. - This _is_ listed in SUBDIRS, the generator directives are in - this makefile. (And hence api needs to be listed before - the assembly directories) + * Run gapi_codegen.exe on the API file(s) you created with the parser. If you depend + on any other wrapped libraries (such as gtk-sharp.dll), you need to include their API + listings via the --include directive. The code generator, if successful, will have + populated the assembly directories with generated/ directories. It is generally helpful + to automate this process with makefiles. Gtk# uses the following organization: + - sources/: Source directories, .sources listing, .metadata files. + developers run make manually here when they want to update the API files. + - api/: API files + The files are committed to CVS and included in releases for the convenience + of the lib user. This dir is included in the build before the namespace dirs + and the generator is invoked from this dir. diff --git a/api/Makefile.in b/api/Makefile.in index 9853a686c..88a422d04 100644 --- a/api/Makefile.in +++ b/api/Makefile.in @@ -4,6 +4,7 @@ APIS = \ gdk-api.xml \ gdk-symbols.xml \ gtk-api.xml \ + gtkhtml-api.xml \ gtk-symbols.xml \ glade-api.xml \ art-api.xml \ diff --git a/api/gdk-api.xml b/api/gdk-api.xml index 2545ce641..4e02b7042 100644 --- a/api/gdk-api.xml +++ b/api/gdk-api.xml @@ -1843,8 +1843,8 @@ - - + + diff --git a/api/gnome-api.xml b/api/gnome-api.xml index c5984e83b..b76c3ce8d 100644 --- a/api/gnome-api.xml +++ b/api/gnome-api.xml @@ -6578,7 +6578,7 @@ - + diff --git a/api/gtk-api.xml b/api/gtk-api.xml index edd9dd007..a0ce3f954 100644 --- a/api/gtk-api.xml +++ b/api/gtk-api.xml @@ -13293,964 +13293,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/api/gtkhtml-api.xml b/api/gtkhtml-api.xml new file mode 100644 index 000000000..d393da304 --- /dev/null +++ b/api/gtkhtml-api.xml @@ -0,0 +1,969 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/parser/Makefile.in b/parser/Makefile.in index c6e2a18c4..fc85b1a8f 100644 --- a/parser/Makefile.in +++ b/parser/Makefile.in @@ -6,6 +6,7 @@ BASE_DEPENDENCIES_CFLAGS = @BASE_DEPENDENCIES_CFLAGS@ SCRIPTS = \ gapi.pl \ gapi_pp.pl \ + gapi-parser \ gapi2xml.pl MODULES=GAPI/Metadata.pm diff --git a/parser/gapi-parser b/parser/gapi-parser new file mode 100755 index 000000000..93c12f091 --- /dev/null +++ b/parser/gapi-parser @@ -0,0 +1,65 @@ +#!/usr/bin/perl -w + +use XML::LibXML; + +die "Usage: gapi-parser \n" if (!$ARGV[0]); + +my $parser = new XML::LibXML; +my $doc = $parser->parse_file($ARGV[0]); +die "Unable to parse input file $ARGV[0].\n" if (!$doc); +my $root = $doc->documentElement; +die "Improperly formatted input file $ARGV[0].\n" if (!$root || $root->nodeName ne "gapi-parser-input"); + +for ($apinode = $root->firstChild; $apinode; $apinode = $apinode->nextSibling ()) { + next if ($apinode->nodeName ne "api"); + @attrs = $apinode->attributes; + my ($outfile); + foreach $attr (@attrs) { + if ($attr->name eq "filename") { + $outfile = $attr->value; + } else { + die "Unexpected attribute $attr->name\n"; + } + } + + unlink "$outfile.pre"; + + for ($libnode = $apinode->firstChild; $libnode; $libnode = $libnode->nextSibling ()) { + next if ($libnode->nodeName ne "library"); + @attrs = $libnode->attributes; + my ($lib); + foreach $attr (@attrs) { + if ($attr->name eq "name") { + $lib = $attr->value; + } else { + die "Unexpected attribute $attr->name\n"; + } + } + + for ($nsnode = $libnode->firstChild; $nsnode; $nsnode = $nsnode->nextSibling ()) { + next if ($nsnode->nodeName ne "namespace"); + @attrs = $nsnode->attributes; + my ($ns); + foreach $attr (@attrs) { + if ($attr->name eq "name") { + $ns = $attr->value; + } else { + die "Unexpected attribute $attr->name\n"; + } + } + + for ($srcnode = $nsnode->firstChild; $srcnode; $srcnode = $srcnode->nextSibling ()) { + next if ($srcnode->nodeName ne "dir"); + my ($dir); + $dir = $srcnode->firstChild->nodeValue; + print "$dir\n"; + `ls $dir`; + system ("gapi_pp.pl $dir | gapi2xml.pl $ns $outfile.pre $lib"); + } + } + } + + system ("gapi_format_xml $outfile.pre $outfile"); + unlink "$outfile.pre"; +} + diff --git a/sources/gtk-sharp-sources.xml b/sources/gtk-sharp-sources.xml new file mode 100644 index 000000000..4a5a7e44a --- /dev/null +++ b/sources/gtk-sharp-sources.xml @@ -0,0 +1,112 @@ + + + + + atk-1.2.4/atk + + + + + + + pango-1.2.3/pango + + + + + + + gtk+-2.2.2/gdk + + + + + gtk+-2.2.2/gdk-pixbuf + + + + + + + gtk+-2.2.2/gtk + + + + + + + libgnome-2.2.3/libgnome + + + + + libgnomecanvas-2.2.1/libgnomecanvas + + + + + libgnomeui-2.2.2/libgnomeui + + + + + libgnomeprint-2.2.1.3/libgnomeprint + + + + + libgnomeprintui-2.2.1.3/libgnomeprintui + libgnomeprintui-2.2.1.3/libgnomeprintui/gpaui + + + + + + + gtkhtml-3.0.8/src + + + + + + + libglade-2.0.0/glade + + + + + + + libart_lgpl-2.3.10 + + + + + + + libgda-1.0.0/libgda + + + + + + + libgnomedb-1.0.0/libgnomedb + + + + + + + gstreamer-0.4.2/gst + + + + + + + librsvg-2.2.5 + + + + diff --git a/sources/gtk-sharp.sources b/sources/gtk-sharp.sources deleted file mode 100644 index a2d5dfa14..000000000 --- a/sources/gtk-sharp.sources +++ /dev/null @@ -1,18 +0,0 @@ -atk-1.2.4/atk Atk libatk-1.0-0.dll -pango-1.2.3/pango Pango libpango-1.0-0.dll -gtk+-2.2.2/gdk Gdk libgdk-win32-2.0-0.dll -gtk+-2.2.2/gdk-pixbuf Gdk libgdk_pixbuf-2.0-0.dll -gtk+-2.2.2/gtk Gtk libgtk-win32-2.0-0.dll -libgnome-2.2.3/libgnome Gnome gnome-2 -libgnomecanvas-2.2.1/libgnomecanvas Gnome gnomecanvas-2 -libgnomeui-2.2.2/libgnomeui Gnome gnomeui-2 -libgnomeprint-2.2.1.3/libgnomeprint Gnome gnomeprint-2-2 -libgnomeprintui-2.2.1.3/libgnomeprintui Gnome gnomeprintui-2-2 -libgnomeprintui-2.2.1.3/libgnomeprintui/gpaui Gnome gnomeprintui-2-2 -gtkhtml-3.0.8/src Gtk gtkhtml-3.0 -libglade-2.0.0/glade Glade libglade-2.0-0.dll -libart_lgpl-2.3.10 Art art_lgpl -libgda-1.0.0/libgda Gda gda-2 -libgnomedb-1.0.0/libgnomedb GnomeDb gnomedb-2 -gstreamer-0.4.2/gst Gst gstreamer -librsvg-2.2.5 Rsvg rsvg-2 diff --git a/sources/makefile b/sources/makefile index 33caed9ad..be73b97ae 100644 --- a/sources/makefile +++ b/sources/makefile @@ -23,7 +23,7 @@ GTKHTML_SOURCES = \ gtkhtml-3.0.8/src/gtkhtml-stream.h all: - PERLLIB=../parser PATH=../parser:$$PATH ../parser/gapi.pl gtk-sharp.sources ../api + PERLLIB=../parser PATH=../parser:$$PATH ../parser/gapi-parser gtk-sharp-sources.xml get-gtkhtml-code: wget http://ftp.gnome.org/pub/GNOME/sources/gtkhtml/3.0/gtkhtml-3.0.8.tar.gz --output-document=- | tar -xz $(GTKHTML_SOURCES)