diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 540b9cbe24..7e676ae385 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,12 +17,32 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-19 11:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * tests/testhrb.prg + * tests/Makefile + * include/Makefile + * include/hbhrb.ch + * source/vm/runner.c + ! Added new files to Makefiles. + ! Fixed to use hbhrb.ch from .c rather than replicating #defines. + (also fixed comments to be ANSI) + ! Added self protection to .ch. + ! Made .hrb file lowercase in testhrb.prg + ! Deleted double license header from .ch. + + * utils/hbmk2/hbmk2.prg + + Added logic to move embedded compilers under a common subdir. + To stay compatible with 2.0.0beta1 release I didn't yet set + this, but it will be for final release. + Probably 'comp', or maybe 'opt'. Sorry for asking for opininons, + but they're welcome anyway. + 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/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) diff --git a/harbour/include/Makefile b/harbour/include/Makefile index 2dbe4871e7..64e471fa01 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -83,6 +83,7 @@ PRG_HEADERS=\ hbgfx.ch \ hbgfxdef.ch \ hbgtinfo.ch \ + hbhrb.ch \ hbinkey.ch \ hblang.ch \ hbmacro.ch \ diff --git a/harbour/include/hbhrb.ch b/harbour/include/hbhrb.ch index 4ae60fa742..968b12cd6a 100644 --- a/harbour/include/hbhrb.ch +++ b/harbour/include/hbhrb.ch @@ -4,9 +4,9 @@ /* * Harbour Project source code: - * Header file for box drawing + * Header file for .hrb API * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 2009 {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 @@ -50,70 +50,23 @@ * */ +/* NOTE: This file is also used by C code. */ -/* - * $Id: std.ch 11185 2009-05-31 16:42:46Z petr_ch $ - */ +#ifndef HB_HBHRB_CH_ +#define HB_HBHRB_CH_ -/* - * Harbour Project source code: - * - * - * Copyright 2006 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. - * - */ +#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_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_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() +#define HB_HRB_KEEP_GLOBAL 2 /* overload all existing public functions + will disable HB_HRBUNLOAD() */ +#endif /* HB_HBHRB_CH_ */ diff --git a/harbour/source/vm/runner.c b/harbour/source/vm/runner.c index 5286728861..33373c6e5c 100644 --- a/harbour/source/vm/runner.c +++ b/harbour/source/vm/runner.c @@ -70,6 +70,8 @@ #include "hbset.h" #include "hb_io.h" +#include "hbhrb.ch" + typedef struct { char * szName; /* Name of the function */ @@ -99,10 +101,6 @@ static const BYTE s_szHead[ 4 ] = { 192, 'H', 'R', 'B' }; #define SYM_DEFERRED 3 /* lately bound function */ #define SYM_NOT_FOUND 0xFFFFFFFFUL /* Symbol not found. */ -#define HB_HRB_DEFAULT 0 /* do not overload anything (like before) */ -#define HB_HRB_KEEP_LOCAL 1 /* keep local references but convert as static */ -#define HB_HRB_KEEP_GLOBAL 2 /* overload all existing public functions */ - static int hb_hrbReadHead( char * szBody, ULONG ulBodySize, ULONG * pulBodyOffset ) { char * pVersion; @@ -724,27 +722,6 @@ HB_FUNC( HB_HRBRUN ) hb_errRT_BASE( EG_ARG, 6103, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); } -#if 0 - - HB_HRBLOAD( [, ] , [] ) - - We have the following choices for nOptions : - - HB_HRB_DEFAULT 0 /* do not overwrite any functions, ignore - public HRB functions if functions with - the same names already exist in HVM */ - - 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 */ - - HB_HRB_KEEP_GLOBAL 2 /* overload all existing public functions */ - -#endif - HB_FUNC( HB_HRBLOAD ) { ULONG ulLen = 0; diff --git a/harbour/tests/Makefile b/harbour/tests/Makefile index 5417234b02..d01cc144fa 100644 --- a/harbour/tests/Makefile +++ b/harbour/tests/Makefile @@ -133,6 +133,7 @@ PRG_SOURCES=\ testerro.prg \ testfor.prg \ testhtml.prg \ + testhrb.prg \ testid.prg \ testinc.prg \ testmem.prg \ @@ -170,6 +171,7 @@ BAD_PRG_SOURCES=\ dupvars.prg \ dynobj.prg \ extend1.prg \ + exthrb.prg \ funcarr.prg \ inherit.prg \ inifiles.prg \ diff --git a/harbour/tests/testhrb.prg b/harbour/tests/testhrb.prg index 799861fc1a..c78db878c2 100644 --- a/harbour/tests/testhrb.prg +++ b/harbour/tests/testhrb.prg @@ -6,7 +6,7 @@ #include "hbhrb.ch" - + Procedure Main(x) Local pHrb, cExe := "Msg2()", n @@ -16,30 +16,30 @@ Local pHrb, cExe := "Msg2()", n Msg() ? "=========================" -// ? "Loading('Exthrb.hrb' )" -// pHrb := hb_HrbLoad("Exthrb.hrb" ) +// ? "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_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(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" ) + ? "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 ? "=========================" @@ -52,4 +52,3 @@ Return Function Msg() ? "Function called from Exe" Return .T. - diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index f790d36ca9..0e5405804e 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -174,6 +174,8 @@ REQUEST hbmk_KEYW #define _HBMK_NEST_MAX 10 #define _HBMK_HEAD_NEST_MAX 10 +#define _COMPEMBED_BASE_ "" /* ( "comp" + hb_osPathSeparator() ) */ + #define _WORKDIR_BASE_ ".hbmk" #define _WORKDIR_DEF_ ( _WORKDIR_BASE_ + hb_osPathSeparator() + hbmk[ _HBMK_cARCH ] + hb_osPathSeparator() + hbmk[ _HBMK_cCOMP ] ) @@ -1081,21 +1083,21 @@ FUNCTION hbmk( aArgs, /* @ */ lPause, /* @ */ lUTF8 ) #if defined( __PLATFORM__WINDOWS ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingw" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw" , "" , NIL } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingw64" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw64" , "x86_64-pc-mingw32-" , NIL } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingwarm" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-mingw32ce-" , NIL } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "mingwarm" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-wince-mingw32ce-", NIL } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "djgpp" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos", "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "watcom" + hb_osPathSeparator() + "binnt", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "win", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "watcom" + hb_osPathSeparator() + "binw" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "dos", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "win", "pocc" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "win", "pocc64" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "wce", "poccarm" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingw" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw" , "" , NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingw64" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "win", "mingw64" , "x86_64-pc-mingw32-" , NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingwarm" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-mingw32ce-" , NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "mingwarm" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc" + cCCEXT_mingw ), tmp1, NIL ) }, "wce", "mingwarm", "arm-wince-mingw32ce-", NIL } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "djgpp" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos", "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "watcom" + hb_osPathSeparator() + "binnt", iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "win", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "watcom" + hb_osPathSeparator() + "binw" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "dos", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "win", "pocc" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "win", "pocc64" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "pocc" + hb_osPathSeparator() + "Bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "pocc.exe" ), tmp1, NIL ) }, "wce", "poccarm" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) #elif defined( __PLATFORM__DOS ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "djgpp" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos", "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) - AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + "watcom" + hb_osPathSeparator() + "binw" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "dos", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "djgpp" + hb_osPathSeparator() + "bin" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "gcc.exe" ), tmp1, NIL ) }, "dos", "djgpp" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) + AAdd( aCOMPDET_EMBED, { {| cPrefix | tmp1 := PathNormalize( l_cHB_INSTALL_PREFIX ) + _COMPEMBED_BASE_ + "watcom" + hb_osPathSeparator() + "binw" , iif( hb_FileExists( tmp1 + hb_osPathSeparator() + cPrefix + "wpp386.exe" ), tmp1, NIL ) }, "dos", "watcom" , "" , {| cARCH, cCOMP, cPathBin | hbmk_COMP_Setup( cARCH, cCOMP, cPathBin + hb_osPathSeparator() + ".." ) } } ) #elif defined( __PLATFORM__UNIX )