Giter VIP home page Giter VIP logo

codespawn's Introduction

Codespawn

Crates.io Documentation Build Status Coverage Status

Codespawn is a basic C++ and Rust code generator. Desired API can be defined using either JSON or XML and the crate supports both reading from a file or a string. Currently it's possible to generate enums, structs, functions, function pointers, variables and bitflags with all applicable attributes and properties.

This crate was created as a helper tool for ProDBG. See example XML for instructions on how to construct the API definition.

Documentation

Usage

# Cargo.toml
[dependencies]
codespawn = "0.3"

Example

extern crate codespawn;

fn main()
{
    // generate from XML definition
    let raw_code = codespawn::from_xml("examples/sample.xml").unwrap();
    // generate from JSON definition
    //let raw_code = codespawn::from_json("examples/sample.json").unwrap();

    // generate code, store as String
    let cpp_code  = raw_code.to_cpp().unwrap().to_string();
    let rust_code = raw_code.to_rust().unwrap().to_string();

    // generate and save directly to file
    raw_code.to_cpp().unwrap().to_file("sample.cpp");
    raw_code.to_rust().unwrap().to_file("sample.rs");
}

Build instructions

cargo build
cargo run --example xml
cargo run --example json

This will run the example which will generate code and save it to files using sample XML definition.

License

Licensed under either of

codespawn's People

Contributors

kondrak avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.