diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 04a9e8ee22..0770c53d8b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,21 @@ +20000520-21:30 GMT-8 Ron Pinkas + + * include/hbvmpub.h + + Added: #define HB_FS_FIRST ( ( HB_SYMBOLSCOPE ) 0x40 ) + + * source/compiler/genc.c + + Added logic to add | HB_FS_FIRST to first defined symbol in a prg. + + * source/vm/hvm.c + * Modified hb_vmProcessSymbols() to llok for HB_FS_FIRST for startup procedure instead of any first symbol. + + * source/compiler/harbour.y + * Minor consilidation in AsType + *** I am aware of 6 reduce conflicts resulting from previous removal of FROM_CLASS, and am looking into it. *** + + * tests/testwarn.prg + ! Corrected the #translate to reflect latest syntax + 20000521-00:37 DST Paul Tucker * source/rtl/setkey.c + include "hbgtapi.h" - needed for proper c++ support diff --git a/harbour/include/hbvmpub.h b/harbour/include/hbvmpub.h index deb367407b..4591529523 100644 --- a/harbour/include/hbvmpub.h +++ b/harbour/include/hbvmpub.h @@ -79,6 +79,7 @@ typedef HB_DYNS_FUNC( PHB_DYNS_FUNC ); #define HB_FS_EXIT ( ( HB_SYMBOLSCOPE ) 0x10 ) #define HB_FS_INITEXIT ( HB_FS_INIT | HB_FS_EXIT ) #define HB_FS_MESSAGE ( ( HB_SYMBOLSCOPE ) 0x20 ) +#define HB_FS_FIRST ( ( HB_SYMBOLSCOPE ) 0x40 ) #define HB_FS_MEMVAR ( ( HB_SYMBOLSCOPE ) 0x80 ) extern void hb_vmExecute( const BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the virtual machine */ diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index c75124bff9..886455a5c8 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -153,6 +153,15 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou if( ( pSym->cScope != HB_FS_MESSAGE ) && ( pSym->cScope & HB_FS_MESSAGE ) ) /* only for non public symbols */ fprintf( yyc, " | HB_FS_MESSAGE" ); + if( hb_comp_bStartProc ) + { + if( strcmp( pSym->szName, hb_comp_functions.pFirst->szName ) == 0 ) + fprintf( yyc, " | HB_FS_FIRST" ); + } + else if( hb_comp_functions.pFirst->pNext ) + if( strcmp( pSym->szName, hb_comp_functions.pFirst->pNext->szName ) == 0 ) + fprintf( yyc, " | HB_FS_FIRST" ); + /* specify the function address if it is a defined function or an external called function */ if( hb_compFunctionFind( pSym->szName ) ) /* is it a function defined in this module */ diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 14ec05064d..2cfcdf01f8 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -286,14 +286,7 @@ AsType : /* not specified */ { hb_comp_cVarType = ' '; } | AS_OBJECT { hb_comp_cVarType = 'O'; } | AS_OBJECT IdentName { hb_comp_cVarType = 'S'; hb_comp_szFromClass = $2 } | AS_VARIANT { hb_comp_cVarType = ' '; } - | AS_NUMERIC_ARRAY { hb_comp_cVarType = 'n'; } - | AS_CHARACTER_ARRAY { hb_comp_cVarType = 'c'; } - | AS_DATE_ARRAY { hb_comp_cVarType = 'd'; } - | AS_LOGICAL_ARRAY { hb_comp_cVarType = 'l'; } - | AS_ARRAY_ARRAY { hb_comp_cVarType = 'a'; } - | AS_BLOCK_ARRAY { hb_comp_cVarType = 'b'; } - | AS_OBJECT_ARRAY { hb_comp_cVarType = 'o'; } - | AS_OBJECT_ARRAY IdentName { hb_comp_cVarType = 's'; hb_comp_szFromClass = $2 } + | AsArray ; AsArray : AS_ARRAY { hb_comp_cVarType = 'A'; } @@ -304,6 +297,7 @@ AsArray : AS_ARRAY { hb_comp_cVarType = 'A'; } | AS_ARRAY_ARRAY { hb_comp_cVarType = 'a'; } | AS_BLOCK_ARRAY { hb_comp_cVarType = 'b'; } | AS_OBJECT_ARRAY { hb_comp_cVarType = 'o'; } + | AS_OBJECT_ARRAY IdentName { hb_comp_cVarType = 's'; hb_comp_szFromClass = $2 } ; ParamList : IdentName AsType { hb_compVariableAdd( $1, hb_comp_cVarType ); $$ = 1; } diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 626656a3f7..0e237ca08b 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -2402,7 +2402,7 @@ static void hb_vmArrayPush( void ) { if( pArray->item.asArray.value->uiHolders > 1 ) { - /* this is a temporary copy of an array - we can overwrite + /* this is a temporary copy of an array - we can overwrite * it with no problem */ hb_arrayGet( pArray, ulIndex, pArray ); @@ -4067,7 +4067,7 @@ void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, USHORT uiModuleSymbols ) /* m hSymScope = ( pModuleSymbols + ui )->cScope; pNewSymbols->hScope |= hSymScope; - if( ( ! s_pSymStart ) && ( hSymScope == HB_FS_PUBLIC ) ) + if( ( ! s_pSymStart ) && ( hSymScope & HB_FS_FIRST ) ) s_pSymStart = pModuleSymbols + ui; /* first public defined symbol to start execution */ if( ( hSymScope == HB_FS_PUBLIC ) || ( hSymScope & ( HB_FS_MESSAGE | HB_FS_MEMVAR ) ) ) diff --git a/harbour/tests/testwarn.prg b/harbour/tests/testwarn.prg index b2f29c731f..92214fc887 100644 --- a/harbour/tests/testwarn.prg +++ b/harbour/tests/testwarn.prg @@ -37,16 +37,19 @@ #TRANSLATE AS DATE => #TRANSLATE AS ARRAY => #TRANSLATE AS BLOCK => + + #TRANSLATE AS OBJ => #TRANSLATE AS OBJECT => #TRANSLATE AS BOOL => #TRANSLATE AS BOOLEAN => + #TRANSLATE AS LOG => #TRANSLATE AS LOGICAL => #TRANSLATE AS VAR => #TRANSLATE AS VARIANT => - #COMMAND DECLARE FUNCTION <*x*> => + #COMMAND DECLARE <*x*> => #endif //DECLARE Function nMyFunc AS NUMERIC @@ -70,15 +73,15 @@ DECLARE MyClass ; nMyFunc( nVal As Num ) As Num ; nMyFunc( nVal As Num ) As Num ; cMyData ; - aInstances AS Array Of Object FROM CLASS MyClass ; - oNext( oInstance AS Object FROM CLASS MyClass ) As Object FROM CLASS MyClass + aInstances AS Array Of Object MyClass ; + oNext( oInstance AS Object MyClass ) As Object MyClass DECLARE OtherClass ; nMyFunc( nVal As Num ) As Num ; nMyFunc( nVal As Num ) As Num ; cMyData ; - aInstances AS Array Of Object FROM CLASS MyClass ; - oNext( oInstance AS Object FROM CLASS OtherClass ) As Object FROM CLASS MyClass + aInstances AS Array Of Object MyClass ; + oNext( oInstance AS Object OtherClass ) As Object MyClass FIELD a AS CHAR FIELD b AS CHAR @@ -89,11 +92,11 @@ STATIC lGlobal AS LOGICAL PROCEDURE THEMAIN( optional ) - STATIC lStatic := 0, oMyObj As Object From CLASS WrongClass + STATIC lStatic := 0, oMyObj As Object WrongClass LOCAL cVar AS CHAR := [declare function] - LOCAL a As Char, ob AS Object FROM CLASS MyClass, c AS Char, d AS Object FROM CLASS OtherClass + LOCAL a As Char, ob AS Object MyClass, c AS Char, d AS Object OtherClass FIELD b AS NUM USE TEMP