diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4ffa9aab4f..509b866c13 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,93 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2006-11-24 03:25 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/compiler/Makefile + * commented out YACC_FLAGS = -p hb_comp + this should not/hbgtcore.c + * include/hbapigt.h + * source/rtl/gtpca/gtpca.c + * source/rtl/gtstd/gtstd.c + ! Fixed recent compiler warnings. + +2006-02-05 09:47 UTC+0200 Chen Kedem + * source/rtl/gtos2/gtos2.c + * Restore my copyright notice for functions used to be in mouseos2.c + +2006-02-04 17:05 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/harbour.spec + * harbour/make_bsd.sh + * harbour/make_drw.sh + * harbour/make_gnu.sh + * harbour/make_rpm.sh + * harbour/make_tgz.sh.c + * harbour/source/compiler/Makefile + * harbour/source/compiler/cmdcheck.c + * harbour/source/compiler/complex.c + * harbour/source/compiler/genc.c + * harbour/source/compiler/gencc.c + * harbour/source/compiler/gencli.c + * harbour/source/compiler/gencobj.c + * harbour/source/compiler/genhrb.c + * harbour/source/compiler/genjava.c + * harbour/source/compiler/genobj32.c + * harbour/source/compiler/harbour.c + * harbour/source/compiler/harbour.l + * harbour/source/compiler/harbour.y + * harbour/source/compiler/hbcomp.c + * harbour/source/compiler/hbdead.c + * harbour/source/compiler/hbfix.c + * harbour/source/compiler/hbfunchk.c + * harbour/source/compiler/hbgenerr.c + * harbour/source/compiler/hbident.c + * harbour/source/compiler/hbpcode.c + * harbour/source/compiler/ppcomp.c + * harbour/source/macro/macro.y + * harbour/source/pp/ppcore.c + * harbour/source/pp/ppgen.c + * harbour/source/pp/pplib.c + * harbour/source/vm/cmdarg.c + * harbour/source/vm/estack.c + * harbour/source/vm/fm.c + * harbour/source/vm/macro.c + * harbour/utils/hbpp/hbpp.c + * harbour/utils/hbpp/hbpp.h + * harbour/utils/hbpp/hbppcomp.c + * harbour/utils/hbpp/hbppcore.c + * harbour/utils/hbpp/hbpplib.c + * harbour/utils/hbpp/pragma.c + * changed the internal compiler API to be MT safe. + All global and static non constant variables replaced by + HB_COMP structure which have all compiler context settings. + It's possible to allocate simultaneously many compiler contexts + and compile code. Only constant/read only variables are shared. + In macro compiler HB_COMP is replaced by HB_MACRO. + In source code I everywhere used to macros: HB_COMP_DECL and + HB_COMP_PARAM which are equivalents of old HB_MACRO_DECL and + HB_MACRO_PARAM definitions. + We will only have to change compiler FATAL errors support to + not execute exit() for non batch systems. + * make macro compiler fully MT safe + * removed not longer used definitions and variables + ! add direct accessing to PP line number information - it fixes missing + line numbers reported recently + ! added generating .ppo files when tokens are teken directly by compiler + - it fixes empty .ppo file problem + ! clear hb_stack internall variables after removing hb_stack to avoid + possible GPF if application still works and try to access unexsiting + hb_stack + ! do not allocate new memory block when final FM statistic report is + generated - it fixes problem with GPF when application compiled with + FM statistic exits and CLIPPER envvar is set. + ! fixed memory leak hb_cmdargCheck() + ! added to harbour.y symbol destructors - it should fixes memory leaks + in syntax errors but it uses quite new bison feature which is not + fully supported yet. Unfortunately it's also not MT safe and the + destructors implementation in 1.875c does not respect %parse-param. + Bison documentation says that it should so I hope it will be fixed + soon (or maybe even already is in the newest bison versions) before + I'll add multi context compilation support. If not then I will have + to add some workaround. I can pass compiler context pointer inside YYSTYPE using hack in a lexer but it will force really huge number modifications in existing bison rules so probably it will be much easier to fix bison or write a small tool to update generated parser. diff --git a/harbour/include/hbapi.h b/harbour/include/hbapi.h index ea1f3cd8ee..bd4db6d155 100644 --- a/harbour/include/hbapi.h +++ b/harbour/include/hbapi.h @@ -796,14 +796,18 @@ typedef struct HB_PCODE_INFO_ /* compiled pcode container */ typedef struct HB_MACRO_ /* a macro compiled pcode container */ { + /* common to compiler members */ + ULONG supported; /* various flags for supported capabilities */ + + /* macro compiler only members */ char * string; /* compiled string */ ULONG length; /* length of the string */ int Flags; /* some flags we may need */ int status; /* status of compilation */ - ULONG supported; /* various flags for supported capabilities */ HB_ITEM_PTR pError; /* error object returned from the parser */ HB_PCODE_INFO_PTR pCodeInfo; /* pointer to pcode buffer and info */ void * pLex; /* lexer buffer pointer */ + void * pExprLst; /* list with allocated expressions */ int exprType; /* type of successfully compiled expression */ USHORT uiListElements; /* number of elements in macro list expression */ USHORT uiNameLen; /* the maximum symbol name length */ diff --git a/harbour/include/hbcomp.h b/harbour/include/hbcomp.h index 6d96fee1b8..29b82653a5 100644 --- a/harbour/include/hbcomp.h +++ b/harbour/include/hbcomp.h @@ -62,185 +62,18 @@ #include /* alloca prototype */ #endif +#include "hbmacro.ch" #include "hbapi.h" #include "hberrors.h" #include "hbpp.h" #include "hbver.h" +#include "hbmacro.h" #include "hbexprop.h" #include "hbpcode.h" #include "hbhash.h" HB_EXTERN_BEGIN -/* compiler related declarations */ - -/* Output types */ -typedef enum -{ - LANG_C, /* C language (by default) */ - LANG_CLI, /* .NET IL language */ - LANG_OBJ32, /* DOS/Windows 32 bits */ - LANG_JAVA, /* Java */ - LANG_PORT_OBJ, /* Portable objects */ - LANG_OBJ_MODULE /* Platform dependant object module */ -} LANGUAGES; /* supported Harbour output languages */ - -struct _COMCLASS; /* forward declaration */ - -/* Declared Function/Method support structure */ -typedef struct _COMDECLARED -{ - char * szName; /* the name of the symbol */ - BYTE cType; - USHORT iParamCount; - BYTE * cParamTypes; - struct _COMCLASS * pClass; - struct _COMCLASS * ( * pParamClasses ); - struct _COMDECLARED * pNext; /* pointer to the next declared function */ -} COMDECLARED, * PCOMDECLARED; - -/* Declared Class support structure */ -typedef struct _COMCLASS -{ - char * szName; - PCOMDECLARED pMethod; - PCOMDECLARED pLastMethod; - struct _COMCLASS * pNext; -} COMCLASS, * PCOMCLASS; - -/* locals, static, public variables support */ -typedef struct _VAR -{ - char * szName; /* variable name */ - char * szAlias; /* variable alias namespace */ - int iUsed; /* number of times used */ - int iDeclLine; /* declaration line number */ - BYTE cType; /* optional strong typing */ - PCOMCLASS pClass; - struct _VAR * pNext; /* pointer to next defined variable */ -} VAR, * PVAR; - -typedef struct HB_ENUMERATOR_ -{ - char *szName; - BOOL bForEach; - struct HB_ENUMERATOR_ *pNext; -} HB_ENUMERATOR, *HB_ENUMERATOR_PTR; /* support structure for FOR EACH statements */ - -/*Support for traversing of linked list */ -#define HB_CARGO_FUNC( proc ) void proc( void *cargo ) -typedef HB_CARGO_FUNC( HB_CARGO_FUNC_ ); -typedef HB_CARGO_FUNC_ *HB_CARGO_FUNC_PTR; - -#define HB_CARGO2_FUNC( proc ) void proc( void *cargo, void *dummy ) -typedef HB_CARGO2_FUNC( HB_CARGO2_FUNC_ ); -typedef HB_CARGO2_FUNC_ *HB_CARGO2_FUNC_PTR; - -/* pcode chunks bytes size */ -#define HB_PCODE_CHUNK 100 - -/* structure to hold a Clipper defined function */ -typedef struct __FUNC -{ - char * szName; /* name of a defined Clipper function */ - HB_SYMBOLSCOPE cScope; /* scope of a defined Clipper function */ - BYTE bFlags; /* some flags we may need */ - USHORT wParamCount; /* number of declared parameters */ - USHORT wParamNum; /* current parameter number */ - PVAR pLocals; /* pointer to local variables list */ - PVAR pStatics; /* pointer to static variables list */ - PVAR pFields; /* pointer to fields variables list */ - PVAR pMemvars; /* pointer to memvar variables list */ - PVAR pPrivates; /* pointer to private variables list */ - BYTE * pCode; /* pointer to a memory block where pcode is stored */ - ULONG lPCodeSize; /* total memory size for pcode */ - ULONG lPCodePos; /* actual pcode offset */ - int iStaticsBase; /* base for this function statics */ - ULONG * pNOOPs; /* pointer to the NOOP array */ - ULONG * pJumps; /* pointer to the Jumps array */ - ULONG iNOOPs; /* NOOPs Counter */ - ULONG iJumps; /* Jumps Counter */ - BYTE * pStack; /* Compile Time Stack */ - USHORT iStackSize; /* Compile Time Stack size */ - int iStackIndex; /* Compile Time Stack index */ - PCOMDECLARED pStackFunctions[ 8 ]; /* Declared Functions on the Compile Time Stack */ - int iStackFunctions; /* Index into DEclared Functions on Compile Time Stack */ - PCOMCLASS pStackClasses[ 8 ]; /* Declared Classes on the Compile Time Stack */ - int iStackClasses; /* Index into Declared Classes on Compile Time Stack */ - BOOL bLateEval; /* TRUE if accessing of declared (compile time) variables is allowed */ - struct __FUNC * pOwner; /* pointer to the function/procedure that owns the codeblock */ - struct __FUNC * pNext; /* pointer to the next defined function */ - HB_ENUMERATOR_PTR pEnum; /* pointer to FOR EACH variables */ -} _FUNC, * PFUNCTION; - -/* structure to hold an INLINE block of source */ -typedef struct __INLINE -{ - char * szName; /* name of a inline function */ - BYTE * pCode; /* pointer to a memory block where pcode is stored */ - ULONG lPCodeSize; /* total memory size for pcode */ - char * szFileName; /* Source file name */ - int iLine; /* Source line number */ - struct __INLINE * pNext; /* pointer to the next defined inline */ -} _INLINE, * PINLINE; - -/* structure to control all Clipper defined functions */ -typedef struct -{ - PFUNCTION pFirst; /* pointer to the first defined funtion */ - PFUNCTION pLast; /* pointer to the last defined function */ - int iCount; /* number of defined functions */ -} FUNCTIONS; - -/* structure to control all Clipper defined functions */ -typedef struct -{ - PINLINE pFirst; /* pointer to the first defined inline */ - PINLINE pLast; /* pointer to the last defined inline */ - int iCount; /* number of defined inlines */ -} INLINES; - -/* compiler symbol support structure */ -typedef struct _COMSYMBOL -{ - char * szName; /* the name of the symbol */ - HB_SYMBOLSCOPE cScope; /* the scope of the symbol */ - BYTE cType; - BOOL bFunc; /* is it a function name (TRUE) or memvar (FALSE) */ - PCOMCLASS pClass; - struct _COMSYMBOL * pNext; /* pointer to the next defined symbol */ -} COMSYMBOL, * PCOMSYMBOL; - -/* symbol table support structures */ -typedef struct -{ - PCOMSYMBOL pFirst; /* pointer to the first defined symbol */ - PCOMSYMBOL pLast; /* pointer to the last defined symbol */ - int iCount; /* number of defined symbols */ -} SYMBOLS; - -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 _AUTOOPEN -{ - char * szName; - struct _AUTOOPEN * pNext; -} AUTOOPEN, * PAUTOOPEN; /* support structure for extern symbols */ - -typedef struct _HB_LABEL_INFO -{ - FILE * yyc; - BOOL fVerbose; - BOOL fSetSeqBegin; - BOOL fCondJump; - ULONG * pulLabels; -} HB_LABEL_INFO, * PHB_LABEL_INFO; - /* definitions for hb_compPCodeEval() support */ typedef void * HB_VOID_PTR; #define HB_PCODE_FUNC( func, type ) ULONG func( PFUNCTION pFunc, ULONG lPCodePos, type cargo ) @@ -253,33 +86,9 @@ extern void hb_compPCodeTrace( PFUNCTION, HB_PCODE_FUNC_PTR *, void * ); extern void hb_compGenLabelTable( PFUNCTION pFunc, PHB_LABEL_INFO label_info ); - -typedef struct _HB_COMP_LEX -{ - PHB_PP_STATE pPP; - int iState; - char * lasttok; -} -HB_COMP_LEX, * PHB_COMP_LEX; - -typedef struct _HB_COMP -{ - PHB_COMP_LEX pLex; -} -HB_COMP, * HB_COMP_PTR; - -extern HB_COMP_PTR hb_comp_new( void ); -extern void hb_comp_free( HB_COMP_PTR ); - - /* compiler PP functions and variables */ -#define HB_PP_STR_SIZE 12288 -#define HB_PP_BUFF_SIZE 4096 -extern void hb_pp_SetRules( BOOL fQuiet, int argc, char * argv[] ); -extern int hb_pp_Internal( char * ); -extern void hb_compParserStop( HB_COMP_PTR pComp ); - - +extern void hb_compInitPP( HB_COMP_DECL, int argc, char * argv[] ); +extern void hb_compParserStop( HB_COMP_DECL ); #define VS_NONE 0 #define VS_LOCAL 1 @@ -291,7 +100,7 @@ extern void hb_compParserStop( HB_COMP_PTR pComp ); #define VS_MEMVAR ( VS_PUBLIC | VS_PRIVATE ) /* return detailed information about a class of variable */ -int hb_compVariableScope( char * ); +extern int hb_compVariableScope( HB_COMP_DECL, char * ); #define HB_VS_UNDECLARED 0 /* variables declared in a current codeblock/function/procedure */ #define HB_VS_CBLOCAL_VAR 1 /* local parameter of a codeblock */ @@ -324,152 +133,159 @@ int hb_compVariableScope( char * ); extern void hb_compMainExit( void ); /* main cleanup function */ -extern void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */ -extern PFUNCTION hb_compFunctionFind( char * szFunName ); /* locates a previously defined function */ -extern PINLINE hb_compInlineFind( char * szFunName ); -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 PINLINE hb_compInlineAdd( HB_COMP_PTR pComp, char * szFunName, int iLine ); +extern void hb_compFunctionAdd( HB_COMP_DECL, char * szFunName, HB_SYMBOLSCOPE cScope, int iType ); /* starts a new Clipper language function definition */ +extern PFUNCTION hb_compFunctionFind( HB_COMP_DECL, char * szFunName ); /* locates a previously defined function */ +extern PINLINE hb_compInlineFind( HB_COMP_DECL, char * szFunName ); +extern USHORT hb_compFunctionGetPos( HB_COMP_DECL, char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */ +extern PFUNCTION hb_compFunctionKill( HB_COMP_DECL, PFUNCTION ); /* releases all memory allocated by function and returns the next one */ +extern void hb_compAnnounce( HB_COMP_DECL, char * ); +extern PINLINE hb_compInlineAdd( HB_COMP_DECL, char * szFunName, int iLine ); -extern PFUNCTION hb_compFunCallAdd( char * szFuntionName ); -extern PFUNCTION hb_compFunCallFind( char * szFunName ); /* locates a previously defined called function */ -extern BOOL hb_compFunCallCheck( char *, int ); +extern PFUNCTION hb_compFunCallAdd( HB_COMP_DECL, char * szFuntionName ); +extern PFUNCTION hb_compFunCallFind( HB_COMP_DECL, char * szFunName ); /* locates a previously defined called function */ +extern BOOL hb_compFunCallCheck( HB_COMP_DECL, char *, int ); -extern void hb_compVariableAdd( char * szVarName, BYTE cType ); /* add a new param, local, static variable to a function definition or a public or private */ +extern void hb_compVariableAdd( HB_COMP_DECL, char * szVarName, BYTE cType ); /* add a new param, local, static variable to a function definition or a public or private */ extern PVAR hb_compVariableFind( PVAR pVars, USHORT wOrder ); /* returns a variable if defined or zero */ extern PVAR hb_compLocalVariableFind( PFUNCTION pFunc, USHORT wVar ); extern USHORT hb_compVariableGetPos( PVAR pVars, char * szVarName ); /* returns the order + 1 of a variable if defined or zero */ -extern int hb_compLocalGetPos( char * szVarName ); /* returns the order + 1 of a local variable */ -extern char * hb_compStaticGetName( USHORT wVar ); /* returns the name of static variable */ +extern int hb_compLocalGetPos( HB_COMP_DECL, char * szVarName ); /* returns the order + 1 of a local variable */ +extern char * hb_compStaticGetName( HB_COMP_DECL, USHORT wVar ); /* returns the name of static variable */ #define HB_SYM_MEMVAR FALSE #define HB_SYM_MSGNAME FALSE #define HB_SYM_FUNCNAME TRUE -extern PCOMSYMBOL hb_compSymbolAdd( char *, USHORT *, BOOL ); +extern PCOMSYMBOL hb_compSymbolAdd( HB_COMP_DECL, char *, USHORT *, BOOL ); extern PCOMSYMBOL hb_compSymbolKill( PCOMSYMBOL ); /* releases all memory allocated by symbol and returns the next one */ -extern PCOMSYMBOL hb_compSymbolFind( char *, USHORT *, BOOL ); /* returns a symbol pointer from the symbol table */ -extern PCOMSYMBOL hb_compSymbolGetPos( USHORT ); /* returns a symbol based on its index on the symbol table */ +extern PCOMSYMBOL hb_compSymbolFind( HB_COMP_DECL, char *, USHORT *, BOOL ); /* returns a symbol pointer from the symbol table */ +extern PCOMSYMBOL hb_compSymbolGetPos( HB_COMP_DECL, USHORT ); /* returns a symbol based on its index on the symbol table */ -extern PCOMDECLARED hb_compDeclaredAdd( char * ); -extern PCOMDECLARED hb_compDeclaredFind( char * ); +extern PCOMDECLARED hb_compDeclaredAdd( HB_COMP_DECL, char * ); +extern PCOMDECLARED hb_compDeclaredFind( HB_COMP_DECL, char * ); -extern PCOMCLASS hb_compClassAdd( char * ); -extern PCOMCLASS hb_compClassFind( char * ); -extern PCOMDECLARED hb_compMethodAdd( PCOMCLASS pClass, char * ); +extern PCOMCLASS hb_compClassAdd( HB_COMP_DECL, char * ); +extern PCOMCLASS hb_compClassFind( HB_COMP_DECL, char * ); +extern PCOMDECLARED hb_compMethodAdd( HB_COMP_DECL, PCOMCLASS pClass, char * ); extern PCOMDECLARED hb_compMethodFind( PCOMCLASS pClass, char * ); -extern void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType ); +extern void hb_compDeclaredParameterAdd( HB_COMP_DECL, char * szVarName, BYTE cValueType ); -extern void hb_compGenBreak( void ); /* generate code for BREAK statement */ +extern void hb_compGenBreak( HB_COMP_DECL ); /* generate code for BREAK statement */ -extern void hb_compExternGen( void ); /* generates the symbols for the EXTERN names */ -extern void hb_compExternAdd( char * szExternName ); /* defines a new extern name */ +extern void hb_compExternGen( HB_COMP_DECL ); /* generates the symbols for the EXTERN names */ +extern void hb_compExternAdd( HB_COMP_DECL, char * szExternName ); /* defines a new extern name */ -extern void hb_compAutoOpenAdd( char * szName ); +extern void hb_compAutoOpenAdd( HB_COMP_DECL, char * szName ); + +extern void hb_compSwitchKill( HB_COMP_DECL ); +extern void hb_compLoopKill( HB_COMP_DECL ); +extern void hb_compRTVariableKill( HB_COMP_DECL ); +extern void hb_compElseIfKill( HB_COMP_DECL ); + +extern void hb_compGenError( HB_COMP_DECL, char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ); /* generic parsing error management function */ +extern void hb_compGenWarning( HB_COMP_DECL, char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2); /* generic parsing warning management function */ + +extern BOOL hb_compIsValidMacroVar( char *, HB_COMP_DECL ); /* checks if passed variable can be used in macro */ +extern BOOL hb_compForEachVarError( HB_COMP_DECL, char * ); /* checks if it is FOR EACH enumerator variable and generates a warning */ + +extern ULONG hb_compGenJump( LONG, HB_COMP_DECL ); /* generates the pcode to jump to a specific offset */ +extern ULONG hb_compGenJumpFalse( LONG, HB_COMP_DECL ); /* generates the pcode to jump if false */ +extern ULONG hb_compGenJumpTrue( LONG, HB_COMP_DECL ); /* generates the pcode to jump if true */ +extern void hb_compGenJumpHere( ULONG, HB_COMP_DECL ); /* returns the pcode pos where to set a jump offset */ +extern void hb_compGenJumpThere( ULONG, ULONG, HB_COMP_DECL ); /* sets a jump offset */ + +extern void hb_compLinePush( HB_COMP_DECL ); /* generates the pcode with the currently compiled source code line */ +extern void hb_compLinePushIfDebugger( HB_COMP_DECL ); /* generates the pcode with the currently compiled source code line */ +extern void hb_compLinePushIfInside( HB_COMP_DECL ); /* generates the pcode with the currently compiled source code line */ + +extern void hb_compGenMessage( char * szMsgName, BOOL bIsObject, HB_COMP_DECL ); /* sends a message to an object */ +extern void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_COMP_DECL ); /* generates an underscore-symbol name for a data assignment */ +extern void hb_compGenPopVar( char * szVarName, HB_COMP_DECL ); /* generates the pcode to pop a value from the virtual machine stack onto a variable */ +extern void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_COMP_DECL ); /* Pushes a number on the virtual machine stack */ +extern void hb_compGenPushFunCall( char *, HB_COMP_DECL ); /* generates the pcode to push function's call */ +extern void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_COMP_DECL ); /* generates the pcode to push a variable value to the virtual machine stack */ +extern void hb_compGenPushVarRef( char * szVarName, HB_COMP_DECL ); /* generates the pcode to push a variable by reference to the virtual machine stack */ +extern void hb_compGenPushInteger( int iNumber, HB_COMP_DECL ); /* Pushes a integer number on the virtual machine stack */ +extern void hb_compGenPushLogical( int iTrueFalse, HB_COMP_DECL ); /* pushes a logical value on the virtual machine stack */ +extern void hb_compGenPushLong( HB_LONG lNumber, HB_COMP_DECL ); /* Pushes a long number on the virtual machine stack */ +extern void hb_compGenPushDate( HB_LONG lNumber, HB_COMP_DECL ); /* Pushes a date constant on the virtual machine stack */ +extern void hb_compGenPushNil( HB_COMP_DECL ); /* Pushes nil on the virtual machine stack */ +extern void hb_compGenPushString( char * szText, ULONG ulLen, HB_COMP_DECL ); /* Pushes a string on the virtual machine stack */ +extern void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_COMP_DECL ); /* Pushes a symbol on to the Virtual machine stack */ +extern void hb_compGenPushAliasedVar( char *, BOOL, char *, long, HB_COMP_DECL ); +extern void hb_compGenPopAliasedVar( char *, BOOL, char *, long, HB_COMP_DECL ); +extern void hb_compGenPushFunRef( char *, HB_COMP_DECL ); +extern void hb_compGenVarPCode( BYTE, char *, HB_COMP_DECL ); +extern void hb_compGenPCode1( BYTE, HB_COMP_DECL ); /* generates 1 byte of pcode */ +extern void hb_compGenPData1( BYTE, HB_COMP_DECL ); /* generates 1 byte of pcode argument */ +extern void hb_compGenPCode2( BYTE, BYTE, HB_COMP_DECL ); /* generates 2 bytes of pcode + flag for optional StrongType(). */ +extern void hb_compGenPCode3( BYTE, BYTE, BYTE, HB_COMP_DECL ); /* generates 3 bytes of pcode + flag for optional StrongType() */ +extern void hb_compGenPCode4( BYTE, BYTE, BYTE, BYTE, HB_COMP_DECL ); /* generates 4 bytes of pcode + flag for optional StrongType() */ +extern void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_COMP_DECL ); /* copy bytes to a pcode buffer + flag for optional StrongType() */ + +extern ULONG hb_compSequenceBegin( HB_COMP_DECL ); +extern ULONG hb_compSequenceEnd( HB_COMP_DECL ); +extern void hb_compSequenceFinish( ULONG, int, HB_COMP_DECL ); + +/* support for FIELD declaration */ +extern void hb_compFieldSetAlias( HB_COMP_DECL, char *, int ); +extern int hb_compFieldsCount( HB_COMP_DECL ); + +/* Static variables */ +extern void hb_compStaticDefStart( HB_COMP_DECL ); +extern void hb_compStaticDefEnd( HB_COMP_DECL ); +extern void hb_compGenStaticName( char *, HB_COMP_DECL ); -extern void hb_compSwitchKill( void ); -extern void hb_compLoopKill( void ); -extern void hb_compRTVariableKill( void ); -extern void hb_compElseIfKill( void ); #ifdef HB_MACRO_SUPPORT -#define hb_compErrorType( p ) hb_macroError( EG_ARG, HB_MACRO_PARAM ) -#define hb_compErrorIndex( p ) hb_macroError( EG_BOUND, HB_MACRO_PARAM ) -#define hb_compErrorSyntax( p ) hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ) -#define hb_compErrorLValue( p ) hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ) -#define hb_compErrorBound( p ) hb_macroError( EG_BOUND, HB_MACRO_PARAM ) -#define hb_compErrorAlias( p ) hb_macroError( EG_NOALIAS, HB_MACRO_PARAM ) -#define hb_compErrorDuplVar( c ) hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ) -#define hb_compErrorRefer( p,c ) hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ) -#define hb_compWarnMeaningless( p ) -#define hb_compErrorMacro( p ) +#define hb_compErrorType( p, x ) hb_macroError( EG_ARG, ( p ) ) +#define hb_compErrorIndex( p, x ) hb_macroError( EG_BOUND, ( p ) ) +#define hb_compErrorSyntax( p, x ) hb_macroError( EG_SYNTAX, ( p ) ) +#define hb_compErrorLValue( p, x ) hb_macroError( EG_SYNTAX, ( p ) ) +#define hb_compErrorBound( p, x ) hb_macroError( EG_BOUND, ( p ) ) +#define hb_compErrorAlias( p, x ) hb_macroError( EG_NOALIAS, ( p ) ) +#define hb_compErrorDuplVar( p, c ) hb_macroError( EG_SYNTAX, ( p ) ) +#define hb_compErrorRefer( p, x, c ) hb_macroError( EG_SYNTAX, ( p ) ) +#define hb_compWarnMeaningless( p, x ) +#define hb_compErrorMacro( p, x ) + +/* Codeblocks */ +extern void hb_compCodeBlockStart( HB_COMP_DECL ); /* starts a codeblock creation */ #else /* HB_MACRO_SUPPORT */ -extern BOOL hb_compIsValidMacroVar( char * ); /* checks if passed variable can be used in macro */ -extern BOOL hb_compForEachVarError( char * ); /* checks if it is FOR EACH enumerator variable and generates a warning */ +extern HB_EXPR_PTR hb_compErrorType( HB_COMP_DECL, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compErrorIndex( HB_COMP_DECL, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compErrorSyntax( HB_COMP_DECL, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compErrorLValue( HB_COMP_DECL, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compErrorBound( HB_COMP_DECL, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compErrorAlias( HB_COMP_DECL, HB_EXPR_PTR ); +extern void hb_compErrorDuplVar( HB_COMP_DECL, const char * ); +extern HB_EXPR_PTR hb_compErrorRefer( HB_COMP_DECL, HB_EXPR_PTR, const char * ); +extern HB_EXPR_PTR hb_compWarnMeaningless( HB_COMP_DECL, HB_EXPR_PTR ); +extern void hb_compErrorMacro( HB_COMP_DECL, const char * ); -extern ULONG hb_compGenJump( LONG ); /* generates the pcode to jump to a specific offset */ -extern ULONG hb_compGenJumpFalse( LONG ); /* generates the pcode to jump if false */ -extern ULONG hb_compGenJumpTrue( LONG ); /* generates the pcode to jump if true */ -extern void hb_compGenJumpHere( ULONG ); /* returns the pcode pos where to set a jump offset */ -extern void hb_compGenJumpThere( ULONG, ULONG ); /* sets a jump offset */ - - -extern void hb_compLinePush( void ); /* generates the pcode with the currently compiled source code line */ -extern void hb_compLinePushIfDebugger( void ); /* generates the pcode with the currently compiled source code line */ -extern void hb_compLinePushIfInside( void ); /* generates the pcode with the currently compiled source code line */ - -extern void hb_compGenMessage( char * szMsgName, BOOL bIsObject ); /* sends a message to an object */ -extern void hb_compGenMessageData( char * szMsg, BOOL bIsObject ); /* generates an underscore-symbol name for a data assignment */ -extern void hb_compGenPopVar( char * szVarName ); /* generates the pcode to pop a value from the virtual machine stack onto a variable */ -extern void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec ); /* Pushes a number on the virtual machine stack */ -extern void hb_compGenPushFunCall( char * ); /* generates the pcode to push function's call */ -extern void hb_compGenPushVar( char * szVarName, BOOL bMacroVar ); /* generates the pcode to push a variable value to the virtual machine stack */ -extern void hb_compGenPushVarRef( char * szVarName ); /* generates the pcode to push a variable by reference to the virtual machine stack */ -extern void hb_compGenPushInteger( int iNumber ); /* Pushes a integer number on the virtual machine stack */ -extern void hb_compGenPushLogical( int iTrueFalse ); /* pushes a logical value on the virtual machine stack */ -extern void hb_compGenPushLong( HB_LONG lNumber ); /* Pushes a long number on the virtual machine stack */ -extern void hb_compGenPushDate( HB_LONG lNumber ); /* Pushes a date constant on the virtual machine stack */ -extern void hb_compGenPushNil( void ); /* Pushes nil on the virtual machine stack */ -extern void hb_compGenPushString( char * szText, ULONG ulLen ); /* Pushes a string on the virtual machine stack */ -extern void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias ); /* Pushes a symbol on to the Virtual machine stack */ -extern void hb_compGenPushAliasedVar( char *, BOOL, char *, long ); -extern void hb_compGenPopAliasedVar( char *, BOOL, char *, long ); -extern void hb_compGenPushFunRef( char * ); -extern void hb_compGenVarPCode( BYTE, char * ); -extern void hb_compGenPCode1( BYTE ); /* generates 1 byte of pcode */ -extern void hb_compGenPData1( BYTE ); /* generates 1 byte of pcode argument */ -extern void hb_compGenPCode2( BYTE, BYTE, BOOL ); /* generates 2 bytes of pcode + flag for optional StrongType(). */ -extern void hb_compGenPCode3( BYTE, BYTE, BYTE, BOOL ); /* generates 3 bytes of pcode + flag for optional StrongType() */ -extern void hb_compGenPCode4( BYTE, BYTE, BYTE, BYTE, BOOL ); /* generates 4 bytes of pcode + flag for optional StrongType() */ -extern void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, BOOL ); /* copy bytes to a pcode buffer + flag for optional StrongType() */ - -#if defined(HB_COMP_STRONG_TYPES) -extern void hb_compStrongType( int iSize ); -#endif - - -extern ULONG hb_compSequenceBegin( void ); -extern ULONG hb_compSequenceEnd( void ); -extern void hb_compSequenceFinish( ULONG, int ); +extern HB_EXPR_PTR hb_compErrorStatic( HB_COMP_DECL, const char *, HB_EXPR_PTR ); +extern void hb_compErrorCodeblock( HB_COMP_DECL, const char * ); /* Codeblocks */ -extern void hb_compCodeBlockStart( BOOL ); /* starts a codeblock creation */ -extern void hb_compCodeBlockEnd( void ); /* end of codeblock creation */ -extern void hb_compCodeBlockStop( void ); /* end of fake codeblock */ -extern void hb_compCodeBlockRewind( void ); /* restart of fake codeblock */ +extern void hb_compCodeBlockStart( BOOL, HB_COMP_DECL ); /* starts a codeblock creation */ -/* support for FIELD declaration */ -extern void hb_compFieldSetAlias( char *, int ); -extern int hb_compFieldsCount( void ); +#endif /* HB_MACRO_SUPPORT */ -/* Static variables */ -extern void hb_compStaticDefStart( void ); -extern void hb_compStaticDefEnd( void ); -extern void hb_compGenStaticName( char * ); +/* Codeblocks */ +extern void hb_compCodeBlockEnd( HB_COMP_DECL ); /* end of codeblock creation */ +extern void hb_compCodeBlockStop( HB_COMP_DECL ); /* end of fake codeblock */ +extern void hb_compCodeBlockRewind( HB_COMP_DECL ); /* restart of fake codeblock */ -extern HB_EXPR_PTR hb_compErrorStatic( char *, HB_EXPR_PTR ); -extern HB_EXPR_PTR hb_compErrorType( HB_EXPR_PTR ); -extern HB_EXPR_PTR hb_compErrorIndex( HB_EXPR_PTR ); -extern HB_EXPR_PTR hb_compErrorSyntax( HB_EXPR_PTR ); -extern HB_EXPR_PTR hb_compErrorLValue( HB_EXPR_PTR ); -extern HB_EXPR_PTR hb_compErrorBound( HB_EXPR_PTR ); -extern HB_EXPR_PTR hb_compErrorAlias( HB_EXPR_PTR ); -extern void hb_compErrorDuplVar( char * ); -extern HB_EXPR_PTR hb_compWarnMeaningless( HB_EXPR_PTR ); -extern void hb_compErrorCodeblock( char * ); -extern void hb_compErrorMacro( char * ); -extern HB_EXPR_PTR hb_compErrorRefer( HB_EXPR_PTR, char * ); -extern ULONG hb_compExprListEval( HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ); -extern ULONG hb_compExprListEval2( HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FUNC_PTR pEval ); +extern ULONG hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ); +extern ULONG hb_compExprListEval2( HB_COMP_DECL, HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FUNC_PTR pEval ); -extern void hb_compChkCompilerSwitch( int, char * Args[] ); -extern void hb_compChkEnvironVar( char * ); -extern void hb_compChkPaths( void ); -extern void hb_compChkDefines( int iArg, char * Args[] ); +extern void hb_compChkCompilerSwitch( HB_COMP_DECL, int, char * Args[] ); +extern void hb_compChkEnvironVar( HB_COMP_DECL, char * ); +extern void hb_compChkPaths( HB_COMP_DECL ); +extern void hb_compChkDefines( HB_COMP_DECL, int iArg, char * Args[] ); extern void hb_compPrintUsage( char * ); extern void hb_compPrintCredits( void ); @@ -477,130 +293,47 @@ extern void hb_compFileInfo( void ); extern void hb_compPrintLogo( void ); extern void hb_compPrintModes( void ); -#endif /* HB_MACRO_SUPPORT */ /* Misc functions defined in harbour.c */ -extern void hb_compFinalizeFunction( void ); /* fixes all last defined function returns jumps offsets */ +extern void hb_compFinalizeFunction( HB_COMP_DECL ); /* fixes all last defined function returns jumps offsets */ extern void hb_compNOOPadd( PFUNCTION pFunc, ULONG ulPos ); extern void hb_compNOOPfill( PFUNCTION pFunc, ULONG ulFrom, int iCount, BOOL fPop, BOOL fCheck ); -extern BOOL hb_compIsJump( PFUNCTION pFunc, ULONG ulPos ); +extern BOOL hb_compIsJump( HB_COMP_DECL, PFUNCTION pFunc, ULONG ulPos ); /* Misc functions defined in hbfix.c */ -extern void hb_compFixFuncPCode( PFUNCTION ); +extern void hb_compFixFuncPCode( HB_COMP_DECL, PFUNCTION ); /* Misc functions defined in hbstripl.c */ extern void hb_compStripFuncLines( PFUNCTION pFunc ); /* Misc functions defined in hbdead.c */ -extern void hb_compCodeTraceMarkDead( PFUNCTION pFunc ); +extern void hb_compCodeTraceMarkDead( HB_COMP_DECL, PFUNCTION pFunc ); /* output related functions defined in gen*.c */ -extern void hb_compGenCCode( PHB_FNAME ); /* generates the C language output */ -extern void hb_compGenILCode( PHB_FNAME ); /* generates the .NET IL language output */ -extern void hb_compGenJava( PHB_FNAME ); /* generates the Java language output */ -extern void hb_compGenPortObj( PHB_FNAME ); /* generates the portable objects */ -extern void hb_compGenObj32( PHB_FNAME ); /* generates OBJ 32 bits */ -extern void hb_compGenCObj( PHB_FNAME ); /* generates platform dependant object module */ +extern void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME ); /* generates the C language output */ +extern void hb_compGenILCode( HB_COMP_DECL, PHB_FNAME ); /* generates the .NET IL language output */ +extern void hb_compGenJava( HB_COMP_DECL, PHB_FNAME ); /* generates the Java language output */ +extern void hb_compGenPortObj( HB_COMP_DECL, PHB_FNAME ); /* generates the portable objects */ +extern void hb_compGenObj32( HB_COMP_DECL, PHB_FNAME ); /* generates OBJ 32 bits */ +extern void hb_compGenCObj( HB_COMP_DECL, PHB_FNAME ); /* generates platform dependant object module */ + +extern void hb_compGenCRealCode( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ); +extern void hb_compGenCString( FILE * yyc, BYTE * pText, USHORT usLen ); /* hbident.c */ -extern char * hb_compIdentifierNew( char * szName, BOOL bCopy ); /* create the reusable identifier */ -extern void hb_compIdentifierOpen( void ); /* prepare the table of identifiers */ -extern void hb_compIdentifierClose( void ); /* release the table of identifiers */ +extern char * hb_compIdentifierNew( HB_COMP_DECL, char * szName, BOOL bCopy ); /* create the reusable identifier */ +extern void hb_compIdentifierOpen( HB_COMP_DECL ); /* prepare the table of identifiers */ +extern void hb_compIdentifierClose( HB_COMP_DECL ); /* release the table of identifiers */ -/* variable used by compiler +/* global readonly variables used by compiler */ -extern HB_COMP_PTR hb_comp_data; - -extern int hb_comp_iLine; -extern FUNCTIONS hb_comp_functions; -extern FUNCTIONS hb_comp_funcalls; -extern SYMBOLS hb_comp_symbols; -extern PCOMDECLARED hb_comp_pFirstDeclared; -extern PCOMDECLARED hb_comp_pLastDeclared; -extern PCOMDECLARED hb_comp_pReleaseDeclared; -extern PCOMCLASS hb_comp_pFirstClass; -extern PCOMCLASS hb_comp_pLastClass; -extern PCOMCLASS hb_comp_pReleaseClass; -extern char * hb_comp_szFromClass; -extern PCOMDECLARED hb_comp_pLastMethod; -extern PFUNCTION hb_comp_pInitFunc; -extern PHB_FNAME hb_comp_pFileName; -extern PHB_FNAME hb_comp_pFilePpo; -extern BOOL hb_comp_bPPO; -extern BOOL hb_comp_bStartProc; -extern BOOL hb_comp_bLineNumbers; -extern BOOL hb_comp_bQuiet; -extern BOOL hb_comp_bShortCuts; -extern int hb_comp_iWarnings; -extern BOOL hb_comp_bAnyWarning; -extern BOOL hb_comp_bAutoMemvarAssume; -extern BOOL hb_comp_bForceMemvars; -extern BOOL hb_comp_bDebugInfo; -extern char hb_comp_szPrefix[ 20 ]; -extern int hb_comp_iGenCOutput; -extern BOOL hb_comp_bNoStartUp; -extern int hb_comp_iExitLevel; -extern int hb_comp_iFunctionCnt; -extern char hb_comp_cVarType; -extern char hb_comp_cDataListType; -extern char hb_comp_cCastType; -extern int hb_comp_iVarScope; -extern BOOL hb_comp_bDontGenLineNum; -extern int hb_comp_iStaticCnt; -extern int hb_comp_iErrorCount; - -extern char * hb_comp_szAnnounce; - -extern PHB_FNAME hb_comp_pOutPath; -extern PHB_FNAME hb_comp_pPpoPath; -extern BOOL hb_comp_bCredits; -extern BOOL hb_comp_bBuildInfo; - -extern BOOL hb_comp_bLogo; -extern BOOL hb_comp_bSyntaxCheckOnly; -extern int hb_comp_iLanguage; - -extern USHORT hb_comp_wSeqCounter; -extern USHORT hb_comp_wForCounter; -extern USHORT hb_comp_wIfCounter; -extern USHORT hb_comp_wWhileCounter; -extern USHORT hb_comp_wCaseCounter; -extern USHORT hb_comp_wSwitchCounter; -extern BOOL hb_comp_long_optimize; -extern BOOL hb_comp_bTextSubst; - -extern char * hb_comp_szDeclaredFun; - -extern char * hb_comp_szLastMethod; extern char * hb_comp_szErrors[]; extern char * hb_comp_szWarnings[]; -extern char * hb_pp_STD_CH; -extern BOOL hb_comp_bAutoOpen; -extern BOOL hb_comp_bError; -extern char hb_comp_cInlineID; - -extern INLINES hb_comp_inlines; -extern int hb_comp_iLineINLINE; -extern int hb_comp_iLinePRG; - -extern ULONG hb_comp_Supported; - -extern char * hb_comp_szFile; - /* table with PCODEs' length */ extern const BYTE hb_comp_pcode_len[]; -/* error messages output */ +/* file handle for error messages */ extern FILE *hb_comp_errFile; -/* Hide Strings */ -extern int hb_comp_iHidden; - - -extern BOOL hb_pp_LiteralEscSeq; -extern BOOL hb_pp_NestedLiteralString; -extern int hb_pp_StreamBlock; -extern unsigned int hb_pp_MaxTranslateCycles; - /* /GC command line setting types */ #define HB_COMPGENC_COMPACT 0 @@ -616,18 +349,25 @@ extern unsigned int hb_pp_MaxTranslateCycles; /* /kx command line setting types - compatibility modes * (turn on a bit in ULONG word) */ -#define HB_COMPFLAG_HARBOUR 1 /* -kh */ -#define HB_COMPFLAG_XBASE 2 /* -kx */ -#define HB_COMPFLAG_HB_INLINE 4 /* -ki */ -#define HB_COMPFLAG_ARRSTR 8 /* -ks strings as array of bytes */ -#define HB_COMPFLAG_OPTJUMP 16 /* -kj turn off jump optimalization */ -#define HB_COMPFLAG_RT_MACRO 64 /* -kr */ -#define HB_COMPFLAG_HB_INLINE_PP 128 /* -kI hb_inLine support in PP */ +#define HB_COMPFLAG_HARBOUR HB_SM_HARBOUR /* 1 -kh */ +#define HB_COMPFLAG_XBASE HB_SM_XBASE /* 2 -kx */ +#define HB_COMPFLAG_SHORTCUTS HB_SM_SHORTCUTS /* 8 -z enable sortcuts for logical operators */ +#define HB_COMPFLAG_ARRSTR HB_SM_ARRSTR /* 16 -ks strings as array of bytes */ +#define HB_COMPFLAG_RT_MACRO HB_SM_RT_MACRO /* 64 -kr */ +#define HB_COMPFLAG_OPTJUMP 256 /* -kj turn off jump optimalization */ +#define HB_COMPFLAG_HB_INLINE_PP 512 /* -kI hb_inLine support in PP */ +#define HB_COMPFLAG_HB_INLINE 1024 /* -ki */ -#ifdef HB_MACRO_SUPPORT - #define HB_COMP_ISSUPPORTED(flag) ( HB_MACRO_DATA->supported & (flag) ) +#define HB_COMP_ISSUPPORTED(flag) ( HB_COMP_PARAM->supported & (flag) ) + +#if defined( HB_MACRO_SUPPORT ) +# define HB_MACRO_GENFLAGS HB_COMPFLAG_RT_MACRO #else - #define HB_COMP_ISSUPPORTED(flag) ( hb_comp_Supported & (flag) ) +# define HB_MACRO_GENFLAGS ( HB_COMP_PARAM->supported & \ + ( HB_COMPFLAG_HARBOUR | \ + HB_COMPFLAG_XBASE | \ + HB_COMPFLAG_SHORTCUTS | \ + HB_COMPFLAG_RT_MACRO ) ) #endif HB_EXTERN_END diff --git a/harbour/include/hbcompdf.h b/harbour/include/hbcompdf.h new file mode 100644 index 0000000000..137a28b0a1 --- /dev/null +++ b/harbour/include/hbcompdf.h @@ -0,0 +1,595 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * definitions shared by compiler and macro compiler + * + * Copyright 2006 Przemyslaw Czerpak + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + + +#ifndef HB_COMPDF_H_ +#define HB_COMPDF_H_ + +#include "hbdefs.h" +#include "hbpp.h" +#include "hbapi.h" +#include "hbhash.h" + +HB_EXTERN_BEGIN + + +/* compiler related declarations */ + +/* Output types */ +typedef enum +{ + LANG_C, /* C language (by default) */ + LANG_CLI, /* .NET IL language */ + LANG_OBJ32, /* DOS/Windows 32 bits */ + LANG_JAVA, /* Java */ + LANG_PORT_OBJ, /* Portable objects */ + LANG_OBJ_MODULE /* Platform dependant object module */ +} LANGUAGES; /* supported Harbour output languages */ + +struct _COMCLASS; /* forward declaration */ + +/* Declared Function/Method support structure */ +typedef struct _COMDECLARED +{ + char * szName; /* the name of the symbol */ + BYTE cType; + USHORT iParamCount; + BYTE * cParamTypes; + struct _COMCLASS * pClass; + struct _COMCLASS * ( * pParamClasses ); + struct _COMDECLARED * pNext; /* pointer to the next declared function */ +} COMDECLARED, * PCOMDECLARED; + +/* Declared Class support structure */ +typedef struct _COMCLASS +{ + char * szName; + PCOMDECLARED pMethod; + PCOMDECLARED pLastMethod; + struct _COMCLASS * pNext; +} COMCLASS, * PCOMCLASS; + +/* locals, static, public variables support */ +typedef struct _VAR +{ + char * szName; /* variable name */ + char * szAlias; /* variable alias namespace */ + int iUsed; /* number of times used */ + int iDeclLine; /* declaration line number */ + BYTE cType; /* optional strong typing */ + PCOMCLASS pClass; + struct _VAR * pNext; /* pointer to next defined variable */ +} VAR, * PVAR; + +typedef struct HB_ENUMERATOR_ +{ + char *szName; + BOOL bForEach; + struct HB_ENUMERATOR_ *pNext; +} HB_ENUMERATOR, *HB_ENUMERATOR_PTR; /* support structure for FOR EACH statements */ + +/* structure to hold a Clipper defined function */ +typedef struct __FUNC +{ + char * szName; /* name of a defined Clipper function */ + HB_SYMBOLSCOPE cScope; /* scope of a defined Clipper function */ + BYTE bFlags; /* some flags we may need */ + USHORT wParamCount; /* number of declared parameters */ + USHORT wParamNum; /* current parameter number */ + PVAR pLocals; /* pointer to local variables list */ + PVAR pStatics; /* pointer to static variables list */ + PVAR pFields; /* pointer to fields variables list */ + PVAR pMemvars; /* pointer to memvar variables list */ + PVAR pPrivates; /* pointer to private variables list */ + BYTE * pCode; /* pointer to a memory block where pcode is stored */ + ULONG lPCodeSize; /* total memory size for pcode */ + ULONG lPCodePos; /* actual pcode offset */ + int iStaticsBase; /* base for this function statics */ + ULONG * pNOOPs; /* pointer to the NOOP array */ + ULONG * pJumps; /* pointer to the Jumps array */ + ULONG iNOOPs; /* NOOPs Counter */ + ULONG iJumps; /* Jumps Counter */ + BYTE * pStack; /* Compile Time Stack */ + USHORT iStackSize; /* Compile Time Stack size */ + int iStackIndex; /* Compile Time Stack index */ + PCOMDECLARED pStackFunctions[ 8 ]; /* Declared Functions on the Compile Time Stack */ + int iStackFunctions; /* Index into DEclared Functions on Compile Time Stack */ + PCOMCLASS pStackClasses[ 8 ]; /* Declared Classes on the Compile Time Stack */ + int iStackClasses; /* Index into Declared Classes on Compile Time Stack */ + BOOL bLateEval; /* TRUE if accessing of declared (compile time) variables is allowed */ + struct __FUNC * pOwner; /* pointer to the function/procedure that owns the codeblock */ + struct __FUNC * pNext; /* pointer to the next defined function */ + HB_ENUMERATOR_PTR pEnum; /* pointer to FOR EACH variables */ +} _FUNC, * PFUNCTION; + +/* structure to hold an INLINE block of source */ +typedef struct __INLINE +{ + char * szName; /* name of a inline function */ + BYTE * pCode; /* pointer to a memory block where pcode is stored */ + ULONG lPCodeSize; /* total memory size for pcode */ + char * szFileName; /* Source file name */ + int iLine; /* Source line number */ + struct __INLINE * pNext; /* pointer to the next defined inline */ +} _INLINE, * PINLINE; + +/* structure to control all Clipper defined functions */ +typedef struct +{ + PFUNCTION pFirst; /* pointer to the first defined funtion */ + PFUNCTION pLast; /* pointer to the last defined function */ + int iCount; /* number of defined functions */ +} FUNCTIONS; + +/* structure to control all Clipper defined functions */ +typedef struct +{ + PINLINE pFirst; /* pointer to the first defined inline */ + PINLINE pLast; /* pointer to the last defined inline */ + int iCount; /* number of defined inlines */ +} INLINES; + +/* compiler symbol support structure */ +typedef struct _COMSYMBOL +{ + char * szName; /* the name of the symbol */ + HB_SYMBOLSCOPE cScope; /* the scope of the symbol */ + BYTE cType; + BOOL bFunc; /* is it a function name (TRUE) or memvar (FALSE) */ + PCOMCLASS pClass; + struct _COMSYMBOL * pNext; /* pointer to the next defined symbol */ +} COMSYMBOL, * PCOMSYMBOL; + +/* symbol table support structures */ +typedef struct +{ + PCOMSYMBOL pFirst; /* pointer to the first defined symbol */ + PCOMSYMBOL pLast; /* pointer to the last defined symbol */ + int iCount; /* number of defined symbols */ +} SYMBOLS; + +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 _AUTOOPEN +{ + char * szName; + struct _AUTOOPEN * pNext; +} AUTOOPEN, * PAUTOOPEN; /* support structure for extern symbols */ + +/* value types seen at language level + */ +#define HB_EV_UNKNOWN 0 +#define HB_EV_NIL 1 +#define HB_EV_NUMERIC 2 +#define HB_EV_STRING 4 +#define HB_EV_CODEBLOCK 8 +#define HB_EV_LOGICAL 16 +#define HB_EV_OBJECT 32 +#define HB_EV_ARRAY 64 +#define HB_EV_SYMBOL 128 +#define HB_EV_VARREF 256 +#define HB_EV_FUNREF 512 +#define HB_EV_DATE 1024 + +/* messages sent to expressions + */ +typedef enum +{ + HB_EA_REDUCE = 0, /* reduce the expression into optimized one */ + HB_EA_ARRAY_AT, /* check if the expession can be used as array */ + HB_EA_ARRAY_INDEX, /* check if the expession can be used as index */ + HB_EA_LVALUE, /* check if the expression can be used as lvalue (left side of an assigment) */ + HB_EA_PUSH_PCODE, /* generate the pcodes to push the value of expression */ + HB_EA_POP_PCODE, /* generate the pcodes to pop the value of expression */ + HB_EA_PUSH_POP, /* generate the pcodes to push and pop the expression */ + HB_EA_STATEMENT, /* generate the pcodes for a statement */ + HB_EA_DELETE /* delete components of the expression */ +} HB_EXPR_MESSAGE; + +/* additional definitions used to distinguish numeric expressions + */ +#define HB_ET_LONG 1 +#define HB_ET_DOUBLE 2 + +/* additional definitions used to distinguish macro expressions + */ +#define HB_ET_MACRO_VAR 0 /* &variable */ +#define HB_ET_MACRO_SYMBOL 1 /* &fimcall() */ +#define HB_ET_MACRO_ALIASED 2 /* &alias->&variable */ +#define HB_ET_MACRO_EXPR 4 /* &( expr ) */ +#define HB_ET_MACRO_LIST 16 /* &variable used as in literal arrays or function call argument. */ +#define HB_ET_MACRO_INDEX 32 /* &variable used as arrays index. */ +#define HB_ET_MACRO_PARE 64 /* &variable used as parentesised expressions. */ +#define HB_ET_MACRO_REFER 128 /* ¯o used in @ (pass by reference) */ + +/* types of expressions + * NOTE: the order of these definition is important - change it carefully + * All types <= HB_ET_FUNREF are constant values + * All types <= HB_ET_VARIABLE are a simple values + * All types > HB_ET_VARIABLE are operators + */ +typedef enum +{ + HB_ET_NONE = 0, + HB_ET_NIL, + HB_ET_NUMERIC, + HB_ET_DATE, + HB_ET_STRING, + HB_ET_CODEBLOCK, + HB_ET_LOGICAL, + HB_ET_SELF, + HB_ET_ARRAY, + HB_ET_VARREF, + HB_ET_REFERENCE, + HB_ET_FUNREF, + HB_ET_IIF, + HB_ET_LIST, + HB_ET_ARGLIST, + HB_ET_MACROARGLIST, + HB_ET_ARRAYAT, + HB_ET_MACRO, + HB_ET_FUNCALL, + HB_ET_ALIASVAR, + HB_ET_ALIASEXPR, + HB_ET_SEND, + HB_ET_FUNNAME, + HB_ET_ALIAS, + HB_ET_RTVAR, /* PRIVATE or PUBLIC declaration of variable */ + HB_ET_VARIABLE, + HB_EO_POSTINC, /* post-operators -> lowest precedence */ + HB_EO_POSTDEC, + HB_EO_ASSIGN, /* assigments */ + HB_EO_PLUSEQ, + HB_EO_MINUSEQ, + HB_EO_MULTEQ, + HB_EO_DIVEQ, + HB_EO_MODEQ, + HB_EO_EXPEQ, + HB_EO_OR, /* logical operators */ + HB_EO_AND, + HB_EO_NOT, + HB_EO_EQUAL, /* relational operators */ + HB_EO_EQ, + HB_EO_LT, + HB_EO_GT, + HB_EO_LE, + HB_EO_GE, + HB_EO_NE, + HB_EO_IN, + HB_EO_PLUS, /* addition */ + HB_EO_MINUS, + HB_EO_MULT, /* multiple */ + HB_EO_DIV, + HB_EO_MOD, + HB_EO_POWER, + HB_EO_NEGATE, /* sign operator */ + HB_EO_PREINC, + HB_EO_PREDEC /* pre-operators -> the highest precedence */ +} HB_EXPR_OPERATOR; + +#define HB_EXPR_COUNT ( HB_EO_PREDEC + 1 ) + +typedef USHORT HB_EXPRTYPE; + +typedef struct HB_EXPR_ +{ + union + { + char *asSymbol; /* variable name */ + BOOL asLogical; /* logical value */ + struct + { + char *string; /* literal strings */ + BOOL dealloc; /* automatic deallocate on expresion deletion */ + } asString; + struct + { + struct HB_EXPR_ *pMacro; /* macro variable */ + char *szName; /* variable name */ + } asRTVar; /* PUBLIC or PRIVATE variable declaration */ + struct + { + HB_LONG lVal; /* long value */ + double dVal; /* double value */ + unsigned char bWidth; /* unsigned char used intentionally */ + unsigned char bDec; /* unsigned char used intentionally */ + unsigned char NumType; /* used to distinguish LONG and DOUBLE */ + } asNum; + struct + { + unsigned char cMacroOp; /* macro operator */ + unsigned char SubType; /* context in which macro is used */ + char * szMacro; /* identifier after the macro operator */ + struct HB_EXPR_ *pExprList; /* list elements if &(...) was used */ + struct HB_EXPR_ *pFunCall; /* pointer to a function if used as function's call argument */ + } asMacro; + struct + { + struct HB_EXPR_ *pExprList; /* list elements */ + struct HB_EXPR_ *pIndex; /* array index, others */ + } asList; + struct + { + BOOL isMacro; /* TRUE=codeblock contains macro expression */ + BOOL lateEval; /* TRUE=late evaluation of macro */ + char *string; /* source code of a codeblock */ + struct HB_EXPR_ *pExprList; /* list elements */ + HB_CBVAR_PTR pLocals; /* list of local variables */ + } asCodeblock; + struct + { + struct HB_EXPR_ *pAlias; /* alias expression */ + struct HB_EXPR_ *pVar; /* aliased variable or macro */ + struct HB_EXPR_ *pExpList; /* aliased expression list */ + } asAlias; + struct + { + struct HB_EXPR_ *pFunName; /* function name */ + struct HB_EXPR_ *pParms; /* function call parameters */ + } asFunCall; + struct + { + struct HB_EXPR_ *pObject; /* object */ + struct HB_EXPR_ *pParms; /* method parameters */ + char * szMessage; /* message as string */ + struct HB_EXPR_ *pMessage; /* message as macro */ + } asMessage; + struct + { + struct HB_EXPR_ *pLeft; /* object */ + struct HB_EXPR_ *pRight; /* object */ + } asOperator; + struct HB_EXPR_ *asReference; + } value; + ULONG ulLength; + ULONG Counter; + HB_EXPRTYPE ExprType; /* internal expression type */ + USHORT ValType; /* language level value type */ + struct HB_EXPR_ *pNext; /* next expression in the list of expressions */ +} HB_EXPR, *HB_EXPR_PTR; + +/* support structure for else if pcode fixups */ +typedef struct HB_ELSEIF_ +{ + ULONG ulOffset; + struct HB_ELSEIF_ * pElseif; /* next ELSEIF in the current IF statement */ + struct HB_ELSEIF_ * pPrev; /* previous IF statement */ +} HB_ELSEIF, * HB_ELSEIF_PTR; + +/* support structure for EXIT and LOOP statements */ +typedef struct HB_LOOPEXIT_ +{ + ULONG ulOffset; + USHORT wSeqCounter; + struct HB_LOOPEXIT_ * pLoopList; + struct HB_LOOPEXIT_ * pExitList; + struct HB_LOOPEXIT_ * pNext; +} HB_LOOPEXIT, * HB_LOOPEXIT_PTR; + +/* support structure for SWITCH statement */ +typedef struct HB_SWITCHCASE_ +{ + ULONG ulOffset; + HB_EXPR_PTR pExpr; + struct HB_SWITCHCASE_ *pNext; +} HB_SWITCHCASE, * HB_SWITCHCASE_PTR; + +typedef struct HB_SWITCHCMD_ +{ + ULONG ulOffset; + int iCount; + HB_SWITCHCASE_PTR pCases; + HB_SWITCHCASE_PTR pLast; + ULONG ulDefault; + struct HB_SWITCHCMD_ *pPrev; +} HB_SWITCHCMD, *HB_SWITCHCMD_PTR; + +/* support structure for PUBLIC and PRIVATE statements */ +typedef struct HB_RTVAR_ +{ + HB_EXPR_PTR pVar; + BOOL bPopValue; + struct HB_RTVAR_ *pNext; + struct HB_RTVAR_ *pPrev; +} HB_RTVAR, *HB_RTVAR_PTR; + + +typedef struct _HB_LABEL_INFO +{ + FILE * yyc; + BOOL fVerbose; + BOOL fSetSeqBegin; + BOOL fCondJump; + ULONG * pulLabels; +} HB_LABEL_INFO, * PHB_LABEL_INFO; + + +#if !defined( HB_MACRO_SUPPORT ) + +typedef struct _HB_COMP_LEX +{ + PHB_PP_STATE pPP; + int iState; + char * lasttok; +} +HB_COMP_LEX, * PHB_COMP_LEX; + +typedef struct _HB_COMP +{ + /* common to macro compiler members */ + ULONG supported; /* various flags for supported capabilities */ + + /* compiler only members */ + PHB_COMP_LEX pLex; + + HB_HASH_TABLE_PTR pIdentifiers; + FUNCTIONS functions; + FUNCTIONS funcalls; + HB_LOOPEXIT_PTR pLoops; + HB_SWITCHCMD_PTR pSwitch; + HB_ELSEIF_PTR elseif; + HB_RTVAR_PTR rtvars; + SYMBOLS symbols; + INLINES inlines; + PEXTERN externs; + PAUTOOPEN autoopen; + + PCOMDECLARED pFirstDeclared; + PCOMDECLARED pLastDeclared; + PCOMDECLARED pReleaseDeclared; + PCOMDECLARED pLastMethod; + PCOMCLASS pFirstClass; + PCOMCLASS pLastClass; + PCOMCLASS pReleaseClass; + PFUNCTION pInitFunc; + PHB_FNAME pMainFileName; + PHB_FNAME pFileName; + PHB_FNAME pFilePpo; + PHB_FNAME pOutPath; + PHB_FNAME pPpoPath; + + ULONG lastLinePos; /* position of last opcode with line number */ + + char * szAnnounce; + char * szStdCh; /* standard definitions file name (-u) */ + char * szFromClass; + char * szDeclaredFun; + char * szFile; /* Source file name of compiled module */ + char szPrefix[ 20 ]; /* holds the prefix added to the generated symbol init function name (in C output currently) */ + + char cVarType; /* current declared variable type */ + char cDataListType; /* current declared variable list type */ + char cCastType; /* current casting type */ + + int iPassByRef; + int iErrorCount; + int iFunctionCnt; + int iMaxTransCycles; /* maximum translate cycles in PP (-r=) */ + int iHidden; /* hide strings */ + int iWarnings; /* enable parse warnings */ + int iExitLevel; /* holds if there was any warning during the compilation process */ + int iStaticCnt; /* number of defined statics variables on the PRG */ + int iVarScope; /* holds the scope for next variables to be defined */ + int iLanguage; /* default Harbour generated output language */ + int iGenCOutput; /* C code generation should be verbose (use comments) or not */ + + BOOL fQuiet; /* be quiet during compilation (-q) */ + BOOL fPPO; /* flag indicating, is ppo output needed */ + BOOL fStartProc; /* holds if we need to create the starting procedure */ + BOOL fLineNumbers; /* holds if we need pcodes with line numbers */ + BOOL fAnyWarning; /* holds if there was any warning during the compilation process */ + BOOL fAutoMemvarAssume; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ + BOOL fForceMemvars; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ + BOOL fDebugInfo; /* holds if generate debugger required info */ + BOOL fNoStartUp; /* C code generation embed HB_FS_FIRST or not */ + BOOL fDontGenLineNum; /* suppress line number generation */ + BOOL fCredits; /* print credits */ + BOOL fBuildInfo; /* print build info */ + BOOL fLogo; /* print logo */ + BOOL fSyntaxCheckOnly; /* syntax check only */ + BOOL fTextSubst; /* check if string variables are macros (&) which needs substitution */ + BOOL fLongOptimize; /* optimize PCODEs generated for integers */ + BOOL fAutoOpen; /* automatically compile DO...[WITH...] external modules (-m) */ + BOOL fError; /* error appeared during compilation */ + BOOL fExternal; /* suppress error report generation for EXTERNAL statement */ + + USHORT wSeqCounter; + USHORT wForCounter; + USHORT wIfCounter; + USHORT wWhileCounter; + USHORT wCaseCounter; + USHORT wSwitchCounter; + USHORT wWithObjectCnt; + +} +HB_COMP, * HB_COMP_PTR; + +extern HB_COMP_PTR hb_comp_new( void ); +extern void hb_comp_free( HB_COMP_PTR ); + +extern HB_COMP_PTR hb_comp_data; + +# define HB_COMP_PARAM pComp +# define HB_COMP_DECL HB_COMP_PTR HB_COMP_PARAM + +#else + +# define HB_COMP_PARAM pMacro +# define HB_COMP_DECL HB_MACRO_PTR HB_COMP_PARAM + +#endif + +#define HB_MACRO_DATA HB_COMP_PARAM +#define HB_PCODE_DATA ( HB_MACRO_DATA->pCodeInfo ) + + +/*Support for traversing of linked list */ +#define HB_CARGO_FUNC( proc ) void proc( HB_COMP_DECL, void *cargo ) +typedef HB_CARGO_FUNC( HB_CARGO_FUNC_ ); +typedef HB_CARGO_FUNC_ *HB_CARGO_FUNC_PTR; + +#define HB_CARGO2_FUNC( proc ) void proc( HB_COMP_DECL, void *cargo, void *dummy ) +typedef HB_CARGO2_FUNC( HB_CARGO2_FUNC_ ); +typedef HB_CARGO2_FUNC_ *HB_CARGO2_FUNC_PTR; + +/* pcode chunks bytes size */ +#define HB_PCODE_CHUNK 100 + + +HB_EXTERN_END + +#endif /* HB_COMPDF_H_ */ diff --git a/harbour/include/hberrors.h b/harbour/include/hberrors.h index bc2db21c7e..1d442452de 100644 --- a/harbour/include/hberrors.h +++ b/harbour/include/hberrors.h @@ -154,9 +154,6 @@ HB_EXTERN_BEGIN #define HB_COMP_WARN_FORVAR_DUPL 30 #define HB_COMP_WARN_ENUM_INVALID 31 -extern void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ); /* generic parsing error management function */ -extern void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2); /* generic parsing warning management function */ - HB_EXTERN_END #endif /* HB_ERRORS_H_ */ diff --git a/harbour/include/hbexpra.c b/harbour/include/hbexpra.c index dd751b9cff..2dffb542f9 100644 --- a/harbour/include/hbexpra.c +++ b/harbour/include/hbexpra.c @@ -135,15 +135,16 @@ static HB_CBVAR_PTR hb_compExprCBVarNew( char *, BYTE ); /* ************************************************************************ */ -HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE iType ) +HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE iType, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNew(%i)", iType)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNew(%i,%p)", iType, HB_COMP_PARAM)); #if defined( HB_MACRO_SUPPORT ) - pExpr = hb_macroExprNew(); + pExpr = hb_macroExprNew( HB_COMP_PARAM ); #else + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); pExpr = ( HB_EXPR_PTR ) HB_XGRAB( sizeof( HB_EXPR ) ); #endif pExpr->ExprType = iType; @@ -168,31 +169,27 @@ void hb_compExprClear( HB_EXPR_PTR pExpr ) /* Delete all components and delete self */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprDelete( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) +void hb_compExprDelete( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { - HB_TRACE(HB_TR_DEBUG, ("hb_compExprDelete(%p)",pExpr)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprDelete(%p,%p)", pExpr, HB_COMP_PARAM)); +#if defined( HB_MACRO_SUPPORT ) if( pExpr && pExpr->ExprType != HB_ET_NONE ) { HB_EXPR_USE( pExpr, HB_EA_DELETE ); pExpr->ExprType = HB_ET_NONE; } -} #else -void hb_compExprDelete( HB_EXPR_PTR pExpr ) -{ - HB_TRACE(HB_TR_DEBUG, ("hb_compExprDelete(%p)", pExpr)); if( pExpr && --pExpr->Counter == 0 ) { HB_EXPR_USE( pExpr, HB_EA_DELETE ); HB_XFREE( pExpr ); } -} #endif +} /* Delete all components and delete self */ -void hb_compExprFree( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) +void hb_compExprFree( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compExprFree()")); if( --pExpr->Counter == 0 ) @@ -204,19 +201,18 @@ void hb_compExprFree( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) HB_XFREE( pExpr ); #endif } - HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); } -void hb_compExprErrorType( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) +void hb_compExprErrorType( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compExprErrorType()")); - hb_compErrorType( pExpr ); + hb_compErrorType( HB_COMP_PARAM, pExpr ); HB_SYMBOL_UNUSED( pExpr ); - HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); } #ifndef HB_MACRO_SUPPORT -ULONG hb_compExprListEval( HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ) +ULONG hb_compExprListEval( HB_COMP_DECL, HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ) { ULONG ulLen = 0; @@ -225,7 +221,7 @@ ULONG hb_compExprListEval( HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ) pExpr = pExpr->value.asList.pExprList; while( pExpr ) { - (pEval)( (void *) pExpr ); + (pEval)( HB_COMP_PARAM, (void *) pExpr ); pExpr = pExpr->pNext; ++ulLen; } @@ -233,7 +229,7 @@ ULONG hb_compExprListEval( HB_EXPR_PTR pExpr, HB_CARGO_FUNC_PTR pEval ) return ulLen; } -ULONG hb_compExprListEval2( HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FUNC_PTR pEval ) +ULONG hb_compExprListEval2( HB_COMP_DECL, HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FUNC_PTR pEval ) { ULONG ulLen = 0; @@ -248,7 +244,7 @@ ULONG hb_compExprListEval2( HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FU pExpr2 = pExpr2->value.asList.pExprList; while( pExpr1 && pExpr2 ) { - (pEval)( (void *) pExpr1, (void *)pExpr2 ); + (pEval)( HB_COMP_PARAM, (void *) pExpr1, (void *)pExpr2 ); pExpr1 = pExpr1->pNext; pExpr2 = pExpr2->pNext; ++ulLen; @@ -259,7 +255,7 @@ ULONG hb_compExprListEval2( HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FU pExpr1 = pExpr1->value.asList.pExprList; while( pExpr1 ) { - (pEval)( (void *) pExpr1, (void *)pExpr2 ); + (pEval)( HB_COMP_PARAM, (void *) pExpr1, (void *)pExpr2 ); pExpr1 = pExpr1->pNext; ++ulLen; } @@ -270,11 +266,8 @@ ULONG hb_compExprListEval2( HB_EXPR_PTR pExpr1, HB_EXPR_PTR pExpr2, HB_CARGO2_FU /* Add a new local variable declaration */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR pCB, char * szVarName, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR pCB, char * szVarName, BYTE bType ) -#endif +HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR pCB, char * szVarName, BYTE bType, + HB_COMP_DECL ) { HB_CBVAR_PTR pVar; @@ -288,27 +281,19 @@ HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR pCB, char * szVarName, BYTE bType ) while( pVar ) { if( strcmp( szVarName, pVar->szName ) == 0 ) - hb_compErrorDuplVar( szVarName ); + hb_compErrorDuplVar( HB_COMP_PARAM, szVarName ); if( pVar->pNext ) pVar = pVar->pNext; else { -#ifdef HB_MACRO_SUPPORT - pVar->pNext = hb_compExprCBVarNew( szVarName, ' ' ); -#else pVar->pNext = hb_compExprCBVarNew( szVarName, bType ); -#endif - pVar = NULL; + break; } } } else -#ifdef HB_MACRO_SUPPORT - pCB->value.asCodeblock.pLocals = hb_compExprCBVarNew( szVarName, ' ' ); -#else pCB->value.asCodeblock.pLocals = hb_compExprCBVarNew( szVarName, bType ); -#endif return pCB; } @@ -317,7 +302,7 @@ HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR pCB, char * szVarName, BYTE bType ) * * pIIF is a list of three expressions */ -HB_EXPR_PTR hb_compExprNewIIF( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compExprNewIIF( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { #ifndef HB_MACRO_SUPPORT HB_EXPR_PTR pTmp; @@ -329,9 +314,10 @@ HB_EXPR_PTR hb_compExprNewIIF( HB_EXPR_PTR pExpr ) { /* there is no conditional expression e.g. IIF( , true, false ) */ - hb_compErrorSyntax( pExpr ); + hb_compErrorSyntax( HB_COMP_PARAM, pExpr ); } #else + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); pExpr->ExprType = HB_ET_IIF; #endif @@ -340,11 +326,7 @@ HB_EXPR_PTR hb_compExprNewIIF( HB_EXPR_PTR pExpr ) /* Create function call */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) -#endif +HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms, HB_COMP_DECL ) { HB_EXPR_PTR pExpr = NULL; @@ -375,7 +357,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) iCount = 0; #ifndef HB_MACRO_SUPPORT - if( ! hb_compFunCallCheck( pName->value.asSymbol, iCount ) ) + if( ! hb_compFunCallCheck( HB_COMP_PARAM, pName->value.asSymbol, iCount ) ) { /* skip any farther modifications which can depend on valid number of parameters */ @@ -389,8 +371,8 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) HB_EXPR_PTR pEval; /* Optimize Eval( bBlock, [ArgList] ) to: bBlock:Eval( [ArgList] ) */ pEval = hb_compExprNewMethodCall( - hb_compExprNewSend( pParms->value.asList.pExprList, "EVAL", NULL ), - hb_compExprNewArgList( pParms->value.asList.pExprList->pNext ) ); + hb_compExprNewSend( pParms->value.asList.pExprList, "EVAL", NULL, HB_COMP_PARAM ), + hb_compExprNewArgList( pParms->value.asList.pExprList->pNext, HB_COMP_PARAM ) ); pParms->value.asList.pExprList = NULL; HB_EXPR_PCODE1( hb_compExprDelete, pParms ); HB_EXPR_PCODE1( hb_compExprDelete, pName ); @@ -436,12 +418,12 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) if( pVar->ExprType == HB_ET_MACRO ) { /* &var[1] */ - hb_compExprFree( pVar, NULL ); - pVar = hb_compExprNewNil(); + hb_compExprFree( pVar, HB_COMP_PARAM ); + pVar = hb_compExprNewNil( HB_COMP_PARAM ); } else { - pVar = hb_compExprAddCodeblockExpr( hb_compExprNewCodeBlock(NULL,0,0), pVar ); + pVar = hb_compExprAddCodeblockExpr( hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ), pVar ); } /* pVar will be the first argument now @@ -457,7 +439,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) hb_compExprClear( pArg ); /* Create an array with index elements */ - pIndex = HB_EXPR_PCODE1( hb_compExprNewArray, hb_compExprNewList( pIndex ) ); + pIndex = HB_EXPR_PCODE1( hb_compExprNewArray, hb_compExprNewList( pIndex, HB_COMP_PARAM ) ); /* The array with index elements have to be the sixth argument * of __GETA() call */ @@ -465,7 +447,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) while( ++uiCount < 6 ) { if( pVar->pNext == NULL ) - pVar->pNext = hb_compExprNewNil(); + pVar->pNext = hb_compExprNewNil( HB_COMP_PARAM ); pVar = pVar->pNext; } if( pVar->pNext ) /* Delete 6-th argument if present */ @@ -524,7 +506,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) if( pNext ) pNext = pNext->pNext; /* third argument */ - pArg = hb_compExprNewNil(); /* replace 1st with NIL */ + pArg = hb_compExprNewNil( HB_COMP_PARAM ); /* replace 1st with NIL */ pParms->value.asList.pExprList = pArg; pArg->pNext = pFirst->pNext; if( pFirst->value.asMacro.cMacroOp == '&' ) @@ -535,7 +517,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) char *szName = pFirst->value.asMacro.szMacro; if( pFirst->pNext ) HB_EXPR_PCODE1( hb_compExprDelete, pFirst->pNext ); /* delete a second argument */ - pArg->pNext = hb_compExprNewVar( szName ); + pArg->pNext = hb_compExprNewVar( szName, HB_COMP_PARAM ); pArg->pNext->pNext = pNext; /* restore third argument */ HB_EXPR_PCODE1( hb_compExprDelete, pFirst ); } @@ -548,7 +530,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) { /* no second argument */ char *szText = pFirst->value.asMacro.szMacro; - pArg->pNext = hb_compExprNewString( szText, strlen(szText) ); + pArg->pNext = hb_compExprNewString( szText, strlen(szText), HB_COMP_PARAM ); pArg->pNext->pNext = pNext; } HB_EXPR_PCODE1( hb_compExprDelete, pFirst ); /* delete first argument */ @@ -570,24 +552,24 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) pArg->pNext = NULL; /* replace first argument with a set/get codeblock */ #ifdef HB_MACRO_SUPPORT - pArg = hb_compExprSetGetBlock( pArg, HB_MACRO_PARAM ); + pArg = hb_compExprSetGetBlock( pArg, HB_COMP_PARAM ); #else if( pArg->ExprType == HB_ET_VARIABLE ) { - if( hb_compVariableScope( pArg->value.asSymbol ) > 0 ) - pArg = hb_compExprSetGetBlock( pArg ); + if( hb_compVariableScope( HB_COMP_PARAM, pArg->value.asSymbol ) > 0 ) + pArg = hb_compExprSetGetBlock( pArg, HB_COMP_PARAM ); else { /* Undeclared variable name - create a set/get codeblock * at runtime */ - hb_compExprFree( pArg, NULL ); - pArg = hb_compExprNewNil(); + hb_compExprFree( pArg, HB_COMP_PARAM ); + pArg = hb_compExprNewNil( HB_COMP_PARAM ); } } else { - pArg = hb_compExprSetGetBlock( pArg ); + pArg = hb_compExprSetGetBlock( pArg, HB_COMP_PARAM ); } #endif /* restore next arguments */ @@ -613,7 +595,7 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) if( pExpr == NULL ) { - pExpr = hb_compExprNew( HB_ET_FUNCALL ); + pExpr = hb_compExprNew( HB_ET_FUNCALL, HB_COMP_PARAM ); pExpr->value.asFunCall.pParms = pParms; pExpr->value.asFunCall.pFunName = pName; } @@ -624,13 +606,14 @@ HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR pName, HB_EXPR_PTR pParms ) /* Creates new send expression * pObject : szMessage */ -HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR pObject, char * szMessage, HB_EXPR_PTR pMessage ) +HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR pObject, char * szMessage, + HB_EXPR_PTR pMessage, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSend(%p, %s)", pObject, szMessage)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSend(%p,%s,%p,%p)", pObject, szMessage, pMessage, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_SEND ); + pExpr = hb_compExprNew( HB_ET_SEND, HB_COMP_PARAM ); pExpr->value.asMessage.pObject = pObject; pExpr->value.asMessage.pParms = NULL; @@ -645,9 +628,9 @@ HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR pObject, char * szMessage, HB_EXPR_P { if( pObject->ExprType == HB_ET_VARIABLE ) { - if( ! hb_compForEachVarError( pObject->value.asSymbol ) ) + if( ! hb_compForEachVarError( HB_COMP_PARAM, pObject->value.asSymbol ) ) { -/* pExpr->value.asMessage.pObject = hb_compExprNewVarRef( pObject->value.asSymbol );*/ + /* pExpr->value.asMessage.pObject = hb_compExprNewVarRef( pObject->value.asSymbol, HB_COMP_PARAM ); */ /* NOTE: direct type change */ pObject->ExprType = HB_ET_VARREF; pExpr->value.asMessage.pObject = pObject; @@ -678,13 +661,13 @@ HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR pObject, char * szMessage, HB_EXPR_P * In harbour compiler strings are shared in the hash table then they * cannot be deallocated by default */ -HB_EXPR_PTR hb_compExprNewString( char *szValue, ULONG ulLen ) +HB_EXPR_PTR hb_compExprNewString( char *szValue, ULONG ulLen, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewString(%s)", szValue)); - pExpr =hb_compExprNew( HB_ET_STRING ); + pExpr =hb_compExprNew( HB_ET_STRING, HB_COMP_PARAM ); pExpr->value.asString.string = szValue; pExpr->value.asString.dealloc = FALSE; @@ -697,11 +680,7 @@ HB_EXPR_PTR hb_compExprNewString( char *szValue, ULONG ulLen ) /* Creates a new literal array { item1, item2, ... itemN } * 'pArrList' is a list of array elements */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR pArrList, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR pArrList ) -#endif +HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR pArrList, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; @@ -744,17 +723,13 @@ HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR pArrList ) * NOTE: In case of multiple indexes it is called recursively * array[ idx1, idx2 ] => ( array[ idx1 ] )[ idx2 ] */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR pArray, HB_EXPR_PTR pIndex, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR pArray, HB_EXPR_PTR pIndex ) -#endif +HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR pArray, HB_EXPR_PTR pIndex, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewArrayAt()")); - pExpr = hb_compExprNew( HB_ET_ARRAYAT ); + pExpr = hb_compExprNew( HB_ET_ARRAYAT, HB_COMP_PARAM ); /* Check if this expression can be indexed */ HB_EXPR_USE( pArray, HB_EA_ARRAY_AT ); @@ -770,7 +745,7 @@ HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR pArray, HB_EXPR_PTR pIndex ) /* ************************************************************************* */ #ifndef HB_MACRO_SUPPORT -static void hb_compExprCheckStaticInitializers( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightExpr ) +static void hb_compExprCheckStaticInitializers( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightExpr, HB_COMP_DECL ) { HB_EXPR_PTR pElem = pRightExpr->value.asList.pExprList; HB_EXPR_PTR pNext; @@ -784,9 +759,9 @@ static void hb_compExprCheckStaticInitializers( HB_EXPR_PTR pLeftExpr, HB_EXPR_P * (classical case of replacing an item in a linked list) */ pNext = pElem->pNext; /* store next expression in case the current will be reduced */ - pElem = hb_compExprListStrip( HB_EXPR_USE( pElem, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pElem = hb_compExprListStrip( HB_EXPR_USE( pElem, HB_EA_REDUCE ), HB_COMP_PARAM ); if( pElem->ExprType > HB_ET_FUNREF ) - hb_compErrorStatic( pLeftExpr->value.asSymbol, pElem ); + hb_compErrorStatic( HB_COMP_PARAM, pLeftExpr->value.asSymbol, pElem ); *pPrev = pElem; /* store a new expression into the previous one */ pElem->pNext = pNext; /* restore the link to next expression */ pPrev = &pElem->pNext; @@ -801,17 +776,17 @@ static void hb_compExprCheckStaticInitializers( HB_EXPR_PTR pLeftExpr, HB_EXPR_P * pLeftExpr - is a variable name * pRightExpr - can be an expression of any type */ -HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightExpr ) +HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightExpr, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprAssignStatic()")); - pExpr = hb_compExprNew( HB_EO_ASSIGN ); + pExpr = hb_compExprNew( HB_EO_ASSIGN, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; /* Try to reduce the assigned value */ - pRightExpr = hb_compExprListStrip( HB_EXPR_USE( pRightExpr, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pRightExpr = hb_compExprListStrip( HB_EXPR_USE( pRightExpr, HB_EA_REDUCE ), HB_COMP_PARAM ); pExpr->value.asOperator.pRight = pRightExpr; if( pRightExpr->ExprType == HB_ET_ARGLIST ) @@ -820,13 +795,13 @@ HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightEx * was used - we have to check if all array dimensions are * constant values */ - hb_compExprCheckStaticInitializers( pLeftExpr, pRightExpr ); + hb_compExprCheckStaticInitializers( pLeftExpr, pRightExpr, HB_COMP_PARAM ); } else if( pRightExpr->ExprType > HB_ET_FUNREF ) { /* Illegal initializer for static variable (not a constant value) */ - hb_compErrorStatic( pLeftExpr->value.asSymbol, pRightExpr ); + hb_compErrorStatic( HB_COMP_PARAM, pLeftExpr->value.asSymbol, pRightExpr ); } else if( pRightExpr->ExprType == HB_ET_ARRAY ) { @@ -834,7 +809,7 @@ HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightEx * Scan an array for illegal initializers. * An array item have to be a const value too. */ - hb_compExprCheckStaticInitializers( pLeftExpr, pRightExpr ); + hb_compExprCheckStaticInitializers( pLeftExpr, pRightExpr, HB_COMP_PARAM ); } return pExpr; @@ -844,11 +819,7 @@ HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightEx /* Sets the argument of an operation found previously */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem ) -#endif +HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem, HB_COMP_DECL ) { BYTE ucRight; @@ -874,7 +845,7 @@ HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem ) } else { - hb_compErrorSyntax( pItem ); + hb_compErrorSyntax( HB_COMP_PARAM, pItem ); } pExpr->value.asOperator.pRight = pItem; /* set it anyway */ } @@ -898,11 +869,7 @@ HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem ) * Right := R * Oper := O */ -#ifdef HB_MACRO_SUPPORT - pItem->value.asOperator.pLeft = hb_compExprSetOperand( pExpr, pItem->value.asOperator.pLeft, HB_MACRO_PARAM ); -#else - pItem->value.asOperator.pLeft = hb_compExprSetOperand( pExpr, pItem->value.asOperator.pLeft ); -#endif + pItem->value.asOperator.pLeft = hb_compExprSetOperand( pExpr, pItem->value.asOperator.pLeft, HB_COMP_PARAM ); pExpr = pItem; } else @@ -929,11 +896,7 @@ HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR pExpr, HB_EXPR_PTR pItem ) /* Generates pcode for inline expression used as a statement * NOTE: It doesn't not leave any value on the eval stack */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR pExpr ) -#endif +HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compExprGenStatement(%p)", pExpr)); if( pExpr ) @@ -947,11 +910,7 @@ HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR pExpr ) /* Generates pcode to push an expressions * NOTE: It pushes a value on the stack and leaves this value on the stack */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR pExpr ) -#endif +HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compExprGenPush(%i)", pExpr->ExprType)); @@ -962,11 +921,7 @@ HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR pExpr ) /* Generates pcode to pop an expressions */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR pExpr ) -#endif +HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compExprGenPop(%i)", pExpr->ExprType)); @@ -1008,9 +963,9 @@ void hb_compExprCBVarDel( HB_CBVAR_PTR pVars ) } #ifndef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprReduce( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compExprReduce( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { - return hb_compExprListStrip( HB_EXPR_USE( pExpr, HB_EA_REDUCE ), NULL ); + return hb_compExprListStrip( HB_EXPR_USE( pExpr, HB_EA_REDUCE ), HB_COMP_PARAM ); } #endif @@ -1019,11 +974,7 @@ HB_EXPR_PTR hb_compExprReduce( HB_EXPR_PTR pExpr ) * * {|var| IIF( var==NIL, , :=var )} */ -#ifdef HB_MACRO_SUPPORT -HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) -#else -HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr ) -#endif +HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_EXPR_PTR pIIF; HB_EXPR_PTR pSet; @@ -1032,31 +983,25 @@ HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr ) * NOTE: this is not a valid variable name so there will be no collisions */ /* create var==NIL */ - pIIF =hb_compExprNewVar( "~1" ); -#ifdef HB_MACRO_SUPPORT - pIIF = hb_compExprSetOperand( hb_compExprNewEQ( pIIF ), hb_compExprNewNil(), HB_MACRO_PARAM ); -#else - pIIF = hb_compExprSetOperand( hb_compExprNewEQ( pIIF ), hb_compExprNewNil() ); -#endif + pIIF = hb_compExprSetOperand( hb_compExprNewEQ( hb_compExprNewVar( "~1", HB_COMP_PARAM ), HB_COMP_PARAM ), + hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ); /* create ( var==NIL, */ - pIIF = hb_compExprNewList( pIIF ); + pIIF = hb_compExprNewList( pIIF, HB_COMP_PARAM ); /* create ( var==NIL, , */ pIIF = hb_compExprAddListExpr( pIIF, pExpr ); /* create var */ - pSet =hb_compExprNewVar( "~1" ); + pSet =hb_compExprNewVar( "~1", HB_COMP_PARAM ); /* create :=var */ - pSet = hb_compExprAssign( hb_compExprClone( pExpr ), pSet ); + pSet = hb_compExprAssign( hb_compExprClone( pExpr ), pSet, HB_COMP_PARAM ); /* create ( var==nil, , :=var ) */ pIIF = hb_compExprAddListExpr( pIIF, pSet ); /* create IIF() expression */ - pIIF = hb_compExprNewIIF( pIIF ); + pIIF = hb_compExprNewIIF( pIIF, HB_COMP_PARAM ); /* create a codeblock */ -#ifdef HB_MACRO_SUPPORT - return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( hb_compExprNewCodeBlock(NULL,0,0), "~1", HB_MACRO_PARAM ), pIIF ); -#else - return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( hb_compExprNewCodeBlock(NULL,0,0), "~1", ' ' ), pIIF ); -#endif + return hb_compExprAddCodeblockExpr( hb_compExprCBVarAdd( + hb_compExprNewCodeBlock( NULL, 0, 0, HB_COMP_PARAM ), + "~1", ' ', HB_COMP_PARAM ), pIIF ); } #endif diff --git a/harbour/include/hbexprb.c b/harbour/include/hbexprb.c index 4aa080f68b..a22cc335fc 100644 --- a/harbour/include/hbexprb.c +++ b/harbour/include/hbexprb.c @@ -73,51 +73,15 @@ */ #if defined( HB_MACRO_SUPPORT ) - void hb_compExprDelOperator( HB_EXPR_PTR, HB_MACRO_DECL ); - void hb_compExprUseOperEq( HB_EXPR_PTR, BYTE, HB_MACRO_DECL ); - void hb_compExprPushPreOp( HB_EXPR_PTR, BYTE, HB_MACRO_DECL ); - void hb_compExprPushPostOp( HB_EXPR_PTR, BYTE, HB_MACRO_DECL ); - void hb_compExprUsePreOp( HB_EXPR_PTR, BYTE, HB_MACRO_DECL ); - void hb_compExprUseAliasMacro( HB_EXPR_PTR, BYTE, HB_MACRO_DECL ); - void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_MACRO_DECL ); - ULONG hb_compExprReduceList( HB_EXPR_PTR, HB_MACRO_DECL ); - #define HB_SUPPORT_XBASE ( HB_COMP_ISSUPPORTED(HB_SM_XBASE) ) #define HB_SUPPORT_HARBOUR ( HB_COMP_ISSUPPORTED(HB_SM_HARBOUR) ) #define HB_SUPPORT_ARRSTR ( HB_COMP_ISSUPPORTED(HB_SM_ARRSTR) ) #else - void hb_compExprDelOperator( HB_EXPR_PTR ); - void hb_compExprUseOperEq( HB_EXPR_PTR, BYTE ); - void hb_compExprPushPreOp( HB_EXPR_PTR, BYTE ); - void hb_compExprPushPostOp( HB_EXPR_PTR, BYTE ); - void hb_compExprUsePreOp( HB_EXPR_PTR, BYTE ); - void hb_compExprUseAliasMacro( HB_EXPR_PTR, BYTE ); - void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ); - ULONG hb_compExprReduceList( HB_EXPR_PTR ); - #define HB_SUPPORT_XBASE ( HB_COMP_ISSUPPORTED(HB_COMPFLAG_XBASE) ) #define HB_SUPPORT_HARBOUR ( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) #define HB_SUPPORT_ARRSTR ( HB_COMP_ISSUPPORTED(HB_COMPFLAG_ARRSTR) ) #endif - -HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR, HB_MACRO_DECL ); - - /* forward declaration of callback functions */ static HB_EXPR_FUNC( hb_compExprUseDummy ); @@ -179,15 +143,15 @@ static HB_EXPR_FUNC( hb_compExprUseNegate ); /* other helper functions */ #if defined( HB_MACRO_SUPPORT ) - static void hb_compExprCodeblockPush( HB_EXPR_PTR, HB_MACRO_DECL ); + static void hb_compExprCodeblockPush( HB_EXPR_PTR, HB_COMP_DECL ); #else - static void hb_compExprCodeblockPush( HB_EXPR_PTR, BOOL ); + static void hb_compExprCodeblockPush( HB_EXPR_PTR, BOOL, HB_COMP_DECL ); #if !defined(SIMPLEX) - static void hb_compExprCodeblockEarly( HB_EXPR_PTR ); + static void hb_compExprCodeblockEarly( HB_EXPR_PTR, HB_COMP_DECL ); #endif #endif -HB_EXPR_FUNC_PTR hb_comp_ExprTable[ HB_EXPR_COUNT ] = { +const HB_EXPR_FUNC_PTR hb_comp_ExprTable[ HB_EXPR_COUNT ] = { hb_compExprUseDummy, hb_compExprUseNil, hb_compExprUseNumeric, @@ -254,14 +218,14 @@ static HB_EXPR_FUNC( hb_compExprUseDummy ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); break; case HB_EA_POP_PCODE: case HB_EA_PUSH_POP: @@ -281,22 +245,22 @@ static HB_EXPR_FUNC( hb_compExprUseNil ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* NIL cannot be used as index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* NIL cannot be used as index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); break; case HB_EA_POP_PCODE: break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -313,12 +277,12 @@ static HB_EXPR_FUNC( hb_compExprUseNumeric ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: if( pSelf->value.asNum.NumType == HB_ET_DOUBLE ) @@ -330,7 +294,7 @@ static HB_EXPR_FUNC( hb_compExprUseNumeric ) break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -346,13 +310,13 @@ static HB_EXPR_FUNC( hb_compExprUseDate ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* Date cannot be used as index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* Date cannot be used as index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_PCODE1( hb_compGenPushDate, pSelf->value.asNum.lVal ); @@ -361,7 +325,7 @@ static HB_EXPR_FUNC( hb_compExprUseDate ) break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -378,13 +342,13 @@ static HB_EXPR_FUNC( hb_compExprUseString ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* string cannot be used as index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* string cannot be used as index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: { @@ -392,20 +356,20 @@ static HB_EXPR_FUNC( hb_compExprUseString ) HB_EXPR_PCODE2( hb_compGenPushString, pSelf->value.asString.string, pSelf->ulLength + 1 ); #if ! defined( HB_MACRO_SUPPORT ) - if( hb_comp_bTextSubst ) + if( HB_COMP_PARAM->fTextSubst ) #endif { BOOL bUseTextSubst; - BOOL bValidMacro = hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ); + BOOL bValidMacro = hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_COMP_PARAM ); if( bUseTextSubst ) { if( HB_SUPPORT_HARBOUR ) { if( bValidMacro ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); else { - hb_compErrorMacro( pSelf->value.asString.string ); + hb_compErrorMacro( HB_COMP_PARAM, pSelf->value.asString.string ); } } else @@ -413,10 +377,10 @@ static HB_EXPR_FUNC( hb_compExprUseString ) /* Clipper always generates macro substitution pcode * even if it is not a valid expression */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROTEXT ); if( !bValidMacro ) { - hb_compErrorMacro( pSelf->value.asString.string ); + hb_compErrorMacro( HB_COMP_PARAM, pSelf->value.asString.string ); } } } @@ -429,7 +393,7 @@ static HB_EXPR_FUNC( hb_compExprUseString ) case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -449,13 +413,13 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* codeblock cannot be used as index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* codeblock cannot be used as index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: { @@ -463,13 +427,13 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) HB_EXPR_PCODE1( hb_compExprCodeblockPush, pSelf ); #else # if defined(SIMPLEX) - HB_EXPR_PCODE2( hb_compExprCodeblockPush, pSelf, TRUE ); + HB_EXPR_PCODE2( hb_compExprCodeblockPush, pSelf, TRUE, HB_COMP_PARAM ); # else if( !pSelf->value.asCodeblock.isMacro || pSelf->value.asCodeblock.lateEval ) - hb_compExprCodeblockPush( pSelf, TRUE ); + hb_compExprCodeblockPush( pSelf, TRUE, HB_COMP_PARAM ); else /* early evaluation of a macro */ - hb_compExprCodeblockEarly( pSelf ); + hb_compExprCodeblockEarly( pSelf, HB_COMP_PARAM ); # endif #endif break; @@ -477,7 +441,7 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) case HB_EA_POP_PCODE: case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -508,9 +472,9 @@ static HB_EXPR_FUNC( hb_compExprUseCodeblock ) with late evaluation of a macro) */ #if defined( HB_MACRO_SUPPORT ) -static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, HB_COMP_DECL ) #else -static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, BOOL bLateEval ) +static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, BOOL bLateEval, HB_COMP_DECL ) #endif { HB_EXPR_PTR pExpr, pNext; @@ -530,7 +494,7 @@ static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, BOOL bLateEval ) pVar = pSelf->value.asCodeblock.pLocals; while( pVar ) { - hb_compVariableAdd( pVar->szName, pVar->bType ); + hb_compVariableAdd( HB_COMP_PARAM, pVar->szName, pVar->bType ); pVar =pVar->pNext; } } @@ -595,7 +559,7 @@ static void hb_compExprCodeblockPush( HB_EXPR_PTR pSelf, BOOL bLateEval ) */ #if !defined(SIMPLEX) #if !defined(HB_MACRO_SUPPORT) -static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) +static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; @@ -609,13 +573,13 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) */ HB_EXPR_PTR pVar, pNew; - pVar = hb_compExprNewVar( pExpr->value.asMacro.szMacro ); - pNew = hb_compExprNewString( "{||", 3 ); - pNew = hb_compExprSetOperand( hb_compExprNewPlus( pNew ), pVar ); - pNew = hb_compExprSetOperand( hb_compExprNewPlus( pNew ), hb_compExprNewString( "}", 1 ) ); - pNew = hb_compExprNewMacro( pNew, 0, NULL ); + pVar = hb_compExprNewVar( pExpr->value.asMacro.szMacro, HB_COMP_PARAM ); + pNew = hb_compExprNewString( "{||", 3, HB_COMP_PARAM ); + pNew = hb_compExprSetOperand( hb_compExprNewPlus( pNew, HB_COMP_PARAM ), pVar, HB_COMP_PARAM ); + pNew = hb_compExprSetOperand( hb_compExprNewPlus( pNew, HB_COMP_PARAM ), hb_compExprNewString( "}", 1, HB_COMP_PARAM ), HB_COMP_PARAM ); + pNew = hb_compExprNewMacro( pNew, 0, NULL, HB_COMP_PARAM ); HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE ); - hb_compExprDelete( pNew ); + hb_compExprDelete( pNew, HB_COMP_PARAM ); } else { @@ -625,12 +589,12 @@ static void hb_compExprCodeblockEarly( HB_EXPR_PTR pSelf ) HB_EXPR_PTR pNew; char *cStr; - hb_compExprCodeblockPush( pSelf, FALSE ); + hb_compExprCodeblockPush( pSelf, FALSE, HB_COMP_PARAM ); cStr = pSelf->value.asCodeblock.string; - pNew = hb_compExprNewMacro( hb_compExprNewString(cStr, strlen(cStr)), 0, NULL ); + pNew = hb_compExprNewMacro( hb_compExprNewString( cStr, strlen( cStr ), HB_COMP_PARAM ), 0, NULL, HB_COMP_PARAM ); HB_EXPR_USE( pNew, HB_EA_PUSH_PCODE ); - hb_compExprDelete( pNew ); + hb_compExprDelete( pNew, HB_COMP_PARAM ); HB_EXPR_PCODE0( hb_compCodeBlockStop ); } } @@ -646,13 +610,13 @@ static HB_EXPR_FUNC( hb_compExprUseLogical ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* logical cannot be used as array index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* logical cannot be used as array index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_PCODE1( hb_compGenPushLogical, pSelf->value.asLogical ); @@ -661,7 +625,7 @@ static HB_EXPR_FUNC( hb_compExprUseLogical ) break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -677,22 +641,22 @@ static HB_EXPR_FUNC( hb_compExprUseSelf ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); /* QUESTION: Is this OK ? */ + hb_compErrorType( HB_COMP_PARAM, pSelf ); /* QUESTION: Is this OK ? */ break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* SELF cannot be used as array index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* SELF cannot be used as array index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHSELF ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHSELF ); break; case HB_EA_POP_PCODE: break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -713,11 +677,11 @@ static HB_EXPR_FUNC( hb_compExprUseArray ) break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); /* array cannot be used as index element */ + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); /* array cannot be used as index element */ break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -726,7 +690,7 @@ static HB_EXPR_FUNC( hb_compExprUseArray ) /* Push all elements of the array */ if( ( pElem == NULL ) || ( pElem->ExprType == HB_ET_NONE && pElem->pNext == NULL ) ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_ARRAYGEN, 0, 0, ( BOOL ) 1 ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_ARRAYGEN, 0, 0 ); else { BOOL fMacroList = FALSE; @@ -777,13 +741,13 @@ static HB_EXPR_FUNC( hb_compExprUseArray ) } if( fMacroList ) { - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_MACROARRAYGEN, - HB_LOBYTE( usGroups ), HB_HIBYTE( usGroups ), TRUE ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_MACROARRAYGEN, + HB_LOBYTE( usGroups ), HB_HIBYTE( usGroups ) ); } else { - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_ARRAYGEN, - HB_LOBYTE( pSelf->ulLength ), HB_HIBYTE( pSelf->ulLength ), TRUE ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_ARRAYGEN, + HB_LOBYTE( pSelf->ulLength ), HB_HIBYTE( pSelf->ulLength ) ); } } } @@ -806,7 +770,7 @@ static HB_EXPR_FUNC( hb_compExprUseArray ) break; case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -838,14 +802,14 @@ static HB_EXPR_FUNC( hb_compExprUseVarRef ) break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -857,7 +821,7 @@ static HB_EXPR_FUNC( hb_compExprUseVarRef ) case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -874,19 +838,19 @@ static HB_EXPR_FUNC( hb_compExprUseFunRef ) break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_PCODE1( hb_compGenPushFunCall, pSelf->value.asSymbol ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_FUNCPTR ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_FUNCPTR ); break; case HB_EA_POP_PCODE: @@ -894,7 +858,7 @@ static HB_EXPR_FUNC( hb_compExprUseFunRef ) case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: break; } @@ -910,12 +874,12 @@ static HB_EXPR_FUNC( hb_compExprUseRef ) case HB_EA_REDUCE: break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: { @@ -939,7 +903,7 @@ static HB_EXPR_FUNC( hb_compExprUseRef ) #endif } else /* @M->&l, @M->&l.1, @&m->l, etc. */ - hb_compErrorRefer( pSelf, szAlias ); + hb_compErrorRefer( HB_COMP_PARAM, pSelf, szAlias ); } else { @@ -955,7 +919,7 @@ static HB_EXPR_FUNC( hb_compExprUseRef ) #endif } else - hb_compErrorRefer( pSelf, szAlias ); + hb_compErrorRefer( HB_COMP_PARAM, pSelf, szAlias ); } } else if( pExp->ExprType == HB_ET_SEND ) @@ -965,13 +929,13 @@ static HB_EXPR_FUNC( hb_compExprUseRef ) { HB_EXPR_PCODE2( hb_compGenMessageData, pExp->value.asMessage.szMessage, TRUE ); HB_EXPR_USE( pSend, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); } else - hb_compErrorRefer( pSelf, hb_compExprDescription(pSelf) ); + hb_compErrorRefer( HB_COMP_PARAM, pSelf, hb_compExprDescription(pSelf) ); } else - hb_compErrorRefer( pSelf, hb_compExprDescription(pSelf) ); + hb_compErrorRefer( HB_COMP_PARAM, pSelf, hb_compExprDescription(pSelf) ); } break; @@ -979,7 +943,7 @@ static HB_EXPR_FUNC( hb_compExprUseRef ) break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); case HB_EA_DELETE: HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asReference ); break; @@ -996,7 +960,7 @@ static HB_EXPR_FUNC( hb_compExprUseIIF ) { case HB_EA_REDUCE: HB_EXPR_PCODE1( hb_compExprReduceList, pSelf ); - pSelf = hb_compExprReduceIIF( pSelf, HB_MACRO_PARAM ); + pSelf = hb_compExprReduceIIF( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: @@ -1004,7 +968,7 @@ static HB_EXPR_FUNC( hb_compExprUseIIF ) break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -1035,7 +999,7 @@ static HB_EXPR_FUNC( hb_compExprUseIIF ) case HB_EA_STATEMENT: { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); /* remove a value if used in statement */ + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); /* remove a value if used in statement */ } break; @@ -1093,10 +1057,10 @@ static HB_EXPR_FUNC( hb_compExprUseList ) /* For example: * ( a ) := 4 */ - hb_compErrorLValue( pSelf->value.asList.pExprList ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf->value.asList.pExprList ); } else - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -1107,7 +1071,7 @@ static HB_EXPR_FUNC( hb_compExprUseList ) { /* Empty list was used () */ - hb_compErrorSyntax( pExpr ); + hb_compErrorSyntax( HB_COMP_PARAM, pExpr ); } else { @@ -1326,7 +1290,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) { /* extract a single expression from the array */ - HB_EXPR_PTR pNew = hb_compExprNew( HB_ET_NONE ); + HB_EXPR_PTR pNew = hb_compExprNew( HB_ET_NONE, HB_COMP_PARAM ); memcpy( pNew, pExpr, sizeof( HB_EXPR ) ); /* This will suppres releasing of memory occupied by components of * the expression - we have just copied them into the new expression. @@ -1340,7 +1304,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) } else { - hb_compErrorBound( pIdx ); + hb_compErrorBound( HB_COMP_PARAM, pIdx ); } } else @@ -1355,7 +1319,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) if( lIndex > 0 ) HB_EXPR_USE( pExpr, HB_EA_ARRAY_AT ); else - hb_compErrorBound( pIdx ); /* index <= 0 - bound error */ + hb_compErrorBound( HB_COMP_PARAM, pIdx ); /* index <= 0 - bound error */ } } } @@ -1378,7 +1342,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) } HB_EXPR_USE( pSelf->value.asList.pIndex, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_ARRAYPUSH ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_ARRAYPUSH ); } break; @@ -1398,7 +1362,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) HB_EXPR_USE( pSelf->value.asList.pExprList, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asList.pIndex, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_ARRAYPOP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_ARRAYPOP ); /* #ifndef HB_C52_STRICT */ if( HB_SUPPORT_ARRSTR ) @@ -1422,7 +1386,7 @@ static HB_EXPR_FUNC( hb_compExprUseArrayAt ) } /* no break */ case HB_EA_STATEMENT: - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: HB_EXPR_PCODE1( hb_compExprDelete, pSelf->value.asList.pExprList ); @@ -1473,9 +1437,9 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) char *szDupl; szDupl = hb_strupr( hb_strdup( pSelf->value.asMacro.szMacro ) ); - if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) + if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_COMP_PARAM ) ) { - hb_compErrorMacro( pSelf->value.asMacro.szMacro ); + hb_compErrorMacro( HB_COMP_PARAM, pSelf->value.asMacro.szMacro ); } hb_xfree( szDupl ); #endif @@ -1485,10 +1449,10 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) /* compile & run - leave a result on the eval stack */ if( pSelf->value.asMacro.SubType == HB_ET_MACRO_SYMBOL ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROSYMBOL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROSYMBOL ); else if( pSelf->value.asMacro.SubType == HB_ET_MACRO_REFER ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHREF ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHREF ); else if( pSelf->value.asMacro.SubType != HB_ET_MACRO_ALIASED ) { @@ -1498,45 +1462,37 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) { /* { ¯o or funCall( ¯o ) } */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHLIST ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHLIST ); } else if( pSelf->value.asMacro.SubType & HB_ET_MACRO_INDEX ) { /* var[ ¯o ] */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHINDEX ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHINDEX ); } else if( pSelf->value.asMacro.SubType & HB_ET_MACRO_PARE ) { /* var := (somevalue, ¯o) - in xbase compatibility mode * EVAL( {|| ¯o} ) - in all cases */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHPARE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHPARE ); } else { /* usual ¯o */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSH ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSH ); } } else /* usual ¯o */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSH ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSH ); } if( pSelf->value.asMacro.SubType != HB_ET_MACRO_SYMBOL && pSelf->value.asMacro.SubType != HB_ET_MACRO_REFER && pSelf->value.asMacro.SubType != HB_ET_MACRO_ALIASED ) { - /* Always add add byte to pcode indicating requested macro compiler flag. */ -#if defined( HB_MACRO_SUPPORT ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_COMPFLAG_RT_MACRO ); -#else - HB_EXPR_GENPCODE1( hb_compGenPData1, - ( hb_comp_Supported & HB_COMPFLAG_HARBOUR ? HB_SM_HARBOUR : 0 ) | - ( hb_comp_Supported & HB_COMPFLAG_XBASE ? HB_SM_XBASE : 0 ) | - ( hb_comp_bShortCuts ? HB_SM_SHORTCUTS : 0 ) | - ( hb_comp_Supported & HB_COMPFLAG_RT_MACRO ? HB_SM_RT_MACRO : 0 ) ); -#endif + /* Always add byte to pcode indicating requested macro compiler flag. */ + HB_EXPR_PCODE1( hb_compGenPCode1, HB_MACRO_GENFLAGS ); } /* NOTE: pcode for alias context is generated in @@ -1575,9 +1531,9 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) char *szDupl; szDupl = hb_strupr( hb_strdup( pSelf->value.asMacro.szMacro ) ); - if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_MACRO_PARAM ) ) + if( !hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_COMP_PARAM ) ) { - hb_compErrorMacro( pSelf->value.asMacro.szMacro ); + hb_compErrorMacro( HB_COMP_PARAM, pSelf->value.asMacro.szMacro ); } hb_xfree( szDupl ); #endif @@ -1589,18 +1545,10 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) */ if( pSelf->value.asMacro.SubType != HB_ET_MACRO_ALIASED ) { - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPOP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPOP ); - /* Always add add byte to pcode indicating requested macro compiler flag. */ -#if defined( HB_MACRO_SUPPORT ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_COMPFLAG_RT_MACRO ); -#else - HB_EXPR_GENPCODE1( hb_compGenPData1, - ( hb_comp_Supported & HB_COMPFLAG_HARBOUR ? HB_SM_HARBOUR : 0 ) | - ( hb_comp_Supported & HB_COMPFLAG_XBASE ? HB_SM_XBASE : 0 ) | - ( hb_comp_bShortCuts ? HB_SM_SHORTCUTS : 0 ) | - ( hb_comp_Supported & HB_COMPFLAG_RT_MACRO ? HB_SM_RT_MACRO : 0 ) ); -#endif + /* Always add byte to pcode indicating requested macro compiler flag. */ + HB_EXPR_PCODE1( hb_compGenPCode1, HB_MACRO_GENFLAGS ); } } break; @@ -1608,7 +1556,7 @@ static HB_EXPR_FUNC( hb_compExprUseMacro ) case HB_EA_PUSH_POP: case HB_EA_STATEMENT: HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); break; case HB_EA_DELETE: @@ -1646,32 +1594,32 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) } #ifndef HB_MACRO_SUPPORT - hb_compFunCallCheck( pName->value.asSymbol, usCount ); + hb_compFunCallCheck( HB_COMP_PARAM, pName->value.asSymbol, usCount ); #endif if( ( strcmp( "AT", pName->value.asSymbol ) == 0 ) && usCount == 2 ) { - hb_compExprReduceAT( pSelf, HB_MACRO_PARAM ); + hb_compExprReduceAT( pSelf, HB_COMP_PARAM ); } else if( ( strcmp( "CHR", pName->value.asSymbol ) == 0 ) && usCount ) { - hb_compExprReduceCHR( pSelf, HB_MACRO_PARAM ); + hb_compExprReduceCHR( pSelf, HB_COMP_PARAM ); } else if( ( strcmp( "LEN", pName->value.asSymbol ) == 0 ) && usCount ) { if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) - hb_compExprReduceLEN( pSelf, HB_MACRO_PARAM ); + hb_compExprReduceLEN( pSelf, HB_COMP_PARAM ); } else if( ( strcmp( "ASC", pName->value.asSymbol ) == 0 ) && usCount ) { if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) - hb_compExprReduceASC( pSelf, HB_MACRO_PARAM ); + hb_compExprReduceASC( pSelf, HB_COMP_PARAM ); } else if( ( ( strcmp( "STOD", pName->value.asSymbol ) == 0 ) || ( strcmp( "HB_STOD", pName->value.asSymbol ) == 0 ) ) && usCount < 2 ) { if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_HARBOUR) ) - hb_compExprReduceSTOD( pSelf, usCount, HB_MACRO_PARAM ); + hb_compExprReduceSTOD( pSelf, usCount, HB_COMP_PARAM ); } } break; @@ -1681,7 +1629,7 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -1690,7 +1638,7 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) USHORT usCount; HB_EXPR_USE( pSelf->value.asFunCall.pFunName, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); if( pSelf->value.asFunCall.pParms ) { @@ -1733,11 +1681,11 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) usCount = 0; if( fMacroList ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_MACROFUNC, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ), TRUE ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_MACROFUNC, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) ); else if( usCount > 255 ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_FUNCTION, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ), TRUE ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_FUNCTION, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) ); else - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_FUNCTIONSHORT, ( BYTE ) usCount, TRUE ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_FUNCTIONSHORT, ( BYTE ) usCount ); break; } case HB_EA_POP_PCODE: @@ -1750,7 +1698,7 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) USHORT usCount; HB_EXPR_USE( pSelf->value.asFunCall.pFunName, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHNIL ); if( pSelf->value.asFunCall.pParms ) { @@ -1790,11 +1738,11 @@ static HB_EXPR_FUNC( hb_compExprUseFunCall ) usCount = 0; if( fMacroList ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_MACRODO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ), TRUE ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_MACRODO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) ); else if( usCount > 255 ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_DO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ), TRUE ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_DO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ) ); else - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_DOSHORT, ( BYTE ) usCount, TRUE ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_DOSHORT, ( BYTE ) usCount ); break; } case HB_EA_DELETE: @@ -1859,7 +1807,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) if( pAlias->value.asNum.NumType == HB_ET_LONG ) HB_EXPR_PCODE4( hb_compGenPushAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, TRUE, NULL, pAlias->value.asNum.lVal ); else - hb_compErrorAlias( pAlias ); + hb_compErrorAlias( HB_COMP_PARAM, pAlias ); } else if( bReduced ) { @@ -1872,7 +1820,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) HB_EXPR_PCODE4( hb_compGenPushAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, FALSE, NULL, 0 ); } else - hb_compErrorAlias( pAlias ); + hb_compErrorAlias( HB_COMP_PARAM, pAlias ); break; } case HB_EA_POP_PCODE: @@ -1913,7 +1861,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) if( pAlias->value.asNum.NumType == HB_ET_LONG ) HB_EXPR_PCODE4( hb_compGenPopAliasedVar, pSelf->value.asAlias.pVar->value.asSymbol, TRUE, NULL, pAlias->value.asNum.lVal ); else - hb_compErrorAlias( pAlias ); + hb_compErrorAlias( HB_COMP_PARAM, pAlias ); } else if( bReduced ) { @@ -1926,7 +1874,7 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) { /* empty expression -> ()->var */ - hb_compErrorAlias( pAlias ); + hb_compErrorAlias( HB_COMP_PARAM, pAlias ); } else { @@ -1935,13 +1883,13 @@ static HB_EXPR_FUNC( hb_compExprUseAliasVar ) } } else - hb_compErrorAlias( pAlias ); + hb_compErrorAlias( HB_COMP_PARAM, pAlias ); break; } case HB_EA_PUSH_POP: case HB_EA_STATEMENT: HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); break; case HB_EA_DELETE: @@ -1965,19 +1913,19 @@ static HB_EXPR_FUNC( hb_compExprUseAliasExpr ) break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: /* save currently selected workarea */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHALIAS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHALIAS ); /* push the expression that will return a new workarea */ HB_EXPR_USE( pSelf->value.asAlias.pAlias, HB_EA_PUSH_PCODE ); /* pop the value from the stack and select it as current workarea */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POPALIAS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POPALIAS ); /* evaluate any expression */ HB_EXPR_USE( pSelf->value.asAlias.pExpList, HB_EA_PUSH_PCODE ); @@ -1986,31 +1934,31 @@ static HB_EXPR_FUNC( hb_compExprUseAliasExpr ) * is previously selected workarea. After swaping select again * the restored workarea. */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_SWAPALIAS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_SWAPALIAS ); break; case HB_EA_POP_PCODE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: /* save currently selected workarea */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHALIAS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHALIAS ); /* push the expression that will return a new workarea */ HB_EXPR_USE( pSelf->value.asAlias.pAlias, HB_EA_PUSH_PCODE ); /* pop the value from the stack and select it as current workarea */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POPALIAS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POPALIAS ); /* evaluate any expression - it will not leave any return * value on the eval stack */ HB_EXPR_USE( pSelf->value.asAlias.pExpList, HB_EA_PUSH_POP ); /* Pop and select again the restored workarea. */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POPALIAS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POPALIAS ); break; case HB_EA_DELETE: @@ -2151,7 +2099,7 @@ static HB_EXPR_FUNC( hb_compExprUseVariable ) case HB_EA_PUSH_POP: case HB_EA_STATEMENT: HB_EXPR_PCODE2( hb_compGenPushVar, pSelf->value.asSymbol, FALSE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); break; case HB_EA_DELETE: @@ -2167,7 +2115,7 @@ static HB_EXPR_FUNC( hb_compExprUseSend ) case HB_EA_REDUCE: { if( pSelf->value.asMessage.pObject ) - pSelf->value.asMessage.pObject = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asMessage.pObject, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asMessage.pObject = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asMessage.pObject, HB_EA_REDUCE ), HB_COMP_PARAM ); if( pSelf->value.asMessage.pParms ) /* Is it a method call ? */ pSelf->value.asMessage.pParms = HB_EXPR_USE( pSelf->value.asMessage.pParms, HB_EA_REDUCE ); } @@ -2239,11 +2187,11 @@ static HB_EXPR_FUNC( hb_compExprUseSend ) } if( fMacroList ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_MACROSEND, HB_LOBYTE( iParms ), HB_HIBYTE( iParms ), ( BOOL ) 1 ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_MACROSEND, HB_LOBYTE( iParms ), HB_HIBYTE( iParms ) ); else if( iParms > 255 ) - HB_EXPR_GENPCODE3( hb_compGenPCode3, HB_P_SEND, HB_LOBYTE( iParms ), HB_HIBYTE( iParms ), ( BOOL ) 1 ); + HB_EXPR_PCODE3( hb_compGenPCode3, HB_P_SEND, HB_LOBYTE( iParms ), HB_HIBYTE( iParms ) ); else - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, ( BYTE ) iParms, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, ( BYTE ) iParms ); } else { @@ -2264,7 +2212,7 @@ static HB_EXPR_FUNC( hb_compExprUseSend ) { HB_EXPR_USE( pSelf->value.asMessage.pObject, HB_EA_PUSH_PCODE ); } - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0 ); } } break; @@ -2294,21 +2242,21 @@ static HB_EXPR_FUNC( hb_compExprUseSend ) HB_EXPR_USE( pSelf->value.asMessage.pObject, HB_EA_PUSH_PCODE ); } HB_EXPR_USE( pSelf->value.asMessage.pParms, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1 ); } break; case HB_EA_PUSH_POP: case HB_EA_STATEMENT: HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); if( ! pSelf->value.asMessage.pParms ) /* Is it a method call ? */ { /* instance variable */ /* QUESTION: This warning can be misleading if nested messages * are used, e.g. a:b():c - should we generate it ? */ - hb_compWarnMeaningless( pSelf ); + hb_compWarnMeaningless( HB_COMP_PARAM, pSelf ); } break; @@ -2337,7 +2285,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostInc ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: @@ -2345,7 +2293,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostInc ) break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2375,7 +2323,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostDec ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: @@ -2383,7 +2331,7 @@ static HB_EXPR_FUNC( hb_compExprUsePostDec ) break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2411,8 +2359,8 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; @@ -2439,7 +2387,7 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); /* QUESTION: Can we replace DUPLICATE+POP with a single PUT opcode */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } } @@ -2460,7 +2408,7 @@ static HB_EXPR_FUNC( hb_compExprUseAssign ) HB_EXPR_USE( pObj, HB_EA_POP_PCODE ); pObj->value.asMessage.pParms = NULL; /* to suppress duplicated releasing */ /* Remove the return value */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } else { @@ -2483,20 +2431,20 @@ static HB_EXPR_FUNC( hb_compExprUsePlusEq ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2523,20 +2471,20 @@ static HB_EXPR_FUNC( hb_compExprUseMinusEq ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2563,20 +2511,20 @@ static HB_EXPR_FUNC( hb_compExprUseMultEq ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2603,20 +2551,20 @@ static HB_EXPR_FUNC( hb_compExprUseDivEq ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2643,20 +2591,20 @@ static HB_EXPR_FUNC( hb_compExprUseModEq ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2683,20 +2631,20 @@ static HB_EXPR_FUNC( hb_compExprUseExpEq ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -2723,40 +2671,40 @@ static HB_EXPR_FUNC( hb_compExprUseOr ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceOr( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceOr( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: - if( hb_comp_bShortCuts ) + if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) { LONG lEndPos; HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); lEndPos = HB_EXPR_PCODE1( hb_compGenJumpTrue, 0 ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_OR ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_OR ); HB_EXPR_PCODE1( hb_compGenJumpHere, lEndPos ); } else { HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_OR ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_OR ); } break; @@ -2775,12 +2723,12 @@ static HB_EXPR_FUNC( hb_compExprUseOr ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -2795,40 +2743,40 @@ static HB_EXPR_FUNC( hb_compExprUseAnd ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceAnd( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceAnd( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: - if( hb_comp_bShortCuts ) + if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) { LONG lEndPos; HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); lEndPos = HB_EXPR_PCODE1( hb_compGenJumpFalse, 0 ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_AND ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_AND ); HB_EXPR_PCODE1( hb_compGenJumpHere, lEndPos ); } else { HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_AND ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_AND ); } break; @@ -2847,12 +2795,12 @@ static HB_EXPR_FUNC( hb_compExprUseAnd ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -2870,7 +2818,7 @@ static HB_EXPR_FUNC( hb_compExprUseNot ) { HB_EXPR_PTR pExpr; - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); pExpr = pSelf->value.asOperator.pLeft; if( pExpr->ExprType == HB_ET_LOGICAL ) @@ -2884,20 +2832,20 @@ static HB_EXPR_FUNC( hb_compExprUseNot ) break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: - hb_compErrorIndex( pSelf ); + hb_compErrorIndex( HB_COMP_PARAM, pSelf ); break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_NOT ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_NOT ); break; case HB_EA_POP_PCODE: @@ -2914,12 +2862,12 @@ static HB_EXPR_FUNC( hb_compExprUseNot ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -2935,8 +2883,8 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) { case HB_EA_REDUCE: { - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); } break; @@ -2945,7 +2893,7 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: { @@ -2978,7 +2926,7 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) { HB_EXPR_USE( pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_EQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_EQUAL ); } break; @@ -3011,7 +2959,7 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) { HB_EXPR_USE( pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_EQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_EQUAL ); } } else @@ -3020,7 +2968,7 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) */ HB_EXPR_USE( pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_EQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_EQUAL ); } } break; @@ -3040,7 +2988,7 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; @@ -3057,7 +3005,7 @@ static HB_EXPR_FUNC( hb_compExprUseEqual ) HB_EXPR_USE( pObj, HB_EA_POP_PCODE ); pObj->value.asMessage.pParms = NULL; /* to suppress duplicated releasing */ /* Remove the return value */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } else { @@ -3080,25 +3028,25 @@ static HB_EXPR_FUNC( hb_compExprUseEQ ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceEQ( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceEQ( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_EXACTLYEQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_EXACTLYEQUAL ); break; case HB_EA_POP_PCODE: @@ -3116,12 +3064,12 @@ static HB_EXPR_FUNC( hb_compExprUseEQ ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3136,25 +3084,25 @@ static HB_EXPR_FUNC( hb_compExprUseLT ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceLT( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceLT( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_LESS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_LESS ); break; case HB_EA_POP_PCODE: @@ -3172,12 +3120,12 @@ static HB_EXPR_FUNC( hb_compExprUseLT ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3192,25 +3140,25 @@ static HB_EXPR_FUNC( hb_compExprUseGT ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceGT( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceGT( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_GREATER ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_GREATER ); break; case HB_EA_POP_PCODE: @@ -3228,12 +3176,12 @@ static HB_EXPR_FUNC( hb_compExprUseGT ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3248,26 +3196,26 @@ static HB_EXPR_FUNC( hb_compExprUseLE ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceLE( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceLE( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_LESSEQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_LESSEQUAL ); break; case HB_EA_POP_PCODE: @@ -3285,12 +3233,12 @@ static HB_EXPR_FUNC( hb_compExprUseLE ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3305,26 +3253,26 @@ static HB_EXPR_FUNC( hb_compExprUseGE ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceGE( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceGE( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_GREATEREQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_GREATEREQUAL ); break; case HB_EA_POP_PCODE: @@ -3342,12 +3290,12 @@ static HB_EXPR_FUNC( hb_compExprUseGE ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3362,26 +3310,26 @@ static HB_EXPR_FUNC( hb_compExprUseNE ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceNE( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceNE( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_NOTEQUAL ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_NOTEQUAL ); break; case HB_EA_POP_PCODE: @@ -3399,12 +3347,12 @@ static HB_EXPR_FUNC( hb_compExprUseNE ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3420,27 +3368,27 @@ static HB_EXPR_FUNC( hb_compExprUseIN ) { case HB_EA_REDUCE: { - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceIN( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceIN( pSelf, HB_COMP_PARAM ); } break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_INSTRING ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_INSTRING ); break; case HB_EA_POP_PCODE: @@ -3458,12 +3406,12 @@ static HB_EXPR_FUNC( hb_compExprUseIN ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3478,26 +3426,26 @@ static HB_EXPR_FUNC( hb_compExprUsePlus ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReducePlus( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReducePlus( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PLUS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PLUS ); break; case HB_EA_POP_PCODE: @@ -3515,12 +3463,12 @@ static HB_EXPR_FUNC( hb_compExprUsePlus ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3535,26 +3483,26 @@ static HB_EXPR_FUNC( hb_compExprUseMinus ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceMinus( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceMinus( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MINUS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MINUS ); break; case HB_EA_POP_PCODE: @@ -3572,12 +3520,12 @@ static HB_EXPR_FUNC( hb_compExprUseMinus ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3592,26 +3540,26 @@ static HB_EXPR_FUNC( hb_compExprUseMult ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceMult( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceMult( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MULT ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MULT ); break; case HB_EA_POP_PCODE: @@ -3629,12 +3577,12 @@ static HB_EXPR_FUNC( hb_compExprUseMult ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3649,26 +3597,26 @@ static HB_EXPR_FUNC( hb_compExprUseDiv ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf = hb_compExprReduceDiv( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf = hb_compExprReduceDiv( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DIVIDE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DIVIDE ); break; case HB_EA_POP_PCODE: @@ -3686,12 +3634,12 @@ static HB_EXPR_FUNC( hb_compExprUseDiv ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3706,26 +3654,26 @@ static HB_EXPR_FUNC( hb_compExprUseMod ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_MACRO_PARAM ); - pSelf =hb_compExprReduceMod( pSelf, HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf->value.asOperator.pRight = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_REDUCE ), HB_COMP_PARAM ); + pSelf =hb_compExprReduceMod( pSelf, HB_COMP_PARAM ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MODULUS ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MODULUS ); break; case HB_EA_POP_PCODE: @@ -3743,12 +3691,12 @@ static HB_EXPR_FUNC( hb_compExprUseMod ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3766,20 +3714,20 @@ static HB_EXPR_FUNC( hb_compExprUsePower ) break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POWER ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POWER ); break; case HB_EA_POP_PCODE: @@ -3797,12 +3745,12 @@ static HB_EXPR_FUNC( hb_compExprUsePower ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3820,7 +3768,7 @@ static HB_EXPR_FUNC( hb_compExprUseNegate ) { HB_EXPR_PTR pExpr; - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); pExpr = pSelf->value.asOperator.pLeft; if( pExpr->ExprType == HB_ET_NUMERIC ) @@ -3836,19 +3784,19 @@ static HB_EXPR_FUNC( hb_compExprUseNegate ) break; } case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_NEGATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_NEGATE ); break; case HB_EA_POP_PCODE: @@ -3865,12 +3813,12 @@ static HB_EXPR_FUNC( hb_compExprUseNegate ) else { HB_EXPR_USE( pSelf, HB_EA_PUSH_PCODE ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } break; case HB_EA_STATEMENT: - hb_compErrorSyntax( pSelf ); + hb_compErrorSyntax( HB_COMP_PARAM, pSelf ); break; case HB_EA_DELETE: @@ -3886,19 +3834,19 @@ static HB_EXPR_FUNC( hb_compExprUsePreInc ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: @@ -3926,19 +3874,19 @@ static HB_EXPR_FUNC( hb_compExprUsePreDec ) switch( iMessage ) { case HB_EA_REDUCE: - pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_MACRO_PARAM ); + pSelf->value.asOperator.pLeft = hb_compExprListStrip( HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_REDUCE ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_LVALUE ); break; case HB_EA_ARRAY_AT: - hb_compErrorType( pSelf ); + hb_compErrorType( HB_COMP_PARAM, pSelf ); break; case HB_EA_ARRAY_INDEX: break; case HB_EA_LVALUE: - hb_compErrorLValue( pSelf ); + hb_compErrorLValue( HB_COMP_PARAM, pSelf ); break; case HB_EA_PUSH_PCODE: diff --git a/harbour/include/hbexprc.c b/harbour/include/hbexprc.c index 1564260142..2a05258298 100644 --- a/harbour/include/hbexprc.c +++ b/harbour/include/hbexprc.c @@ -71,11 +71,7 @@ /* ************************************************************************* */ -#if defined( HB_MACRO_SUPPORT ) -static void hb_compExprSendPopPush( HB_EXPR_PTR pObj, HB_MACRO_DECL ) -#else -static void hb_compExprSendPopPush( HB_EXPR_PTR pObj ) -#endif +static void hb_compExprSendPopPush( HB_EXPR_PTR pObj, HB_COMP_DECL ) { if( pObj->value.asMessage.pObject ) { @@ -133,11 +129,7 @@ static void hb_compExprSendPopPush( HB_EXPR_PTR pObj ) } } -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprDelOperator( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) -#else -void hb_compExprDelOperator( HB_EXPR_PTR pExpr ) -#endif +void hb_compExprDelOperator( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { if( pExpr->value.asOperator.pLeft ) HB_EXPR_PCODE1( hb_compExprDelete, pExpr->value.asOperator.pLeft ); @@ -150,11 +142,7 @@ void hb_compExprDelOperator( HB_EXPR_PTR pExpr ) * * pExpr is an expression created by hb_compExprNewEq functions */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_MACRO_DECL ) -#else -void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) -#endif +void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL ) { /* NOTE: an object instance variable needs special handling */ @@ -195,7 +183,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) if( bOpEq == HB_P_PLUS || bOpEq == HB_P_MINUS || bOpEq == HB_P_MULT || bOpEq == HB_P_DIVIDE ) { - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); /* push increment value */ HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); @@ -215,18 +203,18 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq = HB_P_DIVEQ; break; } - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); } else #endif { - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0 ); /* push increment value */ HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); /* increase operation */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); /* call pop message with one argument */ - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1 ); } return; } @@ -237,7 +225,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq == HB_P_MULT || bOpEq == HB_P_DIVIDE ) && ( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE ) ) { - int iScope = hb_compVariableScope( pSelf->value.asOperator.pLeft->value.asSymbol ); + int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol ); if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && iScope != HB_VS_UNDECLARED ) @@ -249,7 +237,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) if( iScope == HB_VS_LOCAL_VAR && iType == HB_ET_NUMERIC && ( bOpEq == HB_P_PLUS || bOpEq == HB_P_MINUS ) ) { - int iLocal = hb_compLocalGetPos( pSelf->value.asOperator.pLeft->value.asSymbol ); + int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol ); if( iLocal < 256 && hb_compExprIsInteger( pSelf->value.asOperator.pRight ) ) { @@ -262,7 +250,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) iIncrement = -iIncrement; } - hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), ( BOOL ) 0 ); + hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), HB_COMP_PARAM ); HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); @@ -290,12 +278,12 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq = HB_P_DIVEQ; break; } - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); return; } else if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE ) { - int iScope = hb_compVariableScope( pSelf->value.asOperator.pRight->value.asSymbol ); + int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pRight->value.asSymbol ); if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && iScope != HB_VS_UNDECLARED ) @@ -320,7 +308,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq = HB_P_DIVEQ; break; } - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); return; } } @@ -332,8 +320,8 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) /* push increment value */ HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); /* perform operation and duplicate the new value */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); /* pop the new value into variable and leave the copy on the stack */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } @@ -341,11 +329,7 @@ void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) /* Generates pcodes for = syntax * used standalone as a statement (it cannot leave the value on the stack) */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_MACRO_DECL ) -#else -void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) -#endif +void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL ) { /* NOTE: an object instance variable needs special handling */ @@ -360,7 +344,7 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) if( bOpEq == HB_P_PLUS || bOpEq == HB_P_MINUS || bOpEq == HB_P_MULT || bOpEq == HB_P_DIVIDE ) { - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); /* push increment value */ HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); @@ -380,20 +364,20 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq = HB_P_DIVEQPOP; break; } - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); } else #endif { - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0 ); /* push increment value */ HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); /* increase operation */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); /* Now do the assignment - call pop message with one argument */ - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1 ); /* pop the unneeded value from the stack */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } return; } @@ -404,19 +388,19 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq == HB_P_MULT || bOpEq == HB_P_DIVIDE ) && ( pSelf->value.asOperator.pLeft->ExprType == HB_ET_VARIABLE ) ) { - int iScope = hb_compVariableScope( pSelf->value.asOperator.pLeft->value.asSymbol ); + int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol ); if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && iScope != HB_VS_UNDECLARED ) { HB_EXPRTYPE iType = pSelf->value.asOperator.pRight->ExprType, iOldType; - + if( iType == HB_ET_NUMERIC || iType == HB_ET_STRING ) { if( iScope == HB_VS_LOCAL_VAR && iType == HB_ET_NUMERIC && ( bOpEq == HB_P_PLUS || bOpEq == HB_P_MINUS ) ) { - int iLocal = hb_compLocalGetPos( pSelf->value.asOperator.pLeft->value.asSymbol ); + int iLocal = hb_compLocalGetPos( HB_COMP_PARAM, pSelf->value.asOperator.pLeft->value.asSymbol ); if( iLocal < 256 && hb_compExprIsInteger( pSelf->value.asOperator.pRight ) ) { @@ -429,7 +413,7 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) iIncrement = -iIncrement; } - hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), ( BOOL ) 0 ); + hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iIncrement ), HB_HIBYTE( iIncrement ), HB_COMP_PARAM ); return; } } @@ -455,13 +439,13 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq = HB_P_DIVEQPOP; break; } - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); pSelf->value.asOperator.pLeft->ExprType = iOldType; return; } else if( pSelf->value.asOperator.pRight->ExprType == HB_ET_VARIABLE ) { - int iScope = hb_compVariableScope( pSelf->value.asOperator.pRight->value.asSymbol ); + int iScope = hb_compVariableScope( HB_COMP_PARAM, pSelf->value.asOperator.pRight->value.asSymbol ); if( iScope != HB_VS_LOCAL_FIELD && iScope != HB_VS_GLOBAL_FIELD && iScope != HB_VS_UNDECLARED ) @@ -487,7 +471,7 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) bOpEq = HB_P_DIVEQPOP; break; } - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); pSelf->value.asOperator.pLeft->ExprType = iOldType; pSelf->value.asOperator.pRight->ExprType = iType; return; @@ -501,18 +485,14 @@ void hb_compExprUseOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq ) /* push increment value */ HB_EXPR_USE( pSelf->value.asOperator.pRight, HB_EA_PUSH_PCODE ); /* add */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOpEq ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOpEq ); /* pop the new value into variable and remove it from the stack */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } /* Generates the pcodes for pre- increment/decrement expressions */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_MACRO_DECL ) -#else -void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper ) -#endif +void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_COMP_DECL ) { /* NOTE: an object instance variable needs special handling */ @@ -524,7 +504,7 @@ void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper ) /* Temporary disabled optimization with references to object variables untill we will not have extended reference items in our HVM [druzus] */ #ifdef HB_USE_OBJMSG_REF - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_PUSHOVARREF ); /* increase/decrease operation */ /* We have to unreference the item on the stack, because we do not have @@ -532,16 +512,16 @@ void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper ) HB_P_[PLUS|MINUS]EQ, Maybe in the future we will make it in differ way [druzus] */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_ONE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_ONE ); bOper = ( bOper == HB_P_INC ) ? HB_P_PLUSEQ : HB_P_MINUSEQ; - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOper ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOper ); #else - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 0 ); /* increase/decrease operation */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOper ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOper ); /* Now, do the assignment - call pop message with one argument - it leaves the value on the stack */ - HB_EXPR_GENPCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1, ( BOOL ) 1 ); + HB_EXPR_PCODE2( hb_compGenPCode2, HB_P_SENDSHORT, 1 ); #endif } else @@ -549,9 +529,9 @@ void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper ) /* Push current value */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); /* Increment */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOper ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOper ); /* duplicate a value */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); /* pop new value and leave the duplicated copy of it on the stack */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } @@ -559,11 +539,7 @@ void hb_compExprPushPreOp( HB_EXPR_PTR pSelf, BYTE bOper ) /* Generates the pcodes for post- increment/decrement expressions */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprPushPostOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_MACRO_DECL ) -#else -void hb_compExprPushPostOp( HB_EXPR_PTR pSelf, BYTE bOper ) -#endif +void hb_compExprPushPostOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_COMP_DECL ) { /* NOTE: an object instance variable needs special handling */ @@ -574,16 +550,16 @@ void hb_compExprPushPostOp( HB_EXPR_PTR pSelf, BYTE bOper ) /* now increment the value */ HB_EXPR_PCODE2( hb_compExprPushPreOp, pSelf, bOper ); /* pop the value from the stack */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } else { /* Push current value */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); /* Duplicate value */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_DUPLICATE ); /* Increment */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOper ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOper ); /* pop new value from the stack */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } @@ -592,11 +568,7 @@ void hb_compExprPushPostOp( HB_EXPR_PTR pSelf, BYTE bOper ) /* Generates the pcodes for increment/decrement operations * used standalone as a statement */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprUsePreOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_MACRO_DECL ) -#else -void hb_compExprUsePreOp( HB_EXPR_PTR pSelf, BYTE bOper ) -#endif +void hb_compExprUsePreOp( HB_EXPR_PTR pSelf, BYTE bOper, HB_COMP_DECL ) { /* NOTE: an object instance variable needs special handling */ @@ -604,14 +576,14 @@ void hb_compExprUsePreOp( HB_EXPR_PTR pSelf, BYTE bOper ) { HB_EXPR_PCODE2( hb_compExprPushPreOp, pSelf, bOper ); /* pop the value from the stack */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_POP ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_POP ); } else { /* Push current value */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_PUSH_PCODE ); /* Increment */ - HB_EXPR_GENPCODE1( hb_compGenPCode1, bOper ); + HB_EXPR_PCODE1( hb_compGenPCode1, bOper ); /* pop new value from the stack */ HB_EXPR_USE( pSelf->value.asOperator.pLeft, HB_EA_POP_PCODE ); } @@ -621,11 +593,7 @@ void hb_compExprUsePreOp( HB_EXPR_PTR pSelf, BYTE bOper ) * the left or right side of the alias operator * expression->¯o or ¯o->expression or ¯o->¯o */ -#if defined( HB_MACRO_SUPPORT ) -void hb_compExprUseAliasMacro( HB_EXPR_PTR pAliasedVar, BYTE bAction, HB_MACRO_DECL ) -#else -void hb_compExprUseAliasMacro( HB_EXPR_PTR pAliasedVar, BYTE bAction ) -#endif +void hb_compExprUseAliasMacro( HB_EXPR_PTR pAliasedVar, BYTE bAction, HB_COMP_DECL ) { HB_EXPR_PTR pAlias, pVar; @@ -645,9 +613,9 @@ void hb_compExprUseAliasMacro( HB_EXPR_PTR pAliasedVar, BYTE bAction ) HB_EXPR_PCODE2( hb_compGenPushString, pAlias->value.asSymbol, strlen(pAlias->value.asSymbol) + 1 ); HB_EXPR_USE( pVar, HB_EA_PUSH_PCODE ); if( bAction == HB_EA_PUSH_PCODE ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHALIASED ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHALIASED ); else - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPOPALIASED ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPOPALIASED ); } else if( pVar->ExprType == HB_ET_VARIABLE ) { @@ -657,31 +625,22 @@ void hb_compExprUseAliasMacro( HB_EXPR_PTR pAliasedVar, BYTE bAction ) HB_EXPR_USE( pAlias, HB_EA_PUSH_PCODE ); HB_EXPR_PCODE2( hb_compGenPushString, pVar->value.asSymbol, strlen(pVar->value.asSymbol) + 1 ); if( bAction == HB_EA_PUSH_PCODE ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHALIASED ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHALIASED ); else - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPOPALIASED ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPOPALIASED ); } else { HB_EXPR_USE( pAlias, HB_EA_PUSH_PCODE ); HB_EXPR_USE( pVar, HB_EA_PUSH_PCODE ); if( bAction == HB_EA_PUSH_PCODE ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPUSHALIASED ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPUSHALIASED ); else - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_P_MACROPOPALIASED ); + HB_EXPR_PCODE1( hb_compGenPCode1, HB_P_MACROPOPALIASED ); } - /* Always add add byte to pcode indicating requested macro compiler flag. */ -#if defined( HB_MACRO_SUPPORT ) - HB_EXPR_GENPCODE1( hb_compGenPCode1, HB_COMPFLAG_RT_MACRO ); -#else - HB_EXPR_GENPCODE1( hb_compGenPData1, - ( hb_comp_Supported & HB_COMPFLAG_HARBOUR ? HB_SM_HARBOUR : 0 ) | - ( hb_comp_Supported & HB_COMPFLAG_XBASE ? HB_SM_XBASE : 0 ) | - ( hb_comp_bShortCuts ? HB_SM_SHORTCUTS : 0 ) | - ( hb_comp_Supported & HB_COMPFLAG_RT_MACRO ? HB_SM_RT_MACRO : 0 ) ); -#endif - + /* Always add byte to pcode indicating requested macro compiler flag. */ + HB_EXPR_PCODE1( hb_compGenPCode1, HB_MACRO_GENFLAGS ); } @@ -689,11 +648,7 @@ void hb_compExprUseAliasMacro( HB_EXPR_PTR pAliasedVar, BYTE bAction ) * * pExpr is the first expression on the list */ -#if defined( HB_MACRO_SUPPORT ) -ULONG hb_compExprReduceList( HB_EXPR_PTR pExpr, HB_MACRO_DECL ) -#else -ULONG hb_compExprReduceList( HB_EXPR_PTR pExpr ) -#endif +ULONG hb_compExprReduceList( HB_EXPR_PTR pExpr, HB_COMP_DECL ) { HB_EXPR_PTR pNext; HB_EXPR_PTR * pPrev; @@ -718,7 +673,7 @@ ULONG hb_compExprReduceList( HB_EXPR_PTR pExpr ) return ulCnt; } -BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_MACRO_DECL ) +BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_COMP_DECL ) { char * pTmp = szText; BOOL bTextSubst; @@ -768,13 +723,13 @@ BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_MACRO_DECL cSave = *pTmp; *pTmp = '\0'; - bMacroText &= hb_compIsValidMacroVar( pStart ); + bMacroText &= hb_compIsValidMacroVar( pStart, HB_COMP_PARAM ); *pTmp = cSave; #endif } *pbUseTextSubst |= bTextSubst; } - HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */ + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); /* to suppress BCC warning */ return bMacroText; } @@ -783,7 +738,7 @@ BOOL hb_compExprIsValidMacro( char * szText, BOOL *pbUseTextSubst, HB_MACRO_DECL * * pExpr is the first expression on the list */ -HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, HB_COMP_DECL ) { if( pLeft->value.asString.dealloc ) { @@ -792,7 +747,7 @@ HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, pRight->value.asString.string, pRight->ulLength ); pLeft->ulLength += pRight->ulLength; pLeft->value.asString.string[ pLeft->ulLength ] = '\0'; - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else { @@ -804,9 +759,9 @@ HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR pLeft, HB_EXPR_PTR pRight, szString[ pLeft->ulLength ] = '\0'; pLeft->value.asString.string = szString; pLeft->value.asString.dealloc = TRUE; - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } - HB_SYMBOL_UNUSED( HB_MACRO_VARNAME ); /* to suppress BCC warning */ + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); /* to suppress BCC warning */ return pLeft; } diff --git a/harbour/include/hbexprop.h b/harbour/include/hbexprop.h index e9924ef650..6b33cd98b7 100644 --- a/harbour/include/hbexprop.h +++ b/harbour/include/hbexprop.h @@ -57,374 +57,153 @@ HB_EXTERN_BEGIN -/* value types seen at language level - */ -#define HB_EV_UNKNOWN 0 -#define HB_EV_NIL 1 -#define HB_EV_NUMERIC 2 -#define HB_EV_STRING 4 -#define HB_EV_CODEBLOCK 8 -#define HB_EV_LOGICAL 16 -#define HB_EV_OBJECT 32 -#define HB_EV_ARRAY 64 -#define HB_EV_SYMBOL 128 -#define HB_EV_VARREF 256 -#define HB_EV_FUNREF 512 -#define HB_EV_DATE 1024 - -/* messages sent to expressions - */ -typedef enum -{ - HB_EA_REDUCE = 0, /* reduce the expression into optimized one */ - HB_EA_ARRAY_AT, /* check if the expession can be used as array */ - HB_EA_ARRAY_INDEX, /* check if the expession can be used as index */ - HB_EA_LVALUE, /* check if the expression can be used as lvalue (left side of an assigment) */ - HB_EA_PUSH_PCODE, /* generate the pcodes to push the value of expression */ - HB_EA_POP_PCODE, /* generate the pcodes to pop the value of expression */ - HB_EA_PUSH_POP, /* generate the pcodes to push and pop the expression */ - HB_EA_STATEMENT, /* generate the pcodes for a statement */ - HB_EA_DELETE /* delete components of the expression */ -} HB_EXPR_MESSAGE; - -/* additional definitions used to distinguish numeric expressions - */ -#define HB_ET_LONG 1 -#define HB_ET_DOUBLE 2 - -/* additional definitions used to distinguish macro expressions - */ -#define HB_ET_MACRO_VAR 0 /* &variable */ -#define HB_ET_MACRO_SYMBOL 1 /* &fimcall() */ -#define HB_ET_MACRO_ALIASED 2 /* &alias->&variable */ -#define HB_ET_MACRO_EXPR 4 /* &( expr ) */ -#define HB_ET_MACRO_LIST 16 /* &variable used as in literal arrays or function call argument. */ -#define HB_ET_MACRO_INDEX 32 /* &variable used as arrays index. */ -#define HB_ET_MACRO_PARE 64 /* &variable used as parentesised expressions. */ -#define HB_ET_MACRO_REFER 128 /* ¯o used in @ (pass by reference) */ - -/* types of expressions - * NOTE: the order of these definition is important - change it carefully - * All types <= HB_ET_FUNREF are constant values - * All types <= HB_ET_VARIABLE are a simple values - * All types > HB_ET_VARIABLE are operators - */ -typedef enum -{ - HB_ET_NONE = 0, - HB_ET_NIL, - HB_ET_NUMERIC, - HB_ET_DATE, - HB_ET_STRING, - HB_ET_CODEBLOCK, - HB_ET_LOGICAL, - HB_ET_SELF, - HB_ET_ARRAY, - HB_ET_VARREF, - HB_ET_REFERENCE, - HB_ET_FUNREF, - HB_ET_IIF, - HB_ET_LIST, - HB_ET_ARGLIST, - HB_ET_MACROARGLIST, - HB_ET_ARRAYAT, - HB_ET_MACRO, - HB_ET_FUNCALL, - HB_ET_ALIASVAR, - HB_ET_ALIASEXPR, - HB_ET_SEND, - HB_ET_FUNNAME, - HB_ET_ALIAS, - HB_ET_RTVAR, /* PRIVATE or PUBLIC declaration of variable */ - HB_ET_VARIABLE, - HB_EO_POSTINC, /* post-operators -> lowest precedence */ - HB_EO_POSTDEC, - HB_EO_ASSIGN, /* assigments */ - HB_EO_PLUSEQ, - HB_EO_MINUSEQ, - HB_EO_MULTEQ, - HB_EO_DIVEQ, - HB_EO_MODEQ, - HB_EO_EXPEQ, - HB_EO_OR, /* logical operators */ - HB_EO_AND, - HB_EO_NOT, - HB_EO_EQUAL, /* relational operators */ - HB_EO_EQ, - HB_EO_LT, - HB_EO_GT, - HB_EO_LE, - HB_EO_GE, - HB_EO_NE, - HB_EO_IN, - HB_EO_PLUS, /* addition */ - HB_EO_MINUS, - HB_EO_MULT, /* multiple */ - HB_EO_DIV, - HB_EO_MOD, - HB_EO_POWER, - HB_EO_NEGATE, /* sign operator */ - HB_EO_PREINC, - HB_EO_PREDEC /* pre-operators -> the highest precedence */ -} HB_EXPR_OPERATOR; - -#define HB_EXPR_COUNT ( HB_EO_PREDEC + 1 ) - -typedef USHORT HB_EXPRTYPE; - -typedef struct HB_EXPR_ -{ - union - { - char *asSymbol; /* variable name */ - BOOL asLogical; /* logical value */ - struct - { - char *string; /* literal strings */ - BOOL dealloc; /* automatic deallocate on expresion deletion */ - } asString; - struct - { - struct HB_EXPR_ *pMacro; /* macro variable */ - char *szName; /* variable name */ - } asRTVar; /* PUBLIC or PRIVATE variable declaration */ - struct - { - HB_LONG lVal; /* long value */ - double dVal; /* double value */ - unsigned char bWidth; /* unsigned char used intentionally */ - unsigned char bDec; /* unsigned char used intentionally */ - unsigned char NumType; /* used to distinguish LONG and DOUBLE */ - } asNum; - struct - { - unsigned char cMacroOp; /* macro operator */ - unsigned char SubType; /* context in which macro is used */ - char * szMacro; /* identifier after the macro operator */ - struct HB_EXPR_ *pExprList; /* list elements if &(...) was used */ - struct HB_EXPR_ *pFunCall; /* pointer to a function if used as function's call argument */ - } asMacro; - struct - { - struct HB_EXPR_ *pExprList; /* list elements */ - struct HB_EXPR_ *pIndex; /* array index, others */ - } asList; - struct - { - BOOL isMacro; /* TRUE=codeblock contains macro expression */ - BOOL lateEval; /* TRUE=late evaluation of macro */ - char *string; /* source code of a codeblock */ - struct HB_EXPR_ *pExprList; /* list elements */ - HB_CBVAR_PTR pLocals; /* list of local variables */ - } asCodeblock; - struct - { - struct HB_EXPR_ *pAlias; /* alias expression */ - struct HB_EXPR_ *pVar; /* aliased variable or macro */ - struct HB_EXPR_ *pExpList; /* aliased expression list */ - } asAlias; - struct - { - struct HB_EXPR_ *pFunName; /* function name */ - struct HB_EXPR_ *pParms; /* function call parameters */ - } asFunCall; - struct - { - struct HB_EXPR_ *pObject; /* object */ - struct HB_EXPR_ *pParms; /* method parameters */ - char * szMessage; /* message as string */ - struct HB_EXPR_ *pMessage; /* message as macro */ - } asMessage; - struct - { - struct HB_EXPR_ *pLeft; /* object */ - struct HB_EXPR_ *pRight; /* object */ - } asOperator; - struct HB_EXPR_ *asReference; - } value; - ULONG ulLength; - ULONG Counter; - HB_EXPRTYPE ExprType; /* internal expression type */ - USHORT ValType; /* language level value type */ - struct HB_EXPR_ *pNext; /* next expression in the list of expressions */ -} HB_EXPR, *HB_EXPR_PTR; - /* Definitions of function templates used in expression's message * handling */ -#ifdef HB_MACRO_SUPPORT -/* Compilation for macro compiler - */ -#define HB_EXPR_FUNC( proc ) HB_EXPR_PTR proc( HB_EXPR_PTR pSelf, int iMessage, void * pMacro ) +#define HB_EXPR_FUNC( proc ) HB_EXPR_PTR proc( HB_EXPR_PTR pSelf, int iMessage, HB_COMP_DECL ) typedef HB_EXPR_FUNC( HB_EXPR_FUNC_ ); typedef HB_EXPR_FUNC_ *HB_EXPR_FUNC_PTR; -extern HB_EXPR_FUNC_PTR hb_comp_ExprTable[]; +extern const HB_EXPR_FUNC_PTR hb_comp_ExprTable[]; #define HB_EXPR_USE( pSelf, iMessage ) \ - hb_comp_ExprTable[ (pSelf)->ExprType ]( (pSelf), (iMessage), pMacro ) + hb_comp_ExprTable[ (pSelf)->ExprType ]( (pSelf), (iMessage), HB_COMP_PARAM ) -typedef HB_EXPR_PTR HB_EXPR_ACTION( HB_EXPR_PTR pSelf, int iMessage, void * pMacro ); - -#define HB_EXPR_PCODE0( action ) action( pMacro ) -#define HB_EXPR_PCODE1( action, p1 ) action( (p1), pMacro ) -#define HB_EXPR_PCODE2( action, p1, p2 ) action( (p1), (p2), pMacro ) -#define HB_EXPR_PCODE3( action, p1, p2, p3 ) action( (p1), (p2), (p3), pMacro ) -#define HB_EXPR_PCODE4( action, p1, p2, p3, p4 ) action( (p1), (p2), (p3), (p4), pMacro ) -#define HB_EXPR_GENPCODE1( action, p1 ) action( (p1), pMacro ) -#define HB_EXPR_GENPCODE2( action, p1, p2, p3 ) action( (p1), (p2), pMacro ) -#define HB_EXPR_GENPCODE3( action, p1, p2, p3, p4 ) action( (p1), (p2), (p3), pMacro ) -#define HB_EXPR_GENPCODE4( action, p1, p2, p3, p4, p5 ) action( (p1), (p2), (p3), (p4), pMacro ) - -#define HB_MACRO_VARNAME pMacro - -extern HB_EXPR_PTR hb_macroExprNew( void ); -#else - -#define HB_EXPR_FUNC( proc ) HB_EXPR_PTR proc( HB_EXPR_PTR pSelf, int iMessage ) -typedef HB_EXPR_FUNC( HB_EXPR_FUNC_ ); -typedef HB_EXPR_FUNC_ *HB_EXPR_FUNC_PTR; - -extern HB_EXPR_FUNC_PTR hb_comp_ExprTable[]; - -#define HB_EXPR_USE( pSelf, iMessage ) \ - hb_comp_ExprTable[ (pSelf)->ExprType ]( (pSelf), (iMessage) ) - -typedef HB_EXPR_PTR HB_EXPR_ACTION( HB_EXPR_PTR pSelf, int iMessage ); - -#define HB_EXPR_PCODE0( action ) action( ) -#define HB_EXPR_PCODE1( action, p1 ) action( (p1) ) -#define HB_EXPR_PCODE2( action, p1, p2 ) action( (p1), (p2) ) -#define HB_EXPR_PCODE3( action, p1, p2, p3 ) action( (p1), (p2), (p3) ) -#define HB_EXPR_PCODE4( action, p1, p2, p3, p4 ) action( (p1), (p2), (p3), (p4) ) -#define HB_EXPR_GENPCODE1( action, p1 ) action( (p1) ) -#define HB_EXPR_GENPCODE2( action, p1, p2, p3 ) action( (p1), (p2), (p3) ) -#define HB_EXPR_GENPCODE3( action, p1, p2, p3, p4 ) action( (p1), (p2), (p3), (p4) ) -#define HB_EXPR_GENPCODE4( action, p1, p2, p3, p4, p5 ) action( (p1), (p2), (p3), (p4), (p5) ) - -/* pass NULL instead of macro structure pointer */ -#define HB_MACRO_DECL void *pMacro -#define HB_MACRO_PARAM NULL -#define HB_MACRO_VARNAME pMacro -#endif - - -HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE ); -HB_EXPR_PTR hb_compExprNewEmpty( void ); -HB_EXPR_PTR hb_compExprNewNil( void ); -HB_EXPR_PTR hb_compExprNewDouble( double, BYTE, BYTE ); -HB_EXPR_PTR hb_compExprNewLong( HB_LONG ); -HB_EXPR_PTR hb_compExprNewDate( HB_LONG ); -HB_EXPR_PTR hb_compExprNewString( char *, ULONG ); -HB_EXPR_PTR hb_compExprNewLogical( int ); -HB_EXPR_PTR hb_compExprNewSelf( void ); -HB_EXPR_PTR hb_compExprNewCodeBlock( char *, BOOL, BOOL ); -HB_EXPR_PTR hb_compExprNewVar( char * ); -HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR, unsigned char, char * ); -HB_EXPR_PTR hb_compExprNewFunName( char * ); -HB_EXPR_PTR hb_compExprNewRTVar( char *, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewAlias( char * ); -HB_EXPR_PTR hb_compExprNewEQ( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewNE( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewLT( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewLE( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewGT( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewGE( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewIN( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPlus( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewMinus( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewMult( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewDiv( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewMod( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPower( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewAssign( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewEqual( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPlusEq( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewMinusEq( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewMultEq( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewDivEq( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewModEq( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewExpEq( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPostInc( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPostDec( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPreInc( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewPreDec( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewAnd( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewOr( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewNot( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewVarRef( char * ); -HB_EXPR_PTR hb_compExprNewFunRef( char * ); -HB_EXPR_PTR hb_compExprNewRef( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewCodeblockExpr( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewFunCallArg( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR, char *szMessage, HB_EXPR_PTR pMessage ); -HB_EXPR_PTR hb_compExprNewMethodCall( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewList( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewArgList( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprAddListExpr( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprAddCodeblockExpr( 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_compExprClone( HB_EXPR_PTR pSrc ); -ULONG hb_compExprListLen( HB_EXPR_PTR ); -ULONG hb_compExprMacroListLen( 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_compExprIsLong( HB_EXPR_PTR ); -int hb_compExprAsInteger( HB_EXPR_PTR ); -int hb_compExprIsString( HB_EXPR_PTR ); -int hb_compExprAsStringLen( HB_EXPR_PTR ); -char *hb_compExprAsString( HB_EXPR_PTR ); -char *hb_compExprAsSymbol( HB_EXPR_PTR ); - -void hb_compExprFree( HB_EXPR_PTR, HB_MACRO_DECL ); -void hb_compExprErrorType( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR, HB_MACRO_DECL ); -void hb_compExprCBVarDel( HB_CBVAR_PTR ); -HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR, HB_EXPR_PTR, HB_MACRO_DECL ); -BOOL hb_compExprReduceAT( HB_EXPR_PTR, HB_MACRO_DECL ); -BOOL hb_compExprReduceCHR( HB_EXPR_PTR, HB_MACRO_DECL ); -BOOL hb_compExprReduceLEN( HB_EXPR_PTR, HB_MACRO_DECL ); -BOOL hb_compExprReduceASC( HB_EXPR_PTR, HB_MACRO_DECL ); -BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_MACRO_DECL ); -BOOL hb_compExprIsValidMacro( char *, BOOL *, HB_MACRO_DECL ); +typedef HB_EXPR_PTR HB_EXPR_ACTION( HB_EXPR_PTR pSelf, int iMessage, HB_COMP_DECL ); +#define HB_EXPR_PCODE0( action ) action( HB_COMP_PARAM ) +#define HB_EXPR_PCODE1( action, p1 ) action( (p1), HB_COMP_PARAM ) +#define HB_EXPR_PCODE2( action, p1, p2 ) action( (p1), (p2), HB_COMP_PARAM ) +#define HB_EXPR_PCODE3( action, p1, p2, p3 ) action( (p1), (p2), (p3), HB_COMP_PARAM ) +#define HB_EXPR_PCODE4( action, p1, p2, p3, p4 ) action( (p1), (p2), (p3), (p4), HB_COMP_PARAM ) #ifdef HB_MACRO_SUPPORT - -HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR, HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR, HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR, HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR, char *, HB_MACRO_DECL ); -void hb_compExprDelete( HB_EXPR_PTR, HB_MACRO_DECL ); -HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_MACRO_DECL ); - -#else - -HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR, HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR, char *, BYTE ); -void hb_compExprDelete( HB_EXPR_PTR ); -HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr ); - +extern HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL ); #endif +extern HB_EXPR_PTR hb_compExprNew( HB_EXPRTYPE, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewEmpty( HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewNil( HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewDouble( double, BYTE, BYTE, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewLong( HB_LONG, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewDate( HB_LONG, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewString( char *, ULONG, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewLogical( int, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewSelf( HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewCodeBlock( char *, BOOL, BOOL, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewVar( char *, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR, unsigned char, char *, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewFunName( char *, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewRTVar( char *, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewAlias( char *, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewEQ( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewNE( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewLT( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewLE( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewGT( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewGE( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewIN( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPlus( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMinus( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMult( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewDiv( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMod( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPower( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewAssign( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewEqual( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPlusEq( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMinusEq( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMultEq( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewDivEq( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewModEq( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewExpEq( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPostInc( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPostDec( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPreInc( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewPreDec( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewAnd( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewOr( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewNot( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewVarRef( char *, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewFunRef( char *, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewFunCall( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewRef( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewCodeblockExpr( HB_EXPR_PTR, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compExprNewFunCallArg( HB_EXPR_PTR, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compExprNewSend( HB_EXPR_PTR, char *szMessage, HB_EXPR_PTR pMessage, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewMethodCall( HB_EXPR_PTR, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compExprNewList( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewArgList( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewArray( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprNewArrayAt( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprAddListExpr( HB_EXPR_PTR, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compExprCBVarAdd( HB_EXPR_PTR, char *, BYTE, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprAddCodeblockExpr( HB_EXPR_PTR, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compExprNewIIF( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduce( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprAssign( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprEqual( HB_EXPR_PTR, HB_EXPR_PTR ); +extern HB_EXPR_PTR hb_compExprAssignStatic( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprClone( HB_EXPR_PTR pSrc ); +extern ULONG hb_compExprListLen( HB_EXPR_PTR ); +extern ULONG hb_compExprMacroListLen( HB_EXPR_PTR ); +extern void hb_compExprClear( HB_EXPR_PTR ); +extern const char * hb_compExprDescription( HB_EXPR_PTR ); +extern int hb_compExprType( HB_EXPR_PTR ); +extern int hb_compExprIsInteger( HB_EXPR_PTR ); +extern int hb_compExprIsLong( HB_EXPR_PTR ); +extern int hb_compExprAsInteger( HB_EXPR_PTR ); +extern int hb_compExprIsString( HB_EXPR_PTR ); +extern int hb_compExprAsStringLen( HB_EXPR_PTR ); +extern char *hb_compExprAsString( HB_EXPR_PTR ); +extern char *hb_compExprAsSymbol( HB_EXPR_PTR ); + +extern void hb_compExprFree( HB_EXPR_PTR, HB_COMP_DECL ); +extern void hb_compExprErrorType( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR, HB_COMP_DECL ); +extern void hb_compExprCBVarDel( HB_CBVAR_PTR ); +extern HB_EXPR_PTR hb_compExprReducePlusStrings( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern BOOL hb_compExprReduceAT( HB_EXPR_PTR, HB_COMP_DECL ); +extern BOOL hb_compExprReduceCHR( HB_EXPR_PTR, HB_COMP_DECL ); +extern BOOL hb_compExprReduceLEN( HB_EXPR_PTR, HB_COMP_DECL ); +extern BOOL hb_compExprReduceASC( HB_EXPR_PTR, HB_COMP_DECL ); +extern BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL ); +extern BOOL hb_compExprIsValidMacro( char *, BOOL *, HB_COMP_DECL ); +extern void hb_compExprDelete( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprSetOperand( HB_EXPR_PTR, HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprGenStatement( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprGenPush( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprGenPop( HB_EXPR_PTR, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprSetGetBlock( HB_EXPR_PTR pExpr, HB_COMP_DECL ); + +extern void hb_compExprDelOperator( HB_EXPR_PTR, HB_COMP_DECL ); +extern void hb_compExprUseOperEq( HB_EXPR_PTR, BYTE, HB_COMP_DECL ); +extern void hb_compExprPushPreOp( HB_EXPR_PTR, BYTE, HB_COMP_DECL ); +extern void hb_compExprPushPostOp( HB_EXPR_PTR, BYTE, HB_COMP_DECL ); +extern void hb_compExprUsePreOp( HB_EXPR_PTR, BYTE, HB_COMP_DECL ); +extern void hb_compExprUseAliasMacro( HB_EXPR_PTR, BYTE, HB_COMP_DECL ); +extern void hb_compExprPushOperEq( HB_EXPR_PTR pSelf, BYTE bOpEq, HB_COMP_DECL ); +extern ULONG hb_compExprReduceList( HB_EXPR_PTR, HB_COMP_DECL ); + +extern HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_COMP_DECL ); +extern HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR, HB_COMP_DECL ); + + HB_EXTERN_END #endif /* HB_EXPROP_H_ */ diff --git a/harbour/include/hbmacro.h b/harbour/include/hbmacro.h index 0b9c884278..889c6ab49e 100644 --- a/harbour/include/hbmacro.h +++ b/harbour/include/hbmacro.h @@ -60,12 +60,7 @@ #include #include -/* Standard parameters passed to macro aware functions - */ -#define HB_BISON_PTR void * -#define HB_MACRO_PARAM pMacro -#define HB_MACRO_DECL HB_BISON_PTR HB_MACRO_PARAM - +#include "hbcompdf.h" #include "hbapi.h" #include "hbapiitm.h" #include "hbapierr.h" @@ -101,60 +96,60 @@ HB_EXTERN_BEGIN /* Global functions */ -extern void hb_macroError( int iError, HB_BISON_PTR pMacro ); +extern void hb_macroError( int iError, HB_COMP_DECL ); extern int hb_macroYYParse( HB_MACRO_PTR pMacro ); extern ULONG hb_macroSetMacro( BOOL bSet, ULONG ulFlag ); extern ULONG hb_macroAutoSetMacro( ULONG ulFlag ); extern BOOL hb_macroLexNew( HB_MACRO_PTR pMacro ); extern void hb_macroLexDelete( HB_MACRO_PTR pMacro ); -extern void hb_compGenPCode1( BYTE byte, HB_BISON_PTR pMacro ); -extern void hb_compGenPData1( BYTE byte, HB_BISON_PTR pMacro ); -extern void hb_compGenPCode2( BYTE byte1, BYTE byte2, HB_BISON_PTR pMacro ); -extern void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, HB_BISON_PTR pMacro ); -extern void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, HB_BISON_PTR pMacro ); -extern void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_BISON_PTR pMacro ); - /* Size of pcode buffer incrementation */ #define HB_PCODE_SIZE 512 -/* Bison requires (void *) pointer - some code needs HB_MACRO_PTR pointer - */ -#define HB_MACRO_DATA ( (HB_MACRO_PTR) HB_MACRO_PARAM ) -#define HB_PCODE_DATA ( HB_MACRO_DATA->pCodeInfo ) - /* Declarations for functions macro.c */ +#if defined( HB_MACRO_SUPPORT ) -extern int hb_compLocalVarGetPos( char * szVarName, HB_BISON_PTR pMacro ); -extern ULONG hb_compGenJump( LONG lOffset, HB_BISON_PTR pMacro ); -extern ULONG hb_compGenJumpFalse( LONG lOffset, HB_BISON_PTR pMacro ); -extern void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo, HB_BISON_PTR pMacro ); -extern void hb_compGenJumpHere( ULONG ulOffset, HB_BISON_PTR pMacro ); -extern ULONG hb_compGenJumpTrue( LONG lOffset, HB_BISON_PTR pMacro ); -extern void hb_compMemvarGenPCode( BYTE bPCode, char * szVarName, HB_BISON_PTR pMacro ); -extern void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_BISON_PTR pMacro ); -extern void hb_compGenPushLong( HB_LONG lNumber, HB_BISON_PTR pMacro ); -extern void hb_compGenPushDate( HB_LONG lNumber, HB_BISON_PTR pMacro ); -extern void hb_compGenMessage( char * szMsgName, BOOL bIsObject, HB_BISON_PTR pMacro ); -extern void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_BISON_PTR pMacro ); -extern void hb_compGenPopVar( char * szVarName, HB_BISON_PTR pMacro ); +extern void hb_compGenPCode1( BYTE byte, HB_COMP_DECL ); +extern void hb_compGenPData1( BYTE byte, HB_COMP_DECL ); +extern void hb_compGenPCode2( BYTE byte1, BYTE byte2, HB_COMP_DECL ); +extern void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, HB_COMP_DECL ); +extern void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, HB_COMP_DECL ); +extern void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_COMP_DECL ); + +extern int hb_compLocalVarGetPos( char * szVarName, HB_COMP_DECL ); +extern ULONG hb_compGenJump( LONG lOffset, HB_COMP_DECL ); +extern ULONG hb_compGenJumpFalse( LONG lOffset, HB_COMP_DECL ); +extern void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo, HB_COMP_DECL ); +extern void hb_compGenJumpHere( ULONG ulOffset, HB_COMP_DECL ); +extern ULONG hb_compGenJumpTrue( LONG lOffset, HB_COMP_DECL ); + +extern void hb_compMemvarGenPCode( BYTE bPCode, char * szVarName, HB_COMP_DECL ); + +extern void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_COMP_DECL ); +extern void hb_compGenPushLong( HB_LONG lNumber, HB_COMP_DECL ); +extern void hb_compGenPushDate( HB_LONG lNumber, HB_COMP_DECL ); +extern void hb_compGenMessage( char * szMsgName, BOOL bIsObject, HB_COMP_DECL ); +extern void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_COMP_DECL ); +extern void hb_compGenPopVar( char * szVarName, HB_COMP_DECL ); extern void hb_compGenPopAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, - long lWorkarea, HB_BISON_PTR pMacro ); -extern void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_BISON_PTR pMacro ); -extern void hb_compGenPushVarRef( char * szVarName, HB_BISON_PTR pMacro ); + long lWorkarea, HB_COMP_DECL ); +extern void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_COMP_DECL ); +extern void hb_compGenPushVarRef( char * szVarName, HB_COMP_DECL ); extern void hb_compGenPushAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, - long lWorkarea, HB_BISON_PTR pMacro ); -extern void hb_compGenPushLogical( int iTrueFalse, HB_BISON_PTR pMacro ); -extern void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_BISON_PTR pMacro ); -extern void hb_compGenPushFunCall( char * szFunName, HB_BISON_PTR pMacro ); -extern void hb_compGenPushString( char * szText, ULONG ulStrLen, HB_BISON_PTR pMacro ); -extern void hb_compCodeBlockStart( HB_BISON_PTR pMacro ); -extern void hb_compCodeBlockEnd( HB_BISON_PTR pMacro ); + long lWorkarea, HB_COMP_DECL ); +extern void hb_compGenPushLogical( int iTrueFalse, HB_COMP_DECL ); +extern void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_COMP_DECL ); +extern void hb_compGenPushFunCall( char * szFunName, HB_COMP_DECL ); +extern void hb_compGenPushString( char * szText, ULONG ulStrLen, HB_COMP_DECL ); +extern void hb_compCodeBlockStart( HB_COMP_DECL ); +extern void hb_compCodeBlockEnd( HB_COMP_DECL ); + +#endif /* HB_MACRO_SUPPORT */ HB_EXTERN_END diff --git a/harbour/include/hbpp.h b/harbour/include/hbpp.h index 4abca76229..8555a1671d 100644 --- a/harbour/include/hbpp.h +++ b/harbour/include/hbpp.h @@ -548,6 +548,7 @@ typedef struct PHB_MEM_BUFFER pDumpBuffer; /* buffer for dump output */ PHB_MEM_BUFFER pOutputBuffer; /* buffer for preprocessed line */ + int iLineTot; /* total number of parsed lines */ int iCycle; /* translation counter */ int iMaxCycles; /* maximum number of translations */ int iHideStrings; /* hidden string mode */ @@ -612,7 +613,8 @@ typedef void * PHB_PP_STATE; extern PHB_PP_STATE hb_pp_new( void ); extern void hb_pp_free( PHB_PP_STATE pState ); extern void hb_pp_reset( PHB_PP_STATE pState ); -extern void hb_pp_init( PHB_PP_STATE pState, BOOL fQuiet, void * cargo, +extern void hb_pp_init( PHB_PP_STATE pState, BOOL fQuiet, + int iCycles, void * cargo, PHB_PP_OPEN_FUNC pOpenFunc, PHB_PP_CLOSE_FUNC pCloseFunc, PHB_PP_ERROR_FUNC pErrorFunc, PHB_PP_DISP_FUNC pDispFunc, PHB_PP_DUMP_FUNC pDumpFunc, PHB_PP_INLINE_FUNC pInLineFunc, @@ -627,6 +629,7 @@ extern BOOL hb_pp_inFile( PHB_PP_STATE pState, char * szFileName, BOOL fSearch extern BOOL hb_pp_outFile( PHB_PP_STATE pState, char * szOutFileName, FILE * file_out ); extern char * hb_pp_fileName( PHB_PP_STATE pState ); extern int hb_pp_line( PHB_PP_STATE pState ); +extern int hb_pp_lineTot( PHB_PP_STATE pState ); extern char * hb_pp_outFileName( PHB_PP_STATE pState ); extern char * hb_pp_nextLine( PHB_PP_STATE pState, ULONG * pulLen ); extern char * hb_pp_parseLine( PHB_PP_STATE pState, char * pLine, ULONG * pulLen ); diff --git a/harbour/include/hbvm.h b/harbour/include/hbvm.h index cbe5e56f13..53943e0a0d 100644 --- a/harbour/include/hbvm.h +++ b/harbour/include/hbvm.h @@ -148,7 +148,7 @@ extern HB_EXPORT void hb_vmPopState( void ); /* pop current VM state from st /* various flags for supported features */ #define HB_VMFLAG_HARBOUR 1 /* enable Harbour extension */ -#define HB_VMFLAG_ARRSTR 2 /* support for string as array of bytes -ks */ +#define HB_VMFLAG_ARRSTR 16 /* support for string as array of bytes -ks */ extern HB_EXPORT ULONG hb_vmFlagEnabled( ULONG flag ); HB_EXTERN_END diff --git a/harbour/source/common/expropt1.c b/harbour/source/common/expropt1.c index f5be0abc35..cdc2790c96 100644 --- a/harbour/source/common/expropt1.c +++ b/harbour/source/common/expropt1.c @@ -72,7 +72,7 @@ #define HB_XGRAB( size ) hb_xgrab( (size) ) #define HB_XFREE( pPtr ) hb_xfree( (void *)(pPtr) ) -static char * s_OperTable[ HB_EXPR_COUNT ] = { +static const char * s_OperTable[ HB_EXPR_COUNT ] = { "", "NIL", "Numeric", @@ -141,7 +141,7 @@ HB_EXPR_PTR hb_compExprClone( HB_EXPR_PTR pSrc ) return pSrc; } -char * hb_compExprDescription( HB_EXPR_PTR pExpr ) +const char * hb_compExprDescription( HB_EXPR_PTR pExpr ) { if( pExpr ) return s_OperTable[ pExpr->ExprType ]; @@ -154,60 +154,6 @@ int hb_compExprType( HB_EXPR_PTR pExpr ) return ( int ) pExpr->ExprType; } -/* ************************************************************************* */ - -HB_EXPR_PTR hb_compExprNewEmpty( void ) -{ - return hb_compExprNew( HB_ET_NONE ); -} - -HB_EXPR_PTR hb_compExprNewDouble( double dValue, BYTE ucWidth, BYTE ucDec ) -{ - HB_EXPR_PTR pExpr; - - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewDouble(%f, %i)", dValue, ucDec)); - - pExpr = hb_compExprNew( HB_ET_NUMERIC ); - - pExpr->value.asNum.dVal = dValue; - pExpr->value.asNum.bWidth = ucWidth; - pExpr->value.asNum.bDec = ucDec; - pExpr->value.asNum.NumType = HB_ET_DOUBLE; - pExpr->ValType = HB_EV_NUMERIC; - - return pExpr; -} - -HB_EXPR_PTR hb_compExprNewLong( HB_LONG lValue ) -{ - HB_EXPR_PTR pExpr; - - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLong(%" PFHL "d)", lValue)); - - pExpr = hb_compExprNew( HB_ET_NUMERIC ); - - pExpr->value.asNum.lVal = lValue; - pExpr->value.asNum.bDec = 0; - pExpr->value.asNum.NumType = HB_ET_LONG; - pExpr->ValType = HB_EV_NUMERIC; - - return pExpr; -} - -HB_EXPR_PTR hb_compExprNewDate( HB_LONG lValue ) -{ - HB_EXPR_PTR pExpr; - - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewDate(%" PFHL "d)", lValue)); - - pExpr = hb_compExprNew( HB_ET_DATE ); - - pExpr->value.asNum.lVal = lValue; - pExpr->ValType = HB_EV_DATE; - - return pExpr; -} - int hb_compExprIsInteger( HB_EXPR_PTR pExpr ) { return ( pExpr->ExprType == HB_ET_NUMERIC && pExpr->value.asNum.NumType == HB_ET_LONG && @@ -269,13 +215,69 @@ char *hb_compExprAsSymbol( HB_EXPR_PTR pExpr ) return NULL; } -HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, BOOL isMacro, BOOL lateEval ) +/* ************************************************************************* */ + +HB_EXPR_PTR hb_compExprNewEmpty( HB_COMP_DECL ) +{ + return hb_compExprNew( HB_ET_NONE, HB_COMP_PARAM ); +} + +HB_EXPR_PTR hb_compExprNewDouble( double dValue, BYTE ucWidth, BYTE ucDec, + HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%u,%u)",string,isMacro,lateEval)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewDouble(%f, %i, %p)", dValue, ucDec, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_CODEBLOCK ); + pExpr = hb_compExprNew( HB_ET_NUMERIC, HB_COMP_PARAM ); + + pExpr->value.asNum.dVal = dValue; + pExpr->value.asNum.bWidth = ucWidth; + pExpr->value.asNum.bDec = ucDec; + pExpr->value.asNum.NumType = HB_ET_DOUBLE; + pExpr->ValType = HB_EV_NUMERIC; + + return pExpr; +} + +HB_EXPR_PTR hb_compExprNewLong( HB_LONG lValue, HB_COMP_DECL ) +{ + HB_EXPR_PTR pExpr; + + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLong(%" PFHL "d, %p)", lValue, HB_COMP_PARAM)); + + pExpr = hb_compExprNew( HB_ET_NUMERIC, HB_COMP_PARAM ); + + pExpr->value.asNum.lVal = lValue; + pExpr->value.asNum.bDec = 0; + pExpr->value.asNum.NumType = HB_ET_LONG; + pExpr->ValType = HB_EV_NUMERIC; + + return pExpr; +} + +HB_EXPR_PTR hb_compExprNewDate( HB_LONG lValue, HB_COMP_DECL ) +{ + HB_EXPR_PTR pExpr; + + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewDate(%" PFHL "d, %p)", lValue, HB_COMP_PARAM)); + + pExpr = hb_compExprNew( HB_ET_DATE, HB_COMP_PARAM ); + + pExpr->value.asNum.lVal = lValue; + pExpr->ValType = HB_EV_DATE; + + return pExpr; +} + +HB_EXPR_PTR hb_compExprNewCodeBlock( char *string, BOOL isMacro, BOOL lateEval, + HB_COMP_DECL ) +{ + HB_EXPR_PTR pExpr; + + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewCodeBlock(%s,%u,%u,%p)",string,isMacro,lateEval,HB_COMP_PARAM)); + + pExpr = hb_compExprNew( HB_ET_CODEBLOCK, HB_COMP_PARAM ); pExpr->value.asCodeblock.pExprList = NULL; pExpr->value.asCodeblock.pLocals = NULL; /* this will hold local variables declarations */ @@ -304,13 +306,13 @@ HB_EXPR_PTR hb_compExprAddCodeblockExpr( HB_EXPR_PTR pList, HB_EXPR_PTR pNewItem return pList; } -HB_EXPR_PTR hb_compExprNewLogical( int iValue ) +HB_EXPR_PTR hb_compExprNewLogical( int iValue, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLogical(%i)", iValue)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewLogical(%i,%p)", iValue, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_LOGICAL ); + pExpr = hb_compExprNew( HB_ET_LOGICAL, HB_COMP_PARAM ); pExpr->value.asLogical = iValue; pExpr->ValType = HB_EV_LOGICAL; @@ -319,63 +321,63 @@ HB_EXPR_PTR hb_compExprNewLogical( int iValue ) } -HB_EXPR_PTR hb_compExprNewNil( void ) +HB_EXPR_PTR hb_compExprNewNil( HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewNil()")); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewNil(%p)", HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_NIL ); + pExpr = hb_compExprNew( HB_ET_NIL, HB_COMP_PARAM ); pExpr->ValType = HB_EV_NIL; return pExpr; } -HB_EXPR_PTR hb_compExprNewSelf( void ) +HB_EXPR_PTR hb_compExprNewSelf( HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSelf()")); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewSelf(%p)", HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_SELF ); + pExpr = hb_compExprNew( HB_ET_SELF, HB_COMP_PARAM ); pExpr->ValType = HB_EV_OBJECT; return pExpr; } -HB_EXPR_PTR hb_compExprNewVarRef( char * szVarName ) +HB_EXPR_PTR hb_compExprNewVarRef( char * szVarName, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewVarRef(%s)", szVarName)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewVarRef(%s,%p)", szVarName, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_VARREF ); + pExpr = hb_compExprNew( HB_ET_VARREF, HB_COMP_PARAM ); pExpr->value.asSymbol = szVarName; pExpr->ValType = HB_EV_VARREF; return pExpr; } -HB_EXPR_PTR hb_compExprNewFunRef( char * szFunName ) +HB_EXPR_PTR hb_compExprNewFunRef( char * szFunName, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewFunRef(%s)", szFunName)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewFunRef(%s,%p)", szFunName, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_FUNREF ); + pExpr = hb_compExprNew( HB_ET_FUNREF, HB_COMP_PARAM ); pExpr->value.asSymbol = szFunName; pExpr->ValType = HB_EV_FUNREF; return pExpr; } -HB_EXPR_PTR hb_compExprNewRef( HB_EXPR_PTR pRefer ) +HB_EXPR_PTR hb_compExprNewRef( HB_EXPR_PTR pRefer, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewRef(%p)", pRefer)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewRef(%p,%p)", pRefer, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_REFERENCE ); + pExpr = hb_compExprNew( HB_ET_REFERENCE, HB_COMP_PARAM ); pExpr->value.asReference = pRefer; pExpr->ValType = HB_EV_VARREF; @@ -384,7 +386,9 @@ HB_EXPR_PTR hb_compExprNewRef( HB_EXPR_PTR pRefer ) /* Creates new macro expression */ -HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, char * szName ) +HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, + unsigned char cMacroOp, char * szName, + HB_COMP_DECL ) { HB_EXPR_PTR pExpr; @@ -404,7 +408,7 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, * is pushed as: * "MY&VAR.1" */ - pExpr = hb_compExprNew( HB_ET_MACRO ); + pExpr = hb_compExprNew( HB_ET_MACRO, HB_COMP_PARAM ); pExpr->value.asMacro.cMacroOp = cMacroOp; /* '&' if variable or 0 if text */ pExpr->value.asMacro.szMacro = szName; /* variable name or macro text */ pExpr->value.asMacro.pExprList = NULL; /* this is not a parenthesized expressions */ @@ -423,9 +427,9 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, BOOL bUseTextSubst; szDupl = hb_strupr( hb_strdup( szName ) ); - if( ! hb_compExprIsValidMacro( szDupl, &bUseTextSubst, NULL ) ) + if( ! hb_compExprIsValidMacro( szDupl, &bUseTextSubst, HB_COMP_PARAM ) ) { - hb_compErrorMacro( szName ); + hb_compErrorMacro( szName, HB_COMP_PARAM ); } hb_xfree( szDupl ); } @@ -436,7 +440,7 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, /* Macro expression: &( expression_list ) */ - pExpr = hb_compExprNew( HB_ET_MACRO ); + pExpr = hb_compExprNew( HB_ET_MACRO, HB_COMP_PARAM ); pExpr->value.asMacro.pExprList = pMacroExpr; pExpr->value.asMacro.szMacro = NULL; /* this is used to distinguish &(...) from &ident */ pExpr->value.asMacro.SubType = HB_ET_MACRO_EXPR; @@ -448,13 +452,14 @@ HB_EXPR_PTR hb_compExprNewMacro( HB_EXPR_PTR pMacroExpr, unsigned char cMacroOp, /* Creates new aliased variable * aliasexpr -> identifier */ -HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR pAlias, HB_EXPR_PTR pVariable ) +HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR pAlias, HB_EXPR_PTR pVariable, + HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewAliasVar()")); - pExpr = hb_compExprNew( HB_ET_ALIASVAR ); + pExpr = hb_compExprNew( HB_ET_ALIASVAR, HB_COMP_PARAM ); pExpr->value.asAlias.pAlias = pAlias; pExpr->value.asAlias.pVar = pVariable; @@ -473,13 +478,14 @@ HB_EXPR_PTR hb_compExprNewAliasVar( HB_EXPR_PTR pAlias, HB_EXPR_PTR pVariable ) /* Creates new aliased expression * alias_expr -> ( expression ) */ -HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR pAlias, HB_EXPR_PTR pExpList ) +HB_EXPR_PTR hb_compExprNewAliasExpr( HB_EXPR_PTR pAlias, HB_EXPR_PTR pExpList, + HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewAliasExpr()")); - pExpr = hb_compExprNew( HB_ET_ALIASEXPR ); + pExpr = hb_compExprNew( HB_ET_ALIASEXPR, HB_COMP_PARAM ); pExpr->value.asAlias.pAlias = pAlias; pExpr->value.asAlias.pExpList = pExpList; @@ -513,39 +519,39 @@ HB_EXPR_PTR hb_compExprNewMethodCall( HB_EXPR_PTR pObject, HB_EXPR_PTR pArgList /* Creates a list - all elements will be used * This list can be used to create an array or function's call arguments */ -HB_EXPR_PTR hb_compExprNewList( HB_EXPR_PTR pFirstItem ) +HB_EXPR_PTR hb_compExprNewList( HB_EXPR_PTR pFirstItem, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewList()")); - pExpr = hb_compExprNew( HB_ET_LIST ); + pExpr = hb_compExprNew( HB_ET_LIST, HB_COMP_PARAM ); pExpr->value.asList.pExprList = pFirstItem; return pExpr; } /* Creates a list of function call arguments */ -HB_EXPR_PTR hb_compExprNewArgList( HB_EXPR_PTR pFirstItem ) +HB_EXPR_PTR hb_compExprNewArgList( HB_EXPR_PTR pFirstItem, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewArgList()")); - pExpr = hb_compExprNew( HB_ET_ARGLIST ); + pExpr = hb_compExprNew( HB_ET_ARGLIST, HB_COMP_PARAM ); pExpr->value.asList.pExprList = pFirstItem; return pExpr; } /* Creates a list of function call arguments */ -HB_EXPR_PTR hb_compExprNewMacroArgList( HB_EXPR_PTR pFirstItem ) +HB_EXPR_PTR hb_compExprNewMacroArgList( HB_EXPR_PTR pFirstItem, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewMacroArgList()")); - pExpr = hb_compExprNew( HB_ET_MACROARGLIST ); + pExpr = hb_compExprNew( HB_ET_MACROARGLIST, HB_COMP_PARAM ); pExpr->value.asList.pExprList = pFirstItem; return pExpr; } @@ -570,13 +576,13 @@ HB_EXPR_PTR hb_compExprAddListExpr( HB_EXPR_PTR pList, HB_EXPR_PTR pNewItem ) return pList; } -HB_EXPR_PTR hb_compExprNewVar( char * szName ) +HB_EXPR_PTR hb_compExprNewVar( char * szName, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewVar(%s)", szName)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewVar(%s,%p)", szName, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_VARIABLE ); + pExpr = hb_compExprNew( HB_ET_VARIABLE, HB_COMP_PARAM ); pExpr->value.asSymbol = szName; return pExpr; } @@ -586,13 +592,14 @@ HB_EXPR_PTR hb_compExprNewVar( char * szName ) * szName is a string with variable name if 'PUBLIC varname' context * pMacroVar is a macro expression if 'PUBLIC &varname' context */ -HB_EXPR_PTR hb_compExprNewRTVar( char * szName, HB_EXPR_PTR pMacroVar ) +HB_EXPR_PTR hb_compExprNewRTVar( char * szName, HB_EXPR_PTR pMacroVar, + HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewRTVar(%s, %p)", szName, pMacroVar)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewRTVar(%s, %p, %p)", szName, pMacroVar, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_RTVAR ); + pExpr = hb_compExprNew( HB_ET_RTVAR, HB_COMP_PARAM ); pExpr->value.asRTVar.szName = szName; pExpr->value.asRTVar.pMacro = pMacroVar; if( pMacroVar ) @@ -602,26 +609,26 @@ HB_EXPR_PTR hb_compExprNewRTVar( char * szName, HB_EXPR_PTR pMacroVar ) /* Create a new symbol used in function calls */ -HB_EXPR_PTR hb_compExprNewFunName( char * szName ) +HB_EXPR_PTR hb_compExprNewFunName( char * szName, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewFunName(%s)", szName)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewFunName(%s,%p)", szName, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_FUNNAME ); + pExpr = hb_compExprNew( HB_ET_FUNNAME, HB_COMP_PARAM ); pExpr->value.asSymbol = szName; return pExpr; } /* Create a new symbol used in an alias expressions */ -HB_EXPR_PTR hb_compExprNewAlias( char * szName ) +HB_EXPR_PTR hb_compExprNewAlias( char * szName, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; - HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewAlias(%s)", szName)); + HB_TRACE(HB_TR_DEBUG, ("hb_compExprNewAlias(%s,%p)", szName, HB_COMP_PARAM)); - pExpr = hb_compExprNew( HB_ET_ALIAS ); + pExpr = hb_compExprNew( HB_ET_ALIAS, HB_COMP_PARAM ); pExpr->value.asSymbol = szName; return pExpr; } @@ -629,159 +636,159 @@ HB_EXPR_PTR hb_compExprNewAlias( char * szName ) /* ************************************************************************* */ -HB_EXPR_PTR hb_compExprNewEqual( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewEqual( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_EQUAL ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_EQUAL, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPlus( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPlus( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PLUS ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PLUS, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewMinus( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewMinus( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MINUS ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MINUS, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewMult( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewMult( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MULT ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MULT, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewDiv( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewDiv( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_DIV ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_DIV, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewMod( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewMod( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MOD ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MOD, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPower( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPower( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_POWER ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_POWER, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPostInc( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPostInc( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_POSTINC ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_POSTINC, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPostDec( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPostDec( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_POSTDEC ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_POSTDEC, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPreInc( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPreInc( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PREINC ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PREINC, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPreDec( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPreDec( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PREDEC ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PREDEC, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewPlusEq( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewPlusEq( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PLUSEQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_PLUSEQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewMinusEq( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewMinusEq( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MINUSEQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MINUSEQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewMultEq( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewMultEq( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MULTEQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MULTEQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewDivEq( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewDivEq( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_DIVEQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_DIVEQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewModEq( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewModEq( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MODEQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_MODEQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewExpEq( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewExpEq( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_EXPEQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_EXPEQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewAnd( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewAnd( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_AND ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_AND, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewOr( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewOr( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_OR ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_OR, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewNot( HB_EXPR_PTR pNotExpr ) +HB_EXPR_PTR hb_compExprNewNot( HB_EXPR_PTR pNotExpr, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; @@ -792,7 +799,7 @@ HB_EXPR_PTR hb_compExprNewNot( HB_EXPR_PTR pNotExpr ) } else { - pExpr = hb_compExprNew( HB_EO_NOT ); + pExpr = hb_compExprNew( HB_EO_NOT, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pNotExpr; pExpr->value.asOperator.pRight = NULL; } @@ -800,57 +807,57 @@ HB_EXPR_PTR hb_compExprNewNot( HB_EXPR_PTR pNotExpr ) return pExpr; } -HB_EXPR_PTR hb_compExprNewEQ( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewEQ( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_EQ ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_EQ, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewLT( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewLT( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_LT ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_LT, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewGT( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewGT( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_GT ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_GT, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewLE( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewLE( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_LE ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_LE, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewGE( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewGE( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_GE ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_GE, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewNE( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewNE( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_NE ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_NE, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; } -HB_EXPR_PTR hb_compExprNewIN( HB_EXPR_PTR pLeftExpr ) +HB_EXPR_PTR hb_compExprNewIN( HB_EXPR_PTR pLeftExpr, HB_COMP_DECL ) { - HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_IN ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_EO_IN, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = NULL; return pExpr; @@ -858,7 +865,7 @@ HB_EXPR_PTR hb_compExprNewIN( HB_EXPR_PTR pLeftExpr ) /* NOTE: all invalid cases are handled by yacc rules */ -HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr ) +HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; @@ -878,7 +885,7 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr ) } else { - pExpr = hb_compExprNew( HB_EO_NEGATE ); + pExpr = hb_compExprNew( HB_EO_NEGATE, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pNegExpr; pExpr->value.asOperator.pRight = NULL; } @@ -889,13 +896,14 @@ HB_EXPR_PTR hb_compExprNewNegate( HB_EXPR_PTR pNegExpr ) /* Handles (expression := expression) syntax */ -HB_EXPR_PTR hb_compExprAssign( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightExpr ) +HB_EXPR_PTR hb_compExprAssign( HB_EXPR_PTR pLeftExpr, HB_EXPR_PTR pRightExpr, + HB_COMP_DECL ) { HB_EXPR_PTR pExpr; HB_TRACE(HB_TR_DEBUG, ("hb_compExprAssign()")); - pExpr = hb_compExprNew( HB_EO_ASSIGN ); + pExpr = hb_compExprNew( HB_EO_ASSIGN, HB_COMP_PARAM ); pExpr->value.asOperator.pLeft = pLeftExpr; pExpr->value.asOperator.pRight = pRightExpr; return pExpr; diff --git a/harbour/source/common/expropt2.c b/harbour/source/common/expropt2.c index 94cb508239..c68e389cab 100644 --- a/harbour/source/common/expropt2.c +++ b/harbour/source/common/expropt2.c @@ -70,7 +70,7 @@ #include "hbcomp.h" #include "hbdate.h" -HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -90,8 +90,8 @@ HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pSelf->value.asNum.NumType = HB_ET_LONG; pSelf->ExprType = HB_ET_NUMERIC; pSelf->ValType = HB_EV_NUMERIC; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } } } @@ -103,7 +103,7 @@ HB_EXPR_PTR hb_compExprReduceMod( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -181,8 +181,8 @@ HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { /* The expression was reduced - delete old components */ pSelf->ValType = HB_EV_NUMERIC; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } } else @@ -193,7 +193,7 @@ HB_EXPR_PTR hb_compExprReduceDiv( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -256,8 +256,8 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } pSelf->ExprType = HB_ET_NUMERIC; pSelf->ValType = HB_EV_NUMERIC; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else { @@ -267,7 +267,7 @@ HB_EXPR_PTR hb_compExprReduceMult( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -333,8 +333,8 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } pSelf->ExprType = HB_ET_NUMERIC; pSelf->ValType = HB_EV_NUMERIC; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else if( pLeft->ExprType == HB_ET_DATE && pRight->ExprType == HB_ET_DATE ) { @@ -343,8 +343,8 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pSelf->value.asNum.NumType = HB_ET_LONG; pSelf->ExprType = HB_ET_NUMERIC; pSelf->ValType = HB_EV_NUMERIC; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else if( pLeft->ExprType == HB_ET_DATE && pRight->ExprType == HB_ET_NUMERIC ) { @@ -358,8 +358,8 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } pSelf->ExprType = HB_ET_DATE; pSelf->ValType = HB_EV_DATE; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else if( pLeft->ExprType == HB_ET_STRING && pRight->ExprType == HB_ET_STRING ) { @@ -374,7 +374,7 @@ HB_EXPR_PTR hb_compExprReduceMinus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -440,24 +440,24 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } pSelf->ExprType = HB_ET_NUMERIC; pSelf->ValType = HB_EV_NUMERIC; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else if( pLeft->ExprType == HB_ET_STRING && pRight->ExprType == HB_ET_STRING ) { if( pRight->ulLength == 0 ) { pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); pSelf = pLeft; - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else if( pLeft->ulLength == 0 ) { pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); pSelf = pRight; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); } else { @@ -466,8 +466,8 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) if( strchr(pLeft->value.asString.string, '&') == NULL ) { pSelf->ExprType = HB_ET_NONE; /* suppress deletion of operator components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); - pSelf = hb_compExprReducePlusStrings( pLeft, pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); + pSelf = hb_compExprReducePlusStrings( pLeft, pRight, HB_COMP_PARAM ); } } } @@ -483,8 +483,8 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } pSelf->ExprType = HB_ET_DATE; pSelf->ValType = HB_EV_DATE; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); } else { @@ -495,7 +495,7 @@ HB_EXPR_PTR hb_compExprReducePlus( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } -HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { if( ( pSelf->value.asOperator.pLeft->ExprType == pSelf->value.asOperator.pRight->ExprType ) && pSelf->value.asOperator.pLeft->ExprType == HB_ET_STRING ) { @@ -516,8 +516,8 @@ HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * "" $ "XXX" = .T. * "" $ "" = .T. */ - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -527,7 +527,7 @@ HB_EXPR_PTR hb_compExprReduceIN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -545,8 +545,8 @@ HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * .T. != .F. = .T. */ BOOL bResult = ( pLeft->value.asLogical != pRight->value.asLogical ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -561,8 +561,8 @@ HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) */ if( (pLeft->ulLength | pRight->ulLength) == 0 ) { - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = FALSE; @@ -592,8 +592,8 @@ HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } break; } - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -609,7 +609,7 @@ HB_EXPR_PTR hb_compExprReduceNE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -627,8 +627,8 @@ HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * .F. >= .T. = .f. */ BOOL bResult = ! ( ! pLeft->value.asLogical && pRight->value.asLogical ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -656,8 +656,8 @@ HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } break; } - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -673,7 +673,7 @@ HB_EXPR_PTR hb_compExprReduceGE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -691,8 +691,8 @@ HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * .F. <= .T. = .T. */ BOOL bResult = ! ( pLeft->value.asLogical && ! pRight->value.asLogical ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -720,8 +720,8 @@ HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } break; } - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -737,7 +737,7 @@ HB_EXPR_PTR hb_compExprReduceLE( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -755,8 +755,8 @@ HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * .F. > .T. = .F. */ BOOL bResult = ( pLeft->value.asLogical && ! pRight->value.asLogical ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -784,8 +784,8 @@ HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } break; } - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -801,7 +801,7 @@ HB_EXPR_PTR hb_compExprReduceGT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -819,8 +819,8 @@ HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * .T. < .F. = .F. */ BOOL bResult = ( ! pLeft->value.asLogical && pRight->value.asLogical ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -848,8 +848,8 @@ HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } break; } - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -867,7 +867,7 @@ HB_EXPR_PTR hb_compExprReduceLT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -881,8 +881,8 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) case HB_ET_LOGICAL: { BOOL bResult = ( pLeft->value.asLogical == pRight->value.asLogical ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -895,8 +895,8 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) if( pLeft->ulLength == pRight->ulLength ) bResult = ( strcmp( pLeft->value.asString.string, pRight->value.asString.string ) == 0 ); - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -924,8 +924,8 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) } break; } - hb_compExprFree( pSelf->value.asOperator.pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asOperator.pRight, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pLeft, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asOperator.pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; @@ -941,7 +941,7 @@ HB_EXPR_PTR hb_compExprReduceEQ( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -953,51 +953,53 @@ HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) BOOL bResult; bResult = pLeft->value.asLogical && pRight->value.asLogical; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; } - else if( pLeft->ExprType == HB_ET_LOGICAL && hb_comp_bShortCuts ) + else if( pLeft->ExprType == HB_ET_LOGICAL && + HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) { if( pLeft->value.asLogical ) { /* .T. .AND. expr => expr */ - hb_compExprFree( pLeft, HB_MACRO_PARAM); + hb_compExprFree( pLeft, HB_COMP_PARAM); pSelf->ExprType = HB_ET_NONE; /* don't delete expression components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); pSelf = pRight; } else { /* .F. .AND. expr => .F. */ - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); /* discard expression */ + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); /* discard expression */ pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = FALSE; } } - else if( pRight->ExprType == HB_ET_LOGICAL && hb_comp_bShortCuts ) + else if( pRight->ExprType == HB_ET_LOGICAL && + HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) { if( pRight->value.asLogical ) { /* expr .AND. .T. => expr */ - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_NONE; /* don't delete expression components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); pSelf = pLeft; } else { /* expr .AND. .F. => .F. */ - hb_compExprFree( pLeft, HB_MACRO_PARAM ); /* discard expression */ - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); /* discard expression */ + hb_compExprFree( pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = FALSE; @@ -1006,7 +1008,7 @@ HB_EXPR_PTR hb_compExprReduceAnd( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return pSelf; } -HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pLeft, pRight; @@ -1018,20 +1020,21 @@ HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) BOOL bResult; bResult = pLeft->value.asLogical || pRight->value.asLogical; - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = bResult; } - else if( pLeft->ExprType == HB_ET_LOGICAL && hb_comp_bShortCuts ) + else if( pLeft->ExprType == HB_ET_LOGICAL && + HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) { if( pLeft->value.asLogical ) { /* .T. .OR. expr => .T. */ - hb_compExprFree( pLeft, HB_MACRO_PARAM ); - hb_compExprFree( pRight, HB_MACRO_PARAM ); /* discard expression */ + hb_compExprFree( pLeft, HB_COMP_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); /* discard expression */ pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = TRUE; @@ -1040,20 +1043,21 @@ HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { /* .F. .OR. expr => expr */ - hb_compExprFree( pLeft, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_NONE; /* don't delete expression components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); pSelf = pRight; } } - else if( pRight->ExprType == HB_ET_LOGICAL && hb_comp_bShortCuts ) + else if( pRight->ExprType == HB_ET_LOGICAL && + HB_COMP_ISSUPPORTED( HB_COMPFLAG_SHORTCUTS ) ) { if( pRight->value.asLogical ) { /* expr .OR. .T. => .T. */ - hb_compExprFree( pLeft, HB_MACRO_PARAM ); /* discard expression */ - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pLeft, HB_COMP_PARAM ); /* discard expression */ + hb_compExprFree( pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_LOGICAL; pSelf->ValType = HB_EV_LOGICAL; pSelf->value.asLogical = TRUE; @@ -1062,16 +1066,16 @@ HB_EXPR_PTR hb_compExprReduceOr( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { /* expr .OR. .F. => expr */ - hb_compExprFree( pRight, HB_MACRO_PARAM ); + hb_compExprFree( pRight, HB_COMP_PARAM ); pSelf->ExprType = HB_ET_NONE; /* don't delete expression components */ - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); pSelf = pLeft; } } return pSelf; } -HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pExpr; @@ -1087,18 +1091,18 @@ HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pExpr = pExpr->pNext; /* skip to TRUE expression */ /* delete condition - it is no longer needed */ - hb_compExprFree( pSelf->value.asList.pExprList, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asList.pExprList, HB_COMP_PARAM ); /* assign NULL to a start of expressions list to suppress * deletion of expression's components - we are deleting them * here */ pSelf->value.asList.pExprList = NULL; - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); /* store the TRUE expression as a result of reduction */ pSelf = pExpr; pExpr = pExpr->pNext; /* skip to FALSE expression */ - hb_compExprFree( pExpr, HB_MACRO_PARAM ); /* delete FALSE expr */ + hb_compExprFree( pExpr, HB_COMP_PARAM ); /* delete FALSE expr */ pSelf->pNext = NULL; } else @@ -1108,17 +1112,17 @@ HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pExpr = pExpr->pNext; /* skip to TRUE expression */ /* delete condition - it is no longer needed */ - hb_compExprFree( pSelf->value.asList.pExprList, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asList.pExprList, HB_COMP_PARAM ); /* assign NULL to a start of expressions list to suppress * deletion of expression's components - we are deleting them * here */ pSelf->value.asList.pExprList = NULL; - hb_compExprFree( pSelf, HB_MACRO_PARAM ); + hb_compExprFree( pSelf, HB_COMP_PARAM ); /* store the FALSE expression as a result of reduction */ pSelf = pExpr->pNext; - hb_compExprFree( pExpr, HB_MACRO_PARAM ); /* delete TRUE expr */ + hb_compExprFree( pExpr, HB_COMP_PARAM ); /* delete TRUE expr */ pSelf->pNext = NULL; } } @@ -1132,7 +1136,7 @@ HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) ( pExpr->ExprType == HB_ET_SELF ) || ( pExpr->ExprType == HB_ET_ARRAY ) ) { - hb_compExprErrorType( pExpr, HB_MACRO_PARAM ); + hb_compExprErrorType( pExpr, HB_COMP_PARAM ); } return pSelf; } @@ -1141,7 +1145,7 @@ HB_EXPR_PTR hb_compExprReduceIIF( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) * - strips parenthesis * ( EXPR ) -> EXPR */ -HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { if( pSelf->ExprType == HB_ET_LIST ) { @@ -1156,13 +1160,13 @@ HB_EXPR_PTR hb_compExprListStrip( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pSelf = pSelf->value.asList.pExprList; pExpr->value.asList.pExprList = NULL; - hb_compExprFree( pExpr, HB_MACRO_PARAM ); + hb_compExprFree( pExpr, HB_COMP_PARAM ); } } return pSelf; } -BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pSub = pParms->value.asList.pExprList; @@ -1173,15 +1177,17 @@ BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) { if( pSub->value.asString.string[0] == '\0' ) { - pReduced = hb_compExprNewLong( 1 ); + pReduced = hb_compExprNewLong( 1, HB_COMP_PARAM ); } else { - pReduced = hb_compExprNewLong( hb_strAt( pSub->value.asString.string, pSub->ulLength, pText->value.asString.string, pText->ulLength ) ); + pReduced = hb_compExprNewLong( hb_strAt( pSub->value.asString.string, + pSub->ulLength, pText->value.asString.string, + pText->ulLength ), HB_COMP_PARAM ); } - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pParms, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pParms, HB_COMP_PARAM ); memcpy( pSelf, pReduced, sizeof( HB_EXPR ) ); hb_compExprClear( pReduced ); @@ -1191,7 +1197,7 @@ BOOL hb_compExprReduceAT( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return FALSE; } -BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pArg = pParms->value.asList.pExprList; @@ -1204,7 +1210,7 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) can be divided by 256 but it's not zero, in this case it will return an empty string instead of a Chr(0). [vszakats] */ - HB_EXPR_PTR pExpr = hb_compExprNew( HB_ET_STRING ); + HB_EXPR_PTR pExpr = hb_compExprNew( HB_ET_STRING, HB_COMP_PARAM ); pExpr->ValType = HB_EV_STRING; if( pArg->value.asNum.NumType == HB_ET_LONG ) @@ -1236,8 +1242,8 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) pExpr->ulLength = 1; } - hb_compExprFree( pParms, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + hb_compExprFree( pParms, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM ); memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; @@ -1246,17 +1252,17 @@ BOOL hb_compExprReduceCHR( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return FALSE; } -BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pArg = pParms->value.asList.pExprList; if( pArg->ExprType == HB_ET_STRING || pArg->ExprType == HB_ET_ARRAY ) { - HB_EXPR_PTR pExpr = hb_compExprNewLong( pArg->ulLength ); + HB_EXPR_PTR pExpr = hb_compExprNewLong( pArg->ulLength, HB_COMP_PARAM ); - hb_compExprFree( pParms, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + hb_compExprFree( pParms, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM ); memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; @@ -1264,17 +1270,18 @@ BOOL hb_compExprReduceLEN( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return FALSE; } -BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) +BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_COMP_DECL ) { HB_EXPR_PTR pParms = pSelf->value.asFunCall.pParms; HB_EXPR_PTR pArg = pParms->value.asList.pExprList; if( pArg->ExprType == HB_ET_STRING ) { - HB_EXPR_PTR pExpr = hb_compExprNewLong( (BYTE)pArg->value.asString.string[0] ); + HB_EXPR_PTR pExpr = hb_compExprNewLong( + ( UCHAR ) pArg->value.asString.string[0], HB_COMP_PARAM ); - hb_compExprFree( pParms, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + hb_compExprFree( pParms, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM ); memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; @@ -1282,7 +1289,7 @@ BOOL hb_compExprReduceASC( HB_EXPR_PTR pSelf, HB_MACRO_DECL ) return FALSE; } -BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_MACRO_DECL ) +BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_COMP_DECL ) { if( usCount == 1 ) { @@ -1291,10 +1298,12 @@ BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_MACRO_DECL ) if( pArg->ExprType == HB_ET_STRING && ( pArg->ulLength == 8 || pArg->ulLength == 0 ) ) { - HB_EXPR_PTR pExpr = hb_compExprNewDate( pArg->ulLength == 0 ? 0 : hb_dateEncStr( pArg->value.asString.string ) ); - - hb_compExprFree( pParms, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + HB_EXPR_PTR pExpr = hb_compExprNewDate( pArg->ulLength == 0 ? 0 : + hb_dateEncStr( pArg->value.asString.string ), + HB_COMP_PARAM ); + + hb_compExprFree( pParms, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM ); memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; @@ -1302,10 +1311,10 @@ BOOL hb_compExprReduceSTOD( HB_EXPR_PTR pSelf, USHORT usCount, HB_MACRO_DECL ) } else { - HB_EXPR_PTR pExpr = hb_compExprNewDate( 0 ); + HB_EXPR_PTR pExpr = hb_compExprNewDate( 0, HB_COMP_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pParms, HB_MACRO_PARAM ); - hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_MACRO_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pParms, HB_COMP_PARAM ); + hb_compExprFree( pSelf->value.asFunCall.pFunName, HB_COMP_PARAM ); memcpy( pSelf, pExpr, sizeof( HB_EXPR ) ); hb_compExprClear( pExpr ); return TRUE; diff --git a/harbour/source/compiler/Makefile b/harbour/source/compiler/Makefile index fc4c8c72b6..2b6d9b2a50 100644 --- a/harbour/source/compiler/Makefile +++ b/harbour/source/compiler/Makefile @@ -10,6 +10,7 @@ YACC_SOURCE=harbour.sly else +YACC_FLAGS = -p hb_comp YACC_SOURCE=harbour.y endif @@ -54,7 +55,6 @@ C_SOURCES=\ hbdead.c \ hblbl.c \ hbstripl.c \ - hbstrong.c \ hbusage.c \ hbident.c \ ppcomp.c \ diff --git a/harbour/source/compiler/cmdcheck.c b/harbour/source/compiler/cmdcheck.c index baee064de0..2c7a570e5f 100644 --- a/harbour/source/compiler/cmdcheck.c +++ b/harbour/source/compiler/cmdcheck.c @@ -102,7 +102,7 @@ static ULONG PackDateTime( void ) return HB_MKLONG( szString[3], szString[2], szString[1], szString[0] ); } -void hb_compChkCompilerSwitch( int iArg, char *Args[] ) +void hb_compChkCompilerSwitch( HB_COMP_DECL, int iArg, char *Args[] ) { /* If iArg is passed check the command line options */ if( iArg ) @@ -133,7 +133,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[2] = '-'; Switch[3] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j += 2; continue; @@ -155,7 +155,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[5] = 'D'; Switch[6] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j += 5; continue; @@ -163,7 +163,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) else if( !Args[i][j + 1] ) { Switch[2] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j += 1; continue; } @@ -195,20 +195,20 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) } } - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); continue; } else { Switch[2] = '\0'; - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, ( char * ) Switch, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, ( char * ) Switch, NULL ); } case 'd': case 'D': Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as part of #define and continue with next Args[]. */ j = strlen( Args[i] ); @@ -222,7 +222,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[3] = Args[i][j + 2]; Switch[4] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j += 3; continue; @@ -230,7 +230,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) else { Switch[2] = '\0'; - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, ( char * ) Switch, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, ( char * ) Switch, NULL ); } break; @@ -254,16 +254,16 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[3] = '\0'; j += 2; } - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); continue; } else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, ( char * ) Switch, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, ( char * ) Switch, NULL ); case 'i': case 'I': Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as IncludePath and continue with next Args[]. */ j = strlen( Args[i] ); @@ -272,7 +272,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) case 'k': case 'K': Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as part of #define and continue with next Args[]. */ j = strlen( Args[i] ); @@ -294,13 +294,13 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[2] = '\0'; j += 1; } - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); continue; case 'o': case 'O': Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as OutputPath and continue with next Args[]. */ j = strlen( Args[i] ); @@ -311,7 +311,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) if( Args[i][j + 1] ) { Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as PPOPath and continue with next Args[]. */ j += strlen( Args[i] ) - 1; @@ -319,7 +319,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) else { Switch[2] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j++; } continue; @@ -331,7 +331,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[2] = Args[i][j + 1]; Switch[3] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j += 2; continue; @@ -339,21 +339,21 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) else { Switch[2] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); } break; case 'r': case 'R': - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); j = strlen( Args[i] ) - 1; break; case 'u': case 'U': Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as part of .CH Path or "undef:" and continue with next Args[]. */ j = strlen( Args[i] ); @@ -366,7 +366,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Switch[2] = Args[i][j + 1]; Switch[3] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); j += 2; continue; @@ -374,7 +374,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) else { Switch[2] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); } break; @@ -382,7 +382,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) case 'x': case 'X': Args[i] += ( j - 1 ); - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); /* Accept rest as INIT Symbol and continue with next Args[]. */ j = strlen( Args[i] ); @@ -390,7 +390,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) default: Switch[2] = '\0'; - hb_compChkEnvironVar( ( char * ) Switch ); + hb_compChkEnvironVar( HB_COMP_PARAM, ( char * ) Switch ); } } @@ -413,7 +413,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) Args[i][j] = 0; - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); Args[i] += j; Args[i][0] = cSep; @@ -422,7 +422,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) } else { - hb_compChkEnvironVar( Args[i] ); + hb_compChkEnvironVar( HB_COMP_PARAM, Args[i] ); } } } @@ -452,7 +452,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) */ while( szSwitch != NULL ) { - hb_compChkEnvironVar( szSwitch ); + hb_compChkEnvironVar( HB_COMP_PARAM, szSwitch ); szSwitch = strtok( NULL, " " ); } } @@ -462,7 +462,7 @@ void hb_compChkCompilerSwitch( int iArg, char *Args[] ) } } -void hb_compChkEnvironVar( char *szSwitch ) +void hb_compChkEnvironVar( HB_COMP_DECL, char *szSwitch ) { if( szSwitch ) { @@ -477,7 +477,7 @@ void hb_compChkEnvironVar( char *szSwitch ) */ if( !HB_ISOPTSEP( *s ) ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); else { s++; @@ -486,9 +486,9 @@ void hb_compChkEnvironVar( char *szSwitch ) case 'a': case 'A': if( *( s + 1 ) == '-' ) - hb_comp_bAutoMemvarAssume = FALSE; + HB_COMP_PARAM->fAutoMemvarAssume = FALSE; else - hb_comp_bAutoMemvarAssume = TRUE; + HB_COMP_PARAM->fAutoMemvarAssume = TRUE; break; case 'b': @@ -502,15 +502,15 @@ void hb_compChkEnvironVar( char *szSwitch ) szOption[i] = '\0'; if( strcmp( szOption, "BUILD" ) == 0 ) - hb_comp_bBuildInfo = TRUE; + HB_COMP_PARAM->fBuildInfo = TRUE; else { if( *( s + 1 ) == '-' ) - hb_comp_bDebugInfo = FALSE; + HB_COMP_PARAM->fDebugInfo = FALSE; else { - hb_comp_bDebugInfo = TRUE; - hb_comp_bLineNumbers = TRUE; + HB_COMP_PARAM->fDebugInfo = TRUE; + HB_COMP_PARAM->fLineNumbers = TRUE; } } @@ -530,9 +530,9 @@ void hb_compChkEnvironVar( char *szSwitch ) if( strcmp( szOption, "CREDITS" ) == 0 || strcmp( szOption, "CREDIT" ) == 0 || strcmp( szOption, "CREDI" ) == 0 || strcmp( szOption, "CRED" ) == 0 ) - hb_comp_bCredits = TRUE; + HB_COMP_PARAM->fCredits = TRUE; else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, szOption, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, szOption, NULL ); hb_xfree( szOption ); } @@ -551,23 +551,23 @@ void hb_compChkEnvironVar( char *szSwitch ) { case '\0': case '0': - hb_comp_iExitLevel = HB_EXITLEVEL_DEFAULT; + HB_COMP_PARAM->iExitLevel = HB_EXITLEVEL_DEFAULT; break; case '1': - hb_comp_iExitLevel = HB_EXITLEVEL_SETEXIT; + HB_COMP_PARAM->iExitLevel = HB_EXITLEVEL_SETEXIT; break; case '2': - hb_comp_iExitLevel = HB_EXITLEVEL_DELTARGET; + HB_COMP_PARAM->iExitLevel = HB_EXITLEVEL_DELTARGET; break; default: - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); } } else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); break; @@ -577,55 +577,55 @@ void hb_compChkEnvironVar( char *szSwitch ) { case 'c': case 'C': - hb_comp_iLanguage = LANG_C; + HB_COMP_PARAM->iLanguage = LANG_C; switch( *( s + 2 ) ) { case '3': - hb_comp_iGenCOutput = HB_COMPGENC_REALCODE; + HB_COMP_PARAM->iGenCOutput = HB_COMPGENC_REALCODE; break; case '\0': case '2': - hb_comp_iGenCOutput = HB_COMPGENC_VERBOSE; + HB_COMP_PARAM->iGenCOutput = HB_COMPGENC_VERBOSE; break; case '1': - hb_comp_iGenCOutput = HB_COMPGENC_NORMAL; + HB_COMP_PARAM->iGenCOutput = HB_COMPGENC_NORMAL; break; case '0': - hb_comp_iGenCOutput = HB_COMPGENC_COMPACT; + HB_COMP_PARAM->iGenCOutput = HB_COMPGENC_COMPACT; break; default: - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); } break; case 'j': case 'J': - hb_comp_iLanguage = LANG_JAVA; + HB_COMP_PARAM->iLanguage = LANG_JAVA; break; case 'h': case 'H': - hb_comp_iLanguage = LANG_PORT_OBJ; + HB_COMP_PARAM->iLanguage = LANG_PORT_OBJ; break; case 'i': case 'I': - hb_comp_iLanguage = LANG_CLI; + HB_COMP_PARAM->iLanguage = LANG_CLI; break; case 'o': case 'O': - hb_comp_iLanguage = LANG_OBJ_MODULE; + HB_COMP_PARAM->iLanguage = LANG_OBJ_MODULE; break; case 'w': case 'W': - hb_comp_iLanguage = LANG_OBJ32; + HB_COMP_PARAM->iLanguage = LANG_OBJ32; break; default: @@ -648,7 +648,7 @@ void hb_compChkEnvironVar( char *szSwitch ) */ case 'i': case 'I': - hb_pp_addSearchPath( hb_comp_data->pLex->pPP, s + 1, FALSE ); + hb_pp_addSearchPath( HB_COMP_PARAM->pLex->pPP, s + 1, FALSE ); break; case 'k': @@ -663,46 +663,47 @@ void hb_compChkEnvironVar( char *szSwitch ) case '?': hb_compPrintLogo( ); hb_compPrintModes( ); - hb_comp_bLogo = FALSE; - hb_comp_bQuiet = TRUE; + HB_COMP_PARAM->fLogo = FALSE; + HB_COMP_PARAM->fQuiet = TRUE; break; case 'h': /* default Harbour mode */ - hb_comp_Supported |= HB_COMPFLAG_HARBOUR; + HB_COMP_PARAM->supported |= HB_COMPFLAG_HARBOUR; break; case 'c': /* clear all flags - minimal set of features */ - hb_comp_Supported = HB_COMPFLAG_OPTJUMP; + HB_COMP_PARAM->supported &= HB_COMPFLAG_SHORTCUTS; + HB_COMP_PARAM->supported |= HB_COMPFLAG_OPTJUMP; break; case 'x': - hb_comp_Supported |= HB_COMPFLAG_XBASE; + HB_COMP_PARAM->supported |= HB_COMPFLAG_XBASE; break; case 'i': - hb_comp_Supported |= HB_COMPFLAG_HB_INLINE; + HB_COMP_PARAM->supported |= HB_COMPFLAG_HB_INLINE; break; case 'I': - hb_comp_Supported |= HB_COMPFLAG_HB_INLINE_PP; + HB_COMP_PARAM->supported |= HB_COMPFLAG_HB_INLINE_PP; break; case 'J': - hb_comp_Supported &= ~HB_COMPFLAG_OPTJUMP; + HB_COMP_PARAM->supported &= ~HB_COMPFLAG_OPTJUMP; break; case 'r': - hb_comp_Supported |= HB_COMPFLAG_RT_MACRO; + HB_COMP_PARAM->supported |= HB_COMPFLAG_RT_MACRO; break; case 's': - hb_comp_Supported |= HB_COMPFLAG_ARRSTR; + HB_COMP_PARAM->supported |= HB_COMPFLAG_ARRSTR; break; default: - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); break; } } @@ -712,17 +713,17 @@ void hb_compChkEnvironVar( char *szSwitch ) case 'l': case 'L': if( *( s + 1 ) == '-' ) - hb_comp_bLineNumbers = TRUE; + HB_COMP_PARAM->fLineNumbers = TRUE; else - hb_comp_bLineNumbers = FALSE; + HB_COMP_PARAM->fLineNumbers = FALSE; break; case 'm': case 'M': if( *( s + 1 ) == '-' ) - hb_comp_bAutoOpen = TRUE; + HB_COMP_PARAM->fAutoOpen = TRUE; else - hb_comp_bAutoOpen = FALSE; + HB_COMP_PARAM->fAutoOpen = FALSE; break; case 'n': @@ -732,24 +733,24 @@ void hb_compChkEnvironVar( char *szSwitch ) */ if( *( s + 1 ) == '1' ) { - hb_comp_bStartProc = FALSE; - hb_comp_bNoStartUp = TRUE; + HB_COMP_PARAM->fStartProc = FALSE; + HB_COMP_PARAM->fNoStartUp = TRUE; } /* -n or -n0 no implicit start up procedure */ else if( ( *( s + 1 ) == '0' ) || ( *( s + 1 ) == '\0' ) ) - hb_comp_bStartProc = FALSE; + HB_COMP_PARAM->fStartProc = FALSE; /* -n- ceates implicit start up procedure */ else if( *( s + 1 ) == '-' ) - hb_comp_bStartProc = TRUE; + HB_COMP_PARAM->fStartProc = TRUE; /* invalid command */ else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); break; case 'o': @@ -757,7 +758,7 @@ void hb_compChkEnvironVar( char *szSwitch ) { char *szPath = hb_strdup( s + 1 ); - hb_comp_pOutPath = hb_fsFNameSplit( szPath ); + HB_COMP_PARAM->pOutPath = hb_fsFNameSplit( szPath ); hb_xfree( szPath ); } break; @@ -766,25 +767,25 @@ void hb_compChkEnvironVar( char *szSwitch ) case 'p': case 'P': if( *( s + 1 ) == '-' ) - hb_comp_bPPO = 0; - else if( ! hb_comp_bPPO ) + HB_COMP_PARAM->fPPO = 0; + else if( ! HB_COMP_PARAM->fPPO ) { /* do not set a path if option specified more then once */ char *szPath = hb_strdup( s + 1 ); - hb_comp_pPpoPath = hb_fsFNameSplit( szPath ); + HB_COMP_PARAM->pPpoPath = hb_fsFNameSplit( szPath ); hb_xfree( szPath ); - hb_comp_bPPO = 1; + HB_COMP_PARAM->fPPO = 1; } break; case 'q': case 'Q': if( *( s + 1 ) == '0' ) - hb_comp_bLogo = FALSE; + HB_COMP_PARAM->fLogo = FALSE; - hb_comp_bQuiet = TRUE; + HB_COMP_PARAM->fQuiet = TRUE; break; case 'r': @@ -792,10 +793,10 @@ void hb_compChkEnvironVar( char *szSwitch ) if( *( s + 1 ) == '=' ) { int iOverflow; - int iCycles = hb_strValInt( s + 2, &iOverflow ); + int iCycles = ( int ) hb_strValInt( s + 2, &iOverflow ); if( !iOverflow && iCycles > 0 ) - hb_pp_MaxTranslateCycles = ( unsigned int ) iCycles; + HB_COMP_PARAM->iMaxTransCycles = iCycles; } else { @@ -807,9 +808,9 @@ void hb_compChkEnvironVar( char *szSwitch ) case 's': case 'S': if( *( s + 1 ) == '-' ) - hb_comp_bSyntaxCheckOnly = FALSE; + HB_COMP_PARAM->fSyntaxCheckOnly = FALSE; else - hb_comp_bSyntaxCheckOnly = TRUE; + HB_COMP_PARAM->fSyntaxCheckOnly = TRUE; break; case 't': @@ -826,25 +827,25 @@ void hb_compChkEnvironVar( char *szSwitch ) /* NOTE: Ignore these -undef: switches will be processed separately */ break; } - hb_pp_STD_CH = hb_strdup( s + 1 ); + HB_COMP_PARAM->szStdCh = hb_strdup( s + 1 ); break; case 'v': case 'V': if( *( s + 1 ) == '-' ) - hb_comp_bForceMemvars = FALSE; + HB_COMP_PARAM->fForceMemvars = FALSE; else - hb_comp_bForceMemvars = TRUE; + HB_COMP_PARAM->fForceMemvars = TRUE; break; case 'w': case 'W': - hb_comp_iWarnings = 1; + HB_COMP_PARAM->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 > 4 ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + HB_COMP_PARAM->iWarnings = s[1] - '0'; + if( HB_COMP_PARAM->iWarnings < 0 || HB_COMP_PARAM->iWarnings > 4 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); } break; @@ -859,15 +860,14 @@ void hb_compChkEnvironVar( char *szSwitch ) szPrefix[i] = '\0'; if( strlen( szPrefix ) == 0 ) - sprintf( szPrefix, "%08lX_", PackDateTime( ) ); - - strncpy( hb_comp_szPrefix, szPrefix, 16 ); - hb_comp_szPrefix[16] = '\0'; - strcat( hb_comp_szPrefix, "_" ); + sprintf( szPrefix, "%08lX_", PackDateTime() ); + strncpy( HB_COMP_PARAM->szPrefix, szPrefix, 16 ); + HB_COMP_PARAM->szPrefix[ 16 ] = '\0'; + strcat( HB_COMP_PARAM->szPrefix, "_" ); hb_xfree( szPrefix ); - } break; + } #ifdef YYDEBUG case 'y': @@ -879,32 +879,31 @@ void hb_compChkEnvironVar( char *szSwitch ) case 'z': case 'Z': if( *( s + 1 ) == '-' ) - hb_comp_bShortCuts = TRUE; + HB_COMP_PARAM->supported |= HB_COMPFLAG_SHORTCUTS; else - hb_comp_bShortCuts = FALSE; - break; + HB_COMP_PARAM->supported &= ~HB_COMPFLAG_SHORTCUTS; default: - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADOPTION, s, NULL ); break; } } } } -void hb_compChkPaths( void ) +void hb_compChkPaths( HB_COMP_DECL ) { char *szInclude = hb_getenv( "INCLUDE" ); if( szInclude ) { if( szInclude[0] != '\0' ) - hb_pp_addSearchPath( hb_comp_data->pLex->pPP, szInclude, FALSE ); + hb_pp_addSearchPath( HB_COMP_PARAM->pLex->pPP, szInclude, FALSE ); hb_xfree( ( void * ) szInclude ); } } -static void hb_compChkDefineSwitch( char *pszSwitch ) +static void hb_compChkDefineSwitch( HB_COMP_DECL, char *pszSwitch ) { if( pszSwitch && HB_ISOPTSEP( pszSwitch[0] ) ) { @@ -922,7 +921,7 @@ static void hb_compChkDefineSwitch( char *pszSwitch ) pAssign = strchr( szDefText, '=' ); if( pAssign ) *pAssign++ = '\0'; - hb_pp_addDefine( hb_comp_data->pLex->pPP, szDefText, pAssign ); + hb_pp_addDefine( HB_COMP_PARAM->pLex->pPP, szDefText, pAssign ); } hb_xfree( szDefText ); } @@ -943,13 +942,13 @@ static void hb_compChkDefineSwitch( char *pszSwitch ) szDefText[i] = '\0'; if( szDefText[0] ) - hb_pp_delDefine( hb_comp_data->pLex->pPP, szDefText ); + hb_pp_delDefine( HB_COMP_PARAM->pLex->pPP, szDefText ); hb_xfree( szDefText ); } } } -void hb_compChkDefines( int iArg, char *Args[] ) +void hb_compChkDefines( HB_COMP_DECL, int iArg, char *Args[] ) { /* Chech the environment variables */ { @@ -972,7 +971,7 @@ void hb_compChkDefines( int iArg, char *Args[] ) /* Check the environment var while it isn't empty. */ while( szSwitch != NULL ) { - hb_compChkDefineSwitch( szSwitch ); + hb_compChkDefineSwitch( HB_COMP_PARAM, szSwitch ); szSwitch = strtok( NULL, " " ); } } @@ -988,6 +987,6 @@ void hb_compChkDefines( int iArg, char *Args[] ) /* Check all switches in command line They start with an OS_OPT_DELIMITER char */ for( i = 0; i < iArg; i++ ) - hb_compChkDefineSwitch( Args[i] ); + hb_compChkDefineSwitch( HB_COMP_PARAM, Args[i] ); } } diff --git a/harbour/source/compiler/complex.c b/harbour/source/compiler/complex.c index 8cfc778ab7..be229cb6ca 100644 --- a/harbour/source/compiler/complex.c +++ b/harbour/source/compiler/complex.c @@ -253,21 +253,21 @@ static int hb_comp_keywordType( PHB_PP_TOKEN pToken ) return IDENTIFIER; } -static char * hb_comp_tokenIdentifer( PHB_PP_TOKEN pToken ) +static char * hb_comp_tokenIdentifer( HB_COMP_DECL, PHB_PP_TOKEN pToken ) { if( HB_PP_TOKEN_ALLOC( pToken->type ) ) { - pToken->value = hb_compIdentifierNew( pToken->value, FALSE ); + pToken->value = hb_compIdentifierNew( HB_COMP_PARAM, pToken->value, FALSE ); pToken->type |= HB_PP_TOKEN_STATIC; } return pToken->value; } -//int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) -int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) +//int hb_complex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) +int yylex( YYSTYPE *yylval_ptr, HB_COMP_DECL ) { - PHB_COMP_LEX pLex = ( PHB_COMP_LEX ) pComp->pLex; + PHB_COMP_LEX pLex = ( PHB_COMP_LEX ) HB_COMP_PARAM->pLex; PHB_PP_TOKEN pToken = hb_pp_tokenGet( pLex->pPP ); if( !pToken ) @@ -312,7 +312,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) case HB_PP_TOKEN_STRING: pLex->iState = LITERAL; - pLex->lasttok = yylval_ptr->string = hb_comp_tokenIdentifer( pToken ); + pLex->lasttok = yylval_ptr->string = + hb_comp_tokenIdentifer( HB_COMP_PARAM, pToken ); return LITERAL; case HB_PP_TOKEN_LOGICAL: @@ -322,13 +323,15 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) case HB_PP_TOKEN_MACROVAR: pLex->iState = MACROVAR; hb_pp_tokenUpper( pToken ); - pLex->lasttok = yylval_ptr->string = hb_comp_tokenIdentifer( pToken ); + pLex->lasttok = yylval_ptr->string = + hb_comp_tokenIdentifer( HB_COMP_PARAM, pToken ); return MACROVAR; case HB_PP_TOKEN_MACROTEXT: pLex->iState = MACROTEXT; hb_pp_tokenUpper( pToken ); - pLex->lasttok = yylval_ptr->string = hb_comp_tokenIdentifer( pToken ); + pLex->lasttok = yylval_ptr->string = + hb_comp_tokenIdentifer( HB_COMP_PARAM, pToken ); return MACROTEXT; case HB_PP_TOKEN_LEFT_SB: @@ -346,7 +349,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) case WHILE: pLex->iState = LITERAL; hb_pp_tokenToString( pLex->pPP, pToken ); - pLex->lasttok = yylval_ptr->string = hb_comp_tokenIdentifer( pToken ); + pLex->lasttok = yylval_ptr->string = + hb_comp_tokenIdentifer( HB_COMP_PARAM, pToken ); return LITERAL; default: @@ -367,8 +371,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) hb_strdup( hb_pp_tokenBlockString( pLex->pPP, pToken, &iType ) ); yylval_ptr->asCodeblock.length = strlen( yylval_ptr->asCodeblock.string ); - yylval_ptr->asCodeblock.isMacro = iType > 0; - yylval_ptr->asCodeblock.lateEval = iType > 1; + yylval_ptr->asCodeblock.isMacro = iType > 0; + yylval_ptr->asCodeblock.lateEval = iType > 1; hb_pp_tokenGet( pLex->pPP ); return CBSTART; } @@ -509,7 +513,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) int iType; hb_pp_tokenUpper( pToken ); iType = hb_comp_keywordType( pToken ); - pLex->lasttok = yylval_ptr->string = hb_comp_tokenIdentifer( pToken ); + pLex->lasttok = yylval_ptr->string = + hb_comp_tokenIdentifer( HB_COMP_PARAM, pToken ); switch( iType ) { case FUNCTION: @@ -517,8 +522,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) /* Clipper needs PROCEDURE in one context only */ if( !pToken->pNext || HB_PP_TOKEN_TYPE( pToken->pNext->type ) != HB_PP_TOKEN_KEYWORD ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, - pToken->value, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', + HB_COMP_ERR_SYNTAX, pToken->value, NULL ); pLex->iState = iType; return pLex->iState; @@ -563,8 +568,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) pToken->pNext->len >= 4 && pToken->pNext->len <= 8 && hb_strnicmp( "SEQUENCE", pToken->pNext->value, pToken->pNext->len ) == 0 ) { - if( hb_comp_wSeqCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wSeqCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDIF, NULL, NULL ); hb_pp_tokenGet( pLex->pPP ); pLex->iState = END; @@ -584,7 +589,7 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_INC || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_DEC || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_ALIAS ) - hb_compGenError( hb_comp_szErrors, 'E', + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDIF, NULL, NULL ); } iType = IDENTIFIER; @@ -592,38 +597,38 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) case ELSE: /* ELSE can be used in one context only */ - if( hb_comp_wIfCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wIfCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_ELSE, NULL, NULL ); pLex->iState = ELSE; return ELSE; case ELSEIF: /* ELSEIF can be used in one context only */ - if( hb_comp_wIfCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wIfCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_ELSEIF, NULL, NULL ); pLex->iState = ELSEIF; return ELSEIF; case ENDIF: /* ENDIF can be used in one context only */ - if( hb_comp_wIfCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wIfCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDIF, NULL, NULL ); break; case ENDCASE: /* ENDCASE can be used in one context only */ - if( hb_comp_wCaseCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wCaseCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDCASE, NULL, NULL ); break; case ENDDO: /* ENDDO can be used in one context only */ - if( hb_comp_wWhileCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wWhileCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ENDDO, NULL, NULL ); break; @@ -676,8 +681,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) ( HB_PP_TOKEN_ISEOC( pToken->pNext ) || ( iType == CASE && !HB_PP_LEX_NEEDLEFT( pToken->pNext ) ) ) ) { - if( hb_comp_wCaseCounter == 0 && hb_comp_wSwitchCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', + if( HB_COMP_PARAM->wCaseCounter == 0 && HB_COMP_PARAM->wSwitchCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CASE, NULL, NULL ); pLex->iState = iType; return iType; @@ -714,9 +719,9 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) if( HB_PP_TOKEN_ISEOC( pToken->pNext ) || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_KEYWORD ) { - if( hb_comp_wForCounter == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', - HB_COMP_ERR_NEXTFOR, NULL, NULL ); + if( HB_COMP_PARAM->wForCounter == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', + HB_COMP_ERR_NEXTFOR, NULL, NULL ); pLex->iState = iType; return iType; } @@ -727,7 +732,7 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_INC || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_DEC || HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_ALIAS ) - hb_compGenError( hb_comp_szErrors, 'E', + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_NEXTFOR, NULL, NULL ); } iType = IDENTIFIER; @@ -802,7 +807,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) pToken = hb_pp_tokenGet( pLex->pPP ); /* do not upper next token for case sensitive file systems */ /* hb_pp_tokenUpper( pToken ); */ - pLex->lasttok = yylval_ptr->string = hb_comp_tokenIdentifer( pToken ); + pLex->lasttok = yylval_ptr->string = + hb_comp_tokenIdentifer( HB_COMP_PARAM, pToken ); pLex->iState = IDENTIFIER; return DOIDENT; } @@ -854,11 +860,11 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) case IIF: if( pLex->iState == FUNCTION || pLex->iState == PROCEDURE || HB_PP_TOKEN_ISEOC( pToken->pNext ) ) - hb_compGenError( hb_comp_szErrors, 'E', + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, "IIF", NULL ); else if( HB_PP_TOKEN_TYPE( pToken->pNext->type ) != HB_PP_TOKEN_LEFT_PB ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, - pToken->pNext->value, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', + HB_COMP_ERR_SYNTAX, pToken->pNext->value, NULL ); else { pLex->iState = IIF; @@ -870,7 +876,7 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) case IF: if( pLex->iState == FUNCTION || pLex->iState == PROCEDURE || HB_PP_TOKEN_ISEOC( pToken->pNext ) ) - hb_compGenError( hb_comp_szErrors, 'E', + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, "IF", NULL ); else if( HB_PP_TOKEN_TYPE( pToken->pNext->type ) == HB_PP_TOKEN_LEFT_PB ) { @@ -878,8 +884,8 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) return pLex->iState; } else if( HB_PP_LEX_NEEDLEFT( pToken->pNext ) ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX2, - pToken->pNext->value, "IF" ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', + HB_COMP_ERR_SYNTAX2, pToken->pNext->value, "IF" ); else { pLex->iState = IF; @@ -966,7 +972,7 @@ int yylex( YYSTYPE *yylval_ptr, HB_COMP_PTR pComp ) } } -void hb_compParserStop( HB_COMP_PTR pComp ) +void hb_compParserStop( HB_COMP_DECL ) { - HB_SYMBOL_UNUSED( pComp ); + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); } diff --git a/harbour/source/compiler/genc.c b/harbour/source/compiler/genc.c index ce2a107256..537a900c10 100644 --- a/harbour/source/compiler/genc.c +++ b/harbour/source/compiler/genc.c @@ -31,17 +31,15 @@ #include "hbcomp.h" #include "hbdate.h" -extern void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc ); -extern void hb_compGenCString( FILE * yyc, BYTE * pText, USHORT usLen ); - -static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc ); +static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ); static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc ); static void hb_compGenCFunc( FILE *yyc, char *cDecor, char *szName, int iStrip ); -static void hb_writeEndInit( FILE* yyc, char * szModulname, char * szSourceFile ); +static void hb_writeEndInit( HB_COMP_DECL, FILE* yyc, char * szModulname, char * szSourceFile ); /* helper structure to pass information */ typedef struct HB_stru_genc_info { + HB_COMP_DECL; FILE * yyc; BOOL bVerbose; USHORT iNestedCodeblock; @@ -51,14 +49,14 @@ typedef struct HB_stru_genc_info typedef HB_GENC_FUNC( HB_GENC_FUNC_ ); typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR; -void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language output */ +void hb_compGenCCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the C language output */ { char szFileName[ _POSIX_PATH_MAX + 1 ]; char szModulname[ _POSIX_PATH_MAX + 1 ]; - PFUNCTION pFunc = hb_comp_functions.pFirst; - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; FILE * yyc; /* file handle for C output */ - PINLINE pInline = hb_comp_inlines.pFirst; + PINLINE pInline = HB_COMP_PARAM->inlines.pFirst; BOOL bIsInlineFunction = FALSE; BOOL bIsInitStatics; BOOL bIsInitFunction; @@ -73,11 +71,11 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou yyc = fopen( szFileName, "wb" ); if( ! yyc ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); return; } - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { printf( "Generating C source output to \'%s\'... ", szFileName ); fflush( stdout ); @@ -89,31 +87,31 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou fprintf( yyc, "/*\n * %s\n", szHrb ); fprintf( yyc, " * %s\n", szCmp ); - fprintf( yyc, " * Generated C source from \"%s\"\n */\n", hb_comp_szFile ); + fprintf( yyc, " * Generated C source from \"%s\"\n */\n", HB_COMP_PARAM->szFile ); hb_xfree( szCmp ); hb_xfree( szHrb ); } - if( hb_comp_iFunctionCnt ) + if( HB_COMP_PARAM->iFunctionCnt ) { fprintf( yyc, "#include \"hbvmpub.h\"\n" ); - if( hb_comp_iGenCOutput != HB_COMPGENC_COMPACT ) + if( HB_COMP_PARAM->iGenCOutput != HB_COMPGENC_COMPACT ) fprintf( yyc, "#include \"hbpcode.h\"\n" ); fprintf( yyc, "#include \"hbinit.h\"\n" ); - if( hb_comp_iGenCOutput == HB_COMPGENC_REALCODE ) + if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_REALCODE ) fprintf( yyc, "#include \"hbxvm.h\"\n" ); fprintf( yyc, "\n\n" ); - if( ! hb_comp_bStartProc ) + if( ! HB_COMP_PARAM->fStartProc ) pFunc = pFunc->pNext; /* No implicit starting procedure */ /* write functions prototypes for PRG defined functions */ while( pFunc ) { - bIsInitStatics = ( pFunc == hb_comp_pInitFunc ); + bIsInitStatics = ( pFunc == HB_COMP_PARAM->pInitFunc ); bIsInitFunction = ( pFunc->cScope & HB_FS_INIT ) != 0; bIsExitFunction = ( pFunc->cScope & HB_FS_EXIT ) != 0; bIsStaticFunction = ( pFunc->cScope & HB_FS_STATIC ) != 0; @@ -148,11 +146,11 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou } /* write functions prototypes for called functions outside this PRG */ - pFunc = hb_comp_funcalls.pFirst; + pFunc = HB_COMP_PARAM->funcalls.pFirst; while( pFunc ) { - if( hb_compFunctionFind( pFunc->szName ) == NULL && - hb_compInlineFind( pFunc->szName ) == NULL ) + if( hb_compFunctionFind( HB_COMP_PARAM, pFunc->szName ) == NULL && + hb_compInlineFind( HB_COMP_PARAM, pFunc->szName ) == NULL ) fprintf( yyc, "HB_FUNC_EXTERN( %s );\n", pFunc->szName ); pFunc = pFunc->pNext; @@ -179,7 +177,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou } } } - fprintf( yyc, "\n\nHB_INIT_SYMBOLS_BEGIN( hb_vm_SymbolInit_%s%s )\n", hb_comp_szPrefix, szModulname ); + fprintf( yyc, "\n\nHB_INIT_SYMBOLS_BEGIN( hb_vm_SymbolInit_%s%s )\n", HB_COMP_PARAM->szPrefix, szModulname ); while( pSym ) { @@ -213,12 +211,12 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou if( pSym->cScope & HB_FS_MESSAGE ) fprintf( yyc, " | HB_FS_MESSAGE" ); - if( ( pSym->cScope & HB_FS_FIRST ) && ( ! hb_comp_bNoStartUp ) ) + if( ( pSym->cScope & HB_FS_FIRST ) && ( ! HB_COMP_PARAM->fNoStartUp ) ) fprintf( yyc, " | HB_FS_FIRST" ); /* specify the function address if it is a defined function or an external called function */ - if( pSym->bFunc && hb_compFunctionFind( pSym->szName ) ) /* is it a function defined in this module */ + if( pSym->bFunc && hb_compFunctionFind( HB_COMP_PARAM, pSym->szName ) ) /* is it a function defined in this module */ { fprintf( yyc, " | HB_FS_LOCAL" ); @@ -229,30 +227,30 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou else fprintf( yyc, "}, {HB_FUNCNAME( %s )}, NULL }", pSym->szName ); } - else if( pSym->bFunc && hb_compFunCallFind( pSym->szName ) ) /* is it a function called from this module */ + else if( pSym->bFunc && hb_compFunCallFind( HB_COMP_PARAM, pSym->szName ) ) /* is it a function called from this module */ fprintf( yyc, "}, {HB_FUNCNAME( %s )}, NULL }", pSym->szName ); else fprintf( yyc, "}, {NULL}, NULL }" ); /* memvar */ } - if( pSym != hb_comp_symbols.pLast ) + if( pSym != HB_COMP_PARAM->symbols.pLast ) fprintf( yyc, ",\n" ); pSym = pSym->pNext; } - hb_writeEndInit( yyc, szModulname, hb_comp_szFile ); + hb_writeEndInit( HB_COMP_PARAM, yyc, szModulname, HB_COMP_PARAM->szFile ); /* Generate functions data */ - pFunc = hb_comp_functions.pFirst; + pFunc = HB_COMP_PARAM->functions.pFirst; - if( ! hb_comp_bStartProc ) + if( ! HB_COMP_PARAM->fStartProc ) pFunc = pFunc->pNext; /* No implicit starting procedure */ while( pFunc ) { - bIsInitStatics = ( pFunc == hb_comp_pInitFunc ); + bIsInitStatics = ( pFunc == HB_COMP_PARAM->pInitFunc ); bIsInitFunction = ( pFunc->cScope & HB_FS_INIT ) != 0; bIsExitFunction = ( pFunc->cScope & HB_FS_EXIT ) != 0; bIsStaticFunction = ( pFunc->cScope & HB_FS_STATIC ) != 0; @@ -273,16 +271,16 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou fprintf( yyc, "HB_FUNC( %s )", pFunc->szName ); fprintf( yyc, "\n" ); - if( hb_comp_iGenCOutput == HB_COMPGENC_REALCODE ) + if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_REALCODE ) { - hb_compGenCRealCode( pFunc, yyc ); + hb_compGenCRealCode( HB_COMP_PARAM, pFunc, yyc ); } else { - if( hb_comp_iGenCOutput == HB_COMPGENC_COMPACT ) + if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_COMPACT ) hb_compGenCCompact( pFunc, yyc ); else - hb_compGenCReadable( pFunc, yyc ); + hb_compGenCReadable( HB_COMP_PARAM, pFunc, yyc ); } fprintf( yyc, "\n" ); pFunc = pFunc->pNext; @@ -301,7 +299,7 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou fprintf( yyc, "#include \"hboo.ch\"\n" ); } - pInline = hb_comp_inlines.pFirst; + pInline = HB_COMP_PARAM->inlines.pFirst; while( pInline ) { if( pInline->pCode ) @@ -324,19 +322,19 @@ void hb_compGenCCode( PHB_FNAME pFileName ) /* generates the C language ou fclose( yyc ); - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) printf( "Done.\n" ); } -static void hb_writeEndInit( FILE* yyc, char * szModulname, char * szSourceFile ) +static void hb_writeEndInit( HB_COMP_DECL, FILE* yyc, char * szModulname, char * szSourceFile ) { /* HB_SYMBOL_UNUSED( szSourceFile ); fprintf( yyc, "\nHB_INIT_SYMBOLS_END( hb_vm_SymbolInit_%s%s )\n\n", - hb_comp_szPrefix, szModulname ); + HB_COMP_PARAM->szPrefix, szModulname ); */ fprintf( yyc, "\nHB_INIT_SYMBOLS_EX_END( hb_vm_SymbolInit_%s%s, ", - hb_comp_szPrefix, szModulname ); + HB_COMP_PARAM->szPrefix, szModulname ); hb_compGenCString( yyc, ( BYTE * ) szSourceFile, strlen( szSourceFile ) ); fprintf( yyc, ", 0x%lx, 0x%04x )\n\n", 0L, HB_PCODE_VER ); @@ -354,9 +352,9 @@ static void hb_writeEndInit( FILE* yyc, char * szModulname, char * szSourceFile " static HB_$INITSYM hb_vm_auto_SymbolInit_%s%s = hb_vm_SymbolInit_%s%s;\n" " #pragma data_seg()\n" "#endif\n\n", - hb_comp_szPrefix, szModulname, - hb_comp_szPrefix, szModulname, - hb_comp_szPrefix, szModulname ); + HB_COMP_PARAM->szPrefix, szModulname, + HB_COMP_PARAM->szPrefix, szModulname, + HB_COMP_PARAM->szPrefix, szModulname ); } @@ -933,7 +931,7 @@ static HB_GENC_FUNC( hb_p_message ) fprintf( cargo->yyc, "\tHB_P_MESSAGE, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1029,7 +1027,7 @@ static HB_GENC_FUNC( hb_p_parameter ) pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ], pFunc->pCode[ lPCodePos + 3 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 4; } @@ -1066,7 +1064,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfield ) fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1075,7 +1073,7 @@ static HB_GENC_FUNC( hb_p_popaliasedfieldnear ) { fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELDNEAR, %i,", pFunc->pCode[ lPCodePos + 1 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName ); fprintf( cargo->yyc, "\n" ); return 2; } @@ -1085,7 +1083,7 @@ static HB_GENC_FUNC( hb_p_popaliasedvar ) fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1095,7 +1093,7 @@ static HB_GENC_FUNC( hb_p_popfield ) fprintf( cargo->yyc, "\tHB_P_POPFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1160,7 +1158,7 @@ static HB_GENC_FUNC( hb_p_popmemvar ) fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1172,7 +1170,7 @@ static HB_GENC_FUNC( hb_p_popstatic ) pFunc->pCode[ lPCodePos + 2 ] ); if( cargo->bVerbose ) { - char *szName = hb_compStaticGetName( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); + char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); fprintf( cargo->yyc, "\t/* %s */", szName ); } fprintf( cargo->yyc, "\n" ); @@ -1184,7 +1182,7 @@ static HB_GENC_FUNC( hb_p_popvariable ) fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1212,7 +1210,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfield ) fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1221,7 +1219,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedfieldnear ) { fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELDNEAR, %i,", pFunc->pCode[ lPCodePos + 1 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName ); fprintf( cargo->yyc, "\n" ); return 2; } @@ -1231,7 +1229,7 @@ static HB_GENC_FUNC( hb_p_pushaliasedvar ) fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1329,7 +1327,7 @@ static HB_GENC_FUNC( hb_p_pushfield ) fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1479,7 +1477,7 @@ static HB_GENC_FUNC( hb_p_pushmemvar ) fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1489,7 +1487,7 @@ static HB_GENC_FUNC( hb_p_pushmemvarref ) fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1519,7 +1517,7 @@ static HB_GENC_FUNC( hb_p_pushstatic ) pFunc->pCode[ lPCodePos + 2 ] ); if( cargo->bVerbose ) { - char *szName = hb_compStaticGetName( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); + char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); fprintf( cargo->yyc, "\t/* %s */", szName ); } fprintf( cargo->yyc, "\n" ); @@ -1533,7 +1531,7 @@ static HB_GENC_FUNC( hb_p_pushstaticref ) pFunc->pCode[ lPCodePos + 2 ] ); if( cargo->bVerbose ) { - char *szName = hb_compStaticGetName( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); + char *szName = hb_compStaticGetName( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); fprintf( cargo->yyc, "\t/* %s */", szName ); } fprintf( cargo->yyc, "\n" ); @@ -1621,7 +1619,7 @@ static HB_GENC_FUNC( hb_p_pushsym ) pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1631,7 +1629,7 @@ static HB_GENC_FUNC( hb_p_pushsymnear ) fprintf( cargo->yyc, "\tHB_P_PUSHSYMNEAR, %i,", pFunc->pCode[ lPCodePos + 1 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] )->szName ); + fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName ); fprintf( cargo->yyc, "\n" ); return 2; } @@ -1642,7 +1640,7 @@ static HB_GENC_FUNC( hb_p_pushvariable ) pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1998,7 +1996,7 @@ static HB_GENC_FUNC( hb_p_withobjectmessage ) fprintf( cargo->yyc, "\tHB_P_WITHOBJECTMESSAGE, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); + if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( cargo->HB_COMP_PARAM, HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -2183,15 +2181,16 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = { hb_p_vframe }; -static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc ) +static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ) { HB_GENC_INFO genc_info; /* Make sure that table is correct */ assert( HB_P_LAST_PCODE == sizeof( s_verbose_table ) / sizeof( HB_GENC_FUNC_PTR ) ); + genc_info.HB_COMP_PARAM = HB_COMP_PARAM; genc_info.iNestedCodeblock = 0; - genc_info.bVerbose = ( hb_comp_iGenCOutput == HB_COMPGENC_VERBOSE ); + genc_info.bVerbose = ( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_VERBOSE ); genc_info.yyc = yyc; fprintf( yyc, "{\n static const BYTE pcode[] =\n {\n" ); diff --git a/harbour/source/compiler/gencc.c b/harbour/source/compiler/gencc.c index 213e300e98..6d05c3026f 100644 --- a/harbour/source/compiler/gencc.c +++ b/harbour/source/compiler/gencc.c @@ -31,9 +31,6 @@ #include "hbcomp.h" #include "hbdate.h" -extern void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc ); -extern void hb_compGenCString( FILE * yyc, BYTE * pText, USHORT usLen ); - #define HB_GENC_FUNC( func ) HB_PCODE_FUNC( func, PHB_LABEL_INFO ) typedef HB_GENC_FUNC( HB_GENC_FUNC_ ); typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR; @@ -1760,7 +1757,7 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = { hb_p_vframe }; -void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc ) +void hb_compGenCRealCode( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ) { HB_LABEL_INFO label_info; @@ -1768,7 +1765,7 @@ void hb_compGenCRealCode( PFUNCTION pFunc, FILE * yyc ) assert( HB_P_LAST_PCODE == sizeof( s_verbose_table ) / sizeof( HB_GENC_FUNC_PTR ) ); label_info.yyc = yyc; - label_info.fVerbose = ( hb_comp_iGenCOutput == HB_COMPGENC_VERBOSE ); + label_info.fVerbose = ( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_VERBOSE ); label_info.fSetSeqBegin = FALSE; label_info.fCondJump = FALSE; if( pFunc->lPCodePos == 0 ) diff --git a/harbour/source/compiler/gencli.c b/harbour/source/compiler/gencli.c index 8b610e1594..4e3f7746af 100644 --- a/harbour/source/compiler/gencli.c +++ b/harbour/source/compiler/gencli.c @@ -30,13 +30,14 @@ #include "hbcomp.h" -static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc ); +static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ); static void hb_compGenCCompact( PFUNCTION pFunc, FILE * yyc ); static void hb_genNetFunctions( FILE * yyc ); /* helper structure to pass information */ typedef struct HB_stru_genc_info { + HB_COMP_DECL; FILE * yyc; BOOL bVerbose; USHORT iNestedCodeblock; @@ -55,15 +56,15 @@ static HB_FUNCALLS_PTR pFunCalls = NULL; typedef HB_GENC_FUNC( HB_GENC_FUNC_ ); typedef HB_GENC_FUNC_ * HB_GENC_FUNC_PTR; -void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ +void hb_compGenILCode( HB_COMP_DECL, PHB_FNAME pFileName ) /* generates the IL output */ { char szFileName[ _POSIX_PATH_MAX ]; - PFUNCTION pFunc = hb_comp_functions.pFirst; - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; PCOMDECLARED pDeclared; PCOMCLASS pClass; FILE * yyc; /* file handle for IL output */ - PINLINE pInline = hb_comp_inlines.pFirst; + PINLINE pInline = HB_COMP_PARAM->inlines.pFirst; BOOL bIsPublicFunction ; BOOL bIsInitFunction ; @@ -82,11 +83,11 @@ void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ yyc = fopen( szFileName, "wb" ); if( ! yyc ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); return; } - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { printf( "Generating IL source output to \'%s\'... ", szFileName ); fflush( stdout ); @@ -96,7 +97,7 @@ void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ HB_VER_MINOR, HB_VER_REVISION, HB_VER_LEX ); fprintf( yyc, "// Generated .NET IL source code\n\n" ); - if( hb_comp_iFunctionCnt ) + if( HB_COMP_PARAM->iFunctionCnt ) { fprintf( yyc, ".assembly extern mscorlib{}\n" ); fprintf( yyc, ".assembly " ); @@ -105,16 +106,16 @@ void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ /* Generate functions data */ - pFunc = hb_comp_functions.pFirst; + pFunc = HB_COMP_PARAM->functions.pFirst; - if( ! hb_comp_bStartProc ) + if( ! HB_COMP_PARAM->fStartProc ) pFunc = pFunc->pNext; /* No implicit starting procedure */ while( pFunc ) { bIsInitFunction = ( pFunc->cScope & HB_FS_INIT ) ; bIsExitFunction = ( pFunc->cScope & HB_FS_EXIT ) ; - bIsStaticVariable = ( pFunc == hb_comp_pInitFunc ) ; + bIsStaticVariable = ( pFunc == HB_COMP_PARAM->pInitFunc ) ; bIsPublicFunction = ( pFunc->cScope == HB_FS_PUBLIC ) ; /* Is it a PUBLIC FUNCTION/PROCEDURE */ @@ -141,10 +142,10 @@ void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ bIsFirstFunction = FALSE; } - if( hb_comp_iGenCOutput == HB_COMPGENC_COMPACT ) + if( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_COMPACT ) hb_compGenCCompact( pFunc, yyc ); else - hb_compGenCReadable( pFunc, yyc ); + hb_compGenCReadable( HB_COMP_PARAM, pFunc, yyc ); fprintf( yyc, " ret\n}\n" ); @@ -153,17 +154,7 @@ void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ /* Generate codeblocks data */ - if( hb_comp_cInlineID > '0' ) - { - fprintf( yyc, "#include \"hbapi.h\"\n" ); - fprintf( yyc, "#include \"hbstack.h\"\n" ); - fprintf( yyc, "#include \"hbapierr.h\"\n" ); - fprintf( yyc, "#include \"hbapiitm.h\"\n" ); - fprintf( yyc, "#include \"hbvm.h\"\n" ); - fprintf( yyc, "#include \"hboo.ch\"\n" ); - } - - pInline = hb_comp_inlines.pFirst; + pInline = HB_COMP_PARAM->inlines.pFirst; while( pInline ) { fprintf( yyc, "#line %i \"%s\"\n", pInline->iLine, pInline->szFileName ); @@ -186,64 +177,64 @@ void hb_compGenILCode( PHB_FNAME pFileName ) /* generates the IL output */ fclose( yyc ); - pFunc = hb_comp_functions.pFirst; + pFunc = HB_COMP_PARAM->functions.pFirst; while( pFunc ) - pFunc = hb_compFunctionKill( pFunc ); + pFunc = hb_compFunctionKill( HB_COMP_PARAM, pFunc ); - pFunc = hb_comp_funcalls.pFirst; + pFunc = HB_COMP_PARAM->funcalls.pFirst; while( pFunc ) { - hb_comp_funcalls.pFirst = pFunc->pNext; + HB_COMP_PARAM->funcalls.pFirst = pFunc->pNext; hb_xfree( ( void * ) pFunc ); /* NOTE: szName will be released by hb_compSymbolKill() */ - pFunc = hb_comp_funcalls.pFirst; + pFunc = HB_COMP_PARAM->funcalls.pFirst; } - pInline = hb_comp_inlines.pFirst; + pInline = HB_COMP_PARAM->inlines.pFirst; while( pInline ) { - hb_comp_inlines.pFirst = pInline->pNext; + HB_COMP_PARAM->inlines.pFirst = pInline->pNext; if( pInline->pCode ) { hb_xfree( ( void * ) pInline->pCode ); } hb_xfree( ( void * ) pInline->szFileName ); hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */ - pInline = hb_comp_inlines.pFirst; + pInline = HB_COMP_PARAM->inlines.pFirst; } - if ( hb_comp_iWarnings >= 3 ) + if ( HB_COMP_PARAM->iWarnings >= 3 ) { - pDeclared = hb_comp_pReleaseDeclared->pNext; + pDeclared = HB_COMP_PARAM->pReleaseDeclared->pNext; while( pDeclared ) { - hb_comp_pFirstDeclared = pDeclared->pNext; + HB_COMP_PARAM->pFirstDeclared = pDeclared->pNext; hb_xfree( ( void * ) pDeclared ); - pDeclared = hb_comp_pFirstDeclared; + pDeclared = HB_COMP_PARAM->pFirstDeclared; } - pClass = hb_comp_pReleaseClass->pNext; + pClass = HB_COMP_PARAM->pReleaseClass->pNext; while( pClass ) { - hb_comp_pFirstClass = pClass->pNext; + HB_COMP_PARAM->pFirstClass = pClass->pNext; pDeclared = pClass->pMethod; while ( pDeclared ) { - hb_comp_pFirstDeclared = pDeclared->pNext; + HB_COMP_PARAM->pFirstDeclared = pDeclared->pNext; hb_xfree( ( void * ) pDeclared ); - pDeclared = hb_comp_pFirstDeclared; + pDeclared = HB_COMP_PARAM->pFirstDeclared; } hb_xfree( ( void * ) pClass ); - pClass = hb_comp_pFirstClass; + pClass = HB_COMP_PARAM->pFirstClass; } } - pSym = hb_comp_symbols.pFirst; + pSym = HB_COMP_PARAM->symbols.pFirst; while( pSym ) pSym = hb_compSymbolKill( pSym ); - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) printf( "Done.\n" ); } @@ -867,7 +858,6 @@ static HB_GENC_FUNC( hb_p_message ) fprintf( cargo->yyc, "\tHB_P_MESSAGE, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -965,7 +955,6 @@ static HB_GENC_FUNC( hb_p_parameter ) pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ], pFunc->pCode[ lPCodePos + 3 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 4; } @@ -1003,7 +992,6 @@ static HB_GENC_FUNC( hb_p_popaliasedfield ) fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1012,7 +1000,6 @@ static HB_GENC_FUNC( hb_p_popaliasedfieldnear ) { fprintf( cargo->yyc, "\tHB_P_POPALIASEDFIELDNEAR, %i,", pFunc->pCode[ lPCodePos + 1 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] )->szName ); fprintf( cargo->yyc, "\n" ); return 2; } @@ -1022,7 +1009,6 @@ static HB_GENC_FUNC( hb_p_popaliasedvar ) fprintf( cargo->yyc, "\tHB_P_POPALIASEDVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1032,7 +1018,6 @@ static HB_GENC_FUNC( hb_p_popfield ) fprintf( cargo->yyc, "\tHB_P_POPFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1080,7 +1065,6 @@ static HB_GENC_FUNC( hb_p_popmemvar ) fprintf( cargo->yyc, "\tHB_P_POPMEMVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1090,11 +1074,6 @@ static HB_GENC_FUNC( hb_p_popstatic ) fprintf( cargo->yyc, "\tHB_P_POPSTATIC, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) - { - char *szName = hb_compStaticGetName( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); - fprintf( cargo->yyc, "\t/* %s */", szName ); - } fprintf( cargo->yyc, "\n" ); return 3; } @@ -1104,7 +1083,6 @@ static HB_GENC_FUNC( hb_p_popvariable ) fprintf( cargo->yyc, "\tHB_P_POPVARIABLE, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1132,7 +1110,6 @@ static HB_GENC_FUNC( hb_p_pushaliasedfield ) fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1141,7 +1118,6 @@ static HB_GENC_FUNC( hb_p_pushaliasedfieldnear ) { fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDFIELDNEAR, %i,", pFunc->pCode[ lPCodePos + 1 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] )->szName ); fprintf( cargo->yyc, "\n" ); return 2; } @@ -1151,7 +1127,6 @@ static HB_GENC_FUNC( hb_p_pushaliasedvar ) fprintf( cargo->yyc, "\tHB_P_PUSHALIASEDVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1245,7 +1220,6 @@ static HB_GENC_FUNC( hb_p_pushfield ) fprintf( cargo->yyc, "\tHB_P_PUSHFIELD, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1365,7 +1339,6 @@ static HB_GENC_FUNC( hb_p_pushmemvar ) fprintf( cargo->yyc, "\tHB_P_PUSHMEMVAR, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1375,7 +1348,6 @@ static HB_GENC_FUNC( hb_p_pushmemvarref ) fprintf( cargo->yyc, "\tHB_P_PUSHMEMVARREF, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1428,11 +1400,6 @@ static HB_GENC_FUNC( hb_p_pushstatic ) fprintf( cargo->yyc, "\tHB_P_PUSHSTATIC, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) - { - char *szName = hb_compStaticGetName( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); - fprintf( cargo->yyc, "\t/* %s */", szName ); - } fprintf( cargo->yyc, "\n" ); return 3; } @@ -1442,11 +1409,6 @@ static HB_GENC_FUNC( hb_p_pushstaticref ) fprintf( cargo->yyc, "\tHB_P_PUSHSTATICREF, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) - { - char *szName = hb_compStaticGetName( HB_PCODE_MKUSHORT( &( pFunc->pCode[ lPCodePos + 1 ] ) ) ); - fprintf( cargo->yyc, "\t/* %s */", szName ); - } fprintf( cargo->yyc, "\n" ); return 3; @@ -1533,8 +1495,6 @@ static HB_GENC_FUNC( hb_p_pushsym ) fprintf( cargo->yyc, "\tHB_P_PUSHSYM, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) - fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1557,7 +1517,7 @@ static HB_GENC_FUNC( hb_p_pushsymnear ) pTemp = pFunCalls; } - pTemp->szName = hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] )->szName; + pTemp->szName = hb_compSymbolGetPos( cargo->HB_COMP_PARAM, pFunc->pCode[ lPCodePos + 1 ] )->szName; pTemp->bFirstParam = TRUE; pTemp->pNext = NULL; @@ -1572,7 +1532,6 @@ static HB_GENC_FUNC( hb_p_pushvariable ) fprintf( cargo->yyc, "\tHB_P_PUSHVARIABLE, %i, %i,", pFunc->pCode[ lPCodePos + 1 ], pFunc->pCode[ lPCodePos + 2 ] ); - if( cargo->bVerbose ) fprintf( cargo->yyc, "\t/* %s */", hb_compSymbolGetPos( pFunc->pCode[ lPCodePos + 1 ] + pFunc->pCode[ lPCodePos + 2 ] * 256 )->szName ); fprintf( cargo->yyc, "\n" ); return 3; } @@ -1937,15 +1896,16 @@ static HB_GENC_FUNC_PTR s_verbose_table[] = { hb_p_enumend }; -static void hb_compGenCReadable( PFUNCTION pFunc, FILE * yyc ) +static void hb_compGenCReadable( HB_COMP_DECL, PFUNCTION pFunc, FILE * yyc ) { HB_GENC_INFO genc_info; /* Make sure that table is correct */ assert( HB_P_LAST_PCODE == sizeof( s_verbose_table ) / sizeof( HB_GENC_FUNC_PTR ) ); + genc_info.HB_COMP_PARAM = HB_COMP_PARAM; genc_info.iNestedCodeblock = 0; - genc_info.bVerbose = ( hb_comp_iGenCOutput == HB_COMPGENC_VERBOSE ); + genc_info.bVerbose = ( HB_COMP_PARAM->iGenCOutput == HB_COMPGENC_VERBOSE ); genc_info.yyc = yyc; hb_compPCodeEval( pFunc, ( HB_PCODE_FUNC_PTR * ) s_verbose_table, ( void * ) &genc_info ); diff --git a/harbour/source/compiler/gencobj.c b/harbour/source/compiler/gencobj.c index 0017e67d8c..b48c481ebc 100644 --- a/harbour/source/compiler/gencobj.c +++ b/harbour/source/compiler/gencobj.c @@ -40,7 +40,7 @@ static char * hb_searchpath( const char *, char *, char * ); /*--------------------------------------------------------------------------*/ /* Builds platform dependant object module from Harbour C output */ -void hb_compGenCObj( PHB_FNAME pFileName ) +void hb_compGenCObj( HB_COMP_DECL, PHB_FNAME pFileName ) { char szFileName[ _POSIX_PATH_MAX ]; char szLine[ HB_CFG_LINE_LEN ]; @@ -66,12 +66,14 @@ void hb_compGenCObj( PHB_FNAME pFileName ) BOOL bDelTmp = TRUE; /* Delete intermediate C file (default). */ int iSuccess; + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); + /* First pass: build the C output */ /* Force file extension to avoid collisions when called from a make utility */ pFileName->szExtension = ".c"; hb_fsFNameMerge( szFileName, pFileName ); - hb_compGenCCode( hb_comp_pFileName ); + hb_compGenCCode( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); /* Begin second pass */ @@ -161,20 +163,20 @@ void hb_compGenCObj( PHB_FNAME pFileName ) #endif - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { printf( "Building object module output for \'%s\'...", szFileName ); fflush( stdout ); } /* Check if -o was used */ - if( hb_comp_pOutPath ) + if( HB_COMP_PARAM->pOutPath ) { PHB_FNAME pOut = hb_fsFNameSplit( ( char * ) szFileName ); char pszTemp[ _POSIX_PATH_MAX ] = ""; - if( hb_comp_pOutPath->szPath ) - pOut->szPath = hb_comp_pOutPath->szPath; + if( HB_COMP_PARAM->pOutPath->szPath ) + pOut->szPath = HB_COMP_PARAM->pOutPath->szPath; #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__WATCOMC__) pOut->szExtension = ".obj"; @@ -217,7 +219,7 @@ void hb_compGenCObj( PHB_FNAME pFileName ) if( bDelTmp ) /* && iSuccess ) */ unlink( ( char * ) szFileName ); - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { if( iSuccess ) printf( "Done.\n" ); diff --git a/harbour/source/compiler/genhrb.c b/harbour/source/compiler/genhrb.c index 982aaa2de0..902e9628cd 100644 --- a/harbour/source/compiler/genhrb.c +++ b/harbour/source/compiler/genhrb.c @@ -32,11 +32,11 @@ #define SYM_FUNC 1 /* Defined function */ #define SYM_EXTERN 2 /* Previously defined function */ -void hb_compGenPortObj( PHB_FNAME pFileName ) +void hb_compGenPortObj( HB_COMP_DECL, PHB_FNAME pFileName ) { char szFileName[ _POSIX_PATH_MAX ]; - PFUNCTION pFunc /*= hb_comp_functions.pFirst*/; - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PFUNCTION pFunc /*= HB_COMP_PARAM->functions.pFirst*/; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; ULONG lPCodePos; LONG lSymbols; ULONG ulCodeLength; @@ -49,11 +49,11 @@ void hb_compGenPortObj( PHB_FNAME pFileName ) yyc = fopen( szFileName, "wb" ); if( ! yyc ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); return; } - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { printf( "Generating Harbour Portable Object output to \'%s\'... ", szFileName ); fflush( stdout ); @@ -77,7 +77,7 @@ void hb_compGenPortObj( PHB_FNAME pFileName ) fputc( ( BYTE ) ( ( lSymbols >> 16 ) & 255 ), yyc ); fputc( ( BYTE ) ( ( lSymbols >> 24 ) & 255 ), yyc ); - pSym = hb_comp_symbols.pFirst; + pSym = HB_COMP_PARAM->symbols.pFirst; while( pSym ) { fputs( pSym->szName, yyc ); @@ -86,17 +86,17 @@ void hb_compGenPortObj( PHB_FNAME pFileName ) /* specify the function address if it is a defined function or a external called function */ - if( hb_compFunctionFind( pSym->szName ) ) /* is it a defined function ? */ + if( hb_compFunctionFind( HB_COMP_PARAM, pSym->szName ) ) /* is it a defined function ? */ fputc( SYM_FUNC, yyc ); - else if( hb_compFunCallFind( pSym->szName ) ) + else if( hb_compFunCallFind( HB_COMP_PARAM, pSym->szName ) ) fputc( SYM_EXTERN, yyc ); else fputc( SYM_NOLINK, yyc ); pSym = pSym->pNext; } - pFunc = hb_comp_functions.pFirst; - if( ! hb_comp_bStartProc ) + pFunc = HB_COMP_PARAM->functions.pFirst; + if( ! HB_COMP_PARAM->fStartProc ) pFunc = pFunc->pNext; lSymbols = 0; /* Count number of symbols */ @@ -112,8 +112,8 @@ void hb_compGenPortObj( PHB_FNAME pFileName ) /* Generate functions data */ - pFunc = hb_comp_functions.pFirst; - if( ! hb_comp_bStartProc ) + pFunc = HB_COMP_PARAM->functions.pFirst; + if( ! HB_COMP_PARAM->fStartProc ) pFunc = pFunc->pNext; while( pFunc ) @@ -135,7 +135,7 @@ void hb_compGenPortObj( PHB_FNAME pFileName ) fclose( yyc ); - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) printf( "Done.\n" ); } diff --git a/harbour/source/compiler/genjava.c b/harbour/source/compiler/genjava.c index b58883fc43..c4332070c6 100644 --- a/harbour/source/compiler/genjava.c +++ b/harbour/source/compiler/genjava.c @@ -39,11 +39,11 @@ static void hb_fputs( char * szName ); static FILE * s_yyc; static int s_nChar = 0; -void hb_compGenJava( PHB_FNAME pFileName ) +void hb_compGenJava( HB_COMP_DECL, PHB_FNAME pFileName ) { char szFileName[ _POSIX_PATH_MAX ]; - PFUNCTION pFunc /*= hb_comp_functions.pFirst */; - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PFUNCTION pFunc /*= HB_COMP_PARAM->functions.pFirst */; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; ULONG lPCodePos; LONG lSymbols; ULONG ulCodeLength; @@ -55,11 +55,11 @@ void hb_compGenJava( PHB_FNAME pFileName ) s_yyc = fopen( szFileName, "wb" ); if( ! s_yyc ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); return; } - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { printf( "Generating Java source output to \'%s\'... ", szFileName ); fflush( stdout ); @@ -90,7 +90,7 @@ void hb_compGenJava( PHB_FNAME pFileName ) hb_fputc( ( BYTE ) ( ( lSymbols >> 16 ) & 255 ) ); hb_fputc( ( BYTE ) ( ( lSymbols >> 24 ) & 255 ) ); - pSym = hb_comp_symbols.pFirst; + pSym = HB_COMP_PARAM->symbols.pFirst; while( pSym ) { hb_fputs( pSym->szName ); @@ -99,11 +99,11 @@ void hb_compGenJava( PHB_FNAME pFileName ) /* specify the function address if it is a defined function or a external called function */ - if( hb_compFunctionFind( pSym->szName ) ) /* is it a defined function ? */ + if( hb_compFunctionFind( HB_COMP_PARAM, pSym->szName ) ) /* is it a defined function ? */ hb_fputc( SYM_FUNC ); else { - if( hb_compFunCallFind( pSym->szName ) ) + if( hb_compFunCallFind( HB_COMP_PARAM, pSym->szName ) ) hb_fputc( SYM_EXTERN ); else hb_fputc( SYM_NOLINK ); @@ -111,7 +111,7 @@ void hb_compGenJava( PHB_FNAME pFileName ) pSym = pSym->pNext; } - pFunc = hb_comp_functions.pFirst; + pFunc = HB_COMP_PARAM->functions.pFirst; lSymbols = 0; /* Count number of symbols */ while( pFunc ) @@ -126,8 +126,8 @@ void hb_compGenJava( PHB_FNAME pFileName ) /* Generate functions data */ - pFunc = hb_comp_functions.pFirst; - if( ! hb_comp_bStartProc ) + pFunc = HB_COMP_PARAM->functions.pFirst; + if( ! HB_COMP_PARAM->fStartProc ) pFunc = pFunc->pNext; while( pFunc ) @@ -156,7 +156,7 @@ void hb_compGenJava( PHB_FNAME pFileName ) fclose( s_yyc ); - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) printf( "Done.\n" ); } diff --git a/harbour/source/compiler/genobj32.c b/harbour/source/compiler/genobj32.c index 1b8da1d976..d4d91cc403 100644 --- a/harbour/source/compiler/genobj32.c +++ b/harbour/source/compiler/genobj32.c @@ -28,26 +28,26 @@ #include "hbcomp.h" -static ULONG GetSymbolsSize( void ); -static PCOMSYMBOL GetFirstSymbol( void ); -static char * GetSymbolName( ULONG ulPos ); -static ULONG GetPCodesSize( void ); -static ULONG GetSymbolsAmount( void ); -static BOOL IsExternal( ULONG ulSymbol ); +static ULONG GetSymbolsSize( HB_COMP_DECL ); +static PCOMSYMBOL GetFirstSymbol( HB_COMP_DECL ); +static char * GetSymbolName( HB_COMP_DECL, ULONG ulPos ); +static ULONG GetPCodesSize( HB_COMP_DECL ); +static ULONG GetSymbolsAmount( HB_COMP_DECL ); +static BOOL IsExternal( HB_COMP_DECL, ULONG ulSymbol ); static USHORT GetExternalPos( char * szExternal ); static void GenerateLocalNames( FILE * hObjFile ); -static void GenerateSymbolsSegment( FILE * hObjFile ); -static void GenerateDataSegment( FILE * hObjFile ); -static void GenerateCodeSegment( FILE * hObjFile ); -static void GenerateExternals( FILE * hObjFile ); +static void GenerateSymbolsSegment( HB_COMP_DECL, FILE * hObjFile ); +static void GenerateDataSegment( HB_COMP_DECL, FILE * hObjFile ); +static void GenerateCodeSegment( HB_COMP_DECL, FILE * hObjFile ); +static void GenerateExternals( HB_COMP_DECL, FILE * hObjFile ); static void putbyte( BYTE b, FILE * hObjFile, BYTE * pbChecksum ); static void putword( USHORT w, FILE * hObjFile, BYTE * pbChecksum ); static void CompiledFileName( FILE * hObjFile, char * szFileName ); static void CompilerVersion( FILE * hObjFile, char * szVersion ); static void LocalNames( FILE * hObjFile, char * szNames[] ); static void ExternalNames( FILE * hObjFile, char * szNames[] ); -static void CodeSegment( FILE * hObjFile, BYTE * prgCode, ULONG ulPrgLen, USHORT wFunctions ); -static void DataSegment( FILE * hObjFile, BYTE * symbol, ULONG wSymLen, ULONG wSymbols, ULONG ulTotalSize ); +static void CodeSegment( HB_COMP_DECL, FILE * hObjFile, BYTE * prgCode, ULONG ulPrgLen, USHORT wFunctions ); +static void DataSegment( HB_COMP_DECL, FILE * hObjFile, BYTE * symbol, ULONG wSymLen, ULONG wSymbols, ULONG ulTotalSize ); static void DefineSegment( FILE * hObjFile, BYTE bName, BYTE bClass, USHORT wLen ); static void PubDef( FILE * hObjFile, char * szName, USHORT wSegment, USHORT wOffset ); static void Fixup( FILE * hObjFile, BYTE bType, USHORT wOffset, BYTE bFlags, BYTE bSymbol ); @@ -62,7 +62,7 @@ static char * * externNames = 0; static USHORT wExternals = 1; /* _hb_vmExecute is always added */ static char * szPrefix = "_HB_FUN_"; -void hb_compGenObj32( PHB_FNAME pFileName ) +void hb_compGenObj32( HB_COMP_DECL, PHB_FNAME pFileName ) { char szFileName[ _POSIX_PATH_MAX ]; FILE * hObjFile; /* file handle for OBJ output */ @@ -74,11 +74,11 @@ void hb_compGenObj32( PHB_FNAME pFileName ) if( ( hObjFile = fopen( szFileName, "wb" ) ) == NULL ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL ); return; } - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { printf( "Generating Windows/DOS OBJ32 output to \'%s\'... ", szFileName ); fflush( stdout ); @@ -90,32 +90,32 @@ void hb_compGenObj32( PHB_FNAME pFileName ) CompiledFileName( hObjFile, szFileName ); CompilerVersion( hObjFile, compiler ); GenerateLocalNames( hObjFile ); - GenerateExternals( hObjFile ); - GenerateCodeSegment( hObjFile ); - GenerateDataSegment( hObjFile ); - GenerateSymbolsSegment( hObjFile ); + GenerateExternals( HB_COMP_PARAM, hObjFile ); + GenerateCodeSegment( HB_COMP_PARAM, hObjFile ); + GenerateDataSegment( HB_COMP_PARAM, hObjFile ); + GenerateSymbolsSegment( HB_COMP_PARAM, hObjFile ); End( hObjFile ); fclose( hObjFile ); - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) printf( "Done.\n" ); } -static ULONG GetSymbolsSize( void ) +static ULONG GetSymbolsSize( HB_COMP_DECL ) { - return hb_comp_symbols.iCount * sizeof( HB_SYMB ); + return HB_COMP_PARAM->symbols.iCount * sizeof( HB_SYMB ); } -static PCOMSYMBOL GetFirstSymbol( void ) +static PCOMSYMBOL GetFirstSymbol( HB_COMP_DECL ) { - PCOMSYMBOL pSymbol = hb_comp_symbols.pFirst; + PCOMSYMBOL pSymbol = HB_COMP_PARAM->symbols.pFirst; return pSymbol; } -static char * GetSymbolName( ULONG ulPos ) +static char * GetSymbolName( HB_COMP_DECL, ULONG ulPos ) { - PCOMSYMBOL pSymbol = GetFirstSymbol(); + PCOMSYMBOL pSymbol = GetFirstSymbol( HB_COMP_PARAM ); ULONG ul = 0; while( pSymbol && ( ul++ < ulPos ) ) @@ -124,12 +124,12 @@ static char * GetSymbolName( ULONG ulPos ) return pSymbol->szName; } -static ULONG GetPCodesSize( void ) +static ULONG GetPCodesSize( HB_COMP_DECL ) { ULONG ulTotal = 0; - PFUNCTION pFunction = hb_comp_functions.pFirst; + PFUNCTION pFunction = HB_COMP_PARAM->functions.pFirst; - if( ! hb_comp_bStartProc ) + if( ! HB_COMP_PARAM->fStartProc ) pFunction = pFunction->pNext; while( pFunction ) @@ -140,9 +140,9 @@ static ULONG GetPCodesSize( void ) return ulTotal; } -static ULONG GetSymbolsAmount( void ) +static ULONG GetSymbolsAmount( HB_COMP_DECL ) { - PCOMSYMBOL pSymbol = GetFirstSymbol(); + PCOMSYMBOL pSymbol = GetFirstSymbol( HB_COMP_PARAM ); ULONG ulAmount = 1; while( pSymbol->pNext ) @@ -153,15 +153,15 @@ static ULONG GetSymbolsAmount( void ) return ulAmount; } -static BOOL IsExternal( ULONG ulSymbol ) +static BOOL IsExternal( HB_COMP_DECL, ULONG ulSymbol ) { - PCOMSYMBOL pSymbol = GetFirstSymbol(); + PCOMSYMBOL pSymbol = GetFirstSymbol( HB_COMP_PARAM ); ULONG ul = 0; while( ul++ < ulSymbol ) pSymbol = pSymbol->pNext; - return ! hb_compFunctionFind( pSymbol->szName ); + return ! hb_compFunctionFind( HB_COMP_PARAM, pSymbol->szName ); } static USHORT GetExternalPos( char * szExternal ) @@ -190,7 +190,7 @@ static void GenerateLocalNames( FILE * hObjFile ) LocalNames( hObjFile, localNames ); } -static void GenerateSymbolsSegment( FILE * hObjFile ) +static void GenerateSymbolsSegment( HB_COMP_DECL, FILE * hObjFile ) { BYTE symbolsData[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; BYTE groupDGroup[] = { 2, 3, 4, 0 }; /* segments defined order for DGROUP */ @@ -221,7 +221,7 @@ static void GenerateSymbolsSegment( FILE * hObjFile ) GroupDef( hObjFile, 12, groupSymGroup ); /* "SYMGROUP" localNames position - 1 */ GroupDef( hObjFile, 17, groupInitData ); /* "BORLAND" localNames position - 1 */ - * ( USHORT * ) symbolsData = (USHORT) GetSymbolsAmount(); + * ( USHORT * ) symbolsData = (USHORT) GetSymbolsAmount( HB_COMP_PARAM ); EnumeratedData( hObjFile, 6, symbolsData, sizeof( symbolsData ), 0 ); /* HB_SYMBOLS defined order segment */ @@ -230,12 +230,12 @@ static void GenerateSymbolsSegment( FILE * hObjFile ) 4 ); /* DATA segment defined order */ } -static void GenerateDataSegment( FILE * hObjFile ) +static void GenerateDataSegment( HB_COMP_DECL, FILE * hObjFile ) { HB_SYMB symbol; - ULONG ulSize = GetSymbolsSize(); - PCOMSYMBOL pSymbol = GetFirstSymbol(); - ULONG ulSymbols = GetSymbolsAmount(), ul; + ULONG ulSize = GetSymbolsSize( HB_COMP_PARAM ); + PCOMSYMBOL pSymbol = GetFirstSymbol( HB_COMP_PARAM ); + ULONG ulSymbols = GetSymbolsAmount( HB_COMP_PARAM ), ul; while( pSymbol ) { @@ -243,7 +243,7 @@ static void GenerateDataSegment( FILE * hObjFile ) pSymbol = pSymbol->pNext; } - ulSize += GetPCodesSize(); + ulSize += GetPCodesSize( HB_COMP_PARAM ); DefineSegment( hObjFile, 4, /* _NULL position + 1 into localnames */ 6, /* "DATA" position + 1 into localNames */ @@ -256,19 +256,19 @@ static void GenerateDataSegment( FILE * hObjFile ) (USHORT) ulSize ); /* segment length */ memset( &symbol, 0, sizeof( symbol ) ); - DataSegment( hObjFile, (BYTE *) &symbol, - sizeof( symbol ), GetSymbolsAmount(), ulSize ); + DataSegment( HB_COMP_PARAM, hObjFile, (BYTE *) &symbol, + sizeof( symbol ), GetSymbolsAmount( HB_COMP_PARAM ), ulSize ); - pSymbol = GetFirstSymbol(); + pSymbol = GetFirstSymbol( HB_COMP_PARAM ); for( ul = 0; ul < ulSymbols; ul++ ) { Fixup( hObjFile, 0xE4, (USHORT) ( ul * sizeof( HB_SYMB ) ), 0x54, 4 ); /* 4 = Data symbol name location */ - if( IsExternal( ul ) ) + if( IsExternal( HB_COMP_PARAM, ul ) ) { if( ! ( pSymbol->cScope & HB_FS_MESSAGE ) ) Fixup( hObjFile, 0xE4, (USHORT) ( ul * sizeof( HB_SYMB ) ) + 8, 0x56, - GetExternalPos( GetSymbolName( ul ) ) + 1 ); + GetExternalPos( GetSymbolName( HB_COMP_PARAM, ul ) ) + 1 ); } else { @@ -279,11 +279,11 @@ static void GenerateDataSegment( FILE * hObjFile ) } } -static void GenerateCodeSegment( FILE * hObjFile ) +static void GenerateCodeSegment( HB_COMP_DECL, FILE * hObjFile ) { - USHORT wFunctions = hb_comp_functions.iCount - ( hb_comp_bStartProc ? 0: 1 ); + USHORT wFunctions = HB_COMP_PARAM->functions.iCount - ( HB_COMP_PARAM->fStartProc ? 0: 1 ); ULONG ulSize = wFunctions * sizeof( prgFunction ); - PFUNCTION pFunc = ( hb_comp_bStartProc ? hb_comp_functions.pFirst: hb_comp_functions.pFirst->pNext ); + PFUNCTION pFunc = ( HB_COMP_PARAM->fStartProc ? HB_COMP_PARAM->functions.pFirst: HB_COMP_PARAM->functions.pFirst->pNext ); USHORT w = 0; DefineSegment( hObjFile, 2, /* "_TEXT" position + 1 into localNames */ @@ -298,7 +298,7 @@ static void GenerateCodeSegment( FILE * hObjFile ) pFunc = pFunc->pNext; } - CodeSegment( hObjFile, prgFunction, sizeof( prgFunction ), wFunctions ); + CodeSegment( HB_COMP_PARAM, hObjFile, prgFunction, sizeof( prgFunction ), wFunctions ); for( w = 0; w < wFunctions; w++ ) { @@ -314,16 +314,16 @@ static void GenerateCodeSegment( FILE * hObjFile ) } } -static void GenerateExternals( FILE * hObjFile ) +static void GenerateExternals( HB_COMP_DECL, FILE * hObjFile ) { USHORT w; PFUNCTION pFunc, pFTemp; /* calculate amount of externals */ - pFunc = hb_comp_funcalls.pFirst; + pFunc = HB_COMP_PARAM->funcalls.pFirst; while( pFunc ) { - if( ( pFTemp = hb_compFunctionFind( pFunc->szName ) ) == NULL || pFTemp == hb_comp_functions.pFirst ) + if( ( pFTemp = hb_compFunctionFind( HB_COMP_PARAM, pFunc->szName ) ) == NULL || pFTemp == HB_COMP_PARAM->functions.pFirst ) wExternals++; pFunc = pFunc->pNext; } @@ -333,10 +333,10 @@ static void GenerateExternals( FILE * hObjFile ) w = 1; externNames[ 0 ] = "_hb_vmExecute"; - pFunc = hb_comp_funcalls.pFirst; + pFunc = HB_COMP_PARAM->funcalls.pFirst; while( pFunc ) { - if( ( pFTemp = hb_compFunctionFind( pFunc->szName ) ) == NULL || pFTemp == hb_comp_functions.pFirst ) + if( ( pFTemp = hb_compFunctionFind( HB_COMP_PARAM, pFunc->szName ) ) == NULL || pFTemp == HB_COMP_PARAM->functions.pFirst ) externNames[ w++ ] = pFunc->szName; pFunc = pFunc->pNext; } @@ -460,16 +460,16 @@ static void ExternalNames( FILE * hObjFile, char * szNames[] ) putbyte( 256 - bChk, hObjFile, &bChk ); } -static void CodeSegment( FILE * hObjFile, BYTE * prgCode, ULONG ulPrgLen, USHORT wFunctions ) +static void CodeSegment( HB_COMP_DECL, FILE * hObjFile, BYTE * prgCode, ULONG ulPrgLen, USHORT wFunctions ) { BYTE bChk = 0; USHORT y; USHORT wTotalLen = (USHORT) ( ulPrgLen * wFunctions ) + 4; ULONG ul; - PFUNCTION pFunction = hb_comp_functions.pFirst; - ULONG ulPCodeOffset = hb_comp_symbols.iCount * sizeof( HB_SYMB ); + PFUNCTION pFunction = HB_COMP_PARAM->functions.pFirst; + ULONG ulPCodeOffset = HB_COMP_PARAM->symbols.iCount * sizeof( HB_SYMB ); - if( ! hb_comp_bStartProc ) + if( ! HB_COMP_PARAM->fStartProc ) pFunction = pFunction->pNext; putbyte( 0xA0, hObjFile, &bChk ); @@ -489,18 +489,18 @@ static void CodeSegment( FILE * hObjFile, BYTE * prgCode, ULONG ulPrgLen, USHORT putbyte( 256 - bChk, hObjFile, &bChk ); } -static void DataSegment( FILE * hObjFile, BYTE * symbol, ULONG wSymLen, ULONG wSymbols, +static void DataSegment( HB_COMP_DECL, FILE * hObjFile, BYTE * symbol, ULONG wSymLen, ULONG wSymbols, ULONG ulSize ) { BYTE bChk = 0; ULONG w, y; USHORT wTotalLen = 4 + (USHORT) ulSize; - PCOMSYMBOL pSymbol = GetFirstSymbol(); - PFUNCTION pFunction = hb_comp_functions.pFirst; - ULONG ulSymbolNameOffset = GetSymbolsSize() + GetPCodesSize(); + PCOMSYMBOL pSymbol = GetFirstSymbol( HB_COMP_PARAM ); + PFUNCTION pFunction = HB_COMP_PARAM->functions.pFirst; + ULONG ulSymbolNameOffset = GetSymbolsSize( HB_COMP_PARAM ) + GetPCodesSize( HB_COMP_PARAM ); ULONG ulFunctionOffset; - if( ! hb_comp_bStartProc ) + if( ! HB_COMP_PARAM->fStartProc ) pFunction = pFunction->pNext; putbyte( 0xA0, hObjFile, &bChk ); @@ -512,9 +512,9 @@ static void DataSegment( FILE * hObjFile, BYTE * symbol, ULONG wSymLen, ULONG wS { * ( ULONG * ) symbol = ulSymbolNameOffset; - if( ! IsExternal( y ) ) + if( ! IsExternal( HB_COMP_PARAM, y ) ) { - ulFunctionOffset = ( hb_compFunctionGetPos( pSymbol->szName ) - 1 ) * + ulFunctionOffset = ( hb_compFunctionGetPos( HB_COMP_PARAM, pSymbol->szName ) - 1 ) * sizeof( prgFunction ); * ( ( ULONG * ) &symbol[ 8 ] ) = ulFunctionOffset; /* 8 offset of function pointer into symbol */ } @@ -542,7 +542,7 @@ static void DataSegment( FILE * hObjFile, BYTE * symbol, ULONG wSymLen, ULONG wS pFunction = pFunction->pNext; } - pSymbol = GetFirstSymbol(); + pSymbol = GetFirstSymbol( HB_COMP_PARAM ); while( pSymbol ) { diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 079a4c26ff..007b32fe1f 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -68,191 +68,91 @@ extern unsigned _stklen = UINT_MAX; #endif -static void hb_compInitVars( void ); -static void hb_compGenOutput( int ); -static void hb_compOutputFile( void ); -static void hb_compCompileEnd( void ); -static int hb_compCompile( char * szPrg, BOOL bSingleFile ); +static void hb_compGenOutput( HB_COMP_DECL, int ); +static void hb_compCompileEnd( HB_COMP_DECL ); +static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile ); +static int hb_compStaticGetPos( char *, PFUNCTION ); /* return if passed name is a static variable */ +static int hb_compFieldGetPos( char *, PFUNCTION ); /* return if passed name is a field variable */ +static int hb_compMemvarGetPos( char *, PFUNCTION ); /* return if passed name is a memvar variable */ -int hb_compLocalGetPos( char * szVarName ); /* returns the order + 1 of a local variable */ -int hb_compStaticGetPos( char *, PFUNCTION ); /* return if passed name is a static variable */ -int hb_compFieldGetPos( char *, PFUNCTION ); /* return if passed name is a field variable */ -int hb_compMemvarGetPos( char *, PFUNCTION ); /* return if passed name is a memvar variable */ +static void hb_compGenFieldPCode( HB_COMP_DECL, BYTE , int, char *, PFUNCTION ); /* generates the pcode for database field */ +static void hb_compGenVariablePCode( HB_COMP_DECL, BYTE , char * ); /* generates the pcode for undeclared variable */ -static void hb_compGenFieldPCode( BYTE , int, char *, PFUNCTION ); /* generates the pcode for database field */ -static void hb_compGenVariablePCode( BYTE , char * ); /* generates the pcode for undeclared variable */ +static PFUNCTION hb_compFunctionNew( HB_COMP_DECL, char *, HB_SYMBOLSCOPE ); /* creates and initialises the _FUNC structure */ +static void hb_compCheckDuplVars( HB_COMP_DECL, PVAR pVars, char * szVarName ); /*checks for duplicate variables definitions */ +static int hb_compProcessRSPFile( HB_COMP_DECL, char * ); /* process response file */ -static PFUNCTION hb_compFunctionNew( char *, HB_SYMBOLSCOPE ); /* creates and initialises the _FUNC structure */ -static void hb_compCheckDuplVars( PVAR pVars, char * szVarName ); /*checks for duplicate variables definitions */ -static int hb_compProcessRSPFile( char * ); /* process response file */ +static void hb_compOptimizeJumps( HB_COMP_DECL ); +static void hb_compOptimizeFrames( HB_COMP_DECL, PFUNCTION pFunc ); -static void hb_compOptimizeJumps( void ); -static void hb_compOptimizeFrames( PFUNCTION pFunc ); +static void hb_compDeclaredInit( HB_COMP_DECL ); -static void hb_compDeclaredInit( void ); +static int hb_compAutoOpen( HB_COMP_DECL, char * szPrg, BOOL * bSkipGen, BOOL bSingleFile ); /* global variables */ HB_COMP_PTR hb_comp_data; -FUNCTIONS hb_comp_functions; -FUNCTIONS hb_comp_funcalls; -SYMBOLS hb_comp_symbols; -PCOMDECLARED hb_comp_pFirstDeclared; -PCOMDECLARED hb_comp_pLastDeclared; -PCOMDECLARED hb_comp_pReleaseDeclared; - -PCOMCLASS hb_comp_pFirstClass; -PCOMCLASS hb_comp_pLastClass; -PCOMCLASS hb_comp_pReleaseClass; -char * hb_comp_szFromClass; -PCOMDECLARED hb_comp_pLastMethod; - -int hb_comp_iLine; /* currently processed line number (globaly) */ -char * hb_comp_szFile; /* Source file name of compiled module */ -PFUNCTION hb_comp_pInitFunc; -PHB_FNAME hb_comp_pMainFileName = NULL; -PHB_FNAME hb_comp_pFileName = NULL; -PHB_FNAME hb_comp_pFilePpo = NULL; - -BOOL hb_comp_bPPO = FALSE; /* flag indicating, is ppo output needed */ -BOOL hb_comp_bStartProc = TRUE; /* holds if we need to create the starting procedure */ -BOOL hb_comp_bLineNumbers = TRUE; /* holds if we need pcodes with line numbers */ -BOOL hb_comp_bQuiet = FALSE; /* quiet mode */ -BOOL hb_comp_bShortCuts = TRUE; /* .and. & .or. expressions shortcuts */ -int hb_comp_iWarnings = 0; /* enable parse warnings */ -BOOL hb_comp_bAnyWarning = FALSE; /* holds if there was any warning during the compilation process */ -BOOL hb_comp_bAutoMemvarAssume = FALSE; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ -BOOL hb_comp_bForceMemvars = FALSE; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ -BOOL hb_comp_bDebugInfo = FALSE; /* holds if generate debugger required info */ -char hb_comp_szPrefix[ 20 ] = { '\0' }; /* holds the prefix added to the generated symbol init function name (in C output currently) */ -int hb_comp_iGenCOutput = HB_COMPGENC_VERBOSE; /* C code generation should be verbose (use comments) or not */ -BOOL hb_comp_bNoStartUp = FALSE ; /* C code generation embed HB_FS_FIRST or not */ -int hb_comp_iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */ -int hb_comp_iFunctionCnt; -int hb_comp_iErrorCount; -char hb_comp_cVarType; /* current declared variable type */ -char hb_comp_cDataListType; /* current declared variable list type */ -char hb_comp_cCastType; /* current casting type */ -BOOL hb_comp_bDontGenLineNum = FALSE; /* suppress line number generation */ -ULONG hb_comp_ulLastLinePos; /* position of last opcode with line number */ -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; -PHB_FNAME hb_comp_pPpoPath = NULL; -BOOL hb_comp_bCredits = FALSE; /* print credits */ -BOOL hb_comp_bBuildInfo = FALSE; /* print build info */ -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; -char * hb_comp_szDeclaredFun = NULL; - -BOOL hb_comp_bAutoOpen = TRUE; -BOOL hb_comp_bError = FALSE; -char hb_comp_cInlineID = '0'; - -int hb_comp_iLineINLINE = 0; -int hb_comp_iLinePRG; -INLINES hb_comp_inlines; - -/* various compatibility flags (-k switch) */ -ULONG hb_comp_Supported; - FILE * hb_comp_errFile = NULL; -int hb_comp_iHidden; /* Hide Strings */ - - -/* EXTERNAL statement can be placed into any place in a function - this flag is - * used to suppress error report generation - */ -static BOOL hb_comp_bExternal = FALSE; -/* linked list with EXTERNAL symbols declarations - */ -static PEXTERN hb_comp_pExterns = NULL; -static PAUTOOPEN hb_comp_pAutoOpen = NULL; -static int hb_compAutoOpen( char * szPrg, BOOL * bSkipGen, BOOL bSingleFile ); - -/* -m Support */ -static BOOL hb_compAutoOpenFind( char * szName ); - -extern int yyparse( HB_COMP_PTR ); /* main yacc parsing function */ - -extern FILE *yyin ; -extern FILE *yyout ; -extern char *yytext ; -extern int yyleng ; -extern int yychar ; -extern void * yylval ; -#ifdef YYLSP_NEEDED - extern void * yylloc ; -#endif -extern int yynerrs ; - -extern void yyrestart( FILE * ); +extern int yyparse( HB_COMP_DECL ); /* main yacc parsing function */ /* ************************************************************************* */ int main( int argc, char * argv[] ) { + HB_COMP_DECL; int iStatus = EXIT_SUCCESS; int i; BOOL bAnyFiles; - HB_TRACE(HB_TR_DEBUG, ("main()")); - - hb_comp_data = hb_comp_new(); - - hb_comp_pOutPath = NULL; - #if defined( HOST_OS_UNIX_COMPATIBLE ) hb_comp_errFile = stderr; #else hb_comp_errFile = stdout; #endif - /* Activate Harbour extensions by default. */ - hb_comp_Supported = HB_COMPFLAG_HARBOUR | - HB_COMPFLAG_XBASE | - HB_COMPFLAG_HB_INLINE | - HB_COMPFLAG_OPTJUMP; + HB_TRACE(HB_TR_DEBUG, ("main()")); + + hb_comp_data = HB_COMP_PARAM = hb_comp_new(); + + HB_COMP_PARAM->pOutPath = NULL; /* First check the environment variables */ - hb_compChkCompilerSwitch( 0, NULL ); + hb_compChkCompilerSwitch( HB_COMP_PARAM, 0, NULL ); /* Then check command line arguments This will override duplicated environment settings */ - hb_compChkCompilerSwitch( argc, argv ); + hb_compChkCompilerSwitch( HB_COMP_PARAM, argc, argv ); - if( hb_comp_bLogo ) + if( HB_COMP_PARAM->fLogo ) hb_compPrintLogo(); - if( hb_comp_bBuildInfo ) + if( HB_COMP_PARAM->fBuildInfo ) { printf( "\n" ); hb_verBuildInfo(); return iStatus; } - if( hb_comp_bCredits ) + if( HB_COMP_PARAM->fCredits ) { hb_compPrintCredits(); return iStatus; } /* Set Search Path */ - hb_compChkPaths(); + hb_compChkPaths( HB_COMP_PARAM ); /* Set standard rules */ - hb_pp_SetRules( hb_comp_bQuiet, argc, argv ); + hb_compInitPP( HB_COMP_PARAM, argc, argv ); /* Prepare the table of identifiers */ - hb_compIdentifierOpen(); + hb_compIdentifierOpen( HB_COMP_PARAM ); /* Load standard Declarations. */ - if( hb_comp_iWarnings >= 3 ) - hb_compDeclaredInit(); + if( HB_COMP_PARAM->iWarnings >= 3 ) + hb_compDeclaredInit( HB_COMP_PARAM ); /* Process all files passed via the command line. */ @@ -263,28 +163,25 @@ int main( int argc, char * argv[] ) HB_TRACE(HB_TR_DEBUG, ("main LOOP(%i,%s)", i, argv[i])); if( ! HB_ISOPTSEP( argv[ i ][ 0 ] ) ) { - if( ! bAnyFiles ) - bAnyFiles = TRUE; - else /* Clear and reinitialize preprocessor state */ - hb_pp_reset( hb_comp_data->pLex->pPP ); + bAnyFiles = TRUE; if( argv[ i ][ 0 ] == '@' ) - iStatus = hb_compProcessRSPFile( argv[ i ] + 1 ); + iStatus = hb_compProcessRSPFile( HB_COMP_PARAM, argv[ i ] + 1 ); else - iStatus = hb_compCompile( argv[ i ], TRUE ); + iStatus = hb_compCompile( HB_COMP_PARAM, argv[ i ], TRUE ); if( iStatus != EXIT_SUCCESS ) break; } } - if( (! bAnyFiles ) && (! hb_comp_bQuiet) ) + if( ! bAnyFiles && ! HB_COMP_PARAM->fQuiet ) { hb_compPrintUsage( argv[ 0 ] ); iStatus = EXIT_FAILURE; } - if( hb_comp_iErrorCount > 0 ) + if( HB_COMP_PARAM->iErrorCount > 0 ) iStatus = EXIT_FAILURE; hb_compMainExit(); @@ -294,44 +191,45 @@ int main( int argc, char * argv[] ) void hb_compMainExit( void ) { + HB_COMP_DECL = hb_comp_data; static BOOL inProcess = FALSE; - if( inProcess ) + if( inProcess || !HB_COMP_PARAM ) return; inProcess = TRUE; - hb_compCompileEnd(); - hb_compIdentifierClose(); - hb_compParserStop( hb_comp_data ); + hb_compCompileEnd( HB_COMP_PARAM ); + hb_compIdentifierClose( HB_COMP_PARAM ); + hb_compParserStop( HB_COMP_PARAM ); - if( hb_comp_pOutPath ) + if( HB_COMP_PARAM->pOutPath ) { - hb_xfree( hb_comp_pOutPath ); - hb_comp_pOutPath = NULL; + hb_xfree( HB_COMP_PARAM->pOutPath ); + HB_COMP_PARAM->pOutPath = NULL; } - if( hb_comp_pPpoPath ) + if( HB_COMP_PARAM->pPpoPath ) { - hb_xfree( hb_comp_pPpoPath ); - hb_comp_pPpoPath = NULL; + hb_xfree( HB_COMP_PARAM->pPpoPath ); + HB_COMP_PARAM->pPpoPath = NULL; } - while( hb_comp_pAutoOpen ) + while( HB_COMP_PARAM->autoopen ) { - PAUTOOPEN pAutoOpen = hb_comp_pAutoOpen; + PAUTOOPEN pAutoOpen = HB_COMP_PARAM->autoopen; - hb_comp_pAutoOpen = hb_comp_pAutoOpen->pNext; + HB_COMP_PARAM->autoopen = HB_COMP_PARAM->autoopen->pNext; hb_xfree( pAutoOpen->szName ); hb_xfree( pAutoOpen ); } - hb_comp_free( hb_comp_data ); + hb_comp_free( HB_COMP_PARAM ); hb_comp_data = NULL; hb_xexit(); } -static int hb_compProcessRSPFile( char * szRspName ) +static int hb_compProcessRSPFile( HB_COMP_DECL, char * szRspName ) { char szFile[ _POSIX_PATH_MAX + 1 ]; int iStatus = EXIT_SUCCESS; @@ -356,9 +254,9 @@ static int hb_compProcessRSPFile( char * szRspName ) else { int i = 0, ch; - BOOL bAutoOpen = hb_comp_bAutoOpen; + BOOL bAutoOpen = HB_COMP_PARAM->fAutoOpen; - hb_comp_bAutoOpen = TRUE; + HB_COMP_PARAM->fAutoOpen = TRUE; do { @@ -387,7 +285,7 @@ static int hb_compProcessRSPFile( char * szRspName ) szFile[ i ] = '\0'; if( i > 0 ) - hb_compAutoOpenAdd( szFile ); + hb_compAutoOpenAdd( HB_COMP_PARAM, szFile ); i = 0; while( ch != EOF && ch != '\n' ) ch = fgetc( inFile ); @@ -397,12 +295,12 @@ static int hb_compProcessRSPFile( char * szRspName ) } while( ch != EOF ); - fclose ( inFile ); + fclose( inFile ); - hb_comp_bAutoOpen = bAutoOpen; + HB_COMP_PARAM->fAutoOpen = bAutoOpen; hb_fsFNameMerge( szFile, pFileName ); - hb_compCompile( szFile, FALSE ); + hb_compCompile( HB_COMP_PARAM, szFile, FALSE ); } hb_xfree( pFileName ); @@ -427,6 +325,7 @@ int isatty( int handle ) reasonable size */ /* #undef HB_FM_STATISTICS */ + #ifdef HB_FM_STATISTICS #define HB_MEMINFO_SIGNATURE 0xDEADBEAF @@ -457,9 +356,13 @@ static LONG s_ulMemoryConsumed = 0; /* memory max size consumed */ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on failure */ { -#ifdef HB_FM_STATISTICS - void * pMem = malloc( ulSize + HB_MEMINFO_SIZE + sizeof( UINT32 ) ); + void * pMem; + if( ulSize == 0 ) + hb_errInternal( HB_EI_XGRABNULLSIZE, "hb_xgrab requested to allocate zero bytes", NULL, NULL ); + +#ifdef HB_FM_STATISTICS + pMem = malloc( ulSize + HB_MEMINFO_SIZE + sizeof( UINT32 ) ); if( pMem ) { if( s_pMemBlocks ) @@ -479,17 +382,12 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on failu s_ulMemoryMaxBlocks = s_ulMemoryBlocks; pMem = ( BYTE * ) pMem + HB_MEMINFO_SIZE; } + else #else - void * pMem = malloc( ulSize ); -#endif - + pMem = malloc( ulSize ); if( ! pMem ) - { - char szSize[ 32 ]; - - sprintf( szSize, "%lu", ulSize ); - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMALLOC, szSize, NULL ); - } +#endif + hb_errInternal( HB_EI_XGRABALLOC, "hb_xgrab can't allocate memory", NULL, NULL ); return pMem; } @@ -514,10 +412,10 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ ulMemSize = pMemBlock->ulSize; if( pMemBlock->Signature != HB_MEMINFO_SIGNATURE ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMCORRUPT, NULL, NULL ); + hb_errInternal( HB_EI_XREALLOCINV, "hb_xrealloc called with an invalid pointer", NULL, NULL ); if( HB_GET_LE_UINT32( ( ( BYTE * ) pMem ) + ulMemSize ) != HB_MEMINFO_SIGNATURE ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMOVERFLOW, NULL, NULL ); + hb_errInternal( HB_EI_XMEMOVERFLOW, "Memory buffer overflow", NULL, NULL ); HB_PUT_LE_UINT32( ( ( BYTE * ) pMem ) + ulMemSize, 0 ); @@ -545,12 +443,7 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ #endif if( ! pResult && ulSize ) - { - char szSize[ 32 ]; - - sprintf( szSize, "%lu", ulSize ); - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMREALLOC, szSize, NULL ); - } + hb_errInternal( HB_EI_XREALLOC, "hb_xrealloc can't reallocate memory", NULL, NULL ); return pResult; } @@ -563,10 +456,10 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ PHB_MEMINFO pMemBlock = ( PHB_MEMINFO ) ( ( BYTE * ) pMem - HB_MEMINFO_SIZE ); if( pMemBlock->Signature != HB_MEMINFO_SIGNATURE ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMCORRUPT, NULL, NULL ); + hb_errInternal( HB_EI_XFREEINV, "hb_xfree called with an invalid pointer", NULL, NULL ); if( HB_GET_LE_UINT32( ( ( BYTE * ) pMem ) + pMemBlock->ulSize ) != HB_MEMINFO_SIGNATURE ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMOVERFLOW, NULL, NULL ); + hb_errInternal( HB_EI_XMEMOVERFLOW, "Memory buffer overflow", NULL, NULL ); s_ulMemoryConsumed -= pMemBlock->ulSize; s_ulMemoryBlocks--; @@ -585,7 +478,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ free( pMem ); } else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMFREE, NULL, NULL ); + hb_errInternal( HB_EI_XFREENULL, "hb_xfree called with a NULL pointer", NULL, NULL ); } ULONG hb_xquery( USHORT uiMode ) @@ -698,6 +591,26 @@ char * hb_conNewLine( void ) return "\n"; } +/* NOTE: Use as minimal calls from here, as possible. + Don't allocate memory from this function. [vszakats] */ +void hb_errInternal( ULONG ulIntCode, const char * szText, const char * szPar1, const char * szPar2 ) +{ + char buffer[ 1024 ]; + + HB_TRACE(HB_TR_DEBUG, ("hb_errInternal(%lu, %s, %s, %s)", ulIntCode, szText, szPar1, szPar2)); + + hb_conOutErr( hb_conNewLine(), 0 ); + sprintf( buffer, "Unrecoverable error %lu: ", ulIntCode ); + hb_conOutErr( buffer, 0 ); + if( szText ) + { + sprintf( buffer, szText, szPar1, szPar2 ); + hb_conOutErr( buffer, 0 ); + } + hb_conOutErr( hb_conNewLine(), 0 ); + exit( EXIT_FAILURE ); +} + /* ------------------------------------------------------------------------- */ /** ACTIONS **/ /* ------------------------------------------------------------------------- */ @@ -708,21 +621,21 @@ char * hb_conNewLine( void ) * as they have to be placed on the symbol table later than the first * public symbol */ -PFUNCTION hb_compFunCallAdd( char * szFunctionName ) +PFUNCTION hb_compFunCallAdd( HB_COMP_DECL, char * szFunctionName ) { - PFUNCTION pFunc = hb_compFunctionNew( szFunctionName, 0 ); + PFUNCTION pFunc = hb_compFunctionNew( HB_COMP_PARAM, szFunctionName, 0 ); - if( ! hb_comp_funcalls.iCount ) + if( ! HB_COMP_PARAM->funcalls.iCount ) { - hb_comp_funcalls.pFirst = pFunc; - hb_comp_funcalls.pLast = pFunc; + HB_COMP_PARAM->funcalls.pFirst = pFunc; + HB_COMP_PARAM->funcalls.pLast = pFunc; } else { - ( ( PFUNCTION ) hb_comp_funcalls.pLast )->pNext = pFunc; - hb_comp_funcalls.pLast = pFunc; + ( ( PFUNCTION ) HB_COMP_PARAM->funcalls.pLast )->pNext = pFunc; + HB_COMP_PARAM->funcalls.pLast = pFunc; } - hb_comp_funcalls.iCount++; + HB_COMP_PARAM->funcalls.iCount++; return pFunc; } @@ -732,14 +645,14 @@ PFUNCTION hb_compFunCallAdd( char * szFunctionName ) * as they have to be placed on the symbol table later than the first * public symbol */ -void hb_compExternAdd( char * szExternName ) /* defines a new extern name */ +void hb_compExternAdd( HB_COMP_DECL, char * szExternName ) /* defines a new extern name */ { PEXTERN pExtern = ( PEXTERN ) hb_xgrab( sizeof( _EXTERN ) ), pLast; if( strcmp( "_GET_", szExternName ) == 0 ) { /* special function to implement @ GET statement */ - hb_compExternAdd( hb_strdup("__GETA") ); + hb_compExternAdd( HB_COMP_PARAM, hb_strdup("__GETA") ); pExtern->szName = hb_strdup("__GET"); } else @@ -748,32 +661,32 @@ void hb_compExternAdd( char * szExternName ) /* defines a new extern name */ } pExtern->pNext = NULL; - if( hb_comp_pExterns == NULL ) - hb_comp_pExterns = pExtern; + if( HB_COMP_PARAM->externs == NULL ) + HB_COMP_PARAM->externs = pExtern; else { - pLast = hb_comp_pExterns; + pLast = HB_COMP_PARAM->externs; while( pLast->pNext ) pLast = pLast->pNext; pLast->pNext = pExtern; } - hb_comp_bExternal = TRUE; + HB_COMP_PARAM->fExternal = TRUE; } -void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType ) +void hb_compDeclaredParameterAdd( HB_COMP_DECL, char * szVarName, BYTE cValueType ) { /* Nothing to do since no warnings requested.*/ - if ( hb_comp_iWarnings < 3 ) + if ( HB_COMP_PARAM->iWarnings < 3 ) { HB_SYMBOL_UNUSED( szVarName ); return; } /* Either a Declared Function Parameter or a Declared Method Parameter. */ - if( hb_comp_szDeclaredFun ) + if( HB_COMP_PARAM->szDeclaredFun ) { /* Find the Declared Function owner of this parameter. */ - PCOMDECLARED pDeclared = hb_compDeclaredFind( hb_comp_szDeclaredFun ); + PCOMDECLARED pDeclared = hb_compDeclaredFind( HB_COMP_PARAM, HB_COMP_PARAM->szDeclaredFun ); if ( pDeclared ) { @@ -794,61 +707,61 @@ void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType ) if ( toupper( cValueType ) == 'S' ) { - pDeclared->pParamClasses[ pDeclared->iParamCount - 1 ] = hb_compClassFind( hb_comp_szFromClass ); + pDeclared->pParamClasses[ pDeclared->iParamCount - 1 ] = hb_compClassFind( HB_COMP_PARAM, HB_COMP_PARAM->szFromClass ); /* Resetting */ - hb_comp_szFromClass = NULL; + HB_COMP_PARAM->szFromClass = NULL; } } } else /* Declared Method Parameter */ { /* - 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 ); + printf( "\nAdding parameter: %s Type: %c In Method: %s Class: %s FROM CLASS: %s\n", szVarName, cValueType, HB_COMP_PARAM->pLastMethod->szName, HB_COMP_PARAM->pLastClass->szName, HB_COMP_PARAM->szFromClass ); */ - hb_comp_pLastMethod->iParamCount++; + HB_COMP_PARAM->pLastMethod->iParamCount++; - if ( hb_comp_pLastMethod->cParamTypes ) + if ( HB_COMP_PARAM->pLastMethod->cParamTypes ) { - hb_comp_pLastMethod->cParamTypes = ( BYTE * ) hb_xrealloc( hb_comp_pLastMethod->cParamTypes, hb_comp_pLastMethod->iParamCount ); - hb_comp_pLastMethod->pParamClasses = ( PCOMCLASS * ) hb_xrealloc( hb_comp_pLastMethod->pParamClasses, hb_comp_pLastMethod->iParamCount * sizeof( COMCLASS ) ); + HB_COMP_PARAM->pLastMethod->cParamTypes = ( BYTE * ) hb_xrealloc( HB_COMP_PARAM->pLastMethod->cParamTypes, HB_COMP_PARAM->pLastMethod->iParamCount ); + HB_COMP_PARAM->pLastMethod->pParamClasses = ( PCOMCLASS * ) hb_xrealloc( HB_COMP_PARAM->pLastMethod->pParamClasses, HB_COMP_PARAM->pLastMethod->iParamCount * sizeof( COMCLASS ) ); } else { - hb_comp_pLastMethod->cParamTypes = ( BYTE * ) hb_xgrab( 1 ); - hb_comp_pLastMethod->pParamClasses = ( PCOMCLASS * ) hb_xgrab( sizeof( COMCLASS ) ); + HB_COMP_PARAM->pLastMethod->cParamTypes = ( BYTE * ) hb_xgrab( 1 ); + HB_COMP_PARAM->pLastMethod->pParamClasses = ( PCOMCLASS * ) hb_xgrab( sizeof( COMCLASS ) ); } - hb_comp_pLastMethod->cParamTypes[ hb_comp_pLastMethod->iParamCount - 1 ] = cValueType; + HB_COMP_PARAM->pLastMethod->cParamTypes[ HB_COMP_PARAM->pLastMethod->iParamCount - 1 ] = cValueType; if ( toupper( cValueType ) == 'S' ) { - hb_comp_pLastMethod->pParamClasses[ hb_comp_pLastMethod->iParamCount - 1 ] = hb_compClassFind( hb_comp_szFromClass ); + HB_COMP_PARAM->pLastMethod->pParamClasses[ HB_COMP_PARAM->pLastMethod->iParamCount - 1 ] = hb_compClassFind( HB_COMP_PARAM, HB_COMP_PARAM->szFromClass ); /* - printf( "\nParameter: %s FROM CLASS: %s\n", szVarName, hb_comp_pLastMethod->pParamClasses[ hb_comp_pLastMethod->iParamCount - 1 ]->szName ); + printf( "\nParameter: %s FROM CLASS: %s\n", szVarName, HB_COMP_PARAM->pLastMethod->pParamClasses[ HB_COMP_PARAM->pLastMethod->iParamCount - 1 ]->szName ); */ /* Resetting */ - hb_comp_szFromClass = NULL; + HB_COMP_PARAM->szFromClass = NULL; } } } -void hb_compVariableAdd( char * szVarName, BYTE cValueType ) +void hb_compVariableAdd( HB_COMP_DECL, char * szVarName, BYTE cValueType ) { PVAR pVar, pLastVar; - PFUNCTION pFunc = hb_comp_functions.pLast; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; BOOL bFreeVar = TRUE; HB_SYMBOL_UNUSED( cValueType ); - if( ! hb_comp_bStartProc && hb_comp_functions.iCount <= 1 && hb_comp_iVarScope == VS_LOCAL ) + if( ! HB_COMP_PARAM->fStartProc && HB_COMP_PARAM->functions.iCount <= 1 && HB_COMP_PARAM->iVarScope == VS_LOCAL ) { /* 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 ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL ); return; } @@ -856,28 +769,28 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) * executable statements * Note: FIELD and MEMVAR are executable statements */ - if( ( hb_comp_functions.pLast->bFlags & FUN_STATEMENTS ) && !( hb_comp_iVarScope == VS_FIELD || ( hb_comp_iVarScope & VS_MEMVAR ) ) ) + if( ( HB_COMP_PARAM->functions.pLast->bFlags & FUN_STATEMENTS ) && !( HB_COMP_PARAM->iVarScope == VS_FIELD || ( HB_COMP_PARAM->iVarScope & VS_MEMVAR ) ) ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_FOLLOWS_EXEC, ( hb_comp_iVarScope == VS_LOCAL ? "LOCAL" : "STATIC" ), NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FOLLOWS_EXEC, ( HB_COMP_PARAM->iVarScope == VS_LOCAL ? "LOCAL" : "STATIC" ), NULL ); } /* Check if a declaration of duplicated variable name is requested */ if( pFunc->szName ) { /* variable defined in a function/procedure */ - hb_compCheckDuplVars( pFunc->pFields, szVarName ); - hb_compCheckDuplVars( pFunc->pStatics, szVarName ); + hb_compCheckDuplVars( HB_COMP_PARAM, pFunc->pFields, szVarName ); + hb_compCheckDuplVars( HB_COMP_PARAM, pFunc->pStatics, szVarName ); /*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 ); + if( !( HB_COMP_PARAM->iVarScope == VS_PRIVATE || HB_COMP_PARAM->iVarScope == VS_PUBLIC ) ) + hb_compCheckDuplVars( HB_COMP_PARAM, pFunc->pMemvars, szVarName ); } else /* variable defined in a codeblock */ - hb_comp_iVarScope = VS_PARAMETER; + HB_COMP_PARAM->iVarScope = VS_PARAMETER; - hb_compCheckDuplVars( pFunc->pLocals, szVarName ); + hb_compCheckDuplVars( HB_COMP_PARAM, pFunc->pLocals, szVarName ); pVar = ( PVAR ) hb_xgrab( sizeof( VAR ) ); pVar->szName = szVarName; @@ -885,36 +798,36 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) pVar->cType = cValueType; pVar->iUsed = VU_NOT_USED; pVar->pNext = NULL; - pVar->iDeclLine = hb_comp_iLine - 1; + pVar->iDeclLine = hb_pp_line( HB_COMP_PARAM->pLex->pPP ); if ( toupper( cValueType ) == 'S' ) { /* - printf( "\nVariable %s is of Class: %s\n", szVarName, hb_comp_szFromClass ); + printf( "\nVariable %s is of Class: %s\n", szVarName, HB_COMP_PARAM->szFromClass ); */ - pVar->pClass = hb_compClassFind( hb_comp_szFromClass ); + pVar->pClass = hb_compClassFind( HB_COMP_PARAM, HB_COMP_PARAM->szFromClass ); if( ! pVar->pClass ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, hb_comp_szFromClass, szVarName ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, szVarName ); pVar->cType = 'O'; } /* Resetting */ - hb_comp_szFromClass = NULL; + HB_COMP_PARAM->szFromClass = NULL; } - if ( hb_comp_iVarScope & VS_PARAMETER ) + if ( HB_COMP_PARAM->iVarScope & VS_PARAMETER ) pVar->iUsed = VU_INITIALIZED; - if( hb_comp_iVarScope & VS_MEMVAR ) + if( HB_COMP_PARAM->iVarScope & VS_MEMVAR ) { PCOMSYMBOL pSym; USHORT wPos; /*printf( "\nAdding: %s in Function: %s\n", pVar->szName, pFunc->szName );*/ - if( hb_comp_bAutoMemvarAssume || hb_comp_iVarScope == VS_MEMVAR ) + if( HB_COMP_PARAM->fAutoMemvarAssume || HB_COMP_PARAM->iVarScope == VS_MEMVAR ) { /* add this variable to the list of MEMVAR variables */ @@ -922,7 +835,7 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) pFunc->pMemvars = pVar; else { - hb_compCheckDuplVars( pFunc->pMemvars, szVarName ); + hb_compCheckDuplVars( HB_COMP_PARAM, pFunc->pMemvars, szVarName ); pLastVar = pFunc->pMemvars; while( pLastVar->pNext ) @@ -932,7 +845,7 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) bFreeVar = FALSE; } - switch( hb_comp_iVarScope ) + switch( HB_COMP_PARAM->iVarScope ) { case VS_MEMVAR: /* variable declared in MEMVAR statement */ @@ -940,23 +853,23 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) case ( VS_PARAMETER | VS_PRIVATE ): { - if( ++hb_comp_functions.pLast->wParamNum > hb_comp_functions.pLast->wParamCount ) + if( ++HB_COMP_PARAM->functions.pLast->wParamNum > HB_COMP_PARAM->functions.pLast->wParamCount ) { - hb_comp_functions.pLast->wParamCount = hb_comp_functions.pLast->wParamNum; + HB_COMP_PARAM->functions.pLast->wParamCount = HB_COMP_PARAM->functions.pLast->wParamNum; } - pSym = hb_compSymbolFind( szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */ + pSym = hb_compSymbolFind( HB_COMP_PARAM, szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */ if( ! pSym ) - pSym = hb_compSymbolAdd( szVarName, &wPos, HB_SYM_MEMVAR ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szVarName, &wPos, HB_SYM_MEMVAR ); pSym->cScope |= VS_MEMVAR; /*printf( "\nAdded Symbol: %s Pos: %i\n", pSym->szName, wPos );*/ - hb_compGenPCode4( HB_P_PARAMETER, HB_LOBYTE( wPos ), HB_HIBYTE( wPos ), HB_LOBYTE( hb_comp_functions.pLast->wParamNum ), ( BOOL ) 0 ); + hb_compGenPCode4( HB_P_PARAMETER, HB_LOBYTE( wPos ), HB_HIBYTE( wPos ), HB_LOBYTE( HB_COMP_PARAM->functions.pLast->wParamNum ), HB_COMP_PARAM ); } - if ( hb_comp_iWarnings >= 3 ) + if ( HB_COMP_PARAM->iWarnings >= 3 ) { PVAR pMemVar = pFunc->pMemvars; @@ -993,16 +906,16 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) case VS_PRIVATE: { - pSym = hb_compSymbolFind( szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */ + pSym = hb_compSymbolFind( HB_COMP_PARAM, szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */ if( ! pSym ) - pSym = hb_compSymbolAdd( szVarName, &wPos, HB_SYM_MEMVAR ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szVarName, &wPos, HB_SYM_MEMVAR ); pSym->cScope |= VS_MEMVAR; /*printf( "\nAdded Symbol: %s Pos: %i\n", pSym->szName, wPos );*/ } - if ( hb_comp_iWarnings >= 3 ) + if ( HB_COMP_PARAM->iWarnings >= 3 ) { PVAR pMemVar = pFunc->pMemvars; @@ -1039,9 +952,9 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) case VS_PUBLIC: { - pSym = hb_compSymbolFind( szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */ + pSym = hb_compSymbolFind( HB_COMP_PARAM, szVarName, &wPos, HB_SYM_MEMVAR ); /* check if symbol exists already */ if( ! pSym ) - pSym = hb_compSymbolAdd( szVarName, &wPos, HB_SYM_MEMVAR ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szVarName, &wPos, HB_SYM_MEMVAR ); pSym->cScope |= VS_MEMVAR; if( bFreeVar ) { @@ -1054,7 +967,7 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) } else { - switch( hb_comp_iVarScope ) + switch( HB_COMP_PARAM->iVarScope ) { case VS_LOCAL: case VS_PARAMETER: @@ -1074,12 +987,12 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) pLastVar->pNext = pVar; wLocal++; } - if( hb_comp_iVarScope == VS_PARAMETER ) + if( HB_COMP_PARAM->iVarScope == VS_PARAMETER ) { - ++hb_comp_functions.pLast->wParamCount; - hb_comp_functions.pLast->bFlags |= FUN_USES_LOCAL_PARAMS; + ++HB_COMP_PARAM->functions.pLast->wParamCount; + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_LOCAL_PARAMS; } - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) { BYTE * pBuffer; @@ -1091,7 +1004,7 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) memcpy( ( BYTE * ) ( & ( pBuffer[3] ) ), szVarName, strlen( szVarName ) + 1 ); - hb_compGenPCodeN( pBuffer, strlen( szVarName ) + 4 , 0 ); + hb_compGenPCodeN( pBuffer, strlen( szVarName ) + 4 , HB_COMP_PARAM ); hb_xfree( pBuffer ); } @@ -1129,24 +1042,24 @@ void hb_compVariableAdd( char * szVarName, BYTE cValueType ) } } -void hb_compGenStaticName( char *szVarName ) +void hb_compGenStaticName( char *szVarName, HB_COMP_DECL ) { - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) { BYTE bGlobal = 0; PFUNCTION pFunc; BYTE * pBuffer; int iVar; - if( ! hb_comp_bStartProc && hb_comp_functions.iCount <= 1 ) + if( ! HB_COMP_PARAM->fStartProc && HB_COMP_PARAM->functions.iCount <= 1 ) { /* Variable declaration is outside of function/procedure body. File-wide static variable */ - hb_compStaticDefStart(); + hb_compStaticDefStart( HB_COMP_PARAM ); bGlobal = 1; } - pFunc = hb_comp_functions.pLast; + pFunc = HB_COMP_PARAM->functions.pLast; pBuffer = ( BYTE * ) hb_xgrab( strlen( szVarName ) + 5 ); iVar = hb_compStaticGetPos( szVarName, pFunc ); @@ -1157,12 +1070,12 @@ void hb_compGenStaticName( char *szVarName ) memcpy( ( BYTE * ) ( & ( pBuffer[4] ) ), szVarName, strlen( szVarName ) + 1 ); - hb_compGenPCodeN( pBuffer, strlen( szVarName ) + 5 , 0 ); + hb_compGenPCodeN( pBuffer, strlen( szVarName ) + 5, HB_COMP_PARAM ); hb_xfree( pBuffer ); if( bGlobal ) - hb_compStaticDefEnd(); + hb_compStaticDefEnd( HB_COMP_PARAM ); } } @@ -1170,26 +1083,26 @@ void hb_compGenStaticName( char *szVarName ) * expression. * Only MEMVAR or undeclared (memvar will be assumed) variables can be used. */ -BOOL hb_compIsValidMacroVar( char * szVarName ) +BOOL hb_compIsValidMacroVar( char * szVarName, HB_COMP_DECL ) { BOOL bValid = FALSE; - if( hb_compLocalGetPos( szVarName ) ) - ;/* hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ - else if( hb_compStaticGetPos( szVarName, hb_comp_functions.pLast ) > 0 ) - ;/* hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ - else if( hb_compFieldGetPos( szVarName, hb_comp_functions.pLast ) > 0 ) - ;/* hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ - else if( ! hb_comp_bStartProc ) + if( hb_compLocalGetPos( HB_COMP_PARAM, szVarName ) ) + ;/* hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ + else if( hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pLast ) > 0 ) + ;/* hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ + else if( hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pLast ) > 0 ) + ;/* hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ + else if( ! HB_COMP_PARAM->fStartProc ) { - if( hb_compMemvarGetPos( szVarName, hb_comp_functions.pLast ) == 0 ) + if( hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pLast ) == 0 ) { /* This is not a local MEMVAR */ - if( hb_compFieldGetPos( szVarName, hb_comp_functions.pFirst ) > 0 ) - ; /*hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ - else if( hb_compStaticGetPos( szVarName, hb_comp_functions.pFirst ) > 0 ) - ; /*hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ + if( hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ) > 0 ) + ; /*hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ + else if( hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ) > 0 ) + ; /*hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szVarName, NULL );*/ else bValid = TRUE; /* undeclared variable */ } @@ -1201,49 +1114,48 @@ BOOL hb_compIsValidMacroVar( char * szVarName ) return bValid; } -int hb_compVariableScope( char * szVarName ) +int hb_compVariableScope( HB_COMP_DECL, char * szVarName ) { - int iScope = 0; /* undeclared */ - int iLocalPos; + int iScope = 0; /* undeclared */ + int iLocalPos; - iLocalPos = hb_compLocalGetPos( szVarName ); - if( iLocalPos > 0 ) - iScope = HB_VS_LOCAL_VAR; - else if( iLocalPos < 0 ) - iScope = HB_VS_CBLOCAL_VAR; - else if( hb_compStaticGetPos( szVarName, hb_comp_functions.pLast ) > 0 ) - iScope = HB_VS_STATIC_VAR; - else if( hb_compFieldGetPos( szVarName, hb_comp_functions.pLast ) > 0 ) - iScope = HB_VS_LOCAL_FIELD; - else if( hb_compMemvarGetPos( szVarName, hb_comp_functions.pLast ) > 0 ) + iLocalPos = hb_compLocalGetPos( HB_COMP_PARAM, szVarName ); + if( iLocalPos > 0 ) + iScope = HB_VS_LOCAL_VAR; + else if( iLocalPos < 0 ) + iScope = HB_VS_CBLOCAL_VAR; + else if( hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pLast ) > 0 ) + iScope = HB_VS_STATIC_VAR; + else if( hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pLast ) > 0 ) + iScope = HB_VS_LOCAL_FIELD; + else if( hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pLast ) > 0 ) iScope = HB_VS_LOCAL_MEMVAR; - else if( ! hb_comp_bStartProc ) - { - /* Check file-wide variables - */ - if( hb_compMemvarGetPos( szVarName, hb_comp_functions.pFirst ) > 0 ) - iScope = HB_VS_GLOBAL_MEMVAR; - else if( hb_compFieldGetPos( szVarName, hb_comp_functions.pFirst ) > 0 ) - iScope = HB_VS_GLOBAL_FIELD; - else if( hb_compStaticGetPos( szVarName, hb_comp_functions.pFirst ) > 0 ) - iScope = HB_VS_GLOBAL_STATIC; - } - return iScope; + else if( ! HB_COMP_PARAM->fStartProc ) + { + /* Check file-wide variables */ + if( hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ) > 0 ) + iScope = HB_VS_GLOBAL_MEMVAR; + else if( hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ) > 0 ) + iScope = HB_VS_GLOBAL_FIELD; + else if( hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ) > 0 ) + iScope = HB_VS_GLOBAL_STATIC; + } + return iScope; } -PCOMCLASS hb_compClassAdd( char * szClassName ) +PCOMCLASS hb_compClassAdd( HB_COMP_DECL, char * szClassName ) { PCOMCLASS pClass; PCOMDECLARED pDeclared; /*printf( "Declaring Class: %s\n", szClassName );*/ - if ( hb_comp_iWarnings < 3 ) + if ( HB_COMP_PARAM->iWarnings < 3 ) return NULL; - if ( ( pClass = hb_compClassFind( szClassName ) ) != NULL ) + if ( ( pClass = hb_compClassFind( HB_COMP_PARAM, szClassName ) ) != NULL ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_DUP_DECLARATION, "Class", szClassName ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_DUP_DECLARATION, "Class", szClassName ); return pClass; } @@ -1253,31 +1165,31 @@ PCOMCLASS hb_compClassAdd( char * szClassName ) pClass->pMethod = NULL; pClass->pNext = NULL; - if ( hb_comp_pFirstClass == NULL ) - hb_comp_pFirstClass = pClass; + if ( HB_COMP_PARAM->pFirstClass == NULL ) + HB_COMP_PARAM->pFirstClass = pClass; else - hb_comp_pLastClass->pNext = pClass; + HB_COMP_PARAM->pLastClass->pNext = pClass; - hb_comp_pLastClass = pClass; + HB_COMP_PARAM->pLastClass = pClass; /* Auto declaration for the Class Function. */ - pDeclared = hb_compDeclaredAdd( szClassName ); + pDeclared = hb_compDeclaredAdd( HB_COMP_PARAM, szClassName ); pDeclared->cType = 'S'; pDeclared->pClass = pClass; - if( ! hb_comp_pReleaseClass ) + if( ! HB_COMP_PARAM->pReleaseClass ) { - hb_comp_pReleaseClass = pClass; + HB_COMP_PARAM->pReleaseClass = pClass; } return pClass; } -PCOMCLASS hb_compClassFind( char * szClassName ) +PCOMCLASS hb_compClassFind( HB_COMP_DECL, char * szClassName ) { - PCOMCLASS pClass = hb_comp_pFirstClass; + PCOMCLASS pClass = HB_COMP_PARAM->pFirstClass; - if ( hb_comp_iWarnings < 3 ) + if ( HB_COMP_PARAM->iWarnings < 3 ) return NULL; while( pClass ) @@ -1295,18 +1207,18 @@ PCOMCLASS hb_compClassFind( char * szClassName ) return NULL; } -PCOMDECLARED hb_compMethodAdd( PCOMCLASS pClass, char * szMethodName ) +PCOMDECLARED hb_compMethodAdd( HB_COMP_DECL, PCOMCLASS pClass, char * szMethodName ) { PCOMDECLARED pMethod; /*printf( "\nDeclaring Method: %s of Class: %s Pointer: %li\n", szMethodName, pClass->szName, pClass );*/ - if ( hb_comp_iWarnings < 3 ) + if ( HB_COMP_PARAM->iWarnings < 3 ) return NULL; if ( ( pMethod = hb_compMethodFind( pClass, szMethodName ) ) != NULL ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_DUP_DECLARATION, "Method", szMethodName ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_DUP_DECLARATION, "Method", szMethodName ); /* Last Declaration override previous declarations */ pMethod->cParamTypes = NULL; @@ -1332,7 +1244,7 @@ PCOMDECLARED hb_compMethodAdd( PCOMCLASS pClass, char * szMethodName ) pClass->pLastMethod = pMethod; - hb_comp_pLastMethod = pMethod; + HB_COMP_PARAM->pLastMethod = pMethod; return pMethod; } @@ -1359,7 +1271,7 @@ PCOMDECLARED hb_compMethodFind( PCOMCLASS pClass, char * szMethodName ) return NULL; } -void hb_compDeclaredInit( void ) +void hb_compDeclaredInit( HB_COMP_DECL ) { #define _DECL static COMDECLARED @@ -1771,27 +1683,27 @@ void hb_compDeclaredInit( void ) /* ------- */ - hb_comp_pFirstDeclared = &s_267; /* Change to BOTTOM Function. */ - hb_comp_pLastDeclared = &s_001; - hb_comp_pReleaseDeclared = NULL; + HB_COMP_PARAM->pFirstDeclared = &s_267; /* Change to BOTTOM Function. */ + HB_COMP_PARAM->pLastDeclared = &s_001; + HB_COMP_PARAM->pReleaseDeclared = NULL; - hb_comp_pFirstClass = &s_TBROWSE; - hb_comp_pLastClass = &s_ERROR; - hb_comp_pReleaseClass = NULL; + HB_COMP_PARAM->pFirstClass = &s_TBROWSE; + HB_COMP_PARAM->pLastClass = &s_ERROR; + HB_COMP_PARAM->pReleaseClass = NULL; } -PCOMDECLARED hb_compDeclaredAdd( char * szDeclaredName ) +PCOMDECLARED hb_compDeclaredAdd( HB_COMP_DECL, char * szDeclaredName ) { PCOMDECLARED pDeclared; - if ( hb_comp_iWarnings < 3 ) + if ( HB_COMP_PARAM->iWarnings < 3 ) return NULL; /*printf( "\nDeclaring Function: %s\n", szDeclaredName, NULL );*/ - if ( ( pDeclared = hb_compDeclaredFind( szDeclaredName ) ) != NULL ) + if ( ( pDeclared = hb_compDeclaredFind( HB_COMP_PARAM, szDeclaredName ) ) != NULL ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_DUP_DECLARATION, "Function", szDeclaredName ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_DUP_DECLARATION, "Function", szDeclaredName ); /* Last declaration will take effect. */ pDeclared->cType = ' '; /* Not known yet */ @@ -1811,17 +1723,17 @@ PCOMDECLARED hb_compDeclaredAdd( char * szDeclaredName ) pDeclared->pParamClasses = NULL; pDeclared->pNext = NULL; - hb_comp_pLastDeclared->pNext = pDeclared; - hb_comp_pLastDeclared = pDeclared; - if( ! hb_comp_pReleaseDeclared ) + HB_COMP_PARAM->pLastDeclared->pNext = pDeclared; + HB_COMP_PARAM->pLastDeclared = pDeclared; + if( ! HB_COMP_PARAM->pReleaseDeclared ) { - hb_comp_pReleaseDeclared = pDeclared; + HB_COMP_PARAM->pReleaseDeclared = pDeclared; } return pDeclared; } -PCOMSYMBOL hb_compSymbolAdd( char * szSymbolName, USHORT * pwPos, BOOL bFunction ) +PCOMSYMBOL hb_compSymbolAdd( HB_COMP_DECL, char * szSymbolName, USHORT * pwPos, BOOL bFunction ) { PCOMSYMBOL pSym; @@ -1835,24 +1747,24 @@ PCOMSYMBOL hb_compSymbolAdd( char * szSymbolName, USHORT * pwPos, BOOL bFunction pSym->szName = szSymbolName; pSym->cScope = 0; /* HB_FS_PUBLIC; */ - pSym->cType = hb_comp_cVarType; + pSym->cType = HB_COMP_PARAM->cVarType; pSym->pNext = NULL; pSym->bFunc = bFunction; - if( ! hb_comp_symbols.iCount ) + if( ! HB_COMP_PARAM->symbols.iCount ) { - hb_comp_symbols.pFirst = pSym; - hb_comp_symbols.pLast = pSym; + HB_COMP_PARAM->symbols.pFirst = pSym; + HB_COMP_PARAM->symbols.pLast = pSym; } else { - ( ( PCOMSYMBOL ) hb_comp_symbols.pLast )->pNext = pSym; - hb_comp_symbols.pLast = pSym; + ( ( PCOMSYMBOL ) HB_COMP_PARAM->symbols.pLast )->pNext = pSym; + HB_COMP_PARAM->symbols.pLast = pSym; } - hb_comp_symbols.iCount++; + HB_COMP_PARAM->symbols.iCount++; if( pwPos ) - *pwPos = hb_comp_symbols.iCount -1; /* position number starts form 0 */ + *pwPos = HB_COMP_PARAM->symbols.iCount -1; /* position number starts form 0 */ } else pSym = NULL; @@ -1863,7 +1775,7 @@ PCOMSYMBOL hb_compSymbolAdd( char * szSymbolName, USHORT * pwPos, BOOL bFunction /* * This function creates and initialises the _FUNC structure */ -static PFUNCTION hb_compFunctionNew( char * szName, HB_SYMBOLSCOPE cScope ) +static PFUNCTION hb_compFunctionNew( HB_COMP_DECL, char * szName, HB_SYMBOLSCOPE cScope ) { PFUNCTION pFunc; @@ -1881,7 +1793,7 @@ static PFUNCTION hb_compFunctionNew( char * szName, HB_SYMBOLSCOPE cScope ) pFunc->pNext = NULL; pFunc->wParamCount = 0; pFunc->wParamNum = 0; - pFunc->iStaticsBase = hb_comp_iStaticCnt; + pFunc->iStaticsBase = HB_COMP_PARAM->iStaticCnt; pFunc->pOwner = NULL; pFunc->bFlags = 0; pFunc->iNOOPs = 0; @@ -1899,7 +1811,7 @@ static PFUNCTION hb_compFunctionNew( char * szName, HB_SYMBOLSCOPE cScope ) return pFunc; } -static PINLINE hb_compInlineNew( HB_COMP_PTR pComp, char * szName, int iLine ) +static PINLINE hb_compInlineNew( HB_COMP_DECL, char * szName, int iLine ) { PINLINE pInline; @@ -1909,7 +1821,7 @@ static PINLINE hb_compInlineNew( HB_COMP_PTR pComp, char * szName, int iLine ) pInline->pCode = NULL; pInline->lPCodeSize = 0; pInline->pNext = NULL; - pInline->szFileName = hb_strdup( hb_pp_fileName( pComp->pLex->pPP ) ); + pInline->szFileName = hb_strdup( hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ) ); pInline->iLine = iLine; return pInline; @@ -1921,52 +1833,51 @@ static PINLINE hb_compInlineNew( HB_COMP_PTR pComp, char * szName, int iLine ) * cScope - scope of a function * iType - FUN_PROCEDURE if a procedure or 0 */ -void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ) +void hb_compFunctionAdd( HB_COMP_DECL, char * szFunName, HB_SYMBOLSCOPE cScope, int iType ) { PCOMSYMBOL pSym; PFUNCTION pFunc; char * szFunction; - hb_compFinalizeFunction(); /* fix all previous function returns offsets */ + hb_compFinalizeFunction( HB_COMP_PARAM ); /* fix all previous function returns offsets */ if( cScope & (HB_FS_INIT | HB_FS_EXIT) ) { char *szNewName; int iLen; - iLen = strlen(szFunName); + iLen = strlen( szFunName ); szNewName = ( char * ) hb_xgrab( iLen + 2 ); strcpy( szNewName, szFunName ); szNewName[ iLen ] ='$'; szNewName[ iLen + 1 ] = '\0'; - szFunName = hb_compIdentifierNew( szNewName, TRUE ); - hb_xfree( szNewName ); + szFunName = hb_compIdentifierNew( HB_COMP_PARAM, szNewName, FALSE ); } - pFunc = hb_compFunctionFind( szFunName ); + pFunc = hb_compFunctionFind( HB_COMP_PARAM, szFunName ); if( pFunc ) { /* The name of a function/procedure is already defined */ - if( ( pFunc != hb_comp_functions.pFirst ) || hb_comp_bStartProc ) + if( ( pFunc != HB_COMP_PARAM->functions.pFirst ) || HB_COMP_PARAM->fStartProc ) /* it is not a starting procedure that was automatically created */ - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_FUNC_DUPL, szFunName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_FUNC_DUPL, szFunName, NULL ); } szFunction = hb_compReservedName( szFunName ); - if( szFunction && !( hb_comp_functions.iCount==0 && !hb_comp_bStartProc ) ) + if( szFunction && !( HB_COMP_PARAM->functions.iCount==0 && !HB_COMP_PARAM->fStartProc ) ) { /* We are ignoring it when it is the name of PRG file and we are * not creating implicit starting procedure */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_FUNC_RESERVED, szFunction, szFunName ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FUNC_RESERVED, szFunction, szFunName ); } - hb_comp_iFunctionCnt++; + HB_COMP_PARAM->iFunctionCnt++; - pSym = hb_compSymbolFind( szFunName, NULL, HB_SYM_FUNCNAME ); + pSym = hb_compSymbolFind( HB_COMP_PARAM, szFunName, NULL, HB_SYM_FUNCNAME ); if( ! pSym ) { /* there is not a symbol on the symbol table for this function name */ - pSym = hb_compSymbolAdd( szFunName, NULL, HB_SYM_FUNCNAME ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szFunName, NULL, HB_SYM_FUNCNAME ); if( pSym ) pSym->cScope = cScope; } @@ -1974,30 +1885,30 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ) if( pSym && cScope != HB_FS_PUBLIC ) pSym->cScope |= cScope; /* we may have a non public function and a object message */ - pFunc = hb_compFunctionNew( szFunName, cScope ); + pFunc = hb_compFunctionNew( HB_COMP_PARAM, szFunName, cScope ); pFunc->bFlags |= iType; - if( hb_comp_functions.iCount == 0 ) + if( HB_COMP_PARAM->functions.iCount == 0 ) { - hb_comp_functions.pFirst = pFunc; - hb_comp_functions.pLast = pFunc; + HB_COMP_PARAM->functions.pFirst = pFunc; + HB_COMP_PARAM->functions.pLast = pFunc; } else { - hb_comp_functions.pLast->pNext = pFunc; - hb_comp_functions.pLast = pFunc; + HB_COMP_PARAM->functions.pLast->pNext = pFunc; + HB_COMP_PARAM->functions.pLast = pFunc; } - hb_comp_functions.iCount++; + HB_COMP_PARAM->functions.iCount++; - hb_comp_ulLastLinePos = 0; /* optimization of line numbers opcode generation */ + HB_COMP_PARAM->lastLinePos = 0; /* optimization of line numbers opcode generation */ - hb_compGenPCode3( HB_P_FRAME, 0, 0, ( BOOL ) 0 ); /* frame for locals and parameters */ - hb_compGenPCode3( HB_P_SFRAME, 0, 0, ( BOOL ) 0 ); /* frame for statics variables */ + hb_compGenPCode3( HB_P_FRAME, 0, 0, HB_COMP_PARAM ); /* frame for locals and parameters */ + hb_compGenPCode3( HB_P_SFRAME, 0, 0, HB_COMP_PARAM ); /* frame for statics variables */ - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) { BYTE * pBuffer; - char * szFile = hb_pp_fileName( hb_comp_data->pLex->pPP ); + char * szFile = hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ); int iLen = strlen( szFile ); pBuffer = ( BYTE * ) hb_xgrab( 3 + iLen + strlen( szFunName ) ); @@ -2005,24 +1916,24 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ) memcpy( pBuffer + 1, szFile, iLen ); pBuffer[ iLen + 1 ] = ':'; memcpy( &pBuffer[ iLen + 2 ], szFunName, strlen( szFunName ) + 1 ); - hb_compGenPCodeN( pBuffer, 3 + iLen + strlen( szFunName ), 0 ); + hb_compGenPCodeN( pBuffer, 3 + iLen + strlen( szFunName ), HB_COMP_PARAM ); hb_xfree( pBuffer ); } - hb_comp_bDontGenLineNum = FALSE; /* reset the flag */ + HB_COMP_PARAM->fDontGenLineNum = FALSE; /* reset the flag */ } -PINLINE hb_compInlineAdd( HB_COMP_PTR pComp, char * szFunName, int iLine ) +PINLINE hb_compInlineAdd( HB_COMP_DECL, char * szFunName, int iLine ) { PINLINE pInline; PCOMSYMBOL pSym; if( szFunName ) { - pSym = hb_compSymbolFind( szFunName, NULL, HB_SYM_FUNCNAME ); + pSym = hb_compSymbolFind( HB_COMP_PARAM, szFunName, NULL, HB_SYM_FUNCNAME ); if( ! pSym ) { - pSym = hb_compSymbolAdd( szFunName, NULL, HB_SYM_FUNCNAME ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szFunName, NULL, HB_SYM_FUNCNAME ); } if( pSym ) { @@ -2031,29 +1942,29 @@ PINLINE hb_compInlineAdd( HB_COMP_PTR pComp, char * szFunName, int iLine ) } pInline = hb_compInlineNew( pComp, szFunName, iLine ); - if( hb_comp_inlines.iCount == 0 ) + if( HB_COMP_PARAM->inlines.iCount == 0 ) { - hb_comp_inlines.pFirst = pInline; - hb_comp_inlines.pLast = pInline; + HB_COMP_PARAM->inlines.pFirst = pInline; + HB_COMP_PARAM->inlines.pLast = pInline; } else { - hb_comp_inlines.pLast->pNext = pInline; - hb_comp_inlines.pLast = pInline; + HB_COMP_PARAM->inlines.pLast->pNext = pInline; + HB_COMP_PARAM->inlines.pLast = pInline; } - hb_comp_inlines.iCount++; + HB_COMP_PARAM->inlines.iCount++; return pInline; } /* create an ANNOUNCEd procedure */ -void hb_compAnnounce( char * szFunName ) +void hb_compAnnounce( HB_COMP_DECL, char * szFunName ) { PFUNCTION pFunc; - pFunc = hb_compFunctionFind( szFunName ); + pFunc = hb_compFunctionFind( HB_COMP_PARAM, szFunName ); if( pFunc ) { @@ -2061,7 +1972,7 @@ void hb_compAnnounce( char * szFunName ) * have to be a public symbol - check if existing symbol is public */ if( pFunc->cScope & HB_FS_STATIC ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_FUNC_ANNOUNCE, szFunName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_FUNC_ANNOUNCE, szFunName, NULL ); } else { @@ -2069,33 +1980,33 @@ void hb_compAnnounce( char * szFunName ) /* create a new procedure */ - pSym = hb_compSymbolAdd( szFunName, NULL, HB_SYM_FUNCNAME ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szFunName, NULL, HB_SYM_FUNCNAME ); pSym->cScope = HB_FS_PUBLIC; - pFunc = hb_compFunctionNew( szFunName, HB_FS_PUBLIC ); + pFunc = hb_compFunctionNew( HB_COMP_PARAM, szFunName, HB_FS_PUBLIC ); pFunc->bFlags |= FUN_PROCEDURE; - if( hb_comp_functions.iCount == 0 ) + if( HB_COMP_PARAM->functions.iCount == 0 ) { - hb_comp_functions.pFirst = pFunc; - hb_comp_functions.pLast = pFunc; + HB_COMP_PARAM->functions.pFirst = pFunc; + HB_COMP_PARAM->functions.pLast = pFunc; } else { - hb_comp_functions.pLast->pNext = pFunc; - hb_comp_functions.pLast = pFunc; + HB_COMP_PARAM->functions.pLast->pNext = pFunc; + HB_COMP_PARAM->functions.pLast = pFunc; } - hb_comp_functions.iCount++; - hb_comp_iFunctionCnt++; + HB_COMP_PARAM->functions.iCount++; + HB_COMP_PARAM->iFunctionCnt++; /* this function have a very limited functionality */ - hb_compGenPCode1( HB_P_ENDPROC ); + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); } } /* NOTE: Names of variables and functions are released in hbident.c on exit */ -PFUNCTION hb_compFunctionKill( PFUNCTION pFunc ) +PFUNCTION hb_compFunctionKill( HB_COMP_DECL, PFUNCTION pFunc ) { PFUNCTION pNext = pFunc->pNext; PVAR pVar; @@ -2160,9 +2071,9 @@ PFUNCTION hb_compFunctionKill( PFUNCTION pFunc ) /* hb_xfree( ( void * ) pFunc->szName ); The name will be released in hb_compSymbolKill() */ hb_xfree( ( void * ) pFunc ); - hb_compLoopKill(); - hb_compSwitchKill(); - hb_compElseIfKill(); + hb_compLoopKill( HB_COMP_PARAM ); + hb_compSwitchKill( HB_COMP_PARAM ); + hb_compElseIfKill( HB_COMP_PARAM ); return pNext; } @@ -2177,40 +2088,40 @@ PCOMSYMBOL hb_compSymbolKill( PCOMSYMBOL pSym ) return pNext; } -void hb_compGenBreak( void ) +void hb_compGenBreak( HB_COMP_DECL ) { - hb_compGenPushSymbol( "BREAK", TRUE, FALSE ); - hb_compGenPushNil(); + hb_compGenPushSymbol( "BREAK", TRUE, FALSE, HB_COMP_PARAM ); + hb_compGenPushNil( HB_COMP_PARAM ); } -void hb_compExternGen( void ) /* generates the symbols for the EXTERN names */ +void hb_compExternGen( HB_COMP_DECL ) /* generates the symbols for the EXTERN names */ { PEXTERN pDelete; - if( hb_comp_bDebugInfo ) - hb_compExternAdd( hb_compIdentifierNew( "__DBGENTRY", TRUE ) ); + if( HB_COMP_PARAM->fDebugInfo ) + hb_compExternAdd( HB_COMP_PARAM, "__DBGENTRY" ); - while( hb_comp_pExterns ) + while( HB_COMP_PARAM->externs ) { - if( hb_compSymbolFind( hb_comp_pExterns->szName, NULL, HB_SYM_FUNCNAME ) ) + if( hb_compSymbolFind( HB_COMP_PARAM, HB_COMP_PARAM->externs->szName, NULL, HB_SYM_FUNCNAME ) ) { - if( ! hb_compFunCallFind( hb_comp_pExterns->szName ) ) - hb_compFunCallAdd( hb_comp_pExterns->szName ); + if( ! hb_compFunCallFind( HB_COMP_PARAM, HB_COMP_PARAM->externs->szName ) ) + hb_compFunCallAdd( HB_COMP_PARAM, HB_COMP_PARAM->externs->szName ); } else { - hb_compSymbolAdd( hb_comp_pExterns->szName, NULL, HB_SYM_FUNCNAME ); - hb_compFunCallAdd( hb_comp_pExterns->szName ); + hb_compSymbolAdd( HB_COMP_PARAM, HB_COMP_PARAM->externs->szName, NULL, HB_SYM_FUNCNAME ); + hb_compFunCallAdd( HB_COMP_PARAM, HB_COMP_PARAM->externs->szName ); } - pDelete = hb_comp_pExterns; - hb_comp_pExterns = hb_comp_pExterns->pNext; + pDelete = HB_COMP_PARAM->externs; + HB_COMP_PARAM->externs = HB_COMP_PARAM->externs->pNext; hb_xfree( ( void * ) pDelete ); } } -PFUNCTION hb_compFunCallFind( char * szFunctionName ) /* returns a previously called defined function */ +PFUNCTION hb_compFunCallFind( HB_COMP_DECL, char * szFunctionName ) /* returns a previously called defined function */ { - PFUNCTION pFunc = hb_comp_funcalls.pFirst; + PFUNCTION pFunc = HB_COMP_PARAM->funcalls.pFirst; while( pFunc ) { @@ -2227,9 +2138,9 @@ PFUNCTION hb_compFunCallFind( char * szFunctionName ) /* returns a previously ca return NULL; } -PFUNCTION hb_compFunctionFind( char * szFunctionName ) /* returns a previously defined function */ +PFUNCTION hb_compFunctionFind( HB_COMP_DECL, char * szFunctionName ) /* returns a previously defined function */ { - PFUNCTION pFunc = hb_comp_functions.pFirst; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst; while( pFunc ) { @@ -2246,9 +2157,9 @@ PFUNCTION hb_compFunctionFind( char * szFunctionName ) /* returns a previously d return NULL; } -PINLINE hb_compInlineFind( char * szFunctionName ) +PINLINE hb_compInlineFind( HB_COMP_DECL, char * szFunctionName ) { - PINLINE pInline = hb_comp_inlines.pFirst; + PINLINE pInline = HB_COMP_PARAM->inlines.pFirst; while( pInline ) { @@ -2312,10 +2223,10 @@ USHORT hb_compVariableGetPos( PVAR pVars, char * szVarName ) /* returns the orde return 0; } -int hb_compLocalGetPos( char * szVarName ) /* returns the order + 1 of a variable if defined or zero */ +int hb_compLocalGetPos( HB_COMP_DECL, char * szVarName ) /* returns the order + 1 of a variable if defined or zero */ { int iVar; - PFUNCTION pFunc = hb_comp_functions.pLast; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; if( ! szVarName ) return 0; @@ -2362,7 +2273,7 @@ int hb_compLocalGetPos( char * szVarName ) /* returns the order + 1 of a variabl * It is not possible to access a parameter of a codeblock in which * the current codeblock is defined */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_OUTER_VAR, szVarName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_OUTER_VAR, szVarName, NULL ); return iVar; } else if( bStatic ) @@ -2381,7 +2292,7 @@ int hb_compLocalGetPos( char * szVarName ) /* returns the order + 1 of a variabl * 'bound error: array acccess' * Called from: (b)STATICS$(0) */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_ILLEGAL_INIT, "(b)", szVarName ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ILLEGAL_INIT, "(b)", szVarName ); return iVar; } else @@ -2412,7 +2323,7 @@ int hb_compLocalGetPos( char * szVarName ) /* returns the order + 1 of a variabl pVar->cType = ' '; pVar->iUsed = VU_NOT_USED; pVar->pNext = NULL; - pVar->iDeclLine = hb_comp_iLine - 1; + pVar->iDeclLine = hb_pp_line( HB_COMP_PARAM->pLex->pPP ); /* Use negative order to signal that we are accessing a local * variable from a codeblock @@ -2475,10 +2386,10 @@ int hb_compStaticGetPos( char * szVarName, PFUNCTION pFunc ) return iVar; } -char * hb_compStaticGetName( USHORT wVar ) +char * hb_compStaticGetName( HB_COMP_DECL, USHORT wVar ) { PVAR pVar; - PFUNCTION pTmp = hb_comp_functions.pFirst; + PFUNCTION pTmp = HB_COMP_PARAM->functions.pFirst; while( pTmp->pNext && pTmp->pNext->iStaticsBase < wVar ) pTmp = pTmp->pNext; @@ -2535,9 +2446,9 @@ int hb_compMemvarGetPos( char * szVarName, PFUNCTION pFunc ) * and sets its position in the symbol table. * NOTE: symbol's position number starts from 0 */ -PCOMDECLARED hb_compDeclaredFind( char * szDeclaredName ) +PCOMDECLARED hb_compDeclaredFind( HB_COMP_DECL, char * szDeclaredName ) { - PCOMDECLARED pSym = hb_comp_pFirstDeclared; + PCOMDECLARED pSym = HB_COMP_PARAM->pFirstDeclared; while( pSym ) { @@ -2554,9 +2465,9 @@ PCOMDECLARED hb_compDeclaredFind( char * szDeclaredName ) return NULL; } -PCOMSYMBOL hb_compSymbolFind( char * szSymbolName, USHORT * pwPos, BOOL bFunction ) +PCOMSYMBOL hb_compSymbolFind( HB_COMP_DECL, char * szSymbolName, USHORT * pwPos, BOOL bFunction ) { - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; USHORT wCnt = 0; if( pwPos ) @@ -2587,9 +2498,9 @@ PCOMSYMBOL hb_compSymbolFind( char * szSymbolName, USHORT * pwPos, BOOL bFunctio /* returns a symbol based on its index on the symbol table * index starts from 0 */ -PCOMSYMBOL hb_compSymbolGetPos( USHORT wSymbol ) +PCOMSYMBOL hb_compSymbolGetPos( HB_COMP_DECL, USHORT wSymbol ) { - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; USHORT w = 0; while( w++ < wSymbol && pSym->pNext ) @@ -2598,14 +2509,14 @@ PCOMSYMBOL hb_compSymbolGetPos( USHORT wSymbol ) return pSym; } -USHORT hb_compFunctionGetPos( char * szFunctionName ) /* return 0 if not found or order + 1 */ +USHORT hb_compFunctionGetPos( HB_COMP_DECL, char * szFunctionName ) /* return 0 if not found or order + 1 */ { - PFUNCTION pFunc = hb_comp_functions.pFirst; - USHORT wFunction = hb_comp_bStartProc; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst; + USHORT wFunction = HB_COMP_PARAM->fStartProc; while( pFunc ) { - if( ! strcmp( pFunc->szName, szFunctionName ) && pFunc != hb_comp_functions.pFirst ) + if( ! strcmp( pFunc->szName, szFunctionName ) && pFunc != HB_COMP_PARAM->functions.pFirst ) return wFunction; else { @@ -2640,76 +2551,76 @@ void hb_compNOOPadd( PFUNCTION pFunc, ULONG ulPos ) /* NOTE: To disable jump optimization, just make this function a dummy one. [vszakats] */ -static void hb_compPrepareOptimize( void ) +static void hb_compPrepareOptimize( HB_COMP_DECL ) { if( HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) { - hb_comp_functions.pLast->iJumps++; + HB_COMP_PARAM->functions.pLast->iJumps++; - if( hb_comp_functions.pLast->pJumps ) + if( HB_COMP_PARAM->functions.pLast->pJumps ) { - hb_comp_functions.pLast->pJumps = ( ULONG * ) hb_xrealloc( hb_comp_functions.pLast->pJumps, sizeof( ULONG ) * hb_comp_functions.pLast->iJumps ); - hb_comp_functions.pLast->pJumps[ hb_comp_functions.pLast->iJumps - 1 ] = ( ULONG ) ( hb_comp_functions.pLast->lPCodePos - 4 ); + HB_COMP_PARAM->functions.pLast->pJumps = ( ULONG * ) hb_xrealloc( HB_COMP_PARAM->functions.pLast->pJumps, sizeof( ULONG ) * HB_COMP_PARAM->functions.pLast->iJumps ); + HB_COMP_PARAM->functions.pLast->pJumps[ HB_COMP_PARAM->functions.pLast->iJumps - 1 ] = ( ULONG ) ( HB_COMP_PARAM->functions.pLast->lPCodePos - 4 ); } else { - hb_comp_functions.pLast->pJumps = ( ULONG * ) hb_xgrab( sizeof( ULONG ) ); - hb_comp_functions.pLast->pJumps[ hb_comp_functions.pLast->iJumps - 1 ] = ( ULONG ) ( hb_comp_functions.pLast->lPCodePos - 4 ); + HB_COMP_PARAM->functions.pLast->pJumps = ( ULONG * ) hb_xgrab( sizeof( ULONG ) ); + HB_COMP_PARAM->functions.pLast->pJumps[ HB_COMP_PARAM->functions.pLast->iJumps - 1 ] = ( ULONG ) ( HB_COMP_PARAM->functions.pLast->lPCodePos - 4 ); } } } -ULONG hb_compGenJump( LONG lOffset ) +ULONG hb_compGenJump( LONG lOffset, HB_COMP_DECL ) { if( HB_LIM_INT24( lOffset ) ) { - hb_compGenPCode4( HB_P_JUMPFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 ); + hb_compGenPCode4( HB_P_JUMPFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), HB_COMP_PARAM ); } else { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); } - hb_compPrepareOptimize(); + hb_compPrepareOptimize( HB_COMP_PARAM ); - return hb_comp_functions.pLast->lPCodePos - 3; + return HB_COMP_PARAM->functions.pLast->lPCodePos - 3; } -ULONG hb_compGenJumpFalse( LONG lOffset ) +ULONG hb_compGenJumpFalse( LONG lOffset, HB_COMP_DECL ) { if( HB_LIM_INT24( lOffset ) ) { - hb_compGenPCode4( HB_P_JUMPFALSEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 ); + hb_compGenPCode4( HB_P_JUMPFALSEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), HB_COMP_PARAM ); } else { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); } - hb_compPrepareOptimize(); + hb_compPrepareOptimize( HB_COMP_PARAM ); - return hb_comp_functions.pLast->lPCodePos - 3; + return HB_COMP_PARAM->functions.pLast->lPCodePos - 3; } -ULONG hb_compGenJumpTrue( LONG lOffset ) +ULONG hb_compGenJumpTrue( LONG lOffset, HB_COMP_DECL ) { if( HB_LIM_INT24( lOffset ) ) { - hb_compGenPCode4( HB_P_JUMPTRUEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), ( BOOL ) 1 ); + hb_compGenPCode4( HB_P_JUMPTRUEFAR, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), ( BYTE ) ( ( lOffset >> 16 ) & 0xFF ), HB_COMP_PARAM ); } else { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); } - hb_compPrepareOptimize(); + hb_compPrepareOptimize( HB_COMP_PARAM ); - return hb_comp_functions.pLast->lPCodePos - 3; + return HB_COMP_PARAM->functions.pLast->lPCodePos - 3; } -void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo ) +void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo, HB_COMP_DECL ) { - BYTE * pCode = hb_comp_functions.pLast->pCode; + BYTE * pCode = HB_COMP_PARAM->functions.pLast->pCode; LONG lOffset = ulTo - ulFrom + 1; if( HB_LIM_INT24( lOffset ) ) @@ -2717,84 +2628,85 @@ void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo ) HB_PUT_LE_UINT24( &pCode[ ulFrom ], lOffset ); } else - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_TOO_LONG, NULL, NULL ); } -void hb_compGenJumpHere( ULONG ulOffset ) +void hb_compGenJumpHere( ULONG ulOffset, HB_COMP_DECL ) { - hb_compGenJumpThere( ulOffset, hb_comp_functions.pLast->lPCodePos ); + hb_compGenJumpThere( ulOffset, HB_COMP_PARAM->functions.pLast->lPCodePos, HB_COMP_PARAM ); } -void hb_compLinePush( void ) /* generates the pcode with the currently compiled source code line */ +void hb_compLinePush( HB_COMP_DECL ) /* generates the pcode with the currently compiled source code line */ { - if( hb_comp_bLineNumbers && ! hb_comp_bDontGenLineNum ) + if( HB_COMP_PARAM->fLineNumbers && ! HB_COMP_PARAM->fDontGenLineNum ) { - if( ( ( hb_comp_functions.pLast->lPCodePos - hb_comp_ulLastLinePos ) > 3 ) || hb_comp_bDebugInfo ) + int iLine = hb_pp_line( HB_COMP_PARAM->pLex->pPP ); + if( ( ( HB_COMP_PARAM->functions.pLast->lPCodePos - HB_COMP_PARAM->lastLinePos ) > 3 ) || HB_COMP_PARAM->fDebugInfo ) { - hb_comp_ulLastLinePos = hb_comp_functions.pLast->lPCodePos; - hb_compGenPCode3( HB_P_LINE, HB_LOBYTE( hb_comp_iLine-1 ), HB_HIBYTE( hb_comp_iLine-1 ), ( BOOL ) 0 ); + HB_COMP_PARAM->lastLinePos = HB_COMP_PARAM->functions.pLast->lPCodePos; + hb_compGenPCode3( HB_P_LINE, HB_LOBYTE( iLine ), HB_HIBYTE( iLine ), HB_COMP_PARAM ); } else { - hb_comp_functions.pLast->pCode[ hb_comp_ulLastLinePos +1 ] = HB_LOBYTE( hb_comp_iLine-1 ); - hb_comp_functions.pLast->pCode[ hb_comp_ulLastLinePos +2 ] = HB_HIBYTE( hb_comp_iLine-1 ); + HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos +1 ] = HB_LOBYTE( iLine ); + HB_COMP_PARAM->functions.pLast->pCode[ HB_COMP_PARAM->lastLinePos +2 ] = HB_HIBYTE( iLine ); } } - if( hb_comp_functions.pLast->bFlags & FUN_BREAK_CODE ) + if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_BREAK_CODE ) { /* previous line contained RETURN/BREAK/LOOP/EXIT statement */ - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_UNREACHABLE, NULL, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_UNREACHABLE, NULL, NULL ); } - hb_comp_bDontGenLineNum = FALSE; + HB_COMP_PARAM->fDontGenLineNum = FALSE; /* clear RETURN/BREAK flag */ - hb_comp_functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); /* Resting Compile Time Stack */ - hb_comp_functions.pLast->iStackIndex = 0; - hb_comp_functions.pLast->iStackFunctions = 0; - hb_comp_functions.pLast->iStackClasses = 0; + HB_COMP_PARAM->functions.pLast->iStackIndex = 0; + HB_COMP_PARAM->functions.pLast->iStackFunctions = 0; + HB_COMP_PARAM->functions.pLast->iStackClasses = 0; } /* Generates the pcode with the currently compiled source code line * if debug code was requested only */ -void hb_compLinePushIfDebugger( void ) +void hb_compLinePushIfDebugger( HB_COMP_DECL ) { - if( hb_comp_bDebugInfo ) - hb_compLinePush(); + if( HB_COMP_PARAM->fDebugInfo ) + hb_compLinePush( HB_COMP_PARAM ); else { - if( hb_comp_functions.pLast->bFlags & FUN_BREAK_CODE ) + if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_BREAK_CODE ) { /* previous line contained RETURN/BREAK/LOOP/EXIT statement */ - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_UNREACHABLE, NULL, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_UNREACHABLE, NULL, NULL ); } - hb_comp_functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); /* clear RETURN flag */ + HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); /* clear RETURN flag */ } } -void hb_compLinePushIfInside( void ) /* generates the pcode with the currently compiled source code line */ +void hb_compLinePushIfInside( HB_COMP_DECL ) /* generates the pcode with the currently compiled source code line */ { /* This line can be placed inside a procedure or function only * except EXTERNAL */ - if( ! hb_comp_bExternal ) + if( ! HB_COMP_PARAM->fExternal ) { - if( ! hb_comp_bStartProc && hb_comp_functions.iCount <= 1 ) + if( ! HB_COMP_PARAM->fStartProc && HB_COMP_PARAM->functions.iCount <= 1 ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_OUTSIDE, NULL, NULL ); } } - hb_comp_functions.pLast->bFlags |= FUN_STATEMENTS; - hb_compLinePush(); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_STATEMENTS; + hb_compLinePush( HB_COMP_PARAM ); } /* * Function generates pcode for undeclared variable */ -static void hb_compGenVariablePCode( BYTE bPCode, char * szVarName ) +static void hb_compGenVariablePCode( HB_COMP_DECL, BYTE bPCode, char * szVarName ) { BOOL bGenCode; /* @@ -2803,15 +2715,15 @@ static void hb_compGenVariablePCode( BYTE bPCode, char * szVarName ) * is popped (a value is asssigned to a variable). */ if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_HARBOUR ) ) - bGenCode = hb_comp_bForceMemvars; /* harbour compatibility */ + bGenCode = HB_COMP_PARAM->fForceMemvars; /* harbour compatibility */ else - bGenCode = ( hb_comp_bForceMemvars || bPCode == HB_P_POPVARIABLE ); + bGenCode = ( HB_COMP_PARAM->fForceMemvars || bPCode == HB_P_POPVARIABLE ); if( bGenCode ) { /* -v switch was used -> assume it is a memvar variable */ - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_MEMVAR_ASSUMED, szVarName, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_MEMVAR_ASSUMED, szVarName, NULL ); if( bPCode == HB_P_POPVARIABLE ) bPCode = HB_P_POPMEMVAR; @@ -2821,14 +2733,14 @@ static void hb_compGenVariablePCode( BYTE bPCode, char * szVarName ) bPCode = HB_P_PUSHMEMVARREF; } else - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_AMBIGUOUS_VAR, szVarName, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_AMBIGUOUS_VAR, szVarName, NULL ); - hb_compGenVarPCode( bPCode, szVarName ); + hb_compGenVarPCode( bPCode, szVarName, HB_COMP_PARAM ); } /* Generate a pcode for a field variable */ -void hb_compGenFieldPCode( BYTE bPCode, int wVar, char * szVarName, PFUNCTION pFunc ) +static void hb_compGenFieldPCode( HB_COMP_DECL, BYTE bPCode, int wVar, char * szVarName, PFUNCTION pFunc ) { PVAR pField; @@ -2852,33 +2764,33 @@ void hb_compGenFieldPCode( BYTE bPCode, int wVar, char * szVarName, PFUNCTION pF else if( bPCode == HB_P_PUSHFIELD ) bPCode = HB_P_PUSHALIASEDFIELD; - hb_compGenPushSymbol( pField->szAlias, FALSE, TRUE ); + hb_compGenPushSymbol( pField->szAlias, FALSE, TRUE, HB_COMP_PARAM ); } - hb_compGenVarPCode( bPCode, szVarName ); + hb_compGenVarPCode( bPCode, szVarName, HB_COMP_PARAM ); } /* * Function generates passed pcode for passed runtime variable * (field or memvar) */ -void hb_compGenVarPCode( BYTE bPCode, char * szVarName ) +void hb_compGenVarPCode( BYTE bPCode, char * szVarName, HB_COMP_DECL ) { USHORT wVar; PCOMSYMBOL pSym; /* Check if this variable name is placed into the symbol table */ - pSym = hb_compSymbolFind( szVarName, &wVar, HB_SYM_MEMVAR ); + pSym = hb_compSymbolFind( HB_COMP_PARAM, szVarName, &wVar, HB_SYM_MEMVAR ); if( ! pSym ) - pSym = hb_compSymbolAdd( szVarName, &wVar, HB_SYM_MEMVAR ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szVarName, &wVar, HB_SYM_MEMVAR ); pSym->cScope |= VS_MEMVAR; if( bPCode == HB_P_PUSHALIASEDFIELD && wVar <= 255 ) - hb_compGenPCode2( HB_P_PUSHALIASEDFIELDNEAR, ( BYTE ) wVar, ( BOOL ) 1 ); + hb_compGenPCode2( HB_P_PUSHALIASEDFIELDNEAR, ( BYTE ) wVar, HB_COMP_PARAM ); else if( bPCode == HB_P_POPALIASEDFIELD && wVar <= 255 ) - hb_compGenPCode2( HB_P_POPALIASEDFIELDNEAR, ( BYTE ) wVar, ( BOOL ) 1 ); + hb_compGenPCode2( HB_P_POPALIASEDFIELDNEAR, ( BYTE ) wVar, HB_COMP_PARAM ); else - hb_compGenPCode3( bPCode, HB_LOBYTE( wVar ), HB_HIBYTE( wVar ), ( BOOL ) 1 ); + hb_compGenPCode3( bPCode, HB_LOBYTE( wVar ), HB_HIBYTE( wVar ), HB_COMP_PARAM ); } /* sends a message to an object */ @@ -2886,44 +2798,43 @@ void hb_compGenVarPCode( BYTE bPCode, char * szVarName ) bIsObject is FALSE if we are sending a message to an object specified with WITH OBJECT statement. */ -void hb_compGenMessage( char * szMsgName, BOOL bIsObject ) +void hb_compGenMessage( char * szMsgName, BOOL bIsObject, HB_COMP_DECL ) { USHORT wSym; PCOMSYMBOL pSym; if( szMsgName ) { - pSym = hb_compSymbolFind( szMsgName, &wSym, HB_SYM_MSGNAME ); + pSym = hb_compSymbolFind( HB_COMP_PARAM, szMsgName, &wSym, HB_SYM_MSGNAME ); if( ! pSym ) /* the symbol was not found on the symbol table */ - pSym = hb_compSymbolAdd( szMsgName, &wSym, HB_SYM_MSGNAME ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szMsgName, &wSym, HB_SYM_MSGNAME ); pSym->cScope |= HB_FS_MESSAGE; if( bIsObject ) - hb_compGenPCode3( HB_P_MESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_MESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), HB_COMP_PARAM ); else - hb_compGenPCode3( HB_P_WITHOBJECTMESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_WITHOBJECTMESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), HB_COMP_PARAM ); } else { wSym = 0xFFFF; - hb_compGenPCode3( HB_P_WITHOBJECTMESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_WITHOBJECTMESSAGE, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), HB_COMP_PARAM ); } } -void hb_compGenMessageData( char * szMsg, BOOL bIsObject ) /* generates an underscore-symbol name for a data assignment */ +void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_COMP_DECL ) /* generates an underscore-symbol name for a data assignment */ { char * szResult = ( char * ) hb_xgrab( strlen( szMsg ) + 2 ); strcpy( szResult, "_" ); strcat( szResult, szMsg ); - hb_compGenMessage( hb_compIdentifierNew( szResult, TRUE ), bIsObject ); - hb_xfree( szResult ); + hb_compGenMessage( hb_compIdentifierNew( HB_COMP_PARAM, szResult, FALSE ), bIsObject, HB_COMP_PARAM ); } -static void hb_compCheckEarlyMacroEval( char *szVarName ) +static void hb_compCheckEarlyMacroEval( HB_COMP_DECL, char *szVarName ) { - int iScope = hb_compVariableScope( szVarName ); + int iScope = hb_compVariableScope( HB_COMP_PARAM, szVarName ); if( iScope == HB_VS_CBLOCAL_VAR || iScope == HB_VS_STATIC_VAR || @@ -2933,7 +2844,7 @@ static void hb_compCheckEarlyMacroEval( char *szVarName ) iScope == HB_VS_LOCAL_MEMVAR || iScope == HB_VS_GLOBAL_MEMVAR ) { - hb_compErrorCodeblock( szVarName ); + hb_compErrorCodeblock( HB_COMP_PARAM, szVarName ); } } @@ -2947,18 +2858,18 @@ static void hb_compCheckEarlyMacroEval( char *szVarName ) * global MEMVAR variable * (if not found - it is an undeclared variable) */ -void hb_compGenPopVar( char * szVarName ) /* generates the pcode to pop a value from the virtual machine stack onto a variable */ +void hb_compGenPopVar( char * szVarName, HB_COMP_DECL ) /* generates the pcode to pop a value from the virtual machine stack onto a variable */ { int iVar; - if( ! hb_comp_functions.pLast->bLateEval ) + if( ! HB_COMP_PARAM->functions.pLast->bLateEval ) { /* pseudo-generation of pcode for a codeblock with macro symbol */ - hb_compCheckEarlyMacroEval( szVarName ); + hb_compCheckEarlyMacroEval( HB_COMP_PARAM, szVarName ); return; } - iVar = hb_compLocalGetPos( szVarName ); + iVar = hb_compLocalGetPos( HB_COMP_PARAM, szVarName ); if( iVar ) { /* local variable @@ -2967,10 +2878,10 @@ void hb_compGenPopVar( char * szVarName ) /* generates the pcode to pop a value * if PARAMETERS statement will be used then it is safe to * use 2 bytes for LOCALNEAR */ - if( HB_LIM_INT8( iVar ) && !hb_comp_functions.pLast->szName ) - hb_compGenPCode2( HB_P_POPLOCALNEAR, ( BYTE ) iVar, ( BOOL ) 1 ); + if( HB_LIM_INT8( iVar ) && !HB_COMP_PARAM->functions.pLast->szName ) + hb_compGenPCode2( HB_P_POPLOCALNEAR, ( BYTE ) iVar, HB_COMP_PARAM ); else - hb_compGenPCode3( HB_P_POPLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_POPLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); } else { @@ -2980,72 +2891,72 @@ void hb_compGenPopVar( char * szVarName ) /* generates the pcode to pop a value * initialization function - if YES then we have to switch to a function * where the static variable was declared */ - if( ( hb_comp_functions.pLast->cScope & HB_FS_INITEXIT ) == HB_FS_INITEXIT ) - pFunc = hb_comp_functions.pLast->pOwner; + if( ( HB_COMP_PARAM->functions.pLast->cScope & HB_FS_INITEXIT ) == HB_FS_INITEXIT ) + pFunc = HB_COMP_PARAM->functions.pLast->pOwner; else - pFunc = hb_comp_functions.pLast; + pFunc = HB_COMP_PARAM->functions.pLast; iVar = hb_compStaticGetPos( szVarName, pFunc ); if( iVar ) { /* Static variable declared in current function */ - hb_compGenPCode3( HB_P_POPSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_POPSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); pFunc->bFlags |= FUN_USES_STATICS; } else { - iVar = hb_compFieldGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* field declared in current function */ - hb_compGenFieldPCode( HB_P_POPFIELD, iVar, szVarName, hb_comp_functions.pLast ); + hb_compGenFieldPCode( HB_COMP_PARAM, HB_P_POPFIELD, iVar, szVarName, HB_COMP_PARAM->functions.pLast ); } else { - iVar = hb_compMemvarGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* Memvar variable declared in current functions */ - hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName, HB_COMP_PARAM ); } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compStaticGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global static variable */ - hb_compGenPCode3( HB_P_POPSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_USES_STATICS; + hb_compGenPCode3( HB_P_POPSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_STATICS; } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compFieldGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global field declaration */ - hb_compGenFieldPCode( HB_P_POPFIELD, iVar, szVarName, hb_comp_functions.pFirst ); + hb_compGenFieldPCode( HB_COMP_PARAM, HB_P_POPFIELD, iVar, szVarName, HB_COMP_PARAM->functions.pFirst ); } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compMemvarGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global Memvar variable declaration */ - hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName, HB_COMP_PARAM ); } else { /* undeclared variable */ - hb_compGenVariablePCode( HB_P_POPVARIABLE, szVarName ); + hb_compGenVariablePCode( HB_COMP_PARAM, HB_P_POPVARIABLE, szVarName ); } } } @@ -3061,7 +2972,8 @@ void hb_compGenPopVar( char * szVarName ) /* generates the pcode to pop a value void hb_compGenPopAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, - long lWorkarea ) + long lWorkarea, + HB_COMP_DECL ) { if( bPushAliasValue ) { @@ -3069,7 +2981,7 @@ void hb_compGenPopAliasedVar( char * szVarName, { if( szAlias[ 0 ] == 'M' && szAlias[ 1 ] == '\0' ) { /* M->variable */ - hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName, HB_COMP_PARAM ); } else { @@ -3078,7 +2990,7 @@ void hb_compGenPopAliasedVar( char * szVarName, iCmp = strncmp( szAlias, "MEMVAR", strlen( szAlias ) ); if( iCmp == 0 ) { /* MEMVAR-> or MEMVA-> or MEMV-> */ - hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_POPMEMVAR, szVarName, HB_COMP_PARAM ); } else { /* field variable */ @@ -3087,20 +2999,20 @@ void hb_compGenPopAliasedVar( char * szVarName, iCmp = strncmp( szAlias, "FIELD", strlen( szAlias ) ); if( iCmp == 0 ) { /* FIELD-> */ - hb_compGenVarPCode( HB_P_POPFIELD, szVarName ); + hb_compGenVarPCode( HB_P_POPFIELD, szVarName, HB_COMP_PARAM ); } else { /* database alias */ - hb_compGenPushSymbol( szAlias, FALSE, TRUE ); - hb_compGenVarPCode( HB_P_POPALIASEDFIELD, szVarName ); + hb_compGenPushSymbol( szAlias, FALSE, TRUE, HB_COMP_PARAM ); + hb_compGenVarPCode( HB_P_POPALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } } } else { - hb_compGenPushLong( lWorkarea ); - hb_compGenVarPCode( HB_P_POPALIASEDFIELD, szVarName ); + hb_compGenPushLong( lWorkarea, HB_COMP_PARAM ); + hb_compGenVarPCode( HB_P_POPALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } else @@ -3108,25 +3020,25 @@ void hb_compGenPopAliasedVar( char * szVarName, * NOTE: An alias will be determined at runtime then we cannot decide * here if passed name is either a field or a memvar */ - hb_compGenVarPCode( HB_P_POPALIASEDVAR, szVarName ); + hb_compGenVarPCode( HB_P_POPALIASEDVAR, szVarName, HB_COMP_PARAM ); } /* generates the pcode to push a nonaliased variable value to the virtual * machine stack * bMacroVar is TRUE if macro &szVarName context */ -void hb_compGenPushVar( char * szVarName, BOOL bMacroVar ) +void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_COMP_DECL ) { int iVar; - if( ! hb_comp_functions.pLast->bLateEval && ! bMacroVar ) + if( ! HB_COMP_PARAM->functions.pLast->bLateEval && ! bMacroVar ) { /* pseudo-generation of pcode for a codeblock with macro symbol */ - hb_compCheckEarlyMacroEval( szVarName ); + hb_compCheckEarlyMacroEval( HB_COMP_PARAM, szVarName ); return; } - iVar = hb_compLocalGetPos( szVarName ); + iVar = hb_compLocalGetPos( HB_COMP_PARAM, szVarName ); if( iVar ) { /* local variable @@ -3135,74 +3047,74 @@ void hb_compGenPushVar( char * szVarName, BOOL bMacroVar ) * if PARAMETERS statement will be used then it is safe to * use 2 bytes for LOCALNEAR */ - if( HB_LIM_INT8( iVar ) && !hb_comp_functions.pLast->szName ) - hb_compGenPCode2( HB_P_PUSHLOCALNEAR, ( BYTE ) iVar, ( BOOL ) 1 ); + if( HB_LIM_INT8( iVar ) && !HB_COMP_PARAM->functions.pLast->szName ) + hb_compGenPCode2( HB_P_PUSHLOCALNEAR, ( BYTE ) iVar, HB_COMP_PARAM ); else - hb_compGenPCode3( HB_P_PUSHLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_PUSHLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); } else { - iVar = hb_compStaticGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* Static variable declared in current function */ - hb_compGenPCode3( HB_P_PUSHSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_USES_STATICS; + hb_compGenPCode3( HB_P_PUSHSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_STATICS; } else { - iVar = hb_compFieldGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* field declared in current function */ - hb_compGenFieldPCode( HB_P_PUSHFIELD, iVar, szVarName, hb_comp_functions.pLast ); + hb_compGenFieldPCode( HB_COMP_PARAM, HB_P_PUSHFIELD, iVar, szVarName, HB_COMP_PARAM->functions.pLast ); } else { - iVar = hb_compMemvarGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* Memvar variable declared in current functions */ - hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName, HB_COMP_PARAM ); } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compStaticGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global static variable */ - hb_compGenPCode3( HB_P_PUSHSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_USES_STATICS; + hb_compGenPCode3( HB_P_PUSHSTATIC, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_STATICS; } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compFieldGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global field declaration */ - hb_compGenFieldPCode( HB_P_PUSHFIELD, iVar, szVarName, hb_comp_functions.pFirst ); + hb_compGenFieldPCode( HB_COMP_PARAM, HB_P_PUSHFIELD, iVar, szVarName, HB_COMP_PARAM->functions.pFirst ); } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compMemvarGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global Memvar variable declaration */ - hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName, HB_COMP_PARAM ); } else { /* undeclared variable */ - hb_compGenVariablePCode( HB_P_PUSHVARIABLE, szVarName ); + hb_compGenVariablePCode( HB_COMP_PARAM, HB_P_PUSHVARIABLE, szVarName ); } } } @@ -3212,87 +3124,87 @@ void hb_compGenPushVar( char * szVarName, BOOL bMacroVar ) } } -void hb_compGenPushVarRef( char * szVarName ) /* generates the pcode to push a variable by reference to the virtual machine stack */ +void hb_compGenPushVarRef( char * szVarName, HB_COMP_DECL ) /* generates the pcode to push a variable by reference to the virtual machine stack */ { int iVar; - if( ! hb_comp_functions.pLast->bLateEval ) + if( ! HB_COMP_PARAM->functions.pLast->bLateEval ) { /* pseudo-generation of pcode for a codeblock with macro symbol */ - hb_compCheckEarlyMacroEval( szVarName ); + hb_compCheckEarlyMacroEval( HB_COMP_PARAM, szVarName ); return; } - iVar = hb_compLocalGetPos( szVarName ); + iVar = hb_compLocalGetPos( HB_COMP_PARAM, szVarName ); if( iVar ) { /* local variable */ - hb_compGenPCode3( HB_P_PUSHLOCALREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_PUSHLOCALREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); } else { - iVar = hb_compStaticGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* Static variable declared in current function */ - hb_compGenPCode3( HB_P_PUSHSTATICREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_USES_STATICS; + hb_compGenPCode3( HB_P_PUSHSTATICREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_STATICS; } else { - iVar = hb_compFieldGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* pushing fields by reference is not allowed */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, szVarName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, szVarName, NULL ); } else { - iVar = hb_compMemvarGetPos( szVarName, hb_comp_functions.pLast ); + iVar = hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pLast ); if( iVar ) { /* Memvar variable declared in current functions */ - hb_compGenVarPCode( HB_P_PUSHMEMVARREF, szVarName ); + hb_compGenVarPCode( HB_P_PUSHMEMVARREF, szVarName, HB_COMP_PARAM ); } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compStaticGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compStaticGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global static variable */ - hb_compGenPCode3( HB_P_PUSHSTATICREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_USES_STATICS; + hb_compGenPCode3( HB_P_PUSHSTATICREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_STATICS; } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compFieldGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compFieldGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* pushing fields by reference is not allowed */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, szVarName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, szVarName, NULL ); } else { - if( ! hb_comp_bStartProc ) - iVar = hb_compMemvarGetPos( szVarName, hb_comp_functions.pFirst ); + if( ! HB_COMP_PARAM->fStartProc ) + iVar = hb_compMemvarGetPos( szVarName, HB_COMP_PARAM->functions.pFirst ); if( iVar ) { /* Global Memvar variable declaration */ - hb_compGenVarPCode( HB_P_PUSHMEMVARREF, szVarName ); + hb_compGenVarPCode( HB_P_PUSHMEMVARREF, szVarName, HB_COMP_PARAM ); } else { /* undeclared variable - field cannot be passed by the * reference - assume the memvar */ - hb_compGenVariablePCode( HB_P_PUSHMEMVARREF, szVarName ); + hb_compGenVariablePCode( HB_COMP_PARAM, HB_P_PUSHMEMVARREF, szVarName ); } } } @@ -3308,7 +3220,8 @@ void hb_compGenPushVarRef( char * szVarName ) /* generates the pcode to push a v void hb_compGenPushAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, - long lWorkarea ) + long lWorkarea, + HB_COMP_DECL ) { if( bPushAliasValue ) { @@ -3320,7 +3233,7 @@ void hb_compGenPushAliasedVar( char * szVarName, */ if( szAlias[ 0 ] == 'M' && szAlias[ 1 ] == '\0' ) { /* M->variable */ - hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName, HB_COMP_PARAM ); } else { @@ -3329,7 +3242,7 @@ void hb_compGenPushAliasedVar( char * szVarName, iCmp = strncmp( szAlias, "MEMVAR", strlen( szAlias ) ); if( iCmp == 0 ) { /* MEMVAR-> or MEMVA-> or MEMV-> */ - hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName ); + hb_compGenVarPCode( HB_P_PUSHMEMVAR, szVarName, HB_COMP_PARAM ); } else { /* field variable */ @@ -3338,20 +3251,20 @@ void hb_compGenPushAliasedVar( char * szVarName, iCmp = strncmp( szAlias, "FIELD", strlen( szAlias ) ); if( iCmp == 0 ) { /* FIELD-> */ - hb_compGenVarPCode( HB_P_PUSHFIELD, szVarName ); + hb_compGenVarPCode( HB_P_PUSHFIELD, szVarName, HB_COMP_PARAM ); } else { /* database alias */ - hb_compGenPushSymbol( szAlias, FALSE, TRUE ); - hb_compGenVarPCode( HB_P_PUSHALIASEDFIELD, szVarName ); + hb_compGenPushSymbol( szAlias, FALSE, TRUE, HB_COMP_PARAM ); + hb_compGenVarPCode( HB_P_PUSHALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } } } else { - hb_compGenPushLong( lWorkarea ); - hb_compGenVarPCode( HB_P_PUSHALIASEDFIELD, szVarName ); + hb_compGenPushLong( lWorkarea, HB_COMP_PARAM ); + hb_compGenVarPCode( HB_P_PUSHALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } else @@ -3359,21 +3272,21 @@ void hb_compGenPushAliasedVar( char * szVarName, * NOTE: An alias will be determined at runtime then we cannot decide * here if passed name is either a field or a memvar */ - hb_compGenVarPCode( HB_P_PUSHALIASEDVAR, szVarName ); + hb_compGenVarPCode( HB_P_PUSHALIASEDVAR, szVarName, HB_COMP_PARAM ); } -void hb_compGenPushLogical( int iTrueFalse ) /* pushes a logical value on the virtual machine stack */ +void hb_compGenPushLogical( int iTrueFalse, HB_COMP_DECL ) /* pushes a logical value on the virtual machine stack */ { - hb_compGenPCode1( iTrueFalse ? HB_P_TRUE : HB_P_FALSE ); + hb_compGenPCode1( iTrueFalse ? HB_P_TRUE : HB_P_FALSE, HB_COMP_PARAM ); } -void hb_compGenPushNil( void ) +void hb_compGenPushNil( HB_COMP_DECL ) { - hb_compGenPCode1( HB_P_PUSHNIL ); + hb_compGenPCode1( HB_P_PUSHNIL, HB_COMP_PARAM ); } /* generates the pcode to push a double number on the virtual machine stack */ -void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec ) +void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_COMP_DECL ) { BYTE pBuffer[ sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) + 1 ]; @@ -3383,50 +3296,45 @@ void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec ) pBuffer[ 1 + sizeof( double ) ] = bWidth; pBuffer[ 1 + sizeof( double ) + sizeof( BYTE ) ] = bDec; - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), 1 ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } -void hb_compGenPushFunCall( char * szFunName ) +void hb_compGenPushFunCall( char * szFunName, HB_COMP_DECL ) { char * szFunction; + /* if abbreviated function name was used - change it for whole name */ szFunction = hb_compReservedName( szFunName ); - if( szFunction ) - { - /* Abbreviated function name was used - change it for whole name - */ - hb_compGenPushSymbol( hb_compIdentifierNew( szFunction, TRUE ), TRUE, FALSE ); - } - else - hb_compGenPushSymbol( szFunName, TRUE, FALSE ); + hb_compGenPushSymbol( szFunction ? szFunction : szFunName, + TRUE, FALSE, HB_COMP_PARAM ); } /* generates the pcode to push a long number on the virtual machine stack */ -void hb_compGenPushLong( HB_LONG lNumber ) +void hb_compGenPushLong( HB_LONG lNumber, HB_COMP_DECL ) { - if( hb_comp_long_optimize ) + if( HB_COMP_PARAM->fLongOptimize ) { if( lNumber == 0 ) - hb_compGenPCode1( HB_P_ZERO ); + hb_compGenPCode1( HB_P_ZERO, HB_COMP_PARAM ); else if( lNumber == 1 ) - hb_compGenPCode1( HB_P_ONE ); + hb_compGenPCode1( HB_P_ONE, HB_COMP_PARAM ); else if( HB_LIM_INT8( lNumber ) ) - hb_compGenPCode2( HB_P_PUSHBYTE, (BYTE) lNumber, TRUE ); + hb_compGenPCode2( HB_P_PUSHBYTE, (BYTE) lNumber, HB_COMP_PARAM ); else if( HB_LIM_INT16( lNumber ) ) - hb_compGenPCode3( HB_P_PUSHINT, HB_LOBYTE( lNumber ), HB_HIBYTE( lNumber ), TRUE ); + hb_compGenPCode3( HB_P_PUSHINT, HB_LOBYTE( lNumber ), HB_HIBYTE( lNumber ), HB_COMP_PARAM ); else if( HB_LIM_INT32( lNumber ) ) { BYTE pBuffer[ 5 ]; pBuffer[ 0 ] = HB_P_PUSHLONG; HB_PUT_LE_UINT32( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } else { BYTE pBuffer[ 9 ]; pBuffer[ 0 ] = HB_P_PUSHLONGLONG; HB_PUT_LE_UINT64( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } } else @@ -3436,29 +3344,29 @@ void hb_compGenPushLong( HB_LONG lNumber ) BYTE pBuffer[ 5 ]; pBuffer[ 0 ] = HB_P_PUSHLONG; HB_PUT_LE_UINT32( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } else { BYTE pBuffer[ 9 ]; pBuffer[ 0 ] = HB_P_PUSHLONGLONG; HB_PUT_LE_UINT64( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } } } -void hb_compGenPushDate( HB_LONG lNumber ) +void hb_compGenPushDate( HB_LONG lNumber, HB_COMP_DECL ) { BYTE pBuffer[ 5 ]; pBuffer[ 0 ] = HB_P_PUSHDATE; HB_PUT_LE_UINT32( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), TRUE ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } /* generates the pcode to push a string on the virtual machine stack */ -void hb_compGenPushString( char * szText, ULONG ulStrLen ) +void hb_compGenPushString( char * szText, ULONG ulStrLen, HB_COMP_DECL ) { BYTE * pBuffer; @@ -3472,7 +3380,7 @@ void hb_compGenPushString( char * szText, ULONG ulStrLen ) memcpy( ( BYTE *)( &( pBuffer[3] ) ), ( BYTE * ) szText, ulStrLen ); - hb_compGenPCodeN( pBuffer, ulStrLen + 3, 1 ); + hb_compGenPCodeN( pBuffer, ulStrLen + 3, HB_COMP_PARAM ); } else { @@ -3483,29 +3391,29 @@ void hb_compGenPushString( char * szText, ULONG ulStrLen ) memcpy( ( BYTE *)( &( pBuffer[2] ) ), ( BYTE * ) szText, ulStrLen ); - hb_compGenPCodeN( pBuffer, ulStrLen + 2, 1 ); + hb_compGenPCodeN( pBuffer, ulStrLen + 2, HB_COMP_PARAM ); } hb_xfree( pBuffer ); } /* generates the pcode to push a symbol on the virtual machine stack */ -void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias ) +void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_COMP_DECL ) { PCOMSYMBOL pSym; USHORT wSym; - if( ( pSym = hb_compSymbolFind( szSymbolName, &wSym, bFunction ) ) != NULL ) /* the symbol was found on the symbol table */ + if( ( pSym = hb_compSymbolFind( HB_COMP_PARAM, szSymbolName, &wSym, bFunction ) ) != NULL ) /* the symbol was found on the symbol table */ { - if( bFunction && ! hb_compFunCallFind( szSymbolName ) ) - hb_compFunCallAdd( szSymbolName ); + if( bFunction && ! hb_compFunCallFind( HB_COMP_PARAM, szSymbolName ) ) + hb_compFunCallAdd( HB_COMP_PARAM, szSymbolName ); if( bAlias ) pSym->cScope |= HB_FS_PUBLIC; } else { - pSym = hb_compSymbolAdd( szSymbolName, &wSym, bFunction ); + pSym = hb_compSymbolAdd( HB_COMP_PARAM, szSymbolName, &wSym, bFunction ); if( bFunction ) { @@ -3514,23 +3422,23 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias ) /* reset symbol scope because the real scope is unknown now */ pSym->cScope = 0; } - hb_compFunCallAdd( szSymbolName ); + hb_compFunCallAdd( HB_COMP_PARAM, szSymbolName ); } } if( wSym > 255 ) - hb_compGenPCode3( HB_P_PUSHSYM, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_PUSHSYM, HB_LOBYTE( wSym ), HB_HIBYTE( wSym ), HB_COMP_PARAM ); else - hb_compGenPCode2( HB_P_PUSHSYMNEAR, ( BYTE ) wSym, ( BOOL ) 1 ); + hb_compGenPCode2( HB_P_PUSHSYMNEAR, ( BYTE ) wSym, HB_COMP_PARAM ); } -static void hb_compCheckDuplVars( PVAR pVar, char * szVarName ) +static void hb_compCheckDuplVars( HB_COMP_DECL, PVAR pVar, char * szVarName ) { while( pVar ) { if( ! strcmp( pVar->szName, szVarName ) ) { - hb_compErrorDuplVar( szVarName ); + hb_compErrorDuplVar( HB_COMP_PARAM, szVarName ); break; } else @@ -3538,9 +3446,9 @@ static void hb_compCheckDuplVars( PVAR pVar, char * szVarName ) } } -void hb_compFinalizeFunction( void ) /* fixes all last defined function returns jumps offsets */ +void hb_compFinalizeFunction( HB_COMP_DECL ) /* fixes all last defined function returns jumps offsets */ { - PFUNCTION pFunc = hb_comp_functions.pLast; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; if( pFunc ) { @@ -3549,7 +3457,7 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns /* The last statement in a function/procedure was not a RETURN * Generate end-of-procedure pcode */ - hb_compGenPCode1( HB_P_ENDPROC ); + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); } if( pFunc->bFlags & FUN_USES_LOCAL_PARAMS ) @@ -3570,15 +3478,15 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns * of function body when all local variables are already created. */ - hb_compFixFuncPCode( pFunc ); + hb_compFixFuncPCode( HB_COMP_PARAM, pFunc ); pFunc->wParamCount = PCount; } else - hb_compFixFuncPCode( pFunc ); + hb_compFixFuncPCode( HB_COMP_PARAM, pFunc ); - hb_compOptimizeJumps(); + hb_compOptimizeJumps( HB_COMP_PARAM ); - if( hb_comp_iWarnings ) + if( HB_COMP_PARAM->iWarnings ) { PVAR pVar; @@ -3589,7 +3497,7 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns { char szFun[ 256 ]; sprintf( szFun, "%s(%i)", pFunc->szName, pVar->iDeclLine ); - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, szFun ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, szFun ); } pVar = pVar->pNext; @@ -3602,7 +3510,7 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns { char szFun[ 256 ]; sprintf( szFun, "%s(%i)", pFunc->szName, pVar->iDeclLine ); - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, szFun ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_VAR_NOT_USED, pVar->szName, szFun ); } pVar = pVar->pNext; @@ -3612,7 +3520,7 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns */ if( (pFunc->bFlags & FUN_WITH_RETURN) == 0 && (pFunc->bFlags & FUN_PROCEDURE) == 0 ) - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_FUN_WITH_NO_RETURN, + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_FUN_WITH_NO_RETURN, pFunc->szName, NULL ); /* Compile Time Strong Type Checking is not needed any more. */ @@ -3627,19 +3535,19 @@ void hb_compFinalizeFunction( void ) /* fixes all last defined function returns } } -static void hb_compOptimizeFrames( PFUNCTION pFunc ) +static void hb_compOptimizeFrames( HB_COMP_DECL, PFUNCTION pFunc ) { USHORT w; if( pFunc == NULL ) return; - if( pFunc == hb_comp_pInitFunc ) + if( pFunc == HB_COMP_PARAM->pInitFunc ) { if( pFunc->pCode[ 0 ] == HB_P_STATICS && pFunc->pCode[ 5 ] == HB_P_SFRAME ) { - hb_compSymbolFind( hb_comp_pInitFunc->szName, &w, HB_SYM_FUNCNAME ); + hb_compSymbolFind( HB_COMP_PARAM, HB_COMP_PARAM->pInitFunc->szName, &w, HB_SYM_FUNCNAME ); pFunc->pCode[ 1 ] = HB_LOBYTE( w ); pFunc->pCode[ 2 ] = HB_HIBYTE( w ); pFunc->pCode[ 6 ] = HB_LOBYTE( w ); @@ -3660,18 +3568,18 @@ static void hb_compOptimizeFrames( PFUNCTION pFunc ) /* Check Global Statics. */ { /* PVAR pVar = pFunc->pStatics; */ - PVAR pVar = hb_comp_functions.pFirst->pStatics; + PVAR pVar = HB_COMP_PARAM->functions.pFirst->pStatics; while( pVar ) { /*printf( "\nChecking: %s Used: %i\n", pVar->szName, pVar->iUsed );*/ if ( ! ( pVar->iUsed & VU_USED ) && (pVar->iUsed & VU_INITIALIZED) ) - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_VAL_NOT_USED, pVar->szName, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_VAL_NOT_USED, pVar->szName, NULL ); /* May have been initialized in previous execution of the function. else if ( ( pVar->iUsed & VU_USED ) && ! ( pVar->iUsed & VU_INITIALIZED ) ) - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_NOT_INITIALIZED, pVar->szName, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_NOT_INITIALIZED, pVar->szName, NULL ); */ pVar = pVar->pNext; } @@ -3719,7 +3627,7 @@ static void hb_compOptimizeFrames( PFUNCTION pFunc ) if( pFunc->bFlags & FUN_USES_STATICS ) { - hb_compSymbolFind( hb_comp_pInitFunc->szName, &w, HB_SYM_FUNCNAME ); + hb_compSymbolFind( HB_COMP_PARAM, HB_COMP_PARAM->pInitFunc->szName, &w, HB_SYM_FUNCNAME ); pFunc->pCode[ 4 ] = HB_LOBYTE( w ); pFunc->pCode[ 5 ] = HB_HIBYTE( w ); bSkipSFRAME = FALSE; @@ -3790,14 +3698,14 @@ void hb_compNOOPfill( PFUNCTION pFunc, ULONG ulFrom, int iCount, BOOL fPop, BOOL } } -BOOL hb_compIsJump( PFUNCTION pFunc, ULONG ulPos ) +BOOL hb_compIsJump( HB_COMP_DECL, PFUNCTION pFunc, ULONG ulPos ) { ULONG iJump; /* * Do not allow any optimization (code striping) when Jump Optimization * is disabled and we do not have any information about jump addreses */ - if( ! HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) + if( ! HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) ) return TRUE; for( iJump = 0; iJump < pFunc->iJumps; iJump++ ) @@ -3829,9 +3737,9 @@ BOOL hb_compIsJump( PFUNCTION pFunc, ULONG ulPos ) } /* Jump Optimizer and dummy code eliminator */ -static void hb_compOptimizeJumps( void ) +static void hb_compOptimizeJumps( HB_COMP_DECL ) { - BYTE * pCode = hb_comp_functions.pLast->pCode; + BYTE * pCode = HB_COMP_PARAM->functions.pLast->pCode; ULONG * pNOOPs, * pJumps; ULONG ulOptimized, ulNextByte, ulBytes2Copy, ulJumpAddr, iNOOP, iJump; int iPass; @@ -3839,19 +3747,19 @@ static void hb_compOptimizeJumps( void ) if( ! HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) return; - hb_compCodeTraceMarkDead( hb_comp_functions.pLast ); + hb_compCodeTraceMarkDead( HB_COMP_PARAM, HB_COMP_PARAM->functions.pLast ); for( iPass = 0; iPass < 3; ++iPass ) { LONG lOffset; - if( iPass == 2 && ! hb_comp_bDebugInfo && hb_comp_bLineNumbers ) - hb_compStripFuncLines( hb_comp_functions.pLast ); + if( iPass == 2 && ! HB_COMP_PARAM->fDebugInfo && HB_COMP_PARAM->fLineNumbers ) + hb_compStripFuncLines( HB_COMP_PARAM->functions.pLast ); - if( hb_comp_functions.pLast->iJumps > 0 ) + if( HB_COMP_PARAM->functions.pLast->iJumps > 0 ) { - pJumps = hb_comp_functions.pLast->pJumps; - iJump = hb_comp_functions.pLast->iJumps - 1; + pJumps = HB_COMP_PARAM->functions.pLast->pJumps; + iJump = HB_COMP_PARAM->functions.pLast->iJumps - 1; do { @@ -3874,93 +3782,93 @@ static void hb_compOptimizeJumps( void ) { case HB_P_JUMPNEAR: if( ( signed char ) pCode[ ulJumpAddr + 1 ] == 2 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 2, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 2, FALSE, FALSE ); break; case HB_P_JUMPFALSENEAR: case HB_P_JUMPTRUENEAR: if( ( signed char ) pCode[ ulJumpAddr + 1 ] == 2 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 2, TRUE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 2, TRUE, FALSE ); break; case HB_P_JUMP: lOffset = HB_PCODE_MKSHORT( &pCode[ ulJumpAddr + 1 ] ); if( lOffset == 3 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 3, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 3, FALSE, FALSE ); else if( HB_LIM_INT8( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPNEAR; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 2, 1, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 2, 1, FALSE, FALSE ); } break; case HB_P_JUMPFALSE: lOffset = HB_PCODE_MKSHORT( &pCode[ ulJumpAddr + 1 ] ); if( lOffset == 3 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 3, TRUE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 3, TRUE, FALSE ); else if( HB_LIM_INT8( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPFALSENEAR; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 2, 1, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 2, 1, FALSE, FALSE ); } break; case HB_P_JUMPTRUE: lOffset = HB_PCODE_MKSHORT( &pCode[ ulJumpAddr + 1 ] ); if( lOffset == 3 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 3, TRUE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 3, TRUE, FALSE ); else if( HB_LIM_INT8( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPTRUENEAR; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 2, 1, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 2, 1, FALSE, FALSE ); } break; case HB_P_JUMPFAR: lOffset = HB_PCODE_MKINT24( &pCode[ ulJumpAddr + 1 ] ); if( lOffset == 4 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 4, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 4, FALSE, FALSE ); else if( HB_LIM_INT8( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPNEAR; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 2, 2, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 2, 2, FALSE, FALSE ); } else if( HB_LIM_INT16( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMP; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 3, 1, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 3, 1, FALSE, FALSE ); } break; case HB_P_JUMPFALSEFAR: lOffset = HB_PCODE_MKINT24( &pCode[ ulJumpAddr + 1 ] ); if( lOffset == 4 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 4, TRUE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 4, TRUE, FALSE ); else if( HB_LIM_INT8( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPFALSENEAR; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 2, 2, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 2, 2, FALSE, FALSE ); } else if( HB_LIM_INT16( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPFALSE; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 3, 1, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 3, 1, FALSE, FALSE ); } break; case HB_P_JUMPTRUEFAR: lOffset = HB_PCODE_MKINT24( &pCode[ ulJumpAddr + 1 ] ); if( lOffset == 4 ) - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr, 4, TRUE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr, 4, TRUE, FALSE ); else if( HB_LIM_INT8( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPTRUENEAR; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 2, 2, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 2, 2, FALSE, FALSE ); } else if( HB_LIM_INT16( lOffset ) ) { pCode[ ulJumpAddr ] = HB_P_JUMPTRUE; - hb_compNOOPfill( hb_comp_functions.pLast, ulJumpAddr + 3, 1, FALSE, FALSE ); + hb_compNOOPfill( HB_COMP_PARAM->functions.pLast, ulJumpAddr + 3, 1, FALSE, FALSE ); } break; } @@ -3969,49 +3877,49 @@ static void hb_compOptimizeJumps( void ) if( pCode[ ulJumpAddr ] == HB_P_NOOP || pCode[ ulJumpAddr ] == HB_P_POP ) { - if( hb_comp_functions.pLast->iJumps > iJump + 1 ) + if( HB_COMP_PARAM->functions.pLast->iJumps > iJump + 1 ) memmove( &pJumps[ iJump ], &pJumps[ iJump + 1 ], - ( hb_comp_functions.pLast->iJumps - iJump - 1 ) * + ( HB_COMP_PARAM->functions.pLast->iJumps - iJump - 1 ) * sizeof( ULONG ) ); - hb_comp_functions.pLast->iJumps--; + HB_COMP_PARAM->functions.pLast->iJumps--; } } while( iJump-- ); - if( hb_comp_functions.pLast->iJumps == 0 ) + if( HB_COMP_PARAM->functions.pLast->iJumps == 0 ) { - hb_xfree( hb_comp_functions.pLast->pJumps ); - hb_comp_functions.pLast->pJumps = NULL; + hb_xfree( HB_COMP_PARAM->functions.pLast->pJumps ); + HB_COMP_PARAM->functions.pLast->pJumps = NULL; } } - if( hb_comp_functions.pLast->iNOOPs == 0 ) + if( HB_COMP_PARAM->functions.pLast->iNOOPs == 0 ) return; - pNOOPs = hb_comp_functions.pLast->pNOOPs; + pNOOPs = HB_COMP_PARAM->functions.pLast->pNOOPs; /* Needed so the pasting of PCODE pieces below will work correctly */ - qsort( ( void * ) pNOOPs, hb_comp_functions.pLast->iNOOPs, sizeof( ULONG ), hb_compSort_ULONG ); + qsort( ( void * ) pNOOPs, HB_COMP_PARAM->functions.pLast->iNOOPs, sizeof( ULONG ), hb_compSort_ULONG ); - if( hb_comp_functions.pLast->iJumps ) + if( HB_COMP_PARAM->functions.pLast->iJumps ) { LONG * plSizes, * plShifts; ULONG ulSize; - pJumps = hb_comp_functions.pLast->pJumps; - ulSize = sizeof( LONG ) * hb_comp_functions.pLast->iJumps; + pJumps = HB_COMP_PARAM->functions.pLast->pJumps; + ulSize = sizeof( LONG ) * HB_COMP_PARAM->functions.pLast->iJumps; plSizes = ( LONG * ) hb_xgrab( ulSize ); plShifts = ( LONG * ) hb_xgrab( ulSize ); - for( iJump = 0; iJump < hb_comp_functions.pLast->iJumps; iJump++ ) + for( iJump = 0; iJump < HB_COMP_PARAM->functions.pLast->iJumps; iJump++ ) plSizes[ iJump ] = plShifts[ iJump ] = 0; /* First Scan NOOPS - Adjust Jump addresses. */ - for( iNOOP = 0; iNOOP < hb_comp_functions.pLast->iNOOPs; iNOOP++ ) + for( iNOOP = 0; iNOOP < HB_COMP_PARAM->functions.pLast->iNOOPs; iNOOP++ ) { /* Adjusting preceding jumps that pooint to code beyond the current NOOP or trailing backward jumps pointing to lower address. */ - for( iJump = 0; iJump < hb_comp_functions.pLast->iJumps ; iJump++ ) + for( iJump = 0; iJump < HB_COMP_PARAM->functions.pLast->iJumps ; iJump++ ) { ulJumpAddr = pJumps[ iJump ]; switch( pCode[ ulJumpAddr ] ) @@ -4037,7 +3945,7 @@ static void hb_compOptimizeJumps( void ) break; default: - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_NOT_FOUND, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_JUMP_NOT_FOUND, NULL, NULL ); continue; } @@ -4063,7 +3971,7 @@ static void hb_compOptimizeJumps( void ) } } - for( iJump = 0; iJump < hb_comp_functions.pLast->iJumps; iJump++ ) + for( iJump = 0; iJump < HB_COMP_PARAM->functions.pLast->iJumps; iJump++ ) { lOffset = plSizes[ iJump ]; if( lOffset != 0 ) @@ -4099,7 +4007,7 @@ static void hb_compOptimizeJumps( void ) ulOptimized = ulNextByte = 0; /* Second Scan, after all adjustements been made, we can copy the optimized code. */ - for( iNOOP = 0; iNOOP < hb_comp_functions.pLast->iNOOPs; iNOOP++ ) + for( iNOOP = 0; iNOOP < HB_COMP_PARAM->functions.pLast->iNOOPs; iNOOP++ ) { ulBytes2Copy = ( pNOOPs[ iNOOP ] - ulNextByte ) ; @@ -4112,16 +4020,16 @@ static void hb_compOptimizeJumps( void ) ulNextByte++; } - ulBytes2Copy = ( hb_comp_functions.pLast->lPCodePos - ulNextByte ) ; + ulBytes2Copy = ( HB_COMP_PARAM->functions.pLast->lPCodePos - ulNextByte ) ; memmove( pCode + ulOptimized, pCode + ulNextByte, ulBytes2Copy ); ulOptimized += ulBytes2Copy; - hb_comp_functions.pLast->lPCodePos = ulOptimized; - hb_comp_functions.pLast->lPCodeSize = ulOptimized; + HB_COMP_PARAM->functions.pLast->lPCodePos = ulOptimized; + HB_COMP_PARAM->functions.pLast->lPCodeSize = ulOptimized; - hb_xfree( hb_comp_functions.pLast->pNOOPs ); - hb_comp_functions.pLast->pNOOPs = NULL; - hb_comp_functions.pLast->iNOOPs = 0; + hb_xfree( HB_COMP_PARAM->functions.pLast->pNOOPs ); + HB_COMP_PARAM->functions.pLast->pNOOPs = NULL; + HB_COMP_PARAM->functions.pLast->iNOOPs = 0; } } @@ -4130,13 +4038,13 @@ static void hb_compOptimizeJumps( void ) * - either the address of HB_P_SEQEND opcode if there is no RECOVER clause * - or the address of RECOVER code */ -ULONG hb_compSequenceBegin( void ) +ULONG hb_compSequenceBegin( HB_COMP_DECL ) { - hb_compGenPCode4( HB_P_SEQBEGIN, 0, 0, 0, ( BOOL ) 0 ); + hb_compGenPCode4( HB_P_SEQBEGIN, 0, 0, 0, HB_COMP_PARAM ); - hb_compPrepareOptimize(); + hb_compPrepareOptimize( HB_COMP_PARAM ); - return hb_comp_functions.pLast->lPCodePos - 3; + return HB_COMP_PARAM->functions.pLast->lPCodePos - 3; } /* Generate the opcode to close BEGIN/END sequence @@ -4146,28 +4054,28 @@ ULONG hb_compSequenceBegin( void ) * last statement in code beetwen BEGIN ... RECOVER) or if BREAK was requested * and there was no matching RECOVER clause. */ -ULONG hb_compSequenceEnd( void ) +ULONG hb_compSequenceEnd( HB_COMP_DECL ) { - hb_compGenPCode4( HB_P_SEQEND, 0, 0, 0, ( BOOL ) 0 ); + hb_compGenPCode4( HB_P_SEQEND, 0, 0, 0, HB_COMP_PARAM ); - hb_compPrepareOptimize(); + hb_compPrepareOptimize( HB_COMP_PARAM ); - return hb_comp_functions.pLast->lPCodePos - 3; + return HB_COMP_PARAM->functions.pLast->lPCodePos - 3; } /* Remove unnecessary opcodes in case there were no executable statements * beetwen BEGIN and RECOVER sequence */ -void hb_compSequenceFinish( ULONG ulStartPos, int bUsualStmts ) +void hb_compSequenceFinish( ULONG ulStartPos, int bUsualStmts, HB_COMP_DECL ) { - if( ! hb_comp_bDebugInfo ) /* only if no debugger info is required */ + if( ! HB_COMP_PARAM->fDebugInfo ) /* only if no debugger info is required */ { if( ! bUsualStmts ) { if( ! HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) { - hb_comp_functions.pLast->lPCodePos = ulStartPos - 1; /* remove also HB_P_SEQBEGIN */ - hb_comp_ulLastLinePos = ulStartPos - 5; + HB_COMP_PARAM->functions.pLast->lPCodePos = ulStartPos - 1; /* remove also HB_P_SEQBEGIN */ + HB_COMP_PARAM->lastLinePos = ulStartPos - 5; } else { @@ -4176,13 +4084,13 @@ void hb_compSequenceFinish( ULONG ulStartPos, int bUsualStmts ) * is enabled by replacing it with HB_P_NOOP PCODEs - which * will be later eliminated and jump data updated. */ - while( ulStartPos <= hb_comp_functions.pLast->lPCodePos ) + while( ulStartPos <= HB_COMP_PARAM->functions.pLast->lPCodePos ) { - hb_comp_functions.pLast->pCode[ ulStartPos - 1 ] = HB_P_NOOP; - hb_compNOOPadd( hb_comp_functions.pLast, ulStartPos - 1 ); + HB_COMP_PARAM->functions.pLast->pCode[ ulStartPos - 1 ] = HB_P_NOOP; + hb_compNOOPadd( HB_COMP_PARAM->functions.pLast, ulStartPos - 1 ); ++ulStartPos; } - hb_comp_ulLastLinePos = ulStartPos - 5; + HB_COMP_PARAM->lastLinePos = ulStartPos - 5; } } } @@ -4193,11 +4101,11 @@ void hb_compSequenceFinish( ULONG ulStartPos, int bUsualStmts ) * szAlias -> name of the alias * iField -> position of the first FIELD name to change */ -void hb_compFieldSetAlias( char * szAlias, int iField ) +void hb_compFieldSetAlias( HB_COMP_DECL, char * szAlias, int iField ) { PVAR pVar; - pVar = hb_comp_functions.pLast->pFields; + pVar = HB_COMP_PARAM->functions.pLast->pFields; while( iField-- && pVar ) pVar = pVar->pNext; @@ -4211,10 +4119,10 @@ void hb_compFieldSetAlias( char * szAlias, int iField ) /* This functions counts the number of FIELD declaration in a function * We will required this information in hb_compFieldSetAlias function */ -int hb_compFieldsCount() +int hb_compFieldsCount( HB_COMP_DECL ) { int iFields = 0; - PVAR pVar = hb_comp_functions.pLast->pFields; + PVAR pVar = HB_COMP_PARAM->functions.pLast->pFields; while( pVar ) { @@ -4227,23 +4135,23 @@ int hb_compFieldsCount() /* * Start of definition of static variable - * We are using here the special function hb_comp_pInitFunc which will store + * We are using here the special function HB_COMP_PARAM->pInitFunc which will store * pcode needed to initialize all static variables declared in PRG module. * pOwner member will point to a function where the static variable is * declared: */ -void hb_compStaticDefStart( void ) +void hb_compStaticDefStart( HB_COMP_DECL ) { - hb_comp_functions.pLast->bFlags |= FUN_USES_STATICS; - if( ! hb_comp_pInitFunc ) + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_USES_STATICS; + if( ! HB_COMP_PARAM->pInitFunc ) { BYTE pBuffer[ 5 ]; - hb_comp_pInitFunc = hb_compFunctionNew( hb_compIdentifierNew( "(_INITSTATICS)", TRUE ), HB_FS_INITEXIT ); - hb_comp_pInitFunc->pOwner = hb_comp_functions.pLast; - hb_comp_pInitFunc->bFlags = FUN_USES_STATICS | FUN_PROCEDURE; - hb_comp_pInitFunc->cScope = HB_FS_INITEXIT; - hb_comp_functions.pLast = hb_comp_pInitFunc; + HB_COMP_PARAM->pInitFunc = hb_compFunctionNew( HB_COMP_PARAM, "(_INITSTATICS)", HB_FS_INITEXIT ); + HB_COMP_PARAM->pInitFunc->pOwner = HB_COMP_PARAM->functions.pLast; + HB_COMP_PARAM->pInitFunc->bFlags = FUN_USES_STATICS | FUN_PROCEDURE; + HB_COMP_PARAM->pInitFunc->cScope = HB_FS_INITEXIT; + HB_COMP_PARAM->functions.pLast = HB_COMP_PARAM->pInitFunc; pBuffer[ 0 ] = HB_P_STATICS; pBuffer[ 1 ] = 0; @@ -4251,27 +4159,27 @@ void hb_compStaticDefStart( void ) pBuffer[ 3 ] = 1; /* the number of static variables is unknown now */ pBuffer[ 4 ] = 0; - hb_compGenPCodeN( pBuffer, 5, 0 ); + hb_compGenPCodeN( pBuffer, 5, HB_COMP_PARAM ); - hb_compGenPCode3( HB_P_SFRAME, 0, 0, ( BOOL ) 0 ); /* frame for statics variables */ + hb_compGenPCode3( HB_P_SFRAME, 0, 0, HB_COMP_PARAM ); /* frame for statics variables */ - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) { BYTE * pBuffer; - char * szFile = hb_pp_fileName( hb_comp_data->pLex->pPP ); + char * szFile = hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ); int iFileLen = strlen( szFile ); pBuffer = ( BYTE * ) hb_xgrab( 2 + iFileLen ); pBuffer[0] = HB_P_MODULENAME; memcpy( ( BYTE * ) ( &( pBuffer[1] ) ), ( BYTE * ) szFile, iFileLen + 1 ); - hb_compGenPCodeN( pBuffer, 2 + iFileLen, 0 ); + hb_compGenPCodeN( pBuffer, 2 + iFileLen, HB_COMP_PARAM ); hb_xfree( pBuffer ); } } else { - hb_comp_pInitFunc->pOwner = hb_comp_functions.pLast; - hb_comp_functions.pLast = hb_comp_pInitFunc; + HB_COMP_PARAM->pInitFunc->pOwner = HB_COMP_PARAM->functions.pLast; + HB_COMP_PARAM->functions.pLast = HB_COMP_PARAM->pInitFunc; } } @@ -4279,29 +4187,29 @@ void hb_compStaticDefStart( void ) * End of definition of static variable * Return to previously pcoded function. */ -void hb_compStaticDefEnd( void ) +void hb_compStaticDefEnd( HB_COMP_DECL ) { - hb_comp_functions.pLast = hb_comp_pInitFunc->pOwner; - hb_comp_pInitFunc->pOwner = NULL; - ++hb_comp_iStaticCnt; + HB_COMP_PARAM->functions.pLast = HB_COMP_PARAM->pInitFunc->pOwner; + HB_COMP_PARAM->pInitFunc->pOwner = NULL; + ++HB_COMP_PARAM->iStaticCnt; } /* * Start a new fake-function that will hold pcodes for a codeblock */ -void hb_compCodeBlockStart( BOOL bLateEval ) +void hb_compCodeBlockStart( BOOL bLateEval, HB_COMP_DECL ) { PFUNCTION pBlock; - pBlock = hb_compFunctionNew( NULL, HB_FS_STATIC ); - pBlock->pOwner = hb_comp_functions.pLast; - pBlock->iStaticsBase = hb_comp_functions.pLast->iStaticsBase; - pBlock->bLateEval = bLateEval; + pBlock = hb_compFunctionNew( HB_COMP_PARAM, NULL, HB_FS_STATIC ); + pBlock->pOwner = HB_COMP_PARAM->functions.pLast; + pBlock->iStaticsBase = HB_COMP_PARAM->functions.pLast->iStaticsBase; + pBlock->bLateEval = bLateEval; - hb_comp_functions.pLast = pBlock; + HB_COMP_PARAM->functions.pLast = pBlock; } -void hb_compCodeBlockEnd( void ) +void hb_compCodeBlockEnd( HB_COMP_DECL ) { PFUNCTION pCodeblock; /* pointer to the current codeblock */ PFUNCTION pFunc;/* pointer to a function that owns a codeblock */ @@ -4312,16 +4220,16 @@ void hb_compCodeBlockEnd( void ) int iLocalPos; PVAR pVar, pFree; - hb_compGenPCode1( HB_P_ENDBLOCK ); /* finish the codeblock */ + hb_compGenPCode1( HB_P_ENDBLOCK, HB_COMP_PARAM ); /* finish the codeblock */ - hb_compOptimizeJumps(); + hb_compOptimizeJumps( HB_COMP_PARAM ); - pCodeblock = hb_comp_functions.pLast; + pCodeblock = HB_COMP_PARAM->functions.pLast; /* return to pcode buffer of function/codeblock in which the current * codeblock was defined */ - hb_comp_functions.pLast = pCodeblock->pOwner; + HB_COMP_PARAM->functions.pLast = pCodeblock->pOwner; /* find the function that owns the codeblock */ pFunc = pCodeblock->pOwner; @@ -4342,7 +4250,7 @@ void hb_compCodeBlockEnd( void ) pVar = pCodeblock->pStatics; while( pVar ) { - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) wLocalsLen += (4 + strlen(pVar->szName)); pVar = pVar->pNext; ++wLocals; @@ -4351,40 +4259,40 @@ void hb_compCodeBlockEnd( void ) /* NOTE: 2 = HB_P_PUSHBLOCK + BYTE( size ) */ wSize = ( USHORT ) pCodeblock->lPCodePos + 2; - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) { - wSize += (3 + strlen( hb_pp_fileName( hb_comp_data->pLex->pPP ) ) + strlen( pFunc->szName )); + wSize += (3 + strlen( hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ) ) + strlen( pFunc->szName )); wSize += wLocalsLen; } if( wSize <= 255 && pCodeblock->wParamCount == 0 && wLocals == 0 ) { - hb_compGenPCode2( HB_P_PUSHBLOCKSHORT, ( BYTE ) wSize, ( BOOL ) 0 ); + hb_compGenPCode2( HB_P_PUSHBLOCKSHORT, ( BYTE ) wSize, HB_COMP_PARAM ); } else { /* NOTE: 8 = HB_P_PUSHBLOCK + USHORT( size ) + USHORT( wParams ) + USHORT( wLocals ) + _ENDBLOCK */ wSize += (5+ wLocals * 2); - hb_compGenPCode3( HB_P_PUSHBLOCK, HB_LOBYTE( wSize ), HB_HIBYTE( wSize ), ( BOOL ) 0 ); + hb_compGenPCode3( HB_P_PUSHBLOCK, HB_LOBYTE( wSize ), HB_HIBYTE( wSize ), HB_COMP_PARAM ); /* generate the number of local parameters */ - hb_compGenPCode2( HB_LOBYTE( pCodeblock->wParamCount ), HB_HIBYTE( pCodeblock->wParamCount ), ( BOOL ) 0 ); + hb_compGenPCode2( HB_LOBYTE( pCodeblock->wParamCount ), HB_HIBYTE( pCodeblock->wParamCount ), HB_COMP_PARAM ); /* generate the number of referenced local variables */ - hb_compGenPCode2( HB_LOBYTE( wLocals ), HB_HIBYTE( wLocals ), ( BOOL ) 0 ); + hb_compGenPCode2( HB_LOBYTE( wLocals ), HB_HIBYTE( wLocals ), HB_COMP_PARAM ); /* generate the table of referenced local variables */ pVar = pCodeblock->pStatics; while( wLocals-- ) { wPos = hb_compVariableGetPos( pFunc->pLocals, pVar->szName ); - hb_compGenPCode2( HB_LOBYTE( wPos ), HB_HIBYTE( wPos ), ( BOOL ) 0 ); + hb_compGenPCode2( HB_LOBYTE( wPos ), HB_HIBYTE( wPos ), HB_COMP_PARAM ); pVar = pVar->pNext; } } - if( hb_comp_bDebugInfo ) + if( HB_COMP_PARAM->fDebugInfo ) { BYTE * pBuffer; - char * szFile = hb_pp_fileName( hb_comp_data->pLex->pPP ); + char * szFile = hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ); int iLen = strlen( szFile ); pBuffer = ( BYTE * ) hb_xgrab( 3 + iLen + strlen( pFunc->szName ) ); @@ -4392,7 +4300,7 @@ void hb_compCodeBlockEnd( void ) memcpy( ( BYTE * ) ( &( pBuffer[1] ) ), ( BYTE * ) szFile, iLen ); pBuffer[ iLen + 1 ] = ':'; memcpy( ( BYTE * ) ( &( pBuffer[ iLen + 2 ] ) ), ( BYTE * ) pFunc->szName, strlen( pFunc->szName ) + 1 ); - hb_compGenPCodeN( pBuffer, 3 + iLen + strlen( pFunc->szName ), 0 ); + hb_compGenPCodeN( pBuffer, 3 + iLen + strlen( pFunc->szName ), HB_COMP_PARAM ); hb_xfree( pBuffer ); /* generate the name of referenced local variables */ @@ -4409,7 +4317,7 @@ void hb_compCodeBlockEnd( void ) memcpy( ( BYTE * ) ( & ( pBuffer[3] ) ), pVar->szName, strlen( pVar->szName ) + 1 ); - hb_compGenPCodeN( pBuffer, strlen( pVar->szName ) + 4 , 0 ); + hb_compGenPCodeN( pBuffer, strlen( pVar->szName ) + 4, HB_COMP_PARAM ); hb_xfree( pBuffer ); @@ -4430,15 +4338,15 @@ void hb_compCodeBlockEnd( void ) hb_xfree( ( void * ) pFree ); } } - hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, ( BOOL ) 0 ); + hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, HB_COMP_PARAM ); /* this fake-function is no longer needed */ hb_xfree( ( void * ) pCodeblock->pCode ); pVar = pCodeblock->pLocals; while( pVar ) { - if( hb_comp_iWarnings && pFunc->szName && pVar->szName && ! ( pVar->iUsed & VU_USED ) ) - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_BLOCKVAR_NOT_USED, pVar->szName, pFunc->szName ); + if( HB_COMP_PARAM->iWarnings && pFunc->szName && pVar->szName && ! ( pVar->iUsed & VU_USED ) ) + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_BLOCKVAR_NOT_USED, pVar->szName, pFunc->szName ); /* free used variables */ pFree = pVar; @@ -4467,18 +4375,18 @@ void hb_compCodeBlockEnd( void ) hb_xfree( ( void * ) pCodeblock ); } -void hb_compCodeBlockStop( void ) +void hb_compCodeBlockStop( HB_COMP_DECL ) { PFUNCTION pCodeblock; /* pointer to the current codeblock */ PFUNCTION pFunc;/* pointer to a function that owns a codeblock */ PVAR pVar, pFree; - pCodeblock = hb_comp_functions.pLast; + pCodeblock = HB_COMP_PARAM->functions.pLast; /* return to pcode buffer of function/codeblock in which the current * codeblock was defined */ - hb_comp_functions.pLast = pCodeblock->pOwner; + HB_COMP_PARAM->functions.pLast = pCodeblock->pOwner; /* find the function that owns the codeblock */ pFunc = pCodeblock->pOwner; @@ -4488,8 +4396,8 @@ void hb_compCodeBlockStop( void ) pVar = pCodeblock->pLocals; while( pVar ) { - if( hb_comp_iWarnings && pFunc->szName && pVar->szName && ! ( pVar->iUsed & VU_USED ) ) - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_BLOCKVAR_NOT_USED, pVar->szName, pFunc->szName ); + if( HB_COMP_PARAM->iWarnings && pFunc->szName && pVar->szName && ! ( pVar->iUsed & VU_USED ) ) + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_BLOCKVAR_NOT_USED, pVar->szName, pFunc->szName ); /* free used variables */ pFree = pVar; @@ -4498,16 +4406,16 @@ void hb_compCodeBlockStop( void ) hb_xfree( ( void * ) pFree ); } - hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, FALSE ); + hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, HB_COMP_PARAM ); hb_xfree( ( void * ) pCodeblock->pCode ); hb_xfree( ( void * ) pCodeblock ); } -void hb_compCodeBlockRewind() +void hb_compCodeBlockRewind( HB_COMP_DECL ) { PFUNCTION pCodeblock; /* pointer to the current codeblock */ - pCodeblock = hb_comp_functions.pLast; + pCodeblock = HB_COMP_PARAM->functions.pLast; pCodeblock->lPCodePos = 0; /* Release the NOOP array. */ @@ -4527,140 +4435,145 @@ void hb_compCodeBlockRewind() /* ************************************************************************* */ /* initialize support variables */ -static void hb_compInitVars( void ) +static void hb_compInitVars( HB_COMP_DECL ) { - hb_comp_functions.iCount = 0; - hb_comp_functions.pFirst = NULL; - hb_comp_functions.pLast = NULL; - hb_comp_funcalls.iCount = 0; - hb_comp_funcalls.pFirst = NULL; - hb_comp_funcalls.pLast = NULL; - hb_comp_symbols.iCount = 0; - hb_comp_symbols.pFirst = NULL; - hb_comp_symbols.pLast = NULL; - hb_comp_szAnnounce = NULL; - hb_comp_pInitFunc = NULL; - hb_comp_bAnyWarning = FALSE; + HB_COMP_PARAM->functions.iCount = 0; + HB_COMP_PARAM->functions.pFirst = NULL; + HB_COMP_PARAM->functions.pLast = NULL; + HB_COMP_PARAM->funcalls.iCount = 0; + HB_COMP_PARAM->funcalls.pFirst = NULL; + HB_COMP_PARAM->funcalls.pLast = NULL; + HB_COMP_PARAM->szAnnounce = NULL; + HB_COMP_PARAM->fTextSubst = TRUE; + HB_COMP_PARAM->fLongOptimize = TRUE; - hb_comp_iLine = 1; - hb_comp_iFunctionCnt = 0; - hb_comp_iErrorCount = 0; - hb_comp_cVarType = ' '; - hb_comp_ulLastLinePos = 0; - hb_comp_iStaticCnt = 0; - hb_comp_iVarScope = VS_LOCAL; + HB_COMP_PARAM->symbols.iCount = 0; + HB_COMP_PARAM->symbols.pFirst = NULL; + HB_COMP_PARAM->symbols.pLast = NULL; + HB_COMP_PARAM->pInitFunc = NULL; + HB_COMP_PARAM->fAnyWarning = FALSE; - hb_comp_inlines.iCount = 0; - hb_comp_inlines.pFirst = NULL; - hb_comp_inlines.pLast = NULL; + HB_COMP_PARAM->iFunctionCnt = 0; + HB_COMP_PARAM->iErrorCount = 0; + HB_COMP_PARAM->cVarType = ' '; + HB_COMP_PARAM->lastLinePos = 0; + HB_COMP_PARAM->iStaticCnt = 0; + HB_COMP_PARAM->iVarScope = VS_LOCAL; + + HB_COMP_PARAM->inlines.iCount = 0; + HB_COMP_PARAM->inlines.pFirst = NULL; + HB_COMP_PARAM->inlines.pLast = NULL; } -static void hb_compGenOutput( int iLanguage ) +static void hb_compGenOutput( HB_COMP_DECL, int iLanguage ) { - HB_TRACE(HB_TR_DEBUG, ("hb_pp_compGenOutput()")); + HB_TRACE(HB_TR_DEBUG, ("hb_compGenOutput()")); switch( iLanguage ) { case LANG_C: - hb_compGenCCode( hb_comp_pFileName ); + hb_compGenCCode( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); break; case LANG_CLI: - hb_compGenILCode( hb_comp_pFileName ); + hb_compGenILCode( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); break; case LANG_OBJ32: - hb_compGenObj32( hb_comp_pFileName ); + hb_compGenObj32( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); break; case LANG_JAVA: - hb_compGenJava( hb_comp_pFileName ); + hb_compGenJava( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); break; case LANG_PORT_OBJ: - hb_compGenPortObj( hb_comp_pFileName ); + hb_compGenPortObj( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); break; case LANG_OBJ_MODULE: - hb_compGenCObj( hb_comp_pFileName ); + hb_compGenCObj( HB_COMP_PARAM, HB_COMP_PARAM->pFileName ); break; } } -static void hb_compPpoFile( void ) +static void hb_compPpoFile( HB_COMP_DECL ) { - HB_TRACE(HB_TR_DEBUG, ("hb_pp_compPpoFile()")); + HB_TRACE(HB_TR_DEBUG, ("hb_compPpoFile()")); - hb_comp_pFilePpo->szPath = NULL; - hb_comp_pFilePpo->szExtension = NULL; + HB_COMP_PARAM->pFilePpo->szPath = NULL; + HB_COMP_PARAM->pFilePpo->szExtension = NULL; /* we create the output file name */ - if( hb_comp_pPpoPath ) + if( HB_COMP_PARAM->pPpoPath ) { - if( hb_comp_pPpoPath->szPath ) - hb_comp_pFilePpo->szPath = hb_comp_pPpoPath->szPath; + if( HB_COMP_PARAM->pPpoPath->szPath ) + HB_COMP_PARAM->pFilePpo->szPath = HB_COMP_PARAM->pPpoPath->szPath; - if( hb_comp_pPpoPath->szName ) + if( HB_COMP_PARAM->pPpoPath->szName ) { - hb_comp_pFilePpo->szName = hb_comp_pPpoPath->szName; + HB_COMP_PARAM->pFilePpo->szName = HB_COMP_PARAM->pPpoPath->szName; /* - if( hb_comp_pPpoPath->szExtension ) - hb_comp_pFilePpo->szExtension = hb_comp_pPpoPath->szExtension; + if( HB_COMP_PARAM->pPpoPath->szExtension ) + HB_COMP_PARAM->pFilePpo->szExtension = HB_COMP_PARAM->pPpoPath->szExtension; else */ } - hb_comp_pFilePpo->szExtension = ".ppo"; + HB_COMP_PARAM->pFilePpo->szExtension = ".ppo"; } } -static void hb_compOutputFile( void ) +static void hb_compOutputFile( HB_COMP_DECL ) { - HB_TRACE(HB_TR_DEBUG, ("hb_pp_compOutputFile()")); + HB_TRACE(HB_TR_DEBUG, ("hb_compOutputFile()")); - hb_comp_pFileName->szPath = NULL; - hb_comp_pFileName->szExtension = NULL; + HB_COMP_PARAM->pFileName->szPath = NULL; + HB_COMP_PARAM->pFileName->szExtension = NULL; /* we create the output file name */ - if( hb_comp_pOutPath ) + if( HB_COMP_PARAM->pOutPath ) { - if( hb_comp_pOutPath->szPath ) - hb_comp_pFileName->szPath = hb_comp_pOutPath->szPath; + if( HB_COMP_PARAM->pOutPath->szPath ) + HB_COMP_PARAM->pFileName->szPath = HB_COMP_PARAM->pOutPath->szPath; - if( hb_comp_pOutPath->szName ) + if( HB_COMP_PARAM->pOutPath->szName ) { - hb_comp_pFileName->szName = hb_comp_pOutPath->szName; - if( hb_comp_pOutPath->szExtension ) - hb_comp_pFileName->szExtension = hb_comp_pOutPath->szExtension; + HB_COMP_PARAM->pFileName->szName = HB_COMP_PARAM->pOutPath->szName; + if( HB_COMP_PARAM->pOutPath->szExtension ) + HB_COMP_PARAM->pFileName->szExtension = HB_COMP_PARAM->pOutPath->szExtension; } } } -int hb_compCompile( char * szPrg, BOOL bSingleFile ) +static int hb_compCompile( HB_COMP_DECL, char * szPrg, BOOL bSingleFile ) { int iStatus = EXIT_SUCCESS; - HB_TRACE(HB_TR_DEBUG, ("hb_pp_compCompile(%s,%d)", szPrg, bSingleFile)); + HB_TRACE(HB_TR_DEBUG, ("hb_compCompile(%s,%d)", szPrg, bSingleFile)); - hb_comp_pMainFileName = hb_fsFNameSplit( szPrg ); - hb_comp_pFileName = hb_comp_pMainFileName; + HB_COMP_PARAM->pMainFileName = hb_fsFNameSplit( szPrg ); + HB_COMP_PARAM->pFileName = HB_COMP_PARAM->pMainFileName; - if( hb_comp_pFileName->szName ) + if( HB_COMP_PARAM->pFileName->szName ) { char szFileName[ _POSIX_PATH_MAX + 1 ]; /* filename to parse */ char szPpoName[ _POSIX_PATH_MAX + 1 ]; - if( !hb_comp_pFileName->szExtension ) - hb_comp_pFileName->szExtension = ".prg"; + /* Clear and reinitialize preprocessor state */ + hb_pp_reset( HB_COMP_PARAM->pLex->pPP ); - hb_fsFNameMerge( szFileName, hb_comp_pFileName ); + if( !HB_COMP_PARAM->pFileName->szExtension ) + HB_COMP_PARAM->pFileName->szExtension = ".prg"; - if( hb_comp_bPPO && bSingleFile ) + hb_fsFNameMerge( szFileName, HB_COMP_PARAM->pFileName ); + + if( HB_COMP_PARAM->fPPO && bSingleFile ) { - hb_comp_pFilePpo = hb_fsFNameSplit( szPrg ); - hb_compPpoFile(); - /*hb_comp_pFileName->szExtension = ".ppo";*/ - hb_fsFNameMerge( szPpoName, hb_comp_pFilePpo ); - if( !hb_pp_outFile( hb_comp_data->pLex->pPP, szPpoName, NULL ) ) + HB_COMP_PARAM->pFilePpo = hb_fsFNameSplit( szPrg ); + hb_compPpoFile( HB_COMP_PARAM ); + /*HB_COMP_PARAM->pFileName->szExtension = ".ppo";*/ + hb_fsFNameMerge( szPpoName, HB_COMP_PARAM->pFilePpo ); + if( !hb_pp_outFile( HB_COMP_PARAM->pLex->pPP, szPpoName, NULL ) ) iStatus = EXIT_FAILURE; } @@ -4670,28 +4583,28 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) /* hb_compChkDefines( argc, argv ); */ /* Initialize support variables */ - hb_compInitVars(); + hb_compInitVars( HB_COMP_PARAM ); - if( hb_pp_inFile( hb_comp_data->pLex->pPP, szFileName, FALSE, NULL, FALSE ) ) + if( hb_pp_inFile( HB_COMP_PARAM->pLex->pPP, szFileName, FALSE, NULL, FALSE ) ) { BOOL bSkipGen = FALSE ; - hb_comp_szFile = szFileName; + HB_COMP_PARAM->szFile = szFileName; if( bSingleFile ) { - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { - if( hb_comp_bPPO ) + if( HB_COMP_PARAM->fPPO ) printf( "Compiling '%s' and generating preprocessed output to '%s'...\n", szFileName, szPpoName ); else printf( "Compiling '%s'...\n", szFileName ); } /* Generate the starting procedure frame */ - if( hb_comp_bStartProc ) + if( HB_COMP_PARAM->fStartProc ) { - hb_compFunctionAdd( hb_compIdentifierNew( hb_strupr( hb_strdup( hb_comp_pFileName->szName ) ), FALSE ), HB_FS_PUBLIC, FUN_PROCEDURE ); + hb_compFunctionAdd( HB_COMP_PARAM, hb_compIdentifierNew( HB_COMP_PARAM, hb_strupr( hb_strdup( HB_COMP_PARAM->pFileName->szName ) ), FALSE ), HB_FS_PUBLIC, FUN_PROCEDURE ); } else { @@ -4699,15 +4612,15 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) * will be not generated. The name cannot be placed as first symbol * because this symbol can be used as function call or memvar's name. */ - hb_compFunctionAdd( hb_compIdentifierNew( "", TRUE ), HB_FS_PUBLIC, FUN_PROCEDURE ); + hb_compFunctionAdd( HB_COMP_PARAM, "", HB_FS_PUBLIC, FUN_PROCEDURE ); } - yyparse( hb_comp_data ); + yyparse( HB_COMP_PARAM ); - if( hb_comp_pFilePpo ) + if( HB_COMP_PARAM->pFilePpo ) { - hb_xfree( hb_comp_pFilePpo ); - hb_comp_pFilePpo = NULL; + hb_xfree( HB_COMP_PARAM->pFilePpo ); + HB_COMP_PARAM->pFilePpo = NULL; } } else @@ -4718,14 +4631,14 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) /* Open refernced modules (using DO ... WITh statement * or from @.clp command line option */ - while( hb_comp_pAutoOpen ) + while( HB_COMP_PARAM->autoopen ) { - PAUTOOPEN pAutoOpen = hb_comp_pAutoOpen; + PAUTOOPEN pAutoOpen = HB_COMP_PARAM->autoopen; - if( ! hb_compFunctionFind( pAutoOpen->szName ) ) - hb_compAutoOpen( pAutoOpen->szName, &bSkipGen, bSingleFile ); + if( ! hb_compFunctionFind( HB_COMP_PARAM, pAutoOpen->szName ) ) + hb_compAutoOpen( HB_COMP_PARAM, pAutoOpen->szName, &bSkipGen, bSingleFile ); - hb_comp_pAutoOpen = hb_comp_pAutoOpen->pNext; + HB_COMP_PARAM->autoopen = HB_COMP_PARAM->autoopen->pNext; hb_xfree( pAutoOpen->szName ); hb_xfree( pAutoOpen ); @@ -4734,49 +4647,50 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) /* Begin of finalization phase. */ /* fix all previous function returns offsets */ - hb_compFinalizeFunction(); + hb_compFinalizeFunction( HB_COMP_PARAM ); - hb_compExternGen(); /* generates EXTERN symbols names */ + hb_compExternGen( HB_COMP_PARAM ); /* generates EXTERN symbols names */ - if( hb_comp_pInitFunc ) + if( HB_COMP_PARAM->pInitFunc ) { PCOMSYMBOL pSym; - char szNewName[ 32 ]; + char * szNewName; /* Fix the number of static variables */ - hb_comp_pInitFunc->pCode[ 3 ] = HB_LOBYTE( hb_comp_iStaticCnt ); - hb_comp_pInitFunc->pCode[ 4 ] = HB_HIBYTE( hb_comp_iStaticCnt ); - hb_comp_pInitFunc->iStaticsBase = hb_comp_iStaticCnt; + HB_COMP_PARAM->pInitFunc->pCode[ 3 ] = HB_LOBYTE( HB_COMP_PARAM->iStaticCnt ); + HB_COMP_PARAM->pInitFunc->pCode[ 4 ] = HB_HIBYTE( HB_COMP_PARAM->iStaticCnt ); + HB_COMP_PARAM->pInitFunc->iStaticsBase = HB_COMP_PARAM->iStaticCnt; /* Update pseudo function name */ - sprintf( szNewName, "(_INITSTATICS%05d)", hb_comp_iStaticCnt ); - hb_comp_pInitFunc->szName = hb_compIdentifierNew( szNewName, TRUE ); + szNewName = ( char * ) hb_xgrab( 25 ); + sprintf( szNewName, "(_INITSTATICS%05d)", HB_COMP_PARAM->iStaticCnt ); + HB_COMP_PARAM->pInitFunc->szName = hb_compIdentifierNew( HB_COMP_PARAM, szNewName, FALSE ); - pSym = hb_compSymbolAdd( hb_comp_pInitFunc->szName, NULL, HB_SYM_FUNCNAME ); - pSym->cScope |= hb_comp_pInitFunc->cScope; - hb_comp_functions.pLast->pNext = hb_comp_pInitFunc; - hb_comp_functions.pLast = hb_comp_pInitFunc; - hb_compGenPCode1( HB_P_ENDPROC ); - ++hb_comp_functions.iCount; + pSym = hb_compSymbolAdd( HB_COMP_PARAM, HB_COMP_PARAM->pInitFunc->szName, NULL, HB_SYM_FUNCNAME ); + pSym->cScope |= HB_COMP_PARAM->pInitFunc->cScope; + HB_COMP_PARAM->functions.pLast->pNext = HB_COMP_PARAM->pInitFunc; + HB_COMP_PARAM->functions.pLast = HB_COMP_PARAM->pInitFunc; + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); + ++HB_COMP_PARAM->functions.iCount; } - if( hb_comp_szAnnounce ) - hb_compAnnounce( hb_comp_szAnnounce ); + if( HB_COMP_PARAM->szAnnounce ) + hb_compAnnounce( HB_COMP_PARAM, HB_COMP_PARAM->szAnnounce ); /* End of finalization phase. */ - if( hb_comp_iErrorCount || hb_comp_bAnyWarning ) + if( HB_COMP_PARAM->iErrorCount || HB_COMP_PARAM->fAnyWarning ) { - if( hb_comp_iErrorCount ) + if( HB_COMP_PARAM->iErrorCount ) { iStatus = EXIT_FAILURE; bSkipGen = TRUE; - printf( "\r%i error%s\n\nNo code generated\n", hb_comp_iErrorCount, ( hb_comp_iErrorCount > 1 ? "s" : "" ) ); + printf( "\r%i error%s\n\nNo code generated\n", HB_COMP_PARAM->iErrorCount, ( HB_COMP_PARAM->iErrorCount > 1 ? "s" : "" ) ); } - else if( hb_comp_iExitLevel == HB_EXITLEVEL_SETEXIT ) + else if( HB_COMP_PARAM->iExitLevel == HB_EXITLEVEL_SETEXIT ) { iStatus = EXIT_FAILURE; } - else if( hb_comp_iExitLevel == HB_EXITLEVEL_DELTARGET ) + else if( HB_COMP_PARAM->iExitLevel == HB_EXITLEVEL_DELTARGET ) { iStatus = EXIT_FAILURE; bSkipGen = TRUE; @@ -4784,35 +4698,35 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) } } - if( ! hb_comp_bSyntaxCheckOnly && ! bSkipGen && ( hb_comp_iErrorCount == 0 ) ) + if( ! HB_COMP_PARAM->fSyntaxCheckOnly && ! bSkipGen && ( HB_COMP_PARAM->iErrorCount == 0 ) ) { char * szFirstFunction = NULL; PFUNCTION *pFunPtr; /* we create the output file name */ - hb_compOutputFile(); + hb_compOutputFile( HB_COMP_PARAM ); - pFunPtr = &hb_comp_functions.pFirst; - if( ! hb_comp_bStartProc ) + pFunPtr = &HB_COMP_PARAM->functions.pFirst; + if( ! HB_COMP_PARAM->fStartProc ) { /* skip first non-startup procedure */ - hb_compOptimizeFrames( *pFunPtr ); + hb_compOptimizeFrames( HB_COMP_PARAM, *pFunPtr ); pFunPtr = &(*pFunPtr)->pNext; - hb_comp_iFunctionCnt--; + HB_COMP_PARAM->iFunctionCnt--; } while( *pFunPtr ) { /* remove function frames with no names */ - if( ! hb_comp_bStartProc && ! (*pFunPtr)->szName[0] ) + if( ! HB_COMP_PARAM->fStartProc && ! (*pFunPtr)->szName[0] ) { - *pFunPtr = hb_compFunctionKill( *pFunPtr ); - hb_comp_functions.iCount--; - hb_comp_iFunctionCnt--; + *pFunPtr = hb_compFunctionKill( HB_COMP_PARAM, *pFunPtr ); + HB_COMP_PARAM->functions.iCount--; + HB_COMP_PARAM->iFunctionCnt--; } else { - hb_compOptimizeFrames( *pFunPtr ); + hb_compOptimizeFrames( HB_COMP_PARAM, *pFunPtr ); if( szFirstFunction == NULL && ! ( ( *pFunPtr )->cScope & (HB_FS_INIT | HB_FS_EXIT) ) ) @@ -4825,7 +4739,7 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) if( szFirstFunction ) { - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; while( pSym ) { @@ -4838,12 +4752,12 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) } } - if( ! hb_comp_bQuiet ) - printf( "\rLines %i, Functions/Procedures %i\n", hb_comp_iLine, hb_comp_iFunctionCnt ); + if( ! HB_COMP_PARAM->fQuiet ) + printf( "\rLines %i, Functions/Procedures %i\n", hb_pp_lineTot( HB_COMP_PARAM->pLex->pPP ), HB_COMP_PARAM->iFunctionCnt ); - hb_compGenOutput( hb_comp_iLanguage ); + hb_compGenOutput( HB_COMP_PARAM, HB_COMP_PARAM->iLanguage ); } - hb_compCompileEnd(); + hb_compCompileEnd( HB_COMP_PARAM ); } else { @@ -4853,164 +4767,140 @@ int hb_compCompile( char * szPrg, BOOL bSingleFile ) iStatus = EXIT_FAILURE; } - hb_comp_bExternal = FALSE; + HB_COMP_PARAM->fExternal = FALSE; } } else { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADFILENAME, szPrg, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADFILENAME, szPrg, NULL ); iStatus = EXIT_FAILURE; } return iStatus; } -static void hb_compCompileEnd( void ) +static void hb_compCompileEnd( HB_COMP_DECL ) { - hb_compRTVariableKill(); + hb_compRTVariableKill( HB_COMP_PARAM ); - if( hb_comp_pFileName ) + if( HB_COMP_PARAM->pFileName ) { - if( hb_comp_pFileName != hb_comp_pMainFileName && hb_comp_pMainFileName ) + if( HB_COMP_PARAM->pFileName != HB_COMP_PARAM->pMainFileName && HB_COMP_PARAM->pMainFileName ) { /* currently compiled file was autoopened - close also * the main module */ - hb_xfree( hb_comp_pMainFileName ); - hb_comp_pMainFileName = NULL; + hb_xfree( HB_COMP_PARAM->pMainFileName ); + HB_COMP_PARAM->pMainFileName = NULL; } - hb_xfree( hb_comp_pFileName ); - hb_comp_pFileName = NULL; + hb_xfree( HB_COMP_PARAM->pFileName ); + HB_COMP_PARAM->pFileName = NULL; } - if( hb_comp_pFilePpo ) + if( HB_COMP_PARAM->pFilePpo ) { - hb_xfree( hb_comp_pFilePpo ); - hb_comp_pFilePpo = NULL; + hb_xfree( HB_COMP_PARAM->pFilePpo ); + HB_COMP_PARAM->pFilePpo = NULL; } - if( hb_comp_functions.pFirst ) + if( HB_COMP_PARAM->functions.pFirst ) { - PFUNCTION pFunc = hb_comp_functions.pFirst; + PFUNCTION pFunc = HB_COMP_PARAM->functions.pFirst; while( pFunc ) - pFunc = hb_compFunctionKill( pFunc ); + pFunc = hb_compFunctionKill( HB_COMP_PARAM, pFunc ); - hb_comp_functions.pFirst = NULL; + HB_COMP_PARAM->functions.pFirst = NULL; } - if( hb_comp_funcalls.pFirst ) + if( HB_COMP_PARAM->funcalls.pFirst ) { - PFUNCTION pFunc = hb_comp_funcalls.pFirst; + PFUNCTION pFunc = HB_COMP_PARAM->funcalls.pFirst; while( pFunc ) { - hb_comp_funcalls.pFirst = pFunc->pNext; + HB_COMP_PARAM->funcalls.pFirst = pFunc->pNext; hb_xfree( ( void * ) pFunc ); /* NOTE: szName will be released by hb_compSymbolKill() */ - pFunc = hb_comp_funcalls.pFirst; + pFunc = HB_COMP_PARAM->funcalls.pFirst; } - hb_comp_funcalls.pFirst = NULL; + HB_COMP_PARAM->funcalls.pFirst = NULL; } - while( hb_comp_pExterns ) + while( HB_COMP_PARAM->externs ) { - PEXTERN pExtern = hb_comp_pExterns; + PEXTERN pExtern = HB_COMP_PARAM->externs; - hb_comp_pExterns = hb_comp_pExterns->pNext; + HB_COMP_PARAM->externs = HB_COMP_PARAM->externs->pNext; hb_xfree( pExtern ); } - if( hb_comp_inlines.pFirst ) + if( HB_COMP_PARAM->inlines.pFirst ) { - PINLINE pInline = hb_comp_inlines.pFirst; + PINLINE pInline = HB_COMP_PARAM->inlines.pFirst; while( pInline ) { - hb_comp_inlines.pFirst = pInline->pNext; + HB_COMP_PARAM->inlines.pFirst = pInline->pNext; if( pInline->pCode ) { hb_xfree( ( void * ) pInline->pCode ); } hb_xfree( ( void * ) pInline->szFileName ); hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */ - pInline = hb_comp_inlines.pFirst; + pInline = HB_COMP_PARAM->inlines.pFirst; } - hb_comp_inlines.pFirst = NULL; + HB_COMP_PARAM->inlines.pFirst = NULL; } - if( hb_comp_pReleaseDeclared ) + if( HB_COMP_PARAM->pReleaseDeclared ) { - PCOMDECLARED pDeclared = hb_comp_pReleaseDeclared; + PCOMDECLARED pDeclared = HB_COMP_PARAM->pReleaseDeclared; while( pDeclared ) { - hb_comp_pFirstDeclared = pDeclared->pNext; + HB_COMP_PARAM->pFirstDeclared = pDeclared->pNext; hb_xfree( ( void * ) pDeclared ); - pDeclared = hb_comp_pFirstDeclared; + pDeclared = HB_COMP_PARAM->pFirstDeclared; } - hb_comp_pFirstDeclared = NULL; + HB_COMP_PARAM->pFirstDeclared = NULL; } - if( hb_comp_pReleaseClass ) + if( HB_COMP_PARAM->pReleaseClass ) { - PCOMCLASS pClass = hb_comp_pReleaseClass; + PCOMCLASS pClass = HB_COMP_PARAM->pReleaseClass; PCOMDECLARED pDeclared; while( pClass ) { - hb_comp_pFirstClass = pClass->pNext; + HB_COMP_PARAM->pFirstClass = pClass->pNext; pDeclared = pClass->pMethod; while ( pDeclared ) { - hb_comp_pFirstDeclared = pDeclared->pNext; + HB_COMP_PARAM->pFirstDeclared = pDeclared->pNext; hb_xfree( ( void * ) pDeclared ); - pDeclared = hb_comp_pFirstDeclared; + pDeclared = HB_COMP_PARAM->pFirstDeclared; } hb_xfree( ( void * ) pClass ); - pClass = hb_comp_pFirstClass; + pClass = HB_COMP_PARAM->pFirstClass; } - hb_comp_pReleaseClass = NULL; + HB_COMP_PARAM->pReleaseClass = NULL; } - if( hb_comp_symbols.pFirst ) + if( HB_COMP_PARAM->symbols.pFirst ) { - PCOMSYMBOL pSym = hb_comp_symbols.pFirst; + PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst; while( pSym ) pSym = hb_compSymbolKill( pSym ); - hb_comp_symbols.pFirst = NULL; + HB_COMP_PARAM->symbols.pFirst = NULL; } } -void hb_compAutoOpenAdd( char * szName ) +static BOOL hb_compAutoOpenFind( HB_COMP_DECL, char * szName ) { - HB_TRACE(HB_TR_DEBUG, ("hb_pp_compAutoOpenAdd(%s)", szName)); + PAUTOOPEN pLast = HB_COMP_PARAM->autoopen; - if( hb_comp_bAutoOpen && ! hb_compAutoOpenFind( szName ) ) - { - PAUTOOPEN pAutoOpen = ( PAUTOOPEN ) hb_xgrab( sizeof( AUTOOPEN ) ), pLast; - - pAutoOpen->szName = hb_strdup( szName ); - pAutoOpen->pNext = NULL; - - if( hb_comp_pAutoOpen == NULL ) - hb_comp_pAutoOpen = pAutoOpen; - else - { - pLast = hb_comp_pAutoOpen; - while( pLast->pNext ) - pLast = pLast->pNext; - - pLast->pNext = pAutoOpen; - } - } -} - -BOOL hb_compAutoOpenFind( char * szName ) -{ - PAUTOOPEN pLast = hb_comp_pAutoOpen; - - HB_TRACE(HB_TR_DEBUG, ("hb_pp_compAutoOpenFind(%s)", szName)); + HB_TRACE(HB_TR_DEBUG, ("hb_compAutoOpenFind(%s)", szName)); if( pLast == NULL ) return FALSE; @@ -5030,78 +4920,101 @@ BOOL hb_compAutoOpenFind( char * szName ) return FALSE; } -int hb_compAutoOpen( char * szPrg, BOOL * pbSkipGen, BOOL bSingleFile ) +void hb_compAutoOpenAdd( HB_COMP_DECL, char * szName ) +{ + HB_TRACE(HB_TR_DEBUG, ("hb_compAutoOpenAdd(%p,%s)", HB_COMP_PARAM, szName)); + + if( HB_COMP_PARAM->fAutoOpen && ! hb_compAutoOpenFind( HB_COMP_PARAM, szName ) ) + { + PAUTOOPEN pAutoOpen = ( PAUTOOPEN ) hb_xgrab( sizeof( AUTOOPEN ) ), pLast; + + pAutoOpen->szName = hb_strdup( szName ); + pAutoOpen->pNext = NULL; + + if( HB_COMP_PARAM->autoopen == NULL ) + HB_COMP_PARAM->autoopen = pAutoOpen; + else + { + pLast = HB_COMP_PARAM->autoopen; + while( pLast->pNext ) + pLast = pLast->pNext; + + pLast->pNext = pAutoOpen; + } + } +} + +static int hb_compAutoOpen( HB_COMP_DECL, char * szPrg, BOOL * pbSkipGen, BOOL bSingleFile ) { int iStatus = EXIT_SUCCESS; - PHB_FNAME pMainFileName = hb_comp_pFileName; + PHB_FNAME pMainFileName = HB_COMP_PARAM->pFileName; - hb_comp_pFileName = hb_fsFNameSplit( szPrg ); + HB_COMP_PARAM->pFileName = hb_fsFNameSplit( szPrg ); - if( hb_comp_pFileName->szName ) + if( HB_COMP_PARAM->pFileName->szName ) { char szFileName[ _POSIX_PATH_MAX ]; /* filename to parse */ char szPpoName[ _POSIX_PATH_MAX ]; - if( !hb_comp_pFileName->szExtension ) - hb_comp_pFileName->szExtension = ".prg"; + /* Clear and reinitialize preprocessor state */ + hb_pp_reset( HB_COMP_PARAM->pLex->pPP ); - hb_fsFNameMerge( szFileName, hb_comp_pFileName ); + if( !HB_COMP_PARAM->pFileName->szExtension ) + HB_COMP_PARAM->pFileName->szExtension = ".prg"; - if( hb_comp_bPPO ) + hb_fsFNameMerge( szFileName, HB_COMP_PARAM->pFileName ); + + if( HB_COMP_PARAM->fPPO ) { - hb_comp_pFileName->szExtension = ".ppo"; - hb_fsFNameMerge( szPpoName, hb_comp_pFileName ); + HB_COMP_PARAM->pFileName->szExtension = ".ppo"; + hb_fsFNameMerge( szPpoName, HB_COMP_PARAM->pFileName ); - if( !hb_pp_outFile( hb_comp_data->pLex->pPP, szPpoName, NULL ) ) + if( !hb_pp_outFile( HB_COMP_PARAM->pLex->pPP, szPpoName, NULL ) ) iStatus = EXIT_FAILURE; } if( iStatus == EXIT_SUCCESS ) { /* Minimal Init. */ - hb_comp_iLine= 1; - - if( hb_pp_inFile( hb_comp_data->pLex->pPP, szFileName, FALSE, NULL, FALSE ) ) + if( hb_pp_inFile( HB_COMP_PARAM->pLex->pPP, szFileName, FALSE, NULL, FALSE ) ) { - if( ! hb_comp_bQuiet ) + if( ! HB_COMP_PARAM->fQuiet ) { - if( hb_comp_bPPO ) + if( HB_COMP_PARAM->fPPO ) printf( "Compiling module '%s' and generating preprocessed output to '%s'...\n", szFileName, szPpoName ); else printf( "Compiling module '%s'...\n", szFileName ); } - hb_pp_reset( hb_comp_data->pLex->pPP ); - /* Generate the starting procedure frame */ - if( hb_comp_bStartProc ) - hb_compFunctionAdd( hb_compIdentifierNew( hb_strupr( hb_comp_pFileName->szName ), TRUE ) , HB_FS_PUBLIC, FUN_PROCEDURE ); + if( HB_COMP_PARAM->fStartProc ) + hb_compFunctionAdd( HB_COMP_PARAM, hb_compIdentifierNew( HB_COMP_PARAM, hb_strupr( hb_strdup( HB_COMP_PARAM->pFileName->szName ) ), FALSE ), HB_FS_PUBLIC, FUN_PROCEDURE ); else if( ! bSingleFile ) - hb_compFunctionAdd( hb_compIdentifierNew( "", TRUE ), HB_FS_PUBLIC, FUN_PROCEDURE ); + hb_compFunctionAdd( HB_COMP_PARAM, "", HB_FS_PUBLIC, FUN_PROCEDURE ); { - int i = hb_comp_iExitLevel ; - BOOL b = hb_comp_bAnyWarning; + int i = HB_COMP_PARAM->iExitLevel ; + BOOL b = HB_COMP_PARAM->fAnyWarning; - yyparse( hb_comp_data ); + yyparse( HB_COMP_PARAM ); - if( hb_comp_pFilePpo ) + if( HB_COMP_PARAM->pFilePpo ) { - hb_xfree( hb_comp_pFilePpo ); - hb_comp_pFilePpo = NULL; + hb_xfree( HB_COMP_PARAM->pFilePpo ); + HB_COMP_PARAM->pFilePpo = NULL; } - hb_comp_iExitLevel = ( i > hb_comp_iExitLevel ? i : hb_comp_iExitLevel ); - hb_comp_bAnyWarning = ( b ? b : hb_comp_bAnyWarning ); + HB_COMP_PARAM->iExitLevel = ( i > HB_COMP_PARAM->iExitLevel ? i : HB_COMP_PARAM->iExitLevel ); + HB_COMP_PARAM->fAnyWarning = ( b ? b : HB_COMP_PARAM->fAnyWarning ); } - if( hb_comp_bAnyWarning ) + if( HB_COMP_PARAM->fAnyWarning ) { - if( hb_comp_iExitLevel == HB_EXITLEVEL_SETEXIT ) + if( HB_COMP_PARAM->iExitLevel == HB_EXITLEVEL_SETEXIT ) { iStatus = EXIT_FAILURE; } - else if( hb_comp_iExitLevel == HB_EXITLEVEL_DELTARGET ) + else if( HB_COMP_PARAM->iExitLevel == HB_EXITLEVEL_DELTARGET ) { iStatus = EXIT_FAILURE; *pbSkipGen = TRUE; @@ -5117,12 +5030,12 @@ int hb_compAutoOpen( char * szPrg, BOOL * pbSkipGen, BOOL bSingleFile ) } else { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BADFILENAME, szPrg, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BADFILENAME, szPrg, NULL ); iStatus = EXIT_FAILURE; } - hb_xfree( hb_comp_pFileName ); - hb_comp_pFileName = pMainFileName; + hb_xfree( HB_COMP_PARAM->pFileName ); + HB_COMP_PARAM->pFileName = pMainFileName; return iStatus; } diff --git a/harbour/source/compiler/harbour.l b/harbour/source/compiler/harbour.l index c9748f4989..e2cb215558 100644 --- a/harbour/source/compiler/harbour.l +++ b/harbour/source/compiler/harbour.l @@ -88,7 +88,11 @@ int yy_lex_input( char *, int ); #define RINDEX -16 #define LARRAY -32 #define RARRAY -64 + static int hb_comp_iState = LOOKUP; +static int hb_comp_iLineINLINE = 0; +static int hb_comp_iLinePRG; + #define YY_OPERATOR_RET(t) hb_comp_iState = OPERATOR; pComp->pLex->lasttok = yytext; return (t) #define YY_TOKEN_RET(s,t) hb_comp_iState = (s); pComp->pLex->lasttok = yytext; return (t) @@ -359,14 +363,6 @@ Separator {SpaceTab} \n { hb_comp_iState = LOOKUP; - -/* - if( ! hb_comp_bQuiet && ( hb_comp_iLine % 100 ) == 0 ) - { - printf( "\r%i", hb_comp_iLine ); - fflush( stdout ); - } -*/ pComp->pLex->lasttok = "\n"; return '\n'; } @@ -912,7 +908,7 @@ Separator {SpaceTab} int iSize, iBraces = 0; PINLINE pInline; - hb_comp_iLineINLINE = hb_comp_iLine; + hb_comp_iLineINLINE = hb_pp_line( HB_COMP_PARAM->pLex->pPP ) + 1; hb_pp_StreamBlock = HB_PP_STREAM_DUMP_C; sInlineSym[10] = hb_comp_cInlineID++; @@ -935,7 +931,7 @@ Separator {SpaceTab} YY_INPUT( (char*) sBuffer, iSize, YY_BUF_SIZE ); if( iSize == 0 ) { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_INVALID_INLINE, hb_comp_functions.pLast->szName, NULL ); + hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_INVALID_INLINE, HB_MARCO_PARAM->functions.pLast->szName, NULL ); hb_pp_StreamBlock = 0; return '\n'; } @@ -1040,9 +1036,7 @@ Separator {SpaceTab} hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */ } - hb_comp_iLinePRG = hb_comp_iLine - 1; - hb_comp_iLine = hb_comp_iLineINLINE; - + hb_comp_iLinePRG = hb_pp_line( HB_COMP_PARAM->pLex->pPP ); pComp->pLex->lasttok = yylval_ptr->string = hb_compIdentifierNew( sInlineSym, TRUE ); return IDENTIFIER; } @@ -1864,9 +1858,29 @@ Separator {SpaceTab} int yy_lex_input( char *buffer, int iBufferSize ) { - HB_SYMBOL_UNUSED( iBufferSize ); + /* FLEX is not MT safe :-( */ + HB_COMP_DECL = hb_comp_data; + char * szLine; + ULONG ulLen = 0; - return hb_pp_Internal( buffer ); + hb_pp_NestedLiteralString = FALSE; + hb_pp_LiteralEscSeq = FALSE; + + if( hb_pp_StreamBlock == HB_PP_STREAM_DUMP_C ) + hb_pp_setStream( HB_COMP_PARAM->pLex->pPP, HB_PP_STREAM_INLINE_C ); + + szLine = hb_pp_nextLine( HB_COMP_PARAM->pLex->pPP, &ulLen ); + + if( ulLen >= iBufferSize ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_BUFFER_OVERFLOW, NULL, NULL ); + else if( szLine ) + memcpy( buffer, szLine, ulLen + 1 ); + else + * buffer = '\0'; + if( hb_comp_iLineINLINE && hb_pp_StreamBlock == 0 ) + hb_comp_iLineINLINE = 0; + + return ulLen; } static int yy_ConvertNumber( YYSTYPE *yylval_ptr, char * szBuffer ) diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 3778e4f498..8581dbc69f 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -47,103 +47,40 @@ /* Compile using: bison -d -v harbour.y */ -static void hb_compLoopStart( void ); -static void hb_compLoopEnd( void ); -static void hb_compLoopLoop( void ); -static void hb_compLoopExit( void ); -static void hb_compLoopHere( void ); +static void hb_compLoopStart( HB_COMP_DECL ); +static void hb_compLoopEnd( HB_COMP_DECL ); +static void hb_compLoopLoop( HB_COMP_DECL ); +static void hb_compLoopExit( HB_COMP_DECL ); +static void hb_compLoopHere( HB_COMP_DECL ); -static void * hb_compElseIfGen( void * pFirstElseIf, ULONG ulOffset ); /* generates a support structure for elseifs pcode fixups */ -static void hb_compElseIfFix( void * pIfElseIfs ); /* implements the ElseIfs pcode fixups */ +static void * hb_compElseIfGen( HB_COMP_DECL, void * pFirstElseIf, ULONG ulOffset ); /* generates a support structure for elseifs pcode fixups */ +static void hb_compElseIfFix( HB_COMP_DECL, void * pIfElseIfs ); /* implements the ElseIfs pcode fixups */ -static void hb_compRTVariableAdd( HB_EXPR_PTR, BOOL ); -static void hb_compRTVariableGen( char * ); +static void hb_compRTVariableAdd( HB_COMP_DECL, HB_EXPR_PTR, BOOL ); +static void hb_compRTVariableGen( HB_COMP_DECL, char * ); -static void hb_compVariableDim( char *, HB_EXPR_PTR ); +static void hb_compVariableDim( char *, HB_EXPR_PTR, HB_COMP_DECL ); -static void hb_compForStart( char *szVarName, BOOL bForEach ); -static void hb_compForEnd( char *szVarName ); -static void hb_compEnumStart( HB_EXPR_PTR pVars, HB_EXPR_PTR pExprs, int descend ); -static void hb_compEnumNext( HB_EXPR_PTR pExpr, int descend ); -static void hb_compEnumEnd( HB_EXPR_PTR pExpr ); +static void hb_compForStart( HB_COMP_DECL, char *szVarName, BOOL bForEach ); +static void hb_compForEnd( HB_COMP_DECL, char *szVarName ); +static void hb_compEnumStart( HB_COMP_DECL, HB_EXPR_PTR pVars, HB_EXPR_PTR pExprs, int descend ); +static void hb_compEnumNext( HB_COMP_DECL, HB_EXPR_PTR pExpr, int descend ); +static void hb_compEnumEnd( HB_COMP_DECL, HB_EXPR_PTR pExpr ); -static void hb_compSwitchStart( void ); -static void hb_compSwitchAdd( HB_EXPR_PTR ); -static void hb_compSwitchEnd( void ); +static void hb_compSwitchStart( HB_COMP_DECL ); +static void hb_compSwitchAdd( HB_COMP_DECL, HB_EXPR_PTR ); +static void hb_compSwitchEnd( HB_COMP_DECL ); -static HB_EXPR_PTR hb_compCheckPassByRef( HB_EXPR_PTR pExpr ); +static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ); #ifdef HARBOUR_YYDEBUG #define YYDEBUG 1 /* Parser debug information support */ #endif -/* support structure for else if pcode fixups */ -typedef struct HB_ELSEIF_ -{ - ULONG ulOffset; - struct HB_ELSEIF_ * pElseif; /* next ELSEIF in the current IF statement */ - struct HB_ELSEIF_ * pPrev; /* previous IF statement */ -} HB_ELSEIF, * HB_ELSEIF_PTR; - -/* support structure for EXIT and LOOP statements */ -typedef struct HB_LOOPEXIT_ -{ - ULONG ulOffset; - int iLine; - USHORT wSeqCounter; - struct HB_LOOPEXIT_ * pLoopList; - struct HB_LOOPEXIT_ * pExitList; - struct HB_LOOPEXIT_ * pNext; -} HB_LOOPEXIT, * HB_LOOPEXIT_PTR; - -/* support structure for SWITCH statement */ -typedef struct HB_SWITCHCASE_ -{ - ULONG ulOffset; - HB_EXPR_PTR pExpr; - struct HB_SWITCHCASE_ *pNext; -} HB_SWITCHCASE, * HB_SWITCHCASE_PTR; - -typedef struct HB_SWITCHCMD_ -{ - ULONG ulOffset; - int iCount; - HB_SWITCHCASE_PTR pCases; - HB_SWITCHCASE_PTR pLast; - ULONG ulDefault; - struct HB_SWITCHCMD_ *pPrev; -} HB_SWITCHCMD, *HB_SWITCHCMD_PTR; - -typedef struct HB_RTVAR_ -{ - HB_EXPR_PTR pVar; - BOOL bPopValue; - struct HB_RTVAR_ *pNext; - struct HB_RTVAR_ *pPrev; -} HB_RTVAR, *HB_RTVAR_PTR; /* support structure for PUBLIC and PRIVATE statements */ - -USHORT hb_comp_wSeqCounter = 0; -USHORT hb_comp_wForCounter = 0; -USHORT hb_comp_wIfCounter = 0; -USHORT hb_comp_wWhileCounter = 0; -USHORT hb_comp_wCaseCounter = 0; -USHORT hb_comp_wSwitchCounter= 0; -USHORT hb_comp_wWithObjectCnt= 0; -BOOL hb_comp_long_optimize = TRUE; -BOOL hb_comp_bTextSubst = TRUE; - -static HB_LOOPEXIT_PTR hb_comp_pLoops = NULL; -static HB_RTVAR_PTR hb_comp_rtvars = NULL; -static HB_SWITCHCMD_PTR hb_comp_pSwitch = NULL; -static HB_ELSEIF_PTR hb_comp_elseif = NULL; - /* Controls if passing by reference '@' is allowed */ #define HB_PASSBYREF_OFF 0 #define HB_PASSBYREF_FUNCALL 1 #define HB_PASSBYREF_ARRAY 2 -static int hb_comp_bPassByRef = HB_PASSBYREF_OFF; - -char * hb_comp_szAnnounce = NULL; /* ANNOUNCEd procedure */ static void hb_compDebugStart( void ) { }; @@ -198,9 +135,9 @@ static void hb_compDebugStart( void ) { }; /* This must be placed after the above union - the union is * typedef-ined to YYSTYPE */ -extern int yylex( YYSTYPE *, HB_COMP_PTR ); /* main lex token function, called by yyparse() */ -extern int yyparse( HB_COMP_PTR ); /* main yacc parsing function */ -extern void yyerror( HB_COMP_PTR, char * ); /* parsing error management function */ +extern int yylex( YYSTYPE *, HB_COMP_DECL ); /* main lex token function, called by yyparse() */ +extern int yyparse( HB_COMP_DECL ); /* main yacc parsing function */ +extern void yyerror( HB_COMP_DECL, char * ); /* parsing error management function */ %} @@ -248,7 +185,7 @@ extern void yyerror( HB_COMP_PTR, char * ); /* parsing error management func /*the highest precedence*/ %type IdentName IDENTIFIER LITERAL MACROVAR MACROTEXT CompTimeStr -%type DOIDENT WHILE +%type DOIDENT WHILE %type NUM_DOUBLE %type NUM_INTEGER %type NUM_LONG @@ -296,9 +233,56 @@ extern void yyerror( HB_COMP_PTR, char * ); /* parsing error management func %type DateValue %type SendId +%destructor { + /* NOTE: direct using of hb_comp_data is not MT safe but + the version of bison (1.875c) I'm using now does not + support %parse-param for destructors. I can create a + work around for it but documentation says that %destructor + should respect pure parser parameters so probably it will + be (already is?) fixed in next releases do now I'm leaving + it as is. [druzus] + */ + hb_compExprDelete( $$, hb_comp_data ); + } + ArgList ElemList BlockExpList BlockVarList BlockNoVar + DoName DoProc DoArgument DoArgList + PareExpList1 PareExpList2 PareExpList3 PareExpListN + ExpList ExpList1 ExpList2 ExpList3 + NumValue NumAlias + NilValue NilAlias + DateValue + LiteralValue LiteralAlias + CodeBlock CodeBlockAlias + Logical LogicalAlias + SelfValue SelfAlias + Array ArrayAlias + ArrayAt ArrayAtAlias + Variable VarAlias + MacroVar MacroVarAlias + MacroExpr MacroExprAlias + AliasId AliasVar AliasExpr + VariableAt VariableAtAlias + FunIdentCall FunCall FunCallAlias + ObjectData ObjectDataAlias + ObjectMethod ObjectMethodAlias + IfInline IfInlineAlias + PareExpList PareExpListAlias + Expression SimpleExpression LValue + EmptyExpression + ExprAssign ExprOperEq ExprPreOp ExprPostOp + ExprEqual ExprMath ExprBool ExprRelation ExprUnary + ExprPlusEq ExprMinusEq ExprMultEq ExprDivEq ExprModEq ExprExpEq + ArrayIndex IndexList + DimIndex DimList + FieldAlias FieldVarAlias + PostOp + ForVar ForList ForExpr + +%destructor { hb_xfree( $$.string ); } CBSTART + %% -Main : { hb_compLinePush(); } Source { } +Main : { hb_compLinePush( HB_COMP_PARAM ); } Source { } | /* empty file */ ; @@ -328,17 +312,17 @@ Line : LINE NUM_INTEGER LITERAL Crlf | LINE NUM_INTEGER LITERAL '@' LITERAL Crlf /* Xbase++ style */ ; -ProcReq : PROCREQ CompTimeStr ')' Crlf { hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } +ProcReq : PROCREQ CompTimeStr ')' Crlf { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } ; -CompTimeStr: LITERAL { hb_compAutoOpenAdd( $1 ); } - | LITERAL '+' LITERAL { char szFileName[ _POSIX_PATH_MAX ]; sprintf( szFileName, "%s%s", $1, $3 ); hb_compAutoOpenAdd( szFileName ); } +CompTimeStr: LITERAL { hb_compAutoOpenAdd( HB_COMP_PARAM, $1 ); } + | LITERAL '+' LITERAL { char szFileName[ _POSIX_PATH_MAX ]; sprintf( szFileName, "%s%s", $1, $3 ); hb_compAutoOpenAdd( HB_COMP_PARAM, szFileName ); } ; -Function : FunScope FUNCTION IdentName { hb_comp_cVarType = ' '; hb_compFunctionAdd( $3, ( HB_SYMBOLSCOPE ) $1, 0 ); } Crlf {} - | FunScope PROCEDURE IdentName { hb_comp_cVarType = ' '; hb_compFunctionAdd( $3, ( HB_SYMBOLSCOPE ) $1, FUN_PROCEDURE ); } Crlf {} - | FunScope FUNCTION IdentName { hb_comp_cVarType = ' '; hb_compFunctionAdd( $3, ( HB_SYMBOLSCOPE ) $1, 0 ); hb_comp_iVarScope = VS_PARAMETER; } '(' Params ')' Crlf {} - | FunScope PROCEDURE IdentName { hb_comp_cVarType = ' '; hb_compFunctionAdd( $3, ( HB_SYMBOLSCOPE ) $1, FUN_PROCEDURE ); hb_comp_iVarScope = VS_PARAMETER;} '(' Params ')' Crlf {} +Function : FunScope FUNCTION IdentName { HB_COMP_PARAM->cVarType = ' '; hb_compFunctionAdd( HB_COMP_PARAM, $3, ( HB_SYMBOLSCOPE ) $1, 0 ); } Crlf {} + | FunScope PROCEDURE IdentName { HB_COMP_PARAM->cVarType = ' '; hb_compFunctionAdd( HB_COMP_PARAM, $3, ( HB_SYMBOLSCOPE ) $1, FUN_PROCEDURE ); } Crlf {} + | FunScope FUNCTION IdentName { HB_COMP_PARAM->cVarType = ' '; hb_compFunctionAdd( HB_COMP_PARAM, $3, ( HB_SYMBOLSCOPE ) $1, 0 ); HB_COMP_PARAM->iVarScope = VS_PARAMETER; } '(' Params ')' Crlf {} + | FunScope PROCEDURE IdentName { HB_COMP_PARAM->cVarType = ' '; hb_compFunctionAdd( HB_COMP_PARAM, $3, ( HB_SYMBOLSCOPE ) $1, FUN_PROCEDURE ); HB_COMP_PARAM->iVarScope = VS_PARAMETER;} '(' Params ')' Crlf {} ; FunScope : { $$ = HB_FS_PUBLIC; } @@ -348,39 +332,39 @@ FunScope : { $$ = HB_FS_PUBLIC; } ; Params : /*no parameters */ { $$ = 0; } - | EPSILON { hb_comp_functions.pLast->pCode[0] = HB_P_VFRAME; $$ = 0; } + | EPSILON { HB_COMP_PARAM->functions.pLast->pCode[0] = HB_P_VFRAME; $$ = 0; } | ParamList { $$ = $1; } - | ParamList ',' EPSILON { hb_comp_functions.pLast->pCode[0] = HB_P_VFRAME; $$ = $1; } + | ParamList ',' EPSILON { HB_COMP_PARAM->functions.pLast->pCode[0] = HB_P_VFRAME; $$ = $1; } ; -AsType : /* not specified */ { hb_comp_cVarType = ' '; } +AsType : /* not specified */ { HB_COMP_PARAM->cVarType = ' '; } | StrongType ; -StrongType : AS_NUMERIC { hb_comp_cVarType = 'N'; } - | AS_CHARACTER { hb_comp_cVarType = 'C'; } - | AS_DATE { hb_comp_cVarType = 'D'; } - | AS_LOGICAL { hb_comp_cVarType = 'L'; } - | AS_BLOCK { hb_comp_cVarType = 'B'; } - | AS_OBJECT { hb_comp_cVarType = 'O'; } - | AS_CLASS IdentName { hb_comp_cVarType = 'S'; hb_comp_szFromClass = $2; } - | AS_VARIANT { hb_comp_cVarType = ' '; } +StrongType : AS_NUMERIC { HB_COMP_PARAM->cVarType = 'N'; } + | AS_CHARACTER { HB_COMP_PARAM->cVarType = 'C'; } + | AS_DATE { HB_COMP_PARAM->cVarType = 'D'; } + | AS_LOGICAL { HB_COMP_PARAM->cVarType = 'L'; } + | AS_BLOCK { HB_COMP_PARAM->cVarType = 'B'; } + | AS_OBJECT { HB_COMP_PARAM->cVarType = 'O'; } + | AS_CLASS IdentName { HB_COMP_PARAM->cVarType = 'S'; HB_COMP_PARAM->szFromClass = $2; } + | AS_VARIANT { HB_COMP_PARAM->cVarType = ' '; } | AsArray ; -AsArray : AS_ARRAY { hb_comp_cVarType = 'A'; } - | AS_NUMERIC_ARRAY { hb_comp_cVarType = 'n'; } - | AS_CHARACTER_ARRAY { hb_comp_cVarType = 'c'; } - | AS_DATE_ARRAY { hb_comp_cVarType = 'd'; } - | AS_LOGICAL_ARRAY { hb_comp_cVarType = 'l'; } - | AS_ARRAY_ARRAY { hb_comp_cVarType = 'a'; } - | AS_BLOCK_ARRAY { hb_comp_cVarType = 'b'; } - | AS_OBJECT_ARRAY { hb_comp_cVarType = 'o'; } - | AS_CLASS_ARRAY IdentName { hb_comp_cVarType = 's'; hb_comp_szFromClass = $2; } +AsArray : AS_ARRAY { HB_COMP_PARAM->cVarType = 'A'; } + | AS_NUMERIC_ARRAY { HB_COMP_PARAM->cVarType = 'n'; } + | AS_CHARACTER_ARRAY { HB_COMP_PARAM->cVarType = 'c'; } + | AS_DATE_ARRAY { HB_COMP_PARAM->cVarType = 'd'; } + | AS_LOGICAL_ARRAY { HB_COMP_PARAM->cVarType = 'l'; } + | AS_ARRAY_ARRAY { HB_COMP_PARAM->cVarType = 'a'; } + | AS_BLOCK_ARRAY { HB_COMP_PARAM->cVarType = 'b'; } + | AS_OBJECT_ARRAY { HB_COMP_PARAM->cVarType = 'o'; } + | AS_CLASS_ARRAY IdentName { HB_COMP_PARAM->cVarType = 's'; HB_COMP_PARAM->szFromClass = $2; } ; -ParamList : IdentName AsType { hb_compVariableAdd( $1, hb_comp_cVarType ); $$ = 1; } - | ParamList ',' IdentName AsType { hb_compVariableAdd( $3, hb_comp_cVarType ); $$++; } +ParamList : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); $$ = 1; } + | ParamList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); $$++; } ; /* NOTE: This allows the use of Expression as a statement. @@ -388,106 +372,106 @@ ParamList : IdentName AsType { hb_compVariableAdd( $1, hb_comp_c * hb_compExprGenStatement(). With this solution we don't have to * stop compilation if invalid syntax will be used. */ -Statement : ExecFlow { hb_comp_bDontGenLineNum = TRUE; } CrlfStmnt { } +Statement : ExecFlow { HB_COMP_PARAM->fDontGenLineNum = TRUE; } CrlfStmnt { } | WithObject CrlfStmnt { } - | IfInline CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | FunCall CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | AliasExpr CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | ObjectMethod CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | IfInline CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | FunCall CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | AliasExpr CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | ObjectMethod CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } | MacroVar CrlfStmnt { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) ) - hb_compExprDelete( hb_compExprGenStatement( $1 ) ); + hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); else - hb_compExprDelete( hb_compErrorSyntax( $1 ) ); - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + hb_compExprDelete( hb_compErrorSyntax( HB_COMP_PARAM, $1 ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } | MacroExpr CrlfStmnt { if( HB_COMP_ISSUPPORTED( HB_COMPFLAG_XBASE ) ) - hb_compExprDelete( hb_compExprGenStatement( $1 ) ); + hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); else - hb_compExprDelete( hb_compErrorSyntax( $1 ) ); - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + hb_compExprDelete( hb_compErrorSyntax( HB_COMP_PARAM, $1 ), HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | PareExpList CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | ExprPreOp CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | ExprPostOp CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | ExprOperEq CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | ExprEqual CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | ExprAssign CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | DoProc CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1 ) ); hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } - | BREAK CrlfStmnt { hb_compGenBreak(); hb_compGenPCode2( HB_P_DOSHORT, 0, ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; } - | BREAK { hb_compLinePushIfInside(); } Expression Crlf { hb_compGenBreak(); hb_compExprDelete( hb_compExprGenPush( $3 ) ); - hb_compGenPCode2( HB_P_DOSHORT, 1, ( BOOL ) 1 ); - hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; + | PareExpList CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | ExprPreOp CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | ExprPostOp CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | ExprOperEq CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | ExprEqual CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | ExprAssign CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | DoProc CrlfStmnt { hb_compExprDelete( hb_compExprGenStatement( $1, HB_COMP_PARAM ), HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } + | BREAK CrlfStmnt { hb_compGenBreak( HB_COMP_PARAM ); hb_compGenPCode2( HB_P_DOSHORT, 0, HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_BREAK_CODE; } + | BREAK { hb_compLinePushIfInside( HB_COMP_PARAM ); } Expression Crlf { hb_compGenBreak( HB_COMP_PARAM ); hb_compExprDelete( hb_compExprGenPush( $3, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenPCode2( HB_P_DOSHORT, 1, HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_BREAK_CODE; } | RETURN CrlfStmnt { - if( hb_comp_wSeqCounter ) + if( HB_COMP_PARAM->wSeqCounter ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL ); } - hb_compGenPCode1( HB_P_ENDPROC ); - if( (hb_comp_functions.pLast->bFlags & FUN_PROCEDURE) == 0 ) + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); + if( (HB_COMP_PARAM->functions.pLast->bFlags & FUN_PROCEDURE) == 0 ) { /* return from a function without a return value */ - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_NO_RETURN_VALUE, NULL, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_NO_RETURN_VALUE, NULL, NULL ); } - hb_comp_functions.pLast->bFlags |= FUN_WITH_RETURN; - hb_comp_bDontGenLineNum = TRUE; - hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_WITH_RETURN; + HB_COMP_PARAM->fDontGenLineNum = TRUE; + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_BREAK_CODE; } - | RETURN { hb_compLinePushIfInside(); hb_comp_cVarType = ' '; } Expression Crlf { + | RETURN { hb_compLinePushIfInside( HB_COMP_PARAM ); HB_COMP_PARAM->cVarType = ' '; } Expression Crlf { - hb_comp_cCastType = hb_comp_cVarType; - hb_comp_cVarType = ' '; + HB_COMP_PARAM->cCastType = HB_COMP_PARAM->cVarType; + HB_COMP_PARAM->cVarType = ' '; - if( hb_comp_wSeqCounter ) + if( HB_COMP_PARAM->wSeqCounter ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "RETURN", NULL ); } - hb_compExprDelete( hb_compExprGenPush( $3 ) ); /* TODO: check if return value agree with declared value */ - hb_compGenPCode2( HB_P_RETVALUE, HB_P_ENDPROC, ( BOOL ) 1 ); - if( hb_comp_functions.pLast->bFlags & FUN_PROCEDURE ) + hb_compExprDelete( hb_compExprGenPush( $3, HB_COMP_PARAM ), HB_COMP_PARAM ); /* TODO: check if return value agree with declared value */ + hb_compGenPCode2( HB_P_RETVALUE, HB_P_ENDPROC, HB_COMP_PARAM ); + if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_PROCEDURE ) { /* procedure returns a value */ - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_PROC_RETURN_VALUE, NULL, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_PROC_RETURN_VALUE, NULL, NULL ); } - hb_comp_functions.pLast->bFlags |= FUN_WITH_RETURN; - hb_comp_bDontGenLineNum = TRUE; - hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_WITH_RETURN; + HB_COMP_PARAM->fDontGenLineNum = TRUE; + HB_COMP_PARAM->functions.pLast->bFlags |= FUN_BREAK_CODE; } - | PUBLIC { hb_compLinePushIfInside(); hb_comp_iVarScope = VS_PUBLIC; } + | PUBLIC { hb_compLinePushIfInside( HB_COMP_PARAM ); HB_COMP_PARAM->iVarScope = VS_PUBLIC; } ExtVarList - { hb_compRTVariableGen( hb_compIdentifierNew("__MVPUBLIC",TRUE) ); - hb_comp_cVarType = ' '; hb_comp_iVarScope = VS_NONE; - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + { hb_compRTVariableGen( HB_COMP_PARAM, "__MVPUBLIC" ); + HB_COMP_PARAM->cVarType = ' '; HB_COMP_PARAM->iVarScope = VS_NONE; + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } Crlf - | PRIVATE { hb_compLinePushIfInside(); hb_comp_iVarScope = VS_PRIVATE; } + | PRIVATE { hb_compLinePushIfInside( HB_COMP_PARAM ); HB_COMP_PARAM->iVarScope = VS_PRIVATE; } ExtVarList - { hb_compRTVariableGen( hb_compIdentifierNew("__MVPRIVATE",TRUE) ); - hb_comp_cVarType = ' '; hb_comp_iVarScope = VS_NONE; - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + { hb_compRTVariableGen( HB_COMP_PARAM, "__MVPRIVATE" ); + HB_COMP_PARAM->cVarType = ' '; HB_COMP_PARAM->iVarScope = VS_NONE; + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } Crlf - | EXIT { hb_comp_bDontGenLineNum = !hb_comp_bDebugInfo; } CrlfStmnt { hb_compLoopExit(); hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; } - | LOOP { hb_comp_bDontGenLineNum = !hb_comp_bDebugInfo; } CrlfStmnt { hb_compLoopLoop(); hb_comp_functions.pLast->bFlags |= FUN_BREAK_CODE; } + | EXIT { HB_COMP_PARAM->fDontGenLineNum = !HB_COMP_PARAM->fDebugInfo; } CrlfStmnt { hb_compLoopExit( HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags |= FUN_BREAK_CODE; } + | LOOP { HB_COMP_PARAM->fDontGenLineNum = !HB_COMP_PARAM->fDebugInfo; } CrlfStmnt { hb_compLoopLoop( HB_COMP_PARAM ); HB_COMP_PARAM->functions.pLast->bFlags |= FUN_BREAK_CODE; } | EXTERN ExtList Crlf | ANNOUNCE IdentName { - if( hb_comp_szAnnounce == NULL ) + if( HB_COMP_PARAM->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', HB_COMP_ERR_FUNC_RESERVED, szFunction, $2 ); - hb_comp_szAnnounce = $2; + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FUNC_RESERVED, szFunction, $2 ); + HB_COMP_PARAM->szAnnounce = $2; } else - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_DUPL_ANNOUNCE, $2, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_DUPL_ANNOUNCE, $2, NULL ); } Crlf ; -CrlfStmnt : { hb_compLinePushIfInside(); } Crlf +CrlfStmnt : { hb_compLinePushIfInside( HB_COMP_PARAM ); } Crlf ; -LineStat : Crlf { $$ = 0; hb_comp_bDontGenLineNum = TRUE; } +LineStat : Crlf { $$ = 0; HB_COMP_PARAM->fDontGenLineNum = TRUE; } | Statement { $$ = 1; } | Declaration { $$ = 1; } | Line { $$ = 1; } @@ -497,17 +481,17 @@ Statements : LineStat { $$ = $1; } | Statements LineStat { $$ += $2; } ; -ExtList : IdentName { hb_compExternAdd( $1 ); } - | ExtList ',' IdentName { hb_compExternAdd( $3 ); } +ExtList : IdentName { hb_compExternAdd( HB_COMP_PARAM, $1 ); } + | ExtList ',' IdentName { hb_compExternAdd( HB_COMP_PARAM, $3 ); } ; IdentName : IDENTIFIER { $$ = $1; } - | STEP { $$ = hb_compIdentifierNew( "STEP", TRUE ); } - | TO { $$ = hb_compIdentifierNew( "TO", TRUE ); } + | STEP { $$ = "STEP"; } + | TO { $$ = "TO"; } | OPTIONAL { $$ = $1; } - | LOOP { $$ = hb_compIdentifierNew( "LOOP", TRUE ); } - | EXIT { $$ = hb_compIdentifierNew( "EXIT", TRUE ); } - | IN { $$ = hb_compIdentifierNew( "IN", TRUE ); } + | LOOP { $$ = "LOOP"; } + | EXIT { $$ = "EXIT"; } + | IN { $$ = "IN"; } | EXTERN { $$ = $1; } | ANNOUNCE { $$ = $1; } | LOCAL { $$ = $1; } @@ -522,27 +506,27 @@ IdentName : IDENTIFIER { $$ = $1; } /* Numeric values */ -NumValue : NUM_DOUBLE { $$ = hb_compExprNewDouble( $1.dNumber, $1.bWidth, $1.bDec ); } - | NUM_INTEGER { $$ = hb_compExprNewLong( $1.iNumber ); } - | NUM_LONG { $$ = hb_compExprNewLong( $1.lNumber ); } +NumValue : NUM_DOUBLE { $$ = hb_compExprNewDouble( $1.dNumber, $1.bWidth, $1.bDec, HB_COMP_PARAM ); } + | NUM_INTEGER { $$ = hb_compExprNewLong( $1.iNumber, HB_COMP_PARAM ); } + | NUM_LONG { $$ = hb_compExprNewLong( $1.lNumber, HB_COMP_PARAM ); } ; -DateValue : NUM_DATE { $$ = hb_compExprNewDate( $1.lNumber ); +DateValue : NUM_DATE { $$ = hb_compExprNewDate( $1.lNumber, HB_COMP_PARAM ); if( $1.lNumber == 0 ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_DATE, $1.szValue, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_DATE, $1.szValue, NULL ); } } ; -NumAlias : NUM_INTEGER ALIASOP { $$ = hb_compExprNewLong( $1.iNumber ); } - | NUM_LONG ALIASOP { $$ = hb_compExprNewLong( $1.lNumber ); } - | NUM_DOUBLE ALIASOP { $$ = hb_compErrorAlias( hb_compExprNewDouble( $1.dNumber, $1.bWidth, $1.bDec ) ); } +NumAlias : NUM_INTEGER ALIASOP { $$ = hb_compExprNewLong( $1.iNumber, HB_COMP_PARAM ); } + | NUM_LONG ALIASOP { $$ = hb_compExprNewLong( $1.lNumber, HB_COMP_PARAM ); } + | NUM_DOUBLE ALIASOP { $$ = hb_compErrorAlias( HB_COMP_PARAM, hb_compExprNewDouble( $1.dNumber, $1.bWidth, $1.bDec, HB_COMP_PARAM ) ); } ; /* NIL value */ -NilValue : NIL { $$ = hb_compExprNewNil(); } +NilValue : NIL { $$ = hb_compExprNewNil( HB_COMP_PARAM ); } ; NilAlias : NilValue ALIASOP { $$ = $1; } @@ -550,14 +534,10 @@ NilAlias : NilValue ALIASOP { $$ = $1; } /* Literal string value */ -LiteralValue : LITERAL { +LiteralValue : LITERAL { ULONG len = strlen( $1 ); - if( hb_pp_LiteralEscSeq ) - { - hb_strRemEscSeq( $1, &len ); - } - $$ = hb_compExprNewString( $1, len ); - } + $$ = hb_compExprNewString( $1, len, HB_COMP_PARAM ); + } ; LiteralAlias : LiteralValue ALIASOP { $$ = $1; } @@ -570,8 +550,8 @@ CodeBlockAlias : CodeBlock ALIASOP { $$ = $1; } /* Logical value */ -Logical : TRUEVALUE { $$ = hb_compExprNewLogical( TRUE ); } - | FALSEVALUE { $$ = hb_compExprNewLogical( FALSE ); } +Logical : TRUEVALUE { $$ = hb_compExprNewLogical( TRUE, HB_COMP_PARAM ); } + | FALSEVALUE { $$ = hb_compExprNewLogical( FALSE, HB_COMP_PARAM ); } ; LogicalAlias : Logical ALIASOP { $$ = $1; } @@ -579,7 +559,7 @@ LogicalAlias : Logical ALIASOP { $$ = $1; } /* SELF value and expressions */ -SelfValue : SELF { $$ = hb_compExprNewSelf(); } +SelfValue : SELF { $$ = hb_compExprNewSelf( HB_COMP_PARAM ); } ; SelfAlias : SelfValue ALIASOP { $$ = $1; } @@ -587,7 +567,7 @@ SelfAlias : SelfValue ALIASOP { $$ = $1; } /* Literal array */ -Array : '{' {$$=hb_comp_bPassByRef;hb_comp_bPassByRef=HB_PASSBYREF_ARRAY;} ElemList '}' { $$ = hb_compExprNewArray( $3 ); hb_comp_bPassByRef=$2; } +Array : '{' {$$=HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_ARRAY;} ElemList '}' { $$ = hb_compExprNewArray( $3, HB_COMP_PARAM ); HB_COMP_PARAM->iPassByRef=$2; } ; ArrayAlias : Array ALIASOP { $$ = $1; } @@ -603,16 +583,16 @@ ArrayAtAlias : ArrayAt ALIASOP { $$ = $1; } /* Variables */ -Variable : IdentName { $$ = hb_compExprNewVar( $1 ); } +Variable : IdentName { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); } ; -VarAlias : IdentName ALIASOP { $$ = hb_compExprNewAlias( $1 ); } +VarAlias : IdentName ALIASOP { $$ = hb_compExprNewAlias( $1, HB_COMP_PARAM ); } ; /* Macro variables */ -MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1 ); } - | MACROTEXT { $$ = hb_compExprNewMacro( NULL, 0, $1 ); } +MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1, HB_COMP_PARAM ); } + | MACROTEXT { $$ = hb_compExprNewMacro( NULL, 0, $1, HB_COMP_PARAM ); } ; MacroVarAlias : MacroVar ALIASOP { $$ = $1; } @@ -620,7 +600,7 @@ MacroVarAlias : MacroVar ALIASOP { $$ = $1; } /* Macro expressions */ -MacroExpr : '&' PareExpList { $$ = hb_compExprNewMacro( $2, 0, NULL ); } +MacroExpr : '&' PareExpList { $$ = hb_compExprNewMacro( $2, 0, NULL, HB_COMP_PARAM ); } ; MacroExprAlias : MacroExpr ALIASOP { $$ = $1; } @@ -630,51 +610,51 @@ MacroExprAlias : MacroExpr ALIASOP { $$ = $1; } */ /* special case: _FIELD-> and FIELD-> can be nested */ -FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( "FIELD" ); } +FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( "FIELD", HB_COMP_PARAM ); } | FIELD ALIASOP FieldAlias { $$ = $3; } ; /* ignore _FIELD-> or FIELD-> if a real alias is specified */ -FieldVarAlias : FieldAlias VarAlias { hb_compExprDelete( $1 ); $$ = $2; } - | FieldAlias NumAlias { hb_compExprDelete( $1 ); $$ = $2; } - | FieldAlias PareExpListAlias { hb_compExprDelete( $1 ); $$ = $2; } - | FieldAlias MacroVarAlias { hb_compExprDelete( $1 ); $$ = $2; } - | FieldAlias MacroExprAlias { hb_compExprDelete( $1 ); $$ = $2; } - | FieldAlias NilAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias LiteralAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias LogicalAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias CodeBlockAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias SelfAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias ArrayAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias ArrayAtAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } - | FieldAlias IfInlineAlias { hb_compExprDelete( $1 ); $$ = hb_compErrorAlias( $2 ); } +FieldVarAlias : FieldAlias VarAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = $2; } + | FieldAlias NumAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = $2; } + | FieldAlias PareExpListAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = $2; } + | FieldAlias MacroVarAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = $2; } + | FieldAlias MacroExprAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = $2; } + | FieldAlias NilAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias LiteralAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias LogicalAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias CodeBlockAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias SelfAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias ArrayAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias ArrayAtAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } + | FieldAlias IfInlineAlias { hb_compExprDelete( $1, HB_COMP_PARAM ); $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } ; -AliasId : IdentName { $$ = hb_compExprNewVar( $1 ); } +AliasId : IdentName { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); } | MacroVar { $$ = $1; } | MacroExpr { $$ = $1; } ; -AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | MacroVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | MacroExprAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | PareExpListAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | NilAlias AliasId { $$ = hb_compErrorAlias( $1 ); } - | LiteralAlias AliasId { $$ = hb_compErrorAlias( $1 ); } - | LogicalAlias AliasId { $$ = hb_compErrorAlias( $1 ); } - | CodeBlockAlias AliasId { $$ = hb_compErrorAlias( $1 ); } - | SelfAlias AliasId { $$ = hb_compErrorAlias( $1 ); } - | ArrayAlias AliasId { $$ = hb_compErrorAlias( $1 ); } - | ArrayAtAlias AliasId { $$ = hb_compErrorAlias( $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | VariableAtAlias AliasId { $$ = hb_compErrorAlias( $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | IfInlineAlias AliasId { $$ = hb_compErrorAlias( $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | FunCallAlias AliasId { $$ = hb_compErrorAlias( $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | ObjectDataAlias AliasId { $$ = hb_compErrorAlias( $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | ObjectMethodAlias AliasId { $$ = hb_compErrorAlias( $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ - | VarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | FieldAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | FieldVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } +AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | MacroVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | MacroExprAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | PareExpListAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | NilAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | LiteralAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | LogicalAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | CodeBlockAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | SelfAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | ArrayAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } + | ArrayAtAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | VariableAtAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | IfInlineAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | FunCallAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | ObjectDataAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | ObjectMethodAlias AliasId { $$ = hb_compErrorAlias( HB_COMP_PARAM, $1 ); } /* QUESTION: Clipper reports error here - we can handle this */ + | VarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | FieldAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | FieldVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } ; /* Aliased expressions @@ -683,12 +663,12 @@ AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); * alias->( Expression ) * alias always selects a workarea at runtime */ -AliasExpr : NumAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | VarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | MacroVarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | MacroExprAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | PareExpListAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | FieldAlias PareExpList { $$ = hb_compErrorAlias( $2 ); } /* QUESTION: Clipper reports error here - we can handle it */ +AliasExpr : NumAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | VarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | MacroVarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | MacroExprAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | PareExpListAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | FieldAlias PareExpList { $$ = hb_compErrorAlias( HB_COMP_PARAM, $2 ); } /* QUESTION: Clipper reports error here - we can handle it */ ; /* Array expressions access @@ -715,15 +695,15 @@ VariableAtAlias : VariableAt ALIASOP { $$ = $1; } /* Function call */ -FunIdentCall: IdentName '(' {$$=hb_comp_bPassByRef;hb_comp_bPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1 ), $4 ); hb_comp_bPassByRef=$3; } +FunIdentCall: IdentName '(' {$$=HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1, HB_COMP_PARAM ), $4, HB_COMP_PARAM ); HB_COMP_PARAM->iPassByRef=$3; } ; FunCall : FunIdentCall { $$ = $1; } - | MacroVar '(' {$$=hb_comp_bPassByRef;hb_comp_bPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( $1, $4 ); hb_comp_bPassByRef=$3; } - | MacroExpr '(' {$$=hb_comp_bPassByRef;hb_comp_bPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( $1, $4 ); hb_comp_bPassByRef=$3; } + | MacroVar '(' {$$=HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( $1, $4, HB_COMP_PARAM ); HB_COMP_PARAM->iPassByRef=$3; } + | MacroExpr '(' {$$=HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewFunCall( $1, $4, HB_COMP_PARAM ); HB_COMP_PARAM->iPassByRef=$3; } ; -ArgList : EmptyExpression { $$ = hb_compExprNewArgList( $1 ); } +ArgList : EmptyExpression { $$ = hb_compExprNewArgList( $1, HB_COMP_PARAM ); } | ArgList ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); } ; @@ -738,38 +718,38 @@ SendId : IdentName { $$.value.string = $1; $$.bMacro=FALSE; } | MacroExpr { $$.value.macro = $1; $$.bMacro=TRUE; } ; -ObjectData : NumValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | NilValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | DateValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | LiteralValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | Variable ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | CodeBlock ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | Logical ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | SelfValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | Array ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | ArrayAt ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | AliasVar ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | AliasExpr ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | MacroVar ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | MacroExpr ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | FunCall ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | IfInline ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | PareExpList ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | VariableAt ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | ObjectMethod ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | ObjectData ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro ) : hb_compExprNewSend( $1, $3.value.string, NULL )); } - | ':' SendId { if( hb_comp_wWithObjectCnt == 0 ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_WITHOBJECT, NULL, NULL ); - $$ = ($2.bMacro ? hb_compExprNewSend( NULL, NULL, $2.value.macro ) : hb_compExprNewSend( NULL, $2.value.string, NULL )); +ObjectData : NumValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | NilValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | DateValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | LiteralValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | Variable ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | CodeBlock ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | Logical ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | SelfValue ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | Array ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | ArrayAt ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | AliasVar ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | AliasExpr ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | MacroVar ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | MacroExpr ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | FunCall ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | IfInline ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | PareExpList ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | VariableAt ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | ObjectMethod ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | ObjectData ':' SendId { $$ = ($3.bMacro ? hb_compExprNewSend( $1, NULL, $3.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( $1, $3.value.string, NULL, HB_COMP_PARAM )); } + | ':' SendId { if( HB_COMP_PARAM->wWithObjectCnt == 0 ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_WITHOBJECT, NULL, NULL ); + $$ = ($2.bMacro ? hb_compExprNewSend( NULL, NULL, $2.value.macro, HB_COMP_PARAM ) : hb_compExprNewSend( NULL, $2.value.string, NULL, HB_COMP_PARAM )); } ; -ObjectDataAlias : ObjectData ALIASOP { $$ = $1; } +ObjectDataAlias : ObjectData ALIASOP { $$ = $1; } ; /* Object's method */ -ObjectMethod : ObjectData '(' {$$=hb_comp_bPassByRef;hb_comp_bPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewMethodCall( $1, $4 ); hb_comp_bPassByRef=$3; } +ObjectMethod : ObjectData '(' {$$=HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;} ArgList ')' { $$ = hb_compExprNewMethodCall( $1, $4 ); HB_COMP_PARAM->iPassByRef=$3; } ; ObjectMethodAlias : ObjectMethod ALIASOP { $$ = $1; } @@ -788,7 +768,7 @@ SimpleExpression : | CodeBlock { $$ = $1; } | Logical { $$ = $1; } | SelfValue { $$ = $1; } - | SelfValue {hb_comp_cVarType = ' ';} StrongType { $$ = $1; } + | SelfValue {HB_COMP_PARAM->cVarType = ' ';} StrongType { $$ = $1; } | Array { $$ = $1; } | ArrayAt { $$ = $1; } | AliasVar { $$ = $1; } @@ -796,12 +776,12 @@ SimpleExpression : | MacroExpr { $$ = $1; } | VariableAt { $$ = $1; } | FunCall { $$ = $1; } - | FunCall {hb_comp_cVarType = ' ';} StrongType { $$ = $1; } + | FunCall {HB_COMP_PARAM->cVarType = ' ';} StrongType { $$ = $1; } | IfInline { $$ = $1; } | ObjectData { $$ = $1; } - | ObjectData {hb_comp_cVarType = ' ';} StrongType { $$ = $1; } + | ObjectData {HB_COMP_PARAM->cVarType = ' ';} StrongType { $$ = $1; } | ObjectMethod { $$ = $1; } - | ObjectMethod {hb_comp_cVarType = ' ';} StrongType { $$ = $1; } + | ObjectMethod {HB_COMP_PARAM->cVarType = ' ';} StrongType { $$ = $1; } | AliasExpr { $$ = $1; } | ExprAssign { $$ = $1; } | ExprOperEq { $$ = $1; } @@ -816,20 +796,20 @@ SimpleExpression : Expression : Variable { $$ = $1; } | SimpleExpression { $$ = $1; } | PareExpList { $$ = $1; } - | Variable { hb_comp_cVarType = ' ';} StrongType { $$ = $1; } - | PareExpList { hb_comp_cVarType = ' ';} StrongType { $$ = $1; } - | '@' IdentName { $$ = hb_compCheckPassByRef( hb_compExprNewVarRef( $2 ) ); } - | '@' FunIdentCall { int bPassByRef=hb_comp_bPassByRef;hb_comp_bPassByRef=HB_PASSBYREF_FUNCALL;$$ = hb_compExprAsSymbol( $2 ); hb_compExprDelete( $2 ); $$ = hb_compCheckPassByRef( hb_compExprNewFunRef( $$ ) ); hb_comp_bPassByRef=bPassByRef; } - | '@' MacroVar { $$ = hb_compCheckPassByRef( hb_compExprNewRef( $2 ) ); } - | '@' AliasVar { $$ = hb_compCheckPassByRef( hb_compExprNewRef( $2 ) ); } - | '@' ObjectData { $$ = hb_compExprNewRef( $2 ); } + | Variable { HB_COMP_PARAM->cVarType = ' ';} StrongType { $$ = $1; } + | PareExpList { HB_COMP_PARAM->cVarType = ' ';} StrongType { $$ = $1; } + | '@' IdentName { $$ = hb_compCheckPassByRef( HB_COMP_PARAM, hb_compExprNewVarRef( $2, HB_COMP_PARAM ) ); } + | '@' FunIdentCall { int bPassByRef=HB_COMP_PARAM->iPassByRef;HB_COMP_PARAM->iPassByRef=HB_PASSBYREF_FUNCALL;$$ = hb_compExprAsSymbol( $2 ); hb_compExprDelete( $2, HB_COMP_PARAM ); $$ = hb_compCheckPassByRef( HB_COMP_PARAM, hb_compExprNewFunRef( $$, HB_COMP_PARAM ) ); HB_COMP_PARAM->iPassByRef=bPassByRef; } + | '@' MacroVar { $$ = hb_compCheckPassByRef( HB_COMP_PARAM, hb_compExprNewRef( $2, HB_COMP_PARAM ) ); } + | '@' AliasVar { $$ = hb_compCheckPassByRef( HB_COMP_PARAM, hb_compExprNewRef( $2, HB_COMP_PARAM ) ); } + | '@' ObjectData { $$ = hb_compExprNewRef( $2, HB_COMP_PARAM ); } ; -EmptyExpression: /* nothing => nil */ { $$ = hb_compExprNewEmpty(); } +EmptyExpression: /* nothing => nil */ { $$ = hb_compExprNewEmpty( HB_COMP_PARAM ); } | Expression ; -LValue : IdentName { $$ = hb_compExprNewVar( $1 ); } +LValue : IdentName { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); } | AliasVar | MacroVar | MacroExpr @@ -841,8 +821,8 @@ LValue : IdentName { $$ = hb_compExprNewVar( $1 ); } /* NOTE: PostOp can be used in one context only - it uses $0 rule * (the rule that stands before PostOp) */ -PostOp : INC { $$ = hb_compExprNewPostInc( $0 ); } - | DEC { $$ = hb_compExprNewPostDec( $0 ); } +PostOp : INC { $$ = hb_compExprNewPostInc( $0, HB_COMP_PARAM ); } + | DEC { $$ = hb_compExprNewPostDec( $0, HB_COMP_PARAM ); } ; /* NOTE: The rule: Expression Operator Expression @@ -870,186 +850,186 @@ ExprPostOp : NumValue PostOp %prec POST { $$ = $2; } | ObjectMethod PostOp %prec POST { $$ = $2; } ; -ExprPreOp : INC Expression %prec PRE { $$ = hb_compExprNewPreInc( $2 ); } - | DEC Expression %prec PRE { $$ = hb_compExprNewPreDec( $2 ); } +ExprPreOp : INC Expression %prec PRE { $$ = hb_compExprNewPreInc( $2, HB_COMP_PARAM ); } + | DEC Expression %prec PRE { $$ = hb_compExprNewPreDec( $2, HB_COMP_PARAM ); } ; -ExprUnary : NOT Expression { $$ = hb_compExprNewNot( $2 ); } - | '-' Expression %prec UNARY { $$ = hb_compExprNewNegate( $2 ); } +ExprUnary : NOT Expression { $$ = hb_compExprNewNot( $2, HB_COMP_PARAM ); } + | '-' Expression %prec UNARY { $$ = hb_compExprNewNegate( $2, HB_COMP_PARAM ); } | '+' Expression %prec UNARY { $$ = $2; } ; /* -ExprAssign : Expression INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } +ExprAssign : Expression INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } ; */ -ExprAssign : NumValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | NilValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | LiteralValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | CodeBlock INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | Logical INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | SelfValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | Array INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | ArrayAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | Variable INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); hb_comp_cCastType = hb_comp_cVarType; hb_comp_cVarType = ' ';} - | MacroVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | MacroExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | AliasVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | AliasExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | VariableAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); hb_comp_cCastType = hb_comp_cVarType; hb_comp_cVarType = ' ';} - | PareExpList INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | IfInline INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | FunCall INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | ObjectData INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); hb_comp_cCastType = hb_comp_cVarType; hb_comp_cVarType = ' ';} - | ObjectMethod INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } +ExprAssign : NumValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | NilValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | LiteralValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | CodeBlock INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Logical INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | SelfValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Array INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ArrayAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Variable INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); HB_COMP_PARAM->cCastType = HB_COMP_PARAM->cVarType; HB_COMP_PARAM->cVarType = ' ';} + | MacroVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | MacroExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | AliasVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | AliasExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | VariableAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); HB_COMP_PARAM->cCastType = HB_COMP_PARAM->cVarType; HB_COMP_PARAM->cVarType = ' ';} + | PareExpList INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | IfInline INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | FunCall INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ObjectData INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); HB_COMP_PARAM->cCastType = HB_COMP_PARAM->cVarType; HB_COMP_PARAM->cVarType = ' ';} + | ObjectMethod INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } ; -ExprEqual : NumValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | NilValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | DateValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | LiteralValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | CodeBlock '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | Logical '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | SelfValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | Array '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | ArrayAt '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | Variable '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | MacroVar '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | MacroExpr '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | AliasVar '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | AliasExpr '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | VariableAt '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | PareExpList '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | IfInline '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | FunCall '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | ObjectData '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } - | ObjectMethod '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3 ); } +ExprEqual : NumValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | NilValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | DateValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | LiteralValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | CodeBlock '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Logical '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | SelfValue '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Array '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ArrayAt '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Variable '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | MacroVar '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | MacroExpr '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | AliasVar '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | AliasExpr '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | VariableAt '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | PareExpList '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | IfInline '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | FunCall '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ObjectData '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ObjectMethod '=' Expression %prec INASSIGN { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } ; -ExprPlusEq : NumValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | NilValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | LiteralValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | CodeBlock PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | Logical PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | SelfValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | Array PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | ArrayAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | Variable PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | MacroVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | MacroExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | AliasVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | AliasExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | VariableAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | PareExpList PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | IfInline PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | FunCall PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | ObjectData PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } - | ObjectMethod PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3 ); } +ExprPlusEq : NumValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprMinusEq : NumValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | NilValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | LiteralValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | CodeBlock MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | Logical MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | SelfValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | Array MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | ArrayAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | Variable MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | MacroVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | MacroExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | AliasVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | AliasExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | VariableAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | PareExpList MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | IfInline MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | FunCall MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | ObjectData MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } - | ObjectMethod MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3 ); } +ExprMinusEq : NumValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprMultEq : NumValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | NilValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | LiteralValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | CodeBlock MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | Logical MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | SelfValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | Array MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | ArrayAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | Variable MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | MacroVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | MacroExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | AliasVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | AliasExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | VariableAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | PareExpList MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | IfInline MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | FunCall MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | ObjectData MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } - | ObjectMethod MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3 ); } +ExprMultEq : NumValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprDivEq : NumValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | NilValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | LiteralValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | CodeBlock DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | Logical DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | SelfValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | Array DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | ArrayAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | Variable DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | MacroVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | MacroExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | AliasVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | AliasExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | VariableAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | PareExpList DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | IfInline DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | FunCall DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | ObjectData DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } - | ObjectMethod DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3 ); } +ExprDivEq : NumValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprModEq : NumValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | NilValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | LiteralValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | CodeBlock MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | Logical MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | SelfValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | Array MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | ArrayAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | Variable MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | MacroVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | MacroExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | AliasVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | AliasExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | VariableAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | PareExpList MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | IfInline MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | FunCall MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | ObjectData MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } - | ObjectMethod MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3 ); } +ExprModEq : NumValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprExpEq : NumValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | NilValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | LiteralValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | CodeBlock EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | Logical EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | SelfValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | Array EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | ArrayAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | Variable EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | MacroVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | MacroExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | AliasVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | AliasExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | VariableAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | PareExpList EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | IfInline EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | FunCall EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | ObjectData EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } - | ObjectMethod EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3 ); } +ExprExpEq : NumValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; ExprOperEq : ExprPlusEq { $$ = $1; } @@ -1060,27 +1040,27 @@ ExprOperEq : ExprPlusEq { $$ = $1; } | ExprExpEq { $$ = $1; } ; -ExprMath : Expression '+' Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlus( $1 ), $3 ); } - | Expression '-' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinus( $1 ), $3 ); } - | Expression '*' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMult( $1 ), $3 ); } - | Expression '/' Expression { $$ = hb_compExprSetOperand( hb_compExprNewDiv( $1 ), $3 ); } - | Expression '%' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMod( $1 ), $3 ); } - | Expression POWER Expression { $$ = hb_compExprSetOperand( hb_compExprNewPower( $1 ), $3 ); } +ExprMath : Expression '+' Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlus( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '-' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinus( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '*' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMult( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '/' Expression { $$ = hb_compExprSetOperand( hb_compExprNewDiv( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '%' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMod( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression POWER Expression { $$ = hb_compExprSetOperand( hb_compExprNewPower( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprBool : Expression AND Expression { $$ = hb_compExprSetOperand( hb_compExprNewAnd( $1 ), $3 ); } - | Expression OR Expression { $$ = hb_compExprSetOperand( hb_compExprNewOr( $1 ), $3 ); } +ExprBool : Expression AND Expression { $$ = hb_compExprSetOperand( hb_compExprNewAnd( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression OR Expression { $$ = hb_compExprSetOperand( hb_compExprNewOr( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprRelation: Expression EQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewEQ( $1 ), $3 ); } - | Expression '<' Expression { $$ = hb_compExprSetOperand( hb_compExprNewLT( $1 ), $3 ); } - | Expression '>' Expression { $$ = hb_compExprSetOperand( hb_compExprNewGT( $1 ), $3 ); } - | Expression LE Expression { $$ = hb_compExprSetOperand( hb_compExprNewLE( $1 ), $3 ); } - | Expression GE Expression { $$ = hb_compExprSetOperand( hb_compExprNewGE( $1 ), $3 ); } - | Expression NE1 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1 ), $3 ); } - | Expression NE2 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1 ), $3 ); } - | Expression '$' Expression { $$ = hb_compExprSetOperand( hb_compExprNewIN( $1 ), $3 ); } - | Expression '=' Expression { $$ = hb_compExprSetOperand( hb_compExprNewEqual( $1 ), $3 ); } +ExprRelation: Expression EQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewEQ( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '<' Expression { $$ = hb_compExprSetOperand( hb_compExprNewLT( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '>' Expression { $$ = hb_compExprSetOperand( hb_compExprNewGT( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression LE Expression { $$ = hb_compExprSetOperand( hb_compExprNewLE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression GE Expression { $$ = hb_compExprSetOperand( hb_compExprNewGE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression NE1 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression NE2 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '$' Expression { $$ = hb_compExprSetOperand( hb_compExprNewIN( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '=' Expression { $$ = hb_compExprSetOperand( hb_compExprNewEqual( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; ArrayIndex : IndexList ']' { $$ = $1; } @@ -1089,18 +1069,18 @@ ArrayIndex : IndexList ']' { $$ = $1; } /* NOTE: $0 represents the expression before ArrayIndex * Don't use ArrayIndex in other context than as an array index! */ -IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $0, $2 ); } - | IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3 ); } - | IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4 ); } +IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $0, $2, HB_COMP_PARAM ); } + | IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3, HB_COMP_PARAM ); } + | IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4, HB_COMP_PARAM ); } ; -ElemList : EmptyExpression { $$ = hb_compExprNewList( $1 ); } +ElemList : EmptyExpression { $$ = hb_compExprNewList( $1, HB_COMP_PARAM ); } | ElemList ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); } ; -CodeBlock : CBSTART { $$ = hb_compExprNewCodeBlock($1.string,$1.isMacro,$1.lateEval); } BlockNoVar +CodeBlock : CBSTART { $$ = hb_compExprNewCodeBlock( $1.string, $1.isMacro, $1.lateEval, HB_COMP_PARAM ); } BlockNoVar '|' BlockExpList '}' { $$ = $2; } - | CBSTART { $$ = hb_compExprNewCodeBlock($1.string,$1.isMacro,$1.lateEval); } BlockVarList + | CBSTART { $$ = hb_compExprNewCodeBlock( $1.string, $1.isMacro, $1.lateEval, HB_COMP_PARAM ); } BlockVarList '|' BlockExpList '}' { $$ = $2; } ; @@ -1116,8 +1096,8 @@ BlockExpList : Expression { $$ = hb_compExprAddCodeblockExpr( $0, $1, hb_comp_cVarType ); hb_comp_cVarType = ' '; } - | BlockVarList ',' IdentName AsType { hb_comp_iVarScope = VS_LOCAL; $$ = hb_compExprCBVarAdd( $0, $3, hb_comp_cVarType ); hb_comp_cVarType = ' '; } +BlockVarList : IdentName AsType { HB_COMP_PARAM->iVarScope = VS_LOCAL; $$ = hb_compExprCBVarAdd( $0, $1, HB_COMP_PARAM->cVarType, HB_COMP_PARAM ); HB_COMP_PARAM->cVarType = ' '; } + | BlockVarList ',' IdentName AsType { HB_COMP_PARAM->iVarScope = VS_LOCAL; $$ = hb_compExprCBVarAdd( $0, $3, HB_COMP_PARAM->cVarType, HB_COMP_PARAM ); HB_COMP_PARAM->cVarType = ' '; } ; /* There is a conflict between the use of IF( Expr1, Expr2, Expr3 ) @@ -1148,7 +1128,7 @@ PareExpList : PareExpList1 { $$ = $1; } PareExpListAlias : PareExpList ALIASOP { $$ = $1; } ; -ExpList1 : '(' EmptyExpression { $$ = hb_compExprNewList( $2 ); } +ExpList1 : '(' EmptyExpression { $$ = hb_compExprNewList( $2, HB_COMP_PARAM ); } ; ExpList2 : ExpList1 ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); } @@ -1161,23 +1141,23 @@ ExpList : ExpList3 ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, | ExpList ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); } ; -IfInline : IIF PareExpList3 { $$ = hb_compExprNewIIF( $2 ); } +IfInline : IIF PareExpList3 { $$ = hb_compExprNewIIF( $2, HB_COMP_PARAM ); } | IF ExpList1 ',' EmptyExpression ',' { $$ = hb_compExprAddListExpr( $2, $4 ); } EmptyExpression ')' - { $$ = hb_compExprNewIIF( hb_compExprAddListExpr( $6, $7 ) ); } + { $$ = hb_compExprNewIIF( hb_compExprAddListExpr( $6, $7 ), HB_COMP_PARAM ); } ; IfInlineAlias : IfInline ALIASOP { $$ = $1; } ; -VarDefs : LOCAL { hb_comp_iVarScope = VS_LOCAL; hb_compLinePush(); } VarList Crlf { hb_comp_cVarType = ' '; } - | STATIC { hb_comp_iVarScope = VS_STATIC; hb_compLinePush(); } VarList Crlf { hb_comp_cVarType = ' '; } - | PARAMETERS { if( hb_comp_functions.pLast->bFlags & FUN_USES_LOCAL_PARAMS ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_PARAMETERS_NOT_ALLOWED, NULL, NULL ); +VarDefs : LOCAL { HB_COMP_PARAM->iVarScope = VS_LOCAL; hb_compLinePush( HB_COMP_PARAM ); } VarList Crlf { HB_COMP_PARAM->cVarType = ' '; } + | STATIC { HB_COMP_PARAM->iVarScope = VS_STATIC; hb_compLinePush( HB_COMP_PARAM ); } VarList Crlf { HB_COMP_PARAM->cVarType = ' '; } + | PARAMETERS { if( HB_COMP_PARAM->functions.pLast->bFlags & FUN_USES_LOCAL_PARAMS ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_PARAMETERS_NOT_ALLOWED, NULL, NULL ); else - hb_comp_functions.pLast->wParamNum=0; hb_comp_iVarScope = ( VS_PRIVATE | VS_PARAMETER ); } - MemvarList Crlf { hb_comp_iVarScope = VS_NONE; } + HB_COMP_PARAM->functions.pLast->wParamNum=0; HB_COMP_PARAM->iVarScope = ( VS_PRIVATE | VS_PARAMETER ); } + MemvarList Crlf { HB_COMP_PARAM->iVarScope = VS_NONE; } ; VarList : VarDef { $$ = 1; } @@ -1195,71 +1175,71 @@ ExtVarList : ExtVarDef { $$ = 1; } */ ExtVarDef : VarDef | MacroVar AsType - { hb_compRTVariableAdd( hb_compExprNewRTVar( NULL, $1 ), FALSE ); } + { hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), FALSE ); } | MacroVar AsType INASSIGN Expression - { hb_compExprDelete( hb_compExprGenPush( $4 ) ); - hb_compRTVariableAdd( hb_compExprNewRTVar( NULL, $1 ), TRUE ); + { hb_compExprDelete( hb_compExprGenPush( $4, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), TRUE ); } | MacroVar DimList { USHORT uCount = (USHORT) hb_compExprListLen( $2 ); - hb_compExprDelete( hb_compExprGenPush( $2 ) ); - hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), ( BOOL ) 1 ); - hb_compRTVariableAdd( hb_compExprNewRTVar( NULL, $1 ), TRUE ); + hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM ); + hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), TRUE ); } | MacroVar DimList AsArray { USHORT uCount = (USHORT) hb_compExprListLen( $2 ); - hb_compExprDelete( hb_compExprGenPush( $2 ) ); - hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), ( BOOL ) 1 ); - hb_compRTVariableAdd( hb_compExprNewRTVar( NULL, $1 ), TRUE ); + hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM ); + hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( NULL, $1, HB_COMP_PARAM ), TRUE ); } ; -VarDef : IdentName AsType { hb_compVariableAdd( $1, hb_comp_cVarType ); } +VarDef : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); } { - if( hb_comp_iVarScope == VS_STATIC ) + if( HB_COMP_PARAM->iVarScope == VS_STATIC ) { - hb_compStaticDefStart(); /* switch to statics pcode buffer */ - hb_compStaticDefEnd(); - hb_compGenStaticName( $1 ); + hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */ + hb_compStaticDefEnd( HB_COMP_PARAM ); + hb_compGenStaticName( $1, HB_COMP_PARAM ); } - else if( hb_comp_iVarScope == VS_PUBLIC || hb_comp_iVarScope == VS_PRIVATE ) + else if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { - hb_compRTVariableAdd( hb_compExprNewRTVar( $1, NULL ), FALSE ); + hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( $1, NULL, HB_COMP_PARAM ), FALSE ); } } - | IdentName AsType { $$ = hb_comp_iVarScope; - hb_compVariableAdd( $1, hb_comp_cVarType ); + | IdentName AsType { $$ = HB_COMP_PARAM->iVarScope; + hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); } - INASSIGN {hb_comp_cVarType = ' ';} Expression + INASSIGN {HB_COMP_PARAM->cVarType = ' ';} Expression { - hb_comp_cCastType = hb_comp_cVarType; - hb_comp_cVarType = ' '; + HB_COMP_PARAM->cCastType = HB_COMP_PARAM->cVarType; + HB_COMP_PARAM->cVarType = ' '; - hb_comp_iVarScope = $3; - if( hb_comp_iVarScope == VS_STATIC ) + HB_COMP_PARAM->iVarScope = $3; + if( HB_COMP_PARAM->iVarScope == VS_STATIC ) { - hb_compStaticDefStart(); /* switch to statics pcode buffer */ - hb_compExprDelete( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( $1 ), $6 ) ) ); - hb_compStaticDefEnd(); - hb_compGenStaticName( $1 ); + hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */ + hb_compExprDelete( hb_compExprGenStatement( hb_compExprAssignStatic( hb_compExprNewVar( $1, HB_COMP_PARAM ), $6, HB_COMP_PARAM ), HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compStaticDefEnd( HB_COMP_PARAM ); + hb_compGenStaticName( $1, HB_COMP_PARAM ); } - else if( hb_comp_iVarScope == VS_PUBLIC || hb_comp_iVarScope == VS_PRIVATE ) + else if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { - hb_compExprDelete( hb_compExprGenPush( $6 ) ); - hb_compRTVariableAdd( hb_compExprNewRTVar( $1, NULL ), TRUE ); + hb_compExprDelete( hb_compExprGenPush( $6, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( $1, NULL, HB_COMP_PARAM ), TRUE ); } else { - hb_compExprDelete( hb_compExprGenStatement( hb_compExprAssign( hb_compExprNewVar( $1 ), $6 ) ) ); + hb_compExprDelete( hb_compExprGenStatement( hb_compExprAssign( hb_compExprNewVar( $1, HB_COMP_PARAM ), $6, HB_COMP_PARAM ), HB_COMP_PARAM ), HB_COMP_PARAM ); } - hb_comp_iVarScope = $3; + HB_COMP_PARAM->iVarScope = $3; } - | IdentName DimList { hb_compVariableDim( $1, $2 ); } - | IdentName DimList AsArray { hb_compVariableDim( $1, $2 ); } + | IdentName DimList { hb_compVariableDim( $1, $2, HB_COMP_PARAM ); } + | IdentName DimList AsArray { hb_compVariableDim( $1, $2, HB_COMP_PARAM ); } ; /* NOTE: DimList and DimIndex is the same as ArrayIndex and IndexList @@ -1268,54 +1248,54 @@ VarDef : IdentName AsType { hb_compVariableAdd( $1, hb_comp_cVarType ); } DimList : DimIndex ']' { $$ = $1; } ; -DimIndex : '[' Expression { $$ = hb_compExprNewArgList( $2 ); } +DimIndex : '[' Expression { $$ = hb_compExprNewArgList( $2, HB_COMP_PARAM ); } | DimIndex ',' Expression { $$ = hb_compExprAddListExpr( $1, $3 ); } | DimIndex ']' '[' Expression { $$ = hb_compExprAddListExpr( $1, $4 ); } ; -FieldsDef : FIELD { hb_comp_iVarScope = VS_FIELD; } FieldList Crlf { hb_comp_cVarType = ' '; } +FieldsDef : FIELD { HB_COMP_PARAM->iVarScope = VS_FIELD; } FieldList Crlf { HB_COMP_PARAM->cVarType = ' '; } ; -FieldList : IdentName AsType { $$=hb_compFieldsCount(); hb_compVariableAdd( $1, hb_comp_cVarType ); } - | FieldList ',' IdentName AsType { hb_compVariableAdd( $3, hb_comp_cVarType ); } - | FieldList IN IdentName { hb_compFieldSetAlias( $3, $1 ); } +FieldList : IdentName AsType { $$=hb_compFieldsCount( HB_COMP_PARAM ); hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); } + | FieldList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); } + | FieldList IN IdentName { hb_compFieldSetAlias( HB_COMP_PARAM, $3, $1 ); } ; -MemvarDef : MEMVAR { hb_comp_iVarScope = VS_MEMVAR; } MemvarList Crlf { hb_comp_cVarType = ' '; } +MemvarDef : MEMVAR { HB_COMP_PARAM->iVarScope = VS_MEMVAR; } MemvarList Crlf { HB_COMP_PARAM->cVarType = ' '; } ; -MemvarList : IdentName AsType { hb_compVariableAdd( $1, hb_comp_cVarType ); } - | MemvarList ',' IdentName AsType { hb_compVariableAdd( $3, hb_comp_cVarType ); } +MemvarList : IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); } + | MemvarList ',' IdentName AsType { hb_compVariableAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); } ; -Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( $2 ); hb_comp_szDeclaredFun = $2; } DecList ')' AsType Crlf +Declaration: DECLARE IdentName '(' { hb_compDeclaredAdd( HB_COMP_PARAM, $2 ); HB_COMP_PARAM->szDeclaredFun = $2; } DecList ')' AsType Crlf { - if( hb_comp_pLastDeclared ) + if( HB_COMP_PARAM->pLastDeclared ) { - hb_comp_pLastDeclared->cType = hb_comp_cVarType; + HB_COMP_PARAM->pLastDeclared->cType = HB_COMP_PARAM->cVarType; - if ( toupper( hb_comp_cVarType ) == 'S' ) + if ( toupper( HB_COMP_PARAM->cVarType ) == 'S' ) { - hb_comp_pLastDeclared->pClass = hb_compClassFind( hb_comp_szFromClass ); - if( ! hb_comp_pLastDeclared->pClass ) + HB_COMP_PARAM->pLastDeclared->pClass = hb_compClassFind( HB_COMP_PARAM, HB_COMP_PARAM->szFromClass ); + if( ! HB_COMP_PARAM->pLastDeclared->pClass ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, hb_comp_szFromClass, hb_comp_pLastDeclared->szName ); - hb_comp_pLastDeclared->cType = ( isupper( ( int ) hb_comp_cVarType ) ? 'O' : 'o' ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastDeclared->szName ); + HB_COMP_PARAM->pLastDeclared->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' ); } /* Resetting */ - hb_comp_szFromClass = NULL; + HB_COMP_PARAM->szFromClass = NULL; } } - hb_comp_szDeclaredFun = NULL; - hb_comp_cVarType = ' '; - hb_comp_iVarScope = VS_NONE; + HB_COMP_PARAM->szDeclaredFun = NULL; + HB_COMP_PARAM->cVarType = ' '; + HB_COMP_PARAM->iVarScope = VS_NONE; } - | DECLARE IdentName { hb_comp_pLastClass = hb_compClassAdd( $2 ); } ClassInfo Crlf { hb_comp_iVarScope = VS_NONE; } - | DECLARE_CLASS IdentName Crlf { hb_comp_pLastClass = hb_compClassAdd( $2 ); hb_comp_iVarScope = VS_NONE; } - | DECLARE_MEMBER DecMethod Crlf { hb_comp_iVarScope = VS_NONE; } - | DECLARE_MEMBER '{' AsType { hb_comp_cDataListType = hb_comp_cVarType; } DecDataList '}' Crlf { hb_comp_cDataListType = 0; hb_comp_iVarScope = VS_NONE; } + | DECLARE IdentName { HB_COMP_PARAM->pLastClass = hb_compClassAdd( HB_COMP_PARAM, $2 ); } ClassInfo Crlf { HB_COMP_PARAM->iVarScope = VS_NONE; } + | DECLARE_CLASS IdentName Crlf { HB_COMP_PARAM->pLastClass = hb_compClassAdd( HB_COMP_PARAM, $2 ); HB_COMP_PARAM->iVarScope = VS_NONE; } + | DECLARE_MEMBER DecMethod Crlf { HB_COMP_PARAM->iVarScope = VS_NONE; } + | DECLARE_MEMBER '{' AsType { HB_COMP_PARAM->cDataListType = HB_COMP_PARAM->cVarType; } DecDataList '}' Crlf { HB_COMP_PARAM->cDataListType = 0; HB_COMP_PARAM->iVarScope = VS_NONE; } ; DecDataList: DecData @@ -1328,47 +1308,47 @@ ClassInfo : DecMethod | ClassInfo DecData ; -DecMethod : IdentName '(' { hb_comp_pLastMethod = hb_compMethodAdd( hb_comp_pLastClass, $1 ); } DecList ')' AsType +DecMethod : IdentName '(' { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_COMP_PARAM, HB_COMP_PARAM->pLastClass, $1 ); } DecList ')' AsType { - if( hb_comp_pLastMethod ) + if( HB_COMP_PARAM->pLastMethod ) { - hb_comp_pLastMethod->cType = hb_comp_cVarType; - if ( toupper( hb_comp_cVarType ) == 'S' ) + HB_COMP_PARAM->pLastMethod->cType = HB_COMP_PARAM->cVarType; + if ( toupper( HB_COMP_PARAM->cVarType ) == 'S' ) { - hb_comp_pLastMethod->pClass = hb_compClassFind( hb_comp_szFromClass ); - if( ! hb_comp_pLastMethod->pClass ) + HB_COMP_PARAM->pLastMethod->pClass = hb_compClassFind( HB_COMP_PARAM, HB_COMP_PARAM->szFromClass ); + if( ! HB_COMP_PARAM->pLastMethod->pClass ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, hb_comp_szFromClass, hb_comp_pLastMethod->szName ); - hb_comp_pLastMethod->cType = ( isupper( ( int ) hb_comp_cVarType ) ? 'O' : 'o' ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastMethod->szName ); + HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' : 'o' ); } - hb_comp_szFromClass = NULL; + HB_COMP_PARAM->szFromClass = NULL; } } - hb_comp_pLastMethod = NULL; - hb_comp_cVarType = ' '; + HB_COMP_PARAM->pLastMethod = NULL; + HB_COMP_PARAM->cVarType = ' '; } ; -DecData : IdentName { hb_comp_pLastMethod = hb_compMethodAdd( hb_comp_pLastClass, $1 ); } AsType +DecData : IdentName { HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_COMP_PARAM, HB_COMP_PARAM->pLastClass, $1 ); } AsType { - if( hb_comp_pLastMethod ) + if( HB_COMP_PARAM->pLastMethod ) { PCOMCLASS pClass; char * szSetData = ( char * ) hb_xgrab( strlen( $1 ) + 2 ); /* List Type overrides if exists. */ - if( hb_comp_cDataListType ) hb_comp_cVarType = hb_comp_cDataListType; + if( HB_COMP_PARAM->cDataListType ) HB_COMP_PARAM->cVarType = HB_COMP_PARAM->cDataListType; - hb_comp_pLastMethod->cType = hb_comp_cVarType; - if ( toupper( hb_comp_cVarType ) == 'S' ) + HB_COMP_PARAM->pLastMethod->cType = HB_COMP_PARAM->cVarType; + if ( toupper( HB_COMP_PARAM->cVarType ) == 'S' ) { - pClass = hb_compClassFind( hb_comp_szFromClass ); - hb_comp_pLastMethod->pClass = pClass; - if( ! hb_comp_pLastMethod->pClass ) + pClass = hb_compClassFind( HB_COMP_PARAM, HB_COMP_PARAM->szFromClass ); + HB_COMP_PARAM->pLastMethod->pClass = pClass; + if( ! HB_COMP_PARAM->pLastMethod->pClass ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, hb_comp_szFromClass, hb_comp_pLastMethod->szName ); - hb_comp_pLastMethod->cType = ( isupper( ( int ) hb_comp_cVarType ) ? 'O' :'o' ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_CLASS_NOT_FOUND, HB_COMP_PARAM->szFromClass, HB_COMP_PARAM->pLastMethod->szName ); + HB_COMP_PARAM->pLastMethod->cType = ( isupper( ( int ) HB_COMP_PARAM->cVarType ) ? 'O' :'o' ); } } else @@ -1376,25 +1356,25 @@ DecData : IdentName { hb_comp_pLastMethod = hb_compMethodAdd( hb_comp_pLastCl sprintf( szSetData, "_%s", $1 ); - hb_comp_pLastMethod = hb_compMethodAdd( hb_comp_pLastClass, szSetData ); - hb_comp_pLastMethod->cType = hb_comp_cVarType; - hb_comp_pLastMethod->iParamCount = 1; + HB_COMP_PARAM->pLastMethod = hb_compMethodAdd( HB_COMP_PARAM, HB_COMP_PARAM->pLastClass, szSetData ); + HB_COMP_PARAM->pLastMethod->cType = HB_COMP_PARAM->cVarType; + HB_COMP_PARAM->pLastMethod->iParamCount = 1; - hb_comp_pLastMethod->cParamTypes = ( BYTE * ) hb_xgrab( 1 ); - hb_comp_pLastMethod->cParamTypes[0] = hb_comp_cVarType; + HB_COMP_PARAM->pLastMethod->cParamTypes = ( BYTE * ) hb_xgrab( 1 ); + HB_COMP_PARAM->pLastMethod->cParamTypes[0] = HB_COMP_PARAM->cVarType; - hb_comp_pLastMethod->pParamClasses = ( PCOMCLASS * ) hb_xgrab( sizeof( COMCLASS ) ); - hb_comp_pLastMethod->pParamClasses[0] = pClass; + HB_COMP_PARAM->pLastMethod->pParamClasses = ( PCOMCLASS * ) hb_xgrab( sizeof( COMCLASS ) ); + HB_COMP_PARAM->pLastMethod->pParamClasses[0] = pClass; - if ( toupper( hb_comp_cVarType ) == 'S' ) + if ( toupper( HB_COMP_PARAM->cVarType ) == 'S' ) { - hb_comp_pLastMethod->pClass = pClass; - hb_comp_szFromClass = NULL; + HB_COMP_PARAM->pLastMethod->pClass = pClass; + HB_COMP_PARAM->szFromClass = NULL; } } - hb_comp_pLastMethod = NULL; - hb_comp_cVarType = ' '; + HB_COMP_PARAM->pLastMethod = NULL; + HB_COMP_PARAM->cVarType = ' '; } ; @@ -1414,20 +1394,20 @@ DummyArgument : EmptyExpression {} | '@' IdentName {} | '@' IdentName '(' DummyArgList ')' {} */ -FormalList : IdentName AsType { hb_compDeclaredParameterAdd( $1, hb_comp_cVarType ); } - | '@' IdentName AsType { hb_compDeclaredParameterAdd( $2, hb_comp_cVarType + VT_OFFSET_BYREF ); } - | '@' IdentName '(' DummyArgList ')' { hb_compDeclaredParameterAdd( $2, 'F' ); hb_compExprDelete( $4 );} - | FormalList ',' IdentName AsType { hb_compDeclaredParameterAdd( $3, hb_comp_cVarType ); } - | FormalList ',' '@' IdentName AsType { hb_compDeclaredParameterAdd( $4, hb_comp_cVarType + VT_OFFSET_BYREF ); } - | FormalList ',' '@' IdentName '(' DummyArgList ')' { hb_compDeclaredParameterAdd( $4, 'F' ); hb_compExprDelete( $6 ); } +FormalList : IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $1, HB_COMP_PARAM->cVarType ); } + | '@' IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $2, HB_COMP_PARAM->cVarType + VT_OFFSET_BYREF ); } + | '@' IdentName '(' DummyArgList ')' { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $2, 'F' ); hb_compExprDelete( $4, HB_COMP_PARAM );} + | FormalList ',' IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType ); } + | FormalList ',' '@' IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $4, HB_COMP_PARAM->cVarType + VT_OFFSET_BYREF ); } + | FormalList ',' '@' IdentName '(' DummyArgList ')' { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $4, 'F' ); hb_compExprDelete( $6, HB_COMP_PARAM ); } ; -OptList : 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 '(' DummyArgList ')' { hb_compDeclaredParameterAdd( $3, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); } - | 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 '(' DummyArgList ')' { hb_compDeclaredParameterAdd( $5, hb_comp_cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); } +OptList : OPTIONAL IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $2, HB_COMP_PARAM->cVarType + VT_OFFSET_OPTIONAL ); } + | OPTIONAL '@' IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); } + | OPTIONAL '@' IdentName '(' DummyArgList ')' { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $3, HB_COMP_PARAM->cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); } + | OptList ',' OPTIONAL IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $4, HB_COMP_PARAM->cVarType + VT_OFFSET_OPTIONAL ); } + | OptList ',' OPTIONAL '@' IdentName AsType { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $5, HB_COMP_PARAM->cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); } + | OptList ',' OPTIONAL '@' IdentName '(' DummyArgList ')' { hb_compDeclaredParameterAdd( HB_COMP_PARAM, $5, HB_COMP_PARAM->cVarType + VT_OFFSET_OPTIONAL + VT_OFFSET_BYREF ); } ; ExecFlow : IfEndif @@ -1439,10 +1419,10 @@ ExecFlow : IfEndif | DoSwitch ; -IfEndif : IfBegin EndIf { hb_compGenJumpHere( $1 ); } - | IfBegin IfElse EndIf { hb_compGenJumpHere( $1 ); } - | IfBegin IfElseIf EndIf { hb_compGenJumpHere( $1 ); hb_compElseIfFix( $2 ); } - | IfBegin IfElseIf IfElse EndIf { hb_compGenJumpHere( $1 ); hb_compElseIfFix( $2 ); } +IfEndif : IfBegin EndIf { hb_compGenJumpHere( $1, HB_COMP_PARAM ); } + | IfBegin IfElse EndIf { hb_compGenJumpHere( $1, HB_COMP_PARAM ); } + | IfBegin IfElseIf EndIf { hb_compGenJumpHere( $1, HB_COMP_PARAM ); hb_compElseIfFix( HB_COMP_PARAM, $2 ); } + | IfBegin IfElseIf IfElse EndIf { hb_compGenJumpHere( $1, HB_COMP_PARAM ); hb_compElseIfFix( HB_COMP_PARAM, $2 ); } ; EmptyStatements : LineStat { $$ = $1; } @@ -1453,59 +1433,59 @@ EmptyStats : /* empty */ { $$ = 0; } | EmptyStatements { $$ = $1; } ; -IfBegin : IF SimpleExpression { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); } +IfBegin : IF SimpleExpression { ++HB_COMP_PARAM->wIfCounter; hb_compLinePush( HB_COMP_PARAM ); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compGenJump( 0 ); hb_compGenJumpHere( $5 ); } + { $$ = hb_compGenJump( 0, HB_COMP_PARAM ); hb_compGenJumpHere( $5, HB_COMP_PARAM ); } - | IF Variable { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); } + | IF Variable { ++HB_COMP_PARAM->wIfCounter; hb_compLinePush( HB_COMP_PARAM ); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compGenJump( 0 ); hb_compGenJumpHere( $5 ); } + { $$ = hb_compGenJump( 0, HB_COMP_PARAM ); hb_compGenJumpHere( $5, HB_COMP_PARAM ); } - | IF PareExpList1 { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); } + | IF PareExpList1 { ++HB_COMP_PARAM->wIfCounter; hb_compLinePush( HB_COMP_PARAM ); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compGenJump( 0 ); hb_compGenJumpHere( $5 ); } + { $$ = hb_compGenJump( 0, HB_COMP_PARAM ); hb_compGenJumpHere( $5, HB_COMP_PARAM ); } - | IF PareExpList2 { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); } + | IF PareExpList2 { ++HB_COMP_PARAM->wIfCounter; hb_compLinePush( HB_COMP_PARAM ); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compGenJump( 0 ); hb_compGenJumpHere( $5 ); } + { $$ = hb_compGenJump( 0, HB_COMP_PARAM ); hb_compGenJumpHere( $5, HB_COMP_PARAM ); } - | IF PareExpListN { ++hb_comp_wIfCounter; hb_compLinePush(); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2 ) ); $$ = hb_compGenJumpFalse( 0 ); } + | IF PareExpListN { ++HB_COMP_PARAM->wIfCounter; hb_compLinePush( HB_COMP_PARAM ); } Crlf { hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compGenJump( 0 ); hb_compGenJumpHere( $5 ); } + { $$ = hb_compGenJump( 0, HB_COMP_PARAM ); hb_compGenJumpHere( $5, HB_COMP_PARAM ); } ; -IfElse : ELSE Crlf { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } +IfElse : ELSE Crlf { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } EmptyStats ; -IfElseIf : ELSEIF { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; hb_compLinePush(); } +IfElseIf : ELSEIF { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; hb_compLinePush( HB_COMP_PARAM ); } Expression Crlf - { hb_compExprDelete( hb_compExprGenPush( $3 ) ); - $$ = hb_compGenJumpFalse( 0 ); + { hb_compExprDelete( hb_compExprGenPush( $3, HB_COMP_PARAM ), HB_COMP_PARAM ); + $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compElseIfGen( NULL, hb_compGenJump( 0 ) ); - hb_compGenJumpHere( $5 ); + { $$ = hb_compElseIfGen( HB_COMP_PARAM, NULL, hb_compGenJump( 0, HB_COMP_PARAM ) ); + hb_compGenJumpHere( $5, HB_COMP_PARAM ); } - | IfElseIf ELSEIF { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; hb_compLinePush(); } + | IfElseIf ELSEIF { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; hb_compLinePush( HB_COMP_PARAM ); } Expression Crlf - { hb_compExprDelete( hb_compExprGenPush( $4 ) ); - $$ = hb_compGenJumpFalse( 0 ); + { hb_compExprDelete( hb_compExprGenPush( $4, HB_COMP_PARAM ), HB_COMP_PARAM ); + $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats - { $$ = hb_compElseIfGen( $1, hb_compGenJump( 0 ) ); - hb_compGenJumpHere( $6 ); + { $$ = hb_compElseIfGen( HB_COMP_PARAM, $1, hb_compGenJump( 0, HB_COMP_PARAM ) ); + hb_compGenJumpHere( $6, HB_COMP_PARAM ); } ; -EndIf : ENDIF { --hb_comp_wIfCounter; hb_comp_functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); } - | END { --hb_comp_wIfCounter; hb_comp_functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); } +EndIf : ENDIF { --HB_COMP_PARAM->wIfCounter; HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); } + | END { --HB_COMP_PARAM->wIfCounter; HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( /*FUN_WITH_RETURN |*/ FUN_BREAK_CODE ); } ; DoCase : DoCaseBegin Cases - EndCase { hb_compElseIfFix( $2 ); } + EndCase { hb_compElseIfFix( HB_COMP_PARAM, $2 ); } | DoCaseBegin Otherwise @@ -1517,112 +1497,112 @@ DoCase : DoCaseBegin | DoCaseBegin Cases Otherwise - EndCase { hb_compElseIfFix( $2 ); } + EndCase { hb_compElseIfFix( HB_COMP_PARAM, $2 ); } ; EndCase : ENDCASE - { --hb_comp_wCaseCounter; - hb_comp_functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); + { --HB_COMP_PARAM->wCaseCounter; + HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); } | END - { --hb_comp_wCaseCounter; - hb_comp_functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); + { --HB_COMP_PARAM->wCaseCounter; + HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); } ; -DoCaseStart : DOCASE { ++hb_comp_wCaseCounter; hb_compLinePushIfDebugger();} Crlf +DoCaseStart : DOCASE { ++HB_COMP_PARAM->wCaseCounter; hb_compLinePushIfDebugger( HB_COMP_PARAM );} Crlf ; DoCaseBegin : DoCaseStart { } | DoCaseStart Statements { if( $2 > 0 ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); } } ; -Cases : CASE { hb_compLinePush(); } Expression Crlf +Cases : CASE { hb_compLinePush( HB_COMP_PARAM ); } Expression Crlf { - hb_compExprDelete( hb_compExprGenPush( $3 ) ); - $$ = hb_compGenJumpFalse( 0 ); + hb_compExprDelete( hb_compExprGenPush( $3, HB_COMP_PARAM ), HB_COMP_PARAM ); + $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats { - hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; - $$ = hb_compElseIfGen( NULL, hb_compGenJump( 0 ) ); - hb_compGenJumpHere( $5 ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; + $$ = hb_compElseIfGen( HB_COMP_PARAM, NULL, hb_compGenJump( 0, HB_COMP_PARAM ) ); + hb_compGenJumpHere( $5, HB_COMP_PARAM ); } - | Cases CASE { hb_compLinePush(); } Expression Crlf + | Cases CASE { hb_compLinePush( HB_COMP_PARAM ); } Expression Crlf { - hb_compExprDelete( hb_compExprGenPush( $4 ) ); - $$ = hb_compGenJumpFalse( 0 ); + hb_compExprDelete( hb_compExprGenPush( $4, HB_COMP_PARAM ), HB_COMP_PARAM ); + $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats { - hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; - $$ = hb_compElseIfGen( $1, hb_compGenJump( 0 ) ); - hb_compGenJumpHere( $6 ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; + $$ = hb_compElseIfGen( HB_COMP_PARAM, $1, hb_compGenJump( 0, HB_COMP_PARAM ) ); + hb_compGenJumpHere( $6, HB_COMP_PARAM ); } ; -Otherwise : OTHERWISE {hb_compLinePushIfDebugger(); } Crlf { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } +Otherwise : OTHERWISE {hb_compLinePushIfDebugger( HB_COMP_PARAM ); } Crlf { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } EmptyStats - | Otherwise OTHERWISE { hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); } Crlf + | Otherwise OTHERWISE { hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); } Crlf EmptyStats ; DoWhile : WhileBegin Expression Crlf { - hb_compExprDelete( hb_compExprGenPush( $2 ) ); - $$ = hb_compGenJumpFalse( 0 ); + hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); + $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } EmptyStats { - hb_compLoopHere(); - hb_compGenJump( $1 - hb_comp_functions.pLast->lPCodePos ); + hb_compLoopHere( HB_COMP_PARAM ); + hb_compGenJump( $1 - HB_COMP_PARAM->functions.pLast->lPCodePos, HB_COMP_PARAM ); } EndWhile { - hb_compGenJumpHere( $4 ); --hb_comp_wWhileCounter; - hb_compLoopEnd(); - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + hb_compGenJumpHere( $4, HB_COMP_PARAM ); --HB_COMP_PARAM->wWhileCounter; + hb_compLoopEnd( HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } ; -WhileBegin : WHILE { $$ = hb_comp_functions.pLast->lPCodePos; hb_compLinePushIfInside(); ++hb_comp_wWhileCounter; hb_compLoopStart(); } +WhileBegin : WHILE { $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; hb_compLinePushIfInside( HB_COMP_PARAM ); ++HB_COMP_PARAM->wWhileCounter; hb_compLoopStart( HB_COMP_PARAM ); } ; -EndWhile : END { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } - | ENDDO { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } +EndWhile : END { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } + | ENDDO { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } ; ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */ { - hb_compLinePush(); + hb_compLinePush( HB_COMP_PARAM ); hb_compDebugStart(); - ++hb_comp_wForCounter; /* 5 */ - $$ = hb_compExprGenStatement( hb_compExprAssign( $2, $4 ) ); + ++HB_COMP_PARAM->wForCounter; /* 5 */ + $$ = hb_compExprGenStatement( hb_compExprAssign( $2, $4, HB_COMP_PARAM ), HB_COMP_PARAM ); if( hb_compExprAsSymbol($2) ) { - hb_compForStart( hb_compExprAsSymbol($2), FALSE ); + hb_compForStart( HB_COMP_PARAM, hb_compExprAsSymbol($2), FALSE ); } } TO Expression StepExpr /* 6 7 8 */ { - hb_compLoopStart(); - $$ = hb_compGenJump( 0 ); /* 9 */ + hb_compLoopStart( HB_COMP_PARAM ); + $$ = hb_compGenJump( 0, HB_COMP_PARAM ); /* 9 */ } Crlf /* 10 */ { - $$ = hb_comp_functions.pLast->lPCodePos; /* 11 */ + $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; /* 11 */ } ForStatements /* 12 */ { short iStep, iLocal; - hb_compLoopHere(); + hb_compLoopHere( HB_COMP_PARAM ); if( $8 ) { @@ -1636,42 +1616,42 @@ ForNext : FOR LValue ForAssign Expression /* 1 2 3 4 */ iStep = 1; } - if( iStep && ( iLocal = hb_compLocalGetPos( hb_compExprAsSymbol($2) ) ) > 0 && iLocal < 256 ) + if( iStep && ( iLocal = hb_compLocalGetPos( HB_COMP_PARAM, hb_compExprAsSymbol($2) ) ) > 0 && iLocal < 256 ) { - hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iStep ), HB_HIBYTE( iStep ), ( BOOL ) 0 ); + hb_compGenPCode4( HB_P_LOCALNEARADDINT, ( BYTE ) iLocal, HB_LOBYTE( iStep ), HB_HIBYTE( iStep ), HB_COMP_PARAM ); } else if( $8 ) { - hb_compExprClear( hb_compExprGenStatement( hb_compExprSetOperand( hb_compExprNewPlusEq( $2 ), $8 ) ) ); + hb_compExprClear( hb_compExprGenStatement( hb_compExprSetOperand( hb_compExprNewPlusEq( $2, HB_COMP_PARAM ), $8, HB_COMP_PARAM ), HB_COMP_PARAM ) ); } else { - hb_compExprClear( hb_compExprGenStatement( hb_compExprNewPreInc( $2 ) ) ); + hb_compExprClear( hb_compExprGenStatement( hb_compExprNewPreInc( $2, HB_COMP_PARAM ), HB_COMP_PARAM ) ); } - hb_compGenJumpHere( $9 ); + hb_compGenJumpHere( $9, HB_COMP_PARAM ); - hb_compExprGenPush( $2 ); /* counter */ - hb_compExprGenPush( $7 ); /* end */ + hb_compExprGenPush( $2, HB_COMP_PARAM ); /* counter */ + hb_compExprGenPush( $7, HB_COMP_PARAM ); /* end */ if( $8 ) { - hb_compExprGenPush( $8 ); /* step */ - hb_compGenPCode1( HB_P_FORTEST ); + hb_compExprGenPush( $8, HB_COMP_PARAM ); /* step */ + hb_compGenPCode1( HB_P_FORTEST, HB_COMP_PARAM ); } else - hb_compGenPCode1( HB_P_GREATER ); + hb_compGenPCode1( HB_P_GREATER, HB_COMP_PARAM ); - hb_compGenJumpFalse( $11 - hb_comp_functions.pLast->lPCodePos ); - hb_compLoopEnd(); + hb_compGenJumpFalse( $11 - HB_COMP_PARAM->functions.pLast->lPCodePos, HB_COMP_PARAM ); + hb_compLoopEnd( HB_COMP_PARAM ); if( hb_compExprAsSymbol($2) ) { - hb_compForEnd( hb_compExprAsSymbol($2) ); + hb_compForEnd( HB_COMP_PARAM, hb_compExprAsSymbol($2) ); } - hb_compExprDelete( $7 ); - hb_compExprDelete( $5 ); /* deletes $5, $2, $4 */ + hb_compExprDelete( $7, HB_COMP_PARAM ); + hb_compExprDelete( $5, HB_COMP_PARAM ); /* deletes $5, $2, $4 */ if( $8 ) - hb_compExprDelete( $8 ); - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + hb_compExprDelete( $8, HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } ; @@ -1680,60 +1660,60 @@ ForAssign : '=' ; StepExpr : /* default step expression */ { $$ = NULL; } - | STEP Expression { $$ = hb_compExprReduce( $2 ); } + | STEP Expression { $$ = hb_compExprReduce( $2, HB_COMP_PARAM ); } ; -ForStatements : EmptyStats NEXT { hb_compLinePush(); --hb_comp_wForCounter; } - | EmptyStats NEXT IdentName { hb_compLinePush(); --hb_comp_wForCounter; } - | EmptyStats END { hb_compLinePush(); --hb_comp_wForCounter; } - | EmptyStats END IdentName { hb_compLinePush(); --hb_comp_wForCounter; } +ForStatements : EmptyStats NEXT { hb_compLinePush( HB_COMP_PARAM ); --HB_COMP_PARAM->wForCounter; } + | EmptyStats NEXT IdentName { hb_compLinePush( HB_COMP_PARAM ); --HB_COMP_PARAM->wForCounter; } + | EmptyStats END { hb_compLinePush( HB_COMP_PARAM ); --HB_COMP_PARAM->wForCounter; } + | EmptyStats END IdentName { hb_compLinePush( HB_COMP_PARAM ); --HB_COMP_PARAM->wForCounter; } ; -ForVar : IdentName { $$ = hb_compExprNewVarRef($1); } - | AliasVar { $$ = hb_compExprNewRef($1); } +ForVar : IdentName { $$ = hb_compExprNewVarRef( $1, HB_COMP_PARAM ); } + | AliasVar { $$ = hb_compExprNewRef( $1, HB_COMP_PARAM ); } ; -ForList : ForVar { $$ = hb_compExprNewArgList( $1 ); } +ForList : ForVar { $$ = hb_compExprNewArgList( $1, HB_COMP_PARAM ); } | ForList ',' ForVar { $$ = hb_compExprAddListExpr( $1, $3 ); } ; -ForExpr : Expression { $$ = hb_compExprNewArgList( $1 ); } +ForExpr : Expression { $$ = hb_compExprNewArgList( $1, HB_COMP_PARAM ); } | ForExpr ',' Expression { $$ = hb_compExprAddListExpr( $1, $3 ); } ; ForEach : FOREACH ForList IN ForExpr /* 1 2 3 4 */ { - ++hb_comp_wForCounter; /* 5 */ - hb_compLinePush(); + ++HB_COMP_PARAM->wForCounter; /* 5 */ + hb_compLinePush( HB_COMP_PARAM ); hb_compDebugStart(); } Descend /* 6 */ { /* 7 */ - hb_compEnumStart( $2, $4, $6 ); + hb_compEnumStart( HB_COMP_PARAM, $2, $4, $6 ); - hb_compLoopStart(); - $$ = hb_comp_functions.pLast->lPCodePos; + hb_compLoopStart( HB_COMP_PARAM ); + $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; } Crlf /* 8 */ { /* 9 */ - $$ = hb_compGenJumpFalse( 0 ); + $$ = hb_compGenJumpFalse( 0, HB_COMP_PARAM ); } ForStatements /* 10 */ { - hb_compLoopHere(); - hb_compEnumNext( $2, $6 ); - hb_compGenJump( $7 - hb_comp_functions.pLast->lPCodePos ); + hb_compLoopHere( HB_COMP_PARAM ); + hb_compEnumNext( HB_COMP_PARAM, $2, $6 ); + hb_compGenJump( $7 - HB_COMP_PARAM->functions.pLast->lPCodePos, HB_COMP_PARAM ); - hb_compGenJumpHere( $9 ); - hb_compLoopEnd(); - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; - hb_compEnumEnd( $2 ); - hb_compExprDelete( $2 ); - hb_compExprDelete( $4 ); + hb_compGenJumpHere( $9, HB_COMP_PARAM ); + hb_compLoopEnd( HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + hb_compEnumEnd( HB_COMP_PARAM, $2 ); + hb_compExprDelete( $2, HB_COMP_PARAM ); + hb_compExprDelete( $4, HB_COMP_PARAM ); } ; @@ -1743,39 +1723,39 @@ Descend : /* default up */ { $$ = 1; } DoSwitch : SwitchBegin { - hb_compLoopStart(); - hb_compSwitchStart(); - hb_compGenJump( 0 ); + hb_compLoopStart( HB_COMP_PARAM ); + hb_compSwitchStart( HB_COMP_PARAM ); + hb_compGenJump( 0, HB_COMP_PARAM ); } SwitchCases EndSwitch { - hb_compSwitchEnd(); - hb_compLoopEnd(); + hb_compSwitchEnd( HB_COMP_PARAM ); + hb_compLoopEnd( HB_COMP_PARAM ); } | SwitchBegin EndSwitch { - hb_compGenPData1( HB_P_POP ); + hb_compGenPData1( HB_P_POP, HB_COMP_PARAM ); } ; EndSwitch : END { - --hb_comp_wSwitchCounter; - hb_comp_functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); + --HB_COMP_PARAM->wSwitchCounter; + HB_COMP_PARAM->functions.pLast->bFlags &= ~ ( FUN_WITH_RETURN | FUN_BREAK_CODE ); } ; SwitchStart : DOSWITCH - { ++hb_comp_wSwitchCounter; - hb_compLinePush(); + { ++HB_COMP_PARAM->wSwitchCounter; + hb_compLinePush( HB_COMP_PARAM ); } Expression Crlf { - hb_compExprDelete( hb_compExprGenPush( $3 ) ); + hb_compExprDelete( hb_compExprGenPush( $3, HB_COMP_PARAM ), HB_COMP_PARAM ); } ; @@ -1783,15 +1763,15 @@ SwitchBegin : SwitchStart { } | SwitchStart Statements { if( $2 > 0 ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); } } ; -SwitchCases : CASE Expression { hb_compSwitchAdd( $2 ); hb_compLinePush(); } Crlf +SwitchCases : CASE Expression { hb_compSwitchAdd( HB_COMP_PARAM, $2 ); hb_compLinePush( HB_COMP_PARAM ); } Crlf EmptyStats - | SwitchCases CASE Expression { hb_compSwitchAdd( $3 ); hb_compLinePush(); }Crlf + | SwitchCases CASE Expression { hb_compSwitchAdd( HB_COMP_PARAM, $3 ); hb_compLinePush( HB_COMP_PARAM ); }Crlf EmptyStats | SwitchDefault @@ -1799,18 +1779,18 @@ SwitchCases : CASE Expression { hb_compSwitchAdd( $2 ); hb_compLinePush(); } Crl | SwitchCases SwitchDefault ; -SwitchDefault : OTHERWISE {hb_compSwitchAdd(NULL); hb_compLinePush(); } Crlf { hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } +SwitchDefault : OTHERWISE { hb_compSwitchAdd( HB_COMP_PARAM, NULL ); hb_compLinePush( HB_COMP_PARAM ); } Crlf { HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; } EmptyStats ; -BeginSeq : BEGINSEQ { ++hb_comp_wSeqCounter; $$ = hb_compSequenceBegin(); } Crlf +BeginSeq : BEGINSEQ { ++HB_COMP_PARAM->wSeqCounter; $$ = hb_compSequenceBegin( HB_COMP_PARAM ); } Crlf EmptyStats { /* Set jump address for HB_P_SEQBEGIN opcode - this address * will be used in BREAK code if there is no RECOVER clause */ - hb_compGenJumpHere( $2 ); - $$ = hb_compSequenceEnd(); + hb_compGenJumpHere( $2, HB_COMP_PARAM ); + $$ = hb_compSequenceEnd( HB_COMP_PARAM ); } RecoverSeq { @@ -1818,7 +1798,7 @@ BeginSeq : BEGINSEQ { ++hb_comp_wSeqCounter; $$ = hb_compSequenceBegi * HB_P_SEQBEGIN opcode if there is RECOVER clause */ if( $6 ) - hb_compGenJumpThere( $2, $6 ); + hb_compGenJumpThere( $2, $6, HB_COMP_PARAM ); } END { @@ -1826,11 +1806,11 @@ BeginSeq : BEGINSEQ { ++hb_comp_wSeqCounter; $$ = hb_compSequenceBegi * There is no line number after HB_P_SEQEND in case no * RECOVER clause is used */ - hb_compGenJumpThere( $5, hb_comp_functions.pLast->lPCodePos ); + hb_compGenJumpThere( $5, HB_COMP_PARAM->functions.pLast->lPCodePos, HB_COMP_PARAM ); if( !$6 ) /* only if there is no RECOVER clause */ - --hb_comp_wSeqCounter; /* RECOVER is also considered as end of sequence */ - hb_compSequenceFinish( $2, $4 ); - hb_comp_functions.pLast->bFlags &= ~ FUN_WITH_RETURN; + --HB_COMP_PARAM->wSeqCounter; /* RECOVER is also considered as end of sequence */ + hb_compSequenceFinish( $2, $4, HB_COMP_PARAM ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_WITH_RETURN; } ; @@ -1841,22 +1821,22 @@ RecoverSeq : /* no recover */ { $$ = 0; } RecoverEmpty : RECOVER { - hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; - $$ = hb_comp_functions.pLast->lPCodePos; - --hb_comp_wSeqCounter; - hb_compLinePush(); - hb_compGenPCode2( HB_P_SEQRECOVER, HB_P_POP, ( BOOL ) 0 ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; + $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; + --HB_COMP_PARAM->wSeqCounter; + hb_compLinePush( HB_COMP_PARAM ); + hb_compGenPCode2( HB_P_SEQRECOVER, HB_P_POP, HB_COMP_PARAM ); } ; RecoverUsing : RECOVERUSING IdentName { - hb_comp_functions.pLast->bFlags &= ~ FUN_BREAK_CODE; - $$ = hb_comp_functions.pLast->lPCodePos; - --hb_comp_wSeqCounter; - hb_compLinePush(); - hb_compGenPCode1( HB_P_SEQRECOVER ); - hb_compGenPopVar( $2 ); + HB_COMP_PARAM->functions.pLast->bFlags &= ~ FUN_BREAK_CODE; + $$ = HB_COMP_PARAM->functions.pLast->lPCodePos; + --HB_COMP_PARAM->wSeqCounter; + hb_compLinePush( HB_COMP_PARAM ); + hb_compGenPCode1( HB_P_SEQRECOVER, HB_COMP_PARAM ); + hb_compGenPopVar( $2, HB_COMP_PARAM ); } ; @@ -1866,55 +1846,60 @@ RecoverUsing : RECOVERUSING IdentName * DO .. WITH ++variable * will pass the value of variable not a reference */ -DoName : IdentName { $$ = hb_compExprNewFunName( $1 ); hb_compAutoOpenAdd( $1 ); } +DoName : IdentName { $$ = hb_compExprNewFunName( $1, HB_COMP_PARAM ); hb_compAutoOpenAdd( HB_COMP_PARAM, $1 ); } | MacroVar { $$ = $1; } - | MacroExpr { $$ = $1; } + | MacroExpr { $$ = $1; } ; DoProc : DO DoName - { $$ = hb_compExprNewFunCall( $2, NULL ); } + { $$ = hb_compExprNewFunCall( $2, NULL, HB_COMP_PARAM ); } | DO DoName WITH DoArgList - { $$ = hb_compExprNewFunCall( $2, $4 ); } - | DOIDENT { hb_compAutoOpenAdd( $1 ); $$ = hb_compExprNewFunCall( hb_compExprNewFunName( hb_strupr($1) ), NULL ); } + { $$ = hb_compExprNewFunCall( $2, $4, HB_COMP_PARAM ); } + | DOIDENT + { + /* DOIDENT is the only one identifier which can be returned in lower letters */ + hb_compAutoOpenAdd( HB_COMP_PARAM, $1 ); $$ = hb_compExprNewFunCall( hb_compExprNewFunName( hb_compIdentifierNew( HB_COMP_PARAM, hb_strupr( hb_strdup( $1 ) ), FALSE ), HB_COMP_PARAM ), NULL, HB_COMP_PARAM ); + } | DOIDENT WITH DoArgList - { hb_compAutoOpenAdd( $1 ); $$ = hb_compExprNewFunCall( hb_compExprNewFunName(hb_strupr($1)), $3 ); } - | WHILE WITH DoArgList - { hb_compAutoOpenAdd( $1 ); $$ = hb_compExprNewFunCall( hb_compExprNewFunName( hb_compIdentifierNew(hb_strupr($1), TRUE) ), $3 ); } + { + /* DOIDENT is the only one identifier which can be returned in lower letters */ + hb_compAutoOpenAdd( HB_COMP_PARAM, $1 ); $$ = hb_compExprNewFunCall( hb_compExprNewFunName( hb_compIdentifierNew( HB_COMP_PARAM, hb_strupr( hb_strdup( $1 ) ), FALSE ), HB_COMP_PARAM ), $3, HB_COMP_PARAM ); + } ; -DoArgList : ',' { $$ = hb_compExprAddListExpr( hb_compExprNewArgList( hb_compExprNewNil() ), hb_compExprNewNil() ); } - | ',' DoArgument { $$ = hb_compExprAddListExpr( hb_compExprNewArgList( hb_compExprNewNil() ), $2 ); } - | DoArgument { $$ = hb_compExprNewArgList( $1 ); } - | DoArgList ',' { $$ = hb_compExprAddListExpr( $1, hb_compExprNewNil() ); } +DoArgList : ',' { $$ = hb_compExprAddListExpr( hb_compExprNewArgList( hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ), hb_compExprNewNil( HB_COMP_PARAM ) ); } + | ',' DoArgument { $$ = hb_compExprAddListExpr( hb_compExprNewArgList( hb_compExprNewNil( HB_COMP_PARAM ), HB_COMP_PARAM ), $2 ); } + | DoArgument { $$ = hb_compExprNewArgList( $1, HB_COMP_PARAM ); } + | DoArgList ',' { $$ = hb_compExprAddListExpr( $1, hb_compExprNewNil( HB_COMP_PARAM ) ); } | DoArgList ',' DoArgument { $$ = hb_compExprAddListExpr( $1, $3 ); } ; -DoArgument : IdentName { $$ = hb_compExprNewVarRef( $1 ); } +DoArgument : IdentName { $$ = hb_compExprNewVarRef( $1, HB_COMP_PARAM ); } | '@' FunIdentCall { $$ = $2; } - | '@' IdentName { $$ = hb_compExprNewVarRef( $2 ); } + | '@' IdentName { $$ = hb_compExprNewVarRef( $2, HB_COMP_PARAM ); } | SimpleExpression { $$ = $1; } | PareExpList { $$ = $1; } - | '@' MacroVar { $$ = hb_compExprNewRef( $2 ); } - | '@' AliasVar { $$ = hb_compExprNewRef( $2 ); } + | '@' MacroVar { $$ = hb_compExprNewRef( $2, HB_COMP_PARAM ); } + | '@' AliasVar { $$ = hb_compExprNewRef( $2, HB_COMP_PARAM ); } ; WithObject : WITHOBJECT Expression Crlf { - hb_compExprDelete( hb_compExprGenPush( $2 ) ); - hb_compGenPCode1( HB_P_WITHOBJECTSTART ); - hb_comp_wWithObjectCnt++; + hb_compExprDelete( hb_compExprGenPush( $2, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenPCode1( HB_P_WITHOBJECTSTART, HB_COMP_PARAM ); + HB_COMP_PARAM->wWithObjectCnt++; } EmptyStatements END { - --hb_comp_wWithObjectCnt; - hb_compGenPCode1( HB_P_WITHOBJECTEND ); + --HB_COMP_PARAM->wWithObjectCnt; + hb_compGenPCode1( HB_P_WITHOBJECTEND, HB_COMP_PARAM ); } - | WITHOBJECT Expression Crlf END { hb_compExprDelete( $2 ); } + | WITHOBJECT Expression Crlf END { hb_compExprDelete( $2, HB_COMP_PARAM ); } ; -Crlf : '\n' { hb_comp_bError = FALSE; } - | ';' { hb_comp_bDontGenLineNum = TRUE; } +Crlf : '\n' { HB_COMP_PARAM->fError = FALSE; } + | ';' { HB_COMP_PARAM->fDontGenLineNum = TRUE; } ; %% @@ -1939,37 +1924,36 @@ Crlf : '\n' { hb_comp_bError = FALSE; } * This function stores the position in pcode buffer where the FOR/WHILE * loop starts. It will be used to fix any LOOP/EXIT statements */ -static void hb_compLoopStart( void ) +static void hb_compLoopStart( HB_COMP_DECL ) { HB_LOOPEXIT_PTR pLoop = ( HB_LOOPEXIT_PTR ) hb_xgrab( sizeof( HB_LOOPEXIT ) ); - if( hb_comp_pLoops ) + if( HB_COMP_PARAM->pLoops ) { - HB_LOOPEXIT_PTR pLast = hb_comp_pLoops; + HB_LOOPEXIT_PTR pLast = HB_COMP_PARAM->pLoops; while( pLast->pNext ) pLast = pLast->pNext; pLast->pNext = pLoop; } else - hb_comp_pLoops = pLoop; + HB_COMP_PARAM->pLoops = pLoop; pLoop->pNext = NULL; pLoop->pExitList = NULL; pLoop->pLoopList = NULL; - pLoop->ulOffset = hb_comp_functions.pLast->lPCodePos; /* store the start position */ - pLoop->iLine = hb_comp_iLine; - pLoop->wSeqCounter = hb_comp_wSeqCounter; /* store current SEQUENCE counter */ + pLoop->ulOffset = HB_COMP_PARAM->functions.pLast->lPCodePos; /* store the start position */ + pLoop->wSeqCounter = HB_COMP_PARAM->wSeqCounter; /* store current SEQUENCE counter */ } /* * Stores the position of LOOP statement to fix it later at the end of loop */ -static void hb_compLoopLoop( void ) +static void hb_compLoopLoop( HB_COMP_DECL ) { - if( ! hb_comp_pLoops ) + if( ! HB_COMP_PARAM->pLoops ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_EXIT, "LOOP", NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_EXIT, "LOOP", NULL ); } else { @@ -1978,19 +1962,19 @@ static void hb_compLoopLoop( void ) pLoop = ( HB_LOOPEXIT_PTR ) hb_xgrab( sizeof( HB_LOOPEXIT ) ); pLoop->pLoopList = NULL; - pLoop->ulOffset = hb_comp_functions.pLast->lPCodePos; /* store the position to fix */ + pLoop->ulOffset = HB_COMP_PARAM->functions.pLast->lPCodePos; /* store the position to fix */ - pLast = hb_comp_pLoops; + pLast = HB_COMP_PARAM->pLoops; while( pLast->pNext ) pLast = pLast->pNext; - if( pLast->wSeqCounter != hb_comp_wSeqCounter ) + if( pLast->wSeqCounter != HB_COMP_PARAM->wSeqCounter ) { /* Attempt to LOOP from BEGIN/END sequence * Current SEQUENCE counter is different then at the beginning of loop * Notice that LOOP is allowed in RECOVER code. */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "LOOP", NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "LOOP", NULL ); } else { @@ -1999,7 +1983,7 @@ static void hb_compLoopLoop( void ) pLast->pLoopList = pLoop; - hb_compGenJump( 0 ); + hb_compGenJump( 0, HB_COMP_PARAM ); } } } @@ -2007,11 +1991,11 @@ static void hb_compLoopLoop( void ) /* * Stores the position of EXIT statement to fix it later at the end of loop */ -static void hb_compLoopExit( void ) +static void hb_compLoopExit( HB_COMP_DECL ) { - if( ! hb_comp_pLoops ) + if( ! HB_COMP_PARAM->pLoops ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_EXIT, "EXIT", NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_UNMATCHED_EXIT, "EXIT", NULL ); } else { @@ -2020,19 +2004,19 @@ static void hb_compLoopExit( void ) pLoop = ( HB_LOOPEXIT_PTR ) hb_xgrab( sizeof( HB_LOOPEXIT ) ); pLoop->pExitList = NULL; - pLoop->ulOffset = hb_comp_functions.pLast->lPCodePos; /* store the position to fix */ + pLoop->ulOffset = HB_COMP_PARAM->functions.pLast->lPCodePos; /* store the position to fix */ - pLast = hb_comp_pLoops; + pLast = HB_COMP_PARAM->pLoops; while( pLast->pNext ) pLast = pLast->pNext; - if( pLast->wSeqCounter != hb_comp_wSeqCounter ) + if( pLast->wSeqCounter != HB_COMP_PARAM->wSeqCounter ) { /* Attempt to LOOP from BEGIN/END sequence * Current SEQUENCE counter is different then at the beginning of loop * Notice that LOOP is allowed in RECOVER code. */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "EXIT", NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_EXIT_IN_SEQUENCE, "EXIT", NULL ); } else { @@ -2041,7 +2025,7 @@ static void hb_compLoopExit( void ) pLast->pExitList = pLoop; - hb_compGenJump( 0 ); + hb_compGenJump( 0, HB_COMP_PARAM ); } } } @@ -2049,9 +2033,9 @@ static void hb_compLoopExit( void ) /* * Fixes the LOOP statement */ -static void hb_compLoopHere( void ) +static void hb_compLoopHere( HB_COMP_DECL ) { - HB_LOOPEXIT_PTR pLoop = hb_comp_pLoops, pFree, pLast; + HB_LOOPEXIT_PTR pLoop = HB_COMP_PARAM->pLoops, pFree, pLast; if( pLoop ) { @@ -2062,7 +2046,7 @@ static void hb_compLoopHere( void ) pLoop = pLoop->pLoopList; while( pLoop ) { - hb_compGenJumpHere( pLoop->ulOffset + 1 ); + hb_compGenJumpHere( pLoop->ulOffset + 1, HB_COMP_PARAM ); pFree = pLoop; pLoop = pLoop->pLoopList; hb_xfree( ( void * ) pFree ); @@ -2074,9 +2058,9 @@ static void hb_compLoopHere( void ) /* * Fixes the EXIT statements and releases memory allocated for current loop */ -static void hb_compLoopEnd( void ) +static void hb_compLoopEnd( HB_COMP_DECL ) { - HB_LOOPEXIT_PTR pExit, pLoop = hb_comp_pLoops, pLast = hb_comp_pLoops, pFree; + HB_LOOPEXIT_PTR pExit, pLoop = HB_COMP_PARAM->pLoops, pLast = HB_COMP_PARAM->pLoops, pFree; if( pLoop ) { @@ -2089,39 +2073,39 @@ static void hb_compLoopEnd( void ) pExit = pLoop->pExitList; while( pExit ) { - hb_compGenJumpHere( pExit->ulOffset + 1 ); + hb_compGenJumpHere( pExit->ulOffset + 1, HB_COMP_PARAM ); pFree = pExit; pExit = pExit->pExitList; hb_xfree( ( void * ) pFree ); } pLast->pNext = NULL; - if( pLoop == hb_comp_pLoops ) - hb_comp_pLoops = NULL; + if( pLoop == HB_COMP_PARAM->pLoops ) + HB_COMP_PARAM->pLoops = NULL; hb_xfree( ( void * ) pLoop ); } } -void hb_compLoopKill( void ) +void hb_compLoopKill( HB_COMP_DECL ) { HB_LOOPEXIT_PTR pLoop; HB_LOOPEXIT_PTR pExit; - while( hb_comp_pLoops ) + while( HB_COMP_PARAM->pLoops ) { - pLoop = hb_comp_pLoops; + pLoop = HB_COMP_PARAM->pLoops; while( pLoop->pExitList ) { pExit = pLoop->pExitList; pLoop->pExitList = pExit->pExitList; hb_xfree( ( void * ) pExit ); } - hb_comp_pLoops = pLoop->pNext; + HB_COMP_PARAM->pLoops = pLoop->pNext; hb_xfree( ( void * ) pLoop ); } } -static void * hb_compElseIfGen( void * pFirst, ULONG ulOffset ) +static void * hb_compElseIfGen( HB_COMP_DECL, void * pFirst, ULONG ulOffset ) { HB_ELSEIF_PTR pElseIf = ( HB_ELSEIF_PTR ) hb_xgrab( sizeof( HB_ELSEIF ) ), pLast; @@ -2138,41 +2122,41 @@ static void * hb_compElseIfGen( void * pFirst, ULONG ulOffset ) } else { - if( hb_comp_elseif ) + if( HB_COMP_PARAM->elseif ) { - pElseIf->pPrev = hb_comp_elseif; + pElseIf->pPrev = HB_COMP_PARAM->elseif; } pFirst = pElseIf; - hb_comp_elseif = pElseIf; + HB_COMP_PARAM->elseif = pElseIf; } return pFirst; } -static void hb_compElseIfFix( void * pFixElseIfs ) +static void hb_compElseIfFix( HB_COMP_DECL, void * pFixElseIfs ) { HB_ELSEIF_PTR pFix = ( HB_ELSEIF_PTR ) pFixElseIfs; HB_ELSEIF_PTR pDel; - hb_comp_elseif = pFix->pPrev; + HB_COMP_PARAM->elseif = pFix->pPrev; while( pFix ) { - hb_compGenJumpHere( pFix->ulOffset ); + hb_compGenJumpHere( pFix->ulOffset, HB_COMP_PARAM ); pDel = pFix; pFix = pFix->pElseif; hb_xfree( pDel ); } } -void hb_compElseIfKill( void ) +void hb_compElseIfKill( HB_COMP_DECL ) { HB_ELSEIF_PTR pFix; HB_ELSEIF_PTR pDel; - while( hb_comp_elseif ) + while( HB_COMP_PARAM->elseif ) { - pFix = hb_comp_elseif; - hb_comp_elseif = pFix->pPrev; + pFix = HB_COMP_PARAM->elseif; + HB_COMP_PARAM->elseif = pFix->pPrev; while( pFix ) { pDel = pFix; @@ -2182,7 +2166,7 @@ void hb_compElseIfKill( void ) } } -static void hb_compRTVariableAdd( HB_EXPR_PTR pVar, BOOL bPopInitValue ) +static void hb_compRTVariableAdd( HB_COMP_DECL, HB_EXPR_PTR pVar, BOOL bPopInitValue ) { HB_RTVAR_PTR pRTvar = ( HB_RTVAR_PTR ) hb_xgrab( sizeof( HB_RTVAR ) ); @@ -2191,123 +2175,123 @@ static void hb_compRTVariableAdd( HB_EXPR_PTR pVar, BOOL bPopInitValue ) pRTvar->pNext = NULL; pRTvar->pPrev = NULL; - if( hb_comp_rtvars ) + if( HB_COMP_PARAM->rtvars ) { - HB_RTVAR_PTR pLast = hb_comp_rtvars; + HB_RTVAR_PTR pLast = HB_COMP_PARAM->rtvars; while( pLast->pNext ) pLast = pLast->pNext; pLast->pNext = pRTvar; pRTvar->pPrev = pLast; } else - hb_comp_rtvars = pRTvar; + HB_COMP_PARAM->rtvars = pRTvar; } -static void hb_compRTVariableGen( char * szCreateFun ) +static void hb_compRTVariableGen( HB_COMP_DECL, char * szCreateFun ) { USHORT usCount = 0; - HB_RTVAR_PTR pVar = hb_comp_rtvars; + HB_RTVAR_PTR pVar = HB_COMP_PARAM->rtvars; HB_RTVAR_PTR pDel; /* generate the function call frame */ - hb_compGenPushSymbol( szCreateFun, TRUE, FALSE ); - hb_compGenPushNil(); + hb_compGenPushSymbol( szCreateFun, TRUE, FALSE, HB_COMP_PARAM ); + hb_compGenPushNil( HB_COMP_PARAM ); /* push variable names to create */ while( pVar->pNext ) { - hb_compExprGenPush( pVar->pVar ); + hb_compExprGenPush( pVar->pVar, HB_COMP_PARAM ); pVar = pVar->pNext; ++usCount; } - hb_compExprGenPush( pVar->pVar ); + hb_compExprGenPush( pVar->pVar, HB_COMP_PARAM ); ++usCount; /* call function that will create either PUBLIC or PRIVATE variables */ if( usCount > 255 ) - hb_compGenPCode3( HB_P_DO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ), ( BOOL ) 1 ); + hb_compGenPCode3( HB_P_DO, HB_LOBYTE( usCount ), HB_HIBYTE( usCount ), HB_COMP_PARAM ); else - hb_compGenPCode2( HB_P_DOSHORT, ( BYTE ) usCount, ( BOOL ) 1 ); + hb_compGenPCode2( HB_P_DOSHORT, ( BYTE ) usCount, HB_COMP_PARAM ); /* pop initial values */ while( pVar ) { if( pVar->bPopValue ) - hb_compExprDelete( hb_compExprGenPop( pVar->pVar ) ); + hb_compExprDelete( hb_compExprGenPop( pVar->pVar, HB_COMP_PARAM ), HB_COMP_PARAM ); else - hb_compExprDelete( pVar->pVar ); + hb_compExprDelete( pVar->pVar, HB_COMP_PARAM ); pDel = pVar; pVar = pVar->pPrev; hb_xfree( pDel ); } - hb_comp_rtvars = NULL; + HB_COMP_PARAM->rtvars = NULL; } -void hb_compRTVariableKill( void ) +void hb_compRTVariableKill( HB_COMP_DECL ) { HB_RTVAR_PTR pVar; - while( hb_comp_rtvars ) + while( HB_COMP_PARAM->rtvars ) { - pVar = hb_comp_rtvars; + pVar = HB_COMP_PARAM->rtvars; - hb_compExprDelete( pVar->pVar ); - hb_comp_rtvars = pVar->pPrev; + hb_compExprDelete( pVar->pVar, HB_COMP_PARAM ); + HB_COMP_PARAM->rtvars = pVar->pPrev; hb_xfree( pVar ); } - hb_comp_rtvars = NULL; + HB_COMP_PARAM->rtvars = NULL; } -static void hb_compVariableDim( char * szName, HB_EXPR_PTR pInitValue ) +static void hb_compVariableDim( char * szName, HB_EXPR_PTR pInitValue, HB_COMP_DECL ) { - if( hb_comp_iVarScope == VS_PUBLIC || hb_comp_iVarScope == VS_PRIVATE ) + if( HB_COMP_PARAM->iVarScope == VS_PUBLIC || HB_COMP_PARAM->iVarScope == VS_PRIVATE ) { USHORT uCount = (USHORT) hb_compExprListLen( pInitValue ); - hb_compVariableAdd( szName, 'A' ); - hb_compExprDelete( hb_compExprGenPush( pInitValue ) ); - hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), ( BOOL ) 1 ); - hb_compRTVariableAdd( hb_compExprNewRTVar( szName, NULL ), TRUE ); + hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' ); + hb_compExprDelete( hb_compExprGenPush( pInitValue, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM ); + hb_compRTVariableAdd( HB_COMP_PARAM, hb_compExprNewRTVar( szName, NULL, HB_COMP_PARAM ), TRUE ); } - else if( hb_comp_iVarScope == VS_STATIC ) + else if( HB_COMP_PARAM->iVarScope == VS_STATIC ) { USHORT uCount = (USHORT) hb_compExprListLen( pInitValue ); - HB_EXPR_PTR pVar = hb_compExprNewVar( szName ); + HB_EXPR_PTR pVar = hb_compExprNewVar( szName, HB_COMP_PARAM ); HB_EXPR_PTR pAssign; /* create a static variable */ - hb_compVariableAdd( szName, 'A' ); - hb_compStaticDefStart(); /* switch to statics pcode buffer */ + hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' ); + hb_compStaticDefStart( HB_COMP_PARAM ); /* switch to statics pcode buffer */ /* create an array */ - hb_compExprGenPush( pInitValue ); - hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), ( BOOL ) 1 ); + hb_compExprGenPush( pInitValue, HB_COMP_PARAM ); + hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM ); /* check if valid initializers were used but don't generate any code */ - pAssign = hb_compExprAssignStatic( pVar, pInitValue ); + pAssign = hb_compExprAssignStatic( pVar, pInitValue, HB_COMP_PARAM ); /* now pop an array */ - hb_compExprGenPop( pVar ); + hb_compExprGenPop( pVar, HB_COMP_PARAM ); /* delete all used expressions */ - hb_compExprDelete( pAssign ); - hb_compStaticDefEnd(); + hb_compExprDelete( pAssign, HB_COMP_PARAM ); + hb_compStaticDefEnd( HB_COMP_PARAM ); } else { USHORT uCount = (USHORT) hb_compExprListLen( pInitValue ); - hb_compVariableAdd( szName, 'A' ); - hb_compExprDelete( hb_compExprGenPush( pInitValue ) ); - hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), ( BOOL ) 1 ); - hb_compExprDelete( hb_compExprGenPop( hb_compExprNewVar( szName ) ) ); + hb_compVariableAdd( HB_COMP_PARAM, szName, 'A' ); + hb_compExprDelete( hb_compExprGenPush( pInitValue, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenPCode3( HB_P_ARRAYDIM, HB_LOBYTE( uCount ), HB_HIBYTE( uCount ), HB_COMP_PARAM ); + hb_compExprDelete( hb_compExprGenPop( hb_compExprNewVar( szName, HB_COMP_PARAM ), HB_COMP_PARAM ), HB_COMP_PARAM ); } } -static void hb_compForStart( char *szVarName, BOOL bForEach ) +static void hb_compForStart( HB_COMP_DECL, char *szVarName, BOOL bForEach ) { HB_ENUMERATOR_PTR pEnumVar; - pEnumVar = hb_comp_functions.pLast->pEnum; + pEnumVar = HB_COMP_PARAM->functions.pLast->pEnum; if( pEnumVar == NULL ) { - hb_comp_functions.pLast->pEnum = (HB_ENUMERATOR_PTR) hb_xgrab( sizeof(HB_ENUMERATOR) ); - pEnumVar = hb_comp_functions.pLast->pEnum; + HB_COMP_PARAM->functions.pLast->pEnum = (HB_ENUMERATOR_PTR) hb_xgrab( sizeof(HB_ENUMERATOR) ); + pEnumVar = HB_COMP_PARAM->functions.pLast->pEnum; } else { @@ -2321,7 +2305,7 @@ static void hb_compForStart( char *szVarName, BOOL bForEach ) /* Enumerator variable exists already - throw warning */ if( bWarn == TRUE ) { - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_FORVAR_DUPL, szVarName, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_FORVAR_DUPL, szVarName, NULL ); bWarn = FALSE; } } @@ -2336,11 +2320,11 @@ static void hb_compForStart( char *szVarName, BOOL bForEach ) pEnumVar->pNext = NULL; } -BOOL hb_compForEachVarError( char *szVarName ) +BOOL hb_compForEachVarError( HB_COMP_DECL, char *szVarName ) { HB_ENUMERATOR_PTR pEnumVar; - pEnumVar = hb_comp_functions.pLast->pEnum; + pEnumVar = HB_COMP_PARAM->functions.pLast->pEnum; if( pEnumVar ) { while( pEnumVar ) @@ -2359,17 +2343,18 @@ BOOL hb_compForEachVarError( char *szVarName ) } } - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_ENUM_INVALID, szVarName, NULL ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_ENUM_INVALID, szVarName, NULL ); return TRUE; } -static void hb_compForEnd( char *szVar ) +static void hb_compForEnd( HB_COMP_DECL, char *szVar ) { HB_ENUMERATOR_PTR pEnumVar; + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); HB_SYMBOL_UNUSED( szVar ); - pEnumVar = hb_comp_functions.pLast->pEnum; + pEnumVar = HB_COMP_PARAM->functions.pLast->pEnum; if( pEnumVar->pNext ) { HB_ENUMERATOR_PTR pLast = pEnumVar; @@ -2385,7 +2370,7 @@ static void hb_compForEnd( char *szVar ) else { hb_xfree( pEnumVar ); - hb_comp_functions.pLast->pEnum = NULL; + HB_COMP_PARAM->functions.pLast->pEnum = NULL; } } @@ -2393,45 +2378,45 @@ static HB_CARGO2_FUNC( hb_compEnumEvalStart ) { char * szName = hb_compExprAsSymbol( (HB_EXPR_PTR)cargo ); if( szName ) - hb_compForStart( szName, TRUE ); + hb_compForStart( HB_COMP_PARAM, szName, TRUE ); - hb_compExprGenPush( (HB_EXPR_PTR)dummy ); /* expression */ - hb_compExprGenPush( (HB_EXPR_PTR)cargo ); /* variable */ + hb_compExprGenPush( (HB_EXPR_PTR)dummy, HB_COMP_PARAM ); /* expression */ + hb_compExprGenPush( (HB_EXPR_PTR)cargo, HB_COMP_PARAM ); /* variable */ } -static void hb_compEnumStart( HB_EXPR_PTR pVars, HB_EXPR_PTR pExprs, int descend ) +static void hb_compEnumStart( HB_COMP_DECL, HB_EXPR_PTR pVars, HB_EXPR_PTR pExprs, int descend ) { ULONG ulLen; if( hb_compExprListLen(pVars) != hb_compExprListLen(pExprs) ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_FORVAR_DIFF, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FORVAR_DIFF, NULL, NULL ); } - ulLen = hb_compExprListEval2( pVars, pExprs, hb_compEnumEvalStart ); + ulLen = hb_compExprListEval2( HB_COMP_PARAM, pVars, pExprs, hb_compEnumEvalStart ); if( ulLen > 255 ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_FORVAR_TOOMANY, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_FORVAR_TOOMANY, NULL, NULL ); } else { BYTE Len; Len = (BYTE) (ulLen & 0xFF); - hb_compGenPCode3( HB_P_ENUMSTART, Len, ((descend>0)?1:0), FALSE ); + hb_compGenPCode3( HB_P_ENUMSTART, Len, descend > 0 ? 1 : 0, HB_COMP_PARAM ); } } -static void hb_compEnumNext( HB_EXPR_PTR pExpr, int descend ) +static void hb_compEnumNext( HB_COMP_DECL, HB_EXPR_PTR pExpr, int descend ) { HB_SYMBOL_UNUSED( pExpr ); if( descend > 0 ) { - hb_compGenPCode1( HB_P_ENUMNEXT ); + hb_compGenPCode1( HB_P_ENUMNEXT, HB_COMP_PARAM ); } else { - hb_compGenPCode1( HB_P_ENUMPREV ); + hb_compGenPCode1( HB_P_ENUMPREV, HB_COMP_PARAM ); } } @@ -2440,29 +2425,29 @@ static HB_CARGO_FUNC( hb_compEnumEvalEnd ) char * szName = hb_compExprAsSymbol( (HB_EXPR_PTR)cargo ); if( szName ) - hb_compForEnd( szName ); + hb_compForEnd( HB_COMP_PARAM, szName ); } -static void hb_compEnumEnd( HB_EXPR_PTR pExpr ) +static void hb_compEnumEnd( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - hb_compExprListEval( pExpr, hb_compEnumEvalEnd ); - hb_compGenPCode1( HB_P_ENUMEND ); + hb_compExprListEval( HB_COMP_PARAM, pExpr, hb_compEnumEvalEnd ); + hb_compGenPCode1( HB_P_ENUMEND, HB_COMP_PARAM ); } -static void hb_compSwitchStart() +static void hb_compSwitchStart( HB_COMP_DECL ) { - HB_SWITCHCMD_PTR pLast = hb_comp_pSwitch; + HB_SWITCHCMD_PTR pSwitch = (HB_SWITCHCMD_PTR) hb_xgrab( sizeof(HB_SWITCHCMD) ); - hb_comp_pSwitch = (HB_SWITCHCMD_PTR) hb_xgrab( sizeof(HB_SWITCHCMD) ); - hb_comp_pSwitch->pPrev = pLast; - hb_comp_pSwitch->pCases = NULL; - hb_comp_pSwitch->pLast = NULL; - hb_comp_pSwitch->ulDefault = 0; - hb_comp_pSwitch->ulOffset = hb_comp_functions.pLast->lPCodePos; - hb_comp_pSwitch->iCount = 0; + pSwitch->pCases = NULL; + pSwitch->pLast = NULL; + pSwitch->ulDefault = 0; + pSwitch->ulOffset = HB_COMP_PARAM->functions.pLast->lPCodePos; + pSwitch->iCount = 0; + pSwitch->pPrev = HB_COMP_PARAM->pSwitch; + HB_COMP_PARAM->pSwitch = pSwitch; } -static void hb_compSwitchAdd( HB_EXPR_PTR pExpr ) +static void hb_compSwitchAdd( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { HB_SWITCHCASE_PTR pCase; @@ -2470,52 +2455,52 @@ static void hb_compSwitchAdd( HB_EXPR_PTR pExpr ) { /* normal CASE */ pCase = (HB_SWITCHCASE_PTR) hb_xgrab( sizeof(HB_SWITCHCASE) ); - pCase->ulOffset = hb_comp_functions.pLast->lPCodePos; + pCase->ulOffset = HB_COMP_PARAM->functions.pLast->lPCodePos; pCase->pNext = NULL; - pExpr = hb_compExprReduce( pExpr ); + pExpr = hb_compExprReduce( pExpr, HB_COMP_PARAM ); if( !(hb_compExprIsLong(pExpr) || hb_compExprIsString(pExpr)) ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_NOT_LITERAL_CASE, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_NOT_LITERAL_CASE, NULL, NULL ); } pCase->pExpr = pExpr; - if( hb_comp_pSwitch->pLast ) + if( HB_COMP_PARAM->pSwitch->pLast ) { - hb_comp_pSwitch->pLast->pNext = pCase; - hb_comp_pSwitch->pLast = pCase; + HB_COMP_PARAM->pSwitch->pLast->pNext = pCase; + HB_COMP_PARAM->pSwitch->pLast = pCase; } else { - hb_comp_pSwitch->pCases = hb_comp_pSwitch->pLast = pCase; + HB_COMP_PARAM->pSwitch->pCases = HB_COMP_PARAM->pSwitch->pLast = pCase; } - hb_comp_pSwitch->iCount++; + HB_COMP_PARAM->pSwitch->iCount++; if( hb_compExprIsString( pExpr ) && hb_compExprAsStringLen(pExpr) > 255 ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_STR, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_STR, NULL, NULL ); } } else { /* DEFAULT */ - if( hb_comp_pSwitch->ulDefault ) + if( HB_COMP_PARAM->pSwitch->ulDefault ) { /* more than one default clause */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_MAYHEM_IN_CASE, NULL, NULL ); } else { - hb_comp_pSwitch->ulDefault = hb_comp_functions.pLast->lPCodePos; - hb_comp_pSwitch->iCount++; + HB_COMP_PARAM->pSwitch->ulDefault = HB_COMP_PARAM->functions.pLast->lPCodePos; + HB_COMP_PARAM->pSwitch->iCount++; } } } -static void hb_compSwitchEnd( void ) +static void hb_compSwitchEnd( HB_COMP_DECL ) { - BOOL longOptimize = hb_comp_long_optimize; - BOOL bTextSubst = hb_comp_bTextSubst; - HB_SWITCHCASE_PTR pCase = hb_comp_pSwitch->pCases; + BOOL fLongOptimize = HB_COMP_PARAM->fLongOptimize; + BOOL fTextSubst = HB_COMP_PARAM->fTextSubst; + HB_SWITCHCASE_PTR pCase = HB_COMP_PARAM->pSwitch->pCases; HB_SWITCHCASE_PTR pTmp; HB_SWITCHCMD_PTR pTmpSw; ULONG ulExitPos; @@ -2524,94 +2509,94 @@ static void hb_compSwitchEnd( void ) /* skip switch pcode if there was no EXIT in the last CASE * or in the DEFAULT case */ - ulExitPos = hb_compGenJump( 0 ); + ulExitPos = hb_compGenJump( 0, HB_COMP_PARAM ); - hb_compGenJumpHere( hb_comp_pSwitch->ulOffset + 1 ); - hb_compGenPCode3( HB_P_SWITCH, HB_LOBYTE(hb_comp_pSwitch->iCount), HB_HIBYTE(hb_comp_pSwitch->iCount), FALSE ); - hb_comp_long_optimize = FALSE; - hb_comp_bTextSubst = FALSE; + hb_compGenJumpHere( HB_COMP_PARAM->pSwitch->ulOffset + 1, HB_COMP_PARAM ); + hb_compGenPCode3( HB_P_SWITCH, HB_LOBYTE(HB_COMP_PARAM->pSwitch->iCount), HB_HIBYTE(HB_COMP_PARAM->pSwitch->iCount), HB_COMP_PARAM ); + HB_COMP_PARAM->fLongOptimize = FALSE; + HB_COMP_PARAM->fTextSubst = FALSE; while( pCase ) { if( pCase->pExpr ) { if( hb_compExprIsLong(pCase->pExpr) || hb_compExprIsString(pCase->pExpr) ) { - hb_compExprDelete( hb_compExprGenPush( pCase->pExpr ) ); - hb_compGenJumpThere( hb_compGenJump( 0 ), pCase->ulOffset ); + hb_compExprDelete( hb_compExprGenPush( pCase->pExpr, HB_COMP_PARAM ), HB_COMP_PARAM ); + hb_compGenJumpThere( hb_compGenJump( 0, HB_COMP_PARAM ), pCase->ulOffset, HB_COMP_PARAM ); } else { - hb_compExprDelete( pCase->pExpr ); + hb_compExprDelete( pCase->pExpr, HB_COMP_PARAM ); } } pCase = pCase->pNext; } - hb_compGenPData1( HB_P_PUSHNIL ); /* end of cases */ - ulDef = hb_compGenJump( 0 ); + hb_compGenPData1( HB_P_PUSHNIL, HB_COMP_PARAM ); /* end of cases */ + ulDef = hb_compGenJump( 0, HB_COMP_PARAM ); - if( hb_comp_pSwitch->ulDefault ) + if( HB_COMP_PARAM->pSwitch->ulDefault ) { - hb_compGenJumpThere( ulDef, hb_comp_pSwitch->ulDefault ); + hb_compGenJumpThere( ulDef, HB_COMP_PARAM->pSwitch->ulDefault, HB_COMP_PARAM ); } else - hb_compGenJumpHere( ulDef ); + hb_compGenJumpHere( ulDef, HB_COMP_PARAM ); - hb_comp_long_optimize = longOptimize; - hb_comp_bTextSubst = bTextSubst; + HB_COMP_PARAM->fLongOptimize = fLongOptimize; + HB_COMP_PARAM->fTextSubst = fTextSubst; - hb_compGenJumpHere( ulExitPos ); + hb_compGenJumpHere( ulExitPos, HB_COMP_PARAM ); - pCase = hb_comp_pSwitch->pCases; + pCase = HB_COMP_PARAM->pSwitch->pCases; while( pCase ) { pTmp = pCase->pNext; hb_xfree( (void *)pCase ); pCase = pTmp; } - pTmpSw = hb_comp_pSwitch; - hb_comp_pSwitch = hb_comp_pSwitch->pPrev; + pTmpSw = HB_COMP_PARAM->pSwitch; + HB_COMP_PARAM->pSwitch = HB_COMP_PARAM->pSwitch->pPrev; hb_xfree( pTmpSw ); } /* Release all switch statements */ -void hb_compSwitchKill( ) +void hb_compSwitchKill( HB_COMP_DECL ) { HB_SWITCHCASE_PTR pCase; HB_SWITCHCMD_PTR pSwitch; - while( hb_comp_pSwitch ) + while( HB_COMP_PARAM->pSwitch ) { - while( hb_comp_pSwitch->pCases ) + while( HB_COMP_PARAM->pSwitch->pCases ) { - pCase = hb_comp_pSwitch->pCases; - hb_compExprDelete( pCase->pExpr ); - hb_comp_pSwitch->pCases = pCase->pNext; + pCase = HB_COMP_PARAM->pSwitch->pCases; + hb_compExprDelete( pCase->pExpr, HB_COMP_PARAM ); + HB_COMP_PARAM->pSwitch->pCases = pCase->pNext; hb_xfree( (void *) pCase ); } - pSwitch = hb_comp_pSwitch; - hb_comp_pSwitch = pSwitch->pPrev; + pSwitch = HB_COMP_PARAM->pSwitch; + HB_COMP_PARAM->pSwitch = pSwitch->pPrev; hb_xfree( (void *) pSwitch ); } } -static HB_EXPR_PTR hb_compCheckPassByRef( HB_EXPR_PTR pExpr ) +static HB_EXPR_PTR hb_compCheckPassByRef( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - if( !( hb_comp_bPassByRef & (HB_PASSBYREF_FUNCALL | HB_PASSBYREF_ARRAY) ) ) + if( !( HB_COMP_PARAM->iPassByRef & (HB_PASSBYREF_FUNCALL | HB_PASSBYREF_ARRAY) ) ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, hb_compExprAsSymbol( pExpr ), NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, hb_compExprAsSymbol( pExpr ), NULL ); } return pExpr; } /* ************************************************************************* */ -void yyerror( HB_COMP_PTR pComp, char * s ) +void yyerror( HB_COMP_DECL, char * s ) { HB_SYMBOL_UNUSED( pComp ); - if( !pComp->pLex->lasttok || pComp->pLex->lasttok[ 0 ] == '\n' ) - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_YACC, s, "" ); + if( !HB_COMP_PARAM->pLex->lasttok || HB_COMP_PARAM->pLex->lasttok[ 0 ] == '\n' ) + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_YACC, s, "" ); else - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_YACC, s, pComp->pLex->lasttok ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_YACC, s, HB_COMP_PARAM->pLex->lasttok ); } diff --git a/harbour/source/compiler/hbcomp.c b/harbour/source/compiler/hbcomp.c index f6ae0cec0b..731a9cbb7f 100644 --- a/harbour/source/compiler/hbcomp.c +++ b/harbour/source/compiler/hbcomp.c @@ -64,8 +64,46 @@ HB_COMP_PTR hb_comp_new( void ) memset( pComp, 0, sizeof( HB_COMP ) ); pComp->pLex = ( PHB_COMP_LEX ) hb_xgrab( sizeof( HB_COMP_LEX ) ); memset( pComp->pLex, 0, sizeof( HB_COMP_LEX ) ); + + /* initialize default settings */ + pComp->pLex->pPP = pPP; + + /* various compatibility flags (-k switch) + activate Harbour extensions by default. */ + pComp->supported = HB_COMPFLAG_HARBOUR | + HB_COMPFLAG_XBASE | + HB_COMPFLAG_HB_INLINE | + HB_COMPFLAG_OPTJUMP | + HB_COMPFLAG_SHORTCUTS; + + pComp->fTextSubst = pComp->fLongOptimize = TRUE; + + pComp->fPPO = FALSE; /* flag indicating, is ppo output needed */ + pComp->fStartProc = TRUE; /* holds if we need to create the starting procedure */ + pComp->fLineNumbers = TRUE; /* holds if we need pcodes with line numbers */ + pComp->fAnyWarning = FALSE; /* holds if there was any warning during the compilation process */ + pComp->fAutoMemvarAssume= FALSE; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ + pComp->fForceMemvars = FALSE; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ + pComp->fDebugInfo = FALSE; /* holds if generate debugger required info */ + pComp->fNoStartUp = FALSE; /* C code generation embed HB_FS_FIRST or not */ + pComp->fDontGenLineNum = FALSE; /* suppress line number generation */ + pComp->fCredits = FALSE; /* print credits */ + pComp->fBuildInfo = FALSE; /* print build info */ + pComp->fLogo = TRUE; /* print logo */ + pComp->fSyntaxCheckOnly = FALSE; /* syntax check only */ + pComp->fAutoOpen = TRUE; + pComp->fError = FALSE; + /* EXTERNAL statement can be placed into any place in a function - this flag is + used to suppress error report generation */ + pComp->fExternal = FALSE; + + pComp->iWarnings = 0; /* enable parse warnings */ + pComp->iGenCOutput= HB_COMPGENC_VERBOSE; /* C code generation should be verbose (use comments) or not */ + pComp->iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */ + pComp->iLanguage = LANG_C; /* default Harbour generated output language */ } + return pComp; } @@ -77,5 +115,7 @@ void hb_comp_free( HB_COMP_PTR pComp ) hb_pp_free( pComp->pLex->pPP ); hb_xfree( pComp->pLex ); } + if( pComp->szStdCh ) + hb_xfree( pComp->szStdCh ); hb_xfree( pComp ); } diff --git a/harbour/source/compiler/hbdead.c b/harbour/source/compiler/hbdead.c index f644e17684..9301352d28 100644 --- a/harbour/source/compiler/hbdead.c +++ b/harbour/source/compiler/hbdead.c @@ -462,11 +462,11 @@ static PHB_CODETRACE_FUNC s_codeTraceFuncTable[ HB_P_LAST_PCODE ] = hb_p_default /* HB_P_VFRAME */ }; -void hb_compCodeTraceMarkDead( PFUNCTION pFunc ) +void hb_compCodeTraceMarkDead( HB_COMP_DECL, PFUNCTION pFunc ) { HB_CODETRACE_INFO code_info; - if( ! HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) || pFunc->lPCodePos < 2 ) + if( ! HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) || pFunc->lPCodePos < 2 ) return; assert( HB_P_LAST_PCODE == sizeof( s_codeTraceFuncTable ) / sizeof( PHB_CODETRACE_FUNC ) ); diff --git a/harbour/source/compiler/hbfix.c b/harbour/source/compiler/hbfix.c index 52065c637c..acc551fbbc 100644 --- a/harbour/source/compiler/hbfix.c +++ b/harbour/source/compiler/hbfix.c @@ -57,6 +57,7 @@ /* helper structure to pass information */ typedef struct HB_stru_fix_info { + HB_COMP_DECL; USHORT iNestedCodeblock; } HB_FIX_INFO, * HB_FIX_INFO_PTR; @@ -122,13 +123,15 @@ static HB_FIX_FUNC( hb_p_poplocal ) */ if( cargo->iNestedCodeblock == 0 ) { + HB_COMP_DECL = cargo->HB_COMP_PARAM; + BYTE * pVar = &pFunc->pCode[ lPCodePos + 1 ]; SHORT iVar = HB_PCODE_MKSHORT( pVar ); iVar += pFunc->wParamCount; pVar[ 0 ] = HB_LOBYTE( iVar ); pVar[ 1 ] = HB_HIBYTE( iVar ); - if( HB_LIM_INT8( iVar ) && HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) + if( HB_LIM_INT8( iVar ) && HB_COMP_ISSUPPORTED( HB_COMPFLAG_OPTJUMP ) ) { pFunc->pCode[ lPCodePos ] = HB_P_POPLOCALNEAR; hb_compNOOPfill( pFunc, lPCodePos + 2, 1, FALSE, FALSE ); @@ -144,6 +147,7 @@ static HB_FIX_FUNC( hb_p_pushlocal ) */ if( cargo->iNestedCodeblock == 0 ) { + HB_COMP_DECL = cargo->HB_COMP_PARAM; BYTE * pVar = &pFunc->pCode[ lPCodePos + 1 ]; SHORT iVar = HB_PCODE_MKSHORT( pVar ); @@ -199,7 +203,7 @@ static HB_FIX_FUNC( hb_p_poplocalnear ) sprintf( sTemp, "%i", pFunc->wParamCount ); sprintf( sTemp2, "%i", iVar ); - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_OPTIMIZEDLOCAL_OUT_OF_RANGE, sTemp2, sTemp ); + hb_compGenError( cargo->HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_OPTIMIZEDLOCAL_OUT_OF_RANGE, sTemp2, sTemp ); } } @@ -228,7 +232,7 @@ static HB_FIX_FUNC( hb_p_pushlocalnear ) sprintf( sTemp, "%i", pFunc->wParamCount ); sprintf( sTemp2, "%i", iVar ); - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_OPTIMIZEDLOCAL_OUT_OF_RANGE, sTemp2, sTemp ); + hb_compGenError( cargo->HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_OPTIMIZEDLOCAL_OUT_OF_RANGE, sTemp2, sTemp ); } } @@ -256,7 +260,7 @@ static HB_FIX_FUNC( hb_p_localnearaddint ) sprintf( sTemp, "%i", pFunc->wParamCount ); sprintf( sTemp2, "%i", uiVar ); - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_OPTIMIZEDLOCAL_OUT_OF_RANGE, sTemp2, sTemp ); + hb_compGenError( cargo->HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_OPTIMIZEDLOCAL_OUT_OF_RANGE, sTemp2, sTemp ); } } @@ -276,7 +280,7 @@ static HB_FIX_FUNC( hb_p_false ) case HB_P_JUMPTRUENEAR: case HB_P_JUMPTRUE: case HB_P_JUMPTRUEFAR: - if( ! hb_compIsJump( pFunc, lPCodePos + 1 ) ) + if( ! hb_compIsJump( cargo->HB_COMP_PARAM, pFunc, lPCodePos + 1 ) ) { int iCount = 1; @@ -326,7 +330,7 @@ static HB_FIX_FUNC( hb_p_true ) case HB_P_JUMPFALSENEAR: case HB_P_JUMPFALSE: case HB_P_JUMPFALSEFAR: - if( ! hb_compIsJump( pFunc, lPCodePos + 1 ) ) + if( ! hb_compIsJump( cargo->HB_COMP_PARAM, pFunc, lPCodePos + 1 ) ) { int iCount = 1; @@ -396,7 +400,8 @@ static HB_FIX_FUNC( hb_p_not ) break; } - if( opcode < HB_P_LAST_PCODE && ! hb_compIsJump( pFunc, lPCodePos + 1 ) ) + if( opcode < HB_P_LAST_PCODE && + ! hb_compIsJump( cargo->HB_COMP_PARAM, pFunc, lPCodePos + 1 ) ) { hb_compNOOPfill( pFunc, lPCodePos, 1, FALSE, FALSE ); if( opcode == HB_P_NOOP ) @@ -410,6 +415,8 @@ static HB_FIX_FUNC( hb_p_not ) static HB_FIX_FUNC( hb_p_jumpfar ) { + HB_COMP_DECL = cargo->HB_COMP_PARAM; + if( cargo->iNestedCodeblock == 0 && HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) { BYTE * pAddr = &pFunc->pCode[ lPCodePos + 1 ]; @@ -447,6 +454,8 @@ static HB_FIX_FUNC( hb_p_jumpfar ) static HB_FIX_FUNC( hb_p_jumpfalsefar ) { + HB_COMP_DECL = cargo->HB_COMP_PARAM; + if( cargo->iNestedCodeblock == 0 && HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) { BYTE * pAddr = &pFunc->pCode[ lPCodePos + 1 ]; @@ -466,6 +475,8 @@ static HB_FIX_FUNC( hb_p_jumpfalsefar ) static HB_FIX_FUNC( hb_p_jumptruefar ) { + HB_COMP_DECL = cargo->HB_COMP_PARAM; + if( cargo->iNestedCodeblock == 0 && HB_COMP_ISSUPPORTED(HB_COMPFLAG_OPTJUMP) ) { BYTE * pAddr = &pFunc->pCode[ lPCodePos + 1 ]; @@ -642,11 +653,12 @@ static HB_FIX_FUNC_PTR s_fixlocals_table[] = NULL /* HB_P_VFRAME */ }; -void hb_compFixFuncPCode( PFUNCTION pFunc ) +void hb_compFixFuncPCode( HB_COMP_DECL, PFUNCTION pFunc ) { HB_FIX_INFO fix_info; fix_info.iNestedCodeblock = 0; + fix_info.HB_COMP_PARAM = HB_COMP_PARAM; assert( HB_P_LAST_PCODE == sizeof( s_fixlocals_table ) / sizeof( HB_FIX_FUNC_PTR ) ); diff --git a/harbour/source/compiler/hbfunchk.c b/harbour/source/compiler/hbfunchk.c index d455365839..1bd5a57123 100644 --- a/harbour/source/compiler/hbfunchk.c +++ b/harbour/source/compiler/hbfunchk.c @@ -115,7 +115,7 @@ static HB_FUNCINFO hb_StdFunc[] = { 0 , 0, 0 } }; -BOOL hb_compFunCallCheck( char * szFuncCall, int iArgs ) +BOOL hb_compFunCallCheck( HB_COMP_DECL, char * szFuncCall, int iArgs ) { HB_FUNCINFO * f = hb_StdFunc; int i = 0; @@ -151,13 +151,13 @@ BOOL hb_compFunCallCheck( char * szFuncCall, int iArgs ) else sprintf( szMsg, "\nPassed: %i, expected: %i - %i", iArgs, f[ iPos ].iMinParam, f[ iPos ].iMaxParam ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CHECKING_ARGS, szFuncCall, szMsg ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CHECKING_ARGS, szFuncCall, szMsg ); return FALSE; } else { /* Clipper way */ - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_CHECKING_ARGS, szFuncCall, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CHECKING_ARGS, szFuncCall, NULL ); return FALSE; } } diff --git a/harbour/source/compiler/hbgenerr.c b/harbour/source/compiler/hbgenerr.c index 6d95cf21c4..974e3a2321 100644 --- a/harbour/source/compiler/hbgenerr.c +++ b/harbour/source/compiler/hbgenerr.c @@ -28,8 +28,6 @@ #include "hbcomp.h" -extern char *yytext; - /* Table with parse errors */ char * hb_comp_szErrors[] = { @@ -135,12 +133,12 @@ char * hb_comp_szWarnings[] = "0Invalid variable \'%s\' for enumerator message" }; -void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) +void hb_compGenError( HB_COMP_DECL, char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) { - int iLine = hb_pp_line( hb_comp_data->pLex->pPP ); - char * szFile = hb_pp_fileName( hb_comp_data->pLex->pPP ); + int iLine = hb_pp_line( HB_COMP_PARAM->pLex->pPP ); + char * szFile = hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ); - if( cPrefix != 'F' && hb_comp_bError ) + if( cPrefix != 'F' && HB_COMP_PARAM->fError ) return; if( szFile ) @@ -150,8 +148,8 @@ void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * fprintf( hb_comp_errFile, szErrors[ iError - 1 ], szError1, szError2 ); fprintf( hb_comp_errFile, "\n" ); - hb_comp_iErrorCount++; - hb_comp_bError = TRUE; + HB_COMP_PARAM->iErrorCount++; + HB_COMP_PARAM->fError = TRUE; /* fatal error - exit immediately */ if( cPrefix == 'F' ) @@ -161,14 +159,14 @@ void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * } } -void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2) +void hb_compGenWarning( HB_COMP_DECL, char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2) { char * szText = szWarnings[ iWarning - 1 ]; - int iLine = hb_pp_line( hb_comp_data->pLex->pPP ); + int iLine = hb_pp_line( HB_COMP_PARAM->pLex->pPP ); - if( ( szText[ 0 ] - '0' ) <= hb_comp_iWarnings ) + if( ( szText[ 0 ] - '0' ) <= HB_COMP_PARAM->iWarnings ) { - char * szFile = hb_pp_fileName( hb_comp_data->pLex->pPP ); + char * szFile = hb_pp_fileName( HB_COMP_PARAM->pLex->pPP ); if( szFile ) fprintf( hb_comp_errFile, "\r%s(%i) ", szFile, iLine ); @@ -176,85 +174,85 @@ void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const c fprintf( hb_comp_errFile, szText + 1, szWarning1, szWarning2 ); fprintf( hb_comp_errFile, "\n" ); - hb_comp_bAnyWarning = TRUE; /* report warnings at exit */ + HB_COMP_PARAM->fAnyWarning = TRUE; /* report warnings at exit */ } } -HB_EXPR_PTR hb_compErrorLValue( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorLValue( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_LVALUE, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_LVALUE, szDesc, NULL ); return pExpr; } -HB_EXPR_PTR hb_compErrorType( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorType( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_TYPE, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_TYPE, szDesc, NULL ); return pExpr; } -HB_EXPR_PTR hb_compErrorIndex( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorIndex( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_INDEX, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_INDEX, szDesc, NULL ); return pExpr; } -HB_EXPR_PTR hb_compErrorBound( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorBound( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_BOUND, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_BOUND, szDesc, NULL ); return pExpr; } -HB_EXPR_PTR hb_compErrorSyntax( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorSyntax( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_SYNTAX, szDesc, NULL ); return pExpr; } -HB_EXPR_PTR hb_compErrorAlias( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorAlias( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_ALIAS, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_ALIAS, szDesc, NULL ); return pExpr; } -HB_EXPR_PTR hb_compErrorStatic( char * szVarName, HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compErrorStatic( HB_COMP_DECL, const char * szVarName, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_ILLEGAL_INIT, szVarName, szDesc ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_ILLEGAL_INIT, szVarName, szDesc ); return pExpr; } -void hb_compErrorDuplVar( char * szVarName ) +void hb_compErrorDuplVar( HB_COMP_DECL, const char * szVarName ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_VAR_DUPL, szVarName, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_VAR_DUPL, szVarName, NULL ); } -HB_EXPR_PTR hb_compWarnMeaningless( HB_EXPR_PTR pExpr ) +HB_EXPR_PTR hb_compWarnMeaningless( HB_COMP_DECL, HB_EXPR_PTR pExpr ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenWarning( hb_comp_szWarnings, 'W', HB_COMP_WARN_MEANINGLESS, szDesc, NULL ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenWarning( HB_COMP_PARAM, hb_comp_szWarnings, 'W', HB_COMP_WARN_MEANINGLESS, szDesc, NULL ); return pExpr; } -void hb_compErrorCodeblock( char * szBlock ) +void hb_compErrorCodeblock( HB_COMP_DECL, const char * szBlock ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BLOCK, szBlock, NULL ); - hb_comp_bError = FALSE; /* clear error flag for this line */ + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BLOCK, szBlock, NULL ); + HB_COMP_PARAM->fError = FALSE; /* clear error flag for this line */ } -void hb_compErrorMacro( char *szText ) +void hb_compErrorMacro( HB_COMP_DECL, const char *szText ) { - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szText, NULL ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_BAD_MACRO, szText, NULL ); } -HB_EXPR_PTR hb_compErrorRefer( HB_EXPR_PTR pExpr, char *szAlias ) +HB_EXPR_PTR hb_compErrorRefer( HB_COMP_DECL, HB_EXPR_PTR pExpr, const char *szAlias ) { - char * szDesc = hb_compExprDescription( pExpr ); - hb_compGenError( hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, szAlias, szDesc ); + const char * szDesc = hb_compExprDescription( pExpr ); + hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_INVALID_REFER, szAlias, szDesc ); return pExpr; } diff --git a/harbour/source/compiler/hbident.c b/harbour/source/compiler/hbident.c index 52517554d9..52e45b434f 100644 --- a/harbour/source/compiler/hbident.c +++ b/harbour/source/compiler/hbident.c @@ -33,16 +33,14 @@ #define HB_IDENT_TABLE_SIZE 509UL -/* table of identifiers for reuse */ -static HB_HASH_TABLE_PTR s_comp_Identifiers = NULL; - /* create a new identifier or return the existing one */ -char * hb_compIdentifierNew( char * szName, BOOL bCopy ) +char * hb_compIdentifierNew( HB_COMP_DECL, char * szName, BOOL bCopy ) { char * szIdent; - szIdent = ( char * )hb_hashTableFind( s_comp_Identifiers, (void *) szName ); + szIdent = ( char * ) hb_hashTableFind( HB_COMP_PARAM->pIdentifiers, + ( void * ) szName ); if( !szIdent ) { if( bCopy ) @@ -50,7 +48,8 @@ char * hb_compIdentifierNew( char * szName, BOOL bCopy ) else szIdent = szName; - hb_hashTableAdd( s_comp_Identifiers, (void *)szIdent, (void *)szIdent ); + hb_hashTableAdd( HB_COMP_PARAM->pIdentifiers, + ( void * ) szIdent, ( void * ) szIdent ); } else if( !bCopy ) hb_xfree( szName ); @@ -90,18 +89,18 @@ static HB_HASH_FUNC( hb_comp_IdentComp ) } /* initialize the hash table for identifiers */ -void hb_compIdentifierOpen( ) +void hb_compIdentifierOpen( HB_COMP_DECL ) { - s_comp_Identifiers = hb_hashTableCreate( HB_IDENT_TABLE_SIZE, hb_comp_IdentKey, - hb_comp_IdentDel, hb_comp_IdentComp ); + HB_COMP_PARAM->pIdentifiers = hb_hashTableCreate( HB_IDENT_TABLE_SIZE, + hb_comp_IdentKey, hb_comp_IdentDel, hb_comp_IdentComp ); } /* release identifiers table */ -void hb_compIdentifierClose( ) +void hb_compIdentifierClose( HB_COMP_DECL ) { - if( s_comp_Identifiers ) + if( HB_COMP_PARAM->pIdentifiers ) { - hb_hashTableKill( s_comp_Identifiers ); - s_comp_Identifiers = NULL; + hb_hashTableKill( HB_COMP_PARAM->pIdentifiers ); + HB_COMP_PARAM->pIdentifiers = NULL; } } diff --git a/harbour/source/compiler/hbpcode.c b/harbour/source/compiler/hbpcode.c index 36f38c93f5..9271f58b19 100644 --- a/harbour/source/compiler/hbpcode.c +++ b/harbour/source/compiler/hbpcode.c @@ -525,30 +525,9 @@ void hb_compPCodeTrace( PFUNCTION pFunc, HB_PCODE_FUNC_PTR * pFunctions, void * } } -void hb_compGenPCode1( BYTE byte ) +void hb_compGenPCode1( BYTE byte, HB_COMP_DECL ) { - PFUNCTION pFunc = hb_comp_functions.pLast; /* get the currently defined Clipper function */ - - if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ - { - pFunc->pCode = ( BYTE * ) hb_xgrab( HB_PCODE_CHUNK ); - pFunc->lPCodeSize = HB_PCODE_CHUNK; - pFunc->lPCodePos = 0; - } - else if( ( pFunc->lPCodeSize - pFunc->lPCodePos ) < 1 ) - pFunc->pCode = ( BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize += HB_PCODE_CHUNK ); - - pFunc->pCode[ pFunc->lPCodePos++ ] = byte; - -#if defined(HB_COMP_STRONG_TYPES) - if( hb_comp_iWarnings >= 3 ) - hb_compStrongType( 1 ); -#endif -} - -void hb_compGenPData1( BYTE byte ) -{ - PFUNCTION pFunc = hb_comp_functions.pLast; /* get the currently defined Clipper function */ + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; /* get the currently defined Clipper function */ if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ { @@ -562,9 +541,25 @@ void hb_compGenPData1( BYTE byte ) pFunc->pCode[ pFunc->lPCodePos++ ] = byte; } -void hb_compGenPCode2( BYTE byte1, BYTE byte2, BOOL bStackAffected ) +void hb_compGenPData1( BYTE byte, HB_COMP_DECL ) { - PFUNCTION pFunc = hb_comp_functions.pLast; /* get the currently defined Clipper function */ + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; /* get the currently defined Clipper function */ + + if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ + { + pFunc->pCode = ( BYTE * ) hb_xgrab( HB_PCODE_CHUNK ); + pFunc->lPCodeSize = HB_PCODE_CHUNK; + pFunc->lPCodePos = 0; + } + else if( ( pFunc->lPCodeSize - pFunc->lPCodePos ) < 1 ) + pFunc->pCode = ( BYTE * ) hb_xrealloc( pFunc->pCode, pFunc->lPCodeSize += HB_PCODE_CHUNK ); + + pFunc->pCode[ pFunc->lPCodePos++ ] = byte; +} + +void hb_compGenPCode2( BYTE byte1, BYTE byte2, HB_COMP_DECL ) +{ + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; /* get the currently defined Clipper function */ if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ { @@ -577,18 +572,11 @@ void hb_compGenPCode2( BYTE byte1, BYTE byte2, BOOL bStackAffected ) pFunc->pCode[ pFunc->lPCodePos++ ] = byte1; pFunc->pCode[ pFunc->lPCodePos++ ] = byte2; - -#if defined(HB_COMP_STRONG_TYPES) - if( hb_comp_iWarnings >= 3 && bStackAffected ) - hb_compStrongType( 2 ); -#else - HB_SYMBOL_UNUSED( bStackAffected ); -#endif } -void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, BOOL bStackAffected ) +void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, HB_COMP_DECL ) { - PFUNCTION pFunc = hb_comp_functions.pLast; /* get the currently defined Clipper function */ + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; /* get the currently defined Clipper function */ if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ { @@ -602,18 +590,11 @@ void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, BOOL bStackAffected ) pFunc->pCode[ pFunc->lPCodePos++ ] = byte1; pFunc->pCode[ pFunc->lPCodePos++ ] = byte2; pFunc->pCode[ pFunc->lPCodePos++ ] = byte3; - -#if defined(HB_COMP_STRONG_TYPES) - if( hb_comp_iWarnings >= 3 && bStackAffected ) - hb_compStrongType( 3 ); -#else - HB_SYMBOL_UNUSED( bStackAffected ); -#endif } -void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, BOOL bStackAffected ) +void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, HB_COMP_DECL ) { - PFUNCTION pFunc = hb_comp_functions.pLast; /* get the currently defined Clipper function */ + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; /* get the currently defined Clipper function */ if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ { @@ -628,18 +609,11 @@ void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, BOOL bSta pFunc->pCode[ pFunc->lPCodePos++ ] = byte2; pFunc->pCode[ pFunc->lPCodePos++ ] = byte3; pFunc->pCode[ pFunc->lPCodePos++ ] = byte4; - -#if defined(HB_COMP_STRONG_TYPES) - if( hb_comp_iWarnings >= 3 && bStackAffected ) - hb_compStrongType( 4 ); -#else - HB_SYMBOL_UNUSED( bStackAffected ); -#endif } -void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, BOOL bStackAffected ) +void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_COMP_DECL ) { - PFUNCTION pFunc = hb_comp_functions.pLast; /* get the currently defined Clipper function */ + PFUNCTION pFunc = HB_COMP_PARAM->functions.pLast; /* get the currently defined Clipper function */ if( ! pFunc->pCode ) /* has been created the memory block to hold the pcode ? */ { @@ -656,11 +630,4 @@ void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, BOOL bStackAffected ) memcpy( pFunc->pCode + pFunc->lPCodePos, pBuffer, ulSize ); pFunc->lPCodePos += ulSize; - -#if defined(HB_COMP_STRONG_TYPES) - if( hb_comp_iWarnings >= 3 && bStackAffected ) - hb_compStrongType( ulSize ); -#else - HB_SYMBOL_UNUSED( bStackAffected ); -#endif } diff --git a/harbour/source/compiler/ppcomp.c b/harbour/source/compiler/ppcomp.c index 6d9e5250fb..642213e48b 100644 --- a/harbour/source/compiler/ppcomp.c +++ b/harbour/source/compiler/ppcomp.c @@ -30,30 +30,16 @@ #include "hbcomp.h" #include -BOOL hb_pp_NestedLiteralString = FALSE; -BOOL hb_pp_LiteralEscSeq = FALSE; -int hb_pp_StreamBlock = 0; -unsigned int hb_pp_MaxTranslateCycles = 1024; -char *hb_pp_STD_CH = NULL; - - - static void hb_pp_ErrorGen( void * cargo, char * szMsgTable[], char cPrefix, int iErrorCode, const char * szParam1, const char * szParam2 ) { - int iLine = hb_comp_iLine; - - HB_SYMBOL_UNUSED( cargo ); - /* I do not know why but compiler expect line number 1 bigger then real line number */ - hb_comp_iLine = hb_pp_line( hb_comp_data->pLex->pPP ) + 1; if( cPrefix == 'W' ) - hb_compGenWarning( szMsgTable, cPrefix, iErrorCode, szParam1, szParam2 ); + hb_compGenWarning( ( HB_COMP_PTR ) cargo, szMsgTable, cPrefix, iErrorCode, szParam1, szParam2 ); else - hb_compGenError( szMsgTable, cPrefix, iErrorCode, szParam1, szParam2 ); - hb_comp_iLine = iLine; + hb_compGenError( ( HB_COMP_PTR ) cargo, szMsgTable, cPrefix, iErrorCode, szParam1, szParam2 ); } static void hb_pp_PragmaDump( void * cargo, char * pBuffer, ULONG ulSize, @@ -61,8 +47,6 @@ static void hb_pp_PragmaDump( void * cargo, char * pBuffer, ULONG ulSize, { PINLINE pInline; - HB_SYMBOL_UNUSED( cargo ); - pInline = hb_compInlineAdd( ( HB_COMP_PTR ) cargo, NULL, iLine ); pInline->pCode = ( BYTE * ) hb_xgrab( ulSize + 1 ); memcpy( pInline->pCode, pBuffer, ulSize ); @@ -73,14 +57,16 @@ static void hb_pp_PragmaDump( void * cargo, char * pBuffer, ULONG ulSize, static void hb_pp_hb_inLine( void * cargo, char * szFunc, char * pBuffer, ULONG ulSize, int iLine ) { - if( hb_comp_iLanguage != LANG_C && hb_comp_iLanguage != LANG_OBJ_MODULE ) + HB_COMP_DECL = ( HB_COMP_PTR ) cargo; + + if( HB_COMP_PARAM->iLanguage != LANG_C && HB_COMP_PARAM->iLanguage != LANG_OBJ_MODULE ) { - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_REQUIRES_C, NULL, NULL ); + hb_compGenError( ( HB_COMP_PTR ) cargo, hb_comp_szErrors, 'F', HB_COMP_ERR_REQUIRES_C, NULL, NULL ); } else { PINLINE pInline = hb_compInlineAdd( ( HB_COMP_PTR ) cargo, - hb_compIdentifierNew( szFunc, TRUE ), iLine ); + hb_compIdentifierNew( HB_COMP_PARAM, szFunc, TRUE ), iLine ); pInline->pCode = ( BYTE * ) hb_xgrab( ulSize + 1 ); memcpy( pInline->pCode, pBuffer, ulSize ); pInline->pCode[ ulSize ] = '\0'; @@ -91,11 +77,10 @@ static void hb_pp_hb_inLine( void * cargo, char * szFunc, static BOOL hb_pp_CompilerSwitch( void * cargo, const char * szSwitch, int iValue ) { + HB_COMP_DECL = ( HB_COMP_PTR ) cargo; BOOL fError = FALSE; int i = strlen( szSwitch ); - HB_SYMBOL_UNUSED( cargo ); - if( i > 1 && szSwitch[ i - 1 ] - '0' == iValue ) --i; @@ -105,50 +90,53 @@ static BOOL hb_pp_CompilerSwitch( void * cargo, const char * szSwitch, { case 'a': case 'A': - hb_comp_bAutoMemvarAssume = iValue != 0; + HB_COMP_PARAM->fAutoMemvarAssume = iValue != 0; break; case 'b': case 'B': - hb_comp_bDebugInfo = iValue != 0; + HB_COMP_PARAM->fDebugInfo = iValue != 0; break; case 'l': case 'L': - hb_comp_bLineNumbers = iValue != 0; + HB_COMP_PARAM->fLineNumbers = iValue != 0; break; case 'n': case 'N': - hb_comp_bStartProc = iValue != 0; + HB_COMP_PARAM->fStartProc = iValue != 0; break; case 'p': case 'P': - hb_comp_bPPO = iValue != 0; + HB_COMP_PARAM->fPPO = iValue != 0; break; case 'q': case 'Q': - hb_comp_bQuiet = iValue != 0; + HB_COMP_PARAM->fQuiet = iValue != 0; break; case 'v': case 'V': - hb_comp_bForceMemvars = iValue != 0; + HB_COMP_PARAM->fForceMemvars = iValue != 0; break; case 'w': case 'W': if( iValue >= 0 && iValue <= 3 ) - hb_comp_iWarnings = iValue; + HB_COMP_PARAM->iWarnings = iValue; else fError = TRUE; break; case 'z': case 'Z': - hb_comp_bShortCuts = iValue != 0; + if( iValue ) + HB_COMP_PARAM->supported &= ~HB_COMPFLAG_SHORTCUTS; + else + HB_COMP_PARAM->supported |= HB_COMPFLAG_SHORTCUTS; break; default: @@ -161,14 +149,14 @@ static BOOL hb_pp_CompilerSwitch( void * cargo, const char * szSwitch, ( iValue == HB_EXITLEVEL_DEFAULT || iValue == HB_EXITLEVEL_SETEXIT || iValue == HB_EXITLEVEL_DELTARGET ) ) - hb_comp_iExitLevel = iValue; + HB_COMP_PARAM->iExitLevel = iValue; else fError = TRUE; } /* xHarbour extension */ else if( i >= 4 && hb_strnicmp( szSwitch, "TEXTHIDDEN", i ) == 0 && iValue >= 0 && iValue <= 1 ) - hb_comp_iHidden = iValue; + HB_COMP_PARAM->iHidden = iValue; else fError = TRUE; @@ -176,82 +164,41 @@ static BOOL hb_pp_CompilerSwitch( void * cargo, const char * szSwitch, } -void hb_pp_SetRules( BOOL fQuiet, int argc, char * argv[] ) +void hb_compInitPP( HB_COMP_DECL, int argc, char * argv[] ) { - char * szStdCh = hb_pp_STD_CH; + HB_TRACE( HB_TR_DEBUG, ( "hb_compInitPP()" ) ); - HB_TRACE( HB_TR_DEBUG, ( "hb_pp_SetRules()" ) ); - - if( szStdCh && * szStdCh <= ' ' ) - szStdCh = ""; - - if( hb_comp_data->pLex->pPP ) + if( HB_COMP_PARAM->pLex->pPP ) { - hb_pp_init( hb_comp_data->pLex->pPP, fQuiet, hb_comp_data, NULL, NULL, + hb_pp_init( HB_COMP_PARAM->pLex->pPP, HB_COMP_PARAM->fQuiet, + HB_COMP_PARAM->iMaxTransCycles, + HB_COMP_PARAM, NULL, NULL, hb_pp_ErrorGen, NULL, hb_pp_PragmaDump, HB_COMP_ISSUPPORTED( HB_COMPFLAG_HB_INLINE_PP ) ? hb_pp_hb_inLine : NULL, hb_pp_CompilerSwitch ); - if( !szStdCh ) - hb_pp_setStdRules( hb_comp_data->pLex->pPP ); - else if( *szStdCh ) - hb_pp_readRules( hb_comp_data->pLex->pPP, szStdCh ); - else + if( ! HB_COMP_PARAM->szStdCh ) + hb_pp_setStdRules( HB_COMP_PARAM->pLex->pPP ); + else if( HB_COMP_PARAM->szStdCh[ 0 ] > ' ' ) + hb_pp_readRules( HB_COMP_PARAM->pLex->pPP, HB_COMP_PARAM->szStdCh ); + else if( ! HB_COMP_PARAM->fQuiet ) { printf( "Standard command definitions excluded.\n" ); fflush( stdout ); } - hb_pp_initDynDefines( hb_comp_data->pLex->pPP ); + hb_pp_initDynDefines( HB_COMP_PARAM->pLex->pPP ); /* Add /D and /undef: command line or envvar defines */ - hb_compChkDefines( argc, argv ); + hb_compChkDefines( HB_COMP_PARAM, argc, argv ); /* mark current rules as standard ones */ - hb_pp_setStdBase( hb_comp_data->pLex->pPP ); + hb_pp_setStdBase( HB_COMP_PARAM->pLex->pPP ); } - if( hb_comp_pFileName ) + if( HB_COMP_PARAM->pFileName ) { - hb_xfree( ( void * ) hb_comp_pFileName ); - hb_comp_pFileName = NULL; - } - if( hb_pp_STD_CH ) - { - hb_xfree( hb_pp_STD_CH ); - hb_pp_STD_CH = NULL; + hb_xfree( ( void * ) HB_COMP_PARAM->pFileName ); + HB_COMP_PARAM->pFileName = NULL; } } - -int hb_pp_Internal( char * sOut ) -{ - char * szLine; - ULONG ulLen = 0; - - HB_TRACE(HB_TR_DEBUG, ("hb_pp_Internal(%p, %s)", handl_o, sOut)); - - hb_pp_NestedLiteralString = FALSE; - hb_pp_LiteralEscSeq = FALSE; - - if( hb_pp_StreamBlock == HB_PP_STREAM_DUMP_C ) - hb_pp_setStream( hb_comp_data->pLex->pPP, HB_PP_STREAM_INLINE_C ); - - szLine = hb_pp_nextLine( hb_comp_data->pLex->pPP, &ulLen ); - /* I do not know why but compiler expect line number 1 bigger then - real line number */ - hb_comp_iLine = hb_pp_line( hb_comp_data->pLex->pPP ) + 1; - - if( ulLen >= HB_PP_STR_SIZE ) - hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_BUFFER_OVERFLOW, NULL, NULL ); - else if( szLine ) - memcpy( sOut, szLine, ulLen + 1 ); - else - * sOut = '\0'; - - if( hb_comp_iLineINLINE && hb_pp_StreamBlock == 0 ) - { - hb_comp_iLineINLINE = 0; - } - - return ulLen; -} diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index 6580a9c13c..7db38d6e5f 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -222,76 +222,76 @@ extern void yyerror( HB_MACRO_PTR, char * ); /* parsing error management func Main : Expression '\n' { HB_MACRO_DATA->exprType = hb_compExprType( $1 ); if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH ) - hb_compExprGenPush( $1, HB_MACRO_PARAM ); + hb_compExprGenPush( $1, HB_COMP_PARAM ); else - hb_compExprGenPop( $1, HB_MACRO_PARAM ); - hb_compGenPCode1( HB_P_ENDPROC, HB_MACRO_PARAM ); + hb_compExprGenPop( $1, HB_COMP_PARAM ); + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); } | Expression { HB_MACRO_DATA->exprType = hb_compExprType( $1 ); if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH ) - hb_compExprGenPush( $1, HB_MACRO_PARAM ); + hb_compExprGenPush( $1, HB_COMP_PARAM ); else - hb_compExprGenPop( $1, HB_MACRO_PARAM ); - hb_compGenPCode1( HB_P_ENDPROC, HB_MACRO_PARAM ); + hb_compExprGenPop( $1, HB_COMP_PARAM ); + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); } | AsParamList { HB_MACRO_DATA->exprType = hb_compExprType( $1 ); if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PUSH ) - hb_compExprGenPush( $1, HB_MACRO_PARAM ); + hb_compExprGenPush( $1, HB_COMP_PARAM ); else - hb_compExprGenPop( $1, HB_MACRO_PARAM ); - hb_compGenPCode1( HB_P_ENDPROC, HB_MACRO_PARAM ); + hb_compExprGenPop( $1, HB_COMP_PARAM ); + hb_compGenPCode1( HB_P_ENDPROC, HB_COMP_PARAM ); } | Expression error { HB_TRACE(HB_TR_DEBUG, ("macro -> invalid expression: %s", HB_MACRO_DATA->string)); - hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); + hb_macroError( EG_SYNTAX, HB_COMP_PARAM ); YYABORT; } | error { HB_TRACE(HB_TR_DEBUG, ("macro -> invalid syntax: %s", HB_MACRO_DATA->string)); - hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); + hb_macroError( EG_SYNTAX, HB_COMP_PARAM ); YYABORT; } ; /* Numeric values */ -NumValue : NUM_DOUBLE { $$ = hb_compExprNewDouble( $1.dNumber, $1.bWidth, $1.bDec ); } - | NUM_LONG { $$ = hb_compExprNewLong( $1.lNumber ); } +NumValue : NUM_DOUBLE { $$ = hb_compExprNewDouble( $1.dNumber, $1.bWidth, $1.bDec, HB_COMP_PARAM ); } + | NUM_LONG { $$ = hb_compExprNewLong( $1.lNumber, HB_COMP_PARAM ); } ; -DateValue : NUM_DATE { $$ = hb_compExprNewDate( $1.lNumber ); } +DateValue : NUM_DATE { $$ = hb_compExprNewDate( $1.lNumber, HB_COMP_PARAM ); } ; -NumAlias : NUM_LONG ALIASOP { $$ = hb_compExprNewLong( $1.lNumber ); } +NumAlias : NUM_LONG ALIASOP { $$ = hb_compExprNewLong( $1.lNumber, HB_COMP_PARAM ); } ; /* NIL value */ -NilValue : NIL { $$ = hb_compExprNewNil(); } +NilValue : NIL { $$ = hb_compExprNewNil( HB_COMP_PARAM ); } ; /* Literal string value */ -LiteralValue : LITERAL { $$ = hb_compExprNewString( $1, strlen($1) ); } +LiteralValue : LITERAL { $$ = hb_compExprNewString( $1, strlen($1), HB_COMP_PARAM ); } ; /* Logical value */ -Logical : TRUEVALUE { $$ = hb_compExprNewLogical( TRUE ); } - | FALSEVALUE { $$ = hb_compExprNewLogical( FALSE ); } +Logical : TRUEVALUE { $$ = hb_compExprNewLogical( TRUE, HB_COMP_PARAM ); } + | FALSEVALUE { $$ = hb_compExprNewLogical( FALSE, HB_COMP_PARAM ); } ; /* SELF value and expressions */ -SelfValue : SELF { $$ = hb_compExprNewSelf(); } +SelfValue : SELF { $$ = hb_compExprNewSelf( HB_COMP_PARAM ); } ; /* Literal array */ -Array : '{' ElemList '}' { $$ = hb_compExprNewArray( $2, HB_MACRO_PARAM ); } +Array : '{' ElemList '}' { $$ = hb_compExprNewArray( $2, HB_COMP_PARAM ); } ; /* Literal array access @@ -301,22 +301,22 @@ ArrayAt : Array ArrayIndex { $$ = $2; } /* Variables */ -Variable : IDENTIFIER { $$ = hb_compExprNewVar( $1 ); } +Variable : IDENTIFIER { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); } ; -VarAlias : IDENTIFIER ALIASOP { $$ = hb_compExprNewAlias( $1 ); } +VarAlias : IDENTIFIER ALIASOP { $$ = hb_compExprNewAlias( $1, HB_COMP_PARAM ); } ; /* Macro variables - this can signal compilation errors */ -MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1 ); +MacroVar : MACROVAR { $$ = hb_compExprNewMacro( NULL, '&', $1, HB_COMP_PARAM ); HB_MACRO_CHECK( $$ ); } | MACROTEXT { ULONG ulLen = strlen( $1 ); char * szVarName = hb_macroTextSubst( $1, &ulLen ); if( hb_macroIsIdent( szVarName ) ) { - $$ = hb_compExprNewVar( szVarName ); + $$ = hb_compExprNewVar( szVarName, HB_COMP_PARAM ); HB_MACRO_CHECK( $$ ); } else @@ -334,7 +334,7 @@ MacroVarAlias : MacroVar ALIASOP { $$ = $1; } /* Macro expressions */ -MacroExpr : '&' PareExpList { $$ = hb_compExprNewMacro( $2, 0, NULL ); } +MacroExpr : '&' PareExpList { $$ = hb_compExprNewMacro( $2, 0, NULL, HB_COMP_PARAM ); } ; MacroExprAlias : MacroExpr ALIASOP { $$ = $1; } @@ -344,7 +344,7 @@ MacroExprAlias : MacroExpr ALIASOP { $$ = $1; } */ /* special case: _FIELD-> and FIELD-> can be nested */ -FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( "FIELD" ); } +FieldAlias : FIELD ALIASOP { $$ = hb_compExprNewAlias( "FIELD", HB_COMP_PARAM ); } | FIELD ALIASOP FieldAlias { $$ = $3; } ; @@ -357,17 +357,17 @@ FieldVarAlias : FieldAlias VarAlias { $$ = $2; } | FieldAlias MacroExprAlias { $$ = $2; } ; -AliasId : IDENTIFIER { $$ = hb_compExprNewVar( $1 ); } +AliasId : IDENTIFIER { $$ = hb_compExprNewVar( $1, HB_COMP_PARAM ); } | MacroVar { $$ = $1; } ; -AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | MacroVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | MacroExprAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | PareExpListAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | VarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | FieldAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } - | FieldVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); } +AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | MacroVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | MacroExprAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | PareExpListAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | VarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | FieldAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } + | FieldVarAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2, HB_COMP_PARAM ); } ; /* Aliased expressions @@ -376,11 +376,11 @@ AliasVar : NumAlias AliasId { $$ = hb_compExprNewAliasVar( $1, $2 ); * alias->( Expression ) * alias always selects a workarea at runtime */ -AliasExpr : NumAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | VarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | MacroVarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | MacroExprAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } - | PareExpListAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2 ); } +AliasExpr : NumAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | VarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | MacroVarAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | MacroExprAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } + | PareExpListAlias PareExpList { $$ = hb_compExprNewAliasExpr( $1, $2, HB_COMP_PARAM ); } ; /* Array expressions access @@ -404,46 +404,46 @@ VariableAt : NilValue ArrayIndex { $$ = $2; } /* Function call */ -FunCall : IDENTIFIER '(' ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1 ), $3, HB_MACRO_PARAM ); +FunCall : IDENTIFIER '(' ArgList ')' { $$ = hb_compExprNewFunCall( hb_compExprNewFunName( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); HB_MACRO_CHECK( $$ ); } - | MacroVar '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3, HB_MACRO_PARAM ); + | MacroVar '(' ArgList ')' { $$ = hb_compExprNewFunCall( $1, $3, HB_COMP_PARAM ); HB_MACRO_CHECK( $$ ); } ; -ArgList : Argument { $$ = hb_compExprNewArgList( $1 ); } +ArgList : Argument { $$ = hb_compExprNewArgList( $1, HB_COMP_PARAM ); } | ArgList ',' Argument { $$ = hb_compExprAddListExpr( $1, $3 ); } ; Argument : EmptyExpression { $$ = $1; } - | '@' IDENTIFIER { $$ = hb_compExprNewVarRef( $2 ); } - | '@' AliasVar { $$ = hb_compExprNewRef( $2 ); } - | '@' IDENTIFIER '(' ')' { $$ = hb_compExprNewFunRef( $2 ); } + | '@' IDENTIFIER { $$ = hb_compExprNewVarRef( $2, HB_COMP_PARAM ); } + | '@' AliasVar { $$ = hb_compExprNewRef( $2, HB_COMP_PARAM ); } + | '@' IDENTIFIER '(' ')' { $$ = hb_compExprNewFunRef( $2, HB_COMP_PARAM ); } ; /* Object's instance variable */ -ObjectData : NumValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | NilValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | DateValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | LiteralValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | CodeBlock ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | Logical ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | SelfValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | Array ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | ArrayAt ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | Variable ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | AliasVar ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | AliasExpr ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | MacroVar ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | MacroExpr ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | FunCall ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | IfInline ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | PareExpList ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | VariableAt ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | ObjectMethod ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } - | ObjectData ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL ); } +ObjectData : NumValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | NilValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | DateValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | LiteralValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | CodeBlock ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | Logical ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | SelfValue ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | Array ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | ArrayAt ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | Variable ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | AliasVar ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | AliasExpr ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | MacroVar ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | MacroExpr ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | FunCall ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | IfInline ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | PareExpList ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | VariableAt ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | ObjectMethod ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } + | ObjectData ':' IDENTIFIER { $$ = hb_compExprNewSend( $1, $3, NULL, HB_COMP_PARAM ); } ; /* Object's method @@ -489,13 +489,13 @@ RootParamList : EmptyExpression ',' { if( !(HB_MACRO_DATA->Flags & HB_MACRO_GEN_LIST) ) { HB_TRACE(HB_TR_DEBUG, ("macro -> invalid expression: %s", HB_MACRO_DATA->string)); - hb_macroError( EG_SYNTAX, HB_MACRO_PARAM ); + hb_macroError( EG_SYNTAX, HB_COMP_PARAM ); YYABORT; } } EmptyExpression { HB_MACRO_DATA->uiListElements = 1; - $$ = hb_compExprAddListExpr( ( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PARE ) ? hb_compExprNewList( $1 ) : hb_compExprNewArgList( $1 ), $4 ); + $$ = hb_compExprAddListExpr( ( HB_MACRO_DATA->Flags & HB_MACRO_GEN_PARE ) ? hb_compExprNewList( $1, HB_COMP_PARAM ) : hb_compExprNewArgList( $1, HB_COMP_PARAM ), $4 ); } ; @@ -504,15 +504,15 @@ AsParamList : RootParamList { $$ = $1; } $$ = hb_compExprAddListExpr( $1, $3 ); } ; -EmptyExpression: /* nothing => nil */ { $$ = hb_compExprNewEmpty(); } +EmptyExpression: /* nothing => nil */ { $$ = hb_compExprNewEmpty( HB_COMP_PARAM ); } | Expression ; /* NOTE: PostOp can be used in one context only - it uses $0 rule * (the rule that stands before PostOp) */ -PostOp : INC { $$ = hb_compExprNewPostInc( $0 ); } - | DEC { $$ = hb_compExprNewPostDec( $0 ); } +PostOp : INC { $$ = hb_compExprNewPostInc( $0, HB_COMP_PARAM ); } + | DEC { $$ = hb_compExprNewPostDec( $0, HB_COMP_PARAM ); } ; /* NOTE: We cannot use 'Expression PostOp' because it caused @@ -539,160 +539,160 @@ ExprPostOp : NumValue PostOp %prec POST { $$ = $2; } | ObjectMethod PostOp %prec POST { $$ = $2; } ; -ExprPreOp : INC Expression %prec PRE { $$ = hb_compExprNewPreInc( $2 ); } - | DEC Expression %prec PRE { $$ = hb_compExprNewPreDec( $2 ); } +ExprPreOp : INC Expression %prec PRE { $$ = hb_compExprNewPreInc( $2, HB_COMP_PARAM ); } + | DEC Expression %prec PRE { $$ = hb_compExprNewPreDec( $2, HB_COMP_PARAM ); } ; -ExprUnary : NOT Expression { $$ = hb_compExprNewNot( $2 ); } - | '-' Expression %prec UNARY { $$ = hb_compExprNewNegate( $2 ); } +ExprUnary : NOT Expression { $$ = hb_compExprNewNot( $2, HB_COMP_PARAM ); } + | '-' Expression %prec UNARY { $$ = hb_compExprNewNegate( $2, HB_COMP_PARAM ); } | '+' Expression %prec UNARY { $$ = $2; } ; -ExprAssign : NumValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | NilValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | LiteralValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | CodeBlock INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | Logical INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | SelfValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | Array INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | ArrayAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | Variable INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | MacroVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | MacroExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | AliasVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | AliasExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | VariableAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | PareExpList INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | IfInline INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | FunCall INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } - | ObjectData INASSIGN Expression { HB_MACRO_IFENABLED( $$, hb_compExprAssign( $1, $3 ), HB_SM_HARBOUR ); } - | ObjectMethod INASSIGN Expression { $$ = hb_compExprAssign( $1, $3 ); } +ExprAssign : NumValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | NilValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | LiteralValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | CodeBlock INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Logical INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | SelfValue INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Array INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ArrayAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | Variable INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | MacroVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | MacroExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | AliasVar INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | AliasExpr INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | VariableAt INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | PareExpList INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | IfInline INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | FunCall INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } + | ObjectData INASSIGN Expression { HB_MACRO_IFENABLED( $$, hb_compExprAssign( $1, $3, HB_COMP_PARAM ), HB_SM_HARBOUR ); } + | ObjectMethod INASSIGN Expression { $$ = hb_compExprAssign( $1, $3, HB_COMP_PARAM ); } ; -ExprPlusEq : NumValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | NilValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | LiteralValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | CodeBlock PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | Logical PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | SelfValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | Array PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | ArrayAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | Variable PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | VariableAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | PareExpList PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | IfInline PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | FunCall PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectData PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectMethod PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1 ), $3, HB_MACRO_PARAM ); } +ExprPlusEq : NumValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod PLUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprMinusEq : NumValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | NilValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | LiteralValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | CodeBlock MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | Logical MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | SelfValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | Array MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | ArrayAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | Variable MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | VariableAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | PareExpList MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | IfInline MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | FunCall MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectData MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectMethod MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1 ), $3, HB_MACRO_PARAM ); } +ExprMinusEq : NumValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod MINUSEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinusEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprMultEq : NumValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | NilValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | LiteralValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | CodeBlock MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | Logical MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | SelfValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | Array MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | ArrayAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | Variable MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | VariableAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | PareExpList MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | IfInline MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | FunCall MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectData MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectMethod MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1 ), $3, HB_MACRO_PARAM ); } +ExprMultEq : NumValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod MULTEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewMultEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprDivEq : NumValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | NilValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | LiteralValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | CodeBlock DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | Logical DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | SelfValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | Array DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | ArrayAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | Variable DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | VariableAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | PareExpList DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | IfInline DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | FunCall DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectData DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectMethod DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1 ), $3, HB_MACRO_PARAM ); } +ExprDivEq : NumValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod DIVEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewDivEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprModEq : NumValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | NilValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | LiteralValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | CodeBlock MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | Logical MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | SelfValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | Array MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | ArrayAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | Variable MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | VariableAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | PareExpList MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | IfInline MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | FunCall MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectData MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectMethod MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1 ), $3, HB_MACRO_PARAM ); } +ExprModEq : NumValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod MODEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewModEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprExpEq : NumValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | NilValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | LiteralValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | CodeBlock EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | Logical EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | SelfValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | Array EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | ArrayAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | Variable EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | MacroExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | AliasExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | VariableAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | PareExpList EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | IfInline EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | FunCall EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectData EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } - | ObjectMethod EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1 ), $3, HB_MACRO_PARAM ); } +ExprExpEq : NumValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | NilValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | LiteralValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | CodeBlock EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Logical EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | SelfValue EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Array EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ArrayAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Variable EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | MacroExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasVar EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | AliasExpr EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | VariableAt EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | PareExpList EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | IfInline EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | FunCall EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectData EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | ObjectMethod EXPEQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewExpEq( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; ExprOperEq : ExprPlusEq { $$ = $1; } @@ -703,27 +703,27 @@ ExprOperEq : ExprPlusEq { $$ = $1; } | ExprExpEq { $$ = $1; } ; -ExprMath : Expression '+' Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlus( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '-' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinus( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '*' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMult( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '/' Expression { $$ = hb_compExprSetOperand( hb_compExprNewDiv( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '%' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMod( $1 ), $3, HB_MACRO_PARAM ); } - | Expression POWER Expression { $$ = hb_compExprSetOperand( hb_compExprNewPower( $1 ), $3, HB_MACRO_PARAM ); } +ExprMath : Expression '+' Expression { $$ = hb_compExprSetOperand( hb_compExprNewPlus( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '-' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMinus( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '*' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMult( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '/' Expression { $$ = hb_compExprSetOperand( hb_compExprNewDiv( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '%' Expression { $$ = hb_compExprSetOperand( hb_compExprNewMod( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression POWER Expression { $$ = hb_compExprSetOperand( hb_compExprNewPower( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprBool : Expression AND Expression { $$ = hb_compExprSetOperand( hb_compExprNewAnd( $1 ), $3, HB_MACRO_PARAM ); } - | Expression OR Expression { $$ = hb_compExprSetOperand( hb_compExprNewOr( $1 ), $3, HB_MACRO_PARAM ); } +ExprBool : Expression AND Expression { $$ = hb_compExprSetOperand( hb_compExprNewAnd( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression OR Expression { $$ = hb_compExprSetOperand( hb_compExprNewOr( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; -ExprRelation: Expression EQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewEQ( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '<' Expression { $$ = hb_compExprSetOperand( hb_compExprNewLT( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '>' Expression { $$ = hb_compExprSetOperand( hb_compExprNewGT( $1 ), $3, HB_MACRO_PARAM ); } - | Expression LE Expression { $$ = hb_compExprSetOperand( hb_compExprNewLE( $1 ), $3, HB_MACRO_PARAM ); } - | Expression GE Expression { $$ = hb_compExprSetOperand( hb_compExprNewGE( $1 ), $3, HB_MACRO_PARAM ); } - | Expression NE1 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1 ), $3, HB_MACRO_PARAM ); } - | Expression NE2 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '$' Expression { $$ = hb_compExprSetOperand( hb_compExprNewIN( $1 ), $3, HB_MACRO_PARAM ); } - | Expression '=' Expression { $$ = hb_compExprSetOperand( hb_compExprNewEqual( $1 ), $3, HB_MACRO_PARAM ); } +ExprRelation: Expression EQ Expression { $$ = hb_compExprSetOperand( hb_compExprNewEQ( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '<' Expression { $$ = hb_compExprSetOperand( hb_compExprNewLT( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '>' Expression { $$ = hb_compExprSetOperand( hb_compExprNewGT( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression LE Expression { $$ = hb_compExprSetOperand( hb_compExprNewLE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression GE Expression { $$ = hb_compExprSetOperand( hb_compExprNewGE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression NE1 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression NE2 Expression { $$ = hb_compExprSetOperand( hb_compExprNewNE( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '$' Expression { $$ = hb_compExprSetOperand( hb_compExprNewIN( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } + | Expression '=' Expression { $$ = hb_compExprSetOperand( hb_compExprNewEqual( $1, HB_COMP_PARAM ), $3, HB_COMP_PARAM ); } ; ArrayIndex : IndexList ']' { $$ = $1; } @@ -732,21 +732,21 @@ ArrayIndex : IndexList ']' { $$ = $1; } /* NOTE: $0 represents the expression before ArrayIndex * Don't use ArrayIndex in other context than as an array index! */ -IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $0, $2, HB_MACRO_PARAM ); } - | IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3, HB_MACRO_PARAM ); } - | IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4, HB_MACRO_PARAM ); } +IndexList : '[' Expression { $$ = hb_compExprNewArrayAt( $0, $2, HB_COMP_PARAM ); } + | IndexList ',' Expression { $$ = hb_compExprNewArrayAt( $1, $3, HB_COMP_PARAM ); } + | IndexList ']' '[' Expression { $$ = hb_compExprNewArrayAt( $1, $4, HB_COMP_PARAM ); } ; -ElemList : EmptyExpression { $$ = hb_compExprNewList( $1 ); } +ElemList : EmptyExpression { $$ = hb_compExprNewList( $1, HB_COMP_PARAM ); } | ElemList ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); } ; CodeBlock : '{' '|' - { $$ = hb_compExprNewCodeBlock(NULL,FALSE,FALSE); } BlockNoVar + { $$ = hb_compExprNewCodeBlock( NULL, FALSE, FALSE, HB_COMP_PARAM ); } BlockNoVar '|' BlockExpList '}' { $$ = $3; } | '{' '|' - { $$ = hb_compExprNewCodeBlock(NULL,FALSE,FALSE); } + { $$ = hb_compExprNewCodeBlock( NULL, FALSE, FALSE, HB_COMP_PARAM ); } BlockVarList '|' BlockExpList '}' { $$ = $3; } @@ -764,11 +764,11 @@ BlockExpList : Expression { $$ = hb_compExprAddCodeblockExpr( $0, $1, HB_MACRO_PARAM ); } - | BlockVarList ',' IDENTIFIER { $$ = hb_compExprCBVarAdd( $0, $3, HB_MACRO_PARAM ); HB_MACRO_CHECK( $$ ); } +BlockVarList : IDENTIFIER { $$ = hb_compExprCBVarAdd( $0, $1, ' ', HB_COMP_PARAM ); } + | BlockVarList ',' IDENTIFIER { $$ = hb_compExprCBVarAdd( $0, $3, ' ', HB_COMP_PARAM ); HB_MACRO_CHECK( $$ ); } ; -ExpList : '(' EmptyExpression { $$ = hb_compExprNewList( $2 ); } +ExpList : '(' EmptyExpression { $$ = hb_compExprNewList( $2, HB_COMP_PARAM ); } | ExpList ',' EmptyExpression { $$ = hb_compExprAddListExpr( $1, $3 ); } ; @@ -779,14 +779,14 @@ PareExpListAlias : PareExpList ALIASOP { $$ = $1; } ; IfInline : IIF '(' Expression ',' EmptyExpression ',' - { $$ = hb_compExprAddListExpr( hb_compExprNewList( $3 ), $5 ); } + { $$ = hb_compExprAddListExpr( hb_compExprNewList( $3, HB_COMP_PARAM ), $5 ); } EmptyExpression ')' - { $$ = hb_compExprNewIIF( hb_compExprAddListExpr( $7, $8 ) ); } + { $$ = hb_compExprNewIIF( hb_compExprAddListExpr( $7, $8 ), HB_COMP_PARAM ); } | IF '(' Expression ',' EmptyExpression ',' - { $$ = hb_compExprAddListExpr( hb_compExprNewList( $3 ), $5 ); } + { $$ = hb_compExprAddListExpr( hb_compExprNewList( $3, HB_COMP_PARAM ), $5 ); } EmptyExpression ')' - { $$ = hb_compExprNewIIF( hb_compExprAddListExpr( $7, $8 ) ); } + { $$ = hb_compExprNewIIF( hb_compExprAddListExpr( $7, $8 ), HB_COMP_PARAM ); } ; %% @@ -809,6 +809,46 @@ void yyerror( HB_MACRO_PTR pMacro, char * s ) /* ************************************************************************* */ +typedef struct HB_MEXPR_ +{ + HB_EXPR Expression; + struct HB_MEXPR_ *pPrev; +} +HB_MEXPR, * HB_MEXPR_PTR; + +/* Allocates memory for Expression holder structure and stores it + * on the linked list +*/ +HB_EXPR_PTR hb_macroExprNew( HB_COMP_DECL ) +{ + HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) hb_xgrab( sizeof( HB_MEXPR ) ); + pMExpr->pPrev = ( HB_MEXPR_PTR ) HB_MACRO_DATA->pExprLst; + HB_MACRO_DATA->pExprLst = ( void * ) pMExpr; + return &pMExpr->Expression; +} + +/* Deallocate all memory used by expression optimizer */ +static void hb_macroExprLstFree( HB_MACRO_PTR pMacro ) +{ + if( pMacro->pExprLst ) + { + HB_MEXPR_PTR pMExpr = ( HB_MEXPR_PTR ) pMacro->pExprLst; + do + { + hb_compExprDelete( &pMExpr->Expression, pMacro ); + pMExpr = pMExpr->pPrev; + } + while( pMExpr ); + do + { + pMExpr = ( HB_MEXPR_PTR ) pMacro->pExprLst; + pMacro->pExprLst = ( void * ) pMExpr->pPrev; + hb_xfree( pMExpr ); + } + while( pMacro->pExprLst ); + } +} + int hb_macroYYParse( HB_MACRO_PTR pMacro ) { int iResult; @@ -816,13 +856,11 @@ int hb_macroYYParse( HB_MACRO_PTR pMacro ) if( hb_macroLexNew( pMacro ) ) { pMacro->status = HB_MACRO_CONT; + pMacro->pExprLst = NULL; - /* NOTE: bison requires (void *) pointer */ iResult = yyparse( pMacro ); - /* TODO: we should free HB_EXPR list here when it will be bound - with one of pMacro structure member not with static - variable in vm/macro.c */ + hb_macroExprLstFree( pMacro ); hb_macroLexDelete( pMacro ); } else diff --git a/harbour/source/pp/ppcore.c b/harbour/source/pp/ppcore.c index 10772ab02d..5131445a1e 100644 --- a/harbour/source/pp/ppcore.c +++ b/harbour/source/pp/ppcore.c @@ -608,6 +608,7 @@ static void hb_pp_readLine( PHB_PP_STATE pState ) hb_membufAddCh( pState->pBuffer, ch ); } } + ++pState->iLineTot; iLine = ++pState->pFile->iCurrentLine / 100; if( !pState->fQuiet && iLine != pState->pFile->iLastDisp ) @@ -4396,6 +4397,36 @@ PHB_PP_TOKEN hb_pp_tokenGet( PHB_PP_STATE pState ) if( !pState->pTokenOut ) hb_pp_preprocesToken( pState ); + if( pState->fWritePreprocesed && pState->pTokenOut ) + { + hb_membufFlush( pState->pBuffer ); +#if defined( HB_PP_NO_LINEINFO_TOKEN ) + if( pState->pFile->fGenLineInfo ) + { + fprintf( pState->file_out, "#line %d", pState->pFile->iCurrentLine ); + if( pState->pFile->szFileName ) + fprintf( pState->file_out, " \"%s\"", pState->pFile->szFileName ); + fputc( '\n', pState->file_out ); + pState->pFile->fGenLineInfo = FALSE; + } + else if( pState->pFile->iLastLine < pState->pFile->iCurrentLine ) + { + do + fputc( '\n', pState->file_out ); + while( ++pState->pFile->iLastLine < pState->pFile->iCurrentLine ); + } + pState->pFile->iLastLine = pState->pFile->iCurrentLine + + hb_pp_tokenStr( pState->pTokenOut, pState->pBuffer, TRUE, TRUE, + pState->iLastType ); +#else + hb_pp_tokenStr( pState->pTokenOut, pState->pBuffer, TRUE, TRUE, + pState->iLastType ); +#endif + pState->iLastType = pState->pTokenOut->type; + fwrite( hb_membufPtr( pState->pBuffer ), sizeof( char ), + hb_membufLen( pState->pBuffer ), pState->file_out ); + } + return pState->pTokenOut; } @@ -4419,13 +4450,14 @@ void hb_pp_free( PHB_PP_STATE pState ) /* * initialize PP context */ -void hb_pp_init( PHB_PP_STATE pState, BOOL fQuiet, void * cargo, +void hb_pp_init( PHB_PP_STATE pState, BOOL fQuiet, int iCycles, void * cargo, PHB_PP_OPEN_FUNC pOpenFunc, PHB_PP_CLOSE_FUNC pCloseFunc, PHB_PP_ERROR_FUNC pErrorFunc, PHB_PP_DISP_FUNC pDispFunc, PHB_PP_DUMP_FUNC pDumpFunc, PHB_PP_INLINE_FUNC pInLineFunc, PHB_PP_SWITCH_FUNC pSwitchFunc ) { pState->fQuiet = fQuiet; + pState->iMaxCycles = ( iCycles > 0 ) ? iCycles : HB_PP_MAX_CYCLES; pState->cargo = cargo; pState->pOpenFunc = pOpenFunc; pState->pCloseFunc = pCloseFunc; @@ -4587,6 +4619,7 @@ void hb_pp_readRules( PHB_PP_STATE pState, char * szRulesFile ) else { pState->iFiles++; + pState->iLastType = HB_PP_TOKEN_NUL; while( hb_pp_tokenGet( pState ) ); if( pState->pFile ) { @@ -4678,6 +4711,11 @@ int hb_pp_line( PHB_PP_STATE pState ) return 0; } +int hb_pp_lineTot( PHB_PP_STATE pState ) +{ + return pState->iLineTot; +} + /* * return currently preprocessed file name */ @@ -4786,7 +4824,6 @@ char * hb_pp_nextLine( PHB_PP_STATE pState, ULONG * pulLen ) if( pState->pFile ) { PHB_PP_TOKEN pToken; - USHORT ltype = 0; pState->fError = FALSE; @@ -4795,51 +4832,15 @@ char * hb_pp_nextLine( PHB_PP_STATE pState, ULONG * pulLen ) else hb_membufFlush( pState->pOutputBuffer ); + pState->iLastType = HB_PP_TOKEN_NUL; while( ( pToken = hb_pp_tokenGet( pState ) ) != NULL ) { -#if defined( HB_PP_NO_LINEINFO_TOKEN ) - int iLine; - if( pState->fWritePreprocesed ) - { - if( pState->pFile->fGenLineInfo ) - { - fprintf( pState->file_out, "#line %d", pState->pFile->iCurrentLine ); - if( pState->pFile->szFileName ) - { - fprintf( pState->file_out, " \"%s\"", pState->pFile->szFileName ); - } - fputc( '\n', pState->file_out ); - pState->pFile->fGenLineInfo = FALSE; - } - else if( pState->pFile->iLastLine < pState->pFile->iCurrentLine ) - { - do - fputc( '\n', pState->file_out ); - while( ++pState->pFile->iLastLine < pState->pFile->iCurrentLine ); - } - } - pState->pFile->iLastLine = pState->pFile->iCurrentLine; - iLine = hb_pp_tokenStr( pToken, pState->pOutputBuffer, TRUE, TRUE, ltype ); - if( iLine ) - { - pState->pFile->iLastLine += iLine; + if( hb_pp_tokenStr( pToken, pState->pOutputBuffer, TRUE, TRUE, + pState->iLastType ) ) break; - } -#else - if( hb_pp_tokenStr( pToken, pState->pOutputBuffer, TRUE, TRUE, ltype ) ) - break; -#endif /* only single command in one call */ if( !pState->pTokenOut->pNext ) break; - - ltype = HB_PP_TOKEN_TYPE( pToken->type ); - } - - if( pState->fWritePreprocesed ) - { - fwrite( hb_membufPtr( pState->pOutputBuffer ), sizeof( char ), - hb_membufLen( pState->pOutputBuffer ), pState->file_out ); } if( pulLen ) @@ -4861,7 +4862,6 @@ char * hb_pp_parseLine( PHB_PP_STATE pState, char * pLine, ULONG * pulLen ) { PHB_PP_TOKEN pToken; PHB_PP_FILE pFile; - USHORT ltype = 0; ULONG ulLen; pState->fError = FALSE; @@ -4878,10 +4878,11 @@ char * hb_pp_parseLine( PHB_PP_STATE pState, char * pLine, ULONG * pulLen ) pState->pFile = pFile; pState->iFiles++; + pState->iLastType = HB_PP_TOKEN_NUL; while( ( pToken = hb_pp_tokenGet( pState ) ) != NULL ) { - hb_pp_tokenStr( pToken, pState->pOutputBuffer, TRUE, TRUE, ltype ); - ltype = HB_PP_TOKEN_TYPE( pToken->type ); + hb_pp_tokenStr( pToken, pState->pOutputBuffer, TRUE, TRUE, + pState->iLastType ); } if( ( ulLen && pLine[ ulLen - 1 ] == '\n' ) || diff --git a/harbour/source/pp/ppgen.c b/harbour/source/pp/ppgen.c index 7a50820f4a..756fef62bd 100644 --- a/harbour/source/pp/ppgen.c +++ b/harbour/source/pp/ppgen.c @@ -364,7 +364,7 @@ int main( int argc, char * argv[] ) if( szFile ) { - hb_pp_init( pState, fQuiet, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); + hb_pp_init( pState, fQuiet, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL ); if( hb_pp_inFile( pState, szFile, TRUE, NULL, TRUE ) ) { if( fWrite ) diff --git a/harbour/source/pp/pplib.c b/harbour/source/pp/pplib.c index e8cb964d02..0f2f5af070 100644 --- a/harbour/source/pp/pplib.c +++ b/harbour/source/pp/pplib.c @@ -142,7 +142,7 @@ HB_FUNC( __PP_INIT ) { char * szPath = hb_parc( 1 ), * szStdCh = hb_parc( 2 ); - hb_pp_init( pState, TRUE, NULL, NULL, NULL, + hb_pp_init( pState, TRUE, 0, NULL, NULL, NULL, hb_pp_ErrorMessage, hb_pp_Disp, NULL, NULL, NULL ); if( szPath ) diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index 79cfd08410..c207d85831 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -125,9 +125,8 @@ BOOL hb_cmdargIsInternal( const char * szArg ) static char * hb_cmdargGet( const char * pszName, BOOL bRetValue ) { + char * pszRetVal = NULL, * pszEnvVar; int i; - char * pszEnvVar; - char * tmp; HB_TRACE(HB_TR_DEBUG, ("hb_cmdargGet(%s, %d)", pszName, (int) bRetValue)); @@ -141,25 +140,19 @@ static char * hb_cmdargGet( const char * pszName, BOOL bRetValue ) if( bRetValue ) { char * pszPos = s_argv[ i ] + 2 + strlen( pszName ); - char * pszRetVal; if( *pszPos == ':' ) pszPos++; - pszRetVal = ( char * ) hb_xgrab( strlen( pszPos ) + 1 ); - strcpy( pszRetVal, pszPos ); - - return pszRetVal; + return hb_strdup( pszPos ); } else - return s_argv[ i ] + 2; + return ""; } } /* Check the environment variable */ - pszEnvVar = hb_getenv( "HARBOUR" ); - if( !pszEnvVar || pszEnvVar[ 0 ] == '\0' ) { if( pszEnvVar ) @@ -168,11 +161,9 @@ static char * hb_cmdargGet( const char * pszName, BOOL bRetValue ) pszEnvVar = hb_getenv( "CLIPPER" ); } - tmp = pszEnvVar; - if( pszEnvVar && pszEnvVar[ 0 ] != '\0' ) { - char * pszNext; + char * pszNext = pszEnvVar; /* Step through all envvar switches. */ @@ -180,63 +171,56 @@ static char * hb_cmdargGet( const char * pszName, BOOL bRetValue ) chars at all, Harbour is more strict/standard in this respect, it requires the switches to be separated. */ - pszNext = pszEnvVar; - + i = strlen( pszName ); while( *pszNext ) { static const char * szSeparator = " ;,\t"; char * pszEnd; - /* Search for the end of this switch */ - while( *pszNext && strchr( szSeparator, *pszNext ) == NULL ) - pszNext++; - - pszEnd = pszNext; - - /* Skip the separators after the switch */ + /* Skip the separators */ while( *pszNext && strchr( szSeparator, *pszNext ) ) pszNext++; - /* Check the switch */ - /* The // is optional in the envvar */ - if( hb_cmdargIsInternal( pszEnvVar ) ) - pszEnvVar += 2; + if( hb_cmdargIsInternal( pszNext ) ) + pszNext += 2; - if( hb_strnicmp( pszEnvVar, pszName, strlen( pszName ) ) == 0 ) + pszEnd = pszNext; + /* Search for the end of this switch */ + while( *pszEnd && strchr( szSeparator, *pszEnd ) == NULL ) + pszEnd++; + + /* Check the switch */ + if( hb_strnicmp( pszNext, pszName, i ) == 0 ) { if( bRetValue ) { - char * pszPos = pszEnvVar + strlen( pszName ); - char * pszRetVal; - - ULONG ulLen; /* NOTE: Use this variable as a workaround for MSC 8 internal error. [vszakats] */ + ULONG ulLen; + pszNext += i; /* Skip value separator colon. */ - if( *pszPos == ':' ) - pszPos++; - - ulLen = pszEnd - pszPos; + if( *pszNext == ':' ) + pszNext++; + ulLen = pszEnd > pszNext ? pszEnd - pszNext : 0; pszRetVal = ( char * ) hb_xgrab( ulLen + 1 ); - strncpy( pszRetVal, pszPos, ulLen ); + strncpy( pszRetVal, pszNext, ulLen ); pszRetVal[ ulLen ] = '\0'; - - return pszRetVal; } else - return pszEnvVar; + pszRetVal = ""; + break; } /* Step to the next switch */ - pszEnvVar = pszNext; + pszNext = pszEnd; } } - if( tmp ) - hb_xfree( ( void * ) tmp ); + if( pszEnvVar ) + hb_xfree( ( void * ) pszEnvVar ); - return NULL; + return pszRetVal; } BOOL hb_cmdargCheck( const char * pszName ) diff --git a/harbour/source/vm/estack.c b/harbour/source/vm/estack.c index 74372890dd..d997e5e742 100644 --- a/harbour/source/vm/estack.c +++ b/harbour/source/vm/estack.c @@ -131,6 +131,7 @@ void hb_stackFree( void ) while( i >= 0 ) hb_xfree( hb_stack.pItems[ i-- ] ); hb_xfree( hb_stack.pItems ); + hb_stack.pItems = hb_stack.pPos = hb_stack.pBase = NULL; } #undef hb_stackPush diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index b529576392..ba479db928 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -518,56 +518,54 @@ HB_EXPORT void hb_xinit( void ) /* Initialize fixed memory subsystem */ /* Returns pointer to string containing printable version of pMem memory block */ -HB_EXPORT char * hb_mem2str( void * pMem, UINT uiSize ) +#ifdef HB_FM_STATISTICS +static char * hb_mem2str( char * membuffer, void * pMem, UINT uiSize ) { -#define HB_MAX_MEM2STR_BLOCK 256 - - static BYTE cBuffer[2*HB_MAX_MEM2STR_BLOCK+1]; /* multiplied by 2 to allow hex format */ - BYTE *cMem = (BYTE*) pMem; + char *cMem = ( char * ) pMem; UINT uiIndex, uiPrintable; - if( uiSize > HB_MAX_MEM2STR_BLOCK ) - uiSize = HB_MAX_MEM2STR_BLOCK; - uiPrintable = 0; - for( uiIndex=0; uiIndex < uiSize; uiIndex++ ) - if( cMem[uiIndex] >= ' ' ) + for( uiIndex = 0; uiIndex < uiSize; uiIndex++ ) + if( ( cMem[ uiIndex ] & 0x60 ) != 0 ) uiPrintable++; - if( (uiPrintable*100)/uiSize > 70 ) /* more then 70% printable chars */ + if( uiPrintable * 100 / uiSize > 70 ) /* more then 70% printable chars */ { /* format as string of original chars */ - for( uiIndex=0; uiIndex < uiSize; uiIndex++ ) - if( cMem[uiIndex] >= ' ' ) - cBuffer[uiIndex] = cMem[uiIndex]; + for( uiIndex = 0; uiIndex < uiSize; uiIndex++ ) + if( cMem[ uiIndex ] >= ' ' ) + membuffer[ uiIndex ] = cMem[ uiIndex ]; else - cBuffer[uiIndex] = '.'; - cBuffer[uiIndex] = '\0'; + membuffer[ uiIndex ] = '.'; + membuffer[ uiIndex ] = '\0'; } else { /* format as hex */ - for( uiIndex=0; uiIndex < uiSize; uiIndex++ ) + for( uiIndex = 0; uiIndex < uiSize; uiIndex++ ) { int lownibble, hinibble; - hinibble = (cMem[uiIndex])>>4; - lownibble = (cMem[uiIndex]) & 0x0F; - cBuffer[uiIndex*2] = (hinibble <= 9) ? ('0'+hinibble) : ('A'+hinibble-10); - cBuffer[uiIndex*2+1] = (lownibble <= 9) ? ('0'+lownibble) : ('A'+lownibble-10); + hinibble = cMem[ uiIndex ] >> 4; + lownibble = cMem[ uiIndex ] & 0x0F; + membuffer[ uiIndex * 2 ] = hinibble <= 9 ? + ( '0' + hinibble ) : ( 'A' + hinibble - 10 ); + membuffer[ uiIndex * 2 + 1 ] = lownibble <= 9 ? + ( '0' + lownibble ) : ( 'A' + lownibble - 10 ); } - cBuffer[uiIndex*2] = '\0'; + membuffer[ uiIndex * 2 ] = '\0'; } - return (char *)cBuffer; + return membuffer; } +#define HB_MAX_MEM2STR_BLOCK 256 HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ { HB_TRACE(HB_TR_DEBUG, ("hb_xexit()")); -#ifdef HB_FM_STATISTICS if( s_lMemoryBlocks || hb_cmdargCheck( "INFO" ) ) { + char membuffer[ HB_MAX_MEM2STR_BLOCK * 2 + 1 ]; /* multiplied by 2 to allow hex format */ PHB_MEMINFO pMemBlock; USHORT ui; char buffer[ 100 ]; @@ -584,7 +582,7 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ if ( hLog ) { - char *szTime = (char *)hb_xgrab(9); + char szTime[ 9 ]; int iYear, iMonth, iDay; hb_dateToday( &iYear, &iMonth, &iDay ); @@ -593,8 +591,6 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ fprintf( hLog, "Memory Allocation Report : Application => %s\n", hb_cmdargARGV()[0] ); fprintf( hLog, " Application terminated at : %04d.%02d.%02d %s\n", iYear, iMonth, iDay, szTime ); fprintf( hLog, "%s\n", buffer ); - - hb_xfree( szTime ); } if( s_lMemoryBlocks ) @@ -608,36 +604,39 @@ HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ hb_conOutErr( hb_conNewLine(), 0 ); - for( ui = 1, pMemBlock = s_pFirstBlock; pMemBlock; pMemBlock = pMemBlock->pNextBlock ) { - HB_TRACE( HB_TR_ERROR, ( "Block %i (size %lu) %s(%i), \"%s\"", - ui++, - pMemBlock->ulSize, - pMemBlock->szProcName, - pMemBlock->uiProcLine, - hb_mem2str( ( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->ulSize ) - ) ); + for( ui = 1, pMemBlock = s_pFirstBlock; pMemBlock; pMemBlock = pMemBlock->pNextBlock, ++ui ) + { + HB_TRACE( HB_TR_ERROR, ( "Block %i (size %lu) %s(%i), \"%s\"", ui, + pMemBlock->ulSize, pMemBlock->szProcName, pMemBlock->uiProcLine, + hb_mem2str( membuffer, ( char * ) pMemBlock + HB_MEMINFO_SIZE, + HB_MIN( pMemBlock->ulSize, HB_MAX_MEM2STR_BLOCK ) ) ) ); - if ( hLog ) + if( hLog ) { - fprintf( hLog, "Block %i %p (size %lu) %s(%i), \"%s\"\n", - ui-1, + fprintf( hLog, "Block %i %p (size %lu) %s(%i), \"%s\"\n", ui, (char *) pMemBlock + HB_MEMINFO_SIZE, - pMemBlock->ulSize, - pMemBlock->szProcName, - pMemBlock->uiProcLine, - hb_mem2str( ( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->ulSize ) ); + pMemBlock->ulSize, pMemBlock->szProcName, pMemBlock->uiProcLine, + hb_mem2str( membuffer, ( char * ) pMemBlock + HB_MEMINFO_SIZE, + HB_MIN( pMemBlock->ulSize, HB_MAX_MEM2STR_BLOCK ) ) ); } } - if( hLog ) { - fprintf( hLog, "--------------------------------------------------------------------------------\n"); + fprintf( hLog, "------------------------------------------------------------------------\n"); fclose( hLog ); } } -#endif } +#else + +HB_EXPORT void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ +{ + HB_TRACE(HB_TR_DEBUG, ("hb_xexit()")); +} + +#endif + /* hb_xmemcpy and hb_xmemset are only needed when unsigned int and unsigned long differ in length */ diff --git a/harbour/source/vm/macro.c b/harbour/source/vm/macro.c index e2df631b8e..ce4c87650d 100644 --- a/harbour/source/vm/macro.c +++ b/harbour/source/vm/macro.c @@ -71,37 +71,8 @@ HB_FUNC_EXTERN( __MVPUBLIC ); */ BOOL hb_comp_bShortCuts = TRUE; -typedef struct HB_MEXPR_ { - HB_EXPR Expression; - struct HB_MEXPR_ *pPrev; -} HB_MEXPR, *HB_MEXPR_PTR; - /* various flags for macro compiler */ static ULONG s_macroFlags = HB_SM_SHORTCUTS; -static HB_MEXPR_PTR s_macroAlloc = NULL; - -/* ************************************************************************* */ - -/* Allocates memory for Expression holder structure and stores it - * on the linked list -*/ -HB_EXPR_PTR hb_macroExprNew() -{ - HB_MEXPR_PTR pMExpr; - - pMExpr = (HB_MEXPR_PTR) hb_xgrab( sizeof( HB_MEXPR ) ); - if( s_macroAlloc == NULL ) - { - s_macroAlloc = pMExpr; - pMExpr->pPrev = NULL; - } - else - { - pMExpr->pPrev = s_macroAlloc; - s_macroAlloc = pMExpr; - } - return &s_macroAlloc->Expression; -} /* ************************************************************************* */ @@ -115,9 +86,6 @@ HB_EXPR_PTR hb_macroExprNew() */ static int hb_macroParse( HB_MACRO_PTR pMacro, char * szString ) { - int iResult; - HB_MEXPR_PTR pMacroExprList; - /* update the current status for logical shortcuts */ hb_comp_bShortCuts = pMacro->supported & HB_SM_SHORTCUTS; @@ -141,31 +109,7 @@ static int hb_macroParse( HB_MACRO_PTR pMacro, char * szString ) * successfully compilation */ pMacro->exprType = HB_ET_NONE; - - /* Deallocate all memory used by expression optimizer */ - pMacroExprList = s_macroAlloc; /* save current list for recurse entry */ - s_macroAlloc = NULL; - iResult = hb_macroYYParse( pMacro ); - if( s_macroAlloc ) - { - HB_MEXPR_PTR pMExpr = s_macroAlloc; - do - { - hb_compExprDelete( &pMExpr->Expression, pMacro ); - pMExpr = pMExpr->pPrev; - } - while( pMExpr ); - do - { - pMExpr = s_macroAlloc->pPrev; - hb_xfree( s_macroAlloc ); - s_macroAlloc = pMExpr; - } - while( s_macroAlloc ); - } - s_macroAlloc = pMacroExprList; - - return iResult; + return hb_macroYYParse( pMacro ); } /* releases all memory allocated for macro evaluation @@ -1047,7 +991,7 @@ HB_FUNC( HB_SETMACRO ) /* ************************************************************************* */ /* returns the order + 1 of a variable if defined or zero */ -int hb_compLocalVarGetPos( char * szVarName, HB_MACRO_DECL ) +int hb_compLocalVarGetPos( char * szVarName, HB_COMP_DECL ) { int iVar = 1; HB_CBVAR_PTR pVars = HB_PCODE_DATA->pLocals; @@ -1071,31 +1015,31 @@ int hb_compLocalVarGetPos( char * szVarName, HB_MACRO_DECL ) } -ULONG hb_compGenJump( LONG lOffset, HB_MACRO_DECL ) +ULONG hb_compGenJump( LONG lOffset, HB_COMP_DECL ) { /* TODO: We need a longer offset (longer then two bytes) */ if ( ! HB_LIM_INT16( lOffset ) ) - hb_macroError( HB_MACRO_TOO_COMPLEX, HB_MACRO_PARAM ); + hb_macroError( HB_MACRO_TOO_COMPLEX, HB_COMP_PARAM ); - hb_compGenPCode3( HB_P_JUMP, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_JUMP, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_COMP_PARAM ); return HB_PCODE_DATA->lPCodePos - 2; } -ULONG hb_compGenJumpFalse( LONG lOffset, HB_MACRO_DECL ) +ULONG hb_compGenJumpFalse( LONG lOffset, HB_COMP_DECL ) { /* TODO: We need a longer offset (longer then two bytes) */ if ( ! HB_LIM_INT16( lOffset ) ) - hb_macroError( HB_MACRO_TOO_COMPLEX, HB_MACRO_PARAM ); + hb_macroError( HB_MACRO_TOO_COMPLEX, HB_COMP_PARAM ); - hb_compGenPCode3( HB_P_JUMPFALSE, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_JUMPFALSE, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_COMP_PARAM ); return HB_PCODE_DATA->lPCodePos - 2; } -void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo, HB_MACRO_DECL ) +void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo, HB_COMP_DECL ) { BYTE * pCode = HB_PCODE_DATA->pCode; LONG lOffset = ulTo - ulFrom + 1; @@ -1103,25 +1047,25 @@ void hb_compGenJumpThere( ULONG ulFrom, ULONG ulTo, HB_MACRO_DECL ) /* TODO: We need a longer offset (longer then two bytes) */ if ( ! HB_LIM_INT16( lOffset ) ) - hb_macroError( HB_MACRO_TOO_COMPLEX, HB_MACRO_PARAM ); + hb_macroError( HB_MACRO_TOO_COMPLEX, HB_COMP_PARAM ); pCode[ ( ULONG ) ulFrom ] = HB_LOBYTE( lOffset ); pCode[ ( ULONG ) ulFrom + 1 ] = HB_HIBYTE( lOffset ); } -void hb_compGenJumpHere( ULONG ulOffset, HB_MACRO_DECL ) +void hb_compGenJumpHere( ULONG ulOffset, HB_COMP_DECL ) { - hb_compGenJumpThere( ulOffset, HB_PCODE_DATA->lPCodePos, HB_MACRO_PARAM ); + hb_compGenJumpThere( ulOffset, HB_PCODE_DATA->lPCodePos, HB_COMP_PARAM ); } -ULONG hb_compGenJumpTrue( LONG lOffset, HB_MACRO_DECL ) +ULONG hb_compGenJumpTrue( LONG lOffset, HB_COMP_DECL ) { /* TODO: We need a longer offset (longer then two bytes) */ if ( ! HB_LIM_INT16( lOffset ) ) - hb_macroError( HB_MACRO_TOO_COMPLEX, HB_MACRO_PARAM ); + hb_macroError( HB_MACRO_TOO_COMPLEX, HB_COMP_PARAM ); - hb_compGenPCode3( HB_P_JUMPTRUE, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_JUMPTRUE, HB_LOBYTE( lOffset ), HB_HIBYTE( lOffset ), HB_COMP_PARAM ); return HB_PCODE_DATA->lPCodePos - 2; } @@ -1129,7 +1073,7 @@ ULONG hb_compGenJumpTrue( LONG lOffset, HB_MACRO_DECL ) /* Checks if there is a visible memvar variable * szVarName = variable name */ -static void hb_compMemvarCheck( char * szVarName, HB_MACRO_DECL ) +static void hb_compMemvarCheck( char * szVarName, HB_COMP_DECL ) { if( HB_MACRO_DATA->Flags & HB_MACRO_GEN_TYPE ) { @@ -1155,7 +1099,7 @@ static void hb_compMemvarCheck( char * szVarName, HB_MACRO_DECL ) /* * Function generates pcode for passed memvar name */ -void hb_compMemvarGenPCode( BYTE bPCode, char * szVarName, HB_MACRO_DECL ) +void hb_compMemvarGenPCode( BYTE bPCode, char * szVarName, HB_COMP_DECL ) { HB_DYNS_PTR pSym; @@ -1172,18 +1116,18 @@ void hb_compMemvarGenPCode( BYTE bPCode, char * szVarName, HB_MACRO_DECL ) * create the symbol if doesn't exist (Clipper compatibility) */ pSym = hb_dynsymGet( szVarName ); - hb_compGenPCode1( bPCode, HB_MACRO_PARAM ); + hb_compGenPCode1( bPCode, HB_COMP_PARAM ); { BYTE byBuf[ sizeof( HB_DYNS_PTR ) ]; HB_PUT_PTR( byBuf, pSym ); - hb_compGenPCodeN( byBuf, sizeof( pSym ), HB_MACRO_PARAM ); + hb_compGenPCodeN( byBuf, sizeof( pSym ), HB_COMP_PARAM ); } - /* hb_compGenPCodeN( ( BYTE * )( &pSym ), sizeof( pSym ), HB_MACRO_PARAM ); */ + /* hb_compGenPCodeN( ( BYTE * )( &pSym ), sizeof( pSym ), HB_COMP_PARAM ); */ } /* generates the pcode to push a symbol on the virtual machine stack */ -void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_MACRO_DECL ) +void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_COMP_DECL ) { HB_DYNS_PTR pSym; @@ -1216,81 +1160,81 @@ void hb_compGenPushSymbol( char * szSymbolName, BOOL bFunction, BOOL bAlias, HB_ else pSym = hb_dynsymGet( szSymbolName ); - hb_compGenPCode1( HB_P_MPUSHSYM, HB_MACRO_PARAM ); + hb_compGenPCode1( HB_P_MPUSHSYM, HB_COMP_PARAM ); { BYTE byBuf[ sizeof( HB_DYNS_PTR ) ]; HB_PUT_PTR( byBuf, pSym ); - hb_compGenPCodeN( byBuf, sizeof( pSym ), HB_MACRO_PARAM ); + hb_compGenPCodeN( byBuf, sizeof( pSym ), HB_COMP_PARAM ); } - /* hb_compGenPCodeN( ( BYTE * ) &pSym, sizeof( pSym ), HB_MACRO_PARAM ); */ + /* hb_compGenPCodeN( ( BYTE * ) &pSym, sizeof( pSym ), HB_COMP_PARAM ); */ } /* generates the pcode to push a long number on the virtual machine stack */ -void hb_compGenPushLong( HB_LONG lNumber, HB_MACRO_DECL ) +void hb_compGenPushLong( HB_LONG lNumber, HB_COMP_DECL ) { if( lNumber == 0 ) { - hb_compGenPCode1( HB_P_ZERO, HB_MACRO_PARAM ); + hb_compGenPCode1( HB_P_ZERO, HB_COMP_PARAM ); } else if( lNumber == 1 ) { - hb_compGenPCode1( HB_P_ONE, HB_MACRO_PARAM ); + hb_compGenPCode1( HB_P_ONE, HB_COMP_PARAM ); } else if( HB_LIM_INT8( lNumber ) ) { - hb_compGenPCode2( HB_P_PUSHBYTE, (BYTE) lNumber, HB_MACRO_PARAM ); + hb_compGenPCode2( HB_P_PUSHBYTE, (BYTE) lNumber, HB_COMP_PARAM ); } else if( HB_LIM_INT16( lNumber ) ) { - hb_compGenPCode3( HB_P_PUSHINT, HB_LOBYTE( lNumber ), HB_HIBYTE( lNumber ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_PUSHINT, HB_LOBYTE( lNumber ), HB_HIBYTE( lNumber ), HB_COMP_PARAM ); } else if( HB_LIM_INT32( lNumber ) ) { BYTE pBuffer[ 5 ]; pBuffer[ 0 ] = HB_P_PUSHLONG; HB_PUT_LE_UINT32( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_MACRO_PARAM ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } else { BYTE pBuffer[ 9 ]; pBuffer[ 0 ] = HB_P_PUSHLONGLONG; HB_PUT_LE_UINT64( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_MACRO_PARAM ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } } /* generates the pcode to push a date on the virtual machine stack */ -void hb_compGenPushDate( HB_LONG lNumber, HB_MACRO_DECL ) +void hb_compGenPushDate( HB_LONG lNumber, HB_COMP_DECL ) { BYTE pBuffer[ 5 ]; pBuffer[ 0 ] = HB_P_PUSHDATE; HB_PUT_LE_UINT32( pBuffer + 1, lNumber ); - hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_MACRO_PARAM ); + hb_compGenPCodeN( pBuffer, sizeof( pBuffer ), HB_COMP_PARAM ); } /* sends a message to an object */ -void hb_compGenMessage( char * szMsgName, BOOL bIsObject, HB_MACRO_DECL ) +void hb_compGenMessage( char * szMsgName, BOOL bIsObject, HB_COMP_DECL ) { /* Find the address of passed symbol - create the symbol if doesn't exist */ HB_DYNS_PTR pSym = hb_dynsymGet( szMsgName ); - hb_compGenPCode1( HB_P_MMESSAGE, HB_MACRO_PARAM ); + hb_compGenPCode1( HB_P_MMESSAGE, HB_COMP_PARAM ); { BYTE byBuf[ sizeof( HB_DYNS_PTR ) ]; HB_PUT_PTR( byBuf, pSym ); - hb_compGenPCodeN( byBuf, sizeof( pSym ), HB_MACRO_PARAM ); + hb_compGenPCodeN( byBuf, sizeof( pSym ), HB_COMP_PARAM ); } HB_SYMBOL_UNUSED( bIsObject ); /* used in full compiler only */ - /* hb_compGenPCodeN( ( BYTE * ) &pSym, sizeof( pSym ), HB_MACRO_PARAM ); */ + /* hb_compGenPCodeN( ( BYTE * ) &pSym, sizeof( pSym ), HB_COMP_PARAM ); */ } /* generates an underscore-symbol name for a data assignment */ -void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_MACRO_DECL ) +void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_COMP_DECL ) { char * szResult; @@ -1301,25 +1245,25 @@ void hb_compGenMessageData( char * szMsg, BOOL bIsObject, HB_MACRO_DECL ) strcpy( szResult, "_" ); strcat( szResult, szMsg ); - hb_compGenMessage( szResult, bIsObject, HB_MACRO_PARAM ); + hb_compGenMessage( szResult, bIsObject, HB_COMP_PARAM ); hb_xfree( szResult ); } /* generates the pcode to pop a value from the virtual machine stack onto a variable */ -void hb_compGenPopVar( char * szVarName, HB_MACRO_DECL ) +void hb_compGenPopVar( char * szVarName, HB_COMP_DECL ) { int iVar; - iVar = hb_compLocalVarGetPos( szVarName, HB_MACRO_PARAM ); + iVar = hb_compLocalVarGetPos( szVarName, HB_COMP_PARAM ); if( iVar ) { /* this is a codeblock parameter */ - hb_compGenPCode3( HB_P_POPLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_POPLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); } else { - hb_compMemvarGenPCode( HB_P_MPOPMEMVAR, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPOPMEMVAR, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } } @@ -1329,7 +1273,7 @@ void hb_compGenPopVar( char * szVarName, HB_MACRO_DECL ) void hb_compGenPopAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, - long lWorkarea, HB_MACRO_DECL ) + long lWorkarea, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compGenPopAliasedVar(%s->%s)",szAlias,szVarName)); @@ -1342,23 +1286,23 @@ void hb_compGenPopAliasedVar( char * szVarName, if( szAlias[ 0 ] == 'M' && ( iLen == 1 || ( iLen >= 4 && iLen <= 6 && strncmp( szAlias, "MEMVAR", iLen ) == 0 ) ) ) { /* M-> or MEMV-> or MEMVA-> or MEMVAR-> variable */ - hb_compMemvarGenPCode( HB_P_MPOPMEMVAR, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPOPMEMVAR, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } else if( iLen >= 4 && iLen <= 5 && strncmp( szAlias, "FIELD", iLen ) == 0 ) { /* FIELD-> */ - hb_compMemvarGenPCode( HB_P_MPOPFIELD, szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPOPFIELD, szVarName, HB_COMP_PARAM ); } else { /* database alias */ - hb_compGenPushSymbol( szAlias, FALSE, TRUE, HB_MACRO_PARAM ); - hb_compMemvarGenPCode( HB_P_MPOPALIASEDFIELD, szVarName, HB_MACRO_PARAM ); + hb_compGenPushSymbol( szAlias, FALSE, TRUE, HB_COMP_PARAM ); + hb_compMemvarGenPCode( HB_P_MPOPALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } else { - hb_compGenPushLong( lWorkarea, HB_MACRO_PARAM ); - hb_compMemvarGenPCode( HB_P_MPOPALIASEDFIELD, szVarName, HB_MACRO_PARAM ); + hb_compGenPushLong( lWorkarea, HB_COMP_PARAM ); + hb_compMemvarGenPCode( HB_P_MPOPALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } else @@ -1367,45 +1311,45 @@ void hb_compGenPopAliasedVar( char * szVarName, * NOTE: An alias will be determined at runtime then we cannot decide * here if passed name is either a field or a memvar */ - hb_compMemvarGenPCode( HB_P_MPOPALIASEDVAR, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPOPALIASEDVAR, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } } /* generates the pcode to push a nonaliased variable value to the virtual * machine stack */ -void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_MACRO_DECL ) +void hb_compGenPushVar( char * szVarName, BOOL bMacroVar, HB_COMP_DECL ) { int iVar; HB_SYMBOL_UNUSED( bMacroVar ); - iVar = hb_compLocalVarGetPos( szVarName, HB_MACRO_PARAM ); + iVar = hb_compLocalVarGetPos( szVarName, HB_COMP_PARAM ); if( iVar ) { /* this is a codeblock parameter */ - hb_compGenPCode3( HB_P_PUSHLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_PUSHLOCAL, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); } else { - hb_compMemvarGenPCode( HB_P_MPUSHVARIABLE, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHVARIABLE, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } } /* generates the pcode to push a variable by reference to the virtual machine stack */ -void hb_compGenPushVarRef( char * szVarName, HB_MACRO_DECL ) +void hb_compGenPushVarRef( char * szVarName, HB_COMP_DECL ) { USHORT iVar; - iVar = hb_compLocalVarGetPos( szVarName, HB_MACRO_PARAM ); + iVar = hb_compLocalVarGetPos( szVarName, HB_COMP_PARAM ); if( iVar ) - hb_compGenPCode3( HB_P_PUSHLOCALREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_PUSHLOCALREF, HB_LOBYTE( iVar ), HB_HIBYTE( iVar ), HB_COMP_PARAM ); else { - hb_compMemvarGenPCode( HB_P_MPUSHMEMVARREF, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHMEMVARREF, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } } @@ -1415,7 +1359,7 @@ void hb_compGenPushVarRef( char * szVarName, HB_MACRO_DECL ) void hb_compGenPushAliasedVar( char * szVarName, BOOL bPushAliasValue, char * szAlias, - long lWorkarea, HB_MACRO_DECL ) + long lWorkarea, HB_COMP_DECL ) { HB_TRACE(HB_TR_DEBUG, ("hb_compGenPushAliasedVar(%s->%s)",szAlias,szVarName)); @@ -1432,23 +1376,23 @@ void hb_compGenPushAliasedVar( char * szVarName, if( szAlias[ 0 ] == 'M' && ( iLen == 1 || ( iLen >= 4 && iLen <= 6 && strncmp( szAlias, "MEMVAR", iLen ) == 0 ) ) ) { /* M-> or MEMV-> or MEMVA-> or MEMVAR-> variable */ - hb_compMemvarGenPCode( HB_P_MPUSHMEMVAR, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHMEMVAR, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } else if( iLen >= 4 && iLen <= 5 && strncmp( szAlias, "FIELD", iLen ) == 0 ) { /* FIELD-> */ - hb_compMemvarGenPCode( HB_P_MPUSHFIELD, szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHFIELD, szVarName, HB_COMP_PARAM ); } else { /* database alias */ - hb_compGenPushSymbol( szAlias, FALSE, TRUE, HB_MACRO_PARAM ); - hb_compMemvarGenPCode( HB_P_MPUSHALIASEDFIELD, szVarName, HB_MACRO_PARAM ); + hb_compGenPushSymbol( szAlias, FALSE, TRUE, HB_COMP_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } else { - hb_compGenPushLong( lWorkarea, HB_MACRO_PARAM ); - hb_compMemvarGenPCode( HB_P_MPUSHALIASEDFIELD, szVarName, HB_MACRO_PARAM ); + hb_compGenPushLong( lWorkarea, HB_COMP_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHALIASEDFIELD, szVarName, HB_COMP_PARAM ); } } else @@ -1457,22 +1401,22 @@ void hb_compGenPushAliasedVar( char * szVarName, * NOTE: An alias will be determined at runtime then we cannot decide * here if passed name is either a field or a memvar */ - hb_compMemvarGenPCode( HB_P_MPUSHALIASEDVAR, szVarName, HB_MACRO_PARAM ); - hb_compMemvarCheck( szVarName, HB_MACRO_PARAM ); + hb_compMemvarGenPCode( HB_P_MPUSHALIASEDVAR, szVarName, HB_COMP_PARAM ); + hb_compMemvarCheck( szVarName, HB_COMP_PARAM ); } } /* pushes a logical value on the virtual machine stack , */ -void hb_compGenPushLogical( int iTrueFalse, HB_MACRO_DECL ) +void hb_compGenPushLogical( int iTrueFalse, HB_COMP_DECL ) { if( iTrueFalse ) - hb_compGenPCode1( HB_P_TRUE, HB_MACRO_PARAM ); + hb_compGenPCode1( HB_P_TRUE, HB_COMP_PARAM ); else - hb_compGenPCode1( HB_P_FALSE, HB_MACRO_PARAM ); + hb_compGenPCode1( HB_P_FALSE, HB_COMP_PARAM ); } /* generates the pcode to push a double number on the virtual machine stack */ -void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_MACRO_DECL ) +void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_COMP_DECL ) { BYTE pBuffer[ sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ) + 1 ]; @@ -1481,10 +1425,10 @@ void hb_compGenPushDouble( double dNumber, BYTE bWidth, BYTE bDec, HB_MACRO_DECL pBuffer[ 1 + sizeof( double ) ] = bWidth; pBuffer[ 1 + sizeof( double ) + sizeof( BYTE ) ] = bDec; - hb_compGenPCodeN( pBuffer, 1 + sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ), HB_MACRO_PARAM ); + hb_compGenPCodeN( pBuffer, 1 + sizeof( double ) + sizeof( BYTE ) + sizeof( BYTE ), HB_COMP_PARAM ); } -void hb_compGenPushFunCall( char * szFunName, HB_MACRO_DECL ) +void hb_compGenPushFunCall( char * szFunName, HB_COMP_DECL ) { char * szFunction; @@ -1493,24 +1437,24 @@ void hb_compGenPushFunCall( char * szFunName, HB_MACRO_DECL ) { /* Abbreviated function name was used - change it for whole name */ - hb_compGenPushSymbol( szFunction, TRUE, FALSE, HB_MACRO_PARAM ); + hb_compGenPushSymbol( szFunction, TRUE, FALSE, HB_COMP_PARAM ); } else { HB_MACRO_DATA->status |= HB_MACRO_UDF; /* this is used in hb_macroGetType */ - hb_compGenPushSymbol( szFunName, TRUE, FALSE, HB_MACRO_PARAM ); + hb_compGenPushSymbol( szFunName, TRUE, FALSE, HB_COMP_PARAM ); } } /* generates the pcode to push a string on the virtual machine stack */ -void hb_compGenPushString( char * szText, ULONG ulStrLen, HB_MACRO_DECL ) +void hb_compGenPushString( char * szText, ULONG ulStrLen, HB_COMP_DECL ) { - hb_compGenPCode3( HB_P_MPUSHSTR, HB_LOBYTE( ulStrLen ), HB_HIBYTE( ulStrLen ), HB_MACRO_PARAM ); - hb_compGenPCodeN( ( BYTE * ) szText, ulStrLen, HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_MPUSHSTR, HB_LOBYTE( ulStrLen ), HB_HIBYTE( ulStrLen ), HB_COMP_PARAM ); + hb_compGenPCodeN( ( BYTE * ) szText, ulStrLen, HB_COMP_PARAM ); } -void hb_compGenPCode1( BYTE byte, HB_MACRO_DECL ) +void hb_compGenPCode1( BYTE byte, HB_COMP_DECL ) { HB_PCODE_INFO_PTR pFunc = HB_PCODE_DATA; @@ -1520,7 +1464,7 @@ void hb_compGenPCode1( BYTE byte, HB_MACRO_DECL ) pFunc->pCode[ pFunc->lPCodePos++ ] = byte; } -void hb_compGenPCode2( BYTE byte1, BYTE byte2, HB_MACRO_DECL ) +void hb_compGenPCode2( BYTE byte1, BYTE byte2, HB_COMP_DECL ) { HB_PCODE_INFO_PTR pFunc = HB_PCODE_DATA; @@ -1531,7 +1475,7 @@ void hb_compGenPCode2( BYTE byte1, BYTE byte2, HB_MACRO_DECL ) pFunc->pCode[ pFunc->lPCodePos++ ] = byte2; } -void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, HB_MACRO_DECL ) +void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, HB_COMP_DECL ) { HB_PCODE_INFO_PTR pFunc = HB_PCODE_DATA; @@ -1543,7 +1487,7 @@ void hb_compGenPCode3( BYTE byte1, BYTE byte2, BYTE byte3, HB_MACRO_DECL ) pFunc->pCode[ pFunc->lPCodePos++ ] = byte3; } -void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, HB_MACRO_DECL ) +void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, HB_COMP_DECL ) { HB_PCODE_INFO_PTR pFunc = HB_PCODE_DATA; @@ -1556,7 +1500,7 @@ void hb_compGenPCode4( BYTE byte1, BYTE byte2, BYTE byte3, BYTE byte4, HB_MACRO_ pFunc->pCode[ pFunc->lPCodePos++ ] = byte4; } -void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_MACRO_DECL ) +void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_COMP_DECL ) { HB_PCODE_INFO_PTR pFunc = HB_PCODE_DATA; @@ -1573,7 +1517,7 @@ void hb_compGenPCodeN( BYTE * pBuffer, ULONG ulSize, HB_MACRO_DECL ) /* ************************************************************************* */ -void hb_macroError( int iError, HB_MACRO_DECL ) +void hb_macroError( int iError, HB_COMP_DECL ) { HB_MACRO_DATA->status |= iError; HB_MACRO_DATA->status &= ~HB_MACRO_CONT; /* clear CONT bit */ @@ -1582,11 +1526,11 @@ void hb_macroError( int iError, HB_MACRO_DECL ) /* * Start a new pcode buffer for a codeblock */ -void hb_compCodeBlockStart( HB_MACRO_DECL ) +void hb_compCodeBlockStart( HB_COMP_DECL ) { HB_PCODE_INFO_PTR pCB; - HB_TRACE(HB_TR_DEBUG, ("hb_macroCodeBlockStart(%p)", HB_MACRO_PARAM)); + HB_TRACE(HB_TR_DEBUG, ("hb_macroCodeBlockStart(%p)", HB_COMP_PARAM)); pCB = ( HB_PCODE_INFO_PTR ) hb_xgrab( sizeof( HB_PCODE_INFO ) ); @@ -1595,21 +1539,21 @@ void hb_compCodeBlockStart( HB_MACRO_DECL ) pCB->pPrev = HB_PCODE_DATA; HB_PCODE_DATA = pCB; - HB_TRACE(HB_TR_DEBUG, ("hb_macroCodeBlockStart.(%p)", HB_MACRO_PARAM)); + HB_TRACE(HB_TR_DEBUG, ("hb_macroCodeBlockStart.(%p)", HB_COMP_PARAM)); pCB->pCode = ( BYTE * ) hb_xgrab( HB_PCODE_SIZE ); pCB->lPCodeSize = HB_PCODE_SIZE; pCB->lPCodePos = 0; pCB->pLocals = NULL; } -void hb_compCodeBlockEnd( HB_MACRO_DECL ) +void hb_compCodeBlockEnd( HB_COMP_DECL ) { HB_PCODE_INFO_PTR pCodeblock; /* pointer to the current codeblock */ USHORT wSize; USHORT wParms = 0; /* number of codeblock parameters */ HB_CBVAR_PTR pVar; - HB_TRACE(HB_TR_DEBUG, ("hb_macroCodeBlockEnd(%p)", HB_MACRO_PARAM)); + HB_TRACE(HB_TR_DEBUG, ("hb_macroCodeBlockEnd(%p)", HB_COMP_PARAM)); /* a currently processed codeblock */ pCodeblock = HB_PCODE_DATA; @@ -1643,13 +1587,13 @@ void hb_compCodeBlockEnd( HB_MACRO_DECL ) /*NOTE: HB_P_MPUSHBLOCK differs from HB_P_PUSHBLOCK - the pcode * is stored in dynamic memory pool instead of static memory */ - hb_compGenPCode3( HB_P_MPUSHBLOCK, HB_LOBYTE( wSize ), HB_HIBYTE( wSize ), HB_MACRO_PARAM ); - hb_compGenPCode1( HB_LOBYTE( wParms ), HB_MACRO_PARAM ); - hb_compGenPCode1( HB_HIBYTE( wParms ), HB_MACRO_PARAM ); + hb_compGenPCode3( HB_P_MPUSHBLOCK, HB_LOBYTE( wSize ), HB_HIBYTE( wSize ), HB_COMP_PARAM ); + hb_compGenPCode1( HB_LOBYTE( wParms ), HB_COMP_PARAM ); + hb_compGenPCode1( HB_HIBYTE( wParms ), HB_COMP_PARAM ); /* copy a codeblock pcode buffer */ - hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, HB_MACRO_PARAM ); - hb_compGenPCode1( HB_P_ENDBLOCK, HB_MACRO_PARAM ); /* finish the codeblock */ + hb_compGenPCodeN( pCodeblock->pCode, pCodeblock->lPCodePos, HB_COMP_PARAM ); + hb_compGenPCode1( HB_P_ENDBLOCK, HB_COMP_PARAM ); /* finish the codeblock */ /* free memory allocated for a codeblock */ hb_xfree( ( void * ) pCodeblock->pCode ); diff --git a/harbour/utils/hbpp/hbpp.c b/harbour/utils/hbpp/hbpp.c index db8c592794..8c85bf3fe0 100644 --- a/harbour/utils/hbpp/hbpp.c +++ b/harbour/utils/hbpp/hbpp.c @@ -449,10 +449,12 @@ static void AddSearchPath( char * szPath, HB_PATHNAMES * * pSearchList ) pPath->szPath = szPath; } -void hb_compGenError( char * _szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) +void hb_compGenError( HB_COMP_DECL, char * _szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) { HB_TRACE(HB_TR_DEBUG, ("hb_compGenError(%p, %c, %d, %s, %s)", _szErrors, cPrefix, iError, szError1, szError2)); + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); + printf( "\r(%i) ", hb_comp_iLine ); printf( "Error %c%04i ", cPrefix, iError ); printf( _szErrors[ iError - 1 ], szError1, szError2 ); @@ -463,10 +465,12 @@ void hb_compGenError( char * _szErrors[], char cPrefix, int iError, const char * */ } -void hb_compGenWarning( char* _szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2) +void hb_compGenWarning( HB_COMP_DECL, char* _szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2) { HB_TRACE(HB_TR_DEBUG, ("hb_compGenWarning(%p, %c, %d, %s, %s)", _szWarnings, cPrefix, iWarning, szWarning1, szWarning2)); + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); + if( s_iWarnings ) { char *szText = _szWarnings[ iWarning - 1 ]; @@ -488,7 +492,7 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail HB_TRACE(HB_TR_DEBUG, ("hb_xgrab(%lu)", ulSize)); if( ! pMem ) - hb_compGenError( hb_pp_szErrors, 'P', HB_PP_ERR_MEMALLOC, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'P', HB_PP_ERR_MEMALLOC, NULL, NULL ); return pMem; } @@ -500,7 +504,7 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ HB_TRACE(HB_TR_DEBUG, ("hb_xrealloc(%p, %lu)", pMem, ulSize)); if( ! pResult ) - hb_compGenError( hb_pp_szErrors, 'P', HB_PP_ERR_MEMREALLOC, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'P', HB_PP_ERR_MEMREALLOC, NULL, NULL ); return pResult; } @@ -512,7 +516,7 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ if( pMem ) free( pMem ); else - hb_compGenError( hb_pp_szErrors, 'P', HB_PP_ERR_MEMFREE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'P', HB_PP_ERR_MEMFREE, NULL, NULL ); } BOOL hb_pp_fopen( char * szFileName ) diff --git a/harbour/utils/hbpp/hbpp.h b/harbour/utils/hbpp/hbpp.h index f816ffef12..7555b492ed 100644 --- a/harbour/utils/hbpp/hbpp.h +++ b/harbour/utils/hbpp/hbpp.h @@ -131,6 +131,19 @@ extern void hb_pp_Stuff( char *, char *, int, int, int ); extern int hb_pp_strocpy( char *, char * ); extern DEFINES * hb_pp_AddDefine_( char *, char * ); /* Add new #define to a linked list */ +extern PHB_FNAME hb_comp_pFileName; +extern BOOL hb_comp_bQuiet; +extern BOOL hb_comp_bStartProc; +extern BOOL hb_comp_bAutoMemvarAssume; +extern BOOL hb_comp_bForceMemvars; +extern BOOL hb_comp_bShortCuts; +extern BOOL hb_comp_bDebugInfo; +extern BOOL hb_comp_bLineNumbers; +extern int hb_comp_iExitLevel; +extern int hb_comp_iWarnings; +extern int hb_comp_iLine; +extern int hb_comp_iLineINLINE; +extern int hb_comp_iLinePRG; extern int hb_pp_lInclude; extern int * hb_pp_aCondCompile; extern int hb_pp_nCondCompile; @@ -151,17 +164,10 @@ extern FILE * hb_comp_yyppo; extern int hb_pp_Internal_( FILE *, char * ); extern void hb_pp_InternalFree( void ); -#if 0 #define HB_PP_STREAM_DUMP_C 1 /* pragma BEGINDUMP */ #define HB_PP_STREAM_CLIPPER 2 /* clipper compatible TEXT/ENDTEXT */ #define HB_PP_STREAM_PRG 4 /* TEXT/ENDTEXT lines joined with LF */ #define HB_PP_STREAM_C 8 /* TEXT/ENDTEXT lines joined and ESC seq processed */ -#else -#define HB_PP_STREAM_DUMP_C 2 /* pragma BEGINDUMP */ -#define HB_PP_STREAM_CLIPPER 3 /* clipper compatible TEXT/ENDTEXT */ -#define HB_PP_STREAM_PRG 4 /* TEXT/ENDTEXT lines joined with LF */ -#define HB_PP_STREAM_C 5 /* TEXT/ENDTEXT lines joined and ESC seq processed */ -#endif extern BOOL hb_pp_StreamBlockBegin( char *, int ); extern void hb_pp_BlockEnd( void ); diff --git a/harbour/utils/hbpp/hbppcomp.c b/harbour/utils/hbpp/hbppcomp.c index 3db4912c2c..5541db57c8 100644 --- a/harbour/utils/hbpp/hbppcomp.c +++ b/harbour/utils/hbpp/hbppcomp.c @@ -153,7 +153,7 @@ int hb_pp_Internal_( FILE * handl_o, char * sOut ) if( lens >= HB_PP_STR_SIZE-2 ) { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); } if( hb_pp_StreamBlock ) diff --git a/harbour/utils/hbpp/hbppcore.c b/harbour/utils/hbpp/hbppcore.c index 785ad61a4d..35f47f6d66 100644 --- a/harbour/utils/hbpp/hbppcore.c +++ b/harbour/utils/hbpp/hbppcore.c @@ -270,7 +270,7 @@ void hb_pp_SetRules_( HB_INCLUDE_FUNC_PTR pIncludeFunc, BOOL bQuiet ) } else { - hb_compGenWarning( hb_pp_szWarnings, 'I', HB_PP_WARN_NO_DIRECTIVES, NULL /*szFileName */ , NULL ); + hb_compGenWarning( NULL, hb_pp_szWarnings, 'I', HB_PP_WARN_NO_DIRECTIVES, NULL /*szFileName */ , NULL ); } fclose( hb_comp_files.pLast->handle ); @@ -285,12 +285,12 @@ void hb_pp_SetRules_( HB_INCLUDE_FUNC_PTR pIncludeFunc, BOOL bQuiet ) } else { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN_RULES, szFileName, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN_RULES, szFileName, NULL ); } } else { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BAD_RULES_FILE_NAME, hb_pp_STD_CH, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_BAD_RULES_FILE_NAME, hb_pp_STD_CH, NULL ); } } else @@ -513,7 +513,7 @@ int hb_pp_ParseDirective_( char *sLine ) if( i == 4 && memcmp( sDirective, "ELSE", 4 ) == 0 ) { /* --- #else --- */ if( hb_pp_nCondCompile == 0 ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_DIRECTIVE_ELSE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_DIRECTIVE_ELSE, NULL, NULL ); else if( hb_pp_nCondCompile == 1 || hb_pp_aCondCompile[hb_pp_nCondCompile - 2] ) hb_pp_aCondCompile[hb_pp_nCondCompile - 1] = 1 - hb_pp_aCondCompile[hb_pp_nCondCompile - 1]; } @@ -521,7 +521,7 @@ int hb_pp_ParseDirective_( char *sLine ) else if( i >= 4 && i <= 5 && memcmp( sDirective, "ENDIF", i ) == 0 ) { /* --- #endif --- */ if( hb_pp_nCondCompile == 0 ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_DIRECTIVE_ENDIF, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_DIRECTIVE_ENDIF, NULL, NULL ); else hb_pp_nCondCompile--; } @@ -539,7 +539,7 @@ int hb_pp_ParseDirective_( char *sLine ) char cDelimChar; if( *sLine != '\"' && *sLine != '\'' && *sLine != '<' ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_NAME, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_NAME, NULL, NULL ); cDelimChar = *sLine; if( cDelimChar == '<' ) @@ -552,19 +552,19 @@ int hb_pp_ParseDirective_( char *sLine ) while( *( sLine + i ) != '\0' && *( sLine + i ) != cDelimChar ) i++; if( *( sLine + i ) != cDelimChar ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_NAME, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_NAME, NULL, NULL ); *( sLine + i ) = '\0'; if( !OpenInclude( sLine, hb_comp_pIncludePath, hb_comp_pFileName, ( cDelimChar == '>' ), szInclude ) ) { if( errno == 0 || errno == EMFILE ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, sLine, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_TOO_MANY_INCLUDES, sLine, NULL ); else { #if defined(__CYGWIN__) || defined(__IBMCPP__) || defined(__LCC__) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, "" ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, "" ); #else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, strerror( errno ) ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_CANNOT_OPEN, sLine, strerror( errno ) ); #endif } } @@ -591,7 +591,7 @@ int hb_pp_ParseDirective_( char *sLine ) else if( i >= 4 && i <= 5 && memcmp( sDirective, "ERROR", i ) == 0 ) /* --- #error --- */ - hb_compGenError( hb_pp_szErrors, 'E', HB_PP_ERR_EXPLICIT, sLine, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'E', HB_PP_ERR_EXPLICIT, sLine, NULL ); else if( i == 4 && memcmp( sDirective, "LINE", 4 ) == 0 ) return -1; @@ -602,7 +602,7 @@ int hb_pp_ParseDirective_( char *sLine ) bIgnore = hb_pp_ParsePragma( sParse ); /* --- #pragma --- */ } else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_DIRECTIVE, sDirective, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_WRONG_DIRECTIVE, sDirective, NULL ); } return bIgnore; } @@ -651,7 +651,7 @@ int hb_pp_ParseDefine_( char *sLine ) { cPos--; if( *cPos == '\001' ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_DUPL_IN_DEFINE, defname, pars ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_DUPL_IN_DEFINE, defname, pars ); } cParams = ( char * ) hb_xrealloc( cParams, iParLen + iLen + 3 ); cParams[iParLen++] = ','; @@ -664,19 +664,19 @@ int hb_pp_ParseDefine_( char *sLine ) HB_SKIPTABSPACES( sLine ); } else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_MISSING_IN_DEFINE, defname, NULL ); + hb_compGenError( NULL, 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 ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_LABEL_MISSING_IN_DEFINE, defname, NULL ); } } HB_SKIPTABSPACES( sLine ); if( *sLine == '\0' ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PARE_MISSING_IN_DEFINE, defname, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PARE_MISSING_IN_DEFINE, defname, NULL ); sLine++; } @@ -725,7 +725,7 @@ int hb_pp_ParseDefine_( char *sLine ) hb_xfree( cParams ); } else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_DEFINE_ABSENT, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_DEFINE_ABSENT, NULL, NULL ); return 0; } @@ -742,7 +742,7 @@ DEFINES *hb_pp_AddDefine_( char *defname, char *value ) if( stdef != NULL ) { - hb_compGenWarning( hb_pp_szWarnings, 'I', HB_PP_WARN_DEFINE_REDEF, defname, NULL ); + hb_compGenWarning( NULL, hb_pp_szWarnings, 'I', HB_PP_WARN_DEFINE_REDEF, defname, NULL ); if( isNew ) { @@ -815,7 +815,7 @@ static int ParseIfdef( char *sLine, int usl ) { len = NextWord( &sLine, defname, FALSE ); if( *defname == '\0' ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_DEFINE_ABSENT, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_DEFINE_ABSENT, NULL, NULL ); } if( hb_pp_nCondCompile == s_maxCondCompile ) { @@ -1042,7 +1042,7 @@ static void ParseCommand( char *sLine, BOOL com_or_xcom, BOOL com_or_tra ) else { sLine -= ( ipos + 1 ); - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_COMMAND_DEFINITION, cmdname, sLine ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_COMMAND_DEFINITION, cmdname, sLine ); } #if defined(HB_PP_DEBUG_MEMORY) hb_xfree( ( void * ) mpatt ); @@ -1122,7 +1122,7 @@ static int ConvertOptional( char *cpatt, int len, BOOL bLeft ) if( iOpenBrackets ) { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, cpatt + i, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, cpatt + i, NULL ); } } } @@ -1255,7 +1255,7 @@ static void ConvertPatterns( char *mpatt, int mlen, char *rpatt, int rlen ) { if( *ptr == '\0' || *ptr == '<' || *ptr == '[' || *ptr == ']' ) { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); return; } ptr++; @@ -1286,21 +1286,21 @@ static void ConvertPatterns( char *mpatt, int mlen, char *rpatt, int rlen ) if( *( exppatt + explen - 1 ) == '*' ) explen--; else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); } else if( exptype == '4' ) { if( *( exppatt + explen - 1 ) == ')' ) explen--; else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); } else if( exptype == '5' ) { if( *( exppatt + explen - 1 ) == '!' ) explen--; else - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PATTERN_DEFINITION, NULL, NULL ); } rmlen = i - ipos + 1; @@ -1659,7 +1659,7 @@ int hb_pp_ParseExpression( char *sLine, char *sOutLine, BOOL bSplitLines ) if( kolpass > hb_pp_MaxTranslateCycles && ( rezDef || rezTra || rezCom ) ) { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_RECURSE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_RECURSE, NULL, NULL ); break; } } @@ -3016,7 +3016,7 @@ static int getExpReal( char *expreal, char **ptri, BOOL prlist, int maxrez, BOOL } if( !rez && lens >= maxrez ) { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); } if( expreal != NULL && expreal > cStart ) @@ -3341,7 +3341,7 @@ static void SearnRep( char *exppatt, char *expreal, int lenreal, char *ptro, int } else { - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL ); return; } *( s_expcopy + lennew++ ) = ' '; diff --git a/harbour/utils/hbpp/hbpplib.c b/harbour/utils/hbpp/hbpplib.c index f896bf6573..a1180561a1 100644 --- a/harbour/utils/hbpp/hbpplib.c +++ b/harbour/utils/hbpp/hbpplib.c @@ -217,11 +217,12 @@ HB_FUNC( __PREPROCESS ) hb_retc( NULL ); } -void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) +void hb_compGenError( HB_COMP_DECL, char * szErrors[], char cPrefix, int iError, const char * szError1, const char * szError2 ) { PHB_ITEM pError; char buffer[ 128 ]; + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); HB_SYMBOL_UNUSED( cPrefix ); HB_TRACE(HB_TR_DEBUG, ("hb_compGenError(%p, %c, %d, %s, %s)", szErrors, cPrefix, iError, szError1, szError2)); @@ -237,12 +238,13 @@ void hb_compGenError( char * szErrors[], char cPrefix, int iError, const char * /* longjmp( s_env, iError == 0 ? -1 : iError ); */ } -void hb_compGenWarning( char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2 ) +void hb_compGenWarning( HB_COMP_DECL, char * szWarnings[], char cPrefix, int iWarning, const char * szWarning1, const char * szWarning2 ) { HB_TRACE(HB_TR_DEBUG, ("hb_compGenWarning(%p, %c, %d, %s, %s)", szWarnings, cPrefix, iWarning, szWarning1, szWarning2)); /* NOTE: All warnings are simply ignored */ + HB_SYMBOL_UNUSED( HB_COMP_PARAM ); HB_SYMBOL_UNUSED( szWarnings ); HB_SYMBOL_UNUSED( cPrefix ); HB_SYMBOL_UNUSED( iWarning ); diff --git a/harbour/utils/hbpp/pragma.c b/harbour/utils/hbpp/pragma.c index f49d692fa4..9366c3c64d 100644 --- a/harbour/utils/hbpp/pragma.c +++ b/harbour/utils/hbpp/pragma.c @@ -124,7 +124,7 @@ BOOL hb_pp_ParsePragma( char * szLine ) break; default: - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); } DebugPragma( szLine, hb_comp_iExitLevel, FALSE ); } @@ -168,7 +168,7 @@ BOOL hb_pp_ParsePragma( char * szLine ) /* There is -w<0,1,2,3> probably */ hb_comp_iWarnings = szLine[ 2 ] - '0'; if( hb_comp_iWarnings < 0 || hb_comp_iWarnings > 3 ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); DebugPragma( szLine, -1, hb_comp_iWarnings ); } @@ -277,7 +277,7 @@ BOOL hb_pp_ParsePragma( char * szLine ) if( hb_comp_iExitLevel != HB_EXITLEVEL_DEFAULT && hb_comp_iExitLevel != HB_EXITLEVEL_SETEXIT && hb_comp_iExitLevel != HB_EXITLEVEL_DELTARGET ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); DebugPragma( szLine, hb_comp_iExitLevel, FALSE ); } else if( hb_strnicmp( szLine, "DYNAMICMEMVAR", PRAGMAS_LEN ) == 0 ) @@ -309,7 +309,7 @@ BOOL hb_pp_ParsePragma( char * szLine ) { hb_comp_iWarnings = StringToInt( szLine, hb_comp_iWarnings ); if( hb_comp_iWarnings < 0 || hb_comp_iWarnings > 3 ) - hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + hb_compGenError( NULL, hb_pp_szErrors, 'F', HB_PP_ERR_PRAGMA_BAD_VALUE, NULL, NULL ); DebugPragma( szLine, hb_comp_iWarnings, FALSE ); } else if( hb_strnicmp( szLine, "TRACEPRAGMAS", PRAGMAS_LEN ) == 0 )