Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Using a Anytype type as function parameter

Using a Anytype type as function parameter 29 Jan 2009 10:23 #7530

  • Carlos C
  • Carlos C's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Dear TTCN-3 user,

I got a compilation error because of anytype variable usage.
The problem seems simple but I am not able not find a solution out.

Module my_functions.ttcn
{
import my_types.ttcn
...
function f_get_attr_value(out anytype attr_value)
{
...
return boolean
}
}

Module test_cases.ttcn
{
import my_types.ttcn
import my_functions.ttcn
testcase TP__000_B(in charstring v_cs_path) runs on
mtc_TesterExecutable system tsi_testAdapter
{
var anytype v_attr_value;
f_get_attr_value(v_attr_value);
}
}

Compilation Error: the type of "v_attr_value" is not correct.

I know that internally anytype becomes an Union type defined for all the
visible types within the module. As far as I know, in our project the type
visibility is the same for testcase.ttcn and my_functions.ttcn. Why I know
that? Because all user-type defintions are in my_types.ttcn and this is
imported by both modules.

I really appreciate your contributions.

Thanks in advance,
Carlos Cardenas
AT4 wireless
The administrator has disabled public write access.

Using a Anytype type as function parameter 29 Jan 2009 10:37 #7531

Dear Carlos,

I cannot see any type definition in your module test_cases. Thus the "implicit union" is empty, what is not a legal type (i.e. what should be the type of your variable?). Pls. note, that anytype is module-local. If you want to import the anytype type of a module into another module, you have to declare an alias in the imported-from module and use the alias type name in other modules.

BR, Gyorgy

>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
> Sent: 2009-január-29 11:24
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Using a Anytype type as function parameter
>
> Dear TTCN-3 user,
>
> I got a compilation error because of anytype variable usage.
> The problem seems simple but I am not able not find a solution out.
>
> Module my_functions.ttcn
> {
> import my_types.ttcn
> ...
> function f_get_attr_value(out anytype attr_value)
> {
> ...
> return boolean
> }
> }
>
> Module test_cases.ttcn
> {
> import my_types.ttcn
> import my_functions.ttcn
> testcase TP__000_B(in charstring v_cs_path) runs on
> mtc_TesterExecutable system tsi_testAdapter
> {
> var anytype v_attr_value;
> f_get_attr_value(v_attr_value);
> }
> }
>
> Compilation Error: the type of "v_attr_value" is not correct.
>
> I know that internally anytype becomes an Union type defined
> for all the visible types within the module. As far as I
> know, in our project the type visibility is the same for
> testcase.ttcn and my_functions.ttcn. Why I know that? Because
> all user-type defintions are in my_types.ttcn and this is
> imported by both modules.
>
> I really appreciate your contributions.
>
> Thanks in advance,
> Carlos Cardenas
> AT4 wireless
>
The administrator has disabled public write access.

Using a Anytype type as function parameter 29 Jan 2009 10:48 #7532

  • Carlos C
  • Carlos C's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Dear Gyorgy,

What do you mean as "any type definition in your module test_cases"? I think
"var anytype v_attr_value;" is what you mean, isn`t it?

The type of the anytype variable should be any of those declared in
my_types.ttcn.

Thanks for your quick response,
Carlos.

Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György Réthy
Sent: Thursday, January 29, 2009 11:37 AM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Using a Anytype type as function parameter

Dear Carlos,

I cannot see any type definition in your module test_cases. Thus the
"implicit union" is empty, what is not a legal type (i.e. what should be the
type of your variable?). Pls. note, that anytype is module-local. If you
want to import the anytype type of a module into another module, you have to
declare an alias in the imported-from module and use the alias type name in
other modules.

BR, Gyorgy

>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
> Sent: 2009-január-29 11:24
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Using a Anytype type as function parameter
>
> Dear TTCN-3 user,
>
> I got a compilation error because of anytype variable usage.
> The problem seems simple but I am not able not find a solution out.
>
> Module my_functions.ttcn
> {
> import my_types.ttcn
> ...
> function f_get_attr_value(out anytype attr_value)
> {
> ...
> return boolean
> }
> }
>
> Module test_cases.ttcn
> {
> import my_types.ttcn
> import my_functions.ttcn
> testcase TP__000_B(in charstring v_cs_path) runs on
> mtc_TesterExecutable system tsi_testAdapter
> {
> var anytype v_attr_value;
> f_get_attr_value(v_attr_value);
> }
> }
>
> Compilation Error: the type of "v_attr_value" is not correct.
>
> I know that internally anytype becomes an Union type defined for all
> the visible types within the module. As far as I know, in our project
> the type visibility is the same for testcase.ttcn and
> my_functions.ttcn. Why I know that? Because all user-type defintions
> are in my_types.ttcn and this is imported by both modules.
>
> I really appreciate your contributions.
>
> Thanks in advance,
> Carlos Cardenas
> AT4 wireless
>

--
The administrator has disabled public write access.

Using a Anytype type as function parameter 29 Jan 2009 10:51 #7533

Dear Carlos,

I mean that there is no declaration in your module "test_cases" that starts with
type ...

As I explained, the types declared in the module "my_types" are seen in the anytype within module "my_types" only, but not in the module "test_cases".

You have to write in the module "my_types":

type anytype my_anytype;

and in module "test_cases":

var my_anytype v_attr_value;


>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
> Sent: 2009-január-29 11:49
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Using a Anytype type as function parameter
>
> Dear Gyorgy,
>
> What do you mean as "any type definition in your module
> test_cases"? I think "var anytype v_attr_value;" is what you
> mean, isn`t it?
>
> The type of the anytype variable should be any of those
> declared in my_types.ttcn.
>
> Thanks for your quick response,
> Carlos.
>
>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György Réthy
> Sent: Thursday, January 29, 2009 11:37 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Using a Anytype type as function parameter
>
> Dear Carlos,
>
> I cannot see any type definition in your module test_cases.
> Thus the "implicit union" is empty, what is not a legal type
> (i.e. what should be the type of your variable?). Pls. note,
> that anytype is module-local. If you want to import the
> anytype type of a module into another module, you have to
> declare an alias in the imported-from module and use the
> alias type name in other modules.
>
> BR, Gyorgy
>
> >
Original Message
> > From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only
> > [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
> > Sent: 2009-január-29 11:24
> > To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> > Subject: Using a Anytype type as function parameter
> >
> > Dear TTCN-3 user,
> >
> > I got a compilation error because of anytype variable usage.
> > The problem seems simple but I am not able not find a solution out.
> >
> > Module my_functions.ttcn
> > {
> > import my_types.ttcn
> > ...
> > function f_get_attr_value(out anytype attr_value)
> > {
> > ...
> > return boolean
> > }
> > }
> >
> > Module test_cases.ttcn
> > {
> > import my_types.ttcn
> > import my_functions.ttcn
> > testcase TP__000_B(in charstring v_cs_path) runs on
> > mtc_TesterExecutable system tsi_testAdapter
> > {
> > var anytype v_attr_value;
> > f_get_attr_value(v_attr_value);
> > }
> > }
> >
> > Compilation Error: the type of "v_attr_value" is not correct.
> >
> > I know that internally anytype becomes an Union type
> defined for all
> > the visible types within the module. As far as I know, in
> our project
> > the type visibility is the same for testcase.ttcn and
> > my_functions.ttcn. Why I know that? Because all user-type
> defintions
> > are in my_types.ttcn and this is imported by both modules.
> >
> > I really appreciate your contributions.
> >
> > Thanks in advance,
> > Carlos Cardenas
> > AT4 wireless
> >
>
> --
>
The administrator has disabled public write access.

Using a Anytype type as function parameter 29 Jan 2009 15:18 #7534

  • Carlos C
  • Carlos C's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 6
  • Karma: 0
Hello,

It works. Thank you so much.

Best Regards,
Carlos.

Original Message
From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
[This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György Réthy
Sent: Thursday, January 29, 2009 11:52 AM
To: This email address is being protected from spambots. You need JavaScript enabled to view it.
Subject: Re: Using a Anytype type as function parameter

Dear Carlos,

I mean that there is no declaration in your module "test_cases" that starts
with type ...

As I explained, the types declared in the module "my_types" are seen in the
anytype within module "my_types" only, but not in the module "test_cases".

You have to write in the module "my_types":

type anytype my_anytype;

and in module "test_cases":

var my_anytype v_attr_value;


>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
> Sent: 2009-január-29 11:49
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Using a Anytype type as function parameter
>
> Dear Gyorgy,
>
> What do you mean as "any type definition in your module test_cases"? I
> think "var anytype v_attr_value;" is what you mean, isn`t it?
>
> The type of the anytype variable should be any of those declared in
> my_types.ttcn.
>
> Thanks for your quick response,
> Carlos.
>
>
Original Message
> From: active_ttcn3 : mts stf133 ttcn version 3 - active members only
> [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of György Réthy
> Sent: Thursday, January 29, 2009 11:37 AM
> To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Subject: Re: Using a Anytype type as function parameter
>
> Dear Carlos,
>
> I cannot see any type definition in your module test_cases.
> Thus the "implicit union" is empty, what is not a legal type (i.e.
> what should be the type of your variable?). Pls. note, that anytype is
> module-local. If you want to import the anytype type of a module into
> another module, you have to declare an alias in the imported-from
> module and use the alias type name in other modules.
>
> BR, Gyorgy
>
> >
Original Message
> > From: active_ttcn3 : mts stf133 ttcn version 3 - active
> members only
> > [This email address is being protected from spambots. You need JavaScript enabled to view it.] On Behalf Of Carlos Cárdenas
> > Sent: 2009-január-29 11:24
> > To: This email address is being protected from spambots. You need JavaScript enabled to view it.
> > Subject: Using a Anytype type as function parameter
> >
> > Dear TTCN-3 user,
> >
> > I got a compilation error because of anytype variable usage.
> > The problem seems simple but I am not able not find a solution out.
> >
> > Module my_functions.ttcn
> > {
> > import my_types.ttcn
> > ...
> > function f_get_attr_value(out anytype attr_value)
> > {
> > ...
> > return boolean
> > }
> > }
> >
> > Module test_cases.ttcn
> > {
> > import my_types.ttcn
> > import my_functions.ttcn
> > testcase TP__000_B(in charstring v_cs_path) runs on
> > mtc_TesterExecutable system tsi_testAdapter
> > {
> > var anytype v_attr_value;
> > f_get_attr_value(v_attr_value);
> > }
> > }
> >
> > Compilation Error: the type of "v_attr_value" is not correct.
> >
> > I know that internally anytype becomes an Union type
> defined for all
> > the visible types within the module. As far as I know, in
> our project
> > the type visibility is the same for testcase.ttcn and
> > my_functions.ttcn. Why I know that? Because all user-type
> defintions
> > are in my_types.ttcn and this is imported by both modules.
> >
> > I really appreciate your contributions.
> >
> > Thanks in advance,
> > Carlos Cardenas
> > AT4 wireless
> >
>
> --
>

--
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin