19991025-19:09 GMT+1 Victor Szel <info@szelvesz.hu>
This commit is contained in:
@@ -1,3 +1,36 @@
|
||||
19991025-19:09 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
* source/rtl/filesys.c
|
||||
+ CURDRIVE() XBase++ compatible function added, between HB_COMPAT_XPP
|
||||
guards, it also has a TODO:
|
||||
! hb_fsCurDrv() fixed to convert the return value of the OS calls to
|
||||
the Clipper standard.
|
||||
! hb_fsChDrv() / DISKCHANGE(), CURDRIVE()
|
||||
hb_fsIsDrv() / ISDISK()
|
||||
hb_fsCurDrv() / DISKNAME()
|
||||
hb_fsMkDir() / MAKEDIR()
|
||||
hb_fsChDir() / DIRCHANGE()
|
||||
hb_fsRmDir() / DIRREMOVE()
|
||||
hb_fsCurDir() / CURDIR()
|
||||
hb_fsIsDevice()
|
||||
All these fixed, so that now they work with WIN32/MINGW32.
|
||||
* source/rtl/mouseapi.c
|
||||
+ SETMOUSE() and NUMBUTTONS() XBase++ compatible functions added,
|
||||
between HB_COMPAT_XPP
|
||||
+ source/rtl/oemansi.c
|
||||
source/rtl/Makefile
|
||||
config/w32/mingw32.cf
|
||||
+ HB_ANSITOOEM() new Win32 related function added (Harbour extension)
|
||||
+ HB_OEMTOANSI() new Win32 related function added (Harbour extension)
|
||||
+ CONVTOOEMCP() XBase++ compatible function added (between HB_COMPAT_XPP)
|
||||
+ CONVTOANSICP() XBase++ compatible function added (between HB_COMPAT_XPP)
|
||||
; IMPORTANT NOTE: This may cause problems in other platform, since USER32
|
||||
should be linked in. (WIN32/MINGW32 platform arranged)
|
||||
* source/rdd/dbf1.c
|
||||
- Some HB_SYMBOL_UNUSED() macros removed, since the variables are used.
|
||||
* source/tools/ctcrypt.c
|
||||
source/rtl/isprint.c
|
||||
* Some formatting.
|
||||
|
||||
19991025-12:30 EDT Paul Tucker <ptucker@sympatico.ca>
|
||||
* source/tools/ctcrypt.c
|
||||
* added some casts
|
||||
@@ -40,6 +73,7 @@ Mon Oct 25 13:14:42 1999 Gonzalo A. Diethelm <Gonzalo.Diethelm@jda.cl>
|
||||
* source/rtl/inkey.c:
|
||||
Added/corrected a few calls to HB_TRACE().
|
||||
|
||||
>>>>>>> 1.1294
|
||||
19991025-15:20 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
* tests/memory.prg
|
||||
+ Using hbmemory.ch
|
||||
|
||||
@@ -32,6 +32,9 @@ endif
|
||||
|
||||
LINKLIBS += $(foreach lib, $(LIBS), -l$(lib))
|
||||
|
||||
# This library is needed for kbhit() and getch() support.
|
||||
LINKLIBS += -luser32
|
||||
|
||||
# If LIBS specifies the rdd library, add all DB drivers.
|
||||
ifeq ($(findstring rdd,$(LIBS)),rdd)
|
||||
LINKPATHS += $(foreach drv, $(HB_DB_DRIVERS), -L$(TOP)$(ROOT)source/rdd/$(drv)/$(ARCH))
|
||||
|
||||
@@ -901,7 +901,6 @@ static ERRCODE dbfGetValueFile( AREAP pArea, USHORT uiIndex, void * pFile )
|
||||
BYTE * szText, szEndChar;
|
||||
LPFIELD pField;
|
||||
|
||||
HB_SYMBOL_UNUSED( pFile );
|
||||
if( uiIndex > pArea->uiFieldCount )
|
||||
return FAILURE;
|
||||
|
||||
@@ -1388,8 +1387,6 @@ static ERRCODE dbfPutValueFile( AREAP pArea, USHORT uiIndex, void * pFile )
|
||||
BYTE * szText, szEndChar;
|
||||
ULONG lMemoBlock;
|
||||
|
||||
HB_SYMBOL_UNUSED( pFile );
|
||||
|
||||
if( uiIndex > pArea->uiFieldCount )
|
||||
return FAILURE;
|
||||
|
||||
@@ -1411,8 +1408,6 @@ static ERRCODE dbfPutValueFile( AREAP pArea, USHORT uiIndex, void * pFile )
|
||||
|
||||
static ERRCODE dbfRawLock( AREAP pArea, USHORT uiAction, ULONG lRecNo )
|
||||
{
|
||||
HB_SYMBOL_UNUSED( lRecNo );
|
||||
|
||||
if( SELF_GOCOLD( pArea ) == FAILURE )
|
||||
return FAILURE;
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ C_SOURCES=\
|
||||
mtran.c \
|
||||
natmsg.c \
|
||||
net.c \
|
||||
oemansi.c \
|
||||
oldbox.c \
|
||||
oldclear.c \
|
||||
samples.c \
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
* hb_fsReadLarge()
|
||||
* hb_fsWriteLarge()
|
||||
* HB_CURDIR()
|
||||
* HB_CURDRIVE()
|
||||
* HB_DIRCHANGE()
|
||||
* HB_MAKEDIR()
|
||||
* HB_DIRREMOVE()
|
||||
@@ -889,11 +890,11 @@ BOOL hb_fsMkDir( BYTE * pDirname )
|
||||
|
||||
HB_TRACE(("hb_fsMkDir(%s)", (char*) pDirname));
|
||||
|
||||
#if defined(HAVE_POSIX_IO)
|
||||
#if defined(HAVE_POSIX_IO) || defined(__MINGW32__)
|
||||
|
||||
errno = 0;
|
||||
|
||||
#if !defined(__WATCOMC__) && !defined(__BORLANDC__) && !defined(__IBMCPP__)
|
||||
#if !defined(__WATCOMC__) && !defined(__BORLANDC__) && !defined(__IBMCPP__) && !defined(__MINGW32__)
|
||||
iResult = mkdir( ( char * ) pDirname, S_IWUSR | S_IRUSR );
|
||||
#else
|
||||
iResult = mkdir( ( char * ) pDirname );
|
||||
@@ -917,7 +918,7 @@ BOOL hb_fsChDir( BYTE * pDirname )
|
||||
|
||||
HB_TRACE(("hb_fsChDir(%s)", (char*) pDirname));
|
||||
|
||||
#if defined(HAVE_POSIX_IO)
|
||||
#if defined(HAVE_POSIX_IO) || defined(__MINGW32__)
|
||||
|
||||
errno = 0;
|
||||
iResult = chdir( ( char * ) pDirname );
|
||||
@@ -939,7 +940,7 @@ BOOL hb_fsRmDir( BYTE * pDirname )
|
||||
|
||||
HB_TRACE(("hb_fsRmDir(%s)", (char*) pDirname));
|
||||
|
||||
#if defined(HAVE_POSIX_IO)
|
||||
#if defined(HAVE_POSIX_IO) || defined(__MINGW32__)
|
||||
|
||||
errno = 0;
|
||||
iResult = rmdir( ( char * ) pDirname );
|
||||
@@ -966,7 +967,7 @@ BYTE * hb_fsCurDir( USHORT uiDrive )
|
||||
|
||||
HB_SYMBOL_UNUSED( uiDrive );
|
||||
|
||||
#if defined(HAVE_POSIX_IO)
|
||||
#if defined(HAVE_POSIX_IO) || defined(__MINGW32__)
|
||||
|
||||
errno = 0;
|
||||
getcwd( cwd_buff, PATH_MAX );
|
||||
@@ -991,7 +992,7 @@ USHORT hb_fsChDrv( BYTE nDrive )
|
||||
|
||||
HB_TRACE(("hb_fsChDrv(%d)", (int) nDrive));
|
||||
|
||||
#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__)
|
||||
#if ( defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) ) || defined(__MINGW32__)
|
||||
|
||||
{
|
||||
USHORT uiSave = _getdrive();
|
||||
@@ -1017,7 +1018,7 @@ USHORT hb_fsChDrv( BYTE nDrive )
|
||||
USHORT uiSave = _getdrive();
|
||||
USHORT uiTotal;
|
||||
|
||||
/* 1= A:, 2 = B:, 3 = C:, etc
|
||||
/* 1 = A:, 2 = B:, 3 = C:, etc
|
||||
* _dos_*() functions don't set 'errno'
|
||||
*/
|
||||
_dos_getdrive( &uiSave );
|
||||
@@ -1060,7 +1061,7 @@ USHORT hb_fsIsDrv( BYTE nDrive )
|
||||
|
||||
HB_TRACE(("hb_fsIsDrv(%d)", (int) nDrive));
|
||||
|
||||
#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__)
|
||||
#if ( defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) ) || defined(__MINGW32__)
|
||||
|
||||
{
|
||||
USHORT uiSave = _getdrive();
|
||||
@@ -1120,7 +1121,7 @@ BOOL hb_fsIsDevice( FHANDLE hFileHandle )
|
||||
|
||||
HB_TRACE(("hb_fsIsDevice(%p)", hFileHandle));
|
||||
|
||||
#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__)
|
||||
#if ( defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) ) || defined(__MINGW32__)
|
||||
|
||||
errno = 0;
|
||||
bResult = ( isatty( hFileHandle ) == 0 );
|
||||
@@ -1145,25 +1146,23 @@ BYTE hb_fsCurDrv( void )
|
||||
|
||||
HB_TRACE(("hb_fsCurDrv()"));
|
||||
|
||||
#if defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) || defined(__MINGW32__) ) && ! defined(__CYGWIN__)
|
||||
#if ( defined(HAVE_POSIX_IO) && ( defined(OS2) || defined(DOS) || defined(_Windows) ) && ! defined(__CYGWIN__) ) || defined(__MINGW32__)
|
||||
|
||||
{
|
||||
errno = 0;
|
||||
uiResult = _getdrive();
|
||||
uiResult = _getdrive() - 1;
|
||||
s_uiErrorLast = errno;
|
||||
}
|
||||
|
||||
#elif defined( __WATCOMC__ )
|
||||
|
||||
{
|
||||
USHORT uiDrive;
|
||||
|
||||
/* 1= A:, 2 = B:, 3 = C:, etc
|
||||
/* 1 = A:, 2 = B:, 3 = C:, etc
|
||||
* _dos_*() functions don't set 'errno'
|
||||
*/
|
||||
_dos_getdrive( &uiDrive );
|
||||
_dos_getdrive( &uiResult );
|
||||
s_uiErrorLast = 0;
|
||||
uiResult = ( USHORT ) uiDrive;
|
||||
uiResult--;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -1173,7 +1172,7 @@ BYTE hb_fsCurDrv( void )
|
||||
|
||||
#endif
|
||||
|
||||
return uiResult;
|
||||
return ( BYTE ) uiResult;
|
||||
}
|
||||
|
||||
/* TODO: Implement hb_fsExtOpen */
|
||||
@@ -1566,6 +1565,31 @@ HARBOUR HB_DISKNAME( void )
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HB_COMPAT_XPP
|
||||
|
||||
/* NOTE: XBase++ compatible */
|
||||
|
||||
HARBOUR HB_CURDRIVE( void )
|
||||
{
|
||||
USHORT uiErrorOld = s_uiErrorLast;
|
||||
char szDrive[ 1 ];
|
||||
|
||||
szDrive[ 0 ] = ( ( char ) hb_fsCurDrv() ) + 'A';
|
||||
hb_retclen( szDrive, 1 );
|
||||
|
||||
if( ISCHAR( 1 ) && hb_parclen( 1 ) > 0 )
|
||||
{
|
||||
if( hb_fsChDrv( ( USHORT )( toupper( *hb_parc( 1 ) ) - 'A' ) ) != 0 )
|
||||
{
|
||||
/* TODO: Throw some XBase++ like runtime error. */
|
||||
}
|
||||
}
|
||||
|
||||
s_uiErrorLast = uiErrorOld;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define IS_PATH_SEP( c ) ( strchr( OS_PATH_DELIMITER_LIST, ( c ) ) != NULL )
|
||||
|
||||
/* Split given filename into path, name and extension */
|
||||
|
||||
@@ -32,7 +32,11 @@
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: The following #include "hbwinapi.h" must
|
||||
be ahead of any other #include statements! */
|
||||
#include "hbwinapi.h"
|
||||
|
||||
#include "extend.h"
|
||||
#include "filesys.h"
|
||||
|
||||
@@ -102,7 +106,7 @@ HARBOUR HB_ISPRINTER( void )
|
||||
if( ( hb_strnicmp( pszDOSPort, "LPT", 3 ) == 0 ||
|
||||
hb_strnicmp( pszDOSPort, "COM", 3 ) == 0 ) && uiPort > 0 )
|
||||
{
|
||||
FHANDLE fhnd = hb_fsOpen( (BYTE *)pszDOSPort, FO_WRITE | FO_SHARED | FO_PRIVATE );
|
||||
FHANDLE fhnd = hb_fsOpen( ( BYTE * ) pszDOSPort, FO_WRITE | FO_SHARED | FO_PRIVATE );
|
||||
bIsPrinter = ( fhnd != FS_ERROR );
|
||||
hb_fsClose( fhnd );
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
*/
|
||||
|
||||
#include "extend.h"
|
||||
#include "itemapi.h"
|
||||
#include "mouseapi.h"
|
||||
#include "gtapi.h"
|
||||
|
||||
@@ -308,3 +309,35 @@ HARBOUR MSETBOUNDS( void )
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HB_COMPAT_XPP
|
||||
|
||||
/* NOTE: XBase++ compatible function */
|
||||
|
||||
HARBOUR HB_NUMBUTTONS( void )
|
||||
{
|
||||
hb_retni( hb_mouseCountButton() );
|
||||
}
|
||||
|
||||
/* NOTE: XBase++ compatible function */
|
||||
|
||||
HARBOUR HB_SETMOUSE( void )
|
||||
{
|
||||
hb_retl( hb_mouseGetCursor() );
|
||||
|
||||
if( ISLOG( 1 ) )
|
||||
hb_mouseSetCursor( hb_parl( 1 ) );
|
||||
|
||||
{
|
||||
PHB_ITEM pRow = hb_param( 2, IT_NUMERIC );
|
||||
PHB_ITEM pCol = hb_param( 3, IT_NUMERIC );
|
||||
|
||||
if( pRow || pCol )
|
||||
{
|
||||
hb_mouseSetPos( pRow ? hb_itemGetNI( pRow ) : hb_mouseRow() ,
|
||||
pCol ? hb_itemGetNI( pCol ) : hb_mouseCol() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
107
harbour/source/rtl/oemansi.c
Normal file
107
harbour/source/rtl/oemansi.c
Normal file
@@ -0,0 +1,107 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* OEM <-> ANSI string conversion functions (Win32 specific, XBase++ ext.)
|
||||
*
|
||||
* Copyright 1999 Victor Szel <info@szelvesz.hu>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
/* NOTE: These are Win32 specific, for other platforms it will return the
|
||||
passed parameter unchanged. */
|
||||
|
||||
/* NOTE: The following #include "hbwinapi.h" must
|
||||
be ahead of any other #include statements! */
|
||||
#include "hbwinapi.h"
|
||||
#include <winuser.h>
|
||||
|
||||
#include "extend.h"
|
||||
#include "itemapi.h"
|
||||
|
||||
HARBOUR HB_HB_ANSITOOEM( void )
|
||||
{
|
||||
PHB_ITEM pString = hb_param( 1, IT_STRING );
|
||||
|
||||
if( pString )
|
||||
#if defined(_Windows) || defined(WINNT)
|
||||
{
|
||||
DWORD ulLen = hb_itemGetCLen( pString );
|
||||
char * pszDst = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
|
||||
CharToOemBuff( ( LPCSTR ) hb_itemGetCPtr( pString ), ( LPSTR ) pszDst, ulLen );
|
||||
|
||||
hb_retclen( pszDst, ulLen );
|
||||
hb_xfree( pszDst );
|
||||
}
|
||||
#else
|
||||
hb_itemReturn( pString );
|
||||
#endif
|
||||
else
|
||||
hb_retc( "" );
|
||||
}
|
||||
|
||||
HARBOUR HB_HB_OEMTOANSI( void )
|
||||
{
|
||||
PHB_ITEM pString = hb_param( 1, IT_STRING );
|
||||
|
||||
if( pString )
|
||||
#if defined(_Windows) || defined(WINNT)
|
||||
{
|
||||
DWORD ulLen = hb_itemGetCLen( pString );
|
||||
char * pszDst = ( char * ) hb_xgrab( ulLen + 1 );
|
||||
|
||||
OemToCharBuff( ( LPCSTR ) hb_itemGetCPtr( pString ), ( LPSTR ) pszDst, ulLen );
|
||||
|
||||
hb_retclen( pszDst, ulLen );
|
||||
hb_xfree( pszDst );
|
||||
}
|
||||
#else
|
||||
hb_itemReturn( pString );
|
||||
#endif
|
||||
else
|
||||
hb_retc( "" );
|
||||
}
|
||||
|
||||
#ifdef HB_COMPAT_XPP
|
||||
|
||||
/* NOTE: XBase++ compatible function */
|
||||
|
||||
HARBOUR HB_CONVTOOEMCP( void )
|
||||
{
|
||||
HB_HB_ANSITOOEM();
|
||||
}
|
||||
|
||||
/* NOTE: XBase++ compatible function */
|
||||
|
||||
HARBOUR HB_CONVTOANSICP( void )
|
||||
{
|
||||
HB_HB_OEMTOANSI();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -41,14 +41,14 @@ HARBOUR HB_CT_CRYPT( void )
|
||||
|
||||
if( ulCryptLen >= 2 )
|
||||
{
|
||||
BYTE * pbyCrypt = ( BYTE *)hb_parc( 2 );
|
||||
BYTE * pbyCrypt = ( BYTE * ) hb_parc( 2 );
|
||||
ULONG ulCryptPos = 0;
|
||||
|
||||
BYTE * pbyString = (BYTE *)hb_parc( 1 );
|
||||
BYTE * pbyString = ( BYTE * ) hb_parc( 1 );
|
||||
ULONG ulStringLen = hb_parclen( 1 );
|
||||
ULONG ulStringPos;
|
||||
|
||||
BYTE * pbyResult = (BYTE *)hb_xgrab( ulStringLen + 1 );
|
||||
BYTE * pbyResult = ( BYTE * ) hb_xgrab( ulStringLen + 1 );
|
||||
|
||||
USHORT uiCount2 = ( ( ( USHORT ) ( pbyCrypt[ ulCryptPos ] + ( USHORT ) ( pbyCrypt[ ulCryptPos + 1 ] * 256 ) ) ) & 0xFFFF ) ^ ( ( USHORT ) ulCryptLen & 0xFFFF );
|
||||
USHORT uiCount1 = 0xAAAA;
|
||||
@@ -102,7 +102,7 @@ HARBOUR HB_CT_CRYPT( void )
|
||||
ulCryptPos = 0;
|
||||
}
|
||||
|
||||
hb_retclen( (char *)pbyResult, ulStringLen );
|
||||
hb_retclen( ( char * ) pbyResult, ulStringLen );
|
||||
hb_xfree( pbyResult );
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user