[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Arrays in SIP
From: Shaheed Haque <srhaque () theiet ! org>
Date: 2017-09-05 16:44:33
Message-ID: CAHAc2jf6iwTw1AoZoFpm+RMMVqqFGF=H-gcH-+Msqzd=aYcejA () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On 5 Sep 2017 17:42, "Phil Thompson" <phil@riverbankcomputing.com> wrote:
On 5 Sep 2017, at 5:39 pm, Shaheed Haque <srhaque@theiet.org> wrote:
>
>
>
> On 5 Sep 2017 17:00, "Phil Thompson" <phil@riverbankcomputing.com> wrote:
> On 2 Sep 2017, at 3:29 am, Shaheed Haque <srhaque@theiet.org> wrote:
> >
> > Hi,
> >
> > Can I just check my understanding of simple arrays in SIP? Given the
> > following C++
> >
> > ===========
> > enum E
> > {
> > A,
> > B
> > };
> >
> > static const E e[] = { A, A, B, B };
> > ===========
> >
> > I think that the best SIP I can come up with is:
> >
> > ===========
> > %Module(name=foo)
> >
> > enum E
> > {
> > A,
> > B
> > };
> >
> > const E *e /NoSetter/;
> > ===========
> >
> > (I also tried SIP_PYBUFFER etc.) But of course, that needs %GetCode,
> > and %GetCode is not allowed outside class scope. Are *any* arrays
> > possible outside class scope?
>
> Arrays aren't really supported by SIP at all.
>
> I get that...
>
> You'd have to provide hand-written code that implements the sequence
protocol and proxies for the underlying array.
>
> ...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?
>
> (Although as this case is const you could get away with creating a tuple
with the same elements.)
>
> Acknowledged. But even for SIP_PYTUPLE, I'd need the same directives
wouldn't I?
You have to write pure C code - no help from SIP.
As I feared. Thanks for confirming.
Shaheed
Phil
[Attachment #5 (text/html)]
<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On 5 \
Sep 2017 17:42, "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 5 Sep \
2017, at 5:39 pm, Shaheed Haque <<a \
href="mailto:srhaque@theiet.org">srhaque@theiet.org</a>> wrote:<br> ><br>
><br>
><br>
> On 5 Sep 2017 17:00, "Phil Thompson" <<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>> \
wrote:<br> > 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>
> Arrays aren't really supported by SIP at all.<br>
><br>
> I get that...<br>
><br>
> You'd have to provide hand-written code that implements the sequence \
protocol and proxies for the underlying array.<br> ><br>
> ...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?<br> ><br>
> (Although as this case is const you could get away with creating a tuple with \
the same elements.)<br> ><br>
> Acknowledged. But even for SIP_PYTUPLE, I'd need the same directives \
wouldn't I?<br> <br>
</div>You have to write pure C code - no help from \
SIP.<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">As I \
feared. Thanks for confirming.</div><div dir="auto"><br></div><div \
dir="auto">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>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic