2010-07-06 21:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbrun/hbrun.prg
! Don't search passed program in PATH and hbrun dir, if
program name has path component.
* contrib/xhb/xhbenum.c
* contrib/xhb/xhbqself.c
* contrib/xhb/xhbwith.c
* contrib/xhb/xhberrc.c
! Fixed msvc64 warnings after HB_SIZE extension in stack API.
* contrib/make.hbs
+ Added logic to protect against case when 'clean install'
is used but hbrun or hbmk2 isn't available when launching
the make process. In this case 'clean' phase won't be executed
for contribs, which is solved by forcing a -rebuild in
'install' phase.
* src/vm/strapi.c
* src/vm/runner.c
* src/vm/itemapi.c
* src/vm/asort.c
* src/vm/hvm.c
* src/vm/arrays.c
* src/vm/memvars.c
* src/vm/set.c
* src/vm/classes.c
* src/rtl/lennum.c
* src/rtl/strcase.c
* src/rtl/replic.c
* src/rtl/padr.c
* src/rtl/padc.c
* src/rtl/strtran.c
* src/rtl/strtoexp.c
* src/rtl/padl.c
* src/rtl/saverest.c
* src/rtl/right.c
* src/rtl/philes.c
* src/rtl/mlcfunc.c
* src/rtl/left.c
* src/rtl/xsavescr.c
* src/rtl/setkey.c
* src/rtl/stuff.c
* src/rtl/trace.c
* src/rtl/samples.c
* src/rtl/inkeyapi.c
* src/rtl/inkey.c
* src/rtl/mtran.c
* src/rtl/colorind.c
* src/rtl/rat.c
* include/hbapi.h
* include/hbapistr.h
* Renamed HB_SIZE variables to have 'n' prefix.
(verified to generate the same objects as before)
* src/rtl/philes.c
* Changed hb_retnint()/hb_retni() to hb_retns().
* contrib/hbgd/gdwrp.c
* Formatting.
This commit is contained in:
@@ -16,6 +16,67 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2010-07-06 21:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* utils/hbrun/hbrun.prg
|
||||
! Don't search passed program in PATH and hbrun dir, if
|
||||
program name has path component.
|
||||
|
||||
* contrib/xhb/xhbenum.c
|
||||
* contrib/xhb/xhbqself.c
|
||||
* contrib/xhb/xhbwith.c
|
||||
* contrib/xhb/xhberrc.c
|
||||
! Fixed msvc64 warnings after HB_SIZE extension in stack API.
|
||||
|
||||
* contrib/make.hbs
|
||||
+ Added logic to protect against case when 'clean install'
|
||||
is used but hbrun or hbmk2 isn't available when launching
|
||||
the make process. In this case 'clean' phase won't be executed
|
||||
for contribs, which is solved by forcing a -rebuild in
|
||||
'install' phase.
|
||||
|
||||
* src/vm/strapi.c
|
||||
* src/vm/runner.c
|
||||
* src/vm/itemapi.c
|
||||
* src/vm/asort.c
|
||||
* src/vm/hvm.c
|
||||
* src/vm/arrays.c
|
||||
* src/vm/memvars.c
|
||||
* src/vm/set.c
|
||||
* src/vm/classes.c
|
||||
* src/rtl/lennum.c
|
||||
* src/rtl/strcase.c
|
||||
* src/rtl/replic.c
|
||||
* src/rtl/padr.c
|
||||
* src/rtl/padc.c
|
||||
* src/rtl/strtran.c
|
||||
* src/rtl/strtoexp.c
|
||||
* src/rtl/padl.c
|
||||
* src/rtl/saverest.c
|
||||
* src/rtl/right.c
|
||||
* src/rtl/philes.c
|
||||
* src/rtl/mlcfunc.c
|
||||
* src/rtl/left.c
|
||||
* src/rtl/xsavescr.c
|
||||
* src/rtl/setkey.c
|
||||
* src/rtl/stuff.c
|
||||
* src/rtl/trace.c
|
||||
* src/rtl/samples.c
|
||||
* src/rtl/inkeyapi.c
|
||||
* src/rtl/inkey.c
|
||||
* src/rtl/mtran.c
|
||||
* src/rtl/colorind.c
|
||||
* src/rtl/rat.c
|
||||
* include/hbapi.h
|
||||
* include/hbapistr.h
|
||||
* Renamed HB_SIZE variables to have 'n' prefix.
|
||||
(verified to generate the same objects as before)
|
||||
|
||||
* src/rtl/philes.c
|
||||
* Changed hb_retnint()/hb_retni() to hb_retns().
|
||||
|
||||
* contrib/hbgd/gdwrp.c
|
||||
* Formatting.
|
||||
|
||||
2010-07-06 16:32 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/hbwapi.h
|
||||
* contrib/hbwin/wapi_winbase.c
|
||||
|
||||
@@ -57,16 +57,16 @@
|
||||
|
||||
/* NOTE: Do some initialization required by the GD headers. */
|
||||
#if defined( HB_OS_WIN )
|
||||
#if !defined( WIN32 )
|
||||
#define WIN32
|
||||
#endif
|
||||
#if !defined( BGDWIN32 )
|
||||
#define BGDWIN32
|
||||
#endif
|
||||
# if !defined( WIN32 )
|
||||
# define WIN32
|
||||
#endif
|
||||
# if !defined( BGDWIN32 )
|
||||
# define BGDWIN32
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "gd.h"
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define F_NAME 1 /* File name */
|
||||
#define F_ATTR 5 /* File attribute */
|
||||
|
||||
#define _ACT_EXIT 0
|
||||
#define _ACT_CLEAN 1
|
||||
#define _ACT_INC 2
|
||||
#define _ACT_INC_INST 3
|
||||
@@ -141,6 +142,7 @@ PROCEDURE Main( ... )
|
||||
LOCAL lFilterNegative
|
||||
|
||||
LOCAL aParams
|
||||
LOCAL aGNUMakeParams
|
||||
LOCAL tmp
|
||||
LOCAL nAction
|
||||
|
||||
@@ -166,15 +168,15 @@ PROCEDURE Main( ... )
|
||||
/*
|
||||
Workflow translation from GNU Make to hbmk2:
|
||||
|
||||
GNU Make parameter HB_MAKECMDGOALS nAction hbmk2 options
|
||||
-- -------------- ---------- ---------------- -------------- -------------------------
|
||||
#1 clean clean clean _ACT_CLEAN -clean
|
||||
#2 install install install _ACT_INC_INST -inc -instpath=
|
||||
#3 clean install clean clean install _ACT_CLEAN -clean
|
||||
install clean install _ACT_INC_INST -inc -instpath=
|
||||
#4 install clean install install clean _ACT_INC_INST -inc -instpath=
|
||||
clean install clean _ACT_CLEAN -clean
|
||||
#5 all _ACT_INC -inc
|
||||
GNU Make parameter HB_MAKECMDGOALS nAction hbmk2 options
|
||||
-- -------------- ---------- ---------------- ---------------------- -------------------------
|
||||
#1 clean clean clean _ACT_CLEAN -clean
|
||||
#2 install install install _ACT_INC_INST -inc -instpath=
|
||||
#3 clean install clean clean install _ACT_CLEAN -clean
|
||||
install clean install _ACT_INC_REBUILD_INST -inc -instpath= -rebuild
|
||||
#4 install clean install install clean _ACT_INC_INST -inc -instpath=
|
||||
clean install clean _ACT_CLEAN -clean
|
||||
#5 all _ACT_INC -inc
|
||||
|
||||
*/
|
||||
|
||||
@@ -183,16 +185,39 @@ PROCEDURE Main( ... )
|
||||
s_lTest := "test" $ hb_cmdLine()
|
||||
|
||||
aParams := hb_AParams()
|
||||
aGNUMakeParams := hb_ATokens( Lower( GetEnv( "HB_MAKECMDGOALS" ) ) )
|
||||
|
||||
DO CASE
|
||||
CASE AScan( aParams, "clean" ) > 0
|
||||
nAction := _ACT_CLEAN
|
||||
IF AScan( aGNUMakeParams, "clean" ) > 0 .AND. ;
|
||||
AScan( aGNUMakeParams, "install" ) > 0 .AND. ;
|
||||
AScan( aGNUMakeParams, "install" ) > AScan( aGNUMakeParams, "clean" )
|
||||
nAction := _ACT_CLEAN
|
||||
ELSE
|
||||
nAction := _ACT_CLEAN
|
||||
ENDIF
|
||||
CASE AScan( aParams, "install" ) > 0
|
||||
nAction := _ACT_INC_INST
|
||||
IF AScan( aGNUMakeParams, "clean" ) > 0 .AND. ;
|
||||
AScan( aGNUMakeParams, "install" ) > 0 .AND. ;
|
||||
AScan( aGNUMakeParams, "install" ) > AScan( aGNUMakeParams, "clean" )
|
||||
/* Use rebuild mode. This is needed because the clean phase
|
||||
might not have been called previously by GNU Make, f.e.
|
||||
because hbrun or hbmk2 wasn't available. -rebuild is
|
||||
costless, so we do it to make sure to build cleanly.
|
||||
[vszakats] */
|
||||
nAction := _ACT_INC_REBUILD_INST
|
||||
ELSE
|
||||
nAction := _ACT_INC_INST
|
||||
ENDIF
|
||||
OTHERWISE
|
||||
nAction := _ACT_INC
|
||||
ENDCASE
|
||||
|
||||
IF nAction == _ACT_EXIT
|
||||
ErrorLevel( 0 )
|
||||
RETURN
|
||||
ENDIF
|
||||
|
||||
/* Check if the requirements are met and if we have anything to do */
|
||||
|
||||
IF Empty( GetEnv( "HB_PLATFORM" ) ) .OR. ;
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
|
||||
HB_FUNC( HB_ENUMINDEX )
|
||||
{
|
||||
HB_LONG lFuncOffset = hb_stackBaseOffset() - 1, lIndex = 0;
|
||||
HB_ISIZ lFuncOffset = hb_stackBaseOffset() - 1, lIndex = 0;
|
||||
while( --lFuncOffset > 0 )
|
||||
{
|
||||
PHB_ITEM pItem = hb_stackItem( lFuncOffset );
|
||||
@@ -67,5 +67,5 @@ HB_FUNC( HB_ENUMINDEX )
|
||||
break;
|
||||
}
|
||||
}
|
||||
hb_retnl( lIndex );
|
||||
hb_retns( lIndex );
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ HB_FUNC( SETUNHANDLEDEXCEPTIONFILTER )
|
||||
|
||||
pDefaultHandler = SetUnhandledExceptionFilter( PRGUnhandledExceptionFilter );
|
||||
|
||||
hb_retnl( ( long ) pDefaultHandler );
|
||||
hb_retptr( pDefaultHandler );
|
||||
#endif
|
||||
/* Dummy in Harbour */
|
||||
hb_retnl( 0 );
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
HB_FUNC( HB_QSELF )
|
||||
{
|
||||
HB_LONG lOffset = hb_stackBaseProcOffset( 1 );
|
||||
HB_ISIZ lOffset = hb_stackBaseProcOffset( 1 );
|
||||
|
||||
if( lOffset > 0 )
|
||||
{
|
||||
|
||||
@@ -56,13 +56,13 @@
|
||||
#include "hbapierr.h"
|
||||
#include "hbstack.h"
|
||||
|
||||
static PHB_ITEM hb_vmWithObjectItem( HB_LONG lLevel )
|
||||
static PHB_ITEM hb_vmWithObjectItem( HB_ISIZ lLevel )
|
||||
{
|
||||
HB_LONG lOffset = hb_stackWithObjectOffset();
|
||||
HB_ISIZ lOffset = hb_stackWithObjectOffset();
|
||||
|
||||
while( lOffset && lLevel > 0 )
|
||||
{
|
||||
HB_LONG * plOffset = ( HB_LONG * ) hb_itemGetPtr( hb_stackItem( lOffset + 1 ) );
|
||||
HB_ISIZ * plOffset = ( HB_ISIZ * ) hb_itemGetPtr( hb_stackItem( lOffset + 1 ) );
|
||||
if( !plOffset )
|
||||
break;
|
||||
--lLevel;
|
||||
@@ -72,13 +72,13 @@ static PHB_ITEM hb_vmWithObjectItem( HB_LONG lLevel )
|
||||
return ( lOffset && !lLevel ) ? hb_stackItem( lOffset ) : NULL;
|
||||
}
|
||||
|
||||
static HB_LONG hb_vmWithObjectCount( void )
|
||||
static HB_ISIZ hb_vmWithObjectCount( void )
|
||||
{
|
||||
HB_LONG lOffset = hb_stackWithObjectOffset(), lCount = 0;
|
||||
HB_ISIZ lOffset = hb_stackWithObjectOffset(), lCount = 0;
|
||||
|
||||
while( lOffset )
|
||||
{
|
||||
HB_LONG * plOffset = ( HB_LONG * ) hb_itemGetPtr( hb_stackItem( lOffset + 1 ) );
|
||||
HB_ISIZ * plOffset = ( HB_ISIZ * ) hb_itemGetPtr( hb_stackItem( lOffset + 1 ) );
|
||||
if( !plOffset )
|
||||
break;
|
||||
++lCount;
|
||||
@@ -92,12 +92,12 @@ static HB_LONG hb_vmWithObjectCount( void )
|
||||
|
||||
HB_FUNC( HB_QWITH )
|
||||
{
|
||||
hb_itemReturn( hb_vmWithObjectItem( hb_parnl( 1 ) ) );
|
||||
hb_itemReturn( hb_vmWithObjectItem( hb_parns( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_WITHOBJECTCOUNTER )
|
||||
{
|
||||
hb_retnl( hb_vmWithObjectCount() );
|
||||
hb_retns( hb_vmWithObjectCount() );
|
||||
}
|
||||
|
||||
HB_FUNC( HB_RESETWITH )
|
||||
|
||||
@@ -423,8 +423,8 @@ typedef struct _HB_ITEM
|
||||
typedef struct _HB_BASEARRAY
|
||||
{
|
||||
PHB_ITEM pItems; /* pointer to the array items */
|
||||
HB_SIZE ulLen; /* number of items in the array */
|
||||
HB_SIZE ulAllocated; /* number of allocated items */
|
||||
HB_SIZE nLen; /* number of items in the array */
|
||||
HB_SIZE nAllocated; /* number of allocated items */
|
||||
HB_USHORT uiClass; /* offset to the classes base if it is an object */
|
||||
HB_USHORT uiPrevCls; /* for fixing after access super */
|
||||
} HB_BASEARRAY, * PHB_BASEARRAY, * HB_BASEARRAY_PTR;
|
||||
|
||||
@@ -59,69 +59,69 @@
|
||||
HB_EXTERN_BEGIN
|
||||
|
||||
extern HB_EXPORT HB_SIZE hb_wstrlen( const HB_WCHAR * szText );
|
||||
extern HB_EXPORT HB_SIZE hb_wstrnlen( const HB_WCHAR * szText, HB_SIZE count );
|
||||
extern HB_EXPORT HB_SIZE hb_wstrnlen( const HB_WCHAR * szText, HB_SIZE nCount );
|
||||
extern HB_EXPORT int hb_wstrcmp( const HB_WCHAR * s1, const HB_WCHAR * s2 );
|
||||
extern HB_EXPORT int hb_wstrncmp( const HB_WCHAR * s1, const HB_WCHAR * s2, HB_SIZE count );
|
||||
extern HB_EXPORT int hb_wstrncmp( const HB_WCHAR * s1, const HB_WCHAR * s2, HB_SIZE nCount );
|
||||
extern HB_EXPORT HB_WCHAR * hb_wstrdup( const HB_WCHAR * szText );
|
||||
extern HB_EXPORT HB_WCHAR * hb_wstrndup( const HB_WCHAR * szText, HB_SIZE ulLen );
|
||||
extern HB_EXPORT HB_WCHAR * hb_wstrndup( const HB_WCHAR * szText, HB_SIZE nLen );
|
||||
|
||||
extern HB_EXPORT char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE nLen );
|
||||
extern HB_EXPORT HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE nLen );
|
||||
extern HB_EXPORT const char * hb_strnull( const char * str );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_wstrnull( const HB_WCHAR * str );
|
||||
|
||||
|
||||
extern HB_EXPORT void hb_strfree( void * hString );
|
||||
|
||||
extern HB_EXPORT const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_itemGetStrU16( PHB_ITEM pItem, int iEndian, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZE * pnLen );
|
||||
extern HB_EXPORT const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pnLen );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_itemGetStrU16( PHB_ITEM pItem, int iEndian, void ** phString, HB_SIZE * pnLen );
|
||||
|
||||
extern HB_EXPORT HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE ulSize );
|
||||
extern HB_EXPORT HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE ulSize );
|
||||
extern HB_EXPORT HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, HB_SIZE ulSize );
|
||||
extern HB_EXPORT HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE nSize );
|
||||
extern HB_EXPORT HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE nSize );
|
||||
extern HB_EXPORT HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, HB_SIZE nSize );
|
||||
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrLen( PHB_ITEM pItem, void * cdp, const char * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrLenUTF8( PHB_ITEM pItem, const char * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrLenU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrLen( PHB_ITEM pItem, void * cdp, const char * pStr, HB_SIZE nLen );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrLenUTF8( PHB_ITEM pItem, const char * pStr, HB_SIZE nLen );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrLenU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr, HB_SIZE nLen );
|
||||
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStr( PHB_ITEM pItem, void * cdp, const char * pStr );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrUTF8( PHB_ITEM pItem, const char * pStr );
|
||||
extern HB_EXPORT PHB_ITEM hb_itemPutStrU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr );
|
||||
|
||||
|
||||
extern HB_EXPORT const char * hb_arrayGetStr( PHB_ITEM pArray, HB_SIZE ulIndex, void * cdp, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const char * hb_arrayGetStrUTF8( PHB_ITEM pArray, HB_SIZE ulIndex, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_arrayGetStrU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const char * hb_arrayGetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, void ** phString, HB_SIZE * pnLen );
|
||||
extern HB_EXPORT const char * hb_arrayGetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, void ** phString, HB_SIZE * pnLen );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_arrayGetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, void ** phString, HB_SIZE * pnLen );
|
||||
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrLen( PHB_ITEM pArray, HB_SIZE ulIndex, void * cdp, const char * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrLenUTF8( PHB_ITEM pArray, HB_SIZE ulIndex, const char * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian, const HB_WCHAR * pStr, HB_SIZE ulLen );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrLen( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char * pStr, HB_SIZE nLen );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrLenUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const char * pStr, HB_SIZE nLen );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, const HB_WCHAR * pStr, HB_SIZE nLen );
|
||||
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStr( PHB_ITEM pArray, HB_SIZE ulIndex, void * cdp, const char * pStr );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrUTF8( PHB_ITEM pArray, HB_SIZE ulIndex, const char * pStr );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian, const HB_WCHAR * pStr );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char * pStr );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const char * pStr );
|
||||
extern HB_EXPORT HB_BOOL hb_arraySetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, const HB_WCHAR * pStr );
|
||||
|
||||
|
||||
extern HB_EXPORT const char * hb_parstr( int iParam, void * cdp, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const char * hb_parstr_utf8( int iParam, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_parstr_u16( int iParam, int iEndian, void ** phString, HB_SIZE * pulLen );
|
||||
extern HB_EXPORT const char * hb_parstr( int iParam, void * cdp, void ** phString, HB_SIZE * pnLen );
|
||||
extern HB_EXPORT const char * hb_parstr_utf8( int iParam, void ** phString, HB_SIZE * pnLen );
|
||||
extern HB_EXPORT const HB_WCHAR * hb_parstr_u16( int iParam, int iEndian, void ** phString, HB_SIZE * pnLen );
|
||||
|
||||
extern HB_EXPORT void hb_retstr( void * cdp, const char * szText );
|
||||
extern HB_EXPORT void hb_retstr_utf8( const char * szText );
|
||||
extern HB_EXPORT void hb_retstr_u16( int iEndian, const HB_WCHAR * szText );
|
||||
|
||||
extern HB_EXPORT void hb_retstrlen( void * cdp, const char * szText, HB_SIZE ulLen );
|
||||
extern HB_EXPORT void hb_retstrlen_utf8( const char * szText, HB_SIZE ulLen );
|
||||
extern HB_EXPORT void hb_retstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE ulLen );
|
||||
extern HB_EXPORT void hb_retstrlen( void * cdp, const char * szText, HB_SIZE nLen );
|
||||
extern HB_EXPORT void hb_retstrlen_utf8( const char * szText, HB_SIZE nLen );
|
||||
extern HB_EXPORT void hb_retstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE nLen );
|
||||
|
||||
extern HB_EXPORT int hb_storstr( void * cdp, const char * szText, int iParam );
|
||||
extern HB_EXPORT int hb_storstr_utf8( const char * szText, int iParam );
|
||||
extern HB_EXPORT int hb_storstr_u16( int iEndian, const HB_WCHAR * szText, int iParam );
|
||||
|
||||
extern HB_EXPORT int hb_storstrlen( void * cdp, const char * szText, HB_SIZE ulLen, int iParam );
|
||||
extern HB_EXPORT int hb_storstrlen_utf8( const char * szText, HB_SIZE ulLen, int iParam );
|
||||
extern HB_EXPORT int hb_storstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE ulLen, int iParam );
|
||||
extern HB_EXPORT int hb_storstrlen( void * cdp, const char * szText, HB_SIZE nLen, int iParam );
|
||||
extern HB_EXPORT int hb_storstrlen_utf8( const char * szText, HB_SIZE nLen, int iParam );
|
||||
extern HB_EXPORT int hb_storstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE nLen, int iParam );
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -57,14 +57,14 @@ HB_FUNC( HB_COLORINDEX )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISNUM( 2 ) )
|
||||
{
|
||||
const char * pszColor = hb_parc( 1 );
|
||||
HB_SIZE ulColorPos;
|
||||
HB_SIZE ulColorLen;
|
||||
HB_SIZE nColorPos;
|
||||
HB_SIZE nColorLen;
|
||||
int iColorIndex = hb_parni( 2 );
|
||||
|
||||
/* Skip the given number of commas */
|
||||
for( ulColorPos = 0; pszColor[ ulColorPos ] != '\0' && iColorIndex > 0; ulColorPos++ )
|
||||
for( nColorPos = 0; pszColor[ nColorPos ] != '\0' && iColorIndex > 0; nColorPos++ )
|
||||
{
|
||||
if( pszColor[ ulColorPos ] == ',' )
|
||||
if( pszColor[ nColorPos ] == ',' )
|
||||
iColorIndex--;
|
||||
}
|
||||
|
||||
@@ -72,22 +72,22 @@ HB_FUNC( HB_COLORINDEX )
|
||||
if( iColorIndex == 0 )
|
||||
{
|
||||
/* Skip the spaces after the comma */
|
||||
while( pszColor[ ulColorPos ] == ' ' )
|
||||
ulColorPos++;
|
||||
while( pszColor[ nColorPos ] == ' ' )
|
||||
nColorPos++;
|
||||
|
||||
/* Search for next comma or end of string */
|
||||
ulColorLen = 0;
|
||||
while( pszColor[ ulColorPos + ulColorLen ] != '\0' &&
|
||||
pszColor[ ulColorPos + ulColorLen ] != ',' )
|
||||
ulColorLen++;
|
||||
nColorLen = 0;
|
||||
while( pszColor[ nColorPos + nColorLen ] != '\0' &&
|
||||
pszColor[ nColorPos + nColorLen ] != ',' )
|
||||
nColorLen++;
|
||||
|
||||
/* Skip the trailing spaces */
|
||||
while( ulColorLen > 0 &&
|
||||
pszColor[ ulColorPos + ulColorLen - 1 ] == ' ' )
|
||||
ulColorLen--;
|
||||
while( nColorLen > 0 &&
|
||||
pszColor[ nColorPos + nColorLen - 1 ] == ' ' )
|
||||
nColorLen--;
|
||||
|
||||
/* Return the string */
|
||||
hb_retclen( pszColor + ulColorPos, ulColorLen );
|
||||
hb_retclen( pszColor + nColorPos, nColorLen );
|
||||
}
|
||||
else
|
||||
hb_retc_null();
|
||||
|
||||
@@ -112,20 +112,20 @@ HB_FUNC( HB_KEYPUT )
|
||||
else if( HB_ISARRAY( 1 ) )
|
||||
{
|
||||
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
|
||||
HB_SIZE ulIndex;
|
||||
HB_SIZE ulElements = hb_arrayLen( pArray );
|
||||
HB_SIZE nIndex;
|
||||
HB_SIZE nElements = hb_arrayLen( pArray );
|
||||
|
||||
for( ulIndex = 1; ulIndex <= ulElements; ++ulIndex )
|
||||
for( nIndex = 1; nIndex <= nElements; ++nIndex )
|
||||
{
|
||||
HB_TYPE type = hb_arrayGetType( pArray, ulIndex );
|
||||
HB_TYPE type = hb_arrayGetType( pArray, nIndex );
|
||||
|
||||
if( type & HB_IT_NUMERIC )
|
||||
{
|
||||
hb_inkeyPut( hb_arrayGetNI( pArray, ulIndex ) );
|
||||
hb_inkeyPut( hb_arrayGetNI( pArray, nIndex ) );
|
||||
}
|
||||
else if( type & HB_IT_STRING )
|
||||
{
|
||||
hb_inkeySetText( hb_arrayGetCPtr( pArray, ulIndex ), hb_arrayGetCLen( pArray, ulIndex ) );
|
||||
hb_inkeySetText( hb_arrayGetCPtr( pArray, nIndex ), hb_arrayGetCLen( pArray, nIndex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -144,20 +144,20 @@ HB_FUNC( HB_KEYINS )
|
||||
else if( HB_ISARRAY( 1 ) )
|
||||
{
|
||||
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
|
||||
HB_SIZE ulIndex;
|
||||
HB_SIZE ulElements = hb_arrayLen( pArray );
|
||||
HB_SIZE nIndex;
|
||||
HB_SIZE nElements = hb_arrayLen( pArray );
|
||||
|
||||
for( ulIndex = 1; ulIndex <= ulElements; ++ulIndex )
|
||||
for( nIndex = 1; nIndex <= nElements; ++nIndex )
|
||||
{
|
||||
HB_TYPE type = hb_arrayGetType( pArray, ulIndex );
|
||||
HB_TYPE type = hb_arrayGetType( pArray, nIndex );
|
||||
|
||||
if( type & HB_IT_NUMERIC )
|
||||
{
|
||||
hb_inkeyIns( hb_arrayGetNI( pArray, ulIndex ) );
|
||||
hb_inkeyIns( hb_arrayGetNI( pArray, nIndex ) );
|
||||
}
|
||||
else if( type & HB_IT_STRING )
|
||||
{
|
||||
hb_inkeySetText( hb_arrayGetCPtr( pArray, ulIndex ), hb_arrayGetCLen( pArray, ulIndex ) );
|
||||
hb_inkeySetText( hb_arrayGetCPtr( pArray, nIndex ), hb_arrayGetCLen( pArray, nIndex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -183,4 +183,3 @@ HB_FUNC( HB_SETLASTKEY )
|
||||
if( HB_ISNUM( 1 ) )
|
||||
hb_retni( hb_inkeySetLast( hb_parni( 1 ) ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -158,16 +158,16 @@ int hb_inkeySetLast( int iKey )
|
||||
return iLast;
|
||||
}
|
||||
|
||||
void hb_inkeySetText( const char * szText, HB_SIZE ulLen )
|
||||
void hb_inkeySetText( const char * szText, HB_SIZE nLen )
|
||||
{
|
||||
PHB_GT pGT;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_inkeySetText(%s,%" HB_PFS "u)", szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_inkeySetText(%s,%" HB_PFS "u)", szText, nLen));
|
||||
|
||||
pGT = hb_gt_Base();
|
||||
if( pGT )
|
||||
{
|
||||
HB_GTSELF_INKEYSETTEXT( pGT, szText, ulLen );
|
||||
HB_GTSELF_INKEYSETTEXT( pGT, szText, nLen );
|
||||
hb_gt_BaseFree( pGT );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,16 +62,16 @@ HB_FUNC( LEFT )
|
||||
|
||||
if( pText && HB_ISNUM( 2 ) )
|
||||
{
|
||||
HB_ISIZ lLen = hb_parns( 2 );
|
||||
if( lLen <= 0 )
|
||||
HB_ISIZ nLen = hb_parns( 2 );
|
||||
if( nLen <= 0 )
|
||||
hb_retc_null();
|
||||
else
|
||||
{
|
||||
HB_SIZE ulText = hb_itemGetCLen( pText );
|
||||
if( ( HB_SIZE ) lLen >= ulText )
|
||||
HB_SIZE nText = hb_itemGetCLen( pText );
|
||||
if( ( HB_SIZE ) nLen >= nText )
|
||||
hb_itemReturn( pText );
|
||||
else
|
||||
hb_retclen( hb_itemGetCPtr( pText ), lLen );
|
||||
hb_retclen( hb_itemGetCPtr( pText ), nLen );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
HB_FUNC( LENNUM )
|
||||
{
|
||||
PHB_ITEM pNumber = hb_param( 1, HB_IT_NUMERIC );
|
||||
HB_SIZE ulLen = 0;
|
||||
HB_SIZE nLen = 0;
|
||||
|
||||
if( pNumber )
|
||||
{
|
||||
@@ -64,11 +64,11 @@ HB_FUNC( LENNUM )
|
||||
|
||||
if( pszString )
|
||||
{
|
||||
ulLen = strlen( pszString );
|
||||
hb_strLTrim( pszString, &ulLen );
|
||||
nLen = strlen( pszString );
|
||||
hb_strLTrim( pszString, &nLen );
|
||||
hb_xfree( pszString );
|
||||
}
|
||||
}
|
||||
|
||||
hb_retns( ulLen );
|
||||
hb_retns( nLen );
|
||||
}
|
||||
|
||||
@@ -57,98 +57,98 @@
|
||||
typedef struct
|
||||
{
|
||||
const char * szEOL;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
} HB_EOL_INFO, * PHB_EOL_INFO;
|
||||
|
||||
static int hb_mlEol( const char * pszString, HB_SIZE ulLen,
|
||||
static int hb_mlEol( const char * pszString, HB_SIZE nLen,
|
||||
PHB_EOL_INFO pEOLs, int iEOLs )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; i < iEOLs; ++i )
|
||||
{
|
||||
if( ulLen >= pEOLs[ i ].ulLen &&
|
||||
memcmp( pszString, pEOLs[ i ].szEOL, pEOLs[ i ].ulLen ) == 0 )
|
||||
if( nLen >= pEOLs[ i ].nLen &&
|
||||
memcmp( pszString, pEOLs[ i ].szEOL, pEOLs[ i ].nLen ) == 0 )
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static HB_SIZE hb_mlGetLine( const char * pszString, HB_SIZE ulLen, HB_SIZE ulOffset,
|
||||
HB_SIZE ulLineLength, HB_SIZE ulTabSize, HB_SIZE ulMaxPos,
|
||||
static HB_SIZE hb_mlGetLine( const char * pszString, HB_SIZE nLen, HB_SIZE nOffset,
|
||||
HB_SIZE nLineLength, HB_SIZE nTabSize, HB_SIZE nMaxPos,
|
||||
HB_BOOL fWordWrap, PHB_EOL_INFO pEOLs, int iEOLs,
|
||||
HB_SIZE * pulLen, HB_SIZE * pulEOL )
|
||||
HB_SIZE * pnLen, HB_SIZE * pnEOL )
|
||||
{
|
||||
HB_SIZE ulCol = 0, ulBlankCol = 0, ulBlankPos = 0;
|
||||
HB_SIZE nCol = 0, nBlankCol = 0, nBlankPos = 0;
|
||||
int i;
|
||||
|
||||
if( pulEOL )
|
||||
* pulEOL = 0;
|
||||
if( pnEOL )
|
||||
* pnEOL = 0;
|
||||
|
||||
while( ulOffset < ulLen && ( ulMaxPos == 0 || ulOffset < ulMaxPos ) )
|
||||
while( nOffset < nLen && ( nMaxPos == 0 || nOffset < nMaxPos ) )
|
||||
{
|
||||
if( pszString[ ulOffset ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulOffset + 1 ] == HB_CHAR_SOFT2 )
|
||||
if( pszString[ nOffset ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nOffset + 1 ] == HB_CHAR_SOFT2 )
|
||||
{
|
||||
ulOffset += 2;
|
||||
nOffset += 2;
|
||||
if( !fWordWrap )
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
i = hb_mlEol( pszString + ulOffset, ulLen - ulOffset, pEOLs, iEOLs );
|
||||
i = hb_mlEol( pszString + nOffset, nLen - nOffset, pEOLs, iEOLs );
|
||||
if( i >= 0 )
|
||||
{
|
||||
if( ulMaxPos )
|
||||
ulCol += pEOLs[ i ].ulLen;
|
||||
if( nMaxPos )
|
||||
nCol += pEOLs[ i ].nLen;
|
||||
else
|
||||
ulOffset += pEOLs[ i ].ulLen;
|
||||
if( pulEOL )
|
||||
* pulEOL = pEOLs[ i ].ulLen;
|
||||
nOffset += pEOLs[ i ].nLen;
|
||||
if( pnEOL )
|
||||
* pnEOL = pEOLs[ i ].nLen;
|
||||
break;
|
||||
}
|
||||
|
||||
if( pszString[ ulOffset ] == ' ' || pszString[ ulOffset ] == HB_CHAR_HT )
|
||||
if( pszString[ nOffset ] == ' ' || pszString[ nOffset ] == HB_CHAR_HT )
|
||||
{
|
||||
ulBlankCol = ulCol;
|
||||
ulBlankPos = ulOffset;
|
||||
nBlankCol = nCol;
|
||||
nBlankPos = nOffset;
|
||||
}
|
||||
|
||||
if( ulCol >= ulLineLength )
|
||||
if( nCol >= nLineLength )
|
||||
{
|
||||
if( fWordWrap )
|
||||
{
|
||||
if( ulBlankCol == 0 || pszString[ ulOffset ] == ' ' ||
|
||||
pszString[ ulOffset ] == HB_CHAR_HT )
|
||||
if( nBlankCol == 0 || pszString[ nOffset ] == ' ' ||
|
||||
pszString[ nOffset ] == HB_CHAR_HT )
|
||||
{
|
||||
ulCol = ulLineLength;
|
||||
if( pszString[ ulOffset ] == ' ' )
|
||||
++ulOffset;
|
||||
if( pszString[ ulOffset ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulOffset + 1 ] == HB_CHAR_SOFT2 )
|
||||
ulOffset += 2;
|
||||
nCol = nLineLength;
|
||||
if( pszString[ nOffset ] == ' ' )
|
||||
++nOffset;
|
||||
if( pszString[ nOffset ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nOffset + 1 ] == HB_CHAR_SOFT2 )
|
||||
nOffset += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
ulCol = ulBlankCol;
|
||||
ulOffset = ulBlankPos + 1;
|
||||
nCol = nBlankCol;
|
||||
nOffset = nBlankPos + 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( ulCol > ulLineLength )
|
||||
--ulOffset;
|
||||
ulCol = ulLineLength;
|
||||
if( nCol > nLineLength )
|
||||
--nOffset;
|
||||
nCol = nLineLength;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ulCol += pszString[ ulOffset ] == HB_CHAR_HT ?
|
||||
ulTabSize - ( ulCol % ulTabSize ) : 1;
|
||||
ulOffset++;
|
||||
nCol += pszString[ nOffset ] == HB_CHAR_HT ?
|
||||
nTabSize - ( nCol % nTabSize ) : 1;
|
||||
nOffset++;
|
||||
}
|
||||
* pulLen = ulCol;
|
||||
* pnLen = nCol;
|
||||
|
||||
return ulOffset;
|
||||
return nOffset;
|
||||
}
|
||||
|
||||
static PHB_EOL_INFO hb_mlGetEOLs( int iParam, int * piEOLs )
|
||||
@@ -163,35 +163,35 @@ static PHB_EOL_INFO hb_mlGetEOLs( int iParam, int * piEOLs )
|
||||
Clipper will ignore these parameters and use CRLF EOL hard
|
||||
coded. [vszakats] */
|
||||
#ifndef HB_CLP_STRICT /* HB_EXTENSION */
|
||||
HB_SIZE ulLen = hb_parclen( iParam );
|
||||
if( ulLen )
|
||||
HB_SIZE nLen = hb_parclen( iParam );
|
||||
if( nLen )
|
||||
{
|
||||
pEOLs = ( PHB_EOL_INFO ) hb_xgrab( sizeof( HB_EOL_INFO ) );
|
||||
pEOLs->szEOL = hb_parc( iParam );
|
||||
pEOLs->ulLen = ulLen;
|
||||
pEOLs->nLen = nLen;
|
||||
iEOLs = 1;
|
||||
}
|
||||
else if( HB_ISARRAY( iParam ) )
|
||||
{
|
||||
PHB_ITEM pArray = hb_param( iParam, HB_IT_ARRAY );
|
||||
HB_SIZE ulSize = hb_arrayLen( pArray ), ul;
|
||||
HB_SIZE nSize = hb_arrayLen( pArray ), n;
|
||||
|
||||
for( ul = 1; ul <= ulSize; ++ul )
|
||||
for( n = 1; n <= nSize; ++n )
|
||||
{
|
||||
if( hb_arrayGetCLen( pArray, ul ) > 0 )
|
||||
if( hb_arrayGetCLen( pArray, n ) > 0 )
|
||||
++iEOLs;
|
||||
}
|
||||
if( iEOLs )
|
||||
{
|
||||
pEOLs = ( PHB_EOL_INFO ) hb_xgrab( sizeof( HB_EOL_INFO ) * iEOLs );
|
||||
iEOLs = 0;
|
||||
for( ul = 1; ul <= ulSize; ++ul )
|
||||
for( n = 1; n <= nSize; ++n )
|
||||
{
|
||||
ulLen = hb_arrayGetCLen( pArray, ul );
|
||||
if( ulLen > 0 )
|
||||
nLen = hb_arrayGetCLen( pArray, n );
|
||||
if( nLen > 0 )
|
||||
{
|
||||
pEOLs[ iEOLs ].szEOL = hb_arrayGetCPtr( pArray, ul );
|
||||
pEOLs[ iEOLs ].ulLen = ulLen;
|
||||
pEOLs[ iEOLs ].szEOL = hb_arrayGetCPtr( pArray, n );
|
||||
pEOLs[ iEOLs ].nLen = nLen;
|
||||
++iEOLs;
|
||||
}
|
||||
}
|
||||
@@ -207,17 +207,17 @@ static PHB_EOL_INFO hb_mlGetEOLs( int iParam, int * piEOLs )
|
||||
pEOLs->szEOL = hb_setGetEOL();
|
||||
if( !pEOLs->szEOL || !pEOLs->szEOL[ 0 ] )
|
||||
pEOLs->szEOL = hb_conNewLine();
|
||||
pEOLs->ulLen = strlen( pEOLs->szEOL );
|
||||
iEOLs = pEOLs->ulLen ? 1 : 0;
|
||||
pEOLs->nLen = strlen( pEOLs->szEOL );
|
||||
iEOLs = pEOLs->nLen ? 1 : 0;
|
||||
}
|
||||
|
||||
* piEOLs = iEOLs;
|
||||
return pEOLs;
|
||||
}
|
||||
|
||||
static const char * hb_mlGetParams( int iParAdd, HB_SIZE * pulLen,
|
||||
HB_SIZE * pulLineLength,
|
||||
HB_SIZE * pulTabSize, HB_BOOL * pfWordWrap,
|
||||
static const char * hb_mlGetParams( int iParAdd, HB_SIZE * pnLen,
|
||||
HB_SIZE * pnLineLength,
|
||||
HB_SIZE * pnTabSize, HB_BOOL * pfWordWrap,
|
||||
PHB_EOL_INFO * pEOLs, int * piEOLs )
|
||||
{
|
||||
const char * pszString = hb_parc( 1 );
|
||||
@@ -227,39 +227,39 @@ static const char * hb_mlGetParams( int iParAdd, HB_SIZE * pulLen,
|
||||
{
|
||||
if( hb_parnd( 2 ) <= 0 )
|
||||
return NULL;
|
||||
* pulLineLength = hb_parns( 2 );
|
||||
* pnLineLength = hb_parns( 2 );
|
||||
}
|
||||
else
|
||||
* pulLineLength = 79;
|
||||
* pulLen = hb_parclen( 1 );
|
||||
* pulTabSize = hb_parnldef( 3 + iParAdd, 4 );
|
||||
* pnLineLength = 79;
|
||||
* pnLen = hb_parclen( 1 );
|
||||
* pnTabSize = hb_parnldef( 3 + iParAdd, 4 );
|
||||
* pfWordWrap = hb_parldef( 4 + iParAdd, 1 );
|
||||
* pEOLs = hb_mlGetEOLs( 5 + iParAdd, piEOLs );
|
||||
#ifdef HB_CLP_STRICT
|
||||
if( * pulLineLength > 254 )
|
||||
* pulLineLength = 79;
|
||||
if( * pnLineLength > 254 )
|
||||
* pnLineLength = 79;
|
||||
#endif
|
||||
if( * pulTabSize >= * pulLineLength )
|
||||
* pulTabSize = * pulLineLength - 1;
|
||||
else if( * pulTabSize == 0 )
|
||||
* pulTabSize = 1;
|
||||
if( * pnTabSize >= * pnLineLength )
|
||||
* pnTabSize = * pnLineLength - 1;
|
||||
else if( * pnTabSize == 0 )
|
||||
* pnTabSize = 1;
|
||||
}
|
||||
return pszString;
|
||||
}
|
||||
|
||||
HB_FUNC( MEMOLINE )
|
||||
{
|
||||
HB_SIZE ulLen, ulLineLength, ulTabSize;
|
||||
HB_SIZE nLen, nLineLength, nTabSize;
|
||||
HB_BOOL fWordWrap;
|
||||
PHB_EOL_INFO pEOLs;
|
||||
int iEOLs;
|
||||
const char * pszString = hb_mlGetParams( 1, &ulLen, &ulLineLength,
|
||||
&ulTabSize, &fWordWrap,
|
||||
const char * pszString = hb_mlGetParams( 1, &nLen, &nLineLength,
|
||||
&nTabSize, &fWordWrap,
|
||||
&pEOLs, &iEOLs );
|
||||
char * szLine;
|
||||
HB_SIZE ulLine = hb_parns( 3 );
|
||||
HB_SIZE ulOffset = 0;
|
||||
HB_SIZE ulCols = 0;
|
||||
HB_SIZE nLine = hb_parns( 3 );
|
||||
HB_SIZE nOffset = 0;
|
||||
HB_SIZE nCols = 0;
|
||||
|
||||
if( !pszString )
|
||||
{
|
||||
@@ -267,42 +267,42 @@ HB_FUNC( MEMOLINE )
|
||||
return;
|
||||
}
|
||||
|
||||
if( ulLine == 0 )
|
||||
ulLine = 1;
|
||||
if( nLine == 0 )
|
||||
nLine = 1;
|
||||
|
||||
while( --ulLine && ulOffset < ulLen )
|
||||
while( --nLine && nOffset < nLen )
|
||||
{
|
||||
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulLineLength, ulTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &ulCols, NULL );
|
||||
nOffset = hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nLineLength, nTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &nCols, NULL );
|
||||
}
|
||||
if( ulOffset < ulLen )
|
||||
if( nOffset < nLen )
|
||||
{
|
||||
HB_SIZE ulCol = 0;
|
||||
hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulLineLength, ulTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &ulCols, NULL );
|
||||
szLine = ( char * ) hb_xgrab( ulLineLength + 1 );
|
||||
while( ulCol < ulCols )
|
||||
HB_SIZE nCol = 0;
|
||||
hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nLineLength, nTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &nCols, NULL );
|
||||
szLine = ( char * ) hb_xgrab( nLineLength + 1 );
|
||||
while( nCol < nCols )
|
||||
{
|
||||
if( pszString[ ulOffset ] == HB_CHAR_HT )
|
||||
if( pszString[ nOffset ] == HB_CHAR_HT )
|
||||
{
|
||||
HB_SIZE ul = ulTabSize - ( ulCol % ulTabSize );
|
||||
HB_SIZE n = nTabSize - ( nCol % nTabSize );
|
||||
do
|
||||
szLine[ ulCol++ ] = ' ';
|
||||
while( --ul && ulCol < ulCols );
|
||||
szLine[ nCol++ ] = ' ';
|
||||
while( --n && nCol < nCols );
|
||||
}
|
||||
else if( pszString[ ulOffset ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulOffset + 1 ] == HB_CHAR_SOFT2 )
|
||||
ulOffset++;
|
||||
else if( pszString[ nOffset ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nOffset + 1 ] == HB_CHAR_SOFT2 )
|
||||
nOffset++;
|
||||
else
|
||||
szLine[ ulCol++ ] = pszString[ ulOffset ];
|
||||
ulOffset++;
|
||||
szLine[ nCol++ ] = pszString[ nOffset ];
|
||||
nOffset++;
|
||||
}
|
||||
if( ulCols < ulLineLength )
|
||||
memset( szLine + ulCols, ' ', ulLineLength - ulCols );
|
||||
szLine[ ulLineLength ] = 0;
|
||||
hb_retclen_buffer( szLine, ulLineLength );
|
||||
if( nCols < nLineLength )
|
||||
memset( szLine + nCols, ' ', nLineLength - nCols );
|
||||
szLine[ nLineLength ] = 0;
|
||||
hb_retclen_buffer( szLine, nLineLength );
|
||||
}
|
||||
else
|
||||
hb_retc_null();
|
||||
@@ -311,151 +311,151 @@ HB_FUNC( MEMOLINE )
|
||||
|
||||
HB_FUNC( MLCOUNT )
|
||||
{
|
||||
HB_SIZE ulLen, ulLineLength, ulTabSize;
|
||||
HB_SIZE nLen, nLineLength, nTabSize;
|
||||
HB_BOOL fWordWrap;
|
||||
PHB_EOL_INFO pEOLs;
|
||||
int iEOLs;
|
||||
const char * pszString = hb_mlGetParams( 0, &ulLen, &ulLineLength,
|
||||
&ulTabSize, &fWordWrap,
|
||||
const char * pszString = hb_mlGetParams( 0, &nLen, &nLineLength,
|
||||
&nTabSize, &fWordWrap,
|
||||
&pEOLs, &iEOLs );
|
||||
HB_SIZE ulLines = 0;
|
||||
HB_SIZE ulOffset = 0;
|
||||
HB_SIZE ulCols = 0;
|
||||
HB_SIZE nLines = 0;
|
||||
HB_SIZE nOffset = 0;
|
||||
HB_SIZE nCols = 0;
|
||||
|
||||
if( pszString )
|
||||
{
|
||||
while( ulOffset < ulLen )
|
||||
while( nOffset < nLen )
|
||||
{
|
||||
++ulLines;
|
||||
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulLineLength, ulTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &ulCols, NULL );
|
||||
++nLines;
|
||||
nOffset = hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nLineLength, nTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &nCols, NULL );
|
||||
}
|
||||
hb_xfree( pEOLs );
|
||||
}
|
||||
hb_retns( ulLines );
|
||||
hb_retns( nLines );
|
||||
}
|
||||
|
||||
HB_FUNC( MLPOS )
|
||||
{
|
||||
HB_SIZE ulLen, ulLineLength, ulTabSize;
|
||||
HB_SIZE nLen, nLineLength, nTabSize;
|
||||
HB_BOOL fWordWrap;
|
||||
PHB_EOL_INFO pEOLs;
|
||||
int iEOLs;
|
||||
const char * pszString = hb_mlGetParams( 1, &ulLen, &ulLineLength,
|
||||
&ulTabSize, &fWordWrap,
|
||||
const char * pszString = hb_mlGetParams( 1, &nLen, &nLineLength,
|
||||
&nTabSize, &fWordWrap,
|
||||
&pEOLs, &iEOLs );
|
||||
HB_SIZE ulLine = hb_parns( 3 );
|
||||
HB_SIZE ulOffset = 0;
|
||||
HB_SIZE ulCols = 0;
|
||||
HB_SIZE nLine = hb_parns( 3 );
|
||||
HB_SIZE nOffset = 0;
|
||||
HB_SIZE nCols = 0;
|
||||
|
||||
if( pszString )
|
||||
{
|
||||
if( ulLine == 0 )
|
||||
ulLine = 1;
|
||||
while( --ulLine && ulOffset < ulLen )
|
||||
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulLineLength, ulTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &ulCols, NULL );
|
||||
if( ulOffset < ulLen )
|
||||
++ulOffset;
|
||||
if( nLine == 0 )
|
||||
nLine = 1;
|
||||
while( --nLine && nOffset < nLen )
|
||||
nOffset = hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nLineLength, nTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &nCols, NULL );
|
||||
if( nOffset < nLen )
|
||||
++nOffset;
|
||||
hb_xfree( pEOLs );
|
||||
}
|
||||
hb_retns( ulOffset );
|
||||
hb_retns( nOffset );
|
||||
}
|
||||
|
||||
HB_FUNC( MLCTOPOS )
|
||||
{
|
||||
HB_SIZE ulLen, ulLineLength, ulTabSize;
|
||||
HB_SIZE nLen, nLineLength, nTabSize;
|
||||
HB_BOOL fWordWrap;
|
||||
PHB_EOL_INFO pEOLs;
|
||||
int iEOLs;
|
||||
const char * pszString = hb_mlGetParams( 2, &ulLen, &ulLineLength,
|
||||
&ulTabSize, &fWordWrap,
|
||||
const char * pszString = hb_mlGetParams( 2, &nLen, &nLineLength,
|
||||
&nTabSize, &fWordWrap,
|
||||
&pEOLs, &iEOLs );
|
||||
HB_SIZE ulLine = hb_parns( 3 );
|
||||
HB_SIZE ulCol = hb_parns( 4 );
|
||||
HB_SIZE ulOffset = 0;
|
||||
HB_SIZE ulCols = 0;
|
||||
HB_SIZE nLine = hb_parns( 3 );
|
||||
HB_SIZE nCol = hb_parns( 4 );
|
||||
HB_SIZE nOffset = 0;
|
||||
HB_SIZE nCols = 0;
|
||||
|
||||
if( pszString )
|
||||
{
|
||||
if( ulLineLength > 4 && ulLine && HB_ISNUM( 4 ) )
|
||||
if( nLineLength > 4 && nLine && HB_ISNUM( 4 ) )
|
||||
{
|
||||
while( --ulLine && ulOffset < ulLen )
|
||||
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulLineLength, ulTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &ulCols, NULL );
|
||||
if( ulOffset < ulLen && ulCol )
|
||||
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulCol, ulTabSize, ulLen, HB_FALSE,
|
||||
pEOLs, iEOLs, &ulCols, NULL );
|
||||
while( --nLine && nOffset < nLen )
|
||||
nOffset = hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nLineLength, nTabSize, 0, fWordWrap,
|
||||
pEOLs, iEOLs, &nCols, NULL );
|
||||
if( nOffset < nLen && nCol )
|
||||
nOffset = hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nCol, nTabSize, nLen, HB_FALSE,
|
||||
pEOLs, iEOLs, &nCols, NULL );
|
||||
}
|
||||
hb_xfree( pEOLs );
|
||||
}
|
||||
++ulOffset;
|
||||
hb_retns( ulOffset );
|
||||
++nOffset;
|
||||
hb_retns( nOffset );
|
||||
}
|
||||
|
||||
HB_FUNC( MPOSTOLC )
|
||||
{
|
||||
HB_SIZE ulLen, ulLineLength, ulTabSize;
|
||||
HB_SIZE nLen, nLineLength, nTabSize;
|
||||
HB_BOOL fWordWrap;
|
||||
PHB_EOL_INFO pEOLs;
|
||||
int iEOLs;
|
||||
const char * pszString = hb_mlGetParams( 1, &ulLen, &ulLineLength,
|
||||
&ulTabSize, &fWordWrap,
|
||||
const char * pszString = hb_mlGetParams( 1, &nLen, &nLineLength,
|
||||
&nTabSize, &fWordWrap,
|
||||
&pEOLs, &iEOLs );
|
||||
HB_SIZE ulPos = hb_parns( 3 );
|
||||
HB_SIZE ulOffset = 0;
|
||||
HB_SIZE ulLine = 0;
|
||||
HB_SIZE ulCol = 0;
|
||||
HB_SIZE ulEOL = 0;
|
||||
HB_SIZE nPos = hb_parns( 3 );
|
||||
HB_SIZE nOffset = 0;
|
||||
HB_SIZE nLine = 0;
|
||||
HB_SIZE nCol = 0;
|
||||
HB_SIZE nEOL = 0;
|
||||
|
||||
if( pszString )
|
||||
{
|
||||
if( ulPos && ulLen )
|
||||
if( nPos && nLen )
|
||||
{
|
||||
if( --ulPos )
|
||||
if( --nPos )
|
||||
{
|
||||
do
|
||||
{
|
||||
++ulLine;
|
||||
ulOffset = hb_mlGetLine( pszString, ulLen, ulOffset,
|
||||
ulLineLength, ulTabSize, ulPos, fWordWrap,
|
||||
pEOLs, iEOLs, &ulCol, &ulEOL );
|
||||
if( ulEOL )
|
||||
++nLine;
|
||||
nOffset = hb_mlGetLine( pszString, nLen, nOffset,
|
||||
nLineLength, nTabSize, nPos, fWordWrap,
|
||||
pEOLs, iEOLs, &nCol, &nEOL );
|
||||
if( nEOL )
|
||||
{
|
||||
if( ulOffset + ulEOL == ulPos )
|
||||
if( nOffset + nEOL == nPos )
|
||||
{
|
||||
ulCol = 0;
|
||||
++ulLine;
|
||||
nCol = 0;
|
||||
++nLine;
|
||||
break;
|
||||
}
|
||||
ulOffset += ulEOL;
|
||||
nOffset += nEOL;
|
||||
}
|
||||
}
|
||||
while( ulOffset < ulLen && ulOffset < ulPos );
|
||||
while( nOffset < nLen && nOffset < nPos );
|
||||
|
||||
if( ulLine && ulCol == ulLineLength && ulPos <= ulLen &&
|
||||
( hb_mlEol( pszString + ulPos, ulLen - ulPos, pEOLs, iEOLs ) >= 0 ||
|
||||
( pszString[ ulPos ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulPos + 1 ] == HB_CHAR_SOFT2 ) ||
|
||||
( ulPos > 0 && pszString[ ulPos - 1 ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulPos ] == HB_CHAR_SOFT2 ) ||
|
||||
( ulPos > 1 && pszString[ ulPos - 2 ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulPos - 1 ] == HB_CHAR_SOFT2 ) ) )
|
||||
if( nLine && nCol == nLineLength && nPos <= nLen &&
|
||||
( hb_mlEol( pszString + nPos, nLen - nPos, pEOLs, iEOLs ) >= 0 ||
|
||||
( pszString[ nPos ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nPos + 1 ] == HB_CHAR_SOFT2 ) ||
|
||||
( nPos > 0 && pszString[ nPos - 1 ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nPos ] == HB_CHAR_SOFT2 ) ||
|
||||
( nPos > 1 && pszString[ nPos - 2 ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nPos - 1 ] == HB_CHAR_SOFT2 ) ) )
|
||||
{
|
||||
ulCol = 0;
|
||||
++ulLine;
|
||||
nCol = 0;
|
||||
++nLine;
|
||||
}
|
||||
}
|
||||
else
|
||||
++ulLine;
|
||||
++nLine;
|
||||
}
|
||||
hb_xfree( pEOLs );
|
||||
}
|
||||
hb_reta( 2 );
|
||||
hb_storvns( ulLine, -1, 1 );
|
||||
hb_storvns( ulCol, -1, 2 );
|
||||
hb_storvns( nLine, -1, 1 );
|
||||
hb_storvns( nCol, -1, 2 );
|
||||
}
|
||||
|
||||
@@ -53,36 +53,36 @@
|
||||
#include "hbapi.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
/* NOTE: pszResult must have an allocated buffer of at least ulStringLen */
|
||||
/* NOTE: pszResult must have an allocated buffer of at least nStringLen */
|
||||
|
||||
static char * hb_strMemotran( char * pszResult, HB_SIZE * ulResultLen, const char * pszString, HB_SIZE ulStringLen, char cHardcr, char cSoftcr )
|
||||
static char * hb_strMemotran( char * pszResult, HB_SIZE * pnResultLen, const char * pszString, HB_SIZE nStringLen, char cHardcr, char cSoftcr )
|
||||
{
|
||||
HB_SIZE ulStringPos = 0;
|
||||
HB_SIZE ulResultPos = 0;
|
||||
HB_SIZE nStringPos = 0;
|
||||
HB_SIZE nResultPos = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_strMemotran(%p, %p, %s, %" HB_PFS "u, %x, %x)", pszResult, ulResultLen, pszString, ulStringLen, cHardcr, cSoftcr));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_strMemotran(%p, %p, %s, %" HB_PFS "u, %x, %x)", pszResult, pnResultLen, pszString, nStringLen, cHardcr, cSoftcr));
|
||||
|
||||
while( ulStringPos < ulStringLen )
|
||||
while( nStringPos < nStringLen )
|
||||
{
|
||||
if( pszString[ ulStringPos ] == HB_CHAR_HARD1 &&
|
||||
pszString[ ulStringPos + 1 ] == HB_CHAR_HARD2 )
|
||||
if( pszString[ nStringPos ] == HB_CHAR_HARD1 &&
|
||||
pszString[ nStringPos + 1 ] == HB_CHAR_HARD2 )
|
||||
{
|
||||
pszResult[ ulResultPos++ ] = cHardcr;
|
||||
ulStringPos += 2;
|
||||
pszResult[ nResultPos++ ] = cHardcr;
|
||||
nStringPos += 2;
|
||||
}
|
||||
else if( pszString[ ulStringPos ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ ulStringPos + 1 ] == HB_CHAR_SOFT2 )
|
||||
else if( pszString[ nStringPos ] == HB_CHAR_SOFT1 &&
|
||||
pszString[ nStringPos + 1 ] == HB_CHAR_SOFT2 )
|
||||
{
|
||||
pszResult[ ulResultPos++ ] = cSoftcr;
|
||||
ulStringPos += 2;
|
||||
pszResult[ nResultPos++ ] = cSoftcr;
|
||||
nStringPos += 2;
|
||||
}
|
||||
else
|
||||
pszResult[ ulResultPos++ ] = pszString[ ulStringPos++ ];
|
||||
pszResult[ nResultPos++ ] = pszString[ nStringPos++ ];
|
||||
}
|
||||
|
||||
pszResult[ ulResultPos ] = '\0';
|
||||
pszResult[ nResultPos ] = '\0';
|
||||
|
||||
*ulResultLen = ulResultPos;
|
||||
*pnResultLen = nResultPos;
|
||||
|
||||
return pszResult;
|
||||
}
|
||||
@@ -96,10 +96,10 @@ HB_FUNC( MEMOTRAN )
|
||||
char * pszResult = ( char * ) hb_xgrab( hb_itemGetCLen( pString ) + 1 );
|
||||
char cHardcr = HB_ISCHAR( 2 ) ? *hb_parc( 2 ) : ';';
|
||||
char cSoftcr = HB_ISCHAR( 3 ) ? *hb_parc( 3 ) : ' ';
|
||||
HB_SIZE ulResultLen;
|
||||
HB_SIZE nResultLen;
|
||||
|
||||
hb_strMemotran( pszResult, &ulResultLen, hb_itemGetCPtr( pString ), hb_itemGetCLen( pString ), cHardcr, cSoftcr );
|
||||
hb_retclen_buffer( pszResult, ulResultLen );
|
||||
hb_strMemotran( pszResult, &nResultLen, hb_itemGetCPtr( pString ), hb_itemGetCLen( pString ), cHardcr, cSoftcr );
|
||||
hb_retclen_buffer( pszResult, nResultLen );
|
||||
}
|
||||
else
|
||||
hb_retc_null();
|
||||
|
||||
@@ -57,46 +57,46 @@
|
||||
/* centre-pads a date, number, or string with spaces or supplied character */
|
||||
HB_FUNC( PADC )
|
||||
{
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_BOOL bFreeReq;
|
||||
char * szText;
|
||||
HB_ISIZ lLen = hb_parns( 2 );
|
||||
HB_ISIZ nLen = hb_parns( 2 );
|
||||
|
||||
if( lLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) && ( HB_SIZE ) lLen == hb_itemGetCLen( pItem ) )
|
||||
if( pItem && HB_IS_STRING( pItem ) && ( HB_SIZE ) nLen == hb_itemGetCLen( pItem ) )
|
||||
{
|
||||
hb_itemReturn( pItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
szText = hb_itemPadConv( pItem, &ulSize, &bFreeReq );
|
||||
szText = hb_itemPadConv( pItem, &nSize, &bFreeReq );
|
||||
if( szText )
|
||||
{
|
||||
if( ( HB_SIZE ) lLen > ulSize )
|
||||
if( ( HB_SIZE ) nLen > nSize )
|
||||
{
|
||||
char * szResult = ( char * ) hb_xgrab( lLen + 1 );
|
||||
char * szResult = ( char * ) hb_xgrab( nLen + 1 );
|
||||
char cPad;
|
||||
HB_ISIZ ulPad = ( ( HB_SIZE ) lLen - ulSize ) >> 1;
|
||||
HB_ISIZ nPad = ( ( HB_SIZE ) nLen - nSize ) >> 1;
|
||||
|
||||
cPad = ( HB_ISCHAR( 3 ) ? *( hb_parc( 3 ) ) : ' ' );
|
||||
hb_xmemset( szResult, cPad, ulPad );
|
||||
hb_xmemcpy( szResult + ulPad, szText, ulSize );
|
||||
hb_xmemset( szResult + ulPad + ulSize, cPad,
|
||||
( HB_SIZE ) lLen - ulSize - ulPad );
|
||||
hb_xmemset( szResult, cPad, nPad );
|
||||
hb_xmemcpy( szResult + nPad, szText, nSize );
|
||||
hb_xmemset( szResult + nPad + nSize, cPad,
|
||||
( HB_SIZE ) nLen - nSize - nPad );
|
||||
|
||||
hb_retclen_buffer( szResult, ( HB_SIZE ) lLen );
|
||||
hb_retclen_buffer( szResult, ( HB_SIZE ) nLen );
|
||||
if( bFreeReq )
|
||||
hb_xfree( szText );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( bFreeReq )
|
||||
hb_retclen_buffer( szText, ( HB_SIZE ) lLen );
|
||||
hb_retclen_buffer( szText, ( HB_SIZE ) nLen );
|
||||
else
|
||||
hb_retclen( szText, lLen );
|
||||
hb_retclen( szText, nLen );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -57,43 +57,43 @@
|
||||
/* left-pads a date, number, or string with spaces or supplied character */
|
||||
HB_FUNC( PADL )
|
||||
{
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_BOOL bFreeReq;
|
||||
char * szText;
|
||||
HB_ISIZ lLen = hb_parns( 2 );
|
||||
HB_ISIZ nLen = hb_parns( 2 );
|
||||
|
||||
if( lLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) && ( HB_SIZE ) lLen == hb_itemGetCLen( pItem ) )
|
||||
if( pItem && HB_IS_STRING( pItem ) && ( HB_SIZE ) nLen == hb_itemGetCLen( pItem ) )
|
||||
{
|
||||
hb_itemReturn( pItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
szText = hb_itemPadConv( pItem, &ulSize, &bFreeReq );
|
||||
szText = hb_itemPadConv( pItem, &nSize, &bFreeReq );
|
||||
if( szText )
|
||||
{
|
||||
if( ( HB_SIZE ) lLen > ulSize )
|
||||
if( ( HB_SIZE ) nLen > nSize )
|
||||
{
|
||||
char * szResult = ( char * ) hb_xgrab( lLen + 1 );
|
||||
char * szResult = ( char * ) hb_xgrab( nLen + 1 );
|
||||
char cPad;
|
||||
|
||||
cPad = ( HB_ISCHAR( 3 ) ? *( hb_parc( 3 ) ) : ' ' );
|
||||
hb_xmemset( szResult, cPad, ( HB_SIZE ) lLen - ulSize );
|
||||
hb_xmemcpy( szResult + ( HB_SIZE ) lLen - ulSize, szText, ulSize );
|
||||
hb_xmemset( szResult, cPad, ( HB_SIZE ) nLen - nSize );
|
||||
hb_xmemcpy( szResult + ( HB_SIZE ) nLen - nSize, szText, nSize );
|
||||
|
||||
hb_retclen_buffer( szResult, ( HB_SIZE ) lLen );
|
||||
hb_retclen_buffer( szResult, ( HB_SIZE ) nLen );
|
||||
if( bFreeReq )
|
||||
hb_xfree( szText );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( bFreeReq )
|
||||
hb_retclen_buffer( szText, ( HB_SIZE ) lLen );
|
||||
hb_retclen_buffer( szText, ( HB_SIZE ) nLen );
|
||||
else
|
||||
hb_retclen( szText, lLen );
|
||||
hb_retclen( szText, nLen );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -57,43 +57,43 @@
|
||||
/* right-pads a date, number, or string with spaces or supplied character */
|
||||
HB_FUNC( PADR )
|
||||
{
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
HB_BOOL bFreeReq;
|
||||
char * szText;
|
||||
HB_ISIZ lLen = hb_parns( 2 );
|
||||
HB_ISIZ nLen = hb_parns( 2 );
|
||||
|
||||
if( lLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
PHB_ITEM pItem = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) && ( HB_SIZE ) lLen == hb_itemGetCLen( pItem ) )
|
||||
if( pItem && HB_IS_STRING( pItem ) && ( HB_SIZE ) nLen == hb_itemGetCLen( pItem ) )
|
||||
{
|
||||
hb_itemReturn( pItem );
|
||||
}
|
||||
else
|
||||
{
|
||||
szText = hb_itemPadConv( pItem, &ulSize, &bFreeReq );
|
||||
szText = hb_itemPadConv( pItem, &nSize, &bFreeReq );
|
||||
if( szText )
|
||||
{
|
||||
if( ( HB_SIZE ) lLen > ulSize )
|
||||
if( ( HB_SIZE ) nLen > nSize )
|
||||
{
|
||||
char * szResult = ( char * ) hb_xgrab( lLen + 1 );
|
||||
char * szResult = ( char * ) hb_xgrab( nLen + 1 );
|
||||
char cPad;
|
||||
|
||||
cPad = ( HB_ISCHAR( 3 ) ? *( hb_parc( 3 ) ) : ' ' );
|
||||
hb_xmemcpy( szResult, szText, ulSize );
|
||||
hb_xmemset( szResult + ulSize, cPad, ( HB_SIZE ) lLen - ulSize );
|
||||
hb_xmemcpy( szResult, szText, nSize );
|
||||
hb_xmemset( szResult + nSize, cPad, ( HB_SIZE ) nLen - nSize );
|
||||
|
||||
hb_retclen_buffer( szResult, ( HB_SIZE ) lLen );
|
||||
hb_retclen_buffer( szResult, ( HB_SIZE ) nLen );
|
||||
if( bFreeReq )
|
||||
hb_xfree( szText );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( bFreeReq )
|
||||
hb_retclen_buffer( szText, ( HB_SIZE ) lLen );
|
||||
hb_retclen_buffer( szText, ( HB_SIZE ) nLen );
|
||||
else
|
||||
hb_retclen( szText, lLen );
|
||||
hb_retclen( szText, nLen );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -113,31 +113,31 @@ HB_FUNC( FREAD )
|
||||
{
|
||||
PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING );
|
||||
HB_ERRCODE uiError = 0;
|
||||
HB_SIZE ulRead = 0;
|
||||
HB_SIZE nRead = 0;
|
||||
|
||||
if( HB_ISNUM( 1 ) && pBuffer && HB_ISBYREF( 2 ) && HB_ISNUM( 3 ) )
|
||||
{
|
||||
char * buffer;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
ulRead = hb_parns( 3 );
|
||||
nRead = hb_parns( 3 );
|
||||
|
||||
/* NOTE: CA-Cl*pper determines the maximum size by calling _parcsiz()
|
||||
instead of _parclen(), this means that the maximum read length
|
||||
will be one more than the length of the passed buffer, because
|
||||
the terminating zero could be used if needed. [vszakats] */
|
||||
|
||||
if( ulRead <= hb_parcsiz( 2 ) &&
|
||||
hb_itemGetWriteCL( pBuffer, &buffer, &ulSize ) )
|
||||
if( nRead <= hb_parcsiz( 2 ) &&
|
||||
hb_itemGetWriteCL( pBuffer, &buffer, &nSize ) )
|
||||
{
|
||||
ulRead = hb_fsReadLarge( hb_numToHandle( hb_parnint( 1 ) ), buffer, ulRead );
|
||||
nRead = hb_fsReadLarge( hb_numToHandle( hb_parnint( 1 ) ), buffer, nRead );
|
||||
uiError = hb_fsError();
|
||||
}
|
||||
else
|
||||
ulRead = 0;
|
||||
nRead = 0;
|
||||
}
|
||||
|
||||
hb_retnint( ulRead );
|
||||
hb_retns( nRead );
|
||||
hb_fsSetFError( uiError );
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ HB_FUNC( FWRITE )
|
||||
uiError = hb_fsError();
|
||||
}
|
||||
else
|
||||
hb_retni( 0 );
|
||||
hb_retns( 0 );
|
||||
hb_fsSetFError( uiError );
|
||||
}
|
||||
|
||||
@@ -237,17 +237,17 @@ HB_FUNC( FREADSTR )
|
||||
|
||||
if( HB_ISNUM( 1 ) && HB_ISNUM( 2 ) )
|
||||
{
|
||||
HB_SIZE ulToRead = hb_parns( 2 );
|
||||
HB_SIZE nToRead = hb_parns( 2 );
|
||||
|
||||
if( ulToRead > 0 )
|
||||
if( nToRead > 0 )
|
||||
{
|
||||
HB_FHANDLE fhnd = ( HB_FHANDLE ) hb_parni( 1 );
|
||||
char * buffer = ( char * ) hb_xgrab( ulToRead + 1 );
|
||||
HB_SIZE ulRead;
|
||||
char * buffer = ( char * ) hb_xgrab( nToRead + 1 );
|
||||
HB_SIZE nRead;
|
||||
|
||||
ulRead = hb_fsReadLarge( fhnd, buffer, ulToRead );
|
||||
nRead = hb_fsReadLarge( fhnd, buffer, nToRead );
|
||||
uiError = hb_fsError();
|
||||
buffer[ ulRead ] = '\0';
|
||||
buffer[ nRead ] = '\0';
|
||||
|
||||
/* NOTE: Clipper will not return zero chars from this functions. */
|
||||
hb_retc_buffer( buffer );
|
||||
|
||||
@@ -54,26 +54,26 @@
|
||||
|
||||
HB_FUNC( RAT )
|
||||
{
|
||||
HB_SIZE ulSubLen = hb_parclen( 1 );
|
||||
HB_SIZE nSubLen = hb_parclen( 1 );
|
||||
|
||||
if( ulSubLen )
|
||||
if( nSubLen )
|
||||
{
|
||||
HB_ISIZ lPos = hb_parclen( 2 ) - ulSubLen;
|
||||
HB_ISIZ nPos = hb_parclen( 2 ) - nSubLen;
|
||||
|
||||
if( lPos >= 0 )
|
||||
if( nPos >= 0 )
|
||||
{
|
||||
const char * pszSub = hb_parc( 1 );
|
||||
const char * pszText = hb_parc( 2 );
|
||||
HB_BOOL bFound = HB_FALSE;
|
||||
|
||||
while( lPos >= 0 && !bFound )
|
||||
while( nPos >= 0 && !bFound )
|
||||
{
|
||||
if( *( pszText + lPos ) == *pszSub )
|
||||
bFound = ( memcmp( pszSub, pszText + lPos, ulSubLen ) == 0 );
|
||||
lPos--;
|
||||
if( *( pszText + nPos ) == *pszSub )
|
||||
bFound = ( memcmp( pszSub, pszText + nPos, nSubLen ) == 0 );
|
||||
nPos--;
|
||||
}
|
||||
|
||||
hb_retns( bFound ? lPos + 2 : 0 );
|
||||
hb_retns( bFound ? nPos + 2 : 0 );
|
||||
}
|
||||
else
|
||||
hb_retns( 0 );
|
||||
@@ -85,46 +85,46 @@ HB_FUNC( RAT )
|
||||
|
||||
HB_FUNC( HB_RAT )
|
||||
{
|
||||
HB_SIZE ulSubLen = hb_parclen( 1 );
|
||||
HB_SIZE nSubLen = hb_parclen( 1 );
|
||||
|
||||
if( ulSubLen )
|
||||
if( nSubLen )
|
||||
{
|
||||
HB_ISIZ lPos = hb_parclen( 2 ) - ulSubLen;
|
||||
HB_ISIZ nPos = hb_parclen( 2 ) - nSubLen;
|
||||
|
||||
if( lPos >= 0 )
|
||||
if( nPos >= 0 )
|
||||
{
|
||||
const char * pszSub = hb_parc( 1 );
|
||||
const char * pszText = hb_parc( 2 );
|
||||
HB_BOOL bFound = HB_FALSE;
|
||||
HB_ISIZ lStart;
|
||||
HB_ISIZ nStart;
|
||||
|
||||
if( HB_ISNUM( 3 ) )
|
||||
{
|
||||
lStart = hb_parns( 3 );
|
||||
if( lStart >= 1 )
|
||||
--lStart;
|
||||
nStart = hb_parns( 3 );
|
||||
if( nStart >= 1 )
|
||||
--nStart;
|
||||
else
|
||||
lStart = 0;
|
||||
nStart = 0;
|
||||
}
|
||||
else
|
||||
lStart = 0;
|
||||
nStart = 0;
|
||||
|
||||
if( HB_ISNUM( 4 ) )
|
||||
{
|
||||
HB_ISIZ lEnd = hb_parns( 4 ) - 1;
|
||||
HB_ISIZ nEnd = hb_parns( 4 ) - 1;
|
||||
|
||||
if( lEnd < lPos )
|
||||
lPos = lEnd;
|
||||
if( nEnd < nPos )
|
||||
nPos = nEnd;
|
||||
}
|
||||
|
||||
while( lPos >= lStart && !bFound )
|
||||
while( nPos >= nStart && !bFound )
|
||||
{
|
||||
if( *( pszText + lPos ) == *pszSub )
|
||||
bFound = ( memcmp( pszSub, pszText + lPos, ulSubLen ) == 0 );
|
||||
lPos--;
|
||||
if( *( pszText + nPos ) == *pszSub )
|
||||
bFound = ( memcmp( pszSub, pszText + nPos, nSubLen ) == 0 );
|
||||
nPos--;
|
||||
}
|
||||
|
||||
hb_retns( bFound ? lPos + 2 : 0 );
|
||||
hb_retns( bFound ? nPos + 2 : 0 );
|
||||
}
|
||||
else
|
||||
hb_retns( 0 );
|
||||
|
||||
@@ -60,26 +60,26 @@ HB_FUNC( REPLICATE )
|
||||
{
|
||||
if( HB_ISCHAR( 1 ) && HB_ISNUM( 2 ) )
|
||||
{
|
||||
HB_ISIZ lTimes = hb_parns( 2 );
|
||||
HB_ISIZ nTimes = hb_parns( 2 );
|
||||
|
||||
if( lTimes > 0 )
|
||||
if( nTimes > 0 )
|
||||
{
|
||||
HB_SIZE ulLen = hb_parclen( 1 );
|
||||
HB_SIZE nLen = hb_parclen( 1 );
|
||||
|
||||
if( ( double ) ( ( double ) ulLen * ( double ) lTimes ) < ( double ) ULONG_MAX )
|
||||
if( ( double ) ( ( double ) nLen * ( double ) nTimes ) < ( double ) ULONG_MAX )
|
||||
{
|
||||
const char * szText = hb_parc( 1 );
|
||||
char * szResult = ( char * ) hb_xgrab( ( ulLen * lTimes ) + 1 );
|
||||
char * szResult = ( char * ) hb_xgrab( ( nLen * nTimes ) + 1 );
|
||||
char * szPtr = szResult;
|
||||
HB_ISIZ i;
|
||||
HB_ISIZ n;
|
||||
|
||||
for( i = 0; i < lTimes; i++ )
|
||||
for( n = 0; n < nTimes; ++n )
|
||||
{
|
||||
hb_xmemcpy( szPtr, szText, ulLen );
|
||||
szPtr += ulLen;
|
||||
hb_xmemcpy( szPtr, szText, nLen );
|
||||
szPtr += nLen;
|
||||
}
|
||||
|
||||
hb_retclen_buffer( szResult, ulLen * lTimes );
|
||||
hb_retclen_buffer( szResult, nLen * nTimes );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_STROVERFLOW, 1234, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
|
||||
@@ -62,16 +62,16 @@ HB_FUNC( RIGHT )
|
||||
|
||||
if( pText && HB_ISNUM( 2 ) )
|
||||
{
|
||||
HB_ISIZ lLen = hb_parns( 2 );
|
||||
if( lLen <= 0 )
|
||||
HB_ISIZ nLen = hb_parns( 2 );
|
||||
if( nLen <= 0 )
|
||||
hb_retc_null();
|
||||
else
|
||||
{
|
||||
HB_SIZE ulText = hb_itemGetCLen( pText );
|
||||
if( ( HB_SIZE ) lLen >= ulText )
|
||||
HB_SIZE nText = hb_itemGetCLen( pText );
|
||||
if( ( HB_SIZE ) nLen >= nText )
|
||||
hb_itemReturn( pText );
|
||||
else
|
||||
hb_retclen( hb_itemGetCPtr( pText ) + ulText - lLen, lLen );
|
||||
hb_retclen( hb_itemGetCPtr( pText ) + nText - nLen, nLen );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -78,21 +78,21 @@ static char * hb_SecToTimeStr( char * pszTime, long lTime )
|
||||
|
||||
static long hb_TimeStrToSec( const char * pszTime )
|
||||
{
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
long lTime = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_TimeStrToSec(%s)", pszTime));
|
||||
|
||||
ulLen = strlen( pszTime );
|
||||
nLen = strlen( pszTime );
|
||||
|
||||
if( ulLen >= 1 )
|
||||
lTime += ( long ) hb_strVal( pszTime, ulLen ) * 3600;
|
||||
if( nLen >= 1 )
|
||||
lTime += ( long ) hb_strVal( pszTime, nLen ) * 3600;
|
||||
|
||||
if( ulLen >= 4 )
|
||||
lTime += ( long ) hb_strVal( pszTime + 3, ulLen - 3 ) * 60;
|
||||
if( nLen >= 4 )
|
||||
lTime += ( long ) hb_strVal( pszTime + 3, nLen - 3 ) * 60;
|
||||
|
||||
if( ulLen >= 7 )
|
||||
lTime += ( long ) hb_strVal( pszTime + 6, ulLen - 6 );
|
||||
if( nLen >= 7 )
|
||||
lTime += ( long ) hb_strVal( pszTime + 6, nLen - 6 );
|
||||
|
||||
return lTime;
|
||||
}
|
||||
|
||||
@@ -96,18 +96,18 @@ static void hb_getScreenRange( int * piMin, int * piMax,
|
||||
HB_FUNC( SAVESCREEN )
|
||||
{
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
void * pBuffer;
|
||||
HB_BOOL fNoCheck = HB_FALSE;
|
||||
|
||||
hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE );
|
||||
hb_getScreenRange( &iLeft, &iRight, fNoCheck, HB_FALSE );
|
||||
|
||||
hb_gtRectSize( iTop, iLeft, iBottom, iRight, &ulSize );
|
||||
pBuffer = hb_xgrab( ulSize + 1 );
|
||||
hb_gtRectSize( iTop, iLeft, iBottom, iRight, &nSize );
|
||||
pBuffer = hb_xgrab( nSize + 1 );
|
||||
|
||||
hb_gtSave( iTop, iLeft, iBottom, iRight, pBuffer );
|
||||
hb_retclen_buffer( ( char * ) pBuffer, ulSize );
|
||||
hb_retclen_buffer( ( char * ) pBuffer, nSize );
|
||||
}
|
||||
|
||||
HB_FUNC( RESTSCREEN )
|
||||
|
||||
@@ -286,29 +286,29 @@ HB_FUNC( HB_SETKEYSAVE )
|
||||
PHB_SK_DATA sk_data = ( PHB_SK_DATA ) hb_stackGetTSD( &s_skData );
|
||||
PHB_ITEM pKeys, pKeyElements, pParam;
|
||||
PHB_SETKEY sk_list_tmp;
|
||||
HB_SIZE itemcount, nitem;
|
||||
HB_SIZE nItemCount, nItem;
|
||||
|
||||
/* build an multi-dimensional array from existing hot-keys, and return it */
|
||||
|
||||
/* count the number of items in the list */
|
||||
for( itemcount = 0, sk_list_tmp = sk_data->sk_list;
|
||||
for( nItemCount = 0, sk_list_tmp = sk_data->sk_list;
|
||||
sk_list_tmp;
|
||||
itemcount++, sk_list_tmp = sk_list_tmp->next )
|
||||
nItemCount++, sk_list_tmp = sk_list_tmp->next )
|
||||
;
|
||||
|
||||
pKeys = hb_itemArrayNew( itemcount );
|
||||
pKeys = hb_itemArrayNew( nItemCount );
|
||||
pKeyElements = hb_itemNew( NULL );
|
||||
|
||||
for( nitem = 1, sk_list_tmp = sk_data->sk_list;
|
||||
nitem <= itemcount;
|
||||
nitem++, sk_list_tmp = sk_list_tmp->next )
|
||||
for( nItem = 1, sk_list_tmp = sk_data->sk_list;
|
||||
nItem <= nItemCount;
|
||||
nItem++, sk_list_tmp = sk_list_tmp->next )
|
||||
{
|
||||
hb_arrayNew( pKeyElements, 3 );
|
||||
hb_arraySetNI( pKeyElements, 1, sk_list_tmp->iKeyCode );
|
||||
hb_arraySet( pKeyElements, 2, sk_list_tmp->pAction );
|
||||
if( sk_list_tmp->pIsActive )
|
||||
hb_arraySet( pKeyElements, 3, sk_list_tmp->pIsActive );
|
||||
hb_arraySetForward( pKeys, nitem, pKeyElements );
|
||||
hb_arraySetForward( pKeys, nItem, pKeyElements );
|
||||
}
|
||||
hb_itemRelease( pKeyElements );
|
||||
hb_itemReturnRelease( pKeys );
|
||||
@@ -320,11 +320,11 @@ HB_FUNC( HB_SETKEYSAVE )
|
||||
|
||||
if( HB_IS_ARRAY( pParam ) )
|
||||
{
|
||||
itemcount = hb_arrayLen( pParam );
|
||||
nItemCount = hb_arrayLen( pParam );
|
||||
|
||||
for( nitem = 1; nitem <= itemcount; nitem++ )
|
||||
for( nItem = 1; nItem <= nItemCount; nItem++ )
|
||||
{
|
||||
PHB_ITEM itmKeyElements = hb_arrayGetItemPtr( pParam, nitem );
|
||||
PHB_ITEM itmKeyElements = hb_arrayGetItemPtr( pParam, nItem );
|
||||
|
||||
sk_add( &sk_data->sk_list, HB_FALSE,
|
||||
hb_arrayGetNI( itmKeyElements, 1 ),
|
||||
|
||||
@@ -62,9 +62,9 @@ HB_FUNC( LOWER )
|
||||
if( pText )
|
||||
{
|
||||
char * pszBuffer = hb_itemGetC( pText );
|
||||
HB_SIZE ulLen = hb_itemGetCLen( pText );
|
||||
HB_SIZE nLen = hb_itemGetCLen( pText );
|
||||
|
||||
hb_retclen_buffer( hb_strLower( pszBuffer, ulLen ), ulLen );
|
||||
hb_retclen_buffer( hb_strLower( pszBuffer, nLen ), nLen );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 1103, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
@@ -78,9 +78,9 @@ HB_FUNC( UPPER )
|
||||
if( pText )
|
||||
{
|
||||
char * pszBuffer = hb_itemGetC( pText );
|
||||
HB_SIZE ulLen = hb_itemGetCLen( pText );
|
||||
HB_SIZE nLen = hb_itemGetCLen( pText );
|
||||
|
||||
hb_retclen_buffer( hb_strUpper( pszBuffer, ulLen ), ulLen );
|
||||
hb_retclen_buffer( hb_strUpper( pszBuffer, nLen ), nLen );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 1102, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
|
||||
@@ -58,19 +58,19 @@ HB_FUNC( HB_STRTOEXP )
|
||||
|
||||
if( pszString )
|
||||
{
|
||||
HB_SIZE ulLen = hb_parclen( 1 ), ulRet, ul, uQ = 0;
|
||||
HB_SIZE nLen = hb_parclen( 1 ), nRet, n, nQ = 0;
|
||||
int iType = 0;
|
||||
char ch, * pDst, * pszResult;
|
||||
|
||||
for( ul = 0; ul < ulLen; ++ul )
|
||||
for( n = 0; n < nLen; ++n )
|
||||
{
|
||||
switch( pszString[ ul ] )
|
||||
switch( pszString[ n ] )
|
||||
{
|
||||
case '\\':
|
||||
++uQ;
|
||||
++nQ;
|
||||
break;
|
||||
case '"':
|
||||
++uQ;
|
||||
++nQ;
|
||||
iType |= 1;
|
||||
break;
|
||||
case '\'':
|
||||
@@ -82,23 +82,23 @@ HB_FUNC( HB_STRTOEXP )
|
||||
case '\r':
|
||||
case '\n':
|
||||
iType |= 7;
|
||||
++uQ;
|
||||
++nQ;
|
||||
break;
|
||||
case '\0':
|
||||
iType |= 7;
|
||||
uQ += 3;
|
||||
nQ += 3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( iType == 7 || hb_parl( 2 ) )
|
||||
{
|
||||
ulRet = ulLen + 3 + uQ;
|
||||
pDst = pszResult = ( char * ) hb_xgrab( ulRet + 1 );
|
||||
nRet = nLen + 3 + nQ;
|
||||
pDst = pszResult = ( char * ) hb_xgrab( nRet + 1 );
|
||||
*pDst++ = 'e';
|
||||
*pDst++ = '"';
|
||||
for( ul = 0; ul < ulLen; ++ul )
|
||||
for( n = 0; n < nLen; ++n )
|
||||
{
|
||||
ch = pszString[ ul ];
|
||||
ch = pszString[ n ];
|
||||
switch( ch )
|
||||
{
|
||||
case '\r':
|
||||
@@ -127,8 +127,8 @@ HB_FUNC( HB_STRTOEXP )
|
||||
}
|
||||
else
|
||||
{
|
||||
ulRet = ulLen + 2;
|
||||
pDst = pszResult = ( char * ) hb_xgrab( ulRet + 1 );
|
||||
nRet = nLen + 2;
|
||||
pDst = pszResult = ( char * ) hb_xgrab( nRet + 1 );
|
||||
if( ( iType & 1 ) == 0 )
|
||||
*pDst++ = ch = '"';
|
||||
else if( ( iType & 2 ) == 0 )
|
||||
@@ -138,11 +138,11 @@ HB_FUNC( HB_STRTOEXP )
|
||||
*pDst++ = '[';
|
||||
ch = ']';
|
||||
}
|
||||
memcpy( pDst, pszString, ulLen );
|
||||
pDst += ulLen;
|
||||
memcpy( pDst, pszString, nLen );
|
||||
pDst += nLen;
|
||||
*pDst++ = ch;
|
||||
}
|
||||
*pDst = '\0';
|
||||
hb_retclen_buffer( pszResult, ulRet );
|
||||
hb_retclen_buffer( pszResult, nRet );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,28 +116,28 @@ HB_FUNC( STRTRAN )
|
||||
if( bAll || nCount > 0 )
|
||||
{
|
||||
HB_SIZE nFound = 0;
|
||||
HB_ISIZ lReplaced = 0;
|
||||
HB_SIZE i = 0;
|
||||
HB_ISIZ nReplaced = 0;
|
||||
HB_SIZE n = 0;
|
||||
HB_SIZE nLength = nText;
|
||||
HB_SIZE nStop = nText - nSeek + 1;
|
||||
|
||||
while( i < nStop )
|
||||
while( n < nStop )
|
||||
{
|
||||
if( ( bAll || lReplaced < ( HB_ISIZ ) nCount ) &&
|
||||
! memcmp( szText + i, szSeek, nSeek ) )
|
||||
if( ( bAll || nReplaced < ( HB_ISIZ ) nCount ) &&
|
||||
! memcmp( szText + n, szSeek, nSeek ) )
|
||||
{
|
||||
nFound++;
|
||||
if( nFound >= nStart )
|
||||
{
|
||||
lReplaced++;
|
||||
nReplaced++;
|
||||
nLength = nLength - nSeek + nReplace;
|
||||
i += nSeek;
|
||||
n += nSeek;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
n++;
|
||||
}
|
||||
else
|
||||
i++;
|
||||
n++;
|
||||
}
|
||||
|
||||
if( nFound )
|
||||
@@ -146,31 +146,31 @@ HB_FUNC( STRTRAN )
|
||||
char * szPtr = szResult;
|
||||
|
||||
nFound = 0;
|
||||
i = 0;
|
||||
while( i < nText )
|
||||
n = 0;
|
||||
while( n < nText )
|
||||
{
|
||||
if( lReplaced && ! memcmp( szText + i, szSeek, nSeek ) )
|
||||
if( nReplaced && ! memcmp( szText + n, szSeek, nSeek ) )
|
||||
{
|
||||
nFound++;
|
||||
if( nFound >= nStart )
|
||||
{
|
||||
lReplaced--;
|
||||
nReplaced--;
|
||||
memcpy( szPtr, szReplace, nReplace );
|
||||
szPtr += nReplace;
|
||||
i += nSeek;
|
||||
n += nSeek;
|
||||
}
|
||||
else
|
||||
{
|
||||
*szPtr = szText[ i ];
|
||||
*szPtr = szText[ n ];
|
||||
szPtr++;
|
||||
i++;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*szPtr = szText[ i ];
|
||||
*szPtr = szText[ n ];
|
||||
szPtr++;
|
||||
i++;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
hb_retclen_buffer( szResult, nLength );
|
||||
|
||||
@@ -58,32 +58,32 @@ HB_FUNC( STUFF )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && HB_ISCHAR( 4 ) )
|
||||
{
|
||||
const char * szText = hb_parc( 1 );
|
||||
HB_SIZE ulText = hb_parclen( 1 );
|
||||
HB_SIZE ulPos = hb_parns( 2 );
|
||||
HB_SIZE ulDel = hb_parns( 3 );
|
||||
HB_SIZE ulInsert = hb_parclen( 4 );
|
||||
HB_SIZE nText = hb_parclen( 1 );
|
||||
HB_SIZE nPos = hb_parns( 2 );
|
||||
HB_SIZE nDel = hb_parns( 3 );
|
||||
HB_SIZE nInsert = hb_parclen( 4 );
|
||||
|
||||
HB_SIZE ulTotalLen;
|
||||
HB_SIZE nTotalLen;
|
||||
|
||||
if( ulPos > 0 )
|
||||
ulPos--;
|
||||
if( nPos > 0 )
|
||||
nPos--;
|
||||
|
||||
if( ulPos > ulText )
|
||||
ulPos = ulText;
|
||||
if( nPos > nText )
|
||||
nPos = nText;
|
||||
|
||||
if( ulDel > ulText - ulPos )
|
||||
ulDel = ulText - ulPos;
|
||||
if( nDel > nText - nPos )
|
||||
nDel = nText - nPos;
|
||||
|
||||
if( ( ulTotalLen = ulText + ulInsert - ulDel ) > 0 )
|
||||
if( ( nTotalLen = nText + nInsert - nDel ) > 0 )
|
||||
{
|
||||
char * szResult = ( char * ) hb_xgrab( ulTotalLen + 1 );
|
||||
char * szResult = ( char * ) hb_xgrab( nTotalLen + 1 );
|
||||
|
||||
hb_xmemcpy( szResult, szText, ulPos );
|
||||
hb_xmemcpy( szResult + ulPos, hb_parc( 4 ), ulInsert );
|
||||
hb_xmemcpy( szResult + ulPos + ulInsert, szText + ulPos + ulDel, ulText - ( ulPos + ulDel ) );
|
||||
hb_xmemcpy( szResult, szText, nPos );
|
||||
hb_xmemcpy( szResult + nPos, hb_parc( 4 ), nInsert );
|
||||
hb_xmemcpy( szResult + nPos + nInsert, szText + nPos + nDel, nText - ( nPos + nDel ) );
|
||||
|
||||
szResult[ ulTotalLen ] = '\0';
|
||||
hb_retclen_buffer( szResult, ulTotalLen );
|
||||
szResult[ nTotalLen ] = '\0';
|
||||
hb_retclen_buffer( szResult, nTotalLen );
|
||||
}
|
||||
else
|
||||
hb_retc_null();
|
||||
|
||||
@@ -57,13 +57,13 @@
|
||||
|
||||
static int s_traceLogLevel = HB_TR_DEFAULT;
|
||||
|
||||
static void hb_trace_message( char * buffer, HB_SIZE ulSize, int iParam, int iCount )
|
||||
static void hb_trace_message( char * buffer, HB_SIZE nSize, int iParam, int iCount )
|
||||
{
|
||||
int iFirst = iParam;
|
||||
|
||||
buffer[ 0 ] = '\0';
|
||||
|
||||
while( iParam <= iCount && ulSize > 1 )
|
||||
while( iParam <= iCount && nSize > 1 )
|
||||
{
|
||||
char * pszString;
|
||||
HB_SIZE nLen;
|
||||
@@ -72,12 +72,12 @@ static void hb_trace_message( char * buffer, HB_SIZE ulSize, int iParam, int iCo
|
||||
if( iParam > iFirst )
|
||||
{
|
||||
*buffer++ = ' ';
|
||||
--ulSize;
|
||||
--nSize;
|
||||
}
|
||||
pszString = hb_itemString( hb_param( iParam, HB_IT_ANY ), &nLen, &fFree );
|
||||
hb_strncpy( buffer, pszString, ulSize );
|
||||
hb_strncpy( buffer, pszString, nSize );
|
||||
nLen = strlen( buffer );
|
||||
ulSize -= nLen;
|
||||
nSize -= nLen;
|
||||
buffer += nLen;
|
||||
if( fFree )
|
||||
hb_xfree( pszString );
|
||||
|
||||
@@ -87,13 +87,13 @@ static HB_TSD_NEW( s_scrData, sizeof( HB_SCRDATA ), NULL, hb_xSaveRestRelease );
|
||||
HB_FUNC( __XSAVESCREEN )
|
||||
{
|
||||
PHB_SCRDATA pScrData = ( PHB_SCRDATA ) hb_stackGetTSD( &s_scrData );
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
hb_gtGetPos( &pScrData->row, &pScrData->col );
|
||||
hb_gtRectSize( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), &ulSize );
|
||||
hb_gtRectSize( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), &nSize );
|
||||
if( pScrData->buffer )
|
||||
hb_xfree( pScrData->buffer );
|
||||
pScrData->buffer = hb_xgrab( ulSize );
|
||||
pScrData->buffer = hb_xgrab( nSize );
|
||||
hb_gtSave( 0, 0, hb_gtMaxRow(), hb_gtMaxCol(), pScrData->buffer );
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -73,7 +73,7 @@ static HB_BOOL hb_itemIsLess( PHB_ITEM pItem1, PHB_ITEM pItem2, PHB_ITEM pBlock,
|
||||
hb_vmPush( pItem2 );
|
||||
hb_vmSend( 2 );
|
||||
|
||||
if( pBaseArray->ulLen <= ulLast )
|
||||
if( pBaseArray->nLen <= ulLast )
|
||||
return HB_FALSE;
|
||||
else
|
||||
{
|
||||
@@ -172,7 +172,7 @@ static HB_ISIZ hb_arraySortQuickPartition( PHB_BASEARRAY pBaseArray, HB_ISIZ lb,
|
||||
}
|
||||
|
||||
/* pivot belongs in pBaseArray->pItems[j] */
|
||||
if( j > lb && pBaseArray->ulLen > ( HB_SIZE ) j )
|
||||
if( j > lb && pBaseArray->nLen > ( HB_SIZE ) j )
|
||||
hb_itemSwap( pBaseArray->pItems + lb, pBaseArray->pItems + j );
|
||||
|
||||
return j;
|
||||
@@ -186,9 +186,9 @@ static void hb_arraySortQuick( PHB_BASEARRAY pBaseArray, HB_ISIZ lb, HB_ISIZ ub,
|
||||
|
||||
while( lb < ub )
|
||||
{
|
||||
if( ( HB_SIZE ) ub >= pBaseArray->ulLen )
|
||||
if( ( HB_SIZE ) ub >= pBaseArray->nLen )
|
||||
{
|
||||
ub = pBaseArray->ulLen - 1;
|
||||
ub = pBaseArray->nLen - 1;
|
||||
if( lb >= ub )
|
||||
break;
|
||||
}
|
||||
@@ -217,7 +217,7 @@ HB_BOOL hb_arraySort( PHB_ITEM pArray, HB_SIZE * pulStart, HB_SIZE * pulCount, P
|
||||
if( HB_IS_ARRAY( pArray ) )
|
||||
{
|
||||
PHB_BASEARRAY pBaseArray = pArray->item.asArray.value;
|
||||
HB_SIZE ulLen = pBaseArray->ulLen;
|
||||
HB_SIZE ulLen = pBaseArray->nLen;
|
||||
HB_SIZE ulStart;
|
||||
HB_SIZE ulCount;
|
||||
HB_SIZE ulEnd;
|
||||
|
||||
@@ -1698,7 +1698,7 @@ PHB_SYMB hb_objGetMethod( PHB_ITEM pObject, PHB_SYMB pMessage,
|
||||
pStack->uiClass = pObject->item.asArray.value->uiClass;
|
||||
if( pObject->item.asArray.value->uiPrevCls )
|
||||
{
|
||||
if( pObject->item.asArray.value->ulLen )
|
||||
if( pObject->item.asArray.value->nLen )
|
||||
{
|
||||
/*
|
||||
* Copy real object - do not move! the same super casted
|
||||
|
||||
@@ -4636,8 +4636,8 @@ static void hb_vmEnumStart( int nVars, int nDescend )
|
||||
{
|
||||
/* the index into an array */
|
||||
pEnum->item.asEnum.offset = ( nDescend > 0 ) ? 1 :
|
||||
pBase->item.asArray.value->ulLen;
|
||||
if( pBase->item.asArray.value->ulLen == 0 )
|
||||
pBase->item.asArray.value->nLen;
|
||||
if( pBase->item.asArray.value->nLen == 0 )
|
||||
fStart = HB_FALSE;
|
||||
}
|
||||
else if( HB_IS_HASH( pBase ) )
|
||||
@@ -4717,7 +4717,7 @@ static void hb_vmEnumNext( void )
|
||||
pEnum->item.asEnum.valuePtr = NULL;
|
||||
}
|
||||
if( ( HB_SIZE ) ++pEnum->item.asEnum.offset >
|
||||
pBase->item.asArray.value->ulLen )
|
||||
pBase->item.asArray.value->nLen )
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -5095,7 +5095,7 @@ static void hb_vmArrayPush( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->ulLen ) )
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->nLen ) )
|
||||
{
|
||||
hb_itemCopy( pIndex, pArray->item.asArray.value->pItems + ulIndex - 1 );
|
||||
hb_itemMove( pArray, pIndex );
|
||||
@@ -5187,7 +5187,7 @@ static void hb_vmArrayPushRef( void )
|
||||
hb_stackPop();
|
||||
return;
|
||||
}
|
||||
else if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->ulLen ) )
|
||||
else if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->nLen ) )
|
||||
{
|
||||
/* This function is safe for overwriting passed array, [druzus] */
|
||||
hb_arrayGetItemRef( pArray, ulIndex, pRefer );
|
||||
@@ -5286,7 +5286,7 @@ static void hb_vmArrayPop( void )
|
||||
return;
|
||||
}
|
||||
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->ulLen ) )
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->nLen ) )
|
||||
{
|
||||
pValue->type &= ~( HB_IT_MEMOFLAG | HB_IT_DEFAULT );
|
||||
hb_itemMoveRef( pArray->item.asArray.value->pItems + ulIndex - 1, pValue );
|
||||
@@ -5605,7 +5605,7 @@ static void hb_vmPushAParams( void )
|
||||
pArray = hb_stackItemFromTop( -1 );
|
||||
if( HB_IS_ARRAY( pArray ) )
|
||||
{
|
||||
HB_SIZE ulLen = pArray->item.asArray.value->ulLen, ul;
|
||||
HB_SIZE ulLen = pArray->item.asArray.value->nLen, ul;
|
||||
|
||||
if( ulLen )
|
||||
{
|
||||
@@ -10979,7 +10979,7 @@ static void hb_vmArrayItemPush( HB_SIZE ulIndex )
|
||||
return;
|
||||
}
|
||||
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->ulLen ) )
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->nLen ) )
|
||||
{
|
||||
PHB_ITEM pItem = hb_stackAllocItem();
|
||||
|
||||
@@ -11061,7 +11061,7 @@ static void hb_vmArrayItemPop( HB_SIZE ulIndex )
|
||||
return;
|
||||
}
|
||||
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->ulLen ) )
|
||||
if( HB_IS_VALID_INDEX( ulIndex, pArray->item.asArray.value->nLen ) )
|
||||
{
|
||||
pValue->type &= ~( HB_IT_MEMOFLAG | HB_IT_DEFAULT );
|
||||
hb_itemMoveRef( pArray->item.asArray.value->pItems + ulIndex - 1, pValue );
|
||||
|
||||
@@ -172,59 +172,59 @@ HB_BOOL hb_itemRelease( PHB_ITEM pItem )
|
||||
return HB_FALSE;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemArrayNew( HB_SIZE ulLen )
|
||||
PHB_ITEM hb_itemArrayNew( HB_SIZE nLen )
|
||||
{
|
||||
PHB_ITEM pItem;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemArrayNew(%" HB_PFS "u)", ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemArrayNew(%" HB_PFS "u)", nLen));
|
||||
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
hb_arrayNew( pItem, ulLen );
|
||||
hb_arrayNew( pItem, nLen );
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemArrayGet( PHB_ITEM pArray, HB_SIZE ulIndex )
|
||||
PHB_ITEM hb_itemArrayGet( PHB_ITEM pArray, HB_SIZE nIndex )
|
||||
{
|
||||
PHB_ITEM pItem;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemArrayGet(%p, %" HB_PFS "u)", pArray, ulIndex));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemArrayGet(%p, %" HB_PFS "u)", pArray, nIndex));
|
||||
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
if( pArray )
|
||||
hb_arrayGet( pArray, ulIndex, pItem );
|
||||
hb_arrayGet( pArray, nIndex, pItem );
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemArrayPut( PHB_ITEM pArray, HB_SIZE ulIndex, PHB_ITEM pItem )
|
||||
PHB_ITEM hb_itemArrayPut( PHB_ITEM pArray, HB_SIZE nIndex, PHB_ITEM pItem )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemArrayPut(%p, %" HB_PFS "u, %p)", pArray, ulIndex, pItem));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemArrayPut(%p, %" HB_PFS "u, %p)", pArray, nIndex, pItem));
|
||||
|
||||
if( pArray )
|
||||
hb_arraySet( pArray, ulIndex, pItem );
|
||||
hb_arraySet( pArray, nIndex, pItem );
|
||||
|
||||
return pArray;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutC( PHB_ITEM pItem, const char * szText )
|
||||
{
|
||||
HB_SIZE ulLen, ulAlloc;
|
||||
HB_SIZE nLen, nAlloc;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutC(%p, %s)", pItem, szText));
|
||||
|
||||
ulLen = szText ? strlen( szText ) : 0;
|
||||
if( ulLen > 1 )
|
||||
nLen = szText ? strlen( szText ) : 0;
|
||||
if( nLen > 1 )
|
||||
{
|
||||
ulAlloc = ulLen + 1;
|
||||
szText = ( char * ) hb_xmemcpy( hb_xgrab( ulAlloc ), szText, ulAlloc );
|
||||
nAlloc = nLen + 1;
|
||||
szText = ( char * ) hb_xmemcpy( hb_xgrab( nAlloc ), szText, nAlloc );
|
||||
}
|
||||
else
|
||||
{
|
||||
ulAlloc = 0;
|
||||
szText = ( char * ) ( ulLen ? hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ] : "" );
|
||||
nAlloc = 0;
|
||||
szText = ( char * ) ( nLen ? hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ] : "" );
|
||||
}
|
||||
|
||||
if( pItem )
|
||||
@@ -237,28 +237,28 @@ PHB_ITEM hb_itemPutC( PHB_ITEM pItem, const char * szText )
|
||||
|
||||
pItem->type = HB_IT_STRING;
|
||||
pItem->item.asString.value = ( char * ) szText;
|
||||
pItem->item.asString.length = ulLen;
|
||||
pItem->item.asString.allocated = ulAlloc;
|
||||
pItem->item.asString.length = nLen;
|
||||
pItem->item.asString.allocated = nAlloc;
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, const char * szText, HB_SIZE ulLen )
|
||||
PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, const char * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_SIZE ulAlloc;
|
||||
HB_SIZE nAlloc;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCL(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) ulLen, szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCL(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) nLen, szText, nLen));
|
||||
|
||||
if( ulLen > 1 )
|
||||
if( nLen > 1 )
|
||||
{
|
||||
ulAlloc = ulLen + 1;
|
||||
szText = ( char * ) hb_xmemcpy( hb_xgrab( ulAlloc ), szText, ulLen );
|
||||
( ( char * ) szText )[ ulLen ] = '\0';
|
||||
nAlloc = nLen + 1;
|
||||
szText = ( char * ) hb_xmemcpy( hb_xgrab( nAlloc ), szText, nLen );
|
||||
( ( char * ) szText )[ nLen ] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
ulAlloc = 0;
|
||||
szText = ( ulLen ? hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ] : "" );
|
||||
nAlloc = 0;
|
||||
szText = ( nLen ? hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ] : "" );
|
||||
}
|
||||
|
||||
if( pItem )
|
||||
@@ -269,14 +269,14 @@ PHB_ITEM hb_itemPutCL( PHB_ITEM pItem, const char * szText, HB_SIZE ulLen )
|
||||
else
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
/* NOTE: CA-Cl*pper seems to be buggy here, it will return ulLen bytes of
|
||||
/* NOTE: CA-Cl*pper seems to be buggy here, it will return nLen bytes of
|
||||
trash if the szText buffer is NULL, at least with hb_retclen().
|
||||
[vszakats] */
|
||||
|
||||
pItem->type = HB_IT_STRING;
|
||||
pItem->item.asString.value = ( char * ) szText;
|
||||
pItem->item.asString.length = ulLen;
|
||||
pItem->item.asString.allocated = ulAlloc;
|
||||
pItem->item.asString.length = nLen;
|
||||
pItem->item.asString.allocated = nAlloc;
|
||||
|
||||
return pItem;
|
||||
}
|
||||
@@ -310,9 +310,9 @@ PHB_ITEM hb_itemPutCConst( PHB_ITEM pItem, const char * szText )
|
||||
return pItem;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, HB_SIZE ulLen )
|
||||
PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCLConst(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) ulLen, szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCLConst(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) nLen, szText, nLen));
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
@@ -323,12 +323,12 @@ PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, HB_SIZE ulLen )
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
pItem->type = HB_IT_STRING;
|
||||
pItem->item.asString.length = ulLen;
|
||||
pItem->item.asString.length = nLen;
|
||||
pItem->item.asString.allocated = 0;
|
||||
|
||||
if( ulLen == 0 )
|
||||
if( nLen == 0 )
|
||||
pItem->item.asString.value = ( char * ) "";
|
||||
else if( szText[ ulLen ] == '\0' )
|
||||
else if( szText[ nLen ] == '\0' )
|
||||
pItem->item.asString.value = ( char * ) szText;
|
||||
else
|
||||
hb_errInternal( 6003, "Internal error: hb_itemPutCLConst() missing termination character", NULL, NULL );
|
||||
@@ -338,7 +338,7 @@ PHB_ITEM hb_itemPutCLConst( PHB_ITEM pItem, const char * szText, HB_SIZE ulLen )
|
||||
|
||||
PHB_ITEM hb_itemPutCPtr( PHB_ITEM pItem, char * szText )
|
||||
{
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCPtr(%p, %s)", pItem, szText));
|
||||
|
||||
@@ -350,18 +350,18 @@ PHB_ITEM hb_itemPutCPtr( PHB_ITEM pItem, char * szText )
|
||||
else
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
ulLen = szText ? strlen( szText ) : 0;
|
||||
nLen = szText ? strlen( szText ) : 0;
|
||||
|
||||
pItem->type = HB_IT_STRING;
|
||||
pItem->item.asString.length = ulLen;
|
||||
if( ulLen == 0 )
|
||||
pItem->item.asString.length = nLen;
|
||||
if( nLen == 0 )
|
||||
{
|
||||
pItem->item.asString.allocated = 0;
|
||||
pItem->item.asString.value = ( char * ) "";
|
||||
if( szText )
|
||||
hb_xfree( szText );
|
||||
}
|
||||
else if( ulLen == 1 )
|
||||
else if( nLen == 1 )
|
||||
{
|
||||
pItem->item.asString.allocated = 0;
|
||||
pItem->item.asString.value = ( char * ) hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ];
|
||||
@@ -369,17 +369,17 @@ PHB_ITEM hb_itemPutCPtr( PHB_ITEM pItem, char * szText )
|
||||
}
|
||||
else
|
||||
{
|
||||
szText[ ulLen ] = '\0';
|
||||
pItem->item.asString.allocated = ulLen + 1;
|
||||
szText[ nLen ] = '\0';
|
||||
pItem->item.asString.allocated = nLen + 1;
|
||||
pItem->item.asString.value = szText;
|
||||
}
|
||||
|
||||
return pItem;
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, HB_SIZE ulLen )
|
||||
PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCLPtr(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) ulLen, szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutCLPtr(%p, %.*s, %" HB_PFS "u)", pItem, ( int ) nLen, szText, nLen));
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
@@ -390,14 +390,14 @@ PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, HB_SIZE ulLen )
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
pItem->type = HB_IT_STRING;
|
||||
pItem->item.asString.length = ulLen;
|
||||
if( ulLen == 0 )
|
||||
pItem->item.asString.length = nLen;
|
||||
if( nLen == 0 )
|
||||
{
|
||||
pItem->item.asString.allocated = 0;
|
||||
pItem->item.asString.value = ( char * ) "";
|
||||
hb_xfree( szText );
|
||||
}
|
||||
else if( ulLen == 1 )
|
||||
else if( nLen == 1 )
|
||||
{
|
||||
pItem->item.asString.allocated = 0;
|
||||
pItem->item.asString.value = ( char * ) hb_szAscii[ ( unsigned char ) ( szText[ 0 ] ) ];
|
||||
@@ -405,8 +405,8 @@ PHB_ITEM hb_itemPutCLPtr( PHB_ITEM pItem, char * szText, HB_SIZE ulLen )
|
||||
}
|
||||
else
|
||||
{
|
||||
szText[ ulLen ] = '\0';
|
||||
pItem->item.asString.allocated = ulLen + 1;
|
||||
szText[ nLen ] = '\0';
|
||||
pItem->item.asString.allocated = nLen + 1;
|
||||
pItem->item.asString.value = szText;
|
||||
}
|
||||
|
||||
@@ -460,18 +460,18 @@ HB_SIZE hb_itemGetCLen( PHB_ITEM pItem )
|
||||
return 0;
|
||||
}
|
||||
|
||||
HB_SIZE hb_itemCopyC( PHB_ITEM pItem, char * szBuffer, HB_SIZE ulLen )
|
||||
HB_SIZE hb_itemCopyC( PHB_ITEM pItem, char * szBuffer, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyC(%p, %s, %" HB_PFS "u)", pItem, szBuffer, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyC(%p, %s, %" HB_PFS "u)", pItem, szBuffer, nLen));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
if( ulLen == 0 || ulLen > pItem->item.asString.length )
|
||||
ulLen = pItem->item.asString.length;
|
||||
if( nLen == 0 || nLen > pItem->item.asString.length )
|
||||
nLen = pItem->item.asString.length;
|
||||
|
||||
hb_xmemcpy( szBuffer, pItem->item.asString.value, ulLen );
|
||||
hb_xmemcpy( szBuffer, pItem->item.asString.value, nLen );
|
||||
|
||||
return ulLen;
|
||||
return nLen;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
@@ -1851,7 +1851,7 @@ PHB_ITEM hb_itemUnRefOnce( PHB_ITEM pItem )
|
||||
{
|
||||
/* a reference to a static variable or array item */
|
||||
if( ( HB_SIZE ) pItem->item.asRefer.value <
|
||||
pItem->item.asRefer.BasePtr.array->ulLen )
|
||||
pItem->item.asRefer.BasePtr.array->nLen )
|
||||
{
|
||||
pItem = pItem->item.asRefer.BasePtr.array->pItems +
|
||||
pItem->item.asRefer.value;
|
||||
@@ -1868,7 +1868,7 @@ PHB_ITEM hb_itemUnRefOnce( PHB_ITEM pItem )
|
||||
|
||||
/* check it again - user error handler can resize the array */
|
||||
if( ( HB_SIZE ) pItem->item.asRefer.value <
|
||||
pItem->item.asRefer.BasePtr.array->ulLen )
|
||||
pItem->item.asRefer.BasePtr.array->nLen )
|
||||
{
|
||||
pItem = pItem->item.asRefer.BasePtr.array->pItems +
|
||||
pItem->item.asRefer.value;
|
||||
@@ -1981,30 +1981,30 @@ PHB_ITEM hb_itemUnRefRefer( PHB_ITEM pItem )
|
||||
/* Internal API, not standard Clipper */
|
||||
/* Resize string buffer of given string item */
|
||||
|
||||
PHB_ITEM hb_itemReSizeString( PHB_ITEM pItem, HB_SIZE ulSize )
|
||||
PHB_ITEM hb_itemReSizeString( PHB_ITEM pItem, HB_SIZE nSize )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemReSizeString(%p,%" HB_PFS "u)", pItem, ulSize));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemReSizeString(%p,%" HB_PFS "u)", pItem, nSize));
|
||||
|
||||
if( pItem->item.asString.allocated == 0 )
|
||||
{
|
||||
char * szText = ( char * ) hb_xgrab( ulSize + 1 );
|
||||
char * szText = ( char * ) hb_xgrab( nSize + 1 );
|
||||
hb_xmemcpy( szText, pItem->item.asString.value,
|
||||
pItem->item.asString.length );
|
||||
szText[ ulSize ] = '\0';
|
||||
szText[ nSize ] = '\0';
|
||||
pItem->item.asString.value = szText;
|
||||
pItem->item.asString.length = ulSize;
|
||||
pItem->item.asString.allocated = ulSize + 1;
|
||||
pItem->item.asString.length = nSize;
|
||||
pItem->item.asString.allocated = nSize + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
HB_SIZE ulAlloc = ulSize + 1 +
|
||||
( pItem->item.asString.allocated <= ulSize ? ulSize : 0 );
|
||||
HB_SIZE nAlloc = nSize + 1 +
|
||||
( pItem->item.asString.allocated <= nSize ? nSize : 0 );
|
||||
pItem->item.asString.value = ( char* )
|
||||
hb_xRefResize( pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
ulAlloc, &pItem->item.asString.allocated );
|
||||
pItem->item.asString.length = ulSize;
|
||||
pItem->item.asString.value[ ulSize ] = '\0';
|
||||
nAlloc, &pItem->item.asString.allocated );
|
||||
pItem->item.asString.length = nSize;
|
||||
pItem->item.asString.value[ nSize ] = '\0';
|
||||
}
|
||||
pItem->type &= ~HB_IT_DEFAULT;
|
||||
|
||||
@@ -2021,9 +2021,9 @@ PHB_ITEM hb_itemUnShareString( PHB_ITEM pItem )
|
||||
if( pItem->item.asString.allocated == 0 ||
|
||||
hb_xRefCount( pItem->item.asString.value ) > 1 )
|
||||
{
|
||||
HB_SIZE ulLen = pItem->item.asString.length + 1;
|
||||
char * szText = ( char * ) hb_xmemcpy( hb_xgrab( ulLen ),
|
||||
pItem->item.asString.value, ulLen );
|
||||
HB_SIZE nLen = pItem->item.asString.length + 1;
|
||||
char * szText = ( char * ) hb_xmemcpy( hb_xgrab( nLen ),
|
||||
pItem->item.asString.value, nLen );
|
||||
if( pItem->item.asString.allocated )
|
||||
{
|
||||
/* GCLOCK enter */
|
||||
@@ -2031,7 +2031,7 @@ PHB_ITEM hb_itemUnShareString( PHB_ITEM pItem )
|
||||
/* GCLOCK leave */
|
||||
}
|
||||
pItem->item.asString.value = szText;
|
||||
pItem->item.asString.allocated = ulLen;
|
||||
pItem->item.asString.allocated = nLen;
|
||||
}
|
||||
pItem->type &= ~HB_IT_DEFAULT;
|
||||
|
||||
@@ -2051,9 +2051,9 @@ PHB_ITEM hb_itemUnShare( PHB_ITEM pItem )
|
||||
return pItem;
|
||||
}
|
||||
|
||||
HB_BOOL hb_itemGetWriteCL( PHB_ITEM pItem, char ** pszValue, HB_SIZE * pulLen )
|
||||
HB_BOOL hb_itemGetWriteCL( PHB_ITEM pItem, char ** pszValue, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetWriteCL(%p,%p,%p)", pItem, pszValue, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetWriteCL(%p,%p,%p)", pItem, pszValue, pnLen));
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
@@ -2063,7 +2063,7 @@ HB_BOOL hb_itemGetWriteCL( PHB_ITEM pItem, char ** pszValue, HB_SIZE * pulLen )
|
||||
if( HB_IS_STRING( pItem ) )
|
||||
{
|
||||
hb_itemUnShareString( pItem );
|
||||
*pulLen = pItem->item.asString.length;
|
||||
*pnLen = pItem->item.asString.length;
|
||||
*pszValue = pItem->item.asString.value;
|
||||
return HB_TRUE;
|
||||
}
|
||||
@@ -2110,37 +2110,37 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact )
|
||||
HB_STACK_TLS_PRELOAD
|
||||
const char * szFirst;
|
||||
const char * szSecond;
|
||||
HB_SIZE ulLenFirst;
|
||||
HB_SIZE ulLenSecond;
|
||||
HB_SIZE ulMinLen;
|
||||
HB_SIZE nLenFirst;
|
||||
HB_SIZE nLenSecond;
|
||||
HB_SIZE nMinLen;
|
||||
int iRet = 0; /* Current status */
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemStrCmp(%p, %p, %d)", pFirst, pSecond, ( int ) bForceExact));
|
||||
|
||||
szFirst = pFirst->item.asString.value;
|
||||
szSecond = pSecond->item.asString.value;
|
||||
ulLenFirst = pFirst->item.asString.length;
|
||||
ulLenSecond = pSecond->item.asString.length;
|
||||
nLenFirst = pFirst->item.asString.length;
|
||||
nLenSecond = pSecond->item.asString.length;
|
||||
|
||||
if( !bForceExact && hb_stackSetStruct()->HB_SET_EXACT )
|
||||
{
|
||||
/* SET EXACT ON and not using == */
|
||||
/* Don't include trailing spaces */
|
||||
while( ulLenFirst > ulLenSecond && szFirst[ ulLenFirst - 1 ] == ' ' )
|
||||
ulLenFirst--;
|
||||
while( ulLenSecond > ulLenFirst && szSecond[ ulLenSecond - 1 ] == ' ' )
|
||||
ulLenSecond--;
|
||||
while( nLenFirst > nLenSecond && szFirst[ nLenFirst - 1 ] == ' ' )
|
||||
nLenFirst--;
|
||||
while( nLenSecond > nLenFirst && szSecond[ nLenSecond - 1 ] == ' ' )
|
||||
nLenSecond--;
|
||||
bForceExact = HB_TRUE;
|
||||
}
|
||||
|
||||
ulMinLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond;
|
||||
nMinLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
|
||||
|
||||
/* Both strings not empty */
|
||||
if( ulMinLen )
|
||||
if( nMinLen )
|
||||
{
|
||||
PHB_CODEPAGE cdp = hb_vmCDP();
|
||||
if( cdp && cdp->sort )
|
||||
iRet = hb_cdpcmp( szFirst, ulLenFirst, szSecond, ulLenSecond,
|
||||
iRet = hb_cdpcmp( szFirst, nLenFirst, szSecond, nLenSecond,
|
||||
cdp, bForceExact );
|
||||
else
|
||||
{
|
||||
@@ -2154,26 +2154,26 @@ int hb_itemStrCmp( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact )
|
||||
szFirst++;
|
||||
szSecond++;
|
||||
}
|
||||
while( --ulMinLen );
|
||||
while( --nMinLen );
|
||||
|
||||
/* If equal and length is different ! */
|
||||
if( !iRet && ulLenFirst != ulLenSecond )
|
||||
if( !iRet && nLenFirst != nLenSecond )
|
||||
{
|
||||
/* Force an exact comparison? */
|
||||
if( bForceExact || ulLenSecond > ulLenFirst )
|
||||
iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1;
|
||||
if( bForceExact || nLenSecond > nLenFirst )
|
||||
iRet = ( nLenFirst < nLenSecond ) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Both empty ? */
|
||||
if( ulLenFirst != ulLenSecond )
|
||||
if( nLenFirst != nLenSecond )
|
||||
{
|
||||
if( bForceExact )
|
||||
iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1;
|
||||
iRet = ( nLenFirst < nLenSecond ) ? -1 : 1;
|
||||
else
|
||||
iRet = ( ulLenSecond == 0 ) ? 0 : -1;
|
||||
iRet = ( nLenSecond == 0 ) ? 0 : -1;
|
||||
}
|
||||
else
|
||||
/* Both empty => Equal ! */
|
||||
@@ -2189,37 +2189,37 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact )
|
||||
HB_STACK_TLS_PRELOAD
|
||||
const char * szFirst;
|
||||
const char * szSecond;
|
||||
HB_SIZE ulLenFirst;
|
||||
HB_SIZE ulLenSecond;
|
||||
HB_SIZE ulMinLen;
|
||||
HB_SIZE nLenFirst;
|
||||
HB_SIZE nLenSecond;
|
||||
HB_SIZE nMinLen;
|
||||
int iRet = 0; /* Current status */
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemStrICmp(%p, %p, %d)", pFirst, pSecond, ( int ) bForceExact));
|
||||
|
||||
szFirst = pFirst->item.asString.value;
|
||||
szSecond = pSecond->item.asString.value;
|
||||
ulLenFirst = pFirst->item.asString.length;
|
||||
ulLenSecond = pSecond->item.asString.length;
|
||||
nLenFirst = pFirst->item.asString.length;
|
||||
nLenSecond = pSecond->item.asString.length;
|
||||
|
||||
if( !bForceExact && hb_stackSetStruct()->HB_SET_EXACT )
|
||||
{
|
||||
/* SET EXACT ON and not using == */
|
||||
/* Don't include trailing spaces */
|
||||
while( ulLenFirst > ulLenSecond && szFirst[ ulLenFirst - 1 ] == ' ' )
|
||||
ulLenFirst--;
|
||||
while( ulLenSecond > ulLenFirst && szSecond[ ulLenSecond - 1 ] == ' ' )
|
||||
ulLenSecond--;
|
||||
while( nLenFirst > nLenSecond && szFirst[ nLenFirst - 1 ] == ' ' )
|
||||
nLenFirst--;
|
||||
while( nLenSecond > nLenFirst && szSecond[ nLenSecond - 1 ] == ' ' )
|
||||
nLenSecond--;
|
||||
bForceExact = HB_TRUE;
|
||||
}
|
||||
|
||||
ulMinLen = ulLenFirst < ulLenSecond ? ulLenFirst : ulLenSecond;
|
||||
nMinLen = nLenFirst < nLenSecond ? nLenFirst : nLenSecond;
|
||||
|
||||
/* Both strings not empty */
|
||||
if( ulMinLen )
|
||||
if( nMinLen )
|
||||
{
|
||||
PHB_CODEPAGE cdp = hb_vmCDP();
|
||||
if( cdp && cdp->sort )
|
||||
iRet = hb_cdpicmp( szFirst, ulLenFirst, szSecond, ulLenSecond,
|
||||
iRet = hb_cdpicmp( szFirst, nLenFirst, szSecond, nLenSecond,
|
||||
cdp, bForceExact );
|
||||
else
|
||||
{
|
||||
@@ -2235,26 +2235,26 @@ int hb_itemStrICmp( PHB_ITEM pFirst, PHB_ITEM pSecond, HB_BOOL bForceExact )
|
||||
szFirst++;
|
||||
szSecond++;
|
||||
}
|
||||
while( --ulMinLen );
|
||||
while( --nMinLen );
|
||||
|
||||
/* If equal and length is different ! */
|
||||
if( !iRet && ulLenFirst != ulLenSecond )
|
||||
if( !iRet && nLenFirst != nLenSecond )
|
||||
{
|
||||
/* Force an exact comparison? */
|
||||
if( bForceExact || ulLenSecond > ulLenFirst )
|
||||
iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1;
|
||||
if( bForceExact || nLenSecond > nLenFirst )
|
||||
iRet = ( nLenFirst < nLenSecond ) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Both empty ? */
|
||||
if( ulLenFirst != ulLenSecond )
|
||||
if( nLenFirst != nLenSecond )
|
||||
{
|
||||
if( bForceExact )
|
||||
iRet = ( ulLenFirst < ulLenSecond ) ? -1 : 1;
|
||||
iRet = ( nLenFirst < nLenSecond ) ? -1 : 1;
|
||||
else
|
||||
iRet = ( ulLenSecond == 0 ) ? 0 : -1;
|
||||
iRet = ( nLenSecond == 0 ) ? 0 : -1;
|
||||
}
|
||||
else
|
||||
/* Both empty => Equal ! */
|
||||
@@ -2534,18 +2534,18 @@ char * hb_itemStr( PHB_ITEM pNumber, PHB_ITEM pWidth, PHB_ITEM pDec )
|
||||
As a side effect the caller should never modify the returned buffer
|
||||
since it may point to a constant value. [vszakats] */
|
||||
|
||||
char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
char * hb_itemString( PHB_ITEM pItem, HB_SIZE * nLen, HB_BOOL * bFreeReq )
|
||||
{
|
||||
char * buffer;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemString(%p, %p, %p)", pItem, ulLen, bFreeReq));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemString(%p, %p, %p)", pItem, nLen, bFreeReq));
|
||||
|
||||
switch( HB_ITEM_TYPE( pItem ) )
|
||||
{
|
||||
case HB_IT_STRING:
|
||||
case HB_IT_MEMO:
|
||||
buffer = ( char * ) hb_itemGetCPtr( pItem );
|
||||
* ulLen = hb_itemGetCLen( pItem );
|
||||
* nLen = hb_itemGetCLen( pItem );
|
||||
* bFreeReq = HB_FALSE;
|
||||
break;
|
||||
|
||||
@@ -2558,7 +2558,7 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
|
||||
buffer = ( char * ) hb_xgrab( 11 );
|
||||
hb_dateFormat( szDate, buffer, hb_stackSetStruct()->HB_SET_DATEFORMAT );
|
||||
* ulLen = strlen( buffer );
|
||||
* nLen = strlen( buffer );
|
||||
* bFreeReq = HB_TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -2575,7 +2575,7 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
pItem->item.asDateTime.time );
|
||||
|
||||
buffer = hb_strdup( szDateTime );
|
||||
* ulLen = strlen( buffer );
|
||||
* nLen = strlen( buffer );
|
||||
* bFreeReq = HB_TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -2596,13 +2596,13 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
buffer = hb_itemStr( pItem, NULL, NULL );
|
||||
if( buffer )
|
||||
{
|
||||
* ulLen = strlen( buffer );
|
||||
* nLen = strlen( buffer );
|
||||
* bFreeReq = HB_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = ( char * ) "";
|
||||
* ulLen = 0;
|
||||
* nLen = 0;
|
||||
* bFreeReq = HB_FALSE;
|
||||
}
|
||||
break;
|
||||
@@ -2610,13 +2610,13 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
|
||||
case HB_IT_NIL:
|
||||
buffer = ( char * ) "NIL";
|
||||
* ulLen = 3;
|
||||
* nLen = 3;
|
||||
* bFreeReq = HB_FALSE;
|
||||
break;
|
||||
|
||||
case HB_IT_LOGICAL:
|
||||
buffer = ( char * ) ( hb_itemGetL( pItem ) ? ".T." : ".F." );
|
||||
* ulLen = 3;
|
||||
* nLen = 3;
|
||||
* bFreeReq = HB_FALSE;
|
||||
break;
|
||||
|
||||
@@ -2625,7 +2625,7 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
int size = ( sizeof( void * ) << 1 ) + 3; /* n bytes for address + 0x + \0 */
|
||||
HB_PTRDIFF addr = ( HB_PTRDIFF ) hb_itemGetPtr( pItem );
|
||||
|
||||
* ulLen = size - 1;
|
||||
* nLen = size - 1;
|
||||
* bFreeReq = HB_TRUE;
|
||||
buffer = ( char * ) hb_xgrab( size );
|
||||
buffer[ 0 ] = '0';
|
||||
@@ -2642,7 +2642,7 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
}
|
||||
default:
|
||||
buffer = ( char * ) "";
|
||||
* ulLen = 0;
|
||||
* nLen = 0;
|
||||
* bFreeReq = HB_FALSE;
|
||||
}
|
||||
|
||||
@@ -2653,9 +2653,9 @@ char * hb_itemString( PHB_ITEM pItem, HB_SIZE * ulLen, HB_BOOL * bFreeReq )
|
||||
being padded. If date, convert to string using hb_dateFormat(). If numeric,
|
||||
convert to unpadded string. Return pointer to string and set string length */
|
||||
|
||||
char * hb_itemPadConv( PHB_ITEM pItem, HB_SIZE * pulSize, HB_BOOL * bFreeReq )
|
||||
char * hb_itemPadConv( PHB_ITEM pItem, HB_SIZE * pnSize, HB_BOOL * bFreeReq )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPadConv(%p, %p, %p)", pItem, pulSize, bFreeReq));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPadConv(%p, %p, %p)", pItem, pnSize, bFreeReq));
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
@@ -2665,14 +2665,14 @@ char * hb_itemPadConv( PHB_ITEM pItem, HB_SIZE * pulSize, HB_BOOL * bFreeReq )
|
||||
case HB_IT_MEMO:
|
||||
case HB_IT_DATE:
|
||||
case HB_IT_TIMESTAMP:
|
||||
return hb_itemString( pItem, pulSize, bFreeReq );
|
||||
return hb_itemString( pItem, pnSize, bFreeReq );
|
||||
|
||||
case HB_IT_DOUBLE:
|
||||
case HB_IT_INTEGER:
|
||||
case HB_IT_LONG:
|
||||
{
|
||||
int i;
|
||||
char * buffer = hb_itemString( pItem, pulSize, bFreeReq );
|
||||
char * buffer = hb_itemString( pItem, pnSize, bFreeReq );
|
||||
|
||||
/* remove leading spaces if any, a little bit redundant but
|
||||
* I don't want to complicate the API interface more. Druzus
|
||||
@@ -2682,7 +2682,7 @@ char * hb_itemPadConv( PHB_ITEM pItem, HB_SIZE * pulSize, HB_BOOL * bFreeReq )
|
||||
if( i > 0 )
|
||||
{
|
||||
int j = 0;
|
||||
* pulSize -= i;
|
||||
* pnSize -= i;
|
||||
do
|
||||
{
|
||||
buffer[ j++ ] = buffer[ i ];
|
||||
@@ -2702,16 +2702,16 @@ PHB_ITEM hb_itemValToStr( PHB_ITEM pItem )
|
||||
{
|
||||
PHB_ITEM pResult;
|
||||
char * buffer;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
HB_BOOL bFreeReq;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemValToStr(%p)", pItem));
|
||||
|
||||
buffer = hb_itemString( pItem, &ulLen, &bFreeReq );
|
||||
buffer = hb_itemString( pItem, &nLen, &bFreeReq );
|
||||
if( bFreeReq )
|
||||
pResult = hb_itemPutCLPtr( NULL, buffer, ulLen );
|
||||
pResult = hb_itemPutCLPtr( NULL, buffer, nLen );
|
||||
else
|
||||
pResult = hb_itemPutCL( NULL, buffer, ulLen );
|
||||
pResult = hb_itemPutCL( NULL, buffer, nLen );
|
||||
|
||||
return pResult;
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ struct mv_memvarArray_info
|
||||
{
|
||||
PHB_ITEM pArray;
|
||||
PHB_DYNS * pDyns;
|
||||
HB_SIZE ulCount;
|
||||
HB_SIZE nCount;
|
||||
int iScope;
|
||||
};
|
||||
|
||||
@@ -238,14 +238,14 @@ static void hb_memvarAddPrivate( PHB_DYNS pDynSym, PHB_ITEM pValue )
|
||||
*/
|
||||
if( pMemvar )
|
||||
{
|
||||
HB_SIZE ulCount = pPrivateStack->count;
|
||||
while( ulCount > pPrivateStack->base )
|
||||
HB_SIZE nCount = pPrivateStack->count;
|
||||
while( nCount > pPrivateStack->base )
|
||||
{
|
||||
if( pDynSym == pPrivateStack->stack[ ulCount - 1 ].pDynSym )
|
||||
if( pDynSym == pPrivateStack->stack[ nCount - 1 ].pDynSym )
|
||||
break;
|
||||
--ulCount;
|
||||
--nCount;
|
||||
}
|
||||
if( ulCount <= pPrivateStack->base )
|
||||
if( nCount <= pPrivateStack->base )
|
||||
pMemvar = NULL;
|
||||
}
|
||||
|
||||
@@ -294,24 +294,24 @@ static void hb_memvarAddPrivate( PHB_DYNS pDynSym, PHB_ITEM pValue )
|
||||
HB_SIZE hb_memvarGetPrivatesBase( void )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
HB_SIZE ulBase;
|
||||
HB_SIZE nBase;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarGetPrivatesBase()"));
|
||||
|
||||
ulBase = hb_stackGetPrivateStack()->base;
|
||||
nBase = hb_stackGetPrivateStack()->base;
|
||||
hb_stackGetPrivateStack()->base = hb_stackGetPrivateStack()->count;
|
||||
return ulBase;
|
||||
return nBase;
|
||||
}
|
||||
|
||||
/*
|
||||
* This function releases PRIVATE variables created after passed base
|
||||
*/
|
||||
void hb_memvarSetPrivatesBase( HB_SIZE ulBase )
|
||||
void hb_memvarSetPrivatesBase( HB_SIZE nBase )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
PHB_PRIVATE_STACK pPrivateStack;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarSetPrivatesBase(%" HB_PFS "u)", ulBase));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarSetPrivatesBase(%" HB_PFS "u)", nBase));
|
||||
|
||||
pPrivateStack = hb_stackGetPrivateStack();
|
||||
|
||||
@@ -326,7 +326,7 @@ void hb_memvarSetPrivatesBase( HB_SIZE ulBase )
|
||||
hb_memvarDetachDynSym( pDynSym, pPrivateStack->stack[ pPrivateStack->count ].pPrevMemvar );
|
||||
}
|
||||
}
|
||||
pPrivateStack->base = ulBase;
|
||||
pPrivateStack->base = nBase;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -542,13 +542,13 @@ void hb_memvarNewParameter( PHB_SYMB pSymbol, PHB_ITEM pValue )
|
||||
hb_memvarCreateFromDynSymbol( pSymbol->pDynSym, VS_PRIVATE, pValue );
|
||||
}
|
||||
|
||||
static HB_DYNS_PTR hb_memvarFindSymbol( const char * szArg, HB_SIZE ulLen )
|
||||
static HB_DYNS_PTR hb_memvarFindSymbol( const char * szArg, HB_SIZE nLen )
|
||||
{
|
||||
HB_DYNS_PTR pDynSym = NULL;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarFindSymbol(%p,%" HB_PFS "u)", szArg, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarFindSymbol(%p,%" HB_PFS "u)", szArg, nLen));
|
||||
|
||||
if( ulLen && szArg && *szArg )
|
||||
if( nLen && szArg && *szArg )
|
||||
{
|
||||
char szUprName[ HB_SYMBOL_NAME_LEN + 1 ];
|
||||
int iSize = 0;
|
||||
@@ -575,7 +575,7 @@ static HB_DYNS_PTR hb_memvarFindSymbol( const char * szArg, HB_SIZE ulLen )
|
||||
szUprName[ iSize++ ] = cChar;
|
||||
}
|
||||
}
|
||||
while( --ulLen && iSize < HB_SYMBOL_NAME_LEN );
|
||||
while( --nLen && iSize < HB_SYMBOL_NAME_LEN );
|
||||
|
||||
if( iSize )
|
||||
{
|
||||
@@ -586,14 +586,14 @@ static HB_DYNS_PTR hb_memvarFindSymbol( const char * szArg, HB_SIZE ulLen )
|
||||
return pDynSym;
|
||||
}
|
||||
|
||||
char * hb_memvarGetStrValuePtr( char * szVarName, HB_SIZE * pulLen )
|
||||
char * hb_memvarGetStrValuePtr( char * szVarName, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_DYNS_PTR pDynVar;
|
||||
char * szValue = NULL;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarGetStrValuePtr(%s, %p)", szVarName, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarGetStrValuePtr(%s, %p)", szVarName, pnLen));
|
||||
|
||||
pDynVar = hb_memvarFindSymbol( szVarName, *pulLen );
|
||||
pDynVar = hb_memvarFindSymbol( szVarName, *pnLen );
|
||||
|
||||
if( pDynVar )
|
||||
{
|
||||
@@ -612,7 +612,7 @@ char * hb_memvarGetStrValuePtr( char * szVarName, HB_SIZE * pulLen )
|
||||
if( HB_IS_STRING( pMemvar ) )
|
||||
{
|
||||
szValue = pMemvar->item.asString.value;
|
||||
*pulLen = pMemvar->item.asString.length;
|
||||
*pnLen = pMemvar->item.asString.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -712,14 +712,14 @@ static void hb_memvarRelease( HB_ITEM_PTR pMemvar )
|
||||
if( pDynSymbol && hb_dynsymGetMemvar( pDynSymbol ) )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
HB_SIZE ulBase = hb_stackGetPrivateStack()->count;
|
||||
HB_SIZE nBase = hb_stackGetPrivateStack()->count;
|
||||
|
||||
/* Find the variable with a requested name that is currently visible
|
||||
* Start from the top of the stack.
|
||||
*/
|
||||
while( ulBase > 0 )
|
||||
while( nBase > 0 )
|
||||
{
|
||||
if( pDynSymbol == hb_stackGetPrivateStack()->stack[ --ulBase ].pDynSym )
|
||||
if( pDynSymbol == hb_stackGetPrivateStack()->stack[ --nBase ].pDynSym )
|
||||
{
|
||||
/* reset current value to NIL - the overriden variables will be
|
||||
* visible after exit from current procedure
|
||||
@@ -749,17 +749,17 @@ static void hb_memvarRelease( HB_ITEM_PTR pMemvar )
|
||||
static void hb_memvarReleaseWithMask( const char *szMask, HB_BOOL bInclude )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
HB_SIZE ulBase, ulCount;
|
||||
HB_SIZE nBase, nCount;
|
||||
PHB_DYNS pDynVar;
|
||||
PHB_ITEM pMemvar;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarReleaseWithMask(%s, %d)", szMask, (int) bInclude));
|
||||
|
||||
ulCount = hb_stackGetPrivateStack()->count;
|
||||
ulBase = hb_stackBaseItem()->item.asSymbol.stackstate->ulPrivateBase;
|
||||
while( ulCount-- > ulBase )
|
||||
nCount = hb_stackGetPrivateStack()->count;
|
||||
nBase = hb_stackBaseItem()->item.asSymbol.stackstate->ulPrivateBase;
|
||||
while( nCount-- > nBase )
|
||||
{
|
||||
pDynVar = hb_stackGetPrivateStack()->stack[ ulCount ].pDynSym;
|
||||
pDynVar = hb_stackGetPrivateStack()->stack[ nCount ].pDynSym;
|
||||
/* reset current value to NIL - the overriden variables will be
|
||||
* visible after exit from current procedure
|
||||
*/
|
||||
@@ -784,13 +784,13 @@ static int hb_memvarScopeGet( PHB_DYNS pDynVar )
|
||||
else
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
HB_SIZE ulBase = hb_stackGetPrivateStack()->count; /* start from the top of the stack */
|
||||
HB_SIZE nBase = hb_stackGetPrivateStack()->count; /* start from the top of the stack */
|
||||
|
||||
while( ulBase )
|
||||
while( nBase )
|
||||
{
|
||||
if( pDynVar == hb_stackGetPrivateStack()->stack[ --ulBase ].pDynSym )
|
||||
if( pDynVar == hb_stackGetPrivateStack()->stack[ --nBase ].pDynSym )
|
||||
{
|
||||
if( ulBase >= hb_stackGetPrivateStack()->base )
|
||||
if( nBase >= hb_stackGetPrivateStack()->base )
|
||||
return HB_MV_PRIVATE_LOCAL;
|
||||
else
|
||||
return HB_MV_PRIVATE_GLOBAL;
|
||||
@@ -802,13 +802,13 @@ static int hb_memvarScopeGet( PHB_DYNS pDynVar )
|
||||
|
||||
/* This function checks the scope of passed variable name
|
||||
*/
|
||||
int hb_memvarScope( const char * szVarName, HB_SIZE ulLength )
|
||||
int hb_memvarScope( const char * szVarName, HB_SIZE nLength )
|
||||
{
|
||||
PHB_DYNS pDynVar;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarScope(%s, %" HB_PFS "u)", szVarName, ulLength));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_memvarScope(%s, %" HB_PFS "u)", szVarName, nLength));
|
||||
|
||||
pDynVar = hb_memvarFindSymbol( szVarName, ulLength );
|
||||
pDynVar = hb_memvarFindSymbol( szVarName, nLength );
|
||||
|
||||
if( pDynVar )
|
||||
return hb_memvarScopeGet( pDynVar );
|
||||
@@ -987,7 +987,7 @@ static HB_DYNS_FUNC( hb_memvarCountVisible )
|
||||
if( !pMVInfo->iScope ||
|
||||
( hb_memvarScopeGet( pDynSymbol ) & pMVInfo->iScope ) != 0 )
|
||||
{
|
||||
pMVInfo->pDyns[ pMVInfo->ulCount++ ] = pDynSymbol;
|
||||
pMVInfo->pDyns[ pMVInfo->nCount++ ] = pDynSymbol;
|
||||
}
|
||||
}
|
||||
return HB_TRUE;
|
||||
@@ -1013,17 +1013,17 @@ PHB_ITEM hb_memvarSaveInArray( int iScope, HB_BOOL fCopy )
|
||||
MVInfo.pDyns = ( PHB_DYNS * ) hb_xgrab( hb_stackDynHandlesCount() *
|
||||
sizeof( PHB_DYNS ) );
|
||||
#endif
|
||||
MVInfo.ulCount = 0;
|
||||
MVInfo.nCount = 0;
|
||||
MVInfo.iScope = iScope;
|
||||
|
||||
hb_dynsymProtectEval( hb_memvarCountVisible, ( void * ) &MVInfo );
|
||||
if( MVInfo.ulCount > 0 )
|
||||
if( MVInfo.nCount > 0 )
|
||||
{
|
||||
pArray = hb_itemArrayNew( MVInfo.ulCount );
|
||||
pArray = hb_itemArrayNew( MVInfo.nCount );
|
||||
do
|
||||
{
|
||||
pItem = hb_arrayGetItemPtr( pArray, MVInfo.ulCount );
|
||||
pDynSymbol = MVInfo.pDyns[ --MVInfo.ulCount ];
|
||||
pItem = hb_arrayGetItemPtr( pArray, MVInfo.nCount );
|
||||
pDynSymbol = MVInfo.pDyns[ --MVInfo.nCount ];
|
||||
pMemvar = hb_dynsymGetMemvar( pDynSymbol ),
|
||||
|
||||
hb_arrayNew( pItem, 2 );
|
||||
@@ -1041,7 +1041,7 @@ PHB_ITEM hb_memvarSaveInArray( int iScope, HB_BOOL fCopy )
|
||||
hb_xRefInc( pMemvar );
|
||||
}
|
||||
}
|
||||
while( MVInfo.ulCount );
|
||||
while( MVInfo.nCount );
|
||||
}
|
||||
hb_xfree( MVInfo.pDyns );
|
||||
|
||||
@@ -1050,12 +1050,12 @@ PHB_ITEM hb_memvarSaveInArray( int iScope, HB_BOOL fCopy )
|
||||
|
||||
void hb_memvarRestoreFromArray( PHB_ITEM pArray )
|
||||
{
|
||||
HB_SIZE ulCount, ulPos;
|
||||
HB_SIZE nCount, nPos;
|
||||
|
||||
ulCount = hb_arrayLen( pArray );
|
||||
for( ulPos = 1; ulPos <= ulCount; ++ulPos )
|
||||
nCount = hb_arrayLen( pArray );
|
||||
for( nPos = 1; nPos <= nCount; ++nPos )
|
||||
{
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, ulPos );
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, nPos );
|
||||
PHB_DYNS pDynSym = hb_arrayGetSymbol( pItem, 1 )->pDynSym;
|
||||
PHB_ITEM pMemvar = hb_arrayGetItemPtr( pItem, 2 )->item.asMemvar.value;
|
||||
hb_memvarValueIncRef( pMemvar );
|
||||
@@ -1095,10 +1095,10 @@ HB_FUNC( __MVPUBLIC )
|
||||
{
|
||||
/* we are accepting an one-dimensional array of strings only
|
||||
*/
|
||||
HB_SIZE j, ulLen = hb_arrayLen( pMemvar );
|
||||
HB_SIZE n, nLen = hb_arrayLen( pMemvar );
|
||||
|
||||
for( j = 1; j <= ulLen; j++ )
|
||||
hb_memvarCreateFromItem( hb_arrayGetItemPtr( pMemvar, j ), VS_PUBLIC, NULL );
|
||||
for( n = 1; n <= nLen; n++ )
|
||||
hb_memvarCreateFromItem( hb_arrayGetItemPtr( pMemvar, n ), VS_PUBLIC, NULL );
|
||||
}
|
||||
else
|
||||
hb_memvarCreateFromItem( pMemvar, VS_PUBLIC, NULL );
|
||||
@@ -1127,10 +1127,10 @@ HB_FUNC( __MVPRIVATE )
|
||||
{
|
||||
/* we are accepting an one-dimensional array of strings only
|
||||
*/
|
||||
HB_SIZE j, ulLen = hb_arrayLen( pMemvar );
|
||||
HB_SIZE n, nLen = hb_arrayLen( pMemvar );
|
||||
|
||||
for( j = 1; j <= ulLen; j++ )
|
||||
hb_memvarCreateFromItem( hb_arrayGetItemPtr( pMemvar, j ), VS_PRIVATE, NULL );
|
||||
for( n = 1; n <= nLen; n++ )
|
||||
hb_memvarCreateFromItem( hb_arrayGetItemPtr( pMemvar, n ), VS_PRIVATE, NULL );
|
||||
}
|
||||
else
|
||||
hb_memvarCreateFromItem( pMemvar, VS_PRIVATE, NULL );
|
||||
@@ -1159,10 +1159,10 @@ HB_FUNC( __MVXRELEASE )
|
||||
{
|
||||
/* we are accepting an one-dimensional array of strings only
|
||||
*/
|
||||
HB_SIZE j, ulLen = hb_arrayLen( pMemvar );
|
||||
HB_SIZE n, nLen = hb_arrayLen( pMemvar );
|
||||
|
||||
for( j = 1; j <= ulLen; j++ )
|
||||
hb_memvarRelease( hb_arrayGetItemPtr( pMemvar, j ) );
|
||||
for( n = 1; n <= nLen; n++ )
|
||||
hb_memvarRelease( hb_arrayGetItemPtr( pMemvar, n ) );
|
||||
}
|
||||
else
|
||||
hb_memvarRelease( pMemvar );
|
||||
@@ -1385,19 +1385,19 @@ static HB_DYNS_FUNC( hb_memvarSave )
|
||||
if( HB_IS_STRING( pMemvar ) )
|
||||
{
|
||||
/* Store the closing zero byte, too */
|
||||
HB_SIZE ulLen = hb_itemGetCLen( pMemvar ) + 1;
|
||||
HB_SIZE nLen = hb_itemGetCLen( pMemvar ) + 1;
|
||||
int iOverFlow = 0;
|
||||
|
||||
/* Clipper supports only 64KB strings */
|
||||
if( ulLen > USHRT_MAX )
|
||||
if( nLen > USHRT_MAX )
|
||||
{
|
||||
ulLen = USHRT_MAX;
|
||||
nLen = USHRT_MAX;
|
||||
iOverFlow = 1;
|
||||
}
|
||||
buffer[ 11 ] = 'C' + 128;
|
||||
HB_PUT_LE_UINT16( &buffer[ 16 ], ulLen );
|
||||
HB_PUT_LE_UINT16( &buffer[ 16 ], nLen );
|
||||
hb_fsWrite( fhnd, buffer, HB_MEM_REC_LEN );
|
||||
hb_fsWriteLarge( fhnd, hb_itemGetCPtr( pMemvar ), ulLen - iOverFlow );
|
||||
hb_fsWriteLarge( fhnd, hb_itemGetCPtr( pMemvar ), nLen - iOverFlow );
|
||||
if( iOverFlow )
|
||||
hb_fsWrite( fhnd, "\0", 1 );
|
||||
}
|
||||
|
||||
@@ -99,39 +99,39 @@ static const char s_szHead[ 4 ] = { '\xC0', 'H', 'R', 'B' };
|
||||
#define SYM_DEFERRED 3 /* lately bound function */
|
||||
#define SYM_NOT_FOUND 0xFFFFFFFFUL /* Symbol not found. */
|
||||
|
||||
static HB_SIZE hb_hrbCheckSig( const char * szBody, HB_SIZE ulBodySize )
|
||||
static HB_SIZE hb_hrbCheckSig( const char * szBody, HB_SIZE nBodySize )
|
||||
{
|
||||
return ( ulBodySize > sizeof( s_szHead ) &&
|
||||
return ( nBodySize > sizeof( s_szHead ) &&
|
||||
memcmp( s_szHead, szBody, sizeof( s_szHead ) ) == 0 ) ?
|
||||
sizeof( s_szHead ) : 0;
|
||||
}
|
||||
|
||||
static int hb_hrbReadHead( const char * szBody, HB_SIZE ulBodySize, HB_SIZE * pulBodyOffset )
|
||||
static int hb_hrbReadHead( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pnBodyOffset )
|
||||
{
|
||||
const char * pVersion;
|
||||
HB_SIZE nSigSize;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_hrbReadHead(%p,%" HB_PFS "u,%p)", szBody, ulBodySize, pulBodyOffset ));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_hrbReadHead(%p,%" HB_PFS "u,%p)", szBody, nBodySize, pnBodyOffset ));
|
||||
|
||||
nSigSize = hb_hrbCheckSig( szBody, ulBodySize );
|
||||
nSigSize = hb_hrbCheckSig( szBody, nBodySize );
|
||||
|
||||
if( nSigSize == 0 || ulBodySize - nSigSize < 2 )
|
||||
if( nSigSize == 0 || nBodySize - nSigSize < 2 )
|
||||
return 0;
|
||||
|
||||
pVersion = szBody + nSigSize;
|
||||
*pulBodyOffset += nSigSize + 2;
|
||||
*pnBodyOffset += nSigSize + 2;
|
||||
|
||||
return HB_PCODE_MKSHORT( pVersion );
|
||||
}
|
||||
|
||||
static HB_BOOL hb_hrbReadValue( const char * szBody, HB_SIZE ulBodySize, HB_SIZE * pulBodyOffset, HB_ULONG * pulValue )
|
||||
static HB_BOOL hb_hrbReadValue( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pnBodyOffset, HB_ULONG * pulValue )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_hrbReadValue(%p,%" HB_PFS "u,%p,%p)", szBody, ulBodySize, pulBodyOffset, pulValue));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_hrbReadValue(%p,%" HB_PFS "u,%p,%p)", szBody, nBodySize, pnBodyOffset, pulValue));
|
||||
|
||||
if( *pulBodyOffset + 4 < ulBodySize )
|
||||
if( *pnBodyOffset + 4 < nBodySize )
|
||||
{
|
||||
*pulValue = HB_PCODE_MKLONG( szBody + *pulBodyOffset );
|
||||
*pulBodyOffset += 4;
|
||||
*pulValue = HB_PCODE_MKLONG( szBody + *pnBodyOffset );
|
||||
*pnBodyOffset += 4;
|
||||
|
||||
if( *pulValue <= 0x00FFFFFFUL )
|
||||
return HB_TRUE;
|
||||
@@ -142,20 +142,20 @@ static HB_BOOL hb_hrbReadValue( const char * szBody, HB_SIZE ulBodySize, HB_SIZE
|
||||
|
||||
/* ReadId
|
||||
Read the next (zero terminated) identifier */
|
||||
static char * hb_hrbReadId( const char * szBody, HB_SIZE ulBodySize, HB_SIZE * ulBodyOffset )
|
||||
static char * hb_hrbReadId( const char * szBody, HB_SIZE nBodySize, HB_SIZE * pnBodyOffset )
|
||||
{
|
||||
const char * szIdx;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_hrbReadId(%p,%" HB_PFS "u,%p)", szBody, ulBodySize, ulBodyOffset));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_hrbReadId(%p,%" HB_PFS "u,%p)", szBody, nBodySize, pnBodyOffset));
|
||||
|
||||
szIdx = &szBody[ *ulBodyOffset ];
|
||||
szIdx = &szBody[ *pnBodyOffset ];
|
||||
|
||||
do
|
||||
{
|
||||
if( *ulBodyOffset > ulBodySize )
|
||||
if( *pnBodyOffset > nBodySize )
|
||||
return NULL;
|
||||
}
|
||||
while( szBody[ ( *ulBodyOffset )++ ] );
|
||||
while( szBody[ ( *pnBodyOffset )++ ] );
|
||||
|
||||
return hb_strdup( szIdx );
|
||||
}
|
||||
@@ -323,15 +323,15 @@ static void hb_hrbUnLoad( PHRB_BODY pHrbBody )
|
||||
|
||||
|
||||
|
||||
static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHORT usMode, const char * szFileName )
|
||||
static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE nBodySize, HB_USHORT usMode, const char * szFileName )
|
||||
{
|
||||
PHRB_BODY pHrbBody = NULL;
|
||||
|
||||
if( szHrbBody )
|
||||
{
|
||||
HB_SIZE ulBodyOffset = 0;
|
||||
HB_SIZE ulSize; /* Size of function */
|
||||
HB_SIZE ulPos;
|
||||
HB_SIZE nBodyOffset = 0;
|
||||
HB_SIZE nSize; /* Size of function */
|
||||
HB_SIZE nPos;
|
||||
HB_ULONG ul;
|
||||
char * buffer, ch;
|
||||
HB_USHORT usBind = ( usMode & HB_HRB_BIND_MODEMASK );
|
||||
@@ -340,7 +340,7 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
PHB_DYNF pDynFunc; /* Functions read */
|
||||
PHB_DYNS pDynSym;
|
||||
|
||||
int iVersion = hb_hrbReadHead( szHrbBody, ulBodySize, &ulBodyOffset );
|
||||
int iVersion = hb_hrbReadHead( szHrbBody, nBodySize, &nBodyOffset );
|
||||
|
||||
if( iVersion == 0 )
|
||||
{
|
||||
@@ -357,7 +357,7 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
pHrbBody->pSymRead = NULL;
|
||||
pHrbBody->pDynFunc = NULL;
|
||||
pHrbBody->pModuleSymbols = NULL;
|
||||
if( ! hb_hrbReadValue( szHrbBody, ulBodySize, &ulBodyOffset, &pHrbBody->ulSymbols ) ||
|
||||
if( ! hb_hrbReadValue( szHrbBody, nBodySize, &nBodyOffset, &pHrbBody->ulSymbols ) ||
|
||||
pHrbBody->ulSymbols == 0 )
|
||||
{
|
||||
hb_hrbUnLoad( pHrbBody );
|
||||
@@ -366,19 +366,19 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
}
|
||||
|
||||
/* calculate the size of dynamic symbol table */
|
||||
ulPos = ulBodyOffset;
|
||||
ulSize = 0;
|
||||
nPos = nBodyOffset;
|
||||
nSize = 0;
|
||||
|
||||
for( ul = 0; ul < pHrbBody->ulSymbols; ul++ ) /* Read symbols in .hrb */
|
||||
{
|
||||
while( ulBodyOffset < ulBodySize )
|
||||
while( nBodyOffset < nBodySize )
|
||||
{
|
||||
++ulSize;
|
||||
if( szHrbBody[ ulBodyOffset++ ] == 0 )
|
||||
++nSize;
|
||||
if( szHrbBody[ nBodyOffset++ ] == 0 )
|
||||
break;
|
||||
}
|
||||
ulBodyOffset += 2;
|
||||
if( ulBodyOffset >= ulBodySize )
|
||||
nBodyOffset += 2;
|
||||
if( nBodyOffset >= nBodySize )
|
||||
{
|
||||
hb_hrbUnLoad( pHrbBody );
|
||||
hb_errRT_BASE( EG_CORRUPTION, 9997, NULL, HB_ERR_FUNCNAME, 0 );
|
||||
@@ -386,19 +386,19 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
}
|
||||
}
|
||||
|
||||
ulBodyOffset = ulPos;
|
||||
nBodyOffset = nPos;
|
||||
ul = pHrbBody->ulSymbols * sizeof( HB_SYMB );
|
||||
pSymRead = ( PHB_SYMB ) hb_xgrab( ulSize + ul );
|
||||
pSymRead = ( PHB_SYMB ) hb_xgrab( nSize + ul );
|
||||
buffer = ( ( char * ) pSymRead ) + ul;
|
||||
|
||||
for( ul = 0; ul < pHrbBody->ulSymbols; ul++ ) /* Read symbols in .hrb */
|
||||
{
|
||||
pSymRead[ ul ].szName = buffer;
|
||||
do
|
||||
ch = *buffer++ = szHrbBody[ ulBodyOffset++ ];
|
||||
ch = *buffer++ = szHrbBody[ nBodyOffset++ ];
|
||||
while( ch );
|
||||
pSymRead[ ul ].scope.value = ( HB_BYTE ) szHrbBody[ ulBodyOffset++ ];
|
||||
pSymRead[ ul ].value.pCodeFunc = ( PHB_PCODEFUNC ) ( HB_PTRDIFF ) szHrbBody[ ulBodyOffset++ ];
|
||||
pSymRead[ ul ].scope.value = ( HB_BYTE ) szHrbBody[ nBodyOffset++ ];
|
||||
pSymRead[ ul ].value.pCodeFunc = ( PHB_PCODEFUNC ) ( HB_PTRDIFF ) szHrbBody[ nBodyOffset++ ];
|
||||
pSymRead[ ul ].pDynSym = NULL;
|
||||
|
||||
if( pHrbBody->lSymStart == -1 &&
|
||||
@@ -410,7 +410,7 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
}
|
||||
|
||||
/* Read number of functions */
|
||||
if( ! hb_hrbReadValue( szHrbBody, ulBodySize, &ulBodyOffset, &pHrbBody->ulFuncs ) )
|
||||
if( ! hb_hrbReadValue( szHrbBody, nBodySize, &nBodyOffset, &pHrbBody->ulFuncs ) )
|
||||
{
|
||||
hb_xfree( pSymRead );
|
||||
hb_hrbUnLoad( pHrbBody );
|
||||
@@ -431,23 +431,23 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
HB_ULONG ulValue;
|
||||
|
||||
/* Read name of function */
|
||||
pDynFunc[ ul ].szName = hb_hrbReadId( szHrbBody, ulBodySize, &ulBodyOffset );
|
||||
pDynFunc[ ul ].szName = hb_hrbReadId( szHrbBody, nBodySize, &nBodyOffset );
|
||||
if( pDynFunc[ ul ].szName == NULL )
|
||||
break;
|
||||
|
||||
/* Read size of function */
|
||||
if( ! hb_hrbReadValue( szHrbBody, ulBodySize, &ulBodyOffset, &ulValue ) )
|
||||
if( ! hb_hrbReadValue( szHrbBody, nBodySize, &nBodyOffset, &ulValue ) )
|
||||
break;
|
||||
|
||||
ulSize = ( HB_SIZE ) ulValue;
|
||||
nSize = ( HB_SIZE ) ulValue;
|
||||
|
||||
if( ulBodyOffset + ulSize > ulBodySize )
|
||||
if( nBodyOffset + nSize > nBodySize )
|
||||
break;
|
||||
|
||||
/* Copy function body */
|
||||
pDynFunc[ ul ].pCode = ( HB_BYTE * ) hb_xgrab( ulSize );
|
||||
memcpy( ( char * ) pDynFunc[ ul ].pCode, szHrbBody + ulBodyOffset, ulSize );
|
||||
ulBodyOffset += ulSize;
|
||||
pDynFunc[ ul ].pCode = ( HB_BYTE * ) hb_xgrab( nSize );
|
||||
memcpy( ( char * ) pDynFunc[ ul ].pCode, szHrbBody + nBodyOffset, nSize );
|
||||
nBodyOffset += nSize;
|
||||
|
||||
pDynFunc[ ul ].pCodeFunc = ( PHB_PCODEFUNC ) hb_xgrab( sizeof( HB_PCODEFUNC ) );
|
||||
pDynFunc[ ul ].pCodeFunc->pCode = pDynFunc[ ul ].pCode;
|
||||
@@ -468,15 +468,15 @@ static PHRB_BODY hb_hrbLoad( const char * szHrbBody, HB_SIZE ulBodySize, HB_USHO
|
||||
{
|
||||
if( pSymRead[ ul ].value.pCodeFunc == ( PHB_PCODEFUNC ) SYM_FUNC )
|
||||
{
|
||||
ulPos = hb_hrbFindSymbol( pSymRead[ ul ].szName, pHrbBody->pDynFunc, pHrbBody->ulFuncs );
|
||||
nPos = hb_hrbFindSymbol( pSymRead[ ul ].szName, pHrbBody->pDynFunc, pHrbBody->ulFuncs );
|
||||
|
||||
if( ulPos == SYM_NOT_FOUND )
|
||||
if( nPos == SYM_NOT_FOUND )
|
||||
{
|
||||
pSymRead[ ul ].value.pCodeFunc = ( PHB_PCODEFUNC ) SYM_EXTERN;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSymRead[ ul ].value.pCodeFunc = ( PHB_PCODEFUNC ) pHrbBody->pDynFunc[ ulPos ].pCodeFunc;
|
||||
pSymRead[ ul ].value.pCodeFunc = ( PHB_PCODEFUNC ) pHrbBody->pDynFunc[ nPos ].pCodeFunc;
|
||||
pSymRead[ ul ].scope.value |= HB_FS_PCODEFUNC | HB_FS_LOCAL |
|
||||
( usBind == HB_HRB_BIND_FORCELOCAL ? HB_FS_STATIC : 0 );
|
||||
}
|
||||
@@ -613,18 +613,18 @@ static PHRB_BODY hb_hrbLoadFromFile( const char * szHrb, HB_USHORT usMode )
|
||||
|
||||
if( hFile != FS_ERROR )
|
||||
{
|
||||
HB_SIZE ulBodySize = hb_fsSeek( hFile, 0, FS_END );
|
||||
HB_SIZE nBodySize = hb_fsSeek( hFile, 0, FS_END );
|
||||
|
||||
if( ulBodySize )
|
||||
if( nBodySize )
|
||||
{
|
||||
char * pbyBuffer;
|
||||
|
||||
pbyBuffer = ( char * ) hb_xgrab( ulBodySize + sizeof( char ) + 1 );
|
||||
pbyBuffer = ( char * ) hb_xgrab( nBodySize + sizeof( char ) + 1 );
|
||||
hb_fsSeek( hFile, 0, FS_SET );
|
||||
hb_fsReadLarge( hFile, pbyBuffer, ulBodySize );
|
||||
pbyBuffer[ ulBodySize ] = '\0';
|
||||
hb_fsReadLarge( hFile, pbyBuffer, nBodySize );
|
||||
pbyBuffer[ nBodySize ] = '\0';
|
||||
|
||||
pHrbBody = hb_hrbLoad( ( const char * ) pbyBuffer, ulBodySize, usMode, szFileName );
|
||||
pHrbBody = hb_hrbLoad( ( const char * ) pbyBuffer, nBodySize, usMode, szFileName );
|
||||
hb_xfree( pbyBuffer );
|
||||
}
|
||||
hb_fsClose( hFile );
|
||||
@@ -707,7 +707,7 @@ HB_FUNC( HB_HRBRUN )
|
||||
{
|
||||
HB_USHORT usMode = HB_HRB_BIND_DEFAULT;
|
||||
HB_USHORT nParam = 1;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
if( HB_ISNUM( 1 ) )
|
||||
{
|
||||
@@ -715,15 +715,15 @@ HB_FUNC( HB_HRBRUN )
|
||||
nParam++;
|
||||
}
|
||||
|
||||
ulLen = hb_parclen( nParam );
|
||||
nLen = hb_parclen( nParam );
|
||||
|
||||
if( ulLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
const char * fileOrBody = hb_parc( nParam );
|
||||
PHRB_BODY pHrbBody;
|
||||
|
||||
if( hb_hrbCheckSig( fileOrBody, ulLen ) != 0 )
|
||||
pHrbBody = hb_hrbLoad( fileOrBody, ulLen, usMode, NULL );
|
||||
if( hb_hrbCheckSig( fileOrBody, nLen ) != 0 )
|
||||
pHrbBody = hb_hrbLoad( fileOrBody, nLen, usMode, NULL );
|
||||
else
|
||||
pHrbBody = hb_hrbLoadFromFile( fileOrBody, usMode );
|
||||
|
||||
@@ -757,7 +757,7 @@ HB_FUNC( HB_HRBLOAD )
|
||||
{
|
||||
HB_USHORT usMode = HB_HRB_BIND_DEFAULT;
|
||||
HB_USHORT nParam = 1;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
if( HB_ISNUM( 1 ) )
|
||||
{
|
||||
@@ -765,15 +765,15 @@ HB_FUNC( HB_HRBLOAD )
|
||||
nParam++;
|
||||
}
|
||||
|
||||
ulLen = hb_parclen( nParam );
|
||||
nLen = hb_parclen( nParam );
|
||||
|
||||
if( ulLen > 0 )
|
||||
if( nLen > 0 )
|
||||
{
|
||||
const char * fileOrBody = hb_parc( nParam );
|
||||
PHRB_BODY pHrbBody;
|
||||
|
||||
if( hb_hrbCheckSig( fileOrBody, ulLen ) != 0 )
|
||||
pHrbBody = hb_hrbLoad( fileOrBody, ulLen, usMode, NULL );
|
||||
if( hb_hrbCheckSig( fileOrBody, nLen ) != 0 )
|
||||
pHrbBody = hb_hrbLoad( fileOrBody, nLen, usMode, NULL );
|
||||
else
|
||||
pHrbBody = hb_hrbLoadFromFile( fileOrBody, usMode );
|
||||
|
||||
@@ -855,9 +855,9 @@ HB_FUNC( HB_HRBGETFUNSYM )
|
||||
if( pHrbBody && szName )
|
||||
{
|
||||
PHB_SYMB pSym;
|
||||
HB_ULONG ulPos;
|
||||
HB_ULONG nPos;
|
||||
|
||||
for( ulPos = 0, pSym = pHrbBody->pSymRead; ulPos < pHrbBody->ulSymbols; ++pSym, ++ulPos )
|
||||
for( nPos = 0, pSym = pHrbBody->pSymRead; nPos < pHrbBody->ulSymbols; ++pSym, ++nPos )
|
||||
{
|
||||
if( pSym->value.pFunPtr != NULL && hb_stricmp( szName, pSym->szName ) == 0 )
|
||||
{
|
||||
|
||||
@@ -98,8 +98,8 @@ static char set_char( PHB_ITEM pItem, char oldChar )
|
||||
if( HB_IS_STRING( pItem ) )
|
||||
{
|
||||
/* Only replace if string has at least one character. */
|
||||
HB_SIZE ulLen = hb_itemGetCLen( pItem );
|
||||
if( ulLen > 0 )
|
||||
HB_SIZE nLen = hb_itemGetCLen( pItem );
|
||||
if( nLen > 0 )
|
||||
{
|
||||
newChar = *hb_itemGetCPtr( pItem );
|
||||
}
|
||||
@@ -124,13 +124,13 @@ static HB_BOOL set_logical( PHB_ITEM pItem, HB_BOOL bDefault )
|
||||
else if( HB_IS_STRING( pItem ) )
|
||||
{
|
||||
const char * szString = hb_itemGetCPtr( pItem );
|
||||
HB_SIZE ulLen = hb_itemGetCLen( pItem );
|
||||
HB_SIZE nLen = hb_itemGetCLen( pItem );
|
||||
|
||||
if( ulLen >= 2
|
||||
if( nLen >= 2
|
||||
&& ( ( HB_UCHAR ) szString[ 0 ] == 'O' || ( HB_UCHAR ) szString[ 0 ] == 'o' )
|
||||
&& ( ( HB_UCHAR ) szString[ 1 ] == 'N' || ( HB_UCHAR ) szString[ 1 ] == 'n' ) )
|
||||
bLogical = HB_TRUE;
|
||||
else if( ulLen >= 3
|
||||
else if( nLen >= 3
|
||||
&& ( ( HB_UCHAR ) szString[ 0 ] == 'O' || ( HB_UCHAR ) szString[ 0 ] == 'o' )
|
||||
&& ( ( HB_UCHAR ) szString[ 1 ] == 'F' || ( HB_UCHAR ) szString[ 1 ] == 'f' )
|
||||
&& ( ( HB_UCHAR ) szString[ 2 ] == 'F' || ( HB_UCHAR ) szString[ 2 ] == 'f' ) )
|
||||
@@ -2655,7 +2655,7 @@ const char * hb_setGetDBCODEPAGE( void )
|
||||
return hb_stackSetStruct()->HB_SET_DBCODEPAGE;
|
||||
}
|
||||
|
||||
const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pulSize )
|
||||
const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pnSize )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
@@ -2669,22 +2669,22 @@ const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pulS
|
||||
PHB_CODEPAGE cdpHost = hb_vmCDP();
|
||||
if( cdpHost && cdpHost != cdpOS )
|
||||
{
|
||||
HB_SIZE ulSize = 0;
|
||||
HB_SIZE nSize = 0;
|
||||
char * pszBuf;
|
||||
|
||||
if( pszFree == NULL )
|
||||
{
|
||||
pszFree = ( char ** ) &szName;
|
||||
ulSize = strlen( szName );
|
||||
nSize = strlen( szName );
|
||||
}
|
||||
pszBuf = *pszFree;
|
||||
if( pulSize == NULL )
|
||||
pulSize = &ulSize;
|
||||
else if( *pulSize > 0 )
|
||||
ulSize = *pulSize - 1;
|
||||
if( pnSize == NULL )
|
||||
pnSize = &nSize;
|
||||
else if( *pnSize > 0 )
|
||||
nSize = *pnSize - 1;
|
||||
|
||||
szName = hb_cdpnDup3( szName, strlen( szName ),
|
||||
pszBuf, &ulSize, pszFree, pulSize,
|
||||
pszBuf, &nSize, pszFree, pnSize,
|
||||
cdpHost, cdpOS );
|
||||
}
|
||||
}
|
||||
@@ -2693,7 +2693,7 @@ const char * hb_osEncodeCP( const char * szName, char ** pszFree, HB_SIZE * pulS
|
||||
return szName;
|
||||
}
|
||||
|
||||
const char * hb_osDecodeCP( const char * szName, char ** pszFree, HB_SIZE * pulSize )
|
||||
const char * hb_osDecodeCP( const char * szName, char ** pszFree, HB_SIZE * pnSize )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
@@ -2707,22 +2707,22 @@ const char * hb_osDecodeCP( const char * szName, char ** pszFree, HB_SIZE * pulS
|
||||
PHB_CODEPAGE cdpHost = hb_vmCDP();
|
||||
if( cdpHost && cdpHost != cdpOS )
|
||||
{
|
||||
HB_SIZE ulSize = 0;
|
||||
HB_SIZE nSize = 0;
|
||||
char * pszBuf;
|
||||
|
||||
if( pszFree == NULL )
|
||||
{
|
||||
pszFree = ( char ** ) &szName;
|
||||
ulSize = strlen( szName );
|
||||
nSize = strlen( szName );
|
||||
}
|
||||
pszBuf = *pszFree;
|
||||
if( pulSize == NULL )
|
||||
pulSize = &ulSize;
|
||||
else if( *pulSize > 0 )
|
||||
ulSize = *pulSize - 1;
|
||||
if( pnSize == NULL )
|
||||
pnSize = &nSize;
|
||||
else if( *pnSize > 0 )
|
||||
nSize = *pnSize - 1;
|
||||
|
||||
szName = hb_cdpnDup3( szName, strlen( szName ),
|
||||
pszBuf, &ulSize, pszFree, pulSize,
|
||||
pszBuf, &nSize, pszFree, pnSize,
|
||||
cdpOS, cdpHost );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,32 +60,32 @@ static const HB_WCHAR s_szConstStr[ 1 ] = { 0 };
|
||||
|
||||
HB_SIZE hb_wstrlen( const HB_WCHAR * szText )
|
||||
{
|
||||
HB_SIZE ulLen = 0;
|
||||
HB_SIZE nLen = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrlen(%p)", szText));
|
||||
|
||||
if( szText )
|
||||
{
|
||||
while( szText[ ulLen ] )
|
||||
++ulLen;
|
||||
while( szText[ nLen ] )
|
||||
++nLen;
|
||||
}
|
||||
|
||||
return ulLen;
|
||||
return nLen;
|
||||
}
|
||||
|
||||
HB_SIZE hb_wstrnlen( const HB_WCHAR * szText, HB_SIZE count )
|
||||
HB_SIZE hb_wstrnlen( const HB_WCHAR * szText, HB_SIZE nCount )
|
||||
{
|
||||
HB_SIZE ulLen = 0;
|
||||
HB_SIZE nLen = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrnlen(%p,%" HB_PFS "u)", szText, count));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrnlen(%p,%" HB_PFS "u)", szText, nCount));
|
||||
|
||||
if( szText )
|
||||
{
|
||||
while( count-- && szText[ ulLen ] )
|
||||
++ulLen;
|
||||
while( nCount-- && szText[ nLen ] )
|
||||
++nLen;
|
||||
}
|
||||
|
||||
return ulLen;
|
||||
return nLen;
|
||||
}
|
||||
|
||||
int hb_wstrcmp( const HB_WCHAR * s1, const HB_WCHAR * s2 )
|
||||
@@ -111,13 +111,13 @@ int hb_wstrcmp( const HB_WCHAR * s1, const HB_WCHAR * s2 )
|
||||
return rc;
|
||||
}
|
||||
|
||||
int hb_wstrncmp( const HB_WCHAR * s1, const HB_WCHAR * s2, HB_SIZE count )
|
||||
int hb_wstrncmp( const HB_WCHAR * s1, const HB_WCHAR * s2, HB_SIZE nCount )
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrncmp(%p, %p, %" HB_PFS "u)", s1, s2, count));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrncmp(%p, %p, %" HB_PFS "u)", s1, s2, nCount));
|
||||
|
||||
while( count-- )
|
||||
while( nCount-- )
|
||||
{
|
||||
if( *s1 != *s2 )
|
||||
{
|
||||
@@ -137,50 +137,50 @@ int hb_wstrncmp( const HB_WCHAR * s1, const HB_WCHAR * s2, HB_SIZE count )
|
||||
HB_WCHAR * hb_wstrdup( const HB_WCHAR * szText )
|
||||
{
|
||||
HB_WCHAR * pszDest;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrdup(%p)", szText));
|
||||
|
||||
ulSize = ( hb_wstrlen( szText ) + 1 ) * sizeof( HB_WCHAR );
|
||||
pszDest = ( HB_WCHAR * ) hb_xgrab( ulSize );
|
||||
nSize = ( hb_wstrlen( szText ) + 1 ) * sizeof( HB_WCHAR );
|
||||
pszDest = ( HB_WCHAR * ) hb_xgrab( nSize );
|
||||
|
||||
memcpy( pszDest, szText, ulSize );
|
||||
memcpy( pszDest, szText, nSize );
|
||||
|
||||
return pszDest;
|
||||
}
|
||||
|
||||
HB_WCHAR * hb_wstrndup( const HB_WCHAR * szText, HB_SIZE ulLen )
|
||||
HB_WCHAR * hb_wstrndup( const HB_WCHAR * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_WCHAR * pszDest;
|
||||
HB_SIZE ulSize;
|
||||
HB_SIZE nSize;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrndup(%p,%" HB_PFS "u)", szText,ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrndup(%p,%" HB_PFS "u)", szText, nLen));
|
||||
|
||||
ulSize = hb_wstrlen( szText );
|
||||
if( ulSize < ulLen )
|
||||
ulLen = ulSize;
|
||||
ulSize = ulLen * sizeof( HB_WCHAR );
|
||||
pszDest = ( HB_WCHAR * ) hb_xgrab( ulSize + sizeof( HB_WCHAR ) );
|
||||
memcpy( pszDest, szText, ulSize );
|
||||
pszDest[ ulLen ] = 0;
|
||||
nSize = hb_wstrlen( szText );
|
||||
if( nSize < nLen )
|
||||
nLen = nSize;
|
||||
nSize = nLen * sizeof( HB_WCHAR );
|
||||
pszDest = ( HB_WCHAR * ) hb_xgrab( nSize + sizeof( HB_WCHAR ) );
|
||||
memcpy( pszDest, szText, nSize );
|
||||
pszDest[ nLen ] = 0;
|
||||
|
||||
return pszDest;
|
||||
}
|
||||
|
||||
HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE ulLen )
|
||||
HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrunshare(%p,%p,%" HB_PFS "u)", phStr, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_wstrunshare(%p,%p,%" HB_PFS "u)", phStr, pStr, nLen));
|
||||
|
||||
if( pStr == NULL || phStr == NULL || *phStr == NULL )
|
||||
return NULL;
|
||||
|
||||
if( ulLen > 0 &&
|
||||
if( nLen > 0 &&
|
||||
( *phStr == ( void * ) s_szConstStr || hb_xRefCount( *phStr ) > 1 ) )
|
||||
{
|
||||
HB_WCHAR * pszDest = ( HB_WCHAR * ) hb_xgrab( ( ulLen + 1 ) *
|
||||
HB_WCHAR * pszDest = ( HB_WCHAR * ) hb_xgrab( ( nLen + 1 ) *
|
||||
sizeof( HB_WCHAR ) );
|
||||
memcpy( pszDest, pStr, ulLen * sizeof( HB_WCHAR ) );
|
||||
pszDest[ ulLen ] = 0;
|
||||
memcpy( pszDest, pStr, nLen * sizeof( HB_WCHAR ) );
|
||||
pszDest[ nLen ] = 0;
|
||||
if( *phStr != ( void * ) s_szConstStr )
|
||||
hb_xRefDec( *phStr );
|
||||
* phStr = ( void * ) pszDest;
|
||||
@@ -191,19 +191,19 @@ HB_WCHAR * hb_wstrunshare( void ** phStr, const HB_WCHAR * pStr, HB_SIZE ulLen )
|
||||
return ( HB_WCHAR * ) pStr;
|
||||
}
|
||||
|
||||
char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE ulLen )
|
||||
char * hb_strunshare( void ** phStr, const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_strunshare(%p,%p,%" HB_PFS "u)", phStr, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_strunshare(%p,%p,%" HB_PFS "u)", phStr, pStr, nLen));
|
||||
|
||||
if( pStr == NULL || phStr == NULL || *phStr == NULL )
|
||||
return NULL;
|
||||
|
||||
if( ulLen > 0 &&
|
||||
if( nLen > 0 &&
|
||||
( *phStr == ( void * ) s_szConstStr || hb_xRefCount( *phStr ) > 1 ) )
|
||||
{
|
||||
char * pszDest = ( char * ) hb_xgrab( ( ulLen + 1 ) * sizeof( char ) );
|
||||
memcpy( pszDest, pStr, ulLen * sizeof( char ) );
|
||||
pszDest[ ulLen ] = 0;
|
||||
char * pszDest = ( char * ) hb_xgrab( ( nLen + 1 ) * sizeof( char ) );
|
||||
memcpy( pszDest, pStr, nLen * sizeof( char ) );
|
||||
pszDest[ nLen ] = 0;
|
||||
if( *phStr != ( void * ) s_szConstStr )
|
||||
hb_xRefDec( *phStr );
|
||||
* phStr = ( void * ) pszDest;
|
||||
@@ -239,19 +239,19 @@ void hb_strfree( void * hString )
|
||||
|
||||
|
||||
|
||||
const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZE * pulLen )
|
||||
const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStr(%p,%p,%p,%p)", pItem, cdp, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStr(%p,%p,%p,%p)", pItem, cdp, phString, pnLen));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
const char * pString;
|
||||
char * pFree = NULL;
|
||||
HB_SIZE ulSize = 0;
|
||||
HB_SIZE nSize = 0;
|
||||
|
||||
pString = hb_cdpnDup3( pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
NULL, pulLen, &pFree, &ulSize,
|
||||
NULL, pnLen, &pFree, &nSize,
|
||||
hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
|
||||
if( pFree != NULL )
|
||||
* phString = ( void * ) pFree;
|
||||
@@ -265,32 +265,32 @@ const char * hb_itemGetStr( PHB_ITEM pItem, void * cdp, void ** phString, HB_SIZ
|
||||
return pString;
|
||||
}
|
||||
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pulLen )
|
||||
const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStrUTF8(%p,%p,%p)", pItem, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStrUTF8(%p,%p,%p)", pItem, phString, pnLen));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
PHB_CODEPAGE cdp = hb_vmCDP();
|
||||
HB_SIZE ulLen = hb_cdpStrAsUTF8Len( cdp, HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, 0 );
|
||||
if( pulLen )
|
||||
*pulLen = ulLen;
|
||||
HB_SIZE nLen = hb_cdpStrAsUTF8Len( cdp, HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, 0 );
|
||||
if( pnLen )
|
||||
*pnLen = nLen;
|
||||
|
||||
if( ulLen != pItem->item.asString.length )
|
||||
if( nLen != pItem->item.asString.length )
|
||||
{
|
||||
char * pszUtf8 = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
char * pszUtf8 = ( char * ) hb_xgrab( nLen + 1 );
|
||||
hb_cdpStrToUTF8( cdp, HB_FALSE,
|
||||
pItem->item.asString.value, pItem->item.asString.length,
|
||||
pszUtf8, ulLen + 1 );
|
||||
pszUtf8, nLen + 1 );
|
||||
* phString = ( void * ) pszUtf8;
|
||||
return pszUtf8;
|
||||
}
|
||||
@@ -305,195 +305,195 @@ const char * hb_itemGetStrUTF8( PHB_ITEM pItem, void ** phString, HB_SIZE * pulL
|
||||
return pItem->item.asString.value;
|
||||
}
|
||||
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const HB_WCHAR * hb_itemGetStrU16( PHB_ITEM pItem, int iEndian,
|
||||
void ** phString, HB_SIZE * pulLen )
|
||||
void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStrU16(%p,%d,%p,%p)", pItem, iEndian, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemGetStrU16(%p,%d,%p,%p)", pItem, iEndian, phString, pnLen));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
HB_WCHAR * pszU16;
|
||||
PHB_CODEPAGE cdp = hb_vmCDP();
|
||||
HB_SIZE ulLen = hb_cdpStrAsU16Len( cdp, HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, 0 );
|
||||
if( pulLen )
|
||||
*pulLen = ulLen;
|
||||
HB_SIZE nLen = hb_cdpStrAsU16Len( cdp, HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, 0 );
|
||||
if( pnLen )
|
||||
*pnLen = nLen;
|
||||
|
||||
if( ulLen == 0 )
|
||||
if( nLen == 0 )
|
||||
{
|
||||
* phString = ( void * ) s_szConstStr;
|
||||
return s_szConstStr;
|
||||
}
|
||||
|
||||
pszU16 = ( HB_WCHAR * ) hb_xgrab( ( ulLen + 1 ) * sizeof( HB_WCHAR ) );
|
||||
pszU16 = ( HB_WCHAR * ) hb_xgrab( ( nLen + 1 ) * sizeof( HB_WCHAR ) );
|
||||
hb_cdpStrToU16( cdp, HB_FALSE, iEndian,
|
||||
pItem->item.asString.value, pItem->item.asString.length,
|
||||
pszU16, ulLen + 1 );
|
||||
pszU16, nLen + 1 );
|
||||
|
||||
* phString = ( void * ) pszU16;
|
||||
return pszU16;
|
||||
}
|
||||
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE ulSize )
|
||||
HB_SIZE hb_itemCopyStr( PHB_ITEM pItem, void * cdp, char * pStrBuffer, HB_SIZE nSize )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStr(%p,%p,%p,%" HB_PFS "u)", pItem, cdp, pStrBuffer, ulSize));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStr(%p,%p,%p,%" HB_PFS "u)", pItem, cdp, pStrBuffer, nSize));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
if( pStrBuffer )
|
||||
return hb_cdpTransTo( pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
pStrBuffer, ulSize,
|
||||
pStrBuffer, nSize,
|
||||
hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
|
||||
else
|
||||
return hb_cdpnDup2Len( pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
ulSize, hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
|
||||
nSize, hb_vmCDP(), ( PHB_CODEPAGE ) cdp );
|
||||
}
|
||||
else if( pStrBuffer && ulSize )
|
||||
else if( pStrBuffer && nSize )
|
||||
pStrBuffer[ 0 ] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE ulSize )
|
||||
HB_SIZE hb_itemCopyStrUTF8( PHB_ITEM pItem, char * pStrBuffer, HB_SIZE nSize )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStrUTF8(%p,%p,%" HB_PFS "u)", pItem, pStrBuffer, ulSize));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStrUTF8(%p,%p,%" HB_PFS "u)", pItem, pStrBuffer, nSize));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
if( pStrBuffer )
|
||||
ulSize = hb_cdpStrToUTF8( hb_vmCDP(), HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
pStrBuffer, ulSize );
|
||||
else
|
||||
ulSize = hb_cdpStrAsUTF8Len( hb_vmCDP(), HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, ulSize );
|
||||
return ulSize;
|
||||
}
|
||||
else if( pStrBuffer && ulSize )
|
||||
pStrBuffer[ 0 ] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, HB_SIZE ulSize )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStrU16(%p,%d,%p,%" HB_PFS "u)", pItem, iEndian, pStrBuffer, ulSize));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
if( pStrBuffer )
|
||||
ulSize = hb_cdpStrToU16( hb_vmCDP(), HB_FALSE, iEndian,
|
||||
nSize = hb_cdpStrToUTF8( hb_vmCDP(), HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
pStrBuffer, ulSize );
|
||||
pStrBuffer, nSize );
|
||||
else
|
||||
ulSize = hb_cdpStrAsU16Len( hb_vmCDP(), HB_FALSE,
|
||||
nSize = hb_cdpStrAsUTF8Len( hb_vmCDP(), HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, ulSize );
|
||||
return ulSize;
|
||||
pItem->item.asString.length, nSize );
|
||||
return nSize;
|
||||
}
|
||||
else if( pStrBuffer && ulSize )
|
||||
else if( pStrBuffer && nSize )
|
||||
pStrBuffer[ 0 ] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PHB_ITEM hb_itemPutStrLen( PHB_ITEM pItem, void * cdp, const char * pStr, HB_SIZE ulLen )
|
||||
HB_SIZE hb_itemCopyStrU16( PHB_ITEM pItem, int iEndian, HB_WCHAR * pStrBuffer, HB_SIZE nSize )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemCopyStrU16(%p,%d,%p,%" HB_PFS "u)", pItem, iEndian, pStrBuffer, nSize));
|
||||
|
||||
if( pItem && HB_IS_STRING( pItem ) )
|
||||
{
|
||||
if( pStrBuffer )
|
||||
nSize = hb_cdpStrToU16( hb_vmCDP(), HB_FALSE, iEndian,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length,
|
||||
pStrBuffer, nSize );
|
||||
else
|
||||
nSize = hb_cdpStrAsU16Len( hb_vmCDP(), HB_FALSE,
|
||||
pItem->item.asString.value,
|
||||
pItem->item.asString.length, nSize );
|
||||
return nSize;
|
||||
}
|
||||
else if( pStrBuffer && nSize )
|
||||
pStrBuffer[ 0 ] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
PHB_ITEM hb_itemPutStrLen( PHB_ITEM pItem, void * cdp, const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
char * pszText;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrLen(%p,%p,%p,%" HB_PFS "u)", pItem, cdp, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrLen(%p,%p,%p,%" HB_PFS "u)", pItem, cdp, pStr, nLen));
|
||||
|
||||
if( ulLen == 0 )
|
||||
if( nLen == 0 )
|
||||
return hb_itemPutC( pItem, NULL );
|
||||
|
||||
pszText = hb_cdpnDup( pStr, &ulLen, ( PHB_CODEPAGE ) cdp, hb_vmCDP() );
|
||||
pszText = hb_cdpnDup( pStr, &nLen, ( PHB_CODEPAGE ) cdp, hb_vmCDP() );
|
||||
|
||||
return hb_itemPutCLPtr( pItem, pszText, ulLen );
|
||||
return hb_itemPutCLPtr( pItem, pszText, nLen );
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutStrLenUTF8( PHB_ITEM pItem, const char * pStr, HB_SIZE ulLen )
|
||||
PHB_ITEM hb_itemPutStrLenUTF8( PHB_ITEM pItem, const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
PHB_CODEPAGE cdp;
|
||||
char * pszDest;
|
||||
HB_SIZE ulDest;
|
||||
HB_SIZE nDest;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrLenUTF8(%p,%p,%" HB_PFS "u)", pItem, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrLenUTF8(%p,%p,%" HB_PFS "u)", pItem, pStr, nLen));
|
||||
|
||||
if( ulLen == 0 )
|
||||
if( nLen == 0 )
|
||||
return hb_itemPutC( pItem, NULL );
|
||||
|
||||
cdp = hb_vmCDP();
|
||||
ulDest = hb_cdpUTF8AsStrLen( cdp, HB_FALSE, pStr, ulLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( ulDest + 1 );
|
||||
hb_cdpUTF8ToStr( cdp, HB_FALSE, pStr, ulLen, pszDest, ulDest + 1 );
|
||||
nDest = hb_cdpUTF8AsStrLen( cdp, HB_FALSE, pStr, nLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( nDest + 1 );
|
||||
hb_cdpUTF8ToStr( cdp, HB_FALSE, pStr, nLen, pszDest, nDest + 1 );
|
||||
|
||||
return hb_itemPutCLPtr( pItem, pszDest, ulDest );
|
||||
return hb_itemPutCLPtr( pItem, pszDest, nDest );
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutStrLenU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr, HB_SIZE ulLen )
|
||||
PHB_ITEM hb_itemPutStrLenU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr, HB_SIZE nLen )
|
||||
{
|
||||
PHB_CODEPAGE cdp;
|
||||
char * pszDest;
|
||||
HB_SIZE ulDest;
|
||||
HB_SIZE nDest;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrLenU16(%p,%d,%p,%" HB_PFS "u)", pItem, iEndian, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrLenU16(%p,%d,%p,%" HB_PFS "u)", pItem, iEndian, pStr, nLen));
|
||||
|
||||
if( ulLen == 0 )
|
||||
if( nLen == 0 )
|
||||
return hb_itemPutC( pItem, NULL );
|
||||
|
||||
cdp = hb_vmCDP();
|
||||
ulDest = hb_cdpU16AsStrLen( cdp, HB_FALSE, pStr, ulLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( ulDest + 1 );
|
||||
hb_cdpU16ToStr( cdp, HB_FALSE, iEndian, pStr, ulLen, pszDest, ulDest + 1 );
|
||||
nDest = hb_cdpU16AsStrLen( cdp, HB_FALSE, pStr, nLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( nDest + 1 );
|
||||
hb_cdpU16ToStr( cdp, HB_FALSE, iEndian, pStr, nLen, pszDest, nDest + 1 );
|
||||
|
||||
return hb_itemPutCLPtr( pItem, pszDest, ulDest );
|
||||
return hb_itemPutCLPtr( pItem, pszDest, nDest );
|
||||
}
|
||||
|
||||
|
||||
PHB_ITEM hb_itemPutStr( PHB_ITEM pItem, void * cdp, const char * pStr )
|
||||
{
|
||||
char * pszText;
|
||||
HB_SIZE ulLen;
|
||||
HB_SIZE nLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStr(%p,%p,%p)", pItem, cdp, pStr));
|
||||
|
||||
if( pStr == NULL )
|
||||
return hb_itemPutC( pItem, NULL );
|
||||
|
||||
ulLen = strlen( pStr );
|
||||
pszText = hb_cdpnDup( pStr, &ulLen, ( PHB_CODEPAGE ) cdp, hb_vmCDP() );
|
||||
nLen = strlen( pStr );
|
||||
pszText = hb_cdpnDup( pStr, &nLen, ( PHB_CODEPAGE ) cdp, hb_vmCDP() );
|
||||
|
||||
return hb_itemPutCLPtr( pItem, pszText, ulLen );
|
||||
return hb_itemPutCLPtr( pItem, pszText, nLen );
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutStrUTF8( PHB_ITEM pItem, const char * pStr )
|
||||
{
|
||||
PHB_CODEPAGE cdp;
|
||||
char * pszDest;
|
||||
HB_SIZE ulDest, ulLen;
|
||||
HB_SIZE nDest, nLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrUTF8(%p,%p)", pItem, pStr));
|
||||
|
||||
@@ -501,19 +501,19 @@ PHB_ITEM hb_itemPutStrUTF8( PHB_ITEM pItem, const char * pStr )
|
||||
return hb_itemPutC( pItem, NULL );
|
||||
|
||||
cdp = hb_vmCDP();
|
||||
ulLen = strlen( pStr );
|
||||
ulDest = hb_cdpUTF8AsStrLen( cdp, HB_FALSE, pStr, ulLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( ulDest + 1 );
|
||||
hb_cdpUTF8ToStr( cdp, HB_FALSE, pStr, ulLen, pszDest, ulDest + 1 );
|
||||
nLen = strlen( pStr );
|
||||
nDest = hb_cdpUTF8AsStrLen( cdp, HB_FALSE, pStr, nLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( nDest + 1 );
|
||||
hb_cdpUTF8ToStr( cdp, HB_FALSE, pStr, nLen, pszDest, nDest + 1 );
|
||||
|
||||
return hb_itemPutCLPtr( pItem, pszDest, ulDest );
|
||||
return hb_itemPutCLPtr( pItem, pszDest, nDest );
|
||||
}
|
||||
|
||||
PHB_ITEM hb_itemPutStrU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr )
|
||||
{
|
||||
PHB_CODEPAGE cdp;
|
||||
char * pszDest;
|
||||
HB_SIZE ulDest, ulLen;
|
||||
HB_SIZE nDest, nLen;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_itemPutStrU16(%p,%d,%p)", pItem, iEndian, pStr));
|
||||
|
||||
@@ -521,102 +521,102 @@ PHB_ITEM hb_itemPutStrU16( PHB_ITEM pItem, int iEndian, const HB_WCHAR * pStr )
|
||||
return hb_itemPutC( pItem, NULL );
|
||||
|
||||
cdp = hb_vmCDP();
|
||||
ulLen = hb_wstrlen( pStr );
|
||||
ulDest = hb_cdpU16AsStrLen( cdp, HB_FALSE, pStr, ulLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( ulDest + 1 );
|
||||
hb_cdpU16ToStr( cdp, HB_FALSE, iEndian, pStr, ulLen, pszDest, ulDest + 1 );
|
||||
nLen = hb_wstrlen( pStr );
|
||||
nDest = hb_cdpU16AsStrLen( cdp, HB_FALSE, pStr, nLen, 0 );
|
||||
pszDest = ( char * ) hb_xgrab( nDest + 1 );
|
||||
hb_cdpU16ToStr( cdp, HB_FALSE, iEndian, pStr, nLen, pszDest, nDest + 1 );
|
||||
|
||||
return hb_itemPutCLPtr( pItem, pszDest, ulDest );
|
||||
return hb_itemPutCLPtr( pItem, pszDest, nDest );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const char * hb_arrayGetStr( PHB_ITEM pArray, HB_SIZE ulIndex, void * cdp,
|
||||
void ** phString, HB_SIZE * pulLen )
|
||||
const char * hb_arrayGetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp,
|
||||
void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetStr(%p, %" HB_PFS "u, %p, %p, %p)", pArray, ulIndex, cdp, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetStr(%p, %" HB_PFS "u, %p, %p, %p)", pArray, nIndex, cdp, phString, pnLen));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
return hb_itemGetStr( pArray->item.asArray.value->pItems + ulIndex - 1,
|
||||
cdp, phString, pulLen );
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
return hb_itemGetStr( pArray->item.asArray.value->pItems + nIndex - 1,
|
||||
cdp, phString, pnLen );
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * hb_arrayGetStrUTF8( PHB_ITEM pArray, HB_SIZE ulIndex,
|
||||
void ** phString, HB_SIZE * pulLen )
|
||||
const char * hb_arrayGetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex,
|
||||
void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetStrUTF8(%p, %" HB_PFS "u, %p, %p)", pArray, ulIndex, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetStrUTF8(%p, %" HB_PFS "u, %p, %p)", pArray, nIndex, phString, pnLen));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
return hb_itemGetStrUTF8( pArray->item.asArray.value->pItems + ulIndex - 1,
|
||||
phString, pulLen );
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
return hb_itemGetStrUTF8( pArray->item.asArray.value->pItems + nIndex - 1,
|
||||
phString, pnLen );
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const HB_WCHAR * hb_arrayGetStrU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian,
|
||||
void ** phString, HB_SIZE * pulLen )
|
||||
const HB_WCHAR * hb_arrayGetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian,
|
||||
void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetStrU16(%p, %" HB_PFS "u, %d, %p, %p)", pArray, ulIndex, iEndian, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arrayGetStrU16(%p, %" HB_PFS "u, %d, %p, %p)", pArray, nIndex, iEndian, phString, pnLen));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
return hb_itemGetStrU16( pArray->item.asArray.value->pItems + ulIndex - 1,
|
||||
iEndian, phString, pulLen );
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
return hb_itemGetStrU16( pArray->item.asArray.value->pItems + nIndex - 1,
|
||||
iEndian, phString, pnLen );
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
HB_BOOL hb_arraySetStrLen( PHB_ITEM pArray, HB_SIZE ulIndex, void * cdp,
|
||||
const char * pStr, HB_SIZE ulLen )
|
||||
HB_BOOL hb_arraySetStrLen( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp,
|
||||
const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrLen(%p, %" HB_PFS "u, %p, %p, %" HB_PFS "u)", pArray, ulIndex, cdp, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrLen(%p, %" HB_PFS "u, %p, %p, %" HB_PFS "u)", pArray, nIndex, cdp, pStr, nLen));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
{
|
||||
hb_itemPutStrLen( pArray->item.asArray.value->pItems + ulIndex - 1, cdp,
|
||||
pStr, ulLen );
|
||||
hb_itemPutStrLen( pArray->item.asArray.value->pItems + nIndex - 1, cdp,
|
||||
pStr, nLen );
|
||||
return HB_TRUE;
|
||||
}
|
||||
else
|
||||
return HB_FALSE;
|
||||
}
|
||||
|
||||
HB_BOOL hb_arraySetStrLenUTF8( PHB_ITEM pArray, HB_SIZE ulIndex,
|
||||
const char * pStr, HB_SIZE ulLen )
|
||||
HB_BOOL hb_arraySetStrLenUTF8( PHB_ITEM pArray, HB_SIZE nIndex,
|
||||
const char * pStr, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrLenUTF8(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", pArray, ulIndex, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrLenUTF8(%p, %" HB_PFS "u, %p, %" HB_PFS "u)", pArray, nIndex, pStr, nLen));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
{
|
||||
hb_itemPutStrLenUTF8( pArray->item.asArray.value->pItems + ulIndex - 1,
|
||||
pStr, ulLen );
|
||||
hb_itemPutStrLenUTF8( pArray->item.asArray.value->pItems + nIndex - 1,
|
||||
pStr, nLen );
|
||||
return HB_TRUE;
|
||||
}
|
||||
else
|
||||
return HB_FALSE;
|
||||
}
|
||||
|
||||
HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian,
|
||||
const HB_WCHAR * pStr, HB_SIZE ulLen )
|
||||
HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian,
|
||||
const HB_WCHAR * pStr, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrLenU16(%p, %" HB_PFS "u, %d, %p, %" HB_PFS "u)", pArray, ulIndex, iEndian, pStr, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrLenU16(%p, %" HB_PFS "u, %d, %p, %" HB_PFS "u)", pArray, nIndex, iEndian, pStr, nLen));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
{
|
||||
hb_itemPutStrLenU16( pArray->item.asArray.value->pItems + ulIndex - 1,
|
||||
iEndian, pStr, ulLen );
|
||||
hb_itemPutStrLenU16( pArray->item.asArray.value->pItems + nIndex - 1,
|
||||
iEndian, pStr, nLen );
|
||||
return HB_TRUE;
|
||||
}
|
||||
else
|
||||
@@ -624,39 +624,39 @@ HB_BOOL hb_arraySetStrLenU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian,
|
||||
}
|
||||
|
||||
|
||||
HB_BOOL hb_arraySetStr( PHB_ITEM pArray, HB_SIZE ulIndex, void * cdp, const char * pStr )
|
||||
HB_BOOL hb_arraySetStr( PHB_ITEM pArray, HB_SIZE nIndex, void * cdp, const char * pStr )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStr(%p, %" HB_PFS "u, %p, %p)", pArray, ulIndex, cdp, pStr));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStr(%p, %" HB_PFS "u, %p, %p)", pArray, nIndex, cdp, pStr));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
{
|
||||
hb_itemPutStr( pArray->item.asArray.value->pItems + ulIndex - 1, cdp, pStr );
|
||||
hb_itemPutStr( pArray->item.asArray.value->pItems + nIndex - 1, cdp, pStr );
|
||||
return HB_TRUE;
|
||||
}
|
||||
else
|
||||
return HB_FALSE;
|
||||
}
|
||||
|
||||
HB_BOOL hb_arraySetStrUTF8( PHB_ITEM pArray, HB_SIZE ulIndex, const char * pStr)
|
||||
HB_BOOL hb_arraySetStrUTF8( PHB_ITEM pArray, HB_SIZE nIndex, const char * pStr)
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrUTF8(%p, %" HB_PFS "u, %p)", pArray, ulIndex, pStr));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrUTF8(%p, %" HB_PFS "u, %p)", pArray, nIndex, pStr));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
{
|
||||
hb_itemPutStrUTF8( pArray->item.asArray.value->pItems + ulIndex - 1, pStr );
|
||||
hb_itemPutStrUTF8( pArray->item.asArray.value->pItems + nIndex - 1, pStr );
|
||||
return HB_TRUE;
|
||||
}
|
||||
else
|
||||
return HB_FALSE;
|
||||
}
|
||||
|
||||
HB_BOOL hb_arraySetStrU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian, const HB_WCHAR * pStr )
|
||||
HB_BOOL hb_arraySetStrU16( PHB_ITEM pArray, HB_SIZE nIndex, int iEndian, const HB_WCHAR * pStr )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrU16(%p, %" HB_PFS "u, %d, %p)", pArray, ulIndex, iEndian, pStr));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_arraySetStrU16(%p, %" HB_PFS "u, %d, %p)", pArray, nIndex, iEndian, pStr));
|
||||
|
||||
if( HB_IS_ARRAY( pArray ) && ulIndex > 0 && ulIndex <= pArray->item.asArray.value->ulLen )
|
||||
if( HB_IS_ARRAY( pArray ) && nIndex > 0 && nIndex <= pArray->item.asArray.value->nLen )
|
||||
{
|
||||
hb_itemPutStrU16( pArray->item.asArray.value->pItems + ulIndex - 1, iEndian, pStr );
|
||||
hb_itemPutStrU16( pArray->item.asArray.value->pItems + nIndex - 1, iEndian, pStr );
|
||||
return HB_TRUE;
|
||||
}
|
||||
else
|
||||
@@ -666,11 +666,11 @@ HB_BOOL hb_arraySetStrU16( PHB_ITEM pArray, HB_SIZE ulIndex, int iEndian, const
|
||||
|
||||
|
||||
|
||||
const char * hb_parstr( int iParam, void * cdp, void ** phString, HB_SIZE * pulLen )
|
||||
const char * hb_parstr( int iParam, void * cdp, void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parstr(%d,%p,%p,%p)", iParam, cdp, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parstr(%d,%p,%p,%p)", iParam, cdp, phString, pnLen));
|
||||
|
||||
if( iParam >= -1 && iParam <= hb_pcount() )
|
||||
{
|
||||
@@ -679,21 +679,21 @@ const char * hb_parstr( int iParam, void * cdp, void ** phString, HB_SIZE * pulL
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
pItem = hb_itemUnRef( pItem );
|
||||
|
||||
return hb_itemGetStr( pItem, cdp, phString, pulLen );
|
||||
return hb_itemGetStr( pItem, cdp, phString, pnLen );
|
||||
}
|
||||
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char * hb_parstr_utf8( int iParam, void ** phString, HB_SIZE * pulLen )
|
||||
const char * hb_parstr_utf8( int iParam, void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parstr_utf8(%d,%p,%p)", iParam, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parstr_utf8(%d,%p,%p)", iParam, phString, pnLen));
|
||||
|
||||
if( iParam >= -1 && iParam <= hb_pcount() )
|
||||
{
|
||||
@@ -702,22 +702,22 @@ const char * hb_parstr_utf8( int iParam, void ** phString, HB_SIZE * pulLen )
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
pItem = hb_itemUnRef( pItem );
|
||||
|
||||
return hb_itemGetStrUTF8( pItem, phString, pulLen );
|
||||
return hb_itemGetStrUTF8( pItem, phString, pnLen );
|
||||
}
|
||||
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const HB_WCHAR * hb_parstr_u16( int iParam, int iEndian,
|
||||
void ** phString, HB_SIZE * pulLen )
|
||||
void ** phString, HB_SIZE * pnLen )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parstr_u16(%d,%d,%p,%p)", iParam, iEndian, phString, pulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_parstr_u16(%d,%d,%p,%p)", iParam, iEndian, phString, pnLen));
|
||||
|
||||
if( iParam >= -1 && iParam <= hb_pcount() )
|
||||
{
|
||||
@@ -726,11 +726,11 @@ const HB_WCHAR * hb_parstr_u16( int iParam, int iEndian,
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
pItem = hb_itemUnRef( pItem );
|
||||
|
||||
return hb_itemGetStrU16( pItem, iEndian, phString, pulLen );
|
||||
return hb_itemGetStrU16( pItem, iEndian, phString, pnLen );
|
||||
}
|
||||
|
||||
if( pulLen )
|
||||
* pulLen = 0;
|
||||
if( pnLen )
|
||||
* pnLen = 0;
|
||||
* phString = NULL;
|
||||
|
||||
return NULL;
|
||||
@@ -768,31 +768,31 @@ void hb_retstr_u16( int iEndian, const HB_WCHAR * szText )
|
||||
}
|
||||
|
||||
|
||||
void hb_retstrlen( void * cdp, const char * szText, HB_SIZE ulLen )
|
||||
void hb_retstrlen( void * cdp, const char * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_retstrlen(%p,%s,%" HB_PFS "u)", cdp, szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_retstrlen(%p,%s,%" HB_PFS "u)", cdp, szText, nLen));
|
||||
|
||||
hb_itemPutStrLen( hb_stackReturnItem(), cdp, szText, ulLen );
|
||||
hb_itemPutStrLen( hb_stackReturnItem(), cdp, szText, nLen );
|
||||
}
|
||||
|
||||
void hb_retstrlen_utf8( const char * szText, HB_SIZE ulLen )
|
||||
void hb_retstrlen_utf8( const char * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_retstrlen_utf8(%s,%" HB_PFS "u)", szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_retstrlen_utf8(%s,%" HB_PFS "u)", szText, nLen));
|
||||
|
||||
hb_itemPutStrLenUTF8( hb_stackReturnItem(), szText, ulLen );
|
||||
hb_itemPutStrLenUTF8( hb_stackReturnItem(), szText, nLen );
|
||||
}
|
||||
|
||||
void hb_retstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE ulLen )
|
||||
void hb_retstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_retstrlen_u16(%d,%p,%" HB_PFS "u)", iEndian, szText, ulLen));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_retstrlen_u16(%d,%p,%" HB_PFS "u)", iEndian, szText, nLen));
|
||||
|
||||
hb_itemPutStrLenU16( hb_stackReturnItem(), iEndian, szText, ulLen );
|
||||
hb_itemPutStrLenU16( hb_stackReturnItem(), iEndian, szText, nLen );
|
||||
}
|
||||
|
||||
|
||||
@@ -878,15 +878,15 @@ int hb_storstr_u16( int iEndian, const HB_WCHAR * szText, int iParam )
|
||||
}
|
||||
|
||||
|
||||
int hb_storstrlen( void * cdp, const char * szText, HB_SIZE ulLen, int iParam )
|
||||
int hb_storstrlen( void * cdp, const char * szText, HB_SIZE nLen, int iParam )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_storstrlen(%p,%s,%" HB_PFS "u,%d)", cdp, szText, ulLen, iParam));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_storstrlen(%p,%s,%" HB_PFS "u,%d)", cdp, szText, nLen, iParam));
|
||||
|
||||
if( iParam == -1 )
|
||||
{
|
||||
hb_itemPutStrLen( hb_stackReturnItem(), cdp, szText, ulLen );
|
||||
hb_itemPutStrLen( hb_stackReturnItem(), cdp, szText, nLen );
|
||||
return 1;
|
||||
}
|
||||
else if( iParam >= 0 && iParam <= hb_pcount() )
|
||||
@@ -895,7 +895,7 @@ int hb_storstrlen( void * cdp, const char * szText, HB_SIZE ulLen, int iParam )
|
||||
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
{
|
||||
hb_itemPutStrLen( hb_itemUnRef( pItem ), cdp, szText, ulLen );
|
||||
hb_itemPutStrLen( hb_itemUnRef( pItem ), cdp, szText, nLen );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -903,15 +903,15 @@ int hb_storstrlen( void * cdp, const char * szText, HB_SIZE ulLen, int iParam )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hb_storstrlen_utf8( const char * szText, HB_SIZE ulLen, int iParam )
|
||||
int hb_storstrlen_utf8( const char * szText, HB_SIZE nLen, int iParam )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_storstrlen_utf8(%s,%" HB_PFS "u,%d)", szText, ulLen, iParam));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_storstrlen_utf8(%s,%" HB_PFS "u,%d)", szText, nLen, iParam));
|
||||
|
||||
if( iParam == -1 )
|
||||
{
|
||||
hb_itemPutStrLenUTF8( hb_stackReturnItem(), szText, ulLen );
|
||||
hb_itemPutStrLenUTF8( hb_stackReturnItem(), szText, nLen );
|
||||
return 1;
|
||||
}
|
||||
else if( iParam >= 0 && iParam <= hb_pcount() )
|
||||
@@ -920,7 +920,7 @@ int hb_storstrlen_utf8( const char * szText, HB_SIZE ulLen, int iParam )
|
||||
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
{
|
||||
hb_itemPutStrLenUTF8( hb_itemUnRef( pItem ), szText, ulLen );
|
||||
hb_itemPutStrLenUTF8( hb_itemUnRef( pItem ), szText, nLen );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -928,15 +928,15 @@ int hb_storstrlen_utf8( const char * szText, HB_SIZE ulLen, int iParam )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int hb_storstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE ulLen, int iParam )
|
||||
int hb_storstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE nLen, int iParam )
|
||||
{
|
||||
HB_STACK_TLS_PRELOAD
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_storstrlen_u16(%d,%p,%" HB_PFS "u,%d)", iEndian, szText, ulLen, iParam));
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_storstrlen_u16(%d,%p,%" HB_PFS "u,%d)", iEndian, szText, nLen, iParam));
|
||||
|
||||
if( iParam == -1 )
|
||||
{
|
||||
hb_itemPutStrLenU16( hb_stackReturnItem(), iEndian, szText, ulLen );
|
||||
hb_itemPutStrLenU16( hb_stackReturnItem(), iEndian, szText, nLen );
|
||||
return 1;
|
||||
}
|
||||
else if( iParam >= 0 && iParam <= hb_pcount() )
|
||||
@@ -945,7 +945,7 @@ int hb_storstrlen_u16( int iEndian, const HB_WCHAR * szText, HB_SIZE ulLen, int
|
||||
|
||||
if( HB_IS_BYREF( pItem ) )
|
||||
{
|
||||
hb_itemPutStrLenU16( hb_itemUnRef( pItem ), iEndian, szText, ulLen );
|
||||
hb_itemPutStrLenU16( hb_itemUnRef( pItem ), iEndian, szText, nLen );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -474,27 +474,30 @@ STATIC FUNCTION hbrun_FindInPath( cFileName )
|
||||
RETURN cFileName
|
||||
ENDIF
|
||||
|
||||
/* Check in the dir of this executable. */
|
||||
IF ! Empty( hb_DirBase() )
|
||||
IF hb_FileExists( cFileName := hb_FNameMerge( hb_DirBase(), cName, cExt ) )
|
||||
RETURN cFileName
|
||||
ENDIF
|
||||
ENDIF
|
||||
IF Empty( cDir )
|
||||
|
||||
/* Check in the PATH. */
|
||||
#if defined( __PLATFORM__WINDOWS ) .OR. ;
|
||||
defined( __PLATFORM__DOS ) .OR. ;
|
||||
defined( __PLATFORM__OS2 )
|
||||
FOR EACH cDirPATH IN hb_ATokens( GetEnv( "PATH" ), hb_osPathListSeparator(), .T., .T. )
|
||||
#else
|
||||
FOR EACH cDirPATH IN hb_ATokens( GetEnv( "PATH" ), hb_osPathListSeparator() )
|
||||
#endif
|
||||
IF ! Empty( cDirPATH )
|
||||
IF hb_FileExists( cFileName := hb_FNameMerge( hbrun_DirAddPathSep( hbrun_StrStripQuote( cDirPATH ) ), cName, cExt ) )
|
||||
/* Check in the dir of this executable. */
|
||||
IF ! Empty( hb_DirBase() )
|
||||
IF hb_FileExists( cFileName := hb_FNameMerge( hb_DirBase(), cName, cExt ) )
|
||||
RETURN cFileName
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
/* Check in the PATH. */
|
||||
#if defined( __PLATFORM__WINDOWS ) .OR. ;
|
||||
defined( __PLATFORM__DOS ) .OR. ;
|
||||
defined( __PLATFORM__OS2 )
|
||||
FOR EACH cDirPATH IN hb_ATokens( GetEnv( "PATH" ), hb_osPathListSeparator(), .T., .T. )
|
||||
#else
|
||||
FOR EACH cDirPATH IN hb_ATokens( GetEnv( "PATH" ), hb_osPathListSeparator() )
|
||||
#endif
|
||||
IF ! Empty( cDirPATH )
|
||||
IF hb_FileExists( cFileName := hb_FNameMerge( hbrun_DirAddPathSep( hbrun_StrStripQuote( cDirPATH ) ), cName, cExt ) )
|
||||
RETURN cFileName
|
||||
ENDIF
|
||||
ENDIF
|
||||
NEXT
|
||||
ENDIF
|
||||
NEXT
|
||||
|
||||
RETURN NIL
|
||||
|
||||
Reference in New Issue
Block a user