[Gtk-sharp-list] enums not generated for gnomeprintui

Martin Willemoes Hansen mwh@sysrq.dk
Wed, 01 Oct 2003 22:16:05 +0200


--=-1CUEaI9ukz+3URg0+IuH
Content-Type: multipart/alternative; boundary="=-R60ycC8AjiejIHvfwsGZ"


--=-R60ycC8AjiejIHvfwsGZ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sun, 2003-09-28 at 02:12, Mike Kestner wrote:

> On Thu, 2003-09-25 at 13:12 +0200, Martin Willemoes Hansen wrote:
> 
> > I noticed that they are on the form enum foobar { ... }; but
> > if I change them to have the form typedef enum { ... } foobar; 
> > they will be parsed correctly.
> 
> The parser regexes can easily be changed to handle this. You can either
> file the bug or take a look at the enum regex in gapi2xml.pl if you want
> to try to fix it yourself.


I made a patch, using regexes to catch this enum style.

Okay to commit?

-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh@sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------               


--=-R60ycC8AjiejIHvfwsGZ
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.0.9">
</HEAD>
<BODY>
On Sun, 2003-09-28 at 02:12, Mike Kestner wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE><FONT COLOR="#737373"><I>On Thu, 2003-09-25 at 13:12 +0200, Martin Willemoes Hansen wrote:

&gt; I noticed that they are on the form enum foobar { ... }; but
&gt; if I change them to have the form typedef enum { ... } foobar; 
&gt; they will be parsed correctly.

The parser regexes can easily be changed to handle this. You can either
file the bug or take a look at the enum regex in gapi2xml.pl if you want
to try to fix it yourself.</I></FONT></PRE>
</BLOCKQUOTE>
<BR>
I made a patch, using regexes to catch this enum style.<BR>
<BR>
Okay to commit?
<PRE><TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>-- 
Martin Willemoes Hansen

--------------------------------------------------------
E-Mail	mwh@sysrq.dk	Website	mwh.sysrq.dk
IRC     MWH, freenode.net
--------------------------------------------------------               
</PRE>
</TD>
</TR>
</TABLE>
</PRE>
</BODY>
</HTML>

--=-R60ycC8AjiejIHvfwsGZ--

--=-1CUEaI9ukz+3URg0+IuH
Content-Disposition: attachment; filename=ByPassingOfEnumStyle.diff
Content-Type: text/x-patch; name=ByPassingOfEnumStyle.diff; charset=iso-8859-1
Content-Transfer-Encoding: 7bit

? ByPassingOfEnumStyle.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/public/gtk-sharp/ChangeLog,v
retrieving revision 1.477
diff -u -r1.477 ChangeLog
--- ChangeLog	29 Sep 2003 11:05:28 -0000	1.477
+++ ChangeLog	1 Oct 2003 20:27:34 -0000
@@ -1,3 +1,10 @@
+2003-10-01  Martin Willemoes Hansen  <mwh@sysrq.dk>
+
+	* parser/gapi2xml.pl: Fixed bypassing of this kind of enum style:
+	  enum Foobar { ... };
+	* api/gnome-api.xml: Added enums of the above style, also corrects the library
+	  used by gnomeprint.
+
 2003-09-29  Martin Willemoes Hansen  <mwh@sysrq.dk>
 
 	* sources/Gnome.metadata: Use const-gchar* instead of const-guchar*, 
Index: api/gnome-api.xml
===================================================================
RCS file: /cvs/public/gtk-sharp/api/gnome-api.xml,v
retrieving revision 1.15
diff -u -r1.15 gnome-api.xml
--- api/gnome-api.xml	29 Sep 2003 11:05:30 -0000	1.15
+++ api/gnome-api.xml	1 Oct 2003 20:27:37 -0000
@@ -6259,6 +6259,26 @@
     </class>
   </namespace>
   <namespace name="Gnome" library="gnomeprintui-2-2">
+    <enum name="PaperSelectorFlags" cname="GnomePaperSelectorFlags" type="enum">
+      <member cname="GNOME_PAPER_SELECTOR_MARGINS" name="Margins"/>
+      <member cname="GNOME_PAPER_SELECTOR_FEED_ORIENTATION" name="FeedOrientation"/>
+    </enum>
+    <enum name="PrintButtons" cname="GnomePrintButtons" type="enum">
+      <member cname="GNOME_PRINT_DIALOG_RESPONSE_PRINT" name="Print" value="1"/>
+      <member cname="GNOME_PRINT_DIALOG_RESPONSE_PREVIEW" name="Preview"/>
+      <member cname="GNOME_PRINT_DIALOG_RESPONSE_CANCEL" name="Cancel"/>
+    </enum>
+    <enum name="PrintDialogFlags" cname="GnomePrintDialogFlags" type="enum">
+      <member cname="GNOME_PRINT_DIALOG_RANGE" name="Range"/>
+      <member cname="GNOME_PRINT_DIALOG_COPIES" name="Copies"/>
+    </enum>
+    <enum name="PrintDialogRangeFlags" cname="GnomePrintDialogRangeFlags" type="enum">
+      <member cname="GNOME_PRINT_RANGE_CURRENT" name="Current"/>
+      <member cname="GNOME_PRINT_RANGE_ALL" name="All"/>
+      <member cname="GNOME_PRINT_RANGE_RANGE" name="Range"/>
+      <member cname="GNOME_PRINT_RANGE_SELECTION" name="Selection"/>
+      <member cname="GNOME_PRINT_RANGE_SELECTION_UNSENSITIVE" name="SelectionUnsensitive"/>
+    </enum>
     <enum name="PrintRangeType" cname="GnomePrintRangeType" type="enum">
       <member cname="GNOME_PRINT_RANGETYPE_NONE" name="None"/>
       <member cname="GNOME_PRINT_RANGETYPE_CUSTOM" name="Custom"/>
@@ -6578,7 +6598,7 @@
     </object>
     <struct name="CanvasHacktextPriv" cname="GnomeCanvasHacktextPriv" opaque="true"/>
   </namespace>
-  <namespace name="Gnome" library="gnomeprintui-2.2">
+  <namespace name="Gnome" library="gnomeprintui-2-2">
     <object name="GPAOptionMenu" cname="GPAOptionMenu" parent="GPAWidget">
       <field cname="menu" type="GtkWidget*"/>
       <field cname="node" type="GPANode*"/>
Index: parser/gapi2xml.pl
===================================================================
RCS file: /cvs/public/gtk-sharp/parser/gapi2xml.pl,v
retrieving revision 1.40
diff -u -r1.40 gapi2xml.pl
--- parser/gapi2xml.pl	15 Jul 2003 05:52:08 -0000	1.40
+++ parser/gapi2xml.pl	1 Oct 2003 20:27:41 -0000
@@ -69,6 +69,18 @@
 		$edef =~ /}\s*(\w+);/;
 		$ename = $1;
 		$edefs{$ename} = $edef;
+        } elsif ($line =~ /^enum/) {
+                $line =~ /\s(\w+)\s+{/;
+		$ename = $1;
+                $edef = "typedef enum {\n";
+                while ($line = <STDIN>) {
+			$edef .= $line;
+			last if ($line =~ /};/);
+                }
+                $edef =~ s/;\n/ $ename;\n/g;
+		$edef =~ s/\n\s*//g;
+		$edef =~ s|/\*.*?\*/||g;
+		$edefs{$ename} = $edef;
 	} elsif ($line =~ /typedef\s+\w+\s*\**\s*\(\*\s*(\w+)\)\s*\(/) {
 		$fname = $1;
 		$fdef = "";

--=-1CUEaI9ukz+3URg0+IuH--