more generator fixes
| From: | Alan Knowles | Date: | Sat, 05 Jan 2002 05:50:04 +0000 |
| Subject: | more generator fixes | ||
| References: | 1 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-313@lists.php.net to get a copy of this message | ||
can somebody give me karma for this, or just commit it? (or object to it:)
cvs [server aborted]: no such directory `generator'
Index: generator/generator.php
===================================================================
RCS file: /repository/php-gtk/generator/generator.php,v
retrieving revision 1.36
diff -u -r1.36 generator.php
--- generator/generator.php 10 Dec 2001 16:02:21 -0000 1.36 +++ generator/generator.php 5 Jan 2002 05:19:46 -0000@@ -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 still 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");