ExMujoco.Gen.Template (ExMujoco v0.1.1)

Copy Markdown View Source

The text this package generates, from the shapes ExMujoco.Gen hands it.

Kept apart from the reading and the deciding so that what a generated binding looks like can be read in one place. Every emitted body is small on purpose: a field is one return and one FINE_NIF, a function is one call, and the only arithmetic anywhere is a dimension.

c_src/ex_mujoco_nif.cpp is not generated. The parts that need a decision per call — an error buffer, an output array, a state signature — are written out by hand and listed in c_src/manifest.exs.

Summary

Functions

ExMujoco.Api — the C functions bound 1:1, under their C names.

What is bound, what is not, and why — as Markdown.

One module per enum, under ExMujoco.Types.

Whether a C function can be bound from its signature alone.

The field accessors, as NIFs.

The bound functions, as C++ NIFs.

ExMujoco.Native — one stub per generated NIF, and the load hook.

Why a function cannot be bound, in a sentence.

Functions

api(functions, manifest)

ExMujoco.Api — the C functions bound 1:1, under their C names.

coverage(structs, functions, enums, manifest)

What is bound, what is not, and why — as Markdown.

enum_modules(enums)

One module per enum, under ExMujoco.Types.

expressible?(function)

Whether a C function can be bound from its signature alone.

The rules are the four questions a NIF has to answer: what to pass for a callback (nothing), what a void* is (anything), how long an output array is (the caller's business), and what a variadic list contains (unknown).

field_nifs(structs)

The field accessors, as NIFs.

fields(entity, scope, members)

ExMujoco.Model or ExMujoco.Data — a typed reader per field.

function_nifs(functions, manifest)

The bound functions, as C++ NIFs.

native(structs, functions, manifest)

ExMujoco.Native — one stub per generated NIF, and the load hook.

unexpressible_reason(function)

Why a function cannot be bound, in a sentence.