Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

libslax Library and Extension Libraries Overview

 

libslax Library

libslax is an open-source implementation of the SLAX language using the "New BSD License." libslax is written in C and is built on top of the libxml2, libxslt, and libexslt libraries.

The core of the libslax distribution is the libslax library, which incorporates a SLAX parser to read SLAX files, a SLAX writer to write SLAX files, a debugger, a profiler, and the SLAX processor (slaxproc) command-line tool . The parser turns a SLAX source file into an XSLT tree (xmlDocPtr) using the xsltSetLoaderFunc() hook. The writer turns an XSLT tree (xmlDocPtr) into a file containing SLAX statements.

libslax Extension Libraries

libslax provides supports for dynamically loading extension libraries. The libslax distribution includes the bit, curl, db, os, and xutil extension libraries. The source files for the default extension libraries are stored in the libslax-release/extensions directory of the distribution. You can supply additional extension libraries beyond the default extension libraries supported by the libslax distribution. Extension library locations can be specified statically at build time or dynamically at runtime.

By default, libslax installs architecture-independent files, including extension library files, in the /usr/local directories. Specifically, libslax installs the extension libraries in the /usr/local/lib/slax/extensions directory. If you do not specify a different installation directory for the extension libraries at build time, the SLAX processor checks this directory for extension libraries when executing a script.

There are several ways to specify extension library locations at build time. During installation, to specify a directory prefix other than /usr/local for all installation files, including the libraries, execute the ./configure command and include the --prefix=prefix option specifying the location to install the files. The default extension libraries are installed in the prefix/lib/slax/extensions directory, and the SLAX processor checks this directory for extension libraries when executing a script. To install just the extension library files in a different, user-defined location, execute the ./configure command and include the --with-extensions-dir=dir option specifying the location where the extension libraries live. The SLAX processor will then automatically check the specified directory for extension libraries when executing a script. For more information about installing libslax, see Downloading and Installing the libslax Distribution.

There are several ways to specify extension library locations dynamically after installation is complete. You can define or update the SLAXEXTPATH environment variable to include the directory locations of additional extension libraries. The variable value is a colon-separated list of directories. The SLAX processor automatically checks these directories for extension libraries when executing a script. Alternatively, you can specify the extension library location when you execute a script by using the slaxproc command with the --lib or -L option.

To summarize, extension library locations are supplied to the SLAX processor in one of the following ways:

  • By default, in the /usr/local/lib/slax/extensions directory.

  • In lib/slax/extensions/ under the directory specified by the ./configure --prefix option given at build time.

  • In the user-defined directory specified by the ./configure --with-extension-dir option given at build time.

  • In a directory included in the colon-separated list of the SLAXEXTPATH environment variable.

  • In a directory provided using the --lib or -L argument to the slaxproc command.