Integrating tom_som_c_v0

tom_som_c_v0 is the typed TomSpecs object-model facade for C. It depends on tom_som_c_runtime. Both are versioned to the TomSpecs model version (currently 1.3.2) — pin to that version so your document reads and writes match the model the facade was generated from.

Quick start

Build and install tom_som_c_v0 (and tom_som_c_runtime), then compile against it with pkg-config:

#include "tom_som_c_v0.h"

int main(void) {
  // A typed Solution Blueprint over a fresh document. The constructor also runs
  // the instantiation-time model-version check (an empty stamp is editable).
  SpecDocument doc;
  spec_document_init(&doc);

  D00SolutionBlueprint bp;
  d00_solution_blueprint_new(&bp, &doc, "", NULL);

  d00_solution_blueprint_set_content(
      &bp, "A platform that unifies our fragmented order systems.");

  CurrentLandscape cl = d00_solution_blueprint_current_landscape(&bp);
  current_landscape_set_content(
      &cl, "Three legacy systems with no shared customer record.");

  char *content = d00_solution_blueprint_content(&bp);
  printf("%s\n", content);
  free(content);

  current_landscape_free(&cl);
  d00_solution_blueprint_free(&bp);
  spec_document_free(&doc);
  return 0;
}

Dependency routes

pkg-config (installed)

C has no package registry. Install the facade and the runtime (runtime first — the facade links against it), then let pkg-config supply the compile and link flags:

make -C ../tom_som_c_runtime install
make install
cc myapp.c $(pkg-config --cflags --libs tom_som_c_v0) -o myapp

The facade .pc declares Requires: tom_som_c_runtime, so a single pkg-config tom_som_c_v0 pulls in the runtime flags too. Both .pc files report Version 1.3.2.

Source tarball (vendored)

Produce versioned source tarballs and vendor them into your build:

make -C ../tom_som_c_runtime dist   # tom_som_c_runtime-1.3.2.tar.gz
make dist                           # tom_som_c_v0-1.3.2.tar.gz

Unpack both alongside your project and add each include/ to your include path plus the built libraries to your link line.

In-tree (monorepo)

When the SOM projects sit alongside your code, build the facade in place; its Makefile builds the runtime on demand through a relative RUNTIME_DIR:

make                                # builds runtime + facade libs
cc myapp.c -Iinclude -I../tom_som_c_runtime/include \
   build/libtom_som_c_v0.a ../tom_som_c_runtime/build/libtom_som_c_runtime.a \
   -o myapp

Pinning the version

Both tom_som_c_runtime and tom_som_c_v0 carry version 1.3.2, taken from the TomSpecs model version. When you upgrade the model, regenerate and move to the new matching version so the facade and your stored documents stay in step.

Building from source

Regenerate the facade, then build and package both projects from the workspace (runtime first — the facade builds it on demand through its relative RUNTIME_DIR):

dart run tom_specs_clitool/bin/generate_som.dart
cd tom_som_c_runtime && make && make dist
cd ../tom_som_c_v0 && make && make dist

Each make builds the static + shared library and the pkg-config file; each make dist writes build/<name>-<version>.tar.gz.

Further documentation

DocumentCovers
README.md What this package is, its document roots, and how to use them.
doc/tutorial.md A C walkthrough end to end — install, open a document, read and edit a section, validate it, and serialize to *.docspecs.yaml and Markdown.
examples/README.md The runnable samples.
tom_specs_model/doc/som_multiplatform_spec_model.md The SOM authority: the model, the formats, and SOM §17 — the packaging rules this guide implements.
tom_specs_model/doc/index.md The catalogue of every TomSpecs subject-matter document.
tom_som_c_runtime The generic runtime this facade depends on.