comp.lang.ada
 help / color / mirror / Atom feed
From: anon@anon.org (anon)
Subject: Re: GNAT on WinXP: System.OS_Lib.Spawn raises Program_Error
Date: Mon, 04 May 2009 00:22:14 GMT
Date: 2009-05-04T00:22:14+00:00	[thread overview]
Message-ID: <WyqLl.192643$4m1.191533@bgtnsc05-news.ops.worldnet.att.net> (raw)
In-Reply-To: op.utcvihzv5afhvo@naropa

General comments should be taken with a gain of salt.  If you check, most of 
the GNAT packages and programs, you will see 100s of comments that are not 
valid or useful. Like, "Is this correct" or "need comment here". Then other 
places where comments could be useful there is only code. 

What is needed is another documentation file, called may be "GNAT extension 
to Ada 2005 specification", where the documentation would explain the extra 
packages with each package routine, and including the package limitations, 
if any.

The following example show that the "System.OS.LIB" could be set as a 
non-portable internal system file that generates warning and forces a 
programmer to use "GNAT.OS_LIB".  But in Ada 2005 version, Adacore 
decided not too. Which allows the programmer to choose to use 
"GNAT.OS_LIB" (Ada 95 specs) or "System.OS_LIB" (Ada 2005 specs). Just 
like some programmers choose to use "Text_IO" instead of "Ada.Text_IO", 
or "Unchecked_Conversion" instead of "Ada.Unchecked_Conversion".  


The following two/three files will show how to bypass the non-portable 
error. We all know that the attribute Image is an internal routine and if 
you include those files that contains those routine the compiler will 
generate a non-portable compiler warning. But if you rename those system 
files you can access those routines with no generated warnings after 
compiling the renaming file.

-- compiler order
gnat compile Img_Bool 
gnat make test1



--
-- Test1.ads
--
with Ada.Text_IO ;
use  Ada.Text_IO ;

--                  System file that defines Image routine for Boolean
--                  "Image" attribute and will give a non-portable 
--                  warning message, if use 
-- with System.Img_Bool ;
-- use  System.Img_Bool ;


--                  package that refined system file System.Img_Bool
--                  No warning or error message, if pre-compiled 
--                  version is used.
with Img_Bool ;
use  Img_Bool ;

procedure test1 is

  Success      : Boolean := True ;

begin -- test1 

  Put ( "Image Value of 'Success' := " ) ;
  Put ( Image_Boolean ( Success ) ) ;
  New_Line ( 2 ) ;

  Put_Line ( "Built-in Image Value of 'Success' := " 
             & Boolean'Image ( Success ) ) ;
end test1 ;



--
-- Img_Bool.ads : Rename internal GNAT package "System.Img_Bool"
--                Compiling this file like most packages that include 
--                GNAT internal system files will generate a warning. 
--                With or without the body file.
-- 
--                Using this file after it has been compiled will 
--                prevent the compiler from generating a non-portable
--                warning message and gives direct access to a GNAT
--                internal system file routine.
--
with System.Img_Bool ;

package Img_Bool renames System.Img_Bool ;


--
-- Img_Bool.adb : Not really needed.  Used just to match the
--                design of "GNAT.OS_LIB", under Ada 2005.
--
--                Do not use, if compiling pre GNAT 2005.
--
pragma No_Body ;


In <op.utcvihzv5afhvo@naropa>, "Ed Falis" <falis@verizon.net> writes:
>On Sat, 02 May 2009 19:20:05 -0400, anon <anon@anon.org> wrote:
>
>> Ed.
>>
>> If that was correct, then using "System.OS_LIB" would generated a
>> compiler WARNING, but no error or warning is given. So, that package
>> is usable as is.
>
>Ah, I see.  The unit does not get a warning because its interface is  
>"fixed" for use by the renaming.  Still, the current header comments  
>contain:
>
>--  Note: this package is in the System hierarchy so that it can be  
>directly
>--  be used by other predefined packages. User access to this package is  
>via
>--  a renaming of this package in GNAT.OS_Lib (file g-os_lib.ads).




  reply	other threads:[~2009-05-04  0:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-01 21:39 GNAT on WinXP: System.OS_Lib.Spawn raises Program_Error daniel.wengelin
2009-05-01 21:58 ` Jeffrey R. Carter
2009-05-02  4:16 ` anon
2009-05-02 15:59   ` Martin
2009-05-02 20:39     ` anon
2009-05-02 22:01       ` Ed Falis
2009-05-02 23:20         ` anon
2009-05-03 13:24           ` Ed Falis
2009-05-04  0:22             ` anon [this message]
2009-05-04  1:21               ` Ed Falis
2009-05-03 10:33         ` sjw
2009-05-03 13:27           ` Ed Falis
2009-05-04 13:32           ` Robert A Duff
2009-05-03  9:42       ` Martin
2009-05-05  0:04       ` Randy Brukardt
2009-05-05  2:43         ` anon
2009-05-05  8:06           ` Martin
2009-05-05 23:40             ` Randy Brukardt
2009-05-02 20:31   ` daniel.wengelin
2009-05-03  2:22     ` Hang
2009-05-02  6:28 ` Example of Spawn call anon
2009-05-02 15:50   ` Hang
2009-05-02 18:28     ` anon
2009-05-02 19:38     ` sjw
2009-05-02 19:47       ` sjw
2009-05-02 20:59         ` anon
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox