aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-20 20:10:19 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-20 20:10:19 +0000
commita5df6622bcaace28f113129a214d4d102af374de (patch)
tree1cc8fd8f8e629efb3ac99e3d7a2e2618f36092b4 /doc
parentb3e46a45e6ec5d3f872a9fedf0aa7126b0eb7022 (diff)
This finishes the changes for making Macro args LOCAL to the call, and allowing users to declare local variables.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@70461 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'doc')
-rw-r--r--doc/ael.tex46
1 files changed, 46 insertions, 0 deletions
diff --git a/doc/ael.tex b/doc/ael.tex
index d675190cc..416b67e34 100644
--- a/doc/ael.tex
+++ b/doc/ael.tex
@@ -264,6 +264,7 @@ The following are keywords in the AEL language:
\item random
\item goto
\item jump
+ \item local
\item return
\item break
\item continue
@@ -368,6 +369,7 @@ First, some basic objects
| <eswitches>
| <ignorepat>
| <word> '=' <collected-word> ';'
+ | 'local' <word> '=' <collected-word> ';'
| ';'
@@ -400,6 +402,7 @@ First, some basic objects
<statement> :== '{' <statements> '}'
| <word> '=' <collected-word> ';'
+ | 'local' <word> '=' <collected-word> ';'
| 'goto' <target> ';'
| 'jump' <jumptarget> ';'
| <word> ':'
@@ -719,6 +722,49 @@ context blah {
}
\end{verbatim}
+You can declare variables in Macros, as so:
+
+\begin{verbatim}
+Macro myroutine(firstarg, secondarg)
+{
+ Myvar=1;
+ NoOp(Myvar is set to ${myvar});
+}
+\end{verbatim}
+
+\subsection{Local Variables}
+
+In 1.2, and 1.4, ALL VARIABLES are CHANNEL variables, including the function
+arguments and associated ARG1, ARG2, etc variables. Sorry.
+
+In trunk (1.6 and higher), we have made all arguments local variables to
+a macro call. They will not affect channel variables of the same name.
+This includes the ARG1, ARG2, etc variables.
+
+Users can declare their own local variables by using the keyword 'local'
+before setting them to a value;
+
+\begin{verbatim}
+Macro myroutine(firstarg, secondarg)
+{
+ local Myvar=1;
+ NoOp(Myvar is set to ${Myvar}, and firstarg is ${firstarg}, and secondarg is ${secondarg});
+}
+\end{verbatim}
+
+In the above example, Myvar, firstarg, and secondarg are all local variables,
+and will not be visible to the calling code, be it an extension, or another Macro.
+
+If you need to make a local variable within the Set() application, you can do it this way:
+
+\begin{verbatim}
+Macro myroutine(firstarg, secondarg)
+{
+ Set(LOCAL(Myvar)=1);
+ NoOp(Myvar is set to ${Myvar}, and firstarg is ${firstarg}, and secondarg is ${secondarg});
+}
+\end{verbatim}
+
\subsection{Loops}