underscores and dashes in docs



While updating gtk-doc to work with GObject parameters, I noticed,
once again that we use a mix of dash-separated and underscore_separated
conventions for argument names. 

This, not suprisingly, causes various problems. I've just committed
the following patch that standardizes both on dash-separated forms.
This should work with both GTK+-1.2 based libs and GObject based
libs.

>From C you can use either pretty interchangeably. For some other language
bindings you need to use one or the other. In particular, in C++ you need 
to use the underscore_separated forms.

I don't have much of an opinion on which way we should go on this for
the docs. If people feel strongly, I'll reverse the s/_/-/g to
s/-/_/g.  We just need to standardize one way or the other.

Regards,
                                                 Owen

Index: gtkdoc-mkdb.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-mkdb.in,v
retrieving revision 1.18
diff -u -r1.18 gtkdoc-mkdb.in
--- gtkdoc-mkdb.in	2000/11/03 07:01:50	1.18
+++ gtkdoc-mkdb.in	2001/01/08 20:04:38
@@ -1817,7 +1817,7 @@
 		$signal_name = $1;
 		if ($signal_name =~ m/^(.*)::(.*)$/) {
 		    $signal_object = $1;
-		    $signal_name = $2;
+		    ($signal_name = $2) =~ s/_/-/g;
 #		    print "Found signal: $signal_name\n";
 		} else {
 		    print "Invalid signal name: $signal_name\n";
@@ -2052,7 +2052,7 @@
 		$arg_name = $1;
 		if ($arg_name =~ m/^(.*)::(.*)$/) {
 		    $arg_object = $1;
-		    $arg_name = $2;
+		    ($arg_name = $2) =~ s/_/-/g;
 #		    print "Found arg: $arg_name\n";
 		} else {
 		    print "Invalid arg name: $arg_name\n";
Index: gtkdoc-mktmpl.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-mktmpl.in,v
retrieving revision 1.12
diff -u -r1.12 gtkdoc-mktmpl.in
--- gtkdoc-mktmpl.in	2000/11/03 07:01:50	1.12
+++ gtkdoc-mktmpl.in	2001/01/08 20:04:39
@@ -901,7 +901,7 @@
 		$signal_name = $1;
 		if ($signal_name =~ m/^(.*)::(.*)$/) {
 		    $signal_object = $1;
-		    $signal_name = $2;
+		    ($signal_name = $2) =~ s/_/-/g;
 #		    print "Found signal: $signal_name\n";
 		} else {
 		    print "Invalid signal name: $signal_name\n";
@@ -971,6 +971,11 @@
 #		print "Found symbol: $symbol\n";
 	    }
 
+	    # Canonicalize signal and argument names to have -, not _ 
+	    if ($type eq "ARG" || $type eq "SIGNAL") {
+              $symbol =~ s/_/-/g;
+            }
+
 	    # Store previous symbol, but remove any trailing blank lines.
 	    if ($CurrentSymbol ne "") {
 		$SymbolDoc =~ s/\s+$//;
@@ -1123,7 +1128,7 @@
 		$arg_name = $1;
 		if ($arg_name =~ m/^(.*)::(.*)$/) {
 		    $arg_object = $1;
-		    $arg_name = $2;
+		    ($arg_name = $2) =~ s/_/-/g;
 #		    print "Found arg: $arg_name\n";
 		} else {
 		    print "Invalid arg name: $arg_name\n";




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]