Re: [Glade-devel] gob style naming?

Date view Thread view Subject view Author view

From: James Henstridge (james@daa.com.au)
Date: Fri Jul 06 2001 - 23:45:19 EDT


On 6 Jul 2001, Owen Taylor wrote:

> There is "standard" method in GTK+ for converting from StudlyCaps to
> lowercase_words.
>
> Which is encapsulated by the following Perl code:
>
> my $lowername = $capsname;
> $lowername =~ s/([^A-Z])([A-Z])/$1_$2/g;
> $lowername =~ s/([A-Z][A-Z])([A-Z][0-9a-z])/$1_$2/g;
> $lowername = lc($lowername);
>
> So:
>
> GtkHBox => gtk_hbox
>
> But:
>
> GtkIMContext => gtk_im_context
> GdkRGB => gdk_rgb
>
> (GtkRBTree violates this rule, but it is private internal to GTK+)

It would seem that GObject also violates these rules. When passed through
the above perl code, we get 'gobject', rather than 'g_object'.

Maybe an extra regexp like the following is needed:
  $lowername =~ s/^([A-Z])([A-Z])/$1_$2/;

James.

-- 
Email: james@daa.com.au
WWW:   http://www.daa.com.au/~james/

_______________________________________________ Glade-devel maillist - Glade-devel@ximian.com http://lists.ximian.com/mailman/listinfo/glade-devel


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Jul 07 2001 - 00:55:33 EDT