vlad            Wed Aug 13 16:59:44 2003 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/pspell pspell.dsp 

  Modified files:              
    /php-src/ext/pspell pspell.c 
  Log:
  MFH adding win32 support
  
Index: php-src/ext/pspell/pspell.c
diff -u php-src/ext/pspell/pspell.c:1.28.8.3 php-src/ext/pspell/pspell.c:1.28.8.4
--- php-src/ext/pspell/pspell.c:1.28.8.3        Wed Jun 11 21:47:28 2003
+++ php-src/ext/pspell/pspell.c Wed Aug 13 16:59:44 2003
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: pspell.c,v 1.28.8.3 2003/06/12 01:47:28 iliaa Exp $ */
+/* $Id: pspell.c,v 1.28.8.4 2003/08/13 20:59:44 vlad Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -45,6 +45,11 @@
 #define PSPELL_SPEED_MASK_INTERNAL 3L
 #define PSPELL_RUN_TOGETHER 8L
 
+/* Largest ignored word can be 999 characters (this seems sane enough), 
+ * and it takes 3 bytes to represent that (see pspell_config_ignore)
+ */
+#define PSPELL_LARGEST_WORD 3
+
 /* {{{ pspell_functions[]
  */
 function_entry pspell_functions[] = {
@@ -117,6 +122,14 @@
        int argc;
        int ind;
 
+#ifdef PHP_WIN32
+       TCHAR aspell_dir[200];
+       TCHAR data_dir[220];
+       TCHAR dict_dir[220];
+       HKEY hkey;
+       DWORD dwType,dwLen;
+#endif
+
        PspellCanHaveError *ret;
        PspellManager *manager;
        PspellConfig *config;
@@ -127,6 +140,24 @@
        }
 
        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));
 
@@ -194,6 +225,14 @@
        int argc;
        int ind;
 
+#ifdef PHP_WIN32
+       TCHAR aspell_dir[200];
+       TCHAR data_dir[220];
+       TCHAR dict_dir[220];
+       HKEY hkey;
+       DWORD dwType,dwLen;
+#endif
+
        PspellCanHaveError *ret;
        PspellManager *manager;
        PspellConfig *config;
@@ -205,6 +244,23 @@
 
        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(personal);
 
        if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(personal), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
@@ -272,7 +328,6 @@
        
        manager = to_pspell_manager(ret);
        ind = zend_list_insert(manager, le_pspell);
-
        RETURN_LONG(ind);
 }
 /* }}} */
@@ -680,9 +735,8 @@
        zval **sccin, **pignore;
        int argc;
 
-       /* Hack. But I cannot imagine any word being more than 999 characters long */
-       int loc = 3;
-       char ignore_str[loc + 1];       
+       int loc = PSPELL_LARGEST_WORD;
+       char ignore_str[PSPELL_LARGEST_WORD + 1];       
        long ignore = 0L;
 
        PspellConfig *config;

Index: php-src/ext/pspell/pspell.dsp
+++ php-src/ext/pspell/pspell.dsp
# Microsoft Developer Studio Project File - Name="pspell" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **

# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102

CFG=pspell - Win32 Debug_TS
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE 
!MESSAGE NMAKE /f "pspell.mak".
!MESSAGE 
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE 
!MESSAGE NMAKE /f "pspell.mak" CFG="pspell - Win32 Debug_TS"
!MESSAGE 
!MESSAGE Possible choices for configuration are:
!MESSAGE 
!MESSAGE "pspell - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "pspell - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE 

# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe

!IF  "$(CFG)" == "pspell - Win32 Debug_TS"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "pspell___Win32_Debug_TS"
# PROP BASE Intermediate_Dir "pspell___Win32_Debug_TS"
# PROP BASE Ignore_Export_Lib 0
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug_TS"
# PROP Intermediate_Dir "Debug_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I 
"..\..\Zend" /I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /D 
ZEND_DEBUG=1 /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\main" /I "..\..\Zend" 
/I "..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I 
"..\..\..\aspell\include\pspell" /D ZEND_DEBUG=1 /D "_DEBUG" /D ZTS=1 /D HAVE_PSPELL=1 
/D "COMPILE_DL_PSPELL" /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D 
"_MBCS" /D "_USRDLL" /D "PSPELL_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 php4ts_debug.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib /nologo /dll /debug /machine:I386 /out:"..\..\Debug_TS/php_pspell.dll" 
/pdbtype:sept /libpath:"..\..\Debug_TS"
# ADD LINK32 php4ts_debug.lib aspell-15.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 
odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 
/out:"..\..\Debug_TS/php_pspell.dll" /pdbtype:sept /libpath:"..\..\Debug_TS" 
/libpath:"..\..\..\aspell\lib"

!ELSEIF  "$(CFG)" == "pspell - Win32 Release_TS"

# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "pspell___Win32_Release_TS"
# PROP BASE Intermediate_Dir "pspell___Win32_Release_TS"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_TS"
# PROP Intermediate_Dir "Release_TS"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" 
/D "_USRDLL" /D "PSPELL_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\.." /I "..\..\main" /I "..\..\Zend" /I 
"..\..\..\bindlib_w32" /I "..\..\..\zlib" /I "..\..\TSRM" /I 
"..\..\..\aspell\include\pspell" /D ZEND_DEBUG=0 /D "NDEBUG" /D ZTS=1 /D HAVE_PSPELL=1 
/D "COMPILE_DL_PSPELL" /D "WIN32" /D "ZEND_WIN32" /D "PHP_WIN32" /D "_WINDOWS" /D 
"_MBCS" /D "_USRDLL" /D "PSPELL_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib 
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib 
/nologo /dll /machine:I386
# ADD LINK32 php4ts.lib aspell-15.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib 
odbccp32.lib /nologo /dll /machine:I386 /out:"..\..\Release_TS/php_pspell.dll" 
/libpath:"..\..\Release_TS" /libpath:"..\..\..\aspell\lib"

!ENDIF 

# Begin Target

# Name "pspell - Win32 Debug_TS"
# Name "pspell - Win32 Release_TS"
# Begin Group "Source Files"

# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File

SOURCE=.\pspell.c
# End Source File
# End Group
# Begin Group "Header Files"

# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File

SOURCE=.\php_pspell.h
# End Source File
# End Group
# Begin Group "Resource Files"

# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

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

Reply via email to