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.