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,b847a4bf21e6829a,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-13 21:06:23 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!sn-xit-03!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: Andrew Newsgroups: comp.lang.ada Subject: windows ada compiler error Date: Mon, 13 Oct 2003 23:05:41 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 X-Accept-Language: en-us, en MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:800 Date: 2003-10-13T23:05:41-05:00 List-Id: I have run into a bit of a problem when I compile the below program on a red hat 9.0 linux computer it runs just fine.. but if I try to compile it on a windows xp computer I get the following error. ========================== Start Position is across is down is Exit is located at across is down is Found Exit raised ADA.IO_EXCEPTION.NAME_ERROR : s-fileio.adb:869 ====================== where is a randomly determined number but I always get the raised ADA.IO_EXCEPTION.NAME_ERROR : s-fileio.adb:869 error is there something special that I need to add to get it to compile on a windows xp computer? Something that has to be changed? just in case it matters ftp://cs.nyu.edu/pub/gnat that is where I got the windows compiler from and the windows xp and the linux computer is the same computer (it's a dual boot). === source code below === -- This program is to randomly create a maze, using a multi-dimensional array. -- Then it is to create a file called 'Map', and put that array into the file. with TEXT_IO, ADA.NUMERICS.DISCRETE_RANDOM; use TEXT_IO; procedure Mazecreate is spot: CHARACTER; spott:character:='T'; sitt: Boolean:=True; temprow: INTEGER:=5; -- point of origin for map down: Integer:=10; -- down map acros: INTEGER:=10; -- across map row: INTEGER:=1; rowstart:Integer; col: INTEGER:=1; colstart:INTEGER; FoundExit : INTEGER:=0; Move:CHARACTER; map_file:FILE_TYPE; type map_hold is array (INTEGER range <>, INTEGER range<>) of CHARACTER; map_array:map_hold(1..down,1..acros); direction: INTEGER; EntranceExit : INTEGER; package Number_IO is new INTEGER_IO(INTEGER); use Number_IO; package FLOAT1_IO is new FLOAT_IO(FLOAT); use FLOAT1_IO; -- this is used to randomly find the direction subtype Options is INTEGER range 1 .. 4; package Generate_Options is new Ada.Numerics.Discrete_Random(Options); use Generate_Options; A_Generator : Generate_Options.Generator; -- this is used to randomly find the beginning and ending of the maze subtype StartStop is INTEGER range 1 .. 10; package Generate_StartStop is new Ada.Numerics.Discrete_Random(StartStop); use Generate_StartStop; B_Generator : Generate_StartStop.Generator; Begin -- ************************* -- ** Section to load the ** -- ** multi-dimensional ** -- ** array with stars ** -- ************************* for i in 1..down loop for j in 1..acros loop map_array(i,j):='X'; end loop; end loop; -- ************************** -- ** Section to determine ** -- ** the Start and Exit ** -- ** of the maze. ** -- ************************** Put_Line("Start Position is "); Reset (B_Generator); EntranceExit:=Generate_StartStop.Random(B_Generator); Put_Line("across is" & Options'image(EntranceExit)); row:=EntranceExit; temprow:=EntranceExit; rowstart:=EntranceExit; Reset (B_Generator); EntranceExit:=Generate_StartStop.Random(B_Generator); Put_Line("down is" & Options'image(EntranceExit)); col:=EntranceExit; colstart:=EntranceExit; map_array(row,col):='S'; Put_Line("Exit is located at "); while temprow=row loop Reset (B_Generator); EntranceExit:=Generate_StartStop.Random(B_Generator); row:=EntranceExit; end loop; Put_Line("across is" & Options'image(EntranceExit)); Reset (B_Generator); EntranceExit:=Generate_StartStop.Random(B_Generator); Put_Line("down is" & Options'image(EntranceExit)); col:=EntranceExit; map_array(row,col):='E'; -- *********************** -- ** Section to create ** -- ** the entire maze ** -- *********************** row:=rowstart; col:=colstart; while FoundExit /= 1 loop Reset (A_Generator); direction:=Generate_Options.Random(A_Generator); --Put_Line("Selected direction is" & Options'image(direction)); if direction=1 and row>1 then --north row:=row-1; if map_array(row,col)='E' then Put_Line("Found Exit"); FoundExit:=1; else if map_array(row,col)/='S' then map_array(row,col):='P'; end if; end if; elsif direction=2 and col<10 then --east col:=col+1; if map_array(row,col)='E' then Put_Line("Found Exit"); FoundExit:=1; else if map_array(row,col)/='S' then map_array(row,col):='P'; end if; end if; elsif direction=3 and row<10 then --south row:=row+1; if map_array(row,col)='E' then Put_Line("Found Exit"); FoundExit:=1; else if map_array(row,col)/='S' then map_array(row,col):='P'; end if; end if; elsif direction=4 and col>1 then --west col:=col-1; if map_array(row,col)='E' then Put_Line("Found Exit"); FoundExit:=1; else if map_array(row,col)/='S' then map_array(row,col):='P'; end if; end if; end if; end loop; Open (map_file, out_FILE, "Map"); -- ********************* -- ** section to ** -- ** print the ** -- ** square of Stars ** -- ********************* if IS_OPEN(map_file) then for i in 1..down loop for j in 1..acros loop spot:=map_array(i,j); put (spot); end loop; --if j = 11 then NEW_LINE; --end if; end loop; Put(map_file, spott); CLOSE (map_file); else Put_Line("Map file didn't open .. Killing Program"); end if; -- ********************* -- ** section to move ** -- ** through the map ** -- ********************* --putting player at start row:=rowstart; col:=colstart; FoundExit := 0; while FoundExit /= 1 loop Put_Line("Which direction would you like to move?"); Put("You can move "); if row>1 then if map_array(row-1,col)='P' then put("N "); end if; end if; if row<10 then if map_array(row+1,col)='P' then put("S "); end if; end if; if col>1 then if map_array(row,col-1)='P' then put("W "); end if; end if; if col<10 then if map_array(row,col+1)='P' then put("E "); end if; end if; Put(">"); Get(Move); Put_Line(" moving"); put(Move); if Move='N' then row:=row-1; elsif Move='S' then row:=row+1; elsif Move='W' then col:=col-1; elsif Move='E' then col:=col+1; else Put(" "); end if; if map_array(row,col)='E' then FoundExit :=1; end if; end loop; end Mazecreate;