comp.lang.ada
 help / color / mirror / Atom feed
* Interfacing with Objective-C or Python
@ 2008-05-26  6:47 Adrian Hoe
  2008-05-26  8:25 ` Ivan Levashew
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Adrian Hoe @ 2008-05-26  6:47 UTC (permalink / raw)


Hi,

I am developing web-enabled application using AWS. This application
has the capability to send SMS via Skype. The development and target
platform will be Mac OS X. Unfortunately, I can only find Skype
examples in Objective-C and Python.

Is there any way to interface Ada with Objective-C (or Python) without
having a wrapper? Has anyone done this before?

Thanks.
--
Adrian Hoe
http://adrianhoe.com/adrianhoe/



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

* Re: Interfacing with Objective-C or Python
  2008-05-26  6:47 Interfacing with Objective-C or Python Adrian Hoe
@ 2008-05-26  8:25 ` Ivan Levashew
  2008-05-26  8:48   ` Adrian Hoe
  2008-05-26  9:02 ` Sébastien
  2008-06-01 19:40 ` [OT] Skype is dangerous (was 'Re: Interfacing with Objective-C or Python') Ivan Levashew
  2 siblings, 1 reply; 7+ messages in thread
From: Ivan Levashew @ 2008-05-26  8:25 UTC (permalink / raw)


Adrian Hoe пишет:
> Is there any way to interface Ada with Objective-C (or Python) without
> having a wrapper? Has anyone done this before?

Objective-C from Apple and from FSF have different way of dispatching calls.

Apple's one has objc_sendMsg varargs function. The best way is to have a 
C wrapper for every kind of varargs invokation since one can't be sure 
if passing some kind of argument is equivalent to passing it as a 
varargs argument. But if one is sure, one can completely eliminate ObjC 
wrapper. objc_sendMsg must be imported several times for every 
combination of arguments one is going to use it with. One will also need 
to map selectors' string representation to their integer representation 
with NSSelectorFromString. Frozen constant will do.

Then one just calls objc_sendMsg (objc-class-or-object, selector, arg1, 
arg2, ...). And also reference counting: Controlled's Adjust/Finalize 
must be mapped to NeXTSTEP's retain/release. I don't know much about 
exception handling.

> without having a wrapper?

ObjectiveC is like C++. There are at least 3 incompatible 
implementations: Apple, FSF, POC*. One either make a wrapper or go into 
details and make implementation-dependent binding. Cocoa APIs are 
partially duplicated in GNUStep and Cocotron, and Apple is rumored to 
release Cocoa for Windows [1] currently being tested on Safari for 
Windows. So it's usually better to make portable bindings. Since Skype 
API on Mac OS X is likely to remain tied to Apple ObjC, Skype is an 
exception.

What's the point in not having a wrapper?

*) Portable Object Compiler
[1]http://www.roughlydrafted.com/RD/RDM.Tech.Q2.07/A35C23B9-BD22-4478-BC30-4111CFC360B5.html

-- 
If you want to get to the top, you have to start at the bottom



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

* Re: Interfacing with Objective-C or Python
  2008-05-26  8:25 ` Ivan Levashew
@ 2008-05-26  8:48   ` Adrian Hoe
  2008-05-26  9:18     ` Ivan Levashew
  0 siblings, 1 reply; 7+ messages in thread
From: Adrian Hoe @ 2008-05-26  8:48 UTC (permalink / raw)


On May 26, 4:25 pm, Ivan Levashew <octag...@bluebottle.com> wrote:
> Adrian Hoe пишет:
>
> > Is there any way to interface Ada with Objective-C (or Python) without
> > having a wrapper? Has anyone done this before?
>
> Objective-C from Apple and from FSF have different way of dispatching calls.
>
> Apple's one has objc_sendMsg varargs function. The best way is to have a
> C wrapper for every kind of varargs invokation since one can't be sure
> if passing some kind of argument is equivalent to passing it as a
> varargs argument. But if one is sure, one can completely eliminate ObjC
> wrapper. objc_sendMsg must be imported several times for every
> combination of arguments one is going to use it with. One will also need
> to map selectors' string representation to their integer representation
> with NSSelectorFromString. Frozen constant will do.
>
> Then one just calls objc_sendMsg (objc-class-or-object, selector, arg1,
> arg2, ...). And also reference counting: Controlled's Adjust/Finalize
> must be mapped to NeXTSTEP's retain/release. I don't know much about
> exception handling.
>
> > without having a wrapper?
>
> ObjectiveC is like C++. There are at least 3 incompatible
> implementations: Apple, FSF, POC*. One either make a wrapper or go into
> details and make implementation-dependent binding. Cocoa APIs are
> partially duplicated in GNUStep and Cocotron, and Apple is rumored to
> release Cocoa for Windows [1] currently being tested on Safari for
> Windows. So it's usually better to make portable bindings. Since Skype
> API on Mac OS X is likely to remain tied to Apple ObjC, Skype is an
> exception.
>
> What's the point in not having a wrapper?
>
> *) Portable Object Compiler
> [1]http://www.roughlydrafted.com/RD/RDM.Tech.Q2.07/A35C23B9-BD22-4478-BC...


The point of not having a wrapper is to have less language involved.
Currently, the development is in pure Ada and will only involve call
to Skype's API via Objective-C. If there is way to directly interface
with Objective-C without writing a C-wrapper, so much better.

But looks like a C-wrapper is inevitable, isn't it?
--
Adrian Hoe
http://adrianhoe.com/adrianhoe/




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

* Re: Interfacing with Objective-C or Python
  2008-05-26  6:47 Interfacing with Objective-C or Python Adrian Hoe
  2008-05-26  8:25 ` Ivan Levashew
@ 2008-05-26  9:02 ` Sébastien
  2008-06-01 19:40 ` [OT] Skype is dangerous (was 'Re: Interfacing with Objective-C or Python') Ivan Levashew
  2 siblings, 0 replies; 7+ messages in thread
From: Sébastien @ 2008-05-26  9:02 UTC (permalink / raw)


Adrian Hoe a �crit :
> Hi,
> 
> I am developing web-enabled application using AWS. This application
> has the capability to send SMS via Skype. The development and target
> platform will be Mac OS X. Unfortunately, I can only find Skype
> examples in Objective-C and Python.
> 
> Is there any way to interface Ada with Objective-C (or Python) without
> having a wrapper? Has anyone done this before?

Hi,

I don't know ObjectiveC, but about Python, even if there is no direct 
wrapper, it couldn't be difficult. Indeed, all the C API in Python use 
Pointers, so you just have to create your own wrapper like this:

type PyObject_Ptr is new System.Address;

function A_C_Function_Wrapper_To_Python(pyobj: PyObject_Ptr; ...) return 
SomeType;

And so on. I did for MySQL and it's not a big deal, some times of 
course, you could have to write a littke C code to help you and bind 
your ada program with if (particularly when you want to access to 
structure field when you are not sure of the structure size, otherwise, 
you can still create the equivalent Ada Structure and map).

I'm still thinking that everything than can me wrapped in C can me 
wrapped in Ada even if it's, the first time, a little bit more 
complicated but not so much.

Sebastien



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

* Re: Interfacing with Objective-C or Python
  2008-05-26  8:48   ` Adrian Hoe
@ 2008-05-26  9:18     ` Ivan Levashew
  2008-06-01  1:28       ` Adrian Hoe
  0 siblings, 1 reply; 7+ messages in thread
From: Ivan Levashew @ 2008-05-26  9:18 UTC (permalink / raw)


Adrian Hoe О©╫О©╫О©╫О©╫О©╫:
> But looks like a C-wrapper is inevitable, isn't it?
No, it isn't.

You just need to ensure that varargs invokation is identical to usual 
invokation.

-- 
If you want to get to the top, you have to start at the bottom



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

* Re: Interfacing with Objective-C or Python
  2008-05-26  9:18     ` Ivan Levashew
@ 2008-06-01  1:28       ` Adrian Hoe
  0 siblings, 0 replies; 7+ messages in thread
From: Adrian Hoe @ 2008-06-01  1:28 UTC (permalink / raw)


On May 26, 5:18 pm, Ivan Levashew <octag...@bluebottle.com> wrote:
> Adrian Hoe ÐÉÛÅÔ:> But looks like a C-wrapper is inevitable, isn't it?
>
> No, it isn't.
>
> You just need to ensure that varargs invokation is identical to usual
> invokation.
>
> --
> If you want to get to the top, you have to start at the bottom


I found a C-Carbon binding on Mac OS X. No luck on Linux yet but I
will experiment with the C header on Linux to see if it works there.
The problem is to find out which Skype framework or library to bind on
Linux.

--
Adrian Hoe
http://adrianhoe/adrianhoe/



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

* [OT] Skype is dangerous (was 'Re: Interfacing with Objective-C or Python')
  2008-05-26  6:47 Interfacing with Objective-C or Python Adrian Hoe
  2008-05-26  8:25 ` Ivan Levashew
  2008-05-26  9:02 ` Sébastien
@ 2008-06-01 19:40 ` Ivan Levashew
  2 siblings, 0 replies; 7+ messages in thread
From: Ivan Levashew @ 2008-06-01 19:40 UTC (permalink / raw)


Adrian Hoe пишет:
> Hi,
> 
> I am developing web-enabled application using AWS. This application
> has the capability to send SMS via Skype. The development and target
> platform will be Mac OS X. Unfortunately, I can only find Skype
> examples in Objective-C and Python.
> 
> Is there any way to interface Ada with Objective-C (or Python) without
> having a wrapper? Has anyone done this before?

Couldn't you please find any other means of sending SMS?

I have recently read an brief analisys of how is Skype functioning. [1] 
Can't find an English version, sorry.

Do you think it to be a good idea to link an Ada program with Skype? And 
promote Skype as a consequence.

[1] http://www.xakep.ru/magazine/xa/100/064/1.asp

-- 
If you want to get to the top, you have to start at the bottom



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

end of thread, other threads:[~2008-06-01 19:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-26  6:47 Interfacing with Objective-C or Python Adrian Hoe
2008-05-26  8:25 ` Ivan Levashew
2008-05-26  8:48   ` Adrian Hoe
2008-05-26  9:18     ` Ivan Levashew
2008-06-01  1:28       ` Adrian Hoe
2008-05-26  9:02 ` Sébastien
2008-06-01 19:40 ` [OT] Skype is dangerous (was 'Re: Interfacing with Objective-C or Python') Ivan Levashew

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