2000-08-28 15:00 UTC+0800 Ron Pinkas <ron@profit-master.com>

* include/hbcomp.h
     + Added: extern void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType );

   * source/compiler/harbour.y
     ! Changed hb_compVariableAdd() to hb_compDeclaredParameterAdd() for Declaration Rules.

   * source/compiler/harbour.c
     ! Moved logic from hb_compVariableAdd() to new hb_compDeclaredParameterAdd() for "dummy" variables (Declaration Parameters).

   * source/compiler/hbpcode.c
     ! Minor corrections.
This commit is contained in:
Ron Pinkas
2000-08-28 22:10:20 +00:00
parent cab11e9fd6
commit dfde3317a5
5 changed files with 521 additions and 516 deletions

View File

@@ -1,3 +1,16 @@
2000-08-28 15:00 UTC+0800 Ron Pinkas <ron@profit-master.com>
* include/hbcomp.h
+ Added: extern void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType );
* source/compiler/harbour.y
! Changed hb_compVariableAdd() to hb_compDeclaredParameterAdd() for Declaration Rules.
* source/compiler/harbour.c
! Moved logic from hb_compVariableAdd() to new hb_compDeclaredParameterAdd() for "dummy" variables (Declaration Parameters).
* source/compiler/hbpcode.c
! Minor corrections.
2000-08-28 12:03 UTC+0800 Brian Hays <bhays@abacuslaw.com>
* contrib/rdd_ads/doc/en/readme.txt
* small formatting changes

View File

@@ -257,6 +257,7 @@ extern PCOMCLASS hb_compClassAdd( char * );
extern PCOMCLASS hb_compClassFind( char * );
extern PCOMDECLARED hb_compMethodAdd( PCOMCLASS pClass, char * );
extern PCOMDECLARED hb_compMethodFind( PCOMCLASS pClass, char * );
extern void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType );
extern void hb_compGenBreak( void ); /* generate code for BREAK statement */

View File

@@ -351,58 +351,46 @@ void hb_compExternAdd( char * szExternName ) /* defines a new extern name */
hb_comp_bExternal = TRUE;
}
void hb_compVariableAdd( char * szVarName, BYTE cValueType )
void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType )
{
PVAR pVar, pLastVar;
PFUNCTION pFunc = hb_comp_functions.pLast;
/* Nothing to do since no warnings requested.*/
if ( hb_comp_iWarnings < 3 )
return;
/* Dummy Var - Parameter Declaration of Declared Function. */
if ( hb_comp_szDeclaredFun )
/* Either a Declared Function Parameter or a Declared Method Parameter. */
if( hb_comp_szDeclaredFun )
{
/* Nothing to do since no warnings requested.*/
if ( hb_comp_iWarnings < 3 )
return;
/* Find the Declared Function owner of this parameter. */
PCOMDECLARED pDeclared = hb_compDeclaredFind( hb_comp_szDeclaredFun );
if ( pDeclared )
{
/* Find the Declared Function owner of this parameter. */
PCOMDECLARED pDeclared = hb_compDeclaredFind( hb_comp_szDeclaredFun );
pDeclared->iParamCount++;
if ( pDeclared )
if ( pDeclared->cParamTypes )
{
pDeclared->iParamCount++;
pDeclared->cParamTypes = ( BYTE * ) hb_xrealloc( pDeclared->cParamTypes, pDeclared->iParamCount );
pDeclared->pParamClasses = ( PCOMCLASS * ) hb_xrealloc( pDeclared->pParamClasses, pDeclared->iParamCount * sizeof( COMCLASS ) );
}
else
{
pDeclared->cParamTypes = ( BYTE * ) hb_xgrab( 1 );
pDeclared->pParamClasses = ( PCOMCLASS * ) hb_xgrab( sizeof( COMCLASS ) );
}
if ( pDeclared->cParamTypes )
{
pDeclared->cParamTypes = ( BYTE * ) hb_xrealloc( pDeclared->cParamTypes, pDeclared->iParamCount );
pDeclared->pParamClasses = ( PCOMCLASS * ) hb_xrealloc( pDeclared->pParamClasses, pDeclared->iParamCount * sizeof( COMCLASS ) );
}
else
{
pDeclared->cParamTypes = ( BYTE * ) hb_xgrab( 1 );
pDeclared->pParamClasses = ( PCOMCLASS * ) hb_xgrab( sizeof( COMCLASS ) );
}
pDeclared->cParamTypes[ pDeclared->iParamCount - 1 ] = cValueType;
pDeclared->cParamTypes[ pDeclared->iParamCount - 1 ] = cValueType;
if ( toupper( cValueType ) == 'S' )
{
pDeclared->pParamClasses[ pDeclared->iParamCount - 1 ] = hb_compClassFind( hb_comp_szFromClass );
if ( toupper( cValueType ) == 'S' )
{
pDeclared->pParamClasses[ pDeclared->iParamCount - 1 ] = hb_compClassFind( hb_comp_szFromClass );
/* Resetting */
hb_comp_szFromClass = NULL;
}
return;
/* Resetting */
hb_comp_szFromClass = NULL;
}
}
}
/* Dummy Var - Parameter Declaration of Declared Method. */
else if ( hb_comp_pLastMethod )
else /* Declared Method Parameter */
{
/* Nothing to do since no warnings requested.*/
if ( hb_comp_iWarnings < 3 )
return;
/*
printf( "\nAdding parameter: %s Type: %c In Method: %s Class: %s FROM CLASS: %s\n", szVarName, cValueType, hb_comp_pLastMethod->szName, hb_comp_pLastClass->szName, hb_comp_szFromClass );
*/
@@ -433,16 +421,18 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType )
/* Resetting */
hb_comp_szFromClass = NULL;
}
return;
}
}
void hb_compVariableAdd( char * szVarName, BYTE cValueType )
{
PVAR pVar, pLastVar;
PFUNCTION pFunc = hb_comp_functions.pLast;
HB_SYMBOL_UNUSED( cValueType );
if( ! hb_comp_bStartProc && hb_comp_functions.iCount <= 1 && hb_comp_iVarScope == VS_LOCAL )
{
printf( "OOPS %s\n", szVarName );
/* Variable declaration is outside of function/procedure body.
In this case only STATIC and PARAMETERS variables are allowed. */
hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL );
@@ -808,12 +798,7 @@ PCOMDECLARED hb_compMethodAdd( PCOMCLASS pClass, char * szMethodName )
/*printf( "\nDeclaring Method: %s of Class: %s Pointer: %li\n", szMethodName, pClass->szName, pClass );*/
if ( hb_comp_iWarnings < 3 )
{
/* So hb_compAddVariable() will know this is a fictitious Var. */
hb_comp_szDeclaredFun = szMethodName;
return NULL;
}
if ( ( pMethod = hb_compMethodFind( pClass, szMethodName ) ) != NULL )
{

View File

@@ -1274,28 +1274,28 @@ DecList : {}
| FormalList OptList
;
FormalList : IdentName AsType { hb_compVariableAdd( $1, hb_comp_cVarType ); }
| '@' IdentName AsType { hb_compVariableAdd( $2, hb_comp_cVarType + VT_OFFSET_BYREF ); }
| '@' IdentName '(' ')' { hb_compVariableAdd( $2, 'F' ); }
| FormalList ',' IdentName AsType { hb_compVariableAdd( $3, hb_comp_cVarType ); }
| FormalList ',' '@' IdentName AsType { hb_compVariableAdd( $4, hb_comp_cVarType + VT_OFFSET_BYREF ); }
| FormalList ',' '@' IdentName '(' ')'{ hb_compVariableAdd( $4, 'F' ); }
FormalList : IdentName AsType { hb_compDeclaredParameterAdd( $1, hb_comp_cVarType ); }
| '@' IdentName AsType { hb_compDeclaredParameterAdd( $2, hb_comp_cVarType + VT_OFFSET_BYREF ); }
| '@' IdentName '(' ')' { hb_compDeclaredParameterAdd( $2, 'F' ); }
| FormalList ',' IdentName AsType { hb_compDeclaredParameterAdd( $3, hb_comp_cVarType ); }
| FormalList ',' '@' IdentName AsType { hb_compDeclaredParameterAdd( $4, hb_comp_cVarType + VT_OFFSET_BYREF ); }
| FormalList ',' '@' IdentName '(' ')'{ hb_compDeclaredParameterAdd( $4, 'F' ); }
;
OptListOnly: OPTIONAL IdentName AsType { hb_compVariableAdd( $2, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| OPTIONAL '@' IdentName AsType { hb_compVariableAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OPTIONAL '@' IdentName '(' ')' { hb_compVariableAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OptListOnly ',' OPTIONAL IdentName AsType { hb_compVariableAdd( $4, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| OptListOnly ',' OPTIONAL '@' IdentName AsType { hb_compVariableAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OptListOnly ',' OPTIONAL '@' IdentName '(' ')'{ hb_compVariableAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
OptListOnly: OPTIONAL IdentName AsType { hb_compDeclaredParameterAdd( $2, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| OPTIONAL '@' IdentName AsType { hb_compDeclaredParameterAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OPTIONAL '@' IdentName '(' ')' { hb_compDeclaredParameterAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OptListOnly ',' OPTIONAL IdentName AsType { hb_compDeclaredParameterAdd( $4, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| OptListOnly ',' OPTIONAL '@' IdentName AsType { hb_compDeclaredParameterAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OptListOnly ',' OPTIONAL '@' IdentName '(' ')'{ hb_compDeclaredParameterAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
;
OptList : ',' OPTIONAL IdentName AsType { hb_compVariableAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| ',' OPTIONAL '@' IdentName AsType { hb_compVariableAdd( $4, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| ',' OPTIONAL '@' IdentName '(' ')' { hb_compVariableAdd( $4, 'F' ); }
| OptList ',' OPTIONAL IdentName AsType { hb_compVariableAdd( $4, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| OptList ',' OPTIONAL '@' IdentName AsType { hb_compVariableAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OptList ',' OPTIONAL '@' IdentName '(' ')'{ hb_compVariableAdd( $5, 'F' ); }
OptList : ',' OPTIONAL IdentName AsType { hb_compDeclaredParameterAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| ',' OPTIONAL '@' IdentName AsType { hb_compDeclaredParameterAdd( $4, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| ',' OPTIONAL '@' IdentName '(' ')' { hb_compDeclaredParameterAdd( $4, 'F' ); }
| OptList ',' OPTIONAL IdentName AsType { hb_compDeclaredParameterAdd( $4, hb_comp_cVarType + VT_OFFSET_OPTIONAL ); }
| OptList ',' OPTIONAL '@' IdentName AsType { hb_compDeclaredParameterAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); }
| OptList ',' OPTIONAL '@' IdentName '(' ')'{ hb_compDeclaredParameterAdd( $5, 'F' ); }
;
ExecFlow : IfEndif

File diff suppressed because it is too large Load Diff