rust-lang / rust-lang/rust-bindgen
Bindings for define statements using scientific notation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
/* Arcseconds to radians */
/* Radians to arcseconds */
#define DR2AS (206264.8062470963551564734)
/* Arcseconds to radians */
#define DAS2R (4.848136811095359935899141e-6)
/* Seconds of time to radians */
#define DS2R (7.272205216643039903848712e-5)
/* Arcseconds in a full circle */
#define TURNAS (1296000.0)
Bindgen Invocation
let bindings = bindgen::Builder::default()
.generate_inline_functions(true)
.generate_cstr(true)
.use_core()
.no_convert_floats()
.header("extern/src/sofa.h")
.header("extern/src/sofam.h")
.blocklist_var("FP_NAN")
.blocklist_var("FP_INFINITE")
.blocklist_var("FP_ZERO")
.blocklist_var("FP_SUBNORMAL")
.blocklist_var("FP_NORMAL")
.generate()
.expect("Unable to generate bindings");
Actual Results
pub const DR2AS: f64 = 206264.80624709636;
pub const TURNAS: f64 = 1296000.0;
Expected Results
It appears that variables that use scientific notation in define statements are ignored. I can codify these in my own code, although, it would be nice to rely on the bindings.rs file. Are there any methods that enable this? Or is this truly an issue?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the C/C++ definitions in extern/src/sofa.h and extern/src/sofam.h, then inspect the bindgen::Builder invocation and generated bindings.rs output. Compare the emitted DR2AS and TURNAS constants with the omitted scientific-notation constants DAS2R and DS2R; done means those definitions are represented in the generated bindings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100