pdf-raku / native-packing-raku Goto Github PK
View Code? Open in Web Editor NEWStruct packing/unpacking from binary data
License: Artistic License 2.0
Struct packing/unpacking from binary data
License: Artistic License 2.0
Look for 'revamp' branch.
A first attempt at basic inhertance:
use Test;
use Native::Packing :Endian;
plan 1;
class BaseStruct {
has uint16 $.a;
has uint8 $.b;
}
class Struct is BaseStruct does Native::Packing[Network] {
has uint16 $.c;
}
my $s = Struct.new: :a(42), :b(99), :c(69);
my $n-buf = $s.pack;
is-deeply $n-buf.list, (
0,42,
99,
0,69), 'network packing with inheritance';
done-testing;
The above test should pass if the storage a, b (from the base class) then c, but the test fails with:
1..1
not ok 1 - network packing with inheritance
# Failed test 'network packing with inheritance'
# at t/inheritance.t line 17
# expected: $(0, 42, 99, 0, 69)
# got: $(0, 69, 0, 42, 99)
# You failed 1 test of 1
Which indicates we're currentl;y getting c, a, b.
Hi! The current formulation in README.md is:
The two fixed modes are:
- Vax (big endian) - least significant byte written first
- Network (little endian) - most significant byte written first
The "big endian" and "little endian" strings are swapped, it should be:
The two fixed modes are:
- Vax (little endian) - least significant byte written first
- Network (big endian) - most significant byte written first
Would like to allow native shaped arrays; possibly:
use Native::Packing :Endian;
class GifHeader does Native::Packing[Endian::Vax] {
HAS byte @.gif-header[6];
has uint16 $.width;
has uint16 $.height;
}
The problem is introspecting the shape of the @.gif-header
attribute. Have created an RT https://rt.perl.org/Ticket/Display.html?id=131174
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.