diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ff7c480818..f65cd96d59 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,44 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-10-01 23:50 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/tip/Makefile + * contrib/tip/makefile.bc + + contrib/tip/makefile.vc + + contrib/tip/make_vc.bat + * contrib/tip/tip.ch + * contrib/tip/utils.c + * contrib/tip/base64x.c + * contrib/tip/encmthd.c + - contrib/tip/hbhex2n.c + * contrib/tip/cgi.prg + * contrib/tip/client.prg + * contrib/tip/ftpcln.prg + * contrib/tip/httpcln.prg + * contrib/tip/mail.prg + * contrib/tip/thtml.prg + * contrib/tip/url.prg + + Code converted to not require xhb lib. + % Now compiled with -kM switch to avoid macro expansion + of strings. This is important here, as "&" char is used + quite often in the code, so expect a somewhat better + performance. + - Removed hex number conversion functions, as compatible + versions are now available in Harbour with am hb_ prefix. + + C code update to use Harbour API calls only. + + Added VC build script. + ! Fixed two C warnings. + ! Standardized SVN header in one file. + ! Set std SVN keywords and eol-style. + ; Please test it. + + * include/hbextern.ch + * source/rtl/hbinet.c + * contrib/xhb/xhb.ch + * contrib/xhb/xhbfunc.c + * Renamed hb_IsInetSocket() to hb_inetIsSocket() to + keep all inet related functions in one namespace. + 2007-10-01 19:42 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/errorapi.c + added protection against possible GPF when some assign methods diff --git a/harbour/contrib/tip/Makefile b/harbour/contrib/tip/Makefile index 396667d485..40afea5eda 100644 --- a/harbour/contrib/tip/Makefile +++ b/harbour/contrib/tip/Makefile @@ -7,7 +7,6 @@ ROOT = ../../ C_SOURCES = \ base64x.c \ encmthd.c \ - hbhex2n.c \ utils.c \ PRG_SOURCES= \ diff --git a/harbour/contrib/tip/base64x.c b/harbour/contrib/tip/base64x.c index 6053caea03..eaaf4967bb 100644 --- a/harbour/contrib/tip/base64x.c +++ b/harbour/contrib/tip/base64x.c @@ -121,7 +121,7 @@ HB_FUNC( BUILDUSERPASSSTRING ) strcpy( s + 1, szUser ); strcpy( s + u_len + 2, szPass ); - hb_retcAdopt( s ); + hb_retc_buffer( s ); } HB_FUNC( HB_BASE64 ) diff --git a/harbour/contrib/tip/cgi.prg b/harbour/contrib/tip/cgi.prg index 5774b78fbc..ce0d4453da 100644 --- a/harbour/contrib/tip/cgi.prg +++ b/harbour/contrib/tip/cgi.prg @@ -61,7 +61,6 @@ * */ -#include "hbcompat.ch" #include 'hbclass.ch' #include 'tip.ch' #include 'common.ch' @@ -183,7 +182,7 @@ METHOD New() CLASS TIpCgi METHOD Header( cValue ) CLASS TIpCgi if empty( cValue ) - ::cCgiHeader += 'Content-Type: text/html' + _CRLF + ::cCgiHeader += 'Content-Type: text/html' + _CRLF else ::cCgiHeader += cValue + _CRLF endif @@ -215,7 +214,7 @@ METHOD Flush() CLASS TIpCgi local cSID := ::cSID local cSession - hEval( ::hCookies, { |k,v| ::cCgiHeader += 'Set-Cookie: ' + k + '=' + v + ';' + _CRLF } ) + hb_hEval( ::hCookies, { |k,v| ::cCgiHeader += 'Set-Cookie: ' + k + '=' + v + ';' + _CRLF } ) cStream := ::cCgiHeader + _CRLF + ::cHtmlPage + _CRLF @@ -246,11 +245,11 @@ METHOD Flush() CLASS TIpCgi if ( nH := FCreate( cFile, FC_NORMAL ) ) != -1 if ( fwrite( nH, @cSession, nFileSize ) ) != nFileSize - ::Print( "ERROR: On writing session file : " + cFile + ", File error : " + cStr( FError() ) ) + ::Print( "ERROR: On writing session file : " + cFile + ", File error : " + hb_cStr( FError() ) ) endif fclose( nH ) else - ::Print( "ERROR: On writing session file : " + cFile + ", File error : " + cStr( FError() ) ) + ::Print( "ERROR: On writing session file : " + cFile + ", File error : " + hb_cStr( FError() ) ) endif endif @@ -274,7 +273,7 @@ METHOD DestroySession( cID ) CLASS TIpCgi cFile := ::cSessionSavePath + "SESSIONID_" + cSID if !( lRet := ( FErase( cFile ) == 0 ) ) - ::Print( "ERROR: On deleting session file : " + cFile + ", File error : " + cStr( FError() ) ) + ::Print( "ERROR: On deleting session file : " + cFile + ", File error : " + hb_cStr( FError() ) ) else ::hCookies[ 'SESSIONID' ] := cSID + "; expires= " + DateToGMT( DATE() - 1 ) ::CreateSID() @@ -394,12 +393,12 @@ METHOD StartSession( cSID ) CLASS TIpCgi if empty( cSID ) - if ( nH := hGetPos( ::hGets, 'SESSIONID' ) ) != 0 - cSID := hGetValueAt( ::hGets, nH ) - elseif ( nH := hGetPos( ::hPosts, 'SESSIONID' ) ) != 0 - cSID := hGetValueAt( ::hPosts, nH ) - elseif ( nH := hGetPos( ::hCookies, 'SESSIONID' ) ) != 0 - cSID := hGetValueAt( ::hCookies, nH ) + if ( nH := hb_hGetPos( ::hGets, 'SESSIONID' ) ) != 0 + cSID := hb_hGetValueAt( ::hGets, nH ) + elseif ( nH := hb_hGetPos( ::hPosts, 'SESSIONID' ) ) != 0 + cSID := hb_hGetValueAt( ::hPosts, nH ) + elseif ( nH := hb_hGetPos( ::hCookies, 'SESSIONID' ) ) != 0 + cSID := hb_hGetValueAt( ::hCookies, nH ) endif endif @@ -420,7 +419,7 @@ METHOD StartSession( cSID ) CLASS TIpCgi FSeek( nH, 0, FS_SET ) cBuffer := Space( nFileSize ) if ( FRead( nH, @cBuffer, nFileSize ) ) != nFileSize - ::ErrHandler( "ERROR: On reading session file : " + cFile + ", File error : " + cStr( FError() ) ) + ::ErrHandler( "ERROR: On reading session file : " + cFile + ", File error : " + hb_cStr( FError() ) ) else ::SessionDecode( cBuffer ) endif @@ -458,9 +457,9 @@ STATIC FUNCTION HtmlTag( xVal, cKey, cDefault ) DEFAULT cDefault TO '' if !empty( xVal ) .and. !empty( cKey ) - if hHasKey( xVal, cKey ) - cVal := hGet( xVal, cKey ) - hDel( xVal, cKey ) + if hb_hHasKey( xVal, cKey ) + cVal := hb_hGet( xVal, cKey ) + hb_hDel( xVal, cKey ) endif endif @@ -480,7 +479,7 @@ STATIC FUNCTION HtmlAllTag( hTags, cSep ) DEFAULT cSep TO ' ' - hEval( hTags, { |k| cVal += HtmlTag( hTags, k ) + cSep } ) + hb_hEval( hTags, { |k| cVal += HtmlTag( hTags, k ) + cSep } ) return cVal @@ -491,10 +490,10 @@ STATIC FUNCTION HtmlOption( xVal, cKey, cPre, cPost, lScan ) if !empty( xVal ) if empty( cKey ) cVal := xVal - elseif hHasKey( xVal, cKey ) - cVal := hGet( xVal, cKey ) + elseif hb_hHasKey( xVal, cKey ) + cVal := hb_hGet( xVal, cKey ) if empty( lScan ) - hDel( xVal, cKey ) + hb_hDel( xVal, cKey ) endif cVal := cKey + '="' + cVal + '"' if cPre != nil @@ -515,7 +514,7 @@ STATIC FUNCTION HtmlAllOption( hOptions, cSep ) DEFAULT cSep TO ' ' if !empty( hOptions ) - hEval( hOptions, { |k| cVal += HtmlOption( hOptions, k,,, .t. ) + cSep } ) + hb_hEval( hOptions, { |k| cVal += HtmlOption( hOptions, k,,, .t. ) + cSep } ) endif return cVal @@ -527,9 +526,9 @@ STATIC FUNCTION HtmlValue( xVal, cKey, cDefault ) DEFAULT cDefault TO '' if !empty( xVal ) .and. !empty( cKey ) - if hHasKey( xVal, cKey ) - cVal := hGet( xVal, cKey ) - hDel( xVal, cKey ) + if hb_hHasKey( xVal, cKey ) + cVal := hb_hGet( xVal, cKey ) + hb_hDel( xVal, cKey ) endif endif @@ -546,7 +545,7 @@ STATIC FUNCTION HtmlAllValue( hValues, cSep ) DEFAULT cSep TO ' ' if !empty( hValues ) - hEval( hValues, { |k| cVal += HtmlValue( hValues, k ) + cSep } ) + hb_hEval( hValues, { |k| cVal += HtmlValue( hValues, k ) + cSep } ) endif return cVal @@ -560,11 +559,11 @@ STATIC FUNCTION HtmlScript( xVal, cKey ) DEFAULT cKey TO 'script' if !empty( xVal ) - if ( nPos := hGetPos( xVal, cKey ) ) != 0 - cVal := hGetValueAt( xVal, nPos ) + if ( nPos := hb_hGetPos( xVal, cKey ) ) != 0 + cVal := hb_hGetValueAt( xVal, nPos ) if valtype( cVal ) == "H" - if ( nPos := hGetPos( cVal, 'src' ) ) != 0 - cVal := hGetValueAt( cVal, nPos ) + if ( nPos := hb_hGetPos( cVal, 'src' ) ) != 0 + cVal := hb_hGetValueAt( cVal, nPos ) if valtype( cVal ) == "C" cVal := { cVal } endif @@ -574,8 +573,8 @@ STATIC FUNCTION HtmlScript( xVal, cKey ) cVal := cTmp endif endif - if ( nPos := hGetPos( cVal, 'var' ) ) != 0 - cVal := hGetValueAt( cVal, nPos ) + if ( nPos := hb_hGetPos( cVal, 'var' ) ) != 0 + cVal := hb_hGetValueAt( cVal, nPos ) if valtype( cVal ) == "C" cVal := { cVal } endif @@ -586,7 +585,7 @@ STATIC FUNCTION HtmlScript( xVal, cKey ) endif endif endif - hDel( xVal, cKey ) + hb_hDel( xVal, cKey ) endif endif @@ -601,11 +600,11 @@ STATIC FUNCTION HtmlStyle( xVal, cKey ) DEFAULT cKey TO 'style' if !empty( xVal ) - if ( nPos := hGetPos( xVal, cKey ) ) != 0 - cVal := hGetValueAt( xVal, nPos ) + if ( nPos := hb_hGetPos( xVal, cKey ) ) != 0 + cVal := hb_hGetValueAt( xVal, nPos ) if valtype( cVal ) == "H" - if ( nPos := hGetPos( cVal, 'src' ) ) != 0 - cVal := hGetValueAt( cVal, nPos ) + if ( nPos := hb_hGetPos( cVal, 'src' ) ) != 0 + cVal := hb_hGetValueAt( cVal, nPos ) if valtype( cVal ) == "C" cVal := { cVal } endif @@ -615,8 +614,8 @@ STATIC FUNCTION HtmlStyle( xVal, cKey ) cVal := cTmp endif endif - if ( nPos := hGetPos( cVal, 'var' ) ) != 0 - cVal := hGetValueAt( cVal, nPos ) + if ( nPos := hb_hGetPos( cVal, 'var' ) ) != 0 + cVal := hb_hGetValueAt( cVal, nPos ) if valtype( cVal ) == "C" cVal := { cVal } endif @@ -627,7 +626,7 @@ STATIC FUNCTION HtmlStyle( xVal, cKey ) endif endif endif - hDel( xVal, cKey ) + hb_hDel( xVal, cKey ) endif endif @@ -658,7 +657,7 @@ STATIC FUNCTION GenerateSID( cCRCKey ) cTemp := StrZero( nSIDCRC, 5 ) cSIDCRC := "" for n := 1 to Len( cTemp ) - cSIDCRC += SubStr( cCRCKey, Val( SubStr( cTemp, n, 1 ) ) + 1, 1 ) + cSIDCRC += SubStr( cCRCKey, Val( SubStr( cTemp, n, 1 ) ) + 1, 1 ) next cRet := cSID + cSIDCRC @@ -688,30 +687,29 @@ STATIC FUNCTION CheckSID( cSID, cCRCKey ) cTemp := StrZero( nSIDCRC, 5 ) cSIDCRC := "" for n := 1 to Len( cTemp ) - cSIDCRC += SubStr( cCRCKey, Val( SubStr( cTemp, n, 1 ) ) + 1, 1 ) + cSIDCRC += SubStr( cCRCKey, Val( SubStr( cTemp, n, 1 ) ) + 1, 1 ) next RETURN ( Right( cSID, 5 ) == cSIDCRC ) STATIC FUNCTION DateToGMT( dDate, cTime ) - LOCAL cStr := "" - LOCAL cOldDateFormat := Set( _SET_DATEFORMAT, "dd-mm-yy" ) - LOCAL nDay, nMonth, nYear, nDoW - LOCAL aDays := { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } - LOCAL aMonths := { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } - - DEFAULT dDate TO DATE() - DEFAULT cTime TO TIME() - - nDay := Day( dDate ) - nMonth := Month( dDate ) - nYear := Year( dDate) - nDoW := Dow( dDate ) - - cStr := aDays[ nDow ] + ", " + StrZero( nDay, 2 ) + "-" + aMonths[ nMonth ] + "-" + ; - Right( StrZero( nYear, 4 ), 2 ) + " " + cTime + " GMT" - - Set( _SET_DATEFORMAT, cOldDateFormat ) - -RETURN cStr + LOCAL cStr := "" + LOCAL cOldDateFormat := Set( _SET_DATEFORMAT, "dd-mm-yy" ) + LOCAL nDay, nMonth, nYear, nDoW + LOCAL aDays := { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } + LOCAL aMonths := { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } + + DEFAULT dDate TO DATE() + DEFAULT cTime TO TIME() + + nDay := Day( dDate ) + nMonth := Month( dDate ) + nYear := Year( dDate) + nDoW := Dow( dDate ) + + cStr := aDays[ nDow ] + ", " + StrZero( nDay, 2 ) + "-" + aMonths[ nMonth ] + "-" + ; + Right( StrZero( nYear, 4 ), 2 ) + " " + cTime + " GMT" + + Set( _SET_DATEFORMAT, cOldDateFormat ) + RETURN cStr diff --git a/harbour/contrib/tip/client.prg b/harbour/contrib/tip/client.prg index f3eaa044d3..58117c5092 100644 --- a/harbour/contrib/tip/client.prg +++ b/harbour/contrib/tip/client.prg @@ -71,7 +71,6 @@ Added data ::nWrite to work like ::nRead */ -#include "hbcompat.ch" #include "hbclass.ch" #include "error.ch" #include "fileio.ch" @@ -581,9 +580,9 @@ METHOD Log( ... ) CLASS tIPClient // Preserves CRLF on result if xVar:__enumIndex() < PCount() - cMsg += StrTran( StrTran( AllTrim( CStr( xVar ) ), Chr( 13 ) ), Chr( 10 ) ) + cMsg += StrTran( StrTran( AllTrim( hb_CStr( xVar ) ), Chr( 13 ) ), Chr( 10 ) ) else - cMsg += CStr( xVar ) + cMsg += hb_CStr( xVar ) endif cMsg += iif ( xVar:__enumIndex() < PCount() - 1, ", ", "" ) diff --git a/harbour/contrib/tip/encmthd.c b/harbour/contrib/tip/encmthd.c index b2823863c7..29dafdce50 100644 --- a/harbour/contrib/tip/encmthd.c +++ b/harbour/contrib/tip/encmthd.c @@ -113,12 +113,12 @@ HB_FUNC( TIPENCODERBASE64_ENCODE ) break; case 2: cElem1 = nPos < nLen -1 ? (unsigned char) cData[ nPos + 1] : 0; - cElem = ((cElem & 0x3) << 4) | cElem1 >> 4; + cElem = ((cElem & 0x3) << 4) | (cElem1 >> 4); nPos++; break; case 3: cElem1 = nPos < nLen -1 ? (unsigned char) cData[ nPos + 1] : 0; - cElem = ((cElem & 0xF) << 2) | cElem1 >> 6; + cElem = ((cElem & 0xF) << 2) | (cElem1 >> 6); nPos++; break; case 4: @@ -183,7 +183,7 @@ HB_FUNC( TIPENCODERBASE64_ENCODE ) } /* this function also adds a zero */ - hb_retclenAdopt( cRet, nPosRet ); + hb_retclen_buffer( cRet, nPosRet ); } HB_FUNC( TIPENCODERBASE64_DECODE ) @@ -280,7 +280,7 @@ HB_FUNC( TIPENCODERBASE64_DECODE ) /* this function also adds a zero */ /* hopefully reduce the size of cRet */ cRet = (unsigned char *) hb_xrealloc( cRet, nPosRet + 1 ); - hb_retclenAdopt( (char *)cRet, nPosRet ); + hb_retclen_buffer( (char *)cRet, nPosRet ); } HB_FUNC( TIPENCODERQP_ENCODE ) @@ -354,7 +354,7 @@ HB_FUNC( TIPENCODERQP_ENCODE ) /* this function also adds a zero */ cRet = (char *) hb_xrealloc( cRet, nPosRet + 1 ); - hb_retclenAdopt( cRet, nPosRet ); + hb_retclen_buffer( cRet, nPosRet ); } HB_FUNC( TIPENCODERQP_DECODE ) @@ -430,7 +430,7 @@ HB_FUNC( TIPENCODERQP_DECODE ) /* this function also adds a zero */ /* hopefully reduce the size of cRet */ cRet = (char *) hb_xrealloc( cRet, nPosRet + 1 ); - hb_retclenAdopt( cRet, nPosRet ); + hb_retclen_buffer( cRet, nPosRet ); } HB_FUNC( TIPENCODERURL_ENCODE ) @@ -564,5 +564,5 @@ HB_FUNC( TIPENCODERURL_DECODE ) /* this function also adds a zero */ /* hopefully reduce the size of cRet */ cRet = (char *) hb_xrealloc( cRet, nPosRet + 1 ); - hb_retclenAdopt( cRet, nPosRet ); + hb_retclen_buffer( cRet, nPosRet ); } diff --git a/harbour/contrib/tip/ftpcln.prg b/harbour/contrib/tip/ftpcln.prg index 149da4e84d..acf1d1b805 100644 --- a/harbour/contrib/tip/ftpcln.prg +++ b/harbour/contrib/tip/ftpcln.prg @@ -80,7 +80,6 @@ Cleaned unused variables. */ -#include "hbcompat.ch" #include "directry.ch" #include "hbclass.ch" #include "tip.ch" @@ -844,7 +843,7 @@ METHOD listFiles( cFileSpec ) CLASS tIPClientFTP DO WHILE SubStr( cEntry, ++nStart, 1 ) == " " ; ENDDO aFile[F_NAME] := SubStr( cEntry, nStart ) - aFile[F_DATE] := StoD( cYear+cMonth+cDay ) + aFile[F_DATE] := hb_StoD( cYear+cMonth+cDay ) aFile[F_TIME] := cTime aList[ cEntry:__enumIndex() ] := aFile diff --git a/harbour/contrib/tip/hbhex2n.c b/harbour/contrib/tip/hbhex2n.c deleted file mode 100644 index 15c9a5f65e..0000000000 --- a/harbour/contrib/tip/hbhex2n.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * xHarbour compatible functions: NUMTOHEX, HEXTONUM, STRTOHEX, HEXTOSTR - * - * Copyright 2007 Przemyslaw Czerpak - * www - http://www.harbour-project.org - * Copyright 2003 Giancarlo Niccolai - * www - http://www.xharbour.org - * - * 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. - * - */ - -#include "hbapi.h" -#include "hbapierr.h" - -static HB_ULONG hb_hextonum( char * szHex ) -{ - HB_ULONG ulNum = 0; - int iDigit; - - while( * szHex == ' ' ) szHex++; - while( * szHex ) - { - iDigit = * szHex; - if ( iDigit >= '0' && iDigit <= '9' ) - iDigit -= '0'; - else if ( iDigit >= 'A' && iDigit <= 'F' ) - iDigit -= 'A' - 10; - else if ( iDigit >= 'a' && iDigit <= 'f' ) - iDigit -= 'a' - 10; - else - { - ulNum = 0; - break; - } - ulNum = ( ulNum << 4 ) + iDigit; - szHex++; - } - return ulNum; -} - -HB_FUNC( NUMTOHEX ) -{ - HB_ULONG ulNum; - char ret[ 33 ]; - int iDigit, iLen, iDefaultLen; - - if( ISNUM( 2 ) ) - { - iLen = hb_parni( 2 ); - iLen = iLen < 1 ? 1 : ( iLen > 32 ? 32 : iLen ); - iDefaultLen = 0; - } - else - { - iLen = 32; - iDefaultLen = 1; - } - - if( ISNUM( 1 ) ) - ulNum = hb_parnint( 1 ); - else if( ISPOINTER( 1 ) ) - ulNum = ( HB_PTRDIFF ) hb_parptr( 1 ); - else - { - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); - return; - } - - ret[ iLen ] = '\0'; - do - { - iDigit = ( int ) ( ulNum & 0x0F ); - ret[ --iLen ] = iDigit + ( iDigit < 10 ? '0' : 'A' - 10 ); - ulNum >>= 4; - } - while( iDefaultLen ? ulNum > 0 : iLen > 0 ); - - hb_retc( &ret[ iLen ] ); -} - -HB_FUNC( HEXTONUM ) -{ - if( ISCHAR( 1 ) ) - hb_retnint( hb_hextonum( hb_parc( 1 ) ) ); - else - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); -} - -HB_FUNC( STRTOHEX ) -{ - char * cStr = hb_parc( 1 ); - ULONG ulLen = hb_parclen( 1 ); - - if( !cStr ) - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); - else if( ulLen == 0 ) - hb_retc( NULL ); - else - { - char * cSep = hb_parc( 2 ), * cOutBuf, * c; - ULONG ulLenSep = hb_parclen( 2 ), ul; - - c = cOutBuf = ( char * ) hb_xgrab( ulLen * 2 + ( ulLen - 1 ) * ulLenSep + 1 ); - for( ul = 0; ul < ulLen; ul++ ) - { - if( ulLenSep && ul ) - { - memcpy( c, cSep, ulLenSep ); - c += ulLenSep; - } - c[ 0 ] = ( cStr[ ul ] >> 4 ) & 0x0F; - c[ 0 ] += c[ 0 ] < 10 ? '0' : 'A' - 10; - c[ 1 ] = cStr[ ul ] & 0x0F; - c[ 1 ] += c[ 1 ] < 10 ? '0' : 'A' - 10; - c += 2; - } - hb_retclen_buffer( cOutBuf, c - cOutBuf ); - } -} - -HB_FUNC( HEXTOSTR ) -{ - char * cStr = hb_parc( 1 ); - - if( cStr ) - { - ULONG ulLen = hb_parclen( 1 ), ulPos = 0, ul; - char * cOutBuf = ( char * ) hb_xgrab( ( ulLen >> 1 ) + 1 ), c; - int iByte = 0, iFirst = 0; - - for( ul = 0; ul < ulLen; ul++ ) - { - c = *cStr++; - if( c >= '0' && c <= '9' ) - iByte = ( iByte << 4 ) + c - '0'; - else if( c >= 'A' && c <= 'F' ) - iByte = ( iByte << 4 ) + c - 'A' + 10; - else if( c >= 'a' && c <= 'f' ) - iByte = ( iByte << 4 ) + c - 'a' + 10; - else - continue; - iFirst ^= 1; - if( !iFirst ) - { - cOutBuf[ ulPos++ ] = ( char ) iByte; - iByte = 0; - } - } - hb_retclen_buffer( cOutBuf, ulPos ); - } - else - hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, &hb_errFuncName, HB_ERR_ARGS_BASEPARAMS ); -} diff --git a/harbour/contrib/tip/httpcln.prg b/harbour/contrib/tip/httpcln.prg index b16709af6b..6afe68e8f5 100644 --- a/harbour/contrib/tip/httpcln.prg +++ b/harbour/contrib/tip/httpcln.prg @@ -125,12 +125,12 @@ METHOD Post( cPostData, cQuery ) CLASS tIPClientHTTP cData := "" FOR nI := 1 TO Len( cPostData ) cTmp := HGetKeyAt( cPostData, nI ) - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := AllTrim( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cTmp +"=" cTmp := HGetValueAt( cPostData, nI ) - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cTmp + "&" NEXT @@ -140,12 +140,12 @@ METHOD Post( cPostData, cQuery ) CLASS tIPClientHTTP y:=Len(cPostData) FOR nI := 1 TO y cTmp := cPostData[ nI ,1] - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := AllTrim( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cTmp +"=" cTmp := cPostData[ nI,2] - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cTmp IF nI!=y @@ -337,7 +337,7 @@ METHOD Read( nLen ) CLASS tIPClientHTTP // Convert to length // Set length so that super::Read reads in at max cLine bytes. - ::nLength := HexToNum( cLine ) + ::nRead + ::nLength := hb_HexToNum( cLine ) + ::nRead ENDIF @@ -522,12 +522,12 @@ METHOD PostMultiPart( cPostData, cQuery ) CLASS tIPClientHTTP elseif HB_IsHash( cPostData ) FOR nI := 1 TO Len( cPostData ) cTmp := HGetKeyAt( cPostData, nI ) - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := AllTrim( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cBound+cCrlf+'Content-Disposition: form-data; name="'+cTmp +'"'+cCrlf+cCrLf cTmp := HGetValueAt( cPostData, nI ) - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := AllTrim( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cTmp+cCrLf @@ -536,12 +536,12 @@ METHOD PostMultiPart( cPostData, cQuery ) CLASS tIPClientHTTP y:=Len(cPostData) FOR nI := 1 TO y cTmp := cPostData[ nI ,1] - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := AllTrim( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cBound+cCrlf+'Content-Disposition: form-data; name="'+cTmp +'"'+cCrlf+cCrLf cTmp := cPostData[ nI,2] - cTmp := CStr( cTmp ) + cTmp := hb_cStr( cTmp ) cTmp := AllTrim( cTmp ) cTmp := TipEncoderUrl_Encode( cTmp ) cData += cTmp+cCrLf diff --git a/harbour/contrib/tip/mail.prg b/harbour/contrib/tip/mail.prg index c2b40f2957..16463d3a2f 100644 --- a/harbour/contrib/tip/mail.prg +++ b/harbour/contrib/tip/mail.prg @@ -60,7 +60,6 @@ Added method :getMultiParts() */ -#include "hbcompat.ch" #include "hbclass.ch" CLASS TipMail @@ -118,7 +117,7 @@ ENDCLASS METHOD New( cBody, oEncoder ) CLASS TipMail // Set header fileds to non-sensitive - ::hHeaders := HSetCaseMatch( {=>}, .F. ) + ::hHeaders := hb_HSetCaseMatch( {=>}, .F. ) ::aAttachments := {} IF Valtype( oEncoder ) $ "CO" @@ -172,11 +171,11 @@ RETURN ::cBody METHOD GetFieldPart( cPart ) CLASS TipMail LOCAL nPos, cEnc - nPos := HGetPos( ::hHeaders, cPart ) + nPos := hb_HGetPos( ::hHeaders, cPart ) IF nPos == 0 RETURN "" ELSE - cEnc := HGetValueAt( ::hHeaders, nPos ) + cEnc := hb_HGetValueAt( ::hHeaders, nPos ) nPos := At( ";", cEnc ) IF nPos != 0 cEnc := Substr( cEnc, 1, nPos - 1) @@ -190,11 +189,11 @@ METHOD GetFieldOption( cPart, cOption ) CLASS TipMail LOCAL nPos, aMatch LOCAL cEnc - nPos := HGetPos( ::hHeaders, cPart ) + nPos := hb_HGetPos( ::hHeaders, cPart ) IF nPos == 0 RETURN "" ELSE - cEnc := HGetValueAt( ::hHeaders, nPos ) + cEnc := hb_HGetValueAt( ::hHeaders, nPos ) // Case insensitive check aMatch := HB_Regex( ";\s*" + cOption +"\s*=\s*([^;]*)", cEnc, .F. ) IF aMatch != NIL @@ -209,11 +208,11 @@ RETURN cEnc METHOD SetFieldPart( cPart, cValue ) CLASS TipMail LOCAL nPos, cEnc - nPos := HGetPos( ::hHeaders, cPart ) + nPos := hb_HGetPos( ::hHeaders, cPart ) IF nPos == 0 ::hHeaders[ cPart ] := cValue ELSE - cEnc := HGetValueAt( ::hHeaders, nPos ) + cEnc := hb_HGetValueAt( ::hHeaders, nPos ) nPos := At( ";", cEnc ) IF nPos == 0 ::hHeaders[ cPart ] := cValue @@ -229,11 +228,11 @@ METHOD SetFieldOption( cPart, cOption, cValue ) CLASS TipMail LOCAL nPos, aMatch LOCAL cEnc - nPos := HGetPos( ::hHeaders, cPart ) + nPos := hb_HGetPos( ::hHeaders, cPart ) IF nPos == 0 Return .F. ELSE - cEnc := HGetValueAt( ::hHeaders, nPos ) + cEnc := hb_HGetValueAt( ::hHeaders, nPos ) aMatch := HB_Regex( "(.*?;\s*)" + cOption +"\s*=[^;]*(.*)?", cEnc, .F. ) IF Empty( aMatch ) ::hHeaders[ cPart ] := cEnc += "; "+ cOption + '="' + cValue + '"' @@ -336,12 +335,12 @@ METHOD ToString() CLASS TipMail endif FOR i := 1 TO Len( ::hHeaders ) - cElem := Lower(HGetKeyAt( ::hHeaders, i )) + cElem := Lower(hb_HGetKeyAt( ::hHeaders, i )) IF cElem != "return-path" .and. cElem != "delivered-to" .and.; cElem != "date" .and. cElem != "from" .and.; cElem != "to" .and. cElem != "subject" .and. cElem !="mime-version" - cRet += HGetKeyAt( ::hHeaders, i ) + ": " +; - HGetValueAt( ::hHeaders, i ) + e"\r\n" + cRet += hb_HGetKeyAt( ::hHeaders, i ) + ": " +; + hb_HGetValueAt( ::hHeaders, i ) + e"\r\n" ENDIF NEXT @@ -386,7 +385,7 @@ METHOD FromString( cMail, cBoundary, nPos ) CLASS TipMail ENDIF IF Len( ::hHeaders ) > 0 - ::hHeaders := HSetCaseMatch( {=>} , .F. ) + ::hHeaders := hb_HSetCaseMatch( {=>} , .F. ) ENDIF IF Len( ::aReceived ) > 0 diff --git a/harbour/contrib/tip/make_b32.bat b/harbour/contrib/tip/make_b32.bat index e53514a47a..b5e3817bfd 100644 --- a/harbour/contrib/tip/make_b32.bat +++ b/harbour/contrib/tip/make_b32.bat @@ -1,25 +1,25 @@ -@echo off -rem -rem $Id$ -rem - -:BUILD - - make -fmakefile.bc %1 %2 %3 > make_b32.log - if "%1" == "clean" goto CLEAN - if "%1" == "CLEAN" goto CLEAN - if errorlevel 1 goto BUILD_ERR - -:BUILD_OK - copy ..\..\lib\b32\tip.lib ..\..\lib > nul - goto EXIT - -:BUILD_ERR - notepad make_b32.log - goto EXIT - -:CLEAN - if exist make_b32.log del make_b32.log - -:EXIT - +@echo off +rem +rem $Id$ +rem + +:BUILD + + make -fmakefile.bc %1 %2 %3 > make_b32.log + if "%1" == "clean" goto CLEAN + if "%1" == "CLEAN" goto CLEAN + if errorlevel 1 goto BUILD_ERR + +:BUILD_OK + copy ..\..\lib\b32\tip.lib ..\..\lib > nul + goto EXIT + +:BUILD_ERR + notepad make_b32.log + goto EXIT + +:CLEAN + if exist make_b32.log del make_b32.log + +:EXIT + diff --git a/harbour/contrib/tip/make_vc.bat b/harbour/contrib/tip/make_vc.bat new file mode 100644 index 0000000000..3d6c276033 --- /dev/null +++ b/harbour/contrib/tip/make_vc.bat @@ -0,0 +1,21 @@ +@echo off +rem +rem $Id$ +rem + +:BUILD + + nmake /f makefile.vc %1 %2 %3 > make_vc.log + if errorlevel 1 goto BUILD_ERR + +:BUILD_OK + + copy ..\..\lib\vc\tip.lib ..\..\lib\*.* >nul + goto EXIT + +:BUILD_ERR + + notepad make_vc.log + +:EXIT + diff --git a/harbour/contrib/tip/makefile.bc b/harbour/contrib/tip/makefile.bc index 2d02e29760..cf97cb7955 100644 --- a/harbour/contrib/tip/makefile.bc +++ b/harbour/contrib/tip/makefile.bc @@ -27,7 +27,6 @@ $(LIB_DIR)\tip.lib : \ $(OBJ_DIR)\thtml.obj \ $(OBJ_DIR)\base64x.obj \ $(OBJ_DIR)\encmthd.obj \ - $(OBJ_DIR)\hbhex2n.obj \ $(OBJ_DIR)\utils.obj $(OBJ_DIR)\popcln.c : popcln.prg @@ -71,7 +70,6 @@ $(OBJ_DIR)\thtml.obj : $(OBJ_DIR)\thtml.c $(OBJ_DIR)\base64x.obj : base64x.c $(OBJ_DIR)\encmthd.obj : encmthd.c -$(OBJ_DIR)\hbhex2n.obj : hbhex2n.c $(OBJ_DIR)\utils.obj : utils.c .c.obj: @@ -79,5 +77,5 @@ $(OBJ_DIR)\utils.obj : utils.c tlib $(LIB_DIR)\tip.lib -+$@,, .prg.c: - $(BIN_DIR)\harbour.exe $< -q0 -w -es2 -gc0 -n -i$(INCLUDE_DIR) -o$@ + $(BIN_DIR)\harbour.exe $< -q0 -w -es2 -gc0 -kM -n -i$(INCLUDE_DIR) -o$@ diff --git a/harbour/contrib/tip/makefile.vc b/harbour/contrib/tip/makefile.vc new file mode 100644 index 0000000000..aa52b3ef80 --- /dev/null +++ b/harbour/contrib/tip/makefile.vc @@ -0,0 +1,169 @@ +# +# $Id$ +# + +# +# Makefile for Harbour Project for Microsoft Visual C (32 bits) +# + +# +# NOTE: You can use these envvars to configure the make process: +# (note that these are all optional) +# +# CFLAGS - Extra C compiler options for libraries and for +# executables +# C_USR - Extra C compiler options for libraries and for +# executables (GNU make compatible envvar) +# CLIBFLAGS - Extra C compiler options for the libraries +# HARBOURFLAGS - Extra Harbour compiler options +# PRG_USR - Extra Harbour compiler options +# (GNU make compatible envvar) +# + +# +# Notes about this makefile: +# +# 1. To add new files to a dependancy list, add an obj name to one of the +# OBJ lists for the appropriate library. +# NOTE: put .prg related obj's last in the lib list. +# +# 2. This is a recursive script. If you change the name of this file, +# be sure to change MK_FILE (a few lines down) to the new name as well. +# +# 3. Recurrsion rules are quite simple: +# If you specifiy /a on the command line, files in the obj\vc dir +# will be deleted, and when nmake recurses, it's without the /a flag +# +# If a .prg.obj rule is fired, nmake will execute this script with +# a specific target as a parameter immediatley after compiling a given +# set of prg files. +# ie: Harbour $< +# nmake /fmakefile.vc obj\vc\rtl.lib2 +# which will simply get make to re-evaluate the dependancy list for the +# lib, and as a result, it will execute the C compiler using the .c.obj +# rule below to create the obj's for the prg's that were created just +# prior to the recurrsive call. Once the obj's are created, the +# recurrsion is complete. +# See additional notes under RTL.LIB below. +# + +MK_FILE = makefile.vc +MK_FLAGS = $(MAKEFLAGS: =) + +OBJ_DIR = ..\..\obj\vc +LIB_DIR = ..\..\lib\vc +BIN_DIR = ..\..\bin + +# +# Directory macros. These should never have to change. +# + +INCLUDE_DIR = ..\..\include +TOOLS_DIR = . + +# +# C compiler definition and C flags. These should never have to change. +# + +AS = masm +CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(C_USR) $(CFLAGS) +CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) +CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS) +HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w2 -es2 -gc0 -kM $(PRG_USR) $(HARBOURFLAGS) +LDFLAGS = $(LDFLAGS) + +# +# Macros to access our library names +# + +TOOLS_LIB = $(LIB_DIR)\tip.lib + +HARBOUR_EXE = $(BIN_DIR)\harbour.exe + +# +# Rules +# + +.SUFFIXES: .prg .lib .c .obj .asm + +# override builtin + +.c.obj:: + $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< + +# +# +# + +LIBLIST = \ + $(TOOLS_LIB) + +# +# TOOLS.LIB rules +# + +{$(TOOLS_DIR)}.c{$(OBJ_DIR)}.obj:: + $(CC) $(CLIBFLAGS) -Fo$(OBJ_DIR)\ $< + +{$(TOOLS_DIR)}.prg{$(OBJ_DIR)}.obj:: + $(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $< + $(MAKE) -nologo /$(MK_FLAGS) /f$(MK_FILE) $(TOOLS_LIB)2 + +TOOLS_LIB_OBJS = \ + $(OBJ_DIR)\base64x.obj \ + $(OBJ_DIR)\encmthd.obj \ + $(OBJ_DIR)\utils.obj \ + \ + $(OBJ_DIR)\cgi.obj \ + $(OBJ_DIR)\client.obj \ + $(OBJ_DIR)\credent.obj \ + $(OBJ_DIR)\encb64.obj \ + $(OBJ_DIR)\encoder.obj \ + $(OBJ_DIR)\encqp.obj \ + $(OBJ_DIR)\encurl.obj \ + $(OBJ_DIR)\ftpcln.obj \ + $(OBJ_DIR)\httpcln.obj \ + $(OBJ_DIR)\mail.obj \ + $(OBJ_DIR)\popcln.obj \ + $(OBJ_DIR)\smtpcln.obj \ + $(OBJ_DIR)\thtml.obj \ + $(OBJ_DIR)\url.obj \ + +# +# Our default target +# + + +all: \ + $(TOOLS_LIB) + +CLEAN: + -@if exist $(OBJ_DIR)\base64x.* del $(OBJ_DIR)\base64x.* + -@if exist $(OBJ_DIR)\encmthd.* del $(OBJ_DIR)\encmthd.* + -@if exist $(OBJ_DIR)\utils.* del $(OBJ_DIR)\utils.* + -@if exist $(OBJ_DIR)\cgi.* del $(OBJ_DIR)\cgi.* + -@if exist $(OBJ_DIR)\client.* del $(OBJ_DIR)\client.* + -@if exist $(OBJ_DIR)\credent.* del $(OBJ_DIR)\credent.* + -@if exist $(OBJ_DIR)\encb64.* del $(OBJ_DIR)\encb64.* + -@if exist $(OBJ_DIR)\encoder.* del $(OBJ_DIR)\encoder.* + -@if exist $(OBJ_DIR)\encqp.* del $(OBJ_DIR)\encqp.* + -@if exist $(OBJ_DIR)\encurl.* del $(OBJ_DIR)\encurl.* + -@if exist $(OBJ_DIR)\ftpcln.* del $(OBJ_DIR)\ftpcln.* + -@if exist $(OBJ_DIR)\httpcln.* del $(OBJ_DIR)\httpcln.* + -@if exist $(OBJ_DIR)\mail.* del $(OBJ_DIR)\mail.* + -@if exist $(OBJ_DIR)\popcln.* del $(OBJ_DIR)\popcln.* + -@if exist $(OBJ_DIR)\smtpcln.* del $(OBJ_DIR)\smtpcln.* + -@if exist $(OBJ_DIR)\thtml.* del $(OBJ_DIR)\thtml.* + -@if exist $(OBJ_DIR)\url.* del $(OBJ_DIR)\url.* + -@if exist $(TOOLS_LIB) del $(TOOLS_LIB) + +# +# Library dependencies and build rules +# + +$(TOOLS_LIB) : $(TOOLS_LIB_OBJS) + lib /out:$@ $** + +# dummy targets used for prg to c creation + +$(TOOLS_LIB)2 : $(TOOLS_LIB_OBJS) diff --git a/harbour/contrib/tip/thtml.prg b/harbour/contrib/tip/thtml.prg index 0e15d2a0ab..a3272579c0 100644 --- a/harbour/contrib/tip/thtml.prg +++ b/harbour/contrib/tip/thtml.prg @@ -49,7 +49,6 @@ * */ -#include "hbcompat.ch" #include "common.ch" #include "error.ch" #include "hbclass.ch" @@ -136,15 +135,13 @@ ENDCLASS METHOD new( cHtmlString ) CLASS THtmlDocument LOCAL cEmptyHtmlDoc, oNode, oSubNode, oErrNode, aHead, aBody, nMode := 0 - TEXT INTO cEmptyHtmlDoc - - - - - - - - ENDTEXT + cEmptyHtmlDoc := '' + hb_OSNewLine() +; + '' + hb_OSNewLine() +; + ' ' + hb_OSNewLine() +; + ' ' + hb_OSNewLine() +; + ' ' + hb_OSNewLine() +; + ' ' + hb_OSNewLine() +; + '' IF Valtype( cHtmlString ) <> "C" ::root := THtmlNode():new( cEmptyHtmlDoc ) @@ -407,13 +404,13 @@ METHOD Next() CLASS THtmlIterator LOCAL oFound, lExit := .F. DO WHILE .NOT. lExit - TRY + BEGIN SEQUENCE WITH {|oErr| Break( oErr )} oFound := ::aNodes[ ++::nCurrent ] IF ::MatchCriteria( oFound ) ::oNode := oFound lExit := .T. ENDIF - CATCH + RECOVER lExit := .T. oFound := NIL ::nCurrent := 0 @@ -447,13 +444,13 @@ METHOD MatchCriteria( oFound ) CLASS THtmlIteratorScan RETURN .F. ENDIF - IF ::cAttribute != NIL .and. .not. HHasKey( oFound:getAttributes(), ::cAttribute ) + IF ::cAttribute != NIL .and. .not. hb_HHasKey( oFound:getAttributes(), ::cAttribute ) RETURN .F. ENDIF IF ::cValue != NIL xData := oFound:getAttributes() - IF HScan( xData, {| xKey,cValue| HB_SYMBOL_UNUSED(xKey), Lower(::cValue) == Lower(cValue) }) == 0 + IF hb_HScan( xData, {| xKey,cValue| HB_SYMBOL_UNUSED(xKey), Lower(::cValue) == Lower(cValue) }) == 0 RETURN .F. ENDIF ENDIF @@ -486,23 +483,23 @@ RETURN Self METHOD MatchCriteria( oFound ) CLASS THtmlIteratorRegex LOCAL xData - IF ::cName != NIL .and. .not. ( Lower(::cName) LIKE Lower(oFound:htmlTagName) ) + IF ::cName != NIL .and. .not. hb_regexLike( Lower(oFound:htmlTagName), Lower(::cName) ) RETURN .F. ENDIF IF ::cAttribute != NIL .and. ; - hScan( oFound:getAttributes(), {|cKey| ( cKey LIKE lower(::cAttribute) ) } ) == 0 + hb_hScan( oFound:getAttributes(), {|cKey| hb_regexLike( lower(::cAttribute), cKey ) } ) == 0 RETURN .F. ENDIF IF ::cValue != NIL .and.; - hScan( oFound:getAttributes(), {| xKey ,cValue| HB_SYMBOL_UNUSED(xKey), ( cValue LIKE ::cValue ) } ) == 0 + hb_hScan( oFound:getAttributes(), {|xKey, cValue| HB_SYMBOL_UNUSED(xKey), hb_regexLike( ::cValue, cValue ) } ) == 0 RETURN .F. ENDIF IF ::cData != NIL xData := oFound:getText(" ") - IF Empty(xData) .OR. .NOT. ( Alltrim(xData) HAS Alltrim(::cData) ) + IF Empty(xData) .OR. .NOT. hb_regexHas( Alltrim(::cData), Alltrim(xData) ) RETURN .F. ENDIF ENDIF @@ -640,9 +637,9 @@ RETURN self METHOD isType( nType ) CLASS THtmlNode LOCAL lRet - TRY - lRet := ( ( ::htmlTagType[2] & nType ) > 0 ) - CATCH + BEGIN SEQUENCE WITH {|oErr| Break( oErr )} + lRet := hb_bitAnd( ::htmlTagType[2], nType ) > 0 + RECOVER lRet := .F. END @@ -651,17 +648,17 @@ RETURN lRet // checks if this is a node that is always empty and never has HTML text, e.g. ,, METHOD isEmpty CLASS THtmlNode -RETURN ( ( ::htmlTagType[2] & CM_EMPTY ) > 0 ) +RETURN hb_bitAnd( ::htmlTagType[2], CM_EMPTY ) > 0 // checks if this is a node that may occur inline, eg. , METHOD isInline CLASS THtmlNode -RETURN ( ( ::htmlTagType[2] & CM_INLINE ) > 0 ) +RETURN hb_bitAnd( ::htmlTagType[2], CM_INLINE ) > 0 // checks if this is a node that may appear without a closing tag, eg.

,, METHOD isOptional CLASS THtmlNode -RETURN ( ( ::htmlTagType[2] & CM_OPT ) > 0 ) +RETURN hb_bitAnd( ::htmlTagType[2], CM_OPT ) > 0 // checks if this is a node (leafs contain no further nodes, e.g.
,


,_text_) @@ -671,7 +668,7 @@ RETURN ( Valtype( ::htmlContent ) == "A" .AND. Len( ::htmlContent ) > 0 ) // checks if this is a block node that must be closed with an ending tag: eg:
,
    METHOD isBlock CLASS THtmlNode -RETURN ( ( ::htmlTagType[2] & CM_BLOCK ) > 0 ) +RETURN hb_bitAnd( ::htmlTagType[2], CM_BLOCK ) > 0 // checks if this is a node whose text line formatting must be preserved:
    ,