Rename source documentation references.

s/rusty-cheddar/moz-cheddar/ and clean up the readme some.
This commit is contained in:
Ralph Giles 2017-04-04 15:19:01 -07:00
Родитель f8fe3d9e60
Коммит 009fcfac77
4 изменённых файлов: 88 добавлений и 77 удалений

Просмотреть файл

@ -10,18 +10,19 @@ is available._**
moz-cheddar is a library for converting Rust source files into C header files. moz-cheddar is a library for converting Rust source files into C header files.
**A note on versioning:** While moz-cheddar is still pre-`v1.0.0` it will **A note on versioning:**
likely go through numerous breaking changes. We attempt to follow semver While moz-cheddar is still pre-`v1.0.0` it will likely go through
and bump the minor version any time a new feature is added or output numerous breaking changes. We attempt to follow semver and bump
the minor version any time a new feature is added or output
behavior is changed. behavior is changed.
moz-cheddar targets C99 or later (for single line comments, `stdint.h` and moz-cheddar targets C99 or later (for single line comments, and
`stdbool.h`). use of `stdint.h` and `stdbool.h`).
The most useful way to use moz-cheddar is in a build script. The most useful way to use moz-cheddar is in a build script.
To do this add the following `build-dependencies` section to your `Cargo.toml` To do this add the following `build-dependencies` section to
(to use it as a normal library simply replace `build-dependencies` your `Cargo.toml` (to use it as a normal library simply replace
with `dependencies`): `build-dependencies` with `dependencies`):
```toml ```toml
# Cargo.toml # Cargo.toml
@ -48,7 +49,7 @@ This should work as is providing you've set up your project correctly.
see [the cargo docs] for more info.** see [the cargo docs] for more info.**
moz-cheddar will then create a `my_header.h` file in `include/`. moz-cheddar will then create a `my_header.h` file in `include/`.
Note that moz-cheddar emits very few warnings; it is up to the Note that moz-cheddar emits very few warnings, it is up to the
programmer to write a library which can be correctly called from C. programmer to write a library which can be correctly called from C.
#### API In a Module #### API In a Module
@ -109,8 +110,9 @@ typedef uint64_t UInt64;
### Enums ### Enums
moz-cheddar will convert public enums which are marked `#[repr(C)]`. moz-cheddar will convert public enums which are marked `#[repr(C)]`.
If the enum is generic or contains tuple or struct variants then `cheddar` If the enum is generic or contains tuple or struct variants then
will fail. moz-cheddar should correctly handle explicit discriminants. `cheddar` will fail. moz-cheddar should correctly handle explicit
discriminants.
Rust: Rust:
@ -229,8 +231,8 @@ marked `#[no_mangle]` and have one of the following ABIs:
- Fastcall - Fastcall
- System - System
If you believe one of these has been included in error, or if one has If you believe one of these has been included in error, or if one
been omitted, then please open an issue at the [repo]. has been omitted, then please open an issue at the [repo].
moz-cheddar will fail on functions which are marked as diverging (`-> !`). moz-cheddar will fail on functions which are marked as diverging (`-> !`).
@ -303,7 +305,7 @@ regard is appreciated.
Pull requests are also welcome, of course. Pull requests are also welcome, of course.
#### Tests ### Tests
The tests require you to have a version (> `v2.7.2`) of [CppHeaderParser] The tests require you to have a version (> `v2.7.2`) of [CppHeaderParser]
installed for the version of Python which is installed as `python` installed for the version of Python which is installed as `python`

Просмотреть файл

@ -1,41 +1,41 @@
**_Please be aware that version `v0.4.0` of rusty-cheddar will be based around the more general **_This is a fork of rusty-cheddar until such time as
[rusty-binder] framework, though this is still work in progress. Change to this version on GitHub the [rusty-binder version](https://gitlab.com/rusty-binder/rusty-cheddar)
should be bug fixes and minor updates only, any major changes should be made to the [version on is available._**
GitLab](https://gitlab.com/rusty-binder/rusty-cheddar)._**
# {{crate}} # {{crate}}
[![Build Status](https://travis-ci.org/Sean1708/rusty-cheddar.svg)](https://travis-ci.org/Sean1708/rusty-cheddar) [![Build Status](https://travis-ci.org/mozilla/moz-cheddar.svg?branch=master)](https://travis-ci.org/mozilla/moz-cheddar)
[![crates.io](http://meritbadge.herokuapp.com/rusty-cheddar)](https://crates.io/crates/rusty-cheddar) [![crates.io](http://meritbadge.herokuapp.com/moz-cheddar)](https://crates.io/crates/moz-cheddar)
![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg) ![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)
{{readme}} {{readme}}
## Contributing ## Contributing
Contributions to rusty-cheddar are more than welcome. Contributions to moz-cheddar are more than welcome.
### Bugs ### Bugs
If you find a bug or have a feature request please open an issue. I can't guarantee that I'll fix it If you find a bug or have a feature request please open an issue.
but I'll give it a damn good go.
If you find the source code unclear in any way then I consider that a bug. I try to make my source If you find the source code unclear in any way then I consider that a bug.
code as clear as possible but I'm not very good at it, so any help in that regard is appreciated. I try to make my source code as clear as possible, so any help in that
regard is appreciated.
### PRs Pull requests are also welcome, of course.
I love pull requests they tend to make my job much easier, so if you want to fix a bug or implement ### Tests
a feature yourself then that would be great. If you're confused by anything or need some pointers on
how to proceed then feel free to open an issue so that I can help, otherwise [these docs] are a good
place to start.
#### Tests The tests require you to have a version (> `v2.7.2`) of [CppHeaderParser]
installed for the version of Python which is installed as `python`
(usually Python 2). Furthermore, due to the fact that the tests are a
massive pile of wanky hacks, you must be in the same directory as
moz-cheddar's `Cargo.toml` to successfully run them.
The tests require you to have a recent version (> `v2.7.2`) of [CppHeaderParser] installed for the If you don't have this, try
version of Python which is installed as `python` (usually Python 2). Furthermore due to the fact ```bash
that the tests are a massive pile of wanky hacks, you must be in the same directory as pip install CppHeaderParser
rusty-cheddar's `Cargo.toml` to successfully run them. ```
[rusty-binder]: https://gitlab.com/rusty-binder/rusty-binder [rusty-binder]: https://gitlab.com/rusty-binder/rusty-binder
[these docs]: http://manishearth.github.io/rust-internals-docs/syntax/ast/index.html [these docs]: http://manishearth.github.io/rust-internals-docs/syntax/ast/index.html

Просмотреть файл

@ -1,24 +1,24 @@
//! rusty-cheddar is a library for converting Rust source files into C header files. //! moz-cheddar is a library for converting Rust source files into C header files.
//! //!
//! **A note on versioning:** While rusty-cheddar is still in a significant flux (i.e. //! **A note on versioning:**
//! pre-`v1.0.0`) it will likely go through numerous breaking changes. However, until `v1.0.0`, any //! While moz-cheddar is still pre-`v1.0.0` it will likely go through
//! time a breaking change is made the minor version will be bumped and any time a new feature is //! numerous breaking changes. We attempt to follow semver and bump
//! added the path version will be bumped. //! the minor version any time a new feature is added or output
//! behavior is changed.
//! //!
//! rusty-cheddar targets C99 or later (for sane single line comments and use of `stdint.h` and //! moz-cheddar targets C99 or later (for single line comments, and
//! `stdbool.h`), if you really really really really really have to use an older standard then please //! use of `stdint.h` and `stdbool.h`).
//! open an issue at the [repo] and I will begrudgingly figure out how to implement support for it
//! (after arguing with you lots and lots).
//! //!
//! The most useful way to use rusty-cheddar is in a build script. To do this add the following //! The most useful way to use moz-cheddar is in a build script.
//! `build-dependencies` section to your `Cargo.toml` (to use it as a normal library simply replace //! To do this add the following `build-dependencies` section to
//! your `Cargo.toml` (to use it as a normal library simply replace
//! `build-dependencies` with `dependencies`): //! `build-dependencies` with `dependencies`):
//! //!
//! ```toml //! ```toml
//! # Cargo.toml //! # Cargo.toml
//! //!
//! [build-dependencies] //! [build-dependencies]
//! rusty-cheddar = "0.3.0" //! moz-cheddar = "0.4.0"
//! ``` //! ```
//! //!
//! Then create the following `build.rs`: //! Then create the following `build.rs`:
@ -34,18 +34,19 @@
//! } //! }
//! ``` //! ```
//! //!
//! This should work as is providing you've set up your project correctly. **Don't forget to add a //! This should work as is providing you've set up your project correctly.
//! `build = ...` to your `[package]` section, see [the cargo docs] for more info.** //! **Don't forget to add a `build = ...` to your `[package]` section,
//! see [the cargo docs] for more info.**
//! //!
//! rusty-cheddar will then create a `my_header.h` file in `include/`. Note that rusty-cheddar //! moz-cheddar will then create a `my_header.h` file in `include/`.
//! emits very few warnings, it is up to the programmer to write a library which can be correctly //! Note that moz-cheddar emits very few warnings, it is up to the
//! called from C. //! programmer to write a library which can be correctly called from C.
//! //!
//! ### API In a Module //! ### API In a Module
//! //!
//! You can also place your API in a module to help keep your source code neat. To do this you must //! You can also place your API in a module to help keep your source code neat.
//! supply the name of the module to Cheddar, then ensure that the items are available in the //! To do this you must supply the name of the module to Cheddar, then ensure
//! top-level scope: //! that the items are available in the top-level scope:
//! //!
//! ```no_run //! ```no_run
//! // build.rs //! // build.rs
@ -69,7 +70,7 @@
//! } //! }
//! ``` //! ```
//! //!
//! There is also the `.compile()` and `.compile_code()` methods for finer control. //! There are also `.compile()` and `.compile_code()` methods for finer control.
//! //!
//! # Conversions //! # Conversions
//! //!
@ -77,7 +78,8 @@
//! //!
//! ## Typedefs //! ## Typedefs
//! //!
//! rusty-cheddar converts `pub type A = B` into `typedef B A;`. Types containing generics are ignored. //! moz-cheddar converts `pub type A = B` into `typedef B A;`.
//! Types containing generics are ignored.
//! //!
//! Rust: //! Rust:
//! //!
@ -97,9 +99,10 @@
//! //!
//! ## Enums //! ## Enums
//! //!
//! rusty-cheddar will convert public enums which are marked `#[repr(C)]`. If the enum is generic or //! moz-cheddar will convert public enums which are marked `#[repr(C)]`.
//! contains tuple or struct variants then `cheddar` will fail. rusty-cheddar should correctly handle //! If the enum is generic or contains tuple or struct variants then
//! explicit discriminants. //! `cheddar` will fail. moz-cheddar should correctly handle explicit
//! discriminants.
//! //!
//! Rust: //! Rust:
//! //!
@ -146,8 +149,10 @@
//! //!
//! ## Structs //! ## Structs
//! //!
//! Structs are handled very similarly to enums, they must be public, marked `#[repr(C)]`, and they must not //! Structs are handled very similarly to enums, they must be public,
//! contain generics (this currently only checked at the struct-level, generic fields are not checked). //! marked `#[repr(C)]`, and they must not contain generics.
//! This currently only checked at the struct-level.
//! Generic fields are not checked.
//! //!
//! Rust: //! Rust:
//! //!
@ -174,11 +179,13 @@
//! //!
//! ### Opaque Structs //! ### Opaque Structs
//! //!
//! One common C idiom is to hide the implementation of a struct using an opaque struct, which can //! One common C idiom is to hide the implementation of a struct using
//! only be used behind a pointer. This is especially useful in Rust-C interfaces as it allows you //! an opaque struct, which can only be used behind a pointer.
//! This is especially useful in Rust-C interfaces as it allows you
//! to use _any arbitrary Rust struct_ in C. //! to use _any arbitrary Rust struct_ in C.
//! //!
//! To define an opaque struct you must define a public newtype which is marked as `#[repr(C)]`. //! To define an opaque struct you must define a public newtype which
//! is marked as `#[repr(C)]`.
//! //!
//! Rust: //! Rust:
//! //!
@ -200,12 +207,13 @@
//! // Some boilerplate omitted. //! // Some boilerplate omitted.
//! ``` //! ```
//! //!
//! Note that the newtype _must not_ be generic but the type that it wraps can be arbitrary. //! Note that the newtype _must not_ be generic but the type that
//! it wraps can be arbitrary.
//! //!
//! ## Functions //! ## Functions
//! //!
//! For rusty-cheddar to pick up on a function declaration it must be public, marked `#[no_mangle]` and //! For moz-cheddar to pick up on a function declaration it must be public,
//! have one of the following ABIs: //! marked `#[no_mangle]` and have one of the following ABIs:
//! //!
//! - C //! - C
//! - Cdecl //! - Cdecl
@ -213,10 +221,10 @@
//! - Fastcall //! - Fastcall
//! - System //! - System
//! //!
//! I'm not totally up to speed on calling conventions so if you believe one of these has been including //! If you believe one of these has been included in error, or if one
//! in error, or if one has been omitted, then please open an issue at the [repo]. //! has been omitted, then please open an issue at the [repo].
//! //!
//! rusty-cheddar will fail on functions which are marked as diverging (`-> !`). //! moz-cheddar will fail on functions which are marked as diverging (`-> !`).
//! //!
//! Rust: //! Rust:
//! //!
@ -259,9 +267,10 @@
//! //!
//! ## Paths //! ## Paths
//! //!
//! You must not put types defined in other modules in an exported type signature without hiding it //! You must not put types defined in other modules in an exported
//! behind an opaque struct. This is because the C compiler must know the layout of the type and //! type signature without hiding it behind an opaque struct.
//! rusty-cheddar can not yet search other modules. //! This is because the C compiler must know the layout of the type
//! and moz-cheddar can not yet search other modules.
//! //!
//! The very important exception to this rule are the C ABI types defined in //! The very important exception to this rule are the C ABI types defined in
//! the `libc` crate and `std::os::raw`. Types from these two modules _must_ //! the `libc` crate and `std::os::raw`. Types from these two modules _must_
@ -270,7 +279,7 @@
//! statement will not work. //! statement will not work.
//! //!
//! [the cargo docs]: http://doc.crates.io/build-script.html //! [the cargo docs]: http://doc.crates.io/build-script.html
//! [repo]: https://github.com/Sean1708/rusty-cheddar //! [repo]: https://github.com/mozilla/moz-cheddar
#![cfg_attr(not(feature = "with-syntex"), feature(rustc_private))] #![cfg_attr(not(feature = "with-syntex"), feature(rustc_private))]
@ -513,7 +522,7 @@ impl Cheddar {
/// ///
/// This does not add any include-guards, includes, or extern declarations. It is mainly /// This does not add any include-guards, includes, or extern declarations. It is mainly
/// intended for internal use, but may be of interest to people who wish to embed /// intended for internal use, but may be of interest to people who wish to embed
/// rusty-cheddar's generated code in another file. /// moz-cheddar's generated code in another file.
pub fn compile_code(&self) -> Result<String, Vec<Error>> { pub fn compile_code(&self) -> Result<String, Vec<Error>> {
let sess = &self.session; let sess = &self.session;
let krate = match self.input { let krate = match self.input {

Просмотреть файл

@ -79,7 +79,7 @@ pub fn parse_crate(krate: &ast::Crate, path: &ast::Path) -> Result<String, Vec<E
parse_mod(&current_module) parse_mod(&current_module)
} }
/// The manager of rusty-cheddar and entry point when the crate is the module. /// The manager of moz-cheddar and entry point when the crate is the module.
/// ///
/// Iterates through all items in the module and dispatches to correct methods, then pulls all /// Iterates through all items in the module and dispatches to correct methods, then pulls all
/// the results together into a header. /// the results together into a header.