这篇教程C++ zend_hash_move_forward函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中zend_hash_move_forward函数的典型用法代码示例。如果您正苦于以下问题:C++ zend_hash_move_forward函数的具体用法?C++ zend_hash_move_forward怎么用?C++ zend_hash_move_forward使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了zend_hash_move_forward函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PHP_METHODPHP_METHOD(MIME, load) { zval *array, *arg, retval; /* Fetch allowHEAD */ MAKE_STD_ZVAL(array); array_init_size(array, 2); add_next_index_stringl(array, "Pancake//Config", sizeof("Pancake//Config") - 1, 1); add_next_index_stringl(array, "get", 3, 1); MAKE_STD_ZVAL(arg); Z_TYPE_P(arg) = IS_STRING; Z_STRLEN_P(arg) = 4; Z_STRVAL_P(arg) = estrndup("mime", 4); call_user_function(CG(function_table), NULL, array, &retval, 1, &arg TSRMLS_CC); if(Z_TYPE(retval) != IS_ARRAY) { zend_error(E_ERROR, "Bad MIME type array - Please check Pancake MIME type configuration"); } ALLOC_HASHTABLE(PANCAKE_GLOBALS(mimeTable)); zend_hash_init(PANCAKE_GLOBALS(mimeTable), 0, NULL, ZVAL_PTR_DTOR, 0); zval **data, **ext; char *key; for(zend_hash_internal_pointer_reset(Z_ARRVAL(retval)); zend_hash_get_current_data(Z_ARRVAL(retval), (void**) &data) == SUCCESS && zend_hash_get_current_key(Z_ARRVAL(retval), &key, NULL, 0) == HASH_KEY_IS_STRING; zend_hash_move_forward(Z_ARRVAL(retval))) { for(zend_hash_internal_pointer_reset(Z_ARRVAL_PP(data)); zend_hash_get_current_data(Z_ARRVAL_PP(data), (void**) &ext) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_PP(data))) { zval *zkey; MAKE_STD_ZVAL(zkey); Z_TYPE_P(zkey) = IS_STRING; Z_STRLEN_P(zkey) = strlen(key); Z_STRVAL_P(zkey) = estrndup(key, Z_STRLEN_P(zkey)); zend_hash_add(PANCAKE_GLOBALS(mimeTable), Z_STRVAL_PP(ext), Z_STRLEN_PP(ext), (void*) &zkey, sizeof(zval*), NULL); } } MAKE_STD_ZVAL(PANCAKE_GLOBALS(defaultMimeType)); Z_TYPE_P(PANCAKE_GLOBALS(defaultMimeType)) = IS_STRING; Z_STRLEN_P(PANCAKE_GLOBALS(defaultMimeType)) = sizeof("application/octet-stream") - 1; Z_STRVAL_P(PANCAKE_GLOBALS(defaultMimeType)) = estrndup("application/octet-stream", sizeof("application/octet-stream") - 1); free: zval_dtor(&retval); zval_ptr_dtor(&array); zval_ptr_dtor(&arg);}
开发者ID:nhnam,项目名称:Pancake,代码行数:55,
示例2: php_get_warnings/* {{{ MYSQLI_WARNING *php_get_warnings(MYSQL *mysql) */MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql){ MYSQLI_WARNING *w, *first = NULL, *prev = NULL; MYSQL_RES *result; zval row; if (mysql->m->query(mysql, "SHOW WARNINGS", 13)) { return NULL; } result = mysql->m->use_result(mysql, 0); for (;;) { zval *entry; int errno; mysqlnd_fetch_into(result, MYSQLND_FETCH_NUM, &row, MYSQLND_MYSQLI); if (Z_TYPE(row) != IS_ARRAY) { zval_ptr_dtor(&row); break; } zend_hash_internal_pointer_reset(Z_ARRVAL(row)); /* 0. we don't care about the first */ zend_hash_move_forward(Z_ARRVAL(row)); /* 1. Here comes the error no */ entry = zend_hash_get_current_data(Z_ARRVAL(row)); convert_to_long_ex(entry); errno = Z_LVAL_P(entry); zend_hash_move_forward(Z_ARRVAL(row)); /* 2. Here comes the reason */ entry = zend_hash_get_current_data(Z_ARRVAL(row)); w = php_new_warning(entry, errno); /* Don't destroy entry, because the row destroy will decrease the refcounter. Decreased twice then mysqlnd_free_result() will crash, because it will try to access already freed memory. */ if (!first) { first = w; } if (prev) { prev->next = (void *)w; } prev = w; zval_ptr_dtor(&row); } mysql_free_result(result); return first;}
开发者ID:13572293130,项目名称:php-src,代码行数:55,
示例3: yaf_application_is_module_name/** {{{ int yaf_application_is_module_name(char *name, int len TSRMLS_DC)*/int yaf_application_is_module_name(char *name, int len TSRMLS_DC) { zval *modules, **ppzval; HashTable *ht; yaf_application_t *app; app = zend_read_static_property(yaf_application_ce, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_APP), 1 TSRMLS_CC); if (Z_TYPE_P(app) != IS_OBJECT) { return 0; } modules = zend_read_property(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_MODULES), 1 TSRMLS_CC); if (Z_TYPE_P(modules) != IS_ARRAY) { return 0; } ht = Z_ARRVAL_P(modules); zend_hash_internal_pointer_reset(ht); while (zend_hash_get_current_data(ht, (void **)&ppzval) == SUCCESS) { if (Z_STRLEN_PP(ppzval) == len && strncasecmp(Z_STRVAL_PP(ppzval), name, len) == 0) { return 1; } zend_hash_move_forward(ht); } return 0;}
开发者ID:Alhep,项目名称:php-yaf,代码行数:27,
示例4: phar_dir_seek/** * Used for seeking on a phar directory handle */static int phar_dir_seek(php_stream *stream, zend_off_t offset, int whence, zend_off_t *newoffset) /* {{{ */{ HashTable *data = (HashTable *)stream->abstract; if (!data) { return -1; } if (whence == SEEK_END) { whence = SEEK_SET; offset = zend_hash_num_elements(data) + offset; } if (whence == SEEK_SET) { zend_hash_internal_pointer_reset(data); } if (offset < 0) { return -1; } else { *newoffset = 0; while (*newoffset < offset && zend_hash_move_forward(data) == SUCCESS) { ++(*newoffset); } return 0; }}
开发者ID:GreenLightt,项目名称:php-src,代码行数:30,
示例5: PHP_METHOD/** * @brief void Phalcon/Registry::next() */PHP_METHOD(Phalcon_Registry, next){ zval data = {}; phalcon_read_property(&data, getThis(), SL("_data"), PH_NOISY); zend_hash_move_forward(Z_ARRVAL(data));}
开发者ID:dreamsxin,项目名称:cphalcon7,代码行数:10,
示例6: pip_hash_to_list/* {{{ pip_hash_to_list(zval **hash) Convert a PHP hash to a Python list */PyObject *pip_hash_to_list(zval **hash){ PyObject *list, *item; zval **entry; long pos = 0; /* Make sure we were given a PHP hash */ if (Z_TYPE_PP(hash) != IS_ARRAY) { return NULL; } /* Create a list with the same number of elements as the hash */ list = PyList_New(zend_hash_num_elements(Z_ARRVAL_PP(hash))); /* Let's start at the very beginning, a very good place to start. */ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(hash)); /* Iterate over the hash's elements */ while (zend_hash_get_current_data(Z_ARRVAL_PP(hash), (void **)&entry) == SUCCESS) { /* Convert the PHP value to its Python equivalent */ item = pip_zval_to_pyobject(entry); /* Add this item to the list and increment the position */ PyList_SetItem(list, pos++, item); /* Advance to the next entry */ zend_hash_move_forward(Z_ARRVAL_PP(hash)); } return list;}
开发者ID:demos,项目名称:Motif,代码行数:36,
示例7: MAKE_STD_ZVAL/* {{{ static zval* array_to_hash */static zval *array_to_hash(zval *array){ zval *hash, **entry; char *name_lc; /* * Well, this just transposes the array, popularly known as flipping it, or * giving it the finger. */ MAKE_STD_ZVAL(hash); array_init(hash); for (zend_hash_internal_pointer_reset(Z_ARRVAL_P(array)); zend_hash_get_current_data(Z_ARRVAL_P(array), (void**)&entry) == SUCCESS; zend_hash_move_forward(Z_ARRVAL_P(array))) { if (Z_TYPE_PP(entry) == IS_STRING) { /* * I hate case-insensitivity. Die, die, die. */ name_lc = estrndup(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry)); zend_str_tolower(name_lc, Z_STRLEN_PP(entry)); add_assoc_bool_ex(hash, name_lc, Z_STRLEN_PP(entry)+1, 1); efree(name_lc); } } return hash;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:28,
示例8: yaf_application_is_module_name/** {{{ int yaf_application_is_module_name(char *name, int len TSRMLS_DC) * 判断名称是否是已经注册了的module的名称*/int yaf_application_is_module_name(char *name, int len TSRMLS_DC) { zval *modules, **ppzval; HashTable *ht; yaf_application_t *app; /* 获取类的实例,$app = self::$_app */ app = zend_read_static_property(yaf_application_ce, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_APP), 1 TSRMLS_CC); if (!app || Z_TYPE_P(app) != IS_OBJECT) { return 0; } /* $modules = $this->_modules */ modules = zend_read_property(yaf_application_ce, app, ZEND_STRL(YAF_APPLICATION_PROPERTY_NAME_MODULES), 1 TSRMLS_CC); if (!modules || Z_TYPE_P(modules) != IS_ARRAY) { return 0; } /* 检测name是否在$this->_modules数组中,在就返回1,不在返回0 */ ht = Z_ARRVAL_P(modules); zend_hash_internal_pointer_reset(ht); while (zend_hash_get_current_data(ht, (void **)&ppzval) == SUCCESS) { if (Z_TYPE_PP(ppzval) == IS_STRING && Z_STRLEN_PP(ppzval) == len && strncasecmp(Z_STRVAL_PP(ppzval), name, len) == 0) { return 1; } zend_hash_move_forward(ht); } return 0;}
开发者ID:vicenteforever,项目名称:annotated_yaf_source,代码行数:29,
示例9: air_arr_del_index_elzval* air_arr_del_index_el(zval *arr) { HashTable *ht = Z_ARRVAL_P(arr); zval *tmp; MAKE_STD_ZVAL(tmp); array_init(tmp); for( zend_hash_internal_pointer_reset(ht); zend_hash_has_more_elements(ht) == SUCCESS; zend_hash_move_forward(ht) ){ int type; ulong idx; char *key; uint key_len; zval **tmp_data; type = zend_hash_get_current_key_ex(ht, &key, &key_len, &idx, 0, NULL); if(type == HASH_KEY_IS_STRING){ if(zend_hash_get_current_data(ht, (void**)&tmp_data) != FAILURE) { add_assoc_stringl_ex(tmp, key, key_len, Z_STRVAL_PP(tmp_data), Z_STRLEN_PP(tmp_data), 1); } } } return tmp;}
开发者ID:jaykizhou,项目名称:air,代码行数:25,
示例10: create_php_configvoid *merge_php_config(apr_pool_t *p, void *base_conf, void *new_conf){ php_conf_rec *d = base_conf, *e = new_conf, *n = NULL; php_dir_entry *pe; php_dir_entry *data; char *str; uint str_len; ulong num_index; n = create_php_config(p, "merge_php_config"); zend_hash_copy(&n->config, &e->config, NULL, NULL, sizeof(php_dir_entry)); phpapdebug((stderr, "Merge dir (%p)+(%p)=(%p)/n", base_conf, new_conf, n)); for (zend_hash_internal_pointer_reset(&d->config); zend_hash_get_current_key_ex(&d->config, &str, &str_len, &num_index, 0, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(&d->config)) { pe = NULL; zend_hash_get_current_data(&d->config, (void **) &data); if (zend_hash_find(&n->config, str, str_len, (void **) &pe) == SUCCESS) { if (pe->status >= data->status) continue; } zend_hash_update(&n->config, str, str_len, data, sizeof(*data), NULL); phpapdebug((stderr, "ADDING/OVERWRITING %s (%d vs. %d)/n", str, data->status, pe?pe->status:-1)); } return n;}
开发者ID:Doap,项目名称:php-src,代码行数:28,
示例11: ZEND_METHOD//平均数ZEND_METHOD( alinq_class , Average ){ zend_fcall_info fci; zend_fcall_info_cache fci_cache; zend_class_entry *ce; ce = Z_OBJCE_P(getThis()); zval * reArrVal; MAKE_STD_ZVAL(reArrVal); array_init(reArrVal); zval *dataSource, **tmpns; ALLOC_INIT_ZVAL(reArrVal); //持久化分配内存 zval *retval_ptr = NULL; long resulTotal = 0,averagable=0; float averNum; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "f", &fci, &fci_cache) == FAILURE) { return; } dataSource = zend_read_property(ce, getThis(), "dataSource", sizeof("dataSource")-1, 0 TSRMLS_DC); while (zend_hash_get_current_data(Z_ARRVAL_P(dataSource), (void **)&tmpns) == SUCCESS) { char *key; uint keylen; ulong idx; int type; zval **ppzval, *tmpcopy; MAKE_STD_ZVAL(tmpcopy); type = zend_hash_get_current_key_ex(Z_ARRVAL_P(dataSource), &key, &keylen,&idx, 0, NULL); //重新copy一个zval,防止破坏原数据 tmpcopy = *tmpns; zval_copy_ctor(tmpcopy); // INIT_PZVAL(tmpcopy); walu_call_anony_function(&retval_ptr, NULL, fci, "sz", key, keylen,&tmpcopy); resulTotal = resulTotal + Z_LVAL_P(retval_ptr); averagable++; // php_printf("value: %d/n", Z_LVAL_P(retval_ptr)); zend_hash_move_forward(Z_ARRVAL_P(dataSource)); } // php_printf("resulTotal: %d/n", resulTotal); // php_printf("averagable: %d/n", averagable); if(averagable > 0){ averNum = (float)resulTotal/(float)averagable; // php_printf("averagable: %f/n", averNum); RETURN_DOUBLE(averNum); } RETURN_DOUBLE(0); RETURN_ZVAL(reArrVal,1,1);}
开发者ID:wosiwo,项目名称:clinq,代码行数:57,
示例12: PHP_METHOD/* {{{ proto int symbol.setpoints(array points) Set the points of the symbol ) */ PHP_METHOD(symbolObj, setPoints){ zval *zpoints, **ppzval; HashTable *points_hash = NULL; zval *zobj = getThis(); int index = 0, flag = 0, numelements = 0; php_symbol_object *php_symbol; PHP_MAPSCRIPT_ERROR_HANDLING(TRUE); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &zpoints) == FAILURE) { PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE); return; } PHP_MAPSCRIPT_RESTORE_ERRORS(TRUE); php_symbol = (php_symbol_object *) zend_object_store_get_object(zobj TSRMLS_CC); points_hash = Z_ARRVAL_P(zpoints); numelements = zend_hash_num_elements(points_hash); if ((numelements == 0) || (numelements % 2 != 0)) { mapscript_report_php_error(E_WARNING, "symbol->setpoints : invalid array of %d element(s) as parameter." TSRMLS_CC, numelements); RETURN_LONG(MS_FAILURE); } for(zend_hash_internal_pointer_reset(points_hash); zend_hash_has_more_elements(points_hash) == SUCCESS; zend_hash_move_forward(points_hash)) { zend_hash_get_current_data(points_hash, (void **)&ppzval); if (Z_TYPE_PP(ppzval) != IS_DOUBLE) convert_to_double(*ppzval); if (!flag) { php_symbol->symbol->points[index].x = Z_DVAL_PP(ppzval); php_symbol->symbol->sizex = MS_MAX(php_symbol->symbol->sizex, php_symbol->symbol->points[index].x); } else { php_symbol->symbol->points[index].y = Z_DVAL_PP(ppzval); php_symbol->symbol->sizey = MS_MAX(php_symbol->symbol->sizey, php_symbol->symbol->points[index].y); index++; } flag = !flag; } php_symbol->symbol->numpoints = (numelements/2); RETURN_LONG(MS_SUCCESS);}
开发者ID:bb1ackwe11,项目名称:mapserver,代码行数:57,
示例13: php_map_from_HasTable/** * Convert a php Array to a map * * @param t the php Array to convert * @return the created map */map* php_map_from_HasTable(HashTable* t){#ifdef DEBUG fprintf(stderr,"mapsFromPHPArray start/n");#endif map* final_res=(map*)malloc(MAP_SIZE); final_res=NULL; char key[1024]; for(zend_hash_internal_pointer_reset(t); zend_hash_has_more_elements(t) == SUCCESS; zend_hash_move_forward(t)) { char *key; uint keylen; ulong idx; int type; int len; zval **ppzval, tmpcopy; type = zend_hash_get_current_key_ex(t, &key, &keylen, &idx, 0, NULL); if (zend_hash_get_current_data(t, (void**)&ppzval) == FAILURE) { /* Should never actually fail * since the key is known to exist. */ continue; } /** * Duplicate the zval so that * the orignal’s contents are not destroyed */ tmpcopy = **ppzval; zval_copy_ctor(&tmpcopy); /** * Reset refcount & Convert */ INIT_PZVAL(&tmpcopy); convert_to_string(&tmpcopy); if(strncmp(key,"value",5)==0){ len=Z_STRLEN_P(&tmpcopy); final_res = addToMapWithSize(final_res,key,Z_STRVAL_P(&tmpcopy),len); } else{ if(final_res==NULL){#ifdef DEBUG fprintf(stderr,"%s => %s/n",key,Z_STRVAL(tmpcopy));#endif final_res=createMap(key,Z_STRVAL(tmpcopy)); } else{#ifdef DEBUG fprintf(stderr,"%s => %s/n",key,Z_STRVAL(tmpcopy));#endif addToMap(final_res,key,Z_STRVAL(tmpcopy)); } } /* Toss out old copy */ zval_dtor(&tmpcopy); } return final_res;}
开发者ID:OSGeo,项目名称:zoo-project,代码行数:60,
示例14: PHP_METHODPHP_METHOD(Rows, next){ cassandra_rows* self = NULL; if (zend_parse_parameters_none() == FAILURE) { return; } self = (cassandra_rows*) zend_object_store_get_object(getThis() TSRMLS_CC); zend_hash_move_forward(Z_ARRVAL_P(self->rows));}
开发者ID:NSRagu,项目名称:php-driver,代码行数:12,
示例15: skyray_http_request_resolve_cookies_if_neededvoid skyray_http_request_resolve_cookies_if_needed(skyray_http_request_t *self){ if (!ZVAL_IS_NULL(&self->cookie_params)) { return; } zval *lines = skyray_http_message_get_header(&self->message, intern_str_cookie, 0); if (!lines) { return; } array_init(&self->cookie_params); zend_array *ht = Z_ARR_P(lines); zend_array *ht2; zval tmp, *data;; zend_hash_internal_pointer_reset(ht); while(zend_hash_has_more_elements(ht) == SUCCESS) { array_init(&tmp); data = zend_hash_get_current_data(ht); php_explode(intern_str_param_delimiter, Z_STR_P(data), &tmp, ZEND_LONG_MAX); ht2 = Z_ARR_P(&tmp); zend_hash_internal_pointer_reset(ht2); while (zend_hash_has_more_elements(ht2) == SUCCESS) { data = zend_hash_get_current_data(ht2); char *c = strchr(Z_STR_P(data)->val, '='); int len = c - Z_STR_P(data)->val; add_assoc_str_ex(&self->cookie_params, Z_STR_P(data)->val, len, zend_string_init(c + 1, Z_STR_P(data)->len - len - 1, 0)); zend_hash_move_forward(ht2); } zval_ptr_dtor(&tmp); zend_hash_move_forward(ht); }}
开发者ID:Lucups,项目名称:Skyray,代码行数:40,
示例16: PHP_METHODstatic PHP_METHOD(php_midgard_reflection_class, getMethods){ zval *filter = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &filter) == FAILURE) return; zval *this = getThis(); zval *class_name = NULL; zend_call_method_with_0_params(&this, zend_reflection_class_class, NULL, "getname", &class_name); zval *result = NULL; if (filter) { zend_call_method_with_1_params(&this, zend_reflection_class_class, NULL, "getmethods", &result, filter); } else { zend_call_method_with_0_params(&this, zend_reflection_class_class, NULL, "getmethods", &result); } array_init(return_value); HashTable *parent_ht = Z_ARRVAL_P(result); for( zend_hash_internal_pointer_reset(parent_ht); zend_hash_has_more_elements(parent_ht) == SUCCESS; zend_hash_move_forward(parent_ht) ) { zval **ppzval = NULL; zend_hash_get_current_data(parent_ht, (void**)&ppzval); zval *method_name = NULL; zend_call_method_with_0_params(ppzval, zend_reflection_function_class, NULL, "getname", &method_name); zval *new_obj = NULL; MAKE_STD_ZVAL(new_obj); object_init_ex(new_obj, php_midgard_reflection_method_class); zend_call_method_with_2_params(&new_obj, php_midgard_reflection_method_class, &php_midgard_reflection_method_class->constructor, "__construct", NULL, class_name, method_name ); zval_ptr_dtor(&method_name); add_next_index_zval(return_value, new_obj); } zval_ptr_dtor(&result); zval_ptr_dtor(&class_name);}
开发者ID:William-Wai,项目名称:midgard-php5,代码行数:50,
示例17: php_alinq_iterator_key//迭代函数void php_alinq_iterator_key(HashTable *arrht){ for(zend_hash_internal_pointer_reset(arrht); zend_hash_has_more_elements(arrht) == SUCCESS; zend_hash_move_forward(arrht)) { if(zend_hash_has_more_elements(arrht) == SUCCESS){ php_printf("aaaa"); }else{ php_printf("bbbb"); } }}
开发者ID:wosiwo,项目名称:clinq,代码行数:16,
示例18: php_ini_activate_config/* {{{ php_ini_activate_config */PHPAPI void php_ini_activate_config(HashTable *source_hash, int modify_type, int stage){ zend_string *str; zval *data; zend_ulong num_index; /* Walk through config hash and alter matching ini entries using the values found in the hash */ for (zend_hash_internal_pointer_reset(source_hash); zend_hash_get_current_key(source_hash, &str, &num_index) == HASH_KEY_IS_STRING; zend_hash_move_forward(source_hash) ) { data = zend_hash_get_current_data(source_hash); zend_alter_ini_entry_ex(str, Z_STR_P(data), modify_type, stage, 0); }}
开发者ID:Tyrael,项目名称:php-src,代码行数:17,
示例19: PHP/* {{{ pip_zobject_to_pyobject(zval **obj) Convert a PHP (Zend) object to a Python object */PyObject *pip_zobject_to_pyobject(zval **obj){ PyObject *dict, *item, *str; zval **entry; char *string_key; long num_key; /* * At this point, we represent a PHP object as a dictionary of * its properties. In the future, we may provide a true object * conversion (which is entirely possible, but it's more work * that I plan on doing right now). */ dict = PyDict_New(); /* Start at the beginning of the object properties hash */ zend_hash_internal_pointer_reset(Z_OBJPROP_PP(obj)); /* Iterate over the hash's elements */ while (zend_hash_get_current_data(Z_OBJPROP_PP(obj), (void **)&entry) == SUCCESS) { /* Convert the PHP value to its Python equivalent (recursion) */ item = pip_zval_to_pyobject(entry); switch (zend_hash_get_current_key(Z_OBJPROP_PP(obj), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: PyDict_SetItemString(dict, string_key, item); break; case HASH_KEY_IS_LONG: str = PyString_FromFormat("%d", num_key); PyObject_SetItem(dict, str, item); Py_DECREF(str); break; case HASH_KEY_NON_EXISTANT: php_error(E_ERROR, "No array key"); break; } /* Advance to the next entry */ zend_hash_move_forward(Z_OBJPROP_PP(obj)); } return dict;}
开发者ID:demos,项目名称:Motif,代码行数:49,
示例20: apply_configvoid apply_config(void *dummy){ php_conf_rec *d = dummy; char *str; uint str_len; php_dir_entry *data; for (zend_hash_internal_pointer_reset(&d->config); zend_hash_get_current_key(&d->config, &str, &str_len, NULL) == HASH_KEY_IS_STRING; zend_hash_move_forward(&d->config)) { zend_hash_get_current_data(&d->config, (void **) &data); phpapdebug((stderr, "APPLYING (%s)(%s)/n", str, data->value)); if (zend_alter_ini_entry(str, str_len, data->value, data->value_len, data->status, data->htaccess?PHP_INI_STAGE_HTACCESS:PHP_INI_STAGE_ACTIVATE) == FAILURE) { phpapdebug((stderr, "..FAILED/n")); } }}
开发者ID:Tyrael,项目名称:php-src,代码行数:17,
示例21: yee_behavior_attachvoid yee_behavior_attach(zval *self, zval *owner) { zend_class_entry *ce = Z_OBJCE_P(self); zval *events = NULL, **handler_ptr; char *event; int event_size; zend_update_property(ce, self, ZEND_STRL("owner"), owner); zend_call_method(&self, ce, NULL, ZEND_STRL("events"), &events, 0, NULL, NULL); if (events && Z_TYPE_P(events) == IS_ARRAY) { HashTable *ht = Z_ARRVAL_P(events); zend_hash_internal_pointer_reset(ht); while(zend_hash_has_more_elements(ht) == SUCCESS) { zend_hash_get_current_key_ex(ht, &event, &event_size, NULL, 0, NULL); zend_hash_get_current_data(ht, (void **)&handler_ptr); zval *zv_event, *zv_handler; MAKE_STD_ZVAL(zv_event); ZVAL_STRINGL(zv_event, event, event_size - 1, 0); if (Z_TYPE_PP(handler_ptr) == IS_STRING) { MAKE_STD_ZVAL(zv_handler); array_init(zv_handler); add_next_index_zval(zv_handler, self); add_next_index_zval(zv_handler, *handler_ptr); zval_addref_p(self); }else { zv_handler = *handler_ptr; } zend_call_method(&owner, Z_OBJCE_P(owner), NULL, ZEND_STRL("on"), NULL, 2, zv_event, zv_handler); efree(zv_event); if (zv_handler != *handler_ptr) { zval_ptr_dtor(&zv_handler); } zend_hash_move_forward(ht); } } zval_ptr_dtor(&events);}
开发者ID:bixuehujin,项目名称:yee,代码行数:45,
示例22: pip_hash_to_dict/* {{{ pip_hash_to_dict(zval **hash) Convert a PHP hash to a Python dictionary */PyObject *pip_hash_to_dict(zval **hash){ PyObject *dict, *item, *integer; zval **entry; char *string_key; long num_key = 0; /* Make sure we were given a PHP hash */ if (Z_TYPE_PP(hash) != IS_ARRAY) { return NULL; } /* Create a new empty dictionary */ dict = PyDict_New(); /* Let's start at the very beginning, a very good place to start. */ zend_hash_internal_pointer_reset(Z_ARRVAL_PP(hash)); /* Iterate over the hash's elements */ while (zend_hash_get_current_data(Z_ARRVAL_PP(hash), (void **)&entry) == SUCCESS) { /* Convert the PHP value to its Python equivalent (recursion) */ item = pip_zval_to_pyobject(entry); /* Assign the item with the appropriate key type (string or integer) */ switch (zend_hash_get_current_key(Z_ARRVAL_PP(hash), &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: PyDict_SetItemString(dict, string_key, item); break; case HASH_KEY_IS_LONG: integer = PyInt_FromLong(num_key); PyDict_SetItem(dict, integer, item); Py_DECREF(integer); break; } /* Advance to the next entry */ zend_hash_move_forward(Z_ARRVAL_PP(hash)); } return dict;}
开发者ID:demos,项目名称:Motif,代码行数:47,
示例23: TSRMLS_FETCH_FROM_CTXchar *owsrequest_getenv(const char *name, void *thread_context){ zval **val, **ppzval; zval *cookie_result, *key; HashTable *cookies; char *string_key = NULL, *cookie_tmp; ulong num_key; int numElements, i = 0; TSRMLS_FETCH_FROM_CTX(thread_context); if (STRING_EQUAL(name, "HTTP_COOKIE")) { cookies = PG(http_globals)[TRACK_VARS_COOKIE]->value.ht; numElements = zend_hash_num_elements(cookies); MAKE_STD_ZVAL(cookie_result); ZVAL_STRING(cookie_result, "",1); for(zend_hash_internal_pointer_reset(cookies); zend_hash_has_more_elements(cookies) == SUCCESS; zend_hash_move_forward(cookies), ++i) { zend_hash_get_current_data(cookies, (void **)&ppzval); zend_hash_get_current_key(cookies, &string_key, &num_key, 1); cookie_tmp = malloc((strlen(string_key)+Z_STRLEN_PP(ppzval)+3) * sizeof(char)); sprintf(cookie_tmp, "%s=%s;",string_key,Z_STRVAL_PP(ppzval)); MAKE_STD_ZVAL(key); ZVAL_STRING(key, cookie_tmp,1); add_string_to_string(cookie_result,cookie_result, key); zval_dtor(key); free(cookie_tmp); } return Z_STRVAL_P(cookie_result); } else { zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC); if ( PG(http_globals)[TRACK_VARS_SERVER] && (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, name, strlen(name)+1, (void **) &val) == SUCCESS) && (Z_TYPE_PP(val) == IS_STRING)) { return Z_STRVAL_PP(val); } } return NULL;}
开发者ID:bb1ackwe11,项目名称:mapserver,代码行数:45,
示例24: Z_ARRVALstatic char *_readline_command_generator(const char *text, int state){ HashTable *myht = Z_ARRVAL(_readline_array); zval **entry; if (!state) { zend_hash_internal_pointer_reset(myht); } while (zend_hash_get_current_data(myht, (void **)&entry) == SUCCESS) { zend_hash_move_forward(myht); convert_to_string_ex(entry); if (strncmp (Z_STRVAL_PP(entry), text, strlen(text)) == 0) { return (strdup(Z_STRVAL_PP(entry))); } } return NULL;}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:20,
示例25: php_print_gpcse_arraystatic void php_print_gpcse_array(char *name, uint name_length ELS_DC){ zval **data, **tmp, tmp2; char *string_key; ulong num_key; if (zend_hash_find(&EG(symbol_table), name, name_length+1, (void **) &data)!=FAILURE && ((*data)->type==IS_ARRAY)) { zend_hash_internal_pointer_reset((*data)->value.ht); while (zend_hash_get_current_data((*data)->value.ht, (void **) &tmp) == SUCCESS) { PUTS("<TR VALIGN=/"baseline/" BGCOLOR=/"" PHP_CONTENTS_COLOR "/">"); PUTS("<TD BGCOLOR=/"" PHP_ENTRY_NAME_COLOR "/"><B>"); PUTS(name); PUTS("[/""); switch (zend_hash_get_current_key((*data)->value.ht, &string_key, &num_key, 0)) { case HASH_KEY_IS_STRING: zend_html_puts(string_key, strlen(string_key)); break; case HASH_KEY_IS_LONG: php_printf("%ld",num_key); break; } PUTS("/"]</B></TD><TD>"); if ((*tmp)->type == IS_ARRAY) { PUTS("<PRE>"); zend_print_zval_r(*tmp, 0); PUTS("</PRE>"); } else if ((*tmp)->type != IS_STRING) { tmp2 = **tmp; zval_copy_ctor(&tmp2); convert_to_string(&tmp2); zend_html_puts(tmp2.value.str.val, tmp2.value.str.len); zval_dtor(&tmp2); } else { zend_html_puts((*tmp)->value.str.val, (*tmp)->value.str.len); } PUTS(" </TD></TR>/n"); zend_hash_move_forward((*data)->value.ht); } }}
开发者ID:jehurodrig,项目名称:PHP-4.0.6-16-07-2009,代码行数:41,
示例26: call_resolved_handlersstatic void call_resolved_handlers(skyray_promise_t *self, zend_array *on_fulfilled, zend_array *on_rejected){ skyray_promise_t *promise = skyray_promise_from_obj(Z_OBJ_P(&self->result)); zend_array *handlers; if (instanceof_function(Z_OBJCE_P(&self->result), skyray_ce_FulfilledPromise)) { handlers = on_fulfilled; } else { handlers = on_rejected; } zend_hash_internal_pointer_reset(handlers); while(zend_hash_has_more_elements(handlers) == SUCCESS) { promise_resolve_context_t *context = zend_hash_get_current_data_ptr(handlers); promise_resolve_context_call(context, &promise->result); zend_hash_move_forward(handlers); } zend_hash_destroy(&self->on_fulfilled); zend_hash_destroy(&self->on_rejcted);}
开发者ID:Lucups,项目名称:Skyray,代码行数:21,
示例27: yac_add_multi_implstatic int yac_add_multi_impl(char *prefix, uint prefix_len, zval *kvs, int ttl, int add TSRMLS_DC) /* {{{ */ { HashTable *ht = Z_ARRVAL_P(kvs); for (zend_hash_internal_pointer_reset(ht); zend_hash_has_more_elements(ht) == SUCCESS; zend_hash_move_forward(ht)) { char *key; ulong idx; zval **value; uint len, should_free = 0; if (zend_hash_get_current_data(ht, (void **)&value) == FAILURE) { continue; } switch (zend_hash_get_current_key_ex(ht, &key, &len, &idx, 0, NULL)) { case HASH_KEY_IS_LONG: len = spprintf(&key, 0, "%lu", idx) + 1; should_free = 1; case HASH_KEY_IS_STRING: if (yac_add_impl(prefix, prefix_len, key, len - 1, *value, ttl, add TSRMLS_CC)) { if (should_free) { efree(key); } continue; } else { if (should_free) { efree(key); } return 0; } default: continue; } } return 1;}
开发者ID:anakin,项目名称:yac,代码行数:38,
示例28: array/* {{{ xslt_make_array() Make an XSLT array (char **) from a zval array (HashTable *) */extern void xslt_make_array(zval **zarr, char ***carr){ zval **current; HashTable *arr; int idx = 0; arr = HASH_OF(*zarr); if (! arr) { php_error(E_WARNING, "Invalid argument or parameter array to %s", get_active_function_name()); return; } *carr = emalloc((zend_hash_num_elements(arr) * 2) + 1); for (zend_hash_internal_pointer_reset(arr); zend_hash_get_current_data(arr, (void **) ¤t) == SUCCESS; zend_hash_move_forward(arr)) { char *string_key = NULL; ulong num_key; int type; SEPARATE_ZVAL(current); convert_to_string_ex(current); type = zend_hash_get_current_key(arr, &string_key, &num_key, 0); if (type == HASH_KEY_IS_LONG) { php_error(E_WARNING, "Invalid argument or parameter array to %s", get_active_function_name()); return; } (*carr)[idx++] = estrdup(string_key); (*carr)[idx++] = estrndup(Z_STRVAL_PP(current), Z_STRLEN_PP(current)); } (*carr)[idx] = NULL;}
开发者ID:jehurodrig,项目名称:PHP-4.0.6-16-07-2009,代码行数:40,
示例29: yac_add_multi_implstatic int yac_add_multi_impl(char *prefix, uint prefix_len, zval *kvs, int ttl, int add tsrmls_dc) { HashTable *ht = z_arrval_p(kvs); for (zend_hash_internal_pointer_reset(ht); zend_hash_has_more_elements(ht) == success; zend_hash_move_forward(ht)) { char *key; ulong idx; zval **value; uint len, should_free = 0; if (zend_hash_get_current_data(ht, (void **)&value) == FAILURE) { continue; } switch (zend_hash_get_current_key_ex(ht, &key, &len, &idx, 0, null)) { case hash_key_is_long: len = spprintf(&key, 0, "%lu", idx) + 1; should_free = 1; case hash_key_is_string: if (yac_add_impl(prefix, prefix_len, key, len - 1, *value, ttl, add tsrmls_cc)) { if (should_free) { efree(key); } continue; } else { if (should_free) { efree(key); } return 0; } default: continue; } } return 1;}
开发者ID:BD-MCO-WEB,项目名称:mco-web-code,代码行数:38,
注:本文中的zend_hash_move_forward函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ zend_hash_move_forward_ex函数代码示例 C++ zend_hash_internal_pointer_reset_ex函数代码示例 |