diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4304e0dcef..024997c93d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,21 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-08 00:42 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbtip/Makefile + * contrib/hbtip/thtml.prg + * contrib/hbtip/utils.c + + contrib/hbtip/legacy.prg + * Renamed ATI() to TIP_ATI(). + (Probably we should have a proper, CP-aware HB_ATI() function in core) + * Readded ATI() as legacy function. + % Using :exec() instead of HB_EXEC() local .c function. + + HB_EXEC() moved to legacy status and reimplemented in .prg. + (Thanks Przemek and Petr) + % Minor optimization where TIP_ATI() is only used where + we're looking for alphabetic data. + I'd appreciate if someone could review me, I'm not using this code. + 2009-07-07 18:51 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hbcurl/hbcurl.c ! small fix in const casting @@ -28,7 +43,7 @@ * harbour/contrib/hbxbp/xbpstatic.prg + Implemented :type == XBPSTATIC_TYPE_SYSICON With this XbpStatic() class is 100% Xbase++ compliant plus - Harbour has more goodies to play with, i.e., more sysicons to + Harbour has more goodies to play with, i.e., more sysicons to display ( about 60+ ) instead of only 4 provided in Xbase++. Plus Harbour has implemented to define mouse cursor from any image format. diff --git a/harbour/contrib/hbtip/Makefile b/harbour/contrib/hbtip/Makefile index 98145e5a6a..f558ee77d9 100644 --- a/harbour/contrib/hbtip/Makefile +++ b/harbour/contrib/hbtip/Makefile @@ -25,6 +25,7 @@ PRG_SOURCES= \ ftpcln.prg \ smtpcln.prg \ httpcln.prg \ + legacy.prg \ mail.prg \ cgi.prg \ thtml.prg \ diff --git a/harbour/contrib/hbtip/legacy.prg b/harbour/contrib/hbtip/legacy.prg new file mode 100644 index 0000000000..721b35e24b --- /dev/null +++ b/harbour/contrib/hbtip/legacy.prg @@ -0,0 +1,56 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Legacy hbtip functions + * + * Copyright 2009 {list of individual authors and e-mail addresses} + * www - http://www.harbour-project.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. + * + */ + +FUNCTION ATI( ... ) + RETURN TIP_ATI( ... ) + +FUNCTION HB_EXEC( sSym, ... ) + RETURN iif( hb_PValue( 2 ) == NIL, sSym:exec( ... ), hb_execMsg( sSym, ... ) ) diff --git a/harbour/contrib/hbtip/thtml.prg b/harbour/contrib/hbtip/thtml.prg index a57697ac0b..14fa4e8f05 100644 --- a/harbour/contrib/hbtip/thtml.prg +++ b/harbour/contrib/hbtip/thtml.prg @@ -71,7 +71,8 @@ #xtrans :p_len => \[P_LEN] #xtrans :p_end => \[P_END] -#xtrans P_SEEK( , ) => (:p_end:=:p_pos, :p_pos:=AtI(,:p_str,:p_end+1)) +#xtrans P_SEEK( , ) => (:p_end:=:p_pos, :p_pos:=hb_At(,:p_str,:p_end+1)) +#xtrans P_SEEKI( , ) => (:p_end:=:p_pos, :p_pos:=tip_AtI(,:p_str,:p_end+1)) #xtrans P_PEEK( , ) => (:p_end:=:p_pos,PStrCompi( :p_str, :p_pos, )) #xtrans P_NEXT( ) => (:p_end:=:p_pos, substr(:p_str,++:p_pos,1)) #xtrans P_PREV( ) => (:p_end:=:p_pos, substr(:p_str,--:p_pos,1)) @@ -856,7 +857,7 @@ METHOD parseHtmlFixed( parser ) CLASS THtmlNode IF .NOT. P_PEEK( parser, "/" + ::htmlTagName ) // seek < /endtag> - P_SEEK( parser, "/" + ::htmlTagName ) + P_SEEKI( parser, "/" + ::htmlTagName ) ENDIF // back to "<" @@ -1104,7 +1105,7 @@ METHOD attrToString() CLASS THtmlNode ELSE // attributes are parsed into a Hash BEGIN SEQUENCE WITH {|oErr| Break( oErr )} - aAttr := HB_Exec( ::htmlTagType[1] ) + aAttr := ::htmlTagType[1]:exec() RECOVER // Tag has no attributes aAttr := {} @@ -1326,7 +1327,7 @@ STATIC FUNCTION __ParseAttr( parser ) parser:p_end := parser:p_pos parser:p_pos -- ELSE - P_SEEK( parser, cChr ) + P_SEEKI( parser, cChr ) nEnd := parser:p_pos IF nEnd > 0 @@ -1373,7 +1374,7 @@ METHOD setAttribute( cName, cValue ) CLASS THtmlNode ENDIF BEGIN SEQUENCE WITH {|oErr| Break( oErr )} - aAttr := HB_Exec( ::htmlTagType[1] ) + aAttr := ::htmlTagType[1]:exec() RECOVER // Tag has no attributes aAttr := {} @@ -1641,7 +1642,7 @@ FUNCTION THtmlIsValid( cTagName, cAttrName ) BEGIN SEQUENCE WITH {|oErr| Break( oErr )} aValue := shTagTypes[ cTagName ] IF cAttrName != NIL - aValue := HB_Exec( aValue[1] ) + aValue := aValue[1]:exec() lRet := ( Ascan( aValue, {|a| Lower(a[1]) == Lower( cAttrName ) } ) > 0 ) ENDIF RECOVER diff --git a/harbour/contrib/hbtip/utils.c b/harbour/contrib/hbtip/utils.c index 5f4deb67fb..9819ae7221 100644 --- a/harbour/contrib/hbtip/utils.c +++ b/harbour/contrib/hbtip/utils.c @@ -65,7 +65,6 @@ #include "hbapiitm.h" #include "hbapierr.h" #include "hbapifs.h" -#include "hbvm.h" #include "hbdate.h" #ifdef HB_OS_WIN @@ -763,7 +762,7 @@ static ULONG hb_strAtI( const char * szSub, ULONG ulSubLen, const char * szText, } /* Case insensitive At() function */ -HB_FUNC( ATI ) +HB_FUNC( TIP_ATI ) { PHB_ITEM pSub = hb_param( 1, HB_IT_STRING ); PHB_ITEM pText = hb_param( 2, HB_IT_STRING ); @@ -807,57 +806,34 @@ HB_FUNC( ATI ) } } -HB_FUNC( HB_EXEC ) -{ - if( HB_ISSYMBOL( 1 ) ) - { - BOOL fSend = FALSE; - int iParams = hb_pcount() - 1; - - if( iParams >= 1 ) - { - fSend = iParams > 1 && ! HB_IS_NIL( hb_param( 2, HB_IT_ANY ) ); - iParams--; - } - else - hb_vmPushNil(); - if( fSend ) - hb_vmSend( ( USHORT ) iParams ); - else - hb_vmDo( ( USHORT ) iParams ); - } - else - hb_errRT_BASE_SubstR( EG_ARG, 1099, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); -} - HB_FUNC( TIP_HTMLSPECIALCHARS ) { - const char *cData = hb_parc(1); - int nLen = hb_parclen(1); - char *cRet; + const char *cData = hb_parc( 1 ); + int nLen = hb_parclen( 1 ); + char * cRet; int nPos = 0, nPosRet = 0; BYTE cElem; - if ( ! cData ) + if( ! cData ) { hb_errRT_BASE( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 1, hb_paramError(1) ); return; } - if ( ! nLen ) + if( ! nLen ) { hb_retc_null(); return; } /* Giving maximum final length possible */ - cRet = (char *) hb_xgrab( nLen * 6 +1); + cRet = ( char * ) hb_xgrab( nLen * 6 + 1 ); - while ( nPos < nLen ) + while( nPos < nLen ) { - cElem = ( BYTE )cData[ nPos ]; + cElem = ( BYTE ) cData[ nPos ]; - if ( cElem == '&' ) + if( cElem == '&' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'a'; @@ -865,21 +841,21 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = 'p'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '<' ) + else if( cElem == '<' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'l'; cRet[ nPosRet++ ] = 't'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '>' ) + else if( cElem == '>' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'g'; cRet[ nPosRet++ ] = 't'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '"' ) + else if( cElem == '"' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = 'q'; @@ -888,7 +864,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = 't'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '\'' ) + else if( cElem == '\'' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = '#'; @@ -897,7 +873,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = '9'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '\r' ) + else if( cElem == '\r' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = '#'; @@ -906,7 +882,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = '3'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem == '\n' ) + else if( cElem == '\n' ) { cRet[ nPosRet++ ] = '&'; cRet[ nPosRet++ ] = '#'; @@ -915,7 +891,7 @@ HB_FUNC( TIP_HTMLSPECIALCHARS ) cRet[ nPosRet++ ] = '0'; cRet[ nPosRet++ ] = ';'; } - else if ( cElem >= ' ' ) + else if( cElem >= ' ' ) { cRet[ nPosRet ] = cElem; nPosRet++;