![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
Functions | |
| _usable_flags (flags) | |
| parse_api (path) | |
| preprocess (compiler, flags, source) | |
| own_code (preprocessed, module_dir) | |
| defined_entry_points (body, names) | |
| generate_present (args, api_names) | |
| generate_fill (args) | |
| generate_registry (args) | |
| write_if_changed (path, content) | |
| main () | |
Variables | |
| tuple | VERSION_FUNCTIONS = ("dt_module_dt_version", "dt_module_mod_version") |
Generate the glue that binds statically-linked IOP modules into the application.
IOP modules used to be one shared object each, discovered by scanning a directory and
bound with g_module_symbol(). That indirection bought nothing -- the module set is fixed
at build time, and src/develop/iop_order.c and src/develop/geometry/geometry.c both carry
a hardcoded census of module names that a module on disk cannot join -- while costing a
dlopen per module at every startup and turning a stale .so left over from an experimental
branch into a refusal to start (see dt_ioppr_check_so_iop_order).
Two things have to be generated to replace it:
* <module>_present.h -- DT_MODULE_HAS_<fn>, 0 or 1, for EVERY name in the API. This is
the question g_module_symbol() used to answer at runtime: does this module define this
entry point at all? It is answered here by running the real compiler's preprocessor
over the module's real sources with the module's real flags. That is not
over-engineering: a regex over the raw source gets 90 of 91 modules right and then
trips over iop/censorize.c, which hides four functions behind `#if FALSE', and writes
name() with its return type on the previous line. Only the preprocessor knows what
HAVE_OPENCL and `#if FALSE' resolve to, and it costs one -E pass per source.
* <module>_static.c -- the function that fills this module's dt_iop_module_so_t, expanded
from the same X-macro list in iop/iop_api.h that used to drive the g_module_symbol()
calls, inside the module's own translation unit so the plain API names resolve to THIS
module's asm-labelled symbols.
plus one registry naming every module, compiled into lib_ansel.
|
protected |
Drop what the preprocessor cannot use, keep the rest verbatim. CMake's COMPILE_DEFINITIONS carries at least one entry that already includes its own `-D' (LIBSOUP_VERSION_MAJOR), which reaches us as `-D-DLIBSOUP_VERSION_MAJOR=2' -- not a macro name. Imported targets also leak into INCLUDE_DIRECTORIES as `-I<dir>/LCMS2::LCMS2'. Neither changes which functions a module defines, so neither is worth failing over.
Definition at line 58 of file generate_iop_static.py.
Referenced by main().
| generate_iop_static.defined_entry_points | ( | body, | |
| names | |||
| ) |
Names among `names' that `body' defines at file scope with external linkage.
Definition at line 132 of file generate_iop_static.py.
Referenced by generate_present().
| generate_iop_static.generate_fill | ( | args | ) |
Definition at line 183 of file generate_iop_static.py.
References write_if_changed().
Referenced by main().
| generate_iop_static.generate_present | ( | args, | |
| api_names | |||
| ) |
Definition at line 147 of file generate_iop_static.py.
References defined_entry_points(), own_code(), preprocess(), and write_if_changed().
Referenced by main().
| generate_iop_static.generate_registry | ( | args | ) |
Definition at line 210 of file generate_iop_static.py.
References write_if_changed().
Referenced by main().
| generate_iop_static.main | ( | void | ) |
Definition at line 253 of file generate_iop_static.py.
References _usable_flags(), generate_fill(), generate_present(), generate_registry(), main(), and parse_api().
Referenced by main().
| generate_iop_static.own_code | ( | preprocessed, | |
| module_dir | |||
| ) |
Keep only the regions the line markers attribute to the module's own files. Without this, a definition in an included header counts as the module's own: two C++ modules (iop/bilateral.cc, iop/tonemap.cc) pick up an unrelated `init(...)' from a header and would claim an init() they do not have.
Definition at line 108 of file generate_iop_static.py.
Referenced by generate_present().
| generate_iop_static.parse_api | ( | path | ) |
Return [(kind, name)] for every entry point declared in an X-macro API header.
Definition at line 78 of file generate_iop_static.py.
Referenced by main().
| generate_iop_static.preprocess | ( | compiler, | |
| flags, | |||
| source | |||
| ) |
Run the compiler's preprocessor over one source, keeping its line markers.
Definition at line 98 of file generate_iop_static.py.
Referenced by generate_present().
| generate_iop_static.write_if_changed | ( | path, | |
| content | |||
| ) |
Avoid touching an unchanged output, so ninja does not rebuild the world.
Definition at line 242 of file generate_iop_static.py.
Referenced by generate_fill(), generate_present(), and generate_registry().
| tuple generate_iop_static.VERSION_FUNCTIONS = ("dt_module_dt_version", "dt_module_mod_version") |
Definition at line 55 of file generate_iop_static.py.