2013-06-03 16:45 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)

* src/rtl/hbtoken.c
    + added support for passing token parser parameters as bit field number.
      The goal is to replace last to parameters with single bit field which
      allows to set many different parsing aspects instead of adding many
      new parameters.
    + added support for reverted apostrophes quoting: `a b c`
    ; TODO: add constant values to control parser in token functions

  * utils/hbmk2/hbmk2.prg
    ! respect reverted apostrophes quoting in options read from .hbp/.hbm
      files.
    ! do not ignore tool parameters passed in -*flags= hbmk2 params if
      they do not start with '-'. It resolves problems with shells which
      need special quoting to pass parameters, i.e. with both modifications
      it's possible to use in hbp files dynamic parameters encapsulated in
      different forms, depending on used platform, shell and parameter type,
      i.e. parameters are passed as set of separated arguments:
         -cflag=`config-tool1`
      or paramters are passed as single argument:
         -cflag="`config-tool2`"
      or parameters are passed in file which name shows config-tool3:
         -cflag="@`config-tool3`"
      In short words now things like:
         -cflag=`pkg-config --cflags gtk+-3.0`
      will work correctly with .hbp files
This commit is contained in:
Przemysław Czerpak
2013-06-03 16:45:25 +02:00
parent e0238b29ce
commit d900dc5b1c
3 changed files with 51 additions and 17 deletions

View File

@@ -10,6 +10,33 @@
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
*/
2013-06-03 16:45 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/rtl/hbtoken.c
+ added support for passing token parser parameters as bit field number.
The goal is to replace last to parameters with single bit field which
allows to set many different parsing aspects instead of adding many
new parameters.
+ added support for reverted apostrophes quoting: `a b c`
; TODO: add constant values to control parser in token functions
* utils/hbmk2/hbmk2.prg
! respect reverted apostrophes quoting in options read from .hbp/.hbm
files.
! do not ignore tool parameters passed in -*flags= hbmk2 params if
they do not start with '-'. It resolves problems with shells which
need special quoting to pass parameters, i.e. with both modifications
it's possible to use in hbp files dynamic parameters encapsulated in
different forms, depending on used platform, shell and parameter type,
i.e. parameters are passed as set of separated arguments:
-cflag=`config-tool1`
or paramters are passed as single argument:
-cflag="`config-tool2`"
or parameters are passed in file which name shows config-tool3:
-cflag="@`config-tool3`"
In short words now things like:
-cflag=`pkg-config --cflags gtk+-3.0`
will work correctly with .hbp files
2013-05-29 15:14 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* src/vm/hashes.c
! fixed and optimized reordering when KEEPORDER flag is cleared

View File

@@ -52,8 +52,9 @@
#define _HB_TOK_RESPECT_DQUOTE 1
#define _HB_TOK_RESPECT_SQUOTE 2
#define _HB_TOK_ISDELIM 4
#define _HB_TOK_STRIP_QUUTE 8
#define _HB_TOK_RESPECT_BQUOTE 4
#define _HB_TOK_ISDELIM 8
#define _HB_TOK_STRIP_QUUTE 16
static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE nLen,
const char * szDelim, HB_SIZE nDelim,
@@ -70,7 +71,8 @@ static HB_SIZE hb_tokenCount( const char * szLine, HB_SIZE nLen,
cQuote = 0;
}
else if( ( szLine[ ul ] == '"' && ( iFlags & _HB_TOK_RESPECT_DQUOTE ) ) ||
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) )
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) ||
( szLine[ ul ] == '`' && ( iFlags & _HB_TOK_RESPECT_BQUOTE ) ) )
cQuote = szLine[ ul ];
else if( szLine[ ul ] == szDelim[ 0 ] &&
( nDelim == 1 || ! memcmp( szLine + ul, szDelim, nDelim ) ) )
@@ -104,7 +106,8 @@ static const char * hb_tokenGet( const char * szLine, HB_SIZE nLen,
cQuote = 0;
}
else if( ( szLine[ ul ] == '"' && ( iFlags & _HB_TOK_RESPECT_DQUOTE ) ) ||
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) )
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) ||
( szLine[ ul ] == '`' && ( iFlags & _HB_TOK_RESPECT_BQUOTE ) ) )
cQuote = szLine[ ul ];
else if( szLine[ ul ] == szDelim[ 0 ] &&
( nDelim == 1 || ! memcmp( szLine + ul, szDelim, nDelim ) ) )
@@ -152,7 +155,8 @@ static PHB_ITEM hb_tokenArray( const char * szLine, HB_SIZE nLen,
cQuote = 0;
}
else if( ( szLine[ ul ] == '"' && ( iFlags & _HB_TOK_RESPECT_DQUOTE ) ) ||
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) )
( szLine[ ul ] == '\'' && ( iFlags & _HB_TOK_RESPECT_SQUOTE ) ) ||
( szLine[ ul ] == '`' && ( iFlags & _HB_TOK_RESPECT_BQUOTE ) ) )
cQuote = szLine[ ul ];
else if( szLine[ ul ] == szDelim[ 0 ] &&
( nDelim == 1 || ! memcmp( szLine + ul, szDelim, nDelim ) ) )
@@ -221,6 +225,8 @@ static HB_BOOL hb_tokenParam( int iParam, HB_SIZE nSkip,
if( hb_parl( iParam + 2 ) )
iFlags &= ~_HB_TOK_RESPECT_SQUOTE;
}
else
iFlags |= hb_parni( iParam + 1 );
}
*pnLen = nLen;

View File

@@ -3151,14 +3151,14 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
CASE Left( cParamL, Len( "-iflag=" ) ) == "-iflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-iflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aOPTI ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
CASE Left( cParamL, Len( "-signflag=" ) ) == "-signflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-signflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aOPTS ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
@@ -3199,56 +3199,56 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
CASE Left( cParamL, Len( "-cflag=" ) ) == "-cflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-cflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aOPTC ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
CASE Left( cParamL, Len( "-cflag+=" ) ) == "-cflag+="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-cflag+=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aOPTCUSER ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
CASE Left( cParamL, Len( "-resflag=" ) ) == "-resflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-resflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aOPTRES ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
CASE Left( cParamL, Len( "-ldflag=" ) ) == "-ldflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-ldflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAddWithWarning( hbmk, hbmk[ _HBMK_aOPTL ], hbmk_hb_DirSepToOS( cParam, 2 ), aParam, .F. )
ENDIF
CASE Left( cParamL, Len( "-ldflag+=" ) ) == "-ldflag+="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-ldflag+=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAddWithWarning( hbmk, hbmk[ _HBMK_aOPTLPOST ], hbmk_hb_DirSepToOS( cParam, 2 ), aParam, .F. )
ENDIF
CASE Left( cParamL, Len( "-dflag=" ) ) == "-dflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-dflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAddWithWarning( hbmk, hbmk[ _HBMK_aOPTD ], hbmk_hb_DirSepToOS( cParam, 2 ), aParam, .F. )
ENDIF
CASE Left( cParamL, Len( "-dflag+=" ) ) == "-dflag+="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-dflag+=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAddWithWarning( hbmk, hbmk[ _HBMK_aOPTDPOST ], hbmk_hb_DirSepToOS( cParam, 2 ), aParam, .F. )
ENDIF
CASE Left( cParamL, Len( "-aflag=" ) ) == "-aflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-aflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aOPTA ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
@@ -3262,7 +3262,7 @@ STATIC FUNCTION __hbmk( aArgs, nArgTarget, nLevel, /* @ */ lPause, /* @ */ lExit
CASE Left( cParamL, Len( "-pflag=" ) ) == "-pflag="
cParam := MacroProc( hbmk, SubStr( cParam, Len( "-pflag=" ) + 1 ), aParam[ _PAR_cFileName ] )
IF Left( cParam, 1 ) $ cOptPrefix
IF ! Empty( cParam )
AAdd( hbmk[ _HBMK_aPLUGINPars ], hbmk_hb_DirSepToOS( cParam, 2 ) )
ENDIF
@@ -11332,8 +11332,9 @@ STATIC FUNCTION HBM_Load( hbmk, aParams, cFileName, nNestingLevel, lProcHBP, cPa
FOR EACH cLine IN hb_ATokens( cFile, _CHR_EOL )
IF !( Left( cLine, 1 ) == "#" )
FOR EACH cParam IN hb_ATokens( cLine,, .T. )
FOR EACH cParam IN hb_ATokens( cLine,, 7 )
cParam := StrStripQuote( cParam )
IF ! Empty( cParam )
DO CASE
CASE Lower( cParam ) == "-skip"