2009-05-13 16:47 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbwin/Makefile
+ contrib/hbwin/legacy.c
+ Added deprecated compatibility wrappers:
MESSAGEBOX(), ANSITOWIDE(), WIDETOANSI(), OLE2TXTERROR().
+ Added deprecated compatibility wrapper TOLEAUTO for HB_OLEAUTO
class. This is probably not enough as there are other remaining
incompatibilities.
; TODO: users needing this please tweak it further.
+ Added deprecated compatibility wrapper hb_oleWideToAnsi(), which
now calls hb_mbtowc(). Not fully compatible for error cases, old
one could return NULL in some cases.
; TODO: Switch to hb_mbntowc().
+ Added deprecated compatibility wrapper hb_oleAnsiToWide(), which
now calls hb_wctomb(). Not fully compatible for error cases, old
one could return NULL in some cases.
; TODO: Switch to hb_wcntomb().
* contrib/hbwin/win_misc.c
+ Added WAPI_MESSAGEBOX()
+ Added WIN_ANSITOWIDE() (rewritten using common API. Please check.)
+ Added WIN_WIDETOANSI() (rewritten using common API. Please check.)
; NOTE: ANSI/WIDE conversions aren't 100% compatible for error
situations and empty strings. Old version could return NIL
in certain situations.
; None of these were tested besides successful compile.
This commit is contained in:
@@ -17,6 +17,34 @@
|
||||
past entries belonging to these authors: Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-05-13 16:47 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/hbwin/Makefile
|
||||
+ contrib/hbwin/legacy.c
|
||||
+ Added deprecated compatibility wrappers:
|
||||
MESSAGEBOX(), ANSITOWIDE(), WIDETOANSI(), OLE2TXTERROR().
|
||||
+ Added deprecated compatibility wrapper TOLEAUTO for HB_OLEAUTO
|
||||
class. This is probably not enough as there are other remaining
|
||||
incompatibilities.
|
||||
; TODO: users needing this please tweak it further.
|
||||
+ Added deprecated compatibility wrapper hb_oleWideToAnsi(), which
|
||||
now calls hb_mbtowc(). Not fully compatible for error cases, old
|
||||
one could return NULL in some cases.
|
||||
; TODO: Switch to hb_mbntowc().
|
||||
+ Added deprecated compatibility wrapper hb_oleAnsiToWide(), which
|
||||
now calls hb_wctomb(). Not fully compatible for error cases, old
|
||||
one could return NULL in some cases.
|
||||
; TODO: Switch to hb_wcntomb().
|
||||
|
||||
* contrib/hbwin/win_misc.c
|
||||
+ Added WAPI_MESSAGEBOX()
|
||||
+ Added WIN_ANSITOWIDE() (rewritten using common API. Please check.)
|
||||
+ Added WIN_WIDETOANSI() (rewritten using common API. Please check.)
|
||||
; NOTE: ANSI/WIDE conversions aren't 100% compatible for error
|
||||
situations and empty strings. Old version could return NIL
|
||||
in certain situations.
|
||||
|
||||
; None of these were tested besides successful compile.
|
||||
|
||||
2009-05-13 14:59 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/source/vm/runner.c
|
||||
% optimized memory allocation for symbol tables used in loaded .hrb
|
||||
|
||||
@@ -18,6 +18,7 @@ endif
|
||||
ifeq ($(HB_WITH_HBWIN),yes)
|
||||
|
||||
C_SOURCES = \
|
||||
legacy.c \
|
||||
olecore.c \
|
||||
oleinit.c \
|
||||
win_dll.c \
|
||||
|
||||
115
harbour/contrib/hbwin/legacy.c
Normal file
115
harbour/contrib/hbwin/legacy.c
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Compatibility calls.
|
||||
*
|
||||
* Copyright 2009 Viktor Szakats <syenar.01 syenar 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, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* 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 software; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
|
||||
*
|
||||
* As a special exception, the Harbour Project gives permission for
|
||||
* additional uses of the text contained in its release of Harbour.
|
||||
*
|
||||
* The exception is that, if you link the Harbour libraries 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 Harbour library code into it.
|
||||
*
|
||||
* This exception does not however invalidate any other reasons why
|
||||
* the executable file might be covered by the GNU General Public License.
|
||||
*
|
||||
* This exception applies only to the code released by the Harbour
|
||||
* Project under the name Harbour. If you copy code from other
|
||||
* Harbour Project or Free Software Foundation releases into a copy of
|
||||
* Harbour, as the General Public License permits, the exception does
|
||||
* not apply to the code that you add in this way. To avoid misleading
|
||||
* anyone as to the status of such modified files, you must delete
|
||||
* this exception notice from them.
|
||||
*
|
||||
* If you write modifications of your own for Harbour, it is your choice
|
||||
* whether to permit this exception to apply to your modifications.
|
||||
* If you do not wish that, delete this exception notice.
|
||||
*
|
||||
*/
|
||||
|
||||
#define HB_OS_WIN_USED
|
||||
|
||||
#include "hbapi.h"
|
||||
|
||||
HB_FUNC_EXTERN( OLEERRORTEXT );
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
HB_FUNC( OLE2TXTERROR )
|
||||
{
|
||||
HB_FUNC_EXEC( OLEERRORTEXT );
|
||||
}
|
||||
|
||||
HB_FUNC_EXTERN( HB_OLEAUTO );
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
HB_FUNC( TOLEAUTO )
|
||||
{
|
||||
HB_FUNC_EXEC( HB_OLEAUTO );
|
||||
}
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
/* Original version returned NULL for empty strings. */
|
||||
LPWSTR hb_oleAnsiToWide( LPSTR cString )
|
||||
{
|
||||
return hb_mbtowc( cString );
|
||||
}
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
/* Original version returned NULL for empty strings. */
|
||||
LPSTR hb_oleWideToAnsi( BSTR wString )
|
||||
{
|
||||
return hb_wctomb( wString );
|
||||
}
|
||||
|
||||
HB_FUNC_EXTERN( WIN_ANSITOWIDE );
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
/* Original version may have returned NIL in some error situations. */
|
||||
HB_FUNC( ANSITOWIDE )
|
||||
{
|
||||
HB_FUNC_EXEC( WIN_ANSITOWIDE );
|
||||
}
|
||||
|
||||
HB_FUNC_EXTERN( WIN_WIDETOANSI );
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
/* Original version may have returned NIL in some error situations. */
|
||||
HB_FUNC( WIDETOANSI )
|
||||
{
|
||||
HB_FUNC_EXEC( WIN_WIDETOANSI );
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
HB_FUNC_EXTERN( WAPI_MESSAGEBOX );
|
||||
|
||||
/* Deprecated. Compatibility with old OLE implementation. */
|
||||
HB_FUNC( MESSAGEBOX )
|
||||
{
|
||||
HB_FUNC_EXEC( WAPI_MESSAGEBOX );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -222,3 +222,30 @@ HB_FUNC( WAPI_SETERRORMODE )
|
||||
{
|
||||
hb_retni( SetErrorMode( ( UINT ) hb_parni( 1 ) ) );
|
||||
}
|
||||
|
||||
HB_FUNC( WAPI_MESSAGEBOX )
|
||||
{
|
||||
LPTSTR lpStr1 = HB_TCHAR_CONVTO( hb_parcx( 2 ) );
|
||||
LPTSTR lpStr2 = HB_TCHAR_CONVTO( hb_parcx( 3 ) );
|
||||
HWND hWnd = ISNUM( 1 ) ? ( HWND ) ( HB_PTRUINT ) hb_parnint( 1 ) :
|
||||
( HWND ) hb_parptr( 1 );
|
||||
hb_retni( MessageBox( hWnd, lpStr1, lpStr2, hb_parni( 4 ) ) );
|
||||
HB_TCHAR_FREE( lpStr1 );
|
||||
HB_TCHAR_FREE( lpStr2 );
|
||||
}
|
||||
|
||||
/* TODO: Add embedded zero support by using hb_mbntowc() */
|
||||
HB_FUNC( WIN_ANSITOWIDE )
|
||||
{
|
||||
BSTR wString = hb_mbtowc( hb_parcx( 1 ) );
|
||||
|
||||
hb_retclen_buffer( ( char * ) wString, SysStringLen( wString ) );
|
||||
}
|
||||
|
||||
/* TODO: Add embedded zero support by using hb_wcntomb() */
|
||||
HB_FUNC( WIN_WIDETOANSI )
|
||||
{
|
||||
char * cString = hb_wctomb( ( wchar_t * ) hb_parcx( 1 ) );
|
||||
|
||||
hb_retclen_buffer( cString, strlen( cString ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user