comp.lang.ada
 help / color / mirror / Atom feed
* Reading from a .cfg file
@ 2001-06-18 17:24 J J. Rauch
  2001-06-18 19:45 ` Marin David Condic
  2001-08-27  9:19 ` Noam Kloos
  0 siblings, 2 replies; 5+ messages in thread
From: J J. Rauch @ 2001-06-18 17:24 UTC (permalink / raw)


I am brand new to Ada and i need to write a package to read and parse
data from a .cfg file.  This package has to be compatible with both
Ada 83 and Ada 95 as it will be used with programs that are written
with both versions.
Any input would be very helpful because I am just starting off with
Ada now.  I will be writing the package using Apex Ada 95 if that
matters.
Thank you,
J. R.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading from a .cfg file
  2001-06-18 17:24 Reading from a .cfg file J J. Rauch
@ 2001-06-18 19:45 ` Marin David Condic
  2001-08-27  9:19 ` Noam Kloos
  1 sibling, 0 replies; 5+ messages in thread
From: Marin David Condic @ 2001-06-18 19:45 UTC (permalink / raw)


Not being familiar with what a .cfg file is puts me at a disadvantage, but
here's a starting point: From Ada95, you have Stream files which are
basically files of 8-bit bytes which then you have to interpret yourself.
However, this is not backwards compatible to Ada83. (Are you *sure* you want
to support that?) From Ada83, you can kind of get there by using an
instantiation of Sequential_IO with your own data type to represent bytes.
(Upward compatible to Ada95) You then read the file one byte at a time &
translate it as needed. The Ada83 answer may have problems depending on the
OS and underlying file system. It was not intended for reading files as raw
bytes - but you can usually get there from here.

If you provide a bit more detail about what you want to read & how, we might
be able to give you a better answer.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"J J. Rauch" <chemmie@aol.com> wrote in message
news:bfc234ad.0106180924.3320ef28@posting.google.com...
> I am brand new to Ada and i need to write a package to read and parse
> data from a .cfg file.  This package has to be compatible with both
> Ada 83 and Ada 95 as it will be used with programs that are written
> with both versions.
> Any input would be very helpful because I am just starting off with
> Ada now.  I will be writing the package using Apex Ada 95 if that
> matters.
> Thank you,
> J. R.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading from a .cfg file
  2001-06-18 17:24 Reading from a .cfg file J J. Rauch
  2001-06-18 19:45 ` Marin David Condic
@ 2001-08-27  9:19 ` Noam Kloos
  2001-08-30 20:07   ` Greg Bek
  1 sibling, 1 reply; 5+ messages in thread
From: Noam Kloos @ 2001-08-27  9:19 UTC (permalink / raw)


On 18 Jun 2001 10:24:10 -0700, chemmie@aol.com (J J. Rauch) wrote:

>I am brand new to Ada and i need to write a package to read and parse
>data from a .cfg file.  This package has to be compatible with both
>Ada 83 and Ada 95 as it will be used with programs that are written
>with both versions.
>Any input would be very helpful because I am just starting off with
>Ada now.  I will be writing the package using Apex Ada 95 if that
>matters.
>Thank you,
>J. R.

You should have a look at  my program using a config file.
http://www.noam.nl/download/ada95/deadline.adb
it needs the packages
http://www.noam.nl/download/ada95/ustrings.adb
http://www.noam.nl/download/ada95/ustrings.ads

The deadline program runs on linux and windows but in EZ2load
go32_Close gives a page fault *sometimes* when the keyword delay is
included.
Writing any other source with the delay keyword runs okay with EZ2LOAD
latest version.

Greetings,
Noam Kloos.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading from a .cfg file
  2001-08-27  9:19 ` Noam Kloos
@ 2001-08-30 20:07   ` Greg Bek
  2001-09-02 15:36     ` Robert Dewar
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Bek @ 2001-08-30 20:07 UTC (permalink / raw)


> On 18 Jun 2001 10:24:10 -0700, chemmie@aol.com (J J. Rauch) wrote:
> 
> >I am brand new to Ada and i need to write a package to read and parse
> >data from a .cfg file.  This package has to be compatible with both
> >Ada 83 and Ada 95 as it will be used with programs that are written
> >with both versions.
> >Any input would be very helpful because I am just starting off with
> >Ada now.  I will be writing the package using Apex Ada 95 if that
> >matters.
> >Thank you,
> >J. R.
> 

Seeing you state that you are using Apex Ada 95, I'm guessing
I know what a .cfg file is.

Within Apex configuration files (those with the .cfg) extension
are used to contain a list of views or subsystems.  The format
of the file is simply a text file with a full pathname on
each line.  If the path name doesn't resolve to a valid file/location
then it is ignored by Apex -- this allows you to put comments in the
file.

These files are most commonly used to store the imports for a view
or a subsystem.  But can also be used as input to various Apex commands,
such us Show_Usage (here the .cfg would contain a list of views/subsystems
to be searched).

So to read the .cfg file all you need is Text_Io.  The most likely
subprogram in Text_Io to use will be Get_Line.

You may want to build an abstraction that provides iterator capabilities.

Greg Bek



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Reading from a .cfg file
  2001-08-30 20:07   ` Greg Bek
@ 2001-09-02 15:36     ` Robert Dewar
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Dewar @ 2001-09-02 15:36 UTC (permalink / raw)


> > On 18 Jun 2001 10:24:10 -0700, chemmie@aol.com (J J. Rauch) wrote:
> > 
> > >I am brand new to Ada and i need to write a package to read and parse
> > >data from a .cfg file.  using Apex Ada 95


This is highly vendor dependent (the .cfg file is an artifact of the
Apex implementation), so I would suggest
contacting your vendor for assistance, since this is the
kind of problem that your vendor should be able to help with. If there
are specific Ada programming questions regarding techniques necessary
to write this program, then
it is quite appropriate to ask here, but you will have to
describe the problem in a precise stand alone form for most
people to understand the question you are asking.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-09-02 15:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-18 17:24 Reading from a .cfg file J J. Rauch
2001-06-18 19:45 ` Marin David Condic
2001-08-27  9:19 ` Noam Kloos
2001-08-30 20:07   ` Greg Bek
2001-09-02 15:36     ` Robert Dewar

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