Re: [PHP-DEV] from one hash to another, in an extension

2002-10-24 Thread Tim Daly, Jr.
Andrei Zmievski <[EMAIL PROTECTED]> writes: > On Wed, 23 Oct 2002, Tim Daly, Jr. wrote: > > > You don't need to SEPARATE_ZVAL() in this case. > > > > I don't need to, or I need not to? > > Don't use SEPARATE_ZVAL() when

Re: [PHP-DEV] from one hash to another, in an extension

2002-10-23 Thread Tim Daly, Jr.
Andrei Zmievski <[EMAIL PROTECTED]> writes: > On Wed, 23 Oct 2002, Tim Daly, Jr. wrote: ... > > zend_hash_find(hash1, "key", strlen("key")+1, (void **)&val); > > SEPARATE_ZVAL(val); > > zval_add_ref(val); > > zend_hash_update(hash2, &quo

[PHP-DEV] from one hash to another, in an extension

2002-10-23 Thread Tim Daly, Jr.
I'm trying to figure out the right way to take an entry from one hash table, and put it in another, in C. This is what I first tried: // naive attempt at // $hash2["key"] = $hash1["key"]; zval **val; zend_hash_find(hash1, "key", strlen("key")+1, (void **)&val); SEPARATE_ZVAL(val); zval_add_ref

Re: [PHP-DEV] trying to understand zvals

2002-10-18 Thread Tim Daly, Jr.
Stanislav Malyshev <[EMAIL PROTECTED]> writes: *snip* > TDJ>> that did such a reference assignment: > TDJ>> > TDJ>> $foo = "zonk"; > TDJ>> $bar = "baz"; > TDJ>> > TDJ>> ref_assign($bar, $foo); // $bar =& $foo; > TDJ>> > TDJ>> what has to happen in ref_assign? > > That'

[PHP-DEV] trying to understand zvals

2002-10-18 Thread Tim Daly, Jr.
I'm trying to do some extension programming, and I'm pretty confused by the whole zval thing. In particular, references are a little mysterious. If I have $foo = "zonk"; $bar =& $foo; in PHP, what actually happens? Specifically, if I wanted a function that did such a reference

Re: [PHP-DEV] trying to understand zvals

2002-10-18 Thread Tim Daly, Jr.
Stanislav Malyshev <[EMAIL PROTECTED]> writes: > OK, looking again on the matter in depth, it seems to me that you cannot > do it from C function either, due to the way in which parameters are > passed in the engine. Could you go into a little more depth on the problem, just so I understand?

Re: [PHP-DEV] trying to understand zvals

2002-10-18 Thread Tim Daly, Jr.
Stanislav Malyshev <[EMAIL PROTECTED]> writes: > Ah. Then you need to accept the first parameter by reference (this is > defined in ZEND_FE definition, put first_arg_force_ref as second > parameter). Then you get parameters the usual way (zend_get_parameters_ex, > etc.) and have to zval ** va

Re: [PHP-DEV] trying to understand zvals

2002-10-18 Thread Tim Daly, Jr.
Brad LaFountain <[EMAIL PROTECTED]> writes: > PHP_FUNCTION(ref_assign) > { > zval *bar, *foo; > > if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &bar, &foo) == > FAILURE) { > return; > } > > ZVAL_ADDREF(foo); > *bar = *foo; > bar->i

Re: [PHP-DEV] default properties (in c)

2002-10-09 Thread Tim Daly, Jr.
Brad LaFountain <[EMAIL PROTECTED]> writes: > Ok, > > I don't think default_properties is what you are looking for. > default_properties store the information about defined variables and their > default value. Like this: > class MyClass { > var $test = "mytest"; > } > at compile time MyClass cl

Re: [PHP-DEV] default properties (in c)

2002-10-08 Thread Tim Daly, Jr.
Brad LaFountain <[EMAIL PROTECTED]> writes: > What engine are you working with 1 or 2? > -brad I imagine PHP3 == engine 1, and PHP4 == engine 2? I'm using PHP version 4.2.3. -Tim -- PHP Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] default properties (in c)

2002-10-08 Thread Tim Daly, Jr.
Hi everybody. I'm working on an extension that creates classes, and I want to add class variables to the classes. It looks like, internally, class variables are stored in the zend_class_entry.default_properties hash. Manipulating this hash has the effect desired, however I seem to have misunde