Re: filever.exe sub?

2019-02-01 Thread Timo Paulssen
On 01/02/2019 01:33, Bruce Gray wrote: > To call those Windows APIs in Perl 6, you would use NativeCall. > Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine is still a good source for info on how

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
> > On Fri, Feb 1, 2019 at 9:22 PM ToddAndMargo via perl6-users > wrote: >> >> Hi All, >> >> On a type Buf, what do I use to check for the >> position of a byte pattern? >> >> >> Many thanks, >> -T On 2/1/19 7:35 PM, Brad Gilbert wrote: This would work: my $b = Buf.new( 0,0,0, 1, 2, 0 );

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 7:22 PM, ToddAndMargo via perl6-users wrote: Hi All, On a type Buf, what do I use to check for the position of a byte pattern? Many thanks, -T Basically, what am I doing wrong here? $ p6 'my $handle=open("filever.exe", :bin, :ro); my Buf $b; $b= $handle.read(5); say $b; say

Re: binary test and position?

2019-02-01 Thread Brad Gilbert
This would work: my $b = Buf.new( 0,0,0, 1, 2, 0 ); my $match = Buf.new( 1, 2 ); $b.rotor( $match.elems => 1 - $match.elems ).grep(* eqv $match.List, :k) If you only need the first one, swap out `grep` for `first` Another iffy option is to decode it as latin1

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 8:07 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 8:03 PM, ToddAndMargo via perl6-users wrote:  > On Fri, Feb 1, 2019 at 9:37 PM ToddAndMargo via perl6-users  > wrote:  >>  >> On 2/1/19 7:22 PM, ToddAndMargo via perl6-users wrote:  >>> Hi All,  >>>  >>> On a type Buf, what do I

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 8:26 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 8:07 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 8:03 PM, ToddAndMargo via perl6-users wrote:  > On Fri, Feb 1, 2019 at 9:37 PM ToddAndMargo via perl6-users  > wrote:  >>  >> On 2/1/19 7:22 PM, ToddAndMargo via perl6-users

Re: binary test and position?

2019-02-01 Thread Brad Gilbert
`eq` is string equality `==` is numeric equality a Buf is neither. You want `eqv` (equivalent) $b[2..4] eqv (0x90,0x00,0x04) On Fri, Feb 1, 2019 at 9:37 PM ToddAndMargo via perl6-users wrote: > > On 2/1/19 7:22 PM, ToddAndMargo via perl6-users wrote: > > Hi All, > > > > On a type Buf,

binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
Hi All, On a type Buf, what do I use to check for the position of a byte pattern? Many thanks, -T

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 7:37 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 7:22 PM, ToddAndMargo via perl6-users wrote: Hi All, On a type Buf, what do I use to check for the position of a byte pattern? Many thanks, -T Basically, what am I doing wrong here? $ p6 'my $handle=open("filever.exe",

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
> On Fri, Feb 1, 2019 at 9:37 PM ToddAndMargo via perl6-users > wrote: >> >> On 2/1/19 7:22 PM, ToddAndMargo via perl6-users wrote: >>> Hi All, >>> >>> On a type Buf, what do I use to check for the >>> position of a byte pattern? >>> >>> >>> Many thanks, >>> -T >> >> >> Basically, what am I

Re: binary test and position?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 8:03 PM, ToddAndMargo via perl6-users wrote: > On Fri, Feb 1, 2019 at 9:37 PM ToddAndMargo via perl6-users > wrote: >> >> On 2/1/19 7:22 PM, ToddAndMargo via perl6-users wrote: >>> Hi All, >>> >>> On a type Buf, what do I use to check for the >>> position of a byte pattern?

Re: How do I use chr inside a regex?

2019-02-01 Thread JJ Merelo
Hi, El sáb., 2 feb. 2019 a las 7:48, ToddAndMargo via perl6-users (< perl6-users@perl.org>) escribió: > Hi All, > > How do I use chr inside a regex. In the below, how > do I get rid of $y? > > $ p6 'my Str $x=chr(0x66)~chr(0x77); my Str $y=chr(0x66)~chr(0x77); > $x~~s/ $y /xy/; say $x;' > > If

Re: filever.exe sub?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 10:02 AM, Timo Paulssen wrote: On 01/02/2019 01:33, Bruce Gray wrote: To call those Windows APIs in Perl 6, you would use NativeCall. Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux won't run windows code all by itself. That said, wine

Re: filever.exe sub?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 4:26 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 10:02 AM, Timo Paulssen wrote: On 01/02/2019 01:33, Bruce Gray wrote: To call those Windows APIs in Perl 6, you would use NativeCall. Don't forget that Todd wanted to use this on non-windows with not-wine. NativeCall on linux

Re: filever.exe sub?

2019-02-01 Thread ToddAndMargo via perl6-users
On 2/1/19 6:24 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 4:26 PM, ToddAndMargo via perl6-users wrote: On 2/1/19 10:02 AM, Timo Paulssen wrote: On 01/02/2019 01:33, Bruce Gray wrote: To call those Windows APIs in Perl 6, you would use NativeCall. Don't forget that Todd wanted to use

How do I use chr inside a regex?

2019-02-01 Thread ToddAndMargo via perl6-users
Hi All, How do I use chr inside a regex. In the below, how do I get rid of $y? $ p6 'my Str $x=chr(0x66)~chr(0x77); my Str $y=chr(0x66)~chr(0x77); $x~~s/ $y /xy/; say $x;' xy Many thanks, -T