* harbour/bin/hb-func.sh
+ added linker parametrs to hbcc
* harbour/include/hbapi.h
+ added hb_retclenAdoptRaw()
* harbour/include/hbapifs.h
* harbour/source/common/hbfsapi.c
* changed first parameters of hb_fsAddSearchPath() to const char *
* harbour/include/hbclass.ch
* update for new PP. I think that now we can try to create final
version of our OOP rules.
* harbour/include/hbdefs.h
+ added UCHAR and SCHAR typedefs
* harbour/include/hbrddcdx.h
* indenting
* harbour/source/rdd/workarea.c
! fixed minor typo
* harbour/source/common/hbdate.c
* harbour/source/rtl/dates.c
* moved hb_dateToday() and hb_dateTimeStr() from RTL to COMMON library
- harbour/include/hbpp.h
- harbour/source/pp/ppcomp.c
- harbour/source/pp/ppcore.c
- harbour/source/pp/pplib.c
- harbour/source/pp/pptable.c
- harbour/source/pp/pragma.c
* harbour/utils/hbpp/Makefile
* harbour/utils/hbpp/hbpp.c
+ harbour/utils/hbpp/hbpp.h
+ harbour/utils/hbpp/ppcomp.c
+ harbour/utils/hbpp/ppcore.c
+ harbour/utils/hbpp/pplib.c
+ harbour/utils/hbpp/pptable.c
+ harbour/utils/hbpp/pragma.c
* moved all PP code to harbour/utils/hbpp
It's interesting and working preprocessor and the code can be
usable for some other things so I do not want to remove it.
Probablly we should move it to contrib/hbpptext
* harbour/include/hbcomp.h
* harbour/include/hberrors.h
* harbour/include/hbsetup.ch
+ harbour/include/hbpp.h
+ harbour/include/hbstdgen.ch
* harbour/source/common/hbstr.c
* harbour/source/compiler/Makefile
* harbour/source/compiler/cmdcheck.c
* harbour/source/compiler/harbour.c
* harbour/source/compiler/harbour.l
* harbour/source/compiler/hbgenerr.c
+ harbour/source/compiler/ppcomp.c
* harbour/source/pp/Makefile
+ harbour/source/pp/ppcore.c
+ harbour/source/pp/pplib.c
+ harbour/source/pp/ppgen.c
+ New PP code written from scratch. It works in similar way to
Clipper PP even the error codes are replicated. The code is MT
safe does not have any limitation on size of preprocessed code,
line, etc. It's also Clipper compatible lexer. It means that
we do not longer need FLEX or SIMPLEX which can be replaced
by new PP after some small modifications. Anyhow I haven't
decided to make it myself. I would like to agree with with the
rest of developers. I will be very happy if such modifications
will be done by someone else, Ryszard?
Meanwhile I current PP join on output the line tokens and give
the string line to FLEX/SIMPLEX. It does not have any sense and
all FLEX/SIMPLEX limitations are still existing. Ryszard, even
if we keep it then I hope you can remove at least FLEX line buffer
and use the one returned from PP.
Because string tokens in parsed line are converted to text which is
later once again decoded to tokens by FLEX I had to introduce new
string format which supports embedded string delimiters. I chose
modified version of xHarbour extension with escaped strings e"<sting>"
so now FLEX understand such strings and decode them like C escaped
strings. It means that you can use them also in the .prg code f.e.:
outstd( e"Hello\n\rWorld" )
The new PP is also noticeable faster. You should see the difference
compiling long files. The build in PP rules are generated automatically
by ppgen program created from source/pp/ppgen.c
I had to add to GNU source/pp/Makefile these two lines:
pptable.c : ppgen$(EXE_EXT)
./ppgen$(EXE_EXT) $(TOP)$(ROOT)include/hbstdgen.ch -opptable.c -q
Sth like that will have to be done also in non GNU make system.
Now Harbour can be compiled only using GNU make.
Marek can you update non GNU make files? I would like to leave this
modification to you or other developers who can test it.
It was quite big modification and I do not believe that I haven't
make any mistakes but I hope that in few weeks I'll fix any reported
bugs and it will resolve any PP problems.
TODO:
* error messages
create one common list of errors and warnings and keep it
in common library. PP and compiler can still generate different
errors with the same number. It can be confusing for the users
and hard to document and add i18n translations.
If possible we should also try to keep Clipper error numbers.
In new PP code I added Clipper error numbers but I cannot use
them until compiler code is not updated.
We should aslo remove the ctype passed to error functions and
hack with first character in warning messages and use only
error number. The codes from 1000 to 1999 should be warnings
where range 1000:1099 is activated by -w, 1100:1199 by -w1,
1200:1299 by -w2, etc. 2000:2999 are errors and 3000:3999
fatal errors. All compiler functions which generate an error
should expect that error function will not stop the compiler
but return and cleanly finished their job. It's necessary for
MT support in compiler and making compiler part of some other
programs which may still work and compile different source code.
* FLEX/SIMPLEX
remove them at all and add some final pass to PP to create
more precise tokens for grammar parser or at least add better
integration to remove some redundant code and existing limits.
* hb_inLine() support - it's broken in new PP but as I can see
it was never working correctly. I can add a hack to PP to support
hb_inLine() but I'm not sure it's worth to do. Maybe in few days.
+ harbour/include/std.ch
+ added new std.ch. It was created without using Clipper's std.ch.
It's quite possible that some rules are wrong and should be fixed
so please help. Anyhow I created a set of programs based on new PP
code generating all possible combinations of different commands I
collected from different source code, documentation and match patterns
of rules I was adding to new std.ch and then I was comparing .ppo
files generated by Clipper and Harbour so I do not expect any bigger
problems then some minor typos. I had to introduce some modifications
in spacing as workaround for FLEX/SIMPLEX which cannot properly decode
text preprocessed by Clipper after stringify.
* harbour/utils/hbpptest/pretest.prg
* updated for new PP
It reports 16 wrong translations but some of them are valid
and some others are caused by escaped string e"..." (one of hack
for FLEX/SIMPLEX support)
I also had to remove all spaces in comparison the results
because they were not Clipper ocmpatible at all. Ryszard please
look at it.
647 lines
28 KiB
C
647 lines
28 KiB
C
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* Header file for the Harbour Compiler
|
|
*
|
|
* Copyright 1999 Antonio Linares <alinares@fivetechsoft.com>
|
|
* 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_COMP_H_
|
|
#define HB_COMP_H_
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <limits.h>
|
|
#include <ctype.h>
|
|
#if defined(__WATCOMC__)
|
|
#include <malloc.h> /* alloca prototype */
|
|
#endif
|
|
|
|
#include "hbapi.h"
|
|
#include "hberrors.h"
|
|
#include "hbpp.h"
|
|
#include "hbver.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) <file.c> */
|
|
LANG_CLI, /* .NET IL language */
|
|
LANG_OBJ32, /* DOS/Windows 32 bits <file.obj> */
|
|
LANG_JAVA, /* Java <file.java> */
|
|
LANG_PORT_OBJ, /* Portable objects <file.hrb> */
|
|
LANG_OBJ_MODULE /* Platform dependant object module <file.obj> */
|
|
} LANGUAGES; /* supported Harbour output languages */
|
|
|
|
/* #include support */
|
|
typedef struct
|
|
{
|
|
FILE * handle; /* handle of the opened file */
|
|
void * pBuffer; /* file buffer */
|
|
char * yyBuffer; /* buffer used by yyac */
|
|
int iBuffer; /* current position in file buffer */
|
|
int lenBuffer; /* current length of data in file buffer */
|
|
char * szFileName; /* name of the file */
|
|
void * pPrev; /* pointer to the previous opened file */
|
|
void * pNext; /* pointer to the next opened file */
|
|
int iLine; /* currently processed line number */
|
|
} _FILE, * PFILE; /* structure to hold an opened PRG or CH */
|
|
|
|
/* structure to control several opened PRGs and CHs */
|
|
typedef struct
|
|
{
|
|
PFILE pLast; /* pointer to the last opened file */
|
|
int iFiles; /* number of files currently opened */
|
|
} FILES;
|
|
|
|
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 )
|
|
typedef HB_PCODE_FUNC( HB_PCODE_FUNC_, HB_VOID_PTR );
|
|
typedef HB_PCODE_FUNC_ * HB_PCODE_FUNC_PTR;
|
|
|
|
extern LONG hb_compPCodeSize( PFUNCTION, ULONG );
|
|
extern void hb_compPCodeEval( PFUNCTION, HB_PCODE_FUNC_PTR *, void * );
|
|
extern void hb_compPCodeTrace( PFUNCTION, HB_PCODE_FUNC_PTR *, void * );
|
|
|
|
extern void hb_compGenLabelTable( PFUNCTION pFunc, PHB_LABEL_INFO label_info );
|
|
|
|
#define VS_NONE 0
|
|
#define VS_LOCAL 1
|
|
#define VS_STATIC 2
|
|
#define VS_FIELD 4
|
|
#define VS_PARAMETER 8
|
|
#define VS_PRIVATE 64
|
|
#define VS_PUBLIC 128
|
|
#define VS_MEMVAR ( VS_PUBLIC | VS_PRIVATE )
|
|
|
|
/* return detailed information about a class of variable */
|
|
int hb_compVariableScope( 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 */
|
|
#define HB_VS_LOCAL_VAR 2
|
|
#define HB_VS_LOCAL_MEMVAR 4
|
|
#define HB_VS_LOCAL_FIELD 8
|
|
#define HB_VS_STATIC_VAR 16
|
|
/* variables declared outside of a current function/procedure */
|
|
#define HB_VS_GLOBAL_MEMVAR (32 | HB_VS_LOCAL_MEMVAR)
|
|
#define HB_VS_GLOBAL_FIELD (32 | HB_VS_LOCAL_FIELD)
|
|
#define HB_VS_GLOBAL_STATIC (32 | HB_VS_STATIC_VAR)
|
|
|
|
#define VU_NOT_USED 0
|
|
#define VU_INITIALIZED 1
|
|
#define VU_USED 2
|
|
|
|
#define VT_OFFSET_BYREF 60
|
|
#define VT_OFFSET_VARIANT 90
|
|
#define VT_OFFSET_OPTIONAL 90
|
|
|
|
/*
|
|
* flags for bFlags member
|
|
*/
|
|
#define FUN_STATEMENTS 1 /* Function have at least one executable statement */
|
|
#define FUN_USES_STATICS 2 /* Function uses static variables */
|
|
#define FUN_PROCEDURE 4 /* This is a procedure that shouldn't return value */
|
|
#define FUN_BREAK_CODE 8 /* last statement breaks execution flow */
|
|
#define FUN_USES_LOCAL_PARAMS 16 /* parameters are declared using () */
|
|
#define FUN_WITH_RETURN 32 /* there was RETURN statement in previous line */
|
|
|
|
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( char * szFunName );
|
|
|
|
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 void hb_compVariableAdd( 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 */
|
|
|
|
#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_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 PCOMDECLARED hb_compDeclaredAdd( char * );
|
|
extern PCOMDECLARED hb_compDeclaredFind( char * );
|
|
|
|
extern PCOMCLASS hb_compClassAdd( char * );
|
|
extern PCOMCLASS hb_compClassFind( char * );
|
|
extern PCOMDECLARED hb_compMethodAdd( PCOMCLASS pClass, char * );
|
|
extern PCOMDECLARED hb_compMethodFind( PCOMCLASS pClass, char * );
|
|
extern void hb_compDeclaredParameterAdd( char * szVarName, BYTE cValueType );
|
|
|
|
extern void hb_compGenBreak( void ); /* generate code for BREAK statement */
|
|
|
|
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_compAutoOpenAdd( char * szName );
|
|
|
|
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 )
|
|
|
|
#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 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 );
|
|
|
|
/* 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 */
|
|
|
|
/* support for FIELD declaration */
|
|
extern void hb_compFieldSetAlias( char *, int );
|
|
extern int hb_compFieldsCount( void );
|
|
|
|
/* Static variables */
|
|
extern void hb_compStaticDefStart( void );
|
|
extern void hb_compStaticDefEnd( void );
|
|
extern void hb_compGenStaticName( char * );
|
|
|
|
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 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_compPrintUsage( char * );
|
|
extern void hb_compPrintCredits( void );
|
|
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_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 );
|
|
/* Misc functions defined in hbfix.c */
|
|
extern void hb_compFixFuncPCode( 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 );
|
|
|
|
/* Misc functions defined in harbour.y */
|
|
#if 0
|
|
extern int hb_compYACCMain( char * szName );
|
|
#endif
|
|
extern BOOL hb_compInclude( char * szFileName, HB_PATHNAMES * pSearchPath ); /* end #include support */
|
|
extern void hb_compParserStop( void ); /* cleanup the bison parser */
|
|
|
|
extern char * hb_comp_buffer; /* yacc input buffer */
|
|
|
|
/* 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 */
|
|
|
|
/* 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 */
|
|
|
|
/* variable used by compiler
|
|
*/
|
|
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 HB_PATHNAMES * hb_comp_pIncludePath;
|
|
extern PFUNCTION hb_comp_pInitFunc;
|
|
extern PHB_FNAME hb_comp_pFileName;
|
|
extern PHB_FNAME hb_comp_pFilePpo;
|
|
extern BOOL hb_comp_bPPO;
|
|
extern FILE * hb_comp_yyppo;
|
|
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 FILES hb_comp_files;
|
|
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 */
|
|
extern FILE *hb_comp_errFile;
|
|
|
|
/* Hide Strings */
|
|
extern int hb_comp_iHidden;
|
|
|
|
/* compiler PP functions and variables */
|
|
#define HB_PP_STR_SIZE 12288
|
|
#define HB_PP_BUFF_SIZE 4096
|
|
extern void hb_pp_SetRules( BOOL hb_comp_bQuiet, int argc, char * argv[] );
|
|
extern void hb_pp_Init( void );
|
|
extern void hb_pp_Free( void );
|
|
extern void hb_pp_AddDefine( char *defname, char *value );
|
|
extern void hb_pp_ParseDirective( char * );
|
|
extern int hb_pp_Internal( FILE *, char * );
|
|
|
|
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
|
|
#define HB_COMPGENC_NORMAL 1
|
|
#define HB_COMPGENC_VERBOSE 2
|
|
#define HB_COMPGENC_REALCODE 3
|
|
|
|
/* /ES command line setting types */
|
|
#define HB_EXITLEVEL_DEFAULT 0
|
|
#define HB_EXITLEVEL_SETEXIT 1
|
|
#define HB_EXITLEVEL_DELTARGET 2
|
|
|
|
/* /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 */
|
|
|
|
#ifdef HB_MACRO_SUPPORT
|
|
#define HB_COMP_ISSUPPORTED(flag) ( HB_MACRO_DATA->supported & (flag) )
|
|
#else
|
|
#define HB_COMP_ISSUPPORTED(flag) ( hb_comp_Supported & (flag) )
|
|
#endif
|
|
|
|
HB_EXTERN_END
|
|
|
|
#endif /* HB_COMP_H_ */
|