2010-02-07 14:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbct/strdiff.c
* contrib/hbct/token2.c
* contrib/hbct/charlist.c
* contrib/hbct/charonly.c
* contrib/hbct/atadjust.c
* contrib/hbct/charsort.c
* contrib/hbct/charmix.c
* contrib/hbct/charevod.c
* contrib/hbct/wordrepl.c
* contrib/hbct/charrepl.c
* contrib/hbct/strswap.c
* contrib/hbct/charswap.c
* contrib/hbct/charop.c
* contrib/hbct/charone.c
* contrib/hbct/pos1.c
* contrib/hbct/ascpos.c
* contrib/hbct/ctstr.c
* contrib/hbct/token1.c
* contrib/hbct/ctstr.h
* contrib/hbct/charmirr.c
* contrib/hbct/relation.c
* contrib/hbct/atnum.c
* contrib/hbct/count.c
* contrib/hbct/ctcrypt.c
* contrib/hbct/posdiff.c
* contrib/hbct/range.c
* contrib/hbct/addascii.c
* contrib/hbct/tab.c
* contrib/hbct/dattime2.c
* contrib/hbct/replace.c
* contrib/hbct/pos2.c
* contrib/hbct/numat.c
* contrib/hbct/atrepl.c
* contrib/hbct/wordtoch.c
* contrib/hbct/ctpad.c
* contrib/hbct/justify.c
* contrib/hbct/remove.c
* size_t -> HB_SIZE
% Deleted now unnecessary casts.
+ Added casts to strlen() calls.
* contrib/hbct/ctcrypt.c
* ULONG -> HB_SIZE
* contrib/hbct/dattime2.c
* Formatting.
This commit is contained in:
@@ -17,6 +17,54 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-02-07 14:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbct/strdiff.c
|
||||
* contrib/hbct/token2.c
|
||||
* contrib/hbct/charlist.c
|
||||
* contrib/hbct/charonly.c
|
||||
* contrib/hbct/atadjust.c
|
||||
* contrib/hbct/charsort.c
|
||||
* contrib/hbct/charmix.c
|
||||
* contrib/hbct/charevod.c
|
||||
* contrib/hbct/wordrepl.c
|
||||
* contrib/hbct/charrepl.c
|
||||
* contrib/hbct/strswap.c
|
||||
* contrib/hbct/charswap.c
|
||||
* contrib/hbct/charop.c
|
||||
* contrib/hbct/charone.c
|
||||
* contrib/hbct/pos1.c
|
||||
* contrib/hbct/ascpos.c
|
||||
* contrib/hbct/ctstr.c
|
||||
* contrib/hbct/token1.c
|
||||
* contrib/hbct/ctstr.h
|
||||
* contrib/hbct/charmirr.c
|
||||
* contrib/hbct/relation.c
|
||||
* contrib/hbct/atnum.c
|
||||
* contrib/hbct/count.c
|
||||
* contrib/hbct/ctcrypt.c
|
||||
* contrib/hbct/posdiff.c
|
||||
* contrib/hbct/range.c
|
||||
* contrib/hbct/addascii.c
|
||||
* contrib/hbct/tab.c
|
||||
* contrib/hbct/dattime2.c
|
||||
* contrib/hbct/replace.c
|
||||
* contrib/hbct/pos2.c
|
||||
* contrib/hbct/numat.c
|
||||
* contrib/hbct/atrepl.c
|
||||
* contrib/hbct/wordtoch.c
|
||||
* contrib/hbct/ctpad.c
|
||||
* contrib/hbct/justify.c
|
||||
* contrib/hbct/remove.c
|
||||
* size_t -> HB_SIZE
|
||||
% Deleted now unnecessary casts.
|
||||
+ Added casts to strlen() calls.
|
||||
|
||||
* contrib/hbct/ctcrypt.c
|
||||
* ULONG -> HB_SIZE
|
||||
|
||||
* contrib/hbct/dattime2.c
|
||||
* Formatting.
|
||||
|
||||
2010-02-07 14:18 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* src/pp/ppcore.c
|
||||
* src/vm/itemapi.c
|
||||
|
||||
@@ -130,9 +130,9 @@ HB_FUNC( ADDASCII )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcSource = hb_parc( 1 );
|
||||
size_t sLen = hb_parclen( 1 );
|
||||
HB_SIZE sLen = hb_parclen( 1 );
|
||||
char *pcResult;
|
||||
size_t sPos;
|
||||
HB_SIZE sPos;
|
||||
LONG lValue;
|
||||
int iCarryOver;
|
||||
|
||||
@@ -169,7 +169,7 @@ HB_FUNC( ADDASCII )
|
||||
|
||||
if( iCarryOver )
|
||||
{
|
||||
size_t sCurrent;
|
||||
HB_SIZE sCurrent;
|
||||
LONG lResult;
|
||||
|
||||
for( sCurrent = sPos; sCurrent > 0 && lValue != 0; sCurrent-- )
|
||||
|
||||
@@ -67,9 +67,9 @@ static void do_ascpos( int iSwitch )
|
||||
{
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
size_t sStrSize = hb_parclen( 1 );
|
||||
HB_SIZE sStrSize = hb_parclen( 1 );
|
||||
const BYTE *pcString = ( const BYTE * ) hb_parc( 1 );
|
||||
size_t sPos;
|
||||
HB_SIZE sPos;
|
||||
|
||||
if( HB_ISNUM( 2 ) )
|
||||
sPos = hb_parnl( 2 );
|
||||
@@ -84,8 +84,8 @@ static void do_ascpos( int iSwitch )
|
||||
{
|
||||
if( iSwitch == DO_ASCPOS_VALPOS )
|
||||
{
|
||||
if( HB_ISDIGIT( ( size_t ) pcString[sPos - 1] ) )
|
||||
hb_retnl( pcString[sPos - 1] - 48 );
|
||||
if( HB_ISDIGIT( ( HB_UCHAR ) pcString[ sPos - 1 ] ) )
|
||||
hb_retnl( pcString[ sPos - 1 ] - 48 );
|
||||
else
|
||||
hb_retni( 0 );
|
||||
}
|
||||
|
||||
@@ -103,26 +103,26 @@ HB_FUNC( ATADJUST )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) && HB_ISNUM( 3 ) )
|
||||
{
|
||||
const char *pcStringToMatch = hb_parc( 1 );
|
||||
size_t sStrToMatchLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrToMatchLen = hb_parclen( 1 );
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
size_t sAdjustPosition = hb_parnl( 3 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
HB_SIZE sAdjustPosition = hb_parnl( 3 );
|
||||
|
||||
int iMultiPass = ct_getatmupa();
|
||||
int iAtLike = ct_getatlike();
|
||||
char cAtLike = ct_getatlikechar();
|
||||
size_t sIgnore, sMatchStrLen = 0;
|
||||
HB_SIZE sIgnore, sMatchStrLen = 0;
|
||||
ULONG ulCounter;
|
||||
const char *pc = NULL;
|
||||
|
||||
char cFillChar;
|
||||
const char *pcCheckFill;
|
||||
char *pcRetStr;
|
||||
size_t sRetStrLen;
|
||||
HB_SIZE sRetStrLen;
|
||||
|
||||
/* eventually ignore some characters */
|
||||
if( HB_ISNUM( 5 ) )
|
||||
sIgnore = ( size_t ) hb_parnl( 5 );
|
||||
sIgnore = ( HB_SIZE ) hb_parnl( 5 );
|
||||
else
|
||||
sIgnore = 0;
|
||||
|
||||
@@ -165,7 +165,7 @@ HB_FUNC( ATADJUST )
|
||||
{
|
||||
/* find the <ulCounter>th match */
|
||||
const char *pcSubStr;
|
||||
size_t sSubStrLen;
|
||||
HB_SIZE sSubStrLen;
|
||||
ULONG ulMatchCounter = 0;
|
||||
|
||||
pcSubStr = pcString;
|
||||
|
||||
@@ -68,19 +68,19 @@ static void do_atnum( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pcStringToMatch = hb_parc( 1 );
|
||||
size_t sStrToMatchLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrToMatchLen = hb_parclen( 1 );
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
int iMultiPass = ct_getatmupa();
|
||||
int iAtLike = ct_getatlike();
|
||||
char cAtLike = ct_getatlikechar();
|
||||
size_t sIgnore, sMatchStrLen = 0;
|
||||
HB_SIZE sIgnore, sMatchStrLen = 0;
|
||||
ULONG ulCounter;
|
||||
const char *pc = NULL;
|
||||
|
||||
/* eventually ignore some characters */
|
||||
if( HB_ISNUM( 4 ) )
|
||||
sIgnore = ( size_t ) hb_parnl( 4 );
|
||||
sIgnore = ( HB_SIZE ) hb_parnl( 4 );
|
||||
else
|
||||
sIgnore = 0;
|
||||
|
||||
@@ -141,7 +141,7 @@ static void do_atnum( int iSwitch )
|
||||
{
|
||||
/* find the <ulCounter>th match */
|
||||
const char *pcSubStr;
|
||||
size_t sSubStrLen;
|
||||
HB_SIZE sSubStrLen;
|
||||
ULONG ulMatchCounter = 0;
|
||||
|
||||
pcSubStr = pcString;
|
||||
|
||||
@@ -126,25 +126,25 @@ HB_FUNC( ATREPL )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pcStringToMatch = hb_parc( 1 );
|
||||
size_t sStrToMatchLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrToMatchLen = hb_parclen( 1 );
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
int iMultiPass = ct_getatmupa();
|
||||
int iAtLike = ct_getatlike();
|
||||
char cAtLike = ct_getatlikechar();
|
||||
size_t sIgnore, sMatchStrLen = 0;
|
||||
HB_SIZE sIgnore, sMatchStrLen = 0;
|
||||
ULONG ulCounter;
|
||||
char *pc;
|
||||
|
||||
const char *pcReplacement;
|
||||
size_t sReplaceLen;
|
||||
HB_SIZE sReplaceLen;
|
||||
int iReplaceMode;
|
||||
char *pcRetStr;
|
||||
size_t sRetStrLen;
|
||||
HB_SIZE sRetStrLen;
|
||||
|
||||
/* eventually ignore some characters */
|
||||
if( HB_ISNUM( 6 ) )
|
||||
sIgnore = ( size_t ) hb_parnl( 6 );
|
||||
sIgnore = ( HB_SIZE ) hb_parnl( 6 );
|
||||
else
|
||||
sIgnore = 0;
|
||||
|
||||
@@ -196,7 +196,7 @@ HB_FUNC( ATREPL )
|
||||
NOTE: if iReplaceMode = false and the nth occurence does not exist,
|
||||
all occurences are replaced */
|
||||
char *pcRetSubStr;
|
||||
size_t sRetSubStrLen;
|
||||
HB_SIZE sRetSubStrLen;
|
||||
ULONG ulMatchCounter = 0;
|
||||
|
||||
sRetStrLen = sStrLen;
|
||||
@@ -239,7 +239,7 @@ HB_FUNC( ATREPL )
|
||||
{
|
||||
/* pcRetStr grows, so realloc memory */
|
||||
/* save pc pointer */
|
||||
size_t sPCPos = pc - pcRetStr;
|
||||
HB_SIZE sPCPos = pc - pcRetStr;
|
||||
|
||||
pcRetStr = ( char * ) hb_xrealloc( pcRetStr,
|
||||
sRetStrLen + ( sReplaceLen - sMatchStrLen ) );
|
||||
@@ -306,7 +306,7 @@ HB_FUNC( ATREPL )
|
||||
{
|
||||
/* pcRetStr grows, so realloc memory */
|
||||
/* save pc pointer */
|
||||
size_t sPCPos = pc - pcRetStr;
|
||||
HB_SIZE sPCPos = pc - pcRetStr;
|
||||
|
||||
pcRetStr = ( char * ) hb_xrealloc( pcRetStr,
|
||||
sRetStrLen + ( sReplaceLen - sMatchStrLen ) );
|
||||
|
||||
@@ -68,9 +68,9 @@ static void do_charevod( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sLen = hb_parclen( 1 );
|
||||
HB_SIZE sLen = hb_parclen( 1 );
|
||||
char *pcResult;
|
||||
size_t sPos, sResultPos;
|
||||
HB_SIZE sPos, sResultPos;
|
||||
|
||||
if( sLen == 0 )
|
||||
{
|
||||
|
||||
@@ -68,10 +68,10 @@
|
||||
static void do_list( int iSwitch )
|
||||
{
|
||||
const char *pcString;
|
||||
size_t sStrLen;
|
||||
HB_SIZE sStrLen;
|
||||
|
||||
size_t asCharCnt[256];
|
||||
size_t sCnt;
|
||||
HB_SIZE asCharCnt[256];
|
||||
HB_SIZE sCnt;
|
||||
|
||||
/* init asCharCnt */
|
||||
for( sCnt = 0; sCnt < 256; sCnt++ )
|
||||
@@ -83,7 +83,7 @@ static void do_list( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
pcString = hb_parc( 1 );
|
||||
sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
sStrLen = hb_parclen( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -95,14 +95,14 @@ static void do_list( int iSwitch )
|
||||
if( iSwitch == DO_LIST_CHARLIST )
|
||||
{
|
||||
char pcRet[256];
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
|
||||
for( sCnt = 0; sCnt < sStrLen; sCnt++ )
|
||||
{
|
||||
if( asCharCnt[( size_t ) ( pcString[sCnt] )] == 0 )
|
||||
if( asCharCnt[( HB_SIZE ) ( pcString[sCnt] )] == 0 )
|
||||
{
|
||||
pcRet[sRetStrLen++] = pcString[sCnt];
|
||||
asCharCnt[( size_t ) ( pcString[sCnt] )] = 1;
|
||||
asCharCnt[( HB_SIZE ) ( pcString[sCnt] )] = 1;
|
||||
}
|
||||
}
|
||||
hb_retclen( pcRet, sRetStrLen );
|
||||
@@ -111,7 +111,7 @@ static void do_list( int iSwitch )
|
||||
{
|
||||
for( sCnt = 0; sCnt < sStrLen; sCnt++ )
|
||||
{
|
||||
size_t sIndex = ( size_t ) ( unsigned char ) ( *( pcString + sCnt ) );
|
||||
HB_SIZE sIndex = ( HB_SIZE ) ( unsigned char ) ( *( pcString + sCnt ) );
|
||||
asCharCnt[sIndex] = asCharCnt[sIndex] + 1;
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ static void do_list( int iSwitch )
|
||||
case DO_LIST_CHARSLIST:
|
||||
{
|
||||
char *pcRet;
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
|
||||
pcRet = ( char * ) hb_xgrab( 256 );
|
||||
|
||||
@@ -138,7 +138,7 @@ static void do_list( int iSwitch )
|
||||
case DO_LIST_CHARNOLIST:
|
||||
{
|
||||
char *pcRet;
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
|
||||
pcRet = ( char * ) hb_xgrab( 256 );
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ HB_FUNC( CHARMIRR )
|
||||
{
|
||||
|
||||
const char *pcString = hb_parc( 1 ), *pc1;
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet, *pc2;
|
||||
int iDontMirrorSpaces;
|
||||
|
||||
|
||||
@@ -115,8 +115,8 @@ HB_FUNC( CHARMIX )
|
||||
const char *pcString1 = hb_parc( 1 );
|
||||
const char *pcString2;
|
||||
char *pcResult;
|
||||
size_t sLen1 = hb_parclen( 1 );
|
||||
size_t sLen2, sPos1, sPos2, sResultPos;
|
||||
HB_SIZE sLen1 = hb_parclen( 1 );
|
||||
HB_SIZE sLen2, sPos1, sPos2, sResultPos;
|
||||
|
||||
if( sLen1 == 0 )
|
||||
{
|
||||
|
||||
@@ -66,9 +66,9 @@
|
||||
static void do_charone( int iSwitch )
|
||||
{
|
||||
const char *pcString;
|
||||
size_t sStrLen;
|
||||
HB_SIZE sStrLen;
|
||||
const char *pcDeleteSet;
|
||||
size_t sDeleteSetLen;
|
||||
HB_SIZE sDeleteSetLen;
|
||||
|
||||
/* param check */
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
@@ -76,14 +76,14 @@ static void do_charone( int iSwitch )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
pcString = hb_parc( 2 );
|
||||
sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
sStrLen = hb_parclen( 2 );
|
||||
pcDeleteSet = hb_parc( 1 );
|
||||
sDeleteSetLen = ( size_t ) hb_parclen( 1 );
|
||||
sDeleteSetLen = hb_parclen( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
pcString = hb_parc( 1 );
|
||||
sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
sStrLen = hb_parclen( 1 );
|
||||
pcDeleteSet = NULL;
|
||||
sDeleteSetLen = 0;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ static void do_charone( int iSwitch )
|
||||
{
|
||||
const char *pcSub;
|
||||
char *pcRet;
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
char cCurrent = *pcString;
|
||||
|
||||
pcRet = ( char * ) hb_xgrab( sStrLen );
|
||||
@@ -130,7 +130,7 @@ static void do_charone( int iSwitch )
|
||||
{
|
||||
const char *pcSub;
|
||||
char *pcRet;
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
char cCurrent1 = pcString[0];
|
||||
char cCurrent2 = pcString[1];
|
||||
|
||||
@@ -152,7 +152,7 @@ static void do_charone( int iSwitch )
|
||||
{
|
||||
const char *pc = NULL;
|
||||
const char *pStart = pcDeleteSet;
|
||||
size_t sLen = sDeleteSetLen;
|
||||
HB_SIZE sLen = sDeleteSetLen;
|
||||
|
||||
while( sLen >= 2 &&
|
||||
( pc = ct_at_exact_forward( pStart, sLen, pcSub,
|
||||
|
||||
@@ -73,11 +73,11 @@ static void do_charonly( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
const char *pcOnlySet = hb_parc( 1 );
|
||||
size_t sOnlySetLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sOnlySetLen = hb_parclen( 1 );
|
||||
char *pcRet;
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
int iShift, iBool;
|
||||
const char *pcSub, *pc;
|
||||
|
||||
|
||||
@@ -87,8 +87,8 @@ static void do_charop( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
|
||||
size_t sStrLen = hb_parclen( 1 );
|
||||
size_t sPos;
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sPos;
|
||||
unsigned char *pucString = ( unsigned char * ) hb_parc( 1 );
|
||||
unsigned char *pucResult;
|
||||
|
||||
@@ -199,7 +199,7 @@ static void do_charop( int iSwitch )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pucString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
|
||||
for( sPos = 0; sPos < sStrLen; sPos++ )
|
||||
pucResult[sPos] = ( char ) ( pucString[sPos] + pucString2[ sStrLen2 ? ( sPos % sStrLen2 ) : 0 ] );
|
||||
@@ -225,7 +225,7 @@ static void do_charop( int iSwitch )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pucString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
|
||||
for( sPos = 0; sPos < sStrLen; sPos++ )
|
||||
pucResult[sPos] = ( char ) ( pucString[sPos] - pucString2[ sStrLen2 ? ( sPos % sStrLen2 ) : 0 ] );
|
||||
@@ -251,7 +251,7 @@ static void do_charop( int iSwitch )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pucString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
|
||||
for( sPos = 0; sPos < sStrLen; sPos++ )
|
||||
pucResult[sPos] = ( char ) ( pucString[sPos] & pucString2[ sStrLen2 ? ( sPos % sStrLen2 ) : 0 ] );
|
||||
@@ -276,7 +276,7 @@ static void do_charop( int iSwitch )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pucString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
|
||||
for( sPos = 0; sPos < sStrLen; sPos++ )
|
||||
pucResult[sPos] = ( char ) ( pucString[sPos] | pucString2[ sStrLen2 ? ( sPos % sStrLen2 ) : 0 ] );
|
||||
@@ -301,7 +301,7 @@ static void do_charop( int iSwitch )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pucString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
|
||||
for( sPos = 0; sPos < sStrLen; sPos++ )
|
||||
pucResult[sPos] = ( char ) ( pucString[sPos] ^ pucString2[ sStrLen2 ? ( sPos % sStrLen2 ) : 0 ] );
|
||||
|
||||
@@ -123,23 +123,23 @@
|
||||
HB_FUNC( CHARREPL )
|
||||
{
|
||||
int iNoRet;
|
||||
size_t sSearchLen, sReplaceLen;
|
||||
HB_SIZE sSearchLen, sReplaceLen;
|
||||
|
||||
/* suppressing return value ? */
|
||||
iNoRet = ct_getref() && HB_ISBYREF( 2 );
|
||||
|
||||
/* param check */
|
||||
if( ( sSearchLen = ( size_t ) hb_parclen( 1 ) ) > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = ( size_t ) hb_parclen( 3 ) ) > 0 )
|
||||
if( ( sSearchLen = hb_parclen( 1 ) ) > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = hb_parclen( 3 ) ) > 0 )
|
||||
{
|
||||
/* get parameters */
|
||||
const char *pcSearch = hb_parc( 1 );
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
const char *pcReplace = hb_parc( 3 );
|
||||
int iMode;
|
||||
char *pcRet;
|
||||
size_t sIndex;
|
||||
HB_SIZE sIndex;
|
||||
|
||||
/* if sStrLen == 0, we can return immediately */
|
||||
if( sStrLen == 0 )
|
||||
@@ -169,9 +169,9 @@ HB_FUNC( CHARREPL )
|
||||
|
||||
for( sIndex = 0; sIndex < sSearchLen; sIndex++ )
|
||||
{
|
||||
size_t sMatchStrLen;
|
||||
HB_SIZE sMatchStrLen;
|
||||
const char *pc;
|
||||
size_t sReplIndex = sIndex;
|
||||
HB_SIZE sReplIndex = sIndex;
|
||||
|
||||
if( sReplIndex > sReplaceLen - 1 )
|
||||
{
|
||||
@@ -221,8 +221,8 @@ HB_FUNC( CHARREPL )
|
||||
hb_retclen_buffer( pcRet, sStrLen );
|
||||
}
|
||||
}
|
||||
else /* ( ( sSearchLen = ( size_t ) hb_parclen( 1 ) ) > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = ( size_t ) hb_parclen( 3 ) ) > 0 ) */
|
||||
else /* ( ( sSearchLen = hb_parclen( 1 ) ) > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = hb_parclen( 3 ) ) > 0 ) */
|
||||
{
|
||||
PHB_ITEM pSubst = NULL;
|
||||
int iArgErrorMode = ct_getargerrormode();
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
#include "ct.h"
|
||||
|
||||
/* statics */
|
||||
static size_t ssCompareLen; /* TODO: make this thread safe */
|
||||
static size_t ssElementPos; /* TODO: make this thread safe */
|
||||
static HB_SIZE s_sCompareLen; /* TODO: make this thread safe */
|
||||
static HB_SIZE s_sElementPos; /* TODO: make this thread safe */
|
||||
|
||||
/* qsort function */
|
||||
#ifdef __IBMCPP__
|
||||
@@ -69,10 +69,10 @@ _hb_do_sortascend( const void *p1, const void *p2 )
|
||||
char *pc1 = ( char * ) p1;
|
||||
char *pc2 = ( char * ) p2;
|
||||
|
||||
pc1 += ssElementPos;
|
||||
pc2 += ssElementPos;
|
||||
pc1 += s_sElementPos;
|
||||
pc2 += s_sElementPos;
|
||||
|
||||
return strncmp( pc1, pc2, ssCompareLen );
|
||||
return strncmp( pc1, pc2, s_sCompareLen );
|
||||
}
|
||||
|
||||
#ifdef __IBMCPP__
|
||||
@@ -85,10 +85,10 @@ _hb_do_sortdescend( const void *p1, const void *p2 )
|
||||
char *pc1 = ( char * ) p1;
|
||||
char *pc2 = ( char * ) p2;
|
||||
|
||||
pc1 += ssElementPos;
|
||||
pc2 += ssElementPos;
|
||||
pc1 += s_sElementPos;
|
||||
pc2 += s_sElementPos;
|
||||
|
||||
return -strncmp( pc1, pc2, ssCompareLen );
|
||||
return -strncmp( pc1, pc2, s_sCompareLen );
|
||||
}
|
||||
|
||||
|
||||
@@ -186,8 +186,8 @@ HB_FUNC( CHARSORT )
|
||||
/* get parameters */
|
||||
const char *pcString = hb_parc( 1 );
|
||||
char *pcRet;
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
size_t sElementLen, sIgnore, sSortLen;
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sElementLen, sIgnore, sSortLen;
|
||||
int iDescend;
|
||||
|
||||
if( HB_ISNUM( 2 ) )
|
||||
@@ -196,9 +196,9 @@ HB_FUNC( CHARSORT )
|
||||
sElementLen = 1;
|
||||
|
||||
if( HB_ISNUM( 3 ) )
|
||||
ssCompareLen = hb_parnl( 3 );
|
||||
s_sCompareLen = hb_parnl( 3 );
|
||||
else
|
||||
ssCompareLen = sElementLen;
|
||||
s_sCompareLen = sElementLen;
|
||||
|
||||
if( HB_ISNUM( 4 ) )
|
||||
sIgnore = hb_parnl( 4 );
|
||||
@@ -206,9 +206,9 @@ HB_FUNC( CHARSORT )
|
||||
sIgnore = 0;
|
||||
|
||||
if( HB_ISNUM( 5 ) )
|
||||
ssElementPos = hb_parnl( 5 );
|
||||
s_sElementPos = hb_parnl( 5 );
|
||||
else
|
||||
ssElementPos = 0;
|
||||
s_sElementPos = 0;
|
||||
|
||||
if( HB_ISNUM( 6 ) )
|
||||
sSortLen = hb_parnl( 6 );
|
||||
@@ -221,9 +221,9 @@ HB_FUNC( CHARSORT )
|
||||
iDescend = 0;
|
||||
|
||||
/* param check II */
|
||||
if( sElementLen == 0 || ssCompareLen > sElementLen ||
|
||||
if( sElementLen == 0 || s_sCompareLen > sElementLen ||
|
||||
sIgnore + sElementLen > sStrLen ||
|
||||
ssElementPos + ssCompareLen > sElementLen ||
|
||||
s_sElementPos + s_sCompareLen > sElementLen ||
|
||||
sSortLen + sIgnore > sStrLen )
|
||||
{
|
||||
int iArgErrorMode = ct_getargerrormode();
|
||||
|
||||
@@ -75,9 +75,9 @@ static void do_charswap( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet;
|
||||
size_t sRetIndex = 0;
|
||||
HB_SIZE sRetIndex = 0;
|
||||
int iShift, iMod;
|
||||
const char *pcSub;
|
||||
|
||||
|
||||
@@ -65,8 +65,8 @@ static void do_count( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
size_t sRetVal;
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sRetVal;
|
||||
const char *pc;
|
||||
char cSearch;
|
||||
|
||||
|
||||
@@ -54,16 +54,16 @@
|
||||
|
||||
HB_FUNC( CRYPT )
|
||||
{
|
||||
ULONG ulCryptLen = hb_parclen( 2 );
|
||||
HB_SIZE ulCryptLen = hb_parclen( 2 );
|
||||
|
||||
if( ulCryptLen >= 2 )
|
||||
{
|
||||
const BYTE *pbyCrypt = ( const BYTE * ) hb_parc( 2 );
|
||||
ULONG ulCryptPos = 0;
|
||||
HB_SIZE ulCryptPos = 0;
|
||||
|
||||
const BYTE *pbyString = ( const BYTE * ) hb_parc( 1 );
|
||||
ULONG ulStringLen = hb_parclen( 1 );
|
||||
ULONG ulStringPos;
|
||||
HB_SIZE ulStringLen = hb_parclen( 1 );
|
||||
HB_SIZE ulStringPos;
|
||||
|
||||
BYTE *pbyResult = ( BYTE * ) hb_xgrab( ulStringLen + 1 );
|
||||
|
||||
|
||||
@@ -64,10 +64,10 @@ static void do_pad( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISNUM( 2 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet, *pc;
|
||||
LONG lRetLen;
|
||||
size_t sRetLen;
|
||||
HB_SIZE sRetLen;
|
||||
char cFill;
|
||||
|
||||
lRetLen = hb_parnl( 2 );
|
||||
@@ -86,7 +86,7 @@ static void do_pad( int iSwitch )
|
||||
hb_retc_null();
|
||||
return;
|
||||
}
|
||||
sRetLen = ( size_t ) lRetLen;
|
||||
sRetLen = ( HB_SIZE ) lRetLen;
|
||||
|
||||
if( hb_parclen( 3 ) > 0 )
|
||||
cFill = *( hb_parc( 3 ) );
|
||||
|
||||
@@ -75,11 +75,11 @@ int ct_str_exit( void )
|
||||
/* -------------------------- */
|
||||
/* search for exact substring */
|
||||
/* -------------------------- */
|
||||
const char *ct_at_exact_forward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen, size_t * psMatchStrLen )
|
||||
const char *ct_at_exact_forward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen, HB_SIZE * psMatchStrLen )
|
||||
{
|
||||
|
||||
size_t sPos;
|
||||
HB_SIZE sPos;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "ct_at_exact_forward (\"%s\", %lu, \"%s\", %lu, %p)",
|
||||
pcString, ( ULONG ) sStrLen, pcMatch, ( ULONG ) sMatchLen, psMatchStrLen ) );
|
||||
@@ -105,11 +105,11 @@ const char *ct_at_exact_forward( const char *pcString, size_t sStrLen,
|
||||
/* ------------------------------------------------ */
|
||||
/* search for exact substring in backward direction */
|
||||
/* ------------------------------------------------ */
|
||||
const char *ct_at_exact_backward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen, size_t * psMatchStrLen )
|
||||
const char *ct_at_exact_backward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen, HB_SIZE * psMatchStrLen )
|
||||
{
|
||||
|
||||
size_t sIndex;
|
||||
HB_SIZE sIndex;
|
||||
const char *pcRet;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "ct_at_exact_backward (\"%s\", %lu, \"%s\", %lu, %p)",
|
||||
@@ -139,12 +139,12 @@ const char *ct_at_exact_backward( const char *pcString, size_t sStrLen,
|
||||
/* ----------------------------------- */
|
||||
/* search for substring using wildcard */
|
||||
/* ----------------------------------- */
|
||||
const char *ct_at_wildcard_forward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen,
|
||||
char cWildCard, size_t * psMatchStrLen )
|
||||
const char *ct_at_wildcard_forward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen,
|
||||
char cWildCard, HB_SIZE * psMatchStrLen )
|
||||
{
|
||||
|
||||
size_t sIndex;
|
||||
HB_SIZE sIndex;
|
||||
const char *pcRet, *pcStop;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "ct_at_wildcard_forward (\"%s\", %lu, \"%s\", %lu, \'%c\', %p)",
|
||||
@@ -178,12 +178,12 @@ const char *ct_at_wildcard_forward( const char *pcString, size_t sStrLen,
|
||||
/* --------------------------------------------------------- */
|
||||
/* search for substring using wildcard in backward direction */
|
||||
/* --------------------------------------------------------- */
|
||||
const char *ct_at_wildcard_backward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen,
|
||||
char cWildCard, size_t * psMatchStrLen )
|
||||
const char *ct_at_wildcard_backward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen,
|
||||
char cWildCard, HB_SIZE * psMatchStrLen )
|
||||
{
|
||||
|
||||
size_t sIndex;
|
||||
HB_SIZE sIndex;
|
||||
const char *pcRet;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "ct_at_wildcard_backward (\"%s\", %lu, \"%s\", %lu, \'%c\', %p)",
|
||||
@@ -217,8 +217,8 @@ const char *ct_at_wildcard_backward( const char *pcString, size_t sStrLen,
|
||||
/* ------------------------------- */
|
||||
/* search for character from a set */
|
||||
/* ------------------------------- */
|
||||
const char *ct_at_charset_forward( const char *pcString, size_t sStrLen,
|
||||
const char *pcCharSet, size_t sCharSetLen, size_t * psMatchedCharPos )
|
||||
const char *ct_at_charset_forward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcCharSet, HB_SIZE sCharSetLen, HB_SIZE * psMatchedCharPos )
|
||||
{
|
||||
|
||||
const char *pcRet, *pcSet, *pcStop1, *pcStop2;
|
||||
@@ -251,8 +251,8 @@ const char *ct_at_charset_forward( const char *pcString, size_t sStrLen,
|
||||
/* ----------------------------------------------------- */
|
||||
/* search for character from a set in backward direction */
|
||||
/* ----------------------------------------------------- */
|
||||
const char *ct_at_charset_backward( const char *pcString, size_t sStrLen,
|
||||
const char *pcCharSet, size_t sCharSetLen, size_t * psMatchedCharPos )
|
||||
const char *ct_at_charset_backward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcCharSet, HB_SIZE sCharSetLen, HB_SIZE * psMatchedCharPos )
|
||||
{
|
||||
|
||||
const char *pcRet, *pcSet, *pcStop;
|
||||
|
||||
@@ -61,24 +61,24 @@ HB_EXTERN_BEGIN
|
||||
extern int ct_str_init( void );
|
||||
extern int ct_str_exit( void );
|
||||
|
||||
extern const char *ct_at_exact_forward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen,
|
||||
size_t *psMatchStrLen );
|
||||
extern const char *ct_at_exact_backward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen,
|
||||
size_t *psMatchStrLen );
|
||||
extern const char *ct_at_wildcard_forward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen,
|
||||
char cWildCard, size_t *psMatchStrLen );
|
||||
extern const char *ct_at_wildcard_backward( const char *pcString, size_t sStrLen,
|
||||
const char *pcMatch, size_t sMatchLen,
|
||||
char cWildCard, size_t *psMatchStrLen );
|
||||
extern const char *ct_at_charset_forward( const char *pcString, size_t sStrLen,
|
||||
const char *pcCharSet, size_t sCharSetLen,
|
||||
size_t *psMatchedCharPos );
|
||||
extern const char *ct_at_charset_backward( const char *pcString, size_t sStrLen,
|
||||
const char *pcCharSet, size_t sCharSetLen,
|
||||
size_t *psMatchedCharPos );
|
||||
extern const char *ct_at_exact_forward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen,
|
||||
HB_SIZE *psMatchStrLen );
|
||||
extern const char *ct_at_exact_backward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen,
|
||||
HB_SIZE *psMatchStrLen );
|
||||
extern const char *ct_at_wildcard_forward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen,
|
||||
char cWildCard, HB_SIZE *psMatchStrLen );
|
||||
extern const char *ct_at_wildcard_backward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcMatch, HB_SIZE sMatchLen,
|
||||
char cWildCard, HB_SIZE *psMatchStrLen );
|
||||
extern const char *ct_at_charset_forward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcCharSet, HB_SIZE sCharSetLen,
|
||||
HB_SIZE *psMatchedCharPos );
|
||||
extern const char *ct_at_charset_backward( const char *pcString, HB_SIZE sStrLen,
|
||||
const char *pcCharSet, HB_SIZE sCharSetLen,
|
||||
HB_SIZE *psMatchedCharPos );
|
||||
|
||||
extern void ct_setref( int iNewSwitch );
|
||||
extern int ct_getref( void );
|
||||
|
||||
@@ -236,23 +236,17 @@ HB_FUNC( DMY )
|
||||
HB_BOOL bMode = HB_FALSE;
|
||||
|
||||
if( HB_ISDATETIME( 1 ) )
|
||||
{
|
||||
hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_dateToday( &iYear, &iMonth, &iDay );
|
||||
}
|
||||
|
||||
if( HB_ISLOG( 2 ) )
|
||||
{
|
||||
bMode = hb_parl( 2 );
|
||||
}
|
||||
|
||||
if( iMonth >= 1 && iMonth <= 12 )
|
||||
{
|
||||
const char *szMonth = hb_langDGetItem( HB_LANG_ITEM_BASE_MONTH + iMonth - 1 );
|
||||
int iMonLen = strlen( szMonth );
|
||||
int iMonLen = ( int ) strlen( szMonth );
|
||||
int iLen = 0, iBufLen = iMonLen + 10;
|
||||
char *szMDY = ( char * ) hb_xgrab( iBufLen );
|
||||
|
||||
@@ -295,9 +289,7 @@ HB_FUNC( DMY )
|
||||
hb_xfree( szMDY );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retc_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -335,18 +327,14 @@ HB_FUNC( MDY )
|
||||
int iYear, iMonth, iDay;
|
||||
|
||||
if( HB_ISDATETIME( 1 ) )
|
||||
{
|
||||
hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_dateToday( &iYear, &iMonth, &iDay );
|
||||
}
|
||||
|
||||
if( iMonth >= 1 && iMonth <= 12 )
|
||||
{
|
||||
const char *szMonth = hb_langDGetItem( HB_LANG_ITEM_BASE_MONTH + iMonth - 1 );
|
||||
int iLen = strlen( szMonth );
|
||||
int iLen = ( int ) strlen( szMonth );
|
||||
int iBufLen = iLen + 9;
|
||||
char *szMDY = ( char * ) hb_xgrab( iBufLen );
|
||||
|
||||
@@ -379,9 +367,7 @@ HB_FUNC( MDY )
|
||||
hb_xfree( szMDY );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retc_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -497,9 +483,7 @@ HB_FUNC( DOY )
|
||||
long lDate;
|
||||
|
||||
if( HB_ISDATETIME( 1 ) )
|
||||
{
|
||||
lDate = hb_pardl( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
int iYear, iMonth, iDay;
|
||||
@@ -543,13 +527,9 @@ HB_FUNC( ISLEAP )
|
||||
int iYear, iMonth, iDay;
|
||||
|
||||
if( HB_ISDATETIME( 1 ) )
|
||||
{
|
||||
hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_dateToday( &iYear, &iMonth, &iDay );
|
||||
}
|
||||
|
||||
hb_retl( ct_isleap( iYear ) );
|
||||
}
|
||||
@@ -663,13 +643,9 @@ HB_FUNC( QUARTER )
|
||||
int iYear, iMonth, iDay;
|
||||
|
||||
if( HB_ISDATETIME( 1 ) )
|
||||
{
|
||||
hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_dateToday( &iYear, &iMonth, &iDay );
|
||||
}
|
||||
|
||||
hb_retni( ( iMonth + 2 ) / 3 );
|
||||
}
|
||||
@@ -711,19 +687,14 @@ HB_FUNC( LASTDAYOM )
|
||||
int iYear, iMonth, iDay;
|
||||
|
||||
if( HB_ISNUM( 1 ) )
|
||||
{
|
||||
iMonth = hb_parni( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( HB_ISDATETIME( 1 ) )
|
||||
{
|
||||
hb_dateDecode( hb_pardl( 1 ), &iYear, &iMonth, &iDay );
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_dateToday( &iYear, &iMonth, &iDay );
|
||||
}
|
||||
|
||||
bLeap = ct_isleap( iYear );
|
||||
}
|
||||
|
||||
|
||||
@@ -72,11 +72,11 @@ static void do_justify( int iSwitch )
|
||||
{
|
||||
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char cJustChar;
|
||||
const char *pc;
|
||||
char *pcRet, *pcw;
|
||||
size_t sJustOffset;
|
||||
HB_SIZE sJustOffset;
|
||||
|
||||
if( sStrLen == 0 )
|
||||
{
|
||||
|
||||
@@ -88,19 +88,19 @@ HB_FUNC( NUMAT )
|
||||
if( ( HB_ISCHAR( 1 ) ) && ( HB_ISCHAR( 2 ) ) )
|
||||
{
|
||||
const char *pcStringToMatch = hb_parc( 1 );
|
||||
size_t sStrToMatchLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrToMatchLen = hb_parclen( 1 );
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
int iMultiPass = ct_getatmupa();
|
||||
int iAtLike = ct_getatlike();
|
||||
char cAtLike = ct_getatlikechar();
|
||||
size_t sIgnore, sMatchStrLen = 0, sSubStrLen;
|
||||
HB_SIZE sIgnore, sMatchStrLen = 0, sSubStrLen;
|
||||
ULONG ulCounter;
|
||||
const char *pc, *pcSubStr;
|
||||
|
||||
/* eventually ignore some characters */
|
||||
if( HB_ISNUM( 3 ) )
|
||||
sIgnore = ( size_t ) hb_parnl( 3 );
|
||||
sIgnore = ( HB_SIZE ) hb_parnl( 3 );
|
||||
else
|
||||
sIgnore = 0;
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ static void do_pos1( int iSwitch )
|
||||
HB_ISCHAR( 3 ) ) ) ) /* .. and 3rd param */
|
||||
{
|
||||
unsigned char *pcString;
|
||||
size_t sStrLen;
|
||||
HB_SIZE sStrLen;
|
||||
unsigned char *puc, ucChar1 = ' ', ucChar2 = ' ';
|
||||
int iMode;
|
||||
size_t sIgnore;
|
||||
HB_SIZE sIgnore;
|
||||
int iParamShift = 0;
|
||||
|
||||
if( iSwitch == DO_POS1_POSRANGE )
|
||||
@@ -106,7 +106,7 @@ static void do_pos1( int iSwitch )
|
||||
}
|
||||
|
||||
pcString = ( unsigned char * ) hb_parc( iParamShift + 1 );
|
||||
sStrLen = ( size_t ) hb_parclen( iParamShift + 1 );
|
||||
sStrLen = hb_parclen( iParamShift + 1 );
|
||||
|
||||
if( HB_ISLOG( iParamShift + 2 ) )
|
||||
iMode = hb_parl( iParamShift + 2 );
|
||||
@@ -114,7 +114,7 @@ static void do_pos1( int iSwitch )
|
||||
iMode = 0;
|
||||
|
||||
if( HB_ISNUM( iParamShift + 3 ) )
|
||||
sIgnore = ( size_t ) hb_parnl( iParamShift + 3 );
|
||||
sIgnore = ( HB_SIZE ) hb_parnl( iParamShift + 3 );
|
||||
else
|
||||
sIgnore = 0;
|
||||
|
||||
|
||||
@@ -95,10 +95,10 @@ HB_FUNC( POSCHAR )
|
||||
if( ( hb_parclen( 2 ) > 0 ) || HB_ISNUM( 2 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet;
|
||||
char cReplace;
|
||||
size_t sPosition;
|
||||
HB_SIZE sPosition;
|
||||
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
cReplace = *( hb_parc( 2 ) );
|
||||
@@ -204,8 +204,8 @@ HB_FUNC( POSDEL )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = hb_parclen( 1 );
|
||||
size_t sStartPos, sDelLen;
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sStartPos, sDelLen;
|
||||
char *pcRet;
|
||||
|
||||
if( HB_ISNUM( 3 ) )
|
||||
@@ -298,13 +298,13 @@ HB_FUNC( POSINS )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
const char *pcInsert;
|
||||
size_t sInsLen;
|
||||
HB_SIZE sInsLen;
|
||||
|
||||
if( ( sInsLen = hb_parclen( 2 ) ) > 0 )
|
||||
{
|
||||
size_t sStartPos;
|
||||
HB_SIZE sStartPos;
|
||||
char *pcRet;
|
||||
|
||||
pcInsert = hb_parc( 2 );
|
||||
@@ -411,16 +411,16 @@ HB_FUNC( POSREPL )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
const char *pcReplace;
|
||||
size_t sReplLen;
|
||||
HB_SIZE sReplLen;
|
||||
|
||||
if( ( sReplLen = hb_parclen( 2 ) ) > 0 )
|
||||
{
|
||||
|
||||
size_t sStartPos;
|
||||
HB_SIZE sStartPos;
|
||||
char *pcRet;
|
||||
size_t sRetLen;
|
||||
HB_SIZE sRetLen;
|
||||
|
||||
pcReplace = hb_parc( 2 );
|
||||
|
||||
|
||||
@@ -89,11 +89,11 @@ HB_FUNC( POSDIFF )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pcString1 = hb_parc( 1 );
|
||||
size_t sStrLen1 = hb_parclen( 1 );
|
||||
HB_SIZE sStrLen1 = hb_parclen( 1 );
|
||||
const char *pcString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
const char *pc1, *pc2;
|
||||
size_t sIgnore;
|
||||
HB_SIZE sIgnore;
|
||||
|
||||
if( HB_ISNUM( 3 ) )
|
||||
sIgnore = hb_parnl( 3 );
|
||||
@@ -187,11 +187,11 @@ HB_FUNC( POSEQUAL )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char *pcString1 = hb_parc( 1 );
|
||||
size_t sStrLen1 = hb_parclen( 1 );
|
||||
HB_SIZE sStrLen1 = hb_parclen( 1 );
|
||||
const char *pcString2 = hb_parc( 2 );
|
||||
size_t sStrLen2 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 2 );
|
||||
const char *pc1, *pc2;
|
||||
size_t sIgnore, sCompare, sCompareCnt, sRet = 0;
|
||||
HB_SIZE sIgnore, sCompare, sCompareCnt, sRet = 0;
|
||||
|
||||
if( HB_ISNUM( 4 ) )
|
||||
sIgnore = hb_parnl( 4 );
|
||||
|
||||
@@ -97,11 +97,11 @@ HB_FUNC( RANGEREM )
|
||||
( hb_parclen( 2 ) > 0 || HB_ISNUM( 2 ) ) && HB_ISCHAR( 3 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 3 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 3 );
|
||||
HB_SIZE sStrLen = hb_parclen( 3 );
|
||||
char *pcRet;
|
||||
unsigned char *pc;
|
||||
unsigned char ucChar1, ucChar2;
|
||||
size_t sRetIndex;
|
||||
HB_SIZE sRetIndex;
|
||||
int iMode, iBool;
|
||||
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
@@ -204,11 +204,11 @@ HB_FUNC( RANGEREPL )
|
||||
HB_ISCHAR( 3 ) && ( hb_parclen( 4 ) > 0 || HB_ISNUM( 4 ) ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 3 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 3 );
|
||||
HB_SIZE sStrLen = hb_parclen( 3 );
|
||||
char *pcRet;
|
||||
unsigned char *pc;
|
||||
unsigned char ucChar1, ucChar2, ucReplace;
|
||||
size_t sRetIndex;
|
||||
HB_SIZE sRetIndex;
|
||||
int iMode, iBool;
|
||||
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
|
||||
@@ -90,17 +90,17 @@ HB_FUNC( CHARRELA )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) && HB_ISCHAR( 3 ) && HB_ISCHAR( 4 ) )
|
||||
{
|
||||
const char *pcStringToMatch1 = hb_parc( 1 );
|
||||
size_t sStrToMatchLen1 = hb_parclen( 1 );
|
||||
HB_SIZE sStrToMatchLen1 = hb_parclen( 1 );
|
||||
const char *pcString1 = hb_parc( 2 );
|
||||
size_t sStrLen1 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen1 = hb_parclen( 2 );
|
||||
const char *pcStringToMatch2 = hb_parc( 3 );
|
||||
size_t sStrToMatchLen2 = hb_parclen( 3 );
|
||||
HB_SIZE sStrToMatchLen2 = hb_parclen( 3 );
|
||||
const char *pcString2 = hb_parc( 4 );
|
||||
size_t sStrLen2 = hb_parclen( 4 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 4 );
|
||||
|
||||
const char *pc1, *pc2;
|
||||
size_t sOffset1, sOffset2;
|
||||
size_t sMatchStrLen;
|
||||
HB_SIZE sOffset1, sOffset2;
|
||||
HB_SIZE sMatchStrLen;
|
||||
|
||||
/* check for empty strings */
|
||||
if( ( sStrToMatchLen1 == 0 ) || ( sStrToMatchLen2 == 0 ) )
|
||||
@@ -205,19 +205,19 @@ HB_FUNC( CHARRELREP )
|
||||
HB_ISCHAR( 4 ) && HB_ISCHAR( 5 ) )
|
||||
{
|
||||
const char *pcStringToMatch1 = hb_parc( 1 );
|
||||
size_t sStrToMatchLen1 = hb_parclen( 1 );
|
||||
HB_SIZE sStrToMatchLen1 = hb_parclen( 1 );
|
||||
const char *pcString1 = hb_parc( 2 );
|
||||
size_t sStrLen1 = hb_parclen( 2 );
|
||||
HB_SIZE sStrLen1 = hb_parclen( 2 );
|
||||
const char *pcStringToMatch2 = hb_parc( 3 );
|
||||
size_t sStrToMatchLen2 = hb_parclen( 3 );
|
||||
HB_SIZE sStrToMatchLen2 = hb_parclen( 3 );
|
||||
const char *pcString2 = hb_parc( 4 );
|
||||
size_t sStrLen2 = hb_parclen( 4 );
|
||||
HB_SIZE sStrLen2 = hb_parclen( 4 );
|
||||
const char *pcReplace = hb_parc( 5 );
|
||||
size_t sReplaceLen = hb_parclen( 5 );
|
||||
HB_SIZE sReplaceLen = hb_parclen( 5 );
|
||||
char *pcRet;
|
||||
const char *pc1, *pc2;
|
||||
size_t sOffset1, sOffset2;
|
||||
size_t sMatchStrLen;
|
||||
HB_SIZE sOffset1, sOffset2;
|
||||
HB_SIZE sMatchStrLen;
|
||||
|
||||
/* check for empty strings */
|
||||
if( sStrToMatchLen1 == 0 ||
|
||||
@@ -252,14 +252,14 @@ HB_FUNC( CHARRELREP )
|
||||
if( pc1 - pcString1 == pc2 - pcString2 )
|
||||
{
|
||||
/* correlation found -> start replacement */
|
||||
size_t sCurr;
|
||||
HB_SIZE sCurr;
|
||||
|
||||
for( sCurr = 1; sCurr <= sStrToMatchLen1; sCurr++ )
|
||||
{
|
||||
/* check if pcString2 is long enough */
|
||||
if( ( pc2 - pcString2 ) + sCurr >= sStrLen2 )
|
||||
{
|
||||
size_t sStr2Offset, sReplOffset;
|
||||
HB_SIZE sStr2Offset, sReplOffset;
|
||||
|
||||
sStr2Offset = sStrToMatchLen2 < sCurr ? sStrToMatchLen2 : sCurr;
|
||||
sReplOffset = sReplaceLen < sCurr ? sReplaceLen : sCurr;
|
||||
|
||||
@@ -74,10 +74,10 @@ static void do_remove( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
const char *pcRet;
|
||||
const char *pc;
|
||||
size_t sRetLen;
|
||||
HB_SIZE sRetLen;
|
||||
char cSearch;
|
||||
|
||||
if( hb_parclen( 2 ) > 0 )
|
||||
|
||||
@@ -78,7 +78,7 @@ static void do_replace( int iSwitch )
|
||||
if( HB_ISCHAR( 1 ) && ( hb_parclen( 2 ) > 0 || HB_ISNUM( 2 ) ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet, *pc;
|
||||
char cSearch, cReplace;
|
||||
|
||||
|
||||
@@ -142,17 +142,17 @@ HB_FUNC( STRDIFF )
|
||||
{
|
||||
/* get parameters */
|
||||
const char *pcStr1, *pcStr2;
|
||||
size_t sStrLen1, sStrLen2;
|
||||
HB_SIZE sStrLen1, sStrLen2;
|
||||
int iReplace, iDelete, iInsert;
|
||||
int iAtLike = ct_getatlike();
|
||||
char cAtLike = ct_getatlikechar();
|
||||
int *piPenalty;
|
||||
size_t sRowCnt, sColCnt;
|
||||
HB_SIZE sRowCnt, sColCnt;
|
||||
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
pcStr1 = hb_parc( 1 );
|
||||
sStrLen1 = ( size_t ) hb_parclen( 1 );
|
||||
sStrLen1 = hb_parclen( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -163,7 +163,7 @@ HB_FUNC( STRDIFF )
|
||||
if( HB_ISCHAR( 2 ) )
|
||||
{
|
||||
pcStr2 = hb_parc( 2 );
|
||||
sStrLen2 = ( size_t ) hb_parclen( 2 );
|
||||
sStrLen2 = hb_parclen( 2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -85,18 +85,18 @@
|
||||
|
||||
HB_FUNC( STRSWAP )
|
||||
{
|
||||
size_t sStrLen1, sStrLen2;
|
||||
HB_SIZE sStrLen1, sStrLen2;
|
||||
|
||||
/* param check */
|
||||
if( ( sStrLen1 = ( size_t ) hb_parclen( 1 ) ) > 0 &&
|
||||
( sStrLen2 = ( size_t ) hb_parclen( 2 ) ) > 0 )
|
||||
if( ( sStrLen1 = hb_parclen( 1 ) ) > 0 &&
|
||||
( sStrLen2 = hb_parclen( 2 ) ) > 0 )
|
||||
{
|
||||
/* get parameters */
|
||||
const char *pcString1 = hb_parc( 1 );
|
||||
const char *pcString2 = hb_parc( 2 );
|
||||
char *pcRet1 = NULL, *pcRet2 = NULL;
|
||||
int iChange1, iChange2;
|
||||
size_t sIndex, sCmpLen;
|
||||
HB_SIZE sIndex, sCmpLen;
|
||||
|
||||
if( ( iChange1 = HB_ISBYREF( 1 ) ) != 0 )
|
||||
{
|
||||
@@ -145,8 +145,8 @@ HB_FUNC( STRSWAP )
|
||||
|
||||
hb_retc_null();
|
||||
}
|
||||
else /* ( sStrLen1 = ( size_t ) hb_parclen( 1 ) ) > 0 &&
|
||||
( sStrLen2 = ( size_t ) hb_parclen( 2 ) ) > 0 */
|
||||
else /* ( sStrLen1 = hb_parclen( 1 ) ) > 0 &&
|
||||
( sStrLen2 = hb_parclen( 2 ) ) > 0 */
|
||||
{
|
||||
PHB_ITEM pSubst = NULL;
|
||||
int iArgErrorMode = ct_getargerrormode();
|
||||
|
||||
@@ -111,16 +111,16 @@ HB_FUNC( TABEXPAND )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet;
|
||||
size_t sRetLen;
|
||||
size_t sTabWidth = 0;
|
||||
HB_SIZE sRetLen;
|
||||
HB_SIZE sTabWidth = 0;
|
||||
char cFill, cTab, cCR;
|
||||
const char *pcNewLine;
|
||||
size_t sNewLineLen;
|
||||
HB_SIZE sNewLineLen;
|
||||
int iIgnore141;
|
||||
size_t sIndex, sLineIndex;
|
||||
size_t sTabCnt = 0;
|
||||
HB_SIZE sIndex, sLineIndex;
|
||||
HB_SIZE sTabCnt = 0;
|
||||
|
||||
if( HB_ISNUM( 2 ) )
|
||||
sTabWidth = hb_parnl( 2 );
|
||||
@@ -188,7 +188,7 @@ HB_FUNC( TABEXPAND )
|
||||
if( cChar == cTab )
|
||||
{
|
||||
/* tab character */
|
||||
size_t sFillIndex;
|
||||
HB_SIZE sFillIndex;
|
||||
|
||||
for( sFillIndex = sTabWidth - ( sLineIndex % sTabWidth ); sFillIndex > 0; sFillIndex-- )
|
||||
{
|
||||
@@ -312,15 +312,15 @@ HB_FUNC( TABPACK )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
char *pcRet;
|
||||
size_t sRetLen;
|
||||
size_t sTabWidth = 0;
|
||||
HB_SIZE sRetLen;
|
||||
HB_SIZE sTabWidth = 0;
|
||||
char cFill, cTab, cCR;
|
||||
const char *pcNewLine;
|
||||
size_t sNewLineLen;
|
||||
HB_SIZE sNewLineLen;
|
||||
int iIgnore141;
|
||||
size_t sIndex, sTabIndex, sFillCount;
|
||||
HB_SIZE sIndex, sTabIndex, sFillCount;
|
||||
|
||||
if( HB_ISNUM( 2 ) )
|
||||
sTabWidth = hb_parnl( 2 );
|
||||
@@ -340,7 +340,7 @@ HB_FUNC( TABPACK )
|
||||
else
|
||||
{
|
||||
pcNewLine = hb_conNewLine();
|
||||
sNewLineLen = strlen( pcNewLine );
|
||||
sNewLineLen = ( HB_SIZE ) strlen( pcNewLine );
|
||||
}
|
||||
if( sNewLineLen > 0 )
|
||||
cCR = *( pcNewLine );
|
||||
|
||||
@@ -63,14 +63,14 @@
|
||||
|
||||
|
||||
/* static const data */
|
||||
static const char *spcSeparatorStr =
|
||||
static const char *s_pcSeparatorStr =
|
||||
"\x00" "\x09" "\x0A" "\x0C" "\x1A" "\x20" "\x8A" "\x8C" ",.;:!\?/\\<>()#&%+-*";
|
||||
static const size_t ssSeparatorStrLen = 26;
|
||||
static const HB_SIZE s_sSeparatorStrLen = 26;
|
||||
|
||||
/* static data */
|
||||
/* even if these are chars, variable must be int, since we need an extra -1 */
|
||||
static int siPreSeparator = -1; /* TODO: make this threadsafe */
|
||||
static int siPostSeparator = -1; /* TODO: make this threadsafe */
|
||||
static int s_iPreSeparator = -1; /* TODO: make this threadsafe */
|
||||
static int s_iPostSeparator = -1; /* TODO: make this threadsafe */
|
||||
|
||||
/* defines */
|
||||
#define DO_TOKEN1_TOKEN 0
|
||||
@@ -88,7 +88,7 @@ static void do_token1( int iSwitch )
|
||||
switch ( iSwitch )
|
||||
{
|
||||
case DO_TOKEN1_TOKEN:
|
||||
siPreSeparator = siPostSeparator = -1;
|
||||
s_iPreSeparator = s_iPostSeparator = -1;
|
||||
/* no "break" here !! */
|
||||
case DO_TOKEN1_ATTOKEN:
|
||||
case DO_TOKEN1_NUMTOKEN:
|
||||
@@ -101,15 +101,15 @@ static void do_token1( int iSwitch )
|
||||
if( iParamCheck )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
const char *pcSeparatorStr;
|
||||
size_t sSeparatorStrLen;
|
||||
HB_SIZE sSeparatorStrLen;
|
||||
ULONG ulTokenCounter = 0;
|
||||
ULONG ulSkip;
|
||||
const char *pcSubStr;
|
||||
char *pcRet = NULL;
|
||||
size_t sSubStrLen;
|
||||
size_t sRetStrLen = 0;
|
||||
HB_SIZE sSubStrLen;
|
||||
HB_SIZE sRetStrLen = 0;
|
||||
ULONG ulToken = 0;
|
||||
ULONG ulSkipCnt;
|
||||
const char *pc;
|
||||
@@ -120,8 +120,8 @@ static void do_token1( int iSwitch )
|
||||
pcSeparatorStr = hb_parc( 2 );
|
||||
else
|
||||
{
|
||||
pcSeparatorStr = ( char * ) spcSeparatorStr;
|
||||
sSeparatorStrLen = ssSeparatorStrLen;
|
||||
pcSeparatorStr = ( char * ) s_pcSeparatorStr;
|
||||
sSeparatorStrLen = s_sSeparatorStrLen;
|
||||
}
|
||||
|
||||
/* token counter */
|
||||
@@ -173,7 +173,7 @@ static void do_token1( int iSwitch )
|
||||
|
||||
while( ulToken < ulTokenCounter )
|
||||
{
|
||||
size_t sMatchedPos = sSeparatorStrLen;
|
||||
HB_SIZE sMatchedPos = sSeparatorStrLen;
|
||||
|
||||
/* Skip the left ulSkip successive separators */
|
||||
ulSkipCnt = 0;
|
||||
@@ -185,11 +185,11 @@ static void do_token1( int iSwitch )
|
||||
pcSeparatorStr, sSeparatorStrLen, &sMatchedPos );
|
||||
if( iSwitch == DO_TOKEN1_TOKEN )
|
||||
{
|
||||
siPreSeparator = siPostSeparator;
|
||||
s_iPreSeparator = s_iPostSeparator;
|
||||
if( sMatchedPos < sSeparatorStrLen )
|
||||
siPostSeparator = pcSeparatorStr[sMatchedPos];
|
||||
s_iPostSeparator = pcSeparatorStr[sMatchedPos];
|
||||
else
|
||||
siPostSeparator = -1;
|
||||
s_iPostSeparator = -1;
|
||||
}
|
||||
ulSkipCnt++;
|
||||
}
|
||||
@@ -208,13 +208,13 @@ static void do_token1( int iSwitch )
|
||||
hb_retc_null();
|
||||
if( HB_ISBYREF( 5 ) )
|
||||
{
|
||||
cRet = ( char ) siPreSeparator;
|
||||
hb_storclen( &cRet, ( siPreSeparator != -1 ? 1 : 0 ), 5 );
|
||||
cRet = ( char ) s_iPreSeparator;
|
||||
hb_storclen( &cRet, ( s_iPreSeparator != -1 ? 1 : 0 ), 5 );
|
||||
}
|
||||
if( HB_ISBYREF( 6 ) )
|
||||
{
|
||||
cRet = ( char ) siPostSeparator;
|
||||
hb_storclen( &cRet, ( siPostSeparator != -1 ? 1 : 0 ), 6 );
|
||||
cRet = ( char ) s_iPostSeparator;
|
||||
hb_storclen( &cRet, ( s_iPostSeparator != -1 ? 1 : 0 ), 6 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -315,13 +315,13 @@ static void do_token1( int iSwitch )
|
||||
|
||||
if( HB_ISBYREF( 5 ) )
|
||||
{
|
||||
cRet = ( char ) siPreSeparator;
|
||||
hb_storclen( &cRet, ( siPreSeparator != -1 ? 1 : 0 ), 5 );
|
||||
cRet = ( char ) s_iPreSeparator;
|
||||
hb_storclen( &cRet, ( s_iPreSeparator != -1 ? 1 : 0 ), 5 );
|
||||
}
|
||||
if( HB_ISBYREF( 6 ) )
|
||||
{
|
||||
cRet = ( char ) siPostSeparator;
|
||||
hb_storclen( &cRet, ( siPostSeparator != -1 ? 1 : 0 ), 6 );
|
||||
cRet = ( char ) s_iPostSeparator;
|
||||
hb_storclen( &cRet, ( s_iPostSeparator != -1 ? 1 : 0 ), 6 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -364,13 +364,13 @@ static void do_token1( int iSwitch )
|
||||
|
||||
if( HB_ISBYREF( 5 ) )
|
||||
{
|
||||
cRet = ( char ) siPreSeparator;
|
||||
hb_storclen( &cRet, ( siPreSeparator != -1 ? 1 : 0 ), 5 );
|
||||
cRet = ( char ) s_iPreSeparator;
|
||||
hb_storclen( &cRet, ( s_iPreSeparator != -1 ? 1 : 0 ), 5 );
|
||||
}
|
||||
if( HB_ISBYREF( 6 ) )
|
||||
{
|
||||
cRet = ( char ) siPostSeparator;
|
||||
hb_storclen( &cRet, ( siPostSeparator != -1 ? 1 : 0 ), 6 );
|
||||
cRet = ( char ) s_iPostSeparator;
|
||||
hb_storclen( &cRet, ( s_iPostSeparator != -1 ? 1 : 0 ), 6 );
|
||||
}
|
||||
|
||||
if( iArgErrorMode != CT_ARGERR_IGNORE )
|
||||
@@ -795,9 +795,9 @@ HB_FUNC( TOKENSEP )
|
||||
if( hb_parl( 1 ) )
|
||||
{
|
||||
/* return the separator char BEHIND the last token */
|
||||
if( siPostSeparator != -1 )
|
||||
if( s_iPostSeparator != -1 )
|
||||
{
|
||||
cRet = ( char ) siPostSeparator;
|
||||
cRet = ( char ) s_iPostSeparator;
|
||||
hb_retclen( &cRet, 1 );
|
||||
}
|
||||
else
|
||||
@@ -806,9 +806,9 @@ HB_FUNC( TOKENSEP )
|
||||
else
|
||||
{
|
||||
/* return the separator char BEFORE the last token */
|
||||
if( siPreSeparator != -1 )
|
||||
if( s_iPreSeparator != -1 )
|
||||
{
|
||||
cRet = ( char ) siPreSeparator;
|
||||
cRet = ( char ) s_iPreSeparator;
|
||||
hb_retclen( &cRet, 1 );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -74,8 +74,8 @@
|
||||
|
||||
typedef struct _TOKEN_POSITION
|
||||
{
|
||||
size_t sStartPos; /* relative 0-based index of first char of token */
|
||||
size_t sEndPos; /* relative 0-based index of first char BEHIND token,
|
||||
HB_SIZE sStartPos; /* relative 0-based index of first char of token */
|
||||
HB_SIZE sEndPos; /* relative 0-based index of first char BEHIND token,
|
||||
so that length = sEndPos-sStartPos */
|
||||
} TOKEN_POSITION;
|
||||
typedef TOKEN_POSITION *TOKEN_ENVIRONMENT;
|
||||
@@ -107,7 +107,7 @@ static TOKEN_ENVIRONMENT sTokEnvNew( void )
|
||||
|
||||
static int sTokEnvAddPos( TOKEN_ENVIRONMENT * pEnv, TOKEN_POSITION * pPos )
|
||||
{
|
||||
size_t index;
|
||||
HB_SIZE index;
|
||||
TOKEN_ENVIRONMENT env = *pEnv;
|
||||
|
||||
/* new memory needed ? */
|
||||
@@ -143,7 +143,7 @@ static int sTokEnvEnd( TOKEN_ENVIRONMENT env )
|
||||
/* get size of token environment in memory */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static size_t sTokEnvGetSize( TOKEN_ENVIRONMENT env )
|
||||
static HB_SIZE sTokEnvGetSize( TOKEN_ENVIRONMENT env )
|
||||
{
|
||||
return sizeof( TOKEN_POSITION ) * ( 2 + env[0].sEndPos );
|
||||
}
|
||||
@@ -164,7 +164,7 @@ static TOKEN_POSITION *sTokEnvGetPos( TOKEN_ENVIRONMENT env )
|
||||
/* get position element pointed to by given 0-based index */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static TOKEN_POSITION *sTokEnvGetPosIndex( TOKEN_ENVIRONMENT env, size_t index )
|
||||
static TOKEN_POSITION *sTokEnvGetPosIndex( TOKEN_ENVIRONMENT env, HB_SIZE index )
|
||||
{
|
||||
if( index >= env[0].sStartPos )
|
||||
return NULL;
|
||||
@@ -191,7 +191,7 @@ static int sTokEnvIncPtr( TOKEN_ENVIRONMENT env )
|
||||
/* set tokenizing pointer to 0-based value */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static int sTokEnvSetPtr( TOKEN_ENVIRONMENT env, size_t sCnt )
|
||||
static int sTokEnvSetPtr( TOKEN_ENVIRONMENT env, HB_SIZE sCnt )
|
||||
{
|
||||
if( sCnt >= env[0].sStartPos )
|
||||
return 0;
|
||||
@@ -222,7 +222,7 @@ static int sTokEnvSetPtr( TOKEN_ENVIRONMENT env, size_t sCnt )
|
||||
/* get value of tokenizing pointer */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static size_t sTokEnvGetPtr( TOKEN_ENVIRONMENT env )
|
||||
static HB_SIZE sTokEnvGetPtr( TOKEN_ENVIRONMENT env )
|
||||
{
|
||||
return env[1].sStartPos;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ static size_t sTokEnvGetPtr( TOKEN_ENVIRONMENT env )
|
||||
/* get token count */
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
static size_t sTokEnvGetCnt( TOKEN_ENVIRONMENT env )
|
||||
static HB_SIZE sTokEnvGetCnt( TOKEN_ENVIRONMENT env )
|
||||
{
|
||||
return env[0].sStartPos;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ static void sTokEnvDel( TOKEN_ENVIRONMENT env )
|
||||
/* static data */
|
||||
static const char *spcSeparatorStr =
|
||||
"\x00" "\x09" "\x0A" "\x0C" "\x1A" "\x20" "\x8A" "\x8C" ",.;:!\?/\\<>()#&%+-*";
|
||||
static const size_t ssSeparatorStrLen = 26;
|
||||
static const HB_SIZE ssSeparatorStrLen = 26;
|
||||
|
||||
/* TODO: make thread safe */
|
||||
static TOKEN_ENVIRONMENT s_sTokenEnvironment = NULL;
|
||||
@@ -372,12 +372,12 @@ HB_FUNC( TOKENINIT )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
const char *pcSeparatorStr;
|
||||
size_t sSeparatorStrLen;
|
||||
HB_SIZE sSeparatorStrLen;
|
||||
ULONG ulSkipCnt, ulSkip;
|
||||
const char *pcSubStr, *pc;
|
||||
size_t sSubStrLen;
|
||||
HB_SIZE sSubStrLen;
|
||||
TOKEN_ENVIRONMENT sTokenEnvironment;
|
||||
TOKEN_POSITION sTokenPosition;
|
||||
|
||||
@@ -422,7 +422,7 @@ HB_FUNC( TOKENINIT )
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
size_t sMatchedPos = sSeparatorStrLen;
|
||||
HB_SIZE sMatchedPos = sSeparatorStrLen;
|
||||
|
||||
/* ulSkip */
|
||||
ulSkipCnt = 0;
|
||||
@@ -578,7 +578,7 @@ HB_FUNC( TOKENNEXT )
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
const char *pcString = hb_parc( 1 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
HB_SIZE sStrLen = hb_parclen( 1 );
|
||||
|
||||
TOKEN_ENVIRONMENT sTokenEnvironment;
|
||||
TOKEN_POSITION *psTokenPosition;
|
||||
@@ -586,7 +586,7 @@ HB_FUNC( TOKENNEXT )
|
||||
/* token environment by parameter ... */
|
||||
if( HB_ISCHAR( 3 ) && HB_ISBYREF( 3 ) )
|
||||
{
|
||||
size_t sStrLen3 = ( size_t ) hb_parclen( 3 );
|
||||
HB_SIZE sStrLen3 = hb_parclen( 3 );
|
||||
|
||||
if( sStrLen3 < sizeof( TOKEN_POSITION ) * 2 )
|
||||
{
|
||||
@@ -937,7 +937,7 @@ HB_FUNC( TOKENEXIT )
|
||||
HB_FUNC( TOKENAT )
|
||||
{
|
||||
int iSeparatorPos = 0;
|
||||
size_t sCurrentIndex;
|
||||
HB_SIZE sCurrentIndex;
|
||||
TOKEN_ENVIRONMENT sTokenEnvironment;
|
||||
TOKEN_POSITION *psTokenPosition;
|
||||
|
||||
@@ -1065,11 +1065,11 @@ HB_FUNC( SAVETOKEN )
|
||||
HB_FUNC( RESTTOKEN )
|
||||
{
|
||||
TOKEN_ENVIRONMENT sTokenEnvironment = NULL;
|
||||
size_t sStrLen = 1;
|
||||
HB_SIZE sStrLen = 1;
|
||||
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
{
|
||||
sStrLen = ( size_t ) hb_parclen( 1 );
|
||||
sStrLen = hb_parclen( 1 );
|
||||
if( sStrLen >= sizeof( TOKEN_POSITION ) )
|
||||
{
|
||||
TOKEN_ENVIRONMENT env = ( TOKEN_ENVIRONMENT ) hb_parc( 1 );
|
||||
|
||||
@@ -125,24 +125,24 @@ HB_FUNC( WORDREPL )
|
||||
int iNoRet;
|
||||
int iMultiPass;
|
||||
|
||||
size_t sSearchLen, sReplaceLen;
|
||||
HB_SIZE sSearchLen, sReplaceLen;
|
||||
|
||||
/* suppressing return value ? */
|
||||
iNoRet = ct_getref() && HB_ISBYREF( 2 );
|
||||
iMultiPass = ct_getatmupa();
|
||||
|
||||
/* param check */
|
||||
if( ( sSearchLen = ( size_t ) hb_parclen( 1 ) ) / 2 > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = ( size_t ) hb_parclen( 3 ) ) / 2 > 0 )
|
||||
if( ( sSearchLen = hb_parclen( 1 ) ) / 2 > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = hb_parclen( 3 ) ) / 2 > 0 )
|
||||
{
|
||||
/* get parameters */
|
||||
const char *pcSearch = hb_parc( 1 );
|
||||
const char *pcString = hb_parc( 2 );
|
||||
size_t sStrLen = ( size_t ) hb_parclen( 2 );
|
||||
HB_SIZE sStrLen = hb_parclen( 2 );
|
||||
const char *pcReplace = hb_parc( 3 );
|
||||
int iMode;
|
||||
char *pcRet;
|
||||
size_t sIndex;
|
||||
HB_SIZE sIndex;
|
||||
|
||||
if( HB_ISLOG( 4 ) )
|
||||
iMode = hb_parl( 4 );
|
||||
@@ -155,9 +155,9 @@ HB_FUNC( WORDREPL )
|
||||
for( sIndex = 0; sIndex < ( sSearchLen & 0xFFFFFFFE ); sIndex += 2 )
|
||||
{
|
||||
|
||||
size_t sMatchStrLen;
|
||||
HB_SIZE sMatchStrLen;
|
||||
const char *pc;
|
||||
size_t sReplIndex = sIndex;
|
||||
HB_SIZE sReplIndex = sIndex;
|
||||
|
||||
if( sReplIndex > ( sReplaceLen & 0xFFFFFFFE ) )
|
||||
{
|
||||
@@ -214,8 +214,8 @@ HB_FUNC( WORDREPL )
|
||||
hb_retclen_buffer( pcRet, sStrLen );
|
||||
}
|
||||
}
|
||||
else /* ( sSearchLen = ( size_t ) hb_parclen( 1 ) ) / 2 > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = ( size_t ) hb_parclen( 3 ) ) / 2 > 0 */
|
||||
else /* ( sSearchLen = hb_parclen( 1 ) ) / 2 > 0 && HB_ISCHAR( 2 ) &&
|
||||
( sReplaceLen = hb_parclen( 3 ) ) / 2 > 0 */
|
||||
{
|
||||
PHB_ITEM pSubst = NULL;
|
||||
int iArgErrorMode = ct_getargerrormode();
|
||||
|
||||
@@ -88,14 +88,14 @@
|
||||
HB_FUNC( WORDTOCHAR )
|
||||
{
|
||||
int iMultiPass;
|
||||
size_t sSearchLen, sStrLen, sReplaceLen;
|
||||
HB_SIZE sSearchLen, sStrLen, sReplaceLen;
|
||||
|
||||
iMultiPass = ct_getatmupa();
|
||||
|
||||
/* param check */
|
||||
if( ( sSearchLen = ( size_t ) hb_parclen( 1 ) ) / 2 > 0 &&
|
||||
( sStrLen = ( size_t ) hb_parclen( 2 ) ) / 2 > 0 &&
|
||||
( sReplaceLen = ( size_t ) hb_parclen( 3 ) ) > 0 )
|
||||
if( ( sSearchLen = hb_parclen( 1 ) ) / 2 > 0 &&
|
||||
( sStrLen = hb_parclen( 2 ) ) / 2 > 0 &&
|
||||
( sReplaceLen = hb_parclen( 3 ) ) > 0 )
|
||||
{
|
||||
|
||||
/* get parameters */
|
||||
@@ -103,7 +103,7 @@ HB_FUNC( WORDTOCHAR )
|
||||
const char *pcString = hb_parc( 2 );
|
||||
const char *pcReplace = hb_parc( 3 );
|
||||
char *pcRet;
|
||||
size_t sRetIndex, sIndex;
|
||||
HB_SIZE sRetIndex, sIndex;
|
||||
int iNoReplace;
|
||||
|
||||
pcRet = ( char * ) hb_xgrab( sStrLen );
|
||||
@@ -115,9 +115,9 @@ HB_FUNC( WORDTOCHAR )
|
||||
|
||||
do
|
||||
{
|
||||
size_t sMatchStrLen;
|
||||
HB_SIZE sMatchStrLen;
|
||||
const char *pc;
|
||||
size_t sReplIndex;
|
||||
HB_SIZE sReplIndex;
|
||||
|
||||
*( pcRet + sRetIndex + 1 ) = *( pcString + sIndex + 1 );
|
||||
|
||||
@@ -149,9 +149,9 @@ HB_FUNC( WORDTOCHAR )
|
||||
hb_retclen( pcRet, sRetIndex + 1 );
|
||||
hb_xfree( pcRet );
|
||||
}
|
||||
else /* ( sSearchLen = ( size_t ) hb_parclen( 1 ) ) / 2 > 0 &&
|
||||
( sStrLen = ( size_t ) hb_parclen( 2 ) ) / 2 > 0 &&
|
||||
( sReplaceLen = ( size_t ) hb_parclen( 3 ) ) > 0 */
|
||||
else /* ( sSearchLen = hb_parclen( 1 ) ) / 2 > 0 &&
|
||||
( sStrLen = hb_parclen( 2 ) ) / 2 > 0 &&
|
||||
( sReplaceLen = hb_parclen( 3 ) ) > 0 */
|
||||
{
|
||||
PHB_ITEM pSubst = NULL;
|
||||
int iArgErrorMode = ct_getargerrormode();
|
||||
|
||||
Reference in New Issue
Block a user