From nobody Sun Aug 8 13:55:01 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 02C30174EBC3 for ; Sun, 8 Aug 2021 13:55:05 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GjLLw6XTpz4f2J for ; Sun, 8 Aug 2021 13:55:04 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from smtp.theravensnest.org (smtp.theravensnest.org [45.77.103.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: theraven) by smtp.freebsd.org (Postfix) with ESMTPSA id C2475519B for ; Sun, 8 Aug 2021 13:55:04 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.1.64] (host86-165-132-213.range86-165.btcentralplus.com [86.165.132.213]) by smtp.theravensnest.org (Postfix) with ESMTPSA id E78FB2B8AF for ; Sun, 8 Aug 2021 14:55:03 +0100 (BST) From: David Chisnall Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Tooling for UCLification Message-Id: Date: Sun, 8 Aug 2021 14:55:01 +0100 To: Mark Millard via freebsd-current X-Mailer: Apple Mail (2.3445.104.21) X-ThisMailContainsUnwantedMimeParts: N 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