2010-01-20 16:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/wapi_wingdi.c
! Guarded for ! HB_OS_WIN_CE.
(mingwarm compiles it, but poccarm doesn't)
Maybe to focus on important things, we should drop
POCC support altogether?
* contrib/hbwin/win_tprn.prg
* WIN_DELETEDC() calls deleted. 'hDC := NIL' is enough.
* contrib/hbwin/Makefile
+ contrib/hbwin/wapi_alloc.c
* contrib/hbwin/win_prn1.c
+ Moved hbwapi_* low-level object handling functions to
separate WAPI source.
* WIN_DELETEDC() converted to compatibility stub, it
will no longer release the handle.
* contrib/hbwin/win_prn1.c
* contrib/hbwin/win_prn2.c
* contrib/hbwin/win_prn3.c
* contrib/hbwin/win_dll.c
% Deleted '#if defined( HB_OS_WIN )' guards.
(we can readd them for extra safety, but in this case
they should be readded consistently for all source files)
% Deleted '! defined( __RSXNT__ )' guards
RSXNT is not supported a dead compiler since long.
% Deleted '! defined( __CYGWIN__ )' guards.
It compiles with current Cygwin, if someone is interested
in older versions, pls send build results.
This commit is contained in:
@@ -17,6 +17,37 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-01-20 16:57 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/wapi_wingdi.c
|
||||
! Guarded for ! HB_OS_WIN_CE.
|
||||
(mingwarm compiles it, but poccarm doesn't)
|
||||
Maybe to focus on important things, we should drop
|
||||
POCC support altogether?
|
||||
|
||||
* contrib/hbwin/win_tprn.prg
|
||||
* WIN_DELETEDC() calls deleted. 'hDC := NIL' is enough.
|
||||
|
||||
* contrib/hbwin/Makefile
|
||||
+ contrib/hbwin/wapi_alloc.c
|
||||
* contrib/hbwin/win_prn1.c
|
||||
+ Moved hbwapi_* low-level object handling functions to
|
||||
separate WAPI source.
|
||||
* WIN_DELETEDC() converted to compatibility stub, it
|
||||
will no longer release the handle.
|
||||
|
||||
* contrib/hbwin/win_prn1.c
|
||||
* contrib/hbwin/win_prn2.c
|
||||
* contrib/hbwin/win_prn3.c
|
||||
* contrib/hbwin/win_dll.c
|
||||
% Deleted '#if defined( HB_OS_WIN )' guards.
|
||||
(we can readd them for extra safety, but in this case
|
||||
they should be readded consistently for all source files)
|
||||
% Deleted '! defined( __RSXNT__ )' guards
|
||||
RSXNT is not supported a dead compiler since long.
|
||||
% Deleted '! defined( __CYGWIN__ )' guards.
|
||||
It compiles with current Cygwin, if someone is interested
|
||||
in older versions, pls send build results.
|
||||
|
||||
2010-01-20 13:51 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* contrib/hbwin/Makefile
|
||||
+ contrib/hbwin/wapi_wingdi.c
|
||||
|
||||
@@ -28,6 +28,7 @@ C_SOURCES := \
|
||||
win_prn2.c \
|
||||
win_prn3.c \
|
||||
win_regc.c \
|
||||
wapi_alloc.c \
|
||||
wapi_commctrl.c \
|
||||
wapi_err.c \
|
||||
wapi_shellapi.c \
|
||||
|
||||
182
harbour/contrib/hbwin/wapi_alloc.c
Normal file
182
harbour/contrib/hbwin/wapi_alloc.c
Normal file
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Low-level Windows object handling functions
|
||||
*
|
||||
* Copyright 2008 Viktor Szakats (harbour.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"
|
||||
#include "hbwapi.h"
|
||||
|
||||
static HB_GARBAGE_FUNC( s_gc_HDC_release )
|
||||
{
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
DeleteDC( ( HDC ) *ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const HB_GC_FUNCS s_gc_HDC_funcs =
|
||||
{
|
||||
s_gc_HDC_release,
|
||||
hb_gcDummyMark
|
||||
};
|
||||
|
||||
void hbwapi_ret_HDC( HDC p )
|
||||
{
|
||||
if( p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HDC * ), &s_gc_HDC_funcs );
|
||||
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HDC hbwapi_par_HDC( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HDC_funcs, iParam );
|
||||
|
||||
return ph ? ( HDC ) * ph : ( HDC ) hb_parptr( iParam );
|
||||
}
|
||||
|
||||
static HB_GARBAGE_FUNC( s_gc_HPEN_release )
|
||||
{
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
DeleteObject( ( HPEN ) * ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const HB_GC_FUNCS s_gc_HPEN_funcs =
|
||||
{
|
||||
s_gc_HPEN_release,
|
||||
hb_gcDummyMark
|
||||
};
|
||||
|
||||
void hbwapi_ret_HPEN( HPEN p )
|
||||
{
|
||||
if( p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HPEN * ), &s_gc_HPEN_funcs );
|
||||
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HPEN hbwapi_par_HPEN( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HPEN_funcs, iParam );
|
||||
|
||||
return ph ? ( HPEN ) * ph : NULL;
|
||||
}
|
||||
|
||||
static HB_GARBAGE_FUNC( s_gc_HFONT_release )
|
||||
{
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
DeleteObject( ( HFONT ) * ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const HB_GC_FUNCS s_gc_HFONT_funcs =
|
||||
{
|
||||
s_gc_HFONT_release,
|
||||
hb_gcDummyMark
|
||||
};
|
||||
|
||||
void hbwapi_ret_HFONT( HFONT p )
|
||||
{
|
||||
if( p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HFONT * ), &s_gc_HFONT_funcs );
|
||||
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HFONT hbwapi_par_HFONT( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HFONT_funcs, iParam );
|
||||
|
||||
return ph ? ( HFONT ) * ph : NULL;
|
||||
}
|
||||
@@ -94,6 +94,8 @@ DEVMODE * hbwapi_par_DEVMODE( DEVMODE * p, int iParam, HB_BOOL bMandatory )
|
||||
return bMandatory ? p : NULL;
|
||||
}
|
||||
|
||||
#if ! defined( HB_OS_WIN_CE )
|
||||
|
||||
HB_FUNC( WAPI_CREATEDC )
|
||||
{
|
||||
void * hDriver;
|
||||
@@ -420,3 +422,5 @@ HB_FUNC( WAPI_GETTEXTFACE )
|
||||
else
|
||||
hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include "hbapiitm.h"
|
||||
#include "hbwinuni.h"
|
||||
|
||||
#if defined( HB_OS_WIN ) && !defined( __CYGWIN__ ) && !defined( HB_NO_ASM )
|
||||
#if !defined( __CYGWIN__ ) && !defined( HB_NO_ASM )
|
||||
|
||||
/* ==================================================================
|
||||
* DynaCall support comments below
|
||||
|
||||
@@ -74,138 +74,12 @@
|
||||
#include "hbwapi.h"
|
||||
#include "hbwinuni.h"
|
||||
|
||||
#if defined( HB_OS_WIN ) && !defined( HB_OS_WIN_CE )
|
||||
#if ! defined( HB_OS_WIN_CE )
|
||||
|
||||
#ifndef INVALID_FILE_SIZE
|
||||
#define INVALID_FILE_SIZE ( DWORD ) 0xFFFFFFFF
|
||||
#endif
|
||||
|
||||
static HB_GARBAGE_FUNC( s_gc_HDC_release )
|
||||
{
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && *ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
DeleteDC( ( HDC ) *ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const HB_GC_FUNCS s_gc_HDC_funcs =
|
||||
{
|
||||
s_gc_HDC_release,
|
||||
hb_gcDummyMark
|
||||
};
|
||||
|
||||
void hbwapi_ret_HDC( HDC p )
|
||||
{
|
||||
if( p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HDC * ), &s_gc_HDC_funcs );
|
||||
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HDC hbwapi_par_HDC( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HDC_funcs, iParam );
|
||||
|
||||
return ph ? ( HDC ) * ph : ( HDC ) hb_parptr( iParam );
|
||||
}
|
||||
|
||||
static HB_GARBAGE_FUNC( s_gc_HPEN_release )
|
||||
{
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
DeleteObject( ( HPEN ) * ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const HB_GC_FUNCS s_gc_HPEN_funcs =
|
||||
{
|
||||
s_gc_HPEN_release,
|
||||
hb_gcDummyMark
|
||||
};
|
||||
|
||||
void hbwapi_ret_HPEN( HPEN p )
|
||||
{
|
||||
if( p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HPEN * ), &s_gc_HPEN_funcs );
|
||||
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HPEN hbwapi_par_HPEN( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HPEN_funcs, iParam );
|
||||
|
||||
return ph ? ( HPEN ) * ph : NULL;
|
||||
}
|
||||
|
||||
static HB_GARBAGE_FUNC( s_gc_HFONT_release )
|
||||
{
|
||||
void ** ph = ( void ** ) Cargo;
|
||||
|
||||
/* Check if pointer is not NULL to avoid multiple freeing */
|
||||
if( ph && * ph )
|
||||
{
|
||||
/* Destroy the object */
|
||||
DeleteObject( ( HFONT ) * ph );
|
||||
|
||||
/* set pointer to NULL to avoid multiple freeing */
|
||||
*ph = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static const HB_GC_FUNCS s_gc_HFONT_funcs =
|
||||
{
|
||||
s_gc_HFONT_release,
|
||||
hb_gcDummyMark
|
||||
};
|
||||
|
||||
void hbwapi_ret_HFONT( HFONT p )
|
||||
{
|
||||
if( p )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HFONT * ), &s_gc_HFONT_funcs );
|
||||
|
||||
*ph = p;
|
||||
|
||||
hb_retptrGC( ph );
|
||||
}
|
||||
else
|
||||
hb_retptr( NULL );
|
||||
}
|
||||
|
||||
HFONT hbwapi_par_HFONT( int iParam )
|
||||
{
|
||||
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HFONT_funcs, iParam );
|
||||
|
||||
return ph ? ( HFONT ) * ph : NULL;
|
||||
}
|
||||
|
||||
HB_FUNC( WIN_CREATEDC )
|
||||
{
|
||||
if( HB_ISCHAR( 1 ) )
|
||||
@@ -271,11 +145,10 @@ HB_FUNC( WIN_ABORTDOC )
|
||||
hb_retl( hDC && ( AbortDoc( hDC ) > 0 ) );
|
||||
}
|
||||
|
||||
/* Compatibility dummy */
|
||||
HB_FUNC( WIN_DELETEDC )
|
||||
{
|
||||
s_gc_HDC_release( hb_parptrGC( &s_gc_HDC_funcs, 1 ) );
|
||||
|
||||
hb_retni( 0 ); /* Return zero as a new handle even if fails */
|
||||
hb_retni( 0 );
|
||||
}
|
||||
|
||||
HB_FUNC( WIN_STARTPAGE )
|
||||
|
||||
@@ -58,8 +58,7 @@
|
||||
#include "hbapiitm.h"
|
||||
#include "hbwinuni.h"
|
||||
|
||||
#if defined( HB_OS_WIN ) && \
|
||||
!( defined( __RSXNT__ ) || defined( __CYGWIN__ ) || defined( HB_OS_WIN_CE ) )
|
||||
#if ! defined( HB_OS_WIN_CE )
|
||||
|
||||
#define _ENUMPRN_FLAGS_ ( PRINTER_ENUM_LOCAL | PRINTER_ENUM_CONNECTIONS )
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@
|
||||
#include "hbapi.h"
|
||||
#include "hbwinuni.h"
|
||||
|
||||
#if defined( HB_OS_WIN ) && \
|
||||
!( defined( __RSXNT__ ) || defined( __CYGWIN__ ) || defined( HB_OS_WIN_CE ) )
|
||||
#if ! defined( HB_OS_WIN_CE )
|
||||
|
||||
/* NOTE: Based on hb_strncat() */
|
||||
static TCHAR * hb_tstrncat( TCHAR * pDest, const TCHAR * pSource, HB_SIZE nLen )
|
||||
|
||||
@@ -248,7 +248,6 @@ METHOD Create() CLASS WIN_PRN
|
||||
ENDIF
|
||||
|
||||
IF !lResult
|
||||
win_DeleteDC( ::hPrinterDC )
|
||||
::hPrinterDC := NIL
|
||||
ELSE
|
||||
// Set mapping mode to pixels, topleft down
|
||||
@@ -291,7 +290,6 @@ METHOD Destroy() CLASS WIN_PRN
|
||||
IF ::Printing
|
||||
::EndDoc()
|
||||
ENDIF
|
||||
win_DeleteDC( ::hPrinterDC )
|
||||
::hPrinterDC := NIL
|
||||
ENDIF
|
||||
RETURN .T.
|
||||
|
||||
Reference in New Issue
Block a user