Code Monkey home page Code Monkey logo

cddlc's Introduction

CDDL conversion utilities

This little set of tools provides a number of command line utilities for converting to and from cddl.

0.0.2

Installation

gem install cddlc

Formats

cddlc knows the following formats:

  • .cddl: CDDL as defined in RFC8610
  • .cddlj: JSON form of CDDL (the YIN to the YANG)
  • .cddly: The same JSON form, but serialized in YAML.

These targets are identified by -t cddl, -t json (with -t neat invoking a different prettyprinter), -t yaml. These can be abbreviated (but don't do that in scripts).

With -t enum, cddlc generates C-style enumeration type declarations from integer keys used in a map.

Apart from creating enum declarations, the current version only can transform from input CDDL to one of the JSON/YAML formats of CDDL.

Command line utilities

  • cddlc foo.cddl > foo.cddlj
  • cddlc -tyaml foo.cddl > foo.cddly
  • cddlc -ty foo.cddl > foo.cddly

Output is to stdout, input from one or more files given as command line arguments (use - for standard input).

cddlc's People

Contributors

cabo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cddlc's Issues

comments should be copied

when generating an enum, it would be nice if any comments at the top of the cddl file were copied as C comments.
This allows for the provenance of the C header file to be recorded, but also instructions on generating it again could be contained within.

Generator: Be mean to me!

The CBOR generator shipped of the cddl crate was relatively benign, sending values for tstr such as "shudders", "Albion" or "Helene's".

If a generator comes out of this project, I'd like to have an option to make it mean. It might then produce values like "Baho\u0308" (with the NFD of "ΓΆ"), "\u0000 bytes", "\ufeffRuf\ufefffolge" (with both a BOM and the deprecated form of the word joiner, which inhabits the same code point, abused to prevent a ligature), "Ruf\u200dfolge" (the proper way to do it, probably), "Tinker\u0007", "Ctrl Alt \u007f", "NNN\u0083", and maybe also "\ue000" (private use; a penguin on my system), "πŸŒŠπŸ—" (outside BMP), "\uffff" (a noncharacter) and character at the decimal code point 129023 (which is unassigned, but I refuse to write it down in diagnostic notation to not confuse myself and others).

As that behavior is often undesired, it could be hidden behind a --be-mean flag. (That flag might also trigger other mean behavior, such as producing integers below -2**63, tdate hitting leap seconds, float generating denormalized numbers and NaN, and rude language).

nil is not a legal json value

The output of cddlc includes nil, which is not a legal value in JSON. The correct output value for these instances is null.

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.