diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1e7bd8d9a6..d2f0499659 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,40 @@ The license applies to all entries newer than 2009-04-28. */ +2010-12-02 14:41 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * include/harbour.hbx + * include/hbsocket.h + * src/rtl/hbsocket.c + * src/rtl/hbinet.c + * src/rtl/hbsockhb.c + + Added hb_socketSetExclusiveAddr() on .c level. + + Added hb_socketSetExclusiveAddr() on .prg level. + * hb_socketSetReuseAddr() cleaned from SO_EXCLUSIVEADDRUSE (Windows-only) + logic. + * Changed HB_INETSERVER(), HB_INETDGRAMBIND() to call + hb_socketSetExclusiveAddr()(). We may delete these if they + cause problems on some Windows platforms, though we must + absolutely use this option (for security reasons) in every + server component, if Windows host supports it. + ; TODO: Call hb_socketSetExclusiveAddr() from hbnetio server, + hbhttpd server. + + * include/hbcpage.hbx + * src/codepage/Makefile + + src/codepage/cpcs852c.c + * src/codepage/cpsk852c.c + - src/codepage/cpcskam.c + + src/codepage/cpcskamc.c + - src/codepage/cpskkam.c + + src/codepage/cpskkamc.c + ! Fixed SK852C to be fully Clipper compatible. (generated with cpinfo) + ! Added Clipper compatible CS852C CP. (generated with cpinfo) + * SK/CS Kamenicky CP moved to Clipper compatibility status. + Updated to be Clipper compatible. (generated with cpinfo) + INCOMPATIBLE. Pls update CP names if you used these. + Thanks to Jaroslav Janik for the help. + Please test all these. + 2010-12-02 11:19 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/codepage/cpcs852.c * harbour/src/codepage/cpcskam.c diff --git a/harbour/include/harbour.hbx b/harbour/include/harbour.hbx index a72349d8c0..6287047f5f 100644 --- a/harbour/include/harbour.hbx +++ b/harbour/include/harbour.hbx @@ -736,6 +736,7 @@ DYNAMIC HB_SOCKETSEND DYNAMIC HB_SOCKETSENDTO DYNAMIC HB_SOCKETSETBLOCKINGIO DYNAMIC HB_SOCKETSETBROADCAST +DYNAMIC HB_SOCKETSETEXCLUSIVEADDR DYNAMIC HB_SOCKETSETKEEPALIVE DYNAMIC HB_SOCKETSETMULTICAST DYNAMIC HB_SOCKETSETNODELAY diff --git a/harbour/include/hbcpage.hbx b/harbour/include/hbcpage.hbx index d4b18a9c3c..1c38fd293e 100644 --- a/harbour/include/hbcpage.hbx +++ b/harbour/include/hbcpage.hbx @@ -33,8 +33,9 @@ DYNAMIC HB_CODEPAGE_BGISO DYNAMIC HB_CODEPAGE_BGMIK DYNAMIC HB_CODEPAGE_BGWIN DYNAMIC HB_CODEPAGE_CS852 +DYNAMIC HB_CODEPAGE_CS852C DYNAMIC HB_CODEPAGE_CSISO -DYNAMIC HB_CODEPAGE_CSKAM +DYNAMIC HB_CODEPAGE_CSKAMC DYNAMIC HB_CODEPAGE_CSWIN DYNAMIC HB_CODEPAGE_DE850 DYNAMIC HB_CODEPAGE_DE850M @@ -95,7 +96,7 @@ DYNAMIC HB_CODEPAGE_RUKOI8 DYNAMIC HB_CODEPAGE_SK852 DYNAMIC HB_CODEPAGE_SK852C DYNAMIC HB_CODEPAGE_SKISO -DYNAMIC HB_CODEPAGE_SKKAM +DYNAMIC HB_CODEPAGE_SKKAMC DYNAMIC HB_CODEPAGE_SKWIN DYNAMIC HB_CODEPAGE_SL646 DYNAMIC HB_CODEPAGE_SL852 diff --git a/harbour/include/hbsocket.h b/harbour/include/hbsocket.h index a76e832346..4cc78edf92 100644 --- a/harbour/include/hbsocket.h +++ b/harbour/include/hbsocket.h @@ -101,6 +101,7 @@ extern HB_EXPORT long hb_socketRecv( HB_SOCKET sd, void * data, long len extern HB_EXPORT long hb_socketRecvFrom( HB_SOCKET sd, void * data, long len, int flags, void ** pSockAddr, unsigned * puiSockLen, HB_MAXINT timeout ); extern HB_EXPORT int hb_socketSetBlockingIO( HB_SOCKET sd, HB_BOOL fBlocking ); extern HB_EXPORT int hb_socketSetNoDelay( HB_SOCKET sd, HB_BOOL fNoDelay ); +extern HB_EXPORT int hb_socketSetExclusiveAddr( HB_SOCKET sd, HB_BOOL fExclusive ); extern HB_EXPORT int hb_socketSetReuseAddr( HB_SOCKET sd, HB_BOOL fReuse ); extern HB_EXPORT int hb_socketSetKeepAlive( HB_SOCKET sd, HB_BOOL fKeepAlive ); extern HB_EXPORT int hb_socketSetBroadcast( HB_SOCKET sd, HB_BOOL fBroadcast ); diff --git a/harbour/src/codepage/Makefile b/harbour/src/codepage/Makefile index 3e30098717..7b5ff1fac6 100644 --- a/harbour/src/codepage/Makefile +++ b/harbour/src/codepage/Makefile @@ -10,8 +10,9 @@ C_SOURCES := \ cpbgmik.c \ cpbgwin.c \ cpcs852.c \ + cpcs852c.c \ cpcsiso.c \ - cpcskam.c \ + cpcskamc.c \ cpcswin.c \ cpde850.c \ cpde850m.c \ @@ -71,7 +72,7 @@ C_SOURCES := \ cpsk852.c \ cpsk852c.c \ cpskiso.c \ - cpskkam.c \ + cpskkamc.c \ cpskwin.c \ cpsl646.c \ cpsl852.c \ diff --git a/harbour/src/codepage/cpcs852c.c b/harbour/src/codepage/cpcs852c.c new file mode 100644 index 0000000000..0ebf2a14d2 --- /dev/null +++ b/harbour/src/codepage/cpcs852c.c @@ -0,0 +1,27 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( CS852C ) + * + * Copyright 2009 Przemyslaw Czerpak + * www - http://harbour-project.org + * + * This file is generated automatically by cpinfo.prg + */ + +#define HB_CP_ID CS852C +#define HB_CP_INFO "Czech CP-852 (ntxcz852.obj compatible)" +#define HB_CP_UNITB HB_UNITB_852 + +#define HB_CP_RAW + +static const unsigned char s_flags[ 256 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,0,6,6,0,6,6,0,0,0,6,0,0,0,0,10,0,10,10,6,6,6,10,6,0,0,10,10,10,6,0,0,6,6,6,6,6,0,0,10,6,0,0,0,0,10,0,0,0,0,0,0,0,0,10,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,6,10,10,0,6,0,0,0,0,0,10,0,10,0,10,0,0,6,10,6,10,10,6,0,6,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0 }; +static const unsigned char s_upper[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,154,144,131,142,222,134,135,136,211,138,139,140,141,142,143,144,145,145,226,153,149,149,151,152,153,154,155,155,157,158,172,181,214,224,233,164,165,166,166,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,210,213,214,215,183,217,218,219,220,221,222,223,224,225,226,227,228,213,230,230,232,233,232,235,237,237,238,239,240,241,242,243,244,245,246,247,248,249,250,235,252,252,254,255 }; +static const unsigned char s_lower[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,132,143,130,146,146,147,148,150,150,151,152,148,129,156,156,157,158,159,160,161,162,163,164,165,167,167,168,169,170,171,159,173,174,175,176,177,178,179,180,160,182,216,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,212,137,212,229,161,215,216,217,218,219,220,221,133,223,162,225,147,227,228,229,231,231,234,163,234,235,236,236,238,239,240,241,242,243,244,245,246,247,248,249,250,251,253,253,254,255 }; +static const unsigned char s_sort [ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,71,73,77,81,89,91,93,95,99,101,103,109,111,115,123,125,127,133,137,141,149,151,153,155,159,163,164,165,166,167,168,66,72,74,78,82,90,92,94,96,100,102,104,110,112,116,124,126,128,134,138,142,150,152,154,156,160,169,170,171,172,173,174,148,84,175,70,146,176,177,178,88,179,180,181,182,69,183,83,105,106,120,122,107,108,184,185,121,147,139,140,186,187,76,68,98,118,144,188,189,161,162,190,191,192,193,75,194,195,196,197,198,199,200,201,67,202,85,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,79,87,80,113,97,229,86,230,231,232,233,234,145,235,117,236,119,237,238,114,135,136,129,143,130,239,158,157,240,241,242,243,244,245,246,247,248,249,250,251,252,253,131,132,254,255 }; + +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpcskam.c b/harbour/src/codepage/cpcskam.c deleted file mode 100644 index c1162511ef..0000000000 --- a/harbour/src/codepage/cpcskam.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * National Collation Support Module ( CSKAM ) - * - * Copyright 2002 Alexander S.Kresin - * www - http://harbour-project.org - * Czech collating sequence (CSKAM) done by Vojtech Obrdlik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this software; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). - * - * As a special exception, the Harbour Project gives permission for - * additional uses of the text contained in its release of Harbour. - * - * The exception is that, if you link the Harbour libraries with other - * files to produce an executable, this does not by itself cause the - * resulting executable to be covered by the GNU General Public License. - * Your use of that executable is in no way restricted on account of - * linking the Harbour library code into it. - * - * This exception does not however invalidate any other reasons why - * the executable file might be covered by the GNU General Public License. - * - * This exception applies only to the code released by the Harbour - * Project under the name Harbour. If you copy code from other - * Harbour Project or Free Software Foundation releases into a copy of - * Harbour, as the General Public License permits, the exception does - * not apply to the code that you add in this way. To avoid misleading - * anyone as to the status of such modified files, you must delete - * this exception notice from them. - * - * If you write modifications of your own for Harbour, it is your choice - * whether to permit this exception to apply to your modifications. - * If you do not wish that, delete this exception notice. - * - */ - -#define HB_CP_ID CSKAM -#define HB_CP_INFO "Czech Kamenicky (895)" -#define HB_CP_UNITB HB_UNITB_KAM -#define HB_CP_ACSORT HB_CDP_ACSORT_NONE -#define HB_CP_UPPER "ABCDEFGH.CH.IJKLMNOPQRSTUVWXYZ" -#define HB_CP_LOWER "abcdefgh.ch.ijklmnopqrstuvwxyz" - -/* include CP registration code */ -#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpcskamc.c b/harbour/src/codepage/cpcskamc.c new file mode 100644 index 0000000000..e753265b4e --- /dev/null +++ b/harbour/src/codepage/cpcskamc.c @@ -0,0 +1,27 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( CSKAMC ) + * + * Copyright 2009 Przemyslaw Czerpak + * www - http://harbour-project.org + * + * This file is generated automatically by cpinfo.prg + */ + +#define HB_CP_ID CSKAMC +#define HB_CP_INFO "Czech Kamenicky (ntxcz895.obj compatible)" +#define HB_CP_UNITB HB_UNITB_KAM + +#define HB_CP_RAW + +static const unsigned char s_flags[ 256 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,10,6,6,6,6,10,10,6,6,10,10,10,6,6,10,10,10,6,10,6,6,10,6,10,6,10,10,10,10,10,10,6,6,6,6,6,6,10,10,10,6,6,6,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; +static const unsigned char s_upper[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,154,144,133,142,133,134,128,137,137,138,139,156,138,142,143,144,146,146,167,153,149,166,151,157,153,154,155,156,157,158,134,143,139,149,151,165,165,166,167,155,158,171,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 }; +static const unsigned char s_lower[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,135,129,130,131,132,131,159,135,136,136,141,161,140,141,132,160,130,145,145,147,148,162,150,163,152,148,129,168,140,152,169,159,160,161,162,163,164,164,150,147,168,169,170,170,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 }; +static const unsigned char s_sort [ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,71,73,77,81,87,89,91,93,97,99,101,107,109,113,121,123,125,131,135,139,147,149,151,153,157,161,162,163,164,165,166,66,72,74,78,82,88,90,92,94,98,100,102,108,110,114,122,124,126,132,136,140,148,150,152,154,158,167,168,169,170,171,75,146,84,80,70,79,137,76,86,85,103,95,106,104,69,67,83,160,159,118,120,115,144,141,156,119,145,133,105,155,129,138,68,96,116,142,112,111,143,117,134,130,128,127,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 }; + +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpsk852c.c b/harbour/src/codepage/cpsk852c.c index 3b879eac68..8e434c6b3b 100644 --- a/harbour/src/codepage/cpsk852c.c +++ b/harbour/src/codepage/cpsk852c.c @@ -4,7 +4,7 @@ /* * Harbour Project source code: - * National Collation Support Module ( SK852 ) + * National Collation Support Module ( SK852C ) * * Copyright 2009 Przemyslaw Czerpak * www - http://harbour-project.org @@ -15,9 +15,13 @@ #define HB_CP_ID SK852C #define HB_CP_INFO "Slovak CP-852 (ntxsl852.obj compatible)" #define HB_CP_UNITB HB_UNITB_852 -#define HB_CP_ACSORT HB_CDP_ACSORT_NONE -#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUޚVWXYZ" -#define HB_CP_LOWER "abcde؉fghijklmnopqrstuvwxyz" + +#define HB_CP_RAW + +static const unsigned char s_flags[ 256 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,0,6,6,0,6,6,0,0,0,6,0,0,0,0,10,0,10,10,6,6,6,10,6,0,0,10,10,10,6,0,0,6,6,6,6,6,0,0,10,6,0,0,0,0,10,0,0,0,0,0,0,0,0,10,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,6,10,10,0,6,0,0,0,0,0,10,0,10,0,10,0,0,6,10,6,10,10,6,0,6,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,6,0,0 }; +static const unsigned char s_upper[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,154,144,131,142,222,134,135,136,211,138,139,140,141,142,143,144,145,145,226,153,149,149,151,152,153,154,155,155,157,158,172,181,214,224,233,164,165,166,166,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,210,213,214,215,183,217,218,219,220,221,222,223,224,225,226,227,228,213,230,230,232,233,232,235,237,237,238,239,240,241,242,243,244,245,246,247,248,249,250,235,252,252,254,255 }; +static const unsigned char s_lower[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,132,143,130,146,146,147,148,150,150,151,152,148,129,156,156,157,158,159,160,161,162,163,164,165,167,167,168,169,170,171,159,173,174,175,176,177,178,179,180,160,182,216,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,212,137,212,229,161,215,216,217,218,219,220,221,133,223,162,225,147,227,228,229,231,231,234,163,234,235,236,236,238,239,240,241,242,243,244,245,246,247,248,249,250,251,253,253,254,255 }; +static const unsigned char s_sort [ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,71,73,77,81,89,91,93,95,99,101,103,109,111,115,123,125,127,133,137,141,149,151,153,155,159,163,164,165,166,167,168,66,72,74,78,82,90,92,94,96,100,102,104,110,112,116,124,126,128,134,138,142,150,152,154,156,160,169,170,171,172,173,174,148,84,175,70,146,176,177,178,88,179,180,181,182,69,183,83,105,106,120,122,107,108,184,185,121,147,139,140,186,187,76,68,98,118,144,188,189,161,162,190,191,192,193,75,194,195,196,197,198,199,200,201,67,202,85,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,79,87,80,113,97,229,86,230,231,232,233,234,145,235,117,236,119,237,238,114,135,136,129,143,130,239,158,157,240,241,242,243,244,245,246,247,248,249,250,251,252,253,131,132,254,255 }; /* include CP registration code */ #include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpskkam.c b/harbour/src/codepage/cpskkam.c deleted file mode 100644 index 6df5adc170..0000000000 --- a/harbour/src/codepage/cpskkam.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * National Collation Support Module ( SKKAM ) - * - * Copyright 2007-2010 Viktor Szakats (harbour.01 syenar.hu) - * www - http://harbour-project.org - * - * This file is generated automatically by cpinfo.prg - */ - -#define HB_CP_ID SKKAM -#define HB_CP_INFO "Slovak Kamenicky (895)" -#define HB_CP_UNITB HB_UNITB_KAM -#define HB_CP_ACSORT HB_CDP_ACSORT_NONE -#define HB_CP_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" -#define HB_CP_LOWER "abcdefghijklmnopqrstuvwxyz" - -/* include CP registration code */ -#include "hbcdpreg.h" diff --git a/harbour/src/codepage/cpskkamc.c b/harbour/src/codepage/cpskkamc.c new file mode 100644 index 0000000000..d941f3b2ec --- /dev/null +++ b/harbour/src/codepage/cpskkamc.c @@ -0,0 +1,27 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * National Collation Support Module ( SKKAMC ) + * + * Copyright 2009 Przemyslaw Czerpak + * www - http://harbour-project.org + * + * This file is generated automatically by cpinfo.prg + */ + +#define HB_CP_ID SKKAMC +#define HB_CP_INFO "Slovak Kamenicky (ntxsl895.obj compatible)" +#define HB_CP_UNITB HB_UNITB_KAM + +#define HB_CP_RAW + +static const unsigned char s_flags[ 256 ] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,0,0,0,0,10,6,6,6,6,10,10,6,6,10,10,10,6,6,10,10,10,6,10,6,6,10,6,10,6,10,10,10,10,10,10,6,6,6,6,6,6,10,10,10,6,6,6,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; +static const unsigned char s_upper[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,123,124,125,126,127,128,154,144,133,142,133,134,128,137,137,138,139,156,138,142,143,144,146,146,167,153,149,166,151,157,153,154,155,156,157,158,134,143,139,149,151,165,165,166,167,155,158,171,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 }; +static const unsigned char s_lower[ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,135,129,130,131,132,131,159,135,136,136,141,161,140,141,132,160,130,145,145,147,148,162,150,163,152,148,129,168,140,152,169,159,160,161,162,163,164,164,150,147,168,169,170,170,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 }; +static const unsigned char s_sort [ 256 ] = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,71,73,77,81,87,89,91,93,97,99,101,107,109,113,121,123,125,131,135,139,147,149,151,153,157,161,162,163,164,165,166,66,72,74,78,82,88,90,92,94,98,100,102,108,110,114,122,124,126,132,136,140,148,150,152,154,158,167,168,169,170,171,75,146,84,80,70,79,137,76,86,85,103,95,106,104,69,67,83,160,159,118,120,115,144,141,156,119,145,133,105,155,129,138,68,96,116,142,112,111,143,117,134,130,128,127,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255 }; + +/* include CP registration code */ +#include "hbcdpreg.h" diff --git a/harbour/src/rtl/hbinet.c b/harbour/src/rtl/hbinet.c index 909da9ebc2..97632a226b 100644 --- a/harbour/src/rtl/hbinet.c +++ b/harbour/src/rtl/hbinet.c @@ -1105,7 +1105,12 @@ HB_FUNC( HB_INETIFINFO ) static int s_inetBind( PHB_SOCKET_STRUCT socket, const void * pSockAddr, unsigned uiLen ) { +#if defined( HB_OS_WIN ) + /* TODO: Do not set this for UDP multicast */ + hb_socketSetExclusiveAddr( socket->sd, HB_TRUE ); +#else hb_socketSetReuseAddr( socket->sd, HB_TRUE ); +#endif return hb_socketBind( socket->sd, pSockAddr, uiLen ); } diff --git a/harbour/src/rtl/hbsocket.c b/harbour/src/rtl/hbsocket.c index f63419410a..48c8d87882 100644 --- a/harbour/src/rtl/hbsocket.c +++ b/harbour/src/rtl/hbsocket.c @@ -600,6 +600,14 @@ int hb_socketSetNoDelay( HB_SOCKET sd, HB_BOOL fNoDelay ) return -1; } +int hb_socketSetExclusiveAddr( HB_SOCKET sd, HB_BOOL fExclusive ) +{ + HB_SYMBOL_UNUSED( sd ); + HB_SYMBOL_UNUSED( fReuse ); + hb_socketSetRawError( HB_SOCKET_ERR_INVALIDHANDLE ); + return -1; +} + int hb_socketSetReuseAddr( HB_SOCKET sd, HB_BOOL fReuse ) { HB_SYMBOL_UNUSED( sd ); @@ -2432,24 +2440,53 @@ int hb_socketSetNoDelay( HB_SOCKET sd, HB_BOOL fNoDelay ) return ret; } -int hb_socketSetReuseAddr( HB_SOCKET sd, HB_BOOL fReuse ) +/* NOTE: For notes on Windows, see: + http://paste.lisp.org/display/59751 + [vszakats] */ +int hb_socketSetExclusiveAddr( HB_SOCKET sd, HB_BOOL fExclusive ) { - /* it allows to reuse port immediately without timeout used to - * clean all pending connections addressed to previous port owner - */ - int val = fReuse ? 1 : 0, ret; + int ret; #if defined( HB_OS_WIN ) #if defined( SO_EXCLUSIVEADDRUSE ) - /* NOTE: For notes on Windows, see: http://paste.lisp.org/display/59751 */ + int val = fExclusive ? 1 : 0; ret = setsockopt( sd, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, ( const char * ) &val, sizeof( val ) ); + hb_socketSetOsError( ret != -1 ? 0 : HB_SOCK_GETERROR() ); #else - HB_SYMBOL_UNUSED( val ); + HB_SYMBOL_UNUSED( sd ); + HB_SYMBOL_UNUSED( fExclusive ); + hb_socketSetRawError( HB_SOCKET_ERR_NOSUPPORT ); ret = -1; #endif #else - ret = setsockopt( sd, SOL_SOCKET, SO_REUSEADDR, ( const char * ) &val, sizeof( val ) ); + HB_SYMBOL_UNUSED( sd ); + HB_SYMBOL_UNUSED( fExclusive ); + hb_socketSetOsError( 0 ); + ret = 0; + #endif + return ret; +} + +int hb_socketSetReuseAddr( HB_SOCKET sd, HB_BOOL fReuse ) +{ + int ret; + /* it allows to reuse port immediately without timeout used to + * clean all pending connections addressed to previous port owner + */ + #if defined( HB_OS_WIN ) + /* SO_REUSEADDR in MS-Windows makes sth completly different + * then in other OS-es + */ + HB_SYMBOL_UNUSED( sd ); + HB_SYMBOL_UNUSED( fReuse ); + hb_socketSetRawError( HB_SOCKET_ERR_NOSUPPORT ); + ret = -1; + #else + { + int val = fReuse ? 1 : 0; + ret = setsockopt( sd, SOL_SOCKET, SO_REUSEADDR, ( const char * ) &val, sizeof( val ) ); + hb_socketSetOsError( ret != -1 ? 0 : HB_SOCK_GETERROR() ); + } #endif - hb_socketSetOsError( ret != -1 ? 0 : HB_SOCK_GETERROR() ); return ret; } diff --git a/harbour/src/rtl/hbsockhb.c b/harbour/src/rtl/hbsockhb.c index 51622ffa1b..eac8862712 100644 --- a/harbour/src/rtl/hbsockhb.c +++ b/harbour/src/rtl/hbsockhb.c @@ -69,6 +69,7 @@ * HB_SOCKETRECVFROM( hSocket, @cBuffer, [ nLen = LEN( cBuffer ) ], [ nFlags = 0 ], @aAddr, [ nTimeout = FOREVER ] ) --> nBytesRecv * HB_SOCKETSETBLOCKINGIO( hSocket, lValue ) --> lSuccess * HB_SOCKETSETNODELAY( hSocket, lValue ) --> lSuccess + * HB_SOCKETSETEXCLUSIVEADDR( hSocket, lValue ) --> lSuccess * HB_SOCKETSETREUSEADDR( hSocket, lValue ) --> lSuccess * HB_SOCKETSETKEEPALIVE( hSocket, lValue ) --> lSuccess * HB_SOCKETSETBROADCAST( hSocket, lValue ) --> lSuccess @@ -479,6 +480,15 @@ HB_FUNC( HB_SOCKETSETNODELAY ) } } +HB_FUNC( HB_SOCKETSETEXCLUSIVEADDR ) +{ + HB_SOCKET socket = hb_socketParam( 1 ); + if( socket != HB_NO_SOCKET ) + { + hb_retl( hb_socketSetExclusiveAddr( socket, hb_parl( 2 ) ) == 0 ); + } +} + HB_FUNC( HB_SOCKETSETREUSEADDR ) { HB_SOCKET socket = hb_socketParam( 1 );