2007-12-16 13:32 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/common/hbfsapi.c
    + added OS2 version of hb_fsFileExists() and hb_fsDirExists()
      Please test - I do not have OS2

  * harbour/source/rdd/dbf1.c
    ! removed unnecessary printf() message I left by mistake

  * harbour/contrib/hbct/files.c
    + added OS2 version of SETFATTR()
      Please test - I do not have OS2

  * harbour/config/os2/global.cf
    + added temporary workaround for possible problems with some
      GNU make versions

  * harbour/make_deb.sh
    + build hbpgsql when libpq-dev is installed

  * harbour/include/clipdefs.h
    * do not define PBYTE, PSHORT, PUSHORT, PLONG, PULONG, PBOOL, PVOID
      when HB_OS_OS2 && HB_DONT_DEFINE_BASIC_TYPES is defined
This commit is contained in:
Przemyslaw Czerpak
2007-12-16 12:32:41 +00:00
parent 873e71fdf3
commit b30055548c
7 changed files with 180 additions and 73 deletions

View File

@@ -8,6 +8,29 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2007-12-16 13:32 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/common/hbfsapi.c
+ added OS2 version of hb_fsFileExists() and hb_fsDirExists()
Please test - I do not have OS2
* harbour/source/rdd/dbf1.c
! removed unnecessary printf() message I left by mistake
* harbour/contrib/hbct/files.c
+ added OS2 version of SETFATTR()
Please test - I do not have OS2
* harbour/config/os2/global.cf
+ added temporary workaround for possible problems with some
GNU make versions
* harbour/make_deb.sh
+ build hbpgsql when libpq-dev is installed
* harbour/include/clipdefs.h
* do not define PBYTE, PSHORT, PUSHORT, PLONG, PULONG, PBOOL, PVOID
when HB_OS_OS2 && HB_DONT_DEFINE_BASIC_TYPES is defined
2007-12-15 18:35 UTC+0200 Mindaugas Kavaliauskas (dbtopas/at/dbtopas.lt)
* harbour/contrib/hbrddads/adsfunc.c
+ ADSGetServerName()

View File

@@ -11,7 +11,9 @@ HB_GT_LIST=\
gtstd \
# verify if GT drivers exist
HB_GT_LIBS := $(foreach gt, $(HB_GT_LIST), $(if $(wildcard $(TOP)$(ROOT)source/rtl/$(gt)),$(gt),))
#HB_GT_LIBS := $(foreach gt, $(HB_GT_LIST), $(if $(wildcard $(TOP)$(ROOT)source/rtl/$(gt)),$(gt),))
# temporary workaround for some possible problems with some GNU make versions
HB_GT_LIBS := $(HB_GT_LIST)
ifeq ($(HB_GT_LIB),)
HB_GT_LIB = gtos2

View File

@@ -61,7 +61,13 @@
*
*/
/* OS2 */
#define INCL_DOSFILEMGR /* File Manager values */
#define INCL_DOSERRORS /* DOS error values */
/* W32 */
#define HB_OS_WIN_32_USED
#include "hbapi.h"
#include "hbapifs.h"
#include "hbapiitm.h"
@@ -71,16 +77,19 @@
#include "ctdisk.ch"
#if defined( __DJGPP__ )
# include <dpmi.h>
# include <go32.h>
# include <sys/farptr.h>
# include <sys/param.h>
# include <dpmi.h>
# include <go32.h>
# include <sys/farptr.h>
# include <sys/param.h>
#endif
#if defined( OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
# include <sys/types.h>
# include <utime.h>
# include <unistd.h>
# include <time.h>
# include <sys/types.h>
# include <utime.h>
# include <unistd.h>
# include <time.h>
#elif defined( HB_OS_OS2 )
# include <os2.h>
# include <stdio.h>
#endif
static PHB_FFIND s_ffind = NULL;
@@ -175,9 +184,8 @@ HB_FUNC( SETFATTR )
{
#if defined( HB_OS_DOS )
#if defined( __DJGPP__ ) || defined( __BORLANDC__ )
int iFlags;
int iReturn = -1;
int iFlags;
const char *szFile = hb_parcx( 1 );
if( ISNUM( 2 ) )
@@ -186,12 +194,14 @@ HB_FUNC( SETFATTR )
iFlags = 32;
if( !( iFlags & ~( FA_ARCHIVE | FA_HIDDEN | FA_READONLY | FA_SYSTEM ) ) )
{
#if defined( __DJGPP__ ) || defined( __BORLANDC__ )
iReturn = _chmod( szFile, 1, iFlags );
hb_retni( iReturn );
#else
hb_retnl( -1 );
iReturn = _dos_setfileattr( pszDirName, iFlags );
#endif
}
hb_retni( iReturn );
#elif defined( HB_OS_WIN_32 )
@@ -213,8 +223,39 @@ HB_FUNC( SETFATTR )
HB_TCHAR_FREE( lpFile );
hb_retni( dwLastError );
#elif defined( HB_OS_OS2 )
FILESTATUS3 fs3;
ULONG ulAttr = FILE_NORMAL;
APIRET ulrc;
if( iAttr & FA_READONLY )
ulAttr |= FILE_READONLY;
if( iAttr & FA_HIDDEN )
ulAttr |= FILE_HIDDEN;
if( iAttr & FA_SYSTEM )
ulAttr |= FILE_SYSTEM;
if( iAttr & FA_ARCHIVE )
ulAttr |= FILE_ARCHIVED;
ulrc = DosQueryPathInfo( pszPathName, FIL_STANDARD, &fs3, sizeof( fs3 ) );
if( ulrc == NO_ERROR )
{
fs3.attrFile = ulAttr;
ulrc = DosSetPathInfo( pszPathName, FIL_STANDARD,
&fs3, sizeof( fs3 ), DSPI_WRTTHRU );
}
hb_retni( ulrc );
#elif defined( OS_UNIX_COMPATIBLE )
/* *nixes do not use DOS like file attributes */
hb_retnl( -1 );
#else
/* int TODO; */ /* To force warning */
hb_retnl( -1 );
#endif
@@ -241,74 +282,74 @@ HB_FUNC( SETFDATI )
sscanf( hb_itemGetCPtr( pTime ), "%2d:%2d:%2d", &hour, &minute, &second );
#if defined( HB_OS_WIN_32 ) && !defined( __CYGWIN__ )
FILETIME ft, local_ft;
SYSTEMTIME st;
HANDLE f = ( HANDLE ) _lopen( szFile, OF_READWRITE | OF_SHARE_COMPAT );
if( f != ( HANDLE ) HFILE_ERROR )
{
FILETIME ft, local_ft;
SYSTEMTIME st;
HANDLE f = ( HANDLE ) _lopen( szFile, OF_READWRITE | OF_SHARE_COMPAT );
if( f != ( HANDLE ) HFILE_ERROR )
{
if( !pDate || !pTime )
{
GetLocalTime( &st );
}
if( pDate )
{
st.wYear = year;
st.wMonth = month;
st.wDay = day;
}
if( pTime )
{
st.wHour = hour;
st.wMinute = minute;
st.wSecond = second;
}
SystemTimeToFileTime( &st, &local_ft );
LocalFileTimeToFileTime( &local_ft, &ft );
hb_retl( SetFileTime( f, NULL, &ft, &ft ) );
_lclose( ( HFILE ) f );
return;
}
}
#elif defined( OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
{
struct utimbuf buf;
struct tm new_value;
if( !pDate && !pTime )
{
hb_retl( utime( szFile, NULL ) == 0 );
return;
}
if( !pDate || !pTime )
{
time_t current_time;
current_time = time( NULL );
# if _POSIX_C_SOURCE < 199506L || defined( HB_OS_DARWIN_5 )
new_value = *localtime( &current_time );
# else
localtime_r( &current_time, &new_value );
# endif
GetLocalTime( &st );
}
if( pDate )
{
new_value.tm_year = year - 1900;
new_value.tm_mon = month - 1;
new_value.tm_mday = day;
st.wYear = year;
st.wMonth = month;
st.wDay = day;
}
if( pTime )
{
new_value.tm_hour = hour;
new_value.tm_min = minute;
new_value.tm_sec = second;
st.wHour = hour;
st.wMinute = minute;
st.wSecond = second;
}
buf.actime = buf.modtime = mktime( &new_value );
hb_retl( utime( szFile, &buf ) == 0 );
SystemTimeToFileTime( &st, &local_ft );
LocalFileTimeToFileTime( &local_ft, &ft );
hb_retl( SetFileTime( f, NULL, &ft, &ft ) );
_lclose( ( HFILE ) f );
return;
}
#elif defined( OS_UNIX_COMPATIBLE ) || defined( __DJGPP__ )
struct utimbuf buf;
struct tm new_value;
if( !pDate && !pTime )
{
hb_retl( utime( szFile, NULL ) == 0 );
return;
}
if( !pDate || !pTime )
{
time_t current_time;
current_time = time( NULL );
# if _POSIX_C_SOURCE < 199506L || defined( HB_OS_DARWIN_5 )
new_value = *localtime( &current_time );
# else
localtime_r( &current_time, &new_value );
# endif
}
if( pDate )
{
new_value.tm_year = year - 1900;
new_value.tm_mon = month - 1;
new_value.tm_mday = day;
}
if( pTime )
{
new_value.tm_hour = hour;
new_value.tm_min = minute;
new_value.tm_sec = second;
}
buf.actime = buf.modtime = mktime( &new_value );
hb_retl( utime( szFile, &buf ) == 0 );
return;
#else
int TODO; /* To force warning */
#endif
}
@@ -394,5 +435,7 @@ HB_FUNC( FILESMAX )
hb_retni( handles );
#elif defined( _SC_OPEN_MAX )
hb_retnl( sysconf( _SC_OPEN_MAX ) );
#else
hb_retni( -1 );
#endif
}

View File

@@ -69,14 +69,20 @@ typedef BOOL Boolean;
/* New types */
typedef BYTE * BYTEP;
typedef BYTEP PBYTE;
typedef BYTEP BYTEPP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef BYTEP PBYTE;
#endif
typedef SHORT * SHORTP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef SHORTP PSHORT;
#endif
typedef USHORT * USHORTP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef USHORTP PUSHORT;
#endif
#if !(defined(HB_OS_WIN_32) && defined(HB_OS_WIN_32_USED))
typedef unsigned int WORD;
@@ -85,17 +91,23 @@ typedef USHORTP PUSHORT;
#endif
typedef LONG * LONGP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef LONGP PLONG;
#endif
typedef ULONG * ULONGP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef ULONGP PULONG;
#endif
typedef unsigned long DWORD;
typedef DWORD * DWORDP;
typedef DWORDP PDWORD;
typedef BOOL * BOOLP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef BOOLP PBOOL;
#endif
typedef void * NEARP;
typedef NEARP * NEARPP;
@@ -104,7 +116,9 @@ typedef NEARP * NEARPP;
typedef void * FARP;
typedef FARP * FARPP;
typedef FARP VOIDP;
#if !( defined( HB_OS_OS2 ) && defined( HB_DONT_DEFINE_BASIC_TYPES ) )
typedef FARP PVOID;
#endif
typedef HB_VMHANDLE HANDLE;
#endif

View File

@@ -21,6 +21,11 @@ do
test_reqpkg "$i" || TOINST_LST="${TOINST_LST} $i"
done
if test_reqpkg libpq-dev
then
HB_CONTRIBLIBS="${HB_CONTRIBLIBS} hbpgsql"
fi
if [ -z "${TOINST_LST}" ] || [ "$1" = "--force" ]
then
. ./bin/pack_src.sh

View File

@@ -50,6 +50,11 @@
*
*/
/* OS2 */
#define INCL_DOSFILEMGR /* File Manager values */
#define INCL_DOSERRORS /* DOS error values */
/* W32 */
#define HB_OS_WIN_32_USED
#include "hbapi.h"
@@ -63,6 +68,9 @@
#if !defined( FILE_ATTRIBUTE_DEVICE )
#define FILE_ATTRIBUTE_DEVICE 0x00000040
#endif
#elif defined( HB_OS_OS2 )
#include <os2.h>
#include <stdio.h>
#elif defined( HB_OS_UNIX )
#include <sys/types.h>
#include <sys/stat.h>
@@ -315,6 +323,13 @@ HB_EXPORT BOOL hb_fsFileExists( const char * pszFileName )
( dwAttr & ( FILE_ATTRIBUTE_DIRECTORY |
FILE_ATTRIBUTE_DEVICE ) ) == 0;
}
#elif defined( HB_OS_OS2 )
{
FILESTATUS3 fs3;
if( DosQueryPathInfo( pszFileName, FIL_STANDARD,
&fs3, sizeof( fs3 ) ) == NO_ERROR )
fExist = ( fs3.attrFile & FILE_DIRECTORY ) == 0;
}
#elif defined( HB_OS_UNIX )
{
struct stat statbuf;
@@ -367,6 +382,13 @@ HB_EXPORT BOOL hb_fsDirExists( const char * pszDirName )
fExist = ( dwAttr != INVALID_FILE_ATTRIBUTES ) &&
( dwAttr & FILE_ATTRIBUTE_DIRECTORY );
}
#elif defined( HB_OS_OS2 )
{
FILESTATUS3 fs3;
if( DosQueryPathInfo( pszDirName, FIL_STANDARD,
&fs3, sizeof( fs3 ) ) == NO_ERROR )
fExist = ( fs3.attrFile & FILE_DIRECTORY ) != 0;
}
#elif defined( HB_OS_UNIX )
{
struct stat statbuf;

View File

@@ -635,8 +635,6 @@ static void hb_dbfTableCrypt( DBFAREAP pArea, PHB_ITEM pPasswd, BOOL fEncrypt )
{
HB_TRACE(HB_TR_DEBUG, ("hb_dbfTableCrypt(%p,%p,%d)", pArea, pPasswd, fEncrypt));
printf("\r\nhb_dbfTableCrypt(%d)\r\n", fEncrypt);fflush(stdout);
if( !pArea->fReadonly && !pArea->fShared &&
fEncrypt ? !pArea->fTableEncrypted && !pArea->fHasMemo :
pArea->fTableEncrypted )