Here is a few more cases which JCF b7 seems not to like.
I would agree that they are sort of fringe cases but they are legal and used in legitimate code.
BTW, since this is beta, could you not add a temporary feature so that it would write error messages to a text file and continue, (with the next file in the directory) especially when the user has opted for 'All files in Directory'.
If that sort of option were available I would have probably been able to provide a larger number of failure cases. As it is, it just takes too long to parse most of my test files and I am unable to spare that much time waiting at JFC to finish every single file.
Failure cases are below --I hope they come out OK with SF's posting.
Cheers,
Adem
-------------------------------
{Advgrid.pas}
{Line 17126}
Procedure TAdvStringGrid.SavetoDOC(filename: String);
Var
fword: Variant;
fdoc: Variant;
ftable: Variant;
frng: Variant;
fcell: Variant;
s, z: Integer;
Begin
Screen.Cursor := crHourGlass;
Try
FWord := CreateOLEObject('word.application');
Except
Screen.Cursor := crDefault;
Raise EAdvGridError.Create('Word OLE server not found');
Exit;
End;
For s := 1 To RowCount Do Begin
For z := 1 To ColCount Do Begin
FCell := FTable.Cell(Row := s, Column := z);
FCell.Range.InsertAfter(SaveCell(RemapCol(z - 1), s - 1));
Case GetCellAlignment(z - 1, s - 1).Alignment Of
taRightJustify: FCell.Range.ParagraphFormat.Alignment := wdAlignParagraphRight;
taCenter: fcell.Range.ParagraphFormat.Alignment := wdAlignParagraphCenter;
End;
End;
End;
procedure TFilter.BuildTextSearchBitmap(Bitmap: TRecordsBitmap;
FieldNum: Word;
WordBuffer: PChar;
WordBufferSize: Integer;
var RetryFilter: Boolean);
var
TempWordsList: TLanguageStringList;
StopWordPos: Integer;
I: Integer;
FirstIndexKeyBuffer: array [0..MAX_KEYLEN-1] of Char;
SecondIndexKeyBuffer: array [0..MAX_KEYLEN-1] of Char;
RightBitmap: TRecordsBitmap;
TempPartialLength: Word;
AllStopWords: Boolean;
begin
TempWordsList:=TLanguageStringList.Create;
try
with TempWordsList do
begin
LanguageID:=FDataCursor.LanguageID;
SortID:=FDataCursor.SortID;
Duplicates:=dupIgnore;
Sorted:=True;
end;
FDataCursor.CreateWordsList(WordBuffer,WordBufferSize,TempWordsList,True);
RightBitmap:=GetNewRecordsBitmapInstance;
try
RightBitmap.Assign(Bitmap);
AllStopWords:=True;
for I:=0 to TempWordsList.Count-1 do
begin
if (not FDataCursor.TextStopWords.Find(TempWordsList[I],StopWordPos)) then
begin
AllStopWords:=False;
FillChar(FirstIndexKeyBuffer,SizeOf(FirstIndexKeyBuffer),#0);
FillChar(SecondIndexKeyBuffer,SizeOf(SecondIndexKeyBuffer),#0);
Boolean(FirstIndexKeyBuffer[0]):=True;
FlipWordBits(FieldNum,@FirstIndexKeyBuffer[FLDCHG_DATA]);
Move(TempWordsList[I][1],FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE],
Length(TempWordsList[I]));
OSUpperString(FDataCursor.LanguageID,FDataCursor.SortID,
@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE]);
if (StrLen(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE]) > 0) then
begin
if ((StrEnd(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE])-1)^=PARSE_ASTERISK) then
begin
TempPartialLength:=StrLen(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE])-1;
(StrEnd(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE])-1)^:=#0; {<--HERE}
end
else
TempPartialLength:=0;
end
else
TempPartialLength:=0;
FDataCursor.BuildRangeFromConstant(eoEQ,TYPE_ZSTRING,
TEXT_FLDNUM_SIZE+TEXT_WORD_SIZE,
TempPartialLength,False,
@FirstIndexKeyBuffer,
@SecondIndexKeyBuffer);
FDataCursor.NavigateIndexedRecords(@FirstIndexKeyBuffer,@SecondIndexKeyBuffer,
RightBitmap,RetryFilter);
if RetryFilter then
Exit;
Bitmap.AndBits(RightBitmap);
end;
end;
if AllStopWords then
Bitmap.ClearBits;
finally
ReturnRecordsBitmapInstance(RightBitmap);
end;
finally
TempWordsList.Free;
end;
end;
{dbisamlb.pas}
{Line 1757}
procedure FlipFloatBits(Value: double; Buffer: PChar);
var
NumberBytes: array [0..7] of Byte absolute Value;
I: Byte;
begin
if (Value < 0) then
begin
for I:=0 to 7 do
(Buffer+(7-I))^:=Chr(NumberBytes[I] xor $FF);
end
else
begin
Buffer^:=Chr((NumberBytes[7] or $80));
for I:=0 to 6 do
(Buffer+(7-I))^:=Chr(NumberBytes[I]);
end;
end;
QStrings.pas: fixed in CVS. This (label at end of proc failing) has also been reported as bug #803611
dbisamlb.pas, dbisamen.pas: both failures appear to be due to complex stuff on the LHS of the ':='
Fixed in my copy of the code, will check into CVS when fully tested.
Advgrid.pas: 'end' as an identifier?!? yuk!
DirectX.pas: I'll have to go find this file in it's entirety. in order to work with it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Great to see that JCF is getting along fine.
Here is a few more cases which JCF b7 seems not to like.
I would agree that they are sort of fringe cases but they are legal and used in legitimate code.
BTW, since this is beta, could you not add a temporary feature so that it would write error messages to a text file and continue, (with the next file in the directory) especially when the user has opted for 'All files in Directory'.
If that sort of option were available I would have probably been able to provide a larger number of failure cases. As it is, it just takes too long to parse most of my test files and I am unable to spare that much time waiting at JFC to finish every single file.
Failure cases are below --I hope they come out OK with SF's posting.
Cheers,
Adem
-------------------------------
{Advgrid.pas}
{Line 17126}
Procedure TAdvStringGrid.SavetoDOC(filename: String);
Var
fword: Variant;
fdoc: Variant;
ftable: Variant;
frng: Variant;
fcell: Variant;
s, z: Integer;
Begin
Screen.Cursor := crHourGlass;
Try
FWord := CreateOLEObject('word.application');
Except
Screen.Cursor := crDefault;
Raise EAdvGridError.Create('Word OLE server not found');
Exit;
End;
Try
FDoc := FWord.Documents.Add;
FRng := FDoc.Range(start := 0, End := 0); {<-- HERE}
FTable := FDoc.Tables.Add(frng, numRows := RowCount, numColumns := ColCount); {<-- HERE}
For s := 1 To RowCount Do Begin
For z := 1 To ColCount Do Begin
FCell := FTable.Cell(Row := s, Column := z);
FCell.Range.InsertAfter(SaveCell(RemapCol(z - 1), s - 1));
Case GetCellAlignment(z - 1, s - 1).Alignment Of
taRightJustify: FCell.Range.ParagraphFormat.Alignment := wdAlignParagraphRight;
taCenter: fcell.Range.ParagraphFormat.Alignment := wdAlignParagraphCenter;
End;
End;
End;
FDoc.SaveAs(FileName);
Finally
FWord.Quit;
FWord := Unassigned;
Screen.Cursor := FOldCursor;
End;
End;
{dbisamen.pas}
{Line 8365}
procedure TFilter.BuildTextSearchBitmap(Bitmap: TRecordsBitmap;
FieldNum: Word;
WordBuffer: PChar;
WordBufferSize: Integer;
var RetryFilter: Boolean);
var
TempWordsList: TLanguageStringList;
StopWordPos: Integer;
I: Integer;
FirstIndexKeyBuffer: array [0..MAX_KEYLEN-1] of Char;
SecondIndexKeyBuffer: array [0..MAX_KEYLEN-1] of Char;
RightBitmap: TRecordsBitmap;
TempPartialLength: Word;
AllStopWords: Boolean;
begin
TempWordsList:=TLanguageStringList.Create;
try
with TempWordsList do
begin
LanguageID:=FDataCursor.LanguageID;
SortID:=FDataCursor.SortID;
Duplicates:=dupIgnore;
Sorted:=True;
end;
FDataCursor.CreateWordsList(WordBuffer,WordBufferSize,TempWordsList,True);
RightBitmap:=GetNewRecordsBitmapInstance;
try
RightBitmap.Assign(Bitmap);
AllStopWords:=True;
for I:=0 to TempWordsList.Count-1 do
begin
if (not FDataCursor.TextStopWords.Find(TempWordsList[I],StopWordPos)) then
begin
AllStopWords:=False;
FillChar(FirstIndexKeyBuffer,SizeOf(FirstIndexKeyBuffer),#0);
FillChar(SecondIndexKeyBuffer,SizeOf(SecondIndexKeyBuffer),#0);
Boolean(FirstIndexKeyBuffer[0]):=True;
FlipWordBits(FieldNum,@FirstIndexKeyBuffer[FLDCHG_DATA]);
Move(TempWordsList[I][1],FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE],
Length(TempWordsList[I]));
OSUpperString(FDataCursor.LanguageID,FDataCursor.SortID,
@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE]);
if (StrLen(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE]) > 0) then
begin
if ((StrEnd(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE])-1)^=PARSE_ASTERISK) then
begin
TempPartialLength:=StrLen(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE])-1;
(StrEnd(@FirstIndexKeyBuffer[FLDCHG_DATA+TEXT_FLDNUM_SIZE])-1)^:=#0; {<--HERE}
end
else
TempPartialLength:=0;
end
else
TempPartialLength:=0;
FDataCursor.BuildRangeFromConstant(eoEQ,TYPE_ZSTRING,
TEXT_FLDNUM_SIZE+TEXT_WORD_SIZE,
TempPartialLength,False,
@FirstIndexKeyBuffer,
@SecondIndexKeyBuffer);
FDataCursor.NavigateIndexedRecords(@FirstIndexKeyBuffer,@SecondIndexKeyBuffer,
RightBitmap,RetryFilter);
if RetryFilter then
Exit;
Bitmap.AndBits(RightBitmap);
end;
end;
if AllStopWords then
Bitmap.ClearBits;
finally
ReturnRecordsBitmapInstance(RightBitmap);
end;
finally
TempWordsList.Free;
end;
end;
{dbisamlb.pas}
{Line 1757}
procedure FlipFloatBits(Value: double; Buffer: PChar);
var
NumberBytes: array [0..7] of Byte absolute Value;
I: Byte;
begin
if (Value < 0) then
begin
for I:=0 to 7 do
(Buffer+(7-I))^:=Chr(NumberBytes[I] xor $FF);
end
else
begin
Buffer^:=Chr((NumberBytes[7] or $80));
for I:=0 to 6 do
(Buffer+(7-I))^:=Chr(NumberBytes[I]);
end;
end;
{DirectX.pas}
{Line 9334}
const
_c_dfDIKeyboard_Objects: array[0..0] of TDIObjectDataFormat = (
(pguid: @GUID_Key; dwOfs: 1; dwType: DIDFT_BUTTON or DIDFT_ANYINSTANCE; dwFlags: 0)
);
c_dfDIKeyboard: TDIDataFormat = (
dwSize: Sizeof(c_dfDIKeyboard);
dwObjSize: Sizeof(TDIObjectDataFormat);
dwFlags: 0;
dwDataSize: SizeOf(TDIKeyboardState);
dwNumObjs: High(_c_dfDIKeyboard_Objects)+1;
rgodf: @_c_dfDIKeyboard_Objects
);
{QStrings.pas v6.06.424}
{Line 4071}
function Q_TestWildStr(const S, Mask: string; MaskChar, WildCard: Char): Boolean;
label
99;
var
L,X,X0,Q: Integer;
P,P1,B: PChar;
C: Char;
begin
{code}
99:
{code}
end;
QStrings.pas: fixed in CVS. This (label at end of proc failing) has also been reported as bug #803611
dbisamlb.pas, dbisamen.pas: both failures appear to be due to complex stuff on the LHS of the ':='
Fixed in my copy of the code, will check into CVS when fully tested.
Advgrid.pas: 'end' as an identifier?!? yuk!
DirectX.pas: I'll have to go find this file in it's entirety. in order to work with it.
Sorry - re the label error, bug #802994 (regarding numeric labels) is actually more relevant.