From 0fae2fdd2ce993f00eb568d28c45a201a65ffcfc Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sat, 7 Oct 2006 02:35:52 +0000 Subject: [PATCH] 2006-10-07 04:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbclass.ch + added validation for class data names. As additional preprocessor rule to not use * harbour/include/hboo.ch * harbour/source/rtl/tclass.prg * harbour/source/vm/classes.c + added delegate messages * harbour/include/hbstack.h * harbour/source/vm/arrays.c * harbour/source/vm/estack.c * harbour/source/vm/hvm.c * harbour/source/vm/proc.c + added startup symbol to hb_stack. It gives very good stop condition for all procedures which trace stack calls and resolves the problem with hb_stack.pBase which was never pointing to valid function/procedure symbol when no symbol was put on HVM stack. Now after hb_stackInit() the first item is allocated for "hb_stackInit()" symbol so hb_stack.pBase is always a pointer to valid function/procedure symbol. * changed the guard condition for buggy code in hb_stackPop() and similar code from: hb_stack.pPos < hb_stack.pItems to: hb_stack.pPos <= hb_stack.pBase The old condition was generating usable error message only in the startup function. In deeply called functions it was only waste of CPU time on one of the most often call functions. Before it was activated internal stack structures were corrupted. If we were leaving for many years without really working stack underflow protection then maybe we should think about disabling it at when HB_STACK_MACROS are used and keep it only in real stack functions for HVM developers. Single protection in hb_stackOldFrame() I've just added is enough for basic C code validation. I created the second version of stack macros without it in hbstack.h but I would like to hear other developers opinion. --- harbour/ChangeLog | 40 +++++++++++++++++++ harbour/include/hbclass.ch | 21 ++++++++-- harbour/include/hboo.ch | 1 + harbour/include/hbstack.h | 53 ++++++++++++++++++------- harbour/source/rtl/tclass.prg | 55 ++++++++++++++++--------- harbour/source/vm/arrays.c | 2 +- harbour/source/vm/classes.c | 72 +++++++++++++++++++++++++++------ harbour/source/vm/estack.c | 75 +++++++++++++++++++---------------- harbour/source/vm/hvm.c | 9 ++--- harbour/source/vm/proc.c | 8 ++-- 10 files changed, 243 insertions(+), 93 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6d56406908..6110bc348e 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,46 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2006-11-07 20:36 UTC+0200 JF Lefebvre (jflefebv at mafact com) + * harbour/include/hbclass.ch + * added one rule to support inline method with local var separated from by a coma + +2006-11-03 22:00 UTC+0100 Marek Paliwoda (mpaliwoda at interia pl) + * harbour/makefile.bc + * Updated comment section about environment variables used by makefile + * harbour/makefile.vc + * Updated comment section about environment variables used by makefile + * Cleaned compilation under Visual C++ 8.0 (VS2005 compiler), including + 64 bit platforms. To properly compile under Visual C++ 8.0 you have + set a new environment variable HB_VISUALC_VER to 80 before running + make_vc.bat. + +2006-10-07 04:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/include/hbclass.ch + + added validation for class data names. As additional preprocessor + rule to not use + + * harbour/include/hboo.ch + * harbour/source/rtl/tclass.prg + * harbour/source/vm/classes.c + + added delegate messages + + * harbour/include/hbstack.h + * harbour/source/vm/arrays.c + * harbour/source/vm/estack.c + * harbour/source/vm/hvm.c + * harbour/source/vm/proc.c + + added startup symbol to hb_stack. It gives very good stop + condition for all procedures which trace stack calls and + resolves the problem with hb_stack.pBase which was never + pointing to valid function/procedure symbol when no symbol + was put on HVM stack. Now after hb_stackInit() the first + item is allocated for "hb_stackInit()" symbol so hb_stack.pBase + is always a pointer to valid function/procedure symbol. + * changed the guard condition for buggy code in hb_stackPop() + and similar code from: + hb_stack.pPos < hb_stack.pItems + to: hb_stack.pPos <= hb_stack.pBase The old condition was generating usable error message only in the startup function. In deeply called functions it was only waste of diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index d6b491947d..0eac41439c 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -181,9 +181,10 @@ #ifdef HB_CLS_NO_OO_ERR #xtranslate __HB_CLS_ERR([]) => #else - #xtranslate __HB_CLS_ERR([]) => #error [] + #xtranslate __HB_CLS_ERR([]) => ;#error [] ; #undef _DUMMY_DEF_ #endif +#xtranslate __HB_CLS_VARERR() => __HB_CLS_ERR( Invalid instance variable name: ) DECLARE HBClass ; New( cName AS String, OPTIONAL SuperParams ) AS CLASS HBClass ; @@ -220,12 +221,15 @@ DECLARE HBClass ; #xtranslate __HB_CLS_ASARGS( ([]) ) => [] #xtranslate __HB_CLS_ASARGSOPT( ) => #xtranslate __HB_CLS_ASARGSOPT( ([]) ) => [, ] +#xtranslate __HB_CLS_ISVAR( ) => +#xtranslate __HB_CLS_ISVAR( ([]) ) => __HB_CLS_VARERR(([])) +#xcommand __HB_CLS_CHECKVAR( [,] ) => __HB_CLS_ISVAR( ) [;__HB_CLS_ISVAR( )] /* #xtranslate __HB_CLS_SCOPE( , , ) => ; iif( , HB_OO_CLSTP_EXPORTED , ; iif( , HB_OO_CLSTP_PROTECTED, ; iif( , HB_OO_CLSTP_HIDDEN, nScope ) ) ) */ -#xtranslate __HB_CLS_SCOPE( ) => );__HB_CLS_ERR( Can not use multiple scope qualifiers! );empty(nScope +#xtranslate __HB_CLS_SCOPE( ) => __HB_CLS_ERR( Can not use multiple scope qualifiers! ) #xtranslate __HB_CLS_SCOPE( .T., .F., .F. ) => HB_OO_CLSTP_EXPORTED #xtranslate __HB_CLS_SCOPE( .F., .T., .F. ) => HB_OO_CLSTP_PROTECTED #xtranslate __HB_CLS_SCOPE( .F., .F., .T. ) => HB_OO_CLSTP_HIDDEN @@ -442,25 +446,31 @@ DECLARE HBClass ; /* This definitions are not Class(y) compatible - I'm leaving them as is now */ #xcommand VAR [ ] [ ] [] [] [