diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fd11e8638b..8fc6b7b073 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,20 @@ The license applies to all entries newer than 2009-04-28. */ +2010-07-04 12:21 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * src/rtl/cdpapi.c + * src/rtl/cdpapihb.c + * include/hbapicdp.h + + Added new low level hb_cdpList() function. + ! cdp list generation logic now protected with mutex. + ! HB_CDPLIST() .prg level function moved to cdpapihb.c, + thus clearing the last pending TOFIX here regarding + layer separation. Low level can now be moved to + common lib (or is there anything else missing?). + + * contrib/hbqt/hbmk2_plugin_qt.prg + * Minor correction in one stdalone error msg. + 2010-07-02 10:44 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * utils/hbmk2/hbmk2.prg + Added feature for plugins to register the file extensions diff --git a/harbour/contrib/hbqt/hbmk2_plugin_qt.prg b/harbour/contrib/hbqt/hbmk2_plugin_qt.prg index e5f97442cb..89ad325cd3 100644 --- a/harbour/contrib/hbqt/hbmk2_plugin_qt.prg +++ b/harbour/contrib/hbqt/hbmk2_plugin_qt.prg @@ -377,7 +377,7 @@ PROCEDURE Main( cSrc, cDst ) FErase( cTmp ) ELSE - OutErr( "Missing parameter. Call with: <.ui|.qrc> <.prg>" + hb_osNewLine() ) + OutErr( "Missing parameter. Call with: " + hb_osNewLine() ) nError := 8 ENDIF diff --git a/harbour/include/hbapicdp.h b/harbour/include/hbapicdp.h index 354bef4ce3..6815c9333f 100644 --- a/harbour/include/hbapicdp.h +++ b/harbour/include/hbapicdp.h @@ -341,6 +341,7 @@ extern HB_EXPORT PHB_CODEPAGE hb_cdpSelect( PHB_CODEPAGE cdp ); extern HB_EXPORT const char * hb_cdpSelectID( const char * id ); extern HB_EXPORT PHB_CODEPAGE hb_cdpFind( const char * id ); extern HB_EXPORT PHB_CODEPAGE hb_cdpFindExt( const char * id ); +extern HB_EXPORT const char ** hb_cdpList( void ); /* Caller must release the pointer */ extern HB_EXPORT HB_BOOL hb_cdpIsDigit( PHB_CODEPAGE cdp, int iChar ); extern HB_EXPORT HB_BOOL hb_cdpIsAlpha( PHB_CODEPAGE cdp, int iChar ); diff --git a/harbour/src/rtl/cdpapi.c b/harbour/src/rtl/cdpapi.c index e4f472b481..26735e01df 100644 --- a/harbour/src/rtl/cdpapi.c +++ b/harbour/src/rtl/cdpapi.c @@ -2208,11 +2208,14 @@ const char * hb_cdpSelectID( const char * id ) return cdp ? cdp->id : NULL; } -/* TOFIX: Move this to cdpapihb.c */ -HB_FUNC( HB_CDPLIST ) +/* Caller must release the pointer */ +const char ** hb_cdpList( void ) { PHB_CODEPAGE cdp; int iCount; + const char ** list; + + HB_CDP_LOCK cdp = s_cdpList; iCount = 0; @@ -2222,12 +2225,18 @@ HB_FUNC( HB_CDPLIST ) cdp = cdp->next; } - hb_reta( iCount ); + list = ( const char ** ) hb_xgrab( ( iCount + 1 ) * sizeof( char * ) ); + cdp = s_cdpList; iCount = 0; while( cdp ) { - hb_storvc( cdp->id, -1, ++iCount ); + list[ iCount++ ] = cdp->id; cdp = cdp->next; } + list[ iCount ] = NULL; + + HB_CDP_UNLOCK + + return list; } diff --git a/harbour/src/rtl/cdpapihb.c b/harbour/src/rtl/cdpapihb.c index 48e6bff65c..1169fb9cc1 100644 --- a/harbour/src/rtl/cdpapihb.c +++ b/harbour/src/rtl/cdpapihb.c @@ -116,6 +116,27 @@ HB_FUNC( HB_CDPINFO ) hb_retc( cdp ? cdp->info : NULL ); } +HB_FUNC( HB_CDPLIST ) +{ + const char ** list = hb_cdpList(); + HB_ISIZ nPos; + + nPos = 0; + while( list[ nPos ] ) + ++nPos; + + hb_reta( nPos ); + + nPos = 0; + while( list[ nPos ] ) + { + hb_storvc( list[ nPos ], -1, nPos + 1 ); + ++nPos; + } + + hb_xfree( ( void * ) list ); +} + HB_FUNC( __NATSORTVER ) { /* NOTE: CA-Cl*pper 5.2e Intl. will return: "NATSORT v1.2i x14 19/Mar/93" */