helly Wed Jun 4 16:54:14 2003 EDT
Modified files:
/spl php_spl.c php_spl.h spl_engine.c spl_functions.c
spl_functions.h
/spl/tests array_access_001.phpt array_access_002.phpt
array_access_ex.phpt array_read.phpt foreach.phpt
foreach_break.phpt forward.phpt sequence.phpt
Log:
Goodbye namespaces
Index: spl/php_spl.c
diff -u spl/php_spl.c:1.5 spl/php_spl.c:1.6
--- spl/php_spl.c:1.5 Mon May 26 18:06:49 2003
+++ spl/php_spl.c Wed Jun 4 16:54:13 2003
@@ -62,7 +62,6 @@
};
/* }}} */
-zend_namespace *spl_ns_spl;
zend_class_entry *spl_ce_iterator;
zend_class_entry *spl_ce_forward;
zend_class_entry *spl_ce_assoc;
@@ -123,8 +122,6 @@
{
ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
- REGISTER_SPL_NAMESPACE(spl);
-
REGISTER_SPL_INTERFACE(spl, iterator);
REGISTER_SPL_INTF_FUNC(spl, iterator, new_iterator);
@@ -294,11 +291,28 @@
}
/* }}} */
+#define SPL_ADD_CLASS(class_name) \
+ spl_add_classes(&spl_ce_ ## class_name, return_value TSRMLS_CC)
+
/* {{{ spl_classes */
PHP_FUNCTION(spl_classes)
{
array_init(return_value);
- zend_hash_apply_with_argument(&spl_ns_spl->class_table,
(apply_func_arg_t)spl_add_classes, return_value TSRMLS_CC);
+
+ SPL_ADD_CLASS(iterator);
+ SPL_ADD_CLASS(forward);
+ SPL_ADD_CLASS(sequence);
+ SPL_ADD_CLASS(assoc);
+ SPL_ADD_CLASS(forward_assoc);
+ SPL_ADD_CLASS(sequence_assoc);
+ SPL_ADD_CLASS(array_read);
+ SPL_ADD_CLASS(array_access);
+ SPL_ADD_CLASS(array_access_ex);
+ SPL_ADD_CLASS(array_writer);
+
+#ifdef SPL_ARRAY_WRITE
+ SPL_ADD_CLASS(array_writer_default);
+#endif
}
/* }}} */
Index: spl/php_spl.h
diff -u spl/php_spl.h:1.2 spl/php_spl.h:1.3
--- spl/php_spl.h:1.2 Sun May 25 15:10:44 2003
+++ spl/php_spl.h Wed Jun 4 16:54:13 2003
@@ -83,7 +83,6 @@
extern zend_spl_globals spl_globals;
#endif
-extern zend_namespace *spl_ns_spl;
extern zend_class_entry *spl_ce_iterator;
extern zend_class_entry *spl_ce_forward;
extern zend_class_entry *spl_ce_sequence;
Index: spl/spl_engine.c
diff -u spl/spl_engine.c:1.5 spl/spl_engine.c:1.6
--- spl/spl_engine.c:1.5 Thu May 29 17:08:08 2003
+++ spl/spl_engine.c Wed Jun 4 16:54:13 2003
@@ -186,7 +186,6 @@
zend_class_entry *current_scope;
zend_class_entry *calling_scope = NULL;
zval *current_this;
- zend_namespace *current_namespace = EG(active_namespace);
zend_execute_data execute_data;
va_list args;
@@ -315,7 +314,6 @@
}
zend_ptr_stack_clear_multiple(TSRMLS_C);
EG(function_state_ptr) = original_function_state_ptr;
- EG(active_namespace) = current_namespace;
if (EG(This)) {
zval_ptr_dtor(&EG(This));
Index: spl/spl_functions.c
diff -u spl/spl_functions.c:1.9 spl/spl_functions.c:1.10
--- spl/spl_functions.c:1.9 Sat May 31 11:20:11 2003
+++ spl/spl_functions.c Wed Jun 4 16:54:13 2003
@@ -34,25 +34,14 @@
}
/* }}} */
-/* {{{ spl_register_namespace */
-void spl_register_namespace(zend_namespace ** ppns, char * namespace_name TSRMLS_DC)
-{
- zend_namespace ns;
-
- INIT_NAMESPACE(ns, namespace_name);
- ns.name_length = strlen(namespace_name);
- *ppns = zend_register_internal_namespace(&ns TSRMLS_CC);
-}
-/* }}} */
-
/* {{{ spl_register_interface */
-void spl_register_interface(zend_class_entry ** ppce, zend_namespace *
namespace_entry, char * class_name TSRMLS_DC)
+void spl_register_interface(zend_class_entry ** ppce, char * class_name TSRMLS_DC)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, class_name, NULL);
ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_ns_class(&ce, NULL, namespace_entry, NULL
TSRMLS_CC);
+ *ppce = zend_register_internal_class(&ce TSRMLS_CC);
/* entries changed by initialize */
(*ppce)->ce_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_INTERFACE;
@@ -60,14 +49,14 @@
/* }}} */
/* {{{ spl_register_std_class */
-void spl_register_std_class(zend_class_entry ** ppce, zend_namespace *
namespace_entry, char * class_name, void * obj_ctor TSRMLS_DC)
+void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void *
obj_ctor TSRMLS_DC)
{
zend_class_entry ce;
memset(&ce, 0, sizeof(zend_class_entry));
INIT_CLASS_ENTRY(ce, class_name, NULL);
ce.name_length = strlen(class_name);
- *ppce = zend_register_internal_ns_class(&ce, NULL, namespace_entry, NULL
TSRMLS_CC);
+ *ppce = zend_register_internal_class(&ce TSRMLS_CC);
/* entries changed by initialize */
(*ppce)->create_object = obj_ctor;
@@ -86,7 +75,6 @@
pfunction->function_name = fn_name;
pfunction->scope = class_entry;
pfunction->fn_flags = ZEND_ACC_ABSTRACT | ZEND_ACC_PUBLIC;
- pfunction->ns = class_entry->ns;
pfunction->prototype = NULL;
zend_hash_add(&class_entry->function_table, fn_name, strlen(fn_name)+1,
&function, sizeof(zend_function), (void**)®_function);
}
@@ -118,14 +106,7 @@
/* {{ spl_make_fully_qualyfied_name */
char * spl_make_fully_qualyfied_name(zend_class_entry * pce TSRMLS_DC)
{
- if (pce->ns && (pce->ns != &CG(global_namespace))) {
- char *retval;
-
- spprintf(&retval, 0, "%s::%s", pce->ns->name, pce->name);
- return retval;
- } else {
- return estrdup(pce->name);
- }
+ return estrdup(pce->name);
}
/* }}} */
Index: spl/spl_functions.h
diff -u spl/spl_functions.h:1.1.1.1 spl/spl_functions.h:1.2
--- spl/spl_functions.h:1.1.1.1 Thu May 1 19:28:28 2003
+++ spl/spl_functions.h Wed Jun 4 16:54:13 2003
@@ -23,14 +23,11 @@
typedef zend_object_value (*create_object_func_t)(zend_class_entry *class_type
TSRMLS_DC);
-#define REGISTER_SPL_NAMESPACE(namespace_name) \
- spl_register_namespace(&spl_ns_ ## namespace_name, # namespace_name TSRMLS_CC);
-
#define REGISTER_SPL_STD_CLASS(namespace_name, class_name, obj_ctor) \
- spl_register_std_class(&spl_ce_ ## class_name, spl_ns_ ## namespace_name, #
class_name, obj_ctor TSRMLS_CC);
+ spl_register_std_class(&spl_ce_ ## class_name, "spl_" # class_name, obj_ctor
TSRMLS_CC);
#define REGISTER_SPL_INTERFACE(namespace_name, class_name) \
- spl_register_interface(&spl_ce_ ## class_name, spl_ns_ ## namespace_name, #
class_name TSRMLS_CC);
+ spl_register_interface(&spl_ce_ ## class_name, "spl_" # class_name TSRMLS_CC);
#define REGISTER_SPL_INTF_FUNC(namespace_name, class_name, function_name) \
spl_register_interface_function(spl_ce_ ## class_name, # function_name
TSRMLS_CC);
@@ -46,11 +43,9 @@
void spl_destroy_class(zend_class_entry ** ppce);
-void spl_register_namespace(zend_namespace ** ppns, char * namespace_name TSRMLS_DC);
-
-void spl_register_std_class(zend_class_entry ** ppce, zend_namespace *
namespace_entry, char * class_name, create_object_func_t ctor TSRMLS_DC);
+void spl_register_std_class(zend_class_entry ** ppce, char * class_name,
create_object_func_t ctor TSRMLS_DC);
-void spl_register_interface(zend_class_entry ** ppce, zend_namespace *
namespace_entry, char * class_name TSRMLS_DC);
+void spl_register_interface(zend_class_entry ** ppce, char * class_name TSRMLS_DC);
void spl_register_interface_function(zend_class_entry * class_entry, char * fn_name
TSRMLS_DC);
void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry *
parent_class TSRMLS_DC);
@@ -59,7 +54,7 @@
char * spl_make_fully_qualyfied_name(zend_class_entry * pce TSRMLS_DC);
void spl_add_class_name(zval * list, zend_class_entry * pce TSRMLS_DC);
-void spl_add_interfaces(zval *list, zend_class_entry * pce TSRMLS_DC);
+void spl_add_interfaces(zval * list, zend_class_entry * pce TSRMLS_DC);
int spl_add_classes(zend_class_entry ** ppce, zval *list TSRMLS_DC);
#define SPL_CLASS_FE(class_name, function_name, arg_types) \
Index: spl/tests/array_access_001.phpt
diff -u spl/tests/array_access_001.phpt:1.1.1.1 spl/tests/array_access_001.phpt:1.2
--- spl/tests/array_access_001.phpt:1.1.1.1 Thu May 1 19:28:28 2003
+++ spl/tests/array_access_001.phpt Wed Jun 4 16:54:13 2003
@@ -3,11 +3,11 @@
--SKIPIF--
<?php
if (!extension_loaded("spl")) die("skip");
- if (!in_array("spl::array_access",spl_classes())) die("skip spl::array_access
not present");
+ if (!in_array("spl_array_access", spl_classes())) die("skip spl_array_access
not present");
?>
--FILE--
<?php
-class c implements spl::array_access {
+class c implements spl_array_access {
public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
function exists($index) {
Index: spl/tests/array_access_002.phpt
diff -u spl/tests/array_access_002.phpt:1.1.1.1 spl/tests/array_access_002.phpt:1.2
--- spl/tests/array_access_002.phpt:1.1.1.1 Thu May 1 19:28:28 2003
+++ spl/tests/array_access_002.phpt Wed Jun 4 16:54:13 2003
@@ -3,11 +3,11 @@
--SKIPIF--
<?php
if (!extension_loaded("spl")) die("skip");
- if (!in_array("spl::array_access",spl_classes())) die("skip spl::array_access
not present");
+ if (!in_array("spl_array_access", spl_classes())) die("skip spl_array_access
not present");
?>
--FILE--
<?php
-class c implements spl::array_access {
+class c implements spl_array_access {
public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
function exists($index) {
Index: spl/tests/array_access_ex.phpt
diff -u spl/tests/array_access_ex.phpt:1.1.1.1 spl/tests/array_access_ex.phpt:1.2
--- spl/tests/array_access_ex.phpt:1.1.1.1 Thu May 1 19:28:28 2003
+++ spl/tests/array_access_ex.phpt Wed Jun 4 16:54:13 2003
@@ -3,11 +3,11 @@
--SKIPIF--
<?php
if (!extension_loaded("spl")) die("skip");
- if (!in_array("spl::array_access",spl_classes())) die("skip spl::array_access
not present");
+ if (!in_array("spl_array_access", spl_classes())) die("skip spl_array_access
not present");
?>
--FILE--
<?php
-class array_write implements spl::array_writer {
+class array_write implements spl_array_writer {
private $obj;
private $idx;
@@ -22,7 +22,7 @@
}
}
-class c implements spl::array_access_ex {
+class c implements spl_array_access_ex {
public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
@@ -104,11 +104,11 @@
int(4)
c::exists(5th)
-Notice: Undefined index: 5th in /usr/src/php5/ext/spl/tests/array_access_ex.php on
line 49
+Notice: Undefined index: 5th in %sarray_access_ex.php on line %d
NULL
c::exists(6)
-Notice: Undefined index: 6 in /usr/src/php5/ext/spl/tests/array_access_ex.php on
line 50
+Notice: Undefined index: 6 in %sarray_access_ex.php on line %d
NULL
WRITE 1
c::exists(1)
Index: spl/tests/array_read.phpt
diff -u spl/tests/array_read.phpt:1.1.1.1 spl/tests/array_read.phpt:1.2
--- spl/tests/array_read.phpt:1.1.1.1 Thu May 1 19:28:28 2003
+++ spl/tests/array_read.phpt Wed Jun 4 16:54:13 2003
@@ -10,7 +10,7 @@
$a = array('1st', 1, 2=>'3rd', '4th'=>4);
var_dump($a);
-class external implements spl::array_read {
+class external implements spl_array_read {
function exists($index) {
echo __METHOD__ . "($index)\n";
@@ -46,7 +46,7 @@
echo "INTERNAL\n";
-class internal implements spl::array_read {
+class internal implements spl_array_read {
public $a = array('1st', 1, 2=>'3rd', '4th'=>4);
Index: spl/tests/foreach.phpt
diff -u spl/tests/foreach.phpt:1.3 spl/tests/foreach.phpt:1.4
--- spl/tests/foreach.phpt:1.3 Sun Jun 1 12:41:53 2003
+++ spl/tests/foreach.phpt Wed Jun 4 16:54:13 2003
@@ -4,7 +4,7 @@
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
-class c_iter implements spl::forward_assoc {
+class c_iter implements spl_forward_assoc {
private $obj;
private $num = 0;
@@ -36,7 +36,7 @@
}
}
-class c implements spl::iterator {
+class c implements spl_iterator {
public $max = 3;
Index: spl/tests/foreach_break.phpt
diff -u spl/tests/foreach_break.phpt:1.2 spl/tests/foreach_break.phpt:1.3
--- spl/tests/foreach_break.phpt:1.2 Sun Jun 1 12:41:53 2003
+++ spl/tests/foreach_break.phpt Wed Jun 4 16:54:13 2003
@@ -4,7 +4,7 @@
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
-class c_iter implements spl::forward_assoc {
+class c_iter implements spl_forward_assoc {
private $obj;
private $num = 0;
@@ -36,7 +36,7 @@
}
}
-class c implements spl::iterator {
+class c implements spl_iterator {
public $max = 3;
Index: spl/tests/forward.phpt
diff -u spl/tests/forward.phpt:1.3 spl/tests/forward.phpt:1.4
--- spl/tests/forward.phpt:1.3 Sun Jun 1 12:41:53 2003
+++ spl/tests/forward.phpt Wed Jun 4 16:54:13 2003
@@ -4,7 +4,7 @@
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
-class c implements spl::forward_assoc {
+class c implements spl_forward_assoc {
public $max = 3;
public $num = 0;
@@ -36,7 +36,7 @@
$c_info = array(class_name($i) => array('inheits' => class_parents($i), 'implements'
=> class_implements($i)));
print_r($c_info);
-$methods = get_class_methods("spl::forward_assoc");
+$methods = get_class_methods("spl_forward_assoc");
sort($methods);
print_r($methods);
$methods = get_class_methods($i);
@@ -75,9 +75,9 @@
[implements] => Array
(
- [spl::forward_assoc] => spl::forward_assoc
- [spl::assoc] => spl::assoc
- [spl::forward] => spl::forward
+ [spl_forward_assoc] => spl_forward_assoc
+ [spl_assoc] => spl_assoc
+ [spl_forward] => spl_forward
)
)
Index: spl/tests/sequence.phpt
diff -u spl/tests/sequence.phpt:1.2 spl/tests/sequence.phpt:1.3
--- spl/tests/sequence.phpt:1.2 Sun Jun 1 12:41:53 2003
+++ spl/tests/sequence.phpt Wed Jun 4 16:54:13 2003
@@ -4,7 +4,7 @@
<?php if (!extension_loaded("spl")) print "skip"; ?>
--FILE--
<?php
-class c implements spl::iterator {
+class c implements spl_iterator {
public $max = 3;
@@ -14,7 +14,7 @@
}
}
-class c_iter implements spl::sequence_assoc {
+class c_iter implements spl_sequence_assoc {
private $obj;
private $num = 0;
@@ -78,7 +78,7 @@
[implements] => Array
(
- [spl::iterator] => spl::iterator
+ [spl_iterator] => spl_iterator
)
)
@@ -91,11 +91,11 @@
[implements] => Array
(
- [spl::sequence_assoc] => spl::sequence_assoc
- [spl::forward_assoc] => spl::forward_assoc
- [spl::assoc] => spl::assoc
- [spl::forward] => spl::forward
- [spl::sequence] => spl::sequence
+ [spl_sequence_assoc] => spl_sequence_assoc
+ [spl_forward_assoc] => spl_forward_assoc
+ [spl_assoc] => spl_assoc
+ [spl_forward] => spl_forward
+ [spl_sequence] => spl_sequence
)
)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php