Publishing new extension on pecl.php.net

[email protected] (Марк Крейн) Sat, 22 May 2010 09:08:14 +0400
Newsgroups php.pecl.dev
Message-ID <[email protected]>
Hello,

My name is Mark, I would like to publish my extension on your servers. Let me briefly introduce my work.

My extension contains routines for geometrical calculations. For example it can be very easy to calculate rectangle square or size, the length of the cube diagonal or its size. I intend to create many other functions to work with different geometrical figures.

I'm also going to maintain my extension and properly fix any bugs which one may have find. 

I'm posting here a bit of my code so that you can judge my skills and decide if it is possible for me to have a PECL account now or not.

===========
PHP_FUNCTION(get_triangle_simple_square)
{
    double side_a, altitude_a;
    double result;
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &side_a, &altitude_a) == FAILURE)
    {
	return;
    }	
    
    if (side_a <= 0 || altitude_a <= 0)
    {
	zend_error(E_WARNING, ERROR_SIZE);
    }	
    
    result = (side_a * altitude_a) / 2;
    RETURN_DOUBLE(result);
}

PHP_FUNCTION(get_triangle_square_rcs)
{
    double side_a, side_b, side_c, rcs, result;
    if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddd", &side_a, &side_b, &side_c, &rcs) == FAILURE)
    {
	return;
    }	
    
    if (side_a <= 0 || side_b <= 0 || side_c <= 0 || rcs <=0)
    {
	 zend_error(E_WARNING, ERROR_SIZE);
	 RETURN_FALSE;
    }
    
    result = (side_a*side_b*side_c)/(4*rcs);
    RETURN_DOUBLE(result);
}
================================

Those are the functions for calculating triangle square in two different ways. While the first function does it in a very simple manner, the other one requires one to know the length of the radius of circumscribed sphere around the triangle. This way it gets very easy for the person using my extension: any data he or she knows about the needed geometrical figure will work. 

I'm waiting for an answer.

Best regards,

Mark.