diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4af6068603..25b92635ff 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,26 @@ +2001-01-20 17:20 UTC-0800 Ron Pinkas + * hb_slex.vc + + Added -DSIMPLEX to CLIBFLAGS + + * source/compiler/genc.c + * Minor correction. + + * utils/hbpp/hbpp.c + * source/pp/pplib.c + * include/hbcomp.h + * source/compiler/harbour.c + + Added hb_comp_iLinePRG and hb_comp_iLineINLINE + + * source/compiler/harbour.l + * source/compiler/harbour.slx + * source/compiler/hbgenerr.c + + Added logic to disallow multiple HB_INLINE() per source line. + + * source/pp/ppcomp.c + * source/pp/ppcore.c + * source/pp/pragma.c + * Corrected double spacing in PPO generation, and added #pragma BEGINDUMP to PPO. + 2001-01-19 22:30 GMT -3 Luiz Rafael Culik *utils/hbmake/hbmake.prg *Added code to allow Old style -D switch @@ -11,21 +34,21 @@ 2001-01-18 22:41 GMT+1 JFL (Mafact) *harbour/hb_slex.vc - * added HBMAKE + * added HBMAKE harbour/makefile.vc - * added HBMAKE + * added HBMAKE 2001-01-18 00:18 GMT+1 JFL (Mafact) *harbour/makefile.vc * minor form adjustement *harbour/include/hbclass.ch - * Clean the ::Class reference wich does'nt work + * Clean the ::Class reference wich does'nt work *harbour/source/debug/dbgtmenu.prg * Adding a blank line at the end of file to test Simplex and VC++ *harbour/source/rtl/tclass.prg - * Clean the ::Class reference wich does'nt work + * Clean the ::Class reference wich does'nt work *harbour/source/rtl/tobject.prg - * Clean the ::Class reference wich does'nt work + * Clean the ::Class reference wich does'nt work @@ -52,7 +75,7 @@ *include/hbapi.h *modified union in 'asRefer' structure - + *source/vm/codebloc.c *source/vm/hvm.c *source/vm/itemapi.c diff --git a/harbour/hb_slex.vc b/harbour/hb_slex.vc index a74c7191b5..60dd51c085 100644 --- a/harbour/hb_slex.vc +++ b/harbour/hb_slex.vc @@ -85,7 +85,7 @@ HBPDF_DIR = contrib\pdflib AS = masm CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(C_USR) $(CFLAGS) -CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) +CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS) -DSIMPLEX CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS) !ifdef PDF HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS) -dPDF diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 10df13fba5..03d8d28ded 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -466,7 +466,9 @@ extern BOOL hb_comp_bAutoOpen; extern BOOL hb_comp_bError; extern char hb_comp_cInlineID; -extern INLINES hb_comp_inlines; +extern INLINES hb_comp_inlines; +extern int hb_comp_iLineINLINE; +extern int hb_comp_iLinePRG; /* /GC command line setting types */ #define HB_COMPGENC_COMPACT 0 diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index ae13cf80a1..998e3e1688 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -232,7 +232,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou /* Generate codeblocks data */ - if( hb_comp_cInlineID ) + if( hb_comp_cInlineID > '0' ) { fprintf( yyc, "#include \"hbapi.h\"\n" ); } diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 58cd73dcda..7ea280ca1a 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -132,6 +132,8 @@ BOOL hb_comp_bAutoOpen = TRUE; BOOL hb_comp_bError = FALSE; char hb_comp_cInlineID = '0'; +int hb_comp_iLineINLINE = 0; +int hb_comp_iLinePRG; INLINES hb_comp_inlines; /* EXTERNAL statement can be placed into any place in a function - this flag is diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index cd80145cbd..e43e2a0536 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -761,6 +761,16 @@ Separator {SpaceTab} %} "hb_inline" { + + /* NOTE: hb_compiLineINLINE is being RESET in ppcomp.c - hb_pp_Internal() */ + + if( hb_comp_iLineINLINE ) + { + hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_TOOMANY_INLINE, "on the same line", NULL ); + return IDENTIFIER; + } + else + { #define INLINE_NORMAL 0 #define INLINE_SINGLE_QUOT 1 #define INLINE_DOUBLE_QUOT 2 @@ -771,6 +781,7 @@ Separator {SpaceTab} extern BOOL hb_pp_bInline; PINLINE pInline; + hb_comp_iLineINLINE = hb_comp_iLine; hb_pp_bInline = TRUE; sInlineSym[10] = hb_comp_cInlineID++; @@ -898,11 +909,14 @@ Separator {SpaceTab} hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */ } + hb_comp_iLinePRG = hb_comp_iLine - 1; + hb_comp_iLine = hb_comp_iLineINLINE; + yylval.string = hb_compIdentifierNew( sInlineSym, TRUE ); return IDENTIFIER; } - } - + } + } %{ /* ************************************************************************ */ %} diff --git a/harbour/source/compiler/harbour.slx b/harbour/source/compiler/harbour.slx index 2cb44dd5a7..c15f0c237d 100644 --- a/harbour/source/compiler/harbour.slx +++ b/harbour/source/compiler/harbour.slx @@ -1001,6 +1001,16 @@ int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIg return IDENTIFIER; case HB_INLINE : + + /* NOTE: hb_compiLineINLINE is being RESET in ppcomp.c - hb_pp_Internal() */ + + if( hb_comp_iLineINLINE ) + { + hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_TOOMANY_INLINE, "on the same line", NULL ); + iIdentifier++; + return IDENTIFIER + DONT_REDUCE; + } + else { #define INLINE_NORMAL 0 #define INLINE_SINGLE_QUOT 1 @@ -1012,6 +1022,7 @@ int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIg extern BOOL hb_pp_bInline; PINLINE pInline; + hb_comp_iLineINLINE = hb_comp_iLine; hb_pp_bInline = TRUE; sInlineSym[10] = hb_comp_cInlineID++; @@ -1139,6 +1150,9 @@ int hb_comp_SLX_CustomAction( int x, int aiHold[], int *ptr_iHold, BOOL *ptr_bIg hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */ } + hb_comp_iLinePRG = hb_comp_iLine; + hb_comp_iLine = hb_comp_iLineINLINE; + yylval.string = hb_compIdentifierNew( sInlineSym, TRUE ); iIdentifier++; DEBUG_INFO( printf( "INLINE, Primary Identifier %s Increased to: %i\n", "INLINE", iIdentifier ) ); diff --git a/harbour/source/compiler/hbgenerr.c b/harbour/source/compiler/hbgenerr.c index 317a6524e6..f32f1c6ce8 100644 --- a/harbour/source/compiler/hbgenerr.c +++ b/harbour/source/compiler/hbgenerr.c @@ -89,7 +89,7 @@ char * hb_comp_szErrors[] = "Code block contains both macro and declared symbol references", "GET contains complex macro", "Unterminated inline block in function: \'%s\'", - "Too many inline blocks", + "Too many inline blocks %s", "Inline C requires C output generation, use -gc[n]" }; diff --git a/harbour/source/pp/ppcomp.c b/harbour/source/pp/ppcomp.c index a3a9fdd484..e9b074da41 100644 --- a/harbour/source/pp/ppcomp.c +++ b/harbour/source/pp/ppcomp.c @@ -53,7 +53,7 @@ BOOL hb_pp_bInline = FALSE; static char s_szLine[ HB_PP_STR_SIZE ]; static char s_szOutLine[ HB_PP_STR_SIZE ]; -static int hb_pp_LastOutLine = 1; +int hb_pp_LastOutLine = 1; /* BOOL bDebug = FALSE; @@ -147,10 +147,12 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) { if( hb_pp_nCondCompile == 0 || hb_pp_aCondCompile[ hb_pp_nCondCompile - 1 ] ) { + /* Ron Pinkas removed 2001-01-20 if( ( hb_pp_LastOutLine < hb_comp_iLine - 1 ) && hb_comp_files.iFiles == 1 && handl_o ) for( ; hb_pp_LastOutLine < hb_comp_iLine-1; hb_pp_LastOutLine++ ) hb_pp_WrStr( handl_o, "\n" ); hb_pp_LastOutLine = hb_comp_iLine; + */ hb_pp_ParseExpression( ptr, s_szOutLine ); } else @@ -207,10 +209,14 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) { /* Ron Pinkas added 2000-06-13 */ /* Ignore empty lines in #included files. */ + /* Ron Pinkas removed 2001-01-20 */ + #if 0 if( ( hb_pp_LastOutLine != hb_comp_iLine ) && hb_comp_files.iFiles == 1 && handl_o ) /* Ron Pinkas end 2000-06-13 */ for( ; hb_pp_LastOutLine < hb_comp_iLine; hb_pp_LastOutLine++ ) hb_pp_WrStr( handl_o, "\n" ); + #endif + /* END Ron Pinkas removed 2001-01-20 */ } lens = hb_pp_strocpy( ptrOut, s_szLine ) + ( ptrOut - sOut ); @@ -218,8 +224,19 @@ int hb_pp_Internal( FILE * handl_o, char * sOut ) *( sOut + lens++ ) = '\n'; *( sOut + lens ) = '\0'; + if( hb_comp_iLineINLINE && hb_pp_bInline == 0 ) + { + hb_comp_iLine = hb_comp_iLinePRG + ( hb_comp_iLine - hb_comp_iLineINLINE ); + #ifndef SIMPLEX + hb_comp_iLine++; + #endif + hb_comp_iLineINLINE = 0; + } + if( handl_o ) + { hb_pp_WrStr( handl_o, sOut ); + } #if 0 printf( "%d : %s\n", hb_comp_iLine, sOut ); diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index b733580aee..fc878d8818 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -2852,13 +2852,29 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch int hb_pp_WrStr( FILE * handl_o, char * buffer ) { + extern int hb_pp_LastOutLine; int lens = strlen(buffer); HB_TRACE(HB_TR_DEBUG, ("hb_pp_WrStr(%p, %s)", handl_o, buffer)); + /* Ron Pinkas added 2001-01-20 */ + if( hb_comp_files.iFiles == 1 ) + { + for( ; hb_pp_LastOutLine < hb_comp_iLine - 1; hb_pp_LastOutLine++ ) + { + fwrite("\n",1,1,handl_o); + } + hb_pp_LastOutLine = hb_comp_iLine; + } + /* END Ron Pinkas added 2001-01-20 */ + fwrite(buffer,lens,1,handl_o); + if( *(buffer+lens-1) != '\n' ) + { fwrite("\n",1,1,handl_o); + } + return 0; } diff --git a/harbour/source/pp/pplib.c b/harbour/source/pp/pplib.c index f0f3aff23d..ec502fe690 100644 --- a/harbour/source/pp/pplib.c +++ b/harbour/source/pp/pplib.c @@ -56,6 +56,8 @@ PATHNAMES * hb_comp_pIncludePath = NULL; PHB_FNAME hb_comp_pFileName = NULL; FILES hb_comp_files; int hb_comp_iLine; /* currently parsed file line number */ +int hb_comp_iLinePRG; +int hb_comp_iLineINLINE = 0; /* These are need for the PP #pragma support */ BOOL hb_comp_bPPO = FALSE; /* flag indicating, is ppo output needed */ diff --git a/harbour/source/pp/pragma.c b/harbour/source/pp/pragma.c index 8458d7e056..6798040d84 100644 --- a/harbour/source/pp/pragma.c +++ b/harbour/source/pp/pragma.c @@ -176,6 +176,11 @@ void hb_pp_ParsePragma( char * szLine ) extern BOOL hb_pp_bInline; PINLINE pInline; + if( hb_comp_bPPO ) + { + hb_pp_WrStr( hb_comp_yyppo, "#pragma BEGINDUMP" ); + } + hb_pp_bInline = TRUE; pInline = hb_compInlineAdd( NULL ); diff --git a/harbour/utils/hbpp/hbpp.c b/harbour/utils/hbpp/hbpp.c index fc03a24dd6..fd9486b902 100644 --- a/harbour/utils/hbpp/hbpp.c +++ b/harbour/utils/hbpp/hbpp.c @@ -80,6 +80,9 @@ BOOL hb_comp_bDebugInfo = FALSE; /* holds if generate debugger re int hb_comp_iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */ FILE *hb_comp_yyppo = NULL; +int hb_comp_iLinePRG; +int hb_comp_iLineINLINE = 0; + int main( int argc, char * argv[] ) { FILE * handl_o;