Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Aug 2021 14:55:01 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Mark Millard via freebsd-current <freebsd-current@freebsd.org>
Subject:   Tooling for UCLification
Message-ID:  <DEBAA3B6-20E0-45C3-9044-987A4B93B7F3@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
Hi everyone,

A few years ago at BSDCam I started working on a tool that would parse =
data structures using libclang and provide libucl wrappers for =
serialising and deserialising the code.  After working on it for a bit, =
I came to the conclusion that the approach was the wrong way around and =
what I actually wanted to do was describe the config file and reflect =
that into code.

I=E2=80=99ve written a tool (still quite WIP, but now in a usable state) =
that takes a JSON Schema describing the config file and produces some =
modern idiomatic C++ wrappers for exposing it.  JSON Schema is the same =
format the UCL can validate, so you can write the schema once, use it to =
validate config files, and also use it to generate the code that exposes =
the config files into your program.

I hope it=E2=80=99s useful to anyone working on adding UCL support to =
tools:

https://github.com/davidchisnall/config-gen

There are a couple of simple examples in the tests directory that show =
the schema, some example configs, and the code used for accessing them.

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?DEBAA3B6-20E0-45C3-9044-987A4B93B7F3>