Set cubic threshold (?) */
PHP_FUNCTION(ming_setCubicThreshold)
{
- zval **num;
+ long num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
+ return;
}
- convert_to_long_ex(num);
- Ming_setCubicThreshold(Z_LVAL_PP(num));
+
+ Ming_setCubicThreshold(num);
}
/* }}} */
-/* {{{ proto void ming_setscale(int scale)
+/* {{{ proto void ming_setscale(float scale)
Set scale (?) */
PHP_FUNCTION(ming_setScale)
{
- zval **num;
+ double num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &num) == FAILURE) {
+ return;
}
- convert_to_double_ex(num);
- Ming_setScale(FLOAT_Z_DVAL_PP(num));
+
+ Ming_setScale((float)num);
}
/* }}} */
Use SWF version (?) */
PHP_FUNCTION(ming_useSWFVersion)
{
- zval **num;
+ long num;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
+ return;
}
- convert_to_long_ex(num);
- Ming_useSWFVersion(Z_LVAL_PP(num));
+
+ Ming_useSWFVersion(num);
}
/* }}} */
Use constant pool (?) */
PHP_FUNCTION(ming_useConstants)
{
- zval **num;
+ long num;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(num);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
+ return;
+ }
- Ming_useConstants(Z_LVAL_PP(num));
+ Ming_useConstants(num);
}
/* }}} */
#endif
/* {{{ set output compression */
PHP_FUNCTION(ming_setSWFCompression)
{
- zval **num;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &num) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(num);
- Ming_setSWFCompression(Z_LVAL_PP(num));
+ long num;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &num) == FAILURE) {
+ return;
+ }
+
+ Ming_setSWFCompression(num);
}
/* }}} */
#endif
PHP_METHOD(swfaction, __construct)
{
SWFAction action;
- zval **script;
- int ret;
+ char *script;
+ int script_len, ret;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &script) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script, &script_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(script);
- action = compileSWFActionCode(Z_STRVAL_PP(script));
+ action = compileSWFActionCode(script);
if (!action) {
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Couldn't compile actionscript");
SWFInput input, maskinput;
int ret;
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &zfile) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &zfile, &zmask) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|Z", &zfile, &zmask) == FAILURE) {
+ return;
}
if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
Sets the character for this button's hit test state */
PHP_METHOD(swfbutton, setHit)
{
- zval **zchar;
+ zval *zchar;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFCharacter character;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
+ character = getCharacter(zchar TSRMLS_CC);
SWFButton_addShape(button, character, SWFBUTTONRECORD_HITSTATE);
}
/* }}} */
Sets the character for this button's over state */
PHP_METHOD(swfbutton, setOver)
{
- zval **zchar;
+ zval *zchar;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFCharacter character;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
+
+ character = getCharacter(zchar TSRMLS_CC);
SWFButton_addShape(button, character, SWFBUTTONRECORD_OVERSTATE);
}
/* }}} */
Sets the character for this button's up state */
PHP_METHOD(swfbutton, setUp)
{
- zval **zchar;
+ zval *zchar;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFCharacter character;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
+
+ character = getCharacter(zchar TSRMLS_CC);
SWFButton_addShape(button, character, SWFBUTTONRECORD_UPSTATE);
}
/* }}} */
Sets the character for this button's down state */
PHP_METHOD(swfbutton, setDown)
{
- zval **zchar;
+ zval *zchar;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFCharacter character;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
-
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
+
+ character = getCharacter(zchar TSRMLS_CC);
SWFButton_addShape(button, character, SWFBUTTONRECORD_DOWNSTATE);
}
/* }}} */
Sets the character to display for the condition described in flags */
PHP_METHOD(swfbutton, addShape)
{
- zval **zchar, **flags;
+ zval *zchar;
+ long flags;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFCharacter character;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zchar, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zchar, &flags) == FAILURE) {
+ return;
}
- convert_to_object_ex(zchar);
- character = getCharacter(*zchar TSRMLS_CC);
- convert_to_long_ex(flags);
- SWFButton_addShape(button, character, BYTE_Z_LVAL_PP(flags));
+ character = getCharacter(zchar TSRMLS_CC);
+ SWFButton_addShape(button, character, (byte)flags);
}
/* }}} */
PHP_METHOD(swfbutton, setMenu)
{
- zval **zflag;
+ long zflag;
SWFButton button = getButton(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zflag) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zflag);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zflag) == FAILURE) {
+ return;
+ }
- SWFButton_setMenu(button, Z_LVAL_PP(zflag));
+ SWFButton_setMenu(button, zflag);
}
/* }}} */
#endif
Sets the action to perform when button is pressed */
PHP_METHOD(swfbutton, setAction)
{
- zval **zaction;
+ zval *zaction;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFAction action;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zaction) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zaction) == FAILURE) {
+ return;
}
- convert_to_object_ex(zaction);
- action = getAction(*zaction TSRMLS_CC);
+ action = getAction(zaction TSRMLS_CC);
SWFButton_addAction(button, action, SWFBUTTON_OVERDOWNTOOVERUP);
}
/* }}} */
PHP_METHOD(swfbutton, addSound)
{
- zval **zsound, **flags;
+ zval *zsound;
+ long flags;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFSound sound;
SWFSoundInstance item;
int ret;
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zsound, &flags) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zsound);
- sound = getSound(*zsound TSRMLS_CC);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zsound, &flags) == FAILURE) {
+ return;
+ }
- convert_to_long_ex(flags);
+ sound = getSound(zsound TSRMLS_CC);
- item = SWFButton_addSound(button, sound, Z_LVAL_PP(flags));
+ item = SWFButton_addSound(button, sound, flags);
- if(item != NULL) {
+ if (item != NULL) {
/* try and create a soundinstance object */
ret = zend_list_insert(item, le_swfsoundinstancep);
object_init_ex(return_value, soundinstance_class_entry_ptr);
Sets the action to perform when conditions described in flags is met */
PHP_METHOD(swfbutton, addAction)
{
- zval **zaction, **flags;
+ zval *zaction;
+ long flags;
SWFButton button = getButton(getThis() TSRMLS_CC);
SWFAction action;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zaction, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zaction, &flags) == FAILURE) {
+ return;
}
- convert_to_object_ex(zaction);
- action = getAction(*zaction TSRMLS_CC);
- convert_to_long_ex(flags);
- SWFButton_addAction(button, action, Z_LVAL_PP(flags));
+ action = getAction(zaction TSRMLS_CC);
+ SWFButton_addAction(button, action, flags);
}
/* }}} */
Returns the action flag for keyPress(char) */
PHP_FUNCTION(ming_keypress)
{
- zval **key;
+ char *key;
+ int key_len;
char c;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &key) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(key);
- if (Z_STRLEN_PP(key) > 1) {
+ if (key_len > 1) {
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Only one character expected");
}
- c = Z_STRVAL_PP(key)[0];
+ c = key[0];
RETURN_LONG((c&0x7f)<<9);
}
/* }}} */
}
/* }}} */
-/* {{{ proto void swfdisplayitem::moveTo(int x, int y)
+/* {{{ proto void swfdisplayitem::moveTo(float x, float y)
Moves this SWFDisplayItem to movie coordinates (x, y) */
PHP_METHOD(swfdisplayitem, moveTo)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_moveTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+ SWFDisplayItem_moveTo(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Displaces this SWFDisplayItem by (dx, dy) in movie coordinates */
PHP_METHOD(swfdisplayitem, move)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_move(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+ SWFDisplayItem_move(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Scales this SWFDisplayItem by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
PHP_METHOD(swfdisplayitem, scaleTo)
{
- zval **x, **y;
+ double x, y;
+ int argc = ZEND_NUM_ARGS();
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(x));
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(argc TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
+ return;
}
+
+ SWFDisplayItem_scaleTo(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float) (argc == 1 ? x : y));
}
/* }}} */
Multiplies this SWFDisplayItem's current x scale by xScale, its y scale by yScale */
PHP_METHOD(swfdisplayitem, scale)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_scale(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+ SWFDisplayItem_scale(getDisplayItem(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Rotates this SWFDisplayItem the given (clockwise) degrees from its original orientation */
PHP_METHOD(swfdisplayitem, rotateTo)
{
- zval **degrees;
+ double degrees;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, °rees) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
+ return;
}
- convert_to_double_ex(degrees);
- SWFDisplayItem_rotateTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));
+ SWFDisplayItem_rotateTo(getDisplayItem(getThis() TSRMLS_CC), (float)degrees);
}
/* }}} */
Rotates this SWFDisplayItem the given (clockwise) degrees from its current orientation */
PHP_METHOD(swfdisplayitem, rotate)
{
- zval **degrees;
+ double degrees;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, °rees) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
+ return;
}
- convert_to_double_ex(degrees);
- SWFDisplayItem_rotate(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));
+ SWFDisplayItem_rotate(getDisplayItem(getThis() TSRMLS_CC), (float)degrees);
}
/* }}} */
Sets this SWFDisplayItem's x skew value to xSkew */
PHP_METHOD(swfdisplayitem, skewXTo)
{
- zval **x;
+ double x;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- SWFDisplayItem_skewXTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));
+ SWFDisplayItem_skewXTo(getDisplayItem(getThis() TSRMLS_CC), (float)x);
}
/* }}} */
Adds xSkew to this SWFDisplayItem's x skew value */
PHP_METHOD(swfdisplayitem, skewX)
{
- zval **x;
+ double x;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- SWFDisplayItem_skewX(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));
+ SWFDisplayItem_skewX(getDisplayItem(getThis() TSRMLS_CC), (float)x);
}
/* }}} */
Sets this SWFDisplayItem's y skew value to ySkew */
PHP_METHOD(swfdisplayitem, skewYTo)
{
- zval **y;
+ double y;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(y);
- SWFDisplayItem_skewYTo(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));
+ SWFDisplayItem_skewYTo(getDisplayItem(getThis() TSRMLS_CC), (float)y);
}
/* }}} */
Adds ySkew to this SWFDisplayItem's y skew value */
PHP_METHOD(swfdisplayitem, skewY)
{
- zval **y;
+ double y;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(y);
- SWFDisplayItem_skewY(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));
+ SWFDisplayItem_skewY(getDisplayItem(getThis() TSRMLS_CC), (float)y);
}
/* }}} */
Sets the item's transform matrix */
PHP_METHOD(swfdisplayitem, setMatrix)
{
- zval **a, **b, **c, **d, **x, **y;
+ double a, b, c, d, x, y;
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &a, &b, &c, &d, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &a, &b, &c, &d, &x, &y) == FAILURE) {
+ return;
}
-
- convert_to_double_ex(a);
- convert_to_double_ex(b);
- convert_to_double_ex(c);
- convert_to_double_ex(d);
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFDisplayItem_setMatrix( getDisplayItem(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(a), FLOAT_Z_DVAL_PP(b), FLOAT_Z_DVAL_PP(c), FLOAT_Z_DVAL_PP(d), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y)
- );
+ SWFDisplayItem_setMatrix(getDisplayItem(getThis() TSRMLS_CC), (float)a, (float)b, (float)c, (float)d, (float)x, (float)y);
}
/* }}} */
Sets this SWFDisplayItem's z-depth to depth. Items with higher depth values are drawn on top of those with lower values */
PHP_METHOD(swfdisplayitem, setDepth)
{
- zval **depth;
+ long depth;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &depth) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &depth) == FAILURE) {
+ return;
}
- convert_to_long_ex(depth);
- SWFDisplayItem_setDepth(getDisplayItem(getThis() TSRMLS_CC), Z_LVAL_PP(depth));
+ SWFDisplayItem_setDepth(getDisplayItem(getThis() TSRMLS_CC), depth);
}
/* }}} */
Sets this SWFDisplayItem's ratio to ratio. Obviously only does anything if displayitem was created from an SWFMorph */
PHP_METHOD(swfdisplayitem, setRatio)
{
- zval **ratio;
+ double ratio;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &ratio) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &ratio) == FAILURE) {
+ return;
}
- convert_to_double_ex(ratio);
- SWFDisplayItem_setRatio(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(ratio));
+ SWFDisplayItem_setRatio(getDisplayItem(getThis() TSRMLS_CC), (float)ratio);
}
/* }}} */
Sets the add color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 0 */
PHP_METHOD(swfdisplayitem, addColor)
{
- zval **r, **g, **b, **za;
- int a = 0;
+ long r, g, b, a = 0;
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(za);
- a = Z_LVAL_PP(za);
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
}
-
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- SWFDisplayItem_setColorAdd(getDisplayItem(getThis() TSRMLS_CC), Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b), a);
+ SWFDisplayItem_setColorAdd(getDisplayItem(getThis() TSRMLS_CC), r, g, b, (int)a);
}
/* }}} */
Sets the multiply color part of this SWFDisplayItem's CXform to (r, g, b [, a]), a defaults to 1.0 */
PHP_METHOD(swfdisplayitem, multColor)
{
- zval **r, **g, **b, **za;
- float a = 1.0f;
+ double r, g, b, a = 1.0;
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(za);
- a = FLOAT_Z_DVAL_PP(za);
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd|d", &r, &g, &b, &a) == FAILURE) {
+ return;
}
- convert_to_double_ex(r);
- convert_to_double_ex(g);
- convert_to_double_ex(b);
-
- SWFDisplayItem_setColorMult(getDisplayItem(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r), FLOAT_Z_DVAL_PP(g), FLOAT_Z_DVAL_PP(b), a);
+ SWFDisplayItem_setColorMult(getDisplayItem(getThis() TSRMLS_CC), (float)r, (float)g, (float)b, (float)a);
}
/* }}} */
Sets this SWFDisplayItem's name to name */
PHP_METHOD(swfdisplayitem, setName)
{
- zval **name;
+ char *name;
+ int name_len;
SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ return;
}
-
- convert_to_string_ex(name);
- SWFDisplayItem_setName(item, Z_STRVAL_PP(name));
+
+ SWFDisplayItem_setName(item, name);
}
/* }}} */
Adds this SWFAction to the given SWFSprite instance */
PHP_METHOD(swfdisplayitem, addAction)
{
- zval **zaction, **flags;
+ zval *zaction;
+ long flags;
SWFAction action;
SWFDisplayItem item = getDisplayItem(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zaction, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ol", &zaction, &flags) == FAILURE) {
+ return;
}
- convert_to_object_ex(zaction);
- convert_to_long_ex(flags);
- action = getAction(*zaction TSRMLS_CC);
- SWFDisplayItem_addAction(item, action, Z_LVAL_PP(flags));
+ action = getAction(zaction TSRMLS_CC);
+ SWFDisplayItem_addAction(item, action, flags);
}
/* }}} */
PHP_METHOD(swfdisplayitem, setMaskLevel)
{
- zval **level;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &level) == FAILURE)
- WRONG_PARAM_COUNT;
+ long level;
- convert_to_long_ex(level);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &level) == FAILURE) {
+ return;
+ }
- SWFDisplayItem_setMaskLevel(getDisplayItem(getThis() TSRMLS_CC), Z_LVAL_PP(level));
+ SWFDisplayItem_setMaskLevel(getDisplayItem(getThis() TSRMLS_CC), level);
}
/* }}} */
Moves this SWFFill to shape coordinates (x,y) */
PHP_METHOD(swffill, moveTo)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
-
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFFill_moveTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+
+ SWFFill_moveTo(getFill(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Scales this SWFFill by xScale in the x direction, yScale in the y, or both to xScale if only one arg */
PHP_METHOD(swffill, scaleTo)
{
- zval **x, **y;
-
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(x));
- } else if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
- } else {
- WRONG_PARAM_COUNT;
+ double x, y;
+ int argc = ZEND_NUM_ARGS();
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d|d", &x, &y) == FAILURE) {
+ return;
}
+
+ SWFFill_scaleXYTo(getFill(getThis() TSRMLS_CC), (float)x, (float)(argc == 1 ? x : y));
}
/* }}} */
Rotates this SWFFill the given (clockwise) degrees from its original orientation */
PHP_METHOD(swffill, rotateTo)
{
- zval **degrees;
+ double degrees;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, °rees) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", °rees) == FAILURE) {
+ return;
}
- convert_to_double_ex(degrees);
- SWFFill_rotateTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(degrees));
+
+ SWFFill_rotateTo(getFill(getThis() TSRMLS_CC), (float)degrees);
}
/* }}} */
Sets this SWFFill's x skew value to xSkew */
PHP_METHOD(swffill, skewXTo)
{
- zval **x;
+ double x;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &x) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &x) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- SWFFill_skewXTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x));
+
+ SWFFill_skewXTo(getFill(getThis() TSRMLS_CC), (float)x);
}
/* }}} */
Sets this SWFFill's y skew value to ySkew */
PHP_METHOD(swffill, skewYTo)
{
- zval **y;
+ double y;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(y);
- SWFFill_skewYTo(getFill(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(y));
+
+ SWFFill_skewYTo(getFill(getThis() TSRMLS_CC), (float)y);
}
/* }}} */
static const zend_function_entry swffill_functions[] = {
adds characters to a font for exporting font */
PHP_METHOD(swffontchar, addChars)
{
- zval **zstring;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
+ char *zstring;
+ int zstring_len;
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- SWFFontCharacter_addChars(getFontCharacter(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ SWFFontCharacter_addChars(getFontCharacter(getThis() TSRMLS_CC), zstring);
}
/* }}} */
PHP_METHOD(swffontchar, addUTF8Chars)
{
- zval **zstring;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
+ char *zstring;
+ int zstring_len;
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- SWFFontCharacter_addUTF8Chars(getFontCharacter(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ SWFFontCharacter_addUTF8Chars(getFontCharacter(getThis() TSRMLS_CC), zstring);
}
/* }}} */
Creates a new SWFFont object from given file */
PHP_METHOD(swffont, __construct)
{
- zval **zfile;
+ char *zfile;
+ int zfile_len, ret;
SWFFont font;
- int ret;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfile) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zfile, &zfile_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(zfile);
-
- if (strcmp(Z_STRVAL_PP(zfile)+Z_STRLEN_PP(zfile)-4, ".fdb") == 0) {
+ if (strcmp(zfile + zfile_len - 4, ".fdb") == 0) {
php_stream * stream;
FILE * file;
- stream = php_stream_open_wrapper(Z_STRVAL_PP(zfile), "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
+ stream = php_stream_open_wrapper(zfile, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL);
if (stream == NULL) {
RETURN_FALSE;
font = loadSWFFontFromFile(file);
php_stream_close(stream);
} else {
- PHP_MING_FILE_CHK(Z_STRVAL_PP(zfile));
- font = (SWFFont)newSWFBrowserFont(Z_STRVAL_PP(zfile));
+ PHP_MING_FILE_CHK(zfile);
+ font = (SWFFont)newSWFBrowserFont(zfile);
}
ret = zend_list_insert(font, le_swffontp);
Calculates the width of the given string in this font at full height */
PHP_METHOD(swffont, getWidth)
{
- zval **zstring;
+ char *zstring;
+ int zstring_len;
float width;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(zstring);
- width = SWFFont_getStringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+
+ width = SWFFont_getStringWidth(getFont(getThis() TSRMLS_CC), zstring);
RETURN_DOUBLE(width);
}
/* }}} */
PHP_METHOD(swffont, getUTF8Width)
{
- zval **zstring;
+ char *zstring;
+ int zstring_len;
float width;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- width = SWFFont_getUTF8StringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ width = SWFFont_getUTF8StringWidth(getFont(getThis() TSRMLS_CC), zstring);
RETURN_DOUBLE(width);
}
/*
PHP_METHOD(swffont, getWideWidth)
{
- zval **zstring;
+ char *zstring;
+ int zstring_len;
float width;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- width = SWFFont_getWideStringWidth(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ width = SWFFont_getWideStringWidth(getFont(getThis() TSRMLS_CC), zstring);
RETURN_DOUBLE(width);
}
/*
PHP_METHOD(swffont, addChars)
{
- zval **zstring;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
+ char *zstring;
+ int zstring_len;
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- SWFFont_addChars(getFont(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ SWFFont_addChars(getFont(getThis() TSRMLS_CC), zstring);
}
*/
/* }}} */
-/* {{{ proto string swffont::getShape(code)
+/* {{{ proto string swffont::getShape(int code)
Returns the glyph shape of a char as a text string */
PHP_METHOD(swffont, getShape)
{
- zval **zcode;
+ long zcode;
char *result;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zcode) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(zcode);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zcode) == FAILURE) {
+ return;
+ }
- result = SWFFont_getShape(getFont(getThis() TSRMLS_CC), Z_LVAL_PP(zcode));
+ result = SWFFont_getShape(getFont(getThis() TSRMLS_CC), zcode);
RETVAL_STRING(result, 1);
free(result);
}
Adds given entry to the gradient */
PHP_METHOD(swfgradient, addEntry)
{
- zval **ratio, **r, **g, **b;
- byte a = 0xff;
-
- if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &ratio, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 5) {
- zval **za;
+ double ratio;
+ long r, g, b, a = 0xff;
- if (zend_get_parameters_ex(5, &ratio, &r, &g, &b, &za) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(za);
- a = BYTE_Z_LVAL_PP(za);
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dlll|l", &ratio, &r, &g, &b, &a) == FAILURE) {
+ return;
}
- convert_to_double_ex(ratio);
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
-
- SWFGradient_addEntry( getGradient(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(ratio), BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), a
- );
+ SWFGradient_addEntry(getGradient(getThis() TSRMLS_CC), (byte)ratio, (byte)r, (byte)g, (byte)b, (byte)a);
}
/* }}} */
}
/* }}} */
-/* {{{ proto void swfsound::__construct(string filename, int flags)
+/* {{{ proto void swfsound::__construct(mixed filename [, int flags])
Creates a new SWFSound object from given file */
PHP_METHOD(swfsound, __construct)
{
- zval **zfile, **zflags;
+ zval **zfile;
+ long zflags = 0;
SWFSound sound;
SWFInput input;
int flags;
int ret;
-
- if(ZEND_NUM_ARGS() == 1)
- {
- if(zend_get_parameters_ex(1, &zfile) == FAILURE)
- WRONG_PARAM_COUNT;
- flags = 0;
- }
- else if(ZEND_NUM_ARGS() == 2)
- {
- if(zend_get_parameters_ex(2, &zfile, &zflags) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_long_ex(zflags);
- flags = Z_LVAL_PP(zflags);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|l", &zfile, &zflags) == FAILURE) {
+ return;
}
- else
- WRONG_PARAM_COUNT;
- if(Z_TYPE_PP(zfile) != IS_RESOURCE)
- {
+ if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
convert_to_string_ex(zfile);
PHP_MING_FILE_CHK(Z_STRVAL_PP(zfile));
input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
zend_list_addref(zend_list_insert(input, le_swfinputp));
- }
- else
+ } else {
input = getInput(zfile TSRMLS_CC);
+ }
+
+ flags = zflags;
#ifdef HAVE_NEW_MING
sound = newSWFSound_fromInput(input, flags);
}
/* }}} */
-/* {{{ swfsoundinstance_loopinpoint(point) */
+/* {{{ swfsoundinstance_loopinpoint(int point) */
PHP_METHOD(swfsoundinstance, loopInPoint)
{
- zval **zpoint;
+ long zpoint;
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &zpoint) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(zpoint);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zpoint) == FAILURE) {
+ return;
+ }
- SWFSoundInstance_setLoopInPoint(inst, Z_LVAL_PP(zpoint));
+ SWFSoundInstance_setLoopInPoint(inst, zpoint);
}
/* }}} */
PHP_METHOD(swfsoundinstance, loopOutPoint)
{
- zval **zpoint;
+ long zpoint;
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &zpoint) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(zpoint);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zpoint) == FAILURE) {
+ return;
+ }
- SWFSoundInstance_setLoopOutPoint(inst, Z_LVAL_PP(zpoint));
+ SWFSoundInstance_setLoopOutPoint(inst, zpoint);
}
/* }}} */
PHP_METHOD(swfsoundinstance, loopCount)
{
- zval **zcount;
+ long zcount;
SWFSoundInstance inst = getSoundInstance(getThis() TSRMLS_CC);
- if((ZEND_NUM_ARGS() != 1) || zend_get_parameters_ex(1, &zcount) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_long_ex(zcount);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &zcount) == FAILURE) {
+ return;
+ }
- SWFSoundInstance_setLoopCount(inst, Z_LVAL_PP(zcount));
+ SWFSoundInstance_setLoopCount(inst, zcount);
}
/* }}} */
/* {{{ SWFVideoStream */
-/* {{{ proto class swfvideostream_init([file])
+/* {{{ proto class swfvideostream_init([mixed file])
Returns a SWVideoStream object */
PHP_METHOD(swfvideostream, __construct)
SWFVideoStream stream;
SWFInput input;
int ret;
-
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &zfile) == FAILURE)
- WRONG_PARAM_COUNT;
- if(Z_TYPE_PP(zfile) != IS_RESOURCE)
- {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- }
- else
- input = getInput(zfile TSRMLS_CC);
-
- stream = newSWFVideoStream_fromInput(input);
- break;
- case 0:
- stream = newSWFVideoStream();
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Z", &zfile) == FAILURE) {
+ return;
}
- if(stream) {
+ if (zfile) {
+ if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
+ convert_to_string_ex(zfile);
+ input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ } else {
+ input = getInput(zfile TSRMLS_CC);
+ }
+ stream = newSWFVideoStream_fromInput(input);
+ } else {
+ stream = newSWFVideoStream();
+ }
+
+ if (stream) {
ret = zend_list_insert(stream, le_swfvideostreamp);
object_init_ex(getThis(), videostream_class_entry_ptr);
add_property_resource(getThis(), "videostream", ret);
zend_list_addref(ret);
- }
-
+ }
}
static void destroy_SWFVideoStream_resource(zend_rsrc_list_entry *resource TSRMLS_DC)
PHP_METHOD(swfvideostream, setdimension)
{
- zval **x, **y;
+ long x, y;
SWFVideoStream stream = getVideoStream(getThis() TSRMLS_CC);
- if(!stream)
- php_error(E_RECOVERABLE_ERROR, "getVideoSTream returned NULL");
-
- if( ZEND_NUM_ARGS() != 2
- || zend_get_parameters_ex(2, &x, &y) == FAILURE )
- WRONG_PARAM_COUNT;
+
+ if (!stream) {
+ php_error(E_RECOVERABLE_ERROR, "getVideoSTream returned NULL");
+ }
- convert_to_long_ex(x);
- convert_to_long_ex(y);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &x, &y) == FAILURE) {
+ return;
+ }
- SWFVideoStream_setDimension(stream, Z_LVAL_PP(x), Z_LVAL_PP(y));
+ SWFVideoStream_setDimension(stream, x, y);
}
/* }}} */
#ifdef HAVE_SWFPREBUILTCLIP
/* {{{ SWFPrebuiltClip */
-/* {{{ proto class swfprebuiltclip_init([file])
+/* {{{ proto class swfprebuiltclip_init(mixed file)
Returns a SWFPrebuiltClip object */
PHP_METHOD(swfprebuiltclip, __construct)
SWFInput input;
int ret;
- switch(ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &zfile) == FAILURE)
- WRONG_PARAM_COUNT;
-
- if(Z_TYPE_PP(zfile) != IS_RESOURCE)
- {
- convert_to_string_ex(zfile);
- input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
- zend_list_addref(zend_list_insert(input, le_swfinputp));
- }
- else
- input = getInput(zfile TSRMLS_CC);
-
- clip = newSWFPrebuiltClip_fromInput(input);
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z", &zfile) == FAILURE) {
+ return;
+ }
+
/* not sure whether this makes sense
there would have to be a function to add contents
- case 0:
+ case 0:
clip = newSWFPrebuiltClip();
break; */
- default:
- WRONG_PARAM_COUNT;
- break;
- }
- if(clip) {
+ if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
+ convert_to_string_ex(zfile);
+ input = newSWFInput_buffer(Z_STRVAL_PP(zfile), Z_STRLEN_PP(zfile));
+ zend_list_addref(zend_list_insert(input, le_swfinputp));
+ } else {
+ input = getInput(zfile TSRMLS_CC);
+ }
+
+ clip = newSWFPrebuiltClip_fromInput(input);
+
+ if (clip) {
ret = zend_list_insert(clip, le_swfprebuiltclipp);
object_init_ex(getThis(), prebuiltclip_class_entry_ptr);
add_property_resource(getThis(), "prebuiltclip", ret);
/* {{{ SWFMovie
*/
-/* {{{ proto void swfmovie::__construct(int version)
+/* {{{ proto void swfmovie::__construct([int version])
Creates swfmovie object according to the passed version */
PHP_METHOD(swfmovie, __construct)
{
- zval **version;
+ long version;
SWFMovie movie;
- int ret;
+ int ret, argc = ZEND_NUM_ARGS();
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &version) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(version);
- movie = newSWFMovieWithVersion(Z_LVAL_PP(version));
+ if (zend_parse_parameters(argc TSRMLS_CC, "|l", &version) == FAILURE) {
+ return;
+ }
+
+ if (argc) {
+ movie = newSWFMovieWithVersion(version);
} else {
movie = newSWFMovie(); /* default version 4 */
}
Labels frame */
PHP_METHOD(swfmovie, labelFrame)
{
- zval **label;
+ char *label;
+ int label_len;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, &label_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(label);
- SWFMovie_labelFrame(getMovie(getThis() TSRMLS_CC), Z_STRVAL_PP(label));
+
+ SWFMovie_labelFrame(getMovie(getThis() TSRMLS_CC), label);
}
/* }}} */
*/
PHP_METHOD(swfmovie, namedAnchor)
{
- zval **name;
+ char *name;
+ int name_len;
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(name);
-
- SWFMovie_namedAnchor(getMovie(getThis() TSRMLS_CC), Z_STRVAL_PP(name));
+ SWFMovie_namedAnchor(getMovie(getThis() TSRMLS_CC), name);
}
/* }}} */
#endif
*/
PHP_METHOD(swfmovie, protect)
{
- zval **zchar;
+ char *zchar = NULL;
+ int zchar_len, argc = ZEND_NUM_ARGS();
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- switch(ZEND_NUM_ARGS() ) {
- case 0:
- SWFMovie_protect(movie, NULL);
- break;
- case 1:
- if( zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_string_ex(zchar);
- SWFMovie_protect(movie,Z_STRVAL_PP(zchar));
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(argc TSRMLS_CC, "|s", &zchar, &zchar_len) == FAILURE) {
+ return;
+ }
+
+ if (argc) {
+ SWFMovie_protect(movie, zchar);
+ } else {
+ SWFMovie_protect(movie, NULL);
}
}
/* }}} */
*/
PHP_METHOD(swfmovie, add)
{
- zval **zchar;
+ zval *zchar;
int ret;
SWFBlock block;
SWFDisplayItem item;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
-
- convert_to_object_ex(zchar);
/* XXX - SWFMovie_add deals w/ all block types. Probably will need to add that.. */
- if (Z_OBJCE_PP(zchar) == action_class_entry_ptr) {
- block = (SWFBlock) getAction(*zchar TSRMLS_CC);
+ if (Z_OBJCE_P(zchar) == action_class_entry_ptr) {
+ block = (SWFBlock) getAction(zchar TSRMLS_CC);
} else {
- block = (SWFBlock) getCharacter(*zchar TSRMLS_CC);
+ block = (SWFBlock) getCharacter(zchar TSRMLS_CC);
}
item = SWFMovie_add(movie, block);
*/
PHP_METHOD(swfmovie, remove)
{
- zval **zchar;
+ zval *zchar;
SWFDisplayItem item;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
- convert_to_object_ex(zchar);
- item = getDisplayItem(*zchar TSRMLS_CC);
+
+ item = getDisplayItem(zchar TSRMLS_CC);
SWFMovie_remove(movie, item);
}
/* }}} */
{
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
#if defined(HAVE_MING_ZLIB) && !defined(HAVE_NEW_MING)
- zval **zlimit = NULL;
+ long zlimit;
int limit = -1;
int argc = ZEND_NUM_ARGS();
int oldval = INT_MIN;
long out;
- if(argc) {
- if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters(argc TSRMLS_CC, "|l", &zlimit) == FAILURE) {
+ return;
+ }
- convert_to_long_ex(zlimit);
- limit = Z_LVAL_PP(zlimit);
+ if (argc) {
+ limit = zlimit;
if ((limit < 0) || (limit > 9)) {
- php_error(E_WARNING,"compression level must be within 0..9");
+ php_error(E_WARNING, "compression level must be within 0..9");
RETURN_FALSE;
}
}
+
oldval = Ming_setSWFCompression(limit);
out = SWFMovie_output(movie, &phpByteOutputMethod, NULL);
+
if (oldval >= -1 && oldval <= 9) {
Ming_setSWFCompression(oldval);
}
RETURN_LONG(out);
#elif defined(HAVE_NEW_MING) && defined(HAVE_MING_MOVIE_LEVEL)
- zval **zlimit = NULL;
+ long zlimit;
int limit = -1;
int argc = ZEND_NUM_ARGS();
- if(argc) {
- if (zend_get_parameters_ex(1, &zlimit) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
+ if (zend_parse_parameters(argc TSRMLS_CC, "|l", &zlimit) == FAILURE) {
+ return;
+ }
- convert_to_long_ex(zlimit);
- limit = Z_LVAL_PP(zlimit);
+ if (argc) {
+ limit = zlimit;
if ((limit < 0) || (limit > 9)) {
- php_error(E_WARNING,"compression level must be within 0..9");
+ php_error(E_WARNING, "compression level must be within 0..9");
RETURN_FALSE;
}
}
Sets background color (r,g,b) */
PHP_METHOD(swfmovie, setBackground)
{
- zval **r, **g, **b;
+ long r, g, b;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &r, &g, &b) == FAILURE) {
+ return;
}
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- SWFMovie_setBackground(movie, Z_LVAL_PP(r), Z_LVAL_PP(g), Z_LVAL_PP(b));
+ SWFMovie_setBackground(movie, r, g, b);
}
/* }}} */
Sets movie rate */
PHP_METHOD(swfmovie, setRate)
{
- zval **rate;
+ double rate;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &rate) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &rate) == FAILURE) {
+ return;
}
- convert_to_double_ex(rate);
- SWFMovie_setRate(movie, FLOAT_Z_DVAL_PP(rate));
+ SWFMovie_setRate(movie, (float)rate);
}
/* }}} */
Sets movie dimension */
PHP_METHOD(swfmovie, setDimension)
{
- zval **x, **y;
+ double x, y;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFMovie_setDimension(movie, FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+ SWFMovie_setDimension(movie, (float)x, (float)y);
}
/* }}} */
Sets number of frames */
PHP_METHOD(swfmovie, setFrames)
{
- zval **frames;
+ long frames;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &frames) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &frames) == FAILURE) {
+ return;
}
- convert_to_long_ex(frames);
- SWFMovie_setNumberOfFrames(movie, Z_LVAL_PP(frames));
+ SWFMovie_setNumberOfFrames(movie, frames);
}
/* }}} */
Sets sound stream of the SWF movie. The parameter can be stream or string. Retuens the number of frames. */
PHP_METHOD(swfmovie, streamMP3)
{
- zval **zfile, **zskip;
- float skip;
+ zval **zfile;
+ double skip = 0;
SWFSoundStream sound;
SWFInput input;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if(zend_get_parameters_ex(1, &zfile) == FAILURE)
- WRONG_PARAM_COUNT;
- skip = 0;
- break;
- case 2:
- if(zend_get_parameters_ex(2, &zfile, &zskip) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_double_ex(zskip);
- skip = Z_DVAL_PP(zskip);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Z|d", &zfile, &skip) == FAILURE) {
+ return;
}
if (Z_TYPE_PP(zfile) != IS_RESOURCE) {
}
sound = newSWFSoundStream_fromInput(input);
- SWFMovie_setSoundStreamAt(movie, sound, skip);
+ SWFMovie_setSoundStreamAt(movie, sound, (float)skip);
RETURN_LONG(SWFSoundStream_getFrames(sound));
}
/* }}} */
PHP_METHOD(swfmovie, addExport)
{
- zval **zchar, **zname;
+ zval *zchar;
+ char *zname;
+ int zname_len;
SWFBlock block;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &zchar, &zname) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_object_ex(zchar);
- convert_to_string_ex(zname);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os", &zchar, &zname, &zname_len) == FAILURE) {
+ return;
+ }
- block = (SWFBlock)getCharacter(*zchar TSRMLS_CC);
+ block = (SWFBlock)getCharacter(zchar TSRMLS_CC);
- SWFMovie_addExport(movie, block, Z_STRVAL_PP(zname));
+ SWFMovie_addExport(movie, block, zname);
}
/* }}} */
PHP_METHOD(swfmovie, startSound)
{
- zval **zsound;
+ zval *zsound;
int ret;
SWFSound sound;
SWFSoundInstance item;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zsound) == FAILURE)
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zsound) == FAILURE) {
+ return;
+ }
- convert_to_object_ex(zsound);
- sound = (SWFSound)getSound(*zsound TSRMLS_CC);
+ sound = (SWFSound)getSound(zsound TSRMLS_CC);
item = SWFMovie_startSound(movie, sound);
- if(item != NULL)
- {
+ if (item != NULL) {
/* try and create a soundinstance object */
ret = zend_list_insert(item, le_swfsoundinstancep);
object_init_ex(return_value, soundinstance_class_entry_ptr);
PHP_METHOD(swfmovie, stopSound)
{
- zval **zsound;
+ zval *zsound;
SWFSound sound;
SWFMovie movie = getMovie(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zsound) == FAILURE)
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zsound) == FAILURE) {
+ return;
+ }
- convert_to_object_ex(zsound);
- sound = (SWFSound)getSound(*zsound TSRMLS_CC);
+ sound = (SWFSound)getSound(zsound TSRMLS_CC);
SWFMovie_stopSound(movie, sound);
}
SWFMovie movie;
SWFCharacter res;
int ret;
- zval **libswf, **name;
+ char *libswf, *name;
+ int libswf_len, name_len;
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &libswf, &name) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_string_ex(libswf);
- convert_to_string_ex(name);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &libswf, &libswf_len, &name, &name_len) == FAILURE) {
+ return;
+ }
+
movie = getMovie(getThis() TSRMLS_CC);
- res = SWFMovie_importCharacter(movie, Z_STRVAL_PP(libswf), Z_STRVAL_PP(name));
+ res = SWFMovie_importCharacter(movie, libswf, name);
- if(res != NULL)
- {
+ if (res != NULL) {
/* try and create a sprite object */
ret = zend_list_insert(res, le_swfspritep);
object_init_ex(return_value, sprite_class_entry_ptr);
SWFMovie movie;
SWFFontCharacter res;
int ret;
- zval **libswf, **name;
+ char *libswf, *name;
+ int libswf_len, name_len;
- if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &libswf, &name) == FAILURE)
- WRONG_PARAM_COUNT;
- convert_to_string_ex(libswf);
- convert_to_string_ex(name);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &libswf, &libswf_len, &name, &name_len) == FAILURE) {
+ return;
+ }
+
movie = getMovie(getThis() TSRMLS_CC);
- PHP_MING_FILE_CHK(Z_STRVAL_PP(libswf));
- res = SWFMovie_importFont(movie, Z_STRVAL_PP(libswf), Z_STRVAL_PP(name));
+ PHP_MING_FILE_CHK(libswf);
+ res = SWFMovie_importFont(movie, libswf, name);
- if(res != NULL)
- {
+ if (res != NULL) {
/* try and create a fontchar object */
ret = zend_list_insert(res, le_swffontcharp);
object_init_ex(return_value, fontchar_class_entry_ptr);
SWFFontCharacter res;
int ret;
SWFFont font;
- zval **zfont;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfont) == FAILURE)
- WRONG_PARAM_COUNT;
+ zval *zfont;
- convert_to_object_ex(zfont);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zfont) == FAILURE) {
+ return;
+ }
movie = getMovie(getThis() TSRMLS_CC);
- font = getFont(*zfont TSRMLS_CC);
+ font = getFont(zfont TSRMLS_CC);
res = SWFMovie_addFont(movie, font);
- if(res != NULL)
- {
+ if (res != NULL) {
/* try and create a fontchar object */
ret = zend_list_insert(res, le_swffontcharp);
object_init_ex(return_value, fontchar_class_entry_ptr);
{
SWFShape shape = newSWFShape();
int ret = zend_list_insert(shape, le_swfshapep);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
object_init_ex(getThis(), shape_class_entry_ptr);
add_property_resource(getThis(), "shape", ret);
Moves the pen to shape coordinates (x, y) */
PHP_METHOD(swfshape, movePenTo)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_movePenTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+
+ SWFShape_movePenTo(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Moves the pen from its current location by vector (x, y) */
PHP_METHOD(swfshape, movePen)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_movePen(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+
+ SWFShape_movePen(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Draws a line from the current pen position to shape coordinates (x, y) in the current line style */
PHP_METHOD(swfshape, drawLineTo)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+
+ SWFShape_drawLineTo(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Draws a line from the current pen position (x, y) to the point (x+dx, y+dy) in the current line style */
PHP_METHOD(swfshape, drawLine)
{
- zval **x, **y;
+ double x, y;
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFShape_drawLine(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+
+ SWFShape_drawLine(getShape(getThis() TSRMLS_CC), (float)x, (float)y);
}
/* }}} */
Draws the first character in the given string into the shape using the glyph definition from the given font */
PHP_METHOD(swfshape, drawGlyph)
{
- zval **font, **c, **zsize;
- int size=0;
-
- if (ZEND_NUM_ARGS() == 2) {
- if (zend_get_parameters_ex(2, &font, &c) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- size = (int)(1024.0f/Ming_getScale());
+ zval *font;
+ char *c;
+ int c_len;
+ long size = 1024. / Ming_getScale();
- } else if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &font, &c, &zsize) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(zsize);
- size = Z_LVAL_PP(zsize);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os|l", &font, &c, &c_len, &size) == FAILURE) {
+ return;
}
- convert_to_string_ex(c);
- SWFShape_drawSizedGlyph(getShape(getThis() TSRMLS_CC), getFont(*font TSRMLS_CC), Z_STRVAL_PP(c)[0], size);
+
+ SWFShape_drawSizedGlyph(getShape(getThis() TSRMLS_CC), getFont(font TSRMLS_CC), c[0], (int)size);
}
/* }}} */
Draws a circle of radius r centered at the current location, in a counter-clockwise fashion */
PHP_METHOD(swfshape, drawCircle)
{
- zval **r;
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &r) == FAILURE) {
- WRONG_PARAM_COUNT;
+ double r;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &r) == FAILURE) {
+ return;
}
- convert_to_double_ex(r);
- SWFShape_drawCircle(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r));
+
+ SWFShape_drawCircle(getShape(getThis() TSRMLS_CC), (float)r);
}
/* }}} */
Draws an arc of radius r centered at the current location, from angle startAngle to angle endAngle measured clockwise from 12 o'clock */
PHP_METHOD(swfshape, drawArc)
{
- zval **r, **start, **end;
+ double r, start, end;
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &r, &start, &end) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ddd", &r, &start, &end) == FAILURE) {
+ return;
}
- convert_to_double_ex(r);
- convert_to_double_ex(start);
- convert_to_double_ex(end);
/* convert angles to radians, since that's what php uses elsewhere */
- SWFShape_drawArc(getShape(getThis() TSRMLS_CC), FLOAT_Z_DVAL_PP(r), FLOAT_Z_DVAL_PP(start), FLOAT_Z_DVAL_PP(end));
+ SWFShape_drawArc(getShape(getThis() TSRMLS_CC), (float)r, (float)start, (float)end);
}
/* }}} */
Draws a cubic bezier curve using the current position and the three given points as control points */
PHP_METHOD(swfshape, drawCubic)
{
- zval **bx, **by, **cx, **cy, **dx, **dy;
+ double bx, by, cx, cy, dx, dy;
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
+ return;
}
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
- RETURN_LONG( SWFShape_drawCubic(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
+ RETURN_LONG(SWFShape_drawCubic(getShape(getThis() TSRMLS_CC), (float)bx, (float)by, (float)cx, (float)cy, (float)dx, (float)dy));
}
/* }}} */
Draws a cubic bezier curve using the current position and the three given points as control points */
PHP_METHOD(swfshape, drawCubicTo)
{
- zval **bx, **by, **cx, **cy, **dx, **dy;
+ double bx, by, cx, cy, dx, dy;
- if (ZEND_NUM_ARGS() != 6 || zend_get_parameters_ex(6, &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dddddd", &bx, &by, &cx, &cy, &dx, &dy) == FAILURE) {
+ return;
}
- convert_to_double_ex(bx);
- convert_to_double_ex(by);
- convert_to_double_ex(cx);
- convert_to_double_ex(cy);
- convert_to_double_ex(dx);
- convert_to_double_ex(dy);
- RETURN_LONG( SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC),
- FLOAT_Z_DVAL_PP(bx), FLOAT_Z_DVAL_PP(by), FLOAT_Z_DVAL_PP(cx), FLOAT_Z_DVAL_PP(cy), FLOAT_Z_DVAL_PP(dx), FLOAT_Z_DVAL_PP(dy))
- );
+ RETURN_LONG(SWFShape_drawCubicTo(getShape(getThis() TSRMLS_CC), (float)bx, (float)by, (float)cx, (float)cy, (float)dx, (float)dy));
}
/* }}} */
{
SWFMovieClip sprite = newSWFMovieClip();
int ret = zend_list_insert(sprite, le_swfspritep);
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
object_init_ex(getThis(), sprite_class_entry_ptr);
add_property_resource(getThis(), "sprite", ret);
Adds the character to the sprite, returns a displayitem object */
PHP_METHOD(swfsprite, add)
{
- zval **zchar;
+ zval *zchar;
int ret;
SWFBlock block;
SWFDisplayItem item;
SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
-
- convert_to_object_ex(zchar);
- if (Z_OBJCE_PP(zchar) == action_class_entry_ptr) {
- block = (SWFBlock)getAction(*zchar TSRMLS_CC);
+ if (Z_OBJCE_P(zchar) == action_class_entry_ptr) {
+ block = (SWFBlock)getAction(zchar TSRMLS_CC);
} else {
- block = (SWFBlock)getCharacter(*zchar TSRMLS_CC);
+ block = (SWFBlock)getCharacter(zchar TSRMLS_CC);
}
item = SWFMovieClip_add(sprite, block);
Remove the named character from the sprite's display list */
PHP_METHOD(swfsprite, remove)
{
- zval **zchar;
+ zval *zchar;
SWFDisplayItem item;
SWFMovieClip movie = getSprite(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zchar) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zchar) == FAILURE) {
+ return;
}
- convert_to_object_ex(zchar);
- item = getDisplayItem(*zchar TSRMLS_CC);
+
+ item = getDisplayItem(zchar TSRMLS_CC);
SWFMovieClip_remove(movie, item);
}
/* }}} */
Labels frame */
PHP_METHOD(swfsprite, labelFrame)
{
- zval **label;
+ char *label;
+ int label_len;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &label) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &label, &label_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(label);
- SWFMovieClip_labelFrame(getSprite(getThis() TSRMLS_CC), Z_STRVAL_PP(label));
+
+ SWFMovieClip_labelFrame(getSprite(getThis() TSRMLS_CC), label);
}
/* }}} */
Sets the number of frames in this SWFSprite */
PHP_METHOD(swfsprite, setFrames)
{
- zval **frames;
+ long frames;
SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &frames) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &frames) == FAILURE) {
+ return;
}
- convert_to_long_ex(frames);
- SWFMovieClip_setNumberOfFrames(sprite, Z_LVAL_PP(frames));
+
+ SWFMovieClip_setNumberOfFrames(sprite, frames);
}
/* }}} */
PHP_METHOD(swfsprite, startSound)
{
- zval **zsound;
+ zval *zsound;
int ret;
SWFSound sound;
SWFSoundInstance item;
SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zsound) == FAILURE)
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zsound) == FAILURE) {
+ return;
+ }
- convert_to_object_ex(zsound);
- sound = (SWFSound)getSound(*zsound TSRMLS_CC);
+ sound = (SWFSound)getSound(zsound TSRMLS_CC);
item = SWFMovieClip_startSound(sprite, sound);
- if(item != NULL) {
+ if (item != NULL) {
/* try and create a displayitem object */
ret = zend_list_insert(item, le_swfsoundinstancep);
object_init_ex(return_value, soundinstance_class_entry_ptr);
PHP_METHOD(swfsprite, stopSound)
{
- zval **zsound;
+ zval *zsound;
SWFSound sound;
SWFMovieClip sprite = getSprite(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zsound) == FAILURE)
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zsound) == FAILURE) {
+ return;
+ }
- convert_to_object_ex(zsound);
- sound = (SWFSound)getSound(*zsound TSRMLS_CC);
+ sound = (SWFSound)getSound(zsound TSRMLS_CC);
SWFMovieClip_stopSound(sprite, sound);
}
Sets this SWFText object's current font to given font */
PHP_METHOD(swftext, setFont)
{
- zval **zfont;
+ zval *zfont;
SWFText text = getText(getThis() TSRMLS_CC);
SWFFont font;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zfont) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &zfont) == FAILURE) {
+ return;
}
- convert_to_object_ex(zfont);
- font = getFont(*zfont TSRMLS_CC);
+
+ font = getFont(zfont TSRMLS_CC);
SWFText_setFont(text, font);
}
/* }}} */
Sets this SWFText object's current height to given height */
PHP_METHOD(swftext, setHeight)
{
- zval **height;
+ double height;
SWFText text = getText(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &height) == FAILURE) {
+ return;
}
- convert_to_double_ex(height);
- SWFText_setHeight(text, FLOAT_Z_DVAL_PP(height));
+
+ SWFText_setHeight(text, (float)height);
}
/* }}} */
Sets this SWFText object's current letterspacing to given spacing */
PHP_METHOD(swftext, setSpacing)
{
- zval **spacing;
+ double spacing;
SWFText text = getText(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &spacing) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) {
+ return;
}
- convert_to_double_ex(spacing);
- SWFText_setSpacing(text, FLOAT_Z_DVAL_PP(spacing));
+
+ SWFText_setSpacing(text, (float)spacing);
}
/* }}} */
Sets this SWFText object's current color to the given color */
PHP_METHOD(swftext, setColor)
{
- zval **r, **g, **b, **a;
+ long r, g, b, a = 0xff;
SWFText text = getText(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a);
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
}
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- if (ZEND_NUM_ARGS() == 4) {
- SWFText_setColor(text, BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), BYTE_Z_LVAL_PP(a));
- } else {
- SWFText_setColor(text, BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), 0xff);
- }
+ SWFText_setColor(text, (byte)r, (byte)g, (byte)b, (byte)a);
}
/* }}} */
Moves this SWFText object's current pen position to (x, y) in text coordinates */
PHP_METHOD(swftext, moveTo)
{
- zval **x, **y;
+ double x, y;
SWFText text = getText(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &x, &y) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &x, &y) == FAILURE) {
+ return;
}
- convert_to_double_ex(x);
- convert_to_double_ex(y);
- SWFText_setXY(text, FLOAT_Z_DVAL_PP(x), FLOAT_Z_DVAL_PP(y));
+
+ SWFText_setXY(text, (float)x, (float)y);
}
/* }}} */
Writes the given text into this SWFText object at the current pen position, using the current font, height, spacing, and color */
PHP_METHOD(swftext, addString)
{
- zval **s;
+ char *s;
+ int s_len;
SWFText text = getText(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &s) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(s);
- SWFText_addString(text, Z_STRVAL_PP(s), NULL);
+ SWFText_addString(text, s, NULL);
}
/* }}} */
PHP_METHOD(swftext, addUTF8String)
{
- zval **s;
+ char *s;
+ int s_len;
SWFText text = getText(getThis() TSRMLS_CC);
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
+ return;
+ }
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &s) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(s);
-
- SWFText_addUTF8String(text, Z_STRVAL_PP(s), NULL);
+ SWFText_addUTF8String(text, s, NULL);
}
/* }}} */
/*
PHP_METHOD(swftext, addWideString)
{
- zval **s;
+ char *s;
+ int s_len;
SWFText text = getText(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &s) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(s);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s, &s_len) == FAILURE) {
+ return;
+ }
- SWFText_addWideString(text, Z_STRVAL_PP(s), NULL);
+ SWFText_addWideString(text, s, NULL);
}
*/
/* }}} */
Calculates the width of the given string in this text objects current font and size */
PHP_METHOD(swftext, getWidth)
{
- zval **zstring;
+ char *zstring;
+ int zstring_len;
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(zstring);
- RETURN_DOUBLE(SWFText_getStringWidth(getText(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring)));
+
+ RETURN_DOUBLE(SWFText_getStringWidth(getText(getThis() TSRMLS_CC), zstring));
}
/* }}} */
PHP_METHOD(swftext, getUTF8Width)
{
- zval **zstring;
- int width;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
+ char *zstring;
+ int zstring_len, width;
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- width = SWFText_getUTF8StringWidth(getText(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ width = SWFText_getUTF8StringWidth(getText(getThis() TSRMLS_CC), zstring);
RETURN_DOUBLE(width);
}
/*
PHP_METHOD(swftext, getWideWidth)
{
- zval **zstring;
- int width;
-
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
+ char *zstring;
+ int zstring_len, width;
- convert_to_string_ex(zstring);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
- width = SWFText_getWideStringWidth(getText(getThis() TSRMLS_CC), Z_STRVAL_PP(zstring));
+ width = SWFText_getWideStringWidth(getText(getThis() TSRMLS_CC), zstring);
RETURN_DOUBLE(width);
}
Creates a new SWFTextField object */
PHP_METHOD(swftextfield, __construct)
{
- zval **flags;
+ long flags;
SWFTextField field = newSWFTextField();
int ret = zend_list_insert(field, le_swftextfieldp);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
+ return;
+ }
+
object_init_ex(getThis(), textfield_class_entry_ptr);
add_property_resource(getThis(), "textfield", ret);
zend_list_addref(ret);
- if (ZEND_NUM_ARGS() == 1) {
- if (zend_get_parameters_ex(1, &flags) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(flags);
- SWFTextField_setFlags(field, Z_LVAL_PP(flags));
- }
+ SWFTextField_setFlags(field, flags);
}
/* }}} */
PHP_METHOD(swftextfield, setFont)
{
- zval **font;
+ zval *font;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &font) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &font) == FAILURE) {
+ return;
}
- convert_to_object_ex(font);
- SWFTextField_setFont(field, getFontOrFontChar(*font TSRMLS_CC));
+
+ SWFTextField_setFont(field, getFontOrFontChar(font TSRMLS_CC));
}
/* }}} */
Sets the width and height of this textfield */
PHP_METHOD(swftextfield, setBounds)
{
- zval **width, **height;
+ double width, height;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &width, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &width, &height) == FAILURE) {
+ return;
}
- convert_to_double_ex(width);
- convert_to_double_ex(height);
- SWFTextField_setBounds(field, FLOAT_Z_DVAL_PP(width), FLOAT_Z_DVAL_PP(height));
+
+ SWFTextField_setBounds(field, (float)width, (float)height);
}
/* }}} */
Sets the alignment of this textfield */
PHP_METHOD(swftextfield, align)
{
- zval **align;
+ long align;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &align) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &align) == FAILURE) {
+ return;
}
- convert_to_long_ex(align);
- SWFTextField_setAlignment(field, Z_LVAL_PP(align));
+
+ SWFTextField_setAlignment(field, align);
}
/* }}} */
Sets the font height of this textfield */
PHP_METHOD(swftextfield, setHeight)
{
- zval **height;
+ double height;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
-
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &height) == FAILURE) {
- WRONG_PARAM_COUNT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &height) == FAILURE) {
+ return;
}
- convert_to_double_ex(height);
- SWFTextField_setHeight(field, FLOAT_Z_DVAL_PP(height));
+
+ SWFTextField_setHeight(field, (float)height);
}
/* }}} */
Sets the left margin of this textfield */
PHP_METHOD(swftextfield, setLeftMargin)
{
- zval **margin;
+ double margin;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &margin) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &margin) == FAILURE) {
+ return;
}
- convert_to_double_ex(margin);
- SWFTextField_setLeftMargin(field, FLOAT_Z_DVAL_PP(margin));
+
+ SWFTextField_setLeftMargin(field, (float)margin);
}
/* }}} */
Sets the right margin of this textfield */
PHP_METHOD(swftextfield, setRightMargin)
{
- zval **margin;
+ double margin;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &margin) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &margin) == FAILURE) {
+ return;
}
- convert_to_double_ex(margin);
- SWFTextField_setRightMargin(field, FLOAT_Z_DVAL_PP(margin));
+
+ SWFTextField_setRightMargin(field, (float)margin);
}
/* }}} */
Sets both margins of this textfield */
PHP_METHOD(swftextfield, setMargins)
{
- zval **left, **right;
+ double left, right;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &left, &right) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd", &left, &right) == FAILURE) {
+ return;
}
- convert_to_double_ex(left);
- convert_to_double_ex(right);
- SWFTextField_setLeftMargin(field, FLOAT_Z_DVAL_PP(left));
- SWFTextField_setRightMargin(field, FLOAT_Z_DVAL_PP(right));
+
+ SWFTextField_setLeftMargin(field, (float)left);
+ SWFTextField_setRightMargin(field, (float)right);
}
/* }}} */
Sets the indentation of the first line of this textfield */
PHP_METHOD(swftextfield, setIndentation)
{
- zval **indent;
+ double indent;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &indent) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &indent) == FAILURE) {
+ return;
}
- convert_to_double_ex(indent);
- SWFTextField_setIndentation(field, FLOAT_Z_DVAL_PP(indent));
+
+ SWFTextField_setIndentation(field, (float)indent);
}
/* }}} */
Sets the line spacing of this textfield */
PHP_METHOD(swftextfield, setLineSpacing)
{
- zval **spacing;
+ double spacing;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &spacing) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &spacing) == FAILURE) {
+ return;
}
- convert_to_double_ex(spacing);
- SWFTextField_setLineSpacing(field, FLOAT_Z_DVAL_PP(spacing));
+
+ SWFTextField_setLineSpacing(field, (float)spacing);
}
/* }}} */
Sets the color of this textfield */
PHP_METHOD(swftextfield, setColor)
{
- zval **r, **g, **b, **a;
+ long r, g, b, a = 0xff;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- byte alpha = 0xff;
- if (ZEND_NUM_ARGS() == 3) {
- if (zend_get_parameters_ex(3, &r, &g, &b) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- } else if (ZEND_NUM_ARGS() == 4) {
- if (zend_get_parameters_ex(4, &r, &g, &b, &a) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
- convert_to_long_ex(a);
- alpha = BYTE_Z_LVAL_PP(a);
- } else {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll|l", &r, &g, &b, &a) == FAILURE) {
+ return;
}
- convert_to_long_ex(r);
- convert_to_long_ex(g);
- convert_to_long_ex(b);
- SWFTextField_setColor(field, BYTE_Z_LVAL_PP(r), BYTE_Z_LVAL_PP(g), BYTE_Z_LVAL_PP(b), (byte)alpha);
+
+ SWFTextField_setColor(field, (byte)r, (byte)g, (byte)b, (byte)a);
}
/* }}} */
Sets the variable name of this textfield */
PHP_METHOD(swftextfield, setName)
{
- zval **name;
+ char *name;
+ int name_len;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &name) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(name);
- SWFTextField_setVariableName(field, Z_STRVAL_PP(name));
+
+ SWFTextField_setVariableName(field, name);
}
/* }}} */
Adds the given string to this textfield */
PHP_METHOD(swftextfield, addString)
{
- zval **string;
+ char *string;
+ int string_len;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &string) == FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &string, &string_len) == FAILURE) {
+ return;
}
- convert_to_string_ex(string);
- SWFTextField_addString(field, Z_STRVAL_PP(string));
+
+ SWFTextField_addString(field, string);
}
/* }}} */
Sets the padding of this textfield */
PHP_METHOD(swftextfield, setPadding)
{
- zval **padding;
+ double padding;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &padding) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_double_ex(padding);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "d", &padding) == FAILURE) {
+ return;
+ }
- SWFTextField_setPadding(field, Z_DVAL_PP(padding));
+ SWFTextField_setPadding(field, padding);
}
/* }}} */
adds characters to a font that will be available within a textfield */
PHP_METHOD(swftextfield, addChars)
{
- zval **zstring;
+ char *zstring;
+ int zstring_len;
SWFTextField field = getTextField(getThis() TSRMLS_CC);
- if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &zstring) == FAILURE)
- WRONG_PARAM_COUNT;
-
- convert_to_string_ex(zstring);
-
- SWFTextField_addChars(field, Z_STRVAL_PP(zstring));
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &zstring, &zstring_len) == FAILURE) {
+ return;
+ }
+ SWFTextField_addChars(field, zstring);
}
/* }}} */
#endif