See changelog entry for explanation
This commit is contained in:
@@ -7,6 +7,135 @@
|
||||
For example:
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
Viktor classes.c
|
||||
|
||||
2002-01-30 12:30 UTC+0200 Chen Kedem <niki@actcom.co.il>
|
||||
|
||||
* source/vm/arrayshb.c
|
||||
* HB_AEXPRESSIONS() - The reported error code was 1123
|
||||
(which belong to AADD()), since this function is an Harbour extension
|
||||
it should use error code > 3000. Changed into 9999
|
||||
|
||||
* source/vm/extend.c
|
||||
* source/vm/itemapi.c
|
||||
+ Add EOL to the last line
|
||||
|
||||
* source/vm/macro.c
|
||||
! hb_macroCheckParam() - Wrong error code 1080 is used, changed into 1065
|
||||
|
||||
* source/vm/memvars.c
|
||||
+ Add comment to __MVSAVE(), __MVRESTORE() that error code 2008 is
|
||||
undocumented in 5.2e and 5.3
|
||||
|
||||
2002-01-30 09:30 UTC+0100 Antonio Linares <alinares@fivetech.com>
|
||||
|
||||
Notice: All these changes have been done by Viktor
|
||||
Implemented here with his permission
|
||||
|
||||
* source/rtl/strzero.c
|
||||
* source/rtl/str.c
|
||||
* source/rtl/valtostr.c
|
||||
% Calling hb_retc*_buffer() to speed up things.
|
||||
|
||||
* source/rtl/gete.c
|
||||
% Calling hb_retc*_buffer() to speed up things.
|
||||
% Calling hb_retc( NULL )
|
||||
|
||||
* source/rtl/oldbox.c
|
||||
* source/rtl/mpostolc.c
|
||||
* source/rtl/mlpos.c
|
||||
* source/rtl/mlctopos.c
|
||||
* source/rtl/mlcount.c
|
||||
* source/rtl/memoline.c
|
||||
% "ISCHAR( 1 ) ? hb_parc( 1 ) : """ optimized to
|
||||
plain hb_parc( 1 ) since in Harbour it automatically
|
||||
returns "" when !ISCHAR(1).
|
||||
|
||||
* source/pp/pplib.c
|
||||
* source/rdd/dbcmd.c
|
||||
* source/rtl/colorind.c
|
||||
* source/rtl/datec.c
|
||||
* source/rtl/descend.c
|
||||
* source/rtl/fkmax.c
|
||||
* source/rtl/gete.c
|
||||
* source/rtl/hardcr.c
|
||||
* source/rtl/memofile.c
|
||||
* source/rtl/memoline.c
|
||||
* source/rtl/mtran.c
|
||||
* source/rtl/natmsg.c
|
||||
* source/rtl/net.c
|
||||
* source/rtl/oemansi.c
|
||||
* source/rtl/padc.c
|
||||
* source/rtl/padl.c
|
||||
* source/rtl/padr.c
|
||||
* source/rtl/philes.c
|
||||
* source/rtl/replic.c
|
||||
* source/rtl/right.c
|
||||
* source/rtl/set.c
|
||||
* source/rtl/space.c
|
||||
* source/rtl/str.c
|
||||
* source/rtl/strtran.c
|
||||
* source/rtl/strzero.c
|
||||
* source/rtl/stuff.c
|
||||
* source/rtl/substr.c
|
||||
* source/rtl/transfrm.c
|
||||
* source/rtl/trim.c
|
||||
* source/vm/classes.c
|
||||
* source/vm/cmdarg.c
|
||||
* source/vm/dynsym.c
|
||||
* source/vm/proc.c
|
||||
% hb_retc( "" ) calls optimized to hb_retc( NULL )
|
||||
which will have the same effect, but it will
|
||||
generate a constant string item, instead allocating a
|
||||
memory buffer for the empty string, thus saving a
|
||||
hb_grab() call, some memory, and lessen the memort
|
||||
fragmentation.
|
||||
; Note that CA-Cl*pper will also accept NULL as a
|
||||
parameter for _retc(), and it will be also a bit
|
||||
faster. This fact is undocumented though.
|
||||
|
||||
* source/vm/itemapi.c
|
||||
* include/hbapiitm.h
|
||||
% hb_itemPutC*() functions optimized, so that they
|
||||
will assign a constant buffer when receiving a NULL
|
||||
string and thus storing an empty string ("") to the
|
||||
string item. Callers are encouraged to call this
|
||||
function (and hb_retc(), too) with a NULL instead of
|
||||
"" to allow this optimization for Harbour.
|
||||
+ hb_itemPutCConst() API function added, which can set a
|
||||
string to a const buffer, which doesn't need to be
|
||||
freed, just like if it would point to a string stored in
|
||||
the pcode. The caller must make sure that the buffer is
|
||||
terminated with zero byte.
|
||||
|
||||
* source/vm/extend.c
|
||||
* include/hbapi.h
|
||||
+ hb_retc_buffer()
|
||||
+ hb_retc_const()
|
||||
+ hb_retclen_buffer()
|
||||
Three new functions, which can optimize out some memory
|
||||
allocations/deallocations in frequently called Harbour RTL
|
||||
functions, in this situation:
|
||||
---------------------------
|
||||
char * buffer = hb_xgrab();
|
||||
...
|
||||
hb_retclen( buffer, len );
|
||||
hb_xfree( buffer );
|
||||
---------------------------
|
||||
the above becomes:
|
||||
---------------------------
|
||||
char * buffer = hb_xgrab();
|
||||
...
|
||||
hb_retclen_buffer( buffer, len );
|
||||
---------------------------
|
||||
and one pair of mem function calls is ruled out.
|
||||
|
||||
* source/rtl/ampm.c
|
||||
* source/rtl/descend.c
|
||||
* source/rtl/langapi.c
|
||||
* source/rtl/memofile.c
|
||||
* source/rtl/memoline.c
|
||||
* source/rtl/mouseapi.c
|
||||
* source/rtl/mtran.c
|
||||
* source/rtl/oemansi.c
|
||||
* source/rtl/padc.c
|
||||
|
||||
@@ -158,10 +158,10 @@ HB_FUNC( __PP_PATH )
|
||||
}
|
||||
}
|
||||
if( ISCHAR( 1 ) )
|
||||
{
|
||||
{
|
||||
char * cDelim;
|
||||
char * cPath = hb_parc( 1 );
|
||||
|
||||
|
||||
while( ( cDelim = strchr( cPath, OS_PATH_LIST_SEPARATOR ) ) != NULL )
|
||||
{
|
||||
*cDelim = '\0';
|
||||
@@ -260,14 +260,14 @@ HB_FUNC( __PREPROCESS )
|
||||
/* an error occured during parsing.
|
||||
* The longjmp was used in GenError()
|
||||
*/
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
hb_xfree( pText );
|
||||
hb_xfree( pOut );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 )
|
||||
|
||||
@@ -999,7 +999,7 @@ HB_FUNC( ALIAS )
|
||||
}
|
||||
pAreaNode = pAreaNode->pNext;
|
||||
}
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( DBEVAL )
|
||||
@@ -1078,7 +1078,7 @@ HB_FUNC( DBF )
|
||||
}
|
||||
pAreaNode = pAreaNode->pNext;
|
||||
}
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( BOF )
|
||||
@@ -1370,7 +1370,7 @@ HB_FUNC( DBFILTER )
|
||||
hb_itemRelease( pFilter );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( DBGOBOTTOM )
|
||||
@@ -1811,7 +1811,7 @@ HB_FUNC( DBTABLEEXT )
|
||||
pRddNode = hb_rddFindNode( s_szDefDriver, &uiRddID );
|
||||
if( !pRddNode )
|
||||
{
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
return;
|
||||
}
|
||||
uiSize = sizeof( AREA ); /* Default Size Area */
|
||||
@@ -1832,7 +1832,7 @@ HB_FUNC( DBTABLEEXT )
|
||||
pTempArea->rddID = uiRddID;
|
||||
|
||||
if( SELF_NEW( ( AREAP ) pTempArea ) == FAILURE )
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
else
|
||||
{
|
||||
pItem = hb_itemPutC( NULL, "" );
|
||||
@@ -2043,7 +2043,7 @@ HB_FUNC( FIELDNAME )
|
||||
}
|
||||
hb_errRT_DBCMD( EG_ARG, EDBCMD_FIELDNAME_BADPARAMETER, NULL, "FIELDNAME" );
|
||||
}
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( FIELDPOS )
|
||||
@@ -2184,7 +2184,7 @@ HB_FUNC( ORDBAGEXT )
|
||||
pRddNode = hb_rddFindNode( s_szDefDriver, &uiRddID );
|
||||
if( !pRddNode )
|
||||
{
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
return;
|
||||
}
|
||||
uiSize = sizeof( AREA ); /* Default Size Area */
|
||||
@@ -2205,7 +2205,7 @@ HB_FUNC( ORDBAGEXT )
|
||||
pTempArea->rddID = uiRddID;
|
||||
|
||||
if( SELF_NEW( ( AREAP ) pTempArea ) == FAILURE )
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
else
|
||||
{
|
||||
pInfo.itmResult = hb_itemPutC( NULL, "" );
|
||||
@@ -2660,7 +2660,7 @@ HB_FUNC( RDDNAME )
|
||||
else
|
||||
{
|
||||
hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, "RDDNAME" );
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,9 +94,9 @@ HB_FUNC( HB_COLORINDEX )
|
||||
hb_retclen( pszColor + ulColorPos, ulColorLen );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ HB_FUNC( CDOW )
|
||||
hb_retc( hb_dateCDOW( hb_dateDOW( lYear, lMonth, lDay ) ) );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 1117, NULL, "CDOW", 1, hb_paramError( 1 ) );
|
||||
|
||||
@@ -79,9 +79,9 @@ HB_FUNC( FKLABEL )
|
||||
hb_retc( szName );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
|
||||
@@ -85,6 +85,6 @@ HB_FUNC( HARDCR )
|
||||
hb_itemFreeC( pszBuffer );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ HB_FUNC( NATIONMSG )
|
||||
else if( ISNUM( 1 ) )
|
||||
hb_retc( hb_nationGetMsg( hb_parni( 1 ) ) );
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
/* NOTE: Intentionally using one leading underscore, like in Clipper.
|
||||
|
||||
@@ -95,43 +95,42 @@ HB_FUNC( NETNAME )
|
||||
#if defined(HB_OS_OS2) && defined(__GNUC__)
|
||||
|
||||
{
|
||||
char * pszValue = ( char * ) hb_xgrab( MAXGETHOSTNAME + 1 );
|
||||
pszValue[ 0 ] = '\0';
|
||||
|
||||
gethostname( pszValue, MAXGETHOSTNAME );
|
||||
|
||||
hb_retc( pszValue );
|
||||
hb_xfree( pszValue );
|
||||
char szValue[ MAXGETHOSTNAME + 1 ];
|
||||
szValue[ 0 ] = '\0';
|
||||
|
||||
gethostname( szValue, MAXGETHOSTNAME );
|
||||
|
||||
hb_retc( szValue );
|
||||
}
|
||||
|
||||
#elif defined(HB_OS_DOS)
|
||||
|
||||
#if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__)
|
||||
{
|
||||
char * pszValue = ( char * ) hb_xgrab( MAXGETHOSTNAME + 1 );
|
||||
pszValue[ 0 ] = '\0';
|
||||
|
||||
gethostname( pszValue, MAXGETHOSTNAME );
|
||||
|
||||
hb_retc( pszValue );
|
||||
hb_xfree( pszValue );
|
||||
char szValue[ MAXGETHOSTNAME + 1 ];
|
||||
szValue[ 0 ] = '\0';
|
||||
|
||||
gethostname( szValue, MAXGETHOSTNAME );
|
||||
|
||||
hb_retc( szValue );
|
||||
}
|
||||
#else
|
||||
{
|
||||
char szValue[ 16 ];
|
||||
union REGS regs;
|
||||
|
||||
char szValue[ 16 ];
|
||||
szValue[ 0 ] = '\0';
|
||||
|
||||
regs.HB_XREGS.ax = 0x5E00;
|
||||
|
||||
|
||||
{
|
||||
struct SREGS sregs;
|
||||
|
||||
|
||||
regs.HB_XREGS.dx = FP_OFF( szValue );
|
||||
sregs.ds = FP_SEG( szValue );
|
||||
|
||||
|
||||
HB_DOS_INT86X( 0x21, ®s, ®s, &sregs );
|
||||
}
|
||||
|
||||
|
||||
hb_retc( regs.h.ch == 0 ? "" : szValue );
|
||||
}
|
||||
#endif
|
||||
@@ -140,19 +139,17 @@ HB_FUNC( NETNAME )
|
||||
|
||||
{
|
||||
DWORD ulLen = MAX_COMPUTERNAME_LENGTH + 1;
|
||||
char * pszValue = ( char * ) hb_xgrab( ulLen );
|
||||
char szValue[ MAX_COMPUTERNAME_LENGTH + 1 ];
|
||||
szValue[ 0 ] = '\0';
|
||||
|
||||
pszValue[ 0 ] = '\0';
|
||||
GetComputerName( szValue, &ulLen );
|
||||
|
||||
GetComputerName( pszValue, &ulLen );
|
||||
|
||||
hb_retc( pszValue );
|
||||
hb_xfree( pszValue );
|
||||
hb_retc( szValue );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -73,6 +73,6 @@ HB_FUNC( RIGHT )
|
||||
hb_retclen( hb_itemGetCPtr( pText ) + lTextLen - lLen, lLen );
|
||||
}
|
||||
else
|
||||
hb_retc( "" ); /* Clipper doesn't error */
|
||||
hb_retc( NULL ); /* Clipper doesn't error */
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_ALTFILE :
|
||||
if( hb_set.HB_SET_ALTFILE ) hb_retc( hb_set.HB_SET_ALTFILE );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 && ! HB_IS_NIL( pArg2 ) ) hb_set.HB_SET_ALTFILE = set_string( pArg2, hb_set.HB_SET_ALTFILE );
|
||||
if( args > 2 ) bFlag = set_logical( pArg3 );
|
||||
else bFlag = FALSE;
|
||||
@@ -450,7 +450,7 @@ HB_FUNC( SET )
|
||||
if( hb_set.HB_SET_DATEFORMAT )
|
||||
hb_retc( hb_set.HB_SET_DATEFORMAT );
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
|
||||
if( args > 1 )
|
||||
{
|
||||
@@ -495,7 +495,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_DEFAULT :
|
||||
if( hb_set.HB_SET_DEFAULT ) hb_retc( hb_set.HB_SET_DEFAULT );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 ) hb_set.HB_SET_DEFAULT = set_string( pArg2, hb_set.HB_SET_DEFAULT );
|
||||
break;
|
||||
case HB_SET_DELETED :
|
||||
@@ -504,7 +504,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_DELIMCHARS :
|
||||
if( hb_set.HB_SET_DELIMCHARS ) hb_retc( hb_set.HB_SET_DELIMCHARS );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 ) hb_set.HB_SET_DELIMCHARS = set_string( pArg2, hb_set.HB_SET_DELIMCHARS );
|
||||
break;
|
||||
case HB_SET_DELIMITERS :
|
||||
@@ -513,7 +513,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_DEVICE :
|
||||
if( hb_set.HB_SET_DEVICE ) hb_retc( hb_set.HB_SET_DEVICE );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 && ! HB_IS_NIL( pArg2 ) )
|
||||
{
|
||||
/* If the print file is not already open, open it in overwrite mode. */
|
||||
@@ -559,7 +559,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_EXTRAFILE :
|
||||
if( hb_set.HB_SET_EXTRAFILE ) hb_retc( hb_set.HB_SET_EXTRAFILE );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 && ! HB_IS_NIL( pArg2 ) ) hb_set.HB_SET_EXTRAFILE = set_string( pArg2, hb_set.HB_SET_EXTRAFILE );
|
||||
if( args > 2 ) bFlag = set_logical( pArg3 );
|
||||
else bFlag = FALSE;
|
||||
@@ -618,7 +618,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_MFILEEXT :
|
||||
if( hb_set.HB_SET_MFILEEXT ) hb_retc( hb_set.HB_SET_MFILEEXT );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 ) hb_set.HB_SET_MFILEEXT = set_string( pArg2, hb_set.HB_SET_MFILEEXT );
|
||||
break;
|
||||
case HB_SET_OPTIMIZE :
|
||||
@@ -631,7 +631,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_PATH :
|
||||
if( hb_set.HB_SET_PATH ) hb_retc( hb_set.HB_SET_PATH );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 )
|
||||
{
|
||||
hb_setFreeSetPath();
|
||||
@@ -645,7 +645,7 @@ HB_FUNC( SET )
|
||||
break;
|
||||
case HB_SET_PRINTFILE :
|
||||
if( hb_set.HB_SET_PRINTFILE ) hb_retc( hb_set.HB_SET_PRINTFILE );
|
||||
else hb_retc( "" );
|
||||
else hb_retc( NULL );
|
||||
if( args > 1 && ! HB_IS_NIL( pArg2 ) ) hb_set.HB_SET_PRINTFILE = set_string( pArg2, hb_set.HB_SET_PRINTFILE );
|
||||
if( args > 2 ) bFlag = set_logical( pArg3 );
|
||||
else bFlag = FALSE;
|
||||
|
||||
@@ -101,10 +101,10 @@ HB_FUNC( SUBSTR )
|
||||
if( lLen > 0 )
|
||||
hb_retclen( hb_itemGetCPtr( pText ) + lPos, lLen );
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 1110, NULL, "SUBSTR", 3, hb_paramError( 1 ), hb_paramError( 2 ), hb_paramError( 3 ) );
|
||||
|
||||
@@ -156,7 +156,7 @@ HB_FUNC( ALLTRIM )
|
||||
#ifdef HB_COMPAT_C53
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 2022, NULL, "ALLTRIM", 1, hb_paramError( 1 ) ); /* NOTE: This appeared in CA-Cl*pper 5.3 [vszakats] */
|
||||
#else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -320,16 +320,17 @@ static void hb_clsRelease( PCLASS pClass )
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_clsRelease(%p)", pClass));
|
||||
|
||||
for( uiAt = 0; uiAt < uiLimit; uiAt++, pMeth++ )
|
||||
{
|
||||
{
|
||||
if( pMeth->pInitValue )
|
||||
hb_itemRelease( pMeth->pInitValue );
|
||||
}
|
||||
}
|
||||
|
||||
hb_xfree( pClass->szName );
|
||||
hb_xfree( pClass->pMethods );
|
||||
|
||||
hb_itemRelease( pClass->pClassDatas );
|
||||
hb_itemRelease( pClass->pInlines );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -385,10 +386,10 @@ void hb_clsIsClassRef( void )
|
||||
uiLimit = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
pMeth = pClass->pMethods;
|
||||
for( uiAt = 0; uiAt < uiLimit; uiAt++, pMeth++ )
|
||||
{
|
||||
{
|
||||
if( pMeth->pInitValue )
|
||||
hb_gcItemRef( pMeth->pInitValue );
|
||||
}
|
||||
}
|
||||
|
||||
++pClass;
|
||||
}
|
||||
@@ -671,7 +672,7 @@ char * hb_objGetRealClsName( PHB_ITEM pObject, char * szName )
|
||||
if( ! pObject->item.asArray.value->uiClass )
|
||||
szClassName = "ARRAY";
|
||||
else
|
||||
{
|
||||
{
|
||||
PHB_DYNS pMsg = hb_dynsymFindName( szName );
|
||||
USHORT uiClass;
|
||||
USHORT uiCurCls;
|
||||
@@ -680,50 +681,51 @@ char * hb_objGetRealClsName( PHB_ITEM pObject, char * szName )
|
||||
uiClass = pObject->item.asArray.value->uiClass;
|
||||
|
||||
/* default value to current class object */
|
||||
if( pObject->item.asArray.value->puiClsTree && pObject->item.asArray.value->puiClsTree[0] )
|
||||
{
|
||||
uiClsTree = pObject->item.asArray.value->puiClsTree[0] ;
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
}
|
||||
if (pObject->item.asArray.value->puiClsTree && pObject->item.asArray.value->puiClsTree[0])
|
||||
{
|
||||
uiClsTree = pObject->item.asArray.value->puiClsTree[0] ;
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
uiClsTree = 1; /* Flag value */
|
||||
uiCurCls = uiClass;
|
||||
}
|
||||
|
||||
while (uiClsTree)
|
||||
{
|
||||
if( uiCurCls && uiCurCls <= s_uiClasses )
|
||||
{
|
||||
PCLASS pClass = s_pClasses + ( uiCurCls - 1 );
|
||||
USHORT uiAt = ( USHORT ) ( ( ( hb_cls_MsgToNum( pMsg ) ) % pClass->uiHashKey ) * BUCKET );
|
||||
USHORT uiMask = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
USHORT uiLimit = ( USHORT ) ( uiAt ? ( uiAt - 1 ) : ( uiMask - 1 ) );
|
||||
|
||||
while( uiAt != uiLimit )
|
||||
{
|
||||
if( pClass->pMethods[ uiAt ].pMessage == pMsg )
|
||||
{
|
||||
uiClass = (pClass->pMethods + uiAt)->uiSprClass;
|
||||
uiClsTree=1; /* Flag Value */
|
||||
break;
|
||||
}
|
||||
uiAt++;
|
||||
if( uiAt == uiMask )
|
||||
uiAt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if( --uiClsTree )
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree];
|
||||
}
|
||||
|
||||
if( uiClass && uiClass <= s_uiClasses )
|
||||
szClassName = ( s_pClasses + uiClass - 1 )->szName;
|
||||
else
|
||||
szClassName = "UNKNOWN";
|
||||
while (uiClsTree)
|
||||
{
|
||||
if( uiCurCls && uiCurCls <= s_uiClasses )
|
||||
{
|
||||
PCLASS pClass = s_pClasses + ( uiCurCls - 1 );
|
||||
USHORT uiAt = ( USHORT ) ( ( ( hb_cls_MsgToNum( pMsg ) ) % pClass->uiHashKey ) * BUCKET );
|
||||
USHORT uiMask = ( USHORT ) ( pClass->uiHashKey * BUCKET );
|
||||
USHORT uiLimit = ( USHORT ) ( uiAt ? ( uiAt - 1 ) : ( uiMask - 1 ) );
|
||||
|
||||
}
|
||||
while( uiAt != uiLimit )
|
||||
{
|
||||
if( pClass->pMethods[ uiAt ].pMessage == pMsg )
|
||||
{
|
||||
uiClass = (pClass->pMethods + uiAt)->uiSprClass;
|
||||
uiClsTree=1; /* Flag Value */
|
||||
break;
|
||||
}
|
||||
uiAt++;
|
||||
if( uiAt == uiMask )
|
||||
uiAt = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (-- uiClsTree)
|
||||
uiCurCls = pObject->item.asArray.value->puiClsTree[uiClsTree] ;
|
||||
|
||||
}
|
||||
|
||||
if( uiClass && uiClass <= s_uiClasses )
|
||||
szClassName = ( s_pClasses + uiClass - 1 )->szName;
|
||||
else
|
||||
szClassName = "UNKNOWN";
|
||||
|
||||
}
|
||||
}
|
||||
else /* built in types */
|
||||
{
|
||||
@@ -1477,8 +1479,8 @@ HB_FUNC( __CLSDELMSG )
|
||||
while( pClass->pMethods[ uiAt ].pMessage && uiAt != uiLimit )
|
||||
{
|
||||
hb_xmemcpy( pClass->pMethods + uiAt,
|
||||
pClass->pMethods + ( ( uiAt == uiMask ) ? 0 : uiAt + 1 ),
|
||||
sizeof( METHOD ) );
|
||||
pClass->pMethods + ( ( uiAt == uiMask ) ? 0 : uiAt + 1 ),
|
||||
sizeof( METHOD ) );
|
||||
uiAt++;
|
||||
if( uiAt == uiMask )
|
||||
uiAt = 0;
|
||||
@@ -1529,7 +1531,8 @@ static PHB_ITEM hb_clsInst( USHORT uiClass )
|
||||
|
||||
pSelf->item.asArray.value->uiClass = uiClass;
|
||||
pSelf->item.asArray.value->uiPrevCls = 0;
|
||||
pSelf->item.asArray.value->puiClsTree = NULL;
|
||||
|
||||
pSelf->item.asArray.value->puiClsTree = NULL;
|
||||
|
||||
/* pSelf->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) ); */
|
||||
/* pSelf->item.asArray.value->puiClsTree[0]=0; */
|
||||
@@ -1698,7 +1701,7 @@ HB_FUNC( __OBJGETCLSNAME )
|
||||
if( uiClass <= s_uiClasses )
|
||||
hb_retc( s_pClasses[ uiClass - 1 ].szName );
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1731,15 +1734,15 @@ HB_FUNC( __OBJCLONE )
|
||||
PHB_ITEM pDstObject ;
|
||||
|
||||
if( pSrcObject )
|
||||
{
|
||||
pDstObject = hb_arrayClone( pSrcObject, NULL ) ;
|
||||
{
|
||||
pDstObject= hb_arrayClone( pSrcObject, NULL ) ;
|
||||
|
||||
pDstObject->item.asArray.value->puiClsTree = NULL;
|
||||
/* pDstObject->item.asArray.value->puiClsTree = ( USHORT * ) hb_xgrab( sizeof( USHORT ) ); */
|
||||
/* pDstObject->item.asArray.value->puiClsTree[0]=0; */
|
||||
|
||||
hb_itemRelease( hb_itemReturn( pDstObject ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 3001, NULL, "__OBJCLONE", 0 );
|
||||
}
|
||||
@@ -1764,9 +1767,10 @@ HB_FUNC( __OBJSENDMSG )
|
||||
{
|
||||
USHORT uiParam;
|
||||
|
||||
hb_vmPushSymbol( pMsg->pSymbol ); /* Push char symbol as message */
|
||||
hb_vmPush( pObject ); /* Push object */
|
||||
|
||||
hb_vmMessage( pMsg->pSymbol ); /* Push char symbol as message */
|
||||
|
||||
for( uiParam = 3; uiParam <= uiPCount; uiParam++ ) /* Push arguments on stack */
|
||||
hb_vmPush( hb_param( uiParam, HB_IT_ANY ) );
|
||||
|
||||
@@ -1936,7 +1940,7 @@ HB_FUNC( __CLASSSEL )
|
||||
{
|
||||
PHB_ITEM pItem = hb_itemPutC( NULL, pMessage->pSymbol->szName );
|
||||
/* Add to array */
|
||||
hb_arraySet( pReturn, ++uiPos, pItem );
|
||||
hb_itemArrayPut( pReturn, ++uiPos, pItem );
|
||||
hb_itemRelease( pItem );
|
||||
}
|
||||
}
|
||||
@@ -2164,7 +2168,7 @@ static HARBOUR hb___msgClsSel( void )
|
||||
|
||||
PHB_ITEM pItem = hb_itemPutC( NULL, pMessage->pSymbol->szName );
|
||||
/* Add to array */
|
||||
hb_arraySet( pReturn, ++uiPos, pItem );
|
||||
hb_itemArrayPut( pReturn, ++uiPos, pItem );
|
||||
hb_itemRelease( pItem );
|
||||
}
|
||||
}
|
||||
@@ -2248,7 +2252,7 @@ static HARBOUR hb___msgSuper( void )
|
||||
PHB_ITEM pCopy = hb_itemArrayNew(1);
|
||||
|
||||
/* Now save the Self object as the 1st elem. */
|
||||
hb_arraySet( pCopy, 1 , pObject );
|
||||
hb_itemArrayPut( pCopy, 1 , pObject );
|
||||
|
||||
/* Or Store original object as 1st elem */
|
||||
/* hb_itemCopy( pCopy->item.asArray.value->pItems , pObject) ; */
|
||||
@@ -2256,9 +2260,11 @@ static HARBOUR hb___msgSuper( void )
|
||||
/* And transform it into a fake object */
|
||||
pCopy->item.asArray.value->uiPrevCls = pObject->item.asArray.value->uiClass; /* backup of actual handel */
|
||||
pCopy->item.asArray.value->uiClass = s_pMethod->uiSprClass; /* superclass handel casting */
|
||||
pCopy->item.asArray.value->puiClsTree = NULL;
|
||||
|
||||
hb_itemRelease( hb_itemReturn( pCopy ) );
|
||||
pCopy->item.asArray.value->puiClsTree = 0 ;
|
||||
|
||||
|
||||
hb_itemRelease(hb_itemReturn( pCopy ));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2398,7 +2404,7 @@ HB_FUNC( __CLS_PARAM )
|
||||
for( n = 1; n <= uiParam; n++ )
|
||||
{
|
||||
PHB_ITEM iTmp = hb_itemParam( n );
|
||||
hb_arraySet( array, n, iTmp );
|
||||
hb_itemArrayPut( array, n, iTmp );
|
||||
hb_itemRelease( iTmp );
|
||||
}
|
||||
}
|
||||
@@ -2406,7 +2412,7 @@ HB_FUNC( __CLS_PARAM )
|
||||
{
|
||||
PHB_ITEM iTmp = hb_itemPutC( NULL, (char *) "HBObject" );
|
||||
array = hb_itemArrayNew( 1 );
|
||||
hb_arraySet( array, 1, iTmp );
|
||||
hb_itemArrayPut( array, 1, iTmp );
|
||||
hb_itemRelease( iTmp );
|
||||
}
|
||||
|
||||
@@ -2425,7 +2431,7 @@ HB_FUNC( __CLS_PAR00 )
|
||||
for( n = 1; n <= uiParam; n++ )
|
||||
{
|
||||
PHB_ITEM iTmp = hb_itemParam( n );
|
||||
hb_arraySet( array, n, iTmp );
|
||||
hb_itemArrayPut( array, n, iTmp );
|
||||
hb_itemRelease( iTmp );
|
||||
}
|
||||
|
||||
@@ -2519,4 +2525,5 @@ HB_FUNC( __CLSGETPROPERTIES )
|
||||
}
|
||||
|
||||
hb_itemRelease( hb_itemReturn( pReturn ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ HB_FUNC( HB_ARGSTRING )
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
/* Returns the number of command line arguments passed to the application, this
|
||||
@@ -279,7 +279,7 @@ HB_FUNC( HB_ARGV )
|
||||
hb_retc( ( argc >= 0 && argc < s_argc ) ? s_argv[ argc ] : "" );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
/* Check for command line internal arguments */
|
||||
@@ -311,4 +311,4 @@ void hb_cmdargProcessVM( void )
|
||||
|
||||
if( hb_cmdargCheck( "BUILD" ) )
|
||||
hb_verBuildInfo();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ HB_FUNC( __DYNSGETNAME ) /* Get name of symbol: cSymbol = __dynsymGetName( dsInd
|
||||
if( lIndex >= 1 && lIndex <= s_uiDynSymbols )
|
||||
hb_retc( s_pDynItems[ lIndex - 1 ].pDynSym->pSymbol->szName );
|
||||
else
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( __DYNSGETINDEX ) /* Gimme index number of symbol: dsIndex = __dynsymGetIndex( cSymbol ) */
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
* Special treatment in case of Object and __Eval (only for methodname)
|
||||
* skipping block and adding (b) before the method name
|
||||
*
|
||||
*
|
||||
* See doc/license.txt for licensing terms.
|
||||
*
|
||||
*/
|
||||
@@ -71,13 +70,17 @@
|
||||
#include "hbapi.h"
|
||||
#include "hbstack.h"
|
||||
|
||||
HB_FUNC( METHODNAME )
|
||||
#ifdef HB_EXTENSION
|
||||
|
||||
HB_FUNC( HB_METHODNAME )
|
||||
{
|
||||
char szName[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 2 ];
|
||||
|
||||
hb_retc( hb_procname( hb_parni( 1 ) + 1, szName, TRUE ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
HB_FUNC( PROCNAME )
|
||||
{
|
||||
char szName[ HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 2 ];
|
||||
@@ -106,7 +109,7 @@ HB_FUNC( PROCLINE )
|
||||
|
||||
HB_FUNC( PROCFILE )
|
||||
{
|
||||
hb_retc( "" );
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -114,49 +117,52 @@ HB_FUNC( PROCFILE )
|
||||
/* NOTE: szName size must be an at least:
|
||||
HB_SYMBOL_NAME_LEN + HB_SYMBOL_NAME_LEN + 2 [vszakats] */
|
||||
|
||||
char * hb_procname( int iLevel, char * szName, BOOL bskipBlock )
|
||||
char * hb_procname( int iLevel, char * szName, BOOL bSkipBlock )
|
||||
{
|
||||
PHB_ITEM * pBase = hb_stack.pBase;
|
||||
char * szTstName ;
|
||||
BOOL lcb = FALSE ;
|
||||
char * szTstName;
|
||||
BOOL lcb = FALSE;
|
||||
int iLev = iLevel;
|
||||
|
||||
while( ( iLevel-- > 0 ) && pBase != hb_stack.pItems )
|
||||
pBase = hb_stack.pItems + ( *pBase )->item.asSymbol.stackbase;
|
||||
|
||||
szTstName = ( *pBase )->item.asSymbol.value->szName ;
|
||||
szTstName = ( *pBase )->item.asSymbol.value->szName ;
|
||||
|
||||
if (bskipBlock)
|
||||
if( bSkipBlock )
|
||||
{
|
||||
/* Is it an inline method ? if so back one more ... */
|
||||
if( ( strcmp( szTstName, "__EVAL" ) == 0 ) && pBase != hb_stack.pItems )
|
||||
{
|
||||
/* Is it an inline method ? if so back one more ... */
|
||||
if ( ( strcmp( szTstName, "__EVAL" ) == 0 ) && pBase != hb_stack.pItems)
|
||||
{
|
||||
pBase = hb_stack.pItems + ( *pBase )->item.asSymbol.stackbase;
|
||||
lcb = TRUE ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( iLevel < 0 )
|
||||
{
|
||||
if( ( *( pBase + 1 ) )->type == HB_IT_ARRAY ) /* it is a method name */
|
||||
{
|
||||
strcpy( szName, hb_objGetRealClsName( *( pBase + 1 ), ( *pBase )->item.asSymbol.value->szName ) );
|
||||
if (lcb)
|
||||
strcat( szName, ":(b)" );
|
||||
|
||||
if( lcb )
|
||||
strcat( szName, ":(b)" );
|
||||
else
|
||||
strcat( szName, ":" );
|
||||
strcat( szName, ":" );
|
||||
|
||||
strcat( szName, ( *pBase )->item.asSymbol.value->szName );
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lcb) /* Back to standart code block */
|
||||
{
|
||||
if( lcb ) /* Back to standart code block */
|
||||
{
|
||||
pBase = hb_stack.pBase;
|
||||
while( ( iLev-- > 0 ) && pBase != hb_stack.pItems )
|
||||
pBase = hb_stack.pItems + ( *pBase )->item.asSymbol.stackbase;
|
||||
pBase = hb_stack.pBase;
|
||||
while( ( iLev-- > 0 ) && pBase != hb_stack.pItems )
|
||||
pBase = hb_stack.pItems + ( *pBase )->item.asSymbol.stackbase;
|
||||
}
|
||||
|
||||
strcpy( szName, ( *pBase )->item.asSymbol.value->szName );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
strcpy( szName, "" );
|
||||
|
||||
Reference in New Issue
Block a user