Table of Contents generated with DocToc
libnereon is a multi-configuration parser library implemented in C.</br> This library parses the following configurations by HCL.
-
The command-line arguments.
-
The environment variables.
-
The configuration files.
To build libnereon on Ubuntu:
sudo apt install automake libtool cmake mkdir build cd build cmake .. make
To build libnereon on MacOS:
brew install automake libtool cmake pkg-config mkdir build cd build cmake .. make
To build libnereon on Windows using MSYS2 environment:
pacman -S --needed autoconf automake cmake gcc libtool make mkdir build cd build cmake .. -G "Unix Makefiles" make
libnereon uses NOS and NOC configurations based on HCL syntax.
NOS is the NereOn configuration Schema syntax that allows describing what configuration parameters are allowed.
It has the following HCL syntax:
config_option <name> {
type = <type>
cmdline "switch" {
short = <short command line switch>
long = <long command line switch>
}
cmdline "description" {
short = <short command line description>
long = <long command line description>
}
env = <environment variable>
config = <NOC configuration keyword>
default = <default value>
}
-
typehas the following configuration types:-
basic types:int,bool,string,float,array -
config: the configuration option with this type describes how to specify configuration file from</br> command line and environment variable. -
helper: the configuration option with this type describes command line options how to show help message.
-
-
cmdline switchdescribes short and long switch options on command line. -
cmdline descriptiondescribes short and long descriptions on command line. -
envdescribes environment variable to specify the option. -
configdescribes NOC keyword to specify the option. -
defaultspecifies default value of the option.
-
All API functions are defined in nereon.h.
-
NOSconfiguration example is rvd.nos. -
NOCconfiguration example is rvd.noc. -
The example code is noc_test.c.
|
Note
|
NOS configuration should be compiled with the projects which is using libnereon.
nos2cc converts NOS configuration to C source file.</br> To convert NOS to C source file, it needs to execute the following command.</br>
|
nos2cc <NOS configuration file> <NOS CC output path> <prefix of function name>
The project should compile <NOS filename>.c and <NOS filename>.h, and call get_<prefix of function name>_nos_cfg function to get NOS contents.