]> granicus.if.org Git - php/commitdiff
added add_*_resource() and add_*_bool() functions
authorThies C. Arntzen <thies@php.net>
Mon, 4 Oct 1999 11:42:46 +0000 (11:42 +0000)
committerThies C. Arntzen <thies@php.net>
Mon, 4 Oct 1999 11:42:46 +0000 (11:42 +0000)
Zend/zend_API.c
Zend/zend_API.h

index 5b4458702c08945bf1e4c27b0a0b7a3dbcca6d1c..fdcda0c5bee4f8c7600ceb0365a67daa2647d277 100644 (file)
@@ -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));
index cf3428415f8d6d23bf9b4113350e55b7ec3414ac..401148d7ea6ea11e60f7ce6ba694564e74559e04 100644 (file)
@@ -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);