comp.lang.ada
 help / color / mirror / Atom feed
* Creating a dynamic string variable in GPS project
@ 2015-10-05 18:16 Rego, P.
  2015-10-05 19:02 ` Shark8
  0 siblings, 1 reply; 3+ messages in thread
From: Rego, P. @ 2015-10-05 18:16 UTC (permalink / raw)


I need to create a dynamic variable Common in GPS project, depending on another variable. Something like 

1)
project Test is

   type Mode_Type is ("TA", "AT");
   Mode : Mode_Type := ("MODE", "AT");

   Common := ("");

   case Mode is
      when "AT" =>
          Common := "asd-dsdsd";
      when "TA" => 
          Common := "blabla-asd-dsdsd"; -- String of other size 
   end case;
   
   (...)

end Test;

But it returns me
> wrong expression kind for variable "common"

2)
Also, if I define Common like
   case Mode is
      Common := ("");
      when "AT" =>
          Common := "asd-dsdsd";
      when "TA" => 
          Common := "blabla-asd-dsdsd"; -- String of other size 
   end case;

But when I run this, it returns 
> wrong expression kind for variable "common"

3)
And if I do not define Common like
   Common := ("");
it return me 
> a variable cannot be declared for the first time here

Thus... what should I have missed?

Thanks in advance.


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

* Re: Creating a dynamic string variable in GPS project
  2015-10-05 18:16 Creating a dynamic string variable in GPS project Rego, P.
@ 2015-10-05 19:02 ` Shark8
  2015-10-06 16:15   ` Rego, P.
  0 siblings, 1 reply; 3+ messages in thread
From: Shark8 @ 2015-10-05 19:02 UTC (permalink / raw)


On Monday, October 5, 2015 at 12:16:58 PM UTC-6, Rego, P. wrote:
> I need to create a dynamic variable Common in GPS project, depending on another variable. Something like 
> 
> 1)
> project Test is
> 
>    type Mode_Type is ("TA", "AT");
>    Mode : Mode_Type := ("MODE", "AT");
> 
>    Common := ("");
> 
>    case Mode is
>       when "AT" =>
>           Common := "asd-dsdsd";
>       when "TA" => 
>           Common := "blabla-asd-dsdsd"; -- String of other size 
>    end case;
>    
>    (...)
> 
> end Test;
> 
> But it returns me
> > wrong expression kind for variable "common"
> 
> 2)
> Also, if I define Common like
>    case Mode is
>       Common := ("");
>       when "AT" =>
>           Common := "asd-dsdsd";
>       when "TA" => 
>           Common := "blabla-asd-dsdsd"; -- String of other size 
>    end case;
> 
> But when I run this, it returns 
> > wrong expression kind for variable "common"
> 
> 3)
> And if I do not define Common like
>    Common := ("");
> it return me 
> > a variable cannot be declared for the first time here
> 
> Thus... what should I have missed?
> 
> Thanks in advance.

I think that the Common := ("") means a list containing an empty-string.
Try removing the parentheses for assigning to your string variable. 


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

* Re: Creating a dynamic string variable in GPS project
  2015-10-05 19:02 ` Shark8
@ 2015-10-06 16:15   ` Rego, P.
  0 siblings, 0 replies; 3+ messages in thread
From: Rego, P. @ 2015-10-06 16:15 UTC (permalink / raw)


You are right. Tnks!

On Monday, October 5, 2015 at 4:03:01 PM UTC-3, Shark8 wrote:
> On Monday, October 5, 2015 at 12:16:58 PM UTC-6, Rego, P. wrote:
> > I need to create a dynamic variable Common in GPS project, depending on another variable. Something like 
> > 
> > 1)
> > project Test is
> > 
> >    type Mode_Type is ("TA", "AT");
> >    Mode : Mode_Type := ("MODE", "AT");
> > 
> >    Common := ("");
> > 
> >    case Mode is
> >       when "AT" =>
> >           Common := "asd-dsdsd";
> >       when "TA" => 
> >           Common := "blabla-asd-dsdsd"; -- String of other size 
> >    end case;
> >    
> >    (...)
> > 
> > end Test;
> > 
> > But it returns me
> > > wrong expression kind for variable "common"
> > 
> > 2)
> > Also, if I define Common like
> >    case Mode is
> >       Common := ("");
> >       when "AT" =>
> >           Common := "asd-dsdsd";
> >       when "TA" => 
> >           Common := "blabla-asd-dsdsd"; -- String of other size 
> >    end case;
> > 
> > But when I run this, it returns 
> > > wrong expression kind for variable "common"
> > 
> > 3)
> > And if I do not define Common like
> >    Common := ("");
> > it return me 
> > > a variable cannot be declared for the first time here
> > 
> > Thus... what should I have missed?
> > 
> > Thanks in advance.
> 
> I think that the Common := ("") means a list containing an empty-string.
> Try removing the parentheses for assigning to your string variable.

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

end of thread, other threads:[~2015-10-06 16:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 18:16 Creating a dynamic string variable in GPS project Rego, P.
2015-10-05 19:02 ` Shark8
2015-10-06 16:15   ` Rego, P.

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