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]