branch off v1 as R_1_7
[m6w6/ext-http] / funcsummary.php
index 6b1f042..27b602d 100644 (file)
@@ -1,3 +1,4 @@
+#! /usr/bin/php
 <?php
 
 function hl($m)
@@ -74,25 +75,28 @@ $preface = <<<_PREFACE
             display: block; 
         } 
         .toc {
-               position: absolute;
-               top: 10px;
-               right: 10px;
-               width: 300px;
-               height: 95%%;
-               overflow: scroll;
-               font-size: .9em;
-               }
-               body>div.toc {
-                       position: fixed;
-               }
-               .toc ul {
-                       padding-left: 15px;
-                       margin-left: 0;
-               }
-               .toc li {
-                       padding: 0;
-                       margin: 0;
-               }
+            position: absolute;
+            top: 10px;
+            right: 10px;
+            width: 300px;
+            height: 95%%;
+            overflow: scroll;
+            font-size: .9em;
+        }
+        body>div.toc {
+            position: fixed;
+        }
+        .toc ul {
+            padding-left: 15px;
+            margin-left: 0;
+        }
+        .toc li {
+            padding: 0;
+            margin: 0;
+        }
+        .tocfile {
+            font-weight: bold;
+        }
     </style>
 </head>
 <body>
@@ -117,26 +121,28 @@ $seen = array();
 foreach (array_slice($_SERVER['argv'], 1) as $fp) {
     foreach (glob($fp) as $f) {
         if (isset($seen[$f])) {
-           continue;
+              continue;
         } else {
            $seen[$f] = true;
         }
         if (mf($f, $m)) {
+            $c = null;
             e("\nAnalyzing %s\n", basename($f));
             printf("<h1 id=\"%s\">%s</h1>\n", basename($f), basename($f));
             foreach ($m[1] as $i => $p) {
                 e("Documenting $p\n");
                 if ($o = preg_match('/^(.*), (.*)$/', $m[4][$i], $n)) {
-                    if ($n[2] == '__construct') {
+                    if ($n[1] != $c) {
+                        $c = $n[1];
                         printf("<h2 id=\"%s\" class=\"o\">%s</h2>\n", $n[1], $n[1]);
                     }
-                       $TOC[basename($f)][$n[1]][$n[2]] = $n[1].'::'.$n[2].'()';
-                       printf("<h%d id=\"%s\">%s</h%d>\n", 3, $n[1].'_'.$n[2], $p, 3);
-                               } else {
-                                       $TOC[basename($f)][$m[4][$i]] = $m[4][$i].'()';
-                                       printf("<h%d id=\"%s\">%s</h%d>\n", 2, $m[4][$i], $p, 2);
-                               }
-                               print ff($m[3][$i]) ."\n";
+                    $TOC[basename($f)][$n[1]][$n[2]] = $n[1].'::'.$n[2].'()';
+                    printf("<h%d id=\"%s\">%s</h%d>\n", 3, $n[1].'_'.$n[2], $p, 3);
+                } else {
+                    $TOC[basename($f)][$m[4][$i]] = $m[4][$i].'()';
+                    printf("<h%d id=\"%s\">%s</h%d>\n", 2, $m[4][$i], $p, 2);
+                }
+                print ff($m[3][$i]) ."\n";
             }
             print "<hr noshade>\n";
         }
@@ -144,18 +150,18 @@ foreach (array_slice($_SERVER['argv'], 1) as $fp) {
 }
 printf("<div class=\"toc\"><strong>Table of Contents</strong>\n<ul>\n");
 foreach ($TOC as $file => $f) {
-       printf("<li><a href=\"#%s\">%s\n<ul>\n", $file, $file);
-       foreach ($f as $cof => $met) {
-               if (is_array($met)) {
-                       foreach ($met as $id => $m) {
-                               printf("<li><a href=\"#%s_%s\">%s</a></li>\n", $cof, $id, $m);
-                       }
-               } else {
-                       printf("<li><a href=\"#%s\">%s</a>\n", $cof, $cof);
-               }
-               printf("</li>\n");
-       }
-       printf("</ul>\n</li>\n");
+    printf("<li><a class=\"tocfile\" href=\"#%s\">%s</a>\n<ul>\n", $file, $file);
+    foreach ($f as $cof => $met) {
+        if (is_array($met)) {
+            foreach ($met as $id => $m) {
+                printf("<li><a href=\"#%s_%s\">%s</a></li>\n", $cof, $id, $m);
+            }
+        } else {
+            printf("<li><a href=\"#%s\">%s</a>\n", $cof, $cof);
+        }
+        printf("</li>\n");
+    }
+    printf("</ul>\n</li>\n");
 }
 printf("</ul>\n</div>\n");