From 75294d2ded044a1b6f18a18a846b991666d5ed43 Mon Sep 17 00:00:00 2001 From: Ron Pinkas Date: Tue, 21 Nov 2000 16:56:14 +0000 Subject: [PATCH] 2000-11-21 08:55 UTC+0800 Ron Pinkas * source/pp/ppcomp.c * source/compiler/harbour.c * Corrected compiler warnings. * source/compiler/harbour.slx * Small optimization in handling of s_sLastBlock * tests/tstblock.prg + Added complex early macro test. --- harbour/ChangeLog | 11 +++++++++++ harbour/source/compiler/harbour.c | 17 +++++++++++++---- harbour/source/compiler/harbour.slx | 23 +++++++++++++++++------ harbour/source/pp/ppcomp.c | 9 +-------- harbour/tests/tstblock.prg | 15 ++++++++++++++- 5 files changed, 56 insertions(+), 19 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ac44949bab..82a1e39761 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +2000-11-21 08:55 UTC+0800 Ron Pinkas + * source/pp/ppcomp.c + * source/compiler/harbour.c + * Corrected compiler warnings. + + * source/compiler/harbour.slx + * Small optimization in handling of s_sLastBlock + + * tests/tstblock.prg + + Added complex early macro test. + 2000-11-21 17:42 GMT+1 Maurilio Longo * source/rtl/teditor.prg + added ::LoadText() method diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 885a4fa82f..ae4d2cc05c 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -6,7 +6,7 @@ * Harbour Project source code: * Compiler main file * - * Copyright 1999 {list of individual authors and e-mail addresses} + * Copyright 1999 Antonio Linares * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify @@ -24,9 +24,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit * their web site at http://www.gnu.org/). * - */ - -/* * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * @@ -34,6 +31,15 @@ * hb_compPrepareOptimize() * hb_compOptimizeJumps() * hb_compOptimizeFrames() + * hb_compAutoOpenAdd() + * hb_compAutoOpenFind() + * hb_compAutoOpen() + * hb_compDeclaredParameterAdd() + * hb_compClassAdd() + * hb_compClassFind() + * hb_compMethodAdd() + * hb_compMethodFind() + * hb_compDeclaredAdd() * * See doc/license.txt for licensing terms. * @@ -350,7 +356,10 @@ void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType ) { /* Nothing to do since no warnings requested.*/ if ( hb_comp_iWarnings < 3 ) + { + HB_SYMBOL_UNUSED( szVarName ); return; + } /* Either a Declared Function Parameter or a Declared Method Parameter. */ if( hb_comp_szDeclaredFun ) diff --git a/harbour/source/compiler/harbour.slx b/harbour/source/compiler/harbour.slx index 95312627a5..e8339ae2ae 100644 --- a/harbour/source/compiler/harbour.slx +++ b/harbour/source/compiler/harbour.slx @@ -802,6 +802,7 @@ int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIg { unsigned int iBrackets = 1; char cTmp; + BOOL bMacro = FALSE; pTmp++; while( *pTmp ) @@ -818,16 +819,24 @@ int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIg { iBrackets++; } + else if( *pTmp == '&' ) + { + bMacro = TRUE; + } + pTmp++; } - pTmp++; - cTmp = *pTmp; - *pTmp = '\0'; + if( bMacro ) + { + pTmp++; + cTmp = *pTmp; + *pTmp = '\0'; - s_sLastBlock = hb_compIdentifierNew( s_szBuffer - 1, TRUE ); + s_sLastBlock = hb_compIdentifierNew( s_szBuffer - 1, TRUE ); - *pTmp = cTmp; + *pTmp = cTmp; + } } } return '{' + DONT_REDUCE; @@ -997,7 +1006,9 @@ char * hb_comp_SLX_LastBlock( BOOL bReset ) { if( bReset && s_sLastBlock ) { - //hb_xfree( s_sLastBlock ); + /* + hb_xfree( s_sLastBlock ); + */ s_sLastBlock = NULL; } diff --git a/harbour/source/pp/ppcomp.c b/harbour/source/pp/ppcomp.c index 5e250a2f29..9d5ec2faa6 100644 --- a/harbour/source/pp/ppcomp.c +++ b/harbour/source/pp/ppcomp.c @@ -219,7 +219,6 @@ int hb_pp_ReadRules( void ) char * ptr; int lContinue; int lens, rdlen; - int lLine = 0; HB_TRACE(HB_TR_DEBUG, ("hb_pp_ReadRules()")); @@ -275,19 +274,13 @@ int hb_pp_ReadRules( void ) else { CloseInclude(); - lLine = 1; + hb_pp_LastOutLine = hb_comp_iLine; } *s_szLine = '\0'; } } - if( lLine ) - { - if( hb_comp_files.iFiles == 1 ) - hb_pp_LastOutLine = hb_comp_iLine; - } - return lens; } diff --git a/harbour/tests/tstblock.prg b/harbour/tests/tstblock.prg index c64958a5d3..46b1d31a16 100644 --- a/harbour/tests/tstblock.prg +++ b/harbour/tests/tstblock.prg @@ -16,7 +16,19 @@ PROCEDURE Main() bBlock[i] := {|| &Macro } NEXT - ? "Early:" + ? "Early (Simple):" + + FOR i = 1 TO 3 + ? Eval( bBlock[i] ) + NEXT + + FOR i = 1 TO 3 + M->Macro := "Var" + Str( i, 1 ) + bBlock[i] := {|| &Macro + "!" } + NEXT + + ? + ? "Early (Complex):" FOR i = 1 TO 3 ? Eval( bBlock[i] ) @@ -27,6 +39,7 @@ PROCEDURE Main() bBlock[i] := {|| &(Macro) } NEXT + ? ? "Late:" FOR i = 1 TO 3