Predefined functions can be used to perform text processing operations, operate on file specifications and determine the origin of macros. Note that, predefined functions can only be used if extended syntax has been enabled (use /EXTENDED_SYNTAX qualifier when invoking MMS or, in DECwindows MMS, check the Extended Syntax check box in the Build Definitions/Directives Options dialog box). Where a parameter to a function is considered to be a list of words, a word is defined as any sequence of characters, not containing white-space characters, that is terminated by a white-space character or ')'. White-space characters are space and tab. Functions that generate word lists will produce lists that are white-space compressed (i.e. no leading or trailing spaces and a single space character between each word in the list).
1 – Text operations
The following functions perform text processing operations:
1.1 – ADDPREFIX
$(ADDPREFIX prefix,text) Prepends to text. 'prefix' is prepended to the start of each word in 'text'.
1.2 – ADDSUFFIX
$(ADDSUFFIX suffix,text) Appends to text. 'suffix' is appended to the end of each word in 'text'.
1.3 – FILTER
$(FILTER pattern...,text) Filters text. Any word in 'text' that does not match any 'pattern' word is removed. 'pattern' words may contain the wildcard characters * and %.
1.4 – FILTER-OUT
$(FILTER-OUT pattern...,text) Filters text. Any word in 'text' that matches any 'pattern' word is removed. 'pattern' words may contain the wildcard characters * and %.
1.5 – FINDSTRING
$(FINDSTRING find,text) String search. If 'find' occurs in 'text', the value is 'find'; otherwise, the value is empty.
1.6 – FIRSTWORD
$(FIRSTWORD text) Returns the first word in 'text'.
1.7 – FOREACH
$(FOREACH macro,list,text) Repeatedly expands text. For each word in 'list', 'text' is repeated with the value of 'macro' defined as the word from 'list'.
1.8 – JOIN
$(JOIN list,text) Concatenates word by word. Each word in 'text' is appended to the corresponding word in 'list' to form a word in the result. When the number of words in 'list' and 'text' are not the same, the remaining words from the longer list are simply appended to the result.
1.9 – PATSUBST
$(PATSUBST pattern...,to,text) Pattern substitution. Each word in 'text' that matches any 'pattern' word is replaced by 'to'. 'pattern' words may contain the wildcard characters * and %. If 'to' also contains wildcard characters, they will be replaced by the text that matched the wildcard characters in 'pattern'.
1.10 – SORT
$(SORT text) Sorts text. Words in 'text' are sorted into lexical order; duplicated words are removed.
1.11 – STRIP
$(STRIP text) White-space compression. Leading and trailing white-space is removed from 'text' and each internal sequence of white-space characters is replaced by a single space.
1.12 – SUBST
$(SUBST from,to,text) String substitution. Each occurrence of 'from' in 'text' is replaced by 'to'.
1.13 – WORD
$(WORD n,text) Returns the n'th word from 'text'. 'n' should be in the range 1 to the number of words in the list; when 'n' is not in this range, the result is empty.
1.14 – WORDS
$(WORDS text) Returns the number of words in 'text'.
2 – File operations
The following functions operate on file specifications; each has a single parameter which is a list of words where each word is considered to be a file specification:
2.1 – BASENAME
$(BASENAME text) Returns directory and name part. For each file specification in 'text', returns that part of the file specification that is not the type or version.
2.2 – DIR
$(DIR text) Returns directory part. For each file specification in 'text', returns that part of the file specification that is not the name, type or version.
2.3 – FILETYPE
$(FILETYPE text) Returns type part. For each file specification in 'text', returns the type part of the file specification.
2.4 – FILEVERSION
$(FILEVERSION text) Returns version part. For each file specification in 'text', returns the version part of the file specification.
2.5 – NOTDIR
$(NOTDIR text) Returns name/type part. For each file specification in 'text', returns the name and type part of the file specification.
2.6 – WILDCARD
$(WILDCARD text) File search. Result is the name and type part of all existing files that match any of the file specifications in 'text'. The file specifications may contain the wildcard characters * and %.
3 – Other operations
Other miscellaneous operations:
3.1 – ORIGIN
$(ORIGIN macro) Result is the origin of 'macro' as follows: "FILE" defined in a description file "COMMAND LINE" defined on the command line "SPECIAL" a special macro "DEFAULT" a default macro "CLI SYMBOL" a CLI symbol "TEMPORARY" defined by function FOREACH "UNDEFINED" 'macro' is not defined