Quantcast

Tag all pointer params

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Tag all pointer params

Jeremy Cowles
Hey all,

I'm trying to tag all pointer parameters with a special name or type (in C#, so Tag<T> would as well) -- is there an easy way to do this?

string* foo1(Baz* out, Bar const& other);
Baz* foo2(Bar const& other); 
 
I want to tag Baz* in foo1() but not string* or Baz* in foo2.

For context, I'm trying to procedurally inspect the generated C# API and determine if output params are incorrectly wrapped.

Thanks!

--
Jeremy

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tag all pointer params

William S Fulton
On 29 September 2016 at 08:04, Jeremy Cowles <[hidden email]> wrote:

> Hey all,
>
> I'm trying to tag all pointer parameters with a special name or type (in C#,
> so Tag<T> would as well) -- is there an easy way to do this?
>
> string* foo1(Baz* out, Bar const& other);
> Baz* foo2(Bar const& other);
>
> I want to tag Baz* in foo1() but not string* or Baz* in foo2.
>
> For context, I'm trying to procedurally inspect the generated C# API and
> determine if output params are incorrectly wrapped.
>

What do you mean by tag? If it is give types a different name, use
%rename, otherwise anything modifying types is generally done with
typemaps. Maybe you want to add a C# property to each parameter?

Wiliam

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tag all pointer params

Jeremy Cowles
Rename could work, but how would you apply it to only (and all) pointer parameters?

On Thursday, September 29, 2016, William S Fulton <[hidden email]> wrote:
On 29 September 2016 at 08:04, Jeremy Cowles <<a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;jeremy.cowles@gmail.com&#39;)">jeremy.cowles@...> wrote:
> Hey all,
>
> I'm trying to tag all pointer parameters with a special name or type (in C#,
> so Tag<T> would as well) -- is there an easy way to do this?
>
> string* foo1(Baz* out, Bar const& other);
> Baz* foo2(Bar const& other);
>
> I want to tag Baz* in foo1() but not string* or Baz* in foo2.
>
> For context, I'm trying to procedurally inspect the generated C# API and
> determine if output params are incorrectly wrapped.
>

What do you mean by tag? If it is give types a different name, use
%rename, otherwise anything modifying types is generally done with
typemaps. Maybe you want to add a C# property to each parameter?

Wiliam

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tag all pointer params

William S Fulton
SWIGTYPE * works for all pointers in typemaps. Still not sure what you
mean by tag though.

On 30 September 2016 at 07:52, Jeremy Cowles <[hidden email]> wrote:

> Rename could work, but how would you apply it to only (and all) pointer
> parameters?
>
>
> On Thursday, September 29, 2016, William S Fulton <[hidden email]>
> wrote:
>>
>> On 29 September 2016 at 08:04, Jeremy Cowles <[hidden email]>
>> wrote:
>> > Hey all,
>> >
>> > I'm trying to tag all pointer parameters with a special name or type (in
>> > C#,
>> > so Tag<T> would as well) -- is there an easy way to do this?
>> >
>> > string* foo1(Baz* out, Bar const& other);
>> > Baz* foo2(Bar const& other);
>> >
>> > I want to tag Baz* in foo1() but not string* or Baz* in foo2.
>> >
>> > For context, I'm trying to procedurally inspect the generated C# API and
>> > determine if output params are incorrectly wrapped.
>> >
>>
>> What do you mean by tag? If it is give types a different name, use
>> %rename, otherwise anything modifying types is generally done with
>> typemaps. Maybe you want to add a C# property to each parameter?
>>
>> Wiliam

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Tag all pointer params

Jeremy Cowles
Wont SWIGTYPE* also match values that return a pointer?

To make the tagging idea concrete, I would do something like this:

%rename (MyCustomTypeTag<SWIGTYPE>) SWIGTYPE*

Then I would use C# reflection to search through the generated bindings to find all instances of MyCustomTypeTag and generate some code to fix the output parameters.


On Sun, Oct 2, 2016 at 12:48 PM William S Fulton <[hidden email]> wrote:
SWIGTYPE * works for all pointers in typemaps. Still not sure what you
mean by tag though.

On 30 September 2016 at 07:52, Jeremy Cowles <[hidden email]> wrote:
> Rename could work, but how would you apply it to only (and all) pointer
> parameters?
>
>
> On Thursday, September 29, 2016, William S Fulton <[hidden email]>
> wrote:
>>
>> On 29 September 2016 at 08:04, Jeremy Cowles <[hidden email]>
>> wrote:
>> > Hey all,
>> >
>> > I'm trying to tag all pointer parameters with a special name or type (in
>> > C#,
>> > so Tag<T> would as well) -- is there an easy way to do this?
>> >
>> > string* foo1(Baz* out, Bar const& other);
>> > Baz* foo2(Bar const& other);
>> >
>> > I want to tag Baz* in foo1() but not string* or Baz* in foo2.
>> >
>> > For context, I'm trying to procedurally inspect the generated C# API and
>> > determine if output params are incorrectly wrapped.
>> >
>>
>> What do you mean by tag? If it is give types a different name, use
>> %rename, otherwise anything modifying types is generally done with
>> typemaps. Maybe you want to add a C# property to each parameter?
>>
>> Wiliam

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...