예제 #1
0
int php_com_saproxy_create(zend_object *com_object, zval *proxy_out, zval *index)
{
	php_com_saproxy *proxy, *rel = NULL;

	proxy = ecalloc(1, sizeof(*proxy));
	proxy->dimensions = 1;

	if (com_object->ce == php_com_saproxy_class_entry) {
		rel = (php_com_saproxy*) com_object;
		proxy->obj = rel->obj;
		proxy->dimensions += rel->dimensions;
	} else {
		proxy->obj = (php_com_dotnet_object*) com_object;
	}

	GC_ADDREF(&proxy->obj->zo);
	proxy->indices = safe_emalloc(proxy->dimensions, sizeof(zval *), 0);

	if (rel) {
		clone_indices(proxy, rel, rel->dimensions);
	}

	ZVAL_DUP(&proxy->indices[proxy->dimensions-1], index);

	zend_object_std_init(&proxy->std, php_com_saproxy_class_entry);
	proxy->std.handlers = &php_com_saproxy_handlers;
	ZVAL_OBJ(proxy_out, &proxy->std);

	return 1;
}
예제 #2
0
static union _zend_function *incomplete_class_get_method(zend_object **object, zend_string *method, const zval *key) /* {{{ */
{
	zval zobject;

	ZVAL_OBJ(&zobject, *object);
	incomplete_class_message(&zobject, E_ERROR);
	return NULL;
}
예제 #3
0
/* {{{ clone handler for Transliterator */
static zend_object *Transliterator_clone_obj( zval *object )
{
	Transliterator_object *to_orig,
	                      *to_new;
	zend_object 		  *ret_val;
	intl_error_reset( NULL );

	to_orig = Z_INTL_TRANSLITERATOR_P( object );
	intl_error_reset( INTL_DATA_ERROR_P( to_orig ) );
	ret_val = Transliterator_ce_ptr->create_object( Z_OBJCE_P( object ) );
	to_new  = php_intl_transliterator_fetch_object( ret_val );

	zend_objects_clone_members( &to_new->zo, &to_orig->zo );

	if( to_orig->utrans != NULL )
	{
		zval			tempz; /* dummy zval to pass to transliterator_object_construct */

		/* guaranteed to return NULL if it fails */
		UTransliterator *utrans = utrans_clone( to_orig->utrans, TRANSLITERATOR_ERROR_CODE_P( to_orig ) );

		if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to_orig ) ) )
			goto err;

		ZVAL_OBJ(&tempz, ret_val);
		transliterator_object_construct( &tempz, utrans,
			TRANSLITERATOR_ERROR_CODE_P( to_orig ) );

		if( U_FAILURE( TRANSLITERATOR_ERROR_CODE( to_orig ) ) )
		{
			zend_string *err_msg;
err:

			if( utrans != NULL )
				transliterator_object_destroy( to_new );

			/* set the error anyway, in case in the future we decide not to
			 * throw an error. It also helps build the error message */
			intl_error_set_code( NULL, INTL_DATA_ERROR_CODE( to_orig ) );
			intl_errors_set_custom_msg( TRANSLITERATOR_ERROR_P( to_orig ),
				"Could not clone transliterator", 0 );

			err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) );
			zend_throw_error( NULL, "%s", ZSTR_VAL(err_msg) );
			zend_string_free( err_msg ); /* if it's changed into a warning */
			/* do not destroy tempz; we need to return something */
		}
	}
	else
	{
		/* We shouldn't have unconstructed objects in the first place */
		php_error_docref( NULL, E_WARNING,
			"Cloning unconstructed transliterator." );
	}

	return ret_val;
}
예제 #4
0
파일: trytest.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_TryTest, testTry3) {

	zval _0$$3, _1$$3, _2;
	int ZEPHIR_LAST_CALL_STATUS;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&_0$$3);
	ZVAL_UNDEF(&_1$$3);
	ZVAL_UNDEF(&_2);

	ZEPHIR_MM_GROW();


	/* try_start_1: */

		ZEPHIR_INIT_VAR(&_0$$3);
		object_init_ex(&_0$$3, zend_exception_get_default(TSRMLS_C));
		ZEPHIR_INIT_VAR(&_1$$3);
		ZVAL_STRING(&_1$$3, "error!");
		ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", NULL, 24, &_1$$3);
		zephir_check_call_status_or_jump(try_end_1);
		zephir_throw_exception_debug(&_0$$3, "test/trytest.zep", 34 TSRMLS_CC);
		goto try_end_1;


	try_end_1:

	if (EG(exception)) {
		ZEPHIR_INIT_VAR(&_2);
		ZVAL_OBJ(&_2, EG(exception));
		Z_ADDREF_P(&_2);
		if (zephir_instance_of_ev(&_2, zend_exception_get_default(TSRMLS_C) TSRMLS_CC)) {
			zend_clear_exception(TSRMLS_C);
			RETURN_MM_STRING("error");
		}
	}
	RETURN_MM_BOOL(0);

}
예제 #5
0
파일: vars.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Vars, test88Issue) {

	zval *param1_param = NULL, *param2_param = NULL, _0, _1, _2, _3;
	zval param1, param2;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&param1);
	ZVAL_UNDEF(&param2);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_3);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &param1_param, &param2_param);

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


	ZEPHIR_INIT_VAR(&_0);
	ZEPHIR_CPY_WRT(&_0, &param1);
	zephir_var_dump(&_0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_1);
	ZEPHIR_CPY_WRT(&_1, &param2);
	zephir_var_dump(&_1 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_2);
	ZEPHIR_CPY_WRT(&_2, &param1);
	zephir_var_export(&_2 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_3);
	ZEPHIR_CPY_WRT(&_3, &param2);
	zephir_var_export(&_3 TSRMLS_CC);
	ZEPHIR_MM_RESTORE();

}
예제 #6
0
PHP_METHOD(Test_Oo_OoConstruct, __construct) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	


}
예제 #7
0
PHP_METHOD(test_2__closure, __invoke) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	


}
예제 #8
0
static int coro_exit_handler(zend_execute_data *execute_data)
{
    zval ex;
    zend_object *obj;
    zend_long flags = 0;
    if (sw_get_current_cid() != -1)
    {
        flags |= SW_EXIT_IN_COROUTINE;
    }
    if (SwooleG.serv && SwooleG.serv->gs->start)
    {
        flags |= SW_EXIT_IN_SERVER;
    }
    if (flags)
    {
        const zend_op *opline = EX(opline);
        zval _exit_status;
        zval *exit_status = NULL;

        if (opline->op1_type != IS_UNUSED)
        {
            if (opline->op1_type == IS_CONST)
            {
                // see: https://github.com/php/php-src/commit/e70618aff6f447a298605d07648f2ce9e5a284f5
#ifdef EX_CONSTANT
                exit_status = EX_CONSTANT(opline->op1);
#else
                exit_status = RT_CONSTANT(opline, opline->op1);
#endif
            }
            else
            {
                exit_status = EX_VAR(opline->op1.var);
            }
            if (Z_ISREF_P(exit_status))
            {
                exit_status = Z_REFVAL_P(exit_status);
            }
        }
        else
        {
            exit_status = &_exit_status;
            ZVAL_NULL(exit_status);
        }
        obj = zend_throw_error_exception(swoole_exit_exception_class_entry_ptr, "swoole exit.", 0, E_ERROR TSRMLS_CC);
        ZVAL_OBJ(&ex, obj);
        zend_update_property_long(swoole_exit_exception_class_entry_ptr, &ex, ZEND_STRL("flags"), flags);
        Z_TRY_ADDREF_P(exit_status);
        zend_update_property(swoole_exit_exception_class_entry_ptr, &ex, ZEND_STRL("status"), exit_status);
    }

    return ZEND_USER_OPCODE_DISPATCH;
}
예제 #9
0
파일: foo.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Bench_Foo, g) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	


}
예제 #10
0
파일: strings.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Strings, testEchoMultilineString) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	php_printf("%s", "\n            Hello world\n        ");

}
예제 #11
0
파일: strings.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Strings, testInternedString1) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	RETURN_STRING("\"hello");

}
예제 #12
0
PHP_METHOD(Test_ConstantsInterfaceB, testReadInterfaceConstant6) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	RETURN_STRING("test");

}
예제 #13
0
파일: issues.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Issues, test) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	php_printf("%s", "test");

}
예제 #14
0
파일: strings.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Strings, testHardcodedMultilineString) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	RETURN_STRING("\n            Hello world\n        ");

}
예제 #15
0
파일: promise.c 프로젝트: Lucups/Skyray
void skyray_promise_do_reject(skyray_promise_t *self, zval *reason, zend_bool is_copy_required)
{
    if (Z_TYPE(self->result) != IS_UNDEF) {
        return;
    }

    skyray_fulfilled_promise_t *promise = skyray_rejected_promise_new(reason, is_copy_required);
    ZVAL_OBJ(&self->result, &promise->std);

    skyray_promise_t *resolved = skyray_promise_from_obj(Z_OBJ_P(&self->result));

    call_resolved_handlers(self, &self->on_fulfilled, &self->on_rejcted);
}
예제 #16
0
파일: flow.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Flow, testDoWhile1) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	do {
	} while (1);

}
예제 #17
0
PHP_METHOD(Test_Geometry, run) {

	zephir_fcall_cache_entry *_0 = NULL;
	int count, ZEPHIR_LAST_CALL_STATUS, i;
	zval *list_param = NULL, *count_param = NULL, _1$$3, _2$$3, _3$$3, _4$$3, _5$$3, _6$$3, _7$$3, _8$$3;
	zval list;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&list);
	ZVAL_UNDEF(&_1$$3);
	ZVAL_UNDEF(&_2$$3);
	ZVAL_UNDEF(&_3$$3);
	ZVAL_UNDEF(&_4$$3);
	ZVAL_UNDEF(&_5$$3);
	ZVAL_UNDEF(&_6$$3);
	ZVAL_UNDEF(&_7$$3);
	ZVAL_UNDEF(&_8$$3);

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 2, 0, &list_param, &count_param);

	zephir_get_arrval(&list, list_param);
	count = zephir_get_intval(count_param);


	i = 0;
	while (1) {
		if (!(i < count)) {
			break;
		}
		zephir_array_fetch_long(&_1$$3, &list, i, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_2$$3, &_1$$3, 0, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_3$$3, &list, i, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_4$$3, &_3$$3, 1, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_5$$3, &list, i, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_6$$3, &_5$$3, 2, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_7$$3, &list, i, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		zephir_array_fetch_long(&_8$$3, &_7$$3, 3, PH_NOISY | PH_READONLY, "test/geometry.zep", 11 TSRMLS_CC);
		ZEPHIR_CALL_STATIC(NULL, "distancestatic", &_0, 0, &_2$$3, &_4$$3, &_6$$3, &_8$$3);
		zephir_check_call_status();
		i = (i + 1);
	}
	ZEPHIR_MM_RESTORE();

}
예제 #18
0
파일: trytest.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_TryTest, testThrow1) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(zend_exception_get_default(TSRMLS_C), "error", "test/trytest.zep", 10);
	return;

}
예제 #19
0
파일: trytest.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_TryTest, someMethod2) {

		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	

	ZEPHIR_THROW_EXCEPTION_DEBUG_STRW(spl_ce_DomainException, "some external exception", "test/trytest.zep", 123);
	return;

}
예제 #20
0
/* {{{ */
zend_bool pthreads_globals_object_connect(zend_ulong address, zend_class_entry *ce, zval *object) {
	zend_bool valid = 0;

	if (!address)
		return valid;

	if (pthreads_globals_lock()) {
		if (zend_hash_index_exists(&PTHREADS_G(objects), address)) {
			valid = 1;
		}
		pthreads_globals_unlock();
	}

	if (valid) {
		
		/*
		* This can be done outside of a critical section because there are only two possibilities:
		*	We own the object: no possible pathway to fault (read free'd memory)
		*	We don't own the object: possibly pathway to fault whether we use critical section or not:
		*		We use a critical section: we create the connection knowing that address cannot be freed while doing so
		*		however, as soon as we leave the section, and before the conext that called this routine can reference the connection
		*		object the creating context may have free'd the object.
		*		We don't use a critical section: the object may be freed while we are creating the connection, causing a fault.
		* 
		* As always, it's necessary for the programmer to retain the appropriate references so that this does not fault, creating connections
		* in a critical section would be unecessarily slow, not to mention recursively lock mutex (which is fine, but not ideal).
		*/

		if (PTHREADS_IN_CREATOR(((pthreads_object_t*)address))) {
			/* we own the object in this context */
			ZVAL_OBJ(object, &((pthreads_object_t*)address)->std);
			Z_ADDREF_P(object);
		} else {
			/* we do not own the object, create a connection */
			if (!ce) {
				/* we may not know the class, can't use ce directly
					from zend_object because it is from another context */
				ce = zend_lookup_class(
					((pthreads_object_t*)address)->std.ce->name);
			}
			object_init_ex(object, ce);
			pthreads_connect(
				(pthreads_object_t*) address,
				PTHREADS_FETCH_FROM(Z_OBJ_P(object)));
		}
	}
	
	return valid;
} /* }}} */
예제 #21
0
파일: foo.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Bench_Foo, assign_add_prop) {

	int _1;
	zend_bool _0;
	zval *n, n_sub, i, _2, _3$$3, _4$$3;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&n_sub);
	ZVAL_UNDEF(&i);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_3$$3);
	ZVAL_UNDEF(&_4$$3);

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



	ZEPHIR_CPY_WRT(&_2, n);
	_1 = 1;
	_0 = 0;
	if (ZEPHIR_GE_LONG(&_2, _1)) {
		while (1) {
			if (_0) {
				_1++;
				if (!(ZEPHIR_GE_LONG(&_2, _1))) {
					break;
				}
			} else {
				_0 = 1;
			}
			ZEPHIR_INIT_NVAR(&i);
			ZVAL_LONG(&i, _1);
			ZEPHIR_INIT_NVAR(&_4$$3);
			ZVAL_LONG(&_4$$3, 2);
			ZEPHIR_ADD_ASSIGN(&_3$$3, &_4$$3)
			zephir_update_property_zval(this_ptr, SL("b"), &_3$$3);
		}
	}
	ZEPHIR_MM_RESTORE();

}
예제 #22
0
파일: sqrt.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Optimizers_Sqrt, testIntValue2) {

	zval _0;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&_0);


	ZVAL_LONG(&_0, 16);
	RETURN_DOUBLE(sqrt(16));

}
예제 #23
0
파일: concat.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Concat, getTestProperty) {

	zval _0;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&_0);


	zephir_read_static_property_ce(&_0, test_concat_ce, SL("testProperty"), PH_NOISY_CC | PH_READONLY);
	RETURN_CTORW(_0);

}
예제 #24
0
파일: foo.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Bench_Foo, write_static) {

	int _1;
	zend_bool _0;
	zval *n, n_sub, i, _2, _3$$3;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&n_sub);
	ZVAL_UNDEF(&i);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_3$$3);

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



	ZEPHIR_CPY_WRT(&_2, n);
	_1 = 1;
	_0 = 0;
	if (ZEPHIR_GE_LONG(&_2, _1)) {
		while (1) {
			if (_0) {
				_1++;
				if (!(ZEPHIR_GE_LONG(&_2, _1))) {
					break;
				}
			} else {
				_0 = 1;
			}
			ZEPHIR_INIT_NVAR(&i);
			ZVAL_LONG(&i, _1);
			ZEPHIR_INIT_ZVAL_NREF(_3$$3);
			ZVAL_LONG(&_3$$3, 0);
			zephir_update_static_property_ce(test_bench_foo_ce, SL("a"), &_3$$3);
		}
	}
	ZEPHIR_MM_RESTORE();

}
예제 #25
0
파일: foo.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Bench_Foo, empty_prop) {

	int _1;
	zend_bool x = 0, _0;
	zval *n, n_sub, i, _2, _3$$3;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&n_sub);
	ZVAL_UNDEF(&i);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_3$$3);

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



	ZEPHIR_CPY_WRT(&_2, n);
	_1 = 1;
	_0 = 0;
	if (ZEPHIR_GE_LONG(&_2, _1)) {
		while (1) {
			if (_0) {
				_1++;
				if (!(ZEPHIR_GE_LONG(&_2, _1))) {
					break;
				}
			} else {
				_0 = 1;
			}
			ZEPHIR_INIT_NVAR(&i);
			ZVAL_LONG(&i, _1);
			ZEPHIR_OBS_NVAR(&_3$$3);
			zephir_read_property(&_3$$3, this_ptr, SL("b"), PH_NOISY_CC);
			x = ZEPHIR_IS_EMPTY(&_3$$3);
		}
	}
	ZEPHIR_MM_RESTORE();

}
예제 #26
0
PHP_METHOD(Test_Fibonnaci, fibArray) {

	int i = 0, n = 0, k = 0, j = 0;
	zval fib, a, b, c, _0;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&fib);
	ZVAL_UNDEF(&a);
	ZVAL_UNDEF(&b);
	ZVAL_UNDEF(&c);
	ZVAL_UNDEF(&_0);

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(&fib);
	zephir_create_array(&fib, 2, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_0);
	ZVAL_LONG(&_0, 0);
	zephir_array_fast_append(&fib, &_0);
	ZEPHIR_INIT_NVAR(&_0);
	ZVAL_LONG(&_0, 1);
	zephir_array_fast_append(&fib, &_0);
	i = 2;
	n = 10;
	while (1) {
		if (!(i < n)) {
			break;
		}
		k = (i - 1);
		j = (i - 2);
		zephir_array_fetch_long(&a, &fib, k, PH_NOISY | PH_READONLY, "test/fibonnaci.zep", 51 TSRMLS_CC);
		zephir_array_fetch_long(&b, &fib, j, PH_NOISY | PH_READONLY, "test/fibonnaci.zep", 52 TSRMLS_CC);
		ZEPHIR_INIT_NVAR(&c);
		zephir_add_function(&c, &a, &b);
		zephir_array_update_long(&fib, i, &c, PH_COPY | PH_SEPARATE ZEPHIR_DEBUG_PARAMS_DUMMY);
		i++;
	}
	RETURN_CCTOR(fib);

}
예제 #27
0
파일: foo.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Bench_Foo, call) {

	zend_bool _0;
	zephir_fcall_cache_entry *_3 = NULL;
	int ZEPHIR_LAST_CALL_STATUS, _1;
	zval *n, n_sub, i, _2;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&n_sub);
	ZVAL_UNDEF(&i);
	ZVAL_UNDEF(&_2);

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



	ZEPHIR_CPY_WRT(&_2, n);
	_1 = 1;
	_0 = 0;
	if (ZEPHIR_GE_LONG(&_2, _1)) {
		while (1) {
			if (_0) {
				_1++;
				if (!(ZEPHIR_GE_LONG(&_2, _1))) {
					break;
				}
			} else {
				_0 = 1;
			}
			ZEPHIR_INIT_NVAR(&i);
			ZVAL_LONG(&i, _1);
			ZEPHIR_CALL_METHOD(NULL, this_ptr, "g", &_3, 0);
			zephir_check_call_status();
		}
	}
	ZEPHIR_MM_RESTORE();

}
예제 #28
0
파일: foo.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Bench_Foo, read_const) {

	int _1;
	zend_bool _0;
	zval *n, n_sub, i, x, _2;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&n_sub);
	ZVAL_UNDEF(&i);
	ZVAL_UNDEF(&x);
	ZVAL_UNDEF(&_2);

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



	ZEPHIR_CPY_WRT(&_2, n);
	_1 = 1;
	_0 = 0;
	if (ZEPHIR_GE_LONG(&_2, _1)) {
		while (1) {
			if (_0) {
				_1++;
				if (!(ZEPHIR_GE_LONG(&_2, _1))) {
					break;
				}
			} else {
				_0 = 1;
			}
			ZEPHIR_INIT_NVAR(&i);
			ZVAL_LONG(&i, _1);
			ZEPHIR_INIT_NVAR(&x);
			ZVAL_LONG(&x, 0);
		}
	}
	ZEPHIR_MM_RESTORE();

}
예제 #29
0
파일: vars.zep.c 프로젝트: Mrhjx2/zephir
PHP_METHOD(Test_Vars, testVarExport) {

	zval __$false, a, ar, ret, _0, _1, _2;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_BOOL(&__$false, 0);
	ZVAL_UNDEF(&a);
	ZVAL_UNDEF(&ar);
	ZVAL_UNDEF(&ret);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_2);

	ZEPHIR_MM_GROW();

	ZEPHIR_INIT_VAR(&a);
	ZVAL_STRING(&a, "hello");
	ZEPHIR_INIT_VAR(&ar);
	zephir_create_array(&ar, 3, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_0);
	ZVAL_LONG(&_0, 1);
	zephir_array_fast_append(&ar, &_0);
	ZEPHIR_INIT_NVAR(&_0);
	ZVAL_STRING(&_0, "world");
	zephir_array_fast_append(&ar, &_0);
	zephir_array_fast_append(&ar, &__$false);
	ZEPHIR_INIT_VAR(&_1);
	ZEPHIR_CPY_WRT(&_1, &ar);
	zephir_var_export(&_1 TSRMLS_CC);
	ZEPHIR_INIT_VAR(&ret);
	zephir_var_export_ex(&ret, &ar TSRMLS_CC);
	ZEPHIR_INIT_VAR(&_2);
	ZEPHIR_CPY_WRT(&_2, &a);
	zephir_var_export(&_2 TSRMLS_CC);
	ZEPHIR_INIT_NVAR(&ret);
	zephir_var_export_ex(&ret, &a TSRMLS_CC);
	RETURN_CCTOR(ret);

}
예제 #30
0
PHP_METHOD(Test_Statements, testPropertyAcccessAvoidTmpReuse) {

	zval result1, result2, result3, result4, _0, _1, _2, _3, _4, _5, _6, _7;
		zval this_zv;
	zval *this_ptr = getThis();
	if (EXPECTED(this_ptr)) {
		ZVAL_OBJ(&this_zv, Z_OBJ_P(this_ptr));
		this_ptr = &this_zv;
	} else this_ptr = NULL;
	
	ZVAL_UNDEF(&result1);
	ZVAL_UNDEF(&result2);
	ZVAL_UNDEF(&result3);
	ZVAL_UNDEF(&result4);
	ZVAL_UNDEF(&_0);
	ZVAL_UNDEF(&_1);
	ZVAL_UNDEF(&_2);
	ZVAL_UNDEF(&_3);
	ZVAL_UNDEF(&_4);
	ZVAL_UNDEF(&_5);
	ZVAL_UNDEF(&_6);
	ZVAL_UNDEF(&_7);

	ZEPHIR_MM_GROW();

	zephir_read_property(&_0, this_ptr, SL("tmp2"), PH_NOISY_CC | PH_READONLY);
	zephir_read_property(&_1, this_ptr, SL("tmp1"), PH_NOISY_CC | PH_READONLY);
	ZEPHIR_INIT_VAR(&result1);
	zephir_fast_strpos(&result1, &_0, &_1, 0 );
	zephir_read_property(&_2, this_ptr, SL("tmp2"), PH_NOISY_CC | PH_READONLY);
	zephir_read_property(&_3, this_ptr, SL("tmp1"), PH_NOISY_CC | PH_READONLY);
	ZEPHIR_INIT_VAR(&result2);
	zephir_fast_strpos(&result2, &_2, &_3, 0 );
	zephir_read_property(&_4, this_ptr, SL("tmp2"), PH_NOISY_CC | PH_READONLY);
	zephir_read_property(&_5, this_ptr, SL("tmp1"), PH_NOISY_CC | PH_READONLY);
	ZEPHIR_INIT_VAR(&result3);
	zephir_fast_strpos(&result3, &_4, &_5, 0 );
	zephir_read_property(&_6, this_ptr, SL("tmp2"), PH_NOISY_CC | PH_READONLY);
	zephir_read_property(&_7, this_ptr, SL("tmp1"), PH_NOISY_CC | PH_READONLY);
	ZEPHIR_INIT_VAR(&result4);
	zephir_fast_strpos(&result4, &_6, &_7, 0 );
	ZEPHIR_MM_RESTORE();

}