[prev in list] [next in list] [prev in thread] [next in thread]
List: pecl-cvs
Subject: [PECL-CVS] cvs: pecl /PECL_Gen Extension.php ExtensionParser.php /PECL_Gen/Element Class.php Functi
From: "Hartmut Holzgraefe" <hholzgra () php ! net>
Date: 2005-01-26 23:56:58
Message-ID: cvshholzgra1106783818 () cvsserver
[Download RAW message or body]
hholzgra Wed Jan 26 18:56:58 2005 EDT
Added files:
/pecl/PECL_Gen/Element MemberFunction.php
Modified files:
/pecl/PECL_Gen Extension.php ExtensionParser.php
/pecl/PECL_Gen/Element Class.php Function.php
Log:
more steps towards class support
["hholzgra-20050126185658.txt" (text/plain)]
http://cvs.php.net/diff.php/pecl/PECL_Gen/Extension.php?r1=1.17&r2=1.18&ty=u
Index: pecl/PECL_Gen/Extension.php
diff -u pecl/PECL_Gen/Extension.php:1.17 pecl/PECL_Gen/Extension.php:1.18
--- pecl/PECL_Gen/Extension.php:1.17 Tue Jan 25 20:39:23 2005
+++ pecl/PECL_Gen/Extension.php Wed Jan 26 18:56:56 2005
@@ -16,7 +16,7 @@
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Extension.php,v 1.17 2005/01/26 01:39:23 hholzgra Exp $
+// $Id: Extension.php,v 1.18 2005/01/26 23:56:56 hholzgra Exp $
//
// {{{ includes
@@ -49,7 +49,7 @@
* A class that generates PECL extension soure and documenation files
*
* @access public
- * @version $Id: Extension.php,v 1.17 2005/01/26 01:39:23 hholzgra Exp $
+ * @version $Id: Extension.php,v 1.18 2005/01/26 23:56:56 hholzgra Exp $
*/
class PECL_Gen_Extension
@@ -154,14 +154,7 @@
* @var array
*/
var $internal_functions = array();
-
- /**
- * The extensions private internal C functions
- *
- * @var array
- */
- var $private_functions = array();
-
+
/**
* The constants defined by this extension
*
@@ -424,6 +417,10 @@
*/
function add_function($function)
{
+ if (!is_a($function, "PECL_Gen_Element_Function")) {
+ return $this->raiseError("argument is not PECL_Gen_Element_Function");
+ }
+
$role = $function->get_role();
switch ($role) {
@@ -435,11 +432,7 @@
return true;
case "private":
- if (isset($this->functions[$function->name])) {
- return $this->raiseError("private function '{$function->name}' has \
been defined before");
- }
- $this->private_functions[$function->name] = $function;
- return true;
+ return $this->raiseError("private functions are no longer supported, use \
<code> sections instead");
case "internal":
if (isset($this->functions[$function->name])) {
http://cvs.php.net/diff.php/pecl/PECL_Gen/ExtensionParser.php?r1=1.7&r2=1.8&ty=u
Index: pecl/PECL_Gen/ExtensionParser.php
diff -u pecl/PECL_Gen/ExtensionParser.php:1.7 pecl/PECL_Gen/ExtensionParser.php:1.8
--- pecl/PECL_Gen/ExtensionParser.php:1.7 Mon Dec 27 11:29:51 2004
+++ pecl/PECL_Gen/ExtensionParser.php Wed Jan 26 18:56:56 2005
@@ -16,7 +16,7 @@
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: ExtensionParser.php,v 1.7 2004/12/27 16:29:51 hholzgra Exp $
+// $Id: ExtensionParser.php,v 1.8 2005/01/26 23:56:56 hholzgra Exp $
//
require_once "PECL/Gen/XmlParser.php";
@@ -54,6 +54,14 @@
* @var mixed
*/
var $helper = false;
+
+ /**
+ * The previous helper (top-1 of stack)
+ *
+ * @access private
+ * @var mixed
+ */
+ var $helper_prev = false;
/**
* Constructor
@@ -76,6 +84,7 @@
function push_helper($helper)
{
array_push($this->helper_stack, $this->helper);
+ $this->helper_prev = $this->helper;
$this->helper = $helper;
}
@@ -88,6 +97,12 @@
function pop_helper()
{
$this->helper = array_pop($this->helper_stack);
+ if (count($this->helper_stack)) {
+ end($this->helper_stack);
+ $this->helper_prev = current($this->helper_stack);
+ } else {
+ $this->helper_prev = false;
+ }
}
/**
@@ -189,12 +204,40 @@
- function tagstart_extension_function($attr) {
- return $this->tagstart_functions_function($attr);
+ function tagstart_extension_function($attr)
+ {
+ $this->push_helper(new PECL_Gen_Element_Function);
+
+ $role = isset($attr["role"]) ? $attr["role"] : "public";
+
+ if (isset($attr["name"])) {
+ if ($role == "public" && $this->extension->prefix) {
+ $err = \
$this->helper->set_name($this->extension->prefix."_".$attr["name"]); + \
} else { + $err = $this->helper->set_name($attr["name"]);
+ }
+ if (PEAR::isError($err)) {
+ return $err;
+ }
+ } else {
+ return $this->raiseError("name attribut for function missing");
+ }
+
+ $err = $this->helper->set_role($role);
+ if (PEAR::isError($err)) {
+ return $err;
+ }
+
+ return true;
+ }
+
+ function tagstart_extension_functions_function($attr) {
+ return $this->tagstart_extension_function($attr);
}
- function tagstart_functions_function($attr)
+ function tagstart_class_function($attr)
{
+ // TODO modify
$this->push_helper(new PECL_Gen_Element_Function);
$role = isset($attr["role"]) ? $attr["role"] : "public";
@@ -256,19 +299,25 @@
}
}
- function tagend_extension_function($attr, $data)
+ function tagend_extension_function($attr, $data)
+ {
+ $err = $this->extension->add_function($this->helper);
+ $this->pop_helper();
+ return $err;
+ }
+
+ function tagend_extension_functions_function($attr, $data)
{
- return $this->tagend_functions_function($attr, $data);
+ return $this->tagend_extension_function($attr, $data);
}
- function tagend_functions_function($attr, $data)
+ function tagend_class_function($attr, $data)
{
- $err = $this->extension->add_function($this->helper);
+ $err = $this->helper_prev->add_function($this->helper);
$this->pop_helper();
return $err;
}
-
function tagend_functions($attr, $data) {
return true;
}
http://cvs.php.net/diff.php/pecl/PECL_Gen/Element/Class.php?r1=1.3&r2=1.4&ty=u
Index: pecl/PECL_Gen/Element/Class.php
diff -u pecl/PECL_Gen/Element/Class.php:1.3 pecl/PECL_Gen/Element/Class.php:1.4
--- pecl/PECL_Gen/Element/Class.php:1.3 Tue Jan 25 20:31:25 2005
+++ pecl/PECL_Gen/Element/Class.php Wed Jan 26 18:56:57 2005
@@ -16,7 +16,7 @@
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Class.php,v 1.3 2005/01/26 01:31:25 hholzgra Exp $
+// $Id: Class.php,v 1.4 2005/01/26 23:56:57 hholzgra Exp $
//
require_once "PECL/Gen/Tools/Indent.php";
@@ -33,10 +33,9 @@
/**
* The class name
*
- * @access private
* @var string
*/
- var $name = "unknown";
+ private $name = "unknown";
function set_name($name)
{
@@ -55,10 +54,9 @@
/**
* A short description
*
- * @access private
* @var string
*/
- var $summary = "";
+ private $summary = "";
function set_summary($text)
{
@@ -72,10 +70,9 @@
/**
* A long description
*
- * @access private
* @var string
*/
- var $description = "";
+ private $description = "";
function set_description($text)
{
@@ -84,10 +81,138 @@
}
+
+ /**
+ * Documentation
+ *
+ * TODO: isn't this in Element base class already?
+ *
+ * @var string
+ */
+ private $documentation = "";
+
+ function set_documentation($text) {
+ $this->documentation = $text;
+ }
+
+
+
+ /**
+ * Extents which class?
+ *
+ * @var string
+ */
+ private $extends = "";
+
+ function set_extends($parent)
+ {
+ if (!self::is_name($parent)) {
+ return $this->raiseError("'$parent' is not a valid parent class \
name"); + }
+
+ $this->extends = $parent;
+ }
+
+
+ /**
+ * Implemented Interfaces
+ *
+ * @var array
+ */
+ private $implements = array();
+
+ function add_interface($interface)
+ {
+ if (!self::is_name($parent)) {
+ return $this->raiseError("'$interface' is not a valid interface \
name"); + }
+
+ if (isset[$this->implements[$interface]]) {
+ return $this->raiseError("interface '$interface' added twice");
+ }
+
+ $this->implements[$interface] = $interface;
+ }
+
+
+ /**
+ * Properties
+ *
+ * @var array
+ */
+ private $properties = array();
+
+ function add_property($property)
+ {
+ if (!is_a($property, "PECL_Gen_Element_Property")) {
+ return $this->raiseError("argument is not \
PECL_Gen_Element_Property"); + }
+
+ if (isset[$this->properties[$property->getName()]]) {
+ return $this->raiseError("property '$property' already exists");
+ }
+
+ $this->properties[$property->getName()] = $property;
+ }
+
+
+ /**
+ * Member Functions
+ *
+ * @var array
+ */
+ private $functions = array();
+
+ function add_function($function)
+ {
+ if (!is_a($function, "PECL_Gen_Element_Function")) {
+ return $this->raiseError("argument is not \
PECL_Gen_Element_Function"); + }
+
+ if (isset[$this->functions[$function->getName()]]) {
+ return $this->raiseError("member function '$function' already \
exists"); + }
+
+ $this->functions[$function->getName()] = $function;
+ }
+
+
+
+ /**
+ * Is this an abstract class?
+ *
+ * @var bool
+ */
+ private $is_abstract = false;
+
+ function is_abstract()
+ {
+ $this->is_abstract = true;
+ }
+
+
+
+ /**
+ * Is this an interface?
+ *
+ * @var bool
+ */
+ private $is_interface = false;
+
+ function is_interface()
+ {
+ // TODO: check for already added non-abstract stuff
+
+ $this->is_interface = true;
+ }
+
+
+ // TODO globals
+ // TODO init code
function global_code($extension)
{
- return "
+ return "
zend_class_entry * {$this->name}_ce_ptr = NULL;
@@ -110,7 +235,7 @@
function docbook_xml($base)
{
- $xml = "";
+ $xml = "";
return $xml;
}
http://cvs.php.net/diff.php/pecl/PECL_Gen/Element/Function.php?r1=1.19&r2=1.20&ty=u
Index: pecl/PECL_Gen/Element/Function.php
diff -u pecl/PECL_Gen/Element/Function.php:1.19 \
pecl/PECL_Gen/Element/Function.php:1.20
--- pecl/PECL_Gen/Element/Function.php:1.19 Tue Jan 25 20:06:28 2005
+++ pecl/PECL_Gen/Element/Function.php Wed Jan 26 18:56:57 2005
@@ -16,9 +16,10 @@
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: Function.php,v 1.19 2005/01/26 01:06:28 hholzgra Exp $
+// $Id: Function.php,v 1.20 2005/01/26 23:56:57 hholzgra Exp $
//
+ require_once "PECL/Gen/Element.php";
require_once "PECL/Gen/Tools/Indent.php";
require_once "PECL/Gen/Tools/Tokenizer.php";
@@ -188,7 +189,6 @@
*/
var $optional = 0;
-
/**
* Set parameter and return value information from PHP style prototype
*
http://cvs.php.net/co.php/pecl/PECL_Gen/Element/MemberFunction.php?r=1.1&p=1
Index: pecl/PECL_Gen/Element/MemberFunction.php
+++ pecl/PECL_Gen/Element/MemberFunction.php
<?php
//
// +----------------------------------------------------------------------+
// | PHP Version 5 |
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2003 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Hartmut Holzgraefe <hholzgra@php.net> |
// +----------------------------------------------------------------------+
//
// $Id: MemberFunction.php,v 1.1 2005/01/26 23:56:57 hholzgra Exp $
//
require_once "PECL/Gen/Element/Function.php";
require_once "PECL/Gen/Element/Class.php";
/**
* Class describing a function within a PECL extension
*
* @access public
*/
class PECL_Gen_Element_MemberFunction
extends PECL_Gen_Element_Function
{
}
?>
--
PECL CVS Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic