From: Austin Obyrne <austin.obyrne@hotmail.com>
Subject: Re: Help with an errant 'IF' statement please.
Date: Sun, 30 Nov 2014 04:58:34 -0800 (PST)
Date: 2014-11-30T04:58:34-08:00 [thread overview]
Message-ID: <fd50fe7f-d977-4f4a-92fa-4d1ac8ab675e@googlegroups.com> (raw)
In-Reply-To: <m5eudj$mn7$1@dont-email.me>
On Sunday, November 30, 2014 11:18:33 AM UTC, Simon Clubley wrote:
> On 2014-11-30, Austin Obyrne <austin.obyrne@hotmail.com> wrote:
> > On Saturday, November 29, 2014 4:53:48 PM UTC, Dennis Lee Bieber wrote:
> >> On Sat, 29 Nov 2014 07:05:09 -0800 (PST), Austin Obyrne
> >> <austin.obyrne@hotmail.com> declaimed the following:
> >>
> >>
> >> >LOOP
> >> > EXIT WHEN NextChar = Sentinel;
> >> >
> >> What is the definition of "NextChar", since I don't see it changing
> >> inside this loop...
> >>
> >
> > This is the relevant source code at the very start of the program in
> > question,
> >
> > Total := Total+1;
> > Ada.Text_IO.Get(Item => NextChar);
> > Image(Total):= NextChar;
> >
> > 'NextChar' is the variable name given to each character being read
> > in from the keyboard.
> >
>
> [snip]
>
> > Sorry for taking so long in coming back and thanks for your help - Austin.
>
> Do what I told you to do and write a stripped down standalone test program
> around the fragment you posted.
>
> You will then see what Dennis (and myself) are telling you.
>
> I could tell you what the problem is, but I think it's more important for
> you to understand how to find this yourself.
>
> Simon.
>
> --
> Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
> Microsoft: Bringing you 1980s technology to a 21st century world
Hi Simon - herewith the program sourcecode of the procedure in question - I would like to know for future - my main preoccupation is with problem solving but the elegance and efficacy of Ada are important to me also - bear with me -this a an experimental program by me and is not a fine example of programming in Ada. I would appreciate your help - I am going flat out with research work in cryptoland - Ada is a tool to me at the moment until I get more time to 'smell the flowers' of the language proper.
Time_Ex_1;
Count := Phi; --initialising change-of-origin Count
Resets := 0;
Total := 0;
NextChar := ' '; --initialising to pre-empt error message
Line_Number:= 0;
LOOP
EXIT WHEN NextChar = Sentinel;
Count:= Count+1; -- change-of-origin count reinitialising
IF Count REM (Span + Phi +1) = 0 THEN -- Reset signal
Count:= 1;
Resets:= Resets +1;
END IF;
Total := Total +1;
Ada.Text_IO.Get(Item => NextChar);
Counter := Counter +1;
Total := Total +1;
Image(Counter):= NextChar;
-- R := Character 'POS(NextChar);
-- PlainTextNum(R) := PlainTextNum(R) +1;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item => " ");
Ada.Text_IO.Put(Item => NextChar);
Ada.Text_IO.Put(Item => " - Current PlainText for encryption");
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item => " ");
Ada.Text_IO.Put(Item => " Phi ");
Ada.Text_IO.Put(Item => " - ");
Ada.Integer_Text_IO.Put(Item => Phi, Width => 2);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item => " ");
Ada.Text_IO.Put(Item => " Count ");
Ada.Text_IO.Put(Item => " - ");
Ada.Integer_Text_IO.Put(Item => Count, Width => 2);
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item => " ");
Ada.Text_IO.Put(Item => " Total ");
Ada.Text_IO.Put(Item => " - ");
Ada.Integer_Text_IO.Put(Item => Total, Width => 2);
Ada.Text_IO.New_line;
Ada.Integer_Text_IO.Put(Item => Character'Pos(Nextchar), Width => 11);
Ada.Text_IO.Put
(Item => " - Value in ASCII of current plaintext");
Ada.Text_IO.New_line;
Compute_Normal;
Ada.Integer_Text_IO.Put(Item => Normal(1), Width => 4);
Ada.Integer_Text_IO.Put(Item => Normal(2), Width => 8);
Ada.Integer_Text_IO.Put(Item => Normal(3), Width => 8);
Ada.Text_IO.Put(Item => " - Normal vector - fixed in this cipher");
Ada.Text_IO.New_Line;
Ada.Integer_Text_IO.Put(Item => S_1, Width => 4);
Ada.Integer_Text_IO.Put(Item => S_2, Width => 8);
Ada.Integer_Text_IO.Put(Item => S_3, Width => 8);
Ada.Text_IO.Put
(Item => " - VeeZero - fixed in this cipher");
Ada.Text_IO.New_Line;
Ada.Integer_Text_IO.Put(Item => T_1, Width => 4);
Ada.Integer_Text_IO.Put(Item => T_2, Width => 8);
Ada.Integer_Text_IO.Put(Item => T_3, Width => 8);
Ada.Text_IO.Put
(Item => " - VeeOne - fixed in this cipher.");
Ada.Text_IO.New_Line;
Compute_Normal;
Ada.Integer_Text_IO.Put(Item => Normal(1), Width => 4);
Ada.Integer_Text_IO.Put(Item => Normal(2), Width => 8);
Ada.Integer_Text_IO.Put(Item => Normal(3), Width => 8);
Ada.Text_IO.Put(Item => " - Normal vector - fixed in this cipher");
Ada.Text_IO.New_Line;
n :=(Character'Pos(NextChar));
Ada.Integer_Text_IO.Put(Item => n, Width =>12);
Ada.Text_IO.Put
(Item => " - face value 'n' of current plaintext in ASCII");
Ada.Text_IO.New_Line;
n := Number(Character'Pos(NextChar)); -- renumbered by Alice
Ada.Integer_Text_IO.Put(Item => n, Width =>12);
Ada.Text_IO.Put
(Item => " - rendered value of 'n'in the encryption alphabet");
Compute_Position_Vector(Number => n);
Ada.Text_IO.New_Line;
Ada.Integer_Text_IO.Put(Item => Pn(1), Width => 8);
Ada.Integer_Text_IO.Put(Item => Pn(2), Width => 8);
Ada.Integer_Text_IO.Put(Item => Pn(3), Width => 8);
Ada.Text_IO.Put(Item => " - Position vector ('Pn') for this 'n'. ");
Ada.Text_IO.New_Line;
Ada.Integer_Text_IO.Put(Item => Hash_2(Count), Width => 8);
Ada.Integer_Text_IO.Put(Item => Hash_11(Count), Width => 8);
Ada.Integer_Text_IO.Put(Item => Hash_12(Count), Width => 8);
Ada.Text_IO.Put
(Item => " - Change-of-origin vector to be given to this Pn item");
Ada.Text_IO.New_Line;
FOR I IN 1 .. 3 LOOP
W(I):= Compose_CipherText_Items( Numin => I);
Ada.Integer_Text_IO.Put(File => OutData, Item => W(I));
END LOOP;
Ada.Integer_Text_IO.Put( Item => W(1), Width => 9);
Ada.Integer_Text_IO.Put( Item => W(2), Width => 8);
Ada.Integer_Text_IO.Put( Item => W(3), Width => 8);
Ada.Text_IO.Put(Item =>" - Ciphertext for this item of plaintext");
Q:= W(1)REM 1000000;
I_Num(Q) := I_Num(Q)+1;
-- Q:= W(2)REM 1000000;
-- I_Num(Q) := I_Num(Q)+1;
-- Q:= W(3)REM 1000000;
-- I_Num(Q) := I_Num(Q)+1;
-- Ada.Text_IO.New_Line;
-- Ada.Integer_Text_IO.Put(Item => AllTold, Width =>4);
-- Ada.Integer_Text_IO.Put(Item => Total, Width =>8);
-- Ada.Integer_Text_IO.Put(Item => InToto, Width =>8);
-- Ada.Text_IO.Put(Item => " - Compares 'AllTold','Total','InToto' integrators'");
Line_Number:= Line_Number+1;
Ada.Text_IO.New_Line(1);
Ada.Text_IO.Put(Item => " - Character number ");
Ada.Integer_Text_IO.Put(Item => Line_Number, Width => 1);
Ada.Text_IO.New_Line(1);
IF Line_Number REM 12 = 0 THEN
Ada.Text_IO.New_Line(1);
Ada.Text_IO.Put(Item => " ");
Ada.Text_IO.Put(Item => " # - press any key/return to continue > ");
Ada.Text_IO.Get(Item => View);
END IF;
-- IF W(2)REM 1000000 = 514681 THEN --repeated number in ciphertext say
-- Ada.Integer_Text_IO.Put (item => W(2) , Width => 20);
-- Ada.Text_IO.Get(Item => View);
-- END IF;
Ada.Text_IO.New_Line;
Ada.Text_IO.Put(Item => " ---------------------------------------------------------------------------");
END LOOP;
Ada.Text_IO.Close(File => Outdata);
Time_Ex_2; -- time at end
next prev parent reply other threads:[~2014-11-30 12:58 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-29 13:28 Help with an errant 'IF' statement please Austin Obyrne
2014-11-29 14:03 ` gautier_niouzes
2014-11-29 15:05 ` Austin Obyrne
2014-11-29 15:45 ` Simon Clubley
2014-11-29 16:10 ` Austin Obyrne
2014-11-29 16:54 ` Dennis Lee Bieber
2014-11-30 2:16 ` Austin Obyrne
2014-11-30 11:18 ` Simon Clubley
2014-11-30 12:58 ` Austin Obyrne [this message]
2014-11-30 13:01 ` Austin Obyrne
2014-12-01 22:20 ` Stephen Leake
2014-12-02 2:57 ` Austin Obyrne
2014-11-30 13:46 ` Simon Clubley
2014-11-30 14:49 ` Austin Obyrne
2014-11-30 15:43 ` Simon Clubley
2014-11-30 19:23 ` Shark8
2014-11-30 11:56 ` Denis McMahon
2014-11-30 12:19 ` Austin Obyrne
2014-11-29 14:08 ` Simon Clubley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox