comp.lang.ada
 help / color / mirror / Atom feed
* Re: Heterogeneous file I/O
  1995-04-19  0:00 ` Heterogeneous file I/O Theodore Dennison
@ 1995-04-19  0:00   ` Robert Dewar
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Dewar @ 1995-04-19  0:00 UTC (permalink / raw)


It is not true that this problem is approached in the same way in Ada 83
and Ada 95. T.E.D.'s suggestion is reasonable for Ada 83, but in Ada 95,
the package Ada.Streams.Stream_IO, in conjunction with the stream
attributes will give you EXACTLY what you are looking for.





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

* Re: Heterogeneous file I/O
       [not found] <3mu5mb$ako@twonky.btv.ibm.com>
@ 1995-04-19  0:00 ` Theodore Dennison
  1995-04-19  0:00   ` Robert Dewar
  0 siblings, 1 reply; 2+ messages in thread
From: Theodore Dennison @ 1995-04-19  0:00 UTC (permalink / raw)


pontius@twonky.btv.ibm.com (Dale Pontius) wrote:
>
>My most urgent 'real code' need begins with a Spice reader that
>reads the output of circuit simulators. Spice format is a real
>son-of-a-gun, in that there is a simple ASCII header which defines
>the size data type, and labels for a two dimensional array of
>data which follows. (at some arbitrary offset into the file, of
>course.) With some local extensions, it's even possible for more
>ASCII and even binary data to follow the first batch of binary
>data. I will also be interested in writing the data format, but
>I need to read it, first.
>
>I've seen this handled (rather clumsily IMHO) in Pascal as a
>text file, stepping over EOL characters, etc, manually, stuffing
>the characters into a variant record and pulling a number out.
>I've done it in VS/Pascal using both variant record reads and
>a language extension called a SPACE variable. I've also used
>a straight binary read in Modula-2.

I will assume that you are using Ada 83, although for Ada 95 
the answer is probably the same.

You are probably going to have to do something similar to what
you did in Modula-2. This is the problem with interfacing a 
strongly-typed language to a database designed around a weakly-
typed language. You have to make your code "weakly-typed" until
you can get the data into the proper typed variables.

My suggestion is to make a single package that reads (and writes
if nessecary) this database, and puts everything into the proper
strongly-typed variables for the user. That way the weakly-typed
code and implementation dependancies (if any) are isolated from
the rest of the code.

T.E.D. (strucutred programming bigot)





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

end of thread, other threads:[~1995-04-19  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3mu5mb$ako@twonky.btv.ibm.com>
1995-04-19  0:00 ` Heterogeneous file I/O Theodore Dennison
1995-04-19  0:00   ` Robert Dewar

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