Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
cfee93b0
Commit
cfee93b0
authored
6 years ago
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
preprocessor: submodule update: macro functions
parent
ec3e32a1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/dynare.texi
+22
-11
22 additions, 11 deletions
doc/dynare.texi
preprocessor
+1
-1
1 addition, 1 deletion
preprocessor
with
23 additions
and
12 deletions
doc/dynare.texi
+
22
−
11
View file @
cfee93b0
...
@@ -10587,8 +10587,8 @@ strings.
...
@@ -10587,8 +10587,8 @@ strings.
It is possible to construct macro-expressions which can be assigned to
It is possible to construct macro-expressions which can be assigned to
macro-variables or used within a macro-directive. The expressions are
macro-variables or used within a macro-directive. The expressions are
constructed using literals of
the four
basic types (integers, strings,
constructed using literals of
five
basic types (integers, strings,
arrays of
arrays of
strings, arrays of integers), macro-variable
s
names and
strings, arrays of integers
, and string functions
), macro-variable names
,
and
standard operators.
standard operators.
String literals have to be enclosed between @strong{double} quotes
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:
...
@@ -10651,6 +10651,14 @@ getting the length of an array: @code{length} operator (for example:
@code{[1,2,3]})
@code{[1,2,3]})
@end itemize
@end itemize
The following operators can be used on string functions:
@itemize
@item
comparison operators: @code{==}, @code{!=}
@item
concatenation of two strings: @code{+}
@end itemize
Macro-expressions can be used at two places:
Macro-expressions can be used at two places:
@itemize
@itemize
@item
@item
...
@@ -10706,7 +10714,7 @@ file will be searched for in the folders provided by @ref{-I} and
...
@@ -10706,7 +10714,7 @@ file will be searched for in the folders provided by @ref{-I} and
@end deffn
@end deffn
@deffn {Macro directive} @@#define @var{MACRO_VARIABLE} = @var{MACRO_EXPRESSION}
@deffn {Macro directive} @@#define @var{MACRO_VARIABLE} = @var{MACRO_EXPRESSION}
Defines a macro-variable
.
Defines a macro-variable
or macro-function
@customhead{Example 1}
@customhead{Example 1}
@example
@example
...
@@ -10716,6 +10724,8 @@ Defines a macro-variable.
...
@@ -10716,6 +10724,8 @@ Defines a macro-variable.
@@#define w = [ "US", "EA" ] // String array
@@#define w = [ "US", "EA" ] // String array
@@#define z = 3 + v[2] // Equals 5
@@#define z = 3 + v[2] // Equals 5
@@#define t = ("US" in w) // Equals 1 (true)
@@#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
@end example
@customhead{Example 2}
@customhead{Example 2}
...
@@ -10723,15 +10733,16 @@ Defines a macro-variable.
...
@@ -10723,15 +10733,16 @@ Defines a macro-variable.
@example
@example
@@#define x = [ "B", "C" ]
@@#define x = [ "B", "C" ]
@@#define i = 2
@@#define i = 2
@@#define f(x) = " + @@@{x@}"
model;
model;
A = @@@{x[i]@};
A = @@@{x[i]
+ f("D")
@};
end;
end;
@end example
@end example
is strictly equivalent to:
is strictly equivalent to:
@example
@example
model;
model;
A = C;
A = C
+ D
;
end;
end;
@end example
@end example
...
...
This diff is collapsed.
Click to expand it.
preprocessor
@
24455239
Compare
e376267a
...
24455239
Subproject commit
e376267a2867aff79989503f77a2fd2204ed9c8b
Subproject commit
244552393baec541e0d02a2c378a21a6c9409989
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment