# Developer notes

Notes for Futile maintainers on generated sources and on the checks that keep
this documentation consistent with the code.

## Generated sources

Ordinary Futile builds compile checked-in Fortran sources and never run FYPP.
The size inquiries, the undefined sentinels
([f_undefined](../api/precisions/f_undefined.md)), the borrowed views
([f_subptr](../api/memory/f_subptr.md)) and the raw copies ([f_memcpy](../api/memory/f_memcpy.md))
are generated by maintainers from the templates in `fypp/`, as described in
`fypp/README.md`:

```console
python3 fypp/generate-sizeof.py
python3 fypp/generate-subptr.py --doc-output doc/generated/f_subptr_doc.f90
python3 fypp/generate-memcpy.py --doc-output doc/generated/f_memcpy_doc.f90
python3 fypp/generate-undefined.py --doc-output doc/generated/f_undefined_doc.f90
```

Add `--check` to compare the output with the checked-in files instead of
writing them. The optional `fypp-check` CI job runs these checks with the
latest FYPP release.

## Documentation stubs

The generated `f_memcpy_module` and `f_subptr_module` contain thousands of
specific procedures. Their reference pages are rendered from the
documentation-only stubs in `doc/generated/`, which are never compiled. They
declare the same module and public generic interfaces, with one representative
specific per rank and an argument description on every declaration. The
placeholder type `any_intrinsic` stands for any intrinsic type, of any Futile
[ABI kind](../f_prec.md#futile-abi-kinds). Lines starting with `!@specifics` carry a
machine-readable summary of the generated specifics, produced by the same FYPP
loops as the implementation; the `fortran-specifics` directive
(`doc/_ext/futile_specifics.py`) renders them as the kinds and ranks tables.
Interface descriptions are shared with the implementation through
`fypp/memcpy-api.fypp`, `fypp/subptr-api.fypp`, `fypp/size-api.fypp`
and `fypp/undefined-api.fypp`: edit them there. The elemental undefined
sentinel stub uses the placeholder `any_numeric` (any integer, real or
complex ABI kind) instead.

## Documentation checks

Code examples are included with `fortranliteral` directives from programs under
`tests/`, which are compiled and run by `make check`. The `sphinx` CI job
builds this site and runs the `doc/check_*_public_api.py` scripts on the
rendered HTML, which verify that public symbols, required topics and tested
examples are present and that private implementation procedures do not leak.
