comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic" <dont.bother.mcondic.auntie.spam@[acm.org>
Subject: Re: functions, packages & characters
Date: Fri, 22 Feb 2002 08:41:01 -0500
Date: 2002-02-22T13:41:01+00:00	[thread overview]
Message-ID: <a55hpd$4cp$1@nh.pace.co.uk> (raw)
In-Reply-To: u7b1g6cooeo49@corp.supernews.com

Wait a minute...... I seem to recall a nifty example of how you could return
an arbitrary length string from a function that used Get/Get_Line (?) and
recursed in the event that the line was longer than the buffer. It might be
in a code example somewhere like on AdaPower? If you can do that, why not a
similar subprogram for Unbounded_String? It would be even easier and not
require recursion since you could just keep reading some arbitrary sized
buffer in a loop and appending it to an Unbounded_String that is returned to
the caller.

Speed may be an issue, but with a reasonably large buffer, I don't think it
would be unacceptably slow. Why would you have to read it one character at a
time? (I will admit that I have not tried anything like this, so there may
be some tiny devil in the details that I'm missing...)

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/


"Randy Brukardt" <randy@rrsoftware.com> wrote in message
news:u7b1g6cooeo49@corp.supernews.com...
>
> Text_IO doesn't have direct support for unbounded strings (because
> having it would drag the unbounded string library into almost every
> program, whether you used it or not). Possibly, there ought to be a
> Get_Line for Unbounded strings in a child package of Text_IO (but this
> does not exist in Ada 95). This would be quite a bit slower than the
> regular Get_Line for long lines, but it could be made acceptably fast
> for the common case of short lines. It is possible to write such a
> Get_Line out of the primitives in Text_IO, but the result would be
> unacceptably slow (because you would have to read a character at a
> time - you can't use Get_Line because you can't tell between the case of
> a line which exactly fills the buffer and a line which is too long and
> does not -- but in the former case, the line terminator is skipped).
>






  parent reply	other threads:[~2002-02-22 13:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-21  8:59 functions, packages & characters Christoph Grein
2002-02-21 18:07 ` Unversed Angel
2002-02-21 18:28   ` Hyman Rosen
2002-02-21 23:44     ` Randy Brukardt
2002-02-22  0:37       ` Matthew Heaney
2002-02-22  1:12         ` Matthew Heaney
2002-02-22  2:57         ` Randy Brukardt
2002-02-22 13:54           ` Marin David Condic
2002-02-23  1:10             ` Matthew Heaney
2002-02-25 15:47               ` Marin David Condic
2002-02-26 15:58                 ` Matthew Heaney
2002-02-25 19:37             ` Randy Brukardt
2002-02-25 20:49               ` Marin David Condic
2002-02-26  3:30               ` David Starner
2002-02-26 15:44                 ` Hyman Rosen
2002-02-26 21:43                   ` David Starner
2002-02-27  6:32                     ` Hyman Rosen
2002-02-28  3:55                       ` Chad R. Meiners
2002-02-28 18:44                         ` Hyman Rosen
2002-03-02  3:25                           ` Chad R. Meiners
2002-03-03  8:22                             ` Hyman Rosen
2002-03-03 17:50                               ` Chad R. Meiners
2002-03-01  2:08                         ` David Starner
2002-03-05 14:36                       ` Marin David Condic
2002-02-26  7:42               ` tmoran
2002-02-22 15:34           ` Matthew Heaney
2002-02-22  2:47       ` Jeffrey Carter
2002-02-22 13:41       ` Marin David Condic [this message]
2002-02-23  1:08         ` Matthew Heaney
2002-02-23  2:03         ` Jeffrey Carter
2002-02-22 16:27       ` Hyman Rosen
2002-02-21 23:49     ` unversedangel
2002-02-21 22:48   ` unversedangel
2002-02-21 23:14     ` Hyman Rosen
2002-02-22 14:11     ` Marin David Condic
  -- strict thread matches above, loose matches on Subject: below --
2002-02-21  0:16 Unversed Angel
2002-02-21  0:37 ` tmoran
2002-02-21  1:13   ` Unversed Angel
2002-02-21  2:53     ` tmoran
2002-02-21  8:25       ` Unversed Angel
2002-02-21 13:47         ` Marin David Condic
2002-02-22  0:22         ` tmoran
replies disabled

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