hholzgra Sun Jun 29 14:24:08 2003 EDT
Modified files:
/pear/PECL_Gen TODO package.xml pecl-gen
Log:
preparing for ext_skel BC support
Index: pear/PECL_Gen/TODO
diff -u pear/PECL_Gen/TODO:1.3 pear/PECL_Gen/TODO:1.4
--- pear/PECL_Gen/TODO:1.3 Sun Jun 29 13:24:00 2003
+++ pear/PECL_Gen/TODO Sun Jun 29 14:24:08 2003
@@ -34,3 +34,4 @@
- create just function stubs instead of complete
extension (as supported by the old ext_skel)
- README file generation
+- support ext_skel commandline options for BC reasons
Index: pear/PECL_Gen/package.xml
diff -u pear/PECL_Gen/package.xml:1.2 pear/PECL_Gen/package.xml:1.3
--- pear/PECL_Gen/package.xml:1.2 Sun Jun 29 10:06:01 2003
+++ pear/PECL_Gen/package.xml Sun Jun 29 14:24:08 2003
@@ -31,6 +31,8 @@
</notes>
<deps>
<dep type="php" rel="ge" version="5.0"/>
+ <dep type="pkg" rel="ge" version="1.0.1">XML_Parse</dep>
+ <dep type="pkg" rel="ge" version="1.0">Console_Getopt</dep>
</deps>
<filelist>
<dir name="/" baseinstalldir="/">
Index: pear/PECL_Gen/pecl-gen
diff -u pear/PECL_Gen/pecl-gen:1.1 pear/PECL_Gen/pecl-gen:1.2
--- pear/PECL_Gen/pecl-gen:1.1 Sun Jun 29 08:24:54 2003
+++ pear/PECL_Gen/pecl-gen Sun Jun 29 14:24:08 2003
@@ -5,11 +5,12 @@
* Console script to generate PECL extensions from command line
*
* @author Hartmut Holzgraefe <hartmut@xxxxxx>
-* @version $Id: pecl-gen,v 1.1 2003/06/29 12:24:54 hholzgra Exp $
+* @version $Id: pecl-gen,v 1.2 2003/06/29 18:24:08 hholzgra Exp $
*/
// includes
require_once 'PEAR.php';
+require_once "Console/Getopt.php";
require_once "PECL/Gen/Extension.php";
require_once "PECL/Gen/ExtensionParser.php";
@@ -19,9 +20,30 @@
// create extension object
$extension = new PECL_Gen_Extension;
+$argv = Console_Getopt::readPHPArgv();
+$options = Console_Getopt::getopt($argv, "h?",
+
array( "help",
+
"extname=",
+
"full-xml",
+
"no-help",
+
"proto=",
+
"skel=",
+
"stubs=",
+
"xml==",
+
));
+
+
+if (count($options[1]) != 1) usage();
+
+$xmlfile = $options[1][0];
+
+if (!file_exists($xmlfile) || !is_readable($xmlfile)) {
+ die("Cannot open XML spec file '$xmlfile'");
+}
+
// create XML parser for extension specs
$parser = new PECL_Gen_ExtensionParser($extension);
-$err = $parser->setInputFile("extension.xml");
+$err = $parser->setInputFile($xmlfile);
if (PEAR::isError($err)) {
die($err->message);
}
@@ -36,6 +58,42 @@
$err = $extension->create_extension();
if (PEAR::isError($err)) {
die($err->getMessage()." ".$err->getUserInfo());
+}
+
+exit(0);
+
+
+
+function usage($message = false)
+{
+ $fp = fopen("php://stderr", "w");
+
+ if ($message) fputs($fp, "$message\n\n");
+
+ fputs($fp, "Usage:
+
+pecl-gen [-h] [--extname=name] [--proto=file] [--skel=dir] [--stubs=file]
+ [--no-help] [--xml[=file]] [--full-xml] [specfile.xml]
+
+ -h|--help this message
+
+ the following options are inherited from ext_skel
+ they are accepted but currently not used in any way ...
+
+ --extname=module module is the name of your extension
+ --proto=file file contains prototypes of functions to create
+ --stubs=file generate only function stubs in file
+ --xml generate xml documentation to be added to phpdoc-cvs
+ --skel=dir path to the skeleton directory
+ --full-xml generate xml documentation for a self-contained extension
+ (not yet implemented)
+ --no-help don't try to be nice and create comments in the code
+ and helper functions to test if the module compiled
+");
+
+ fclose($fp);
+
+ exit(3);
}
?>
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|