Comments (4)
Um, ok, I'm on that. The main problem here is that [0x11, 0x22, 0x33]
you're proposing is not a byte array (as in byte[]
in Java), but array of integers, that will be ArrayList<Integer>
in Java. We need to somehow convert one into another.
from kaitai_struct.
Well, it's more or less done, at least for Ruby that you were most interested in: see http://kaitai.io/ci
The syntax is just as you've requested, but note that there's a crazy catch here: argument must be "byte array", not just any "array of integers". And here's the subtle difference:
[0x11, 0x22, 0x33]
is treated as byte array now[0x11, 0x222, 0x33]
would be treated as array of integers, because of 0x222, which does not fit 1 byte and thus is represented by "generic integer" (i.e.CalcIntType
) and not 1-byte type (Int1Type
)[0x11, 0x222 - 0x200, 0x33]
would be treated as array of integers too, despite 0x222 - 0x200 being able to fit in one byte, calculations would keep types promoted toCalcIntType
.
from kaitai_struct.
Thanks, testing now.
Works like a charm!
I believe that you'd want to close this issue yourself, after adding support to all other languages?
from kaitai_struct.
Yeah. It's fully done now - http://kaitai.io/ci - except for 2 WIP languages, C# and Swift.
from kaitai_struct.
Related Issues (20)
- Fix Go 1.22 Docker image build failure
- if-expression with self-link for optional field HOT 1
- Serialization using python failing because the buffer is empty. HOT 1
- Top-level parameters are not validated
- Warnings (and maybe errors) are reported in unstable order HOT 1
- Warning about encoding name is reported even for types without explicit `encoding`
- `_root` / `_parent` chain broken by recursive use of the top-level type
- `bytes.to_s(encoding)` should validate the passed encoding
- Using enum members as int is broken in ruby HOT 3
- Add explanation to errors `spec_build_failed` and `format_build_failed` on https://ci.kaitai.io/ HOT 1
- C++: the type of all integer constants wrongly deduced as `int32_t` HOT 1
- ci.kaitai.io: use snake_case for test names instead of PascalCase HOT 1
- Java: byte array elements propageted to `int` as signed values (0xFF -> -1 instead of 255)
- Unclear expected values for integer division HOT 4
- Invalid Java code generated: Incompatible types: possible lossy conversion from int to byte HOT 3
- Ruby, Lua: missing `require`s not detected by tests due to `require` leaks HOT 1
- Invalid Java code generated: Switch selectors cannot be of type "long" HOT 1
- Recursive decoding of value HOT 3
- Python: Fix missing `assertRaisesRegexp` method in Python 3.12
- C++11: segfault in debug mode for arrays HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaitai_struct.