From bc949f32caa06867a036fcd794e725cc90cfcdb6 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 2 Aug 1999 13:41:13 +0000 Subject: [PATCH] *** empty log message *** --- harbour/ChangeLog | 78 ++++++++++- harbour/doc/codestyl.txt | 8 ++ harbour/include/Makefile | 5 +- harbour/include/compat.h | 18 --- harbour/include/compiler.h | 10 +- harbour/include/ctoharb.h | 28 ++-- harbour/include/dates.h | 14 +- harbour/include/error.api | Bin 1218 -> 1241 bytes harbour/include/errorapi.h | 59 ++++----- harbour/include/extend.api | 51 ++++---- harbour/include/extend.h | 197 +++++++++++++++------------- harbour/include/extra.h | 143 -------------------- harbour/include/filesys.api | 40 +++--- harbour/include/filesys.h | 42 +++--- harbour/include/fm.api | 6 +- harbour/include/gt.api | 1 - harbour/include/gtapi.h | 105 +++++++-------- harbour/include/hbdefs.h | 2 +- harbour/include/hberrors.h | 4 +- harbour/include/init.h | 2 +- harbour/include/inkey.h | 10 +- harbour/include/item.api | 10 +- harbour/include/itemapi.h | 60 ++++----- harbour/include/set.h | 15 +-- harbour/include/super.h | 10 -- harbour/include/vm.api | 4 +- harbour/source/hbpp/hbpplib.c | 1 - harbour/source/rtl/arrays.c | 31 ++--- harbour/source/rtl/classes.c | 102 +++++++-------- harbour/source/rtl/codebloc.c | 9 +- harbour/source/rtl/dates.c | 45 +++++-- harbour/source/rtl/extend.c | 95 ++++++++------ harbour/source/rtl/files.c | 2 + harbour/source/rtl/itemapi.c | 37 ++---- harbour/source/rtl/memvars.c | 2 - harbour/source/rtl/strings.c | 29 ++++ harbour/source/runner/runner.c | 8 +- harbour/source/tools/debug.c | 1 - harbour/source/tools/stringsx.c | 1 - harbour/source/vm/dynsym.c | 56 ++------ harbour/source/vm/hvm.c | 225 +++++++++++++++----------------- harbour/source/vm/initsymb.c | 2 - 42 files changed, 735 insertions(+), 833 deletions(-) create mode 100644 harbour/doc/codestyl.txt delete mode 100644 harbour/include/compat.h delete mode 100644 harbour/include/extra.h delete mode 100644 harbour/include/super.h diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 60f27c0560..c6d93d267b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,69 @@ +19990802-15:20 GMT+1 Victor Szel + % source/hbpp/hbpplib.c + source/tools/debug.c + source/tools/stringsx.c - Unused #includes removed +^ + doc/codestyl.txt - Added. Moved here from source/vm/hvm.c + * source/rtl/strings.c + include/extend.h + source/vm/dynsym.c - hb_strgreater() and hb_strupr() moved. + * source/vm/dynsym.c + source/vm/hvm.c + LogSymbols() -> hb_LogDynSym() + hb_ReleaseDynamicSymbols() -> hb_ReleaseDynSym() + * source/rtl/classes.c + source/runner/runner.c + source/vm/hvm.c + include/extend.h + include/hbdefs.h - HARBOURFUNC -> PHB_FUNC + + include/item.api + include/itemapi.h - Moved #define ITEM PHB_ITEM to item.api, guard added. + ! source/rtl/itemapi.c + hb_itemGetDS() handling of the case when item is not a date + fixed and made Clipper compatible. + It will no longer place a \0 after the date. Clipper does the + same, the NG is obviously wrong here, since it requires to pass + an 8 byte buffer which is then supposed to hold an 8 chars date plus the + terminating zero. Testing showed that Clipper doesn't place a \0. + + include/extend.h + source/rtl/arrays.c + source/rtl/extend.c + Change hb_arrayGetDate() to be thread safe by design, + got rid of static buffer. + + source/rtl/files.c/hb_fsCurDir() - Added TODO: Make it thread safe. + % source/rtl/dates.c/STOD() - Some checkings removed, which had been + moved to hb_retds() previously. + + source/rtl/dates.c + source/rtl/arrays.c + source/rtl/extend.c + source/rtl/itemapi.c + include/dates.h + hb_dateStrPut(), hb_dateStrGet() added. Redundant code converted + to calls for these. + * include/set.h + source/vm/hvm.c- Extern decls moved to source/rtl/set.c and to + * source/rtl/codebloc.c - Extern decls moved to include/extend.h + * source/vm/initsymb.c - Extern decl moved to include/extend.h + + include/*.h - extern keyword added to all extern declarations. + ! include/item.api - _array* removed since not in Clipper. + ! include/extend.api - _pcount, _reta removed since not in Clipper. + ! include/gt.api - _gtInit removed since not in Clipper. + ! include/vm.api - #include "extend.h" added. +^ - include/compat.h + include/super.h + include/extra.h + include/Makefile - Unused header files removed. + They supposed to be used by Ad's RDD implementation. + + include/itemapi.h + source/rtl/itemapi.c + The maximum number of parameters that could be addd with + hb_EvalPutParam() can be set with a #define. Also 10 instead on 9 + parameters can be used now. + % include/itemapi.h - Two unused variables removed from the EVALINFO + structure. + + include/extend.api + include/extend.h + source/rtl/extend.c - hb_parcsiz() added for Clipper compatibility. + 19990802-05:30 EDT Paul Tucker * test/working/scroll.prg * added calls to dispbegin/dispend - nice & snappy now! @@ -81,7 +147,7 @@ 19990801-21:58 GMT+1 Victor Szel % source/rtl/descend.c #include removed - ! source/compiler/harbour.y - + ! source/compiler/harbour.y - hb_INITSTATICS() -> HB_INITSTATICS() (case adjusted) Change undone. Comment added to make this clear. @@ -115,16 +181,16 @@ Added a include path to harbour 19990801-18:14 CET Victor Szel - ! source/compiler/harbour.y - + ! source/compiler/harbour.y - hb_INITSTATICS() -> HB_INITSTATICS() (case adjusted) + source/rdd/nulsys/nulsys.prg - Using ANNOUNCE ! source/rtl/mtran.c - Fixed, now 100% Clipper compatible. - HARD and SOFT characters swapped. - HARD and SOFT characters pairs are changed to only one character, like in Clipper. - - unnecessary include ctype.h removed. - ! source/rtl/hardcr.c - - unnecessary include ctype.h removed. + - unnecessary include ctype.h removed. + ! source/rtl/hardcr.c + - unnecessary include ctype.h removed. - "HARD_" -> "SOFT_" #define names corrected. + tests/working/mtran.prg - More extensive tests added. ! source/rtl/msgxxx.c - Previous changes undone, to make it work in GCC. @@ -136,7 +202,7 @@ 199908.01-16:30 GMT+3 Alexander Kresin * source/hbpp/hbppint.c * Bug fixed ( related to line continuation ) - + 199908.01-20:30 WIB Andi Jahja * msgxxx.c correct directives, it now works diff --git a/harbour/doc/codestyl.txt b/harbour/doc/codestyl.txt new file mode 100644 index 0000000000..a0ae3ae4a1 --- /dev/null +++ b/harbour/doc/codestyl.txt @@ -0,0 +1,8 @@ + +/* Please note the following comments we may use everywhere + TODO: something should be added here + TOFIX: something needs to be fixed + OBSOLETE: something could be removed from here + QUESTION: I had some questions at this point but I could not get an answer + OPT: something is commented out to improve performance + As an example: */ diff --git a/harbour/include/Makefile b/harbour/include/Makefile index bf26bf8c18..7ef2f6ff04 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -6,19 +6,18 @@ ROOT = ../ C_HEADERS=\ box.h \ - compat.h \ compiler.h \ ctoharb.h \ dates.h \ errorapi.h \ extend.h \ - extra.h \ filesys.h \ gtapi.h \ hbdefs.h \ hberrors.h \ hbpp.h \ hbsetup.h \ + hbver.h \ init.h \ initsymb.h \ inkey.h \ @@ -26,8 +25,6 @@ C_HEADERS=\ pcode.h \ run_exp.h \ set.h \ - super.h \ - hbver.h \ PRG_HEADERS=\ box.ch \ diff --git a/harbour/include/compat.h b/harbour/include/compat.h deleted file mode 100644 index 52f2fb52f7..0000000000 --- a/harbour/include/compat.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * $Id$ - */ - -#ifndef HB_COMPAT_H_ -#define HB_COMPAT_H_ - -#ifndef HRBCLIPPER -#define far -#define near -#define _near -/* #define pascal */ -typedef void * FARP; -#endif - -#define _DEBUG - -#endif /* HB_COMPAT_H_ */ diff --git a/harbour/include/compiler.h b/harbour/include/compiler.h index 9a9bebb91b..92181d99f4 100644 --- a/harbour/include/compiler.h +++ b/harbour/include/compiler.h @@ -84,11 +84,11 @@ typedef struct _STACK_VAL_TYPE /* locals, static, public variables suppor struct _STACK_VAL_TYPE * pPrev; /* pointer to previous stack value's type */ } STACK_VAL_TYPE, * PSTACK_VAL_TYPE; -PFUNCTION GetFunction( char * szFunName ); /* locates a previously defined function */ -WORD GetFunctionPos( char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */ +extern PFUNCTION GetFunction( char * szFunName ); /* locates a previously defined function */ +extern WORD GetFunctionPos( char * szSymbolName ); /* returns the index + 1 of a function on the functions defined list */ -void * OurMalloc( LONG lSize ); /* our malloc with error control */ -void * OurRealloc( void * p, LONG lSize ); /* our malloc with error control */ -void OurFree( void * p ); /* releases allocated memory */ +extern void * OurMalloc( LONG lSize ); /* our malloc with error control */ +extern void * OurRealloc( void * p, LONG lSize ); /* our malloc with error control */ +extern void OurFree( void * p ); /* releases allocated memory */ #endif /* HB_COMPILER_H_ */ diff --git a/harbour/include/ctoharb.h b/harbour/include/ctoharb.h index a08254d4fe..6743265a2a 100644 --- a/harbour/include/ctoharb.h +++ b/harbour/include/ctoharb.h @@ -30,20 +30,20 @@ /* Calling Harbour from C code */ /* executing Harbour code from C */ -void Message( PSYMBOL ); -void PushSymbol( PSYMBOL pSym ); /* pushes a function pointer onto the stack */ -void Push( PHB_ITEM pItem ); /* pushes any item to the stack */ -void PushNil( void ); /* in this case it places nil at self */ +extern void Message( PSYMBOL ); +extern void PushSymbol( PSYMBOL pSym ); /* pushes a function pointer onto the stack */ +extern void Push( PHB_ITEM pItem ); /* pushes any item to the stack */ +extern void PushNil( void ); /* in this case it places nil at self */ /* parameters should come here using Push...() */ -void PushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ -void PushInteger( int iNumber ); -void PushLong( long lNumber ); -void PushDouble( double dNumber, WORD wDec ); -void PushString( char * szText, ULONG length ); /* pushes a string on to the stack */ -void PushLogical( int iTrueFalse ); /* pushes a logical value onto the stack */ -void PushSymbol( PSYMBOL ); -void Do( WORD wParams ); /* invokes the virtual machine */ -void Function( WORD wParams ); /* invokes the virtual machine */ -void StackShow( void ); +extern void PushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ +extern void PushInteger( int iNumber ); +extern void PushLong( long lNumber ); +extern void PushDouble( double dNumber, WORD wDec ); +extern void PushString( char * szText, ULONG length ); /* pushes a string on to the stack */ +extern void PushLogical( int iTrueFalse ); /* pushes a logical value onto the stack */ +extern void PushSymbol( PSYMBOL ); +extern void Do( WORD wParams ); /* invokes the virtual machine */ +extern void Function( WORD wParams ); /* invokes the virtual machine */ +extern void StackShow( void ); #endif /* HB_CTOHARB_H_ */ diff --git a/harbour/include/dates.h b/harbour/include/dates.h index b4380bfc5a..70c7a17818 100644 --- a/harbour/include/dates.h +++ b/harbour/include/dates.h @@ -6,12 +6,14 @@ #define HB_DATES_H_ /* In msgxxx.c modules */ -extern char *hb_monthsname[]; -extern char *hb_daysname[]; +extern char * hb_monthsname []; +extern char * hb_daysname []; -long hb_dow( long d, long m, long y ); -char * hb_dtoc( const char * szDate, char * szFormattedDate, const char * szDateFormat ); -long hb_dateEncode( long lDay, long lMonth, long lYear ); -void hb_dateDecode( long julian, long * plDay, long * plMonth, long * plYear ); +extern long hb_dow( long d, long m, long y ); +extern char * hb_dtoc( const char * szDate, char * szFormattedDate, const char * szDateFormat ); +extern long hb_dateEncode( long lDay, long lMonth, long lYear ); +extern void hb_dateDecode( long julian, long * plDay, long * plMonth, long * plYear ); +extern void hb_dateStrPut( char * szDate, long lDay, long lMonth, long lYear ); +extern void hb_dateStrGet( char * szDate, long * plDay, long * plMonth, long * plYear ); #endif /* HB_DATES_H_ */ diff --git a/harbour/include/error.api b/harbour/include/error.api index 1fe17f94b6f058095ad90eed7d75b7b78652f0db..2212890ebbd48ebf2b26faf547953830b4202494 100644 GIT binary patch delta 177 zcmX@ad6RR(7Dk52{mceH(wjvWNE$O~0m)WI9U%FhSr16wWz+_e+KeFC+e{#FW3YHT zNae(v8bD%;Do}Jk*pv#eDY0NvHiAu&WdWJO!2~iT0&Gemv+!goW=SAF5p2>%uxds| kO*sZGF6Gp`l*}{*eJuqKr+C+(Apf9v#{kcG1ucCp05{|(Z2$lO delta 102 zcmV-s0Ga>U3Bn1Gw3DR*C6jytD3g)|DFF(T#{n&q-2*L?KLIS0RRb)On*l46u>&iU z6agxeDg!E$Q35KHX9Oyf^#LrC3j{2aA_6XxI0P<{wJ?**0x*+o0WOn*11^!~EtC8L IEt9+i9mG>1mH+?% diff --git a/harbour/include/errorapi.h b/harbour/include/errorapi.h index 74d58903d6..ebaa14e859 100644 --- a/harbour/include/errorapi.h +++ b/harbour/include/errorapi.h @@ -71,42 +71,41 @@ /* Standard API */ -PHB_ITEM hb_errNew( void ); -WORD hb_errLaunch( PHB_ITEM pError ); -void hb_errRelease( PHB_ITEM pError ); - -USHORT hb_errGetSeverity( PHB_ITEM pError ); -PHB_ITEM hb_errPutSeverity( PHB_ITEM pError, USHORT uiSeverity ); -USHORT hb_errGetGenCode( PHB_ITEM pError ); -PHB_ITEM hb_errPutGenCode( PHB_ITEM pError, USHORT uiGenCode ); -USHORT hb_errGetOsCode( PHB_ITEM pError ); -PHB_ITEM hb_errPutOsCode( PHB_ITEM pError, USHORT uiOsCode ); -USHORT hb_errGetFlags( PHB_ITEM pError ); -PHB_ITEM hb_errPutFlags( PHB_ITEM pError, USHORT uiFlags ); -USHORT hb_errGetTries( PHB_ITEM pError ); -PHB_ITEM hb_errPutTries( PHB_ITEM pError, USHORT uiTries ); -USHORT hb_errGetSubCode( PHB_ITEM pError ); -PHB_ITEM hb_errPutSubCode( PHB_ITEM pError, USHORT uiSubCode ); -char * hb_errGetSubSystem( PHB_ITEM pError ); -PHB_ITEM hb_errPutSubSystem( PHB_ITEM pError, char * szSubSystem ); -char * hb_errGetDescription( PHB_ITEM pError ); -PHB_ITEM hb_errPutDescription( PHB_ITEM pError, char * szDescription ); -char * hb_errGetOperation( PHB_ITEM pError ); -PHB_ITEM hb_errPutOperation( PHB_ITEM pError, char * szOperation ); -char * hb_errGetFileName( PHB_ITEM pError ); -PHB_ITEM hb_errPutFileName( PHB_ITEM pError, char * szFileName ); +extern char * hb_errGetDescription( PHB_ITEM pError ); +extern char * hb_errGetFileName( PHB_ITEM pError ); +extern USHORT hb_errGetFlags( PHB_ITEM pError ); +extern USHORT hb_errGetGenCode( PHB_ITEM pError ); +extern char * hb_errGetOperation( PHB_ITEM pError ); +extern USHORT hb_errGetOsCode( PHB_ITEM pError ); +extern USHORT hb_errGetSeverity( PHB_ITEM pError ); +extern USHORT hb_errGetSubCode( PHB_ITEM pError ); +extern char * hb_errGetSubSystem( PHB_ITEM pError ); +extern USHORT hb_errGetTries( PHB_ITEM pError ); +extern WORD hb_errLaunch( PHB_ITEM pError ); +extern PHB_ITEM hb_errNew( void ); +extern PHB_ITEM hb_errPutDescription( PHB_ITEM pError, char * szDescription ); +extern PHB_ITEM hb_errPutFileName( PHB_ITEM pError, char * szFileName ); +extern PHB_ITEM hb_errPutFlags( PHB_ITEM pError, USHORT uiFlags ); +extern PHB_ITEM hb_errPutGenCode( PHB_ITEM pError, USHORT uiGenCode ); +extern PHB_ITEM hb_errPutOperation( PHB_ITEM pError, char * szOperation ); +extern PHB_ITEM hb_errPutOsCode( PHB_ITEM pError, USHORT uiOsCode ); +extern PHB_ITEM hb_errPutSeverity( PHB_ITEM pError, USHORT uiSeverity ); +extern PHB_ITEM hb_errPutSubCode( PHB_ITEM pError, USHORT uiSubCode ); +extern PHB_ITEM hb_errPutSubSystem( PHB_ITEM pError, char * szSubSystem ); +extern PHB_ITEM hb_errPutTries( PHB_ITEM pError, USHORT uiTries ); +extern void hb_errRelease( PHB_ITEM pError ); /* Error launchers */ -WORD hb_errorRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); -WORD hb_errorRT_TERMINAL( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); -WORD hb_errorRT_DBCMD( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); -WORD hb_errorRT_TOOLS( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern WORD hb_errorRT_BASE( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern WORD hb_errorRT_TERMINAL( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern WORD hb_errorRT_DBCMD( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern WORD hb_errorRT_TOOLS( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); /* TODO: Enable this: -void hb_errorInternal( ULONG ulCode ); +extern void hb_errorInternal( ULONG ulCode ); */ /* Reads error description in national language */ -char *hb_errorNatDescription( ULONG ulGenCode ); +extern char *hb_errorNatDescription( ULONG ulGenCode ); #endif /* HB_ERRORAPI_H_ */ diff --git a/harbour/include/extend.api b/harbour/include/extend.api index ee5de2fb27..7617c7b90d 100644 --- a/harbour/include/extend.api +++ b/harbour/include/extend.api @@ -10,33 +10,32 @@ #include "extend.h" -#define _parc hb_parc -#define _parclen hb_parclen -#define _pards hb_pards -#define _parl hb_parl -#define _parnd hb_parnd -#define _parni hb_parni -#define _parnl hb_parnl -#define _parinfo hb_parinfo -#define _pcount hb_pcount -#define _parinfa hb_parinfa +#define _parc hb_parc +#define _parclen hb_parclen +#define _parcsiz hb_parcsiz +#define _pards hb_pards +#define _parinfa hb_parinfa +#define _parinfo hb_parinfo +#define _parl hb_parl +#define _parnd hb_parnd +#define _parni hb_parni +#define _parnl hb_parnl -#define _ret hb_ret -#define _retc hb_retc -#define _retclen hb_retclen -#define _retds hb_retds -#define _retl hb_retl -#define _retnd hb_retnd -#define _retni hb_retni -#define _retnl hb_retnl +#define _ret hb_ret +#define _retc hb_retc +#define _retclen hb_retclen +#define _retds hb_retds +#define _retl hb_retl +#define _retnd hb_retnd +#define _retni hb_retni +#define _retnl hb_retnl -#define _storc hb_storc -#define _stords hb_stords -#define _storl hb_storl -#define _stornd hb_stornd -#define _storni hb_storni -#define _stornl hb_stornl -#define _reta hb_reta -#define _storclen hb_storclen +#define _storc hb_storc +#define _storclen hb_storclen +#define _stords hb_stords +#define _storl hb_storl +#define _stornd hb_stornd +#define _storni hb_storni +#define _stornl hb_stornl #endif /* HB_EXTEND_API_ */ diff --git a/harbour/include/extend.h b/harbour/include/extend.h index f838f6d197..6687737ebe 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -1,4 +1,4 @@ -/* +/* * $Id$ */ @@ -35,7 +35,7 @@ #include "hbsetup.h" #ifdef HARBOUR_STRICT_CLIPPER_COMPATIBILITY - /* Clipper includes these from its extend.h */ + /* Clipper includes these from extend.h */ #include "extend.api" #include "fm.api" #endif @@ -46,7 +46,7 @@ typedef struct /* symbol support structure */ { char* szName; /* the name of the symbol */ SYMBOLSCOPE cScope; /* the scope of the symbol */ - HARBOURFUNC pFunPtr; /* function address for function symbol table entries */ + PHB_FUNC pFunPtr; /* function address for function symbol table entries */ struct _DYNSYM * pDynSym; /* pointer to its dynamic symbol if defined */ } SYMBOL, * PSYMBOL; @@ -59,8 +59,8 @@ typedef struct /* symbol support structure */ #define FS_MESSAGE 32 #define FS_MEMVAR 128 -void VirtualMachine( PBYTE pCode, PSYMBOL pSymbols ); /* invokes the virtual machine */ -void ProcessSymbols( SYMBOL *, WORD ); +extern void VirtualMachine( PBYTE pCode, PSYMBOL pSymbols ); /* invokes the virtual machine */ +extern void ProcessSymbols( SYMBOL *, WORD ); /* items types */ #define IT_NIL 0x0000 @@ -82,8 +82,7 @@ void ProcessSymbols( SYMBOL *, WORD ); #define IT_NUMERIC ( IT_INTEGER | IT_LONG | IT_DOUBLE ) #define IT_ANY 0xFFFF -/* forward declarations -*/ +/* forward declarations */ struct _HB_CODEBLOCK; struct _HB_BASEARRAY; struct _HB_ITEM; @@ -217,9 +216,14 @@ typedef struct _DYNSYM HB_HANDLE hArea; /* Workarea number */ HB_HANDLE hMemvar; /* Index number into memvars ( publics & privates ) array */ PSYMBOL pSymbol; /* pointer to its relative local symbol */ - HARBOURFUNC pFunPtr; /* Pointer to the function address */ + PHB_FUNC pFunPtr; /* Pointer to the function address */ } DYNSYM, * PDYNSYM; /* dynamic symbol structure */ +typedef struct +{ + PDYNSYM pDynSym; /* Pointer to dynamic symbol */ +} DYNHB_ITEM, * PDYNHB_ITEM; + /* internal structure for codeblocks */ typedef struct _HB_CODEBLOCK { @@ -242,95 +246,112 @@ extern SYMBOL symEval; extern HB_ITEM errorBlock; extern HB_ITEM aStatics; -PHB_ITEM hb_param( int iParam, WORD wType ); /* retrieve a generic parameter */ -char * hb_parc( int iParam, ... ); /* retrieve a string parameter */ -ULONG hb_parclen( int iParam, ... ); /* retrieve a string parameter length */ -char * hb_pards( int iParam, ... ); /* retrieve a date as a string yyyymmdd */ -int hb_parl( int iParam, ... ); /* retrieve a logical parameter as an int */ -double hb_parnd( int iParam, ... ); /* retrieve a numeric parameter as a double */ -int hb_parni( int iParam, ... ); /* retrieve a numeric parameter as a integer */ -long hb_parnl( int iParam, ... ); /* retrieve a numeric parameter as a long */ -WORD hb_parinfo( int iParam ); /* Determine the param count or data type */ -ULONG hb_parinfa( int iParamNum, ULONG uiArrayIndex ); -void hb_storc( char * szText, int iParam, ... ); /* stores a szString on a variable by reference */ -void hb_storclen( char * fixText, WORD wLength, int iParam, ... ); /* stores a fixed length string on a variable by reference */ -void hb_stords( char * szDate, int iParam, ... ); /* szDate must have yyyymmdd format */ -void hb_storl( int iLogical, int iParam, ... ); /* stores a logical integer on a variable by reference */ -void hb_storni( int iValue, int iParam, ... ); /* stores an integer on a variable by reference */ -void hb_stornl( long lValue, int iParam, ... ); /* stores a long on a variable by reference */ -void hb_stornd( double dValue, int iParam, ... ); /* stores a double on a variable by reference */ -WORD hb_pcount( void ); /* returns the number of suplied parameters */ -void hb_ret( void ); /* post a NIL return value */ -void hb_retc( char * szText ); /* returns a string */ -void hb_retclen( char * szText, ULONG ulLen ); /* returns a string with a specific length */ -void hb_retds( char * szDate ); /* returns a date, must use yyyymmdd format */ -void hb_retl( int iTrueFalse ); /* returns a logical integer */ -void hb_retni( int iNumber ); /* returns a integer number */ -void hb_retnl( long lNumber ); /* returns a long number */ -void hb_retnd( double dNumber ); /* returns a double */ -void hb_reta( ULONG ulLen ); /* returns an array with a specific length */ +extern char * hb_parc( int iParam, ... ); /* retrieve a string parameter */ +extern ULONG hb_parclen( int iParam, ... ); /* retrieve a string parameter length */ +extern ULONG hb_parcsiz( int iParam, ... ); +extern char * hb_pards( int iParam, ... ); /* retrieve a date as a string yyyymmdd */ +extern ULONG hb_parinfa( int iParamNum, ULONG uiArrayIndex ); +extern WORD hb_parinfo( int iParam ); /* Determine the param count or data type */ +extern int hb_parl( int iParam, ... ); /* retrieve a logical parameter as an int */ +extern double hb_parnd( int iParam, ... ); /* retrieve a numeric parameter as a double */ +extern int hb_parni( int iParam, ... ); /* retrieve a numeric parameter as a integer */ +extern long hb_parnl( int iParam, ... ); /* retrieve a numeric parameter as a long */ +extern PHB_ITEM hb_param( int iParam, WORD wType ); /* retrieve a generic parameter */ +extern WORD hb_pcount( void ); /* returns the number of suplied parameters */ -void * hb_xalloc( ULONG lSize ); /* allocates memory, returns NULL on failure */ -void * hb_xgrab( ULONG lSize ); /* allocates memory, exists on failure */ -void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */ -void hb_xfree( void * pMem ); /* frees memory */ -ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */ +extern void hb_ret( void ); /* post a NIL return value */ +extern void hb_retc( char * szText ); /* returns a string */ +extern void hb_retclen( char * szText, ULONG ulLen ); /* returns a string with a specific length */ +extern void hb_retds( char * szDate ); /* returns a date, must use yyyymmdd format */ +extern void hb_retl( int iTrueFalse ); /* returns a logical integer */ +extern void hb_retni( int iNumber ); /* returns a integer number */ +extern void hb_retnl( long lNumber ); /* returns a long number */ +extern void hb_retnd( double dNumber ); /* returns a double */ +extern void hb_reta( ULONG ulLen ); /* returns an array with a specific length */ -void hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creates a new array */ -void hb_arrayGet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* retrieves an item */ -ULONG hb_arrayLen( PHB_ITEM pArray ); /* retrives the array len */ -void hb_arraySet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* sets an array element */ -void hb_arraySize( PHB_ITEM pArray, ULONG ulLen ); /* sets the array total length */ -void hb_arrayRelease( PHB_ITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */ -char * hb_arrayGetString( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string contained on an array element */ -ULONG hb_arrayGetStringLen( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string length contained on an array element */ -BOOL hb_arrayGetBool( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the logical value contained on an array element */ -double hb_arrayGetDouble( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the double value contained on an array element */ -int hb_arrayGetType( PHB_ITEM pArray, ULONG ulIndex ); -void hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex ); -PHB_ITEM hb_arrayClone( PHB_ITEM pArray ); -void hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ); -char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the date value contained on an array element */ +extern void hb_storc( char * szText, int iParam, ... ); /* stores a szString on a variable by reference */ +extern void hb_storclen( char * fixText, WORD wLength, int iParam, ... ); /* stores a fixed length string on a variable by reference */ +extern void hb_stords( char * szDate, int iParam, ... ); /* szDate must have yyyymmdd format */ +extern void hb_storl( int iLogical, int iParam, ... ); /* stores a logical integer on a variable by reference */ +extern void hb_storni( int iValue, int iParam, ... ); /* stores an integer on a variable by reference */ +extern void hb_stornl( long lValue, int iParam, ... ); /* stores a long on a variable by reference */ +extern void hb_stornd( double dValue, int iParam, ... ); /* stores a double on a variable by reference */ -int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ); /* our string compare */ -void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ); /* copies an item to one place to another respecting its containts */ -void hb_itemClear( PHB_ITEM pItem ); -PHB_ITEM hb_itemUnRef( PHB_ITEM pItem ); /* de-references passed variable */ +extern void * hb_xalloc( ULONG lSize ); /* allocates memory, returns NULL on failure */ +extern void * hb_xgrab( ULONG lSize ); /* allocates memory, exists on failure */ +extern void hb_xfree( void * pMem ); /* frees memory */ +extern void * hb_xrealloc( void * pMem, ULONG lSize ); /* reallocates memory */ +extern ULONG hb_xsize( void * pMem ); /* returns the size of an allocated memory block */ -char * hb_str( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec ); /* convert number to string */ -int hb_stricmp( const char *s1, const char *s2 ); -BOOL hb_strempty( char * szText, ULONG ulLen ); -BOOL hb_strMatchRegExp( char * szString, char * szMask ); -ULONG hb_strAt( char *, long, char *, long ); -char * hb_strUpper( char * szText, long lLen ); -char * hb_strLower( char * szText, long lLen ); +extern void hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creates a new array */ +extern void hb_arrayGet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* retrieves an item */ +extern ULONG hb_arrayLen( PHB_ITEM pArray ); /* retrives the array len */ +extern void hb_arraySet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); /* sets an array element */ +extern void hb_arraySize( PHB_ITEM pArray, ULONG ulLen ); /* sets the array total length */ +extern void hb_arrayRelease( PHB_ITEM pArray ); /* releases an array - don't call it - use ItemRelease() !!! */ +extern int hb_arrayGetType( PHB_ITEM pArray, ULONG ulIndex ); +extern char * hb_arrayGetString( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string contained on an array element */ +extern ULONG hb_arrayGetStringLen( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the string length contained on an array element */ +extern BOOL hb_arrayGetBool( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the logical value contained on an array element */ +extern double hb_arrayGetDouble( PHB_ITEM pArray, ULONG ulIndex ); /* retrieves the double value contained on an array element */ +extern char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex, char * szDate ); /* retrieves the date value contained on an array element */ +extern void hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex ); +extern PHB_ITEM hb_arrayClone( PHB_ITEM pArray ); +extern void hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ); -HARBOURFUNC hb_GetMethod( PHB_ITEM pObject, PSYMBOL pSymMsg ); /* returns the method pointer of a object class */ -char * hb_GetClassName( PHB_ITEM pObject ); /* retrieves an object class name */ -ULONG hb_isMessage( PHB_ITEM, char * ); +extern int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ); /* our string compare */ +extern void hb_itemCopy( PHB_ITEM pDest, PHB_ITEM pSource ); /* copies an item to one place to another respecting its containts */ +extern void hb_itemClear( PHB_ITEM pItem ); +extern PHB_ITEM hb_itemUnRef( PHB_ITEM pItem ); /* de-references passed variable */ + +#define HB_STRGREATER_EQUAL 0 +#define HB_STRGREATER_LEFT 1 +#define HB_STRGREATER_RIGHT 2 + +extern char * hb_str( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec ); /* convert number to string */ +extern int hb_stricmp( const char *s1, const char *s2 ); +extern BOOL hb_strempty( char * szText, ULONG ulLen ); +extern WORD hb_strgreater( char * sz1, char * sz2 ); +extern void hb_strupr( char * szText ); +extern BOOL hb_strMatchRegExp( char * szString, char * szMask ); +extern ULONG hb_strAt( char *, long, char *, long ); +extern char * hb_strUpper( char * szText, long lLen ); +extern char * hb_strLower( char * szText, long lLen ); + +extern PHB_FUNC hb_GetMethod( PHB_ITEM pObject, PSYMBOL pSymMsg ); /* returns the method pointer of a object class */ +extern char * hb_GetClassName( PHB_ITEM pObject ); /* retrieves an object class name */ +extern ULONG hb_isMessage( PHB_ITEM, char * ); /* dynamic symbol table management */ -PDYNSYM hb_GetDynSym( char * szName ); /* finds and creates a dynamic symbol if not found */ -PDYNSYM hb_NewDynSym( PSYMBOL pSymbol ); /* creates a new dynamic symbol based on a local one */ -PDYNSYM hb_FindDynSym( char * szName ); /* finds a dynamic symbol */ +extern PDYNSYM hb_GetDynSym( char * szName ); /* finds and creates a dynamic symbol if not found */ +extern PDYNSYM hb_NewDynSym( PSYMBOL pSymbol ); /* creates a new dynamic symbol based on a local one */ +extern PDYNSYM hb_FindDynSym( char * szName ); /* finds a dynamic symbol */ +extern void hb_LogDynSym( void ); /* displays all dynamic symbols */ +extern void hb_ReleaseDynSym( void ); /* releases the memory of the dynamic symbol table */ +extern PSYMBOL hb_NewSymbol( char * szName ); -HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE *, WORD, WORD *, PSYMBOL ); -void hb_CodeblockDelete( PHB_ITEM ); -PHB_ITEM hb_CodeblockGetVar( PHB_ITEM, LONG ); -PHB_ITEM hb_CodeblockGetRef( PHB_ITEM, PHB_ITEM ); -void hb_CodeblockEvaluate( PHB_ITEM ); -void hb_CodeblockCopy( PHB_ITEM, PHB_ITEM ); +extern HB_CODEBLOCK_PTR hb_CodeblockNew( BYTE *, WORD, WORD *, PSYMBOL ); +extern void hb_CodeblockDelete( PHB_ITEM ); +extern PHB_ITEM hb_CodeblockGetVar( PHB_ITEM, LONG ); +extern PHB_ITEM hb_CodeblockGetRef( PHB_ITEM, PHB_ITEM ); +extern void hb_CodeblockEvaluate( PHB_ITEM ); +extern void hb_CodeblockCopy( PHB_ITEM, PHB_ITEM ); /* Initialisation and closing memvars subsystem */ -void hb_MemvarsInit( void ); -void hb_MemvarsRelease( void ); -void hb_MemvarValueIncRef( HB_HANDLE ); -void hb_MemvarValueDecRef( HB_HANDLE ); -void hb_MemvarSetValue( PSYMBOL, HB_ITEM_PTR ); -void hb_MemvarGetValue( HB_ITEM_PTR, PSYMBOL ); -void hb_MemvarGetRefer( HB_ITEM_PTR, PSYMBOL ); -void hb_MemvarNewSymbol( PSYMBOL ); -ULONG hb_MemvarGetPrivatesBase( void ); -void hb_MemvarSetPrivatesBase( ULONG ); +extern HB_HANDLE hb_MemvarValueNew( PHB_ITEM, int ); +extern HB_VALUE_PTR * hb_MemvarValueBaseAddress( void ); +extern void hb_MemvarsInit( void ); +extern void hb_MemvarsRelease( void ); +extern void hb_MemvarValueIncRef( HB_HANDLE ); +extern void hb_MemvarValueDecRef( HB_HANDLE ); +extern void hb_MemvarSetValue( PSYMBOL, HB_ITEM_PTR ); +extern void hb_MemvarGetValue( HB_ITEM_PTR, PSYMBOL ); +extern void hb_MemvarGetRefer( HB_ITEM_PTR, PSYMBOL ); +extern void hb_MemvarNewSymbol( PSYMBOL ); +extern ULONG hb_MemvarGetPrivatesBase( void ); +extern void hb_MemvarSetPrivatesBase( ULONG ); + +extern void ProcessSymbols( PSYMBOL pSymbols, WORD wSymbols ); /* statics symbols initialization */ +extern char * hb_setColor( char * ); #endif /* HB_EXTEND_H_ */ diff --git a/harbour/include/extra.h b/harbour/include/extra.h deleted file mode 100644 index 30541f636e..0000000000 --- a/harbour/include/extra.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * $Id$ - */ - -#ifndef HB_EXTRA_H_ -#define HB_EXTRA_H_ - -#ifndef HARBOUR_OK -#define HARBOUR_OK 0 /* ES_WHOCARES */ -#endif - - -typedef ULONG ERRCODE; -typedef unsigned char UCHAR; -typedef void * HANDLE; - -typedef BOOL * BOOLP; - -#ifdef __XPP__ -#define ITEM ContainerHandle -#define PCOUNT( paramList ) PCOUNT( paramList ) -#define HARBOUR void -#define HARBOUR_ParamList void * -#define paramList paramList -#define XBONLY( x ) x -/* xbReleaseC( cFieldName ) */ -#else - -#define PCOUNT( paramList ) hb_parinfo(0) - -#ifndef PCOUNT -#define PCOUNT hb_parinfo(0) -#endif - -#ifdef __GNUC__ - -#if 0 -/* already defined in ./include/ */ -#define HARBOUR void __attribute__ ((stdcall)) -#endif - -#else -#define HARBOUR void -#endif - -#define HARBOUR_ParamList void -#define paramList -#define XBONLY( x ) -#define xbReleaseC( cFieldName ) -#endif - -#ifndef __XPP__ - -#define _PARC( paramlist, n ) hb_parc( n ) -#define _PARNL( paramList, n ) hb_parnl( n ) -#define _PARL( paramList, n ) hb_parl( n ) -#define _PARTYPE( paramList, n) hb_parinfo( n ) -#define _RETNL( paramList, n) hb_retnl( n ) -#define _RETL( paramList, n) hb_retl( n ) -#define _RETC( paramList, s) hb_retc( s ) -#define _RET( paramlist ) hb_ret() -#define _ITEMNEW( x ) hb_itemNew( x ) -#define _ITEMRELEASE( item ) hb_itemRelease( item ) -#define _ITEMRETURN( paramList, item ) hb_itemReturn( item ) -#define _ITEMPARAM( paramList, n ) hb_itemParam( n ) -#define _ITEMPUTNL( item, nLong ) hb_itemPutNL( item, nLong) -#define _ITEMPUTC( item, cStr ) hb_itemPutC( item, cStr ) -#define _ITEMGETC( item ) hb_itemGetC( item ) -#else - -#define _PARC( paramlist, n ) _xbParC( paramList, n) -#define _PARNL( paramlist, n ) _parnl( paramList, n ) -#define _PARL( paramlist, n ) _parl( paramList, n ) -#define _PARTYPE( paramList, n) _partype( paramList, n ) -#define _RETNL( paramlist, n ) _retnl( paramList, n ) -#define _RETL( paramlist, n ) _retl( paramList, n ) -#define _RETC( paramlist, s ) _retc( paramList, s ) -#define _RET( paramlist ) _ret( paramList ) -#define _ITEMNEW( x ) _conNew( x ) -#define _ITEMRELEASE( item ) _conRelease( item ) -#define _ITEMRETURN( paramList, x ) _conReturn( paramList, x ) -#define _ITEMPARAM( paramList, n ) _conParam( paramList, n, &pbRef); -#define _ITEMPUTNL( item, nLong ) _conPutNL( item, nLong) -#define _ITEMPUTC( item, cStr ) _conPutC( item, cStr ) -#define _ITEMGETC( item ) _xbGetC( item ) - - -#include -#include "xppdef.h" -#include "xppcon.h" - -#endif - - - -#ifdef DEBUG -void logmsg( char *s, ...); - -#ifdef __XPP__ -#define TRACEENTRY( p1, p2) traceentry( p1, p2) -#define TRACEEXIT( p1, p2) traceexit( p1, p2) -void traceentry( UCHAR *entrypoint, HARBOUR_ParamList paramList); -void traceexit( UCHAR *entrypoint, HARBOUR_ParamList paramList); -void tracecall( UCHAR *entrypoint, HARBOUR_ParamList paramList); -#else -#define TRACEENTRY( p1, p2) traceentry( p1 ) -#define TRACEEXIT( p1, p2) traceexit( p1 ) -void traceentry( UCHAR *entrypoint ); -void traceexit( UCHAR *entrypoint ); -void tracecall( UCHAR *entrypoint ); -#endif - -#define DEBUGTRACE1( x1 ) logmsg( x1 ) -#define DEBUGTRACE2( x1, x2 ) logmsg( x1, x2 ) -#define DEBUGTRACE3( x1, x2, x3) logmsg( x1, x2, x3) -#define DEBUGTRACE4( x1, x2, x3, x4) logmsg( x1, x2, x3, x4) -#define DEBUGTRACE5( x1, x2, x3, x4, x5) logmsg( x1, x2, x3, x4, x5) -#define DEBUGTRACE6( x1, x2, x3, x4, x5, x6) logmsg( x1, x2, x3, x4, x5, x6) -#define DEBUGTRACE7( x1, x2, x3, x4, x5, x6, x7) logmsg( x1, x2, x3, x4, x5, x6, x7) -#define DEBUGTRACE8( x1, x2, x3, x4, x5, x6, x7, x8) logmsg( x1, x2, x3, x4, x5, x6, x7, x8) -#define DEBUGTRACE9( x1, x2, x3, x4, x5, x6, x7, x8, x9 ) logmsg( x1, x2, x3, x4, x5, x6, x7, x8, x9) -#define DEBUGTRACE10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10 ) logmsg( x1, x2, x3, x4, x5, x6, x7, x8, x9, x10) -#define DEBUGTRACEX tracecall -#else - -void logmsg( char *s, ...); -#define TRACEENTRY( p1, p2) -#define TRACEEXIT( p1, p2) - -#define DEBUGTRACE1( x1 ) -#define DEBUGTRACE2( x1, x2 ) -#define DEBUGTRACE3( x1, x2, x3) -#define DEBUGTRACE4( x1, x2, x3, x4) -#define DEBUGTRACE5( x1, x2, x3, x4, x5) -#define DEBUGTRACE6( x1, x2, x3, x4, x5, x6) -#define DEBUGTRACE7( x1, x2, x3, x4, x5, x6, x7) -#define DEBUGTRACE8( x1, x2, x3, x4, x5, x6, x7, x8) -#define DEBUGTRACE9( x1, x2, x3, x4, x5, x6, x7, x8, x9 ) -#define DEBUGTRACE10(x1, x2, x3, x4, x5, x6, x7, x8, x9, x10 ) -#define DEBUGTRACEX( x, y ) -#endif - -#endif /* HB_EXTRA_H_ */ diff --git a/harbour/include/filesys.api b/harbour/include/filesys.api index 0cb6b3f9ee..87fa760c67 100644 --- a/harbour/include/filesys.api +++ b/harbour/include/filesys.api @@ -1,4 +1,4 @@ -/* +/* * $Id$ */ @@ -50,24 +50,24 @@ #include "filesys.h" -#define _fsChDir hb_fsChDir -#define _fsChDrv hb_fsChDrv -#define _fsClose hb_fsClose -#define _fsCommit hb_fsCommit -#define _fsCreate hb_fsCreate -#define _fsCurDir hb_fsCurDir -#define _fsCurDrv hb_fsCurDrv -#define _fsDelete hb_fsDelete -#define _fsError hb_fsError -#define _fsExtOpen hb_fsExtOpen -#define _fsIsDrv hb_fsIsDrv -#define _fsLock hb_fsLock -#define _fsMkDir hb_fsMkDir -#define _fsOpen hb_fsOpen -#define _fsRead hb_fsRead -#define _fsRmDir hb_fsRmDir -#define _fsRename hb_fsRename -#define _fsSeek hb_fsSeek -#define _fsWrite hb_fsWrite +#define _fsChDir hb_fsChDir +#define _fsChDrv hb_fsChDrv +#define _fsClose hb_fsClose +#define _fsCommit hb_fsCommit +#define _fsCreate hb_fsCreate +#define _fsCurDir hb_fsCurDir +#define _fsCurDrv hb_fsCurDrv +#define _fsDelete hb_fsDelete +#define _fsError hb_fsError +#define _fsExtOpen hb_fsExtOpen +#define _fsIsDrv hb_fsIsDrv +#define _fsLock hb_fsLock +#define _fsMkDir hb_fsMkDir +#define _fsOpen hb_fsOpen +#define _fsRead hb_fsRead +#define _fsRmDir hb_fsRmDir +#define _fsRename hb_fsRename +#define _fsSeek hb_fsSeek +#define _fsWrite hb_fsWrite #endif /* HB_FILESYS_API_ */ diff --git a/harbour/include/filesys.h b/harbour/include/filesys.h index c54b34c302..3a32af005d 100644 --- a/harbour/include/filesys.h +++ b/harbour/include/filesys.h @@ -54,26 +54,26 @@ typedef void * ERRORP; typedef int FHANDLE; typedef PBYTE BYTEP; -BOOL hb_fsChDir ( BYTEP fpDirName ); -USHORT hb_fsChDrv ( BYTEP nDrive ); -void hb_fsClose ( FHANDLE hFileHandle ); -void hb_fsCommit ( FHANDLE hFileHandle ); -FHANDLE hb_fsCreate ( BYTEP fpFilename, USHORT uiAttribute ); -BYTEP hb_fsCurDir ( USHORT uiDrive ); -BYTE hb_fsCurDrv ( void ); -void hb_fsDelete ( BYTEP fpFilename ); -USHORT hb_fsError ( void ); -FHANDLE hb_fsExtOpen( BYTEP fpFilename, BYTEP fpDefExt, - USHORT uiFlags, BYTEP fpPaths, ERRORP pError ); -USHORT hb_fsIsDrv ( BYTE nDrive ); -BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart, - ULONG ulLength, USHORT uiMode ); -BOOL hb_fsMkDir ( BYTEP fpDirName ); -FHANDLE hb_fsOpen ( BYTEP fpFilename, USHORT uiFlags ); -USHORT hb_fsRead ( FHANDLE hFileHandle, BYTEP fpBuff, USHORT uiCount ); -BOOL hb_fsRmDir ( BYTEP fpDirName ); -void hb_fsRename ( BYTEP fpOldName, BYTEP fpNewName ); -ULONG hb_fsSeek ( FHANDLE hFileHandle, LONG lOffset, USHORT uiMode ); -USHORT hb_fsWrite ( FHANDLE hFileHandle, BYTEP fpBuff, USHORT uiCount ); +extern BOOL hb_fsChDir ( BYTEP fpDirName ); +extern USHORT hb_fsChDrv ( BYTEP nDrive ); +extern void hb_fsClose ( FHANDLE hFileHandle ); +extern void hb_fsCommit ( FHANDLE hFileHandle ); +extern FHANDLE hb_fsCreate ( BYTEP fpFilename, USHORT uiAttribute ); +extern BYTEP hb_fsCurDir ( USHORT uiDrive ); +extern BYTE hb_fsCurDrv ( void ); +extern void hb_fsDelete ( BYTEP fpFilename ); +extern USHORT hb_fsError ( void ); +extern FHANDLE hb_fsExtOpen( BYTEP fpFilename, BYTEP fpDefExt, + USHORT uiFlags, BYTEP fpPaths, ERRORP pError ); +extern USHORT hb_fsIsDrv ( BYTE nDrive ); +extern BOOL hb_fsLock ( FHANDLE hFileHandle, ULONG ulStart, + ULONG ulLength, USHORT uiMode ); +extern BOOL hb_fsMkDir ( BYTEP fpDirName ); +extern FHANDLE hb_fsOpen ( BYTEP fpFilename, USHORT uiFlags ); +extern USHORT hb_fsRead ( FHANDLE hFileHandle, BYTEP fpBuff, USHORT uiCount ); +extern BOOL hb_fsRmDir ( BYTEP fpDirName ); +extern void hb_fsRename ( BYTEP fpOldName, BYTEP fpNewName ); +extern ULONG hb_fsSeek ( FHANDLE hFileHandle, LONG lOffset, USHORT uiMode ); +extern USHORT hb_fsWrite ( FHANDLE hFileHandle, BYTEP fpBuff, USHORT uiCount ); #endif /* HB_FILESYS_H_ */ diff --git a/harbour/include/fm.api b/harbour/include/fm.api index 65752df8b3..5e1f738b0d 100644 --- a/harbour/include/fm.api +++ b/harbour/include/fm.api @@ -10,8 +10,8 @@ #include "extend.h" -#define _xalloc hb_xalloc -#define _xgrab hb_xgrab -#define _xfree hb_xfree +#define _xalloc hb_xalloc +#define _xgrab hb_xgrab +#define _xfree hb_xfree #endif /* HB_FM_API_ */ diff --git a/harbour/include/gt.api b/harbour/include/gt.api index a476933f14..693710ff43 100644 --- a/harbour/include/gt.api +++ b/harbour/include/gt.api @@ -10,7 +10,6 @@ #include "gtapi.h" -#define _gtInit hb_gtInit #define _gtBox hb_gtBox #define _gtBoxD hb_gtBoxD #define _gtBoxS hb_gtBoxS diff --git a/harbour/include/gtapi.h b/harbour/include/gtapi.h index fbb6b2b37d..6e9416a1c8 100644 --- a/harbour/include/gtapi.h +++ b/harbour/include/gtapi.h @@ -47,38 +47,38 @@ /* Public interface. These should never change, only be added to. */ -void hb_gtInit(void); -void hb_gtExit(void); -int hb_gtBox(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString); -int hb_gtBoxD(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight); -int hb_gtBoxS(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight); -int hb_gtColorSelect(USHORT uiColorIndex); -int hb_gtDispBegin(void); -USHORT hb_gtDispCount(void); -int hb_gtDispEnd(void); -int hb_gtGetColorStr(char * fpColorString); -int hb_gtGetCursor(USHORT * uipCursorShape); -int hb_gtGetPos(USHORT * uipRow, USHORT * uipCol); -BOOL hb_gtIsColor(void); -USHORT hb_gtMaxCol(void); -USHORT hb_gtMaxRow(void); -int hb_gtPostExt(void); -int hb_gtPreExt(void); -int hb_gtRectSize(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT * uipBuffSize); -int hb_gtRepChar(USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount); -int hb_gtRest(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff); -int hb_gtSave(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff); -int hb_gtScrDim(USHORT * uipHeight, USHORT * uipWidth); -int hb_gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols); -int hb_gtSetBlink(BOOL bBlink); -int hb_gtSetColorStr(char * fpColorString); -int hb_gtSetCursor(USHORT uiCursorShape); -int hb_gtSetMode(USHORT uiRows, USHORT uiCols); -int hb_gtSetPos(USHORT uiRow, USHORT uiCol); -int hb_gtSetSnowFlag(BOOL bNoSnow); -int hb_gtWrite(char * fpStr, ULONG length); -int hb_gtWriteAt(USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length); -int hb_gtWriteCon(char * fpStr, ULONG length); +extern void hb_gtInit(void); +extern void hb_gtExit(void); +extern int hb_gtBox(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * fpBoxString); +extern int hb_gtBoxD(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight); +extern int hb_gtBoxS(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight); +extern int hb_gtColorSelect(USHORT uiColorIndex); +extern int hb_gtDispBegin(void); +extern USHORT hb_gtDispCount(void); +extern int hb_gtDispEnd(void); +extern int hb_gtGetColorStr(char * fpColorString); +extern int hb_gtGetCursor(USHORT * uipCursorShape); +extern int hb_gtGetPos(USHORT * uipRow, USHORT * uipCol); +extern BOOL hb_gtIsColor(void); +extern USHORT hb_gtMaxCol(void); +extern USHORT hb_gtMaxRow(void); +extern int hb_gtPostExt(void); +extern int hb_gtPreExt(void); +extern int hb_gtRectSize(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, USHORT * uipBuffSize); +extern int hb_gtRepChar(USHORT uiRow, USHORT uiCol, USHORT uiChar, USHORT uiCount); +extern int hb_gtRest(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff); +extern int hb_gtSave(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, char * vlpScrBuff); +extern int hb_gtScrDim(USHORT * uipHeight, USHORT * uipWidth); +extern int hb_gtScroll(USHORT uiTop, USHORT uiLeft, USHORT uiBottom, USHORT uiRight, SHORT iRows, SHORT iCols); +extern int hb_gtSetBlink(BOOL bBlink); +extern int hb_gtSetColorStr(char * fpColorString); +extern int hb_gtSetCursor(USHORT uiCursorShape); +extern int hb_gtSetMode(USHORT uiRows, USHORT uiCols); +extern int hb_gtSetPos(USHORT uiRow, USHORT uiCol); +extern int hb_gtSetSnowFlag(BOOL bNoSnow); +extern int hb_gtWrite(char * fpStr, ULONG length); +extern int hb_gtWriteAt(USHORT uiRow, USHORT uiCol, char * fpStr, ULONG length); +extern int hb_gtWriteCon(char * fpStr, ULONG length); #ifndef DOS #if defined(_QC) || defined(__DOS__) || defined(MSDOS) || defined(__MSDOS__) @@ -105,26 +105,27 @@ int hb_gtWriteCon(char * fpStr, ULONG length); #endif /* private interface listed below. these are common to all platforms */ +/* TODO: Rename these to hb_gt_*() */ -void gtInit(void); -int gtIsColor(void); -void gtDone(void); -char gtGetScreenWidth(void); -char gtGetScreenHeight(void); -void gtSetPos(char cRow, char cCol); -char gtCol(void); -char gtRow(void); -void gtScroll(char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz); -void gtSetCursorStyle(int style); -int gtGetCursorStyle(void); -void gtPuts(char cRow, char cCol, char attr, char *str, int len); -void gtGetText(char cTop, char cLeft, char cBottom, char cRight, char *dest); -void gtPutText(char cTop, char cLeft, char cBottom, char cRight, char *srce); -void gtSetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute ); -void gtDrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute ); -void hb_gt_DispBegin(char color); -void hb_gt_DispEnd(void); -ULONG hb_gt_ScreenBuffer( ULONG buffer ); -void hb_gt_SetMode( USHORT uiRows, USHORT uiCols ); +extern void gtInit(void); +extern int gtIsColor(void); +extern void gtDone(void); +extern char gtGetScreenWidth(void); +extern char gtGetScreenHeight(void); +extern void gtSetPos(char cRow, char cCol); +extern char gtCol(void); +extern char gtRow(void); +extern void gtScroll(char cTop, char cLeft, char cBottom, char cRight, char attribute, char vert, char horiz); +extern void gtSetCursorStyle(int style); +extern int gtGetCursorStyle(void); +extern void gtPuts(char cRow, char cCol, char attr, char *str, int len); +extern void gtGetText(char cTop, char cLeft, char cBottom, char cRight, char *dest); +extern void gtPutText(char cTop, char cLeft, char cBottom, char cRight, char *srce); +extern void gtSetAttribute( char cTop, char cLeft, char cBottom, char cRight, char attribute ); +extern void gtDrawShadow( char cTop, char cLeft, char cBottom, char cRight, char attribute ); +extern void hb_gt_DispBegin(char color); +extern void hb_gt_DispEnd(void); +extern ULONG hb_gt_ScreenBuffer( ULONG buffer ); +extern void hb_gt_SetMode( USHORT uiRows, USHORT uiCols ); #endif /* HB_GTAPI_H_ */ diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index a27abe418c..3787deb611 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -94,7 +94,7 @@ typedef int BOOL; #define EXTERNAL_LINKAGE #endif #endif -typedef HARBOUR ( * HARBOURFUNC )( void ); +typedef HARBOUR ( * PHB_FUNC )( void ); #ifndef _POSIX_PATH_MAX #define _POSIX_PATH_MAX 255 diff --git a/harbour/include/hberrors.h b/harbour/include/hberrors.h index 9a4dd5ea45..b3e9920d18 100644 --- a/harbour/include/hberrors.h +++ b/harbour/include/hberrors.h @@ -88,7 +88,7 @@ #define ERR_RECURSE 8 #define ERR_WRONG_DIRECTIVE 9 -void GenError( char* _szErrors[], char, int, char*, char * ); /* generic parsing error management function */ -void GenWarning( int, char*, char * ); /* generic parsing warning management function */ +extern void GenError( char* _szErrors[], char, int, char*, char * ); /* generic parsing error management function */ +extern void GenWarning( int, char*, char * ); /* generic parsing warning management function */ #endif /* HB_ERROR_H_ */ diff --git a/harbour/include/init.h b/harbour/include/init.h index d992abdb74..62e1533ca3 100644 --- a/harbour/include/init.h +++ b/harbour/include/init.h @@ -29,7 +29,7 @@ #ifndef HB_INIT_H_ #define HB_INIT_H_ -void ProcessSymbols( SYMBOL * pSymbols, WORD wSymbols ); +extern void ProcessSymbols( SYMBOL * pSymbols, WORD wSymbols ); #ifdef HARBOUR_STRICT_ANSI_C diff --git a/harbour/include/inkey.h b/harbour/include/inkey.h index 95269ee364..e0ae2a310f 100644 --- a/harbour/include/inkey.h +++ b/harbour/include/inkey.h @@ -43,10 +43,10 @@ #include "hbdefs.h" /* Harbour keyboard support functions */ -int hb_inkeyGet( void ); /* Extract the next key from the Harbour keyboard buffer */ -int hb_inkeyLast( void ); /* Return the value of the last key that was extracted */ -int hb_inkeyNext( void ); /* Return the next key without extracting it */ -void hb_inkeyPoll( void ); /* Poll the console keyboard to stuff the Harbour buffer */ -void hb_inkeyReset( BOOL allocate ); /* Reset the Harbour keyboard buffer */ +extern int hb_inkeyGet( void ); /* Extract the next key from the Harbour keyboard buffer */ +extern int hb_inkeyLast( void ); /* Return the value of the last key that was extracted */ +extern int hb_inkeyNext( void ); /* Return the next key without extracting it */ +extern void hb_inkeyPoll( void ); /* Poll the console keyboard to stuff the Harbour buffer */ +extern void hb_inkeyReset( BOOL allocate ); /* Reset the Harbour keyboard buffer */ #endif diff --git a/harbour/include/item.api b/harbour/include/item.api index 09f0437de6..69459040f5 100644 --- a/harbour/include/item.api +++ b/harbour/include/item.api @@ -10,13 +10,9 @@ #include "itemapi.h" -#define _arrayNew hb_arrayNew -#define _arrayLen hb_arrayLen -#define _arrayGet hb_arrayGet -#define _arrayPut hb_arraySet -#define _arrayResize hb_arraySize -#define _arrayGetC hb_arrayGetString -#define _arrayGetCL hb_arrayGetStringLen +#ifndef ITEM +#define ITEM PHB_ITEM +#endif #define _evalLaunch hb_evalLaunch #define _evalNew hb_evalNew diff --git a/harbour/include/itemapi.h b/harbour/include/itemapi.h index a75e2e91cc..b1d61d9b60 100644 --- a/harbour/include/itemapi.h +++ b/harbour/include/itemapi.h @@ -29,41 +29,39 @@ #include "extend.h" +#define HB_EVAL_PARAM_MAX_ 10 + typedef struct { - WORD type; - WORD paramCount; - PHB_ITEM pItems[ 10 ]; + PHB_ITEM pItems[ HB_EVAL_PARAM_MAX_ + 1 ]; } EVALINFO, * PEVALINFO; -#define ITEM PHB_ITEM +extern PHB_ITEM hb_evalLaunch( PEVALINFO pEvalInfo ); +extern BOOL hb_evalNew( PEVALINFO pEvalInfo, PHB_ITEM pItem ); +extern BOOL hb_evalPutParam( PEVALINFO pEvalInfo, PHB_ITEM pItem ); +extern BOOL hb_evalRelease( PEVALINFO pEvalInfo ); -PHB_ITEM hb_evalLaunch( PEVALINFO pEvalInfo ); -BOOL hb_evalNew( PEVALINFO pEvalInfo, PHB_ITEM pItem ); -BOOL hb_evalPutParam( PEVALINFO pEvalInfo, PHB_ITEM pItem ); -BOOL hb_evalRelease( PEVALINFO pEvalInfo ); - -PHB_ITEM hb_itemArrayGet( PHB_ITEM pArray, ULONG ulIndex ); -PHB_ITEM hb_itemArrayNew( ULONG ulLen ); -PHB_ITEM hb_itemArrayPut( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); -ULONG hb_itemCopyC( PHB_ITEM pItem, char *szBuffer, ULONG ulLen ); -BOOL hb_itemFreeC( char *szText ); -char * hb_itemGetC( PHB_ITEM pItem ); -char * hb_itemGetDS( PHB_ITEM pItem, char *szDate ); -BOOL hb_itemGetL( PHB_ITEM pItem ); -double hb_itemGetND( PHB_ITEM pItem ); -long hb_itemGetNL( PHB_ITEM pItem ); -PHB_ITEM hb_itemNew( PHB_ITEM pNull ); -PHB_ITEM hb_itemParam( WORD wParam ); -PHB_ITEM hb_itemPutC( PHB_ITEM pItem, char *szText ); -PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, char *nszText, ULONG ulLen ); -PHB_ITEM hb_itemPutDS( PHB_ITEM pItem, char *szDate ); -PHB_ITEM hb_itemPutL( PHB_ITEM pItem, BOOL bValue ); -PHB_ITEM hb_itemPutND( PHB_ITEM pItem, double dNumber ); -PHB_ITEM hb_itemPutNL( PHB_ITEM pItem, long lNumber ); -BOOL hb_itemRelease( PHB_ITEM pItem ); -PHB_ITEM hb_itemReturn( PHB_ITEM pItem ); -ULONG hb_itemSize( PHB_ITEM pItem ); -WORD hb_itemType( PHB_ITEM pItem ); +extern PHB_ITEM hb_itemArrayGet( PHB_ITEM pArray, ULONG ulIndex ); +extern PHB_ITEM hb_itemArrayNew( ULONG ulLen ); +extern PHB_ITEM hb_itemArrayPut( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ); +extern ULONG hb_itemCopyC( PHB_ITEM pItem, char *szBuffer, ULONG ulLen ); +extern BOOL hb_itemFreeC( char *szText ); +extern char * hb_itemGetC( PHB_ITEM pItem ); +extern char * hb_itemGetDS( PHB_ITEM pItem, char *szDate ); +extern BOOL hb_itemGetL( PHB_ITEM pItem ); +extern double hb_itemGetND( PHB_ITEM pItem ); +extern long hb_itemGetNL( PHB_ITEM pItem ); +extern PHB_ITEM hb_itemNew( PHB_ITEM pNull ); +extern PHB_ITEM hb_itemParam( WORD wParam ); +extern PHB_ITEM hb_itemPutC( PHB_ITEM pItem, char *szText ); +extern PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, char *nszText, ULONG ulLen ); +extern PHB_ITEM hb_itemPutDS( PHB_ITEM pItem, char *szDate ); +extern PHB_ITEM hb_itemPutL( PHB_ITEM pItem, BOOL bValue ); +extern PHB_ITEM hb_itemPutND( PHB_ITEM pItem, double dNumber ); +extern PHB_ITEM hb_itemPutNL( PHB_ITEM pItem, long lNumber ); +extern BOOL hb_itemRelease( PHB_ITEM pItem ); +extern PHB_ITEM hb_itemReturn( PHB_ITEM pItem ); +extern ULONG hb_itemSize( PHB_ITEM pItem ); +extern WORD hb_itemType( PHB_ITEM pItem ); #endif /* HB_ITEMAPI_H_ */ diff --git a/harbour/include/set.h b/harbour/include/set.h index 6842fe1571..37e6ace17f 100644 --- a/harbour/include/set.h +++ b/harbour/include/set.h @@ -76,16 +76,6 @@ #include "hbdefs.h" -HARBOUR HB_SET( void ); -HARBOUR HB_SETCENTURY( void ); -char * hb_setColor( char * ); -void hb_setInitialize(void ); -void hb_consoleInitialize( void ); -void hb_rddInitialize( void ); -void hb_setRelease( void ); -void hb_consoleRelease( void ); -void hb_rddRelease( void ); - typedef enum { SC_NONE = 0, /* None */ @@ -200,4 +190,9 @@ extern int hb_set_althan; extern int hb_set_extrahan; extern int hb_set_printhan; +extern HARBOUR HB_SET( void ); +extern HARBOUR HB_SETCENTURY( void ); +extern void hb_setInitialize( void ); +extern void hb_setRelease( void ); + #endif /* HB_SET_H_ */ diff --git a/harbour/include/super.h b/harbour/include/super.h deleted file mode 100644 index d344dabcfc..0000000000 --- a/harbour/include/super.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * $Id$ - */ - -#ifndef HB_SUPER_H_ -#define HB_SUPER_H_ - -#define SUPER_VERSION "version 0.00" - -#endif /* HB_SUPER_H_ */ diff --git a/harbour/include/vm.api b/harbour/include/vm.api index f311ef95be..dd085f987e 100644 --- a/harbour/include/vm.api +++ b/harbour/include/vm.api @@ -8,7 +8,9 @@ #ifndef HB_VM_API_ #define HB_VM_API_ -typedef void* HANDLE; +#include "extend.h" + +typedef void * HANDLE; /* Standard */ #define _xvalloc(size, flags) hb_xalloc(size) diff --git a/harbour/source/hbpp/hbpplib.c b/harbour/source/hbpp/hbpplib.c index 2aaade26db..dc425f4de9 100644 --- a/harbour/source/hbpp/hbpplib.c +++ b/harbour/source/hbpp/hbpplib.c @@ -36,7 +36,6 @@ /* TODO: Move this to source/tools */ -#include #include #include "hbpp.h" #include "extend.h" diff --git a/harbour/source/rtl/arrays.c b/harbour/source/rtl/arrays.c index 82edf20fe9..c8beeb231b 100644 --- a/harbour/source/rtl/arrays.c +++ b/harbour/source/rtl/arrays.c @@ -64,11 +64,8 @@ HB_INIT_SYMBOLS_END( Arrays__InitSymbols ); */ -char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex ) +char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex, char * szDate ) { - static char szDate[ 9 ]; - long lDay, lMonth, lYear; - if( IS_ARRAY( pArray ) ) { if( ulIndex <= ( unsigned )hb_arrayLen( pArray ) ) @@ -77,24 +74,15 @@ char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex ) if( IS_DATE( pItem ) && pItem->item.asDate.value > 0 ) { + long lDay, lMonth, lYear; + hb_dateDecode( pItem->item.asDate.value, &lDay, &lMonth, &lYear ); - - szDate[ 0 ] = ( lYear / 1000 ) + '0'; - szDate[ 1 ] = ( ( lYear % 1000 ) / 100 ) + '0'; - szDate[ 2 ] = ( ( lYear % 100 ) / 10 ) + '0'; - szDate[ 3 ] = ( lYear % 10 ) + '0'; - - szDate[ 4 ] = ( lMonth / 10 ) + '0'; - szDate[ 5 ] = ( lMonth % 10 ) + '0'; - - szDate[ 6 ] = ( lDay / 10 ) + '0'; - szDate[ 7 ] = ( lDay % 10 ) + '0'; - szDate[ 8 ] = 0; - - return szDate; - } + hb_dateStrPut( szDate, lDay, lMonth, lYear ); + } else - return " "; + { + memset( szDate, ' ', 8 ); + } } else { @@ -105,7 +93,8 @@ char * hb_arrayGetDate( PHB_ITEM pArray, ULONG ulIndex ) { hb_errorRT_BASE(EG_ARG, 1068, NULL, hb_errorNatDescription(EG_ARRACCESS)); } - return " "; + + return szDate; } diff --git a/harbour/source/rtl/classes.c b/harbour/source/rtl/classes.c index 5606ee85f3..6220949a73 100644 --- a/harbour/source/rtl/classes.c +++ b/harbour/source/rtl/classes.c @@ -57,11 +57,11 @@ typedef struct { - void * pMessage; /* pointer to dynamic symbol when they get ready */ - HARBOURFUNC pFunction; - WORD wData; - WORD wScope; - PHB_ITEM pInitValue; + void * pMessage; /* pointer to dynamic symbol when they get ready */ + PHB_FUNC pFunction; + WORD wData; + WORD wScope; + PHB_ITEM pInitValue; } METHOD, * PMETHOD; typedef struct @@ -78,46 +78,46 @@ typedef struct #define BASE_METHODS 200 #define BUCKET 4 -#define HASH_KEY BASE_METHODS/BUCKET +#define HASH_KEY (BASE_METHODS / BUCKET) PCLASS pClasses = 0; WORD wClasses = 0; PMETHOD pMethod = 0; -PDYNSYM msgClassName = 0, - msgClassH = 0, - msgEval = 0, - msgClassSel = 0; +PDYNSYM msgClassName = 0; +PDYNSYM msgClassH = 0; +PDYNSYM msgEval = 0; +PDYNSYM msgClassSel = 0; /* All functions contained in classes.c */ - HARBOUR HB_CLASSADD( void ); - HARBOUR HB_CLASSCREATE( void ); - HARBOUR HB_CLASSDEL( void ); -static HARBOUR ClassH( void ); - HARBOUR HB_CLASSINSTANCE( void ); - HARBOUR HB_CLASSMOD( void ); -static HARBOUR ClassName( void ); - HARBOUR HB_CLASSNAME( void ); -static HARBOUR ClassSel( void ); -static void DictRealloc( PCLASS ); -static HARBOUR EvalInline( void ); -static HARBOUR GetClassData( void ); -static HARBOUR GetData( void ); - HARBOURFUNC hb_GetMethod( PHB_ITEM, PSYMBOL ); - ULONG hb_isMessage( PHB_ITEM, char *); - HARBOUR HB_ISMESSAGE( void ); - HARBOUR HB_OCLONE( void ); - HARBOUR HB_OSEND( void ); - void ReleaseClass( PCLASS ); - void ReleaseClasses( void ); -static HARBOUR SelectSuper( void ); -static HARBOUR SetClassData( void ); -static HARBOUR SetData( void ); -static HARBOUR Virtual( void ); - HARBOUR HB___INSTSUPER( void ); - HARBOUR HB___WDATAS( void ); - HARBOUR HB___WDATADEC( void ); - HARBOUR HB___WDATAINC( void ); + HARBOUR HB_CLASSADD( void ); + HARBOUR HB_CLASSCREATE( void ); + HARBOUR HB_CLASSDEL( void ); +static HARBOUR ClassH( void ); + HARBOUR HB_CLASSINSTANCE( void ); + HARBOUR HB_CLASSMOD( void ); +static HARBOUR ClassName( void ); + HARBOUR HB_CLASSNAME( void ); +static HARBOUR ClassSel( void ); +static void DictRealloc( PCLASS ); +static HARBOUR EvalInline( void ); +static HARBOUR GetClassData( void ); +static HARBOUR GetData( void ); + PHB_FUNC hb_GetMethod( PHB_ITEM, PSYMBOL ); + ULONG hb_isMessage( PHB_ITEM, char *); + HARBOUR HB_ISMESSAGE( void ); + HARBOUR HB_OCLONE( void ); + HARBOUR HB_OSEND( void ); + void ReleaseClass( PCLASS ); + void ReleaseClasses( void ); +static HARBOUR SelectSuper( void ); +static HARBOUR SetClassData( void ); +static HARBOUR SetData( void ); +static HARBOUR Virtual( void ); + HARBOUR HB___INSTSUPER( void ); + HARBOUR HB___WDATAS( void ); + HARBOUR HB___WDATADEC( void ); + HARBOUR HB___WDATAINC( void ); /* All function contained in matching objfunc.prg */ @@ -219,7 +219,7 @@ HARBOUR HB_CLASSADD(void) switch( wType ) { case MET_METHOD: - pNewMeth->pFunction = ( HARBOURFUNC ) hb_parnl( 3 ); + pNewMeth->pFunction = ( PHB_FUNC ) hb_parnl( 3 ); break; case MET_DATA: @@ -354,7 +354,7 @@ HARBOUR HB_CLASSDEL(void) WORD wLimit; WORD wMask; - HARBOURFUNC pFunc; + PHB_FUNC pFunc; if( wClass && wClass <= wClasses ) { @@ -445,17 +445,17 @@ HARBOUR HB_CLASSINSTANCE(void) */ HARBOUR HB_CLASSMOD(void) { - PHB_ITEM pString = hb_param( 2, IT_STRING ); - PSYMBOL pMessage = hb_GetDynSym( pString->item.asString.value )->pSymbol; - PDYNSYM pMsg = ( PDYNSYM ) pMessage->pDynSym; - PCLASS pClass; + PHB_ITEM pString = hb_param( 2, IT_STRING ); + PSYMBOL pMessage = hb_GetDynSym( pString->item.asString.value )->pSymbol; + PDYNSYM pMsg = ( PDYNSYM ) pMessage->pDynSym; + PCLASS pClass; - WORD wClass = hb_parni( 1 ); - WORD wAt; - WORD wLimit; - WORD wMask; + WORD wClass = hb_parni( 1 ); + WORD wAt; + WORD wLimit; + WORD wMask; - HARBOURFUNC pFunc; + PHB_FUNC pFunc; if( wClass && wClass <= wClasses ) { @@ -485,7 +485,7 @@ HARBOUR HB_CLASSMOD(void) hb_errorRT_BASE(EG_ARG, 3004, NULL, "CLASSMOD"); } else /* Modify METHOD */ - pClass->pMethods[ wAt ].pFunction = ( HARBOURFUNC ) hb_parnl( 3 ); + pClass->pMethods[ wAt ].pFunction = ( PHB_FUNC ) hb_parnl( 3 ); } } } @@ -723,7 +723,7 @@ static HARBOUR GetData( void ) * * Internal function to the function pointer of a message of an object */ -HARBOURFUNC hb_GetMethod( PHB_ITEM pObject, PSYMBOL pMessage ) +PHB_FUNC hb_GetMethod( PHB_ITEM pObject, PSYMBOL pMessage ) { WORD wAt, wLimit, wMask; WORD wClass; diff --git a/harbour/source/rtl/codebloc.c b/harbour/source/rtl/codebloc.c index 9715e62653..303eb79aee 100644 --- a/harbour/source/rtl/codebloc.c +++ b/harbour/source/rtl/codebloc.c @@ -35,15 +35,8 @@ /* The Harbour implementation of codeblocks */ -#include "extend.h" #include - -/* functions for memvar variables - */ -HB_HANDLE hb_MemvarValueNew( PHB_ITEM, int ); -void hb_MemvarValueIncRef( HB_HANDLE ); -void hb_MemvarValueDecRef( HB_HANDLE ); -HB_VALUE_PTR * hb_MemvarValueBaseAddress( void ); +#include "extend.h" /* Uncomment this to trace codeblocks activity #define CODEBLOCKDEBUG diff --git a/harbour/source/rtl/dates.c b/harbour/source/rtl/dates.c index a74b51f703..b60fabee73 100644 --- a/harbour/source/rtl/dates.c +++ b/harbour/source/rtl/dates.c @@ -1,6 +1,7 @@ /* * $Id$ */ + /* Harbour Project source code * http://www.Harbour-Project.org/ * @@ -166,6 +167,34 @@ void hb_dateDecode( long julian, long * plDay, long * plMonth, long * plYear ) } } +void hb_dateStrPut( char * szDate, long lDay, long lMonth, long lYear ) +{ + szDate[ 0 ] = ( lYear / 1000 ) + '0'; + szDate[ 1 ] = ( ( lYear % 1000 ) / 100 ) + '0'; + szDate[ 2 ] = ( ( lYear % 100 ) / 10 ) + '0'; + szDate[ 3 ] = ( lYear % 10 ) + '0'; + + szDate[ 4 ] = ( lMonth / 10 ) + '0'; + szDate[ 5 ] = ( lMonth % 10 ) + '0'; + + szDate[ 6 ] = ( lDay / 10 ) + '0'; + szDate[ 7 ] = ( lDay % 10 ) + '0'; +} + +void hb_dateStrGet( char * szDate, long * plDay, long * plMonth, long * plYear ) +{ + if( szDate && strlen( szDate ) == 8 ) + { + /* Date string has correct length, so attempt to convert */ + *plDay = ( ( szDate[ 6 ] - '0' ) * 10 ) + ( szDate[ 7 ] - '0' ); + *plMonth = ( ( szDate[ 4 ] - '0' ) * 10 ) + ( szDate[ 5 ] - '0' ); + *plYear = ( ( szDate[ 0 ] - '0' ) * 1000 ) + ( ( szDate[ 1 ] - '0' ) * 100 ) + + ( ( szDate[ 2 ] - '0' ) * 10 ) + ( szDate[ 3 ] - '0' ); + } + else *plDay = *plMonth = *plYear = 0; /* Date string missing or bad length, + so force an empty date */ +} + HARBOUR HB_CTOD( void ) { char * szDate = hb_parc( 1 ); @@ -435,7 +464,7 @@ HARBOUR HB_DTOS( void ) HARBOUR HB_STOD( void ) { - hb_retds((ISCHAR(1) && hb_parclen(1) == 8) ? hb_parc(1) : " "); + hb_retds( hb_parc(1) ); } HARBOUR HB_DAY( void ) @@ -456,7 +485,7 @@ HARBOUR HB_DAY( void ) hb_itemRelease( pReturn ); /* hb_retni( lDay ); - * It is dengerous to manipulate the stack return value directly! + * It is dangerous to manipulate the stack return value directly! stack.Return.item.asInteger.length = 3; */ } @@ -484,7 +513,7 @@ HARBOUR HB_MONTH( void ) hb_itemRelease( pReturn ); /* hb_retni( lMonth ); - * It is dengerous to manipulate the stack return value directly! + * It is dangerous to manipulate the stack return value directly! stack.Return.item.asInteger.length = 3; */ } @@ -512,7 +541,7 @@ HARBOUR HB_YEAR( void ) hb_itemRelease( pReturn ); /* hb_retni( lYear ); - * It is dengerous to manipulate the stack return value directly! + * It is dangerous to manipulate the stack return value directly! stack.Return.item.asInteger.length = 5; */ } @@ -589,13 +618,13 @@ HARBOUR HB_DOW( void ) { hb_dateDecode( pDate->item.asDate.value, &lDay, &lMonth, &lYear ); pReturn->item.asLong.value =hb_dow( lDay, lMonth, lYear ); - /* hb_retni( hb_dow( lDay, lMonth, lYear ) ); - */ + /* hb_retni( hb_dow( lDay, lMonth, lYear ) ); + */ } else pReturn->item.asLong.value =0; - /* hb_retni( 0 ); - */ + /* hb_retni( 0 ); + */ pReturn->item.asLong.length =3; hb_itemReturn( pReturn ); diff --git a/harbour/source/rtl/extend.c b/harbour/source/rtl/extend.c index 54236843ee..db8f3cf933 100644 --- a/harbour/source/rtl/extend.c +++ b/harbour/source/rtl/extend.c @@ -138,12 +138,52 @@ ULONG hb_parclen( int iParam, ... ) return 0; } +/* Same as _parclen() but return the length including the */ +/* terminating zero byte */ + +ULONG hb_parcsiz( int iParam, ... ) +{ + PHB_ITEM pItem; + va_list va; + WORD wArrayIndex; + + va_start( va, iParam ); + wArrayIndex = va_arg( va, int ); + va_end( va ); + + if( ( iParam <= hb_pcount() ) || ( iParam == -1 ) ) + { + if( iParam == -1 ) + pItem = &stack.Return; + else if( iParam < -1 ) + return 0; + else + pItem = stack.pBase + 1 + iParam; + + if( IS_BYREF( pItem ) ) + pItem = hb_itemUnRef( pItem ); + + if( IS_ARRAY( pItem ) ) + { + if( wArrayIndex ) + return hb_arrayGetStringLen( pItem, wArrayIndex ) + 1; + else + return 0; + } + else if( IS_STRING( pItem ) ) + return pItem->item.asString.length + 1; + + else + return 0; + } + return 0; +} + char * hb_pards( int iParam, ... ) { PHB_ITEM pItem; va_list va; WORD wArrayIndex; - long lDay, lMonth, lYear; va_start( va, iParam ); wArrayIndex = va_arg( va, int ); @@ -164,25 +204,21 @@ char * hb_pards( int iParam, ... ) if( IS_ARRAY( pItem ) ) { if( wArrayIndex ) - return strcpy( stack.szDate, hb_arrayGetDate( pItem, wArrayIndex ) ); + { + hb_arrayGetDate( pItem, wArrayIndex, stack.szDate ); + stack.szDate[ 8 ] = 0; + + return stack.szDate; + } else return " "; } - - else if( IS_DATE( pItem ) && pItem->item.asDate.value > 0 ) + else if( IS_DATE( pItem ) && pItem->item.asDate.value > 0 ) { + long lDay, lMonth, lYear; + hb_dateDecode( pItem->item.asDate.value, &lDay, &lMonth, &lYear ); - - stack.szDate[ 0 ] = ( lYear / 1000 ) + '0'; - stack.szDate[ 1 ] = ( ( lYear % 1000 ) / 100 ) + '0'; - stack.szDate[ 2 ] = ( ( lYear % 100 ) / 10 ) + '0'; - stack.szDate[ 3 ] = ( lYear % 10 ) + '0'; - - stack.szDate[ 4 ] = ( lMonth / 10 ) + '0'; - stack.szDate[ 5 ] = ( lMonth % 10 ) + '0'; - - stack.szDate[ 6 ] = ( lDay / 10 ) + '0'; - stack.szDate[ 7 ] = ( lDay % 10 ) + '0'; + hb_dateStrPut( stack.szDate, lDay, lMonth, lYear ); stack.szDate[ 8 ] = 0; return stack.szDate; /* this guaranties good behavior when multithreading */ @@ -444,16 +480,7 @@ void hb_retds( char * szDate ) /* szDate must have yyyymmdd format */ { long lDay, lMonth, lYear; - if( szDate && strlen( szDate ) == 8 ) - { - /* Date string has correct length, so attempt to convert */ - lDay = ( ( szDate[ 6 ] - '0' ) * 10 ) + ( szDate[ 7 ] - '0' ); - lMonth = ( ( szDate[ 4 ] - '0' ) * 10 ) + ( szDate[ 5 ] - '0' ); - lYear = ( ( szDate[ 0 ] - '0' ) * 1000 ) + ( ( szDate[ 1 ] - '0' ) * 100 ) + - ( ( szDate[ 2 ] - '0' ) * 10 ) + ( szDate[ 3 ] - '0' ); - } - else lDay = lMonth = lYear = 0; /* Date string missing or bad length, - so force an empty date */ + hb_dateStrGet( szDate, &lDay, &lMonth, &lYear ); hb_itemClear( &stack.Return ); @@ -608,21 +635,8 @@ void hb_storclen( char * fixText, WORD wLength, int iParam, ... ) void hb_stords( char * szDate, int iParam, ... ) /* szDate must have yyyymmdd format */ { - PHB_ITEM pItem, pItemRef; va_list va; WORD wArrayIndex; - long lDay, lMonth, lYear; - - if( szDate && strlen( szDate ) == 8 ) - { - /* Date string is valid length, so attempt conversion */ - lDay = ( ( szDate[ 6 ] - '0' ) * 10 ) + ( szDate[ 7 ] - '0' ); - lMonth = ( ( szDate[ 4 ] - '0' ) * 10 ) + ( szDate[ 5 ] - '0' ); - lYear = ( ( szDate[ 0 ] - '0' ) * 1000 ) + ( ( szDate[ 1 ] - '0' ) * 100 ) + - ( ( szDate[ 2 ] - '0' ) * 10 ) + ( szDate[ 3 ] - '0' ); - } - else lDay = lMonth = lYear = 0; /* Date string missing or bad length, - so force an empty date */ va_start( va, iParam ); wArrayIndex = va_arg( va, int ); @@ -630,6 +644,11 @@ void hb_stords( char * szDate, int iParam, ... ) /* szDate must have yyyymmdd fo if( ( iParam <= hb_pcount() ) || ( iParam == -1 ) ) { + PHB_ITEM pItem, pItemRef; + long lDay, lMonth, lYear; + + hb_dateStrGet( szDate, &lDay, &lMonth, &lYear ); + if( iParam == -1 ) { pItem = &stack.Return; diff --git a/harbour/source/rtl/files.c b/harbour/source/rtl/files.c index 1a86a51394..2f41c220a8 100644 --- a/harbour/source/rtl/files.c +++ b/harbour/source/rtl/files.c @@ -492,6 +492,8 @@ BOOL hb_fsRmDir ( BYTEP name ) return (result ? FALSE : TRUE ); } +/* TODO: Make it thread safe */ + BYTEP hb_fsCurDir ( USHORT uiDrive ) { static char cwd_buff[PATH_MAX+1]; diff --git a/harbour/source/rtl/itemapi.c b/harbour/source/rtl/itemapi.c index cfdd07c368..6558ac1f15 100644 --- a/harbour/source/rtl/itemapi.c +++ b/harbour/source/rtl/itemapi.c @@ -49,7 +49,7 @@ BOOL hb_evalPutParam( PEVALINFO pEvalInfo, PHB_ITEM pItem ) if( pEvalInfo ) { - for( w = 1; w < 10; w++ ) /* note that 0 position is used by the codeblock or function name item */ + for( w = 1; w < HB_EVAL_PARAM_MAX_ + 1; w++ ) /* note that 0 position is used by the codeblock or function name item */ { if( ! pEvalInfo->pItems[ w ] ) { @@ -70,7 +70,7 @@ BOOL hb_evalRelease( PEVALINFO pEvalInfo ) if( pEvalInfo ) { - for( w = 0; w < 10; w++ ) + for( w = 0; w < HB_EVAL_PARAM_MAX_ + 1; w++ ) hb_itemRelease( pEvalInfo->pItems[ w ] ); bResult = TRUE; } @@ -88,7 +88,7 @@ PHB_ITEM hb_evalLaunch( PEVALINFO pEvalInfo ) { PushSymbol( hb_GetDynSym( hb_itemGetC( pEvalInfo->pItems[ 0 ] ) )->pSymbol ); PushNil(); - while( w < 10 && pEvalInfo->pItems[ w ] ) + while( w < (HB_EVAL_PARAM_MAX_ + 1) && pEvalInfo->pItems[ w ] ) Push( pEvalInfo->pItems[ w++ ] ); Do( w - 1 ); pResult = hb_itemNew( 0 ); @@ -98,7 +98,7 @@ PHB_ITEM hb_evalLaunch( PEVALINFO pEvalInfo ) { PushSymbol( &symEval ); Push( pEvalInfo->pItems[ 0 ] ); - while( w < 10 && pEvalInfo->pItems[ w ] ) + while( w < (HB_EVAL_PARAM_MAX_ + 1) && pEvalInfo->pItems[ w ] ) Push( pEvalInfo->pItems[ w++ ] ); Do( w - 1 ); pResult = hb_itemNew( 0 ); @@ -243,24 +243,16 @@ char *hb_itemGetDS( PHB_ITEM pItem, char *szDate ) if( pItem && IS_DATE(pItem) ) { long lDay, lMonth, lYear; - hb_dateDecode(pItem->item.asDate.value, &lDay, &lMonth, &lYear); - szDate[ 0 ] = ( lYear / 1000 ) + '0'; - szDate[ 1 ] = ( ( lYear % 1000 ) / 100 ) + '0'; - szDate[ 2 ] = ( ( lYear % 100 ) / 10 ) + '0'; - szDate[ 3 ] = ( lYear % 10 ) + '0'; - - szDate[ 4 ] = ( lMonth / 10 ) + '0'; - szDate[ 5 ] = ( lMonth % 10 ) + '0'; - - szDate[ 6 ] = ( lDay / 10 ) + '0'; - szDate[ 7 ] = ( lDay % 10 ) + '0'; - szDate[ 8 ] = 0; - - return szDate; + hb_dateDecode( pItem->item.asDate.value, &lDay, &lMonth, &lYear ); + hb_dateStrPut( szDate, lDay, lMonth, lYear ); } else - return "00000000"; + { + memset( szDate, ' ', 8 ); + } + + return szDate; } BOOL hb_itemGetL( PHB_ITEM pItem ) @@ -322,10 +314,7 @@ PHB_ITEM hb_itemPutDS( PHB_ITEM pItem, char *szDate ) else pItem = hb_itemNew(0); - lDay = ((szDate[ 6 ] - '0') * 10) + (szDate[ 7 ] - '0'); - lMonth = ((szDate[ 4 ] - '0') * 10) + (szDate[ 5 ] - '0'); - lYear = ((szDate[ 0 ] - '0') * 1000) + ((szDate[ 1 ] - '0') * 100) - + ((szDate[ 2 ] - '0') * 10) + (szDate[ 3 ] - '0'); + hb_dateStrGet( szDate, &lDay, &lMonth, &lYear ); hb_itemClear( pItem ); pItem->type = IT_DATE; @@ -513,7 +502,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) int iRet = 0; /* Current status */ if (hb_set.HB_SET_EXACT && !bForceExact) - { /* SET EXACT ON and not using == */ + { /* SET EXACT ON and not using == */ /* Don't include trailing spaces */ while( lLenFirst > 0 && szFirst[ lLenFirst - 1 ] == ' ') lLenFirst--; while( lLenSecond > 0 && szSecond[ lLenSecond - 1 ] == ' ') lLenSecond--; diff --git a/harbour/source/rtl/memvars.c b/harbour/source/rtl/memvars.c index 52907cf614..e23785cf5f 100644 --- a/harbour/source/rtl/memvars.c +++ b/harbour/source/rtl/memvars.c @@ -62,8 +62,6 @@ static HB_VALUE_PTR _globalTable = NULL; static void hb_MemvarCreateFromItem( PHB_ITEM, BYTE, PHB_ITEM ); static void hb_MemvarCreateFromDynSymbol( PDYNSYM, BYTE, PHB_ITEM ); static void hb_MemvarAddPrivate( PDYNSYM ); -void hb_MemvarValueIncRef( HB_HANDLE ); -void hb_MemvarValueDecRef( HB_HANDLE ); void hb_MemvarsInit( void ) { diff --git a/harbour/source/rtl/strings.c b/harbour/source/rtl/strings.c index 334be95b7d..0be1261bfa 100644 --- a/harbour/source/rtl/strings.c +++ b/harbour/source/rtl/strings.c @@ -1359,3 +1359,32 @@ HARBOUR HB_STR( void ) hb_errorRT_BASE(EG_ARGCOUNT, 3000, NULL, "STR"); } } + +/* Values returned : HB_STRGREATER_EQUAL, HB_STRGREATER_LEFT, HB_STRGREATER_RIGHT */ + +WORD hb_strgreater( char * sz1, char * sz2 ) +{ + + while( *( sz1 ) && *( sz2 ) && *( sz1 ) == *( sz2 ) ) + { + sz1++; + sz2++; + } + if ( ( *( sz1 ) == 0 && *( sz2 ) != 0 ) || + ( *( sz2 ) > *( sz1 ) ) ) + return HB_STRGREATER_RIGHT; + + if ( ( *( sz1 ) != 0 && *( sz2 ) == 0 ) || + ( *( sz1 ) > *( sz2 ) ) ) + return HB_STRGREATER_LEFT; + + return HB_STRGREATER_EQUAL; +} + +void hb_strupr( char * szText ) +{ + char *p; + + for( p = szText; *p; p++ ) + *p = toupper( *p ); +} diff --git a/harbour/source/runner/runner.c b/harbour/source/runner/runner.c index 9e0973f0a4..0d7c05d971 100644 --- a/harbour/source/runner/runner.c +++ b/harbour/source/runner/runner.c @@ -51,8 +51,8 @@ static BYTE prgFunction[] = { 0x68, 0x00, 0x00, 0x00, 0x00, typedef union { - PBYTE pAsmData; /* The assembler bytes */ - HARBOURFUNC pFunPtr; /* The (dynamic) harbour + PBYTE pAsmData; /* The assembler bytes */ + PHB_FUNC pFunPtr; /* The (dynamic) harbour function */ } ASM_CALL, *PASM_CALL; @@ -161,7 +161,7 @@ HARBOUR HB_HB_RUN( void ) { pSymRead[ ul ].szName = ReadId( file ); pSymRead[ ul ].cScope = ReadByte( file ); - pSymRead[ ul ].pFunPtr = ( HARBOURFUNC ) ReadByte( file ); + pSymRead[ ul ].pFunPtr = ( PHB_FUNC ) ReadByte( file ); pSymRead[ ul ].pDynSym = NULL; } @@ -200,7 +200,7 @@ HARBOUR HB_HB_RUN( void ) pSymRead[ ul ].pFunPtr = pDynFunc[ ulPos ].pAsmCall->pFunPtr; } else - pSymRead[ ul ].pFunPtr = ( HARBOURFUNC ) SYM_EXTERN; + pSymRead[ ul ].pFunPtr = ( PHB_FUNC ) SYM_EXTERN; } if( ( (ULONG) pSymRead[ ul ].pFunPtr ) == SYM_EXTERN ) { /* External function */ diff --git a/harbour/source/tools/debug.c b/harbour/source/tools/debug.c index c9ba779dda..d576d0899b 100644 --- a/harbour/source/tools/debug.c +++ b/harbour/source/tools/debug.c @@ -37,7 +37,6 @@ * $Date$ 1999/05/06 * $End$ */ -#include #include "extend.h" #include "ctoharb.h" #include "itemapi.h" diff --git a/harbour/source/tools/stringsx.c b/harbour/source/tools/stringsx.c index a696445bd2..90d50404e7 100644 --- a/harbour/source/tools/stringsx.c +++ b/harbour/source/tools/stringsx.c @@ -3,7 +3,6 @@ */ #include "extend.h" -#include /* TODO: search this file for TODO and find 'em! */ diff --git a/harbour/source/vm/dynsym.c b/harbour/source/vm/dynsym.c index 18b7da3334..a99c98b3d8 100644 --- a/harbour/source/vm/dynsym.c +++ b/harbour/source/vm/dynsym.c @@ -27,26 +27,17 @@ */ #include "extend.h" -#include -typedef struct -{ - PDYNSYM pDynSym; /* Pointer to dynamic symbol */ -} DYNHB_ITEM, * PDYNHB_ITEM; - -#define SYM_ALLOCATED -1 - -PSYMBOL hb_NewSymbol( char * szName ); -PDYNSYM hb_FindDynSym( char * szName ); +#define SYM_ALLOCATED (-1) static PDYNHB_ITEM pDynItems = 0; /* Pointer to dynamic items */ -static WORD wDynSymbols = 0; /* Number of symbols present */ -static WORD wClosestDynSym = 0; +static WORD wDynSymbols = 0; /* Number of symbols present */ +static WORD wClosestDynSym = 0; /* Closest symbol for match. hb_FindDynSym will search for the name. */ /* If it cannot find the name, it positions itself to the */ /* closest symbol. */ -void LogSymbols( void ) +void hb_LogDynSym( void ) { WORD w; @@ -54,37 +45,6 @@ void LogSymbols( void ) printf( "%i %s\n", w + 1, pDynItems[ w ].pDynSym->pSymbol->szName ); } -#define RIGHT_GREATER 2 -#define LEFT_GREATER 1 -#define SYM_EQUAL 0 - -static WORD hb_strgreater( char * sz1, char * sz2 ) -{ - /* Values returned : SYM_EQUAL, LEFT_GREATER, RIGHT_GREATER */ - - while( *( sz1 ) && *( sz2 ) && *( sz1 ) == *( sz2 ) ) - { - sz1++; - sz2++; - } - if ( ( *( sz1 ) == 0 && *( sz2 ) != 0 ) || - ( *( sz2 ) > *( sz1 ) ) ) - return RIGHT_GREATER; - - if ( ( *( sz1 ) != 0 && *( sz2 ) == 0 ) || - ( *( sz1 ) > *( sz2 ) ) ) - return LEFT_GREATER; - return SYM_EQUAL; -} - -static void hb_strupr( char * szText ) -{ - char *p; - - for( p = szText; *p; p++ ) - *p = toupper( *p ); -} - PSYMBOL hb_NewSymbol( char * szName ) /* Create a new symbol */ { PSYMBOL pSymbol = ( PSYMBOL ) hb_xgrab( sizeof( SYMBOL ) ); @@ -204,15 +164,15 @@ PDYNSYM hb_FindDynSym( char * szName ) { switch( hb_strgreater( pDynItems[ wMiddle ].pDynSym->pSymbol->szName, szName ) ) { - case SYM_EQUAL: /* they are equals */ + case HB_STRGREATER_EQUAL: /* they are equals */ return pDynItems[ wMiddle ].pDynSym; - case LEFT_GREATER: /* pMiddle is greater */ + case HB_STRGREATER_LEFT: /* pMiddle is greater */ wLast = wMiddle; wClosestDynSym = wMiddle; break; - case RIGHT_GREATER: /* szName is greater */ + case HB_STRGREATER_RIGHT: /* szName is greater */ wFirst = wMiddle + 1; wClosestDynSym = wFirst; break; @@ -223,7 +183,7 @@ PDYNSYM hb_FindDynSym( char * szName ) return 0; } -void hb_ReleaseDynamicSymbols( void ) +void hb_ReleaseDynSym( void ) { WORD w; diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index ca72e48d4c..5d256455f2 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -25,16 +25,6 @@ * You can contact me at: alinares@fivetech.com */ -/* Please note the following comments we may use everywhere - TODO: something should be added here - TOFIX: something needs to be fixed - OBSOLETE: something could be removed from here - QUESTION: I had some questions at this point but I could not get an answer - OPT: something is commented out to improve performance - As an example: */ - -/* TODO: Add all the TODO comments. */ - #include #ifndef __MPW__ #include @@ -52,77 +42,15 @@ #include "set.h" #include "inkey.h" -HARBOUR HB_ERRORSYS( void ); -HARBOUR HB_ERRORNEW( void ); -HARBOUR HB_EVAL( void ); /* Evaluates a codeblock from Harbour */ -HARBOUR HB_MAIN( void ); /* fixed entry point by now */ -HARBOUR HB_VALTYPE( void ); /* returns a string description of a value */ +extern void hb_consoleInitialize( void ); +extern void hb_consoleRelease( void ); +extern void ReleaseClasses( void ); /* releases all defined classes */ +extern void InitSymbolTable( void ); /* initialization of runtime support symbols */ -extern void InitSymbolTable(void); /* This prototype is needed by C++ compilers */ - -/* currently supported virtual machine actions */ -void And( void ); /* performs the logical AND on the latest two values, removes them and leaves result on the stack */ -void ArrayAt( void ); /* pushes an array element to the stack, removing the array and the index from the stack */ -void ArrayPut( void ); /* sets an array value and pushes the value on to the stack */ -void Dec( void ); /* decrements the latest numeric value on the stack */ -void Div( void ); /* divides the latest two values on the stack, removes them and leaves the result */ -void Do( WORD WParams ); /* invoke the virtual machine */ -HARBOUR DoBlock( void ); /* executes a codeblock */ -void Duplicate( void ); /* duplicates the latest value on the stack */ -void DuplTwo( void ); /* duplicates the latest two value on the stack */ -void EndBlock( void ); /* copies the last codeblock pushed value into the return value */ -void Equal( BOOL bExact ); /* checks if the two latest values on the stack are equal, removes both and leaves result */ -void ForTest( void ); /* test for end condition of for */ -void Frame( BYTE bLocals, BYTE bParams ); /* increases the stack pointer for the amount of locals and params suplied */ -void FuncPtr( void ); /* pushes a function address pointer. Removes the symbol from the satck */ -void Function( WORD wParams ); /* executes a function saving its result */ -void GenArray( WORD wElements ); /* generates a wElements Array and fills it from the stack values */ -void Greater( void ); /* checks if the latest - 1 value is greater than the latest, removes both and leaves result */ -void GreaterEqual( void ); /* checks if the latest - 1 value is greater than or equal the latest, removes both and leaves result */ -void Inc( void ); /* increment the latest numeric value on the stack */ -void Instring( void ); /* check whether string 1 is contained in string 2 */ -void Less( void ); /* checks if the latest - 1 value is less than the latest, removes both and leaves result */ -void LessEqual( void ); /* checks if the latest - 1 value is less than or equal the latest, removes both and leaves result */ -void Message( PSYMBOL pSymMsg ); /* sends a message to an object */ -void Minus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ -void Modulus( void ); /* calculates the modulus of latest two values on the stack, removes them and leaves the result */ -void Mult( void ); /* multiplies the latest two values on the stack, removes them and leaves the result */ -void Negate( void ); /* negates (-) the latest value on the stack */ -void Not( void ); /* changes the latest logical value on the stack */ -void NotEqual( void ); /* checks if the two latest values on the stack are not equal, removes both and leaves result */ -void OperatorCall( PHB_ITEM, PHB_ITEM, char *); /* call an overloaded operator */ -void Or( void ); /* performs the logical OR on the latest two values, removes them and leaves result on the stack */ -void Plus( void ); /* sums the latest two values on the stack, removes them and leaves the result */ -long PopDate( void ); /* pops the stack latest value and returns its date value as a LONG */ -void PopDefStat( WORD wStatic ); /* pops the stack latest value onto a static as default init */ -double PopDouble( WORD * ); /* pops the stack latest value and returns its double numeric format value */ -void PopLocal( SHORT wLocal ); /* pops the stack latest value onto a local */ -int PopLogical( void ); /* pops the stack latest value and returns its logical value */ -void PopMemvar( PSYMBOL ); /* pops a value of memvar variable */ -double PopNumber( void ); /* pops the stack latest value and returns its numeric value */ -void PopParameter( PSYMBOL, BYTE ); /* creates a PRIVATE variable and sets it with parameter's value */ -void PopStatic( WORD wStatic ); /* pops the stack latest value onto a static */ -void Power( void ); /* power the latest two values on the stack, removes them and leaves the result */ -void Push( PHB_ITEM pItem ); /* pushes a generic item onto the stack */ -void PushBlock( BYTE * pCode, PSYMBOL pSymbols ); /* creates a codeblock */ -void PushDate( LONG lDate ); /* pushes a long date onto the stack */ -void PushDouble( double lNumber, WORD wDec ); /* pushes a double number onto the stack */ -void PushLocal( SHORT iLocal ); /* pushes the containts of a local onto the stack */ -void PushLocalByRef( SHORT iLocal ); /* pushes a local by refrence onto the stack */ -void PushLogical( int iTrueFalse ); /* pushes a logical value onto the stack */ -void PushLong( long lNumber ); /* pushes a long number onto the stack */ -void PushMemvar( PSYMBOL ); /* pushes a value of memvar variable */ -void PushMemvarByRef( PSYMBOL ); /* pushes a reference to a memvar variable */ -void PushNil( void ); /* in this case it places nil at self */ -void PushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ -void PushStatic( WORD wStatic ); /* pushes the containts of a static onto the stack */ -void PushStaticByRef( WORD iLocal ); /* pushes a static by refrence onto the stack */ -void PushString( char * szText, ULONG length ); /* pushes a string on to the stack */ -void PushSymbol( PSYMBOL pSym ); /* pushes a function pointer onto the stack */ -void PushInteger( int iNumber ); /* pushes a integer number onto the stack */ -void RetValue( void ); /* pops the latest stack value into stack.Return */ -void SFrame( PSYMBOL pSym ); /* sets the statics frame for a function */ -void Statics( PSYMBOL pSym ); /* increases the the global statics array to hold a PRG statics */ +extern ULONG ulMemoryBlocks; /* memory blocks used */ +extern ULONG ulMemoryMaxBlocks; /* maximum number of used memory blocks */ +extern ULONG ulMemoryConsumed; /* memory size consumed */ +extern ULONG ulMemoryMaxConsumed; /* memory max size consumed */ typedef struct _SYMBOLS { @@ -132,34 +60,81 @@ typedef struct _SYMBOLS SYMBOLSCOPE hScope; /* scope collected from all symbols in module used to speed initialization code */ } SYMBOLS, * PSYMBOLS; /* structure to keep track of all modules symbol tables */ +HARBOUR HB_ERRORSYS( void ); +HARBOUR HB_ERRORNEW( void ); +HARBOUR HB_EVAL( void ); /* Evaluates a codeblock from Harbour */ +HARBOUR HB_MAIN( void ); /* fixed entry point by now */ +HARBOUR HB_VALTYPE( void ); /* returns a string description of a value */ + +/* currently supported virtual machine actions */ +void And( void ); /* performs the logical AND on the latest two values, removes them and leaves result on the stack */ +void ArrayAt( void ); /* pushes an array element to the stack, removing the array and the index from the stack */ +void ArrayPut( void ); /* sets an array value and pushes the value on to the stack */ +void Dec( void ); /* decrements the latest numeric value on the stack */ +void Div( void ); /* divides the latest two values on the stack, removes them and leaves the result */ +void Do( WORD WParams ); /* invoke the virtual machine */ +HARBOUR DoBlock( void ); /* executes a codeblock */ +void Duplicate( void ); /* duplicates the latest value on the stack */ +void DuplTwo( void ); /* duplicates the latest two value on the stack */ +void EndBlock( void ); /* copies the last codeblock pushed value into the return value */ +void Equal( BOOL bExact ); /* checks if the two latest values on the stack are equal, removes both and leaves result */ +void ForTest( void ); /* test for end condition of for */ +void Frame( BYTE bLocals, BYTE bParams ); /* increases the stack pointer for the amount of locals and params suplied */ +void FuncPtr( void ); /* pushes a function address pointer. Removes the symbol from the satck */ +void Function( WORD wParams ); /* executes a function saving its result */ +void GenArray( WORD wElements ); /* generates a wElements Array and fills it from the stack values */ +void Greater( void ); /* checks if the latest - 1 value is greater than the latest, removes both and leaves result */ +void GreaterEqual( void ); /* checks if the latest - 1 value is greater than or equal the latest, removes both and leaves result */ +void Inc( void ); /* increment the latest numeric value on the stack */ +void Instring( void ); /* check whether string 1 is contained in string 2 */ +void Less( void ); /* checks if the latest - 1 value is less than the latest, removes both and leaves result */ +void LessEqual( void ); /* checks if the latest - 1 value is less than or equal the latest, removes both and leaves result */ +void Message( PSYMBOL pSymMsg ); /* sends a message to an object */ +void Minus( void ); /* substracts the latest two values on the stack, removes them and leaves the result */ +void Modulus( void ); /* calculates the modulus of latest two values on the stack, removes them and leaves the result */ +void Mult( void ); /* multiplies the latest two values on the stack, removes them and leaves the result */ +void Negate( void ); /* negates (-) the latest value on the stack */ +void Not( void ); /* changes the latest logical value on the stack */ +void NotEqual( void ); /* checks if the two latest values on the stack are not equal, removes both and leaves result */ +void OperatorCall( PHB_ITEM, PHB_ITEM, char *); /* call an overloaded operator */ +void Or( void ); /* performs the logical OR on the latest two values, removes them and leaves result on the stack */ +void Plus( void ); /* sums the latest two values on the stack, removes them and leaves the result */ +long PopDate( void ); /* pops the stack latest value and returns its date value as a LONG */ +void PopDefStat( WORD wStatic ); /* pops the stack latest value onto a static as default init */ +double PopDouble( WORD * ); /* pops the stack latest value and returns its double numeric format value */ +void PopLocal( SHORT wLocal ); /* pops the stack latest value onto a local */ +int PopLogical( void ); /* pops the stack latest value and returns its logical value */ +void PopMemvar( PSYMBOL ); /* pops a value of memvar variable */ +double PopNumber( void ); /* pops the stack latest value and returns its numeric value */ +void PopParameter( PSYMBOL, BYTE ); /* creates a PRIVATE variable and sets it with parameter's value */ +void PopStatic( WORD wStatic ); /* pops the stack latest value onto a static */ +void Power( void ); /* power the latest two values on the stack, removes them and leaves the result */ +void Push( PHB_ITEM pItem ); /* pushes a generic item onto the stack */ +void PushBlock( BYTE * pCode, PSYMBOL pSymbols ); /* creates a codeblock */ +void PushDate( LONG lDate ); /* pushes a long date onto the stack */ +void PushDouble( double lNumber, WORD wDec ); /* pushes a double number onto the stack */ +void PushLocal( SHORT iLocal ); /* pushes the containts of a local onto the stack */ +void PushLocalByRef( SHORT iLocal ); /* pushes a local by refrence onto the stack */ +void PushLogical( int iTrueFalse ); /* pushes a logical value onto the stack */ +void PushLong( long lNumber ); /* pushes a long number onto the stack */ +void PushMemvar( PSYMBOL ); /* pushes a value of memvar variable */ +void PushMemvarByRef( PSYMBOL ); /* pushes a reference to a memvar variable */ +void PushNil( void ); /* in this case it places nil at self */ +void PushNumber( double dNumber, WORD wDec ); /* pushes a number on to the stack and decides if it is integer, long or double */ +void PushStatic( WORD wStatic ); /* pushes the containts of a static onto the stack */ +void PushStaticByRef( WORD iLocal ); /* pushes a static by refrence onto the stack */ +void PushString( char * szText, ULONG length ); /* pushes a string on to the stack */ +void PushSymbol( PSYMBOL pSym ); /* pushes a function pointer onto the stack */ +void PushInteger( int iNumber ); /* pushes a integer number onto the stack */ +void RetValue( void ); /* pops the latest stack value into stack.Return */ +void SFrame( PSYMBOL pSym ); /* sets the statics frame for a function */ +void Statics( PSYMBOL pSym ); /* increases the the global statics array to hold a PRG statics */ + void ProcessSymbols( PSYMBOL pSymbols, WORD wSymbols ); /* statics symbols initialization */ void DoInitStatics( void ); /* executes all _INITSTATICS functions */ void DoInitFunctions( int argc, char * argv[] ); /* executes all defined PRGs INIT functions */ void DoExitFunctions( void ); /* executes all defined PRGs EXIT functions */ -void LogSymbols( void ); /* displays all dynamic symbols */ -void ReleaseClasses( void ); /* releases all defined classes */ void ReleaseLocalSymbols( void ); /* releases the memory of the local symbols linked list */ -void hb_ReleaseDynamicSymbols( void ); /* releases the memory of the dynamic symbol table */ - -/* stack management functions */ -void StackDec( void ); /* pops an item from the stack without clearing it's contents */ -void StackPop( void ); /* pops an item from the stack */ -void StackFree( void ); /* releases all memory used by the stack */ -void StackPush( void ); /* pushes an item on to the stack */ -void StackInit( void ); /* initializes the stack */ -void StackShow( void ); /* show the types of the items on the stack for debugging purposes */ - -void InitSymbolTable( void ); /* initialization of runtime support symbols */ - -static void ForceLink( void ); - -#define STACK_INITHB_ITEMS 100 -#define STACK_EXPANDHB_ITEMS 20 - -extern ULONG ulMemoryBlocks; /* memory blocks used */ -extern ULONG ulMemoryMaxBlocks; /* maximum number of used memory blocks */ -extern ULONG ulMemoryConsumed; /* memory size consumed */ -extern ULONG ulMemoryMaxConsumed; /* memory max size consumed */ #ifdef HARBOUR_OBJ_GENERATION void ProcessObjSymbols ( void ); /* process Harbour generated OBJ symbols */ @@ -177,16 +152,28 @@ extern POBJSYMBOLS HB_FIRSTSYMBOL, HB_LASTSYMBOL; #endif #endif -int iHB_DEBUG = 0; /* if 1 traces the virtual machine activity */ +/* stack management functions */ +void StackDec( void ); /* pops an item from the stack without clearing it's contents */ +void StackPop( void ); /* pops an item from the stack */ +void StackFree( void ); /* releases all memory used by the stack */ +void StackPush( void ); /* pushes an item on to the stack */ +void StackInit( void ); /* initializes the stack */ +void StackShow( void ); /* show the types of the items on the stack for debugging purposes */ -STACK stack; -SYMBOL symEval = { "__EVAL", FS_PUBLIC, DoBlock, 0 }; /* symbol to evaluate codeblocks */ -PSYMBOL pSymStart; /* start symbol of the application. MAIN() is not required */ -HB_ITEM aStatics; /* Harbour array to hold all application statics variables */ -HB_ITEM errorBlock; /* errorblock */ -PSYMBOLS pSymbols = 0; /* to hold a linked list of all different modules symbol tables */ -BOOL bQuit = FALSE; /* inmediately exit the application */ -BYTE bErrorLevel = 0; /* application exit errorlevel */ +static void ForceLink( void ); + +#define STACK_INITHB_ITEMS 100 +#define STACK_EXPANDHB_ITEMS 20 + +int iHB_DEBUG = 0; /* if 1 traces the virtual machine activity */ +STACK stack; +SYMBOL symEval = { "__EVAL", FS_PUBLIC, DoBlock, 0 }; /* symbol to evaluate codeblocks */ +PSYMBOL pSymStart; /* start symbol of the application. MAIN() is not required */ +HB_ITEM aStatics; /* Harbour array to hold all application statics variables */ +HB_ITEM errorBlock; /* errorblock */ +PSYMBOLS pSymbols = 0; /* to hold a linked list of all different modules symbol tables */ +BOOL bQuit = FALSE; /* inmediately exit the application */ +BYTE bErrorLevel = 0; /* application exit errorlevel */ #define HB_DEBUG( x ) if( iHB_DEBUG ) printf( x ) #define HB_DEBUG2( x, y ) if( iHB_DEBUG ) printf( x, y ) @@ -263,12 +250,12 @@ BYTE bErrorLevel = 0; /* application exit errorlevel */ hb_itemClear( &errorBlock ); ReleaseClasses(); ReleaseLocalSymbols(); /* releases the local modules linked list */ - hb_ReleaseDynamicSymbols(); /* releases the dynamic symbol table */ + hb_ReleaseDynSym(); /* releases the dynamic symbol table */ hb_consoleRelease(); /* releases Console */ hb_setRelease(); /* releases Sets */ hb_MemvarsRelease(); StackFree(); - /* LogSymbols(); */ + /* hb_LogDynSym(); */ HB_DEBUG( "Done!\n" ); if( ulMemoryBlocks ) @@ -732,7 +719,7 @@ void Do( WORD wParams ) LONG wStackBase = stack.pBase - stack.pItems; /* as the stack memory block could change */ LONG wItemIndex = pItem - stack.pItems; PHB_ITEM pSelf = stack.pPos - wParams - 1; /* NIL, OBJECT or BLOCK */ - HARBOURFUNC pFunc; + PHB_FUNC pFunc; int iStatics = stack.iStatics; /* Return iStatics position */ if( ! IS_SYMBOL( pItem ) ) @@ -1862,8 +1849,8 @@ void StackFree( void ) void StackPush( void ) { - LONG CurrIndex, /* index of current top item */ - TopIndex; /* index of the topmost possible item */ + LONG CurrIndex; /* index of current top item */ + LONG TopIndex; /* index of the topmost possible item */ CurrIndex = stack.pPos - stack.pItems; TopIndex = stack.wItems - 1; @@ -1979,7 +1966,7 @@ void Statics( PSYMBOL pSym ) /* initializes the global aStatics array or redimen } else { - pSym->pFunPtr = ( HARBOURFUNC )hb_arrayLen( &aStatics ); + pSym->pFunPtr = ( PHB_FUNC )hb_arrayLen( &aStatics ); hb_arraySize( &aStatics, hb_arrayLen( &aStatics ) + wStatics ); } @@ -2209,7 +2196,7 @@ HARBOUR HB_EMPTY(void) break; case IT_DATE: - hb_retl( atol( hb_pards( 1 ) ) == 0 ); /* Convert to long */ + hb_retl( atol( hb_pards( 1 ) ) == 0 ); /* Convert to long */ break; case IT_LOGICAL: diff --git a/harbour/source/vm/initsymb.c b/harbour/source/vm/initsymb.c index 2e89df0fe3..97f4a04a66 100644 --- a/harbour/source/vm/initsymb.c +++ b/harbour/source/vm/initsymb.c @@ -27,8 +27,6 @@ extern void Set__InitSymbols( void ); extern void Strings__InitSymbols( void ); extern void Transfrm__InitSymbols( void ); -void ProcessSymbols( SYMBOL *, WORD ); - HARBOUR HB_AADD( void ); HARBOUR HB_ABS( void ); HARBOUR HB_ASC( void );