Extracting 4 wchar_t's from int64

--00000000000027b02805b8e4ce26
Content-Type: text/plain; charset="UTF-8"

Let me preface this by saying if I were using a lower level language (like
C) I wouldn't have this problem; as I know how to shift and mask
accordingly.

On raku however, how to do so *eloquantly* eludes me.

I've defined a CStruct as follows:

class test is repr('CStruct') {

  has int64 $.a1;

  has int64 $.a2;

  ...

  has int64 $.a65;

}

Under normal circumstances I would have defined the member as:
`HAS int16 @.a[260] is CArray` however that seems to be broken. See:

https://github.com/rakudo/rakudo/issues/3633

The function that gets called with these members $.a1 .. $.a65 should get
filled with a wchar_t character array.

Does raku employ a simple method of decoding the 4 wchar_t's that get
placed into a int64 structure?  The characters I'd like to extract are at
bit positions [15:0], [31.16], [47:32], [63:48]

I'm imagining something along the lines of:

buf16.new( $.a1, ... $.a64);

.... but that doesn't quite work like I would expect.

Thanks,
~Paul

-- 
__________________

:(){ :|:& };:

--00000000000027b02805b8e4ce26
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Let me preface this by saying if I were using a lower=
 level language (like C) I wouldn&#39;t have this problem; as I know how to=
 shift and mask accordingly.</div><div><br></div><div>On raku however, how =
to do so *eloquantly* eludes me.<br></div><div><br></div><div>I&#39;ve defi=
ned a CStruct as follows:<br><br><pre style=3D"background-color:rgb(255,255=
,255);color:rgb(8,8,8);font-family:&quot;JetBrains Mono&quot;,monospace;fon=
t-size:9.8pt"><span style=3D"color:rgb(0,51,179)">class </span><span style=
=3D"color:rgb(75,0,130)">test </span><span style=3D"color:rgb(0,51,179)">is=
 </span><span style=3D"color:rgb(75,0,130)">repr</span>(<span style=3D"colo=
r:rgb(6,125,23)">&#39;CStruct&#39;</span>) {<br></pre><pre style=3D"backgro=
und-color:rgb(255,255,255);color:rgb(8,8,8);font-family:&quot;JetBrains Mon=
o&quot;,monospace;font-size:9.8pt">  has int64 $.a1;<br></pre><pre style=3D=
"background-color:rgb(255,255,255);color:rgb(8,8,8);font-family:&quot;JetBr=
ains Mono&quot;,monospace;font-size:9.8pt">  has int64 $.a2;<br><br>  ...<b=
r></pre><pre style=3D"background-color:rgb(255,255,255);color:rgb(8,8,8);fo=
nt-family:&quot;JetBrains Mono&quot;,monospace;font-size:9.8pt">  has int64=
 $.a65; <br></pre><pre style=3D"background-color:rgb(255,255,255);color:rgb=
(8,8,8);font-family:&quot;JetBrains Mono&quot;,monospace;font-size:9.8pt">}=
<br></pre></div><div>Under normal circumstances I would have defined the me=
mber as:</div><div>`HAS int16 @.a[260] is CArray` however that seems to be =
broken. See:<br><br><a href=3D"https://github.com/rakudo/rakudo/issues/3633=
">https://github.com/rakudo/rakudo/issues/3633</a><br><br></div><div>The fu=
nction that gets called with these members $.a1 .. $.a65 should get filled =
with a wchar_t character array.<br><br></div><div>Does raku employ a simple=
 method of decoding the 4 wchar_t&#39;s that get placed into a int64 struct=
ure?=C2=A0 The characters I&#39;d like to extract are at bit positions [15:=
0], [31.16], [47:32], [63:48] <br></div><div><br></div><div>I&#39;m imagini=
ng something along the lines of:</div><div><br></div><div>buf16.new( $.a1, =
.... $.a64);</div><div><br></div><div>... but that doesn&#39;t quite work li=
ke I would expect.</div><div><br></div><div>Thanks,</div><div>~Paul<br></di=
v><div><br>-- <br><div dir=3D"ltr" class=3D"gmail_signature" data-smartmail=
=3D"gmail_signature">__________________<br><br>:(){ :|:&amp; };:</div></div=
></div>

--00000000000027b02805b8e4ce26--
0
pprocacci
1/14/2021 11:42:02 PM
perl.perl6.users 1545 articles. 0 followers. Follow

6 Replies
47 Views

Similar Articles

[PageSpeed] 47

On 1/14/21 3:42 PM, Paul Procacci wrote:
> Let me preface this by saying if I were using a lower level language=20
> (like C) I wouldn't have this problem; as I know how to shift and mask =

> accordingly.
>=20
> On raku however, how to do so *eloquantly* eludes me.
>=20
> I've defined a CStruct as follows:
>=20
> class test is repr('CStruct') {
>=20
>    has int64 $.a1;
>=20
>    has int64 $.a2;
>=20
>    ...
>=20
>    has int64 $.a65;
>=20
> }
>=20
> Under normal circumstances I would have defined the member as:
> `HAS int16 @.a[260] is CArray` however that seems to be broken. See:
>=20
> https://github.com/rakudo/rakudo/issues/3633=20
> <https://github.com/rakudo/rakudo/issues/3633>
>=20
> The function that gets called with these members $.a1 .. $.a65 should=20
> get filled with a wchar_t character array.
>=20
> Does raku employ a simple method of decoding the 4 wchar_t's that get=20
> placed into a int64 structure?=C2=A0 The characters I'd like to extract=
 are=20
> at bit positions [15:0], [31.16], [47:32], [63:48]
>=20
> I'm imagining something along the lines of:
>=20
> buf16.new( $.a1, ... $.a64);
>=20
> ... but that doesn't quite work like I would expect.
>=20
> Thanks,
> ~Paul

Hi Paul,

Would you post the system call you are trying to
interface with?

-T

0
perl6
1/15/2021 12:29:53 AM
--000000000000bb7d2b05b8e583cd
Content-Type: text/plain; charset="UTF-8"

https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot

On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 1/14/21 3:42 PM, Paul Procacci wrote:
> > Let me preface this by saying if I were using a lower level language
> > (like C) I wouldn't have this problem; as I know how to shift and mask
> > accordingly.
> >
> > On raku however, how to do so *eloquantly* eludes me.
> >
> > I've defined a CStruct as follows:
> >
> > class test is repr('CStruct') {
> >
> >    has int64 $.a1;
> >
> >    has int64 $.a2;
> >
> >    ...
> >
> >    has int64 $.a65;
> >
> > }
> >
> > Under normal circumstances I would have defined the member as:
> > `HAS int16 @.a[260] is CArray` however that seems to be broken. See:
> >
> > https://github.com/rakudo/rakudo/issues/3633
> > <https://github.com/rakudo/rakudo/issues/3633>
> >
> > The function that gets called with these members $.a1 .. $.a65 should
> > get filled with a wchar_t character array.
> >
> > Does raku employ a simple method of decoding the 4 wchar_t's that get
> > placed into a int64 structure?  The characters I'd like to extract are
> > at bit positions [15:0], [31.16], [47:32], [63:48]
> >
> > I'm imagining something along the lines of:
> >
> > buf16.new( $.a1, ... $.a64);
> >
> > ... but that doesn't quite work like I would expect.
> >
> > Thanks,
> > ~Paul
>
> Hi Paul,
>
> Would you post the system call you are trying to
> interface with?
>
> -T
>
>

-- 
__________________

:(){ :|:& };:

--000000000000bb7d2b05b8e583cd
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><a href=3D"https://docs.microsoft.com/en-us/windows/win32/=
api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot">https://docs.microsoft.c=
om/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot</a=
></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr"=
>On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users &lt;<a href=
=3D"mailto:perl6-users@perl.org">perl6-users@perl.org</a>&gt; wrote:<br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/14/21 3:42 PM, Pa=
ul Procacci wrote:<br>
&gt; Let me preface this by saying if I were using a lower level language <=
br>
&gt; (like C) I wouldn&#39;t have this problem; as I know how to shift and =
mask <br>
&gt; accordingly.<br>
&gt; <br>
&gt; On raku however, how to do so *eloquantly* eludes me.<br>
&gt; <br>
&gt; I&#39;ve defined a CStruct as follows:<br>
&gt; <br>
&gt; class test is repr(&#39;CStruct&#39;) {<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 has int64 $.a1;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 has int64 $.a2;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 ...<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 has int64 $.a65;<br>
&gt; <br>
&gt; }<br>
&gt; <br>
&gt; Under normal circumstances I would have defined the member as:<br>
&gt; `HAS int16 @.a[260] is CArray` however that seems to be broken. See:<b=
r>
&gt; <br>
&gt; <a href=3D"https://github.com/rakudo/rakudo/issues/3633" rel=3D"norefe=
rrer" target=3D"_blank">https://github.com/rakudo/rakudo/issues/3633</a> <b=
r>
&gt; &lt;<a href=3D"https://github.com/rakudo/rakudo/issues/3633" rel=3D"no=
referrer" target=3D"_blank">https://github.com/rakudo/rakudo/issues/3633</a=
>&gt;<br>
&gt; <br>
&gt; The function that gets called with these members $.a1 .. $.a65 should =
<br>
&gt; get filled with a wchar_t character array.<br>
&gt; <br>
&gt; Does raku employ a simple method of decoding the 4 wchar_t&#39;s that =
get <br>
&gt; placed into a int64 structure?=C2=A0 The characters I&#39;d like to ex=
tract are <br>
&gt; at bit positions [15:0], [31.16], [47:32], [63:48]<br>
&gt; <br>
&gt; I&#39;m imagining something along the lines of:<br>
&gt; <br>
&gt; buf16.new( $.a1, ... $.a64);<br>
&gt; <br>
&gt; ... but that doesn&#39;t quite work like I would expect.<br>
&gt; <br>
&gt; Thanks,<br>
&gt; ~Paul<br>
<br>
Hi Paul,<br>
<br>
Would you post the system call you are trying to<br>
interface with?<br>
<br>
-T<br>
<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature">__________________<br><br>:(){ :|:&amp; };:</div>

--000000000000bb7d2b05b8e583cd--
0
pprocacci
1/15/2021 12:32:48 AM
On 1/14/21 4:32 PM, Paul Procacci wrote:
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32=
-createtoolhelp32snapshot=20
> <https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp3=
2-createtoolhelp32snapshot>
>=20
> On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users=20
> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>=20
>     On 1/14/21 3:42 PM, Paul Procacci wrote:
>      > Let me preface this by saying if I were using a lower level lang=
uage
>      > (like C) I wouldn't have this problem; as I know how to shift an=
d
>     mask
>      > accordingly.
>      >
>      > On raku however, how to do so *eloquantly* eludes me.
>      >
>      > I've defined a CStruct as follows:
>      >
>      > class test is repr('CStruct') {
>      >
>      >=C2=A0 =C2=A0 has int64 $.a1;
>      >
>      >=C2=A0 =C2=A0 has int64 $.a2;
>      >
>      >=C2=A0 =C2=A0 ...
>      >
>      >=C2=A0 =C2=A0 has int64 $.a65;
>      >
>      > }
>      >
>      > Under normal circumstances I would have defined the member as:
>      > `HAS int16 @.a[260] is CArray` however that seems to be broken. =
See:
>      >
>      > https://github.com/rakudo/rakudo/issues/3633
>     <https://github.com/rakudo/rakudo/issues/3633>
>      > <https://github.com/rakudo/rakudo/issues/3633
>     <https://github.com/rakudo/rakudo/issues/3633>>
>      >
>      > The function that gets called with these members $.a1 .. $.a65
>     should
>      > get filled with a wchar_t character array.
>      >
>      > Does raku employ a simple method of decoding the 4 wchar_t's tha=
t
>     get
>      > placed into a int64 structure?=C2=A0 The characters I'd like to
>     extract are
>      > at bit positions [15:0], [31.16], [47:32], [63:48]
>      >
>      > I'm imagining something along the lines of:
>      >
>      > buf16.new( $.a1, ... $.a64);
>      >
>      > ... but that doesn't quite work like I would expect.
>      >
>      > Thanks,
>      > ~Paul
>=20
>     Hi Paul,
>=20
>     Would you post the system call you are trying to
>     interface with?
>=20
>     -T


Did you see?

https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot=
-and-viewing-processes

0
perl6
1/15/2021 2:57:47 AM
--000000000000478c0305b8e81b2d
Content-Type: text/plain; charset="UTF-8"

I may have.

Regardless, I have written a proof of concept in 'C' which works.
My question isn't how to interface with the Windows Operating System
because I have already done so in 'C' quite easily.

My question pertains to working around the bug as described here:
https://github.com/rakudo/rakudo/issues/3633
Do you have any comments concerning this bug and/or the approach I'm taking?
Passing a flattened array of 260 int16's doesn't work so my approach is
passing 65 non-flattened int64's.

The 65 int64's are in fact being utilized by the callee, yet I'm looking
for a method to reconstruct this back into 260 wchar_t's (which has a width
of 16)  w/ a simple method that doesn't include me walking the int64 and
masking the chars out myself.
Does this exist.

Thanks,
~Paul

On Thu, Jan 14, 2021 at 9:58 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 1/14/21 4:32 PM, Paul Procacci wrote:
> >
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
> > <
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
> >
> >
> > On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users
> > <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
> >
> >     On 1/14/21 3:42 PM, Paul Procacci wrote:
> >      > Let me preface this by saying if I were using a lower level
> language
> >      > (like C) I wouldn't have this problem; as I know how to shift and
> >     mask
> >      > accordingly.
> >      >
> >      > On raku however, how to do so *eloquantly* eludes me.
> >      >
> >      > I've defined a CStruct as follows:
> >      >
> >      > class test is repr('CStruct') {
> >      >
> >      >    has int64 $.a1;
> >      >
> >      >    has int64 $.a2;
> >      >
> >      >    ...
> >      >
> >      >    has int64 $.a65;
> >      >
> >      > }
> >      >
> >      > Under normal circumstances I would have defined the member as:
> >      > `HAS int16 @.a[260] is CArray` however that seems to be broken.
> See:
> >      >
> >      > https://github.com/rakudo/rakudo/issues/3633
> >     <https://github.com/rakudo/rakudo/issues/3633>
> >      > <https://github.com/rakudo/rakudo/issues/3633
> >     <https://github.com/rakudo/rakudo/issues/3633>>
> >      >
> >      > The function that gets called with these members $.a1 .. $.a65
> >     should
> >      > get filled with a wchar_t character array.
> >      >
> >      > Does raku employ a simple method of decoding the 4 wchar_t's that
> >     get
> >      > placed into a int64 structure?  The characters I'd like to
> >     extract are
> >      > at bit positions [15:0], [31.16], [47:32], [63:48]
> >      >
> >      > I'm imagining something along the lines of:
> >      >
> >      > buf16.new( $.a1, ... $.a64);
> >      >
> >      > ... but that doesn't quite work like I would expect.
> >      >
> >      > Thanks,
> >      > ~Paul
> >
> >     Hi Paul,
> >
> >     Would you post the system call you are trying to
> >     interface with?
> >
> >     -T
>
>
> Did you see?
>
>
> https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes
>
>

-- 
__________________

:(){ :|:& };:

--000000000000478c0305b8e81b2d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I may have.</div><div><br></div><div>Regardless, I ha=
ve written a proof of concept in &#39;C&#39; which works.<br></div><div>My =
question isn&#39;t how to interface with the Windows Operating System becau=
se I have already done so in &#39;C&#39; quite easily.<br><br></div><div>My=
 question pertains to working around the bug as described here:=C2=A0 <a hr=
ef=3D"https://github.com/rakudo/rakudo/issues/3633">https://github.com/raku=
do/rakudo/issues/3633</a><br></div><div>Do you have any comments concerning=
 this bug and/or the approach I&#39;m taking?<br></div><div>Passing a flatt=
ened array of 260 int16&#39;s doesn&#39;t work so my approach is passing 65=
 non-flattened int64&#39;s.<br><br></div><div>The 65 int64&#39;s are in fac=
t being utilized by the callee, yet I&#39;m looking for a method to reconst=
ruct this back into 260 wchar_t&#39;s (which has a width of 16)=C2=A0 w/ a =
simple method that doesn&#39;t include me walking the int64 and masking the=
 chars out myself.<br></div><div>Does this exist.<br></div><div><br></div><=
div>Thanks,</div><div>~Paul<br> </div></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jan 14, 2021 at 9:58 PM ToddA=
ndMargo via perl6-users &lt;<a href=3D"mailto:perl6-users@perl.org">perl6-u=
sers@perl.org</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddi=
ng-left:1ex">On 1/14/21 4:32 PM, Paul Procacci wrote:<br>
&gt; <a href=3D"https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32=
/nf-tlhelp32-createtoolhelp32snapshot" rel=3D"noreferrer" target=3D"_blank"=
>https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-cr=
eatetoolhelp32snapshot</a> <br>
&gt; &lt;<a href=3D"https://docs.microsoft.com/en-us/windows/win32/api/tlhe=
lp32/nf-tlhelp32-createtoolhelp32snapshot" rel=3D"noreferrer" target=3D"_bl=
ank">https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp3=
2-createtoolhelp32snapshot</a>&gt;<br>
&gt; <br>
&gt; On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users <br>
&gt; &lt;<a href=3D"mailto:perl6-users@perl.org" target=3D"_blank">perl6-us=
ers@perl.org</a> &lt;mailto:<a href=3D"mailto:perl6-users@perl.org" target=
=3D"_blank">perl6-users@perl.org</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 1/14/21 3:42 PM, Paul Procacci wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Let me preface this by saying if I were using=
 a lower level language<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; (like C) I wouldn&#39;t have this problem; as=
 I know how to shift and<br>
&gt;=C2=A0 =C2=A0 =C2=A0mask<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; accordingly.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; On raku however, how to do so *eloquantly* el=
udes me.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; I&#39;ve defined a CStruct as follows:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; class test is repr(&#39;CStruct&#39;) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 has int64 $.a1;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 has int64 $.a2;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 ...<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 has int64 $.a65;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; }<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Under normal circumstances I would have defin=
ed the member as:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; `HAS int16 @.a[260] is CArray` however that s=
eems to be broken. See:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; <a href=3D"https://github.com/rakudo/rakudo/i=
ssues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/=
rakudo/issues/3633</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/rakudo/rakudo/iss=
ues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/ra=
kudo/issues/3633</a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; &lt;<a href=3D"https://github.com/rakudo/raku=
do/issues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rak=
udo/rakudo/issues/3633</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/rakudo/rakudo/iss=
ues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/ra=
kudo/issues/3633</a>&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; The function that gets called with these memb=
ers $.a1 .. $.a65<br>
&gt;=C2=A0 =C2=A0 =C2=A0should<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; get filled with a wchar_t character array.<br=
>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Does raku employ a simple method of decoding =
the 4 wchar_t&#39;s that<br>
&gt;=C2=A0 =C2=A0 =C2=A0get<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; placed into a int64 structure?=C2=A0 The char=
acters I&#39;d like to<br>
&gt;=C2=A0 =C2=A0 =C2=A0extract are<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; at bit positions [15:0], [31.16], [47:32], [6=
3:48]<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; I&#39;m imagining something along the lines o=
f:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; buf16.new( $.a1, ... $.a64);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; ... but that doesn&#39;t quite work like I wo=
uld expect.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; Thanks,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; ~Paul<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Hi Paul,<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Would you post the system call you are trying to<br=
>
&gt;=C2=A0 =C2=A0 =C2=A0interface with?<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0-T<br>
<br>
<br>
Did you see?<br>
<br>
<a href=3D"https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a=
-snapshot-and-viewing-processes" rel=3D"noreferrer" target=3D"_blank">https=
://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-vi=
ewing-processes</a><br>
<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature">__________________<br><br>:(){ :|:&amp; };:</div>

--000000000000478c0305b8e81b2d--
0
pprocacci
1/15/2021 3:38:21 AM
On 1/14/21 7:38 PM, Paul Procacci wrote:
> I may have.
>=20
> Regardless, I have written a proof of concept in 'C' which works.
> My question isn't how to interface with the Windows Operating System=20
> because I have already done so in 'C' quite easily.
>=20
> My question pertains to working around the bug as described here:=20
> https://github.com/rakudo/rakudo/issues/3633=20
> <https://github.com/rakudo/rakudo/issues/3633>
> Do you have any comments concerning this bug and/or the approach I'm ta=
king?
> Passing a flattened array of 260 int16's doesn't work so my approach is=
=20
> passing 65 non-flattened int64's.
>=20
> The 65 int64's are in fact being utilized by the callee, yet I'm lookin=
g=20
> for a method to reconstruct this back into 260 wchar_t's (which has a=20
> width of 16)=C2=A0 w/ a simple method that doesn't include me walking t=
he=20
> int64 and masking the chars out myself.
> Does this exist.
>=20
> Thanks,
> ~Paul
>=20
> On Thu, Jan 14, 2021 at 9:58 PM ToddAndMargo via perl6-users=20
> <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
>=20
>     On 1/14/21 4:32 PM, Paul Procacci wrote:
>      >
>     https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhe=
lp32-createtoolhelp32snapshot
>     <https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlh=
elp32-createtoolhelp32snapshot>
>=20
>      >
>     <https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlh=
elp32-createtoolhelp32snapshot
>     <https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlh=
elp32-createtoolhelp32snapshot>>
>      >
>      > On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users
>      > <perl6-users@perl.org <mailto:perl6-users@perl.org>
>     <mailto:perl6-users@perl.org <mailto:perl6-users@perl.org>>> wrote:=

>      >
>      >=C2=A0 =C2=A0 =C2=A0On 1/14/21 3:42 PM, Paul Procacci wrote:
>      >=C2=A0 =C2=A0 =C2=A0 > Let me preface this by saying if I were us=
ing a lower
>     level language
>      >=C2=A0 =C2=A0 =C2=A0 > (like C) I wouldn't have this problem; as =
I know how to
>     shift and
>      >=C2=A0 =C2=A0 =C2=A0mask
>      >=C2=A0 =C2=A0 =C2=A0 > accordingly.
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > On raku however, how to do so *eloquantly*=
 eludes me.
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > I've defined a CStruct as follows:
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > class test is repr('CStruct') {
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 has int64 $.a1;
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 has int64 $.a2;
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 ...
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 >=C2=A0 =C2=A0 has int64 $.a65;
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > }
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > Under normal circumstances I would have de=
fined the member as:
>      >=C2=A0 =C2=A0 =C2=A0 > `HAS int16 @.a[260] is CArray` however tha=
t seems to be
>     broken. See:
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > https://github.com/rakudo/rakudo/issues/36=
33
>     <https://github.com/rakudo/rakudo/issues/3633>
>      >=C2=A0 =C2=A0 =C2=A0<https://github.com/rakudo/rakudo/issues/3633=

>     <https://github.com/rakudo/rakudo/issues/3633>>
>      >=C2=A0 =C2=A0 =C2=A0 > <https://github.com/rakudo/rakudo/issues/3=
633
>     <https://github.com/rakudo/rakudo/issues/3633>
>      >=C2=A0 =C2=A0 =C2=A0<https://github.com/rakudo/rakudo/issues/3633=

>     <https://github.com/rakudo/rakudo/issues/3633>>>
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > The function that gets called with these m=
embers $.a1 .. $.a65
>      >=C2=A0 =C2=A0 =C2=A0should
>      >=C2=A0 =C2=A0 =C2=A0 > get filled with a wchar_t character array.=

>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > Does raku employ a simple method of decodi=
ng the 4
>     wchar_t's that
>      >=C2=A0 =C2=A0 =C2=A0get
>      >=C2=A0 =C2=A0 =C2=A0 > placed into a int64 structure?=C2=A0 The c=
haracters I'd like to
>      >=C2=A0 =C2=A0 =C2=A0extract are
>      >=C2=A0 =C2=A0 =C2=A0 > at bit positions [15:0], [31.16], [47:32],=
 [63:48]
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > I'm imagining something along the lines of=
:
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > buf16.new( $.a1, ... $.a64);
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > ... but that doesn't quite work like I wou=
ld expect.
>      >=C2=A0 =C2=A0 =C2=A0 >
>      >=C2=A0 =C2=A0 =C2=A0 > Thanks,
>      >=C2=A0 =C2=A0 =C2=A0 > ~Paul
>      >
>      >=C2=A0 =C2=A0 =C2=A0Hi Paul,
>      >
>      >=C2=A0 =C2=A0 =C2=A0Would you post the system call you are trying=
 to
>      >=C2=A0 =C2=A0 =C2=A0interface with?
>      >
>      >=C2=A0 =C2=A0 =C2=A0-T
>=20
>=20
>     Did you see?
>=20
>     https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-sn=
apshot-and-viewing-processes
>     <https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-s=
napshot-and-viewing-processes>

I am not following the bug.  :'(

Would you mind posting your C code?

And the output of your C code?


0
perl6
1/15/2021 4:00:02 AM
--0000000000001139ce05b8e8c914
Content-Type: text/plain; charset="UTF-8"

My C code has nothing to do with the question I'm asking.
I'll share it anyway to my dismay.

static int raidFillProcessStruct(raidProcess* process)
> {
> process->handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
> if (process->handle == INVALID_HANDLE_VALUE) return 0;
>
> process->entry.dwSize = sizeof(process->entry);
> if (Process32First(process->handle, &process->entry)) {
> do {
> if (!wcscmp(L"Raid.exe", process->entry.szExeFile)) {
> CloseHandle(process->handle);
> return 1;
> }
> } while (Process32Next(process->handle, &process->entry));
> }
>
> CloseHandle(process->handle);
> return 0;
> }
>
>
My C code also doesn't print anything as that's not it's intention.  It
returns with an appropriate exit code which
is all my proof of concept measures.

The above is besides the point however and functions as expected.

I have defined a CStruct that contains 65 non inlined int64's.
Each int64 contains four int16's that I need to extract at the following
bit positions:  [0,15], [16,31], [32, 47], [48, 63]

What method accomplishes this, if any?
I'm ok with no function existing in which case I'll need to roll my own,
but this is the premise for this email.


On Thu, Jan 14, 2021 at 11:00 PM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

> On 1/14/21 7:38 PM, Paul Procacci wrote:
> > I may have.
> >
> > Regardless, I have written a proof of concept in 'C' which works.
> > My question isn't how to interface with the Windows Operating System
> > because I have already done so in 'C' quite easily.
> >
> > My question pertains to working around the bug as described here:
> > https://github.com/rakudo/rakudo/issues/3633
> > <https://github.com/rakudo/rakudo/issues/3633>
> > Do you have any comments concerning this bug and/or the approach I'm
> taking?
> > Passing a flattened array of 260 int16's doesn't work so my approach is
> > passing 65 non-flattened int64's.
> >
> > The 65 int64's are in fact being utilized by the callee, yet I'm looking
> > for a method to reconstruct this back into 260 wchar_t's (which has a
> > width of 16)  w/ a simple method that doesn't include me walking the
> > int64 and masking the chars out myself.
> > Does this exist.
> >
> > Thanks,
> > ~Paul
> >
> > On Thu, Jan 14, 2021 at 9:58 PM ToddAndMargo via perl6-users
> > <perl6-users@perl.org <mailto:perl6-users@perl.org>> wrote:
> >
> >     On 1/14/21 4:32 PM, Paul Procacci wrote:
> >      >
> >
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
> >     <
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
> >
> >
> >      >
> >     <
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
> >     <
> https://docs.microsoft.com/en-us/windows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot
> >>
> >      >
> >      > On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo via perl6-users
> >      > <perl6-users@perl.org <mailto:perl6-users@perl.org>
> >     <mailto:perl6-users@perl.org <mailto:perl6-users@perl.org>>> wrote:
> >      >
> >      >     On 1/14/21 3:42 PM, Paul Procacci wrote:
> >      >      > Let me preface this by saying if I were using a lower
> >     level language
> >      >      > (like C) I wouldn't have this problem; as I know how to
> >     shift and
> >      >     mask
> >      >      > accordingly.
> >      >      >
> >      >      > On raku however, how to do so *eloquantly* eludes me.
> >      >      >
> >      >      > I've defined a CStruct as follows:
> >      >      >
> >      >      > class test is repr('CStruct') {
> >      >      >
> >      >      >    has int64 $.a1;
> >      >      >
> >      >      >    has int64 $.a2;
> >      >      >
> >      >      >    ...
> >      >      >
> >      >      >    has int64 $.a65;
> >      >      >
> >      >      > }
> >      >      >
> >      >      > Under normal circumstances I would have defined the member
> as:
> >      >      > `HAS int16 @.a[260] is CArray` however that seems to be
> >     broken. See:
> >      >      >
> >      >      > https://github.com/rakudo/rakudo/issues/3633
> >     <https://github.com/rakudo/rakudo/issues/3633>
> >      >     <https://github.com/rakudo/rakudo/issues/3633
> >     <https://github.com/rakudo/rakudo/issues/3633>>
> >      >      > <https://github.com/rakudo/rakudo/issues/3633
> >     <https://github.com/rakudo/rakudo/issues/3633>
> >      >     <https://github.com/rakudo/rakudo/issues/3633
> >     <https://github.com/rakudo/rakudo/issues/3633>>>
> >      >      >
> >      >      > The function that gets called with these members $.a1 ..
> $.a65
> >      >     should
> >      >      > get filled with a wchar_t character array.
> >      >      >
> >      >      > Does raku employ a simple method of decoding the 4
> >     wchar_t's that
> >      >     get
> >      >      > placed into a int64 structure?  The characters I'd like to
> >      >     extract are
> >      >      > at bit positions [15:0], [31.16], [47:32], [63:48]
> >      >      >
> >      >      > I'm imagining something along the lines of:
> >      >      >
> >      >      > buf16.new( $.a1, ... $.a64);
> >      >      >
> >      >      > ... but that doesn't quite work like I would expect.
> >      >      >
> >      >      > Thanks,
> >      >      > ~Paul
> >      >
> >      >     Hi Paul,
> >      >
> >      >     Would you post the system call you are trying to
> >      >     interface with?
> >      >
> >      >     -T
> >
> >
> >     Did you see?
> >
> >
> https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes
> >     <
> https://docs.microsoft.com/en-us/windows/win32/toolhelp/taking-a-snapshot-and-viewing-processes
> >
>
> I am not following the bug.  :'(
>
> Would you mind posting your C code?
>
> And the output of your C code?
>
>
>

-- 
__________________

:(){ :|:& };:

--0000000000001139ce05b8e8c914
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>My C code has nothing to do with the question I&#39;m=
 asking.<br></div><div>I&#39;ll share it anyway to my dismay.<br><br><block=
quote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1=
px solid rgb(204,204,204);padding-left:1ex">static int raidFillProcessStruc=
t(raidProcess* process)<br>{<br>	process-&gt;handle =3D CreateToolhelp32Sna=
pshot(TH32CS_SNAPPROCESS, NULL);<br>	if (process-&gt;handle =3D=3D INVALID_=
HANDLE_VALUE) return 0;<br><br>	process-&gt;entry.dwSize =3D sizeof(process=
-&gt;entry);<br>	if (Process32First(process-&gt;handle, &amp;process-&gt;en=
try)) {<br>		do {<br>			if (!wcscmp(L&quot;Raid.exe&quot;, process-&gt;entr=
y.szExeFile)) {<br>				CloseHandle(process-&gt;handle);<br>				return 1;<br=
>			}<br>		} while (Process32Next(process-&gt;handle, &amp;process-&gt;entr=
y));<br>	}<br><br>	CloseHandle(process-&gt;handle);<br>	return 0;<br>}<br><=
br></blockquote><div><br></div><div>My C code also doesn&#39;t print anythi=
ng as that&#39;s not it&#39;s intention.=C2=A0 It returns with an appropria=
te exit code which</div><div>is all my proof of concept measures.<br><br></=
div><div>The above is besides the point however and functions as expected.<=
br></div><div><br></div></div><div>I have defined a CStruct that contains 6=
5 non inlined int64&#39;s.</div><div>Each int64 contains four int16&#39;s t=
hat I need to extract at the following bit positions:=C2=A0 [0,15], [16,31]=
, [32, 47], [48, 63]<br><br></div><div>What method accomplishes this, if an=
y?<br></div><div>I&#39;m ok with no function existing in which case I&#39;l=
l need to roll my own, but this is the premise for this email.<br></div><di=
v><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"=
gmail_attr">On Thu, Jan 14, 2021 at 11:00 PM ToddAndMargo via perl6-users &=
lt;<a href=3D"mailto:perl6-users@perl.org">perl6-users@perl.org</a>&gt; wro=
te:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 1/14/21 7=
:38 PM, Paul Procacci wrote:<br>
&gt; I may have.<br>
&gt; <br>
&gt; Regardless, I have written a proof of concept in &#39;C&#39; which wor=
ks.<br>
&gt; My question isn&#39;t how to interface with the Windows Operating Syst=
em <br>
&gt; because I have already done so in &#39;C&#39; quite easily.<br>
&gt; <br>
&gt; My question pertains to working around the bug as described here: <br>
&gt; <a href=3D"https://github.com/rakudo/rakudo/issues/3633" rel=3D"norefe=
rrer" target=3D"_blank">https://github.com/rakudo/rakudo/issues/3633</a> <b=
r>
&gt; &lt;<a href=3D"https://github.com/rakudo/rakudo/issues/3633" rel=3D"no=
referrer" target=3D"_blank">https://github.com/rakudo/rakudo/issues/3633</a=
>&gt;<br>
&gt; Do you have any comments concerning this bug and/or the approach I&#39=
;m taking?<br>
&gt; Passing a flattened array of 260 int16&#39;s doesn&#39;t work so my ap=
proach is <br>
&gt; passing 65 non-flattened int64&#39;s.<br>
&gt; <br>
&gt; The 65 int64&#39;s are in fact being utilized by the callee, yet I&#39=
;m looking <br>
&gt; for a method to reconstruct this back into 260 wchar_t&#39;s (which ha=
s a <br>
&gt; width of 16)=C2=A0 w/ a simple method that doesn&#39;t include me walk=
ing the <br>
&gt; int64 and masking the chars out myself.<br>
&gt; Does this exist.<br>
&gt; <br>
&gt; Thanks,<br>
&gt; ~Paul<br>
&gt; <br>
&gt; On Thu, Jan 14, 2021 at 9:58 PM ToddAndMargo via perl6-users <br>
&gt; &lt;<a href=3D"mailto:perl6-users@perl.org" target=3D"_blank">perl6-us=
ers@perl.org</a> &lt;mailto:<a href=3D"mailto:perl6-users@perl.org" target=
=3D"_blank">perl6-users@perl.org</a>&gt;&gt; wrote:<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0On 1/14/21 4:32 PM, Paul Procacci wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"https://docs.microsoft.com/en-us/windows=
/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot" rel=3D"noreferrer=
" target=3D"_blank">https://docs.microsoft.com/en-us/windows/win32/api/tlhe=
lp32/nf-tlhelp32-createtoolhelp32snapshot</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://docs.microsoft.com/en-us/win=
dows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot" rel=3D"norefe=
rrer" target=3D"_blank">https://docs.microsoft.com/en-us/windows/win32/api/=
tlhelp32/nf-tlhelp32-createtoolhelp32snapshot</a>&gt;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://docs.microsoft.com/en-us/win=
dows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot" rel=3D"norefe=
rrer" target=3D"_blank">https://docs.microsoft.com/en-us/windows/win32/api/=
tlhelp32/nf-tlhelp32-createtoolhelp32snapshot</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://docs.microsoft.com/en-us/win=
dows/win32/api/tlhelp32/nf-tlhelp32-createtoolhelp32snapshot" rel=3D"norefe=
rrer" target=3D"_blank">https://docs.microsoft.com/en-us/windows/win32/api/=
tlhelp32/nf-tlhelp32-createtoolhelp32snapshot</a>&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; On Thu, Jan 14, 2021 at 7:30 PM ToddAndMargo =
via perl6-users<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt; &lt;<a href=3D"mailto:perl6-users@perl.org" t=
arget=3D"_blank">perl6-users@perl.org</a> &lt;mailto:<a href=3D"mailto:perl=
6-users@perl.org" target=3D"_blank">perl6-users@perl.org</a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;mailto:<a href=3D"mailto:perl6-users@perl.org" =
target=3D"_blank">perl6-users@perl.org</a> &lt;mailto:<a href=3D"mailto:per=
l6-users@perl.org" target=3D"_blank">perl6-users@perl.org</a>&gt;&gt;&gt; w=
rote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0On 1/14/21 3:42 PM, Paul P=
rocacci wrote:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; Let me preface this =
by saying if I were using a lower<br>
&gt;=C2=A0 =C2=A0 =C2=A0level language<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; (like C) I wouldn&#3=
9;t have this problem; as I know how to<br>
&gt;=C2=A0 =C2=A0 =C2=A0shift and<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0mask<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; accordingly.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; On raku however, how=
 to do so *eloquantly* eludes me.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; I&#39;ve defined a C=
Struct as follows:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; class test is repr(&=
#39;CStruct&#39;) {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 has int=
64 $.a1;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 has int=
64 $.a2;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 ...<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 has int=
64 $.a65;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; }<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; Under normal circums=
tances I would have defined the member as:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; `HAS int16 @.a[260] =
is CArray` however that seems to be<br>
&gt;=C2=A0 =C2=A0 =C2=A0broken. See:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; <a href=3D"https://g=
ithub.com/rakudo/rakudo/issues/3633" rel=3D"noreferrer" target=3D"_blank">h=
ttps://github.com/rakudo/rakudo/issues/3633</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/rakudo/rakudo/iss=
ues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/ra=
kudo/issues/3633</a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://git=
hub.com/rakudo/rakudo/issues/3633" rel=3D"noreferrer" target=3D"_blank">htt=
ps://github.com/rakudo/rakudo/issues/3633</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/rakudo/rakudo/iss=
ues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/ra=
kudo/issues/3633</a>&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; &lt;<a href=3D"https=
://github.com/rakudo/rakudo/issues/3633" rel=3D"noreferrer" target=3D"_blan=
k">https://github.com/rakudo/rakudo/issues/3633</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/rakudo/rakudo/iss=
ues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/ra=
kudo/issues/3633</a>&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://git=
hub.com/rakudo/rakudo/issues/3633" rel=3D"noreferrer" target=3D"_blank">htt=
ps://github.com/rakudo/rakudo/issues/3633</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://github.com/rakudo/rakudo/iss=
ues/3633" rel=3D"noreferrer" target=3D"_blank">https://github.com/rakudo/ra=
kudo/issues/3633</a>&gt;&gt;&gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; The function that ge=
ts called with these members $.a1 .. $.a65<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0should<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; get filled with a wc=
har_t character array.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; Does raku employ a s=
imple method of decoding the 4<br>
&gt;=C2=A0 =C2=A0 =C2=A0wchar_t&#39;s that<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0get<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; placed into a int64 =
structure?=C2=A0 The characters I&#39;d like to<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0extract are<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; at bit positions [15=
:0], [31.16], [47:32], [63:48]<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; I&#39;m imagining so=
mething along the lines of:<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; buf16.new( $.a1, ...=
 $.a64);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; ... but that doesn&#=
39;t quite work like I would expect.<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; Thanks,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0 &gt; ~Paul<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0Hi Paul,<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0Would you post the system =
call you are trying to<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0interface with?<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;<br>
&gt;=C2=A0 =C2=A0 =C2=A0 &gt;=C2=A0 =C2=A0 =C2=A0-T<br>
&gt; <br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0Did you see?<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 =C2=A0<a href=3D"https://docs.microsoft.com/en-us/windows=
/win32/toolhelp/taking-a-snapshot-and-viewing-processes" rel=3D"noreferrer"=
 target=3D"_blank">https://docs.microsoft.com/en-us/windows/win32/toolhelp/=
taking-a-snapshot-and-viewing-processes</a><br>
&gt;=C2=A0 =C2=A0 =C2=A0&lt;<a href=3D"https://docs.microsoft.com/en-us/win=
dows/win32/toolhelp/taking-a-snapshot-and-viewing-processes" rel=3D"norefer=
rer" target=3D"_blank">https://docs.microsoft.com/en-us/windows/win32/toolh=
elp/taking-a-snapshot-and-viewing-processes</a>&gt;<br>
<br>
I am not following the bug.=C2=A0 :&#39;(<br>
<br>
Would you mind posting your C code?<br>
<br>
And the output of your C code?<br>
<br>
<br>
</blockquote></div><br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"g=
mail_signature">__________________<br><br>:(){ :|:&amp; };:</div>

--0000000000001139ce05b8e8c914--
0
pprocacci
1/15/2021 4:26:56 AM
Reply: