Built-in functions test certain conditions at either read-time or run-time. They are used in expressions with the conditional constructs. The following built-in functions are available:

ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³Function Name                 ³Description                   ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%defined(macro)               ³Returns 1 if macro is defined;³
³                              ³0 otherwise                   ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%dir(dirspec)                 ³Returns 1 if dirspec specifies³
³                              ³a valid and existing          ³
³                              ³directory; 0 otherwise        ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%exist(filespec)              ³Returns 1 if filespec exists  ³
³                              ³(as a file or directory); 0   ³
³                              ³otherwise                     ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%exists(filespec)             ³Is a synonym for %exist(      ³
³                              ³filespec)                     ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%file(filespec)               ³Returns 1 if filespec         ³
³                              ³specifies a valid and existing³
³                              ³file; 0 otherwise             ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%member(word, word_list)      ³Returns 1 if word is contained³
³                              ³-- as a separate, blank       ³
³                              ³delimited word -- in word_list³
³                              ³; 0 otherwise. The search is  ³
³                              ³case-insensitive.             ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%status()                     ³Returns the return code of the³
³                              ³last user command invoked.    ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³%writable(filespec)           ³Returns 1 if filespec         ³
³                              ³specifies a valid and existing³
³                              ³directory or file that is not ³
³                              ³read-only; 0 otherwise.       ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

Example:

Built-in functions can be used just like other values in expressions:

     !if %defined(macro1) && ("$(macro2)" == "ON") &&
         %exists($(target))

This directive is evaluated to non-zero if macro1 is defined, macro2 has the definition "ON", and the file name defined in the macro target exists as a file or directory.


[Back] [Next]