2001-10-05 Mike Kestner <mkestner@speakeasy.net>
* defs-parse.pl : A little automation for the binding. The enums and flags can be painlessly generated from defs files. * gtk/makefile : use defs-parse.pl to produce generated.cs. * gtk/.cvsignore : hush generated.cs * gtk/gtk.defs : unceremoniously ripped from gtk+ HEAD. * gtk/Window.cs : Killed the WindowType enum which is now generated. svn path=/trunk/gtk-sharp/; revision=1095
This commit is contained in:
parent
26142a99ca
commit
d659e12e05
6 changed files with 2222 additions and 7 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2001-10-05 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
|
* defs-parse.pl : A little automation for the binding. The enums and
|
||||||
|
flags can be painlessly generated from defs files.
|
||||||
|
* gtk/makefile : use defs-parse.pl to produce generated.cs.
|
||||||
|
* gtk/.cvsignore : hush generated.cs
|
||||||
|
* gtk/gtk.defs : unceremoniously ripped from gtk+ HEAD.
|
||||||
|
* gtk/Window.cs : Killed the WindowType enum which is now generated.
|
||||||
|
|
||||||
2001-10-04 Mike Kestner <mkestner@speakeasy.net>
|
2001-10-04 Mike Kestner <mkestner@speakeasy.net>
|
||||||
|
|
||||||
* glib/SimpleSignal.cs : Reworked to parallel SimpleEvent.
|
* glib/SimpleSignal.cs : Reworked to parallel SimpleEvent.
|
||||||
|
|
54
defs-parse.pl
Executable file
54
defs-parse.pl
Executable file
|
@ -0,0 +1,54 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
while ($line = <STDIN>) {
|
||||||
|
|
||||||
|
if ($line =~ /^\(define-(enum|flags) (Gtk|G|Gdk)(\w+)/) {
|
||||||
|
if (!defined ($namespace)) {
|
||||||
|
print "// Generated file: Do not modify\n\n";
|
||||||
|
print "namespace $2 {\n\n\tusing System;\n\n";
|
||||||
|
} elsif ($2 ne $namespace) {
|
||||||
|
print "}\n\nnamespace $2 {\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = $1;
|
||||||
|
$namespace = $2;
|
||||||
|
$typename = $3;
|
||||||
|
|
||||||
|
foreach $paren ($line =~ /[\(\)]/g) {
|
||||||
|
($paren eq "(") ? $nest++ : $nest--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($type eq "flags") {
|
||||||
|
print "\t[Flags]\n";
|
||||||
|
}
|
||||||
|
print "\tpublic enum $typename {\n";
|
||||||
|
|
||||||
|
$val = 1;
|
||||||
|
while ($nest > 0) {
|
||||||
|
$line = <STDIN>;
|
||||||
|
if ($line =~ /\((.*) .*\)/) {
|
||||||
|
$name = $1;
|
||||||
|
$name =~ s/^([a-z])/\u\1/;
|
||||||
|
$name =~ s/\-([a-z])/\u\1/g;
|
||||||
|
$name =~ s/\-(\d)/\1/g;
|
||||||
|
if ($type eq "enum") {
|
||||||
|
print "\t\t$name,\n";
|
||||||
|
} else {
|
||||||
|
print "\t\t$name = $val,\n";
|
||||||
|
$val *= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $paren ($line =~ /[\(\)]/g) {
|
||||||
|
($paren eq "(") ? $nest++ : $nest--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\t}\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (defined ($namespace)) {
|
||||||
|
print "}\n";
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
*.dll
|
*.dll
|
||||||
*.exe
|
*.exe
|
||||||
|
generated.cs
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,6 @@ namespace Gtk {
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
public enum WindowType {
|
|
||||||
TopLevel,
|
|
||||||
Popup,
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Window : Widget {
|
public class Window : Widget {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -44,7 +39,7 @@ namespace Gtk {
|
||||||
|
|
||||||
public Window ()
|
public Window ()
|
||||||
{
|
{
|
||||||
RawObject = gtk_window_new (WindowType.TopLevel);
|
RawObject = gtk_window_new (WindowType.Toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
2153
gtk/gtk.defs
Normal file
2153
gtk/gtk.defs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -2,8 +2,11 @@ all:
|
||||||
@echo "You must use 'make windows' or 'make unix'."
|
@echo "You must use 'make windows' or 'make unix'."
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
||||||
windows:
|
windows: defs
|
||||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../gdk/gdk-sharp.dll /out:gtk-sharp.dll /recurse:*.cs
|
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../gdk/gdk-sharp.dll /out:gtk-sharp.dll /recurse:*.cs
|
||||||
|
|
||||||
unix:
|
unix:
|
||||||
@echo "'make unix' is broken for now."
|
@echo "'make unix' is broken for now."
|
||||||
|
|
||||||
|
defs:
|
||||||
|
../defs-parse.pl < gtk.defs > generated.cs
|
||||||
|
|
Loading…
Reference in a new issue