# cbindgen config for kglite-c — generates `include/kglite.h`
# at build time. CI verifies the committed copy is up to date by
# running cbindgen and diffing against fresh-cbindgen output.

language = "C"
include_guard = "KGLITE_H_INCLUDED"
no_includes = false
sys_includes = ["stdint.h", "stddef.h", "stdbool.h"]

header = """\
/*
 * kglite-c — C ABI for the kglite knowledge graph engine.
 *
 * Generated by cbindgen. Do NOT edit by hand. To regenerate:
 *   cargo build -p kglite-c
 * (the crate's build.rs runs cbindgen automatically).
 *
 * Conventions: see docs/rust/c-abi.md in the kglite repo.
 *   https://github.com/kkollsga/kglite/blob/main/docs/rust/c-abi.md
 */"""

[parse]
# Only parse this crate — don't follow into kglite, serde_json,
# etc. and try to render their types. The crate's #[no_mangle]
# extern "C" surface only mentions our own #[repr(C)] types
# (opaque handles + KgliteStatusCode + KgliteAbiVersion).
parse_deps = false

[defines]
# Map Cargo features to C preprocessor defines so the generated
# header wraps feature-gated items in matching `#ifdef` blocks.
# Consumers building against a `libkglite_c` with feature X must
# `#define KGLITE_FEATURE_X` before including `kglite.h`, or the
# corresponding declarations are skipped. This keeps the header
# linkable: a kglite-c built without `sodir` won't export
# `kglite_datasets_sodir_fetch_all`, and the matching `#ifdef`
# hides the declaration so callers can't accidentally reference
# an undefined symbol.
"feature = sodir" = "KGLITE_FEATURE_SODIR"
"feature = sec" = "KGLITE_FEATURE_SEC"
"feature = wikidata" = "KGLITE_FEATURE_WIKIDATA"
"feature = fastembed" = "KGLITE_FEATURE_FASTEMBED"
"feature = rdf" = "KGLITE_FEATURE_RDF"

[export]
# Don't add any prefix; the Rust types are already `Kglite*`.
prefix = ""
item_types = ["enums", "structs", "opaque", "typedefs", "functions"]

[enum]
# Names are like `KGLITE_OK`, `KGLITE_ERR_CYPHER_SYNTAX`. The
# `Kglite` part comes from the type prefix; cbindgen prepends the
# enum type name in screaming snake to each variant.
prefix_with_name = true
rename_variants = "ScreamingSnakeCase"

[fn]
prefix = ""
sort_by = "None"
