From 37c3041e7e824f66109db71b85294521fa0bc554 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 27 Aug 1999 03:34:53 +0000 Subject: [PATCH] 19990826-05:00 GMT+1 --- harbour/ChangeLog | 97 +++++ harbour/gt.b32 | 3 +- harbour/include/Makefile | 1 + harbour/include/ctoharb.h | 5 +- harbour/include/errorapi.h | 4 +- harbour/include/extend.h | 22 +- harbour/include/gtapi.h | 2 +- harbour/include/hbdefs.h | 50 +-- harbour/include/mouse.h | 90 ----- harbour/include/mouseapi.h | 72 ++++ harbour/include/rddapi.h | 7 + harbour/source/compiler/harbour.y | 20 +- harbour/source/hbpp/hbpplib.c | 27 +- harbour/source/hbpp/stdalone/hbpp.c | 18 +- harbour/source/rtl/Makefile | 2 + harbour/source/rtl/console.c | 19 +- harbour/source/rtl/errorapi.c | 189 +++++++--- harbour/source/rtl/extend.c | 38 +- harbour/source/rtl/fm.c | 67 +++- harbour/source/rtl/inkey.c | 7 +- harbour/source/rtl/itemapi.c | 13 +- harbour/source/rtl/langapi.c | 4 +- harbour/source/rtl/mouse.c | 197 ---------- harbour/source/rtl/mouse/mousedos.c | 337 +++-------------- harbour/source/rtl/mouse/mouseos2.c | 54 +-- harbour/source/rtl/mouse/mousetpl.c | 130 ++++--- harbour/source/rtl/mouse/mousewin.c | 125 +++++++ harbour/source/rtl/mouseapi.c | 272 ++++++++++++++ harbour/source/rtl/{msxxx.c => mousexxx.c} | 0 harbour/source/rtl/natmsg/msg_tpl.c | 2 +- harbour/source/rtl/natmsg/msgca.c | 2 +- harbour/source/rtl/natmsg/msgcs852.c | 2 +- harbour/source/rtl/natmsg/msgcskam.c | 2 +- harbour/source/rtl/natmsg/msgde.c | 2 +- harbour/source/rtl/natmsg/msgen.c | 2 +- harbour/source/rtl/natmsg/msgeo.c | 2 +- harbour/source/rtl/natmsg/msgeu.c | 2 +- harbour/source/rtl/natmsg/msgfr.c | 2 +- harbour/source/rtl/natmsg/msggl.c | 2 +- harbour/source/rtl/natmsg/msghe862.c | 2 +- harbour/source/rtl/natmsg/msghewin.c | 2 +- harbour/source/rtl/natmsg/msgid.c | 2 +- harbour/source/rtl/natmsg/msgko.c | 2 +- harbour/source/rtl/natmsg/msgnl.c | 2 +- harbour/source/rtl/natmsg/msgru866.c | 2 +- harbour/source/rtl/natmsg/msgruwin.c | 2 +- harbour/source/rtl/natmsg/msgsr852.c | 2 +- harbour/source/tools/Makefile | 1 + harbour/source/tools/debug.c | 2 - harbour/source/tools/io.c | 3 +- harbour/source/tools/nconvert.prg | 407 +++++++++++++++++++++ harbour/source/vm/hvm.c | 294 +++++++-------- harbour/source/vm/initsymb.c | 144 ++++---- 53 files changed, 1630 insertions(+), 1129 deletions(-) delete mode 100644 harbour/include/mouse.h create mode 100644 harbour/include/mouseapi.h delete mode 100644 harbour/source/rtl/mouse.c create mode 100644 harbour/source/rtl/mouse/mousewin.c create mode 100644 harbour/source/rtl/mouseapi.c rename harbour/source/rtl/{msxxx.c => mousexxx.c} (100%) create mode 100644 harbour/source/tools/nconvert.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b2b8eb4495..bbdf2d23c6 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,100 @@ +19990826-05:00 GMT+1 Victor Szel + + * include/Makefile + include/mouseapi.h + source/rtl/mouseapi.c + source/rtl/mousexxx.c (renamed) + source/rtl/Makefile + source/rtl/mouse/mousetpl.c + source/rtl/mouse/mousedos.c + source/rtl/mouse/mouseos2.c + source/rtl/mouse/mousewin.c (added) + include/mouse.h (changed to mouseapi.h) + source/rtl/mouse.c (changed to mouseapi.c) + source/rtl/msxxx.c (changed to mousexxx.c) + + Changed the previouse Mouse API implementation to a somehow more + Clipper compatible and complete one. + * source/rtl/inkey.c + + INKEY() add runtime parameter count checking and error message. + * Two ints changed to BOOLs. + * source/vm/hvm.c + include/rddapi.h + * Some int -> BOOL, Some 0 -> NULL, '\0', Some cleanup. + ! LEN(), EMPTY(), PCOUNT() returns a runtime error if bad number of + parameter was passed. + + BREAK() doesn't have a parameter count check, an explanation of this + added as a NOTE:. + * hb_rdd*() function declarations moved to rddapi.h + * include/ctoharb.h + source/vm/hvm.c + source/vm/initsymb.c + * InitSymbolTable() -> hb_vmRTSymbolsInit() + * include/extend.h + source/rtl/fm.c + source/vm/hvm.c + + Moved memory statistics printing to fm.c, fixed memory subsystem now + has a hb_xinit() and hb_xexit() functions, which should contain all + init and exit code related to memory. + % Memory statistic variables made static, prefixed with "s_" + + #define added to suppress the collection of statistics. + * include/ctoharb.h + source/vm/hvm.c + source/rtl/errorapi.c + * hb_stackShow() -> hb_stackDispLocal() + * hb_callStackShow() -> hb_stackDispCall() + * include/errorapi.h + source/rtl/errorapi.c + * hb_errLaunch() using eval API to launch the handler. + + hb_errLaunchSubst() added to be able to add error handling using value + substitution. Not finished yet. + * include/hbdefs.h + % PCOUNT uses hb_pcount() since it's more efficient than hb_parinfo(0) + * source/rtl/extend.c + ! hb_evalPutParam() is no longer making a copy of the items, like Clipper. + * source/rtl/itemapi.c + % hb_itemParam(): one hb_param() call optimed out. + * source/hbpp/stdalone/hbpp.c + include/hbpp.h + + Standalone PP is now showing the line numbers in errors and warnings. + * source/compiler/harbour.y + source/hbpp/hbplib.c + source/hbpp/stdalone/hbpp.c + source/rtl/errorapi.c + % GenError(), GenWarning(), hb_errInternel() no longer need sprintf() + neither the local stack buffers, so there's no more an undocumented limit + on the message length. + * source/rtl/console.c + ! In some places printf( "\n" ) was changed to print CrLf. + (Non-GT version is affected only) + * source/rtl/errorapi.c + source/hbpp/hbplib.c + source/vm/hvm.c + ! Uses hb_consoleGetNewLine() instead of \n character, so that it will + work on all platforms. This was needed because we have turned off cooked + mode of stdout, so the compiler/OS will not do it for us. The bug could + be observed in the stack dump on an internal error in DOS/DJGPP. + * source/rtl/console.c + include/extend.h + + New function hb_consoleGetNewLine() which returns the CrLf value. + * source/vm/hvm.c + include/extend.h + * hb_console*() declarations moved to the header file. + * source/compiler/harbour.y + + Small cosmetic enhancments in generated C code. + * source/tools/debug.c + - Removed external declaration of non-existing function. + * source/rtl/langapi.c + source/rtl/natmsg/*.c + ! Typo fixed "Limit exeeded" -> "Limit exceeded". + Thanks to Jose Lalin . + * source/tools/io.c + source/tools/nconvert.prg + source/tools/Makefile + gt.b32 + ! HB_RD() - Fixed: chdir() changed to rmdir() + + nconvert.prg added, Borland makefile modified + by Luiz Rafael Culik . + 19990826-22:00 EDT Paul Tucker * include/hbsetup.h + add mouse driver selector defines diff --git a/harbour/gt.b32 b/harbour/gt.b32 index 108d83e66f..ce97e9eb9c 100644 --- a/harbour/gt.b32 +++ b/harbour/gt.b32 @@ -10,7 +10,7 @@ libs\b32\hbgt.lib : \ ascpos.obj atdiff.obj chareven.obj charodd.obj chrcount.obj \ - chrtotal.obj charmix.obj asciisum.obj chrfirst.obj io.obj numtxthu.obj numtxten.obj\ + chrtotal.obj charmix.obj asciisum.obj chrfirst.obj io.obj numtxthu.obj numtxten.obj nconvert.obj \ strasint.obj strcount.obj strcspn.obj strdiff.obj strexpan.obj \ strleft.obj strpbrk.obj strright.obj @@ -33,6 +33,7 @@ strpbrk.obj : strpbrk.c extend.h hbdefs.h strright.obj : strright.c extend.h hbdefs.h numtxthu.obj : numtxthu.c extend.h hbdefs.h numtxten.obj : numtxten.c extend.h hbdefs.h +nconvert.obj : nconvert.c extend.h hbdefs.h io.obj : io.c extend.h hbdefs.h numtxthu.c : numtxthu.prg harbour.exe diff --git a/harbour/include/Makefile b/harbour/include/Makefile index cb13e7e4ec..d3db560024 100644 --- a/harbour/include/Makefile +++ b/harbour/include/Makefile @@ -26,6 +26,7 @@ C_HEADERS=\ inkey.h \ itemapi.h \ langapi.h \ + mouseapi.h \ pcode.h \ rddapi.h \ run_exp.h \ diff --git a/harbour/include/ctoharb.h b/harbour/include/ctoharb.h index 98e42e95f4..2aed1ed89d 100644 --- a/harbour/include/ctoharb.h +++ b/harbour/include/ctoharb.h @@ -34,6 +34,7 @@ extern void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ); /* invokes the extern void hb_vmProcessSymbols( PHB_SYMB pSymbols, WORD wSymbols ); /* statics symbols initialization */ extern void hb_vmRequestQuit( void ); extern void hb_vmRequestBreak( PHB_ITEM pItem ); +extern void hb_vmRTSymbolsInit( void ); /* initialization of runtime support symbols */ /* PCode functions */ extern void hb_vmAnd( void ); /* performs the logical AND on the latest two values, removes them and leaves result on the stack */ @@ -108,8 +109,8 @@ extern void hb_stackPop( void ); /* pops an item from the stack */ extern void hb_stackFree( void ); /* releases all memory used by the stack */ extern void hb_stackPush( void ); /* pushes an item on to the stack */ extern void hb_stackInit( void ); /* initializes the stack */ -extern void hb_stackShow( void ); /* show the types of the items on the stack for debugging purposes */ -extern void hb_callStackShow( void ); /* show the procedure names of the call stack for internal errors use */ +extern void hb_stackDispLocal( void ); /* show the types of the items on the stack for debugging purposes */ +extern void hb_stackDispCall( void ); /* show the procedure names of the call stack for internal errors use */ #define STACK_INITHB_ITEMS 100 #define STACK_EXPANDHB_ITEMS 20 diff --git a/harbour/include/errorapi.h b/harbour/include/errorapi.h index 3cb9c0f4f6..01274b18c7 100644 --- a/harbour/include/errorapi.h +++ b/harbour/include/errorapi.h @@ -97,7 +97,7 @@ extern void hb_errRelease ( PHB_ITEM pError ); /* Error launchers */ -extern void hb_errInternal ( ULONG ulIntCode, char * szText, char * szPar1, char * szPar2 ); +extern PHB_ITEM hb_errLaunchSubst ( PHB_ITEM pError ); extern void hb_errRT_BASE ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); extern WORD hb_errRT_BASE_Ext1 ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation, USHORT uiOsCode, USHORT uiFlags ); @@ -105,4 +105,6 @@ extern void hb_errRT_TERMINAL ( ULONG ulGenCode, ULONG ulSubCode, char extern void hb_errRT_DBCMD ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); extern void hb_errRT_TOOLS ( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, char * szOperation ); +extern void hb_errInternal ( ULONG ulIntCode, char * szText, char * szPar1, char * szPar2 ); + #endif /* HB_ERRORAPI_H_ */ diff --git a/harbour/include/extend.h b/harbour/include/extend.h index cf8a895c9b..d3546ef272 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -237,16 +237,13 @@ extern void hb_storni( int iValue, int iParam, ... ); /* stores an integer o 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 */ -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 */ - -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 */ +extern void hb_xinit( void ); /* Initialize fixed memory subsystem */ +extern void hb_xexit( void ); /* Deinitialize fixed memory subsystem */ +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 */ /* array management */ extern void hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ); /* creates a new array */ @@ -324,6 +321,11 @@ extern void hb_memvarGetRefer( HB_ITEM_PTR, PHB_SYMB ); extern ULONG hb_memvarGetPrivatesBase( void ); extern void hb_memvarSetPrivatesBase( ULONG ); +/* console I/O subsystem */ +extern void hb_consoleInitialize( void ); +extern void hb_consoleRelease( void ); +extern char * hb_consoleGetNewLine( void ); + extern char * hb_setColor( char * ); #endif /* HB_EXTEND_H_ */ diff --git a/harbour/include/gtapi.h b/harbour/include/gtapi.h index fb4f684159..c370b70556 100644 --- a/harbour/include/gtapi.h +++ b/harbour/include/gtapi.h @@ -81,7 +81,7 @@ 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 ); -/* private interface listed below. these are common to all platforms */ +/* Private interface listed below. these are common to all platforms */ extern void hb_gt_Init( void ); extern int hb_gt_IsColor( void ); diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index ce1d263be6..db9fe8d666 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -12,25 +12,25 @@ #include #if defined(__IBMCPP__) - /* With the exception of WORD, the IBM Visual Age C++ compiler has - its own definitions of the Harbour types defined in the #else - section of this #ifdef block, most of which conflict with the - Harbour #undefs, due to typedef being the prevalent method of - defining the types in IBMCPP, whereas Harbour assumes that the - definitions that it is replacing have been defined using - #define. Therefore, it is necessary to skip the Harbour - definition section when using the IBMCPP compiiler, include - the IBMCPP type definitions, and then add the definition for WORD + /* With the exception of WORD, the IBM Visual Age C++ compiler has + its own definitions of the Harbour types defined in the #else + section of this #ifdef block, most of which conflict with the + Harbour #undefs, due to typedef being the prevalent method of + defining the types in IBMCPP, whereas Harbour assumes that the + definitions that it is replacing have been defined using + #define. Therefore, it is necessary to skip the Harbour + definition section when using the IBMCPP compiiler, include + the IBMCPP type definitions, and then add the definition for WORD - NOTE: This only applies to the common types that most C compilers - define. Any new types, particulary those that start with - HB_, must be placed AFTER the #endif __IBMCPP__ line! - */ - #define INCL_TYPES - #include - typedef unsigned short int WORD; - #undef INT - #undef UINT + NOTE: This only applies to the common types that most C compilers + define. Any new types, particulary those that start with + HB_, must be placed AFTER the #endif __IBMCPP__ line! + */ + #define INCL_TYPES + #include + typedef unsigned short int WORD; + #undef INT + #undef UINT #else @@ -65,18 +65,18 @@ typedef unsigned long DWORD; #define FALSE 0 #define TRUE 1 -#define LOBYTE(w) ((BYTE)(w)) -#define HIBYTE(w) ((BYTE)(((WORD)(w) >> 8) & 0xFF)) -#define LOWORD(l) ((WORD)(l)) +#define LOBYTE( w ) ( ( BYTE )( w ) ) +#define HIBYTE( w ) ( ( BYTE )( ( ( WORD )( w ) >> 8 ) & 0xFF ) ) +#define LOWORD( l ) ( ( WORD )( l ) ) #endif /* HB_DONT_DEFINE_BASIC_TYPES */ #endif /* __IBMCPP__ */ #ifndef MAX -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#define MAX( a, b ) (( ( a ) > ( b ) ) ? ( a ) : ( b ) ) #endif #ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#define MIN( a, b ) (( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif #ifdef __GNUC__ @@ -106,7 +106,7 @@ typedef PHB_FUNC HB_FUNC_PTR; typedef LONG HB_HANDLE; /* handle to memvar value */ typedef char SYMBOLSCOPE; /* stores symbol's scope */ -#define HB_SYMBOL_UNUSED(symbol) (void)symbol +#define HB_SYMBOL_UNUSED( symbol ) ( void ) symbol #define IS_BYREF( p ) ( ( p )->type & IT_BYREF ) #define IS_OF_TYPE( p, t ) ( ( ( p )->type & ~IT_BYREF ) == t ) @@ -133,7 +133,7 @@ typedef char SYMBOLSCOPE; /* stores symbol's scope */ #define ISBYREF( n ) ( hb_parinfo( n ) & IT_BYREF ) /* Intentionally using a different method */ #define ISARRAY( n ) ( hb_param( n, IT_ARRAY ) != NULL ) -#define PCOUNT hb_parinfo( 0 ) +#define PCOUNT hb_pcount() #define ALENGTH( n ) hb_parinfa( n, 0 ) #endif /* HB_DEFS_H_ */ diff --git a/harbour/include/mouse.h b/harbour/include/mouse.h deleted file mode 100644 index 1215a2a05b..0000000000 --- a/harbour/include/mouse.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - Harbour Project source code - - Harbour mouse support - - Copyright(C) 1999 by Jose Lalin. - http://www.Harbour-Project.org/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - The exception is that if you link the Harbour Runtime Library (HRL) - and/or the Harbour Virtual Machine (HVM) with other files to produce - an executable, this does not by itself cause the resulting executable - to be covered by the GNU General Public License. Your use of that - executable is in no way restricted on account of linking the HRL - and/or HVM code into it. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - their web site at http://www.gnu.org/). - - You can contact me at: dezac@corevia.com - - The Follow Functions or Copyright(C) 1999 Luiz Rafael Culik (culik@sl.conex.net) - int hb_MouseButton(void); - int hb_MouseGetPage(void); - void hb_MouseSetPage(int iPage) - void hb_MouseDefCursor(int nCurType,nScrMask,nCurMask) - void hb_MouseSetCoord(int nX, int nY) - void hb_MouseSetLanguage(int nLang) - char hb_MouseVersion(void) - HARBOUR HB_MBPRESSED(void) - HARBOUR HB_MGETPAGE(void) - HARBOUR HB_MSETPAGE(void) - HARBOUR HB_MDEFCURSOR(void) - HARBOUR HB_MSETCOORDS(void) - HARBOUR HB_MSETLANG(void); - HARBOUR HB_MGETLANG(void) - HARBOUR HB_MVERSION(void) -*/ - -#ifndef HB_MOUSE_H_ -#define HB_MOUSE_H_ - -#define MOUSE_INTERRUPT 0x33 - -void hb_MouseInit( void ); -void hb_MouseDone( void ); -int hb_MousePresent( void ); -void hb_MouseShow( void ); -void hb_MouseHide( void ); -int hb_MouseCol( void ); -int hb_MouseRow( void ); -void hb_MouseSetPos( int, int ); -int hb_MouseSetCursor( int ); -void hb_MouseSetBounds( int, int, int, int ); -int hb_MouseButton(void); -int hb_MouseGetPage(void); -void hb_MouseSetPage(int ); -void hb_MouseDefCursor(int ,int,int ); -void hb_MouseSetCoord(int , int ); -void hb_MouseSetLanguage(int ); -int hb_MouseGetLanguage(void); -char *hb_MouseVersion(void); -HARBOUR HB_MPRESENT( void ); -HARBOUR HB_MSHOW( void ); -HARBOUR HB_MHIDE( void ); -HARBOUR HB_MCOL( void ); -HARBOUR HB_MROW( void ); -HARBOUR HB_MSETPOS( void ); -HARBOUR HB_MSETCURSOR( void ); -HARBOUR HB_MSETBOUNDS( void ); -HARBOUR HB_MBPRESSED(void); -HARBOUR HB_MGETPAGE(void); -HARBOUR HB_MSETPAGE(void); -HARBOUR HB_MDEFCURSOR(void); -HARBOUR HB_MSETCOORDS(void) ; -HARBOUR HB_MSETLANG(void); -HARBOUR HB_MGETLANG(void); -HARBOUR HB_MVERSION(void); -#endif /* HB_MOUSE_H_ */ diff --git a/harbour/include/mouseapi.h b/harbour/include/mouseapi.h new file mode 100644 index 0000000000..b6f0640543 --- /dev/null +++ b/harbour/include/mouseapi.h @@ -0,0 +1,72 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Harbour Mouse subsystem header + + Copyright 1999 Victor Szel + www - http://www.harbour-project.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: + + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). + +*/ + +#ifndef HB_MOUSEAPI_H_ +#define HB_MOUSEAPI_H_ + +#include "extend.h" + +/* Public interface. These should never change, only be added to. */ + +extern void hb_mouseInit( void ); +extern void hb_mouseExit( void ); +extern BOOL hb_mouseIsPresent( void ); +extern BOOL hb_mouseGetCursor( void ); +extern void hb_mouseSetCursor( BOOL bVisible ); +extern int hb_mouseCol( void ); +extern int hb_mouseRow( void ); +extern void hb_mouseSetPos( int iRow, int iCol ); +extern BOOL hb_mouseIsButtonPressed( int iButton ); +extern int hb_mouseCountButton( void ); +extern void hb_mouseSetBounds( int iTop, int iLeft, int iBottom, int iRight ); +extern void hb_mouseGetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ); + +/* Private interface listed below. these are common to all platforms */ + +extern void hb_mouse_Init( void ); +extern void hb_mouse_Exit( void ); +extern BOOL hb_mouse_IsPresent( void ); +extern void hb_mouse_Show( void ); +extern void hb_mouse_Hide( void ); +extern int hb_mouse_Col( void ); +extern int hb_mouse_Row( void ); +extern void hb_mouse_SetPos( int iRow, int iCol ); +extern BOOL hb_mouse_IsButtonPressed( int iButton ); +extern int hb_mouse_CountButton( void ); +extern void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ); +extern void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ); + +#endif /* HB_MOUSEAPI_H_ */ diff --git a/harbour/include/rddapi.h b/harbour/include/rddapi.h index 68b825b1ee..ce15a1194b 100644 --- a/harbour/include/rddapi.h +++ b/harbour/include/rddapi.h @@ -9,6 +9,13 @@ typedef USHORT ERRCODE; +/* RDD virtual machine integration functions */ + +extern int hb_rddGetCurrentWorkAreaNumber( void ); +extern void hb_rddSelectWorkAreaNumber( int iArea ); +extern void hb_rddGetFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol ); +extern void hb_rddPutFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol ); + /* RDD method return codes */ diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index 8839d2d6f0..6e19a52d61 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -1265,15 +1265,13 @@ void * GenElseIf( void * pFirst, WORD wOffset ) void GenError( char* _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 ) { - char szLine[ 160 ]; /* 2 lines of text */ - - if( files.pLast->szFileName ) + if( files.pLast->szFileName != NULL ) printf( "\r%s(%i) ", files.pLast->szFileName, iLine ); else printf( "\rLine %i ", iLine ); printf( "Error %c%i ", cPrefix, iError ); - sprintf( szLine, _szCErrors[ iError - 1 ], szError1, szError2 ); - printf( "%s\n\n", szLine ); + printf( _szCErrors[ iError - 1 ], szError1, szError2 ); + printf( "\n\n" ); exit( EXIT_FAILURE ); } @@ -1282,13 +1280,10 @@ void GenWarning( char* _szWarnings[], char cPrefix, int iWarning, char * szWarni { if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */ { - char szLine[ 160 ]; /* 2 lines of text */ - printf( "\r%s(%i) ", files.pLast->szFileName, iLine ); printf( "Warning %c%i ", cPrefix, iWarning ); - sprintf( szLine, _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 ); - - printf( "%s\n", szLine ); + printf( _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 ); + printf( "\n" ); } } @@ -2308,6 +2303,7 @@ void GenCCode( char *szFileName, char *szName ) /* generates the C languag if( ! _bQuiet ) printf( "\nGenerating C language output...\n" ); + fprintf( yyc, "/* Harbour compiler generated code */\n\n" ); fprintf( yyc, "#include \"hb_vmpub.h\"\n" ); fprintf( yyc, "#include \"init.h\"\n\n\n" ); @@ -2408,9 +2404,9 @@ void GenCCode( char *szFileName, char *szName ) /* generates the C languag fprintf( yyc, "static " ); if( pFunc == _pInitFunc ) /* Is it (_INITSTATICS) */ - fprintf( yyc, "HARBOUR hb_INITSTATICS( void )\n{\n static BYTE pcode[] = { \n" ); /* NOTE: hb_ intentionally in lower case */ + fprintf( yyc, "HARBOUR hb_INITSTATICS( void )\n{\n static BYTE pcode[] = { \n" ); /* NOTE: hb_ intentionally in lower case */ else - fprintf( yyc, "HARBOUR HB_%s( void )\n{\n static BYTE pcode[] = { \n", pFunc->szName ); + fprintf( yyc, "HARBOUR HB_%s( void )\n{\n static BYTE pcode[] = { \n", pFunc->szName ); bEndProcRequired =TRUE; lPCodePos = 0; diff --git a/harbour/source/hbpp/hbpplib.c b/harbour/source/hbpp/hbpplib.c index e03879f00c..fb75889511 100644 --- a/harbour/source/hbpp/hbpplib.c +++ b/harbour/source/hbpp/hbpplib.c @@ -79,25 +79,20 @@ HARBOUR HB___PREPROCESS(void) void GenError( char* _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 ) { - char szLine[ 160 ]; /* 2 lines of text */ + printf( "Error %c%i ", cPrefix, iError ); + printf( _szErrors[ iError - 1 ], szError1, szError2 ); + printf( hb_consoleGetNewLine() ); + printf( hb_consoleGetNewLine() ); - /* printf( "\r%s(%i) ", files.pLast->szFileName, iLine ); */ - printf( "Error %c%i ", cPrefix, iError ); - sprintf( szLine, _szErrors[ iError - 1 ], szError1, szError2 ); - printf( "%s\n\n", szLine ); - - exit( EXIT_FAILURE ); + exit( EXIT_FAILURE ); } void GenWarning( char* _szWarnings[], char cPrefix, int iWarning, char * szWarning1, char * szWarning2) { - if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */ - { - char szLine[ 160 ]; /* 2 lines of text */ - - /* printf( "\r%s(%i) ", files.pLast->szFileName, iLine ); */ - printf( "Warning %c%i ", cPrefix, iWarning ); - sprintf( szLine, _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 ); - printf( "%s\n", szLine ); - } + if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */ + { + printf( "Warning %c%i ", cPrefix, iWarning ); + printf( _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 ); + printf( hb_consoleGetNewLine() ); + } } diff --git a/harbour/source/hbpp/stdalone/hbpp.c b/harbour/source/hbpp/stdalone/hbpp.c index a252f7b4c5..cfd4cf5956 100644 --- a/harbour/source/hbpp/stdalone/hbpp.c +++ b/harbour/source/hbpp/stdalone/hbpp.c @@ -408,12 +408,10 @@ void AddSearchPath( char *szPath, PATHNAMES * *pSearchList ) void GenError( char* _szErrors[], char cPrefix, int iError, char * szError1, char * szError2 ) { - char szLine[ 160 ]; /* 2 lines of text */ - - /* printf( "\r%s(%i) ", files.pLast->szFileName, iLine ); */ - printf( "\tError %c%i ", cPrefix, iError ); - sprintf( szLine, _szErrors[ iError - 1 ], szError1, szError2 ); - printf( "%s\n\n", szLine ); + printf( "\r(%i) ", nline ); + printf( "Error %c%i ", cPrefix, iError ); + printf( _szErrors[ iError - 1 ], szError1, szError2 ); + printf( "\n\n" ); exit( EXIT_FAILURE ); } @@ -422,12 +420,10 @@ void GenWarning( char* _szWarnings[], char cPrefix, int iWarning, char * szWarni { if( _bWarnings && iWarning < WARN_ASSIGN_SUSPECT ) /* TODO: add switch to set level */ { - char szLine[ 160 ]; /* 2 lines of text */ - - /* printf( "\r%s(%i) ", files.pLast->szFileName, iLine ); */ + printf( "\r(%i) ", nline ); printf( "Warning %c%i ", cPrefix, iWarning ); - sprintf( szLine, _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 ); - printf( "%s\n", szLine ); + printf( _szWarnings[ iWarning - 1 ], szWarning1, szWarning2 ); + printf( "\n" ); } } diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index baa03d4b72..5a7470bc3c 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -26,6 +26,7 @@ C_SOURCES=\ langapi.c \ math.c \ memvars.c \ + mouseapi.c \ mtran.c \ set.c \ setcolor.c \ @@ -34,6 +35,7 @@ C_SOURCES=\ transfrm.c \ \ gtxxx.c \ + mousexxx.c \ msgxxx.c \ PRG_SOURCES=\ diff --git a/harbour/source/rtl/console.c b/harbour/source/rtl/console.c index c339d3235f..542d535148 100644 --- a/harbour/source/rtl/console.c +++ b/harbour/source/rtl/console.c @@ -91,11 +91,11 @@ void hb_consoleRelease( void ) void hb_consoleInitialize( void ) { #if defined(OS_DOS_COMPATIBLE) - CrLf[ 0 ] = 13; - CrLf[ 1 ] = 10; + CrLf[ 0 ] = '\r'; + CrLf[ 1 ] = '\n'; CrLf[ 2 ] = '\0'; #else - CrLf[ 0 ] = 10; + CrLf[ 0 ] = '\n'; CrLf[ 1 ] = '\0'; #endif @@ -120,6 +120,11 @@ void hb_consoleInitialize( void ) #endif } +char * hb_consoleGetNewLine( void ) +{ + return CrLf; +} + WORD hb_max_row( void ) { #ifdef HARBOUR_USE_GTAPI @@ -447,13 +452,13 @@ void hb_setpos( WORD row, WORD col ) if( row < dev_row || col < dev_col ) { - printf("\n"); + printf( CrLf ); dev_col = 0; dev_row++; } else if( row > dev_row ) dev_col = 0; - for( count = dev_row; count < row; count++ ) printf("\n"); - for( count = dev_col; count < col; count++ ) printf(" "); + for( count = dev_row; count < row; count++ ) printf( CrLf ); + for( count = dev_col; count < col; count++ ) printf( " " ); #endif dev_row = row; @@ -720,7 +725,7 @@ HARBOUR HB_SCROLL( void ) /* Scrolls a screen region (requires the GT API) */ { WORD count; dev_row = iMR; - for( count = 0; count < dev_row ; count++ ) printf( "\n" ); + for( count = 0; count < dev_row ; count++ ) printf( CrLf ); dev_row = dev_col = 0; } #endif diff --git a/harbour/source/rtl/errorapi.c b/harbour/source/rtl/errorapi.c index e6637419ee..29da3919ba 100644 --- a/harbour/source/rtl/errorapi.c +++ b/harbour/source/rtl/errorapi.c @@ -31,8 +31,7 @@ extern HARBOUR HB_ERRORNEW( void ); /* NOTE: This is called via its symbol name, so we should make sure */ -/* that it gets linked. */ -/* Don't make this function static, because it's not called from this file. */ +/* that it gets linked. WARNING ! DON'T make this function static. */ void hb_errForceLink() { HB_ERRORNEW(); @@ -55,39 +54,44 @@ WORD hb_errLaunch( PHB_ITEM pError ) { WORD wRetVal; - if ( pError ) + if( pError ) { - /* TODO: Determine if there was a BREAK in the error handler. */ - BOOL bBreak; - WORD nSequenceLevel; - USHORT uiFlags; + EVALINFO eval; + PHB_ITEM pBlock; + PHB_ITEM pObject; + PHB_ITEM pResult; - if ( ! IS_BLOCK( &errorBlock ) ) - { + /* Check if we have a valid error handler */ + + if( ! IS_BLOCK( &errorBlock ) ) hb_errInternal( 9999, "No ERRORBLOCK() for error", NULL, NULL ); - } - /* NOTE: This must be called before the hb_vm*() calls */ - uiFlags = hb_errGetFlags( pError ); + /* Launch the error handler: "lResult := EVAL( bErrorBlock, oError )" */ - hb_vmPushSymbol( &symEval ); - hb_vmPush( &errorBlock ); - hb_vmPush( pError ); - hb_vmDo( 1 ); + pBlock = hb_itemNew( NULL ); + pObject = hb_itemNew( NULL ); - /* NOTE: Don't make any hb_vm*() calls here, since they may screw up */ - /* the stack.return value */ + hb_itemCopy( pBlock, &errorBlock ); + hb_itemCopy( pObject, pError ); - /* TODO: Detect these properly */ - bBreak = FALSE; - nSequenceLevel = 0; + hb_evalNew( &eval, pBlock ); + hb_evalPutParam( &eval, pObject ); - if ( bBreak ) + pResult = hb_evalLaunch( &eval ); + hb_evalRelease( &eval ); + + /* Check results */ + + /* TODO: Determine if there was a BREAK in the error handler. */ + if( FALSE ) { - if ( nSequenceLevel ) + hb_itemRelease( pResult ); + + /* TODO: Detect sequence level properly */ + if( FALSE ) { - wRetVal = E_BREAK; /* TODO: Initiate a jump to the closest RECOVER statement */ + wRetVal = E_BREAK; } else { @@ -98,54 +102,119 @@ WORD hb_errLaunch( PHB_ITEM pError ) else { BOOL bFailure = FALSE; + USHORT uiFlags = hb_errGetFlags( pError ); /* If the error block didn't return a logical value, */ /* or the canSubstitute flag has been set, consider it as a failure */ - if ( ! IS_LOGICAL( &stack.Return ) || - ( uiFlags & EF_CANSUBSTITUTE ) ) + if( ! IS_LOGICAL( pResult ) || + ( uiFlags & EF_CANSUBSTITUTE ) ) { bFailure = TRUE; } else { - wRetVal = stack.Return.item.asLogical.value ? E_RETRY : E_DEFAULT; + wRetVal = hb_itemGetL( pResult ) ? E_RETRY : E_DEFAULT; - if ( ( wRetVal == E_DEFAULT && !( uiFlags & EF_CANDEFAULT ) ) || - ( wRetVal == E_RETRY && !( uiFlags & EF_CANRETRY ) ) ) + if( ( wRetVal == E_DEFAULT && !( uiFlags & EF_CANDEFAULT ) ) || + ( wRetVal == E_RETRY && !( uiFlags & EF_CANRETRY ) ) ) { bFailure = TRUE; } } - if ( bFailure ) + hb_itemRelease( pResult ); + + if( bFailure ) + hb_errInternal( 9999, "Error recovery failure", NULL, NULL ); + } + } + else + wRetVal = E_RETRY; /* Clipper does this, undocumented */ + + return wRetVal; +} + +/* This error launcher should be used in those situations, where the error + handler is expected to return a value to be substituted as the result of + a failed operation. */ + +/* NOTE: This should only be called when the EF_CANSUBSTITUE flag was set + Since it this case the error handler will return the value + to be substituted */ +/* NOTE: The item pointer returned should be hb_itemRelease()-d by the + caller. */ + +PHB_ITEM hb_errLaunchSubst( PHB_ITEM pError ) +{ + PHB_ITEM pResult; + + if( pError ) + { + EVALINFO eval; + PHB_ITEM pBlock; + PHB_ITEM pObject; + + /* Check if we have a valid error handler */ + + if( ! IS_BLOCK( &errorBlock ) ) + hb_errInternal( 9999, "No ERRORBLOCK() for error", NULL, NULL ); + + /* Launch the error handler: "xResult := EVAL( bErrorBlock, oError )" */ + + pBlock = hb_itemNew( NULL ); + pObject = hb_itemNew( NULL ); + + hb_itemCopy( pBlock, &errorBlock ); + hb_itemCopy( pObject, pError ); + + hb_evalNew( &eval, pBlock ); + hb_evalPutParam( &eval, pObject ); + + pResult = hb_evalLaunch( &eval ); + hb_evalRelease( &eval ); + + /* Check results */ + + /* TODO: Determine if there was a BREAK in the error handler. */ + if( FALSE ) + { + /* TODO: Detect sequence level properly */ + if( FALSE ) + { + /* TODO: Initiate a jump to the closest RECOVER statement */ + /* QUESTION: Will Clipper return to the caller in this case ? */ + } + else + { + hb_itemRelease( pResult ); + pResult = NULL; + + /* TODO: QUIT correctly, without any message */ + exit( 1 ); + } + } + else + { + /* If the canSubstitute flag has not been set, + consider it as a failure. */ + + if( ! ( hb_errGetFlags( pError ) & EF_CANSUBSTITUTE ) ) { hb_errInternal( 9999, "Error recovery failure", NULL, NULL ); } } } else - { - wRetVal = E_RETRY; /* Clipper does this, undocumented */ - } + pResult = hb_itemNew( NULL ); - return wRetVal; + return pResult; } -/* NOTE: This should be called when the EF_CANSUBSTITUE flag was set */ -/* Since it this case the error handler will return the value */ -/* to be substituted */ - -/* TODO: -PHB_ITEM hb_errLaunchExt( PHB_ITEM pError ) -{ -} -*/ - void hb_errRelease( PHB_ITEM pError ) { - if ( pError ) - hb_itemRelease( pError ); + /* NOTE: NULL pointer is checked by hb_itemRelease() */ + hb_itemRelease( pError ); } char * hb_errGetDescription( PHB_ITEM pError ) @@ -312,7 +381,8 @@ USHORT hb_errGetFlags( PHB_ITEM pError ) hb_vmPush( pError ); hb_vmDo( 0 ); - if (stack.Return.item.asLogical.value) uiFlags |= EF_CANRETRY; + if( stack.Return.item.asLogical.value ) + uiFlags |= EF_CANRETRY; /* ; */ @@ -320,7 +390,8 @@ USHORT hb_errGetFlags( PHB_ITEM pError ) hb_vmPush( pError ); hb_vmDo( 0 ); - if (stack.Return.item.asLogical.value) uiFlags |= EF_CANSUBSTITUTE; + if( stack.Return.item.asLogical.value ) + uiFlags |= EF_CANSUBSTITUTE; /* ; */ @@ -328,7 +399,8 @@ USHORT hb_errGetFlags( PHB_ITEM pError ) hb_vmPush( pError ); hb_vmDo( 0 ); - if (stack.Return.item.asLogical.value) uiFlags |= EF_CANDEFAULT; + if( stack.Return.item.asLogical.value ) + uiFlags |= EF_CANDEFAULT; /* ; */ @@ -382,7 +454,7 @@ static WORD hb_errRT_New hb_errPutSubSystem( pError, szSubSystem ); hb_errPutGenCode( pError, ulGenCode ); hb_errPutSubCode( pError, ulSubCode ); - hb_errPutDescription( pError, szDescription ? szDescription : hb_langDGetErrorDesc(ulGenCode) ); + hb_errPutDescription( pError, szDescription ? szDescription : hb_langDGetErrorDesc( ulGenCode ) ); hb_errPutOperation( pError, szOperation ); hb_errPutOsCode( pError, uiOsCode ); hb_errPutFlags( pError, uiFlags ); @@ -396,8 +468,8 @@ static WORD hb_errRT_New HARBOUR HB___ERRRT_BASE( void ) { - hb_errRT_BASE( (ULONG) hb_parnl( 1 ), - (ULONG) hb_parnl( 2 ), + hb_errRT_BASE( ( ULONG ) hb_parnl( 1 ), + ( ULONG ) hb_parnl( 2 ), ISCHAR( 3 ) ? hb_parc( 3 ) : NULL, hb_parc( 4 ) ); } @@ -430,14 +502,15 @@ void hb_errRT_TOOLS( ULONG ulGenCode, ULONG ulSubCode, char * szDescription, cha /* NOTE: Use as minimal calls from here, as possible. */ /* Don't allocate memory from this function. */ -void hb_errInternal ( ULONG ulIntCode, char * szText, char * szPar1, char * szPar2 ) +void hb_errInternal( ULONG ulIntCode, char * szText, char * szPar1, char * szPar2 ) { - char szError [ 256 ]; + printf( hb_consoleGetNewLine() ); + printf( "Internal error %lu: ", ulIntCode ); + printf( szText != NULL ? szText : hb_langDGetErrorIntr( ulIntCode ), szPar1, szPar2 ); + printf( hb_consoleGetNewLine() ); - sprintf( szError, szText ? szText : hb_langDGetErrorIntr( ulIntCode ), szPar1, szPar2 ); - printf( "\nInternal error %lu: %s\n", ulIntCode, szError ); - - hb_callStackShow(); + hb_stackDispCall(); exit( EXIT_FAILURE ); } + diff --git a/harbour/source/rtl/extend.c b/harbour/source/rtl/extend.c index a28dca674a..4408b4b443 100644 --- a/harbour/source/rtl/extend.c +++ b/harbour/source/rtl/extend.c @@ -27,7 +27,7 @@ #include "set.h" #include "dates.h" -/* NOTE: iParam == 0 can be used to access the SELF object. */ +/* NOTE: iParam = 0 can be used to access the SELF object. */ PHB_ITEM hb_param( int iParam, WORD wMask ) { @@ -85,7 +85,7 @@ char * hb_parc( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return hb_arrayGetString( pItem, ulArrayIndex ); } } @@ -119,7 +119,7 @@ ULONG hb_parclen( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return hb_arrayGetStringLen( pItem, ulArrayIndex ); } } @@ -156,7 +156,7 @@ ULONG hb_parcsiz( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return hb_arrayGetStringLen( pItem, ulArrayIndex ) + 1; } } @@ -180,7 +180,7 @@ char * hb_pards( int iParam, ... ) if( IS_DATE( pItem ) ) { - if ( pItem->item.asDate.value > 0 ) + if( pItem->item.asDate.value > 0 ) { long lDay, lMonth, lYear; @@ -200,7 +200,7 @@ char * hb_pards( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { hb_arrayGetDate( pItem, ulArrayIndex, stack.szDate ); stack.szDate[ 8 ] = '\0'; @@ -209,8 +209,8 @@ char * hb_pards( int iParam, ... ) } } } - - return " "; + + return " "; /* 8 spaces */ } int hb_parl( int iParam, ... ) @@ -248,7 +248,7 @@ int hb_parl( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return hb_arrayGetBool( pItem, ulArrayIndex ) ? 1 : 0; } } @@ -288,7 +288,7 @@ double hb_parnd( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return hb_arrayGetDouble( pItem, ulArrayIndex ); } } @@ -328,7 +328,7 @@ int hb_parni( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return ( int ) hb_arrayGetDouble( pItem, ulArrayIndex ); } } @@ -371,7 +371,7 @@ long hb_parnl( int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) return ( long ) hb_arrayGetDouble( pItem, ulArrayIndex ); } } @@ -554,7 +554,7 @@ void hb_storc( char * szText, int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { ulLen = strlen( szText ); pItemRef = hb_itemNew( NULL ); @@ -607,7 +607,7 @@ void hb_storclen( char * fixText, ULONG ulLen, int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { pItemRef = hb_itemNew( NULL ); pItemRef->type = IT_STRING; @@ -657,7 +657,7 @@ void hb_stords( char * szDate, int iParam, ... ) /* szDate must have yyyymmdd fo ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { pItemRef = hb_itemNew( NULL ); pItemRef->type = IT_DATE; @@ -701,7 +701,7 @@ void hb_storl( int iLogical, int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { pItemRef = hb_itemNew( NULL ); pItemRef->type = IT_LOGICAL; @@ -747,7 +747,7 @@ void hb_storni( int iValue, int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { pItemRef = hb_itemNew( NULL ); pItemRef->type = IT_INTEGER; @@ -794,7 +794,7 @@ void hb_stornl( long lValue, int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { pItemRef = hb_itemNew( NULL ); pItemRef->type = IT_LONG; @@ -849,7 +849,7 @@ void hb_stornd( double dValue, int iParam, ... ) ulArrayIndex = va_arg( va, long ); va_end( va ); - if ( ulArrayIndex != 0 ) + if( ulArrayIndex != 0 ) { pItemRef = hb_itemNew( NULL ); pItemRef->type = IT_DOUBLE; diff --git a/harbour/source/rtl/fm.c b/harbour/source/rtl/fm.c index bbeaee839b..4250ba7e67 100644 --- a/harbour/source/rtl/fm.c +++ b/harbour/source/rtl/fm.c @@ -22,6 +22,12 @@ You can contact me at: alinares@fivetech.com */ +/* NOTE: If you turn this on, the memory subsystem will collect information + about several statistical data about memory management, it will show + these on exit if memory seem to have leaked. + This should be normally turned off in a final release */ +#define HB_FM_STATISTICS + #ifndef __MPW__ #include #endif @@ -29,10 +35,12 @@ #include "extend.h" #include "errorapi.h" -ULONG ulMemoryBlocks = 0; -ULONG ulMemoryMaxBlocks = 0; -ULONG ulMemoryMaxConsumed = 0; -ULONG ulMemoryConsumed = 0; +#ifdef HB_FM_STATISTICS +static ULONG s_ulMemoryBlocks = 0; /* memory blocks used */ +static ULONG s_ulMemoryMaxBlocks = 0; /* maximum number of used memory blocks */ +static ULONG s_ulMemoryMaxConsumed = 0; /* memory size consumed */ +static ULONG s_ulMemoryConsumed = 0; /* memory max size consumed */ +#endif void * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, returns NULL on failure */ { @@ -45,10 +53,12 @@ void * hb_xalloc( ULONG ulSize ) /* allocates fixed memory, returns NULL * ( ( ULONG * ) pMem ) = ulSize; /* we store the block size into it */ - ulMemoryConsumed += ulSize; - ulMemoryMaxConsumed += ulSize; - ulMemoryBlocks++; - ulMemoryMaxBlocks++; +#ifdef HB_FM_STATISTICS + s_ulMemoryConsumed += ulSize; + s_ulMemoryMaxConsumed += ulSize; + s_ulMemoryBlocks++; + s_ulMemoryMaxBlocks++; +#endif return ( char * ) pMem + sizeof( ULONG ); } @@ -64,10 +74,12 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail * ( ( ULONG * ) pMem ) = ulSize; /* we store the block size into it */ - ulMemoryConsumed += ulSize; - ulMemoryMaxConsumed += ulSize; - ulMemoryBlocks++; - ulMemoryMaxBlocks++; +#ifdef HB_FM_STATISTICS + s_ulMemoryConsumed += ulSize; + s_ulMemoryMaxConsumed += ulSize; + s_ulMemoryBlocks++; + s_ulMemoryMaxBlocks++; +#endif return ( char * ) pMem + sizeof( ULONG ); } @@ -84,12 +96,14 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ * ( ( ULONG * ) pResult ) = ulSize; /* we store the block size into it */ +#ifdef HB_FM_STATISTICS if( ! ulSize ) - ulMemoryBlocks--; + s_ulMemoryBlocks--; - ulMemoryConsumed += ( ulSize - ulMemSize ); + s_ulMemoryConsumed += ( ulSize - ulMemSize ); if( ulSize > ulMemSize ) - ulMemoryMaxConsumed += ulSize - ulMemSize; + s_ulMemoryMaxConsumed += ulSize - ulMemSize; +#endif return ( char * ) pResult + sizeof( ULONG ); } @@ -103,8 +117,10 @@ void hb_xfree( void * pMem ) /* frees fixed memory */ else hb_errInternal( 9999, "hb_xfree called with a null pointer", NULL, NULL ); - ulMemoryConsumed -= ulMemSize; - ulMemoryBlocks--; +#ifdef HB_FM_STATISTICS + s_ulMemoryConsumed -= ulMemSize; + s_ulMemoryBlocks--; +#endif } ULONG hb_xsize( void * pMem ) /* returns the size of an allocated memory block */ @@ -112,3 +128,20 @@ ULONG hb_xsize( void * pMem ) /* returns the size of an allocated memory block * return * ( ULONG * ) ( ( char * ) pMem - sizeof( ULONG ) ); } +void hb_xinit( void ) /* Initialize fixed memory subsystem */ +{ + ; +} + +void hb_xexit( void ) /* Deinitialize fixed memory subsystem */ +{ +#ifdef HB_FM_STATISTICS + if( s_ulMemoryBlocks ) + { + printf( "\n\ntotal memory blocks allocated: %lu\n", s_ulMemoryMaxBlocks ); + printf( "memory maximum size consumed: %ld\n", s_ulMemoryMaxConsumed ); + printf( "memory blocks not released: %ld\n", s_ulMemoryBlocks ); + printf( "memory size not released: %ld\n", s_ulMemoryConsumed ); + } +#endif +} diff --git a/harbour/source/rtl/inkey.c b/harbour/source/rtl/inkey.c index a7a17e0280..7cdc95dda6 100644 --- a/harbour/source/rtl/inkey.c +++ b/harbour/source/rtl/inkey.c @@ -510,10 +510,15 @@ void hb_inkeyReset( BOOL allocate) /* Reset the keyboard buffer */ HARBOUR HB_INKEY( void ) { - int args = hb_pcount(), key = 0, wait = FALSE, forever = FALSE; + int args = hb_pcount(); + int key = 0; + BOOL wait = FALSE, forever = FALSE; double seconds; HB_inkey_enum event_mask = hb_set.HB_SET_EVENTMASK; /* Default to the SET input event mask */ + if( args < 1 || args > 2 ) + hb_errRT_BASE( EG_ARGCOUNT, 3000, NULL, "INKEY" ); /* NOTE: Clipper catches this at compile time! */ + if( args == 1 || ( args > 1 && hb_param( 1, IT_NUMERIC ) ) ) { /* If only one parameter or if 1st parameter is numeric, then use it diff --git a/harbour/source/rtl/itemapi.c b/harbour/source/rtl/itemapi.c index bc71ac56d7..9e8b36e956 100644 --- a/harbour/source/rtl/itemapi.c +++ b/harbour/source/rtl/itemapi.c @@ -53,10 +53,9 @@ BOOL hb_evalPutParam( PEVALINFO pEvalInfo, PHB_ITEM pItem ) 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 ] ) + if( pEvalInfo->pItems[ w ] == NULL ) { - pEvalInfo->pItems[ w ] = hb_itemNew( NULL ); - hb_itemCopy( pEvalInfo->pItems[ w ], pItem ); + pEvalInfo->pItems[ w ] = pItem; bResult = TRUE; break; } @@ -75,6 +74,7 @@ BOOL hb_evalRelease( PEVALINFO pEvalInfo ) WORD w; for( w = 0; w < HB_EVAL_PARAM_MAX_ + 1; w++ ) + /* NOTE: NULL pointer is checked by hb_itemRelease() */ hb_itemRelease( pEvalInfo->pItems[ w ] ); bResult = TRUE; @@ -133,9 +133,10 @@ PHB_ITEM hb_itemNew( PHB_ITEM pNull ) PHB_ITEM hb_itemParam( WORD wParam ) { PHB_ITEM pNew = hb_itemNew( NULL ); + PHB_ITEM pItem = hb_param( wParam, IT_ANY ); - if( hb_param( wParam, IT_ANY ) ) - hb_itemCopy( pNew, hb_param( wParam, IT_ANY )); + if( pItem ) + hb_itemCopy( pNew, pItem ); return pNew; } @@ -521,7 +522,7 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, BOOL bForceExact ) long lCounter; int iRet = 0; /* Current status */ - if ( hb_set.HB_SET_EXACT && ! bForceExact ) + if( hb_set.HB_SET_EXACT && ! bForceExact ) { /* SET EXACT ON and not using == */ /* Don't include trailing spaces */ while( lLenFirst > 0 && szFirst[ lLenFirst - 1 ] == ' ') lLenFirst--; diff --git a/harbour/source/rtl/langapi.c b/harbour/source/rtl/langapi.c index 1a0f9bcb87..4b69b5d627 100644 --- a/harbour/source/rtl/langapi.c +++ b/harbour/source/rtl/langapi.c @@ -113,7 +113,7 @@ static HB_LANG langEN = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", @@ -151,7 +151,7 @@ static PHB_LANG langDef = &langEN; void hb_langDSet ( PHB_LANG lang ) { - if (lang) + if( lang ) langDef = lang; } diff --git a/harbour/source/rtl/mouse.c b/harbour/source/rtl/mouse.c deleted file mode 100644 index 88d9ab038e..0000000000 --- a/harbour/source/rtl/mouse.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - Harbour Project source code - - Harbour mouse support - - Copyright(C) 1999 by Jose Lalin. - http://www.Harbour-Project.org/ - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - The exception is that if you link the Harbour Runtime Library (HRL) - and/or the Harbour Virtual Machine (HVM) with other files to produce - an executable, this does not by itself cause the resulting executable - to be covered by the GNU General Public License. Your use of that - executable is in no way restricted on account of linking the HRL - and/or HVM code into it. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - their web site at http://www.gnu.org/). - - You can contact me at: dezac@corevia.com - - The Follow Functions or Copyright(C) 1999 Luiz Rafael Culik (culik@sl.conex.net) - int hb_MouseButton(void); - int hb_MouseGetPage(void); - void hb_MouseSetPage(int iPage) - void hb_MouseDefCursor(int nCurType,nScrMask,nCurMask) - void hb_MouseSetCoord(int nX, int nY) - void hb_MouseSetLanguage(int nLang) - char hb_MouseVersion(void) - HARBOUR HB_MBPRESSED(void) - HARBOUR HB_MGETPAGE(void) - HARBOUR HB_MSETPAGE(void) - HARBOUR HB_MDEFCURSOR(void) - HARBOUR HB_MSETCOORDS(void) - HARBOUR HB_MSETLANG(void); - HARBOUR HB_MGETLANG(void) - HARBOUR HB_MVERSION(void) - -*/ - - - -#include -#include "hbdefs.h" -#include "extend.h" -#include "gtapi.h" -#include "mouse.h" -#include "init.h" -HB_INIT_SYMBOLS_BEGIN( Mouse__InitSymbols ) -{"MPRESENT",FS_PUBLIC,"HB_PRESENT",0}, -{"MSHOW",FS_PUBLIC,"HB_MSHOW",0}, -{"MHIDE",FS_PUBLIC,"HB_MHIDE",0}, -{"MCOL",FS_PUBLIC,"HB_MCOL",0}, -{"MROW",FS_PUBLIC,"HB_MROW",0}, -{"MSETPOS",FS_PUBLIC,"HB_MSETPOS",0}, -{"MSETCURSOR",FS_PUBLIC,"HB_MSETCURSOR",0}, -{"MSETBOUND",FS_PUBLIC,"HB_MSETBOUNDS",0}, -{"MPRESSED",FS_PUBLIC,"HB_MBPRESSED",0}, -{"MGETPAGE",FS_PUBLIC,"HB_MGETPAGE",0}, -{"MSETPAGE",FS_PUBLIC,"HB_MSETPAGE",0}, -{"MDEFCURSOR",FS_PUBLIC,"HB_MDEFCURSOR",0}, -{"MSETCURSOR",FS_PUBLIC,"HB_MSETCOORDS",0}, -{"MSETLANG",FS_PUBLIC,"HB_MSETLANG",0}, -{"MGETLANG",FS_PUBLIC,"HB_MGETLANG",0}, -{"MVERSION",FS_PUBLIC,"HB_MVERSION",0} -HB_INIT_SYMBOLS_END( Mouse__InitSymbols ) -#if ! defined(__GNUC__) -#pragma startup Mouse__InitSymbols -#endif - - -HARBOUR HB_MPRESENT( void ) -{ - hb_retni( hb_MousePresent() ); -} - -HARBOUR HB_MSHOW( void ) -{ - hb_MouseShow(); -} - -HARBOUR HB_MHIDE( void ) -{ - hb_MouseHide(); -} - -HARBOUR HB_MCOL( void ) -{ - hb_retni( hb_MouseCol() ); -} - -HARBOUR HB_MROW( void ) -{ - hb_retni( hb_MouseRow() ); -} - -HARBOUR HB_MSETPOS( void ) -{ - if( ISNUM( 1 ) && ISNUM( 2 ) ) - hb_MouseSetPos( hb_parni( 1 ), hb_parni( 2 ) ); -} - -HARBOUR HB_MSETCURSOR( void ) -{ - if( ISLOG( 1 ) ) - hb_retl( hb_MouseSetCursor( hb_parl( 1 ) ) ); -} - -HARBOUR HB_MSETBOUNDS( void ) -{ - if( ISNUM( 1 ) && ISNUM( 2 ) && ISNUM( 3 ) && ISNUM( 4 ) ) - hb_MouseSetBounds( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); -} -/* $DOC$ - * $FUNCNAME$ - * HB_MBPRESSED() - * $CATEGORY$ - * Mouse - * $ONELINER$ - * Get the last mouse button number - * $SYNTAX$ - * :=MPRESSED() --> lButton - * $ARGUMENTS$ - * - * $RETURNS$ - * The last mouse button pressed - * $DESCRIPTION$ - * - * This function will return the last mouse button pressed - * 1 for left button,2 for the right button - * 3 for both left and right button, 4 for the middle button - * 5 for both left and middle button, 6 for both right and middle button - * 7 for all 3 button - * - * $EXAMPLES$ - * x:=mPressed() - * $TESTS$ - * - * $STATUS$ - * - * $COMPLIANCE$ - * - * $SEEALSO$ - * - * $END$ - */ - -HARBOUR HB_MBPRESSED(void) -{ - hb_retni( hb_MouseButton()); -} - -HARBOUR HB_MSETPAGE(void) -{ - if( ISNUM( 1 )) - hb_MouseSetPage(hb_parni(1)); -} - -HARBOUR HB_MGETPAGE() -{ - int iPage; - hb_retni(hb_MouseGetPage()); -} - -HARBOUR HB_MDEFCURSOR(void) -{ - hb_MouseDefCursor( hb_parni(1),hb_parni(2),hb_parni(3)); - -} - -HARBOUR HB_MSETCOORDS(void) -{ - if( ISNUM(1) &&ISNUM(2) ) - hb_MouseSetCoord(hb_parni(1),hb_parni(2)); -} - -HARBOUR HB_MSETLANG(void) -{ - if (ISNUM(1)) - hb_MouseSetLanguage(hb_parni(1)); -} - -HARBOUR HB_MVERSION(void) -{ - hb_retclen(hb_MouseVersion(),4); -} diff --git a/harbour/source/rtl/mouse/mousedos.c b/harbour/source/rtl/mouse/mousedos.c index 4c84332687..bbf6959db4 100644 --- a/harbour/source/rtl/mouse/mousedos.c +++ b/harbour/source/rtl/mouse/mousedos.c @@ -1,15 +1,19 @@ +/* + * $Id$ + */ + /* Harbour Project source code - Harbour mouse support + Harbour Mouse Subsystem for DOS - Copyright(C) 1999 by Jose Lalin. - http://www.Harbour-Project.org/ + Copyright 1999 ???????????????? + www - http://www.harbour-project.org This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: The exception is that if you link the Harbour Runtime Library (HRL) and/or the Harbour Virtual Machine (HVM) with other files to produce @@ -18,323 +22,104 @@ executable is in no way restricted on account of linking the HRL and/or HVM code into it. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit their web site at http://www.gnu.org/). - You can contact me at: dezac@corevia.com - - The Follow Functions or Copyright(C) 1999 Luiz Rafael Culik (culik@sl.conex.net) - int hb_MouseButton(void); - int hb_MouseGetPage(void); - void hb_MouseSetPage(int iPage) - void hb_MouseDefCursor(int nCurType,nScrMask,nCurMask) - void hb_MouseSetCoord(int nX, int nY) - void hb_MouseSetLanguage(int nLang) - char hb_MouseVersion(void) - HARBOUR HB_MBPRESSED(void) - HARBOUR HB_MGETPAGE(void) - HARBOUR HB_MSETPAGE(void) - HARBOUR HB_MDEFCURSOR(void) - HARBOUR HB_MSETCOORDS(void) - HARBOUR HB_MSETLANG(void); - HARBOUR HB_MGETLANG(void) - HARBOUR HB_MVERSION(void) - V 1.11 Luiz Rafael Fixed Another bug on hb_MouseVersion() . Now it returning the Correct Value - V 1.1 Luiz Rafael Fixed bug on hb_MouseVersion() and hb_MouseSetCoord() - V 1.0 Luiz Rafael Initial Release */ -#pragma inline +#include "mouseapi.h" +/* C callable low-level interface */ - -#include "hbdefs.h" -#include "extend.h" -#include "gtapi.h" -#include "mouse.h" -#include "init.h" -#include "string.h" -#include "stdlib.h" -#include "dos.h" -#include "stdio.h" -/* Is there a mouse ? */ -int iMouse = 0; - -/* Mouse buttons */ -int iButtons = 0; - -/* Is mouse cursor visible ? */ -int iCursorVisible = 0; - -/* Init mouse pos */ -int iInitCol = 0; -int iInitRow = 0; - - -void hb_MouseSetLanguage(int nLang) +void hb_mouse_Init( void ) { - asm - { - mov ax,34 - mov bx,nLang - int MOUSE_INTERRUPT - } + /* TODO: */ } -int hb_MouseGetLanguage(void) +void hb_mouse_Exit( void ) { - int nLang; - - asm - { - mov ax,35 - int MOUSE_INTERRUPT - mov nLang,bx - - } - return nLang; + /* TODO: */ } -void hb_MouseSetCoord(int nX, int nY) +BOOL hb_mouse_IsPresent( void ) { - union REGS regs; + /* TODO: */ - nX*=8; - nY*=8; - - regs.x.ax=4 ; - regs.x.cx=nY ; - regs.x.dx=nX; - int86(MOUSE_INTERRUPT,®s,®s); -/* - asm - { - mox ax,4 - mov cx,nY - mov dx,nX - int MOUSE_INTERRUPT - } - */ -} -void hb_MouseDefCursor(int nCurType,int nScrMask,int nCurMask) -{ - asm - { - mov ax,10 - mov bx,nCurType - mov cx,nScrMask - mov dx,nCurMask - int MOUSE_INTERRUPT - } + return 0; } -int hb_MouseGetPage() +void hb_mouse_Show( void ) { - int iPage; - asm - { - mov ax,30 - int MOUSE_INTERRUPT - mov iPage,bx - } - return iPage; + /* TODO: */ } -void hb_MouseSetPage(int iPage) +void hb_mouse_Hide( void ) { - asm - { - mov ax,29 - mov bx,iPage - int MOUSE_INTERRUPT - } - + /* TODO: */ } -void hb_MouseInit( void ) +int hb_mouse_Col( void ) { - asm - { - xor ax, ax - int MOUSE_INTERRUPT - mov iMouse, ax - mov iButtons, bx - } + /* TODO: */ - if( iMouse ) - { - iInitCol = hb_MouseCol(); - iInitRow = hb_MouseRow(); - } + return 0; } -int hb_MouseButton() +int hb_mouse_Row( void ) { - int iButton; - if (iMouse) - { - asm - { - mov ax,3 - int MOUSE_INTERRUPT - mov iButton,bx - } + /* TODO: */ - } - return iButton; + return 0; } -void hb_MouseDone( void ) +void hb_mouse_SetPos( int iRow, int iCol ) { - hb_MouseSetPos( iInitRow, iInitCol ); - hb_MouseSetBounds( 0, 0, hb_gtMaxCol(), hb_gtMaxRow() ); + /* TODO: */ + + HB_SYMBOL_UNUSED( iRow ); + HB_SYMBOL_UNUSED( iCol ); } -int hb_MousePresent( void ) +BOOL hb_mouse_IsButtonPressed( int iButton ) { - return( iMouse ); + /* TODO: */ + + HB_SYMBOL_UNUSED( iButton ); + + return FALSE; } -void hb_MouseShow( void ) +int hb_mouse_CountButton( void ) { - if( iMouse ) - { - asm - { - mov ax, 1 - int MOUSE_INTERRUPT - } - iCursorVisible = TRUE; - } + /* TODO: */ + + return 0; } -void hb_MouseHide( void ) +void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ) { - if( iMouse ) - { - asm - { - mov ax, 2 - int MOUSE_INTERRUPT - } - iCursorVisible = FALSE; - } + /* TODO: */ + + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( iBottom ); + HB_SYMBOL_UNUSED( iRight ); } -int hb_MouseCol( void ) +void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ) { - int iCol; + /* TODO: */ - if( iMouse ) - { - asm - { - mov ax, 3 - int MOUSE_INTERRUPT - mov iCol, cx - } - return( iCol / 8 ); - } - return( -1 ); + HB_SYMBOL_UNUSED( piTop ); + HB_SYMBOL_UNUSED( piLeft ); + HB_SYMBOL_UNUSED( piBottom ); + HB_SYMBOL_UNUSED( piRight ); } -int hb_MouseRow( void ) -{ - int iRow; - - if( iMouse ) - { - asm - { - mov ax, 3 - int MOUSE_INTERRUPT - mov iRow, dx - } - return( iRow / 8 ); - } - return( -1 ); -} - -void hb_MouseSetPos( int iRow, int iCol ) -{ - if( iMouse ) - { - iRow *= 8; - iCol *= 8; - - asm - { - mov ax, 4 - mov cx, iRow - mov dx, iCol - int MOUSE_INTERRUPT - } - } -} - -int hb_MouseSetCursor( int iVisible ) -{ - if( iVisible ) - hb_MouseShow(); - else - hb_MouseHide(); - - return( iCursorVisible ); -} - -void hb_MouseSetBounds( int iTop, int iLeft, int iBottom, int iRight ) -{ - if( iMouse ) - { - iLeft *= 8; - iRight *= 8; - - asm - { - mov ax, 7 - mov cx, iLeft - mov dx, iRight - int MOUSE_INTERRUPT - } - - iTop *= 8; - iBottom *= 8; - - asm - { - mov ax, 8 - mov cx, iTop - mov dx, iBottom - int MOUSE_INTERRUPT - } - } -} - -char *hb_MouseVersion(void) -{ - union REGS regs; - char Major[4],Minor[4], Version[10]; - char *cReturn; - int nMajor,nMinor; - - regs.x.ax=0x024; - int86(MOUSE_INTERRUPT,®s,®s); - nMajor=regs.h.bh; - nMinor=regs.h.bl; - itoa(nMajor,Major,10); - itoa(nMinor,Minor,10); - strcpy(Version,Major); - strcat(Version,"."); - strcat(Version,Minor); - strcpy(cReturn,Version); - - return cReturn; - -} diff --git a/harbour/source/rtl/mouse/mouseos2.c b/harbour/source/rtl/mouse/mouseos2.c index 8b56fa8b3f..05368a6987 100644 --- a/harbour/source/rtl/mouse/mouseos2.c +++ b/harbour/source/rtl/mouse/mouseos2.c @@ -1,8 +1,10 @@ /* - * $Id: + * $Id$ */ /* + Harbour Project source code + Harbour mouse subsystem for OS/2 compilers. Copyright 1999 by Chen Kedem @@ -33,6 +35,8 @@ V 1.0 Chen Kedem Initial version. */ +#include "mouseapi.h" + /*---------------------------------------------------------------------------*/ /* TODO: those exist in os2.h which I don't have */ /* #define INCL_???? as needed */ @@ -77,26 +81,7 @@ typedef struct _MOUEVENTINFO { } MOUEVENTINFO; /*---------------------------------------------------------------------------*/ -/*---------------------------------------------------------------------------*/ -/* TODO: those should probably be in mouse.h */ -extern void hb_mouse_Init( void ); -extern void hb_mouse_Exit( void ); -extern BOOL hb_mouse_IsPresent( void ); -extern void hb_mouse_Show( void ); -extern void hb_mouse_Hide( void ); -extern int hb_mouse_Col( void ); -extern int hb_mouse_Row( void ); -extern void hb_mouse_SetPos( int, int ); -/* extern BOOL hb_mouse_GetCursor( void ); */ /* top level should do it */ -/* extern void hb_mouse_SetCursor( BOOL ); */ /* top level should do it */ -extern BOOL hb_mouse_IsButtonPressed( int ); -extern int hb_mouse_CountButton( void ); -extern void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ); -extern void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ); -/*---------------------------------------------------------------------------*/ - static unsigned suMouHandle; /* mouse logical handle */ -/* static BOOL sbMouVisible = FALSE; */ /* is mouse cursor visible ? */ void hb_mouse_Init() { @@ -121,10 +106,7 @@ BOOL hb_mouse_IsPresent(void) void hb_mouse_Show(void) { if ( suMouHandle ) - { MouDrawPtr ( suMouHandle ); -/* sbMouVisible = TRUE; */ - } } void hb_mouse_Hide(void) @@ -147,7 +129,6 @@ void hb_mouse_Hide(void) rect.cRow = 20/*hb_gt_GetScreenHeight()*/; /* x-coordinate lower right */ rect.cCol = 60/*hb_gt_GetScreenWidth()*/; /* y-coordinate lower right */ MouRemovePtr ( &rect, suMouHandle ); -/* sbMouVisible = FALSE; */ } } @@ -188,30 +169,6 @@ void hb_mouse_SetPos( int row, int col ) } } -/* - NOTE: I think top level should handle that -*/ -/* -BOOL hb_mouse_GetCursor(void) -{ - return ( sbMouVisible ); -} -*/ - -/* - NOTE: I think top level should handle that -*/ -/* -void hb_mouse_SetCursor( BOOL bVisible ) -{ - if ( bVisible ) - hb_mouse_Show(); - else - hb_mouse_Hide(); - return ( sbMouVisible ); -} -*/ - BOOL hb_mouse_IsButtonPressed( int iButton ) { /* @@ -256,3 +213,4 @@ void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRigh the old book I'm using does not have such. */ } + diff --git a/harbour/source/rtl/mouse/mousetpl.c b/harbour/source/rtl/mouse/mousetpl.c index 1902a4b052..f8bd767388 100644 --- a/harbour/source/rtl/mouse/mousetpl.c +++ b/harbour/source/rtl/mouse/mousetpl.c @@ -1,12 +1,19 @@ +/* + * $Id$ + */ + /* Harbour Project source code - Harbour mouse support + Harbour Mouse Subsystem Template + + Copyright 1999 Victor Szel + www - http://www.harbour-project.org This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: The exception is that if you link the Harbour Runtime Library (HRL) and/or the Harbour Virtual Machine (HVM) with other files to produce @@ -15,115 +22,104 @@ executable is in no way restricted on account of linking the HRL and/or HVM code into it. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit their web site at http://www.gnu.org/). - - V 1.0 Luiz Rafael Initial Release - - TODO:Everything! */ -/* Is there a mouse ? */ -int iMouse = 0; +#include "mouseapi.h" -/* Mouse buttons */ -int iButtons = 0; +/* C callable low-level interface */ -/* Is mouse cursor visible ? */ -int iCursorVisible = 0; - -/* Init mouse pos */ -int iInitCol = 0; -int iInitRow = 0; - - -void hb_MouseSetLanguage(int nLang) +void hb_mouse_Init( void ) { + /* TODO: */ } -int hb_MouseGetLanguage(void) +void hb_mouse_Exit( void ) { - return 0; + /* TODO: */ } -void hb_MouseSetCoord(int nX, int nY) +BOOL hb_mouse_IsPresent( void ) { - nX*=8; - nY*=8; + /* TODO: */ -} - -void hb_MouseDefCursor(int nCurType,int nScrMask,int nCurMask) -{ -} - -int hb_MouseGetPage() -{ return 0; } -void hb_MouseSetPage(int iPage) +void hb_mouse_Show( void ) { + /* TODO: */ } -void hb_MouseInit( void ) +void hb_mouse_Hide( void ) { + /* TODO: */ } -int hb_MouseButton() +int hb_mouse_Col( void ) { + /* TODO: */ + return 0; } -void hb_MouseDone( void ) +int hb_mouse_Row( void ) { - hb_MouseSetPos( iInitRow, iInitCol ); - hb_MouseSetBounds( 0, 0, hb_gtMaxCol(), hb_gtMaxRow() ); + /* TODO: */ + + return 0; } -int hb_MousePresent( void ) +void hb_mouse_SetPos( int iRow, int iCol ) { - return( iMouse ); + /* TODO: */ + + HB_SYMBOL_UNUSED( iRow ); + HB_SYMBOL_UNUSED( iCol ); } -void hb_MouseShow( void ) +BOOL hb_mouse_IsButtonPressed( int iButton ) { + /* TODO: */ + + HB_SYMBOL_UNUSED( iButton ); + + return FALSE; } -void hb_MouseHide( void ) +int hb_mouse_CountButton( void ) { + /* TODO: */ + + return 0; } -int hb_MouseCol( void ) +void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ) { - return( -1 ); + /* TODO: */ + + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( iBottom ); + HB_SYMBOL_UNUSED( iRight ); } -int hb_MouseRow( void ) +void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ) { - return( -1 ); + /* TODO: */ + + HB_SYMBOL_UNUSED( piTop ); + HB_SYMBOL_UNUSED( piLeft ); + HB_SYMBOL_UNUSED( piBottom ); + HB_SYMBOL_UNUSED( piRight ); } -void hb_MouseSetPos( int iRow, int iCol ) -{ -} - -int hb_MouseSetCursor( int iVisible ) -{ -} - -void hb_MouseSetBounds( int iTop, int iLeft, int iBottom, int iRight ) -{ -} - -char *hb_MouseVersion(void) -{ -} diff --git a/harbour/source/rtl/mouse/mousewin.c b/harbour/source/rtl/mouse/mousewin.c new file mode 100644 index 0000000000..b32c537326 --- /dev/null +++ b/harbour/source/rtl/mouse/mousewin.c @@ -0,0 +1,125 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Harbour Mouse Subsystem for Windows + + Copyright 1999 ???????????? + www - http://www.harbour-project.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: + + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). + +*/ + +#include "mouseapi.h" + +/* C callable low-level interface */ + +void hb_mouse_Init( void ) +{ + /* TODO: */ +} + +void hb_mouse_Exit( void ) +{ + /* TODO: */ +} + +BOOL hb_mouse_IsPresent( void ) +{ + /* TODO: */ + + return 0; +} + +void hb_mouse_Show( void ) +{ + /* TODO: */ +} + +void hb_mouse_Hide( void ) +{ + /* TODO: */ +} + +int hb_mouse_Col( void ) +{ + /* TODO: */ + + return 0; +} + +int hb_mouse_Row( void ) +{ + /* TODO: */ + + return 0; +} + +void hb_mouse_SetPos( int iRow, int iCol ) +{ + /* TODO: */ + + HB_SYMBOL_UNUSED( iRow ); + HB_SYMBOL_UNUSED( iCol ); +} + +BOOL hb_mouse_IsButtonPressed( int iButton ) +{ + /* TODO: */ + + HB_SYMBOL_UNUSED( iButton ); + + return FALSE; +} + +int hb_mouse_CountButton( void ) +{ + /* TODO: */ + + return 0; +} + +void hb_mouse_SetBounds( int iTop, int iLeft, int iBottom, int iRight ) +{ + /* TODO: */ + + HB_SYMBOL_UNUSED( iTop ); + HB_SYMBOL_UNUSED( iLeft ); + HB_SYMBOL_UNUSED( iBottom ); + HB_SYMBOL_UNUSED( iRight ); +} + +void hb_mouse_GetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ) +{ + /* TODO: */ + + HB_SYMBOL_UNUSED( piTop ); + HB_SYMBOL_UNUSED( piLeft ); + HB_SYMBOL_UNUSED( piBottom ); + HB_SYMBOL_UNUSED( piRight ); +} + diff --git a/harbour/source/rtl/mouseapi.c b/harbour/source/rtl/mouseapi.c new file mode 100644 index 0000000000..45207c1f47 --- /dev/null +++ b/harbour/source/rtl/mouseapi.c @@ -0,0 +1,272 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Harbour Mouse subsystem main file + + Copyright 1999 Victor Szel + www - http://www.harbour-project.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: + + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). + +*/ + +#include "extend.h" +#include "mouseapi.h" +#include "gtapi.h" + +/* TODO: This level should make sure that if there's no mouse present + the functions don't call the low level function, but return some + default values. */ + +static BOOL s_bPresent; +static BOOL s_bVisible; +static USHORT s_uiDoubleClickSpeed; /* In milliseconds */ +static int s_iLeftButton; +static int s_iRightButton; + +/* C callable interface */ + +void hb_mouseInit( void ) +{ + hb_mouse_Init(); + + s_bPresent = hb_mouse_IsPresent(); + + hb_mouseSetCursor( FALSE ); + + s_uiDoubleClickSpeed = 168; + s_iLeftButton = 1; /* TOFIX: */ + s_iRightButton = hb_mouseCountButton(); /* TOFIX: */ +} + +void hb_mouseExit( void ) +{ + hb_mouse_Exit(); +} + +BOOL hb_mouseIsPresent( void ) +{ + return hb_mouse_IsPresent(); +} + +BOOL hb_mouseGetCursor( void ) +{ + return s_bVisible; +} + +void hb_mouseSetCursor( BOOL bVisible ) +{ + if( bVisible ) + { + hb_mouse_Show(); + s_bVisible = TRUE; + } + else + { + hb_mouse_Hide(); + s_bVisible = FALSE; + } +} + +int hb_mouseCol( void ) +{ + return hb_mouse_Col(); +} + +int hb_mouseRow( void ) +{ + return hb_mouse_Row(); +} + +void hb_mouseSetPos( int iRow, int iCol ) +{ + hb_mouse_SetPos( iRow, iCol ); +} + +BOOL hb_mouseIsButtonPressed( int iButton ) +{ + return hb_mouse_IsButtonPressed( iButton ); +} + +int hb_mouseCountButton( void ) +{ + return hb_mouse_CountButton(); +} + +void hb_mouseSetBounds( int iTop, int iLeft, int iBottom, int iRight ) +{ + hb_mouse_SetBounds( iTop, iLeft, iBottom, iRight ); +} + +void hb_mouseGetBounds( int * piTop, int * piLeft, int * piBottom, int * piRight ) +{ + hb_mouse_GetBounds( piTop, piLeft, piBottom, piRight ); +} + +/* HARBOUR callable interface */ + +HARBOUR MPRESENT( void ) +{ + hb_retl( hb_mouseIsPresent() ); +} + +HARBOUR MHIDE( void ) +{ + hb_mouseSetCursor( FALSE ); +} + +HARBOUR MSHOW( void ) +{ + hb_mouseSetCursor( TRUE ); +} + +HARBOUR MSETCURSOR( void ) +{ + hb_retl( hb_mouseGetCursor() ); + + if( ISLOG( 1 ) ) + hb_mouseSetCursor( hb_parl( 1 ) ); +} + +HARBOUR MROW( void ) +{ + hb_retni( hb_mouseRow() ); +} + +HARBOUR MCOL( void ) +{ + hb_retni( hb_mouseCol() ); +} + +HARBOUR MSETPOS( void ) +{ + if( ISNUM( 1 ) && ISNUM( 2 ) ) + hb_mouseSetPos( hb_parni( 1 ), hb_parni( 2 ) ); +} + +HARBOUR MRIGHTDOWN( void ) +{ + hb_retl( hb_mouseIsButtonPressed( s_iRightButton ) ); +} + +HARBOUR MLEFTDOWN( void ) +{ + hb_retl( hb_mouseIsButtonPressed( s_iLeftButton ) ); +} + +HARBOUR MDBLCLK( void ) +{ + hb_retni( s_uiDoubleClickSpeed ); + + if( ISNUM( 1 ) ) + { + int uiDoubleClickSpeed = hb_parni( 1 ); + + if( uiDoubleClickSpeed > 0 ) + s_uiDoubleClickSpeed = uiDoubleClickSpeed; + } +} + +HARBOUR MSAVESTATE( void ) +{ + int iTop, iLeft, iBottom, iRight; + + USHORT uiPos; + USHORT uiLen = sizeof( int ) * 2 + + sizeof( BOOL ) + + sizeof( int ) * 4; + + BYTE * pBuffer = ( BYTE * ) hb_xgrab( uiLen ); + + hb_mouseGetBounds( &iTop, &iLeft, &iBottom, &iRight ); + + uiPos = 0; + *(pBuffer + uiPos) = hb_mouseRow(); + uiPos += sizeof( int ); + *(pBuffer + uiPos) = hb_mouseCol(); + uiPos += sizeof( int ); + *(pBuffer + uiPos) = s_bVisible; + uiPos += sizeof( BOOL ); + *(pBuffer + uiPos) = iTop; + uiPos += sizeof( int ); + *(pBuffer + uiPos) = iLeft; + uiPos += sizeof( int ); + *(pBuffer + uiPos) = iBottom; + uiPos += sizeof( int ); + *(pBuffer + uiPos) = iRight; + + hb_retclen( pBuffer, uiLen ); + + hb_xfree( pBuffer ); +} + +HARBOUR MRESTSTATE( void ) +{ + USHORT uiLen = sizeof( int ) * 2 + + sizeof( BOOL ) + + sizeof( int ) * 4; + + if( ISCHAR( 1 ) && hb_parclen( 1 ) == uiLen ) + { + int iRow, iCol; + int iTop, iLeft, iBottom, iRight; + BOOL bVisible; + + USHORT uiPos; + + BYTE * pBuffer = ( BYTE * ) hb_parc( 1 ); + + uiPos = 0; + iRow = *(pBuffer + uiPos); + uiPos += sizeof( int ); + iCol = *(pBuffer + uiPos); + uiPos += sizeof( int ); + bVisible = *(pBuffer + uiPos); + uiPos += sizeof( BOOL ); + iTop = *(pBuffer + uiPos); + uiPos += sizeof( int ); + iLeft = *(pBuffer + uiPos); + uiPos += sizeof( int ); + iBottom = *(pBuffer + uiPos); + uiPos += sizeof( int ); + iRight = *(pBuffer + uiPos); + + hb_mouseSetPos( iRow, iCol ); + hb_mouseSetBounds( iTop, iLeft, iBottom, iRight ); + hb_mouseSetCursor( bVisible ); + } +} + +HARBOUR MSETBOUNDS( void ) +{ + int iTop = ISNUM( 1 ) ? hb_parni( 1 ) : 0; + int iLeft = ISNUM( 2 ) ? hb_parni( 2 ) : 0; + int iBottom = ISNUM( 3 ) ? hb_parni( 3 ) : hb_gtMaxRow(); + int iRight = ISNUM( 4 ) ? hb_parni( 4 ) : hb_gtMaxCol(); + + hb_mouseSetBounds( iTop, iLeft, iBottom, iRight ); +} diff --git a/harbour/source/rtl/msxxx.c b/harbour/source/rtl/mousexxx.c similarity index 100% rename from harbour/source/rtl/msxxx.c rename to harbour/source/rtl/mousexxx.c diff --git a/harbour/source/rtl/natmsg/msg_tpl.c b/harbour/source/rtl/natmsg/msg_tpl.c index fc60e2663a..9ef61d15ee 100644 --- a/harbour/source/rtl/natmsg/msg_tpl.c +++ b/harbour/source/rtl/natmsg/msg_tpl.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgca.c b/harbour/source/rtl/natmsg/msgca.c index d2273a0508..aa0f5df9a8 100644 --- a/harbour/source/rtl/natmsg/msgca.c +++ b/harbour/source/rtl/natmsg/msgca.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgcs852.c b/harbour/source/rtl/natmsg/msgcs852.c index 3c724faf77..60a1699795 100644 --- a/harbour/source/rtl/natmsg/msgcs852.c +++ b/harbour/source/rtl/natmsg/msgcs852.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgcskam.c b/harbour/source/rtl/natmsg/msgcskam.c index b2a71353a2..e1575ab337 100644 --- a/harbour/source/rtl/natmsg/msgcskam.c +++ b/harbour/source/rtl/natmsg/msgcskam.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgde.c b/harbour/source/rtl/natmsg/msgde.c index 6a99a92f48..911a22043c 100644 --- a/harbour/source/rtl/natmsg/msgde.c +++ b/harbour/source/rtl/natmsg/msgde.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgen.c b/harbour/source/rtl/natmsg/msgen.c index 7de3268ebf..e7ba31f2bb 100644 --- a/harbour/source/rtl/natmsg/msgen.c +++ b/harbour/source/rtl/natmsg/msgen.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgeo.c b/harbour/source/rtl/natmsg/msgeo.c index af761fba9b..94bb5c3937 100644 --- a/harbour/source/rtl/natmsg/msgeo.c +++ b/harbour/source/rtl/natmsg/msgeo.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgeu.c b/harbour/source/rtl/natmsg/msgeu.c index b5c94227e7..ef7e03f43d 100644 --- a/harbour/source/rtl/natmsg/msgeu.c +++ b/harbour/source/rtl/natmsg/msgeu.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgfr.c b/harbour/source/rtl/natmsg/msgfr.c index 20cccc436e..26990baef0 100644 --- a/harbour/source/rtl/natmsg/msgfr.c +++ b/harbour/source/rtl/natmsg/msgfr.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msggl.c b/harbour/source/rtl/natmsg/msggl.c index fc6be92ef0..69e2452cc8 100644 --- a/harbour/source/rtl/natmsg/msggl.c +++ b/harbour/source/rtl/natmsg/msggl.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msghe862.c b/harbour/source/rtl/natmsg/msghe862.c index 45ce3c392e..b470d486d6 100644 --- a/harbour/source/rtl/natmsg/msghe862.c +++ b/harbour/source/rtl/natmsg/msghe862.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", " ", - "Limit exeeded", + "Limit exceeded", " ", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msghewin.c b/harbour/source/rtl/natmsg/msghewin.c index 7aea1e08fe..c3bced33ac 100644 --- a/harbour/source/rtl/natmsg/msghewin.c +++ b/harbour/source/rtl/natmsg/msghewin.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", " ", - "Limit exeeded", + "Limit exceeded", " ", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgid.c b/harbour/source/rtl/natmsg/msgid.c index db326d7f20..63160c984d 100644 --- a/harbour/source/rtl/natmsg/msgid.c +++ b/harbour/source/rtl/natmsg/msgid.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgko.c b/harbour/source/rtl/natmsg/msgko.c index b3fe18fddd..87de914f83 100644 --- a/harbour/source/rtl/natmsg/msgko.c +++ b/harbour/source/rtl/natmsg/msgko.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgnl.c b/harbour/source/rtl/natmsg/msgnl.c index 45f70ac4c6..89b7aef018 100644 --- a/harbour/source/rtl/natmsg/msgnl.c +++ b/harbour/source/rtl/natmsg/msgnl.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgru866.c b/harbour/source/rtl/natmsg/msgru866.c index a7e7bc620b..7877ffa547 100644 --- a/harbour/source/rtl/natmsg/msgru866.c +++ b/harbour/source/rtl/natmsg/msgru866.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgruwin.c b/harbour/source/rtl/natmsg/msgruwin.c index cacc3edec6..46d6736721 100644 --- a/harbour/source/rtl/natmsg/msgruwin.c +++ b/harbour/source/rtl/natmsg/msgruwin.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/rtl/natmsg/msgsr852.c b/harbour/source/rtl/natmsg/msgsr852.c index cfe0d8fa2b..e1c4cd9adb 100644 --- a/harbour/source/rtl/natmsg/msgsr852.c +++ b/harbour/source/rtl/natmsg/msgsr852.c @@ -70,7 +70,7 @@ char *hb_errorsGeneric[] = "", "", "Unsupported operation", - "Limit exeeded", + "Limit exceeded", "Index corruption detected", "Incorrect type of data", "Data width too long", diff --git a/harbour/source/tools/Makefile b/harbour/source/tools/Makefile index a368b64659..cb3049cd63 100644 --- a/harbour/source/tools/Makefile +++ b/harbour/source/tools/Makefile @@ -33,6 +33,7 @@ C_SOURCES=\ PRG_SOURCES=\ fileread.prg \ + nconvert.prg \ numtxthu.prg \ numtxten.prg \ stringp.prg \ diff --git a/harbour/source/tools/debug.c b/harbour/source/tools/debug.c index 78f8e0cb7b..c75ded3880 100644 --- a/harbour/source/tools/debug.c +++ b/harbour/source/tools/debug.c @@ -40,8 +40,6 @@ #include "extend.h" #include "itemapi.h" -PHB_ITEM ArrayClone( PHB_ITEM ); - /* $Doc$ * $FuncName$ __aStatic() * $Description$ Return the statics array diff --git a/harbour/source/tools/io.c b/harbour/source/tools/io.c index 99cb4d3b66..f65ba1e80e 100644 --- a/harbour/source/tools/io.c +++ b/harbour/source/tools/io.c @@ -122,9 +122,8 @@ HARBOUR HB_MD(void) HARBOUR HB_RD( void ) { - /* TOFIX: chdir() is wrong here */ #ifdef __DOS__ - hb_retni( ISCHAR( 1 ) ? chdir( hb_parc( 1 ) ) : 0 ); + hb_retni( ISCHAR( 1 ) ? rmdir( hb_parc( 1 ) ) : 0 ); #else hb_retni( 0 ); #endif diff --git a/harbour/source/tools/nconvert.prg b/harbour/source/tools/nconvert.prg new file mode 100644 index 0000000000..81e8881f44 --- /dev/null +++ b/harbour/source/tools/nconvert.prg @@ -0,0 +1,407 @@ +/* + * $Id$ + */ + +/* + Harbour Project source code + + Convertion Funtions + + Copyright (C) 1999 Luiz Rafael Culik + www - http://www.harbour-project.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version, with one exception: + + The exception is that if you link the Harbour Runtime Library (HRL) + and/or the Harbour Virtual Machine (HVM) with other files to produce + an executable, this does not by itself cause the resulting executable + to be covered by the GNU General Public License. Your use of that + executable is in no way restricted on account of linking the HRL + and/or HVM code into it. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + their web site at http://www.gnu.org/). +*/ + +/* $DOC$ + * $FUNCNAME$ + * ISBIN() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Check if the value is a Binary Number + * $SYNTAX$ + * ISBIN() -> + * + * $ARGUMENTS$ + * STRING TO BE CHECKED + * $RETURNS$ + * + * ^b .T.^b IF THE STRING IS BYNARY + * ^b .F.^b^ IF NOT + * $DESCRIPTION$ + * ^b check if the passed string is a bynary number or not + * $EXAMPLES$ + * + * $SEEALSO$ + * ISOCTAL() ISDEC() ISHEXA() + * $INCLUDE$ + * + * $END$ + */ + +FUNCTION IsBin(cString) + local nX,lFlag:=.t. + cString:=AllTrim(cString) + FOR nX:=1 to Len(cString) + IF !(SubStr(cString,nX,1) $"01") + lFlag:=.F. + EXIT + ENDIF + NEXT nX + RETURN(lFlag) + +/* $DOC$ + * $FUNCNAME$ + * ISOCTAL() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Check if the value is a Octal Number + * $SYNTAX$ + * ISOCTAL() -> + * + * $ARGUMENTS$ + * STRING TO BE CHECKED + * $RETURNS$ + * + * ^b .T.^b IF THE STRING IS OCTAL + * ^b .F.^b^ IF NOT + * + * $DESCRIPTION$ + * ^b check if the passed string is a octal number or not + * $EXAMPLES$ + * + * $SEEALSO$ + * ISBIN() ISDEC() ISHEXA() + * $INCLUDE$ + * + * $END$ + */ + +FUNCTION IsOctal(cString) + local nX,lFlag:=.t. + cString:=AllTrim(cString) + FOR nX:=1 to Len(cString) + if !(SubStr(cString,nX,1) $"01234567") + lFlag:=.f. + EXIT + ENDIF + NEXT nX + RETURN(lFlag) + +/* $DOC$ + * $FUNCNAME$ + * ISDEC() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Check if the value is a Decimal Number + * $SYNTAX$ + * ISDEC() -> + * + * $ARGUMENTS$ + * STRING TO BE CHECKED + * $RETURNS$ + * ^b .T.^b IF THE STRING IS DECIMAL + * ^b .F.^b^ IF NOT + * $DESCRIPTION$ + * ^b check if the passed string is a decimal number or not + * $EXAMPLES$ + * + * $SEEALSO$ + * ISOCTAL() ISBIN() ISHEXA() + * $INCLUDE$ + * + * $END$ + */ + +FUNCTION IsDec(cString) + local nX,lFlag:=.t. + cString:=AllTrim(cString) + FOR nX:=1 to Len(cString) + if !(SubStr(cString,nX,1) $"0123456789") + lFlag:=.f. + EXIT + ENDIF + NEXT nX + RETURN(lFlag) + +/* $DOC$ + * $FUNCNAME$ + * ISHEXA() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Check if the value is a Hexal Number + * $SYNTAX$ + * ISHEXA() -> + * + * $ARGUMENTS$ + * STRING TO BE CHECKED + * $RETURNS$ + * ^b .T.^b IF THE STRING IS HEXA + * ^b .F.^b^ IF NOT + * $DESCRIPTION$ + * ^b check if the passed string is a hexa number or not + * $EXAMPLES$ + * + * $SEEALSO$ + * ISOCTAL() ISDEC() ISBIN() + * $INCLUDE$ + * + * $END$ + */ + +FUNCTION IsHexa(cString) + local nX,lFlag:=.t. + cString:=AllTrim(cString) + FOR nX:=1 to Len(cString) + if !(SubStr(cString,nX,1) $"0123456789ABCDEF") + lFlag:=.f. + EXIT + ENDIF + NEXT nX + RETURN(lFlag) + +/* $DOC$ + * $FUNCNAME$ + * DECTOBIN() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Converts a Decimal Value to Binary + * $SYNTAX$ + * DECTOBIN() -> + * + * $ARGUMENTS$ + * NUMBER TO BE CONVERTED + * $RETURNS$ + * NUMBER CONVERTED + * $DESCRIPTION$ + * + * $EXAMPLES$ + * + * $SEEALSO$ + * + * $INCLUDE$ + * + * $END$ + */ + +FUNCTION DecToBin(nNumber) + local cNewString:='' + local nTemp:=0 + WHILE(nNumber > 0) + nTemp:=(nNumber%2) + cNewString:=SubStr('01',(nTemp+1),1)+cNewString + nNumber:=Int((nNumber-nTemp)/2) + ENDDO + RETURN(cNewString) + +/* $DOC$ + * $FUNCNAME$ + * DECTOOCTAL() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Converts a Decimal Value to Octal + * $SYNTAX$ + * DECTOOCTAL() -> + * + * $ARGUMENTS$ + * NUMBER TO BE CONVERTED + * $RETURNS$ + * NUMBER CONVERTED + * $DESCRIPTION$ + * + * $EXAMPLES$ + * + * $SEEALSO$ + * + * $INCLUDE$ + * + * $EnNumber$ + */ + +FUNCTION DecToOctal(nNumber) + local cNewString:='' + local nTemp:=0 + WHILE(nNumber > 0) + nTemp:=(nNumber%8) + cNewString:=SubStr('01234567',(nTemp+1),1)+cNewString + nNumber:=Int((nNumber-nTemp)/8) + ENDDO + RETURN(cNewString) + +/* $DOC$ + * $FUNCNAME$ + * DECTOHEXA() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Converts a Decimal Value to Hexa + * $SYNTAX$ + * DECTOHEXA() -> + * + * $ARGUMENTS$ + * NUMBER TO BE CONVERTED + * $RETURNS$ + * NUMBER CONVERTED + * $DESCRIPTION$ + * + * $EXAMPLES$ + * + * $SEEALSO$ + * + * $INCLUDE$ + * + * $EnNumber$ + */ + +FUNCTION DecToHexa(nNumber) + local cNewString:='' + local nTemp:=0 + WHILE(nNumber > 0) + nTemp:=(nNumber%16) + cNewString:=SubStr('0123456789ABCDEF',(nTemp+1),1)+cNewString + nNumber:=Int((nNumber-nTemp)/16) + ENDDO + RETURN(cNewString) + +/* $DOC$ + * $FUNCNAME$ + * BIntODEC() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Converts a Binary Value to Decimal + * $SYNTAX$ + * BIntODEC() -> + * + * $ARGUMENTS$ + * NUMBER TO BE CONVERTED + * $RETURNS$ + * NUMBER CONVERTED + * $DESCRIPTION$ + * + * $EXAMPLES$ + * + * $SEEALSO$ + * + * $INCLUDE$ + * + * $EnNumber$ + */ + +FUNCTION BinToDec(cString) + local nNumber:=0,nX:=0 + local cNewString:=AllTrim(cString) + local nLen:=Len(cNewString) + FOR nX:=1 to nLen + nNumber+=(At(SubStr(cNewString,nX,1),'01')-1)*; + (2**(nLen-nX)) + NEXT nX + RETURN(nNumber) + +/* $DOC$ + * $FUNCNAME$ + * OCTALTODEC() + * + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Converts a Octal Value to Decimal + * $SYNTAX$ + * OCTALTODEC() -> + * + * $ARGUMENTS$ + * NUMBER TO BE CONVERTED + * $RETURNS$ + * NUMBER CONVERTED + * $DESCRIPTION$ + * + * $EXAMPLES$ + * + * $SEEALSO$ + * + * $INCLUDE$ + * + * $EnNumber$ + */ + +FUNCTION OctalToDec(cString) + local nNumber:=0,nX:=0 + local cNewString:=AllTrim(cString) + local nLen:=Len(cNewString) + FOR nX:=1 to nLen + nNumber+=(At(SubStr(cNewString,nX,1),'01234567')-1)*; + (8**(nLen-nX)) + NEXT nX + RETURN(nNumber) + + +/* $DOC$ + * $FUNCNAME$ + * HEXATODEC() + * $CATEGORY$ + * Conversion + * $ONELINER$ + * Converts a Hexa Value to Decimal + * $SYNTAX$ + * HEXATODEC() -> + * + * $ARGUMENTS$ + * NUMBER TO BE CONVERTED + * $RETURNS$ + * NUMBER CONVERTED + * $DESCRIPTION$ + * + * $EXAMPLES$ + * + * $SEEALSO$ + * + * $INCLUDE$ + * + * $EnNumber$ + */ + +FUNCTION HexaToDec(cString) + local nNumber:=0,nX:=0 + local cNewString:=AllTrim(cString) + local nLen:=Len(cNewString) + FOR nX:=1 to nLen + nNumber+=(At(SubStr(cNewString,nX,1),'0123456789ABCDEF')-1)*; + (16**(nLen-nX)) + NEXT nX + RETURN nNumber + +* EOF: NCONVERT.PRG diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 9a01f0aea4..4a1dcd5125 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -36,18 +36,11 @@ #include "errorapi.h" #include "itemapi.h" #include "langapi.h" +#include "rddapi.h" #include "pcode.h" #include "set.h" #include "inkey.h" -extern void hb_consoleInitialize( void ); -extern void hb_consoleRelease( void ); -extern void InitSymbolTable( void ); /* initialization of runtime support symbols */ -extern int hb_rddGetCurrentWorkAreaNumber( void ); -extern void hb_rddSelectWorkAreaNumber( int iArea ); -extern void hb_rddGetFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol ); -extern void hb_rddPutFieldValue( HB_ITEM_PTR pItem, PHB_SYMB pFieldSymbol ); - typedef struct _SYMBOLS { PHB_SYMB pModuleSymbols; /* pointer to a one module own symbol table */ @@ -100,7 +93,7 @@ HB_ITEM aStatics; /* Harbour array to hold all application statics vari static BOOL bDebugging = FALSE; static BOOL bDebugShowLines = FALSE; /* update source code line on the debugger display */ static PHB_SYMB pSymStart; /* start symbol of the application. MAIN() is not required */ -static PSYMBOLS pSymbols = 0; /* to hold a linked list of all different modules symbol tables */ +static PSYMBOLS pSymbols = NULL; /* to hold a linked list of all different modules symbol tables */ static BYTE byErrorLevel = 0; /* application exit errorlevel */ /* Stores the position on the stack of current SEQUENCE envelope or 0 if no @@ -142,17 +135,16 @@ int main( int argc, char * argv[] ) errorBlock.type = IT_NIL; stack.Return.type = IT_NIL; + hb_xinit(); hb_stackInit(); hb_dynsymNew( &symEval ); /* initialize dynamic symbol for evaluating codeblocks */ hb_setInitialize(); /* initialize Sets */ hb_consoleInitialize(); /* initialize Console */ hb_memvarsInit(); #ifdef HARBOUR_OBJ_GENERATION - hb_vmProcessObjSymbols(); /* initialize Harbour generated OBJs symbols */ + hb_vmProcessObjSymbols(); /* initialize Harbour generated OBJs symbols */ #endif - - /* Initialize symbol table with runtime support functions */ - InitSymbolTable(); + hb_vmRTSymbolsInit(); /* initialize symbol table with runtime support functions */ /* Call functions that initializes static variables * Static variables have to be initialized before any INIT functions @@ -163,27 +155,21 @@ int main( int argc, char * argv[] ) #ifdef HARBOUR_START_PROCEDURE { - PHB_DYNS pDynSym =hb_dynsymFind( HARBOUR_START_PROCEDURE ); - if( pDynSym ) - pSymStart =pDynSym->pSymbol; - else - { - hb_errInternal( 9999, "Can\'t locate the starting procedure: \'%s\'", HARBOUR_START_PROCEDURE, NULL ); - } + PHB_DYNS pDynSym = hb_dynsymFind( HARBOUR_START_PROCEDURE ); + + if( pDynSym ) + pSymStart = pDynSym->pSymbol; + else + hb_errInternal( 9999, "Can\'t locate the starting procedure: \'%s\'", HARBOUR_START_PROCEDURE, NULL ); } #endif hb_vmPushSymbol( pSymStart ); /* pushes first FS_PUBLIC defined symbol to the stack */ - hb_vmPushNil(); /* places NIL at self */ - - for( i = 1; i < argc; i++ ) /* places application parameters on the stack */ + for( i = 1; i < argc; i++ ) /* places application parameters on the stack */ hb_vmPushString( argv[ i ], strlen( argv[ i ] ) ); - hb_vmDo( argc - 1 ); /* invoke it with number of supplied parameters */ - /* QUESTION: How to handle QUIT or BREAK in EXIT procedures? - */ wActionRequest = 0; /* EXIT procedures should be processed */ hb_vmDoExitFunctions(); /* process defined EXIT functions */ @@ -197,16 +183,10 @@ int main( int argc, char * argv[] ) hb_setRelease(); /* releases Sets */ hb_memvarsRelease(); hb_stackFree(); - /* hb_dynsymLog(); */ - HB_DEBUG( "Done!\n" ); +/* hb_dynsymLog(); */ + hb_xexit(); - if( ulMemoryBlocks ) - { - printf( "\n\ntotal memory blocks allocated: %lu\n", ulMemoryMaxBlocks ); - printf( "memory maximum size consumed: %ld\n", ulMemoryMaxConsumed ); - printf( "memory blocks not released: %ld\n", ulMemoryBlocks ); - printf( "memory size not released: %ld\n", ulMemoryConsumed ); - } + HB_DEBUG( "Done!\n" ); return byErrorLevel; } @@ -223,6 +203,7 @@ void hb_vmExecute( BYTE * pCode, PHB_SYMB pSymbols ) while( ( bCode = pCode[ w ] ) != HB_P_ENDPROC ) { hb_inkeyPoll(); /* Poll the console keyboard */ + switch( bCode ) { case HB_P_AND: @@ -877,9 +858,7 @@ void hb_vmAnd( void ) hb_vmPushLogical( bResult ); } else - { - hb_errRT_BASE(EG_ARG, 1078, NULL, ".AND."); - } + hb_errRT_BASE( EG_ARG, 1078, NULL, ".AND." ); } void hb_vmArrayAt( void ) @@ -959,9 +938,7 @@ void hb_vmDimArray( WORD wDimensions ) /* generates a wDimensions Array and init hb_arrayNew( &itArray, ( stack.pPos - wDimensions )->item.asLong.value ); if( wDimensions > 1 ) - { hb_errInternal( 9999, "HVM.C hb_vmDimArray() does not supports multiple dimensions yet", NULL, NULL ); - } /* for( w = 0; w < wElements; w++ ) @@ -1007,14 +984,14 @@ void hb_vmDo( WORD wParams ) if( ! IS_SYMBOL( pItem ) ) { /* QUESTION: Is this call needed ? [vszel] */ - hb_stackShow(); + hb_stackDispLocal(); hb_errInternal( 9999, "Symbol item expected as a base from hb_vmDo()", NULL, NULL ); } /* if( ! IS_NIL( pSelf ) ) { - hb_stackShow(); + hb_stackDispLocal(); hb_errInternal( 9999, "Invalid symbol type for self from hb_vmDo()", NULL, NULL ); } */ @@ -1034,18 +1011,17 @@ void hb_vmDo( WORD wParams ) pFunc = hb_objGetMethod( pSelf, pSym ); if( ! pFunc ) - { hb_errInternal( 9999, "Message %s not implemented for class %s", pSym->szName, hb_objGetClsName( pSelf ) ); - } + pFunc(); } else /* it is a function */ { pFunc = pSym->pFunPtr; + if( ! pFunc ) - { hb_errInternal( 9999, "Invalid function pointer (%s) from hb_vmDo()", pSym->szName, NULL ); - } + pFunc(); } @@ -1065,9 +1041,7 @@ HARBOUR hb_vmDoBlock( void ) int iParam; if( ! IS_BLOCK( pBlock ) ) - { hb_errInternal( 9999, "Codeblock expected from hb_vmDoBlock()", NULL, NULL ); - } /* Check for valid count of parameters */ iParam =pBlock->item.asBlock.paramcnt -hb_pcount(); @@ -1119,9 +1093,7 @@ HARBOUR HB_EVAL( void ) hb_vmDo( hb_pcount() - 1 ); } else - { hb_errInternal( 9999, "Not a valid codeblock on EVAL", NULL, NULL ); - } } void hb_vmEndBlock( void ) @@ -1146,7 +1118,7 @@ void hb_vmEqual( BOOL bExact ) hb_vmPushLogical( TRUE ); } - else if ( IS_NIL( pItem1 ) || IS_NIL( pItem2 ) ) + else if( IS_NIL( pItem1 ) || IS_NIL( pItem2 ) ) { hb_stackPop(); hb_stackPop(); @@ -1171,9 +1143,7 @@ void hb_vmEqual( BOOL bExact ) hb_vmOperatorCall( pItem1, pItem2, "==" ); else if( pItem1->type != pItem2->type ) - { - hb_errRT_BASE(EG_ARG, 1070, NULL, "=="); - } + hb_errRT_BASE( EG_ARG, 1070, NULL, "==" ); else hb_vmPushLogical( FALSE ); @@ -1202,9 +1172,7 @@ void hb_vmForTest( void ) /* Test to check the end point of the FOR */ hb_vmPushLogical( bEqual ); } else - { - hb_errRT_BASE(EG_ARG, 1073, NULL, "<"); - } + hb_errRT_BASE( EG_ARG, 1073, NULL, "<" ); } void hb_vmFrame( BYTE bLocals, BYTE bParams ) @@ -1227,9 +1195,7 @@ void hb_vmFuncPtr( void ) /* pushes a function address pointer. Removes the sym hb_vmPushLong( ( ULONG ) pItem->item.asSymbol.value->pFunPtr ); } else - { hb_errInternal( 9999, "Symbol item expected from hb_vmFuncPtr()", NULL, NULL ); - } } void hb_vmFunction( WORD wParams ) @@ -1298,9 +1264,7 @@ void hb_vmGreater( void ) hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, ">" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) - { - hb_errRT_BASE(EG_ARG, 1075, NULL, ">"); - } + hb_errRT_BASE( EG_ARG, 1075, NULL, ">" ); } void hb_vmGreaterEqual( void ) @@ -1343,9 +1307,7 @@ void hb_vmGreaterEqual( void ) hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, ">=" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) - { - hb_errRT_BASE(EG_ARG, 1076, NULL, ">="); - } + hb_errRT_BASE( EG_ARG, 1076, NULL, ">=" ); } void hb_vmInc( void ) @@ -1365,9 +1327,7 @@ void hb_vmInc( void ) hb_vmPushDate( ++lDate ); } else - { - hb_errRT_BASE(EG_ARG, 1086, NULL, "++"); - } + hb_errRT_BASE( EG_ARG, 1086, NULL, "++" ); } void hb_vmInstring( void ) @@ -1385,9 +1345,7 @@ void hb_vmInstring( void ) hb_vmPushLogical( iResult == 0 ? FALSE : TRUE ); } else - { - hb_errRT_BASE(EG_ARG, 1109, NULL, "$"); - } + hb_errRT_BASE( EG_ARG, 1109, NULL, "$" ); } void hb_vmLess( void ) @@ -1430,9 +1388,7 @@ void hb_vmLess( void ) hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, "<" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) - { - hb_errRT_BASE(EG_ARG, 1073, NULL, "<"); - } + hb_errRT_BASE( EG_ARG, 1073, NULL, "<" ); } void hb_vmLessEqual( void ) @@ -1475,9 +1431,7 @@ void hb_vmLessEqual( void ) hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, "<=" ); else if( ( stack.pPos - 2 )->type != ( stack.pPos - 1 )->type ) - { - hb_errRT_BASE(EG_ARG, 1074, NULL, "<="); - } + hb_errRT_BASE( EG_ARG, 1074, NULL, "<=" ); } void hb_vmLocalName( WORD wLocal, char * szLocalName ) /* locals and parameters index and name information for the debugger */ @@ -1516,7 +1470,7 @@ void hb_vmNot( void ) if( IS_LOGICAL( pItem ) ) pItem->item.asLogical.value = ! pItem->item.asLogical.value; else - hb_errRT_BASE(EG_ARG, 1077, NULL, ".NOT."); + hb_errRT_BASE( EG_ARG, 1077, NULL, ".NOT." ); } void hb_vmNotEqual( void ) @@ -1533,7 +1487,7 @@ void hb_vmNotEqual( void ) hb_vmPushLogical( FALSE ); } - else if ( IS_NIL( pItem1 ) || IS_NIL( pItem2 ) ) + else if( IS_NIL( pItem1 ) || IS_NIL( pItem2 ) ) { hb_stackPop(); hb_stackPop(); @@ -1558,9 +1512,7 @@ void hb_vmNotEqual( void ) hb_vmOperatorCall( pItem1, pItem2, "!=" ); else if( pItem1->type != pItem2->type ) - { - hb_errRT_BASE(EG_ARG, 1072, NULL, "<>"); - } + hb_errRT_BASE( EG_ARG, 1072, NULL, "<>" ); else hb_vmPushLogical( TRUE ); @@ -1608,7 +1560,7 @@ void hb_vmMinus( void ) memcpy( pItem1->item.asString.value + ulLen, pItem2->item.asString.value, pItem2->item.asString.length ); ulLen += pItem2->item.asString.length; memset( pItem1->item.asString.value + ulLen, ' ', pItem1->item.asString.length - ulLen); - pItem1->item.asString.value[ pItem1->item.asString.length ] = 0; + pItem1->item.asString.value[ pItem1->item.asString.length ] = '\0'; if( pItem2->item.asString.value ) { @@ -1621,8 +1573,7 @@ void hb_vmMinus( void ) else if( IS_OBJECT( stack.pPos - 2 ) && hb_objHasMsg( stack.pPos - 2, "-" ) ) hb_vmOperatorCall( stack.pPos - 2, stack.pPos - 1, "-" ); else - hb_errRT_BASE(EG_ARG, 1082, NULL, "-"); - + hb_errRT_BASE( EG_ARG, 1082, NULL, "-" ); } void hb_vmModuleName( char * szModuleName ) /* PRG and function name information for the debugger */ @@ -1677,9 +1628,7 @@ void hb_vmOr( void ) hb_vmPushLogical( bResult ); } else - { - hb_errRT_BASE(EG_ARG, 1079, NULL, ".OR."); - } + hb_errRT_BASE( EG_ARG, 1079, NULL, ".OR." ); } void hb_vmPlus( void ) @@ -1693,7 +1642,7 @@ void hb_vmPlus( void ) memcpy( pItem1->item.asString.value+ pItem1->item.asString.length, pItem2->item.asString.value, pItem2->item.asString.length ); pItem1->item.asString.length += pItem2->item.asString.length; - pItem1->item.asString.value[ pItem1->item.asString.length ] = 0; + pItem1->item.asString.value[ pItem1->item.asString.length ] = '\0'; if( pItem2->item.asString.value ) { hb_xfree( pItem2->item.asString.value ); @@ -1791,7 +1740,7 @@ static void hb_vmPopAliasedField( PHB_SYMB pSym ) hb_errRT_BASE( EG_BADALIAS, 1000, NULL, NULL ); break; } - + hb_rddPutFieldValue( stack.pPos - 2, pSym ); hb_rddSelectWorkAreaNumber( iCurrArea ); hb_stackPop(); /* field */ @@ -1809,17 +1758,17 @@ double hb_vmPopDouble( WORD *pwDec ) { case IT_INTEGER: dNumber = ( double ) stack.pPos->item.asInteger.value; - *pwDec =0; + *pwDec = 0; break; case IT_LONG: dNumber = ( double ) stack.pPos->item.asLong.value; - *pwDec =0; + *pwDec = 0; break; case IT_DOUBLE: dNumber = stack.pPos->item.asDouble.value; - *pwDec =stack.pPos->item.asDouble.decimal; + *pwDec = stack.pPos->item.asDouble.decimal; break; default: @@ -1877,7 +1826,7 @@ BOOL hb_vmPopLogical( void ) } else { - hb_errRT_BASE(EG_ARG, 1066, NULL, hb_langDGetErrorDesc(EG_CONDITION)); + hb_errRT_BASE( EG_ARG, 1066, NULL, hb_langDGetErrorDesc( EG_CONDITION ) ); return 0; } } @@ -2115,7 +2064,7 @@ void hb_vmPushString( char * szText, ULONG length ) char * szTemp = ( char * ) hb_xgrab( length + 1 ); memcpy (szTemp, szText, length); - szTemp[ length ] = 0; + szTemp[ length ] = '\0'; stack.pPos->type = IT_STRING; stack.pPos->item.asString.length = length; @@ -2152,11 +2101,11 @@ void hb_vmPushBlock( BYTE * pCode, PHB_SYMB pSymbols ) stack.pPos->type = IT_BLOCK; - wLocals =pCode[ 5 ] + ( pCode[ 6 ] * 256 ); + wLocals = pCode[ 5 ] + ( pCode[ 6 ] * 256 ); stack.pPos->item.asBlock.value = hb_codeblockNew( pCode + 7 + wLocals*2, /* pcode buffer */ - wLocals, /* number of referenced local variables */ - (WORD *)(pCode +7), /* table with referenced local variables */ + wLocals, /* number of referenced local variables */ + (WORD *)( pCode + 7 ), /* table with referenced local variables */ pSymbols ); /* store the statics base of function where the codeblock was defined @@ -2186,7 +2135,7 @@ void hb_vmPushDouble( double dNumber, WORD wDec ) stack.pPos->item.asDouble.value = dNumber; if( dNumber >= 10000000000.0 ) stack.pPos->item.asDouble.length = 20; else stack.pPos->item.asDouble.length = 10; - stack.pPos->item.asDouble.decimal = (wDec > 9) ? 9 : wDec; + stack.pPos->item.asDouble.decimal = ( wDec > 9 ) ? 9 : wDec; hb_stackPush(); HB_DEBUG( "hb_vmPushDouble\n" ); } @@ -2220,9 +2169,8 @@ void hb_vmRetValue( void ) void hb_stackPop( void ) { if( --stack.pPos < stack.pItems ) - { hb_errInternal( 9999, "Stack underflow", NULL, NULL ); - } + if( stack.pPos->type != IT_NIL ) hb_itemClear( stack.pPos ); } @@ -2230,9 +2178,7 @@ void hb_stackPop( void ) void hb_stackDec( void ) { if( --stack.pPos < stack.pItems ) - { hb_errInternal( 9999, "Stack underflow", NULL, NULL ); - } } void hb_stackFree( void ) @@ -2257,7 +2203,7 @@ void hb_stackPush( void ) BaseIndex = stack.pBase - stack.pItems; /* no, make more headroom: */ - /* hb_stackShow(); */ + /* hb_stackDispLocal(); */ stack.pItems = (PHB_ITEM)hb_xrealloc( stack.pItems, sizeof( HB_ITEM ) * ( stack.wItems + STACK_EXPANDHB_ITEMS ) ); @@ -2265,7 +2211,7 @@ void hb_stackPush( void ) stack.pPos = stack.pItems + CurrIndex; stack.pBase = stack.pItems + BaseIndex; stack.wItems += STACK_EXPANDHB_ITEMS; - /* hb_stackShow(); */ + /* hb_stackDispLocal(); */ } /* now, push it: */ @@ -2283,20 +2229,20 @@ void hb_stackInit( void ) HB_DEBUG( "hb_stackInit\n" ); } -void hb_stackShow( void ) +void hb_stackDispLocal( void ) { - PHB_ITEM p; + PHB_ITEM pBase; - for( p = stack.pBase; p <= stack.pPos; p++ ) + for( pBase = stack.pBase; pBase <= stack.pPos; pBase++ ) { - switch( p->type ) + switch( pBase->type ) { case IT_NIL: printf( "NIL " ); break; case IT_ARRAY: - if( p->item.asArray.value->wClass ) + if( pBase->item.asArray.value->wClass ) printf( "OBJECT " ); else printf( "ARRAY " ); @@ -2315,7 +2261,7 @@ void hb_stackShow( void ) break; case IT_LOGICAL: - printf( "LOGICAL[%i] ", (int) p->item.asLogical.value ); + printf( "LOGICAL[%c] ", pBase->item.asLogical.value ? 'T' : 'F' ); break; case IT_LONG: @@ -2323,7 +2269,7 @@ void hb_stackShow( void ) break; case IT_INTEGER: - printf( "INTEGER[%i] ", p->item.asInteger.value ); + printf( "INTEGER[%i] ", pBase->item.asInteger.value ); break; case IT_STRING: @@ -2331,15 +2277,37 @@ void hb_stackShow( void ) break; case IT_SYMBOL: - printf( "SYMBOL(%s) ", p->item.asSymbol.value->szName ); + printf( "SYMBOL(%s) ", pBase->item.asSymbol.value->szName ); break; default: - printf( "UNKNOWN[%i] ", p->type ); + printf( "UNKNOWN[%i] ", pBase->type ); break; } } - printf( "\n" ); + + printf( hb_consoleGetNewLine() ); +} + +void hb_stackDispCall( void ) +{ + PHB_ITEM pBase = stack.pBase; + + while( pBase != stack.pItems ) + { + pBase = stack.pItems + pBase->item.asSymbol.stackbase; + + if( ( pBase + 1 )->type == IT_ARRAY ) + printf( "Called from %s:%s(%i)", hb_objGetClsName( pBase + 1 ), + pBase->item.asSymbol.value->szName, + pBase->item.asSymbol.lineno ); + else + printf( "Called from %s(%i)", + pBase->item.asSymbol.value->szName, + pBase->item.asSymbol.lineno ); + + printf( hb_consoleGetNewLine() ); + } } void hb_vmSFrame( PHB_SYMB pSym ) /* sets the statics frame for a function */ @@ -2355,7 +2323,7 @@ void hb_vmStatics( PHB_SYMB pSym ) /* initializes the global aStatics array or r if( IS_NIL( &aStatics ) ) { - pSym->pFunPtr = 0; /* statics frame for this PRG */ + pSym->pFunPtr = NULL; /* statics frame for this PRG */ hb_arrayNew( &aStatics, wStatics ); } else @@ -2374,11 +2342,11 @@ void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* modu SYMBOLSCOPE hSymScope; #ifdef HARBOUR_OBJ_GENERATION - static int iObjChecked = 0; + static BOOL bObjChecked = FALSE; - if( ! iObjChecked ) + if( ! bObjChecked ) { - iObjChecked = 1; + bObjChecked = TRUE; hb_vmProcessObjSymbols(); /* to asure Harbour OBJ symbols are processed first */ } #endif @@ -2386,8 +2354,8 @@ void hb_vmProcessSymbols( PHB_SYMB pModuleSymbols, WORD wModuleSymbols ) /* modu pNewSymbols = ( PSYMBOLS ) hb_xgrab( sizeof( SYMBOLS ) ); pNewSymbols->pModuleSymbols = pModuleSymbols; pNewSymbols->wModuleSymbols = wModuleSymbols; - pNewSymbols->pNext = 0; - pNewSymbols->hScope =0; + pNewSymbols->pNext = NULL; + pNewSymbols->hScope = 0; if( ! pSymbols ) pSymbols = pNewSymbols; @@ -2416,11 +2384,11 @@ static void hb_vmProcessObjSymbols( void ) { POBJSYMBOLS pObjSymbols = ( POBJSYMBOLS ) &HB_FIRSTSYMBOL; - static int iDone = 0; + static BOOL bDone = FALSE; - if( ! iDone ) + if( ! bDone ) { - iDone = 1; + bDone = TRUE; while( pObjSymbols < ( POBJSYMBOLS ) ( &HB_LASTSYMBOL - 1 ) ) { hb_vmProcessSymbols( pObjSymbols->pSymbols, pObjSymbols->wSymbols ); @@ -2494,10 +2462,10 @@ static void hb_vmDoExitFunctions( void ) hb_vmPushSymbol( pLastSymbols->pModuleSymbols + w ); hb_vmPushNil(); hb_vmDo( 0 ); - if( wActionRequest ) - /* QUIT or BREAK was issued - stop processing - */ - return; + if( wActionRequest ) + /* QUIT or BREAK was issued - stop processing + */ + return; } } } @@ -2548,11 +2516,11 @@ void hb_vmForceLink( void ) HARBOUR HB_LEN( void ) { - PHB_ITEM pItem; - - if( hb_pcount() ) + if( hb_pcount() == 1 ) { - pItem = hb_param( 1, IT_ANY ); + PHB_ITEM pItem = hb_param( 1, IT_ANY ); + + /* NOTE: pItem cannot be NULL here */ switch( pItem->type ) { @@ -2565,20 +2533,22 @@ HARBOUR HB_LEN( void ) break; default: - hb_errRT_BASE(EG_ARG, 1111, NULL, "LEN"); + hb_errRT_BASE( EG_ARG, 1111, NULL, "LEN" ); break; } } else - hb_retni( 0 ); /* QUESTION: Should we raise an error here ? */ + hb_errRT_BASE( EG_ARGCOUNT, 3000, NULL, "LEN" ); /* NOTE: Clipper catches this at compile time! */ } HARBOUR HB_EMPTY(void) { - PHB_ITEM pItem = hb_param( 1, IT_ANY ); - - if( pItem ) + if( hb_pcount() == 1 ) { + PHB_ITEM pItem = hb_param( 1, IT_ANY ); + + /* NOTE: pItem cannot be NULL here */ + switch( pItem->type & ~IT_BYREF ) { case IT_ARRAY: @@ -2619,16 +2589,16 @@ HARBOUR HB_EMPTY(void) } } else - hb_retl( TRUE ); + hb_errRT_BASE( EG_ARGCOUNT, 3000, NULL, "EMPTY" ); /* NOTE: Clipper catches this at compile time! */ } HARBOUR HB_VALTYPE( void ) { - PHB_ITEM pItem; - if( hb_pcount() == 1 ) { - pItem = hb_param( 1, IT_ANY ); + PHB_ITEM pItem = hb_param( 1, IT_ANY ); + + /* NOTE: pItem cannot be NULL here */ switch( pItem->type & ~IT_BYREF ) { @@ -2668,10 +2638,7 @@ HARBOUR HB_VALTYPE( void ) } } else - { - /* QUESTION: Clipper catches this at compile time! */ - hb_errRT_BASE(EG_ARGCOUNT, 3000, NULL, "VALTYPE"); - } + hb_errRT_BASE( EG_ARGCOUNT, 3000, NULL, "VALTYPE" ); /* NOTE: Clipper catches this at compile time! */ } HARBOUR HB_ERRORBLOCK(void) @@ -2689,23 +2656,6 @@ HARBOUR HB_ERRORBLOCK(void) hb_itemClear( &oldError ); } -void hb_callStackShow( void ) -{ - PHB_ITEM pBase = stack.pBase; - - while( pBase != stack.pItems ) - { - pBase = stack.pItems + pBase->item.asSymbol.stackbase; - if( ( pBase + 1 )->type == IT_ARRAY ) - printf( "Called from %s:%s(%i)\n", hb_objGetClsName( pBase + 1 ), - pBase->item.asSymbol.value->szName, - pBase->item.asSymbol.lineno ); - else - printf( "Called from %s(%i)\n", pBase->item.asSymbol.value->szName, - pBase->item.asSymbol.lineno ); - } -} - HARBOUR HB_PROCNAME(void) { int iLevel = hb_parni( 1 ) + 1; /* we are already inside ProcName() */ @@ -2771,10 +2721,15 @@ HARBOUR HB_ERRORLEVEL(void) HARBOUR HB_PCOUNT(void) { - PHB_ITEM pBase = stack.pItems + stack.pBase->item.asSymbol.stackbase; - WORD wRet = pBase->item.asSymbol.paramcnt; /* Skip current function */ + if( hb_pcount() == 0 ) + { + PHB_ITEM pBase = stack.pItems + stack.pBase->item.asSymbol.stackbase; + WORD wRet = pBase->item.asSymbol.paramcnt; /* Skip current function */ - hb_retni( wRet ); + hb_retni( wRet ); + } + else + hb_errRT_BASE( EG_ARGCOUNT, 3000, NULL, "PCOUNT" ); /* NOTE: Clipper catches this at compile time! */ } HARBOUR HB_PVALUE(void) /* PValue( ) */ @@ -2786,9 +2741,7 @@ HARBOUR HB_PVALUE(void) /* PValue( ) if( wParam && wParam <= pBase->item.asSymbol.paramcnt ) /* Valid number */ hb_itemReturn( pBase + 1 + wParam ); else - { - hb_errRT_BASE(EG_ARG, 3011, NULL, "PVALUE"); - } + hb_errRT_BASE( EG_ARG, 3011, NULL, "PVALUE" ); } void hb_vmRequestBreak( PHB_ITEM pItem ) @@ -2803,6 +2756,11 @@ void hb_vmRequestBreak( PHB_ITEM pItem ) wActionRequest = HB_QUIT_REQUESTED; } +/* NOTE: This function should normally have a parameter count check. But + since in Harbour we cannot distinguish between BREAK() function and + the BREAK statement, because both generate a BREAK() function + call on the pcode level, we should drop the checking. */ + HARBOUR HB_BREAK( void ) { hb_vmRequestBreak( hb_param( 1, IT_ANY ) ); diff --git a/harbour/source/vm/initsymb.c b/harbour/source/vm/initsymb.c index 7c5074bb74..dfb1e4ee80 100644 --- a/harbour/source/vm/initsymb.c +++ b/harbour/source/vm/initsymb.c @@ -57,78 +57,78 @@ extern HARBOUR HB_VAL( void ); extern HARBOUR HB_YEAR( void ); static HB_SYMB symbols[] = { - { "AADD" , FS_PUBLIC, HB_AADD , 0 }, - { "ABS" , FS_PUBLIC, HB_ABS , 0 }, - { "ASC" , FS_PUBLIC, HB_ASC , 0 }, - { "AT" , FS_PUBLIC, HB_AT , 0 }, - { "BOF" , FS_PUBLIC, NULL , 0 }, - { "BREAK" , FS_PUBLIC, NULL , 0 }, - { "CDOW" , FS_PUBLIC, HB_CDOW , 0 }, - { "CHR" , FS_PUBLIC, HB_CHR , 0 }, - { "CMONTH" , FS_PUBLIC, HB_CMONTH , 0 }, - { "COL" , FS_PUBLIC, HB_COL , 0 }, - { "CTOD" , FS_PUBLIC, HB_CTOD , 0 }, - { "DATE" , FS_PUBLIC, HB_DATE , 0 }, - { "DAY" , FS_PUBLIC, HB_DAY , 0 }, - { "DELETED" , FS_PUBLIC, NULL , 0 }, - { "DEVPOS" , FS_PUBLIC, HB_DEVPOS , 0 }, - { "DOW" , FS_PUBLIC, HB_DOW , 0 }, - { "DTOC" , FS_PUBLIC, HB_DTOC , 0 }, - { "DTOS" , FS_PUBLIC, HB_DTOS , 0 }, - { "EMPTY" , FS_PUBLIC, HB_EMPTY , 0 }, - { "EOF" , FS_PUBLIC, NULL , 0 }, - { "EXP" , FS_PUBLIC, HB_EXP , 0 }, - { "FCOUNT" , FS_PUBLIC, NULL , 0 }, - { "FIELDNAME" , FS_PUBLIC, NULL , 0 }, - { "FLOCK" , FS_PUBLIC, NULL , 0 }, - { "FOUND" , FS_PUBLIC, NULL , 0 }, - { "INKEY" , FS_PUBLIC, HB_INKEY , 0 }, - { "INT" , FS_PUBLIC, HB_INT , 0 }, - { "LASTREC" , FS_PUBLIC, NULL , 0 }, - { "LEFT" , FS_PUBLIC, HB_LEFT , 0 }, - { "LEN" , FS_PUBLIC, HB_LEN , 0 }, - { "LOCK" , FS_PUBLIC, NULL , 0 }, - { "LOG" , FS_PUBLIC, HB_LOG , 0 }, - { "LOWER" , FS_PUBLIC, HB_LOWER , 0 }, - { "LTRIM" , FS_PUBLIC, HB_LTRIM , 0 }, - { "MAX" , FS_PUBLIC, HB_MAX , 0 }, - { "MIN" , FS_PUBLIC, HB_MIN , 0 }, - { "MONTH" , FS_PUBLIC, HB_MONTH , 0 }, - { "PCOL" , FS_PUBLIC, HB_PCOL , 0 }, - { "PCOUNT" , FS_PUBLIC, HB_PCOUNT , 0 }, - { "PROW" , FS_PUBLIC, HB_PROW , 0 }, - { "QSELF" , FS_PUBLIC, NULL , 0 }, - { "RECCOUNT" , FS_PUBLIC, NULL , 0 }, - { "RECNO" , FS_PUBLIC, NULL , 0 }, - { "REPLICATE" , FS_PUBLIC, HB_REPLICATE , 0 }, - { "RLOCK" , FS_PUBLIC, NULL , 0 }, - { "ROUND" , FS_PUBLIC, HB_ROUND , 0 }, - { "ROW" , FS_PUBLIC, HB_ROW , 0 }, - { "RTRIM" , FS_PUBLIC, HB_RTRIM , 0 }, - { "SECONDS" , FS_PUBLIC, HB_SECONDS , 0 }, - { "SELECT" , FS_PUBLIC, NULL , 0 }, - { "SETPOS" , FS_PUBLIC, HB_SETPOS , 0 }, - { "SPACE" , FS_PUBLIC, HB_SPACE , 0 }, - { "SQRT" , FS_PUBLIC, HB_SQRT , 0 }, - { "STR" , FS_PUBLIC, HB_STR , 0 }, - { "SUBSTR" , FS_PUBLIC, HB_SUBSTR , 0 }, - { "TIME" , FS_PUBLIC, HB_TIME , 0 }, - { "TRANSFORM" , FS_PUBLIC, HB_TRANSFORM , 0 }, - { "TRIM" , FS_PUBLIC, HB_TRIM , 0 }, - { "TYPE" , FS_PUBLIC, NULL , 0 }, - { "UPPER" , FS_PUBLIC, HB_UPPER , 0 }, - { "VAL" , FS_PUBLIC, HB_VAL , 0 }, - { "WORD" , FS_PUBLIC, NULL , 0 }, - { "YEAR" , FS_PUBLIC, HB_YEAR , 0 } - }; + { "AADD" , FS_PUBLIC, HB_AADD , 0 }, + { "ABS" , FS_PUBLIC, HB_ABS , 0 }, + { "ASC" , FS_PUBLIC, HB_ASC , 0 }, + { "AT" , FS_PUBLIC, HB_AT , 0 }, + { "BOF" , FS_PUBLIC, NULL , 0 }, + { "BREAK" , FS_PUBLIC, NULL , 0 }, + { "CDOW" , FS_PUBLIC, HB_CDOW , 0 }, + { "CHR" , FS_PUBLIC, HB_CHR , 0 }, + { "CMONTH" , FS_PUBLIC, HB_CMONTH , 0 }, + { "COL" , FS_PUBLIC, HB_COL , 0 }, + { "CTOD" , FS_PUBLIC, HB_CTOD , 0 }, + { "DATE" , FS_PUBLIC, HB_DATE , 0 }, + { "DAY" , FS_PUBLIC, HB_DAY , 0 }, + { "DELETED" , FS_PUBLIC, NULL , 0 }, + { "DEVPOS" , FS_PUBLIC, HB_DEVPOS , 0 }, + { "DOW" , FS_PUBLIC, HB_DOW , 0 }, + { "DTOC" , FS_PUBLIC, HB_DTOC , 0 }, + { "DTOS" , FS_PUBLIC, HB_DTOS , 0 }, + { "EMPTY" , FS_PUBLIC, HB_EMPTY , 0 }, + { "EOF" , FS_PUBLIC, NULL , 0 }, + { "EXP" , FS_PUBLIC, HB_EXP , 0 }, + { "FCOUNT" , FS_PUBLIC, NULL , 0 }, + { "FIELDNAME" , FS_PUBLIC, NULL , 0 }, + { "FLOCK" , FS_PUBLIC, NULL , 0 }, + { "FOUND" , FS_PUBLIC, NULL , 0 }, + { "INKEY" , FS_PUBLIC, HB_INKEY , 0 }, + { "INT" , FS_PUBLIC, HB_INT , 0 }, + { "LASTREC" , FS_PUBLIC, NULL , 0 }, + { "LEFT" , FS_PUBLIC, HB_LEFT , 0 }, + { "LEN" , FS_PUBLIC, HB_LEN , 0 }, + { "LOCK" , FS_PUBLIC, NULL , 0 }, + { "LOG" , FS_PUBLIC, HB_LOG , 0 }, + { "LOWER" , FS_PUBLIC, HB_LOWER , 0 }, + { "LTRIM" , FS_PUBLIC, HB_LTRIM , 0 }, + { "MAX" , FS_PUBLIC, HB_MAX , 0 }, + { "MIN" , FS_PUBLIC, HB_MIN , 0 }, + { "MONTH" , FS_PUBLIC, HB_MONTH , 0 }, + { "PCOL" , FS_PUBLIC, HB_PCOL , 0 }, + { "PCOUNT" , FS_PUBLIC, HB_PCOUNT , 0 }, + { "PROW" , FS_PUBLIC, HB_PROW , 0 }, + { "QSELF" , FS_PUBLIC, NULL , 0 }, + { "RECCOUNT" , FS_PUBLIC, NULL , 0 }, + { "RECNO" , FS_PUBLIC, NULL , 0 }, + { "REPLICATE" , FS_PUBLIC, HB_REPLICATE , 0 }, + { "RLOCK" , FS_PUBLIC, NULL , 0 }, + { "ROUND" , FS_PUBLIC, HB_ROUND , 0 }, + { "ROW" , FS_PUBLIC, HB_ROW , 0 }, + { "RTRIM" , FS_PUBLIC, HB_RTRIM , 0 }, + { "SECONDS" , FS_PUBLIC, HB_SECONDS , 0 }, + { "SELECT" , FS_PUBLIC, NULL , 0 }, + { "SETPOS" , FS_PUBLIC, HB_SETPOS , 0 }, + { "SPACE" , FS_PUBLIC, HB_SPACE , 0 }, + { "SQRT" , FS_PUBLIC, HB_SQRT , 0 }, + { "STR" , FS_PUBLIC, HB_STR , 0 }, + { "SUBSTR" , FS_PUBLIC, HB_SUBSTR , 0 }, + { "TIME" , FS_PUBLIC, HB_TIME , 0 }, + { "TRANSFORM" , FS_PUBLIC, HB_TRANSFORM , 0 }, + { "TRIM" , FS_PUBLIC, HB_TRIM , 0 }, + { "TYPE" , FS_PUBLIC, NULL , 0 }, + { "UPPER" , FS_PUBLIC, HB_UPPER , 0 }, + { "VAL" , FS_PUBLIC, HB_VAL , 0 }, + { "WORD" , FS_PUBLIC, NULL , 0 }, + { "YEAR" , FS_PUBLIC, HB_YEAR , 0 } +}; -/* - * Registers runtime support functions symbols - */ -void InitSymbolTable( void ) +/* Registers runtime support functions symbols */ + +/* NOTE: The system symbol table with runtime functions HAVE TO be called + last */ + +void hb_vmRTSymbolsInit( void ) { - /* - * The system symbol table with runtime functions HAVE TO be called last - */ - hb_vmProcessSymbols( symbols, sizeof(symbols)/sizeof( HB_SYMB ) ); + hb_vmProcessSymbols( symbols, sizeof(symbols) / sizeof( HB_SYMB ) ); } +