ChangeLog 19990916-17:10 GMT+2

This commit is contained in:
Ryszard Glab
1999-09-16 15:15:13 +00:00
parent 2347fd0344
commit 815b9485cb
9 changed files with 173 additions and 98 deletions

View File

@@ -1,3 +1,23 @@
19990916-17:10 GMT+2 Ryszard Glab <rglab@imid.med.pl>
*source/vm/dynsym.c
*include/extend.h
+ new function HB_DYNS hb_dynsymFindName( char * szName )
that checks if given name is a public symbol - this function
converts given name to uppercase before checking
*source/rtl/itemapi.c
*source/rtl/classes.c
*source/rtl/do.c
*source/vm/hvm.c
* replaced hb_dynsymGet with new hb_dynsymFindName
*source/rdd/dbcmd.c
* replaced hb_dynsymFind with new hb_dynsymFindName
*source/rtl/dir.c
* corrected invalid mask value in HarbourToOsMask()
19990916-14:30 GMT+1 Victor Szel <info@szelvesz.hu>
* makefile.vc
! Fixed version by Matteo Baccan.

View File

@@ -339,6 +339,7 @@ extern ULONG hb_objHasMsg( PHB_ITEM pObject, char *szString );
extern PHB_DYNS hb_dynsymGet( char * szName ); /* finds and creates a dynamic symbol if not found */
extern PHB_DYNS hb_dynsymNew( PHB_SYMB pSymbol ); /* creates a new dynamic symbol based on a local one */
extern PHB_DYNS hb_dynsymFind( char * szName ); /* finds a dynamic symbol */
extern PHB_DYNS hb_dynsymFindName( char * szName ); /* converts to uppercase and finds a dynamic symbol */
extern void hb_dynsymLog( void ); /* displays all dynamic symbols */
extern void hb_dynsymRelease( void ); /* releases the memory of the dynamic symbol table */
extern void hb_dynsymEval( PHB_DYNS_FUNC, void * ); /* enumerates all dynamic symbols */

View File

@@ -539,7 +539,7 @@ static int hb_rddRegister( char * szDriver, USHORT uiType )
szGetFuncTable = ( char * ) hb_xgrab( strlen( szDriver ) + 14 );
strcpy( szGetFuncTable, szDriver );
strcat( szGetFuncTable, "_GETFUNCTABLE" );
pGetFuncTable = hb_dynsymFind( szGetFuncTable );
pGetFuncTable = hb_dynsymFindName( szGetFuncTable );
hb_xfree( szGetFuncTable );
if( !pGetFuncTable )
return 2; /* Not valid RDD */
@@ -580,7 +580,7 @@ static USHORT hb_rddSelect( char * szAlias )
{
PHB_DYNS pSymAlias;
pSymAlias = hb_dynsymFind( szAlias );
pSymAlias = hb_dynsymFindName( szAlias );
if( pSymAlias && pSymAlias->hArea )
return pSymAlias->hArea;
else
@@ -713,17 +713,9 @@ ERRCODE hb_rddSelectWorkAreaSymbol( PHB_SYMB pSymAlias )
ERRCODE hb_rddSelectWorkAreaAlias( char * szName )
{
PHB_DYNS pSymArea;
WORD wLen;
ERRCODE bResult;
/* NOTE: szAlias have to be allocated on the stack because hb_errLaunch
* doesn't return control to this function if QUIT action is requested
*/
char szAlias[ HARBOUR_MAX_RDD_ALIAS_LENGTH ];
wLen = strlen( szName );
hb_strncpyUpper( szAlias, szName, wLen );
pSymArea = hb_dynsymFind( szAlias );
pSymArea = hb_dynsymFindName( szName );
if( pSymArea && pSymArea->hArea )
bResult = hb_rddSelectWorkAreaNumber( pSymArea->hArea );
else
@@ -735,7 +727,7 @@ ERRCODE hb_rddSelectWorkAreaAlias( char * szName )
HB_ITEM_PTR pError;
pError = hb_errRT_New( ES_ERROR, NULL, EG_NOALIAS, 1002,
NULL, szAlias, 0, EF_CANRETRY );
NULL, szName, 0, EF_CANRETRY );
bResult = FAILURE;
while( wAction == E_RETRY )
@@ -743,7 +735,7 @@ ERRCODE hb_rddSelectWorkAreaAlias( char * szName )
wAction = hb_errLaunch( pError );
if( wAction == E_RETRY )
{
pSymArea = hb_dynsymFind( szAlias );
pSymArea = hb_dynsymFindName( szName );
if( pSymArea && pSymArea->hArea )
{
bResult = hb_rddSelectWorkAreaNumber( pSymArea->hArea );
@@ -1263,8 +1255,6 @@ HARBOUR HB_DBSELECTAREA( void )
if( ISCHAR( 1 ) )
{
szAlias = hb_parc( 1 );
hb_strUpper( szAlias, strlen( szAlias ) );
if( ( uiNewArea = hb_rddSelect( szAlias ) ) == 0 )
{
hb_errRT_BASE( EG_NOALIAS, 1002, 0, szAlias );

View File

@@ -306,8 +306,11 @@ PHB_FUNC hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage )
*/
ULONG hb_objHasMsg( PHB_ITEM pObject, char *szString )
{
PHB_SYMB pMessage = hb_dynsymGet( szString )->pSymbol;
return ( ULONG ) hb_objGetMethod( pObject, pMessage );
PHB_DYNS pDynSym = hb_dynsymFindName( szString );
if( pDynSym )
return ( ULONG ) hb_objGetMethod( pObject, pDynSym->pSymbol );
else
return 0;
} /* Get funcptr of message */
@@ -497,45 +500,49 @@ HARBOUR HB___CLSDELMSG( void )
if( wClass && wClass <= s_wClasses && pString )
{
PCLASS pClass = s_pClasses + wClass - 1;
PHB_SYMB pMessage = hb_dynsymGet( pString->item.asString.value )->pSymbol;
PHB_DYNS pMsg = pMessage->pDynSym;
WORD wAt = ( ( ( unsigned ) pMsg ) % pClass->wHashKey ) * BUCKET;
WORD wMask = pClass->wHashKey * BUCKET;
WORD wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 );
while( ( wAt != wLimit ) &&
( pClass->pMethods[ wAt ].pMessage &&
( pClass->pMethods[ wAt ].pMessage != pMsg ) ) )
PHB_DYNS pMsg = hb_dynsymFindName( pString->item.asString.value );
if( pMsg )
{
wAt++;
if( wAt == wMask )
wAt = 0;
}
if( wAt != wLimit )
{ /* Requested method found */
PHB_FUNC pFunc = pClass->pMethods[ wAt ].pFunction;
if( pFunc == hb___msgEvalInline ) /* INLINE method deleted */
PCLASS pClass = s_pClasses + wClass - 1;
WORD wMask = pClass->wHashKey * BUCKET;
PHB_SYMB pMessage = pMsg->pSymbol;
WORD wAt = ( ( ( unsigned ) pMsg ) % pClass->wHashKey ) * BUCKET;
WORD wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 );
while( ( wAt != wLimit ) &&
( pClass->pMethods[ wAt ].pMessage &&
( pClass->pMethods[ wAt ].pMessage != pMsg ) ) )
{
hb_arrayDel( pClass->pInlines, pClass->pMethods[ wAt ].wData );
/* Delete INLINE block */
}
/* Move messages */
while( pClass->pMethods[ wAt ].pMessage && wAt != wLimit )
{
memcpy( pClass->pMethods + wAt,
pClass->pMethods + ( ( wAt == wMask ) ? 0 : wAt + 1 ),
sizeof( METHOD ) );
wAt++;
if( wAt == wMask )
wAt = 0;
}
memset( pClass->pMethods + wAt, 0, sizeof( METHOD ) );
if( wAt != wLimit )
{ /* Requested method found */
PHB_FUNC pFunc = pClass->pMethods[ wAt ].pFunction;
pClass->wMethods--; /* Decrease number messages */
if( pFunc == hb___msgEvalInline ) /* INLINE method deleted */
{
hb_arrayDel( pClass->pInlines, pClass->pMethods[ wAt ].wData );
/* Delete INLINE block */
}
/* Move messages */
while( pClass->pMethods[ wAt ].pMessage && wAt != wLimit )
{
memcpy( pClass->pMethods + wAt,
pClass->pMethods + ( ( wAt == wMask ) ? 0 : wAt + 1 ),
sizeof( METHOD ) );
wAt++;
if( wAt == wMask )
wAt = 0;
}
memset( pClass->pMethods + wAt, 0, sizeof( METHOD ) );
pClass->wMethods--; /* Decrease number messages */
}
}
}
}
@@ -579,41 +586,45 @@ HARBOUR HB___CLSMODMSG( void )
if( wClass && wClass <= s_wClasses && pString )
{
PCLASS pClass = s_pClasses + wClass - 1;
PHB_SYMB pMessage = hb_dynsymGet( pString->item.asString.value )->pSymbol;
PHB_DYNS pMsg = pMessage->pDynSym;
WORD wAt = ( ( ( unsigned ) pMsg ) % pClass->wHashKey ) * BUCKET;
WORD wMask = pClass->wHashKey * BUCKET;
WORD wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 );
PHB_DYNS pMsg = hb_dynsymFindName( pString->item.asString.value );
while( ( wAt != wLimit ) &&
( pClass->pMethods[ wAt ].pMessage &&
( pClass->pMethods[ wAt ].pMessage != pMsg ) ) )
if( pMsg )
{
wAt++;
if( wAt == wMask )
wAt = 0;
}
PCLASS pClass = s_pClasses + wClass - 1;
PHB_SYMB pMessage = pMsg->pSymbol;
WORD wAt = ( ( ( unsigned ) pMsg ) % pClass->wHashKey ) * BUCKET;
WORD wMask = pClass->wHashKey * BUCKET;
WORD wLimit = wAt ? ( wAt - 1 ) : ( wMask - 1 );
if( wAt != wLimit )
{ /* Requested method found */
PHB_FUNC pFunc = pClass->pMethods[ wAt ].pFunction;
if( pFunc == hb___msgEvalInline ) /* INLINE method changed */
while( ( wAt != wLimit ) &&
( pClass->pMethods[ wAt ].pMessage &&
( pClass->pMethods[ wAt ].pMessage != pMsg ) ) )
{
PHB_ITEM pBlock = hb_param( 3, IT_BLOCK );
wAt++;
if( wAt == wMask )
wAt = 0;
}
if( pBlock == NULL )
hb_errRT_BASE( EG_ARG, 3000, NULL, "__CLSMODMSG" );
else
hb_arraySet( pClass->pInlines, pClass->pMethods[ wAt ].wData, pBlock );
if( wAt != wLimit )
{ /* Requested method found */
PHB_FUNC pFunc = pClass->pMethods[ wAt ].pFunction;
if( pFunc == hb___msgEvalInline ) /* INLINE method changed */
{
PHB_ITEM pBlock = hb_param( 3, IT_BLOCK );
if( pBlock == NULL )
hb_errRT_BASE( EG_ARG, 3000, NULL, "__CLSMODMSG" );
else
hb_arraySet( pClass->pInlines, pClass->pMethods[ wAt ].wData, pBlock );
}
else if( ( pFunc == hb___msgSetData ) || ( pFunc == hb___msgGetData ) )
{ /* Not allowed for DATA */
hb_errRT_BASE( EG_ARG, 3004, "Cannot modify a DATA item", "__CLSMODMSG" );
}
else /* Modify METHOD */
pClass->pMethods[ wAt ].pFunction = ( PHB_FUNC ) hb_parnl( 3 );
}
else if( ( pFunc == hb___msgSetData ) || ( pFunc == hb___msgGetData ) )
{ /* Not allowed for DATA */
hb_errRT_BASE( EG_ARG, 3004, "Cannot modify a DATA item", "__CLSMODMSG" );
}
else /* Modify METHOD */
pClass->pMethods[ wAt ].pFunction = ( PHB_FUNC ) hb_parnl( 3 );
}
}
}
@@ -697,14 +708,19 @@ HARBOUR HB___OBJSENDMSG( void )
if( pMessage && pObject ) /* Object & message passed */
{
WORD w;
PHB_DYNS pMsg = hb_dynsymFindName( pMessage->item.asString.value );
hb_vmPush( pObject ); /* Push object */
hb_vmMessage( hb_dynsymGet( pMessage->item.asString.value )->pSymbol );
if( pMsg )
{
WORD w;
hb_vmPush( pObject ); /* Push object */
hb_vmMessage( pMsg->pSymbol );
/* Push char symbol as message */
for( w = 3; w <= hb_pcount(); w++ ) /* Push arguments on stack */
hb_vmPush( hb_param( w, IT_ANY ) );
hb_vmDo( hb_pcount()-2 ); /* Execute message */
for( w = 3; w <= hb_pcount(); w++ ) /* Push arguments on stack */
hb_vmPush( hb_param( w, IT_ANY ) );
hb_vmDo( hb_pcount()-2 ); /* Execute message */
}
}
else
hb_errRT_BASE( EG_ARG, 3000, NULL, "__OBJSENDMSG" );

View File

@@ -242,7 +242,7 @@ static USHORT HarbourToOsMask( USHORT usMask )
usRetMask = 0;
if( usMask & FA_ARCH )
usRetMask = S_ISREG; /* 0x0000 (numbers as in ms impimentation) */
usRetMask = S_IFREG; /* 0x0000 (numbers as in ms impimentation) */
if( usMask & FA_DIREC )
usRetMask |= S_IFDIR; /* 0x3000 */
if( usMask & FA_REPARSE )
@@ -256,9 +256,9 @@ static USHORT HarbourToOsMask( USHORT usMask )
if( usMask & FA_SPARSE ) /* s_issock... */
usRetMask |= S_IFSOCK; /* -not in ms- cygwin=140000 decimal! */
if( usMask & FA_LABEL )
usRetMask |= S_IFLABEL; /* 0x5000 */
usRetMask |= 0; /* TODO: check this: S_IFLABEL; */ /* 0x5000 */
if( usMask & FA_RDONLY )
usRetMask ~= S_IRUSR; /* ??? - want to mask off this bit */
usRetMask &= ~S_IWUSR; /* clear the WRITE permission bit */
#else
#if defined(__IBMCPP__)

View File

@@ -94,7 +94,7 @@ HARBOUR HB_DO( void )
if( IS_STRING( pItem ) )
{
PHB_DYNS pDynSym = hb_dynsymGet( hb_itemGetCPtr( pItem ) );
PHB_DYNS pDynSym = hb_dynsymFindName( hb_itemGetCPtr( pItem ) );
if( pDynSym )
{

View File

@@ -108,7 +108,7 @@ PHB_ITEM hb_evalLaunch( PEVALINFO pEvalInfo )
if( IS_STRING( pEvalInfo->pItems[ 0 ] ) )
{
hb_vmPushSymbol( hb_dynsymGet( hb_itemGetCPtr( pEvalInfo->pItems[ 0 ] ) )->pSymbol );
hb_vmPushSymbol( hb_dynsymFindName( hb_itemGetCPtr( pEvalInfo->pItems[ 0 ] ) )->pSymbol );
hb_vmPushNil();
while( uiParam <= pEvalInfo->paramCount )
hb_vmPush( pEvalInfo->pItems[ uiParam++ ] );
@@ -178,7 +178,7 @@ PHB_ITEM hb_itemDo( PHB_ITEM pItem, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
{
if( IS_STRING( pItem ) )
{
PHB_DYNS pDynSym = hb_dynsymGet( hb_itemGetCPtr( pItem ) );
PHB_DYNS pDynSym = hb_dynsymFindName( hb_itemGetCPtr( pItem ) );
if( pDynSym )
{
@@ -255,7 +255,7 @@ PHB_ITEM hb_itemDoC( char * szFunc, USHORT uiPCount, PHB_ITEM pItemArg1, ... )
if( szFunc )
{
PHB_DYNS pDynSym = hb_dynsymGet( szFunc );
PHB_DYNS pDynSym = hb_dynsymFindName( szFunc );
if( pDynSym )
{

View File

@@ -139,6 +139,24 @@ PHB_DYNS hb_dynsymGet( char * szName ) /* finds and creates a symbol if not fou
return pDynSym;
}
PHB_DYNS hb_dynsymFindName( char * szName ) /* finds a symbol */
{
PHB_DYNS pDynSym;
ULONG ulLen = strlen( szName );
char * szUprName;
szUprName = ( char * ) hb_xgrab( ulLen + 1 );
hb_strncpyUpper( szUprName, szName, ulLen ); /* make a copy as we may get a const string */
/* if( strlen( szUprName ) > 10 )
szUprName[ 10 ] = '\0'; keeps this here for 10 chars /c compatibility mode */
pDynSym = hb_dynsymFind( szUprName );
hb_xfree( szUprName ); /* release memory */
return pDynSym;
}
PHB_DYNS hb_dynsymFind( char * szName )
{
if( s_pDynItems == NULL )

View File

@@ -1843,17 +1843,47 @@ void hb_vmMult( void )
void hb_vmOperatorCall( PHB_ITEM pItem1, PHB_ITEM pItem2, char * szSymbol )
{
hb_vmPush( pItem1 ); /* Push object */
hb_vmMessage( hb_dynsymGet( szSymbol )->pSymbol ); /* Push operation */
hb_vmPush( pItem2 ); /* Push argument */
hb_vmFunction( 1 );
PHB_DYNS pMsg = hb_dynsymFindName( szSymbol );
if( pMsg )
{
hb_vmPush( pItem1 ); /* Push object */
hb_vmMessage( pMsg->pSymbol ); /* Push operation */
hb_vmPush( pItem2 ); /* Push argument */
hb_vmFunction( 1 );
}
else
{
PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, szSymbol );
if( pResult )
{
hb_itemClear( &stack.Return );
hb_itemCopy( stack.pPos, pResult );
hb_stackPush();
hb_itemClear( pResult );
}
}
}
void hb_vmOperatorCallUnary( PHB_ITEM pItem1, char * szSymbol )
{
hb_vmPush( pItem1 ); /* Push object */
hb_vmMessage( hb_dynsymGet( szSymbol )->pSymbol ); /* Push operation */
hb_vmFunction( 0 );
PHB_DYNS pMsg = hb_dynsymFindName( szSymbol );
if( pMsg )
{
hb_vmPush( pItem1 ); /* Push object */
hb_vmMessage( pMsg->pSymbol ); /* Push operation */
hb_vmFunction( 0 );
}
else
{
PHB_ITEM pResult = hb_errRT_BASE_Subst( EG_NOMETHOD, 1004, NULL, szSymbol );
if( pResult )
{
hb_itemClear( &stack.Return );
hb_itemCopy( stack.pPos, pResult );
hb_stackPush();
hb_itemClear( pResult );
}
}
}
void hb_vmOr( void )
@@ -3133,7 +3163,7 @@ void hb_vmRequestCancel( void )
HARBOUR HB___XHELP( void )
{
PHB_DYNS pDynSym = hb_dynsymGet( "HELP" );
PHB_DYNS pDynSym = hb_dynsymFind( "HELP" );
if( pDynSym )
{