svn: /phpdoc/doc-base/branches/gtk-docgen/scripts/docgen/ docgen.php

[email protected] (Justin Martin) Thu, 18 Nov 2010 23:23:03 +0000
Newsgroups php.gtk.doc
Message-ID <[email protected]>
--9982df9ba0f556e7992956f2019799d8f5fb984d
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

frozenfire                               Thu, 18 Nov 2010 23:23:03 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305538

Log:
Myriad bugfixes.

Changed paths:
    U   phpdoc/doc-base/branches/gtk-docgen/scripts/docgen/docgen.php

Modified: phpdoc/doc-base/branches/gtk-docgen/scripts/docgen/docgen.php
===================================================================
--- phpdoc/doc-base/branches/gtk-docgen/scripts/docgen/docgen.php	2010-11-18 23:14:24 UTC (rev 305537)
+++ phpdoc/doc-base/branches/gtk-docgen/scripts/docgen/docgen.php	2010-11-18 23:23:03 UTC (rev 305538)
@@ -156,6 +156,7 @@
 /* }}} */

 function format_id($name) { /* {{{ */
+	$name = preg_replace('/\+/', 'plus', $name);
 	return preg_replace(array('/[^[:alnum:]]/', '/^-+/'), array('-', ''), strtolower($name));
 }
 /* }}} */
@@ -403,9 +404,10 @@
 			$content = preg_replace('/\{PARAMETERS_DESCRIPTION\}/', $markup, $content, 1);
 		}
 	} else {
-		$content = preg_replace('/\{SIGNAL\}/', '<void />', $content, 1);
+		$content = preg_replace('/\{SIGNAL_PARAMETERS\}/', '<void />', $content, 1);
 		$content = preg_replace('/\{PARAMETERS_DESCRIPTION\}/', '&no.function.parameters;', $content, 1);
 	}
+	return $content;
 }
 /* }}} */

@@ -942,7 +944,7 @@

 			create_dir($path);

-			$path = $OPTION['output'] . '/signals';
+			$path = $path . '/signals';
 			$filename = $path .'/'. format_filename($obj[1]) .'.xml';

 			create_dir($path);
@@ -979,9 +981,10 @@
 				$initialOutput = $OPTION["output"];
 				$exts = glob("{$OPTION['gtk']}{$dirsep}ext{$dirsep}*", GLOB_ONLYDIR);
 				foreach($exts as $ext) {
-					if ($OPTION['verbose']) echo "Generating ".basename($ext)." PHP-GTK sub-extension.".PHP_EOL;
+					$extname = format_id(basename($ext));
+					if ($OPTION['verbose']) echo "Generating ".$extname." PHP-GTK sub-extension.".PHP_EOL;
 					$classes = array();
-					$OPTION["output"] = $OPTION["output"].$dirsep.basename($ext);
+					$OPTION["output"] = $OPTION["output"].$dirsep.$extname;
 					create_dir($OPTION["output"]);

 					$defs = glob("{$ext}{$dirsep}*.defs");
@@ -1003,7 +1006,7 @@
 						if(!class_exists($classtmp)) continue;
 						$class = new ReflectionClass($classtmp);

-						if(basename($ext) == "gtk+") {
+						if($extname == "gtkplus") {
 							$classLevelOutput = $OPTION["output"];

 							if(is_int(stripos($classtmp, "Gtk"))) $OPTION["output"] = $OPTION["output"]."{$dirsep}gtk";
@@ -1015,7 +1018,7 @@
 						}
 						gen_docs($class->name, DOC_CLASS);

-						if(basename($ext) == "gtk+") $OPTION["output"] = $classLevelOutput;
+						if($extname == "gtkplus") $OPTION["output"] = $classLevelOutput;
 					}
 					$OPTION["output"] = $initialOutput;
 				}
@@ -1096,7 +1099,8 @@
 				$signals = GObject::signal_list_ids($class->getConstant("gtype"))
 			) foreach($signals as $signal) {
 				$signal = GObject::signal_query($signal, $class->getConstant("gtype"));
-				write_doc($signal, DOC_SIGNAL);
+				if(is_array($signal)) write_doc($signal, DOC_SIGNAL);
+				else add_warning("Could not query signal #{$signal}");
 			}
 		} catch (Exception $e) {
 			die('Error: '. $e->getMessage() ."\n");
@@ -1329,6 +1333,12 @@
 	}
 }

+if (!empty($OPTION['gtk'])) {
+	define('DOC_SIGNAL', 1<<5);
+	$TEMPLATE[DOC_CLASS] = 'gtk/class.tpl';
+	$TEMPLATE[DOC_SIGNAL] = 'gtk/signal.tpl';
+}
+
 if (!empty($OPTION['example'])) {
 	$DOC_EXT['examples.xml'] = 'examples.tpl';
 }
@@ -1355,12 +1365,6 @@
 	gen_docs($OPTION['function'], DOC_FUNCTION);
 }

-if (!empty($OPTION['gtk'])) {
-	define('DOC_SIGNAL', 1<<5);
-	$TEMPLATE[DOC_CLASS] = 'gtk/class.tpl';
-	$TEMPLATE[DOC_SIGNAL] = 'gtk/signal.tpl';
-}
-
 if (!empty($OPTION['method'])) {
 	gen_docs($OPTION['method'], DOC_METHOD);
 }

--9982df9ba0f556e7992956f2019799d8f5fb984d--