comp.lang.ada
 help / color / mirror / Atom feed
* Unchecked_Conversion help needed
@ 2004-12-21 21:22 rcarnesiii
  2004-12-21 21:49 ` rcarnesiii
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: rcarnesiii @ 2004-12-21 21:22 UTC (permalink / raw)


I used Ada many years ago and am now getting back into it. Here's my
problem, I have to applications and am sending messages between them.

Sending procedures function call
Send_Message
     (Partner => The_Handle,
      Message => Message(X)'Address,
      Bytes   => Message(X).Length,
      Message_Id => My_Message_Id);

On the receiving side my callback routine looks like this

Process_Message_From_Partner
            (Partner : Xxx.The_Handle;
             Message : in System.Address;
             Bytes   : in Positive;
             Message_Id : in Xxx.Message_Id) is

begin
  my code

end Process_Message_From_Partner;

What I would like to do is print out the message on the receiving side.

Is this possible using unchecked_conversion ?

Thanks


 




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

* Re: Unchecked_Conversion help needed
  2004-12-21 21:22 Unchecked_Conversion help needed rcarnesiii
@ 2004-12-21 21:49 ` rcarnesiii
  2004-12-21 21:53 ` tmoran
  2004-12-22  9:21 ` Adrien Plisson
  2 siblings, 0 replies; 18+ messages in thread
From: rcarnesiii @ 2004-12-21 21:49 UTC (permalink / raw)


I meant I have two apps talking to each other.






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

* Re: Unchecked_Conversion help needed
  2004-12-21 21:22 Unchecked_Conversion help needed rcarnesiii
  2004-12-21 21:49 ` rcarnesiii
@ 2004-12-21 21:53 ` tmoran
  2004-12-22  0:17   ` Jeffrey Carter
  2004-12-22  9:21 ` Adrien Plisson
  2 siblings, 1 reply; 18+ messages in thread
From: tmoran @ 2004-12-21 21:53 UTC (permalink / raw)


>            Message : in System.Address;
>            Bytes   : in Positive;
>...
>What I would like to do is print out the message on the receiving side.
>
>Is this possible using unchecked_conversion ?
  Much is possible using unchecked_conversion.  But why not something like:
    Actual_Message : String(Positive);
    for Actual_Message'address use Message;
    ...
    Ada.Text_IO.Put(Actual_Message(1 .. Bytes));



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

* Re: Unchecked_Conversion help needed
  2004-12-21 21:53 ` tmoran
@ 2004-12-22  0:17   ` Jeffrey Carter
  2004-12-22  5:41     ` Brian May
  0 siblings, 1 reply; 18+ messages in thread
From: Jeffrey Carter @ 2004-12-22  0:17 UTC (permalink / raw)


tmoran@acm.org wrote:
> 
>     Actual_Message : String(Positive);
>     for Actual_Message'address use Message;

Don't forget:

pragma Import (Ada, Actual_Message);

-- 
Jeff Carter
"Ditto, you provincial putz?"
Blazing Saddles
86



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

* Re: Unchecked_Conversion help needed
@ 2004-12-22  3:29 Nick Roberts
  2004-12-22  8:03 ` Jerome Hugues
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Roberts @ 2004-12-22  3:29 UTC (permalink / raw)


"rcarnesiii" <reid_carnes@yahoo.com> wrote:

> I meant I have two apps talking to each other.

This is a problem that may be addressed (pardon the pun) by Annex E of the
Ada 95 Reference Manual (RM95). I believe there is an Open Source
implementation, but I forget the name. Alternatively, some Object Request
Broker (ORB) system might be what you need.

In any case, the essence of communication between two Ada programs (or
partitions) usually involves using streams and serialisation -- see RM95
section 13.13 -- to perform what is called 'marshalling' of data.

Values of a type T are serialised and deserialised by the T'Write and T'Read
procedures or the T'Output procedure and T'Input function, as described in
the RM95.

To transfer a set of values from one program to another, the source program
marshalls (serialises) the values into a stream (using T'Write or T'Output),
then the stream is transferred from the source program to the target program
(how this is done depends on a lot of things), then the values are
unmarshalled (deserialised) into variables (using T'Read or T'Input) in the
target program.

A stream which represents a shared file or shared memory area may be used to
effect the transfer of data. In the case of programs which are running on
different machines, a stream which represents a (buffered) network channel
between the machines may be used.

For some types (typically limited and access types), you will need to write
your own serialisation code (you then use a 'use' clause to declare them as
the implementations of T'Write and T'Read and/or T'Output and T'Input).

Please reply if you need more help.

-- 
Nick Roberts



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

* Re: Unchecked_Conversion help needed
  2004-12-22  0:17   ` Jeffrey Carter
@ 2004-12-22  5:41     ` Brian May
  2004-12-23  0:32       ` Jeffrey Carter
  0 siblings, 1 reply; 18+ messages in thread
From: Brian May @ 2004-12-22  5:41 UTC (permalink / raw)


>>>>> "Jeffrey" == Jeffrey Carter <spam@spam.com> writes:

    Jeffrey> pragma Import (Ada, Actual_Message);

Why is that required? What does it do?
-- 
Brian May <bam@snoopy.apana.org.au>



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

* Re: Unchecked_Conversion help needed
  2004-12-22  3:29 Unchecked_Conversion help needed Nick Roberts
@ 2004-12-22  8:03 ` Jerome Hugues
  2004-12-22  9:24   ` Pascal Obry
  2004-12-22  9:55   ` Martin Krischik
  0 siblings, 2 replies; 18+ messages in thread
From: Jerome Hugues @ 2004-12-22  8:03 UTC (permalink / raw)


In article <gemini.i93tp6001bo1s02fg.nick.roberts@acm.org>, Nick Roberts wrote:
> "rcarnesiii" <reid_carnes@yahoo.com> wrote:
> 
>> I meant I have two apps talking to each other.
> 
> This is a problem that may be addressed (pardon the pun) by Annex E of the
> Ada 95 Reference Manual (RM95). I believe there is an Open Source
> implementation, but I forget the name. Alternatively, some Object Request
> Broker (ORB) system might be what you need.

You might be speaking of GLADE ( http://libre.act-europe.fr/glade/ ),

and, for instance PolyORB ( http://libre.act-europe.fr/polyorb/ ) for an ORB,

and AWS ( http://libre.act-europe.fr/aws/ ) is using SOAP is OK; so
that no one is forgotten ;)

-- 
Jerome



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

* Re: Unchecked_Conversion help needed
  2004-12-21 21:22 Unchecked_Conversion help needed rcarnesiii
  2004-12-21 21:49 ` rcarnesiii
  2004-12-21 21:53 ` tmoran
@ 2004-12-22  9:21 ` Adrien Plisson
  2 siblings, 0 replies; 18+ messages in thread
From: Adrien Plisson @ 2004-12-22  9:21 UTC (permalink / raw)


rcarnesiii wrote:
> I used Ada many years ago and am now getting back into it. Here's my
> problem, I have to applications and am sending messages between them.

[...]

>       Message => Message(X)'Address,

[...]

>              Message : in System.Address;

don't forget that most operating systems have memory protection and 
virtual memory managers. so an address in one process is invalid in 
another process (at least it is not required to point to the same 
physical memory location).

so be careful when using System.Address.

also i'm not sure using System.Address is a good programming practice, 
unless you are talking with an application implemented using a 
"low-level" language as C. you may consider creating a message type.

-- 
rien



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

* Re: Unchecked_Conversion help needed
  2004-12-22  8:03 ` Jerome Hugues
@ 2004-12-22  9:24   ` Pascal Obry
  2004-12-22  9:55   ` Martin Krischik
  1 sibling, 0 replies; 18+ messages in thread
From: Pascal Obry @ 2004-12-22  9:24 UTC (permalink / raw)



Jerome,

> and AWS ( http://libre.act-europe.fr/aws/ ) is using SOAP is OK; so
> that no one is forgotten ;)

Thanks Jerome ;)

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Unchecked_Conversion help needed
  2004-12-22  8:03 ` Jerome Hugues
  2004-12-22  9:24   ` Pascal Obry
@ 2004-12-22  9:55   ` Martin Krischik
  2004-12-22 12:46     ` Pascal Obry
  2004-12-22 14:09     ` Jerome Hugues
  1 sibling, 2 replies; 18+ messages in thread
From: Martin Krischik @ 2004-12-22  9:55 UTC (permalink / raw)


Jerome Hugues wrote:

> hopini.i93tp6001bo1s02fg.nick.roberts@acm.org>, Nick Roberts
> wrote:
>> "rcarnesiii" <reid_carnes@yahoo.com> wrote:
>> 
>>> I meant I have two apps talking to each other.
>> 
>> This is a problem that may be addressed (pardon the pun) by Annex E of
>> the Ada 95 Reference Manual (RM95). I believe there is an Open Source
>> implementation, but I forget the name. Alternatively, some Object Request
>> Broker (ORB) system might be what you need.
> 
> You might be speaking of GLADE ( http://libre.act-europe.fr/glade/ ),
 
> and, for instance PolyORB ( http://libre.act-europe.fr/polyorb/ ) for an
> ORB,

Coincidental I have started a little tutorial on how to use PolyORB:

http://en.wikibooks.org/wiki/Programming:CORBA

Well it is little and not yet finished but nevertheless it might be of
intererest.

> and AWS ( http://libre.act-europe.fr/aws/ ) is using SOAP is OK; so
> that no one is forgotten ;)

Actually PolyORB can do Annex E, CORBA and SOAP. Mind you, I have only
tested CORBA so I can't say much about the other personalities.

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



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

* Re: Unchecked_Conversion help needed
  2004-12-22  9:55   ` Martin Krischik
@ 2004-12-22 12:46     ` Pascal Obry
  2004-12-22 14:14       ` Jerome Hugues
  2004-12-22 14:09     ` Jerome Hugues
  1 sibling, 1 reply; 18+ messages in thread
From: Pascal Obry @ 2004-12-22 12:46 UTC (permalink / raw)



Martin Krischik <martin@krischik.com> writes:

> Jerome Hugues wrote:
> 
> > and AWS ( http://libre.act-europe.fr/aws/ ) is using SOAP is OK; so
> > that no one is forgotten ;)
> 
> Actually PolyORB can do Annex E, CORBA and SOAP. Mind you, I have only
> tested CORBA so I can't say much about the other personalities.

I am sure that Jerome knows that as he has worked on PolyORB. BTW, the PolyORB
SOAP persoanlity is based on AWS.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Unchecked_Conversion help needed
  2004-12-22  9:55   ` Martin Krischik
  2004-12-22 12:46     ` Pascal Obry
@ 2004-12-22 14:09     ` Jerome Hugues
  2004-12-22 18:33       ` Martin Krischik
  1 sibling, 1 reply; 18+ messages in thread
From: Jerome Hugues @ 2004-12-22 14:09 UTC (permalink / raw)


In article <1911458.3otSqa1tqp@linux1.krischik.com>, Martin Krischik wrote:
> Coincidental I have started a little tutorial on how to use PolyORB:
> 
> http://en.wikibooks.org/wiki/Programming:CORBA
> 
> Well it is little and not yet finished but nevertheless it might be of
> intererest.

Sure, but this is of high interrest, as there is few documentation on
CORBA/Ada ! Another interresting point with CORBA is comparing IDL
types and their counterpart in C++, Java or other language .. and to
see how elegant and simple the Ada mapping is ;)

-- 
Jerome



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

* Re: Unchecked_Conversion help needed
  2004-12-22 12:46     ` Pascal Obry
@ 2004-12-22 14:14       ` Jerome Hugues
  2004-12-22 14:30         ` Pascal Obry
  0 siblings, 1 reply; 18+ messages in thread
From: Jerome Hugues @ 2004-12-22 14:14 UTC (permalink / raw)


In article <uoegmlcvn.fsf@obry.net>, Pascal Obry wrote:

> I am sure that Jerome knows that as he has worked on PolyORB. 

I'm still working on it ;)

But I'm mainly focusing on RT-CORBA (one aspect of my PhD)

> BTW, the PolyORB SOAP persoanlity is based on AWS.

The AWS personality is also based on AWS ;)

The SOAP personality is based on an old version of AWS, it supports
most types. There are room for improvements in these domains, and all
contributors are always welcome.

-- 
Jerome





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

* Re: Unchecked_Conversion help needed
  2004-12-22 14:14       ` Jerome Hugues
@ 2004-12-22 14:30         ` Pascal Obry
  0 siblings, 0 replies; 18+ messages in thread
From: Pascal Obry @ 2004-12-22 14:30 UTC (permalink / raw)



Jerome Hugues <hugues@merlin.enst.fr> writes:

> The SOAP personality is based on an old version of AWS, it supports
> most types. There are room for improvements in these domains, and all
> contributors are always welcome.

Right, especially since the SOAP support in AWS has improved a lot since
then.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



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

* Re: Unchecked_Conversion help needed
  2004-12-22 14:09     ` Jerome Hugues
@ 2004-12-22 18:33       ` Martin Krischik
  2004-12-22 22:05         ` CORBA/Ada [Was: Re: Unchecked_Conversion help needed] Jerome Hugues
  0 siblings, 1 reply; 18+ messages in thread
From: Martin Krischik @ 2004-12-22 18:33 UTC (permalink / raw)


Jerome Hugues wrote:

> In article <1911458.3otSqa1tqp@linux1.krischik.com>, Martin Krischik
> wrote:
>> Coincidental I have started a little tutorial on how to use PolyORB:
>> 
>> http://en.wikibooks.org/wiki/Programming:CORBA
>> 
>> Well it is little and not yet finished but nevertheless it might be of
>> intererest.
> 
> Sure, but this is of high interrest, as there is few documentation on
> CORBA/Ada !

When I found the wiki page "Programming:CORBA" it contained "so far so
good". Yes, full 4 words. And since I am currently doing work with PolyORB
I thougt: "That's a great opertunity to push some Ada" :-) .

> Another interresting point with CORBA is comparing IDL 
> types and their counterpart in C++, Java or other language .. and to
> see how elegant and simple the Ada mapping is ;)

I constantly try to improve the page and I would be happy if you would look
over it from time to time.

When we are at it, I don't like the way the New_Echo method is implemented:

http://en.wikibooks.org/wiki/Programming:CORBA#Ada_Implementation_2

According to the CORBA doc one should use create_reference to create a new
object and I found a fitting function in PortableServer.POA but I could not
get it to work. Any Ideas?

With Regards

Martin
-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



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

* CORBA/Ada [Was: Re: Unchecked_Conversion help needed]
  2004-12-22 18:33       ` Martin Krischik
@ 2004-12-22 22:05         ` Jerome Hugues
  2004-12-23  7:41           ` CORBA/Ada Martin Krischik
  0 siblings, 1 reply; 18+ messages in thread
From: Jerome Hugues @ 2004-12-22 22:05 UTC (permalink / raw)


In article <1751648.n8nPOOOENr@linux1.krischik.com>, Martin Krischik wrote:

> I constantly try to improve the page and I would be happy if you would look
> over it from time to time.

Do not hesitate to ping me by private mail, or through the PolyORB
mailing-lists.

> When we are at it, I don't like the way the New_Echo method is implemented:
> 
> http://en.wikibooks.org/wiki/Programming:CORBA#Ada_Implementation_2
> 
> According to the CORBA doc one should use create_reference to create a new
> object and I found a fitting function in PortableServer.POA but I could not
> get it to work. Any Ideas?

Can you be more precise ? What is the problem you see ?

Note that a similar echo is already covered in PolyORB's examples and
in the User's Guide.

For a more complete look over the use of the POA interface in PolyORB,
you can grab PolyORB from the CVS repository, and examine
testsuite/corba/portableserver; these examples review each function
from this interface.

-- 
Jerome






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

* Re: Unchecked_Conversion help needed
  2004-12-22  5:41     ` Brian May
@ 2004-12-23  0:32       ` Jeffrey Carter
  0 siblings, 0 replies; 18+ messages in thread
From: Jeffrey Carter @ 2004-12-23  0:32 UTC (permalink / raw)


Brian May wrote:

>     Jeffrey> pragma Import (Ada, Actual_Message);
> 
> Why is that required? What does it do?

It prevents the compiler from generating anything that initializes 
Actual_Message.

-- 
Jeff Carter
"If I could find a sheriff who so offends the citizens of Rock
Ridge that his very appearance would drive them out of town ...
but where would I find such a man? Why am I asking you?"
Blazing Saddles
37



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

* Re: CORBA/Ada
  2004-12-22 22:05         ` CORBA/Ada [Was: Re: Unchecked_Conversion help needed] Jerome Hugues
@ 2004-12-23  7:41           ` Martin Krischik
  0 siblings, 0 replies; 18+ messages in thread
From: Martin Krischik @ 2004-12-23  7:41 UTC (permalink / raw)


Jerome Hugues wrote:

> In article <1751648.n8nPOOOENr@linux1.krischik.com>, Martin Krischik
> wrote:
> 
>> I constantly try to improve the page and I would be happy if you would
>> look over it from time to time.
> 
> Do not hesitate to ping me by private mail, or through the PolyORB
> mailing-lists.
> 
>> When we are at it, I don't like the way the New_Echo method is
>> implemented:
>> 
>> http://en.wikibooks.org/wiki/Programming:CORBA#Ada_Implementation_2
>> 
>> According to the CORBA doc one should use create_reference to create a
>> new object and I found a fitting function in PortableServer.POA but I
>> could not get it to work. Any Ideas?
 
> Can you be more precise ? What is the problem you see ?

An exception on activate. I get an example ready and post it to the PolyORB
mailing list.
 
> Note that a similar echo is already covered in PolyORB's examples and
> in the User's Guide.

True. But all PolyORB examples force you to cut/copy/paste the IOP address
from the server diagnostic output to the client command line. I thought
that is not good enough. So I created an echo example wich does not need
that.

> For a more complete look over the use of the POA interface in PolyORB,
> you can grab PolyORB from the CVS repository,

Got that allready.

> and examine 
> testsuite/corba/portableserver; these examples review each function
> from this interface.

Have looked there allready - but I have another look just to be shure.

With Regards

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



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

end of thread, other threads:[~2004-12-23  7:41 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-22  3:29 Unchecked_Conversion help needed Nick Roberts
2004-12-22  8:03 ` Jerome Hugues
2004-12-22  9:24   ` Pascal Obry
2004-12-22  9:55   ` Martin Krischik
2004-12-22 12:46     ` Pascal Obry
2004-12-22 14:14       ` Jerome Hugues
2004-12-22 14:30         ` Pascal Obry
2004-12-22 14:09     ` Jerome Hugues
2004-12-22 18:33       ` Martin Krischik
2004-12-22 22:05         ` CORBA/Ada [Was: Re: Unchecked_Conversion help needed] Jerome Hugues
2004-12-23  7:41           ` CORBA/Ada Martin Krischik
  -- strict thread matches above, loose matches on Subject: below --
2004-12-21 21:22 Unchecked_Conversion help needed rcarnesiii
2004-12-21 21:49 ` rcarnesiii
2004-12-21 21:53 ` tmoran
2004-12-22  0:17   ` Jeffrey Carter
2004-12-22  5:41     ` Brian May
2004-12-23  0:32       ` Jeffrey Carter
2004-12-22  9:21 ` Adrien Plisson

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