From: Stewart <s_aitken@lineone.net>
Subject: Data_Error - Where in this code?
Date: Mon, 06 Aug 2001 20:47:41 +0100
Date: 2001-08-06T20:47:41+01:00 [thread overview]
Message-ID: <1qstmt4hiaiutibe0jies4j0v04ll7mahs@4ax.com> (raw)
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;
next reply other threads:[~2001-08-06 19:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-08-06 19:47 Stewart [this message]
2001-08-07 13:53 ` Data_Error - Where in this code? Mark Johnson
2001-08-08 9:31 ` Stewart
2001-08-08 13:08 ` Mark Johnson
2001-08-09 9:34 ` Stewart
2001-08-09 13:27 ` Mark Johnson
2001-08-09 17:55 ` Stewart
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox