]> granicus.if.org Git - php/commitdiff
make iconv compile under win32 using libiconv
authorDaniel Beulshausen <dbeu@php.net>
Wed, 31 Jan 2001 16:57:00 +0000 (16:57 +0000)
committerDaniel Beulshausen <dbeu@php.net>
Wed, 31 Jan 2001 16:57:00 +0000 (16:57 +0000)
# http://clisp.cons.org/~haible/packages-libiconv.html

ext/iconv/iconv.c
ext/iconv/iconv.dsp [new file with mode: 0644]

index e1d6f51273d481b1bba8af664a456c8b76e4a481..7c8f9eedaf69e64eb7a87f067f69c8c2342f90a5 100644 (file)
  */
 
 #include "php.h"
-#include "php_config.h"
 
 #if HAVE_ICONV
 
 #include "php_ini.h"
 #include "php_iconv.h"
+#include "ext/standard/info.h"
 
 
 ZEND_DECLARE_MODULE_GLOBALS(iconv)
 
+#if HAVE_LIBICONV
+#define icv_open(a,b) libiconv_open(a,b)
+#define icv_close(a) libiconv_close(a)
+#define icv(a,b,c,d,e) libiconv(a,b,c,d,e)
+#else
+#define icv_open(a,b) iconv_open(a,b)
+#define icv_close(a) iconv_close(a)
+#define icv(a,b,c,d,e) iconv(a,b,c,d,e)
+#endif
+
+
 /* True global resources - no need for thread safety here */
 static int le_iconv;
 
@@ -68,6 +79,7 @@ PHP_INI_END()
 
 PHP_MINIT_FUNCTION(iconv)
 {
+       ZEND_INIT_MODULE_GLOBALS(iconv, NULL, NULL);
        REGISTER_INI_ENTRIES();
        return SUCCESS;
 }
@@ -101,7 +113,7 @@ int php_iconv_string(char *in_p, char **out, char *in_charset, char *out_charset
        *out = out_buffer;
     out_p = out_buffer;
   
-    cd = iconv_open(out_charset, in_charset);
+    cd = icv_open(out_charset, in_charset);
   
        if (cd == (iconv_t)(-1)) {
                php_error(E_WARNING, "iconv: cannot convert from `%s' to `%s'",
@@ -110,7 +122,7 @@ int php_iconv_string(char *in_p, char **out, char *in_charset, char *out_charset
                return -1;
        }
        
-       result = iconv(cd, (const char **) &in_p, &in_size, (char **)
+       result = icv(cd, (const char **) &in_p, &in_size, (char **)
                                   &out_p, &out_size);
 
     if (result == (size_t)(-1)) {
@@ -118,11 +130,12 @@ int php_iconv_string(char *in_p, char **out, char *in_charset, char *out_charset
                return -1;
     }
 
-    iconv_close(cd);
+    icv_close(cd);
 
     return SUCCESS;
 }
 
+
 /* {{{ proto string iconv(string in_charset, string out_charset, string str)
    Returns str converted to the out_charset character set */
 PHP_FUNCTION(iconv)
diff --git a/ext/iconv/iconv.dsp b/ext/iconv/iconv.dsp
new file mode 100644 (file)
index 0000000..7a8bc90
--- /dev/null
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="iconv" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** DO NOT EDIT **\r
+\r
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102\r
+\r
+CFG=iconv - Win32 Debug_TS\r
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,\r
+!MESSAGE use the Export Makefile command and run\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "iconv.mak".\r
+!MESSAGE \r
+!MESSAGE You can specify a configuration when running NMAKE\r
+!MESSAGE by defining the macro CFG on the command line. For example:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "iconv.mak" CFG="iconv - Win32 Debug_TS"\r
+!MESSAGE \r
+!MESSAGE Possible choices for configuration are:\r
+!MESSAGE \r
+!MESSAGE "iconv - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE "iconv - Win32 Debug_TS" (based on "Win32 (x86) Dynamic-Link Library")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+MTL=midl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "iconv - Win32 Release_TS"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release_TS"\r
+# PROP BASE Intermediate_Dir "Release_TS"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "Release_TS"\r
+# PROP Intermediate_Dir "Release_TS"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D "WIN32" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "HAVE_ICONV" /D ZEND_DEBUG=0 /D "NDEBUG" /D "_WINDOWS" /D "ZEND_WIN32" /D "PHP_WIN32" /D ZTS=1 /YX /FD /c\r
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
+# ADD RSC /l 0x407 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# 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\r
+# ADD LINK32 php4ts.lib iconv.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_iconv.dll" /libpath:"..\..\Release_TS" /libpath:"..\..\Release_TS_Inline"\r
+\r
+!ELSEIF  "$(CFG)" == "iconv - Win32 Debug_TS"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug_TS"\r
+# PROP BASE Intermediate_Dir "Debug_TS"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "Debug_TS"\r
+# PROP Intermediate_Dir "Debug_TS"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\.." /I "..\..\Zend" /I "..\..\TSRM" /I "..\..\main" /I "..\..\win32" /D ZEND_DEBUG=1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "PHP_EXPORTS" /D "COMPILE_DL_ICONV" /D "ZEND_WIN32" /D "PHP_WIN32" /D "HAVE_ICONV" /D ZTS=1 /YX /FD /GZ /c\r
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32\r
+# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
+# ADD RSC /l 0x407 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# 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 /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 php4ts_debug.dll iconv-1.3.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_iconv.dll" /pdbtype:sept /libpath:"..\..\Debug_TS"\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "iconv - Win32 Release_TS"\r
+# Name "iconv - Win32 Debug_TS"\r
+# Begin Group "Source Files"\r
+\r
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"\r
+# Begin Source File\r
+\r
+SOURCE=.\iconv.c\r
+# End Source File\r
+# End Group\r
+# Begin Group "Header Files"\r
+\r
+# PROP Default_Filter "h;hpp;hxx;hm;inl"\r
+# Begin Source File\r
+\r
+SOURCE=.\php_iconv.h\r
+# End Source File\r
+# End Group\r
+# End Target\r
+# End Project\r