comp.lang.ada
 help / color / mirror / Atom feed
* How do I use the package characters?
@ 1996-10-07  0:00 Stephen M O'Shaughnessy
  1996-10-08  0:00 ` Robert Dewar
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Stephen M O'Shaughnessy @ 1996-10-07  0:00 UTC (permalink / raw)



I would like to use the functions in the package characters.
handling described in paragraph A.3.2 of the ARM.  How do I
instantiate/reference these functions?

Thanks

Steve O





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

* Re: How do I use the package characters?
  1996-10-07  0:00 How do I use the package characters? Stephen M O'Shaughnessy
  1996-10-08  0:00 ` Robert Dewar
@ 1996-10-08  0:00 ` Stephen Leake
  1996-10-08  0:00 ` Stephen M O'Shaughnessy
  1996-10-09  0:00 ` Michael Feldman
  3 siblings, 0 replies; 8+ messages in thread
From: Stephen Leake @ 1996-10-08  0:00 UTC (permalink / raw)



Stephen M O'Shaughnessy wrote:
> 
> I would like to use the functions in the package characters.
> handling described in paragraph A.3.2 of the ARM.  How do I
> instantiate/reference these functions?
> 
> Thanks
> 
> Steve O

You need the full name of the package:

with Ada.Characters.Handling;
procedure Foo is
    A : CHARACTER;
begin
    ... other code that sets A

    if Ada.Characters.Handling.Is_Control (A) then
     ...
    end if;
end Foo;

or you can use the `use' clause:

with Ada.Characters.Handling;
use Ada.Characters.Handling;
procedure Foo is
    A : CHARACTER;
begin
    ... other code that sets A

    if Is_Control (A) then
     ...
    end if;
end Foo;

Happy coding!
-- 
- Stephe




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

* Re: How do I use the package characters?
  1996-10-07  0:00 How do I use the package characters? Stephen M O'Shaughnessy
  1996-10-08  0:00 ` Robert Dewar
  1996-10-08  0:00 ` Stephen Leake
@ 1996-10-08  0:00 ` Stephen M O'Shaughnessy
  1996-10-09  0:00 ` Michael Feldman
  3 siblings, 0 replies; 8+ messages in thread
From: Stephen M O'Shaughnessy @ 1996-10-08  0:00 UTC (permalink / raw)



At 02:57 AM 10/8/96 GMT, you wrote:
>You just need a "with" clause for the package Ada.Character.Handling;
>this package is part of the standard predefined environment and
>must be supported by every implementation.
>
>-Ben
>
>
Ben,

    Thanks for your reply.  I tried this with Alsys on an HP workstation
and with APEX on a Sun.  They both choked on the periods.  I then tried
gnat on my PC.  It worked.  A little digging and I realized that the work-
stations where running Ada-83.  This is an Ada-95 package.

Thanks again.





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

* Re: How do I use the package characters?
  1996-10-07  0:00 How do I use the package characters? Stephen M O'Shaughnessy
@ 1996-10-08  0:00 ` Robert Dewar
  1996-10-08  0:00 ` Stephen Leake
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Robert Dewar @ 1996-10-08  0:00 UTC (permalink / raw)



Steve asked

"I would like to use the functions in the package characters.
handling described in paragraph A.3.2 of the ARM.  How do I
instantiate/reference these functions?"

There are no generics in sight, so there is no issue of instantiation
here. Just with the package and call the routines you need!





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

* Re: How do I use the package characters?
  1996-10-07  0:00 How do I use the package characters? Stephen M O'Shaughnessy
                   ` (2 preceding siblings ...)
  1996-10-08  0:00 ` Stephen M O'Shaughnessy
@ 1996-10-09  0:00 ` Michael Feldman
  3 siblings, 0 replies; 8+ messages in thread
From: Michael Feldman @ 1996-10-09  0:00 UTC (permalink / raw)



In article <DyxDvs.n54@most.fw.hac.com>,
Stephen M O'Shaughnessy <smosha@most.fw.hac.com> wrote:
>I would like to use the functions in the package characters.
>handling described in paragraph A.3.2 of the ARM.  How do I
>instantiate/reference these functions?

Like any other package -

with Ada.Characters.Handling

should do the trick. Did I miss something more subtle inthe question?

Mike Feldman








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

* Re: How do I use the package characters?
@ 1996-10-09  0:00 John Herro
  0 siblings, 0 replies; 8+ messages in thread
From: John Herro @ 1996-10-09  0:00 UTC (permalink / raw)



smosha@most.fw.hac.com (Stephen M O'Shaughnessy) writes:
> I would like to use the functions in the package characters.
> handling described in paragraph A.3.2 of the ARM.  How do I
> instantiate/reference these functions?
     Technically the package doesn't contain "functions," but I think I
know what you mean.  You want to reference the character definitions. 
Also, since the package isn't generic, you don't need to instantiate it,
but you do want to know how to reference it.  Two examples are below, but
here are the steps to follow:
     1. Begin your program with a WITH clause mentioning the package you
want to reference, probably Ada.Characters.Latin_1.
     2. Optionally supply a USE clause mentioning the same package.  If
you don't do this, you'll have to supply the package name and a dot
everywhere in your program that you reference characters from the package.
     For example, either of these two programs below will beep the
terminal:
-----
with Ada.Characters.Latin_1, Ada.Text_IO;
procedure Beep is
begin
   Ada.Text_IO.Put(Ada.Characters.Latin_1.BEL);
end Beep;
-----
with Ada.Characters.Latin_1, Ada.Text_IO;
use  Ada.Characters.Latin_1, Ada.Text_IO;
procedure Beep is
begin
   Put(BEL);
end Beep;
-----
     Note that you follow the same steps to reference ANY package.  In the
examples above, I referenced Ada.Text_IO the same way as
Ada.Characters.Latin_1.  I hope this helps.

- John Herro
Software Innovations Technology
An Ada Tutor program is available for download at:
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




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

* Re: How do I use the package characters?
@ 1996-10-09  0:00 John Herro
  1996-10-09  0:00 ` Robert Dewar
  0 siblings, 1 reply; 8+ messages in thread
From: John Herro @ 1996-10-09  0:00 UTC (permalink / raw)



smosha@most.fw.hac.com (Stephen M O'Shaughnessy) wrote:
> A little digging and I realized that the work-
> stations where running Ada-83.  This is an
> Ada-95 package.
     I'm posting this before my earlier post appears in CLA, because I saw
Stephen's reply to Ben.  Yes, the package you mentioned is an Ada 95
package, and Ada 83 packages don't have children, hence no periods.
    But you can reference package ASCII in Ada 83, and the steps are a
little different, because ASCII is inside Standard, and you never have to
WITH Standard; it's automatically WITHed in every compilation.  You can
optionally write a USE clause for ASCII, but it goes in the declarative
region of your program.  For example, here are two ways to beep the
terminal in Ada 83:
-----
with Text_IO;
procedure Beep is
begin
   Text_IO.Put(ASCII.BEL);
end Beep;
-----
with Text_IO; use Text_IO;
procedure Beep is
   use ASCII;
begin
   Put(BEL);
end Beep;

- John Herro
Software Innovations Technology
You can download an Ada Tutor program at:
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




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

* Re: How do I use the package characters?
  1996-10-09  0:00 John Herro
@ 1996-10-09  0:00 ` Robert Dewar
  0 siblings, 0 replies; 8+ messages in thread
From: Robert Dewar @ 1996-10-09  0:00 UTC (permalink / raw)



John Herro said

"     I'm posting this before my earlier post appears in CLA, because I saw
Stephen's reply to Ben.  Yes, the package you mentioned is an Ada 95
package, and Ada 83 packages don't have children, hence no periods.
    But you can reference package ASCII in Ada 83, and the steps are a
little different, because ASCII is inside Standard, and you never have to
WITH Standard; it's automatically WITHed in every compilation.  You can
optionally write a USE clause for ASCII, but it goes in the declarative
region of your program.  For example, here are two ways to beep the
terminal in Ada 83:"



That's confused. The original question was about Ada.Characters.Handling
which is not related to Standard.Ascii.

Standard.Ascii provides a subset of the functionality of
Ada.Characters.Latin_1, but none of the functoinality
of Ada.Characters.Handling.





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

end of thread, other threads:[~1996-10-09  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-07  0:00 How do I use the package characters? Stephen M O'Shaughnessy
1996-10-08  0:00 ` Robert Dewar
1996-10-08  0:00 ` Stephen Leake
1996-10-08  0:00 ` Stephen M O'Shaughnessy
1996-10-09  0:00 ` Michael Feldman
  -- strict thread matches above, loose matches on Subject: below --
1996-10-09  0:00 John Herro
1996-10-09  0:00 ` Robert Dewar
1996-10-09  0:00 John Herro

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