AlBor | 27 Jul 2012 10:35
Picon

One file for different target languages


Hello swig users!

I made some simple wrapping for C# and want to do the same for Java. I have
a set of wrapping rules (%defines) that include typemaps. Is it possible to
create some generic rule that would apply different typemaps according to
target language? For instance:
%define WRAP_RULE(CLASS)
%typemap(ctype) CLASS ...
if (C# target)
  %typemap(cscode) ...
elseif(Java target)
  %typemap(javacode) ...
end
%enddef

and apply this WRAP_RULE for C++ classes where necessary.
Or probably somebody may share some approaches of how to separate wrapping
logics and language specifics?

Thanks in advance,
Alex.
--

-- 
View this message in context: http://old.nabble.com/One-file-for-different-target-languages-tp34219501p34219501.html
Sent from the swig-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
(Continue reading)

Andrew Ward | 27 Jul 2012 17:05
Picon

Re: One file for different target languages

What about using the various language specific preprocessor defines?:

http://www.swig.org/Doc2.0/Preprocessor.html#Preprocessor_condition_compilation

I.e:

#ifdef SWIGJAVA
#endif



On 27 July 2012 09:35, AlBor <dsbalbor <at> gmail.com> wrote:

Hello swig users!

I made some simple wrapping for C# and want to do the same for Java. I have
a set of wrapping rules (%defines) that include typemaps. Is it possible to
create some generic rule that would apply different typemaps according to
target language? For instance:
%define WRAP_RULE(CLASS)
%typemap(ctype) CLASS ...
if (C# target)
  %typemap(cscode) ...
elseif(Java target)
  %typemap(javacode) ...
end
%enddef

and apply this WRAP_RULE for C++ classes where necessary.
Or probably somebody may share some approaches of how to separate wrapping
logics and language specifics?

Thanks in advance,
Alex.
--
View this message in context: http://old.nabble.com/One-file-for-different-target-languages-tp34219501p34219501.html
Sent from the swig-user mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
William S Fulton | 27 Jul 2012 20:56
Picon
Favicon
Gravatar

Re: One file for different target languages

Yes, that is exactly what they are intended for.

William

On 27/07/12 16:05, Andrew Ward wrote:
> What about using the various language specific preprocessor defines?:
>
> http://www.swig.org/Doc2.0/Preprocessor.html#Preprocessor_condition_compilation
>
> I.e:
>
> #ifdef SWIGJAVA
> #endif
>
>
>
> On 27 July 2012 09:35, AlBor <dsbalbor <at> gmail.com
> <mailto:dsbalbor <at> gmail.com>> wrote:
>
>
>     Hello swig users!
>
>     I made some simple wrapping for C# and want to do the same for Java.
>     I have
>     a set of wrapping rules (%defines) that include typemaps. Is it
>     possible to
>     create some generic rule that would apply different typemaps
>     according to
>     target language? For instance:
>     %define WRAP_RULE(CLASS)
>     %typemap(ctype) CLASS ...
>     if (C# target)
>        %typemap(cscode) ...
>     elseif(Java target)
>        %typemap(javacode) ...
>     end
>     %enddef
>
>     and apply this WRAP_RULE for C++ classes where necessary.
>     Or probably somebody may share some approaches of how to separate
>     wrapping
>     logics and language specifics?
>
>     Thanks in advance,
>     Alex.
>     --
>     View this message in context:
>     http://old.nabble.com/One-file-for-different-target-languages-tp34219501p34219501.html
>     Sent from the swig-user mailing list archive at Nabble.com.
>
>
>     ------------------------------------------------------------------------------
>     Live Security Virtual Conference
>     Exclusive live event will cover all the ways today's security and
>     threat landscape has changed and how IT managers can respond.
>     Discussions
>     will include endpoint security, mobile security and the latest in
>     malware
>     threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>     _______________________________________________
>     Swig-user mailing list
>     Swig-user <at> lists.sourceforge.net <mailto:Swig-user <at> lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/swig-user
>
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>
>
>
> _______________________________________________
> Swig-user mailing list
> Swig-user <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/swig-user

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
AlBor | 30 Jul 2012 06:59
Picon

Re: One file for different target languages


Yes, that is exactly what they are intended for.

William

Thanks a lot. I paid attention to this chapter but (I don't know why) had
some doubts )))
--

-- 
View this message in context: http://old.nabble.com/One-file-for-different-target-languages-tp34219501p34228831.html
Sent from the swig-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
AlBor | 30 Jul 2012 06:58
Picon

Re: One file for different target languages


Andrew Ward-5 wrote:
> 
> What about using the various language specific preprocessor defines?:
> 
> http://www.swig.org/Doc2.0/Preprocessor.html#Preprocessor_condition_compilation
> 
> I.e:
> 
> #ifdef SWIGJAVA
> #endif
> 
> Thanks a lot. I paid attention to this chapter but (I don't know why) had
> some doubts )))
> 
> On 27 July 2012 09:35, AlBor <dsbalbor <at> gmail.com> wrote:
> 
>>
>> Hello swig users!
>>
>> I made some simple wrapping for C# and want to do the same for Java. I
>> have
>> a set of wrapping rules (%defines) that include typemaps. Is it possible
>> to
>> create some generic rule that would apply different typemaps according to
>> target language? For instance:
>> %define WRAP_RULE(CLASS)
>> %typemap(ctype) CLASS ...
>> if (C# target)
>>   %typemap(cscode) ...
>> elseif(Java target)
>>   %typemap(javacode) ...
>> end
>> %enddef
>>
>> and apply this WRAP_RULE for C++ classes where necessary.
>> Or probably somebody may share some approaches of how to separate
>> wrapping
>> logics and language specifics?
>>
>> Thanks in advance,
>> Alex.
>> --
>> View this message in context:
>> http://old.nabble.com/One-file-for-different-target-languages-tp34219501p34219501.html
>> Sent from the swig-user mailing list archive at Nabble.com.
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
>> _______________________________________________
>> Swig-user mailing list
>> Swig-user <at> lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/swig-user
>>
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Swig-user mailing list
> Swig-user <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/swig-user
> 
> 

--

-- 
View this message in context: http://old.nabble.com/One-file-for-different-target-languages-tp34219501p34228829.html
Sent from the swig-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

Gmane