Add RzIterator support to the bindgen and linter - #121
Open
notxvilka wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
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.
Bindgen:
RzIteratoras a class.rz_iterator_nextis exposed asnext()and
rz_iterator_freeas the destructor. SinceRzIteratoristype-erased in C (
rz_iterator_nextreturns a borrowedvoid *),elements are yielded as opaque pointers. A new
RzIteratorIteratorpython helper implements the iterator protocol on top of
next(), soevery
RzIterator *return value works directly in aforloop. Onexhaustion it hands ownership to SWIG via
thisownso the idiomaticfor x in coll.as_iter(): ...frees the iterator deterministically.as_iter/as_iter_keys/as_iter_mutto every hashtable type(HtPP, HtPU, HtUP, HtUU, HtSP, HtSS, HtSU). RzSetS / RzSetU are typedef
aliases of HtSP / HtUP, so this covers sets transitively.
add_python_methodonClass(it previously only existed onGeneric), used forRzIterator.__iter__.Linter:
RzIteratortype comments. The element type isoften not known statically, so RzIterator is kept out of
generic_types(the comment stays optional); when present it must name exactly one type,
unlike the two-parameter RzGraph / HtPP form.
/* <T> */style used by the RzIterator helpers is accepted alongsidethe existing compact
/*<T>*/style. Existing annotations have nopadding, so this is a no-op for them.
Closes #67