Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc
src
tests
tools
.gitignore
.travis.yml
CMakeLists.txt
README.md
nereon_config.h.in

README.md

LIBNEREON

Build Status

Table of Contents generated with DocToc

Introduction

libnereon is a multi-configuration parser library implemented in C.
This library parses the following configurations by HCL.

  • The command-line arguments.
  • The environment variables.
  • The configuration files.

How To Build

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

NOS and NOC syntax

libnereon uses NOS and NOC configurations based on HCL syntax.

NOS configuration

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>
}

  • type has 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
      command line and environment variable.
    • helper : the configuration option with this type describes command line options how to show help message.
  • cmdline switch describes short and long switch options on command line.
  • cmdline description describes short and long descriptions on command line.
  • env describes environment variable to specify the option.
  • config describes NOC keyword to specify the option.
  • default specifies default value of the option.

NOC configuration

NOC is the NereOn Configuration syntax to allow setting configuration

libnereon API functions

NOTE: NOS configuration should be compiled with the projects which is using libnereon. nos2cc converts NOS configuration to C source file.
To convert NOS to C source file, it needs to execute the following command.

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.

You can’t perform that action at this time.