Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lua5.1 compatibility #5
base: master
Are you sure you want to change the base?
lua5.1 compatibility #5
Changes from 1 commit
78b8676
7609195
6f1e309
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how this mess happened (you probably took the
read_bits_int
definition from the Johnnynator/kaitai_struct_luajit_runtime repo), but the result is wrong. You completely dropped theread_bits_int_le
method (introduced in fc9556d from Apr 28, 2020 0:27), and this newread_bits_int
method is only a duplicate of the existingread_bits_int_be
method when it didn't have changes from cb6138b commited on Apr 28, 2020 0:13 yet.Context: in 0.8 and older versions of KS, there had been only the big-endian version of bit-sized integers, so there had been only one method –
read_bits_int
. However, in 0.9 along with the advent of little-endian bit integers (kaitai-io/kaitai_struct#155), it was necessary to add another functionread_bits_int_le
for reading bit integers in LE manner. To maintain naming consistency, the oldread_bits_int
for reading BE bit-integers was renamed toread_bits_int_be
, and in order not to break backward compatibility (to make parsing codes generated by KSC ≤0.8 work with 0.9 runtime library), the outdated methodread_bits_int
has been kept as a deprecated alias ofread_bits_int_be
. See kaitai-io/kaitai_struct#155 (comment) for more info.In short, the canonical names are
read_bits_int_be
andread_bits_int_le
. The nameread_bits_int
became deprecated (it's ambiguous now), and it'll be removed in a future release.Anyway, this is a side-by-side comparison of your
read_bits_int_be
andread_bits_int
methods (these are the same changes as introduced in cb6138b):Please see how
read_bits_int
andread_bits_int_le
methods are currently implemented onmaster
branch and rewrite them using thebit
module from scratch.That reminds me that I have to run tests locally before I can mark this PR as OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I took a lot of code over from luajit_runtime repo, but there must have been reason for me to do it this way, it's hard to remember after few months since i've done it.
Strangely, this did not mess up any tests in place
Also no, i'm not going to rewrite the functions using
bit
module from scratch now, but we can surely add that task to backlog of other issues, this runtime has.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really doubt that. It's obviously wrong, please read my above comment.
Sorry, maybe I wrote it ambiguously, I meant copying the
read_bits_int
andread_bits_int_le
method implementations and only replacing the ops&
and>>
with thebit
module as you've done. Rewriting anything from scratch is undesirable, sorry for this wrong phrase.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, ok, that's something i can do for sure, no hard feelings 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It certainly would now. How would possibly pass the test
bits_simple_le
when you completely removed theread_bit_ints_le
method that it depends on?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's what happens, if my contribution from 13th is compared with updated tests/expectations from 23rd August
Merge this PR and the connected ones (specifically kaitai-io/ci_targets#7 and kaitai-io/kaitai_ci_ui#8 ), then we can work on fixing remaining issues and releasing a new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not true. Expectations on this matter have been last updated with these commits:
fc9556d
implementing the methodread_bits_int_le
(from April 28, 2020 0:27)746e34e
making the compiler outputread_bits_int_{be,le}()
calls in the generated Lua parsers (from April 29, 2020 21:17)27d5f3b
with the CI rebuild ofbits_simple_le.lua
parser code based on test KSY specbits_simple_le.ksy
using KSC having the change above - it shows thatread_bits_int_le
method is already in use (commit from April 29, 2020 21:40)If this PR would be based on a earlier commit than fc9556d (imaginary situation), Git would not allow to merge this PR automatically, and merge conflicts would occur instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, you're right, hopefully you feel satisfied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 6f1e309
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Congratulations!
Yet the dot here must be a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar uses utf8.lua for relative require, and the unicode module is relative to string_decode.lua in the same directory currently, so it seemed appropriate
https://github.com/Stepets/utf8.lua/blame/master/README.md#L54
currently works even with tests, so I'm not sure it's wrong, however that might change with implementing #11