Sean1708 / rusty-cheddar

A Rust crate for automatically generating C header files from Rust source file.
http://sean1708.github.io/rusty-cheddar/
191 stars 25 forks source link

Allow the user to add custom code. #21

Closed Sean1708 closed 8 years ago

Sean1708 commented 8 years ago

Allows the inclusion of custom includes, macros and static functions.

Maybe have a prepend(&mut self, &str) and append(&mut self, &str).

Probably best to move the boilerplate generation (include-guards, inlcludes, etc) into .compile_to_string() so we don't have to pass more stuff to the parse:: functions. Plus they never really should have been in a parsing function anyway.

Sean1708 commented 8 years ago

Might be worth having a .parse() method as well which parses the file, adds the includes but does not add an include guard or extern "C" declaration.

Sean1708 commented 8 years ago

Might be worth putting the includes in in the parse:: functions since they are absolutely required in all circumstances.

Sean1708 commented 8 years ago

Although maybe we should have an option to exclude the #include <stdint.h> and #include <stdbool.h> for the people who are working in a pre-C99 environment and ensure they only use libc:: types.