comp.lang.ada
 help / color / mirror / Atom feed
* Dynamic String
@ 2005-10-22 15:16 TC
  2005-10-22 17:10 ` jimmaureenrogers
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: TC @ 2005-10-22 15:16 UTC (permalink / raw)


I have some problem with Strings Unbounded.
How read a string from keyboard and put in S(Strings Unbounded)?

there is a manual or site on line that have an example of use the 
Strings Unbounded, Wiki is no very good



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

* Re: Dynamic String
  2005-10-22 15:16 Dynamic String TC
@ 2005-10-22 17:10 ` jimmaureenrogers
  2005-10-22 21:03 ` Jeffrey R. Carter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: jimmaureenrogers @ 2005-10-22 17:10 UTC (permalink / raw)


TC wrote:
> I have some problem with Strings Unbounded.
> How read a string from keyboard and put in S(Strings Unbounded)?
>
> there is a manual or site on line that have an example of use the
> Strings Unbounded, Wiki is no very good

You could try the Ada Language Reference Manual, which is available
in several formats at http://www.adaic.com/standards/ada95.html

Jim Rogers




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

* Re: Dynamic String
  2005-10-22 15:16 Dynamic String TC
  2005-10-22 17:10 ` jimmaureenrogers
@ 2005-10-22 21:03 ` Jeffrey R. Carter
  2005-10-22 21:51 ` Adrian Knoth
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Jeffrey R. Carter @ 2005-10-22 21:03 UTC (permalink / raw)


TC wrote:

> I have some problem with Strings Unbounded.
> How read a string from keyboard and put in S(Strings Unbounded)?

Typically, you read into a String and then use To_Unbounded_String.

-- 
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail
11



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

* Re: Dynamic String
  2005-10-22 15:16 Dynamic String TC
  2005-10-22 17:10 ` jimmaureenrogers
  2005-10-22 21:03 ` Jeffrey R. Carter
@ 2005-10-22 21:51 ` Adrian Knoth
  2005-10-26 14:04 ` Martin Krischik
  2005-10-31 10:15 ` Harald Korneliussen
  4 siblings, 0 replies; 18+ messages in thread
From: Adrian Knoth @ 2005-10-22 21:51 UTC (permalink / raw)


TC <tecomeco@inwind.it> wrote:

> I have some problem with Strings Unbounded.
> How read a string from keyboard and put in S(Strings Unbounded)?

Google for ustrings.adb and for ustrings.ads. Both times, use the
first hit. Afterwards you'll have Get_Line for unbounded strings.

The package also contains several useful functions for handling
ustrings.


-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Das Gras steht hoch, man kann kaum mehr blicken,
das ist die richtige Zeit zum --- Rasenmaehen.



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

* Re: Dynamic String
  2005-10-22 15:16 Dynamic String TC
                   ` (2 preceding siblings ...)
  2005-10-22 21:51 ` Adrian Knoth
@ 2005-10-26 14:04 ` Martin Krischik
  2005-10-31 10:15 ` Harald Korneliussen
  4 siblings, 0 replies; 18+ messages in thread
From: Martin Krischik @ 2005-10-26 14:04 UTC (permalink / raw)


Am 22.10.2005, 18:16 Uhr, schrieb TC <tecomeco@inwind.it>:

> I have some problem with Strings Unbounded.
> How read a string from keyboard and put in S(Strings Unbounded)?
>
> there is a manual or site on line that have an example of use the  
> Strings Unbounded, Wiki is no very good

AdaCL (adacl.sf.net) has a Get_Line function with might be usefull.

And of corse there is allways wikibooks:

http://en.wikibooks.org/wiki/Ada_Programming/Libraries/Ada.Strings.Unbounded
http://en.wikibooks.org/wiki/Ada_Programming/Libraries/Ada.Text_IO

Both pages would have answered your question

Martin



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

* Re: Dynamic String
  2005-10-22 15:16 Dynamic String TC
                   ` (3 preceding siblings ...)
  2005-10-26 14:04 ` Martin Krischik
@ 2005-10-31 10:15 ` Harald Korneliussen
  2005-10-31 12:05   ` Larry Kilgallen
  4 siblings, 1 reply; 18+ messages in thread
From: Harald Korneliussen @ 2005-10-31 10:15 UTC (permalink / raw)



TC wrote:
> I have some problem with Strings Unbounded.
> How read a string from keyboard and put in S(Strings Unbounded)?
>
> there is a manual or site on line that have an example of use the
> Strings Unbounded, Wiki is no very good

I believe GNAT has a utility function to do this. But when such a
function is not standardized, I wonder how some people can say (like
they do in wikibooks) that Ada is a rapid application development
language.




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

* Re: Dynamic String
  2005-10-31 10:15 ` Harald Korneliussen
@ 2005-10-31 12:05   ` Larry Kilgallen
  2005-11-01  8:02     ` Harald Korneliussen
  0 siblings, 1 reply; 18+ messages in thread
From: Larry Kilgallen @ 2005-10-31 12:05 UTC (permalink / raw)


In article <1130753721.639869.322210@g43g2000cwa.googlegroups.com>, "Harald Korneliussen" <vintermann@gmail.com> writes:
> 
> TC wrote:
>> I have some problem with Strings Unbounded.
>> How read a string from keyboard and put in S(Strings Unbounded)?
>>
>> there is a manual or site on line that have an example of use the
>> Strings Unbounded, Wiki is no very good
> 
> I believe GNAT has a utility function to do this. But when such a
> function is not standardized, I wonder how some people can say (like
> they do in wikibooks) that Ada is a rapid application development
> language.

Rapid application development makes sense for keyboard-style interfaces
where one is going to accept input from humans.  Pick a maximum size and
go with it.

If your goal is to parse XML strings of arbitrary size created by some
other computer, then a more careful approach than RAD is required.



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

* Re: Dynamic String
  2005-10-31 12:05   ` Larry Kilgallen
@ 2005-11-01  8:02     ` Harald Korneliussen
  2005-11-01 10:55       ` Pascal Obry
                         ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Harald Korneliussen @ 2005-11-01  8:02 UTC (permalink / raw)



Larry Kilgallen wrote:
> In article <1130753721.639869.322210@g43g2000cwa.googlegroups.com>, "Harald Korneliussen" <vintermann@gmail.com> writes:
> >
> > TC wrote:
> >> I have some problem with Strings Unbounded.
> >> How read a string from keyboard and put in S(Strings Unbounded)?
> >>
> >> there is a manual or site on line that have an example of use the
> >> Strings Unbounded, Wiki is no very good
> >
> > I believe GNAT has a utility function to do this. But when such a
> > function is not standardized, I wonder how some people can say (like
> > they do in wikibooks) that Ada is a rapid application development
> > language.
>
> Rapid application development makes sense for keyboard-style interfaces
> where one is going to accept input from humans.  Pick a maximum size and
> go with it.
>
> If your goal is to parse XML strings of arbitrary size created by some
> other computer, then a more careful approach than RAD is required.

Fred Brooks claimed that programming is inherently hard, and suggested
that the best way to write software quickly would be to not write it at
all, but use pre-written modules. RAD languages like Java, C# and
Visual Basic (gross!) attempt to leverage that idea. It helps with
development speed, however it is usually a good idea security-wise as
well. For instance, I'd trust the XML parsers of java quite a lot more
than some random equivalient written in C. If I really needed it, and
could afford it, and was personally accountable anyway (so blaming my
suppliers would not be an option), I would perhaps hire you to write a
custom XML-parser in Ada, Larry ;-)

btw, I think Ada is great, but it's not for rapid application
development. I wish it could be that too, but without even a container
library... I understand that containers have been left out of Ada0Y
again?




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

* Re: Dynamic String
  2005-11-01  8:02     ` Harald Korneliussen
@ 2005-11-01 10:55       ` Pascal Obry
  2005-11-01 17:20       ` Martin Dowie
                         ` (3 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Pascal Obry @ 2005-11-01 10:55 UTC (permalink / raw)
  To: Harald Korneliussen

Harald,

> btw, I think Ada is great, but it's not for rapid application
> development. I wish it could be that too, but without even a container
> library... I understand that containers have been left out of Ada0Y
> again?

No, Ada.Containers *is* part of the new standard.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Dynamic String
  2005-11-01  8:02     ` Harald Korneliussen
  2005-11-01 10:55       ` Pascal Obry
@ 2005-11-01 17:20       ` Martin Dowie
  2005-11-01 20:09       ` Matthew Heaney
                         ` (2 subsequent siblings)
  4 siblings, 0 replies; 18+ messages in thread
From: Martin Dowie @ 2005-11-01 17:20 UTC (permalink / raw)


Harald Korneliussen wrote:
> I understand that containers have been left out of Ada0Y
> again?

Where on earth did you hear that?!?! Someone tell Randy!!...




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

* Re: Dynamic String
  2005-11-01  8:02     ` Harald Korneliussen
  2005-11-01 10:55       ` Pascal Obry
  2005-11-01 17:20       ` Martin Dowie
@ 2005-11-01 20:09       ` Matthew Heaney
  2005-11-02  0:34         ` not null access procedure (was: Re: Dynamic String) Anonymous Coward
  2005-11-01 22:31       ` Dynamic String Björn Persson
  2005-11-02  0:18       ` Stephen Leake
  4 siblings, 1 reply; 18+ messages in thread
From: Matthew Heaney @ 2005-11-01 20:09 UTC (permalink / raw)


Harald Korneliussen wrote:
> I understand that containers have been left out of Ada0Y again?

Your understanding is incorrect.

Ada 2005 will indeed include a standard container library.  You can
find the latest AI-302 draft (released just a couple of days ago) here:

http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-20302.TXT?rev=1.23

In fact, GCC 4 already comes bundled with the library; see the units in
the Ada.Containers.* subsystem.

-Matt




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

* Re: Dynamic String
  2005-11-01  8:02     ` Harald Korneliussen
                         ` (2 preceding siblings ...)
  2005-11-01 20:09       ` Matthew Heaney
@ 2005-11-01 22:31       ` Björn Persson
  2005-11-02 10:56         ` Stefan Bellon
  2005-11-02  0:18       ` Stephen Leake
  4 siblings, 1 reply; 18+ messages in thread
From: Björn Persson @ 2005-11-01 22:31 UTC (permalink / raw)


Harald Korneliussen wrote:
> If I really needed it, and
> could afford it, and was personally accountable anyway (so blaming my
> suppliers would not be an option), I would perhaps hire you to write a
> custom XML-parser in Ada, Larry ;-)

You mean, assuming XML/Ada didn't meet your needs?

-- 
Bj�rn Persson                              PGP key A88682FD
                    omb jor ers @sv ge.
                    r o.b n.p son eri nu



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

* Re: Dynamic String
  2005-11-01  8:02     ` Harald Korneliussen
                         ` (3 preceding siblings ...)
  2005-11-01 22:31       ` Dynamic String Björn Persson
@ 2005-11-02  0:18       ` Stephen Leake
  2005-11-02  7:31         ` Harald Korneliussen
  4 siblings, 1 reply; 18+ messages in thread
From: Stephen Leake @ 2005-11-02  0:18 UTC (permalink / raw)


"Harald Korneliussen" <vintermann@gmail.com> writes:

> btw, I think Ada is great, but it's not for rapid application
> development. 

For the applications I write, Ada is the fastest (in development time)
language I know (and I have used APL, Visual Basic, C, C++, Emacs
Lisp, Java). 

The speed is partly due to the library of useful stuff I've built up
over the years (including my own container library); Ada makes it much
easier to write such a library.

-- 
-- Stephe



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

* not null access procedure (was: Re: Dynamic String)
  2005-11-01 20:09       ` Matthew Heaney
@ 2005-11-02  0:34         ` Anonymous Coward
  2005-11-02  1:07           ` Robert A Duff
  0 siblings, 1 reply; 18+ messages in thread
From: Anonymous Coward @ 2005-11-02  0:34 UTC (permalink / raw)


In article <1130875772.717413.45520@g14g2000cwa.googlegroups.com>, Matthew Heaney wrote:
> 
> Ada 2005 will indeed include a standard container library.  You can
> find the latest AI-302 draft (released just a couple of days ago)
> here:
> 
> http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-20302.TXT?rev=1.23

I noticed some syntax in the package specification of that link above,
which is unfamiliar to me:

   procedure Update_Element
     (Container : in out Vector;
      Index     : in     Index_Type;
      Process   : not null access procedure (Element : in out Element_Type));

What is meant by this "not null"?  Is this available in ADA95, or new
to ADA05?

I also had a more general question with access procedures.  Does an
access procedure still have scope in the package it is defined in?
Will it be able to access other subprograms and variables that it
normally would, when it is executed by the container package,
considering the container package has no visibility into its user?



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

* Re: not null access procedure (was: Re: Dynamic String)
  2005-11-02  0:34         ` not null access procedure (was: Re: Dynamic String) Anonymous Coward
@ 2005-11-02  1:07           ` Robert A Duff
  2005-11-02  8:10             ` not null access procedure Dmitry A. Kazakov
  0 siblings, 1 reply; 18+ messages in thread
From: Robert A Duff @ 2005-11-02  1:07 UTC (permalink / raw)


Anonymous Coward <bogus_addy@bogus_domain.net> writes:

> In article <1130875772.717413.45520@g14g2000cwa.googlegroups.com>, Matthew Heaney wrote:
> > 
> > Ada 2005 will indeed include a standard container library.  You can
> > find the latest AI-302 draft (released just a couple of days ago)
> > here:
> > 
> > http://www.ada-auth.org/cgi-bin/cvsweb.cgi/AIs/AI-20302.TXT?rev=1.23
> 
> I noticed some syntax in the package specification of that link above,
> which is unfamiliar to me:
> 
>    procedure Update_Element
>      (Container : in out Vector;
>       Index     : in     Index_Type;
>       Process   : not null access procedure (Element : in out Element_Type));
> 
> What is meant by this "not null"?  Is this available in ADA95, or new
> to ADA05?

New to Ada 2005.  "Not null" means there's a run-time check that the
pointer is not null.  It's pretty annoying that in order to pass a
procedure as a parameter, you have to say the noise words "not null access",
but that was considered necessary for compatibility.

> I also had a more general question with access procedures.  Does an
> access procedure still have scope in the package it is defined in?
> Will it be able to access other subprograms and variables that it
> normally would, when it is executed by the container package,
> considering the container package has no visibility into its user?

Yes.  This is the "downward closure" feature that we've all been waiting
for.

- Bob




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

* Re: Dynamic String
  2005-11-02  0:18       ` Stephen Leake
@ 2005-11-02  7:31         ` Harald Korneliussen
  0 siblings, 0 replies; 18+ messages in thread
From: Harald Korneliussen @ 2005-11-02  7:31 UTC (permalink / raw)


Stephen Leake wrote:
> "Harald Korneliussen" <vintermann@gmail.com> writes:
>
> > btw, I think Ada is great, but it's not for rapid application
> > development.
>
> For the applications I write, Ada is the fastest (in development time)
> language I know (and I have used APL, Visual Basic, C, C++, Emacs
> Lisp, Java).
>
> The speed is partly due to the library of useful stuff I've built up
> over the years (including my own container library); Ada makes it much
> easier to write such a library.
>
> --
> -- Stephe

There are certainly applications where I would expect this. I was
writing my own container and algorithm libraries myself, but mostly to
learn. I realize that rolling on my own might hurt cooperative efforts,
so I will certainly explore the new Ada.Containers library, which I am
very pleased to hear was included :-)




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

* Re: not null access procedure
  2005-11-02  1:07           ` Robert A Duff
@ 2005-11-02  8:10             ` Dmitry A. Kazakov
  0 siblings, 0 replies; 18+ messages in thread
From: Dmitry A. Kazakov @ 2005-11-02  8:10 UTC (permalink / raw)


On 01 Nov 2005 20:07:47 -0500, Robert A Duff wrote:

> Anonymous Coward <bogus_addy@bogus_domain.net> writes:
> 
>> I noticed some syntax in the package specification of that link above,
>> which is unfamiliar to me:
>> 
>>    procedure Update_Element
>>      (Container : in out Vector;
>>       Index     : in     Index_Type;
>>       Process   : not null access procedure (Element : in out Element_Type));
>> 
>> What is meant by this "not null"?  Is this available in ADA95, or new
>> to ADA05?
> 
> New to Ada 2005.  "Not null" means there's a run-time check that the
> pointer is not null.  It's pretty annoying that in order to pass a
> procedure as a parameter, you have to say the noise words "not null access",
> but that was considered necessary for compatibility.

Were subroutine types considered?

procedure Update_Element
     (Container : in out Vector;
       Index     : in Index_Type;
      Process   : in procedure (Element : in out Element_Type));

type Call_Back is procedure (...);

etc

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

* Re: Dynamic String
  2005-11-01 22:31       ` Dynamic String Björn Persson
@ 2005-11-02 10:56         ` Stefan Bellon
  0 siblings, 0 replies; 18+ messages in thread
From: Stefan Bellon @ 2005-11-02 10:56 UTC (permalink / raw)
  To: Björn Persson

Björn Persson wrote:

> Harald Korneliussen wrote:
> > If I really needed it, and
> > could afford it, and was personally accountable anyway (so blaming
> > my suppliers would not be an option), I would perhaps hire you to
> > write a custom XML-parser in Ada, Larry ;-)
> 
> You mean, assuming XML/Ada didn't meet your needs?

And further assuming that XML4Ada95/Xerces (http://xml4ada95.sf.net/)
does not meet your needs.

-- 
Dipl.-Inf. Stefan Bellon
Bauhaus Software Technologies | TTI GmbH TGZ Softwareanalysen c/o ISTE
Tel.: +49 711 78 16 221       | Universitätsstraße 38
Fax.: +49 711 78 16 380       | 70569 Stuttgart



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

end of thread, other threads:[~2005-11-02 10:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-22 15:16 Dynamic String TC
2005-10-22 17:10 ` jimmaureenrogers
2005-10-22 21:03 ` Jeffrey R. Carter
2005-10-22 21:51 ` Adrian Knoth
2005-10-26 14:04 ` Martin Krischik
2005-10-31 10:15 ` Harald Korneliussen
2005-10-31 12:05   ` Larry Kilgallen
2005-11-01  8:02     ` Harald Korneliussen
2005-11-01 10:55       ` Pascal Obry
2005-11-01 17:20       ` Martin Dowie
2005-11-01 20:09       ` Matthew Heaney
2005-11-02  0:34         ` not null access procedure (was: Re: Dynamic String) Anonymous Coward
2005-11-02  1:07           ` Robert A Duff
2005-11-02  8:10             ` not null access procedure Dmitry A. Kazakov
2005-11-01 22:31       ` Dynamic String Björn Persson
2005-11-02 10:56         ` Stefan Bellon
2005-11-02  0:18       ` Stephen Leake
2005-11-02  7:31         ` Harald Korneliussen

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