From 970ec4e61dc2392238be3ffb9118d97f5af864a5 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 18 Mar 2009 19:22:47 +0000 Subject: [PATCH] 2009-03-18 20:17 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * source/vm/Makefile + source/vm/maindllp + source/vm/maindllp/Makefile + Added generation of hbmaindllp lib, to create pcode .dlls on Windows platform. -DHB_DYNLIB is always defined for this lib. This is just the first step, we will need compiler, hbmk2 and other changes. I'll contribute with hbmk2 changes. * source/vm/maindllp.c % Code made less verbose. ! Created HB_EXPORT declaration for DllEntryPoint(). * config/win/icc.cf * Changed optimization to -O3 (from MSVC ones). With max optim (-Ox) it was just a bit faster than MSVC 2008. + contrib/hbqt + contrib/hbqt/hbqt_qabstractbutton.cpp + contrib/hbqt/hbqt_qdialog.cpp + contrib/hbqt/hbqt.h + contrib/hbqt/Makefile + Added initial QT wrapper lib layout with content posted by Pritpal to the list. (I did a few renames, please check them) * contrib/hbwin/hbwapi.h * Fixes in header. --- harbour/ChangeLog | 29 +++ harbour/config/win/icc.cf | 4 +- harbour/contrib/hbqt/Makefile | 53 ++++ harbour/contrib/hbqt/hbqt.h | 64 +++++ harbour/contrib/hbqt/hbqt_qabstractbutton.cpp | 230 ++++++++++++++++++ harbour/contrib/hbqt/hbqt_qdialog.cpp | 145 +++++++++++ harbour/contrib/hbwin/hbwapi.h | 4 +- harbour/source/vm/Makefile | 2 +- harbour/source/vm/maindllp.c | 129 +++------- harbour/source/vm/maindllp/Makefile | 17 ++ 10 files changed, 578 insertions(+), 99 deletions(-) create mode 100644 harbour/contrib/hbqt/Makefile create mode 100644 harbour/contrib/hbqt/hbqt.h create mode 100644 harbour/contrib/hbqt/hbqt_qabstractbutton.cpp create mode 100644 harbour/contrib/hbqt/hbqt_qdialog.cpp create mode 100644 harbour/source/vm/maindllp/Makefile diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 11fa16fedd..998605038a 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,35 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-18 20:17 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * source/vm/Makefile + + source/vm/maindllp + + source/vm/maindllp/Makefile + + Added generation of hbmaindllp lib, to create pcode .dlls + on Windows platform. -DHB_DYNLIB is always defined for + this lib. This is just the first step, we will need compiler, + hbmk2 and other changes. I'll contribute with hbmk2 changes. + + * source/vm/maindllp.c + % Code made less verbose. + ! Created HB_EXPORT declaration for DllEntryPoint(). + + * config/win/icc.cf + * Changed optimization to -O3 (from MSVC ones). + With max optim (-Ox) it was just a bit faster than MSVC 2008. + + + contrib/hbqt + + contrib/hbqt/hbqt_qabstractbutton.cpp + + contrib/hbqt/hbqt_qdialog.cpp + + contrib/hbqt/hbqt.h + + contrib/hbqt/Makefile + + Added initial QT wrapper lib layout with content posted + by Pritpal to the list. (I did a few renames, please check + them) + + * contrib/hbwin/hbwapi.h + * Fixes in header. + 2009-03-18 20:07 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/minmax.c ! fixed min()/max() functions to always return the 1-st item when diff --git a/harbour/config/win/icc.cf b/harbour/config/win/icc.cf index 338027ae55..5670c597b2 100644 --- a/harbour/config/win/icc.cf +++ b/harbour/config/win/icc.cf @@ -19,7 +19,9 @@ CPPFLAGS = -I. -I$(HB_INC_COMPILE) CFLAGS = -W4 -Gs ifneq ($(HB_BUILD_OPTIM),no) -CFLAGS += -Ogt2yb1p -GX- -G6 -YX +# maximum optimizations +# CFLAGS += -Ox +CFLAGS += -O3 endif ifeq ($(HB_BUILD_DEBUG),yes) diff --git a/harbour/contrib/hbqt/Makefile b/harbour/contrib/hbqt/Makefile new file mode 100644 index 0000000000..e85830d72f --- /dev/null +++ b/harbour/contrib/hbqt/Makefile @@ -0,0 +1,53 @@ +# +# $Id$ +# + +ROOT = ../../ + +LIBNAME=hbqt + +ifneq ($(HB_ARCHITECTURE),dos) +ifneq ($(HB_ARCHITECTURE),os2) + +ifeq ($(HB_INC_QT),) +ifeq ($(HB_XBUILD),) +HB_INC_QT = /usr/include /usr/local/Trolltech/Qt-4.5.0/include /Developer/qt/include +endif +endif + +HB_INC_QT_OK += $(foreach d, $(HB_INC_QT), $(if $(wildcard $(d)/Qt/qatomic.h),$(d),)) + +ifneq ($(strip $(HB_INC_QT_OK)),) + +HB_USER_CFLAGS += $(foreach d, $(HB_INC_QT_OK), -I$(d)) + +CPP_SOURCES=\ + hbqt_qdialog.cpp \ + hbqt_qabstractbutton.cpp \ + +C_HEADERS=\ + hbqt.h \ + +#PRG_HEADERS=\ +# hbqt.ch \ +# hbqtextern.ch \ + +#PRG_SOURCES=\ +# xxx.prg \ + +include $(TOP)$(ROOT)config/header.cf +INSTALL_RULE_HEADERS := $(INSTALL_RULE) +include $(TOP)$(ROOT)config/lib.cf + +install:: + $(INSTALL_RULE_HEADERS) + +else +include $(TOP)$(ROOT)config/none.cf +endif +else +include $(TOP)$(ROOT)config/none.cf +endif +else +include $(TOP)$(ROOT)config/none.cf +endif diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h new file mode 100644 index 0000000000..fe6ba2ed2c --- /dev/null +++ b/harbour/contrib/hbqt/hbqt.h @@ -0,0 +1,64 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 {list of individual authors and e-mail addresses} + * 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. + * + */ + +#ifndef __HBQT_H +#define __HBQT_H + +#include + +#define hbqt_par_QWidget( n ) ( ( QWidget* ) hb_parptr( n ) ) +#define hbqt_par_QDialog( n ) ( ( QDialog* ) hb_parptr( n ) ) +#define hbqt_par_QAbstractButton( n ) ( ( QAbstractButton* ) hb_parptr( n ) ) +#define hbqt_par_QString( n ) ( ( QString ) hb_parc( n ) ) +#define hbqt_par_WindowFlags( n ) ( ( Qt::WindowFlags ) hb_parni( n ) ) + +#endif /* __HBQT_H */ diff --git a/harbour/contrib/hbqt/hbqt_qabstractbutton.cpp b/harbour/contrib/hbqt/hbqt_qabstractbutton.cpp new file mode 100644 index 0000000000..9b1780dba6 --- /dev/null +++ b/harbour/contrib/hbqt/hbqt_qabstractbutton.cpp @@ -0,0 +1,230 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 {list of individual authors and e-mail addresses} + * 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 "hbapi.h" + +#include "hbqt.h" + +#include + +/* +bool autoExclusive () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_AUTOEXCLUSIVE ) +{ + hb_retl( hbqt_par_QAbstractButton( 1 )->autoExclusive() ); +} + +/* +bool autoRepeat () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_AUTOREPEAT ) +{ + hb_retl( hbqt_par_QAbstractButton( 1 )->autoRepeat() ); +} + +/* +int autoRepeatDelay () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_AUTOREPEATDELAY ) +{ + hb_retni( hbqt_par_QAbstractButton( 1 )->autoRepeatDelay() ); +} + +/* +int autoRepeatInterval () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_AUTOREPEATINTERVAL ) +{ + hb_retni( hbqt_par_QAbstractButton( 1 )->autoRepeatInterval() ); +} + +/* +QButtonGroup * group () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_GROUP ) +{ + hb_retptr( ( QButtonGroup* ) hbqt_par_QAbstractButton( 1 )->group() ); +} + +/* +bool isCheckable () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_ISCHECKABLE ) +{ + hb_retl( hbqt_par_QAbstractButton( 1 )->isCheckable() ); +} + +/* +bool isChecked () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_ISCHECKED ) +{ + hb_retl( hbqt_par_QAbstractButton( 1 )->isChecked() ); +} + +/* +bool isDown () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_ISDOWN ) +{ + hb_retl( hbqt_par_QAbstractButton( 1 )->isDown() ); +} + +/* +void setAutoExclusive ( bool ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETAUTOEXCLUSIVE ) +{ + hbqt_par_QAbstractButton( 1 )->setAutoExclusive( hb_parl( 2 ) ); +} + +/* +void setAutoRepeat ( bool ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETAUTOREPEAT ) +{ + hbqt_par_QAbstractButton( 1 )->setAutoRepeat( hb_parl( 2 ) ); +} + +/* +void setAutoRepeatDelay ( int ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETAUTOREPEATDELAY ) +{ + hbqt_par_QAbstractButton( 1 )->setAutoRepeatDelay( hb_parni( 2 ) ); +} + +/* +void setAutoRepeatInterval ( int ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETAUTOREPEATINTERVAL ) +{ + hbqt_par_QAbstractButton( 1 )->setAutoRepeatInterval( hb_parni( 2 ) ); +} + +/* +void setCheckable ( bool ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETCHECKABLE ) +{ + hbqt_par_QAbstractButton( 1 )->setCheckable( hb_parl( 2 ) ); +} + +/* +void setDown ( bool ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETDOWN ) +{ + hbqt_par_QAbstractButton( 1 )->setDown( hb_parl( 2 ) ); +} + +/* +void setIcon ( const QIcon & icon ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETICON ) +{ + hbqt_par_QAbstractButton( 1 )->setIcon( QIcon( hbqt_par_QString( 2 ) ) ); +} + +/* +void setText ( const QString & text ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETTEXT ) +{ + hbqt_par_QAbstractButton( 1 )->setText( hbqt_par_QString( 2 ) ); +} + +/* +QString text () const +*/ +HB_FUNC( QT_QABSTRACTBUTTON_TEXT ) +{ + QString str1 = hbqt_par_QAbstractButton( 1 )->text(); + QByteArray ba = str1.toLatin1(); + const char * c_str2 = ba.data(); + hb_retc( c_str2 ); +} + +/* +void animateClick ( int msec = 100 ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_ANIMATECLICK ) +{ + hbqt_par_QAbstractButton( 1 )->animateClick( hb_parni( 2 ) ); +} + +/* +void click () +*/ +HB_FUNC( QT_QABSTRACTBUTTON_CLICK ) +{ + hbqt_par_QAbstractButton( 1 )->click(); +} + +/* +void setChecked ( bool ) +*/ +HB_FUNC( QT_QABSTRACTBUTTON_SETCHECKED ) +{ + hbqt_par_QAbstractButton( 1 )->setChecked( hb_parl( 2 ) ); +} + +/* +void toggle () +*/ +HB_FUNC( QT_QABSTRACTBUTTON_TOGGLE ) +{ + hbqt_par_QAbstractButton( 1 )->toggle(); +} + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/hbqt_qdialog.cpp b/harbour/contrib/hbqt/hbqt_qdialog.cpp new file mode 100644 index 0000000000..f0dab5bb22 --- /dev/null +++ b/harbour/contrib/hbqt/hbqt_qdialog.cpp @@ -0,0 +1,145 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 {list of individual authors and e-mail addresses} + * 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 "hbapi.h" + +#include "hbqt.h" + +/* +QDialog ( QWidget * parent = 0, Qt::WindowFlags f = 0 ) +*/ +HB_FUNC( QT_QDIALOG ) +{ + hb_retptr( new QDialog( hbqt_par_QWidget( 1 ), hbqt_par_WindowFlags( 2 ) ) ); +} + +/* +bool isModal () const +void setModal ( bool modal ) +*/ +HB_FUNC( QT_QDIALOG_ISMODAL ) +{ + hb_retl( hbqt_par_QDialog( 1 )->isModal() ); +} + +HB_FUNC( QT_QDIALOG_SETMODAL ) +{ + hbqt_par_QDialog( 1 )->setModal( hb_parl( 2 ) ); +} + +/* +bool isSizeGripEnabled () const +void setSizeGripEnabled ( bool ) +*/ +HB_FUNC( QT_QDIALOG_ISSIZEGRIPENABLED ) +{ + hb_retl( hbqt_par_QDialog( 1 )->isSizeGripEnabled() ); +} + +HB_FUNC( QT_QDIALOG_SETSIZEGRIPENABLED ) +{ + hbqt_par_QDialog( 1 )->setSizeGripEnabled( hb_parl( 2 ) ); +} + +/* +void QDialog::accept () [virtual slot] +*/ +HB_FUNC( QT_QDIALOG_ACCEPT ) +{ + hbqt_par_QDialog( 1 )->accept(); +} + +/* +void QDialog::done ( int r ) [virtual slot] +*/ +HB_FUNC( QT_QDIALOG_DONE ) +{ + hbqt_par_QDialog( 1 )->done( hb_parni( 2 ) ); +} + +/* +int QDialog::exec () [slot] +*/ +HB_FUNC( QT_QDIALOG_EXEC ) +{ + hb_retni( hbqt_par_QDialog( 1 )->exec() ); +} + +/* +void QDialog::open () [slot] +*/ +HB_FUNC( QT_QDIALOG_OPEN ) +{ + hbqt_par_QDialog( 1 )->open(); +} + +/* +void QDialog::reject () [virtual slot] +*/ +HB_FUNC( QT_QDIALOG_REJECT ) +{ + hbqt_par_QDialog( 1 )->reject(); +} + +/* +int QDialog::result () const +void QDialog::setResult ( int i ) +*/ +HB_FUNC( QT_QDIALOG_RESULT ) +{ + hb_retni( hbqt_par_QDialog( 1 )->result() ); +} + +HB_FUNC( QT_QDIALOG_SETRESULT ) +{ + hbqt_par_QDialog( 1 )->setResult( hb_parni( 2 ) ); +} diff --git a/harbour/contrib/hbwin/hbwapi.h b/harbour/contrib/hbwin/hbwapi.h index c9282d6fa9..0e77084ca1 100644 --- a/harbour/contrib/hbwin/hbwapi.h +++ b/harbour/contrib/hbwin/hbwapi.h @@ -4,9 +4,9 @@ /* * Harbour Project source code: - * Compiler Expression Optimizer + * Windows API (WAPI) wrapper main header * - * Copyright 2009 Development Team + * Copyright 2009 {list of individual authors and e-mail addresses} * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify diff --git a/harbour/source/vm/Makefile b/harbour/source/vm/Makefile index 30291e690a..0f539ffae9 100644 --- a/harbour/source/vm/Makefile +++ b/harbour/source/vm/Makefile @@ -17,7 +17,7 @@ ifeq ($(HB_ARCHITECTURE),win) DIRS = mainstd mainwin endif endif - DIRS += maindllh + DIRS += maindllh maindllp else ifeq ($(HB_ARCHITECTURE),os2) C_MAIN = mainstd.c diff --git a/harbour/source/vm/maindllp.c b/harbour/source/vm/maindllp.c index e5558a8aa0..0d38f2e169 100644 --- a/harbour/source/vm/maindllp.c +++ b/harbour/source/vm/maindllp.c @@ -78,6 +78,8 @@ #if defined(HB_OS_WIN) HB_EXTERN_BEGIN +BOOL WINAPI HB_EXPORT DllEntryPoint( HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved ); + static FARPROC hb_getProcAddress( LPCSTR szProcName ) { static HMODULE s_hModule = NULL; @@ -121,10 +123,10 @@ BOOL WINAPI DllEntryPoint( HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserve switch( fdwReason ) { case DLL_PROCESS_ATTACH: - break; + break; case DLL_PROCESS_DETACH: - break; + break; } return TRUE; @@ -213,33 +215,24 @@ char * hb_parc( int iParam, ... ) PHB_ITEM hb_param( int iParam, long lMask ) /* retrieve a generic parameter */ { - PHB_ITEM pReturn = NULL; FARPROC pParam = GetProcAddress( GetModuleHandle( NULL ), "_hb_param" ); - if( pParam ) - pReturn = ( ( HB_PARAM ) pParam )( iParam, lMask ); - return pReturn; + return pParam ? ( ( HB_PARAM ) pParam )( iParam, lMask ) : NULL; } PHB_ITEM hb_paramError( int iParam ) /* Returns either the generic parameter or a NIL item if param not provided */ { - PHB_ITEM pReturn = NULL; FARPROC pParamError = GetProcAddress( GetModuleHandle( NULL ), "_hb_paramError" ); - if( pParamError ) - pReturn = ( ( HB_PARAMERROR ) pParamError )( iParam ); - return pReturn; + return pParamError ? ( ( HB_PARAMERROR ) pParamError )( iParam ) : NULL; } int hb_pcount( void ) /* returns the number of suplied parameters */ { - int iReturn = 0; FARPROC pCounts = GetProcAddress( GetModuleHandle( NULL ), "_hb_pcount" ); - if( pCounts ) - iReturn = ( ( HB_PCOUNTS ) pCounts )(); - return iReturn; + return pCounts ? ( ( HB_PCOUNTS ) pCounts )() : 0; } void hb_retc( const char * szText ) /* returns a string */ { - FARPROC pRetc=GetProcAddress( GetModuleHandle( NULL ), "_hb_retc" ); + FARPROC pRetc = GetProcAddress( GetModuleHandle( NULL ), "_hb_retc" ); if( pRetc ) ( ( HB_RETC ) pRetc )( szText ); } @@ -337,20 +330,14 @@ void hb_reta( ULONG ulLen ) /* returns an array with a specific length */ ULONG hb_parinfa( int iParamNum, ULONG uiArrayIndex ) /* retrieve length or element type of an array parameter */ { - ULONG ulReturn = 0; FARPROC pParinfa = GetProcAddress( GetModuleHandle( NULL ), "_hb_parinfa" ); - if( pParinfa ) - ulReturn = ( ( HB_PARINFA ) pParinfa )( iParamNum, uiArrayIndex ); - return ulReturn; + return pParinfa ? ( ( HB_PARINFA ) pParinfa )( iParamNum, uiArrayIndex ) : 0; } ULONG hb_parinfo( int iParam ) /* Determine the param count or data type */ { - ULONG ulReturn = 0; FARPROC pParinfo = GetProcAddress( GetModuleHandle( NULL ), "_hb_parinfo" ); - if( pParinfo ) - ulReturn = ( ( HB_PARINFO ) pParinfo )( iParam ); - return ulReturn; + return pParinfo ? ( ( HB_PARINFO ) pParinfo )( iParam ) : 0; } ULONG hb_parclen( int iParam, ... ) /* retrieve a string parameter length */ @@ -609,7 +596,6 @@ int hb_storclen( const char * szText, ULONG ulLen, int iParam, ... ) ( ( HB_STORCLEN ) pStorC )( szText, ulLen, iParam ); return 1; } - } return 0; @@ -640,7 +626,6 @@ int hb_stords( const char * szDate, int iParam, ... ) ( ( HB_STORDS ) pStorDs )( szDate, iParam ); return 1; } - } return 0; @@ -670,7 +655,6 @@ int hb_storl( int iLogical, int iParam, ... ) ( ( HB_STORL ) pStorL )( iLogical, iParam ); return 1; } - } return 0; @@ -700,7 +684,6 @@ int hb_storni( int iValue, int iParam, ... ) ( ( HB_STORNI ) pStorNi )( iValue, iParam ); return 1; } - } return 0; @@ -730,7 +713,6 @@ int hb_stornl( long lValue, int iParam, ... ) ( ( HB_STORNL ) pStorNl )( lValue, iParam ); return 1; } - } return 0; @@ -760,7 +742,6 @@ int hb_stornd( double dNumber, int iParam, ... ) ( ( HB_STORND ) pStorNd )( dNumber, iParam ); return 1; } - } return 0; @@ -768,92 +749,62 @@ int hb_stornd( double dNumber, int iParam, ... ) BOOL hb_arrayNew( PHB_ITEM pItem, ULONG ulLen ) /* creates a new array */ { - HB_ARRAYNEW pArrayNew = ( HB_ARRAYNEW) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayNew" ); - if( pArrayNew ) - return pArrayNew( pItem, ulLen ); - else - return FALSE; + HB_ARRAYNEW pArrayNew = ( HB_ARRAYNEW) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayNew" ); + return pArrayNew ? pArrayNew( pItem, ulLen ) : FALSE; } ULONG hb_arrayLen( PHB_ITEM pArray ) /* retrives the array len */ { - HB_ARRAYLEN pArrayLen = ( HB_ARRAYLEN ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayLen" ); - if( pArrayLen ) - return pArrayLen( pArray ); - else - return 0; + HB_ARRAYLEN pArrayLen = ( HB_ARRAYLEN ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayLen" ); + return pArrayLen ? pArrayLen( pArray ) : 0; } BOOL hb_arrayIsObject( PHB_ITEM pArray ) /* retrives if the array is an object */ { - HB_ARRAYISOBJECT pArrayIsObject = ( HB_ARRAYISOBJECT ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayIsObject" ); - if( pArrayIsObject ) - return pArrayIsObject( pArray ); - else - return FALSE; + HB_ARRAYISOBJECT pArrayIsObject = ( HB_ARRAYISOBJECT ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayIsObject" ); + return pArrayIsObject ? pArrayIsObject( pArray ) : FALSE; } BOOL hb_arrayAdd( PHB_ITEM pArray, PHB_ITEM pItemValue ) /* add a new item to the end of an array item */ { - HB_ARRAYADD pArrayAdd = ( HB_ARRAYADD ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayAdd" ); - if( pArrayAdd ) - return pArrayAdd( pArray, pItemValue ); - else - return FALSE; + HB_ARRAYADD pArrayAdd = ( HB_ARRAYADD ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayAdd" ); + return pArrayAdd ? pArrayAdd( pArray, pItemValue ) : FALSE; } BOOL hb_arrayIns( PHB_ITEM pArray, ULONG ulIndex ) /* insert a nil item into an array, without changing the length */ { - HB_ARRAYINS pArrayIns = ( HB_ARRAYINS ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayIns" ); - if( pArrayIns ) - return pArrayIns( pArray, ulIndex ); - else - return FALSE; + HB_ARRAYINS pArrayIns = ( HB_ARRAYINS ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayIns" ); + return pArrayIns ? pArrayIns( pArray, ulIndex ) : FALSE; } BOOL hb_arrayDel( PHB_ITEM pArray, ULONG ulIndex ) /* delete an array item, without changing length */ { - HB_ARRAYDEL pArrayDel = ( HB_ARRAYDEL ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayDel" ); - if( pArrayDel ) - return pArrayDel( pArray, ulIndex ); - else - return FALSE; + HB_ARRAYDEL pArrayDel = ( HB_ARRAYDEL ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayDel" ); + return pArrayDel ? pArrayDel( pArray, ulIndex ) : FALSE; } BOOL hb_arraySize( PHB_ITEM pArray, ULONG ulLen ) /* sets the array total length */ { - HB_ARRAYSIZE pArraySize = ( HB_ARRAYSIZE ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arraySize" ); - if( pArraySize ) - return pArraySize( pArray, ulLen ); - else - return FALSE; + HB_ARRAYSIZE pArraySize = ( HB_ARRAYSIZE ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arraySize" ); + return pArraySize ? pArraySize( pArray, ulLen ) : FALSE; } BOOL hb_arrayLast( PHB_ITEM pArray, PHB_ITEM pResult ) /* retrieve last item in an array */ { - HB_ARRAYLAST pArrayLast = ( HB_ARRAYLAST ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayLast" ); - if( pArrayLast ) - return pArrayLast( pArray, pResult ); - else - return FALSE; + HB_ARRAYLAST pArrayLast = ( HB_ARRAYLAST ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayLast" ); + return pArrayLast ? pArrayLast( pArray, pResult ) : FALSE; } BOOL hb_arraySet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ) /* sets an array element */ { - HB_ARRAYSET pArraySet = ( HB_ARRAYSET ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arraySet" ); - if( pArraySet ) - return pArraySet( pArray, ulIndex, pItem); - else - return FALSE; + HB_ARRAYSET pArraySet = ( HB_ARRAYSET ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arraySet" ); + return pArraySet ? pArraySet( pArray, ulIndex, pItem) : FALSE; } BOOL hb_arrayGet( PHB_ITEM pArray, ULONG ulIndex, PHB_ITEM pItem ) /* retrieves an item */ { - HB_ARRAYGET pArrayGet = ( HB_ARRAYGET ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayGet" ); - if( pArrayGet ) - return pArrayGet( pArray, ulIndex, pItem); - else - return FALSE; + HB_ARRAYGET pArrayGet = ( HB_ARRAYGET ) GetProcAddress( GetModuleHandle( NULL ), "_hb_arrayGet" ); + return pArrayGet ? pArrayGet( pArray, ulIndex, pItem) : FALSE; } void hb_xinit( void ) /* Initialize fixed memory subsystem */ @@ -872,20 +823,14 @@ void hb_xexit( void ) /* Deinitialize fixed memory s void * hb_xalloc( ULONG ulSize ) /* allocates memory, returns NULL on failure */ { - void * pRet = NULL; HB_XALLOC pXalloc = ( HB_XALLOC ) GetProcAddress( GetModuleHandle( NULL ), "_hb_xalloc" ); - if( pXalloc ) - pRet = pXalloc( ulSize ); - return pRet; + return pXalloc ? pXalloc( ulSize ) : NULL; } void * hb_xgrab( ULONG ulSize ) /* allocates memory, exits on failure */ { - void * pRet = NULL; HB_XGRAB pXgrab = ( HB_XGRAB ) GetProcAddress( GetModuleHandle( NULL ), "_hb_xgrab" ); - if( pXgrab ) - pRet = pXgrab( ulSize ); - return pRet; + return pXgrab ? pXgrab( ulSize ) : NULL; } void hb_xfree( void * pMem ) /* frees memory */ @@ -897,20 +842,14 @@ void hb_xfree( void * pMem ) /* frees memory */ void * hb_xrealloc( void * pMem, ULONG ulSize ) /* reallocates memory */ { - void * pRet = NULL; HB_XREALLOC pXrealloc = ( HB_XREALLOC ) GetProcAddress( GetModuleHandle( NULL ), "_hb_xrealloc" ); - if( pXrealloc ) - pRet = ( void * ) pXrealloc( pMem, ulSize ); - return pRet; + return pXrealloc ? ( void * ) pXrealloc( pMem, ulSize ) : NULL; } ULONG hb_xsize( void * pMem ) /* returns the size of an allocated memory block */ { HB_XSIZE pXsize = ( HB_XSIZE ) GetProcAddress( GetModuleHandle( NULL ), "_hb_xsize" ); - ULONG ulReturn = 0; - if( pXsize ) - ulReturn = pXsize( ( void * ) pMem ); - return ulReturn; + return pXsize ? pXsize( ( void * ) pMem ) : 0; } HB_EXTERN_END diff --git a/harbour/source/vm/maindllp/Makefile b/harbour/source/vm/maindllp/Makefile new file mode 100644 index 0000000000..cde15b6aa4 --- /dev/null +++ b/harbour/source/vm/maindllp/Makefile @@ -0,0 +1,17 @@ +# +# $Id$ +# + +vpath %.c ../ + +ROOT = ../../../ + +C_SOURCES=\ + maindllp.c \ + +LIBNAME=hbmaindllp + +# always export symbols +HB_USER_CFLAGS += -DHB_DYNLIB + +include $(TOP)$(ROOT)config/lib.cf