Author: voxus
Date: 2006-06-16 16:47:57 +0400 (Fri, 16 Jun 2006)
New Revision: 1699
Added:
trunk/incubator/ext/src/core/
trunk/incubator/ext/src/core/Main/
trunk/incubator/ext/src/core/Main/Identifiable.c
trunk/incubator/ext/src/core/Main/Identifiable.h
trunk/incubator/ext/src/core/Main/IdentifiableObject.c
trunk/incubator/ext/src/core/Main/IdentifiableObject.h
trunk/incubator/ext/src/core/Main/Identifier.c
trunk/incubator/ext/src/core/Main/Identifier.h
Modified:
trunk/incubator/ext/config.m4
trunk/incubator/ext/src/onphp.c
trunk/incubator/ext/src/onphp_core.c
trunk/incubator/ext/src/onphp_core.h
Log:
* classes extracted to separate files
Modified: trunk/incubator/ext/config.m4
===================================================================
--- trunk/incubator/ext/config.m4 2006-06-16 10:59:59 UTC (rev 1698)
+++ trunk/incubator/ext/config.m4 2006-06-16 12:47:57 UTC (rev 1699)
@@ -8,6 +8,9 @@
onphp_sources="\
src/onphp.c \
src/onphp_core.c \
+ src/core/Main/Identifiable.c \
+ src/core/Main/Identifier.c \
+ src/core/Main/IdentifiableObject.c \
"
ONPHP_INCLUDES="-I./src/"
Added: trunk/incubator/ext/src/core/Main/Identifiable.c
===================================================================
--- trunk/incubator/ext/src/core/Main/Identifiable.c (rev 0)
+++ trunk/incubator/ext/src/core/Main/Identifiable.c 2006-06-16 12:47:57 UTC (rev 1699)
@@ -0,0 +1,11 @@
+/* $Id$ */
+
+#include "onphp_core.h"
+
+PHPAPI zend_class_entry *onphp_ce_Identifiable;
+
+zend_function_entry onphp_funcs_Identifiable[] = {
+ ONPHP_ABSTRACT_ME(Identifiable, getId, NULL)
+ ONPHP_ABSTRACT_ME(Identifiable, setId, arginfo_id)
+ {NULL, NULL, NULL}
+};
Property changes on: trunk/incubator/ext/src/core/Main/Identifiable.c
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/incubator/ext/src/core/Main/Identifiable.h
===================================================================
--- trunk/incubator/ext/src/core/Main/Identifiable.h (rev 0)
+++ trunk/incubator/ext/src/core/Main/Identifiable.h 2006-06-16 12:47:57 UTC (rev 1699)
@@ -0,0 +1,10 @@
+/* $Id$ */
+
+#ifndef ONPHP_CORE_IDENTIFIABLE_H
+#define ONPHP_CORE_IDENTIFIABLE_H
+
+extern PHPAPI zend_class_entry *onphp_ce_Identifiable;
+
+extern zend_function_entry onphp_funcs_Identifiable[];
+
+#endif /* ONPHP_CORE_IDENTIFIABLE_H */
Property changes on: trunk/incubator/ext/src/core/Main/Identifiable.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/incubator/ext/src/core/Main/IdentifiableObject.c
===================================================================
--- trunk/incubator/ext/src/core/Main/IdentifiableObject.c (rev 0)
+++ trunk/incubator/ext/src/core/Main/IdentifiableObject.c 2006-06-16 12:47:57 UTC (rev 1699)
@@ -0,0 +1,76 @@
+/* $Id$ */
+
+#include "onphp.h"
+
+#include "core/Main/Identifier.h"
+#include "core/Main/IdentifiableObject.h"
+
+PHPAPI zend_class_entry *onphp_ce_IdentifiableObject;
+
+ONPHP_METHOD(IdentifiableObject, wrap)
+{
+ zval *object, *id;
+
+ MAKE_STD_ZVAL(object);
+
+ object->value.obj = onphp_empty_object_new(onphp_ce_IdentifiableObject TSRMLS_CC);
+ Z_TYPE_P(object) = IS_OBJECT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
+ zend_update_property(
+ onphp_ce_IdentifiableObject,
+ object,
+ "id",
+ strlen("id"),
+ id TSRMLS_CC
+ );
+ }
+
+ RETURN_ZVAL(object, 1, 1);
+}
+
+ONPHP_METHOD(IdentifiableObject, getId)
+{
+ zval *this = getThis(), *id;
+
+ onphp_identifiable_object *object = (onphp_identifiable_object *) zend_object_store_get_object(
+ this TSRMLS_CC
+ );
+
+ id = zend_read_property(Z_OBJCE_P(this), this, "id", strlen("id"), 1 TSRMLS_CC);
+
+ if (
+ Z_TYPE_P(id) == IS_OBJECT
+ && instanceof_function(Z_OBJCE_P(id), onphp_ce_Identifier TSRMLS_CC)
+ ) {
+ if (zval_is_true(zend_read_property(Z_OBJCE_P(id), id, "final", strlen("final"), 1 TSRMLS_CC))) {
+ id = zend_read_property(Z_OBJCE_P(id), id, "id", strlen("id"), 1 TSRMLS_CC);
+ }
+ }
+
+ RETURN_ZVAL(id, 1, 0);
+}
+
+ONPHP_METHOD(IdentifiableObject, setId)
+{
+ zval *this = getThis(), *id;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
+ zend_update_property(
+ onphp_ce_IdentifiableObject,
+ this,
+ "id",
+ strlen("id"),
+ id TSRMLS_CC
+ );
+ }
+
+ RETURN_ZVAL(this, 1, 0);
+}
+
+zend_function_entry onphp_funcs_IdentifiableObject[] = {
+ ONPHP_ME(IdentifiableObject, getId, NULL, ZEND_ACC_PUBLIC)
+ ONPHP_ME(IdentifiableObject, setId, arginfo_id, ZEND_ACC_PUBLIC)
+ ONPHP_ME(IdentifiableObject, wrap, arginfo_id, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ {NULL, NULL, NULL}
+};
Property changes on: trunk/incubator/ext/src/core/Main/IdentifiableObject.c
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/incubator/ext/src/core/Main/IdentifiableObject.h
===================================================================
--- trunk/incubator/ext/src/core/Main/IdentifiableObject.h (rev 0)
+++ trunk/incubator/ext/src/core/Main/IdentifiableObject.h 2006-06-16 12:47:57 UTC (rev 1699)
@@ -0,0 +1,14 @@
+/* $Id$ */
+
+#ifndef ONPHP_CORE_IDENTIFIABLE_OBJECT_H
+#define ONPHP_CORE_IDENTIFIABLE_OBJECT_H
+
+#include "onphp_core.h"
+
+extern PHPAPI zend_class_entry *onphp_ce_IdentifiableObject;
+
+typedef struct _onphp_empty_object onphp_identifiable_object;
+
+extern zend_function_entry onphp_funcs_IdentifiableObject[];
+
+#endif /* ONPHP_CORE_IDENTIFIABLE_OBJECT_H */
Property changes on: trunk/incubator/ext/src/core/Main/IdentifiableObject.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/incubator/ext/src/core/Main/Identifier.c
===================================================================
--- trunk/incubator/ext/src/core/Main/Identifier.c (rev 0)
+++ trunk/incubator/ext/src/core/Main/Identifier.c 2006-06-16 12:47:57 UTC (rev 1699)
@@ -0,0 +1,104 @@
+/* $Id$ */
+
+#include "onphp.h"
+
+#include "core/Main/Identifier.h"
+
+PHPAPI zend_class_entry *onphp_ce_Identifier;
+
+ONPHP_METHOD(Identifier, create)
+{
+ zval *object;
+
+ MAKE_STD_ZVAL(object);
+
+ object->value.obj = onphp_empty_object_new(onphp_ce_Identifier TSRMLS_CC);
+ Z_TYPE_P(object) = IS_OBJECT;
+
+ RETURN_ZVAL(object, 1, 1);
+}
+
+ONPHP_METHOD(Identifier, wrap)
+{
+ zval *object, *id;
+
+ MAKE_STD_ZVAL(object);
+
+ object->value.obj = onphp_empty_object_new(onphp_ce_Identifier TSRMLS_CC);
+ Z_TYPE_P(object) = IS_OBJECT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
+ zend_update_property(
+ onphp_ce_Identifier,
+ object,
+ "id",
+ strlen("id"),
+ id TSRMLS_CC
+ );
+ }
+
+ RETURN_ZVAL(object, 1, 1);
+}
+
+ONPHP_METHOD(Identifier, getId)
+{
+ zval *this = getThis(), *id;
+
+ id = zend_read_property(Z_OBJCE_P(this), this, "id", strlen("id"), 1 TSRMLS_CC);
+
+ RETURN_ZVAL(id, 1, 0);
+}
+
+ONPHP_METHOD(Identifier, setId)
+{
+ zval *this = getThis(), *id;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
+ zend_update_property(
+ onphp_ce_Identifier,
+ this,
+ "id",
+ strlen("id"),
+ id TSRMLS_CC
+ );
+ }
+
+ RETURN_ZVAL(this, 1, 0);
+}
+
+ONPHP_METHOD(Identifier, finalize)
+{
+ zval *this = getThis(), *true;
+
+ ALLOC_INIT_ZVAL(true);
+ ZVAL_TRUE(true);
+
+ zend_update_property(
+ onphp_ce_Identifier,
+ this,
+ "final",
+ strlen("final"),
+ true TSRMLS_CC
+ );
+
+ RETURN_ZVAL(this, 1, 0);
+}
+
+ONPHP_METHOD(Identifier, isFinalized)
+{
+ zval *this = getThis(), *final;
+
+ final = zend_read_property(Z_OBJCE_P(this), this, "final", strlen("final"), 1 TSRMLS_CC);
+
+ RETURN_ZVAL(final, 1, 0);
+}
+
+zend_function_entry onphp_funcs_Identifier[] = {
+ ONPHP_ME(Identifier, create, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ ONPHP_ME(Identifier, wrap, arginfo_id, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
+ ONPHP_ME(Identifier, getId, NULL, ZEND_ACC_PUBLIC)
+ ONPHP_ME(Identifier, setId, arginfo_id, ZEND_ACC_PUBLIC)
+ ONPHP_ME(Identifier, finalize, NULL, ZEND_ACC_PUBLIC)
+ ONPHP_ME(Identifier, isFinalized, NULL, ZEND_ACC_PUBLIC)
+ {NULL, NULL, NULL}
+};
Property changes on: trunk/incubator/ext/src/core/Main/Identifier.c
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Added: trunk/incubator/ext/src/core/Main/Identifier.h
===================================================================
--- trunk/incubator/ext/src/core/Main/Identifier.h (rev 0)
+++ trunk/incubator/ext/src/core/Main/Identifier.h 2006-06-16 12:47:57 UTC (rev 1699)
@@ -0,0 +1,14 @@
+/* $Id$ */
+
+#ifndef ONPHP_CORE_IDENTIFIER_H
+#define ONPHP_CORE_IDENTIFIER_H
+
+#include "onphp_core.h"
+
+extern PHPAPI zend_class_entry *onphp_ce_Identifier;
+
+typedef struct _onphp_empty_object onphp_identifier;
+
+extern zend_function_entry onphp_funcs_Identifier[];
+
+#endif /* ONPHP_CORE_IDENTIFIER_H */
Property changes on: trunk/incubator/ext/src/core/Main/Identifier.h
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Modified: trunk/incubator/ext/src/onphp.c
===================================================================
--- trunk/incubator/ext/src/onphp.c 2006-06-16 10:59:59 UTC (rev 1698)
+++ trunk/incubator/ext/src/onphp.c 2006-06-16 12:47:57 UTC (rev 1699)
@@ -1,13 +1,11 @@
/* $Id$ */
-#ifdef HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include "php.h"
-
#include "onphp.h"
+
#include "onphp_core.h"
+#include "core/Main/Identifiable.h"
+#include "core/Main/Identifier.h"
+#include "core/Main/IdentifiableObject.h"
#define ONPHP_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
spl_add_classes(&onphp_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC)
Modified: trunk/incubator/ext/src/onphp_core.c
===================================================================
--- trunk/incubator/ext/src/onphp_core.c 2006-06-16 10:59:59 UTC (rev 1698)
+++ trunk/incubator/ext/src/onphp_core.c 2006-06-16 12:47:57 UTC (rev 1699)
@@ -1,13 +1,13 @@
/* $Id$ */
+#include "core/Main/IdentifiableObject.h"
+#include "core/Main/Identifiable.h"
+#include "core/Main/Identifier.h"
+
#include "onphp_core.h"
#include "zend_interfaces.h"
-PHPAPI zend_class_entry *onphp_ce_Identifier;
-PHPAPI zend_class_entry *onphp_ce_Identifiable;
-PHPAPI zend_class_entry *onphp_ce_IdentifiableObject;
-
static zend_object_handlers zend_std_obj_handlers;
static void onphp_empty_object_free_storage(void *object TSRMLS_DC)
@@ -56,188 +56,11 @@
return objval;
}
-static zend_object_value onphp_empty_object_new(zend_class_entry *class_type TSRMLS_DC)
+zend_object_value onphp_empty_object_new(zend_class_entry *class_type TSRMLS_DC)
{
return onphp_empty_object_spawn(class_type, NULL TSRMLS_CC);
}
-ONPHP_METHOD(Identifier, create)
-{
- zval *object;
-
- MAKE_STD_ZVAL(object);
-
- object->value.obj = onphp_empty_object_new(onphp_ce_Identifier TSRMLS_CC);
- Z_TYPE_P(object) = IS_OBJECT;
-
- RETURN_ZVAL(object, 1, 1);
-}
-
-ONPHP_METHOD(Identifier, wrap)
-{
- zval *object, *id;
-
- MAKE_STD_ZVAL(object);
-
- object->value.obj = onphp_empty_object_new(onphp_ce_Identifier TSRMLS_CC);
- Z_TYPE_P(object) = IS_OBJECT;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
- zend_update_property(
- onphp_ce_Identifier,
- object,
- "id",
- strlen("id"),
- id TSRMLS_CC
- );
- }
-
- RETURN_ZVAL(object, 1, 1);
-}
-
-ONPHP_METHOD(Identifier, getId)
-{
- zval *this = getThis(), *id;
-
- id = zend_read_property(Z_OBJCE_P(this), this, "id", strlen("id"), 1 TSRMLS_CC);
-
- RETURN_ZVAL(id, 1, 0);
-}
-
-ONPHP_METHOD(Identifier, setId)
-{
- zval *this = getThis(), *id;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
- zend_update_property(
- onphp_ce_Identifier,
- this,
- "id",
- strlen("id"),
- id TSRMLS_CC
- );
- }
-
- RETURN_ZVAL(this, 1, 0);
-}
-
-ONPHP_METHOD(Identifier, finalize)
-{
- zval *this = getThis(), *true;
-
- ALLOC_INIT_ZVAL(true);
- ZVAL_TRUE(true);
-
- zend_update_property(
- onphp_ce_Identifier,
- this,
- "final",
- strlen("final"),
- true TSRMLS_CC
- );
-
- RETURN_ZVAL(this, 1, 0);
-}
-
-ONPHP_METHOD(Identifier, isFinalized)
-{
- zval *this = getThis(), *final;
-
- final = zend_read_property(Z_OBJCE_P(this), this, "final", strlen("final"), 1 TSRMLS_CC);
-
- RETURN_ZVAL(final, 1, 0);
-}
-
-ONPHP_METHOD(IdentifiableObject, wrap)
-{
- zval *object, *id;
-
- MAKE_STD_ZVAL(object);
-
- object->value.obj = onphp_empty_object_new(onphp_ce_IdentifiableObject TSRMLS_CC);
- Z_TYPE_P(object) = IS_OBJECT;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
- zend_update_property(
- onphp_ce_IdentifiableObject,
- object,
- "id",
- strlen("id"),
- id TSRMLS_CC
- );
- }
-
- RETURN_ZVAL(object, 1, 1);
-}
-
-ONPHP_METHOD(IdentifiableObject, getId)
-{
- zval *this = getThis(), *id;
-
- onphp_identifiable_object *object = (onphp_identifiable_object *) zend_object_store_get_object(
- this TSRMLS_CC
- );
-
- id = zend_read_property(Z_OBJCE_P(this), this, "id", strlen("id"), 1 TSRMLS_CC);
-
- if (
- Z_TYPE_P(id) == IS_OBJECT
- && instanceof_function(Z_OBJCE_P(id), onphp_ce_Identifier TSRMLS_CC)
- ) {
- if (zval_is_true(zend_read_property(Z_OBJCE_P(id), id, "final", strlen("final"), 1 TSRMLS_CC))) {
- id = zend_read_property(Z_OBJCE_P(id), id, "id", strlen("id"), 1 TSRMLS_CC);
- }
- }
-
- RETURN_ZVAL(id, 1, 0);
-}
-
-ONPHP_METHOD(IdentifiableObject, setId)
-{
- zval *this = getThis(), *id;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &id) == SUCCESS) {
- zend_update_property(
- onphp_ce_IdentifiableObject,
- this,
- "id",
- strlen("id"),
- id TSRMLS_CC
- );
- }
-
- RETURN_ZVAL(this, 1, 0);
-}
-
-static
-ZEND_BEGIN_ARG_INFO(arginfo_id, 0)
- ZEND_ARG_INFO(0, id)
-ZEND_END_ARG_INFO()
-
-static
-zend_function_entry onphp_funcs_Identifiable[] = {
- ONPHP_ABSTRACT_ME(Identifiable, getId, NULL)
- ONPHP_ABSTRACT_ME(Identifiable, setId, arginfo_id)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry onphp_funcs_IdentifiableObject[] = {
- ONPHP_ME(IdentifiableObject, getId, NULL, ZEND_ACC_PUBLIC)
- ONPHP_ME(IdentifiableObject, setId, arginfo_id, ZEND_ACC_PUBLIC)
- ONPHP_ME(IdentifiableObject, wrap, arginfo_id, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- {NULL, NULL, NULL}
-};
-
-static zend_function_entry onphp_funcs_Identifier[] = {
- ONPHP_ME(Identifier, create, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- ONPHP_ME(Identifier, wrap, arginfo_id, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
- ONPHP_ME(Identifier, getId, NULL, ZEND_ACC_PUBLIC)
- ONPHP_ME(Identifier, setId, arginfo_id, ZEND_ACC_PUBLIC)
- ONPHP_ME(Identifier, finalize, NULL, ZEND_ACC_PUBLIC)
- ONPHP_ME(Identifier, isFinalized, NULL, ZEND_ACC_PUBLIC)
- {NULL, NULL, NULL}
-};
-
PHP_MINIT_FUNCTION(onphp_core)
{
REGISTER_ONPHP_INTERFACE(Identifiable);
Modified: trunk/incubator/ext/src/onphp_core.h
===================================================================
--- trunk/incubator/ext/src/onphp_core.h 2006-06-16 10:59:59 UTC (rev 1698)
+++ trunk/incubator/ext/src/onphp_core.h 2006-06-16 12:47:57 UTC (rev 1699)
@@ -7,19 +7,19 @@
#include "onphp.h"
-extern PHPAPI zend_class_entry *onphp_ce_Identifier;
-extern PHPAPI zend_class_entry *onphp_ce_Identifiable;
-extern PHPAPI zend_class_entry *onphp_ce_IdentifiableObject;
+extern zend_object_value onphp_empty_object_new(zend_class_entry *class_type TSRMLS_DC);
typedef struct _onphp_empty_object onphp_empty_object;
-typedef struct _onphp_empty_object onphp_identifier;
-typedef struct _onphp_empty_object onphp_identifiable_object;
-
struct _onphp_empty_object {
zend_object std;
};
+static
+ZEND_BEGIN_ARG_INFO(arginfo_id, 0)
+ ZEND_ARG_INFO(0, id)
+ZEND_END_ARG_INFO()
+
PHP_MINIT_FUNCTION(onphp_core);
#endif /* ONPHP_CORE_H */
Received on Fri Jun 16 2006 - 16:47:58 MSD
This archive was generated by hypermail 2.2.0 : Sat Oct 27 2007 - 20:09:40 MSD