vlad            Tue Feb  3 00:40:26 2004 EDT

  Modified files:              
    /php-src/ext/pspell pspell.c 
  Log:
  This should allow us to read dictionary locations from the win32 registry when we 
use a custom config. 
  Not doing so when I added win32 support was an oversight.
  Now all pspell_new_* functions should be usable on win32.
  
http://cvs.php.net/diff.php/php-src/ext/pspell/pspell.c?r1=1.39&r2=1.40&ty=u
Index: php-src/ext/pspell/pspell.c
diff -u php-src/ext/pspell/pspell.c:1.39 php-src/ext/pspell/pspell.c:1.40
--- php-src/ext/pspell/pspell.c:1.39    Thu Jan  8 03:17:13 2004
+++ php-src/ext/pspell/pspell.c Tue Feb  3 00:40:25 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: pspell.c,v 1.39 2004/01/08 08:17:13 andi Exp $ */
+/* $Id: pspell.c,v 1.40 2004/02/03 05:40:25 vlad Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -627,7 +627,33 @@
                WRONG_PARAM_COUNT;
        }
 
+#ifdef PHP_WIN32
+        TCHAR aspell_dir[200];
+        TCHAR data_dir[220];
+        TCHAR dict_dir[220];
+        HKEY hkey;
+        DWORD dwType,dwLen;
+#endif
+
        config = new_pspell_config();
+
+#ifdef PHP_WIN32
+    /* 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)) {
+       RegQueryValueEx(hkey, "", NULL, &dwType, (LPBYTE)&aspell_dir, &dwLen);
+       RegCloseKey(hkey);
+       strcpy(data_dir, aspell_dir);
+       strcat(data_dir, "\\data");
+       strcpy(dict_dir, aspell_dir);
+       strcat(dict_dir, "\\dict");
+
+       pspell_config_replace(config, "data-dir", data_dir);
+       pspell_config_replace(config, "dict-dir", dict_dir);
+      }
+#endif
+
        convert_to_string_ex(language);
        pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
 

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

Reply via email to