2000-06-25 14:25 UTC+0100 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-06-25 12:29:19 +00:00
parent 057aabe723
commit af1cd893af
14 changed files with 123 additions and 126 deletions

View File

@@ -1,3 +1,37 @@
2000-06-25 14:25 UTC+0100 Victor Szakats <info@szelvesz.hu>
* tests/onidle.prg
* source/rtl/idle.c
* Renamed some idle related Harbour level functions:
HB_ADDIDLE() -> HB_IDLEADD()
HB_DELIDLE() -> HB_IDLEDEL()
HB_IAMIDLE() -> HB_IDLESTATE()
* source/rtl/objfunc.prg
* source/rtl/teditor.prg
% Small optimizations.
* source/vm/fm.c
% Some optimizations on the hb_xquery() OS/2 branch, some other cleanups
and formattings made.
* include/hbapigt.h
- Removed hb_releaseCPU() prototype.
* source/vm/itemapi.c
* include/hbapiitm.h
* source/rtl/errorapi.c
+ hb_itemInit() function added, to initialize a new HB_ITEM structure.
* errorapi.c now uses hb_itemInit() instead of the low-level item access.
* include/inkey.ch
* include/set.ch
+ Some comments added related to Harbour or C53 extensions.
* source/vm/hvm.c
* include/simpleio.ch
* Minor changes.
2000-06-25 03:35 UTC-0800 Ron Pinkas <Ron@Profit-Master.com>
* source/compiler/hbgenerr.c
! Fixed line number when in <eol> was 1 too short.

View File

@@ -227,9 +227,6 @@ extern int hb_inkeyNext( void ); /* Return the next key without ext
extern void hb_inkeyPoll( void ); /* Poll the console keyboard to stuff the Harbour buffer */
extern void hb_inkeyReset( BOOL allocate ); /* Reset the Harbour keyboard buffer */
/* TOFIX: This should go somewhere else. */
extern void hb_releaseCPU( void ); /* Attempt to release a CPU time slice */
/* Mouse related declarations */
/* Public interface. These should never change, only be added to. */

View File

@@ -75,6 +75,7 @@ extern long hb_itemGetNL ( PHB_ITEM pItem );
extern void hb_itemGetNLen ( PHB_ITEM pItem, int * piWidth, int * piDec );
extern void * hb_itemGetPtr ( PHB_ITEM pItem );
extern PHB_ITEM hb_itemNew ( PHB_ITEM pNull );
extern void hb_itemInit ( PHB_ITEM pItem );
extern USHORT hb_itemPCount ( void );
extern PHB_ITEM hb_itemParam ( USHORT uiParam );
extern PHB_ITEM hb_itemPutC ( PHB_ITEM pItem, char * szText );

View File

@@ -50,7 +50,7 @@
#define INKEY_RUP 16
#define INKEY_KEYBOARD 128
#define INKEY_ALL 159
#define INKEY_RAW 256
#define INKEY_RAW 256 /* Harbour extension */
/* Mouse events */

View File

@@ -82,22 +82,22 @@
#define _SET_MCENTER 37
#define _SET_SCROLLBREAK 38
#define _SET_EVENTMASK 39
#define _SET_EVENTMASK 39 /* CA-Cl*pper 5.3 compatible */
#define _SET_VIDEOMODE 40
#define _SET_VIDEOMODE 40 /* CA-Cl*pper 5.3 compatible */
#define _SET_MBLOCKSIZE 41
#define _SET_MFILEEXT 42
#define _SET_MBLOCKSIZE 41 /* CA-Cl*pper 5.3 compatible */
#define _SET_MFILEEXT 42 /* CA-Cl*pper 5.3 compatible */
#define _SET_STRICTREAD 43
#define _SET_OPTIMIZE 44
#define _SET_AUTOPEN 45
#define _SET_AUTORDER 46
#define _SET_AUTOSHARE 47
#define _SET_STRICTREAD 43 /* CA-Cl*pper 5.3 compatible */
#define _SET_OPTIMIZE 44 /* CA-Cl*pper 5.3 compatible */
#define _SET_AUTOPEN 45 /* CA-Cl*pper 5.3 compatible */
#define _SET_AUTORDER 46 /* CA-Cl*pper 5.3 compatible */
#define _SET_AUTOSHARE 47 /* CA-Cl*pper 5.3 compatible */
#define _SET_COUNT 47
#define _SET_LANGUAGE 100
#define _SET_LANGUAGE 100 /* Harbour extension */
#define HB_SET_BASE 100
#define HB_SET_COUNT 1

View File

@@ -36,16 +36,10 @@
#ifndef _SIMPLEIO_CH
#define _SIMPLEIO_CH
#command ? [ <xList,...> ] => ;
( OutStd( hb_OSNewLine() ) [, OutStd(<xList>)] )
#command ? [ <xList,...> ] => ( OutStd( hb_OSNewLine() ) [, OutStd( <xList> ) ] )
#command ?? [ <xList,...> ] => OutStd( <xList> )
#command ?? [ <xList,...> ] => ;
OutStd( <xList> )
#command ACCEPT TO <idVar> => ;
<idVar> := StrTran( FReadStr( 0, 256 ), hb_OSNewLine() )
#command ACCEPT <cPrompt> TO <idVar> => ;
? <cPrompt> ; ACCEPT TO <idVar>
#command ACCEPT TO <idVar> => <idVar> := StrTran( FReadStr( 0, 256 ), hb_OSNewLine() )
#command ACCEPT <cPrompt> TO <idVar> => ? <cPrompt> ; ACCEPT TO <idVar>
#endif /* _SIMPLEIO_CH */

View File

@@ -102,7 +102,7 @@ HB_FUNC( ERRORBLOCK )
* NOTE: hb_itemClear() cannot be used to initialize an item because
* memory occupied by the item can contain garbage bits
*/
oldError.type = HB_IT_NIL;
hb_itemInit( &oldError );
hb_itemCopy( &oldError, &s_errorBlock );
if( pNewErrorBlock )
@@ -149,7 +149,7 @@ void hb_errInit( void )
* NOTE: hb_itemClear() cannot be used to initialize an item because
* memory occupied by the item can contain garbage bits
*/
s_errorBlock.type = HB_IT_NIL;
hb_itemInit( &s_errorBlock.type );
}
void hb_errExit( void )

View File

@@ -130,13 +130,13 @@ void hb_idleShutDown( void )
}
/* signal that the user code is in idle state */
HB_FUNC( HB_IAMIDLE )
HB_FUNC( HB_IDLESTATE )
{
hb_idleState();
}
/* add a new background task and return its handle */
HB_FUNC( HB_ADDIDLE )
HB_FUNC( HB_IDLEADD )
{
HB_ITEM_PTR pBlock = hb_param( 1, HB_IT_BLOCK );
@@ -164,11 +164,11 @@ HB_FUNC( HB_ADDIDLE )
}
/* Delete a task with given handle and return a codeblock with this task */
HB_FUNC( HB_DELIDLE )
HB_FUNC( HB_IDLEDEL )
{
BOOL bFound = FALSE;
if( s_pIdleTasks && ( hb_parinfo(1) & HB_IT_NUMERIC ) )
if( s_pIdleTasks && ( hb_parinfo( 1 ) & HB_IT_NUMERIC ) )
{
SHORT iTask;
ULONG ulID = hb_parnl( 1 ); /* TODO: access to pointers from harbour code */
@@ -177,7 +177,7 @@ HB_FUNC( HB_DELIDLE )
iTask = 0;
while( iTask < s_uiIdleMaxTask && !bFound )
{
if( ulID == ( ULONG )pItem->item.asBlock.value )
if( ulID == ( ULONG ) pItem->item.asBlock.value )
{
hb_gcUnlock( pItem->item.asBlock.value );
hb_itemReturn( pItem ); /* return a codeblock */
@@ -202,6 +202,7 @@ HB_FUNC( HB_DELIDLE )
++iTask;
}
}
if( !bFound )
hb_ret(); /* return NIL */
}

View File

@@ -74,35 +74,36 @@ FUNCTION __objGetMsgList( oObject, lDataMethod )
LOCAL aData
LOCAL n
LOCAL nLen
LOCAL lFoundDM // Found DATA ?
IF !ISOBJECT( oObject )
__errRT_BASE( EG_ARG, 3101, NIL, ProcName( 0 ) )
ENDIF
IF !ISLOGICAL( lDataMethod )
lDataMethod := .T.
lDataMethod := .T.
ENDIF
aInfo := aSort( oObject:ClassSel() )
aData := {}
n := 1
nLen := Len( aInfo )
aInfo := ASort( oObject:ClassSel() )
aData := {}
n := 1
nLen := Len( aInfo )
DO WHILE n <= nLen .AND. Substr( aInfo[ n ], 1, 1 ) != "_"
DO WHILE n <= nLen .AND. !( Substr( aInfo[ n ], 1, 1 ) == "_" )
/* If in range and no set function found yet ( set functions */
/* begin with a leading underscore ). */
lFoundDM := !Empty( AScan( aInfo, "_" + aInfo[ n ], n + 1 ) )
// If found -> DATA
// else METHOD
/* Find position of matching set function in array with all symbols */
IF lFoundDM == lDataMethod // If found -> DATA
// else METHOD
IF ( AScan( aInfo, {| tmp | tmp == ( "_" + aInfo[ n ] ) }, n + 1 ) != 0 ) == lDataMethod
AAdd( aData, aInfo[ n ] )
ENDIF
n++
ENDDO
RETURN aData
@@ -127,7 +128,7 @@ FUNCTION __objGetValueList( oObject, aExcept )
ENDIF
IF !ISARRAY( aExcept )
aExcept := {}
aExcept := {}
ENDIF
aDataSymbol := __objGetMsgList( oObject )
@@ -136,7 +137,7 @@ FUNCTION __objGetValueList( oObject, aExcept )
FOR n := 1 to nLen
cSymbol := aDataSymbol[ n ]
IF Empty( AScan( aExcept, cSymbol ) )
IF AScan( aExcept, {| tmp | tmp == cSymbol } ) == 0
AAdd( aData, { cSymbol, __objSendMsg( oObject, cSymbol ) } )
ENDIF
NEXT
@@ -178,11 +179,9 @@ FUNCTION __objAddData( oObject, cSymbol )
IF !ISOBJECT( oObject ) .OR. !ISCHARACTER( cSymbol )
__errRT_BASE( EG_ARG, 3101, NIL, ProcName( 0 ) )
ELSEIF !__objHasMsg( oObject, cSymbol ) .AND. ;
!__objHasMsg( oObject, "_" + cSymbol )
ELSEIF !__objHasMsg( oObject, cSymbol ) .AND. !__objHasMsg( oObject, "_" + cSymbol )
nSeq := __cls_IncData( oObject:ClassH ) // Allocate new Seq#
__clsAddMsg( oObject:ClassH, cSymbol, nSeq, HB_OO_MSG_DATA )
__clsAddMsg( oObject:ClassH, cSymbol, nSeq, HB_OO_MSG_DATA )
__clsAddMsg( oObject:ClassH, "_" + cSymbol, nSeq, HB_OO_MSG_DATA )
ENDIF

View File

@@ -101,10 +101,8 @@ ENDCLASS
// Returns EOL char (be it either CR or LF or both)
STATIC function WhichEOL(cString)
local nCRPos, nLFPos
nCRPos := At(Chr(13), cString)
nLFPos := At(Chr(10), cString)
local nCRPos := At(Chr(13), cString)
local nLFPos := At(Chr(10), cString)
if nCRPos > 0 .AND. nLFPos == 0
return Chr(13)
@@ -115,12 +113,9 @@ STATIC function WhichEOL(cString)
elseif nCRPos > 0 .AND. nLFPos == nCRPos + 1
return Chr(13) + Chr(10)
else
return HB_OSNewLine()
endif
return nil
return HB_OSNewLine()
// Converts a string to an array of strings splitting input string at EOL boundaries

View File

@@ -51,17 +51,16 @@
#define HB_OS_WIN_32_USED
/* NOTE: For OS/2. Must be ahead of any and all #include statements */
#define INCL_BASE
#define INCL_DOSMISC
#define INCL_DOSERRORS
#define INCL_DOSPROCESS
#ifndef __MPW__
#include <malloc.h>
#endif
#if (defined(__EMX__) && ! defined(__RSXNT__)) || defined(OS2) || defined(__OS2__) || defined(OS_2)
#define INCL_BASE
#define INCL_DOSMISC
#define INCL_DOSERRORS
#define INCL_DOSPROCESS
#endif
#include "hbapi.h"
#include "hbapierr.h"
#include "hbmemory.ch"
@@ -226,7 +225,7 @@ void * hb_xgrab( ULONG ulSize ) /* allocates fixed memory, exits on fail
}
}
s_lMemoryConsumed += ulSize;
s_lMemoryConsumed += ulSize;
if( s_lMemoryMaxConsumed < s_lMemoryConsumed )
s_lMemoryMaxConsumed = s_lMemoryConsumed;
s_lMemoryBlocks++;
@@ -440,6 +439,7 @@ void * hb_xmemcpy( void * pDestArg, void * pSourceArg, ULONG ulLen )
pDest += iCopySize;
pSource += iCopySize;
}
return pDestArg;
}
@@ -470,6 +470,7 @@ void * hb_xmemset( void * pDestArg, int iFill, ULONG ulLen )
memset( pDest, iFill, iSetSize );
pDest += iSetSize;
}
return pDestArg;
}
@@ -495,14 +496,11 @@ ULONG hb_xquery( USHORT uiMode )
#elif defined(HB_OS_OS2)
{
ULONG ulSysInfo = 0;
APIRET rc;
rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG));
if (rc != NO_ERROR) {
if( DosQuerySysInfo( QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof( ULONG ) ) != NO_ERROR )
ulResult = 0;
} else {
else
ulResult = ulSysInfo / 1024;
}
}
#else
ulResult = 9999;
@@ -519,14 +517,11 @@ ULONG hb_xquery( USHORT uiMode )
#elif defined(HB_OS_OS2)
{
ULONG ulSysInfo = 0;
APIRET rc;
rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG));
if (rc != NO_ERROR) {
if( DosQuerySysInfo( QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof( ULONG ) ) != NO_ERROR )
ulResult = 0;
} else {
ulResult = HB_MIN(ulSysInfo, ULONG_MAX) / 1024;
}
else
ulResult = HB_MIN( ulSysInfo, ULONG_MAX ) / 1024;
}
#else
ulResult = 9999;
@@ -543,14 +538,11 @@ ULONG hb_xquery( USHORT uiMode )
#elif defined(HB_OS_OS2)
{
ULONG ulSysInfo = 0;
APIRET rc;
rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG));
if (rc != NO_ERROR) {
if( DosQuerySysInfo( QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof( ULONG ) ) != NO_ERROR )
ulResult = 0;
} else {
else
ulResult = ulSysInfo / 1024;
}
}
#else
ulResult = 9999;
@@ -567,14 +559,11 @@ ULONG hb_xquery( USHORT uiMode )
#elif defined(HB_OS_OS2)
{
ULONG ulSysInfo = 0;
APIRET rc;
rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG));
if (rc != NO_ERROR) {
if( DosQuerySysInfo( QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof( ULONG ) ) != NO_ERROR )
ulResult = 0;
} else {
else
ulResult = ulSysInfo / 1024;
}
}
#else
ulResult = 9999;
@@ -599,14 +588,11 @@ ULONG hb_xquery( USHORT uiMode )
#elif defined(HB_OS_OS2)
{
ULONG ulSysInfo = 0;
APIRET rc;
rc = DosQuerySysInfo(QSV_MAXPRMEM, QSV_MAXPRMEM, &ulSysInfo, sizeof(ULONG));
if (rc != NO_ERROR) {
if( DosQuerySysInfo( QSV_MAXPRMEM, QSV_MAXPRMEM, &ulSysInfo, sizeof( ULONG ) ) != NO_ERROR )
ulResult = 0;
} else {
else
ulResult = ulSysInfo / 1024;
}
}
#else
ulResult = 9999;
@@ -630,11 +616,10 @@ ULONG hb_xquery( USHORT uiMode )
}
#elif defined(HB_OS_OS2)
{
/* 10/05/2000 - maurilio.longo@libero.it
There is no way to know how much a swap file can grow on an OS/2 system.
I think we should return free space on DASD media which contains swap
file */
ulResult = 0;
/* NOTE: There is no way to know how much a swap file can grow on an
OS/2 system. I think we should return free space on DASD
media which contains swap file [maurilio.longo] */
ulResult = 9999;
}
#else
ulResult = 9999;

View File

@@ -191,10 +191,9 @@ static void hb_vmReleaseLocalSymbols( void ); /* releases the memory of the
#endif
#endif
static void hb_vmProcessObjSymbols ( void ); /* process Harbour generated OBJ symbols */
void hb_vmProcessBorlandInitSegment( void ); /* process Borland _INIT_ segment functions
when not using Borland startup */
void hb_startup( void ); /* Harbour startup when not using a C compiler startup */
static void hb_vmProcessObjSymbols( void ); /* process Harbour generated OBJ symbols */
extern void hb_vmProcessBorlandInitSegment( void ); /* process Borland _INIT_ segment functions when not using Borland startup */
extern void hb_startup( void ); /* Harbour startup when not using a C compiler startup */
typedef struct
{
@@ -2750,15 +2749,6 @@ void hb_vmDo( USHORT uiParams )
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmDo()", NULL );
}
#if 0
if( ! HB_IS_NIL( pSelf ) )
{
/* QUESTION: Is this call needed ? [vszakats] */
hb_stackDispLocal();
hb_errInternal( IE_VMINVSYMBOL, NULL, "hb_vmDo()", NULL );
}
#endif
pItem->item.asSymbol.lineno = 0;
pItem->item.asSymbol.paramcnt = uiParams;
hb_stack.pBase = hb_stack.pItems + pItem->item.asSymbol.stackbase;
@@ -2857,15 +2847,6 @@ void hb_vmSend( USHORT uiParams )
hb_errInternal( IE_VMNOTSYMBOL, NULL, "hb_vmSend()", NULL );
}
#if 0
if( ! HB_IS_NIL( pSelf ) )
{
/* QUESTION: Is this call needed ? [vszakats] */
hb_stackDispLocal();
hb_errInternal( IE_VMINVSYMBOL, NULL, "hb_vmSend()", NULL );
}
#endif
pItem->item.asSymbol.lineno = 0;
pItem->item.asSymbol.paramcnt = uiParams;
hb_stack.pBase = hb_stack.pItems + pItem->item.asSymbol.stackbase;
@@ -2998,7 +2979,7 @@ HB_ITEM_PTR hb_vmEvalBlockV( HB_ITEM_PTR pBlock, USHORT uiArgCount, ... )
hb_vmPush( pBlock );
va_start( va, uiArgCount );
for( i=1; i<= uiArgCount; i++ )
for( i = 1; i <= uiArgCount; i++ )
hb_vmPush( va_arg( va, PHB_ITEM ) );
va_end( va );

View File

@@ -1003,6 +1003,14 @@ char * hb_itemTypeStr( PHB_ITEM pItem )
/* Internal API, not standard Clipper */
void hb_itemInit( PHB_ITEM pItem )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemInit(%p)", pItem));
if( pItem )
pItem->type = HB_IT_NIL;
}
void hb_itemClear( PHB_ITEM pItem )
{
HB_TRACE(HB_TR_DEBUG, ("hb_itemClear(%p)", pItem));

View File

@@ -1,6 +1,7 @@
//
// $Id$
//
#include "hbmemory.ch"
FUNCTION MAIN
@@ -15,16 +16,16 @@ LOCAL nPrev:=SECONDS()
? "Can you see it ??? :) Press ESC or wait 5 seconds"
?
?
nH1 = HB_ADDIDLE( {|| DEVPOS(0,01), DEVOUT( TIME() )} )
nH2 = HB_ADDIDLE( {|| DEVPOS(0,21), TEST(), DEVOUT( MEMORY(HB_MEM_USED) )} )
nH3 = HB_ADDIDLE( {|| DEVPOS(0,41), IIF(n=4,n:=1,n++),DEVOUT(aSign[n]) } )
nH4 = HB_ADDIDLE( {|| DEVPOS(0,61), DEVOUT( 1000*(SECONDS()-nPrev) ), nPrev:=SECONDS()} )
nH1 = HB_IDLEADD( {|| DEVPOS(0,01), DEVOUT( TIME() )} )
nH2 = HB_IDLEADD( {|| DEVPOS(0,21), TEST(), DEVOUT( MEMORY(HB_MEM_USED) )} )
nH3 = HB_IDLEADD( {|| DEVPOS(0,41), IIF(n=4,n:=1,n++),DEVOUT(aSign[n]) } )
nH4 = HB_IDLEADD( {|| DEVPOS(0,61), DEVOUT( 1000*(SECONDS()-nPrev) ), nPrev:=SECONDS()} )
INKEY( 10 )
HB_DELIDLE( nH3 )
HB_DELIDLE( nH2 )
HB_DELIDLE( nH1 )
HB_DELIDLE( nH4 )
HB_IDLEDEL( nH3 )
HB_IDLEDEL( nH2 )
HB_IDLEDEL( nH1 )
HB_IDLEDEL( nH4 )
RETURN 1
@@ -43,4 +44,5 @@ LOCAL cb
// EVAL( cb, 20 )
// INKEY( .5 )
RETURN
RETURN