ChangeLog 20000116-15:35 GMT+1

This commit is contained in:
Ryszard Glab
2000-01-16 14:23:07 +00:00
parent c3b93b4fb1
commit a28cf6b8b9
9 changed files with 114 additions and 12 deletions

View File

@@ -1,3 +1,29 @@
20000116-15:35 GMT+1 Ryszard Glab <rglab@imid.med.pl>
*include/hberrors.h
* added WARN_DUPL_ANNOUNCE
* added ERR_FUNC_ANNOUNCE
*include/compiler.h
* added declaration of hb_compAnnounce( char * )
which creates an ANNOUNCEd procedure
*source/compiler/hbgenerr.c
* added warning when redundant ANNOUNCE statement is used
* added error message when ANNUNCEd procedure is declared STATIC
*source/compiler/harbour.y
*source/compiler/harbour.l
*source/compiler/harbour.c
* fixed support for ANNOUNCE statement
(static variables are no longer bound to ANNOUNCEd procedure)
*source/pp/table.c
* removed fixed translation of ANNOUNCE statement
*source/compiler/cmdcheck.c
* restored correct support for '-w' compiler switch
20000115-20:3 GMT+3 Luiz Rafael Culik <culik@sl.conex.net>
*source/rtl/arrays.c
*source/rtl/type.c

View File

@@ -161,6 +161,7 @@ extern void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, in
extern PFUNCTION hb_compFunctionFind( char * szFunName ); /* locates a previously defined function */
extern USHORT hb_compFunctionGetPos( char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */
extern PFUNCTION hb_compFunctionKill( PFUNCTION ); /* releases all memory allocated by function and returns the next one */
extern void hb_compAnnounce( char * );
extern PFUNCTION hb_compFunCallAdd( char * szFuntionName );
extern PFUNCTION hb_compFunCallFind( char * szFunName ); /* locates a previously defined called function */

View File

@@ -82,6 +82,7 @@
#define ERR_INVALID_BOUND 41
#define ERR_BAD_MACRO 42
#define ERR_INVALID_SEND 43
#define ERR_FUNC_ANNOUNCE 44
#define WARN_AMBIGUOUS_VAR 1
#define WARN_MEMVAR_ASSUMED 2
@@ -100,6 +101,7 @@
#define WARN_NUMERIC_SUSPECT 15
#define WARN_MEANINGLESS 16
#define WARN_UNREACHABLE 17
#define WARN_DUPL_ANNOUNCE 18
/*
* Errors generated by Harbour preprocessor

View File

@@ -408,7 +408,13 @@ void hb_compChkEnvironVar( char * szSwitch )
case 'w':
case 'W':
hb_comp_bAnyWarning = TRUE;
hb_comp_iWarnings = 1;
if( s[ 1 ] )
{ /*there is -w<0,1,2,3> probably */
hb_comp_iWarnings = s[ 1 ] - '0';
if( hb_comp_iWarnings < 0 || hb_comp_iWarnings > 3 )
hb_compGenError( hb_comp_szErrors, 'F', ERR_BADOPTION, s, NULL );
}
break;
case 'x':

View File

@@ -689,8 +689,6 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType )
pSym = hb_compSymbolAdd( szFunName, NULL );
if( cScope != FS_PUBLIC )
/* pSym->cScope = FS_PUBLIC; */
/* else */
pSym->cScope |= cScope; /* we may have a non public function and a object message */
pFunc = hb_compFunctionNew( szFunName, cScope );
@@ -723,6 +721,50 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType )
}
}
/* create an ANNOUNCEd procedure
*/
void hb_compAnnounce( char * szFunName )
{
PFUNCTION pFunc;
pFunc = hb_compFunctionFind( szFunName );
if( pFunc )
{
/* there is a function/procedure defined already - ANNOUNCEd procedure
* have to be a public symbol - check if existing symbol is public
*/
if( pFunc->cScope & FS_STATIC )
hb_compGenError( hb_comp_szErrors, 'F', ERR_FUNC_ANNOUNCE, szFunName, NULL );
}
else
{
PCOMSYMBOL pSym;
/* create a new procedure
*/
pSym = hb_compSymbolAdd( szFunName, NULL );
pSym->cScope = FS_PUBLIC;
pFunc = hb_compFunctionNew( szFunName, FS_PUBLIC );
pFunc->bFlags |= FUN_PROCEDURE;
if( hb_comp_functions.iCount == 0 )
{
hb_comp_functions.pFirst = pFunc;
hb_comp_functions.pLast = pFunc;
}
else
{
hb_comp_functions.pLast->pNext = pFunc;
hb_comp_functions.pLast = pFunc;
}
hb_comp_functions.iCount++;
/* this function have a very limited functionality
*/
hb_compGenPCode1( HB_P_ENDPROC );
}
}
PFUNCTION hb_compFunctionKill( PFUNCTION pFunc )
{
@@ -1721,7 +1763,7 @@ void hb_compGenPushAliasedVar( char * szVarName,
}
}
else
/* Alias is already placed on stack
/* Alias is already placed on stack
* NOTE: An alias will be determined at runtime then we cannot decide
* here if passed name is either a field or a memvar
*/

View File

@@ -233,6 +233,10 @@ Separator {SpaceTab}
%{
/* ************************************************************************ */
%}
"anno"("unce"|"unc"|"un"|"u")? return ANNOUNCE;
%{
/* ************************************************************************ */
%}
"begin"{Separator}+"sequ"("ence"|"enc"|"en"|"e")? return BEGINSEQ;
%{
/* ************************************************************************ */

View File

@@ -127,6 +127,8 @@ USHORT hb_comp_wCaseCounter = 0;
static PTR_LOOPEXIT hb_comp_pLoops = NULL;
static HB_RTVAR_PTR hb_comp_rtvars = NULL;
static char * hb_comp_szAnnounce = NULL; /* ANNOUNCEd procedure */
%}
%union /* special structure used by lex and yacc to share info */
@@ -157,7 +159,7 @@ static HB_RTVAR_PTR hb_comp_rtvars = NULL;
%token FUNCTION PROCEDURE IDENTIFIER RETURN NIL NUM_DOUBLE INASSIGN NUM_INTEGER NUM_LONG
%token LOCAL STATIC IIF IF ELSE ELSEIF END ENDIF LITERAL TRUEVALUE FALSEVALUE
%token EXTERN INIT EXIT AND OR NOT PUBLIC EQ NE1 NE2
%token ANNOUNCE EXTERN INIT EXIT AND OR NOT PUBLIC EQ NE1 NE2
%token INC DEC ALIASOP DOCASE CASE OTHERWISE ENDCASE ENDDO MEMVAR
%token WHILE EXIT LOOP END FOR NEXT TO STEP LE GE FIELD IN PARAMETERS
%token PLUSEQ MINUSEQ MULTEQ DIVEQ POWER EXPEQ MODEQ EXITLOOP
@@ -347,6 +349,21 @@ Statement : ExecFlow CrlfStmnt { }
| EXITLOOP CrlfStmnt { hb_compLoopExit(); hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
| LOOP CrlfStmnt { hb_compLoopLoop(); hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
| EXTERN ExtList CrlfStmnt
| ANNOUNCE IDENTIFIER {
if( hb_comp_szAnnounce == NULL )
{
/* check for reserved name
* NOTE: Clipper doesn't check for it
*/
char * szFunction = hb_compReservedName( $2 );
if( szFunction )
hb_compGenError( hb_comp_szErrors, 'E', ERR_FUNC_RESERVED, szFunction, $2 );
hb_comp_szAnnounce = $2;
}
else
hb_compGenWarning( hb_comp_szWarnings, 'W', WARN_DUPL_ANNOUNCE, $2, NULL );
} Crlf
;
CrlfStmnt : { hb_compLinePushIfInside(); } Crlf
@@ -1432,6 +1449,9 @@ int hb_compYACCMain( char * szName )
++hb_comp_functions.iCount;
}
if( hb_comp_szAnnounce )
hb_compAnnounce( hb_comp_szAnnounce );
/* Close processed file (it is opened in hb_compInclude() function )
*/
fclose( yyin );
@@ -1809,7 +1829,7 @@ static void hb_compVariableDim( char * szName, HB_EXPR_PTR pInitValue )
USHORT uCount = hb_compExprListLen( pInitValue );
HB_EXPR_PTR pVar = hb_compExprNewVar( szName );
HB_EXPR_PTR pAssign;
hb_compStaticDefStart(); /* switch to statics pcode buffer */
/* create a static variable */
hb_compVariableAdd( szName, 'A' );
@@ -1827,10 +1847,10 @@ static void hb_compVariableDim( char * szName, HB_EXPR_PTR pInitValue )
else
{
USHORT uCount = hb_compExprListLen( pInitValue );
hb_compVariableAdd( szName, 'A' );
hb_compExprDelete( hb_compExprGenPush( pInitValue ) );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ) );
hb_compExprDelete( hb_compExprGenPop( hb_compExprNewVar( szName ) ) );
}
}
}

View File

@@ -80,7 +80,8 @@ char * hb_comp_szErrors[] =
"Invalid array index expression: \'%s\'",
"Bound error: \'%s\'",
"Macro of declared symbol: \'%s\'",
"Invalid selector in send: \'%s\'"
"Invalid selector in send: \'%s\'",
"ANNOUNCEd procedure \'%s\' must be a public symbol"
};
/* Table with parse warnings */
@@ -105,7 +106,8 @@ char * hb_comp_szWarnings[] =
"3Suspicious operand type: \'UnKnown\' expected: \'Logical\'",
"3Suspicious operand type: \'UnKnown\' expected: \'Numeric\'",
"0Meaningless use of expression: \'%s\'",
"1Unreachable code"
"1Unreachable code",
"1Redundant \'ANNOUNCE %s\' statement ignored"
};
void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )

View File

@@ -388,7 +388,6 @@
static COMMANDS sC___237 = {0,"SET","ORDER TO \1A00 [IN \1B40]","ordSetFocus( \1A00 [, \1B30] )",&sC___236 };
static COMMANDS sC___238 = {0,"SET","ORDER TO TAG \1A40 [IN \1B40]","ordSetFocus( \1A30 [, \1B30] )",&sC___237 };
static COMMANDS sC___239 = {0,"SET","ORDER TO","ordSetFocus(0)",&sC___238 };
static COMMANDS sC___240 = {0,"ANNOUNCE","\1A10","procedure \1A00 ; return",&sC___239 };
COMMANDS * hb_pp_topCommand = &sC___240;
COMMANDS * hb_pp_topCommand = &sC___239;
COMMANDS * hb_pp_topTranslate = NULL;