2006-02-12 14:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapi.h
* harbour/include/hbdefs.h
* cleaned BOOL usage
* harbour/include/hbcomp.h
* harbour/include/hbpp.h
* harbour/source/compiler/harbour.l
* harbour/source/compiler/harbour.sly
* harbour/source/compiler/harbour.y
* harbour/source/pp/ppcomp.c
* harbour/source/pp/ppcore.c
* harbour/source/pp/pplib.c
* harbour/source/pp/pragma.c
* keep functions and public variables definitions in header files.
Do not use any extern ... in source code to aviod possible mistakes
! fixed some mistakes in BOOL/int declarations
* use hb_fsFreeSearchPath() to free allocated path list
* harbour/source/compiler/harbour.c
* keep functions and public variables definitions in header files.
+ added memory statistic module - it's disabled now because too
much errors is reported.
Ryszard I hope it will help in locating memory leaks in compiler.
* begun of cleaning static variables to make compiler code
ready for reentrance.
* harbour/source/rtl/gtstd/gtstd.c
! fixed cursor positioning
* harbour/config/os2/gcc.cf
+ added socket library
+ harbour/tests/ctwtest.prg
+ added CTWIN test program
+ harbour/contrib/dot/Makefile
+ added GNU Makefile
This commit is contained in:
@@ -8,6 +8,45 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
* fixed <-x-> match marker
|
||||
2006-02-12 14:33 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbapi.h
|
||||
* harbour/include/hbdefs.h
|
||||
* cleaned BOOL usage
|
||||
|
||||
* harbour/include/hbcomp.h
|
||||
* harbour/include/hbpp.h
|
||||
* harbour/source/compiler/harbour.l
|
||||
* harbour/source/compiler/harbour.sly
|
||||
* harbour/source/compiler/harbour.y
|
||||
* harbour/source/pp/ppcomp.c
|
||||
* harbour/source/pp/ppcore.c
|
||||
* harbour/source/pp/pplib.c
|
||||
* harbour/source/pp/pragma.c
|
||||
* keep functions and public variables definitions in header files.
|
||||
Do not use any extern ... in source code to aviod possible mistakes
|
||||
! fixed some mistakes in BOOL/int declarations
|
||||
* use hb_fsFreeSearchPath() to free allocated path list
|
||||
|
||||
* harbour/source/compiler/harbour.c
|
||||
* keep functions and public variables definitions in header files.
|
||||
+ added memory statistic module - it's disabled now because too
|
||||
much errors is reported.
|
||||
Ryszard I hope it will help in locating memory leaks in compiler.
|
||||
* begun of cleaning static variables to make compiler code
|
||||
ready for reentrance.
|
||||
|
||||
* harbour/source/rtl/gtstd/gtstd.c
|
||||
! fixed cursor positioning
|
||||
|
||||
* harbour/config/os2/gcc.cf
|
||||
+ added socket library
|
||||
|
||||
+ harbour/tests/ctwtest.prg
|
||||
+ added CTWIN test program
|
||||
|
||||
+ harbour/contrib/dot/Makefile
|
||||
+ added GNU Makefile
|
||||
|
||||
2006-02-12 11:15 UTC+0100 Antonio Linares <alinares@fivetechsoft.com>
|
||||
* harbour/include/hbdefs.h
|
||||
* minor fix to avoid conflict with Darwin and Cocoa BOOL use
|
||||
|
||||
@@ -51,7 +51,7 @@ ifeq ($(findstring rdd,$(LIBS)),rdd)
|
||||
LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$(HB_ARCH))
|
||||
LINKLIBS += $(foreach drv, $(HB_DB_DRIVERS), -l$(drv))
|
||||
# add a last round of rtl/vm to solve positional interdependencies (at the moment hbrun requires this)
|
||||
LINKLIBS += -lrtl -lvm
|
||||
LINKLIBS += -lrtl -lvm -lrtl
|
||||
endif
|
||||
|
||||
# Add the specified GT driver library
|
||||
@@ -70,6 +70,9 @@ endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# add socket library
|
||||
LINKLIBS += -lsocket
|
||||
|
||||
#LINKLIBS += -Wl,-)
|
||||
# statical linking with GCC 3.2.2 libc as not require its presence on user system
|
||||
LDFLAGS += $(LINKPATHS)
|
||||
|
||||
36
harbour/contrib/dot/Makefile
Normal file
36
harbour/contrib/dot/Makefile
Normal file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
ifeq ($(HB_MAIN),)
|
||||
HB_MAIN = std
|
||||
endif
|
||||
|
||||
ROOT = ../../
|
||||
|
||||
PRG_SOURCES=\
|
||||
pp.prg \
|
||||
|
||||
PRG_MAIN=pp.prg
|
||||
|
||||
PRG_HEADERS = \
|
||||
rp_dot.src \
|
||||
rp_run.src \
|
||||
|
||||
LIBS=\
|
||||
debug \
|
||||
vm \
|
||||
rtl \
|
||||
lang \
|
||||
rdd \
|
||||
macro \
|
||||
pp \
|
||||
common \
|
||||
|
||||
include $(TOP)$(ROOT)config/header.cf
|
||||
INSTALL_RULE_HEADERS := $(INSTALL_RULE)
|
||||
|
||||
include $(TOP)$(ROOT)config/bin.cf
|
||||
|
||||
install::
|
||||
$(INSTALL_RULE_HEADERS)
|
||||
@@ -93,13 +93,13 @@ HB_EXTERN_BEGIN
|
||||
#define HB_IT_OBJECT HB_IT_ARRAY
|
||||
#define HB_IT_NUMERIC ( ( HB_TYPE ) ( HB_IT_INTEGER | HB_IT_LONG | HB_IT_DOUBLE ) )
|
||||
#define HB_IT_NUMINT ( ( HB_TYPE ) ( HB_IT_INTEGER | HB_IT_LONG ) )
|
||||
#define HB_IT_ANY ( ( HB_TYPE ) 0xFFFF )
|
||||
#define HB_IT_ANY ( ( HB_TYPE ) 0xFFFFFFFF )
|
||||
#define HB_IT_COMPLEX ( ( HB_TYPE ) ( HB_IT_STRING | HB_IT_BLOCK | HB_IT_ARRAY | HB_IT_MEMVAR | HB_IT_BYREF ) )
|
||||
#define HB_IT_GCITEM ( ( HB_TYPE ) ( HB_IT_BLOCK | HB_IT_ARRAY | HB_IT_POINTER | HB_IT_BYREF ) )
|
||||
|
||||
#define HB_IS_OF_TYPE( p, t ) ( ( HB_ITEM_TYPE( p ) & ~HB_IT_BYREF ) == t )
|
||||
|
||||
#define HB_IS_BYREF( p ) ( HB_ITEM_TYPE( p ) & HB_IT_BYREF )
|
||||
#define HB_IS_BYREF( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_BYREF ) != 0 )
|
||||
#define HB_IS_ARRAY( p ) HB_IS_OF_TYPE( p, HB_IT_ARRAY )
|
||||
#define HB_IS_NIL( p ) HB_IS_OF_TYPE( p, HB_IT_NIL )
|
||||
#define HB_IS_BLOCK( p ) HB_IS_OF_TYPE( p, HB_IT_BLOCK )
|
||||
@@ -114,12 +114,12 @@ HB_EXTERN_BEGIN
|
||||
#define HB_IS_SYMBOL( p ) HB_IS_OF_TYPE( p, HB_IT_SYMBOL )
|
||||
#define HB_IS_MEMVAR( p ) HB_IS_OF_TYPE( p, HB_IT_MEMVAR )
|
||||
#define HB_IS_POINTER( p ) HB_IS_OF_TYPE( p, HB_IT_POINTER )
|
||||
#define HB_IS_NUMERIC( p ) ( HB_ITEM_TYPE( p ) & HB_IT_NUMERIC )
|
||||
#define HB_IS_NUMBER( p ) ( HB_ITEM_TYPE( p ) & HB_IT_NUMERIC )
|
||||
#define HB_IS_NUMINT( p ) ( HB_ITEM_TYPE( p ) & HB_IT_NUMINT )
|
||||
#define HB_IS_COMPLEX( p ) ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX )
|
||||
#define HB_IS_GCITEM( p ) ( HB_ITEM_TYPE( p ) & HB_IT_GCITEM )
|
||||
#define HB_IS_BADITEM( p ) ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX && HB_ITEM_TYPE( p ) & ~( HB_IT_COMPLEX | HB_IT_MEMOFLAG ) )
|
||||
#define HB_IS_NUMERIC( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_NUMERIC ) != 0 )
|
||||
#define HB_IS_NUMBER( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_NUMERIC ) != 0 )
|
||||
#define HB_IS_NUMINT( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_NUMINT ) != 0 )
|
||||
#define HB_IS_COMPLEX( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX ) != 0 )
|
||||
#define HB_IS_GCITEM( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_GCITEM ) != 0 )
|
||||
#define HB_IS_BADITEM( p ) ( ( HB_ITEM_TYPE( p ) & HB_IT_COMPLEX != 0 ) && ( HB_ITEM_TYPE( p ) & ~( HB_IT_COMPLEX | HB_IT_MEMOFLAG ) ) != 0 )
|
||||
|
||||
|
||||
#define ISNIL( n ) ( hb_param( n, HB_IT_ANY ) == NULL || HB_IS_NIL( hb_param( n, HB_IT_ANY ) ) ) /* NOTE: Intentionally using a different method */
|
||||
@@ -128,7 +128,7 @@ HB_EXTERN_BEGIN
|
||||
#define ISLOG( n ) ( hb_param( n, HB_IT_LOGICAL ) != NULL )
|
||||
#define ISDATE( n ) ( hb_param( n, HB_IT_DATE ) != NULL )
|
||||
#define ISMEMO( n ) ( hb_param( n, HB_IT_MEMO ) != NULL )
|
||||
#define ISBYREF( n ) ( hb_parinfo( n ) & HB_IT_BYREF ) /* NOTE: Intentionally using a different method */
|
||||
#define ISBYREF( n ) ( ( hb_parinfo( n ) & HB_IT_BYREF ) != 0 ) /* NOTE: Intentionally using a different method */
|
||||
#define ISARRAY( n ) ( hb_param( n, HB_IT_ARRAY ) != NULL )
|
||||
#define ISOBJECT( n ) ( hb_extIsObject( n ) )
|
||||
#define ISBLOCK( n ) ( hb_param( n, HB_IT_BLOCK ) != NULL ) /* Not available in CA-Cl*pper. */
|
||||
|
||||
@@ -318,6 +318,7 @@ extern void hb_compVariableAdd( char * szVarName, BYTE cType ); /* add a new par
|
||||
extern PVAR hb_compVariableFind( PVAR pVars, USHORT wOrder ); /* returns a variable if defined or zero */
|
||||
extern PVAR hb_compLocalVariableFind( PFUNCTION pFunc, USHORT wVar );
|
||||
extern USHORT hb_compVariableGetPos( PVAR pVars, char * szVarName ); /* returns the order + 1 of a variable if defined or zero */
|
||||
extern int hb_compLocalGetPos( char * szVarName ); /* returns the order + 1 of a local variable */
|
||||
|
||||
#define HB_SYM_MEMVAR FALSE
|
||||
#define HB_SYM_FUNCNAME TRUE
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
#if ! defined( HB_DONT_DEFINE_BOOL )
|
||||
#undef BOOL /* boolean */
|
||||
typedef int BOOL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef UINT /* varies with platform */
|
||||
typedef unsigned int UINT;
|
||||
|
||||
@@ -110,6 +110,10 @@ extern int hb_pp_nCondCompile;
|
||||
extern char * hb_pp_szErrors[];
|
||||
extern char * hb_pp_szWarnings[];
|
||||
extern int hb_pp_nEmptyStrings;
|
||||
extern BOOL hb_pp_bInline;
|
||||
extern int hb_pp_LastOutLine;
|
||||
extern BOOL hb_ppInsideTextBlock;
|
||||
extern BOOL hb_ppNestedLiteralString;
|
||||
|
||||
/* PPCOMP.C exported functions */
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
|
||||
#include "hbcomp.h"
|
||||
#include "hbhash.h"
|
||||
#include "hbmemory.ch"
|
||||
|
||||
#if defined(HB_OS_DOS) && defined(__BORLANDC__)
|
||||
#include <limits.h>
|
||||
@@ -187,10 +188,7 @@ extern void * yylval ;
|
||||
#endif
|
||||
extern int yynerrs ;
|
||||
|
||||
extern char * hb_comp_buffer;
|
||||
extern char * hb_comp_szAnnounce;
|
||||
|
||||
extern void yyrestart( FILE * );
|
||||
extern void yyrestart( FILE * );
|
||||
|
||||
/* ************************************************************************* */
|
||||
|
||||
@@ -289,7 +287,10 @@ int main( int argc, char * argv[] )
|
||||
|
||||
hb_compIdentifierClose();
|
||||
if( hb_comp_pIncludePath )
|
||||
{
|
||||
hb_fsFreeSearchPath( hb_comp_pIncludePath );
|
||||
hb_comp_pIncludePath = NULL;
|
||||
}
|
||||
|
||||
if( (! bAnyFiles ) && (! hb_comp_bQuiet) )
|
||||
{
|
||||
@@ -298,14 +299,22 @@ int main( int argc, char * argv[] )
|
||||
}
|
||||
|
||||
if( hb_comp_pOutPath )
|
||||
{
|
||||
hb_xfree( hb_comp_pOutPath );
|
||||
hb_comp_pOutPath = NULL;
|
||||
}
|
||||
|
||||
if( hb_comp_pPpoPath )
|
||||
{
|
||||
hb_xfree( hb_comp_pPpoPath );
|
||||
hb_comp_pPpoPath = NULL;
|
||||
}
|
||||
|
||||
if( hb_comp_iErrorCount > 0 )
|
||||
iStatus = EXIT_FAILURE;
|
||||
|
||||
hb_xexit();
|
||||
|
||||
return iStatus;
|
||||
}
|
||||
|
||||
@@ -386,24 +395,84 @@ static int hb_compProcessRSPFile( char * szRspName, int argc, char * argv[] )
|
||||
return iStatus;
|
||||
}
|
||||
|
||||
/*
|
||||
#if defined(__IBMCPP__) || defined(_MSC_VER) || (defined(__BORLANDC__) && defined(__cplusplus))
|
||||
int isatty( int handle )
|
||||
{
|
||||
return ( handle < 4 ) ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* FM statistic module */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on failure */
|
||||
/* remove this 'undef' when number of memory leaks will be reduced to
|
||||
reasonable size */
|
||||
#undef HB_FM_STATISTICS
|
||||
|
||||
#ifdef HB_FM_STATISTICS
|
||||
|
||||
#define HB_MEMINFO_SIGNATURE 0xDEADBEAF
|
||||
#define HB_MEMSTR_BLOCK_MAX 256
|
||||
|
||||
typedef struct _HB_MEMINFO
|
||||
{
|
||||
struct _HB_MEMINFO * pPrevBlock;
|
||||
struct _HB_MEMINFO * pNextBlock;
|
||||
ULONG ulSize;
|
||||
UINT32 Signature;
|
||||
} HB_MEMINFO, * PHB_MEMINFO;
|
||||
|
||||
#ifdef HB_ALLOC_ALIGNMENT
|
||||
# define HB_MEMINFO_SIZE ( ( sizeof( HB_MEMINFO ) + HB_ALLOC_ALIGNMENT - 1 ) - \
|
||||
( sizeof( HB_MEMINFO ) + HB_ALLOC_ALIGNMENT - 1 ) % HB_ALLOC_ALIGNMENT )
|
||||
#else
|
||||
# define HB_MEMINFO_SIZE sizeof( HB_MEMINFO )
|
||||
#endif
|
||||
|
||||
static PHB_MEMINFO s_pMemBlocks = NULL;
|
||||
static LONG s_ulMemoryBlocks = 0; /* memory blocks used */
|
||||
static LONG s_ulMemoryMaxBlocks = 0; /* maximum number of used memory blocks */
|
||||
static LONG s_ulMemoryMaxConsumed = 0; /* memory size consumed */
|
||||
static LONG s_ulMemoryConsumed = 0; /* memory max size consumed */
|
||||
|
||||
#endif /* HB_FM_STATISTICS */
|
||||
|
||||
void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on failure */
|
||||
{
|
||||
#ifdef HB_FM_STATISTICS
|
||||
void * pMem = malloc( ulSize + HB_MEMINFO_SIZE + sizeof( UINT32 ) );
|
||||
|
||||
if( pMem )
|
||||
{
|
||||
if( s_pMemBlocks )
|
||||
s_pMemBlocks->pPrevBlock = ( PHB_MEMINFO ) pMem;
|
||||
( ( PHB_MEMINFO ) pMem )->pNextBlock = s_pMemBlocks;
|
||||
( ( PHB_MEMINFO ) pMem )->pPrevBlock = NULL;
|
||||
s_pMemBlocks = ( PHB_MEMINFO ) pMem;
|
||||
( ( PHB_MEMINFO ) pMem )->ulSize = ulSize;
|
||||
( ( PHB_MEMINFO ) pMem )->Signature = HB_MEMINFO_SIGNATURE;
|
||||
HB_PUT_LE_UINT32( ( ( BYTE * ) pMem ) + HB_MEMINFO_SIZE + ulSize, HB_MEMINFO_SIGNATURE );
|
||||
|
||||
s_ulMemoryConsumed += ulSize;
|
||||
if( s_ulMemoryMaxConsumed < s_ulMemoryConsumed )
|
||||
s_ulMemoryMaxConsumed = s_ulMemoryConsumed;
|
||||
s_ulMemoryBlocks++;
|
||||
if( s_ulMemoryMaxBlocks < s_ulMemoryBlocks )
|
||||
s_ulMemoryMaxBlocks = s_ulMemoryBlocks;
|
||||
pMem = ( BYTE * ) pMem + HB_MEMINFO_SIZE;
|
||||
}
|
||||
#else
|
||||
void * pMem = malloc( ulSize );
|
||||
#endif
|
||||
|
||||
if( ! pMem )
|
||||
{
|
||||
char szSize[ 32 ];
|
||||
|
||||
sprintf( szSize, "%li", ulSize );
|
||||
sprintf( szSize, "%lu", ulSize );
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMALLOC, szSize, NULL );
|
||||
}
|
||||
|
||||
@@ -412,12 +481,54 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail
|
||||
|
||||
void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */
|
||||
{
|
||||
#ifdef HB_FM_STATISTICS
|
||||
PHB_MEMINFO pMemBlock;
|
||||
ULONG ulMemSize;
|
||||
void * pResult = NULL;
|
||||
|
||||
if( ulSize == 0 )
|
||||
{
|
||||
if( pMem )
|
||||
hb_xfree( pMem );
|
||||
return NULL;
|
||||
}
|
||||
else if( ! pMem )
|
||||
return hb_xgrab( ulSize );
|
||||
|
||||
pMemBlock = ( PHB_MEMINFO ) ( ( BYTE * ) pMem - HB_MEMINFO_SIZE );
|
||||
ulMemSize = pMemBlock->ulSize;
|
||||
|
||||
if( pMemBlock->Signature == HB_MEMINFO_SIGNATURE &&
|
||||
HB_GET_LE_UINT32( ( ( BYTE * ) pMem ) + ulMemSize ) == HB_MEMINFO_SIGNATURE )
|
||||
{
|
||||
HB_PUT_LE_UINT32( ( ( BYTE * ) pMem ) + ulMemSize, 0 );
|
||||
pResult = realloc( pMemBlock, ulSize + HB_MEMINFO_SIZE + sizeof( UINT32 ) );
|
||||
if( pResult )
|
||||
{
|
||||
if( s_pMemBlocks == pMemBlock )
|
||||
s_pMemBlocks = ( PHB_MEMINFO ) pResult;
|
||||
else
|
||||
( ( PHB_MEMINFO ) pResult )->pPrevBlock->pNextBlock = ( PHB_MEMINFO ) pResult;
|
||||
if( ( ( PHB_MEMINFO ) pResult )->pNextBlock )
|
||||
( ( PHB_MEMINFO ) pResult )->pNextBlock->pPrevBlock = ( PHB_MEMINFO ) pResult;
|
||||
|
||||
s_ulMemoryConsumed += ( ulSize - ulMemSize );
|
||||
if( s_ulMemoryMaxConsumed < s_ulMemoryConsumed )
|
||||
s_ulMemoryMaxConsumed = s_ulMemoryConsumed;
|
||||
( ( PHB_MEMINFO ) pResult )->ulSize = ulSize; /* size of the memory block */
|
||||
HB_PUT_LE_UINT32( ( ( BYTE * ) pResult ) + ulSize + HB_MEMINFO_SIZE, HB_MEMINFO_SIGNATURE );
|
||||
pResult = ( BYTE * ) pResult + HB_MEMINFO_SIZE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void * pResult = realloc( pMem, ulSize );
|
||||
if( ! pResult )
|
||||
#endif
|
||||
|
||||
if( ! pResult && ulSize )
|
||||
{
|
||||
char szSize[ 32 ];
|
||||
|
||||
sprintf( szSize, "%li", ulSize );
|
||||
sprintf( szSize, "%lu", ulSize );
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_MEMREALLOC, szSize, NULL );
|
||||
}
|
||||
|
||||
@@ -426,6 +537,30 @@ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */
|
||||
|
||||
void hb_xfree( void * pMem ) /* frees fixed memory */
|
||||
{
|
||||
#ifdef HB_FM_STATISTICS
|
||||
if( pMem )
|
||||
{
|
||||
PHB_MEMINFO pMemBlock = ( PHB_MEMINFO ) ( ( BYTE * ) pMem - HB_MEMINFO_SIZE );
|
||||
|
||||
if( pMemBlock->Signature == HB_MEMINFO_SIGNATURE &&
|
||||
HB_GET_LE_UINT32( ( ( BYTE * ) pMem ) + pMemBlock->ulSize ) == HB_MEMINFO_SIGNATURE )
|
||||
{
|
||||
s_ulMemoryConsumed -= pMemBlock->ulSize;
|
||||
s_ulMemoryBlocks--;
|
||||
if( s_pMemBlocks == pMemBlock )
|
||||
s_pMemBlocks = pMemBlock->pNextBlock;
|
||||
else
|
||||
pMemBlock->pPrevBlock->pNextBlock = pMemBlock->pNextBlock;
|
||||
if( pMemBlock->pNextBlock )
|
||||
pMemBlock->pNextBlock->pPrevBlock = pMemBlock->pPrevBlock;
|
||||
pMemBlock->Signature = 0;
|
||||
HB_PUT_LE_UINT32( ( ( BYTE * ) pMem ) + pMemBlock->ulSize, 0 );
|
||||
pMem = ( BYTE * ) pMem - HB_MEMINFO_SIZE;
|
||||
}
|
||||
else
|
||||
pMem = NULL;
|
||||
}
|
||||
#endif
|
||||
if( pMem )
|
||||
free( pMem );
|
||||
else
|
||||
@@ -434,8 +569,99 @@ void hb_xfree( void * pMem ) /* frees fixed memory */
|
||||
|
||||
ULONG hb_xquery( USHORT uiMode )
|
||||
{
|
||||
ULONG ulResult = 0;
|
||||
|
||||
#ifdef HB_FM_STATISTICS
|
||||
switch( uiMode )
|
||||
{
|
||||
case HB_MEM_USED:
|
||||
ulResult = s_ulMemoryConsumed;
|
||||
break;
|
||||
|
||||
case HB_MEM_USEDMAX:
|
||||
ulResult = s_ulMemoryMaxConsumed;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
HB_SYMBOL_UNUSED( uiMode );
|
||||
return 0;
|
||||
#endif
|
||||
return ulResult;
|
||||
}
|
||||
|
||||
#ifdef HB_FM_STATISTICS
|
||||
static char * hb_memToStr( char * szBuffer, void * pMem, ULONG ulSize )
|
||||
{
|
||||
unsigned char *byMem = ( BYTE * ) pMem;
|
||||
char * pDest = szBuffer;
|
||||
int iSize, i, iPrintable;
|
||||
|
||||
if( ulSize > HB_MEMSTR_BLOCK_MAX )
|
||||
iSize = HB_MEMSTR_BLOCK_MAX;
|
||||
else
|
||||
iSize = ( int ) ulSize;
|
||||
|
||||
iPrintable = 0;
|
||||
for( i = 0; i < iSize; ++i )
|
||||
if( ( byMem[ i ] & 0x7f ) >= 0x20 )
|
||||
iPrintable++;
|
||||
|
||||
if( ( iPrintable * 100 ) / iSize > 70 ) /* more then 70% printable chars */
|
||||
{
|
||||
/* format as string of original chars */
|
||||
for( i = 0; i < iSize; ++i )
|
||||
if( ( byMem[ i ] & 0x7f ) >= 0x20 )
|
||||
* pDest++ = byMem[ i ];
|
||||
else
|
||||
* pDest++ = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
/* format as hex */
|
||||
for( i = 0; i < iSize; ++i )
|
||||
{
|
||||
int iLo = byMem[ i ] & 0x0f, iHi = byMem[ i ] >> 4;
|
||||
* pDest++ = '\\';
|
||||
* pDest++ = iHi < 9 ? '0' + iHi : 'A' - 10 + iHi;
|
||||
* pDest++ = iLo < 9 ? '0' + iLo : 'A' - 10 + iLo;
|
||||
}
|
||||
}
|
||||
* pDest = '\0';
|
||||
|
||||
return szBuffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
void hb_xexit( void )
|
||||
{
|
||||
#ifdef HB_FM_STATISTICS
|
||||
if( s_ulMemoryBlocks /* || hb_cmdargCheck( "INFO" ) */ )
|
||||
{
|
||||
char szBuffer[ HB_MAX( 3 * HB_MEMSTR_BLOCK_MAX + 1, 100 ) ];
|
||||
PHB_MEMINFO pMemBlock;
|
||||
int i;
|
||||
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
hb_conOutErr( "----------------------------------------", 0 );
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
sprintf( szBuffer, "Total memory allocated: %lu bytes (%lu blocks)", s_ulMemoryMaxConsumed, s_ulMemoryMaxBlocks );
|
||||
hb_conOutErr( szBuffer, 0 );
|
||||
|
||||
if( s_ulMemoryBlocks )
|
||||
{
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
sprintf( szBuffer, "WARNING! Memory allocated but not released: %lu bytes (%lu blocks)", s_ulMemoryConsumed, s_ulMemoryBlocks );
|
||||
hb_conOutErr( szBuffer, 0 );
|
||||
}
|
||||
|
||||
hb_conOutErr( hb_conNewLine(), 0 );
|
||||
|
||||
for( i = 1, pMemBlock = s_pMemBlocks; pMemBlock; ++i, pMemBlock = pMemBlock->pNextBlock )
|
||||
HB_TRACE( HB_TR_ERROR, ( "Block %i %p (size %lu) \"%s\"", i,
|
||||
( char * ) pMemBlock + HB_MEMINFO_SIZE, pMemBlock->ulSize,
|
||||
hb_memToStr( szBuffer, ( char * ) pMemBlock + HB_MEMINFO_SIZE,
|
||||
pMemBlock->ulSize ) ) );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void hb_conOutErr( const char * pStr, ULONG ulLen )
|
||||
|
||||
@@ -43,11 +43,16 @@
|
||||
#include "hbdefs.h"
|
||||
#include "hbdate.h"
|
||||
|
||||
#undef alloca
|
||||
#define alloca hb_xgrab
|
||||
#undef malloc
|
||||
#define malloc hb_xgrab
|
||||
#undef free
|
||||
#define free hb_xfree
|
||||
|
||||
/* helper functions */
|
||||
static int yy_ConvertNumber( char * szBuffer );
|
||||
static int yy_ConvertDate( char * szBuffer );
|
||||
extern int hb_ppInsideTextBlock;
|
||||
extern BOOL hb_ppNestedLiteralString;
|
||||
|
||||
/* YACC functions */
|
||||
void yyerror( char * );
|
||||
@@ -851,167 +856,166 @@ Separator {SpaceTab}
|
||||
|
||||
"hb_inline" {
|
||||
|
||||
/* NOTE: hb_compiLineINLINE is being RESET in ppcomp.c - hb_pp_Internal() */
|
||||
/* NOTE: hb_compiLineINLINE is being RESET in ppcomp.c - hb_pp_Internal() */
|
||||
|
||||
if( ! HB_COMP_ISSUPPORTED( HB_COMPFLAG_HB_INLINE ) )
|
||||
{
|
||||
yylval.string = hb_compIdentifierNew( "HB_INLINE", TRUE );
|
||||
if( ! HB_COMP_ISSUPPORTED( HB_COMPFLAG_HB_INLINE ) )
|
||||
{
|
||||
yylval.string = hb_compIdentifierNew( "HB_INLINE", TRUE );
|
||||
hb_comp_iState = IDENTIFIER;
|
||||
return IDENTIFIER;
|
||||
}
|
||||
}
|
||||
|
||||
if( hb_comp_iLineINLINE )
|
||||
{
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_TOOMANY_INLINE, "on the same line", NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
#define INLINE_NORMAL 0
|
||||
#define INLINE_SINGLE_QUOT 1
|
||||
#define INLINE_DOUBLE_QUOT 2
|
||||
#define INLINE_COMMENT 3
|
||||
if( hb_comp_iLineINLINE )
|
||||
{
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_TOOMANY_INLINE, "on the same line", NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
#define INLINE_NORMAL 0
|
||||
#define INLINE_SINGLE_QUOT 1
|
||||
#define INLINE_DOUBLE_QUOT 2
|
||||
#define INLINE_COMMENT 3
|
||||
|
||||
char sBuffer[ YY_BUF_SIZE ], *pBuffer, sInlineSym[] = "HB_INLINE_0", cMode = INLINE_NORMAL;
|
||||
int iSize, iBraces = 0;
|
||||
extern BOOL hb_pp_bInline;
|
||||
PINLINE pInline;
|
||||
char sBuffer[ YY_BUF_SIZE ], *pBuffer, sInlineSym[] = "HB_INLINE_0", cMode = INLINE_NORMAL;
|
||||
int iSize, iBraces = 0;
|
||||
PINLINE pInline;
|
||||
|
||||
hb_comp_iLineINLINE = hb_comp_iLine;
|
||||
hb_pp_bInline = TRUE;
|
||||
hb_comp_iLineINLINE = hb_comp_iLine;
|
||||
hb_pp_bInline = TRUE;
|
||||
|
||||
sInlineSym[10] = hb_comp_cInlineID++;
|
||||
sInlineSym[10] = hb_comp_cInlineID++;
|
||||
|
||||
switch( sInlineSym[10] )
|
||||
{
|
||||
case '9' + 1 :
|
||||
sInlineSym[10] = 'A';
|
||||
break;
|
||||
switch( sInlineSym[10] )
|
||||
{
|
||||
case '9' + 1 :
|
||||
sInlineSym[10] = 'A';
|
||||
break;
|
||||
|
||||
case 'Z' + 1 :
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_TOOMANY_INLINE, NULL, NULL );
|
||||
break;
|
||||
}
|
||||
case 'Z' + 1 :
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_TOOMANY_INLINE, NULL, NULL );
|
||||
break;
|
||||
}
|
||||
|
||||
pInline = hb_compInlineAdd( hb_compIdentifierNew( sInlineSym, TRUE ) );
|
||||
pInline = hb_compInlineAdd( hb_compIdentifierNew( sInlineSym, TRUE ) );
|
||||
|
||||
DigestInline :
|
||||
DigestInline:
|
||||
|
||||
YY_INPUT( (char*) sBuffer, iSize, YY_BUF_SIZE );
|
||||
if( iSize == 0 )
|
||||
{
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_INVALID_INLINE, hb_comp_functions.pLast->szName, NULL );
|
||||
hb_pp_bInline = FALSE;
|
||||
return '\n';
|
||||
}
|
||||
pBuffer = (char*) sBuffer;
|
||||
YY_INPUT( (char*) sBuffer, iSize, YY_BUF_SIZE );
|
||||
if( iSize == 0 )
|
||||
{
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_INVALID_INLINE, hb_comp_functions.pLast->szName, NULL );
|
||||
hb_pp_bInline = FALSE;
|
||||
return '\n';
|
||||
}
|
||||
pBuffer = (char*) sBuffer;
|
||||
|
||||
while( *pBuffer )
|
||||
{
|
||||
switch( cMode )
|
||||
{
|
||||
case INLINE_NORMAL :
|
||||
if( *pBuffer == '{' )
|
||||
{
|
||||
iBraces++;
|
||||
}
|
||||
else if( *pBuffer == '}' && iBraces > 1 )
|
||||
{
|
||||
iBraces--;
|
||||
}
|
||||
else if( *pBuffer == '}' )
|
||||
{
|
||||
hb_pp_bInline = FALSE;
|
||||
break;
|
||||
}
|
||||
else if( *pBuffer == '\'' )
|
||||
{
|
||||
cMode = INLINE_SINGLE_QUOT;
|
||||
}
|
||||
else if( *pBuffer == '"' )
|
||||
{
|
||||
cMode = INLINE_DOUBLE_QUOT;
|
||||
}
|
||||
else if( *pBuffer == '/' && *(pBuffer+1) == '/' )
|
||||
{
|
||||
goto SaveInline;
|
||||
}
|
||||
else if( *pBuffer == '/' && *(pBuffer+1) == '*' )
|
||||
{
|
||||
pBuffer++;
|
||||
cMode = INLINE_COMMENT;
|
||||
}
|
||||
break;
|
||||
while( *pBuffer )
|
||||
{
|
||||
switch( cMode )
|
||||
{
|
||||
case INLINE_NORMAL :
|
||||
if( *pBuffer == '{' )
|
||||
{
|
||||
iBraces++;
|
||||
}
|
||||
else if( *pBuffer == '}' && iBraces > 1 )
|
||||
{
|
||||
iBraces--;
|
||||
}
|
||||
else if( *pBuffer == '}' )
|
||||
{
|
||||
hb_pp_bInline = FALSE;
|
||||
break;
|
||||
}
|
||||
else if( *pBuffer == '\'' )
|
||||
{
|
||||
cMode = INLINE_SINGLE_QUOT;
|
||||
}
|
||||
else if( *pBuffer == '"' )
|
||||
{
|
||||
cMode = INLINE_DOUBLE_QUOT;
|
||||
}
|
||||
else if( *pBuffer == '/' && *(pBuffer+1) == '/' )
|
||||
{
|
||||
goto SaveInline;
|
||||
}
|
||||
else if( *pBuffer == '/' && *(pBuffer+1) == '*' )
|
||||
{
|
||||
pBuffer++;
|
||||
cMode = INLINE_COMMENT;
|
||||
}
|
||||
break;
|
||||
|
||||
case INLINE_SINGLE_QUOT :
|
||||
if( *pBuffer == '\\' )
|
||||
{
|
||||
pBuffer++;
|
||||
}
|
||||
else if( *pBuffer == '\'' )
|
||||
{
|
||||
cMode = INLINE_NORMAL;
|
||||
}
|
||||
break;
|
||||
case INLINE_SINGLE_QUOT :
|
||||
if( *pBuffer == '\\' )
|
||||
{
|
||||
pBuffer++;
|
||||
}
|
||||
else if( *pBuffer == '\'' )
|
||||
{
|
||||
cMode = INLINE_NORMAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case INLINE_DOUBLE_QUOT :
|
||||
if( *pBuffer == '\\' )
|
||||
{
|
||||
pBuffer++;
|
||||
}
|
||||
else if( *pBuffer == '"' )
|
||||
{
|
||||
cMode = INLINE_NORMAL;
|
||||
}
|
||||
break;
|
||||
case INLINE_DOUBLE_QUOT :
|
||||
if( *pBuffer == '\\' )
|
||||
{
|
||||
pBuffer++;
|
||||
}
|
||||
else if( *pBuffer == '"' )
|
||||
{
|
||||
cMode = INLINE_NORMAL;
|
||||
}
|
||||
break;
|
||||
|
||||
case INLINE_COMMENT :
|
||||
if( *pBuffer == '*' && *(pBuffer+1) == '/' )
|
||||
{
|
||||
pBuffer++;
|
||||
cMode = INLINE_NORMAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case INLINE_COMMENT :
|
||||
if( *pBuffer == '*' && *(pBuffer+1) == '/' )
|
||||
{
|
||||
pBuffer++;
|
||||
cMode = INLINE_NORMAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
pBuffer++;
|
||||
}
|
||||
pBuffer++;
|
||||
}
|
||||
|
||||
SaveInline :
|
||||
SaveInline:
|
||||
|
||||
if( pInline->pCode == NULL )
|
||||
{
|
||||
pInline->pCode = (BYTE *) hb_xgrab( ( iSize = strlen( (char*) sBuffer ) ) + 1 );
|
||||
strcpy( (char *) pInline->pCode, (char*) sBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
pInline->pCode = (BYTE *) hb_xrealloc( pInline->pCode, pInline->lPCodeSize + ( iSize = strlen( (char*) sBuffer ) ) + 1 );
|
||||
strcpy( (char *) (pInline->pCode + pInline->lPCodeSize), (char*) sBuffer );
|
||||
}
|
||||
pInline->lPCodeSize += iSize;
|
||||
if( pInline->pCode == NULL )
|
||||
{
|
||||
pInline->pCode = (BYTE *) hb_xgrab( ( iSize = strlen( (char*) sBuffer ) ) + 1 );
|
||||
strcpy( (char *) pInline->pCode, (char*) sBuffer );
|
||||
}
|
||||
else
|
||||
{
|
||||
pInline->pCode = (BYTE *) hb_xrealloc( pInline->pCode, pInline->lPCodeSize + ( iSize = strlen( (char*) sBuffer ) ) + 1 );
|
||||
strcpy( (char *) (pInline->pCode + pInline->lPCodeSize), (char*) sBuffer );
|
||||
}
|
||||
pInline->lPCodeSize += iSize;
|
||||
|
||||
if( hb_pp_bInline )
|
||||
{
|
||||
goto DigestInline;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( hb_comp_iLanguage != LANG_C && hb_comp_iLanguage != LANG_OBJ_MODULE )
|
||||
{
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_REQUIRES_C, NULL, NULL );
|
||||
hb_xfree( ( void * ) pInline->pCode );
|
||||
hb_xfree( ( void * ) pInline->szFileName );
|
||||
hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */
|
||||
}
|
||||
if( hb_pp_bInline )
|
||||
{
|
||||
goto DigestInline;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( hb_comp_iLanguage != LANG_C && hb_comp_iLanguage != LANG_OBJ_MODULE )
|
||||
{
|
||||
hb_compGenError( hb_comp_szErrors, 'F', HB_COMP_ERR_REQUIRES_C, NULL, NULL );
|
||||
hb_xfree( ( void * ) pInline->pCode );
|
||||
hb_xfree( ( void * ) pInline->szFileName );
|
||||
hb_xfree( ( void * ) pInline ); /* NOTE: szName will be released by hb_compSymbolKill() */
|
||||
}
|
||||
|
||||
hb_comp_iLinePRG = hb_comp_iLine - 1;
|
||||
hb_comp_iLine = hb_comp_iLineINLINE;
|
||||
hb_comp_iLinePRG = hb_comp_iLine - 1;
|
||||
hb_comp_iLine = hb_comp_iLineINLINE;
|
||||
|
||||
yylval.string = hb_compIdentifierNew( sInlineSym, TRUE );
|
||||
return IDENTIFIER;
|
||||
}
|
||||
}
|
||||
}
|
||||
yylval.string = hb_compIdentifierNew( sInlineSym, TRUE );
|
||||
return IDENTIFIER;
|
||||
}
|
||||
}
|
||||
}
|
||||
%{
|
||||
/* ************************************************************************ */
|
||||
%}
|
||||
|
||||
@@ -33,11 +33,13 @@
|
||||
* 2) Support this syntax: nPtr := @Hello()
|
||||
*/
|
||||
|
||||
/* malloc.h has been obsoleted by stdlib.h, which is included via hbcomp.h
|
||||
#include <malloc.h>
|
||||
*/
|
||||
|
||||
#include "hbcomp.h"
|
||||
#undef alloca
|
||||
#define alloca hb_xgrab
|
||||
#undef malloc
|
||||
#define malloc hb_xgrab
|
||||
#undef free
|
||||
#define free hb_xfree
|
||||
|
||||
/* Compile using: bison -d -v harbour.y */
|
||||
|
||||
|
||||
@@ -33,16 +33,17 @@
|
||||
* 2) Support this syntax: nPtr := @Hello()
|
||||
*/
|
||||
|
||||
/* malloc.h has been obsoleted by stdlib.h, which is included via hbcomp.h
|
||||
#include <malloc.h>
|
||||
*/
|
||||
|
||||
#include "hbcomp.h"
|
||||
#undef alloca
|
||||
#define alloca hb_xgrab
|
||||
#undef malloc
|
||||
#define malloc hb_xgrab
|
||||
#undef free
|
||||
#define free hb_xfree
|
||||
|
||||
/* Compile using: bison -d -v harbour.y */
|
||||
|
||||
extern FILE *yyin; /* currently yacc parsed file */
|
||||
extern int hb_comp_iLine; /* currently parsed file line number */
|
||||
extern char *yytext;
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -160,8 +161,6 @@ static PTR_LOOPEXIT hb_comp_pLoops = NULL;
|
||||
static HB_RTVAR_PTR hb_comp_rtvars = NULL;
|
||||
static SWITCHCMD_PTR hb_comp_pSwitch = NULL;
|
||||
|
||||
extern int hb_compLocalGetPos( char * szVarName ); /* returns the order + 1 of a local variable */
|
||||
|
||||
char * hb_comp_szAnnounce = NULL; /* ANNOUNCEd procedure */
|
||||
|
||||
static void hb_compDebugStart( void ) { };
|
||||
|
||||
@@ -68,9 +68,6 @@
|
||||
|
||||
static int strncmp_nocase( char* s1, char* s2, int n );
|
||||
|
||||
extern BOOL hb_ppInsideTextBlock;
|
||||
extern BOOL hb_ppNestedLiteralString;
|
||||
|
||||
BOOL hb_pp_bInline = FALSE;
|
||||
|
||||
static char s_szLine[ HB_PP_STR_SIZE ];
|
||||
@@ -81,8 +78,6 @@ int hb_pp_LastOutLine = 1;
|
||||
BOOL bDebug = FALSE;
|
||||
*/
|
||||
|
||||
extern void CloseInclude( void );
|
||||
|
||||
int hb_pp_Internal( FILE * handl_o, char * sOut )
|
||||
{
|
||||
PFILE pFile;
|
||||
|
||||
@@ -195,11 +195,6 @@ char * hb_pp_STD_CH = NULL;
|
||||
/* Ron Pinkas added 2000-11-21 */
|
||||
static BOOL s_bArray = FALSE;
|
||||
|
||||
#if defined(__WATCOMC__)
|
||||
extern BOOL hb_pp_bInline;
|
||||
extern int hb_pp_LastOutLine;
|
||||
#endif
|
||||
|
||||
/* Table with parse errors */
|
||||
char * hb_pp_szErrors[] =
|
||||
{
|
||||
@@ -3311,9 +3306,6 @@ static void pp_rQuotes( char * expreal, char * sQuotes )
|
||||
|
||||
int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lContinue, char * sBuffer, int * lenBuffer, int * iBuffer )
|
||||
{
|
||||
#ifndef __WATCOMC__
|
||||
extern BOOL hb_pp_bInline;
|
||||
#endif
|
||||
int readed = 0;
|
||||
int State = 0;
|
||||
char cha, cLast = '\0', symbLast = '\0';
|
||||
@@ -3507,9 +3499,6 @@ int hb_pp_RdStr( FILE * handl_i, char * buffer, int maxlen, BOOL lContinue, char
|
||||
|
||||
int hb_pp_WrStr( FILE * handl_o, char * buffer )
|
||||
{
|
||||
#ifndef __WATCOMC__
|
||||
extern int hb_pp_LastOutLine;
|
||||
#endif
|
||||
int lens = strlen(buffer);
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_pp_WrStr(%p, %s)", handl_o, buffer));
|
||||
|
||||
@@ -131,57 +131,48 @@ HB_FUNC( __PP_INIT )
|
||||
char * pDelim;
|
||||
|
||||
while( ( pDelim = strchr( pPath, OS_PATH_LIST_SEPARATOR ) ) != NULL )
|
||||
{
|
||||
*pDelim = '\0';
|
||||
AddSearchPath( pPath, &hb_comp_pIncludePath );
|
||||
pPath = pDelim + 1;
|
||||
}
|
||||
{
|
||||
*pDelim = '\0';
|
||||
AddSearchPath( pPath, &hb_comp_pIncludePath );
|
||||
pPath = pDelim + 1;
|
||||
}
|
||||
AddSearchPath( pPath, &hb_comp_pIncludePath );
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( __PP_PATH )
|
||||
{
|
||||
HB_PATHNAMES * pPath = hb_comp_pIncludePath, * pPathNext;
|
||||
|
||||
if( ISLOG( 2 ) && hb_parl( 2 ) )
|
||||
if( ISLOG( 2 ) && hb_parl( 2 ) && hb_comp_pIncludePath )
|
||||
{
|
||||
while( pPath )
|
||||
{
|
||||
pPathNext = pPath->pNext;
|
||||
hb_xfree( pPath->szPath );
|
||||
hb_xfree( pPath );
|
||||
pPath = pPathNext;
|
||||
}
|
||||
hb_fsFreeSearchPath( hb_comp_pIncludePath );
|
||||
hb_comp_pIncludePath = NULL;
|
||||
}
|
||||
|
||||
if( ISCHAR( 1 ) )
|
||||
{
|
||||
char * cDelim;
|
||||
char * cPath = hb_parc( 1 );
|
||||
|
||||
while( ( cDelim = strchr( cPath, OS_PATH_LIST_SEPARATOR ) ) != NULL )
|
||||
{
|
||||
*cDelim = '\0';
|
||||
AddSearchPath( cPath, &hb_comp_pIncludePath );
|
||||
cPath = cDelim + 1;
|
||||
}
|
||||
{
|
||||
*cDelim = '\0';
|
||||
AddSearchPath( cPath, &hb_comp_pIncludePath );
|
||||
cPath = cDelim + 1;
|
||||
}
|
||||
AddSearchPath( cPath, &hb_comp_pIncludePath );
|
||||
}
|
||||
}
|
||||
|
||||
HB_FUNC( __PP_FREE )
|
||||
{
|
||||
HB_PATHNAMES * pPath = hb_comp_pIncludePath, * pPathNext;
|
||||
|
||||
while( pPath )
|
||||
if( hb_comp_pIncludePath )
|
||||
{
|
||||
pPathNext = pPath->pNext;
|
||||
hb_xfree( pPath->szPath );
|
||||
hb_xfree( pPath );
|
||||
pPath = pPathNext;
|
||||
hb_fsFreeSearchPath( hb_comp_pIncludePath );
|
||||
hb_comp_pIncludePath = NULL;
|
||||
}
|
||||
|
||||
hb_pp_Free();
|
||||
|
||||
if( hb_pp_aCondCompile )
|
||||
{
|
||||
hb_xfree( hb_pp_aCondCompile );
|
||||
|
||||
@@ -67,10 +67,6 @@ static BOOL s_bTracePragma = FALSE;
|
||||
/* Size of abreviated pragma commands */
|
||||
#define PRAGMAS_LEN 8
|
||||
|
||||
#if defined(__WATCOMC__)
|
||||
extern BOOL hb_pp_bInline;
|
||||
#endif
|
||||
|
||||
/* TODO: Add support for:
|
||||
RequestLib /R
|
||||
*/
|
||||
@@ -194,9 +190,6 @@ void hb_pp_ParsePragma( char * szLine )
|
||||
{
|
||||
char sBuffer[ HB_PP_STR_SIZE ], *pBuffer, sDirective[9] ;
|
||||
int iSize;
|
||||
#ifndef __WATCOMC__
|
||||
extern BOOL hb_pp_bInline;
|
||||
#endif
|
||||
PINLINE pInline;
|
||||
|
||||
if( hb_comp_bPPO )
|
||||
|
||||
@@ -515,10 +515,7 @@ static void hb_gt_std_DispLine( int iRow )
|
||||
}
|
||||
hb_gt_std_newLine();
|
||||
if( iMin > 0 )
|
||||
{
|
||||
hb_gt_std_termOut( s_sLineBuf, iMin );
|
||||
iMin--;
|
||||
}
|
||||
s_iLastCol = s_iCol = iMin;
|
||||
s_iRow = iRow;
|
||||
}
|
||||
|
||||
113
harbour/tests/ctwtest.prg
Normal file
113
harbour/tests/ctwtest.prg
Normal file
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code
|
||||
* http://www.Harbour-Project.org/
|
||||
*
|
||||
* Clipper Tool III like window system test program
|
||||
* Donated to the public domain on 2006-02-11 by Przemyslaw Czerpak
|
||||
*/
|
||||
|
||||
#define ntrim(n) ltrim(str(n))
|
||||
#include "inkey.ch"
|
||||
|
||||
proc main()
|
||||
local aWin:=array(9), y, x, i, k, s, c, lFlag:=.f., lBoard:=.t.
|
||||
|
||||
setblink(.f.)
|
||||
wboard(5,5,20,75)
|
||||
wmode(.t.,.t.,.t.,.t.)
|
||||
wsetshadow(7)
|
||||
setclearA(10*16+14)
|
||||
setclearB(35)
|
||||
dispbox(0,0,maxrow(),maxcol(),repl("#",9),ntocolor(10*16+14))
|
||||
setpos(0,0)
|
||||
? "GT driver: "+ HB_GTVERSION()
|
||||
? HB_GTVERSION(1)
|
||||
?
|
||||
? "ESC - quit "
|
||||
? "0 - select window 0 (base screen) "
|
||||
? "1-9 select window 1-9 "
|
||||
? "C - close window "
|
||||
? "Q - clear screen "
|
||||
? "P - print text at window 0 "
|
||||
? "B - board switch "
|
||||
? "INS - cursor shape "
|
||||
? "DEL - hide cursor "
|
||||
? "arrows - window move "
|
||||
|
||||
setclearB(61)
|
||||
for i:=1 to len(aWin)
|
||||
y:=i+2
|
||||
x:=i*4+10
|
||||
setcolor(ntocolor(i*16+15)+",W+/B*")
|
||||
wsetshadow(i%8)
|
||||
aWin[i]:=wopen(y,x,y+10,x+20)
|
||||
wbox()
|
||||
|
||||
@ -1,0 say "TITLE "+ntrim(aWin[i])
|
||||
? ntrim(row())+":"+ntrim(col()),"/",ntrim(maxrow())+":"+ntrim(maxcol()),""
|
||||
? ntrim(wrow())+":"+ntrim(wcol()),"/",ntrim(maxrow(.t.))+":"+ntrim(maxcol(.t.)),""
|
||||
? ntrim(wfrow())+":"+ntrim(wfcol()),"/",;
|
||||
ntrim(wflastrow())+":"+ntrim(wflastcol()),""
|
||||
? ntrim(wfrow(.t.))+":"+ntrim(wfcol(.t.)),"/",;
|
||||
ntrim(wflastrow(.t.))+":"+ntrim(wflastcol(.t.)),""
|
||||
? "window:",ntrim(aWin[i]),""
|
||||
setcursor(int(i%5))
|
||||
|
||||
next
|
||||
|
||||
dspcord()
|
||||
while .t.
|
||||
k:=inkey(0, INKEY_ALL)
|
||||
if k == K_ESC
|
||||
exit
|
||||
elseif k>=asc("1") .and. k<=asc("9")
|
||||
wselect(aWin[k-asc("0")])
|
||||
elseif k==asc("0")
|
||||
wselect(0)
|
||||
elseif k==asc("C") .or. k==asc("c")
|
||||
wclose()
|
||||
elseif k==asc("Q") .or. k==asc("q")
|
||||
clear screen
|
||||
elseif k==asc("B") .or. k==asc("b")
|
||||
if lBoard
|
||||
wboard(0,0,maxrow(.t.)-1,maxcol(.t.))
|
||||
else
|
||||
wboard(5,5,20,75)
|
||||
endif
|
||||
lBoard:=!lBoard
|
||||
elseif k==asc("P") .or. k==asc("P")
|
||||
y:=wfrow()
|
||||
x:=wfcol()
|
||||
i:=wselect()
|
||||
wselect(0)
|
||||
@ y,x say "THIS IS WINDOW 0 OUTPUT"
|
||||
wselect(i)
|
||||
elseif k==K_INS
|
||||
lFlag:=!lFlag
|
||||
setcursor(iif(lFlag,3,1))
|
||||
elseif k==K_DEL
|
||||
setcursor(0)
|
||||
elseif k==K_LEFT
|
||||
wmove(wrow(),wcol()-1)
|
||||
elseif k==K_RIGHT
|
||||
wmove(wrow(),wcol()+1)
|
||||
elseif k==K_UP
|
||||
wmove(wrow()-1,wcol())
|
||||
elseif k==K_DOWN
|
||||
wmove(wrow()+1,wcol())
|
||||
endif
|
||||
dspcord()
|
||||
enddo
|
||||
return
|
||||
|
||||
static proc dspcord()
|
||||
local mr:=mrow(), mc:=mcol(), r:=wrow(), c:=wcol(), w:=wselect()
|
||||
wselect(0)
|
||||
@ maxrow(), 0 say padr("WPOS("+ltrim(str(r))+","+ltrim(str(c))+")"+;
|
||||
iif(MPresent(), "MPOS("+ltrim(str(mr))+","+ltrim(str(mc))+")", ""), maxcol()+1)
|
||||
wselect(w)
|
||||
return
|
||||
Reference in New Issue
Block a user