aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_math.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-01 21:10:07 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-11-01 21:10:07 +0000
commitb1f91b97d2085cc845d0f57bd9907de50c995105 (patch)
tree9c836ac808552d20be6bd2baa3a3c29f642eda53 /funcs/func_math.c
parentc5d084051f21e943fcbcc347fc80b166885f298d (diff)
Merge changes from team/group/appdocsxml
This commit introduces the first phase of an effort to manage documentation of the interfaces in Asterisk in an XML format. Currently, a new format is available for applications and dialplan functions. A good number of conversions to the new format are also included. For more information, see the following message to asterisk-dev: http://lists.digium.com/pipermail/asterisk-dev/2008-October/034968.html git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153365 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_math.c')
-rw-r--r--funcs/func_math.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/funcs/func_math.c b/funcs/func_math.c
index 3517b16ed..627cf860a 100644
--- a/funcs/func_math.c
+++ b/funcs/func_math.c
@@ -39,6 +39,35 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/app.h"
#include "asterisk/config.h"
+/*** DOCUMENTATION
+ <function name="MATH" language="en_US">
+ <synopsis>
+ Performs Mathematical Functions.
+ </synopsis>
+ <syntax>
+ <parameter name="expression" required="true">
+ <para>Is of the form:
+ <replaceable>number1</replaceable><replaceable>op</replaceable><replaceable>number2</replaceable>
+ where the possible values for <replaceable>op</replaceable>
+ are:</para>
+ <para>+,-,/,*,%,&lt;&lt;,&gt;&gt;,^,AND,OR,XOR,&lt;,%gt;,&gt;=,&lt;=,== (and behave as their C equivalents)</para>
+ </parameter>
+ <parameter name="type">
+ <para>Wanted type of result:</para>
+ <para>f, float - float(default)</para>
+ <para>i, int - integer</para>
+ <para>h, hex - hex</para>
+ <para>c, char - char</para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>Performs mathematicas functions based on two parameters and a operator, the returned
+ value type is <replaceable>type</replaceable></para>
+ <para>Example: Set(i=${MATH(123%16,int)}) - sets var i=11</para>
+ </description>
+ </function>
+ ***/
+
enum TypeOfFunctions {
ADDFUNCTION,
DIVIDEFUNCTION,
@@ -306,17 +335,6 @@ static int math(struct ast_channel *chan, const char *cmd, char *parse,
static struct ast_custom_function math_function = {
.name = "MATH",
- .synopsis = "Performs Mathematical Functions",
- .syntax = "MATH(<number1><op><number2>[,<type_of_result>])",
- .desc = "Perform calculation on number1 to number2. Valid ops are: \n"
- " +,-,/,*,%,<<,>>,^,AND,OR,XOR,<,>,>=,<=,==\n"
- "and behave as their C equivalents.\n"
- "<type_of_result> - wanted type of result:\n"
- " f, float - float(default)\n"
- " i, int - integer,\n"
- " h, hex - hex,\n"
- " c, char - char\n"
- "Example: Set(i=${MATH(123%16,int)}) - sets var i=11",
.read = math
};