diff --git a/ChangeLog.txt b/ChangeLog.txt index 09fe5d3582..febd29cb3a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,85 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2018-09-14 15:36 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * include/harbour.hbx + * include/hbchksum.h + * src/harbour.def + * src/rtl/hbmd5.c + + added new C function + void hb_hmac_md5( const void * key, HB_SIZE nKeyLen, + const void * message, HB_SIZE nMsgLen, + char * digest ); + + added new PRG function + HB_HMAC_MD5( , ) -> + ; HMAC MD5 is used in some authentication methods i.e. CRAM-MD5 + authentication in SMTP protocol + + * src/rtl/gttrm/gttrm.c + + enable extended XTERM colors automatically when xterm-16color, + xterm-256color, xterm+256color, xterm-88color, rxvt-16color, + rxvt-256color, rxvt-98color or putty terminal is detected + + added support for HB_GTI_SCREENDEPTH + + * contrib/gtqtc/gtqtc1.cpp + + set clipboard data also into selection buffer on platforms which + support it + + when main clipboard buffer is empty retrieve clipboard data from + selection buffer and if it's empty too from find buffer + + * include/harbour.hbx + * src/harbour.def + * src/vm/memvars.c + + added new PRG function + __mvGetDef( [, ] ) -> + it works in similar way to __mvGet() but if does + not exist then it returns or NIL instead of RTE + + * contrib/hbwin/hbwin.hbx + + added missing declarations for win_osIs10() and win_osIs81() + + * contrib/hbssl/ssl.c + ! fixed compilation with OpenSSL < 0.9.8k + + * contrib/sddodbc/core.c + * pacified warning + + * contrib/xhb/hbxml.c + * contrib/xhb/hbxml.h + ! fixed CDATA terminator, it should be "]]>" instead of " ]]>" + + added support for HBXML_STYLE_NONEWLINE flag + + * src/3rd/pcre/Makefile + ! typo wince -> wce + + * src/main/Makefile + * use harbour.rc only in MS-Windows builds - it fixes OS2 OpenWatcom + builds + + * config/global.mk + ! in DOS builds check if the 'uname' exists before running it + + * include/hbapigt.h + * include/hbgtcore.h + * src/rtl/hbgtcore.c + * src/rtl/inkey.c + * src/rtl/inkeyapi.c + * contrib/xhb/xhbfunc.c + + added 3-rd parameter to hb_inkeySetText() function. When this parameter + is true then ';' is not translated to Chr( 13 ) but DOS and UNIX EOLs + are translated to Chr( 13 ) + + added logical parameter to HB_GTI_CLIPBOARDPASTE which allows to set + text without ';' translation but with platform independent EOLs + + * src/rtl/memoedit.prg + * utils/hbmk2/hbmk2.prg + * contrib/hbnetio/utils/hbnetio/_console.prg + * extras/dbu/dbu52.patch + * extras/dbu/dbu53.patch + * use hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) instead of + hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) for pasting data from clipboard + with platform independent EOLs and ';' characters + 2018-09-02 23:07 UTC+0200 Aleksander Czajczynski (hb fki.pl) * include/hbsetup.h * changed to recognize ARM64 platform with modern GCC builds diff --git a/config/global.mk b/config/global.mk index 149f7897c8..7fef025763 100644 --- a/config/global.mk +++ b/config/global.mk @@ -367,8 +367,10 @@ ifeq ($(HB_HOST_PLAT),) _DETPLAT_STR := $(OS) include $(TOP)$(ROOT)config/detplat.mk ifeq ($(HB_HOST_PLAT),) - _DETPLAT_STR := $(shell uname -s) - include $(TOP)$(ROOT)config/detplat.mk + ifneq ($(call find_in_path,uname),) + _DETPLAT_STR := $(shell uname -s) + include $(TOP)$(ROOT)config/detplat.mk + endif endif endif endif diff --git a/contrib/gtqtc/gtqtc1.cpp b/contrib/gtqtc/gtqtc1.cpp index 75532fff29..6542fa055b 100644 --- a/contrib/gtqtc/gtqtc1.cpp +++ b/contrib/gtqtc/gtqtc1.cpp @@ -2035,11 +2035,19 @@ static HB_BOOL hb_gt_qtc_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_CLIPBOARDDATA: { QString qStr = QApplication::clipboard()->text(); + if( qStr.isEmpty() && QApplication::clipboard()->supportsSelection() ) + { + qStr = QApplication::clipboard()->text( QClipboard::Selection ); + if( qStr.isEmpty() && QApplication::clipboard()->supportsFindBuffer() ) + qStr = QApplication::clipboard()->text( QClipboard::FindBuffer ); + } pInfo->pResult = hb_gt_qtc_itemPutQString( pInfo->pResult, &qStr ); if( pInfo->pNewVal && HB_IS_STRING( pInfo->pNewVal ) ) { hb_gt_qtc_itemGetQString( pInfo->pNewVal, &qStr ); QApplication::clipboard()->setText( qStr ); + if( QApplication::clipboard()->supportsSelection() ) + QApplication::clipboard()->setText( qStr, QClipboard::Selection ); } break; } @@ -2826,6 +2834,8 @@ void QTConsole::copySelection( void ) } QApplication::clipboard()->setText( qStr ); + if( QApplication::clipboard()->supportsSelection() ) + QApplication::clipboard()->setText( qStr, QClipboard::Selection ); } void QTConsole::repaintChars( const QRect & rx ) diff --git a/contrib/hbnetio/utils/hbnetio/_console.prg b/contrib/hbnetio/utils/hbnetio/_console.prg index 1604692904..0fc31652e8 100644 --- a/contrib/hbnetio/utils/hbnetio/_console.prg +++ b/contrib/hbnetio/utils/hbnetio/_console.prg @@ -103,7 +103,7 @@ PROCEDURE hbnetiocon_cmdUI( cIP, nPort, cPassword ) aHistory[ ++nHistIndex ], ; ( nHistIndex := Len( aHistory ) + 1, "" ) ), Len( cCommand ) ), ; ManageCursor( cCommand ) } ) - bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } ) + bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) } ) bKeyTab := SetKey( K_TAB, {|| CompleteCmd( @cCommand, hCommands ) } ) @@ -251,7 +251,7 @@ STATIC FUNCTION hbnetiocon_GetHidden() ATail( GetList ):display() SetCursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) ) - bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } ) + bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) } ) READ diff --git a/contrib/hbssl/ssl.c b/contrib/hbssl/ssl.c index 121cdff513..017e7f8a88 100644 --- a/contrib/hbssl/ssl.c +++ b/contrib/hbssl/ssl.c @@ -1200,10 +1200,12 @@ HB_FUNC( SSL_SET_TLSEXT_HOST_NAME ) { if( hb_SSL_is( 1 ) ) { +#if defined( SSL_set_tlsext_host_name ) || OPENSSL_VERSION_NUMBER >= 0x00908060L SSL * ssl = hb_SSL_par( 1 ); if( ssl ) SSL_set_tlsext_host_name( ssl, hb_parc( 2 ) ); +#endif } else hb_errRT_BASE( EG_ARG, 2010, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); diff --git a/contrib/hbwin/hbwin.hbx b/contrib/hbwin/hbwin.hbx index 0eba85b33c..aaf64883ac 100644 --- a/contrib/hbwin/hbwin.hbx +++ b/contrib/hbwin/hbwin.hbx @@ -348,11 +348,13 @@ DYNAMIC win_oleCreateObject DYNAMIC win_oleError DYNAMIC win_oleErrorText DYNAMIC win_oleGetActiveObject +DYNAMIC win_osIs10 DYNAMIC win_osIs2000 DYNAMIC win_osIs2000OrUpper DYNAMIC win_osIs2003 DYNAMIC win_osIs7 DYNAMIC win_osIs8 +DYNAMIC win_osIs81 DYNAMIC win_osIs95 DYNAMIC win_osIs98 DYNAMIC win_osIs9x diff --git a/contrib/sddodbc/core.c b/contrib/sddodbc/core.c index 79e7ad3f94..19b8c39676 100644 --- a/contrib/sddodbc/core.c +++ b/contrib/sddodbc/core.c @@ -698,8 +698,7 @@ static HB_ERRCODE odbcGoTo( SQLBASEAREAP pArea, HB_ULONG ulRecNo ) /* No pArea->pSDDData for DBCreate() area... * though pArea->fFetched == HB_TRUE for them */ - if( pArea->pSDDData ) - hStmt = ( ( SDDDATA * ) pArea->pSDDData )->hStmt; + hStmt = pArea->pSDDData ? ( ( SDDDATA * ) pArea->pSDDData )->hStmt : NULL; while( ulRecNo > pArea->ulRecCount && ! pArea->fFetched ) { diff --git a/contrib/xhb/hbxml.c b/contrib/xhb/hbxml.c index 10a6295f7b..5c436e0992 100644 --- a/contrib/xhb/hbxml.c +++ b/contrib/xhb/hbxml.c @@ -1623,6 +1623,9 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style pChild = hb_itemNew( NULL ); pItem = hb_itemNew( NULL ); + if( style & MXML_STYLE_NONEWLINE ) + style &= ~MXML_STYLE_INDENT; + if( style & MXML_STYLE_INDENT ) { hb_objSendMsg( pNode, "DEPTH", 0 ); @@ -1653,7 +1656,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style if( HB_IS_NIL( pItem ) && HB_IS_NIL( pChild ) ) { mxml_output_string_len( out, "/>", 2 ); - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); } else { @@ -1664,7 +1668,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style if( ! HB_IS_NIL( pChild ) ) { mustIndent = 1; - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); while( ! HB_IS_NIL( pChild ) ) { @@ -1693,7 +1698,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style hb_objSendMsg( pNode, "CNAME", 0 ); mxml_output_string_len( out, hb_parc( -1 ), hb_parclen( -1 ) ); mxml_output_char( out, '>' ); - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); } break; @@ -1702,15 +1708,17 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style hb_objSendMsg( pNode, "CDATA", 0 ); mxml_output_string_len( out, hb_parc( -1 ), hb_parclen( -1 ) ); mxml_output_string_len( out, " -->", 4 ); - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); break; case MXML_TYPE_CDATA: mxml_output_string_len( out, "", 4 ); - mxml_output_string( out, hb_conNewLine() ); + mxml_output_string_len( out, "]]>", 3 ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); break; case MXML_TYPE_DATA: @@ -1719,7 +1727,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style mxml_output_string_escape( out, hb_parcx( -1 ) ); else mxml_output_string_len( out, hb_parcx( -1 ), hb_parclen( -1 ) ); - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); break; case MXML_TYPE_DIRECTIVE: @@ -1735,7 +1744,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style mxml_output_string_len( out, hb_parcx( -1 ), hb_parclen( -1 ) ); } mxml_output_char( out, '>' ); - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); break; case MXML_TYPE_PI: @@ -1750,7 +1760,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style mxml_output_string_len( out, hb_parcx( -1 ), hb_parclen( -1 ) ); } mxml_output_string_len( out, "?>", 2 ); - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); break; case MXML_TYPE_DOCUMENT: @@ -1763,7 +1774,8 @@ static MXML_STATUS mxml_node_write( MXML_OUTPUT * out, PHB_ITEM pNode, int style hb_objSendMsg( pChild, "ONEXT", 0 ); hb_itemMove( pChild, hb_param( -1, HB_IT_ANY ) ); } - mxml_output_string( out, hb_conNewLine() ); + if( ! ( style & MXML_STYLE_NONEWLINE ) ) + mxml_output_string( out, hb_conNewLine() ); break; } diff --git a/contrib/xhb/hbxml.h b/contrib/xhb/hbxml.h index 6093f1be83..2dd073a0b1 100644 --- a/contrib/xhb/hbxml.h +++ b/contrib/xhb/hbxml.h @@ -84,6 +84,7 @@ #define MXML_STYLE_TAB 0x0002 #define MXML_STYLE_THREESPACES 0x0004 #define MXML_STYLE_NOESCAPE 0x0008 +#define MXML_STYLE_NONEWLINE 0x0010 /* Status values */ diff --git a/contrib/xhb/xhbfunc.c b/contrib/xhb/xhbfunc.c index 89f79f021d..27eb3c12d6 100644 --- a/contrib/xhb/xhbfunc.c +++ b/contrib/xhb/xhbfunc.c @@ -117,7 +117,7 @@ HB_FUNC( XHB__KEYBOARD ) } else if( HB_ISCHAR( 1 ) ) { - hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ) ); + hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ), HB_FALSE ); } else if( HB_ISARRAY( 1 ) ) { @@ -135,7 +135,7 @@ HB_FUNC( XHB__KEYBOARD ) } else if( HB_IS_STRING( pItem ) ) { - hb_inkeySetText( ( const char * ) hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ) ); + hb_inkeySetText( hb_itemGetCPtr( pItem ), hb_itemGetCLen( pItem ), HB_FALSE ); } } } diff --git a/extras/dbu/dbu52.patch b/extras/dbu/dbu52.patch index b7b94069dd..a58bc6dd5b 100644 --- a/extras/dbu/dbu52.patch +++ b/extras/dbu/dbu52.patch @@ -23,7 +23,7 @@ diff -u dbu52ori/dbu.prg dbu52pat/dbu.prg + hb_cdpSelect( "UTF8EX" ) + hb_gtInfo( HB_GTI_BOXCP, "UTF8EX" ) + ENDIF -+ SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } ) ++ SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) } ) IF (ISCOLOR() .OR. "/C" $ UPPER(param2)) .AND. .NOT. "/M" $ UPPER(param2) * make it pretty diff --git a/extras/dbu/dbu53.patch b/extras/dbu/dbu53.patch index d6feef82a1..0a06d38857 100644 --- a/extras/dbu/dbu53.patch +++ b/extras/dbu/dbu53.patch @@ -24,7 +24,7 @@ diff -u dbu53ori/dbu.prg dbu53pat/dbu.prg + hb_cdpSelect( "UTF8EX" ) + hb_gtInfo( HB_GTI_BOXCP, "UTF8EX" ) + ENDIF -+ SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } ) ++ SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) } ) + IF (ISCOLOR() .OR. "/C" $ UPPER(param2)) .AND. .NOT. "/M" $ UPPER(param2) // make it pretty diff --git a/include/harbour.hbx b/include/harbour.hbx index 2fff5076fd..86bf156266 100644 --- a/include/harbour.hbx +++ b/include/harbour.hbx @@ -527,6 +527,7 @@ DYNAMIC hb_HHasKey DYNAMIC hb_HKeepOrder DYNAMIC hb_HKeyAt DYNAMIC hb_HKeys +DYNAMIC hb_HMAC_MD5 DYNAMIC hb_HMAC_SHA1 DYNAMIC hb_HMAC_SHA224 DYNAMIC hb_HMAC_SHA256 @@ -1526,6 +1527,7 @@ DYNAMIC __mvClear DYNAMIC __mvDbgInfo DYNAMIC __mvExist DYNAMIC __mvGet +DYNAMIC __mvGetDef DYNAMIC __mvPrivate DYNAMIC __mvPublic DYNAMIC __mvPut diff --git a/include/hbapigt.h b/include/hbapigt.h index 2258fdcf37..1c263dfa41 100644 --- a/include/hbapigt.h +++ b/include/hbapigt.h @@ -289,7 +289,7 @@ extern HB_EXPORT int hb_inkeyLast( int iEvenMask ); /* Return the value extern HB_EXPORT int hb_inkeyNext( int iEvenMask ); /* Return the next key without extracting it */ extern HB_EXPORT void hb_inkeyPoll( void ); /* Poll the console keyboard to stuff the Harbour buffer */ extern HB_EXPORT void hb_inkeyReset( void ); /* Reset the Harbour keyboard buffer */ -extern HB_EXPORT void hb_inkeySetText( const char * szText, HB_SIZE nLen ); /* Set text into inkey buffer */ +extern HB_EXPORT void hb_inkeySetText( const char * szText, HB_SIZE nLen, HB_BOOL fEol ); /* Set text into inkey buffer */ extern HB_EXPORT int hb_inkeySetLast( int iKey ); /* Set new LastKey() value, return previous one */ extern HB_EXPORT void hb_inkeyExit( void ); /* reset inkey pool to default state and free any allocated resources */ diff --git a/include/hbchksum.h b/include/hbchksum.h index 996c8f8e61..cb1657e4bf 100644 --- a/include/hbchksum.h +++ b/include/hbchksum.h @@ -55,5 +55,7 @@ extern HB_EXPORT HB_MAXUINT hb_crc( HB_MAXUINT crc, const void * buf, HB_SIZE le extern HB_EXPORT HB_MAXUINT hb_crcct( HB_MAXUINT crc, const void * buf, HB_SIZE len, HB_MAXUINT poly ); extern HB_EXPORT void hb_md5( const void * data, HB_SIZE datalen, char * digest ); extern HB_EXPORT HB_BOOL hb_md5file( const char * pszFileName, char * digest ); +extern HB_EXPORT void hb_hmac_md5( const void * key, HB_SIZE nKeyLen, + const void * message, HB_SIZE nMsgLen, char * digest ); HB_EXTERN_END diff --git a/include/hbgtcore.h b/include/hbgtcore.h index c92c41d6a0..3754e6f2c4 100644 --- a/include/hbgtcore.h +++ b/include/hbgtcore.h @@ -205,7 +205,7 @@ typedef struct int (* InkeyLast) ( HB_GT_PTR, int iEventMask ); int (* InkeyNext) ( HB_GT_PTR, int iEventMask ); void (* InkeyPoll) ( HB_GT_PTR ); - void (* InkeySetText) ( HB_GT_PTR, const char * szText, HB_SIZE nLen ); + void (* InkeySetText) ( HB_GT_PTR, const char * szText, HB_SIZE nLen, HB_BOOL fEol ); int (* InkeySetLast) ( HB_GT_PTR, int iKey ); void (* InkeyReset) ( HB_GT_PTR ); void (* InkeyExit) ( HB_GT_PTR ); @@ -463,7 +463,7 @@ extern HB_EXPORT void hb_gt_gcMark( void ); #define HB_GTSELF_INKEYLAST(g,m) (g)->pFuncTable->InkeyLast(g,m) #define HB_GTSELF_INKEYNEXT(g,m) (g)->pFuncTable->InkeyNext(g,m) #define HB_GTSELF_INKEYPOLL(g) (g)->pFuncTable->InkeyPoll(g) -#define HB_GTSELF_INKEYSETTEXT(g,s,l) (g)->pFuncTable->InkeySetText(g,s,l) +#define HB_GTSELF_INKEYSETTEXT(g,s,l,e) (g)->pFuncTable->InkeySetText(g,s,l,e) #define HB_GTSELF_INKEYSETLAST(g,k) (g)->pFuncTable->InkeySetLast(g,k) #define HB_GTSELF_INKEYRESET(g) (g)->pFuncTable->InkeyReset(g) #define HB_GTSELF_INKEYEXIT(g) (g)->pFuncTable->InkeyExit(g) @@ -593,7 +593,7 @@ extern HB_EXPORT void hb_gt_gcMark( void ); #define HB_GTSUPER_INKEYLAST(g,m) (HB_GTSUPERTABLE(g))->InkeyLast(g,m) #define HB_GTSUPER_INKEYNEXT(g,m) (HB_GTSUPERTABLE(g))->InkeyNext(g,m) #define HB_GTSUPER_INKEYPOLL(g) (HB_GTSUPERTABLE(g))->InkeyPoll(g) -#define HB_GTSUPER_INKEYSETTEXT(g,s,l) (HB_GTSUPERTABLE(g))->InkeySetText(g,s,l) +#define HB_GTSUPER_INKEYSETTEXT(g,s,l,e) (HB_GTSUPERTABLE(g))->InkeySetText(g,s,l,e) #define HB_GTSUPER_INKEYSETLAST(g,k) (HB_GTSUPERTABLE(g))->InkeySetLast(g,k) #define HB_GTSUPER_INKEYRESET(g) (HB_GTSUPERTABLE(g))->InkeyReset(g) #define HB_GTSUPER_INKEYEXIT(g) (HB_GTSUPERTABLE(g))->InkeyExit(g) diff --git a/src/3rd/pcre/Makefile b/src/3rd/pcre/Makefile index e97b9d83e7..a6ba555cce 100644 --- a/src/3rd/pcre/Makefile +++ b/src/3rd/pcre/Makefile @@ -35,7 +35,7 @@ ifneq ($(HB_HAS_PCRE_LOCAL),) # only needed for win/wce, for other platforms this is noop HB_CFLAGS_STA := -DPCRE_STATIC - ifeq ($(filter $(HB_PLATFORM),win wince dos vxworks),) + ifeq ($(filter $(HB_PLATFORM),win wce dos vxworks),) HB_CFLAGS += -DHAVE_STDINT_H else ifeq ($(HB_PLATFORM),sunos) diff --git a/src/harbour.def b/src/harbour.def index e75685af5f..33896323f8 100644 --- a/src/harbour.def +++ b/src/harbour.def @@ -623,6 +623,7 @@ HB_FUN_HB_HHASKEY HB_FUN_HB_HKEEPORDER HB_FUN_HB_HKEYAT HB_FUN_HB_HKEYS +HB_FUN_HB_HMAC_MD5 HB_FUN_HB_HMAC_SHA1 HB_FUN_HB_HMAC_SHA224 HB_FUN_HB_HMAC_SHA256 @@ -1843,6 +1844,7 @@ HB_FUN___MVCLEAR HB_FUN___MVDBGINFO HB_FUN___MVEXIST HB_FUN___MVGET +HB_FUN___MVGETDEF HB_FUN___MVPRIVATE HB_FUN___MVPUBLIC HB_FUN___MVPUT @@ -2723,6 +2725,7 @@ hb_hashTableFind hb_hashTableKill hb_hashTableResize hb_hashTableSize +hb_hmac_md5 hb_idleReset hb_idleSleep hb_idleState diff --git a/src/main/Makefile b/src/main/Makefile index 7cc7a79405..a26ea6b83d 100644 --- a/src/main/Makefile +++ b/src/main/Makefile @@ -4,7 +4,9 @@ C_SOURCES := \ C_MAIN := harbour.c +ifneq ($(filter $(HB_PLATFORM),win wce),) RC_SOURCES := harbour.rc +endif LIBS := \ hbcplr \ diff --git a/src/rtl/gttrm/gttrm.c b/src/rtl/gttrm/gttrm.c index 680807002f..894fb2233f 100644 --- a/src/rtl/gttrm/gttrm.c +++ b/src/rtl/gttrm/gttrm.c @@ -128,6 +128,7 @@ static HB_GT_FUNCS SuperTable; #define TERM_CYGWIN 5 #define TERM_PUTTY 16 +#define HB_GTTRM_CLRNDF -1 #define HB_GTTRM_CLRSTD 0 #define HB_GTTRM_CLRX16 1 #define HB_GTTRM_CLR256 2 @@ -3165,7 +3166,7 @@ static void hb_gt_trm_SetTerm( PHB_GTTRM pTerm ) pTerm->mouse_type = MOUSE_NONE; pTerm->esc_delay = ESC_DELAY; pTerm->iAttrMask = ~HB_GTTRM_ATTR_BOX; - pTerm->iExtColor = HB_GTTRM_CLRSTD; + pTerm->iExtColor = HB_GTTRM_CLRNDF; pTerm->terminal_ext = 0; pTerm->fAM = HB_FALSE; @@ -3220,12 +3221,13 @@ static void hb_gt_trm_SetTerm( PHB_GTTRM pTerm ) if( szTerm == NULL || *szTerm == '\0' ) szTerm = "ansi"; } + if( strncmp( szTerm, "putty", 5 ) == 0 ) + pTerm->terminal_ext |= TERM_PUTTY; } if( ( pTerm->terminal_ext & TERM_PUTTY ) || - strstr( szTerm, "xterm" ) != NULL || + strncmp( szTerm, "xterm", 5 ) == 0 || strncmp( szTerm, "rxvt", 4 ) == 0 || - strcmp( szTerm, "putty" ) == 0 || strncmp( szTerm, "screen", 6 ) == 0 ) { pTerm->Init = hb_gt_trm_AnsiInit; @@ -3241,6 +3243,22 @@ static void hb_gt_trm_SetTerm( PHB_GTTRM pTerm ) pTerm->Bell = hb_gt_trm_AnsiBell; pTerm->szAcsc = szAcsc; pTerm->terminal_type = TERM_XTERM; + if( pTerm->iExtColor == HB_GTTRM_CLRNDF ) + { + if( pTerm->terminal_ext & TERM_PUTTY ) + pTerm->iExtColor = HB_GTTRM_CLR256; + else if( strncmp( szTerm, "xterm", 5 ) == 0 || + strncmp( szTerm, "rxvt", 4 ) == 0 ) + { + if( strstr( szTerm, "+256color" ) != NULL || + strstr( szTerm, "-256color" ) != NULL ) + pTerm->iExtColor = HB_GTTRM_CLR256; + else if( strstr( szTerm, "-88color" ) != NULL ) + pTerm->iExtColor = HB_GTTRM_CLRRGB; + else if( strstr( szTerm, "-16color" ) != NULL ) + pTerm->iExtColor = HB_GTTRM_CLRAIX; + } + } } else if( strncmp( szTerm, "linux", 5 ) == 0 || strcmp( szTerm, "cygwin" ) == 0 || @@ -3300,7 +3318,8 @@ static void hb_gt_trm_SetTerm( PHB_GTTRM pTerm ) pTerm->szAcsc = szExtAcsc; pTerm->terminal_type = TERM_ANSI; } - + if( pTerm->iExtColor == HB_GTTRM_CLRNDF ) + pTerm->iExtColor = HB_GTTRM_CLRSTD; pTerm->fStdinTTY = hb_fsIsDevice( pTerm->hFilenoStdin ); pTerm->fStdoutTTY = hb_fsIsDevice( pTerm->hFilenoStdout ); pTerm->fStderrTTY = hb_fsIsDevice( pTerm->hFilenoStderr ); @@ -4002,6 +4021,29 @@ static HB_BOOL hb_gt_trm_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } break; + case HB_GTI_SCREENDEPTH: + switch( pTerm->iExtColor ) + { + case HB_GTTRM_CLRRGB: + iVal = 8; + break; + case HB_GTTRM_CLR256: + iVal = 6; + break; + case HB_GTTRM_CLRX16: + case HB_GTTRM_CLRAIX: + iVal = 4; + break; + case HB_GTTRM_CLRSTD: + iVal = ( pTerm->terminal_type == TERM_LINUX || + ( pTerm->terminal_ext & TERM_PUTTY ) ) ? 8 : 3; + break; + default: + iVal = 3; + break; + } + pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal ); + break; case HB_GTI_PALETTE: if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC ) diff --git a/src/rtl/hbgtcore.c b/src/rtl/hbgtcore.c index 096bd259ba..005e1f8e87 100644 --- a/src/rtl/hbgtcore.c +++ b/src/rtl/hbgtcore.c @@ -1961,7 +1961,8 @@ static HB_BOOL hb_gt_def_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) case HB_GTI_CLIPBOARDPASTE: if( HB_GTSELF_INFO( pGT, HB_GTI_CLIPBOARDDATA, pInfo ) ) HB_GTSELF_INKEYSETTEXT( pGT, hb_itemGetCPtr( pInfo->pResult ), - hb_itemGetCLen( pInfo->pResult ) ); + hb_itemGetCLen( pInfo->pResult ), + hb_itemGetL( pInfo->pNewVal ) ); break; case HB_GTI_NOTIFIERBLOCK: @@ -3031,9 +3032,9 @@ static int hb_gt_def_InkeySetLast( PHB_GT pGT, int iKey ) } /* Set text into inkey buffer */ -static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE nLen ) +static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE nLen, HB_BOOL fEol ) { - HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeySetText(%p,%s,%" HB_PFS "u)", ( void * ) pGT, szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_gt_def_InkeySetText(%p,%s,%" HB_PFS "u, %d)", ( void * ) pGT, szText, nLen, fEol ) ); if( pGT->StrBuffer ) { @@ -3045,13 +3046,29 @@ static void hb_gt_def_InkeySetText( PHB_GT pGT, const char * szText, HB_SIZE nLe { PHB_CODEPAGE cdp = hb_vmCDP(); HB_SIZE nIndex = 0; - HB_WCHAR wc; + HB_WCHAR wc, prev = 0; pGT->StrBufferSize = pGT->StrBufferPos = 0; pGT->StrBuffer = ( HB_WCHAR * ) hb_xgrab( nLen * sizeof( HB_WCHAR ) ); while( HB_CDPCHAR_GET( cdp, szText, nLen, &nIndex, &wc ) ) - pGT->StrBuffer[ pGT->StrBufferSize++ ] = wc == ';' ? HB_CHAR_CR : wc; - + { + if( fEol ) + { + if( wc == HB_CHAR_LF ) + { + if( prev == HB_CHAR_CR ) + { + prev = 0; + continue; + } + else + wc = HB_CHAR_CR; + } + } + else if( wc == ';' ) + wc = HB_CHAR_CR; + pGT->StrBuffer[ pGT->StrBufferSize++ ] = prev = wc; + } if( pGT->StrBufferSize == 0 ) { hb_xfree( pGT->StrBuffer ); diff --git a/src/rtl/hbmd5.c b/src/rtl/hbmd5.c index 26f5f31d89..9bb538fbbe 100644 --- a/src/rtl/hbmd5.c +++ b/src/rtl/hbmd5.c @@ -6,7 +6,7 @@ * Copyright 2004 Dmitry V. Korzhov * Copyright 2007 Przemyslaw Czerpak * updated for current Harbour code, other then x86@32 machines, - * files and buffers longer then 2^32 and some fixes + * files and buffers longer then 2^32 and some fixes, HMAC-MD5 * * 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 @@ -107,6 +107,10 @@ typedef struct /* Defines for file ops */ #define MAX_FBUF 0x20000 /* file read buffer size, MUST be 64*n */ +/* Defines for HMAC_MD5 */ +#define IPAD 0x36 +#define OPAD 0x5C + /* Static data */ static const HB_U32 T[ 64 ] = { 0xD76AA478, 0xE8C7B756, 0x242070DB, 0xC1BDCEEE, @@ -233,14 +237,7 @@ static void hb_md5val( HB_U32 accum[], char * md5val ) } } -/* - Parameters: - data - input byte stream - datalen - input stream length - digest - raw (unformatted) MD5 digest buffer - (at least 16 bytes long) - */ -void hb_md5( const void * data, HB_SIZE nLen, char * digest ) +static void hb_md5_count( const void * data, HB_SIZE nLen, char * digest, const void * init_block ) { const unsigned char * ucdata = ( const unsigned char * ) data; HB_UCHAR buf[ 128 ]; @@ -249,6 +246,11 @@ void hb_md5( const void * data, HB_SIZE nLen, char * digest ) /* perform startup procedures */ hb_md5accinit( md5.accum ); + if( init_block ) + { + memcpy( md5.buf, init_block, 64 ); + hb_md5go( &md5 ); + } /* count full 512-bit blocks in data*/ n = nLen >> 6; /* process full blocks */ @@ -257,6 +259,8 @@ void hb_md5( const void * data, HB_SIZE nLen, char * digest ) memcpy( md5.buf, ucdata, 64 ); hb_md5go( &md5 ); } + if( init_block ) + nLen += 64; /* prepare additional block(s) */ memset( buf, 0, sizeof( buf ) ); n = nLen & 63; @@ -284,6 +288,41 @@ void hb_md5( const void * data, HB_SIZE nLen, char * digest ) hb_md5val( md5.accum, digest ); } +/* + Parameters: + data - input byte stream + datalen - input stream length + digest - raw (unformatted) MD5 digest buffer + (at least 16 bytes long) + */ +void hb_md5( const void * data, HB_SIZE nLen, char * digest ) +{ + hb_md5_count( data, nLen, digest, NULL ); +} + +void hb_hmac_md5( const void * key, HB_SIZE nKeyLen, + const void * message, HB_SIZE nMsgLen, char * digest ) +{ + char init_block[ 64 ]; + int i; + + memset( init_block, 0, sizeof( init_block ) ); + if( nKeyLen <= sizeof( init_block ) ) + memcpy( init_block, key, nKeyLen ); + else + hb_md5( key, nKeyLen, init_block ); + + for( i = 0; i < ( int ) sizeof( init_block ); ++i ) + init_block[ i ] ^= IPAD; + + hb_md5_count( message, nMsgLen, digest, init_block ); + + for( i = 0; i < ( int ) sizeof( init_block ); ++i ) + init_block[ i ] ^= IPAD ^ OPAD; + + hb_md5_count( digest, 16, digest, init_block ); +} + /* Parameters: pFile - file handle @@ -378,6 +417,14 @@ HB_FUNC( HB_MD5 ) /* Considered insecure. Use SHA256 or higher instead. */ } else hb_retclen( dststr, HB_SIZEOFARRAY( dststr ) ); + if( ! hb_parl( 2 ) ) + { + char digest[ ( sizeof( dststr ) * 2 ) + 1 ]; + hb_strtohex( dststr, sizeof( dststr ), digest ); + hb_retclen( digest, HB_SIZEOFARRAY( digest ) - 1 ); + } + else + hb_retclen( dststr, HB_SIZEOFARRAY( dststr ) ); } else hb_retc_null(); /* return empty string on wrong call */ @@ -402,3 +449,20 @@ HB_FUNC( HB_MD5FILE ) /* Considered insecure. Use SHA256 or higher instead. */ else hb_retc_null(); /* return empty string on wrong call */ } + +HB_FUNC( HB_HMAC_MD5 ) +{ + char dststr[ 16 ]; + + hb_hmac_md5( hb_parcx( 2 ), hb_parclen( 2 ), + hb_parcx( 1 ), hb_parclen( 1 ), dststr ); + + if( ! hb_parl( 3 ) ) + { + char digest[ ( sizeof( dststr ) * 2 ) + 1 ]; + hb_strtohex( dststr, sizeof( dststr ), digest ); + hb_retclen( digest, HB_SIZEOFARRAY( digest ) - 1 ); + } + else + hb_retclen( dststr, HB_SIZEOFARRAY( dststr ) ); +} diff --git a/src/rtl/inkey.c b/src/rtl/inkey.c index 3b001bc7e8..bf1af4c4fe 100644 --- a/src/rtl/inkey.c +++ b/src/rtl/inkey.c @@ -102,7 +102,7 @@ HB_FUNC( __KEYBOARD ) hb_inkeyReset(); if( HB_ISCHAR( 1 ) ) - hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ) ); + hb_inkeySetText( hb_parc( 1 ), hb_parclen( 1 ), HB_FALSE ); } HB_FUNC( HB_KEYCLEAR ) diff --git a/src/rtl/inkeyapi.c b/src/rtl/inkeyapi.c index fcf92251b9..4ca7579d3c 100644 --- a/src/rtl/inkeyapi.c +++ b/src/rtl/inkeyapi.c @@ -313,16 +313,16 @@ int hb_inkeySetLast( int iKey ) return iLast; } -void hb_inkeySetText( const char * szText, HB_SIZE nLen ) +void hb_inkeySetText( const char * szText, HB_SIZE nLen, HB_BOOL fEol ) { PHB_GT pGT; - HB_TRACE( HB_TR_DEBUG, ( "hb_inkeySetText(%s,%" HB_PFS "u)", szText, nLen ) ); + HB_TRACE( HB_TR_DEBUG, ( "hb_inkeySetText(%s,%" HB_PFS "u, %d)", szText, nLen, fEol ) ); pGT = hb_gt_Base(); if( pGT ) { - HB_GTSELF_INKEYSETTEXT( pGT, szText, nLen ); + HB_GTSELF_INKEYSETTEXT( pGT, szText, nLen, fEol ); hb_gt_BaseFree( pGT ); } } diff --git a/src/rtl/memoedit.prg b/src/rtl/memoedit.prg index 6acedd8eab..272cb3442e 100644 --- a/src/rtl/memoedit.prg +++ b/src/rtl/memoedit.prg @@ -254,7 +254,7 @@ METHOD HandleUserKey( nKey, nUdfReturn ) CLASS HBMemoEditor #ifndef HB_CLP_STRICT CASE ME_PASTE /* Xbase++ compatibility */ - hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) + hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) EXIT #endif diff --git a/src/vm/memvars.c b/src/vm/memvars.c index 5dcd53c1b4..18f673b7bf 100644 --- a/src/vm/memvars.c +++ b/src/vm/memvars.c @@ -1293,6 +1293,27 @@ HB_FUNC( __MVGET ) } } +HB_FUNC( __MVGETDEF ) +{ + PHB_ITEM pName = hb_param( 1, HB_IT_STRING ); + + if( pName ) + { + HB_STACK_TLS_PRELOAD + PHB_ITEM pMemvar; + PHB_DYNS pDynVar = hb_memvarFindSymbol( pName->item.asString.value, + pName->item.asString.length ); + + if( pDynVar && ( pMemvar = hb_dynsymGetMemvar( pDynVar ) ) != NULL ) + hb_itemReturn( HB_IS_BYREF( pMemvar ) ? hb_itemUnRef( pMemvar ) : + pMemvar ); + else if( hb_pcount() >= 2 ) + hb_itemReturn( hb_param( 2, HB_IT_ANY ) ); + } + else + hb_errRT_BASE_SubstR( EG_ARG, 3009, NULL, NULL, HB_ERR_ARGS_BASEPARAMS ); +} + HB_FUNC( __MVPUT ) { PHB_ITEM pName = hb_param( 1, HB_IT_STRING ); diff --git a/utils/hbmk2/hbmk2.prg b/utils/hbmk2/hbmk2.prg index f0c69c8fa2..14f6102deb 100644 --- a/utils/hbmk2/hbmk2.prg +++ b/utils/hbmk2/hbmk2.prg @@ -14510,7 +14510,7 @@ STATIC PROCEDURE __hbshell_prompt( aParams, aCommand ) hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS ) - SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } ) + SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) } ) Set( _SET_EVENTMASK, hb_bitOr( INKEY_KEYBOARD, HB_INKEY_GTEVENT ) ) @@ -14652,7 +14652,7 @@ STATIC FUNCTION __hbshell_GetHidden() ATail( GetList ):display() SetCursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) ) - bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE ) } ) + bKeyPaste := SetKey( K_ALT_V, {|| hb_gtInfo( HB_GTI_CLIPBOARDPASTE, .T. ) } ) ReadModal( GetList )