Re: [PHP-DEV] Overloading object methods

2003-01-09 Thread Stefano Corsi
Alle 09:40, giovedì 9 gennaio 2003, John Coggeshall ha scritto:
> This list is for the development _of_ PHP not _with_ PHP, please direct
> future questions there
>
> However, I don't understand the question you are asking... If you have
> this:
>
> Class A {
>
>   function foo() {
>
>   echo "I am function foo";
>   }
> }

Hello, I'm also the function foo. Pleased to meet you.

I'm asking how to call parent::method() from zend engine (C), not from php. 
Are questions regarding the C zend_engine API welcome?

Thanks,
Stefano

--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Overloading object methods

2003-01-09 Thread Stefano Corsi
Does someone know how to call a parent's object method? Not contructor 
(because that is easy) but a method with the same name.

For example, if I have a method that is called pippo() and at the end of the 
method i want to call parent::pippo(), how could I do?

I tried with call_user_function using  

&(this_object->ce->parent->function_table)

as the function table, but I don't know how to pass the underlyig object.

Thanks,
Stefano



--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Include a file from inside an extension...

2003-01-07 Thread Stefano Corsi
Hello,

does someone understand if this is the right procedure to include a filename 
from inside a C extension?

MAKE_STD_ZVAL(filename_z);
ZVAL_STRING(filename_z, "myfile.inc", 1);
op = compile_filename(ZEND_INCLUDE, filename_z);
zend_execute(op TSRMLS_CC);

Thanks,
Stefano


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] "add_property_*", "set_constructor" and more ...

2003-01-06 Thread Stefano Corsi
Hello.

I have managed porting my Zend1 objects to the new object structure and I have 
some ideas or doubts I want to share:

Properties
---

The "add_property_*" function pool updates zval->value->obj->properties 
(Z_OBJPROP_P), while now the correct HastTable to update is in 
Z_OBJ_P(zval)->properties.
So I created a new set of functions (temporarily) named "add_objprop_*" that 
updates the right HashTable, and I created a macro 

#define add_property add_objprop

in case ZEND_ENGINE_2 should be defined inside my files.

It seems to work fine.

What will be the policy for properties in the future? Will be a separate set 
of functions for the new object or will the "add_property_*" set be modified?

Constructor
-

Furthermore, my object had no costructor with the new model and there seems 
not to be an API function to assign constructors. I used this little 
function:

ZEND_API int set_constructor(zend_class_entry ** class_entry, char * 
constructor_name) {
/*
 *  I use a zend_op_array because
 *  I cannot figure out how to populate a (zend_function *)
 *  otherwise ...
 */
zend_op_array * func_method;

if (zend_hash_find(
&(*class_entry)->function_table,
constructor_name,
strlen(constructor_name) + 1,
(void **) &func_method) == FAILURE) {
return FAILURE;
}

(*class_entry)->constructor = (zend_function *) func_method;
return SUCCESS;
}

and this function should be called from the MINIT function this way:

// an_object
INIT_OVERLOADED_CLASS_ENTRY
(ce,
 "an_object",
 php_an_object_class_functions,
 NULL, NULL, NULL);
an_object_class_entry = zend_register_internal_class_ex(&ce, NULL, NULL 
TSRMLS_CC);
#ifdef ZEND_ENGINE_2
set_constructor(&an_object_class_entry, "scobject");
#endif

Constructor return value
---

I used before a this syntax to return value from constructors.

SEPARATE_ZVAL(&zval); \
*return_value = *zval; \
FREE_ZVAL(zval);

now I have noticed I should use this:

*return_value = *zval;
zval_copy_ctor(return_value);

I have some more function for dealing with objects. If someone is interested I 
cand send it outside the list.

Regards,
Stefano

--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Zend 2 - how to test

2003-01-05 Thread Stefano Corsi
Hello.

I have downloaded Zend2 and tried to compile it against php 4.3.0 with many 
errors during the linking phase and some corrections at main/* files. 
Which is the right version/checkout for php to compile against Zend2 and where 
is it possible to get it?

Thanks,
Stefano

--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Objects and Zend Engine2.

2003-01-04 Thread Stefano Corsi
Hello.

I'm developing and extension that creates several objects using the zend 
engine. 

- Will probably the new Zend Engine 2 make my C code unusable? 
- How could I start building towards the new Zend Engine?

Thanks,
Stefano


--
PHP Development Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DEV] Creating objects at startup

2002-12-28 Thread Stefano Corsi
Hello.

Is there a way to force php (apxs) load a php script containing class 
definition at startup time and have them registered as if they were created 
through zend_register_internal_class() thus eliminating the need to code all 
classes in C as an extension?

Thanks and best regards,
Stefano Corsi

--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php