bfrance         Wed Feb 11 13:50:17 2004 EDT

  Modified files:              
    /php-src/ext/pspell php_pspell.h pspell.c 
  Log:
  
        Added two new functions to set the dict-dir and data-dir options.
  
  
  
http://cvs.php.net/diff.php/php-src/ext/pspell/php_pspell.h?r1=1.13&r2=1.14&ty=u
Index: php-src/ext/pspell/php_pspell.h
diff -u php-src/ext/pspell/php_pspell.h:1.13 php-src/ext/pspell/php_pspell.h:1.14
--- php-src/ext/pspell/php_pspell.h:1.13        Thu Jan  8 12:32:42 2004
+++ php-src/ext/pspell/php_pspell.h     Wed Feb 11 13:50:16 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_pspell.h,v 1.13 2004/01/08 17:32:42 sniper Exp $ */
+/* $Id: php_pspell.h,v 1.14 2004/02/11 18:50:16 bfrance Exp $ */
 
 #ifndef _PSPELL_H
 #define _PSPELL_H
@@ -41,6 +41,8 @@
 PHP_FUNCTION(pspell_config_mode);
 PHP_FUNCTION(pspell_config_ignore);
 PHP_FUNCTION(pspell_config_personal);
+PHP_FUNCTION(pspell_config_dict_dir);
+PHP_FUNCTION(pspell_config_data_dir);
 PHP_FUNCTION(pspell_config_repl);
 PHP_FUNCTION(pspell_config_save_repl);
 #else
http://cvs.php.net/diff.php/php-src/ext/pspell/pspell.c?r1=1.40&r2=1.41&ty=u
Index: php-src/ext/pspell/pspell.c
diff -u php-src/ext/pspell/pspell.c:1.40 php-src/ext/pspell/pspell.c:1.41
--- php-src/ext/pspell/pspell.c:1.40    Tue Feb  3 00:40:25 2004
+++ php-src/ext/pspell/pspell.c Wed Feb 11 13:50:16 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: pspell.c,v 1.40 2004/02/03 05:40:25 vlad Exp $ */
+/* $Id: pspell.c,v 1.41 2004/02/11 18:50:16 bfrance Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -68,6 +68,8 @@
        PHP_FE(pspell_config_mode,              NULL)
        PHP_FE(pspell_config_ignore,            NULL)
        PHP_FE(pspell_config_personal,          NULL)
+       PHP_FE(pspell_config_dict_dir,          NULL)
+       PHP_FE(pspell_config_data_dir,          NULL)
        PHP_FE(pspell_config_repl,              NULL)
        PHP_FE(pspell_config_save_repl,         NULL)
        {NULL, NULL, NULL} 
@@ -803,18 +805,15 @@
 }
 /* }}} */
 
-/* {{{ proto bool pspell_config_personal(int conf, string personal)
-   Use a personal dictionary for this config */
-PHP_FUNCTION(pspell_config_personal)
-{
+static int pspell_config_path( INTERNAL_FUNCTION_PARAMETERS, char *option ) {
        int type;
-       zval **sccin, **personal;
+       zval **sccin, **value;
        int argc;
 
        PspellConfig *config;
        
        argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&personal) == FAILURE) {
+       if (argc != 2 || zend_get_parameters_ex(argc,&sccin,&value) == FAILURE) {
                WRONG_PARAM_COUNT;
        }
 
@@ -825,20 +824,45 @@
                RETURN_FALSE;
        }
 
-       convert_to_string_ex(personal);
+       convert_to_string_ex(value);
 
-       if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(personal), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+       if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(value), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
                RETURN_FALSE;
        }
 
-       if (php_check_open_basedir(Z_STRVAL_PP(personal) TSRMLS_CC)) {
+       if (php_check_open_basedir(Z_STRVAL_PP(value) TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
-       pspell_config_replace(config, "personal", Z_STRVAL_PP(personal));
+       pspell_config_replace(config, option, Z_STRVAL_PP(value));
 
        RETURN_TRUE;
 }
+
+/* {{{ proto bool pspell_config_personal(int conf, string personal)
+   Use a personal dictionary for this config */
+PHP_FUNCTION(pspell_config_personal)
+{
+       pspell_config_path( INTERNAL_FUNCTION_PARAM_PASSTHRU, "personal");
+}
+/* }}} */
+
+/* {{{ proto bool pspell_config_dict_dir(int conf, string directory)
+
+   location of the main word list */
+PHP_FUNCTION(pspell_config_dict_dir)
+{
+       pspell_config_path( INTERNAL_FUNCTION_PARAM_PASSTHRU, "dict-dir");
+}
+
+/* }}} */
+
+/* {{{ proto bool pspell_config_data_dir(int conf, string directory)
+    location of language data files */
+PHP_FUNCTION(pspell_config_data_dir)
+{
+       pspell_config_path( INTERNAL_FUNCTION_PARAM_PASSTHRU, "data-dir");
+}
 /* }}} */
 
 /* {{{ proto bool pspell_config_repl(int conf, string repl)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to