This repository has been archived by the owner on Nov 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
array.h
86 lines (68 loc) · 4.54 KB
/
array.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
+------------------------------------------------------------------------+
| Zephir Language |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2014 Zephir Team (http://www.zephir-lang.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to [email protected] so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <[email protected]> |
| Eduar Carvajal <[email protected]> |
| Vladimir Kolesnikov <[email protected]> |
+------------------------------------------------------------------------+
*/
#ifndef ZEPHIR_KERNEL_ARRAY_H
#define ZEPHIR_KERNEL_ARRAY_H
/** Combined isset/fetch */
int zephir_array_isset_fetch(zval **fetched, const zval *arr, zval *index, int readonly TSRMLS_DC);
int zephir_array_isset_quick_string_fetch(zval **fetched, zval *arr, char *index, uint index_length, unsigned long key, int readonly TSRMLS_DC);
int zephir_array_isset_string_fetch(zval **fetched, zval *arr, char *index, uint index_length, int readonly TSRMLS_DC);
int zephir_array_isset_long_fetch(zval **fetched, zval *arr, unsigned long index, int readonly TSRMLS_DC);
/** Check for index existence */
int ZEPHIR_FASTCALL zephir_array_isset(const zval *arr, zval *index);
int ZEPHIR_FASTCALL zephir_array_isset_long(const zval *arr, unsigned long index);
int ZEPHIR_FASTCALL zephir_array_isset_string(const zval *arr, const char *index, uint index_length);
/** Fast index existence checking */
int ZEPHIR_FASTCALL zephir_array_isset_quick_string(const zval *arr, const char *index, uint index_length, unsigned long key);
/** Unset existing indexes */
int ZEPHIR_FASTCALL zephir_array_unset(zval **arr, zval *index, int flags);
int ZEPHIR_FASTCALL zephir_array_unset_long(zval **arr, unsigned long index, int flags);
int ZEPHIR_FASTCALL zephir_array_unset_string(zval **arr, const char *index, uint index_length, int flags);
/** Append elements to arrays */
int zephir_array_append(zval **arr, zval *value, int separate ZEPHIR_DEBUG_PARAMS);
int zephir_array_append_long(zval **arr, long value, int separate);
int zephir_array_append_string(zval **arr, char *value, uint value_length, int separate);
/** Modify arrays */
int zephir_array_update_zval(zval **arr, zval *index, zval **value, int flags);
int zephir_array_update_string(zval **arr, const char *index, uint index_length, zval **value, int flags);
int zephir_array_update_long(zval **arr, unsigned long index, zval **value, int flags ZEPHIR_DEBUG_PARAMS);
/** Fetch items from arrays */
int zephir_array_fetch(zval **return_value, zval *arr, zval *index, int flags ZEPHIR_DEBUG_PARAMS TSRMLS_DC);
int zephir_array_fetch_string(zval **return_value, zval *arr, const char *index, uint index_length, int flags ZEPHIR_DEBUG_PARAMS TSRMLS_DC);
int zephir_array_fetch_long(zval **return_value, zval *arr, unsigned long index, int flags ZEPHIR_DEBUG_PARAMS TSRMLS_DC);
/** Merge+Append */
void zephir_merge_append(zval *left, zval *values);
/* Traversing Arays */
void zephir_array_get_current(zval *return_value, zval *array);
void zephir_array_next(zval *array);
/* In Array */
int zephir_fast_in_array(zval *needle, zval *haystack TSRMLS_DC);
/** Fast Array Merge */
void zephir_fast_array_merge(zval *return_value, zval **array1, zval **array2 TSRMLS_DC);
/** Recursive merge */
void zephir_array_merge_recursive_n(zval **a1, zval *a2 TSRMLS_DC);
void zephir_array_unshift(zval *arr, zval *arg TSRMLS_DC);
void zephir_array_keys(zval *return_value, zval *arr TSRMLS_DC);
void zephir_array_values(zval *return_value, zval *arr);
int zephir_array_key_exists(zval *arr, zval *key TSRMLS_DC);
int zephir_array_is_associative(zval *arr);
int zephir_array_update_multi(zval **arr, zval **value TSRMLS_DC, const char *types, int types_length, int types_count, ...);
#define zephir_array_fast_append(arr, value) \
Z_ADDREF_P(value); \
zend_hash_next_index_insert(Z_ARRVAL_P(arr), &value, sizeof(zval *), NULL);
#endif /* ZEPHIR_KERNEL_ARRAY_H */