2005-08-29 22:03:37 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2005-08-29 22:03:37 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
2005-08-29 22:03:37 +00:00
|
|
|
*
|
|
|
|
|
* Mark Spencer <markster@digium.com>
|
|
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
|
* channels for your use.
|
|
|
|
|
*
|
2005-08-29 22:03:37 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
2005-08-30 18:32:10 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
|
* at the top of the source tree.
|
2005-08-29 22:03:37 +00:00
|
|
|
*/
|
|
|
|
|
|
2007-12-11 14:17:29 +00:00
|
|
|
/*! \file
|
|
|
|
|
*
|
|
|
|
|
* ???????
|
|
|
|
|
* \todo Explain this file!
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2005-08-29 22:03:37 +00:00
|
|
|
#ifndef _ASTERISK_EXPR_H
|
|
|
|
|
#define _ASTERISK_EXPR_H
|
In regards to changes for 9508, expr2 system choking on floating point numbers, I'm adding this update to round out (no pun intended) and make this FP-capable version of the Expr2 stuff interoperate better with previous integer-only usage, by providing Functions syntax, with 20 builtin functions for floating pt to integer conversions, and some general floating point math routines that might commonly be used also. Along with this, I made it so if a function was not a builtin, it will try and find it in the ast_custom_function list, and if found, execute it and collect the results. Thus, you can call system functions like CDR(), CHANNEL(), etc, from within $\[..\] exprs, without having to wrap them in $\{...\} (curly brace) notation. Did a valgrind on the standalone and made sure there's no mem leaks. Looks good. Updated the docs, too.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@73449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-05 18:15:22 +00:00
|
|
|
#ifndef STANDALONE
|
|
|
|
|
#endif
|
2005-08-29 22:03:37 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-04-29 18:53:01 +00:00
|
|
|
/*!\brief Evaluate the given expression
|
|
|
|
|
* \param expr An expression
|
|
|
|
|
* \param buf Result buffer
|
|
|
|
|
* \param length Size of the result buffer, in bytes
|
|
|
|
|
* \param chan Channel to use for evaluating included dialplan functions, if any
|
|
|
|
|
* \return Length of the result string, in bytes
|
|
|
|
|
*/
|
In regards to changes for 9508, expr2 system choking on floating point numbers, I'm adding this update to round out (no pun intended) and make this FP-capable version of the Expr2 stuff interoperate better with previous integer-only usage, by providing Functions syntax, with 20 builtin functions for floating pt to integer conversions, and some general floating point math routines that might commonly be used also. Along with this, I made it so if a function was not a builtin, it will try and find it in the ast_custom_function list, and if found, execute it and collect the results. Thus, you can call system functions like CDR(), CHANNEL(), etc, from within $\[..\] exprs, without having to wrap them in $\{...\} (curly brace) notation. Did a valgrind on the standalone and made sure there's no mem leaks. Looks good. Updated the docs, too.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@73449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-05 18:15:22 +00:00
|
|
|
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan);
|
2005-08-29 22:03:37 +00:00
|
|
|
|
2009-04-29 18:53:01 +00:00
|
|
|
/*!\brief Evaluate the given expression
|
|
|
|
|
* \param str Dynamic result buffer
|
|
|
|
|
* \param maxlen <0 if the size of the buffer should remain constant, >0 if the size of the buffer should expand to that many bytes, maximum, or 0 for unlimited expansion of the result buffer
|
|
|
|
|
* \param chan Channel to use for evaluating included dialplan functions, if any
|
|
|
|
|
* \param expr An expression
|
|
|
|
|
* \return Length of the result string, in bytes
|
|
|
|
|
*/
|
|
|
|
|
int ast_str_expr(struct ast_str **str, ssize_t maxlen, struct ast_channel *chan, char *expr);
|
|
|
|
|
|
2005-08-29 22:03:37 +00:00
|
|
|
#if defined(__cplusplus) || defined(c_plusplus)
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif /* _ASTERISK_EXPR_H */
|