static HB_SIZE hb_cdpItemLen( PHB_CODEPAGE cdp, PHB_ITEM pItem ) { HB_SIZE nLen = hb_itemGetCLen( pItem ); return nLen && HB_CDP_ISCHARIDX( cdp ) ? hb_cdpTextLen( cdp, hb_itemGetCPtr( pItem ), nLen ) : nLen; }
static HB_BOOL hb_mlInit( PHB_MLC_INFO pMLC, int iParAdd ) { HB_ISIZ nSize = hb_parnsdef( 2, 79 ); pMLC->pszString = hb_parc( 1 ); if( pMLC->pszString && nSize > 0 ) { pMLC->nOffset = pMLC->nMaxCol = pMLC->nMaxPos = pMLC->nCol = 0; pMLC->nLineLength = nSize; pMLC->nLen = hb_parclen( 1 ); pMLC->nTabSize = hb_parnsdef( 3 + iParAdd, 4 ); pMLC->fWordWrap = hb_parldef( 4 + iParAdd, 1 ); #ifdef HB_CLP_STRICT if( pMLC->nLineLength > 254 ) pMLC->nLineLength = 79; #endif if( pMLC->nTabSize >= pMLC->nLineLength ) pMLC->nTabSize = pMLC->nLineLength - 1; if( pMLC->nTabSize == 0 ) pMLC->nTabSize = 1; pMLC->cdp = hb_vmCDP(); if( ! HB_CDP_ISCHARIDX( pMLC->cdp ) ) pMLC->cdp = NULL; hb_mlGetEOLs( pMLC, 5 + iParAdd ); return HB_TRUE; } return HB_FALSE; }
static HB_SIZE hb_strAtI( PHB_CODEPAGE cdp, const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen ) { HB_TRACE( HB_TR_DEBUG, ( "hb_strAtI(%p, %s, %" HB_PFS "u, %s, %" HB_PFS "u)", cdp, szSub, nSubLen, szText, nLen ) ); if( nSubLen > 0 && nLen >= nSubLen ) { HB_SIZE nPos = 0, nIndex = 0; do { HB_SIZE nSubPos = 0, nPrev = nPos; if( hb_cdpCharCaseEq( cdp, szText, nLen, &nPos, szSub, nSubLen, &nSubPos ) ) { HB_SIZE nBack = nPos; do { if( nSubPos >= nSubLen ) return ( HB_CDP_ISCHARIDX( cdp ) ? nIndex : nPrev ) + 1; } while( hb_cdpCharCaseEq( cdp, szText, nLen, &nPos, szSub, nSubLen, &nSubPos ) ); nPos = nBack; } ++nIndex; } while( nPos < nLen ); } return 0; }
HB_BOOL hb_strMatchCaseWildExact( const char * szString, const char * szPattern ) { PHB_CODEPAGE cdp = hb_vmCDP(); if( cdp && HB_CDP_ISCHARIDX( cdp ) ) return hb_strMatchWildCDP( szString, szPattern, HB_TRUE, HB_TRUE, HB_FALSE, cdp ); else return hb_strMatchWildRaw( szString, szPattern, HB_TRUE, HB_TRUE, HB_FALSE ); }
static const char * s_hb_padGet( PHB_CODEPAGE cdp, HB_SIZE * pnPad ) { const char * szPad = hb_parc( 3 ); *pnPad = 1; if( szPad == NULL ) szPad = " "; else if( HB_CDP_ISCHARIDX( cdp ) ) { *pnPad = hb_cdpTextPos( cdp, szPad, hb_parclen( 3 ), 1 ); if( *pnPad == 0 ) szPad = ""; } return szPad; }
HB_BOOL hb_strMatchFile( const char * szString, const char * szPattern ) { #if defined( HB_OS_UNIX ) # if defined( HB_NO_FNMATCH ) return hb_strMatchWildExact( szString, szPattern ); # else return fnmatch( szPattern, szString, FNM_PERIOD | FNM_PATHNAME ) == 0; # endif #elif defined( HB_OS_DOS ) || defined( HB_OS_WIN ) || defined( HB_OS_OS2 ) PHB_CODEPAGE cdp = hb_vmCDP(); if( cdp && HB_CDP_ISCHARIDX( cdp ) ) return hb_strMatchWildCDP( szString, szPattern, HB_TRUE, HB_TRUE, HB_TRUE, cdp ); else return hb_strMatchWildRaw( szString, szPattern, HB_TRUE, HB_TRUE, HB_TRUE ); #else return hb_strMatchCaseWildExact( szString, szPattern ); #endif }