diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 945b12ed27..e55e27d83d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,47 @@ The license applies to all entries newer than 2009-04-28. */ +2012-08-24 14:11 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/include/hbapicls.h + * harbour/src/vm/classes.c + + added new C function: + PHB_ITEM hb_objGetVarPtr( PHB_ITEM pObject, PHB_DYNS pVarMsg ); + it returns pointer to object instance variable + + * harbour/src/rtl/tclass.prg + * cleand parameter name + + * harbour/contrib/hbmisc/spd.c + * removed unnecessary comment for older version which didn't use + hb_snprintf() + * formatting + + * harbour/contrib/hbmxml/3rd/minixml/config.h + % use hb_snprintf() and hb_vsnprintf() instead of local emulation + based on CRTL sprintf() + + * harbour/include/hbdefs.h + + added HB_PF64 definition - it's printf format for HB_[UI]64 type + + * harbour/src/3rd/tiff/print.c + * harbour/src/3rd/tiff/tiffconf.h + ! use HB_PF64 instead of PFLL + + * harbour/src/3rd/tiff/tiffconf.h + + added TIFF_FILE_HANDLE definition + + * harbour/src/3rd/tiff/tiffio.h + ! use TIFF_FILE_HANDLE + + * harbour/src/3rd/tiff/dirread.c + ! fixed typo in TIFF_UINT32_MAX definition + + * harbour/src/3rd/tiff/Makefile + ! enabled fcntl.h in *unix builds + + * harbour/src/3rd/tiff/tiff.dif + * updated + 2012-08-23 21:25 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/gtwvg/gtwvg.c - Reverted: last commit. It was by mistake and went unnoticed, @@ -162,7 +203,7 @@ * harbour/src/rtl/gtwvt/gtwvt.c * harbour/src/rtl/gtwvt/gtwvt.h + added support for HB_GTI_UNITRANS - due to limited support - for unicode vlaues in MS-Windows raster fonts it's necessary + for unicode values in MS-Windows raster fonts it's necessary for some custom fonts. * harbour/src/rtl/tpersist.prg diff --git a/harbour/contrib/hbmisc/spd.c b/harbour/contrib/hbmisc/spd.c index 1eb17af826..a146c24b35 100644 --- a/harbour/contrib/hbmisc/spd.c +++ b/harbour/contrib/hbmisc/spd.c @@ -84,13 +84,6 @@ static HB_UINT SCItm( char * cBuffer, HB_UINT ulMaxBuf, char * cParFrm, int iCOu { HB_UINT s; - /* NOTE: In DJGPP (4.2.3) hb_snprintf() will be preprocessed to sprintf(), which - makes ulMaxBuf unused, and this in turn causes a warning, so we're - manually suppressing it. [vszakats] */ - #if defined( __DJGPP__ ) - HB_SYMBOL_UNUSED( ulMaxBuf ); - #endif - if( IsIndW && IsIndP ) { switch( iCOut ) @@ -106,9 +99,8 @@ static HB_UINT SCItm( char * cBuffer, HB_UINT ulMaxBuf, char * cParFrm, int iCOu break; /* case 'c': case 'C': case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': */ default: - s = - hb_snprintf( cBuffer, ulMaxBuf, cParFrm, iIndWidth, iIndPrec, - ( HB_IS_LONG( pItmPar ) ? hb_itemGetNL( pItmPar ) : hb_itemGetNI( pItmPar ) ) ); + s = hb_snprintf( cBuffer, ulMaxBuf, cParFrm, iIndWidth, iIndPrec, + HB_IS_LONG( pItmPar ) ? hb_itemGetNL( pItmPar ) : hb_itemGetNI( pItmPar ) ); } } else if( IsIndW || IsIndP ) @@ -128,9 +120,8 @@ static HB_UINT SCItm( char * cBuffer, HB_UINT ulMaxBuf, char * cParFrm, int iCOu break; /* case 'c': case 'C': case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': */ default: - s = - hb_snprintf( cBuffer, ulMaxBuf, cParFrm, iInd, - ( HB_IS_LONG( pItmPar ) ? hb_itemGetNL( pItmPar ) : hb_itemGetNI( pItmPar ) ) ); + s = hb_snprintf( cBuffer, ulMaxBuf, cParFrm, iInd, + HB_IS_LONG( pItmPar ) ? hb_itemGetNL( pItmPar ) : hb_itemGetNI( pItmPar ) ); } } else @@ -148,9 +139,8 @@ static HB_UINT SCItm( char * cBuffer, HB_UINT ulMaxBuf, char * cParFrm, int iCOu break; /* case 'c': case 'C': case 'd': case 'i': case 'o': case 'u': case 'x': case 'X': */ default: - s = - hb_snprintf( cBuffer, ulMaxBuf, cParFrm, - ( HB_IS_LONG( pItmPar ) ? hb_itemGetNL( pItmPar ) : hb_itemGetNI( pItmPar ) ) ); + s = hb_snprintf( cBuffer, ulMaxBuf, cParFrm, + HB_IS_LONG( pItmPar ) ? hb_itemGetNL( pItmPar ) : hb_itemGetNI( pItmPar ) ); } } return s; diff --git a/harbour/contrib/hbmxml/3rd/minixml/config.h b/harbour/contrib/hbmxml/3rd/minixml/config.h index 83f0842358..903a2de1bb 100644 --- a/harbour/contrib/hbmxml/3rd/minixml/config.h +++ b/harbour/contrib/hbmxml/3rd/minixml/config.h @@ -26,6 +26,15 @@ #include "hbdefs.h" #include "hb_io.h" +#include "hbapi.h" +#define HAVE_SNPRINTF 1 +#undef snprintf +#define snprintf hb_snprintf + +#define HAVE_VSNPRINTF 1 +#undef vsnprintf +#define vsnprintf hb_vsnprintf + #if defined ( _MSC_VER ) #define close _close #define open _open diff --git a/harbour/include/hbapicls.h b/harbour/include/hbapicls.h index 06d7c7c213..ecc2629946 100644 --- a/harbour/include/hbapicls.h +++ b/harbour/include/hbapicls.h @@ -130,6 +130,8 @@ extern HB_EXPORT HB_BOOL hb_objHasMessage( PHB_ITEM pObject, PHB_DYNS pMessag extern HB_EXPORT PHB_ITEM hb_objSendMsg( PHB_ITEM pObj, const char *sMsg, HB_ULONG ulArg, ... ); extern HB_EXPORT PHB_ITEM hb_objSendMessage( PHB_ITEM pObj, PHB_DYNS pMessage, HB_ULONG ulArg, ... ); +extern HB_EXPORT PHB_ITEM hb_objGetVarPtr( PHB_ITEM pObject, PHB_DYNS pVarMsg ); + /* send message which allows to set execution context for debugger */ extern HB_EXPORT void hb_dbg_objSendMessage( int iProcLevel, PHB_ITEM pObject, PHB_ITEM pMessage, int iParamOffset ); diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index b3939d1915..18a1acb074 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -317,6 +317,7 @@ typedef HB_UCHAR HB_U8; #define HB_I64_MIN LONG_MIN #define HB_I64_MAX LONG_MAX #define HB_U64_MAX ULONG_MAX + #define HB_PF64 "l" # if !defined( UINT64_MAX ) # define UINT64_MAX ULONG_MAX # endif @@ -718,6 +719,10 @@ typedef HB_U32 HB_FATTR; # define PFHL PFLL #endif +#ifndef HB_PF64 +# defien HB_PF64 PFLL +#endif + #if defined( HB_OS_WIN_64 ) # define HB_PFS PFLL #else diff --git a/harbour/src/3rd/tiff/Makefile b/harbour/src/3rd/tiff/Makefile index 50beb22c71..38342c471a 100644 --- a/harbour/src/3rd/tiff/Makefile +++ b/harbour/src/3rd/tiff/Makefile @@ -60,6 +60,7 @@ ifeq ($(HB_PLATFORM),win) # HB_CFLAGS += -DUSE_WIN32_FILEIO else ifeq ($(HB_PLATFORM_UNIX),yes) C_SOURCES += unix.c + HB_CFLAGS += -DHAVE_FCNTL_H endif ifeq ($(filter $(HB_COMPILER),<>),) diff --git a/harbour/src/3rd/tiff/dirread.c b/harbour/src/3rd/tiff/dirread.c index 1089e50867..02700a4ba5 100644 --- a/harbour/src/3rd/tiff/dirread.c +++ b/harbour/src/3rd/tiff/dirread.c @@ -3194,7 +3194,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32 value) /* * Largest 32-bit unsigned integer value. */ -#define TIFF_UINT32_MAX UINT64_MAX +#define TIFF_UINT32_MAX UINT32_MAX static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongLong8(uint64 value) diff --git a/harbour/src/3rd/tiff/print.c b/harbour/src/3rd/tiff/print.c index c0b1f56a95..a9ce2c4fb1 100644 --- a/harbour/src/3rd/tiff/print.c +++ b/harbour/src/3rd/tiff/print.c @@ -101,7 +101,7 @@ _TIFFPrintField(FILE* fd, const TIFFField *fip, else if(fip->field_type == TIFF_SLONG8) fprintf(fd, TIFF_INT64_FORMAT, (TIFF_INT64_T)((int64 *) raw_data)[j]); else if(fip->field_type == TIFF_IFD8) - fprintf(fd, "0x%" PFLL "x", + fprintf(fd, "0x%" HB_PF64 "x", (TIFF_UINT64_T)((uint64 *) raw_data)[j]); else if(fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *)raw_data)[j]); @@ -224,7 +224,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) uint16 i; long l, n; - fprintf(fd, "TIFF Directory at offset 0x%" PFLL "x (%" PFLL "u)\n", + fprintf(fd, "TIFF Directory at offset 0x%" HB_PF64 "x (%" HB_PF64 "u)\n", (TIFF_UINT64_T) tif->tif_diroff, (TIFF_UINT64_T) tif->tif_diroff); if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) { @@ -530,7 +530,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) { fprintf(fd, " SubIFD Offsets:"); for (i = 0; i < td->td_nsubifd; i++) - fprintf(fd, " %5" PFLL "u", + fprintf(fd, " %5" HB_PF64 "u", (TIFF_UINT64_T) td->td_subifd[i]); fputc('\n', fd); } @@ -631,7 +631,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags) (long) td->td_nstrips, isTiled(tif) ? "Tiles" : "Strips"); for (s = 0; s < td->td_nstrips; s++) - fprintf(fd, " %3lu: [%8" PFLL "u, %8" PFLL "u]\n", + fprintf(fd, " %3lu: [%8" HB_PF64 "u, %8" HB_PF64 "u]\n", (unsigned long) s, (TIFF_UINT64_T) td->td_stripoffset[s], (TIFF_UINT64_T) td->td_stripbytecount[s]); diff --git a/harbour/src/3rd/tiff/tiff.dif b/harbour/src/3rd/tiff/tiff.dif index a52a77c3ba..7f5592065a 100644 --- a/harbour/src/3rd/tiff/tiff.dif +++ b/harbour/src/3rd/tiff/tiff.dif @@ -19,7 +19,7 @@ diff -urN tiff.orig\dirread.c tiff\dirread.c -#else -# define TIFF_UINT32_MAX 0xFFFFFFFFLL -#endif -+#define TIFF_UINT32_MAX UINT64_MAX ++#define TIFF_UINT32_MAX UINT32_MAX static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongLong8(uint64 value) @@ -216,7 +216,7 @@ diff -urN tiff.orig\print.c tiff\print.c - fprintf(fd, "0x%llx", - (unsigned long long)((uint64 *) raw_data)[j]); -#endif -+ fprintf(fd, "0x%" PFLL "x", ++ fprintf(fd, "0x%" HB_PF64 "x", + (TIFF_UINT64_T)((uint64 *) raw_data)[j]); else if(fip->field_type == TIFF_FLOAT) fprintf(fd, "%f", ((float *)raw_data)[j]); @@ -234,7 +234,7 @@ diff -urN tiff.orig\print.c tiff\print.c - (unsigned long long) tif->tif_diroff, - (unsigned long long) tif->tif_diroff); -#endif -+ fprintf(fd, "TIFF Directory at offset 0x%" PFLL "x (%" PFLL "u)\n", ++ fprintf(fd, "TIFF Directory at offset 0x%" HB_PF64 "x (%" HB_PF64 "u)\n", + (TIFF_UINT64_T) tif->tif_diroff, + (TIFF_UINT64_T) tif->tif_diroff); if (TIFFFieldSet(tif,FIELD_SUBFILETYPE)) { @@ -251,7 +251,7 @@ diff -urN tiff.orig\print.c tiff\print.c - fprintf(fd, " %5llu", - (unsigned long long) td->td_subifd[i]); -#endif -+ fprintf(fd, " %5" PFLL "u", ++ fprintf(fd, " %5" HB_PF64 "u", + (TIFF_UINT64_T) td->td_subifd[i]); fputc('\n', fd); } @@ -262,7 +262,7 @@ diff -urN tiff.orig\print.c tiff\print.c for (s = 0; s < td->td_nstrips; s++) -#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) - fprintf(fd, " %3lu: [%8I64u, %8I64u]\n", -+ fprintf(fd, " %3lu: [%8" PFLL "u, %8" PFLL "u]\n", ++ fprintf(fd, " %3lu: [%8" HB_PF64 "u, %8" HB_PF64 "u]\n", (unsigned long) s, - (unsigned __int64) td->td_stripoffset[s], - (unsigned __int64) td->td_stripbytecount[s]); @@ -598,10 +598,10 @@ diff -urN tiff.orig\tiffconf.h tiff\tiffconf.h +#define TIFF_UINT32_FORMAT "%u" + +/* Signed 64-bit type formatter */ -+#define TIFF_INT64_FORMAT "%" PFLL "d" ++#define TIFF_INT64_FORMAT "%" HB_PF64 "d" + +/* Unsigned 64-bit type formatter */ -+#define TIFF_UINT64_FORMAT "%" PFLL "u" ++#define TIFF_UINT64_FORMAT "%" HB_PF64 "u" + +/* Signed size type formatter */ +#define TIFF_SSIZE_FORMAT "%" HB_PFS "d" diff --git a/harbour/src/3rd/tiff/tiffconf.h b/harbour/src/3rd/tiff/tiffconf.h index 117bba99a8..a429fd5445 100644 --- a/harbour/src/3rd/tiff/tiffconf.h +++ b/harbour/src/3rd/tiff/tiffconf.h @@ -47,14 +47,17 @@ #define TIFF_UINT32_FORMAT "%u" /* Signed 64-bit type formatter */ -#define TIFF_INT64_FORMAT "%" PFLL "d" +#define TIFF_INT64_FORMAT "%" HB_PF64 "d" /* Unsigned 64-bit type formatter */ -#define TIFF_UINT64_FORMAT "%" PFLL "u" +#define TIFF_UINT64_FORMAT "%" HB_PF64 "u" /* Signed size type formatter */ #define TIFF_SSIZE_FORMAT "%" HB_PFS "d" +/* file handler */ +#define TIFF_FILE_HANDLE HB_FHANDLE + /* Define to 1 if the system has the type `int16'. */ #define HAVE_INT16 diff --git a/harbour/src/3rd/tiff/tiffio.h b/harbour/src/3rd/tiff/tiffio.h index c88ca190c9..3eb24ee2a8 100644 --- a/harbour/src/3rd/tiff/tiffio.h +++ b/harbour/src/3rd/tiff/tiffio.h @@ -102,6 +102,8 @@ DECLARE_HANDLE(thandle_t); /* Win32 file handle */ # else typedef HFILE thandle_t; /* client data handle */ # endif /* __WIN32__ */ +#elif defined(TIFF_FILE_HANDLE) +typedef TIFF_FILE_HANDLE thandle_t; /* client data handle */ #else typedef void* thandle_t; /* client data handle */ #endif /* USE_WIN32_FILEIO */ diff --git a/harbour/src/rtl/tclass.prg b/harbour/src/rtl/tclass.prg index ea6e4a1be3..5db42b5924 100644 --- a/harbour/src/rtl/tclass.prg +++ b/harbour/src/rtl/tclass.prg @@ -401,21 +401,21 @@ STATIC PROCEDURE AddInline( cMethod, bCode, nScope ) RETURN -STATIC PROCEDURE AddMethod( cMethod, nFuncPtr, nScope ) +STATIC PROCEDURE AddMethod( cMethod, sFuncSym, nScope ) hb_default( @nScope, HB_OO_CLSTP_EXPORTED ) - AAdd( QSelf():aMethods, { cMethod, nFuncPtr, nScope } ) + AAdd( QSelf():aMethods, { cMethod, sFuncSym, nScope } ) RETURN -STATIC PROCEDURE AddClsMethod( cMethod, nFuncPtr, nScope ) +STATIC PROCEDURE AddClsMethod( cMethod, sFuncSym, nScope ) hb_default( @nScope, HB_OO_CLSTP_EXPORTED ) nScope := hb_bitOr( nScope, HB_OO_CLSTP_CLASS ) - AAdd( QSelf():aClsMethods, { cMethod, nFuncPtr, nScope } ) + AAdd( QSelf():aClsMethods, { cMethod, sFuncSym, nScope } ) RETURN diff --git a/harbour/src/vm/classes.c b/harbour/src/vm/classes.c index f4e941fd11..5dff8cfe53 100644 --- a/harbour/src/vm/classes.c +++ b/harbour/src/vm/classes.c @@ -2382,9 +2382,9 @@ PHB_ITEM hb_objSendMessage( PHB_ITEM pObject, PHB_DYNS pMsgSym, HB_ULONG ulArg, } } -PHB_ITEM hb_objSendMsg( PHB_ITEM pObject, const char *sMsg, HB_ULONG ulArg, ... ) +PHB_ITEM hb_objSendMsg( PHB_ITEM pObject, const char *szMsg, HB_ULONG ulArg, ... ) { - hb_vmPushSymbol( hb_dynsymGet( sMsg )->pSymbol ); + hb_vmPushSymbol( hb_dynsymGet( szMsg )->pSymbol ); hb_vmPush( pObject ); if( ulArg ) { @@ -2406,6 +2406,42 @@ PHB_ITEM hb_objSendMsg( PHB_ITEM pObject, const char *sMsg, HB_ULONG ulArg, ... } } +PHB_ITEM hb_objGetVarPtr( PHB_ITEM pObject, PHB_DYNS pVarMsg ) +{ + if( pObject && HB_IS_OBJECT( pObject ) && pVarMsg ) + { + HB_USHORT uiClass = pObject->item.asArray.value->uiClass; + PCLASS pClass = s_pClasses[ uiClass ]; + PMETHOD pMethod = hb_clsFindMsg( pClass, pVarMsg ); + + if( pMethod ) + { + PHB_SYMB pFuncSym = pMethod->pFuncSym; + + if( pFuncSym == &s___msgSync || pFuncSym == &s___msgSyncClass ) + pFuncSym = pMethod->pRealSym; + + if( pFuncSym->value.pFunPtr == HB_FUNCNAME( msgSetData ) || + pFuncSym->value.pFunPtr == HB_FUNCNAME( msgGetData ) ) + { + HB_SIZE nIndex = pMethod->uiData + pMethod->uiOffset; + if( pObject->item.asArray.value->uiPrevCls ) + { + pObject = hb_arrayGetItemPtr( pObject, 1 ); + if( !pObject ) + return NULL; + if( uiClass != pObject->item.asArray.value->uiClass ) + nIndex = pMethod->uiData + + hb_clsParentInstanceOffset( s_pClasses[ pObject->item.asArray.value->uiClass ], + s_pClasses[ pMethod->uiSprClass ]->pClassSym ); + } + return hb_arrayGetItemPtr( pObject, nIndex ); + } + } + } + return NULL; +} + static PHB_DYNS hb_objGetMsgSym( PHB_ITEM pMessage ) { PHB_DYNS pDynSym = NULL;