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.
This commit is contained in:
Viktor Szakats
2009-02-18 01:06:57 +00:00
parent c3bfd3c191
commit 409012d5e6
11 changed files with 170 additions and 46 deletions

View File

@@ -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

View File

@@ -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 <windows.h>
#include "hbapi.h"
/* GetCommandLine() returns entire command line as a single string */
HB_FUNC( WAPI_GETCOMMANDLINE )
{
hb_retc( GetCommandLine() );
}
#pragma ENDDUMP

View File

@@ -3,3 +3,6 @@
#
libs=hbblat blat
# for the tests only
libs=hbwin

View File

@@ -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 \

View File

@@ -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) \

View File

@@ -2,4 +2,4 @@
# $Id$
#
{win}libs=hbwin ole32 oleaut32 winspool
{win}libs=hbwin ole32 oleaut32 shell32 winspool

View File

@@ -6,6 +6,9 @@
PROCEDURE Main()
? ">" + win_GetCommandLineParam() + "<"
? ">" + wapi_GetCommandLine() + "<"
/* old API */
? ">" + hb_ValToStr( GetRegistry( HKEY_CURRENT_USER, "Control Panel\Desktop", "Wallpaper" ) ) + "<"

View File

@@ -0,0 +1,73 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Misc Windows API functions
*
* Copyright 2009 Viktor Szakats <harbour.01 syenar hu>
* 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 );
}

View File

@@ -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 );
}

View File

@@ -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`

View File

@@ -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 := ""