mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-16 19:44:45 +02:00
2005-04-15 Mike Kestner <mkestner@novell.com>
* parser/gapi-parser.cs : C# rewrite of the old perl driver script. * parser/gapi_parser.pl : kill. * parser/gapi2-parser.in : invoke via $(RUNTIME). * parser/Makefile.am : build rework for C# parser driver. * sources/Makefile.am : use $(RUNTIME) to invoke new parser assm. svn path=/trunk/gtk-sharp/; revision=43077
This commit is contained in:
parent
f06290f6b6
commit
68ab921940
@ -1,3 +1,11 @@
|
|||||||
|
2005-04-15 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
|
* parser/gapi-parser.cs : C# rewrite of the old perl driver script.
|
||||||
|
* parser/gapi_parser.pl : kill.
|
||||||
|
* parser/gapi2-parser.in : invoke via $(RUNTIME).
|
||||||
|
* parser/Makefile.am : build rework for C# parser driver.
|
||||||
|
* sources/Makefile.am : use $(RUNTIME) to invoke new parser assm.
|
||||||
|
|
||||||
2005-04-12 Mike Kestner <mkestner@novell.com>
|
2005-04-12 Mike Kestner <mkestner@novell.com>
|
||||||
|
|
||||||
* configure.in : bump version to 1.9.3 and tag.
|
* configure.in : bump version to 1.9.3 and tag.
|
||||||
|
@ -1,28 +1,29 @@
|
|||||||
assemblydir = $(libdir)/gtk-sharp-2.0
|
assemblydir = $(libdir)/gtk-sharp-2.0
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
assembly_DATA = gapi-fixup.exe
|
assembly_DATA = gapi-fixup.exe gapi-parser.exe
|
||||||
pkgconfig_DATA = gapi-2.0.pc
|
pkgconfig_DATA = gapi-2.0.pc
|
||||||
bin_SCRIPTS = gapi2-fixup gapi2-parser
|
bin_SCRIPTS = gapi2-fixup gapi2-parser
|
||||||
assembly_SCRIPTS = gapi_parser.pl gapi_pp.pl gapi2xml.pl
|
assembly_SCRIPTS = gapi_pp.pl gapi2xml.pl
|
||||||
CLEANFILES = gapi-fixup.exe
|
CLEANFILES = gapi-fixup.exe
|
||||||
DISTCLEANFILES = gapi2-fixup gapi2-parser gapi-2.0.pc
|
DISTCLEANFILES = gapi2-fixup gapi2-parser gapi-2.0.pc
|
||||||
|
|
||||||
sources = \
|
sources = \
|
||||||
gapi-fixup.cs
|
gapi-fixup.cs \
|
||||||
|
gapi-parser.cs
|
||||||
build_sources = $(addprefix $(srcdir)/, $(sources))
|
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
makefile.win32 \
|
makefile.win32 \
|
||||||
$(sources) \
|
$(sources) \
|
||||||
gapi2-parser.in \
|
gapi2-parser.in \
|
||||||
gapi_parser.pl \
|
|
||||||
gapi_pp.pl \
|
gapi_pp.pl \
|
||||||
gapi2xml.pl \
|
gapi2xml.pl \
|
||||||
gapi-2.0.pc.in
|
gapi-2.0.pc.in
|
||||||
|
|
||||||
gapi-fixup.exe: $(build_sources)
|
gapi-fixup.exe: $(srcdir)/gapi-fixup.cs
|
||||||
$(CSC) /out:gapi-fixup.exe $(build_sources)
|
$(CSC) /out:gapi-fixup.exe $(srcdir)/gapi-fixup.cs
|
||||||
|
|
||||||
|
gapi-parser.exe: $(srcdir)/gapi-parser.cs
|
||||||
|
$(CSC) /out:gapi-parser.exe $(srcdir)/gapi-parser.cs
|
||||||
|
|
||||||
INCLUDES = $(GLIB_CFLAGS) $(XML_CFLAGS)
|
INCLUDES = $(GLIB_CFLAGS) $(XML_CFLAGS)
|
||||||
|
|
||||||
|
143
parser/gapi-parser.cs
Normal file
143
parser/gapi-parser.cs
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
// gapi-parser.cs - parsing driver application.
|
||||||
|
//
|
||||||
|
// Author: Mike Kestner <mkestner@novell.com>
|
||||||
|
//
|
||||||
|
// Copyright (c) 2005 Novell, Inc.
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of version 2 of the GNU General Public
|
||||||
|
// License as published by the Free Software Foundation.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public
|
||||||
|
// License along with this program; if not, write to the
|
||||||
|
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
// Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
namespace GtkSharp.Parsing {
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
public class Parser {
|
||||||
|
|
||||||
|
[DllImport ("libc")]
|
||||||
|
static extern int system (string command);
|
||||||
|
|
||||||
|
public static int Main (string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 1) {
|
||||||
|
Console.WriteLine ("Usage: gapi2-parser <filename>");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlDocument src_doc = new XmlDocument ();
|
||||||
|
|
||||||
|
try {
|
||||||
|
using (Stream stream = File.OpenRead (args [0]))
|
||||||
|
src_doc.Load (stream);
|
||||||
|
} catch (XmlException e) {
|
||||||
|
Console.WriteLine ("Couldn't open source file.");
|
||||||
|
Console.WriteLine (e);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
XmlNode root = src_doc.DocumentElement;
|
||||||
|
if (root.Name != "gapi-parser-input") {
|
||||||
|
Console.WriteLine ("Improperly formatted input file: " + args [0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (XmlNode apinode in root.ChildNodes) {
|
||||||
|
if (apinode.Name != "api")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string outfile = (apinode as XmlElement).GetAttribute ("filename");
|
||||||
|
string prefile = outfile + ".pre";
|
||||||
|
|
||||||
|
if (File.Exists (prefile))
|
||||||
|
File.Delete (prefile);
|
||||||
|
|
||||||
|
foreach (XmlNode libnode in apinode.ChildNodes) {
|
||||||
|
if (libnode.Name != "library")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string lib = (libnode as XmlElement).GetAttribute ("name");
|
||||||
|
|
||||||
|
foreach (XmlNode nsnode in libnode.ChildNodes) {
|
||||||
|
if (nsnode.Name != "namespace")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
string ns = (nsnode as XmlElement).GetAttribute ("name");
|
||||||
|
|
||||||
|
ArrayList files = new ArrayList ();
|
||||||
|
Hashtable excludes = new Hashtable ();
|
||||||
|
|
||||||
|
foreach (XmlNode srcnode in nsnode.ChildNodes) {
|
||||||
|
if (!(srcnode is XmlElement))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
XmlElement elem = srcnode as XmlElement;
|
||||||
|
|
||||||
|
switch (srcnode.Name) {
|
||||||
|
case "dir":
|
||||||
|
string dir = elem.InnerXml;
|
||||||
|
Console.Write ("<dir {0}> ", dir);
|
||||||
|
DirectoryInfo di = new DirectoryInfo (dir);
|
||||||
|
foreach (FileInfo file in di.GetFiles ("*.c"))
|
||||||
|
files.Add (dir + Path.DirectorySeparatorChar + file.Name);
|
||||||
|
foreach (FileInfo file in di.GetFiles ("*.h"))
|
||||||
|
files.Add (dir + Path.DirectorySeparatorChar + file.Name);
|
||||||
|
break;
|
||||||
|
case "file":
|
||||||
|
string incfile = elem.InnerXml;
|
||||||
|
Console.Write ("<file {0}> ", incfile);
|
||||||
|
files.Add (incfile);
|
||||||
|
break;
|
||||||
|
case "exclude":
|
||||||
|
string excfile = elem.InnerXml;
|
||||||
|
Console.Write ("<exclude {0}> ", excfile);
|
||||||
|
excludes [excfile] = 1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine ("Invalid source: " + srcnode.Name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Console.WriteLine ();
|
||||||
|
|
||||||
|
if (files.Count == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ArrayList realfiles = new ArrayList ();
|
||||||
|
foreach (string file in files) {
|
||||||
|
string trimfile = file.TrimEnd ();
|
||||||
|
if (excludes.Contains (trimfile))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
realfiles.Add (trimfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] filenames = (string[]) realfiles.ToArray (typeof (string));
|
||||||
|
string pp_args = String.Join (" ", filenames);
|
||||||
|
system ("gapi_pp.pl " + pp_args + " | gapi2xml.pl " + ns + " " + prefile + " " + lib);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
system ("gapi_format_xml " + prefile + " " + outfile);
|
||||||
|
File.Delete (prefile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
export PATH=@prefix@/lib/gtk-sharp-2.0:$PATH
|
export PATH=@prefix@/lib/gtk-sharp-2.0:$PATH
|
||||||
@prefix@/lib/gtk-sharp-2.0/gapi_parser.pl "$@"
|
@RUNTIME@ @prefix@/lib/gtk-sharp-2.0/gapi-parser.exe "$@"
|
||||||
|
@ -1,112 +0,0 @@
|
|||||||
#!/usr/bin/perl -w
|
|
||||||
# gapi-parser - parser frontend for XML-based sources file format.
|
|
||||||
#
|
|
||||||
# Author: Mike Kestner <mkestner@speakeasy.net>
|
|
||||||
#
|
|
||||||
# Copyright (c) 2003 Mike Kestner
|
|
||||||
# Copyright (c) 2003 Novell, Inc.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of version 2 of the GNU General Public
|
|
||||||
# License as published by the Free Software Foundation.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public
|
|
||||||
# License along with this program; if not, write to the
|
|
||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
||||||
# Boston, MA 02111-1307, USA.
|
|
||||||
|
|
||||||
use XML::LibXML;
|
|
||||||
|
|
||||||
die "Usage: gapi-parser <xml_sources_file>\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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
my @files = ();
|
|
||||||
my @realfiles = ();
|
|
||||||
my %excludes = ();
|
|
||||||
for ($srcnode = $nsnode->firstChild; $srcnode; $srcnode = $srcnode->nextSibling ()) {
|
|
||||||
next if ($srcnode->nodeName ne "dir" && $srcnode->nodeName ne "file" && $srcnode->nodeName ne "exclude");
|
|
||||||
|
|
||||||
if ($srcnode->nodeName eq "dir") {
|
|
||||||
my ($dir);
|
|
||||||
$dir = $srcnode->firstChild->nodeValue;
|
|
||||||
print "<dir $dir> ";
|
|
||||||
@files = (@files, `ls $dir/*.c`);
|
|
||||||
@files = (@files, `ls $dir/*.h`);
|
|
||||||
} elsif ($srcnode->nodeName eq "file") {
|
|
||||||
$incfile = $srcnode->firstChild->nodeValue;
|
|
||||||
print "<file $incfile> ";
|
|
||||||
@files = (@files, $srcnode->firstChild->nodeValue);
|
|
||||||
} elsif ($srcnode->nodeName eq "exclude") {
|
|
||||||
$excfile = $srcnode->firstChild->nodeValue;
|
|
||||||
print "<exclude $excfile> ";
|
|
||||||
$excludes{$srcnode->firstChild->nodeValue} = 1;
|
|
||||||
} else {
|
|
||||||
die "Unexpected source $srcnode->nodeName \n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
print "\n";
|
|
||||||
if ($#files >= 0) {
|
|
||||||
foreach $file (@files) {
|
|
||||||
chomp ($file);
|
|
||||||
@realfiles = (@realfiles, $file) if (!exists($excludes{$file}));
|
|
||||||
}
|
|
||||||
|
|
||||||
$pp_args = join (" ", @realfiles);
|
|
||||||
system ("gapi_pp.pl $pp_args | gapi2xml.pl $ns $outfile.pre $lib");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
system ("gapi_format_xml $outfile.pre $outfile");
|
|
||||||
unlink "$outfile.pre";
|
|
||||||
}
|
|
||||||
|
|
@ -37,7 +37,7 @@ GTKHTML_SOURCEFILES = \
|
|||||||
gtkhtml-3.0.10/src/gtkhtml-stream.h
|
gtkhtml-3.0.10/src/gtkhtml-stream.h
|
||||||
|
|
||||||
api:
|
api:
|
||||||
PATH=../parser:$$PATH ../parser/gapi_parser.pl gtk-sharp-sources.xml
|
PATH=../parser:$$PATH $(RUNTIME) ../parser/gapi-parser.exe gtk-sharp-sources.xml
|
||||||
|
|
||||||
get-gtkhtml-code:
|
get-gtkhtml-code:
|
||||||
wget http://ftp.gnome.org/pub/GNOME/sources/gtkhtml/3.0/gtkhtml-3.0.10.tar.gz --output-document=- | tar -xz $(GTKHTML_SOURCEFILES)
|
wget http://ftp.gnome.org/pub/GNOME/sources/gtkhtml/3.0/gtkhtml-3.0.10.tar.gz --output-document=- | tar -xz $(GTKHTML_SOURCEFILES)
|
||||||
|
Loading…
Reference in New Issue
Block a user