mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2025-01-09 00:45:41 +00:00
This is an enormous commit of stuff that I've been working on for several
weeks. I'll be posting an update to gtk-sharp-list in a bit to describe my latest psychosis. svn path=/trunk/gtk-sharp/; revision=1797
This commit is contained in:
parent
e1c553c646
commit
30e653825c
37
ChangeLog
37
ChangeLog
|
@ -1,8 +1,45 @@
|
|||
2002-01-04 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* makefile : switch to the new generator.
|
||||
* generator/CodeGenerator.cs : New main program class.
|
||||
* generator/IGeneratable.cs : Interface for generation methods/props.
|
||||
* generator/EnumGen.cs : Subclass of IGeneratable for enums.
|
||||
* generator/Parser.cs : The XML parser.
|
||||
* parser/gapi_pp.pl : A source preprocessor for api extraction.
|
||||
* parser/gapi2xml.pl : Produces Xml document for GObject based APIs.
|
||||
|
||||
2001-12-31 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* codegen/defs-parse.pl : Fix EOL handling for DOS \r\n patterns as
|
||||
reported by David Dawkins.
|
||||
|
||||
2001-12-17 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* makefile : Add the pango subdir.
|
||||
* codegen/defs-parse.pl : Add a buttload of type entries to %maptypes
|
||||
and %marshaltypes. Ignore props, sigs, and methods for non GObject
|
||||
types. Turn on all classes. Major beefup of struct generation. Start
|
||||
to use the new sighandlers. Rip out const- types. Handle Unicode
|
||||
string marshalling.
|
||||
* codegen/gdk-structs.defs : Regenerated.
|
||||
* codegen/get-structs-from-source.pl : Handle typedef x y; Suppress
|
||||
structs with "Private" in the typename. Handle multiple levels of
|
||||
typedeffing. Handle function pointers. Suppress comments sanely.
|
||||
* codegen/gtk-props.defs : Fill out the rest of the classes.
|
||||
* codegen/gtk-signals.defs : Fill out the rest of the classes.
|
||||
* codegen/gtk-structs.defs : First pass. Hacked obscenely.
|
||||
* codegen/hardcoded.defs : Kill. No hardcoding needed anymore.
|
||||
* codegen/makefile : Use the new defs files.
|
||||
* codegen/pango.defs : Ripped from pygtk.
|
||||
* codegen/pango-structs.defs : New struct defs gen'd with my tool.
|
||||
* codegen/pango-types.defs : Ripped from pygtk.
|
||||
* gdk/makefile : Add the pango-sharp.dll ref.
|
||||
* gdk/SimpleEvent.cs : Killed.
|
||||
* glib/SimpleSignal.cs : Killed.
|
||||
* gtk/makefile : Add the pango-sharp.dll ref.
|
||||
* gtk/Widget.cs : Killed.
|
||||
* pango/makefile : New build dir.
|
||||
|
||||
2001-12-11 Mike Kestner <mkestner@speakeasy.net>
|
||||
|
||||
* codegen/get-structs-from-source.pl : New define-struct extractor.
|
||||
|
|
|
@ -9,21 +9,41 @@
|
|||
%maptypes = (
|
||||
'none', "void", 'gboolean', "bool", 'gint', "int", 'guint', "uint",
|
||||
'guint32', "uint", 'const-gchar', "String", 'GObject', "GLib.Object",
|
||||
'gchar', "String", 'gfloat', "float", 'gdouble', "double");
|
||||
'gchar', "String", 'gfloat', "float", 'gdouble', "double",
|
||||
'GList', "IntPtr", 'GSList', "IntPtr", 'gpointer', "IntPtr",
|
||||
'long', "long", 'gint8', "byte", 'guint8', "byte", 'gint16', "short",
|
||||
'guint16', "ushort", 'char', "String", 'GPtrArray', "IntPtr[]",
|
||||
'const-char', "String", 'gushort', "ushort", 'gshort', "short",
|
||||
'guint1', "bool", 'guchar', "byte", 'GValue', "GLib.Value",
|
||||
'GtkType', "int", 'glong', "long", 'gulong', "ulong", 'GQuark', "int",
|
||||
'va_list', "IntPtr", 'GParamSpec', "IntPtr", 'int', "int",
|
||||
'double', "double", 'gunichar', "String", 'uint1', "bool",
|
||||
'GtkSignalFunc', "IntPtr");
|
||||
|
||||
%marshaltypes = (
|
||||
'none', "void", 'gboolean', "bool", 'gint', "int", 'guint', "uint",
|
||||
'guint32', "uint", 'const-gchar', "IntPtr", 'GObject', "IntPtr",
|
||||
'gchar', "IntPtr", 'gfloat', "float", 'gdouble', "double");
|
||||
'gchar', "IntPtr", 'gfloat', "float", 'gdouble', "double",
|
||||
'GList', "IntPtr", 'GSList', "IntPtr", 'gpointer', "IntPtr",
|
||||
'long', "long", 'gint8', "byte", 'guint8', "byte", 'gint16', "short",
|
||||
'guint16', "ushort", 'char', "IntPtr", 'GPtrArray', "IntPtr[]",
|
||||
'const-char', "IntPtr", 'gushort', "ushort", 'gshort', "short",
|
||||
'guint1', "bool", 'guchar', "byte", 'GValue', "GLib.Value",
|
||||
'GtkType', "int", 'glong', "long", 'gulong', "ulong", 'GQuark', "int",
|
||||
'va_list', "IntPtr", 'GParamSpec', "IntPtr", 'int', "int",
|
||||
'double', "double", 'gunichar', "Unicode", 'uint1', "bool",
|
||||
'GtkSignalFunc', "IntPtr");
|
||||
|
||||
|
||||
%usings = (
|
||||
'GLib', "System,System.Collections,System.Runtime.InteropServices,GLib",
|
||||
'Gdk', "System,System.Collections,System.Runtime.InteropServices,GLib,Gdk",
|
||||
'Gtk', "System,System.Collections,System.Runtime.InteropServices,GLib,Gdk,Gtk",
|
||||
'GtkSharp', "System,System.Collections,System.Runtime.InteropServices,GLib,Gdk,Gtk");
|
||||
'Pango', "System,System.Collections,System.Runtime.InteropServices,GLib,Pango",
|
||||
'Gdk', "System,System.Collections,System.Runtime.InteropServices,GLib,Pango,Gdk",
|
||||
'Gtk', "System,System.Collections,System.Runtime.InteropServices,GLib,Pango,Gdk,Gtk,GtkSharp",
|
||||
'GtkSharp', "System,System.Collections,System.Runtime.InteropServices,GLib,Pango,Gdk,Gtk");
|
||||
|
||||
`mkdir -p ../glib/generated`;
|
||||
`mkdir -p ../pango/generated`;
|
||||
`mkdir -p ../gdk/generated`;
|
||||
`mkdir -p ../gtk/generated`;
|
||||
|
||||
|
@ -50,10 +70,13 @@ while ($def = get_def()) {
|
|||
} elsif ($def =~ /^\(define-(prop|signal|method)/) {
|
||||
$def =~ /of-object "(\w+)"/;
|
||||
$cname=$1;
|
||||
$def =~ s/\r?\n\s*//g;
|
||||
$objects{$cname} .= "\n$def";
|
||||
if (exists($objects{$cname})) {
|
||||
$def =~ s/\r?\n\s*//g;
|
||||
$objects{$cname} .= "\n$def";
|
||||
}
|
||||
} elsif ($def =~ /^\(define-function/) {
|
||||
if ($def =~ /is-constructor-of (\w+)\)/) {
|
||||
if (($def =~ /is-constructor-of (\w+)\)/) &&
|
||||
(exists($objects{$1}))) {
|
||||
$cname=$1;
|
||||
$def =~ s/\r?\n\s*//g;
|
||||
$objects{$cname} .= "\n$def";
|
||||
|
@ -69,11 +92,12 @@ while ($def = get_def()) {
|
|||
}
|
||||
|
||||
foreach $key (keys (%structs)) {
|
||||
next if ($key =~ /GtkTree|GtkText/);
|
||||
gen_struct ($key, $structs{$key});
|
||||
}
|
||||
|
||||
foreach $key (keys (%objects)) {
|
||||
next if ($key !~ /GdkPixbuf\b|GtkWindow\b|GtkAccelGroup|GtkBin\b/);
|
||||
next if ($key =~ /GtkTree|GtkText/);
|
||||
gen_object (split (/\n/, $objects{$key}));
|
||||
}
|
||||
|
||||
|
@ -179,6 +203,7 @@ sub gen_struct
|
|||
|
||||
$def =~ /define-struct (\w+)/;
|
||||
$name = $1;
|
||||
|
||||
$def =~ /in-module "(\w+)"/;
|
||||
$namespace = $1;
|
||||
|
||||
|
@ -200,11 +225,26 @@ sub gen_struct
|
|||
if ($def =~ /fields'\((.*)\)\)\)/) {
|
||||
foreach $parm (split(/\)'\(/, $1)) {
|
||||
$parm =~ s/\*//g;
|
||||
$parm =~ /"(\S*)" "(\S*)"/;
|
||||
$ptype = $1;
|
||||
$parm =~ /"(.*)" "(.*)"/;
|
||||
$ptype = $maptypes{$1};
|
||||
$pname = $2;
|
||||
if ($pname =~ /(\w+)\s*\(.*\)/) {
|
||||
$pname = $1;
|
||||
$ptype = "IntPtr"; # FIXME: delegate?
|
||||
}
|
||||
$pname =~ s/object/objekt/;
|
||||
print OUTFILE "\t\tpublic $maptypes{$ptype} $pname;\n";
|
||||
$pname =~ s/string/str1ng/;
|
||||
$pname =~ s/\bin\b/in_/;
|
||||
if ($pname =~ /(\w+)\s*\[\d+\]/) {
|
||||
$ptype .= "[]";
|
||||
$pname = $1;
|
||||
} elsif ($pname =~ /(\w+)\s*\:\s*(\d+)/) {
|
||||
$pname = $1;
|
||||
if ($2 == 1) {
|
||||
$ptype = "bool";
|
||||
}
|
||||
}
|
||||
print OUTFILE "\t\tpublic $ptype $pname;\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,15 +257,16 @@ sub gen_object
|
|||
{
|
||||
my ($objdef, @defs) = @_;
|
||||
my ($key, $typename, $parent, $dir, $namespace, $abstract, $def);
|
||||
|
||||
|
||||
$objdef =~ /define-object (\w+)/;
|
||||
$typename = $1;
|
||||
|
||||
$objdef =~ /parent "(\w+)"/;
|
||||
$parent = $maptypes{$1};
|
||||
|
||||
$objdef =~ /in-module "(\w+)"/;
|
||||
$dir = "../" . lc ($namespace = $1) . "/generated";
|
||||
$namespace = $1;
|
||||
$dir = "../" . lc ($namespace) . "/generated";
|
||||
|
||||
open (OUTFILE, ">$dir/$typename.cs") || die "can't open file $dir/$typename.cs";
|
||||
|
||||
%props = ();
|
||||
%signals = ();
|
||||
|
@ -243,8 +284,6 @@ sub gen_object
|
|||
}
|
||||
}
|
||||
|
||||
open (OUTFILE, ">$dir/$typename.cs") || die "can't open file";
|
||||
|
||||
print OUTFILE "// Generated file: Do not modify\n\n";
|
||||
print OUTFILE "namespace $namespace {\n\n";
|
||||
foreach $ns (split (/,/, $usings{$namespace})) {
|
||||
|
@ -319,15 +358,6 @@ sub gen_signal
|
|||
|
||||
$marsh = get_sighandler ($def);
|
||||
|
||||
if (($ret eq "none") && (@plist == 1)) {
|
||||
$marsh = "SimpleSignal";
|
||||
} elsif (($ret eq "gboolean") && (@plist == 2) &&
|
||||
($plist[1] =~ /^\"GdkEvent\*\"/)) {
|
||||
$marsh = "SimpleEvent";
|
||||
} else {
|
||||
return "\t\t// FIXME: Need Marshaller for $name event\n\n";
|
||||
}
|
||||
|
||||
$code = "\t\t/// <summary> $name Event </summary>\n";
|
||||
$code .= "\t\t/// <remarks>\n\t\t///\tFIXME: Get some docs.\n";
|
||||
$code .= "\t\t/// </remarks>\n\n";
|
||||
|
@ -440,13 +470,13 @@ sub gen_method
|
|||
$def =~ /\(c-name "(\w+)"/;
|
||||
$cname = $1;
|
||||
|
||||
$def =~ /return-type "(\w+)/;
|
||||
if (exists ($maptypes{$1})) {
|
||||
$sret = $maptypes{$1};
|
||||
$mret = $marshaltypes{$1};
|
||||
$ret = $1;
|
||||
$def =~ /return-type "(const-)*(\w+)/;
|
||||
if (exists ($maptypes{$2})) {
|
||||
$sret = $maptypes{$2};
|
||||
$mret = $marshaltypes{$2};
|
||||
$ret = $2;
|
||||
} else {
|
||||
$sret = $mret = $ret = $1;
|
||||
$sret = $mret = $ret = $2;
|
||||
}
|
||||
|
||||
($call, $pinv, $sig) = gen_param_strings($def);
|
||||
|
@ -494,9 +524,10 @@ sub gen_param_strings
|
|||
if ($def =~ /parameters'\((.*)\)\)\)/) {
|
||||
foreach $parm (split(/\)'\(/, $1)) {
|
||||
$parm =~ s/\*//g;
|
||||
$parm =~ /"(\S*)" "(\S*)"/;
|
||||
$parm =~ /"(\S*)"\s+"(\S*)"/;
|
||||
$ptype = $1;
|
||||
$pname = $2;
|
||||
$ptype =~ s/const-//;
|
||||
$pname =~ s/object/objekt/;
|
||||
$pname =~ s/event/ev3nt/;
|
||||
if ($sig) {
|
||||
|
@ -504,16 +535,24 @@ sub gen_param_strings
|
|||
$call .= ', ';
|
||||
$pinv .= ', ';
|
||||
}
|
||||
$pinv .= "$marshaltypes{$ptype} $pname";
|
||||
if ($marshaltypes{$ptype} eq "Unicode") {
|
||||
$pinv .= "IntPtr $pname";
|
||||
} else {
|
||||
$pinv .= "$marshaltypes{$ptype} $pname";
|
||||
}
|
||||
$sig .= "$maptypes{$ptype} $pname";
|
||||
if ($maptypes{$ptype} eq $marshaltypes{$ptype}) {
|
||||
$call .= "$pname";
|
||||
} elsif (exists ($objects{$ptype}) ||
|
||||
($ptype =~ /GObject/)) {
|
||||
$call .= "$pname.Handle";
|
||||
} elsif ($ptype =~ /gchar/) {
|
||||
$call .= "Marshal.StringToHGlobalAnsi($pname)";
|
||||
} elsif ($marshaltypes{$ptype} = "int") {
|
||||
} elsif ($maptypes{$ptype} eq "String") {
|
||||
if ($marshaltypes{$ptype} eq "IntPtr") {
|
||||
$call .= "Marshal.StringToHGlobalAnsi($pname)";
|
||||
} else {
|
||||
$call .= "Marshal.StringToHGlobalUni($pname)";
|
||||
}
|
||||
} elsif ($marshaltypes{$ptype} eq "int") {
|
||||
$call .= "(int) $pname";
|
||||
} else {
|
||||
die "Unexpected type encountered $ptype\n";
|
||||
|
@ -529,12 +568,13 @@ sub get_sighandler
|
|||
my ($def) = @_;
|
||||
my ($key, $name, $dir, $ns, $nspace, $tok);
|
||||
|
||||
$def =~ /return-type \"(\w+)\"/;
|
||||
$def =~ /return-type \"(\w+)/;
|
||||
my $ret = $1;
|
||||
|
||||
$def =~ /parameters'\((.*)\)\)\)/;
|
||||
my @parms = split(/\)'\(/, $1);
|
||||
|
||||
$key = "";
|
||||
for ($i = 1; $i < @parms; $i++) {
|
||||
$parms[$i] =~ /^\"(\w+)/;
|
||||
$key .= ":$1";
|
||||
|
@ -572,7 +612,7 @@ sub get_sighandler
|
|||
my $dname = $name . "Delegate";
|
||||
my $cbname = $name . "Callback";
|
||||
|
||||
$sighandlers{$key} = $name;
|
||||
$sighandlers{$key} = $sname;
|
||||
|
||||
open (SIGFILE, ">$dir/$sname.cs") || die "can't open file";
|
||||
|
||||
|
@ -593,15 +633,13 @@ sub get_sighandler
|
|||
print SIGFILE "\t\t\tSignalArgs args = new SignalArgs ();\n";
|
||||
if ($def =~ /parameters'\((.*)\)\)\)/) {
|
||||
my (@parms) = split(/\)'\(/, $1);
|
||||
print "$sname pcnt=$#parms\n";
|
||||
for ($idx=0; $idx < $#parms; $idx++) {
|
||||
$parms[$idx+1] =~ s/\*//g;
|
||||
$parms[$idx+1] =~ /"(\S*)" "(\S*)"/;
|
||||
$parms[$idx+1] =~ /"(\S*)"\s+"(\S*)"/;
|
||||
$ptype = $1;
|
||||
$pname = $2;
|
||||
$pname =~ s/object/objekt/;
|
||||
$pname =~ s/event/ev3nt/;
|
||||
print "$ptype $pname\n";
|
||||
if (exists($objects{$ptype})) {
|
||||
print SIGFILE "\t\t\targs.Args[$idx] = GLib.Object.GetObject($pname);\n";
|
||||
} elsif (exists($maptypes{$ptype})) {
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
(define-struct ArgContext
|
||||
(define-struct Atom
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkArgContext")
|
||||
(c-name "GdkAtom")
|
||||
(fields
|
||||
'("GPtrArray*" "tables")
|
||||
'("gpointer" "cb_data")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct ArgDesc
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkArgDesc")
|
||||
(fields
|
||||
'("const-char*" "name")
|
||||
'("GdkArgType" "type")
|
||||
'("gpointer" "location")
|
||||
'("GdkArgFunc" "callback")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -26,16 +13,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct ClientFilter
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkClientFilter")
|
||||
(fields
|
||||
'("GdkAtom" "type")
|
||||
'("GdkFilterFunc" "function")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Color
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkColor")
|
||||
|
@ -47,15 +24,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct ColorInfo
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkColorInfo")
|
||||
(fields
|
||||
'("GdkColorInfoFlags" "flags")
|
||||
'("guint" "ref_count")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Cursor
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkCursor")
|
||||
|
@ -122,7 +90,7 @@
|
|||
'("gint8" "send_event")
|
||||
'("GdkAtom" "message_type")
|
||||
'("gushort" "data_format")
|
||||
'("char" "data_b[20]")
|
||||
'("gint8" "data_b[20]")
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -187,15 +155,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct EventFilter
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkEventFilter")
|
||||
(fields
|
||||
'("GdkFilterFunc" "function")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct EventFocus
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkEventFocus")
|
||||
|
@ -356,15 +315,6 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct FontPrivate
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkFontPrivate")
|
||||
(fields
|
||||
'("GdkFont" "font")
|
||||
'("guint" "ref_count")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct GCValues
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkGCValues")
|
||||
|
@ -418,6 +368,13 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct NativeWindow
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkNativeWindow")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct PangoAttrEmbossed
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkPangoAttrEmbossed")
|
||||
|
@ -489,6 +446,17 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct RegionBox
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkRegionBox")
|
||||
(fields
|
||||
'("gint" "x1")
|
||||
'("gint" "y1")
|
||||
'("gint" "x2")
|
||||
'("gint" "y2")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct RgbCmap
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkRgbCmap")
|
||||
|
@ -517,6 +485,20 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct Selection
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkSelection")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct SelectionType
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkSelectionType")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Span
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkSpan")
|
||||
|
@ -527,6 +509,13 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct Target
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkTarget")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct TimeCoord
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkTimeCoord")
|
||||
|
@ -536,6 +525,13 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct WChar
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkWChar")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Window
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkWindow")
|
||||
|
@ -565,3 +561,10 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-struct XEvent
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkXEvent")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
|
||||
while ($line = <STDIN>) {
|
||||
|
||||
if ($line =~ /typedef\s+struct\s+(\w+)\s+(\w+);/) {
|
||||
if ($line =~ /typedef\s+struct\s+(\w+)\s+\**(\w+);/) {
|
||||
$types{$2} = $1;
|
||||
} elsif ($line =~ /typedef\s+(\w+)\s+(\w+);/) {
|
||||
$types{$2} = $1;
|
||||
} elsif ($line =~ /^struct\s+(\w+)/) {
|
||||
$sname = $1;
|
||||
|
@ -22,19 +24,38 @@ while ($line = <STDIN>) {
|
|||
}
|
||||
|
||||
foreach $key (sort (keys (%types))) {
|
||||
next if (($key =~ /Class$/) || exists($types{$key."Class"}));
|
||||
next if (($key =~ /Class$/) || ($key =~ "Private") ||
|
||||
exists($types{$key."Class"}));
|
||||
|
||||
if (exists($sdefs{$key})) {
|
||||
$def = $sdefs{$key};
|
||||
} else {
|
||||
$newkey = $types{$key};
|
||||
while ($newkey && !exists($sdefs{$newkey})) {
|
||||
$newkey = $types{$newkey};
|
||||
}
|
||||
warn "$key has no struct def\n" if ($newkey eq "");
|
||||
$def = $sdefs{$newkey};
|
||||
}
|
||||
|
||||
$key =~ /$ARGV[0](\w+)/;
|
||||
print "(define-struct $1\n";
|
||||
print " (in-module \"$ARGV[0]\")\n";
|
||||
print " (c-name \"$key\")\n";
|
||||
print " (fields\n";
|
||||
$sdefs{$types{$key}} =~ s/\n\s*//g;
|
||||
$sdefs{$types{$key}} =~ /\{(.+)\}/;
|
||||
$def =~ s/\s+/ /g;
|
||||
$def =~ s/\n\s*//g;
|
||||
$def =~ s|/\*.*?\*/||g;
|
||||
$def =~ /\{(.+)\}/;
|
||||
foreach $mem (split (/;/, $1)) {
|
||||
$mem =~ s?/\*.*\*/??;
|
||||
$mem =~ s/\s+(\*+)/\1 /;
|
||||
$mem =~ s/const /const\-/;
|
||||
if ($mem =~ /(\S+)\s+(.+)/) {
|
||||
$mem =~ s/\s+(\*+)/\1 /g;
|
||||
$mem =~ s/const /const\-/g;
|
||||
if ($mem =~ /(\S+\s+\(\*)\s*(.+\))/) {
|
||||
$type = $1; $fdesc = $2;
|
||||
$type =~ s/\s+\(\*/\*/;
|
||||
$fdesc =~ s/^(\w+)\)/\1/;
|
||||
print " '(\"$type\" \"$fdesc\")\n";
|
||||
} elsif ($mem =~ /(\S+)\s+(.+)/) {
|
||||
$type = $1; $symb = $2;
|
||||
foreach $tok (split (/,\s*/, $symb)) {
|
||||
print " '(\"$type\" \"$tok\")\n";
|
||||
|
|
|
@ -46,3 +46,378 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-signal size_request
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "first")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GtkRequisition*" "requisition")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal child_notify
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "first")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GParamSpec*" "pspec")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal focus
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "last")
|
||||
(parameters
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEvent*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal button_press_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventButton*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal button_release_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventButton*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal scroll_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventScroll*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal motion_notify_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventMotion*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal delete_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventAny*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal destroy_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventAny*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal expose_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventExpose*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal key_press_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventKey*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal key_release_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventKey*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal enter_notify_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventCrossing*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal leave_notify_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventCrossing*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal configure_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventConfigure*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal focus_in_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventFocus*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal focus_out_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventFocus*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal map_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventAny*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal unmap_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventAny*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal property_notify_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventProperty*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal selection_clear_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventSelection*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal selection_request_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventSelection*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal selection_notify_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventSelection*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal selection_received
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GtkSelectionData*" "selection_data")
|
||||
'("guint" "time")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal selection_get
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GtkSelectionData*" "selection_data")
|
||||
'("guint" "info")
|
||||
'("guint" "time")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal proximity_in_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventProximity*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal proximity_out_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventProximity*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal drag_motion
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkDragContext*" "context")
|
||||
'("gint" "x")
|
||||
'("gint" "y")
|
||||
'("guint" "time")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal drag_drop
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkDragContext*" "context")
|
||||
'("gint" "x")
|
||||
'("gint" "y")
|
||||
'("guint" "time")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal drag_data_get
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkDragContext*" "context")
|
||||
'("GtkSelectionData*" "selection_data")
|
||||
'("guint" "info")
|
||||
'("guint" "time")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal drag_data_received
|
||||
(of-object "GtkWidget")
|
||||
(return-type "none")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkDragContext*" "context")
|
||||
'("gint" "x")
|
||||
'("gint" "y")
|
||||
'("GtkSelectionData*" "selection_data")
|
||||
'("guint" "info")
|
||||
'("guint" "time")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal visibility_notify_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventVisibility*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal client_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventClient*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal no_expose_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventAny*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
(define-signal window_state_event
|
||||
(of-object "GtkWidget")
|
||||
(return-type "gboolean")
|
||||
(when "last")
|
||||
(parameters
|
||||
'("GtkWidget*" "widget")
|
||||
'("GdkEventWindowState*" "event")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
1088
codegen/gtk-structs.defs
Normal file
1088
codegen/gtk-structs.defs
Normal file
File diff suppressed because it is too large
Load diff
294
codegen/gtk.defs
294
codegen/gtk.defs
|
@ -2527,7 +2527,7 @@
|
|||
(parameters
|
||||
'("GtkCTreeNode*" "parent")
|
||||
'("GtkCTreeNode*" "sibling")
|
||||
'("gchar*[]" "text")
|
||||
'("gchar*" "text")
|
||||
'("guint8" "spacing" (default "5"))
|
||||
'("GdkPixmap*" "pixmap_closed" (null-ok) (default "NULL"))
|
||||
'("GdkBitmap*" "mask_closed" (null-ok) (default "NULL"))
|
||||
|
@ -2573,51 +2573,51 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method post_recursive
|
||||
(of-object "GtkCTree")
|
||||
(c-name "gtk_ctree_post_recursive")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCTreeNode*" "node")
|
||||
'("GtkCTreeFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method post_recursive
|
||||
# (of-object "GtkCTree")
|
||||
# (c-name "gtk_ctree_post_recursive")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCTreeNode*" "node")
|
||||
# '("GtkCTreeFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method post_recursive_to_depth
|
||||
(of-object "GtkCTree")
|
||||
(c-name "gtk_ctree_post_recursive_to_depth")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCTreeNode*" "node")
|
||||
'("gint" "depth")
|
||||
'("GtkCTreeFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method post_recursive_to_depth
|
||||
# (of-object "GtkCTree")
|
||||
# (c-name "gtk_ctree_post_recursive_to_depth")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCTreeNode*" "node")
|
||||
# '("gint" "depth")
|
||||
# '("GtkCTreeFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method pre_recursive
|
||||
(of-object "GtkCTree")
|
||||
(c-name "gtk_ctree_pre_recursive")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCTreeNode*" "node")
|
||||
'("GtkCTreeFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method pre_recursive
|
||||
# (of-object "GtkCTree")
|
||||
# (c-name "gtk_ctree_pre_recursive")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCTreeNode*" "node")
|
||||
# '("GtkCTreeFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method pre_recursive_to_depth
|
||||
(of-object "GtkCTree")
|
||||
(c-name "gtk_ctree_pre_recursive_to_depth")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCTreeNode*" "node")
|
||||
'("gint" "depth")
|
||||
'("GtkCTreeFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method pre_recursive_to_depth
|
||||
# (of-object "GtkCTree")
|
||||
# (c-name "gtk_ctree_pre_recursive_to_depth")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCTreeNode*" "node")
|
||||
# '("gint" "depth")
|
||||
# '("GtkCTreeFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method is_viewable
|
||||
(of-object "GtkCTree")
|
||||
|
@ -3077,16 +3077,16 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method node_set_row_data_full
|
||||
(of-object "GtkCTree")
|
||||
(c-name "gtk_ctree_node_set_row_data_full")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCTreeNode*" "node")
|
||||
'("gpointer" "data")
|
||||
'("GtkDestroyNotify" "destroy")
|
||||
)
|
||||
)
|
||||
#(define-method node_set_row_data_full
|
||||
# (of-object "GtkCTree")
|
||||
# (c-name "gtk_ctree_node_set_row_data_full")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCTreeNode*" "node")
|
||||
# '("gpointer" "data")
|
||||
# '("GtkDestroyNotify" "destroy")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method node_get_row_data
|
||||
(of-object "GtkCTree")
|
||||
|
@ -3163,14 +3163,14 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method set_drag_compare_func
|
||||
(of-object "GtkCTree")
|
||||
(c-name "gtk_ctree_set_drag_compare_func")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCTreeCompareDragFunc" "cmp_func")
|
||||
)
|
||||
)
|
||||
#(define-method set_drag_compare_func
|
||||
# (of-object "GtkCTree")
|
||||
# (c-name "gtk_ctree_set_drag_compare_func")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCTreeCompareDragFunc" "cmp_func")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method sort_node
|
||||
(of-object "GtkCTree")
|
||||
|
@ -12960,15 +12960,15 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method set_select_function
|
||||
(of-object "GtkTreeSelection")
|
||||
(c-name "gtk_tree_selection_set_select_function")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkSelectionFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method set_select_function
|
||||
# (of-object "GtkTreeSelection")
|
||||
# (c-name "gtk_tree_selection_set_select_function")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkSelectionFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method get_user_data
|
||||
(of-object "GtkTreeSelection")
|
||||
|
@ -12986,15 +12986,15 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method selected_foreach
|
||||
(of-object "GtkTreeSelection")
|
||||
(c-name "gtk_tree_selection_selected_foreach")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkTreeSelectionForeachFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method selected_foreach
|
||||
# (of-object "GtkTreeSelection")
|
||||
# (c-name "gtk_tree_selection_selected_foreach")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkTreeSelectionForeachFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method select_path
|
||||
(of-object "GtkTreeSelection")
|
||||
|
@ -13387,19 +13387,19 @@
|
|||
(varargs #t)
|
||||
)
|
||||
|
||||
(define-method insert_column_with_data_func
|
||||
(of-object "GtkTreeView")
|
||||
(c-name "gtk_tree_view_insert_column_with_data_func")
|
||||
(return-type "gint")
|
||||
(parameters
|
||||
'("gint" "position")
|
||||
'("gchar*" "title")
|
||||
'("GtkCellRenderer*" "cell")
|
||||
'("GtkTreeCellDataFunc" "func")
|
||||
'("gpointer" "data")
|
||||
'("GDestroyNotify" "dnotify")
|
||||
)
|
||||
)
|
||||
#(define-method insert_column_with_data_func
|
||||
# (of-object "GtkTreeView")
|
||||
# (c-name "gtk_tree_view_insert_column_with_data_func")
|
||||
# (return-type "gint")
|
||||
# (parameters
|
||||
# '("gint" "position")
|
||||
# '("gchar*" "title")
|
||||
# '("GtkCellRenderer*" "cell")
|
||||
# '("GtkTreeCellDataFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# '("GDestroyNotify" "dnotify")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method get_column
|
||||
(of-object "GtkTreeView")
|
||||
|
@ -13425,16 +13425,16 @@
|
|||
(return-type "GtkTreeViewColumn*")
|
||||
)
|
||||
|
||||
(define-method set_column_drag_function
|
||||
(of-object "GtkTreeView")
|
||||
(c-name "gtk_tree_view_set_column_drag_function")
|
||||
(return-type "void")
|
||||
(parameters
|
||||
'("GtkTreeViewColumnDropFunc" "func")
|
||||
'("gpointer" "user_data")
|
||||
'("GDestroyNotify" "dnotify")
|
||||
)
|
||||
)
|
||||
#(define-method set_column_drag_function
|
||||
# (of-object "GtkTreeView")
|
||||
# (c-name "gtk_tree_view_set_column_drag_function")
|
||||
# (return-type "void")
|
||||
# (parameters
|
||||
# '("GtkTreeViewColumnDropFunc" "func")
|
||||
# '("gpointer" "user_data")
|
||||
# '("GDestroyNotify" "dnotify")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method scroll_to_point
|
||||
(of-object "GtkTreeView")
|
||||
|
@ -13500,15 +13500,15 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method expand_rows
|
||||
(of-object "GtkTreeView")
|
||||
(c-name "gtk_tree_view_expand_rows")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkTreeViewMappingFunc" "func")
|
||||
'("gpointer" "data")
|
||||
)
|
||||
)
|
||||
#(define-method expand_rows
|
||||
# (of-object "GtkTreeView")
|
||||
# (c-name "gtk_tree_view_expand_rows")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkTreeViewMappingFunc" "func")
|
||||
# '("gpointer" "data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method set_reorderable
|
||||
(of-object "GtkTreeView")
|
||||
|
@ -13600,32 +13600,32 @@
|
|||
)
|
||||
)
|
||||
|
||||
(define-method set_rows_drag_source
|
||||
(of-object "GtkTreeView")
|
||||
(c-name "gtk_tree_view_set_rows_drag_source")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GdkModifierType" "start_button_mask")
|
||||
'("const-GtkTargetEntry*" "targets")
|
||||
'("gint" "n_targets")
|
||||
'("GdkDragAction" "actions")
|
||||
'("GtkTreeViewDraggableFunc" "row_draggable_func")
|
||||
'("gpointer" "user_data")
|
||||
)
|
||||
)
|
||||
#(define-method set_rows_drag_source
|
||||
# (of-object "GtkTreeView")
|
||||
# (c-name "gtk_tree_view_set_rows_drag_source")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GdkModifierType" "start_button_mask")
|
||||
# '("const-GtkTargetEntry*" "targets")
|
||||
# '("gint" "n_targets")
|
||||
# '("GdkDragAction" "actions")
|
||||
# '("GtkTreeViewDraggableFunc" "row_draggable_func")
|
||||
# '("gpointer" "user_data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method set_rows_drag_dest
|
||||
(of-object "GtkTreeView")
|
||||
(c-name "gtk_tree_view_set_rows_drag_dest")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("const-GtkTargetEntry*" "targets")
|
||||
'("gint" "n_targets")
|
||||
'("GdkDragAction" "actions")
|
||||
'("GtkTreeViewDroppableFunc" "location_droppable_func")
|
||||
'("gpointer" "user_data")
|
||||
)
|
||||
)
|
||||
#(define-method set_rows_drag_dest
|
||||
# (of-object "GtkTreeView")
|
||||
# (c-name "gtk_tree_view_set_rows_drag_dest")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("const-GtkTargetEntry*" "targets")
|
||||
# '("gint" "n_targets")
|
||||
# '("GdkDragAction" "actions")
|
||||
# '("GtkTreeViewDroppableFunc" "location_droppable_func")
|
||||
# '("gpointer" "user_data")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method unset_rows_drag_source
|
||||
(of-object "GtkTreeView")
|
||||
|
@ -13758,17 +13758,17 @@
|
|||
(varargs #t)
|
||||
)
|
||||
|
||||
(define-method set_cell_data_func
|
||||
(of-object "GtkTreeViewColumn")
|
||||
(c-name "gtk_tree_view_column_set_cell_data_func")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkCellRenderer*" "cell_renderer")
|
||||
'("GtkCellDataFunc" "func")
|
||||
'("gpointer" "func_data")
|
||||
'("GtkDestroyNotify" "destroy")
|
||||
)
|
||||
)
|
||||
#(define-method set_cell_data_func
|
||||
# (of-object "GtkTreeViewColumn")
|
||||
# (c-name "gtk_tree_view_column_set_cell_data_func")
|
||||
# (return-type "none")
|
||||
# (parameters
|
||||
# '("GtkCellRenderer*" "cell_renderer")
|
||||
# '("GtkCellDataFunc" "func")
|
||||
# '("gpointer" "func_data")
|
||||
# '("GtkDestroyNotify" "destroy")
|
||||
# )
|
||||
#)
|
||||
|
||||
(define-method clear_attributes
|
||||
(of-object "GtkTreeViewColumn")
|
||||
|
|
|
@ -1,21 +1,3 @@
|
|||
(define-struct Geometry
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkGeometry")
|
||||
(fields
|
||||
'("gint" "min_width")
|
||||
'("gint" "max_width")
|
||||
'("gint" "min_height")
|
||||
'("gint" "max_height")
|
||||
'("gint" "base_width")
|
||||
'("gint" "base_height")
|
||||
'("gint" "width_inc")
|
||||
'("gint" "height_inc")
|
||||
'("gdouble" "min_aspect")
|
||||
'("gdouble" "max_aspect")
|
||||
'("GdkGravity" "win_gravity")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Event
|
||||
(in-module "Gdk")
|
||||
(c-name "GdkEvent")
|
||||
|
@ -36,3 +18,13 @@
|
|||
'("guint" "signal_id")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct TargetList
|
||||
(in-module "Gtk")
|
||||
(c-name "GtkTargetList")
|
||||
(fields
|
||||
'("GList*" "target_list")
|
||||
'("guint" "ref_count")
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ all:
|
|||
@echo "'make unix' is broken for now."
|
||||
|
||||
windows:
|
||||
cat gdk-types.defs hardcoded.defs gtk-types.defs gtk-signals.defs gtk-props.defs gtk.defs | ./defs-parse.pl
|
||||
cat pango-types.defs pango-structs.defs pango.defs gdk-types.defs gdk-structs.defs hardcoded.defs gtk-types.defs gtk-structs.defs gtk-signals.defs gtk-props.defs gtk.defs | ./defs-parse.pl
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
|
412
codegen/pango-structs.defs
Normal file
412
codegen/pango-structs.defs
Normal file
|
@ -0,0 +1,412 @@
|
|||
(define-struct Analysis
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAnalysis")
|
||||
(fields
|
||||
'("PangoEngineShape*" "shape_engine")
|
||||
'("PangoEngineLang*" "lang_engine")
|
||||
'("PangoFont*" "font")
|
||||
'("guint8" "level")
|
||||
'("PangoLanguage*" "language")
|
||||
'("GSList*" "extra_attrs")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrColor
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrColor")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("PangoColor" "color")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrFloat
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrFloat")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("double" "value")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrFontDesc
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrFontDesc")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("PangoFontDescription*" "desc")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrInt
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrInt")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("int" "value")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrIterator
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrIterator")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrLanguage
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrLanguage")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("PangoLanguage*" "value")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrList
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrList")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrShape
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrShape")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("PangoRectangle" "ink_rect")
|
||||
'("PangoRectangle" "logical_rect")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct AttrString
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrString")
|
||||
(fields
|
||||
'("PangoAttribute" "attr")
|
||||
'("char*" "value")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Attribute
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttribute")
|
||||
(fields
|
||||
'("gpointer" "klass")
|
||||
'("guint" "start_index")
|
||||
'("guint" "end_index")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Color
|
||||
(in-module "Pango")
|
||||
(c-name "PangoColor")
|
||||
(fields
|
||||
'("guint16" "red")
|
||||
'("guint16" "green")
|
||||
'("guint16" "blue")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Coverage
|
||||
(in-module "Pango")
|
||||
(c-name "PangoCoverage")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Engine
|
||||
(in-module "Pango")
|
||||
(c-name "PangoEngine")
|
||||
(fields
|
||||
'("gchar*" "id")
|
||||
'("gchar*" "type")
|
||||
'("gint" "length")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct EngineInfo
|
||||
(in-module "Pango")
|
||||
(c-name "PangoEngineInfo")
|
||||
(fields
|
||||
'("gchar*" "id")
|
||||
'("gchar*" "engine_type")
|
||||
'("gchar*" "render_type")
|
||||
'("PangoEngineRange*" "ranges")
|
||||
'("gint" "n_ranges")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct EngineLang
|
||||
(in-module "Pango")
|
||||
(c-name "PangoEngineLang")
|
||||
(fields
|
||||
'("PangoEngine" "engine")
|
||||
'("void*" "script_break (const-char* text, int len, PangoAnalysis* analysis, PangoLogAttr* attrs, int attrs_len)")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct EngineRange
|
||||
(in-module "Pango")
|
||||
(c-name "PangoEngineRange")
|
||||
(fields
|
||||
'("guint32" "start")
|
||||
'("guint32" "end")
|
||||
'("gchar*" "langs")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct EngineShape
|
||||
(in-module "Pango")
|
||||
(c-name "PangoEngineShape")
|
||||
(fields
|
||||
'("PangoEngine" "engine")
|
||||
'("void*" "script_shape (PangoFont* font, const-char* text, int length, PangoAnalysis* analysis, PangoGlyphString* glyphs)")
|
||||
'("PangoCoverage**" "get_coverage (PangoFont* font, PangoLanguage* language)")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct FontDescription
|
||||
(in-module "Pango")
|
||||
(c-name "PangoFontDescription")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct FontMetrics
|
||||
(in-module "Pango")
|
||||
(c-name "PangoFontMetrics")
|
||||
(fields
|
||||
'("guint" "ref_count")
|
||||
'("int" "ascent")
|
||||
'("int" "descent")
|
||||
'("int" "approximate_char_width")
|
||||
'("int" "approximate_digit_width")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Glyph
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyph")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct GlyphGeometry
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyphGeometry")
|
||||
(fields
|
||||
'("PangoGlyphUnit" "width")
|
||||
'("PangoGlyphUnit" "x_offset")
|
||||
'("PangoGlyphUnit" "y_offset")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct GlyphInfo
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyphInfo")
|
||||
(fields
|
||||
'("PangoGlyph" "glyph")
|
||||
'("PangoGlyphGeometry" "geometry")
|
||||
'("PangoGlyphVisAttr" "attr")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct GlyphString
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyphString")
|
||||
(fields
|
||||
'("gint" "num_glyphs")
|
||||
'("PangoGlyphInfo*" "glyphs")
|
||||
'("gint*" "log_clusters")
|
||||
'("gint" "space")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct GlyphUnit
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyphUnit")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct GlyphVisAttr
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyphVisAttr")
|
||||
(fields
|
||||
'("guint" "is_cluster_start : 1")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct IncludedModule
|
||||
(in-module "Pango")
|
||||
(c-name "PangoIncludedModule")
|
||||
(fields
|
||||
'("void*" "list (PangoEngineInfo** engines, int* n_engines)")
|
||||
'("PangoEngine**" "load (const-char* id)")
|
||||
'("void*" "unload (PangoEngine* engine)")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct IndicScript
|
||||
(in-module "Pango")
|
||||
(c-name "PangoIndicScript")
|
||||
(fields
|
||||
'("gchar*" "name")
|
||||
'("gboolean*" "is_prefixing_vowel (gunichar what)")
|
||||
'("gboolean*" "is_vowel_sign (gunichar what)")
|
||||
'("gunichar*" "vowel_sign_to_matra (gunichar what)")
|
||||
'("gboolean*" "is_vowel_half (gunichar what)")
|
||||
'("gboolean*" "vowel_split (gunichar what, gunichar* prefix, gunichar* suffix)")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct IntSet
|
||||
(in-module "Pango")
|
||||
(c-name "PangoIntSet")
|
||||
(fields
|
||||
'("int" "start")
|
||||
'("int" "size")
|
||||
'("guint*" "bits")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Item
|
||||
(in-module "Pango")
|
||||
(c-name "PangoItem")
|
||||
(fields
|
||||
'("gint" "offset")
|
||||
'("gint" "length")
|
||||
'("gint" "num_chars")
|
||||
'("PangoAnalysis" "analysis")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Language
|
||||
(in-module "Pango")
|
||||
(c-name "PangoLanguage")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct LayoutIter
|
||||
(in-module "Pango")
|
||||
(c-name "PangoLayoutIter")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct LayoutLine
|
||||
(in-module "Pango")
|
||||
(c-name "PangoLayoutLine")
|
||||
(fields
|
||||
'("PangoLayout*" "layout")
|
||||
'("gint" "start_index")
|
||||
'("gint" "length")
|
||||
'("GSList*" "runs")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct LayoutRun
|
||||
(in-module "Pango")
|
||||
(c-name "PangoLayoutRun")
|
||||
(fields
|
||||
'("PangoItem*" "item")
|
||||
'("PangoGlyphString*" "glyphs")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct LogAttr
|
||||
(in-module "Pango")
|
||||
(c-name "PangoLogAttr")
|
||||
(fields
|
||||
'("guint" "is_line_break : 1")
|
||||
'("guint" "is_mandatory_break : 1")
|
||||
'("guint" "is_char_break : 1")
|
||||
'("guint" "is_white : 1")
|
||||
'("guint" "is_cursor_position : 1")
|
||||
'("guint" "is_word_start : 1")
|
||||
'("guint" "is_word_end : 1")
|
||||
'("guint" "is_sentence_boundary : 1")
|
||||
'("guint" "is_sentence_start : 1")
|
||||
'("guint" "is_sentence_end : 1")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Map
|
||||
(in-module "Pango")
|
||||
(c-name "PangoMap")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct MapEntry
|
||||
(in-module "Pango")
|
||||
(c-name "PangoMapEntry")
|
||||
(fields
|
||||
'("PangoEngineInfo*" "info")
|
||||
'("gboolean" "is_exact")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct OTInfo
|
||||
(in-module "Pango")
|
||||
(c-name "PangoOTInfo")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct OTRuleset
|
||||
(in-module "Pango")
|
||||
(c-name "PangoOTRuleset")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct OTTag
|
||||
(in-module "Pango")
|
||||
(c-name "PangoOTTag")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Rectangle
|
||||
(in-module "Pango")
|
||||
(c-name "PangoRectangle")
|
||||
(fields
|
||||
'("int" "x")
|
||||
'("int" "y")
|
||||
'("int" "width")
|
||||
'("int" "height")
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct TabArray
|
||||
(in-module "Pango")
|
||||
(c-name "PangoTabArray")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct Win32FontCache
|
||||
(in-module "Pango")
|
||||
(c-name "PangoWin32FontCache")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct XFontCache
|
||||
(in-module "Pango")
|
||||
(c-name "PangoXFontCache")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
||||
(define-struct XSubfont
|
||||
(in-module "Pango")
|
||||
(c-name "PangoXSubfont")
|
||||
(fields
|
||||
)
|
||||
)
|
||||
|
271
codegen/pango-types.defs
Normal file
271
codegen/pango-types.defs
Normal file
|
@ -0,0 +1,271 @@
|
|||
;; -*- scheme -*-
|
||||
; object definitions ...
|
||||
|
||||
(define-object Context
|
||||
(in-module "Pango")
|
||||
(parent "GObject")
|
||||
(c-name "PangoContext")
|
||||
(gtype-id "PANGO_TYPE_CONTEXT")
|
||||
)
|
||||
|
||||
(define-object Font
|
||||
(in-module "Pango")
|
||||
(parent "GObject")
|
||||
(c-name "PangoFont")
|
||||
(gtype-id "PANGO_TYPE_FONT")
|
||||
)
|
||||
|
||||
(define-object FontFace
|
||||
(in-module "Pango")
|
||||
(parent "GObject")
|
||||
(c-name "PangoFontFace")
|
||||
(gtype-id "PANGO_TYPE_FONT_FACE")
|
||||
)
|
||||
|
||||
(define-object FontFamily
|
||||
(in-module "Pango")
|
||||
(parent "GObject")
|
||||
(c-name "PangoFontFamily")
|
||||
(gtype-id "PANGO_TYPE_FONT_FAMILY")
|
||||
)
|
||||
|
||||
(define-object FontMap
|
||||
(in-module "Pango")
|
||||
(parent "GObject")
|
||||
(c-name "PangoFontMap")
|
||||
(gtype-id "PANGO_TYPE_FONT_MAP")
|
||||
)
|
||||
|
||||
(define-object Layout
|
||||
(in-module "Pango")
|
||||
(parent "GObject")
|
||||
(c-name "PangoLayout")
|
||||
(gtype-id "PANGO_TYPE_LAYOUT")
|
||||
)
|
||||
|
||||
|
||||
;; boxed definitions ...
|
||||
|
||||
(define-boxed AttrList
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrList")
|
||||
(gtype-id "PANGO_TYPE_ATTR_LIST")
|
||||
(copy-func "pango_attr_list_ref")
|
||||
(release-func "pango_attr_list_unref")
|
||||
)
|
||||
|
||||
(define-boxed Color
|
||||
(in-module "Pango")
|
||||
(c-name "PangoColor")
|
||||
(gtype-id "PANGO_TYPE_COLOR")
|
||||
(copy-func "pango_color_copy")
|
||||
(release-func "pango_color_free")
|
||||
(fields
|
||||
'("guint16" "red")
|
||||
'("guint16" "green")
|
||||
'("guint16" "blue")
|
||||
)
|
||||
)
|
||||
|
||||
(define-boxed FontDescription
|
||||
(in-module "Pango")
|
||||
(c-name "PangoFontDescription")
|
||||
(gtype-id "PANGO_TYPE_FONT_DESCRIPTION")
|
||||
(copy-func "pango_font_description_copy")
|
||||
(release-func "pango_font_description_free")
|
||||
)
|
||||
|
||||
(define-boxed FontMetrics
|
||||
(in-module "Pango")
|
||||
(c-name "PangoFontMetrics")
|
||||
(gtype-id "PANGO_TYPE_FONT_METRICS")
|
||||
(copy-func "pango_font_metrics_ref")
|
||||
(release-func "pango_font_metrics_unref")
|
||||
)
|
||||
|
||||
(define-boxed GlyphString
|
||||
(in-module "Pango")
|
||||
(c-name "PangoGlyphString")
|
||||
(gtype-id "PANGO_TYPE_GLYPH_STRING")
|
||||
(copy-func "pango_glyph_string_copy")
|
||||
(release-func "pango_glyph_string_free")
|
||||
(fields
|
||||
'("gint" "num_glyphs")
|
||||
'("PangoGlyphInfo*" "glyphs")
|
||||
'("gint*" "log_clusters")
|
||||
)
|
||||
)
|
||||
|
||||
(define-boxed Language
|
||||
(in-module "Pango")
|
||||
(c-name "PangoLanguage")
|
||||
(gtype-id "PANGO_TYPE_LANGUAGE")
|
||||
)
|
||||
|
||||
(define-boxed TabArray
|
||||
(in-module "Pango")
|
||||
(c-name "PangoTabArray")
|
||||
(gtype-id "PANGO_TYPE_TAB_ARRAY")
|
||||
(copy-func "pango_tab_array_copy")
|
||||
(release-func "pango_tab_array_free")
|
||||
)
|
||||
|
||||
|
||||
;; Enumerations and flags ...
|
||||
|
||||
(define-enum AttrType
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAttrType")
|
||||
(gtype-id "PANGO_TYPE_ATTR_TYPE")
|
||||
(values
|
||||
'("invalid" "PANGO_ATTR_INVALID")
|
||||
'("language" "PANGO_ATTR_LANGUAGE")
|
||||
'("family" "PANGO_ATTR_FAMILY")
|
||||
'("style" "PANGO_ATTR_STYLE")
|
||||
'("weight" "PANGO_ATTR_WEIGHT")
|
||||
'("variant" "PANGO_ATTR_VARIANT")
|
||||
'("stretch" "PANGO_ATTR_STRETCH")
|
||||
'("size" "PANGO_ATTR_SIZE")
|
||||
'("font-desc" "PANGO_ATTR_FONT_DESC")
|
||||
'("foreground" "PANGO_ATTR_FOREGROUND")
|
||||
'("background" "PANGO_ATTR_BACKGROUND")
|
||||
'("underline" "PANGO_ATTR_UNDERLINE")
|
||||
'("strikethrough" "PANGO_ATTR_STRIKETHROUGH")
|
||||
'("rise" "PANGO_ATTR_RISE")
|
||||
'("shape" "PANGO_ATTR_SHAPE")
|
||||
'("scale" "PANGO_ATTR_SCALE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Underline
|
||||
(in-module "Pango")
|
||||
(c-name "PangoUnderline")
|
||||
(gtype-id "PANGO_TYPE_UNDERLINE")
|
||||
(values
|
||||
'("none" "PANGO_UNDERLINE_NONE")
|
||||
'("single" "PANGO_UNDERLINE_SINGLE")
|
||||
'("double" "PANGO_UNDERLINE_DOUBLE")
|
||||
'("low" "PANGO_UNDERLINE_LOW")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum CoverageLevel
|
||||
(in-module "Pango")
|
||||
(c-name "PangoCoverageLevel")
|
||||
(gtype-id "PANGO_TYPE_COVERAGE_LEVEL")
|
||||
(values
|
||||
'("none" "PANGO_COVERAGE_NONE")
|
||||
'("fallback" "PANGO_COVERAGE_FALLBACK")
|
||||
'("approximate" "PANGO_COVERAGE_APPROXIMATE")
|
||||
'("exact" "PANGO_COVERAGE_EXACT")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Style
|
||||
(in-module "Pango")
|
||||
(c-name "PangoStyle")
|
||||
(gtype-id "PANGO_TYPE_STYLE")
|
||||
(values
|
||||
'("normal" "PANGO_STYLE_NORMAL")
|
||||
'("oblique" "PANGO_STYLE_OBLIQUE")
|
||||
'("italic" "PANGO_STYLE_ITALIC")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Variant
|
||||
(in-module "Pango")
|
||||
(c-name "PangoVariant")
|
||||
(gtype-id "PANGO_TYPE_VARIANT")
|
||||
(values
|
||||
'("normal" "PANGO_VARIANT_NORMAL")
|
||||
'("small-caps" "PANGO_VARIANT_SMALL_CAPS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Weight
|
||||
(in-module "Pango")
|
||||
(c-name "PangoWeight")
|
||||
(gtype-id "PANGO_TYPE_WEIGHT")
|
||||
(values
|
||||
'("ultralight" "PANGO_WEIGHT_ULTRALIGHT")
|
||||
'("light" "PANGO_WEIGHT_LIGHT")
|
||||
'("normal" "PANGO_WEIGHT_NORMAL")
|
||||
'("bold" "PANGO_WEIGHT_BOLD")
|
||||
'("ultrabold" "PANGO_WEIGHT_ULTRABOLD")
|
||||
'("heavy" "PANGO_WEIGHT_HEAVY")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Stretch
|
||||
(in-module "Pango")
|
||||
(c-name "PangoStretch")
|
||||
(gtype-id "PANGO_TYPE_STRETCH")
|
||||
(values
|
||||
'("ultra-condensed" "PANGO_STRETCH_ULTRA_CONDENSED")
|
||||
'("extra-condensed" "PANGO_STRETCH_EXTRA_CONDENSED")
|
||||
'("condensed" "PANGO_STRETCH_CONDENSED")
|
||||
'("semi-condensed" "PANGO_STRETCH_SEMI_CONDENSED")
|
||||
'("normal" "PANGO_STRETCH_NORMAL")
|
||||
'("semi-expanded" "PANGO_STRETCH_SEMI_EXPANDED")
|
||||
'("expanded" "PANGO_STRETCH_EXPANDED")
|
||||
'("extra-expanded" "PANGO_STRETCH_EXTRA_EXPANDED")
|
||||
'("ultra-expanded" "PANGO_STRETCH_ULTRA_EXPANDED")
|
||||
)
|
||||
)
|
||||
|
||||
(define-flags FontMask
|
||||
(in-module "Pango")
|
||||
(c-name "PangoFontMask")
|
||||
(gtype-id "PANGO_TYPE_FONT_MASK")
|
||||
(values
|
||||
'("family" "PANGO_FONT_MASK_FAMILY")
|
||||
'("style" "PANGO_FONT_MASK_STYLE")
|
||||
'("variant" "PANGO_FONT_MASK_VARIANT")
|
||||
'("weight" "PANGO_FONT_MASK_WEIGHT")
|
||||
'("stretch" "PANGO_FONT_MASK_STRETCH")
|
||||
'("size" "PANGO_FONT_MASK_SIZE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Alignment
|
||||
(in-module "Pango")
|
||||
(c-name "PangoAlignment")
|
||||
(gtype-id "PANGO_TYPE_ALIGNMENT")
|
||||
(values
|
||||
'("left" "PANGO_ALIGN_LEFT")
|
||||
'("center" "PANGO_ALIGN_CENTER")
|
||||
'("right" "PANGO_ALIGN_RIGHT")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum WrapMode
|
||||
(in-module "Pango")
|
||||
(c-name "PangoWrapMode")
|
||||
(gtype-id "PANGO_TYPE_WRAP_MODE")
|
||||
(values
|
||||
'("word" "PANGO_WRAP_WORD")
|
||||
'("char" "PANGO_WRAP_CHAR")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum TabAlign
|
||||
(in-module "Pango")
|
||||
(c-name "PangoTabAlign")
|
||||
(gtype-id "PANGO_TYPE_TAB_ALIGN")
|
||||
(values
|
||||
'("t" "PANGO_TAB_LEFT")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Direction
|
||||
(in-module "Pango")
|
||||
(c-name "PangoDirection")
|
||||
(gtype-id "PANGO_TYPE_DIRECTION")
|
||||
(values
|
||||
'("ltr" "PANGO_DIRECTION_LTR")
|
||||
'("rtl" "PANGO_DIRECTION_RTL")
|
||||
'("ttb-ltr" "PANGO_DIRECTION_TTB_LTR")
|
||||
'("ttb-rtl" "PANGO_DIRECTION_TTB_RTL")
|
||||
)
|
||||
)
|
||||
|
1738
codegen/pango.defs
Normal file
1738
codegen/pango.defs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,142 +0,0 @@
|
|||
// Gdk.SimpleEvent.cs - Gdk Simple Event Signal implementation
|
||||
//
|
||||
// Author: Bob Smith <bob@thestuff.net>
|
||||
// Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Bob Smith and Mike Kestner
|
||||
|
||||
namespace Gdk {
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using GLib;
|
||||
using Gdk;
|
||||
|
||||
public class SimpleEventArgs : EventArgs {
|
||||
public SimpleEventArgs(Gdk.Event evnt)
|
||||
{
|
||||
_evnt = evnt;
|
||||
}
|
||||
private Gdk.Event _evnt;
|
||||
public Gdk.Event Event
|
||||
{
|
||||
get
|
||||
{
|
||||
return _evnt;
|
||||
}
|
||||
}
|
||||
public static explicit operator Gdk.Event(SimpleEventArgs value)
|
||||
{
|
||||
return value.Event;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SimpleEventDelegate Delegate
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Callback used to connect to GdkEvent based signals.
|
||||
/// </remarks>
|
||||
|
||||
public delegate bool SimpleEventDelegate(IntPtr obj, IntPtr e,
|
||||
int key);
|
||||
|
||||
/// <summary>
|
||||
/// SimpleEvent Class
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Connects to a specified signal on a raw object and relays
|
||||
/// events to an EventHandle when they occur.
|
||||
/// </remarks>
|
||||
|
||||
public class SimpleEvent {
|
||||
|
||||
// A Counter used to produce unique keys for instances.
|
||||
private static int _NextKey = 0;
|
||||
|
||||
// A hash table containing refs to all current instances.
|
||||
private static Hashtable _Instances = new Hashtable ();
|
||||
|
||||
// locals to create and pin the shared delegate.
|
||||
private static SimpleEventDelegate _Delegate;
|
||||
private static GCHandle _GCHandle;
|
||||
|
||||
// Shared delegate that relays events to registered handlers
|
||||
private static bool SimpleEventCallback (IntPtr obj, IntPtr e,
|
||||
int inst_key)
|
||||
{
|
||||
if (!_Instances.Contains (inst_key))
|
||||
throw new Exception ("Unexpected event key");
|
||||
|
||||
SimpleEvent se = (SimpleEvent) _Instances [inst_key];
|
||||
Event evnt = new Event ();
|
||||
Marshal.PtrToStructure (e, evnt);
|
||||
// Marshal.PtrToStructure (e, (object) evnt);
|
||||
EventArgs args = new SimpleEventArgs (evnt);
|
||||
se._handler (se._obj, args);
|
||||
return true; //FIXME: How do we manage the return value?
|
||||
}
|
||||
|
||||
// private instance members
|
||||
private GLib.Object _obj;
|
||||
private EventHandler _handler;
|
||||
private int _key;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleEvent Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Registers a new event handler for a specified signal.
|
||||
/// A connection to the raw object signal is made which
|
||||
/// causes any events which occur to be relayed to the
|
||||
/// event handler.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport ("gobject-1.3.dll", CharSet=CharSet.Ansi,
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_signal_connect_data (
|
||||
IntPtr obj, IntPtr name, SimpleEventDelegate eh,
|
||||
int key, IntPtr p, int flags);
|
||||
|
||||
public SimpleEvent (GLib.Object obj, IntPtr raw,
|
||||
String name, EventHandler eh)
|
||||
{
|
||||
if (_Delegate == null) {
|
||||
_Delegate = new SimpleEventDelegate (
|
||||
SimpleEventCallback);
|
||||
/* FIXME: Exception thrown for lack of layout
|
||||
_GCHandle = GCHandle.Alloc (
|
||||
_Delegate, GCHandleType.Pinned);
|
||||
*/
|
||||
}
|
||||
|
||||
_key = _NextKey++;
|
||||
_Instances [_key] = this;
|
||||
_obj = obj;
|
||||
_handler = eh;
|
||||
|
||||
g_signal_connect_data (
|
||||
raw, Marshal.StringToHGlobalAnsi (name),
|
||||
_Delegate, _key, new IntPtr (0), 0);
|
||||
}
|
||||
|
||||
// Destructor is needed to release references from the instance
|
||||
// table and unpin the delegate if no refs remain.
|
||||
|
||||
~SimpleEvent ()
|
||||
{
|
||||
// FIXME: Disconnect the signal
|
||||
_Instances.Remove (_key);
|
||||
|
||||
if (_Instances.Count == 0) {
|
||||
/* FIXME: when the handle can be obtained
|
||||
_GCHandle.Free();
|
||||
*/
|
||||
_Delegate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ all:
|
|||
@echo "'make unix' is broken for now."
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /out:gdk-sharp.dll /recurse:*.cs
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /r:../pango/pango-sharp.dll /out:gdk-sharp.dll /recurse:*.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
|
3
generator/.cvsignore
Normal file
3
generator/.cvsignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.dll
|
||||
*.exe
|
||||
|
31
generator/CodeGenerator.cs
Normal file
31
generator/CodeGenerator.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
// GtkSharp.CodeGenerator.cs - The main code generation engine.
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Mike Kestner
|
||||
|
||||
namespace GtkSharp {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
|
||||
public class CodeGenerator {
|
||||
|
||||
public static int Main (string[] args)
|
||||
{
|
||||
Parser p = new Parser (args[0]);
|
||||
Hashtable types = p.Types;
|
||||
Console.WriteLine (types.Count);
|
||||
|
||||
IDictionaryEnumerator de = types.GetEnumerator();
|
||||
while (de.MoveNext()) {
|
||||
IGeneratable gen = (IGeneratable) de.Value;
|
||||
gen.Generate ();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
97
generator/EnumGen.cs
Normal file
97
generator/EnumGen.cs
Normal file
|
@ -0,0 +1,97 @@
|
|||
// GtkSharp.EnumGen.cs - The Enumeration Generatable.
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Mike Kestner
|
||||
|
||||
namespace GtkSharp {
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
public class EnumGen : IGeneratable {
|
||||
|
||||
private String ns;
|
||||
private XmlElement elem;
|
||||
|
||||
public EnumGen (String ns, XmlElement elem) {
|
||||
|
||||
this.ns = ns;
|
||||
this.elem = elem;
|
||||
}
|
||||
|
||||
public String Name {
|
||||
get
|
||||
{
|
||||
return elem.GetAttribute("name");
|
||||
}
|
||||
}
|
||||
|
||||
public String CName {
|
||||
get
|
||||
{
|
||||
return elem.GetAttribute("cname");
|
||||
}
|
||||
}
|
||||
|
||||
public String MarshalType {
|
||||
get
|
||||
{
|
||||
return "int";
|
||||
}
|
||||
}
|
||||
|
||||
public String CallByName (String var_name)
|
||||
{
|
||||
return "(int) " + var_name;
|
||||
}
|
||||
|
||||
public void Generate ()
|
||||
{
|
||||
String filename = "..\\" + ns.ToLower() + "\\generated\\" + Name + ".cs";
|
||||
|
||||
FileStream stream = new FileStream (filename, FileMode.OpenOrCreate, FileAccess.Write);
|
||||
StreamWriter sw = new StreamWriter (stream);
|
||||
|
||||
sw.WriteLine ("// Generated File. Do not modify.");
|
||||
sw.WriteLine ("// <c> 2001 Mike Kestner");
|
||||
sw.WriteLine ();
|
||||
|
||||
sw.WriteLine ("namespace " + ns + "{");
|
||||
sw.WriteLine ();
|
||||
|
||||
if (elem.GetAttribute("type") == "flags") {
|
||||
sw.WriteLine ("\tusing System;");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("\t[Flags]");
|
||||
}
|
||||
|
||||
sw.WriteLine ("\tpublic enum " + Name + " {");
|
||||
sw.WriteLine ();
|
||||
|
||||
foreach (XmlNode node in elem.ChildNodes) {
|
||||
if (node.Name != "member") {
|
||||
continue;
|
||||
}
|
||||
|
||||
XmlElement member = (XmlElement) node;
|
||||
sw.Write ("\t\t" + member.GetAttribute("name"));
|
||||
if (member.HasAttribute("value")) {
|
||||
sw.WriteLine (" = " + member.GetAttribute("value") + ",");
|
||||
} else {
|
||||
sw.WriteLine (",");
|
||||
}
|
||||
}
|
||||
|
||||
sw.WriteLine ("\t}");
|
||||
sw.WriteLine ();
|
||||
sw.WriteLine ("}");
|
||||
|
||||
sw.Flush();
|
||||
sw.Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
23
generator/IGeneratable.cs
Normal file
23
generator/IGeneratable.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
// GtkSharp.IGeneratable.cs - Interface to generate code for a type.
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Mike Kestner
|
||||
|
||||
namespace GtkSharp {
|
||||
|
||||
using System;
|
||||
|
||||
public interface IGeneratable {
|
||||
|
||||
String CName {get;}
|
||||
|
||||
String MarshalType {get;}
|
||||
|
||||
String Name {get;}
|
||||
|
||||
String CallByName (String var_name);
|
||||
|
||||
void Generate ();
|
||||
}
|
||||
}
|
102
generator/Parser.cs
Normal file
102
generator/Parser.cs
Normal file
|
@ -0,0 +1,102 @@
|
|||
// GtkSharp.Parser.cs - The XML Parsing engine.
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Mike Kestner
|
||||
|
||||
namespace GtkSharp {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Xml;
|
||||
|
||||
public class Parser {
|
||||
|
||||
private XmlDocument doc;
|
||||
private Hashtable types;
|
||||
|
||||
public Parser (String filename)
|
||||
{
|
||||
doc = new XmlDocument ();
|
||||
|
||||
try {
|
||||
|
||||
doc.Load (filename);
|
||||
|
||||
} catch (XmlException e) {
|
||||
|
||||
Console.WriteLine ("Invalid XML file.");
|
||||
Console.WriteLine (e.ToString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public Hashtable Types {
|
||||
get
|
||||
{
|
||||
if (types != null) return types;
|
||||
|
||||
XmlElement root = doc.DocumentElement;
|
||||
|
||||
if ((root == null) || !root.HasChildNodes) {
|
||||
Console.WriteLine ("No Namespaces found.");
|
||||
return null;
|
||||
}
|
||||
|
||||
types = new Hashtable ();
|
||||
|
||||
foreach (XmlNode ns in root.ChildNodes) {
|
||||
if (ns.Name != "namespace") {
|
||||
continue;
|
||||
}
|
||||
|
||||
XmlElement elem = (XmlElement) ns;
|
||||
ParseNamespace (elem);
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
}
|
||||
|
||||
private void ParseNamespace (XmlElement ns)
|
||||
{
|
||||
String ns_name = ns.GetAttribute ("name");
|
||||
|
||||
foreach (XmlNode def in ns.ChildNodes) {
|
||||
|
||||
if (def.NodeType != XmlNodeType.Element) {
|
||||
continue;
|
||||
}
|
||||
|
||||
XmlElement elem = (XmlElement) def;
|
||||
|
||||
switch (def.Name) {
|
||||
|
||||
case "alias":
|
||||
break;
|
||||
|
||||
case "callback":
|
||||
break;
|
||||
|
||||
case "enum":
|
||||
IGeneratable gen = new EnumGen (ns_name, elem);
|
||||
types [gen.CName] = gen;
|
||||
break;
|
||||
|
||||
case "object":
|
||||
break;
|
||||
|
||||
case "struct":
|
||||
break;
|
||||
|
||||
default:
|
||||
Console.WriteLine ("Unexpected node.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
2
generator/api.xml
Normal file
2
generator/api.xml
Normal file
File diff suppressed because one or more lines are too long
11
generator/makefile
Normal file
11
generator/makefile
Normal file
|
@ -0,0 +1,11 @@
|
|||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /out:codegen.exe /recurse:*.cs
|
||||
./codegen api.xml
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
// GLib.Signals.Simple.cs - GLib Simple Signal implementation
|
||||
//
|
||||
// Authors: Bob Smith <bob@thestuff.net>
|
||||
// Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Bob Smith & Mike Kestner
|
||||
|
||||
namespace GLib {
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using GLib;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleDelegate Delegate
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Used to connect to simple signals which contain no signal-
|
||||
/// specific data.
|
||||
/// </remarks>
|
||||
|
||||
public delegate void SimpleDelegate (IntPtr obj, int key);
|
||||
|
||||
/// <summary>
|
||||
/// SimpleSignal Class
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Wraps a simple signal which contains no single-specific data.
|
||||
/// </remarks>
|
||||
|
||||
public class SimpleSignal {
|
||||
|
||||
// A counter used to produce unique keys for instances.
|
||||
private static int _NextKey = 0;
|
||||
|
||||
// Hashtable containing refs to all current instances.
|
||||
private static Hashtable _Instances = new Hashtable ();
|
||||
|
||||
// locals to create and pin the shared delegate.
|
||||
private static SimpleDelegate _Delegate;
|
||||
private static GCHandle _GCHandle;
|
||||
|
||||
// Shared delegate that relays events to registered handlers.
|
||||
private static void SimpleCallback(IntPtr obj, int inst_key)
|
||||
{
|
||||
if (!_Instances.Contains (inst_key))
|
||||
throw new Exception ("Unexpected signal key");
|
||||
|
||||
SimpleSignal ss = (SimpleSignal) _Instances [inst_key];
|
||||
EventArgs args = new EventArgs ();
|
||||
ss._handler (ss._obj, args);
|
||||
}
|
||||
|
||||
// private instance members
|
||||
private GLib.Object _obj;
|
||||
private EventHandler _handler;
|
||||
private int _key;
|
||||
|
||||
/// <summary>
|
||||
/// SimpleSignal Constructor
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Registers a new event handler for a specified signal.
|
||||
/// A connection to the raw object signal is made which
|
||||
/// causes any events which occur to be relayed to the
|
||||
/// event handler.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport ("gobject-1.3.dll", CharSet=CharSet.Ansi,
|
||||
CallingConvention=CallingConvention.Cdecl)]
|
||||
static extern void g_signal_connect_data (
|
||||
IntPtr obj, IntPtr name,
|
||||
SimpleDelegate cb,
|
||||
int key, IntPtr p, int flags);
|
||||
|
||||
public SimpleSignal (GLib.Object obj, IntPtr raw,
|
||||
String name, EventHandler eh)
|
||||
{
|
||||
if (_Delegate == null) {
|
||||
_Delegate = new SimpleDelegate(SimpleCallback);
|
||||
|
||||
/* FIXME: need layout attribute for
|
||||
* SimpleCallback to avoid an exception.
|
||||
* _GCHandle = GCHandle.Alloc (
|
||||
* _Delegate, GCHandleType.Pinned);
|
||||
*/
|
||||
}
|
||||
|
||||
_key = _NextKey++;
|
||||
_obj = obj;
|
||||
_handler = eh;
|
||||
_Instances [_key] = this;
|
||||
|
||||
g_signal_connect_data (
|
||||
raw, Marshal.StringToHGlobalAnsi (name),
|
||||
_Delegate, _key, new IntPtr (0), 0);
|
||||
}
|
||||
|
||||
// Destructor needed to release references from the instance
|
||||
// table and unpin the delegate if no refs remain.
|
||||
~SimpleSignal ()
|
||||
{
|
||||
_Instances.Remove (_key);
|
||||
|
||||
if (_Instances.Count == 0) {
|
||||
// FIXME: when pin works _GCHandle.Free();
|
||||
_Delegate = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
314
gtk/Widget.cs
314
gtk/Widget.cs
|
@ -1,314 +0,0 @@
|
|||
// GTK.Widget.cs - GTK Widget class implementation
|
||||
//
|
||||
// Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
//
|
||||
// (c) 2001 Mike Kestner
|
||||
|
||||
namespace Gtk {
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using GLib;
|
||||
using Gdk;
|
||||
|
||||
|
||||
public class Widget : Object {
|
||||
|
||||
private Hashtable Signals = new Hashtable ();
|
||||
|
||||
// Properties
|
||||
|
||||
// FIXME: Implement Parent, Style, Event, & ExtensionEvents
|
||||
|
||||
/// <summary>
|
||||
/// AppPaintable Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// FIXME: What's this?
|
||||
/// </remarks>
|
||||
|
||||
public bool AppPaintable {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("app-paintable", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("app-paintable", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CanDefault Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Indicates if the Widget can be the default for focus.
|
||||
/// </remarks>
|
||||
|
||||
public bool CanDefault {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("can-default", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("can-default", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CanFocus Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Indicates if the Widget can obtain the input focus.
|
||||
/// </remarks>
|
||||
|
||||
public bool CanFocus {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("can-focus", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("can-focus", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// CompositeChild Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// FIXME: What's this?
|
||||
/// </remarks>
|
||||
|
||||
public bool CompositeChild {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("composite-child", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("composite-child", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HasDefault Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Indicates if the Widget is the default for focus.
|
||||
/// </remarks>
|
||||
|
||||
public bool HasDefault {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("has-default", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("has-default", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HasFocus Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Indicates if the Widget has the input focus.
|
||||
/// </remarks>
|
||||
|
||||
public bool HasFocus {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("has-focus", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("has-focus", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HeightRequest Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// The desired height in pixels for the widget.
|
||||
/// </remarks>
|
||||
|
||||
public int HeightRequest {
|
||||
get {
|
||||
int val;
|
||||
GetProperty ("height-request", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("height-request", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// The name of the widget.
|
||||
/// </remarks>
|
||||
|
||||
public String Name {
|
||||
get {
|
||||
String val;
|
||||
GetProperty ("name", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("name", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ReceivesDefault Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// FIXME: What does this do?
|
||||
/// </remarks>
|
||||
|
||||
public bool ReceivesDefault {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("receives-default", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("receives-default", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sensitive Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Indicates if the Widget is sensitive to input.
|
||||
/// </remarks>
|
||||
|
||||
public bool Sensitive {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("sensitive", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("sensitive", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SizeRequest Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// The desired size in pixels for the widget.
|
||||
/// </remarks>
|
||||
|
||||
public Size SizeRequest {
|
||||
get {
|
||||
return new Size (WidthRequest, HeightRequest);
|
||||
}
|
||||
set {
|
||||
WidthRequest = value.Width;
|
||||
HeightRequest = value.Height;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Visible Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Indicates if the Widget is visible.
|
||||
/// </remarks>
|
||||
|
||||
public bool Visible {
|
||||
get {
|
||||
bool val;
|
||||
GetProperty ("visible", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("visible", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// WidthRequest Property
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// The desired height in pixels for the widget.
|
||||
/// </remarks>
|
||||
|
||||
public int WidthRequest {
|
||||
get {
|
||||
int val;
|
||||
GetProperty ("width-request", out val);
|
||||
return val;
|
||||
}
|
||||
set {
|
||||
SetProperty ("width-request", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deleted Event
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Signal emitted when a widget is deleted by the
|
||||
/// windowing environment.
|
||||
/// </remarks>
|
||||
|
||||
private static readonly string DelEvName = "delete-event";
|
||||
|
||||
public event EventHandler Deleted {
|
||||
add {
|
||||
if (Events [DelEvName] == null)
|
||||
Signals [DelEvName] = new SimpleEvent (
|
||||
this, RawObject,
|
||||
DelEvName, value);
|
||||
|
||||
Events.AddHandler(DelEvName, value);
|
||||
}
|
||||
remove {
|
||||
Events.RemoveHandler(DelEvName, value);
|
||||
if (Events [DelEvName] == null)
|
||||
Signals.Remove (DelEvName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show Method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Makes the Widget visible on the display.
|
||||
/// </remarks>
|
||||
|
||||
[DllImport("gtk-1.3.dll")]
|
||||
static extern void gtk_widget_show (IntPtr obj);
|
||||
|
||||
public void Show ()
|
||||
{
|
||||
gtk_widget_show (RawObject);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,7 +3,7 @@ all:
|
|||
@echo "'make unix' is broken for now."
|
||||
|
||||
windows:
|
||||
$(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:../pango/pango-sharp.dll /r:../gdk/gdk-sharp.dll /out:gtk-sharp.dll /recurse:*.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
||||
|
|
2
makefile
2
makefile
|
@ -1,4 +1,4 @@
|
|||
DIRS=codegen glib gdk gtk sample
|
||||
DIRS=generator glib pango gdk gtk sample
|
||||
ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT)))
|
||||
CSC=$(ROOT)/microsoft.net/framework/v1.0.2914/csc.exe
|
||||
|
||||
|
|
3
pango/.cvsignore
Normal file
3
pango/.cvsignore
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.dll
|
||||
*.exe
|
||||
|
10
pango/makefile
Normal file
10
pango/makefile
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
all:
|
||||
@echo "You must use 'make windows' or 'make unix'."
|
||||
@echo "'make unix' is broken for now."
|
||||
|
||||
windows:
|
||||
$(CSC) /unsafe /target:library /r:../glib/glib-sharp.dll /out:pango-sharp.dll /recurse:*.cs
|
||||
|
||||
unix:
|
||||
@echo "'make unix' is broken for now."
|
1
parser/TODO
Normal file
1
parser/TODO
Normal file
|
@ -0,0 +1 @@
|
|||
Fix enum bug where symbolic values are used (eg Gdk.ModifierType.ModifierMask).
|
549
parser/gapi2xml.pl
Executable file
549
parser/gapi2xml.pl
Executable file
|
@ -0,0 +1,549 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# gapi2xml.pl : Generates an XML representation of GObject based APIs.
|
||||
#
|
||||
# Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
#
|
||||
# <c> 2001 Mike Kestner
|
||||
##############################################################
|
||||
|
||||
$debug=1;
|
||||
|
||||
use XML::LibXML;
|
||||
|
||||
if (!$ARGV[0]) {
|
||||
die "Usage: gapi_pp.pl <srcdir> | gapi2xml.pl <namespace> <outfile>\n";
|
||||
}
|
||||
|
||||
$ns = $ARGV[0];
|
||||
|
||||
##############################################################
|
||||
# If a filename was provided see if it exists. We parse existing files into
|
||||
# a tree and append the namespace to the root node. If the file doesn't
|
||||
# exist, we create a doc tree and root node to work with.
|
||||
##############################################################
|
||||
|
||||
if ($ARGV[1] && -e $ARGV[1]) {
|
||||
#parse existing file and get root node.
|
||||
$doc = XML::LibXML->new->parse_file($ARGV[1]);
|
||||
$root = $doc->getDocumentElement();
|
||||
} else {
|
||||
$doc = XML::LibXML::Document->new();
|
||||
$root = $doc->createElement('api');
|
||||
$doc->setDocumentElement($root);
|
||||
}
|
||||
|
||||
$ns_elem = $doc->createElement('namespace');
|
||||
$ns_elem->setAttribute('name', $ns);
|
||||
$root->appendChild($ns_elem);
|
||||
|
||||
##############################################################
|
||||
# First we parse the input for typedefs, structs, enums, and class_init funcs
|
||||
# and put them into temporary hashes.
|
||||
##############################################################
|
||||
|
||||
while ($line = <STDIN>) {
|
||||
if ($line =~ /typedef\s+(struct\s+\w+\s+)\*+(\w+);/) {
|
||||
$ptrs{$2} = $1;
|
||||
} elsif ($line =~ /typedef\s+(struct\s+\w+)\s+(\w+);/) {
|
||||
$types{$2} = $1;
|
||||
} elsif ($line =~ /typedef\s+(\w+\s+\**)(\w+);/) {
|
||||
$types{$2} = $1;
|
||||
} elsif ($line =~ /typedef\s+enum/) {
|
||||
$ename = $1;
|
||||
$edef = $line;
|
||||
while ($line = <STDIN>) {
|
||||
$edef .= $line;
|
||||
last if ($line =~ /^}\s*(\w+);/);
|
||||
}
|
||||
$edef =~ s/\n\s*//g;
|
||||
$edef =~ s|/\*.*?\*/||g;
|
||||
$edef =~ /}\s*(\w+);/;
|
||||
$ename = $1;
|
||||
$edefs{$ename} = $edef;
|
||||
} elsif ($line =~ /typedef\s+\w+\s*\**\s*\(\*(\w+)\)\s*\(/) {
|
||||
$fname = $1;
|
||||
$fdef = "";
|
||||
while ($line !~ /;/) {
|
||||
$fdef .= $line;
|
||||
$line = <STDIN>;
|
||||
}
|
||||
$fdef .= $line;
|
||||
$fdef =~ s/\n\s+//g;
|
||||
$fpdefs{$1} = $fdef;
|
||||
} elsif ($line =~ /struct\s+(\w+)/) {
|
||||
$sname = $1;
|
||||
$sdef = $line;
|
||||
while ($line = <STDIN>) {
|
||||
$sdef .= $line;
|
||||
last if ($line =~ /^}/);
|
||||
}
|
||||
$sdef =~ s/\n\s*//g;
|
||||
$sdef =~ s|/\*.*?\*/||g;
|
||||
$sdefs{$sname} = $sdef;
|
||||
} elsif ($line =~ /^(\w+)_class_init\b/) {
|
||||
$class = StudlyCaps($1);
|
||||
$pedef = $line;
|
||||
while ($line = <STDIN>) {
|
||||
$pedef .= $line;
|
||||
last if ($line =~ /^}/);
|
||||
}
|
||||
$pedefs{$class} = $pedef;
|
||||
} elsif ($line =~ /^(const|G_CONST_RETURN)?\s*\w+\s*\**\s*(\w+)\s*\(/) {
|
||||
$fname = $2;
|
||||
$fdef = "";
|
||||
while ($line !~ /;/) {
|
||||
$fdef .= $line;
|
||||
$line = <STDIN>;
|
||||
}
|
||||
$fdef .= $line;
|
||||
$fdefs{$fname} = $fdef;
|
||||
} elsif ($line =~ /G_TYPE_CHECK_(\w+)_CAST.*,\s*(\w+),\s*(\w+)/) {
|
||||
if ($1 eq "INSTANCE") {
|
||||
$objects{$2} = $3 . $objects{$2};
|
||||
} else {
|
||||
$objects{$2} .= ":$3";
|
||||
}
|
||||
} elsif ($line =~ /GTK_CHECK_CAST.*,\s*(\w+),\s*(\w+)/) {
|
||||
$objects{$1} = $2 . $objects{$1};
|
||||
} elsif ($line =~ /GTK_CHECK_CLASS_CAST.*,\s*(\w+),\s*(\w+)/) {
|
||||
$objects{$1} .= ":$2";
|
||||
} else {
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Produce the enum definitions.
|
||||
##############################################################
|
||||
|
||||
foreach $cname (sort(keys(%edefs))) {
|
||||
$ecnt++;
|
||||
$enum_elem = addNameElem($ns_elem, 'enum', $cname, $ns);
|
||||
$def = $edefs{$cname};
|
||||
if ($def =~ /=\s*1\s*<<\s*\d+/) {
|
||||
$enum_elem->setAttribute('type', "flags");
|
||||
} else {
|
||||
$enum_elem->setAttribute('type', "enum");
|
||||
}
|
||||
$def =~ /\{(.*)\}/;
|
||||
@vals = split(/,\s*/, $1);
|
||||
@v0 = split(/_/, $vals[0]);
|
||||
if (@vals > 1) {
|
||||
$done = 0;
|
||||
for ($idx = 0, $regex = ""; $idx < @v0; $idx++) {
|
||||
$regex .= ($v0[$idx] . "_");
|
||||
foreach $val (@vals) {
|
||||
$done = 1 if ($val !~ /$regex/);
|
||||
}
|
||||
last if $done;
|
||||
}
|
||||
$common = join("_", @v0[0..$idx-1]);
|
||||
} else {
|
||||
$common = join("_", @v0[0..$#v0-1]);
|
||||
}
|
||||
|
||||
foreach $val (@vals) {
|
||||
if ($val =~ /$common\_(\w+)\s*=\s*(\d+.*)/) {
|
||||
$name = $1;
|
||||
if ($2 =~ /1u?\s*<<\s*(\d+)/) {
|
||||
$enumval = "1 << $1";
|
||||
} else {
|
||||
$enumval = $2;
|
||||
}
|
||||
} elsif ($val =~ /$common\_(\w+)/) {
|
||||
$name = $1; $enumval = "";
|
||||
} else {
|
||||
die "Unexpected enum value: $val\n";
|
||||
}
|
||||
|
||||
$val_elem = addNameElem($enum_elem, 'member');
|
||||
$val_elem->setAttribute('cname', "$common\_$name");
|
||||
$val_elem->setAttribute('name', StudlyCaps(lc($name)));
|
||||
if ($enumval) {
|
||||
$val_elem->setAttribute('value', $enumval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Parse the callbacks.
|
||||
##############################################################
|
||||
|
||||
foreach $cbname (sort(keys(%fpdefs))) {
|
||||
$cbcnt++;
|
||||
$fdef = $cb = $fpdefs{$cbname};
|
||||
$cb_elem = addNameElem($ns_elem, 'callback', $cbname, $ns);
|
||||
$cb =~ /typedef\s+(.*)\(.*\).*\((.*)\);/;
|
||||
$ret = $1; $params = $2;
|
||||
addReturnElem($cb_elem, $ret);
|
||||
if ($params && ($params ne "void")) {
|
||||
addParamsElem($cb_elem, split(/,/, $params));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##############################################################
|
||||
# Parse the classes by walking the objects list.
|
||||
##############################################################
|
||||
|
||||
foreach $type (sort(keys(%objects))) {
|
||||
|
||||
($inst, $class) = split(/:/, $objects{$type});
|
||||
$class = $inst . "Class" if (!$class);
|
||||
$initfunc = $pedefs{$inst};
|
||||
$insttype = delete $types{$inst};
|
||||
$classtype = delete $types{$class};
|
||||
|
||||
$instdef = $classdef = "";
|
||||
$instdef = $sdefs{$1} if ($insttype =~ /struct\s+(\w+)/);
|
||||
$classdef = $sdefs{$1} if ($classtype =~ /struct\s+(\w+)/);
|
||||
$instdef =~ s/\s+(\*+)/\1 /g;
|
||||
warn "Strange Class $inst\n" if (!$instdef && $debug);
|
||||
|
||||
$classcnt++;
|
||||
$obj_el = addNameElem($ns_elem, 'object', $inst, $ns);
|
||||
|
||||
# Extract parent and fields from the struct
|
||||
if ($instdef =~ /^struct/) {
|
||||
$instdef =~ /\{(.*)\}/;
|
||||
@fields = split(/;/, $1);
|
||||
$fields[0] =~ /(\w+)/;
|
||||
$obj_el->setAttribute('parent', "$1");
|
||||
addFieldElems($obj_el, @fields[1..$#fields]);
|
||||
} elsif ($instdef =~ /privatestruct/) {
|
||||
# just get the parent for private structs
|
||||
$instdef =~ /\{\s*(\w+)/;
|
||||
$obj_el->setAttribute('parent', "$1");
|
||||
}
|
||||
|
||||
# Get the props from the class_init func.
|
||||
if ($initfunc) {
|
||||
parseInitFunc($obj_el, $initfunc);
|
||||
} else {
|
||||
warn "Don't have an init func for $inst.\n" if $debug;
|
||||
}
|
||||
|
||||
addFuncElems($obj_el, $inst);
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Parse the remaining types.
|
||||
##############################################################
|
||||
|
||||
foreach $key (sort (keys (%types))) {
|
||||
|
||||
$lasttype = $type = $key;
|
||||
while ($type && ($types{$type} !~ /struct/)) {
|
||||
$lasttype = $type;
|
||||
$type = $types{$type};
|
||||
}
|
||||
|
||||
if ($types{$type} =~ /struct\s+(\w+)/) {
|
||||
$type = $1;
|
||||
} else {
|
||||
$elem = addNameElem($ns_elem, 'alias', $key, $ns);
|
||||
$elem->setAttribute('type', $lasttype);
|
||||
warn "alias $key to $lasttype\n" if $debug;
|
||||
next;
|
||||
}
|
||||
|
||||
if (exists($sdefs{$type})) {
|
||||
$def = $sdefs{$type};
|
||||
} else {
|
||||
warn "Couldn't find $type\n" if $debug;
|
||||
next;
|
||||
}
|
||||
|
||||
$struct_el = addNameElem($ns_elem, 'struct', $key, $ns);
|
||||
$def =~ s/\s+/ /g;
|
||||
$def =~ /\{(.+)\}/;
|
||||
addFieldElems($struct_el, split(/;/, $1));
|
||||
addFuncElems($struct_el, $key);
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Output the tree
|
||||
##############################################################
|
||||
|
||||
if ($ARGV[1]) {
|
||||
open(XMLFILE, ">$ARGV[1]") ||
|
||||
die "Couldn't open $ARGV[1] for writing.\n";
|
||||
print XMLFILE $doc->toString();
|
||||
close(XMLFILE);
|
||||
} else {
|
||||
print $doc->toString();
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Generate a few stats from the parsed source.
|
||||
##############################################################
|
||||
|
||||
$scnt = keys(%sdefs); $fcnt = keys(%fdefs); $tcnt = keys(%types);
|
||||
print "structs: $scnt enums: $ecnt callbacks: $cbcnt\n";
|
||||
print "funcs: $fcnt types: $tcnt classes: $classcnt\n";
|
||||
print "props: $propcnt signals: $sigcnt\n";
|
||||
|
||||
sub addFieldElems
|
||||
{
|
||||
my ($parent, @fields) = @_;
|
||||
|
||||
foreach $field (@fields) {
|
||||
next if ($field !~ /\S/);
|
||||
$field =~ s/\s+(\*+)/\1 /g;
|
||||
$field =~ s/const /const\-/g;
|
||||
if ($field =~ /(\S+\s+\*?)\(\*\s*(.+)\)\s*\((.*)\)/) {
|
||||
$elem = addNameElem($parent, 'callback', $2);
|
||||
addReturnElem($elem, $1);
|
||||
addParamsElem($elem, $3);
|
||||
} elsif ($field =~ /(\S+)\s+(.+)/) {
|
||||
$type = $1; $symb = $2;
|
||||
foreach $tok (split (/,\s*/, $symb)) {
|
||||
if ($tok =~ /(\w+)\s*\[(.*)\]/) {
|
||||
$elem = addNameElem($parent, 'field', $1);
|
||||
$elem->setAttribute('array_len', "$2");
|
||||
$elem->setAttribute('type', "$type");
|
||||
} else {
|
||||
$elem = addNameElem($parent, 'field', $symb);
|
||||
$elem->setAttribute('type', "$type");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
die "$field\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub addFuncElems
|
||||
{
|
||||
my ($obj_el, $inst) = @_;
|
||||
|
||||
my $prefix = $inst;
|
||||
$prefix =~ s/([A-Z]+)/_\1/g;
|
||||
$prefix = lc($prefix);
|
||||
$prefix =~ s/^_//;
|
||||
$prefix .= "_";
|
||||
|
||||
$fcnt = keys(%fdefs);
|
||||
|
||||
foreach $mname (keys(%fdefs)) {
|
||||
next if ($mname !~ /$prefix/);
|
||||
|
||||
if ($fdefs{$mname} =~ /\(\s*$inst\b/) {
|
||||
$el = addNameElem($obj_el, 'method', $mname, $prefix);
|
||||
$fdefs{$mname} =~ /(.*?)\w+\s*\(/;
|
||||
addReturnElem($el, $1);
|
||||
$drop_1st = 1;
|
||||
} elsif ($mname =~ /$prefix(new)/) {
|
||||
$el = addNameElem($obj_el, 'constructor', $mname);
|
||||
$drop_1st = 0;
|
||||
} else {
|
||||
next;
|
||||
}
|
||||
|
||||
$mdef = delete $fdefs{$mname};
|
||||
|
||||
if (($mdef =~ /\(.*\)/) && ($1 ne "void")) {
|
||||
@parms = split(/,/, $1);
|
||||
($dump, @parms) = @params if $dump_1st;
|
||||
if (@parms > 0) {
|
||||
addParamsElem($el, @parms);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
sub addNameElem
|
||||
{
|
||||
my ($node, $type, $cname, $prefix) = @_;
|
||||
|
||||
my $elem = $doc->createElement($type);
|
||||
$node->appendChild($elem);
|
||||
if ($prefix) {
|
||||
$cname =~ /$prefix(\w+)/;
|
||||
$elem->setAttribute('name', $1);
|
||||
}
|
||||
if ($cname) {
|
||||
$elem->setAttribute('cname', $cname);
|
||||
}
|
||||
return $elem;
|
||||
}
|
||||
|
||||
sub addParamsElem
|
||||
{
|
||||
my ($parent, @params) = @_;
|
||||
|
||||
my $parms_elem = $doc->createElement('parameters');
|
||||
$parent->appendChild($parms_elem);
|
||||
foreach $parm (@params) {
|
||||
$parm_elem = $doc->createElement('parameter');
|
||||
$parms_elem->appendChild($parm_elem);
|
||||
$parm =~ s/\s+\*/\* /g;
|
||||
$parm =~ s/const\s+/const-/g;
|
||||
$parm =~ /(\S+)\s+(\S+)/;
|
||||
$parm_elem->setAttribute('type', "$1");
|
||||
$parm_elem->setAttribute('name', "$2");
|
||||
}
|
||||
}
|
||||
|
||||
sub addReturnElem
|
||||
{
|
||||
my ($parent, $ret) = @_;
|
||||
|
||||
$ret =~ s/const|G_CONST_RETURN/const-/g;
|
||||
$ret =~ s/\s+//g;
|
||||
my $ret_elem = $doc->createElement('return-type');
|
||||
$parent->appendChild($ret_elem);
|
||||
$ret_elem->setAttribute('type', $ret);
|
||||
return $ret_elem;
|
||||
}
|
||||
|
||||
sub addPropElem
|
||||
{
|
||||
my ($spec, $node) = @_;
|
||||
my ($name, $mode, $docs);
|
||||
$spec =~ /g_param_spec_(\w+)\s*\((.*)/;
|
||||
my $type = $1;
|
||||
my $params = $2;
|
||||
|
||||
if ($type =~ /boolean|^u*int|pointer/) {
|
||||
$params =~ /\"(.+)\",.+\".+\".+\"(.+)\".*(,\s*G_PARAM_\w+.*)\)\s*\)/;
|
||||
$name = $1; $docs = $2; $mode = $3;
|
||||
$type = "g$type";
|
||||
} elsif ($type =~ /string/) {
|
||||
$params =~ /\"(.+)\",.+\".+\".+\"(.+)\".*(,\s*G_PARAM_\w+.*)\)\s*\)/;
|
||||
$name = $1; $docs = $2; $mode = $3;
|
||||
$type = "gchar*";
|
||||
} elsif ($type =~ /enum|flags/) {
|
||||
$params =~ /\"(.+)\",.+,.+\"(.+)\".*,\s+(\w+),.*,(\s*G_PARAM_\w+.*)\)\s*\)/;
|
||||
$name = $1; $docs = $2; $type = $3; $mode = $4;
|
||||
$type =~ s/TYPE_//;
|
||||
$type = StudlyCaps(lc($type));
|
||||
} elsif ($type =~ /object/) {
|
||||
$params =~ /\"(.+)\",.+,.+\"(.+)\".*,\s+(\w+),(\s*G_PARAM_\w+.*)\)\s*\)/;
|
||||
$name = $1; $docs = $2; $type = $3; $mode = $4;
|
||||
$type =~ s/TYPE_//;
|
||||
$type = StudlyCaps(lc($type));
|
||||
}
|
||||
|
||||
|
||||
$prop_elem = $doc->createElement('property');
|
||||
$node->appendChild($prop_elem);
|
||||
$prop_elem->setAttribute('name', $name);
|
||||
$prop_elem->setAttribute('type', $type);
|
||||
$prop_elem->setAttribute('doc-string', $docs);
|
||||
|
||||
if ($mode =~ /READ/) {
|
||||
$prop_elem->setAttribute('readable', "true");
|
||||
}
|
||||
if ($mode =~ /WRIT/) {
|
||||
$prop_elem->setAttribute('writeable', "true");
|
||||
}
|
||||
if ($mode =~ /CONS/) {
|
||||
$prop_elem->setAttribute('construct-only', "true");
|
||||
}
|
||||
}
|
||||
|
||||
sub addSignalElem
|
||||
{
|
||||
my ($spec, $class, $node) = @_;
|
||||
$spec =~ s/\n\s*//g; $class =~ s/\n\s*//g;
|
||||
|
||||
$sig_elem = $doc->createElement('signal');
|
||||
$node->appendChild($sig_elem);
|
||||
|
||||
$sig_elem->setAttribute('name', $1) if ($spec =~ /\(\"(\w+)\"/);
|
||||
$sig_elem->setAttribute('when', $1) if ($spec =~ /_RUN_(\w+)/);
|
||||
|
||||
my $method = "";
|
||||
if ($spec =~ /_OFFSET\s*\(\w+,\s*(\w+)\)/) {
|
||||
$method = $1;
|
||||
} else {
|
||||
@args = split(/,/, $spec);
|
||||
$args[7] =~ s/_TYPE//; $args[7] =~ s/\s+//g;
|
||||
addReturnElem($sig_elem, StudlyCaps(lc($args[7])));
|
||||
$parmcnt = ($args[8] =~ /\d+/);
|
||||
if ($parmcnt > 0) {
|
||||
$parms_elem = $doc->createElement('parameters');
|
||||
$sig_elem->appendChild($parms_elem);
|
||||
for (my $idx = 0; $idx < $parmcnt; $idx++) {
|
||||
$arg = $args[9+$idx];
|
||||
$arg =~ s/_TYPE//; $arg =~ s/\s+//g;
|
||||
$arg = StudlyCaps(lc($arg));
|
||||
$parm_elem = $doc->createElement('parameter');
|
||||
$parms_elem->appendChild($parm_elem);
|
||||
$parm_elem->setAttribute('name', "p$idx");
|
||||
$parm_elem->setAttribute('type', $arg);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ($class =~ /;\s*(\S+\s*\**)\s*\(\*\s*$method\)\s*\((.*)\);/) {
|
||||
$ret = $1; $parms = $2;
|
||||
addReturnElem($sig_elem, $ret);
|
||||
if ($parms && ($parms ne "void")) {
|
||||
addParamsElem($sig_elem, split(/,/, $parms));
|
||||
}
|
||||
} else {
|
||||
die "$method $class";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub parseInitFunc
|
||||
{
|
||||
my ($obj_el, $initfunc) = @_;
|
||||
|
||||
my @init_lines = split (/\n/, $initfunc);
|
||||
|
||||
my $linenum = 0;
|
||||
while ($linenum < @init_lines) {
|
||||
|
||||
my $line = $init_lines[$linenum];
|
||||
|
||||
while ($linenum < @init_lines) {
|
||||
$line = $init_lines[$linenum];
|
||||
if ($line =~ /g_object_class_install_prop/) {
|
||||
my $prop = $line;
|
||||
do {
|
||||
$prop .= $init_lines[++$linenum];
|
||||
} until ($init_lines[$linenum] =~ /;/);
|
||||
addPropElem ($prop, $obj_el);
|
||||
$propcnt++;
|
||||
} elsif ($line =~ /g(tk)?_signal_new/) {
|
||||
my $sig = $line;
|
||||
do {
|
||||
$sig .= $init_lines[++$linenum];
|
||||
} until ($init_lines[$linenum] =~ /;/);
|
||||
addSignalElem ($sig, $classdef, $obj_el);
|
||||
$sigcnt++;
|
||||
}
|
||||
$linenum++;
|
||||
}
|
||||
|
||||
$linenum++;
|
||||
}
|
||||
}
|
||||
|
||||
##############################################################
|
||||
# Converts a dash or underscore separated name to StudlyCaps.
|
||||
##############################################################
|
||||
|
||||
%num2txt = ('1', "One", '2', "Two", '3', "Three", '4', "Four", '5', "Five",
|
||||
'6', "Six", '7', "Seven", '8', "Eight", '9', "Nine", '0', "Zero");
|
||||
|
||||
sub StudlyCaps
|
||||
{
|
||||
my ($symb) = @_;
|
||||
$symb =~ s/^([a-z])/\u\1/;
|
||||
$symb =~ s/^(\d)/\1_/;
|
||||
$symb =~ s/[-_]([a-z])/\u\1/g;
|
||||
$symb =~ s/[-_](\d)/\1/g;
|
||||
$symb =~ s/^2/Two/;
|
||||
$symb =~ s/^3/Three/;
|
||||
return $symb;
|
||||
}
|
||||
|
70
parser/gapi_pp.pl
Executable file
70
parser/gapi_pp.pl
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# gapi_pp.pl : A source preprocessor for the extraction of API info from a
|
||||
# C library source directory.
|
||||
#
|
||||
# Author: Mike Kestner <mkestner@speakeasy.net>
|
||||
#
|
||||
# <c> 2001 Mike Kestner
|
||||
|
||||
$eatit_regex = "^#if.*(__cplusplus|DEBUG|DISABLE_(DEPRECATED|COMPAT)|ENABLE_BROKEN|COMPILATION)";
|
||||
$ignoreit_regex = '^\s+\*|#\s*include|#\s*else|#\s*endif|#\s*undef|G_(BEGIN|END)_DECLS|extern|GDKVAR|GTKVAR|GTKMAIN_C_VAR|GTKTYPEUTILS_VAR|VARIABLE';
|
||||
|
||||
foreach $dir (@ARGV) {
|
||||
@hdrs = (@hdrs, `ls $dir/*.h`);
|
||||
}
|
||||
|
||||
foreach $fname (@hdrs) {
|
||||
next if ($fname =~ /test|private|internals|gtktextlayout/);
|
||||
|
||||
open(INFILE, $fname) || die "Could open $fname\n";
|
||||
|
||||
while ($line = <INFILE>) {
|
||||
|
||||
next if ($line =~ /$ignoreit_regex/);
|
||||
next if ($line !~ /\S/);
|
||||
|
||||
if ($line =~ /#\s*define\s+\w+\s*\D+/) {
|
||||
$def = $line;
|
||||
while ($line =~ /\\\n/) {$def .= ($line = <INFILE>);}
|
||||
if ($def =~ /_CHECK_\w*CAST/) {
|
||||
$def =~ s/\\\n//g;
|
||||
print $def;
|
||||
}
|
||||
} elsif ($line =~ /^\s*\/\*/) {
|
||||
while ($line !~ /\*\//) {$line = <INFILE>;}
|
||||
} elsif ($line =~ /^#ifndef\s+\w+_H_*\b/) {
|
||||
while ($line !~ /#define/) {$line = <INFILE>;}
|
||||
} elsif ($line =~ /$eatit_regex/) {
|
||||
while ($line !~ /#else|#endif/) {$line = <INFILE>;}
|
||||
} elsif ($line =~ /^#\s*ifn?\s*\!?def/) {
|
||||
#warn "Ignored #if:\n$line";
|
||||
} elsif ($line =~ /typedef\s+struct\s+\w*\s*\{/) {
|
||||
while ($line !~ /^}\s*\w+;/) {$line = <INFILE>;}
|
||||
} elsif ($line =~ /^enum\s+\{/) {
|
||||
while ($line !~ /^};/) {$line = <INFILE>;}
|
||||
} else {
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach $fname (`ls $ARGV[0]/*.c`) {
|
||||
|
||||
open(INFILE, $fname) || die "Could open $fname\n";
|
||||
|
||||
while ($line = <INFILE>) {
|
||||
next if ($line !~ /^(struct|\w+_class_init)/);
|
||||
|
||||
if ($line =~ /^struct/) {
|
||||
# need some of these to parse out parent types
|
||||
print "private";
|
||||
}
|
||||
|
||||
do {
|
||||
print $line;
|
||||
} until (($line = <INFILE>) =~ /^}/);
|
||||
print $line;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue