2009-06-19 10:56 UTC+0200 Jean lefebvre (jfl at mafact dot com)

* vm/runner.c
    FIXED ;
    ../../runner.c:413: error: '_HB_SYMB' undeclared (first use in this function)
  + include/hbhrb.ch:  HB_HRBLOAD() mode #define new file
  + tests/testhrb.prg: test program fro new params 
  + tests/exthrb.prg:  test program to be compiled as .HRB using /gh option
This commit is contained in:
Jean-Francois Lefebvre
2009-06-19 09:00:16 +00:00
parent ce275c340e
commit d7a22185d5
5 changed files with 198 additions and 2 deletions

View File

@@ -17,6 +17,14 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-06-19 10:56 UTC+0200 Jean lefebvre (jfl at mafact dot com)
* vm/runner.c
FIXED ;
../../runner.c:413: error: '_HB_SYMB' undeclared (first use in this function)
+ include/hbhrb.ch: HB_HRBLOAD() mode #define new file
+ tests/testhrb.prg: test program fro new params
+ tests/exthrb.prg: test program to be compiled as .HRB using /gh option
2009-06-19 00:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/vm/runner.c
* Formatted.
@@ -51,6 +59,7 @@
* Reverted to r11403 for Pritpal.
(now for real)
>>>>>>> .r11422
2009-06-18 21:18 UTC+0200 Jean lefebvre (jfl at mafact dot com)
* vm/runner.c
+ Added options to HB_HRBLOAD() :

119
harbour/include/hbhrb.ch Normal file
View File

@@ -0,0 +1,119 @@
/*
* $Id: hbhrb.ch 0001 2009-06-18 20:20:54 j. Lefebvre $
*/
/*
* Harbour Project source code:
* Header file for box drawing
*
* Copyright 1999 {list of individual authors and e-mail addresses}
* 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.
*
*/
/*
* $Id: std.ch 11185 2009-05-31 16:42:46Z petr_ch $
*/
/*
* Harbour Project source code:
*
*
* Copyright 2006 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* 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.
*
*/
#define HB_HRB_DEFAULT 0 // do not overwrite any functions, ignore
// public HRB functions if functions with
// the same names already exist in HVM
#define HB_HRB_KEEP_LOCAL 1 // do not overwrite any functions
// but keep local references, so
// if module has public function FOO and
// this function exists also in HVM
// then the function in HRB is converted
// to STATIC one
#define HB_HRB_KEEP_GLOBAL 2 // overload all existing public functions
// will disable HB_HRBUNLOAD()

View File

@@ -410,8 +410,8 @@ static PHRB_BODY hb_hrbLoad( char* szHrbBody, ULONG ulBodySize, USHORT suMode )
pHrbBody->pDynFunc = pDynFunc;
/* ok to much space reserved but ... */
pSymFuncExe = ( PHB_SYMB ) hb_xgrab( pHrbBody->ulFuncs * sizeof( _HB_SYMB ) );
memset( pSymFuncExe, 0, pHrbBody->ulFuncs * sizeof( _HB_SYMB ) );
pSymFuncExe = ( PHB_SYMB ) hb_xgrab( pHrbBody->ulFuncs * sizeof( HB_SYMB ) );
memset( pSymFuncExe, 0, pHrbBody->ulFuncs * sizeof( HB_SYMB ) );
for( ul = 0; ul < pHrbBody->ulFuncs; ul++ )
{

13
harbour/tests/exthrb.prg Normal file
View File

@@ -0,0 +1,13 @@
//
// $Id: extmsg.prg 0001 2009-06-18 20:20:41 j. lefebvre $
//
// see also testhrb.prg
Function Msg()
? "Function called from HRB file"
Return .T.
Function msg2()
Return Msg()

55
harbour/tests/testhrb.prg Normal file
View File

@@ -0,0 +1,55 @@
//
// $Id: testhrb.prg 0001 2009-06-18 20:20:41 j. lefebvre $
//
// see also exthrb.prg
#include "hbhrb.ch"
Procedure Main(x)
Local pHrb, cExe := "Msg2()", n
n:=iif(x==NIL,0,val(x))
? "calling Msg ... From exe here !"
Msg()
? "========================="
// ? "Loading('Exthrb.hrb' )"
// pHrb := hb_HrbLoad("Exthrb.hrb" )
// ? "Loading(HB_HRB_DEFAULT,'Exthrb.hrb' )"
// pHrb := hb_HrbLoad(HB_HRB_DEFAULT,"Exthrb.hrb" )
// ? "Loading(HB_HRB_KEEP_LOCAL,'Exthrb.hrb' )"
// pHrb := hb_HrbLoad(HB_HRB_KEEP_LOCAL,"Exthrb.hrb" )
? "Loading("+iif(n=0,"HB_HRB_DEFAULT",iif(n=1,"HB_HRB_KEEP_LOCAL","HB_HRB_KEEP_GLOBAL"))+",'Exthrb.hrb' )"
pHrb := hb_HrbLoad(n,"Exthrb.hrb" )
? "========================="
? "calling Msg ... DEFAULT=From exe, LOCAL=From exe, GLOBAL=From HRB"
Msg()
? "========================="
? "calling Msg ... DEFAULT=From exe, LOCAL=From HRB, GLOBAL=From HRB"
&cExe //
? "========================="
hb_HrbUnload( pHrb ) // should do nothing in case of GLOBAL
? "calling Msg ... DEFAULT=From exe, LOCAL=From exe, GLOBAL=From HRB"
Msg() // test unload protection when using GLOBAL ... then Hrb not anymore unloadable
? "========================="
? "END"
Return
Function Msg()
? "Function called from Exe"
Return .T.