Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.26 KB

File metadata and controls

67 lines (48 loc) · 1.26 KB

[EXPERIMENTAL]

djevko.h

A variant of Jevko implemented in C which differs from the original in that:

Features

  • single-header library: simply #include "djevko.h" and use!
  • provides utility functions to help with (de)serialization, escaping, checking, converting, etc.
  • should be fairly fast (yet to be benchmarked)
  • binary data can be mixed with text data
  • human readable and writable
  • super minimal and flexible

Example

An example piece of data like:

name [Jon Wąpierz 😀]
age [32]
is cool [true]
fav colors [
  [red]
  [green]
  [blue]
]

can be parsed into C structs like:

typedef struct {
  char** colors;
  Size len;
} FavColors;

typedef struct {
  char* name;
  int age;
  Bool is_cool;
  FavColors fav_colors;
} Person;

And the other way around.

Usage

All you need is djevko.h.

See example.c.

It shows how to (de)serialize C structs/arrays/strings/numbers/booleans to/from Djevko.

You can compile and run the example with:

gcc example.c && ./a.out