2001-08-05 12:15 UTC-0800 Ron Pinkas <ron@profit-master.com>

+ include/hbmsetup.h
   * include/hbmacro.h
     * Moved #defines of HB_SM_* to new file hbmsetup.h

   * source/compiler/harbour.c
   * source/vm/macro.c
   * source/compiler/genc.c
     + Added logic to automatically synchronize HB_SETMACRO() level with the -k option supplied to compiler.

     /* HB_SETMACRO() may still be called explictly, but now specifying any -k option to harbour will automatically provide same
       level of functionalty in macro compiler. Example:

           harbour test -kc

        will restrict the compiler to the Clipper level mode, and will automatically disable extended macro support in that module
        without requiring:

           HB_SETMACRO( HB_SM_HARBOUR, .F. )
           HB_SETMACRO( HB_SM_XBASE, .F. )

        By default all harbour extensions are enabled - you can use -kc, -kx -ki, etc., to disable any unwanted feature.

        We should still review the need to have -ki which I find absolutley redundant and unproductive.
     */
This commit is contained in:
Ron Pinkas
2001-08-05 19:24:12 +00:00
parent 2b4f426339
commit cb4e5e74e0
6 changed files with 65 additions and 14 deletions

View File

@@ -1,3 +1,29 @@
2001-08-05 12:15 UTC-0800 Ron Pinkas <ron@profit-master.com>
+ include/hbmsetup.h
* include/hbmacro.h
* Moved #defines of HB_SM_* to new file hbmsetup.h
* source/compiler/harbour.c
* source/vm/macro.c
* source/compiler/genc.c
+ Added logic to automatically synchronize HB_SETMACRO() level with the -k option supplied to compiler.
/* HB_SETMACRO() may still be called explictly, but now specifying any -k option to harbour will automatically provide same
level of functionalty in macro compiler. Example:
harbour test -kc
will restrict the compiler to the Clipper level mode, and will automatically disable extended macro support in that module
without requiring:
HB_SETMACRO( HB_SM_HARBOUR, .F. )
HB_SETMACRO( HB_SM_XBASE, .F. )
By default all harbour extensions are enabled - you can use -kc, -kx -ki, etc., to disable any unwanted feature.
We should still review the need to have -ki which I find absolutley redundant and unproductive.
*/
2001-08-05 22:58 GMT+3 Alexander Kresin <alex@belacy.belgorod.su>
* source/vm/memvars.c
+ Two functions added: hb_memvarGetVarHandle() and hb_memvarGetValueByHandle()
@@ -14,10 +40,10 @@
* all options used with -k switch are letter case sensitive
* -kc (Clipper compatibility) clears all other switches (minimal
set of features)
*source/compiler/harbour.l
* added support for -ki command line switch
*source/compiler/harbour.sly
*source/compiler/harbour.y
* fixed line numer issues in generated pcode

View File

@@ -72,6 +72,7 @@
#include "hbvm.h"
#include "hbexprop.h"
#include "hbpcode.h"
#include "hbmsetup.h"
#if defined(HB_EXTERN_C)
extern "C" {
@@ -100,15 +101,6 @@ extern "C" {
#define HB_MACRO_UNKN_SYM 8 /* requested symbol was not found in runtime symbol table */
#define HB_MACRO_UNKN_VAR 16 /* requested variable doesn't exist */
/* runtime settings for macro compiler */
#define HB_SM_HARBOUR 1 /* extended Harbour features */
#define HB_SM_XBASE 2 /* extended xbase compatibility */
#define HB_SM_PREPROC 4 /* enable/disable commands preprocessing */
#define HB_SM_SHORTCUTS 8 /* enable/disable sortcuts for logical operators */
#define HB_SM_PARSER 128 /* address of macro parser (TODO) */
/* Global functions
*/
extern void hb_macroError( int iError, HB_BISON_PTR pMacro );

View File

@@ -0,0 +1,6 @@
/* runtime settings for macro compiler */
#define HB_SM_HARBOUR 1 /* extended Harbour features */
#define HB_SM_XBASE 2 /* extended xbase compatibility */
#define HB_SM_PREPROC 4 /* enable/disable commands preprocessing */
#define HB_SM_SHORTCUTS 8 /* enable/disable sortcuts for logical operators */
#define HB_SM_PARSER 128 /* address of macro parser (TODO) */

View File

@@ -29,6 +29,7 @@
#include <assert.h>
#include "hbcomp.h"
#include "hbmsetup.h"
static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc );
static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc );
@@ -202,6 +203,10 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
hb_comp_szPrefix, pFileName->szName,
hb_comp_szPrefix, pFileName->szName );
if( hb_comp_Supported )
fprintf( yyc, "\nextern ULONG hb_macroSetMacro( BOOL bSet, ULONG flag );\n" );
/* Generate functions data
*/
pFunc = hb_comp_functions.pFirst;
@@ -227,6 +232,22 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou
hb_compGenCReadable( pFunc, yyc );
fprintf( yyc, " };\n\n" );
if( hb_comp_Supported )
{
if( hb_comp_Supported & HB_COMPFLAG_HARBOUR )
{
fprintf( yyc, " hb_macroSetMacro( TRUE, %i );\n\n", HB_SM_HARBOUR );
}
if( hb_comp_Supported & HB_COMPFLAG_XBASE )
{
fprintf( yyc, " hb_macroSetMacro( TRUE, %i );\n\n", HB_SM_XBASE );
}
hb_comp_Supported = 0;
}
fprintf( yyc, " hb_vmExecute( pcode, symbols );\n}\n\n" );
pFunc = pFunc->pNext;
}

View File

@@ -142,7 +142,8 @@ int hb_comp_iLinePRG;
INLINES hb_comp_inlines;
/* various compatibility flags (-k switch) */
ULONG hb_comp_Supported = HB_COMPFLAG_HARBOUR;
ULONG hb_comp_Supported;
/* EXTERNAL statement can be placed into any place in a function - this flag is
* used to suppress error report generation
@@ -185,6 +186,11 @@ int main( int argc, char * argv[] )
hb_comp_pOutPath = NULL;
/* Activate Harbour extensions by default. */
hb_comp_Supported = HB_COMPFLAG_HARBOUR;
hb_comp_Supported |= HB_COMPFLAG_XBASE;
hb_comp_Supported |= HB_COMPFLAG_HB_INLINE;
/* First check the environment variables */
hb_compChkCompilerSwitch( 0, NULL );
@@ -2235,7 +2241,7 @@ static void hb_compGenVariablePCode( BYTE bPCode, char * szVarName )
bGenCode = hb_comp_bForceMemvars; /* harbour compatibility */
else
bGenCode = ( hb_comp_bForceMemvars || bPCode == HB_P_POPVARIABLE );
if( bGenCode )
{
/* -v switch was used -> assume it is a memvar variable

View File

@@ -69,7 +69,7 @@
BOOL hb_comp_bShortCuts = TRUE;
/* various flags for macro compiler */
static ULONG s_macroFlags = (HB_SM_SHORTCUTS | HB_SM_HARBOUR);
static ULONG s_macroFlags = HB_SM_SHORTCUTS;
static void hb_macroUseAliased( HB_ITEM_PTR, HB_ITEM_PTR, int );
static void hb_compMemvarCheck( char * szVarName, HB_MACRO_DECL );