ChangeLog 19991120-14:35 GMT+1
This commit is contained in:
@@ -1,3 +1,41 @@
|
||||
19991120-14:35 GMT+1 Ryszard Glab <rglab@imid.med.pl>
|
||||
|
||||
*source/compiler/harbour.y
|
||||
* fixed NOT operator precedence
|
||||
* fixed the infinite loop when a duplicated variable error
|
||||
was reported
|
||||
* fixed '=' operator use (there was conflict between a compare
|
||||
and assignment context)
|
||||
* added new warning "Unreachable code'
|
||||
* fatal errors (errors for which the compilation process should
|
||||
terminate immediately should use 'F' prefix)
|
||||
* corrected logic of handling errors (the compilation can be continued
|
||||
with no GPF or core dump)
|
||||
|
||||
*source/compiler/expropt.c
|
||||
* corrected to support 'DO procname' statement
|
||||
|
||||
*include/compiler.h
|
||||
*source/compiler/harbour.y
|
||||
*source/compiler/harbour.c
|
||||
*source/compiler/expropt.c
|
||||
*source/compiler/genc.c
|
||||
*source/compiler/genhrb.c
|
||||
*source/compiler/genjava.c
|
||||
*source/compiler/genobj32.c
|
||||
* finished uniform naming scheme hb_comp*
|
||||
* cleared up declarations and visibility of functions and variables
|
||||
|
||||
*include/hberrors.h
|
||||
* added new warning "Unreachable code'
|
||||
|
||||
*source/debug/debugger.prg
|
||||
* removed one unreachable RETURN statement
|
||||
|
||||
*source/pp/hbpp.c
|
||||
* all errors reported by the preprocesor are promoted to fatal
|
||||
errors ('F' prefix)
|
||||
|
||||
19991119-16:59 GMT+1 Antonio Linares
|
||||
* updated makefile.b32
|
||||
* updated hbpp.b32
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "hberrors.h"
|
||||
#include "hbpp.h"
|
||||
#include "hbver.h"
|
||||
#include "hbfsapi.h"
|
||||
|
||||
/* compiler related declarations */
|
||||
|
||||
@@ -183,10 +182,6 @@ typedef struct HB_EXPR_
|
||||
} HB_EXPR, *HB_EXPR_PTR;
|
||||
|
||||
|
||||
|
||||
extern PFUNCTION GetFunction( char * szFunName ); /* locates a previously defined function */
|
||||
extern USHORT GetFunctionPos( char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */
|
||||
|
||||
extern void * hb_xgrab( ULONG lSize ); /* allocates memory, exists on failure */
|
||||
extern void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */
|
||||
extern void hb_xfree( void * pMem ); /* frees memory */
|
||||
@@ -194,13 +189,6 @@ extern void hb_xfree( void * pMem ); /* frees memory */
|
||||
char * yy_strdup( char * p ); /* this will exit if there is not enough memory */
|
||||
char * yy_strupr( char * p );
|
||||
|
||||
extern USHORT FixSymbolPos( USHORT ); /* converts symbol's compile-time position into generation-time position */
|
||||
extern PFUNCTION GetFuncall( char * szFunName ); /* locates a previously defined called function */
|
||||
extern PVAR GetVar( PVAR pVars, USHORT wOrder ); /* returns a variable if defined or zero */
|
||||
extern PCOMSYMBOL hb_compGetSymbol( char *, USHORT * ); /* returns a symbol pointer from the symbol table */
|
||||
extern PCOMSYMBOL hb_compGetSymbolOrd( USHORT ); /* returns a symbol based on its index on the symbol table */
|
||||
extern PFUNCTION KillFunction( PFUNCTION ); /* releases all memory allocated by function and returns the next one */
|
||||
extern PCOMSYMBOL KillSymbol( PCOMSYMBOL ); /* releases all memory allocated by symbol and returns the next one */
|
||||
|
||||
#define VS_LOCAL 1
|
||||
#define VS_STATIC 2
|
||||
@@ -216,71 +204,45 @@ extern PCOMSYMBOL KillSymbol( PCOMSYMBOL ); /* releases all memory allocated
|
||||
#define FUN_STATEMENTS 1 /* Function have at least one executable statement */
|
||||
#define FUN_USES_STATICS 2 /* Function uses static variables */
|
||||
#define FUN_PROCEDURE 4 /* This is a procedure that shouldn't return value */
|
||||
#define FUN_ILLEGAL_INIT 8 /* Attempt to initialize static variable with a function call */
|
||||
#define FUN_BREAK_CODE 8 /* last statement breaks execution flow */
|
||||
#define FUN_USES_LOCAL_PARAMS 16 /* parameters are declared using () */
|
||||
#define FUN_WITH_RETURN 32 /* there was RETURN statement in previous line */
|
||||
|
||||
typedef struct __EXTERN
|
||||
{
|
||||
char * szName;
|
||||
struct __EXTERN * pNext;
|
||||
} _EXTERN, * PEXTERN; /* support structure for extern symbols */
|
||||
/* as they have to be placed on the symbol table later than the first public symbol */
|
||||
|
||||
typedef struct _LOOPEXIT
|
||||
{
|
||||
ULONG ulOffset;
|
||||
int iLine;
|
||||
USHORT wSeqCounter;
|
||||
struct _LOOPEXIT * pLoopList;
|
||||
struct _LOOPEXIT * pExitList;
|
||||
struct _LOOPEXIT * pNext;
|
||||
} LOOPEXIT, * PTR_LOOPEXIT; /* support structure for EXIT and LOOP statements */
|
||||
void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */
|
||||
PFUNCTION hb_compFunctionFind( char * szFunName ); /* locates a previously defined function */
|
||||
USHORT hb_compFunctionGetPos( char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */
|
||||
PFUNCTION hb_compFunctionKill( PFUNCTION ); /* releases all memory allocated by function and returns the next one */
|
||||
|
||||
PFUNCTION hb_compFunCallAdd( char * szFuntionName );
|
||||
PFUNCTION hb_compFunCallFind( char * szFunName ); /* locates a previously defined called function */
|
||||
void hb_compFunCallCheck( char *, int );
|
||||
|
||||
typedef struct __ELSEIF
|
||||
{
|
||||
ULONG ulOffset;
|
||||
struct __ELSEIF * pNext;
|
||||
} _ELSEIF, * PELSEIF; /* support structure for else if pcode fixups */
|
||||
void hb_compVariableAdd( char * szVarName, char cType ); /* add a new param, local, static variable to a function definition or a public or private */
|
||||
PVAR hb_compVariableFind( PVAR pVars, USHORT wOrder ); /* returns a variable if defined or zero */
|
||||
|
||||
PCOMSYMBOL hb_compSymbolAdd( char *, USHORT * );
|
||||
PCOMSYMBOL hb_compSymbolKill( PCOMSYMBOL ); /* releases all memory allocated by symbol and returns the next one */
|
||||
PCOMSYMBOL hb_compSymbolFind( char *, USHORT * ); /* returns a symbol pointer from the symbol table */
|
||||
PCOMSYMBOL hb_compSymbolGetPos( USHORT ); /* returns a symbol based on its index on the symbol table */
|
||||
USHORT hb_compSymbolFixPos( USHORT ); /* converts symbol's compile-time position into generation-time position */
|
||||
|
||||
/* TODO: clear the functions name space
|
||||
*/
|
||||
PFUNCTION hb_compAddFunCall( char * szFuntionName );
|
||||
void hb_compAddExtern( char * szExternName ); /* defines a new extern name */
|
||||
void hb_compAddVar( char * szVarName, char cType ); /* add a new param, local, static variable to a function definition or a public or private */
|
||||
PCOMSYMBOL hb_compAddSymbol( char *, USHORT * );
|
||||
void CheckDuplVars( PVAR pVars, char * szVarName, int iVarScope ); /*checks for duplicate variables definitions */
|
||||
void Dec( void ); /* generates the pcode to decrement the latest value on the virtual machine stack */
|
||||
void hb_compGenDoProc( BYTE bParams ); /* generates the pcode to execute a Clipper function discarding its result */
|
||||
void Duplicate( void ); /* duplicates the virtual machine latest stack latest value and places it on the stack */
|
||||
void DupPCode( ULONG ulStart ); /* duplicates the current generated pcode from an offset */
|
||||
void FieldPCode( BYTE , char * ); /* generates the pcode for database field */
|
||||
void FixElseIfs( void * pIfElseIfs ); /* implements the ElseIfs pcode fixups */
|
||||
void FixReturns( void ); /* fixes all last defined function returns jumps offsets */
|
||||
void Function( BYTE bParams ); /* generates the pcode to execute a Clipper function pushing its result */
|
||||
PFUNCTION FunctionNew( char *, char ); /* creates and initialises the _FUNC structure */
|
||||
void hb_compFunDef( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */
|
||||
void GenArray( int iElements ); /* instructs the virtual machine to build an array and load elemnst from the stack */
|
||||
void hb_compGenBreak( void ); /* generate code for BREAK statement */
|
||||
void * GenElseIf( void * pFirstElseIf, ULONG ulOffset ); /* generates a support structure for elseifs pcode fixups */
|
||||
void hb_compGenExterns( void ); /* generates the symbols for the EXTERN names */
|
||||
void GenIfInline( void ); /* generates pcodes for IIF( expr1, expr2, expr3 ) */
|
||||
int GetFieldVarPos( char *, PFUNCTION ); /* return if passed name is a field variable */
|
||||
int GetMemvarPos( char *, PFUNCTION ); /* return if passed name is a memvar variable */
|
||||
USHORT GetVarPos( PVAR pVars, char * szVarName ); /* returns the order + 1 of a variable if defined or zero */
|
||||
int GetLocalVarPos( char * szVarName ); /* returns the order + 1 of a local variable */
|
||||
void Inc( void ); /* generates the pcode to increment the latest value on the virtual machine stack */
|
||||
|
||||
void hb_compExternGen( void ); /* generates the symbols for the EXTERN names */
|
||||
void hb_compExternAdd( char * szExternName ); /* defines a new extern name */
|
||||
|
||||
ULONG hb_compGenJump( LONG lOffset ); /* generates the pcode to jump to a specific offset */
|
||||
ULONG hb_compGenJumpFalse( LONG lOffset ); /* generates the pcode to jump if false */
|
||||
ULONG hb_compGenJumpTrue( LONG lOffset ); /* generates the pcode to jump if true */
|
||||
void hb_compGenJumpHere( ULONG ulOffset ); /* returns the pcode pos where to set a jump offset */
|
||||
void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo ); /* sets a jump offset */
|
||||
ULONG hb_compGenJumpTrue( LONG lOffset ); /* generates the pcode to jump if true */
|
||||
void Line( void ); /* generates the pcode with the currently compiled source code line */
|
||||
void LineDebug( void ); /* generates the pcode with the currently compiled source code line */
|
||||
void LineBody( void ); /* generates the pcode with the currently compiled source code line */
|
||||
void VariablePCode( BYTE , char * ); /* generates the pcode for undeclared variable */
|
||||
void MemvarPCode( BYTE , char * ); /* generates the pcode for memvar variable */
|
||||
|
||||
|
||||
void hb_compLinePush( void ); /* generates the pcode with the currently compiled source code line */
|
||||
void hb_compLinePushIfDebugger( void ); /* generates the pcode with the currently compiled source code line */
|
||||
void hb_compLinePushIfInside( void ); /* generates the pcode with the currently compiled source code line */
|
||||
|
||||
void hb_compGenMessage( char * szMsgName ); /* sends a message to an object */
|
||||
void hb_compGenMessageData( char * szMsg ); /* generates an underscore-symbol name for a data assignment */
|
||||
void hb_compGenPopVar( char * szVarName ); /* generates the pcode to pop a value from the virtual machine stack onto a variable */
|
||||
@@ -293,40 +255,25 @@ void hb_compGenPushLogical( int iTrueFalse ); /* pushes a logical value on t
|
||||
void hb_compGenPushLong( long lNumber ); /* Pushes a long number on the virtual machine stack */
|
||||
void hb_compGenPushNil( void ); /* Pushes nil on the virtual machine stack */
|
||||
void hb_compGenPushString( char * szText, ULONG ulLen ); /* Pushes a string on the virtual machine stack */
|
||||
void hb_compPushSymbol( char * szSymbolName, int iIsFunction ); /* Pushes a symbol on to the Virtual machine stack */
|
||||
void hb_compGenPushSymbol( char * szSymbolName, int iIsFunction ); /* Pushes a symbol on to the Virtual machine stack */
|
||||
void hb_compGenPushAliasedVar( char *, BOOL, char *, long );
|
||||
void hb_compGenPopAliasedVar( char *, BOOL, char *, long );
|
||||
void hb_compGenPushFunRef( char * );
|
||||
void hb_compGenPCode1( BYTE ); /* generates 1 byte of pcode */
|
||||
void hb_compGenPCode3( BYTE, BYTE, BYTE ); /* generates 3 bytes of pcode */
|
||||
void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize ); /* copy bytes to a pcode buffer */
|
||||
|
||||
/* Codeblocks */
|
||||
void hb_compCodeBlockStart( void ); /* starts a codeblock creation */
|
||||
void hb_compCodeBlockEnd( void ); /* end of codeblock creation */
|
||||
|
||||
|
||||
void hb_compGenPushFunRef( char * );
|
||||
|
||||
void hb_compGenPCode1( BYTE ); /* generates 1 byte of pcode */
|
||||
void hb_compGenPCode3( BYTE, BYTE, BYTE ); /* generates 3 bytes of pcode */
|
||||
void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize ); /* copy bytes to a pcode buffer */
|
||||
|
||||
ULONG SequenceBegin( void );
|
||||
ULONG SequenceEnd( void );
|
||||
void SequenceFinish( ULONG, int );
|
||||
|
||||
/* Managing value type */
|
||||
extern void ValTypePush( char cType ); /* Pushes the type of expression (used with -w3 option */
|
||||
extern void ValTypePop( int );
|
||||
extern void ValTypePlus( void );
|
||||
extern void ValTypeRelational( void );
|
||||
extern void ValTypeCheck( char, int, int );
|
||||
extern void ValTypeCheck2( char, int, int );
|
||||
extern char ValTypeGet( void );
|
||||
extern void ValTypePut( char );
|
||||
extern void ValTypeAssign( char * );
|
||||
extern void ValTypeReset( void );
|
||||
ULONG hb_compSequenceBegin( void );
|
||||
ULONG hb_compSequenceEnd( void );
|
||||
void hb_compSequenceFinish( ULONG, int );
|
||||
|
||||
/* support for FIELD declaration */
|
||||
void FieldsSetAlias( char *, int );
|
||||
int FieldsCount( void );
|
||||
void hb_compFieldSetAlias( char *, int );
|
||||
int hb_compFieldsCount( void );
|
||||
|
||||
/* Static variables */
|
||||
void hb_compStaticDefStart( void );
|
||||
@@ -342,13 +289,12 @@ HB_EXPR_PTR hb_compErrorAlias( HB_EXPR_PTR );
|
||||
void hb_compErrorDuplVar( char * );
|
||||
HB_EXPR_PTR hb_compWarnMeaningless( HB_EXPR_PTR );
|
||||
|
||||
void hb_compCheckArgs( char *, int );
|
||||
|
||||
void hb_compGenError( char* _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 );
|
||||
void hb_compGenWarning( char* _szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2);
|
||||
|
||||
/* variable used by compiler
|
||||
*/
|
||||
extern int hb_comp_iLine;
|
||||
extern FUNCTIONS hb_comp_functions, hb_comp_funcalls;
|
||||
extern SYMBOLS hb_comp_symbols;
|
||||
extern PATHNAMES * hb_comp_pIncludePath;
|
||||
@@ -368,14 +314,12 @@ extern char hb_comp_szPrefix[ 20 ];
|
||||
extern BOOL hb_comp_bGenCVerbose;
|
||||
extern int hb_comp_iExitLevel;
|
||||
extern int hb_comp_iFunctionCnt;
|
||||
extern BOOL hb_comp_bExternal;
|
||||
extern char hb_comp_cVarType;
|
||||
extern int hb_comp_iVarScope;
|
||||
extern BOOL hb_comp_bDontGenLineNum;
|
||||
extern FILES hb_comp_files;
|
||||
extern int hb_comp_iStaticCnt;
|
||||
extern int hb_comp_iErrorCount;
|
||||
extern PTR_LOOPEXIT hb_comp_pLoops;
|
||||
|
||||
extern USHORT hb_comp_wSeqCounter;
|
||||
extern USHORT hb_comp_wForCounter;
|
||||
@@ -445,6 +389,7 @@ HB_EXPR_PTR hb_compExprAddListExpr( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprNewIIF( HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprReduce( HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprAssign( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprEqual( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR, HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR );
|
||||
HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR );
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
#define WARN_LOGICAL_SUSPECT 14
|
||||
#define WARN_NUMERIC_SUSPECT 15
|
||||
#define WARN_MEANINGLESS 16
|
||||
#define WARN_UNREACHABLE 17
|
||||
|
||||
/*
|
||||
* Errors generated by Harbour preprocessor
|
||||
|
||||
@@ -577,14 +577,21 @@ HB_EXPR_PTR hb_compExprNewFunCall( char *szFunName, HB_EXPR_PTR pParms )
|
||||
HB_EXPR_PTR pExpr = NULL;
|
||||
int iCount;
|
||||
|
||||
iCount = hb_compExprListLen( pParms );
|
||||
/* Check the special case when no parameters are passed - in this case
|
||||
* pParms is an expression of type HB_ET_NONE and we shouldn't
|
||||
* replace it with NIL value
|
||||
*/
|
||||
if( iCount == 1 && pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
|
||||
--iCount;
|
||||
hb_compCheckArgs( szFunName, iCount );
|
||||
if( pParms )
|
||||
{
|
||||
iCount = hb_compExprListLen( pParms );
|
||||
/* Check the special case when no parameters are passed - in this case
|
||||
* pParms is an expression of type HB_ET_NONE and we shouldn't
|
||||
* replace it with NIL value
|
||||
*/
|
||||
if( iCount == 1 && pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
|
||||
--iCount;
|
||||
}
|
||||
else
|
||||
iCount = 0;
|
||||
|
||||
hb_compFunCallCheck( szFunName, iCount );
|
||||
|
||||
if( ( strcmp( "CHR", szFunName ) == 0 ) && iCount )
|
||||
{
|
||||
/* try to change it into a string */
|
||||
@@ -604,6 +611,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( char *szFunName, HB_EXPR_PTR pParms )
|
||||
hb_compExprDelete( pParms );
|
||||
}
|
||||
}
|
||||
|
||||
if( pExpr == NULL )
|
||||
{
|
||||
pExpr = hb_compExprNew( HB_ET_FUNCALL );
|
||||
@@ -1123,7 +1131,7 @@ HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem )
|
||||
/* the right side of an operator is an expression with other operator
|
||||
* e.g. a := 2 + b * 3
|
||||
* We have to set the proper order of evaluation using
|
||||
* precedennce rules
|
||||
* precedence rules
|
||||
*/
|
||||
unsigned char ucLeft = s_PrecedTable[ pExpr->ExprType ];
|
||||
if( ucLeft >= ucRight )
|
||||
@@ -1366,7 +1374,7 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock )
|
||||
pVar = ( HB_CBVAR_PTR ) pSelf->value.asList.pIndex;
|
||||
while( pVar )
|
||||
{
|
||||
hb_compAddVar( pVar->szName, pVar->bType );
|
||||
hb_compVariableAdd( pVar->szName, pVar->bType );
|
||||
pVar =pVar->pNext;
|
||||
}
|
||||
pExpr = pSelf->value.asList.pExprList;
|
||||
@@ -2015,7 +2023,8 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
{
|
||||
/* Reduce the expressions on the list of arguments
|
||||
*/
|
||||
pSelf->value.asFunCall.pParms = HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_REDUCE );
|
||||
if( pSelf->value.asFunCall.pParms )
|
||||
pSelf->value.asFunCall.pParms = HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_REDUCE );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2034,11 +2043,19 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
hb_compGenPushFunCall( pSelf->value.asFunCall.szFunName );
|
||||
hb_compGenPCode1( HB_P_PUSHNIL );
|
||||
|
||||
usCount = hb_compExprListLen( pSelf->value.asFunCall.pParms );
|
||||
if( usCount == 1 && pSelf->value.asFunCall.pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
|
||||
--usCount;
|
||||
if( usCount )
|
||||
HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE );
|
||||
if( pSelf->value.asFunCall.pParms )
|
||||
{
|
||||
/* NOTE: pParms will be NULL in 'DO procname' (if there is
|
||||
* no WITH keyword)
|
||||
*/
|
||||
usCount = hb_compExprListLen( pSelf->value.asFunCall.pParms );
|
||||
if( usCount == 1 && pSelf->value.asFunCall.pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
|
||||
--usCount;
|
||||
if( usCount )
|
||||
HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE );
|
||||
}
|
||||
else
|
||||
usCount = 0;
|
||||
hb_compGenPCode3( HB_P_FUNCTION, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) );
|
||||
}
|
||||
break;
|
||||
@@ -2054,11 +2071,16 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall )
|
||||
hb_compGenPushFunCall( pSelf->value.asFunCall.szFunName );
|
||||
hb_compGenPCode1( HB_P_PUSHNIL );
|
||||
|
||||
usCount = hb_compExprListLen( pSelf->value.asFunCall.pParms );
|
||||
if( usCount == 1 && pSelf->value.asFunCall.pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
|
||||
--usCount;
|
||||
if( usCount )
|
||||
HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE );
|
||||
if( pSelf->value.asFunCall.pParms )
|
||||
{
|
||||
usCount = hb_compExprListLen( pSelf->value.asFunCall.pParms );
|
||||
if( usCount == 1 && pSelf->value.asFunCall.pParms->value.asList.pExprList->ExprType == HB_ET_NONE )
|
||||
--usCount;
|
||||
if( usCount )
|
||||
HB_EXPR_USE( pSelf->value.asFunCall.pParms, HB_EA_PUSH_PCODE );
|
||||
}
|
||||
else
|
||||
usCount = 0;
|
||||
hb_compGenPCode3( HB_P_DO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -96,7 +96,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
pFunc = hb_comp_funcalls.pFirst;
|
||||
while( pFunc )
|
||||
{
|
||||
pFTemp = GetFunction( pFunc->szName );
|
||||
pFTemp = hb_compFunctionFind( pFunc->szName );
|
||||
if( ! pFTemp || pFTemp == hb_comp_functions.pFirst )
|
||||
fprintf( yyc, "extern HARBOUR HB_%s( void );\n", pFunc->szName );
|
||||
pFunc = pFunc->pNext;
|
||||
@@ -146,9 +146,9 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
/* specify the function address if it is a defined function or an
|
||||
external called function */
|
||||
if( GetFunction( pSym->szName ) ) /* is it a function defined in this module */
|
||||
if( hb_compFunctionFind( pSym->szName ) ) /* is it a function defined in this module */
|
||||
fprintf( yyc, ", HB_%s, 0 }", pSym->szName );
|
||||
else if( GetFuncall( pSym->szName ) ) /* is it a function called from this module */
|
||||
else if( hb_compFunCallFind( pSym->szName ) ) /* is it a function called from this module */
|
||||
fprintf( yyc, ", HB_%s, 0 }", pSym->szName );
|
||||
else
|
||||
fprintf( yyc, ", 0, 0 }" ); /* memvar */
|
||||
@@ -421,11 +421,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
USHORT wFixPos;
|
||||
|
||||
wSym = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wSym );
|
||||
wFixPos = hb_compSymbolFixPos( wSym );
|
||||
fprintf( yyc, "\tHB_P_MESSAGE, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wSym )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wSym )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
fprintf( yyc, "\tHB_P_MODULENAME," );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", ( char * ) pFunc->pCode + lPCodePos++ + 1 );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos++;
|
||||
lPCodePos++;
|
||||
while( pFunc->pCode[ lPCodePos ] )
|
||||
{
|
||||
chr = pFunc->pCode[ lPCodePos++ ];
|
||||
@@ -488,12 +488,12 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
USHORT wFixPos;
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_PARAMETER, %i, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ),
|
||||
pFunc->pCode[ lPCodePos + 3 ] );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 4;
|
||||
}
|
||||
@@ -519,11 +519,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
USHORT wFixPos;
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -534,11 +534,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
USHORT wFixPos;
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_POPFIELD, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -576,7 +576,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
fprintf( yyc, "\tHB_P_POPLOCAL, %i, %i,",
|
||||
pFunc->pCode[ lPCodePos + 1 ],
|
||||
pFunc->pCode[ lPCodePos + 2 ] );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", GetVar( pFunc->pLocals, wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compVariableFind( pFunc->pLocals, wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
}
|
||||
lPCodePos += 3;
|
||||
@@ -588,11 +588,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
USHORT wFixPos;
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_POPMEMVAR, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -606,7 +606,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
|
||||
pTmp = pTmp->pNext;
|
||||
pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase );
|
||||
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
|
||||
fprintf( yyc, "\tHB_P_POPSTATIC, %i, %i,",
|
||||
pFunc->pCode[ lPCodePos + 1 ],
|
||||
pFunc->pCode[ lPCodePos + 2 ] );
|
||||
@@ -621,11 +621,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
USHORT wFixPos;
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_POPVARIABLE, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -647,11 +647,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] +
|
||||
pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -690,7 +690,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
fprintf( yyc, "\t%i, %i,",
|
||||
pFunc->pCode[ lPCodePos ],
|
||||
pFunc->pCode[ lPCodePos + 1 ] );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", GetVar( pFunc->pLocals, w )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compVariableFind( pFunc->pLocals, w )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos +=2;
|
||||
}
|
||||
@@ -718,11 +718,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] +
|
||||
pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_PUSHFIELD, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -771,7 +771,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
fprintf( yyc, "\tHB_P_PUSHLOCAL, %i, %i,",
|
||||
pFunc->pCode[ lPCodePos + 1 ],
|
||||
pFunc->pCode[ lPCodePos + 2 ] );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", GetVar( pFunc->pLocals, wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compVariableFind( pFunc->pLocals, wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
}
|
||||
lPCodePos += 3;
|
||||
@@ -810,7 +810,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
fprintf( yyc, "\tHB_P_PUSHLOCALREF, %i, %i,",
|
||||
pFunc->pCode[ lPCodePos + 1 ],
|
||||
pFunc->pCode[ lPCodePos + 2 ] );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", GetVar( pFunc->pLocals, wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compVariableFind( pFunc->pLocals, wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
}
|
||||
lPCodePos += 3;
|
||||
@@ -834,11 +834,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] +
|
||||
pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_PUSHMEMVAR, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -850,11 +850,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] +
|
||||
pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -878,7 +878,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
|
||||
pTmp = pTmp->pNext;
|
||||
pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase );
|
||||
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
|
||||
fprintf( yyc, "\tHB_P_PUSHSTATIC, %i, %i,",
|
||||
pFunc->pCode[ lPCodePos + 1 ],
|
||||
pFunc->pCode[ lPCodePos + 2 ] );
|
||||
@@ -896,7 +896,7 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar )
|
||||
pTmp = pTmp->pNext;
|
||||
pVar = GetVar( pTmp->pStatics, wVar - pTmp->iStaticsBase );
|
||||
pVar = hb_compVariableFind( pTmp->pStatics, wVar - pTmp->iStaticsBase );
|
||||
fprintf( yyc, "\tHB_P_PUSHSTATICREF, %i, %i,",
|
||||
pFunc->pCode[ lPCodePos + 1 ],
|
||||
pFunc->pCode[ lPCodePos + 2 ] );
|
||||
@@ -922,10 +922,10 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
while( wLen-- )
|
||||
{
|
||||
uchr = ( unsigned char ) ( pFunc->pCode[ lPCodePos++ ] );
|
||||
/*
|
||||
/*
|
||||
* NOTE: After optimization some CHR(n) can be converted
|
||||
* into a string containing nonprintable characters.
|
||||
*
|
||||
*
|
||||
* TODO: add switch to use hexadecimal format "%#04x"
|
||||
*/
|
||||
if( ( uchr < (unsigned char) ' ' ) || ( uchr >= 127 ) )
|
||||
@@ -945,11 +945,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
wSym = pFunc->pCode[ lPCodePos + 1 ] +
|
||||
pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wSym );
|
||||
wFixPos = hb_compSymbolFixPos( wSym );
|
||||
fprintf( yyc, "\tHB_P_PUSHSYM, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wSym )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wSym )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -961,11 +961,11 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
wVar = pFunc->pCode[ lPCodePos + 1 ] +
|
||||
pFunc->pCode[ lPCodePos + 2 ] * 256;
|
||||
wFixPos = FixSymbolPos( wVar );
|
||||
wFixPos = hb_compSymbolFixPos( wVar );
|
||||
fprintf( yyc, "\tHB_P_PUSHVARIABLE, %i, %i,",
|
||||
HB_LOBYTE( wFixPos ),
|
||||
HB_HIBYTE( wFixPos ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compGetSymbolOrd( wVar )->szName );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* %s */", hb_compSymbolGetPos( wVar )->szName );
|
||||
fprintf( yyc, "\n" );
|
||||
lPCodePos += 3;
|
||||
}
|
||||
@@ -1007,8 +1007,8 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
/* we only generate it if there are statics used in this function */
|
||||
if( pFunc->bFlags & FUN_USES_STATICS )
|
||||
{
|
||||
hb_compGetSymbol( hb_comp_pInitFunc->szName, &w );
|
||||
w = FixSymbolPos( w );
|
||||
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
|
||||
w = hb_compSymbolFixPos( w );
|
||||
fprintf( yyc, "\tHB_P_SFRAME, %i, %i,",
|
||||
HB_LOBYTE( w ), HB_HIBYTE( w ) );
|
||||
if( hb_comp_bGenCVerbose ) fprintf( yyc, "\t/* symbol (_INITSTATICS) */" );
|
||||
@@ -1019,8 +1019,8 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
case HB_P_STATICS:
|
||||
|
||||
hb_compGetSymbol( hb_comp_pInitFunc->szName, &w );
|
||||
w = FixSymbolPos( w );
|
||||
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
|
||||
w = hb_compSymbolFixPos( w );
|
||||
fprintf( yyc, "\tHB_P_STATICS, %i, %i, %i, %i,",
|
||||
HB_LOBYTE( w ),
|
||||
HB_HIBYTE( w ),
|
||||
@@ -1074,19 +1074,19 @@ void GenCCode( PHB_FNAME pFileName ) /* generates the C language output */
|
||||
|
||||
pFunc = hb_comp_functions.pFirst;
|
||||
while( pFunc )
|
||||
pFunc = KillFunction( pFunc );
|
||||
pFunc = hb_compFunctionKill( pFunc );
|
||||
|
||||
pFunc = hb_comp_funcalls.pFirst;
|
||||
while( pFunc )
|
||||
{
|
||||
hb_comp_funcalls.pFirst = pFunc->pNext;
|
||||
hb_xfree( ( void * ) pFunc ); /* NOTE: szName will be released by KillSymbol() */
|
||||
hb_xfree( ( void * ) pFunc ); /* NOTE: szName will be released by hb_compSymbolKill() */
|
||||
pFunc = hb_comp_funcalls.pFirst;
|
||||
}
|
||||
|
||||
pSym = hb_comp_symbols.pFirst;
|
||||
while( pSym )
|
||||
pSym = KillSymbol( pSym );
|
||||
pSym = hb_compSymbolKill( pSym );
|
||||
|
||||
if( ! hb_comp_bQuiet )
|
||||
printf( "Done.\n" );
|
||||
|
||||
@@ -100,13 +100,13 @@ void GenPortObj( PHB_FNAME pFileName )
|
||||
|
||||
/* specify the function address if it is a defined function or a
|
||||
external called function */
|
||||
if( GetFunction( pSym->szName ) ) /* is it a defined function ? */
|
||||
if( hb_compFunctionFind( pSym->szName ) ) /* is it a defined function ? */
|
||||
{
|
||||
fputc( SYM_FUNC, yyc );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetFuncall( pSym->szName ) )
|
||||
if( hb_compFunCallFind( pSym->szName ) )
|
||||
{
|
||||
fputc( SYM_EXTERN, yyc );
|
||||
}
|
||||
@@ -270,7 +270,7 @@ void GenPortObj( PHB_FNAME pFileName )
|
||||
case HB_P_POPALIASEDFIELD:
|
||||
case HB_P_PUSHALIASEDFIELD:
|
||||
fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
wVar = FixSymbolPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
wVar = hb_compSymbolFixPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
fputc( HB_LOBYTE( wVar ), yyc );
|
||||
fputc( HB_HIBYTE( wVar ), yyc );
|
||||
lPCodePos += 3;
|
||||
@@ -278,7 +278,7 @@ void GenPortObj( PHB_FNAME pFileName )
|
||||
|
||||
case HB_P_PARAMETER:
|
||||
fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
wVar = FixSymbolPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
wVar = hb_compSymbolFixPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
fputc( HB_LOBYTE( wVar ), yyc );
|
||||
fputc( HB_HIBYTE( wVar ), yyc );
|
||||
fputc( pFunc->pCode[ lPCodePos + 3 ], yyc );
|
||||
@@ -336,8 +336,8 @@ void GenPortObj( PHB_FNAME pFileName )
|
||||
/* we only generate it if there are statics used in this function */
|
||||
if( pFunc->bFlags & FUN_USES_STATICS )
|
||||
{
|
||||
hb_compGetSymbol( hb_comp_pInitFunc->szName, &w );
|
||||
w = FixSymbolPos( w );
|
||||
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
|
||||
w = hb_compSymbolFixPos( w );
|
||||
fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
fputc( HB_LOBYTE( w ), yyc );
|
||||
fputc( HB_HIBYTE( w ), yyc );
|
||||
@@ -348,8 +348,8 @@ void GenPortObj( PHB_FNAME pFileName )
|
||||
break;
|
||||
|
||||
case HB_P_STATICS:
|
||||
hb_compGetSymbol( hb_comp_pInitFunc->szName, &w );
|
||||
w = FixSymbolPos( w );
|
||||
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
|
||||
w = hb_compSymbolFixPos( w );
|
||||
fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
fputc( HB_LOBYTE( w ), yyc );
|
||||
fputc( HB_HIBYTE( w ), yyc );
|
||||
|
||||
@@ -122,13 +122,13 @@ void GenJava( PHB_FNAME pFileName )
|
||||
|
||||
/* specify the function address if it is a defined function or a
|
||||
external called function */
|
||||
if( GetFunction( pSym->szName ) ) /* is it a defined function ? */
|
||||
if( hb_compFunctionFind( pSym->szName ) ) /* is it a defined function ? */
|
||||
{
|
||||
hb_fputc( SYM_FUNC, yyc );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( GetFuncall( pSym->szName ) )
|
||||
if( hb_compFunCallFind( pSym->szName ) )
|
||||
{
|
||||
hb_fputc( SYM_EXTERN, yyc );
|
||||
}
|
||||
@@ -292,7 +292,7 @@ void GenJava( PHB_FNAME pFileName )
|
||||
case HB_P_POPALIASEDFIELD:
|
||||
case HB_P_PUSHALIASEDFIELD:
|
||||
hb_fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
wVar = FixSymbolPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
wVar = hb_compSymbolFixPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
hb_fputc( HB_LOBYTE( wVar ), yyc );
|
||||
hb_fputc( HB_HIBYTE( wVar ), yyc );
|
||||
lPCodePos += 3;
|
||||
@@ -300,7 +300,7 @@ void GenJava( PHB_FNAME pFileName )
|
||||
|
||||
case HB_P_PARAMETER:
|
||||
hb_fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
wVar = FixSymbolPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
wVar = hb_compSymbolFixPos( pFunc->pCode[ lPCodePos + 1 ] + 256 * pFunc->pCode[ lPCodePos + 2 ] );
|
||||
hb_fputc( HB_LOBYTE( wVar ), yyc );
|
||||
hb_fputc( HB_HIBYTE( wVar ), yyc );
|
||||
hb_fputc( pFunc->pCode[ lPCodePos + 3 ], yyc );
|
||||
@@ -358,8 +358,8 @@ void GenJava( PHB_FNAME pFileName )
|
||||
/* we only generate it if there are statics used in this function */
|
||||
if( pFunc->bFlags & FUN_USES_STATICS )
|
||||
{
|
||||
hb_compGetSymbol( hb_comp_pInitFunc->szName, &w );
|
||||
w = FixSymbolPos( w );
|
||||
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
|
||||
w = hb_compSymbolFixPos( w );
|
||||
hb_fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
hb_fputc( HB_LOBYTE( w ), yyc );
|
||||
hb_fputc( HB_HIBYTE( w ), yyc );
|
||||
@@ -370,8 +370,8 @@ void GenJava( PHB_FNAME pFileName )
|
||||
break;
|
||||
|
||||
case HB_P_STATICS:
|
||||
hb_compGetSymbol( hb_comp_pInitFunc->szName, &w );
|
||||
w = FixSymbolPos( w );
|
||||
hb_compSymbolFind( hb_comp_pInitFunc->szName, &w );
|
||||
w = hb_compSymbolFixPos( w );
|
||||
hb_fputc( pFunc->pCode[ lPCodePos ], yyc );
|
||||
hb_fputc( HB_LOBYTE( w ), yyc );
|
||||
hb_fputc( HB_HIBYTE( w ), yyc );
|
||||
@@ -429,7 +429,7 @@ static void hb_fputc( BYTE b, FILE * yyc )
|
||||
fprintf( yyc, ", " );
|
||||
|
||||
if( _nChar == 9 )
|
||||
{
|
||||
{
|
||||
fprintf( yyc, "\n " );
|
||||
_nChar = 1;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ static BOOL IsExternal( ULONG ulSymbol )
|
||||
while( ul++ < ulSymbol )
|
||||
pSymbol = pSymbol->pNext;
|
||||
|
||||
return ! GetFunction( pSymbol->szName );
|
||||
return ! hb_compFunctionFind( pSymbol->szName );
|
||||
}
|
||||
|
||||
static USHORT GetExternalPos( char * szExternal )
|
||||
@@ -302,7 +302,7 @@ static void GenerateExternals( FILE * hObjFile )
|
||||
pFunc = hb_comp_funcalls.pFirst;
|
||||
while( pFunc )
|
||||
{
|
||||
if( ! ( pFTemp = GetFunction( pFunc->szName ) ) || pFTemp == hb_comp_functions.pFirst )
|
||||
if( ! ( pFTemp = hb_compFunctionFind( pFunc->szName ) ) || pFTemp == hb_comp_functions.pFirst )
|
||||
wExternals++;
|
||||
pFunc = pFunc->pNext;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static void GenerateExternals( FILE * hObjFile )
|
||||
pFunc = hb_comp_funcalls.pFirst;
|
||||
while( pFunc )
|
||||
{
|
||||
if( ! ( pFTemp = GetFunction( pFunc->szName ) ) || pFTemp == hb_comp_functions.pFirst )
|
||||
if( ! ( pFTemp = hb_compFunctionFind( pFunc->szName ) ) || pFTemp == hb_comp_functions.pFirst )
|
||||
externNames[ w++ ] = pFunc->szName;
|
||||
pFunc = pFunc->pNext;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ static void DataSegment( FILE * hObjFile, BYTE * symbol, USHORT wSymLen, USHORT
|
||||
|
||||
if( ! IsExternal( y ) )
|
||||
{
|
||||
ulFunctionOffset = ( GetFunctionPos( pSymbol->szName ) - 1 ) *
|
||||
ulFunctionOffset = ( hb_compFunctionGetPos( pSymbol->szName ) - 1 ) *
|
||||
sizeof( prgFunction );
|
||||
* ( ( ULONG * ) &symbol[ 5 ] ) = ulFunctionOffset;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -73,21 +73,16 @@ extern int PreProcess( FILE*, FILE*, char *);
|
||||
int yy_lex_input( char *, int );
|
||||
#define YY_INPUT( buf, result, max_size ) result = yy_lex_input( buf, max_size );
|
||||
|
||||
/* variables defined in harbour.y */
|
||||
extern int hb_comp_bRestrictSymbolLength;
|
||||
|
||||
int iLine = 1;
|
||||
long lNumber = 0;
|
||||
|
||||
#define LOOKUP 0 /* scan from the begining of line */
|
||||
#define OPERATOR -1
|
||||
#define SEPARATOR -2
|
||||
int hb_comp_iState = LOOKUP;
|
||||
static int hb_comp_iState = LOOKUP;
|
||||
static int _iOpenBracket = 0;
|
||||
|
||||
/* Support for Array Index */
|
||||
int iIndexSets = 0;
|
||||
int i_INDEX_STATE = 0;
|
||||
static int iIndexSets = 0;
|
||||
static int i_INDEX_STATE = 0;
|
||||
|
||||
%}
|
||||
|
||||
@@ -220,16 +215,16 @@ Separator {SpaceTab}
|
||||
\n.* {
|
||||
hb_comp_iState = LOOKUP;
|
||||
yyless( 1 );
|
||||
/*++iLine;*/
|
||||
/*++hb_comp_iLine;*/
|
||||
#if 0
|
||||
if( ! hb_comp_bQuiet )
|
||||
{
|
||||
printf( "\r%i", iLine );
|
||||
printf( "\r%i", hb_comp_iLine );
|
||||
}
|
||||
#endif
|
||||
if( ! hb_comp_bQuiet && ( iLine % 100 ) == 0 )
|
||||
if( ! hb_comp_bQuiet && ( hb_comp_iLine % 100 ) == 0 )
|
||||
{
|
||||
printf( "\r%i", iLine );
|
||||
printf( "\r%i", hb_comp_iLine );
|
||||
fflush( stdout );
|
||||
}
|
||||
return '\n';
|
||||
@@ -1175,7 +1170,10 @@ Separator {SpaceTab}
|
||||
|
||||
{Number} { return yy_ConvertNumber( yytext ); }
|
||||
|
||||
{HexNumber} { sscanf( yytext, "%lxI", &lNumber );
|
||||
{HexNumber} {
|
||||
long lNumber = 0;
|
||||
|
||||
sscanf( yytext, "%lxI", &lNumber );
|
||||
|
||||
if( ( double )SHRT_MIN <= lNumber &&
|
||||
lNumber <= ( double )SHRT_MAX )
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -868,8 +868,6 @@ METHOD GetHotKeyPos( cKey ) CLASS TDbMenu
|
||||
|
||||
return 0
|
||||
|
||||
return .f.
|
||||
|
||||
METHOD GoBottom() CLASS TDbMenu
|
||||
|
||||
local oPopup
|
||||
|
||||
@@ -184,7 +184,7 @@ int ParseDirective( char* sLine )
|
||||
if ( i == 4 && memcmp ( sDirective, "ELSE", 4 ) == 0 )
|
||||
{ /* --- #else --- */
|
||||
if ( nCondCompile == 0 )
|
||||
hb_compGenError( _szPErrors, 'P', ERR_DIRECTIVE_ELSE, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_DIRECTIVE_ELSE, NULL, NULL );
|
||||
else if ( nCondCompile == 1 || aCondCompile[nCondCompile-2] )
|
||||
aCondCompile[nCondCompile-1] = 1 - aCondCompile[nCondCompile-1];
|
||||
}
|
||||
@@ -192,7 +192,7 @@ int ParseDirective( char* sLine )
|
||||
else if ( i == 5 && memcmp ( sDirective, "ENDIF", 5 ) == 0 )
|
||||
{ /* --- #endif --- */
|
||||
if ( nCondCompile == 0 )
|
||||
hb_compGenError( _szPErrors, 'P', ERR_DIRECTIVE_ENDIF, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_DIRECTIVE_ENDIF, NULL, NULL );
|
||||
else nCondCompile--;
|
||||
}
|
||||
|
||||
@@ -208,8 +208,8 @@ int ParseDirective( char* sLine )
|
||||
{ /* --- #include --- */
|
||||
char cDelimChar;
|
||||
|
||||
if ( *sLine != '\"' && *sLine != '\'' && *sLine != '<' && *sLine != '`' )
|
||||
hb_compGenError( _szPErrors, 'P', ERR_WRONG_NAME, NULL, NULL );
|
||||
if ( *sLine != '\"' && *sLine != '\'' && *sLine != '<' )
|
||||
hb_compGenError( _szPErrors, 'F', ERR_WRONG_NAME, NULL, NULL );
|
||||
|
||||
cDelimChar = *sLine;
|
||||
if( cDelimChar == '<' )
|
||||
@@ -220,7 +220,7 @@ int ParseDirective( char* sLine )
|
||||
sLine++; i = 0;
|
||||
while ( *(sLine+i) != '\0' && *(sLine+i) != cDelimChar ) i++;
|
||||
if ( *(sLine+i) != cDelimChar )
|
||||
hb_compGenError( _szPErrors, 'P', ERR_WRONG_NAME, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_WRONG_NAME, NULL, NULL );
|
||||
*(sLine+i) = '\0';
|
||||
|
||||
/* if ((handl_i = fopen(sLine, "r")) == NULL) */
|
||||
@@ -232,7 +232,7 @@ int ParseDirective( char* sLine )
|
||||
fclose(handl_i);
|
||||
}
|
||||
else
|
||||
hb_compGenError( _szPErrors, 'P', ERR_CANNOT_OPEN, sLine, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_CANNOT_OPEN, sLine, NULL );
|
||||
}
|
||||
|
||||
else if ( i == 6 && memcmp ( sDirective, "DEFINE", 6 ) == 0 )
|
||||
@@ -256,12 +256,12 @@ int ParseDirective( char* sLine )
|
||||
|
||||
else if ( i == 5 && memcmp ( sDirective, "ERROR", 5 ) == 0 )
|
||||
/* --- #error --- */
|
||||
hb_compGenError( _szPErrors, 'P', ERR_EXPLICIT, sLine, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_EXPLICIT, sLine, NULL );
|
||||
|
||||
else if ( i == 4 && memcmp ( sDirective, "LINE", 4 ) == 0 )
|
||||
return -1;
|
||||
else
|
||||
hb_compGenError( _szPErrors, 'P', ERR_WRONG_DIRECTIVE, sDirective, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_WRONG_DIRECTIVE, sDirective, NULL );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -300,7 +300,7 @@ int ParseDefine( char* sLine)
|
||||
lastdef->pars = ( npars <= 0 )? NULL : strodup ( pars );
|
||||
}
|
||||
else
|
||||
hb_compGenError( _szPErrors, 'P', ERR_DEFINE_ABSENT, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_DEFINE_ABSENT, NULL, NULL );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -365,7 +365,7 @@ int ParseIfdef( char* sLine, int usl)
|
||||
{
|
||||
NextWord( &sLine, defname, FALSE );
|
||||
if ( *defname == '\0' )
|
||||
hb_compGenError( _szPErrors, 'P', ERR_DEFINE_ABSENT, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_DEFINE_ABSENT, NULL, NULL );
|
||||
}
|
||||
if ( nCondCompile == maxCondCompile )
|
||||
{
|
||||
@@ -468,7 +468,7 @@ void ParseCommand( char* sLine, int com_or_xcom, int com_or_tra )
|
||||
if ( (ipos = pp_strAt( "=>", 2, sLine, strolen(sLine) )) > 0 )
|
||||
stroncpy( mpatt, sLine, ipos-1 );
|
||||
else
|
||||
hb_compGenError( _szPErrors, 'P', ERR_COMMAND_DEFINITION, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_COMMAND_DEFINITION, NULL, NULL );
|
||||
RemoveSlash( mpatt );
|
||||
mlen = strotrim( mpatt );
|
||||
|
||||
@@ -535,13 +535,13 @@ void ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen )
|
||||
{
|
||||
if ( *(exppatt+explen-1) == '*' ) explen--;
|
||||
else
|
||||
hb_compGenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
}
|
||||
else if ( exptype == '4' )
|
||||
{
|
||||
if ( *(exppatt+explen-1) == ')' ) explen--;
|
||||
else
|
||||
hb_compGenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
}
|
||||
rmlen = i - ipos + 1;
|
||||
/* Convert match marker into inner format */
|
||||
@@ -756,7 +756,7 @@ int ParseExpression( char* sLine, char* sOutLine )
|
||||
while ( ipos != 0 );
|
||||
kolpass++;
|
||||
if( kolpass > 20 && rezDef )
|
||||
hb_compGenError( _szPErrors, 'P', ERR_RECURSE, NULL, NULL );
|
||||
hb_compGenError( _szPErrors, 'F', ERR_RECURSE, NULL, NULL );
|
||||
}
|
||||
while ( rezDef || rezTra || rezCom );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user