  }
  
  /*
+Index: Zend/zend_enumerations.c
+===================================================================
+RCS file: Zend/zend_enumerations.c
+diff -N Zend/zend_enumerations.c
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ Zend/zend_enumerations.c	6 Mar 2005 15:06:01 -0000
+@@ -0,0 +1,129 @@
++/*
++   +----------------------------------------------------------------------+
++   | Zend Engine                                                          |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 2.00 of the Zend license,     |
++   | that is bundled with this package in the file LICENSE, and is        | 
++   | available through the world-wide-web at the following url:           |
++   | http://www.zend.com/license/2_00.txt.                                |
++   | If you did not receive a copy of the Zend license and are unable to  |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license@zend.com so we can mail you a copy immediately.              |
++   +----------------------------------------------------------------------+
++   | Authors: Alex Kiesel <alex@kiesel.name>                              |
++   +----------------------------------------------------------------------+
++*/
++
++/* $Id$ */
++
++#include "zend.h"
++#include "zend_API.h"
++#include "zend_reflection_api.h"
++#include "zend_builtin_functions.h"
++#include "zend_interfaces.h"
++#include "zend_exceptions.h"
++#include "zend_enumerations.h"
++
++ZEND_API zend_class_entry *base_enumeration_ce;
++
++ZEND_METHOD(enumeration, __clone)
++{
++
++	/* Should never be executable */
++	zend_throw_exception(NULL, "Cannot clone object using __clone()", 0 TSRMLS_CC);
++}
++
++ZEND_METHOD(enumeration, __construct)
++{
++
++	/* Should never be executable */
++	zend_throw_exception(NULL, "Cannot clone object using __clone()", 0 TSRMLS_CC);
++}
++
++ZEND_METHOD(enumeration, size)
++{
++	RETURN_LONG(zend_hash_num_elements(&EG(scope)->constants_table));
++}
++
++ZEND_METHOD(enumeration, values)
++{
++	HashPosition pos;
++	zval **ordinal, *container;
++	char *name;
++	uint length;
++	ulong dummy;
++	
++	array_init(return_value);
++	
++	/* Go through class constants and add values to the return array */
++	zend_hash_internal_pointer_reset_ex(&EG(scope)->constants_table, &pos);
++	while (zend_hash_get_current_data_ex(&EG(scope)->constants_table, (void **)&ordinal, &pos) == SUCCESS) {
++		zend_hash_get_current_key_ex(&EG(scope)->constants_table, &name, &length, &dummy, 0, &pos);
++
++		/* Create object for this enumeration memeber */
++		MAKE_STD_ZVAL(container);
++		if (object_init_ex(container, EG(scope)) != SUCCESS) {
++			zend_error(E_CORE_ERROR, "Cannot create object in Enumeration::values()");
++		}
++		add_property_stringl(container, "name", name, length, 1);
++		add_property_long(container, "ordinal", (*ordinal)->value.lval);
++
++		/* Add to result array and proceed to next element */
++		zend_hash_next_index_insert(Z_ARRVAL_P(return_value), &container, sizeof(zval *), NULL);
++		zend_hash_move_forward_ex(&EG(scope)->constants_table, &pos);
++	}
++}
++
++ZEND_METHOD(enumeration, valueOf) {
++	long needle;
++	char *name;
++	uint length;
++	ulong dummy;
++	HashPosition pos;
++	zval **ordinal;
++	
++	if (ZEND_NUM_ARGS() != 1)
++		WRONG_PARAM_COUNT;
++	
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &needle) == FAILURE) {
++		zend_error(E_WARNING, "valueOf() expects integer.");
++		return;
++	}
++	
++	/* Iterate over constants until the searched needle is found */
++	zend_hash_internal_pointer_reset_ex(&EG(scope)->constants_table, &pos);
++	while (zend_hash_get_current_data_ex(&EG(scope)->constants_table, (void **)&ordinal, &pos) == SUCCESS) {
++	
++		/* Compare current value with searched one. If they equal, it's the right one, because enums are unique */
++		if ((*ordinal)->value.lval == needle) {
++			zend_hash_get_current_key_ex(&EG(scope)->constants_table, &name, &length, &dummy, 0, &pos);
++			
++			object_init_ex(return_value, EG(scope));
++			add_property_stringl(return_value, "name", name, length, 1);
++			add_property_long(return_value, "ordinal", (*ordinal)->value.lval);
++			return;
++		}
++		
++		zend_hash_move_forward_ex(&EG(scope)->constants_table, &pos);
++	}
++	
++	zend_error(E_WARNING, "Value %s::%ld not bound", EG(scope)->name, needle);
++	RETURN_FALSE;
++}
++
++static zend_function_entry default_enumeration_functions[]= {
++	ZEND_ME(enumeration, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL)
++	ZEND_ME(enumeration, __construct, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL)
++	ZEND_ME(enumeration, size, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
++	ZEND_ME(enumeration, values, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
++	ZEND_ME(enumeration, valueOf, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC|ZEND_ACC_FINAL)
++};
++
++void zend_register_default_enumeration(TSRMLS_D)
++{
++	zend_class_entry ce;
++	INIT_CLASS_ENTRY(ce, "Enumeration", default_enumeration_functions);
++	base_enumeration_ce = zend_register_internal_class(&ce TSRMLS_CC);
++}
+Index: Zend/zend_enumerations.h
+===================================================================
+RCS file: Zend/zend_enumerations.h
+diff -N Zend/zend_enumerations.h
+--- /dev/null	1 Jan 1970 00:00:00 -0000
++++ Zend/zend_enumerations.h	6 Mar 2005 15:06:01 -0000
+@@ -0,0 +1,39 @@
++/*
++   +----------------------------------------------------------------------+
++   | Zend Engine                                                          |
++   +----------------------------------------------------------------------+
++   | Copyright (c) 1998-2004 Zend Technologies Ltd. (http://www.zend.com) |
++   +----------------------------------------------------------------------+
++   | This source file is subject to version 2.00 of the Zend license,     |
++   | that is bundled with this package in the file LICENSE, and is        | 
++   | available through the world-wide-web at the following url:           |
++   | http://www.zend.com/license/2_00.txt.                                |
++   | If you did not receive a copy of the Zend license and are unable to  |
++   | obtain it through the world-wide-web, please send a note to          |
++   | license@zend.com so we can mail you a copy immediately.              |
++   +----------------------------------------------------------------------+
++   | Authors: Alex Kiesel <alex@kiesel.name>                              |
++   +----------------------------------------------------------------------+
++*/
++
++/* $Id$ */
++
++#ifndef ZEND_ENUMERATIONS_H
++#define ZEND_ENUMERATIONS_H
++
++BEGIN_EXTERN_C()
++
++extern ZEND_API zend_class_entry *base_enumeration_ce;
++void zend_register_default_enumeration(TSRMLS_D);
++
++END_EXTERN_C()
++
++#endif
++
++/*
++ * Local variables:
++ * tab-width: 4
++ * c-basic-offset: 4
++ * indent-tabs-mode: t
++ * End:
++ */
 Index: Zend/zend_exceptions.c
 ===================================================================
 RCS file: /repository/ZendEngine2/zend_exceptions.c,v
 retrieving revision 1.75
 diff -u -r1.75 zend_exceptions.c
 --- Zend/zend_exceptions.c	7 Dec 2004 07:46:12 -0000	1.75
-+++ Zend/zend_exceptions.c	6 Mar 2005 15:02:50 -0000
++++ Zend/zend_exceptions.c	6 Mar 2005 15:06:02 -0000
 @@ -28,6 +28,7 @@
  #include "zend_interfaces.h"
  #include "zend_exceptions.h"

retrieving revision 1.8
diff -u -r1.8 zend_vm_opcodes.h
--- Zend/zend_vm_opcodes.h	24 Feb 2005 08:52:11 -0000	1.8
+++ Zend/zend_vm_opcodes.h	6 Mar 2005 15:03:03 -0000
@@ -147,3 +147,6 @@
 #define ZEND_ASSIGN_DIM              147
 #define ZEND_ISSET_ISEMPTY_PROP_OBJ  148

retrieving revision 1.58
diff -u -r1.58 zend_default_classes.c
--- Zend/zend_default_classes.c	12 Feb 2004 10:38:14 -0000	1.58
+++ Zend/zend_default_classes.c	6 Mar 2005 15:06:01 -0000
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
