From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.67.14.232 with SMTP id fj8mr53578706pad.16.1417352314274; Sun, 30 Nov 2014 04:58:34 -0800 (PST) X-Received: by 10.140.84.21 with SMTP id k21mr11605qgd.6.1417352314218; Sun, 30 Nov 2014 04:58:34 -0800 (PST) Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!news.glorb.com!h15no2696334igd.0!news-out.google.com!m4ni576qag.1!nntp.google.com!w8no3603563qac.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 30 Nov 2014 04:58:34 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=86.176.91.16; posting-account=pmkN8QoAAAAtIhXRUfydb0SCISnwaeyg NNTP-Posting-Host: 86.176.91.16 References: <0a70a8a3-45fc-440b-999b-f9cfbc6ac7f9@googlegroups.com> <8ecc1fb7-615c-4b7e-83e3-866a830a59a5@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Help with an errant 'IF' statement please. From: Austin Obyrne Injection-Date: Sun, 30 Nov 2014 12:58:34 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.giganews.com comp.lang.ada:191102 Date: 2014-11-30T04:58:34-08:00 List-Id: On Sunday, November 30, 2014 11:18:33 AM UTC, Simon Clubley wrote: > On 2014-11-30, Austin Obyrne 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 > >> declaimed the following: > >>=20 > >>=20 > >> >LOOP > >> > EXIT WHEN NextChar =3D Sentinel; > >> > > >> What is the definition of "NextChar", since I don't see it changing > >> inside this loop... > >> =20 > > > > This is the relevant source code at the very start of the program in > > question, > > > > Total :=3D Total+1; > > Ada.Text_IO.Get(Item =3D> NextChar); > > Image(Total):=3D NextChar; > > =20 > > 'NextChar' is the variable name given to each character being read > > in from the keyboard. > > >=20 > [snip] >=20 > > Sorry for taking so long in coming back and thanks for your help - Aust= in. >=20 > Do what I told you to do and write a stripped down standalone test progra= m > around the fragment you posted. >=20 > You will then see what Dennis (and myself) are telling you. >=20 > I could tell you what the problem is, but I think it's more important for > you to understand how to find this yourself. >=20 > Simon. >=20 > --=20 > 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 solv= ing but the elegance and efficacy of Ada are important to me also - bear wi= th me -this a an experimental program by me and is not a fine example of pr= ogramming in Ada. I would appreciate your help - I am going flat out with r= esearch 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 :=3D Phi; --initialising change-of-origin Count Resets :=3D 0; Total :=3D 0; NextChar :=3D ' '; --initialising to pre-empt error message Line_Number:=3D 0; LOOP EXIT WHEN NextChar =3D Sentinel; Count:=3D Count+1; -- change-of-origin count reinitialising IF Count REM (Span + Phi +1) =3D 0 THEN -- Reset signal Count:=3D 1; Resets:=3D Resets +1; END IF; Total :=3D Total +1; Ada.Text_IO.Get(Item =3D> NextChar); Counter :=3D Counter +1; Total :=3D Total +1; Image(Counter):=3D NextChar; -- R :=3D Character 'POS(NextChar); -- PlainTextNum(R) :=3D PlainTextNum(R) +1; Ada.Text_IO.New_Line; Ada.Text_IO.Put(Item =3D> " "); Ada.Text_IO.Put(Item =3D> NextChar); Ada.Text_IO.Put(Item =3D> " - Current PlainText for encryp= tion"); Ada.Text_IO.New_Line; Ada.Text_IO.Put(Item =3D> " "); Ada.Text_IO.Put(Item =3D> " Phi "); Ada.Text_IO.Put(Item =3D> " - "); Ada.Integer_Text_IO.Put(Item =3D> Phi, Width =3D> 2); Ada.Text_IO.New_Line; Ada.Text_IO.Put(Item =3D> " "); Ada.Text_IO.Put(Item =3D> " Count "); Ada.Text_IO.Put(Item =3D> " - "); Ada.Integer_Text_IO.Put(Item =3D> Count, Width =3D> 2); Ada.Text_IO.New_Line; Ada.Text_IO.Put(Item =3D> " "); Ada.Text_IO.Put(Item =3D> " Total "); Ada.Text_IO.Put(Item =3D> " - "); Ada.Integer_Text_IO.Put(Item =3D> Total, Width =3D> 2); Ada.Text_IO.New_line; Ada.Integer_Text_IO.Put(Item =3D> Character'Pos(Nextchar), Width =3D> 11)= ; Ada.Text_IO.Put (Item =3D> " - Value in ASCII of current plaintext"); Ada.Text_IO.New_line; Compute_Normal; Ada.Integer_Text_IO.Put(Item =3D> Normal(1), Width =3D> 4); Ada.Integer_Text_IO.Put(Item =3D> Normal(2), Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> Normal(3), Width =3D> 8); Ada.Text_IO.Put(Item =3D> " - Normal vector - fixed in this cipher"= ); Ada.Text_IO.New_Line; Ada.Integer_Text_IO.Put(Item =3D> S_1, Width =3D> 4); Ada.Integer_Text_IO.Put(Item =3D> S_2, Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> S_3, Width =3D> 8); Ada.Text_IO.Put (Item =3D> " - VeeZero - fixed in this cipher"); Ada.Text_IO.New_Line; Ada.Integer_Text_IO.Put(Item =3D> T_1, Width =3D> 4); Ada.Integer_Text_IO.Put(Item =3D> T_2, Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> T_3, Width =3D> 8); Ada.Text_IO.Put (Item =3D> " - VeeOne - fixed in this cipher."); Ada.Text_IO.New_Line; Compute_Normal; Ada.Integer_Text_IO.Put(Item =3D> Normal(1), Width =3D> 4); Ada.Integer_Text_IO.Put(Item =3D> Normal(2), Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> Normal(3), Width =3D> 8); Ada.Text_IO.Put(Item =3D> " - Normal vector - fixed in this cipher"= ); Ada.Text_IO.New_Line; n :=3D(Character'Pos(NextChar)); Ada.Integer_Text_IO.Put(Item =3D> n, Width =3D>12); Ada.Text_IO.Put (Item =3D> " - face value 'n' of current plaintext in ASCII"= ); Ada.Text_IO.New_Line; n :=3D Number(Character'Pos(NextChar)); -- renumbered by Alice Ada.Integer_Text_IO.Put(Item =3D> n, Width =3D>12); Ada.Text_IO.Put (Item =3D> " - rendered value of 'n'in the encryption alphab= et"); Compute_Position_Vector(Number =3D> n); Ada.Text_IO.New_Line; Ada.Integer_Text_IO.Put(Item =3D> Pn(1), Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> Pn(2), Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> Pn(3), Width =3D> 8); Ada.Text_IO.Put(Item =3D> " - Position vector ('Pn') for this 'n'. "); Ada.Text_IO.New_Line; Ada.Integer_Text_IO.Put(Item =3D> Hash_2(Count), Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> Hash_11(Count), Width =3D> 8); Ada.Integer_Text_IO.Put(Item =3D> Hash_12(Count), Width =3D> 8); Ada.Text_IO.Put (Item =3D> " - Change-of-origin vector to be given to this Pn item"); Ada.Text_IO.New_Line; FOR I IN 1 .. 3 LOOP W(I):=3D Compose_CipherText_Items( Numin =3D> I); Ada.Integer_Text_IO.Put(File =3D> OutData, Item =3D> W(I)); END LOOP; Ada.Integer_Text_IO.Put( Item =3D> W(1), Width =3D> 9); Ada.Integer_Text_IO.Put( Item =3D> W(2), Width =3D> 8); Ada.Integer_Text_IO.Put( Item =3D> W(3), Width =3D> 8); Ada.Text_IO.Put(Item =3D>" - Ciphertext for this item of plaintext"); Q:=3D W(1)REM 1000000; I_Num(Q) :=3D I_Num(Q)+1; -- Q:=3D W(2)REM 1000000; -- I_Num(Q) :=3D I_Num(Q)+1; -- Q:=3D W(3)REM 1000000; -- I_Num(Q) :=3D I_Num(Q)+1; -- Ada.Text_IO.New_Line; -- Ada.Integer_Text_IO.Put(Item =3D> AllTold, Width =3D>4); -- Ada.Integer_Text_IO.Put(Item =3D> Total, Width =3D>8); -- Ada.Integer_Text_IO.Put(Item =3D> InToto, Width =3D>8); -- Ada.Text_IO.Put(Item =3D> " - Compares 'AllTold','Total','InToto' = integrators'"); Line_Number:=3D Line_Number+1; Ada.Text_IO.New_Line(1); Ada.Text_IO.Put(Item =3D> " - Character number "= ); Ada.Integer_Text_IO.Put(Item =3D> Line_Number, Width =3D> 1); Ada.Text_IO.New_Line(1); IF Line_Number REM 12 =3D 0 THEN Ada.Text_IO.New_Line(1); Ada.Text_IO.Put(Item =3D> " "); Ada.Text_IO.Put(Item =3D> " # - press any key/return to continue > ")= ; Ada.Text_IO.Get(Item =3D> View); END IF; -- IF W(2)REM 1000000 =3D 514681 THEN --repeated number in ciphertext sa= y -- Ada.Integer_Text_IO.Put (item =3D> W(2) , Width =3D> 20); -- Ada.Text_IO.Get(Item =3D> View); -- END IF; Ada.Text_IO.New_Line; Ada.Text_IO.Put(Item =3D> " --------------------------------------------= -------------------------------"); END LOOP; Ada.Text_IO.Close(File =3D> Outdata); Time_Ex_2; -- time at end