From 937101dd91bdc53b7559f8beffd60ed1e7a21b52 Mon Sep 17 00:00:00 2001 From: Jean-Francois Lefebvre Date: Sun, 28 May 2000 20:09:56 +0000 Subject: [PATCH] *harbour/include/hboo.ch *harbour/include/hbclass.ch Now support MI, scoping, fowarding and delegating Also support 10 chars limit by not prefixing the Classname when in 10 chars mode *harbour/include/hbsetup.ch Allow the configuration of Hidden message *harbour/source/rtl/objfunc.prg added function __objDerivedFrom(oSelf, oObj | cClassName) *harbour/source/rtl/tclass.prg Major modification to implement MI & scoping Added message :Super to acces frist superclass object instance Added message :IsDerivedFrom(oObj | cClassName ) (Xbase++ comp.) *harbour/source/vm/proc.c added char * hb_procname( int iLevel, char * szName ) extracted from HB_FUNC( PROCNAME ) to allow it to be called from c HB_FUNC( PROCNAME ) modified to call the previous'one *harbour/source/vm/classes.c Major modification to implement MI & Scoping Added function Sender() used by delegating to allow full polymorphism Added function __CLS_PARAM used by the preprocessor --- harbour/ChangeLog | 30 ++ harbour/include/hbclass.ch | 292 +++++++++-- harbour/include/hbextern.ch | 8 + harbour/include/hboo.ch | 31 ++ harbour/include/hbsetup.ch | 5 +- harbour/source/rtl/objfunc.prg | 25 + harbour/source/rtl/tclass.prg | 232 +++++---- harbour/source/vm/classes.c | 889 ++++++++++++++++++++++++++++----- harbour/source/vm/proc.c | 46 +- 9 files changed, 1299 insertions(+), 259 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 11435d41c3..d9322296e1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +2000-05-28 22:16 UTC+0200 Jfl&RaC + + +*harbour/include/hboo.ch +*harbour/include/hbclass.ch + Now support MI, scoping, fowarding and delegating + Also support 10 chars limit by not prefixing the Classname when in 10 chars mode + +*harbour/include/hbsetup.ch + Allow the configuration of Hidden message + +*harbour/source/rtl/objfunc.prg + added function __objDerivedFrom(oSelf, oObj | cClassName) + +*harbour/source/rtl/tclass.prg + Major modification to implement MI & scoping + Added message :Super to acces frist superclass object instance + Added message :IsDerivedFrom(oObj | cClassName ) (Xbase++ comp.) + +*harbour/source/vm/proc.c + added char * hb_procname( int iLevel, char * szName ) + extracted from HB_FUNC( PROCNAME ) to allow it to be called from c + HB_FUNC( PROCNAME ) modified to call the previous'one + +*harbour/source/vm/classes.c + Major modification to implement MI & Scoping + Added function Sender() used by delegating to allow full polymorphism + Added function __CLS_PARAM used by the preprocessor + + 2000-05-27 23:12 UTC+0100 Victor Szakats * source/rtl/gtdos/gtdos.c diff --git a/harbour/include/hbclass.ch b/harbour/include/hbclass.ch index 09925b0f9e..8c01592a77 100644 --- a/harbour/include/hbclass.ch +++ b/harbour/include/hbclass.ch @@ -6,6 +6,10 @@ * Harbour Project source code: * Header file for Class commands * + * + * Copyright 2000 JfL&RaC + * www - http://www.harbour-project.org + * * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * @@ -37,6 +41,13 @@ * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * + * + * Copyright 2000 JF Lefebvre and RA Cuylen + * Support for Class(y), TopClass and Visual Object compatibility + * Support for MI, Scoping (Protect, Hidden and Readonly) + * Delegating, DATA Shared + * Support of 10 Chars limits + * * Copyright 2000 Brian Hays * Documentation for the commands * @@ -44,69 +55,245 @@ * */ +#include "hbsetup.ch" + +#ifndef HB_OO_CH_ + #include "hboo.ch" +#endif + #ifndef HB_CLASS_CH_ #define HB_CLASS_CH_ -#xcommand CLASS [ ] => ; - function () ;; +#xtranslate HBCLSCHOICE( , , ) => if( , HBCLSTP_EXPORTED , if( , HBCLSTP_PROTECTED, if( , HBCLSTP_HIDDEN, nScope) ) ) + +#xtranslate CREATE CLASS => CLASS + + +#ifndef HB_SHORTNAMES +#xcommand CLASS [ [,] ] [] => ; + function () ;; static oClass ;; + local nScope := HBCLSTP_EXPORTED ;; if oClass == nil ;; - oClass := TClass():New( <(ClassName)> [,<(SuperClass)>] ) ;; + oClass := TClass():New( <(ClassName)>, __CLS_PARAM([ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ;; #undef _CLASS_NAME_ ;; #define _CLASS_NAME_ ;; #translate CLSMETH () => @_() ; - [ ; #translate Super : => ::: ] ; - [ ; extern ] + [ ; #translate Super( ) : => ::: ] ; + [ ; #translate Super( ) : => ::: ] ; + [ ; #translate Super() : => ::: ] ; + [ ; #translate Super : => ::: ] ; + [ ; extern ] [ , ] +#else +#xcommand CLASS [ [,] ] [] => ; + function () ;; + static oClass ;; + local nScope := HBCLSTP_EXPORTED ;; + if oClass == nil ;; + oClass := TClass():New( <(ClassName)>, __CLS_PARAM([ <(SuperClass1)> ] [ ,<(SuperClassN)> ] ) ) ;; + #undef _CLASS_NAME_ ;; + #define _CLASS_NAME_ ;; + #translate CLSMETH () => @() ; + [ ; #translate Super( ) : => ::: ] ; + [ ; #translate Super( ) : => ::: ] ; + [ ; #translate Super() : => ::: ] ; + [ ; #translate Super : => ::: ] ; + [ ; extern ] [ , ] +#endif /* HB_SHORTNAMES */ +//VO compatibility +#xtranslate ( { [] } => ( ():New(

) +#xtranslate := { [] } => := ():New(

) +#xtranslate = { [] } => = ():New(

) +#xtranslate , { [] } => , ():New(

) -/* Note the use of commas ',' on the following rule to avoid their call - if there are no AS ... or INIT clauses specified. As we just use - those methods first parameter, the second one supplied acts as a dummy one */ +#xtranslate EXPORTED: => nScope := HBCLSTP_EXPORTED +#xtranslate VISIBLE: => nScope := HBCLSTP_EXPORTED +#xtranslate HIDDEN: => nScope := HBCLSTP_HIDDEN +#xtranslate PROTECTED: => nScope := HBCLSTP_PROTECTED -#xcommand DATA [,] [ AS ] [ INIT ] => ; - [ oClass:SetType( <(type)> ) ; ][ oClass:SetInit( ) ; ] ; - oClass:AddData( <(DataName1)> ) ; - [; oClass:AddData( <(DataNameN)> ) ] ; - [; oClass:SetInit(,) ] [ ; oClass:SetType(,<(type)>) ] +#xcommand DATA [ AS ] [ INIT ] [ ] [] [