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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5355421156b0daa1,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-06 21:14:58 PST From: Stewart Newsgroups: comp.lang.ada Subject: Data_Error - Where in this code? Date: Mon, 06 Aug 2001 20:47:41 +0100 Message-ID: <1qstmt4hiaiutibe0jies4j0v04ll7mahs@4ax.com> X-Newsreader: Forte Agent 1.8/32.548 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: host62-6-86-158.dialup.lineone.co.uk X-Trace: 6 Aug 2001 20:46:59 +0100, host62-6-86-158.dialup.lineone.co.uk Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!dispose.news.demon.net!demon!mk-nntp-1.news.uk.worldonline.com!host62-6-86-158.dialup.lineone.co.uk Xref: archiver1.google.com comp.lang.ada:11450 Date: 2001-08-06T20:47:41+01:00 List-Id: Hi, Help' The two procedures work seperately on Linux and jointly on Win98. On linux I get the following data error using gnatmake. a-tiinio.adb:71 instantiated at latest.adb:9 > with Ada.Text_Io; > use Ada.Text_Io; >--with Sorts; > > procedure latest is > > > type Edge_Cost is range 1 .. 999; > package Cost_Io is new Integer_Io(Edge_Cost); > package Int_Io is new Integer_Io(Integer); > use Cost_Io, Int_Io; > > Max_Size, Int_Range : Natural; > Input : String (1 .. Max_Size); > Node_A : String (1 .. 6); > Node_B : String (1 .. 6); > Edge : Edge_Cost; > >-- this procedure reads the external network text file -- >-- for use by the other procedures. -- > procedure Load_Locations is > Location_File : File_Type; -- variable of type file. -- >-- Space : Character; Need for Win98 > > begin > > Put_Line("Opening Network.txt for reading");new_line; > Open(Location_File, Mode => In_File, Name => > "network.txt"); -- opening text file for reading. -- > > while not End_Of_File(Location_File) loop >-- stop at end of external text file. > > Get(Location_File,Node_A); --get the first name. >-- Get(Location_File,Space); --move pointer for next get in Win98. > Get(Location_File,Node_B); --get the second name. > Get(Location_File,Edge); >-- distance between node_a and node_b. > > end loop; > Close(Location_File); --close the network.txt file after input. > end Load_Locations; > > procedure Menu is -- required input command structure -- > > Add : String (1 .. 3) := "add"; > Remove : String (1 .. 6) := "remove"; > Link : String (1 .. 4) := "link"; > Cost : String (1 .. 4) := "cost"; > Quit : String (1 .. 4) := "quit"; > > begin > loop > begin -- Block for zero or negative cost in link -- > New_Line; Put("Please enter command: "); > Get_Line(Input, Max_Size); > > if Input(1..3) = Add and 10 = Max_Size then > Node_A := Input(5..10); New_Line; > > > elsif Input(1..6) = Remove and 13 = Max_Size then > Node_A := Input(8..13); New_Line; > > > elsif Input(1..4) = Link and 19 < Max_Size and Max_Size < 23 then >-- Node_A := Input(6..11); >-- Node_B := Input(13..18); > Int_Range := Max_Size - 19; New_Line; > > case Int_Range is -- Mapping ascii numerals to integers -- > when 1 => > Edge := Edge_Cost'Value(Input(19..Max_Size)); >-- Convert a single numeral -- > > when 2 => > Edge := Edge_Cost'Value(Input(20..21)); >-- Convert two numerals -- > > when 3 => > Edge := Edge_Cost'Value(Input(20..22)); >-- Convert three numerals -- > > when others => null; > end case; > > > elsif Input(1..4) = Cost and 11 = Max_Size then > Node_A := Input(6..11); > > > elsif Input(1..4) = Quit then > exit when Input(1..4) = Quit; new_line; > > else > Put ("Sorry, do not understand command."); New_Line; > Put ("Try again."); New_Line; > end if; > exception > when CONSTRAINT_ERROR => > Put("Error in Cost Value. Enter 1 to 999 only."); > end; -- End Block for zero or negative cost in link -- > end loop; > end Menu; > > > begin > > Load_Locations;new_line; > Put_Line(" Network.txt loaded successfully!!!");new_line; > menu; > Put(Edge); > end latest;