From: patthoyts Date: Mon, 9 Feb 2004 12:02:32 +0000 (+0000) Subject: * Makefile.in: Fixed to build in directories other than the top X-Git-Tag: root-dev-2~5 X-Git-Url: https://privyetmir.co.uk/gitweb.cgi?a=commitdiff_plain;h=e35728d2a5b3408100fcace678e6b6e5447f8e57;p=tcludp * Makefile.in: Fixed to build in directories other than the top of the source tree. * generic/udp_tcl.c: Applied the patch from bug #810572 which fixes a memory leak in udp_open - from D. Richard Hipp? * generic/udp_tcl.h: Fix for missing define WIN32 sometimes. * win/makefile.vc: Added the standard windows nmake makefiles * win/nmakehlp.c: from the sampleextension project. * win/rules.vc: Visual Studio project updated as a Makefile * win/tcludp.dsp: project. --- diff --git a/ChangeLog b/ChangeLog index c20b037..e631784 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2004-02-09 Pat Thoyts + + * all: INCREMENTED VERSION TO 1.0.6 + + * Makefile.in: Fixed to build in directories other than the top + of the source tree. + + * generic/udp_tcl.c: Applied the patch from bug #810572 which + fixes a memory leak in udp_open - from D. Richard Hipp? + + * generic/udp_tcl.h: Fix for missing define WIN32 sometimes. + + * win/makefile.vc: Added the standard windows nmake makefiles + * win/nmakehlp.c: from the sampleextension project. + * win/rules.vc: Visual Studio project updated as a Makefile + * win/tcludp.dsp: project. + 2003-10-14 Pat Thoyts * generic/udp_tcl.c: Fix CONSTness for Tcl < 8.4 diff --git a/Makefile.in b/Makefile.in index 3c8108d..dde947d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,7 +27,7 @@ # unix subdirectory. #======================================================================== -udp_SOURCES = generic/udp_tcl.c +udp_SOURCES = $(srcdir)/generic/udp_tcl.c WIN_SOURCES = UNIX_SOURCES = diff --git a/configure b/configure index 0f43d21..db9c7e2 100755 --- a/configure +++ b/configure @@ -573,7 +573,7 @@ PACKAGE=udp MAJOR_VERSION=1 MINOR_VERSION=0 -PATCHLEVEL=5 +PATCHLEVEL=6 VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCHLEVEL} NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION} diff --git a/configure.in b/configure.in index 4d951c8..4355ec6 100644 --- a/configure.in +++ b/configure.in @@ -39,7 +39,7 @@ PACKAGE=udp MAJOR_VERSION=1 MINOR_VERSION=0 -PATCHLEVEL=5 +PATCHLEVEL=6 VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCHLEVEL} NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION} diff --git a/generic/udp_tcl.c b/generic/udp_tcl.c index 9898767..373547f 100644 --- a/generic/udp_tcl.c +++ b/generic/udp_tcl.c @@ -21,7 +21,7 @@ #ifdef WIN32 #include #include -#else +#else /* ! WIN32 */ #if defined(HAVE_SYS_IOCTL_H) #include #elif defined(HAVE_SYS_FILIO_H) @@ -29,7 +29,7 @@ #else #error "Neither sys/ioctl.h nor sys/filio.h found. We need ioctl()" #endif -#endif +#endif /* WIN32 */ /* Tcl 8.4 CONST support */ #ifndef CONST84 @@ -42,7 +42,7 @@ #define INVALID_SOCKET -1 #define closesocket close #define ioctlsocket ioctl -#endif +#endif /* WIN32 */ #ifdef DEBUG #define UDPTRACE udpTrace @@ -101,6 +101,26 @@ static UdpState *sockTail; #endif /* ! WIN32 */ +/* + * This structure describes the channel type for accessing UDP. + */ +static Tcl_ChannelType Udp_ChannelType = { +#ifdef SIPC_IPV6 + "udp6", /* Type name. */ +#else + "udp", /* Type name. */ +#endif + NULL, /* Set blocking/nonblocking behaviour. NULL'able */ + udpClose, /* Close channel, clean instance data */ + udpInput, /* Handle read request */ + udpOutput, /* Handle write request */ + NULL, /* Move location of access point. NULL'able */ + udpSetOption, /* Set options. NULL'able */ + udpGetOption, /* Get options. NULL'able */ + udpWatch, /* Initialize notifier */ + udpGetHandle, /* Get OS handle from the channel. */ +}; + /* * ---------------------------------------------------------------------- * udpInit @@ -186,25 +206,27 @@ udpOpen(ClientData clientData, Tcl_Interp *interp, unsigned long status = 1; int len; - Tcl_ChannelType *Udp_ChannelType; - Udp_ChannelType = (Tcl_ChannelType *) ckalloc((unsigned) sizeof(Tcl_ChannelType)); - memset(Udp_ChannelType, 0, sizeof(Tcl_ChannelType)); -#ifdef SIPC_IPV6 - Udp_ChannelType->typeName = strdup("udp6"); -#else - Udp_ChannelType->typeName = strdup("udp"); -#endif - Udp_ChannelType->blockModeProc = NULL; - Udp_ChannelType->closeProc = udpClose; - Udp_ChannelType->inputProc = udpInput; - Udp_ChannelType->outputProc = udpOutput; - Udp_ChannelType->seekProc = NULL; - Udp_ChannelType->setOptionProc = udpSetOption; - Udp_ChannelType->getOptionProc = udpGetOption; - Udp_ChannelType->watchProc = udpWatch; - Udp_ChannelType->getHandleProc = udpGetHandle; - Udp_ChannelType->close2Proc = NULL; - + /* + * Tcl_ChannelType *Udp_ChannelType; + * Udp_ChannelType = (Tcl_ChannelType *) ckalloc((unsigned) sizeof(Tcl_ChannelType)); + * memset(Udp_ChannelType, 0, sizeof(Tcl_ChannelType)); + * #ifdef SIPC_IPV6 + * Udp_ChannelType->typeName = strdup("udp6"); + *#else + * Udp_ChannelType->typeName = strdup("udp"); + *#endif + * Udp_ChannelType->blockModeProc = NULL; + * Udp_ChannelType->closeProc = udpClose; + * Udp_ChannelType->inputProc = udpInput; + * Udp_ChannelType->outputProc = udpOutput; + * Udp_ChannelType->seekProc = NULL; + * Udp_ChannelType->setOptionProc = udpSetOption; + * Udp_ChannelType->getOptionProc = udpGetOption; + * Udp_ChannelType->watchProc = udpWatch; + * Udp_ChannelType->getHandleProc = udpGetHandle; + * Udp_ChannelType->close2Proc = NULL; + */ + if (argc >= 2) { if (udpGetService(interp, argv[1], &localport) != TCL_OK) return TCL_ERROR; @@ -258,7 +280,7 @@ udpOpen(ClientData clientData, Tcl_Interp *interp, memset(statePtr, 0, sizeof(UdpState)); statePtr->sock = sock; sprintf(channelName, "sock%d", statePtr->sock); - statePtr->channel = Tcl_CreateChannel(Udp_ChannelType, channelName, + statePtr->channel = Tcl_CreateChannel(&Udp_ChannelType, channelName, (ClientData) statePtr, (TCL_READABLE | TCL_WRITABLE | TCL_MODE_NONBLOCKING)); statePtr->doread = 1; diff --git a/generic/udp_tcl.h b/generic/udp_tcl.h index 508767f..fdcf899 100644 --- a/generic/udp_tcl.h +++ b/generic/udp_tcl.h @@ -20,6 +20,10 @@ # include #endif +#if defined(_WIN32) && !defined(WIN32) +#define WIN32 +#endif + #ifdef WIN32 # include #else @@ -33,7 +37,7 @@ # include # include # include -#endif +#endif /* WIN32 */ #include #include @@ -64,7 +68,7 @@ typedef struct PacketList { struct PacketList *next; } PacketList; -#endif // WIN32 +#endif /* WIN32 */ typedef struct UdpState { Tcl_Channel channel; diff --git a/win/tcludp.dsp b/win/tcludp.dsp index 4508c7e..1d7ae3b 100644 --- a/win/tcludp.dsp +++ b/win/tcludp.dsp @@ -2,7 +2,7 @@ # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 +# TARGTYPE "Win32 (x86) External Target" 0x0106 CFG=tcludp - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, @@ -17,17 +17,14 @@ CFG=tcludp - Win32 Debug !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "tcludp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "tcludp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "tcludp - Win32 Release" (based on "Win32 (x86) External Target") +!MESSAGE "tcludp - Win32 Debug" (based on "Win32 (x86) External Target") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe !IF "$(CFG)" == "tcludp - Win32 Release" @@ -35,25 +32,20 @@ RSC=rc.exe # PROP BASE Use_Debug_Libraries 0 # PROP BASE Output_Dir "Release" # PROP BASE Intermediate_Dir "Release" +# PROP BASE Cmd_Line "NMAKE /f tcludp.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "tcludp.exe" +# PROP BASE Bsc_Name "tcludp.bsc" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 # PROP Output_Dir "Release" # PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 +# PROP Cmd_Line "nmake -f Makefile.vc INSTALLDIR=c:\opt\tcl" +# PROP Rebuild_Opt "/a" +# PROP Target_File "Release/udp106.dll" +# PROP Bsc_Name "" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCLUDP_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D VERSION=\"1.0.5\" /D "USE_TCL_STUBS" /D "TCLUDP_EXPORTS" /D "BUILD_udp" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 tclstub84.lib wsock32.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/udp105.dll" !ELSEIF "$(CFG)" == "tcludp - Win32 Debug" @@ -61,25 +53,20 @@ LINK32=link.exe # PROP BASE Use_Debug_Libraries 1 # PROP BASE Output_Dir "Debug" # PROP BASE Intermediate_Dir "Debug" +# PROP BASE Cmd_Line "NMAKE /f tcludp.mak" +# PROP BASE Rebuild_Opt "/a" +# PROP BASE Target_File "tcludp.exe" +# PROP BASE Bsc_Name "tcludp.bsc" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 # PROP Output_Dir "Debug" # PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 +# PROP Cmd_Line "nmake /f makefile.vc INSTALLDIR=c:\opt\tcl OPTS=symbols all" +# PROP Rebuild_Opt "/a" +# PROP Target_File "Debug/udp106g.dll" +# PROP Bsc_Name "" # PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TCLUDP_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D VERSION=\"1.0.5\" /D "USE_TCL_STUBS" /D "TCLUDP_EXPORTS" /D "BUILD_udp" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 tclstub84.lib wsock32.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/udp105d.dll" /pdbtype:sept !ENDIF @@ -87,6 +74,13 @@ LINK32=link.exe # Name "tcludp - Win32 Release" # Name "tcludp - Win32 Debug" + +!IF "$(CFG)" == "tcludp - Win32 Release" + +!ELSEIF "$(CFG)" == "tcludp - Win32 Debug" + +!ENDIF + # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" @@ -111,9 +105,5 @@ SOURCE=..\generic\udp_tcl.h SOURCE=.\tcludp.rc # End Source File # End Group -# Begin Source File - -SOURCE=..\tests\udp.test -# End Source File # End Target # End Project diff --git a/win/tcludp.rc b/win/tcludp.rc index 12e2caa..fb16bf5 100644 --- a/win/tcludp.rc +++ b/win/tcludp.rc @@ -8,8 +8,8 @@ LANGUAGE 0x9, 0x1 /* LANG_ENGLISH, SUBLANG_DEFAULT */ VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,5,0 - PRODUCTVERSION 1,0,5,0 + FILEVERSION 1,0,6,0 + PRODUCTVERSION 1,0,6,0 FILEFLAGSMASK 0x3fL #ifdef DEBUG FILEFLAGS VS_FF_DEBUG @@ -25,11 +25,11 @@ BEGIN BLOCK "040904b0" /* LANG_ENGLISH/SUBLANG_ENGLISH_US, Unicode CP */ BEGIN VALUE "FileDescription", "Tcl UDP extension\0" - VALUE "OriginalFilename", "udp105.dll\0" - VALUE "FileVersion", "1.0.5.0\0" + VALUE "OriginalFilename", "udp106.dll\0" + VALUE "FileVersion", "1.0.6.0\0" VALUE "LegalCopyright", "Copyright \251 1999-2000 Columbia University; all rights reserved\0" VALUE "ProductName", "TclUDP\0" - VALUE "ProductVersion", "1.0.5.0\0" + VALUE "ProductVersion", "1.0.6.0\0" END END BLOCK "VarFileInfo"