ChangeLog 20000425-12:40 GMT+1

This commit is contained in:
Ryszard Glab
2000-04-25 10:37:40 +00:00
parent 0eac82ed2d
commit 9f23de3925
9 changed files with 78 additions and 37 deletions

View File

@@ -1,3 +1,25 @@
20000425-12:40 GMT+1 Ryszard Glab <rglab@imid.med.pl>
*include/hbcomp.h
*source/compiler/harbour.c
*source/compiler/harbour.l
*source/compiler/harbour.y
*source/compiler/hbgenerr.c
*source/pp/ppcore.c
* fixed STATIC var[ <value> ] declaration
* fixed DO &(<name>) WITH ... syntax
* fixed reporting of line numbers in errors/warnings messages
NOTE: fix in ppcore.c needs Alexander to review it - anyway
empty lines cannot be buffered by a preprocessor (see
hb_pp_nEmptyStrings)
*source/rtl/gtstd/gtstd.c
* removed atexit() call when HB_OS_UNIX is defined
*source/vm/hvm.c
* <windows.h> can be included only if HB_OS_WIN_32 is defined
20000425-11:36 GMT+1 Antonio Linares <alinares@fivetech.com>
+ source/vm/startup.asm
Harbour startup for Win32 when not using any C compiler startup

View File

@@ -375,6 +375,8 @@ extern USHORT hb_comp_wIfCounter;
extern USHORT hb_comp_wWhileCounter;
extern USHORT hb_comp_wCaseCounter;
extern BOOL hb_comp_EOL;
extern char * hb_comp_szErrors[];
extern char * hb_comp_szWarnings[];

View File

@@ -107,7 +107,6 @@ int hb_comp_iErrorCount;
char hb_comp_cVarType; /* current declared variable type */
BOOL hb_comp_bDontGenLineNum = FALSE; /* suppress line number generation */
ULONG hb_comp_ulLastLinePos; /* position of last opcode with line number */
ULONG hb_comp_ulMessageFix; /* Position of the message which needs to be changed */
int hb_comp_iStaticCnt; /* number of defined statics variables on the PRG */
int hb_comp_iVarScope; /* holds the scope for next variables to be defined */
PHB_FNAME hb_comp_pOutPath = NULL;
@@ -116,6 +115,7 @@ BOOL hb_comp_bLogo = TRUE; /* print logo */
BOOL hb_comp_bSyntaxCheckOnly = FALSE; /* syntax check only */
int hb_comp_iLanguage = LANG_C; /* default Harbour generated output language */
int hb_comp_iJumpOptimize = 1;
BOOL hb_comp_EOL;
typedef struct __EXTERN
{
@@ -427,7 +427,6 @@ void hb_compVariableAdd( char * szVarName, char cValueType )
{
/* Variable declaration is outside of function/procedure body.
In this case only STATIC and PARAMETERS variables are allowed. */
--hb_comp_iLine;
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL );
return;
}
@@ -438,7 +437,6 @@ void hb_compVariableAdd( char * szVarName, char cValueType )
*/
if( ( hb_comp_functions.pLast->bFlags & FUN_STATEMENTS ) && !( hb_comp_iVarScope == VS_FIELD || ( hb_comp_iVarScope & VS_MEMVAR ) ) )
{
--hb_comp_iLine;
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_FOLLOWS_EXEC, ( hb_comp_iVarScope == VS_LOCAL ? "LOCAL" : "STATIC" ), NULL );
}
@@ -448,7 +446,10 @@ void hb_compVariableAdd( char * szVarName, char cValueType )
/* variable defined in a function/procedure */
hb_compCheckDuplVars( pFunc->pFields, szVarName, hb_comp_iVarScope );
hb_compCheckDuplVars( pFunc->pStatics, szVarName, hb_comp_iVarScope );
if( !( hb_comp_iVarScope & VS_PRIVATE || hb_comp_iVarScope == VS_PUBLIC ) )
/*NOTE: Clipper warns if PARAMETER variable duplicates the MEMVAR
* declaration
*/
if( !( hb_comp_iVarScope == VS_PRIVATE || hb_comp_iVarScope == VS_PUBLIC ) )
hb_compCheckDuplVars( pFunc->pMemvars, szVarName, hb_comp_iVarScope );
}
else
@@ -2310,8 +2311,6 @@ static void hb_compCheckDuplVars( PVAR pVar, char * szVarName, int iVarScope )
{
if( ! strcmp( pVar->szName, szVarName ) )
{
if( ! ( iVarScope & VS_PARAMETER ) )
--hb_comp_iLine;
hb_compErrorDuplVar( szVarName );
break;
}
@@ -2883,9 +2882,9 @@ static void hb_compInitVars( void )
hb_comp_iErrorCount = 0;
hb_comp_cVarType = ' ';
hb_comp_ulLastLinePos = 0;
hb_comp_ulMessageFix = 0;
hb_comp_iStaticCnt = 0;
hb_comp_iVarScope = VS_LOCAL;
hb_comp_EOL = FALSE;
}
static void hb_compGenOutput( int iLanguage )

View File

@@ -1264,10 +1264,11 @@ Separator {SpaceTab}
if( i_INDEX_STATE ) BEGIN INDEX; else BEGIN 0;
unput( yytext[ yyleng-1 ] );
if( hb_comp_iState == WHILE ||
hb_comp_iState == DO ||
hb_comp_iState == MACROVAR ||
hb_comp_iState == MACROTEXT ||
hb_comp_iState == IDENTIFIER )
hb_comp_iState == DO ||
hb_comp_iState == MACROVAR ||
hb_comp_iState == MACROTEXT ||
hb_comp_iState == IDENTIFIER ||
hb_comp_iState == SEPARATOR )
{ /* DO <ident> WITH <arg> */
hb_comp_iState =WITH;
return WITH;

View File

@@ -237,21 +237,21 @@ Main : { hb_compLinePush(); } Source { }
| /* empty file */
;
Source : Crlf
| VarDefs
| FieldsDef
| MemvarDef
| Function
| Statement
| Line
| Source Crlf
| Source Function
| Source Statement
| Source VarDefs
| Source FieldsDef
| Source MemvarDef
| Source Line
| Source error Crlf { yyclearin; }
Source : Crlf { hb_comp_EOL = FALSE; }
| VarDefs { hb_comp_EOL = FALSE; }
| FieldsDef { hb_comp_EOL = FALSE; }
| MemvarDef { hb_comp_EOL = FALSE; }
| Function { hb_comp_EOL = FALSE; }
| Statement { hb_comp_EOL = FALSE; }
| Line { hb_comp_EOL = FALSE; }
| Source Crlf { hb_comp_EOL = FALSE; }
| Source Function { hb_comp_EOL = FALSE; }
| Source Statement { hb_comp_EOL = FALSE; }
| Source VarDefs { hb_comp_EOL = FALSE; }
| Source FieldsDef { hb_comp_EOL = FALSE; }
| Source MemvarDef { hb_comp_EOL = FALSE; }
| Source Line { hb_comp_EOL = FALSE; }
| Source error Crlf { hb_comp_EOL = FALSE; yyclearin; }
;
Line : LINE NUM_INTEGER LITERAL Crlf
@@ -303,7 +303,7 @@ Statement : ExecFlow CrlfStmnt { }
| ExprPostOp CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); }
| ExprOperEq CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); }
| ExprEqual CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); }
| ExprAssign CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); }
| ExprAssign CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); }
| DoProc CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); }
| BREAK CrlfStmnt { hb_compGenBreak(); hb_compGenPCode2( HB_P_DOSHORT, 0 );
hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; }
@@ -1128,8 +1128,8 @@ IfEndif : IfBegin EndIf { hb_compGenJumpHere( $1 ); }
| IfBegin IfElseIf IfElse EndIf { hb_compGenJumpHere( $1 ); hb_compElseIfFix( $2 ); }
;
EmptyStats : /* empty */ { hb_comp_bDontGenLineNum = TRUE; }
| Statements
EmptyStats : /* empty */ { hb_comp_bDontGenLineNum = TRUE; hb_comp_EOL = FALSE; }
| Statements { hb_comp_EOL = FALSE; }
;
IfBegin : IF SimpleExpression { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); hb_compLinePush(); }
@@ -1202,7 +1202,6 @@ DoCaseBegin : DoCaseStart { }
| DoCaseStart Statements {
if( $<lNumber>2 > 0 )
{
--hb_comp_iLine;
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL );
}
}
@@ -1413,7 +1412,7 @@ DoArgument : IdentName { $$ = hb_compExprNewVarRef( $1 ); }
| PareExpList { $$ = $1; }
;
Crlf : '\n' { ++hb_comp_iLine; }
Crlf : '\n' { ++hb_comp_iLine; hb_comp_EOL = TRUE; }
| ';' { hb_comp_bDontGenLineNum = TRUE; }
;
@@ -1477,6 +1476,7 @@ int hb_compYACCMain( char * szName )
void yyerror( char * s )
{
hb_comp_EOL = FALSE; /* we are in the middle of a line */
if( yytext[ 0 ] == '\n' )
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_YACC, s, "<eol>" );
else
@@ -1863,9 +1863,9 @@ static void hb_compVariableDim( char * szName, HB_EXPR_PTR 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' );
hb_compStaticDefStart(); /* switch to statics pcode buffer */
/* create an array */
hb_compExprGenPush( pInitValue );
hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ) );

View File

@@ -113,9 +113,12 @@ char * hb_comp_szWarnings[] =
void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szError1, char * szError2 )
{
int iLine = hb_comp_iLine;
if( hb_comp_EOL )
--iLine;
if( hb_comp_files.pLast != NULL && hb_comp_files.pLast->szFileName != NULL )
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_iLine + hb_pp_nEmptyStrings );
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, iLine + hb_pp_nEmptyStrings );
printf( "Error %c%04i ", cPrefix, iError );
printf( szErrors[ iError - 1 ], szError1, szError2 );
printf( "\n" );
@@ -130,11 +133,15 @@ void hb_compGenError( char * szErrors[], char cPrefix, int iError, char * szErro
void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2)
{
char * szText = szWarnings[ iWarning - 1 ];
int iLine = hb_comp_iLine;
if( hb_comp_EOL )
--iLine;
if( ( szText[ 0 ] - '0' ) <= hb_comp_iWarnings )
{
if( hb_comp_files.pLast != NULL && hb_comp_files.pLast->szFileName != NULL )
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, hb_comp_iLine + hb_pp_nEmptyStrings );
printf( "\r%s(%i) ", hb_comp_files.pLast->szFileName, iLine + hb_pp_nEmptyStrings );
printf( "Warning %c%04i ", cPrefix, iWarning );
printf( szText + 1, szWarning1, szWarning2 );
printf( "\n" );

View File

@@ -2047,6 +2047,13 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lDropSpaces, ch
}
}
while(--readed >= 0 && ( buffer[readed] == ' ' || buffer[readed] == '\t') );
/* rglab: start */
if( cha == '\n' && readed < 0 )
{
readed = 0;
buffer[ readed ] = ' '; /* return an empty line */
}
/* rglab: end */
if( buffer[readed] != ';' && s_ParseState != STATE_COMMENT )
s_ParseState = STATE_NORMAL;
readed++;

View File

@@ -70,7 +70,7 @@ void hb_gt_Init( int iFilenoStdin, int iFilenoStdout, int iFilenoStderr )
struct termios ta;
tcgetattr( STDIN_FILENO, &startup_attributes );
atexit( restore_input_mode );
// atexit( restore_input_mode );
tcgetattr( STDIN_FILENO, &ta );
ta.c_lflag &= ~( ICANON | ECHO );

View File

@@ -69,7 +69,10 @@
#include "hbpcode.h"
#include "hbset.h"
#include <windows.h>
#ifdef HB_OS_WIN_32
/* do not include it on U*ix and pure DOS */
#include <windows.h>
#endif
typedef struct _SYMBOLS
{