Logical equivalence tests added hvm.c
Used in debugtst.prg
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
19990509-21:00 Eddie Runia
|
||||
* hvm.c
|
||||
Logical equivalence tests added ( ==, !=, >, <, >=, <= )
|
||||
* debugtst.c
|
||||
Logical equivalence used. (==) aoMethod down to one-liner !
|
||||
|
||||
19990509-19:30 Eddie Runia
|
||||
* makefile.b16, makefile.b32
|
||||
debug.obj added
|
||||
|
||||
@@ -755,6 +755,9 @@ void Equal( void )
|
||||
PushLogical( i == 0 );
|
||||
}
|
||||
|
||||
else if( IS_LOGICAL( pItem1 ) && IS_LOGICAL( pItem2 ) )
|
||||
PushLogical( PopLogical() == PopLogical() );
|
||||
|
||||
else if( IS_NUMERIC( pItem1 ) && IS_NUMERIC( pItem2 ) )
|
||||
PushLogical( PopDouble() == PopDouble() );
|
||||
|
||||
@@ -854,6 +857,7 @@ void Greater( void )
|
||||
double dNumber1, dNumber2;
|
||||
LONG lDate1, lDate2;
|
||||
int i;
|
||||
int iLogical1, iLogical2;
|
||||
|
||||
if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) )
|
||||
{
|
||||
@@ -877,6 +881,13 @@ void Greater( void )
|
||||
PushLogical( lDate1 > lDate2 );
|
||||
}
|
||||
|
||||
else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) )
|
||||
{
|
||||
iLogical1 = PopLogical();
|
||||
iLogical2 = PopLogical();
|
||||
PushLogical( iLogical1 > iLogical2 );
|
||||
}
|
||||
|
||||
else if( ( stack.pPos - 2 )->wType != ( stack.pPos - 1 )->wType )
|
||||
{
|
||||
printf( "types not match on greater operation\n" );
|
||||
@@ -889,6 +900,7 @@ void GreaterEqual( void )
|
||||
double dNumber1, dNumber2;
|
||||
LONG lDate1, lDate2;
|
||||
int i;
|
||||
int iLogical1, iLogical2;
|
||||
|
||||
if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) )
|
||||
{
|
||||
@@ -912,6 +924,13 @@ void GreaterEqual( void )
|
||||
PushLogical( lDate1 >= lDate2 );
|
||||
}
|
||||
|
||||
else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) )
|
||||
{
|
||||
iLogical1 = PopLogical();
|
||||
iLogical2 = PopLogical();
|
||||
PushLogical( iLogical1 >= iLogical2 );
|
||||
}
|
||||
|
||||
else if( ( stack.pPos - 2 )->wType != ( stack.pPos - 1 )->wType )
|
||||
{
|
||||
printf( "types not match on greaterequal operation\n" );
|
||||
@@ -999,6 +1018,7 @@ void Less( void )
|
||||
double dNumber1, dNumber2;
|
||||
LONG lDate1, lDate2;
|
||||
int i;
|
||||
int iLogical1, iLogical2;
|
||||
|
||||
if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) )
|
||||
{
|
||||
@@ -1022,6 +1042,13 @@ void Less( void )
|
||||
PushLogical( lDate1 < lDate2 );
|
||||
}
|
||||
|
||||
else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) )
|
||||
{
|
||||
iLogical1 = PopLogical();
|
||||
iLogical2 = PopLogical();
|
||||
PushLogical( iLogical1 < iLogical2 );
|
||||
}
|
||||
|
||||
else if( ( stack.pPos - 2 )->wType != ( stack.pPos - 1 )->wType )
|
||||
{
|
||||
printf( "types not match on less operation\n" );
|
||||
@@ -1034,6 +1061,7 @@ void LessEqual( void )
|
||||
double dNumber1, dNumber2;
|
||||
LONG lDate1, lDate2;
|
||||
int i;
|
||||
int iLogical1, iLogical2;
|
||||
|
||||
if( IS_STRING( stack.pPos - 2 ) && IS_STRING( stack.pPos - 1 ) )
|
||||
{
|
||||
@@ -1057,6 +1085,13 @@ void LessEqual( void )
|
||||
PushLogical( lDate1 <= lDate2 );
|
||||
}
|
||||
|
||||
else if( IS_LOGICAL( stack.pPos - 1 ) && IS_LOGICAL( stack.pPos -2 ) )
|
||||
{
|
||||
iLogical1 = PopLogical();
|
||||
iLogical2 = PopLogical();
|
||||
PushLogical( iLogical1 <= iLogical2 );
|
||||
}
|
||||
|
||||
else if( ( stack.pPos - 2 )->wType != ( stack.pPos - 1 )->wType )
|
||||
{
|
||||
printf( "types not match on lessequal operation\n" );
|
||||
@@ -1134,6 +1169,9 @@ void NotEqual( void )
|
||||
else if( IS_NUMERIC( pItem1 ) && IS_NUMERIC( pItem2 ) )
|
||||
PushLogical( PopDouble() != PopDouble() );
|
||||
|
||||
else if( IS_LOGICAL( pItem1 ) && IS_LOGICAL( pItem2 ) )
|
||||
PushLogical( PopLogical() != PopLogical() );
|
||||
|
||||
else if( pItem1->wType != pItem2->wType )
|
||||
{
|
||||
printf( "types not match on equal operation\n" );
|
||||
|
||||
@@ -384,7 +384,7 @@ function aOData( oObject, lDataMethod )
|
||||
|
||||
/* Find position of matching set function in array with all symbols */
|
||||
|
||||
if lFoundDM /* == lDataMethod */ // If found -> DATA
|
||||
if lFoundDM == lDataMethod // If found -> DATA
|
||||
// else METHOD
|
||||
aAdd( aData, aInfo[ n ] )
|
||||
endif
|
||||
@@ -401,20 +401,20 @@ return aData
|
||||
//
|
||||
function aOMethod( oObject )
|
||||
|
||||
// should become return aOData( oObject, .F. )
|
||||
local aInfo := aSort( oObject:ClassSel() )
|
||||
local aData := {}
|
||||
local n := 1
|
||||
local nLen := Len( aInfo )
|
||||
return aOData( oObject, .F. )
|
||||
// local aInfo := aSort( oObject:ClassSel() )
|
||||
// local aData := {}
|
||||
// local n := 1
|
||||
// local nLen := Len( aInfo )
|
||||
|
||||
do while n <= nLen .and. Substr( aInfo[ n ], 1, 1 ) != "_"
|
||||
if Empty( aScan( aInfo, "_" + aInfo[ n ], n + 1 ) )
|
||||
aAdd( aData, aInfo[ n ] )
|
||||
endif
|
||||
n++
|
||||
enddo
|
||||
// do while n <= nLen .and. Substr( aInfo[ n ], 1, 1 ) != "_"
|
||||
// if Empty( aScan( aInfo, "_" + aInfo[ n ], n + 1 ) )
|
||||
// aAdd( aData, aInfo[ n ] )
|
||||
// endif
|
||||
// n++
|
||||
// enddo
|
||||
|
||||
return aData
|
||||
//return aData
|
||||
|
||||
//
|
||||
// <aData> aOGet( <oObject>, [<aExcept>] )
|
||||
|
||||
Reference in New Issue
Block a user