Liblouis User's and Programmer's Manual
7.29 lou_registerTableResolver ¶
void lou_registerTableResolver ( char **(*resolver) (const char *table, const char *base));
Replaces the default table resolver (see How tables are found)
with resolver. From then on, every table name that liblouis
needs to turn into a file or list of files is passed to this function,
whether it was passed to a function such as lou_translate,
lou_indexTables or lou_getTableInfo, or comes from an
include opcode (see include) inside a table file.
table is the table name, exactly as it was given. base
is NULL when the table name was passed to a function. When it
comes from an include, base is the path of the table
file that contains the include, that is, one of the paths the
resolver returned earlier. base is therefore always either
NULL or a file path, and a resolver can use the paths it
returns to carry information from one call to the next.
The resolver must return a NULL-terminated array of file paths,
the table files that make up the table in the order in which they are
to be compiled, or NULL if the table cannot be resolved. A
table named in an include, passed to lou_indexTables or
passed to lou_getTableInfo must resolve to exactly one file.
The paths must be openable by liblouis with fopen. liblouis
copies the array and its strings as soon as the call returns and never
frees them, so the resolver keeps ownership of the memory it returns
and may free or reuse it on its next invocation.
Passing NULL is rejected with an error message and leaves the
current resolver in place. There is no function to restore the
default resolver.