<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 5 Sep 2017 17:00, "Phil Thompson" <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text">On 2 Sep 2017, at 3:29 am, Shaheed Haque <<a href="mailto:srhaque@theiet.org">srhaque@theiet.org</a>> wrote:<br>
><br>
> Hi,<br>
><br>
> Can I just check my understanding of simple arrays in SIP? Given the<br>
> following C++<br>
><br>
> ===========<br>
> enum E<br>
> {<br>
>    A,<br>
>    B<br>
> };<br>
><br>
> static const E e[] = { A, A, B, B };<br>
> ===========<br>
><br>
> I think that the best SIP I can come up with is:<br>
><br>
> ===========<br>
> %Module(name=foo)<br>
><br>
> enum E<br>
> {<br>
>    A,<br>
>    B<br>
> };<br>
><br>
> const E *e /NoSetter/;<br>
> ===========<br>
><br>
> (I also tried SIP_PYBUFFER etc.) But of course, that needs %GetCode,<br>
> and %GetCode is not allowed outside class scope. Are *any* arrays<br>
> possible outside class scope?<br>
<br>
</div>Arrays aren't really supported by SIP at all.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I get that...</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You'd have to provide hand-written code that implements the sequence protocol and proxies for the underlying array.</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">...and for N-dimensional array variable members of classes, I already generate the needed %GetCode etc. Can you clarify what directives I could use to "host" the generated code in this case, where the variable is not in a class?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> (Although as this case is const you could get away with creating a tuple with the same elements.)<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Acknowledged. But even for SIP_PYTUPLE, I'd need the same directives wouldn't I?</div><div dir="auto"><br></div><div dir="auto">Thanks, Shaheed</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font color="#888888"><br>
Phil</font></blockquote></div><br></div></div></div>