Skip to content

Miscellaneous Functionality

Urs Liska edited this page Jul 5, 2017 · 1 revision

As mentioned oll-core makes many built-in functions available that are initially created for internal use in openLilyLib, Option handling and logging are only two of them.

There is no possibility to document everything in this Wiki (please hope for the creation of the autogenerated complete documentation ...), so this page will only give a rough overview of some possibilities.

os-path

An interesting moduĺe is os-path, inspired by the similar Python module. It can perform many path operations, for example normalizing paths, producing strings joining path elements with slashes or dots etc. It also provides functions to extract paths from LilyPond's location objects.

Note that internally all functions work on lists which can be turned into strings with os-path-join (using the current OS convention), os-path-join-unix (using slashes) or os-path-join-dots.

(this-file), (this-dir) and (this-parent) can be used to determine the absolute filename, enclosing or parent directory of the file where the command is used:

% in file /home/myuser/lily-score/main.ly:

#(this-file)   % => /home/myuser/lily-score/main.ly
#(this-dir)    % => /home/myuser/lily-score
#(this-parent) % => /home/myuser
% (all as lists)

For access to the full functionality please read the source file internal/os-path.ily.

include-pattern Module

\loadModule oll-core.include-pattern provides the command \includePattern which makes it possible to load a number of files (matching a pattern) from a directory.

Miscellaneous Scheme modules

There are a number of Scheme modules in the scheme/oll-core/internal directory. These are all loaded implicitly, and the functions exported in them are all available after including oll-core.

The most interesting modules to have a look at right now are file-handling and lilypond-version-predicates.