Files
harbour-core/harbour/contrib/hbwin/wapi_alloc.c
Viktor Szakats 5cfcb4f323 2010-02-09 03:55 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/common/Makefile
  * src/common/hbwince.c
  + src/common/hbwin.c
    ! Moved Windows UNICODE helper function into new source,
      leaving WinCE API local emulation into separate source file.

  * include/hbwince.h
    + Now automatically includes windows.h. (since it depends on it)

  * include/hbdefs.h
    - Deleted HB_OS_WIN_USED autodetection. Not needed anymore.
    ! Fixed to not include hbwince.h anymore. It should be included
      directly from source files, where needed.

  * include/hbdefs.h
  * contrib/hbodbc/odbc.c
  * contrib/rddsql/sddodbc/odbcdd.c
    + Always defining HB_TCHAR_*() macros. They will be dummies
      in non-Windows or non-UNICODE builds.

  * include/clipdefs.h
    ! Legacy Clipper types moved to the bottom, because it's
      no longer true that hbapi.h defines their dependent types
      (our legacy ones).

  * contrib/hbwin/win_bmpd.c
  * contrib/hbwin/wapi_wingdi.c
  * contrib/hbwin/win_misc.c
  * contrib/hbwin/wapi_winbase.c
  * contrib/hbwin/wapi_alloc.c
  * contrib/hbwin/wapi_winuser.c
  * contrib/hbwin/hbwin.h
  * contrib/hbwin/hbwinole.h
  * contrib/hbwin/mapi.c
  * contrib/hbwin/wapi_wingdi_font.c
  * contrib/hbwin/olecore.c
  * contrib/hbwin/wce_simc.c
  * contrib/hbwin/wapi_winnls.c
  * contrib/hbwin/win_bmp.c
  * contrib/hbwin/win_com.c
  * contrib/hbwin/Makefile
  * contrib/hbwin/win_regc.c
  * contrib/hbwin/win_prn1.c
  * contrib/hbwin/win_prn2.c
  * contrib/hbwin/win_prn3.c
  * contrib/hbwin/wapi_commctrl.c
  * contrib/hbwin/win_osc.c
  * contrib/hbwin/wce_smsc.c
  * contrib/hbwin/wapi_err.c
  * contrib/hbwin/legacycd.c
  * contrib/hbwin/hbwapi.h
  * contrib/hbwin/wapi_shellapi.c
  * contrib/hbwin/win_dlg.c
  * contrib/hbwin/legacyco.c
  * contrib/hbwin/win_dll.c
  * contrib/hbwin/wapi_winbase_mutex.c
    + Reworked the way windows.h is included and headers
      are organized. New types allow complete control and
      flexibility. Finally.

  * src/vm/mainwin.c
  * src/vm/maindll.c
  * src/vm/maindllh.c
  * src/vm/cmdarg.c
  * src/vm/maindllp.c
  * src/vm/task.c
  * src/vm/fm.c
  * src/vm/extrap.c
  * src/vm/thread.c
  * src/vm/hvmall.c
  * src/vm/dynlibhb.c
  * src/common/hbgete.c
  * src/common/hbffind.c
  * src/common/hbver.c
  * src/common/hbtrace.c
  * src/common/hbfsapi.c
  * src/common/hbdate.c
  * src/rtl/gtwin/gtwin.c
  * src/rtl/fstemp.c
  * src/rtl/gttone.c
  * src/rtl/fserr.c
  * src/rtl/filesys.c
  * src/rtl/lang.c
  * src/rtl/diskspac.c
  * src/rtl/console.c
  * src/rtl/cputime.c
  * src/rtl/gtclip.c
  * src/rtl/oemansi.c
  * src/rtl/disksphb.c
  * src/rtl/net.c
  * src/rtl/gtgui/gtgui.c
  * src/rtl/hbproces.c
  * src/rtl/gtwvt/gtwvt.h
  * src/rtl/gtwvt/gtwvt.c
  * src/rtl/gtkbstat.c
  * contrib/hbct/ctnet.c
  * contrib/hbct/dattime3.c
  * contrib/hbct/disk.c
  * contrib/hbodbc/odbc.c
  * contrib/xhb/hboutdbg.c
  * contrib/xhb/xhberrc.c
  * contrib/xhb/filestat.c
  * contrib/xhb/hbserv.c
  * contrib/hbtpathy/tpwin.c
  * contrib/hbmzip/hbmzip.c
  * contrib/hbqt/hbqt_base.cpp
  * contrib/hbnf/getenvrn.c
  * contrib/rddsql/sddodbc/odbcdd.c
  * contrib/rddads/adsx.c
  * contrib/rddads/adsfunc.c
  * contrib/rddads/rddads.h
  * contrib/rddads/ads1.c
  * contrib/rddads/adsmgmnt.c
  * examples/hbapollo/apollo.c
    + HB_OS_WIN_USED trick replaced with direct windows.h
      inclusion, just like we do for all other OSes.
    + Also inclded hbwince.h in source files which required
      it. Please test it.

  * contrib/hbqt/gtqtc/gtqtc.cpp
    - Deleted commented code to not create false grep hits
      all the time.
2010-02-09 02:58:53 +00:00

264 lines
6.1 KiB
C

/*
* $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.
*
*/
#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_HBRUSH_release )
{
void ** ph = ( void ** ) Cargo;
/* Check if pointer is not NULL to avoid multiple freeing */
if( ph && *ph )
{
/* Destroy the object */
DeleteObject( ( HBRUSH ) *ph );
/* set pointer to NULL to avoid multiple freeing */
*ph = NULL;
}
}
static const HB_GC_FUNCS s_gc_HBRUSH_funcs =
{
s_gc_HBRUSH_release,
hb_gcDummyMark
};
void hbwapi_ret_HBRUSH( HBRUSH p )
{
if( p )
{
void ** ph = ( void ** ) hb_gcAllocate( sizeof( HBRUSH * ), &s_gc_HBRUSH_funcs );
*ph = p;
hb_retptrGC( ph );
}
else
hb_retptr( NULL );
}
HBRUSH hbwapi_par_HBRUSH( int iParam )
{
void ** ph = ( void ** ) hb_parptrGC( &s_gc_HBRUSH_funcs, iParam );
return ph ? ( HBRUSH ) *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;
}
static HB_GARBAGE_FUNC( s_gc_PDEVMODE_release )
{
void ** ph = ( void ** ) Cargo;
/* Check if pointer is not NULL to avoid multiple freeing */
if( ph && *ph )
{
/* Destroy the object */
hb_xfree( *ph );
/* set pointer to NULL to avoid multiple freeing */
*ph = NULL;
}
}
static const HB_GC_FUNCS s_gc_PDEVMODE_funcs =
{
s_gc_PDEVMODE_release,
hb_gcDummyMark
};
void hbwapi_ret_PDEVMODE( PDEVMODE p )
{
if( p )
{
void ** ph = ( void ** ) hb_gcAllocate( sizeof( PDEVMODE * ), &s_gc_PDEVMODE_funcs );
*ph = p;
hb_retptrGC( ph );
}
else
hb_retptr( NULL );
}
PDEVMODE hbwapi_par_PDEVMODE( int iParam )
{
void ** ph = ( void ** ) hb_parptrGC( &s_gc_PDEVMODE_funcs, iParam );
return ph ? ( PDEVMODE ) *ph : NULL;
}