2012-11-01 16:04 UTC+0100 Viktor Szakats (harbour syenar.net)
* contrib/hbexpat/core.c
* minor change to avoid uncrustify formatting a tricky macro
* contrib/hbfship/*.[c|h]
* contrib/hbmysql/*.[c|h]
* contrib/hbmzip/*.[c|h]
* contrib/hbsqlit3/*.[c|h]
* contrib/hbssl/*.[c|h] (with some exceptions)
* contrib/hbxpp/*.[c|h]
* contrib/xhb/*.[c|h] (with some exceptions)
* uncrustified
* minor manual corrections before and after
This commit is contained in:
@@ -16,6 +16,20 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-11-01 16:04 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbexpat/core.c
|
||||
* minor change to avoid uncrustify formatting a tricky macro
|
||||
|
||||
* contrib/hbfship/*.[c|h]
|
||||
* contrib/hbmysql/*.[c|h]
|
||||
* contrib/hbmzip/*.[c|h]
|
||||
* contrib/hbsqlit3/*.[c|h]
|
||||
* contrib/hbssl/*.[c|h] (with some exceptions)
|
||||
* contrib/hbxpp/*.[c|h]
|
||||
* contrib/xhb/*.[c|h] (with some exceptions)
|
||||
* uncrustified
|
||||
* minor manual corrections before and after
|
||||
|
||||
2012-11-01 12:52 UTC+0100 Viktor Szakats (harbour syenar.net)
|
||||
* contrib/hbcups/*.[c|h]
|
||||
* contrib/hbcurl/*.[c|h]
|
||||
|
||||
@@ -120,7 +120,7 @@ typedef struct _HB_EXPAT
|
||||
\
|
||||
hb_expat_setvar( hb_expat, _VAR_b##_name_, hb_param( 2, HB_IT_BLOCK | HB_IT_SYMBOL ) ); \
|
||||
\
|
||||
XML_Set##_name_ ( hb_expat->parser, hb_expat->pVar[ _VAR_b##_name_ ] ? hb_expat_##_name_ : NULL ); \
|
||||
XML_Set##_name_ /* do not delete this */ ( hb_expat->parser, hb_expat->pVar[ _VAR_b##_name_ ] ? hb_expat_##_name_ : NULL ); \
|
||||
\
|
||||
hb_ret(); \
|
||||
} \
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
|
||||
HB_FUNC( DBSETLOCATE )
|
||||
{
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
HB_BOOL fSet = HB_FALSE;
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
HB_BOOL fSet = HB_FALSE;
|
||||
|
||||
if( pArea )
|
||||
{
|
||||
|
||||
@@ -77,8 +77,10 @@ HB_FUNC( EXECNAME )
|
||||
if( pFileName->szPath )
|
||||
{
|
||||
hb_xfree( pszBaseName );
|
||||
pszBaseName = hb_xstrcpy( NULL, pFileName->szName,
|
||||
pFileName->szExtension, NULL );
|
||||
pszBaseName = hb_xstrcpy( NULL,
|
||||
pFileName->szName,
|
||||
pFileName->szExtension,
|
||||
NULL );
|
||||
}
|
||||
hb_xfree( pFileName );
|
||||
}
|
||||
|
||||
@@ -79,8 +79,8 @@ HB_FUNC( INDEXNAMES )
|
||||
if( pArea )
|
||||
{
|
||||
DBORDERINFO pOrderInfo;
|
||||
PHB_ITEM pArray;
|
||||
int iSize, i;
|
||||
PHB_ITEM pArray;
|
||||
int iSize, i;
|
||||
|
||||
memset( &pOrderInfo, 0, sizeof( pOrderInfo ) );
|
||||
pOrderInfo.itmResult = hb_itemPutNI( NULL, 0 );
|
||||
@@ -90,7 +90,7 @@ HB_FUNC( INDEXNAMES )
|
||||
pArray = hb_itemArrayNew( iSize );
|
||||
for( i = 1; i <= iSize; ++i )
|
||||
{
|
||||
pOrderInfo.itmOrder = hb_itemPutNI( pOrderInfo.itmOrder, i );
|
||||
pOrderInfo.itmOrder = hb_itemPutNI( pOrderInfo.itmOrder, i );
|
||||
pOrderInfo.itmResult = hb_itemPutC( pOrderInfo.itmResult, 0 );
|
||||
if( SELF_ORDINFO( pArea, DBOI_NAME, &pOrderInfo ) != HB_SUCCESS )
|
||||
break;
|
||||
|
||||
@@ -79,7 +79,7 @@ HB_FUNC( STRPOKE )
|
||||
if( pText && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) )
|
||||
{
|
||||
HB_SIZE ulPos = hb_parns( 2 ), ulLen;
|
||||
char * pszText;
|
||||
char * pszText;
|
||||
|
||||
if( ulPos > 0 && hb_itemGetWriteCL( pText, &pszText, &ulLen ) &&
|
||||
ulPos <= ulLen )
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
#include "hbapiitm.h"
|
||||
#include "hbapifs.h"
|
||||
|
||||
/* NOTE: To satisfy MySQL headers. */
|
||||
#if defined( HB_OS_WIN )
|
||||
/* NOTE: To satisfy MySQL headers. */
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
@@ -85,13 +85,13 @@ static HB_GARBAGE_FUNC( MYSQL_release )
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
mysql_close( ( MYSQL * ) * ph );
|
||||
mysql_close( ( MYSQL * ) *ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
* ph = NULL;
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ static void hb_MYSQL_ret( MYSQL * p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( MYSQL * ), &s_gcMYSQLFuncs );
|
||||
|
||||
* ph = p;
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
@@ -119,7 +119,7 @@ static MYSQL * hb_MYSQL_par( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gcMYSQLFuncs, iParam );
|
||||
|
||||
return ph ? ( MYSQL * ) * ph : NULL;
|
||||
return ph ? ( MYSQL * ) *ph : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,13 +128,13 @@ static HB_GARBAGE_FUNC( MYSQL_RES_release )
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
mysql_free_result( ( MYSQL_RES * ) * ph );
|
||||
mysql_free_result( ( MYSQL_RES * ) *ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
* ph = NULL;
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ static void hb_MYSQL_RES_ret( MYSQL_RES * p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( MYSQL_RES * ), &s_gcMYSQL_RESFuncs );
|
||||
|
||||
* ph = p;
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
@@ -162,7 +162,7 @@ static MYSQL_RES * hb_MYSQL_RES_par( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gcMYSQL_RESFuncs, iParam );
|
||||
|
||||
return ph ? ( MYSQL_RES * ) * ph : NULL;
|
||||
return ph ? ( MYSQL_RES * ) *ph : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ HB_FUNC( MYSQL_REAL_CONNECT ) /* MYSQL * mysql_real_connect( MYSQL *, char * hos
|
||||
const char * szPass = hb_parc( 3 );
|
||||
|
||||
#if MYSQL_VERSION_ID > 32200
|
||||
MYSQL * mysql;
|
||||
MYSQL * mysql;
|
||||
unsigned int port = ( unsigned int ) hb_parnidef( 4, MYSQL_PORT );
|
||||
unsigned int flags = ( unsigned int ) hb_parnidef( 5, 0 );
|
||||
|
||||
@@ -208,7 +208,7 @@ HB_FUNC( MYSQL_GET_SERVER_VERSION ) /* long mysql_get_server_version( MYSQL * )
|
||||
hb_retnl( ( long ) mysql_get_server_version( mysql ) );
|
||||
#else
|
||||
const char * szVer = mysql_get_server_info( mysql );
|
||||
long lVer = 0;
|
||||
long lVer = 0;
|
||||
|
||||
while( *szVer )
|
||||
{
|
||||
@@ -302,13 +302,13 @@ HB_FUNC( MYSQL_FETCH_ROW ) /* MYSQL_ROW * mysql_fetch_row( MYSQL_RES * ) */
|
||||
if( mresult )
|
||||
{
|
||||
unsigned int num_fields = mysql_num_fields( mresult );
|
||||
PHB_ITEM aRow = hb_itemArrayNew( num_fields );
|
||||
MYSQL_ROW mrow = mysql_fetch_row( mresult );
|
||||
PHB_ITEM aRow = hb_itemArrayNew( num_fields );
|
||||
MYSQL_ROW mrow = mysql_fetch_row( mresult );
|
||||
|
||||
if( mrow )
|
||||
{
|
||||
unsigned long * lengths = mysql_fetch_lengths( mresult );
|
||||
unsigned int i;
|
||||
unsigned int i;
|
||||
for( i = 0; i < num_fields; ++i )
|
||||
hb_arraySetCL( aRow, i + 1, mrow[ i ], lengths[ i ] );
|
||||
}
|
||||
@@ -344,7 +344,7 @@ HB_FUNC( MYSQL_FETCH_FIELD ) /* MYSQL_FIELD * mysql_fetch_field( MYSQL_RES * ) *
|
||||
if( mresult )
|
||||
{
|
||||
/* NOTE: field structure of MySQL has 8 members as of MySQL 3.22.x */
|
||||
PHB_ITEM aField = hb_itemArrayNew( 8 );
|
||||
PHB_ITEM aField = hb_itemArrayNew( 8 );
|
||||
MYSQL_FIELD * mfield = mysql_fetch_field( mresult );
|
||||
|
||||
if( mfield )
|
||||
@@ -438,9 +438,9 @@ HB_FUNC( MYSQL_LIST_DBS ) /* MYSQL_RES * mysql_list_dbs( MYSQL *, char * wild );
|
||||
if( mysql )
|
||||
{
|
||||
MYSQL_RES * mresult = mysql_list_dbs( mysql, NULL );
|
||||
HB_SIZE nr = ( HB_SIZE ) mysql_num_rows( mresult );
|
||||
PHB_ITEM aDBs = hb_itemArrayNew( nr );
|
||||
HB_SIZE i;
|
||||
HB_SIZE nr = ( HB_SIZE ) mysql_num_rows( mresult );
|
||||
PHB_ITEM aDBs = hb_itemArrayNew( nr );
|
||||
HB_SIZE i;
|
||||
|
||||
for( i = 0; i < nr; ++i )
|
||||
{
|
||||
@@ -461,11 +461,11 @@ HB_FUNC( MYSQL_LIST_TABLES ) /* MYSQL_RES * mysql_list_tables( MYSQL *, char * w
|
||||
|
||||
if( mysql )
|
||||
{
|
||||
const char * cWild = hb_parc( 2 );
|
||||
MYSQL_RES * mresult = mysql_list_tables( mysql, cWild );
|
||||
long nr = ( long ) mysql_num_rows( mresult );
|
||||
PHB_ITEM aTables = hb_itemArrayNew( nr );
|
||||
long i;
|
||||
const char * cWild = hb_parc( 2 );
|
||||
MYSQL_RES * mresult = mysql_list_tables( mysql, cWild );
|
||||
long nr = ( long ) mysql_num_rows( mresult );
|
||||
PHB_ITEM aTables = hb_itemArrayNew( nr );
|
||||
long i;
|
||||
|
||||
for( i = 0; i < nr; ++i )
|
||||
{
|
||||
@@ -536,9 +536,9 @@ HB_FUNC( MYSQL_REAL_ESCAPE_STRING ) /* unsigned long STDCALL mysql_real_escape_s
|
||||
|
||||
if( mysql )
|
||||
{
|
||||
const char * from = hb_parcx( 2 );
|
||||
unsigned long nSize = ( unsigned long ) hb_parclen( 2 );
|
||||
char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 );
|
||||
const char * from = hb_parcx( 2 );
|
||||
unsigned long nSize = ( unsigned long ) hb_parclen( 2 );
|
||||
char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 );
|
||||
nSize = mysql_real_escape_string( mysql, buffer, from, nSize );
|
||||
hb_retclen_buffer( ( char * ) buffer, nSize );
|
||||
}
|
||||
@@ -548,16 +548,17 @@ HB_FUNC( MYSQL_REAL_ESCAPE_STRING ) /* unsigned long STDCALL mysql_real_escape_s
|
||||
|
||||
HB_FUNC( MYSQL_ESCAPE_STRING )
|
||||
{
|
||||
const char * from = hb_parcx( 1 );
|
||||
unsigned long nSize = ( unsigned long ) hb_parclen( 1 );
|
||||
char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 );
|
||||
const char * from = hb_parcx( 1 );
|
||||
unsigned long nSize = ( unsigned long ) hb_parclen( 1 );
|
||||
char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 );
|
||||
|
||||
nSize = mysql_escape_string( buffer, from, nSize );
|
||||
hb_retclen_buffer( ( char * ) buffer, nSize );
|
||||
}
|
||||
|
||||
static char * filetoBuff( const char * fname, unsigned long * size )
|
||||
{
|
||||
char * buffer = NULL;
|
||||
char * buffer = NULL;
|
||||
HB_FHANDLE handle = hb_fsOpen( fname, FO_READWRITE );
|
||||
|
||||
if( handle != FS_ERROR )
|
||||
@@ -565,7 +566,7 @@ static char * filetoBuff( const char * fname, unsigned long * size )
|
||||
*size = hb_fsSeek( handle, 0, FS_END );
|
||||
hb_fsSeek( handle, 0, FS_SET );
|
||||
buffer = ( char * ) hb_xgrab( *size + 1 );
|
||||
*size = ( unsigned long ) hb_fsReadLarge( handle, buffer, *size );
|
||||
*size = ( unsigned long ) hb_fsReadLarge( handle, buffer, *size );
|
||||
buffer[ *size ] = '\0';
|
||||
hb_fsClose( handle );
|
||||
}
|
||||
@@ -578,7 +579,7 @@ static char * filetoBuff( const char * fname, unsigned long * size )
|
||||
HB_FUNC( MYSQL_ESCAPE_STRING_FROM_FILE )
|
||||
{
|
||||
unsigned long nSize;
|
||||
char * from = filetoBuff( hb_parc( 1 ), &nSize );
|
||||
char * from = filetoBuff( hb_parc( 1 ), &nSize );
|
||||
|
||||
if( from )
|
||||
{
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
#endif
|
||||
#elif defined( HB_OS_WIN )
|
||||
#include <windows.h>
|
||||
#if !defined( INVALID_FILE_ATTRIBUTES )
|
||||
#define INVALID_FILE_ATTRIBUTES ( ( DWORD ) -1 )
|
||||
#if ! defined( INVALID_FILE_ATTRIBUTES )
|
||||
#define INVALID_FILE_ATTRIBUTES ( ( DWORD ) -1 )
|
||||
#endif
|
||||
#include "hbwinuni.h"
|
||||
#elif defined( HB_OS_OS2 )
|
||||
@@ -86,7 +86,7 @@
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#define HB_Z_IOBUF_SIZE ( 1024 * 16 )
|
||||
#define HB_Z_IOBUF_SIZE ( 1024 * 16 )
|
||||
|
||||
static HB_GARBAGE_FUNC( hb_zipfile_destructor )
|
||||
{
|
||||
@@ -184,9 +184,9 @@ HB_FUNC( HB_ZIPOPEN )
|
||||
if( szFileName )
|
||||
{
|
||||
zipcharpc pszGlobalComment = NULL;
|
||||
char * pszFree;
|
||||
zipFile hZip = zipOpen2( hb_fsNameConv( szFileName, &pszFree ), hb_parnidef( 2, APPEND_STATUS_CREATE ),
|
||||
&pszGlobalComment, NULL );
|
||||
char * pszFree;
|
||||
zipFile hZip = zipOpen2( hb_fsNameConv( szFileName, &pszFree ), hb_parnidef( 2, APPEND_STATUS_CREATE ),
|
||||
&pszGlobalComment, NULL );
|
||||
|
||||
if( pszFree )
|
||||
hb_xfree( pszFree );
|
||||
@@ -238,10 +238,10 @@ HB_FUNC( HB_ZIPFILECREATE )
|
||||
|
||||
if( hZip )
|
||||
{
|
||||
int iMethod = hb_parnidef( 7, Z_DEFLATED );
|
||||
int iLevel = hb_parnidef( 8, Z_DEFAULT_COMPRESSION );
|
||||
int iMethod = hb_parnidef( 7, Z_DEFLATED );
|
||||
int iLevel = hb_parnidef( 8, Z_DEFAULT_COMPRESSION );
|
||||
long lJulian, lMillisec;
|
||||
int iYear, iMonth, iDay, iHour, iMinute, iSecond, iMSec;
|
||||
int iYear, iMonth, iDay, iHour, iMinute, iSecond, iMSec;
|
||||
|
||||
zip_fileinfo zfi;
|
||||
|
||||
@@ -260,16 +260,16 @@ HB_FUNC( HB_ZIPFILECREATE )
|
||||
}
|
||||
|
||||
zfi.tmz_date.tm_hour = iHour;
|
||||
zfi.tmz_date.tm_min = iMinute;
|
||||
zfi.tmz_date.tm_sec = iSecond;
|
||||
zfi.tmz_date.tm_min = iMinute;
|
||||
zfi.tmz_date.tm_sec = iSecond;
|
||||
|
||||
zfi.tmz_date.tm_year = iYear;
|
||||
zfi.tmz_date.tm_mon = iMonth - 1;
|
||||
zfi.tmz_date.tm_mon = iMonth - 1;
|
||||
zfi.tmz_date.tm_mday = iDay;
|
||||
|
||||
zfi.internal_fa = hb_parnl( 5 );
|
||||
zfi.external_fa = hb_parnl( 6 );
|
||||
#if !defined( HB_OS_UNIX )
|
||||
#if ! defined( HB_OS_UNIX )
|
||||
if( ( zfi.external_fa & 0xFFFF0000 ) == 0 )
|
||||
zfi.external_fa = hb_translateExtAttr( szZipName, zfi.external_fa );
|
||||
#endif
|
||||
@@ -324,7 +324,7 @@ HB_FUNC( HB_UNZIPOPEN )
|
||||
|
||||
if( szFileName )
|
||||
{
|
||||
char * pszFree;
|
||||
char * pszFree;
|
||||
unzFile hUnzip = unzOpen( hb_fsNameConv( szFileName, &pszFree ) );
|
||||
|
||||
if( pszFree )
|
||||
@@ -350,7 +350,7 @@ HB_FUNC( HB_UNZIPCLOSE )
|
||||
|
||||
if( phUnzip && *phUnzip )
|
||||
{
|
||||
unzFile hUnzip = *phUnzip;
|
||||
unzFile hUnzip = *phUnzip;
|
||||
|
||||
*phUnzip = NULL;
|
||||
hb_retni( unzClose( hUnzip ) );
|
||||
@@ -363,7 +363,7 @@ HB_FUNC( HB_UNZIPCLOSE )
|
||||
/* HB_UnzipGlobalInfo( hUnzip, @nEntries, @cGlobalComment ) --> nError */
|
||||
HB_FUNC( HB_UNZIPGLOBALINFO )
|
||||
{
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
|
||||
if( hUnzip )
|
||||
{
|
||||
@@ -393,7 +393,7 @@ HB_FUNC( HB_UNZIPGLOBALINFO )
|
||||
else
|
||||
{
|
||||
pszComment[ iResult ] = '\0';
|
||||
if( !hb_storclen_buffer( pszComment, ugi.size_comment, 3 ) )
|
||||
if( ! hb_storclen_buffer( pszComment, ugi.size_comment, 3 ) )
|
||||
hb_xfree( pszComment );
|
||||
}
|
||||
}
|
||||
@@ -411,7 +411,7 @@ HB_FUNC( HB_UNZIPGLOBALINFO )
|
||||
/* HB_UnzipFileFirst( hUnzip ) --> nError */
|
||||
HB_FUNC( HB_UNZIPFILEFIRST )
|
||||
{
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
|
||||
if( hUnzip )
|
||||
hb_retni( unzGoToFirstFile( hUnzip ) );
|
||||
@@ -421,7 +421,7 @@ HB_FUNC( HB_UNZIPFILEFIRST )
|
||||
/* HB_UnzipFileNext( hUnzip ) --> nError */
|
||||
HB_FUNC( HB_UNZIPFILENEXT )
|
||||
{
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
|
||||
if( hUnzip )
|
||||
hb_retni( unzGoToNextFile( hUnzip ) );
|
||||
@@ -458,11 +458,11 @@ HB_FUNC( HB_UNZIPFILEINFO )
|
||||
|
||||
if( hUnzip )
|
||||
{
|
||||
char szFileName[ HB_PATH_MAX ];
|
||||
unz_file_info ufi;
|
||||
int iResult;
|
||||
char buf[ 16 ];
|
||||
long lJulian, lMillisec;
|
||||
char szFileName[ HB_PATH_MAX ];
|
||||
unz_file_info ufi;
|
||||
int iResult;
|
||||
char buf[ 16 ];
|
||||
long lJulian, lMillisec;
|
||||
|
||||
iResult = unzGetCurrentFileInfo( hUnzip, &ufi, szFileName, HB_PATH_MAX - 1,
|
||||
NULL, 0, NULL, 0 );
|
||||
@@ -473,8 +473,8 @@ HB_FUNC( HB_UNZIPFILEINFO )
|
||||
szFileName[ HB_PATH_MAX - 1 ] = '\0';
|
||||
hb_storc( szFileName, 2 );
|
||||
|
||||
lJulian = hb_dateEncode( ufi.tmu_date.tm_year, ufi.tmu_date.tm_mon + 1,
|
||||
ufi.tmu_date.tm_mday );
|
||||
lJulian = hb_dateEncode( ufi.tmu_date.tm_year, ufi.tmu_date.tm_mon + 1,
|
||||
ufi.tmu_date.tm_mday );
|
||||
lMillisec = hb_timeEncode( ufi.tmu_date.tm_hour, ufi.tmu_date.tm_min,
|
||||
ufi.tmu_date.tm_sec, 0 );
|
||||
|
||||
@@ -506,7 +506,7 @@ HB_FUNC( HB_UNZIPFILEINFO )
|
||||
hb_xfree( pszComment );
|
||||
hb_storc( NULL, 11 );
|
||||
}
|
||||
else if( !hb_storclen_buffer( pszComment, ufi.size_file_comment, 11 ) )
|
||||
else if( ! hb_storclen_buffer( pszComment, ufi.size_file_comment, 11 ) )
|
||||
hb_xfree( pszComment );
|
||||
}
|
||||
}
|
||||
@@ -530,7 +530,7 @@ HB_FUNC( HB_UNZIPFILEINFO )
|
||||
/* HB_UnzipFileOpen( hUnzip, [ cPassword ] ) --> nError */
|
||||
HB_FUNC( HB_UNZIPFILEOPEN )
|
||||
{
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
unzFile hUnzip = hb_unzipfileParam( 1 );
|
||||
|
||||
if( hUnzip )
|
||||
hb_retni( unzOpenCurrentFilePassword( hUnzip, hb_parc( 2 ) ) );
|
||||
@@ -540,9 +540,9 @@ HB_FUNC( HB_UNZIPFILEOPEN )
|
||||
/* HB_UnzipFileRead( hUnzip, @cBuf [, nLen ] ) --> nRead */
|
||||
HB_FUNC( HB_UNZIPFILEREAD )
|
||||
{
|
||||
PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING );
|
||||
char * buffer;
|
||||
HB_SIZE nSize;
|
||||
PHB_ITEM pBuffer = hb_param( 2, HB_IT_STRING );
|
||||
char * buffer;
|
||||
HB_SIZE nSize;
|
||||
|
||||
if( pBuffer && HB_ISBYREF( 2 ) &&
|
||||
hb_itemGetWriteCL( pBuffer, &buffer, &nSize ) )
|
||||
@@ -585,12 +585,12 @@ HB_FUNC( HB_UNZIPFILECLOSE )
|
||||
static HB_BOOL hb_zipGetFileInfoFromHandle( HB_FHANDLE hFile, HB_U32 * pulCRC, HB_BOOL * pfText )
|
||||
{
|
||||
HB_BOOL fText = pfText != NULL, fResult = HB_FALSE;
|
||||
HB_U32 ulCRC = 0;
|
||||
HB_U32 ulCRC = 0;
|
||||
|
||||
if( hFile != FS_ERROR )
|
||||
{
|
||||
unsigned char * pString = ( unsigned char * ) hb_xgrab( HB_Z_IOBUF_SIZE );
|
||||
HB_SIZE nRead, u;
|
||||
HB_SIZE nRead, u;
|
||||
|
||||
do
|
||||
{
|
||||
@@ -635,9 +635,9 @@ static HB_BOOL hb_zipGetFileInfoFromHandle( HB_FHANDLE hFile, HB_U32 * pulCRC, H
|
||||
static HB_BOOL hb_zipGetFileInfo( const char * szFileName, HB_U32 * pulCRC, HB_BOOL * pfText )
|
||||
{
|
||||
HB_FHANDLE hFile;
|
||||
HB_BOOL fResult;
|
||||
HB_BOOL fResult;
|
||||
|
||||
hFile = hb_fsOpen( szFileName, FO_READ );
|
||||
hFile = hb_fsOpen( szFileName, FO_READ );
|
||||
fResult = hb_zipGetFileInfoFromHandle( hFile, pulCRC, pfText );
|
||||
if( hFile != FS_ERROR )
|
||||
hb_fsClose( hFile );
|
||||
@@ -654,7 +654,7 @@ HB_FUNC( HB_ZIPFILECRC32 )
|
||||
if( szFileName )
|
||||
{
|
||||
HB_U32 ulCRC = 0;
|
||||
if( !hb_zipGetFileInfo( szFileName, &ulCRC, NULL ) )
|
||||
if( ! hb_zipGetFileInfo( szFileName, &ulCRC, NULL ) )
|
||||
ulCRC = 0;
|
||||
hb_retnint( ulCRC );
|
||||
}
|
||||
@@ -664,22 +664,22 @@ HB_FUNC( HB_ZIPFILECRC32 )
|
||||
|
||||
static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char * szName, const char * szPassword, const char * szComment )
|
||||
{
|
||||
char * szZipName, * pString;
|
||||
HB_FHANDLE hFile;
|
||||
HB_SIZE nLen;
|
||||
HB_FATTR ulExtAttr;
|
||||
zip_fileinfo zfi;
|
||||
int iResult;
|
||||
HB_BOOL fError;
|
||||
HB_BOOL fText;
|
||||
HB_U32 ulCRC;
|
||||
char * szZipName, * pString;
|
||||
HB_FHANDLE hFile;
|
||||
HB_SIZE nLen;
|
||||
HB_FATTR ulExtAttr;
|
||||
zip_fileinfo zfi;
|
||||
int iResult;
|
||||
HB_BOOL fError;
|
||||
HB_BOOL fText;
|
||||
HB_U32 ulCRC;
|
||||
|
||||
if( szName )
|
||||
{
|
||||
/* change path separators to '/' */
|
||||
szZipName = hb_strdup( szName );
|
||||
|
||||
nLen = strlen( szZipName );
|
||||
nLen = strlen( szZipName );
|
||||
pString = szZipName;
|
||||
while( nLen-- )
|
||||
{
|
||||
@@ -692,7 +692,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
/* get file name */
|
||||
szZipName = hb_strdup( szFileName );
|
||||
|
||||
nLen = strlen( szZipName );
|
||||
nLen = strlen( szZipName );
|
||||
pString = szZipName;
|
||||
|
||||
while( nLen-- )
|
||||
@@ -706,21 +706,21 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
}
|
||||
|
||||
memset( &zfi, 0, sizeof( zfi ) );
|
||||
fError = HB_FALSE;
|
||||
fError = HB_FALSE;
|
||||
ulExtAttr = 0;
|
||||
|
||||
#if defined( HB_OS_WIN )
|
||||
{
|
||||
LPTSTR lpFileNameFree;
|
||||
LPTSTR lpFileNameFree;
|
||||
LPCTSTR lpFileName = HB_FSNAMECONV( szFileName, &lpFileNameFree );
|
||||
DWORD attr = GetFileAttributes( lpFileName );
|
||||
DWORD attr = GetFileAttributes( lpFileName );
|
||||
|
||||
if( attr != INVALID_FILE_ATTRIBUTES )
|
||||
{
|
||||
ulExtAttr = hb_translateExtAttr( szFileName, attr &
|
||||
( FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN |
|
||||
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY |
|
||||
FILE_ATTRIBUTE_ARCHIVE ) );
|
||||
( FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_HIDDEN |
|
||||
FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_DIRECTORY |
|
||||
FILE_ATTRIBUTE_ARCHIVE ) );
|
||||
}
|
||||
else
|
||||
fError = HB_TRUE;
|
||||
@@ -732,7 +732,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
{
|
||||
struct stat statbuf;
|
||||
struct tm st;
|
||||
char * pszFree;
|
||||
char * pszFree;
|
||||
|
||||
if( stat( hb_fsNameConv( szFileName, &pszFree ), &statbuf ) == 0 )
|
||||
{
|
||||
@@ -763,11 +763,11 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
st = *localtime( &statbuf.st_mtime );
|
||||
# endif
|
||||
|
||||
zfi.tmz_date.tm_sec = st.tm_sec;
|
||||
zfi.tmz_date.tm_min = st.tm_min;
|
||||
zfi.tmz_date.tm_sec = st.tm_sec;
|
||||
zfi.tmz_date.tm_min = st.tm_min;
|
||||
zfi.tmz_date.tm_hour = st.tm_hour;
|
||||
zfi.tmz_date.tm_mday = st.tm_mday;
|
||||
zfi.tmz_date.tm_mon = st.tm_mon;
|
||||
zfi.tmz_date.tm_mon = st.tm_mon;
|
||||
zfi.tmz_date.tm_year = st.tm_year;
|
||||
}
|
||||
else
|
||||
@@ -779,7 +779,7 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
#elif defined( HB_OS_DOS )
|
||||
{
|
||||
# if defined( __DJGPP__ ) || defined( __RSX32__ ) || defined( __GNUC__ )
|
||||
int attr;
|
||||
int attr;
|
||||
char * pszFree;
|
||||
|
||||
attr = _chmod( hb_fsNameConv( szFileName, &pszFree ), 0, 0 );
|
||||
@@ -805,9 +805,9 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
#elif defined( HB_OS_OS2 )
|
||||
{
|
||||
FILESTATUS3 fs3;
|
||||
APIRET ulrc;
|
||||
HB_FATTR ulAttr;
|
||||
char * pszFree;
|
||||
APIRET ulrc;
|
||||
HB_FATTR ulAttr;
|
||||
char * pszFree;
|
||||
|
||||
ulrc = DosQueryPathInfo( ( PCSZ ) hb_fsNameConv( szFileName, &pszFree ), FIL_STANDARD, &fs3, sizeof( fs3 ) );
|
||||
|
||||
@@ -830,11 +830,11 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
|
||||
ulExtAttr = hb_translateExtAttr( szFileName, ulAttr );
|
||||
|
||||
zfi.tmz_date.tm_sec = fs3.ftimeLastWrite.twosecs * 2;
|
||||
zfi.tmz_date.tm_min = fs3.ftimeLastWrite.minutes;
|
||||
zfi.tmz_date.tm_sec = fs3.ftimeLastWrite.twosecs * 2;
|
||||
zfi.tmz_date.tm_min = fs3.ftimeLastWrite.minutes;
|
||||
zfi.tmz_date.tm_hour = fs3.ftimeLastWrite.hours;
|
||||
zfi.tmz_date.tm_mday = fs3.fdateLastWrite.day;
|
||||
zfi.tmz_date.tm_mon = fs3.fdateLastWrite.month;
|
||||
zfi.tmz_date.tm_mon = fs3.fdateLastWrite.month;
|
||||
zfi.tmz_date.tm_year = fs3.fdateLastWrite.year + 1980;
|
||||
}
|
||||
else
|
||||
@@ -844,12 +844,12 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
{
|
||||
HB_FATTR attr;
|
||||
|
||||
if( !hb_fsGetAttr( szFileName, &attr ) )
|
||||
if( ! hb_fsGetAttr( szFileName, &attr ) )
|
||||
ulExtAttr = 0x81B60020; /* FILE_ATTRIBUTE_ARCHIVE | rw-rw-rw- */
|
||||
else
|
||||
{
|
||||
ulExtAttr = attr & ( HB_FA_READONLY | HB_FA_HIDDEN | HB_FA_SYSTEM |
|
||||
HB_FA_DIRECTORY | HB_FA_ARCHIVE );
|
||||
HB_FA_DIRECTORY | HB_FA_ARCHIVE );
|
||||
|
||||
ulExtAttr = hb_translateExtAttr( szFileName, ulExtAttr );
|
||||
}
|
||||
@@ -887,18 +887,18 @@ static int hb_zipStoreFile( zipFile hZip, const char * szFileName, const char *
|
||||
{
|
||||
#if defined( HB_OS_WIN )
|
||||
{
|
||||
FILETIME ftutc, ft;
|
||||
SYSTEMTIME st;
|
||||
FILETIME ftutc, ft;
|
||||
SYSTEMTIME st;
|
||||
|
||||
if( GetFileTime( ( HANDLE ) hb_fsGetOsHandle( hFile ), NULL, NULL, &ftutc ) &&
|
||||
FileTimeToLocalFileTime( &ftutc, &ft ) &&
|
||||
FileTimeToSystemTime( &ft, &st ) )
|
||||
{
|
||||
zfi.tmz_date.tm_sec = st.wSecond;
|
||||
zfi.tmz_date.tm_min = st.wMinute;
|
||||
zfi.tmz_date.tm_sec = st.wSecond;
|
||||
zfi.tmz_date.tm_min = st.wMinute;
|
||||
zfi.tmz_date.tm_hour = st.wHour;
|
||||
zfi.tmz_date.tm_mday = st.wDay;
|
||||
zfi.tmz_date.tm_mon = st.wMonth - 1;
|
||||
zfi.tmz_date.tm_mon = st.wMonth - 1;
|
||||
zfi.tmz_date.tm_year = st.wYear;
|
||||
}
|
||||
}
|
||||
@@ -952,12 +952,12 @@ HB_FUNC( HB_ZIPSTOREFILE )
|
||||
|
||||
static int hb_zipStoreFileHandle( zipFile hZip, HB_FHANDLE hFile, const char * szName, const char * szPassword, const char * szComment )
|
||||
{
|
||||
char * szZipName;
|
||||
HB_SIZE nLen;
|
||||
zip_fileinfo zfi;
|
||||
int iResult;
|
||||
HB_BOOL fText;
|
||||
HB_U32 ulCRC;
|
||||
char * szZipName;
|
||||
HB_SIZE nLen;
|
||||
zip_fileinfo zfi;
|
||||
int iResult;
|
||||
HB_BOOL fText;
|
||||
HB_U32 ulCRC;
|
||||
|
||||
if( hFile == FS_ERROR || szName == NULL )
|
||||
return -200;
|
||||
@@ -974,12 +974,12 @@ static int hb_zipStoreFileHandle( zipFile hZip, HB_FHANDLE hFile, const char * s
|
||||
|
||||
memset( &zfi, 0, sizeof( zfi ) );
|
||||
|
||||
zfi.external_fa = 0x81B60020;
|
||||
zfi.tmz_date.tm_sec = 0;
|
||||
zfi.tmz_date.tm_min = 0;
|
||||
zfi.external_fa = 0x81B60020;
|
||||
zfi.tmz_date.tm_sec = 0;
|
||||
zfi.tmz_date.tm_min = 0;
|
||||
zfi.tmz_date.tm_hour = 0;
|
||||
zfi.tmz_date.tm_mday = 1;
|
||||
zfi.tmz_date.tm_mon = 0;
|
||||
zfi.tmz_date.tm_mon = 0;
|
||||
zfi.tmz_date.tm_year = 0;
|
||||
|
||||
ulCRC = 0;
|
||||
@@ -1030,12 +1030,12 @@ HB_FUNC( HB_ZIPSTOREFILEHANDLE )
|
||||
|
||||
static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName, const char * szPassword )
|
||||
{
|
||||
char szName[ HB_PATH_MAX ];
|
||||
HB_SIZE nPos, nLen;
|
||||
char cSep, * pString;
|
||||
unz_file_info ufi;
|
||||
int iResult;
|
||||
HB_FHANDLE hFile;
|
||||
char szName[ HB_PATH_MAX ];
|
||||
HB_SIZE nPos, nLen;
|
||||
char cSep, * pString;
|
||||
unz_file_info ufi;
|
||||
int iResult;
|
||||
HB_FHANDLE hFile;
|
||||
|
||||
iResult = unzGetCurrentFileInfo( hUnzip, &ufi, szName, HB_PATH_MAX - 1,
|
||||
NULL, 0, NULL, 0 );
|
||||
@@ -1090,15 +1090,15 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName,
|
||||
|
||||
#if defined( HB_OS_WIN )
|
||||
{
|
||||
FILETIME ftutc, ft;
|
||||
SYSTEMTIME st;
|
||||
FILETIME ftutc, ft;
|
||||
SYSTEMTIME st;
|
||||
|
||||
st.wSecond = ( WORD ) ufi.tmu_date.tm_sec;
|
||||
st.wMinute = ( WORD ) ufi.tmu_date.tm_min;
|
||||
st.wHour = ( WORD ) ufi.tmu_date.tm_hour;
|
||||
st.wDay = ( WORD ) ufi.tmu_date.tm_mday;
|
||||
st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1;
|
||||
st.wYear = ( WORD ) ufi.tmu_date.tm_year;
|
||||
st.wSecond = ( WORD ) ufi.tmu_date.tm_sec;
|
||||
st.wMinute = ( WORD ) ufi.tmu_date.tm_min;
|
||||
st.wHour = ( WORD ) ufi.tmu_date.tm_hour;
|
||||
st.wDay = ( WORD ) ufi.tmu_date.tm_mday;
|
||||
st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1;
|
||||
st.wYear = ( WORD ) ufi.tmu_date.tm_year;
|
||||
st.wMilliseconds = 0;
|
||||
|
||||
if( SystemTimeToFileTime( &st, &ft ) &&
|
||||
@@ -1118,7 +1118,7 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName,
|
||||
|
||||
#if defined( HB_OS_WIN )
|
||||
{
|
||||
LPTSTR lpFileNameFree;
|
||||
LPTSTR lpFileNameFree;
|
||||
LPCTSTR lpFileName = HB_FSNAMECONV( szName, &lpFileNameFree );
|
||||
|
||||
SetFileAttributes( ( LPCTSTR ) lpFileName, ufi.external_fa & 0xFF );
|
||||
@@ -1128,11 +1128,11 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName,
|
||||
}
|
||||
#elif defined( HB_OS_UNIX ) || defined( __DJGPP__ )
|
||||
{
|
||||
struct utimbuf utim;
|
||||
struct tm st;
|
||||
time_t tim;
|
||||
struct utimbuf utim;
|
||||
struct tm st;
|
||||
time_t tim;
|
||||
|
||||
char * pszFree;
|
||||
char * pszFree;
|
||||
const char * szNameOS = hb_fsNameConv( szName, &pszFree );
|
||||
|
||||
# if defined( __DJGPP__ )
|
||||
@@ -1143,23 +1143,24 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName,
|
||||
if( ( ulAttr & 0xFFFF0000 ) == 0 )
|
||||
ulAttr = hb_translateExtAttr( szName, ulAttr );
|
||||
|
||||
chmod( szNameOS, ( ( ulAttr & 0x00010000 ) ? S_IXOTH : 0 ) |
|
||||
( ( ulAttr & 0x00020000 ) ? S_IWOTH : 0 ) |
|
||||
( ( ulAttr & 0x00040000 ) ? S_IROTH : 0 ) |
|
||||
( ( ulAttr & 0x00080000 ) ? S_IXGRP : 0 ) |
|
||||
( ( ulAttr & 0x00100000 ) ? S_IWGRP : 0 ) |
|
||||
( ( ulAttr & 0x00200000 ) ? S_IRGRP : 0 ) |
|
||||
( ( ulAttr & 0x00400000 ) ? S_IXUSR : 0 ) |
|
||||
( ( ulAttr & 0x00800000 ) ? S_IWUSR : 0 ) |
|
||||
( ( ulAttr & 0x01000000 ) ? S_IRUSR : 0 ) );
|
||||
chmod( szNameOS,
|
||||
( ( ulAttr & 0x00010000 ) ? S_IXOTH : 0 ) |
|
||||
( ( ulAttr & 0x00020000 ) ? S_IWOTH : 0 ) |
|
||||
( ( ulAttr & 0x00040000 ) ? S_IROTH : 0 ) |
|
||||
( ( ulAttr & 0x00080000 ) ? S_IXGRP : 0 ) |
|
||||
( ( ulAttr & 0x00100000 ) ? S_IWGRP : 0 ) |
|
||||
( ( ulAttr & 0x00200000 ) ? S_IRGRP : 0 ) |
|
||||
( ( ulAttr & 0x00400000 ) ? S_IXUSR : 0 ) |
|
||||
( ( ulAttr & 0x00800000 ) ? S_IWUSR : 0 ) |
|
||||
( ( ulAttr & 0x01000000 ) ? S_IRUSR : 0 ) );
|
||||
# endif
|
||||
memset( &st, 0, sizeof( st ) );
|
||||
|
||||
st.tm_sec = ufi.tmu_date.tm_sec;
|
||||
st.tm_min = ufi.tmu_date.tm_min;
|
||||
st.tm_sec = ufi.tmu_date.tm_sec;
|
||||
st.tm_min = ufi.tmu_date.tm_min;
|
||||
st.tm_hour = ufi.tmu_date.tm_hour;
|
||||
st.tm_mday = ufi.tmu_date.tm_mday;
|
||||
st.tm_mon = ufi.tmu_date.tm_mon;
|
||||
st.tm_mon = ufi.tmu_date.tm_mon;
|
||||
st.tm_year = ufi.tmu_date.tm_year - 1900;
|
||||
|
||||
tim = mktime( &st );
|
||||
@@ -1192,11 +1193,11 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName,
|
||||
#elif defined( HB_OS_OS2 )
|
||||
{
|
||||
FILESTATUS3 fs3;
|
||||
APIRET ulrc;
|
||||
HB_FATTR ulAttr = FILE_NORMAL;
|
||||
int iAttr = ufi.external_fa & 0xFF;
|
||||
APIRET ulrc;
|
||||
HB_FATTR ulAttr = FILE_NORMAL;
|
||||
int iAttr = ufi.external_fa & 0xFF;
|
||||
|
||||
char * pszFree;
|
||||
char * pszFree;
|
||||
const char * szNameOS = hb_fsNameConv( szName, &pszFree );
|
||||
|
||||
if( iAttr & HB_FA_READONLY )
|
||||
@@ -1215,10 +1216,10 @@ static int hb_unzipExtractCurrentFile( unzFile hUnzip, const char * szFileName,
|
||||
FDATE fdate;
|
||||
FTIME ftime;
|
||||
|
||||
fdate.year = ufi.tmu_date.tm_year - 1980;
|
||||
fdate.month = ufi.tmu_date.tm_mon;
|
||||
fdate.day = ufi.tmu_date.tm_mday;
|
||||
ftime.hours = ufi.tmu_date.tm_hour;
|
||||
fdate.year = ufi.tmu_date.tm_year - 1980;
|
||||
fdate.month = ufi.tmu_date.tm_mon;
|
||||
fdate.day = ufi.tmu_date.tm_mday;
|
||||
ftime.hours = ufi.tmu_date.tm_hour;
|
||||
ftime.minutes = ufi.tmu_date.tm_min;
|
||||
ftime.twosecs = ufi.tmu_date.tm_sec / 2;
|
||||
|
||||
@@ -1256,8 +1257,8 @@ HB_FUNC( HB_UNZIPEXTRACTCURRENTFILE )
|
||||
|
||||
static int hb_unzipExtractCurrentFileToHandle( unzFile hUnzip, HB_FHANDLE hFile, const char * szPassword )
|
||||
{
|
||||
unz_file_info ufi;
|
||||
int iResult;
|
||||
unz_file_info ufi;
|
||||
int iResult;
|
||||
|
||||
if( hFile == FS_ERROR )
|
||||
return -200;
|
||||
@@ -1272,7 +1273,7 @@ static int hb_unzipExtractCurrentFileToHandle( unzFile hUnzip, HB_FHANDLE hFile,
|
||||
if( iResult != UNZ_OK )
|
||||
return iResult;
|
||||
|
||||
if( !( ufi.external_fa & 0x40000000 ) ) /* DIRECTORY */
|
||||
if( ! ( ufi.external_fa & 0x40000000 ) ) /* DIRECTORY */
|
||||
{
|
||||
if( hFile != FS_ERROR )
|
||||
{
|
||||
@@ -1285,15 +1286,15 @@ static int hb_unzipExtractCurrentFileToHandle( unzFile hUnzip, HB_FHANDLE hFile,
|
||||
|
||||
#if defined( HB_OS_WIN )
|
||||
{
|
||||
FILETIME ftutc, ft;
|
||||
SYSTEMTIME st;
|
||||
FILETIME ftutc, ft;
|
||||
SYSTEMTIME st;
|
||||
|
||||
st.wSecond = ( WORD ) ufi.tmu_date.tm_sec;
|
||||
st.wMinute = ( WORD ) ufi.tmu_date.tm_min;
|
||||
st.wHour = ( WORD ) ufi.tmu_date.tm_hour;
|
||||
st.wDay = ( WORD ) ufi.tmu_date.tm_mday;
|
||||
st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1;
|
||||
st.wYear = ( WORD ) ufi.tmu_date.tm_year;
|
||||
st.wSecond = ( WORD ) ufi.tmu_date.tm_sec;
|
||||
st.wMinute = ( WORD ) ufi.tmu_date.tm_min;
|
||||
st.wHour = ( WORD ) ufi.tmu_date.tm_hour;
|
||||
st.wDay = ( WORD ) ufi.tmu_date.tm_mday;
|
||||
st.wMonth = ( WORD ) ufi.tmu_date.tm_mon + 1;
|
||||
st.wYear = ( WORD ) ufi.tmu_date.tm_year;
|
||||
st.wMilliseconds = 0;
|
||||
|
||||
if( SystemTimeToFileTime( &st, &ft ) &&
|
||||
@@ -1325,25 +1326,25 @@ HB_FUNC( HB_UNZIPEXTRACTCURRENTFILETOHANDLE )
|
||||
|
||||
static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask )
|
||||
{
|
||||
char szTempFile[ HB_PATH_MAX ];
|
||||
char szCurrFile[ HB_PATH_MAX ];
|
||||
PHB_FNAME pFileName;
|
||||
HB_FHANDLE hFile;
|
||||
unzFile hUnzip;
|
||||
zipFile hZip;
|
||||
char szTempFile[ HB_PATH_MAX ];
|
||||
char szCurrFile[ HB_PATH_MAX ];
|
||||
PHB_FNAME pFileName;
|
||||
HB_FHANDLE hFile;
|
||||
unzFile hUnzip;
|
||||
zipFile hZip;
|
||||
unz_global_info ugi;
|
||||
unz_file_info ufi;
|
||||
zip_fileinfo zfi;
|
||||
char * pszGlobalComment = NULL;
|
||||
char * pszFileComment = NULL;
|
||||
void * pExtraField = NULL;
|
||||
void * pLocalExtraField = NULL;
|
||||
int iFilesLeft = 0;
|
||||
int iFilesDel = 0;
|
||||
int iExtraFieldLen;
|
||||
int method;
|
||||
int level;
|
||||
int iResult;
|
||||
unz_file_info ufi;
|
||||
zip_fileinfo zfi;
|
||||
char * pszGlobalComment = NULL;
|
||||
char * pszFileComment = NULL;
|
||||
void * pExtraField = NULL;
|
||||
void * pLocalExtraField = NULL;
|
||||
int iFilesLeft = 0;
|
||||
int iFilesDel = 0;
|
||||
int iExtraFieldLen;
|
||||
int method;
|
||||
int level;
|
||||
int iResult;
|
||||
char * pszFree;
|
||||
|
||||
/* open source file */
|
||||
@@ -1356,8 +1357,8 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask )
|
||||
return UNZ_ERRNO;
|
||||
|
||||
pFileName = hb_fsFNameSplit( szZipFile );
|
||||
hFile = hb_fsCreateTemp( pFileName->szPath, NULL, FC_NORMAL, szTempFile );
|
||||
hZip = NULL;
|
||||
hFile = hb_fsCreateTemp( pFileName->szPath, NULL, FC_NORMAL, szTempFile );
|
||||
hZip = NULL;
|
||||
if( hFile != FS_ERROR )
|
||||
{
|
||||
hb_fsClose( hFile );
|
||||
@@ -1378,7 +1379,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask )
|
||||
{
|
||||
pszGlobalComment = ( char * ) hb_xgrab( ugi.size_comment + 1 );
|
||||
if( ( uLong ) unzGetGlobalComment( hUnzip, pszGlobalComment,
|
||||
ugi.size_comment ) != ugi.size_comment )
|
||||
ugi.size_comment ) != ugi.size_comment )
|
||||
iResult = UNZ_ERRNO;
|
||||
pszGlobalComment[ ugi.size_comment ] = '\0';
|
||||
}
|
||||
@@ -1431,7 +1432,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask )
|
||||
|
||||
memset( &zfi, 0, sizeof( zfi ) );
|
||||
memcpy( &zfi.tmz_date, &ufi.tmu_date, sizeof( tm_unz ) );
|
||||
zfi.dosDate = ufi.dosDate;
|
||||
zfi.dosDate = ufi.dosDate;
|
||||
zfi.internal_fa = ufi.internal_fa;
|
||||
zfi.external_fa = ufi.external_fa;
|
||||
|
||||
@@ -1442,7 +1443,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask )
|
||||
if( ufi.compressed_size )
|
||||
{
|
||||
void * buffer = hb_xgrab( HB_Z_IOBUF_SIZE );
|
||||
uLong ulLeft = ufi.compressed_size;
|
||||
uLong ulLeft = ufi.compressed_size;
|
||||
|
||||
while( ulLeft > 0 )
|
||||
{
|
||||
@@ -1521,7 +1522,7 @@ static int hb_zipDeleteFile( const char * szZipFile, const char * szFileMask )
|
||||
|
||||
if( iFilesLeft == 0 )
|
||||
hb_fsDelete( szTempFile );
|
||||
else if( !hb_fsRename( szTempFile, szZipFile ) )
|
||||
else if( ! hb_fsRename( szTempFile, szZipFile ) )
|
||||
iResult = UNZ_ERRNO;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,15 +63,15 @@
|
||||
|
||||
/* TOFIX: verify the exact SQLITE3 version */
|
||||
#if SQLITE_VERSION_NUMBER <= 3004001
|
||||
#define sqlite3_int64 HB_LONGLONG
|
||||
#define sqlite3_uint64 HB_ULONGLONG
|
||||
#define sqlite3_int64 HB_LONGLONG
|
||||
#define sqlite3_uint64 HB_ULONGLONG
|
||||
#endif
|
||||
|
||||
#define HB_SQLITE3_DB 6000001
|
||||
#define HB_SQLITE3_DB 6000001
|
||||
|
||||
#define HB_ERR_MEMSTRU_NOT_MEM_BLOCK 4001
|
||||
#define HB_ERR_MEMSTRU_WRONG_MEMSTRU_BLOCK 4002
|
||||
#define HB_ERR_MEMSTRU_DESTROYED 4003
|
||||
#define HB_ERR_MEMSTRU_NOT_MEM_BLOCK 4001
|
||||
#define HB_ERR_MEMSTRU_WRONG_MEMSTRU_BLOCK 4002
|
||||
#define HB_ERR_MEMSTRU_DESTROYED 4003
|
||||
|
||||
#ifdef SQLITE3_DYNLIB
|
||||
extern char * sqlite3_temp_directory;
|
||||
@@ -93,12 +93,12 @@ static void func( sqlite3_context *, int, sqlite3_value ** );
|
||||
typedef struct
|
||||
{
|
||||
sqlite3 * db;
|
||||
PHB_ITEM cbAuthorizer;
|
||||
PHB_ITEM cbBusyHandler;
|
||||
PHB_ITEM cbProgressHandler;
|
||||
PHB_ITEM cbHookCommit;
|
||||
PHB_ITEM cbHookRollback;
|
||||
PHB_ITEM cbFunc;
|
||||
PHB_ITEM cbAuthorizer;
|
||||
PHB_ITEM cbBusyHandler;
|
||||
PHB_ITEM cbProgressHandler;
|
||||
PHB_ITEM cbHookCommit;
|
||||
PHB_ITEM cbHookRollback;
|
||||
PHB_ITEM cbFunc;
|
||||
} HB_SQLITE3, * PHB_SQLITE3;
|
||||
|
||||
typedef struct
|
||||
@@ -214,16 +214,16 @@ static PHB_ITEM hb_sqlite3_itemPut( PHB_ITEM pItem, void * pMemAddr, int iType )
|
||||
pStructHolder = ( PHB_SQLITE3_HOLDER ) hb_gcAllocate( sizeof( HB_SQLITE3_HOLDER ),
|
||||
&s_gcSqlite3Funcs );
|
||||
pStructHolder->hbsqlite3 = ( HB_SQLITE3 * ) pMemAddr;
|
||||
pStructHolder->type = iType;
|
||||
pStructHolder->type = iType;
|
||||
|
||||
return hb_itemPutPtrGC( pItem, pStructHolder );
|
||||
}
|
||||
|
||||
static void * hb_sqlite3_itemGet( PHB_ITEM pItem, int iType, HB_BOOL fError )
|
||||
{
|
||||
PHB_SQLITE3_HOLDER pStructHolder = ( PHB_SQLITE3_HOLDER ) hb_itemGetPtrGC( pItem,
|
||||
&s_gcSqlite3Funcs );
|
||||
int iError = 0;
|
||||
PHB_SQLITE3_HOLDER pStructHolder = ( PHB_SQLITE3_HOLDER ) hb_itemGetPtrGC( pItem,
|
||||
&s_gcSqlite3Funcs );
|
||||
int iError = 0;
|
||||
|
||||
HB_SYMBOL_UNUSED( iError );
|
||||
|
||||
@@ -266,7 +266,7 @@ static int callback( void * Cargo, int argc, char ** argv, char ** azColName )
|
||||
|
||||
if( pCallback && hb_vmRequestReenter() )
|
||||
{
|
||||
PHB_ITEM pArrayValue = hb_itemArrayNew( argc );
|
||||
PHB_ITEM pArrayValue = hb_itemArrayNew( argc );
|
||||
PHB_ITEM pArrayColName = hb_itemArrayNew( argc );
|
||||
int iRes, i;
|
||||
|
||||
@@ -434,35 +434,35 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv )
|
||||
{
|
||||
switch( sqlite3_value_type( argv[ i ] ) )
|
||||
{
|
||||
case SQLITE_NULL:
|
||||
hb_vmPushNil();
|
||||
break;
|
||||
case SQLITE_NULL:
|
||||
hb_vmPushNil();
|
||||
break;
|
||||
|
||||
case SQLITE_TEXT:
|
||||
hb_itemPutStrUTF8( hb_stackAllocItem(),
|
||||
( const char * ) sqlite3_value_text( argv[ i ] ) );
|
||||
break;
|
||||
case SQLITE_TEXT:
|
||||
hb_itemPutStrUTF8( hb_stackAllocItem(),
|
||||
( const char * ) sqlite3_value_text( argv[ i ] ) );
|
||||
break;
|
||||
|
||||
case SQLITE_FLOAT:
|
||||
hb_vmPushDouble( sqlite3_value_double( argv[ i ] ), HB_DEFAULT_DECIMALS );
|
||||
break;
|
||||
case SQLITE_FLOAT:
|
||||
hb_vmPushDouble( sqlite3_value_double( argv[ i ] ), HB_DEFAULT_DECIMALS );
|
||||
break;
|
||||
|
||||
case SQLITE_INTEGER:
|
||||
case SQLITE_INTEGER:
|
||||
#if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF )
|
||||
hb_vmPushInteger( sqlite3_value_int( argv[ i ] ) );
|
||||
hb_vmPushInteger( sqlite3_value_int( argv[ i ] ) );
|
||||
#else
|
||||
hb_vmPushNumInt( sqlite3_value_int64( argv[ i ] ) );
|
||||
hb_vmPushNumInt( sqlite3_value_int64( argv[ i ] ) );
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
|
||||
case SQLITE_BLOB:
|
||||
hb_vmPushString( ( const char * ) sqlite3_value_blob( argv[ i ] ),
|
||||
sqlite3_value_bytes( argv[ i ] ) );
|
||||
break;
|
||||
case SQLITE_BLOB:
|
||||
hb_vmPushString( ( const char * ) sqlite3_value_blob( argv[ i ] ),
|
||||
sqlite3_value_bytes( argv[ i ] ) );
|
||||
break;
|
||||
|
||||
default:
|
||||
hb_itemPutCConst( hb_stackAllocItem(), ":default:" );
|
||||
break;
|
||||
default:
|
||||
hb_itemPutCConst( hb_stackAllocItem(), ":default:" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -472,38 +472,38 @@ static void func( sqlite3_context * ctx, int argc, sqlite3_value ** argv )
|
||||
|
||||
switch( hb_itemType( pResult ) )
|
||||
{
|
||||
case HB_IT_NIL:
|
||||
sqlite3_result_null( ctx );
|
||||
break;
|
||||
case HB_IT_NIL:
|
||||
sqlite3_result_null( ctx );
|
||||
break;
|
||||
|
||||
case HB_IT_INTEGER:
|
||||
case HB_IT_LONG:
|
||||
case HB_IT_INTEGER:
|
||||
case HB_IT_LONG:
|
||||
#if HB_VMLONG_MAX == INT32_MAX || defined( HB_LONG_LONG_OFF )
|
||||
sqlite3_result_int( ctx, hb_itemGetNI( pResult ) );
|
||||
sqlite3_result_int( ctx, hb_itemGetNI( pResult ) );
|
||||
#else
|
||||
sqlite3_result_int64( ctx, hb_itemGetNInt( pResult ) );
|
||||
sqlite3_result_int64( ctx, hb_itemGetNInt( pResult ) );
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
|
||||
case HB_IT_DOUBLE:
|
||||
sqlite3_result_double( ctx, hb_itemGetND( pResult ) );
|
||||
break;
|
||||
case HB_IT_DOUBLE:
|
||||
sqlite3_result_double( ctx, hb_itemGetND( pResult ) );
|
||||
break;
|
||||
|
||||
case HB_IT_STRING:
|
||||
{
|
||||
void * hText;
|
||||
HB_SIZE nText;
|
||||
const char * pszText = hb_itemGetStrUTF8( pResult, &hText, &nText );
|
||||
case HB_IT_STRING:
|
||||
{
|
||||
void * hText;
|
||||
HB_SIZE nText;
|
||||
const char * pszText = hb_itemGetStrUTF8( pResult, &hText, &nText );
|
||||
|
||||
sqlite3_result_text( ctx, pszText, ( int ) nText, SQLITE_TRANSIENT );
|
||||
sqlite3_result_text( ctx, pszText, ( int ) nText, SQLITE_TRANSIENT );
|
||||
|
||||
hb_strfree( hText );
|
||||
break;
|
||||
}
|
||||
hb_strfree( hText );
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
sqlite3_result_error_code( ctx, -1 );
|
||||
break;
|
||||
default:
|
||||
sqlite3_result_error_code( ctx, -1 );
|
||||
break;
|
||||
}
|
||||
|
||||
hb_vmRequestRestore();
|
||||
@@ -663,8 +663,8 @@ HB_FUNC( SQLITE3_TEMP_DIRECTORY )
|
||||
|
||||
#ifdef SQLITE3_DYNLIB
|
||||
{
|
||||
char * pszFree;
|
||||
const char * pszDirName = hb_fsNameConv( hb_parcx( 1 ), &pszFree );
|
||||
char * pszFree;
|
||||
const char * pszDirName = hb_fsNameConv( hb_parcx( 1 ), &pszFree );
|
||||
|
||||
if( hb_fsIsDirectory( pszDirName ) )
|
||||
{
|
||||
@@ -709,9 +709,9 @@ HB_FUNC( SQLITE3_TEMP_DIRECTORY )
|
||||
|
||||
HB_FUNC( SQLITE3_OPEN )
|
||||
{
|
||||
sqlite3 * db;
|
||||
char * pszFree;
|
||||
const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree );
|
||||
sqlite3 * db;
|
||||
char * pszFree;
|
||||
const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree );
|
||||
|
||||
if( hb_fsFileExists( pszdbName ) || hb_parl( 2 ) )
|
||||
{
|
||||
@@ -745,9 +745,9 @@ HB_FUNC( SQLITE3_OPEN )
|
||||
HB_FUNC( SQLITE3_OPEN_V2 )
|
||||
{
|
||||
#if SQLITE_VERSION_NUMBER >= 3005000
|
||||
sqlite3 * db;
|
||||
char * pszFree;
|
||||
const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree );
|
||||
sqlite3 * db;
|
||||
char * pszFree;
|
||||
const char * pszdbName = hb_fsNameConv( hb_parcx( 1 ), &pszFree );
|
||||
|
||||
if( sqlite3_open_v2( pszdbName, &db, hb_parni( 2 ), NULL ) == SQLITE_OK )
|
||||
{
|
||||
@@ -784,9 +784,9 @@ HB_FUNC( SQLITE3_EXEC )
|
||||
|
||||
if( pHbSqlite3 && pHbSqlite3->db )
|
||||
{
|
||||
void * hSQLText;
|
||||
char * pszErrMsg = NULL;
|
||||
int rc;
|
||||
void * hSQLText;
|
||||
char * pszErrMsg = NULL;
|
||||
int rc;
|
||||
|
||||
if( HB_ISBLOCK( 3 ) || HB_ISSYMBOL( 3 ) )
|
||||
{
|
||||
@@ -833,10 +833,10 @@ HB_FUNC( SQLITE3_PREPARE )
|
||||
|
||||
if( SQL )
|
||||
{
|
||||
const char * pSQL = hb_itemGetCPtr( SQL );
|
||||
int ulLen = ( int ) hb_itemGetCLen( SQL );
|
||||
psqlite3_stmt pStmt;
|
||||
const char * pszTail;
|
||||
const char * pSQL = hb_itemGetCPtr( SQL );
|
||||
int ulLen = ( int ) hb_itemGetCLen( SQL );
|
||||
psqlite3_stmt pStmt;
|
||||
const char * pszTail;
|
||||
|
||||
if( sqlite3_prepare_v2( pHbSqlite3->db, pSQL, ulLen, &pStmt, &pszTail ) == SQLITE_OK )
|
||||
{
|
||||
@@ -939,19 +939,19 @@ HB_FUNC( SQLITE3_STMT_READONLY )
|
||||
sqlite3_db_handle( pStmt ) -> pHbSqlite3
|
||||
*/
|
||||
|
||||
/*
|
||||
#if 0
|
||||
HB_FUNC( SQLITE3_DB_HANDLE )
|
||||
{
|
||||
psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );
|
||||
psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );
|
||||
|
||||
if( pStmt )
|
||||
{
|
||||
;
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError(1) );
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 0, NULL, HB_ERR_FUNCNAME, 1, hb_paramError( 1 ) );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
|
||||
/**
|
||||
Evaluate An Prepared SQL Statement
|
||||
@@ -1076,8 +1076,8 @@ HB_FUNC( SQLITE3_BIND_INT )
|
||||
|
||||
HB_FUNC( SQLITE3_BIND_INT64 )
|
||||
{
|
||||
psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );
|
||||
sqlite3_int64 int64 = hb_parnint( 3 );
|
||||
psqlite3_stmt pStmt = ( psqlite3_stmt ) hb_parptr( 1 );
|
||||
sqlite3_int64 int64 = hb_parnint( 3 );
|
||||
|
||||
if( pStmt )
|
||||
hb_retni( sqlite3_bind_int64( pStmt, hb_parni( 2 ), int64 ) );
|
||||
@@ -1101,10 +1101,10 @@ HB_FUNC( SQLITE3_BIND_TEXT )
|
||||
|
||||
if( pStmt )
|
||||
{
|
||||
void * hSQLText;
|
||||
HB_SIZE nSQLText;
|
||||
void * hSQLText;
|
||||
HB_SIZE nSQLText;
|
||||
|
||||
const char * pszSQLText = hb_parstr_utf8( 3, &hSQLText, &nSQLText );
|
||||
const char * pszSQLText = hb_parstr_utf8( 3, &hSQLText, &nSQLText );
|
||||
|
||||
hb_retni( sqlite3_bind_text( pStmt, hb_parni( 2 ), pszSQLText, ( int ) nSQLText,
|
||||
SQLITE_TRANSIENT ) );
|
||||
@@ -1484,15 +1484,15 @@ HB_FUNC( SQLITE3_TABLE_COLUMN_METADATA )
|
||||
|
||||
if( pHbSqlite3 && pHbSqlite3->db )
|
||||
{
|
||||
char const * pzDataType = NULL;
|
||||
char const * pzCollSeq = NULL;
|
||||
int iNotNull = 0;
|
||||
int iPrimaryKey = 0;
|
||||
int iAutoinc = 0;
|
||||
char const * pzDataType = NULL;
|
||||
char const * pzCollSeq = NULL;
|
||||
int iNotNull = 0;
|
||||
int iPrimaryKey = 0;
|
||||
int iAutoinc = 0;
|
||||
|
||||
void * hDbName;
|
||||
void * hTableName;
|
||||
void * hColumnName;
|
||||
void * hDbName;
|
||||
void * hTableName;
|
||||
void * hColumnName;
|
||||
|
||||
if
|
||||
(
|
||||
@@ -1603,9 +1603,9 @@ HB_FUNC( SQLITE3_BLOB_OPEN )
|
||||
{
|
||||
sqlite3_blob * ppBlob = NULL;
|
||||
|
||||
void * hDbName;
|
||||
void * hTableName;
|
||||
void * hColumnName;
|
||||
void * hDbName;
|
||||
void * hTableName;
|
||||
void * hColumnName;
|
||||
|
||||
if
|
||||
(
|
||||
@@ -1690,8 +1690,8 @@ HB_FUNC( SQLITE3_BLOB_READ )
|
||||
|
||||
if( pBlob )
|
||||
{
|
||||
int iLen = hb_parni( 2 );
|
||||
char * buffer;
|
||||
int iLen = hb_parni( 2 );
|
||||
char * buffer;
|
||||
|
||||
if( iLen == 0 )
|
||||
iLen = sqlite3_blob_bytes( pBlob );
|
||||
@@ -1827,13 +1827,13 @@ HB_FUNC( SQLITE3_FILE_TO_BUFF )
|
||||
|
||||
if( handle != FS_ERROR )
|
||||
{
|
||||
char * buffer;
|
||||
HB_SIZE nSize;
|
||||
char * buffer;
|
||||
HB_SIZE nSize;
|
||||
|
||||
nSize = hb_fsSeek( handle, 0, FS_END );
|
||||
hb_fsSeek( handle, 0, FS_SET );
|
||||
buffer = ( char * ) hb_xgrab( nSize + 1 );
|
||||
nSize = hb_fsReadLarge( handle, buffer, nSize );
|
||||
nSize = hb_fsReadLarge( handle, buffer, nSize );
|
||||
buffer[ nSize ] = '\0';
|
||||
hb_fsClose( handle );
|
||||
|
||||
@@ -1845,8 +1845,8 @@ HB_FUNC( SQLITE3_FILE_TO_BUFF )
|
||||
|
||||
HB_FUNC( SQLITE3_BUFF_TO_FILE )
|
||||
{
|
||||
HB_FHANDLE handle = hb_fsCreate( hb_parcx( 1 ), FC_NORMAL );
|
||||
HB_SIZE nSize = hb_parcsiz( 2 ) - 1;
|
||||
HB_FHANDLE handle = hb_fsCreate( hb_parcx( 1 ), FC_NORMAL );
|
||||
HB_SIZE nSize = hb_parcsiz( 2 ) - 1;
|
||||
|
||||
if( handle != FS_ERROR && nSize > 0 )
|
||||
{
|
||||
@@ -2040,10 +2040,10 @@ HB_FUNC( SQLITE3_SET_AUTHORIZER )
|
||||
HB_FUNC( SQLITE3_BACKUP_INIT )
|
||||
{
|
||||
#if SQLITE_VERSION_NUMBER >= 3006011
|
||||
HB_SQLITE3 * pHbSqlite3Dest = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE );
|
||||
HB_SQLITE3 * pHbSqlite3Source = ( HB_SQLITE3 * ) hb_sqlite3_param( 3, HB_SQLITE3_DB,
|
||||
HB_TRUE );
|
||||
sqlite3_backup * pBackup;
|
||||
HB_SQLITE3 * pHbSqlite3Dest = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE );
|
||||
HB_SQLITE3 * pHbSqlite3Source = ( HB_SQLITE3 * ) hb_sqlite3_param( 3, HB_SQLITE3_DB,
|
||||
HB_TRUE );
|
||||
sqlite3_backup * pBackup;
|
||||
|
||||
if( pHbSqlite3Dest && pHbSqlite3Dest->db && pHbSqlite3Source && pHbSqlite3Source->db &&
|
||||
HB_ISCHAR( 2 ) && HB_ISCHAR( 4 ) )
|
||||
@@ -2052,13 +2052,13 @@ HB_FUNC( SQLITE3_BACKUP_INIT )
|
||||
2 ), pHbSqlite3Source->db, hb_parcx( 4 ) );
|
||||
|
||||
if( pBackup )
|
||||
hb_retptr( pBackup ); /* TOFIX: Create GC collected pointer */
|
||||
hb_retptr( pBackup ); /* TOFIX: Create GC collected pointer */
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
else
|
||||
#endif /* SQLITE_VERSION_NUMBER >= 3006011 */
|
||||
hb_retptr( NULL );
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HB_FUNC( SQLITE3_BACKUP_STEP )
|
||||
@@ -2071,7 +2071,7 @@ HB_FUNC( SQLITE3_BACKUP_STEP )
|
||||
hb_retni( sqlite3_backup_step( pBackup, hb_parni( 2 ) ) );
|
||||
else
|
||||
#endif /* SQLITE_VERSION_NUMBER >= 3006011 */
|
||||
hb_retni( -1 );
|
||||
hb_retni( -1 );
|
||||
}
|
||||
|
||||
HB_FUNC( SQLITE3_BACKUP_FINISH )
|
||||
@@ -2084,7 +2084,7 @@ HB_FUNC( SQLITE3_BACKUP_FINISH )
|
||||
hb_retni( sqlite3_backup_finish( pBackup ) );
|
||||
else
|
||||
#endif /* SQLITE_VERSION_NUMBER >= 3006011 */
|
||||
hb_retni( -1 );
|
||||
hb_retni( -1 );
|
||||
}
|
||||
|
||||
HB_FUNC( SQLITE3_BACKUP_REMAINING )
|
||||
@@ -2097,7 +2097,7 @@ HB_FUNC( SQLITE3_BACKUP_REMAINING )
|
||||
hb_retni( sqlite3_backup_remaining( pBackup ) );
|
||||
else
|
||||
#endif /* SQLITE_VERSION_NUMBER >= 3006011 */
|
||||
hb_retni( -1 );
|
||||
hb_retni( -1 );
|
||||
}
|
||||
|
||||
HB_FUNC( SQLITE3_BACKUP_PAGECOUNT )
|
||||
@@ -2110,7 +2110,7 @@ HB_FUNC( SQLITE3_BACKUP_PAGECOUNT )
|
||||
hb_retni( sqlite3_backup_pagecount( pBackup ) );
|
||||
else
|
||||
#endif /* SQLITE_VERSION_NUMBER >= 3006011 */
|
||||
hb_retni( -1 );
|
||||
hb_retni( -1 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2188,8 +2188,8 @@ HB_FUNC( SQLITE3_STATUS )
|
||||
HB_FUNC( SQLITE3_DB_STATUS )
|
||||
{
|
||||
#if SQLITE_VERSION_NUMBER >= 3006001
|
||||
int iCurrent, iHighwater;
|
||||
HB_SQLITE3 * pHbSqlite3 = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE );
|
||||
int iCurrent, iHighwater;
|
||||
HB_SQLITE3 * pHbSqlite3 = ( HB_SQLITE3 * ) hb_sqlite3_param( 1, HB_SQLITE3_DB, HB_TRUE );
|
||||
|
||||
if( pHbSqlite3 && pHbSqlite3->db && ( hb_pcount() > 4 ) &&
|
||||
( HB_ISNUM( 3 ) && HB_ISBYREF( 3 ) ) && ( HB_ISNUM( 4 ) && HB_ISBYREF( 4 ) ) )
|
||||
|
||||
@@ -116,7 +116,7 @@ HB_FUNC( ERR_REASON_ERROR_STRING )
|
||||
HB_FUNC( ERR_GET_ERROR_LINE )
|
||||
{
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
int line = 0;
|
||||
|
||||
hb_retnint( ERR_get_error_line( &file, &line ) );
|
||||
|
||||
@@ -127,7 +127,7 @@ HB_FUNC( ERR_GET_ERROR_LINE )
|
||||
HB_FUNC( ERR_PEEK_ERROR_LINE )
|
||||
{
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
int line = 0;
|
||||
|
||||
hb_retnint( ERR_peek_error_line( &file, &line ) );
|
||||
|
||||
@@ -138,7 +138,7 @@ HB_FUNC( ERR_PEEK_ERROR_LINE )
|
||||
HB_FUNC( ERR_PEEK_LAST_ERROR_LINE )
|
||||
{
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
int line = 0;
|
||||
|
||||
hb_retnint( ERR_peek_last_error_line( &file, &line ) );
|
||||
|
||||
@@ -148,10 +148,10 @@ HB_FUNC( ERR_PEEK_LAST_ERROR_LINE )
|
||||
|
||||
HB_FUNC( ERR_GET_ERROR_LINE_DATA )
|
||||
{
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
const char * data = NULL;
|
||||
int flags = 0;
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
const char * data = NULL;
|
||||
int flags = 0;
|
||||
|
||||
hb_retnint( ERR_get_error_line_data( &file, &line, &data, &flags ) );
|
||||
|
||||
@@ -163,10 +163,10 @@ HB_FUNC( ERR_GET_ERROR_LINE_DATA )
|
||||
|
||||
HB_FUNC( ERR_PEEK_ERROR_LINE_DATA )
|
||||
{
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
const char * data = NULL;
|
||||
int flags = 0;
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
const char * data = NULL;
|
||||
int flags = 0;
|
||||
|
||||
hb_retnint( ERR_peek_error_line_data( &file, &line, &data, &flags ) );
|
||||
|
||||
@@ -178,10 +178,10 @@ HB_FUNC( ERR_PEEK_ERROR_LINE_DATA )
|
||||
|
||||
HB_FUNC( ERR_PEEK_LAST_ERROR_LINE_DATA )
|
||||
{
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
const char * data = NULL;
|
||||
int flags = 0;
|
||||
const char * file = NULL;
|
||||
int line = 0;
|
||||
const char * data = NULL;
|
||||
int flags = 0;
|
||||
|
||||
hb_retnint( ERR_peek_last_error_line_data( &file, &line, &data, &flags ) );
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ HB_FUNC( EVP_PKEY_FREE )
|
||||
HB_FUNC( EVP_BYTESTOKEY )
|
||||
{
|
||||
const EVP_CIPHER * cipher = hb_EVP_CIPHER_par( 1 );
|
||||
const EVP_MD * md = hb_EVP_MD_par( 2 );
|
||||
const EVP_MD * md = hb_EVP_MD_par( 2 );
|
||||
|
||||
if( cipher && md && ( ! HB_ISCHAR( 3 ) || hb_parclen( 3 ) == 8 ) )
|
||||
{
|
||||
|
||||
@@ -63,13 +63,13 @@ static HB_GARBAGE_FUNC( EVP_ENCODE_CTX_release )
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
hb_xfree( * ph );
|
||||
hb_xfree( *ph );
|
||||
|
||||
/* set pointer to NULL just in case */
|
||||
* ph = NULL;
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ static EVP_ENCODE_CTX * hb_EVP_ENCODE_CTX_par( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gcEVP_ENCODE_CTX_funcs, iParam );
|
||||
|
||||
return ph ? ( EVP_ENCODE_CTX * ) * ph : NULL;
|
||||
return ph ? ( EVP_ENCODE_CTX * ) *ph : NULL;
|
||||
}
|
||||
|
||||
HB_FUNC( HB_EVP_ENCODE_CTX_CREATE )
|
||||
@@ -97,7 +97,7 @@ HB_FUNC( HB_EVP_ENCODE_CTX_CREATE )
|
||||
|
||||
EVP_ENCODE_CTX * ctx = ( EVP_ENCODE_CTX * ) hb_xgrab( sizeof( EVP_ENCODE_CTX ) );
|
||||
|
||||
* ph = ctx;
|
||||
*ph = ctx;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ static HB_GARBAGE_FUNC( EVP_PKEY_release )
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
EVP_PKEY_free( ( EVP_PKEY * ) * ph );
|
||||
EVP_PKEY_free( ( EVP_PKEY * ) *ph );
|
||||
|
||||
/* set pointer to NULL just in case */
|
||||
* ph = NULL;
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ EVP_PKEY * hb_EVP_PKEY_par( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gcEVP_PKEY_funcs, iParam );
|
||||
|
||||
return ph ? ( EVP_PKEY * ) * ph : NULL;
|
||||
return ph ? ( EVP_PKEY * ) *ph : NULL;
|
||||
}
|
||||
|
||||
HB_FUNC( EVP_PKEY_NEW )
|
||||
@@ -97,7 +97,7 @@ HB_FUNC( EVP_PKEY_NEW )
|
||||
|
||||
EVP_PKEY * ctx = EVP_PKEY_new();
|
||||
|
||||
* ph = ctx;
|
||||
*ph = ctx;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
@@ -153,7 +153,7 @@ HB_FUNC( EVP_PKEY_ASSIGN_RSA )
|
||||
if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) )
|
||||
{
|
||||
EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 );
|
||||
RSA * key = ( RSA * ) hb_parptr( 2 );
|
||||
RSA * key = ( RSA * ) hb_parptr( 2 );
|
||||
|
||||
if( pkey && key )
|
||||
hb_retni( EVP_PKEY_assign_RSA( pkey, key ) );
|
||||
@@ -171,7 +171,7 @@ HB_FUNC( EVP_PKEY_ASSIGN_DSA )
|
||||
if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) )
|
||||
{
|
||||
EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 );
|
||||
DSA * key = ( DSA * ) hb_parptr( 2 );
|
||||
DSA * key = ( DSA * ) hb_parptr( 2 );
|
||||
|
||||
if( pkey && key )
|
||||
hb_retni( EVP_PKEY_assign_DSA( pkey, key ) );
|
||||
@@ -189,7 +189,7 @@ HB_FUNC( EVP_PKEY_ASSIGN_DH )
|
||||
if( hb_EVP_PKEY_is( 1 ) && HB_ISPOINTER( 2 ) )
|
||||
{
|
||||
EVP_PKEY * pkey = hb_EVP_PKEY_par( 1 );
|
||||
DH * key = ( DH * ) hb_parptr( 2 );
|
||||
DH * key = ( DH * ) hb_parptr( 2 );
|
||||
|
||||
if( pkey && key )
|
||||
hb_retni( EVP_PKEY_assign_DH( pkey, key ) );
|
||||
@@ -203,44 +203,44 @@ HB_FUNC( EVP_PKEY_ASSIGN_DH )
|
||||
|
||||
#if 0
|
||||
|
||||
int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key);
|
||||
int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key);
|
||||
int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key);
|
||||
int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey,EC_KEY *key);
|
||||
int EVP_PKEY_set1_RSA( EVP_PKEY * pkey, RSA * key );
|
||||
int EVP_PKEY_set1_DSA( EVP_PKEY * pkey, DSA * key );
|
||||
int EVP_PKEY_set1_DH( EVP_PKEY * pkey, DH * key );
|
||||
int EVP_PKEY_set1_EC_KEY( EVP_PKEY * pkey, EC_KEY * key );
|
||||
|
||||
RSA * EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
|
||||
DSA * EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
|
||||
DH * EVP_PKEY_get1_DH(EVP_PKEY *pkey);
|
||||
EC_KEY * EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
|
||||
RSA * EVP_PKEY_get1_RSA( EVP_PKEY * pkey );
|
||||
DSA * EVP_PKEY_get1_DSA( EVP_PKEY * pkey );
|
||||
DH * EVP_PKEY_get1_DH( EVP_PKEY * pkey );
|
||||
EC_KEY * EVP_PKEY_get1_EC_KEY( EVP_PKEY * pkey );
|
||||
|
||||
/* These changed in 0.9.9 to something different, they weren't probably documented before. */
|
||||
int EVP_PKEY_decrypt( unsigned char * dec_key, const unsigned char * enc_key, int enc_key_len, EVP_PKEY * private_key );
|
||||
int EVP_PKEY_encrypt( unsigned char * enc_key, const unsigned char * key , int key_len , EVP_PKEY * pub_key );
|
||||
int EVP_PKEY_encrypt( unsigned char * enc_key, const unsigned char * key, int key_len, EVP_PKEY * pub_key );
|
||||
|
||||
/* 1.0.0 */
|
||||
int EVP_PKEY_sign_init(EVP_PKEY_CTX *ctx);
|
||||
int EVP_PKEY_sign(EVP_PKEY_CTX *ctx,
|
||||
unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
int EVP_PKEY_sign_init( EVP_PKEY_CTX * ctx );
|
||||
int EVP_PKEY_sign( EVP_PKEY_CTX * ctx,
|
||||
unsigned char * sig, size_t * siglen,
|
||||
const unsigned char * tbs, size_t tbslen );
|
||||
|
||||
int EVP_PKEY_verify_init(EVP_PKEY_CTX *ctx);
|
||||
int EVP_PKEY_verify(EVP_PKEY_CTX *ctx,
|
||||
const unsigned char *sig, size_t siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
int EVP_PKEY_verify_init( EVP_PKEY_CTX * ctx );
|
||||
int EVP_PKEY_verify( EVP_PKEY_CTX * ctx,
|
||||
const unsigned char * sig, size_t siglen,
|
||||
const unsigned char * tbs, size_t tbslen );
|
||||
|
||||
int EVP_PKEY_verify_recover_init(EVP_PKEY_CTX *ctx);
|
||||
int EVP_PKEY_verify_recover(EVP_PKEY_CTX *ctx,
|
||||
unsigned char *rout, size_t *routlen,
|
||||
const unsigned char *sig, size_t siglen);
|
||||
int EVP_PKEY_verify_recover_init( EVP_PKEY_CTX * ctx );
|
||||
int EVP_PKEY_verify_recover( EVP_PKEY_CTX * ctx,
|
||||
unsigned char * rout, size_t * routlen,
|
||||
const unsigned char * sig, size_t siglen );
|
||||
|
||||
int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
|
||||
int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx,
|
||||
unsigned char *out, size_t *outlen,
|
||||
const unsigned char *in, size_t inlen);
|
||||
int EVP_PKEY_encrypt_init( EVP_PKEY_CTX * ctx );
|
||||
int EVP_PKEY_encrypt( EVP_PKEY_CTX * ctx,
|
||||
unsigned char * out, size_t * outlen,
|
||||
const unsigned char * in, size_t inlen );
|
||||
|
||||
int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
|
||||
int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx,
|
||||
unsigned char *out, size_t *outlen,
|
||||
const unsigned char *in, size_t inlen);
|
||||
int EVP_PKEY_decrypt_init( EVP_PKEY_CTX * ctx );
|
||||
int EVP_PKEY_decrypt( EVP_PKEY_CTX * ctx,
|
||||
unsigned char * out, size_t * outlen,
|
||||
const unsigned char * in, size_t inlen );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -66,13 +66,13 @@ static HB_GARBAGE_FUNC( SSL_CTX_release )
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
SSL_CTX_free( ( SSL_CTX * ) * ph );
|
||||
SSL_CTX_free( ( SSL_CTX * ) *ph );
|
||||
|
||||
/* set pointer to NULL just in case */
|
||||
* ph = NULL;
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ SSL_CTX * hb_SSL_CTX_par( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gcSSL_CTX_funcs, iParam );
|
||||
|
||||
return ph ? ( SSL_CTX * ) * ph : NULL;
|
||||
return ph ? ( SSL_CTX * ) *ph : NULL;
|
||||
}
|
||||
|
||||
const SSL_METHOD * hb_ssl_method_id_to_ptr( int n )
|
||||
@@ -101,20 +101,20 @@ const SSL_METHOD * hb_ssl_method_id_to_ptr( int n )
|
||||
switch( n )
|
||||
{
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10000000L
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV2 : p = SSLv2_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV2_SERVER : p = SSLv2_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV2_CLIENT : p = SSLv2_client_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV2: p = SSLv2_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV2_SERVER: p = SSLv2_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV2_CLIENT: p = SSLv2_client_method(); break;
|
||||
#endif
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV3 : p = SSLv3_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV3_SERVER : p = SSLv3_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV3_CLIENT : p = SSLv3_client_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_TLSV1 : p = TLSv1_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_TLSV1_SERVER : p = TLSv1_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_TLSV1_CLIENT : p = TLSv1_client_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV23 : p = SSLv23_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER : p = SSLv23_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV23_CLIENT : p = SSLv23_client_method(); break;
|
||||
default : p = SSLv23_method();
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV3: p = SSLv3_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV3_SERVER: p = SSLv3_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV3_CLIENT: p = SSLv3_client_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_TLSV1: p = TLSv1_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_TLSV1_SERVER: p = TLSv1_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_TLSV1_CLIENT: p = TLSv1_client_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV23: p = SSLv23_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV23_SERVER: p = SSLv23_server_method(); break;
|
||||
case HB_SSL_CTX_NEW_METHOD_SSLV23_CLIENT: p = SSLv23_client_method(); break;
|
||||
default: p = SSLv23_method();
|
||||
}
|
||||
|
||||
return p;
|
||||
@@ -130,7 +130,7 @@ HB_FUNC( SSL_CTX_NEW )
|
||||
SSL_CTX * ctx = SSL_CTX_new( hb_ssl_method_id_to_ptr( hb_parnidef( 1, HB_SSL_CTX_NEW_METHOD_DEFAULT ) ) );
|
||||
#endif
|
||||
|
||||
* ph = ( void * ) ctx;
|
||||
*ph = ( void * ) ctx;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
@@ -195,7 +195,7 @@ HB_FUNC( SSL_CTX_ADD_SESSION )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) && hb_SSL_SESSION_is( 2 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
SSL_SESSION * session = hb_SSL_SESSION_par( 2 );
|
||||
|
||||
if( ctx && session )
|
||||
@@ -209,7 +209,7 @@ HB_FUNC( SSL_CTX_REMOVE_SESSION )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) && hb_SSL_SESSION_is( 2 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
SSL_SESSION * session = hb_SSL_SESSION_par( 2 );
|
||||
|
||||
if( ctx && session )
|
||||
@@ -574,8 +574,8 @@ HB_FUNC( SSL_CTX_USE_CERTIFICATE )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) && hb_X509_is( 2 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
X509 * x509 = hb_X509_par( 2 );
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
X509 * x509 = hb_X509_par( 2 );
|
||||
|
||||
if( ctx && x509 )
|
||||
hb_retni( SSL_CTX_use_certificate( ctx, x509 ) );
|
||||
@@ -588,8 +588,8 @@ HB_FUNC( SSL_CTX_ADD_CLIENT_CA )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) && hb_X509_is( 2 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
X509 * x509 = hb_X509_par( 2 );
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
X509 * x509 = hb_X509_par( 2 );
|
||||
|
||||
if( ctx && x509 )
|
||||
hb_retni( SSL_CTX_add_client_CA( ctx, x509 ) );
|
||||
@@ -613,7 +613,7 @@ HB_FUNC( SSL_CTX_GET_CLIENT_CA_LIST )
|
||||
if( len > 0 )
|
||||
{
|
||||
PHB_ITEM pArray = hb_itemArrayNew( sk_X509_NAME_num( stack ) );
|
||||
int tmp;
|
||||
int tmp;
|
||||
|
||||
for( tmp = 0; tmp < len; tmp++ )
|
||||
hb_arraySetPtr( pArray, tmp + 1, sk_X509_NAME_value( stack, tmp ) );
|
||||
@@ -622,7 +622,7 @@ HB_FUNC( SSL_CTX_GET_CLIENT_CA_LIST )
|
||||
}
|
||||
else
|
||||
#endif
|
||||
hb_reta( 0 );
|
||||
hb_reta( 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -633,8 +633,8 @@ HB_FUNC( SSL_CTX_ADD_EXTRA_CHAIN_CERT )
|
||||
{
|
||||
if( hb_SSL_CTX_is( 1 ) && hb_X509_is( 2 ) )
|
||||
{
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
X509 * x509 = hb_X509_par( 2 );
|
||||
SSL_CTX * ctx = hb_SSL_CTX_par( 1 );
|
||||
X509 * x509 = hb_X509_par( 2 );
|
||||
|
||||
if( ctx && x509 )
|
||||
hb_retnl( SSL_CTX_add_extra_chain_cert( ctx, x509 ) );
|
||||
@@ -786,49 +786,49 @@ HB_FUNC( SSL_CTX_SET_DEFAULT_VERIFY_PATHS )
|
||||
|
||||
/*
|
||||
|
||||
#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)
|
||||
#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val))
|
||||
#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st))
|
||||
#define sk_X509_NAME_new_null() SKM_sk_new_null(X509_NAME)
|
||||
#define sk_X509_NAME_push(st, val) SKM_sk_push(X509_NAME, (st), (val))
|
||||
#define sk_X509_NAME_free(st) SKM_sk_free(X509_NAME, (st))
|
||||
|
||||
X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
|
||||
void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);
|
||||
void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *cs);
|
||||
int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
|
||||
long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, char *parg);
|
||||
X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *);
|
||||
void SSL_CTX_set_cert_store(SSL_CTX *,X509_STORE *);
|
||||
void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *cs);
|
||||
int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa);
|
||||
long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, char *parg);
|
||||
|
||||
void SSL_CTX_set_app_data(SSL_CTX *ctx, void *arg);
|
||||
int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, char *arg);
|
||||
char * SSL_CTX_get_app_data( ctx );
|
||||
char * SSL_CTX_get_ex_data( ctx, int );
|
||||
void SSL_CTX_set_app_data(SSL_CTX *ctx, void *arg);
|
||||
int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, char *arg);
|
||||
char * SSL_CTX_get_app_data( ctx );
|
||||
char * SSL_CTX_get_ex_data( ctx, int );
|
||||
|
||||
int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
|
||||
int SSL_CTX_get_ex_new_index(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
|
||||
void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(SSL *ssl, int cb, int ret);
|
||||
int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx);
|
||||
SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy);
|
||||
int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess);
|
||||
void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess);
|
||||
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy));
|
||||
void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess));
|
||||
void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess));
|
||||
LHASH *SSL_CTX_sessions(SSL_CTX *ctx);
|
||||
void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(), char *arg)
|
||||
void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK *list);
|
||||
void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
|
||||
void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, int (*cb);(void))
|
||||
void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret));
|
||||
void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
|
||||
void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);
|
||||
long SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH *dh);
|
||||
long SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*cb)(void));
|
||||
long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa);
|
||||
SSL_CTX_set_tmp_rsa_callback
|
||||
long SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int export, int keylength));
|
||||
Sets the callback which will be called when a temporary private key is required. The export flag will be set if the reason for needing a temp key is that an export ciphersuite is in use, in which case, keylength will contain the required keylength in bits. Generate a key of appropriate size (using ???) and return it.
|
||||
SSL_set_tmp_rsa_callback
|
||||
long SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength));
|
||||
The same as SSL_CTX_set_tmp_rsa_callback, except it operates on an SSL session instead of a context.
|
||||
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb);(void))
|
||||
void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len));
|
||||
void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));
|
||||
*/
|
||||
int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey);
|
||||
int SSL_CTX_get_ex_new_index(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void))
|
||||
void (*SSL_CTX_get_info_callback(SSL_CTX *ctx))(SSL *ssl, int cb, int ret);
|
||||
int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx);
|
||||
SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy);
|
||||
int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess);
|
||||
void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess);
|
||||
void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy));
|
||||
void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess));
|
||||
void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess));
|
||||
LHASH *SSL_CTX_sessions(SSL_CTX *ctx);
|
||||
void SSL_CTX_set_cert_verify_cb(SSL_CTX *ctx, int (*cb)(), char *arg)
|
||||
void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK *list);
|
||||
void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey));
|
||||
void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, int (*cb);(void))
|
||||
void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret));
|
||||
void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg));
|
||||
void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg);
|
||||
long SSL_CTX_set_tmp_dh(SSL_CTX* ctx, DH *dh);
|
||||
long SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, DH *(*cb)(void));
|
||||
long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa);
|
||||
SSL_CTX_set_tmp_rsa_callback
|
||||
long SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, RSA *(*cb)(SSL *ssl, int export, int keylength));
|
||||
Sets the callback which will be called when a temporary private key is required. The export flag will be set if the reason for needing a temp key is that an export ciphersuite is in use, in which case, keylength will contain the required keylength in bits. Generate a key of appropriate size (using ???) and return it.
|
||||
SSL_set_tmp_rsa_callback
|
||||
long SSL_set_tmp_rsa_callback(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength));
|
||||
The same as SSL_CTX_set_tmp_rsa_callback, except it operates on an SSL session instead of a context.
|
||||
void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, int (*cb);(void))
|
||||
void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len));
|
||||
void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len));
|
||||
*/
|
||||
|
||||
@@ -60,13 +60,13 @@ static HB_GARBAGE_FUNC( SSL_SESSION_release )
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
SSL_SESSION_free( ( SSL_SESSION * ) * ph );
|
||||
SSL_SESSION_free( ( SSL_SESSION * ) *ph );
|
||||
|
||||
/* set pointer to NULL just in case */
|
||||
* ph = NULL;
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ SSL_SESSION * hb_SSL_SESSION_par( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gcSSL_SESSION_funcs, iParam );
|
||||
|
||||
return ph ? ( SSL_SESSION * ) * ph : NULL;
|
||||
return ph ? ( SSL_SESSION * ) *ph : NULL;
|
||||
}
|
||||
|
||||
HB_FUNC( SSL_SESSION_NEW )
|
||||
@@ -94,7 +94,7 @@ HB_FUNC( SSL_SESSION_NEW )
|
||||
|
||||
SSL_SESSION * session = SSL_SESSION_new();
|
||||
|
||||
* ph = ( void * ) session;
|
||||
*ph = ( void * ) session;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
@@ -183,12 +183,12 @@ HB_FUNC( SSL_SESSION_HASH )
|
||||
}
|
||||
|
||||
/*
|
||||
char *SSL_SESSION_get_app_data(SSL_SESSION *s);
|
||||
char *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx);
|
||||
void SSL_SESSION_set_app_data(SSL_SESSION *s, char *a);
|
||||
int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, char *arg);
|
||||
char *SSL_SESSION_get_app_data(SSL_SESSION *s);
|
||||
char *SSL_SESSION_get_ex_data(const SSL_SESSION *s, int idx);
|
||||
void SSL_SESSION_set_app_data(SSL_SESSION *s, char *a);
|
||||
int SSL_SESSION_set_ex_data(SSL_SESSION *s, int idx, char *arg);
|
||||
|
||||
int SSL_SESSION_get_ex_new_index(long argl, char *argp, int (*new_func)(void), int (*dup_func)(void), void (*free_func)(void))
|
||||
int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x);
|
||||
int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x);
|
||||
*/
|
||||
int SSL_SESSION_get_ex_new_index(long argl, char *argp, int (*new_func)(void), int (*dup_func)(void), void (*free_func)(void))
|
||||
int SSL_SESSION_print(BIO *bp, const SSL_SESSION *x);
|
||||
int SSL_SESSION_print_fp(FILE *fp, const SSL_SESSION *x);
|
||||
*/
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
|
||||
HB_FUNC( BIN2U )
|
||||
{
|
||||
PHB_ITEM pItem = hb_param( 1, HB_IT_STRING );
|
||||
HB_U32 uiResult = 0;
|
||||
PHB_ITEM pItem = hb_param( 1, HB_IT_STRING );
|
||||
HB_U32 uiResult = 0;
|
||||
|
||||
if( pItem )
|
||||
{
|
||||
@@ -76,23 +76,25 @@ HB_FUNC( BIN2U )
|
||||
|
||||
HB_FUNC( U2BIN )
|
||||
{
|
||||
char szResult[ 4 ];
|
||||
char szResult[ 4 ];
|
||||
HB_U32 uiValue = ( HB_U32 ) hb_parnint( 1 );
|
||||
|
||||
HB_PUT_LE_UINT32( szResult, uiValue );
|
||||
hb_retclen( szResult, 4 );
|
||||
}
|
||||
|
||||
HB_FUNC( W2BIN )
|
||||
{
|
||||
char szResult[ 2 ];
|
||||
char szResult[ 2 ];
|
||||
HB_U16 uiValue = ( HB_U16 ) hb_parni( 1 );
|
||||
|
||||
HB_PUT_LE_UINT16( szResult, uiValue );
|
||||
hb_retclen( szResult, 2 );
|
||||
}
|
||||
|
||||
HB_FUNC( F2BIN )
|
||||
{
|
||||
char buf[ sizeof( double ) ];
|
||||
char buf[ sizeof( double ) ];
|
||||
double d = hb_parnd( 1 );
|
||||
|
||||
HB_PUT_LE_DOUBLE( buf, d );
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
typedef struct
|
||||
{
|
||||
PHB_ITEM pLibraryHandle;
|
||||
HB_BOOL bFreeLibrary; /* Free library handle on destroy? */
|
||||
HB_BOOL bFreeLibrary; /* Free library handle on destroy? */
|
||||
int iFuncFlags;
|
||||
void * pFunctionPtr; /* Function Address */
|
||||
} HB_DLLEXEC, * PHB_DLLEXEC;
|
||||
@@ -105,9 +105,9 @@ HB_FUNC_TRANSLATE( DLLUNLOAD, HB_LIBFREE )
|
||||
|
||||
HB_FUNC( DLLCALL )
|
||||
{
|
||||
PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pLibraryHandle = NULL;
|
||||
HB_BOOL bFreeLibrary = HB_FALSE;
|
||||
HB_BOOL bFreeLibrary = HB_FALSE;
|
||||
|
||||
if( HB_IS_STRING( pLibrary ) )
|
||||
{
|
||||
@@ -120,8 +120,8 @@ HB_FUNC( DLLCALL )
|
||||
|
||||
if( pLibraryHandle )
|
||||
{
|
||||
int iXPPFlags = hb_parni( 2 );
|
||||
int iFuncFlags = 0;
|
||||
int iXPPFlags = hb_parni( 2 );
|
||||
int iFuncFlags = 0;
|
||||
void * pFunctionPtr = hb_libSymAddr( pLibraryHandle, hb_parcx( 3 ) );
|
||||
|
||||
if( ( iXPPFlags & DLL_CDECL ) != 0 )
|
||||
@@ -147,8 +147,8 @@ HB_FUNC( DLLCALL )
|
||||
|
||||
HB_FUNC( DLLPREPARECALL )
|
||||
{
|
||||
PHB_DLLEXEC xec = ( PHB_DLLEXEC ) hb_gcAllocate( sizeof( HB_DLLEXEC ), &s_gcDllFuncs );
|
||||
PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY );
|
||||
PHB_DLLEXEC xec = ( PHB_DLLEXEC ) hb_gcAllocate( sizeof( HB_DLLEXEC ), &s_gcDllFuncs );
|
||||
PHB_ITEM pLibrary = hb_param( 1, HB_IT_ANY );
|
||||
const char * pszErrorText;
|
||||
|
||||
memset( xec, 0, sizeof( HB_DLLEXEC ) );
|
||||
|
||||
@@ -75,7 +75,7 @@ HB_FUNC( SETMOUSE )
|
||||
{
|
||||
int iRow = 0, iCol = 0;
|
||||
|
||||
if( !fRow || !fCol )
|
||||
if( ! fRow || ! fCol )
|
||||
hb_mouseGetPos( &iRow, &iCol );
|
||||
|
||||
if( fRow )
|
||||
|
||||
@@ -67,14 +67,14 @@ HB_FUNC( CONVTOOEMCP )
|
||||
int nLen = ( int ) hb_itemGetCLen( pString );
|
||||
const char * pszSrc = hb_itemGetCPtr( pString );
|
||||
|
||||
int nWideLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 );
|
||||
LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) );
|
||||
int nWideLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 );
|
||||
LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) );
|
||||
|
||||
char * pszDst;
|
||||
|
||||
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszSrc, nLen, pszWide, nWideLen );
|
||||
|
||||
nLen = WideCharToMultiByte( CP_OEMCP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL );
|
||||
nLen = WideCharToMultiByte( CP_OEMCP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL );
|
||||
pszDst = ( char * ) hb_xgrab( nLen + 1 );
|
||||
|
||||
WideCharToMultiByte( CP_OEMCP, 0, pszWide, nWideLen, pszDst, nLen, NULL, NULL );
|
||||
@@ -99,14 +99,14 @@ HB_FUNC( CONVTOANSICP )
|
||||
int nLen = ( int ) hb_itemGetCLen( pString );
|
||||
const char * pszSrc = hb_itemGetCPtr( pString );
|
||||
|
||||
int nWideLen = MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 );
|
||||
LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) );
|
||||
int nWideLen = MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED, pszSrc, nLen, NULL, 0 );
|
||||
LPWSTR pszWide = ( LPWSTR ) hb_xgrab( ( nWideLen + 1 ) * sizeof( wchar_t ) );
|
||||
|
||||
char * pszDst;
|
||||
|
||||
MultiByteToWideChar( CP_OEMCP, MB_PRECOMPOSED, pszSrc, nLen, pszWide, nWideLen );
|
||||
|
||||
nLen = WideCharToMultiByte( CP_ACP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL );
|
||||
nLen = WideCharToMultiByte( CP_ACP, 0, pszWide, nWideLen, NULL, 0, NULL, NULL );
|
||||
pszDst = ( char * ) hb_xgrab( nLen + 1 );
|
||||
|
||||
WideCharToMultiByte( CP_ACP, 0, pszWide, nWideLen, pszDst, nLen, NULL, NULL );
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
static HB_ERRCODE s_waList( AREAP pArea, void * Cargo )
|
||||
{
|
||||
PHB_ITEM pArray = ( PHB_ITEM ) Cargo;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray ) + 1;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray ) + 1;
|
||||
|
||||
hb_arraySize( pArray, nLen );
|
||||
hb_arraySetC( pArray, nLen, hb_dynsymName( ( PHB_DYNS ) pArea->atomAlias ) );
|
||||
|
||||
@@ -61,15 +61,15 @@
|
||||
* data from tail
|
||||
*/
|
||||
#undef HB_IS_VALID_INDEX
|
||||
#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) (idx) < 0 ? (idx) += (max) + 1 : (idx) ) > 0 && ( HB_SIZE ) (idx) <= (max) )
|
||||
#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) )
|
||||
|
||||
HB_FUNC( XPP_INDEX )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pIndex = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( hb_pcount() == 2 )
|
||||
{ /* ASSIGN */
|
||||
if( hb_pcount() == 2 ) /* ASSIGN */
|
||||
{
|
||||
PHB_ITEM pValue = hb_param( 2, HB_IT_ANY );
|
||||
if( HB_IS_NUMERIC( pIndex ) )
|
||||
{
|
||||
@@ -103,15 +103,15 @@ HB_FUNC( XPP_INDEX )
|
||||
hb_errRT_BASE( EG_BOUND, 1012, "Error in array index", hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex );
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
hb_errRT_BASE( EG_ARG, 1069, NULL, hb_langDGetErrorDesc( EG_ARRASSIGN ), 1, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
|
||||
hb_itemReturn( pSelf );
|
||||
}
|
||||
else
|
||||
{ /* ACCESS */
|
||||
else /* ACCESS */
|
||||
{
|
||||
if( HB_IS_NUMERIC( pIndex ) )
|
||||
{
|
||||
HB_SIZE nIndex = hb_itemGetNS( pIndex );
|
||||
@@ -121,7 +121,7 @@ HB_FUNC( XPP_INDEX )
|
||||
if( HB_IS_VALID_INDEX( nIndex, nLen ) )
|
||||
hb_itemReturn( hb_arrayGetItemPtr( pSelf, nIndex ) );
|
||||
else
|
||||
hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
}
|
||||
else if( HB_IS_STRING( pSelf ) )
|
||||
{
|
||||
@@ -129,10 +129,10 @@ HB_FUNC( XPP_INDEX )
|
||||
if( HB_IS_VALID_INDEX( nIndex, nLen ) )
|
||||
hb_retclen( hb_itemGetCPtr( pSelf ) + nIndex - 1, 1 );
|
||||
else
|
||||
hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
hb_errRT_BASE( EG_BOUND, 1132, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
}
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 1068, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
hb_errRT_BASE( EG_ARG, 1068, NULL, hb_langDGetErrorDesc( EG_ARRACCESS ), 2, pSelf, pIndex ); /* TODO: Emulate exact XPP error msg */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -146,7 +146,7 @@ HB_FUNC( XPP_INDEX )
|
||||
HB_FUNC( XPP_INCLUDE )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pKey = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pKey = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_ARRAY( pSelf ) )
|
||||
{
|
||||
|
||||
@@ -72,9 +72,9 @@ typedef struct HB_BACKGROUNDTASK_
|
||||
{
|
||||
HB_ULONG ulTaskID; /* task identifier */
|
||||
PHB_ITEM pTask; /* pointer to the task item */
|
||||
double dSeconds; /* internal - last time this task has gone */
|
||||
int millisec; /* milliseconds after this task must run */
|
||||
HB_BOOL bActive; /* task is active ? */
|
||||
double dSeconds; /* internal - last time this task has gone */
|
||||
int millisec; /* milliseconds after this task must run */
|
||||
HB_BOOL bActive; /* task is active ? */
|
||||
} HB_BACKGROUNDTASK, * PHB_BACKGROUNDTASK;
|
||||
|
||||
extern void hb_backgroundRunSingle( HB_ULONG ulID ); /* run a single background routine */
|
||||
@@ -98,25 +98,25 @@ static HB_ULONG s_ulBackgroundID = 0;
|
||||
/* list of background tasks
|
||||
* A pointer into an array of pointers to items with a codeblock
|
||||
*/
|
||||
static PHB_BACKGROUNDTASK * s_pBackgroundTasks = NULL;
|
||||
static PHB_BACKGROUNDTASK * s_pBackgroundTasks = NULL;
|
||||
|
||||
static HB_BOOL s_bEnabled = HB_FALSE;
|
||||
static HB_BOOL s_bEnabled = HB_FALSE;
|
||||
|
||||
/* flag to prevent recursive calls of hb_backgroundRun() */
|
||||
static HB_BOOL s_bIamBackground = HB_FALSE;
|
||||
static HB_BOOL s_bIamBackground = HB_FALSE;
|
||||
|
||||
/* current task to be executed */
|
||||
static HB_USHORT s_uiBackgroundTask = 0;
|
||||
static HB_USHORT s_uiBackgroundTask = 0;
|
||||
|
||||
/* number of tasks in the list */
|
||||
static HB_USHORT s_uiBackgroundMaxTask = 0;
|
||||
static HB_USHORT s_uiBackgroundMaxTask = 0;
|
||||
#else
|
||||
|
||||
#define s_ulBackgroundID HB_VM_STACK.ulBackgroundID
|
||||
#define s_pBackgroundTasks ( HB_VM_STACK.pBackgroundTasks )
|
||||
#define s_bIamBackground HB_VM_STACK.bIamBackground
|
||||
#define s_uiBackgroundTask HB_VM_STACK.uiBackgroundTask
|
||||
#define s_uiBackgroundMaxTask HB_VM_STACK.uiBackgroundMaxTask
|
||||
#define s_ulBackgroundID HB_VM_STACK.ulBackgroundID
|
||||
#define s_pBackgroundTasks ( HB_VM_STACK.pBackgroundTasks )
|
||||
#define s_bIamBackground HB_VM_STACK.bIamBackground
|
||||
#define s_uiBackgroundTask HB_VM_STACK.uiBackgroundTask
|
||||
#define s_uiBackgroundMaxTask HB_VM_STACK.uiBackgroundMaxTask
|
||||
|
||||
#endif
|
||||
|
||||
@@ -129,17 +129,17 @@ HB_ULONG hb_backgroundAddFunc( PHB_ITEM pBlock, int nMillisec, HB_BOOL bActive )
|
||||
/* store a copy of passed codeblock
|
||||
*/
|
||||
|
||||
pBkgTask = ( PHB_BACKGROUNDTASK ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) );
|
||||
pBkgTask = ( PHB_BACKGROUNDTASK ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) );
|
||||
|
||||
pBkgTask->pTask = hb_itemNew( pBlock );
|
||||
pBkgTask->dSeconds = hb_dateSeconds();
|
||||
pBkgTask->millisec = nMillisec;
|
||||
pBkgTask->bActive = bActive;
|
||||
pBkgTask->pTask = hb_itemNew( pBlock );
|
||||
pBkgTask->dSeconds = hb_dateSeconds();
|
||||
pBkgTask->millisec = nMillisec;
|
||||
pBkgTask->bActive = bActive;
|
||||
|
||||
if( ! s_pBackgroundTasks )
|
||||
{
|
||||
pBkgTask->ulTaskID = s_ulBackgroundID = 1;
|
||||
s_pBackgroundTasks = ( PHB_BACKGROUNDTASK * ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) );
|
||||
pBkgTask->ulTaskID = s_ulBackgroundID = 1;
|
||||
s_pBackgroundTasks = ( PHB_BACKGROUNDTASK * ) hb_xgrab( sizeof( HB_BACKGROUNDTASK ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -234,7 +234,7 @@ void hb_backgroundRunSingle( HB_ULONG ulID )
|
||||
{
|
||||
s_bIamBackground = HB_TRUE;
|
||||
|
||||
pBkgTask = hb_backgroundFind( ulID );
|
||||
pBkgTask = hb_backgroundFind( ulID );
|
||||
if( pBkgTask )
|
||||
hb_itemRelease( hb_itemDo( pBkgTask->pTask, 0 ) );
|
||||
|
||||
@@ -257,9 +257,9 @@ void hb_backgroundShutDown( void )
|
||||
do
|
||||
{
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
pBkgTask = s_pBackgroundTasks[ --s_uiBackgroundMaxTask ];
|
||||
pBkgTask = s_pBackgroundTasks[ --s_uiBackgroundMaxTask ];
|
||||
hb_itemRelease( pBkgTask->pTask );
|
||||
pBkgTask->pTask = NULL;
|
||||
pBkgTask->pTask = NULL;
|
||||
hb_xfree( pBkgTask );
|
||||
}
|
||||
while( s_uiBackgroundMaxTask );
|
||||
@@ -272,14 +272,14 @@ void hb_backgroundShutDown( void )
|
||||
/* caller have to free return ITEM by hb_itemRelease() if it's not NULL */
|
||||
PHB_ITEM hb_backgroundDelFunc( HB_ULONG ulID )
|
||||
{
|
||||
int iTask;
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
PHB_ITEM pItem = NULL;
|
||||
HB_BOOL bOldSet = s_bEnabled;
|
||||
int iTask;
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
PHB_ITEM pItem = NULL;
|
||||
HB_BOOL bOldSet = s_bEnabled;
|
||||
|
||||
s_bEnabled = HB_FALSE;
|
||||
|
||||
iTask = 0;
|
||||
iTask = 0;
|
||||
while( iTask < s_uiBackgroundMaxTask )
|
||||
{
|
||||
pBkgTask = s_pBackgroundTasks[ iTask ];
|
||||
@@ -317,8 +317,8 @@ PHB_ITEM hb_backgroundDelFunc( HB_ULONG ulID )
|
||||
/* Find a task */
|
||||
PHB_BACKGROUNDTASK hb_backgroundFind( HB_ULONG ulID )
|
||||
{
|
||||
int iTask;
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
int iTask;
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
|
||||
iTask = 0;
|
||||
while( iTask < s_uiBackgroundMaxTask )
|
||||
@@ -336,15 +336,15 @@ PHB_BACKGROUNDTASK hb_backgroundFind( HB_ULONG ulID )
|
||||
/* Set task as active */
|
||||
HB_BOOL hb_backgroundActive( HB_ULONG ulID, HB_BOOL bActive )
|
||||
{
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
HB_BOOL bOldState = HB_FALSE;
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
HB_BOOL bOldState = HB_FALSE;
|
||||
|
||||
pBkgTask = hb_backgroundFind( ulID );
|
||||
|
||||
if( pBkgTask )
|
||||
{
|
||||
bOldState = pBkgTask->bActive;
|
||||
pBkgTask->bActive = bActive;
|
||||
bOldState = pBkgTask->bActive;
|
||||
pBkgTask->bActive = bActive;
|
||||
}
|
||||
return bOldState;
|
||||
|
||||
@@ -353,15 +353,15 @@ HB_BOOL hb_backgroundActive( HB_ULONG ulID, HB_BOOL bActive )
|
||||
/* Set task time */
|
||||
int hb_backgroundTime( HB_ULONG ulID, int nMillisec )
|
||||
{
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
int nOldState = 0;
|
||||
PHB_BACKGROUNDTASK pBkgTask;
|
||||
int nOldState = 0;
|
||||
|
||||
pBkgTask = hb_backgroundFind( ulID );
|
||||
|
||||
if( pBkgTask )
|
||||
{
|
||||
nOldState = pBkgTask->millisec;
|
||||
pBkgTask->millisec = nMillisec;
|
||||
nOldState = pBkgTask->millisec;
|
||||
pBkgTask->millisec = nMillisec;
|
||||
}
|
||||
return nOldState;
|
||||
}
|
||||
@@ -403,9 +403,9 @@ HB_FUNC( HB_BACKGROUNDRESET )
|
||||
/* add a new background task and return its handle */
|
||||
HB_FUNC( HB_BACKGROUNDADD )
|
||||
{
|
||||
PHB_ITEM pBlock = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pMillisec = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pActive = hb_param( 3, HB_IT_LOGICAL );
|
||||
PHB_ITEM pBlock = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pMillisec = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pActive = hb_param( 3, HB_IT_LOGICAL );
|
||||
|
||||
if( HB_IS_BLOCK( pBlock ) || HB_IS_ARRAY( pBlock ) )
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -60,10 +60,10 @@
|
||||
|
||||
static HB_ULONG hb_TimeStrToSec( const char * pszTime )
|
||||
{
|
||||
HB_SIZE nLen;
|
||||
HB_SIZE nLen;
|
||||
HB_ULONG ulTime = 0;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_TimeStrToSec(%s)", pszTime));
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_TimeStrToSec(%s)", pszTime ) );
|
||||
|
||||
nLen = strlen( pszTime );
|
||||
|
||||
@@ -94,19 +94,19 @@ HB_FUNC( TIMEOFDAY )
|
||||
}
|
||||
else
|
||||
{
|
||||
int iSeconds = hb_parni(1);
|
||||
iSeconds %= 3600*24;
|
||||
int iSeconds = hb_parni( 1 );
|
||||
iSeconds %= 3600 * 24;
|
||||
hb_snprintf( szResult, sizeof( szResult ), "%02d:%02d:%02d",
|
||||
iSeconds/3600 , (iSeconds % 3600)/60, iSeconds % 60 );
|
||||
iSeconds / 3600, ( iSeconds % 3600 ) / 60, iSeconds % 60 );
|
||||
}
|
||||
hb_retclen( szResult, 8 );
|
||||
}
|
||||
|
||||
HB_FUNC( HMS2D )
|
||||
{
|
||||
int iHour = hb_parni( 1 );
|
||||
int iMin = hb_parni( 2 );
|
||||
double dSec = hb_parnd( 3 );
|
||||
int iHour = hb_parni( 1 );
|
||||
int iMin = hb_parni( 2 );
|
||||
double dSec = hb_parnd( 3 );
|
||||
|
||||
hb_retnd( hb_timeEncode( iHour, iMin, ( int ) dSec, ( int ) ( ( ( double ) ( dSec - ( double ) ( ( int ) dSec ) ) ) * 1000 ) ) );
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
/* Escaping delimited strings. Need to be cleaned/optimized/improved */
|
||||
static char * hb_strescape( const char * szInput, HB_ISIZ nLen, const char * cDelim )
|
||||
{
|
||||
HB_ISIZ nCnt = 0;
|
||||
HB_ISIZ nCnt = 0;
|
||||
const char * szChr;
|
||||
char * szEscape;
|
||||
char * szReturn;
|
||||
char * szEscape;
|
||||
char * szReturn;
|
||||
|
||||
szReturn = szEscape = ( char * ) hb_xgrab( nLen * 2 + 4 );
|
||||
|
||||
@@ -123,10 +123,8 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD
|
||||
}
|
||||
/* an "L" field */
|
||||
case HB_IT_LOGICAL:
|
||||
{
|
||||
hb_fsWriteLarge( handle, ( hb_itemGetL( pValue ) ? "T" : "F" ), 1 );
|
||||
break;
|
||||
}
|
||||
/* an "N" field */
|
||||
case HB_IT_INTEGER:
|
||||
case HB_IT_LONG:
|
||||
@@ -136,7 +134,7 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD
|
||||
|
||||
if( szResult )
|
||||
{
|
||||
HB_SIZE nLen = strlen( szResult );
|
||||
HB_SIZE nLen = strlen( szResult );
|
||||
const char * szTrimmed = hb_strLTrim( szResult, &nLen );
|
||||
|
||||
hb_fsWriteLarge( handle, szTrimmed, strlen( szTrimmed ) );
|
||||
@@ -146,7 +144,7 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD
|
||||
}
|
||||
/* an "M" field or the other, might be a "V" in SixDriver */
|
||||
default:
|
||||
/* We do not want MEMO contents */
|
||||
/* We do not want MEMO contents */
|
||||
return HB_FALSE;
|
||||
}
|
||||
return HB_TRUE;
|
||||
@@ -154,25 +152,25 @@ static HB_BOOL hb_ExportVar( HB_FHANDLE handle, PHB_ITEM pValue, const char * cD
|
||||
|
||||
HB_FUNC( DBF2TEXT )
|
||||
{
|
||||
PHB_ITEM pWhile = hb_param( 1, HB_IT_BLOCK );
|
||||
PHB_ITEM pFor = hb_param( 2, HB_IT_BLOCK );
|
||||
PHB_ITEM pFields = hb_param( 3, HB_IT_ARRAY );
|
||||
PHB_ITEM pWhile = hb_param( 1, HB_IT_BLOCK );
|
||||
PHB_ITEM pFor = hb_param( 2, HB_IT_BLOCK );
|
||||
PHB_ITEM pFields = hb_param( 3, HB_IT_ARRAY );
|
||||
|
||||
const char * cDelim = hb_parc( 4 );
|
||||
HB_FHANDLE handle = ( HB_FHANDLE ) hb_parnint( 5 );
|
||||
const char * cSep = hb_parc( 6 );
|
||||
int nCount = hb_parni( 7 );
|
||||
PHB_CODEPAGE cdp = hb_cdpFind( hb_parcx( 8 ) );
|
||||
HB_FHANDLE handle = ( HB_FHANDLE ) hb_parnint( 5 );
|
||||
const char * cSep = hb_parc( 6 );
|
||||
int nCount = hb_parni( 7 );
|
||||
PHB_CODEPAGE cdp = hb_cdpFind( hb_parcx( 8 ) );
|
||||
|
||||
AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();
|
||||
|
||||
/* Export DBF content to text file */
|
||||
|
||||
HB_ISIZ nSepLen;
|
||||
HB_ISIZ nSepLen;
|
||||
HB_USHORT uiFields = 0;
|
||||
HB_USHORT ui;
|
||||
PHB_ITEM pTmp;
|
||||
HB_BOOL bWriteSep = HB_FALSE;
|
||||
PHB_ITEM pTmp;
|
||||
HB_BOOL bWriteSep = HB_FALSE;
|
||||
|
||||
HB_BOOL bEof = HB_TRUE;
|
||||
HB_BOOL bBof = HB_TRUE;
|
||||
@@ -203,7 +201,7 @@ HB_FUNC( DBF2TEXT )
|
||||
nSepLen = hb_parclen( 6 );
|
||||
else
|
||||
{
|
||||
cSep = ",";
|
||||
cSep = ",";
|
||||
nSepLen = 1;
|
||||
}
|
||||
|
||||
@@ -226,7 +224,7 @@ HB_FUNC( DBF2TEXT )
|
||||
/* User does not request fields, copy all fields */
|
||||
if( bNoFieldPassed )
|
||||
{
|
||||
for( ui = 1; ui <= uiFields; ui ++ )
|
||||
for( ui = 1; ui <= uiFields; ui++ )
|
||||
{
|
||||
if( bWriteSep )
|
||||
hb_fsWriteLarge( handle, cSep, nSepLen );
|
||||
|
||||
@@ -64,6 +64,7 @@ static HB_BOOL s_bEmptyLogFile = HB_TRUE;
|
||||
HB_BOOL hb_ToOutDebugOnOff( HB_BOOL bOnOff )
|
||||
{
|
||||
HB_BOOL bOld = s_bToOutputDebug;
|
||||
|
||||
s_bToOutputDebug = bOnOff;
|
||||
return bOld;
|
||||
}
|
||||
@@ -86,6 +87,7 @@ void hb_ToOutDebug( const char * sTraceMsg, ... )
|
||||
HB_BOOL hb_ToLogFileOnOff( HB_BOOL bOnOff )
|
||||
{
|
||||
HB_BOOL bOld = s_bToLogFile;
|
||||
|
||||
s_bToLogFile = bOnOff;
|
||||
return bOld;
|
||||
}
|
||||
@@ -93,6 +95,7 @@ HB_BOOL hb_ToLogFileOnOff( HB_BOOL bOnOff )
|
||||
HB_BOOL hb_EmptyLogFile( HB_BOOL bOnOff )
|
||||
{
|
||||
HB_BOOL bOld = s_bEmptyLogFile;
|
||||
|
||||
s_bEmptyLogFile = bOnOff;
|
||||
return bOld;
|
||||
}
|
||||
|
||||
@@ -65,17 +65,17 @@
|
||||
#elif defined( HB_OS_WIN )
|
||||
#include <windows.h>
|
||||
#if ! defined( INVALID_FILE_ATTRIBUTES )
|
||||
#define INVALID_FILE_ATTRIBUTES ( ( DWORD ) ( -1 ) )
|
||||
#define INVALID_FILE_ATTRIBUTES ( ( DWORD ) ( -1 ) )
|
||||
#endif
|
||||
#include "hbwinuni.h"
|
||||
#endif
|
||||
|
||||
HB_FUNC( FILESTATS )
|
||||
{
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
char szAttr[ 21 ];
|
||||
HB_FOFFSET llSize = 0;
|
||||
long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0;
|
||||
HB_BOOL fResult = HB_FALSE;
|
||||
char szAttr[ 21 ];
|
||||
HB_FOFFSET llSize = 0;
|
||||
long lcDate = 0, lcTime = 0, lmDate = 0, lmTime = 0;
|
||||
|
||||
/* Parameter checking */
|
||||
if( hb_parclen( 1 ) == 0 )
|
||||
@@ -92,10 +92,10 @@ HB_FUNC( FILESTATS )
|
||||
if( stat( hb_parc( 1 ), &statbuf ) == 0 )
|
||||
{
|
||||
// determine if we can read/write/execute the file
|
||||
HB_FATTR usAttr, ushbAttr = 0;
|
||||
time_t ftime;
|
||||
HB_FATTR usAttr, ushbAttr = 0;
|
||||
time_t ftime;
|
||||
#if defined( HB_HAS_LOCALTIME_R )
|
||||
struct tm tms;
|
||||
struct tm tms;
|
||||
#endif
|
||||
struct tm * ptms;
|
||||
char * pszAttr = szAttr;
|
||||
@@ -155,28 +155,28 @@ HB_FUNC( FILESTATS )
|
||||
else if( S_ISREG( statbuf.st_mode ) && ushbAttr == 0 )
|
||||
ushbAttr |= HB_FA_ARCHIVE;
|
||||
|
||||
llSize = ( HB_FOFFSET ) statbuf.st_size;
|
||||
llSize = ( HB_FOFFSET ) statbuf.st_size;
|
||||
|
||||
ftime = statbuf.st_mtime;
|
||||
ftime = statbuf.st_mtime;
|
||||
#if defined( HB_HAS_LOCALTIME_R )
|
||||
ptms = localtime_r( &ftime, &tms );
|
||||
ptms = localtime_r( &ftime, &tms );
|
||||
#else
|
||||
ptms = localtime( &ftime );
|
||||
ptms = localtime( &ftime );
|
||||
#endif
|
||||
|
||||
lcDate = hb_dateEncode( ptms->tm_year + 1900,
|
||||
ptms->tm_mon + 1, ptms->tm_mday );
|
||||
lcTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec;
|
||||
lcDate = hb_dateEncode( ptms->tm_year + 1900,
|
||||
ptms->tm_mon + 1, ptms->tm_mday );
|
||||
lcTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec;
|
||||
|
||||
ftime = statbuf.st_atime;
|
||||
ftime = statbuf.st_atime;
|
||||
#if defined( HB_HAS_LOCALTIME_R )
|
||||
ptms = localtime_r( &ftime, &tms );
|
||||
ptms = localtime_r( &ftime, &tms );
|
||||
#else
|
||||
ptms = localtime( &ftime );
|
||||
ptms = localtime( &ftime );
|
||||
#endif
|
||||
lmDate = hb_dateEncode( ptms->tm_year + 1900,
|
||||
ptms->tm_mon + 1, ptms->tm_mday );
|
||||
lmTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec;
|
||||
lmDate = hb_dateEncode( ptms->tm_year + 1900,
|
||||
ptms->tm_mon + 1, ptms->tm_mday );
|
||||
lmTime = ptms->tm_hour * 3600 + ptms->tm_min * 60 + ptms->tm_sec;
|
||||
|
||||
hb_fsAttrDecode( ushbAttr, szAttr );
|
||||
|
||||
@@ -187,13 +187,13 @@ HB_FUNC( FILESTATS )
|
||||
#elif defined( HB_OS_WIN )
|
||||
|
||||
{
|
||||
void * hFileName;
|
||||
LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL );
|
||||
DWORD dwAttribs;
|
||||
WIN32_FIND_DATA ffind;
|
||||
HANDLE hFind;
|
||||
FILETIME filetime;
|
||||
SYSTEMTIME time;
|
||||
void * hFileName;
|
||||
LPCTSTR lpFileName = HB_PARSTR( 1, &hFileName, NULL );
|
||||
DWORD dwAttribs;
|
||||
WIN32_FIND_DATA ffind;
|
||||
HANDLE hFind;
|
||||
FILETIME filetime;
|
||||
SYSTEMTIME time;
|
||||
|
||||
/* Get attributes... */
|
||||
dwAttribs = GetFileAttributes( lpFileName );
|
||||
@@ -213,25 +213,25 @@ HB_FUNC( FILESTATS )
|
||||
if( FileTimeToLocalFileTime( &ffind.ftCreationTime, &filetime ) &&
|
||||
FileTimeToSystemTime( &filetime, &time ) )
|
||||
{
|
||||
lcDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay );
|
||||
lcTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond;
|
||||
lcDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay );
|
||||
lcTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond;
|
||||
}
|
||||
else
|
||||
{
|
||||
lcDate = hb_dateEncode( 0, 0, 0 );
|
||||
lcTime = 0;
|
||||
lcDate = hb_dateEncode( 0, 0, 0 );
|
||||
lcTime = 0;
|
||||
}
|
||||
|
||||
if( FileTimeToLocalFileTime( &ffind.ftLastAccessTime, &filetime ) &&
|
||||
FileTimeToSystemTime( &filetime, &time ) )
|
||||
{
|
||||
lmDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay );
|
||||
lmTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond;
|
||||
lmDate = hb_dateEncode( time.wYear, time.wMonth, time.wDay );
|
||||
lmTime = time.wHour * 3600 + time.wMinute * 60 + time.wSecond;
|
||||
}
|
||||
else
|
||||
{
|
||||
lcDate = hb_dateEncode( 0, 0, 0 );
|
||||
lcTime = 0;
|
||||
lcDate = hb_dateEncode( 0, 0, 0 );
|
||||
lcTime = 0;
|
||||
}
|
||||
fResult = HB_TRUE;
|
||||
}
|
||||
@@ -248,18 +248,18 @@ HB_FUNC( FILESTATS )
|
||||
if( findinfo )
|
||||
{
|
||||
hb_fsAttrDecode( findinfo->attr, szAttr );
|
||||
llSize = ( HB_FOFFSET ) findinfo->size;
|
||||
lcDate = findinfo->lDate;
|
||||
lcTime = ( findinfo->szTime[ 0 ] - '0' ) * 36000 +
|
||||
( findinfo->szTime[ 1 ] - '0' ) * 3600 +
|
||||
( findinfo->szTime[ 3 ] - '0' ) * 600 +
|
||||
( findinfo->szTime[ 4 ] - '0' ) * 60 +
|
||||
( findinfo->szTime[ 6 ] - '0' ) * 10 +
|
||||
( findinfo->szTime[ 7 ] - '0' );
|
||||
lmDate = hb_dateEncode( 0, 0, 0 );
|
||||
lmTime = 0;
|
||||
llSize = ( HB_FOFFSET ) findinfo->size;
|
||||
lcDate = findinfo->lDate;
|
||||
lcTime = ( findinfo->szTime[ 0 ] - '0' ) * 36000 +
|
||||
( findinfo->szTime[ 1 ] - '0' ) * 3600 +
|
||||
( findinfo->szTime[ 3 ] - '0' ) * 600 +
|
||||
( findinfo->szTime[ 4 ] - '0' ) * 60 +
|
||||
( findinfo->szTime[ 6 ] - '0' ) * 10 +
|
||||
( findinfo->szTime[ 7 ] - '0' );
|
||||
lmDate = hb_dateEncode( 0, 0, 0 );
|
||||
lmTime = 0;
|
||||
hb_fsFindClose( findinfo );
|
||||
fResult = HB_TRUE;
|
||||
fResult = HB_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
FPARSE( cFile, cDelimiter ) -> array
|
||||
FPARSE( cFile, cDelimiter ) -> array
|
||||
|
||||
Purpose:
|
||||
Parse a delimited text file.
|
||||
@@ -70,7 +70,7 @@ FPARSE( cFile, cDelimiter ) -> array
|
||||
Upon success -> Two dimensional array, of which each element contains
|
||||
the results of parsing
|
||||
Upon error -> An empty array
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapifs.h"
|
||||
@@ -78,7 +78,7 @@ FPARSE( cFile, cDelimiter ) -> array
|
||||
#include "hbfast.h"
|
||||
|
||||
/* adjustable, but this should be sufficient in normal situation */
|
||||
#define MAX_READ 4096
|
||||
#define MAX_READ 4096
|
||||
|
||||
static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter, int * iWord )
|
||||
{
|
||||
@@ -88,9 +88,9 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter,
|
||||
|
||||
if( nLen > 0 )
|
||||
{
|
||||
PHB_ITEM pTemp = hb_itemNew( NULL );
|
||||
HB_ISIZ i = 0;
|
||||
int word_count = 0;
|
||||
PHB_ITEM pTemp = hb_itemNew( NULL );
|
||||
HB_ISIZ i = 0;
|
||||
int word_count = 0;
|
||||
/* booked enough memory */
|
||||
char * szResult = ( char * ) hb_xgrab( nLen + 1 );
|
||||
|
||||
@@ -145,7 +145,7 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter,
|
||||
}
|
||||
}
|
||||
word_count++;
|
||||
hb_arrayAddForward( pReturn, hb_itemPutC( pTemp, szResult ));
|
||||
hb_arrayAddForward( pReturn, hb_itemPutC( pTemp, szResult ) );
|
||||
}
|
||||
/* delimiter found */
|
||||
else if( szText[ i ] == iDelimiter )
|
||||
@@ -262,10 +262,10 @@ static void hb_ParseLine( PHB_ITEM pReturn, const char * szText, int iDelimiter,
|
||||
|
||||
static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharCount, int * iWord )
|
||||
{
|
||||
char * buffer, * bufptr;
|
||||
char * buffer, * bufptr;
|
||||
char ** token_list;
|
||||
char last_char = '\0';
|
||||
int word_count = 0, word_nbr;
|
||||
char last_char = '\0';
|
||||
int word_count = 0, word_nbr;
|
||||
|
||||
buffer = ( char * ) hb_xgrab( iCharCount + 1 );
|
||||
|
||||
@@ -299,13 +299,13 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC
|
||||
|
||||
*bufptr = '\0';
|
||||
|
||||
token_list = ( char ** ) hb_xgrab( sizeof( char * ) * ( word_count + 2 ) );
|
||||
token_list = ( char ** ) hb_xgrab( sizeof( char * ) * ( word_count + 2 ) );
|
||||
token_list[ 0 ] = buffer;
|
||||
token_list++;
|
||||
|
||||
bufptr = buffer;
|
||||
|
||||
for(word_nbr = 0; word_nbr < word_count; word_nbr++)
|
||||
for( word_nbr = 0; word_nbr < word_count; word_nbr++ )
|
||||
{
|
||||
token_list[ word_nbr ] = bufptr;
|
||||
bufptr += strlen( bufptr ) + 1;
|
||||
@@ -318,7 +318,7 @@ static char ** hb_tokensplit( const char * string, HB_BYTE delimiter, int iCharC
|
||||
return token_list;
|
||||
}
|
||||
|
||||
static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount )
|
||||
static HB_BOOL file_read( FILE * stream, char * string, int * iCharCount )
|
||||
{
|
||||
int ch, cnbr = 0;
|
||||
|
||||
@@ -330,7 +330,7 @@ static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount )
|
||||
|
||||
if( ( ch == '\n' ) || ( ch == EOF ) || ( ch == 26 ) )
|
||||
{
|
||||
*iCharCount = cnbr;
|
||||
*iCharCount = cnbr;
|
||||
string[ cnbr ] = '\0';
|
||||
return ch == '\n' || cnbr;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount )
|
||||
|
||||
if( cnbr >= MAX_READ )
|
||||
{
|
||||
*iCharCount = cnbr;
|
||||
*iCharCount = cnbr;
|
||||
string[ MAX_READ ] = '\0';
|
||||
return HB_TRUE;
|
||||
}
|
||||
@@ -353,18 +353,18 @@ static HB_BOOL file_read( FILE *stream, char *string, int *iCharCount )
|
||||
|
||||
HB_FUNC( FPARSE )
|
||||
{
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
PHB_ITEM pDelim = hb_param( 2, HB_IT_STRING );
|
||||
PHB_ITEM pArray;
|
||||
PHB_ITEM pItem;
|
||||
char * string;
|
||||
char ** tokens;
|
||||
int iToken, iCharCount = 0;
|
||||
HB_BYTE nByte;
|
||||
char * string;
|
||||
char ** tokens;
|
||||
int iToken, iCharCount = 0;
|
||||
HB_BYTE nByte;
|
||||
|
||||
/* file parameter correctly passed */
|
||||
if( !pSrc )
|
||||
if( ! pSrc )
|
||||
{
|
||||
hb_reta( 0 );
|
||||
return;
|
||||
@@ -380,7 +380,7 @@ HB_FUNC( FPARSE )
|
||||
inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" );
|
||||
|
||||
/* return empty array on failure */
|
||||
if( !inFile )
|
||||
if( ! inFile )
|
||||
{
|
||||
hb_reta( 0 );
|
||||
return;
|
||||
@@ -391,7 +391,7 @@ HB_FUNC( FPARSE )
|
||||
|
||||
/* the main array */
|
||||
pArray = hb_itemArrayNew( 0 );
|
||||
pItem = hb_itemNew( NULL );
|
||||
pItem = hb_itemNew( NULL );
|
||||
|
||||
/* book memory for line to read */
|
||||
string = ( char * ) hb_xgrab( MAX_READ + 1 );
|
||||
@@ -431,17 +431,17 @@ HB_FUNC( FPARSE )
|
||||
|
||||
HB_FUNC( FPARSEEX )
|
||||
{
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
PHB_ITEM pDelim = hb_param( 2, HB_IT_STRING );
|
||||
PHB_ITEM pArray;
|
||||
PHB_ITEM pSubArray;
|
||||
char * string;
|
||||
int iCharCount = 0;
|
||||
HB_BYTE nByte;
|
||||
char * string;
|
||||
int iCharCount = 0;
|
||||
HB_BYTE nByte;
|
||||
|
||||
/* file parameter correctly passed */
|
||||
if( !pSrc )
|
||||
if( ! pSrc )
|
||||
{
|
||||
hb_reta( 0 );
|
||||
return;
|
||||
@@ -457,7 +457,7 @@ HB_FUNC( FPARSEEX )
|
||||
inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" );
|
||||
|
||||
/* return empty array on failure */
|
||||
if( !inFile )
|
||||
if( ! inFile )
|
||||
{
|
||||
hb_reta( 0 );
|
||||
return;
|
||||
@@ -467,7 +467,7 @@ HB_FUNC( FPARSEEX )
|
||||
nByte = pDelim ? ( HB_BYTE ) hb_itemGetCPtr( pDelim )[ 0 ] : ( HB_BYTE ) ',';
|
||||
|
||||
/* the main array */
|
||||
pArray = hb_itemArrayNew( 0 );
|
||||
pArray = hb_itemArrayNew( 0 );
|
||||
pSubArray = hb_itemNew( NULL );
|
||||
|
||||
/* book memory for line to read */
|
||||
@@ -497,16 +497,16 @@ HB_FUNC( FPARSEEX )
|
||||
|
||||
HB_FUNC( FWORDCOUNT )
|
||||
{
|
||||
FILE * inFile;
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
char *string;
|
||||
char **tokens;
|
||||
int iCharCount = 0;
|
||||
HB_BYTE nByte = ' ';
|
||||
HB_SIZE nWordCount = 0;
|
||||
char * string;
|
||||
char ** tokens;
|
||||
int iCharCount = 0;
|
||||
HB_BYTE nByte = ' ';
|
||||
HB_SIZE nWordCount = 0;
|
||||
|
||||
/* file parameter correctly passed */
|
||||
if( !pSrc )
|
||||
if( ! pSrc )
|
||||
{
|
||||
hb_retns( 0 );
|
||||
return;
|
||||
@@ -522,7 +522,7 @@ HB_FUNC( FWORDCOUNT )
|
||||
inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" );
|
||||
|
||||
/* return 0 on failure */
|
||||
if( !inFile )
|
||||
if( ! inFile )
|
||||
{
|
||||
hb_retns( 0 );
|
||||
return;
|
||||
@@ -556,13 +556,13 @@ HB_FUNC( FWORDCOUNT )
|
||||
|
||||
HB_FUNC( FLINECOUNT )
|
||||
{
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
HB_SIZE nLineCount = 0;
|
||||
int ch;
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
HB_SIZE nLineCount = 0;
|
||||
int ch;
|
||||
|
||||
/* file parameter correctly passed */
|
||||
if( !pSrc )
|
||||
if( ! pSrc )
|
||||
{
|
||||
hb_retns( 0 );
|
||||
return;
|
||||
@@ -578,7 +578,7 @@ HB_FUNC( FLINECOUNT )
|
||||
inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" );
|
||||
|
||||
/* return 0 on failure */
|
||||
if( !inFile )
|
||||
if( ! inFile )
|
||||
{
|
||||
hb_retns( 0 );
|
||||
return;
|
||||
@@ -602,13 +602,13 @@ HB_FUNC( FLINECOUNT )
|
||||
|
||||
HB_FUNC( FCHARCOUNT )
|
||||
{
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
HB_SIZE nResult = 0;
|
||||
int ch;
|
||||
FILE * inFile;
|
||||
PHB_ITEM pSrc = hb_param( 1, HB_IT_STRING );
|
||||
HB_SIZE nResult = 0;
|
||||
int ch;
|
||||
|
||||
/* file parameter correctly passed */
|
||||
if( !pSrc )
|
||||
if( ! pSrc )
|
||||
{
|
||||
hb_retns( 0 );
|
||||
return;
|
||||
@@ -624,7 +624,7 @@ HB_FUNC( FCHARCOUNT )
|
||||
inFile = hb_fopen( hb_itemGetCPtr( pSrc ), "r" );
|
||||
|
||||
/* return 0 on failure */
|
||||
if( !inFile )
|
||||
if( ! inFile )
|
||||
{
|
||||
hb_retns( 0 );
|
||||
return;
|
||||
@@ -635,13 +635,13 @@ HB_FUNC( FCHARCOUNT )
|
||||
{
|
||||
switch( ch )
|
||||
{
|
||||
case '\n':
|
||||
case '\r':
|
||||
case ' ':
|
||||
case '\t':
|
||||
break;
|
||||
default:
|
||||
nResult++;
|
||||
case '\n':
|
||||
case '\r':
|
||||
case ' ':
|
||||
case '\t':
|
||||
break;
|
||||
default:
|
||||
nResult++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -654,8 +654,8 @@ HB_FUNC( FCHARCOUNT )
|
||||
|
||||
HB_FUNC( FPARSELINE )
|
||||
{
|
||||
PHB_ITEM pArray;
|
||||
HB_ISIZ nWords = 0;
|
||||
PHB_ITEM pArray;
|
||||
HB_ISIZ nWords = 0;
|
||||
const char * szText;
|
||||
|
||||
pArray = hb_itemArrayNew( 0 );
|
||||
@@ -664,7 +664,7 @@ HB_FUNC( FPARSELINE )
|
||||
if( szText )
|
||||
{
|
||||
const char * szDelim = hb_parc( 2 );
|
||||
int iWords = 0;
|
||||
int iWords = 0;
|
||||
hb_ParseLine( pArray, szText, szDelim ? ( unsigned char ) *szDelim : ',', &iWords );
|
||||
nWords = iWords;
|
||||
}
|
||||
|
||||
@@ -56,16 +56,16 @@
|
||||
#include "hbapiitm.h"
|
||||
#include "hbapierr.h"
|
||||
|
||||
#define READING_BLOCK 4096
|
||||
#define READING_BLOCK 4096
|
||||
|
||||
static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const char ** pTerm, HB_ISIZ * pnTermSizes, HB_ISIZ nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF )
|
||||
{
|
||||
HB_ISIZ nPosTerm = 0, nPos, nPosition;
|
||||
int nTries;
|
||||
int nTries;
|
||||
HB_ISIZ nRead = 0, nOffset, nSize;
|
||||
char * pBuff;
|
||||
char * pBuff;
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_fsReadLine(%p, %" HB_PFS "d, %p, %p, %" HB_PFS "d, %p, %p)", ( void * ) ( HB_PTRDIFF ) hFileHandle, *plBuffLen, pTerm, pnTermSizes, nTerms, pbFound, pbEOF ));
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_fsReadLine(%p, %" HB_PFS "d, %p, %p, %" HB_PFS "d, %p, %p)", ( void * ) ( HB_PTRDIFF ) hFileHandle, *plBuffLen, pTerm, pnTermSizes, nTerms, pbFound, pbEOF ) );
|
||||
|
||||
*pbFound = HB_FALSE;
|
||||
*pbEOF = HB_FALSE;
|
||||
@@ -83,8 +83,8 @@ static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const
|
||||
if( nTries > 0 )
|
||||
{
|
||||
/* pBuff can be enlarged to hold the line as needed.. */
|
||||
nSize = ( *plBuffLen * ( nTries + 1 ) ) + 1;
|
||||
pBuff = ( char * ) hb_xrealloc( pBuff, nSize );
|
||||
nSize = ( *plBuffLen * ( nTries + 1 ) ) + 1;
|
||||
pBuff = ( char * ) hb_xrealloc( pBuff, nSize );
|
||||
nOffset += nRead;
|
||||
}
|
||||
|
||||
@@ -164,22 +164,22 @@ static char * hb_fsReadLine( HB_FHANDLE hFileHandle, HB_ISIZ * plBuffLen, const
|
||||
|
||||
HB_FUNC( HB_FREADLINE )
|
||||
{
|
||||
PHB_ITEM pTerm1;
|
||||
HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 );
|
||||
PHB_ITEM pTerm1;
|
||||
HB_FHANDLE hFileHandle = ( HB_FHANDLE ) hb_parnint( 1 );
|
||||
const char ** Term;
|
||||
char * pBuffer;
|
||||
HB_ISIZ * pnTermSizes;
|
||||
HB_ISIZ nSize = hb_parns( 4 );
|
||||
HB_ISIZ i, nTerms;
|
||||
HB_BOOL bFound, bEOF;
|
||||
char * pBuffer;
|
||||
HB_ISIZ * pnTermSizes;
|
||||
HB_ISIZ nSize = hb_parns( 4 );
|
||||
HB_ISIZ i, nTerms;
|
||||
HB_BOOL bFound, bEOF;
|
||||
|
||||
if( ( !HB_ISBYREF( 2 ) ) || ( !HB_ISNUM( 1 ) ) )
|
||||
if( ( ! HB_ISBYREF( 2 ) ) || ( ! HB_ISNUM( 1 ) ) )
|
||||
{
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 4,
|
||||
hb_paramError( 1 ),
|
||||
hb_paramError( 2 ),
|
||||
hb_paramError( 3 ),
|
||||
hb_paramError( 4 ) );
|
||||
hb_paramError( 1 ),
|
||||
hb_paramError( 2 ),
|
||||
hb_paramError( 3 ),
|
||||
hb_paramError( 4 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -193,14 +193,14 @@ HB_FUNC( HB_FREADLINE )
|
||||
if( nTerms <= 0 )
|
||||
{
|
||||
hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, 4,
|
||||
hb_paramError( 1 ),
|
||||
hb_paramError( 2 ),
|
||||
hb_paramError( 3 ),
|
||||
hb_paramError( 4 ) );
|
||||
hb_paramError( 1 ),
|
||||
hb_paramError( 2 ),
|
||||
hb_paramError( 3 ),
|
||||
hb_paramError( 4 ) );
|
||||
return;
|
||||
}
|
||||
|
||||
Term = ( const char ** ) hb_xgrab( sizeof( char * ) * nTerms );
|
||||
Term = ( const char ** ) hb_xgrab( sizeof( char * ) * nTerms );
|
||||
pnTermSizes = ( HB_ISIZ * ) hb_xgrab( sizeof( HB_ISIZ ) * nTerms );
|
||||
|
||||
for( i = 0; i < nTerms; i++ )
|
||||
|
||||
@@ -60,19 +60,21 @@
|
||||
|
||||
#ifdef __XHARBOUR__
|
||||
|
||||
#define hb_retc_buffer( szText ) hb_retcAdopt( (szText) )
|
||||
#define hb_retclen_buffer( szText, ulLen ) hb_retclenAdopt( (szText), (ulLen) )
|
||||
#define hb_retc_const( szText ) hb_retcStatic( (szText) )
|
||||
#define hb_storclen_buffer hb_storclenAdopt
|
||||
#define hb_itemPutCLConst hb_itemPutCRawStatic
|
||||
#define hb_retc_buffer( szText ) hb_retcAdopt( ( szText ) )
|
||||
#define hb_retclen_buffer( szText, ulLen ) hb_retclenAdopt( ( szText ), ( ulLen ) )
|
||||
#define hb_retc_const( szText ) hb_retcStatic( ( szText ) )
|
||||
|
||||
#define hb_storclen_buffer hb_storclenAdopt
|
||||
#define hb_itemPutCLConst hb_itemPutCRawStatic
|
||||
|
||||
#else
|
||||
|
||||
#define hb_retcAdopt( szText ) hb_retc_buffer( (szText) )
|
||||
#define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( (szText), (ulLen) )
|
||||
#define hb_retcStatic( szText ) hb_retc_const( (szText) )
|
||||
#define hb_storclenAdopt hb_storclen_buffer
|
||||
#define hb_itemPutCRawStatic hb_itemPutCLConst
|
||||
#define hb_retcAdopt( szText ) hb_retc_buffer( ( szText ) )
|
||||
#define hb_retclenAdopt( szText, ulLen ) hb_retclen_buffer( ( szText ), ( ulLen ) )
|
||||
#define hb_retcStatic( szText ) hb_retc_const( ( szText ) )
|
||||
|
||||
#define hb_storclenAdopt hb_storclen_buffer
|
||||
#define hb_itemPutCRawStatic hb_itemPutCLConst
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -52,15 +52,15 @@
|
||||
*/
|
||||
|
||||
/***************************************************************
|
||||
* NXS aglorithm is FREE SOFTWARE. It can be reused for any
|
||||
* purpose, provided that this copyright notice is still present
|
||||
* in the software.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY that it can
|
||||
* fit any particular need.
|
||||
*
|
||||
* NXS author is Giancarlo Niccolai <giancarlo@niccolai.ws>
|
||||
**************************************************************/
|
||||
* NXS aglorithm is FREE SOFTWARE. It can be reused for any
|
||||
* purpose, provided that this copyright notice is still present
|
||||
* in the software.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY that it can
|
||||
* fit any particular need.
|
||||
*
|
||||
* NXS author is Giancarlo Niccolai <giancarlo@niccolai.ws>
|
||||
**************************************************************/
|
||||
|
||||
|
||||
#include "hbapi.h"
|
||||
@@ -69,15 +69,15 @@
|
||||
#include "hbchksum.h"
|
||||
#include "hbnxs.h"
|
||||
|
||||
#define BASE 65521L /* largest prime smaller than 65536 */
|
||||
#define BASE 65521L /* largest prime smaller than 65536 */
|
||||
|
||||
/* Giancarlo Niccolai's x scrambler algorithm
|
||||
* Prerequisites:
|
||||
* 1) source must be at least 8 bytes long.
|
||||
* 2) key must be at least 6 characters long.
|
||||
* Optimal lenght is about 12 to 16 bytes. Maximum keylen is 512 bytes
|
||||
* 3) cipher must be preallocated with srclen bytes
|
||||
*/
|
||||
* Prerequisites:
|
||||
* 1) source must be at least 8 bytes long.
|
||||
* 2) key must be at least 6 characters long.
|
||||
* Optimal lenght is about 12 to 16 bytes. Maximum keylen is 512 bytes
|
||||
* 3) cipher must be preallocated with srclen bytes
|
||||
*/
|
||||
|
||||
void nxs_crypt(
|
||||
const unsigned char * source, HB_SIZE srclen,
|
||||
@@ -127,7 +127,7 @@ void nxs_decrypt(
|
||||
}
|
||||
|
||||
/* This function scrambles the source using the letter ordering in the
|
||||
* key. */
|
||||
* key. */
|
||||
void nxs_scramble(
|
||||
const unsigned char * source, HB_SIZE srclen,
|
||||
const unsigned char * key, HB_SIZE keylen,
|
||||
@@ -160,10 +160,10 @@ void nxs_partial_scramble(
|
||||
HB_ISIZ * scramble,
|
||||
HB_SIZE len, HB_SIZE keylen )
|
||||
{
|
||||
HB_SIZE pos;
|
||||
HB_SIZE pos;
|
||||
HB_USHORT kpos;
|
||||
|
||||
pos = 0;
|
||||
pos = 0;
|
||||
kpos = 0;
|
||||
while( pos + kpos < len )
|
||||
{
|
||||
@@ -179,8 +179,8 @@ void nxs_partial_scramble(
|
||||
|
||||
/* Reversing scramble process */
|
||||
void nxs_unscramble(
|
||||
unsigned char * cipher, HB_SIZE cipherlen,
|
||||
const unsigned char * key, HB_SIZE keylen )
|
||||
unsigned char * cipher, HB_SIZE cipherlen,
|
||||
const unsigned char * key, HB_SIZE keylen )
|
||||
{
|
||||
HB_ISIZ scramble[ NXS_MAX_KEYLEN ];
|
||||
HB_SIZE len;
|
||||
@@ -209,11 +209,11 @@ void nxs_partial_unscramble(
|
||||
HB_ISIZ * scramble,
|
||||
HB_SIZE len, HB_SIZE keylen )
|
||||
{
|
||||
HB_SIZE pos;
|
||||
HB_USHORT kpos;
|
||||
HB_SIZE pos;
|
||||
HB_USHORT kpos;
|
||||
unsigned char buf[ NXS_MAX_KEYLEN ];
|
||||
|
||||
pos = 0;
|
||||
pos = 0;
|
||||
kpos = 0;
|
||||
while( pos + kpos < len )
|
||||
{
|
||||
@@ -234,8 +234,8 @@ void nxs_xorcode(
|
||||
unsigned char * cipher, HB_SIZE cipherlen,
|
||||
const unsigned char * key, HB_SIZE keylen )
|
||||
{
|
||||
HB_SIZE pos = 0;
|
||||
HB_USHORT keypos = 0;
|
||||
HB_SIZE pos = 0;
|
||||
HB_USHORT keypos = 0;
|
||||
unsigned char c_bitrest;
|
||||
|
||||
c_bitrest = cipher[ 0 ] >> 5;
|
||||
@@ -255,7 +255,7 @@ void nxs_xorcode(
|
||||
|
||||
if( keypos == ( HB_USHORT ) keylen )
|
||||
{
|
||||
keypos = 0;
|
||||
keypos = 0;
|
||||
c_bitrest = cipher[ pos ] >> 5;
|
||||
}
|
||||
}
|
||||
@@ -265,8 +265,8 @@ void nxs_xordecode(
|
||||
unsigned char * cipher, HB_SIZE cipherlen,
|
||||
const unsigned char * key, HB_SIZE keylen )
|
||||
{
|
||||
HB_SIZE pos = 0;
|
||||
HB_USHORT keypos = 0;
|
||||
HB_SIZE pos = 0;
|
||||
HB_USHORT keypos = 0;
|
||||
unsigned char c_bitrest, c_bitleft;
|
||||
|
||||
/* A very short block? */
|
||||
@@ -279,10 +279,10 @@ void nxs_xordecode(
|
||||
{
|
||||
cipher[ pos ] ^= key[ keypos ];
|
||||
|
||||
c_bitrest = cipher[ pos ] << 5;
|
||||
c_bitrest = cipher[ pos ] << 5;
|
||||
cipher[ pos ] >>= 3;
|
||||
cipher[ pos ] |= c_bitleft;
|
||||
c_bitleft = c_bitrest;
|
||||
cipher[ pos ] |= c_bitleft;
|
||||
c_bitleft = c_bitrest;
|
||||
|
||||
keypos++;
|
||||
pos++;
|
||||
@@ -307,8 +307,8 @@ void nxs_xorcyclic(
|
||||
const unsigned char * key, HB_SIZE keylen )
|
||||
{
|
||||
HB_SIZE pos = 0, crcpos = 0;
|
||||
HB_U32 crc1, crc2, crc3;
|
||||
HB_U32 crc1l, crc2l, crc3l;
|
||||
HB_U32 crc1, crc2, crc3;
|
||||
HB_U32 crc1l, crc2l, crc3l;
|
||||
|
||||
/* Build the cyclic key seed */
|
||||
crc1 = keylen >= 2 ? hb_adler32( 0, ( const char * ) key + 0, keylen - 2 ) : 1;
|
||||
@@ -325,17 +325,17 @@ void nxs_xorcyclic(
|
||||
{
|
||||
/* this ensures portability across platforms */
|
||||
cipher[ pos ] ^= ( unsigned char ) ( crc1l % 256 );
|
||||
crc1l /= 256L;
|
||||
crc1l /= 256L;
|
||||
}
|
||||
else if( crcpos < 8 )
|
||||
{
|
||||
cipher[ pos ] ^= ( unsigned char ) ( crc2l % 256 );
|
||||
crc2l /= 256L;
|
||||
crc2l /= 256L;
|
||||
}
|
||||
else
|
||||
{
|
||||
cipher[ pos ] ^= ( unsigned char ) ( crc3l % 256 );
|
||||
crc3l /= 256L;
|
||||
crc3l /= 256L;
|
||||
}
|
||||
crcpos++;
|
||||
pos++;
|
||||
@@ -343,19 +343,19 @@ void nxs_xorcyclic(
|
||||
if( crcpos == 12 )
|
||||
{
|
||||
crcpos = 0;
|
||||
crc1l = crc1 = nxs_cyclic_sequence( crc1 );
|
||||
crc2l = crc2 = nxs_cyclic_sequence( crc2 );
|
||||
crc3l = crc3 = nxs_cyclic_sequence( crc3 );
|
||||
crc1l = crc1 = nxs_cyclic_sequence( crc1 );
|
||||
crc2l = crc2 = nxs_cyclic_sequence( crc2 );
|
||||
crc3l = crc3 = nxs_cyclic_sequence( crc3 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HB_U32 nxs_cyclic_sequence( HB_U32 input )
|
||||
{
|
||||
HB_U32 first = input & 0xffff;
|
||||
HB_U32 first = input & 0xffff;
|
||||
HB_U32 second = input >> 16;
|
||||
HB_U32 ret = ( ( second * BASE * BASE ) & 0xffff ) |
|
||||
( ( first * BASE * BASE ) & 0xffff0000 );
|
||||
HB_U32 ret = ( ( second * BASE * BASE ) & 0xffff ) |
|
||||
( ( first * BASE * BASE ) & 0xffff0000 );
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -384,23 +384,23 @@ void nxs_make_scramble( HB_ISIZ * scramble, const unsigned char * key, HB_SIZE k
|
||||
}
|
||||
|
||||
/*
|
||||
* END OF NXS
|
||||
*/
|
||||
* END OF NXS
|
||||
*/
|
||||
|
||||
/***********************************
|
||||
* XHarbour implementation
|
||||
************************************/
|
||||
* XHarbour implementation
|
||||
************************************/
|
||||
|
||||
/*****
|
||||
* Encrypt a text using a key
|
||||
* Usage:
|
||||
* HB_Crypt( cSource, cKey ) --> cCipher
|
||||
*/
|
||||
* Encrypt a text using a key
|
||||
* Usage:
|
||||
* HB_Crypt( cSource, cKey ) --> cCipher
|
||||
*/
|
||||
|
||||
HB_FUNC( HB_CRYPT )
|
||||
{
|
||||
PHB_ITEM pSource = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pKey = hb_param( 2, HB_IT_ANY );
|
||||
PHB_ITEM pKey = hb_param( 2, HB_IT_ANY );
|
||||
|
||||
unsigned char * cRes = ( unsigned char * ) hb_xgrab( hb_itemGetCLen( pSource ) + 8 );
|
||||
|
||||
@@ -413,15 +413,15 @@ HB_FUNC( HB_CRYPT )
|
||||
}
|
||||
|
||||
/*****
|
||||
* Decrypt a text using a key
|
||||
* Usage:
|
||||
* HB_Decrypt( cCrypt, cKey ) --> cSource
|
||||
*/
|
||||
* Decrypt a text using a key
|
||||
* Usage:
|
||||
* HB_Decrypt( cCrypt, cKey ) --> cSource
|
||||
*/
|
||||
|
||||
HB_FUNC( HB_DECRYPT )
|
||||
{
|
||||
PHB_ITEM pSource = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pKey = hb_param( 2, HB_IT_ANY );
|
||||
PHB_ITEM pKey = hb_param( 2, HB_IT_ANY );
|
||||
|
||||
unsigned char * cRes = ( unsigned char * ) hb_xgrab( hb_itemGetCLen( pSource ) + 8 );
|
||||
|
||||
|
||||
@@ -52,24 +52,24 @@
|
||||
*/
|
||||
|
||||
/***************************************************************
|
||||
* NXS aglorithm is FREE SOFTWARE. It can be reused for any
|
||||
* purpose, provided that this copiright notice is still present
|
||||
* in the software.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY that it can
|
||||
* fit any particular need.
|
||||
*
|
||||
* NXS author is Giancarlo Niccolai <giancarlo@niccolai.ws>
|
||||
*
|
||||
* Adler 32 CRC is copyrighted by Martin Adler
|
||||
**************************************************************/
|
||||
* NXS aglorithm is FREE SOFTWARE. It can be reused for any
|
||||
* purpose, provided that this copiright notice is still present
|
||||
* in the software.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY that it can
|
||||
* fit any particular need.
|
||||
*
|
||||
* NXS author is Giancarlo Niccolai <giancarlo@niccolai.ws>
|
||||
*
|
||||
* Adler 32 CRC is copyrighted by Martin Adler
|
||||
**************************************************************/
|
||||
|
||||
#ifndef HBNXS_H
|
||||
#define HBNXS_H
|
||||
|
||||
#include "hbdefs.h"
|
||||
|
||||
#define NXS_MAX_KEYLEN 256
|
||||
#define NXS_MAX_KEYLEN 256
|
||||
|
||||
void nxs_crypt(
|
||||
const unsigned char * source, HB_SIZE srclen,
|
||||
@@ -98,7 +98,7 @@ void nxs_partial_unscramble(
|
||||
|
||||
void nxs_unscramble(
|
||||
unsigned char * cipher, HB_SIZE cypherlen,
|
||||
const unsigned char * key, HB_SIZE keylen);
|
||||
const unsigned char * key, HB_SIZE keylen );
|
||||
|
||||
void nxs_xorcode(
|
||||
unsigned char * cipher, HB_SIZE cipherlen,
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
to be managed from the main thread. Every thread may use it,
|
||||
but only the main thread should be allowed to activate the
|
||||
debug window.
|
||||
*/
|
||||
*/
|
||||
|
||||
#include "hbapi.h"
|
||||
#include "hbapiitm.h"
|
||||
@@ -67,7 +67,7 @@
|
||||
#include "hbwinuni.h"
|
||||
#endif
|
||||
|
||||
#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS )
|
||||
#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS )
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
@@ -77,17 +77,17 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
static int s_iDebugFd = 0;
|
||||
static int s_iDebugFd = 0;
|
||||
static char s_szDebugName[ 128 ];
|
||||
static int s_iUseDebugName = 0;
|
||||
static int s_iXtermPid = 0;
|
||||
static int s_iUseDebugName = 0;
|
||||
static int s_iXtermPid = 0;
|
||||
|
||||
static void debugInit( void )
|
||||
{
|
||||
int iPid, iFifoResult;
|
||||
char szDebugTitle[ 30 ];
|
||||
int iPid, iFifoResult;
|
||||
char szDebugTitle[ 30 ];
|
||||
PHB_FNAME pFileName = NULL;
|
||||
char szDebugName[ 128 ];
|
||||
char szDebugName[ 128 ];
|
||||
|
||||
if( ! s_iUseDebugName )
|
||||
{
|
||||
@@ -112,7 +112,7 @@ static void debugInit( void )
|
||||
iPid = fork();
|
||||
if( iPid != 0 )
|
||||
{
|
||||
s_iDebugFd = open( szDebugName, O_WRONLY );
|
||||
s_iDebugFd = open( szDebugName, O_WRONLY );
|
||||
s_iXtermPid = iPid;
|
||||
}
|
||||
else
|
||||
@@ -142,15 +142,15 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName )
|
||||
{
|
||||
HB_BOOL bRet;
|
||||
|
||||
#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS )
|
||||
if( s_iDebugFd == 0 && pName != NULL)
|
||||
#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS )
|
||||
if( s_iDebugFd == 0 && pName != NULL )
|
||||
{
|
||||
hb_strncpy( s_szDebugName, hb_itemGetCPtr( pName ), sizeof( s_szDebugName ) - 1 );
|
||||
s_iUseDebugName = 1;
|
||||
|
||||
bRet = HB_TRUE;
|
||||
}
|
||||
else if( pName == NULL)
|
||||
else if( pName == NULL )
|
||||
{
|
||||
s_iUseDebugName = 0;
|
||||
bRet = HB_TRUE;
|
||||
@@ -169,7 +169,7 @@ HB_BOOL hb_OutDebugName( PHB_ITEM pName )
|
||||
|
||||
void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen )
|
||||
{
|
||||
#if defined( HB_OS_UNIX ) && !defined( HB_OS_VXWORKS )
|
||||
#if defined( HB_OS_UNIX ) && ! defined( HB_OS_VXWORKS )
|
||||
int iStatus, iPid;
|
||||
|
||||
/* Are we under X? */
|
||||
@@ -185,7 +185,7 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen )
|
||||
/* Chech if display process has terminated in the meanwhile */
|
||||
if( ! s_iUseDebugName )
|
||||
{
|
||||
iPid = waitpid( s_iXtermPid, &iStatus, WNOHANG );
|
||||
iPid = waitpid( s_iXtermPid, &iStatus, WNOHANG );
|
||||
if( iPid == s_iXtermPid || iPid == -1 )
|
||||
{
|
||||
s_iXtermPid = 0;
|
||||
@@ -206,13 +206,15 @@ void hb_OutDebug( const char * szMsg, HB_SIZE nMsgLen )
|
||||
{
|
||||
if( ( HB_SIZE ) write( s_iDebugFd, szMsg, nMsgLen ) == nMsgLen )
|
||||
{
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 100000;
|
||||
FD_ZERO( &wrds );
|
||||
FD_SET( s_iDebugFd, &wrds );
|
||||
if( select( s_iDebugFd + 1, NULL, &wrds, NULL, &tv ) > 0 )
|
||||
{
|
||||
if( write( s_iDebugFd, "\n", 1 ) != 1 ) {}
|
||||
if( write( s_iDebugFd, "\n", 1 ) != 1 )
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v )
|
||||
bSignalEnabled = HB_TRUE;
|
||||
/*s_serviceSetHBSig();*/
|
||||
|
||||
/* TODO
|
||||
#if 0
|
||||
if( uiSig != HB_SIGNAL_UNKNOWN )
|
||||
{
|
||||
if( sa_oldAction[ sig ].sa_flags & SA_SIGINFO )
|
||||
@@ -262,7 +262,7 @@ static void s_signalHandler( int sig, siginfo_t * info, void * v )
|
||||
else
|
||||
sa_oldAction[ sig ].sa_handler( sig );
|
||||
}
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
/* 2003 - <maurilio.longo@libero.it>
|
||||
@@ -1107,13 +1107,13 @@ HB_FUNC( HB_SERVICEGENERATEFPE )
|
||||
|
||||
#else
|
||||
|
||||
HB_FUNC( HB_STARTSERVICE ) {;}
|
||||
HB_FUNC( HB_ISSERVICE ) {;}
|
||||
HB_FUNC( HB_SERVICELOOP ) {;}
|
||||
HB_FUNC( HB_PUSHSIGNALHANDLER ) {;}
|
||||
HB_FUNC( HB_POPSIGNALHANDLER ) {;}
|
||||
HB_FUNC( HB_SIGNALDESC ) {;}
|
||||
HB_FUNC( HB_SERVICEGENERATEFAULT ) {;}
|
||||
HB_FUNC( HB_SERVICEGENERATEFPE ) {;}
|
||||
HB_FUNC( HB_STARTSERVICE ) {}
|
||||
HB_FUNC( HB_ISSERVICE ) {}
|
||||
HB_FUNC( HB_SERVICELOOP ) {}
|
||||
HB_FUNC( HB_PUSHSIGNALHANDLER ) {}
|
||||
HB_FUNC( HB_POPSIGNALHANDLER ) {}
|
||||
HB_FUNC( HB_SIGNALDESC ) {}
|
||||
HB_FUNC( HB_SERVICEGENERATEFAULT ) {}
|
||||
HB_FUNC( HB_SERVICEGENERATEFPE ) {}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,51 +53,51 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* MXML (Mini XML) Library related copyright notice.
|
||||
* (referring to Harbour/xHarbour version).
|
||||
*
|
||||
* This source file contains a modified version of MXML (Mini XML)
|
||||
* library, developed by Giancarlo Niccolai. MXML is released under
|
||||
* LGPL license; this modified version (called HBXML) is released under
|
||||
* GPL with HARBOUR exception. HBXML license does not extends into
|
||||
* MXML; HBXML and any modification to HBXML is to be considered as
|
||||
* a part of Harbour or xHarbour projects, as it is modified to
|
||||
* be specifically working in the context of the compiler's RTL.
|
||||
*
|
||||
* Original MXML lib can be obtained requesting it at
|
||||
* Giancarlo Niccolai <giancarlo@niccolai.org>
|
||||
*/
|
||||
* MXML (Mini XML) Library related copyright notice.
|
||||
* (referring to Harbour/xHarbour version).
|
||||
*
|
||||
* This source file contains a modified version of MXML (Mini XML)
|
||||
* library, developed by Giancarlo Niccolai. MXML is released under
|
||||
* LGPL license; this modified version (called HBXML) is released under
|
||||
* GPL with HARBOUR exception. HBXML license does not extends into
|
||||
* MXML; HBXML and any modification to HBXML is to be considered as
|
||||
* a part of Harbour or xHarbour projects, as it is modified to
|
||||
* be specifically working in the context of the compiler's RTL.
|
||||
*
|
||||
* Original MXML lib can be obtained requesting it at
|
||||
* Giancarlo Niccolai <giancarlo@niccolai.org>
|
||||
*/
|
||||
|
||||
#ifndef HB_XML_H
|
||||
#define HB_XML_H
|
||||
|
||||
/* Standard definitions */
|
||||
#ifdef HB_OS_MAC
|
||||
#define MXML_LINE_TERMINATOR '\r'
|
||||
#define MXML_SOFT_LINE_TERMINATOR '\n'
|
||||
#define MXML_LINE_TERMINATOR '\r'
|
||||
#define MXML_SOFT_LINE_TERMINATOR '\n'
|
||||
#else
|
||||
/*Notice, this works for unix AND windows */
|
||||
#define MXML_LINE_TERMINATOR '\n'
|
||||
#define MXML_SOFT_LINE_TERMINATOR '\r'
|
||||
/*Notice, this works for unix AND windows */
|
||||
#define MXML_LINE_TERMINATOR '\n'
|
||||
#define MXML_SOFT_LINE_TERMINATOR '\r'
|
||||
#endif
|
||||
|
||||
#define MXML_EOF -256
|
||||
#define MXML_EOF -256
|
||||
|
||||
#define MXML_ALLOC_BLOCK 128
|
||||
#define MXML_MAX_DEPTH 64
|
||||
#define MXML_ALLOC_BLOCK 128
|
||||
#define MXML_MAX_DEPTH 64
|
||||
|
||||
/* Styles */
|
||||
#define MXML_STYLE_INDENT 0x0001
|
||||
#define MXML_STYLE_TAB 0x0002
|
||||
#define MXML_STYLE_THREESPACES 0x0004
|
||||
#define MXML_STYLE_NOESCAPE 0x0008
|
||||
#define MXML_STYLE_INDENT 0x0001
|
||||
#define MXML_STYLE_TAB 0x0002
|
||||
#define MXML_STYLE_THREESPACES 0x0004
|
||||
#define MXML_STYLE_NOESCAPE 0x0008
|
||||
|
||||
/* Status vaules */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MXML_STATUS_ERROR=0,
|
||||
MXML_STATUS_OK=1,
|
||||
MXML_STATUS_ERROR = 0,
|
||||
MXML_STATUS_OK = 1,
|
||||
MXML_STATUS_MORE,
|
||||
MXML_STATUS_DONE,
|
||||
MXML_STATUS_UNDEFINED,
|
||||
@@ -108,7 +108,7 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
MXML_ERROR_NONE = 0,
|
||||
MXML_ERROR_IO = 1,
|
||||
MXML_ERROR_IO = 1,
|
||||
MXML_ERROR_NOMEM,
|
||||
|
||||
MXML_ERROR_OUTCHAR,
|
||||
@@ -128,7 +128,7 @@ typedef enum
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MXML_TYPE_TAG=0,
|
||||
MXML_TYPE_TAG = 0,
|
||||
MXML_TYPE_COMMENT,
|
||||
MXML_TYPE_PI,
|
||||
MXML_TYPE_DIRECTIVE,
|
||||
@@ -141,12 +141,12 @@ typedef enum
|
||||
struct tag_mxml_refil;
|
||||
struct tag_mxml_output;
|
||||
|
||||
typedef void (*MXML_REFIL_FUNC)( struct tag_mxml_refil *ref );
|
||||
typedef void (*MXML_OUTPUT_FUNC)( struct tag_mxml_output *out, const char *data, HB_ISIZ len );
|
||||
typedef void ( *MXML_REFIL_FUNC )( struct tag_mxml_refil * ref );
|
||||
typedef void ( *MXML_OUTPUT_FUNC )( struct tag_mxml_output * out, const char * data, HB_ISIZ len );
|
||||
|
||||
/*************************************************
|
||||
Structures holding the XML data
|
||||
**************************************************/
|
||||
**************************************************/
|
||||
|
||||
|
||||
/* Refiller */
|
||||
@@ -154,14 +154,14 @@ typedef void (*MXML_OUTPUT_FUNC)( struct tag_mxml_output *out, const char *data,
|
||||
typedef struct tag_mxml_refil
|
||||
{
|
||||
/* status variables */
|
||||
MXML_STATUS status;
|
||||
MXML_STATUS status;
|
||||
MXML_ERROR_CODE error;
|
||||
|
||||
/* buffer for reading data */
|
||||
unsigned char *buffer;
|
||||
HB_ISIZ bufsize; /* size of the whole buffer */
|
||||
HB_ISIZ buflen; /* valid characters in the current buffer */
|
||||
HB_ISIZ bufpos; /* current position */
|
||||
unsigned char * buffer;
|
||||
HB_ISIZ bufsize; /* size of the whole buffer */
|
||||
HB_ISIZ buflen; /* valid characters in the current buffer */
|
||||
HB_ISIZ bufpos; /* current position */
|
||||
|
||||
/* lenght of the stream for implementing progress indicators */
|
||||
HB_ISIZ streampos;
|
||||
@@ -186,11 +186,11 @@ typedef struct tag_mxml_refil
|
||||
typedef struct tag_mxml_output
|
||||
{
|
||||
/* status variables */
|
||||
MXML_STATUS status;
|
||||
MXML_STATUS status;
|
||||
MXML_ERROR_CODE error;
|
||||
|
||||
/* output operation */
|
||||
MXML_OUTPUT_FUNC output_func;
|
||||
MXML_OUTPUT_FUNC output_func;
|
||||
|
||||
/* data to implement progress indicators */
|
||||
int node_count;
|
||||
@@ -208,28 +208,29 @@ typedef struct tag_mxml_output
|
||||
|
||||
typedef struct tag_mxml_self_growing_string
|
||||
{
|
||||
char * buffer;
|
||||
char * buffer;
|
||||
HB_ISIZ allocated;
|
||||
HB_ISIZ length;
|
||||
} MXML_SGS;
|
||||
|
||||
typedef struct _hbxml_attribute {
|
||||
typedef struct _hbxml_attribute
|
||||
{
|
||||
PHB_ITEM pName;
|
||||
PHB_ITEM pValue;
|
||||
} HBXML_ATTRIBUTE, *PHBXML_ATTRIBUTE;
|
||||
} HBXML_ATTRIBUTE, * PHBXML_ATTRIBUTE;
|
||||
|
||||
|
||||
/* Allocator and deletor functions are meant to be redeclared by includers */
|
||||
#ifndef MXML_ALLOCATOR
|
||||
#define MXML_ALLOCATOR hb_xgrab
|
||||
#define MXML_ALLOCATOR hb_xgrab
|
||||
#endif
|
||||
|
||||
#ifndef MXML_DELETOR
|
||||
#define MXML_DELETOR hb_xfree
|
||||
#define MXML_DELETOR hb_xfree
|
||||
#endif
|
||||
|
||||
#ifndef MXML_REALLOCATOR
|
||||
#define MXML_REALLOCATOR hb_xrealloc
|
||||
#define MXML_REALLOCATOR hb_xrealloc
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -58,23 +58,23 @@
|
||||
|
||||
static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen, HB_SIZE nTabLen, HB_BOOL bWrap, const char ** pTerm, HB_SIZE * pnTermSizes, HB_SIZE nTerms, HB_BOOL * pbFound, HB_BOOL * pbEOF, HB_ISIZ * pnEnd, HB_SIZE * pnEndOffset )
|
||||
{
|
||||
HB_SIZE nPosTerm, nPosition;
|
||||
HB_SIZE nPos, nCurrCol, nLastBlk;
|
||||
HB_BOOL bBreak = HB_FALSE;
|
||||
HB_SIZE nPosTerm, nPosition;
|
||||
HB_SIZE nPos, nCurrCol, nLastBlk;
|
||||
HB_BOOL bBreak = HB_FALSE;
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_readLine(%p, %" HB_PFS "u, %" HB_PFS "u, %" HB_PFS "u, %d, %p, %p, %" HB_PFS "u, %p, %p, %p, %p)", szText, nTextLen, nLineLen, nTabLen, bWrap, pTerm, pnTermSizes, nTerms, pbFound, pbEOF, pnEnd, pnEndOffset ) );
|
||||
|
||||
*pbFound = HB_FALSE;
|
||||
*pbEOF = HB_FALSE;
|
||||
*pnEnd = 0;
|
||||
*pnEndOffset = 0;
|
||||
nCurrCol = 0;
|
||||
nLastBlk = 0;
|
||||
*pbFound = HB_FALSE;
|
||||
*pbEOF = HB_FALSE;
|
||||
*pnEnd = 0;
|
||||
*pnEndOffset = 0;
|
||||
nCurrCol = 0;
|
||||
nLastBlk = 0;
|
||||
|
||||
if( nTextLen == 0 )
|
||||
{
|
||||
*pnEnd = -1;
|
||||
*pbEOF = HB_TRUE;
|
||||
*pnEnd = -1;
|
||||
*pbEOF = HB_TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -103,13 +103,13 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen
|
||||
{
|
||||
if( nPos == 0 )
|
||||
{
|
||||
*pnEnd = -1;
|
||||
*pnEndOffset = pnTermSizes[ nPosTerm ];
|
||||
*pnEnd = -1;
|
||||
*pnEndOffset = pnTermSizes[ nPosTerm ];
|
||||
}
|
||||
else
|
||||
{
|
||||
*pnEnd = nPos - 1;
|
||||
*pnEndOffset = nPos + pnTermSizes[ nPosTerm ];
|
||||
*pnEnd = nPos - 1;
|
||||
*pnEndOffset = nPos + pnTermSizes[ nPosTerm ];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -145,16 +145,16 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen
|
||||
{
|
||||
if( ! bWrap || nLastBlk == 0 )
|
||||
{
|
||||
*pnEnd = nPos - 1;
|
||||
*pnEndOffset = nPos;
|
||||
bBreak = 1;
|
||||
*pnEnd = nPos - 1;
|
||||
*pnEndOffset = nPos;
|
||||
bBreak = 1;
|
||||
break;
|
||||
}
|
||||
else if( bWrap && nLastBlk != 0 )
|
||||
{
|
||||
*pnEnd = nLastBlk;
|
||||
*pnEndOffset = nLastBlk + 1;
|
||||
bBreak = 1;
|
||||
*pnEnd = nLastBlk;
|
||||
*pnEndOffset = nLastBlk + 1;
|
||||
bBreak = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -162,9 +162,9 @@ static void hb_readLine( const char * szText, HB_SIZE nTextLen, HB_SIZE nLineLen
|
||||
|
||||
if( ! *pbFound && ! bBreak )
|
||||
{
|
||||
*pnEnd = nTextLen - 1;
|
||||
*pnEndOffset = nTextLen - 1;
|
||||
*pbEOF = HB_TRUE;
|
||||
*pnEnd = nTextLen - 1;
|
||||
*pnEndOffset = nTextLen - 1;
|
||||
*pbEOF = HB_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,12 +193,12 @@ static HB_ISIZ hb_tabexpand( const char * szString, char * szRet, HB_ISIZ nEnd,
|
||||
|
||||
HB_FUNC( HB_TABEXPAND )
|
||||
{
|
||||
const char * szText = hb_parcx( 1 );
|
||||
HB_ISIZ nStrLen = hb_parclen( 1 );
|
||||
HB_SIZE nTabLen = hb_parns( 2 );
|
||||
HB_SIZE nTabCount = 0;
|
||||
HB_ISIZ nPos, nSize;
|
||||
char * szRet;
|
||||
const char * szText = hb_parcx( 1 );
|
||||
HB_ISIZ nStrLen = hb_parclen( 1 );
|
||||
HB_SIZE nTabLen = hb_parns( 2 );
|
||||
HB_SIZE nTabCount = 0;
|
||||
HB_ISIZ nPos, nSize;
|
||||
char * szRet;
|
||||
|
||||
for( nPos = 0; nPos < nStrLen; nPos++ )
|
||||
{
|
||||
@@ -212,10 +212,10 @@ HB_FUNC( HB_TABEXPAND )
|
||||
}
|
||||
else
|
||||
{
|
||||
nSize = nStrLen + nTabCount * ( nTabLen - 1 );
|
||||
szRet = ( char * ) hb_xgrab( nSize + 1 );
|
||||
nSize = nStrLen + nTabCount * ( nTabLen - 1 );
|
||||
szRet = ( char * ) hb_xgrab( nSize + 1 );
|
||||
memset( szRet, ' ', nSize );
|
||||
nStrLen = hb_tabexpand( szText, szRet, nStrLen, nTabLen );
|
||||
nStrLen = hb_tabexpand( szText, szRet, nStrLen, nTabLen );
|
||||
hb_retclen_buffer( szRet, nStrLen );
|
||||
}
|
||||
}
|
||||
@@ -223,20 +223,20 @@ HB_FUNC( HB_TABEXPAND )
|
||||
/* HB_READLINE( <cText>, [<aTerminators | cTerminator>], <nLineLen>, <nTabLen>, <lWrap>, [<nStartOffset>], @nOffSet, @nEnd, @lFound, @lEOF ) */
|
||||
HB_FUNC( HB_READLINE )
|
||||
{
|
||||
PHB_ITEM pTerm1;
|
||||
const char * szText = hb_parcx( 1 );
|
||||
const char ** pTerm;
|
||||
HB_SIZE * pnTermSizes;
|
||||
HB_SIZE nTabLen, nTerms;
|
||||
HB_SIZE nLineSize = hb_parni( 3 );
|
||||
HB_SIZE i;
|
||||
HB_BOOL bWrap = hb_parl( 5 );
|
||||
HB_BOOL bFound, bEOF;
|
||||
HB_SIZE nStartOffset;
|
||||
HB_SIZE nEndOffset, nTextLen;
|
||||
HB_ISIZ nEnd;
|
||||
PHB_ITEM pOpt;
|
||||
HB_BOOL bAlloc_Term1 = HB_FALSE;
|
||||
PHB_ITEM pTerm1;
|
||||
const char * szText = hb_parcx( 1 );
|
||||
const char ** pTerm;
|
||||
HB_SIZE * pnTermSizes;
|
||||
HB_SIZE nTabLen, nTerms;
|
||||
HB_SIZE nLineSize = hb_parni( 3 );
|
||||
HB_SIZE i;
|
||||
HB_BOOL bWrap = hb_parl( 5 );
|
||||
HB_BOOL bFound, bEOF;
|
||||
HB_SIZE nStartOffset;
|
||||
HB_SIZE nEndOffset, nTextLen;
|
||||
HB_ISIZ nEnd;
|
||||
PHB_ITEM pOpt;
|
||||
HB_BOOL bAlloc_Term1 = HB_FALSE;
|
||||
|
||||
if( ! HB_ISCHAR( 1 ) )
|
||||
{
|
||||
@@ -244,10 +244,10 @@ HB_FUNC( HB_READLINE )
|
||||
return;
|
||||
}
|
||||
|
||||
nTextLen = hb_parclen( 1 );
|
||||
nTabLen = hb_parclen( 4 );
|
||||
nTextLen = hb_parclen( 1 );
|
||||
nTabLen = hb_parclen( 4 );
|
||||
|
||||
nStartOffset = hb_parns( 6 );
|
||||
nStartOffset = hb_parns( 6 );
|
||||
|
||||
if( ! ( HB_ISARRAY( 2 ) || HB_ISCHAR( 2 ) ) )
|
||||
{
|
||||
@@ -259,8 +259,8 @@ HB_FUNC( HB_READLINE )
|
||||
hb_itemRelease( pEOL );
|
||||
}
|
||||
|
||||
pTerm1 = hb_itemPutC( NULL, hb_setGetCPtr( HB_SET_EOL ) );
|
||||
bAlloc_Term1 = HB_TRUE;
|
||||
pTerm1 = hb_itemPutC( NULL, hb_setGetCPtr( HB_SET_EOL ) );
|
||||
bAlloc_Term1 = HB_TRUE;
|
||||
}
|
||||
else
|
||||
pTerm1 = hb_param( 2, HB_IT_ANY );
|
||||
@@ -276,17 +276,17 @@ HB_FUNC( HB_READLINE )
|
||||
for( i = 0; i < nTerms; i++ )
|
||||
{
|
||||
hb_arrayGet( pTerm1, i + 1, pOpt );
|
||||
pTerm[ i ] = hb_itemGetCPtr( pOpt );
|
||||
pnTermSizes[ i ] = hb_itemGetCLen( pOpt );
|
||||
pTerm[ i ] = hb_itemGetCPtr( pOpt );
|
||||
pnTermSizes[ i ] = hb_itemGetCLen( pOpt );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) );
|
||||
pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * 1 );
|
||||
pTerm[ 0 ] = hb_itemGetCPtr( pTerm1 );
|
||||
pnTermSizes[ 0 ] = hb_itemGetCLen( pTerm1 );
|
||||
nTerms = 1;
|
||||
pTerm = ( const char ** ) hb_xgrab( sizeof( char * ) );
|
||||
pnTermSizes = ( HB_SIZE * ) hb_xgrab( sizeof( HB_SIZE ) * 1 );
|
||||
pTerm[ 0 ] = hb_itemGetCPtr( pTerm1 );
|
||||
pnTermSizes[ 0 ] = hb_itemGetCLen( pTerm1 );
|
||||
nTerms = 1;
|
||||
}
|
||||
|
||||
hb_itemRelease( pOpt );
|
||||
|
||||
@@ -69,7 +69,7 @@ extern HB_EXPORT HB_BOOL hb_ToLogFileOnOff( HB_BOOL bOnOff );
|
||||
extern HB_EXPORT HB_BOOL hb_EmptyLogFile( HB_BOOL bOnOff );
|
||||
extern HB_EXPORT void hb_ToLogFile( const char * sFile, const char * sTraceMsg, ... );
|
||||
|
||||
#define hb_seconds() hb_dateSeconds()
|
||||
#define hb_seconds() hb_dateSeconds()
|
||||
|
||||
HB_EXTERN_END
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ HB_FUNC( ASPLICE )
|
||||
|
||||
if( pArray )
|
||||
{
|
||||
HB_SIZE nStart, nRemove, nIndex;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
HB_SIZE nStart, nRemove, nIndex;
|
||||
HB_SIZE nLen = hb_arrayLen( pArray );
|
||||
PHB_ITEM pReturn = hb_stackReturnItem();
|
||||
|
||||
if( nLen == 0 )
|
||||
@@ -76,7 +76,7 @@ HB_FUNC( ASPLICE )
|
||||
if( HB_ISNUM( 2 ) )
|
||||
nStart = hb_parns( 2 );
|
||||
else
|
||||
nStart = nLen + ( hb_pcount() > 3 && !HB_ISNUM( 3 ) ? 1 : 0 );
|
||||
nStart = nLen + ( hb_pcount() > 3 && ! HB_ISNUM( 3 ) ? 1 : 0 );
|
||||
|
||||
if( HB_ISNUM( 3 ) )
|
||||
nRemove = hb_parns( 3 );
|
||||
@@ -111,7 +111,7 @@ HB_FUNC( ASPLICE )
|
||||
|
||||
if( ( HB_SIZE ) nAdd > nRemove )
|
||||
{
|
||||
HB_SIZE nMore = nAdd - nRemove;
|
||||
HB_SIZE nMore = nAdd - nRemove;
|
||||
HB_SIZE nShift = nLen - ( nStart + nRemove );
|
||||
|
||||
hb_arraySize( pArray, nLen + nMore );
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
/* ASIZEALLOC( <array>, <num> ) -> <array> - Set the pre-alloc step. */
|
||||
HB_FUNC( ASIZEALLOC )
|
||||
{
|
||||
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
|
||||
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
|
||||
PHB_ITEM pPreAlloc = hb_param( 2, HB_IT_NUMERIC );
|
||||
|
||||
if( pArray && pPreAlloc )
|
||||
|
||||
@@ -61,11 +61,11 @@ static HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char
|
||||
{
|
||||
char cLastChar = ' ';
|
||||
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_AtSkipStrings(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen));
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_AtSkipStrings(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen ) );
|
||||
|
||||
if( nSubLen > 0 && nLen >= nSubLen )
|
||||
{
|
||||
HB_SIZE nPos = 0;
|
||||
HB_SIZE nPos = 0;
|
||||
HB_SIZE nSubPos = 0;
|
||||
|
||||
while( nPos < nLen && nSubPos < nSubLen )
|
||||
@@ -132,7 +132,7 @@ static HB_SIZE hb_AtSkipStrings( const char * szSub, HB_SIZE nSubLen, const char
|
||||
{
|
||||
/* Go back to the first character after the first match,
|
||||
or else tests like "22345" $ "012223456789" will fail. */
|
||||
nPos -= ( nSubPos - 1 );
|
||||
nPos -= ( nSubPos - 1 );
|
||||
nSubPos = 0;
|
||||
}
|
||||
else
|
||||
@@ -178,11 +178,11 @@ HB_FUNC( ATSKIPSTRINGS ) /* cFind, cWhere, nStart */
|
||||
/* Case insensitive hb_strAt() function */
|
||||
static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szText, HB_SIZE nLen )
|
||||
{
|
||||
HB_TRACE(HB_TR_DEBUG, ("hb_strAtI(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen));
|
||||
HB_TRACE( HB_TR_DEBUG, ( "hb_strAtI(%s, %" HB_PFS "u, %s, %" HB_PFS "u)", szSub, nSubLen, szText, nLen ) );
|
||||
|
||||
if( nSubLen > 0 && nLen >= nSubLen )
|
||||
{
|
||||
HB_SIZE nPos = 0;
|
||||
HB_SIZE nPos = 0;
|
||||
HB_SIZE nSubPos = 0;
|
||||
|
||||
while( nPos < nLen && nSubPos < nSubLen )
|
||||
@@ -196,7 +196,7 @@ static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szTe
|
||||
{
|
||||
/* Go back to the first character after the first match,
|
||||
or else tests like "22345" $ "012223456789" will fail. */
|
||||
nPos -= ( nSubPos - 1 );
|
||||
nPos -= ( nSubPos - 1 );
|
||||
nSubPos = 0;
|
||||
}
|
||||
else
|
||||
@@ -211,17 +211,17 @@ static HB_SIZE hb_strAtI( const char * szSub, HB_SIZE nSubLen, const char * szTe
|
||||
/* Case insensitive At() function */
|
||||
HB_FUNC( ATI )
|
||||
{
|
||||
PHB_ITEM pSub = hb_param( 1, HB_IT_STRING );
|
||||
PHB_ITEM pSub = hb_param( 1, HB_IT_STRING );
|
||||
PHB_ITEM pText = hb_param( 2, HB_IT_STRING );
|
||||
|
||||
if( pText && pSub )
|
||||
{
|
||||
PHB_ITEM pStart = hb_param( 3, HB_IT_NUMERIC );
|
||||
PHB_ITEM pEnd = hb_param( 4, HB_IT_NUMERIC );
|
||||
HB_ISIZ nLen = hb_itemGetCLen( pText );
|
||||
HB_ISIZ nStart = pStart ? hb_itemGetNS( pStart ) : 1;
|
||||
HB_ISIZ nEnd = pEnd ? hb_itemGetNS( pEnd ) : nLen;
|
||||
HB_SIZE nPos;
|
||||
PHB_ITEM pEnd = hb_param( 4, HB_IT_NUMERIC );
|
||||
HB_ISIZ nLen = hb_itemGetCLen( pText );
|
||||
HB_ISIZ nStart = pStart ? hb_itemGetNS( pStart ) : 1;
|
||||
HB_ISIZ nEnd = pEnd ? hb_itemGetNS( pEnd ) : nLen;
|
||||
HB_SIZE nPos;
|
||||
|
||||
if( nStart < 0 )
|
||||
{
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
HB_FUNC( HB_ENUMINDEX )
|
||||
{
|
||||
HB_ISIZ nFuncOffset = hb_stackBaseOffset() - 1, nIndex = 0;
|
||||
|
||||
while( --nFuncOffset > 0 )
|
||||
{
|
||||
PHB_ITEM pItem = hb_stackItem( nFuncOffset );
|
||||
|
||||
@@ -65,11 +65,11 @@
|
||||
|
||||
static PHB_SYMB s_xHbFunc = NULL;
|
||||
|
||||
LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo )
|
||||
LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS * ExceptionInfo )
|
||||
{
|
||||
if( s_xHbFunc )
|
||||
{
|
||||
HB_ITEM Exception;
|
||||
HB_ITEM Exception;
|
||||
PHB_DYNS pDyn = hb_dynsymFind( "HB_CSTRUCTURE" );
|
||||
|
||||
Exception.type = HB_IT_NIL;
|
||||
@@ -89,7 +89,7 @@ LONG WINAPI PRGUnhandledExceptionFilter( EXCEPTION_POINTERS *ExceptionInfo )
|
||||
|
||||
hb_itemMove( &Exception, hb_stackReturnItem() );
|
||||
|
||||
hb_itemPutCLStatic( &Buffer, (char *) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) );
|
||||
hb_itemPutCLStatic( &Buffer, ( char * ) ExceptionInfo, sizeof( EXCEPTION_POINTERS ) );
|
||||
|
||||
Adopt.type = HB_IT_LOGICAL;
|
||||
Adopt.item.asLogical.value = HB_FALSE;
|
||||
|
||||
@@ -89,11 +89,11 @@ static HB_BOOL s_isHashAA( PHB_ITEM pHash )
|
||||
HB_FUNC( HAAGETKEYAT )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
|
||||
if( !pHash || !pPos )
|
||||
if( ! pHash || ! pPos )
|
||||
s_errRT_hashArg();
|
||||
else if( !s_isHashAA( pHash ) )
|
||||
else if( ! s_isHashAA( pHash ) )
|
||||
s_errRT_hashAA();
|
||||
else
|
||||
{
|
||||
@@ -109,11 +109,11 @@ HB_FUNC( HAAGETKEYAT )
|
||||
HB_FUNC( HAAGETVALUEAT )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
|
||||
if( !pHash || !pPos )
|
||||
if( ! pHash || ! pPos )
|
||||
s_errRT_hashArg();
|
||||
else if( !s_isHashAA( pHash ) )
|
||||
else if( ! s_isHashAA( pHash ) )
|
||||
s_errRT_hashAA();
|
||||
else
|
||||
{
|
||||
@@ -128,13 +128,13 @@ HB_FUNC( HAAGETVALUEAT )
|
||||
/* HAASETVALUEAT( <hValue>, <nPos>, <value> ) -> NIL */
|
||||
HB_FUNC( HAASETVALUEAT )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pValue = hb_param( 3, HB_IT_ANY );
|
||||
|
||||
if( !pHash || !pPos || !pValue )
|
||||
if( ! pHash || ! pPos || ! pValue )
|
||||
s_errRT_hashArg();
|
||||
else if( !s_isHashAA( pHash ) )
|
||||
else if( ! s_isHashAA( pHash ) )
|
||||
s_errRT_hashAA();
|
||||
else
|
||||
{
|
||||
@@ -150,13 +150,13 @@ HB_FUNC( HAASETVALUEAT )
|
||||
HB_FUNC( HAADELAT )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
PHB_ITEM pPos = hb_param( 2, HB_IT_NUMERIC );
|
||||
|
||||
if( !pHash || !pPos )
|
||||
if( ! pHash || ! pPos )
|
||||
s_errRT_hashArg();
|
||||
else if( !s_isHashAA( pHash ) )
|
||||
else if( ! s_isHashAA( pHash ) )
|
||||
s_errRT_hashAA();
|
||||
else if( !hb_hashDelAt( pHash, hb_itemGetNS( pPos ) ) )
|
||||
else if( ! hb_hashDelAt( pHash, hb_itemGetNS( pPos ) ) )
|
||||
s_errRT_hashBound();
|
||||
}
|
||||
|
||||
@@ -164,11 +164,11 @@ HB_FUNC( HAADELAT )
|
||||
HB_FUNC( HAAGETPOS )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pKey = hb_param( 2, HB_IT_HASHKEY );
|
||||
PHB_ITEM pKey = hb_param( 2, HB_IT_HASHKEY );
|
||||
|
||||
if( !pHash || !pKey )
|
||||
if( ! pHash || ! pKey )
|
||||
s_errRT_hashArg();
|
||||
else if( !s_isHashAA( pHash ) )
|
||||
else if( ! s_isHashAA( pHash ) )
|
||||
s_errRT_hashAA();
|
||||
else
|
||||
{
|
||||
@@ -201,7 +201,7 @@ HB_FUNC( HGETVAAPOS )
|
||||
|
||||
if( pHash )
|
||||
{
|
||||
HB_SIZE n, nLen = hb_hashLen( pHash );
|
||||
HB_SIZE n, nLen = hb_hashLen( pHash );
|
||||
PHB_ITEM pArray = hb_itemArrayNew( nLen );
|
||||
|
||||
for( n = 1; n <= nLen; ++n )
|
||||
@@ -215,7 +215,7 @@ HB_FUNC( HGETVAAPOS )
|
||||
/* HSETAACOMPATIBILITY( <hValue>, <lAACompat> ) -> <lDone> */
|
||||
HB_FUNC( HSETAACOMPATIBILITY )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pValue = hb_param( 2, HB_IT_LOGICAL );
|
||||
|
||||
if( pHash && pValue && hb_hashLen( pHash ) == 0 )
|
||||
|
||||
@@ -59,9 +59,9 @@
|
||||
|
||||
HB_FUNC( HSETPARTITION )
|
||||
{
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pLevel = hb_param( 3, HB_IT_NUMERIC );
|
||||
HB_UINT uiLevel = pLevel ? hb_itemGetNI( pLevel ) : 1;
|
||||
PHB_ITEM pHash = hb_param( 1, HB_IT_HASH );
|
||||
PHB_ITEM pLevel = hb_param( 3, HB_IT_NUMERIC );
|
||||
HB_UINT uiLevel = pLevel ? hb_itemGetNI( pLevel ) : 1;
|
||||
|
||||
if( ! pHash )
|
||||
hb_errRT_BASE( EG_ARG, 2017, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
|
||||
@@ -71,25 +71,25 @@
|
||||
#undef tolower
|
||||
#undef toupper
|
||||
|
||||
#define isalnum(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISALNUM)
|
||||
#define isalpha(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISALPHA)
|
||||
#define iscntrl(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISCNTRL)
|
||||
#define isdigit(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISDIGIT)
|
||||
#define isgraph(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISGRAPH)
|
||||
#define islower(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISLOWER)
|
||||
#define isprint(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISPRINT)
|
||||
#define ispunct(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISPUNCT)
|
||||
#define isspace(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISSPACE)
|
||||
#define isupper(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISUPPER)
|
||||
#define isxdigit(c) (__dj_ctype_flags[(unsigned char)(c)+1] & __dj_ISXDIGIT)
|
||||
#define isalnum( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISALNUM )
|
||||
#define isalpha( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISALPHA )
|
||||
#define iscntrl( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISCNTRL )
|
||||
#define isdigit( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISDIGIT )
|
||||
#define isgraph( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISGRAPH )
|
||||
#define islower( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISLOWER )
|
||||
#define isprint( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISPRINT )
|
||||
#define ispunct( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISPUNCT )
|
||||
#define isspace( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISSPACE )
|
||||
#define isupper( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISUPPER )
|
||||
#define isxdigit( c ) ( __dj_ctype_flags[ ( unsigned char ) ( c ) + 1 ] & __dj_ISXDIGIT )
|
||||
|
||||
#define tolower(c) (__dj_ctype_tolower[(unsigned char)(c)+1])
|
||||
#define toupper(c) (__dj_ctype_toupper[(unsigned char)(c)+1])
|
||||
#define tolower( c ) ( __dj_ctype_tolower[ ( unsigned char ) ( c ) + 1 ] )
|
||||
#define toupper( c ) ( __dj_ctype_toupper[ ( unsigned char ) ( c ) + 1 ] )
|
||||
|
||||
#endif /* __dj_include_inline_ctype_ha_ */
|
||||
|
||||
#if !defined( isascii )
|
||||
#define isascii( c ) ( ( unsigned ) ( c ) <= 0x7F )
|
||||
#if ! defined( isascii )
|
||||
#define isascii( c ) ( ( unsigned ) ( c ) <= 0x7F )
|
||||
#endif
|
||||
|
||||
/* determines if first char of a string is an alphanumeric character */
|
||||
@@ -99,7 +99,7 @@ HB_FUNC( ISALNUM )
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
if( szString != NULL )
|
||||
hb_retl( HB_ISALNUM( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( HB_ISALNUM( ( HB_BYTE ) *szString ) );
|
||||
else
|
||||
hb_retl( HB_FALSE );
|
||||
}
|
||||
@@ -107,82 +107,82 @@ HB_FUNC( ISALNUM )
|
||||
/* determines if first char of a string is a white-space character;
|
||||
that is, a horizontal tab, a new-line, a vertical tab, a form-feed,
|
||||
a carriage-return or a space.
|
||||
*/
|
||||
*/
|
||||
|
||||
HB_FUNC( ISSPACE )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
if( szString != NULL )
|
||||
hb_retl( HB_ISSPACE( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( HB_ISSPACE( ( HB_BYTE ) *szString ) );
|
||||
else
|
||||
hb_retl( HB_FALSE );
|
||||
}
|
||||
|
||||
/* determines if first char of a string is a hexadecimal digit
|
||||
('A' - 'F', 'a' - 'f', or '0' -'9').
|
||||
*/
|
||||
('A' - 'F', 'a' - 'f', or '0' -'9').
|
||||
*/
|
||||
|
||||
HB_FUNC( ISXDIGIT )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
hb_retl( szString && HB_ISXDIGIT( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( szString && HB_ISXDIGIT( ( HB_BYTE ) *szString ) );
|
||||
}
|
||||
|
||||
/* determines if first char of a string is a control character;
|
||||
that is, if it is in the range 0 - 31 or 127 (0x00 - 0x1f or 0x7f).
|
||||
*/
|
||||
*/
|
||||
|
||||
HB_FUNC( ISCNTRL )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
hb_retl( szString && iscntrl( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( szString && iscntrl( ( HB_BYTE ) *szString ) );
|
||||
}
|
||||
|
||||
/* determines if first char of a string is a printable character.
|
||||
The space character (' ') is not considered a printable character.
|
||||
*/
|
||||
*/
|
||||
|
||||
HB_FUNC( ISGRAPH )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
hb_retl( szString && isgraph( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( szString && isgraph( ( HB_BYTE ) *szString ) );
|
||||
}
|
||||
|
||||
/* determines if first char of a string is a printable character.
|
||||
Printable characters have an ASCII value between 32 - 126, (0x20 - 0x7e),
|
||||
a space and the tilde, inclusive.
|
||||
*/
|
||||
*/
|
||||
|
||||
HB_FUNC( ISPRINT )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
hb_retl( szString && isprint( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( szString && isprint( ( HB_BYTE ) *szString ) );
|
||||
}
|
||||
|
||||
/* determines if first char of a string is a punctuation character.
|
||||
A punctuation character is one that is not alphabetic, not numeric,
|
||||
not a control character, and not a white space.
|
||||
*/
|
||||
*/
|
||||
|
||||
HB_FUNC( ISPUNCT )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
hb_retl( szString && ispunct( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( szString && ispunct( ( HB_BYTE ) *szString ) );
|
||||
}
|
||||
|
||||
/* determines if first char of a string is a member of the 7-bit ASCII
|
||||
character set; that is, if: 0 <= c <= 127
|
||||
*/
|
||||
*/
|
||||
|
||||
HB_FUNC( ISASCII )
|
||||
{
|
||||
const char * szString = hb_parc( 1 );
|
||||
|
||||
hb_retl( szString && isascii( ( HB_BYTE ) * szString ) );
|
||||
hb_retl( szString && isascii( ( HB_BYTE ) *szString ) );
|
||||
}
|
||||
|
||||
@@ -59,14 +59,14 @@
|
||||
HB_FUNC( XHB_HASHERROR )
|
||||
{
|
||||
const char * szMessage = hb_itemGetSymbol( hb_stackBaseItem() )->szName;
|
||||
int iPCount = hb_pcount();
|
||||
int iPCount = hb_pcount();
|
||||
|
||||
if( iPCount == 1 )
|
||||
{
|
||||
if( szMessage[ 0 ] == '_' )
|
||||
{ /* ASSIGN */
|
||||
if( szMessage[ 0 ] == '_' ) /* ASSIGN */
|
||||
{
|
||||
PHB_ITEM pIndex = hb_itemPutCConst( hb_stackAllocItem(), szMessage + 1 );
|
||||
PHB_ITEM pDest = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ASSIGN );
|
||||
PHB_ITEM pDest = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ASSIGN );
|
||||
hb_stackPop();
|
||||
if( pDest )
|
||||
{
|
||||
@@ -77,8 +77,8 @@ HB_FUNC( XHB_HASHERROR )
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( iPCount == 0 )
|
||||
{ /* ACCESS */
|
||||
else if( iPCount == 0 ) /* ACCESS */
|
||||
{
|
||||
PHB_ITEM pIndex = hb_itemPutCConst( hb_stackAllocItem(), szMessage );
|
||||
PHB_ITEM pValue = hb_hashGetItemPtr( hb_stackSelfItem(), pIndex, HB_HASH_AUTOADD_ACCESS );
|
||||
hb_stackPop();
|
||||
@@ -98,7 +98,7 @@ HB_FUNC( XHB_HASHERROR )
|
||||
HB_FUNC( XHB_INCLUDE )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pKey = hb_param( 1, HB_IT_ANY );
|
||||
PHB_ITEM pKey = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_ARRAY( pSelf ) )
|
||||
{
|
||||
@@ -118,19 +118,19 @@ HB_FUNC( XHB_INCLUDE )
|
||||
|
||||
HB_FUNC( XHB_EEQUAL )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue == ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc == dValue );
|
||||
}
|
||||
else if( HB_IS_BLOCK( pSelf ) && HB_IS_BLOCK( pValue ) )
|
||||
@@ -147,19 +147,19 @@ HB_FUNC( XHB_EEQUAL )
|
||||
|
||||
HB_FUNC( XHB_EQUAL )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue == ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc == dValue );
|
||||
}
|
||||
else if( HB_IS_HASH( pSelf ) && HB_IS_HASH( pValue ) )
|
||||
@@ -176,19 +176,19 @@ HB_FUNC( XHB_EQUAL )
|
||||
|
||||
HB_FUNC( XHB_NOTEQUAL )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue != ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc != dValue );
|
||||
}
|
||||
else if( HB_IS_HASH( pSelf ) && HB_IS_HASH( pValue ) )
|
||||
@@ -205,19 +205,19 @@ HB_FUNC( XHB_NOTEQUAL )
|
||||
|
||||
HB_FUNC( XHB_LESS )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue < ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc < dValue );
|
||||
}
|
||||
else
|
||||
@@ -230,19 +230,19 @@ HB_FUNC( XHB_LESS )
|
||||
|
||||
HB_FUNC( XHB_LESSEQ )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue <= ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc <= dValue );
|
||||
}
|
||||
else
|
||||
@@ -255,19 +255,19 @@ HB_FUNC( XHB_LESSEQ )
|
||||
|
||||
HB_FUNC( XHB_GREATER )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue > ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc > dValue );
|
||||
}
|
||||
else
|
||||
@@ -280,19 +280,19 @@ HB_FUNC( XHB_GREATER )
|
||||
|
||||
HB_FUNC( XHB_GREATEREQ )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
double dValue = hb_itemGetND( pSelf );
|
||||
hb_retl( dValue >= ( double ) uc );
|
||||
}
|
||||
else if( hb_itemGetCLen( pSelf ) == 1 && pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dValue = hb_itemGetND( pValue );
|
||||
hb_retl( ( double ) uc >= dValue );
|
||||
}
|
||||
else
|
||||
@@ -309,15 +309,15 @@ HB_FUNC( XHB_GREATEREQ )
|
||||
* data from tail
|
||||
*/
|
||||
#undef HB_IS_VALID_INDEX
|
||||
#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) (idx) < 0 ? (idx) += (max) + 1 : (idx) ) > 0 && ( HB_SIZE ) (idx) <= (max) )
|
||||
#define HB_IS_VALID_INDEX( idx, max ) ( ( ( HB_ISIZ ) ( idx ) < 0 ? ( idx ) += ( max ) + 1 : ( idx ) ) > 0 && ( HB_SIZE ) ( idx ) <= ( max ) )
|
||||
|
||||
HB_FUNC( XHB_INDEX )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pIndex = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( hb_pcount() == 2 )
|
||||
{ /* ASSIGN */
|
||||
if( hb_pcount() == 2 ) /* ASSIGN */
|
||||
{
|
||||
PHB_ITEM pValue = hb_param( 2, HB_IT_ANY );
|
||||
if( HB_IS_NUMERIC( pIndex ) )
|
||||
{
|
||||
@@ -358,8 +358,8 @@ HB_FUNC( XHB_INDEX )
|
||||
|
||||
hb_itemReturn( pSelf );
|
||||
}
|
||||
else
|
||||
{ /* ACCESS */
|
||||
else /* ACCESS */
|
||||
{
|
||||
if( HB_IS_NUMERIC( pIndex ) )
|
||||
{
|
||||
HB_SIZE nIndex = hb_itemGetNS( pIndex );
|
||||
@@ -393,14 +393,14 @@ HB_FUNC( XHB_INDEX )
|
||||
|
||||
HB_FUNC( XHB_PLUS )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pSelf, &iDec );
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pSelf, &iDec );
|
||||
hb_retnlen( dValue + uc, 0, iDec );
|
||||
}
|
||||
else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 &&
|
||||
@@ -426,14 +426,14 @@ HB_FUNC( XHB_PLUS )
|
||||
|
||||
HB_FUNC( XHB_MINUS )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pSelf, &iDec );
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pSelf, &iDec );
|
||||
hb_retnlen( dValue - uc, 0, iDec );
|
||||
}
|
||||
else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 &&
|
||||
@@ -497,29 +497,29 @@ HB_FUNC( XHB_DEC )
|
||||
|
||||
HB_FUNC( XHB_MULT )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pSelf, &iDec );
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pSelf, &iDec );
|
||||
hb_retndlen( dValue * uc, 0, iDec );
|
||||
}
|
||||
else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 &&
|
||||
pValue && HB_IS_NUMERIC( pValue ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pValue, &iDec );
|
||||
int iDec;
|
||||
double dValue = hb_itemGetNDDec( pValue, &iDec );
|
||||
hb_retndlen( ( double ) uc * dValue, 0, iDec );
|
||||
}
|
||||
else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 &&
|
||||
hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc1 = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ],
|
||||
uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
hb_retnint( uc1 * uc2 );
|
||||
}
|
||||
else
|
||||
@@ -532,7 +532,7 @@ HB_FUNC( XHB_MULT )
|
||||
|
||||
HB_FUNC( XHB_DIV )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
@@ -550,9 +550,9 @@ HB_FUNC( XHB_DIV )
|
||||
else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && pValue &&
|
||||
( HB_IS_NUMERIC( pValue ) || hb_itemGetCLen( pValue ) == 1 ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) :
|
||||
( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) :
|
||||
( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] );
|
||||
|
||||
if( dDivisor == 0 )
|
||||
{
|
||||
@@ -573,7 +573,7 @@ HB_FUNC( XHB_DIV )
|
||||
|
||||
HB_FUNC( XHB_MOD )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
@@ -591,9 +591,9 @@ HB_FUNC( XHB_MOD )
|
||||
else if( HB_IS_STRING( pSelf ) && hb_itemGetCLen( pSelf ) == 1 && pValue &&
|
||||
( HB_IS_NUMERIC( pValue ) || hb_itemGetCLen( pValue ) == 1 ) )
|
||||
{
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) :
|
||||
( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] );
|
||||
HB_UCHAR uc = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ];
|
||||
double dDivisor = HB_IS_NUMERIC( pValue ) ? hb_itemGetND( pValue ) :
|
||||
( double ) ( ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ] );
|
||||
|
||||
if( dDivisor == 0 )
|
||||
{
|
||||
@@ -614,7 +614,7 @@ HB_FUNC( XHB_MOD )
|
||||
|
||||
HB_FUNC( XHB_POW )
|
||||
{
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pSelf = hb_stackSelfItem();
|
||||
PHB_ITEM pValue = hb_param( 1, HB_IT_ANY );
|
||||
|
||||
if( HB_IS_NUMERIC( pSelf ) && hb_itemGetCLen( pValue ) == 1 )
|
||||
@@ -632,7 +632,7 @@ HB_FUNC( XHB_POW )
|
||||
hb_itemGetCLen( pValue ) == 1 )
|
||||
{
|
||||
HB_UCHAR uc1 = ( HB_UCHAR ) hb_itemGetCPtr( pSelf )[ 0 ],
|
||||
uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
uc2 = ( HB_UCHAR ) hb_itemGetCPtr( pValue )[ 0 ];
|
||||
hb_retnd( pow( ( double ) uc1, ( double ) uc2 ) );
|
||||
}
|
||||
else
|
||||
|
||||
@@ -65,7 +65,7 @@ HB_FUNC( __MVSYMBOLINFO )
|
||||
for( n = 1; n <= nLen; ++n )
|
||||
{
|
||||
PHB_ITEM pItem = hb_arrayGetItemPtr( pArray, n );
|
||||
PHB_SYMB pSym = hb_arrayGetSymbol( pItem, 1 );
|
||||
PHB_SYMB pSym = hb_arrayGetSymbol( pItem, 1 );
|
||||
hb_arraySetC( pItem, 1, pSym->szName );
|
||||
}
|
||||
hb_itemReturnRelease( pArray );
|
||||
|
||||
@@ -66,19 +66,19 @@ static void hb_getScreenRange( int * piMin, int * piMax,
|
||||
}
|
||||
else
|
||||
{
|
||||
iMax = hb_gtMaxCol();
|
||||
iMax = hb_gtMaxCol();
|
||||
iFrom = hb_parni( 2 );
|
||||
iTo = hb_parnidef( 4, iMax );
|
||||
}
|
||||
|
||||
if( iFrom < 0 )
|
||||
iFrom = 0;
|
||||
else if( iFrom > iMax && !fNoCheck )
|
||||
else if( iFrom > iMax && ! fNoCheck )
|
||||
iFrom = iMax;
|
||||
|
||||
if( iTo < 0 )
|
||||
iTo = 0;
|
||||
else if( iTo > iMax && !fNoCheck )
|
||||
else if( iTo > iMax && ! fNoCheck )
|
||||
iTo = iMax;
|
||||
|
||||
if( iFrom > iTo )
|
||||
@@ -95,9 +95,9 @@ static void hb_getScreenRange( int * piMin, int * piMax,
|
||||
|
||||
HB_FUNC( XHB_SAVESCREEN )
|
||||
{
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
HB_SIZE nSize;
|
||||
void * pBuffer;
|
||||
void * pBuffer;
|
||||
HB_BOOL fNoCheck = hb_parl( 5 );
|
||||
|
||||
hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE );
|
||||
@@ -114,7 +114,7 @@ HB_FUNC( XHB_RESTSCREEN )
|
||||
{
|
||||
if( HB_ISCHAR( 5 ) )
|
||||
{
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
int iTop, iLeft, iBottom, iRight;
|
||||
HB_BOOL fNoCheck = hb_parl( 6 );
|
||||
|
||||
hb_getScreenRange( &iTop, &iBottom, fNoCheck, HB_TRUE );
|
||||
|
||||
@@ -72,7 +72,9 @@ HB_FUNC( MESSAGEBOX )
|
||||
void * hStr2;
|
||||
HWND hWnd = HB_ISNUM( 1 ) ? ( HWND ) ( HB_PTRUINT ) hb_parnint( 1 ) :
|
||||
( HWND ) hb_parptr( 1 );
|
||||
|
||||
hb_retni( MessageBox( hWnd, HB_PARSTR( 2, &hStr1, NULL ), HB_PARSTR( 3, &hStr2, NULL ), hb_parni( 4 ) ) );
|
||||
|
||||
hb_strfree( hStr1 );
|
||||
hb_strfree( hStr2 );
|
||||
}
|
||||
|
||||
@@ -63,13 +63,13 @@ static PHB_ITEM hb_vmWithObjectItem( HB_ISIZ nLevel )
|
||||
while( nOffset && nLevel > 0 )
|
||||
{
|
||||
HB_ISIZ * pnOffset = ( HB_ISIZ * ) hb_itemGetPtr( hb_stackItem( nOffset + 1 ) );
|
||||
if( !pnOffset )
|
||||
if( ! pnOffset )
|
||||
break;
|
||||
--nLevel;
|
||||
nOffset = *pnOffset;
|
||||
}
|
||||
|
||||
return ( nOffset && !nLevel ) ? hb_stackItem( nOffset ) : NULL;
|
||||
return ( nOffset && ! nLevel ) ? hb_stackItem( nOffset ) : NULL;
|
||||
}
|
||||
|
||||
static HB_ISIZ hb_vmWithObjectCount( void )
|
||||
@@ -79,7 +79,7 @@ static HB_ISIZ hb_vmWithObjectCount( void )
|
||||
while( nOffset )
|
||||
{
|
||||
HB_ISIZ * pnOffset = ( HB_ISIZ * ) hb_itemGetPtr( hb_stackItem( nOffset + 1 ) );
|
||||
if( !pnOffset )
|
||||
if( ! pnOffset )
|
||||
break;
|
||||
++nCount;
|
||||
nOffset = *pnOffset;
|
||||
|
||||
@@ -58,24 +58,24 @@ HB_FUNC( STRDEL )
|
||||
if( HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
|
||||
{
|
||||
const char * szText = hb_parcx( 1 );
|
||||
HB_SIZE nText = hb_parclen( 1 );
|
||||
HB_SIZE nDel = hb_parclen( 2 );
|
||||
HB_SIZE nText = hb_parclen( 1 );
|
||||
HB_SIZE nDel = hb_parclen( 2 );
|
||||
|
||||
if( nDel > 0 && nText > 0 )
|
||||
{
|
||||
const char * szDel = hb_parcx( 2 );
|
||||
HB_SIZE nPosTxt = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
HB_SIZE nPosDel = 0;
|
||||
char * szResult = ( char * ) hb_xgrab( nText + 1 );
|
||||
const char * szDel = hb_parcx( 2 );
|
||||
HB_SIZE nPosTxt = 0;
|
||||
HB_SIZE nResult = 0;
|
||||
HB_SIZE nPosDel = 0;
|
||||
char * szResult = ( char * ) hb_xgrab( nText + 1 );
|
||||
|
||||
for( ; ( nPosDel < nText && nPosDel < nDel ); nPosDel++ )
|
||||
for(; ( nPosDel < nText && nPosDel < nDel ); nPosDel++ )
|
||||
{
|
||||
if( szDel[ nPosDel ] != ' ' )
|
||||
{
|
||||
hb_xmemcpy( szResult + nResult, szText + nPosTxt, nPosDel - nPosTxt );
|
||||
nResult += nPosDel - nPosTxt;
|
||||
nPosTxt = nPosDel + 1;
|
||||
nPosTxt = nPosDel + 1;
|
||||
}
|
||||
}
|
||||
hb_xmemcpy( szResult + nResult, szText + nPosTxt, nText - nPosTxt );
|
||||
|
||||
Reference in New Issue
Block a user