diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 83282c512b..7519e91b98 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,22 @@ past entries belonging to these authors: Viktor Szakats. */ +2009-05-27 03:16 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * include/hbver.ch + * source/rtl/version.c + + Added hb_Version( HB_VER_COMPILER_CPP ) which + returns if the C compiler was used in C++ mode. + Mainly added for HB_BUILDINFO() emulation, maybe it + can be useful to set defaults in hbmk2, we will see. + + * contrib/xhb/Makefile + + contrib/xhb/xhbver.prg + + Added emulation of HB_BUILDINFO() xhb function. + + + contrib/xhb/xhbver.ch + + Copied xhb's hbver.ch under this name. + (borrowed from xhb, work of Andi Jahja) + 2009-05-27 02:06 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbct/print.c + added PRINTSEND() support for Windows platform. diff --git a/harbour/contrib/xhb/Makefile b/harbour/contrib/xhb/Makefile index 5e6cae1748..048f7118f6 100644 --- a/harbour/contrib/xhb/Makefile +++ b/harbour/contrib/xhb/Makefile @@ -58,6 +58,7 @@ PRG_SOURCES=\ xhbcomp.prg \ xhberr.prg \ xhbmt.prg \ + xhbver.prg \ PRG_HEADERS=\ hbcompat.ch \ diff --git a/harbour/contrib/xhb/xhbver.ch b/harbour/contrib/xhb/xhbver.ch new file mode 100644 index 0000000000..a0812e1001 --- /dev/null +++ b/harbour/contrib/xhb/xhbver.ch @@ -0,0 +1,92 @@ +/* + * $Id: hbver.ch,v 1.1 2005/03/09 05:38:01 andijahja Exp $ + */ + +/* + * Harbour Project source code: + * Header file for version information + * + * Copyright 2005 Andi Jahja + * 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 HB_VERX_CH_ +#define HB_VERX_CH_ + +#define _HB_VER_MAJOR 1 /* int */ +#define _HB_VER_MINOR 2 /* int */ +#define _HB_VER_REVISION 3 /* int */ +#define _HB_VER_LEX 4 /* char */ +#define _HB_VER_AS_STRING 5 /* char */ +#define _HB_PCODE_VER 6 /* int */ +#define _HB_VER_COMPILER 7 /* char */ +#define _HB_VER_PLATFORM 8 /* char */ +#define _HB_VER_BUILD_DATE 9 /* char */ +#define _HB_VER_BUILD_TIME 10 /* char */ +#define _HB_VER_LENTRY 11 /* char */ +#define _HB_VER_CHLCVS 12 /* char */ +#define _HB_VER_C_USR 13 /* char */ +#define _HB_VER_L_USR 14 /* char */ +#define _HB_VER_PRG_USR 15 /* char */ +#define _HB_EXTENSION 16 /* bool */ +#define _HB_C52_UNDOC 17 /* bool */ +#define _HB_C52_STRICT 18 /* bool */ +#define _HB_COMPAT_C53 19 /* bool */ +#define _HB_COMPAT_XPP 20 /* bool */ +#define _HB_COMPAT_VO 21 /* bool */ +#define _HB_COMPAT_FLAGSHIP 22 /* bool */ +#define _HB_COMPAT_FOXPRO 23 /* bool */ +#define _HB_COMPAT_DBASE 24 /* bool */ +#define _HB_HARBOUR_OBJ_GENERATION 25 /* bool */ +#define _HB_HARBOUR_STRICT_ANSI_C 26 /* bool */ +#define _HB_CPLUSPLUS 27 /* bool */ +#define _HB_HARBOUR_YYDEBUG 28 /* bool */ +#define _HB_SYMBOL_NAME_LEN 29 /* int */ +#define _HB_MULTITHREAD 30 /* bool */ +#define _HB_VM_OPTIMIZATION 31 /* int */ +#define _HB_LANG_ID 32 /* char */ +#define _HB_ARRAY_MODE 33 /* int */ +#define _HB_CREDITS 34 /* array */ +#define _HB_VER_LAST 35 /* last */ + +#endif /* HB_VERX_CH_ */ diff --git a/harbour/contrib/xhb/xhbver.prg b/harbour/contrib/xhb/xhbver.prg new file mode 100644 index 0000000000..25ef197b0e --- /dev/null +++ b/harbour/contrib/xhb/xhbver.prg @@ -0,0 +1,128 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * xhb HB_BUILDINFO() emulation. + * + * Copyright 2009 Viktor Szakats + * 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 "common.ch" +#include "hbver.ch" + +#include "xhbver.ch" + +FUNCTION hb_buildinfo( n ) + LOCAL v := Array( _HB_VER_LAST - 1 ) + + v[ _HB_VER_MAJOR ] := hb_Version( HB_VERSION_MAJOR ) + v[ _HB_VER_MINOR ] := hb_Version( HB_VERSION_MINOR ) + v[ _HB_VER_REVISION ] := hb_Version( HB_VERSION_RELEASE ) + v[ _HB_VER_LEX ] := "Flex" + v[ _HB_VER_AS_STRING ] := hb_Version( HB_VERSION_HARBOUR ) + v[ _HB_PCODE_VER ] := hb_Version( HB_VERSION_PCODE_VER ) + v[ _HB_VER_COMPILER ] := hb_Version( HB_VERSION_COMPILER ) + v[ _HB_VER_PLATFORM ] := OS() + v[ _HB_VER_BUILD_DATE ] := Left( hb_Version( HB_VERSION_BUILD_DATE_STR ), 11 ) + v[ _HB_VER_BUILD_TIME ] := hb_Version( HB_VERSION_BUILD_TIME ) + v[ _HB_VER_LENTRY ] := hb_Version( HB_VERSION_CHANGELOG_LAST ) + v[ _HB_VER_CHLCVS ] := hb_Version( HB_VERSION_CHANGELOG_ID ) + v[ _HB_VER_C_USR ] := hb_Version( HB_VERSION_FLAG_C ) + v[ _HB_VER_L_USR ] := hb_Version( HB_VERSION_FLAG_LINKER ) + v[ _HB_VER_PRG_USR ] := hb_Version( HB_VERSION_FLAG_PRG ) + v[ _HB_EXTENSION ] := .F. +#ifdef HB_C52_UNDOC + v[ _HB_C52_UNDOC ] := .T. +#else + v[ _HB_C52_UNDOC ] := .F. +#endif +#ifdef HB_C52_STRICT + v[ _HB_C52_STRICT ] := .T. +#else + v[ _HB_C52_STRICT ] := .F. +#endif +#ifdef HB_COMPAT_C53 + v[ _HB_COMPAT_C53 ] := .T. +#else + v[ _HB_COMPAT_C53 ] := .F. +#endif +#ifdef HB_COMPAT_XPP + v[ _HB_COMPAT_XPP ] := .T. +#else + v[ _HB_COMPAT_XPP ] := .F. +#endif +#ifdef HB_COMPAT_VO + v[ _HB_COMPAT_VO ] := .T. +#else + v[ _HB_COMPAT_VO ] := .F. +#endif +#ifdef HB_COMPAT_FLAGSHIP + v[ _HB_COMPAT_FLAGSHIP ] := .T. +#else + v[ _HB_COMPAT_FLAGSHIP ] := .F. +#endif +#ifdef HB_COMPAT_FOXPRO + v[ _HB_COMPAT_FOXPRO ] := .T. +#else + v[ _HB_COMPAT_FOXPRO ] := .F. +#endif +#ifdef HB_COMPAT_DBASE + v[ _HB_COMPAT_DBASE ] := .T. +#else + v[ _HB_COMPAT_DBASE ] := .F. +#endif + v[ _HB_HARBOUR_OBJ_GENERATION ] := .F. /* Always off in Harbour */ + v[ _HB_HARBOUR_STRICT_ANSI_C ] := .F. /* Fake value, unlikely it's turned on */ + v[ _HB_CPLUSPLUS ] := hb_Version( HB_VERSION_COMPILER_CPP ) + v[ _HB_HARBOUR_YYDEBUG ] := .F. /* Fake value, unlikely it's turned on */ + v[ _HB_SYMBOL_NAME_LEN ] := 63 /* Constant in Harbour */ + v[ _HB_MULTITHREAD ] := hb_mtvm() + v[ _HB_VM_OPTIMIZATION ] := 2 /* Emulate xhb */ + v[ _HB_LANG_ID ] := hb_LangSelect() + v[ _HB_ARRAY_MODE ] := 0 /* Emulate xhb */ + v[ _HB_CREDITS ] := { "See 'harbour /credits'" } + + RETURN iif( ISNUMBER( n ), iif( n <= Len( v ), v[ n ], NIL ), v ) diff --git a/harbour/include/hbver.ch b/harbour/include/hbver.ch index 52f4663cd5..9f007cbc6f 100644 --- a/harbour/include/hbver.ch +++ b/harbour/include/hbver.ch @@ -80,7 +80,8 @@ #define HB_VERSION_MT 19 #define HB_VERSION_UNIX_COMPAT 20 #define HB_VERSION_PLATFORM 21 -#define HB_VERSION_CPU 24 /* Last. Please continue from here. */ +#define HB_VERSION_CPU 24 +#define HB_VERSION_COMPILER_CPP 25 /* Last. Please continue from here. */ /* hb_version( HB_VERSION_ENDIANNESS ) return values. */ #define HB_VERSION_ENDIAN_LITTLE 1 diff --git a/harbour/source/rtl/version.c b/harbour/source/rtl/version.c index 5793deb6ce..c19cdb6c9f 100644 --- a/harbour/source/rtl/version.c +++ b/harbour/source/rtl/version.c @@ -138,6 +138,14 @@ HB_FUNC( HB_VERSION ) #endif break; + case HB_VERSION_COMPILER_CPP: + #if defined( __cplusplus ) + hb_retl( TRUE ); + #else + hb_retl( FALSE ); + #endif + break; + case HB_VERSION_PLATFORM: #if defined( HB_OS_DOS ) hb_retc_const( "DOS" );