2001-12-11 Mike Kestner <mkestner@speakeasy.net>

* codegen/get-structs-from-source.pl : New define-struct extractor.
	* codegen/gdk-structs.defs : generated defs with a few hand edits.

svn path=/trunk/gtk-sharp/; revision=1559
This commit is contained in:
Mike Kestner 2001-12-12 00:08:19 +00:00
parent 8f1d4d3412
commit 7052eadbaf
3 changed files with 617 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2001-12-11 Mike Kestner <mkestner@speakeasy.net>
* codegen/get-structs-from-source.pl : New define-struct extractor.
* codegen/gdk-structs.defs : generated defs with a few hand edits.
2001-12-04 Mike Kestner <mkestner@speakeasy.net>
* codegen/defs-parse.pl : Index %structs by cname, not name. Derive

567
codegen/gdk-structs.defs Normal file
View File

@ -0,0 +1,567 @@
(define-struct ArgContext
(in-module "Gdk")
(c-name "GdkArgContext")
(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")
)
)
(define-struct Bitmap
(in-module "Gdk")
(c-name "GdkBitmap")
(fields
'("GObject" "parent_instance")
)
)
(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")
(fields
'("guint32" "pixel")
'("guint16" "red")
'("guint16" "green")
'("guint16" "blue")
)
)
(define-struct ColorInfo
(in-module "Gdk")
(c-name "GdkColorInfo")
(fields
'("GdkColorInfoFlags" "flags")
'("guint" "ref_count")
)
)
(define-struct Cursor
(in-module "Gdk")
(c-name "GdkCursor")
(fields
'("GdkCursorType" "type")
'("guint" "ref_count")
)
)
(define-struct DeviceAxis
(in-module "Gdk")
(c-name "GdkDeviceAxis")
(fields
'("GdkAxisUse" "use")
'("gdouble" "min")
'("gdouble" "max")
)
)
(define-struct DeviceKey
(in-module "Gdk")
(c-name "GdkDeviceKey")
(fields
'("guint" "keyval")
'("GdkModifierType" "modifiers")
)
)
(define-struct EventAny
(in-module "Gdk")
(c-name "GdkEventAny")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
)
)
(define-struct EventButton
(in-module "Gdk")
(c-name "GdkEventButton")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("guint32" "time")
'("gdouble" "x")
'("gdouble" "y")
'("gdouble*" "axes")
'("guint" "state")
'("guint" "button")
'("GdkDevice*" "device")
'("gdouble" "x_root")
'("gdouble" "y_root")
)
)
(define-struct EventClient
(in-module "Gdk")
(c-name "GdkEventClient")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkAtom" "message_type")
'("gushort" "data_format")
'("char" "data_b[20]")
)
)
(define-struct EventConfigure
(in-module "Gdk")
(c-name "GdkEventConfigure")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("gint" "x")
'("gint" "y")
'("gint" "width")
'("gint" "height")
)
)
(define-struct EventCrossing
(in-module "Gdk")
(c-name "GdkEventCrossing")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkWindow*" "subwindow")
'("guint32" "time")
'("gdouble" "x")
'("gdouble" "y")
'("gdouble" "x_root")
'("gdouble" "y_root")
'("GdkCrossingMode" "mode")
'("GdkNotifyType" "detail")
'("gboolean" "focus")
'("guint" "state")
)
)
(define-struct EventDND
(in-module "Gdk")
(c-name "GdkEventDND")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkDragContext*" "context")
'("guint32" "time")
'("gshort" "x_root")
'("gshort" "y_root")
)
)
(define-struct EventExpose
(in-module "Gdk")
(c-name "GdkEventExpose")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkRectangle" "area")
'("GdkRegion*" "region")
'("gint" "count")
)
)
(define-struct EventFilter
(in-module "Gdk")
(c-name "GdkEventFilter")
(fields
'("GdkFilterFunc" "function")
'("gpointer" "data")
)
)
(define-struct EventFocus
(in-module "Gdk")
(c-name "GdkEventFocus")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("gint16" "in")
)
)
(define-struct EventKey
(in-module "Gdk")
(c-name "GdkEventKey")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("guint32" "time")
'("guint" "state")
'("guint" "keyval")
'("gint" "length")
'("gchar*" "string")
'("guint16" "hardware_keycode")
'("guint8" "group")
)
)
(define-struct EventMotion
(in-module "Gdk")
(c-name "GdkEventMotion")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("guint32" "time")
'("gdouble" "x")
'("gdouble" "y")
'("gdouble*" "axes")
'("guint" "state")
'("gint16" "is_hint")
'("GdkDevice*" "device")
'("gdouble" "x_root")
'("gdouble" "y_root")
)
)
(define-struct EventNoExpose
(in-module "Gdk")
(c-name "GdkEventNoExpose")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
)
)
(define-struct EventProperty
(in-module "Gdk")
(c-name "GdkEventProperty")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkAtom" "atom")
'("guint32" "time")
'("guint" "state")
)
)
(define-struct EventProximity
(in-module "Gdk")
(c-name "GdkEventProximity")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("guint32" "time")
'("GdkDevice*" "device")
)
)
(define-struct EventScroll
(in-module "Gdk")
(c-name "GdkEventScroll")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("guint32" "time")
'("gdouble" "x")
'("gdouble" "y")
'("guint" "state")
'("GdkScrollDirection" "direction")
'("GdkDevice*" "device")
'("gdouble" "x_root")
'("gdouble" "y_root")
)
)
(define-struct EventSelection
(in-module "Gdk")
(c-name "GdkEventSelection")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkAtom" "selection")
'("GdkAtom" "target")
'("GdkAtom" "property")
'("guint32" "time")
'("GdkNativeWindow" "requestor")
)
)
(define-struct EventSetting
(in-module "Gdk")
(c-name "GdkEventSetting")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkSettingAction" "action")
'("char*" "name")
)
)
(define-struct EventVisibility
(in-module "Gdk")
(c-name "GdkEventVisibility")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkVisibilityState" "state")
)
)
(define-struct EventWindowState
(in-module "Gdk")
(c-name "GdkEventWindowState")
(fields
'("GdkEventType" "type")
'("GdkWindow*" "window")
'("gint8" "send_event")
'("GdkWindowState" "changed_mask")
'("GdkWindowState" "new_window_state")
)
)
(define-struct Font
(in-module "Gdk")
(c-name "GdkFont")
(fields
'("GdkFontType" "type")
'("gint" "ascent")
'("gint" "descent")
)
)
(define-struct FontPrivate
(in-module "Gdk")
(c-name "GdkFontPrivate")
(fields
'("GdkFont" "font")
'("guint" "ref_count")
)
)
(define-struct GCValues
(in-module "Gdk")
(c-name "GdkGCValues")
(fields
'("GdkColor" "foreground")
'("GdkColor" "background")
'("GdkFont*" "font")
'("GdkFunction" "function")
'("GdkFill" "fill")
'("GdkPixmap*" "tile")
'("GdkPixmap*" "stipple")
'("GdkPixmap*" "clip_mask")
'("GdkSubwindowMode" "subwindow_mode")
'("gint" "ts_x_origin")
'("gint" "ts_y_origin")
'("gint" "clip_x_origin")
'("gint" "clip_y_origin")
'("gint" "graphics_exposures")
'("gint" "line_width")
'("GdkLineStyle" "line_style")
'("GdkCapStyle" "cap_style")
'("GdkJoinStyle" "join_style")
)
)
(define-struct Geometry
(in-module "Gdk")
(c-name "GdkGeometry")
(fields
'("gint" "min_width")
'("gint" "min_height")
'("gint" "max_width")
'("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 KeymapKey
(in-module "Gdk")
(c-name "GdkKeymapKey")
(fields
'("guint" "keycode")
'("gint" "group")
'("gint" "level")
)
)
(define-struct PangoAttrEmbossed
(in-module "Gdk")
(c-name "GdkPangoAttrEmbossed")
(fields
'("PangoAttribute" "attr")
'("gboolean" "embossed")
)
)
(define-struct PangoAttrStipple
(in-module "Gdk")
(c-name "GdkPangoAttrStipple")
(fields
'("PangoAttribute" "attr")
'("GdkBitmap*" "stipple")
)
)
(define-struct Pixmap
(in-module "Gdk")
(c-name "GdkPixmap")
(fields
'("GObject" "parent_instance")
)
)
(define-struct Point
(in-module "Gdk")
(c-name "GdkPoint")
(fields
'("gint" "x")
'("gint" "y")
)
)
#(define-struct PointerHooks
# (in-module "Gdk")
# (c-name "GdkPointerHooks")
# (fields
# '("GdkWindow*" "(*get_pointer) (GdkWindow* window")
# '("GdkWindow*" "gint *x")
# '("GdkWindow*" "gint *y")
# '("GdkWindow*" "GdkModifierType *mask)")
# '("GdkWindow*" "(*window_at_pointer) (GdkScreen* screen")
# '("GdkWindow*" "gint *win_x")
# '("GdkWindow*" "gint *win_y)")
# )
#)
(define-struct Rectangle
(in-module "Gdk")
(c-name "GdkRectangle")
(fields
'("gint" "x")
'("gint" "y")
'("gint" "width")
'("gint" "height")
)
)
(define-struct Region
(in-module "Gdk")
(c-name "GdkRegion")
(fields
'("long" "size")
'("long" "numRects")
'("GdkRegionBox*" "rects")
'("GdkRegionBox" "extents")
)
)
(define-struct RgbCmap
(in-module "Gdk")
(c-name "GdkRgbCmap")
(fields
'("guint32" "colors[256]")
'("gint" "n_colors")
'("GSList*" "info_list")
)
)
(define-struct Screen
(in-module "Gdk")
(c-name "GdkScreen")
(fields
)
)
(define-struct Segment
(in-module "Gdk")
(c-name "GdkSegment")
(fields
'("gint" "x1")
'("gint" "y1")
'("gint" "x2")
'("gint" "y2")
)
)
(define-struct Span
(in-module "Gdk")
(c-name "GdkSpan")
(fields
'("gint" "x")
'("gint" "y")
'("gint" "width")
)
)
(define-struct TimeCoord
(in-module "Gdk")
(c-name "GdkTimeCoord")
(fields
'("guint32" "time")
'("gdouble" "axes[128]")
)
)
(define-struct Window
(in-module "Gdk")
(c-name "GdkWindow")
(fields
'("GObject" "parent_instance")
)
)
(define-struct WindowAttr
(in-module "Gdk")
(c-name "GdkWindowAttr")
(fields
'("gchar*" "title")
'("gint" "event_mask")
'("gint" "x")
'("gint" "y")
'("gint" "width")
'("gint" "height")
'("GdkWindowClass" "wclass")
'("GdkVisual*" "visual")
'("GdkColormap*" "colormap")
'("GdkWindowType" "window_type")
'("GdkCursor*" "cursor")
'("gchar*" "wmclass_name")
'("gchar*" "wmclass_class")
'("gboolean" "override_redirect")
)
)

View File

@ -0,0 +1,45 @@
#!/usr/bin/perl
#
# get-structs-from-source.pl : Extracts define-struct expressions
#
# Author: Mike Kestner (mkestner@speakeasy.net)
#
# <c> 2001 Mike Kestner
while ($line = <STDIN>) {
if ($line =~ /typedef\s+struct\s+(\w+)\s+(\w+);/) {
$types{$2} = $1;
} elsif ($line =~ /^struct\s+(\w+)/) {
$sname = $1;
$sdef = $line;
while ($line = <STDIN>) {
$sdef .= $line;
last if ($line =~ /^}/);
}
$sdefs{$sname} = $sdef;
}
}
foreach $key (sort (keys (%types))) {
next if (($key =~ /Class$/) || exists($types{$key."Class"}));
$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}} =~ /\{(.+)\}/;
foreach $mem (split (/;/, $1)) {
$mem =~ s?/\*.*\*/??;
$mem =~ s/\s+(\*+)/\1 /;
$mem =~ s/const /const\-/;
if ($mem =~ /(\S+)\s+(.+)/) {
$type = $1; $symb = $2;
foreach $tok (split (/,\s*/, $symb)) {
print " '(\"$type\" \"$tok\")\n";
}
}
}
print " )\n)\n\n";
}