2007-09-22 17:39:37 +00:00
|
|
|
/*
|
2005-09-14 20:46:50 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2005-06-16 08:47:06 +00:00
|
|
|
*
|
2006-04-24 17:41:27 +00:00
|
|
|
* Copyright (C) 2006, Digium, Inc.
|
2005-06-16 08:47:06 +00:00
|
|
|
*
|
2006-04-24 17:41:27 +00:00
|
|
|
* Steve Murphy <murf@parsetree.com>
|
2005-06-16 08:47:06 +00:00
|
|
|
*
|
2005-09-14 20:46:50 +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-06-16 08:47:06 +00:00
|
|
|
* This program is free software, distributed under the terms of
|
2005-09-14 20:46:50 +00:00
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2006-04-24 17:41:27 +00:00
|
|
|
* \brief Compile symbolic Asterisk Extension Logic into Asterisk extensions, version 2.
|
2005-09-14 20:46:50 +00:00
|
|
|
*
|
2005-06-16 08:47:06 +00:00
|
|
|
*/
|
|
|
|
|
2007-08-15 19:21:27 +00:00
|
|
|
/*** MODULEINFO
|
|
|
|
<depend>res_ael_share</depend>
|
2011-07-14 20:28:54 +00:00
|
|
|
<support_level>extended</support_level>
|
2007-08-15 19:21:27 +00:00
|
|
|
***/
|
|
|
|
|
2006-06-07 18:54:56 +00:00
|
|
|
#include "asterisk.h"
|
|
|
|
|
2008-09-27 15:52:56 +00:00
|
|
|
#if !defined(STANDALONE)
|
2006-06-07 18:54:56 +00:00
|
|
|
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
2008-09-27 15:52:56 +00:00
|
|
|
#endif
|
2006-06-07 18:54:56 +00:00
|
|
|
|
2005-06-16 08:47:06 +00:00
|
|
|
#include <ctype.h>
|
2006-04-24 17:41:27 +00:00
|
|
|
#include <regex.h>
|
2006-04-26 22:41:16 +00:00
|
|
|
#include <sys/stat.h>
|
2005-06-17 12:56:35 +00:00
|
|
|
|
2008-12-17 05:04:56 +00:00
|
|
|
#ifdef STANDALONE
|
|
|
|
#ifdef HAVE_MTX_PROFILE
|
|
|
|
static int mtx_prof = -1; /* helps the standalone compile with the mtx_prof flag on */
|
|
|
|
#endif
|
|
|
|
#endif
|
2005-06-16 08:47:06 +00:00
|
|
|
#include "asterisk/pbx.h"
|
|
|
|
#include "asterisk/config.h"
|
|
|
|
#include "asterisk/module.h"
|
|
|
|
#include "asterisk/logger.h"
|
|
|
|
#include "asterisk/cli.h"
|
2006-04-24 17:41:27 +00:00
|
|
|
#include "asterisk/app.h"
|
2005-06-16 08:47:06 +00:00
|
|
|
#include "asterisk/callerid.h"
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
#include "asterisk/hashtab.h"
|
2006-04-24 17:41:27 +00:00
|
|
|
#include "asterisk/ael_structs.h"
|
2007-08-15 19:21:27 +00:00
|
|
|
#include "asterisk/pval.h"
|
2006-04-24 17:41:27 +00:00
|
|
|
#ifdef AAL_ARGCHECK
|
|
|
|
#include "asterisk/argdesc.h"
|
|
|
|
#endif
|
2005-06-16 08:47:06 +00:00
|
|
|
|
Merged revisions 310462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r310462 | tilghman | 2011-03-12 14:27:54 -0600 (Sat, 12 Mar 2011) | 45 lines
Merged revisions 310448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r310448 | tilghman | 2011-03-12 14:24:54 -0600 (Sat, 12 Mar 2011) | 38 lines
Recorded merge of revisions 310435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r310435 | tilghman | 2011-03-12 14:22:07 -0600 (Sat, 12 Mar 2011) | 31 lines
Add AELSub, which provides a stable entry point into AEL subroutines.
This commit needs some explanation, given that we're adding a new application
into an existing release branch. This is generally a violation of our release
policy, except in very limited circumstances, and I believe this is one of
those circumstances.
The problem that this solves is one of the sanity of using multiple dialplan
languages to define a dialplan. In the case of the reporter, he or she is
using AEL is define subroutines, while using Realtime extensions to invoke
those subroutines. While you can do this, it's based upon the reality of AEL
using actual dialplan extensions; however, there is no guarantee that the
details of _how_ AEL is compiled into extensions will remain stable. In fact,
at the time of this commit, it has already changed twice, once in a
fundamental way.
Now normally, a new application would only be added to trunk. However, this
application is explicitly to create a stable user-level API between versions,
and adding it to trunk only will not solve the user's problem of switching
between 1.6.2 and 1.8, nor will it help anybody switching from 1.8 to 1.10.
Therefore, it needs to go into existing release branches. For the sake of
consistency, and also because one of the changes was between 1.4 and 1.6.x,
I am also electing to commit this to 1.4.
(closes issue #18910)
Reported by: alexandrekeller
Patches:
20110304__issue18919__1.6.2.diff.txt uploaded by tilghman (license 14)
20110304__issue18919__1.4.diff.txt uploaded by tilghman (license 14)
Tested by: alexandrekeller
........
................
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-12 20:42:33 +00:00
|
|
|
/*** DOCUMENTATION
|
|
|
|
<application name="AELSub" language="en_US">
|
|
|
|
<synopsis>
|
|
|
|
Launch subroutine built with AEL
|
|
|
|
</synopsis>
|
|
|
|
<syntax>
|
|
|
|
<parameter name="routine" required="true">
|
|
|
|
<para>Named subroutine to execute.</para>
|
|
|
|
</parameter>
|
|
|
|
<parameter name="args" required="false" />
|
|
|
|
</syntax>
|
|
|
|
<description>
|
|
|
|
<para>Execute the named subroutine, defined in AEL, from another dialplan
|
|
|
|
language, such as extensions.conf, Realtime extensions, or Lua.</para>
|
|
|
|
<para>The purpose of this application is to provide a sane entry point into
|
|
|
|
AEL subroutines, the implementation of which may change from time to time.</para>
|
|
|
|
</description>
|
|
|
|
</application>
|
|
|
|
***/
|
|
|
|
|
2006-04-24 17:41:27 +00:00
|
|
|
/* these functions are in ../ast_expr2.fl */
|
2005-06-16 08:47:06 +00:00
|
|
|
|
|
|
|
#define DEBUG_READ (1 << 0)
|
|
|
|
#define DEBUG_TOKENS (1 << 1)
|
|
|
|
#define DEBUG_MACROS (1 << 2)
|
|
|
|
#define DEBUG_CONTEXTS (1 << 3)
|
|
|
|
|
|
|
|
static char *config = "extensions.ael";
|
|
|
|
static char *registrar = "pbx_ael";
|
2006-08-25 20:43:51 +00:00
|
|
|
static int pbx_load_module(void);
|
2006-04-24 17:41:27 +00:00
|
|
|
|
|
|
|
#ifndef AAL_ARGCHECK
|
|
|
|
/* for the time being, short circuit all the AAL related structures
|
|
|
|
without permanently removing the code; after/during the AAL
|
|
|
|
development, this code can be properly re-instated
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AAL_ARGCHECK
|
|
|
|
int option_matches_j( struct argdesc *should, pval *is, struct argapp *app);
|
|
|
|
int option_matches( struct argdesc *should, pval *is, struct argapp *app);
|
|
|
|
int ael_is_funcname(char *name);
|
2005-06-16 08:47:06 +00:00
|
|
|
#endif
|
2006-04-24 17:41:27 +00:00
|
|
|
|
|
|
|
int check_app_args(pval *appcall, pval *arglist, struct argapp *app);
|
2006-07-19 02:55:24 +00:00
|
|
|
void check_pval(pval *item, struct argapp *apps, int in_globals);
|
|
|
|
void check_pval_item(pval *item, struct argapp *apps, int in_globals);
|
2006-04-24 17:41:27 +00:00
|
|
|
void check_switch_expr(pval *item, struct argapp *apps);
|
|
|
|
void ast_expr_register_extra_error_info(char *errmsg);
|
|
|
|
void ast_expr_clear_extra_error_info(void);
|
|
|
|
struct pval *find_macro(char *name);
|
|
|
|
struct pval *find_context(char *name);
|
|
|
|
struct pval *find_context(char *name);
|
|
|
|
struct pval *find_macro(char *name);
|
|
|
|
struct ael_priority *new_prio(void);
|
|
|
|
struct ael_extension *new_exten(void);
|
|
|
|
void destroy_extensions(struct ael_extension *exten);
|
|
|
|
void set_priorities(struct ael_extension *exten);
|
2006-08-07 12:59:47 +00:00
|
|
|
void add_extensions(struct ael_extension *exten);
|
2010-06-18 21:32:09 +00:00
|
|
|
int ast_compile_ael2(struct ast_context **local_contexts, struct ast_hashtab *local_table, struct pval *root);
|
2006-04-24 17:41:27 +00:00
|
|
|
void destroy_pval(pval *item);
|
|
|
|
void destroy_pval_item(pval *item);
|
|
|
|
int is_float(char *arg );
|
|
|
|
int is_int(char *arg );
|
|
|
|
int is_empty(char *arg);
|
|
|
|
|
2007-07-26 01:33:55 +00:00
|
|
|
/* static void substitute_commas(char *str); */
|
2006-08-25 20:43:51 +00:00
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int aeldebug = 0;
|
|
|
|
|
2006-04-24 17:41:27 +00:00
|
|
|
/* interface stuff */
|
2005-06-16 08:47:06 +00:00
|
|
|
|
Merged revisions 310462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r310462 | tilghman | 2011-03-12 14:27:54 -0600 (Sat, 12 Mar 2011) | 45 lines
Merged revisions 310448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r310448 | tilghman | 2011-03-12 14:24:54 -0600 (Sat, 12 Mar 2011) | 38 lines
Recorded merge of revisions 310435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r310435 | tilghman | 2011-03-12 14:22:07 -0600 (Sat, 12 Mar 2011) | 31 lines
Add AELSub, which provides a stable entry point into AEL subroutines.
This commit needs some explanation, given that we're adding a new application
into an existing release branch. This is generally a violation of our release
policy, except in very limited circumstances, and I believe this is one of
those circumstances.
The problem that this solves is one of the sanity of using multiple dialplan
languages to define a dialplan. In the case of the reporter, he or she is
using AEL is define subroutines, while using Realtime extensions to invoke
those subroutines. While you can do this, it's based upon the reality of AEL
using actual dialplan extensions; however, there is no guarantee that the
details of _how_ AEL is compiled into extensions will remain stable. In fact,
at the time of this commit, it has already changed twice, once in a
fundamental way.
Now normally, a new application would only be added to trunk. However, this
application is explicitly to create a stable user-level API between versions,
and adding it to trunk only will not solve the user's problem of switching
between 1.6.2 and 1.8, nor will it help anybody switching from 1.8 to 1.10.
Therefore, it needs to go into existing release branches. For the sake of
consistency, and also because one of the changes was between 1.4 and 1.6.x,
I am also electing to commit this to 1.4.
(closes issue #18910)
Reported by: alexandrekeller
Patches:
20110304__issue18919__1.6.2.diff.txt uploaded by tilghman (license 14)
20110304__issue18919__1.4.diff.txt uploaded by tilghman (license 14)
Tested by: alexandrekeller
........
................
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-12 20:42:33 +00:00
|
|
|
#ifndef STANDALONE
|
|
|
|
static char *aelsub = "AELSub";
|
|
|
|
|
|
|
|
static int aelsub_exec(struct ast_channel *chan, const char *vdata)
|
|
|
|
{
|
|
|
|
char buf[256], *data = ast_strdupa(vdata);
|
|
|
|
struct ast_app *gosub = pbx_findapp("Gosub");
|
|
|
|
AST_DECLARE_APP_ARGS(args,
|
|
|
|
AST_APP_ARG(name);
|
|
|
|
AST_APP_ARG(args);
|
|
|
|
);
|
|
|
|
|
|
|
|
if (gosub) {
|
|
|
|
AST_STANDARD_RAW_ARGS(args, data);
|
|
|
|
snprintf(buf, sizeof(buf), "%s,~~s~~,1(%s)", args.name, args.args);
|
|
|
|
return pbx_exec(chan, gosub, buf);
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-08-25 20:43:51 +00:00
|
|
|
/* if all the below are static, who cares if they are present? */
|
|
|
|
|
2006-04-24 17:41:27 +00:00
|
|
|
static int pbx_load_module(void)
|
2005-06-16 08:47:06 +00:00
|
|
|
{
|
2007-10-01 23:03:50 +00:00
|
|
|
int errs=0, sem_err=0, sem_warn=0, sem_note=0;
|
2005-06-16 08:47:06 +00:00
|
|
|
char *rfilename;
|
2006-04-24 17:41:27 +00:00
|
|
|
struct ast_context *local_contexts=NULL, *con;
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
struct ast_hashtab *local_table=NULL;
|
|
|
|
|
2006-04-24 17:41:27 +00:00
|
|
|
struct pval *parse_tree;
|
2005-06-16 08:47:06 +00:00
|
|
|
|
2014-03-21 15:50:11 +00:00
|
|
|
ast_debug(1, "Starting AEL load process.\n");
|
2006-04-24 17:41:27 +00:00
|
|
|
if (config[0] == '/')
|
|
|
|
rfilename = (char *)config;
|
2005-06-16 08:47:06 +00:00
|
|
|
else {
|
2012-07-31 20:21:43 +00:00
|
|
|
rfilename = ast_alloca(strlen(config) + strlen(ast_config_AST_CONFIG_DIR) + 2);
|
2006-04-24 17:41:27 +00:00
|
|
|
sprintf(rfilename, "%s/%s", ast_config_AST_CONFIG_DIR, config);
|
2005-06-16 08:47:06 +00:00
|
|
|
}
|
2006-09-22 21:17:07 +00:00
|
|
|
if (access(rfilename,R_OK) != 0) {
|
|
|
|
ast_log(LOG_NOTICE, "File %s not found; AEL declining load\n", rfilename);
|
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
|
|
|
}
|
2005-06-16 08:47:06 +00:00
|
|
|
|
2006-04-24 17:41:27 +00:00
|
|
|
parse_tree = ael2_parse(rfilename, &errs);
|
2014-03-21 15:50:11 +00:00
|
|
|
ast_debug(1, "AEL load process: parsed config file name '%s'.\n", rfilename);
|
2006-04-24 17:41:27 +00:00
|
|
|
ael2_semantic_check(parse_tree, &sem_err, &sem_warn, &sem_note);
|
|
|
|
if (errs == 0 && sem_err == 0) {
|
2014-03-21 15:50:11 +00:00
|
|
|
ast_debug(1, "AEL load process: checked config file name '%s'.\n", rfilename);
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
local_table = ast_hashtab_create(11, ast_hashtab_compare_contexts, ast_hashtab_resize_java, ast_hashtab_newsize_java, ast_hashtab_hash_contexts, 0);
|
2010-06-18 21:32:09 +00:00
|
|
|
if (ast_compile_ael2(&local_contexts, local_table, parse_tree)) {
|
|
|
|
ast_log(LOG_ERROR, "AEL compile failed! Aborting.\n");
|
|
|
|
destroy_pval(parse_tree); /* free up the memory */
|
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
|
|
|
}
|
2014-03-21 15:50:11 +00:00
|
|
|
ast_debug(1, "AEL load process: compiled config file name '%s'.\n", rfilename);
|
2006-04-24 17:41:27 +00:00
|
|
|
|
(closes issue #6002)
Reported by: rizzo
Tested by: murf
Proposal of the changes to be made, and then an announcement of how they were accomplished:
http://lists.digium.com/pipermail/asterisk-dev/2008-February/032065.html
and:
http://lists.digium.com/pipermail/asterisk-dev/2008-March/032124.html
Here is a recap, file by file, of what I have done:
pbx/pbx_config.c
pbx/pbx_ael.c
All funcs that were passed a ptr to the context list, now will ALSO be passed a hashtab ptr to the same set.
Why? because (for the time being), the dialplan is stored in both, to facilitate a quick, low-cost move to
hash-tables to speed up dialplan processing. If it was deemed necessary to pass the context LIST, well, it
is just as necessary to have the TABLE available. This is because the list/table in question might not be
the global one, but temporary ones we would use to stage the dialplan on, and then swap into the global
position when things are ready.
We now have one external function for apps to use, "ast_context_find_or_create()" instead of the pre-existing
"find" and "create", as all existing usages used both in tandem anyway.
pbx_config, and pbx_ael, will stage the reloaded dialplan into local lists and tables, and
then call merge_contexts_and_delete, which will merge (now) existing contexts and
priorities from other registrars into this local set by copying them. Then, merge_contexts_and_delete will
lock down the contexts, swap the lists and tables, and unlock (real quick), and then
destroy the old dialplan.
chan_sip.c
chan_iax.c
chan_skinny.c
All the channel drivers that would add regcontexts now use the ast_context_find_or_create now.
chan_sip also includes a small fix to get rid of warnings about removing priorities that never got entered.
apps/app_meetme.c
apps/app_dial.c
apps/app_queue.c
All the apps that added a context/exten/priority were also modified to use ast_context_find_or_create instead.
include/asterisk/pbx.h
ast_context_create() is removed. Find_or_create_ is the new method.
ast_context_find_or_create() interface gets the hashtab added.
ast_merge_contexts_and_delete() gets the local hashtab arg added.
ast_wrlock_contexts_version() is added so you can detect if someone else got a writelock between your readlocking and writelocking.
ast_hashtab_compare_contexts was made public for use in pbx_config/pbx_ael
ast_hashtab_hash_contexts was in like fashion make public.
include/asterisk/pval.h
ast_compile_ael2() interface changed to include the local hashtab table ptr.
main/features.c
For the sake of the parking context, we use ast_context_find_or_create().
main/pbx.c
I changed all the "tree" names to "table" instead. That's because the original
implementation was based on binary trees. (had a free library). Then I moved
to hashtabs. Now, the names move forward too.
refcount field added to contexts, so you can keep track of how many modules
wanted this context to exist.
Some log messages that are warnings were inflated from LOG_NOTICE to LOG_WARNING.
Added some calls to ast_verb(3,...) for debug messages
Lots of little mods to ast_context_remove_extension2, which is now excersized in ways
it was not previously; one definite bug fixed.
find_or_create was upgraded to handle both local lists/tables as well as the globals.
context_merge() was added to do the per-context merging of the old/present contexts/extens/prios into the new/proposed local list/tables
ast_merge_contexts_and_delete() was heavily modified.
ast_add_extension2() was also upgraded to handle changes.
the context_destroy() code was re-engineered to handle the new way of doing things,
by exten/prio instead of by context.
res/ael/pval.c
res/ael/ael.tab.c
res/ael/ael.tab.h
res/ael/ael.y
res/ael/ael_lex.c
res/ael/ael.flex
utils/ael_main.c
utils/extconf.c
utils/conf2ael.c
utils/Makefile
Had to change the interface to ast_compile_ael2(), to include the hashtab ptr.
This ended up involving several external apps. The main gotcha was I had to
include lock.h and hashtab.h in several places.
As a side note, I tested this stuff pretty thoroughly, I replicated the problems
originally reported by Luigi, and made triply sure that reloads worked, and everything
worked thru "stop gracefully". I found a and fixed a few bugs as I was merging into
trunk, that did not appear in my tests of bug6002.
How's this for verbose commit messages?
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106757 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-03-07 18:57:57 +00:00
|
|
|
ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);
|
|
|
|
local_table = NULL; /* it's the dialplan global now */
|
|
|
|
local_contexts = NULL;
|
2014-03-21 15:50:11 +00:00
|
|
|
ast_debug(1, "AEL load process: merged config file name '%s'.\n", rfilename);
|
2006-04-24 17:41:27 +00:00
|
|
|
for (con = ast_walk_contexts(NULL); con; con = ast_walk_contexts(con))
|
|
|
|
ast_context_verify_includes(con);
|
2014-03-21 15:50:11 +00:00
|
|
|
ast_debug(1, "AEL load process: verified config file name '%s'.\n", rfilename);
|
2006-04-24 17:41:27 +00:00
|
|
|
} else {
|
|
|
|
ast_log(LOG_ERROR, "Sorry, but %d syntax errors and %d semantic errors were detected. It doesn't make sense to compile.\n", errs, sem_err);
|
2006-09-22 21:34:04 +00:00
|
|
|
destroy_pval(parse_tree); /* free up the memory */
|
2007-03-27 18:21:50 +00:00
|
|
|
return AST_MODULE_LOAD_DECLINE;
|
2005-06-16 08:47:06 +00:00
|
|
|
}
|
2006-04-24 17:41:27 +00:00
|
|
|
destroy_pval(parse_tree); /* free up the memory */
|
|
|
|
|
2006-09-22 21:34:04 +00:00
|
|
|
return AST_MODULE_LOAD_SUCCESS;
|
2005-06-16 08:47:06 +00:00
|
|
|
}
|
|
|
|
|
2005-10-13 15:36:29 +00:00
|
|
|
/* CLI interface */
|
2008-02-08 21:26:32 +00:00
|
|
|
static char *handle_cli_ael_set_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
{
|
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "ael set debug {read|tokens|macros|contexts|off}";
|
|
|
|
e->usage =
|
2008-12-18 21:21:44 +00:00
|
|
|
"Usage: ael set debug {read|tokens|macros|contexts|off}\n"
|
2008-02-08 21:26:32 +00:00
|
|
|
" Enable AEL read, token, macro, or context debugging,\n"
|
|
|
|
" or disable all AEL debugging messages. Note: this\n"
|
|
|
|
" currently does nothing.\n";
|
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a->argc != e->args)
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
|
|
|
|
if (!strcasecmp(a->argv[3], "read"))
|
|
|
|
aeldebug |= DEBUG_READ;
|
|
|
|
else if (!strcasecmp(a->argv[3], "tokens"))
|
|
|
|
aeldebug |= DEBUG_TOKENS;
|
|
|
|
else if (!strcasecmp(a->argv[3], "macros"))
|
|
|
|
aeldebug |= DEBUG_MACROS;
|
|
|
|
else if (!strcasecmp(a->argv[3], "contexts"))
|
|
|
|
aeldebug |= DEBUG_CONTEXTS;
|
|
|
|
else if (!strcasecmp(a->argv[3], "off"))
|
|
|
|
aeldebug = 0;
|
|
|
|
else
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2007-10-11 19:03:06 +00:00
|
|
|
static char *handle_cli_ael_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
2005-10-13 15:36:29 +00:00
|
|
|
{
|
2007-10-11 19:03:06 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case CLI_INIT:
|
|
|
|
e->command = "ael reload";
|
|
|
|
e->usage =
|
|
|
|
"Usage: ael reload\n"
|
|
|
|
" Reloads AEL configuration.\n";
|
|
|
|
return NULL;
|
|
|
|
case CLI_GENERATE:
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-10-13 15:36:29 +00:00
|
|
|
|
2007-10-11 19:03:06 +00:00
|
|
|
if (a->argc != 2)
|
|
|
|
return CLI_SHOWUSAGE;
|
2005-10-13 15:36:29 +00:00
|
|
|
|
2007-10-11 19:03:06 +00:00
|
|
|
return (pbx_load_module() ? CLI_FAILURE : CLI_SUCCESS);
|
2005-10-13 15:36:29 +00:00
|
|
|
}
|
|
|
|
|
2006-09-18 19:54:18 +00:00
|
|
|
static struct ast_cli_entry cli_ael[] = {
|
2008-02-08 21:26:32 +00:00
|
|
|
AST_CLI_DEFINE(handle_cli_ael_reload, "Reload AEL configuration"),
|
2008-11-12 06:46:04 +00:00
|
|
|
AST_CLI_DEFINE(handle_cli_ael_set_debug, "Enable AEL debugging flags")
|
2005-10-13 15:36:29 +00:00
|
|
|
};
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int unload_module(void)
|
2005-06-16 08:47:06 +00:00
|
|
|
{
|
|
|
|
ast_context_destroy(NULL, registrar);
|
2008-12-05 10:31:25 +00:00
|
|
|
ast_cli_unregister_multiple(cli_ael, ARRAY_LEN(cli_ael));
|
Merged revisions 310462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r310462 | tilghman | 2011-03-12 14:27:54 -0600 (Sat, 12 Mar 2011) | 45 lines
Merged revisions 310448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r310448 | tilghman | 2011-03-12 14:24:54 -0600 (Sat, 12 Mar 2011) | 38 lines
Recorded merge of revisions 310435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r310435 | tilghman | 2011-03-12 14:22:07 -0600 (Sat, 12 Mar 2011) | 31 lines
Add AELSub, which provides a stable entry point into AEL subroutines.
This commit needs some explanation, given that we're adding a new application
into an existing release branch. This is generally a violation of our release
policy, except in very limited circumstances, and I believe this is one of
those circumstances.
The problem that this solves is one of the sanity of using multiple dialplan
languages to define a dialplan. In the case of the reporter, he or she is
using AEL is define subroutines, while using Realtime extensions to invoke
those subroutines. While you can do this, it's based upon the reality of AEL
using actual dialplan extensions; however, there is no guarantee that the
details of _how_ AEL is compiled into extensions will remain stable. In fact,
at the time of this commit, it has already changed twice, once in a
fundamental way.
Now normally, a new application would only be added to trunk. However, this
application is explicitly to create a stable user-level API between versions,
and adding it to trunk only will not solve the user's problem of switching
between 1.6.2 and 1.8, nor will it help anybody switching from 1.8 to 1.10.
Therefore, it needs to go into existing release branches. For the sake of
consistency, and also because one of the changes was between 1.4 and 1.6.x,
I am also electing to commit this to 1.4.
(closes issue #18910)
Reported by: alexandrekeller
Patches:
20110304__issue18919__1.6.2.diff.txt uploaded by tilghman (license 14)
20110304__issue18919__1.4.diff.txt uploaded by tilghman (license 14)
Tested by: alexandrekeller
........
................
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-12 20:42:33 +00:00
|
|
|
#ifndef STANDALONE
|
|
|
|
ast_unregister_application(aelsub);
|
|
|
|
#endif
|
2005-06-16 08:47:06 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int load_module(void)
|
2005-10-13 15:36:29 +00:00
|
|
|
{
|
2008-12-05 10:31:25 +00:00
|
|
|
ast_cli_register_multiple(cli_ael, ARRAY_LEN(cli_ael));
|
Merged revisions 310462 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r310462 | tilghman | 2011-03-12 14:27:54 -0600 (Sat, 12 Mar 2011) | 45 lines
Merged revisions 310448 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r310448 | tilghman | 2011-03-12 14:24:54 -0600 (Sat, 12 Mar 2011) | 38 lines
Recorded merge of revisions 310435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r310435 | tilghman | 2011-03-12 14:22:07 -0600 (Sat, 12 Mar 2011) | 31 lines
Add AELSub, which provides a stable entry point into AEL subroutines.
This commit needs some explanation, given that we're adding a new application
into an existing release branch. This is generally a violation of our release
policy, except in very limited circumstances, and I believe this is one of
those circumstances.
The problem that this solves is one of the sanity of using multiple dialplan
languages to define a dialplan. In the case of the reporter, he or she is
using AEL is define subroutines, while using Realtime extensions to invoke
those subroutines. While you can do this, it's based upon the reality of AEL
using actual dialplan extensions; however, there is no guarantee that the
details of _how_ AEL is compiled into extensions will remain stable. In fact,
at the time of this commit, it has already changed twice, once in a
fundamental way.
Now normally, a new application would only be added to trunk. However, this
application is explicitly to create a stable user-level API between versions,
and adding it to trunk only will not solve the user's problem of switching
between 1.6.2 and 1.8, nor will it help anybody switching from 1.8 to 1.10.
Therefore, it needs to go into existing release branches. For the sake of
consistency, and also because one of the changes was between 1.4 and 1.6.x,
I am also electing to commit this to 1.4.
(closes issue #18910)
Reported by: alexandrekeller
Patches:
20110304__issue18919__1.6.2.diff.txt uploaded by tilghman (license 14)
20110304__issue18919__1.4.diff.txt uploaded by tilghman (license 14)
Tested by: alexandrekeller
........
................
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@310500 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2011-03-12 20:42:33 +00:00
|
|
|
#ifndef STANDALONE
|
|
|
|
ast_register_application_xml(aelsub, aelsub_exec);
|
|
|
|
#endif
|
2005-10-13 15:36:29 +00:00
|
|
|
return (pbx_load_module());
|
|
|
|
}
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
static int reload(void)
|
2005-10-13 15:36:29 +00:00
|
|
|
{
|
2005-11-13 02:19:14 +00:00
|
|
|
return pbx_load_module();
|
2005-10-13 15:36:29 +00:00
|
|
|
}
|
|
|
|
|
2008-09-27 15:52:56 +00:00
|
|
|
#ifdef STANDALONE
|
2006-08-25 20:43:51 +00:00
|
|
|
#define AST_MODULE "ael"
|
|
|
|
int ael_external_load_module(void);
|
|
|
|
int ael_external_load_module(void)
|
|
|
|
{
|
2007-08-15 19:21:27 +00:00
|
|
|
pbx_load_module();
|
|
|
|
return 1;
|
2006-08-25 20:43:51 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-08-21 02:11:39 +00:00
|
|
|
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Extension Language Compiler",
|
2014-07-25 16:47:17 +00:00
|
|
|
.support_level = AST_MODULE_SUPPORT_EXTENDED,
|
2006-08-21 02:11:39 +00:00
|
|
|
.load = load_module,
|
|
|
|
.unload = unload_module,
|
|
|
|
.reload = reload,
|
|
|
|
);
|
2006-08-25 20:43:51 +00:00
|
|
|
|
2006-04-24 17:41:27 +00:00
|
|
|
#ifdef AAL_ARGCHECK
|
2009-05-21 21:13:09 +00:00
|
|
|
static const char * const ael_funclist[] =
|
2006-04-24 17:41:27 +00:00
|
|
|
{
|
|
|
|
"AGENT",
|
|
|
|
"ARRAY",
|
|
|
|
"BASE64_DECODE",
|
|
|
|
"BASE64_ENCODE",
|
|
|
|
"CALLERID",
|
|
|
|
"CDR",
|
|
|
|
"CHANNEL",
|
|
|
|
"CHECKSIPDOMAIN",
|
|
|
|
"CHECK_MD5",
|
|
|
|
"CURL",
|
|
|
|
"CUT",
|
|
|
|
"DB",
|
|
|
|
"DB_EXISTS",
|
|
|
|
"DUNDILOOKUP",
|
|
|
|
"ENUMLOOKUP",
|
|
|
|
"ENV",
|
|
|
|
"EVAL",
|
|
|
|
"EXISTS",
|
|
|
|
"FIELDQTY",
|
|
|
|
"FILTER",
|
|
|
|
"GROUP",
|
|
|
|
"GROUP_COUNT",
|
|
|
|
"GROUP_LIST",
|
|
|
|
"GROUP_MATCH_COUNT",
|
|
|
|
"IAXPEER",
|
|
|
|
"IF",
|
|
|
|
"IFTIME",
|
|
|
|
"ISNULL",
|
|
|
|
"KEYPADHASH",
|
|
|
|
"LANGUAGE",
|
|
|
|
"LEN",
|
|
|
|
"MATH",
|
|
|
|
"MD5",
|
|
|
|
"MUSICCLASS",
|
|
|
|
"QUEUEAGENTCOUNT",
|
|
|
|
"QUEUE_MEMBER_COUNT",
|
|
|
|
"QUEUE_MEMBER_LIST",
|
|
|
|
"QUOTE",
|
|
|
|
"RAND",
|
|
|
|
"REGEX",
|
|
|
|
"SET",
|
|
|
|
"SHA1",
|
|
|
|
"SIPCHANINFO",
|
|
|
|
"SIPPEER",
|
|
|
|
"SIP_HEADER",
|
|
|
|
"SORT",
|
|
|
|
"STAT",
|
|
|
|
"STRFTIME",
|
|
|
|
"STRPTIME",
|
|
|
|
"TIMEOUT",
|
|
|
|
"TXTCIDNAME",
|
|
|
|
"URIDECODE",
|
|
|
|
"URIENCODE",
|
|
|
|
"VMCOUNT"
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int ael_is_funcname(char *name)
|
|
|
|
{
|
|
|
|
int s,t;
|
|
|
|
t = sizeof(ael_funclist)/sizeof(char*);
|
|
|
|
s = 0;
|
|
|
|
while ((s < t) && strcasecmp(name, ael_funclist[s]))
|
|
|
|
s++;
|
|
|
|
if ( s < t )
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|