summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authorDaniel Beulshausen <dbeu@php.net>2001-01-31 16:57:00 +0000
committerDaniel Beulshausen <dbeu@php.net>2001-01-31 16:57:00 +0000
commit6f1ca9de3ec6b7a89c2fe20d5d4acf43448d82ba (patch)
treea41ea7d9a507dd8e1f78df90f2daa7eb23ca1e9b /ext/iconv
parent7413c65e31dbda3012a18ac1356d84d6d6f6bf43 (diff)
downloadphp-git-6f1ca9de3ec6b7a89c2fe20d5d4acf43448d82ba.tar.gz
make iconv compile under win32 using libiconv
# http://clisp.cons.org/~haible/packages-libiconv.html
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/iconv.c21
-rw-r--r--ext/iconv/iconv.dsp107
2 files changed, 124 insertions, 4 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index e1d6f51273..7c8f9eedaf 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -18,16 +18,27 @@
*/
#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
index 0000000000..7a8bc90def
--- /dev/null
+++ b/ext/iconv/iconv.dsp
@@ -0,0 +1,107 @@
+# Microsoft Developer Studio Project File - Name="iconv" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=iconv - 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 "iconv.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 "iconv.mak" CFG="iconv - Win32 Debug_TS"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "iconv - Win32 Release_TS" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "iconv - Win32 Debug_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)" == "iconv - Win32 Release_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release_TS"
+# PROP BASE Intermediate_Dir "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 "ICONV_EXPORTS" /YX /FD /c
+# 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
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /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 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"
+
+!ELSEIF "$(CFG)" == "iconv - Win32 Debug_TS"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug_TS"
+# PROP BASE Intermediate_Dir "Debug_TS"
+# 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 /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ICONV_EXPORTS" /YX /FD /GZ /c
+# 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
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+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 /debug /machine:I386 /pdbtype:sept
+# 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"
+
+!ENDIF
+
+# Begin Target
+
+# Name "iconv - Win32 Release_TS"
+# Name "iconv - Win32 Debug_TS"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\iconv.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\php_iconv.h
+# End Source File
+# End Group
+# End Target
+# End Project