Permalink
Browse files

added add_*_resource() and add_*_bool() functions

  • Loading branch information...
1 parent b357d0e commit 6847fefad9139c0f692f92b557869ff43a907411 Thies C. Arntzen committed Oct 4, 1999
Showing with 86 additions and 10 deletions.
  1. +72 −6 Zend/zend_API.c
  2. +14 −4 Zend/zend_API.h
View
@@ -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));
View
@@ -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);

0 comments on commit 6847fef

Please sign in to comment.