cvs: pecl /ps php_ps.h ps.c

From: Date: Wed, 21 Apr 2004 09:50:34 +0000
Subject: cvs: pecl /ps php_ps.h ps.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-1162@lists.php.net to get a copy of this message
steinm Wed Apr 21 05:50:34 2004 EDT Modified files: /pecl/ps ps.c php_ps.h Log: - added function ps_hyphenate() http://cvs.php.net/diff.php/pecl/ps/ps.c?r1=1.9&r2=1.10&ty=u Index: pecl/ps/ps.c diff -u pecl/ps/ps.c:1.9 pecl/ps/ps.c:1.10 --- pecl/ps/ps.c:1.9 Thu Mar 4 02:26:22 2004 +++ pecl/ps/ps.c Wed Apr 21 05:50:33 2004 @@ -125,6 +125,7 @@ PHP_FE(ps_set_border_color, NULL) PHP_FE(ps_set_border_dash, NULL) PHP_FE(ps_setcolor, NULL) + PHP_FE(ps_hyphenate, NULL) /* End of the official PSLIB V3.x API */ @@ -255,7 +256,7 @@ php_info_print_table_start(); php_info_print_table_row(2, "PS Support", "enabled" ); php_info_print_table_row(2, "PSlib Version", tmp ); - php_info_print_table_row(2, "Revision", "$Revision: 1.9 $" ); + php_info_print_table_row(2, "Revision", "$Revision: 1.10 $" ); php_info_print_table_end(); } @@ -2340,6 +2341,37 @@ } /* }}} */ #endif +/* {{{ proto void ps_hyphenate(int ps, string word) + Hyphenate a given word */ +PHP_FUNCTION(ps_hyphenate) { + zval **arg1, **arg2; + PSDoc *ps; + char *buffer; + int i, j; + + if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) { + WRONG_PARAM_COUNT; + } + + ZEND_FETCH_RESOURCE(ps, PSDoc *, arg1, -1, "ps document", le_psdoc); + + convert_to_string_ex(arg2); + + if(NULL == (buffer = emalloc(strlen(Z_STRVAL_PP(arg2))+1))) { + RETURN_FALSE; + } + PS_hyphenate(ps, Z_STRVAL_PP(arg2), &buffer); + array_init(return_value); + j = 0; + for(i=0; i<strlen(buffer); i++) { + if(buffer[i] & 1) { + add_index_long(return_value, j, i); + j++; + } + } + efree(buffer); + +} /* }}} */ #endif /* 0 */ /* http://cvs.php.net/diff.php/pecl/ps/php_ps.h?r1=1.5&r2=1.6&ty=u Index: pecl/ps/php_ps.h diff -u pecl/ps/php_ps.h:1.5 pecl/ps/php_ps.h:1.6 --- pecl/ps/php_ps.h:1.5 Thu Mar 4 02:26:22 2004 +++ pecl/ps/php_ps.h Wed Apr 21 05:50:33 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_ps.h,v 1.5 2004/03/04 07:26:22 steinm Exp $ */ +/* $Id: php_ps.h,v 1.6 2004/04/21 09:50:33 steinm Exp $ */ #ifndef PHP_PS_H #define PHP_PS_H @@ -110,6 +110,7 @@ PHP_FUNCTION(ps_set_border_color); PHP_FUNCTION(ps_set_border_dash); PHP_FUNCTION(ps_setcolor); +PHP_FUNCTION(ps_hyphenate); /* old way of starting a PS document */ PHP_FUNCTION(ps_open); /* deprecated */

« previous php.pecl.cvs (#1162) next »