comp.lang.ada
 help / color / mirror / Atom feed
From: Ole-Hjalmar Kristensen <ole-hjalmar.kristensen@substitute_employer_here.com>
Subject: Re: array of strings in a function
Date: 15 Oct 2003 16:19:12 +0200
Date: 2003-10-15T14:19:13+00:00	[thread overview]
Message-ID: <wvbr8ynmtwgv.fsf@sun.com> (raw)
In-Reply-To: bmjc7h$per$1@mercurio.cica.es

You could have an unconstrained array of Unbounded_String as the
parameter to your procedure, like this:

with Ada.Text_Io; use Ada.Text_Io;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

procedure U is
   type U_S_A is array(Integer range <>) of Unbounded_String;

   procedure Print(S : U_S_A) is
   begin
      for I in S'Range loop
         Put_Line(To_String(S(I)));
      end loop;
   end Print;

   X : U_S_A := (To_Unbounded_String("foo"), 
                 To_Unbounded_String("bar"));

begin
   Print(X);
end U;


>>>>> "AM�" == Antonio Mart�nez �lvarez <amartinez@atc.ugr.es> writes:

    AM�> Hello again. I'm the original poster.
    AM�> What  I want  to  do is  a procedure  (sorry,  not a  function) to  do
    AM�> something like this:


    AM�> my_AND("Entrada_1", "P2", "Output");

    AM�> and with this argument, this function have to write this:

    AM�> entity my_AND is port(
    AM�>    Entrada_1 	: in std_logic;
    AM�>    P2		: in std_logic;
    AM�>    Output	: out std:logic;
    AM�> );

    AM�> (This is VHDL code, very similar to Ada95).

    AM�> In  general, I don't  know the  number of  string arguments.  An these
    AM�> strings  can   be  any   length.  I  have   tried  to  do   this  with
    AM�> unbounded... but without any nice results ...

    AM�> Maybe I must use access variables, like in C. I know how to do this in
    AM�> C, but I'm really interested in do this job into Ada95. I'm writting a
    AM�> generator of VHDL (parsing, etc ...).


    AM�> I'll send  the answer when it  works. But till this  moment, and havig
    AM�> read your posts I haven't found the answer.


    AM�> Thank you so much.

    AM�> --
    AM�> Antonio Mart�nez


-- 
This page intentionally left blank



  parent reply	other threads:[~2003-10-15 14:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-14 20:54 array of strings in a function Antonio Martínez
2003-10-15  2:55 ` Robert I. Eachus
2003-10-15  3:29   ` Jeff C,
2003-10-15  3:08 ` Jeffrey Carter
2003-10-16  6:40   ` tmoran
2003-10-16  9:31     ` Craig Carey
2003-10-16 18:13       ` Craig Carey
2003-10-16 21:44         ` Marius Amado Alves
2003-10-17 19:48           ` Craig Carey
2003-10-18 10:05             ` Marius Amado Alves
2003-10-18 20:05               ` Craig Carey
2003-10-30  9:42                 ` Craig Carey
2003-10-16 17:58     ` Jeffrey Carter
2003-10-16 20:00       ` tmoran
2003-10-17  0:51         ` Jeffrey Carter
2003-10-15 11:49 ` Antonio Martínez Álvarez
2003-10-15 12:29   ` Preben Randhol
2003-10-15 14:19   ` Ole-Hjalmar Kristensen [this message]
2003-10-16 14:30   ` Robert I. Eachus
2003-10-16 17:53     ` Jeffrey Carter
2003-10-17  0:48       ` Robert I. Eachus
2003-10-17 18:41         ` Jeffrey Carter
replies disabled

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