• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ RETVAL_ZVAL函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中RETVAL_ZVAL函数的典型用法代码示例。如果您正苦于以下问题:C++ RETVAL_ZVAL函数的具体用法?C++ RETVAL_ZVAL怎么用?C++ RETVAL_ZVAL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了RETVAL_ZVAL函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PHP_METHOD

/**
 * Validates a value against the class constants.
 *
 * If value is a valid constant name, returns the corresponding value.
 *
 * If value is null and a default is set, returns the default value.
 *
 * @param mixed value
 *
 * @return mixed
 *
 * @throws \RuntimeException if value is null and no default exists, or if given an invalid value.
 */
PHP_METHOD(Xpl_Enum, filterValidateValue) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *value = NULL, *reflection = NULL, *constants = NULL, *_0, *_2 = NULL, *_1$$6;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 1, &value);

	if (!value) {
		ZEPHIR_CPY_WRT(value, ZEPHIR_GLOBAL(global_null));
	} else {
		ZEPHIR_SEPARATE_PARAM(value);
	}


	ZEPHIR_INIT_VAR(reflection);
	object_init_ex(reflection, zephir_get_internal_ce(SS("reflectionclass") TSRMLS_CC));
	ZEPHIR_INIT_VAR(_0);
	zephir_get_class(_0, this_ptr, 0 TSRMLS_CC);
	ZEPHIR_CALL_METHOD(NULL, reflection, "__construct", NULL, 63, _0);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&constants, reflection, "getconstants", NULL, 100);
	zephir_check_call_status();
	if (Z_TYPE_P(value) == IS_NULL) {
		ZEPHIR_OBS_NVAR(value);
		if (zephir_array_isset_string_fetch(&value, constants, SS("_default"), 0 TSRMLS_CC)) {
			RETVAL_ZVAL(value, 1, 0);
			RETURN_MM();
		}
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Missing value: no default exists", "xpl/enum.zep", 177);
		return;
	}
	if (Z_TYPE_P(value) == IS_STRING) {
		if (zephir_array_isset(constants, value)) {
			zephir_array_fetch(&_1$$6, constants, value, PH_NOISY | PH_READONLY, "xpl/enum.zep", 183 TSRMLS_CC);
			ZEPHIR_CPY_WRT(value, _1$$6);
		}
		if ((zephir_method_exists(this_ptr, value TSRMLS_CC)  == SUCCESS)) {
			ZEPHIR_RETURN_CALL_METHOD_ZVAL(this_ptr, value, NULL, 0);
			zephir_check_call_status();
			RETURN_MM();
		}
	}
	ZEPHIR_CALL_FUNCTION(&_2, "in_array", NULL, 2, value, constants, ZEPHIR_GLOBAL(global_true));
	zephir_check_call_status();
	if (!(zephir_is_true(_2))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(spl_ce_RuntimeException, "Invalid enum value", "xpl/enum.zep", 193);
		return;
	}
	RETVAL_ZVAL(value, 1, 0);
	RETURN_MM();

}
开发者ID:wells5609,项目名称:xpl,代码行数:66,代码来源:enum.zep.c


示例2: function

/*
 * This is PHP code snippet handling extend()s calls :

 $extended = function ($c) use ($callable, $factory) {
 return $callable($factory($c), $c);
 };

*/
PHP_METHOD(PimpleClosure, invoker)
{
	zval *arg = NULL, retval = {0}, newretval = {0};
	zend_fcall_info fci      = {0};
	zval args[2];
	FETCH_CUSTOM_OBJ_THIS(pimple_closure_object)

    if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &arg) == FAILURE) {
      OBJ_RELEASE((zend_object*)execute_data->func->common.prototype);
      return;
    }

	ZVAL_COPY_VALUE(&args[0], arg);
	fci.function_name = obj->factory;
	fci.params        = args;
	fci.param_count   = 1;
	fci.retval        = &retval;
	fci.size = sizeof(fci);

	if (zend_call_function(&fci, NULL) == FAILURE || EG(exception)) {
		OBJ_RELEASE((zend_object*)execute_data->func->common.prototype);
		RETVAL_ZVAL(&EG(uninitialized_zval), 1, 0);
		return;
	}

	memset(&fci, 0, sizeof(fci));
	fci.size = sizeof(fci);

	ZVAL_COPY_VALUE(&args[0], &retval);
	ZVAL_COPY_VALUE(&args[1], arg);

	fci.function_name = obj->callable;
	fci.params        = args;
	fci.param_count   = 2;
	fci.retval = &newretval;

	if (zend_call_function(&fci, NULL) == FAILURE || EG(exception)) {
		zval_ptr_dtor(&retval);
		OBJ_RELEASE((zend_object*)execute_data->func->common.prototype);
		RETVAL_ZVAL(&EG(uninitialized_zval), 1, 0);
		return;
	}

	zval_ptr_dtor(&retval);

	RETVAL_ZVAL(&newretval, 0 ,0);
	OBJ_RELEASE((zend_object*)execute_data->func->common.prototype);
}
开发者ID:ruolinn,项目名称:yaf,代码行数:56,代码来源:yaf_closure.c


示例3: PHP_METHOD

/* {{{ MongoDate::toDateTime()
 * Returns a DateTime object with the same information as the MongoDate object */
PHP_METHOD(MongoDate, toDateTime)
{
	mongo_date *date;
	int64_t     sec;
	int64_t     usec;
	double      dusec;
	char       *str;
	int         str_len;
	zval        datetime_object;
	php_date_obj *datetime_obj;
	zval *datetime_object_ptr = &datetime_object;

	date = (mongo_date*) zend_object_store_get_object(getThis() TSRMLS_CC);

	php_date_instantiate(php_date_get_date_ce(), &datetime_object TSRMLS_CC);
	mongo_date_to_parts(date, &sec, &usec, &dusec);

#ifdef WIN32
	str_len = spprintf(&str, 0, "@%I64d", (int64_t) sec);
#else
	str_len = spprintf(&str, 0, "@%lld", (long long int) sec);
#endif

	datetime_obj = zend_object_store_get_object(&datetime_object TSRMLS_CC);
	php_date_initialize(datetime_obj, str, str_len, NULL, NULL, 0 TSRMLS_CC);
	efree(str);
	datetime_obj->time->f = dusec;

	RETVAL_ZVAL(datetime_object_ptr, 0, 0);
}
开发者ID:AndrewHarkusha,项目名称:mongo-php-driver,代码行数:32,代码来源:date.c


示例4: PHP_METHOD

PHP_METHOD(MongoDB, repair)
{
	zend_bool cloned=0, original=0;
	zval *cmd, *retval;
	mongo_db *db;

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bb", &cloned, &original) == FAILURE) {
		return;
	}

	PHP_MONGO_GET_DB(getThis());

	MAKE_STD_ZVAL(cmd);
	array_init(cmd);
	add_assoc_long(cmd, "repairDatabase", 1);
	add_assoc_bool(cmd, "preserveClonedFilesOnFailure", cloned);
	add_assoc_bool(cmd, "backupOriginalFiles", original);

	retval = php_mongo_runcommand(db->link, &db->read_pref, Z_STRVAL_P(db->name), Z_STRLEN_P(db->name), cmd, NULL, 0, NULL TSRMLS_CC);

	zval_ptr_dtor(&cmd);

	if (retval) {
		RETVAL_ZVAL(retval, 0, 1);
	}
}
开发者ID:NorthBird,项目名称:mongo-php-driver-legacy,代码行数:26,代码来源:db.c


示例5: PHP_METHOD

/**
 * Returns a cached content
 *
 * @param 	string $keyName
 * @param   long $lifetime
 * @return  mixed
 */
PHP_METHOD(Phalcon_Cache_Backend_Memory, get){

	zval *key_name, *lifetime = NULL;
	zval *data, *cached_content, *frontend, *last_key;

	PHALCON_MM_GROW();

	phalcon_fetch_params(1, 1, 1, &key_name, &lifetime);
	
	if (Z_TYPE_P(key_name) == IS_NULL) {
		last_key = phalcon_fetch_nproperty_this(this_ptr, SL("_lastKey"), PH_NOISY TSRMLS_CC);
	} else {
		zval *prefix = phalcon_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY TSRMLS_CC);
	
		PHALCON_INIT_VAR(last_key);
		PHALCON_CONCAT_VV(last_key, prefix, key_name);
		phalcon_update_property_this(this_ptr, SL("_lastKey"), last_key TSRMLS_CC);
	}
	
	data = phalcon_fetch_nproperty_this(this_ptr, SL("_data"), PH_NOISY TSRMLS_CC);
	if (phalcon_array_isset_fetch(&cached_content, data, last_key)) {
		if (Z_TYPE_P(cached_content) != IS_NULL) {
			if (phalcon_is_numeric(cached_content)) {
				RETVAL_ZVAL(cached_content, 1, 0);
			} else {
				frontend = phalcon_fetch_nproperty_this(this_ptr, SL("_frontend"), PH_NOISY TSRMLS_CC);
				PHALCON_RETURN_CALL_METHOD(frontend, "afterretrieve", cached_content);
			}
		}
	}

	PHALCON_MM_RESTORE();
}
开发者ID:100851766,项目名称:cphalcon,代码行数:40,代码来源:memory.c


示例6: PHP_METHOD

/**
 * Escapes a string with htmlentities
 */
PHP_METHOD(Phalcon_Debug, _escapeString) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_nts_static zephir_fcall_cache_entry *_5 = NULL;
	zval *value, *_0, _1, _2, _3, _4;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &value);



	if (Z_TYPE_P(value) == IS_STRING) {
		ZEPHIR_INIT_VAR(_0);
		ZEPHIR_SINIT_VAR(_1);
		ZVAL_STRING(&_1, "\n", 0);
		ZEPHIR_SINIT_VAR(_2);
		ZVAL_STRING(&_2, "\\n", 0);
		zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_3);
		ZVAL_LONG(&_3, 2);
		ZEPHIR_SINIT_VAR(_4);
		ZVAL_STRING(&_4, "utf-8", 0);
		ZEPHIR_RETURN_CALL_FUNCTION("htmlentities", &_5, _0, &_3, &_4);
		zephir_check_call_status();
		RETURN_MM();
	}
	RETVAL_ZVAL(value, 1, 0);
	RETURN_MM();

}
开发者ID:flaver12,项目名称:cphalcon,代码行数:33,代码来源:debug.zep.c


示例7: PHP_METHOD

/* {{{ proto Riak\BucketPropertyList Riak\Bucket->getPropertyList()
Fetch and return a RiakBucketProperties object with properties for this bucket */
PHP_METHOD(RiakBucket, getPropertyList)
{
    riak_connection *connection;
    RIACK_STRING bucketName;
    uint32_t nVal = 3;
    uint8_t allowMult = 0;
    int riackResult;
    zval *zBucketProps, *zAllowMult, *zNVal;

    GET_RIAK_CONNECTION_RETURN_EXC_ON_ERROR(connection)

    bucketName = riack_name_from_bucket(getThis() TSRMLS_CC);
    riackResult = riack_get_bucket_props(connection->client,  bucketName, &nVal, &allowMult);

    CHECK_RIACK_STATUS_THROW_AND_RETURN_ON_ERROR(connection, riackResult);

    MAKE_STD_ZVAL(zNVal);
    ZVAL_LONG(zNVal, nVal);

    MAKE_STD_ZVAL(zAllowMult);
    ZVAL_BOOL(zAllowMult, allowMult);

    MAKE_STD_ZVAL(zBucketProps);
    object_init_ex(zBucketProps, riak_bucket_properties_ce);
    RIAK_CALL_METHOD2(RiakBucketProperties, __construct, zBucketProps, zBucketProps, zNVal, zAllowMult);
    RETVAL_ZVAL(zBucketProps, 0, 1);

    zval_ptr_dtor(&zNVal);
    zval_ptr_dtor(&zAllowMult);
}
开发者ID:radev,项目名称:php_riak,代码行数:32,代码来源:bucket.c


示例8: PHP_METHOD

/**
 * Returns an option
 */
PHP_METHOD(Phalcon_Mvc_Model_Validator, getOption) {

	zval *option_param = NULL, *defaultValue = NULL, *options, *value;
	zval *option = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &option_param, &defaultValue);

	if (unlikely(Z_TYPE_P(option_param) != IS_STRING && Z_TYPE_P(option_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'option' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(option_param) == IS_STRING)) {
		zephir_get_strval(option, option_param);
	} else {
		ZEPHIR_INIT_VAR(option);
		ZVAL_EMPTY_STRING(option);
	}
	if (!defaultValue) {
		ZEPHIR_INIT_VAR(defaultValue);
		ZVAL_STRING(defaultValue, "", 1);
	}


	options = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC);
	if (zephir_array_isset_fetch(&value, options, option, 1 TSRMLS_CC)) {
		RETURN_CTOR(value);
	}
	RETVAL_ZVAL(defaultValue, 1, 0);
	RETURN_MM();

}
开发者ID:AlloVince,项目名称:cphalcon,代码行数:35,代码来源:validator.zep.c


示例9: PHP_METHOD

PHP_METHOD(Phalcon_Debug, getFileLink) {

	zval **file, **line, **format;

	phalcon_fetch_params_ex(3, 0, &file, &line, &format);

	PHALCON_ENSURE_IS_STRING(file);
	PHALCON_ENSURE_IS_STRING(line);

	if (Z_TYPE_PP(format) == IS_STRING) {
		char *tmp, *link;
		int tmp_len, link_len;
		zval z_link = zval_used_for_init;

		tmp  = php_str_to_str_ex(Z_STRVAL_PP(format), Z_STRLEN_PP(format), SL("%f"), Z_STRVAL_PP(file), Z_STRLEN_PP(file), &tmp_len, 1, NULL);
		link = php_str_to_str_ex(tmp, tmp_len, SL("%l"), Z_STRVAL_PP(line), Z_STRLEN_PP(line), &link_len, 1, NULL);

		ZVAL_STRINGL(&z_link, link, link_len, 0);

		efree(tmp);
		PHALCON_CONCAT_SVSVS(return_value, "<a href=\"", &z_link, "\">", *file, "</a>");
		efree(link);
	}
	else {
		RETVAL_ZVAL(*file, 1, 0);
	}
}
开发者ID:Myleft,项目名称:cphalcon,代码行数:27,代码来源:debug.c


示例10: PHP_METHOD

/**
 * Get an action parameter
 *
 * @param string $key
 * @param mixed $default Default value to use if key not found
 * @return mixed
 */
PHP_METHOD(Yaf_Request_Abstract, getParam) {

	zval *_0 = NULL;
	zval *name = NULL, *tmpDefault = NULL, *_1, *_2, *_3;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &name, &tmpDefault);

	ZEPHIR_SEPARATE_PARAM(name);
	if (!tmpDefault) {
		tmpDefault = ZEPHIR_GLOBAL(global_null);
	}


	zephir_get_strval(_0, name);
	ZEPHIR_CPY_WRT(name, _0);
	_1 = zephir_fetch_nproperty_this(this_ptr, SL("params"), PH_NOISY_CC);
	if (zephir_array_isset(_1, name)) {
		_2 = zephir_fetch_nproperty_this(this_ptr, SL("params"), PH_NOISY_CC);
		zephir_array_fetch(&_3, _2, name, PH_NOISY | PH_READONLY, "yaf/request_abstract.zep", 196 TSRMLS_CC);
		RETURN_CTOR(_3);
	}
	RETVAL_ZVAL(tmpDefault, 1, 0);
	RETURN_MM();

}
开发者ID:swordkee,项目名称:yaftoz,代码行数:33,代码来源:request_abstract.zep.c


示例11: PHP_METHOD

/**
 * Escapes a column/table/schema name
 *
 * @param string|array identifier
 * @return string
 */
PHP_METHOD(Phalcon_Db_Adapter_Pdo_Mysql, escapeIdentifier) {

	zval *identifier, *domain, *name;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &identifier);



	if (Z_TYPE_P(identifier) == IS_ARRAY) {
		ZEPHIR_OBS_VAR(domain);
		zephir_array_fetch_long(&domain, identifier, 0, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 63 TSRMLS_CC);
		ZEPHIR_OBS_VAR(name);
		zephir_array_fetch_long(&name, identifier, 1, PH_NOISY, "phalcon/db/adapter/pdo/mysql.zep", 64 TSRMLS_CC);
		if (ZEPHIR_GLOBAL(db).escape_identifiers) {
			ZEPHIR_CONCAT_SVSVS(return_value, "`", domain, "`.`", name, "`");
			RETURN_MM();
		}
		ZEPHIR_CONCAT_VSV(return_value, domain, ".", name);
		RETURN_MM();
	}
	if (ZEPHIR_GLOBAL(db).escape_identifiers) {
		ZEPHIR_CONCAT_SVS(return_value, "`", identifier, "`");
		RETURN_MM();
	}
	RETVAL_ZVAL(identifier, 1, 0);
	RETURN_MM();

}
开发者ID:3axap4eHko,项目名称:cphalcon,代码行数:35,代码来源:mysql.zep.c


示例12: PHP_METHOD

/**
 * Gets an attribute from the configuration, if the attribute isn't defined returns null
 * If the value is exactly null or is not defined the default value will be used instead
 *
 *<code>
 * echo $config->get('controllersDir', '../app/controllers/');
 *</code>
 */
PHP_METHOD(Phalcon_Config, get) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *index = NULL, *defaultValue = NULL, *_0 = NULL, *_1;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &index, &defaultValue);

	ZEPHIR_SEPARATE_PARAM(index);
	if (!defaultValue) {
		defaultValue = ZEPHIR_GLOBAL(global_null);
	}


	ZEPHIR_CALL_FUNCTION(&_0, "strval", NULL, 20, index);
	zephir_check_call_status();
	ZEPHIR_CPY_WRT(index, _0);
	if (zephir_isset_property_zval(this_ptr, index TSRMLS_CC)) {
		ZEPHIR_OBS_VAR(_1);
		zephir_read_property_zval(&_1, this_ptr, index, PH_NOISY_CC);
		RETURN_CCTOR(_1);
	}
	RETVAL_ZVAL(defaultValue, 1, 0);
	RETURN_MM();

}
开发者ID:spuy767,项目名称:cphalcon,代码行数:34,代码来源:config.zep.c


示例13: PHP_METHOD

/**
 * Get label for field
 *
 * @param string field
 * @return string
 */
PHP_METHOD(Phalcon_Validation, getLabel) {

	zend_bool _0;
	zval *field, *labels = NULL, *value = NULL;

	zephir_fetch_params(0, 1, 0, &field);



	labels = zephir_fetch_nproperty_this(this_ptr, SL("_labels"), PH_NOISY_CC);
	_0 = Z_TYPE_P(labels) == IS_ARRAY;
	if (_0) {
		_0 = Z_TYPE_P(field) != IS_ARRAY;
	}
	if (_0) {
		if (zephir_array_isset_fetch(&value, labels, field, 1 TSRMLS_CC)) {
			RETURN_CTORW(value);
		}
	} else if (Z_TYPE_P(field) == IS_ARRAY) {
		zephir_fast_join_str(return_value, SL(", "), field TSRMLS_CC);
		return;
	}
	RETVAL_ZVAL(field, 1, 0);
	return;

}
开发者ID:SDpower,项目名称:cphalcon,代码行数:32,代码来源:validation.zep.c


示例14: PHP_METHOD

PHP_METHOD(MongoDB, setProfilingLevel) {
  long level;
  zval *data, *cmd_return;
  zval **ok;

  if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level) == FAILURE) {
    return;
  }

  MAKE_STD_ZVAL(data);
  array_init(data);
  add_assoc_long(data, "profile", level);

  MAKE_STD_ZVAL(cmd_return);
  MONGO_CMD(cmd_return, getThis());

  zval_ptr_dtor(&data);

  if (EG(exception)) {
    zval_ptr_dtor(&cmd_return);
    return;
  }

  if (zend_hash_find(HASH_P(cmd_return), "ok", 3, (void**)&ok) == SUCCESS &&
      ((Z_TYPE_PP(ok) == IS_BOOL && Z_BVAL_PP(ok)) || Z_DVAL_PP(ok) == 1)) {
    zend_hash_find(HASH_P(cmd_return), "was", 4, (void**)&ok);
    RETVAL_ZVAL(*ok, 1, 0);
  }
  else {
    RETVAL_NULL();
  }
  zval_ptr_dtor(&cmd_return);
}
开发者ID:cockatoo-org,项目名称:mongo-php-driver,代码行数:33,代码来源:db.c


示例15: PHP_METHOD

/**
 * Sets a service using a raw Phalcon\Di\Service definition
 */
PHP_METHOD(Phalcon_Di, setRaw) {

	zval *name_param = NULL, *rawDefinition;
	zval *name = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &name_param, &rawDefinition);

	if (unlikely(Z_TYPE_P(name_param) != IS_STRING && Z_TYPE_P(name_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'name' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(name_param) == IS_STRING)) {
		zephir_get_strval(name, name_param);
	} else {
		ZEPHIR_INIT_VAR(name);
		ZVAL_EMPTY_STRING(name);
	}


	zephir_update_property_array(this_ptr, SL("_services"), name, rawDefinition TSRMLS_CC);
	RETVAL_ZVAL(rawDefinition, 1, 0);
	RETURN_MM();

}
开发者ID:Studentsov,项目名称:cphalcon,代码行数:28,代码来源:di.zep.c


示例16: PHP_METHOD

/**
 * Reads meta-data from files
 *
 * @param string $key
 * @return array
 */
PHP_METHOD(Phalcon_Mvc_Model_MetaData_Files, read){

	zval **key, *meta_data_dir, *virtual_key;
	zval *path, *data = NULL;

	phalcon_fetch_params_ex(1, 0, &key);
	PHALCON_ENSURE_IS_STRING(key);

	PHALCON_MM_GROW();

	meta_data_dir = phalcon_fetch_nproperty_this(this_ptr, SL("_metaDataDir"), PH_NOISY TSRMLS_CC);
	
	PHALCON_INIT_VAR(virtual_key);
	phalcon_prepare_virtual_path_ex(virtual_key, Z_STRVAL_PP(key), Z_STRLEN_PP(key), '_' TSRMLS_CC);
	
	PHALCON_INIT_VAR(path);
	PHALCON_CONCAT_VVS(path, meta_data_dir, virtual_key, ".php");
	
	if (phalcon_file_exists(path TSRMLS_CC) == SUCCESS) {
		RETURN_MM_ON_FAILURE(phalcon_require_ret(&data, Z_STRVAL_P(path) TSRMLS_CC));
		RETVAL_ZVAL(data, 1, 1);
	}
	
	PHALCON_MM_RESTORE();
}
开发者ID:100851766,项目名称:cphalcon,代码行数:31,代码来源:files.c


示例17: PHP_METHOD

/**
 * Escapes a string with htmlentities
 */
PHP_METHOD(Phalcon_Debug, _escapeString) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *value, *_0$$3, _1$$3, _2$$3, _3$$3, _4$$3;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &value);



	if (Z_TYPE_P(value) == IS_STRING) {
		ZEPHIR_INIT_VAR(_0$$3);
		ZEPHIR_SINIT_VAR(_1$$3);
		ZVAL_STRING(&_1$$3, "\n", 0);
		ZEPHIR_SINIT_VAR(_2$$3);
		ZVAL_STRING(&_2$$3, "\\n", 0);
		zephir_fast_str_replace(&_0$$3, &_1$$3, &_2$$3, value TSRMLS_CC);
		ZEPHIR_SINIT_VAR(_3$$3);
		ZVAL_LONG(&_3$$3, 2);
		ZEPHIR_SINIT_VAR(_4$$3);
		ZVAL_STRING(&_4$$3, "utf-8", 0);
		ZEPHIR_RETURN_CALL_FUNCTION("htmlentities", NULL, 158, _0$$3, &_3$$3, &_4$$3);
		zephir_check_call_status();
		RETURN_MM();
	}
	RETVAL_ZVAL(value, 1, 0);
	RETURN_MM();

}
开发者ID:bschantz,项目名称:cphalcon,代码行数:32,代码来源:debug.zep.c


示例18: PHP_METHOD

/**
 * Returns an option in the validator's options
 * Returns null if the option hasn't set
 */
PHP_METHOD(Phalcon_Validation_Validator, getOption) {

	zval *key_param = NULL, *defaultValue = NULL, *options, *value;
	zval *key = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &key_param, &defaultValue);

	if (unlikely(Z_TYPE_P(key_param) != IS_STRING && Z_TYPE_P(key_param) != IS_NULL)) {
		zephir_throw_exception_string(spl_ce_InvalidArgumentException, SL("Parameter 'key' must be a string") TSRMLS_CC);
		RETURN_MM_NULL();
	}
	if (likely(Z_TYPE_P(key_param) == IS_STRING)) {
		zephir_get_strval(key, key_param);
	} else {
		ZEPHIR_INIT_VAR(key);
		ZVAL_EMPTY_STRING(key);
	}
	if (!defaultValue) {
		defaultValue = ZEPHIR_GLOBAL(global_null);
	}


	options = zephir_fetch_nproperty_this(this_ptr, SL("_options"), PH_NOISY_CC);
	if (Z_TYPE_P(options) == IS_ARRAY) {
		if (zephir_array_isset_fetch(&value, options, key, 1 TSRMLS_CC)) {
			RETURN_CTOR(value);
		}
	}
	RETVAL_ZVAL(defaultValue, 1, 0);
	RETURN_MM();

}
开发者ID:AlloVince,项目名称:cphalcon,代码行数:37,代码来源:validator.zep.c


示例19: ZEND_METHOD

ZEND_METHOD(Closure, __invoke) /* {{{ */
{
	zend_function *func = EG(current_execute_data)->function_state.function;
	zval ***arguments;
	zval *closure_result_ptr = NULL;

	arguments = emalloc(sizeof(zval**) * ZEND_NUM_ARGS());
	if (zend_get_parameters_array_ex(ZEND_NUM_ARGS(), arguments) == FAILURE) {
		efree(arguments);
		zend_error(E_RECOVERABLE_ERROR, "Cannot get arguments for calling closure");
		RETVAL_FALSE;
	} else if (call_user_function_ex(CG(function_table), NULL, this_ptr, &closure_result_ptr, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) {
		RETVAL_FALSE;
	} else if (closure_result_ptr) {
		if (Z_ISREF_P(closure_result_ptr) && return_value_ptr) {
			if (return_value) {
				zval_ptr_dtor(&return_value);
			}
			*return_value_ptr = closure_result_ptr;
		} else {
			RETVAL_ZVAL(closure_result_ptr, 1, 1);
		}
	}
	efree(arguments);

	/* destruct the function also, then - we have allocated it in get_method */
	efree(func->internal_function.function_name);
	efree(func);
}
开发者ID:m4ster-git,项目名称:nginx-on-heroku,代码行数:29,代码来源:zend_closures.c


示例20: PHP_METHOD

/* {{{ Cassandra\Timestamp::toDateTime() */
PHP_METHOD(Timestamp, toDateTime)
{
  cassandra_timestamp *self;
  zval *datetime = NULL;
  php_date_obj *datetime_obj = NULL;
  char *str;
  int str_len;

  if (zend_parse_parameters_none() == FAILURE) {
    return;
  }

  self = PHP_CASSANDRA_GET_TIMESTAMP(getThis());

  PHP5TO7_ZVAL_MAYBE_MAKE(datetime);
  php_date_instantiate(php_date_get_date_ce(), datetime TSRMLS_CC);

#if PHP_MAJOR_VERSION >= 7
  datetime_obj = php_date_obj_from_obj(Z_OBJ_P(datetime));
#else
  datetime_obj = zend_object_store_get_object(datetime TSRMLS_CC);
#endif

  str_len      = spprintf(&str, 0, "@%ld", (long) (self->timestamp / 1000));
  php_date_initialize(datetime_obj, str, str_len, NULL, NULL, 0 TSRMLS_CC);
  efree(str);

  RETVAL_ZVAL(datetime, 0, 0);
}
开发者ID:1e1,项目名称:heroku-buildpack-php-cassandra-driver,代码行数:30,代码来源:Timestamp.c



注:本文中的RETVAL_ZVAL函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ RET_ERR函数代码示例发布时间:2022-05-30
下一篇:
C++ RETURN_ZVAL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap