1 Star 0 Fork 0

necnotdie / libcyaml

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
ISC

LibCYAML: Schema-based YAML parsing and serialisation

Build Status Static Analysis Code Coverage

LibCYAML is a C library for reading and writing structured YAML documents. It is written in ISO C11 and licensed under the ISC licence.

Warning

The main branch is currently undergoing changes for version 2. You probably want to be using a tagged release instead.

Overview

The fundamental idea behind CYAML is to allow applications to construct schemas which describe both the permissible structure of the YAML documents to read/write, and the C data structure(s) in which the loaded data is arranged in memory.

Goals

  • Make it easy to load YAML into client's custom C data structures.
  • Good compromise between flexibility and simplicity.

Features

  • Load, Save and Free functions.
  • Reads and writes arbitrary client data structures.
  • Schema-driven, allowing control over permitted YAML, for example:
    • Required / optional mapping fields.
    • Allowed / disallowed values.
    • Minimum / maximum sequence entry count.
    • etc...
  • Enumerations and flag words.
  • YAML backtraces make it simple for users to fix their YAML to conform to your schema.
  • Uses standard libyaml library for low-level YAML read / write.
  • Support for YAML aliases and anchors.

Building

To build the library, run:

make

You can control the optimisation and building of asserts by setting the build variant:

make VARIANT=debug
make VARIANT=release

Another debug build variant which is built with address sanitiser (incompatible with valgrind) can be built with:

make VARIANT=san

Installation

To install a release version of the library, run:

make install VARIANT=release

It will install to the PREFIX /usr/local by default, and it will use DESTDIR and PREFIX from the environment if set.

Testing

To run the tests, run any of the following, which generate various levels of output verbosity (optionally setting VARIANT=release, or VARIANT=san):

make test
make test-quiet
make test-verbose
make test-debug

To run the tests under valgrind, a similar set of targets is available:

make valgrind
make valgrind-quiet
make valgrind-verbose
make valgrind-debug

To run a single test or a subset of tests, use the TESTLIST variable, which expects a space and/or comma separated list of test names:

make test-debug TESTLIST=test_load_mapping_without_any_fields
make valgrind-debug TESTLIST="test_load_no_log test_util_state_invalid"

To generate a test coverage report, gcovr is required:

make coverage

Documentation

To generate both public API documentation, and documentation of CYAML's internals, doxygen is required:

make docs

Alternatively, the read the API documentation directly from the cyaml.h header file.

There is also a tutorial.

Examples

In addition to the documentation, you can study the examples.

Copyright (c) 2017-2021, Michael Drake Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

简介

c 解析yaml简化版 展开 收起
C 等 2 种语言
ISC
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/necnotdie/libcyaml.git
git@gitee.com:necnotdie/libcyaml.git
necnotdie
libcyaml
libcyaml
main

搜索帮助