Index: gtkdoc-mkdb.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-mkdb.in,v
retrieving revision 1.138
diff -u -u -r1.138 gtkdoc-mkdb.in
--- gtkdoc-mkdb.in	26 Mar 2006 14:36:18 -0000	1.138
+++ gtkdoc-mkdb.in	29 Mar 2006 08:29:01 -0000
@@ -204,7 +204,7 @@
 my %AllIncompleteSymbols;
 my %AllDocumentedSymbols;
 
-# These global arrays store GtkObject and subclasses and the hierarchy.
+# These global arrays store GObject, subclasses and the hierarchy.
 my @Objects;
 my @ObjectLevels;
 
@@ -246,6 +246,10 @@
 # If any of the DocBook SGML files have changed, update the timestamp file (so
 # it can be used for Makefile dependencies).
 if ($changed || ! -e "$ROOT_DIR/sgml.stamp") {
+
+    &OutputIndex;
+    &OutputDeprecatedIndex;
+
     open (TIMESTAMP, ">$ROOT_DIR/sgml.stamp")
 	|| die "Can't create $ROOT_DIR/sgml.stamp";
     print (TIMESTAMP "timestamp");
@@ -278,7 +282,7 @@
 
     my $count = 0;
     my $object;
-    foreach $object (sort(@Objects)) {
+    foreach $object (sort (@Objects)) {
 	my $xref = &MakeXRef ($object);
 	if ($count % $cols == 0) { print (OUTPUT "<row>\n"); }
 	print (OUTPUT "<entry>$xref</entry>\n");
@@ -619,6 +623,107 @@
     &OutputBook ($book_top, $book_bottom);
 
     return $changed;
+}
+
+#############################################################################
+# Function    : OutputIndex
+# Description : This writes an indexlist that can be included into the main-
+#               document into an <index> tag.
+# Todo        : - remove leading prefix (requires two passes and a re-sort)
+#               - do separate index-files for since too
+#############################################################################
+
+sub OutputIndex {
+    my $old_index = "$SGML_OUTPUT_DIR/index.sgml";
+    my $new_index = "$SGML_OUTPUT_DIR/index.new";
+    my $lastletter = " ";
+    my $divopen = 0;
+
+    open (OUTPUT, ">$new_index")
+	|| die "Can't create $new_index";
+
+    #print "generate api index (".%KnownSymbols." entries)\n";
+
+    my $symbol;
+    foreach $symbol (sort (keys (%KnownSymbols))) {
+        if (defined ($SymbolDocs{$symbol}) || defined ($SourceSymbolDocs{$symbol})) {
+	    my $xref = &MakeXRef ($symbol);
+            my $curletter = uc(substr($symbol,0,1));
+            
+            #print "  add symbol $symbol to index\n";
+
+            if ($curletter ne $lastletter) {
+	        $lastletter = $curletter;
+	  
+	        if ($divopen == 1) {
+                    print (OUTPUT "</indexdiv>\n");
+                }
+	        print (OUTPUT "<indexdiv><title>$curletter</title>");
+	        $divopen = 1;
+	    }
+	
+            print (OUTPUT <<EOF);
+<indexentry><primaryie>$xref</primaryie></indexentry>
+EOF
+        }
+    }
+
+    if ($divopen == 1) {
+        print (OUTPUT "</indexdiv>");
+    }
+    close (OUTPUT);
+
+    &UpdateFileIfChanged ($old_index, $new_index, 0);
+}
+
+#############################################################################
+# Function    : OutputDeprecatedIndex
+# Description : This writes an indexlist that can be included into the main-
+#               document into an <index> tag.
+# Todo        : - remove leading prefix (requires two passes and a re-sort)
+#############################################################################
+
+sub OutputDeprecatedIndex {
+    my $old_index = "$SGML_OUTPUT_DIR/deprecated_index.sgml";
+    my $new_index = "$SGML_OUTPUT_DIR/deprecated_index.new";
+    my $lastletter = " ";
+    my $divopen = 0;
+
+    open (OUTPUT, ">$new_index")
+	|| die "Can't create $new_index";
+
+    #print "generate deprecated index (".%KnownSymbols." entries)\n";
+
+    my $symbol;
+    foreach $symbol (sort (keys (%KnownSymbols))) {
+        if ((defined ($SymbolDocs{$symbol}) || defined ($SourceSymbolDocs{$symbol})) && exists ($Deprecated{$symbol})) {
+	    my $xref = &MakeXRef ($symbol);
+            my $curletter = uc(substr($symbol,0,1));
+            
+            #print "  add symbol $symbol to index\n";
+
+            if ($curletter ne $lastletter) {
+	        $lastletter = $curletter;
+	  
+	        if ($divopen == 1) {
+                    print (OUTPUT "</indexdiv>\n");
+                }
+	        print (OUTPUT "<indexdiv><title>$curletter</title>");
+	        $divopen = 1;
+	    }
+	
+            print (OUTPUT <<EOF);
+<indexentry><primaryie>$xref</primaryie></indexentry>
+EOF
+        }
+    }
+
+    if ($divopen == 1) {
+        print (OUTPUT "</indexdiv>");
+    }
+    close (OUTPUT);
+
+    &UpdateFileIfChanged ($old_index, $new_index, 0);
 }
 
 
