Files
mars-nwe/doc/librarys/nwcore/README.md
Mario Fetka a1d1234859
All checks were successful
Source release / source-package (push) Successful in 1m43s
docs: fix libnwcore/libnwnss attribution errors in remaining MDs
doc/librarys/nwcore/README.md: completely rewrite — old content described
libnwnss (Unicode, UTC, GUID, WIO, FSM, latch, stdio, library/*, nss/lib,
sharedsrc) as if it were libnwcore. libnwcore builds only core.c, nwlog.c,
ini.c and exposes only core.h and ini.h. Add correct dependency chain diagram
showing libnwcore is independent of libnwnss.

TODO.md:
- "shared libnwcore/libnwfs helpers" for salvage/deleted metadata → libnwnss/libnwfs (2 occurrences)
- "libnwcore/libnwfs" for metadata snapshot helpers → libnwnss/libnwfs
- "src/core/" and "include/core/" for NSS imports → src/nwnss/ and include/nwnss/

REDESIGN.md:
- Architecture status table: "libnwcore/libnwfs helpers" for NSS-shaped
  salvage → libnwnss/libnwfs
- Salvage snapshot section: nwcore_salvage_snapshot → nwnss_salvage_snapshot;
  "libnwcore/libnwfs-style helpers" → libnwnss/libnwfs

Note: third_party/unicodeTables/COPYRIGHT.md also says "libnwcore" but that
file lives in a submodule and cannot be staged here.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 18:27:17 +02:00

2.3 KiB

nwcore

nwcore is the minimal common runtime library for mars-nwe. It contains only Mars-native helpers shared by daemons and tools. It does not contain imported NSS helpers; those live in libnwnss.

Public headers

include/nwcore/core.h   — Mars project core utilities
include/nwcore/ini.h    — shared INI reader/writer API (nw_ini_*)

These are the only public headers. Do not add include/nwcore/include, include/nwcore/library, or similar subdirectories.

Built sources

libnwcore builds exactly three files:

  • src/nwcore/core.c — core Mars helpers
  • src/nwcore/nwlog.c — logging facade (nwlog_error(), nwlog_warn(), nwlog_info(), nwlog_debug(), nwlog_trace(); nwlog_detail() only in MAINTAINER_BUILD)
  • src/nwcore/ini.c — INI reader/writer wrapper over the bundled iniparser

Mars-native APIs

  • core.h — project-wide Mars helpers
  • ini.hnw_ini_load_file(), nw_ini_get_string(), nw_ini_get_bool(), nw_ini_get_u32(), nw_ini_set_string(), nw_ini_delete_key(), nw_ini_save_file(), nw_ini_free()

Server daemons and tools must call only the nw_ini_* API; do not call iniparser.h directly from new Mars code.

Internal bundled dependencies

  • third_party/iniparser: backing implementation for the ini.h wrapper.

Keep this dependency hidden behind the nwcore INI API.

Boundary rule

libnwcore must not link against libnwnss. If a helper is imported from NSS sources it belongs in libnwnss, not here. The dependency direction is:

libnwcore (INI, logging)
    ↑
libnwnss (NSS runtime: Unicode, UTC, GUID, WIO, FSM, latch, stdio, …)
    ↑
libnwfs  (Mars/NCP filesystem wrapper)
    ↑
nwconn, nwbind, … (server processes)

The dependency chain for consumers reads top-to-bottom:

nwconn, nwbind, … (server processes)
    depends on
libnwfs  (Mars/NCP filesystem wrapper)
    depends on
libnwnss (NSS runtime: Unicode, UTC, GUID, WIO, FSM, latch, stdio, …)

libnwcore (INI, logging) — independent; must NOT depend on libnwnss

Server daemons and interactive tools may use libnwcore directly for INI and logging. libnwnss may use libnwcore logging, but libnwcore must never link against libnwnss.

See also doc/TOOLBOX_PLAN.md for the INI and toolbox dependency chain.