diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 63e1b87a88..74e5824fc5 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,38 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-18 02:03 UTC+0100 Viktor Szakats (harbour.01 syenar hu) + * utils/hbmk/hbmk2.prg + ! Fixed not recognising hbp lines if the filter was at BOL. + ! Two minor fixes. + + * utils/hbmk/examples/xbgtk.hbp + + Added cflags, it was already supported, just forgot about it. + + * contrib/hbblat/tests/hbblat.hbp + * contrib/hbblat/tests/blatcmd.prg + % Using WIN_GETCOMMANDLINEPARAM(). + + * contrib/hbwin/win_misc.c + * contrib/hbwin/tests/testreg.prg + + Added WIN_GETCOMMANDLINEPARAM(). + Similar to WAPI_GETCOMMANDLINE() but returns + only the parameter part. Handles UNICODE, + _SET_OSCODEPAGE and appnames with spaces. + + * contrib/hbwin/tests/hbwin.hbp + ! Fixed to include shell32 lib. + + * contrib/hbwin/Makefile + * contrib/hbwin/common.mak + + contrib/hbwin/wapi_winbase.c + * contrib/hbwin/tests/testreg.prg + + Added WAPI_GETCOMMANDLINE(). + With UNICODE and _SET_OSCODEPAGE support. + + * ChangeLog + * TOFIX (hb_cmdline()) marked as POSTPONED with explanation. + 2009-02-18 00:19 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * source/rtl/listbox.prg ! Restored _SET_EXACT dependent code parts to have the @@ -146,6 +178,8 @@ * contrib/hbblat/tests/blatcmd.prg ! Reverted fix of mine until we properly fix hb_cmdline(). ; TOFIX: Fix hb_cmdline() to work more consistently on Windows. + [POSTPONED. It creates incompatibility with behaviour + on other platforms.] 2009-02-17 11:22 UTC+0100 Viktor Szakats (harbour.01 syenar hu) - contrib/hbmysql/tests/hbmk.bat diff --git a/harbour/contrib/hbblat/tests/blatcmd.prg b/harbour/contrib/hbblat/tests/blatcmd.prg index 4268160f2e..928177921f 100644 --- a/harbour/contrib/hbblat/tests/blatcmd.prg +++ b/harbour/contrib/hbblat/tests/blatcmd.prg @@ -50,12 +50,11 @@ * */ - #include "common.ch" PROCEDURE Main() - LOCAL cCmd := GetParams() + LOCAL cCmd := win_GetCommandLineParam() LOCAL nRet ? "Simple BLAT Command interface" @@ -69,38 +68,3 @@ PROCEDURE Main() ENDIF RETURN - -STATIC FUNCTION GetParams() - LOCAL cCmd := WAPI_GetCommandLine() - LOCAL n - - // Search first space after program name - n := AT( " ", cCmd ) - IF n > 0 - // remove program name - cCmd := SubStr( cCmd, n + 1 ) - ELSE - // empty params list - cCmd := "" - ENDIF - -RETURN cCmd - -//----------------------------------------- - -// TODO: move to hbwin lib -#pragma BEGINDUMP - -#define HB_OS_WIN_USED - -#include - -#include "hbapi.h" - -/* GetCommandLine() returns entire command line as a single string */ -HB_FUNC( WAPI_GETCOMMANDLINE ) -{ - hb_retc( GetCommandLine() ); -} - -#pragma ENDDUMP diff --git a/harbour/contrib/hbblat/tests/hbblat.hbp b/harbour/contrib/hbblat/tests/hbblat.hbp index 5c35259406..a97a742c59 100644 --- a/harbour/contrib/hbblat/tests/hbblat.hbp +++ b/harbour/contrib/hbblat/tests/hbblat.hbp @@ -3,3 +3,6 @@ # libs=hbblat blat + +# for the tests only +libs=hbwin diff --git a/harbour/contrib/hbwin/Makefile b/harbour/contrib/hbwin/Makefile index e4ef5a90a7..93f94d49b8 100644 --- a/harbour/contrib/hbwin/Makefile +++ b/harbour/contrib/hbwin/Makefile @@ -17,7 +17,8 @@ C_SOURCES = \ win_prn2.c \ win_prt.c \ win_regc.c \ - wapi_commctrl.c \ + wapi_commctrl.c \ + wapi_winbase.c \ PRG_SOURCES = \ win_os.prg \ diff --git a/harbour/contrib/hbwin/common.mak b/harbour/contrib/hbwin/common.mak index 1ed86e5232..6d89c1cba7 100644 --- a/harbour/contrib/hbwin/common.mak +++ b/harbour/contrib/hbwin/common.mak @@ -23,6 +23,7 @@ LIB_OBJS = \ $(OBJ_DIR)win_prt$(OBJEXT) \ $(OBJ_DIR)win_regc$(OBJEXT) \ $(OBJ_DIR)wapi_commctrl$(OBJEXT) \ + $(OBJ_DIR)wapi_winbase$(OBJEXT) \ \ $(OBJ_DIR)win_os$(OBJEXT) \ $(OBJ_DIR)win_reg$(OBJEXT) \ diff --git a/harbour/contrib/hbwin/tests/hbwin.hbp b/harbour/contrib/hbwin/tests/hbwin.hbp index 35b8e0e3b1..212f8315e5 100644 --- a/harbour/contrib/hbwin/tests/hbwin.hbp +++ b/harbour/contrib/hbwin/tests/hbwin.hbp @@ -2,4 +2,4 @@ # $Id$ # -{win}libs=hbwin ole32 oleaut32 winspool +{win}libs=hbwin ole32 oleaut32 shell32 winspool diff --git a/harbour/contrib/hbwin/tests/testreg.prg b/harbour/contrib/hbwin/tests/testreg.prg index e78671ac64..8fa0023ac5 100644 --- a/harbour/contrib/hbwin/tests/testreg.prg +++ b/harbour/contrib/hbwin/tests/testreg.prg @@ -6,6 +6,9 @@ PROCEDURE Main() + ? ">" + win_GetCommandLineParam() + "<" + ? ">" + wapi_GetCommandLine() + "<" + /* old API */ ? ">" + hb_ValToStr( GetRegistry( HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper" ) ) + "<" diff --git a/harbour/contrib/hbwin/wapi_winbase.c b/harbour/contrib/hbwin/wapi_winbase.c new file mode 100644 index 0000000000..e1d5bdf824 --- /dev/null +++ b/harbour/contrib/hbwin/wapi_winbase.c @@ -0,0 +1,73 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Misc Windows API functions + * + * 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. + * + */ + +#define HB_OS_WIN_USED + +#include "hbapi.h" + +HB_FUNC( WAPI_GETCOMMANDLINE ) +{ + char * buffer = HB_TCHAR_CONVFROM( GetCommandLine() ); + + { + /* Convert from OS codepage */ + BOOL fFree; + char * pbyResult = ( char * ) hb_osDecode( ( BYTE * ) buffer, &fFree ); + + if( fFree ) + hb_retc_buffer( pbyResult ); + else + hb_retc( pbyResult ); + } + + HB_TCHAR_FREE( buffer ); +} diff --git a/harbour/contrib/hbwin/win_misc.c b/harbour/contrib/hbwin/win_misc.c index 7c5b123c48..18a0a52443 100644 --- a/harbour/contrib/hbwin/win_misc.c +++ b/harbour/contrib/hbwin/win_misc.c @@ -156,3 +156,46 @@ HB_FUNC( WIN_LOADRESOURCE ) HB_TCHAR_FREE( lpType ); } } + +HB_FUNC( WIN_GETCOMMANDLINEPARAM ) +{ + char * buffer = HB_TCHAR_CONVFROM( GetCommandLine() ); + long pos; + + /* Skip application path */ + pos = 0; + if( buffer[ pos ] == '"' ) + { + /* If it contains spaces, it will be enclosed in quote chars, + skip this to get to the command line. */ + pos++; + while( buffer[ pos ] && buffer[ pos ] != '"' ) + pos++; + + if( buffer[ pos ] == '"' ) + pos++; + } + else + { + /* If not, look for the next space for the beginning of the + command line. */ + while( buffer[ pos ] && buffer[ pos ] != ' ' ) + pos++; + } + + if( buffer[ pos ] == ' ' ) + pos++; + + { + /* Convert from OS codepage */ + BOOL fFree; + char * pbyResult = ( char * ) hb_osDecode( ( BYTE * ) buffer + pos, &fFree ); + + if( fFree ) + hb_retc_buffer( pbyResult ); + else + hb_retc( pbyResult ); + } + + HB_TCHAR_FREE( buffer ); +} diff --git a/harbour/utils/hbmk/examples/xbgtk.hbp b/harbour/utils/hbmk/examples/xbgtk.hbp index ca60613664..f7052f4d39 100644 --- a/harbour/utils/hbmk/examples/xbgtk.hbp +++ b/harbour/utils/hbmk/examples/xbgtk.hbp @@ -5,5 +5,4 @@ libs=xbgtk {win}libs=gdk-win32-2.0. gdk_pixbuf-2.0. gtk-win32-2.0. glib-2.0. gobject-2.0. pango-1.0. pangocairo-1.0. glade-2.0. {linux}libs=`pkg-config --libs gtk+-2.0` - -# TODO: -I`PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --variable=xbgtkincludedir xbgtk` +{linux}cflags=-I`PKG_CONFIG_PATH=/usr/local/lib/pkgconfig pkg-config --variable=xbgtkincludedir xbgtk` diff --git a/harbour/utils/hbmk/hbmk2.prg b/harbour/utils/hbmk/hbmk2.prg index c02f1472dc..4b96cda4e1 100644 --- a/harbour/utils/hbmk/hbmk2.prg +++ b/harbour/utils/hbmk/hbmk2.prg @@ -1287,22 +1287,25 @@ STATIC PROCEDURE HBP_ProcessOne( cFileName,; DO CASE CASE Lower( Left( cLine, Len( "libs=" ) ) ) == "libs=" ; cLine := SubStr( cLine, Len( "libs=" ) + 1 ) FOR EACH cItem IN hb_ATokens( cLine, " " ) + cItem := DirAdaptPathSep( cItem ) IF AScan( aLIBS, {| tmp | tmp == cItem } ) == 0 - AAddNotEmpty( aLIBS, DirAdaptPathSep( cItem ) ) + AAddNotEmpty( aLIBS, cItem ) ENDIF NEXT CASE Lower( Left( cLine, Len( "libpaths=" ) ) ) == "libpaths=" ; cLine := SubStr( cLine, Len( "libpaths=" ) + 1 ) FOR EACH cItem IN hb_ATokens( cLine, " " ) - IF AScan( aLIBS, {| tmp | tmp == cItem } ) == 0 - AAddNotEmpty( aLIBPATH, DirAdaptPathSep( cItem ) ) + cItem := DirAdaptPathSep( cItem ) + IF AScan( aLIBPATH, {| tmp | tmp == cItem } ) == 0 + AAddNotEmpty( aLIBPATH, cItem ) ENDIF NEXT CASE Lower( Left( cLine, Len( "prgflags=" ) ) ) == "prgflags=" ; cLine := SubStr( cLine, Len( "prgflags=" ) + 1 ) FOR EACH cItem IN hb_ATokens( cLine, " " ) + cItem := DirAdaptPathSep( cItem ) IF AScan( aOPTPRG, {| tmp | tmp == cItem } ) == 0 - AAddNotEmpty( aOPTPRG, DirAdaptPathSep( cItem ) ) + AAddNotEmpty( aOPTPRG, cItem ) ENDIF NEXT @@ -1436,7 +1439,7 @@ STATIC FUNCTION ArchCompFilter( cItem ) /* Separate filter from the rest of the item */ cFilterSrc := SubStr( cItem, nStart + 1, nEnd - nStart - 1 ) - cItem := Left( cItem, nStart - 1 ) + " " + SubStr( cItem, nEnd + 1 ) + cItem := Left( cItem, nStart - 1 ) + SubStr( cItem, nEnd + 1 ) /* Parse filter and convert it to Harbour expression */ cFilterHarb := ""