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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,919fe9cf87c8237e X-Google-Attributes: gid103376,public From: Theodore Dennison Subject: Re: Heterogeneous file I/O Date: 1995/04/19 Message-ID: <3n347s$2h7@theopolis.orl.mmc.com>#1/1 X-Deja-AN: 101283228 references: <3mu5mb$ako@twonky.btv.ibm.com> content-type: text/plain; charset=iso-8859-1 organization: IPL InterNetNews site x-url: news:3mu5mb$ako@twonky.btv.ibm.com mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 1.1b2 (X11; I; SunOS 4.1.3_U1 sun4c) Date: 1995-04-19T00:00:00+00:00 List-Id: 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)