-
Notifications
You must be signed in to change notification settings - Fork 309
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
Port string_char_to_byte and string_byte_to_char #1534
Open
agraven
wants to merge
11
commits into
remacs:master
Choose a base branch
from
agraven:string-index-conversion
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Co-Authored-By: Nick Drozd <nicholasdrozd@gmail.com>
I forgot github suggestions only change one line, whoops.
Additional changes: * Port clear_string_char_byte_cache * Add head_len, is_head_at and char_and_len to LispStringRef
shaleh
reviewed
Aug 7, 2019
shaleh
reviewed
Aug 7, 2019
shaleh
reviewed
Aug 7, 2019
shaleh
reviewed
Aug 7, 2019
shaleh
reviewed
Aug 7, 2019
shaleh
reviewed
Aug 7, 2019
As the lisp_string_width PR has been merged, I plan on finishing this PR sometime soon |
shaleh
reviewed
Jan 13, 2020
Unless anyone has any additional feedback, I think this PR is ready for merge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a more or less direct port of the C code. I experimented with using if expressions directly in the assignments of
best_above
and friends, but the two conditionals created enough visual noise to reduce readability.I moved the statics for caching over to rust, but I wasn't sure if I should use
lazy_static
or not since they don't need to be initialized at runtime/first use.I also added some convenience functions for using
char_head_p
,multibyte_length_by_head
andmultibyte_char_at
on strings, and I'm not entirely sure how themultibyte_char_at
one should look with regards to (absence of) error handling.The PR is based on
the lisp_string_width
PR as it's the only place in the rust code the index conversion functions are used, and additionally I want to remove all invocations of C code fromlisp_string_width
to enable wring rust tests.On the subject of tests, none are in this PR yet; I intend to add some ASAP.