unit penigma;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Memo1: TMemo;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Memo2: TMemo;
Memo3: TMemo;
Memo4: TMemo;
Label9: TLabel;
Memo5: TMemo;
Edit9: TEdit;
Edit10: TEdit;
Button2: TButton;
Label10: TLabel;
Label11: TLabel;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure KeyPress(Sender: TObject; var Key: Char);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
TReflektor=RECORD
pos:byte;
bs:CHAR;
END;
TWalze=RECORD
pos:byte;
bs,cb,sc:CHAR;
END;
var
Form1: TForm1;
freflektor:FILE OF TReflektor;
dreflektor:TReflektor;
areflektor:ARRAY[0..25]OF TReflektor;
fwalze1, fwalze2, fwalze3 : File OF TWalze;
dwalze:TWalze;
aw1, aw2, aw3:ARRAY[0..25] OF TWalze;
ea:ARRAY[0..25] OF CHAR;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
VAR
zaehler:BYTE;
reflektor:Shortstring;
walze1,walze2,walze3:SHORTSTRING;
begin
reflektor:='Reflektor'+Edit1.Text+'.dat';
ASSIGNFILE(freflektor,reflektor);
RESET(freflektor);
SEEK(freflektor,STRTOINT(Edit2.Text)-1);
FOR zaehler:=0 TO 25-(STRTOINT(edit2.Text)-1) DO
BEGIN
READ(freflektor,dreflektor);
areflektor[zaehler]:= dreflektor;
END;
SEEK(freflektor,0);
FOR zaehler:=zaehler TO 25 DO
BEGIN
READ(freflektor,dreflektor);
areflektor[zaehler]:= dreflektor;
END;
Memo1.Lines.Clear;
FOR Zaehler:=0 TO 25 DO
Memo1.Lines.Add(INTTOSTR(Zaehler)+' , '+areflektor[zaehler].bs);
Closefile(freflektor);
walze1:='Walze'+Edit3.Text+'.dat';
ASSIGNFILE(fwalze1,walze1);
RESET(fwalze1);
SEEK(fwalze1,STRTOINT(Edit4.Text)-1);
FOR zaehler:=0 TO 25-(STRTOINT(edit4.Text)-1) DO
BEGIN
READ(fwalze1,dwalze);
aw1[zaehler]:= dwalze;
END;
SEEK(fwalze1,0);
FOR zaehler:=zaehler TO 25 DO
BEGIN
READ(fwalze1,dwalze);
aw1[zaehler]:= dwalze;
END;
Memo2.Lines.Clear;
FOR Zaehler:=0 TO 25 DO
Memo2.Lines.Add(INTTOSTR(Zaehler)+' , '+aw1[zaehler].bs+' , '+aw1[zaehler].cb+' , '+aw1[zaehler].sc);
closefile(fwalze1);
walze2:='Walze'+Edit5.Text+'.dat';
ASSIGNFILE(fwalze2,walze2);
RESET(fwalze2);
SEEK(fwalze2,STRTOINT(Edit6.Text)-1);
FOR zaehler:=0 TO 25-(STRTOINT(edit6.Text)-1) DO
BEGIN
READ(fwalze2,dwalze);
aw2[zaehler]:= dwalze;
END;
SEEK(fwalze2,0);
FOR zaehler:=zaehler TO 25 DO
BEGIN
READ(fwalze2,dwalze);
aw2[zaehler]:= dwalze;
END;
Memo3.Lines.Clear;
FOR Zaehler:=0 TO 25 DO
Memo3.Lines.Add(INTTOSTR(Zaehler)+' , '+aw2[zaehler].bs+' , '+aw2[zaehler].cb+' , '+aw2[zaehler].sc);
closefile(fwalze2);
walze3:='Walze'+Edit7.Text+'.dat';
ASSIGNFILE(fwalze3,walze3);
RESET(fwalze3);
SEEK(fwalze3,STRTOINT(Edit8.Text)-1);
FOR zaehler:=0 TO 25-(STRTOINT(edit8.Text)-1) DO
BEGIN
READ(fwalze3,dwalze);
aw3[zaehler]:= dwalze;
END;
SEEK(fwalze3,0);
FOR zaehler:=zaehler TO 25 DO
BEGIN
READ(fwalze3,dwalze);
aw3[zaehler]:= dwalze;
END;
Memo4.Lines.Clear;
FOR Zaehler:=0 TO 25 DO
Memo4.Lines.Add(INTTOSTR(Zaehler)+' , '+aw3[zaehler].bs+' , '+aw3[zaehler].cb+' , '+aw3[zaehler].sc);
closefile(fwalze3);
FOR zaehler:=0 TO 25 DO ea[zaehler]:=chr(65+Zaehler);
Memo5.Lines.Clear;
FOR Zaehler:=0 TO 25 DO Memo5.Lines.add(INTTOSTR(Zaehler)+' , '+ea[zaehler]);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
application.Terminate;
end;
procedure TForm1.Button3Click(Sender: TObject);
VAR
zaehler:INTEGER;
zs: twalze;
begin
zs:= AW3[0];
For zaehler :=1 TO 25 Do
AW3[zaehler-1]:= AW3[zaehler];
AW3[25]:= zs;
IF Zs.sc='+' then
Begin
zs:= Aw2[0];
For zaehler :=1 TO 25 Do
AW2[zaehler-1]:= AW2[zaehler];
AW2[25]:= zs;
IF Zs.sc='+' then
Begin
zs:= Aw1[0];
For zaehler :=1 TO 25 Do
AW1[zaehler-1]:= AW1[zaehler];
AW1[25]:= zs;
end;
end;
For zaehler:=0 to 25 do
Begin
Memo2.Lines.Add(INTTOSTR(Zaehler)+' , '+aw1[zaehler].bs+' , '+aw1[zaehler].cb+' , '+aw1[zaehler].sc);
Memo3.Lines.Add(INTTOSTR(Zaehler)+' , '+aw2[zaehler].bs+' , '+aw2[zaehler].cb+' , '+aw2[zaehler].sc);
Memo4.Lines.Add(INTTOSTR(Zaehler)+' , '+aw3[zaehler].bs+' , '+aw3[zaehler].cb+' , '+aw3[zaehler].sc);
end;
end;
procedure TForm1.KeyPress(Sender: TObject; var Key: Char);
VAR
zaehler:INTEGER;
Pos_BS1:BYTE;
Pos_BS2:BYTE;
Pos_BS3:BYTE;
Pos_Ea:Byte;
pos_Ref:Byte;
cb3,cb2,cb1,Ref,bs1,bs2,bs3:Char;
zs:twalze;
Begin
If (((Key<#97) OR (Key >#122)) AND ((Key <#65) OR (Key >#90)))
Then Key:=#0 Else
Begin
If Key>#90 then Key:= CHR(ORD(KEY)-32);
zs:= AW3[0];
For zaehler :=1 TO 25 Do
AW3[zaehler-1]:= AW3[zaehler];
AW3[25]:= zs;
IF Zs.sc='+' then
Begin
zs:= Aw2[0];
For zaehler :=1 TO 25 Do
AW2[zaehler-1]:= AW2[zaehler];
AW2[25]:= zs;
IF Zs.sc='+' then
Begin
zs:= Aw1[0];
For zaehler :=1 TO 25 Do
AW1[zaehler-1]:= AW1[zaehler];
AW1[25]:= zs;
end;
end;
For zaehler:=1 to 25 do
Begin
Memo2.Lines.Add(INTTOSTR(Zaehler)+' , '+aw1[zaehler].bs+' , '+aw1[zaehler].cb+' , '+aw1[zaehler].sc);
Memo3.Lines.Add(INTTOSTR(Zaehler)+' , '+aw2[zaehler].bs+' , '+aw2[zaehler].cb+' , '+aw2[zaehler].sc);
Memo4.Lines.Add(INTTOSTR(Zaehler)+' , '+aw3[zaehler].bs+' , '+aw3[zaehler].cb+' , '+aw3[zaehler].sc);
end;
For zaehler:=0 To 25 do
if EA[zaehler]=key Then POS_EA:=zaehler;
CB3:=AW3[pos_EA].cb;
FOR zaehler:=0 To 25 Do
If Aw3[zaehler].bs=CB3 Then pos_BS3:=zaehler;
CB2:= AW2[pos_Bs3].CB;
FOR zaehler:=0 To 25 Do
IF AW2[zaehler].Bs=cb2 Then Pos_Bs2:=zaehler;
Cb1:=AW1[Pos_BS2].Cb;
For zaehler:= 0 To 25 Do
If AW1[zaehler].Bs=Cb1 Then Pos_Bs1:=zaehler;
REF:=AREFLEKTOR[Pos_BS1].BS;
For zaehler:= 0 To 25 DO
IF ((AReflektor[zaehler].Bs=REF) And (zaehler>pos_BS1)) Then Pos_Ref:=zaehler;
bs1:=AW1[Pos_ref].bs;
For zaehler:= 0 To 25 Do
If AW1[zaehler].cb=bs1 Then Pos_Bs1:=zaehler;
bs2:=AW2[Pos_BS1].bs;
FOR zaehler:=0 To 25 Do
IF AW2[zaehler].cb=bs2 Then Pos_Bs2:=zaehler;
bs3:=AW3[Pos_BS2].bs;
FOR zaehler:=0 To 25 Do
If Aw3[zaehler].cb=bs3 Then pos_EA:=zaehler;
Edit10.text:=Edit10.Text+EA[pos_EA];
end;
end;
end.