comp.lang.ada
 help / color / mirror / Atom feed
* trying to work with generic
@ 2003-07-09  4:01 Cephus�
  2003-07-09  4:33 ` Steve
  0 siblings, 1 reply; 2+ messages in thread
From: Cephus� @ 2003-07-09  4:01 UTC (permalink / raw)


Hello guys, I am getting an error here trying to compile a specification for
an array_generic package I am making for class. Can you guys tell me why it
is not allowing me to use (<>) in the indextype declaration:

WITH Ada.TEXT_IO;

GENERIC


PACKAGE array_generic IS


--declare the private type

TYPE elementType IS PRIVATE;


--declare the index type, the generic array

TYPE indexType IS (<>);

TYPE listType IS ARRAY(indexType RANGE <>) OF elementType;


PROCEDURE getData(list : OUT listType; infile : IN OUT

Ada.TEXT_IO.File_Type);


PROCEDURE Display(list : IN listType);


FUNCTION Find(list : listType; item : elementType) RETURN Boolean;


end array_generic;





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

* Re: trying to work with generic
  2003-07-09  4:01 trying to work with generic Cephus�
@ 2003-07-09  4:33 ` Steve
  0 siblings, 0 replies; 2+ messages in thread
From: Steve @ 2003-07-09  4:33 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

Move the line that reads:

PACKAGE Array_Generic IS

 to the line immediately following

 TYPE indexType IS (<>);

 and you'll have it.  The parameters of your generic (or whatever they're
officially called) need to come between the generic keyword and your package
declaration (or procedure or function definition for generic procedures and
functions).

Steve
(The Duck)


"Cephus�" <beau@hiwaay.net> wrote in message
news:vgn4spk446g005@corp.supernews.com...
> Hello guys, I am getting an error here trying to compile a specification
for
> an array_generic package I am making for class. Can you guys tell me why
it
> is not allowing me to use (<>) in the indextype declaration:
>
> WITH Ada.TEXT_IO;
>
> GENERIC
>
>
> PACKAGE array_generic IS
>
>
> --declare the private type
>
> TYPE elementType IS PRIVATE;
>
>
> --declare the index type, the generic array
>
> TYPE indexType IS (<>);
>
> TYPE listType IS ARRAY(indexType RANGE <>) OF elementType;
>
>
> PROCEDURE getData(list : OUT listType; infile : IN OUT
>
> Ada.TEXT_IO.File_Type);
>
>
> PROCEDURE Display(list : IN listType);
>
>
> FUNCTION Find(list : listType; item : elementType) RETURN Boolean;
>
>
> end array_generic;
>
>





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

end of thread, other threads:[~2003-07-09  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09  4:01 trying to work with generic Cephus�
2003-07-09  4:33 ` Steve

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