diff --git a/harbour/ChangeLog b/harbour/ChangeLog index bdaabfe818..88c787ae45 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +20000522-10:40 GMT-8 Ron Pinkas + + * source/compiler/hbpcode.c + ! Fixed ambigious else in hb_StrongType() + + * source/pp/pptable.c + ! Fixed STRUCTURE rule to allow nesting of structures. + + * tests/teststru.prg + * Enhanced to demonstrate Structure as element of other structure and self reference capabilities. + 20000523-02:58 GMT+1 Victor Szakats ; Thanks to Jose Lalin for these: @@ -19,7 +30,7 @@ % formatting and clean 20000523-02:06 GMT+1 Victor Szakats - + * makefile.bc * makefile.vc * contrib/hbclip/hbclip.ch @@ -32,13 +43,13 @@ * source/lang/msgsriso.c * source/rtl/Makefile * misc small corrections and fixes. - + * include/hbapi.h * source/rtl/console.c * source/rtl/xsavescr.c ! Fixed memory leak when no __XRESTSCREEN() was called after an __XSAVESCREEN() - + 2000-05-22 18:15 GMT-4 David G. Holm * source/rtl/filesys.c @@ -49,10 +60,10 @@ + Added RSX32 to the list of protected mode DOS compilers that are unable to generate an INT 21h, AX=5E00h call. -20000522-09:40 GMT-8 Ron Pinkas +20000522-10:40 GMT-8 Ron Pinkas * contrib/hbclip.ch - ! Updated to reflect latest sysntax. + ! Updated to reflect latest syntax. * tests/testwarn.ch ! Updated translate segment to reflect latest sysntax. diff --git a/harbour/source/compiler/hbpcode.c b/harbour/source/compiler/hbpcode.c index 3c87a22294..e1cc1fac1a 100644 --- a/harbour/source/compiler/hbpcode.c +++ b/harbour/source/compiler/hbpcode.c @@ -444,10 +444,12 @@ void hb_compStrongType( int iSize ) /*printf( "\nMethod: %s of Class: %s Parameters: %i\n", pSym->szName, pFunc->pStackClasses[ pFunc->iStackClasses - 1 ]->szName, pFunc->pStackFunctions[ pFunc->iStackFunctions - 1 ]->iParamCount );*/ if ( pFunc->pStackFunctions[ pFunc->iStackFunctions - 1 ] == NULL ) + { if ( pSym->szName[0] == '_' ) hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_MESSAGE_NOT_FOUND, &( pSym->szName[1] ), pFunc->pStackClasses[ pFunc->iStackClasses - 1 ]->szName ); else hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_MESSAGE_NOT_FOUND, pSym->szName, pFunc->pStackClasses[ pFunc->iStackClasses - 1 ]->szName ); + } } else { diff --git a/harbour/source/pp/pptable.c b/harbour/source/pp/pptable.c index b412eb757a..1c4924af13 100644 --- a/harbour/source/pp/pptable.c +++ b/harbour/source/pp/pptable.c @@ -389,7 +389,14 @@ static COMMANDS sC___236 = {0,"SET","INDEX TO [ \1A40 [, \1B40]] [\1C20 ADDITIVE static COMMANDS sC___237 = {0,"SET","ORDER TO \1A00 [IN \1B40]","ordSetFocus( \1A00 [, \1B30] )",&sC___236 }; static COMMANDS sC___238 = {0,"SET","ORDER TO TAG \1A40 [IN \1B40]","ordSetFocus( \1A30 [, \1B30] )",&sC___237 }; static COMMANDS sC___239 = {0,"SET","ORDER TO","ordSetFocus(0)",&sC___238 }; -static COMMANDS sC___240 = {0,"STRUCTURE","\1A00 \1B00 AS \1C00 [, \1D00 AS \1E00 ]","STATIC __\1A00 := {|| IF(__\1A00 == NIL, , ) ,hb_structure( \1A20, { \1B20 [, \1D20] } )} ; DECLARE \1A00 \1B00 AS \1C00 [ \1D00 AS \1E00] ; #translate AS NEW \1A00 => AS CLASS \1A00 := ( Eval(__\1A00), hb_Structure( \1A20 ) )",&sC___239 }; +static COMMANDS sC___240 = {0,"STRUCTURE","\1A00 \1B00 \1C20:AS CLASS,AS STRUCTURE,AS STRU,AS ARRAY OF,AS> \1D00 [, \1E00 \1F20:AS CLASS,AS STRUCTURE,AS STRU,AS ARRAY OF,AS> \1G00 ]","STATIC __\1A00 := {|| IF(__\1A00 == NIL, , ) ,hb_structure( \1A20, { \1B20 [, \1E20] } )} ; DECLARE \1A00 \1B00 \1C00 \1D00 [ \1E00 \1F00 \1G00 ] ; #translate AS NEW \1A00 => AS CLASS \1A00 := ( Eval(__\1A00), hb_Structure( \1A20 ) )",&sC___239 }; + +/* +#COMMAND STRUCTURE [, ] => ; + STATIC __ := {|| IF( __ == NIL, , ) , HB_Structure( <"StruName">, { <"Var1"> [, <"VarN">] } )} ;; + DECLARE [ ] ;; + #TRANSLATE AS NEW => AS STRUCTURE := ( Eval( __ ), HB_Structure( <"StruName"> ) ) +*/ static COMMANDS sT___1 = {0,"AS","NEW \1A00","AS CLASS \1A00 := \1A00():New()",NULL }; diff --git a/harbour/tests/teststru.prg b/harbour/tests/teststru.prg index 03115b6f53..bc01c2bfe9 100644 --- a/harbour/tests/teststru.prg +++ b/harbour/tests/teststru.prg @@ -1,16 +1,26 @@ -STRUCTURE MyStruct Var1 As Char, Var2 As Num +STRUCTURE MyStruct Var1 As Char, Var2 As Num, sNext AS Stru MyStruct + +STRUCTURE OtherStruct sNested As Stru MyStruct, sNext AS Structure OtherStruct PROCEDURE MAIN() - LOCAL sTest AS New MyStruct + LOCAL sTest AS New MyStruct, sTest2 As New OtherStruct - sTest:Var1 := 'Working' // No problem here. + sTest:Var1 := 'Working' // No problem here. (Var1 of myStruct is Char) - ? sTest:Var1 // No Problem here. + ? sTest:Var1 // No Problem here. + + sTest:Var1 := 8 // Warning Here as Expected. -> Var1 of MyStruct is Char not Num + + sTest2:sNested:Var1 := 8 // Warning Here Expected -> Var1 of MyStruct is Char not Num + + sTest2:sNested:sNext := 8 // Warning Here Expected -> sNext of MyStruct is MyStruct not Num - sTest:Var1 := 8 // Warning Here as Expected. /* Run TIME ERROR Here */ - sTest:NoSuchVar := "Error" // Warning here as expected. + sTest2:sNested:sNested := 8 // Warning Here Expected -> MyStruct has no sNested Var + + /* Run TIME ERROR Here */ + sTest:NoSuchVar := "Error" // Warning here as expected. -> MyStruct has no NoSuchVar Var. RETURN