unit analyserMW;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus,
engine, faults, StdCtrls, ExtCtrls, ComCtrls, ToolWin;
type
TForm1 =
class(TForm)
MainMenu1: TMainMenu;
File1: TMenuItem;
SetFileBase1: TMenuItem;
Colors1: TMenuItem;
Analyse1: TMenuItem;
Panel1: TPanel;
ListBox1: TListBox;
Label1: TLabel;
Panel2: TPanel;
ListBox2: TListBox;
Label2: TLabel;
Panel3: TPanel;
Panel4: TPanel;
Panel5: TPanel;
Panel6: TPanel;
ListBox3: TListBox;
StatusBar1: TStatusBar;
PaintBox1: TPaintBox;
Label3: TLabel;
Panel7: TPanel;
PaintBox2: TPaintBox;
procedure SetFileBase1Click(Sender: TObject);
procedure Colors1Click(Sender: TObject);
procedure Analyse1Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure ListBox3Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure PaintBox1Paint(Sender: TObject);
procedure PaintBox2Paint(Sender: TObject);
private
{ Private declarations }
dhh, dhc: integer;
hindex:
array[0..6]
of byte;
cfn:
string;
procedure readfile(s:
string);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses fileselector;
{$R *.dfm}
procedure TForm1.SetFileBase1Click(Sender: TObject);
begin
if filelist.showmodal = mrok
then begin;
end;
end;
procedure TForm1.Colors1Click(Sender: TObject);
begin
if colorcode.showmodal= mrok
then begin;
end;
end;
procedure tform1.readfile;
var f: textfile; st:
string; c: char;
begin;
assignfile(f,s);
reset(f);
while not eof(f)
do begin;
readln(f,st);
ps.parseline(st);
end;
closefile(f);
end;
procedure TForm1.Analyse1Click(Sender: TObject);
var i,n:integer; s:
string;
begin
n:= filelist.nfiles;
ps.reset;
setlength(operations, n);
filenumber:=0;
if n>0
then for i:=0
to n-1
do begin;
if filelist.isfile(i,s)
then begin;
statusbar1.Panels[0].Text:=extractfilename(s);
statusbar1.repaint;
cfn:=s;
readfile(s);
operations[filenumber]:=chip[0].nfl;
inc(filenumber);
statusbar1.Panels[1].Text:=ps.device;
statusbar1.repaint;
end else begin;
{its a comment}
end;
end;
listbox1.clear;
for i:=0
to 255
do begin;
if i=52
then begin;
s:='
q';
end;
chip[i].countfaults;
with chip[i]
do begin;
if (nfaults+ npersistantfaults = 0)
then listbox1.items.add(format('
%3d '+#9+'
%6d',[i, nfaults + npersistantfaults]))
else listbox1.items.add(format('
%3d '+#9+'
%6d'+#9+'
(%d)',[i, nfaults + npersistantfaults, firstfile]))
end;
end;
listbox3.clear;
ps.hlist(listbox3.Items, hindex);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var ch: integer; f: tfault;
begin
listbox2.clear;
label2.Caption:='
';
ch:=listbox1.itemindex;
if ch >=0
then begin;
label2.Caption:=format('
Chip %d',[ch]);
for f:=ft_tobulkerase
to ft_badsignature
do begin;
listbox2.items.add(format('
%6d '+#9+faultdes[f], [chip[ch].fcount[f]]));
end;
end;
listbox3.ItemIndex:=-1;
paintbox2.Invalidate;
end;
procedure TForm1.ListBox3Click(Sender: TObject);
var c,h: integer;
begin
c:=listbox1.ItemIndex;
if c>=0
then begin;
h:=listbox3.ItemIndex;
if h>=0
then begin;
h:=hindex[h];
dhh:=h; dhc:=c;
paintbox1.Invalidate;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
dhh:=-1; dhc:=-1;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
ps.drawhist(dhh, dhc, paintbox1);
end;
procedure TForm1.PaintBox2Paint(Sender: TObject);
var cn: integer;
begin
if filenumber<1
then exit
else begin;
cn:= listbox1.ItemIndex;
if cn<0
then exit;
ps.drawepf(cn,paintbox2);
end;
end;
end.