[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pspell pspell.c /ext/pspell/tests 003.phpt 005.phpt
felipe Sat Aug 23 16:32:04 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pspell pspell.c /php-src/ext/pspell/tests 003.phpt 005.phpt Log: MFH: - WS, Cosmetics - Removed unnecessary variables http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/pspell.c?r1=1.45.2.4.2.7.2.5r2=1.45.2.4.2.7.2.6diff_format=u Index: php-src/ext/pspell/pspell.c diff -u php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.5 php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.6 --- php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.5Wed Aug 13 08:08:47 2008 +++ php-src/ext/pspell/pspell.c Sat Aug 23 16:32:04 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: pspell.c,v 1.45.2.4.2.7.2.5 2008/08/13 08:08:47 tony2001 Exp $ */ +/* $Id: pspell.c,v 1.45.2.4.2.7.2.6 2008/08/23 16:32:04 felipe Exp $ */ #define IS_EXT_MODULE @@ -307,12 +307,12 @@ /* If aspell was installed using installer, we should have a key * pointing to the location of the dictionaries */ - if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, Software\\Aspell, hkey)) { + if (0 == RegOpenKey(HKEY_LOCAL_MACHINE, Software\\Aspell, hkey)) { LONG result; dwLen = sizeof(aspell_dir) - 1; result = RegQueryValueEx(hkey, , NULL, dwType, (LPBYTE)aspell_dir, dwLen); RegCloseKey(hkey); - if(result == ERROR_SUCCESS) { + if (result == ERROR_SUCCESS) { strlcpy(data_dir, aspell_dir, sizeof(data_dir)); strlcat(data_dir, \\data, sizeof(data_dir)); strlcpy(dict_dir, aspell_dir, sizeof(dict_dir)); @@ -342,16 +342,16 @@ speed = mode PSPELL_SPEED_MASK_INTERNAL; /* First check what mode we want (how many suggestions) */ - if(speed == PSPELL_FAST){ + if (speed == PSPELL_FAST) { pspell_config_replace(config, sug-mode, fast); - }else if(speed == PSPELL_NORMAL){ + } else if (speed == PSPELL_NORMAL) { pspell_config_replace(config, sug-mode, normal); - }else if(speed == PSPELL_BAD_SPELLERS){ + } else if (speed == PSPELL_BAD_SPELLERS) { pspell_config_replace(config, sug-mode, bad-spellers); } /* Then we see if run-together words should be treated as valid components */ - if(mode PSPELL_RUN_TOGETHER){ + if (mode PSPELL_RUN_TOGETHER) { pspell_config_replace(config, run-together, true); } } @@ -359,8 +359,8 @@ ret = new_pspell_manager(config); delete_pspell_config(config); - if(pspell_error_number(ret) != 0){ - php_error_docref(NULL TSRMLS_CC, E_WARNING, PSPELL couldn't open the dictionary. reason: %s , pspell_error_message(ret)); + if (pspell_error_number(ret) != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, PSPELL couldn't open the dictionary. reason: %s, pspell_error_message(ret)); delete_pspell_can_have_error(ret); RETURN_FALSE; } @@ -404,12 +404,12 @@ /* If aspell was installed using installer, we should have a key * pointing to the location of the dictionaries */ - if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, Software\\Aspell, hkey)) { + if (0 == RegOpenKey(HKEY_LOCAL_MACHINE, Software\\Aspell, hkey)) { LONG result; dwLen = sizeof(aspell_dir) - 1; result = RegQueryValueEx(hkey, , NULL, dwType, (LPBYTE)aspell_dir, dwLen); RegCloseKey(hkey); - if(result == ERROR_SUCCESS) { + if (result == ERROR_SUCCESS) { strlcpy(data_dir, aspell_dir, sizeof(data_dir)); strlcat(data_dir, \\data, sizeof(data_dir)); strlcpy(dict_dir, aspell_dir, sizeof(dict_dir)); @@ -452,16 +452,16 @@ speed = mode PSPELL_SPEED_MASK_INTERNAL; /* First check what mode we want (how many suggestions) */ - if(speed == PSPELL_FAST){ + if (speed == PSPELL_FAST) { pspell_config_replace(config, sug-mode, fast); - }else if(speed == PSPELL_NORMAL){ + } else if (speed == PSPELL_NORMAL) { pspell_config_replace(config, sug-mode, normal); - }else if(speed == PSPELL_BAD_SPELLERS){ + } else if (speed == PSPELL_BAD_SPELLERS) { pspell_config_replace(config, sug-mode, bad-spellers); } /* Then we see if run-together words should be treated as valid components */ - if(mode PSPELL_RUN_TOGETHER){ +
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pspell pspell.c
tony2001Wed Aug 13 08:08:47 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pspell pspell.c Log: MFH: fix compile warnings (patch by Phil Oleson) http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/pspell.c?r1=1.45.2.4.2.7.2.4r2=1.45.2.4.2.7.2.5diff_format=u Index: php-src/ext/pspell/pspell.c diff -u php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.4 php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.5 --- php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.4Wed Jul 16 18:34:56 2008 +++ php-src/ext/pspell/pspell.c Wed Aug 13 08:08:47 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: pspell.c,v 1.45.2.4.2.7.2.4 2008/07/16 18:34:56 felipe Exp $ */ +/* $Id: pspell.c,v 1.45.2.4.2.7.2.5 2008/08/13 08:08:47 tony2001 Exp $ */ #define IS_EXT_MODULE @@ -361,7 +361,7 @@ if(pspell_error_number(ret) != 0){ php_error_docref(NULL TSRMLS_CC, E_WARNING, PSPELL couldn't open the dictionary. reason: %s , pspell_error_message(ret)); - delete_pspell_manager(ret); + delete_pspell_can_have_error(ret); RETURN_FALSE; } @@ -471,7 +471,7 @@ if(pspell_error_number(ret) != 0){ php_error_docref(NULL TSRMLS_CC, E_WARNING, PSPELL couldn't open the dictionary. reason: %s , pspell_error_message(ret)); - delete_pspell_manager(ret); + delete_pspell_can_have_error(ret); RETURN_FALSE; } @@ -502,7 +502,7 @@ if(pspell_error_number(ret) != 0){ php_error_docref(NULL TSRMLS_CC, E_WARNING, PSPELL couldn't open the dictionary. reason: %s , pspell_error_message(ret)); - delete_pspell_manager(ret); + delete_pspell_can_have_error(ret); RETURN_FALSE; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pspell pspell.c
felipe Wed Jul 16 18:34:56 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pspell pspell.c Log: - Added arginfo http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/pspell.c?r1=1.45.2.4.2.7.2.3r2=1.45.2.4.2.7.2.4diff_format=u Index: php-src/ext/pspell/pspell.c diff -u php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.3 php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.4 --- php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.3Fri Jun 27 02:58:12 2008 +++ php-src/ext/pspell/pspell.c Wed Jul 16 18:34:56 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: pspell.c,v 1.45.2.4.2.7.2.3 2008/06/27 02:58:12 felipe Exp $ */ +/* $Id: pspell.c,v 1.45.2.4.2.7.2.4 2008/07/16 18:34:56 felipe Exp $ */ #define IS_EXT_MODULE @@ -72,28 +72,151 @@ static PHP_FUNCTION(pspell_config_repl); static PHP_FUNCTION(pspell_config_save_repl); +/* {{{ arginfo */ +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new, 0, 0, 1) + ZEND_ARG_INFO(0, language) + ZEND_ARG_INFO(0, spelling) + ZEND_ARG_INFO(0, jargon) + ZEND_ARG_INFO(0, encoding) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_personal, 0, 0, 2) + ZEND_ARG_INFO(0, personal) + ZEND_ARG_INFO(0, language) + ZEND_ARG_INFO(0, spelling) + ZEND_ARG_INFO(0, jargon) + ZEND_ARG_INFO(0, encoding) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_new_config, 0, 0, 1) + ZEND_ARG_INFO(0, config) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_check, 0, 0, 2) + ZEND_ARG_INFO(0, pspell) + ZEND_ARG_INFO(0, word) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_suggest, 0, 0, 2) + ZEND_ARG_INFO(0, pspell) + ZEND_ARG_INFO(0, word) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_store_replacement, 0, 0, 3) + ZEND_ARG_INFO(0, pspell) + ZEND_ARG_INFO(0, misspell) + ZEND_ARG_INFO(0, correct) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_add_to_personal, 0, 0, 2) + ZEND_ARG_INFO(0, pspell) + ZEND_ARG_INFO(0, word) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_add_to_session, 0, 0, 2) + ZEND_ARG_INFO(0, pspell) + ZEND_ARG_INFO(0, word) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_clear_session, 0, 0, 1) + ZEND_ARG_INFO(0, pspell) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_save_wordlist, 0, 0, 1) + ZEND_ARG_INFO(0, pspell) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_create, 0, 0, 1) + ZEND_ARG_INFO(0, language) + ZEND_ARG_INFO(0, spelling) + ZEND_ARG_INFO(0, jargon) + ZEND_ARG_INFO(0, encoding) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_runtogether, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, runtogether) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_mode, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, mode) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_ignore, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, ignore) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_personal, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, personal) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_dict_dir, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, directory) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_data_dir, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, directory) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_repl, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, repl) +ZEND_END_ARG_INFO() + +static +ZEND_BEGIN_ARG_INFO_EX(arginfo_pspell_config_save_repl, 0, 0, 2) + ZEND_ARG_INFO(0, conf) + ZEND_ARG_INFO(0, save) +ZEND_END_ARG_INFO() +/* }}} */ + /* {{{ pspell_functions[] */ static const zend_function_entry pspell_functions[] = { - PHP_FE(pspell_new, NULL) - PHP_FE(pspell_new_personal, NULL) - PHP_FE(pspell_new_config, NULL) - PHP_FE(pspell_check,NULL) - PHP_FE(pspell_suggest, NULL) - PHP_FE(pspell_store_replacement,NULL) - PHP_FE(pspell_add_to_personal, NULL) - PHP_FE(pspell_add_to_session, NULL) - PHP_FE(pspell_clear_session,NULL) - PHP_FE(pspell_save_wordlist,NULL) - PHP_FE(pspell_config_create,NULL) - PHP_FE(pspell_config_runtogether, NULL) - PHP_FE(pspell_config_mode,
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pspell pspell.c /ext/pspell/tests 002.phpt
felipe Fri Jun 27 02:58:13 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/pspell pspell.c /php-src/ext/pspell/tests 002.phpt Log: - New parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/pspell.c?r1=1.45.2.4.2.7.2.2r2=1.45.2.4.2.7.2.3diff_format=u Index: php-src/ext/pspell/pspell.c diff -u php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.2 php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.3 --- php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.2Mon Dec 31 07:17:12 2007 +++ php-src/ext/pspell/pspell.c Fri Jun 27 02:58:12 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: pspell.c,v 1.45.2.4.2.7.2.2 2007/12/31 07:17:12 sebastian Exp $ */ +/* $Id: pspell.c,v 1.45.2.4.2.7.2.3 2008/06/27 02:58:12 felipe Exp $ */ #define IS_EXT_MODULE @@ -124,18 +124,16 @@ } #define PSPELL_FETCH_CONFIG \ - convert_to_long_ex(conf); \ - config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), type); \ + config = (PspellConfig *) zend_list_find(conf, type); \ if (config == NULL || type != le_pspell_config) { \ - php_error_docref(NULL TSRMLS_CC, E_WARNING, %ld is not a PSPELL config index, Z_LVAL_PP(conf)); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, %ld is not a PSPELL config index, conf); \ RETURN_FALSE; \ } \ #define PSPELL_FETCH_MANAGER \ - convert_to_long_ex(scin); \ - manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), type); \ + manager = (PspellManager *) zend_list_find(scin, type);\ if (!manager || type != le_pspell) {\ - php_error_docref(NULL TSRMLS_CC, E_WARNING, %ld is not a PSPELL result index, Z_LVAL_PP(scin)); \ + php_error_docref(NULL TSRMLS_CC, E_WARNING, %ld is not a PSPELL result index, scin); \ RETURN_FALSE; \ } \ @@ -157,9 +155,10 @@ Load a dictionary */ static PHP_FUNCTION(pspell_new) { - zval **language,**spelling,**jargon,**encoding,**pmode; + char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL; + int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0; long mode = 0L, speed = 0L; - int argc; + int argc = ZEND_NUM_ARGS(); int ind; #ifdef PHP_WIN32 @@ -174,9 +173,9 @@ PspellManager *manager; PspellConfig *config; - argc = ZEND_NUM_ARGS(); - if (argc 1 || argc 5 || zend_get_parameters_ex(argc,language,spelling,jargon,encoding,pmode) == FAILURE) { - WRONG_PARAM_COUNT; + if (zend_parse_parameters(argc TSRMLS_CC, s|sssl, language, language_len, spelling, spelling_len, + jargon, jargon_len, encoding, encoding_len, mode) == FAILURE) { + return; } config = new_pspell_config(); @@ -202,33 +201,21 @@ } #endif - convert_to_string_ex(language); - pspell_config_replace(config, language-tag, Z_STRVAL_PP(language)); + pspell_config_replace(config, language-tag, language); - if(argc 1){ - convert_to_string_ex(spelling); - if(Z_STRLEN_PP(spelling) 0){ - pspell_config_replace(config, spelling, Z_STRVAL_PP(spelling)); - } + if (spelling_len) { + pspell_config_replace(config, spelling, spelling); } - if(argc 2){ - convert_to_string_ex(jargon); - if(Z_STRLEN_PP(jargon) 0){ - pspell_config_replace(config, jargon, Z_STRVAL_PP(jargon)); - } + if (jargon_len) { + pspell_config_replace(config, jargon, jargon); } - if(argc 3){ - convert_to_string_ex(encoding); - if(Z_STRLEN_PP(encoding) 0){ - pspell_config_replace(config, encoding, Z_STRVAL_PP(encoding)); - } + if (encoding_len) { + pspell_config_replace(config, encoding, encoding); } - if(argc 4){ - convert_to_long_ex(pmode); - mode = Z_LVAL_PP(pmode); + if (argc 4) { speed = mode PSPELL_SPEED_MASK_INTERNAL; /* First check what mode we want (how many suggestions) */ @@ -265,9 +252,10 @@ Load a dictionary with a personal wordlist*/ static PHP_FUNCTION(pspell_new_personal) { - zval **personal, **language,**spelling,**jargon,**encoding,**pmode; + char *personal, *language, *spelling = NULL, *jargon = NULL, *encoding = NULL; + int personal_len, language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0; long mode = 0L, speed = 0L; - int argc; + int argc = ZEND_NUM_ARGS(); int ind; #ifdef PHP_WIN32 @@ -281,10 +269,10 @@ PspellCanHaveError