cvs: php-gtk /generator generator.php
| From: | Alan Knowles | Date: | Tue, 15 Jan 2002 07:10:12 +0000 |
| Subject: | cvs: php-gtk /generator generator.php | ||
| Groups: | php.gtk.cvs | ||
| Request: | Send a blank email to php-gtk-cvs+get-451@lists.php.net to get a copy of this message | ||
alan_k Tue Jan 15 02:10:12 2002 EDT
Modified files:
/php-gtk/generator generator.php
Log:
fatal_error function added to generator\nadditional checks for argv added to generator
Index: php-gtk/generator/generator.php
diff -u php-gtk/generator/generator.php:1.36 php-gtk/generator/generator.php:1.37
--- php-gtk/generator/generator.php:1.36 Mon Dec 10 11:02:21 2001
+++ php-gtk/generator/generator.php Tue Jan 15 02:10:11 2002
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: generator.php,v 1.36 2001/12/10 16:02:21 mfischer Exp $ */
+/* $Id: generator.php,v 1.37 2002/01/15 07:10:11 alan_k Exp $ */
/*
* Significant portions of this generator are based on the pygtk code generator
@@ -691,8 +691,41 @@
}
}
+/* simple fatal_error function
+ - useful in 4.2.0-dev and later as it will actually halt exectution of make
+ - needs to output to stderr as the default print would end up inside the code
+ - TODO - the make file outputs an empty file to gen_XXX.c, there must be a
+ better way to delete it... - by using output buffering or somthing?
+*/
+function fatal_error($message) {
+ $fh = fopen("php://stderr", "w");
+ fwrite($fh,"\n\n\n\n
+========================================================================
+ There was a Serious error with the PHP-GTK generator script
+========================================================================
+ $message
+========================================================================
+ You should type this to ensure that the c source is correctly
+ generated before attempting to make again.
+
+ #find . | grep defs | xargs touch
+
+ \n\n\n\n");
+ fclose($fh);
+ exit(1);
+}
+
+
$old_error_reporting = error_reporting(E_ALL & ~E_NOTICE);
+if (!isset($HTTP_SERVER_VARS['argv']))
+ fatal_error("
+ Could not read command line arguments for generator.php
+ Please ensure that this option is set in your php.ini
+ register_argc_argv = On
+ ");
+
+
$argc = $HTTP_SERVER_VARS['argc'];
$argv = $HTTP_SERVER_VARS['argv'];
@@ -700,9 +733,10 @@
separator in command-line version. */
array_walk($argv, create_function('&$x', '$x = urldecode($x);'));
+
$result = Console_Getopt::getopt($argv, 'o:p:c:r:');
if (!$result || count($result[1]) < 2)
- die("usage: php -q generator.php [-o overridesfile] [-p prefix] [-c functionclass ] [-r
typesfile] defsfile\n");
+ fatal_error("usage: php -q generator.php [-o overridesfile] [-p prefix] [-c functionclass ]
[-r typesfile] defsfile\n");
list($opts, $argv) = $result;