[Harbour] SF.net SVN: harbour-project:[10164] trunk/harbour
Viktor Szakáts
harbour.01 at syenar.hu
Wed Feb 4 19:12:01 EST 2009
>
> hbwapi.h
> =======
> #define wapi_parwparam( n ) ( ( WPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parlparam( n ) ( ( LPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parhandle( n ) ( ( HANDLE ) ( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parhwnd( n ) ( ( HWND ) ( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parwndproc( n ) ( ( WNDPROC ) ( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parhdc( n ) ( ( HDC ) ( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parcolor( n ) ( ( COLORREF )( HB_PTRDIFF ) hb_parnint( n ) )
> #define wapi_parstruct( n ) ( hb_parc( n ) )
We should also allow for hb_parptr(). Also, I'd exactly replicate
the type name in the macro/function name (easier to recognize,
easier to grep):
#define wapi_par_WPARAM() ( ( WPARAM ) ( ISNUM( iParam ) ? ( HB_PTRDIFF )
hb_parnint( n ) : hb_parptr( n ) ) )
> #define wapi_rethandle( n ) ( hb_retnint( ( HB_PTRDIFF ) n ) )
We should rather use hb_retptr() for handles and pointers.
hb_retnint() is meant for large numbers, or mixed use values.
> #define HB_HWND HWND
> #define HB_COLORREF COLORREF
> #define HB_HDC HDC
> // etc.
>
> /* IMO, we must avoid the direct API types at the API level */
I'm not sure if this is necessary. Windows is one layer,
on the top of that comes the .prg interface, no need to add
another layer of abstraction IMO. This just makes maintenance
more complicated.
> wapi_gdi.c
> ========
> /*
> All functions prefixed with WAPI_* will accept parameters in
> the same order and types, including structures. Only in cases
> where a complex structure is involved, an array of same number
> of elements corresponding members of the structure. If both
> can be implemented, the better it could be.
> */
> #include <windows.h>
> #include <gdi32.h>
> #include "hbwapi.h"
Instead of #include <windows.h>, we should still use
'#define HB_OS_WIN_USED', placed before the first
Harbour include file.
Also, please use /* ANSI C */ comments exclusively.
Brgds,
Viktor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.harbour-project.org/pipermail/harbour/attachments/20090205/b837ad54/attachment.html
More information about the Harbour
mailing list