Updating hbpp.c
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
19991018-14:10 GMT+3 Alexander Kresin
|
||||
* source/pp/hbpp.c
|
||||
* Fixed bugs, reported by Antonio Linares
|
||||
* source/rtl/tbrowse.prg
|
||||
* Fixed some problems with Left(), Right() and logical fields.
|
||||
|
||||
19991018-11:58 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
* source/rtl/adir.prg
|
||||
+ SET DEFAULT handling added.
|
||||
|
||||
@@ -444,82 +444,85 @@ void ConvertPatterns ( char *mpatt, int mlen, char *rpatt, int rlen )
|
||||
|
||||
while ( *(mpatt+i) != '\0' )
|
||||
{
|
||||
if ( *(mpatt+i) == '<' )
|
||||
{ /* Drag match marker, determine it type */
|
||||
explen = 0; ipos = i; i++; exptype = '0';
|
||||
while( *(mpatt+i) == ' ' || *(mpatt+i) == '\t' ) i++;
|
||||
if ( *(mpatt+i) == '*' ) /* Wild match marker */
|
||||
{ exptype = '3'; i++; }
|
||||
else if ( *(mpatt+i) == '(' ) /* Extended expression match marker */
|
||||
{ exptype = '4'; i++; }
|
||||
while ( *(mpatt+i) != '>' )
|
||||
{
|
||||
if ( *(mpatt+i) == ',' ) /* List match marker */
|
||||
if ( *(mpatt+i) == '<' )
|
||||
{ /* Drag match marker, determine it type */
|
||||
explen = 0; ipos = i; i++; exptype = '0';
|
||||
while( *(mpatt+i) == ' ' || *(mpatt+i) == '\t' ) i++;
|
||||
if ( *(mpatt+i) == '*' ) /* Wild match marker */
|
||||
{ exptype = '3'; i++; }
|
||||
else if ( *(mpatt+i) == '(' ) /* Extended expression match marker */
|
||||
{ exptype = '4'; i++; }
|
||||
while ( *(mpatt+i) != '>' )
|
||||
{
|
||||
exptype = '1';
|
||||
while ( *(mpatt+i) != '>' ) i++;
|
||||
break;
|
||||
if ( *(mpatt+i) == ',' ) /* List match marker */
|
||||
{
|
||||
exptype = '1';
|
||||
while ( *(mpatt+i) != '>' ) i++;
|
||||
break;
|
||||
}
|
||||
else if ( *(mpatt+i) == ':' ) /* Restricted match marker */
|
||||
{
|
||||
exptype = '2';
|
||||
*(mpatt+i--) = ' ';
|
||||
break;
|
||||
}
|
||||
if( *(mpatt+i) != ' ' && *(mpatt+i) != '\t' )
|
||||
*(exppatt+explen++) = *(mpatt+i);
|
||||
i++;
|
||||
}
|
||||
else if ( *(mpatt+i) == ':' ) /* Restricted match marker */
|
||||
if ( exptype == '3' )
|
||||
{
|
||||
exptype = '2';
|
||||
*(mpatt+i--) = ' ';
|
||||
break;
|
||||
if ( *(exppatt+explen-1) == '*' ) explen--;
|
||||
else
|
||||
GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
}
|
||||
*(exppatt+explen++) = *(mpatt+i++);
|
||||
}
|
||||
if ( exptype == '3' )
|
||||
{
|
||||
if ( *(exppatt+explen-1) == '*' ) explen--;
|
||||
else
|
||||
GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
}
|
||||
else if ( exptype == '4' )
|
||||
{
|
||||
if ( *(exppatt+explen-1) == ')' ) explen--;
|
||||
else
|
||||
GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
}
|
||||
rmlen = i - ipos + 1;
|
||||
else if ( exptype == '4' )
|
||||
{
|
||||
if ( *(exppatt+explen-1) == ')' ) explen--;
|
||||
else
|
||||
GenError( _szPErrors, 'P', ERR_PATTERN_DEFINITION, NULL, NULL );
|
||||
}
|
||||
rmlen = i - ipos + 1;
|
||||
/* Convert match marker into inner format */
|
||||
lastchar = (char) ( (unsigned int)lastchar + 1 );
|
||||
expreal[1] = lastchar;
|
||||
expreal[2] = exptype;
|
||||
pp_Stuff ( expreal, mpatt+ipos, 4, rmlen, mlen );
|
||||
mlen += 4 - rmlen; i += 4 - rmlen;
|
||||
lastchar = (char) ( (unsigned int)lastchar + 1 );
|
||||
expreal[1] = lastchar;
|
||||
expreal[2] = exptype;
|
||||
pp_Stuff ( expreal, mpatt+ipos, 4, rmlen, mlen );
|
||||
mlen += 4 - rmlen;
|
||||
i += 4 - rmlen;
|
||||
|
||||
/* Look for appropriate result markers */
|
||||
ptr = rpatt;
|
||||
while ( (ifou = pp_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 )
|
||||
{
|
||||
ptr = rpatt;
|
||||
while ( (ifou = pp_strAt( exppatt, explen, ptr, rlen-(ptr-rpatt) )) > 0 )
|
||||
{
|
||||
/* Convert result marker into inner format */
|
||||
ptr += ifou;
|
||||
if ( *(ptr-2) == '<' && *(ptr+explen-1) == '>' &&
|
||||
ptr += ifou;
|
||||
if ( *(ptr-2) == '<' && *(ptr+explen-1) == '>' &&
|
||||
*(ptr-3) != '\\' && *(ptr+explen-2) != '\\' ) /* <...> */
|
||||
{
|
||||
if ( *(ptr-3) == '#' && *(ptr-4) != '\\' ) /* #<...> */
|
||||
{ exptype = '1'; ptr -= 3; rmlen = explen+3; }
|
||||
else
|
||||
{ exptype = '0'; ptr -= 2; rmlen = explen+2; }
|
||||
}
|
||||
else if ( *(ptr-3) == '<' && *(ptr+explen) == '>' &&
|
||||
{
|
||||
if ( *(ptr-3) == '#' && *(ptr-4) != '\\' ) /* #<...> */
|
||||
{ exptype = '1'; ptr -= 3; rmlen = explen+3; }
|
||||
else
|
||||
{ exptype = '0'; ptr -= 2; rmlen = explen+2; }
|
||||
}
|
||||
else if ( *(ptr-3) == '<' && *(ptr+explen) == '>' &&
|
||||
*(ptr-4) != '\\' && *(ptr+explen-1) != '\\' ) /* < ... > */
|
||||
{
|
||||
ptr -= 2;
|
||||
if ( *ptr == '\"' ) exptype = '2';
|
||||
else if ( *ptr == '(' ) exptype = '3';
|
||||
else if ( *ptr == '{' ) exptype = '4';
|
||||
else if ( *ptr == '.' ) exptype = '5';
|
||||
ptr--;
|
||||
rmlen = explen+4;
|
||||
{
|
||||
ptr -= 2;
|
||||
if ( *ptr == '\"' ) exptype = '2';
|
||||
else if ( *ptr == '(' ) exptype = '3';
|
||||
else if ( *ptr == '{' ) exptype = '4';
|
||||
else if ( *ptr == '.' ) exptype = '5';
|
||||
ptr--;
|
||||
rmlen = explen+4;
|
||||
}
|
||||
else continue;
|
||||
expreal[2] = exptype;
|
||||
pp_Stuff ( expreal, ptr, 4, rmlen, rlen );
|
||||
rlen += 4 - rmlen;
|
||||
}
|
||||
else continue;
|
||||
expreal[2] = exptype;
|
||||
pp_Stuff ( expreal, ptr, 4, rmlen, rlen );
|
||||
rlen += 4 - rmlen;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1430,7 +1433,7 @@ void SearnRep( char *exppatt,char *expreal,int lenreal,char *ptro, int *lenres)
|
||||
if ( *ptr == '\1' ) kolmarkers++;
|
||||
ptr--;
|
||||
}
|
||||
if ( *ptr == '[' )
|
||||
if ( *ptr == '[' && *(ptr-1) != '\\' )
|
||||
{
|
||||
if( Repeate ) aIsRepeate[ Repeate - 1 ]++;
|
||||
if( !lReplacePat ) return;
|
||||
|
||||
@@ -242,17 +242,23 @@ return nil
|
||||
|
||||
METHOD Left() CLASS TBrowse
|
||||
|
||||
local leftVis := ::leftVisible
|
||||
|
||||
if ::ColPos > ::leftVisible .or. ( ::ColPos < ::leftVisible .and. ::ColPos > 1 ) ;
|
||||
.or. ( ::ColPos == ::leftVisible .and. ::Freeze > 0 .and. ::leftVisible - ::Freeze == 1 )
|
||||
::DeHilite()
|
||||
::ColPos--
|
||||
::Hilite()
|
||||
else
|
||||
if ::ColPos > 1
|
||||
::rightVisible--
|
||||
::leftVisible = ::LeftDetermine()
|
||||
::ColPos--
|
||||
::RefreshAll()
|
||||
if ::ColPos > 1 .and. ::leftVisible - ::Freeze > 1
|
||||
while leftVis == ::leftVisible
|
||||
::rightVisible--
|
||||
::leftVisible = ::LeftDetermine()
|
||||
::RefreshAll()
|
||||
end
|
||||
if --::ColPos < ::leftVisible
|
||||
::ColPos = ::rightVisible
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -388,7 +394,7 @@ METHOD Right() CLASS TBrowse
|
||||
if ::ColPos < Len( ::aColumns )
|
||||
::rightVisible++
|
||||
::leftVisible = ::LeftDetermine()
|
||||
::ColPos = ::rightVisible
|
||||
::ColPos++
|
||||
::RefreshAll()
|
||||
endif
|
||||
endif
|
||||
@@ -400,10 +406,15 @@ METHOD DeHilite() CLASS TBrowse
|
||||
local nColor := If( ::aColumns[ ::ColPos ]:ColorBlock != nil,;
|
||||
Eval( ::aColumns[ ::ColPos ]:ColorBlock )[ 1 ], 1 )
|
||||
local cColor := __ColorIndex( ::ColorSpec, nColor - 1 )
|
||||
local ftmp := Eval( ::aColumns[ ::ColPos ]:block )
|
||||
|
||||
if valtype( ftmp ) == "L"
|
||||
ftmp = PadC( If( ftmp, "T","F" ), ::aColumns[ ::ColPos ]:Width )
|
||||
endif
|
||||
|
||||
@ ::nTop + ::RowPos - If( ::lHeaders, 0, 1 ) + If( Empty(::HeadSep), 0, 1 ),;
|
||||
::aColumns[ ::ColPos ]:ColPos ;
|
||||
SAY PadR( Eval( ::aColumns[ ::ColPos ]:block ), ::aColumns[ ::ColPos ]:Width ) ;
|
||||
SAY PadR( ftmp, ::aColumns[ ::ColPos ]:Width ) ;
|
||||
COLOR cColor
|
||||
|
||||
return nil
|
||||
@@ -420,11 +431,16 @@ METHOD Hilite() CLASS TBrowse
|
||||
local nColor := If( ::aColumns[ ::ColPos ]:ColorBlock != nil,;
|
||||
Eval( ::aColumns[ ::ColPos ]:ColorBlock )[ 2 ], 2 )
|
||||
local cColor := __ColorIndex( ::ColorSpec, nColor - 1 )
|
||||
local ftmp := Eval( ::aColumns[ ::ColPos ]:block )
|
||||
|
||||
if valtype( ftmp ) == "L"
|
||||
ftmp = PadC( If( ftmp, "T","F" ), ::aColumns[ ::ColPos ]:Width )
|
||||
endif
|
||||
|
||||
if ::AutoLite
|
||||
@ ::nTop + ::RowPos - If( ::lHeaders, 0, 1 ) + If( Empty(::HeadSep), 0, 1 ),;
|
||||
::aColumns[ ::ColPos ]:ColPos ;
|
||||
SAY PadR( Eval( ::aColumns[ ::ColPos ]:block ), ::aColumns[ ::ColPos ]:Width ) ;
|
||||
SAY PadR( ftmp, ::aColumns[ ::ColPos ]:Width ) ;
|
||||
COLOR cColor
|
||||
endif
|
||||
|
||||
@@ -439,6 +455,7 @@ METHOD Stabilize() CLASS TBrowse
|
||||
local lFooters := .f. // Are there column footers to paint ?
|
||||
local cColColor // Column color to use
|
||||
local oCol, oCol2
|
||||
local ftmp
|
||||
|
||||
if ::aRedraw == Nil .or. ! ::aRedraw[ 1 ]
|
||||
// Are there any column header to paint ?
|
||||
@@ -613,8 +630,11 @@ METHOD Stabilize() CLASS TBrowse
|
||||
__ColorIndex( ::ColorSpec,;
|
||||
Eval( ::aColumns[ n ]:ColorBlock )[ 1 ] - 1 ),;
|
||||
::ColorSpec )
|
||||
DevOut( PadR( Eval( ::aColumns[ n ]:block ),;
|
||||
::aColumns[ n ]:Width ), cColColor )
|
||||
ftmp = Eval( ::aColumns[ n ]:block )
|
||||
if valtype( ftmp ) == "L"
|
||||
ftmp = PadC( If( ftmp, "T","F" ), ::aColumns[ n ]:Width )
|
||||
endif
|
||||
DevOut( PadR( ftmp, ::aColumns[ n ]:Width ), cColColor )
|
||||
else
|
||||
DevOut( Space( ::aColumns[ n ]:Width ), ::ColorSpec )
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user