* String
@ 2003-05-31 8:55 And838N
2003-05-31 9:38 ` String Pascal Obry
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: And838N @ 2003-05-31 8:55 UTC (permalink / raw)
To: comp.lang.ada
Hello group!
I only have one question at this time and I will be out of the groups current discussion. At least for a while anyway.
Where is the type String defined? That is, which file, which package. I grep'd all the spec files that came with the GNAT compiler and there is no line that says "type String is ...". Is it in a lib somewhere? what filename should I look for?
Thanks a bunch!!
Andrew
__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397
Get AOL Instant Messenger 5.1 free of charge. Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2003-05-31 8:55 String And838N
@ 2003-05-31 9:38 ` Pascal Obry
2003-05-31 9:40 ` String Pascal Obry
2003-05-31 9:39 ` String Sergey Koshcheyev
2003-06-01 3:03 ` String Jeffrey Carter
2 siblings, 1 reply; 12+ messages in thread
From: Pascal Obry @ 2003-05-31 9:38 UTC (permalink / raw)
And838N@netscape.net writes:
> Where is the type String defined? That is, which file, which package. I
> grep'd all the spec files that came with the GNAT compiler and there is no
> line that says "type String is ...". Is it in a lib somewhere? what
> filename should I look for?
In package standard.adb, run gnatpsta to display it.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2003-05-31 8:55 String And838N
2003-05-31 9:38 ` String Pascal Obry
@ 2003-05-31 9:39 ` Sergey Koshcheyev
2003-06-01 3:03 ` String Jeffrey Carter
2 siblings, 0 replies; 12+ messages in thread
From: Sergey Koshcheyev @ 2003-05-31 9:39 UTC (permalink / raw)
<And838N@netscape.net> wrote in message
news:mailman.20.1054371405.386.comp.lang.ada@ada.eu.org...
> Hello group!
> I only have one question at this time and I will be out of the groups
current discussion. At least for a while anyway.
>
> Where is the type String defined? That is, which file, which package. I
grep'd all the spec files that came with the GNAT compiler and there is no
line that says "type String is ...". Is it in a lib somewhere? what
filename should I look for?
It's defined in the package Standard. This is a special package, so it isn't
contained in any file, but is sort of preloaded into GNAT. If you run
"gnatpsta" (short for "print Standard"), you can see its contents.
Sergey.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2003-05-31 9:38 ` String Pascal Obry
@ 2003-05-31 9:40 ` Pascal Obry
0 siblings, 0 replies; 12+ messages in thread
From: Pascal Obry @ 2003-05-31 9:40 UTC (permalink / raw)
Pascal Obry <p.obry@wanadoo.fr> writes:
> In package standard.adb, run gnatpsta to display it.
I meant standard.ads (this is a spec), but well this file does not really
exist on the file system anyway.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://perso.wanadoo.fr/pascal.obry
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2003-05-31 8:55 String And838N
2003-05-31 9:38 ` String Pascal Obry
2003-05-31 9:39 ` String Sergey Koshcheyev
@ 2003-06-01 3:03 ` Jeffrey Carter
2 siblings, 0 replies; 12+ messages in thread
From: Jeffrey Carter @ 2003-06-01 3:03 UTC (permalink / raw)
And838N@netscape.net wrote:
>
> Where is the type String defined? That is, which file, which
> package. I grep'd all the spec files that came with the GNAT
> compiler and there is no line that says "type String is ...". Is it
> in a lib somewhere? what filename should I look for?
String is defined in package Standard, and Standard is defined in the
ARM (ARM A.1).
Standard is a special package; everything you compile is considered to
be compiled as part of package Standard. This is why you can use the
types declared in Standard (Integer, Boolean, String, and so on) without
having to put "with Standard; use Standard;" on everything.
As such, Standard is unlikely to exist as a file for any compiler.
--
Jeff Carter
"When Roman engineers built a bridge, they had to stand under it
while the first legion marched across. If programmers today
worked under similar ground rules, they might well find
themselves getting much more interested in Ada!"
Robert Dewar
^ permalink raw reply [flat|nested] 12+ messages in thread
* String
@ 2005-08-31 16:52 TC
2005-08-31 17:38 ` String Frode Tennebø
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: TC @ 2005-08-31 16:52 UTC (permalink / raw)
there is a function that calculate string lenght?
how use that?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2005-08-31 16:52 String TC
@ 2005-08-31 17:38 ` Frode Tennebø
2005-08-31 18:00 ` String Pascal Obry
2005-08-31 18:11 ` String Marc A. Criley
2005-08-31 18:37 ` String Martin Krischik
2005-09-02 13:52 ` String Preben Randhol
2 siblings, 2 replies; 12+ messages in thread
From: Frode Tennebø @ 2005-08-31 17:38 UTC (permalink / raw)
On Wednesday 31 August 2005 18:52 TC wrote:
> there is a function that calculate string lenght?
'Length
> how use that?
Foo : constant String := "bar";
Len : Integer := Foo'Length; -- Len=3
-Frode
--
^ Frode Tenneb� | email: frode@tennebo.com | Frode@IRC ^
| with Standard.Disclaimer; use Standard.Disclaimer; |
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2005-08-31 17:38 ` String Frode Tennebø
@ 2005-08-31 18:00 ` Pascal Obry
2005-08-31 19:16 ` String Marin David Condic
2005-08-31 18:11 ` String Marc A. Criley
1 sibling, 1 reply; 12+ messages in thread
From: Pascal Obry @ 2005-08-31 18:00 UTC (permalink / raw)
To: Frode Tennebø
Frode Tenneb� a �crit :
> On Wednesday 31 August 2005 18:52 TC wrote:
>
>
>>there is a function that calculate string lenght?
>
> 'Length
Just to point out that it is called an attribute in Ada.
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] 12+ messages in thread
* Re: String
2005-08-31 17:38 ` String Frode Tennebø
2005-08-31 18:00 ` String Pascal Obry
@ 2005-08-31 18:11 ` Marc A. Criley
1 sibling, 0 replies; 12+ messages in thread
From: Marc A. Criley @ 2005-08-31 18:11 UTC (permalink / raw)
Frode Tenneb� wrote:
> On Wednesday 31 August 2005 18:52 TC wrote:
>
>>there is a function that calculate string lenght?
>
> 'Length
>
>>how use that?
>
> Foo : constant String := "bar";
> Len : Integer := Foo'Length; -- Len=3
This is of course correct so long as one is using fully filled-out
string values.
(Frode, I know you know all of the following, I'm just adding to it for
the benefit of TC :-)
Ada does not implicitly support the C approach of treating strings as an
array of characters terminating with a null (0). So you can't use Ada's
strings the same way you would C's strings.
If you are going to need variable length strings, the
Ada.Strings.Unbounded package will probably meet your needs.
If you really need C-style strings, such as when interfacing to a C
library, you can use the Interfaces.C.Strings package. It has a Strlen
function that can be applied to its definition of C strings.
(Both of these packages are part of the standard Ada distribution.)
Or you can write your own package to manage strings the way that you
want. But given the ready availability of the above string packages,
there's really little to be gained by doing so, unless you have some
special needs that you have to live with, e.g., hard real-time.
-- Marc A. Criley
-- McKae Technologies
-- www.mckae.com
-- DTraq - XPath In Ada - XML EZ Out
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2005-08-31 16:52 String TC
2005-08-31 17:38 ` String Frode Tennebø
@ 2005-08-31 18:37 ` Martin Krischik
2005-09-02 13:52 ` String Preben Randhol
2 siblings, 0 replies; 12+ messages in thread
From: Martin Krischik @ 2005-08-31 18:37 UTC (permalink / raw)
TC wrote:
> there is a function that calculate string lenght?
> how use that?
What kind of string?
Read: http://en.wikibooks.org/wiki/Ada_Programming/Strings.
Martin
--
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2005-08-31 18:00 ` String Pascal Obry
@ 2005-08-31 19:16 ` Marin David Condic
0 siblings, 0 replies; 12+ messages in thread
From: Marin David Condic @ 2005-08-31 19:16 UTC (permalink / raw)
Additional observation. The 'Length attribute only tells you about the
allocated space - not any sort of logical end of the string. Trailing
spaces, nulls, line terminators or any of the other mechanisms that
might tell you where the string stops (but not where the storage stops)
do NOT figure in to the value of the 'Length attribute.
This is often less than useful. I recommend that the reader look into
Ada.Strings.Unbounded (or Ada.Strings.Fixed) for strings that have
dynamic lengths.
MDC
Pascal Obry wrote:
>
>
> Just to point out that it is called an attribute in Ada.
>
> Pascal.
>
--
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jsf.mil/NSFrames.htm
Send Replies To: No.Mcondic.Spam@Del.Mindspring.Com
(Remove the "No.", ".Spam" and "Del." for the real address.)
"The Christian ideal has not been tried and found wanting. It has
been found difficult; and left untried."
-- G. K. Chesterton
======================================================================
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: String
2005-08-31 16:52 String TC
2005-08-31 17:38 ` String Frode Tennebø
2005-08-31 18:37 ` String Martin Krischik
@ 2005-09-02 13:52 ` Preben Randhol
2 siblings, 0 replies; 12+ messages in thread
From: Preben Randhol @ 2005-09-02 13:52 UTC (permalink / raw)
In article <AflRe.39695$HM1.1116430@twister1.libero.it>, TC wrote:
>there is a function that calculate string lenght?
>how use that?
Recommended: http://www.it.bton.ac.uk/staff/je/adacraft/
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2005-09-02 13:52 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-31 16:52 String TC
2005-08-31 17:38 ` String Frode Tennebø
2005-08-31 18:00 ` String Pascal Obry
2005-08-31 19:16 ` String Marin David Condic
2005-08-31 18:11 ` String Marc A. Criley
2005-08-31 18:37 ` String Martin Krischik
2005-09-02 13:52 ` String Preben Randhol
-- strict thread matches above, loose matches on Subject: below --
2003-05-31 8:55 String And838N
2003-05-31 9:38 ` String Pascal Obry
2003-05-31 9:40 ` String Pascal Obry
2003-05-31 9:39 ` String Sergey Koshcheyev
2003-06-01 3:03 ` String Jeffrey Carter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox