19990826-05:00 GMT+1

This commit is contained in:
Viktor Szakats
1999-08-27 03:34:53 +00:00
parent 306b09b507
commit 37c3041e7e
53 changed files with 1630 additions and 1129 deletions

View File

@@ -1,3 +1,100 @@
19990826-05:00 GMT+1 Victor Szel <info@szelvesz.hu>
* 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 <dezac@corevia.com>.
* 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 <Culik@sl.conex.net>.
19990826-22:00 EDT Paul Tucker <ptucker@sympatico.ca>
* include/hbsetup.h
+ add mouse driver selector defines

View File

@@ -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

View File

@@ -26,6 +26,7 @@ C_HEADERS=\
inkey.h \
itemapi.h \
langapi.h \
mouseapi.h \
pcode.h \
rddapi.h \
run_exp.h \

View File

@@ -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

View File

@@ -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_ */

View File

@@ -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_ */

View File

@@ -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 );

View File

@@ -12,25 +12,25 @@
#include <limits.h>
#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 <os2.h>
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 <os2.h>
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_ */

View File

@@ -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_ */

View File

@@ -0,0 +1,72 @@
/*
* $Id$
*/
/*
Harbour Project source code
Harbour Mouse subsystem header
Copyright 1999 Victor Szel <info@szelvesz.hu>
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_ */

View File

@@ -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 */

View File

@@ -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;

View File

@@ -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() );
}
}

View File

@@ -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" );
}
}

View File

@@ -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=\

View File

@@ -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

View File

@@ -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 );
}

View File

@@ -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;

View File

@@ -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 <malloc.h>
#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
}

View File

@@ -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

View File

@@ -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--;

View File

@@ -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;
}

View File

@@ -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 <dos.h>
#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$
* <var>:=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);
}

View File

@@ -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,&regs,&regs);
/*
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,&regs,&regs);
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;
}

View File

@@ -1,8 +1,10 @@
/*
* $Id:
* $Id$
*/
/*
Harbour Project source code
Harbour mouse subsystem for OS/2 compilers.
Copyright 1999 by Chen Kedem <niki@actcom.co.il>
@@ -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.
*/
}

View File

@@ -1,12 +1,19 @@
/*
* $Id$
*/
/*
Harbour Project source code
Harbour mouse support
Harbour Mouse Subsystem Template
Copyright 1999 Victor Szel <info@szelvesz.hu>
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)
{
}

View File

@@ -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 );
}

View File

@@ -0,0 +1,272 @@
/*
* $Id$
*/
/*
Harbour Project source code
Harbour Mouse subsystem main file
Copyright 1999 Victor Szel <info@szelvesz.hu>
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 );
}

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"šŽš<EFBFBD><>‰€ š€† „Œ…’”",
"Limit exeeded",
"Limit exceeded",
"<EFBFBD>‰—š €Œ …€ ™<>…™Ž <E28098>‰€",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"פעולה זאת אינה נתמכת",
"Limit exeeded",
"Limit exceeded",
"אינקס משובש או לא תקין",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -70,7 +70,7 @@ char *hb_errorsGeneric[] =
"",
"",
"Unsupported operation",
"Limit exeeded",
"Limit exceeded",
"Index corruption detected",
"Incorrect type of data",
"Data width too long",

View File

@@ -33,6 +33,7 @@ C_SOURCES=\
PRG_SOURCES=\
fileread.prg \
nconvert.prg \
numtxthu.prg \
numtxten.prg \
stringp.prg \

View File

@@ -40,8 +40,6 @@
#include "extend.h"
#include "itemapi.h"
PHB_ITEM ArrayClone( PHB_ITEM );
/* $Doc$
* $FuncName$ <aStat> __aStatic()
* $Description$ Return the statics array

View File

@@ -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

View File

@@ -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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> NUMBER TO BE CONVERTED
* $RETURNS$
* <CNR> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> NUMBER TO BE CONVERTED
* $RETURNS$
* <CNR> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> NUMBER TO BE CONVERTED
* $RETURNS$
* <CNR> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> NUMBER TO BE CONVERTED
* $RETURNS$
* <CNR> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> NUMBER TO BE CONVERTED
* $RETURNS$
* <CNR> 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(<CN>) -><CNR>
*
* $ARGUMENTS$
* <CN> NUMBER TO BE CONVERTED
* $RETURNS$
* <CNR> 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

View File

@@ -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( <nArg> ) */
@@ -2786,9 +2741,7 @@ HARBOUR HB_PVALUE(void) /* PValue( <nArg> )
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 ) );

View File

@@ -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 ) );
}