comp.lang.ada
 help / color / mirror / Atom feed
From: kassover@minerva.crd.ge.com (David Kassover)
Subject: Re: Design/Development questions
Date: 8 Jun 90 18:33:28 GMT	[thread overview]
Message-ID: <8369@crdgw1.crd.ge.com> (raw)
In-Reply-To: 67999@cc.utah.edu

In article <67999@cc.utah.edu> RCAPENER@cc.utah.edu writes:

...
>Now that I have added my two bits on the above, all of which is totally
>and purely subjective, I have a question to ask people on the net.
>In VAX-Ada, the GET and the GET_LINE procedures have the very
>disconcerting behavior that when you get a string, you must enter
>the EXACT number of characters the string is declared for.  Is this
>behavior part of the LRM?  Does anyone in NetLand have the equivalent
>of C's fgets for strings in Ada?  Any input (pun intended) on solving
>this problem will be appreciated.

We use, generally, the following interface to get_line, from
package text_io, as shown in
sys$sysroot:[syslib.adalib]text_io_.adc


           procedure GET_LINE(FILE : in FILE_TYPE; ITEM : out STRING;
			      LAST : out NATURAL);

LAST tells me how long the string actually is, We use this to load
the string into the composite data structures we have built to
actually manipulate strings

Item must, of course, be long enough to handle any anticipated
string, otherwise, presumably, we'd get a CONSTRAINT_ERROR or
some such at run time.  (Which means something has corrupted our
files, or we really do need to make our strings bigger)

This is probably not iron_clad.  We have not yet had to deal with
string lengths outside the range 0..256

I'm not near the manuals, so I can't tell if DEC considers this
standard or an allowable interpretation.

As far as dealing with C strings, we have routines that convert a
C string to our Vstring, and vice versa.  These routines are
applied to the appropriate strings at the point where we call the
C routines.
--
David Kassover             "Proper technique helps protect you against
kassover@ra.crd.ge.com	    sharp weapons and dull judges."
kassover@crd.ge.com			F. Collins

  reply	other threads:[~1990-06-08 18:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-06-05 18:56 Design/Development questions Dennis Gibbs
1990-06-06 17:12 ` James THIELE
1990-06-07 10:34 ` RCAPENER
1990-06-08 18:33   ` David Kassover [this message]
1990-06-08 20:22   ` Brian Hanafee
1990-06-09  8:26 ` Kim Shearer
replies disabled

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