2011-10-20 22:03 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbpp.h
* harbour/include/hbcomp.h
* harbour/src/pp/ppcore.c
* harbour/src/compiler/hbmain.c
* harbour/src/compiler/hbcmplib.c
+ added support for setting starting line number in code compiled
from memory buffer
! removed unnecessary EF_CANDEFULT flag from recently added
compiler RTE
This commit is contained in:
@@ -16,6 +16,17 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-10-20 22:03 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbpp.h
|
||||
* harbour/include/hbcomp.h
|
||||
* harbour/src/pp/ppcore.c
|
||||
* harbour/src/compiler/hbmain.c
|
||||
* harbour/src/compiler/hbcmplib.c
|
||||
+ added support for setting starting line number in code compiled
|
||||
from memory buffer
|
||||
! removed unnecessary EF_CANDEFULT flag from recently added
|
||||
compiler RTE
|
||||
|
||||
2011-10-20 20:19 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbpp.h
|
||||
* harbour/include/hbcomp.h
|
||||
|
||||
@@ -266,7 +266,7 @@ extern HB_BOOL hb_compCheckUnclosedStru( HB_COMP_DECL, PFUNCTION );
|
||||
#define HB_GEN_FUNC4( func, p1,p2,p3,p4 ) hb_compGen##func( p1, p2, p3, p4, HB_COMP_PARAM )
|
||||
|
||||
extern int hb_compMain( int argc, const char * const argv[] );
|
||||
extern int hb_compMainExt( int argc, const char * const argv[], HB_BYTE ** pBufPtr, HB_SIZE * pnSize, const char * szSource, void * cargo, PHB_PP_OPEN_FUNC pOpenFunc, PHB_PP_MSG_FUNC pMsgFunc );
|
||||
extern int hb_compMainExt( int argc, const char * const argv[], HB_BYTE ** pBufPtr, HB_SIZE * pnSize, const char * szSource, int iStartLine, void * cargo, PHB_PP_OPEN_FUNC pOpenFunc, PHB_PP_MSG_FUNC pMsgFunc );
|
||||
extern void hb_compOutStd( HB_COMP_DECL, const char * szMessage );
|
||||
extern void hb_compOutErr( HB_COMP_DECL, const char * szMessage );
|
||||
|
||||
|
||||
@@ -664,7 +664,7 @@ extern HB_EXPORT void hb_pp_setStdRules( PHB_PP_STATE pState );
|
||||
extern HB_EXPORT void hb_pp_setStdBase( PHB_PP_STATE pState );
|
||||
extern HB_EXPORT void hb_pp_setStream( PHB_PP_STATE pState, int iMode );
|
||||
extern HB_EXPORT void hb_pp_addSearchPath( PHB_PP_STATE pState, const char * szPath, HB_BOOL fReplace );
|
||||
extern HB_EXPORT HB_BOOL hb_pp_inBuffer( PHB_PP_STATE pState, const char * pBuffer, HB_SIZE nLen );
|
||||
extern HB_EXPORT HB_BOOL hb_pp_inBuffer( PHB_PP_STATE pState, const char * pBuffer, HB_SIZE nLen, int iStartLine );
|
||||
extern HB_EXPORT HB_BOOL hb_pp_inFile( PHB_PP_STATE pState, const char * szFileName, HB_BOOL fSearchPath, FILE * file_in, HB_BOOL fError );
|
||||
extern HB_EXPORT HB_BOOL hb_pp_outFile( PHB_PP_STATE pState, const char * szOutFileName, FILE * file_out );
|
||||
extern HB_EXPORT HB_BOOL hb_pp_traceFile( PHB_PP_STATE pState, const char * szTraceFileName, FILE * file_trace );
|
||||
|
||||
@@ -74,8 +74,8 @@ static void s_pp_msg( void * cargo, int iErrorFmt, int iLine,
|
||||
hb_snprintf( szLine, sizeof( szLine ),
|
||||
iErrorFmt == HB_ERRORFMT_CLIPPER ? "%s(%i)" : "%s:%i",
|
||||
szModule, iLine );
|
||||
pError = hb_errRT_New( ES_ERROR, "COMPILER", 1001, ( HB_ERRCODE ) iValue, szMsgBuf,
|
||||
szLine, 0 /*OsCode*/, EF_NONE | EF_CANDEFAULT );
|
||||
pError = hb_errRT_New( ES_ERROR, "COMPILER", 1001, ( HB_ERRCODE ) iValue,
|
||||
szMsgBuf, szLine, 0 /*OsCode*/, EF_NONE );
|
||||
hb_errLaunch( pError );
|
||||
hb_errRelease( pError );
|
||||
}
|
||||
@@ -210,7 +210,7 @@ HB_FUNC( HB_COMPILE )
|
||||
PHB_PP_MSG_FUNC pMsgFunc;
|
||||
|
||||
hb_compGenArgList( 1, hb_pcount(), &argc, &argv, &pIncItem, &pOpenFunc, &pMsgFunc );
|
||||
hb_retni( hb_compMainExt( argc, argv, NULL, NULL, NULL, pIncItem, pOpenFunc, pMsgFunc ) );
|
||||
hb_retni( hb_compMainExt( argc, argv, NULL, NULL, NULL, 0, pIncItem, pOpenFunc, pMsgFunc ) );
|
||||
hb_xfree( argv );
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ HB_FUNC( HB_COMPILEBUF )
|
||||
HB_SIZE nLen;
|
||||
|
||||
hb_compGenArgList( 1, hb_pcount(), &argc, &argv, &pIncItem, &pOpenFunc, &pMsgFunc );
|
||||
iResult = hb_compMainExt( argc, argv, &pBuffer, &nLen, NULL, pIncItem, pOpenFunc, pMsgFunc );
|
||||
iResult = hb_compMainExt( argc, argv, &pBuffer, &nLen, NULL, 0, pIncItem, pOpenFunc, pMsgFunc );
|
||||
hb_xfree( argv );
|
||||
|
||||
if( iResult == EXIT_SUCCESS && pBuffer )
|
||||
@@ -247,7 +247,7 @@ HB_FUNC( HB_COMPILEFROMBUF )
|
||||
if( szSource )
|
||||
{
|
||||
hb_compGenArgList( 2, hb_pcount(), &argc, &argv, &pIncItem, &pOpenFunc, &pMsgFunc );
|
||||
iResult = hb_compMainExt( argc, argv, &pBuffer, &nLen, szSource, pIncItem, pOpenFunc, pMsgFunc );
|
||||
iResult = hb_compMainExt( argc, argv, &pBuffer, &nLen, szSource, 0, pIncItem, pOpenFunc, pMsgFunc );
|
||||
hb_xfree( argv );
|
||||
|
||||
if( iResult == EXIT_SUCCESS && pBuffer )
|
||||
|
||||
@@ -54,14 +54,14 @@
|
||||
#include "hbcomp.h"
|
||||
#include "hbhash.h"
|
||||
|
||||
static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuffer );
|
||||
static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuffer, int iStartLine );
|
||||
static HB_BOOL hb_compRegisterFunc( HB_COMP_DECL, PFUNCTION pFunc, HB_BOOL fError );
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
int hb_compMainExt( int argc, const char * const argv[],
|
||||
HB_BYTE ** pBufPtr, HB_SIZE * pnSize,
|
||||
const char * szSource,
|
||||
const char * szSource, int iStartLine,
|
||||
void * cargo, PHB_PP_OPEN_FUNC pOpenFunc,
|
||||
PHB_PP_MSG_FUNC pMsgFunc )
|
||||
{
|
||||
@@ -138,7 +138,7 @@ int hb_compMainExt( int argc, const char * const argv[],
|
||||
if( szSource )
|
||||
{
|
||||
bAnyFiles = HB_TRUE;
|
||||
iStatus = hb_compCompile( HB_COMP_PARAM, "{SOURCE}", szSource );
|
||||
iStatus = hb_compCompile( HB_COMP_PARAM, "{SOURCE}", szSource, iStartLine );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -149,7 +149,7 @@ int hb_compMainExt( int argc, const char * const argv[],
|
||||
if( ! HB_ISOPTSEP( argv[ i ][ 0 ] ) )
|
||||
{
|
||||
bAnyFiles = HB_TRUE;
|
||||
iStatus = hb_compCompile( HB_COMP_PARAM, argv[ i ], NULL );
|
||||
iStatus = hb_compCompile( HB_COMP_PARAM, argv[ i ], NULL, 0 );
|
||||
if( iStatus != EXIT_SUCCESS )
|
||||
break;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ int hb_compMainExt( int argc, const char * const argv[],
|
||||
|
||||
int hb_compMain( int argc, const char * const argv[] )
|
||||
{
|
||||
return hb_compMainExt( argc, argv, NULL, NULL, NULL, NULL, NULL, NULL );
|
||||
return hb_compMainExt( argc, argv, NULL, NULL, NULL, 0, NULL, NULL, NULL );
|
||||
}
|
||||
|
||||
static int hb_compReadClpFile( HB_COMP_DECL, const char * szClpFile )
|
||||
@@ -4054,7 +4054,7 @@ static void hb_compRestoreSwitches( HB_COMP_DECL, PHB_COMP_SWITCHES pSwitches )
|
||||
HB_COMP_PARAM->supported = pSwitches->supported;
|
||||
}
|
||||
|
||||
static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuffer )
|
||||
static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuffer, int iStartLine )
|
||||
{
|
||||
char buffer[ HB_PATH_MAX * 2 + 80 ];
|
||||
HB_COMP_SWITCHES switches;
|
||||
@@ -4063,7 +4063,7 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuff
|
||||
PHB_MODULE pModule;
|
||||
HB_BOOL fGenCode = HB_TRUE;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compCompile(%s,%p)", szPrg, szBuffer));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_compCompile(%s,%p,%d)", szPrg, szBuffer, iStartLine));
|
||||
|
||||
hb_compSaveSwitches( HB_COMP_PARAM, &switches );
|
||||
/* Initialize support variables */
|
||||
@@ -4113,7 +4113,7 @@ static int hb_compCompile( HB_COMP_DECL, const char * szPrg, const char * szBuff
|
||||
|
||||
if( szBuffer )
|
||||
{
|
||||
if( !hb_pp_inBuffer( HB_COMP_PARAM->pLex->pPP, szBuffer, strlen( szBuffer ) ) )
|
||||
if( !hb_pp_inBuffer( HB_COMP_PARAM->pLex->pPP, szBuffer, strlen( szBuffer ), iStartLine ) )
|
||||
{
|
||||
hb_compOutErr( HB_COMP_PARAM, "Cannot create preprocessor buffer." );
|
||||
iStatus = EXIT_FAILURE;
|
||||
|
||||
@@ -5316,7 +5316,7 @@ static void hb_pp_preprocessToken( PHB_PP_STATE pState )
|
||||
{
|
||||
hb_pp_directiveNew( pState, pToken, HB_PP_CMP_CASE, HB_TRUE, fDirect, HB_TRUE );
|
||||
}
|
||||
/* Clipper PP does not accept #line and generate error */
|
||||
/* Clipper PP does not accept #line and generates error */
|
||||
else if( hb_pp_tokenValueCmp( pToken, "LINE", HB_PP_CMP_DBASE ) )
|
||||
{
|
||||
/* ignore #line directives */
|
||||
@@ -5694,13 +5694,15 @@ void hb_pp_readRules( PHB_PP_STATE pState, const char * szRulesFile )
|
||||
/*
|
||||
* close all open input files and set the given buffer as input stream
|
||||
*/
|
||||
HB_BOOL hb_pp_inBuffer( PHB_PP_STATE pState, const char * pBuffer, HB_SIZE nLen )
|
||||
HB_BOOL hb_pp_inBuffer( PHB_PP_STATE pState, const char * pBuffer, HB_SIZE nLen, int iStartLine )
|
||||
{
|
||||
hb_pp_InFileFree( pState );
|
||||
|
||||
pState->fError = HB_FALSE;
|
||||
|
||||
pState->pFile = hb_pp_FileBufNew( pBuffer, nLen );
|
||||
pState->pFile->iCurrentLine = iStartLine;
|
||||
pState->pFile->iLastLine = iStartLine + 1;
|
||||
pState->iFiles++;
|
||||
return HB_TRUE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user