Next: , Previous: , Up: silex syntax   [Index]


53.5.2 Including macro files

The special syntax:

%[pathname]

can be used to include a macro definition file whose pathname is pathname, which can be any string not including the ‘]’ character; the pathname is handled as follows:

  1. If pathname is absolute, test its existence: when found, convert it to a string representing the real, absolute file pathname.
  2. If pathname is relative and it has a directory part, test its existence from the current process working directory: when found, convert it to a string representing the real, absolute file pathname.
  3. If pathname is relative and it has no directory part, read the system environment variable SILEX_PATH as colon–separated list of directories and search the file in them, from the first to the last: when found, convert it to a string representing the real, absolute file pathname.

    Notice that the file is searched in the process’ current working directory only if such directory is listed in the given path.

the result of converting ?pathname to a real, absolute pathname is handed as is to open-input-file. If the file is not found: an exception is raised.

Two macros with the same name are allowed if they have the same regexp specification, this allows an include file to be loaded multiple times. Recursive inclusion of files is detected by comparing real, absolute file pathnames.