Commit cfee93b0 authored by Houtan Bastani's avatar Houtan Bastani

preprocessor: submodule update: macro functions

parent ec3e32a1
......@@ -10587,8 +10587,8 @@ strings.
It is possible to construct macro-expressions which can be assigned to
macro-variables or used within a macro-directive. The expressions are
constructed using literals of the four basic types (integers, strings,
arrays of strings, arrays of integers), macro-variables names and
constructed using literals of five basic types (integers, strings, arrays of
strings, arrays of integers, and string functions), macro-variable names, and
standard operators.
String literals have to be enclosed between @strong{double} quotes
......@@ -10651,6 +10651,14 @@ getting the length of an array: @code{length} operator (for example:
@end itemize
The following operators can be used on string functions:
comparison operators: @code{==}, @code{!=}
concatenation of two strings: @code{+}
@end itemize
Macro-expressions can be used at two places:
......@@ -10706,7 +10714,7 @@ file will be searched for in the folders provided by @ref{-I} and
@end deffn
@deffn {Macro directive} @@#define @var{MACRO_VARIABLE} = @var{MACRO_EXPRESSION}
Defines a macro-variable.
Defines a macro-variable or macro-function
@customhead{Example 1}
......@@ -10716,6 +10724,8 @@ Defines a macro-variable.
@@#define w = [ "US", "EA" ] // String array
@@#define z = 3 + v[2] // Equals 5
@@#define t = ("US" in w) // Equals 1 (true)
@@#define f(x) = " + @@@{x@} + @@@{y@}" // Defines a function 'f' with argument 'x'
// that returns the string: ' + @@@{x@} + US'
@end example
@customhead{Example 2}
......@@ -10723,15 +10733,16 @@ Defines a macro-variable.
@@#define x = [ "B", "C" ]
@@#define i = 2
@@#define f(x) = " + @@@{x@}"
A = @@@{x[i]@};
A = @@@{x[i] + f("D")@};
@end example
is strictly equivalent to:
A = C;
A = C + D;
@end example
Subproject commit e376267a2867aff79989503f77a2fd2204ed9c8b
Subproject commit 244552393baec541e0d02a2c378a21a6c9409989
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment