diff options
author | Thies C. Arntzen <thies@php.net> | 1999-10-04 11:42:46 +0000 |
---|---|---|
committer | Thies C. Arntzen <thies@php.net> | 1999-10-04 11:42:46 +0000 |
commit | 6847fefad9139c0f692f92b557869ff43a907411 (patch) | |
tree | c5e6fea457982aa6e37b9bd10af22a8ce096bf79 | |
parent | b357d0eaf8280a2c1d3059f7b61912eeadbf2cbc (diff) | |
download | php-git-6847fefad9139c0f692f92b557869ff43a907411.tar.gz |
added add_*_resource() and add_*_bool() functions
-rw-r--r-- | Zend/zend_API.c | 78 | ||||
-rw-r--r-- | Zend/zend_API.h | 18 |
2 files changed, 86 insertions, 10 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 5b4458702c..fdcda0c5be 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -226,6 +226,13 @@ ZEND_API inline int object_init(zval *arg) } +ZEND_API inline int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) +{ + zend_error(E_WARNING, "add_assoc_function() is no longer supported"); + return FAILURE; +} + + ZEND_API inline int add_assoc_long(zval *arg, char *key, long n) { zval *tmp = (zval *) emalloc(sizeof(zval)); @@ -237,6 +244,28 @@ ZEND_API inline int add_assoc_long(zval *arg, char *key, long n) } +ZEND_API inline int add_assoc_bool(zval *arg, char *key, int b) +{ + zval *tmp = (zval *) emalloc(sizeof(zval)); + + tmp->type = IS_BOOL; + tmp->value.lval = b; + INIT_PZVAL(tmp); + return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); +} + + +ZEND_API inline int add_assoc_resource(zval *arg, char *key, int r) +{ + zval *tmp = (zval *) emalloc(sizeof(zval)); + + tmp->type = IS_RESOURCE; + tmp->value.lval = r; + INIT_PZVAL(tmp); + return zend_hash_update(arg->value.ht, key, strlen(key)+1, (void *) &tmp, sizeof(zval *), NULL); +} + + ZEND_API inline int add_assoc_double(zval *arg, char *key, double d) { zval *tmp = (zval *) emalloc(sizeof(zval)); @@ -280,19 +309,34 @@ ZEND_API inline int add_assoc_stringl(zval *arg, char *key, char *str, uint leng } -ZEND_API inline int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)) +ZEND_API inline int add_index_long(zval *arg, uint index, long n) { - zend_error(E_WARNING, "add_assoc_function() is no longer supported"); - return FAILURE; + zval *tmp = (zval *) emalloc(sizeof(zval)); + + tmp->type = IS_LONG; + tmp->value.lval = n; + INIT_PZVAL(tmp); + return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); } -ZEND_API inline int add_index_long(zval *arg, uint index, long n) +ZEND_API inline int add_index_bool(zval *arg, uint index, int b) { zval *tmp = (zval *) emalloc(sizeof(zval)); - tmp->type = IS_LONG; - tmp->value.lval = n; + tmp->type = IS_BOOL; + tmp->value.lval = b; + INIT_PZVAL(tmp); + return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); +} + + +ZEND_API inline int add_index_resource(zval *arg, uint index, int r) +{ + zval *tmp = (zval *) emalloc(sizeof(zval)); + + tmp->type = IS_RESOURCE; + tmp->value.lval = r; INIT_PZVAL(tmp); return zend_hash_index_update(arg->value.ht, index, (void *) &tmp, sizeof(zval *),NULL); } @@ -352,6 +396,28 @@ ZEND_API inline int add_next_index_long(zval *arg, long n) } +ZEND_API inline int add_next_index_bool(zval *arg, int b) +{ + zval *tmp = (zval *) emalloc(sizeof(zval)); + + tmp->type = IS_BOOL; + tmp->value.lval = b; + INIT_PZVAL(tmp); + return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL); +} + + +ZEND_API inline int add_next_index_resource(zval *arg, int r) +{ + zval *tmp = (zval *) emalloc(sizeof(zval)); + + tmp->type = IS_RESOURCE; + tmp->value.lval = r; + INIT_PZVAL(tmp); + return zend_hash_next_index_insert(arg->value.ht, &tmp, sizeof(zval *), NULL); +} + + ZEND_API inline int add_next_index_double(zval *arg, double d) { zval *tmp = (zval *) emalloc(sizeof(zval)); diff --git a/Zend/zend_API.h b/Zend/zend_API.h index cf3428415f..401148d7ea 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -90,31 +90,41 @@ int zend_startup_module(zend_module_entry *module); ZEND_API int array_init(zval *arg); ZEND_API int object_init(zval *arg); ZEND_API int object_init_ex(zval *arg, zend_class_entry *ce); + +/* no longer supported */ +ZEND_API int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); + ZEND_API int add_assoc_long(zval *arg, char *key, long n); +ZEND_API int add_assoc_bool(zval *arg, char *key, int b); +ZEND_API int add_assoc_resource(zval *arg, char *key, int r); ZEND_API int add_assoc_double(zval *arg, char *key, double d); ZEND_API int add_assoc_string(zval *arg, char *key, char *str, int duplicate); ZEND_API int add_assoc_stringl(zval *arg, char *key, char *str, uint length, int duplicate); -ZEND_API int add_assoc_function(zval *arg, char *key,void (*function_ptr)(INTERNAL_FUNCTION_PARAMETERS)); + ZEND_API int add_index_long(zval *arg, uint idx, long n); +ZEND_API int add_index_bool(zval *arg, uint idx, int b); +ZEND_API int add_index_resource(zval *arg, uint idx, int r); ZEND_API int add_index_double(zval *arg, uint idx, double d); ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate); ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate); + ZEND_API int add_next_index_long(zval *arg, long n); +ZEND_API int add_next_index_bool(zval *arg, int b); +ZEND_API int add_next_index_resource(zval *arg, int r); ZEND_API int add_next_index_double(zval *arg, double d); ZEND_API int add_next_index_string(zval *arg, char *str, int duplicate); ZEND_API int add_next_index_stringl(zval *arg, char *str, uint length, int duplicate); -ZEND_API int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate); -ZEND_API int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate); ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest); ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest); +ZEND_API int add_get_assoc_string(zval *arg, char *key, char *str, void **dest, int duplicate); +ZEND_API int add_get_assoc_stringl(zval *arg, char *key, char *str, uint length, void **dest, int duplicate); ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate); ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate); ZEND_API int call_user_function(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval *params[]); ZEND_API int call_user_function_ex(HashTable *function_table, zval *object, zval *function_name, zval *retval, int param_count, zval **params[], int no_separation); - ZEND_API int add_property_long(zval *arg, char *key, long l); ZEND_API int add_property_resource(zval *arg, char *key, long r); ZEND_API int add_property_double(zval *arg, char *key, double d); |