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.
This commit is contained in:
Viktor Szakats
2007-10-01 22:17:21 +00:00
parent b5d010fbeb
commit 799edeb1e5
21 changed files with 538 additions and 516 deletions

View File

@@ -8,6 +8,44 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
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

View File

@@ -7,7 +7,6 @@ ROOT = ../../
C_SOURCES = \
base64x.c \
encmthd.c \
hbhex2n.c \
utils.c \
PRG_SOURCES= \

View File

@@ -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 )

View File

@@ -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

View File

@@ -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, ", ", "" )

View File

@@ -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 );
}

View File

@@ -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

View File

@@ -1,196 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* xHarbour compatible functions: NUMTOHEX, HEXTONUM, STRTOHEX, HEXTOSTR
*
* Copyright 2007 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://www.harbour-project.org
* Copyright 2003 Giancarlo Niccolai <giancarlo@niccolai.ws>
* 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 );
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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$@

View File

@@ -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)

View File

@@ -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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body>
</body>
</html>
ENDTEXT
cEmptyHtmlDoc := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' + hb_OSNewLine() +;
'<html>' + hb_OSNewLine() +;
' <head>' + hb_OSNewLine() +;
' </head>' + hb_OSNewLine() +;
' <body>' + hb_OSNewLine() +;
' </body>' + hb_OSNewLine() +;
'</html>'
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. <img>,<link>,<meta>
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. <b>,<font>
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. <p>,<tr>,<td>
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. <br>,<hr>,_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: <table></table>, <ul></ul>
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: <pre>,<script>,<textarea>
@@ -764,7 +761,7 @@ METHOD parseHtml( parser ) CLASS THtmlNode
lRewind := .T.
EXIT
DEFAULT
OTHERWISE
IF oThisTag:isOptional()
// this tag has no closing tag
@@ -907,7 +904,7 @@ METHOD insertBefore( oTHtmlNode ) CLASS THtmlNode
ENDIF
IF Valtype( ::parent:htmlContent ) == "A"
AIns( ::parent:htmlContent, 1, oTHtmlNode, .T. )
hb_AIns( ::parent:htmlContent, 1, oTHtmlNode, .T. )
ENDIF
RETURN oTHtmlNode
@@ -932,7 +929,7 @@ METHOD insertAfter( oTHtmlNode ) CLASS THtmlNode
IF nPos > Len( ::parent:htmlContent )
::parent:addNode( oTHtmlNode )
ELSE
AIns( ::parent:htmlContent, nPos, oTHtmlNode, .T. )
hb_AIns( ::parent:htmlContent, nPos, oTHtmlNode, .T. )
ENDIF
RETURN oTHtmlNode
@@ -951,7 +948,7 @@ METHOD delete() CLASS THtmlNode
IF Valtype( ::parent:htmlContent ) == "A"
nPos := AScan( ::parent:htmlContent, self )
ADel( ::parent:htmlContent, nPos, .T. )
hb_ADel( ::parent:htmlContent, nPos, .T. )
ENDIF
::parent := NIL
@@ -1102,14 +1099,14 @@ METHOD attrToString() CLASS THtmlNode
ELSE
// attributes are parsed into a Hash
TRY
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
aAttr := HB_Exec( ::htmlTagType[1] )
CATCH
RECOVER
// Tag has no attributes
aAttr := {}
END
cAttr := ""
HEval( ::htmlAttributes, {|cKey,cValue| cAttr+=__AttrToStr( cKey, cValue, aAttr, self ) } )
hb_HEval( ::htmlAttributes, {|cKey,cValue| cAttr+=__AttrToStr( cKey, cValue, aAttr, self ) } )
ENDIF
RETURN cAttr
@@ -1228,9 +1225,9 @@ METHOD getAttribute( cName ) CLASS THtmlNode
RETURN hHash
ENDIF
TRY
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
cValue := hHash[cName]
CATCH
RECOVER
cValue := NIL
END
RETURN cValue
@@ -1270,7 +1267,7 @@ STATIC FUNCTION __ParseAttr( parser )
LOCAL nStart, nEnd
LOCAL lIsQuoted := .F.
HSetCaseMatch( hHash, .F. )
hb_HSetCaseMatch( hHash, .F. )
DO WHILE .NOT. ( cChr := P_NEXT( parser ) ) == ""
@@ -1347,7 +1344,7 @@ STATIC FUNCTION __ParseAttr( parser )
EXIT
DEFAULT
OTHERWISE
aAttr[nMode] += cChr
END
ENDDO
@@ -1371,9 +1368,9 @@ METHOD setAttribute( cName, cValue ) CLASS THtmlNode
RETURN ::error( "Invalid HTML attribute for: <" + ::htmlTagName + ">", ::className(), cName, EG_ARG, {cName, cValue} )
ENDIF
TRY
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
aAttr := HB_Exec( ::htmlTagType[1] )
CATCH
RECOVER
// Tag has no attributes
aAttr := {}
END
@@ -1403,10 +1400,10 @@ METHOD delAttribute( cName ) CLASS THtmlNode
LOCAL xVal := ::getAttribute( cName )
LOCAL lRet := .F.
IF xVal <> NIL
TRY
HDel( ::htmlAttributes, cName )
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
hb_HDel( ::htmlAttributes, cName )
lRet := .T.
CATCH
RECOVER
lRet := .F.
END
ENDIF
@@ -1422,9 +1419,9 @@ RETURN .T.
// Checks for the existence of an attribute
METHOD isAttribute( cName ) CLASS THtmlNode
LOCAL lRet
TRY
lRet := HHasKey( ::getAttributes(), cName )
CATCH
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
lRet := hb_HHasKey( ::getAttributes(), cName )
RECOVER
lRet := .F.
END
RETURN lRet
@@ -1446,7 +1443,7 @@ METHOD noAttribute( cName, aValue ) CLASS THtmlNode
cName := SubStr( cName, 2 )
ENDIF
IF HHasKey( shTagTypes, cName )
IF hb_HHasKey( shTagTypes, cName )
// message identifies a html tag
oNode := ::findNodeByTagName( cName )
@@ -1460,7 +1457,7 @@ METHOD noAttribute( cName, aValue ) CLASS THtmlNode
RETURN oNode
ELSEIF Right( cName, 1 ) == "s" .AND. HHasKey( shTagTypes, Left(cName, Len(cName)-1) )
ELSEIF Right( cName, 1 ) == "s" .AND. hb_HHasKey( shTagTypes, Left(cName, Len(cName)-1) )
// message is the plural of a html tag -> oNode:forms -> Array of <FORM> tags
RETURN ::findNodesByTagName( Left(cName, Len(cName)-1), Atail(aValue) )
ENDIF
@@ -1544,8 +1541,8 @@ METHOD pushNode( cTagName ) CLASS THtmlNode
RETURN ::error( "Cannot add HTML tag to: <" + ::htmlTagName + ">", ::className(), "+", EG_ARG, {cName} )
ENDIF
IF .NOT. HHasKey( shTagTypes, cName )
IF Left( cName, 1 ) == "/" .AND. HHasKey( shTagTypes, SubStr(cName,2) )
IF .NOT. hb_HHasKey( shTagTypes, cName )
IF Left( cName, 1 ) == "/" .AND. hb_HHasKey( shTagTypes, SubStr(cName,2) )
IF .NOT. Lower( SubStr(cName,2) ) == Lower( ::htmlTagName )
RETURN ::error( "Not a valid closing HTML tag for: <" + ::htmlTagName + ">", ::className(), "-", EG_ARG, {cName} )
ENDIF
@@ -1608,7 +1605,7 @@ FUNCTION THtmlInit( lInit )
_Init_Html_Attributes()
_Init_Html_TagTypes()
slInit := .T.
ENDIF
ENDIF
RETURN .T.
@@ -1622,9 +1619,9 @@ FUNCTION THtmlTagType( cTagName )
THtmlInit()
ENDIF
TRY
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
aType := shTagTypes[ cTagName ]
CATCH
RECOVER
aType := shTagTypes[ "_text_" ]
END
RETURN aType
@@ -1637,13 +1634,13 @@ FUNCTION THtmlIsValid( cTagName, cAttrName )
THtmlInit()
ENDIF
TRY
BEGIN SEQUENCE WITH {|oErr| Break( oErr )}
aValue := shTagTypes[ cTagName ]
IF cAttrName <> NIL
aValue := HB_Exec( aValue[1] )
lRet := ( Ascan( aValue, {|a| Lower(a[1]) == Lower( cAttrName ) } ) > 0 )
ENDIF
CATCH
RECOVER
lRet := .F.
END
RETURN lRet
@@ -1654,130 +1651,130 @@ RETURN lRet
STATIC PROCEDURE _Init_Html_TagTypes
shTagTypes := HB_HSetAutoAdd( {=>}, .T. )
HSetCaseMatch( shTagTypes, .F. )
hb_HSetCaseMatch( shTagTypes, .F. )
shTagTypes[ "_root_" ] := { NIL , (CM_INLINE) }
shTagTypes[ "_text_" ] := { NIL , (CM_INLINE) }
shTagTypes[ "!--" ] := { NIL , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "a" ] := { ( @THtmlAttr_A() ) , (CM_INLINE) }
shTagTypes[ "abbr" ] := { ( @THtmlAttr_ABBR() ) , (CM_INLINE) }
shTagTypes[ "acronym" ] := { ( @THtmlAttr_ACRONYM() ) , (CM_INLINE) }
shTagTypes[ "address" ] := { ( @THtmlAttr_ADDRESS() ) , (CM_BLOCK) }
shTagTypes[ "align" ] := { NIL , (CM_BLOCK) }
shTagTypes[ "applet" ] := { ( @THtmlAttr_APPLET() ) , (CM_OBJECT|CM_IMG|CM_INLINE|CM_PARAM) }
shTagTypes[ "area" ] := { ( @THtmlAttr_AREA() ) , (CM_BLOCK|CM_EMPTY) }
shTagTypes[ "b" ] := { ( @THtmlAttr_B() ) , (CM_INLINE) }
shTagTypes[ "base" ] := { ( @THtmlAttr_BASE() ) , (CM_HEAD|CM_EMPTY) }
shTagTypes[ "basefont" ] := { ( @THtmlAttr_BASEFONT() ) , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "bdo" ] := { ( @THtmlAttr_BDO() ) , (CM_INLINE) }
shTagTypes[ "bgsound" ] := { NIL , (CM_HEAD|CM_EMPTY) }
shTagTypes[ "big" ] := { ( @THtmlAttr_BIG() ) , (CM_INLINE) }
shTagTypes[ "blink" ] := { NIL , (CM_INLINE) }
shTagTypes[ "blockquote" ] := { ( @THtmlAttr_BLOCKQUOTE() ) , (CM_BLOCK) }
shTagTypes[ "body" ] := { ( @THtmlAttr_BODY() ) , (CM_HTML|CM_OPT|CM_OMITST) }
shTagTypes[ "br" ] := { ( @THtmlAttr_BR() ) , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "button" ] := { ( @THtmlAttr_BUTTON() ) , (CM_INLINE) }
shTagTypes[ "caption" ] := { ( @THtmlAttr_CAPTION() ) , (CM_TABLE) }
shTagTypes[ "center" ] := { ( @THtmlAttr_CENTER() ) , (CM_BLOCK) }
shTagTypes[ "cite" ] := { ( @THtmlAttr_CITE() ) , (CM_INLINE) }
shTagTypes[ "code" ] := { ( @THtmlAttr_CODE() ) , (CM_INLINE) }
shTagTypes[ "col" ] := { ( @THtmlAttr_COL() ) , (CM_TABLE|CM_EMPTY) }
shTagTypes[ "colgroup" ] := { ( @THtmlAttr_COLGROUP() ) , (CM_TABLE|CM_OPT) }
shTagTypes[ "comment" ] := { NIL , (CM_INLINE) }
shTagTypes[ "dd" ] := { ( @THtmlAttr_DD() ) , (CM_DEFLIST|CM_OPT|CM_NO_INDENT) }
shTagTypes[ "del" ] := { ( @THtmlAttr_DEL() ) , (CM_INLINE|CM_BLOCK|CM_MIXED) }
shTagTypes[ "dfn" ] := { ( @THtmlAttr_DFN() ) , (CM_INLINE) }
shTagTypes[ "dir" ] := { ( @THtmlAttr_DIR() ) , (CM_BLOCK|CM_OBSOLETE) }
shTagTypes[ "div" ] := { ( @THtmlAttr_DIV() ) , (CM_BLOCK) }
shTagTypes[ "dl" ] := { ( @THtmlAttr_DL() ) , (CM_BLOCK) }
shTagTypes[ "dt" ] := { ( @THtmlAttr_DT() ) , (CM_DEFLIST|CM_OPT|CM_NO_INDENT) }
shTagTypes[ "em" ] := { ( @THtmlAttr_EM() ) , (CM_INLINE) }
shTagTypes[ "embed" ] := { NIL , (CM_INLINE|CM_IMG|CM_EMPTY) }
shTagTypes[ "fieldset" ] := { ( @THtmlAttr_FIELDSET() ) , (CM_BLOCK) }
shTagTypes[ "font" ] := { ( @THtmlAttr_FONT() ) , (CM_INLINE) }
shTagTypes[ "form" ] := { ( @THtmlAttr_FORM() ) , (CM_BLOCK) }
shTagTypes[ "frame" ] := { ( @THtmlAttr_FRAME() ) , (CM_FRAMES|CM_EMPTY) }
shTagTypes[ "frameset" ] := { ( @THtmlAttr_FRAMESET() ) , (CM_HTML|CM_FRAMES) }
shTagTypes[ "h1" ] := { ( @THtmlAttr_H1() ) , (CM_BLOCK|CM_HEADING) }
shTagTypes[ "h2" ] := { ( @THtmlAttr_H2() ) , (CM_BLOCK|CM_HEADING) }
shTagTypes[ "h3" ] := { ( @THtmlAttr_H3() ) , (CM_BLOCK|CM_HEADING) }
shTagTypes[ "h4" ] := { ( @THtmlAttr_H4() ) , (CM_BLOCK|CM_HEADING) }
shTagTypes[ "h5" ] := { ( @THtmlAttr_H5() ) , (CM_BLOCK|CM_HEADING) }
shTagTypes[ "h6" ] := { ( @THtmlAttr_H6() ) , (CM_BLOCK|CM_HEADING) }
shTagTypes[ "head" ] := { ( @THtmlAttr_HEAD() ) , (CM_HTML|CM_OPT|CM_OMITST) }
shTagTypes[ "hr" ] := { ( @THtmlAttr_HR() ) , (CM_BLOCK|CM_EMPTY) }
shTagTypes[ "html" ] := { ( @THtmlAttr_HTML() ) , (CM_HTML|CM_OPT|CM_OMITST) }
shTagTypes[ "i" ] := { ( @THtmlAttr_I() ) , (CM_INLINE) }
shTagTypes[ "iframe" ] := { ( @THtmlAttr_IFRAME() ) , (CM_INLINE) }
shTagTypes[ "ilayer" ] := { NIL , (CM_INLINE) }
shTagTypes[ "img" ] := { ( @THtmlAttr_IMG() ) , (CM_INLINE|CM_IMG|CM_EMPTY) }
shTagTypes[ "input" ] := { ( @THtmlAttr_INPUT() ) , (CM_INLINE|CM_IMG|CM_EMPTY) }
shTagTypes[ "ins" ] := { ( @THtmlAttr_INS() ) , (CM_INLINE|CM_BLOCK|CM_MIXED) }
shTagTypes[ "isindex" ] := { ( @THtmlAttr_ISINDEX() ) , (CM_BLOCK|CM_EMPTY) }
shTagTypes[ "kbd" ] := { ( @THtmlAttr_KBD() ) , (CM_INLINE) }
shTagTypes[ "keygen" ] := { NIL , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "label" ] := { ( @THtmlAttr_LABEL() ) , (CM_INLINE) }
shTagTypes[ "layer" ] := { NIL , (CM_BLOCK) }
shTagTypes[ "legend" ] := { ( @THtmlAttr_LEGEND() ) , (CM_INLINE) }
shTagTypes[ "li" ] := { ( @THtmlAttr_LI() ) , (CM_LIST|CM_OPT|CM_NO_INDENT) }
shTagTypes[ "link" ] := { ( @THtmlAttr_LINK() ) , (CM_HEAD|CM_EMPTY) }
shTagTypes[ "listing" ] := { ( @THtmlAttr_LISTING() ) , (CM_BLOCK|CM_OBSOLETE) }
shTagTypes[ "map" ] := { ( @THtmlAttr_MAP() ) , (CM_INLINE) }
shTagTypes[ "marquee" ] := { NIL , (CM_INLINE|CM_OPT) }
shTagTypes[ "menu" ] := { ( @THtmlAttr_MENU() ) , (CM_BLOCK|CM_OBSOLETE) }
shTagTypes[ "meta" ] := { ( @THtmlAttr_META() ) , (CM_HEAD|CM_EMPTY) }
shTagTypes[ "multicol" ] := { NIL , (CM_BLOCK) }
shTagTypes[ "nextid" ] := { ( @THtmlAttr_NEXTID() ) , (CM_HEAD|CM_EMPTY) }
shTagTypes[ "nobr" ] := { NIL , (CM_INLINE) }
shTagTypes[ "noembed" ] := { NIL , (CM_INLINE) }
shTagTypes[ "noframes" ] := { ( @THtmlAttr_NOFRAMES() ) , (CM_BLOCK|CM_FRAMES) }
shTagTypes[ "nolayer" ] := { NIL , (CM_BLOCK|CM_INLINE|CM_MIXED) }
shTagTypes[ "nosave" ] := { NIL , (CM_BLOCK) }
shTagTypes[ "noscript" ] := { ( @THtmlAttr_NOSCRIPT() ) , (CM_BLOCK|CM_INLINE|CM_MIXED) }
shTagTypes[ "object" ] := { ( @THtmlAttr_OBJECT() ) , (CM_OBJECT|CM_HEAD|CM_IMG|CM_INLINE|CM_PARAM) }
shTagTypes[ "ol" ] := { ( @THtmlAttr_OL() ) , (CM_BLOCK) }
shTagTypes[ "optgroup" ] := { ( @THtmlAttr_OPTGROUP() ) , (CM_FIELD|CM_OPT) }
shTagTypes[ "option" ] := { ( @THtmlAttr_OPTION() ) , (CM_FIELD|CM_OPT) }
shTagTypes[ "p" ] := { ( @THtmlAttr_P() ) , (CM_BLOCK|CM_OPT) }
shTagTypes[ "param" ] := { ( @THtmlAttr_PARAM() ) , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "plaintext" ] := { ( @THtmlAttr_PLAINTEXT() ) , (CM_BLOCK|CM_OBSOLETE) }
shTagTypes[ "pre" ] := { ( @THtmlAttr_PRE() ) , (CM_BLOCK) }
shTagTypes[ "q" ] := { ( @THtmlAttr_Q() ) , (CM_INLINE) }
shTagTypes[ "rb" ] := { ( @THtmlAttr_RB() ) , (CM_INLINE) }
shTagTypes[ "rbc" ] := { ( @THtmlAttr_RBC() ) , (CM_INLINE) }
shTagTypes[ "rp" ] := { ( @THtmlAttr_RP() ) , (CM_INLINE) }
shTagTypes[ "rt" ] := { ( @THtmlAttr_RT() ) , (CM_INLINE) }
shTagTypes[ "rtc" ] := { ( @THtmlAttr_RTC() ) , (CM_INLINE) }
shTagTypes[ "ruby" ] := { ( @THtmlAttr_RUBY() ) , (CM_INLINE) }
shTagTypes[ "s" ] := { ( @THtmlAttr_S() ) , (CM_INLINE) }
shTagTypes[ "samp" ] := { ( @THtmlAttr_SAMP() ) , (CM_INLINE) }
shTagTypes[ "script" ] := { ( @THtmlAttr_SCRIPT() ) , (CM_HEAD|CM_MIXED|CM_BLOCK|CM_INLINE) }
shTagTypes[ "select" ] := { ( @THtmlAttr_SELECT() ) , (CM_INLINE|CM_FIELD) }
shTagTypes[ "server" ] := { NIL , (CM_HEAD|CM_MIXED|CM_BLOCK|CM_INLINE) }
shTagTypes[ "servlet" ] := { NIL , (CM_OBJECT|CM_IMG|CM_INLINE|CM_PARAM) }
shTagTypes[ "small" ] := { ( @THtmlAttr_SMALL() ) , (CM_INLINE) }
shTagTypes[ "spacer" ] := { NIL , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "span" ] := { ( @THtmlAttr_SPAN() ) , (CM_INLINE) }
shTagTypes[ "strike" ] := { ( @THtmlAttr_STRIKE() ) , (CM_INLINE) }
shTagTypes[ "strong" ] := { ( @THtmlAttr_STRONG() ) , (CM_INLINE) }
shTagTypes[ "style" ] := { ( @THtmlAttr_STYLE() ) , (CM_HEAD) }
shTagTypes[ "sub" ] := { ( @THtmlAttr_SUB() ) , (CM_INLINE) }
shTagTypes[ "sup" ] := { ( @THtmlAttr_SUP() ) , (CM_INLINE) }
shTagTypes[ "table" ] := { ( @THtmlAttr_TABLE() ) , (CM_BLOCK) }
shTagTypes[ "tbody" ] := { ( @THtmlAttr_TBODY() ) , (CM_TABLE|CM_ROWGRP|CM_OPT) }
shTagTypes[ "td" ] := { ( @THtmlAttr_TD() ) , (CM_ROW|CM_OPT|CM_NO_INDENT) }
shTagTypes[ "textarea" ] := { ( @THtmlAttr_TEXTAREA() ) , (CM_INLINE|CM_FIELD) }
shTagTypes[ "tfoot" ] := { ( @THtmlAttr_TFOOT() ) , (CM_TABLE|CM_ROWGRP|CM_OPT) }
shTagTypes[ "th" ] := { ( @THtmlAttr_TH() ) , (CM_ROW|CM_OPT|CM_NO_INDENT) }
shTagTypes[ "thead" ] := { ( @THtmlAttr_THEAD() ) , (CM_TABLE|CM_ROWGRP|CM_OPT) }
shTagTypes[ "title" ] := { ( @THtmlAttr_TITLE() ) , (CM_HEAD) }
shTagTypes[ "tr" ] := { ( @THtmlAttr_TR() ) , (CM_TABLE|CM_OPT) }
shTagTypes[ "tt" ] := { ( @THtmlAttr_TT() ) , (CM_INLINE) }
shTagTypes[ "u" ] := { ( @THtmlAttr_U() ) , (CM_INLINE) }
shTagTypes[ "ul" ] := { ( @THtmlAttr_UL() ) , (CM_BLOCK) }
shTagTypes[ "var" ] := { ( @THtmlAttr_VAR() ) , (CM_INLINE) }
shTagTypes[ "wbr" ] := { NIL , (CM_INLINE|CM_EMPTY) }
shTagTypes[ "xmp" ] := { ( @THtmlAttr_XMP() ) , (CM_BLOCK|CM_OBSOLETE) }
shTagTypes[ "_root_" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "_text_" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "!--" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "a" ] := { ( @THtmlAttr_A() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "abbr" ] := { ( @THtmlAttr_ABBR() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "acronym" ] := { ( @THtmlAttr_ACRONYM() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "address" ] := { ( @THtmlAttr_ADDRESS() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "align" ] := { NIL , hb_bitOr(CM_BLOCK) }
shTagTypes[ "applet" ] := { ( @THtmlAttr_APPLET() ) , hb_bitOr(CM_OBJECT, CM_IMG, CM_INLINE, CM_PARAM) }
shTagTypes[ "area" ] := { ( @THtmlAttr_AREA() ) , hb_bitOr(CM_BLOCK, CM_EMPTY) }
shTagTypes[ "b" ] := { ( @THtmlAttr_B() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "base" ] := { ( @THtmlAttr_BASE() ) , hb_bitOr(CM_HEAD, CM_EMPTY) }
shTagTypes[ "basefont" ] := { ( @THtmlAttr_BASEFONT() ) , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "bdo" ] := { ( @THtmlAttr_BDO() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "bgsound" ] := { NIL , hb_bitOr(CM_HEAD, CM_EMPTY) }
shTagTypes[ "big" ] := { ( @THtmlAttr_BIG() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "blink" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "blockquote" ] := { ( @THtmlAttr_BLOCKQUOTE() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "body" ] := { ( @THtmlAttr_BODY() ) , hb_bitOr(CM_HTML, CM_OPT, CM_OMITST) }
shTagTypes[ "br" ] := { ( @THtmlAttr_BR() ) , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "button" ] := { ( @THtmlAttr_BUTTON() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "caption" ] := { ( @THtmlAttr_CAPTION() ) , hb_bitOr(CM_TABLE) }
shTagTypes[ "center" ] := { ( @THtmlAttr_CENTER() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "cite" ] := { ( @THtmlAttr_CITE() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "code" ] := { ( @THtmlAttr_CODE() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "col" ] := { ( @THtmlAttr_COL() ) , hb_bitOr(CM_TABLE, CM_EMPTY) }
shTagTypes[ "colgroup" ] := { ( @THtmlAttr_COLGROUP() ) , hb_bitOr(CM_TABLE, CM_OPT) }
shTagTypes[ "comment" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "dd" ] := { ( @THtmlAttr_DD() ) , hb_bitOr(CM_DEFLIST, CM_OPT, CM_NO_INDENT) }
shTagTypes[ "del" ] := { ( @THtmlAttr_DEL() ) , hb_bitOr(CM_INLINE, CM_BLOCK, CM_MIXED) }
shTagTypes[ "dfn" ] := { ( @THtmlAttr_DFN() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "dir" ] := { ( @THtmlAttr_DIR() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) }
shTagTypes[ "div" ] := { ( @THtmlAttr_DIV() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "dl" ] := { ( @THtmlAttr_DL() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "dt" ] := { ( @THtmlAttr_DT() ) , hb_bitOr(CM_DEFLIST, CM_OPT, CM_NO_INDENT) }
shTagTypes[ "em" ] := { ( @THtmlAttr_EM() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "embed" ] := { NIL , hb_bitOr(CM_INLINE, CM_IMG, CM_EMPTY) }
shTagTypes[ "fieldset" ] := { ( @THtmlAttr_FIELDSET() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "font" ] := { ( @THtmlAttr_FONT() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "form" ] := { ( @THtmlAttr_FORM() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "frame" ] := { ( @THtmlAttr_FRAME() ) , hb_bitOr(CM_FRAMES, CM_EMPTY) }
shTagTypes[ "frameset" ] := { ( @THtmlAttr_FRAMESET() ) , hb_bitOr(CM_HTML, CM_FRAMES) }
shTagTypes[ "h1" ] := { ( @THtmlAttr_H1() ) , hb_bitOr(CM_BLOCK, CM_HEADING) }
shTagTypes[ "h2" ] := { ( @THtmlAttr_H2() ) , hb_bitOr(CM_BLOCK, CM_HEADING) }
shTagTypes[ "h3" ] := { ( @THtmlAttr_H3() ) , hb_bitOr(CM_BLOCK, CM_HEADING) }
shTagTypes[ "h4" ] := { ( @THtmlAttr_H4() ) , hb_bitOr(CM_BLOCK, CM_HEADING) }
shTagTypes[ "h5" ] := { ( @THtmlAttr_H5() ) , hb_bitOr(CM_BLOCK, CM_HEADING) }
shTagTypes[ "h6" ] := { ( @THtmlAttr_H6() ) , hb_bitOr(CM_BLOCK, CM_HEADING) }
shTagTypes[ "head" ] := { ( @THtmlAttr_HEAD() ) , hb_bitOr(CM_HTML, CM_OPT, CM_OMITST) }
shTagTypes[ "hr" ] := { ( @THtmlAttr_HR() ) , hb_bitOr(CM_BLOCK, CM_EMPTY) }
shTagTypes[ "html" ] := { ( @THtmlAttr_HTML() ) , hb_bitOr(CM_HTML, CM_OPT, CM_OMITST) }
shTagTypes[ "i" ] := { ( @THtmlAttr_I() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "iframe" ] := { ( @THtmlAttr_IFRAME() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "ilayer" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "img" ] := { ( @THtmlAttr_IMG() ) , hb_bitOr(CM_INLINE, CM_IMG, CM_EMPTY) }
shTagTypes[ "input" ] := { ( @THtmlAttr_INPUT() ) , hb_bitOr(CM_INLINE, CM_IMG, CM_EMPTY) }
shTagTypes[ "ins" ] := { ( @THtmlAttr_INS() ) , hb_bitOr(CM_INLINE, CM_BLOCK, CM_MIXED) }
shTagTypes[ "isindex" ] := { ( @THtmlAttr_ISINDEX() ) , hb_bitOr(CM_BLOCK, CM_EMPTY) }
shTagTypes[ "kbd" ] := { ( @THtmlAttr_KBD() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "keygen" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "label" ] := { ( @THtmlAttr_LABEL() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "layer" ] := { NIL , hb_bitOr(CM_BLOCK) }
shTagTypes[ "legend" ] := { ( @THtmlAttr_LEGEND() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "li" ] := { ( @THtmlAttr_LI() ) , hb_bitOr(CM_LIST, CM_OPT, CM_NO_INDENT) }
shTagTypes[ "link" ] := { ( @THtmlAttr_LINK() ) , hb_bitOr(CM_HEAD, CM_EMPTY) }
shTagTypes[ "listing" ] := { ( @THtmlAttr_LISTING() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) }
shTagTypes[ "map" ] := { ( @THtmlAttr_MAP() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "marquee" ] := { NIL , hb_bitOr(CM_INLINE, CM_OPT) }
shTagTypes[ "menu" ] := { ( @THtmlAttr_MENU() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) }
shTagTypes[ "meta" ] := { ( @THtmlAttr_META() ) , hb_bitOr(CM_HEAD, CM_EMPTY) }
shTagTypes[ "multicol" ] := { NIL , hb_bitOr(CM_BLOCK) }
shTagTypes[ "nextid" ] := { ( @THtmlAttr_NEXTID() ) , hb_bitOr(CM_HEAD, CM_EMPTY) }
shTagTypes[ "nobr" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "noembed" ] := { NIL , hb_bitOr(CM_INLINE) }
shTagTypes[ "noframes" ] := { ( @THtmlAttr_NOFRAMES() ) , hb_bitOr(CM_BLOCK, CM_FRAMES) }
shTagTypes[ "nolayer" ] := { NIL , hb_bitOr(CM_BLOCK, CM_INLINE, CM_MIXED) }
shTagTypes[ "nosave" ] := { NIL , hb_bitOr(CM_BLOCK) }
shTagTypes[ "noscript" ] := { ( @THtmlAttr_NOSCRIPT() ) , hb_bitOr(CM_BLOCK, CM_INLINE, CM_MIXED) }
shTagTypes[ "object" ] := { ( @THtmlAttr_OBJECT() ) , hb_bitOr(CM_OBJECT, CM_HEAD, CM_IMG, CM_INLINE, CM_PARAM) }
shTagTypes[ "ol" ] := { ( @THtmlAttr_OL() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "optgroup" ] := { ( @THtmlAttr_OPTGROUP() ) , hb_bitOr(CM_FIELD, CM_OPT) }
shTagTypes[ "option" ] := { ( @THtmlAttr_OPTION() ) , hb_bitOr(CM_FIELD, CM_OPT) }
shTagTypes[ "p" ] := { ( @THtmlAttr_P() ) , hb_bitOr(CM_BLOCK, CM_OPT) }
shTagTypes[ "param" ] := { ( @THtmlAttr_PARAM() ) , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "plaintext" ] := { ( @THtmlAttr_PLAINTEXT() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) }
shTagTypes[ "pre" ] := { ( @THtmlAttr_PRE() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "q" ] := { ( @THtmlAttr_Q() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "rb" ] := { ( @THtmlAttr_RB() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "rbc" ] := { ( @THtmlAttr_RBC() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "rp" ] := { ( @THtmlAttr_RP() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "rt" ] := { ( @THtmlAttr_RT() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "rtc" ] := { ( @THtmlAttr_RTC() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "ruby" ] := { ( @THtmlAttr_RUBY() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "s" ] := { ( @THtmlAttr_S() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "samp" ] := { ( @THtmlAttr_SAMP() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "script" ] := { ( @THtmlAttr_SCRIPT() ) , hb_bitOr(CM_HEAD, CM_MIXED, CM_BLOCK, CM_INLINE) }
shTagTypes[ "select" ] := { ( @THtmlAttr_SELECT() ) , hb_bitOr(CM_INLINE, CM_FIELD) }
shTagTypes[ "server" ] := { NIL , hb_bitOr(CM_HEAD, CM_MIXED, CM_BLOCK, CM_INLINE) }
shTagTypes[ "servlet" ] := { NIL , hb_bitOr(CM_OBJECT, CM_IMG, CM_INLINE, CM_PARAM) }
shTagTypes[ "small" ] := { ( @THtmlAttr_SMALL() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "spacer" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "span" ] := { ( @THtmlAttr_SPAN() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "strike" ] := { ( @THtmlAttr_STRIKE() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "strong" ] := { ( @THtmlAttr_STRONG() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "style" ] := { ( @THtmlAttr_STYLE() ) , hb_bitOr(CM_HEAD) }
shTagTypes[ "sub" ] := { ( @THtmlAttr_SUB() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "sup" ] := { ( @THtmlAttr_SUP() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "table" ] := { ( @THtmlAttr_TABLE() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "tbody" ] := { ( @THtmlAttr_TBODY() ) , hb_bitOr(CM_TABLE, CM_ROWGRP, CM_OPT) }
shTagTypes[ "td" ] := { ( @THtmlAttr_TD() ) , hb_bitOr(CM_ROW, CM_OPT, CM_NO_INDENT) }
shTagTypes[ "textarea" ] := { ( @THtmlAttr_TEXTAREA() ) , hb_bitOr(CM_INLINE, CM_FIELD) }
shTagTypes[ "tfoot" ] := { ( @THtmlAttr_TFOOT() ) , hb_bitOr(CM_TABLE, CM_ROWGRP, CM_OPT) }
shTagTypes[ "th" ] := { ( @THtmlAttr_TH() ) , hb_bitOr(CM_ROW, CM_OPT, CM_NO_INDENT) }
shTagTypes[ "thead" ] := { ( @THtmlAttr_THEAD() ) , hb_bitOr(CM_TABLE, CM_ROWGRP, CM_OPT) }
shTagTypes[ "title" ] := { ( @THtmlAttr_TITLE() ) , hb_bitOr(CM_HEAD) }
shTagTypes[ "tr" ] := { ( @THtmlAttr_TR() ) , hb_bitOr(CM_TABLE, CM_OPT) }
shTagTypes[ "tt" ] := { ( @THtmlAttr_TT() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "u" ] := { ( @THtmlAttr_U() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "ul" ] := { ( @THtmlAttr_UL() ) , hb_bitOr(CM_BLOCK) }
shTagTypes[ "var" ] := { ( @THtmlAttr_VAR() ) , hb_bitOr(CM_INLINE) }
shTagTypes[ "wbr" ] := { NIL , hb_bitOr(CM_INLINE, CM_EMPTY) }
shTagTypes[ "xmp" ] := { ( @THtmlAttr_XMP() ) , hb_bitOr(CM_BLOCK, CM_OBSOLETE) }
RETURN

View File

@@ -1,3 +1,7 @@
/*
* $Id$
*/
/**********************************************
* tip.ch
*
@@ -5,7 +9,6 @@
* Base definitions
*
* (C) 2002 Giancarlo Niccolai
* $Id$
************************************************/
#ifndef TIP_H

View File

@@ -51,7 +51,6 @@
*
*/
#include "hbcompat.ch"
#include "hbclass.ch"
/*
@@ -150,7 +149,7 @@ METHOD BuildAddress() CLASS tURL
::cProto := Lower( ::cProto )
ENDIF
IF .not. Empty( ::cProto ) .and. .not. Empty( ::cServer )
IF ! Empty( ::cProto ) .and. ! Empty( ::cServer )
cRet := ::cProto + "://"
ENDIF
@@ -174,7 +173,7 @@ METHOD BuildAddress() CLASS tURL
ENDIF
cRet += ::cPath + ::cFile
IF .not. Empty( ::cQuery )
IF ! Empty( ::cQuery )
cRet += "?" + ::cQuery
ENDIF
@@ -194,7 +193,7 @@ METHOD BuildQuery( ) CLASS tURL
ENDIF
cLine := ::cPath + ::cFile
IF .not. Empty( ::cQuery )
IF ! Empty( ::cQuery )
cLine += "?" + ::cQuery
ENDIF
@@ -205,13 +204,13 @@ METHOD AddGetForm( cPostData )
IF HB_IsHash( cPostData )
FOR nI := 1 TO Len( cPostData )
cTmp := HGetKeyAt( cPostData, nI )
cTmp := CStr( cTmp )
cTmp := hb_HGetKeyAt( cPostData, nI )
cTmp := hb_cStr( cTmp )
cTmp := AllTrim( cTmp )
cTmp := TipEncoderUrl_Encode( cTmp )
cData += cTmp +"="
cTmp := HGetValueAt( cPostData, nI )
cTmp := CStr( cTmp )
cTmp := hb_HGetValueAt( cPostData, nI )
cTmp := hb_cStr( cTmp )
cTmp := AllTrim( cTmp )
cTmp := TipEncoderUrl_Encode( cTmp )
cData += cTmp + "&"
@@ -221,12 +220,12 @@ METHOD AddGetForm( cPostData )
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 := AllTrim( cTmp )
cTmp := TipEncoderUrl_Encode( cTmp )
cData += cTmp

View File

@@ -215,9 +215,8 @@
#xtranslate INETDGRAMSEND([<x,...>]) => hb_INETDGRAMSEND(<x>)
#xtranslate INETDGRAMRECV([<x,...>]) => hb_INETDGRAMRECV(<x>)
#xtranslate INETCRLF([<x,...>]) => hb_INETCRLF(<x>)
#xtranslate ISINETSOCKET([<x,...>]) => HB_ISINETSOCKET(<x>)
#xtranslate INETDESTROY([<x,...>]) => IIF( HB_ISINETSOCKET( <x> ), ;
hb_INETCLOSE( <x> ), )
#xtranslate ISINETSOCKET([<x,...>]) => HB_INETISSOCKET(<x>)
#xtranslate INETDESTROY([<x,...>]) => IIF( HB_INETISSOCKET( <x> ), hb_INETCLOSE( <x> ), )
/* THROW => generate error */
#xtranslate THROW(<oErr>) => (Eval(ErrorBlock(), <oErr>), Break(<oErr>))

View File

@@ -174,7 +174,7 @@ HB_FUNC_EXTERN( HB_INETDGRAM );
HB_FUNC_EXTERN( HB_INETDGRAMSEND );
HB_FUNC_EXTERN( HB_INETDGRAMRECV );
HB_FUNC_EXTERN( HB_INETCRLF );
HB_FUNC_EXTERN( HB_ISINETSOCKET );
HB_FUNC_EXTERN( HB_INETISSOCKET );
HB_FUNC( INETINIT ) { HB_FUNC_EXEC( HB_INETINIT ); }
HB_FUNC( INETCLEANUP ) { HB_FUNC_EXEC( HB_INETCLEANUP ); }
@@ -215,7 +215,7 @@ HB_FUNC( INETDGRAM ) { HB_FUNC_EXEC( HB_INETDGRAM ); }
HB_FUNC( INETDGRAMSEND ) { HB_FUNC_EXEC( HB_INETDGRAMSEND ); }
HB_FUNC( INETDGRAMRECV ) { HB_FUNC_EXEC( HB_INETDGRAMRECV ); }
HB_FUNC( INETCRLF ) { HB_FUNC_EXEC( HB_INETCRLF ); }
HB_FUNC( ISINETSOCKET ) { HB_FUNC_EXEC( HB_ISINETSOCKET ); }
HB_FUNC( ISINETSOCKET ) { HB_FUNC_EXEC( HB_INETISSOCKET ); }
HB_FUNC( INETDESTROY ) { }
#endif /* !HB_NO_DEFAULT_INET */

View File

@@ -1120,7 +1120,7 @@ EXTERNAL HB_INETDGRAM
EXTERNAL HB_INETDGRAMSEND
EXTERNAL HB_INETDGRAMRECV
EXTERNAL HB_INETCRLF
EXTERNAL HB_ISINETSOCKET
EXTERNAL HB_INETISSOCKET
#endif /* __PLATFORM__DOS */
#endif /* HB_EXTENSION */

View File

@@ -1981,7 +1981,7 @@ HB_FUNC( HB_INETCRLF )
hb_retc( "\r\n" );
}
HB_FUNC( HB_ISINETSOCKET )
HB_FUNC( HB_INETISSOCKET )
{
hb_retl( HB_PARSOCKET( 1 ) != NULL );
}