From 246e124c59b04a3dfb1f5e2da511defa04f77d2f Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Fri, 27 Feb 2009 15:47:25 +0000 Subject: [PATCH] 2009-02-27 16:52 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + harbour/contrib/xhb/xhbcls.ch + added header file which xHarbour like OVERRIDE / EXTEND CLASS definitions. Warning: using this functionality may break logical inheritance scheme or even some internal class definitions in both Harbour and xHarbour compilers. In Harbour it's unsupported feature added here only for strict XHB compatibility. --- harbour/ChangeLog | 9 +++ harbour/contrib/xhb/xhbcls.ch | 122 ++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 harbour/contrib/xhb/xhbcls.ch diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 04583e70c6..b08a6072fc 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,15 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-27 16:52 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + + harbour/contrib/xhb/xhbcls.ch + + added header file which xHarbour like OVERRIDE / EXTEND CLASS + definitions. + Warning: using this functionality may break logical inheritance + scheme or even some internal class definitions in both + Harbour and xHarbour compilers. In Harbour it's unsupported + feature added here only for strict XHB compatibility. + 2009-02-27 16:05 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * INSTALL * bin/postinst.bat diff --git a/harbour/contrib/xhb/xhbcls.ch b/harbour/contrib/xhb/xhbcls.ch new file mode 100644 index 0000000000..b56ba17a97 --- /dev/null +++ b/harbour/contrib/xhb/xhbcls.ch @@ -0,0 +1,122 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Header file for cross-compatibility with xhb class code extensions + * + * Warning: using this functionality may break logical inheritance + * scheme or even some internal class definitions in both + * Harbour and xHarbour compilers. In Harbour it's unsupported + * feature added here only for strict XHB compatibility. + * + * Copyright 2009 Przemyslaw Czerpak + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#ifndef XHB_CLS__CH_ +#define XHB_CLS__CH_ + +#ifdef __HARBOUR__ + +#ifndef __XHARBOUR__ + + #xtranslate __xhb_cls_scope( , .t. ) => + HB_OO_CLSTP_PERSIST + #xtranslate __xhb_cls_scope( , .f. ) => + #xtranslate __xhb_cls_scope( , .t. ) => HB_OO_CLSTP_PERSIST + #xtranslate __xhb_cls_scope( , .f. ) => + + #xcommand OVERRIDE METHOD [IN] CLASS ; + WITH [METHOD] [SCOPE ] => ; + __clsModMsg( ():classH, #, @() ) + + + #xcommand EXTEND CLASS WITH ; + [SCOPE ] [] ; + [] => ; + __clsAddMsg( ():classH, #, ; + __cls_IncData( ():classH ), ; + HB_OO_MSG_PROPERTY, NIL, ; + __xhb_cls_scope( , <.persist.> ) ) + + + #xcommand EXTEND CLASS WITH METHOD [SCOPE ] ; + [] [] => ; + __clsAddMsg( ():classH, #, @(), ; + HB_OO_MSG_METHOD, NIL, ; + __xhb_cls_scope( , <.persist.> ) ) + + + #xcommand EXTEND CLASS WITH MESSAGE METHOD ; + [SCOPE ] [] ; + [] => ; + __clsAddMsg( ():classH, #, @(), ; + HB_OO_MSG_METHOD, NIL, ; + __xhb_cls_scope( , <.persist.> ) ) + + + #xcommand EXTEND CLASS WITH MESSAGE INLINE ; + [SCOPE ] [] ; + [] => ; + __clsAddMsg( ():classH, #, ; + { |Self| HB_SYMBOL_UNUSED(Self), }, ; + HB_OO_MSG_INLINE, NIL, ; + __xhb_cls_scope( , <.persist.> ) ) + + + #xcommand EXTEND CLASS WITH MESSAGE ( ) ; + INLINE ; + [SCOPE ] [] ; + [] => ; + __clsAddMsg( ():classH, #, ; + { |Self, | HB_SYMBOL_UNUSED(Self), }, ; + HB_OO_MSG_INLINE, NIL, ; + __xhb_cls_scope( , <.persist.> ) ) + + +#endif /* __XHARBOUR__ */ + +#endif /* __HARBOUR__ */ + +#endif /* XHB_CLS__CH_ */