2004-03-18 12:45 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
* include/hberrors.h
* source/pp/ppcore.c
*fixed #define parsing of pseudofunctions in cases where
passed argument has the same name as declared parameter
*fixed #define parsing of pseudofunctions - the following
syntax is not allowed:
#define test(x,x) - duplicated parameters
#define test(x,) - missing parameter
#define test(x - missing parenthes
* source/common/expropt1.c
* fixed generation of pcode for &(macro)->() syntax
* source/compiler/harbour.l
* fixed GPF when string with unmatched terminator was used
* include/hbexprop.h
* source/compiler/harbour.y
* removed direct access to internals of expression
optimizer structure
* source/debug/debugger.prg
* fixed checking of path separator
This commit is contained in:
@@ -8,6 +8,32 @@
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2004-03-18 12:45 UTC+0100 Ryszard Glab <rglab@imid.med.pl>
|
||||
* include/hberrors.h
|
||||
* source/pp/ppcore.c
|
||||
*fixed #define parsing of pseudofunctions in cases where
|
||||
passed argument has the same name as declared parameter
|
||||
*fixed #define parsing of pseudofunctions - the following
|
||||
syntax is not allowed:
|
||||
#define test(x,x) - duplicated parameters
|
||||
#define test(x,) - missing parameter
|
||||
#define test(x - missing parenthes
|
||||
|
||||
* source/common/expropt1.c
|
||||
* fixed generation of pcode for &(macro)->() syntax
|
||||
|
||||
* source/compiler/harbour.l
|
||||
* fixed GPF when string with unmatched terminator was used
|
||||
|
||||
|
||||
* include/hbexprop.h
|
||||
* source/compiler/harbour.y
|
||||
* removed direct access to internals of expression
|
||||
optimizer structure
|
||||
|
||||
* source/debug/debugger.prg
|
||||
* fixed checking of path separator
|
||||
|
||||
2004-03-17 8:14 UTC-0800 Luis Krause Mantilla <lkrausem /*at*/ shaw /*dot*/ ca>
|
||||
* contrib/rdd_sys/ads1.c
|
||||
* reuploaded to CVS (somehow it didn't get through the last time)
|
||||
|
||||
@@ -166,6 +166,9 @@ extern "C" {
|
||||
#define HB_PP_ERR_BAD_RULES_FILE_NAME 16
|
||||
#define HB_PP_ERR_TOO_MANY_INCLUDES 17
|
||||
#define HB_PP_ERR_BUFFER_OVERFLOW 18
|
||||
#define HB_PP_ERR_LABEL_MISSING_IN_DEFINE 19
|
||||
#define HB_PP_ERR_PARE_MISSING_IN_DEFINE 20
|
||||
#define HB_PP_ERR_LABEL_DUPL_IN_DEFINE 21
|
||||
|
||||
#define HB_PP_WARN_DEFINE_REDEF 1
|
||||
#define HB_PP_WARN_NO_DIRECTIVES 2
|
||||
|
||||
@@ -371,6 +371,9 @@ ULONG hb_compExprListLen( HB_EXPR_PTR );
|
||||
void hb_compExprClear( HB_EXPR_PTR );
|
||||
char * hb_compExprDescription( HB_EXPR_PTR );
|
||||
int hb_compExprType( HB_EXPR_PTR );
|
||||
int hb_compExprIsInteger( HB_EXPR_PTR );
|
||||
int hb_compExprAsInteger( HB_EXPR_PTR );
|
||||
char *hb_compExprAsString( HB_EXPR_PTR );
|
||||
|
||||
void hb_compExprFree( HB_EXPR_PTR, HB_MACRO_DECL );
|
||||
void hb_compExprErrorType( HB_EXPR_PTR, HB_MACRO_DECL );
|
||||
|
||||
@@ -216,6 +216,30 @@ HB_EXPR_PTR hb_compExprNewLong( long lValue )
|
||||
return pExpr;
|
||||
}
|
||||
|
||||
int hb_compExprIsInteger( HB_EXPR_PTR pExpr )
|
||||
{
|
||||
return ( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG &&
|
||||
pExpr->value.asNum.lVal >= -32768 && pExpr->value.asNum.lVal <= 32767 );
|
||||
}
|
||||
|
||||
int hb_compExprAsInteger( HB_EXPR_PTR pExpr )
|
||||
{
|
||||
if( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG )
|
||||
return ( int ) pExpr->value.asNum.lVal;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *hb_compExprAsString( HB_EXPR_PTR pExpr )
|
||||
{
|
||||
switch( pExpr->ExprType )
|
||||
{
|
||||
case HB_ET_VARIABLE:
|
||||
return pExpr->value.asSymbol ;
|
||||
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, BOOL isMacro, BOOL lateEval )
|
||||
{
|
||||
@@ -474,7 +498,8 @@ HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR pAlias, HB_EXPR_PTR pExpList )
|
||||
if( pAlias->ExprType == HB_ET_MACRO )
|
||||
{
|
||||
/* Is it a special case &variable->( expressionList ) */
|
||||
if( pAlias->value.asMacro.SubType == HB_ET_MACRO_VAR )
|
||||
if( pAlias->value.asMacro.SubType == HB_ET_MACRO_VAR ||
|
||||
pAlias->value.asMacro.SubType == HB_ET_MACRO_EXPR )
|
||||
pAlias->value.asMacro.SubType = HB_ET_MACRO_ALIASED;
|
||||
}
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ Separator {SpaceTab}
|
||||
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_STRING_TERMINATOR, yytext, NULL );
|
||||
hb_comp_iState = LOOKUP;
|
||||
|
||||
return LITERAL;
|
||||
return NIL;
|
||||
}
|
||||
|
||||
<STRING1>[^'\n]*' { BEGIN 0;
|
||||
@@ -221,7 +221,7 @@ Separator {SpaceTab}
|
||||
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_STRING_TERMINATOR, yytext, NULL );
|
||||
hb_comp_iState = LOOKUP;
|
||||
|
||||
return LITERAL;
|
||||
return NIL;
|
||||
}
|
||||
|
||||
<STRING3>.*\n {
|
||||
@@ -295,7 +295,7 @@ Separator {SpaceTab}
|
||||
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_STRING_TERMINATOR, yytext, NULL );
|
||||
hb_comp_iState = LOOKUP;
|
||||
|
||||
return LITERAL;
|
||||
return NIL;
|
||||
}
|
||||
|
||||
<STRING5>.*\n {
|
||||
|
||||
@@ -1546,22 +1546,17 @@ ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */
|
||||
|
||||
if( $<asExpr>8 )
|
||||
{
|
||||
if( $<asExpr>8->ExprType == HB_ET_NUMERIC && $<asExpr>8->value.asNum.NumType == HB_ET_LONG &&
|
||||
$<asExpr>8->value.asNum.lVal >= -32768 && $<asExpr>8->value.asNum.lVal <= 32767 )
|
||||
{
|
||||
iStep = ( short ) $<asExpr>8->value.asNum.lVal;
|
||||
}
|
||||
if( hb_compExprIsInteger($<asExpr>8) )
|
||||
iStep = hb_compExprAsInteger($<asExpr>8);
|
||||
else
|
||||
{
|
||||
iStep = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iStep = 1;
|
||||
}
|
||||
|
||||
if( iStep && ( iLocal = hb_compLocalGetPos( $<asExpr>2->value.asSymbol ) ) > 0 && iLocal < 256 )
|
||||
if( iStep && ( iLocal = hb_compLocalGetPos( hb_compExprAsString($<asExpr>2) ) ) > 0 && iLocal < 256 )
|
||||
{
|
||||
hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iStep ), HB_HIBYTE( iStep ), ( BOOL ) 0 );
|
||||
}
|
||||
|
||||
@@ -509,7 +509,7 @@ return Self
|
||||
METHOD PathForFiles() CLASS TDebugger
|
||||
|
||||
::cPathForFiles := ::InputBox( "Search path for source files:", ::cPathForFiles )
|
||||
IF RIGHT(::cPathForFiles,1) $ HB_OSPATHDELIMITERS()
|
||||
IF ! RIGHT(::cPathForFiles,1) $ HB_OSPATHDELIMITERS()
|
||||
::cPathForFiles:=::cPathForFiles + HB_OSPATHSEPARATOR()
|
||||
ENDIF
|
||||
|
||||
|
||||
@@ -217,7 +217,10 @@ char * hb_pp_szErrors[] =
|
||||
"Can\'t open command definitions file: \'%s\'",
|
||||
"Invalid command definitions file name: \'%s\'",
|
||||
"Too many nested #includes, can\'t open: \'%s\'",
|
||||
"Input buffer overflow"
|
||||
"Input buffer overflow",
|
||||
"Label missing in #define '%s'",
|
||||
"Comma or right parenthesis missing in #define '%s'",
|
||||
"Label duplicated in #define '%s(%s)'",
|
||||
};
|
||||
|
||||
/* Table with warnings */
|
||||
@@ -535,7 +538,7 @@ int hb_pp_ParseDirective( char * sLine )
|
||||
|
||||
int hb_pp_ParseDefine( char * sLine )
|
||||
{
|
||||
char defname[ MAX_NAME ], pars[ MAX_NAME ];
|
||||
char defname[ MAX_NAME ], pars[ MAX_NAME+1 ];
|
||||
int i, npars = -1;
|
||||
DEFINES * lastdef;
|
||||
|
||||
@@ -544,27 +547,103 @@ int hb_pp_ParseDefine( char * sLine )
|
||||
HB_SKIPTABSPACES( sLine );
|
||||
if( ISNAME( *sLine ) )
|
||||
{
|
||||
char *cParams = NULL;
|
||||
|
||||
NextName( &sLine, defname );
|
||||
if( *sLine == '(' ) /* If pseudofunction was found */
|
||||
{
|
||||
sLine++; i = 0;
|
||||
int iParLen = 0;
|
||||
int iLen;
|
||||
|
||||
sLine++;
|
||||
HB_SKIPTABSPACES( sLine );
|
||||
|
||||
i = 0;
|
||||
npars = 0;
|
||||
while( *sLine != '\0' && *sLine != ')')
|
||||
{
|
||||
if( *sLine == ',' ) npars++;
|
||||
if( *sLine != ' ' && *sLine != '\t' ) *(pars+i++) = *sLine;
|
||||
sLine++;
|
||||
}
|
||||
if( i > 0 ) npars++;
|
||||
*(pars+i) = '\0';
|
||||
while( *sLine && *sLine != ')' )
|
||||
{
|
||||
if( ISNAME(*sLine) )
|
||||
{
|
||||
NextName( &sLine, pars );
|
||||
iLen = strlen( pars );
|
||||
if( cParams == NULL )
|
||||
{
|
||||
/* 'xy0' -> '~xy0' */
|
||||
cParams = hb_xgrab( iLen+2 );
|
||||
}
|
||||
else
|
||||
{
|
||||
/* '~xy0' -> '~xy,~ab0' */
|
||||
char *cPos;
|
||||
cPos = strstr( cParams, pars );
|
||||
if( cPos && (cPos[iLen]==',' || cPos[iLen]=='\0') )
|
||||
{
|
||||
cPos--;
|
||||
if( *cPos == '\001' )
|
||||
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_DUPL_IN_DEFINE, defname, pars );
|
||||
}
|
||||
cParams = hb_xrealloc( cParams, iParLen+iLen+3 );
|
||||
cParams[iParLen++] = ',';
|
||||
cParams[iParLen] = '\0';
|
||||
}
|
||||
cParams[iParLen] = '\001';
|
||||
strcpy( cParams+iParLen+1, pars );
|
||||
iParLen += iLen+1;
|
||||
npars++;
|
||||
HB_SKIPTABSPACES( sLine );
|
||||
}
|
||||
else
|
||||
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_MISSING_IN_DEFINE, defname, NULL );
|
||||
|
||||
if( *sLine == ',' )
|
||||
{
|
||||
sLine++;
|
||||
HB_SKIPTABSPACES( sLine );
|
||||
if( *sLine == ')' )
|
||||
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_MISSING_IN_DEFINE, defname, NULL );
|
||||
}
|
||||
}
|
||||
sLine++;
|
||||
}
|
||||
|
||||
HB_SKIPTABSPACES(sLine);
|
||||
if( *sLine == '\0' )
|
||||
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PARE_MISSING_IN_DEFINE, defname, NULL );
|
||||
|
||||
if( cParams )
|
||||
{
|
||||
char *tmp = cParams;
|
||||
char *cPos;
|
||||
int iPar, iLen, iPos, iOldPos;
|
||||
|
||||
iLen = strlen( sLine );
|
||||
for(i=0; i<npars; i++ )
|
||||
{
|
||||
/*1z,1y*/
|
||||
cPos =strchr( tmp, ',' );
|
||||
if( cPos )
|
||||
iPar = cPos - tmp;
|
||||
else
|
||||
iPar = strlen( tmp );
|
||||
memcpy( pars, tmp, iPar );
|
||||
pars[ iPar ] = '\0';
|
||||
iPos = iOldPos = 0;
|
||||
while( (iPos = md_strAt( pars+1, iPar-1, sLine+iOldPos, TRUE, FALSE, FALSE )) )
|
||||
{
|
||||
if( sLine[iOldPos+iPos] != '\001' )
|
||||
{
|
||||
hb_pp_Stuff( pars, sLine+iOldPos+iPos-1, iPar, iPar-1, iLen-iPos );
|
||||
iLen++;
|
||||
}
|
||||
iOldPos +=iPos + iPar;
|
||||
}
|
||||
tmp = cPos+1;
|
||||
}
|
||||
}
|
||||
lastdef = hb_pp_AddDefine( defname, ( *sLine == '\0' ) ? NULL : sLine );
|
||||
|
||||
lastdef->npars = npars;
|
||||
lastdef->pars = ( npars <= 0 ) ? NULL : hb_strdup( pars );
|
||||
lastdef->pars = cParams;
|
||||
}
|
||||
else
|
||||
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_DEFINE_ABSENT, NULL, NULL );
|
||||
|
||||
Reference in New Issue
Block a user